/*! For license information please see embed-aac7e407.js.LICENSE.txt */ (()=>{var e={5573:(e,t,i)=>{"use strict";var n=i(6368),o=i(7510),r="value",s="\n ",a={};function l(e){var t=Array.isArray(e);return function(i){var n=c(a.plainArray,i);if(n)return n;if(t&&i.length!==e.length)return"an array with "+e.length+" items";for(var o=0;oe.length?t:e}))}},a.equal=function(e){return function(t){if(t!==e)return JSON.stringify(e)}},a.oneOf=function(){var e=(Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments)).map((function(e){return a.equal(e)}));return a.oneOfType.apply(this,e)},a.range=function(e){var t=e[0],i=e[1];return function(e){if(c(a.number,e)||ei)return"number between "+t+" & "+i+" (inclusive)"}},a.any=function(){},a.boolean=function(e){if("boolean"!=typeof e)return"boolean"},a.number=function(e){if("number"!=typeof e)return"number"},a.plainArray=function(e){if(!Array.isArray(e))return"array"},a.plainObject=function(e){if(!n(e))return"object"},a.string=function(e){if("string"!=typeof e)return"string"},a.func=function(e){if("function"!=typeof e)return"function"},a.validate=c,a.processMessage=u,e.exports=a},8122:(e,t,i)=>{"use strict";var n=i(4329).Ak;function o(e){this.origin=e.origin||"https://api.mapbox.com",this.endpoint="events/v2",this.access_token=e.accessToken,this.version="0.2.0",this.sessionID=this.generateSessionID(),this.userAgent=this.getUserAgent(),this.options=e,this.send=this.send.bind(this),this.countries=e.countries?e.countries.split(","):null,this.types=e.types?e.types.split(","):null,this.bbox=e.bbox?e.bbox:null,this.language=e.language?e.language.split(","):null,this.limit=e.limit?+e.limit:null,this.locale=navigator.language||null,this.enableEventLogging=this.shouldEnableLogging(e),this.eventQueue=new Array,this.flushInterval=e.flushInterval||1e3,this.maxQueueSize=e.maxQueueSize||100,this.timer=this.flushInterval?setTimeout(this.flush.bind(this),this.flushInterval):null,this.lastSentInput="",this.lastSentIndex=0}o.prototype={select:function(e,t){var i=this.getSelectedIndex(e,t),n=this.getEventPayload("search.select",t);if(n.resultIndex=i,n.resultPlaceName=e.place_name,n.resultId=e.id,(i!==this.lastSentIndex||n.queryString!==this.lastSentInput)&&-1!=i&&(this.lastSentIndex=i,this.lastSentInput=n.queryString,n.queryString))return this.push(n)},start:function(e){var t=this.getEventPayload("search.start",e);if(t.queryString)return this.push(t)},keyevent:function(e,t){if(e.key&&!e.metaKey&&-1===[9,27,37,39,13,38,40].indexOf(e.keyCode)){var i=this.getEventPayload("search.keystroke",t);if(i.lastAction=e.key,i.queryString)return this.push(i)}},send:function(e,t){if(!this.enableEventLogging)return t?t():void 0;var i=this.getRequestOptions(e);this.request(i,function(e){return e?this.handleError(e,t):t?t():void 0}.bind(this))},getRequestOptions:function(e){return Array.isArray(e)||(e=[e]),{method:"POST",host:this.origin,path:this.endpoint+"?access_token="+this.access_token,headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}},getEventPayload:function(e,t){var i;i=t.options.proximity?"object"==typeof t.options.proximity?[t.options.proximity.longitude,t.options.proximity.latitude]:"ip"===t.options.proximity?[999,999]:t.options.proximity:null;var n=t._map?t._map.getZoom():void 0,o={event:e,created:+new Date,sessionIdentifier:this.sessionID,country:this.countries,userAgent:this.userAgent,language:this.language,bbox:this.bbox,types:this.types,endpoint:"mapbox.places",autocomplete:t.options.autocomplete,fuzzyMatch:t.options.fuzzyMatch,proximity:i,limit:t.options.limit,routing:t.options.routing,worldview:t.options.worldview,mapZoom:n,keyboardLocale:this.locale};return"search.select"===e?o.queryString=t.inputString:"search.select"!=e&&t._inputEl?o.queryString=t._inputEl.value:o.queryString=t.inputString,o},request:function(e,t){var i=new XMLHttpRequest;for(var n in i.onreadystatechange=function(){if(4==this.readyState)return 204==this.status?t(null):t(this.statusText)},i.open(e.method,e.host+"/"+e.path,!0),e.headers){var o=e.headers[n];i.setRequestHeader(n,o)}i.send(e.body)},handleError:function(e,t){if(t)return t(e)},generateSessionID:function(){return n()},getUserAgent:function(){return"mapbox-gl-geocoder."+this.version+"."+navigator.userAgent},getSelectedIndex:function(e,t){if(t._typeahead){var i=t._typeahead.data,n=e.id;return i.map((function(e){return e.id})).indexOf(n)}},shouldEnableLogging:function(e){return!(!1===e.enableEventLogging||e.origin&&"https://api.mapbox.com"!==e.origin||e.localGeocoder||e.filter)},flush:function(){this.eventQueue.length>0&&(this.send(this.eventQueue),this.eventQueue=new Array),this.timer&&clearTimeout(this.timer),this.flushInterval&&(this.timer=setTimeout(this.flush.bind(this),this.flushInterval))},push:function(e,t){this.eventQueue.push(e),(this.eventQueue.length>=this.maxQueueSize||t)&&this.flush()},remove:function(){this.flush()}},e.exports=o},7265:e=>{e.exports={fr:{name:"France",bbox:[[-4.59235,41.380007],[9.560016,51.148506]]},us:{name:"United States",bbox:[[-171.791111,18.91619],[-66.96466,71.357764]]},ru:{name:"Russia",bbox:[[19.66064,41.151416],[190.10042,81.2504]]},ca:{name:"Canada",bbox:[[-140.99778,41.675105],[-52.648099,83.23324]]}}},8377:e=>{function t(){}t.prototype={isSupport:function(){return Boolean(window.navigator.geolocation)},getCurrentPosition:function(){const e={enableHighAccuracy:!0};return new Promise((function(t,i){window.navigator.geolocation.getCurrentPosition(t,i,e)}))}},e.exports=t},5915:(e,t,i)=>{"use strict";var n=i(3326),o=i(181),r=i(7510),s=i(7007).EventEmitter,a=i(7265),l=i(7995),c=i(5663),u=i(8122),d=i(7906),h=i(1929),p=i(8377),m=i(2614);function f(e){this._eventEmitter=new s,this.options=r({},this.options,e),this.inputString="",this.fresh=!0,this.lastSelected=null,this.geolocation=new p}f.prototype={options:{zoom:16,flyTo:!0,trackProximity:!0,minLength:2,reverseGeocode:!1,flipCoordinates:!1,limit:5,origin:"https://api.mapbox.com",enableEventLogging:!0,marker:!0,mapboxgl:null,collapsed:!1,clearAndBlurOnEsc:!1,clearOnBlur:!1,enableGeolocation:!1,addressAccuracy:"street",getItemValue:function(e){return e.place_name},render:function(e){var t=e.place_name.split(",");return'
'+t[0]+'
'+t.splice(1,t.length).join(",")+"
"}},addTo:function(e){function t(e,t){if(!document.body.contains(t))throw new Error("Element provided to #addTo() exists, but is not in the DOM");const i=e.onAdd();t.appendChild(i)}if(e._controlContainer)e.addControl(this);else if(e instanceof HTMLElement)t(this,e);else{if("string"!=typeof e)throw new Error("Error: addTo must be a mapbox-gl-js map, an html element, or a CSS selector query for a single html element");{const i=document.querySelectorAll(e);if(0===i.length)throw new Error("Element ",e,"not found.");if(i.length>1)throw new Error("Geocoder can only be added to a single html element");t(this,i[0])}}},onAdd:function(e){if(e&&"string"!=typeof e&&(this._map=e),this.setLanguage(),this.options.localGeocoderOnly||(this.geocoderService=c(l({accessToken:this.options.accessToken,origin:this.options.origin}))),this.options.localGeocoderOnly&&!this.options.localGeocoder)throw new Error("A localGeocoder function must be specified to use localGeocoderOnly mode");this.eventManager=new u(this.options),this._onChange=this._onChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onPaste=this._onPaste.bind(this),this._onBlur=this._onBlur.bind(this),this._showButton=this._showButton.bind(this),this._hideButton=this._hideButton.bind(this),this._onQueryResult=this._onQueryResult.bind(this),this.clear=this.clear.bind(this),this._updateProximity=this._updateProximity.bind(this),this._collapse=this._collapse.bind(this),this._unCollapse=this._unCollapse.bind(this),this._clear=this._clear.bind(this),this._clearOnBlur=this._clearOnBlur.bind(this),this._geolocateUser=this._geolocateUser.bind(this);var t=this.container=document.createElement("div");t.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl";var i=this.createIcon("search",'');this._inputEl=document.createElement("input"),this._inputEl.type="text",this._inputEl.className="mapboxgl-ctrl-geocoder--input",this.setPlaceholder(),this.options.collapsed&&(this._collapse(),this.container.addEventListener("mouseenter",this._unCollapse),this.container.addEventListener("mouseleave",this._collapse),this._inputEl.addEventListener("focus",this._unCollapse)),(this.options.collapsed||this.options.clearOnBlur)&&this._inputEl.addEventListener("blur",this._onBlur),this._inputEl.addEventListener("keydown",o(this._onKeyDown,200)),this._inputEl.addEventListener("paste",this._onPaste),this._inputEl.addEventListener("change",this._onChange),this.container.addEventListener("mouseenter",this._showButton),this.container.addEventListener("mouseleave",this._hideButton),this._inputEl.addEventListener("keyup",function(e){this.eventManager.keyevent(e,this)}.bind(this));var r=document.createElement("div");r.classList.add("mapboxgl-ctrl-geocoder--pin-right"),this._clearEl=document.createElement("button"),this._clearEl.setAttribute("aria-label","Clear"),this._clearEl.addEventListener("click",this.clear),this._clearEl.className="mapboxgl-ctrl-geocoder--button";var s=this.createIcon("close",'');if(this._clearEl.appendChild(s),this._loadingEl=this.createIcon("loading",''),r.appendChild(this._clearEl),r.appendChild(this._loadingEl),t.appendChild(i),t.appendChild(this._inputEl),t.appendChild(r),this.options.enableGeolocation&&this.geolocation.isSupport()){this._geolocateEl=document.createElement("button"),this._geolocateEl.setAttribute("aria-label","Geolocate"),this._geolocateEl.addEventListener("click",this._geolocateUser),this._geolocateEl.className="mapboxgl-ctrl-geocoder--button";var a=this.createIcon("geolocate",'');this._geolocateEl.appendChild(a),r.appendChild(this._geolocateEl),this._showGeolocateButton()}var d=this._typeahead=new n(this._inputEl,[],{filter:!1,minLength:this.options.minLength,limit:this.options.limit});this.setRenderFunction(this.options.render),d.getItemValue=this.options.getItemValue;var h,p=d.list.draw,m=this._footerNode=((h=document.createElement("div")).className="mapboxgl-ctrl-geocoder--powered-by",h.innerHTML='Powered by Mapbox',h);return d.list.draw=function(){p.call(this),m.addEventListener("mousedown",function(){this.selectingListItem=!0}.bind(this)),m.addEventListener("mouseup",function(){this.selectingListItem=!1}.bind(this)),this.element.appendChild(m)},this.mapMarker=null,this._handleMarker=this._handleMarker.bind(this),this._map&&(this.options.trackProximity&&(this._updateProximity(),this._map.on("moveend",this._updateProximity)),this._mapboxgl=this.options.mapboxgl,!this._mapboxgl&&this.options.marker&&(console.error("No mapboxgl detected in options. Map markers are disabled. Please set options.mapboxgl."),this.options.marker=!1)),t},_geolocateUser:function(){this._hideGeolocateButton(),this._showLoadingIcon(),this.geolocation.getCurrentPosition().then(function(e){this._hideLoadingIcon();const t={geometry:{type:"Point",coordinates:[e.coords.longitude,e.coords.latitude]}};this._handleMarker(t),this._fly(t),this._typeahead.clear(),this._typeahead.selected=!0,this.lastSelected=JSON.stringify(t),this._showClearButton(),this.fresh=!1;const i={limit:1,language:[this.options.language],query:t.geometry.coordinates,types:["address"]};if(this.options.localGeocoderOnly){const e=t.geometry.coordinates[0]+","+t.geometry.coordinates[1];this._setInputValue(e),this._eventEmitter.emit("result",{result:t})}else this.geocoderService.reverseGeocode(i).send().then(function(e){const i=e.body.features[0];if(i){const e=m.transformFeatureToGeolocationText(i,this.options.addressAccuracy);this._setInputValue(e),i.user_coordinates=t.geometry.coordinates,this._eventEmitter.emit("result",{result:i})}else this._eventEmitter.emit("result",{result:{user_coordinates:t.geometry.coordinates}})}.bind(this))}.bind(this)).catch(function(e){1===e.code?this._renderUserDeniedGeolocationError():this._renderLocationError(),this._hideLoadingIcon(),this._showGeolocateButton(),this._hideAttribution()}.bind(this))},createIcon:function(e,t){var i=document.createElementNS("http://www.w3.org/2000/svg","svg");return i.setAttribute("class","mapboxgl-ctrl-geocoder--icon mapboxgl-ctrl-geocoder--icon-"+e),i.setAttribute("viewBox","0 0 18 18"),i.setAttribute("xml:space","preserve"),i.setAttribute("width",18),i.setAttribute("height",18),i.innerHTML=t,i},onRemove:function(){return this.container.parentNode.removeChild(this.container),this.options.trackProximity&&this._map&&this._map.off("moveend",this._updateProximity),this._removeMarker(),this._map=null,this},_setInputValue:function(e){this._inputEl.value=e,setTimeout(function(){this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0)}.bind(this),1)},_onPaste:function(e){var t=(e.clipboardData||window.clipboardData).getData("text");t.length>=this.options.minLength&&this._geocode(t)},_onKeyDown:function(e){var t=27,i=9;if(e.keyCode===t&&this.options.clearAndBlurOnEsc)return this._clear(e),this._inputEl.blur();var n=e.target&&e.target.shadowRoot?e.target.shadowRoot.activeElement:e.target;if(!n||!n.value)return this.fresh=!0,e.keyCode!==i&&this.clear(e),this._showGeolocateButton(),this._hideClearButton();this._hideGeolocateButton(),e.metaKey||-1!==[i,t,37,39,13,38,40].indexOf(e.keyCode)||n.value.length>=this.options.minLength&&this._geocode(n.value)},_showButton:function(){this._typeahead.selected&&this._showClearButton()},_hideButton:function(){this._typeahead.selected&&this._hideClearButton()},_showClearButton:function(){this._clearEl.style.display="block"},_hideClearButton:function(){this._clearEl.style.display="none"},_showGeolocateButton:function(){this._geolocateEl&&this.geolocation.isSupport()&&(this._geolocateEl.style.display="block")},_hideGeolocateButton:function(){this._geolocateEl&&(this._geolocateEl.style.display="none")},_showLoadingIcon:function(){this._loadingEl.style.display="block"},_hideLoadingIcon:function(){this._loadingEl.style.display="none"},_showAttribution:function(){this._footerNode.style.display="block"},_hideAttribution:function(){this._footerNode.style.display="none"},_onBlur:function(e){this.options.clearOnBlur&&this._clearOnBlur(e),this.options.collapsed&&this._collapse()},_onChange:function(){var e=this._typeahead.selected;e&&JSON.stringify(e)!==this.lastSelected&&(this._hideClearButton(),this.options.flyTo&&this._fly(e),this.options.marker&&this._mapboxgl&&this._handleMarker(e),this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0),this.lastSelected=JSON.stringify(e),this._eventEmitter.emit("result",{result:e}),this.eventManager.select(e,this))},_fly:function(e){var t;if(e.properties&&a[e.properties.short_code])t=r({},this.options.flyTo),this._map&&this._map.fitBounds(a[e.properties.short_code].bbox,t);else if(e.bbox){var i=e.bbox;t=r({},this.options.flyTo),this._map&&this._map.fitBounds([[i[0],i[1]],[i[2],i[3]]],t)}else{var n={zoom:this.options.zoom};t=r({},n,this.options.flyTo),e.center?t.center=e.center:e.geometry&&e.geometry.type&&"Point"===e.geometry.type&&e.geometry.coordinates&&(t.center=e.geometry.coordinates),this._map&&this._map.flyTo(t)}},_requestType:function(e,t){return e.localGeocoderOnly?1:e.reverseGeocode&&m.REVERSE_GEOCODE_COORD_RGX.test(t)?2:0},_setupConfig:function(e,t){const i=/[\s,]+/;var n=this,o=["bbox","limit","proximity","countries","types","language","reverseMode","mode","autocomplete","fuzzyMatch","routing","worldview"].reduce((function(e,t){if(void 0===n.options[t]||null===n.options[t])return e;["countries","types","language"].indexOf(t)>-1?e[t]=n.options[t].split(i):e[t]=n.options[t];const o="number"==typeof n.options[t].longitude&&"number"==typeof n.options[t].latitude;if("proximity"===t&&o){const i=n.options[t].longitude,o=n.options[t].latitude;e[t]=[i,o]}return e}),{});switch(e){case 2:var s=t.split(i).map((function(e){return parseFloat(e,10)}));n.options.flipCoordinates||s.reverse(),!o.types||o.types[0],o=r(o,{query:s,limit:1}),["proximity","autocomplete","fuzzyMatch","bbox"].forEach((function(e){e in o&&delete o[e]}));break;case 0:{const e=t.trim();/^(-?\d{1,3}(\.\d{0,256})?)[, ]+(-?\d{1,3}(\.\d{0,256})?)?$/.test(e)&&(t=t.replace(/,/g," ")),o=r(o,{query:t})}}return o},_geocode:function(e){this.inputString=e,this._showLoadingIcon(),this._eventEmitter.emit("loading",{query:e});const t=this._requestType(this.options,e),i=this._setupConfig(t,e);var n;switch(t){case 1:n=Promise.resolve();break;case 0:n=this.geocoderService.forwardGeocode(i).send();break;case 2:n=this.geocoderService.reverseGeocode(i).send()}var o=this.options.localGeocoder&&this.options.localGeocoder(e)||[],r=[],s=null;return n.catch(function(e){s=e}.bind(this)).then(function(t){this._hideLoadingIcon();var n={};return t?"200"==t.statusCode&&((n=t.body).request=t.request,n.headers=t.headers):n={type:"FeatureCollection",features:[]},n.config=i,this.fresh&&(this.eventManager.start(this),this.fresh=!1),n.features=n.features?o.concat(n.features):o,this.options.externalGeocoder?(r=this.options.externalGeocoder(e,n.features)||Promise.resolve([])).then((function(e){return n.features=n.features?e.concat(n.features):e,n}),(function(){return n})):n}.bind(this)).then(function(e){if(s)throw s;this.options.filter&&e.features.length&&(e.features=e.features.filter(this.options.filter)),e.features.length?(this._showClearButton(),this._hideGeolocateButton(),this._showAttribution(),this._eventEmitter.emit("results",e),this._typeahead.update(e.features)):(this._hideClearButton(),this._hideAttribution(),this._typeahead.selected=null,this._renderNoResults(),this._eventEmitter.emit("results",e))}.bind(this)).catch(function(e){this._hideLoadingIcon(),this._hideAttribution(),o.length&&this.options.localGeocoder||r.length&&this.options.externalGeocoder?(this._showClearButton(),this._hideGeolocateButton(),this._typeahead.update(o)):(this._hideClearButton(),this._typeahead.selected=null,this._renderError()),this._eventEmitter.emit("results",{features:o}),this._eventEmitter.emit("error",{error:e})}.bind(this)),n},_clear:function(e){e&&e.preventDefault(),this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this._onChange(),this._hideClearButton(),this._showGeolocateButton(),this._removeMarker(),this.lastSelected=null,this._eventEmitter.emit("clear"),this.fresh=!0},clear:function(e){this._clear(e),this._inputEl.focus()},_clearOnBlur:function(e){e.relatedTarget&&this._clear(e)},_onQueryResult:function(e){var t=e.body;if(t.features.length){var i=t.features[0];this._typeahead.selected=i,this._inputEl.value=i.place_name,this._onChange()}},_updateProximity:function(){if(this._map&&this.options.trackProximity)if(this._map.getZoom()>9){var e=this._map.getCenter().wrap();this.setProximity({longitude:e.lng,latitude:e.lat},!1)}else this.setProximity(null,!1)},_collapse:function(){this._inputEl.value||this._inputEl===document.activeElement||this.container.classList.add("mapboxgl-ctrl-geocoder--collapsed")},_unCollapse:function(){this.container.classList.remove("mapboxgl-ctrl-geocoder--collapsed")},query:function(e){return this._geocode(e).then(this._onQueryResult),this},_renderError:function(){this._renderMessage("
There was an error reaching the server
")},_renderLocationError:function(){this._renderMessage("
A location error has occurred
")},_renderNoResults:function(){this._renderMessage("
No results found
")},_renderUserDeniedGeolocationError:function(){this._renderMessage("
Geolocation permission denied
")},_renderMessage:function(e){this._typeahead.update([]),this._typeahead.selected=null,this._typeahead.clear(),this._typeahead.renderError(e)},_getPlaceholderText:function(){if(this.options.placeholder)return this.options.placeholder;if(this.options.language){var e=this.options.language.split(",")[0],t=h.language(e),i=d.placeholder[t];if(i)return i}return"Search"},setInput:function(e,t){return void 0===t&&(t=!1),this._inputEl.value=e,this._typeahead.selected=null,this._typeahead.clear(),e.length>=this.options.minLength&&(t?this._geocode(e):this._onChange()),this},setProximity:function(e,t=!0){return this.options.proximity=e,t&&(this.options.trackProximity=!1),this},getProximity:function(){return this.options.proximity},setRenderFunction:function(e){return e&&"function"==typeof e&&(this._typeahead.render=e),this},getRenderFunction:function(){return this._typeahead.render},setLanguage:function(e){var t=navigator.language||navigator.userLanguage||navigator.browserLanguage;return this.options.language=e||this.options.language||t,this},getLanguage:function(){return this.options.language},getZoom:function(){return this.options.zoom},setZoom:function(e){return this.options.zoom=e,this},getFlyTo:function(){return this.options.flyTo},setFlyTo:function(e){return this.options.flyTo=e,this},getPlaceholder:function(){return this.options.placeholder},setPlaceholder:function(e){return this.options.placeholder=e||this._getPlaceholderText(),this._inputEl.placeholder=this.options.placeholder,this._inputEl.setAttribute("aria-label",this.options.placeholder),this},getBbox:function(){return this.options.bbox},setBbox:function(e){return this.options.bbox=e,this},getCountries:function(){return this.options.countries},setCountries:function(e){return this.options.countries=e,this},getTypes:function(){return this.options.types},setTypes:function(e){return this.options.types=e,this},getMinLength:function(){return this.options.minLength},setMinLength:function(e){return this.options.minLength=e,this._typeahead&&(this._typeahead.options.minLength=e),this},getLimit:function(){return this.options.limit},setLimit:function(e){return this.options.limit=e,this._typeahead&&(this._typeahead.options.limit=e),this},getFilter:function(){return this.options.filter},setFilter:function(e){return this.options.filter=e,this},setOrigin:function(e){return this.options.origin=e,this.geocoderService=c(l({accessToken:this.options.accessToken,origin:this.options.origin})),this},getOrigin:function(){return this.options.origin},setAccessToken:function(e){return this.options.accessToken=e,this.geocoderService=c(l({accessToken:this.options.accessToken,origin:this.options.origin})),this},setAutocomplete:function(e){return this.options.autocomplete=e,this},getAutocomplete:function(){return this.options.autocomplete},setFuzzyMatch:function(e){return this.options.fuzzyMatch=e,this},getFuzzyMatch:function(){return this.options.fuzzyMatch},setRouting:function(e){return this.options.routing=e,this},getRouting:function(){return this.options.routing},setWorldview:function(e){return this.options.worldview=e,this},getWorldview:function(){return this.options.worldview},_handleMarker:function(e){if(this._map){this._removeMarker();var t=r({},{color:"#4668F2"},this.options.marker);return this.mapMarker=new this._mapboxgl.Marker(t),e.center?this.mapMarker.setLngLat(e.center).addTo(this._map):e.geometry&&e.geometry.type&&"Point"===e.geometry.type&&e.geometry.coordinates&&this.mapMarker.setLngLat(e.geometry.coordinates).addTo(this._map),this}},_removeMarker:function(){this.mapMarker&&(this.mapMarker.remove(),this.mapMarker=null)},on:function(e,t){return this._eventEmitter.on(e,t),this},off:function(e,t){return this._eventEmitter.removeListener(e,t),this.eventManager.remove(),this}},e.exports=f},7906:e=>{"use strict";e.exports={placeholder:{de:"Suche",it:"Ricerca",en:"Search",nl:"Zoeken",fr:"Chercher",ca:"Cerca",he:"לחפש",ja:"サーチ",lv:"Meklēt",pt:"Procurar",sr:"Претрага",zh:"搜索",cs:"Vyhledávání",hu:"Keresés",ka:"ძიება",nb:"Søke",sk:"Vyhľadávanie",th:"ค้นหา",fi:"Hae",is:"Leita",ko:"수색",pl:"Szukaj",sl:"Iskanje",fa:"جستجو",ru:"Поиск"}}},2614:e=>{function t(e){const t=e.address||"",i=e.text||"",n=e.place_name||"",o={address:n.split(",")[0],houseNumber:t,street:i,placeName:n};return e.context.forEach((function(e){const t=e.id.split(".")[0];o[t]=e.text})),o}e.exports={transformFeatureToGeolocationText:function(e,i){const n=t(e),o=["address","street","place","country"];if("function"==typeof i)return i(n);const r=o.indexOf(i);return(-1===r?o:o.slice(r)).reduce((function(e,t){return n[t]?(""!==e&&(e+=", "),e+n[t]):e}),"")},getAddressInfo:t,REVERSE_GEOCODE_COORD_RGX:/^[ ]*(-?\d{1,3}(\.\d{0,256})?)[, ]+(-?\d{1,3}(\.\d{0,256})?)[ ]*$/}},7995:(e,t,i)=>{"use strict";var n=i(3086);e.exports=n},3086:(e,t,i)=>{"use strict";var n=i(9136),o=i(3115);function r(e){o.call(this,e)}r.prototype=Object.create(o.prototype),r.prototype.constructor=r,r.prototype.sendRequest=n.browserSend,r.prototype.abortRequest=n.browserAbort,e.exports=function(e){return new r(e)}},9136:(e,t,i)=>{"use strict";var n=i(511),o=i(8040),r=i(8910),s=i(3349),a={};function l(e){var t=e.total,i=e.loaded;return{total:t,transferred:i,percent:100*i/t}}function c(e,t){return new Promise((function(i,n){t.onprogress=function(t){e.emitter.emit(r.EVENT_PROGRESS_DOWNLOAD,l(t))};var s=e.file;s&&(t.upload.onprogress=function(t){e.emitter.emit(r.EVENT_PROGRESS_UPLOAD,l(t))}),t.onerror=function(e){n(e)},t.onabort=function(){var t=new o({request:e,type:r.ERROR_REQUEST_ABORTED});n(t)},t.onload=function(){if(delete a[e.id],t.status<200||t.status>=400){var r=new o({request:e,body:t.response,statusCode:t.status});n(r)}else i(t)};var c=e.body;"string"==typeof c?t.send(c):c?t.send(JSON.stringify(c)):s?t.send(s):t.send(),a[e.id]=t})).then((function(t){return function(e,t){return new n(e,{body:t.response,headers:s(t.getAllResponseHeaders()),statusCode:t.status})}(e,t)}))}function u(e,t){var i=e.url(t),n=new window.XMLHttpRequest;return n.open(e.method,i),Object.keys(e.headers).forEach((function(t){n.setRequestHeader(t,e.headers[t])})),n}e.exports={browserAbort:function(e){var t=a[e.id];t&&(t.abort(),delete a[e.id])},sendRequestXhr:c,browserSend:function(e){return Promise.resolve().then((function(){var t=u(e,e.client.accessToken);return c(e,t)}))},createRequestXhr:u}},3115:(e,t,i)=>{"use strict";var n=i(4256),o=i(75),r=i(8910);function s(e){if(!e||!e.accessToken)throw new Error("Cannot create a client without an access token");n(e.accessToken),this.accessToken=e.accessToken,this.origin=e.origin||r.API_ORIGIN}s.prototype.createRequest=function(e){return new o(this,e)},e.exports=s},8040:(e,t,i)=>{"use strict";var n=i(8910);e.exports=function(e){var t,i=e.type||n.ERROR_HTTP;if(e.body)try{t=JSON.parse(e.body)}catch(i){t=e.body}else t=null;var o=e.message||null;o||("string"==typeof t?o=t:t&&"string"==typeof t.message?o=t.message:i===n.ERROR_REQUEST_ABORTED&&(o="Request aborted")),this.message=o,this.type=i,this.statusCode=e.statusCode||null,this.request=e.request,this.body=t}},75:(e,t,i)=>{"use strict";var n=i(4256),o=i(7510),r=i(228),s=i(5452),a=i(8910),l=1;function c(e,t){if(!e)throw new Error("MapiRequest requires a client");if(!t||!t.path||!t.method)throw new Error("MapiRequest requires an options object with path and method properties");var i={};t.body&&(i["content-type"]="application/json");var n=o(i,t.headers),s=Object.keys(n).reduce((function(e,t){return e[t.toLowerCase()]=n[t],e}),{});this.id=l++,this._options=t,this.emitter=new r,this.client=e,this.response=null,this.error=null,this.sent=!1,this.aborted=!1,this.path=t.path,this.method=t.method,this.origin=t.origin||e.origin,this.query=t.query||{},this.params=t.params||{},this.body=t.body||null,this.file=t.file||null,this.encoding=t.encoding||"utf8",this.sendFileAs=t.sendFileAs||null,this.headers=s}c.prototype.url=function(e){var t=s.prependOrigin(this.path,this.origin);t=s.appendQueryObject(t,this.query);var i=this.params,r=null==e?this.client.accessToken:e;if(r){t=s.appendQueryParam(t,"access_token",r);var a=n(r).user;i=o({ownerId:a},i)}return t=s.interpolateRouteParams(t,i)},c.prototype.send=function(){var e=this;if(e.sent)throw new Error("This request has already been sent. Check the response and error properties. Create a new request with clone().");return e.sent=!0,e.client.sendRequest(e).then((function(t){return e.response=t,e.emitter.emit(a.EVENT_RESPONSE,t),t}),(function(t){throw e.error=t,e.emitter.emit(a.EVENT_ERROR,t),t}))},c.prototype.abort=function(){this._nextPageRequest&&(this._nextPageRequest.abort(),delete this._nextPageRequest),this.response||this.error||this.aborted||(this.aborted=!0,this.client.abortRequest(this))},c.prototype.eachPage=function(e){var t=this;function i(i){e(null,i,(function(){delete t._nextPageRequest;var e=i.nextPage();e&&(t._nextPageRequest=e,o(e))}))}function n(t){e(t,null,(function(){}))}function o(e){e.send().then(i,n)}o(this)},c.prototype.clone=function(){return this._extend()},c.prototype._extend=function(e){var t=o(this._options,e);return new c(this.client,t)},e.exports=c},511:(e,t,i)=>{"use strict";var n=i(7857);function o(e,t){this.request=e,this.headers=t.headers,this.rawBody=t.body,this.statusCode=t.statusCode;try{this.body=JSON.parse(t.body||"{}")}catch(e){this.body=t.body}this.links=n(this.headers.link)}o.prototype.hasNextPage=function(){return!!this.links.next},o.prototype.nextPage=function(){return this.hasNextPage()?this.request._extend({path:this.links.next.url}):null},e.exports=o},8910:e=>{"use strict";e.exports={API_ORIGIN:"https://api.mapbox.com",EVENT_PROGRESS_DOWNLOAD:"downloadProgress",EVENT_PROGRESS_UPLOAD:"uploadProgress",EVENT_ERROR:"error",EVENT_RESPONSE:"response",ERROR_HTTP:"HttpError",ERROR_REQUEST_ABORTED:"RequestAbortedError"}},3349:e=>{"use strict";e.exports=function(e){var t={};return e?(e.trim().split(/[\r|\n]+/).forEach((function(e){var i=function(e){var t=e.indexOf(":");return{name:e.substring(0,t).trim().toLowerCase(),value:e.substring(t+1).trim()}}(e);t[i.name]=i.value})),t):t}},7857:e=>{"use strict";e.exports=function(e){return e?e.split(/,\s*]*)>(.*)/);if(!t)return null;var i=t[1],n=t[2].split(";"),o=null,r=n.reduce((function(e,t){var i=function(e){var t=e.match(/\s*(.+)\s*=\s*"?([^"]+)"?/);return t?{key:t[1],value:t[2]}:null}(t);return i?"rel"===i.key?(o||(o=i.value),e):(e[i.key]=i.value,e):e}),{});return o?{url:i,rel:o,params:r}:null}(t);return i?(i.rel.split(/\s+/).forEach((function(t){e[t]||(e[t]={url:i.url,params:i.params})})),e):e}),{}):{}}},5452:e=>{"use strict";function t(e){return Array.isArray(e)?e.map(encodeURIComponent).join(","):encodeURIComponent(String(e))}function i(e,i,n){if(!1===n||null===n)return e;var o=/\?/.test(e)?"&":"?",r=encodeURIComponent(i);return void 0!==n&&""!==n&&!0!==n&&(r+="="+t(n)),""+e+o+r}e.exports={appendQueryObject:function(e,t){if(!t)return e;var n=e;return Object.keys(t).forEach((function(e){var o=t[e];void 0!==o&&(Array.isArray(o)&&(o=o.filter((function(e){return null!=e})).join(",")),n=i(n,e,o))})),n},appendQueryParam:i,prependOrigin:function(e,t){if(!t)return e;if("http"===e.slice(0,4))return e;var i="/"===e[0]?"":"/";return""+t.replace(/\/$/,"")+i+e},interpolateRouteParams:function(e,i){return i?e.replace(/\/:([a-zA-Z0-9]+)/g,(function(e,n){var o=i[n];if(void 0===o)throw new Error("Unspecified route parameter "+n);return"/"+t(o)})):e}}},5663:(e,t,i)=>{"use strict";var n=i(7510),o=i(9414),r=i(7267),s=i(1087),a=i(7583),l={},c=["country","region","postcode","district","place","locality","neighborhood","address","poi","poi.landmark"];l.forwardGeocode=function(e){o.assertShape({query:o.required(o.string),mode:o.oneOf("mapbox.places","mapbox.places-permanent"),countries:o.arrayOf(o.string),proximity:o.oneOf(o.coordinates,"ip"),types:o.arrayOf(o.oneOf(c)),autocomplete:o.boolean,bbox:o.arrayOf(o.number),limit:o.number,language:o.arrayOf(o.string),routing:o.boolean,fuzzyMatch:o.boolean,worldview:o.string})(e),e.mode=e.mode||"mapbox.places";var t=s(n({country:e.countries},r(e,["proximity","types","autocomplete","bbox","limit","language","routing","fuzzyMatch","worldview"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:r(e,["mode","query"]),query:t})},l.reverseGeocode=function(e){o.assertShape({query:o.required(o.coordinates),mode:o.oneOf("mapbox.places","mapbox.places-permanent"),countries:o.arrayOf(o.string),types:o.arrayOf(o.oneOf(c)),bbox:o.arrayOf(o.number),limit:o.number,language:o.arrayOf(o.string),reverseMode:o.oneOf("distance","score"),routing:o.boolean,worldview:o.string})(e),e.mode=e.mode||"mapbox.places";var t=s(n({country:e.countries},r(e,["country","types","bbox","limit","language","reverseMode","routing","worldview"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:r(e,["mode","query"]),query:t})},e.exports=a(l)},7583:(e,t,i)=>{"use strict";var n=i(3115),o=i(3086);e.exports=function(e){return function(t){var i;i=n.prototype.isPrototypeOf(t)?t:o(t);var r=Object.create(e);return r.client=i,r}}},4086:e=>{"use strict";e.exports=function(e,t){return Object.keys(e).reduce((function(i,n){return i[n]=t(n,e[n]),i}),{})}},7267:e=>{"use strict";e.exports=function(e,t){var i=function(e,i){return-1!==t.indexOf(e)&&void 0!==i};return"function"==typeof t&&(i=t),Object.keys(e).filter((function(t){return i(t,e[t])})).reduce((function(t,i){return t[i]=e[i],t}),{})}},1087:(e,t,i)=>{"use strict";var n=i(4086);e.exports=function(e){return n(e,(function(e,t){return"boolean"==typeof t?JSON.stringify(t):t}))}},9414:(e,t,i)=>{"use strict";var n=i(7510),o=i(5573);e.exports=n(o,{file:function(e){if("undefined"!=typeof window){if(e instanceof i.g.Blob||e instanceof i.g.ArrayBuffer)return;return"Blob or ArrayBuffer"}if("string"!=typeof e&&void 0===e.pipe)return"Filename or Readable stream"},date:function(e){var t="date";if("boolean"==typeof e)return t;try{var i=new Date(e);if(i.getTime&&isNaN(i.getTime()))return t}catch(e){return t}},coordinates:function(e){return o.tuple(o.number,o.number)(e)},assertShape:function(e,t){return o.assert(o.strictShape(e),t)}})},4256:(e,t,i)=>{"use strict";var n=i(5914),o={};function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e){if(o[e])return o[e];var t=e.split("."),i=t[0],s=t[1];if(!s)throw new Error("Invalid token");var a=function(e){try{return JSON.parse(n.decode(e))}catch(e){throw new Error("Invalid token")}}(s),l={usage:i,user:a.u};return r(a,"a")&&(l.authorization=a.a),r(a,"exp")&&(l.expires=1e3*a.exp),r(a,"iat")&&(l.created=1e3*a.iat),r(a,"scopes")&&(l.scopes=a.scopes),r(a,"client")&&(l.client=a.client),r(a,"ll")&&(l.lastLogin=a.ll),r(a,"iu")&&(l.impersonator=a.iu),o[e]=l,l}},5914:function(e,t,i){var n;e=i.nmd(e),function(){var o=(e&&e.exports,"object"==typeof i.g&&i.g);o.global!==o&&o.window;var r=function(e){this.message=e};(r.prototype=new Error).name="InvalidCharacterError";var s=function(e){throw new r(e)},a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=/[\t\n\f\r ]/g,c={encode:function(e){e=String(e),/[^\0-\xFF]/.test(e)&&s("The string to be encoded contains characters outside of the Latin1 range.");for(var t,i,n,o,r=e.length%3,l="",c=-1,u=e.length-r;++c>18&63)+a.charAt(o>>12&63)+a.charAt(o>>6&63)+a.charAt(63&o);return 2==r?(t=e.charCodeAt(c)<<8,i=e.charCodeAt(++c),l+=a.charAt((o=t+i)>>10)+a.charAt(o>>4&63)+a.charAt(o<<2&63)+"="):1==r&&(o=e.charCodeAt(c),l+=a.charAt(o>>2)+a.charAt(o<<4&63)+"=="),l},decode:function(e){var t=(e=String(e).replace(l,"")).length;t%4==0&&(t=(e=e.replace(/==?$/,"")).length),(t%4==1||/[^+a-zA-Z0-9/]/.test(e))&&s("Invalid character: the string to be decoded is not correctly encoded.");for(var i,n,o=0,r="",c=-1;++c>(-2*o&6)));return r},version:"0.1.0"};void 0===(n=function(){return c}.call(t,i,t,e))||(e.exports=n)}()},8713:(e,t,i)=>{"use strict";i.d(t,{A:()=>W});var n=i(1601),o=i.n(n),r=i(6314),s=i.n(r),a=i(4417),l=i.n(a),c=new URL(i(3437),i.b),u=new URL(i(8810),i.b),d=new URL(i(8386),i.b),h=new URL(i(1988),i.b),p=new URL(i(1192),i.b),m=new URL(i(5291),i.b),f=new URL(i(3681),i.b),g=new URL(i(5160),i.b),_=new URL(i(2895),i.b),y=new URL(i(3812),i.b),b=new URL(i(7045),i.b),x=new URL(i(8325),i.b),v=new URL(i(2279),i.b),w=new URL(i(2233),i.b),E=new URL(i(4388),i.b),M=new URL(i(6629),i.b),T=new URL(i(2225),i.b),C=new URL(i(7020),i.b),k=new URL(i(6107),i.b),S=s()(o()),L=l()(c),A=l()(u),I=l()(d),D=l()(h),z=l()(p),P=l()(m),O=l()(f),B=l()(g),j=l()(_),R=l()(y),F=l()(b),N=l()(x),U=l()(v),V=l()(w),$=l()(E),q=l()(M),G=l()(T),Z=l()(C),H=l()(k);S.push([e.id,`:root {\n --bluesky: url(${L});\n --tiktok: url(${A});\n --hyperlink: url(${I});\n --twitter: url(${D});\n --facebook: url(${z});\n --instagram: url(${P});\n --linkedin: url(${O});\n --pinterest: url(${B});\n --youtube: url(${j});\n --soundcloud: url(${R});\n --spotify: url(${F});\n --vimeo: url(${N});\n --flickr: url(${U});\n --tumblr: url(${V});\n --amazon: url(${$});\n --ebay: url(${q});\n --etsy: url(${G});\n --slack: url(${Z});\n --threads: url(${H});\n}\n[box],\n[dialogbox],\n.cbeb-modal {\n /* Hack for Google's autocomplete widget */\n /* https://github.com/twbs/bootstrap/issues/4160 */\n /* Hack for Maptiler's autocomplete widget */\n /* Mobile */\n /* Desktop */\n /* ---------------------------------- spinner */\n /* ---------------------------------- entry fields */\n /* Account ----------------------------- */\n}\n[box] .cbeb-noscroll,\n[dialogbox] .cbeb-noscroll,\n.cbeb-modal .cbeb-noscroll {\n overflow: hidden;\n}\n[box] .lds-ripple,\n[dialogbox] .lds-ripple,\n.cbeb-modal .lds-ripple {\n justify-content: center;\n align-items: center;\n margin: auto;\n position: relative;\n width: 64px;\n height: 64px;\n}\n[box] .lds-ripple div,\n[dialogbox] .lds-ripple div,\n.cbeb-modal .lds-ripple div {\n position: absolute;\n border: 4px solid grey;\n opacity: 1;\n border-radius: 50%;\n animation: lds-ripple 1s cubic-bezier(0, 0.2, 0.8, 1) infinite;\n}\n[box] .lds-ripple div:nth-child(2),\n[dialogbox] .lds-ripple div:nth-child(2),\n.cbeb-modal .lds-ripple div:nth-child(2) {\n animation-delay: -0.5s;\n}\n@keyframes lds-ripple {\n 0% {\n top: 28px;\n left: 28px;\n width: 0;\n height: 0;\n opacity: 1;\n }\n 100% {\n top: -1px;\n left: -1px;\n width: 58px;\n height: 58px;\n opacity: 0;\n }\n}\n[box] .pac-container,\n[dialogbox] .pac-container,\n.cbeb-modal .pac-container {\n z-index: 8101 !important;\n}\n[box] .maptiler-geocoder-results,\n[dialogbox] .maptiler-geocoder-results,\n.cbeb-modal .maptiler-geocoder-results {\n z-index: 8101 !important;\n}\n@media screen and (max-width: 510px) {\n [box] [cbeb-main-div],\n [dialogbox] [cbeb-main-div],\n .cbeb-modal [cbeb-main-div] {\n row-gap: 2lh;\n }\n [box] .cbeb-toolbar-searchgroup,\n [dialogbox] .cbeb-toolbar-searchgroup,\n .cbeb-modal .cbeb-toolbar-searchgroup {\n justify-content: center;\n }\n [box] .cbeb-category-summary-container,\n [dialogbox] .cbeb-category-summary-container,\n .cbeb-modal .cbeb-category-summary-container {\n font-size: 14px;\n }\n [box] .cbeb-category-summary,\n [dialogbox] .cbeb-category-summary,\n .cbeb-modal .cbeb-category-summary {\n padding-left: 10px;\n padding-right: 10px;\n }\n [box] .cbeb-bio-snippet,\n [dialogbox] .cbeb-bio-snippet,\n .cbeb-modal .cbeb-bio-snippet {\n font-size: 17px;\n }\n [box] .cbeb-entry-view,\n [dialogbox] .cbeb-entry-view,\n .cbeb-modal .cbeb-entry-view {\n display: flex;\n flex-direction: column;\n font-size: 17px;\n text-align: center;\n }\n [box] .cbeb-modal-title-text,\n [dialogbox] .cbeb-modal-title-text,\n .cbeb-modal .cbeb-modal-title-text {\n font-size: 25px;\n }\n [box] .cbeb-socmed-summary,\n [dialogbox] .cbeb-socmed-summary,\n .cbeb-modal .cbeb-socmed-summary {\n font-size: 21px;\n }\n [box] .cbeb-growdiv,\n [dialogbox] .cbeb-growdiv,\n .cbeb-modal .cbeb-growdiv {\n flex-grow: 0;\n }\n [box] .cbeb-search-inputfield,\n [dialogbox] .cbeb-search-inputfield,\n .cbeb-modal .cbeb-search-inputfield {\n width: 80%;\n }\n [box] .cbeb-toolbar-btn-group,\n [dialogbox] .cbeb-toolbar-btn-group,\n .cbeb-modal .cbeb-toolbar-btn-group {\n margin-top: 17px;\n }\n [box] .cb-photo-uploaded,\n [dialogbox] .cb-photo-uploaded,\n .cbeb-modal .cb-photo-uploaded {\n width: 250px;\n height: 250px;\n }\n [box] .cb-beo-overview-title,\n [dialogbox] .cb-beo-overview-title,\n .cbeb-modal .cb-beo-overview-title {\n font-size: 22px;\n }\n [box] .cb-beo-overview-businessname,\n [dialogbox] .cb-beo-overview-businessname,\n .cbeb-modal .cb-beo-overview-businessname {\n font-size: 20px;\n font-weight: bold;\n line-height: 0.9em;\n }\n [box] .cbeb-toolbar-btnlabel,\n [dialogbox] .cbeb-toolbar-btnlabel,\n .cbeb-modal .cbeb-toolbar-btnlabel {\n font-size: 23px;\n }\n [box] .cbeb-toolbar-btnlabel-plus,\n [dialogbox] .cbeb-toolbar-btnlabel-plus,\n .cbeb-modal .cbeb-toolbar-btnlabel-plus {\n font-size: 25px;\n font-weight: bold;\n }\n [box] .cbeb-toolbar-button,\n [dialogbox] .cbeb-toolbar-button,\n .cbeb-modal .cbeb-toolbar-button {\n width: 44px;\n height: 44px;\n }\n [box] .cb-image-upload-readonly,\n [dialogbox] .cb-image-upload-readonly,\n .cbeb-modal .cb-image-upload-readonly {\n width: 250px;\n height: 250px;\n margin-bottom: 20px !important;\n }\n [box] .cbeb-toolbar-btntxt,\n [dialogbox] .cbeb-toolbar-btntxt,\n .cbeb-modal .cbeb-toolbar-btntxt {\n display: none;\n }\n}\n@media screen and (min-width: 511px) {\n [box] .cbeb-growdiv,\n [dialogbox] .cbeb-growdiv,\n .cbeb-modal .cbeb-growdiv {\n flex-grow: 1;\n }\n [box] .cbeb-search-container,\n [dialogbox] .cbeb-search-container,\n .cbeb-modal .cbeb-search-container {\n width: 300px;\n }\n [box] .cbeb-category-summary,\n [dialogbox] .cbeb-category-summary,\n .cbeb-modal .cbeb-category-summary {\n padding-left: 5px;\n padding-right: 5px;\n }\n [box] .cbeb-category-summary-container,\n [dialogbox] .cbeb-category-summary-container,\n .cbeb-modal .cbeb-category-summary-container {\n font-size: 12px;\n }\n [box] .cbeb-bio-snippet,\n [dialogbox] .cbeb-bio-snippet,\n .cbeb-modal .cbeb-bio-snippet {\n font-size: 14px;\n }\n [box] .cbeb-socmed-summary,\n [dialogbox] .cbeb-socmed-summary,\n .cbeb-modal .cbeb-socmed-summary {\n font-size: 17px;\n }\n [box] .cbeb-entry-view,\n [dialogbox] .cbeb-entry-view,\n .cbeb-modal .cbeb-entry-view {\n display: flex;\n flex-direction: column;\n font-size: 15px;\n text-align: center;\n line-height: 1.2 !important;\n }\n [box] .cbeb-entry-view p,\n [dialogbox] .cbeb-entry-view p,\n .cbeb-modal .cbeb-entry-view p {\n margin-top: 3px;\n margin-bottom: 2px;\n }\n [box] .cbeb-toolbar-button,\n [dialogbox] .cbeb-toolbar-button,\n .cbeb-modal .cbeb-toolbar-button {\n padding-left: 10px;\n padding-right: 10px;\n padding-top: 5px;\n padding-bottom: 5px;\n }\n [box] .cbeb-toolbar-btntxt,\n [dialogbox] .cbeb-toolbar-btntxt,\n .cbeb-modal .cbeb-toolbar-btntxt {\n margin-left: 5px;\n }\n [box] .cbeb-toolbar-btnlabel,\n [dialogbox] .cbeb-toolbar-btnlabel,\n .cbeb-modal .cbeb-toolbar-btnlabel {\n font-size: 13px;\n }\n [box] .cbeb-toolbar-btnlabel-plus,\n [dialogbox] .cbeb-toolbar-btnlabel-plus,\n .cbeb-modal .cbeb-toolbar-btnlabel-plus {\n font-size: 15px;\n font-weight: bold;\n }\n [box] .cb-photo-uploaded,\n [dialogbox] .cb-photo-uploaded,\n .cbeb-modal .cb-photo-uploaded {\n width: 150px;\n height: 150px;\n }\n [box] .cb-image-upload-readonly,\n [dialogbox] .cb-image-upload-readonly,\n .cbeb-modal .cb-image-upload-readonly {\n width: 150px;\n height: 150px;\n margin-bottom: 20px !important;\n }\n [box] .cb-beo-overview-title,\n [dialogbox] .cb-beo-overview-title,\n .cbeb-modal .cb-beo-overview-title {\n font-size: 18px;\n }\n}\n[box] .cb-beo-overview-businessname,\n[dialogbox] .cb-beo-overview-businessname,\n.cbeb-modal .cb-beo-overview-businessname {\n margin-top: 4px;\n margin-bottom: 4px;\n font-weight: bold;\n font-size: 15px;\n}\n[box] #communitybox-target,\n[dialogbox] #communitybox-target,\n.cbeb-modal #communitybox-target {\n background-color: transparent;\n color: #55606b;\n display: flex;\n flex-direction: column;\n}\n[box] [cbeb-main-div],\n[dialogbox] [cbeb-main-div],\n.cbeb-modal [cbeb-main-div] {\n display: flex;\n flex-direction: column;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n line-height: 1em;\n}\n[box] .cb-photo-uploaded,\n[dialogbox] .cb-photo-uploaded,\n.cbeb-modal .cb-photo-uploaded {\n margin-top: 10px;\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 20px;\n background-size: cover;\n background-repeat: no-repeat;\n background-position: center;\n cursor: pointer;\n}\n[box] .cbeb-fake-link,\n[dialogbox] .cbeb-fake-link,\n.cbeb-modal .cbeb-fake-link {\n font-weight: bold;\n text-decoration: underline;\n cursor: pointer;\n}\n[box] .cb-beo-text,\n[dialogbox] .cb-beo-text,\n.cbeb-modal .cb-beo-text {\n display: flex;\n justify-content: center;\n text-align: center;\n line-height: 1em;\n}\n[box] .cb-beo-readmore,\n[dialogbox] .cb-beo-readmore,\n.cbeb-modal .cb-beo-readmore {\n display: flex;\n color: var(--cb-readmore-fg-col);\n justify-content: center;\n text-decoration: underline;\n cursor: pointer;\n margin-bottom: 7px;\n}\n@media screen and (min-width: 511px) {\n [box] .cb-beo-readmore,\n [dialogbox] .cb-beo-readmore,\n .cbeb-modal .cb-beo-readmore {\n font-size: 12px;\n }\n}\n@media screen and (max-width: 510px) {\n [box] .cb-beo-readmore,\n [dialogbox] .cb-beo-readmore,\n .cbeb-modal .cb-beo-readmore {\n font-size: 16px;\n font-weight: 700;\n }\n}\n[box] .box-entry-overview-container,\n[dialogbox] .box-entry-overview-container,\n.cbeb-modal .box-entry-overview-container {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n padding-left: 10px;\n padding-right: 10px;\n}\n@media screen and (min-width: 511px) {\n [box] .box-entry-overview-container,\n [dialogbox] .box-entry-overview-container,\n .cbeb-modal .box-entry-overview-container {\n margin-bottom: 21px;\n }\n}\n@media screen and (max-width: 510px) {\n [box] .box-entry-overview-container:first-child,\n [dialogbox] .box-entry-overview-container:first-child,\n .cbeb-modal .box-entry-overview-container:first-child {\n margin-top: 0px;\n }\n}\n@media screen and (max-width: 510px) {\n [box] .box-entry-overview-container:nth-child(n + 2),\n [dialogbox] .box-entry-overview-container:nth-child(n + 2),\n .cbeb-modal .box-entry-overview-container:nth-child(n + 2) {\n margin-top: 40px;\n }\n}\n[box] .cbeb-vert-spacer,\n[dialogbox] .cbeb-vert-spacer,\n.cbeb-modal .cbeb-vert-spacer {\n display: flex;\n flex-grow: 1;\n}\n[box] .cbeb-search-container,\n[dialogbox] .cbeb-search-container,\n.cbeb-modal .cbeb-search-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n border: 1px solid lightgrey;\n}\n@media screen and (min-width: 511px) {\n [box] .cbeb-search-container,\n [dialogbox] .cbeb-search-container,\n .cbeb-modal .cbeb-search-container {\n padding-bottom: 3px;\n margin-left: 7px;\n }\n}\n@media screen and (max-width: 510px) {\n [box] .cbeb-search-container,\n [dialogbox] .cbeb-search-container,\n .cbeb-modal .cbeb-search-container {\n flex-basis: 100%;\n padding-top: 9px;\n padding-bottom: 10px;\n margin-bottom: 7px;\n border-radius: 7px;\n box-shadow: 0 4px 7px rgba(0, 0, 0, 0.1);\n }\n}\n[box] .cbeb-search-inputfield,\n[dialogbox] .cbeb-search-inputfield,\n.cbeb-modal .cbeb-search-inputfield {\n background-color: transparent;\n width: 300px;\n font-size: 14px;\n padding-top: 5px;\n border: none;\n outline: 0;\n padding-left: 10px;\n width: 280px;\n}\n[box] .cbeb-content-container,\n[dialogbox] .cbeb-content-container,\n.cbeb-modal .cbeb-content-container {\n display: flex;\n margin-top: 20px;\n user-select: text;\n -moz-user-select: text;\n -webkit-user-select: text;\n}\n@media screen and (min-width: 511px) {\n [box] .cbeb-content-container,\n [dialogbox] .cbeb-content-container,\n .cbeb-modal .cbeb-content-container {\n flex-flow: row wrap;\n position: relative;\n justify-content: center;\n }\n}\n@media screen and (max-width: 510px) {\n [box] .cbeb-content-container,\n [dialogbox] .cbeb-content-container,\n .cbeb-modal .cbeb-content-container {\n flex-direction: column;\n }\n}\n[box] [cbeb-button],\n[dialogbox] [cbeb-button],\n.cbeb-modal [cbeb-button] {\n font-size: 16px;\n border: none;\n display: flex;\n align-items: center;\n outline: 0;\n justify-content: center;\n color: #fcfcfc;\n cursor: pointer;\n font-family: inherit;\n padding: 7px 12px 7px 12px;\n}\n[box] .cbeb-toolbar-button,\n[dialogbox] .cbeb-toolbar-button,\n.cbeb-modal .cbeb-toolbar-button {\n font-size: 16px;\n border: none;\n display: flex;\n /* align-items: baseline; */\n outline: 0;\n justify-content: center;\n color: #fcfcfc;\n cursor: pointer;\n /*\n @media @mobile\n {\n align-items: center;\n margin-left: 7px;\n margin-top: 7px;\n margin-bottom: 21px;\n }\n */\n}\n@media screen and (min-width: 511px) {\n [box] .cbeb-toolbar-button,\n [dialogbox] .cbeb-toolbar-button,\n .cbeb-modal .cbeb-toolbar-button {\n align-items: baseline;\n }\n}\n[box] .cbeb-modal-content > *,\n[dialogbox] .cbeb-modal-content > *,\n.cbeb-modal .cbeb-modal-content > * {\n flex-shrink: 0;\n}\n[box] [close-dialog-btn],\n[dialogbox] [close-dialog-btn],\n.cbeb-modal [close-dialog-btn] {\n outline: none;\n border: none;\n background-color: transparent;\n font-size: 25px;\n color: white;\n cursor: pointer;\n}\n[box] [flexible-dialogbox-content],\n[dialogbox] [flexible-dialogbox-content],\n.cbeb-modal [flexible-dialogbox-content] {\n display: flex;\n flex-direction: column;\n border: none;\n margin: auto;\n background-color: #fcfcfc;\n color: #55606b;\n}\n@media screen and (min-width: 511px) {\n [box] [flexible-dialogbox-content],\n [dialogbox] [flexible-dialogbox-content],\n .cbeb-modal [flexible-dialogbox-content] {\n width: 90%;\n overflow-y: auto;\n max-height: 80%;\n }\n}\n@media screen and (max-width: 510px) {\n [box] [flexible-dialogbox-content],\n [dialogbox] [flexible-dialogbox-content],\n .cbeb-modal [flexible-dialogbox-content] {\n width: 100%;\n height: auto;\n min-height: 400px;\n }\n}\n[box] button[svg],\n[dialogbox] button[svg],\n.cbeb-modal button[svg] {\n outline: none;\n border: none;\n cursor: pointer;\n background-color: transparent;\n}\n[box] button[basic],\n[dialogbox] button[basic],\n.cbeb-modal button[basic] {\n font-size: 13px;\n font-weight: bold;\n /* text-transform: uppercase; */\n padding: 10px 19px 10px 19px;\n border: 1px solid white;\n cursor: pointer;\n}\n[box] .cbeb-dialog-title-button,\n[dialogbox] .cbeb-dialog-title-button,\n.cbeb-modal .cbeb-dialog-title-button {\n color: #fcfcfc;\n font-size: 13px;\n font-weight: bold;\n /* text-transform: uppercase; */\n padding: 7px;\n margin-top: 5px !important;\n margin-bottom: 5px !important;\n margin-left: 5px;\n margin-right: 5px;\n border: 1px solid white;\n cursor: pointer;\n}\n[box] .cbeb-dialog-close-button,\n[dialogbox] .cbeb-dialog-close-button,\n.cbeb-modal .cbeb-dialog-close-button {\n font-size: 13px;\n font-weight: bold;\n margin: 5px;\n cursor: pointer;\n width: 27px;\n height: 27px;\n stroke-width: 2px;\n stroke: white;\n}\n[box] .cbeb-dialog-msg,\n[dialogbox] .cbeb-dialog-msg,\n.cbeb-modal .cbeb-dialog-msg {\n padding-left: 20px;\n padding-right: 20px;\n padding-top: 15px;\n margin-top: 10px;\n text-align: center;\n}\n[box] .cbeb-dialog-msg > h1,\n[dialogbox] .cbeb-dialog-msg > h1,\n.cbeb-modal .cbeb-dialog-msg > h1 {\n display: flex;\n justify-content: center;\n}\n[box] .cbeb-dlg-input-row,\n[dialogbox] .cbeb-dlg-input-row,\n.cbeb-modal .cbeb-dlg-input-row {\n display: flex;\n margin-top: 10px;\n justify-content: center;\n}\n[box] .cbeb-dlg-input-row-input,\n[dialogbox] .cbeb-dlg-input-row-input,\n.cbeb-modal .cbeb-dlg-input-row-input {\n flex-direction: column;\n flex-grow: 0;\n width: 350px;\n}\n[box] .cbeb-dlg-input-label,\n[dialogbox] .cbeb-dlg-input-label,\n.cbeb-modal .cbeb-dlg-input-label {\n padding-top: 17px;\n font-size: 11px;\n}\n[box] .cbeb-dlg-inputfield-container,\n[dialogbox] .cbeb-dlg-inputfield-container,\n.cbeb-modal .cbeb-dlg-inputfield-container {\n display: flex;\n}\n[box] [cbeb-password-input-container],\n[dialogbox] [cbeb-password-input-container],\n.cbeb-modal [cbeb-password-input-container] {\n display: flex;\n flex-direction: row;\n border-bottom: 1px solid grey;\n}\n[box] .cbeb-dlg-input,\n[dialogbox] .cbeb-dlg-input,\n.cbeb-modal .cbeb-dlg-input,\n[box] input[basic],\n[dialogbox] input[basic],\n.cbeb-modal input[basic] {\n display: flex;\n flex-grow: 1;\n padding-top: 5px;\n border-top: none;\n border-left: none;\n border-right: none;\n border-bottom: 1px solid grey;\n outline: 0;\n font-weight: 400;\n font-style: normal;\n font-size: 17px;\n}\n[box] [cbeb-password-input],\n[dialogbox] [cbeb-password-input],\n.cbeb-modal [cbeb-password-input] {\n display: flex;\n flex-grow: 1;\n padding-top: 5px;\n border: none;\n outline: 0;\n font-weight: 400;\n font-style: normal;\n font-size: 17px;\n}\n[box] .cbeb-checkbox-container,\n[dialogbox] .cbeb-checkbox-container,\n.cbeb-modal .cbeb-checkbox-container {\n display: flex;\n flex-direction: column;\n}\n[box] .cbeb-modal-field-container,\n[dialogbox] .cbeb-modal-field-container,\n.cbeb-modal .cbeb-modal-field-container {\n padding-left: 40px;\n padding-right: 40px;\n padding-bottom: 20px;\n display: flex;\n flex-direction: column;\n height: auto;\n}\n[box] .loader,\n[dialogbox] .loader,\n.cbeb-modal .loader {\n display: none;\n justify-content: center;\n align-items: center;\n margin: auto;\n}\n[box] .spinner,\n[dialogbox] .spinner,\n.cbeb-modal .spinner {\n justify-content: center;\n align-items: center;\n margin: auto;\n}\n[box] .cbeb-locked-preamble-row,\n[dialogbox] .cbeb-locked-preamble-row,\n.cbeb-modal .cbeb-locked-preamble-row {\n display: flex;\n}\n[box] .cbeb-entry-preamble-text,\n[dialogbox] .cbeb-entry-preamble-text,\n.cbeb-modal .cbeb-entry-preamble-text {\n border-bottom: 1px solid grey;\n display: flex;\n align-items: flex-end;\n padding-bottom: 1px;\n}\n[box] .cbeb-entry-input,\n[dialogbox] .cbeb-entry-input,\n.cbeb-modal .cbeb-entry-input {\n display: flex;\n flex-grow: 1;\n padding-top: 5px;\n border-top: none;\n border-left: none;\n border-right: none;\n border-bottom: 1px solid grey;\n font-weight: 400;\n font-style: normal;\n font-size: 17px;\n outline: none;\n}\n[box] .cbeb-entry-view > a,\n[dialogbox] .cbeb-entry-view > a,\n.cbeb-modal .cbeb-entry-view > a {\n color: #55606b;\n}\n[box] .cbeb-center,\n[dialogbox] .cbeb-center,\n.cbeb-modal .cbeb-center {\n justify-content: center;\n}\n[box] .cbeb-entry-input-label,\n[dialogbox] .cbeb-entry-input-label,\n.cbeb-modal .cbeb-entry-input-label,\n[box] [cbeb-entry-input-label],\n[dialogbox] [cbeb-entry-input-label],\n.cbeb-modal [cbeb-entry-input-label] {\n padding-top: 17px;\n font-size: 11px;\n}\n[box] .cbeb-entry-input-row,\n[dialogbox] .cbeb-entry-input-row,\n.cbeb-modal .cbeb-entry-input-row {\n display: flex;\n margin-top: 10px;\n flex-direction: column;\n}\n[box] .cbeb-entry-view-row,\n[dialogbox] .cbeb-entry-view-row,\n.cbeb-modal .cbeb-entry-view-row {\n display: flex;\n flex-direction: column;\n margin-top: 25px;\n}\n[box] .cbeb-entry-tag-container,\n[dialogbox] .cbeb-entry-tag-container,\n.cbeb-modal .cbeb-entry-tag-container {\n display: flex;\n flex-grow: 1;\n flex-wrap: wrap;\n padding-top: 7px;\n border-bottom: 1px solid grey;\n}\n[box] .cbeb-entry-tag-details-container,\n[dialogbox] .cbeb-entry-tag-details-container,\n.cbeb-modal .cbeb-entry-tag-details-container {\n display: flex;\n justify-content: center;\n flex-direction: row;\n flex-wrap: wrap;\n flex-grow: 1;\n padding-top: 7px;\n padding-bottom: 7px;\n}\n[box] .cbeb-entry-input-row-left,\n[dialogbox] .cbeb-entry-input-row-left,\n.cbeb-modal .cbeb-entry-input-row-left {\n display: flex;\n flex-basis: 5%;\n align-items: flex-end;\n justify-content: flex-end;\n font-size: 18px;\n padding-bottom: 2px;\n color: #777777;\n}\n[box] .cbeb-entry-input-row-right,\n[dialogbox] .cbeb-entry-input-row-right,\n.cbeb-modal .cbeb-entry-input-row-right {\n padding-top: 11px;\n flex-basis: 5%;\n font-size: 20px;\n font-weight: bold;\n}\n[box] .cbeb-entry-image-input-container,\n[dialogbox] .cbeb-entry-image-input-container,\n.cbeb-modal .cbeb-entry-image-input-container {\n display: flex;\n justify-content: center;\n}\n[box] .cbeb-entry-inputfield-container,\n[dialogbox] .cbeb-entry-inputfield-container,\n.cbeb-modal .cbeb-entry-inputfield-container {\n display: flex;\n}\n[box] .cbeb-entry-viewfield-container,\n[dialogbox] .cbeb-entry-viewfield-container,\n.cbeb-modal .cbeb-entry-viewfield-container {\n display: flex;\n justify-content: center;\n flex-direction: column;\n align-items: center;\n margin-top: 4px;\n}\n[box] .cbeb-entry-viewfield-container [detail-label],\n[dialogbox] .cbeb-entry-viewfield-container [detail-label],\n.cbeb-modal .cbeb-entry-viewfield-container [detail-label] {\n font-size: 13px;\n font-weight: 900;\n letter-spacing: -1px;\n}\n[box] .cbeb-entry-multiline,\n[dialogbox] .cbeb-entry-multiline,\n.cbeb-modal .cbeb-entry-multiline {\n font-size: 13px !important;\n border-left: 1px solid lightgrey !important;\n border-right: 1px solid lightgrey !important;\n border-top: 1px solid lightgrey !important;\n}\n[box] .cb-image-upload > input,\n[dialogbox] .cb-image-upload > input,\n.cbeb-modal .cb-image-upload > input {\n display: none;\n}\n[box] .cb-image-upload img,\n[dialogbox] .cb-image-upload img,\n.cbeb-modal .cb-image-upload img {\n width: 150px;\n height: 150px;\n cursor: pointer;\n}\n[box] .cb-image-upload div,\n[dialogbox] .cb-image-upload div,\n.cbeb-modal .cb-image-upload div {\n width: 150px;\n height: 150px;\n cursor: pointer;\n}\n[box] .cb-image-upload,\n[dialogbox] .cb-image-upload,\n.cbeb-modal .cb-image-upload {\n display: flex;\n justify-content: center;\n align-items: center;\n background-size: cover;\n background-repeat: no-repeat;\n background-position: center;\n width: 150px;\n height: 150px;\n border-radius: 50%;\n background-color: #eee;\n border: dashed 2px #ddd;\n margin-top: 30px;\n cursor: pointer;\n}\n[box] .cb-image-upload-readonly,\n[dialogbox] .cb-image-upload-readonly,\n.cbeb-modal .cb-image-upload-readonly {\n background-size: cover;\n background-repeat: no-repeat;\n background-position: center;\n border-radius: 50%;\n background-color: transparent;\n margin-top: 30px !important;\n}\n[box] #cbeb-add-entry-modal-field-container,\n[dialogbox] #cbeb-add-entry-modal-field-container,\n.cbeb-modal #cbeb-add-entry-modal-field-container {\n /* overflow-y: scroll; */\n /* height: 800px; */\n padding-left: 30px;\n padding-right: 30px;\n padding-bottom: 20px;\n}\n[box] #cbeb-edit-entry-modal-field-container,\n[dialogbox] #cbeb-edit-entry-modal-field-container,\n.cbeb-modal #cbeb-edit-entry-modal-field-container {\n padding-left: 30px;\n padding-right: 30px;\n padding-bottom: 20px;\n}\n@media screen and (min-width: 511px) {\n [box] #cbeb-edit-entry-modal-field-container,\n [dialogbox] #cbeb-edit-entry-modal-field-container,\n .cbeb-modal #cbeb-edit-entry-modal-field-container {\n height: 80vh;\n }\n}\n[box] #cbeb-view-entry-modal-field-container,\n[dialogbox] #cbeb-view-entry-modal-field-container,\n.cbeb-modal #cbeb-view-entry-modal-field-container {\n overflow-y: visible;\n padding-left: 30px;\n padding-right: 30px;\n padding-bottom: 20px;\n}\n[box] #cbeb-view-entry-modal-field-container a,\n[dialogbox] #cbeb-view-entry-modal-field-container a,\n.cbeb-modal #cbeb-view-entry-modal-field-container a {\n text-decoration: none;\n}\n[box] .cbeb-extra-button-row,\n[dialogbox] .cbeb-extra-button-row,\n.cbeb-modal .cbeb-extra-button-row {\n display: flex;\n padding-top: 20px;\n padding-bottom: 20px;\n justify-content: center;\n align-items: center;\n}\n[box] .cbeb-socmed-details,\n[dialogbox] .cbeb-socmed-details,\n.cbeb-modal .cbeb-socmed-details {\n display: flex;\n font-size: 19px;\n justify-content: center;\n padding-top: 5px;\n margin-bottom: 15px;\n color: #64b5f6;\n}\n[box] .cbeb-socmed-summary,\n[dialogbox] .cbeb-socmed-summary,\n.cbeb-modal .cbeb-socmed-summary {\n display: flex;\n justify-content: center;\n color: #64b5f6;\n margin-bottom: 5px;\n margin-top: 4px;\n}\n[box] .cbeb-socmed-indiv,\n[dialogbox] .cbeb-socmed-indiv,\n.cbeb-modal .cbeb-socmed-indiv {\n cursor: pointer;\n margin-left: 5px;\n margin-right: 5px;\n}\n[box] .cbeb-add-entry-error-msg,\n[dialogbox] .cbeb-add-entry-error-msg,\n.cbeb-modal .cbeb-add-entry-error-msg {\n display: flex;\n color: red;\n font-size: 12px;\n justify-content: center;\n margin-top: 20px;\n}\n[box] .cbeb-entry-tag-input,\n[dialogbox] .cbeb-entry-tag-input,\n.cbeb-modal .cbeb-entry-tag-input {\n display: flex;\n flex-grow: 1;\n padding-top: 5px;\n padding-left: 7px;\n border: none;\n font-weight: 400;\n font-style: normal;\n font-size: 17px;\n outline: none;\n box-sizing: content-box;\n}\n[box] .cbeb-entry-tag,\n[dialogbox] .cbeb-entry-tag,\n.cbeb-modal .cbeb-entry-tag {\n display: flex;\n align-items: center;\n padding-top: 2px;\n padding-bottom: 2px;\n color: white;\n font-size: 14px;\n margin-left: 2px;\n margin-right: 2px;\n padding-left: 7px;\n padding-right: 7px;\n padding-bottom: 4px;\n margin-top: 5px;\n}\n[box] .cbeb-detail-tag,\n[dialogbox] .cbeb-detail-tag,\n.cbeb-modal .cbeb-detail-tag {\n cursor: pointer;\n}\n[box] .cbeb-category-summary-container,\n[dialogbox] .cbeb-category-summary-container,\n.cbeb-modal .cbeb-category-summary-container {\n display: flex;\n justify-content: center;\n flex-grow: 0;\n flex-direction: row;\n flex-wrap: wrap;\n font-weight: bold;\n margin-top: 4px;\n}\n[box] .cbeb-category-summary,\n[dialogbox] .cbeb-category-summary,\n.cbeb-modal .cbeb-category-summary {\n display: flex;\n color: white;\n padding-top: 3px;\n padding-bottom: 4px;\n margin: 2px;\n cursor: pointer;\n line-height: 1em;\n text-align: center;\n}\n[box] .cbeb-bio-snippet,\n[dialogbox] .cbeb-bio-snippet,\n.cbeb-modal .cbeb-bio-snippet {\n display: flex;\n justify-content: center;\n align-items: center;\n text-align: center;\n line-height: 1.1;\n margin-top: 4px;\n margin-bottom: 4px;\n}\n[box] .cbeb-vert-flex,\n[dialogbox] .cbeb-vert-flex,\n.cbeb-modal .cbeb-vert-flex {\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n[box] .cbeb-act-container,\n[dialogbox] .cbeb-act-container,\n.cbeb-modal .cbeb-act-container {\n display: flex;\n flex-direction: column;\n margin-top: 20px;\n flex-grow: 1;\n}\n@media screen and (min-width: 511px) {\n [box] .cbeb-act-container,\n [dialogbox] .cbeb-act-container,\n .cbeb-modal .cbeb-act-container {\n margin-left: 7px;\n margin-right: 7px;\n }\n}\n[box] .cbeb-act-row,\n[dialogbox] .cbeb-act-row,\n.cbeb-modal .cbeb-act-row {\n display: flex;\n flex-direction: row;\n border: 1px solid lightgrey;\n margin-top: 5px;\n margin-bottom: 5px;\n padding-left: 10px;\n padding-top: 5px;\n padding-bottom: 5px;\n padding-right: 10px;\n align-items: center;\n}\n[box] .cbeb-act-button-group,\n[dialogbox] .cbeb-act-button-group,\n.cbeb-modal .cbeb-act-button-group {\n display: flex;\n flex-direction: row;\n flex-grow: 0;\n column-gap: 14px;\n}\n[box] .cbeb-act-name,\n[dialogbox] .cbeb-act-name,\n.cbeb-modal .cbeb-act-name {\n flex-grow: 1;\n}\n[box] .cbeb-act-button,\n[dialogbox] .cbeb-act-button,\n.cbeb-modal .cbeb-act-button {\n margin-left: 4px;\n margin-right: 3px;\n padding: 5px;\n color: white;\n font-size: 15px;\n cursor: pointer;\n}\n@media screen and (max-width: 510px) {\n [box] .cbeb-act-msg,\n [dialogbox] .cbeb-act-msg,\n .cbeb-modal .cbeb-act-msg {\n display: flex;\n flex-direction: column;\n justify-content: center;\n text-align: center;\n }\n}\n[box] .cbeb-close-tag,\n[dialogbox] .cbeb-close-tag,\n.cbeb-modal .cbeb-close-tag {\n font-weight: bold;\n cursor: pointer;\n}\n[box] .cbeb-detailleft,\n[dialogbox] .cbeb-detailleft,\n.cbeb-modal .cbeb-detailleft {\n padding-top: 2px;\n min-width: 30px;\n font-size: 13px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n[box] .cbeb-search-clear-btn,\n[dialogbox] .cbeb-search-clear-btn,\n.cbeb-modal .cbeb-search-clear-btn {\n margin-right: 7px;\n}\n[box] #cbeb-imgupload-progress-msg,\n[dialogbox] #cbeb-imgupload-progress-msg,\n.cbeb-modal #cbeb-imgupload-progress-msg {\n display: none;\n width: auto;\n height: auto;\n}\n[box] .cbeb-toolbar-btn-group,\n[dialogbox] .cbeb-toolbar-btn-group,\n.cbeb-modal .cbeb-toolbar-btn-group {\n display: flex;\n flex-direction: row;\n justify-content: center;\n}\n[box] .cbeb-toolbar-searchgroup,\n[dialogbox] .cbeb-toolbar-searchgroup,\n.cbeb-modal .cbeb-toolbar-searchgroup {\n display: flex;\n flex-direction: row;\n}\n[box] .cbeb-fpw-row,\n[dialogbox] .cbeb-fpw-row,\n.cbeb-modal .cbeb-fpw-row {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n[box] .cbeb-banner,\n[dialogbox] .cbeb-banner,\n.cbeb-modal .cbeb-banner {\n display: block;\n margin: auto;\n margin-top: 20px;\n margin-bottom: 20px;\n}\n@media screen and (max-width: 510px) {\n [box] .cbeb-banner,\n [dialogbox] .cbeb-banner,\n .cbeb-modal .cbeb-banner {\n max-width: 80vw;\n }\n}\n@media screen and (min-width: 511px) {\n [box] .cbeb-banner,\n [dialogbox] .cbeb-banner,\n .cbeb-modal .cbeb-banner {\n height: 100px;\n }\n}\n@keyframes buttonPulse {\n 50% {\n opacity: 0.4;\n }\n}\n[box] .cbeb-pulse-colour,\n[dialogbox] .cbeb-pulse-colour,\n.cbeb-modal .cbeb-pulse-colour {\n animation: buttonPulse 3s infinite;\n}\n[box] .cbeb-normal-btn-row,\n[dialogbox] .cbeb-normal-btn-row,\n.cbeb-modal .cbeb-normal-btn-row {\n display: flex;\n}\n@media screen and (min-width: 511px) {\n [box] .cbeb-normal-btn-row,\n [dialogbox] .cbeb-normal-btn-row,\n .cbeb-modal .cbeb-normal-btn-row {\n flex-direction: row;\n flex-wrap: wrap;\n }\n}\n@media screen and (max-width: 510px) {\n [box] .cbeb-normal-btn-row,\n [dialogbox] .cbeb-normal-btn-row,\n .cbeb-modal .cbeb-normal-btn-row {\n flex-direction: column;\n justify-content: center;\n }\n}\n[box] .cbeb-normal-btn,\n[dialogbox] .cbeb-normal-btn,\n.cbeb-modal .cbeb-normal-btn {\n display: flex;\n cursor: pointer;\n margin-top: 7px;\n margin-bottom: 7px;\n margin-left: 7px;\n margin-right: 7px;\n color: #fcfcfc;\n padding-top: 5px;\n padding-bottom: 5px;\n padding-left: 7px;\n padding-right: 7px;\n}\n@media screen and (max-width: 510px) {\n [box] .cbeb-normal-btn,\n [dialogbox] .cbeb-normal-btn,\n .cbeb-modal .cbeb-normal-btn {\n justify-content: center;\n }\n}\n[box] [server-error-msg],\n[dialogbox] [server-error-msg],\n.cbeb-modal [server-error-msg] {\n text-align: center;\n border: 1px solid #77b3f4;\n padding: 20px;\n}\n[box] #cbeb-tc-text,\n[dialogbox] #cbeb-tc-text,\n.cbeb-modal #cbeb-tc-text {\n margin-left: 30px;\n margin-top: 20px;\n margin-right: 30px;\n font-size: 14px;\n}\n[box] [cbeb-poweredby],\n[dialogbox] [cbeb-poweredby],\n.cbeb-modal [cbeb-poweredby] {\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: baseline;\n column-gap: 7px;\n}\n[box] [showmore-row],\n[dialogbox] [showmore-row],\n.cbeb-modal [showmore-row] {\n display: flex;\n flex-direction: row;\n justify-content: center;\n margin-top: 10px;\n margin-bottom: 10px;\n}\n[box] [showmore-row] button,\n[dialogbox] [showmore-row] button,\n.cbeb-modal [showmore-row] button {\n background-color: transparent;\n outline: 0;\n border: 0;\n text-decoration: underline;\n cursor: pointer;\n font-size: 16px;\n color: #1abc9c;\n}\n[box] [footer],\n[dialogbox] [footer],\n.cbeb-modal [footer] {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n}\n[box] [footer] #privacy-policy,\n[dialogbox] [footer] #privacy-policy,\n.cbeb-modal [footer] #privacy-policy {\n text-decoration: underline;\n cursor: pointer;\n}\n@media screen and (min-width: 511px) {\n [box] [footer],\n [dialogbox] [footer],\n .cbeb-modal [footer] {\n font-size: 15px;\n margin-top: 20px;\n }\n}\n@media screen and (max-width: 510px) {\n [box] [footer],\n [dialogbox] [footer],\n .cbeb-modal [footer] {\n margin-top: 31px;\n }\n}\n[box] .cbeb-banner-text,\n[dialogbox] .cbeb-banner-text,\n.cbeb-modal .cbeb-banner-text {\n display: flex;\n justify-content: center;\n margin-bottom: 20px;\n margin-top: 10px;\n padding-left: 20%;\n padding-right: 20%;\n text-align: center;\n}\n[box] .cb-beo-overview-location,\n[dialogbox] .cb-beo-overview-location,\n.cbeb-modal .cb-beo-overview-location {\n cursor: pointer;\n}\n[box] .cb-beo-overview-location a,\n[dialogbox] .cb-beo-overview-location a,\n.cbeb-modal .cb-beo-overview-location a {\n text-decoration: none;\n}\n@media screen and (min-width: 511px) {\n [box] .cb-beo-overview-location,\n [dialogbox] .cb-beo-overview-location,\n .cbeb-modal .cb-beo-overview-location {\n margin-top: 4px;\n margin-bottom: 7px;\n font-size: 14px;\n }\n}\n@media screen and (max-width: 510px) {\n [box] .cb-beo-overview-location,\n [dialogbox] .cb-beo-overview-location,\n .cbeb-modal .cb-beo-overview-location {\n margin-top: 7px;\n margin-bottom: 3px;\n font-size: 18px;\n }\n}\n[box] .cbeb-error-label,\n[dialogbox] .cbeb-error-label,\n.cbeb-modal .cbeb-error-label {\n color: red;\n display: inline-block;\n}\n[box] [cbeb-map],\n[dialogbox] [cbeb-map],\n.cbeb-modal [cbeb-map] {\n height: 400px;\n}\n@media screen and (max-width: 510px) {\n [box] [cbeb-map],\n [dialogbox] [cbeb-map],\n .cbeb-modal [cbeb-map] {\n width: 100%;\n margin-left: auto;\n margin-right: auto;\n }\n}\n@media screen and (min-width: 511px) {\n [box] [cbeb-map],\n [dialogbox] [cbeb-map],\n .cbeb-modal [cbeb-map] {\n width: 100%;\n margin-left: 7px;\n margin-right: 7px;\n margin-bottom: 37px;\n margin-top: 21px;\n }\n}\n[box] .cb-beo-connect,\n[dialogbox] .cb-beo-connect,\n.cbeb-modal .cb-beo-connect {\n display: flex;\n justify-content: center;\n}\n[box] .cb-beo-connect button,\n[dialogbox] .cb-beo-connect button,\n.cbeb-modal .cb-beo-connect button {\n background-color: #55606b;\n color: white;\n outline: 0;\n border: none;\n padding-top: 2px;\n padding-bottom: 2px;\n padding-left: 8px;\n padding-right: 8px;\n border-radius: 8px;\n font-size: 14px;\n cursor: pointer;\n}\n[box] [cbeb-invitation-lookup-modal] [cbeb-modal-field-container],\n[dialogbox] [cbeb-invitation-lookup-modal] [cbeb-modal-field-container],\n.cbeb-modal [cbeb-invitation-lookup-modal] [cbeb-modal-field-container] {\n padding-left: 30px;\n padding-right: 30px;\n padding-bottom: 10px;\n}\n[box] [cbeb-invitation-lookup-modal] [cbeb-modal-field-container] [cbeb-lookup-msg],\n[dialogbox] [cbeb-invitation-lookup-modal] [cbeb-modal-field-container] [cbeb-lookup-msg],\n.cbeb-modal [cbeb-invitation-lookup-modal] [cbeb-modal-field-container] [cbeb-lookup-msg],\n[box] [cbeb-invitation-lookup-modal] [cbeb-modal-field-container] [cbeb-signing-up],\n[dialogbox] [cbeb-invitation-lookup-modal] [cbeb-modal-field-container] [cbeb-signing-up],\n.cbeb-modal [cbeb-invitation-lookup-modal] [cbeb-modal-field-container] [cbeb-signing-up] {\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n[box] [cbeb-invitation-lookup-modal] [cbeb-modal-field-container] [invite-email],\n[dialogbox] [cbeb-invitation-lookup-modal] [cbeb-modal-field-container] [invite-email],\n.cbeb-modal [cbeb-invitation-lookup-modal] [cbeb-modal-field-container] [invite-email] {\n font-weight: bold;\n}\n[box] [cbeb-connection-modal] [requesting-connection],\n[dialogbox] [cbeb-connection-modal] [requesting-connection],\n.cbeb-modal [cbeb-connection-modal] [requesting-connection] {\n display: flex;\n flex-direction: column;\n align-items: center;\n box-sizing: border-box;\n padding: 31px;\n}\n[box] [cbeb-connection-modal] [connection-made],\n[dialogbox] [cbeb-connection-modal] [connection-made],\n.cbeb-modal [cbeb-connection-modal] [connection-made] {\n display: flex;\n flex-direction: row;\n justify-content: center;\n padding-left: 30px;\n padding-right: 30px;\n padding-top: 30px;\n padding-bottom: 30px;\n}\n[box] [cbeb-connection-lookup-dlg] [looking-up-data],\n[dialogbox] [cbeb-connection-lookup-dlg] [looking-up-data],\n.cbeb-modal [cbeb-connection-lookup-dlg] [looking-up-data] {\n display: flex;\n flex-direction: column;\n justify-content: center;\n text-align: center;\n padding-left: 30px;\n padding-right: 30px;\n}\n[box] [cbeb-connection-lookup-dlg] [found-connection],\n[dialogbox] [cbeb-connection-lookup-dlg] [found-connection],\n.cbeb-modal [cbeb-connection-lookup-dlg] [found-connection] {\n display: flex;\n flex-direction: column;\n justify-content: center;\n text-align: center;\n padding-left: 30px;\n padding-right: 30px;\n padding-top: 30px;\n padding-bottom: 30px;\n}\n[box] [cbeb-connection-lookup-dlg] [spinner],\n[dialogbox] [cbeb-connection-lookup-dlg] [spinner],\n.cbeb-modal [cbeb-connection-lookup-dlg] [spinner] {\n min-height: 100px;\n}\n[box] [cbeb-share-entry-dlg] [contents],\n[dialogbox] [cbeb-share-entry-dlg] [contents],\n.cbeb-modal [cbeb-share-entry-dlg] [contents] {\n display: flex;\n flex-direction: row;\n justify-content: space-evenly;\n align-items: center;\n}\n[box] [cbeb-share-entry-dlg] [share-row],\n[dialogbox] [cbeb-share-entry-dlg] [share-row],\n.cbeb-modal [cbeb-share-entry-dlg] [share-row] {\n margin-top: 10px;\n margin-bottom: 10px;\n}\n[box] [cbeb-input-group],\n[dialogbox] [cbeb-input-group],\n.cbeb-modal [cbeb-input-group] {\n display: flex;\n flex-direction: column;\n}\n[box] [cbeb-product-picture-edit-row],\n[dialogbox] [cbeb-product-picture-edit-row],\n.cbeb-modal [cbeb-product-picture-edit-row] {\n display: flex;\n flex-direction: row;\n flex-grow: 1;\n justify-content: space-between;\n}\n[box] [cbeb-product-picture-edit-row] [inputfields],\n[dialogbox] [cbeb-product-picture-edit-row] [inputfields],\n.cbeb-modal [cbeb-product-picture-edit-row] [inputfields] {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n flex-grow: 1;\n}\n[box] [cbeb-product-picture-edit-row] [inputfields] input,\n[dialogbox] [cbeb-product-picture-edit-row] [inputfields] input,\n.cbeb-modal [cbeb-product-picture-edit-row] [inputfields] input {\n display: flex;\n flex-grow: 0;\n}\n[box] [cbeb-product-picture-edit-row] [cbeb-pp-upload-thumbnail],\n[dialogbox] [cbeb-product-picture-edit-row] [cbeb-pp-upload-thumbnail],\n.cbeb-modal [cbeb-product-picture-edit-row] [cbeb-pp-upload-thumbnail] {\n width: 120px;\n height: 120px;\n background-size: cover;\n background-repeat: no-repeat;\n background-position: center;\n background-color: #eee;\n background-image: url('https://dashboard.communitybox.co/img/upload-image.png');\n border: 2px dashed #ddd;\n}\n[box] [cbeb-product-picture-edit-row] [cbeb-pp-upload-thumbnail] input,\n[dialogbox] [cbeb-product-picture-edit-row] [cbeb-pp-upload-thumbnail] input,\n.cbeb-modal [cbeb-product-picture-edit-row] [cbeb-pp-upload-thumbnail] input {\n display: none;\n}\n[box] [cbeb-product-picture-edit-row] [cbeb-pp-upload-thumbnail] img,\n[dialogbox] [cbeb-product-picture-edit-row] [cbeb-pp-upload-thumbnail] img,\n.cbeb-modal [cbeb-product-picture-edit-row] [cbeb-pp-upload-thumbnail] img {\n width: 120px;\n height: 120px;\n cursor: pointer;\n}\n[box] [cbeb-product-picture-edit-row] [cbeb-pp-upload-thumbnail] div,\n[dialogbox] [cbeb-product-picture-edit-row] [cbeb-pp-upload-thumbnail] div,\n.cbeb-modal [cbeb-product-picture-edit-row] [cbeb-pp-upload-thumbnail] div {\n width: 120px;\n height: 120px;\n cursor: pointer;\n}\n[box] [cbeb-ev-gallery],\n[dialogbox] [cbeb-ev-gallery],\n.cbeb-modal [cbeb-ev-gallery] {\n display: flex;\n flex-direction: row;\n justify-content: space-evenly;\n}\n[box] [cbeb-ev-gallery] [cbeb-ev-gallery-pic],\n[dialogbox] [cbeb-ev-gallery] [cbeb-ev-gallery-pic],\n.cbeb-modal [cbeb-ev-gallery] [cbeb-ev-gallery-pic] {\n width: 130px;\n height: 130px;\n background-size: cover;\n background-repeat: no-repeat;\n background-position: center;\n background-color: #eee;\n cursor: pointer;\n}\n[box] [feature-listing][container],\n[dialogbox] [feature-listing][container],\n.cbeb-modal [feature-listing][container] {\n height: 20px;\n color: white;\n text-align: center;\n font-size: 14px;\n font-weight: bold;\n display: flex;\n flex-direction: row;\n justify-content: center;\n}\n[box] [feature-listing][container] [banner],\n[dialogbox] [feature-listing][container] [banner],\n.cbeb-modal [feature-listing][container] [banner] {\n padding-left: 20px;\n padding-right: 20px;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n@media screen and (max-width: 510px) {\n [box] [toolbar][desktop],\n [dialogbox] [toolbar][desktop],\n .cbeb-modal [toolbar][desktop] {\n display: none;\n }\n}\n@media screen and (min-width: 511px) {\n [box] [toolbar][desktop],\n [dialogbox] [toolbar][desktop],\n .cbeb-modal [toolbar][desktop] {\n display: flex;\n margin-left: 7px;\n margin-right: 7px;\n }\n}\n@media screen and (min-width: 511px) {\n [box] [toolbar][mobile],\n [dialogbox] [toolbar][mobile],\n .cbeb-modal [toolbar][mobile] {\n display: none;\n }\n}\n@media screen and (max-width: 510px) {\n [box] [toolbar][mobile],\n [dialogbox] [toolbar][mobile],\n .cbeb-modal [toolbar][mobile] {\n display: flex;\n margin-top: 10px;\n /* margin-left: 10px;\n margin-right: 10px; */\n }\n}\n[box] [toolbar],\n[dialogbox] [toolbar],\n.cbeb-modal [toolbar] {\n flex-wrap: wrap;\n justify-content: space-between;\n flex-direction: row;\n}\n[box] [toolbar] [select-container],\n[dialogbox] [toolbar] [select-container],\n.cbeb-modal [toolbar] [select-container] {\n padding: 0;\n width: 190px;\n overflow: hidden;\n background: #fff url("https://dashboard.communitybox.co/img/dropdown_3.png") no-repeat 95% 50%;\n display: flex;\n}\n@media screen and (min-width: 511px) {\n [box] [toolbar] [select-container],\n [dialogbox] [toolbar] [select-container],\n .cbeb-modal [toolbar] [select-container] {\n margin: 0;\n }\n}\n@media screen and (max-width: 510px) {\n [box] [toolbar] [select-container],\n [dialogbox] [toolbar] [select-container],\n .cbeb-modal [toolbar] [select-container] {\n margin-top: 7px;\n margin-left: 7px;\n }\n}\n[box] [toolbar] [select-container] select,\n[dialogbox] [toolbar] [select-container] select,\n.cbeb-modal [toolbar] [select-container] select {\n color: white;\n padding: 5px 8px;\n width: 130%;\n border: none;\n box-shadow: none;\n background-color: transparent;\n background-image: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n[box] [toolbar] [select-container] select:focus,\n[dialogbox] [toolbar] [select-container] select:focus,\n.cbeb-modal [toolbar] [select-container] select:focus {\n outline: none;\n}\n[box] .choices,\n[dialogbox] .choices,\n.cbeb-modal .choices {\n flex-grow: 1;\n}\n[box] .choices__list--dropdown,\n[dialogbox] .choices__list--dropdown,\n.cbeb-modal .choices__list--dropdown {\n z-index: 2 !important;\n}\n[box] .choices__inner,\n[dialogbox] .choices__inner,\n.cbeb-modal .choices__inner {\n padding-right: 0px !important;\n padding-left: 0px !important;\n}\n[box] .choices__item,\n[dialogbox] .choices__item,\n.cbeb-modal .choices__item {\n border-radius: 0px !important;\n margin-right: 2px !important;\n margin-left: 2px;\n border: none !important;\n}\n[box] #cbeb-login-modal p,\n[dialogbox] #cbeb-login-modal p,\n.cbeb-modal #cbeb-login-modal p {\n text-align: center;\n font-size: 15px;\n}\n[box] button[fake-link],\n[dialogbox] button[fake-link],\n.cbeb-modal button[fake-link] {\n outline: none;\n border: none;\n background-color: transparent;\n text-decoration: underline;\n cursor: pointer;\n padding-left: 0px;\n padding-right: 0px;\n font-size: inherit;\n}\n[box] [entry-ordering],\n[dialogbox] [entry-ordering],\n.cbeb-modal [entry-ordering] {\n font-size: 16px;\n}\n[box] [entry-ordering] > option,\n[dialogbox] [entry-ordering] > option,\n.cbeb-modal [entry-ordering] > option {\n color: grey;\n}\n[box] [h17],\n[dialogbox] [h17],\n.cbeb-modal [h17] {\n height: 17px;\n}\n[box] [h37],\n[dialogbox] [h37],\n.cbeb-modal [h37] {\n height: 37px;\n}\n[box] [flexrow],\n[dialogbox] [flexrow],\n.cbeb-modal [flexrow] {\n display: flex;\n flex-direction: row;\n}\n[box] [flex],\n[dialogbox] [flex],\n.cbeb-modal [flex] {\n display: flex;\n}\n[box] [col],\n[dialogbox] [col],\n.cbeb-modal [col] {\n flex-direction: column;\n}\n[box] [row],\n[dialogbox] [row],\n.cbeb-modal [row] {\n flex-direction: row;\n}\n[box] [grow],\n[dialogbox] [grow],\n.cbeb-modal [grow] {\n flex-grow: 1;\n}\n[box] [mt0],\n[dialogbox] [mt0],\n.cbeb-modal [mt0] {\n margin-top: 0px;\n}\n[box] [mb0],\n[dialogbox] [mb0],\n.cbeb-modal [mb0] {\n margin-bottom: 0px;\n}\n[box] [mt10],\n[dialogbox] [mt10],\n.cbeb-modal [mt10] {\n margin-top: 10px;\n}\n[box] [mt17],\n[dialogbox] [mt17],\n.cbeb-modal [mt17] {\n margin-top: 17px;\n}\n[box] [mt31],\n[dialogbox] [mt31],\n.cbeb-modal [mt31] {\n margin-top: 31px;\n}\n[box] [mt37],\n[dialogbox] [mt37],\n.cbeb-modal [mt37] {\n margin-top: 37px;\n}\n[box] [mt53],\n[dialogbox] [mt53],\n.cbeb-modal [mt53] {\n margin-top: 53px;\n}\n[box] [mb10],\n[dialogbox] [mb10],\n.cbeb-modal [mb10] {\n margin-bottom: 10px;\n}\n[box] [mb17],\n[dialogbox] [mb17],\n.cbeb-modal [mb17] {\n margin-bottom: 17px;\n}\n[box] [mb53],\n[dialogbox] [mb53],\n.cbeb-modal [mb53] {\n margin-bottom: 53px;\n}\n[box] [ml17],\n[dialogbox] [ml17],\n.cbeb-modal [ml17] {\n margin-left: 17px;\n}\n[box] [mr17],\n[dialogbox] [mr17],\n.cbeb-modal [mr17] {\n margin-right: 17px;\n}\n[box] [w80],\n[dialogbox] [w80],\n.cbeb-modal [w80] {\n width: 80%;\n}\n[box] [w100],\n[dialogbox] [w100],\n.cbeb-modal [w100] {\n width: 100%;\n}\n[box] [pl71],\n[dialogbox] [pl71],\n.cbeb-modal [pl71] {\n padding-left: 71px;\n}\n[box] [pr71],\n[dialogbox] [pr71],\n.cbeb-modal [pr71] {\n padding-right: 71px;\n}\n[box] [pb43],\n[dialogbox] [pb43],\n.cbeb-modal [pb43] {\n padding-bottom: 43px;\n}\n[box] [cntr],\n[dialogbox] [cntr],\n.cbeb-modal [cntr] {\n justify-content: center;\n}\n[box] [vcntr],\n[dialogbox] [vcntr],\n.cbeb-modal [vcntr] {\n align-items: center;\n}\n[box] [left-text],\n[dialogbox] [left-text],\n.cbeb-modal [left-text] {\n text-align: left;\n}\n[box] [cntr-text],\n[dialogbox] [cntr-text],\n.cbeb-modal [cntr-text] {\n text-align: center;\n}\n[box] [space-evenly],\n[dialogbox] [space-evenly],\n.cbeb-modal [space-evenly] {\n justify-content: space-evenly;\n}\n[box] [space-between],\n[dialogbox] [space-between],\n.cbeb-modal [space-between] {\n justify-content: space-between;\n}\n[box] [justify-end],\n[dialogbox] [justify-end],\n.cbeb-modal [justify-end] {\n justify-content: flex-end;\n}\n[box] [justify-center],\n[dialogbox] [justify-center],\n.cbeb-modal [justify-center] {\n justify-content: center;\n}\n[box] [wrap],\n[dialogbox] [wrap],\n.cbeb-modal [wrap] {\n flex-wrap: wrap;\n}\n[box] [block],\n[dialogbox] [block],\n.cbeb-modal [block] {\n display: block;\n}\n[box] [no-shrink],\n[dialogbox] [no-shrink],\n.cbeb-modal [no-shrink] {\n flex-shrink: 0;\n}\n[box] [d-none],\n[dialogbox] [d-none],\n.cbeb-modal [d-none] {\n display: none;\n}\n[box] h4[fileedit],\n[dialogbox] h4[fileedit],\n.cbeb-modal h4[fileedit] {\n margin-top: 0;\n margin-bottom: 0;\n}\n[box] h5[fileedit],\n[dialogbox] h5[fileedit],\n.cbeb-modal h5[fileedit] {\n margin-top: 0px;\n margin-bottom: 0px;\n}\n[box] h4[dlg],\n[dialogbox] h4[dlg],\n.cbeb-modal h4[dlg] {\n font-size: 14px;\n font-weight: 400;\n margin-bottom: 3px;\n}\n[box] input[dlg],\n[dialogbox] input[dlg],\n.cbeb-modal input[dlg] {\n border-top: none;\n border-left: none;\n border-right: none;\n}\n[box] button[new],\n[dialogbox] button[new],\n.cbeb-modal button[new] {\n outline: 0;\n border: none;\n border-radius: 5px;\n padding-top: 8px;\n padding-bottom: 7px;\n padding-left: 31px;\n padding-right: 31px;\n font-size: 14px;\n font-weight: 600;\n font-family: inherit;\n letter-spacing: -1px;\n cursor: pointer;\n}\n[box] a[fake],\n[dialogbox] a[fake],\n.cbeb-modal a[fake] {\n outline: none;\n border: none;\n background-color: transparent;\n}\n[box] [cbeb-fake-button],\n[dialogbox] [cbeb-fake-button],\n.cbeb-modal [cbeb-fake-button] {\n color: grey;\n outline: none;\n border: none;\n background: transparent;\n cursor: pointer;\n}\n[box] .mapboxgl-ctrl-geocoder,\n[dialogbox] .mapboxgl-ctrl-geocoder,\n.cbeb-modal .mapboxgl-ctrl-geocoder {\n font-size: inherit !important;\n min-width: initial !important;\n box-shadow: none !important;\n}\n@media screen and (max-width: 510px) {\n [box] .mapboxgl-ctrl-geocoder,\n [dialogbox] .mapboxgl-ctrl-geocoder,\n .cbeb-modal .mapboxgl-ctrl-geocoder {\n width: 100% !important;\n line-height: inherit !important;\n height: inherit;\n }\n}\n@media screen and (min-width: 511px) {\n [box] .mapboxgl-ctrl-geocoder,\n [dialogbox] .mapboxgl-ctrl-geocoder,\n .cbeb-modal .mapboxgl-ctrl-geocoder {\n width: 95% !important;\n }\n}\n[box] .mapboxgl-ctrl-geocoder--icon-search,\n[dialogbox] .mapboxgl-ctrl-geocoder--icon-search,\n.cbeb-modal .mapboxgl-ctrl-geocoder--icon-search {\n display: none !important;\n}\n@media screen and (max-width: 510px) {\n [box] .mapboxgl-ctrl-geocoder--input,\n [dialogbox] .mapboxgl-ctrl-geocoder--input,\n .cbeb-modal .mapboxgl-ctrl-geocoder--input {\n height: inherit !important;\n padding-left: 17px !important;\n padding-top: unset !important;\n padding-right: unset !important;\n padding-bottom: unset !important;\n }\n}\n@media screen and (min-width: 511px) {\n [box] .mapboxgl-ctrl-geocoder--input,\n [dialogbox] .mapboxgl-ctrl-geocoder--input,\n .cbeb-modal .mapboxgl-ctrl-geocoder--input {\n padding-left: 17px !important;\n padding-top: unset !important;\n padding-right: unset !important;\n padding-bottom: unset !important;\n }\n}\n[box] [missing_required_field],\n[dialogbox] [missing_required_field],\n.cbeb-modal [missing_required_field] {\n background-color: #ffaaaa;\n}\n[box] [missing_required_field] input,\n[dialogbox] [missing_required_field] input,\n.cbeb-modal [missing_required_field] input {\n background-color: #ffaaaa;\n}\n[box] [missing_required_field] textarea,\n[dialogbox] [missing_required_field] textarea,\n.cbeb-modal [missing_required_field] textarea {\n background-color: #ffaaaa;\n}\n[box] [missing_required_field] .choices__inner,\n[dialogbox] [missing_required_field] .choices__inner,\n.cbeb-modal [missing_required_field] .choices__inner {\n background-color: #ffaaaa;\n}\n[box] [nobreak],\n[dialogbox] [nobreak],\n.cbeb-modal [nobreak] {\n white-space: nowrap;\n}\n[box] [funky-hover],\n[dialogbox] [funky-hover],\n.cbeb-modal [funky-hover] {\n transition: transform 0.2s;\n}\n[box] [funky-hover]:hover,\n[dialogbox] [funky-hover]:hover,\n.cbeb-modal [funky-hover]:hover {\n transform: scale(1.2) rotate(2deg);\n}\n[box] [red],\n[dialogbox] [red],\n.cbeb-modal [red] {\n color: #d40f0f;\n}\n[box] [inline],\n[dialogbox] [inline],\n.cbeb-modal [inline] {\n display: inline;\n}\n[box] [maperrorcontainer],\n[dialogbox] [maperrorcontainer],\n.cbeb-modal [maperrorcontainer] {\n display: flex;\n flex-direction: column;\n row-gap: 17px;\n width: 100%;\n align-items: center;\n}\n[box] [category-workbench-container],\n[dialogbox] [category-workbench-container],\n.cbeb-modal [category-workbench-container] {\n display: flex;\n flex-direction: column;\n row-gap: 5px;\n}\n[box] [tag-workbench],\n[dialogbox] [tag-workbench],\n.cbeb-modal [tag-workbench] {\n display: flex;\n flex-direction: row;\n align-items: center;\n column-gap: 17px;\n box-sizing: border-box;\n padding: 7px 15px 7px 15px;\n background-color: lightblue;\n}\n[box] [tag-workbench-select-ctrl],\n[dialogbox] [tag-workbench-select-ctrl],\n.cbeb-modal [tag-workbench-select-ctrl] {\n flex-grow: 1;\n}\n[box] [tag-workbench-frame],\n[dialogbox] [tag-workbench-frame],\n.cbeb-modal [tag-workbench-frame] {\n display: flex;\n flex-direction: row;\n column-gap: 17px;\n row-gap: 7px;\n box-shadow: inset 2px 2px 2px 0px rgba(0, 0, 0, 0.07);\n box-sizing: border-box;\n padding: 7px;\n border: 1px solid lightgrey;\n flex-wrap: wrap;\n max-height: 90px;\n overflow-y: scroll;\n}\n[box] [tag-workbench-label],\n[dialogbox] [tag-workbench-label],\n.cbeb-modal [tag-workbench-label] {\n margin-top: 0px;\n margin-bottom: 0px;\n font-size: 15px;\n}\n[box] [tag-workbench-error-msg],\n[dialogbox] [tag-workbench-error-msg],\n.cbeb-modal [tag-workbench-error-msg] {\n color: red;\n font-size: 14px;\n}\n[box] [connect-dlg-question-container],\n[dialogbox] [connect-dlg-question-container],\n.cbeb-modal [connect-dlg-question-container] {\n display: flex;\n flex-direction: column;\n row-gap: 21px;\n box-sizing: border-box;\n padding: 21px;\n}\n[box] [connect-dlg-connect-btn-row],\n[dialogbox] [connect-dlg-connect-btn-row],\n.cbeb-modal [connect-dlg-connect-btn-row] {\n display: flex;\n justify-content: center;\n width: 100%;\n}\n[box] [cbeb-view-connection-modal-field-container],\n[dialogbox] [cbeb-view-connection-modal-field-container],\n.cbeb-modal [cbeb-view-connection-modal-field-container] {\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n padding: 0px 21px 37px 21px;\n}\n[box] [connect-dlg-question-row] input,\n[dialogbox] [connect-dlg-question-row] input,\n.cbeb-modal [connect-dlg-question-row] input,\n[box] [connect-dlg-question-row] textarea,\n[dialogbox] [connect-dlg-question-row] textarea,\n.cbeb-modal [connect-dlg-question-row] textarea {\n width: 100%;\n padding: 11px;\n box-sizing: border-box;\n}\n[box] [desktop][toolbar] button[cb-open-search-dlg],\n[dialogbox] [desktop][toolbar] button[cb-open-search-dlg],\n.cbeb-modal [desktop][toolbar] button[cb-open-search-dlg],\n[box] [desktop][toolbar] button[clear-search-filter],\n[dialogbox] [desktop][toolbar] button[clear-search-filter],\n.cbeb-modal [desktop][toolbar] button[clear-search-filter] {\n color: var(--cb-button-fg-col);\n background-color: var(--cb-button-bg-col);\n font-family: var(--cb-button-font-family);\n min-width: 44px;\n width: auto;\n column-gap: 7px;\n padding-inline: 12px;\n box-sizing: border-box;\n}\n[box] [desktop][toolbar][search-active] button[clear-search-filter],\n[dialogbox] [desktop][toolbar][search-active] button[clear-search-filter],\n.cbeb-modal [desktop][toolbar][search-active] button[clear-search-filter] {\n display: flex;\n}\n[box] [desktop][toolbar]:not([search-active]) button[clear-search-filter],\n[dialogbox] [desktop][toolbar]:not([search-active]) button[clear-search-filter],\n.cbeb-modal [desktop][toolbar]:not([search-active]) button[clear-search-filter] {\n display: none;\n}\n[box] [mobile][toolbar] button,\n[dialogbox] [mobile][toolbar] button,\n.cbeb-modal [mobile][toolbar] button {\n align-items: center;\n}\n[box] [mobile][toolbar] button[cb-open-search-dlg],\n[dialogbox] [mobile][toolbar] button[cb-open-search-dlg],\n.cbeb-modal [mobile][toolbar] button[cb-open-search-dlg],\n[box] [mobile][toolbar] button[clear-search-filter],\n[dialogbox] [mobile][toolbar] button[clear-search-filter],\n.cbeb-modal [mobile][toolbar] button[clear-search-filter] {\n color: var(--cb-button-fg-col);\n background-color: var(--cb-button-bg-col);\n font-family: var(--cb-button-font-family);\n min-width: 44px;\n width: auto;\n column-gap: 7px;\n padding-inline: 12px;\n box-sizing: border-box;\n}\n[box] [mobile][toolbar] button[clear-search-filter]:after,\n[dialogbox] [mobile][toolbar] button[clear-search-filter]:after,\n.cbeb-modal [mobile][toolbar] button[clear-search-filter]:after {\n content: var(--cb-clear-search-filter-btn-label);\n}\n[box] [mobile][toolbar] button[cb-open-search-dlg]:after,\n[dialogbox] [mobile][toolbar] button[cb-open-search-dlg]:after,\n.cbeb-modal [mobile][toolbar] button[cb-open-search-dlg]:after {\n content: var(--cb-open-search-dlg-btn-label);\n}\n[box] [mobile][toolbar][search-active] button[clear-search-filter],\n[dialogbox] [mobile][toolbar][search-active] button[clear-search-filter],\n.cbeb-modal [mobile][toolbar][search-active] button[clear-search-filter] {\n display: flex;\n}\n[box] [mobile][toolbar]:not([search-active]) button[clear-search-filter],\n[dialogbox] [mobile][toolbar]:not([search-active]) button[clear-search-filter],\n.cbeb-modal [mobile][toolbar]:not([search-active]) button[clear-search-filter] {\n display: none;\n}\n[box] [socmed-list],\n[dialogbox] [socmed-list],\n.cbeb-modal [socmed-list] {\n display: flex;\n flex-direction: row;\n justify-content: center;\n column-gap: 1lh;\n}\n[box] .cbeb-socmed-summary a,\n[dialogbox] .cbeb-socmed-summary a,\n.cbeb-modal .cbeb-socmed-summary a {\n width: 1.2em;\n}\n[box] [socmed-list],\n[dialogbox] [socmed-list],\n.cbeb-modal [socmed-list] {\n margin-top: 1lh;\n}\n[box] [socmed-list] a,\n[dialogbox] [socmed-list] a,\n.cbeb-modal [socmed-list] a {\n width: 1.7em;\n}\n[box] .cbeb-socmed-summary a,\n[dialogbox] .cbeb-socmed-summary a,\n.cbeb-modal .cbeb-socmed-summary a,\n[box] [socmed-list] a,\n[dialogbox] [socmed-list] a,\n.cbeb-modal [socmed-list] a {\n aspect-ratio: 1;\n grid-area: glyph;\n mask-repeat: no-repeat;\n mask-position: center;\n border: none;\n cursor: pointer;\n justify-self: center;\n align-self: center;\n}\n[box] .cbeb-socmed-summary a[socmed-type="file-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="file-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="file-input"],\n[box] [socmed-list] a[socmed-type="file-input"],\n[dialogbox] [socmed-list] a[socmed-type="file-input"],\n.cbeb-modal [socmed-list] a[socmed-type="file-input"] {\n mask-image: var(--file);\n}\n[box] .cbeb-socmed-summary a[socmed-type="threads"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="threads"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="threads"],\n[box] [socmed-list] a[socmed-type="threads"],\n[dialogbox] [socmed-list] a[socmed-type="threads"],\n.cbeb-modal [socmed-list] a[socmed-type="threads"] {\n mask-image: var(--threads);\n}\n[box] .cbeb-socmed-summary a[socmed-type="slack-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="slack-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="slack-input"],\n[box] [socmed-list] a[socmed-type="slack-input"],\n[dialogbox] [socmed-list] a[socmed-type="slack-input"],\n.cbeb-modal [socmed-list] a[socmed-type="slack-input"] {\n mask-image: var(--slack);\n}\n[box] .cbeb-socmed-summary a[socmed-type="video-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="video-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="video-input"],\n[box] [socmed-list] a[socmed-type="video-input"],\n[dialogbox] [socmed-list] a[socmed-type="video-input"],\n.cbeb-modal [socmed-list] a[socmed-type="video-input"] {\n mask-image: var(--video);\n}\n[box] .cbeb-socmed-summary a[socmed-type="etsy-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="etsy-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="etsy-input"],\n[box] [socmed-list] a[socmed-type="etsy-input"],\n[dialogbox] [socmed-list] a[socmed-type="etsy-input"],\n.cbeb-modal [socmed-list] a[socmed-type="etsy-input"] {\n mask-image: var(--etsy);\n}\n[box] .cbeb-socmed-summary a[socmed-type="ebay-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="ebay-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="ebay-input"],\n[box] [socmed-list] a[socmed-type="ebay-input"],\n[dialogbox] [socmed-list] a[socmed-type="ebay-input"],\n.cbeb-modal [socmed-list] a[socmed-type="ebay-input"] {\n mask-image: var(--ebay);\n}\n[box] .cbeb-socmed-summary a[socmed-type="amazon-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="amazon-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="amazon-input"],\n[box] [socmed-list] a[socmed-type="amazon-input"],\n[dialogbox] [socmed-list] a[socmed-type="amazon-input"],\n.cbeb-modal [socmed-list] a[socmed-type="amazon-input"] {\n mask-image: var(--amazon);\n}\n[box] .cbeb-socmed-summary a[socmed-type="tumblr-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="tumblr-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="tumblr-input"],\n[box] [socmed-list] a[socmed-type="tumblr-input"],\n[dialogbox] [socmed-list] a[socmed-type="tumblr-input"],\n.cbeb-modal [socmed-list] a[socmed-type="tumblr-input"] {\n mask-image: var(--tumblr);\n}\n[box] .cbeb-socmed-summary a[socmed-type="flickr-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="flickr-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="flickr-input"],\n[box] [socmed-list] a[socmed-type="flickr-input"],\n[dialogbox] [socmed-list] a[socmed-type="flickr-input"],\n.cbeb-modal [socmed-list] a[socmed-type="flickr-input"] {\n mask-image: var(--flickr);\n}\n[box] .cbeb-socmed-summary a[socmed-type="vimeo-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="vimeo-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="vimeo-input"],\n[box] [socmed-list] a[socmed-type="vimeo-input"],\n[dialogbox] [socmed-list] a[socmed-type="vimeo-input"],\n.cbeb-modal [socmed-list] a[socmed-type="vimeo-input"] {\n mask-image: var(--vimeo);\n}\n[box] .cbeb-socmed-summary a[socmed-type="spotify-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="spotify-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="spotify-input"],\n[box] [socmed-list] a[socmed-type="spotify-input"],\n[dialogbox] [socmed-list] a[socmed-type="spotify-input"],\n.cbeb-modal [socmed-list] a[socmed-type="spotify-input"] {\n mask-image: var(--spotify);\n}\n[box] .cbeb-socmed-summary a[socmed-type="soundcloud-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="soundcloud-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="soundcloud-input"],\n[box] [socmed-list] a[socmed-type="soundcloud-input"],\n[dialogbox] [socmed-list] a[socmed-type="soundcloud-input"],\n.cbeb-modal [socmed-list] a[socmed-type="soundcloud-input"] {\n mask-image: var(--soundcloud);\n}\n[box] .cbeb-socmed-summary a[socmed-type="youtube-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="youtube-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="youtube-input"],\n[box] [socmed-list] a[socmed-type="youtube-input"],\n[dialogbox] [socmed-list] a[socmed-type="youtube-input"],\n.cbeb-modal [socmed-list] a[socmed-type="youtube-input"] {\n mask-image: var(--youtube);\n}\n[box] .cbeb-socmed-summary a[socmed-type="image-gallery"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="image-gallery"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="image-gallery"],\n[box] [socmed-list] a[socmed-type="image-gallery"],\n[dialogbox] [socmed-list] a[socmed-type="image-gallery"],\n.cbeb-modal [socmed-list] a[socmed-type="image-gallery"] {\n mask-image: var(--gallery);\n}\n[box] .cbeb-socmed-summary a[socmed-type="pinterest-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="pinterest-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="pinterest-input"],\n[box] [socmed-list] a[socmed-type="pinterest-input"],\n[dialogbox] [socmed-list] a[socmed-type="pinterest-input"],\n.cbeb-modal [socmed-list] a[socmed-type="pinterest-input"] {\n mask-image: var(--pinterest);\n}\n[box] .cbeb-socmed-summary a[socmed-type="linkedin-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="linkedin-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="linkedin-input"],\n[box] [socmed-list] a[socmed-type="linkedin-input"],\n[dialogbox] [socmed-list] a[socmed-type="linkedin-input"],\n.cbeb-modal [socmed-list] a[socmed-type="linkedin-input"] {\n mask-image: var(--linkedin);\n}\n[box] .cbeb-socmed-summary a[socmed-type="instagram-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="instagram-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="instagram-input"],\n[box] [socmed-list] a[socmed-type="instagram-input"],\n[dialogbox] [socmed-list] a[socmed-type="instagram-input"],\n.cbeb-modal [socmed-list] a[socmed-type="instagram-input"] {\n mask-image: var(--instagram);\n}\n[box] .cbeb-socmed-summary a[socmed-type="facebook-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="facebook-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="facebook-input"],\n[box] [socmed-list] a[socmed-type="facebook-input"],\n[dialogbox] [socmed-list] a[socmed-type="facebook-input"],\n.cbeb-modal [socmed-list] a[socmed-type="facebook-input"] {\n mask-image: var(--facebook);\n}\n[box] .cbeb-socmed-summary a[socmed-type="twitter-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="twitter-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="twitter-input"],\n[box] [socmed-list] a[socmed-type="twitter-input"],\n[dialogbox] [socmed-list] a[socmed-type="twitter-input"],\n.cbeb-modal [socmed-list] a[socmed-type="twitter-input"] {\n mask-image: var(--twitter);\n}\n[box] .cbeb-socmed-summary a[socmed-type="website-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="website-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="website-input"],\n[box] [socmed-list] a[socmed-type="website-input"],\n[dialogbox] [socmed-list] a[socmed-type="website-input"],\n.cbeb-modal [socmed-list] a[socmed-type="website-input"] {\n mask-image: var(--hyperlink);\n}\n[box] .cbeb-socmed-summary a[socmed-type="date-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="date-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="date-input"],\n[box] [socmed-list] a[socmed-type="date-input"],\n[dialogbox] [socmed-list] a[socmed-type="date-input"],\n.cbeb-modal [socmed-list] a[socmed-type="date-input"] {\n mask-image: var(--calendar);\n}\n[box] .cbeb-socmed-summary a[socmed-type="phone-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="phone-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="phone-input"],\n[box] [socmed-list] a[socmed-type="phone-input"],\n[dialogbox] [socmed-list] a[socmed-type="phone-input"],\n.cbeb-modal [socmed-list] a[socmed-type="phone-input"] {\n mask-image: var(--email);\n}\n[box] .cbeb-socmed-summary a[socmed-type="email-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="email-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="email-input"],\n[box] [socmed-list] a[socmed-type="email-input"],\n[dialogbox] [socmed-list] a[socmed-type="email-input"],\n.cbeb-modal [socmed-list] a[socmed-type="email-input"] {\n mask-image: var(--email);\n}\n[box] .cbeb-socmed-summary a[socmed-type="category-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="category-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="category-input"],\n[box] [socmed-list] a[socmed-type="category-input"],\n[dialogbox] [socmed-list] a[socmed-type="category-input"],\n.cbeb-modal [socmed-list] a[socmed-type="category-input"],\n[box] .cbeb-socmed-summary a[socmed-type="tag-hierarchy"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="tag-hierarchy"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="tag-hierarchy"],\n[box] [socmed-list] a[socmed-type="tag-hierarchy"],\n[dialogbox] [socmed-list] a[socmed-type="tag-hierarchy"],\n.cbeb-modal [socmed-list] a[socmed-type="tag-hierarchy"] {\n mask-image: var(--tag);\n}\n[box] .cbeb-socmed-summary a[socmed-type="image-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="image-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="image-input"],\n[box] [socmed-list] a[socmed-type="image-input"],\n[dialogbox] [socmed-list] a[socmed-type="image-input"],\n.cbeb-modal [socmed-list] a[socmed-type="image-input"] {\n mask-image: var(--picture);\n}\n[box] .cbeb-socmed-summary a[socmed-type="single-line-text-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="single-line-text-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="single-line-text-input"],\n[box] [socmed-list] a[socmed-type="single-line-text-input"],\n[dialogbox] [socmed-list] a[socmed-type="single-line-text-input"],\n.cbeb-modal [socmed-list] a[socmed-type="single-line-text-input"],\n[box] .cbeb-socmed-summary a[socmed-type="multi-line-text-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="multi-line-text-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="multi-line-text-input"],\n[box] [socmed-list] a[socmed-type="multi-line-text-input"],\n[dialogbox] [socmed-list] a[socmed-type="multi-line-text-input"],\n.cbeb-modal [socmed-list] a[socmed-type="multi-line-text-input"] {\n mask-image: var(--text);\n}\n[box] .cbeb-socmed-summary a[socmed-type="location-input"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="location-input"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="location-input"],\n[box] [socmed-list] a[socmed-type="location-input"],\n[dialogbox] [socmed-list] a[socmed-type="location-input"],\n.cbeb-modal [socmed-list] a[socmed-type="location-input"] {\n mask-image: var(--location);\n}\n[box] .cbeb-socmed-summary a[socmed-type="bluesky"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="bluesky"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="bluesky"],\n[box] [socmed-list] a[socmed-type="bluesky"],\n[dialogbox] [socmed-list] a[socmed-type="bluesky"],\n.cbeb-modal [socmed-list] a[socmed-type="bluesky"] {\n mask-image: var(--bluesky);\n}\n[box] .cbeb-socmed-summary a[socmed-type="tiktok"],\n[dialogbox] .cbeb-socmed-summary a[socmed-type="tiktok"],\n.cbeb-modal .cbeb-socmed-summary a[socmed-type="tiktok"],\n[box] [socmed-list] a[socmed-type="tiktok"],\n[dialogbox] [socmed-list] a[socmed-type="tiktok"],\n.cbeb-modal [socmed-list] a[socmed-type="tiktok"] {\n mask-image: var(--tiktok);\n}\n[box] [image-frame],\n[dialogbox] [image-frame],\n.cbeb-modal [image-frame] {\n width: 100%;\n height: 255px;\n margin-top: 10px;\n display: flex;\n justify-content: center;\n position: relative;\n overflow-y: clip;\n}\n.cbeb-modal,\n[dialogbox] {\n position: fixed;\n z-index: 1100;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n overflow: auto;\n background-color: rgba(0, 0, 0, 0.4);\n}\n.cbeb-modal:not([block]),\n[dialogbox]:not([block]) {\n display: none;\n}\n.cbeb-modal[block],\n[dialogbox][block] {\n display: block;\n}\n@media screen and (min-width: 511px) {\n .cbeb-modal,\n [dialogbox] {\n padding-top: 50px;\n backdrop-filter: blur(7px);\n -webkit-backdrop-filter: blur(7px);\n }\n}\n.cbeb-modal-content {\n line-height: normal;\n display: flex;\n flex-direction: column;\n margin: auto;\n border: none;\n background-color: #fcfcfc;\n color: #55606b;\n}\n@media screen and (min-width: 511px) {\n .cbeb-modal-content {\n width: 500px;\n overflow-y: auto;\n overflow-x: hidden;\n max-height: 80%;\n }\n}\n@media screen and (max-width: 510px) {\n .cbeb-modal-content {\n width: 100%;\n height: 100%;\n overflow-y: scroll;\n min-height: 400px;\n }\n}\n.cbeb-modal-title {\n display: flex;\n font-weight: bold;\n align-items: center;\n padding-top: 25px;\n padding-bottom: 25px;\n padding-left: 20px;\n padding-right: 20px;\n border: none;\n}\n.cbeb-modal-title-text {\n flex-grow: 1;\n color: white;\n text-align: left;\n}\n[filter-and-search] [chapters] {\n display: flex;\n flex-direction: column;\n margin-top: 5px;\n margin-bottom: 20px;\n}\n[filter-and-search] [chapters] [fields] {\n display: flex;\n flex-direction: row;\n margin-top: 20px;\n}\n[filter-and-search] [chapters] [fields] [left] {\n display: flex;\n flex-direction: row;\n width: 131px;\n justify-content: flex-end;\n}\n[filter-and-search] [chapters] [fields] [right] {\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n padding-left: 5%;\n}\n[filter-and-search] [chapters] [fields] [right] [inputrow] {\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n}\n[filter-and-search] [chapters] [fields] [right] [inputrow] [label] {\n font-size: 13px;\n text-align: left;\n}\n[filter-and-search] [chapters] [fields] [right] [inputrow] select {\n width: 75%;\n}\n[filter-and-search] [chapters] [fields] [right] [inputrow] [tag-list] {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n margin-top: 10px;\n}\n[filter-and-search] [chapters] [fields] [right] [inputrow] [tag-list] [tag] {\n display: flex;\n background-color: #777777;\n color: white;\n padding-left: 10px;\n padding-top: 4px;\n padding-right: 10px;\n padding-bottom: 3px;\n font-size: 14px;\n font-weight: 600;\n margin-right: 10px;\n margin-top: 7px;\n}\n[filter-and-search] [chapters] [fields] [right] [inputrow] [tag-list] [tag] button {\n background: transparent;\n border: none;\n outline: none;\n color: inherit;\n cursor: pointer;\n}\n[tag-filter][dialogbox] [search-row-container] {\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n padding-left: 21%;\n align-items: center;\n margin-top: 40px;\n}\n[tag-filter][dialogbox] [search-row-container] input {\n border-top: none;\n border-left: none;\n border-right: none;\n border-bottom: 1px solid black;\n}\n[tag-filter][dialogbox] [tag-listing-container] {\n margin-top: 40px;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n padding-left: 21%;\n padding-right: 7%;\n padding-bottom: 50px;\n}\n[tag-filter][dialogbox] [tag-listing-container] button[entry] {\n outline: none;\n border: none;\n background-color: transparent;\n text-align: left;\n padding-left: 0px;\n font-size: 16px;\n color: #515151;\n cursor: pointer;\n}\n[tag-filter][dialogbox] [tag-listing-container] button[entry]:hover {\n color: grey;\n}\n@media screen and (min-width: 511px) {\n [tag-filter][dialogbox] [tag-listing-container] button[entry] {\n flex-basis: 50%;\n margin-top: 10px;\n }\n}\n@media screen and (max-width: 510px) {\n [tag-filter][dialogbox] [tag-listing-container] button[entry] {\n flex-basis: 100%;\n }\n}\n`,""]);const W=S},6314:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var i="",n=void 0!==t[5];return t[4]&&(i+="@supports (".concat(t[4],") {")),t[2]&&(i+="@media ".concat(t[2]," {")),n&&(i+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),i+=e(t),n&&(i+="}"),t[2]&&(i+="}"),t[4]&&(i+="}"),i})).join("")},t.i=function(e,i,n,o,r){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(n)for(var a=0;a0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=r),i&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=i):u[2]=i),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},4417:e=>{"use strict";e.exports=function(e,t){return t||(t={}),e?(e=String(e.__esModule?e.default:e),/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]|(%20)/.test(e)||t.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e):e}},1601:e=>{"use strict";e.exports=function(e){return e[1]}},6964:function(e,t,i){e.exports=function(){"use strict";function e(e){return"function"==typeof e}var t=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},n=0,o=void 0,r=void 0,s=function(e,t){p[n]=e,p[n+1]=t,2===(n+=2)&&(r?r(m):b())};var a="undefined"!=typeof window?window:void 0,l=a||{},c=l.MutationObserver||l.WebKitMutationObserver,u="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),d="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function h(){var e=setTimeout;return function(){return e(m,1)}}var p=new Array(1e3);function m(){for(var e=0;e{"use strict";var t=Object.prototype.hasOwnProperty,i="~";function n(){}function o(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function r(e,t,n,r,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new o(n,r||e,s),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var e,n,o=[];if(0===this._eventsCount)return o;for(n in e=this._events)t.call(e,n)&&o.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},a.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,r=n.length,s=new Array(r);o{"use strict";var t,i="object"==typeof Reflect?Reflect:null,n=i&&"function"==typeof i.apply?i.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};t=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function r(){r.init.call(this)}e.exports=r,e.exports.once=function(e,t){return new Promise((function(i,n){function o(i){e.removeListener(t,r),n(i)}function r(){"function"==typeof e.removeListener&&e.removeListener("error",o),i([].slice.call(arguments))}f(e,t,r,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&f(e,"error",t,{once:!0})}(e,o)}))},r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?r.defaultMaxListeners:e._maxListeners}function c(e,t,i,n){var o,r,s,c;if(a(i),void 0===(r=e._events)?(r=e._events=Object.create(null),e._eventsCount=0):(void 0!==r.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),r=e._events),s=r[t]),void 0===s)s=r[t]=i,++e._eventsCount;else if("function"==typeof s?s=r[t]=n?[i,s]:[s,i]:n?s.unshift(i):s.push(i),(o=l(e))>0&&s.length>o&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,c=u,console&&console.warn&&console.warn(c)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,i){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},o=u.bind(n);return o.listener=i,n.wrapFn=o,o}function h(e,t,i){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?i?[o.listener||o]:[o]:i?function(e){for(var t=new Array(e.length),i=0;i0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=r[e];if(void 0===l)return!1;if("function"==typeof l)n(l,this,t);else{var c=l.length,u=m(l,c);for(i=0;i=0;r--)if(i[r]===t||i[r].listener===t){s=i[r].listener,o=r;break}if(o<0)return this;0===o?i.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},r.prototype.listeners=function(e){return h(this,e,!0)},r.prototype.rawListeners=function(e){return h(this,e,!1)},r.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},r.prototype.listenerCount=p,r.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},4751:e=>{var t;t={},e.exports=t,t.simpleFilter=function(e,i){return i.filter((function(i){return t.test(e,i)}))},t.test=function(e,i){return null!==t.match(e,i)},t.match=function(e,t,i){i=i||{};var n,o=0,r=[],s=t.length,a=0,l=0,c=i.pre||"",u=i.post||"",d=i.caseSensitive&&t||t.toLowerCase();e=i.caseSensitive&&e||e.toLowerCase();for(var h=0;h{"use strict";var t=Object.prototype.toString;e.exports=function(e){var i;return"[object Object]"===t.call(e)&&(null===(i=Object.getPrototypeOf(e))||i===Object.getPrototypeOf({}))}},181:(e,t,i)=>{var n=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,r=/^0b[01]+$/i,s=/^0o[0-7]+$/i,a=parseInt,l="object"==typeof i.g&&i.g&&i.g.Object===Object&&i.g,c="object"==typeof self&&self&&self.Object===Object&&self,u=l||c||Function("return this")(),d=Object.prototype.toString,h=Math.max,p=Math.min,m=function(){return u.Date.now()};function f(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==d.call(e)}(e))return NaN;if(f(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=f(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var i=r.test(e);return i||s.test(e)?a(e.slice(2),i?2:8):o.test(e)?NaN:+e}e.exports=function(e,t,i){var n,o,r,s,a,l,c=0,u=!1,d=!1,_=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var i=n,r=o;return n=o=void 0,c=t,s=e.apply(r,i)}function b(e){var i=e-l;return void 0===l||i>=t||i<0||d&&e-c>=r}function x(){var e=m();if(b(e))return v(e);a=setTimeout(x,function(e){var i=t-(e-l);return d?p(i,r-(e-c)):i}(e))}function v(e){return a=void 0,_&&n?y(e):(n=o=void 0,s)}function w(){var e=m(),i=b(e);if(n=arguments,o=this,l=e,i){if(void 0===a)return function(e){return c=e,a=setTimeout(x,t),u?y(e):s}(l);if(d)return a=setTimeout(x,t),y(l)}return void 0===a&&(a=setTimeout(x,t)),s}return t=g(t)||0,f(i)&&(u=!!i.leading,r=(d="maxWait"in i)?h(g(i.maxWait)||0,t):r,_="trailing"in i?!!i.trailing:_),w.cancel=function(){void 0!==a&&clearTimeout(a),c=0,n=l=o=a=void 0},w.flush=function(){return void 0===a?s:v(m())},w}},842:function(e){e.exports=function(){"use strict";var e,t,i;function n(n,o){if(e)if(t){var r="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+e+")(sharedChunk); ("+t+")(sharedChunk); self.onerror = null;",s={};e(s),i=o(s),"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(i.workerUrl=window.URL.createObjectURL(new Blob([r],{type:"text/javascript"})))}else t=o;else e=o}return n(0,(function(e){var t="undefined"!=typeof self?self:{},i="2.15.0";let n;const o={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==n){const e=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{n=null!=process.env.API_URL_REGEX?new RegExp(process.env.API_URL_REGEX):e}catch(t){n=e}}return n},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!o.API_URL)return null;try{const e=new URL(o.API_URL);return"api.mapbox.cn"===e.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===e.hostname?"https://events.mapbox.com/events/v2":null}catch(e){return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},r={supported:!1,testSupport:function(e){!l&&a&&(c?u(e):s=e)}};let s,a,l=!1,c=!1;function u(e){const t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,a),e.isContextLost())return;r.supported=!0}catch(e){}e.deleteTexture(t),l=!0}t.document&&(a=t.document.createElement("img"),a.onload=function(){s&&u(s),s=null,c=!0},a.onerror=function(){l=!0,s=null},a.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const d="01";function h(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var p=m;function m(e,t,i,n){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=n}m.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,n=0;n<8;n++){var o=this.sampleCurveX(i)-e;if(Math.abs(o)o?s=i:a=i,i=.5*(a-s)+s;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}};var f=h(p),g=_;function _(e,t){this.x=e,this.y=t}_.prototype={clone:function(){return new _(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),i=Math.sin(e),n=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=n,this},_rotateAround:function(e,t){var i=Math.cos(e),n=Math.sin(e),o=t.y+n*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-n*(this.y-t.y),this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},_.convert=function(e){return e instanceof _?e:Array.isArray(e)?new _(e[0],e[1]):e};var y=h(g);const b=Math.PI/180,x=180/Math.PI;function v(e){return e*b}function w(e){return e*x}const E=[[0,0],[1,0],[1,1],[0,1]];function M(e){if(e<=0)return 0;if(e>=1)return 1;const t=e*e,i=t*e;return 4*(e<.5?i:3*(e-t)+i-.75)}function T(e,t,i,n){const o=new f(e,t,i,n);return function(e){return o.solve(e)}}const C=T(.25,.1,.25,1);function k(e,t,i){return Math.min(i,Math.max(t,e))}function S(e,t,i){return(i=k((i-e)/(t-e),0,1))*i*(3-2*i)}function L(e,t,i){const n=i-t,o=((e-t)%n+n)%n+t;return o===t?i:o}function A(e,t,i){if(!e.length)return i(null,[]);let n=e.length;const o=new Array(e.length);let r=null;e.forEach(((e,s)=>{t(e,((e,t)=>{e&&(r=e),o[s]=t,0==--n&&i(r,o)}))}))}function I(e){const t=[];for(const i in e)t.push(e[i]);return t}function D(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}let z=1;function P(){return z++}function O(){return function e(t){return t?(t^Math.random()*(16>>t/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()}function B(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function j(e){return!!e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function R(e,t){e.forEach((e=>{t[e]&&(t[e]=t[e].bind(t))}))}function F(e,t){return-1!==e.indexOf(t,e.length-t.length)}function N(e,t,i){const n={};for(const o in e)n[o]=t.call(i||this,e[o],o,e);return n}function U(e,t,i){const n={};for(const o in e)t.call(i||this,e[o],o,e)&&(n[o]=e[o]);return n}function V(e){return Array.isArray(e)?e.map(V):"object"==typeof e&&e?N(e,V):e}const $={};function q(e){$[e]||("undefined"!=typeof console&&console.warn(e),$[e]=!0)}function G(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function Z(e){let t=0;for(let i,n,o=0,r=e.length,s=r-1;o@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,i,n,o)=>{const r=n||o;return t[i]=!r||r.toLowerCase(),""})),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}let X=null;function Y(e){if(null==X){const t=e.navigator?e.navigator.userAgent:null;X=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return X}function K(e){try{const i=t[e];return i.setItem("_mapbox_test_",1),i.removeItem("_mapbox_test_"),!0}catch(e){return!1}}function Q(e,t){return[e[4*t],e[4*t+1],e[4*t+2],e[4*t+3]]}const J="mapbox-tiles";let ee,te,ie=500,ne=50;function oe(){try{return t.caches}catch(e){}}function re(){oe()&&!ee&&(ee=t.caches.open(J))}function se(e){const t=e.indexOf("?");if(t<0)return e;const i=function(e){const t=e.indexOf("?");return t>0?e.slice(t+1).split("&"):[]}(e),n=i.filter((e=>{const t=e.split("=");return"language"===t[0]||"worldview"===t[0]}));return n.length?`${e.slice(0,t)}?${n.join("&")}`:e.slice(0,t)}let ae=1/0;const le={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(le);class ce extends Error{constructor(e,t,i){401===t&&xe(i)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=t,this.url=i}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const ue=H()?()=>self.worker&&self.worker.referrer:()=>("blob:"===t.location.protocol?t.parent:t).location.href,de=function(e,i){if(!(/^file:/.test(n=e.url)||/^file:/.test(ue())&&!/^\w+:/.test(n))){if(t.fetch&&t.Request&&t.AbortController&&t.Request.prototype.hasOwnProperty("signal"))return function(e,i){const n=new t.AbortController,o=new t.Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:ue(),referrerPolicy:e.referrerPolicy,signal:n.signal});let r=!1,s=!1;const a=(l=o.url).indexOf("sku=")>0&&xe(l);var l;"json"===e.type&&o.headers.set("Accept","application/json");const c=(n,r,l)=>{if(s)return;if(n&&"SecurityError"!==n.message&&q(n.toString()),r&&l)return u(r);const c=Date.now();t.fetch(o).then((t=>{if(t.ok){const e=a?t.clone():null;return u(t,e,c)}return i(new ce(t.statusText,t.status,e.url))})).catch((t=>{"AbortError"!==t.name&&i(new Error(`${t.message} ${e.url}`))}))},u=(n,a,l)=>{("arrayBuffer"===e.type?n.arrayBuffer():"json"===e.type?n.json():n.text()).then((e=>{s||(a&&l&&function(e,i,n){if(re(),!ee)return;const o={status:i.status,statusText:i.statusText,headers:new t.Headers};i.headers.forEach(((e,t)=>o.headers.set(t,e)));const r=W(i.headers.get("Cache-Control")||"");if(r["no-store"])return;r["max-age"]&&o.headers.set("Expires",new Date(n+1e3*r["max-age"]).toUTCString());const s=o.headers.get("Expires");s&&(new Date(s).getTime()-n<42e4||function(e,t){if(void 0===te)try{new Response(new ReadableStream),te=!0}catch(e){te=!1}te?t(e.body):e.blob().then(t)}(i,(i=>{const n=new t.Response(i,o);re(),ee&&ee.then((t=>t.put(se(e.url),n))).catch((e=>q(e.message)))})))}(o,a,l),r=!0,i(null,e,n.headers.get("Cache-Control"),n.headers.get("Expires")))})).catch((e=>{s||i(new Error(e.message))}))};return a?function(e,t){if(re(),!ee)return t(null);const i=se(e.url);ee.then((e=>{e.match(i).then((n=>{const o=function(e){if(!e)return!1;const t=new Date(e.headers.get("Expires")||0),i=W(e.headers.get("Cache-Control")||"");return t>Date.now()&&!i["no-cache"]}(n);e.delete(i),o&&e.put(i,n.clone()),t(null,n,o)})).catch(t)})).catch(t)}(o,c):c(null,null),{cancel:()=>{s=!0,r||n.abort()}}}(e,i);if(H()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,i,void 0,!0)}var n;return function(e,i){const n=new t.XMLHttpRequest;n.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(n.responseType="arraybuffer");for(const t in e.headers)n.setRequestHeader(t,e.headers[t]);return"json"===e.type&&(n.responseType="text",n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===e.credentials,n.onerror=()=>{i(new Error(n.statusText))},n.onload=()=>{if((n.status>=200&&n.status<300||0===n.status)&&null!==n.response){let t=n.response;if("json"===e.type)try{t=JSON.parse(n.response)}catch(e){return i(e)}i(null,t,n.getResponseHeader("Cache-Control"),n.getResponseHeader("Expires"))}else i(new ce(n.statusText,n.status,e.url))},n.send(e.body),{cancel:()=>n.abort()}}(e,i)},he=function(e,t){return de(D(e,{type:"arrayBuffer"}),t)};function pe(e){const i=t.document.createElement("a");return i.href=e,i.protocol===t.document.location.protocol&&i.host===t.document.location.host}const me="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let fe,ge;fe=[],ge=0;const _e=function(e,i){if(r.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),ge>=o.MAX_PARALLEL_IMAGE_REQUESTS){const t={requestParameters:e,callback:i,cancelled:!1,cancel(){this.cancelled=!0}};return fe.push(t),t}ge++;let n=!1;const s=()=>{if(!n)for(n=!0,ge--;fe.length&&ge{s(),e?i(e):n&&(t.createImageBitmap?function(e,i){const n=new t.Blob([new Uint8Array(e)],{type:"image/png"});t.createImageBitmap(n).then((e=>{i(null,e)})).catch((e=>{i(new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))}(n,((e,t)=>i(e,t,o,r))):function(e,i){const n=new t.Image,o=t.URL;n.onload=()=>{i(null,n),o.revokeObjectURL(n.src),n.onload=null,t.requestAnimationFrame((()=>{n.src=me}))},n.onerror=()=>i(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const r=new t.Blob([new Uint8Array(e)],{type:"image/png"});n.src=e.byteLength?o.createObjectURL(r):me}(n,((e,t)=>i(e,t,o,r))))}));return{cancel:()=>{a.cancel(),s()}}},ye="NO_ACCESS_TOKEN";function be(e){return 0===e.indexOf("mapbox:")}function xe(e){return o.API_URL_REGEX.test(e)}function ve(e){return o.API_CDN_URL_REGEX.test(e)}function we(e){return o.API_STYLE_REGEX.test(e)&&!Ee(e)}function Ee(e){return o.API_SPRITE_REGEX.test(e)}const Me=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Te(e){const t=e.match(Me);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function Ce(e){const t=e.params.length?`?${e.params.join("&")}`:"";return`${e.protocol}://${e.authority}${e.path}${t}`}const ke="mapbox.eventData";function Se(e){if(!e)return null;const i=e.split(".");if(!i||3!==i.length)return null;try{return JSON.parse(decodeURIComponent(t.atob(i[1]).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join("")))}catch(e){return null}}class Le{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(e){const i=Se(o.ACCESS_TOKEN);let n="";return n=i&&i.u?t.btoa(encodeURIComponent(i.u).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(Number("0x"+t))))):o.ACCESS_TOKEN||"",e?`${ke}.${e}:${n}`:`${ke}:${n}`}fetchEventData(){const e=K("localStorage"),i=this.getStorageKey(),n=this.getStorageKey("uuid");if(e)try{const e=t.localStorage.getItem(i);e&&(this.eventData=JSON.parse(e));const o=t.localStorage.getItem(n);o&&(this.anonId=o)}catch(e){q("Unable to read from LocalStorage")}}saveEventData(){const e=K("localStorage"),i=this.getStorageKey(),n=this.getStorageKey("uuid");if(e)try{t.localStorage.setItem(n,this.anonId),Object.keys(this.eventData).length>=1&&t.localStorage.setItem(i,JSON.stringify(this.eventData))}catch(e){q("Unable to write to LocalStorage")}}processRequests(e){}postEvent(e,t,i,n){if(!o.EVENTS_URL)return;const r=Te(o.EVENTS_URL);r.params.push(`access_token=${n||o.ACCESS_TOKEN||""}`);const s={event:this.type,created:new Date(e).toISOString()},a=t?D(s,t):s,l={url:Ce(r),headers:{"Content-Type":"text/plain"},body:JSON.stringify([a])};this.pendingRequest=function(e,t){return de(D(e,{method:"POST"}),t)}(l,(e=>{this.pendingRequest=null,i(e),this.saveEventData(),this.processRequests(n)}))}queueRequest(e,t){this.queue.push(e),this.processRequests(t)}}const Ae=new class extends Le{constructor(e){super("appUserTurnstile"),this._customAccessToken=e}postTurnstileEvent(e,t){o.EVENTS_URL&&o.ACCESS_TOKEN&&Array.isArray(e)&&e.some((e=>be(e)||xe(e)))&&this.queueRequest(Date.now(),t)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=Se(o.ACCESS_TOKEN),n=t?t.u:o.ACCESS_TOKEN;let r=n!==this.eventData.tokenU;j(this.anonId)||(this.anonId=O(),r=!0);const s=this.queue.shift();if(this.eventData.lastSuccess){const e=new Date(this.eventData.lastSuccess),t=new Date(s),i=(s-this.eventData.lastSuccess)/864e5;r=r||i>=1||i<-1||e.getDate()!==t.getDate()}else r=!0;r?this.postEvent(s,{sdkIdentifier:"mapbox-gl-js",sdkVersion:i,skuId:d,"enabled.telemetry":!1,userId:this.anonId},(e=>{e||(this.eventData.lastSuccess=s,this.eventData.tokenU=n)}),e):this.processRequests()}},Ie=Ae.postTurnstileEvent.bind(Ae),De=new class extends Le{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(e,t,i,n){this.skuToken=t,this.errorCb=n,o.EVENTS_URL&&(i||o.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(ye)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{id:t,timestamp:n}=this.queue.shift();t&&this.success[t]||(this.anonId||this.fetchEventData(),j(this.anonId)||(this.anonId=O()),this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:i,skuId:d,skuToken:this.skuToken,userId:this.anonId},(e=>{e?this.errorCb(e):t&&(this.success[t]=!0)}),e))}},ze=De.postMapLoadEvent.bind(De),Pe=new class extends Le{constructor(){super("gljs.performance")}postPerformanceEvent(e,t){o.EVENTS_URL&&(e||o.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},e)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:n,performanceData:o}=this.queue.shift(),r=function(e){const n=t.performance.getEntriesByType("resource"),o=t.performance.getEntriesByType("mark"),r=function(e){const t={};if(e)for(const i in e)if("other"!==i)for(const n of e[i]){const e=`${i}ResolveRangeMin`,o=`${i}ResolveRangeMax`,r=`${i}RequestCount`,s=`${i}RequestCachedCount`;t[e]=Math.min(t[e]||1/0,n.startTime),t[o]=Math.max(t[o]||-1/0,n.responseEnd);const a=e=>{void 0===t[e]&&(t[e]=0),++t[e]};void 0!==n.transferSize&&0===n.transferSize&&a(s),a(r)}return t}(function(e,t){const i={};if(e)for(const n of e){const e=t(n);void 0===i[e]&&(i[e]=[]),i[e].push(n)}return i}(n,Ue)),s=t.devicePixelRatio,a=t.navigator.connection||t.navigator.mozConnection||t.navigator.webkitConnection,l={counters:[],metadata:[],attributes:[]},c=(e,t,i)=>{null!=i&&e.push({name:t,value:i.toString()})};for(const e in r)c(l.counters,e,r[e]);if(e.interactionRange[0]!==1/0&&e.interactionRange[1]!==-1/0&&(c(l.counters,"interactionRangeMin",e.interactionRange[0]),c(l.counters,"interactionRangeMax",e.interactionRange[1])),o)for(const e of Object.keys(Fe)){const t=Fe[e],i=o.find((e=>e.name===t));i&&c(l.counters,t,i.startTime)}return c(l.counters,"visibilityHidden",e.visibilityHidden),c(l.attributes,"style",function(e){if(e)for(const t of e){const e=t.name.split("?")[0];if(we(e)){const t=e.split("/").slice(-2);if(2===t.length)return`mapbox://styles/${t[0]}/${t[1]}`}}}(n)),c(l.attributes,"terrainEnabled",e.terrainEnabled?"true":"false"),c(l.attributes,"fogEnabled",e.fogEnabled?"true":"false"),c(l.attributes,"projection",e.projection),c(l.attributes,"zoom",e.zoom),c(l.metadata,"devicePixelRatio",s),c(l.metadata,"connectionEffectiveType",a?a.effectiveType:void 0),c(l.metadata,"navigatorUserAgent",t.navigator.userAgent),c(l.metadata,"screenWidth",t.screen.width),c(l.metadata,"screenHeight",t.screen.height),c(l.metadata,"windowWidth",t.innerWidth),c(l.metadata,"windowHeight",t.innerHeight),c(l.metadata,"mapWidth",e.width/s),c(l.metadata,"mapHeight",e.height/s),c(l.metadata,"webglRenderer",e.renderer),c(l.metadata,"webglVendor",e.vendor),c(l.metadata,"sdkVersion",i),c(l.metadata,"sdkIdentifier","mapbox-gl-js"),l}(o);for(const e of r.metadata);for(const e of r.counters);for(const e of r.attributes);this.postEvent(n,r,(()=>{}),e)}},Oe=Pe.postPerformanceEvent.bind(Pe),Be=new class extends Le{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(e,t,i,n){if(!o.API_URL||!o.SESSION_PATH)return;const r=Te(o.API_URL+o.SESSION_PATH);r.params.push(`sku=${t||""}`),r.params.push(`access_token=${n||o.ACCESS_TOKEN||""}`);const s={url:Ce(r),headers:{"Content-Type":"text/plain"}};this.pendingRequest=function(e,t){return de(D(e,{method:"GET"}),t)}(s,(e=>{this.pendingRequest=null,i(e),this.saveEventData(),this.processRequests(n)}))}getSessionAPI(e,t,i,n){this.skuToken=t,this.errorCb=n,o.SESSION_PATH&&o.API_URL&&(i||o.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(ye)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{id:t,timestamp:i}=this.queue.shift();t&&this.success[t]||this.getSession(i,this.skuToken,(e=>{e?this.errorCb(e):t&&(this.success[t]=!0)}),e)}},je=Be.getSessionAPI.bind(Be),Re=new Set,Fe={create:"create",load:"load",fullLoad:"fullLoad"},Ne={mark(e){t.performance.mark(e)},measure(e,i,n){t.performance.measure(e,i,n)}};function Ue(e){const t=e.name.split("?")[0];return ve(t)&&t.includes("mapbox-gl.js")?"javascript":ve(t)&&t.includes("mapbox-gl.css")?"css":function(e){return o.API_FONTS_REGEX.test(e)}(t)?"fontRange":Ee(t)?"sprite":we(t)?"style":function(e){return o.API_TILEJSON_REGEX.test(e)}(t)?"tilejson":"other"}const Ve=t.performance;function $e(e){const t=e?e.url.toString():void 0;return Ve.getEntriesByName(t)}let qe,Ge,Ze,He;const We={now:()=>void 0!==Ze?Ze:t.performance.now(),setNow(e){Ze=e},restoreNow(){Ze=void 0},frame(e){const i=t.requestAnimationFrame(e);return{cancel:()=>t.cancelAnimationFrame(i)}},getImageData(e,i=0){const{width:n,height:o}=e;He||(He=t.document.createElement("canvas"));const r=He.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return(n>He.width||o>He.height)&&(He.width=n,He.height=o),r.clearRect(-i,-i,n+2*i,o+2*i),r.drawImage(e,0,0,n,o),r.getImageData(-i,-i,n+2*i,o+2*i)},resolveURL:e=>(qe||(qe=t.document.createElement("a")),qe.href=e,qe.href),get devicePixelRatio(){return t.devicePixelRatio},get prefersReducedMotion(){return!!t.matchMedia&&(null==Ge&&(Ge=t.matchMedia("(prefers-reduced-motion: reduce)")),Ge.matches)}};function Xe(e,t,i){i[e]&&-1!==i[e].indexOf(t)||(i[e]=i[e]||[],i[e].push(t))}function Ye(e,t,i){if(i&&i[e]){const n=i[e].indexOf(t);-1!==n&&i[e].splice(n,1)}}class Ke{constructor(e,t={}){D(this,t),this.type=e}}class Qe extends Ke{constructor(e,t={}){super("error",D({error:e},t))}}class Je{on(e,t){return this._listeners=this._listeners||{},Xe(e,t,this._listeners),this}off(e,t){return Ye(e,t,this._listeners),Ye(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},Xe(e,t,this._oneTimeListeners),this):new Promise((t=>this.once(e,t)))}fire(e,t){"string"==typeof e&&(e=new Ke(e,t||{}));const i=e.type;if(this.listens(i)){e.target=this;const t=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(const i of t)i.call(this,e);const n=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const t of n)Ye(i,t,this._oneTimeListeners),t.call(this,e);const o=this._eventedParent;o&&(D(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),o.fire(e))}else e instanceof Qe&&console.error(e.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var et=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"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"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"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":true,"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":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"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":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"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":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"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":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"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_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"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":false,"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"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1,"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":{},"round":{},"square":{}},"default":"butt","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"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":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"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":true,"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":false,"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":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"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":true,"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":false,"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":false,"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":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"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":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"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_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"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":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{},"globe":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["source"]}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["fill-extrusion-edge-radius"]},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"requires":["fill-extrusion-edge-radius"],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":false,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"transition":false,"requires":[{"source":"geojson","has":{"lineMetrics":true}}],"property-type":"constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"transition":false,"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"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"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function tt(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}function it(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function nt(e){if(Array.isArray(e))return e.map(nt);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const i in e)t[i]=nt(e[i]);return t}return it(e)}class ot extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}var rt=ot;class st{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[e,i]of t)this.bindings[e]=i}concat(e){return new st(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}var at=st;const lt={kind:"null"},ct={kind:"number"},ut={kind:"string"},dt={kind:"boolean"},ht={kind:"color"},pt={kind:"object"},mt={kind:"value"},ft={kind:"collator"},gt={kind:"formatted"},_t={kind:"resolvedImage"};function yt(e,t){return{kind:"array",itemType:e,N:t}}function bt(e){if("array"===e.kind){const t=bt(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const xt=[lt,ct,ut,dt,ht,gt,pt,yt(mt),_t];function vt(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!vt(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of xt)if(!vt(e,t))return null}return`Expected ${bt(e)} but found ${bt(t)} instead.`}function wt(e,t){return t.some((t=>t.kind===e.kind))}function Et(e,t){return t.some((t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e))}var Mt,Tt={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 Ct(e){return(e=Math.round(e))<0?0:e>255?255:e}function kt(e){return Ct("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function St(e){return(t="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:t>1?1:t;var t}function Lt(e,t,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?e+(t-e)*i*6:2*i<1?t:3*i<2?e+(t-e)*(2/3-i)*6:e}try{Mt={}.parseCSSColor=function(e){var t,i=e.replace(/ /g,"").toLowerCase();if(i in Tt)return Tt[i].slice();if("#"===i[0])return 4===i.length?(t=parseInt(i.substr(1),16))>=0&&t<=4095?[(3840&t)>>4|(3840&t)>>8,240&t|(240&t)>>4,15&t|(15&t)<<4,1]:null:7===i.length&&(t=parseInt(i.substr(1),16))>=0&&t<=16777215?[(16711680&t)>>16,(65280&t)>>8,255&t,1]:null;var n=i.indexOf("("),o=i.indexOf(")");if(-1!==n&&o+1===i.length){var r=i.substr(0,n),s=i.substr(n+1,o-(n+1)).split(","),a=1;switch(r){case"rgba":if(4!==s.length)return null;a=St(s.pop());case"rgb":return 3!==s.length?null:[kt(s[0]),kt(s[1]),kt(s[2]),a];case"hsla":if(4!==s.length)return null;a=St(s.pop());case"hsl":if(3!==s.length)return null;var l=(parseFloat(s[0])%360+360)%360/360,c=St(s[1]),u=St(s[2]),d=u<=.5?u*(c+1):u+c-u*c,h=2*u-d;return[Ct(255*Lt(h,d,l+1/3)),Ct(255*Lt(h,d,l)),Ct(255*Lt(h,d,l-1/3)),a];default:return null}}return null}}catch(e){}class At{constructor(e,t,i,n=1){this.r=e,this.g=t,this.b=i,this.a=n}static parse(e){if(!e)return;if(e instanceof At)return e;if("string"!=typeof e)return;const t=Mt(e);return t?new At(t[0]/255*t[3],t[1]/255*t[3],t[2]/255*t[3],t[3]):void 0}toString(){const[e,t,i,n]=this.toArray();return`rgba(${Math.round(e)},${Math.round(t)},${Math.round(i)},${n})`}toArray(){const{r:e,g:t,b:i,a:n}=this;return 0===n?[0,0,0,0]:[255*e/n,255*t/n,255*i/n,n]}toArray01(){const{r:e,g:t,b:i,a:n}=this;return 0===n?[0,0,0,0]:[e/n,t/n,i/n,n]}toArray01PremultipliedAlpha(){const{r:e,g:t,b:i,a:n}=this;return[e,t,i,n]}}At.black=new At(0,0,0,1),At.white=new At(1,1,1,1),At.transparent=new At(0,0,0,0),At.red=new At(1,0,0,1),At.blue=new At(0,0,1,1);var It=At;class Dt{constructor(e,t,i){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class zt{constructor(e,t,i,n,o){this.text=e.normalize?e.normalize():e,this.image=t,this.scale=i,this.fontStack=n,this.textColor=o}}class Pt{constructor(e){this.sections=e}static fromString(e){return new Pt([new zt(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((e=>0!==e.text.length||e.image&&0!==e.image.name.length))}static factory(e){return e instanceof Pt?e:Pt.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map((e=>e.text)).join("")}serialize(){const e=["format"];for(const t of this.sections){if(t.image){e.push(["image",t.image.name]);continue}e.push(t.text);const i={};t.fontStack&&(i["text-font"]=["literal",t.fontStack.split(",")]),t.scale&&(i["font-scale"]=t.scale),t.textColor&&(i["text-color"]=["rgba"].concat(t.textColor.toArray())),e.push(i)}return e}}class Ot{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Ot({name:e,available:!1}):null}serialize(){return["image",this.name]}}function Bt(e,t,i,n){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[e,t,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[e,t,i,n]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function jt(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof It)return!0;if(e instanceof Dt)return!0;if(e instanceof Pt)return!0;if(e instanceof Ot)return!0;if(Array.isArray(e)){for(const t of e)if(!jt(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!jt(e[t]))return!1;return!0}return!1}function Rt(e){if(null===e)return lt;if("string"==typeof e)return ut;if("boolean"==typeof e)return dt;if("number"==typeof e)return ct;if(e instanceof It)return ht;if(e instanceof Dt)return ft;if(e instanceof Pt)return gt;if(e instanceof Ot)return _t;if(Array.isArray(e)){const t=e.length;let i;for(const t of e){const e=Rt(t);if(i){if(i===e)continue;i=mt;break}i=e}return yt(i||mt,t)}return pt}function Ft(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof It||e instanceof Pt||e instanceof Ot?e.toString():JSON.stringify(e)}class Nt{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!jt(e[1]))return t.error("invalid value");const i=e[1];let n=Rt(i);const o=t.expectedType;return"array"!==n.kind||0!==n.N||!o||"array"!==o.kind||"number"==typeof o.N&&0!==o.N||(n=o),new Nt(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof It?["rgba"].concat(this.value.toArray()):this.value instanceof Pt?this.value.serialize():this.value}}var Ut=Nt,Vt=class{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}};const $t={string:ut,number:ct,boolean:dt,object:pt};class qt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i,n=1;const o=e[0];if("array"===o){let o,r;if(e.length>2){const i=e[1];if("string"!=typeof i||!(i in $t)||"object"===i)return t.error('The item type argument of "array" must be one of string, number, boolean',1);o=$t[i],n++}else o=mt;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);r=e[2],n++}i=yt(o,r)}else i=$t[o];const r=[];for(;ne.outputDefined()))}serialize(){const e=this.type,t=[e.kind];if("array"===e.kind){const i=e.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){t.push(i.kind);const n=e.N;("number"==typeof n||this.args.length>1)&&t.push(n)}}return t.concat(this.args.map((e=>e.serialize())))}}var Gt=qt;class Zt{constructor(e){this.type=gt,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[1];if(!Array.isArray(i)&&"object"==typeof i)return t.error("First argument must be an image or text section.");const n=[];let o=!1;for(let i=1;i<=e.length-1;++i){const r=e[i];if(o&&"object"==typeof r&&!Array.isArray(r)){o=!1;let e=null;if(r["font-scale"]&&(e=t.parse(r["font-scale"],1,ct),!e))return null;let i=null;if(r["text-font"]&&(i=t.parse(r["text-font"],1,yt(ut)),!i))return null;let s=null;if(r["text-color"]&&(s=t.parse(r["text-color"],1,ht),!s))return null;const a=n[n.length-1];a.scale=e,a.font=i,a.textColor=s}else{const r=t.parse(e[i],1,mt);if(!r)return null;const s=r.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,n.push({content:r,scale:null,font:null,textColor:null})}}return new Zt(n)}evaluate(e){return new Pt(this.sections.map((t=>{const i=t.content.evaluate(e);return Rt(i)===_t?new zt("",i,null,null,null):new zt(Ft(i),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)})))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const t of this.sections){e.push(t.content.serialize());const i={};t.scale&&(i["font-scale"]=t.scale.serialize()),t.font&&(i["text-font"]=t.font.serialize()),t.textColor&&(i["text-color"]=t.textColor.serialize()),e.push(i)}return e}}class Ht{constructor(e){this.type=_t,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,ut);return i?new Ht(i):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),i=Ot.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Wt={"to-boolean":dt,"to-color":ht,"to-number":ct,"to-string":ut};class Xt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[0];if(("to-boolean"===i||"to-string"===i)&&2!==e.length)return t.error("Expected one argument.");const n=Wt[i],o=[];for(let i=1;i4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Bt(t[0],t[1],t[2],t[3]),!i))return new It(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Vt(i||`Could not parse color from value '${"string"==typeof t?t:String(JSON.stringify(t))}'`)}if("number"===this.type.kind){let t=null;for(const i of this.args){if(t=i.evaluate(e),null===t)return 0;const n=Number(t);if(!isNaN(n))return n}throw new Vt(`Could not convert ${JSON.stringify(t)} to number.`)}return"formatted"===this.type.kind?Pt.fromString(Ft(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?Ot.fromString(Ft(this.args[0].evaluate(e))):Ft(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new Zt([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Ht(this.args[0]).serialize();const e=[`to-${this.type.kind}`];return this.eachChild((t=>{e.push(t.serialize())})),e}}var Yt=Xt;const Kt=["Unknown","Point","LineString","Polygon"];var Qt=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Kt[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||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,t=this.featureDistanceData.scale,{x:i,y:n}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(i*t-e[0])+this.featureDistanceData.bearing[1]*(n*t-e[1])}return 0}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=It.parse(e)),t}};class Jt{constructor(e,t,i,n){this.name=e,this.type=t,this._evaluate=i,this.args=n}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((e=>e.serialize())))}static parse(e,t){const i=e[0],n=Jt.definitions[i];if(!n)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const o=Array.isArray(n)?n[0]:n.type,r=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,s=r.filter((([t])=>!Array.isArray(t)||t.length===e.length-1));let a=null;for(const[n,r]of s){a=new Ci(t.registry,t.path,null,t.scope);const s=[];let l=!1;for(let t=1;t{return t=e,Array.isArray(t)?`(${t.map(bt).join(", ")})`:`(${bt(t.type)}...)`;var t})).join(" | "),n=[];for(let i=1;i=t[2]||e[1]<=t[1]||e[3]>=t[3])}function ri(e,t){const i=(180+e[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,o=Math.pow(2,t.z);return[Math.round(i*o*ii),Math.round(n*o*ii)]}function si(e,t,i){const n=e[0]-t[0],o=e[1]-t[1],r=e[0]-i[0],s=e[1]-i[1];return n*s-r*o==0&&n*r<=0&&o*s<=0}function ai(e,t){let i=!1;for(let s=0,a=t.length;s(n=e)[1]!=(r=a[t+1])[1]>n[1]&&n[0]<(r[0]-o[0])*(n[1]-o[1])/(r[1]-o[1])+o[0]&&(i=!i)}}var n,o,r;return i}function li(e,t){for(let i=0;i0&&a<0||s<0&&a>0}function ui(e,t,i){for(const c of i)for(let i=0;ii[2]){const t=.5*n;let o=e[0]-i[0]>t?-n:i[0]-e[0]>t?n:0;0===o&&(o=e[0]-i[2]>t?-n:i[2]-e[0]>t?n:0),e[0]+=o}ni(t,e)}function gi(e,t,i,n){const o=Math.pow(2,n.z)*ii,r=[n.x*ii,n.y*ii],s=[];if(!e)return s;for(const n of e)for(const e of n){const n=[e.x+r[0],e.y+r[1]];fi(n,t,i,o),s.push(n)}return s}function _i(e,t,i,n){const o=Math.pow(2,n.z)*ii,r=[n.x*ii,n.y*ii],s=[];if(!e)return s;for(const i of e){const e=[];for(const n of i){const i=[n.x+r[0],n.y+r[1]];ni(t,i),e.push(i)}s.push(e)}if(t[2]-t[0]<=o/2){(a=t)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const e of s)for(const n of e)fi(n,t,i,o)}var a;return s}class yi{constructor(e,t){this.type=dt,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(jt(e[1])){const t=e[1];if("FeatureCollection"===t.type)for(let e=0;e{t&&!xi(e)&&(t=!1)})),t}function vi(e){if(e instanceof ei&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild((e=>{t&&!vi(e)&&(t=!1)})),t}function wi(e,t){if(e instanceof ei&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild((e=>{i&&!wi(e,t)&&(i=!1)})),i}class Ei{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");const i=e[1];return t.scope.has(i)?new Ei(i,t.scope.get(i)):t.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}var Mi=Ei;class Ti{constructor(e,t=[],i,n=new at,o=[]){this.registry=e,this.path=t,this.key=t.map((e=>`[${e}]`)).join(""),this.scope=n,this.errors=o,this.expectedType=i}parse(e,t,i,n,o={}){return t?this.concat(t,i,n)._parse(e,o):this._parse(e,o)}_parse(e,t){function i(e,t,i){return"assert"===i?new Gt(t,[e]):"coerce"===i?new Yt(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=e[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const o=this.registry[n];if(o){let n=o.parse(e,this);if(!n)return null;if(this.expectedType){const e=this.expectedType,o=n.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==o.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==o.kind&&"string"!==o.kind){if(this.checkSubtype(e,o))return null}else n=i(n,e,t.typeAnnotation||"coerce");else n=i(n,e,t.typeAnnotation||"assert")}if(!(n instanceof Ut)&&"resolvedImage"!==n.type.kind&&ki(n)){const t=new Qt;try{n=new Ut(n.type,n.evaluate(t))}catch(e){return this.error(e.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i){const n="number"==typeof e?this.path.concat(e):this.path,o=i?this.scope.concat(i):this.scope;return new Ti(this.registry,n,t||null,o,this.errors)}error(e,...t){const i=`${this.key}${t.map((e=>`[${e}]`)).join("")}`;this.errors.push(new rt(i,e))}checkSubtype(e,t){const i=vt(e,t);return i&&this.error(i),i}}var Ci=Ti;function ki(e){if(e instanceof Mi)return ki(e.boundExpression);if(e instanceof ei&&"error"===e.name)return!1;if(e instanceof ti)return!1;if(e instanceof bi)return!1;const t=e instanceof Yt||e instanceof Gt;let i=!0;return e.eachChild((e=>{i=t?i&&ki(e):i&&e instanceof Ut})),!!i&&xi(e)&&wi(e,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function Si(e,t){const i=e.length-1;let n,o,r=0,s=i,a=0;for(;r<=s;)if(a=Math.floor((r+s)/2),n=e[a],o=e[a+1],n<=t){if(a===i||tt))throw new Vt("Input is not a number.");s=a-1}return 0}class Li{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[e,t]of i)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const i=t.parse(e[1],1,ct);if(!i)return null;const n=[];let o=null;t.expectedType&&"value"!==t.expectedType.kind&&(o=t.expectedType);for(let i=1;i=r)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=t.parse(s,l,o);if(!c)return null;o=o||c.type,n.push([r,c])}return new Li(o,i,n)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const n=this.input.evaluate(e);if(n<=t[0])return i[0].evaluate(e);const o=t.length;return n>=t[o-1]?i[o-1].evaluate(e):i[Si(t,n)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}serialize(){const e=["step",this.input.serialize()];for(let t=0;t0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e}}var Ai=Li;function Ii(e,t,i){return e*(1-i)+t*i}var Di=Object.freeze({__proto__:null,array:function(e,t,i){return e.map(((e,n)=>Ii(e,t[n],i)))},color:function(e,t,i){return new It(Ii(e.r,t.r,i),Ii(e.g,t.g,i),Ii(e.b,t.b,i),Ii(e.a,t.a,i))},number:Ii});const zi=.95047,Pi=1.08883,Oi=4/29,Bi=6/29,ji=3*Bi*Bi,Ri=Bi*Bi*Bi,Fi=Math.PI/180,Ni=180/Math.PI;function Ui(e){return e>Ri?Math.pow(e,1/3):e/ji+Oi}function Vi(e){return e>Bi?e*e*e:ji*(e-Oi)}function $i(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function qi(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Gi(e){const t=qi(e.r),i=qi(e.g),n=qi(e.b),o=Ui((.4124564*t+.3575761*i+.1804375*n)/zi),r=Ui((.2126729*t+.7151522*i+.072175*n)/1);return{l:116*r-16,a:500*(o-r),b:200*(r-Ui((.0193339*t+.119192*i+.9503041*n)/Pi)),alpha:e.a}}function Zi(e){let t=(e.l+16)/116,i=isNaN(e.a)?t:t+e.a/500,n=isNaN(e.b)?t:t-e.b/200;return t=1*Vi(t),i=zi*Vi(i),n=Pi*Vi(n),new It($i(3.2404542*i-1.5371385*t-.4985314*n),$i(-.969266*i+1.8760108*t+.041556*n),$i(.0556434*i-.2040259*t+1.0572252*n),e.alpha)}function Hi(e,t,i){const n=t-e;return e+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const Wi={forward:Gi,reverse:Zi,interpolate:function(e,t,i){return{l:Ii(e.l,t.l,i),a:Ii(e.a,t.a,i),b:Ii(e.b,t.b,i),alpha:Ii(e.alpha,t.alpha,i)}}},Xi={forward:function(e){const{l:t,a:i,b:n}=Gi(e),o=Math.atan2(n,i)*Ni;return{h:o<0?o+360:o,c:Math.sqrt(i*i+n*n),l:t,alpha:e.a}},reverse:function(e){const t=e.h*Fi,i=e.c;return Zi({l:e.l,a:Math.cos(t)*i,b:Math.sin(t)*i,alpha:e.alpha})},interpolate:function(e,t,i){return{h:Hi(e.h,t.h,i),c:Ii(e.c,t.c,i),l:Ii(e.l,t.l,i),alpha:Ii(e.alpha,t.alpha,i)}}};var Yi=Object.freeze({__proto__:null,hcl:Xi,lab:Wi});class Ki{constructor(e,t,i,n,o){this.type=e,this.operator=t,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(const[e,t]of o)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,i,n){let o=0;if("exponential"===e.name)o=Qi(t,e.base,i,n);else if("linear"===e.name)o=Qi(t,1,i,n);else if("cubic-bezier"===e.name){const r=e.controlPoints;o=new f(r[0],r[1],r[2],r[3]).solve(Qi(t,1,i,n))}return o}static parse(e,t){let[i,n,o,...r]=e;if(!Array.isArray(n)||0===n.length)return t.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const e=n[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:e}}else{if("cubic-bezier"!==n[0])return t.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const e=n.slice(1);if(4!==e.length||e.some((e=>"number"!=typeof e||e<0||e>1)))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(o=t.parse(o,2,ct),!o)return null;const s=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=ht:t.expectedType&&"value"!==t.expectedType.kind&&(a=t.expectedType);for(let e=0;e=i)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',o);const c=t.parse(n,l,a);if(!c)return null;a=a||c.type,s.push([i,c])}return"number"===a.kind||"color"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new Ki(a,i,n,o,s):t.error(`Type ${bt(a)} is not interpolatable.`)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const n=this.input.evaluate(e);if(n<=t[0])return i[0].evaluate(e);const o=t.length;if(n>=t[o-1])return i[o-1].evaluate(e);const r=Si(t,n),s=Ki.interpolationFactor(this.interpolation,n,t[r],t[r+1]),a=i[r].evaluate(e),l=i[r+1].evaluate(e);return"interpolate"===this.operator?Di[this.type.kind.toLowerCase()](a,l,s):"interpolate-hcl"===this.operator?Xi.reverse(Xi.interpolate(Xi.forward(a),Xi.forward(l),s)):Wi.reverse(Wi.interpolate(Wi.forward(a),Wi.forward(l),s))}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}serialize(){let e;e="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const t=[this.operator,e,this.input.serialize()];for(let e=0;evt(n,e.type)));return new en(r?mt:i,o)}evaluate(e){let t,i=null,n=0;for(const o of this.args){if(n++,i=o.evaluate(e),i&&i instanceof Ot&&!i.available&&(t||(t=i),i=null,n===this.args.length))return t;if(null!==i)break}return i}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){const e=["coalesce"];return this.eachChild((t=>{e.push(t.serialize())})),e}}var tn=en;class nn{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const i=[];for(let n=1;n=i.length)throw new Vt(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new Vt(`Array index must be an integer, but found ${t} instead.`);return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var sn=rn;class an{constructor(e,t){this.type=dt,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,mt),n=t.parse(e[2],2,mt);return i&&n?wt(i.type,[dt,ut,ct,lt,mt])?new an(i,n):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${bt(i.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(null==i)return!1;if(!Et(t,["boolean","string","number","null"]))throw new Vt(`Expected first argument to be of type boolean, string, number or null, but found ${bt(Rt(t))} instead.`);if(!Et(i,["string","array"]))throw new Vt(`Expected second argument to be of type array or string, but found ${bt(Rt(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var ln=an;class cn{constructor(e,t,i){this.type=ct,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,mt),n=t.parse(e[2],2,mt);if(!i||!n)return null;if(!wt(i.type,[dt,ut,ct,lt,mt]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${bt(i.type)} instead`);if(4===e.length){const o=t.parse(e[3],3,ct);return o?new cn(i,n,o):null}return new cn(i,n)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!Et(t,["boolean","string","number","null"]))throw new Vt(`Expected first argument to be of type boolean, string, number or null, but found ${bt(Rt(t))} instead.`);if(!Et(i,["string","array"]))throw new Vt(`Expected second argument to be of type array or string, but found ${bt(Rt(i))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(e);return i.indexOf(t,n)}return i.indexOf(t)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var un=cn;class dn{constructor(e,t,i,n,o,r){this.inputType=e,this.type=t,this.input=i,this.cases=n,this.outputs=o,this.otherwise=r}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let i,n;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);const o={},r=[];for(let s=2;sNumber.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,Rt(e)))return null}else i=Rt(e);if(void 0!==o[String(e)])return c.error("Branch labels must be unique.");o[String(e)]=r.length}const u=t.parse(l,s,n);if(!u)return null;n=n||u.type,r.push(u)}const s=t.parse(e[1],1,mt);if(!s)return null;const a=t.parse(e[e.length-1],e.length-1,n);return a?"value"!==s.type.kind&&t.concat(1).checkSubtype(i,s.type)?null:new dn(i,n,s,o,r,a):null}evaluate(e){const t=this.input.evaluate(e);return(Rt(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],t=Object.keys(this.cases).sort(),i=[],n={};for(const e of t){const t=n[this.cases[e]];void 0===t?(n[this.cases[e]]=i.length,i.push([this.cases[e],[e]])):i[t][1].push(e)}const o=e=>"number"===this.inputType.kind?Number(e):e;for(const[t,n]of i)e.push(1===n.length?o(n[0]):n.map(o)),e.push(this.outputs[t].serialize());return e.push(this.otherwise.serialize()),e}}var hn=dn;class pn{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let i;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);const n=[];for(let o=1;ot.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild((t=>{e.push(t.serialize())})),e}}var mn=pn;class fn{constructor(e,t,i,n){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,mt),n=t.parse(e[2],2,ct);if(!i||!n)return null;if(!wt(i.type,[yt(mt),ut,mt]))return t.error(`Expected first argument to be of type array or string, but found ${bt(i.type)} instead`);if(4===e.length){const o=t.parse(e[3],3,ct);return o?new fn(i.type,i,n,o):null}return new fn(i.type,i,n)}evaluate(e){const t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);if(!Et(t,["string","array"]))throw new Vt(`Expected first argument to be of type array or string, but found ${bt(Rt(t))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(e);return t.slice(i,n)}return t.slice(i)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var gn=fn;function _n(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function yn(e,t,i,n){return 0===n.compare(t,i)}function bn(e,t,i){const n="=="!==e&&"!="!==e;return class o{constructor(e,t,i){this.type=dt,this.lhs=e,this.rhs=t,this.collator=i,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const i=e[0];let r=t.parse(e[1],1,mt);if(!r)return null;if(!_n(i,r.type))return t.concat(1).error(`"${i}" comparisons are not supported for type '${bt(r.type)}'.`);let s=t.parse(e[2],2,mt);if(!s)return null;if(!_n(i,s.type))return t.concat(2).error(`"${i}" comparisons are not supported for type '${bt(s.type)}'.`);if(r.type.kind!==s.type.kind&&"value"!==r.type.kind&&"value"!==s.type.kind)return t.error(`Cannot compare types '${bt(r.type)}' and '${bt(s.type)}'.`);n&&("value"===r.type.kind&&"value"!==s.type.kind?r=new Gt(s.type,[r]):"value"!==r.type.kind&&"value"===s.type.kind&&(s=new Gt(r.type,[s])));let a=null;if(4===e.length){if("string"!==r.type.kind&&"string"!==s.type.kind&&"value"!==r.type.kind&&"value"!==s.type.kind)return t.error("Cannot use collator to compare non-string types.");if(a=t.parse(e[3],3,ft),!a)return null}return new o(r,s,a)}evaluate(o){const r=this.lhs.evaluate(o),s=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){const t=Rt(r),i=Rt(s);if(t.kind!==i.kind||"string"!==t.kind&&"number"!==t.kind)throw new Vt(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${i.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const e=Rt(r),i=Rt(s);if("string"!==e.kind||"string"!==i.kind)return t(o,r,s)}return this.collator?i(o,r,s,this.collator.evaluate(o)):t(o,r,s)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}serialize(){const t=[e];return this.eachChild((e=>{t.push(e.serialize())})),t}}}const xn=bn("==",(function(e,t,i){return t===i}),yn),vn=bn("!=",(function(e,t,i){return t!==i}),(function(e,t,i,n){return!yn(0,t,i,n)})),wn=bn("<",(function(e,t,i){return t",(function(e,t,i){return t>i}),(function(e,t,i,n){return n.compare(t,i)>0})),Mn=bn("<=",(function(e,t,i){return t<=i}),(function(e,t,i,n){return n.compare(t,i)<=0})),Tn=bn(">=",(function(e,t,i){return t>=i}),(function(e,t,i,n){return n.compare(t,i)>=0}));class Cn{constructor(e,t,i,n,o,r){this.type=ut,this.number=e,this.locale=t,this.currency=i,this.unit=n,this.minFractionDigits=o,this.maxFractionDigits=r}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,ct);if(!i)return null;const n=e[2];if("object"!=typeof n||Array.isArray(n))return t.error("NumberFormat options argument must be an object.");let o=null;if(n.locale&&(o=t.parse(n.locale,1,ut),!o))return null;let r=null;if(n.currency&&(r=t.parse(n.currency,1,ut),!r))return null;let s=null;if(n.unit&&(s=t.parse(n.unit,1,ut),!s))return null;let a=null;if(n["min-fraction-digits"]&&(a=t.parse(n["min-fraction-digits"],1,ct),!a))return null;let l=null;return n["max-fraction-digits"]&&(l=t.parse(n["max-fraction-digits"],1,ct),!l)?null:new Cn(i,o,r,s,a,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class kn{constructor(e){this.type=ct,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const i=t.parse(e[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?t.error(`Expected argument of type string or array, but found ${bt(i.type)} instead.`):new kn(i):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return t.length;if(Array.isArray(t))return t.length;throw new Vt(`Expected value to be of type string or array, but found ${bt(Rt(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild((t=>{e.push(t.serialize())})),e}}const Sn={"==":xn,"!=":vn,">":En,"<":wn,">=":Tn,"<=":Mn,array:Gt,at:sn,boolean:Gt,case:mn,coalesce:tn,collator:ti,format:Zt,image:Ht,in:ln,"index-of":un,interpolate:Ji,"interpolate-hcl":Ji,"interpolate-lab":Ji,length:kn,let:on,literal:Ut,match:hn,number:Gt,"number-format":Cn,object:Gt,slice:gn,step:Ai,string:Gt,"to-boolean":Yt,"to-color":Yt,"to-number":Yt,"to-string":Yt,var:Mi,within:bi};function Ln(e,[t,i,n,o]){t=t.evaluate(e),i=i.evaluate(e),n=n.evaluate(e);const r=o?o.evaluate(e):1,s=Bt(t,i,n,r);if(s)throw new Vt(s);return new It(t/255*r,i/255*r,n/255*r,r)}function An(e,t){return e in t}function In(e,t){const i=t[e];return void 0===i?null:i}function Dn(e){return{type:e}}ei.register(Sn,{error:[{kind:"error"},[ut],(e,[t])=>{throw new Vt(t.evaluate(e))}],typeof:[ut,[mt],(e,[t])=>bt(Rt(t.evaluate(e)))],"to-rgba":[yt(ct,4),[ht],(e,[t])=>t.evaluate(e).toArray()],rgb:[ht,[ct,ct,ct],Ln],rgba:[ht,[ct,ct,ct,ct],Ln],has:{type:dt,overloads:[[[ut],(e,[t])=>An(t.evaluate(e),e.properties())],[[ut,pt],(e,[t,i])=>An(t.evaluate(e),i.evaluate(e))]]},get:{type:mt,overloads:[[[ut],(e,[t])=>In(t.evaluate(e),e.properties())],[[ut,pt],(e,[t,i])=>In(t.evaluate(e),i.evaluate(e))]]},"feature-state":[mt,[ut],(e,[t])=>In(t.evaluate(e),e.featureState||{})],properties:[pt,[],e=>e.properties()],"geometry-type":[ut,[],e=>e.geometryType()],id:[mt,[],e=>e.id()],zoom:[ct,[],e=>e.globals.zoom],pitch:[ct,[],e=>e.globals.pitch||0],"distance-from-center":[ct,[],e=>e.distanceFromCenter()],"heatmap-density":[ct,[],e=>e.globals.heatmapDensity||0],"line-progress":[ct,[],e=>e.globals.lineProgress||0],"sky-radial-progress":[ct,[],e=>e.globals.skyRadialProgress||0],accumulated:[mt,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[ct,Dn(ct),(e,t)=>{let i=0;for(const n of t)i+=n.evaluate(e);return i}],"*":[ct,Dn(ct),(e,t)=>{let i=1;for(const n of t)i*=n.evaluate(e);return i}],"-":{type:ct,overloads:[[[ct,ct],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[ct],(e,[t])=>-t.evaluate(e)]]},"/":[ct,[ct,ct],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[ct,[ct,ct],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[ct,[],()=>Math.LN2],pi:[ct,[],()=>Math.PI],e:[ct,[],()=>Math.E],"^":[ct,[ct,ct],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[ct,[ct],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[ct,[ct],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[ct,[ct],(e,[t])=>Math.log(t.evaluate(e))],log2:[ct,[ct],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[ct,[ct],(e,[t])=>Math.sin(t.evaluate(e))],cos:[ct,[ct],(e,[t])=>Math.cos(t.evaluate(e))],tan:[ct,[ct],(e,[t])=>Math.tan(t.evaluate(e))],asin:[ct,[ct],(e,[t])=>Math.asin(t.evaluate(e))],acos:[ct,[ct],(e,[t])=>Math.acos(t.evaluate(e))],atan:[ct,[ct],(e,[t])=>Math.atan(t.evaluate(e))],min:[ct,Dn(ct),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[ct,Dn(ct),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[ct,[ct],(e,[t])=>Math.abs(t.evaluate(e))],round:[ct,[ct],(e,[t])=>{const i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[ct,[ct],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[ct,[ct],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[dt,[ut,mt],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[dt,[mt],(e,[t])=>e.id()===t.value],"filter-type-==":[dt,[ut],(e,[t])=>e.geometryType()===t.value],"filter-<":[dt,[ut,mt],(e,[t,i])=>{const n=e.properties()[t.value],o=i.value;return typeof n==typeof o&&n{const i=e.id(),n=t.value;return typeof i==typeof n&&i":[dt,[ut,mt],(e,[t,i])=>{const n=e.properties()[t.value],o=i.value;return typeof n==typeof o&&n>o}],"filter-id->":[dt,[mt],(e,[t])=>{const i=e.id(),n=t.value;return typeof i==typeof n&&i>n}],"filter-<=":[dt,[ut,mt],(e,[t,i])=>{const n=e.properties()[t.value],o=i.value;return typeof n==typeof o&&n<=o}],"filter-id-<=":[dt,[mt],(e,[t])=>{const i=e.id(),n=t.value;return typeof i==typeof n&&i<=n}],"filter->=":[dt,[ut,mt],(e,[t,i])=>{const n=e.properties()[t.value],o=i.value;return typeof n==typeof o&&n>=o}],"filter-id->=":[dt,[mt],(e,[t])=>{const i=e.id(),n=t.value;return typeof i==typeof n&&i>=n}],"filter-has":[dt,[mt],(e,[t])=>t.value in e.properties()],"filter-has-id":[dt,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[dt,[yt(ut)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[dt,[yt(mt)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[dt,[ut,yt(mt)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[dt,[ut,yt(mt)],(e,[t,i])=>function(e,t,i,n){for(;i<=n;){const o=i+n>>1;if(t[o]===e)return!0;t[o]>e?n=o-1:i=o+1}return!1}(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:dt,overloads:[[[dt,dt],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[Dn(dt),(e,t)=>{for(const i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:dt,overloads:[[[dt,dt],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[Dn(dt),(e,t)=>{for(const i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[dt,[dt],(e,[t])=>!t.evaluate(e)],"is-supported-script":[dt,[ut],(e,[t])=>{const i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[ut,[ut],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[ut,[ut],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[ut,Dn(mt),(e,t)=>t.map((t=>Ft(t.evaluate(e)))).join("")],"resolved-locale":[ut,[ft],(e,[t])=>t.evaluate(e).resolvedLocale()]});var zn=Sn;function Pn(e){return{result:"success",value:e}}function On(e){return{result:"error",value:e}}function Bn(e){return"data-driven"===e["property-type"]}function jn(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function Rn(e){return!!e.expression&&e.expression.interpolated}function Fn(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function Nn(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Un(e){return e}function Vn(e,t){const i="color"===t.type,n=e.stops&&"object"==typeof e.stops[0][0],o=n||!(n||void 0!==e.property),r=e.type||(Rn(t)?"exponential":"interval");if(i&&((e=tt({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],It.parse(e[1])]))),e.default=It.parse(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!Yi[e.colorSpace])throw new Error(`Unknown color space: ${e.colorSpace}`);let s,a,l;if("exponential"===r)s=Zn;else if("interval"===r)s=Gn;else if("categorical"===r){s=qn,a=Object.create(null);for(const t of e.stops)a[t[0]]=t[1];l=typeof e.stops[0][0]}else{if("identity"!==r)throw new Error(`Unknown function type "${r}"`);s=Hn}if(n){const i={},n=[];for(let t=0;te[0])),evaluate:({zoom:i},n)=>Zn({stops:o,base:e.base},t,i).evaluate(i,n)}}if(o){const i="exponential"===r?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:Ji.interpolationFactor.bind(void 0,i),zoomStops:e.stops.map((e=>e[0])),evaluate:({zoom:i})=>s(e,t,i,a,l)}}return{kind:"source",evaluate(i,n){const o=n&&n.properties?n.properties[e.property]:void 0;return void 0===o?$n(e.default,t.default):s(e,t,o,a,l)}}}function $n(e,t,i){return void 0!==e?e:void 0!==t?t:void 0!==i?i:void 0}function qn(e,t,i,n,o){return $n(typeof i===o?n[i]:void 0,e.default,t.default)}function Gn(e,t,i){if("number"!==Fn(i))return $n(e.default,t.default);const n=e.stops.length;if(1===n)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[n-1][0])return e.stops[n-1][1];const o=Si(e.stops.map((e=>e[0])),i);return e.stops[o][1]}function Zn(e,t,i){const n=void 0!==e.base?e.base:1;if("number"!==Fn(i))return $n(e.default,t.default);const o=e.stops.length;if(1===o)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[o-1][0])return e.stops[o-1][1];const r=Si(e.stops.map((e=>e[0])),i),s=function(e,t,i,n){const o=n-i,r=e-i;return 0===o?0:1===t?r/o:(Math.pow(t,r)-1)/(Math.pow(t,o)-1)}(i,n,e.stops[r][0],e.stops[r+1][0]),a=e.stops[r][1],l=e.stops[r+1][1];let c=Di[t.type]||Un;if(e.colorSpace&&"rgb"!==e.colorSpace){const t=Yi[e.colorSpace];c=(e,i)=>t.reverse(t.interpolate(t.forward(e),t.forward(i),s))}return"function"==typeof a.evaluate?{evaluate(...e){const t=a.evaluate.apply(void 0,e),i=l.evaluate.apply(void 0,e);if(void 0!==t&&void 0!==i)return c(t,i,s)}}:c(a,l,s)}function Hn(e,t,i){return"color"===t.type?i=It.parse(i):"formatted"===t.type?i=Pt.fromString(i.toString()):"resolvedImage"===t.type?i=Ot.fromString(i.toString()):Fn(i)===t.type||"enum"===t.type&&t.values[i]||(i=void 0),$n(i,e.default,t.default)}class Wn{constructor(e,t){this.expression=e,this._warningHistory={},this._evaluator=new Qt,this._defaultValue=t?function(e){return"color"===e.type&&(Nn(e.default)||Array.isArray(e.default))?new It(0,0,0,0):"color"===e.type?It.parse(e.default)||null:void 0===e.default?null:e.default}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null}evaluateWithoutErrorHandling(e,t,i,n,o,r,s,a){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=n||null,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=r,this._evaluator.featureTileCoord=s||null,this._evaluator.featureDistanceData=a||null,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,n,o,r,s,a){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n||null,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=r||null,this._evaluator.featureTileCoord=s||null,this._evaluator.featureDistanceData=a||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new Vt(`Expected value to be one of ${Object.keys(this._enumValues).map((e=>JSON.stringify(e))).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(e.message)),this._defaultValue}}}function Xn(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in zn}function Yn(e,t){const i=new Ci(zn,[],t?function(e){const t={color:ht,string:ut,number:ct,enum:ut,boolean:dt,formatted:gt,resolvedImage:_t};return"array"===e.type?yt(t[e.value]||mt,e.length):t[e.type]}(t):void 0),n=i.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return n?Pn(new Wn(n,t)):On(i.errors)}class Kn{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!vi(t.expression)}evaluateWithoutErrorHandling(e,t,i,n,o,r){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,n,o,r)}evaluate(e,t,i,n,o,r){return this._styleExpression.evaluate(e,t,i,n,o,r)}}class Qn{constructor(e,t,i,n){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent="camera"!==e&&!vi(t.expression),this.interpolationType=n}evaluateWithoutErrorHandling(e,t,i,n,o,r){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,n,o,r)}evaluate(e,t,i,n,o,r){return this._styleExpression.evaluate(e,t,i,n,o,r)}interpolationFactor(e,t,i){return this.interpolationType?Ji.interpolationFactor(this.interpolationType,e,t,i):0}}function Jn(e,t){if("error"===(e=Yn(e,t)).result)return e;const i=e.value.expression,n=xi(i);if(!n&&!Bn(t))return On([new rt("","data expressions not supported")]);const o=wi(i,["zoom","pitch","distance-from-center"]);if(!o&&!jn(t))return On([new rt("","zoom expressions not supported")]);const r=to(i);return r||o?r instanceof rt?On([r]):r instanceof Ji&&!Rn(t)?On([new rt("",'"interpolate" expressions cannot be used with this property')]):Pn(r?new Qn(n?"camera":"composite",e.value,r.labels,r instanceof Ji?r.interpolation:void 0):new Kn(n?"constant":"source",e.value)):On([new rt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class eo{constructor(e,t){this._parameters=e,this._specification=t,tt(this,Vn(this._parameters,this._specification))}static deserialize(e){return new eo(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function to(e){let t=null;if(e instanceof on)t=to(e.result);else if(e instanceof tn){for(const i of e.args)if(t=to(i),t)break}else(e instanceof Ai||e instanceof Ji)&&e.input instanceof ei&&"zoom"===e.input.name&&(t=e);return t instanceof rt||e.eachChild((e=>{const i=to(e);i instanceof rt?t=i:!t&&i?t=new rt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new rt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}class io{constructor(e,t,i,n){this.message=(e?`${e}: `:"")+i,n&&(this.identifier=n),null!=t&&t.__line__&&(this.line=t.__line__)}}function no(e){const t=e.key,i=e.value,n=e.valueSpec||{},o=e.objectElementValidators||{},r=e.style,s=e.styleSpec;let a=[];const l=Fn(i);if("object"!==l)return[new io(t,i,`object expected, ${l} found`)];for(const e in i){const l=e.split(".")[0];let c;o[l]?c=o[l]:n[l]?c=Ro:o["*"]?c=o["*"]:n["*"]&&(c=Ro),c?a=a.concat(c({key:(t?`${t}.`:t)+e,value:i[e],valueSpec:n[l]||n["*"],style:r,styleSpec:s,object:i,objectKey:e},i)):a.push(new io(t,i[e],`unknown property "${e}"`))}for(const e in n)o[e]||n[e].required&&void 0===n[e].default&&void 0===i[e]&&a.push(new io(t,i,`missing required property "${e}"`));return a}function oo(e){const t=e.value,i=e.valueSpec,n=e.style,o=e.styleSpec,r=e.key,s=e.arrayElementValidator||Ro;if("array"!==Fn(t))return[new io(r,t,`array expected, ${Fn(t)} found`)];if(i.length&&t.length!==i.length)return[new io(r,t,`array length ${i.length} expected, length ${t.length} found`)];if(i["min-length"]&&t.lengtho)return[new io(t,i,`${i} is greater than the maximum value ${o}`)]}return[]}function so(e){const t=e.valueSpec,i=it(e.value.type);let n,o,r,s={};const a="categorical"!==i&&void 0===e.value.property,l=!a,c="array"===Fn(e.value.stops)&&"array"===Fn(e.value.stops[0])&&"object"===Fn(e.value.stops[0][0]),u=no({key:e.key,value:e.value,valueSpec:e.styleSpec.function,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===i)return[new io(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const n=e.value;return t=t.concat(oo({key:e.key,value:n,valueSpec:e.valueSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:d})),"array"===Fn(n)&&0===n.length&&t.push(new io(e.key,n,"array must have at least one stop")),t},default:function(e){return Ro({key:e.key,value:e.value,valueSpec:t,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===i&&a&&u.push(new io(e.key,e.value,'missing required property "property"')),"identity"===i||e.value.stops||u.push(new io(e.key,e.value,'missing required property "stops"')),"exponential"===i&&e.valueSpec.expression&&!Rn(e.valueSpec)&&u.push(new io(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Bn(e.valueSpec)?u.push(new io(e.key,e.value,"property functions not supported")):a&&!jn(e.valueSpec)&&u.push(new io(e.key,e.value,"zoom functions not supported"))),"categorical"!==i&&!c||void 0!==e.value.property||u.push(new io(e.key,e.value,'"property" property is required')),u;function d(e){let i=[];const n=e.value,a=e.key;if("array"!==Fn(n))return[new io(a,n,`array expected, ${Fn(n)} found`)];if(2!==n.length)return[new io(a,n,`array length 2 expected, length ${n.length} found`)];if(c){if("object"!==Fn(n[0]))return[new io(a,n,`object expected, ${Fn(n[0])} found`)];if(void 0===n[0].zoom)return[new io(a,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new io(a,n,"object stop key must have value")];const t=it(n[0].zoom);if("number"!=typeof t)return[new io(a,n[0].zoom,"stop zoom values must be numbers")];if(r&&r>t)return[new io(a,n[0].zoom,"stop zoom values must appear in ascending order")];t!==r&&(r=t,o=void 0,s={}),i=i.concat(no({key:`${a}[0]`,value:n[0],valueSpec:{zoom:{}},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:ro,value:h}}))}else i=i.concat(h({key:`${a}[0]`,value:n[0],valueSpec:{},style:e.style,styleSpec:e.styleSpec},n));return Xn(nt(n[1]))?i.concat([new io(`${a}[1]`,n[1],"expressions are not allowed in function stops.")]):i.concat(Ro({key:`${a}[1]`,value:n[1],valueSpec:t,style:e.style,styleSpec:e.styleSpec}))}function h(e,r){const a=Fn(e.value),l=it(e.value),c=null!==e.value?e.value:r;if(n){if(a!==n)return[new io(e.key,c,`${a} stop domain type must match previous stop domain type ${n}`)]}else n=a;if("number"!==a&&"string"!==a&&"boolean"!==a&&"number"!=typeof l&&"string"!=typeof l&&"boolean"!=typeof l)return[new io(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==i){let n=`number expected, ${a} found`;return Bn(t)&&void 0===i&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new io(e.key,c,n)]}return"categorical"!==i||"number"!==a||"number"==typeof l&&isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===a&&"number"==typeof l&&"number"==typeof o&&void 0!==o&&lnew io(`${e.key}${t.key}`,e.value,t.message)));const i=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!i.outputDefined())return[new io(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!vi(i))return[new io(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext)return lo(i,e);if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!wi(i,["zoom","feature-state"]))return[new io(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!xi(i))return[new io(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function lo(e,t){const i=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const e of t.valueSpec.expression.parameters)i.delete(e);if(0===i.size)return[];const n=[];return e instanceof ei&&i.has(e.name)?[new io(t.key,t.value,`["${e.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)]:(e.eachChild((e=>{n.push(...lo(e,t))})),n)}function co(e){const t=e.key,i=e.value,n=e.valueSpec,o=[];return Array.isArray(n.values)?-1===n.values.indexOf(it(i))&&o.push(new io(t,i,`expected one of [${n.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(n.values).indexOf(it(i))&&o.push(new io(t,i,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(i)} found`)),o}function uo(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!uo(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}function ho(e,t="fill"){if(null==e)return{filter:()=>!0,needGeometry:!1,needFeature:!1};uo(e)||(e=bo(e));const i=e;let n=!0;try{n=function(e){if(!fo(e))return e;let t=nt(e);return mo(t),t=po(t),t}(i)}catch(e){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n${JSON.stringify(i,null,2)}\n `)}const o=et[`filter_${t}`],r=Yn(n,o);let s=null;if("error"===r.result)throw new Error(r.value.map((e=>`${e.key}: ${e.message}`)).join(", "));s=(e,t,i)=>r.value.evaluate(e,t,{},i);let a=null,l=null;if(n!==i){const e=Yn(i,o);if("error"===e.result)throw new Error(e.value.map((e=>`${e.key}: ${e.message}`)).join(", "));a=(t,i,n,o,r)=>e.value.evaluate(t,i,{},n,void 0,void 0,o,r),l=!xi(e.value.expression)}return{filter:s,dynamicFilter:a||void 0,needGeometry:yo(n),needFeature:!!l}}function po(e){if(!Array.isArray(e))return e;const t=function(e){if(go.has(e[0]))for(let t=1;tpo(e)))}function mo(e){let t=!1;const i=[];if("case"===e[0]){for(let n=1;n",">=","<","<=","to-boolean"]);function _o(e,t){return et?1:0}function yo(e){if(!Array.isArray(e))return!1;if("within"===e[0])return!0;for(let t=1;t"===t||"<="===t||">="===t?xo(e[1],e[2],t):"any"===t?(i=e.slice(1),["any"].concat(i.map(bo))):"all"===t?["all"].concat(e.slice(1).map(bo)):"none"===t?["all"].concat(e.slice(1).map(bo).map(Eo)):"in"===t?vo(e[1],e.slice(2)):"!in"===t?Eo(vo(e[1],e.slice(2))):"has"===t?wo(e[1]):"!has"===t?Eo(wo(e[1])):"within"!==t||e;var i}function xo(e,t,i){switch(e){case"$type":return[`filter-type-${i}`,t];case"$id":return[`filter-id-${i}`,t];default:return[`filter-${i}`,e,t]}}function vo(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((e=>typeof e!=typeof t[0]))?["filter-in-large",e,["literal",t.sort(_o)]]:["filter-in-small",e,["literal",t]]}}function wo(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Eo(e){return["!",e]}function Mo(e){return uo(nt(e.value))?ao(tt({},e,{expressionContext:"filter",valueSpec:e.styleSpec[`filter_${e.layerType||"fill"}`]})):To(e)}function To(e){const t=e.value,i=e.key;if("array"!==Fn(t))return[new io(i,t,`array expected, ${Fn(t)} found`)];const n=e.styleSpec;let o,r=[];if(t.length<1)return[new io(i,t,"filter array must have at least 1 element")];switch(r=r.concat(co({key:`${i}[0]`,value:t[0],valueSpec:n.filter_operator,style:e.style,styleSpec:e.styleSpec})),it(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===it(t[1])&&r.push(new io(i,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":3!==t.length&&r.push(new io(i,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(o=Fn(t[1]),"string"!==o&&r.push(new io(`${i}[1]`,t[1],`string expected, ${o} found`)));for(let s=2;s{e in i&&t.push(new io(n,i[e],`"${e}" is prohibited for ref layers`))})),o.layers.forEach((t=>{it(t.id)===a&&(e=t)})),e?e.ref?t.push(new io(n,i.ref,"ref cannot reference another ref layer")):s=it(e.type):"string"==typeof a&&t.push(new io(n,i.ref,`ref layer "${a}" not found`))}else if("background"!==s&&"sky"!==s)if(i.source){const e=o.sources&&o.sources[i.source],r=e&&it(e.type);e?"vector"===r&&"raster"===s?t.push(new io(n,i.source,`layer "${i.id}" requires a raster source`)):"raster"===r&&"raster"!==s?t.push(new io(n,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==r||i["source-layer"]?"raster-dem"===r&&"hillshade"!==s?t.push(new io(n,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==s||!i.paint||!i.paint["line-gradient"]&&!i.paint["line-trim-offset"]||"geojson"===r&&e.lineMetrics||t.push(new io(n,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new io(n,i,`layer "${i.id}" must specify a "source-layer"`)):t.push(new io(n,i.source,`source "${i.source}" not found`))}else t.push(new io(n,i,'missing required property "source"'));return t=t.concat(no({key:n,value:i,valueSpec:r.layer,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Ro({key:`${n}.type`,value:i.type,valueSpec:r.layer.type,style:e.style,styleSpec:e.styleSpec,object:i,objectKey:"type"}),filter:e=>Mo(tt({layerType:s},e)),layout:e=>no({layer:i,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":e=>So(tt({layerType:s},e))}}),paint:e=>no({layer:i,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":e=>ko(tt({layerType:s},e))}})}})),t}function Ao(e){const t=e.value,i=e.key,n=Fn(t);return"string"!==n?[new io(i,t,`string expected, ${n} found`)]:[]}const Io={promoteId:function({key:e,value:t}){if("string"===Fn(t))return Ao({key:e,value:t});{const i=[];for(const n in t)i.push(...Ao({key:`${e}.${n}`,value:t[n]}));return i}}};function Do(e){const t=e.value,i=e.key,n=e.styleSpec,o=e.style;if(!t.type)return[new io(i,t,'"type" is required')];const r=it(t.type);let s;switch(r){case"vector":case"raster":case"raster-dem":return s=no({key:i,value:t,valueSpec:n[`source_${r.replace("-","_")}`],style:e.style,styleSpec:n,objectElementValidators:Io}),s;case"geojson":if(s=no({key:i,value:t,valueSpec:n.source_geojson,style:o,styleSpec:n,objectElementValidators:Io}),t.cluster)for(const e in t.clusterProperties){const[n,o]=t.clusterProperties[e],r="string"==typeof n?[n,["accumulated"],["get",e]]:n;s.push(...ao({key:`${i}.${e}.map`,value:o,expressionContext:"cluster-map"})),s.push(...ao({key:`${i}.${e}.reduce`,value:r,expressionContext:"cluster-reduce"}))}return s;case"video":return no({key:i,value:t,valueSpec:n.source_video,style:o,styleSpec:n});case"image":return no({key:i,value:t,valueSpec:n.source_image,style:o,styleSpec:n});case"canvas":return[new io(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return co({key:`${i}.type`,value:t.type,valueSpec:{values:zo(n)},style:o,styleSpec:n})}}function zo(e){return e.source.reduce(((t,i)=>{const n=e[i];return"enum"===n.type.type&&(t=t.concat(Object.keys(n.type.values))),t}),[])}function Po(e){const t=e.value,i=e.styleSpec,n=i.light,o=e.style;let r=[];const s=Fn(t);if(void 0===t)return r;if("object"!==s)return r=r.concat([new io("light",t,`object expected, ${s} found`)]),r;for(const e in t){const s=e.match(/^(.*)-transition$/);r=r.concat(s&&n[s[1]]&&n[s[1]].transition?Ro({key:e,value:t[e],valueSpec:i.transition,style:o,styleSpec:i}):n[e]?Ro({key:e,value:t[e],valueSpec:n[e],style:o,styleSpec:i}):[new io(e,t[e],`unknown property "${e}"`)])}return r}function Oo(e){const t=e.value,i=e.key,n=e.style,o=e.styleSpec,r=o.terrain;let s=[];const a=Fn(t);if(void 0===t)return s;if("object"!==a)return s=s.concat([new io("terrain",t,`object expected, ${a} found`)]),s;for(const e in t){const i=e.match(/^(.*)-transition$/);s=s.concat(i&&r[i[1]]&&r[i[1]].transition?Ro({key:e,value:t[e],valueSpec:o.transition,style:n,styleSpec:o}):r[e]?Ro({key:e,value:t[e],valueSpec:r[e],style:n,styleSpec:o}):[new io(e,t[e],`unknown property "${e}"`)])}if(t.source){const e=n.sources&&n.sources[t.source],o=e&&it(e.type);e?"raster-dem"!==o&&s.push(new io(i,t.source,`terrain cannot be used with a source of type ${String(o)}, it only be used with a "raster-dem" source type`)):s.push(new io(i,t.source,`source "${t.source}" not found`))}else s.push(new io(i,t,'terrain is missing required property "source"'));return s}function Bo(e){const t=e.value,i=e.style,n=e.styleSpec,o=n.fog;let r=[];const s=Fn(t);if(void 0===t)return r;if("object"!==s)return r=r.concat([new io("fog",t,`object expected, ${s} found`)]),r;for(const e in t){const s=e.match(/^(.*)-transition$/);r=r.concat(s&&o[s[1]]&&o[s[1]].transition?Ro({key:e,value:t[e],valueSpec:n.transition,style:i,styleSpec:n}):o[e]?Ro({key:e,value:t[e],valueSpec:o[e],style:i,styleSpec:n}):[new io(e,t[e],`unknown property "${e}"`)])}return r}const jo={"*":()=>[],array:oo,boolean:function(e){const t=e.value,i=e.key,n=Fn(t);return"boolean"!==n?[new io(i,t,`boolean expected, ${n} found`)]:[]},number:ro,color:function(e){const t=e.key,i=e.value,n=Fn(i);return"string"!==n?[new io(t,i,`color expected, ${n} found`)]:null===Mt(i)?[new io(t,i,`color expected, "${i}" found`)]:[]},enum:co,filter:Mo,function:so,layer:Lo,object:no,source:Do,light:Po,terrain:Oo,fog:Bo,string:Ao,formatted:function(e){return 0===Ao(e).length?[]:ao(e)},resolvedImage:function(e){return 0===Ao(e).length?[]:ao(e)},projection:function(e){const t=e.value,i=e.styleSpec,n=i.projection,o=e.style;let r=[];const s=Fn(t);if("object"===s)for(const e in t)r=r.concat(Ro({key:e,value:t[e],valueSpec:n[e],style:o,styleSpec:i}));else"string"!==s&&(r=r.concat([new io("projection",t,`object or string expected, ${s} found`)]));return r}};function Ro(e){const t=e.value,i=e.valueSpec,n=e.styleSpec;return i.expression&&Nn(it(t))?so(e):i.expression&&Xn(nt(t))?ao(e):i.type&&jo[i.type]?jo[i.type](e):no(tt({},e,{valueSpec:i.type?n[i.type]:i}))}function Fo(e){const t=e.value,i=e.key,n=Ao(e);return n.length||(-1===t.indexOf("{fontstack}")&&n.push(new io(i,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&n.push(new io(i,t,'"glyphs" url must include a "{range}" token'))),n}function No(e,t=et){return $o(Ro({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,objectElementValidators:{glyphs:Fo,"*":()=>[]}}))}const Uo=e=>$o(ko(e)),Vo=e=>$o(So(e));function $o(e){return e.slice().sort(((e,t)=>e.line&&t.line?e.line-t.line:0))}function qo(e,t){let i=!1;if(t&&t.length)for(const n of t)e.fire(new Qe(new Error(n.message))),i=!0;return i}var Go=Ho,Zo=3;function Ho(e,t,i){var n=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;var o=new Int32Array(this.arrayBuffer);e=o[0],this.d=(t=o[1])+2*(i=o[2]);for(var r=0;r=u[p+0]&&n>=u[p+1])?(s[h]=!0,r.push(c[h])):s[h]=!1}}},Ho.prototype._forEachCell=function(e,t,i,n,o,r,s,a){for(var l=this._convertToCellCoord(e),c=this._convertToCellCoord(t),u=this._convertToCellCoord(i),d=this._convertToCellCoord(n),h=l;h<=u;h++)for(var p=c;p<=d;p++){var m=this.d*p+h;if((!a||a(this._convertFromCellCoord(h),this._convertFromCellCoord(p),this._convertFromCellCoord(h+1),this._convertFromCellCoord(p+1)))&&o.call(this,e,t,i,n,m,r,s,a))return}},Ho.prototype._convertFromCellCoord=function(e){return(e-this.padding)/this.scale},Ho.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},Ho.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var e=this.cells,t=Zo+this.cells.length+1+1,i=0,n=0;n=0||(o[t]=Jo(e[t],i)));e instanceof Error&&(o.message=e.message)}if(o.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==n&&(o.$name=n),o}throw new Error("can't serialize object of type "+typeof e)}function er(e){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||Ko(e)||Qo(e)||ArrayBuffer.isView(e)||e instanceof t.ImageData)return e;if(Array.isArray(e))return e.map(er);if("object"==typeof e){const t=e.$name||"Object",{klass:i}=Xo[t];if(!i)throw new Error(`can't deserialize unregistered class ${t}`);if(i.deserialize)return i.deserialize(e);const n=Object.create(i.prototype);for(const t of Object.keys(e))"$name"!==t&&(n[t]=er(e[t]));return n}throw new Error("can't deserialize object of type "+typeof e)}const tr={"Latin-1 Supplement":e=>e>=128&&e<=255,Arabic:e=>e>=1536&&e<=1791,"Arabic Supplement":e=>e>=1872&&e<=1919,"Arabic Extended-A":e=>e>=2208&&e<=2303,"Hangul Jamo":e=>e>=4352&&e<=4607,"Unified Canadian Aboriginal Syllabics":e=>e>=5120&&e<=5759,Khmer:e=>e>=6016&&e<=6143,"Unified Canadian Aboriginal Syllabics Extended":e=>e>=6320&&e<=6399,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"CJK Radicals Supplement":e=>e>=11904&&e<=12031,"Kangxi Radicals":e=>e>=12032&&e<=12255,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Bopomofo:e=>e>=12544&&e<=12591,"Hangul Compatibility Jamo":e=>e>=12592&&e<=12687,Kanbun:e=>e>=12688&&e<=12703,"Bopomofo Extended":e=>e>=12704&&e<=12735,"CJK Strokes":e=>e>=12736&&e<=12783,"Katakana Phonetic Extensions":e=>e>=12784&&e<=12799,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"CJK Unified Ideographs Extension A":e=>e>=13312&&e<=19903,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Yi Syllables":e=>e>=40960&&e<=42127,"Yi Radicals":e=>e>=42128&&e<=42191,"Hangul Jamo Extended-A":e=>e>=43360&&e<=43391,"Hangul Syllables":e=>e>=44032&&e<=55215,"Hangul Jamo Extended-B":e=>e>=55216&&e<=55295,"Private Use Area":e=>e>=57344&&e<=63743,"CJK Compatibility Ideographs":e=>e>=63744&&e<=64255,"Arabic Presentation Forms-A":e=>e>=64336&&e<=65023,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Arabic Presentation Forms-B":e=>e>=65136&&e<=65279,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519};function ir(e){for(const t of e)if(rr(t.charCodeAt(0)))return!0;return!1}function nr(e){for(const t of e)if(!or(t.charCodeAt(0)))return!1;return!0}function or(e){return!(tr.Arabic(e)||tr["Arabic Supplement"](e)||tr["Arabic Extended-A"](e)||tr["Arabic Presentation Forms-A"](e)||tr["Arabic Presentation Forms-B"](e))}function rr(e){return!(746!==e&&747!==e&&(e<4352||!(tr["Bopomofo Extended"](e)||tr.Bopomofo(e)||tr["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||tr["CJK Compatibility Ideographs"](e)||tr["CJK Compatibility"](e)||tr["CJK Radicals Supplement"](e)||tr["CJK Strokes"](e)||!(!tr["CJK Symbols and Punctuation"](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||tr["CJK Unified Ideographs Extension A"](e)||tr["CJK Unified Ideographs"](e)||tr["Enclosed CJK Letters and Months"](e)||tr["Hangul Compatibility Jamo"](e)||tr["Hangul Jamo Extended-A"](e)||tr["Hangul Jamo Extended-B"](e)||tr["Hangul Jamo"](e)||tr["Hangul Syllables"](e)||tr.Hiragana(e)||tr["Ideographic Description Characters"](e)||tr.Kanbun(e)||tr["Kangxi Radicals"](e)||tr["Katakana Phonetic Extensions"](e)||tr.Katakana(e)&&12540!==e||!(!tr["Halfwidth and Fullwidth Forms"](e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!tr["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||tr["Unified Canadian Aboriginal Syllabics"](e)||tr["Unified Canadian Aboriginal Syllabics Extended"](e)||tr["Vertical Forms"](e)||tr["Yijing Hexagram Symbols"](e)||tr["Yi Syllables"](e)||tr["Yi Radicals"](e))))}function sr(e){return!(rr(e)||function(e){return!!(tr["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||tr["General Punctuation"](e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||tr["Letterlike Symbols"](e)||tr["Number Forms"](e)||tr["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||tr["Control Pictures"](e)&&9251!==e||tr["Optical Character Recognition"](e)||tr["Enclosed Alphanumerics"](e)||tr["Geometric Shapes"](e)||tr["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||tr["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||tr["CJK Symbols and Punctuation"](e)||tr.Katakana(e)||tr["Private Use Area"](e)||tr["CJK Compatibility Forms"](e)||tr["Small Form Variants"](e)||tr["Halfwidth and Fullwidth Forms"](e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}(e))}function ar(e){return e>=1424&&e<=2303||tr["Arabic Presentation Forms-A"](e)||tr["Arabic Presentation Forms-B"](e)}function lr(e,t){return!(!t&&ar(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||tr.Khmer(e))}function cr(e){for(const t of e)if(ar(t.charCodeAt(0)))return!0;return!1}const ur="deferred",dr="loading",hr="loaded";let pr=null,mr="unavailable",fr=null;const gr=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(mr="error"),pr&&pr(e)};function _r(){yr.fire(new Ke("pluginStateChange",{pluginStatus:mr,pluginURL:fr}))}const yr=new Je,br=function(){return mr},xr=function(){if(mr!==ur||!fr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");mr=dr,_r(),fr&&he({url:fr},(e=>{e?gr(e):(mr=hr,_r())}))},vr={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>mr===hr||null!=vr.applyArabicShaping,isLoading:()=>mr===dr,setState(e){mr=e.pluginStatus,fr=e.pluginURL},isParsed:()=>null!=vr.applyArabicShaping&&null!=vr.processBidirectionalText&&null!=vr.processStyledBidirectionalText,getPluginURL:()=>fr};class wr{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.transition=t.transition,this.pitch=t.pitch):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0)}isSupportedScript(e){return function(e,t){for(const i of e)if(!lr(i.charCodeAt(0),t))return!1;return!0}(e,vr.isLoaded())}}class Er{constructor(e,t){this.property=e,this.value=t,this.expression=function(e,t){if(Nn(e))return new eo(e,t);if(Xn(e)){const i=Jn(e,t);if("error"===i.result)throw new Error(i.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return i.value}{let i=e;return"string"==typeof e&&"color"===t.type&&(i=It.parse(e)),{kind:"constant",evaluate:()=>i}}}(void 0===t?e.specification.default:t,e.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}}class Mr{constructor(e){this.property=e,this.value=new Er(e,void 0)}transitioned(e,t){return new Cr(this.property,this.value,t,D({},e.transition,this.transition),e.now)}untransitioned(){return new Cr(this.property,this.value,null,{},0)}}class Tr{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return V(this._values[e].value.value)}setValue(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new Mr(this._values[e].property)),this._values[e].value=new Er(this._values[e].property,null===t?void 0:V(t))}getTransition(e){return V(this._values[e].transition)}setTransition(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new Mr(this._values[e].property)),this._values[e].transition=V(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const i=this.getValue(t);void 0!==i&&(e[t]=i);const n=this.getTransition(t);void 0!==n&&(e[`${t}-transition`]=n)}return e}transitioned(e,t){const i=new kr(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].transitioned(e,t._values[n]);return i}untransitioned(){const e=new kr(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class Cr{constructor(e,t,i,n,o){const r=n.delay||0,s=n.duration||0;o=o||0,this.property=e,this.value=t,this.begin=o+r,this.end=this.begin+s,e.specification.transition&&(n.delay||n.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){const n=e.now||0,o=this.value.possiblyEvaluate(e,t,i),r=this.prior;if(r){if(n>this.end)return this.prior=null,o;if(this.value.isDataDriven())return this.prior=null,o;if(nthis.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function Fr(e,t=1){let i=0,n=0;return{members:e.map((e=>{const o=Br[e.type].BYTES_PER_ELEMENT,r=i=Nr(i,Math.max(t,o)),s=e.components||1;return n=Math.max(n,o),i+=o*s,{name:e.name,type:e.type,components:s,offset:r}})),size:Nr(i,Math.max(n,t)),alignment:t}}function Nr(e,t){return Math.ceil(e/t)*t}class Ur extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const n=2*e;return this.int16[n+0]=t,this.int16[n+1]=i,e}}Ur.prototype.bytesPerElement=4,Yo(Ur,"StructArrayLayout2i4");class Vr extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){const o=3*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=n,e}}Vr.prototype.bytesPerElement=6,Yo(Vr,"StructArrayLayout3i6");class $r extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n)}emplace(e,t,i,n,o){const r=4*e;return this.int16[r+0]=t,this.int16[r+1]=i,this.int16[r+2]=n,this.int16[r+3]=o,e}}$r.prototype.bytesPerElement=8,Yo($r,"StructArrayLayout4i8");class qr extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,r,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,n,o,r,s)}emplace(e,t,i,n,o,r,s,a){const l=6*e,c=12*e,u=3*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.uint8[c+4]=n,this.uint8[c+5]=o,this.uint8[c+6]=r,this.uint8[c+7]=s,this.float32[u+2]=a,e}}qr.prototype.bytesPerElement=12,Yo(qr,"StructArrayLayout2i4ub1f12");class Gr extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n)}emplace(e,t,i,n,o){const r=4*e;return this.float32[r+0]=t,this.float32[r+1]=i,this.float32[r+2]=n,this.float32[r+3]=o,e}}Gr.prototype.bytesPerElement=16,Yo(Gr,"StructArrayLayout4f16");class Zr extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i,n,o)}emplace(e,t,i,n,o,r){const s=6*e,a=3*e;return this.uint16[s+0]=t,this.uint16[s+1]=i,this.uint16[s+2]=n,this.uint16[s+3]=o,this.float32[a+2]=r,e}}Zr.prototype.bytesPerElement=12,Yo(Zr,"StructArrayLayout4ui1f12");class Hr extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n)}emplace(e,t,i,n,o){const r=4*e;return this.uint16[r+0]=t,this.uint16[r+1]=i,this.uint16[r+2]=n,this.uint16[r+3]=o,e}}Hr.prototype.bytesPerElement=8,Yo(Hr,"StructArrayLayout4ui8");class Wr extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,n,o,r)}emplace(e,t,i,n,o,r,s){const a=6*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=n,this.int16[a+3]=o,this.int16[a+4]=r,this.int16[a+5]=s,e}}Wr.prototype.bytesPerElement=12,Yo(Wr,"StructArrayLayout6i12");class Xr extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,r,s,a,l,c,u,d){const h=this.length;return this.resize(h+1),this.emplace(h,e,t,i,n,o,r,s,a,l,c,u,d)}emplace(e,t,i,n,o,r,s,a,l,c,u,d,h){const p=12*e;return this.int16[p+0]=t,this.int16[p+1]=i,this.int16[p+2]=n,this.int16[p+3]=o,this.uint16[p+4]=r,this.uint16[p+5]=s,this.uint16[p+6]=a,this.uint16[p+7]=l,this.int16[p+8]=c,this.int16[p+9]=u,this.int16[p+10]=d,this.int16[p+11]=h,e}}Xr.prototype.bytesPerElement=24,Yo(Xr,"StructArrayLayout4i4ui4i24");class Yr extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,n,o,r)}emplace(e,t,i,n,o,r,s){const a=10*e,l=5*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=n,this.float32[l+2]=o,this.float32[l+3]=r,this.float32[l+4]=s,e}}Yr.prototype.bytesPerElement=20,Yo(Yr,"StructArrayLayout3i3f20");class Kr extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}Kr.prototype.bytesPerElement=4,Yo(Kr,"StructArrayLayout1ul4");class Qr extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,r,s,a,l,c,u,d,h){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,i,n,o,r,s,a,l,c,u,d,h)}emplace(e,t,i,n,o,r,s,a,l,c,u,d,h,p){const m=20*e,f=10*e;return this.int16[m+0]=t,this.int16[m+1]=i,this.int16[m+2]=n,this.int16[m+3]=o,this.int16[m+4]=r,this.float32[f+3]=s,this.float32[f+4]=a,this.float32[f+5]=l,this.float32[f+6]=c,this.int16[m+14]=u,this.uint32[f+8]=d,this.uint16[m+18]=h,this.uint16[m+19]=p,e}}Qr.prototype.bytesPerElement=40,Yo(Qr,"StructArrayLayout5i4f1i1ul2ui40");class Jr extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,r,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,n,o,r,s)}emplace(e,t,i,n,o,r,s,a){const l=8*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.int16[l+2]=n,this.int16[l+4]=o,this.int16[l+5]=r,this.int16[l+6]=s,this.int16[l+7]=a,e}}Jr.prototype.bytesPerElement=16,Yo(Jr,"StructArrayLayout3i2i2i16");class es extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i,n,o)}emplace(e,t,i,n,o,r){const s=4*e,a=8*e;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=n,this.int16[a+6]=o,this.int16[a+7]=r,e}}es.prototype.bytesPerElement=16,Yo(es,"StructArrayLayout2f1f2i16");class ts extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n)}emplace(e,t,i,n,o){const r=12*e,s=3*e;return this.uint8[r+0]=t,this.uint8[r+1]=i,this.float32[s+1]=n,this.float32[s+2]=o,e}}ts.prototype.bytesPerElement=12,Yo(ts,"StructArrayLayout2ub2f12");class is extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){const o=3*e;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=n,e}}is.prototype.bytesPerElement=12,Yo(is,"StructArrayLayout3f12");class ns extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){const o=3*e;return this.uint16[o+0]=t,this.uint16[o+1]=i,this.uint16[o+2]=n,e}}ns.prototype.bytesPerElement=6,Yo(ns,"StructArrayLayout3ui6");class os extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,r,s,a,l,c,u,d,h,p,m,f,g,_,y,b,x){const v=this.length;return this.resize(v+1),this.emplace(v,e,t,i,n,o,r,s,a,l,c,u,d,h,p,m,f,g,_,y,b,x)}emplace(e,t,i,n,o,r,s,a,l,c,u,d,h,p,m,f,g,_,y,b,x,v){const w=30*e,E=15*e,M=60*e;return this.int16[w+0]=t,this.int16[w+1]=i,this.int16[w+2]=n,this.float32[E+2]=o,this.float32[E+3]=r,this.uint16[w+8]=s,this.uint16[w+9]=a,this.uint32[E+5]=l,this.uint32[E+6]=c,this.uint32[E+7]=u,this.uint16[w+16]=d,this.uint16[w+17]=h,this.uint16[w+18]=p,this.float32[E+10]=m,this.float32[E+11]=f,this.uint8[M+48]=g,this.uint8[M+49]=_,this.uint8[M+50]=y,this.uint32[E+13]=b,this.int16[w+28]=x,this.uint8[M+58]=v,e}}os.prototype.bytesPerElement=60,Yo(os,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class rs extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,r,s,a,l,c,u,d,h,p,m,f,g,_,y,b,x,v,w,E,M,T,C,k,S,L){const A=this.length;return this.resize(A+1),this.emplace(A,e,t,i,n,o,r,s,a,l,c,u,d,h,p,m,f,g,_,y,b,x,v,w,E,M,T,C,k,S,L)}emplace(e,t,i,n,o,r,s,a,l,c,u,d,h,p,m,f,g,_,y,b,x,v,w,E,M,T,C,k,S,L,A){const I=38*e,D=19*e;return this.int16[I+0]=t,this.int16[I+1]=i,this.int16[I+2]=n,this.float32[D+2]=o,this.float32[D+3]=r,this.int16[I+8]=s,this.int16[I+9]=a,this.int16[I+10]=l,this.int16[I+11]=c,this.int16[I+12]=u,this.int16[I+13]=d,this.uint16[I+14]=h,this.uint16[I+15]=p,this.uint16[I+16]=m,this.uint16[I+17]=f,this.uint16[I+18]=g,this.uint16[I+19]=_,this.uint16[I+20]=y,this.uint16[I+21]=b,this.uint16[I+22]=x,this.uint16[I+23]=v,this.uint16[I+24]=w,this.uint16[I+25]=E,this.uint16[I+26]=M,this.uint16[I+27]=T,this.uint16[I+28]=C,this.uint32[D+15]=k,this.float32[D+16]=S,this.float32[D+17]=L,this.float32[D+18]=A,e}}rs.prototype.bytesPerElement=76,Yo(rs,"StructArrayLayout3i2f6i15ui1ul3f76");class ss extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}ss.prototype.bytesPerElement=4,Yo(ss,"StructArrayLayout1f4");class as extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i,n,o)}emplace(e,t,i,n,o,r){const s=5*e;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=n,this.float32[s+3]=o,this.float32[s+4]=r,e}}as.prototype.bytesPerElement=20,Yo(as,"StructArrayLayout5f20");class ls extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n)}emplace(e,t,i,n,o){const r=6*e;return this.uint32[3*e+0]=t,this.uint16[r+2]=i,this.uint16[r+3]=n,this.uint16[r+4]=o,e}}ls.prototype.bytesPerElement=12,Yo(ls,"StructArrayLayout1ul3ui12");class cs extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const n=2*e;return this.uint16[n+0]=t,this.uint16[n+1]=i,e}}cs.prototype.bytesPerElement=4,Yo(cs,"StructArrayLayout2ui4");class us extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}us.prototype.bytesPerElement=2,Yo(us,"StructArrayLayout1ui2");class ds extends Rr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const n=2*e;return this.float32[n+0]=t,this.float32[n+1]=i,e}}ds.prototype.bytesPerElement=8,Yo(ds,"StructArrayLayout2f8");class hs extends jr{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}hs.prototype.size=40;class ps extends Qr{get(e){return new hs(this,e)}}Yo(ps,"CollisionBoxArray");class ms extends jr{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}ms.prototype.size=60;class fs extends os{get(e){return new ms(this,e)}}Yo(fs,"PlacedSymbolArray");class gs extends jr{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+11]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+13]}get key(){return this._structArray.uint16[this._pos2+14]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+17]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+19]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+21]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+22]}get featureIndex(){return this._structArray.uint16[this._pos2+23]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+25]}get numIconVertices(){return this._structArray.uint16[this._pos2+26]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+27]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+28]}get crossTileID(){return this._structArray.uint32[this._pos4+15]}set crossTileID(e){this._structArray.uint32[this._pos4+15]=e}get textOffset0(){return this._structArray.float32[this._pos4+16]}get textOffset1(){return this._structArray.float32[this._pos4+17]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+18]}}gs.prototype.size=76;class _s extends rs{get(e){return new gs(this,e)}}Yo(_s,"SymbolInstanceArray");class ys extends ss{getoffsetX(e){return this.float32[1*e+0]}}Yo(ys,"GlyphOffsetArray");class bs extends Ur{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}Yo(bs,"SymbolLineVertexArray");class xs extends jr{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}xs.prototype.size=12;class vs extends ls{get(e){return new xs(this,e)}}Yo(vs,"FeatureIndexArray");class ws extends cs{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}Yo(ws,"FillExtrusionCentroidArray");const Es=Fr([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Ms=Fr([{name:"a_dash",components:4,type:"Uint16"}]);var Ts={exports:{}},Cs=function(e,t){var i,n,o,r,s,a,l,c;for(n=e.length-(i=3&e.length),o=t,s=3432918353,a=461845907,c=0;c>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)&4294967295))+((58964+(r>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&e.charCodeAt(c+2))<<16;case 2:l^=(255&e.charCodeAt(c+1))<<8;case 1:o^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(c)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return o^=e.length,o=2246822507*(65535&(o^=o>>>16))+((2246822507*(o>>>16)&65535)<<16)&4294967295,o=3266489909*(65535&(o^=o>>>13))+((3266489909*(o>>>16)&65535)<<16)&4294967295,(o^=o>>>16)>>>0},ks=function(e,t){for(var i,n=e.length,o=t^n,r=0;n>=4;)i=1540483477*(65535&(i=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+((1540483477*(i>>>16)&65535)<<16),o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),n-=4,++r;switch(n){case 3:o^=(255&e.charCodeAt(r+2))<<16;case 2:o^=(255&e.charCodeAt(r+1))<<8;case 1:o=1540483477*(65535&(o^=255&e.charCodeAt(r)))+((1540483477*(o>>>16)&65535)<<16)}return o=1540483477*(65535&(o^=o>>>13))+((1540483477*(o>>>16)&65535)<<16),(o^=o>>>15)>>>0};Ts.exports=Cs,Ts.exports.murmur3=Cs,Ts.exports.murmur2=ks;var Ss=h(Ts.exports);class Ls{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,i,n){this.ids.push(As(e)),this.positions.push(t,i,n)}getPositions(e){const t=As(e);let i=0,n=this.ids.length-1;for(;i>1;this.ids[e]>=t?n=e:i=e+1}const o=[];for(;this.ids[i]===t;)o.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return o}static serialize(e,t){const i=new Float64Array(e.ids),n=new Uint32Array(e.positions);return Is(i,n,0,i.length-1),t&&t.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(e){const t=new Ls;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function As(e){const t=+e;return!isNaN(t)&&Number.MIN_SAFE_INTEGER<=t&&t<=Number.MAX_SAFE_INTEGER?t:Ss(String(e))}function Is(e,t,i,n){for(;i>1];let r=i-1,s=n+1;for(;;){do{r++}while(e[r]o);if(r>=s)break;Ds(e,r,s),Ds(t,3*r,3*s),Ds(t,3*r+1,3*s+1),Ds(t,3*r+2,3*s+2)}s-i`u_${e}`)),this.type=i}setUniform(e,t,i,n,o){t.set(e,o,n.constantOr(this.value))}getBinding(e,t){return"color"===this.type?new Bs(e):new Ps(e)}}class Vs{constructor(e,t){this.uniformNames=t.map((e=>`u_${e}`)),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(e){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br)}setUniform(e,t,i,n,o){const r="u_pattern"===o||"u_dash"===o?this.pattern:"u_pixel_ratio"===o?this.pixelRatio:null;r&&t.set(e,o,r)}getBinding(e,t){return"u_pattern"===t||"u_dash"===t?new Os(e):new Ps(e)}}class $s{constructor(e,t,i,n){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===i?2:1,offset:0}))),this.paintVertexArray=new n}populatePaintArray(e,t,i,n,o,r){const s=this.paintVertexArray.length,a=this.expression.evaluate(new wr(0),t,{},o,n,r);this.paintVertexArray.resize(e),this._setPaintValue(s,e,a)}updatePaintArray(e,t,i,n,o){const r=this.expression.evaluate({zoom:0},i,n,void 0,o);this._setPaintValue(e,t,r)}_setPaintValue(e,t,i){if("color"===this.type){const n=Ns(i);for(let i=e;i`u_${e}_t`)),this.type=i,this.useIntegerZoom=n,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===i?4:2,offset:0}))),this.paintVertexArray=new r}populatePaintArray(e,t,i,n,o,r){const s=this.expression.evaluate(new wr(this.zoom),t,{},o,n,r),a=this.expression.evaluate(new wr(this.zoom+1),t,{},o,n,r),l=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(l,e,s,a)}updatePaintArray(e,t,i,n,o){const r=this.expression.evaluate({zoom:this.zoom},i,n,void 0,o),s=this.expression.evaluate({zoom:this.zoom+1},i,n,void 0,o);this._setPaintValue(e,t,r,s)}_setPaintValue(e,t,i,n){if("color"===this.type){const o=Ns(i),r=Ns(n);for(let i=e;i!0){this.binders={},this._buffers=[];const n=[];for(const o in e.paint._values){if(!i(o))continue;const r=e.paint.get(o);if(!(r instanceof Lr&&Bn(r.property.specification)))continue;const s=Xs(o,e.type),a=r.value,l=r.property.specification.type,c=!!r.property.useIntegerZoom,u="line-dasharray"===o||o.endsWith("pattern"),d="line-dasharray"===o&&"constant"!==e.layout.get("line-cap").value.kind;if("constant"!==a.kind||d)if("source"===a.kind||d||u){const t=Qs(o,l,"source");this.binders[o]=u?new Gs(a,s,l,t,e.id):new $s(a,s,l,t),n.push(`/a_${o}`)}else{const e=Qs(o,l,"composite");this.binders[o]=new qs(a,s,l,c,t,e),n.push(`/z_${o}`)}else this.binders[o]=u?new Vs(a.value,s):new Us(a.value,s,l),n.push(`/u_${o}`)}this.cacheKey=n.sort().join("")}getMaxValue(e){const t=this.binders[e];return t instanceof $s||t instanceof qs?t.maxValue:0}populatePaintArrays(e,t,i,n,o,r){for(const s in this.binders){const a=this.binders[s];(a instanceof $s||a instanceof qs||a instanceof Gs)&&a.populatePaintArray(e,t,i,n,o,r)}}setConstantPatternPositions(e){for(const t in this.binders){const i=this.binders[t];i instanceof Vs&&i.setConstantPatternPositions(e)}}updatePaintArrays(e,t,i,n,o,r){let s=!1;for(const a in e){const l=t.getPositions(a);for(const t of l){const l=i.feature(t.index);for(const i in this.binders){const c=this.binders[i];if((c instanceof $s||c instanceof qs||c instanceof Gs)&&!0===c.expression.isStateDependent){const u=n.paint.get(i);c.expression=u.value,c.updatePaintArray(t.start,t.end,l,e[a],o,r),s=!0}}}}return s}defines(){const e=[];for(const t in this.binders){const i=this.binders[t];(i instanceof Us||i instanceof Vs)&&e.push(...i.uniformNames.map((e=>`#define HAS_UNIFORM_${e}`)))}return e}getBinderAttributes(){const e=[];for(const t in this.binders){const i=this.binders[t];if(i instanceof $s||i instanceof qs||i instanceof Gs)for(let t=0;t!0){this.programConfigurations={};for(const n of e)this.programConfigurations[n.id]=new Zs(n,t,i);this.needsUpload=!1,this._featureMap=new Ls,this._bufferOffset=0}populatePaintArrays(e,t,i,n,o,r,s){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(e,t,n,o,r,s);void 0!==t.id&&this._featureMap.add(t.id,i,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,n,o){for(const r of i)this.needsUpload=this.programConfigurations[r.id].updatePaintArrays(e,this._featureMap,t,r,n,o)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const Ws={"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","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function Xs(e,t){return Ws[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}const Ys={"line-pattern":{source:Zr,composite:Zr},"fill-pattern":{source:Zr,composite:Zr},"fill-extrusion-pattern":{source:Zr,composite:Zr},"line-dasharray":{source:Hr,composite:Hr}},Ks={color:{source:ds,composite:Gr},number:{source:ss,composite:ds}};function Qs(e,t,i){const n=Ys[e];return n&&n[i]||Ks[t][i]}Yo(Us,"ConstantBinder"),Yo(Vs,"PatternConstantBinder"),Yo($s,"SourceExpressionBinder"),Yo(Gs,"PatternCompositeBinder"),Yo(qs,"CompositeExpressionBinder"),Yo(Zs,"ProgramConfiguration",{omit:["_buffers"]}),Yo(Hs,"ProgramConfigurationSet");const Js="-transition";class ea extends Je{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&"sky"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),t.layout&&(this._unevaluatedLayout=new Sr(t.layout)),t.paint)){this._transitionablePaint=new Tr(t.paint);for(const t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(const t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ar(t.paint)}}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t,i={}){null!=t&&this._validate(Vo,`layers.${this.id}.layout.${e}`,e,t,i)||("visibility"!==e?this._unevaluatedLayout.setValue(e,t):this.visibility=t)}getPaintProperty(e){return F(e,Js)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,i={}){if(null!=t&&this._validate(Uo,`layers.${this.id}.paint.${e}`,e,t,i))return!1;if(F(e,Js))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{const i=this._transitionablePaint._values[e],n=i.value.isDataDriven(),o=i.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);const r=this._transitionablePaint._values[e].value,s=r.isDataDriven(),a=F(e,"pattern")||"line-dasharray"===e;return s||n||a||this._handleOverridablePaintPropertyUpdate(e,o,r)}}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getProgramConfiguration(e){return null}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){const e={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&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),U(e,((e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length)))}_validate(e,t,i,n,o={}){return(!o||!1!==o.validate)&&qo(this,e.call(No,{key:t,layerType:this.type,objectKey:i,value:n,styleSpec:et,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof Lr&&Bn(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=ho(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const ta=Fr([{name:"a_pos",components:2,type:"Int16"}],4),ia=Fr([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class na{constructor(e=[]){this.segments=e}prepareSegment(e,t,i,n){let o=this.segments[this.segments.length-1];return e>na.MAX_VERTEX_ARRAY_LENGTH&&q(`Max vertices per segment is ${na.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!o||o.vertexLength+e>na.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==n)&&(o={vertexOffset:t.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},void 0!==n&&(o.sortKey=n),this.segments.push(o)),o}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,i,n){return new na([{vertexOffset:e,primitiveOffset:t,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}}na.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Yo(na,"SegmentVector");var oa=8192;class ra{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof Rl?new Rl(e.lng,e.lat):Rl.convert(e),this}setSouthWest(e){return this._sw=e instanceof Rl?new Rl(e.lng,e.lat):Rl.convert(e),this}extend(e){const t=this._sw,i=this._ne;let n,o;if(e instanceof Rl)n=e,o=e;else{if(!(e instanceof ra))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(ra.convert(e)):this.extend(Rl.convert(e)):"object"==typeof e&&null!==e&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(Rl.convert(e)):this;if(n=e._sw,o=e._ne,!n||!o)return this}return t||i?(t.lng=Math.min(n.lng,t.lng),t.lat=Math.min(n.lat,t.lat),i.lng=Math.max(o.lng,i.lng),i.lat=Math.max(o.lat,i.lat)):(this._sw=new Rl(n.lng,n.lat),this._ne=new Rl(o.lng,o.lat)),this}getCenter(){return new Rl((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 Rl(this.getWest(),this.getNorth())}getSouthEast(){return new Rl(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:t,lat:i}=Rl.convert(e);let n=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=t&&t>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&n}static convert(e){return!e||e instanceof ra?e:new ra(e)}}var sa=1e-6,aa="undefined"!=typeof Float32Array?Float32Array:Array;function la(){var e=new aa(9);return aa!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function ca(e,t,i){var n=t[0],o=t[1],r=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],d=t[8],h=i[0],p=i[1],m=i[2],f=i[3],g=i[4],_=i[5],y=i[6],b=i[7],x=i[8];return e[0]=h*n+p*s+m*c,e[1]=h*o+p*a+m*u,e[2]=h*r+p*l+m*d,e[3]=f*n+g*s+_*c,e[4]=f*o+g*a+_*u,e[5]=f*r+g*l+_*d,e[6]=y*n+b*s+x*c,e[7]=y*o+b*a+x*u,e[8]=y*r+b*l+x*d,e}function ua(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function da(e,t){var i=t[0],n=t[1],o=t[2],r=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],d=t[9],h=t[10],p=t[11],m=t[12],f=t[13],g=t[14],_=t[15],y=i*a-n*s,b=i*l-o*s,x=i*c-r*s,v=n*l-o*a,w=n*c-r*a,E=o*c-r*l,M=u*f-d*m,T=u*g-h*m,C=u*_-p*m,k=d*g-h*f,S=d*_-p*f,L=h*_-p*g,A=y*L-b*S+x*k+v*C-w*T+E*M;return A?(e[0]=(a*L-l*S+c*k)*(A=1/A),e[1]=(o*S-n*L-r*k)*A,e[2]=(f*E-g*w+_*v)*A,e[3]=(h*w-d*E-p*v)*A,e[4]=(l*C-s*L-c*T)*A,e[5]=(i*L-o*C+r*T)*A,e[6]=(g*x-m*E-_*b)*A,e[7]=(u*E-h*x+p*b)*A,e[8]=(s*S-a*C+c*M)*A,e[9]=(n*C-i*S-r*M)*A,e[10]=(m*w-f*x+_*y)*A,e[11]=(d*x-u*w-p*y)*A,e[12]=(a*T-s*k-l*M)*A,e[13]=(i*k-n*T+o*M)*A,e[14]=(f*b-m*v-g*y)*A,e[15]=(u*v-d*b+h*y)*A,e):null}function ha(e,t,i){var n=t[0],o=t[1],r=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],d=t[8],h=t[9],p=t[10],m=t[11],f=t[12],g=t[13],_=t[14],y=t[15],b=i[0],x=i[1],v=i[2],w=i[3];return e[0]=b*n+x*a+v*d+w*f,e[1]=b*o+x*l+v*h+w*g,e[2]=b*r+x*c+v*p+w*_,e[3]=b*s+x*u+v*m+w*y,e[4]=(b=i[4])*n+(x=i[5])*a+(v=i[6])*d+(w=i[7])*f,e[5]=b*o+x*l+v*h+w*g,e[6]=b*r+x*c+v*p+w*_,e[7]=b*s+x*u+v*m+w*y,e[8]=(b=i[8])*n+(x=i[9])*a+(v=i[10])*d+(w=i[11])*f,e[9]=b*o+x*l+v*h+w*g,e[10]=b*r+x*c+v*p+w*_,e[11]=b*s+x*u+v*m+w*y,e[12]=(b=i[12])*n+(x=i[13])*a+(v=i[14])*d+(w=i[15])*f,e[13]=b*o+x*l+v*h+w*g,e[14]=b*r+x*c+v*p+w*_,e[15]=b*s+x*u+v*m+w*y,e}function pa(e,t,i){var n,o,r,s,a,l,c,u,d,h,p,m,f=i[0],g=i[1],_=i[2];return t===e?(e[12]=t[0]*f+t[4]*g+t[8]*_+t[12],e[13]=t[1]*f+t[5]*g+t[9]*_+t[13],e[14]=t[2]*f+t[6]*g+t[10]*_+t[14],e[15]=t[3]*f+t[7]*g+t[11]*_+t[15]):(o=t[1],r=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],d=t[8],h=t[9],p=t[10],m=t[11],e[0]=n=t[0],e[1]=o,e[2]=r,e[3]=s,e[4]=a,e[5]=l,e[6]=c,e[7]=u,e[8]=d,e[9]=h,e[10]=p,e[11]=m,e[12]=n*f+a*g+d*_+t[12],e[13]=o*f+l*g+h*_+t[13],e[14]=r*f+c*g+p*_+t[14],e[15]=s*f+u*g+m*_+t[15]),e}function ma(e,t,i){var n=i[0],o=i[1],r=i[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function fa(e,t,i){var n=Math.sin(i),o=Math.cos(i),r=t[4],s=t[5],a=t[6],l=t[7],c=t[8],u=t[9],d=t[10],h=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=r*o+c*n,e[5]=s*o+u*n,e[6]=a*o+d*n,e[7]=l*o+h*n,e[8]=c*o-r*n,e[9]=u*o-s*n,e[10]=d*o-a*n,e[11]=h*o-l*n,e}function ga(e,t,i){var n=Math.sin(i),o=Math.cos(i),r=t[0],s=t[1],a=t[2],l=t[3],c=t[8],u=t[9],d=t[10],h=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=r*o-c*n,e[1]=s*o-u*n,e[2]=a*o-d*n,e[3]=l*o-h*n,e[8]=r*n+c*o,e[9]=s*n+u*o,e[10]=a*n+d*o,e[11]=l*n+h*o,e}function _a(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function ya(e,t,i){var n,o,r,s=i[0],a=i[1],l=i[2],c=Math.hypot(s,a,l);return c0&&(r=1/Math.sqrt(r)),e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function Da(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function za(e,t,i){var n=t[0],o=t[1],r=t[2],s=i[0],a=i[1],l=i[2];return e[0]=o*l-r*a,e[1]=r*s-n*l,e[2]=n*a-o*s,e}function Pa(e,t,i){var n=t[0],o=t[1],r=t[2],s=i[3]*n+i[7]*o+i[11]*r+i[15];return e[0]=(i[0]*n+i[4]*o+i[8]*r+i[12])/(s=s||1),e[1]=(i[1]*n+i[5]*o+i[9]*r+i[13])/s,e[2]=(i[2]*n+i[6]*o+i[10]*r+i[14])/s,e}function Oa(e,t,i){var n=i[0],o=i[1],r=i[2],s=t[0],a=t[1],l=t[2],c=o*l-r*a,u=r*s-n*l,d=n*a-o*s,h=o*d-r*u,p=r*c-n*d,m=n*u-o*c,f=2*i[3];return u*=f,d*=f,p*=2,m*=2,e[0]=s+(c*=f)+(h*=2),e[1]=a+u+p,e[2]=l+d+m,e}var Ba,ja=Ta,Ra=Ca,Fa=wa;function Na(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}function Ua(e,t){var i=t[0],n=t[1],o=t[2],r=t[3],s=i*i+n*n+o*o+r*r;return s>0&&(s=1/Math.sqrt(s)),e[0]=i*s,e[1]=n*s,e[2]=o*s,e[3]=r*s,e}function Va(e,t,i){var n=t[0],o=t[1],r=t[2],s=t[3];return e[0]=i[0]*n+i[4]*o+i[8]*r+i[12]*s,e[1]=i[1]*n+i[5]*o+i[9]*r+i[13]*s,e[2]=i[2]*n+i[6]*o+i[10]*r+i[14]*s,e[3]=i[3]*n+i[7]*o+i[11]*r+i[15]*s,e}function $a(){var e=new aa(4);return aa!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function qa(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Ga(e,t,i){i*=.5;var n=t[0],o=t[1],r=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=n*l+s*a,e[1]=o*l+r*a,e[2]=r*l-o*a,e[3]=s*l-n*a,e}function Za(e,t,i){i*=.5;var n=t[0],o=t[1],r=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=n*l-r*a,e[1]=o*l+s*a,e[2]=r*l+n*a,e[3]=s*l-o*a,e}xa(),Ba=new aa(4),aa!=Float32Array&&(Ba[0]=0,Ba[1]=0,Ba[2]=0,Ba[3]=0);var Ha=Ua;xa(),Ea(1,0,0),Ea(0,1,0),$a(),$a(),la();const Wa=Fr([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:Xa}=Wa,Ya=Fr([{name:"a_pos_3",components:3,type:"Int16"}]);var Ka=Fr([{name:"a_pos",type:"Int16",components:2}]);class Qa{constructor(e,t){this.pos=e,this.dir=t}intersectsPlane(e,t,i){const n=Da(t,this.dir);if(Math.abs(n)<1e-6)return!1;const o=((e[0]-this.pos[0])*t[0]+(e[1]-this.pos[1])*t[1]+(e[2]-this.pos[2])*t[2])/n;return i[0]=this.pos[0]+this.dir[0]*o,i[1]=this.pos[1]+this.dir[1]*o,i[2]=this.pos[2]+this.dir[2]*o,!0}closestPointOnSphere(e,t,i){if(function(e,t){var i=e[0],n=e[1],o=e[2],r=t[0],s=t[1],a=t[2];return Math.abs(i-r)<=sa*Math.max(1,Math.abs(i),Math.abs(r))&&Math.abs(n-s)<=sa*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(o-a)<=sa*Math.max(1,Math.abs(o),Math.abs(a))}(this.pos,e)||0===t)return i[0]=i[1]=i[2]=0,!1;const[n,o,r]=this.dir,s=this.pos[0]-e[0],a=this.pos[1]-e[1],l=this.pos[2]-e[2],c=n*n+o*o+r*r,u=2*(s*n+a*o+l*r),d=u*u-4*c*(s*s+a*a+l*l-t*t);if(d<0){const e=Math.max(-u/2,0),c=s+n*e,d=a+o*e,h=l+r*e,p=Math.hypot(c,d,h);return i[0]=c*t/p,i[1]=d*t/p,i[2]=h*t/p,!1}{const e=(-u-Math.sqrt(d))/(2*c);if(e<0){const e=Math.hypot(s,a,l);return i[0]=s*t/e,i[1]=a*t/e,i[2]=l*t/e,!1}return i[0]=s+n*e,i[1]=a+o*e,i[2]=l+r*e,!0}}}class Ja{constructor(e,t,i,n,o){this.TL=e,this.TR=t,this.BR=i,this.BL=n,this.horizon=o}static fromInvProjectionMatrix(e,t,i){const n=[-1,1,1],o=[1,1,1],r=[1,-1,1],s=[-1,-1,1],a=Pa(n,n,e),l=Pa(o,o,e),c=Pa(r,r,e),u=Pa(s,s,e);return new Ja(a,l,c,u,t/i)}}class el{constructor(e,t){this.points=e,this.planes=t}static fromInvProjectionMatrix(e,t,i,n){const o=Math.pow(2,i),r=[[-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((i=>{const r=Va([],i,e),s=1/r[3]/t*o;return function(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e}(r,r,[s,s,n?1/r[3]:s,s])})),s=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((e=>{const t=Ia([],za([],ja([],r[e[0]],r[e[1]]),ja([],r[e[2]],r[e[1]]))),i=-Da(t,r[e[1]]);return t.concat(i)}));return new el(r,s)}}class tl{static fromPoints(e){const t=[1/0,1/0,1/0],i=[-1/0,-1/0,-1/0];for(const n of e)ka(t,t,n),Sa(i,i,n);return new tl(t,i)}static applyTransform(e,t){const i=e.getCorners();for(let e=0;e=0;if(0===r)return 0;r!==t.length&&(i=!1)}if(i)return 2;for(let t=0;t<3;t++){let i=Number.MAX_VALUE,n=-Number.MAX_VALUE;for(let o=0;othis.max[t]-this.min[t])return 0}return 1}}const il=5,nl=6,ol=oa/Math.PI/2,rl=16383,sl=64,al=[sl,32,16],ll=-ol,cl=ol,ul=[new tl([ll,ll,ll],[cl,cl,cl]),new tl([ll,ll,ll],[0,0,cl]),new tl([0,ll,ll],[cl,0,cl]),new tl([ll,0,ll],[0,cl,cl]),new tl([0,0,ll],[cl,cl,cl])];function dl(e){return e*ol/Ol}function hl(e,t,i,n=!0){const o=La([],e._camera.position,e.worldSize),r=[t,i,1,1];Va(r,r,e.pixelMatrixInverse),Na(r,r,1/r[3]);const s=Ia([],ja([],r,o)),a=e.globeMatrix,l=[a[12],a[13],a[14]],c=ja([],l,o),u=wa(c),d=Ia([],c),h=e.worldSize/(2*Math.PI),p=Da(d,s),m=Math.asin(h/u);if(m1?null:function(e,t,i,n){const o=Math.sin(i);return e*(Math.sin((1-n)*i)/o)+t*(Math.sin(n*i)/o)}(e.a[t],e.b[t],e.angle,k(i,0,1))+e.center[t]}function fl(e){if(e.z<=1)return ul[e.z+2*e.y+e.x];const t=xl(bl(e));return tl.fromPoints(t)}function gl(e,t,i){return La(e,e,1-i),Aa(e,e,t,i)}function _l(e,t){const i=Ll(t.zoom);if(0===i)return fl(e);const n=bl(e),o=xl(n),r=Nl(n.getWest())*t.worldSize,s=Nl(n.getEast())*t.worldSize,a=Ul(n.getNorth())*t.worldSize,l=Ul(n.getSouth())*t.worldSize,c=[r,a,0],u=[s,a,0],d=[r,l,0],h=[s,l,0],p=da([],t.globeMatrix);return Pa(c,c,p),Pa(u,u,p),Pa(d,d,p),Pa(h,h,p),o[0]=gl(o[0],d,i),o[1]=gl(o[1],h,i),o[2]=gl(o[2],u,i),o[3]=gl(o[3],c,i),tl.fromPoints(o)}function yl(e,t,i){for(const n of e)Pa(n,n,t),La(n,n,i)}function bl({x:e,y:t,z:i}){const n=1/(1<Math.PI/2*1.01}const Dl=v(85),zl=Math.cos(Dl),Pl=Math.sin(Dl),Ol=6371008.8,Bl=2*Math.PI*Ol;class jl{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new jl(L(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,i=this.lat*t,n=e.lat*t,o=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((e.lng-this.lng)*t);return Ol*Math.acos(Math.min(o,1))}toBounds(e=0){const t=360*e/40075017,i=t/Math.cos(Math.PI/180*this.lat);return new ra(new jl(this.lng-i,this.lat-t),new jl(this.lng+i,this.lat+t))}toEcef(e){const t=dl(e);return wl(this.lat,this.lng,ol+t)}static convert(e){if(e instanceof jl)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new jl(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new jl(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}var Rl=jl;function Fl(e){return Bl*Math.cos(e*Math.PI/180)}function Nl(e){return(180+e)/360}function Ul(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Vl(e,t){return e/Fl(t)}function $l(e){return 360*e-180}function ql(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function Gl(e,t){return e*Fl(ql(t))}const Zl=85.051129;function Hl(e){return 1/Math.cos(e*Math.PI/180)}class Wl{constructor(e,t,i=0){this.x=+e,this.y=+t,this.z=+i}static fromLngLat(e,t=0){const i=Rl.convert(e);return new Wl(Nl(i.lng),Ul(i.lat),Vl(t,i.lat))}toLngLat(){return new Rl($l(this.x),ql(this.y))}toAltitude(){return Gl(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Bl*Hl(ql(this.y))}}function Xl(e,t,i,n,o,r,s,a,l){const c=(t+n)/2,u=(i+o)/2,d=new y(c,u);a(d),function(e,t,i,n,o,r){const s=i-o,a=n-r;return Math.abs((n-t)*s-(i-e)*a)/Math.hypot(s,a)}(d.x,d.y,r.x,r.y,s.x,s.y)>=l?(Xl(e,t,i,c,u,r,d,a,l),Xl(e,c,u,n,o,d,s,a,l)):e.push(s)}function Yl(e,t,i){let n=e[0],o=n.x,r=n.y;t(n);const s=[n];for(let a=1;ae.x+1||ne.y+1)&&q("Geometry exceeds allowed extent, reduce your vector tile buffer size"),e}function ic(e,t,i){const n=e.loadGeometry(),o=e.extent,r=oa/o;if(t&&i&&i.projection.isReprojectedInTileSpace){const r=1<{const i=$l((t.x+e.x/o)/r),n=ql((t.y+e.y/o)/r),u=c.project(i,n);e.x=(u.x*s-a)*o,e.y=(u.y*s-l)*o};for(let t=0;t=o||i.y<0||i.y>=o||(u(i),e.push(i));n[t]=e}}for(const e of n)for(const t of e)tc(t,r);return n}function nc(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?ic(e):[]}}function oc(e,t,i,n,o){e.emplaceBack(2*t+(n+1)/2,2*i+(o+1)/2)}function rc(e,t,i){const n=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*n,i[1]*n,i[2]*n)}class sc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new Ur,this.indexArray=new ns,this.segments=new na,this.programConfigurations=new Hs(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i,n){const o=this.layers[0],r=[];let s=null;"circle"===o.type&&(s=o.layout.get("circle-sort-key"));for(const{feature:t,id:o,index:a,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=nc(t,e);if(!this.layers[0]._featureFilter.filter(new wr(this.zoom),c,i))continue;const u=s?s.evaluate(c,{},i):void 0,d={id:o,properties:t.properties,type:t.type,sourceLayerIndex:l,index:a,geometry:e?c.geometry:ic(t,i,n),patterns:{},sortKey:u};r.push(d)}s&&r.sort(((e,t)=>e.sortKey-t.sortKey));let a=null;"globe"===n.projection.name&&(this.globeExtVertexArray=new Wr,a=n.projection);for(const n of r){const{geometry:o,index:r,sourceLayerIndex:s}=n,l=e[r].feature;this.addFeature(n,o,r,t.availableImages,i,a),t.featureIndex.insert(l,o,r,s,this.index)}}update(e,t,i,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ta.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,ia.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(e,t,i,n,o,r){for(const i of t)for(const t of i){const i=t.x,n=t.y;if(i<0||i>=oa||n<0||n>=oa)continue;if(r){const e=r.projectTilePoint(i,n,o),t=r.upVector(o,i,n),s=this.globeExtVertexArray;rc(s,e,t),rc(s,e,t),rc(s,e,t),rc(s,e,t)}const s=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),a=s.vertexLength;oc(this.layoutVertexArray,i,n,-1,-1),oc(this.layoutVertexArray,i,n,1,-1),oc(this.layoutVertexArray,i,n,1,1),oc(this.layoutVertexArray,i,n,-1,1),this.indexArray.emplaceBack(a,a+1,a+2),this.indexArray.emplaceBack(a,a+2,a+3),s.vertexLength+=4,s.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{},n,o)}}function ac(e,t){for(let i=0;i1){if(dc(e,t))return!0;for(let n=0;n1?i:i.sub(t)._mult(o)._add(t))}function fc(e,t){let i,n,o,r=!1;for(let s=0;st.y!=o.y>t.y&&t.x<(o.x-n.x)*(t.y-n.y)/(o.y-n.y)+n.x&&(r=!r)}return r}function gc(e,t){let i=!1;for(let n=0,o=e.length-1;nt.y!=s.y>t.y&&t.x<(s.x-r.x)*(t.y-r.y)/(s.y-r.y)+r.x&&(i=!i)}return i}function _c(e,t,i,n,o){for(const r of e)if(t<=r.x&&i<=r.y&&n>=r.x&&o>=r.y)return!0;const r=[new y(t,i),new y(t,o),new y(n,o),new y(n,i)];if(e.length>2)for(const t of r)if(gc(e,t))return!0;for(let t=0;to.x&&t.x>o.x||e.yo.y&&t.y>o.y)return!1;const r=G(e,t,i[0]);return r!==G(e,t,i[1])||r!==G(e,t,i[2])||r!==G(e,t,i[3])}function bc(e,t,i){const n=t.paint.get(e).value;return"constant"===n.kind?n.value:i.programConfigurations.get(t.id).getMaxValue(e)}function xc(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function vc(e,t,i,n,o){if(!t[0]&&!t[1])return e;const r=y.convert(t)._mult(o);"viewport"===i&&r._rotate(-n);const s=[];for(let t=0;t0){const e=i.projection.upVector(c,d.x,d.y);p.x+=e[0]*u*h,p.y+=e[1]*u*h,p.z+=e[2]*u*h}const m=r?d:Cc(p.x,p.y,p.z,n),f=r?e.tilespaceRays.map((e=>Lc(e,h))):e.queryGeometry.screenGeometry,g=Va([],[p.x,p.y,p.z,1],n);if(!s&&r?l*=g[3]/i.cameraToCenterDistance:s&&!r&&(l*=i.cameraToCenterDistance/g[3]),r){const e=ql((t.y/oa+c.y)/(1<e.width||o.height>e.height||i.x>e.width-o.width||i.y>e.height-o.height)throw new RangeError("out of range source coordinates for image copy");if(o.width>t.width||o.height>t.height||n.x>t.width-o.width||n.y>t.height-o.height)throw new RangeError("out of range destination coordinates for image copy");const s=e.data,a=t.data;for(let l=0;l{t[e.evaluationKey]=r;const s=e.expression.evaluate(t);o.data[i+n+0]=Math.floor(255*s.r/s.a),o.data[i+n+1]=Math.floor(255*s.g/s.a),o.data[i+n+2]=Math.floor(255*s.b/s.a),o.data[i+n+3]=Math.floor(255*s.a)};if(e.clips)for(let t=0,o=0;t80*i){n=r=e[0],o=s=e[1];for(var m=i;mr&&(r=a),l>s&&(s=l);c=0!==(c=Math.max(r-n,s-o))?32767/c:0}return Gc(h,p,i,n,o,c,0),p}function $c(e,t,i,n,o){var r,s;if(o===pu(e,t,i,n)>0)for(r=t;r=t;r-=n)s=uu(r,e[r],e[r+1],s);return s&&ou(s,s.next)&&(du(s),s=s.next),s}function qc(e,t){if(!e)return e;t||(t=e);var i,n=e;do{if(i=!1,n.steiner||!ou(n,n.next)&&0!==nu(n.prev,n,n.next))n=n.next;else{if(du(n),(n=t=n.prev)===n.next)break;i=!0}}while(i||n!==t);return t}function Gc(e,t,i,n,o,r,s){if(e){!s&&r&&function(e,t,i,n){var o=e;do{0===o.z&&(o.z=Jc(o.x,o.y,t,i,n)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next}while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,function(e){var t,i,n,o,r,s,a,l,c=1;do{for(i=e,e=null,r=null,s=0;i;){for(s++,n=i,a=0,t=0;t0||l>0&&n;)0!==a&&(0===l||!n||i.z<=n.z)?(o=i,i=i.nextZ,a--):(o=n,n=n.nextZ,l--),r?r.nextZ=o:e=o,o.prevZ=r,r=o;i=n}r.nextZ=null,c*=2}while(s>1)}(o)}(e,n,o,r);for(var a,l,c=e;e.prev!==e.next;)if(a=e.prev,l=e.next,r?Hc(e,n,o,r):Zc(e))t.push(a.i/i|0),t.push(e.i/i|0),t.push(l.i/i|0),du(e),e=l.next,c=l.next;else if((e=l)===c){s?1===s?Gc(e=Wc(qc(e),t,i),t,i,n,o,r,2):2===s&&Xc(e,t,i,n,o,r):Gc(qc(e),t,i,n,o,r,1);break}}}function Zc(e){var t=e.prev,i=e,n=e.next;if(nu(t,i,n)>=0)return!1;for(var o=t.x,r=i.x,s=n.x,a=t.y,l=i.y,c=n.y,u=or?o>s?o:s:r>s?r:s,p=a>l?a>c?a:c:l>c?l:c,m=n.next;m!==t;){if(m.x>=u&&m.x<=h&&m.y>=d&&m.y<=p&&tu(o,a,r,l,s,c,m.x,m.y)&&nu(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Hc(e,t,i,n){var o=e.prev,r=e,s=e.next;if(nu(o,r,s)>=0)return!1;for(var a=o.x,l=r.x,c=s.x,u=o.y,d=r.y,h=s.y,p=al?a>c?a:c:l>c?l:c,g=u>d?u>h?u:h:d>h?d:h,_=Jc(p,m,t,i,n),y=Jc(f,g,t,i,n),b=e.prevZ,x=e.nextZ;b&&b.z>=_&&x&&x.z<=y;){if(b.x>=p&&b.x<=f&&b.y>=m&&b.y<=g&&b!==o&&b!==s&&tu(a,u,l,d,c,h,b.x,b.y)&&nu(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,x.x>=p&&x.x<=f&&x.y>=m&&x.y<=g&&x!==o&&x!==s&&tu(a,u,l,d,c,h,x.x,x.y)&&nu(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;b&&b.z>=_;){if(b.x>=p&&b.x<=f&&b.y>=m&&b.y<=g&&b!==o&&b!==s&&tu(a,u,l,d,c,h,b.x,b.y)&&nu(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;x&&x.z<=y;){if(x.x>=p&&x.x<=f&&x.y>=m&&x.y<=g&&x!==o&&x!==s&&tu(a,u,l,d,c,h,x.x,x.y)&&nu(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Wc(e,t,i){var n=e;do{var o=n.prev,r=n.next.next;!ou(o,r)&&ru(o,n,n.next,r)&&lu(o,r)&&lu(r,o)&&(t.push(o.i/i|0),t.push(n.i/i|0),t.push(r.i/i|0),du(n),du(n.next),n=e=r),n=n.next}while(n!==e);return qc(n)}function Xc(e,t,i,n,o,r){var s=e;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&iu(s,a)){var l=cu(s,a);return s=qc(s,s.next),l=qc(l,l.next),Gc(s,t,i,n,o,r,0),void Gc(l,t,i,n,o,r,0)}a=a.next}s=s.next}while(s!==e)}function Yc(e,t){return e.x-t.x}function Kc(e,t){var i=function(e,t){var i,n=t,o=e.x,r=e.y,s=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){var a=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=o&&a>s&&(s=a,i=n.x=n.x&&n.x>=u&&o!==n.x&&tu(ri.x||n.x===i.x&&Qc(i,n)))&&(i=n,h=l)),n=n.next}while(n!==c);return i}(e,t);if(!i)return t;var n=cu(i,e);return qc(n,n.next),qc(i,i.next)}function Qc(e,t){return nu(e.prev,e,t.prev)<0&&nu(t.next,e,e.next)<0}function Jc(e,t,i,n,o){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*o|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function eu(e){var t=e,i=e;do{(t.x=(e-s)*(r-a)&&(e-s)*(n-a)>=(i-s)*(t-a)&&(i-s)*(r-a)>=(o-s)*(n-a)}function iu(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&ru(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(lu(e,t)&&lu(t,e)&&function(e,t){var i=e,n=!1,o=(e.x+t.x)/2,r=(e.y+t.y)/2;do{i.y>r!=i.next.y>r&&i.next.y!==i.y&&o<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==e);return n}(e,t)&&(nu(e.prev,e,t.prev)||nu(e,t.prev,t))||ou(e,t)&&nu(e.prev,e,e.next)>0&&nu(t.prev,t,t.next)>0)}function nu(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function ou(e,t){return e.x===t.x&&e.y===t.y}function ru(e,t,i,n){var o=au(nu(e,t,i)),r=au(nu(e,t,n)),s=au(nu(i,n,e)),a=au(nu(i,n,t));return o!==r&&s!==a||!(0!==o||!su(e,i,t))||!(0!==r||!su(e,n,t))||!(0!==s||!su(i,e,n))||!(0!==a||!su(i,t,n))}function su(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function au(e){return e>0?1:e<0?-1:0}function lu(e,t){return nu(e.prev,e,e.next)<0?nu(e,t,e.next)>=0&&nu(e,e.prev,t)>=0:nu(e,t,e.prev)<0||nu(e,e.next,t)<0}function cu(e,t){var i=new hu(e.i,e.x,e.y),n=new hu(t.i,t.x,t.y),o=e.next,r=t.prev;return e.next=t,t.prev=e,i.next=o,o.prev=i,n.next=i,i.prev=n,r.next=n,n.prev=r,n}function uu(e,t,i,n){var o=new hu(e,t,i);return n?(o.next=n.next,o.prev=n,n.next.prev=o,n.next=o):(o.prev=o,o.next=o),o}function du(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function hu(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function pu(e,t,i,n){for(var o=0,r=t,s=i-n;r0&&i.holes.push(n+=e[o-1].length)}return i};var mu=h(Uc.exports);function fu(e,t,i,n,o){gu(e,t,i||0,n||e.length-1,o||yu)}function gu(e,t,i,n,o){for(;n>i;){if(n-i>600){var r=n-i+1,s=t-i+1,a=Math.log(r),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(r-l)/r)*(s-r/2<0?-1:1);gu(e,t,Math.max(i,Math.floor(t-s*l/r+c)),Math.min(n,Math.floor(t+(r-s)*l/r+c)),o)}var u=e[t],d=i,h=n;for(_u(e,i,t),o(e[n],u)>0&&_u(e,i,n);d0;)h--}0===o(e[i],u)?_u(e,i,h):_u(e,++h,n),h<=t&&(i=h+1),t<=h&&(n=h-1)}}function _u(e,t,i){var n=e[t];e[t]=e[i],e[i]=n}function yu(e,t){return et?1:0}function bu(e,t){const i=e.length;if(i<=1)return[e];const n=[];let o,r;for(let t=0;t1)for(let e=0;ee.id)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ur,this.indexArray=new ns,this.indexArray2=new cs,this.programConfigurations=new Hs(e.layers,e.zoom),this.segments=new na,this.segments2=new na,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.projection=e.projection}populate(e,t,i,n){this.hasPattern=vu("fill",this.layers,t);const o=this.layers[0].layout.get("fill-sort-key"),r=[];for(const{feature:s,id:a,index:l,sourceLayerIndex:c}of e){const e=this.layers[0]._featureFilter.needGeometry,u=nc(s,e);if(!this.layers[0]._featureFilter.filter(new wr(this.zoom),u,i))continue;const d=o?o.evaluate(u,{},i,t.availableImages):void 0,h={id:a,properties:s.properties,type:s.type,sourceLayerIndex:c,index:l,geometry:e?u.geometry:ic(s,i,n),patterns:{},sortKey:d};r.push(h)}o&&r.sort(((e,t)=>e.sortKey-t.sortKey));for(const n of r){const{geometry:o,index:r,sourceLayerIndex:s}=n;if(this.hasPattern){const e=wu("fill",this.layers,n,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(n,o,r,i,{},t.availableImages);t.featureIndex.insert(e[r].feature,o,r,s,this.index)}}update(e,t,i,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i,n)}addFeatures(e,t,i,n,o){for(const e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,i,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Nc),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,i,n,o,r=[]){for(const e of bu(t,500)){let t=0;for(const i of e)t+=i.length;const i=this.segments.prepareSegment(t,this.layoutVertexArray,this.indexArray),n=i.vertexLength,o=[],r=[];for(const t of e){if(0===t.length)continue;t!==e[0]&&r.push(o.length/2);const i=this.segments2.prepareSegment(t.length,this.layoutVertexArray,this.indexArray2),n=i.vertexLength;this.layoutVertexArray.emplaceBack(t[0].x,t[0].y),this.indexArray2.emplaceBack(n+t.length-1,n),o.push(t[0].x),o.push(t[0].y);for(let e=1;e>3}if(o--,1===n||2===n)r+=e.readSVarint(),s+=e.readSVarint(),1===n&&(t&&a.push(t),t=[]),t.push(new Iu(r,s));else{if(7!==n)throw new Error("unknown command "+n);t&&t.push(t[0].clone())}}return t&&a.push(t),a},zu.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,i=1,n=0,o=0,r=0,s=1/0,a=-1/0,l=1/0,c=-1/0;e.pos>3}if(n--,1===i||2===i)(o+=e.readSVarint())a&&(a=o),(r+=e.readSVarint())c&&(c=r);else if(7!==i)throw new Error("unknown command "+i)}return[s,l,a,c]},zu.prototype.toGeoJSON=function(e,t,i){var n,o,r=this.extent*Math.pow(2,i),s=this.extent*e,a=this.extent*t,l=this.loadGeometry(),c=zu.types[this.type];function u(e){for(var t=0;t>3;t=1===n?e.readString():2===n?e.readFloat():3===n?e.readDouble():4===n?e.readVarint64():5===n?e.readVarint():6===n?e.readSVarint():7===n?e.readBoolean():null}return t}(i))}Ru.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new Bu(this._pbf,t,this.extent,this._keys,this._values)};var Nu=ju;function Uu(e,t,i){if(3===e){var n=new Nu(i,i.readVarint()+i.pos);n.length&&(t[n.name]=n)}}var Vu=Au.VectorTile=function(e,t){this.layers=e.readFields(Uu,{},t)},$u=Au.VectorTileFeature=Du;function qu(e,t,i,n){const o=[],r=0===n?(e,t,i,n,o,r)=>{e.push(new y(r,i+(r-t)/(n-t)*(o-i)))}:(e,t,i,n,o,r)=>{e.push(new y(t+(r-i)/(o-i)*(n-t),r))};for(const s of e){const e=[];for(const o of s){if(o.length<=2)continue;const s=[];for(let e=0;et&&r(s,a,l,c,u,t):d>i?h=t&&r(s,a,l,c,u,t),h>i&&d<=i&&r(s,a,l,c,u,i)}let a=o[o.length-1];const l=0===n?a.x:a.y;l>=t&&l<=i&&s.push(a),s.length&&(a=s[s.length-1],s[0].x===a.x&&s[0].y===a.y||s.push(s[0]),e.push(s))}e.length&&o.push(e)}return o}Au.VectorTileLayer=ju;const Gu=$u.types,Zu=Math.pow(2,13);function Hu(e,t,i,n,o,r,s,a){e.emplaceBack((t<<1)+s,(i<<1)+r,(Math.floor(n*Zu)<<1)+o,Math.round(a))}function Wu(e,t,i){const n=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*n,i[1]*n,i[2]*n)}class Xu{constructor(){this.acc=new y(0,0),this.polyCount=[]}startRing(e){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new y(e.x,e.y),this.max=new y(e.x,e.y))}append(e,t){this.currentPolyCount.edges++,this.acc._add(e);const i=this.min,n=this.max;e.xn.x&&(n.x=e.x),e.yn.y&&(n.y=e.y),((0===e.x||e.x===oa)&&e.x===t.x)!=((0===e.y||e.y===oa)&&e.y===t.y)&&this.processBorderOverlap(e,t),t.x<0!=e.x<0&&this.addBorderIntersection(0,Ii(t.y,e.y,(0-t.x)/(e.x-t.x))),t.x>oa!=e.x>oa&&this.addBorderIntersection(1,Ii(t.y,e.y,(oa-t.x)/(e.x-t.x))),t.y<0!=e.y<0&&this.addBorderIntersection(2,Ii(t.x,e.x,(0-t.y)/(e.y-t.y))),t.y>oa!=e.y>oa&&this.addBorderIntersection(3,Ii(t.x,e.x,(oa-t.y)/(e.y-t.y)))}addBorderIntersection(e,t){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const i=this.borders[e];ti[1]&&(i[1]=t)}processBorderOverlap(e,t){if(e.x===t.x){if(e.y===t.y)return;const i=0===e.x?0:1;this.addBorderIntersection(i,t.y),this.addBorderIntersection(i,e.y)}else{const i=0===e.y?2:3;this.addBorderIntersection(i,t.x),this.addBorderIntersection(i,e.x)}}centroid(){const e=this.polyCount.reduce(((e,t)=>e+t.edges),0);return 0!==e?this.acc.div(e)._round():new y(0,0)}span(){return new y(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce(((e,t)=>e+ +(t[0]!==Number.MAX_VALUE)),0)}}class Yu{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.layoutVertexArray=new $r,this.centroidVertexArray=new ws,this.indexArray=new ns,this.programConfigurations=new Hs(e.layers,e.zoom),this.segments=new na,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.enableTerrain=e.enableTerrain}populate(e,t,i,n){this.features=[],this.hasPattern=vu("fill-extrusion",this.layers,t),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=function(e){const t=Math.exp(Math.PI*(1-e.y/(1<=0;e--){const t=h[e];(0===t.length||(p=t[0]).every((e=>e.x<=0))||p.every((e=>e.x>=oa))||p.every((e=>e.y<=0))||p.every((e=>e.y>=oa)))&&h.splice(e,1)}var p;let m;if(c)m=od(h,a,n);else{m=[];for(const e of h)m.push({polygon:e,bounds:a})}const f=d?this.edgeRadius:0;for(const{polygon:e,bounds:t}of m){let i=0,o=0;for(const t of e)d&&!t[0].equals(t[t.length-1])&&t.push(t[0]),o+=d?t.length-1:t.length;const r=this.segments.prepareSegment((d?5:4)*o,this.layoutVertexArray,this.indexArray);if(d){const t=[],o=[];i=r.vertexLength;for(const i of e){let s,a;i.length&&i!==e[0]&&o.push(t.length/2),s=i[1].sub(i[0])._perp()._unit();for(let e=1;e4&&td(o[o.length-2],o[0],o[1]),p=f?Qu(o[o.length-2],o[0],o[1],f):0;s=o[1].sub(o[0])._perp()._unit();let m=!0;for(let g=1,_=0;g0?1:0,M=y.dist(b);if(_+M>32768&&(_=0),f){a=x.sub(b)._perp()._unit();let e=Ju(y,b,x,Ku(s,a),f);isNaN(e)&&(e=0);const t=b.sub(y)._unit();y=y.add(t.mult(p))._round(),b=b.add(t.mult(-e))._round(),p=e,s=a}const T=r.vertexLength,C=o.length>4&&td(y,b,x);let k=id(_,h,m);if(Hu(this.layoutVertexArray,y.x,y.y,w,E,0,0,k),Hu(this.layoutVertexArray,y.x,y.y,w,E,0,1,k),_+=M,k=id(_,C,!m),h=C,Hu(this.layoutVertexArray,b.x,b.y,w,E,0,0,k),Hu(this.layoutVertexArray,b.x,b.y,w,E,0,1,k),r.vertexLength+=4,this.indexArray.emplaceBack(T+0,T+1,T+2),this.indexArray.emplaceBack(T+1,T+3,T+2),r.primitiveLength+=2,f){const n=i+(1===g?o.length-2:g-2),s=1===g?i:n+1;if(this.indexArray.emplaceBack(T+1,n,T+3),this.indexArray.emplaceBack(n,s,T+3),r.primitiveLength+=2,void 0===e&&(e=T),!ed(x,o[g],t)){const t=g===o.length-1?e:r.vertexLength;this.indexArray.emplaceBack(T+2,T+3,t),this.indexArray.emplaceBack(T+3,t+1,t),this.indexArray.emplaceBack(T+3,s,t+1),r.primitiveLength+=3}m=!m}if(c){const e=this.layoutVertexExtArray,t=l.projectTilePoint(y.x,y.y,n),i=l.projectTilePoint(b.x,b.y,n),o=l.upVector(n,y.x,y.y),r=l.upVector(n,b.x,b.y);Wu(e,t,o),Wu(e,t,o),Wu(e,i,r),Wu(e,i,r)}}d&&(i+=o.length-1)}}if(u&&u.polyCount.length>0){if(u.borders){u.vertexArrayOffset=this.centroidVertexArray.length;const e=u.borders,t=this.featuresOnBorder.push(u)-1;for(let i=0;i<4;i++)e[i][0]!==Number.MAX_VALUE&&this.borders[i].push(t)}this.encodeCentroid(u.borders?void 0:u.centroid(),u)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,o,r,n)}sortBorders(){for(let e=0;e<4;e++)this.borders[e].sort(((t,i)=>this.featuresOnBorder[t].borders[e][0]-this.featuresOnBorder[i].borders[e][0]))}encodeCentroid(e,t,i=!0){let n,o;if(e)if(0!==e.y){const i=t.span()._mult(this.tileToMeter);n=(Math.max(e.x,1)<<3)+Math.min(7,Math.round(i.x/10)),o=(Math.max(e.y,1)<<3)+Math.min(7,Math.round(i.y/10))}else n=Math.ceil(7*(e.x+450)),o=0;else n=0,o=+i;let r=i?this.centroidVertexArray.length:t.vertexArrayOffset;for(const e of t.polyCount){i&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*e.edges+e.top);for(let t=0;ti[1].x&&t.x>i[1].x||e.yi[1].y&&t.y>i[1].y}function td(e,t,i){if(e.x<0||e.x>=oa||t.x<0||t.x>=oa||i.x<0||i.x>=oa)return!1;const n=i.sub(t),o=n.perp(),r=e.sub(t);return(n.x*r.x+n.y*r.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(r.x*r.x+r.y*r.y))>-.866&&o.x*r.x+o.y*r.y<0}function id(e,t,i){const n=t?2|e:-3&e;return i?1|n:-2&n}function nd(){const e=Math.PI/32,t=Math.tan(e),i=Ol;return i*Math.sqrt(1+2*t*t)-i}function od(e,t,i){const n=1<{for(const i of e)s.push({polygon:i,bounds:t})},l=Math.ceil(Math.log2(i)),c=Math.ceil(Math.log2(n)),u=l-c,d=[];for(let e=0;e0?0:1);for(let e=0;et+1?p.push({polygons:h,bounds:e,depth:t+1}):a(h,e)}if(m.length){const e=[new y(0===i?u:n.x,1===i?u:n.y),s];d.length>t+1?p.push({polygons:m,bounds:e,depth:t+1}):a(m,e)}}return s}(e,t,Math.ceil((r-o)/11.25),Math.ceil((s-a)/11.25),1,((e,t,o)=>{if(0===e)return.5*(t+o);{const e=ql((i.y+t/oa)/n);return(Ul(.5*(ql((i.y+o/oa)/n)+e))*n-i.y)*oa}}))}Yo(Yu,"FillExtrusionBucket",{omit:["layers","features"]}),Yo(Xu,"PartMetadata");const rd=new Pr({"fill-extrusion-edge-radius":new Ir(et["layout_fill-extrusion"]["fill-extrusion-edge-radius"])});var sd={paint:new Pr({"fill-extrusion-opacity":new Ir(et["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Dr(et["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ir(et["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ir(et["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Dr(et["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Dr(et["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Dr(et["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ir(et["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Ir(et["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Ir(et["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-rounded-roof":new Ir(et["paint_fill-extrusion"]["fill-extrusion-rounded-roof"])}),layout:rd};function ad(e,t,i){var n=2*Math.PI*6378137/256/Math.pow(2,i);return[e*n-2*Math.PI*6378137/2,t*n-2*Math.PI*6378137/2]}class ld{constructor(e,t,i){this.z=e,this.x=t,this.y=i,this.key=dd(0,e,e,t,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t){const i=function(e,t,i){var n=ad(256*e,256*(t=Math.pow(2,i)-t-1),i),o=ad(256*(e+1),256*(t+1),i);return n[0]+","+n[1]+","+o[0]+","+o[1]}(this.x,this.y,this.z),n=function(e,t,i){let n,o="";for(let r=e;r>0;r--)n=1<this.canonical.z?new ud(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ud(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t=!0){if(this.overscaledZ===e&&t)return this.key;if(e>this.canonical.z)return dd(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y);{const i=this.canonical.z-e;return dd(this.wrap*+t,e,e,this.canonical.x>>i,this.canonical.y>>i)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new ud(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,i=2*this.canonical.x,n=2*this.canonical.y;return[new ud(t,this.wrap,t,i,n),new ud(t,this.wrap,t,i+1,n),new ud(t,this.wrap,t,i,n+1),new ud(t,this.wrap,t,i+1,n+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ye.id)),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((e=>{this.gradients[e.id]={}})),this.layoutVertexArray=new qr,this.layoutVertexArray2=new Gr,this.indexArray=new ns,this.programConfigurations=new Hs(e.layers,e.zoom),this.segments=new na,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i,n){this.hasPattern=vu("line",this.layers,t);const o=this.layers[0].layout.get("line-sort-key"),r=[];for(const{feature:t,id:s,index:a,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=nc(t,e);if(!this.layers[0]._featureFilter.filter(new wr(this.zoom),c,i))continue;const u=o?o.evaluate(c,{},i):void 0,d={id:s,properties:t.properties,type:t.type,sourceLayerIndex:l,index:a,geometry:e?c.geometry:ic(t,i,n),patterns:{},sortKey:u};r.push(d)}o&&r.sort(((e,t)=>e.sortKey-t.sortKey));const{lineAtlas:s,featureIndex:a}=t,l=this.addConstantDashes(s);for(const n of r){const{geometry:o,index:r,sourceLayerIndex:c}=n;if(l&&this.addFeatureDashes(n,s),this.hasPattern){const e=wu("line",this.layers,n,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(n,o,r,i,s.positions,t.availableImages);a.insert(e[r].feature,o,r,c,this.index)}}addConstantDashes(e){let t=!1;for(const i of this.layers){const n=i.paint.get("line-dasharray").value,o=i.layout.get("line-cap").value;if("constant"!==n.kind||"constant"!==o.kind)t=!0;else{const t=o.value,i=n.value;if(!i)continue;e.addDash(i,t)}}return t}addFeatureDashes(e,t){const i=this.zoom;for(const n of this.layers){const o=n.paint.get("line-dasharray").value,r=n.layout.get("line-cap").value;if("constant"===o.kind&&"constant"===r.kind)continue;let s,a;if("constant"===o.kind){if(s=o.value,!s)continue}else s=o.evaluate({zoom:i},e);a="constant"===r.kind?r.value:r.evaluate({zoom:i},e),t.addDash(s,a),e.patterns[n.id]=t.getKey(s,a)}}update(e,t,i,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i,n)}addFeatures(e,t,i,n,o){for(const e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,i,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,bd)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,_d),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,t,i,n,o,r){const s=this.layers[0].layout,a=s.get("line-join").evaluate(e,{}),l=s.get("line-cap").evaluate(e,{}),c=s.get("line-miter-limit"),u=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const i of t)this.addLine(i,e,a,l,c,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,o,r,n)}addLine(e,t,i,n,o,r){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t=2&&e[a-1].equals(e[a-2]);)a--;let l=0;for(;l0;if(v&&t>l){const e=d.dist(h);if(e>2*c){const t=d.sub(d.sub(h)._mult(c/e)._round());this.updateDistance(h,t),this.addCurrentVertex(t,m,0,0,u),h=t}}const E=h&&p;let M=E?i:s?"butt":n;if(E&&"round"===M&&(bo&&(M="bevel"),"bevel"===M&&(b>2&&(M="flipbevel"),b100)g=f.mult(-1);else{const e=b*m.add(f).mag()/m.sub(f).mag();g._perp()._mult(e*(w?-1:1))}this.addCurrentVertex(d,g,0,0,u),this.addCurrentVertex(d,g.mult(-1),0,0,u)}else if("bevel"===M||"fakeround"===M){const e=-Math.sqrt(b*b-1),t=w?e:0,i=w?0:e;if(h&&this.addCurrentVertex(d,m,t,i,u),"fakeround"===M){const e=Math.round(180*x/Math.PI/20);for(let t=1;t2*c){const t=d.add(p.sub(d)._mult(c/e)._round());this.updateDistance(d,t),this.addCurrentVertex(t,f,0,0,u),d=t}}}}addCurrentVertex(e,t,i,n,o,r=!1){const s=t.y*n-t.x,a=-t.y-t.x*n;this.addHalfVertex(e,t.x+t.y*i,t.y-t.x*i,r,!1,i,o),this.addHalfVertex(e,s,a,r,!0,-n,o)}addHalfVertex({x:e,y:t},i,n,o,r,s,a){this.layoutVertexArray.emplaceBack((e<<1)+(o?1:0),(t<<1)+(r?1:0),Math.round(63*i)+128,Math.round(63*n)+128,1+(0===s?0:s<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const l=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),a.primitiveLength++),r?this.e2=l:this.e1=l}updateScaledDistance(){if(this.lineClips){const e=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}}Yo(wd,"LineBucket",{omit:["layers","patternFeatures"]});const Ed=new Pr({"line-cap":new Dr(et.layout_line["line-cap"]),"line-join":new Dr(et.layout_line["line-join"]),"line-miter-limit":new Ir(et.layout_line["line-miter-limit"]),"line-round-limit":new Ir(et.layout_line["line-round-limit"]),"line-sort-key":new Dr(et.layout_line["line-sort-key"])});var Md={paint:new Pr({"line-opacity":new Dr(et.paint_line["line-opacity"]),"line-color":new Dr(et.paint_line["line-color"]),"line-translate":new Ir(et.paint_line["line-translate"]),"line-translate-anchor":new Ir(et.paint_line["line-translate-anchor"]),"line-width":new Dr(et.paint_line["line-width"]),"line-gap-width":new Dr(et.paint_line["line-gap-width"]),"line-offset":new Dr(et.paint_line["line-offset"]),"line-blur":new Dr(et.paint_line["line-blur"]),"line-dasharray":new Dr(et.paint_line["line-dasharray"]),"line-pattern":new Dr(et.paint_line["line-pattern"]),"line-gradient":new zr(et.paint_line["line-gradient"]),"line-trim-offset":new Ir(et.paint_line["line-trim-offset"])}),layout:Ed};const Td=new class extends Dr{possiblyEvaluate(e,t){return t=new wr(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,n){return t=D({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,n)}}(Md.paint.properties["line-width"].specification);function Cd(e,t){return t>0?t+2*e:e}Td.useIntegerZoom=!0;const kd=Fr([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Sd=Fr([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Ld=Fr([{name:"a_projected_pos",components:4,type:"Float32"}],4);Fr([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Ad=Fr([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),Id=Fr([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);Fr([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Dd=Fr([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),zd=Fr([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Fr([{name:"triangle",components:3,type:"Uint16"}]),Fr([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),Fr([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Fr([{type:"Float32",name:"offsetX"}]),Fr([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var Pd=24;const Od=128;function Bd(e,t){const{expression:i}=t;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new wr(e+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:n}=i;let o=0;for(;o{e.text=function(e,t,i){const n=t.layout.get("text-transform").evaluate(i,{});return"uppercase"===n?e=e.toLocaleUpperCase():"lowercase"===n&&(e=e.toLocaleLowerCase()),vr.applyArabicShaping&&(e=vr.applyArabicShaping(e)),e}(e.text,t,i)})),e}const Ud={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function Vd(e){return"︶"===e||"﹈"===e||"︸"===e||"﹄"===e||"﹂"===e||"︾"===e||"︼"===e||"︺"===e||"︘"===e||"﹀"===e||"︐"===e||"︓"===e||"︔"===e||"`"===e||" ̄"===e||"︑"===e||"︒"===e}function $d(e){return"︵"===e||"﹇"===e||"︷"===e||"﹃"===e||"﹁"===e||"︽"===e||"︻"===e||"︹"===e||"︗"===e||"︿"===e}var qd=Hd,Gd=function(e,t,i,n,o){var r,s,a=8*o-n-1,l=(1<>1,u=-7,d=i?o-1:0,h=i?-1:1,p=e[t+d];for(d+=h,r=p&(1<<-u)-1,p>>=-u,u+=a;u>0;r=256*r+e[t+d],d+=h,u-=8);for(s=r&(1<<-u)-1,r>>=-u,u+=n;u>0;s=256*s+e[t+d],d+=h,u-=8);if(0===r)r=1-c;else{if(r===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),r-=c}return(p?-1:1)*s*Math.pow(2,r-n)},Zd=function(e,t,i,n,o,r){var s,a,l,c=8*r-o-1,u=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:r-1,m=n?1:-1,f=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+d>=1?h/l:h*Math.pow(2,1-d))*l>=2&&(s++,l/=2),s+d>=u?(a=0,s=u):s+d>=1?(a=(t*l-1)*Math.pow(2,o),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,o),s=0));o>=8;e[i+p]=255&a,p+=m,a/=256,o-=8);for(s=s<0;e[i+p]=255&s,p+=m,s/=256,c-=8);e[i+p-m]|=128*f};function Hd(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}Hd.Varint=0,Hd.Fixed64=1,Hd.Bytes=2,Hd.Fixed32=5;var Wd=4294967296,Xd=1/Wd,Yd="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Kd(e){return e.type===Hd.Bytes?e.readVarint()+e.pos:e.pos+1}function Qd(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function Jd(e,t,i){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(n);for(var o=i.pos-1;o>=e;o--)i.buf[o+n]=i.buf[o]}function eh(e,t){for(var i=0;i>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function dh(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}Hd.prototype={destroy:function(){this.buf=null},readFields:function(e,t,i){for(i=i||this.length;this.pos>3,r=this.pos;this.type=7&n,e(o,t,this),this.pos===r&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=ch(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=dh(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=ch(this.buf,this.pos)+ch(this.buf,this.pos+4)*Wd;return this.pos+=8,e},readSFixed64:function(){var e=ch(this.buf,this.pos)+dh(this.buf,this.pos+4)*Wd;return this.pos+=8,e},readFloat:function(){var e=Gd(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Gd(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,i,n=this.buf;return t=127&(i=n[this.pos++]),i<128?t:(t|=(127&(i=n[this.pos++]))<<7,i<128?t:(t|=(127&(i=n[this.pos++]))<<14,i<128?t:(t|=(127&(i=n[this.pos++]))<<21,i<128?t:function(e,t,i){var n,o,r=i.buf;if(n=(112&(o=r[i.pos++]))>>4,o<128)return Qd(e,n,t);if(n|=(127&(o=r[i.pos++]))<<3,o<128)return Qd(e,n,t);if(n|=(127&(o=r[i.pos++]))<<10,o<128)return Qd(e,n,t);if(n|=(127&(o=r[i.pos++]))<<17,o<128)return Qd(e,n,t);if(n|=(127&(o=r[i.pos++]))<<24,o<128)return Qd(e,n,t);if(n|=(1&(o=r[i.pos++]))<<31,o<128)return Qd(e,n,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(i=n[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&Yd?function(e,t,i){return Yd.decode(e.subarray(t,i))}(this.buf,t,e):function(e,t,i){for(var n="",o=t;o239?4:l>223?3:l>191?2:1;if(o+u>i)break;1===u?l<128&&(c=l):2===u?128==(192&(r=e[o+1]))&&(c=(31&l)<<6|63&r)<=127&&(c=null):3===u?(s=e[o+2],128==(192&(r=e[o+1]))&&128==(192&s)&&((c=(15&l)<<12|(63&r)<<6|63&s)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(s=e[o+2],a=e[o+3],128==(192&(r=e[o+1]))&&128==(192&s)&&128==(192&a)&&((c=(15&l)<<18|(63&r)<<12|(63&s)<<6|63&a)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,u=1):c>65535&&(c-=65536,n+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),n+=String.fromCharCode(c),o+=u}return n}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==Hd.Bytes)return e.push(this.readVarint(t));var i=Kd(this);for(e=e||[];this.pos127;);else if(t===Hd.Bytes)this.pos=this.readVarint()+this.pos;else if(t===Hd.Fixed32)this.pos+=4;else{if(t!==Hd.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t268435455||e<0?function(e,t){var i,n;if(e>=0?(i=e%4294967296|0,n=e/4294967296|0):(n=~(-e/4294967296),4294967295^(i=~(-e%4294967296))?i=i+1|0:(i=0,n=n+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,i.buf[i.pos]=127&(e>>>=7)}(i,0,t),function(e,t){var i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(n,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,i){for(var n,o,r=0;r55295&&n<57344){if(!o){n>56319||r+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):o=n;continue}if(n<56320){e[i++]=239,e[i++]=191,e[i++]=189,o=n;continue}n=o-55296<<10|n-56320|65536,o=null}else o&&(e[i++]=239,e[i++]=191,e[i++]=189,o=null);n<128?e[i++]=n:(n<2048?e[i++]=n>>6|192:(n<65536?e[i++]=n>>12|224:(e[i++]=n>>18|240,e[i++]=n>>12&63|128),e[i++]=n>>6&63|128),e[i++]=63&n|128)}return i}(this.buf,e,this.pos);var i=this.pos-t;i>=128&&Jd(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(e){this.realloc(4),Zd(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Zd(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var i=0;i=128&&Jd(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,i){this.writeTag(e,Hd.Bytes),this.writeRawMessage(t,i)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,eh,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,th,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,oh,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,ih,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,nh,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,rh,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,sh,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,ah,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,lh,t)},writeBytesField:function(e,t){this.writeTag(e,Hd.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,Hd.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,Hd.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,Hd.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,Hd.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,Hd.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,Hd.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,Hd.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,Hd.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,Hd.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};var hh=h(qd);const ph=3;function mh(e,t,i){t.glyphs=[],1===e&&i.readMessage(fh,t)}function fh(e,t,i){if(3===e){const{id:e,bitmap:n,width:o,height:r,left:s,top:a,advance:l}=i.readMessage(gh,{});t.glyphs.push({id:e,bitmap:new Pc({width:o+2*ph,height:r+2*ph},n),metrics:{width:o,height:r,left:s,top:a,advance:l}})}else 4===e?t.ascender=i.readSVarint():5===e&&(t.descender=i.readSVarint())}function gh(e,t,i){1===e?t.id=i.readVarint():2===e?t.bitmap=i.readBytes():3===e?t.width=i.readVarint():4===e?t.height=i.readVarint():5===e?t.left=i.readSVarint():6===e?t.top=i.readSVarint():7===e&&(t.advance=i.readVarint())}const _h=ph;function yh(e){let t=0,i=0;for(const n of e)t+=n.w*n.h,i=Math.max(i,n.w);e.sort(((e,t)=>t.h-e.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}];let o=0,r=0;for(const t of e)for(let e=n.length-1;e>=0;e--){const i=n[e];if(!(t.w>i.w||t.h>i.h)){if(t.x=i.x,t.y=i.y,r=Math.max(r,t.y+t.h),o=Math.max(o,t.x+t.w),t.w===i.w&&t.h===i.h){const t=n.pop();ee.hasImage(t))),e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const i in e.updatedImages)this.patchUpdatedImage(this.iconPositions[i],e.getImage(i),t),this.patchUpdatedImage(this.patternPositions[i],e.getImage(i),t)}patchUpdatedImage(e,t,i){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[n,o]=e.tl;i.update(t.data,void 0,{x:n,y:o})}}Yo(xh,"ImagePosition"),Yo(vh,"ImageAtlas");const wh={horizontal:1,vertical:2,horizontalOnly:3},Eh=-17;class Mh{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,t){const i=new Mh;return i.scale=e||1,i.fontStack=t,i}static forImage(e){const t=new Mh;return t.imageName=e,t}}class Th{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,t){const i=new Th;for(let n=0;n=0&&i>=e&&kh[this.text.charCodeAt(i)];i--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){const i=new Th;return i.text=this.text.substring(e,t),i.sectionIndex=this.sectionIndex.slice(e,t),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,t)=>Math.max(e,this.sections[t].scale)),0)}addTextSection(e,t){this.text+=e.text,this.sections.push(Mh.forText(e.scale,e.fontStack||t));const i=this.sections.length-1;for(let t=0;t=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Ch(e,t,i,n,o,r,s,a,l,c,u,d,h,p,m){const f=Th.fromFeature(e,o);d===wh.vertical&&f.verticalizePunctuation(h);let g=[];const _=function(e,t,i,n,o,r){if(!e)return[];const s=[],a=function(e,t,i,n,o,r){let s=0;for(let i=0;i=0;let c=0;for(let i=0;i0&&r>v&&(v=r)}else{const e=i[a.fontStack];if(!e)continue;e[f]&&(M=e[f]);const n=t[a.fontStack];if(!n)continue;const r=n.glyphs[f];if(!r)continue;if(b=r.metrics,C=8203!==f?Pd:0,g){const e=void 0!==n.ascender?Math.abs(n.ascender):0,t=void 0!==n.descender?Math.abs(n.descender):0,i=(e+t)*_;w-i/2;){if(s--,s<0)return!1;a-=e[s].dist(r),r=e[s]}a+=e[s].dist(e[s+1]),s++;const l=[];let c=0;for(;an;)c-=l.shift().angleDelta;if(c>o)return!1;s++,a+=t.dist(i)}return!0}function Nh(e){let t=0;for(let i=0;ic){const u=(c-l)/r,d=Ii(n.x,o.x,u),h=Ii(n.y,o.y,u),p=new Rh(d,h,0,o.angleTo(n),i);return!s||Fh(e,p,a,s,t)?p:void 0}l+=r}}function qh(e,t,i,n,o,r,s,a,l){const c=Uh(n,r,s),u=Vh(n,o),d=u*s,h=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-d=0&&_=0&&y=0&&h+c<=u){const i=new Rh(_,y,0,f,t);i._round(),n&&!Fh(e,i,r,n,o)||p.push(i)}}d+=m}return a||p.length||s||(p=Gh(e,d/2,i,n,o,r,s,!0,l)),p}function Zh(e,t,i,n,o){const r=[];for(let s=0;s=n&&c.x>=n||(s.x>=n?s=new y(n,s.y+(n-s.x)/(c.x-s.x)*(c.y-s.y))._round():c.x>=n&&(c=new y(n,s.y+(n-s.x)/(c.x-s.x)*(c.y-s.y))._round()),s.y>=o&&c.y>=o||(s.y>=o?s=new y(s.x+(o-s.y)/(c.y-s.y)*(c.x-s.x),o)._round():c.y>=o&&(c=new y(s.x+(o-s.y)/(c.y-s.y)*(c.x-s.x),o)._round()),l&&s.equals(l[l.length-1])||(l=[s],r.push(l)),l.push(c)))))}}return r}Yo(Rh,"Anchor");const Hh=1e20;function Wh(e,t,i,n,o,r,s,a,l){for(let c=t;c-1);l++,r[l]=a,s[l]=c,s[l+1]=Hh}for(let a=0,l=0;a{let n=this.entries[e];n||(n=this.entries[e]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let o=n.glyphs[t];if(void 0!==o)return void i(null,{stack:e,id:t,glyph:o});if(o=this._tinySDF(n,e,t),o)return n.glyphs[t]=o,void i(null,{stack:e,id:t,glyph:o});const r=Math.floor(t/256);if(256*r>65535)return void i(new Error("glyphs > 65535 not supported"));if(n.ranges[r])return void i(null,{stack:e,id:t,glyph:o});let s=n.requests[r];s||(s=n.requests[r]=[],Qh.loadGlyphRange(e,r,this.url,this.requestManager,((e,t)=>{if(t){n.ascender=t.ascender,n.descender=t.descender;for(const e in t.glyphs)this._doesCharSupportLocalGlyph(+e)||(n.glyphs[+e]=t.glyphs[+e]);n.ranges[r]=!0}for(const i of s)i(e,t);delete n.requests[r]}))),s.push(((n,o)=>{n?i(n):o&&i(null,{stack:e,id:t,glyph:o.glyphs[t]||null})}))}),((e,i)=>{if(e)t(e);else if(i){const e={};for(const{stack:t,id:n,glyph:o}of i)void 0===e[t]&&(e[t]={}),void 0===e[t].glyphs&&(e[t].glyphs={}),e[t].glyphs[n]=o&&{id:o.id,bitmap:o.bitmap.clone(),metrics:o.metrics},e[t].ascender=this.entries[t].ascender,e[t].descender=this.entries[t].descender;t(null,e)}}))}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==Kh.none&&(this.localGlyphMode===Kh.all?!!this.localFontFamily:!!this.localFontFamily&&(tr["CJK Unified Ideographs"](e)||tr["Hangul Syllables"](e)||tr.Hiragana(e)||tr.Katakana(e)||tr["CJK Symbols and Punctuation"](e)))}_tinySDF(e,t,i){const n=this.localFontFamily;if(!n||!this._doesCharSupportLocalGlyph(i))return;let o=e.tinySDF;if(!o){let i="400";/bold/i.test(t)?i="900":/medium/i.test(t)?i="500":/light/i.test(t)&&(i="200"),o=e.tinySDF=new Qh.TinySDF({fontFamily:n,fontWeight:i,fontSize:24*Yh,buffer:3*Yh,radius:8*Yh}),o.fontWeight=i}if(this.localGlyphs[o.fontWeight][i])return this.localGlyphs[o.fontWeight][i];const r=String.fromCharCode(i),{data:s,width:a,height:l,glyphWidth:c,glyphHeight:u,glyphLeft:d,glyphTop:h,glyphAdvance:p}=o.draw(r);return this.localGlyphs[o.fontWeight][i]={id:i,bitmap:new Pc({width:a,height:l},s),metrics:{width:c/Yh,height:u/Yh,left:d/Yh,top:h/Yh-27,advance:p/Yh,localGlyph:!0}}}}Qh.loadGlyphRange=function(e,t,i,n,o){const r=256*t,s=r+255,a=n.transformRequest(n.normalizeGlyphsURL(i).replace("{fontstack}",e).replace("{range}",`${r}-${s}`),le.Glyphs);he(a,((e,t)=>{if(e)o(e);else if(t){const e={},i=function(e){return new hh(e).readFields(mh,{})}(t);for(const t of i.glyphs)e[t.id]=t;o(null,{glyphs:e,ascender:i.ascender,descender:i.descender})}}))},Qh.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:n=.25,fontFamily:o="sans-serif",fontWeight:r="normal",fontStyle:s="normal"}={}){this.buffer=t,this.cutoff=n,this.radius=i;const a=this.size=e+4*t,l=this._createCanvas(a),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${s} ${r} ${e}px ${o}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:o,actualBoundingBoxRight:r}=this.ctx.measureText(e),s=Math.ceil(i),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(r-o))),l=Math.min(this.size-this.buffer,s+Math.ceil(n)),c=a+2*this.buffer,u=l+2*this.buffer,d=Math.max(c*u,0),h=new Uint8ClampedArray(d),p={data:h,width:c,height:u,glyphWidth:a,glyphHeight:l,glyphTop:s,glyphLeft:0,glyphAdvance:t};if(0===a||0===l)return p;const{ctx:m,buffer:f,gridInner:g,gridOuter:_}=this;m.clearRect(f,f,a,l),m.fillText(e,f,f+s);const y=m.getImageData(f,f,a,l);_.fill(Hh,0,d),g.fill(0,0,d);for(let e=0;e0?e*e:0,g[n]=e<0?e*e:0}}Wh(_,0,0,c,u,c,this.f,this.v,this.z),Wh(g,f,f,a,l,c,this.f,this.v,this.z);for(let e=0;ee+t[1]-t[0],m=d.reduce(p,0),f=h.reduce(p,0),g=a-m,_=l-f;let b=0,x=m,v=0,w=f,E=0,M=g,T=0,C=_;if(r.content&&n){const e=r.content;b=tp(d,0,e[0]),v=tp(h,0,e[1]),x=tp(d,e[0],e[2]),w=tp(h,e[1],e[3]),E=e[0]-b,T=e[1]-v,M=e[2]-e[0]-x,C=e[3]-e[1]-w}const k=(n,o,a,l)=>{const d=np(n.stretch-b,x,c,e.left),h=op(n.fixed-E,M,n.stretch,m),p=np(o.stretch-v,w,u,e.top),g=op(o.fixed-T,C,o.stretch,f),_=np(a.stretch-b,x,c,e.left),k=op(a.fixed-E,M,a.stretch,m),S=np(l.stretch-v,w,u,e.top),L=op(l.fixed-T,C,l.stretch,f),A=new y(d,p),I=new y(_,p),D=new y(_,S),z=new y(d,S),P=new y(h/s,g/s),O=new y(k/s,L/s),B=t*Math.PI/180;if(B){const e=Math.sin(B),t=Math.cos(B),i=[t,-e,e,t];A._matMult(i),I._matMult(i),z._matMult(i),D._matMult(i)}const j=n.stretch+n.fixed,R=o.stretch+o.fixed;return{tl:A,tr:I,bl:z,br:D,tex:{x:r.paddedRect.x+Jh+j,y:r.paddedRect.y+Jh+R,w:a.stretch+a.fixed-j,h:l.stretch+l.fixed-R},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:P,pixelOffsetBR:O,minFontScaleX:M/s/c,minFontScaleY:C/s/u,isSDF:i}};if(n&&(r.stretchX||r.stretchY)){const e=ip(d,g,m),t=ip(h,_,f);for(let i=0;i0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return this.length--,this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,n=t[e];for(;e>0;){const o=e-1>>1,r=t[o];if(i(n,r)>=0)break;t[e]=r,e=o}t[e]=n}_down(e){const{data:t,compare:i}=this,n=this.length>>1,o=t[e];for(;e=0)break;t[e]=r,e=n}t[e]=o}}function ap(e,t){return et?1:0}function lp(e,t=1,i=!1){let n=1/0,o=1/0,r=-1/0,s=-1/0;const a=e[0];for(let e=0;er)&&(r=t.x),(!e||t.y>s)&&(s=t.y)}const l=Math.min(r-n,s-o);let c=l/2;const u=new sp([],cp);if(0===l)return new y(n,o);for(let t=n;td.d||!d.d)&&(d=n,i&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,h)),n.max-d.d<=t||(c=n.h/2,u.push(new up(n.p.x-c,n.p.y-c,c,e)),u.push(new up(n.p.x+c,n.p.y-c,c,e)),u.push(new up(n.p.x-c,n.p.y+c,c,e)),u.push(new up(n.p.x+c,n.p.y+c,c,e)),h+=4)}return i&&(console.log(`num probes: ${h}`),console.log(`best distance: ${d.d}`)),d.p}function cp(e,t){return t.max-e.max}class up{constructor(e,t,i,n){this.p=new y(e,t),this.h=i,this.d=function(e,t){let i=!1,n=1/0;for(let o=0;oe.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(i=!i),n=Math.min(n,mc(e,o,a))}}return(i?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}}const dp=7,hp=Number.POSITIVE_INFINITY,pp=Math.sqrt(2);function mp(e,[t,i]){let n=0,o=0;if(i===hp){t<0&&(t=0);const i=t/pp;switch(e){case"top-right":case"top-left":o=i-dp;break;case"bottom-right":case"bottom-left":o=-i+dp;break;case"bottom":o=-t+dp;break;case"top":o=t-dp}switch(e){case"top-right":case"bottom-right":n=-i;break;case"top-left":case"bottom-left":n=i;break;case"left":n=t;break;case"right":n=-t}}else{switch(t=Math.abs(t),i=Math.abs(i),e){case"top-right":case"top-left":case"top":o=i-dp;break;case"bottom-right":case"bottom-left":case"bottom":o=-i+dp}switch(e){case"top-right":case"bottom-right":case"right":n=-t;break;case"top-left":case"bottom-left":case"left":n=t}}return[n,o]}function fp(e,t,i,n,o,r,s,a,l,c){e.createArrays(),e.tilePixelRatio=oa/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;const u=e.layers[0].layout,d=e.layers[0]._unevaluatedLayout._values,h={};if("composite"===e.textSizeData.kind){const{minZoom:t,maxZoom:i}=e.textSizeData;h.compositeTextSizes=[d["text-size"].possiblyEvaluate(new wr(t),a),d["text-size"].possiblyEvaluate(new wr(i),a)]}if("composite"===e.iconSizeData.kind){const{minZoom:t,maxZoom:i}=e.iconSizeData;h.compositeIconSizes=[d["icon-size"].possiblyEvaluate(new wr(t),a),d["icon-size"].possiblyEvaluate(new wr(i),a)]}h.layoutTextSize=d["text-size"].possiblyEvaluate(new wr(l+1),a),h.layoutIconSize=d["icon-size"].possiblyEvaluate(new wr(l+1),a),h.textMaxSize=d["text-size"].possiblyEvaluate(new wr(18),a);const p="map"===u.get("text-rotation-alignment")&&"point"!==u.get("symbol-placement"),m=u.get("text-size");for(const r of e.features){const l=u.get("text-font").evaluate(r,{},a).join(","),d=m.evaluate(r,{},a),f=h.layoutTextSize.evaluate(r,{},a),g=(h.layoutIconSize.evaluate(r,{},a),{horizontal:{},vertical:void 0}),_=r.text;let y,b=[0,0];if(_){const n=_.toString(),s=u.get("text-letter-spacing").evaluate(r,{},a)*Pd,c=u.get("text-line-height").evaluate(r,{},a)*Pd,h=nr(n)?s:0,m=u.get("text-anchor").evaluate(r,{},a),y=u.get("text-variable-anchor");if(!y){const e=u.get("text-radial-offset").evaluate(r,{},a);b=e?mp(m,[e*Pd,hp]):u.get("text-offset").evaluate(r,{},a).map((e=>e*Pd))}let x=p?"center":u.get("text-justify").evaluate(r,{},a);const v="point"===u.get("symbol-placement"),w=v?u.get("text-max-width").evaluate(r,{},a)*Pd:1/0,E=r=>{e.allowVerticalPlacement&&ir(n)&&(g.vertical=Ch(_,t,i,o,l,w,c,m,r,h,b,wh.vertical,!0,f,d))};if(!p&&y){const e="auto"===x?y.map((e=>gp(e))):[x];let n=!1;for(let r=0;r=0||!ir(n)){const e=Ch(_,t,i,o,l,w,c,m,x,h,b,wh.horizontal,!1,f,d);e&&(g.horizontal[x]=e)}E(v?"left":x)}}let x=!1;if(r.icon&&r.icon.name){const t=n[r.icon.name];t&&(y=Bh(o[r.icon.name],u.get("icon-offset").evaluate(r,{},a),u.get("icon-anchor").evaluate(r,{},a)),x=t.sdf,void 0===e.sdfIcons?e.sdfIcons=t.sdf:e.sdfIcons!==t.sdf&&q("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.pixelRatio||0!==u.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0))}const v=vp(g.horizontal)||g.vertical;e.iconsInText||(e.iconsInText=!!v&&v.iconsInText),(v||y)&&_p(e,r,g,y,n,h,f,0,b,x,s,a,c)}r&&e.generateCollisionDebugBuffers(l,e.collisionBoxArray)}function gp(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function _p(e,t,i,n,o,r,s,a,l,c,u,d,h){let p=r.textMaxSize.evaluate(t,{},d);void 0===p&&(p=s);const m=e.layers[0].layout,f=m.get("icon-offset").evaluate(t,{},d),g=vp(i.horizontal)||i.vertical,_="globe"===h.name,y=Pd,b=s/y,x=e.tilePixelRatio*p/y,w=(A=e.overscaling,e.zoom>18&&A>2&&(A>>=1),Math.max(oa/(512*A),1)*m.get("symbol-spacing")),E=m.get("text-padding")*e.tilePixelRatio,M=m.get("icon-padding")*e.tilePixelRatio,T=v(m.get("text-max-angle")),C="map"===m.get("text-rotation-alignment")&&"point"!==m.get("symbol-placement"),k="map"===m.get("icon-rotation-alignment")&&"point"!==m.get("symbol-placement"),S=m.get("symbol-placement"),L=w/2;var A;const I=m.get("icon-text-fit");let D;n&&"none"!==I&&(e.allowVerticalPlacement&&i.vertical&&(D=jh(n,i.vertical,I,m.get("icon-text-fit-padding"),f,b)),g&&(n=jh(n,g,I,m.get("icon-text-fit-padding"),f,b)));const z=(s,a,p)=>{if(a.x<0||a.x>=oa||a.y<0||a.y>=oa)return;let m=null;if(_){const{x:e,y:t,z:i}=h.projectTilePoint(a.x,a.y,p);m={anchor:new Rh(e,t,i,0,void 0),up:h.upVector(p,a.x,a.y)}}!function(e,t,i,n,o,r,s,a,l,c,u,d,h,p,m,f,g,_,y,b,x,v,w,E,M){const T=e.addToLineVertexArray(t,n);let C,k,S,L,A,I,D,z=0,P=0,O=0,B=0,j=-1,R=-1;const F={};let N=Ss("");const U=i?i.anchor:t;let V=0,$=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[V,$]=l.layout.get("text-offset").evaluate(x,{},M).map((e=>e*Pd)):(V=l.layout.get("text-radial-offset").evaluate(x,{},M)*Pd,$=hp),e.allowVerticalPlacement&&o.vertical){const e=o.vertical;if(m)I=Ep(e),a&&(D=Ep(a));else{const i=l.layout.get("text-rotate").evaluate(x,{},M)+90;S=wp(c,U,t,u,d,h,e,p,i,f),a&&(L=wp(c,U,t,u,d,h,a,_,i))}}if(r){const n=l.layout.get("icon-rotate").evaluate(x,{},M),o="none"!==l.layout.get("icon-text-fit"),s=ep(r,n,w,o),p=a?ep(a,n,w,o):void 0;k=wp(c,U,t,u,d,h,r,_,n),z=4*s.length;const m=e.iconSizeData;let f=null;"source"===m.kind?(f=[Od*l.layout.get("icon-size").evaluate(x,{},M)],f[0]>bp&&q(`${e.layerIds[0]}: Value for "icon-size" is >= ${yp}. Reduce your "icon-size".`)):"composite"===m.kind&&(f=[Od*v.compositeIconSizes[0].evaluate(x,{},M),Od*v.compositeIconSizes[1].evaluate(x,{},M)],(f[0]>bp||f[1]>bp)&&q(`${e.layerIds[0]}: Value for "icon-size" is >= ${yp}. Reduce your "icon-size".`)),e.addSymbols(e.icon,s,f,b,y,x,!1,i,t,T.lineStartIndex,T.lineLength,-1,E,M),j=e.icon.placedSymbolArray.length-1,p&&(P=4*p.length,e.addSymbols(e.icon,p,f,b,y,x,wh.vertical,i,t,T.lineStartIndex,T.lineLength,-1,E,M),R=e.icon.placedSymbolArray.length-1)}for(const n in o.horizontal){const r=o.horizontal[n];C||(N=Ss(r.text),m?A=Ep(r):C=wp(c,U,t,u,d,h,r,p,l.layout.get("text-rotate").evaluate(x,{},M),f));const a=1===r.positionedLines.length;if(O+=xp(e,i,t,r,s,l,m,x,f,T,o.vertical?wh.horizontal:wh.horizontalOnly,a?Object.keys(o.horizontal):[n],F,j,v,E,M),a)break}o.vertical&&(B+=xp(e,i,t,o.vertical,s,l,m,x,f,T,wh.vertical,["vertical"],F,R,v,E,M));let G=-1;const Z=(e,t)=>e?Math.max(e,t):t;G=Z(A,G),G=Z(I,G),G=Z(D,G);const H=G>-1?1:0;e.glyphOffsetArray.length>=im.MAX_GLYPHS&&q("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,x.sortKey),e.symbolInstances.emplaceBack(U.x,U.y,U.z,t.x,t.y,F.right>=0?F.right:-1,F.center>=0?F.center:-1,F.left>=0?F.left:-1,F.vertical>=0?F.vertical:-1,j,R,N,void 0!==C?C:e.collisionBoxArray.length,void 0!==C?C+1:e.collisionBoxArray.length,void 0!==S?S:e.collisionBoxArray.length,void 0!==S?S+1:e.collisionBoxArray.length,void 0!==k?k:e.collisionBoxArray.length,void 0!==k?k+1:e.collisionBoxArray.length,L||e.collisionBoxArray.length,L?L+1:e.collisionBoxArray.length,u,O,B,z,P,H,0,V,$,G)}(e,a,m,s,i,n,o,D,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,E,C,l,0,M,k,f,t,r,c,u,d)};if("line"===S)for(const o of Zh(t.geometry,0,0,oa,oa)){const t=qh(o,w,T,i.vertical||g,n,y,x,e.overscaling,oa);for(const i of t)g&&Mp(e,g.text,L,i)||z(o,i,d)}else if("line-center"===S){for(const e of t.geometry)if(e.length>1){const t=$h(e,T,i.vertical||g,n,y,x);t&&z(e,t,d)}}else if("Polygon"===t.type)for(const e of bu(t.geometry,0)){const t=lp(e,16);z(e[0],new Rh(t.x,t.y,0,0,void 0),d)}else if("LineString"===t.type)for(const e of t.geometry)z(e,new Rh(e[0].x,e[0].y,0,0,void 0),d);else if("Point"===t.type)for(const e of t.geometry)for(const t of e)z([t],new Rh(t.x,t.y,0,0,void 0),d)}const yp=255,bp=yp*Od;function xp(e,t,i,n,o,r,s,a,l,c,u,d,h,p,m,f,g){const _=function(e,t,i,n,o,r,s,a){const l=[];if(0===t.positionedLines.length)return l;const c=n.layout.get("text-rotate").evaluate(r,{})*Math.PI/180,u=function(e){const t=e[0],i=e[1],n=t*i;return n>0?[t,-i]:n<0?[-t,i]:0===t?[i,t]:[i,-t]}(i);let d=Math.abs(t.top-t.bottom);for(const e of t.positionedLines)d-=e.lineOffset;const h=t.positionedLines.length,p=d/h;let m=t.top-i[1];for(let e=0;ebp&&q(`${e.layerIds[0]}: Value for "text-size" is >= ${yp}. Reduce your "text-size".`)):"composite"===b.kind&&(x=[Od*m.compositeTextSizes[0].evaluate(a,{},g),Od*m.compositeTextSizes[1].evaluate(a,{},g)],(x[0]>bp||x[1]>bp)&&q(`${e.layerIds[0]}: Value for "text-size" is >= ${yp}. Reduce your "text-size".`)),e.addSymbols(e.text,_,x,l,s,a,u,t,i,c.lineStartIndex,c.lineLength,p,f,g);for(const t of d)h[t]=e.text.placedSymbolArray.length-1;return 4*_.length}function vp(e){for(const t in e)return e[t];return null}function wp(e,t,i,n,o,r,s,a,l,c){let u=s.top,d=s.bottom,h=s.left,p=s.right;const m=s.collisionPadding;if(m&&(h-=m[0],u-=m[1],p+=m[2],d+=m[3]),l){const e=new y(h,u),t=new y(p,u),i=new y(h,d),n=new y(p,d),o=v(l);let r=new y(0,0);c&&(r=new y(c[0],c[1])),e._rotateAround(o,r),t._rotateAround(o,r),i._rotateAround(o,r),n._rotateAround(o,r),h=Math.min(e.x,t.x,i.x,n.x),p=Math.max(e.x,t.x,i.x,n.x),u=Math.min(e.y,t.y,i.y,n.y),d=Math.max(e.y,t.y,i.y,n.y)}return e.emplaceBack(t.x,t.y,t.z,i.x,i.y,h,u,p,d,a,n,o,r),e.length-1}function Ep(e){e.collisionPadding&&(e.top-=e.collisionPadding[1],e.bottom+=e.collisionPadding[3]);const t=e.bottom-e.top;return t>0?Math.max(10,t):null}function Mp(e,t,i,n){const o=e.compareText;if(t in o){const e=o[t];for(let t=e.length-1;t>=0;t--)if(n.dist(e[t])b&&(x(e,c,n,o,a,l),x(c,i,a,l,r,s))}x(d,h,n,r,o,r),x(h,p,o,r,o,s),x(p,m,o,s,n,s),x(m,d,n,s,n,r),f-=b,g-=b,_+=b,y+=b;const v=1/Math.max(_-f,y-g);return{scale:v,x:f*v,y:g*v,x2:_*v,y2:y*v,projection:t}}const kp=ua(new Float32Array(16));class Sp{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,t){return{x:0,y:0,z:0}}unproject(e,t){return new Rl(0,0)}projectTilePoint(e,t,i){return{x:e,y:t,z:0}}locationPoint(e,t,i=!0){return e._coordinatePoint(e.locationCoordinate(t),i)}pixelsPerMeter(e,t){return Vl(1,e)*t}pixelSpaceConversion(e,t,i){return 1}farthestPixelDistance(e){return Tp(e,e.pixelsPerMeter)}pointCoordinate(e,t,i,n){const o=e.horizonLineFromTop(!1),r=new y(t,Math.max(o,i));return e.rayIntersectionCoordinate(e.pointRayIntersection(r,n))}pointCoordinate3D(e,t,i){const n=new y(t,i);if(e.elevation)return e.elevation.pointCoordinate(n);{const t=this.pointCoordinate(e,n.x,n.y,0);return[t.x,t.y,t.z]}}isPointAboveHorizon(e,t){if(e.elevation)return!this.pointCoordinate3D(e,t.x,t.y);const i=e.horizonLineFromTop();return t.y0?t<-jp+i&&(t=-jp+i):t>jp-i&&(t=jp-i);const r=o/Math.pow(Rp(t),n);let s=r*Math.sin(n*e),a=o-r*Math.cos(n*e);return s=.5*(s/Math.PI+.5),a=.5*(a/Math.PI+.5),{x:s,y:this.southernCenter?a:1-a,z:0}}unproject(e,t){e=(2*e-.5)*Math.PI,this.southernCenter&&(t=1-t),t=(2*(1-t)-.5)*Math.PI;const{n:i,f:n}=this,o=n-t,r=Math.sign(o),s=Math.sign(i)*Math.sqrt(e*e+o*o);let a=Math.atan2(e,Math.abs(o))*r;o*i<0&&(a-=Math.PI*Math.sign(e)*r);const l=k(w(a/i)+this.center[0],-180,180),c=k(w(2*Math.atan(Math.pow(n/s,1/i))-jp),-Zl,Zl);return new Rl(l,this.southernCenter?-c:c)}}class Np extends Sp{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,t){return{x:Nl(e),y:Ul(t),z:0}}unproject(e,t){const i=$l(e),n=ql(t);return new Rl(i,n)}}const Up=v(Zl);class Vp extends Sp{project(e,t){const i=(t=v(t))*t,n=i*i;return{x:.5*((e=v(e))*(.8707-.131979*i+n*(n*(.003971*i-.001529*n)-.013791))/Math.PI+.5),y:1-.5*(t*(1.007226+i*(.015085+n*(.028874*i-.044475-.005916*n)))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let i=t=(2*(1-t)-1)*Math.PI,n=25,o=0,r=i*i;do{r=i*i;const e=r*r;o=(i*(1.007226+r*(.015085+e*(.028874*r-.044475-.005916*e)))-t)/(1.007226+r*(.045255+e*(.259866*r-.311325-.005916*11*e))),i=k(i-o,-Up,Up)}while(Math.abs(o)>1e-6&&--n>0);r=i*i;const s=k(w(e/(.8707+r*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979))),-180,180),a=w(i);return new Rl(s,a)}}const $p=v(Zl);class qp extends Sp{project(e,t){t=v(t),e=v(e);const i=Math.cos(t),n=2/Math.PI,o=Math.acos(i*Math.cos(e/2)),r=Math.sin(o)/o,s=.5*(e*n+2*i*Math.sin(e/2)/r)||0,a=.5*(t+Math.sin(t)/r)||0;return{x:.5*(s/Math.PI+.5),y:1-.5*(a/Math.PI+1),z:0}}unproject(e,t){let i=e=(2*e-.5)*Math.PI,n=t=(2*(1-t)-1)*Math.PI,o=25;const r=1e-6;let s=0,a=0;do{const o=Math.cos(n),r=Math.sin(n),l=2*r*o,c=r*r,u=o*o,d=Math.cos(i/2),h=Math.sin(i/2),p=2*d*h,m=h*h,f=1-u*d*d,g=f?1/f:0,_=f?Math.acos(o*d)*Math.sqrt(1/f):0,y=.5*(2*_*o*h+2*i/Math.PI)-e,b=.5*(_*r+n)-t,x=.5*g*(u*m+_*o*d*c)+1/Math.PI,v=g*(p*l/4-_*r*h),w=.125*g*(l*h-_*r*u*p),E=.5*g*(c*d+_*m*o)+.5,M=v*w-E*x;s=(b*v-y*E)/M,a=(y*w-b*x)/M,i=k(i-s,-Math.PI,Math.PI),n=k(n-a,-$p,$p)}while((Math.abs(s)>r||Math.abs(a)>r)&&--o>0);return new Rl(w(i),w(n))}}class Gp extends Sp{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(v(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){const{scale:i,cosPhi:n}=this;return{x:v(e)*n*i+.5,y:-Math.sin(v(t))/n*i+.5,z:0}}unproject(e,t){const{scale:i,cosPhi:n}=this,o=-(t-.5)/i,r=k(w((e-.5)/i)/n,-180,180),s=Math.asin(k(o*n,-1,1)),a=k(w(s),-Zl,Zl);return new Rl(r,a)}}class Zp extends Np{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,t,i){const n=El(e,t,i);return Pa(n,n,Cl(fl(i))),{x:n[0],y:n[1],z:n[2]}}locationPoint(e,t){const i=wl(t.lat,t.lng),n=Ia([],i),o=e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(t),e._centerAltitude):e._centerAltitude;Aa(i,i,n,Vl(1,0)*oa*o);const r=ua(new Float64Array(16));return ha(r,e.pixelMatrix,e.globeMatrix),Pa(i,i,r),new y(i[0],i[1])}pixelsPerMeter(e,t){return Vl(1,0)*t}pixelSpaceConversion(e,t,i){const n=Vl(1,e)*t,o=Ii(Vl(1,45)*t,n,i);return this.pixelsPerMeter(e,t)/o}createTileMatrix(e,t,i){const n=kl(fl(i.canonical));return ha(new Float64Array(16),e.globeMatrix,n)}createInversionMatrix(e,t){const{center:i}=e,n=Cl(fl(t));return ga(n,n,v(i.lng)),fa(n,n,v(i.lat)),ma(n,n,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(n)}pointCoordinate(e,t,i,n){return hl(e,t,i,!0)||new Wl(0,0)}pointCoordinate3D(e,t,i){const n=this.pointCoordinate(e,t,i,0);return[n.x,n.y,n.z]}isPointAboveHorizon(e,t){return!hl(e,t.x,t.y,!1)}farthestPixelDistance(e){const t=function(e,t){const i=e.cameraToCenterDistance,n=e._centerAltitude*t,o=e._camera,r=e._camera.forward(),s=Ma([],La([],r,-i),[0,0,n]),a=e.worldSize/(2*Math.PI),l=[0,0,-a],c=e.width/e.height,u=Math.tan(e.fovAboveCenter),d=La([],o.up(),u),h=La([],o.right(),u*c),p=Ia([],Ma([],Ma([],r,d),h)),m=[];let f;if(new Qa(s,p).closestPointOnSphere(l,a,m)){const t=Ma([],m,l),i=ja([],t,s);f=Math.cos(e.fovAboveCenter)*wa(i)}else{const e=ja([],s,l),t=ja([],l,s);Ia(t,t);const i=wa(e)-a;f=Math.sqrt(i*(i+2*a));const n=Math.acos(f/(a+i))-Math.acos(Da(r,t));f*=Math.cos(n)}return 1.01*f}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),i=Ll(e.zoom);if(i>0){const n=Tp(e,Vl(1,e.center.lat)*e.worldSize),o=e.worldSize/(2*Math.PI),r=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Ii(t,n+o*(1-Math.cos(r)),Math.pow(i,10))}return t}upVector(e,t,i){return El(t,i,e,1)}upVectorScale(e){return{metersToTile:dl(Ml(fl(e)))}}}function Hp(e){const t=e.parallels,i=!!t&&Math.abs(t[0]+t[1])<.01;switch(e.name){case"mercator":return new Np(e);case"equirectangular":return new Bp(e);case"naturalEarth":return new Vp(e);case"equalEarth":return new Op(e);case"winkelTripel":return new qp(e);case"albers":return i?new Gp(e):new Lp(e);case"lambertConformalConic":return i?new Gp(e):new Fp(e);case"globe":return new Zp(e)}throw new Error(`Invalid projection name: ${e.name}`)}const Wp=$u.types,Xp=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Yp(e,t,i,n,o,r,s,a,l,c,u,d,h){const p=a?Math.min(bp,Math.round(a[0])):0,m=a?Math.min(bp,Math.round(a[1])):0;e.emplaceBack(t,i,Math.round(32*n),Math.round(32*o),r,s,(p<<1)+(l?1:0),m,16*c,16*u,256*d,256*h)}function Kp(e,t,i,n,o,r,s){e.emplaceBack(t,i,n,o,r,s)}function Qp(e,t,i,n,o){e.emplaceBack(t,i,n,o),e.emplaceBack(t,i,n,o),e.emplaceBack(t,i,n,o),e.emplaceBack(t,i,n,o)}function Jp(e){for(const t of e.sections)if(cr(t.text))return!0;return!1}class em{constructor(e){this.layoutVertexArray=new Xr,this.indexArray=new ns,this.programConfigurations=e,this.segments=new na,this.dynamicLayoutVertexArray=new Gr,this.opacityVertexArray=new Kr,this.placedSymbolArray=new fs,this.globeExtVertexArray=new Yr}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(e,t,i,n){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,kd.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Ld.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Xp,!0),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Sd.members,!0)),this.opacityVertexBuffer.itemSize=1),(i||n)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}}Yo(em,"SymbolBuffers");class tm{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new na,this.collisionVertexArray=new ts,this.collisionVertexArrayExt=new is}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Ad.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,Id.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Yo(tm,"CollisionBuffers");class im{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=ua([]),this.placementViewportMatrix=ua([]);const t=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Bd(this.zoom,t["text-size"]),this.iconSizeData=Bd(this.zoom,t["icon-size"]);const i=this.layers[0].layout,n=i.get("symbol-sort-key"),o=i.get("symbol-z-order");this.canOverlap=i.get("text-allow-overlap")||i.get("icon-allow-overlap")||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&void 0!==n.constantOr(1),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=i.get("text-writing-mode").map((e=>wh[e])),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=e.sourceID,this.projection=e.projection}createArrays(){this.text=new em(new Hs(this.layers,this.zoom,(e=>/^text/.test(e)))),this.icon=new em(new Hs(this.layers,this.zoom,(e=>/^icon/.test(e)))),this.glyphOffsetArray=new ys,this.lineVertexArray=new bs,this.symbolInstances=new _s}calculateGlyphDependencies(e,t,i,n,o){for(let i=0;i0)&&("constant"!==a.value.kind||a.value.value.length>0),d="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,h=r.get("symbol-sort-key");if(this.features=[],!u&&!d)return;const p=t.iconDependencies,m=t.glyphDependencies,f=t.availableImages,g=new wr(this.zoom);for(const{feature:t,id:l,index:c,sourceLayerIndex:_}of e){const e=o._featureFilter.needGeometry,y=nc(t,e);if(!o._featureFilter.filter(g,y,i))continue;if(e||(y.geometry=ic(t,i,n)),s&&1!==t.type&&i.z<=5){const e=y.geometry,t=.98078528056,n=(e,n)=>Da(El(e.x,e.y,i,1),El(n.x,n.y,i,1))=0;for(const i of b.sections)if(i.image)p[i.image.name]=!0;else{const n=ir(b.toString()),o=i.fontStack||e,r=m[o]=m[o]||{};this.calculateGlyphDependencies(i.text,r,t,this.allowVerticalPlacement,n)}}}"line"===r.get("symbol-placement")&&(this.features=function(e){const t={},i={},n=[];let o=0;function r(t){n.push(e[t]),o++}function s(e,t,o){const r=i[e];return delete i[e],i[t]=r,n[r].geometry[0].pop(),n[r].geometry[0]=n[r].geometry[0].concat(o[0]),r}function a(e,i,o){const r=t[i];return delete t[i],t[e]=r,n[r].geometry[0].shift(),n[r].geometry[0]=o[0].concat(n[r].geometry[0]),r}function l(e,t,i){const n=i?t[0][t[0].length-1]:t[0][0];return`${e}:${n.x}:${n.y}`}for(let c=0;ce.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((e,t)=>e.sortKey-t.sortKey))}update(e,t,i,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,i,n),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,i,n))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Hp(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const i=this.lineVertexArray.length;if(void 0!==e.segment)for(const{x:e,y:i}of t)this.lineVertexArray.emplaceBack(e,i);return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,t,i,n,o,r,s,a,l,c,u,d,h,p){const m=e.indexArray,f=e.layoutVertexArray,g=e.globeExtVertexArray,_=e.segments.prepareSegment(4*t.length,f,m,this.canOverlap?r.sortKey:void 0),y=this.glyphOffsetArray.length,b=_.vertexLength,x=this.allowVerticalPlacement&&s===wh.vertical?Math.PI/2:0,v=r.text&&r.text.sections;for(let n=0;n=0?t.rightJustifiedTextSymbolIndex:t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.leftJustifiedTextSymbolIndex>=0?t.leftJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex>=0?t.verticalPlacedTextSymbolIndex:n),r=jd(this.textSizeData,e,o)/Pd;return this.tilePixelRatio*r}getSymbolInstanceIconSize(e,t,i){const n=this.icon.placedSymbolArray.get(i),o=jd(this.iconSizeData,e,n);return this.tilePixelRatio*o}_commitDebugCollisionVertexUpdate(e,t,i){e.emplaceBack(t,-i,-i),e.emplaceBack(t,i,-i),e.emplaceBack(t,i,i),e.emplaceBack(t,-i,i)}_updateTextDebugCollisionBoxes(e,t,i,n,o,r){for(let s=n;s0}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(e,t){const i=e.placedSymbolArray.get(t),n=i.vertexStartIndex+4*i.numGlyphs;for(let t=i.vertexStartIndex;tn[e]-n[t]||o[t]-o[e])),r}addToSortKeyRanges(e,t){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex);const{rightJustifiedTextSymbolIndex:i,centerJustifiedTextSymbolIndex:n,leftJustifiedTextSymbolIndex:o,verticalPlacedTextSymbolIndex:r,placedIconSymbolIndex:s,verticalPlacedIconSymbolIndex:a}=t;i>=0&&this.addIndicesForPlacedSymbol(this.text,i),n>=0&&n!==i&&this.addIndicesForPlacedSymbol(this.text,n),o>=0&&o!==n&&o!==i&&this.addIndicesForPlacedSymbol(this.text,o),r>=0&&this.addIndicesForPlacedSymbol(this.text,r),s>=0&&this.addIndicesForPlacedSymbol(this.icon,s),a>=0&&this.addIndicesForPlacedSymbol(this.icon,a)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Yo(im,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),im.MAX_GLYPHS=65535,im.addDynamicAttributes=Qp;const nm=new Pr({"symbol-placement":new Ir(et.layout_symbol["symbol-placement"]),"symbol-spacing":new Ir(et.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ir(et.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Dr(et.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ir(et.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ir(et.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Ir(et.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ir(et.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ir(et.layout_symbol["icon-rotation-alignment"]),"icon-size":new Dr(et.layout_symbol["icon-size"]),"icon-text-fit":new Ir(et.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ir(et.layout_symbol["icon-text-fit-padding"]),"icon-image":new Dr(et.layout_symbol["icon-image"]),"icon-rotate":new Dr(et.layout_symbol["icon-rotate"]),"icon-padding":new Ir(et.layout_symbol["icon-padding"]),"icon-keep-upright":new Ir(et.layout_symbol["icon-keep-upright"]),"icon-offset":new Dr(et.layout_symbol["icon-offset"]),"icon-anchor":new Dr(et.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ir(et.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ir(et.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ir(et.layout_symbol["text-rotation-alignment"]),"text-field":new Dr(et.layout_symbol["text-field"]),"text-font":new Dr(et.layout_symbol["text-font"]),"text-size":new Dr(et.layout_symbol["text-size"]),"text-max-width":new Dr(et.layout_symbol["text-max-width"]),"text-line-height":new Dr(et.layout_symbol["text-line-height"]),"text-letter-spacing":new Dr(et.layout_symbol["text-letter-spacing"]),"text-justify":new Dr(et.layout_symbol["text-justify"]),"text-radial-offset":new Dr(et.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ir(et.layout_symbol["text-variable-anchor"]),"text-anchor":new Dr(et.layout_symbol["text-anchor"]),"text-max-angle":new Ir(et.layout_symbol["text-max-angle"]),"text-writing-mode":new Ir(et.layout_symbol["text-writing-mode"]),"text-rotate":new Dr(et.layout_symbol["text-rotate"]),"text-padding":new Ir(et.layout_symbol["text-padding"]),"text-keep-upright":new Ir(et.layout_symbol["text-keep-upright"]),"text-transform":new Dr(et.layout_symbol["text-transform"]),"text-offset":new Dr(et.layout_symbol["text-offset"]),"text-allow-overlap":new Ir(et.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Ir(et.layout_symbol["text-ignore-placement"]),"text-optional":new Ir(et.layout_symbol["text-optional"])});var om={paint:new Pr({"icon-opacity":new Dr(et.paint_symbol["icon-opacity"]),"icon-color":new Dr(et.paint_symbol["icon-color"]),"icon-halo-color":new Dr(et.paint_symbol["icon-halo-color"]),"icon-halo-width":new Dr(et.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Dr(et.paint_symbol["icon-halo-blur"]),"icon-translate":new Ir(et.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ir(et.paint_symbol["icon-translate-anchor"]),"text-opacity":new Dr(et.paint_symbol["text-opacity"]),"text-color":new Dr(et.paint_symbol["text-color"],{runtimeType:ht,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Dr(et.paint_symbol["text-halo-color"]),"text-halo-width":new Dr(et.paint_symbol["text-halo-width"]),"text-halo-blur":new Dr(et.paint_symbol["text-halo-blur"]),"text-translate":new Ir(et.paint_symbol["text-translate"]),"text-translate-anchor":new Ir(et.paint_symbol["text-translate-anchor"])}),layout:nm};class rm{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:lt,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Yo(rm,"FormatSectionOverride",{omit:["defaultValue"]});class sm extends ea{constructor(e){super(e,om)}recalculate(e,t){super.recalculate(e,t),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const i=this.layout.get("text-writing-mode");if(i){const e=[];for(const t of i)e.indexOf(t)<0&&e.push(t);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(e,t,i,n){const o=this.layout.get(e).evaluate(t,{},i,n),r=this._unevaluatedLayout._values[e];return r.isDataDriven()||Xn(r.value)||!o?o:function(e,t){return t.replace(/{([^{}]+)}/g,((t,i)=>i in e?String(e[i]):""))}(t.properties,o)}createBucket(e){return new im(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of om.paint.overridableProperties){if(!sm.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),i=new rm(t),n=new Wn(i,t.property.specification);let o=null;o="constant"===t.value.kind||"source"===t.value.kind?new Kn("source",n):new Qn("composite",n,t.value.zoomStops,t.value._interpolationType),this.paint._values[e]=new Lr(t.property,o,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven())&&sm.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const i=e.get("text-field"),n=om.paint.properties[t];let o=!1;const r=e=>{for(const t of e)if(n.overrides&&n.overrides.hasOverride(t))return void(o=!0)};if("constant"===i.value.kind&&i.value.value instanceof Pt)r(i.value.value.sections);else if("source"===i.value.kind){const e=t=>{o||(t instanceof Ut&&Rt(t.value)===gt?r(t.value.sections):t instanceof Zt?r(t.sections):t.eachChild(e))},t=i.value;t._styleExpression&&e(t._styleExpression.expression)}return o}getProgramConfiguration(e){return new Zs(this,e)}}var am={paint:new Pr({"background-color":new Ir(et.paint_background["background-color"]),"background-pattern":new Ir(et.paint_background["background-pattern"]),"background-opacity":new Ir(et.paint_background["background-opacity"])})},lm={paint:new Pr({"raster-opacity":new Ir(et.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ir(et.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ir(et.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ir(et.paint_raster["raster-brightness-max"]),"raster-saturation":new Ir(et.paint_raster["raster-saturation"]),"raster-contrast":new Ir(et.paint_raster["raster-contrast"]),"raster-resampling":new Ir(et.paint_raster["raster-resampling"]),"raster-fade-duration":new Ir(et.paint_raster["raster-fade-duration"])})};class cm extends ea{constructor(e){super(e,{}),this.implementation=e}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}isLayerDraped(){return void 0!==this.implementation.renderToTile}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}var um={paint:new Pr({"sky-type":new Ir(et.paint_sky["sky-type"]),"sky-atmosphere-sun":new Ir(et.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Ir(et.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Ir(et.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Ir(et.paint_sky["sky-gradient-radius"]),"sky-gradient":new zr(et.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Ir(et.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Ir(et.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Ir(et.paint_sky["sky-opacity"])})};function dm(e,t,i){const n=[0,0,1],o=qa([]);return Za(o,o,i?-v(e)+Math.PI:v(e)),Ga(o,o,-v(t)),Oa(n,n,o),Ia(n,n)}const hm={circle:class extends ea{constructor(e){super(e,Mc)}createBucket(e){return new sc(e)}queryRadius(e){const t=e;return bc("circle-radius",this,t)+bc("circle-stroke-width",this,t)+xc(this.paint.get("circle-translate"))}queryIntersectsFeature(e,t,i,n,o,r,s,a){const l=wc(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),r.angle,e.pixelToTileUnitsFactor),c=this.paint.get("circle-radius").evaluate(t,i)+this.paint.get("circle-stroke-width").evaluate(t,i);return Tc(e,n,r,s,a,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),l,c)}getProgramIds(){return["circle"]}getProgramConfiguration(e){return new Zs(this,e)}},heatmap:class extends ea{createBucket(e){return new Ac(e)}constructor(e){super(e,Bc),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=jc({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(e){return bc("heatmap-radius",this,e)}queryIntersectsFeature(e,t,i,n,o,r,s,a){const l=this.paint.get("heatmap-radius").evaluate(t,i);return Tc(e,n,r,s,a,!0,!0,new y(0,0),l)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(e){return new Zs(this,e)}},hillshade:class extends ea{constructor(e){super(e,Rc)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}},fill:class extends ea{constructor(e){super(e,Tu)}getProgramIds(){const e=this.paint.get("fill-pattern"),t=e&&e.constantOr(1),i=[t?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(t&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getProgramConfiguration(e){return new Zs(this,e)}recalculate(e,t){super.recalculate(e,t);const i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Eu(e)}queryRadius(){return xc(this.paint.get("fill-translate"))}queryIntersectsFeature(e,t,i,n,o,r){return!e.queryGeometry.isAboveHorizon&&cc(vc(e.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),r.angle,e.pixelToTileUnitsFactor),n)}isTileClipped(){return!0}},"fill-extrusion":class extends ea{constructor(e){super(e,sd)}createBucket(e){return new Yu(e)}queryRadius(){return xc(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}getProgramConfiguration(e){return new Zs(this,e)}queryIntersectsFeature(e,t,i,n,o,r,s,a,l){const c=wc(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),r.angle,e.pixelToTileUnitsFactor),u=this.paint.get("fill-extrusion-height").evaluate(t,i),d=this.paint.get("fill-extrusion-base").evaluate(t,i),h=[0,0],p=a&&r.elevation,m=r.elevation?r.elevation.exaggeration():1,f=e.tile.getBucket(this);if(p&&f instanceof Yu){const e=f.centroidVertexArray,t=l+1;te.polygon)).flat());const g=p?a:null,[_,b]=function(e,t,i,n,o,r,s,a,l,c,u){return"globe"===e.projection.name?function(e,t,i,n,o,r,s,a,l,c,u){const d=[],h=[],p=e.projection.upVectorScale(u,e.center.lat,e.worldSize).metersToTile,m=[0,0,0,1],f=[0,0,0,1],g=(e,t,i,n)=>{e[0]=t,e[1]=i,e[2]=n,e[3]=1},_=nd();i>0&&(i+=_),n+=_;for(const _ of t){const t=[],y=[];for(const d of _){const h=d.x+o.x,_=d.y+o.y,b=e.projection.projectTilePoint(h,_,u),x=e.projection.upVector(u,d.x,d.y);let v=i,w=n;if(s){const e=fd(h,_,i,n,s,a,l,c);v+=e.base,w+=e.top}0!==i?g(m,b.x+x[0]*p*v,b.y+x[1]*p*v,b.z+x[2]*p*v):g(m,b.x,b.y,b.z),g(f,b.x+x[0]*p*w,b.y+x[1]*p*w,b.z+x[2]*p*w),Pa(m,m,r),Pa(f,f,r),t.push(new hd(m[0],m[1],m[2])),y.push(new hd(f[0],f[1],f[2]))}d.push(t),h.push(y)}return[d,h]}(e,t,i,n,o,r,s,a,l,c,u):s?function(e,t,i,n,o,r,s,a,l){const c=[],u=[],d=[0,0,0,1];for(const h of e){const e=[],p=[];for(const c of h){const u=c.x+n.x,h=c.y+n.y,m=fd(u,h,t,i,r,s,a,l);d[0]=u,d[1]=h,d[2]=m.base,d[3]=1,Va(d,d,o),d[3]=Math.max(d[3],1e-5);const f=new hd(d[0]/d[3],d[1]/d[3],d[2]/d[3]);d[0]=u,d[1]=h,d[2]=m.top,d[3]=1,Va(d,d,o),d[3]=Math.max(d[3],1e-5);const g=new hd(d[0]/d[3],d[1]/d[3],d[2]/d[3]);e.push(f),p.push(g)}c.push(e),u.push(p)}return[c,u]}(t,i,n,o,r,s,a,l,c):function(e,t,i,n,o){const r=[],s=[],a=o[8]*t,l=o[9]*t,c=o[10]*t,u=o[11]*t,d=o[8]*i,h=o[9]*i,p=o[10]*i,m=o[11]*i;for(const t of e){const e=[],i=[];for(const r of t){const t=r.x+n.x,s=r.y+n.y,f=o[0]*t+o[4]*s+o[12],g=o[1]*t+o[5]*s+o[13],_=o[2]*t+o[6]*s+o[14],y=o[3]*t+o[7]*s+o[15],b=f+a,x=g+l,v=_+c,w=Math.max(y+u,1e-5),E=f+d,M=g+h,T=_+p,C=Math.max(y+m,1e-5);e.push(new hd(b/w,x/w,v/w)),i.push(new hd(E/C,M/C,T/C))}r.push(e),s.push(i)}return[r,s]}(t,i,n,o,r)}(r,n,d,u,c,s,g,h,m,r.center.lat,e.tileID.canonical),x=e.queryGeometry;return function(e,t,i){let n=1/0;cc(i,t)&&(n=md(i,t[0]));for(let o=0;o=3)for(let t=0;t{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback()}),0))}remove(){this._channel=void 0,this._callback=()=>{}}}class fm{constructor(){this.tasks={},this.taskQueue=[],R(["process"],this),this.invoker=new mm(this.process),this.nextId=0}add(e,t){const i=this.nextId++,n=function({type:e,isSymbolTile:t,zoom:i}){return i=i||0,"message"===e?0:"maybePrepare"!==e||t?"parseTile"!==e||t?"parseTile"===e&&t?300-i:"maybePrepare"===e&&t?400-i:500:200-i:100-i}(t);if(0===n){H();try{e()}finally{}return{cancel:()=>{}}}return this.tasks[i]={fn:e,metadata:t,priority:n,id:i},this.taskQueue.push(i),this.invoker.trigger(),{cancel:()=>{delete this.tasks[i]}}}process(){H();try{if(this.taskQueue=this.taskQueue.filter((e=>!!this.tasks[e])),!this.taskQueue.length)return;const e=this.pick();if(null===e)return;const t=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!t)return;t.fn()}finally{}}pick(){let e=null,t=1/0;for(let i=0;i>=1)>1;){const e=i+o>>1,l=n+r>>1;1&t?(o=i,r=n,i=s,n=a):(i=o,n=r,o=s,r=a),s=e,a=l}const l=4*e;vm[l+0]=i,vm[l+1]=n,vm[l+2]=o,vm[l+3]=r}const wm=new Uint16Array(2178),Em=new Uint8Array(1089),Mm=new Uint16Array(1089);function Tm(e){return 0===e?-.03125:32===e?.03125:0}var Cm=Fr([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);const km={type:2,extent:oa,loadGeometry:()=>[[new y(0,0),new y(oa+1,0),new y(oa+1,oa+1),new y(0,oa+1),new y(0,0)]]};class Sm{constructor(e,t,i,n,o){this.tileID=e,this.uid=P(),this.uses=0,this.tileSize=t,this.tileZoom=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=o,this.expiredRequestCount=0,this.state="loading",n&&n.transform&&(this.projection=n.transform.projection)}registerFadeDuration(e){const t=e+this.timeAdded;tt.getLayer(e))).filter(Boolean);if(0!==e.length){n.layers=e,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(const t of e)i[t.id]=n}}return i}(e.buckets,t.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const t=this.buckets[e];if(t instanceof im){if(this.hasSymbolBuckets=!0,!i)break;t.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const t=this.buckets[e];if(t instanceof im&&t.hasRTLText){this.hasRTLText=!0,vr.isLoading()||vr.isLoaded()||"deferred"!==br()||xr();break}}this.queryPadding=0;for(const e in this.buckets){const i=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(e).queryRadius(i))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),e.lineAtlas&&(this.lineAtlas=e.lineAtlas)}else this.collisionBoxArray=new ps}unloadVectorData(){if(this.hasData()){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(e){return this.buckets[e.id]}upload(e){for(const t in this.buckets){const i=this.buckets[t];i.uploadPending()&&i.upload(e)}const t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new pm(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new pm(e,this.glyphAtlasImage,t.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new pm(e,this.lineAtlas.image,t.ALPHA),this.lineAtlas.uploaded=!0)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,i,n,o,r,s,a){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:n,pixelPosMatrix:s,transform:r,params:o,tileTransform:this.tileTransform},e,t,i):{}}querySourceFeatures(e,t){const i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;const n=i.loadVTLayers(),o=t?t.sourceLayer:"",r=n._geojsonTileLayer||n[o];if(!r)return;const s=ho(t&&t.filter),{z:a,x:l,y:c}=this.tileID.canonical,u={z:a,x:l,y:c};for(let t=0;te)i=!1;else if(t)if(this.expirationTime=0;e--){const t=4*e,i=vm[t+0],n=vm[t+1],o=vm[t+2],r=vm[t+3],s=i+o>>1,a=n+r>>1,l=s+a-n,c=a+i-s,u=n*xm+i,d=r*xm+o,h=a*xm+s,p=Math.hypot((wm[2*u+0]+wm[2*d+0])/2-wm[2*h+0],(wm[2*u+1]+wm[2*d+1])/2-wm[2*h+1])>=16;Em[h]=Em[h]||(p?1:0),e<1022&&(Em[h]=Em[h]||Em[(n+c>>1)*xm+(i+l>>1)]||Em[(r+c>>1)*xm+(o+l>>1)])}const o=new $r,r=new ns;let s=0;function a(e,t){const i=t*xm+e;return 0===Mm[i]&&(o.emplaceBack(wm[2*i+0],wm[2*i+1],e*oa/bm,t*oa/bm),Mm[i]=++s),Mm[i]-1}function l(e,t,i,n,o,s){const c=e+i>>1,u=t+n>>1;if(Math.abs(e-o)+Math.abs(t-s)>1&&Em[u*xm+c])l(o,s,e,t,c,u),l(i,n,o,s,c,u);else{const l=a(e,t),c=a(i,n),u=a(o,s);r.emplaceBack(l,c,u)}}return l(0,0,bm,bm,bm,0),l(bm,bm,0,0,0,bm),{vertices:o,indices:r}}(this.tileID.canonical,t);n=e.vertices,o=e.indices}else{n=new $r,o=new ns;for(const{x:e,y:t}of i)n.emplaceBack(e,t,0,0);const e=mu(n.int16,void 0,4);for(let t=0;t0&&(s=da(new Float64Array(16),t.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(e,n,t,o,s,r),this._makeGlobeTileDebugTextBuffer(e,n,t,o,s,r)}_globePoint(e,t,i,n,o,r,s){let a=El(e,t,i);if(r){const o=1<.5?d=-1:u<-.5&&(d=1);let h=(e/oa+i.x)/o+d,p=(t/oa+i.y)/o;h=(h-l)*n._pixelsPerMercatorPixel+l,p=(p-c)*n._pixelsPerMercatorPixel+c;const m=[h*n.worldSize,p*n.worldSize,0];Pa(m,m,r),a=gl(a,m,s)}return Pa(a,a,o)}_makeGlobeTileDebugBorderBuffer(e,t,i,n,o,r){const s=new Ur,a=new us,l=new Vr,c=(e,c,u,d,h)=>{const p=(u-e)/(h-1),m=(d-c)/(h-1),f=s.length;for(let u=0;uu*e+t;for(let e=0;et[s])return null}else{const a=1/n[s];let l=(e[s]-i[s])*a,c=(t[s]-i[s])*a;if(l>c){const e=l;l=c,c=e}if(l>o&&(o=l),cr)return null}return o}function Dm(e,t,i,n,o,r,s,a,l,c,u){const d=n-e,h=o-t,p=r-i,m=s-e,f=a-t,g=l-i,_=u[1]*g-u[2]*f,y=u[2]*m-u[0]*g,b=u[0]*f-u[1]*m,x=d*_+h*y+p*b;if(Math.abs(x)<1e-15)return null;const v=1/x,w=c[0]-e,E=c[1]-t,M=c[2]-i,T=(w*_+E*y+M*b)*v;if(T<0||T>1)return null;const C=E*p-M*h,k=M*d-w*p,S=w*h-E*d,L=(u[0]*C+u[1]*k+u[2]*S)*v;return L<0||T+L>1?null:(m*C+f*k+g*S)*v}function zm(e,t,i){return(e-t)/(i-t)}function Pm(e,t,i,n,o,r,s,a,l){const c=1<{const r=n?1:0,s=(e+1)*i-r,a=t*i,l=(t+1)*i-r;o[0]=e*i,o[1]=a,o[2]=s,o[3]=l};let s=new Am(n);const a=[];for(let t=0;t=1;n/=2){const e=i[i.length-1];s=new Am(n);for(let t=0;t0;){const{idx:a,t:p,nodex:m,nodey:f,depth:g}=h.pop();if(this.leaves[a]){Pm(m,f,g,e,t,i,n,u,d);const a=1<=e[2])return p}continue}let _=0;for(let h=0;h=l[c[i]]&&(c.splice(i,0,h),t=!0);t||(c[_]=h),_++}}for(let e=0;e<_;e++){const t=c[e];h.push({idx:this.childOffsets[a]+t,t:l[t],nodex:(m<<1)+this._siblingOffset[t][0],nodey:(f<<1)+this._siblingOffset[t][1],depth:g+1})}}return null}_addNode(e,t,i){return this.minimums.push(e),this.maximums.push(t),this.leaves.push(i),this.childOffsets.push(0),this.nodeCount++}_construct(e,t,i,n,o){if(1===e[n].isLeaf(t,i))return;this.childOffsets[o]||(this.childOffsets[o]=this.nodeCount);const r=n-1,s=e[r];let a=0,l=0;for(let e=0;e=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}static pack(e,t){const i=[0,0,0,0],n=Um.getUnpackVector(t);let o=Math.floor((e+n[3])/n[2]);return i[2]=o%256,o=Math.floor(o/256),i[1]=o%256,o=Math.floor(o/256),i[0]=o,i}getPixels(){return new Oc({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let n=t*this.dim,o=t*this.dim+this.dim,r=i*this.dim,s=i*this.dim+this.dim;switch(t){case-1:n=o-1;break;case 1:o=n+1}switch(i){case-1:r=s-1;break;case 1:s=r+1}const a=-t*this.dim,l=-i*this.dim;for(let t=r;t{this.remove(e,o)}),i)),this.data[n].push(o),this.order.push(n),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){const t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;const i=e.wrapped().key,n=void 0===t?0:this.data[i].indexOf(t),o=this.data[i][n];return this.data[i].splice(n,1),o.timeout&&clearTimeout(o.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(o.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){const t=[];for(const i in this.data)for(const n of this.data[i])e(n.value)||t.push(n);for(const e of t)this.remove(e.value.tileID,e)}}class $m{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}}$m.ReadOnly=!1,$m.ReadWrite=!0,$m.disabled=new $m(519,$m.ReadOnly,[0,1]);const qm=7680;class Gm{constructor(e,t,i,n,o,r){this.test=e,this.ref=t,this.mask=i,this.fail=n,this.depthFail=o,this.pass=r}}Gm.disabled=new Gm({func:519,mask:0},0,0,qm,qm,qm);class Zm{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}}Zm.Replace=[1,0],Zm.disabled=new Zm(Zm.Replace,It.transparent,[!1,!1,!1,!1]),Zm.unblended=new Zm(Zm.Replace,It.transparent,[!0,!0,!0,!0]),Zm.alphaBlended=new Zm([1,771],It.transparent,[!0,!0,!0,!0]);const Hm=1029,Wm=2305;class Xm{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}}Xm.disabled=new Xm(!1,Hm,Wm),Xm.backCCW=new Xm(!0,Hm,Wm),Xm.backCW=new Xm(!0,Hm,2304),Xm.frontCW=new Xm(!0,1028,2304),Xm.frontCCW=new Xm(!0,1028,Wm);class Ym extends Je{constructor(e,t,i){super(),this.id=e,this._onlySymbols=i,t.on("data",(e=>{"source"===e.dataType&&"metadata"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))})),t.on("error",(()=>{this._sourceErrored=!0})),this._source=t,this._tiles={},this._cache=new Vm(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._loadedParentTiles={},this._coveredTiles={},this._state=new Lm,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(e){this.map=e,this._minTileCacheSize=void 0===this._minTileCacheSize&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&e?e._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const e in this._tiles){const t=this._tiles[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,t){return e.isSymbolTile=this._onlySymbols,this._source.loadTile(e,t)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e,(()=>{}))}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e,(()=>{}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const t in this._tiles){const i=this._tiles[t];i.upload(e),i.prepare(this.map.style.imageManager)}}getIds(){return I(this._tiles).map((e=>e.tileID)).sort(Km).map((e=>e.key))}getRenderableIds(e){const t=[];for(const i in this._tiles)this._isIdRenderable(+i,e)&&t.push(this._tiles[i]);return e?t.sort(((e,t)=>{const i=e.tileID,n=t.tileID,o=new y(i.canonical.x,i.canonical.y)._rotate(this.transform.angle),r=new y(n.canonical.x,n.canonical.y)._rotate(this.transform.angle);return i.overscaledZ-n.overscaledZ||r.y-o.y||r.x-o.x})).map((e=>e.tileID.key)):t.map((e=>e.tileID)).sort(Km).map((e=>e.key))}hasRenderableParent(e){const t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(+e,"reloading")}}_reloadTile(e,t){const i=this._tiles[e];i&&("loading"!==i.state&&(i.state=t),this._loadTile(i,this._tileLoaded.bind(this,i,e,t)))}_tileLoaded(e,t,i,n){if(n)if(e.state="errored",404!==n.status)this._source.fire(new Qe(n,{tile:e}));else if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const e=this.map.painter.terrain;this.update(this.transform,e.getScaledDemTileSize(),!0),e.resetTileLookupCache(this.id)}else this.update(this.transform);else e.timeAdded=We.now(),"expired"===i&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),"raster-dem"===this._source.type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),this._source.fire(new Ke("data",{dataType:"source",tile:e,coord:e.tileID,sourceCacheId:this.id}))}_backfillDEM(e){const t=this.getRenderableIds();for(let n=0;n1||(Math.abs(i)>1&&(1===Math.abs(i+o)?i+=o:1===Math.abs(i-o)&&(i-=o)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,n),e.neighboringTiles&&e.neighboringTiles[r]&&(e.neighboringTiles[r].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,i,n){for(const o in this._tiles){let r=this._tiles[o];if(n[o]||!r.hasData()||r.tileID.overscaledZ<=t||r.tileID.overscaledZ>i)continue;let s=r.tileID;for(;r&&r.tileID.overscaledZ>t+1;){const e=r.tileID.scaledTo(r.tileID.overscaledZ-1);r=this._tiles[e.key],r&&r.hasData()&&(s=e)}let a=s;for(;a.overscaledZ>t;)if(a=a.scaledTo(a.overscaledZ-1),e[a.key]){n[s.key]=s;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){const i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=t?i:null}for(let i=e.overscaledZ-1;i>=t;i--){const t=e.scaledTo(i),n=this._getLoadedTile(t);if(n)return n}}_getLoadedTile(e){const t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,t){t=t||this._source.tileSize;const i=Math.ceil(e.width/t)+1,n=Math.ceil(e.height/t)+1,o=Math.floor(i*n*5),r="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,o):o,s="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(s)}handleWrapJump(e){const t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){const e={};for(const i in this._tiles){const n=this._tiles[i];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),e[n.tileID.key]=n}this._tiles=e;for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e in this._tiles)this._setTileReloadTimer(+e,this._tiles[e])}}update(e,t,i){if(this.transform=e,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!i)return;let n;this.updateCacheSize(e,t),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?n=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new ud(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(n=e.coveringTiles({tileSize:t||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!i,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(n=n.filter((e=>this._source.hasTile(e))))):n=[];const o=this._updateRetainedTiles(n);if(Qm(this._source.type)&&0!==n.length){const e={},t={},i=Object.keys(o);for(const n of i){const i=o[n],r=this._tiles[n];if(!r||r.fadeEndTime&&r.fadeEndTime<=We.now())continue;const s=this.findLoadedParent(i,Math.max(i.overscaledZ-Ym.maxOverzooming,this._source.minzoom));s&&(this._addTile(s.tileID),e[s.tileID.key]=s.tileID),t[n]=i}const r=n[n.length-1].overscaledZ;for(const e in this._tiles){const i=this._tiles[e];if(o[e]||!i.hasData())continue;let n=i.tileID;for(;n.overscaledZ>r;){n=n.scaledTo(n.overscaledZ-1);const r=this._tiles[n.key];if(r&&r.hasData()&&t[n.key]){o[e]=i.tileID;break}}}for(const t in e)o[t]||(this._coveredTiles[t]=!0,o[t]=e[t])}for(const e in o)this._tiles[e].clearFadeHold();const r=function(e,t){const i=[];for(const n in e)n in t||i.push(n);return i}(this._tiles,o);for(const e of r){const t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(+e)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}_updateRetainedTiles(e){const t={};if(0===e.length)return t;const i={},n=e.reduce(((e,t)=>Math.min(e,t.overscaledZ)),1/0),o=e[0].overscaledZ,r=Math.max(o-Ym.maxOverzooming,this._source.minzoom),s=Math.max(o+Ym.maxUnderzooming,this._source.minzoom),a={};for(const i of e){const e=this._addTile(i);t[i.key]=i,e.hasData()||n=this._source.maxzoom){const e=n.children(this._source.maxzoom)[0],i=this.getTile(e);if(i&&i.hasData()){t[e.key]=e;continue}}else{const e=n.children(this._source.maxzoom);if(t[e[0].key]&&t[e[1].key]&&t[e[2].key]&&t[e[3].key])continue}let o=e.wasRequested();for(let s=n.overscaledZ-1;s>=r;--s){const r=n.scaledTo(s);if(i[r.key])break;if(i[r.key]=!0,e=this.getTile(r),!e&&o&&(e=this._addTile(r)),e&&(t[r.key]=r,o=e.wasRequested(),e.hasData()))break}}return t}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const t=[];let i,n=this._tiles[e].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){i=this._loadedParentTiles[n.key];break}t.push(n.key);const e=n.scaledTo(n.overscaledZ-1);if(i=this._getLoadedTile(e),i)break;n=e}for(const e of t)this._loadedParentTiles[e]=i}}_addTile(e){let t=this._tiles[e.key];if(t)return t;t=this._cache.getAndRemove(e),t&&(this._setTileReloadTimer(e.key,t),t.tileID=e,this._state.initializeTileState(t,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,t)));const i=Boolean(t);if(!i){const i=this.map?this.map.painter:null;t=new Sm(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,i,this._isRaster),this._loadTile(t,this._tileLoaded.bind(this,t,e.key,t.state))}return t?(t.uses++,this._tiles[e.key]=t,i||this._source.fire(new Ke("dataloading",{tile:t,coord:t.tileID,dataType:"source"})),t):null}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,"expired"),delete this._timers[e]}),i))}_removeTile(e){const t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&"reloading"!==t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(e,t,i){const n=[],o=this.transform;if(!o)return n;const r="globe"===o.projection.name,s=Nl(o.center.lng);for(const a in this._tiles){const l=this._tiles[a];if(i&&l.clearQueryDebugViz(),l.holdingForFade())continue;let c;if(r){const e=l.tileID.canonical;if(0===e.z){const t=[Math.abs(k(s,...Jm(e,-1))-s),Math.abs(k(s,...Jm(e,1))-s)];c=[0,2*t.indexOf(Math.min(...t))-1]}else{const t=[Math.abs(k(s,...Jm(e,-1))-s),Math.abs(k(s,...Jm(e,0))-s),Math.abs(k(s,...Jm(e,1))-s)];c=[t.indexOf(Math.min(...t))-1]}}else c=[0];for(const i of c){const r=e.containsTile(l,o,t,i);r&&n.push(r)}}return n}getVisibleCoordinates(e){const t=this.getRenderableIds(e).map((e=>this._tiles[e].tileID));for(const e of t)e.projMatrix=this.transform.calculateProjMatrix(e.toUnwrapped());return t}hasTransition(){if(this._source.hasTransition())return!0;if(Qm(this._source.type))for(const e in this._tiles){const t=this._tiles[e];if(void 0!==t.fadeEndTime&&t.fadeEndTime>=We.now())return!0}return!1}setFeatureState(e,t,i){this._state.updateState(e=e||"_geojsonTileLayer",t,i)}removeFeatureState(e,t,i){this._state.removeFeatureState(e=e||"_geojsonTileLayer",t,i)}getFeatureState(e,t){return this._state.getState(e=e||"_geojsonTileLayer",t)}setDependencies(e,t,i){const n=this._tiles[e];n&&n.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(const i in this._tiles)this._tiles[i].hasDependency(e,t)&&this._reloadTile(+i,"reloading");this._cache.filter((i=>!i.hasDependency(e,t)))}_preloadTiles(e,t){if(!this._sourceLoaded){const i=()=>{this._sourceLoaded&&(this._source.off("data",i),this._preloadTiles(e,t))};return void this._source.on("data",i)}const i=new Map,n=Array.isArray(e)?e:[e],o=this.map.painter.terrain,r=this.usedForTerrain&&o?o.getScaledDemTileSize():this._source.tileSize;for(const e of n){const t=e.coveringTiles({tileSize:r,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const e of t)i.set(e.key,e);this.usedForTerrain&&e.updateElevation(!1)}A(Array.from(i.values()),((e,t)=>{const i=new Sm(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(i,(e=>{"raster-dem"===this._source.type&&i.dem&&this._backfillDEM(i),t(e,i)}))}),t)}}function Km(e,t){const i=Math.abs(2*e.wrap)-+(e.wrap<0),n=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||n-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function Qm(e){return"raster"===e||"image"===e||"video"===e||"custom"===e}function Jm(e,t){const i=1<=0&&n[3]>=0&&a.insert(s,n[0],n[1],n[2],n[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Vu(new hh(this.rawTileData)).layers,this.sourceLayerCoder=new gm(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,t,i,n){this.loadVTLayers();const o=e.params||{},r=ho(o.filter),s=e.tileResult,a=e.transform,l=s.bufferedTilespaceBounds,c=this.grid.query(l.min.x,l.min.y,l.max.x,l.max.y,((e,t,i,n)=>_c(s.bufferedTilespaceGeometry,e,t,i,n)));c.sort(of);let u=null;a.elevation&&c.length>0&&(u=ef.create(a.elevation,this.tileID));const d={};let h;for(let a=0;a(m||(m=ic(t,this.tileID.canonical,e.tileTransform)),i.queryIntersectsFeature(s,t,n,m,this.z,e.transform,e.pixelPosMatrix,u,o))))}return d}loadMatchingFeature(e,t,i,n,o,r,s,a,l){const{featureIndex:c,bucketIndex:u,sourceLayerIndex:d,layoutVertexArrayOffset:h}=t,p=this.bucketLayerIDs[u];if(n&&!function(e,t){for(let i=0;i=0)return!0;return!1}(n,p))return;const m=this.sourceLayerCoder.decode(d),f=this.vtLayers[m].feature(c);if(i.needGeometry){const e=nc(f,!0);if(!i.filter(new wr(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!i.filter(new wr(this.tileID.overscaledZ),f))return;const g=this.getId(f,m);for(let t=0;t{const s=t instanceof Ar?t.get(r):null;return s&&s.evaluate?s.evaluate(i,n,o):s}))}function of(e,t){return t-e}Yo(tf,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});class rf{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.image=new Pc({width:e,height:t}),this.positions={},this.uploaded=!1}getDash(e,t){const i=this.getKey(e,t);return this.positions[i]}trim(){const e=this.width,t=this.height=B(this.nextRow);this.image.resize({width:e,height:t})}getKey(e,t){return e.join(",")+t}getDashRanges(e,t,i){const n=[];let o=e.length%2==1?-e[e.length-1]*i:0,r=e[0]*i,s=!0;n.push({left:o,right:r,isDash:s,zeroLength:0===e[0]});let a=e[0];for(let t=1;t1&&(s=e[++r]);const l=Math.abs(a-s.left),c=Math.abs(a-s.right),u=Math.min(l,c);let d;const h=t/i*(n+1);if(s.isDash){const e=n-Math.abs(h);d=Math.sqrt(u*u+e*e)}else d=n-Math.sqrt(u*u+h*h);this.image.data[o+a]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e,t){for(let t=e.length-1;t>=0;--t){const i=e[t],n=e[t+1];i.zeroLength?e.splice(t,1):n&&n.isDash===i.isDash&&(n.left=i.left,e.splice(t,1))}const i=e[0],n=e[e.length-1];i.isDash===n.isDash&&(i.left=n.left-this.width,n.right=i.right+this.width);const o=this.width*this.nextRow;let r=0,s=e[r];for(let i=0;i1&&(s=e[++r]);const n=Math.abs(i-s.left),a=Math.abs(i-s.right),l=Math.min(n,a);this.image.data[o+i]=Math.max(0,Math.min(255,(s.isDash?l:-l)+t+128))}}addDash(e,t){const i=this.getKey(e,t);if(this.positions[i])return this.positions[i];const n="round"===t,o=n?7:0,r=2*o+1;if(this.nextRow+r>this.height)return q("LineAtlas out of space"),null;0===e.length&&e.push(1);let s=0;for(let t=0;t=t.maxzoom||"none"!==t.visibility&&(cf(e,this.zoom,i),(a[t.id]=t.createBucket({index:s.bucketLayerIDs.length,layers:e,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:d,sourceID:this.source,enableTerrain:this.enableTerrain,projection:this.projection.spec,availableImages:i})).populate(h,c,this.tileID.canonical,this.tileTransform),s.bucketLayerIDs.push(e.map((e=>e.id))))}}let d,h,p,m;l.trim();const f={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},g=()=>{if(d)return o(d);if(h&&p&&m){const e=new af(h),t=new vh(p,m);for(const n in a){const o=a[n];o instanceof im?(cf(o.layers,this.zoom,i),fp(o,h,e.positions,p,t.iconPositions,this.showCollisionBoxes,i,this.tileID.canonical,this.tileZoom,this.projection)):o.hasPattern&&(o instanceof wd||o instanceof Eu||o instanceof Yu)&&(cf(o.layers,this.zoom,i),o.addFeatures(c,this.tileID.canonical,t.patternPositions,i,this.tileTransform))}this.status="done",o(null,{buckets:I(a).filter((e=>!e.isEmpty())),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,lineAtlas:l,imageAtlas:t,glyphMap:this.returnDependencies?h:null,iconMap:this.returnDependencies?p:null,glyphPositions:this.returnDependencies?e.positions:null})}},_=N(c.glyphDependencies,(e=>Object.keys(e).map(Number)));Object.keys(_).length?n.send("getGlyphs",{uid:this.uid,stacks:_},((e,t)=>{d||(d=e,h=t,g())}),void 0,!1,f):h={};const y=Object.keys(c.iconDependencies);y.length?n.send("getImages",{icons:y,source:this.source,tileID:this.tileID,type:"icons"},((e,t)=>{d||(d=e,p=t,g())}),void 0,!1,f):p={};const b=Object.keys(c.patternDependencies);b.length?n.send("getImages",{icons:b,source:this.source,tileID:this.tileID,type:"patterns"},((e,t)=>{d||(d=e,m=t,g())}),void 0,!1,f):m={},g()}}function cf(e,t,i){const n=new wr(t);for(const t of e)t.recalculate(n,i)}class uf{constructor(e){this.entries={},this.scheduler=e}request(e,t,i,n){const o=this.entries[e]=this.entries[e]||{callbacks:[]};if(o.result){const[e,i]=o.result;return this.scheduler?this.scheduler.add((()=>{n(e,i)}),t):n(e,i),()=>{}}return o.callbacks.push(n),o.cancel||(o.cancel=i(((i,n)=>{o.result=[i,n];for(const e of o.callbacks)this.scheduler?this.scheduler.add((()=>{e(i,n)}),t):e(i,n);setTimeout((()=>delete this.entries[e]),3e3)}))),()=>{o.result||(o.callbacks=o.callbacks.filter((e=>e!==n)),o.callbacks.length||(o.cancel(),delete this.entries[e]))}}}function df(e,t,i){const n=JSON.stringify(e.request);return e.data&&(this.deduped.entries[n]={result:[null,e.data]}),this.deduped.request(n,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom},(t=>{const n=he(e.request,((e,n,o,r)=>{e?t(e):n&&t(null,{vectorTile:i?void 0:new Vu(new hh(n)),rawData:n,cacheControl:o,expires:r})}));return()=>{n.cancel(),t()}}),t)}const hf=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class pf{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,i]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");const n=i>>4;if(1!==n)throw new Error(`Got v${n} data when expected v1.`);const o=hf[15&i];if(!o)throw new Error("Unrecognized array type.");const[r]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new pf(s,r,o,e)}constructor(e,t=64,i=Float64Array,n){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const o=hf.indexOf(this.ArrayType),r=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-s%8)%8;if(o<0)throw new Error(`Unexpected typed array class: ${i}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+r+s+a),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+o]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return mf(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:r,nodeSize:s}=this,a=[0,o.length-1,0],l=[];for(;a.length;){const c=a.pop()||0,u=a.pop()||0,d=a.pop()||0;if(u-d<=s){for(let s=d;s<=u;s++){const a=r[2*s],c=r[2*s+1];a>=e&&a<=i&&c>=t&&c<=n&&l.push(o[s])}continue}const h=d+u>>1,p=r[2*h],m=r[2*h+1];p>=e&&p<=i&&m>=t&&m<=n&&l.push(o[h]),(0===c?e<=p:t<=m)&&(a.push(d),a.push(h-1),a.push(1-c)),(0===c?i>=p:n>=m)&&(a.push(h+1),a.push(u),a.push(1-c))}return l}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:r}=this,s=[0,n.length-1,0],a=[],l=i*i;for(;s.length;){const c=s.pop()||0,u=s.pop()||0,d=s.pop()||0;if(u-d<=r){for(let i=d;i<=u;i++)yf(o[2*i],o[2*i+1],e,t)<=l&&a.push(n[i]);continue}const h=d+u>>1,p=o[2*h],m=o[2*h+1];yf(p,m,e,t)<=l&&a.push(n[h]),(0===c?e-i<=p:t-i<=m)&&(s.push(d),s.push(h-1),s.push(1-c)),(0===c?e+i>=p:t+i>=m)&&(s.push(h+1),s.push(u),s.push(1-c))}return a}}function mf(e,t,i,n,o,r){if(o-n<=i)return;const s=n+o>>1;ff(e,t,s,n,o,r),mf(e,t,i,n,s-1,1-r),mf(e,t,i,s+1,o,1-r)}function ff(e,t,i,n,o,r){for(;o>n;){if(o-n>600){const s=o-n+1,a=i-n+1,l=Math.log(s),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(s-c)/s)*(a-s/2<0?-1:1);ff(e,t,i,Math.max(n,Math.floor(i-a*c/s+u)),Math.min(o,Math.floor(i+(s-a)*c/s+u)),r)}const s=t[2*i+r];let a=n,l=o;for(gf(e,t,n,i),t[2*o+r]>s&&gf(e,t,n,o);as;)l--}t[2*n+r]===s?gf(e,t,n,l):(l++,gf(e,t,l,o)),l<=i&&(n=l+1),i<=l&&(o=l-1)}}function gf(e,t,i,n){_f(e,i,n),_f(t,2*i,2*n),_f(t,2*i+1,2*n+1)}function _f(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function yf(e,t,i,n){const o=e-i,r=t-n;return o*o+r*r}e.ARRAY_TYPE=aa,e.AUTH_ERR_MSG=ye,e.Aabb=tl,e.Actor=class{constructor(e,i,n){this.target=e,this.parent=i,this.mapId=n,this.callbacks={},this.cancelCallbacks={},R(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=H()?e:t,this.scheduler=new fm}send(e,t,i,n,o=!1,r){const s=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(i.metadata=r,this.callbacks[s]=i);const a=Y(this.globalScope)?void 0:[];return this.target.postMessage({id:s,type:e,hasCallback:!!i,targetMapId:n,mustQueue:o,sourceMapId:this.mapId,data:Jo(t,a)},a),{cancel:()=>{i&&delete this.callbacks[s],this.target.postMessage({id:s,type:"",targetMapId:n,sourceMapId:this.mapId})}}}receive(e){const t=e.data,i=t.id;if(i&&(!t.targetMapId||this.mapId===t.targetMapId))if(""===t.type){const e=this.cancelCallbacks[i];delete this.cancelCallbacks[i],e&&e.cancel()}else if(t.mustQueue||H()){const e=this.callbacks[i];this.cancelCallbacks[i]=this.scheduler.add((()=>this.processTask(i,t)),e&&e.metadata||{type:"message"})}else this.processTask(i,t)}processTask(e,t){if(""===t.type){const i=this.callbacks[e];delete this.callbacks[e],i&&(t.error?i(er(t.error)):i(null,er(t.data)))}else{const i=Y(this.globalScope)?void 0:[],n=t.hasCallback?(t,n)=>{delete this.cancelCallbacks[e],this.target.postMessage({id:e,type:"",sourceMapId:this.mapId,error:t?Jo(t):null,data:Jo(n,i)},i)}:e=>{},o=er(t.data);if(this.parent[t.type])this.parent[t.type](t.sourceMapId,o,n);else if(this.parent.getWorkerSource){const e=t.type.split(".");this.parent.getWorkerSource(t.sourceMapId,e[0],o.source)[e[1]](o,n)}else n(new Error(`Could not find function ${t.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},e.CanonicalTileID=ld,e.Color=It,e.ColorMode=Zm,e.CullFaceMode=Xm,e.DEMData=Um,e.DataConstantProperty=Ir,e.DedupedRequest=uf,e.DepthMode=$m,e.EXTENT=oa,e.Elevation=class{isDataAvailableAtPoint(e){const t=this._source();if(this.isUsingMockSource()||!t||e.y<0||e.y>1)return!1;const i=t.getSource().maxzoom,n=1<1)return t;const o=n.getSource().maxzoom,r=1<{const r=this.getAtTileOffset(e,o.x,o.y),s=n.upVector(e.canonical,o.x,o.y);return La(s,s,r*n.upVectorScale(e.canonical,t,i).metersToTile),s}}getForTilePoints(e,t,i,n){if(this.isUsingMockSource())return!1;const o=ef.create(this,e,n);return!!o&&(t.forEach((e=>{e[2]=this.exaggeration()*o.getElevationAt(e[0],e[1],i)})),!0)}getMinMaxForTile(e){if(this.isUsingMockSource())return null;const t=this.findDEMTileFor(e);if(!t||!t.dem)return null;const i=t.dem.tree,n=t.tileID,o=1<{let n=e===r-1?e-2:0===e?e:e-1;return n+=i?24575:0,[n,t]};for(let e=0;ethis._skuTokenExpiresAt}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}normalizeStyleURL(e,t){if(!be(e))return e;const i=Te(e);return i.path=`/styles/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||t)}normalizeGlyphsURL(e,t){if(!be(e))return e;const i=Te(e);return i.path=`/fonts/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||t)}normalizeSourceURL(e,t,i,n){if(!be(e))return e;const o=Te(e);return o.path=`/v4/${o.authority}.json`,o.params.push("secure"),i&&o.params.push(`language=${i}`),n&&o.params.push(`worldview=${n}`),this._makeAPIURL(o,this._customAccessToken||t)}normalizeSpriteURL(e,t,i,n){const o=Te(e);return be(e)?(o.path=`/styles/v1${o.path}/sprite${t}${i}`,this._makeAPIURL(o,this._customAccessToken||n)):(o.path+=`${t}${i}`,Ce(o))}normalizeTileURL(e,t,i){if(this._isSkuTokenExpired()&&this._createSkuToken(),e&&!be(e))return e;const n=Te(e);n.path=n.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${t||i&&"raster"!==n.authority&&512===i?"@2x":""}${r.supported?".webp":"$1"}`),"raster"===n.authority?n.path=`/${o.RASTER_URL_PREFIX}${n.path}`:(n.path=n.path.replace(/^.+\/v4\//,"/"),n.path=`/${o.TILE_URL_VERSION}${n.path}`);const s=this._customAccessToken||function(e){for(const t of e){const e=t.match(/^access_token=(.*)$/);if(e)return e[1]}return null}(n.params)||o.ACCESS_TOKEN;return o.REQUIRE_ACCESS_TOKEN&&s&&this._skuToken&&n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,s)}canonicalizeTileURL(e,t){const i=Te(e);if(!i.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!i.path.match(/\.[\w]+$/))return e;let n="mapbox://";i.path.match(/^\/raster\/v1\//)?n+=`raster/${i.path.replace(`/${o.RASTER_URL_PREFIX}/`,"")}`:n+=`tiles/${i.path.replace(`/${o.TILE_URL_VERSION}/`,"")}`;let r=i.params;return t&&(r=r.filter((e=>!e.match(/^access_token=/)))),r.length&&(n+=`?${r.join("&")}`),n}canonicalizeTileset(e,t){const i=!!t&&be(t),n=[];for(const t of e.tiles||[])xe(t)?n.push(this.canonicalizeTileURL(t,i)):n.push(t);return n}_makeAPIURL(e,t){const i="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",n=Te(o.API_URL);if(e.protocol=n.protocol,e.authority=n.authority,"http"===e.protocol){const t=e.params.indexOf("secure");t>=0&&e.params.splice(t,1)}if("/"!==n.path&&(e.path=`${n.path}${e.path}`),!o.REQUIRE_ACCESS_TOKEN)return Ce(e);if(t=t||o.ACCESS_TOKEN,!this._silenceAuthErrors){if(!t)throw new Error(`An API access token is required to use Mapbox GL. ${i}`);if("s"===t[0])throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${i}`)}return e.params=e.params.filter((e=>-1===e.indexOf("access_token"))),e.params.push(`access_token=${t||""}`),Ce(e)}},e.ResourceType=le,e.SegmentVector=na,e.SourceCache=Ym,e.StencilMode=Gm,e.StructArrayLayout1ui2=us,e.StructArrayLayout2f1f2i16=es,e.StructArrayLayout2i4=Ur,e.StructArrayLayout2ui4=cs,e.StructArrayLayout3f12=is,e.StructArrayLayout3ui6=ns,e.StructArrayLayout4i8=$r,e.StructArrayLayout5f20=as,e.Texture=pm,e.Tile=Sm,e.Transitionable=Tr,e.Uniform1f=Ps,e.Uniform1i=class extends zs{constructor(e){super(e),this.current=0}set(e,t,i){this.fetchUniformLocation(e,t)&&this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},e.Uniform2f=class extends zs{constructor(e){super(e),this.current=[0,0]}set(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1])))}},e.Uniform3f=class extends zs{constructor(e){super(e),this.current=[0,0,0]}set(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2])))}},e.Uniform4f=Os,e.UniformColor=Bs,e.UniformMatrix2f=class extends zs{constructor(e){super(e),this.current=Fs}set(e,t,i){if(this.fetchUniformLocation(e,t))for(let e=0;e<4;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix2fv(this.location,!1,i);break}}},e.UniformMatrix3f=class extends zs{constructor(e){super(e),this.current=Rs}set(e,t,i){if(this.fetchUniformLocation(e,t))for(let e=0;e<9;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}},e.UniformMatrix4f=class extends zs{constructor(e){super(e),this.current=js}set(e,t,i){if(this.fetchUniformLocation(e,t)){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}}},e.UnwrappedTileID=cd,e.ValidationError=io,e.VectorTileFeature=$u,e.VectorTileWorkerSource=class extends Je{constructor(e,t,i,n,o){super(),this.actor=e,this.layerIndex=t,this.availableImages=i,this.loadVectorData=o||df,this.loading={},this.loaded={},this.deduped=new uf(e.scheduler),this.isSpriteLoaded=n,this.scheduler=e.scheduler}loadTile(e,t){const i=e.uid,n=e&&e.request,o=n&&n.collectResourceTiming,r=this.loading[i]=new lf(e);r.abort=this.loadVectorData(e,((s,a)=>{const l=!this.loading[i];if(delete this.loading[i],l||s||!a)return r.status="done",l||(this.loaded[i]=r),t(s);const c=a.rawData,u={};a.expires&&(u.expires=a.expires),a.cacheControl&&(u.cacheControl=a.cacheControl),r.vectorTile=a.vectorTile||new Vu(new hh(c));const d=()=>{r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,((e,i)=>{if(e||!i)return t(e);const r={};if(o){const e=$e(n);e.length>0&&(r.resourceTiming=JSON.parse(JSON.stringify(e)))}t(null,D({rawTileData:c.slice(0)},i,u,r))}))};this.isSpriteLoaded?d():this.once("isSpriteLoaded",(()=>{this.scheduler?this.scheduler.add(d,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom}):d()})),this.loaded=this.loaded||{},this.loaded[i]=r}))}reloadTile(e,t){const i=this.loaded,n=e.uid,o=this;if(i&&i[n]){const r=i[n];r.showCollisionBoxes=e.showCollisionBoxes,r.enableTerrain=!!e.enableTerrain,r.projection=e.projection,r.tileTransform=Cp(e.tileID.canonical,e.projection);const s=(e,i)=>{const n=r.reloadCallback;n&&(delete r.reloadCallback,r.parse(r.vectorTile,o.layerIndex,this.availableImages,o.actor,n)),t(e,i)};"parsing"===r.status?r.reloadCallback=s:"done"===r.status&&(r.vectorTile?r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}}abortTile(e,t){const i=e.uid,n=this.loading[i];n&&(n.abort&&n.abort(),delete this.loading[i]),t()}removeTile(e,t){const i=this.loaded,n=e.uid;i&&i[n]&&delete i[n],t()}},e.WritingMode=wh,e.ZoomDependentExpression=Qn,e.add=Ma,e.addDynamicAttributes=Qp,e.adjoint=function(e,t){var i=t[0],n=t[1],o=t[2],r=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8];return e[0]=s*u-a*c,e[1]=o*c-n*u,e[2]=n*a-o*s,e[3]=a*l-r*u,e[4]=i*u-o*l,e[5]=o*r-i*a,e[6]=r*c-s*l,e[7]=n*l-i*c,e[8]=i*s-n*r,e},e.asyncAll=A,e.bezier=T,e.bindAll=R,e.boundsAttributes=Cm,e.bufferConvexPolygon=function(e,t){const i=[];for(let n=0;nne&&(e.getActor().send("enforceCacheSizeLimit",ie),ae=0)},e.calculateGlobeLabelMatrix=function(e,t){const{x:i,y:n}=e.point,o=Sl(i,n,e.worldSize/e._pixelsPerMercatorPixel,0,0);return ha(o,o,kl(fl(t)))},e.calculateGlobeMatrix=function(e){const{x:t,y:i}=e.point,{lng:n,lat:o}=e._center;return Sl(t,i,e.worldSize,n,o)},e.calculateGlobeMercatorMatrix=function(e){const t=e.pixelsPerMeter,i=t/Vl(1,e.center.lat),n=ua(new Float64Array(16));return pa(n,n,[e.point.x,e.point.y,0]),ma(n,n,[i,i,t]),Float32Array.from(n)},e.circumferenceAtLatitude=Fl,e.clamp=k,e.clearTileCache=function(e){if(!oe())return;const i=t.caches.delete(J);e&&i.catch(e).then((()=>e()))},e.clipLine=Zh,e.clone=function(e){var t=new aa(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.clone$1=V,e.collisionCircleLayout=zd,e.config=o,e.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},e.create=function(){var e=new aa(16);return aa!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.create$1=la,e.createExpression=Yn,e.createLayout=Fr,e.createStyleLayer=function(e){return"custom"===e.type?new cm(e):new hm[e.type](e)},e.cross=za,e.degToRad=v,e.distance=function(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2])},e.div=function(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e},e.dot=Da,e.earthRadius=Ol,e.ease=C,e.easeCubicInOut=M,e.ecefToLatLng=function([e,t,i]){const n=Math.hypot(e,t,i),o=Math.atan2(e,i),r=.5*Math.PI-Math.acos(-t/n);return new Rl(w(o),w(r))},e.emitValidationErrors=qo,e.endsWith=F,e.enforceCacheSizeLimit=function(e){re(),ee&&ee.then((t=>{t.keys().then((i=>{for(let n=0;nr&&(n+=(e[o]-r)*(e[o]-r)),t[o]0){const e=180/n;ca(p,p,[e/c+1,0,0,0,e/u+1,0,-.5*e/d,.5*e/h,1])}return p[2]=l,p[5]=e.x,p[8]=e.y,p},e.getImage=_e,e.getJSON=function(e,t){return de(D(e,{type:"json"}),t)},e.getLatitudinalLod=function(e){const t=Zl-5;e=k(e,-t,t)/t*90;const i=Math.pow(Math.abs(Math.sin(v(e))),3);return Math.round(i*(al.length-1))},e.getMapSessionAPI=je,e.getPerformanceMeasurement=$e,e.getProjection=Hp,e.getRTLTextPluginStatus=br,e.getReferrer=ue,e.getTilePoint=function(e,{x:t,y:i},n=0){return new y(((t-n)*e.scale-e.x)*oa,(i*e.scale-e.y)*oa)},e.getTileVec3=function(e,t,i=0){return Ea(((t.x-i)*e.scale-e.x)*oa,(t.y*e.scale-e.y)*oa,Gl(t.z,t.y))},e.getVideo=function(e,i){const n=t.document.createElement("video");n.muted=!0,n.onloadstart=function(){i(null,n)};for(let i=0;i{}}},e.globeCenterToScreenPoint=function(e){const t=[0,0,0],i=ua(new Float64Array(16));return ha(i,e.pixelMatrix,e.globeMatrix),Pa(t,t,i),new y(t[0],t[1])},e.globeDenormalizeECEF=kl,e.globeECEFOrigin=function(e,t){const i=[0,0,0];return Pa(i,i,Cl(fl(t.canonical))),Pa(i,i,e),i},e.globeMetersToEcef=dl,e.globeNormalizeECEF=Cl,e.globePixelsToTileUnits=function(e,t){return oa/(512*Math.pow(2,e))*Ml(fl(t))},e.globePoleMatrixForTile=function(e,t,i){const n=ua(new Float64Array(16)),o=(t/(1<0;return 0===n&&!o&&!s&&r},e.identity=ua,e.identity$1=qa,e.invert=da,e.isFullscreen=function(){return!!t.document.fullscreenElement||!!t.document.webkitFullscreenElement},e.isLngLatBehindGlobe=Il,e.isMapAuthenticated=function(e){return Re.has(e)},e.isMapboxURL=be,e.isSafariWithAntialiasingBug=function(e){const t=e.navigator?e.navigator.userAgent:null;return!!Y(e)&&t&&(t.match("Version/15.4")||t.match("Version/15.5")||t.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},e.latFromMercatorY=ql,e.latLngToECEF=wl,e.len=Fa,e.length=wa,e.length$1=function(e){return Math.hypot(e[0],e[1],e[2],e[3])},e.lngFromMercatorX=$l,e.loadVectorTile=df,e.makeRequest=de,e.mapValue=function(e,t,i,n,o){return k((e-t)/(i-t)*(o-n)+n,n,o)},e.mercatorScale=Hl,e.mercatorXfromLng=Nl,e.mercatorYfromLat=Ul,e.mercatorZfromAltitude=Vl,e.mul=ba,e.mul$1=Ra,e.multiply=ha,e.multiply$1=ca,e.multiply$2=Ca,e.nextPowerOfTwo=B,e.normalize=Ia,e.normalize$1=Ha,e.normalize$2=Ua,e.number=Ii,e.ortho=function(e,t,i,n,o,r,s){var a=1/(t-i),l=1/(n-o),c=1/(r-s);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+i)*a,e[13]=(o+n)*l,e[14]=(s+r)*c,e[15]=1,e},e.pbf=qd,e.perspective=function(e,t,i,n,o){var r,s=1/Math.tan(t/2);return e[0]=s/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(e[10]=(o+n)*(r=1/(n-o)),e[14]=2*o*n*r):(e[10]=-1,e[14]=-2*n),e},e.pick=function(e,t){const i={};for(let n=0;n0&&i[0]<=e.width&&i[1]>0&&i[1]<=e.height&&!Il(e,new Rl(e.center.lat,90)),n[0]>0&&n[0]<=e.width&&n[1]>0&&n[1]<=e.height&&!Il(e,new Rl(e.center.lat,-90))]},e.polygonContainsPoint=gc,e.polygonIntersectsBox=_c,e.polygonIntersectsPolygon=ac,e.polygonizeBounds=function(e,t,i=0,n=!0){const o=new y(i,i),r=e.sub(o),s=t.add(o),a=[r,new y(s.x,r.y),s,new y(r.x,s.y)];return n&&a.push(r.clone()),a},e.posAttributes=Ka,e.postMapLoadEvent=ze,e.postPerformanceEvent=Oe,e.postTurnstileEvent=Ie,e.potpack=yh,e.prevPowerOfTwo=function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},e.radToDeg=w,e.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.registerForPluginStateChange=function(e){return e({pluginStatus:mr,pluginURL:fr}),yr.on("pluginStateChange",e),e},e.removeAuthState=function(e){Re.delete(e)},e.renderColorRamp=jc,e.resample=Yl,e.rotateX=fa,e.rotateX$1=Ga,e.rotateY=ga,e.rotateY$1=Za,e.rotateZ=function(e,t,i){var n=Math.sin(i),o=Math.cos(i),r=t[0],s=t[1],a=t[2],l=t[3],c=t[4],u=t[5],d=t[6],h=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=r*o+c*n,e[1]=s*o+u*n,e[2]=a*o+d*n,e[3]=l*o+h*n,e[4]=c*o-r*n,e[5]=u*o-s*n,e[6]=d*o-a*n,e[7]=h*o-l*n,e},e.rotateZ$1=function(e,t,i){i*=.5;var n=t[0],o=t[1],r=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=n*l+o*a,e[1]=o*l-n*a,e[2]=r*l+s*a,e[3]=s*l-r*a,e},e.scale=ma,e.scale$1=Na,e.scale$2=La,e.scaleAndAdd=Aa,e.set=function(e,t,i,n){return e[0]=t,e[1]=i,e[2]=n,e},e.setCacheLimits=function(e,t){ie=e,ne=t},e.setColumn=function(e,t,i){e[4*t+0]=i[0],e[4*t+1]=i[1],e[4*t+2]=i[2],e[4*t+3]=i[3]},e.setRTLTextPlugin=function(e,t,i=!1){if(mr===ur||mr===dr||mr===hr)throw new Error("setRTLTextPlugin cannot be called multiple times.");fr=We.resolveURL(e),mr=ur,pr=t,_r(),i||xr()},e.smoothstep=S,e.spec=et,e.squaredLength=function(e){var t=e[0],i=e[1],n=e[2];return t*t+i*i+n*n},e.storeAuthState=function(e,t){t?Re.add(e):Re.delete(e)},e.sub=ja,e.subtract=Ta,e.symbolSize=Fd,e.tileAABB=function(e,t,i,n,o,r,s,a,l){if("globe"===l.name)return function(e,t,i){const n=t/e.worldSize,o=e.globeMatrix;if(i.z<=1){const e=fl(i).getCorners();return yl(e,o,n),tl.fromPoints(e)}const r=bl(i),s=xl(r);yl(s,o,n);const a=Number.MAX_VALUE,l=[-a,-a,-a],c=[a,a,a];if(r.contains(e.center)){for(const e of s)ka(c,c,e),Sa(l,l,e);l[2]=0;const t=e.point,i=[t.x*n,t.y*n,0];return ka(c,c,i),Sa(l,l,i),new tl(c,l)}const u=[o[12]*n,o[13]*n,o[14]*n],d=r.getCenter(),h=k(e.center.lat,-Zl,Zl),p=k(d.lat,-Zl,Zl),m=Nl(e.center.lng),f=Ul(h);let g=m-Nl(d.lng);const _=f-Ul(p);g>.5?g-=1:g<-.5&&(g+=1);let y=0;Math.abs(g)>Math.abs(_)?y=g>=0?1:3:(y=_>=0?0:2,Aa(u,u,[o[4]*n,o[5]*n,o[6]*n],-Math.sin(v(_>=0?r.getSouth():r.getNorth()))*ol));const b=s[y],x=s[(y+1)%4],w=new pl(b,x,u),E=[ml(w,0)||b[0],ml(w,1)||b[1],ml(w,2)||b[2]],M=Ll(e.zoom);if(M>0){const n=function({x:e,y:t,z:i},n,o,r,s){const a=1/(1<.5?h=-1:p<-.5&&(h=1),l=((l+h)*n-(r*=n))*o+r,c=((c+h)*n-r)*o+r,u=(u*n-(s*=n))*o+s,d=(d*n-s)*o+s,[[l,d,0],[c,d,0],[c,u,0],[l,u,0]]}(i,t,e._pixelsPerMercatorPixel,m,f);for(let e=0;e$o(Mo(e)),e.validateFog=e=>$o(Bo(e)),e.validateLayer=e=>$o(Lo(e)),e.validateLight=e=>$o(Po(e)),e.validateSource=e=>$o(Do(e)),e.validateStyle=No,e.validateTerrain=e=>$o(Oo(e)),e.values=I,e.vectorTile=Au,e.version=i,e.warnOnce=q,e.window=t,e.wrap=L})),n(0,(function(e){function t(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){let i="[";for(const n of e)i+=`${t(n)},`;return`${i}]`}let i="{";for(const n of Object.keys(e).sort())i+=`${n}:${t(e[n])},`;return`${i}}`}function i(i){let n="";for(const o of e.refProperties)n+=`/${t(i[o])}`;return n}class n{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(t,n){for(const i of t)this._layerConfigs[i.id]=i,(this._layers[i.id]=e.createStyleLayer(i)).compileFilter(),this.keyCache[i.id]&&delete this.keyCache[i.id];for(const e of n)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const o=function(e,t){const n={};for(let o=0;othis._layers[e.id])),i=t[0];if("none"===i.visibility)continue;const n=i.source||"";let o=this.familiesBySource[n];o||(o=this.familiesBySource[n]={});const r=i.sourceLayer||"_geojsonTileLayer";let s=o[r];s||(s=o[r]=[]),s.push(t)}}}class o{loadTile(t,i){const{uid:n,encoding:o,rawImageData:r,padding:s,buildQuadTree:a}=t,l=e.window.ImageBitmap&&r instanceof e.window.ImageBitmap?this.getImageData(r,s):r;i(null,new e.DEMData(n,l,o,s<1,a))}getImageData(e,t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);const i=this.offscreenCanvasContext.getImageData(-t,-t,e.width+2*t,e.height+2*t);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),i}}function r(e,t){if(0!==e.length){s(e[0],t);for(var i=1;i=Math.abs(a)?i-l+a:a-l+i,i=l}i+n>=0!=!!t&&e.reverse()}var a=e.getDefaultExportFromCjs((function e(t,i){var n,o=t&&t.type;if("FeatureCollection"===o)for(n=0;n>31}function E(e,t){for(var i=e.loadGeometry(),n=e.type,o=0,r=0,s=i.length,a=0;ae},k=Math.fround||(S=new Float32Array(1),e=>(S[0]=+e,S[0]));var S;const L=3,A=5,I=6;class D{constructor(e){this.options=Object.assign(Object.create(C),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:i,maxZoom:n}=this.options;t&&console.time("total time");const o=`prepare ${e.length} points`;t&&console.time(o),this.points=e;const r=[];for(let t=0;t=i;e--){const i=+Date.now();s=this.trees[e]=this._createTree(this._cluster(s,e)),t&&console.log("z%d: %d clusters in %dms",e,s.numItems,+Date.now()-i)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let i=((e[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,e[1]));let o=180===e[2]?180:((e[2]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,o=180;else if(i>o){const e=this.getClusters([i,n,180,r],t),s=this.getClusters([-180,n,o,r],t);return e.concat(s)}const s=this.trees[this._limitZoom(t)],a=s.range(O(i),B(r),O(o),B(n)),l=s.data,c=[];for(const e of a){const t=this.stride*e;c.push(l[t+A]>1?z(l,t,this.clusterProps):this.points[l[t+L]])}return c}getChildren(e){const t=this._getOriginId(e),i=this._getOriginZoom(e),n="No cluster with the specified id.",o=this.trees[i];if(!o)throw new Error(n);const r=o.data;if(t*this.stride>=r.length)throw new Error(n);const s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=o.within(r[t*this.stride],r[t*this.stride+1],s),l=[];for(const t of a){const i=t*this.stride;r[i+4]===e&&l.push(r[i+A]>1?z(r,i,this.clusterProps):this.points[r[i+L]])}if(0===l.length)throw new Error(n);return l}getLeaves(e,t,i){const n=[];return this._appendLeaves(n,e,t=t||10,i=i||0,0),n}getTile(e,t,i){const n=this.trees[this._limitZoom(e)],o=Math.pow(2,e),{extent:r,radius:s}=this.options,a=s/r,l=(i-a)/o,c=(i+1+a)/o,u={features:[]};return this._addTileFeatures(n.range((t-a)/o,l,(t+1+a)/o,c),n.data,t,i,o,u),0===t&&this._addTileFeatures(n.range(1-a/o,l,1,c),n.data,o,i,o,u),t===o-1&&this._addTileFeatures(n.range(0,l,a/o,c),n.data,-1,i,o,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const i=this.getChildren(e);if(t++,1!==i.length)break;e=i[0].properties.cluster_id}return t}_appendLeaves(e,t,i,n,o){const r=this.getChildren(t);for(const t of r){const r=t.properties;if(r&&r.cluster?o+r.point_count<=n?o+=r.point_count:o=this._appendLeaves(e,r.cluster_id,i,n,o):o1;let l,c,u;if(a)l=P(t,e,this.clusterProps),c=t[e],u=t[e+1];else{const i=this.points[t[e+L]];l=i.properties;const[n,o]=i.geometry.coordinates;c=O(n),u=B(o)}const d={type:1,geometry:[[Math.round(this.options.extent*(c*o-i)),Math.round(this.options.extent*(u*o-n))]],tags:l};let h;h=a||this.options.generateId?t[e+L]:this.points[t[e+L]].id,void 0!==h&&(d.id=h),r.features.push(d)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:i,extent:n,reduce:o,minPoints:r}=this.options,s=i/(n*Math.pow(2,t)),a=e.data,l=[],c=this.stride;for(let i=0;it&&(p+=a[i+A])}if(p>h&&p>=r){let e,r=n*h,s=u*h,m=-1;const f=(i/c<<5)+(t+1)+this.points.length;for(const n of d){const l=n*c;if(a[l+2]<=t)continue;a[l+2]=t;const u=a[l+A];r+=a[l]*u,s+=a[l+1]*u,a[l+4]=f,o&&(e||(e=this._map(a,i,!0),m=this.clusterProps.length,this.clusterProps.push(e)),o(e,this._map(a,l)))}a[i+4]=f,l.push(r/p,s/p,1/0,f,-1,p),o&&l.push(m)}else{for(let e=0;e1)for(const e of d){const i=e*c;if(!(a[i+2]<=t)){a[i+2]=t;for(let e=0;e>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,i){if(e[t+A]>1){const n=this.clusterProps[e[t+I]];return i?Object.assign({},n):n}const n=this.points[e[t+L]].properties,o=this.options.map(n);return i&&o===n?Object.assign({},o):o}}function z(e,t,i){return{type:"Feature",id:e[t+L],properties:P(e,t,i),geometry:{type:"Point",coordinates:[(n=e[t],360*(n-.5)),j(e[t+1])]}};var n}function P(e,t,i){const n=e[t+A],o=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,r=e[t+I],s=-1===r?{}:Object.assign({},i[r]);return Object.assign(s,{cluster:!0,cluster_id:e[t+L],point_count:n,point_count_abbreviated:o})}function O(e){return e/360+.5}function B(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function j(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function R(e,t,i,n){for(var o,r=n,s=i-t>>1,a=i-t,l=e[t],c=e[t+1],u=e[i],d=e[i+1],h=t+3;hr)o=h,r=p;else if(p===r){var m=Math.abs(h-s);mn&&(o-t>3&&R(e,t,o,n),e[o+2]=r,i-o>3&&R(e,o,i,n))}function F(e,t,i,n,o,r){var s=o-i,a=r-n;if(0!==s||0!==a){var l=((e-i)*s+(t-n)*a)/(s*s+a*a);l>1?(i=o,n=r):l>0&&(i+=s*l,n+=a*l)}return(s=e-i)*s+(a=t-n)*a}function N(e,t,i,n){var o={id:void 0===e?null:e,type:t,geometry:i,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,i=e.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)U(e,t);else if("Polygon"===i||"MultiLineString"===i)for(var n=0;n0&&(s+=n?(o*c-l*r)/2:Math.sqrt(Math.pow(l-o,2)+Math.pow(c-r,2))),o=l,r=c}var u=t.length-3;t[2]=1,R(t,0,u,i),t[u+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function G(e,t,i,n){for(var o=0;o1?1:i}function W(e,t,i,n,o,r,s,a){if(n/=t,r>=(i/=t)&&s=n)return null;for(var l=[],c=0;c=i&&m=n)){var f=[];if("Point"===h||"MultiPoint"===h)X(d,f,i,n,o);else if("LineString"===h)Y(d,f,i,n,o,!1,a.lineMetrics);else if("MultiLineString"===h)Q(d,f,i,n,o,!1);else if("Polygon"===h)Q(d,f,i,n,o,!0);else if("MultiPolygon"===h)for(var g=0;g=i&&s<=n&&(t.push(e[r]),t.push(e[r+1]),t.push(e[r+2]))}}function Y(e,t,i,n,o,r,s){for(var a,l,c=K(e),u=0===o?ee:te,d=e.start,h=0;hi&&(l=u(c,p,m,g,_,i),s&&(c.start=d+a*l)):y>n?b=i&&(l=u(c,p,m,g,_,i),x=!0),b>n&&y<=n&&(l=u(c,p,m,g,_,n),x=!0),!r&&x&&(s&&(c.end=d+a*l),t.push(c),c=K(e)),s&&(d+=a)}var v=e.length-3;p=e[v],m=e[v+1],f=e[v+2],(y=0===o?p:m)>=i&&y<=n&&J(c,p,m,f),v=c.length-3,r&&v>=3&&(c[v]!==c[0]||c[v+1]!==c[1])&&J(c,c[0],c[1],c[2]),c.length&&t.push(c)}function K(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function Q(e,t,i,n,o,r){for(var s=0;ss.maxX&&(s.maxX=u),d>s.maxY&&(s.maxY=d)}return s}function ae(e,t,i,n){var o=t.geometry,r=t.type,s=[];if("Point"===r||"MultiPoint"===r)for(var a=0;a0&&t.size<(o?s:n))i.numPoints+=t.length/3;else{for(var a=[],l=0;ls)&&(i.numSimplified++,a.push(t[l]),a.push(t[l+1])),i.numPoints++;o&&function(e,t){for(var i=0,n=0,o=e.length,r=o-2;n0===t)for(n=0,o=e.length;n24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(e,t){var i=[];if("FeatureCollection"===e.type)for(var n=0;n1&&console.time("creation"),h=this.tiles[d]=se(e,t,i,n,l),this.tileCoords.push({z:t,x:i,y:n}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,n,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));var p="z"+t;this.stats[p]=(this.stats[p]||0)+1,this.total++}if(h.source=e,o){if(t===l.maxZoom||t===o)continue;var m=1<1&&console.time("clipping");var f,g,_,y,b,x,v=.5*l.buffer/l.extent,w=.5-v,E=.5+v,M=1+v;f=g=_=y=null,b=W(e,u,i-v,i+E,0,h.minX,h.maxX,l),x=W(e,u,i+w,i+M,0,h.minX,h.maxX,l),e=null,b&&(f=W(b,u,n-v,n+E,1,h.minY,h.maxY,l),g=W(b,u,n+w,n+M,1,h.minY,h.maxY,l),b=null),x&&(_=W(x,u,n-v,n+E,1,h.minY,h.maxY,l),y=W(x,u,n+w,n+M,1,h.minY,h.maxY,l),x=null),c>1&&console.timeEnd("clipping"),a.push(f||[],t+1,2*i,2*n),a.push(g||[],t+1,2*i,2*n+1),a.push(_||[],t+1,2*i+1,2*n),a.push(y||[],t+1,2*i+1,2*n+1)}}},ce.prototype.getTile=function(e,t,i){var n=this.options,o=n.extent,r=n.debug;if(e<0||e>24)return null;var s=1<1&&console.log("drilling down to z%d-%d-%d",e,t,i);for(var l,c=e,u=t,d=i;!l&&c>0;)c--,u=Math.floor(u/2),d=Math.floor(d/2),l=this.tiles[ue(c,u,d)];return l&&l.source?(r>1&&console.log("found parent tile z%d-%d-%d",c,u,d),r>1&&console.time("drilling down"),this.splitTile(l.source,c,u,d,e,t,i),r>1&&console.timeEnd("drilling down"),this.tiles[a]?oe(this.tiles[a],o):null):null};class he extends e.VectorTileWorkerSource{constructor(e,t,i,n,o){super(e,t,i,n,de),o&&(this.loadGeoJSON=o)}loadData(t,i){const n=t&&t.request,o=n&&n.collectResourceTiming;this.loadGeoJSON(t,((r,s)=>{if(r||!s)return i(r);if("object"!=typeof s)return i(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));{a(s,!0);try{if(t.filter){const i=e.createExpression(t.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw new Error(i.value.map((e=>`${e.key}: ${e.message}`)).join(", "));const n=s.features.filter((e=>i.value.evaluate({zoom:0},e)));s={type:"FeatureCollection",features:n}}this._geoJSONIndex=t.cluster?new D(function({superclusterOptions:t,clusterProperties:i}){if(!i||!t)return t;const n={},o={},r={accumulated:null,zoom:0},s={properties:null},a=Object.keys(i);for(const t of a){const[r,s]=i[t],a=e.createExpression(s),l=e.createExpression("string"==typeof r?[r,["accumulated"],["get",t]]:r);n[t]=a.value,o[t]=l.value}return t.map=e=>{s.properties=e;const t={};for(const e of a)t[e]=n[e].evaluate(r,s);return t},t.reduce=(e,t)=>{s.properties=t;for(const t of a)r.accumulated=e[t],e[t]=o[t].evaluate(r,s)},t}(t)).load(s.features):function(e,t){return new ce(e,t)}(s,t.geojsonVtOptions)}catch(r){return i(r)}this.loaded={};const l={};if(o){const i=e.getPerformanceMeasurement(n);i&&(l.resourceTiming={},l.resourceTiming[t.source]=JSON.parse(JSON.stringify(i)))}i(null,l)}}))}reloadTile(e,t){const i=this.loaded;return i&&i[e.uid]?super.reloadTile(e,t):this.loadTile(e,t)}loadGeoJSON(t,i){if(t.request)e.getJSON(t.request,i);else{if("string"!=typeof t.data)return i(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));try{return i(null,JSON.parse(t.data))}catch(e){return i(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(e){t(e)}}getClusterChildren(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(e){t(e)}}getClusterLeaves(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(e){t(e)}}}class pe{constructor(t){this.self=t,this.actor=new e.Actor(t,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=e.getProjection({name:"mercator"}),this.workerSourceTypes={vector:e.VectorTileWorkerSource,geojson:he},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(e,t)=>{if(this.workerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.workerSourceTypes[e]=t},this.self.registerRTLTextPlugin=t=>{if(e.plugin.isParsed())throw new Error("RTL text plugin already registered.");e.plugin.applyArabicShaping=t.applyArabicShaping,e.plugin.processBidirectionalText=t.processBidirectionalText,e.plugin.processStyledBidirectionalText=t.processStyledBidirectionalText}}clearCaches(e,t,i){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],i()}checkIfReady(e,t,i){i()}setReferrer(e,t){this.referrer=t}spriteLoaded(t,i){this.isSpriteLoaded[t]=i;for(const n in this.workerSources[t]){const o=this.workerSources[t][n];for(const t in o)o[t]instanceof e.VectorTileWorkerSource&&(o[t].isSpriteLoaded=i,o[t].fire(new e.Event("isSpriteLoaded")))}}setImages(e,t,i){this.availableImages[e]=t;for(const i in this.workerSources[e]){const n=this.workerSources[e][i];for(const e in n)n[e].availableImages=t}i()}enableTerrain(e,t,i){this.terrain=t,i()}setProjection(t,i){this.projections[t]=e.getProjection(i)}setLayers(e,t,i){this.getLayerIndex(e).replace(t),i()}updateLayers(e,t,i){this.getLayerIndex(e).update(t.layers,t.removedIds),i()}loadTile(t,i,n){const o=this.enableTerrain?e.extend({enableTerrain:this.terrain},i):i;o.projection=this.projections[t]||this.defaultProjection,this.getWorkerSource(t,i.type,i.source).loadTile(o,n)}loadDEMTile(t,i,n){const o=this.enableTerrain?e.extend({buildQuadTree:this.terrain},i):i;this.getDEMWorkerSource(t,i.source).loadTile(o,n)}reloadTile(t,i,n){const o=this.enableTerrain?e.extend({enableTerrain:this.terrain},i):i;o.projection=this.projections[t]||this.defaultProjection,this.getWorkerSource(t,i.type,i.source).reloadTile(o,n)}abortTile(e,t,i){this.getWorkerSource(e,t.type,t.source).abortTile(t,i)}removeTile(e,t,i){this.getWorkerSource(e,t.type,t.source).removeTile(t,i)}removeSource(e,t,i){if(!this.workerSources[e]||!this.workerSources[e][t.type]||!this.workerSources[e][t.type][t.source])return;const n=this.workerSources[e][t.type][t.source];delete this.workerSources[e][t.type][t.source],void 0!==n.removeSource?n.removeSource(t,i):i()}loadWorkerSource(e,t,i){try{this.self.importScripts(t.url),i()}catch(e){i(e.toString())}}syncRTLPluginState(t,i,n){try{e.plugin.setState(i);const t=e.plugin.getPluginURL();if(e.plugin.isLoaded()&&!e.plugin.isParsed()&&null!=t){this.self.importScripts(t);const i=e.plugin.isParsed();n(i?void 0:new Error(`RTL Text Plugin failed to import scripts from ${t}`),i)}}catch(e){n(e.toString())}}getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}getLayerIndex(e){let t=this.layerIndexes[e];return t||(t=this.layerIndexes[e]=new n),t}getWorkerSource(e,t,i){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][i]){const n={send:(t,i,n,o,r,s)=>{this.actor.send(t,i,n,e,r,s)},scheduler:this.actor.scheduler};this.workerSources[e][t][i]=new this.workerSourceTypes[t](n,this.getLayerIndex(e),this.getAvailableImages(e),this.isSpriteLoaded[e])}return this.workerSources[e][t][i]}getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new o),this.demWorkerSources[e][t]}enforceCacheSizeLimit(t,i){e.enforceCacheSizeLimit(i)}getWorkerPerformanceMetrics(e,t,i){i(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new pe(self)),pe})),n(0,(function(e){function t(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let n=0;n{e.window.removeEventListener("click",h,!0)}),0)}function m(e,t){const i=e.getBoundingClientRect();return _(e,i,t)}function f(e,t){const i=e.getBoundingClientRect(),n=[];for(let o=0;o=0?0:t.button}function _(t,i,n){const o=t.offsetWidth===i.width?1:t.offsetWidth/i.width;return new e.Point((n.clientX-i.left)*o,(n.clientY-i.top)*o)}function y(e,t){var i=t[0],n=t[1],o=t[2],r=t[3],s=i*r-o*n;return s?(e[0]=r*(s=1/s),e[1]=-n*s,e[2]=-o*s,e[3]=i*s,e):null}function b(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class x extends e.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new e.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:e,callback:t}of this.requestors)this._notify(e,t);this.requestors=[]}}hasImage(e){return!!this.getImage(e)}getImage(e){return this.images[e]}addImage(e,t){this._validate(e,t)&&(this.images[e]=t)}_validate(t,i){let n=!0;return this._validateStretch(i.stretchX,i.data&&i.data.width)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),n=!1),this._validateStretch(i.stretchY,i.data&&i.data.height)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),n=!1),this._validateContent(i.content,i)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),n=!1),n}_validateStretch(e,t){if(!e)return!0;let i=0;for(const n of e){if(n[0]{this.ready=!0}))}broadcast(t,i,n){e.asyncAll(this.actors,((e,n)=>{e.send(t,i,n)}),n=n||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 A(t,i,n){return i*(e.EXTENT/(t.tileSize*Math.pow(2,n-t.tileID.overscaledZ)))}L.Actor=e.Actor;class I{constructor(e,t,i,n){this.screenBounds=e,this.cameraPoint=t,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=i,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,n)}static createFromScreenPoints(t,i){let n,o;if(t instanceof e.Point||"number"==typeof t[0]){const r=e.Point.convert(t);n=[r],o=i.isPointAboveHorizon(r)}else{const r=e.Point.convert(t[0]),s=e.Point.convert(t[1]);n=[r,s],o=e.polygonizeBounds(r,s).every((e=>i.isPointAboveHorizon(e)))}return new I(n,i.getCameraPoint(),o,i)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(t){return e.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const i=this.screenBounds[0],n=1===this.screenBounds.length?this.screenBounds[0].add(new e.Point(1,1)):this.screenBounds[1],o=e.polygonizeBounds(i,n,0,!1);return this.cameraPoint.y>n.y&&(this.cameraPoint.x>i.x&&this.cameraPoint.x=n.x?o[2]=this.cameraPoint:this.cameraPoint.x<=i.x&&(o[3]=this.cameraPoint)),e.bufferConvexPolygon(o,t)}bufferedCameraGeometryGlobe(t){const i=this.screenBounds[0],n=1===this.screenBounds.length?this.screenBounds[0].add(new e.Point(1,1)):this.screenBounds[1],o=e.polygonizeBounds(i,n,t),r=this.cameraPoint.clone();switch(3*((r.y>i.y)+(r.y>n.y))+((r.x>i.x)+(r.x>n.x))){case 0:o[0]=r,o[4]=r.clone();break;case 1:o.splice(1,0,r);break;case 2:o[1]=r;break;case 3:o.splice(4,0,r);break;case 5:o.splice(2,0,r);break;case 6:o[3]=r;break;case 7:o.splice(3,0,r);break;case 8:o[2]=r}return o}containsTile(t,i,n,o=0){const r=t.queryPadding/i._pixelsPerMercatorPixel+1,s=n?this._bufferedCameraMercator(r,i):this._bufferedScreenMercator(r,i);let a=t.tileID.wrap+(s.unwrapped?o:0);const l=s.polygon.map((i=>e.getTilePoint(t.tileTransform,i,a)));if(!e.polygonIntersectsBox(l,0,0,e.EXTENT,e.EXTENT))return;a=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?o:0);const c=this.screenGeometryMercator.polygon.map((i=>e.getTileVec3(t.tileTransform,i,a))),u=c.map((t=>new e.Point(t[0],t[1]))),d=i.getFreeCameraOptions().position||new e.MercatorCoordinate(0,0,0),h=e.getTileVec3(t.tileTransform,d,a),p=c.map((t=>{const i=e.sub(t,t,h);return e.normalize(i,i),new e.Ray(h,i)})),m=A(t,1,i.zoom)*i._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:u,tilespaceRays:p,bufferedTilespaceGeometry:l,bufferedTilespaceBounds:(f=e.getBounds(l),f.min.x=e.clamp(f.min.x,0,e.EXTENT),f.min.y=e.clamp(f.min.y,0,e.EXTENT),f.max.x=e.clamp(f.max.x,0,e.EXTENT),f.max.y=e.clamp(f.max.y,0,e.EXTENT),f),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:m};var f}_bufferedScreenMercator(e,t){const i=P(e);if(this._screenRaycastCache[i])return this._screenRaycastCache[i];{let n;return n="globe"===t.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),t):{polygon:this.bufferedScreenGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._screenRaycastCache[i]=n,n}}_bufferedCameraMercator(e,t){const i=P(e);if(this._cameraRaycastCache[i])return this._cameraRaycastCache[i];{let n;return n="globe"===t.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),t):{polygon:this.bufferedCameraGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._cameraRaycastCache[i]=n,n}}_projectAndResample(t,i){const n=function(t,i){const n=e.multiply([],i.pixelMatrix,i.globeMatrix),o=[0,-e.GLOBE_RADIUS,0,1],r=[0,e.GLOBE_RADIUS,0,1],s=[0,0,0,1];e.transformMat4$1(o,o,n),e.transformMat4$1(r,r,n),e.transformMat4$1(s,s,n);const a=new e.Point(o[0]/o[3],o[1]/o[3]),l=new e.Point(r[0]/r[3],r[1]/r[3]),c=e.polygonContainsPoint(t,a)&&o[3]1?D(t.slice(0,h),i):[],f=hnew e.Point(z(t.x),t.y))),f=f.map((t=>new e.Point(z(t.x),t.y)));const g=[...m];0===g.length&&g.push(f[f.length-1]);const _=e.number(g[g.length-1].y,(0===f.length?m[0]:f[0]).y,p);let y;return y=c?[new e.Point(0,_),new e.Point(0,0),new e.Point(1,0),new e.Point(1,_)]:[new e.Point(1,_),new e.Point(1,1),new e.Point(0,1),new e.Point(0,_)],g.push(...y),0===f.length?g.push(m[0]):g.push(...f),{polygon:g.map((t=>new e.MercatorCoordinate(t.x,t.y))),unwrapped:!1}}(t,i);if(n)return n;const o=function(t,i){let n=!1,o=-1/0,r=0;for(let e=0;eo&&(o=t[e].x,r=e);for(let e=0;e.5&&(o.x{e.x-=1})),{polygon:t,unwrapped:n}}(D(t,i).map((t=>new e.Point(z(t.x),t.y))),i);return{polygon:o.polygon.map((t=>new e.MercatorCoordinate(t.x,t.y))),unwrapped:o.unwrapped}}}function D(t,i){return e.resample(t,(e=>{const t=i.pointCoordinate3D(e);e.x=t.x,e.y=t.y}),1/256)}function z(e){return e<0?1+e%1:e%1}function P(e){return 100*e|0}function O(t,i,n,o,r){const s=function(n,o){if(n)return r(n);if(o){t.url&&o.tiles&&t.tiles&&delete t.tiles;const n=e.pick(e.extend(o,t),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);o.vector_layers&&(n.vectorLayers=o.vector_layers,n.vectorLayerIds=n.vectorLayers.map((e=>e.id))),n.tiles=i.canonicalizeTileset(n,t.url),r(null,n)}};return t.url?e.getJSON(i.transformRequest(i.normalizeSourceURL(t.url,null,n,o),e.ResourceType.Source),s):e.exported.frame((()=>s(null,t)))}class B{constructor(t,i,n){this.bounds=e.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=i||0,this.maxzoom=n||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(t){const i=Math.pow(2,t.z),n=Math.floor(e.mercatorXfromLng(this.bounds.getWest())*i),o=Math.floor(e.mercatorYfromLat(this.bounds.getNorth())*i),r=Math.ceil(e.mercatorXfromLng(this.bounds.getEast())*i),s=Math.ceil(e.mercatorYfromLat(this.bounds.getSouth())*i);return t.x>=n&&t.x=o&&t.y{this._tileJSONRequest=null,this._loaded=!0,o?(i&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i}`),n&&2!==n.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${n}`),this.fire(new e.ErrorEvent(o))):r&&(e.extend(this,r),r.bounds&&(this.tileBounds=new B(r.bounds,this.minzoom,this.maxzoom)),e.postTurnstileEvent(r.tiles,this.map._requestManager._customAccessToken),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))),t&&t(o)}))}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest(),this.load((()=>this.map.style._clearSource(this.id)))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return e.extend({},this._options)}loadTile(t,i){const n=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme)),o={request:this.map._requestManager.transformRequest(n,e.ResourceType.Tile),data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:e.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile};if(o.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state)"loading"===t.state?t.reloadCallback=i:t.request=t.actor.send("reloadTile",o,r.bind(this));else if(t.actor=this._tileWorkers[n]=this._tileWorkers[n]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",o,r.bind(this),void 0,!0);else{const i=e.loadVectorTile.call({deduped:this._deduped},o,((e,i)=>{e||!i?r.call(this,e):(o.data={cacheControl:i.cacheControl,expires:i.expires,rawData:i.rawData.slice(0)},t.actor&&t.actor.send("loadTile",o,r.bind(this),void 0,!0))}),!0);t.request={cancel:i}}function r(n,o){return delete t.request,t.aborted?i(null):n&&404!==n.status?i(n):(o&&o.resourceTiming&&(t.resourceTiming=o.resourceTiming),this.map._refreshExpiredTiles&&o&&t.setExpiryData(o),t.loadVectorData(o,this.map.painter),e.cacheEntryPossiblyAdded(this.dispatcher),i(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id})}unloadTile(e){e.unloadVectorData(),e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Ce extends e.Evented{constructor(t,i,n,o){super(),this.id=t,this.dispatcher=n,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=e.extend({type:"raster"},i),e.extend(this,e.pick(i,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=O(this._options,this.map._requestManager,null,null,((i,n)=>{this._tileJSONRequest=null,this._loaded=!0,i?this.fire(new e.ErrorEvent(i)):n&&(e.extend(this,n),n.bounds&&(this.tileBounds=new B(n.bounds,this.minzoom,this.maxzoom)),e.postTurnstileEvent(n.tiles),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))),t&&t(i)}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest(),this.load((()=>this.map.style._clearSource(this.id)))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return e.extend({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(t,i){const n=e.exported.devicePixelRatio>=2,o=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),n,this.tileSize);t.request=e.getImage(this.map._requestManager.transformRequest(o,e.ResourceType.Tile),((n,o,r,s)=>(delete t.request,t.aborted?(t.state="unloaded",i(null)):n?(t.state="errored",i(n)):o?(this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:r,expires:s}),t.setTexture(o,this.map.painter),t.state="loaded",e.cacheEntryPossiblyAdded(this.dispatcher),void i(null)):i(null))))}static loadTileData(e,t,i){e.setTexture(t,i)}static unloadTileData(e,t){e.texture&&t.saveTileTexture(e.texture)}abortTile(e,t){e.request&&(e.request.cancel(),delete e.request),t()}unloadTile(e,t){e.texture&&this.map.painter.saveTileTexture(e.texture),t()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function ke(t,i,n,o,r,s,a,l){const c=[t,n,r,i,o,s,1,1,1],u=[a,l,1],d=e.adjoint([],c),[h,p,m]=e.transformMat3(u,u,e.transpose(d,d));return e.multiply$1(c,[h,0,0,0,p,0,0,0,m],c)}class Se extends e.Evented{constructor(e,t,i,n){super(),this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(n),this.options=t,this._dirty=!1}load(t,i){this._loaded=i||!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._imageRequest=e.getImage(this.map._requestManager.transformRequest(this.url,e.ResourceType.Image),((i,n)=>{if(this._imageRequest=null,this._loaded=!0,i)this.fire(new e.ErrorEvent(i));else if(n){const{HTMLImageElement:i}=e.window;this.image=n instanceof i?e.exported.getImageData(n):n,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,t&&(this.coordinates=t),this._finishLoading()}}))}loaded(){return this._loaded}updateImage(e){return this.image&&e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),this.texture&&this.texture.destroy()}setCoordinates(t){this.coordinates=t,this._boundsArray=void 0;const i=t.map(e.MercatorCoordinate.fromLngLat);return this.tileID=function(t){let i=1/0,n=1/0,o=-1/0,r=-1/0;for(const e of t)i=Math.min(i,e.x),n=Math.min(n,e.y),o=Math.max(o,e.x),r=Math.max(r,e.y);const s=Math.max(o-i,r-n),a=Math.max(0,Math.floor(-Math.log(s)/Math.LN2)),l=Math.pow(2,a);return new e.CanonicalTileID(a,Math.floor((i+o)/2*l),Math.floor((n+r)/2*l))}(i),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0}_prepareData(t){for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture)}if(this._boundsArray)return;const i=e.tileTransform(this.tileID,this.map.transform.projection),[n,o,r,s]=this.coordinates.map((t=>{const n=i.projection.project(t[0],t[1]);return e.getTilePoint(i,n)._round()}));this.perspectiveTransform=function(t,i,n,o,r,s,a,l,c,u){const d=ke(0,0,t,0,0,i,t,i),h=ke(n,o,r,s,a,l,c,u);return e.multiply$1(h,e.adjoint(d,d),h),[h[6]/h[8]*t/e.EXTENT,h[7]/h[8]*i/e.EXTENT]}(this.width,this.height,n.x,n.y,o.x,o.y,s.x,s.y,r.x,r.y);const a=this._boundsArray=new e.StructArrayLayout4i8;a.emplaceBack(n.x,n.y,0,0),a.emplaceBack(o.x,o.y,e.EXTENT,0),a.emplaceBack(s.x,s.y,0,e.EXTENT),a.emplaceBack(r.x,r.y,e.EXTENT,e.EXTENT),this.boundsBuffer&&this.boundsBuffer.destroy(),this.boundsBuffer=t.createVertexBuffer(a,e.boundsAttributes.members),this.boundsSegments=e.SegmentVector.simpleSegment(0,0,4,2)}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const t=this.map.painter.context,i=t.gl;this._dirty&&(this.texture?this.texture.update(this.image):(this.texture=new e.Texture(t,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)),this._dirty=!1),this._prepareData(t)}loadTile(e,t){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},t(null)):(e.state="errored",t(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}const Le={vector:Te,raster:Ce,"raster-dem":class extends Ce{constructor(t,i,n,o){super(t,i,n,o),this.type="raster-dem",this.maxzoom=22,this._options=e.extend({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox"}loadTile(t,i){const n=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function o(e,n){e&&(t.state="errored",i(e)),n&&(t.dem=n,t.dem.onDeserialize(),t.needsHillshadePrepare=!0,t.needsDEMTextureUpload=!0,t.state="loaded",i(null))}t.request=e.getImage(this.map._requestManager.transformRequest(n,e.ResourceType.Tile),function(n,r,s,a){if(delete t.request,t.aborted)t.state="unloaded",i(null);else if(n)t.state="errored",i(n);else if(r){this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:s,expires:a});const i=e.window.ImageBitmap&&r instanceof e.window.ImageBitmap&&(null==se&&(se=e.window.OffscreenCanvas&&new e.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof e.window.createImageBitmap),se),n=1-(r.width-e.prevPowerOfTwo(r.width))/2;n<1||t.neighboringTiles||(t.neighboringTiles=this._getNeighboringTiles(t.tileID));const l=i?r:e.exported.getImageData(r,n),c={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:l,encoding:this.encoding,padding:n};t.actor&&"expired"!==t.state||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",c,o.bind(this),void 0,!0))}}.bind(this))}_getNeighboringTiles(t){const i=t.canonical,n=Math.pow(2,i.z),o=(i.x-1+n)%n,r=0===i.x?t.wrap-1:t.wrap,s=(i.x+1+n)%n,a=i.x+1===n?t.wrap+1:t.wrap,l={};return l[new e.OverscaledTileID(t.overscaledZ,r,i.z,o,i.y).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,a,i.z,s,i.y).key]={backfilled:!1},i.y>0&&(l[new e.OverscaledTileID(t.overscaledZ,r,i.z,o,i.y-1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,t.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,a,i.z,s,i.y-1).key]={backfilled:!1}),i.y+1{if(this._loaded=!0,this._pendingLoad=null,t)this.fire(new e.ErrorEvent(t));else{const t={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&i&&i.resourceTiming&&i.resourceTiming[this.id]&&(t.resourceTiming=i.resourceTiming[this.id]),this.fire(new e.Event("data",t)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)}))}loaded(){return this._loaded}loadTile(t,i){const n=t.actor?"reloadTile":"loadTile";t.actor=this.actor,t.request=this.actor.send(n,{type:this.type,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:e.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},((e,o)=>(delete t.request,t.unloadVectorData(),t.aborted?i(null):e?i(e):(t.loadVectorData(o,this.map.painter,"reloadTile"===n),i(null)))),void 0,"loadTile"===n)}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._pendingLoad&&this._pendingLoad.cancel()}serialize(){return e.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends Se{constructor(e,t,i,n){super(e,t,i,n),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const i of t.urls)this.urls.push(this.map._requestManager.transformRequest(i,e.ResourceType.Source).url);e.getVideo(this.urls,((t,i)=>{this._loaded=!0,t?this.fire(new e.ErrorEvent(t)):i&&(this.video=i,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading())}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const i=this.video.seekable;ti.end(0)?this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const t=this.map.painter.context,i=t.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new e.Texture(t,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(t)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:Se,canvas:class extends Se{constructor(t,i,n,o){super(t,i,n,o),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((e=>!Array.isArray(e)||2!==e.length||e.some((e=>"number"!=typeof e))))||this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof e.window.HTMLCanvasElement||this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof e.window.HTMLCanvasElement?this.options.canvas:e.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.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 t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new e.Texture(i,this.canvas,i.gl.RGBA,{premultiply:!0}),this._prepareData(i)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}},custom:class extends e.Evented{constructor(t,i,n,o){super(),this.id=t,this.type="custom",this._dataType="raster",this._dispatcher=n,this._implementation=i,this.setEventedParent(o),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new e.ErrorEvent(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new e.ErrorEvent(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new B(this._implementation.bounds,this.minzoom,this.maxzoom)),i.update=this._update.bind(this),i.clearTiles=this._clearTiles.bind(this),i.coveringTiles=this._coveringTiles.bind(this),e.extend(this,e.pick(i,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return e.pick(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(t){this._map=t,this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(t),this.load()}onRemove(e){this._implementation.onRemove&&this._implementation.onRemove(e)}hasTile(e){if(this._implementation.hasTile){const{x:t,y:i,z:n}=e.canonical;return this._implementation.hasTile({x:t,y:i,z:n})}return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(t,i){const{x:n,y:o,z:r}=t.tileID.canonical,s=new e.window.AbortController;t.request=Promise.resolve(this._implementation.loadTile({x:n,y:o,z:r},{signal:s.signal})).then(function(n){return delete t.request,t.aborted?(t.state="unloaded",i(null)):void 0===n?(t.state="errored",i(null)):null===n?(this.loadTileData(t,{width:this.tileSize,height:this.tileSize,data:null}),t.state="loaded",i(null)):function(t){return t instanceof e.window.ImageData||t instanceof e.window.HTMLCanvasElement||t instanceof e.window.ImageBitmap||t instanceof e.window.HTMLImageElement}(n)?(this.loadTileData(t,n),t.state="loaded",void i(null)):(t.state="errored",i(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}.bind(this)).catch((e=>{20!==e.code&&(t.state="errored",i(e))})),t.request.cancel=()=>s.abort()}loadTileData(e,t){Ce.loadTileData(e,t,this._map.painter)}unloadTileData(e){Ce.unloadTileData(e,this._map.painter)}unloadTile(e,t){if(this.unloadTileData(e),this._implementation.unloadTile){const{x:t,y:i,z:n}=e.tileID.canonical;this._implementation.unloadTile({x:t,y:i,z:n})}t()}abortTile(e,t){e.request&&e.request.cancel&&(e.request.cancel(),delete e.request),t()}hasTransition(){return!1}_coveringTiles(){return this._map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map((e=>({x:e.canonical.x,y:e.canonical.y,z:e.canonical.z})))}_clearTiles(){this._map.style._clearSource(this.id)}_update(){this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))}}},Ae=function(t,i,n,o){const r=new Le[i.type](t,i,n,o);if(r.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${r.id}`);return e.bindAll(["load","abort","unload","serialize","prepare"],r),r};function Ie(t,i){const n=e.identity([]);return e.scale(n,n,[.5*t.width,.5*-t.height,1]),e.translate(n,n,[1,-1,0]),e.multiply(n,n,t.calculateProjMatrix(i.toUnwrapped())),Float32Array.from(n)}function De(e,t,i,n,o,r,s,a=!1){const l=e.tilesIn(n,s,a);l.sort(Pe);const c=[];for(const n of l)c.push({wrappedTileID:n.tile.tileID.wrapped().key,queryResults:n.tile.queryRenderedFeatures(t,i,e._state,n,o,r,Ie(e.transform,n.tile.tileID),a)});const u=function(e){const t={},i={};for(const n of e){const e=n.queryResults,o=n.wrappedTileID,r=i[o]=i[o]||{};for(const i in e){const n=e[i],o=r[i]=r[i]||{},s=t[i]=t[i]||[];for(const e of n)o[e.featureIndex]||(o[e.featureIndex]=!0,s.push(e))}}return t}(c);for(const t in u)u[t].forEach((t=>{const i=t.feature,n=i.layer;n&&"background"!==n.type&&"sky"!==n.type&&(i.source=n.source,n["source-layer"]&&(i.sourceLayer=n["source-layer"]),i.state=void 0!==i.id?e.getFeatureState(n["source-layer"],i.id):{})}));return u}function ze(e,t){const i=e.getRenderableIds().map((t=>e.getTileByID(t))),n=[],o={};for(let e=0;e{e.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Be]}numActive(){return Object.keys(this.active).length}}let Re;function Fe(){return Re||(Re=new je),Re}function Ne(t,i){const n={};for(const e in t)"ref"!==e&&(n[e]=t[e]);return e.refProperties.forEach((e=>{e in i&&(n[e]=i[e])})),n}function Ue(e){e=e.slice();const t=Object.create(null);for(let i=0;i0?(o-s)/a:0;return this.points[r].mult(1-l).add(this.points[i].mult(l))}}class Ke{constructor(e,t,i){const n=this.boxCells=[],o=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let e=0;ethis.width||n<0||t>this.height)return!o&&[];const s=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=n){if(o)return!0;for(let e=0;e0:s}_queryCircle(e,t,i,n,o){const r=e-i,s=e+i,a=t-i,l=t+i;if(s<0||r>this.width||l<0||a>this.height)return!n&&[];const c=[];return this._forEachCell(r,a,s,l,this._queryCellCircle,c,{hitTest:n,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}},o),n?c.length>0:c}query(e,t,i,n,o){return this._query(e,t,i,n,!1,o)}hitTest(e,t,i,n,o){return this._query(e,t,i,n,!0,o)}hitTestCircle(e,t,i,n){return this._queryCircle(e,t,i,!0,n)}_queryCell(e,t,i,n,o,r,s,a){const l=s.seenUids,c=this.boxCells[o];if(null!==c){const o=this.bboxes;for(const u of c)if(!l.box[u]){l.box[u]=!0;const c=4*u;if(e<=o[c+2]&&t<=o[c+3]&&i>=o[c+0]&&n>=o[c+1]&&(!a||a(this.boxKeys[u]))){if(s.hitTest)return r.push(!0),!0;r.push({key:this.boxKeys[u],x1:o[c],y1:o[c+1],x2:o[c+2],y2:o[c+3]})}}}const u=this.circleCells[o];if(null!==u){const o=this.circles;for(const c of u)if(!l.circle[c]){l.circle[c]=!0;const u=3*c;if(this._circleAndRectCollide(o[u],o[u+1],o[u+2],e,t,i,n)&&(!a||a(this.circleKeys[c]))){if(s.hitTest)return r.push(!0),!0;{const e=o[u],t=o[u+1],i=o[u+2];r.push({key:this.circleKeys[c],x1:e-i,y1:t-i,x2:e+i,y2:t+i})}}}}}_queryCellCircle(e,t,i,n,o,r,s,a){const l=s.circle,c=s.seenUids,u=this.boxCells[o];if(null!==u){const e=this.bboxes;for(const t of u)if(!c.box[t]){c.box[t]=!0;const i=4*t;if(this._circleAndRectCollide(l.x,l.y,l.radius,e[i+0],e[i+1],e[i+2],e[i+3])&&(!a||a(this.boxKeys[t])))return r.push(!0),!0}}const d=this.circleCells[o];if(null!==d){const e=this.circles;for(const t of d)if(!c.circle[t]){c.circle[t]=!0;const i=3*t;if(this._circlesCollide(e[i],e[i+1],e[i+2],l.x,l.y,l.radius)&&(!a||a(this.circleKeys[t])))return r.push(!0),!0}}}_forEachCell(e,t,i,n,o,r,s,a){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(i),d=this._convertToYCellCoord(n);for(let h=l;h<=u;h++)for(let l=c;l<=d;l++)if(o.call(this,e,t,i,n,this.xCellCount*l+h,r,s,a))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,n,o,r){const s=n-e,a=o-t,l=i+r;return l*l>s*s+a*a}_circleAndRectCollide(e,t,i,n,o,r,s){const a=(r-n)/2,l=Math.abs(e-(n+a));if(l>a+i)return!1;const c=(s-o)/2,u=Math.abs(t-(o+c));if(u>c+i)return!1;if(l<=a||u<=c)return!0;const d=l-a,h=u-c;return d*d+h*h<=i*i}}const Qe={unknown:0,flipRequired:1,flipNotRequired:2},Je=Math.tan(85*Math.PI/180);function et(t,i,n,o,r,s,a){const l=e.create();if(n)if("globe"===s.name){const t=e.calculateGlobeLabelMatrix(r,i);e.multiply(l,l,t)}else{const t=y([],a);l[0]=t[0],l[1]=t[1],l[4]=t[2],l[5]=t[3],o||e.rotateZ(l,l,r.angle)}else e.multiply(l,r.labelPlaneMatrix,t);return l}function tt(e,t,i,n,o,r,s){const a=et(e,t,i,n,o,r,s);return"globe"===r.name&&i||(a[2]=a[6]=a[10]=a[14]=0),a}function it(t,i,n,o,r,s,a){if(n){if("globe"===s.name){const l=et(t,i,n,o,r,s,a);return e.invert(l,l),e.multiply(l,t,l),l}{const i=e.clone(t),n=e.identity([]);return n[0]=a[0],n[1]=a[1],n[4]=a[2],n[5]=a[3],e.multiply(i,i,n),o||e.rotateZ(i,i,-r.angle),i}}return r.glCoordMatrix}function nt(t,i,n,o){const r=[t,i,n,1];n?e.transformMat4$1(r,r,o):mt(r,r,o);const s=r[3];return r[0]/=s,r[1]/=s,r[2]/=s,r}function ot(e,t){return Math.min(.5+e/t*.5,1.5)}function rt(e,t){const i=e[0]/e[3],n=e[1]/e[3];return i>=-t[0]&&i<=t[0]&&n>=-t[1]&&n<=t[1]}function st(t,i,n,o,r,s,a,l,c,u){const d=n.transform,h=o?t.textSizeData:t.iconSizeData,p=e.evaluateSizeForZoom(h,n.transform.zoom),m="globe"===d.projection.name,f=[256/n.width*2+1,256/n.height*2+1],g=o?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;g.clear();let _=null;m&&(_=o?t.text.globeExtVertexArray:t.icon.globeExtVertexArray);const y=t.lineVertexArray,b=o?t.text.placedSymbolArray:t.icon.placedSymbolArray,x=n.transform.width/n.transform.height;let v,w=!1;for(let o=0;oMath.abs(n)?{useVertical:!0}:t===e.WritingMode.vertical?o>0?{needsFlipping:!0}:null:i!==Qe.unknown&&function(e,t){return 0===e||Math.abs(t/e)>Je}(n,o)?i===Qe.flipRequired?{needsFlipping:!0}:null:n<0?{needsFlipping:!0}:null}function ct(t,i,n,o,r,s,a,l,c,u,d,h,p,m,f,g,_,y,b){const x=i/24,v=t.lineOffsetX*x,w=t.lineOffsetY*x,{lineStartIndex:E,glyphStartIndex:M,numGlyphs:T,segment:C,writingMode:k,flipState:S}=t,L=E+t.lineLength,A=t=>{if(d){const[i,n,o]=t.up,r=u.length;e.updateGlobeVertexNormal(d,r+0,i,n,o),e.updateGlobeVertexNormal(d,r+1,i,n,o),e.updateGlobeVertexNormal(d,r+2,i,n,o),e.updateGlobeVertexNormal(d,r+3,i,n,o)}const[i,n,o]=t.point;e.addDynamicAttributes(u,i,n,o,t.angle)};if(T>1){const e=at(x,l,v,w,n,h,p,t,c,s,m,g,!1,_,y,b);if(!e)return{notEnoughRoom:!0};if(o&&!n){let[i,n,o]=e.first.point,[r,s,l]=e.last.point;[i,n]=nt(i,n,o,a),[r,s]=nt(r,s,l,a);const c=lt(k,S,(r-i)*f,s-n);if(t.flipState=c&&c.needsFlipping?Qe.flipRequired:Qe.flipNotRequired,c)return c}A(e.first);for(let e=M+1;e0?s:dt(p,o,i,1,r,void 0,_,y.canonical),l=lt(k,S,(a[0]-i[0])*f,a[1]-i[1]);if(t.flipState=l&&l.needsFlipping?Qe.flipRequired:Qe.flipNotRequired,l)return l}const i=ht(x*l.getoffsetX(M),v,w,n,h,p,C,E,L,c,s,m,g,!1,!1,_,y,b);if(!i)return{notEnoughRoom:!0};A(i)}return{}}function ut(e,t,i,n,o){const{x:r,y:s,z:a}=n.projectTilePoint(e.x,e.y,t);if(!o)return nt(r,s,a,i);const[l,c,u]=o(e);return nt(r+l,s+c,a+u,i)}function dt(t,i,n,o,r,s,a,l){const c=ut(t.sub(i)._unit()._add(t),l,r,a,s);return e.sub(c,n,c),e.normalize(c,c),e.scaleAndAdd(c,n,c,o)}function ht(t,i,n,o,r,s,a,l,c,u,d,h,p,m,f,g,_,y){const b=o?t-i:t+i;let x=b>0?1:-1,v=0;o&&(x*=-1,v=Math.PI),x<0&&(v+=Math.PI);let w=l+a+(x>0?0:1)|0,E=r,M=r,T=0,C=0;const k=Math.abs(b),S=[],L=[];let A=s,I=A;const D=()=>dt(I,A,M,k-T+1,d,p,g,_.canonical);for(;T+C<=k;){if(w+=x,w=c)return null;if(M=E,I=A,S.push(M),m&&L.push(I),A=new e.Point(u.getx(w),u.gety(w)),E=h[w],!E){const e=ut(A,_.canonical,d,g,p);E=e[3]>0?h[w]=e:D()}T+=C,C=e.distance(M,E)}f&&p&&(h[w]&&(E=D(),C=e.distance(M,E)),h[w]=E);const z=(k-T)/C,P=A.sub(I)._mult(z)._add(I),O=e.sub([],E,M),B=e.scaleAndAdd([],M,O,z);let j=[0,0,1],R=O[0],F=O[1];if(y&&(j=g.upVector(_.canonical,P.x,P.y),0!==j[0]||0!==j[1]||1!==j[2])){const t=[j[2],0,-j[0]],i=e.cross([],j,t);e.normalize(t,t),e.normalize(i,i),R=e.dot(O,t),F=e.dot(O,i)}if(n){const t=e.cross([],j,O);e.normalize(t,t),e.scaleAndAdd(B,B,t,n*x)}const N=v+Math.atan2(F,R);return S.push(B),m&&L.push(P),{point:B,angle:N,path:S,tilePath:L,up:j}}function pt(e,t){const i=t.length,n=i+4*e;t.resize(n),t.float32.fill(-1/0,4*i,4*n)}function mt(e,t,i){const n=t[0],o=t[1];return e[0]=i[0]*n+i[4]*o+i[12],e[1]=i[1]*n+i[5]*o+i[13],e[3]=i[3]*n+i[7]*o+i[15],e}const ft=100;class gt{constructor(e,t,i=new Ke(e.width+200,e.height+200,25),n=new Ke(e.width+200,e.height+200,25)){this.transform=e,this.grid=i,this.ignoredGrid=n,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+ft,this.screenBottomBoundary=e.height+ft,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.fogState=t}placeCollisionBox(e,t,i,n,o,r,s,a){let l=i.projectedAnchorX,c=i.projectedAnchorY,u=i.projectedAnchorZ;const d=i.elevation,h=i.tileID,p=e.getProjection();if(d&&h){const[e,t,n]=p.upVector(h.canonical,i.tileAnchorX,i.tileAnchorY),o=p.upVectorScale(h.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;l+=e*d*o,c+=t*d*o,u+=n*d*o}const m=this.projectAndGetPerspectiveRatio(s,l,c,u,i.tileID,"globe"===p.name||!!d||this.transform.pitch>0,p),f=r*m.perspectiveRatio,g=(i.x1*t+n.x-i.padding)*f+m.point.x,_=(i.y1*t+n.y-i.padding)*f+m.point.y,y=(i.x2*t+n.x+i.padding)*f+m.point.x,b=(i.y2*t+n.y+i.padding)*f+m.point.y,x=m.perspectiveRatio<=.55||m.occluded;return!this.isInsideGrid(g,_,y,b)||!o&&this.grid.hitTest(g,_,y,b,a)||x?{box:[],offscreen:!1,occluded:m.occluded}:{box:[g,_,y,b],offscreen:this.isOffscreen(g,_,y,b),occluded:!1}}placeCollisionCircles(t,i,n,o,r,s,a,l,c,u,d,h,p,m,f){const g=[],_=this.transform.elevation,y=t.getProjection(),b=_?_.getAtTileOffsetFunc(f,this.transform.center.lat,this.transform.worldSize,y):null,x=new e.Point(n.tileAnchorX,n.tileAnchorY);let{x:v,y:w,z:E}=y.projectTilePoint(x.x,x.y,f.canonical);if(b){const[e,t,i]=b(x);v+=e,w+=t,E+=i}const M="globe"===y.name,T=this.projectAndGetPerspectiveRatio(a,v,w,E,f,M||!!_||this.transform.pitch>0,y),{perspectiveRatio:C}=T,k=(d?s/C:s*C)/e.ONE_EM,S=nt(v,w,E,l),L=T.signedDistanceFromCamera>0?at(k,r,n.lineOffsetX*k,n.lineOffsetY*k,!1,S,x,n,o,l,{},_&&!d?b:null,d&&!!_,y,f,d):null;let A=!1,I=!1,D=!0;if(L&&!T.occluded){const t=.5*p*C+m,n=new e.Point(-100,-100),o=new e.Point(this.screenRightBoundary,this.screenBottomBoundary),r=new Ye,{first:s,last:a}=L,l=s.path.length;let d=[];for(let e=l-1;e>=1;e--)d.push(s.path[e]);for(let e=1;e(b&&!M&&(i=b(ne[3]<=0))&&(d=[]));let _=[];if(d.length>0){let t=1/0,i=-1/0,r=1/0,s=-1/0;for(const e of d)t=Math.min(t,e[0]),r=Math.min(r,e[1]),i=Math.max(i,e[0]),s=Math.max(s,e[1]);i>=n.x&&t<=o.x&&s>=n.y&&r<=o.y&&(_=[d.map((t=>new e.Point(t[0],t[1])))],(to.x||ro.y)&&(_=e.clipLine(_,n.x,n.y,o.x,o.y)))}for(const e of _){r.reset(e,.25*t);let n=0;n=r.length<=.5*t?1:Math.ceil(r.paddedLength/f)+1;for(let e=0;e0){if(e.transformMat4$1(l,l,t),this.fogState&&r&&"globe"!==a.name){const t=function(t,i,n,o,r,s){const a=s.calculateFogTileMatrix(r),l=[i,n,o];return e.transformMat4(l,l,a),T(t,l,s.pitch,s._fov)}(this.fogState,i,n,o,r.toUnwrapped(),this.transform);c=t>.9}}else mt(l,l,t);const u=l[3];return{point:new e.Point((l[0]/u+1)/2*this.transform.width+ft,(-l[1]/u+1)/2*this.transform.height+ft),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(a)/u*.5,1.5),signedDistanceFromCamera:u,occluded:s&&l[2]>u||c}}isOffscreen(e,t,i,n){return i=this.screenRightBoundary||nthis.screenBottomBoundary}isInsideGrid(e,t,i,n){return i>=0&&e=0&&te.collisionGroupID===t}}return this.collisionGroups[e]}}function Ct(t,i,n,o,r){const{horizontalAlign:s,verticalAlign:a}=e.getAnchorAlignment(t),l=-(s-.5)*i,c=-(a-.5)*n,u=e.evaluateVariableOffset(t,o);return new e.Point(l+u[0]*r,c+u[1]*r)}function kt(t,i,n,o,r){const s=new e.Point(t,i);return n&&s._rotate(o?r:-r),s}class St{constructor(e,t,i,n,o){this.transform=e.clone(),this.projection=e.projection.name,this.collisionIndex=new gt(this.transform,o),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=t,this.retainedQueryData={},this.collisionGroups=new Tt(i),this.collisionCircleArrays={},this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,i,n,o){const r=n.getBucket(i),s=n.latestFeatureIndex;if(!r||!s||i.id!==r.layerIds[0])return;const a=r.layers[0].layout,l=n.collisionBoxArray,c=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),u=n.tileSize/e.EXTENT,d=n.tileID.toUnwrapped();this.transform.setProjection(r.projection);const h=(p=n.tileID,m=r.getProjection(),f=this.transform,m.name===this.projection?f.calculateProjMatrix(p.toUnwrapped()):_t(f,m,p));var p,m,f;const g="map"===a.get("text-pitch-alignment"),_="map"===a.get("text-rotation-alignment");i.compileFilter();const y=i.dynamicFilter(),b=i.dynamicFilterNeedsFeature(),x=this.transform.calculatePixelsToTileUnitsMatrix(n),v=tt(h,n.tileID.canonical,g,_,this.transform,r.getProjection(),x);let w=null;if(g){const t=it(h,n.tileID.canonical,g,_,this.transform,r.getProjection(),x);w=e.multiply([],this.transform.labelPlaneMatrix,t)}let E=null;y&&n.latestFeatureIndex&&(E={unwrappedTileID:d,dynamicFilter:y,dynamicFilterNeedsFeature:b,featureIndex:n.latestFeatureIndex}),this.retainedQueryData[r.bucketInstanceId]=new Mt(r.bucketInstanceId,s,r.sourceLayerIndex,r.index,n.tileID);const M={bucket:r,layout:a,posMatrix:h,textLabelPlaneMatrix:v,labelToScreenMatrix:w,clippingData:E,scale:c,textPixelRatio:u,holdingForFade:n.holdingForFade(),collisionBoxArray:l,partiallyEvaluatedTextSize:e.evaluateSizeForZoom(r.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:e.evaluateSizeForZoom(r.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(r.sourceID)};if(o)for(const e of r.sortKeyRanges){const{sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:o}=e;t.push({sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:o,parameters:M})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:r.symbolInstances.length,parameters:M})}attemptAnchorPlacement(e,t,i,n,o,r,s,a,l,c,u,d,h,p,m,f,g,_){const{textOffset0:y,textOffset1:b,crossTileID:x}=d,v=[y,b],w=Ct(e,i,n,v,o),E=this.collisionIndex.placeCollisionBox(p,o,t,kt(w.x,w.y,r,s,this.transform.angle),u,a,l,c.predicate);if(f){const e=p.getSymbolInstanceIconSize(_,this.transform.zoom,d.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(p,e,f,kt(w.x,w.y,r,s,this.transform.angle),u,a,l,c.predicate).box.length)return}if(E.box.length>0){let t;return this.prevPlacement&&this.prevPlacement.variableOffsets[x]&&this.prevPlacement.placements[x]&&this.prevPlacement.placements[x].text&&(t=this.prevPlacement.variableOffsets[x].anchor),this.variableOffsets[x]={textOffset:v,width:i,height:n,anchor:e,textScale:o,prevAnchor:t},this.markUsedJustification(p,e,d,m),p.allowVerticalPlacement&&(this.markUsedOrientation(p,m,d),this.placedOrientations[x]=m),{shift:w,placedGlyphBoxes:E}}}placeLayerBucketPart(t,i,n,o){const{bucket:r,layout:s,posMatrix:a,textLabelPlaneMatrix:l,labelToScreenMatrix:c,clippingData:u,textPixelRatio:d,holdingForFade:h,collisionBoxArray:p,partiallyEvaluatedTextSize:m,partiallyEvaluatedIconSize:f,collisionGroup:g}=t.parameters,_=s.get("text-optional"),y=s.get("icon-optional"),b=s.get("text-allow-overlap"),x=s.get("icon-allow-overlap"),v="map"===s.get("text-rotation-alignment"),w="map"===s.get("text-pitch-alignment"),E="none"!==s.get("icon-text-fit"),M="viewport-y"===s.get("symbol-z-order");this.transform.setProjection(r.projection);let T=b&&(x||!r.hasIconData()||y),C=x&&(b||!r.hasTextData()||_);!r.collisionArrays&&p&&r.deserializeCollisionBoxes(p),n&&o&&r.updateCollisionDebugBuffers(this.transform.zoom,p);const k=(t,o,p)=>{const{crossTileID:M,numVerticalGlyphVertices:k}=t;if(u){const n={zoom:this.transform.zoom,pitch:this.transform.pitch};let o=null;if(u.dynamicFilterNeedsFeature){const e=this.retainedQueryData[r.bucketInstanceId];o=u.featureIndex.loadFeature({featureIndex:t.featureIndex,bucketIndex:e.bucketIndex,sourceLayerIndex:e.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,u.dynamicFilter)(n,o,this.retainedQueryData[r.bucketInstanceId].tileID.canonical,new e.Point(t.tileAnchorX,t.tileAnchorY),this.transform.calculateDistanceTileData(u.unwrappedTileID)))return this.placements[M]=new wt(!1,!1,!1,!0),void i.add(M)}if(i.has(M))return;if(h)return void(this.placements[M]=new wt(!1,!1,!1));let S=!1,L=!1,A=!0,I=!1,D=!1,z=null,P={box:null,offscreen:null,occluded:null},O={box:null,offscreen:null,occluded:null},B=null,j=null,R=null,F=0,N=0,U=0;p.textFeatureIndex?F=p.textFeatureIndex:t.useRuntimeCollisionCircles&&(F=t.featureIndex),p.verticalTextFeatureIndex&&(N=p.verticalTextFeatureIndex);const V=e=>{e.tileID=this.retainedQueryData[r.bucketInstanceId].tileID;const t=this.transform.elevation;(t||e.elevation)&&(e.elevation=t?t.getAtTileOffset(e.tileID,e.tileAnchorX,e.tileAnchorY):0)},$=p.textBox;if($){V($);const i=i=>{let n=e.WritingMode.horizontal;if(r.allowVerticalPlacement&&!i&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[M];e&&(this.placedOrientations[M]=e,n=e,this.markUsedOrientation(r,n,t))}return n},n=(t,i)=>{if(r.allowVerticalPlacement&&k>0&&p.verticalTextBox){for(const n of r.writingModes)if(n===e.WritingMode.vertical?(P=i(),O=P):P=t(),P&&P.box&&P.box.length)break}else P=t()};if(s.get("text-variable-anchor")){let l=s.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[M]){const e=this.prevPlacement.variableOffsets[M];l.indexOf(e.anchor)>0&&(l=l.filter((t=>t!==e.anchor)),l.unshift(e.anchor))}const c=(e,i,n)=>{const s=r.getSymbolInstanceTextSize(m,t,this.transform.zoom,o),c=(e.x2-e.x1)*s+2*e.padding,u=(e.y2-e.y1)*s+2*e.padding,h=E&&!x?i:null;h&&V(h);let p={box:[],offscreen:!1,occluded:!1};const _=b?2*l.length:l.length;for(let i=0;i<_;++i){const _=this.attemptAnchorPlacement(l[i%l.length],e,c,u,s,v,w,d,a,g,i>=l.length,t,o,r,n,h,m,f);if(_&&(p=_.placedGlyphBoxes,p&&p.box&&p.box.length)){S=!0,z=_.shift;break}}return p};n((()=>c($,p.iconBox,e.WritingMode.horizontal)),(()=>{const t=p.verticalTextBox;return t&&V(t),r.allowVerticalPlacement&&!(P&&P.box&&P.box.length)&&k>0&&t?c(t,p.verticalIconBox,e.WritingMode.vertical):{box:null,offscreen:null,occluded:null}})),P&&(S=P.box,A=P.offscreen,I=P.occluded);const u=i(!(!P||!P.box));if(!S&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[M];e&&(this.variableOffsets[M]=e,this.markUsedJustification(r,e.anchor,t,u))}}else{const s=(i,n)=>{const s=r.getSymbolInstanceTextSize(m,t,this.transform.zoom,o),l=this.collisionIndex.placeCollisionBox(r,s,i,new e.Point(0,0),b,d,a,g.predicate);return l&&l.box&&l.box.length&&(this.markUsedOrientation(r,n,t),this.placedOrientations[M]=n),l};n((()=>s($,e.WritingMode.horizontal)),(()=>{const t=p.verticalTextBox;return r.allowVerticalPlacement&&k>0&&t?(V(t),s(t,e.WritingMode.vertical)):{box:null,offscreen:null,occluded:null}})),i(!!(P&&P.box&&P.box.length))}}if(B=P,S=B&&B.box&&B.box.length>0,A=B&&B.offscreen,I=B&&B.occluded,t.useRuntimeCollisionCircles){const i=r.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex),o=e.evaluateSizeForFeature(r.textSizeData,m,i),u=s.get("text-padding");j=this.collisionIndex.placeCollisionCircles(r,b,i,r.lineVertexArray,r.glyphOffsetArray,o,a,l,c,n,w,g.predicate,t.collisionCircleDiameter*o/e.ONE_EM,u,this.retainedQueryData[r.bucketInstanceId].tileID),S=b||j.circles.length>0&&!j.collisionDetected,A=A&&j.offscreen,I=j.occluded}if(p.iconFeatureIndex&&(U=p.iconFeatureIndex),p.iconBox){const i=i=>{V(i);const n=E&&z?kt(z.x,z.y,v,w,this.transform.angle):new e.Point(0,0),o=r.getSymbolInstanceIconSize(f,this.transform.zoom,t.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(r,o,i,n,x,d,a,g.predicate)};O&&O.box&&O.box.length&&p.verticalIconBox?(R=i(p.verticalIconBox),L=R.box.length>0):(R=i(p.iconBox),L=R.box.length>0),A=A&&R.offscreen,D=R.occluded}const q=_||0===t.numHorizontalGlyphVertices&&0===k,G=y||0===t.numIconVertices;if(q||G?G?q||(L=L&&S):S=L&&S:L=S=L&&S,S&&B&&B.box&&this.collisionIndex.insertCollisionBox(B.box,s.get("text-ignore-placement"),r.bucketInstanceId,O&&O.box&&N?N:F,g.ID),L&&R&&this.collisionIndex.insertCollisionBox(R.box,s.get("icon-ignore-placement"),r.bucketInstanceId,U,g.ID),j&&(S&&this.collisionIndex.insertCollisionCircles(j.circles,s.get("text-ignore-placement"),r.bucketInstanceId,F,g.ID),n)){const e=r.bucketInstanceId;let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=new Et);for(let e=0;e=0;--t){const i=e[t];k(r.symbolInstances.get(i),i,r.collisionArrays[i])}}else for(let e=t.symbolInstanceStart;e=0&&(t.text.placedSymbolArray.get(r).crossTileID=d>=0&&r!==d?0:c),s>=0&&(t.text.placedSymbolArray.get(s).crossTileID=d>=0&&s!==d?0:c),a>=0&&(t.text.placedSymbolArray.get(a).crossTileID=d>=0&&a!==d?0:c),l>=0&&(t.text.placedSymbolArray.get(l).crossTileID=d>=0&&l!==d?0:c)}markUsedOrientation(t,i,n){const o=i===e.WritingMode.horizontal||i===e.WritingMode.horizontalOnly?i:0,r=i===e.WritingMode.vertical?i:0,{leftJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:a,rightJustifiedTextSymbolIndex:l,verticalPlacedTextSymbolIndex:c}=n,u=t.text.placedSymbolArray;s>=0&&(u.get(s).placedOrientation=o),a>=0&&(u.get(a).placedOrientation=o),l>=0&&(u.get(l).placedOrientation=o),c>=0&&(u.get(c).placedOrientation=r)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const t=this.prevPlacement;let i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;const n=t?t.symbolFadeChange(e):1,o=t?t.opacities:{},r=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(const e in this.placements){const t=this.placements[e],r=o[e];r?(this.opacities[e]=new vt(r,n,t.text,t.icon,null,t.clipped),i=i||t.text!==r.text.placed||t.icon!==r.icon.placed):(this.opacities[e]=new vt(null,n,t.text,t.icon,t.skipFade,t.clipped),i=i||t.text||t.icon)}for(const e in o){const t=o[e];if(!this.opacities[e]){const o=new vt(t,n,!1,!1);o.isHidden()||(this.opacities[e]=o,i=i||t.text.placed||t.icon.placed)}}for(const e in r)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=r[e]);for(const e in s)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=s[e]);i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){const i=new Set;for(const n of t){const t=n.getBucket(e);t&&n.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,i,n.collisionBoxArray)}}updateBucketOpacities(t,i,n){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const o=t.layers[0].layout,r=!!t.layers[0].dynamicFilter(),s=new vt(null,0,!1,!1,!0),a=o.get("text-allow-overlap"),l=o.get("icon-allow-overlap"),c=o.get("text-variable-anchor"),u="map"===o.get("text-rotation-alignment"),d="map"===o.get("text-pitch-alignment"),h="none"!==o.get("icon-text-fit"),p=new vt(null,0,a&&(l||!t.hasIconData()||o.get("icon-optional")),l&&(a||!t.hasTextData()||o.get("text-optional")),!0);!t.collisionArrays&&n&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(n);const m=(e,t,i)=>{for(let n=0;n0||l>0,v=_>0,w=this.placedOrientations[g],E=w===e.WritingMode.vertical,M=w===e.WritingMode.horizontal||w===e.WritingMode.horizontalOnly;if(!x&&!v||b.isHidden()||f++,x){const e=jt(b.text);m(t.text,a,E?Rt:e),m(t.text,l,M?Rt:e);const i=b.text.isHidden(),{leftJustifiedTextSymbolIndex:n,centerJustifiedTextSymbolIndex:r,rightJustifiedTextSymbolIndex:s,verticalPlacedTextSymbolIndex:c}=o,u=t.text.placedSymbolArray,d=i||E?1:0;n>=0&&(u.get(n).hidden=d),r>=0&&(u.get(r).hidden=d),s>=0&&(u.get(s).hidden=d),c>=0&&(u.get(c).hidden=i||M?1:0);const h=this.variableOffsets[g];h&&this.markUsedJustification(t,h.anchor,o,w);const p=this.placedOrientations[g];p&&(this.markUsedJustification(t,"left",o,p),this.markUsedOrientation(t,p,o))}if(v){const e=jt(b.icon),{placedIconSymbolIndex:i,verticalPlacedIconSymbolIndex:n}=o,r=t.icon.placedSymbolArray,s=b.icon.isHidden()?1:0;i>=0&&(m(t.icon,_,E?Rt:e),r.get(i).hidden=s),n>=0&&(m(t.icon,o.numVerticalIconVertices,M?Rt:e),r.get(n).hidden=s)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const i=t.collisionArrays[n];if(i){let n=new e.Point(0,0),o=!0;if(i.textBox||i.verticalTextBox){if(c){const e=this.variableOffsets[g];e?(n=Ct(e.anchor,e.width,e.height,e.textOffset,e.textScale),u&&n._rotate(d?this.transform.angle:-this.transform.angle)):o=!1}r&&(o=!b.clipped),i.textBox&&Lt(t.textCollisionBox.collisionVertexArray,b.text.placed,!o||E,n.x,n.y),i.verticalTextBox&&Lt(t.textCollisionBox.collisionVertexArray,b.text.placed,!o||M,n.x,n.y)}const s=o&&Boolean(!M&&i.verticalIconBox);i.iconBox&&Lt(t.iconCollisionBox.collisionVertexArray,b.icon.placed,s,h?n.x:0,h?n.y:0),i.verticalIconBox&&Lt(t.iconCollisionBox.collisionVertexArray,b.icon.placed,!s,h?n.x:0,h?n.y:0)}}}if(t.fullyClipped=0===f,t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=e.invProjMatrix,t.placementViewportMatrix=e.viewportMatrix,t.collisionCircleArray=e.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTimee}setStale(){this.stale=!0}}function Lt(e,t,i,n,o){e.emplaceBack(t?1:0,i?1:0,n||0,o||0),e.emplaceBack(t?1:0,i?1:0,n||0,o||0),e.emplaceBack(t?1:0,i?1:0,n||0,o||0),e.emplaceBack(t?1:0,i?1:0,n||0,o||0)}const At=Math.pow(2,25),It=Math.pow(2,24),Dt=Math.pow(2,17),zt=Math.pow(2,16),Pt=Math.pow(2,9),Ot=Math.pow(2,8),Bt=Math.pow(2,1);function jt(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;const t=e.placed?1:0,i=Math.floor(127*e.opacity);return i*At+t*It+i*Dt+t*zt+i*Pt+t*Ot+i*Bt+t}const Rt=0;class Ft{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&void 0!==e.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(e,t,i,n,o){const r=this._bucketParts;for(;this._currentTileIndexe.sortKey-t.sortKey)));this._currentPartIndex{const t=e.exported.now()-o;return!this._forceFullPlacement&&t>2};for(;this._currentPlacementIndex>=0;){const e=i[t[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if("symbol"===e.type&&(!e.minzoom||e.minzoom<=o)&&(!e.maxzoom||e.maxzoom>o)){if(this._inProgressLayer||(this._inProgressLayer=new Ft(e)),this._inProgressLayer.continuePlacement(n[e.source],this.placement,this._showCollisionBoxes,e,r))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Ut=512/e.EXTENT/2;class Vt{constructor(t,i,n){this.tileID=t,this.bucketInstanceId=n,this.index=new e.KDBush(i.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const o=t.canonical.x*e.EXTENT,r=t.canonical.y*e.EXTENT;for(let e=0;ee.overscaledZ)for(const i in o){const r=o[i];r.tileID.isChildOf(e)&&r.findMatches(t.symbolInstances,e,n)}else{const r=o[e.scaledTo(Number(i)).key];r&&r.findMatches(t.symbolInstances,e,n)}}for(let e=0;e{t[e]=!0}));for(const e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}const Zt=(t,i)=>e.emitValidationErrors(t,i&&i.filter((e=>"source.canvas"!==e.identifier))),Ht=e.pick(Ve,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection"]),Wt=e.pick(Ve,["setCenter","setZoom","setBearing","setPitch"]),Xt={version:8,layers:[],sources:{}},Yt={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class Kt extends e.Evented{constructor(t,i={}){super(),this.map=t,this.dispatcher=new L(Fe(),this),this.imageManager=new x,this.imageManager.setEventedParent(this),this.glyphManager=new e.GlyphManager(t._requestManager,i.localFontFamily?e.LocalGlyphMode.all:i.localIdeographFontFamily?e.LocalGlyphMode.ideographs:e.LocalGlyphMode.none,i.localFontFamily||i.localIdeographFontFamily),this.crossTileSymbolIndex=new Gt,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedUpdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",e.getReferrer());const n=this;this._rtlTextPluginCallback=Kt.registerForPluginStateChange((t=>{n.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:t.pluginStatus,pluginURL:t.pluginURL},((t,i)=>{if(e.triggerPluginCompletionEvent(t),i&&i.every((e=>e)))for(const e in n._sourceCaches){const t=n._sourceCaches[e],i=t.getSource().type;"vector"!==i&&"geojson"!==i||t.reload()}}))})),this.on("data",(e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const t=this.getSource(e.sourceId);if(t&&t.vectorLayerIds)for(const e in this._layers){const i=this._layers[e];i.source===t.id&&this._validateLayer(i)}}))}loadURL(t,i={}){this.fire(new e.Event("dataloading",{dataType:"style"}));const n="boolean"==typeof i.validate?i.validate:!e.isMapboxURL(t);t=this.map._requestManager.normalizeStyleURL(t,i.accessToken);const o=this.map._requestManager.transformRequest(t,e.ResourceType.Style);this._request=e.getJSON(o,((t,i)=>{this._request=null,t?this.fire(new e.ErrorEvent(t)):i&&this._load(i,n)}))}loadJSON(t,i={}){this.fire(new e.Event("dataloading",{dataType:"style"})),this._request=e.exported.frame((()=>{this._request=null,this._load(t,!1!==i.validate)}))}loadEmpty(){this.fire(new e.Event("dataloading",{dataType:"style"})),this._load(Xt,!1)}_updateLayerCount(e,t){const i=t?1:-1;e.is3D()&&(this._num3DLayers+=i),"circle"===e.type&&(this._numCircleLayers+=i),"symbol"===e.type&&(this._numSymbolLayers+=i)}_load(t,i){if(i&&Zt(this,e.validateStyle(t)))return;this._loaded=!0,this.stylesheet=e.clone$1(t),this._updateMapProjection();for(const e in t.sources)this.addSource(e,t.sources[e],{validate:!1});this._changed=!1,t.sprite?this._loadSprite(t.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(t.glyphs);const n=Ue(this.stylesheet.layers);this._order=n.map((e=>e.id)),this._layers={},this._serializedLayers={};for(const t of n){const i=e.createStyleLayer(t);i.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=i,this._serializedLayers[i.id]=i.serialize(),this._updateLayerCount(i,!0)}this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new w(this.stylesheet.light),this.stylesheet.terrain&&!this.terrainSetForDrapingOnly()&&this._createTerrain(this.stylesheet.terrain,1),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this._updateDrapeFirstLayers(),this.fire(new e.Event("data",{dataType:"style"})),this.fire(new e.Event("style.load"))}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}setProjection(e){e?this.stylesheet.projection=e:delete this.stylesheet.projection,this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null))}_updateMapProjection(){this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.stylesheet.projection)}_loadSprite(t){this._spriteRequest=function(t,i,n){let o,r,s;const a=e.exported.devicePixelRatio>1?"@2x":"";let l=e.getJSON(i.transformRequest(i.normalizeSpriteURL(t,a,".json"),e.ResourceType.SpriteJSON),((e,t)=>{l=null,s||(s=e,o=t,u())})),c=e.getImage(i.transformRequest(i.normalizeSpriteURL(t,a,".png"),e.ResourceType.SpriteImage),((e,t)=>{c=null,s||(s=e,r=t,u())}));function u(){if(s)n(s);else if(o&&r){const t=e.exported.getImageData(r),i={};for(const n in o){const{width:r,height:s,x:a,y:l,sdf:c,pixelRatio:u,stretchX:d,stretchY:h,content:p}=o[n],m=new e.RGBAImage({width:r,height:s});e.RGBAImage.copy(t,m,{x:a,y:l},{x:0,y:0},{width:r,height:s}),i[n]={data:m,pixelRatio:u,sdf:c,stretchX:d,stretchY:h,content:p}}n(null,i)}}return{cancel(){l&&(l.cancel(),l=null),c&&(c.cancel(),c=null)}}}(t,this.map._requestManager,((t,i)=>{if(this._spriteRequest=null,t)this.fire(new e.ErrorEvent(t));else if(i)for(const e in i)this.imageManager.addImage(e,i[e]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new e.Event("data",{dataType:"style"}))}))}_validateLayer(t){const i=this.getSource(t.source);if(!i)return;const n=t.sourceLayer;n&&("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(n))&&this.fire(new e.ErrorEvent(new Error(`Source layer "${n}" does not exist on source "${i.id}" as specified by style layer "${t.id}"`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const e in this._sourceCaches)if(!this._sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(e){const t=[];for(const i of e){const e=this._layers[i];"custom"!==e.type&&t.push(e.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;if(this.fog&&this.fog.hasTransition())return!0;for(const e in this._sourceCaches)if(this._sourceCaches[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(e){return!!this.terrain&&("function"==typeof e.isLayerDraped?e.isLayerDraped():Yt[e.type])}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}update(t){if(!this._loaded)return;const i=this._changed;if(this._changed){const e=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(e.length||i.length)&&this._updateWorkerLayers(e,i);for(const e in this._updatedSources){const t=this._updatedSources[e];"reload"===t?this._reloadSource(e):"clear"===t&&this._clearSource(e)}this._updateTilesForChangedImages();for(const e in this._updatedPaintProps)this._layers[e].updateTransitions(t);this.light.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this._resetUpdates()}const n={};for(const e in this._sourceCaches){const t=this._sourceCaches[e];n[e]=t.used,t.used=!1}for(const e of this._order){const i=this._layers[e];if(i.recalculate(t,this._availableImages),!i.isHidden(t.zoom)){const e=this._getLayerSourceCache(i);e&&(e.used=!0)}const n=this.map.painter;if(n){const e=i.getProgramIds();if(!e)continue;const o=i.getProgramConfiguration(t.zoom);for(const t of e)n.useProgram(t,o)}}for(const t in n){const i=this._sourceCaches[t];n[t]!==i.used&&i.getSource().fire(new e.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:i.getSource().id}))}this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),i&&this.fire(new e.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const t in this._sourceCaches)this._sourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(e),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(i){if(this._checkLoaded(),Zt(this,e.validateStyle(i)))return!1;(i=e.clone$1(i)).layers=Ue(i.layers);const n=function(e,i){if(!e)return[{command:Ve.setStyle,args:[i]}];let n=[];try{if(!t(e.version,i.version))return[{command:Ve.setStyle,args:[i]}];t(e.center,i.center)||n.push({command:Ve.setCenter,args:[i.center]}),t(e.zoom,i.zoom)||n.push({command:Ve.setZoom,args:[i.zoom]}),t(e.bearing,i.bearing)||n.push({command:Ve.setBearing,args:[i.bearing]}),t(e.pitch,i.pitch)||n.push({command:Ve.setPitch,args:[i.pitch]}),t(e.sprite,i.sprite)||n.push({command:Ve.setSprite,args:[i.sprite]}),t(e.glyphs,i.glyphs)||n.push({command:Ve.setGlyphs,args:[i.glyphs]}),t(e.transition,i.transition)||n.push({command:Ve.setTransition,args:[i.transition]}),t(e.light,i.light)||n.push({command:Ve.setLight,args:[i.light]}),t(e.fog,i.fog)||n.push({command:Ve.setFog,args:[i.fog]}),t(e.projection,i.projection)||n.push({command:Ve.setProjection,args:[i.projection]});const o={},r=[];!function(e,i,n,o){let r;for(r in i=i||{},e=e||{})e.hasOwnProperty(r)&&(i.hasOwnProperty(r)||qe(r,n,o));for(r in i){if(!i.hasOwnProperty(r))continue;const s=i[r];e.hasOwnProperty(r)?t(e[r],s)||("geojson"===e[r].type&&"geojson"===s.type&&Ze(e,i,r)?n.push({command:Ve.setGeoJSONSourceData,args:[r,s.data]}):Ge(r,i,n,o)):$e(r,i,n)}}(e.sources,i.sources,r,o);const s=[];e.layers&&e.layers.forEach((e=>{e.source&&o[e.source]?n.push({command:Ve.removeLayer,args:[e.id]}):s.push(e)}));let a=e.terrain;a&&o[a.source]&&(n.push({command:Ve.setTerrain,args:[void 0]}),a=void 0),n=n.concat(r),t(a,i.terrain)||n.push({command:Ve.setTerrain,args:[i.terrain]}),function(e,i,n){i=i||[];const o=(e=e||[]).map(We),r=i.map(We),s=e.reduce(Xe,{}),a=i.reduce(Xe,{}),l=o.slice(),c=Object.create(null);let u,d,h,p,m,f,g;for(u=0,d=0;u!(e.command in Wt)));if(0===n.length)return!1;const o=n.filter((e=>!(e.command in Ht)));if(o.length>0)throw new Error(`Unimplemented: ${o.map((e=>e.command)).join(", ")}.`);return n.forEach((e=>{"setTransition"!==e.command&&"setProjection"!==e.command&&this[e.command].apply(this,e.args)})),this.stylesheet=i,this._updateMapProjection(),!0}addImage(t,i){return this.getImage(t)?this.fire(new e.ErrorEvent(new Error("An image with this name already exists."))):(this.imageManager.addImage(t,i),this._afterImageUpdated(t),this)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t),this._afterImageUpdated(t),this):this.fire(new e.ErrorEvent(new Error("No image with this name exists.")))}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new e.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addSource(t,i,n={}){if(this._checkLoaded(),void 0!==this.getSource(t))throw new Error("There is already a source with this ID");if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(e.validateSource,`sources.${t}`,i,null,n))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const o=Ae(t,i,this.dispatcher,this);o.setEventedParent(this,(()=>({isSourceLoaded:this._isSourceCacheLoaded(t),source:o.serialize(),sourceId:t})));const r=i=>{const n=(i?"symbol:":"other:")+t,r=this._sourceCaches[n]=new e.SourceCache(n,o,i);(i?this._symbolSourceCaches:this._otherSourceCaches)[t]=r,r.style=this,r.onAdd(this.map)};r(!1),"vector"!==i.type&&"geojson"!==i.type||r(!0),o.onAdd&&o.onAdd(this.map),this._changed=!0}removeSource(t){this._checkLoaded();const i=this.getSource(t);if(!i)throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===t)return this.fire(new e.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${i}" is using it.`)));if(this.terrain&&this.terrain.get().source===t)return this.fire(new e.ErrorEvent(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));const n=this._getSourceCaches(t);for(const t of n)delete this._sourceCaches[t.id],delete this._updatedSources[t.id],t.fire(new e.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t.getSource().id})),t.setEventedParent(null),t.clearTiles();return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],i.setEventedParent(null),i.onRemove&&i.onRemove(this.map),this._changed=!0,this}setGeoJSONSourceData(e,t){this._checkLoaded(),this.getSource(e).setData(t),this._changed=!0}getSource(e){const t=this._getSourceCache(e);return t&&t.getSource()}_getSources(){const e=[];for(const t in this._otherSourceCaches){const i=this._getSourceCache(t);i&&e.push(i.getSource())}return e}addLayer(t,i,n={}){this._checkLoaded();const o=t.id;if(this.getLayer(o))return void this.fire(new e.ErrorEvent(new Error(`Layer with id "${o}" already exists on this map`)));let r;if("custom"===t.type){if(Zt(this,e.validateCustomStyleLayer(t)))return;r=e.createStyleLayer(t)}else{if("object"==typeof t.source&&(this.addSource(o,t.source),t=e.clone$1(t),t=e.extend(t,{source:o})),this._validate(e.validateLayer,`layers.${o}`,t,{arrayIndex:-1},n))return;r=e.createStyleLayer(t),this._validateLayer(r),r.setEventedParent(this,{layer:{id:o}}),this._serializedLayers[r.id]=r.serialize(),this._updateLayerCount(r,!0)}const s=i?this._order.indexOf(i):this._order.length;if(i&&-1===s)return void this.fire(new e.ErrorEvent(new Error(`Layer with id "${i}" does not exist on this map.`)));this._order.splice(s,0,o),this._layerOrderChanged=!0,this._layers[o]=r;const a=this._getLayerSourceCache(r);if(this._removedLayers[o]&&r.source&&a&&"custom"!==r.type){const e=this._removedLayers[o];delete this._removedLayers[o],e.type!==r.type?this._updatedSources[r.source]="clear":(this._updatedSources[r.source]="reload",a.pause())}this._updateLayer(r),r.onAdd&&r.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(t,i){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===i)return;const n=this._order.indexOf(t);this._order.splice(n,1);const o=i?this._order.indexOf(i):this._order.length;i&&-1===o?this.fire(new e.ErrorEvent(new Error(`Layer with id "${i}" does not exist on this map.`))):(this._order.splice(o,0,t),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(t){this._checkLoaded();const i=this._layers[t];if(!i)return void this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be removed.`)));i.setEventedParent(null),this._updateLayerCount(i,!1);const n=this._order.indexOf(t);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=i,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],i.onRemove&&i.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(e){return this._layers[e]}hasLayer(e){return e in this._layers}hasLayerType(e){for(const t in this._layers)if(this._layers[t].type===e)return!0;return!1}setLayerZoomRange(t,i,n){this._checkLoaded();const o=this.getLayer(t);o?o.minzoom===i&&o.maxzoom===n||(null!=i&&(o.minzoom=i),null!=n&&(o.maxzoom=n),this._updateLayer(o)):this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(i,n,o={}){this._checkLoaded();const r=this.getLayer(i);if(r){if(!t(r.filter,n))return null==n?(r.filter=void 0,void this._updateLayer(r)):void(this._validate(e.validateFilter,`layers.${r.id}.filter`,n,{layerType:r.type},o)||(r.filter=e.clone$1(n),this._updateLayer(r)))}else this.fire(new e.ErrorEvent(new Error(`The layer '${i}' does not exist in the map's style and cannot be filtered.`)))}getFilter(t){const i=this.getLayer(t);return i&&e.clone$1(i.filter)}setLayoutProperty(i,n,o,r={}){this._checkLoaded();const s=this.getLayer(i);s?t(s.getLayoutProperty(n),o)||(s.setLayoutProperty(n,o,r),this._updateLayer(s)):this.fire(new e.ErrorEvent(new Error(`The layer '${i}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(t,i){const n=this.getLayer(t);if(n)return n.getLayoutProperty(i);this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style.`)))}setPaintProperty(i,n,o,r={}){this._checkLoaded();const s=this.getLayer(i);s?t(s.getPaintProperty(n),o)||(s.setPaintProperty(n,o,r)&&this._updateLayer(s),this._changed=!0,this._updatedPaintProps[i]=!0):this.fire(new e.ErrorEvent(new Error(`The layer '${i}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(e,t){const i=this.getLayer(e);return i&&i.getPaintProperty(t)}setFeatureState(t,i){this._checkLoaded();const n=t.source,o=t.sourceLayer,r=this.getSource(n);if(!r)return void this.fire(new e.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)));const s=r.type;if("geojson"===s&&o)return void this.fire(new e.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===s&&!o)return void this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));void 0===t.id&&this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided.")));const a=this._getSourceCaches(n);for(const e of a)e.setFeatureState(o,t.id,i)}removeFeatureState(t,i){this._checkLoaded();const n=t.source,o=this.getSource(n);if(!o)return void this.fire(new e.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)));const r=o.type,s="vector"===r?t.sourceLayer:void 0;if("vector"===r&&!s)return void this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));if(i&&"string"!=typeof t.id&&"number"!=typeof t.id)return void this.fire(new e.ErrorEvent(new Error("A feature id is required to remove its specific state property.")));const a=this._getSourceCaches(n);for(const e of a)e.removeFeatureState(s,t.id,i)}getFeatureState(t){this._checkLoaded();const i=t.source,n=t.sourceLayer,o=this.getSource(i);if(o){if("vector"!==o.type||n)return void 0===t.id&&this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided."))),this._getSourceCaches(i)[0].getFeatureState(n,t.id);this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new e.ErrorEvent(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return e.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const t={};for(const e in this._sourceCaches){const i=this._sourceCaches[e].getSource();t[i.id]||(t[i.id]=i.serialize())}return e.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.getTerrain()||void 0,fog:this.stylesheet.fog,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,projection:this.stylesheet.projection,sources:t,layers:this._serializeLayers(this._order)},(e=>void 0!==e))}_updateLayer(e){this._updatedLayers[e.id]=!0;const t=this._getLayerSourceCache(e);e.source&&!this._updatedSources[e.source]&&t&&"raster"!==t.getSource().type&&(this._updatedSources[e.source]="reload",t.pause()),this._changed=!0,e.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(e){const t=e=>"fill-extrusion"===this._layers[e].type,i={},n=[];for(let o=this._order.length-1;o>=0;o--){const r=this._order[o];if(t(r)){i[r]=o;for(const t of e){const e=t[r];if(e)for(const t of e)n.push(t)}}}n.sort(((e,t)=>t.intersectionZ-e.intersectionZ));const o=[];for(let r=this._order.length-1;r>=0;r--){const s=this._order[r];if(t(s))for(let e=n.length-1;e>=0;e--){const t=n[e].feature;if(i[t.layer.id]{const t=this.getLayer(e);return t&&t.is3D()})):this.has3DLayers(),a=I.createFromScreenPoints(t,n);for(const e in this._sourceCaches){const t=this._sourceCaches[e].getSource().id;i.layers&&!o[t]||r.push(De(this._sourceCaches[e],this._layers,this._serializedLayers,a,i,n,s,!!this.map._showQueryGeometry))}return this.placement&&r.push(function(e,t,i,n,o,r,s){const a={},l=r.queryRenderedSymbols(n),c=[];for(const e of Object.keys(l).map(Number))c.push(s[e]);c.sort(Pe);for(const i of c){const n=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],t,i.bucketIndex,i.sourceLayerIndex,o.filter,o.layers,o.availableImages,e);for(const e in n){const t=a[e]=a[e]||[],o=n[e];o.sort(((e,t)=>{const n=i.featureSortOrder;if(n){const i=n.indexOf(e.featureIndex);return n.indexOf(t.featureIndex)-i}return t.featureIndex-e.featureIndex}));for(const e of o)t.push(e)}}for(const t in a)a[t].forEach((n=>{const o=n.feature,r=i(e[t]);if(!r)return;const s=r.getFeatureState(o.layer["source-layer"],o.id);o.source=o.layer.source,o.layer["source-layer"]&&(o.sourceLayer=o.layer["source-layer"]),o.state=s}));return a}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),a.screenGeometry,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(r)}querySourceFeatures(t,i){i&&i.filter&&this._validate(e.validateFilter,"querySourceFeatures.filter",i.filter,null,i);const n=this._getSourceCaches(t);let o=[];for(const e of n)o=o.concat(ze(e,i));return o}addSourceType(e,t,i){return Kt.getSourceType(e)?i(new Error(`A source type called "${e}" already exists.`)):(Kt.setSourceType(e,t),t.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:t.workerSourceURL},i):i(null,null))}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();const n=this.light.getLight();let o=!1;for(const i in e)if(!t(e[i],n[i])){o=!0;break}if(!o)return;const r=this._setTransitionParameters({duration:300,delay:0});this.light.setLight(e,i),this.light.updateTransitions(r)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(i,n=1){if(this._checkLoaded(),!i)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);let o=i;if(1===n){if("object"==typeof o.source){const t="terrain-dem-src";this.addSource(t,o.source),o=e.clone$1(o),o=e.extend(o,{source:t})}if(this._validate(e.validateTerrain,"terrain",o))return}if(!this.terrain||this.terrain&&n!==this.terrain.drapeRenderMode){if(!o)return;this._createTerrain(o,n)}else{const i=this.terrain,n=i.get();for(const t of Object.keys(e.spec.terrain))!o.hasOwnProperty(t)&&e.spec.terrain[t].default&&(o[t]=e.spec.terrain[t].default);for(const e in o)if(!t(o[e],n[e])){i.set(o),this.stylesheet.terrain=o;const e=this._setTransitionParameters({duration:0});i.updateTransitions(e);break}}this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(e){const t=this.fog=new S(e,this.map.transform);this.stylesheet.fog=e;const i=this._setTransitionParameters({duration:0});t.updateTransitions(i)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask((()=>{for(const e of this.map._markers)e._evaluateOpacity()}))}getFog(){return this.fog?this.fog.get():null}setFog(e){if(this._checkLoaded(),!e)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const i=this.fog,n=i.get();0===Object.keys(e).length&&i.set(e);for(const o in e)if(!t(e[o],n[o])){i.set(e),this.stylesheet.fog=e;const t=this._setTransitionParameters({duration:0});i.updateTransitions(t);break}}else this._createFog(e);this._markersNeedUpdate=!0}_setTransitionParameters(t){return{now:e.exported.now(),transition:e.extend(t,this.stylesheet.transition)}}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;const e=this._order.filter((e=>this.isLayerDraped(this._layers[e]))),t=this._order.filter((e=>!this.isLayerDraped(this._layers[e])));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...e),this._drapedFirstOrder.push(...t)}_createTerrain(e,t){const i=this.terrain=new M(e,t);this.stylesheet.terrain=e,this.dispatcher.broadcast("enableTerrain",!this.terrainSetForDrapingOnly()),this._force3DLayerUpdate();const n=this._setTransitionParameters({duration:0});i.updateTransitions(n)}_force3DLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"fill-extrusion"===t.type&&this._updateLayer(t)}}_forceSymbolLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"symbol"===t.type&&this._updateLayer(t)}}_validate(t,i,n,o,r={}){return(!r||!1!==r.validate)&&Zt(this,t.call(e.validateStyle,e.extend({key:i,style:this.serialize(),value:n,styleSpec:e.spec},o)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),e.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const e in this._layers)this._layers[e].setEventedParent(null);for(const e in this._sourceCaches)this._sourceCaches[e].clearTiles(),this._sourceCaches[e].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(e){const t=this._getSourceCaches(e);for(const e of t)e.clearTiles()}_reloadSource(e){const t=this._getSourceCaches(e);for(const e of t)e.resume(),e.reload()}_reloadSources(){for(const e of this._getSources())e.reload&&e.reload()}_updateSources(e){for(const t in this._sourceCaches)this._sourceCaches[t].update(e)}_generateCollisionBoxes(){for(const e in this._sourceCaches){const t=this._sourceCaches[e];t.resume(),t.reload()}}_updatePlacement(t,i,n,o,r=!1){let s=!1,a=!1;const l={};for(const e of this._order){const i=this._layers[e];if("symbol"!==i.type)continue;if(!l[i.source]){const e=this._getLayerSourceCache(i);if(!e)continue;l[i.source]=e.getRenderableIds(!0).map((t=>e.getTileByID(t))).sort(((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)))}const n=this.crossTileSymbolIndex.addLayer(i,l[i.source],t.center.lng,t.projection);s=s||n}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),r=r||this._layerOrderChanged||0===n,this._layerOrderChanged&&this.fire(new e.Event("neworder")),(r||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.exported.now(),t.zoom))&&(this.pauseablePlacement=new Nt(t,this._order,r,i,n,o,this.placement,this.fog&&t.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(e.exported.now()),a=!0),s&&this.pauseablePlacement.placement.setStale()),a||s)for(const e of this._order){const t=this._layers[e];"symbol"===t.type&&this.placement.updateLayerOpacities(t,l[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(e.exported.now())}_releaseSymbolFadeTiles(){for(const e in this._sourceCaches)this._sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,t,i){this.imageManager.getImages(t.icons,i),this._updateTilesForChangedImages();const n=e=>{e&&e.setDependencies(t.tileID.key,t.type,t.icons)};n(this._otherSourceCaches[t.source]),n(this._symbolSourceCaches[t.source])}getGlyphs(e,t,i){this.glyphManager.getGlyphs(t.stacks,i)}getResource(t,i,n){return e.makeRequest(i,n)}_getSourceCache(e){return this._otherSourceCaches[e]}_getLayerSourceCache(e){return"symbol"===e.type?this._symbolSourceCaches[e.source]:this._otherSourceCaches[e.source]}_getSourceCaches(e){const t=[];return this._otherSourceCaches[e]&&t.push(this._otherSourceCaches[e]),this._symbolSourceCaches[e]&&t.push(this._symbolSourceCaches[e]),t}_isSourceCacheLoaded(t){const i=this._getSourceCaches(t);return 0===i.length?(this.fire(new e.ErrorEvent(new Error(`There is no source with ID '${t}'`))),!1):i.every((e=>e.loaded()))}has3DLayers(){return this._num3DLayers>0}hasSymbolLayers(){return this._numSymbolLayers>0}hasCircleLayers(){return this._numCircleLayers>0}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}Kt.getSourceType=function(e){return Le[e]},Kt.setSourceType=function(e,t){Le[e]=t},Kt.registerForPluginStateChange=e.registerForPluginStateChange;var Qt="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#define EXTENT 8192.0\n#define HALF_PI PI/2.0\n#define QUARTER_PI PI/4.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0",Jt="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",ei="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\nconst float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}\n#ifdef TERRAIN\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;\n#else\nuniform sampler2D u_dem;uniform sampler2D u_dem_prev;\n#endif\nuniform vec4 u_dem_unpack;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem,pos));\n#ifdef TERRAIN_DEM_NEAREST_FILTER\nreturn u_exaggeration*tl;\n#endif\nfloat tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem_prev,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nhighp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(\nunpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(u_depth,uv+df.zy))\n);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nfloat tl=texture2D(u_dem,pos).a;float tr=texture2D(u_dem,pos+vec2(off.x,0.0)).a;float bl=texture2D(u_dem,pos+vec2(0.0,off.y)).a;float br=texture2D(u_dem,pos+off).a;\n#else\nvec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack);\n#endif\nreturn vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }\n#endif",ti="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;varying vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",ii="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump float u_fog_temporal_offset;varying vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,opacity);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec3 fog_dither(vec3 color) {vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif";let ni={},oi={};const ri=[];ui(Qt,ri),ui(ei,ri),ui(ti,ri),ui(ii,ri),ni=di("",ei),oi=di(ii,ti);const si=di("\n#if __VERSION__ >=300\n#define varying in\n#define gl_FragColor glFragColor\n#define texture2D texture\n#define textureCube texture\nout vec4 glFragColor;\n#endif\nhighp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}highp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}","\n#if __VERSION__ >=300\n#define attribute in\n#define varying out\n#define texture2D texture\n#endif\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered."),ai=Qt,li="\n#ifdef GL_ES\nprecision mediump float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif";var ci={background:di("uniform vec4 u_color;uniform float u_opacity;\n#ifdef LIGHTING_3D_MODE\nvarying vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#ifdef LIGHTING_3D_MODE\nuniform vec4 u_color;varying vec4 v_color;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting(u_color);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),backgroundPattern:di("uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos;void main() {vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),circle:di("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float 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(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\ngl_FragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}"),clippingMask:di("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:di("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {gl_FragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),heatmapTexture:di("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;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:di("varying float v_placed;varying float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);gl_FragColor =mix(red,blue,step(0.5,v_placed))*0.5;gl_FragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}","attribute vec3 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;attribute float a_size_scale;attribute vec2 a_padding;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_pos+elevationVector(a_anchor_pos)*elevation(a_anchor_pos),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:di("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_2f;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_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:di("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;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;\n#endif\nvarying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}"),fill:di("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutline:di("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutlinePattern:di("uniform vec2 u_texsize;uniform sampler2D u_image;varying vec2 v_pos;varying vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;varying vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillPattern:di("uniform vec2 u_texsize;uniform sampler2D u_image;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillExtrusion:di("varying vec4 v_color;\n#ifdef RENDER_SHADOWS\nvarying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef ZERO_ROOF_RADIUS\nvarying vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvarying highp vec3 v_normal;\n#endif\nvoid main() {\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvec3 normal=v_normal;\n#endif\nfloat z;vec4 color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);color=mix(v_color,v_roof_color,z);\n#else\ncolor=v_color;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);color.rgb=color.rgb*shade;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef ZERO_ROOF_RADIUS\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#endif\ncolor.xyz=shadowed_color_normal(color.xyz,normalize(normal),v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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;uniform float u_edge_radius;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec4 v_color;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;\n#endif\n#ifdef ZERO_ROOF_RADIUS\nvarying vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvarying highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nv_normal=normal;\n#endif\nbase=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;float c_ele;vec3 pos;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nv_pos_light_view_0=u_light_matrix_0*vec4(pos,1);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1);v_depth=gl_Position.w;\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}v_color=vec4(0.0,0.0,0.0,1.0);\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting(color,NdotL);\n#else\nv_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));\n#endif\nv_color*=u_opacity;\n#ifdef ZERO_ROOF_RADIUS\nv_roof_color=vec4(0.0,0.0,0.0,1.0);\n#ifdef LIGHTING_3D_MODE\nv_roof_color=apply_lighting(color,calculate_NdotL(vec3(0.0,0.0,1.0)));\n#else\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));\n#endif\nv_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),fillExtrusionPattern:di("uniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nvarying float v_NdotL;\n#endif\nvarying vec2 v_pos;varying vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,v_NdotL)*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec2 v_pos;varying vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nvarying float v_NdotL;\n#endif\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_NdotL=NdotL;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif \n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}"),hillshadePrepare:di("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nreturn texture2D(u_image,coord).a/4.0;\n#else\nvec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;\n#endif\n}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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:di("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;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;\n#ifdef LIGHTING_3D_MODE\ngl_FragColor=apply_lighting(gl_FragColor);\n#endif\n#ifdef FOG\ngl_FragColor=fog_dither(fog_apply_premultiplied(gl_FragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),line:di("uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;varying vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\nuniform float u_border_width;uniform vec4 u_border_color;float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nfloat linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture2D(u_dash_image,v_tex).a;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture2D(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trimmed=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {out_color=vec4(0,0,0,0);trimmed=0.0;}}\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef RENDER_LINE_ALPHA_DISCARD\nif (alpha < u_alpha_discard_threshold) {discard;}\n#endif\n#ifdef RENDER_LINE_BORDER\nfloat edgeBlur=(u_border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);\n#ifdef RENDER_LINE_BORDER_AUTO\nfloat Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}\n#else\nout_color.rgb=mix(u_border_color.rgb*u_border_color.a*trimmed,out_color.rgb,smoothAlpha);\n#endif\n}\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define EXTRUDE_SCALE 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nattribute highp vec4 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nattribute float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;varying vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);\n#else\nv_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),linePattern:di("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;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;\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;vec2 pattern_size=vec2(display_size.x/u_tile_units_to_pixels,display_size.y);float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x=mod(v_linesofar/pattern_size.x*aspect,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));vec4 color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting(color);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;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;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);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_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),raster:di("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(\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply(out_color,v_fog_pos));\n#endif\ngl_FragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {float w=1.0+dot(a_texture_pos,u_perspective_transform);gl_Position=u_matrix*vec4(a_pos*w,0,w);v_pos0=a_texture_pos/8192.0;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),symbolIcon:di("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform vec3 u_up_vector;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjected_point;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\noffsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_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(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;}"),symbolSDF:di("#define SDF_PX 8.0\nuniform 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;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;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);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat gamma_scale=gl_Position.w;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade);}"),symbolTextAndIcon:di("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform 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;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat 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;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;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);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat 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(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade,is_sdf);}"),terrainRaster:di("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nvarying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;\n#endif\nvoid main() {vec4 color=texture2D(u_image0,v_pos0);\n#ifdef RENDER_SHADOWS\ncolor.xyz=shadowed_color(color.xyz,v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;\n#endif\nconst float wireframeOffset=0.00015;void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;\n#ifdef TERRAIN_WIREFRAME\nelevation+=wireframeOffset;\n#endif\nv_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);v_depth=gl_Position.w;\n#endif\n}"),terrainDepth:di("#ifdef GL_ES\nprecision highp float;\n#endif\nvarying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}","uniform mat4 u_matrix;attribute vec2 a_pos;varying float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),skybox:di("\nvarying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=textureCube(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);gl_FragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",Jt),skyboxGradient:di("varying highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture2D(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",Jt),skyboxCapture:di("\nvarying highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;\n#ifdef GL_ES\nprecision highp float;\n#endif\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;gl_FragColor=vec4(color,1.0);}","attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:di("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nvec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture2D(u_image0,v_pos0);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#else\ncolor=texture2D(u_image0,v_pos0);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;\n#ifdef GLOBE_POLES\nattribute vec3 a_globe_pos;attribute vec2 a_uv;\n#else\nattribute vec2 a_pos;\n#endif\nvarying vec2 v_pos0;const float wireframeOffset=1e3;float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(QUARTER_PI+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);\n#ifdef TERRAIN_WIREFRAME\nheight+=wireframeOffset;\n#endif\nglobe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}"),globeAtmosphere:di("uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec3 u_start_color;uniform vec4 u_color;uniform vec4 u_space_color;uniform vec4 u_high_color;uniform float u_star_intensity;uniform float u_star_size;uniform float u_star_density;uniform float u_horizon_angle;uniform mat4 u_rotation_matrix;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;highp float random(highp vec3 p) {p=fract(p*vec3(23.2342,97.1231,91.2342));p+=dot(p.zxy,p.yxz+123.1234);return fract(p.x*p.y);}float stars(vec3 p,float scale,vec2 offset) {vec2 uv_scale=(u_viewport/u_star_size)*scale;vec3 position=vec3(p.xy*uv_scale+offset*u_viewport,p.z);vec3 q=fract(position)-0.5;vec3 id=floor(position);float random_visibility=step(random(id),u_star_density);float circle=smoothstep(0.5+u_star_intensity,0.5,length(q));return circle*random_visibility;}void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {discard;return;}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(dot(dir,horizon_dir)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;float closest_point_to_center=length(closest_point-u_globe_pos);float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c =mix(color_stop_2,c2,t);float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);vec2 uv=gl_FragCoord.xy/u_viewport-0.5;float aspect_ratio=u_viewport.x/u_viewport.y;vec4 uv_dir=vec4(normalize(vec3(uv.x*aspect_ratio,uv.y,1.0)),1.0);uv_dir=u_rotation_matrix*uv_dir;vec3 n=abs(uv_dir.xyz);vec2 uv_remap=(n.x > n.y && n.x > n.z) ? uv_dir.yz/uv_dir.x:\n(n.y > n.x && n.y > n.z) ? uv_dir.zx/uv_dir.y:\nuv_dir.xy/uv_dir.z;uv_remap.x/=aspect_ratio;vec3 D=vec3(uv_remap,1.0);highp float star_field=0.0;if (u_star_intensity > 0.0) {star_field+=stars(D,1.2,vec2(0.0,0.0));star_field+=stars(D,1.0,vec2(1.0,0.0));star_field+=stars(D,0.8,vec2(0.0,1.0));star_field+=stars(D,0.6,vec2(1.0,1.0));star_field*=(1.0-pow(t,0.25+(1.0-u_high_color.a)*0.75));c+=star_field*alpha_2;}c=dither(c,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=vec4(c,a);}","attribute vec3 a_pos;attribute vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}")};function ui(e,t){const i=e.replace(/\s*\/\/[^\n]*\n/g,"\n").split("\n");for(let e of i)if(e=e.trim(),"#"===e[0]&&e.includes("if")&&!e.includes("endif")){e=e.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const i=e.split(" ");for(const e of i)t.includes(e)||t.push(e)}}function di(e,t){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n=t.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),o={},r=[...ri];return ui(e,r),ui(t,r),{fragmentSource:e=e.replace(i,((e,t,i,n,r)=>(o[r]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${r}\nvarying ${i} ${n} ${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${r}\n ${i} ${n} ${r} = u_${r};\n#endif\n`))),vertexSource:t=t.replace(i,((e,t,i,n,r)=>{const s="float"===n?"vec2":"vec4",a=r.match(/color/)?"color":s;return o[r]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nattribute ${i} ${s} a_${r};\nvarying ${i} ${n} ${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${r}\n ${r} = a_${r};\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n ${r} = unpack_mix_${a}(a_${r}, u_${r}_t);\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`:"define"===t?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nattribute ${i} ${s} a_${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${r}\n ${i} ${n} ${r} = a_${r};\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n ${i} ${n} ${r} = unpack_mix_${a}(a_${r}, u_${r}_t);\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`})),staticAttributes:n,usedDefines:r}}class hi{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(e,t,i,n,o,r,s){this.context=e;let a=this.boundPaintVertexBuffers.length!==n.length;for(let e=0;!a&&e{const o=i.paint.get("hillshade-shadow-color"),r=i.paint.get("hillshade-highlight-color"),s=i.paint.get("hillshade-accent-color");let a=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===i.paint.get("hillshade-illumination-anchor")&&(a-=e.transform.angle);const l=!e.options.moving;return{u_matrix:n||e.transform.calculateProjMatrix(t.tileID.toUnwrapped(),l),u_image:0,u_latrange:pi(0,t.tileID),u_light:[i.paint.get("hillshade-exaggeration"),a],u_shadow:o,u_highlight:r,u_accent:s}})(t,n,o,t.terrain?i.projMatrix:null);t.prepareDrawProgram(l,d,i.toUnwrapped());const{tileBoundsBuffer:p,tileBoundsIndexBuffer:m,tileBoundsSegments:f}=t.getTileBoundsBuffers(n);d.draw(l,c.TRIANGLES,r,s,a,e.CullFaceMode.disabled,h,o.id,p,m,f)}function fi(t,i,n){if(!i.needsDEMTextureUpload)return;const o=t.context,r=o.gl;o.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||t.getTileTexture(n.stride);const s=n.getPixels();i.demTexture?i.demTexture.update(s,{premultiply:!1}):i.demTexture=new e.Texture(o,s,r.RGBA,{premultiply:!1}),i.needsDEMTextureUpload=!1}function gi(t,i,n,o,r,s){const a=t.context,l=a.gl;if(!i.dem)return;const c=i.dem;if(a.activeTexture.set(l.TEXTURE1),fi(t,i,c),!i.demTexture)return;i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);const u=c.dim;a.activeTexture.set(l.TEXTURE0);let d=i.fbo;if(!d){const t=new e.Texture(a,{width:u,height:u,data:null},l.RGBA);t.bind(l.LINEAR,l.CLAMP_TO_EDGE),d=i.fbo=a.createFramebuffer(u,u,!0),d.colorAttachment.set(t.texture)}a.bindFramebuffer.set(d.framebuffer),a.viewport.set([0,0,u,u]);const{tileBoundsBuffer:h,tileBoundsIndexBuffer:p,tileBoundsSegments:m}=t.getMercatorTileBoundsBuffers();t.useProgram("hillshadePrepare").draw(a,l.TRIANGLES,o,r,s,e.CullFaceMode.disabled,((t,i)=>{const n=i.stride,o=e.create();return e.ortho(o,0,e.EXTENT,-e.EXTENT,0,0,1),e.translate(o,o,[0,-e.EXTENT,0]),{u_matrix:o,u_image:1,u_dimension:[n,n],u_zoom:t.overscaledZ,u_unpack:i.unpackVector}})(i.tileID,c),n.id,h,p,m),i.needsHillshadePrepare=!1}const _i=t=>({u_matrix:new e.UniformMatrix4f(t),u_image0:new e.Uniform1i(t),u_skirt_height:new e.Uniform1f(t)}),yi=(e,t)=>({u_matrix:e,u_image0:0,u_skirt_height:t}),bi=(e,t,i,n,o,r,s,a,l,c,u,d,h,p,m)=>({u_proj_matrix:Float32Array.from(e),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(n),u_merc_matrix:i,u_zoom_transition:o,u_merc_center:r,u_image0:0,u_frustum_tl:s,u_frustum_tr:a,u_frustum_br:l,u_frustum_bl:c,u_globe_pos:u,u_globe_radius:d,u_viewport:h,u_grid_matrix:m?Float32Array.from(m):new Float32Array(9),u_skirt_height:p});function xi(e,t){return null!=e&&null!=t&&!(!e.hasData()||!t.hasData())&&null!=e.demTexture&&null!=t.demTexture&&e.tileID.key!==t.tileID.key}const vi=new class{constructor(){this.operations={}}newMorphing(e,t,i,n,o){if(e in this.operations){const t=this.operations[e];t.to.tileID.key!==i.tileID.key&&(t.queued=i)}else this.operations[e]={startTime:n,phase:0,duration:o,from:t,to:i,queued:null}}getMorphValuesForProxy(e){if(!(e in this.operations))return null;const t=this.operations[e];return{from:t.from,to:t.to,phase:t.phase}}update(e){for(const t in this.operations){const i=this.operations[t];for(i.phase=(e-i.startTime)/i.duration;i.phase>=1||!this._validOp(i);)if(!this._nextOp(i,e)){delete this.operations[t];break}}}_nextOp(e,t){return!!e.queued&&(e.from=e.to,e.to=e.queued,e.queued=null,e.phase=0,e.startTime=t,!0)}_validOp(e){return e.from.hasData()&&e.to.hasData()}},wi={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"};function Ei(e){return 6*Math.pow(1.5,22-e)}function Mi(e,t){const i=1<({u_matrix:e});function Ci(t,i,n,o,r){if(r>0){const s=e.exported.now(),a=(s-t.timeAdded)/r,l=i?(s-i.timeAdded)/r:-1,c=n.getSource(),u=o.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),d=!i||Math.abs(i.tileID.overscaledZ-u)>Math.abs(t.tileID.overscaledZ-u),h=d&&t.refreshedUponExpiration?1:e.clamp(d?a:1-l,0,1);return t.refreshedUponExpiration&&a>=1&&(t.refreshedUponExpiration=!1),i?{opacity:1,mix:1-h}:{opacity:h,mix:0}}return{opacity:1,mix:0}}class ki extends e.SourceCache{constructor(e){const t={type:"raster-dem",maxzoom:e.transform.maxZoom},i=new L(Fe(),null),n=Ae("mock-dem",t,i,e.style);super("mock-dem",n,!1),n.setEventedParent(this),this._sourceLoaded=!0}_loadTile(e,t){e.state="loaded",t(null)}}class Si extends e.SourceCache{constructor(e){const t=Ae("proxy",{type:"geojson",maxzoom:e.transform.maxZoom},new L(Fe(),null),e.style);super("proxy",t,!1),t.setEventedParent(this),this.map=this.getSource().map=e,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(t,i,n){if(t.freezeTileCoverage)return;this.transform=t;const o=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce(((i,n)=>{if(i[n.key]="",!this._tiles[n.key]){const i=new e.Tile(n,this._source.tileSize*n.overscaleFactor(),t.tileZoom);i.state="loaded",this._tiles[n.key]=i}return i}),{});for(const e in this._tiles)e in o||(this.freeFBO(e),this._tiles[e].unloadVectorData(),delete this._tiles[e])}freeFBO(e){const t=this.proxyCachedFBO[e];if(void 0!==t){const i=Object.values(t);this.renderCachePool.push(...i),delete this.proxyCachedFBO[e]}}deallocRenderCache(){this.renderCache.forEach((e=>e.fb.destroy())),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class Li extends e.OverscaledTileID{constructor(e,t,i){super(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y),this.proxyTileKey=t,this.projMatrix=i}}class Ai extends e.Elevation{constructor(t,i){super(),this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[n,o,r]=function(){const t=new e.StructArrayLayout2i4,i=new e.StructArrayLayout3ui6,n=131;t.reserve(17161),i.reserve(33800);const o=e.EXTENT/128,r=e.EXTENT+o/2,s=r+o;for(let i=-o;ir||i<0||i>r?24575:0,s=e.clamp(Math.round(n),0,e.EXTENT),a=e.clamp(Math.round(i),0,e.EXTENT);t.emplaceBack(s+o,a)}const a=(e,t)=>{const o=t*n+e;i.emplaceBack(o+1,o,o+n),i.emplaceBack(o+n,o+n+1,o+1)};for(let e=1;e<129;e++)for(let t=1;t<129;t++)a(t,e);return[0,129].forEach((e=>{for(let t=0;t<130;t++)a(t,e),a(e,t)})),[t,i,32768]}(),s=t.context;this.gridBuffer=s.createVertexBuffer(n,e.posAttributes.members),this.gridIndexBuffer=s.createIndexBuffer(o),this.gridSegments=e.SegmentVector.simpleSegment(0,0,n.length,o.length),this.gridNoSkirtSegments=e.SegmentVector.simpleSegment(0,0,n.length,r),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Si(i.map),this.orthoMatrix=e.create(),e.ortho(this.orthoMatrix,"globe"===this.painter.transform.projection.name?.015:0,e.EXTENT,0,e.EXTENT,0,1);const a=s.gl;this._overlapStencilMode=new e.StencilMode({func:a.GEQUAL,mask:255},0,255,a.KEEP,a.KEEP,a.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=i,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new ki(i.map)}set style(e){e.on("data",this._onStyleDataEvent.bind(this)),e.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=e,this._checkRenderCacheEfficiency(),this._style.map.on("moveend",(()=>{this._clearLineLayersFromRenderCache()}))}update(t,i,n){if(t&&t.terrain){this._style!==t&&(this.style=t),this.enabled=!0;const o=t.terrain.properties;this.sourceCache=0===t.terrain.drapeRenderMode?this._mockSourceCache:t._getSourceCache(o.get("source")),this._exaggeration=o.get("exaggeration");const r=()=>{this.sourceCache.used&&e.warnOnce(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.\nThis leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const t=this.getScaledDemTileSize();this.sourceCache.update(i,t,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,r(),this._initializing=!0),r(),i.updateElevation(!0,n),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(i),this._emptyDEMTextureDirty=!0}else this._disable()}resetTileLookupCache(e){this._findCoveringTileCache[e]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_checkRenderCacheEfficiency(){const t=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||100!==t.efficiency&&e.warnOnce(`Terrain render cache efficiency is not optimal (${t.efficiency}%) and performance\n may be affected negatively, consider placing all background, fill and line layers before layer\n with id '${t.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(e){e.coord&&"source"===e.dataType?this._clearRenderCacheForTile(e.sourceCacheId,e.coord):"style"===e.dataType&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const e in this._style._sourceCaches)this._style._sourceCaches[e].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach((e=>e.fb.destroy())),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0)}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const e=2*this.proxySourceCache.getSource().tileSize;return[e,e]}set useVertexMorphing(e){this._useVertexMorphing=e}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const i=this.proxySourceCache,n=this.painter.transform;this._initializing&&(this._initializing=0===n._centerAltitude&&-1===this.getAtPointOrZero(e.MercatorCoordinate.fromLngLat(n.center),-1),this._emptyDEMTextureDirty=!this._initializing);const o=this.proxyCoords=i.getIds().map((e=>{const t=i.getTileByID(e).tileID;return t.projMatrix=n.calculateProjMatrix(t.toUnwrapped()),t}));!function(t,i){const n=i.transform.pointCoordinate(i.transform.getCameraPoint()),o=new e.Point(n.x,n.y);t.sort(((t,i)=>{if(i.overscaledZ-t.overscaledZ)return i.overscaledZ-t.overscaledZ;const n=new e.Point(t.canonical.x+(1<{this.proxyToSource[e.key]={}})),this.terrainTileForTile={};const s=this._style._sourceCaches;for(const e in s){const i=s[e];if(!i.used)continue;if(i!==this.sourceCache&&this.resetTileLookupCache(i.id),this._setupProxiedCoordsForOrtho(i,t[e],r),i.usedForTerrain)continue;const n=t[e];i.getSource().reparseOverscaled&&this._assignTerrainTiles(n)}this.proxiedCoords[i.id]=o.map((e=>new Li(e,e.key,this.orthoMatrix))),this._assignTerrainTiles(o),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(r),this.renderingToTexture=!1,this._updateTimestamp=e.exported.now();const a={};this._visibleDemTiles=[];for(const e of this.proxyCoords){const t=this.terrainTileForTile[e.key];if(!t)continue;const i=t.tileID.key;i in a||(this._visibleDemTiles.push(t),a[i]=i)}}_assignTerrainTiles(e){this._initializing||e.forEach((e=>{if(this.terrainTileForTile[e.key])return;const t=this._findTileCoveringTileID(e,this.sourceCache);t&&(this.terrainTileForTile[e.key]=t)}))}_prepareDEMTextures(){const e=this.painter.context,t=e.gl;for(const i in this.terrainTileForTile){const n=this.terrainTileForTile[i],o=n.dem;!o||n.demTexture&&!n.needsDEMTextureUpload||(e.activeTexture.set(t.TEXTURE1),fi(this.painter,n,o))}}_prepareDemTileUniforms(e,t,i,n){if(!t||null==t.demTexture)return!1;const o=e.tileID.canonical,r=Math.pow(2,t.tileID.canonical.z-o.z),s=n||"";return i[`u_dem_tl${s}`]=[o.x*r%1,o.y*r%1],i[`u_dem_scale${s}`]=r,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const t=this.painter.context,i=t.gl;if(!this._emptyDepthBufferTexture){const n=new e.RGBAImage({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new e.Texture(t,n,i.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let e=0;const t=this._visibleDemTiles.reduce(((t,i)=>{if(!i.dem)return t;const n=i.dem.tree.minimums[0];return n>0&&e++,t+n}),0);return e?t/e:0}_updateEmptyDEMTexture(){const t=this.painter.context,i=t.gl;t.activeTexture.set(i.TEXTURE2);const n=this._getLoadedAreaMinimum(),o=new e.RGBAImage({width:1,height:1},new Uint8Array(e.DEMData.pack(n,this.sourceCache.getSource().encoding)));this._emptyDEMTextureDirty=!1;let r=this._emptyDEMTexture;return r?r.update(o,{premultiply:!1}):r=this._emptyDEMTexture=new e.Texture(t,o,i.RGBA,{premultiply:!1}),r}setupElevationDraw(t,i,n){const o=this.painter.context,r=o.gl,s=(a=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:e.DEMData.getUnpackVector(a),u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0});var a;s.u_dem_size=this.sourceCache.getSource().tileSize,s.u_exaggeration=this.exaggeration();let l=null,c=null,u=1;if(n&&n.morphing&&this._useVertexMorphing){const e=n.morphing.srcDemTile,i=n.morphing.dstDemTile;u=n.morphing.phase,e&&i&&(this._prepareDemTileUniforms(t,e,s,"_prev")&&(c=e),this._prepareDemTileUniforms(t,i,s)&&(l=i))}if(c&&l?(o.activeTexture.set(r.TEXTURE2),l.demTexture.bind(r.NEAREST,r.CLAMP_TO_EDGE,r.NEAREST),o.activeTexture.set(r.TEXTURE4),c.demTexture.bind(r.NEAREST,r.CLAMP_TO_EDGE,r.NEAREST),s.u_dem_lerp=u):(l=this.terrainTileForTile[t.tileID.key],o.activeTexture.set(r.TEXTURE2),(this._prepareDemTileUniforms(t,l,s)?l.demTexture:this.emptyDEMTexture).bind(r.NEAREST,r.CLAMP_TO_EDGE)),o.activeTexture.set(r.TEXTURE3),n&&n.useDepthForOcclusion?(this._depthTexture&&this._depthTexture.bind(r.NEAREST,r.CLAMP_TO_EDGE),this._depthFBO&&(s.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height])):(this.emptyDepthBufferTexture.bind(r.NEAREST,r.CLAMP_TO_EDGE),s.u_depth_size_inv=[1,1]),n&&n.useMeterToDem&&l){const t=(1<{if(c===e)return;const n=[wi[e],"PROJECTION_GLOBE_VIEW"];h&&n.push("CUSTOM_ANTIALIASING"),i&&n.push(wi[u]),l=t.useProgram("globeRaster",null,n),c=e},m=t.colorModeForRenderPass(),f=new e.DepthMode(a.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);vi.update(r);const g=e.calculateGlobeMercatorMatrix(d),_=[e.mercatorXfromLng(d.center.lng),e.mercatorYfromLat(d.center.lat)],y=u?[!1,!0]:[!1],b=t.globeSharedBuffers,x=[d.width*e.exported.devicePixelRatio,d.height*e.exported.devicePixelRatio],v=Float32Array.from(d.globeMatrix),w={useDenormalizedUpVectorScale:!0};if(y.forEach((u=>{const d=t.transform,h=Ei(d.zoom)*i.exaggeration();c=-1;const y=u?a.LINES:a.TRIANGLES;for(const c of o){const o=n.getTile(c),E=e.StencilMode.disabled,M=i.prevTerrainTileForTile[c.key],T=i.terrainTileForTile[c.key];xi(M,T)&&vi.newMorphing(c.key,M,T,r,250),s.activeTexture.set(a.TEXTURE0),o.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const C=vi.getMorphValuesForProxy(c.key),k=C?1:0;C&&e.extend$1(w,{morphing:{srcDemTile:C.from,dstDemTile:C.to,phase:e.easeCubicInOut(C.phase)}});const S=e.tileCornersToBounds(c.canonical),L=e.getLatitudinalLod(S.getCenter().lat),A=e.getGridMatrix(c.canonical,S,L,d.worldSize/d._pixelsPerMercatorPixel),I=e.globeNormalizeECEF(e.globeTileBounds(c.canonical)),D=bi(d.projMatrix,v,g,I,e.globeToMercatorTransition(d.zoom),_,d.frustumCorners.TL,d.frustumCorners.TR,d.frustumCorners.BR,d.frustumCorners.BL,d.globeCenterInViewSpace,d.globeRadius,x,h,A);if(p(k,u),i.setupElevationDraw(o,l,w),t.prepareDrawProgram(s,l,c.toUnwrapped()),b){const[i,n,o]=u?b.getWirefameBuffers(t.context,L):b.getGridBuffers(L,0!==h);l.draw(s,y,f,E,m,e.CullFaceMode.backCCW,D,"globe_raster",i,n,o)}}})),b){const r=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];h&&r.push("CUSTOM_ANTIALIASING"),l=t.useProgram("globeRaster",null,r);for(const r of o){const{x:o,y:c,z:u}=r.canonical,h=0===c,p=c===(1<t.draw(s,a.TRIANGLES,f,e.StencilMode.disabled,m,e.CullFaceMode.disabled,bi(d.projMatrix,b,b,M,0,_,d.frustumCorners.TL,d.frustumCorners.TR,d.frustumCorners.BR,d.frustumCorners.BL,d.globeCenterInViewSpace,d.globeRadius,x,0),"globe_pole_raster",i,v,E);i.setupElevationDraw(c,l,w),t.prepareDrawProgram(s,l,r.toUnwrapped()),h&&T(l,g),p&&(b=e.scale(e.create(),b,[1,-1,1]),T(l,y))}}}}(t,i,n,o,r);else{const s=t.context,a=s.gl;let l,c;const u=t.options.showTerrainWireframe?2:0,d=(e,i)=>{if(c===e)return;const n=[wi[e]];i&&n.push(wi[u]),l=t.useProgram("terrainRaster",null,n),c=e},h=t.colorModeForRenderPass(),p=new e.DepthMode(a.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);vi.update(r);const m=t.transform,f=Ei(m.zoom)*i.exaggeration();(u?[!1,!0]:[!1]).forEach((u=>{c=-1;const g=u?a.LINES:a.TRIANGLES,[_,y]=u?i.getWirefameBuffer():[i.gridIndexBuffer,i.gridSegments];for(const c of o){const o=n.getTile(c),b=e.StencilMode.disabled,x=i.prevTerrainTileForTile[c.key],v=i.terrainTileForTile[c.key];xi(x,v)&&vi.newMorphing(c.key,x,v,r,250),s.activeTexture.set(a.TEXTURE0),o.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE,a.LINEAR_MIPMAP_NEAREST);const w=vi.getMorphValuesForProxy(c.key),E=w?1:0;let M;w&&(M={morphing:{srcDemTile:w.from,dstDemTile:w.to,phase:e.easeCubicInOut(w.phase)}});const T=yi(c.projMatrix,Mi(c.canonical,m.renderWorldCopies)?f/10:f);d(E,u),i.setupElevationDraw(o,l,M),t.prepareDrawProgram(s,l,c.toUnwrapped()),l.draw(s,g,p,b,h,e.CullFaceMode.backCCW,T,"terrain_raster",i.gridBuffer,_,y)}}))}}(i,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,i.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(0===this._drapedRenderBatches.length)return t+1;this.renderingToTexture=!0;const i=this.painter,n=this.painter.context,o=this.proxySourceCache,r=this.proxiedCoords[o.id],s=this._drapedRenderBatches.shift(),a=[],l=i.style.order;let c=0;for(const u of r){const r=o.getTileByID(u.proxyTileKey),d=o.proxyCachedFBO[u.key]?o.proxyCachedFBO[u.key][t]:void 0,h=void 0!==d?o.renderCache[d]:this.pool[c++],p=void 0!==d;if(r.texture=h.tex,p&&!h.dirty){a.push(r.tileID);continue}let m;n.bindFramebuffer.set(h.fb.framebuffer),this.renderedToTile=!1,h.dirty&&(n.clear({color:e.Color.transparent,stencil:0}),h.dirty=!1);for(let e=s.start;e<=s.end;++e){const t=i.style._layers[l[e]];if(t.isHidden(i.transform.zoom))continue;const o=i.style._getLayerSourceCache(t),r=o?this.proxyToSource[u.key][o.id]:[u];if(!r)continue;const s=r;n.viewport.set([0,0,h.fb.width,h.fb.height]),m!==(o?o.id:null)&&(this._setupStencil(h,r,t,o),m=o?o.id:null),i.renderLayer(i,o,t,s)}this.renderedToTile?(h.dirty=!0,a.push(r.tileID)):p||--c,5===c&&(c=0,this.renderToBackBuffer(a))}return this.renderToBackBuffer(a),this.renderingToTexture=!1,n.bindFramebuffer.set(null),n.viewport.set([0,0,i.width,i.height]),s.end+1}postRender(){}renderCacheEfficiency(e){const t=e.order.length;if(0===t)return{efficiency:100};let i,n=0,o=0,r=!1;for(let s=0;se.dem)).forEach((t=>{e=Math.min(e,t.dem.tree.minimums[0])})),0===e?e:(e-30)*this._exaggeration}raycast(e,t,i){if(!this._visibleDemTiles)return null;const n=this._visibleDemTiles.filter((e=>e.dem)).map((n=>{const o=n.tileID,r=1<(null!==e.t?e.t:Number.MAX_VALUE)-(null!==t.t?t.t:Number.MAX_VALUE)));for(const o of n){if(null==o.t)return null;const n=o.tile.dem.tree.raycast(o.minx,o.miny,o.maxx,o.maxy,e,t,i);if(null!=n)return n}return null}_createFBO(){const t=this.painter.context,i=t.gl,n=this.drapeBufferSize;t.activeTexture.set(i.TEXTURE0);const o=new e.Texture(t,{width:n[0],height:n[1],data:null},i.RGBA);o.bind(i.LINEAR,i.CLAMP_TO_EDGE);const r=t.createFramebuffer(n[0],n[1],!1);return r.colorAttachment.set(o.texture),r.depthAttachment=new we(t,r.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,n[0],n[1]),this._stencilRef=0,r.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):r.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&!t.extTextureFilterAnisotropicForceOff&&i.texParameterf(i.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:r,tex:o,dirty:!1}}_initFBOPool(){for(;this.pool.length{const t=this._style._layers[e],i=t.isHidden(this.painter.transform.zoom);return"custom"===t.type?!i&&t.shouldRedrape():!i&&t.hasTransition()}))}_clearLineLayersFromRenderCache(){let t=!1;for(const e of this._style._getSources())if(e instanceof Te){t=!0;break}if(!t)return;const i={};for(let t=0;tt.renderCachePool.length){const e=Object.values(t.proxyCachedFBO);t.proxyCachedFBO={};for(let i=0;i=0;o--){const r=i[o];if(t.getTileByID(r.key),void 0!==t.proxyCachedFBO[r.key]){const i=e[r.key],o=this.proxyToSource[r.key];let s=0;for(const e in o){const t=o[e],r=i[e];if(!r||r.length!==t.length||t.some(((t,i)=>t!==r[i]||n[e]&&n[e].hasOwnProperty(t.key)))){s=-1;break}++s}for(const e in t.proxyCachedFBO[r.key])t.renderCache[t.proxyCachedFBO[r.key][e]].dirty=s<0||s!==Object.values(i).length}}const o=[...this._drapedRenderBatches];o.sort(((e,t)=>t.end-t.start-(e.end-e.start)));for(const e of o)for(const n of i){if(t.proxyCachedFBO[n.key])continue;let i=t.renderCachePool.pop();void 0===i&&t.renderCache.length<50&&(i=t.renderCache.length,t.renderCache.push(this._createFBO())),void 0!==i&&(t.proxyCachedFBO[n.key]={},t.proxyCachedFBO[n.key][e.start]=i,t.renderCache[i].dirty=!0)}this._tilesDirty={}}_setupStencil(e,t,i,n){if(!n||!this._sourceTilesOverlap[n.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const o=this.painter.context,r=o.gl;if(t.length<=1)return void(this._overlapStencilType=!1);let s;if(i.isTileClipped())s=t.length,this._overlapStencilMode.test={func:r.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(t[0].overscaledZ>t[t.length-1].overscaledZ))return void(this._overlapStencilType=!1);s=1,this._overlapStencilMode.test={func:r.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+s>255&&(o.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=s,this._overlapStencilMode.ref=this._stencilRef,i.isTileClipped()&&this._renderTileClippingMasks(t,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(t){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[t.key]),this._overlapStencilMode):e.StencilMode.disabled}_renderTileClippingMasks(t,i){const n=this.painter,o=this.painter.context,r=o.gl;n._tileClippingMaskIDs={},o.setColorMode(e.ColorMode.disabled),o.setDepthMode(e.DepthMode.disabled);const s=n.useProgram("clippingMask");for(const a of t){const t=n._tileClippingMaskIDs[a.key]=--i;s.draw(o,r.TRIANGLES,e.DepthMode.disabled,new e.StencilMode({func:r.ALWAYS,mask:0},t,255,r.KEEP,r.KEEP,r.REPLACE),e.ColorMode.disabled,e.CullFaceMode.disabled,Ti(a.projMatrix),"$clipping",n.tileExtentBuffer,n.quadTriangleIndexBuffer,n.tileExtentSegments)}}pointCoordinate(t){const i=this.painter.transform;if(t.x<0||t.x>i.width||t.y<0||t.y>i.height)return null;const n=[t.x,t.y,1,1];e.transformMat4$1(n,n,i.pixelMatrixInverse),e.scale$1(n,n,1/n[3]),n[0]/=i.worldSize,n[1]/=i.worldSize;const o=i._camera.position,r=e.mercatorZfromAltitude(1,i.center.lat),s=[o[0],o[1],o[2]/r,0],a=e.subtract([],n.slice(0,3),s);e.normalize(a,a);const l=this.raycast(s,a,this._exaggeration);return null!==l&&l?(e.scaleAndAdd(s,s,a,l),s[3]=s[2],s[2]*=r,s):null}drawDepth(){const t=this.painter,i=t.context,n=this.proxySourceCache,o=Math.ceil(t.width),r=Math.ceil(t.height);if(!this._depthFBO||this._depthFBO.width===o&&this._depthFBO.height===r||(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),!this._depthFBO){const t=i.gl,n=i.createFramebuffer(o,r,!0);i.activeTexture.set(t.TEXTURE0);const s=new e.Texture(i,{width:o,height:r,data:null},t.RGBA);s.bind(t.NEAREST,t.CLAMP_TO_EDGE),n.colorAttachment.set(s.texture);const a=i.createRenderbuffer(i.gl.DEPTH_COMPONENT16,o,r);n.depthAttachment.set(a),this._depthFBO=n,this._depthTexture=s}i.bindFramebuffer.set(this._depthFBO.framebuffer),i.viewport.set([0,0,o,r]),function(t,i,n,o){if("globe"===t.transform.projection.name)return;const r=t.context,s=r.gl;r.clear({depth:1});const a=t.useProgram("terrainDepth"),l=new e.DepthMode(s.LESS,e.DepthMode.ReadWrite,t.depthRangeFor3D);for(const t of o){const o=n.getTile(t),c=yi(t.projMatrix,0);i.setupElevationDraw(o,a),a.draw(r,s.TRIANGLES,l,e.StencilMode.disabled,e.ColorMode.unblended,e.CullFaceMode.backCCW,c,"terrain_depth",i.gridBuffer,i.gridIndexBuffer,i.gridNoSkirtSegments)}}(t,this,n,this.proxyCoords)}_setupProxiedCoordsForOrtho(e,t,i){if(e.getSource()instanceof Se)return this._setupProxiedCoordsForImageSource(e,t,i);this._findCoveringTileCache[e.id]=this._findCoveringTileCache[e.id]||{};const n=this.proxiedCoords[e.id]=[],o=this.proxyCoords;for(let t=0;t(e.min.x=Math.min(e.min.x,t.x-a.x),e.min.y=Math.min(e.min.y,t.y-a.y),e.max.x=Math.max(e.max.x,t.x-a.x),e.max.y=Math.max(e.max.y,t.y-a.y),e)),{min:new e.Point(Number.MAX_VALUE,Number.MAX_VALUE),max:new e.Point(-Number.MAX_VALUE,-Number.MAX_VALUE)}),c=(t,i)=>{const n=t.wrap+t.canonical.x/(1<s+l.max.x||o+ra+l.max.y};for(let e=0;ee.key===i.tileID.key));if(e)return e}if(i.tileID.key!==t.key){const n=t.canonical.z-i.tileID.canonical.z;let r,s,a;o=e.create();const l=i.tileID.wrap-t.wrap<0?(r=e.EXTENT>>n,s=r*((i.tileID.canonical.x<=o){const n=t.canonical.z-o;i.getSource().reparseOverscaled?(a=Math.max(t.canonical.z+2,i.transform.tileZoom),s=new e.OverscaledTileID(a,t.wrap,o,t.canonical.x>>n,t.canonical.y>>n)):0!==n&&(a=o,s=new e.OverscaledTileID(a,t.wrap,o,t.canonical.x>>n,t.canonical.y>>n))}s.key!==t.key&&(c.push(s.key),n=i.getTile(s))}const u=e=>{c.forEach((t=>{o[t]=e})),c.length=0};for(a-=1;a>=l&&(!n||!n.hasData());a--){n&&u(n.tileID.key);const e=s.calculateScaledKey(a);if(n=i.getTileByID(e),n&&n.hasData())break;const t=o[e];if(null===t)break;void 0===t?c.push(e):n=i.getTileByID(t)}return u(n?n.tileID.key:null),n&&n.hasData()?n:null}findDEMTileFor(e){return this.enabled?this._findTileCoveringTileID(e,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(e,t){let i=this._tilesDirty[e];i||(i=this._tilesDirty[e]={}),i[t.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){const t=function(){let t=0;const i=new e.StructArrayLayout2ui4,n=131;for(let e=1;e<129;e++){for(let o=1;o<129;o++)t=e*n+o,i.emplaceBack(t,t+1),i.emplaceBack(t,t+n),i.emplaceBack(t+1,t+n),128===e&&i.emplaceBack(t+n,t+n+1);i.emplaceBack(t+1,t+1+n)}return i}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(t),this.wireframeSegments=e.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,t.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]}}class Ii{static cacheKey(e,t,i,n){let o=`${t}${n?n.cacheKey:""}`;for(const t of i)e.usedDefines.includes(t)&&(o+=`/${t}`);return o}constructor(t,i,n,o,r,s){const a=t.gl;this.program=a.createProgram();const l=function(e){const t=[];for(let i=0;i`#define ${e}`)));const h=t.isWebGL2?"#version 300 es\n":"",p=h+d.concat(t.extStandardDerivatives&&0===h.length?"#extension GL_OES_standard_derivatives : enable\n".concat(li):li,li,ai,si.fragmentSource,oi.fragmentSource,n.fragmentSource).join("\n"),m=h+d.concat("\n#ifdef GL_ES\nprecision highp float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif",ai,si.vertexSource,oi.vertexSource,ni.vertexSource,n.vertexSource).join("\n"),f=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);a.shaderSource(f,p),a.compileShader(f),a.attachShader(this.program,f);const g=a.createShader(a.VERTEX_SHADER);if(a.isContextLost())this.failedToCreate=!0;else{a.shaderSource(g,m),a.compileShader(g),a.attachShader(this.program,g),this.attributes={},this.numAttributes=u.length;for(let e=0;e({u_dem:new e.Uniform1i(t),u_dem_prev:new e.Uniform1i(t),u_dem_unpack:new e.Uniform4f(t),u_dem_tl:new e.Uniform2f(t),u_dem_scale:new e.Uniform1f(t),u_dem_tl_prev:new e.Uniform2f(t),u_dem_scale_prev:new e.Uniform1f(t),u_dem_size:new e.Uniform1f(t),u_dem_lerp:new e.Uniform1f(t),u_exaggeration:new e.Uniform1f(t),u_depth:new e.Uniform1i(t),u_depth_size_inv:new e.Uniform2f(t),u_meter_to_dem:new e.Uniform1f(t),u_label_plane_matrix_inv:new e.UniformMatrix4f(t)}))(t)),s.includes("GLOBE")&&(this.globeUniforms=(t=>({u_tile_tl_up:new e.Uniform3f(t),u_tile_tr_up:new e.Uniform3f(t),u_tile_br_up:new e.Uniform3f(t),u_tile_bl_up:new e.Uniform3f(t),u_tile_up_scale:new e.Uniform1f(t)}))(t)),s.includes("FOG")&&(this.fogUniforms=(t=>({u_fog_matrix:new e.UniformMatrix4f(t),u_fog_range:new e.Uniform2f(t),u_fog_color:new e.Uniform4f(t),u_fog_horizon_blend:new e.Uniform1f(t),u_fog_temporal_offset:new e.Uniform1f(t),u_frustum_tl:new e.Uniform3f(t),u_frustum_tr:new e.Uniform3f(t),u_frustum_br:new e.Uniform3f(t),u_frustum_bl:new e.Uniform3f(t),u_globe_pos:new e.Uniform3f(t),u_globe_radius:new e.Uniform1f(t),u_globe_transition:new e.Uniform1f(t),u_is_globe:new e.Uniform1i(t),u_viewport:new e.Uniform2f(t)}))(t))}}setTerrainUniformValues(e,t){if(!this.terrainUniforms)return;const i=this.terrainUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e]&&i[e].set(this.program,e,t[e])}}setGlobeUniformValues(e,t){if(!this.globeUniforms)return;const i=this.globeUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e]&&i[e].set(this.program,e,t[e])}}setFogUniformValues(e,t){if(!this.fogUniforms)return;const i=this.fogUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}}draw(e,t,i,n,o,r,s,a,l,c,u,d,h,p,m){const f=e.gl;if(this.failedToCreate)return;e.program.set(this.program),e.setDepthMode(i),e.setStencilMode(n),e.setColorMode(o),e.setCullFace(r);for(const e of Object.keys(this.fixedUniforms))this.fixedUniforms[e].set(this.program,e,s[e]);p&&p.setUniforms(this.program,e,this.binderUniforms,d,{zoom:h});const g={[f.LINES]:2,[f.TRIANGLES]:3,[f.LINE_STRIP]:1}[t];for(const i of u.get()){const n=i.vaos||(i.vaos={});(n[a]||(n[a]=new hi)).bind(e,this,l,p?p.getPaintVertexBuffers():[],c,i.vertexOffset,m||[]),f.drawElements(t,i.primitiveLength*g,f.UNSIGNED_SHORT,i.primitiveOffset*g*2)}}}function Di(e,t){const i=Math.pow(2,t.tileID.overscaledZ),n=t.tileSize*Math.pow(2,e.transform.tileZoom)/i,o=n*(t.tileID.canonical.x+t.tileID.wrap*i),r=n*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture.size,u_tile_units_to_pixels:1/A(t,1,e.transform.tileZoom),u_pixel_coord_upper:[o>>16,r>>16],u_pixel_coord_lower:[65535&o,65535&r]}}const zi=e.create(),Pi=(t,i,n,o,r,s,a,l,c,u,d)=>{const h=i.style.light,p=h.properties.get("position"),m=[p.x,p.y,p.z],f=e.create$1();"viewport"===h.properties.get("anchor")&&(e.fromRotation(f,-i.transform.angle),e.transformMat3(m,m,f));const g=h.properties.get("color"),_=i.transform,y={u_matrix:t,u_lightpos:m,u_lightintensity:h.properties.get("intensity"),u_lightcolor:[g.r,g.g,g.b],u_vertical_gradient:+n,u_opacity:o,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:zi,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:r,u_edge_radius:s};return"globe"===_.projection.name&&(y.u_tile_id=[a.canonical.x,a.canonical.y,1<{const p=Pi(t,i,n,o,r,s,a,c,u,d,h),m={u_height_factor:-Math.pow(2,a.overscaledZ)/l.tileSize/8};return e.extend(p,Di(i,l),m)},Bi=e=>({u_matrix:e}),ji=(t,i,n)=>e.extend(Bi(t),Di(i,n)),Ri=(e,t)=>({u_matrix:e,u_world:t}),Fi=(t,i,n,o)=>e.extend(ji(t,i,n),{u_world:o}),Ni=e.create(),Ui=(t,i,n,o,r,s)=>{const a=t.transform,l="globe"===a.projection.name;let c;if("map"===s.paint.get("circle-pitch-alignment"))if(l){const t=e.globePixelsToTileUnits(a.zoom,i.canonical)*a._pixelsPerMercatorPixel;c=Float32Array.from([t,0,0,t])}else c=a.calculatePixelsToTileUnitsMatrix(n);else c=new Float32Array([a.pixelsToGLUnits[0],0,0,a.pixelsToGLUnits[1]]);const u={u_camera_to_center_distance:a.cameraToCenterDistance,u_matrix:t.translatePosMatrix(i.projMatrix,n,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_device_pixel_ratio:e.exported.devicePixelRatio,u_extrude_scale:c,u_inv_rot_matrix:Ni,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(l){u.u_inv_rot_matrix=o,u.u_merc_center=r,u.u_tile_id=[i.canonical.x,i.canonical.y,1<{const t=[];return"map"===e.paint.get("circle-pitch-alignment")&&t.push("PITCH_WITH_MAP"),"map"===e.paint.get("circle-pitch-scale")&&t.push("SCALE_WITH_MAP"),t},$i=(t,i,n,o)=>{const r=e.EXTENT/n.tileSize;return{u_matrix:t,u_camera_to_center_distance:i.getCameraToCenterDistance(o),u_extrude_scale:[i.pixelsToGLUnits[0]/r,i.pixelsToGLUnits[1]/r]}},qi=(e,t,i=1)=>({u_matrix:e,u_color:t,u_overlay:0,u_overlay_scale:i}),Gi=e.create(),Zi=(t,i,n,o,r,s,a)=>{const l=t.transform,c="globe"===l.projection.name,u=c?e.globePixelsToTileUnits(l.zoom,i.canonical)*l._pixelsPerMercatorPixel:A(n,1,s),d={u_matrix:i.projMatrix,u_extrude_scale:u,u_intensity:a,u_inv_rot_matrix:Gi,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(c){d.u_inv_rot_matrix=o,d.u_merc_center=r,d.u_tile_id=[i.canonical.x,i.canonical.y,1<{const a=e.transform,l=a.calculatePixelsToTileUnitsMatrix(t);return{u_matrix:Yi(e,t,i,n),u_pixels_to_tile_units:l,u_device_pixel_ratio:r,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:o,u_texsize:Ki(i)?t.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Xi(t,e.transform),u_alpha_discard_threshold:0,u_trim_offset:s}},Wi=(e,t,i,n,o)=>{const r=e.transform;return{u_matrix:Yi(e,t,i,n),u_texsize:t.imageAtlasTexture.size,u_pixels_to_tile_units:r.calculatePixelsToTileUnitsMatrix(t),u_device_pixel_ratio:o,u_image:0,u_tile_units_to_pixels:Xi(t,r),u_units_to_pixels:[1/r.pixelsToGLUnits[0],1/r.pixelsToGLUnits[1]],u_alpha_discard_threshold:0}};function Xi(e,t){return 1/A(e,1,t.tileZoom)}function Yi(e,t,i,n){return e.translatePosMatrix(n||t.tileID.projMatrix,t,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}function Ki(e){const t=e.paint.get("line-dasharray").value;return t.value||"constant"!==t.kind}const Qi=(e,t,i,n,o,r)=>{return{u_matrix:e,u_tl_parent:t,u_scale_parent:i,u_fade_t:n.mix,u_opacity:n.opacity*o.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:o.paint.get("raster-brightness-min"),u_brightness_high:o.paint.get("raster-brightness-max"),u_saturation_factor:(a=o.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(s=o.paint.get("raster-contrast"),s>0?1/(1-s):1+s),u_spin_weights:Ji(o.paint.get("raster-hue-rotate")),u_perspective_transform:r};var s,a};function Ji(e){e*=Math.PI/180;const t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}const en=e.create(),tn=(t,i,n,o,r,s,a,l,c,u,d,h,p,m,f,g)=>{const _=r.transform,y={u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:_.cameraToCenterDistance,u_rotate_symbol:+n,u_aspect_ratio:_.width/_.height,u_fade_change:r.options.fadeDuration?r.symbolFadeChange:1,u_matrix:s,u_label_plane_matrix:a,u_coord_matrix:l,u_is_text:+c,u_pitch_with_map:+o,u_texsize:u,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:en,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:en,u_up_vector:[0,-1,0]};return"globe"===g.name&&(y.u_tile_id=[d.canonical.x,d.canonical.y,1<e.extend(tn(t,i,n,o,r,s,a,l,c,u,h,p,m,f,g,_),{u_gamma_scale:o?r.transform.cameraToCenterDistance*Math.cos(r.terrain?0:r.transform._pitch):1,u_device_pixel_ratio:e.exported.devicePixelRatio,u_is_halo:+d}),on=(t,i,n,o,r,s,a,l,c,u,d,h,p,m,f,g)=>e.extend(nn(t,i,n,o,r,s,a,l,!0,c,!0,d,h,p,m,f,g),{u_texsize_icon:u,u_texture_icon:1}),rn=(e,t,i)=>({u_matrix:e,u_opacity:t,u_color:i}),sn=(t,i,n,o,r)=>e.extend(function(e,t,i){const n=t.imageManager.getPattern(e.toString()),{width:o,height:r}=t.imageManager.getPixelSize(),s=Math.pow(2,i.tileID.overscaledZ),a=i.tileSize*Math.pow(2,t.transform.tileZoom)/s,l=a*(i.tileID.canonical.x+i.tileID.wrap*s),c=a*i.tileID.canonical.y;return{u_image:0,u_pattern_tl:n.tl,u_pattern_br:n.br,u_texsize:[o,r],u_pattern_size:n.displaySize,u_tile_units_to_pixels:1/A(i,1,t.transform.tileZoom),u_pixel_coord_upper:[l>>16,c>>16],u_pixel_coord_lower:[65535&l,65535&c]}}(o,n,r),{u_matrix:t,u_opacity:i}),an={fillExtrusion:t=>({u_matrix:new e.UniformMatrix4f(t),u_lightpos:new e.Uniform3f(t),u_lightintensity:new e.Uniform1f(t),u_lightcolor:new e.Uniform3f(t),u_vertical_gradient:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t),u_edge_radius:new e.Uniform1f(t),u_ao:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_up_dir:new e.Uniform3f(t),u_height_lift:new e.Uniform1f(t)}),fillExtrusionPattern:t=>({u_matrix:new e.UniformMatrix4f(t),u_lightpos:new e.Uniform3f(t),u_lightintensity:new e.Uniform1f(t),u_lightcolor:new e.Uniform3f(t),u_vertical_gradient:new e.Uniform1f(t),u_height_factor:new e.Uniform1f(t),u_edge_radius:new e.Uniform1f(t),u_ao:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_up_dir:new e.Uniform3f(t),u_height_lift:new e.Uniform1f(t),u_image:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t)}),fill:t=>({u_matrix:new e.UniformMatrix4f(t)}),fillPattern:t=>({u_matrix:new e.UniformMatrix4f(t),u_image:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t)}),fillOutline:t=>({u_matrix:new e.UniformMatrix4f(t),u_world:new e.Uniform2f(t)}),fillOutlinePattern:t=>({u_matrix:new e.UniformMatrix4f(t),u_world:new e.Uniform2f(t),u_image:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t)}),circle:t=>({u_camera_to_center_distance:new e.Uniform1f(t),u_extrude_scale:new e.UniformMatrix2f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_up_dir:new e.Uniform3f(t)}),collisionBox:t=>({u_matrix:new e.UniformMatrix4f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_extrude_scale:new e.Uniform2f(t)}),collisionCircle:t=>({u_matrix:new e.UniformMatrix4f(t),u_inv_matrix:new e.UniformMatrix4f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_viewport_size:new e.Uniform2f(t)}),debug:t=>({u_color:new e.UniformColor(t),u_matrix:new e.UniformMatrix4f(t),u_overlay:new e.Uniform1i(t),u_overlay_scale:new e.Uniform1f(t)}),clippingMask:t=>({u_matrix:new e.UniformMatrix4f(t)}),heatmap:t=>({u_extrude_scale:new e.Uniform1f(t),u_intensity:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_up_dir:new e.Uniform3f(t)}),heatmapTexture:t=>({u_image:new e.Uniform1i(t),u_color_ramp:new e.Uniform1i(t),u_opacity:new e.Uniform1f(t)}),hillshade:t=>({u_matrix:new e.UniformMatrix4f(t),u_image:new e.Uniform1i(t),u_latrange:new e.Uniform2f(t),u_light:new e.Uniform2f(t),u_shadow:new e.UniformColor(t),u_highlight:new e.UniformColor(t),u_accent:new e.UniformColor(t)}),hillshadePrepare:t=>({u_matrix:new e.UniformMatrix4f(t),u_image:new e.Uniform1i(t),u_dimension:new e.Uniform2f(t),u_zoom:new e.Uniform1f(t),u_unpack:new e.Uniform4f(t)}),line:t=>({u_matrix:new e.UniformMatrix4f(t),u_pixels_to_tile_units:new e.UniformMatrix2f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_units_to_pixels:new e.Uniform2f(t),u_dash_image:new e.Uniform1i(t),u_gradient_image:new e.Uniform1i(t),u_image_height:new e.Uniform1f(t),u_texsize:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t),u_alpha_discard_threshold:new e.Uniform1f(t),u_trim_offset:new e.Uniform2f(t)}),linePattern:t=>({u_matrix:new e.UniformMatrix4f(t),u_texsize:new e.Uniform2f(t),u_pixels_to_tile_units:new e.UniformMatrix2f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_image:new e.Uniform1i(t),u_units_to_pixels:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t),u_alpha_discard_threshold:new e.Uniform1f(t)}),raster:t=>({u_matrix:new e.UniformMatrix4f(t),u_tl_parent:new e.Uniform2f(t),u_scale_parent:new e.Uniform1f(t),u_fade_t:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t),u_image0:new e.Uniform1i(t),u_image1:new e.Uniform1i(t),u_brightness_low:new e.Uniform1f(t),u_brightness_high:new e.Uniform1f(t),u_saturation_factor:new e.Uniform1f(t),u_contrast_factor:new e.Uniform1f(t),u_spin_weights:new e.Uniform3f(t),u_perspective_transform:new e.Uniform2f(t)}),symbolIcon:t=>({u_is_size_zoom_constant:new e.Uniform1i(t),u_is_size_feature_constant:new e.Uniform1i(t),u_size_t:new e.Uniform1f(t),u_size:new e.Uniform1f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_rotate_symbol:new e.Uniform1i(t),u_aspect_ratio:new e.Uniform1f(t),u_fade_change:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_label_plane_matrix:new e.UniformMatrix4f(t),u_coord_matrix:new e.UniformMatrix4f(t),u_is_text:new e.Uniform1i(t),u_pitch_with_map:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_camera_forward:new e.Uniform3f(t),u_tile_matrix:new e.UniformMatrix4f(t),u_up_vector:new e.Uniform3f(t),u_ecef_origin:new e.Uniform3f(t),u_texture:new e.Uniform1i(t)}),symbolSDF:t=>({u_is_size_zoom_constant:new e.Uniform1i(t),u_is_size_feature_constant:new e.Uniform1i(t),u_size_t:new e.Uniform1f(t),u_size:new e.Uniform1f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_rotate_symbol:new e.Uniform1i(t),u_aspect_ratio:new e.Uniform1f(t),u_fade_change:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_label_plane_matrix:new e.UniformMatrix4f(t),u_coord_matrix:new e.UniformMatrix4f(t),u_is_text:new e.Uniform1i(t),u_pitch_with_map:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_texture:new e.Uniform1i(t),u_gamma_scale:new e.Uniform1f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_camera_forward:new e.Uniform3f(t),u_tile_matrix:new e.UniformMatrix4f(t),u_up_vector:new e.Uniform3f(t),u_ecef_origin:new e.Uniform3f(t),u_is_halo:new e.Uniform1i(t)}),symbolTextAndIcon:t=>({u_is_size_zoom_constant:new e.Uniform1i(t),u_is_size_feature_constant:new e.Uniform1i(t),u_size_t:new e.Uniform1f(t),u_size:new e.Uniform1f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_rotate_symbol:new e.Uniform1i(t),u_aspect_ratio:new e.Uniform1f(t),u_fade_change:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_label_plane_matrix:new e.UniformMatrix4f(t),u_coord_matrix:new e.UniformMatrix4f(t),u_is_text:new e.Uniform1i(t),u_pitch_with_map:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_texsize_icon:new e.Uniform2f(t),u_texture:new e.Uniform1i(t),u_texture_icon:new e.Uniform1i(t),u_gamma_scale:new e.Uniform1f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_is_halo:new e.Uniform1i(t)}),background:t=>({u_matrix:new e.UniformMatrix4f(t),u_opacity:new e.Uniform1f(t),u_color:new e.UniformColor(t)}),backgroundPattern:t=>({u_matrix:new e.UniformMatrix4f(t),u_opacity:new e.Uniform1f(t),u_image:new e.Uniform1i(t),u_pattern_tl:new e.Uniform2f(t),u_pattern_br:new e.Uniform2f(t),u_texsize:new e.Uniform2f(t),u_pattern_size:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t)}),terrainRaster:_i,terrainDepth:_i,skybox:t=>({u_matrix:new e.UniformMatrix4f(t),u_sun_direction:new e.Uniform3f(t),u_cubemap:new e.Uniform1i(t),u_opacity:new e.Uniform1f(t),u_temporal_offset:new e.Uniform1f(t)}),skyboxGradient:t=>({u_matrix:new e.UniformMatrix4f(t),u_color_ramp:new e.Uniform1i(t),u_center_direction:new e.Uniform3f(t),u_radius:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t),u_temporal_offset:new e.Uniform1f(t)}),skyboxCapture:t=>({u_matrix_3f:new e.UniformMatrix3f(t),u_sun_direction:new e.Uniform3f(t),u_sun_intensity:new e.Uniform1f(t),u_color_tint_r:new e.Uniform4f(t),u_color_tint_m:new e.Uniform4f(t),u_luminance:new e.Uniform1f(t)}),globeRaster:t=>({u_proj_matrix:new e.UniformMatrix4f(t),u_globe_matrix:new e.UniformMatrix4f(t),u_normalize_matrix:new e.UniformMatrix4f(t),u_merc_matrix:new e.UniformMatrix4f(t),u_zoom_transition:new e.Uniform1f(t),u_merc_center:new e.Uniform2f(t),u_image0:new e.Uniform1i(t),u_grid_matrix:new e.UniformMatrix3f(t),u_skirt_height:new e.Uniform1f(t),u_frustum_tl:new e.Uniform3f(t),u_frustum_tr:new e.Uniform3f(t),u_frustum_br:new e.Uniform3f(t),u_frustum_bl:new e.Uniform3f(t),u_globe_pos:new e.Uniform3f(t),u_globe_radius:new e.Uniform1f(t),u_viewport:new e.Uniform2f(t)}),globeAtmosphere:t=>({u_frustum_tl:new e.Uniform3f(t),u_frustum_tr:new e.Uniform3f(t),u_frustum_br:new e.Uniform3f(t),u_frustum_bl:new e.Uniform3f(t),u_horizon:new e.Uniform1f(t),u_transition:new e.Uniform1f(t),u_fadeout_range:new e.Uniform1f(t),u_color:new e.Uniform4f(t),u_high_color:new e.Uniform4f(t),u_space_color:new e.Uniform4f(t),u_star_intensity:new e.Uniform1f(t),u_star_density:new e.Uniform1f(t),u_star_size:new e.Uniform1f(t),u_temporal_offset:new e.Uniform1f(t),u_horizon_angle:new e.Uniform1f(t),u_rotation_matrix:new e.UniformMatrix4f(t)})};let ln;function cn(t,i,n,o,r,s,a){const l=t.context,c=l.gl,u=t.transform,d=t.useProgram("collisionBox"),h=[];let p=0,m=0;for(let f=0;f0){const t=e.create(),i=x;e.mul(t,y.placementInvProjMatrix,u.glCoordMatrix),e.mul(t,t,y.placementViewportMatrix),h.push({circleArray:w,circleOffset:m,transform:i,invTransform:t,projection:y.getProjection()}),p+=w.length/4,m=p}v&&(t.terrain&&t.terrain.setupElevationDraw(_,d),d.draw(l,c.LINES,e.DepthMode.disabled,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.disabled,$i(x,u,_,y.getProjection()),n.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,null,u.zoom,null,[v.collisionVertexBuffer,v.collisionVertexBufferExt]))}if(!a||!h.length)return;const f=t.useProgram("collisionCircle"),g=new e.StructArrayLayout2f1f2i16;g.resize(4*p),g._trim();let _=0;for(const e of h)for(let t=0;t=0&&(f[x.associatedIconIndex]={x:T,y:C,z:k,angle:D})}else pt(E,p)}if(d){m.clear();const i=t.icon.placedSymbolArray;for(let t=0;te.sortKey-t.sortKey));for(const e of C){const i=e.state;if(t.terrain&&t.terrain.setupElevationDraw(i.tile,i.program,{useDepthForOcclusion:!T,labelPlaneMatrixInv:i.labelPlaneMatrixInv}),p.activeTexture.set(m.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,m.CLAMP_TO_EDGE),i.atlasTextureIcon&&(p.activeTexture.set(m.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,m.CLAMP_TO_EDGE)),i.isSDF){const o=i.uniformValues;i.hasHalo&&(o.u_is_halo=1,fn(i.buffers,e.segments,n,t,i.program,w,d,h,o)),o.u_is_halo=0}fn(i.buffers,e.segments,n,t,i.program,w,d,h,i.uniformValues)}}function fn(t,i,n,o,r,s,a,l,c){const u=o.context,d=[t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer,t.globeExtVertexBuffer];r.draw(u,u.gl.TRIANGLES,s,a,l,e.CullFaceMode.disabled,c,n.id,t.layoutVertexBuffer,t.indexBuffer,i,n.paint,o.transform.zoom,t.programConfigurations.get(n.id),d)}function gn(t,i,n,o,r,s,a){const l=t.context.gl,c=n.paint.get("fill-pattern"),u=c&&c.constantOr(1);let d,h,p,m,f;a?(h=u&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",d=l.LINES):(h=u?"fillPattern":"fill",d=l.TRIANGLES);for(const g of o){const o=i.getTile(g);if(u&&!o.patternsLoaded())continue;const _=o.getBucket(n);if(!_)continue;t.prepareDrawTile();const y=_.programConfigurations.get(n.id),b=t.useProgram(h,y);u&&(t.context.activeTexture.set(l.TEXTURE0),o.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),y.updatePaintBuffers());const x=c.constantOr(null);if(x&&o.imageAtlas){const e=o.imageAtlas.patternPositions[x.toString()];e&&y.setConstantPatternPositions(e)}const v=t.translatePosMatrix(g.projMatrix,o,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(a){m=_.indexBuffer2,f=_.segments2;const e=t.terrain&&t.terrain.renderingToTexture?t.terrain.drapeBufferSize:[l.drawingBufferWidth,l.drawingBufferHeight];p="fillOutlinePattern"===h&&u?Fi(v,t,o,e):Ri(v,e)}else m=_.indexBuffer,f=_.segments,p=u?ji(v,t,o):Bi(v);t.prepareDrawProgram(t.context,b,g.toUnwrapped()),b.draw(t.context,d,r,t.stencilModeForClipping(g),s,e.CullFaceMode.disabled,p,n.id,_.layoutVertexBuffer,m,f,n.paint,t.transform.zoom,y)}}function _n(t,i,n,o,r,s,a){const l=t.context,c=l.gl,u=t.transform,d=n.paint.get("fill-extrusion-pattern"),h=d.constantOr(1),p=n.paint.get("fill-extrusion-opacity"),m=[n.paint.get("fill-extrusion-ambient-occlusion-intensity"),n.paint.get("fill-extrusion-ambient-occlusion-radius")],f=n.layout.get("fill-extrusion-edge-radius"),g=f>0&&!n.paint.get("fill-extrusion-rounded-roof"),_=g?0:f,y="globe"===u.projection.name?e.fillExtrusionHeightLift():0,b="globe"===u.projection.name,x=b?e.globeToMercatorTransition(u.zoom):0,v=[e.mercatorXfromLng(u.center.lng),e.mercatorYfromLat(u.center.lat)],w=[];b&&w.push("PROJECTION_GLOBE_VIEW"),m[0]>0&&w.push("FAUX_AO"),g&&w.push("ZERO_ROOF_RADIUS");for(const f of o){const o=i.getTile(f),g=o.getBucket(n);if(!g||g.projection.name!==u.projection.name)continue;const E=g.programConfigurations.get(n.id),M=t.useProgram(h?"fillExtrusionPattern":"fillExtrusion",E,w);if(t.terrain){const e=t.terrain;if(t.style.terrainSetForDrapingOnly())e.setupElevationDraw(o,M,{useMeterToDem:!0});else{if(!g.enableTerrain)continue;if(e.setupElevationDraw(o,M,{useMeterToDem:!0}),yn(l,i,f,g,n,e),!g.centroidVertexBuffer){const e=M.attributes.a_centroid_pos;void 0!==e&&c.vertexAttrib2f(e,0,0)}}}h&&(t.context.activeTexture.set(c.TEXTURE0),o.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),E.updatePaintBuffers());const T=d.constantOr(null);if(T&&o.imageAtlas){const e=o.imageAtlas.patternPositions[T.toString()];e&&E.setConstantPatternPositions(e)}const C=t.translatePosMatrix(f.projMatrix,o,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),k=u.projection.createInversionMatrix(u,f.canonical),S=n.paint.get("fill-extrusion-vertical-gradient"),L=h?Oi(C,t,S,p,m,_,f,o,y,x,v,k):Pi(C,t,S,p,m,_,f,y,x,v,k);t.prepareDrawProgram(l,M,f.toUnwrapped());const A=[];t.terrain&&A.push(g.centroidVertexBuffer),b&&A.push(g.layoutVertexExtBuffer),M.draw(l,l.gl.TRIANGLES,r,s,a,e.CullFaceMode.backCCW,L,n.id,g.layoutVertexBuffer,g.indexBuffer,g.segments,n.paint,t.transform.zoom,E,A)}}function yn(t,i,n,o,r,s){const a=[t=>{let i=t.canonical.x-1,n=t.wrap;return i<0&&(i=(1<{let i=t.canonical.x+1,n=t.wrap;return i===1<new e.OverscaledTileID(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,(0===t.canonical.y?1<new e.OverscaledTileID(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y===(1<{const t=i.getSource().minzoom,n=e=>{const t=i.getTileByID(e);if(t&&t.hasData())return t.getBucket(r)},o=[0,-1,1];for(const i of o){if(e.overscaledZ+i(c[0]=Math.min(t.min.y,i.min.y),c[1]=Math.max(t.max.y,i.max.y),c[2]=e.EXTENT-i.min.x>t.max.x?i.min.x-e.EXTENT:t.max.x,c),d=(t,i)=>(c[0]=Math.min(t.min.x,i.min.x),c[1]=Math.max(t.max.x,i.max.x),c[2]=e.EXTENT-i.min.y>t.max.y?i.min.y-e.EXTENT:t.max.y,c),h=[(e,t)=>u(e,t),(e,t)=>u(t,e),(e,t)=>d(e,t),(e,t)=>d(t,e)],p=new e.Point(0,0);let m,f,g;const _=(t,i,o,r,a)=>{const l=[[r?o:t,r?t:o,0],[r?o:i,r?i:o,0]],c=a<0?e.EXTENT+a:a,u=[r?c:(t+i)/2,r?(t+i)/2:c,0];return 0===o&&a<0||0!==o&&a>0?s.getForTilePoints(g,[u],!0,f):l.push(u),s.getForTilePoints(n,l,!0,m),Math.max(l[0][2],l[1][2],u[2])/s.exaggeration()};for(let t=0;t<4;t++){const i=(t<2?1:5)-t,r=o.borders[t];if(0===r.length)continue;const c=g=a[t](n),u=l(c);if(!(u&&u instanceof e.FillExtrusionBucket&&u.enableTerrain))continue;if(o.borderDoneWithNeighborZ[t]===u.canonical.z&&u.borderDoneWithNeighborZ[i]===o.canonical.z)continue;if(f=s.findDEMTileFor(c),!f||!f.dem)continue;if(!m){const e=s.findDEMTileFor(n);if(!e||!e.dem)return;m=e}const d=u.borders[i];let y=0;const b=u.borderDoneWithNeighborZ[i]!==o.canonical.z;if(o.canonical.z===u.canonical.z){for(let n=0;na[0]+3));)b&&u.encodeCentroid(void 0,l,!1),y++;if(l&&ya[1]-3)&&(r++,++y!==d.length);)l=u.featuresOnBorder[d[y]];if(l=u.featuresOnBorder[d[n]],s.intersectsCount()>1||l.intersectsCount()>1||1!==r){1!==r&&(y=n),o.encodeCentroid(void 0,s,!1),b&&u.encodeCentroid(void 0,l,!1);continue}const c=h[t](s,l),m=t%2?e.EXTENT-1:0;p.x=_(c[0],Math.min(e.EXTENT-1,c[1]),m,t<2,c[2]),p.y=0,o.encodeCentroid(p,s,!1),b&&u.encodeCentroid(p,l,!1)}else o.encodeCentroid(void 0,s,!1)}o.borderDoneWithNeighborZ[t]=u.canonical.z,o.needsCentroidUpdate=!0,b&&(u.borderDoneWithNeighborZ[i]=o.canonical.z,u.needsCentroidUpdate=!0)}else{for(const e of r)o.encodeCentroid(void 0,o.featuresOnBorder[e],!1);if(b){for(const e of d)u.encodeCentroid(void 0,u.featuresOnBorder[e],!1);u.borderDoneWithNeighborZ[i]=o.canonical.z,u.needsCentroidUpdate=!0}o.borderDoneWithNeighborZ[t]=u.canonical.z,o.needsCentroidUpdate=!0}}(o.needsCentroidUpdate||!o.centroidVertexBuffer&&0!==o.centroidVertexArray.length)&&o.uploadCentroid(t)}const bn=new e.Color(1,0,0,1),xn=new e.Color(0,1,0,1),vn=new e.Color(0,0,1,1),wn=new e.Color(1,0,1,1),En=new e.Color(0,1,1,1);function Mn(t,i,n){const o=t.context,r=t.transform,s=o.gl,a="globe"===r.projection.name,l=a?["PROJECTION_GLOBE_VIEW"]:null;let c=n.projMatrix;if(a&&e.globeToMercatorTransition(r.zoom)>0){const t=e.transitionTileAABBinECEF(n.canonical,r),i=e.globeDenormalizeECEF(t);c=e.multiply(new Float32Array(16),r.globeMatrix,i),e.multiply(c,r.projMatrix,c)}const u=t.useProgram("debug",null,l),d=i.getTileByID(n.key);t.terrain&&t.terrain.setupElevationDraw(d,u);const h=e.DepthMode.disabled,p=e.StencilMode.disabled,m=t.colorModeForRenderPass(),f="$debug";o.activeTexture.set(s.TEXTURE0),t.emptyTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),a?d._makeGlobeTileDebugBuffers(t.context,r):d._makeDebugTileBoundsBuffers(t.context,r.projection);const g=d._tileDebugBuffer||t.debugBuffer,_=d._tileDebugIndexBuffer||t.debugIndexBuffer,y=d._tileDebugSegments||t.debugSegments;u.draw(o,s.LINE_STRIP,h,p,m,e.CullFaceMode.disabled,qi(c,e.Color.red),f,g,_,y,null,null,null,[d._globeTileDebugBorderBuffer]);const b=d.latestRawTileData,x=Math.floor((b&&b.byteLength||0)/1024),v=i.getTile(n).tileSize,w=512/Math.min(v,512)*(n.overscaledZ/r.zoom)*.5;let E=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(E+=` => ${n.overscaledZ}`),E+=` ${x}kb`,function(e,t){e.initDebugOverlayCanvas();const i=e.debugOverlayCanvas,n=e.context.gl,o=e.debugOverlayCanvas.getContext("2d");o.clearRect(0,0,i.width,i.height),o.shadowColor="white",o.shadowBlur=2,o.lineWidth=1.5,o.strokeStyle="white",o.textBaseline="top",o.font="bold 36px Open Sans, sans-serif",o.fillText(t,5,5),o.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(t,E);const M=d._tileDebugTextBuffer||t.debugBuffer,T=d._tileDebugTextIndexBuffer||t.quadTriangleIndexBuffer,C=d._tileDebugTextSegments||t.debugSegments;u.draw(o,s.TRIANGLES,h,p,e.ColorMode.alphaBlended,e.CullFaceMode.disabled,qi(c,e.Color.transparent,w),f,M,T,C,null,null,null,[d._globeTileDebugTextBuffer])}function Tn(e,t,i,n){kn(e,0,t+i/2,e.transform.width,i,n)}function Cn(e,t,i,n){kn(e,t-i/2,0,i,e.transform.height,n)}function kn(t,i,n,o,r,s){const a=t.context,l=a.gl;l.enable(l.SCISSOR_TEST),l.scissor(i*e.exported.devicePixelRatio,n*e.exported.devicePixelRatio,o*e.exported.devicePixelRatio,r*e.exported.devicePixelRatio),a.clear({color:s}),l.disable(l.SCISSOR_TEST)}const Sn=e.createLayout([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Ln}=Sn;function An(e,t,i,n){e.emplaceBack(t,i,n)}class In{constructor(t){this.vertexArray=new e.StructArrayLayout3f12,this.indices=new e.StructArrayLayout3ui6,An(this.vertexArray,-1,-1,1),An(this.vertexArray,1,-1,1),An(this.vertexArray,-1,1,1),An(this.vertexArray,1,1,1),An(this.vertexArray,-1,-1,-1),An(this.vertexArray,1,-1,-1),An(this.vertexArray,-1,1,-1),An(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=t.createVertexBuffer(this.vertexArray,Ln),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=e.SegmentVector.simpleSegment(0,0,36,12)}}function Dn(t,i,n,o,r,s){const a=t.gl,l=i.paint.get("sky-atmosphere-color"),c=i.paint.get("sky-atmosphere-halo-color"),u=i.paint.get("sky-atmosphere-sun-intensity"),d=((e,t,i,n,o)=>({u_matrix_3f:e,u_sun_direction:t,u_sun_intensity:i,u_color_tint_r:[n.r,n.g,n.b,n.a],u_color_tint_m:[o.r,o.g,o.b,o.a],u_luminance:5e-5}))(e.fromMat4(e.create$1(),o),r,u,l,c);a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+s,i.skyboxTexture,0),n.draw(t,a.TRIANGLES,e.DepthMode.disabled,e.StencilMode.disabled,e.ColorMode.unblended,e.CullFaceMode.frontCW,d,"skyboxCapture",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}const zn=e.createLayout([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Pn{constructor(t){const i=new e.StructArrayLayout5f20;i.emplaceBack(-1,1,1,0,0),i.emplaceBack(1,1,1,1,0),i.emplaceBack(1,-1,1,1,1),i.emplaceBack(-1,-1,1,0,1);const n=new e.StructArrayLayout3ui6;n.emplaceBack(0,1,2),n.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(i,zn.members),this.indexBuffer=t.createIndexBuffer(n),this.segments=e.SegmentVector.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const On={symbol:function(t,i,n,o,r){if("translucent"!==t.renderPass)return;const s=e.StencilMode.disabled,a=t.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(t,i,n,o,r,s,a){const l=i.transform,c="map"===r,u="map"===s;for(const i of t){const t=o.getTile(i),r=t.getBucket(n);if(!r||!r.text||!r.text.segments.get().length)continue;const s=e.evaluateSizeForZoom(r.textSizeData,l.zoom),d=bt(i,r.getProjection(),l),h=l.calculatePixelsToTileUnitsMatrix(t),p=et(d,t.tileID.canonical,u,c,l,r.getProjection(),h),m="none"!==n.layout.get("icon-text-fit")&&r.hasIconData();if(s){const n=Math.pow(2,l.zoom-t.tileID.overscaledZ);hn(r,c,u,a,e.symbolSize,l,p,i,n,s,m)}}}(o,t,n,i,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),r),0!==n.paint.get("icon-opacity").constantOr(1)&&mn(t,i,n,o,!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"),s,a),0!==n.paint.get("text-opacity").constantOr(1)&&mn(t,i,n,o,!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"),s,a),i.map.showCollisionBoxes&&(cn(t,i,n,o,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),cn(t,i,n,o,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(t,i,n,o){if("translucent"!==t.renderPass)return;const r=n.paint.get("circle-opacity"),s=n.paint.get("circle-stroke-width"),a=n.paint.get("circle-stroke-opacity"),l=void 0!==n.layout.get("circle-sort-key").constantOr(1);if(0===r.constantOr(1)&&(0===s.constantOr(1)||0===a.constantOr(1)))return;const c=t.context,u=c.gl,d=t.transform,h=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),p=e.StencilMode.disabled,m=t.colorModeForRenderPass(),f="globe"===d.projection.name,g=[e.mercatorXfromLng(d.center.lng),e.mercatorYfromLat(d.center.lat)],_=[];for(let r=0;re.sortKey-t.sortKey));const y={useDepthForOcclusion:!f};for(const i of _){const{programConfiguration:o,program:r,layoutVertexBuffer:s,globeExtVertexBuffer:a,indexBuffer:l,uniformValues:f,tile:g}=i.state,_=i.segments;t.terrain&&t.terrain.setupElevationDraw(g,r,y),t.prepareDrawProgram(c,r,g.tileID.toUnwrapped()),r.draw(c,u.TRIANGLES,h,p,m,e.CullFaceMode.disabled,f,n.id,s,l,_,n.paint,d.zoom,o,[a])}},heatmap:function(t,i,n,o){if(0!==n.paint.get("heatmap-opacity"))if("offscreen"===t.renderPass){const r=t.context,s=r.gl,a=e.StencilMode.disabled,l=new e.ColorMode([s.ONE,s.ONE],e.Color.transparent,[!0,!0,!0,!0]);!function(e,t,i,n){const o=e.gl,r=t.width*n,s=t.height*n;e.activeTexture.set(o.TEXTURE1),e.viewport.set([0,0,r,s]);let a=i.heatmapFbo;if(!a||a&&(a.width!==r||a.height!==s)){a&&a.destroy();const t=o.createTexture();o.bindTexture(o.TEXTURE_2D,t),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),a=i.heatmapFbo=e.createFramebuffer(r,s,!1),function(e,t,i,n,o,r){const s=e.gl;s.texImage2D(s.TEXTURE_2D,0,e.isWebGL2&&e.extRenderToTextureHalfFloat?s.RGBA16F:s.RGBA,o,r,0,s.RGBA,e.extRenderToTextureHalfFloat?e.isWebGL2?s.HALF_FLOAT:e.extTextureHalfFloat.HALF_FLOAT_OES:s.UNSIGNED_BYTE,null),n.colorAttachment.set(i)}(e,0,t,a,r,s)}else o.bindTexture(o.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer)}(r,t,n,"globe"===t.transform.projection.name?.5:.25),r.clear({color:e.Color.transparent});const c=t.transform,u="globe"===c.projection.name,d=u?["PROJECTION_GLOBE_VIEW"]:null,h=u?e.CullFaceMode.frontCCW:e.CullFaceMode.disabled,p=[e.mercatorXfromLng(c.center.lng),e.mercatorYfromLat(c.center.lat)];for(let m=0;m({u_image:0,u_color_ramp:1,u_opacity:t.paint.get("heatmap-opacity")}))(0,i),i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,i.paint,t.transform.zoom)}(t,n))},line:function(t,i,n,o){if("translucent"!==t.renderPass)return;const r=n.paint.get("line-opacity"),s=n.paint.get("line-width");if(0===r.constantOr(1)||0===s.constantOr(1))return;const a=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),l=t.colorModeForRenderPass(),c=t.terrain&&t.terrain.renderingToTexture?1:e.exported.devicePixelRatio,u=n.paint.get("line-dasharray"),d=u.constantOr(1),h=n.layout.get("line-cap"),p=n.paint.get("line-pattern"),m=p.constantOr(1),f=n.paint.get("line-gradient"),g=m?"linePattern":"line",_=t.context,y=_.gl,b=(e=>{const t=[];Ki(e)&&t.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&&t.push("RENDER_LINE_GRADIENT");const i=e.paint.get("line-trim-offset");0===i[0]&&0===i[1]||t.push("RENDER_LINE_TRIM_OFFSET");const n=e.paint.get("line-pattern").constantOr(1),o=1!==e.paint.get("line-opacity").constantOr(1);return!n&&o&&t.push("RENDER_LINE_ALPHA_DISCARD"),t})(n);let x=b.includes("RENDER_LINE_ALPHA_DISCARD");t.terrain&&t.terrain.clipOrMaskOverlapStencilType()&&(x=!1);for(const r of o){const o=i.getTile(r);if(m&&!o.patternsLoaded())continue;const s=o.getBucket(n);if(!s)continue;t.prepareDrawTile();const v=s.programConfigurations.get(n.id),w=t.useProgram(g,v,b),E=p.constantOr(null);if(E&&o.imageAtlas){const e=o.imageAtlas.patternPositions[E.toString()];e&&v.setConstantPatternPositions(e)}const M=u.constantOr(null),T=h.constantOr(null);if(!m&&M&&T&&o.lineAtlas){const e=o.lineAtlas.getDash(M,T);e&&v.setConstantPatternPositions(e)}let[C,k]=n.paint.get("line-trim-offset");if("round"===T||"square"===T){const e=1;C!==k&&(0===C&&(C-=e),1===k&&(k+=e))}const S=t.terrain?r.projMatrix:null,L=m?Wi(t,o,n,S,c):Hi(t,o,n,S,s.lineClipsArray.length,c,[C,k]);if(f){const o=s.gradients[n.id];let a=o.texture;if(n.gradientVersion!==o.version){let l=256;if(n.stepInterpolant){const n=i.getSource().maxzoom,o=r.canonical.z===n?Math.ceil(1<{w.draw(_,y.TRIANGLES,a,i,l,e.CullFaceMode.disabled,L,n.id,s.layoutVertexBuffer,s.indexBuffer,s.segments,n.paint,t.transform.zoom,v,[s.layoutVertexBuffer2])};if(x){const i=t.stencilModeForClipping(r).ref;0===i&&t.terrain&&_.clear({stencil:0});const n={func:y.EQUAL,mask:255};L.u_alpha_discard_threshold=.8,A(new e.StencilMode(n,i,255,y.KEEP,y.KEEP,y.INVERT)),L.u_alpha_discard_threshold=0,A(new e.StencilMode(n,i,255,y.KEEP,y.KEEP,y.KEEP))}else A(t.stencilModeForClipping(r))}x&&(t.resetStencilClippingMasks(),t.terrain&&_.clear({stencil:0}))},fill:function(t,i,n,o){const r=n.paint.get("fill-color"),s=n.paint.get("fill-opacity");if(0===s.constantOr(1))return;const a=t.colorModeForRenderPass(),l=n.paint.get("fill-pattern"),c=t.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===r.constantOr(e.Color.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";if(t.renderPass===c){const r=t.depthModeForSublayer(1,"opaque"===t.renderPass?e.DepthMode.ReadWrite:e.DepthMode.ReadOnly);gn(t,i,n,o,r,a,!1)}if("translucent"===t.renderPass&&n.paint.get("fill-antialias")){const r=t.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,e.DepthMode.ReadOnly);gn(t,i,n,o,r,a,!0)}},"fill-extrusion":function(t,i,n,o){const r=n.paint.get("fill-extrusion-opacity");if(0!==r&&"translucent"===t.renderPass){const s=new e.DepthMode(t.context.gl.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);if(1!==r||n.paint.get("fill-extrusion-pattern").constantOr(1))_n(t,i,n,o,s,e.StencilMode.disabled,e.ColorMode.disabled),_n(t,i,n,o,s,t.stencilModeFor3D(),t.colorModeForRenderPass()),t.resetStencilClippingMasks();else{const r=t.colorModeForRenderPass();_n(t,i,n,o,s,e.StencilMode.disabled,r)}}},hillshade:function(t,i,n,o){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;const r=t.context,s=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),a=t.colorModeForRenderPass(),l=t.terrain&&t.terrain.renderingToTexture,[c,u]="translucent"!==t.renderPass||l?[{},o]:t.stencilConfigForOverlap(o);for(const o of u){const r=i.getTile(o);if(r.needsHillshadePrepare&&"offscreen"===t.renderPass)gi(t,r,n,s,e.StencilMode.disabled,a);else if("translucent"===t.renderPass){const e=l&&t.terrain?t.terrain.stencilModeForRTTOverlap(o):c[o.overscaledZ];mi(t,o,r,n,s,e,a)}}r.viewport.set([0,0,t.width,t.height]),t.resetStencilClippingMasks()},raster:function(t,i,n,o,r,s){if("translucent"!==t.renderPass)return;if(0===n.paint.get("raster-opacity"))return;if(!o.length)return;const a=t.context,l=a.gl,c=i.getSource(),u=t.useProgram("raster"),d=t.colorModeForRenderPass(),h=t.terrain&&t.terrain.renderingToTexture,[p,m]=c instanceof Se||h?[{},o]:t.stencilConfigForOverlap(o),f=m[m.length-1].overscaledZ,g=!t.options.moving;for(const o of m){const r=h?e.DepthMode.disabled:t.depthModeForSublayer(o.overscaledZ-f,1===n.paint.get("raster-opacity")?e.DepthMode.ReadWrite:e.DepthMode.ReadOnly,l.LESS),m=o.toUnwrapped(),_=i.getTile(o);if(h&&(!_||!_.hasData()))continue;const y=h?o.projMatrix:t.transform.calculateProjMatrix(m,g),b=t.terrain&&h?t.terrain.stencilModeForRTTOverlap(o):p[o.overscaledZ],x=s?0:n.paint.get("raster-fade-duration");_.registerFadeDuration(x);const v=i.findLoadedParent(o,0),w=Ci(_,v,i,t.transform,x);let E,M;t.terrain&&t.terrain.prepareDrawTile();const T="nearest"===n.paint.get("raster-resampling")?l.NEAREST:l.LINEAR;a.activeTexture.set(l.TEXTURE0),_.texture.bind(T,l.CLAMP_TO_EDGE),a.activeTexture.set(l.TEXTURE1),v?(v.texture.bind(T,l.CLAMP_TO_EDGE),E=Math.pow(2,v.tileID.overscaledZ-_.tileID.overscaledZ),M=[_.tileID.canonical.x*E%1,_.tileID.canonical.y*E%1]):_.texture.bind(T,l.CLAMP_TO_EDGE),_.texture.useMipmap&&a.extTextureFilterAnisotropic&&t.transform.pitch>20&&l.texParameterf(l.TEXTURE_2D,a.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,a.extTextureFilterAnisotropicMax);const C=Qi(y,M||[0,0],E||1,w,n,c instanceof Se?c.perspectiveTransform:[0,0]);if(t.prepareDrawProgram(a,u,m),c instanceof Se)c.boundsBuffer&&c.boundsSegments&&u.draw(a,l.TRIANGLES,r,e.StencilMode.disabled,d,e.CullFaceMode.disabled,C,n.id,c.boundsBuffer,t.quadTriangleIndexBuffer,c.boundsSegments);else{const{tileBoundsBuffer:i,tileBoundsIndexBuffer:o,tileBoundsSegments:s}=t.getTileBoundsBuffers(_);u.draw(a,l.TRIANGLES,r,b,d,e.CullFaceMode.disabled,C,n.id,i,o,s)}}t.resetStencilClippingMasks()},background:function(t,i,n,o){const r=n.paint.get("background-color"),s=n.paint.get("background-opacity");if(0===s)return;const a=t.context,l=a.gl,c=t.transform,u=c.tileSize,d=n.paint.get("background-pattern");if(t.isPatternMissing(d))return;const h=!d&&1===r.a&&1===s&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==h)return;const p=e.StencilMode.disabled,m=t.depthModeForSublayer(0,"opaque"===h?e.DepthMode.ReadWrite:e.DepthMode.ReadOnly),f=t.colorModeForRenderPass(),g=t.useProgram(d?"backgroundPattern":"background");let _,y=o;y||(_=t.getBackgroundTiles(),y=Object.values(_).map((e=>e.tileID))),d&&(a.activeTexture.set(l.TEXTURE0),t.imageManager.bind(t.context));for(const h of y){const y=h.toUnwrapped(),b=o?h.projMatrix:t.transform.calculateProjMatrix(y);t.prepareDrawTile();const x=i?i.getTile(h):_?_[h.key]:new e.Tile(h,u,c.zoom,t),v=d?sn(b,s,t,d,{tileID:h,tileSize:u}):rn(b,s,r);t.prepareDrawProgram(a,g,y);const{tileBoundsBuffer:w,tileBoundsIndexBuffer:E,tileBoundsSegments:M}=t.getTileBoundsBuffers(x);g.draw(a,l.TRIANGLES,m,p,f,e.CullFaceMode.disabled,v,n.id,w,E,M)}},sky:function(t,i,n){const o=t.transform,r="mercator"===o.projection.name||"globe"===o.projection.name?1:e.smoothstep(7,8,o.zoom),s=n.paint.get("sky-opacity")*r;if(0===s)return;const a=t.context,l=n.paint.get("sky-type"),c=new e.DepthMode(a.gl.LEQUAL,e.DepthMode.ReadOnly,[0,1]),u=t.frameCounter/1e3%1;"atmosphere"===l?"offscreen"===t.renderPass?n.needsSkyboxCapture(t)&&(function(t,i){const n=t.context,o=n.gl;let r=i.skyboxFbo;if(!r){r=i.skyboxFbo=n.createFramebuffer(32,32,!1),i.skyboxGeometry=new In(n),i.skyboxTexture=n.gl.createTexture(),o.bindTexture(o.TEXTURE_CUBE_MAP,i.skyboxTexture),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_MAG_FILTER,o.LINEAR);for(let e=0;e<6;++e)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,o.RGBA,32,32,0,o.RGBA,o.UNSIGNED_BYTE,null)}n.bindFramebuffer.set(r.framebuffer),n.viewport.set([0,0,32,32]);const s=i.getCenter(t,!0),a=t.useProgram("skyboxCapture"),l=new Float64Array(16);e.identity(l),e.rotateY(l,l,.5*-Math.PI),Dn(n,i,a,l,s,0),e.identity(l),e.rotateY(l,l,.5*Math.PI),Dn(n,i,a,l,s,1),e.identity(l),e.rotateX(l,l,.5*-Math.PI),Dn(n,i,a,l,s,2),e.identity(l),e.rotateX(l,l,.5*Math.PI),Dn(n,i,a,l,s,3),e.identity(l),Dn(n,i,a,l,s,4),e.identity(l),e.rotateY(l,l,Math.PI),Dn(n,i,a,l,s,5),n.viewport.set([0,0,t.width,t.height])}(t,n),n.markSkyboxValid(t)):"sky"===t.renderPass&&function(t,i,n,o,r){const s=t.context,a=s.gl,l=t.transform,c=t.useProgram("skybox");s.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_CUBE_MAP,i.skyboxTexture);const u=((e,t,i,n,o)=>({u_matrix:e,u_sun_direction:t,u_cubemap:0,u_opacity:n,u_temporal_offset:o}))(l.skyboxMatrix,i.getCenter(t,!1),0,o,r);t.prepareDrawProgram(s,c),c.draw(s,a.TRIANGLES,n,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.backCW,u,"skybox",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(t,n,c,s,u):"gradient"===l&&"sky"===t.renderPass&&function(t,i,n,o,r){const s=t.context,a=s.gl,l=t.transform,c=t.useProgram("skyboxGradient");i.skyboxGeometry||(i.skyboxGeometry=new In(s)),s.activeTexture.set(a.TEXTURE0);let u=i.colorRampTexture;u||(u=i.colorRampTexture=new e.Texture(s,i.colorRamp,a.RGBA)),u.bind(a.LINEAR,a.CLAMP_TO_EDGE);const d=((t,i,n,o,r)=>({u_matrix:t,u_color_ramp:0,u_center_direction:i,u_radius:e.degToRad(n),u_opacity:o,u_temporal_offset:r}))(l.skyboxMatrix,i.getCenter(t,!1),i.paint.get("sky-gradient-radius"),o,r);t.prepareDrawProgram(s,c),c.draw(s,a.TRIANGLES,n,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.backCW,d,"skyboxGradient",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(t,n,c,s,u)},debug:function(e,t,i){for(let n=0;nn)return void(this.transform.fogCullDistSq=null);const o=i+.78*(n-i);this.transform.fogCullDistSq=o*o}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}resize(t,i){if(this.width=t*e.exported.devicePixelRatio,this.height=i*e.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const e of this.style.order)this.style._layers[e].resize()}setup(){const t=this.context,i=new e.StructArrayLayout2i4;i.emplaceBack(0,0),i.emplaceBack(e.EXTENT,0),i.emplaceBack(0,e.EXTENT),i.emplaceBack(e.EXTENT,e.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(i,e.posAttributes.members),this.tileExtentSegments=e.SegmentVector.simpleSegment(0,0,4,2);const n=new e.StructArrayLayout2i4;n.emplaceBack(0,0),n.emplaceBack(e.EXTENT,0),n.emplaceBack(0,e.EXTENT),n.emplaceBack(e.EXTENT,e.EXTENT),this.debugBuffer=t.createVertexBuffer(n,e.posAttributes.members),this.debugSegments=e.SegmentVector.simpleSegment(0,0,4,5);const o=new e.StructArrayLayout2i4;o.emplaceBack(-1,-1),o.emplaceBack(1,-1),o.emplaceBack(-1,1),o.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(o,e.posAttributes.members),this.viewportSegments=e.SegmentVector.simpleSegment(0,0,4,2);const r=new e.StructArrayLayout4i8;r.emplaceBack(0,0,0,0),r.emplaceBack(e.EXTENT,0,e.EXTENT,0),r.emplaceBack(0,e.EXTENT,0,e.EXTENT),r.emplaceBack(e.EXTENT,e.EXTENT,e.EXTENT,e.EXTENT),this.mercatorBoundsBuffer=t.createVertexBuffer(r,e.boundsAttributes.members),this.mercatorBoundsSegments=e.SegmentVector.simpleSegment(0,0,4,2);const s=new e.StructArrayLayout3ui6;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(s);const a=new e.StructArrayLayout1ui2;for(const e of[0,1,3,2,0])a.emplaceBack(e);this.debugIndexBuffer=t.createIndexBuffer(a),this.emptyTexture=new e.Texture(t,new e.RGBAImage({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA),this.identityMat=e.create();const l=this.context.gl;this.stencilClearMode=new e.StencilMode({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.loadTimeStamps.push(e.window.performance.now()),this.atmosphereBuffer=new Pn(this.context)}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(e){return e._makeTileBoundsBuffers(this.context,this.transform.projection),e._tileBoundsBuffer?{tileBoundsBuffer:e._tileBoundsBuffer,tileBoundsIndexBuffer:e._tileBoundsIndexBuffer,tileBoundsSegments:e._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const t=this.context,i=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(t,i.TRIANGLES,e.DepthMode.disabled,this.stencilClearMode,e.ColorMode.disabled,e.CullFaceMode.disabled,Ti(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(t,i,n){if(!i||this.currentStencilSource===i.id||!t.isTileClipped()||!n||0===n.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let e=!1;for(const t of n)if(void 0===this._tileClippingMaskIDs[t.key]){e=!0;break}if(!e)return}this.currentStencilSource=i.id;const o=this.context,r=o.gl;this.nextStencilID+n.length>256&&this.clearStencil(),o.setColorMode(e.ColorMode.disabled),o.setDepthMode(e.DepthMode.disabled);const s=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const t of n){const n=i.getTile(t),a=this._tileClippingMaskIDs[t.key]=this.nextStencilID++,{tileBoundsBuffer:l,tileBoundsIndexBuffer:c,tileBoundsSegments:u}=this.getTileBoundsBuffers(n);s.draw(o,r.TRIANGLES,e.DepthMode.disabled,new e.StencilMode({func:r.ALWAYS,mask:0},a,255,r.KEEP,r.KEEP,r.REPLACE),e.ColorMode.disabled,e.CullFaceMode.disabled,Ti(t.projMatrix),"$clipping",l,c,u)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,i=this.context.gl;return new e.StencilMode({func:i.NOTEQUAL,mask:255},t,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(t){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(t);const i=this.context.gl;return new e.StencilMode({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,i.KEEP,i.KEEP,i.REPLACE)}stencilConfigForOverlap(t){const i=this.context.gl,n=t.sort(((e,t)=>t.overscaledZ-e.overscaledZ)),o=n[n.length-1].overscaledZ,r=n[0].overscaledZ-o+1;if(r>1){this.currentStencilSource=void 0,this.nextStencilID+r>256&&this.clearStencil();const t={};for(let n=0;n=0;this.currentLayer--){const e=this.style._layers[n[this.currentLayer]],i=t._getLayerSourceCache(e);if(e.isSky())continue;const o=i?s[i.id]:void 0;this._renderTileClippingMasks(e,i,o),this.renderLayer(this,i,e,o)}if(this.style.fog&&this.transform.projection.supportsFog&&function(t,i){const n=t.context,o=n.gl,r=t.transform,s=new e.DepthMode(o.LEQUAL,e.DepthMode.ReadOnly,[0,1]),a=t.useProgram("globeAtmosphere",null,"globe"===r.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"]),l=e.globeToMercatorTransition(r.zoom),c=i.properties.get("color").toArray01(),u=i.properties.get("high-color").toArray01(),d=i.properties.get("space-color").toArray01PremultipliedAlpha(),h=e.identity$1([]);e.rotateY$1(h,h,-e.degToRad(r._center.lng)),e.rotateX$1(h,h,e.degToRad(r._center.lat)),e.rotateZ$1(h,h,r.angle),e.rotateX$1(h,h,-r._pitch);const p=e.fromQuat(new Float32Array(16),h),m=e.mapValue(i.properties.get("star-intensity"),0,1,0,.25),f=5e-4,g=e.mapValue(i.properties.get("horizon-blend"),0,1,f,.25),_=e.globeUseCustomAntiAliasing(t,n,r)&&g===f?r.worldSize/(2*Math.PI*1.025)-1:r.globeRadius,y=t.frameCounter/1e3%1,b=e.length(r.globeCenterInViewSpace),x=Math.sqrt(Math.pow(b,2)-Math.pow(_,2)),v=Math.acos(x/b),w=((t,i,n,o,r,s,a,l,c,u,d,h,p,m)=>({u_frustum_tl:t,u_frustum_tr:i,u_frustum_br:n,u_frustum_bl:o,u_horizon:r,u_transition:s,u_fadeout_range:a,u_color:l,u_high_color:c,u_space_color:u,u_star_intensity:d,u_star_size:5*e.exported.devicePixelRatio,u_star_density:0,u_temporal_offset:h,u_horizon_angle:p,u_rotation_matrix:m}))(r.frustumCorners.TL,r.frustumCorners.TR,r.frustumCorners.BR,r.frustumCorners.BL,r.frustumCorners.horizon,l,g,c,u,d,m,y,v,p);t.prepareDrawProgram(n,a);const E=t.atmosphereBuffer;E&&a.draw(n,o.TRIANGLES,s,e.StencilMode.disabled,e.ColorMode.alphaBlended,e.CullFaceMode.backCW,w,"skybox",E.vertexBuffer,E.indexBuffer,E.segments)}(this,this.style.fog),this.renderPass="sky",(e.globeToMercatorTransition(this.transform.zoom)>0||"globe"!==this.transform.projection.name)&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer{const n=t._getLayerSourceCache(e);n&&!e.isHidden(this.transform.zoom)&&(!i||i.getSource().maxzoom0?t.pop():null}isPatternMissing(e){return null===e||void 0!==e&&!this.imageManager.getPattern(e.toString())}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture}currentGlobalDefines(){const e=this.terrain&&this.terrain.renderingToTexture,t=this.terrain&&0===this.terrain.exaggeration(),i=this.style&&this.style.fog,n=[];return this.terrainRenderModeElevated()&&n.push("TERRAIN"),"globe"===this.transform.projection.name&&n.push("GLOBE"),t&&n.push("ZERO_EXAGGERATION"),i&&!e&&0!==i.getOpacity(this.transform.pitch)&&n.push("FOG"),e&&n.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&n.push("OVERDRAW_INSPECTOR"),n}useProgram(e,t,i){this.cache=this.cache||{};const n=i||[],o=this.currentGlobalDefines().concat(n),r=Ii.cacheKey(ci[e],e,o,t);return this.cache[r]||(this.cache[r]=new Ii(this.context,e,ci[e],t,an[e],o)),this.cache[r]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=e.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new e.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.atmosphereBuffer&&this.atmosphereBuffer.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}prepareDrawProgram(t,i,n){if(this.terrain&&this.terrain.renderingToTexture)return;const o=this.style.fog;if(o){const r=o.getOpacity(this.transform.pitch),s=((t,i,n,o,r,s,a,l,c,u,d)=>{const h=t.transform,p=i.properties.get("color").toArray01();p[3]=o;const m=t.frameCounter/1e3%1;return{u_fog_matrix:n?h.calculateFogTileMatrix(n):t.identityMat,u_fog_range:i.getFovAdjustedRange(h._fov),u_fog_color:p,u_fog_horizon_blend:i.properties.get("horizon-blend"),u_fog_temporal_offset:m,u_frustum_tl:r,u_frustum_tr:s,u_frustum_br:a,u_frustum_bl:l,u_globe_pos:c,u_globe_radius:u,u_viewport:d,u_globe_transition:e.globeToMercatorTransition(h.zoom),u_is_globe:+("globe"===h.projection.name)}})(this,o,n,r,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*e.exported.devicePixelRatio,this.transform.height*e.exported.devicePixelRatio]);i.setFogUniformValues(t,s)}}setTileLoadedFlag(e){this.tileLoaded=e}saveCanvasCopy(){const e=this.canvasCopy();e&&(this.frameCopies.push(e),this.tileLoaded=!1)}canvasCopy(){const e=this.context.gl,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,0,0,e.drawingBufferWidth,e.drawingBufferHeight,0),t}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const e=this.style&&this.style.fog;return!!e&&0!==e.getOpacity(this.transform.pitch)}getBackgroundTiles(){const t=this._backgroundTiles,i=this._backgroundTiles={},n=this.transform.coveringTiles({tileSize:512});for(const o of n)i[o.key]=t[o.key]||new e.Tile(o,512,this.transform.tileZoom,this);return i}clearBackgroundTiles(){this._backgroundTiles={}}}class jn{constructor(e=0,t=0,i=0,n=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=i,this.right=n}interpolate(t,i,n){return null!=i.top&&null!=t.top&&(this.top=e.number(t.top,i.top,n)),null!=i.bottom&&null!=t.bottom&&(this.bottom=e.number(t.bottom,i.bottom,n)),null!=i.left&&null!=t.left&&(this.left=e.number(t.left,i.left,n)),null!=i.right&&null!=t.right&&(this.right=e.number(t.right,i.right,n)),this}getCenter(t,i){const n=e.clamp((this.left+t-this.right)/2,0,t),o=e.clamp((this.top+i-this.bottom)/2,0,i);return new e.Point(n,o)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new jn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Rn(t,i){const n=e.getColumn(t,3);e.fromQuat(t,i),e.setColumn(t,3,n)}function Fn(t,i){const n=e.identity$1([]);return e.rotateZ$1(n,n,-i),e.rotateX$1(n,n,-t),n}function Nn(t,i){const n=[t[0],t[1],0],o=[i[0],i[1],0];if(e.length(n)>=1e-15){const t=e.normalize([],n);e.scale$2(o,t,e.dot(o,t)),i[0]=o[0],i[1]=o[1]}const r=e.cross([],i,t);if(e.len(r)<1e-15)return null;const s=Math.atan2(-r[1],r[0]);return Fn(Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2]),s)}class Un{constructor(e,t){this.position=e,this.orientation=t}get position(){return this._position}set position(t){if(t){const i=t instanceof e.MercatorCoordinate?t:new e.MercatorCoordinate(t[0],t[1],t[2]);this._renderWorldCopies&&(i.x=e.wrap(i.x,0,1)),this._position=i}else this._position=null}lookAtPoint(t,i){if(this.orientation=null,!this.position)return;const n=this.position,o=this._elevation?this._elevation.getAtPointOrZero(e.MercatorCoordinate.fromLngLat(t)):0,r=e.MercatorCoordinate.fromLngLat(t,o),s=[r.x-n.x,r.y-n.y,r.z-n.z];i||(i=[0,0,1]),i[2]=Math.abs(i[2]),this.orientation=Nn(s,i)}setPitchBearing(t,i){this.orientation=Fn(e.degToRad(t),e.degToRad(-i))}}class Vn{constructor(t,i){this._transform=e.identity([]),this.orientation=i,this.position=t}get mercatorPosition(){const t=this.position;return new e.MercatorCoordinate(t[0],t[1],t[2])}get position(){const t=e.getColumn(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var i;t&&e.setColumn(this._transform,3,[(i=t)[0],i[1],i[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||e.identity$1([]),t&&Rn(this._transform,this._orientation)}getPitchBearing(){const e=this.forward(),t=this.right();return{bearing:Math.atan2(-t[1],t[0]),pitch:Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2])}}setPitchBearing(e,t){this._orientation=Fn(e,t),Rn(this._transform,this._orientation)}forward(){const t=e.getColumn(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=e.getColumn(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=e.getColumn(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,i){const n=new Float64Array(16);return e.invert(n,this.getWorldToCamera(t,i)),n}getWorldToCameraPosition(t,i,n){const o=this.position;e.scale$2(o,o,-t);const r=new Float64Array(16);return e.fromScaling(r,[n,n,n]),e.translate(r,r,o),r[10]*=i,r}getWorldToCamera(t,i){const n=new Float64Array(16),o=new Float64Array(4),r=this.position;return e.conjugate(o,this._orientation),e.scale$2(r,r,-t),e.fromQuat(n,o),e.translate(n,n,r),n[1]*=-1,n[5]*=-1,n[9]*=-1,n[13]*=-1,n[8]*=i,n[9]*=i,n[10]*=i,n[11]*=i,n}getCameraToClipPerspective(t,i,n,o){const r=new Float64Array(16);return e.perspective(r,t,i,n,o),r}getDistanceToElevation(t,i=!1){const n=0===t?0:e.mercatorZfromAltitude(t,i?e.latFromMercatorY(this.position[1]):this.position[1]),o=this.forward();return(n-this.position[2])/o[2]}clone(){return new Vn([...this.position],[...this.orientation])}}function $n(t,i){const n=Gn(t.projection,t.zoom,t.width,t.height),o=function(t,i,n,o,r){const s=new e.LngLat(n.lng-180*Zn,n.lat),a=new e.LngLat(n.lng+180*Zn,n.lat),l=t.project(s.lng,s.lat),c=t.project(a.lng,a.lat),u=-Math.atan2(c.y-l.y,c.x-l.x),d=e.MercatorCoordinate.fromLngLat(n);d.y=e.clamp(d.y,-1+Zn,1-Zn);const h=d.toLngLat(),p=t.project(h.lng,h.lat),m=e.MercatorCoordinate.fromLngLat(h);m.x+=Zn;const f=m.toLngLat(),g=t.project(f.lng,f.lat),_=Wn(g.x-p.x,g.y-p.y,u),y=e.MercatorCoordinate.fromLngLat(h);y.y+=Zn;const b=y.toLngLat(),x=t.project(b.lng,b.lat),v=Wn(x.x-p.x,x.y-p.y,u),w=Math.abs(_.x)/Math.abs(v.y),E=e.identity([]);e.rotateZ(E,E,-u*(1-(r?0:o)));const M=e.identity([]);return e.scale(M,M,[1,1-(1-w)*o,1]),M[4]=-v.x/v.y*o,e.rotateZ(M,M,u),e.multiply(M,E,M),M}(t.projection,0,t.center,n,i),r=qn(t);return e.scale(o,o,[r,r,1]),o}function qn(t){const i=t.projection,n=Gn(t.projection,t.zoom,t.width,t.height),o=Hn(i,t.center),r=Hn(i,e.LngLat.convert(i.center));return Math.pow(2,o*n+(1-n)*r)}function Gn(t,i,n,o,r=1/0){const s=t.range;if(!s)return 0;const a=Math.min(r,Math.max(n,o)),l=Math.log(a/1024)/Math.LN2;return e.smoothstep(s[0]+l,s[1]+l,i)}const Zn=1/4e4;function Hn(t,i){const n=e.clamp(i.lat,-e.MAX_MERCATOR_LATITUDE,e.MAX_MERCATOR_LATITUDE),o=new e.LngLat(i.lng-180*Zn,n),r=new e.LngLat(i.lng+180*Zn,n),s=t.project(o.lng,n),a=t.project(r.lng,n),l=e.MercatorCoordinate.fromLngLat(o),c=e.MercatorCoordinate.fromLngLat(r),u=a.x-s.x,d=a.y-s.y,h=c.x-l.x,p=c.y-l.y,m=Math.sqrt((h*h+p*p)/(u*u+d*d));return Math.log(m)/Math.LN2}function Wn(e,t,i){const n=Math.cos(i),o=Math.sin(i);return{x:e*n-t*o,y:e*o+t*n}}class Xn{constructor(t,i,n,o,r,s,a){this.tileSize=512,this._renderWorldCopies=void 0===r||r,this._minZoom=t||0,this._maxZoom=i||22,this._minPitch=null==n?0:n,this._maxPitch=null==o?60:o,this.setProjection(s),this.setMaxBounds(a),this.width=0,this.height=0,this._center=new e.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new jn,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new Vn,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._horizonShift=.1}clone(){const e=new Xn(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return e._elevation=this._elevation,e._centerAltitude=this._centerAltitude,e._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,e.tileSize=this.tileSize,e.mercatorFromTransition=this.mercatorFromTransition,e.width=this.width,e.height=this.height,e.cameraElevationReference=this.cameraElevationReference,e._center=this._center,e._setZoom(this.zoom),e._seaLevelZoom=this._seaLevelZoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._nearZ=this._nearZ,e._farZ=this._farZ,e._averageElevation=this._averageElevation,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._camera=this._camera.clone(),e._calcMatrices(),e.freezeTileCoverage=this.freezeTileCoverage,e.frustumCorners=this.frustumCorners,e}get elevation(){return this._elevation}set elevation(e){this._elevation!==e&&(this._elevation=e,this._updateCameraOnTerrain(),this._calcMatrices())}updateElevation(e,t=!1){const i=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(null==this._seaLevelZoom||i)&&this._updateCameraOnTerrain(),(e||i)&&this._constrainCamera(t),this._calcMatrices()}getProjection(){return e.pick(this.projection,["name","center","parallels"])}setProjection(i){this.projectionOptions=i||{name:"mercator"};const n=this.projection?this.getProjection():void 0;this.projection=e.getProjection(this.projectionOptions);const o=!t(n,this.getProjection());return o&&this._calcMatrices(),this.mercatorFromTransition=!1,o}setMercatorFromTransition(){const t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=e.getProjection({name:"mercator"});const i=t!==this.projection.name;return i&&this._calcMatrices(),i}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const e=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get cameraWorldSize(){const e=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return e.mercatorZfromAltitude(this.center.lat,this.cameraWorldSizeForFog)}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.Point(this.width,this.height)}get bearing(){return e.wrap(this.rotation,-180,180)}set bearing(e){this.rotation=e}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const i=-t*Math.PI/180;var n;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=(n=new e.ARRAY_TYPE(4),e.ARRAY_TYPE!=Float32Array&&(n[1]=0,n[2]=0),n[0]=1,n[3]=1,n),function(e,t,i){var n=t[0],o=t[1],r=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);e[0]=n*l+r*a,e[1]=o*l+s*a,e[2]=n*-a+r*l,e[3]=o*-a+s*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const i=e.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}get fovX(){return this._fov}get fovY(){const e=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/e)}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=e.degToRad(t),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(e){this._averageElevation=e,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(e){const t=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==t&&(this._unmodified=!1,this._setZoom(t),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(e){this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom}_updateCameraOnTerrain(){if(!this._elevation||!this._elevation.isDataAvailableAtPoint(this.locationCoordinate(this.center)))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const e=this._elevation;this._centerAltitude=e.getAtPointOrZero(this.locationCoordinate(this.center)),this._centerAltitudeValidForExaggeration=e.exaggeration(),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){void 0!==this._centerAltitudeValidForExaggeration&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,i=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],n=this.horizonLineFromTop();let o=0,r=0;for(let s=0;st.maxzoom&&(i=t.maxzoom);const s=this.locationCoordinate(this.center),a=this.center.lat,l=1<{const i=1/4e4,n=new e.MercatorCoordinate(t.x+i,t.y,t.z),o=new e.MercatorCoordinate(t.x,t.y+i,t.z),r=t.toLngLat(),s=n.toLngLat(),a=o.toLngLat(),l=this.locationCoordinate(r),c=this.locationCoordinate(s),u=this.locationCoordinate(a),d=Math.hypot(c.x-l.x,c.y-l.y),h=Math.hypot(u.x-l.x,u.y-l.y);return Math.sqrt(d*h)*v/i},E=t=>{const i=b,n=x;return{aabb:e.tileAABB(this,l,0,0,0,t,n,i,this.projection),zoom:0,x:0,y:0,minZ:n,maxZ:i,wrap:t,fullyVisible:!1}},M=[];let T=[];const C=i,k=t.reparseOverscaled?n:i,S=e=>e*e,L=S((f-this._centerAltitude)*m),A=e=>{if(!this._elevation||!e.tileID||!r)return;const t=this._elevation.getMinMaxForTile(e.tileID),i=e.aabb;t?(i.min[2]=t.min,i.max[2]=t.max,i.center[2]=(i.min[2]+i.max[2])/2):(e.shouldSplit=I(e),e.shouldSplit||(i.min[2]=i.max[2]=i.center[2]=this._centerAltitude))},I=t=>{if(t.zoom=.9)return!0}else if(o&&(s=S(t.aabb.distanceZ(g)*m)),this.projection.isReprojectedInTileSpace&&n<=5){const i=Math.pow(2,t.zoom),n=w(new e.MercatorCoordinate((t.x+.5)/i,(t.y+.5)/i));l=n>.85?1:n}const c=i*i+r*r+s,d=S((1<{if(t*S(.707)0;){const n=M.pop(),s=n.x,a=n.y;let d=n.fullyVisible;if(!d){const e=n.aabb.intersects(h);if(0===e)continue;d=2===e}if(n.zoom!==C&&I(n))for(let t=0;t<4;t++){const i=(s<<1)+t%2,c=(a<<1)+(t>>1),h={aabb:r?n.aabb.quadrant(t):e.tileAABB(this,l,n.zoom+1,i,c,n.wrap,n.minZ,n.maxZ,this.projection),zoom:n.zoom+1,x:i,y:c,wrap:n.wrap,fullyVisible:d,tileID:void 0,shouldSplit:void 0,minZ:n.minZ,maxZ:n.maxZ};o&&!u&&(h.tileID=new e.OverscaledTileID(n.zoom+1===C?k:n.zoom+1,n.wrap,n.zoom+1,i,c),A(h)),M.push(h)}else{const o=n.zoom===C?k:n.zoom;if(t.minzoom&&t.minzoom>o)continue;const r=c[0]-(.5+s+(n.wrap<{const r=[0,0,0,1],s=[e.EXTENT,e.EXTENT,0,1],a=this.calculateFogTileMatrix(o.tileID.toUnwrapped());e.transformMat4$1(r,r,a),e.transformMat4$1(s,s,a);const l=e.getAABBPointSquareDist(r,s);if(0===l)return!0;let c=!1;const u=this._elevation;if(u&&l>i&&0!==n){const i=this.calculateProjMatrix(o.tileID.toUnwrapped());let r;t.isTerrainDEM||(r=u.getMinMaxForTile(o.tileID)),r||(r={min:x,max:b});const s=e.furthestTileCorner(this.rotation),a=[s[0]*e.EXTENT,s[1]*e.EXTENT,r.max];e.transformMat4(a,a,i),c=(1-a[1])*this.height*.5e.distanceSq-t.distanceSq)).map((e=>e.tileID))}resize(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(t){const i=e.clamp(t.lat,-e.MAX_MERCATOR_LATITUDE,e.MAX_MERCATOR_LATITUDE),n=this.projection.project(t.lng,i);return new e.Point(n.x*this.worldSize,n.y*this.worldSize)}unproject(e){return this.projection.unproject(e.x/this.worldSize,e.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/e.mercatorZfromAltitude(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,i){let n,o;const r=this.centerPoint;if("globe"===this.projection.name){const e=this.worldSize;n=(i.x-r.x)/e,o=(i.y-r.y)/e}else{const e=this.pointCoordinate(i),t=this.pointCoordinate(r);n=e.x-t.x,o=e.y-t.y}const s=this.locationCoordinate(t);this.setLocation(new e.MercatorCoordinate(s.x-n,s.y-o))}setLocation(e){this.center=this.coordinateLocation(e),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(e){return this.projection.locationPoint(this,e)}locationPoint3D(e){return this.projection.locationPoint(this,e,!0)}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}pointLocation3D(e){return this.coordinateLocation(this.pointCoordinate3D(e))}locationCoordinate(t,i){const n=i?e.mercatorZfromAltitude(i,t.lat):void 0,o=this.projection.project(t.lng,t.lat);return new e.MercatorCoordinate(o.x,o.y,n)}coordinateLocation(e){return this.projection.unproject(e.x,e.y)}pointRayIntersection(t,i){const n=null!=i?i:this._centerAltitude,o=[t.x,t.y,0,1],r=[t.x,t.y,1,1];e.transformMat4$1(o,o,this.pixelMatrixInverse),e.transformMat4$1(r,r,this.pixelMatrixInverse);const s=r[3];e.scale$1(o,o,1/o[3]),e.scale$1(r,r,1/s);const a=o[2],l=r[2];return{p0:o,p1:r,t:a===l?0:(n-a)/(l-a)}}screenPointToMercatorRay(t){const i=[t.x,t.y,0,1],n=[t.x,t.y,1,1];return e.transformMat4$1(i,i,this.pixelMatrixInverse),e.transformMat4$1(n,n,this.pixelMatrixInverse),e.scale$1(i,i,1/i[3]),e.scale$1(n,n,1/n[3]),i[2]=e.mercatorZfromAltitude(i[2],this._center.lat)*this.worldSize,n[2]=e.mercatorZfromAltitude(n[2],this._center.lat)*this.worldSize,e.scale$1(i,i,1/this.worldSize),e.scale$1(n,n,1/this.worldSize),new e.Ray([i[0],i[1],i[2]],e.normalize([],e.sub([],n,i)))}rayIntersectionCoordinate(t){const{p0:i,p1:n,t:o}=t,r=e.mercatorZfromAltitude(i[2],this._center.lat),s=e.mercatorZfromAltitude(n[2],this._center.lat);return new e.MercatorCoordinate(e.number(i[0],n[0],o)/this.worldSize,e.number(i[1],n[1],o)/this.worldSize,e.number(r,s,o))}pointCoordinate(e,t=this._centerAltitude){return this.projection.pointCoordinate(this,e.x,e.y,t)}pointCoordinate3D(t){if(!this.elevation)return this.pointCoordinate(t);let i=this.projection.pointCoordinate3D(this,t.x,t.y);if(i)return new e.MercatorCoordinate(i[0],i[1],i[2]);let n=0,o=this.horizonLineFromTop();if(t.y>o)return this.pointCoordinate(t);const r=.02*o,s=t.clone();for(let t=0;t<10&&o-n>r;t++){s.y=e.number(n,o,.66);const t=this.projection.pointCoordinate3D(this,s.x,s.y);t?(o=s.y,i=t):n=s.y}return i?new e.MercatorCoordinate(i[0],i[1],i[2]):this.pointCoordinate(t)}isPointAboveHorizon(e){return this.projection.isPointAboveHorizon(this,e)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return!1;if(this.elevation||this.zoom>=e.GLOBE_ZOOM_THRESHOLD_MAX)return!this.isPointAboveHorizon(t);const i=this.pointCoordinate(t);return i.y>=0&&i.y<=1}_coordinatePoint(t,i){const n=i&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,o=[t.x*this.worldSize,t.y*this.worldSize,n+t.toAltitude(),1];return e.transformMat4$1(o,o,this.pixelMatrix),o[3]>0?new e.Point(o[0]/o[3],o[1]/o[3]):new e.Point(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:i}=this._edgeInsets,n=this.height-this._edgeInsets.bottom,o=this.width-this._edgeInsets.right,r=this.pointLocation3D(new e.Point(i,t)),s=this.pointLocation3D(new e.Point(o,t)),a=this.pointLocation3D(new e.Point(o,n)),l=this.pointLocation3D(new e.Point(i,n));let c=Math.min(r.lng,s.lng,a.lng,l.lng),u=Math.max(r.lng,s.lng,a.lng,l.lng),d=Math.min(r.lat,s.lat,a.lat,l.lat),h=Math.max(r.lat,s.lat,a.lat,l.lat);const p=Math.pow(2,-this.zoom)/16*270,m="globe"===this.projection.name?1:4,f=(t,i,n,o,r)=>{const s=(t+n)/2,a=(i+o)/2,l=new e.Point(s,a),{lng:g,lat:_}=this.pointLocation3D(l),y=Math.max(0,c-g,d-_,g-u,_-h);c=Math.min(c,g),u=Math.max(u,g),d=Math.min(d,_),h=Math.max(h,_),(rp)&&(f(t,i,s,a,r+1),f(s,a,n,o,r+1))};if(f(i,t,o,t,1),f(o,t,o,n,1),f(o,n,i,n,1),f(i,n,i,t,1),"globe"===this.projection.name){const[t,i]=e.polesInViewport(this);t?(h=90,u=180,c=-180):i&&(d=-90,u=180,c=-180)}return new e.LngLatBounds(new e.LngLat(c,d),new e.LngLat(u,h))}_getBoundsRectangular(t,i){const{top:n,left:o}=this._edgeInsets,r=this.height-this._edgeInsets.bottom,s=this.width-this._edgeInsets.right,a=new e.Point(o,n),l=new e.Point(s,n),c=new e.Point(s,r),u=new e.Point(o,r);let d=this.pointCoordinate(a,t),h=this.pointCoordinate(l,t);const p=this.pointCoordinate(c,i),m=this.pointCoordinate(u,i),f=(e,t)=>(t.y-e.y)/(t.x-e.x);return d.y>1&&h.y>=0?d=new e.MercatorCoordinate((1-m.y)/f(m,d)+m.x,1):d.y<0&&h.y<=1&&(d=new e.MercatorCoordinate(-m.y/f(m,d)+m.x,0)),h.y>1&&d.y>=0?h=new e.MercatorCoordinate((1-p.y)/f(p,h)+p.x,1):h.y<0&&d.y<=1&&(h=new e.MercatorCoordinate(-p.y/f(p,h)+p.x,0)),(new e.LngLatBounds).extend(this.coordinateLocation(d)).extend(this.coordinateLocation(h)).extend(this.coordinateLocation(m)).extend(this.coordinateLocation(p))}_getBoundsRectangularTerrain(){const e=this.elevation;if(!e.visibleDemTiles.length||e.isUsingMockSource())return this._getBoundsRectangular(0,0);const t=e.visibleDemTiles.reduce(((e,t)=>{if(t.dem){const i=t.dem.tree;e.min=Math.min(e.min,i.minimums[0]),e.max=Math.max(e.max,i.maximums[0])}return e}),{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(t.min*e.exaggeration(),t.max*e.exaggeration())}getBounds(){return"mercator"===this.projection.name||"equirectangular"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(e=!0){const t=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,i=this.height/2-t*(1-this._horizonShift);return e?Math.max(0,i):i}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-e.MAX_MERCATOR_LATITUDE,this.maxLat=e.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLngd&&(a=d-c),d-ut&&(s=t-l),t-e.5?x-1:x,v>.5?v-1:v,0]),this.alignedProjMatrix=w,a=e.create(),e.scale(a,a,[this.width/2,-this.height/2,1]),e.translate(a,a,[1,-1,0]),this.labelPlaneMatrix=a,a=e.create(),e.scale(a,a,[1,-1,1]),e.translate(a,a,[-1,-1,0]),e.scale(a,a,[2/this.width,2/this.height,1]),this.glCoordMatrix=a,this.pixelMatrix=e.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},a=e.invert(new Float64Array(16),this.pixelMatrix),!a)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=a,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=e.calculateGlobeMatrix(this);const t=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=e.transformMat4(t,t,r),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=a;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,i=this.cameraPixelsPerMeter,n=this._camera.position,o=1/this.height/this._pixelsPerMercatorPixel,r=[t,t,i];e.scale$2(r,r,o),e.scale$2(n,n,-1),e.multiply$2(n,n,r);const s=e.create();e.translate(s,s,n),e.scale(s,s,r),this.mercatorFogMatrix=s,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,i,o)}_computeCameraPosition(e){const t=(e=e||this.pixelsPerMeter)/this.pixelsPerMeter,i=this._camera.forward(),n=this.point,o=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*t-e/this.worldSize*this._centerAltitude;return[n.x/this.worldSize-i[0]*o,n.y/this.worldSize-i[1]*o,e/this.worldSize*this._centerAltitude-i[2]*o]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const i=this._maxCameraBoundsDistance()*Math.cos(this._pitch),n=this._camera.position[2],o=t[2];let r=1;this.projection.wrap&&(this.center=this.center.wrap()),o>0&&(r=Math.min((i-n)/o,1)),this._camera.position=e.scaleAndAdd([],this._camera.position,t,r),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,i=this._camera.forward(),{pitch:n,bearing:o}=this._camera.getPitchBearing(),r=e.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,s=this._mercatorZfromZoom(this._maxZoom)*Math.cos(e.degToRad(this._maxPitch)),a=Math.max((t[2]-r)/Math.cos(n),s),l=this._zoomFromMercatorZ(a);e.scaleAndAdd(t,t,i,a),this._pitch=e.clamp(n,e.degToRad(this.minPitch),e.degToRad(this.maxPitch)),this.angle=e.wrap(o,-Math.PI,Math.PI),this._setZoom(e.clamp(l,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new e.MercatorCoordinate(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(e){return Math.pow(2,e)*this.tileSize}_mercatorZfromZoom(e){return this.cameraToCenterDistance/this._worldSizeFromZoom(e)}_minimumHeightOverTerrain(){const e=Math.min((null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom)+4,this._maxZoom);return this._mercatorZfromZoom(e)}_zoomFromMercatorZ(e){return this.scaleZoom(this.cameraToCenterDistance/(e*this.tileSize))}zoomFromMercatorZAdjusted(t){let i=0,n=e.GLOBE_ZOOM_THRESHOLD_MAX,o=0,r=1/0;for(;n-i>1e-6&&n>i;){const e=i+.5*(n-i),s=this.tileSize*Math.pow(2,e),a=this.getCameraToCenterDistance(this.projection,e,s),l=this.scaleZoom(a/(t*this.tileSize)),c=Math.abs(e-l);cc||i.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+e.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new e.Point(0,0),new e.Point(this.width,this.height))}zoomDeltaToMovement(t,i){const n=e.length(e.sub([],this._camera.position,t)),o=this._zoomFromMercatorZ(n)+i;return n-this._mercatorZfromZoom(o)}getCameraPoint(){if("globe"===this.projection.name){const t=function([t,i,n],o){const r=[t,i,n,1];e.transformMat4$1(r,r,o);const s=r[3]=Math.max(r[3],1e-6);return r[0]/=s,r[1]/=s,r[2]/=s,r}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new e.Point(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.Point(0,t))}}getCameraToCenterDistance(e,t=this.zoom,i=this.worldSize){const n=Gn(e,t,this.width,this.height,1024),o=e.pixelSpaceConversion(this.center.lat,i,n);return.5/Math.tan(.5*this._fov)*this.height*o}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&e.multiply(t,t,this.globeMatrix),t}}function Yn(e,t){let i=!1,n=null;const o=()=>{n=null,i&&(e(),n=setTimeout(o,t),i=!1)};return()=>(i=!0,n||o(),n)}class Kn{constructor(t){this._hashName=t&&encodeURIComponent(t),e.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=Yn(this._updateHashUnthrottled.bind(this),300)}addTo(t){return this._map=t,e.window.addEventListener("hashchange",this._onHashChange,!1),t.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),e.window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const t=this._map;if(!t)return"";const i=Qn(t);if(this._hashName){const t=this._hashName;let n=!1;const o=e.window.location.hash.slice(1).split("&").map((e=>{const o=e.split("=")[0];return o===t?(n=!0,`${o}=${i}`):e})).filter((e=>e));return n||o.push(`${t}=${i}`),`#${o.join("&")}`}return`#${i}`}_getCurrentHash(){const t=e.window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map((e=>e.split("="))).forEach((t=>{t[0]===this._hashName&&(e=t)})),(e&&e[1]||"").split("/")}return t.split("/")}_onHashChange(){const e=this._map;if(!e)return!1;const t=this._getCurrentHash();if(t.length>=3&&!t.some((e=>isNaN(e)))){const i=e.dragRotate.isEnabled()&&e.touchZoomRotate.isEnabled()?+(t[3]||0):e.getBearing();return e.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:i,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=e.window.location.href.replace(/(#.+)?$/,this.getHashString());e.window.history.replaceState(e.window.history.state,null,t)}}function Qn(e,t){const i=e.getCenter(),n=Math.round(100*e.getZoom())/100,o=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),r=Math.pow(10,o),s=Math.round(i.lng*r)/r,a=Math.round(i.lat*r)/r,l=e.getBearing(),c=e.getPitch();let u=t?`/${s}/${a}/${n}`:`${n}/${a}/${s}`;return(l||c)&&(u+="/"+Math.round(10*l)/10),c&&(u+=`/${Math.round(c)}`),u}const Jn={linearity:.3,easing:e.bezier(0,0,.3,1)},eo=e.extend({deceleration:2500,maxSpeed:1400},Jn),to=e.extend({deceleration:20,maxSpeed:1400},Jn),io=e.extend({deceleration:1e3,maxSpeed:360},Jn),no=e.extend({deceleration:1e3,maxSpeed:90},Jn);class oo{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:e.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,i=e.exported.now();for(;t.length>0&&i-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion())return;if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new e.Point(0,0),pinchAround:void 0,around:void 0};for(const{settings:e}of this._inertiaBuffer)i.zoom+=e.zoomDelta||0,i.bearing+=e.bearingDelta||0,i.pitch+=e.pitchDelta||0,e.panDelta&&i.pan._add(e.panDelta),e.around&&(i.around=e.around),e.pinchAround&&(i.pinchAround=e.pinchAround);const n=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(i.pan.mag()){const r=so(i.pan.mag(),n,e.extend({},eo,t||{}));o.offset=i.pan.mult(r.amount/i.pan.mag()),o.center=this._map.transform.center,ro(o,r)}if(i.zoom){const e=so(i.zoom,n,to);o.zoom=this._map.transform.zoom+e.amount,ro(o,e)}if(i.bearing){const t=so(i.bearing,n,io);o.bearing=this._map.transform.bearing+e.clamp(t.amount,-179,179),ro(o,t)}if(i.pitch){const e=so(i.pitch,n,no);o.pitch=this._map.transform.pitch+e.amount,ro(o,e)}if(o.zoom||o.bearing){const e=void 0===i.pinchAround?i.around:i.pinchAround;o.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),o.noMoveStart=!0,o}}function ro(e,t){(!e.duration||e.durationi.unproject(e))),a=r.reduce(((e,t,i,n)=>e.add(t.div(n.length))),new e.Point(0,0));super(t,{points:r,point:a,lngLats:s,lngLat:i.unproject(a),originalEvent:n}),this._defaultPrevented=!1}}class co extends e.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){super(e,{originalEvent:i}),this._defaultPrevented=!1}}class uo{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){this._mousedownPos=void 0}wheel(e){return this._firePreventable(new co(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new ao(e.type,this._map,e))}mouseup(e){this._map.fire(new ao(e.type,this._map,e))}preclick(t){const i=e.extend({},t);i.type="preclick",this._map.fire(new ao(i.type,this._map,i))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||(this.preclick(e),this._map.fire(new ao(e.type,this._map,e)))}dblclick(e){return this._firePreventable(new ao(e.type,this._map,e))}mouseover(e){this._map.fire(new ao(e.type,this._map,e))}mouseout(e){this._map.fire(new ao(e.type,this._map,e))}touchstart(e){return this._firePreventable(new lo(e.type,this._map,e))}touchmove(e){this._map.fire(new lo(e.type,this._map,e))}touchend(e){this._map.fire(new lo(e.type,this._map,e))}touchcancel(e){this._map.fire(new lo(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ho{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(e){this._map.fire(new ao(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ao("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new ao(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class po{constructor(e,t){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(u(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;const i=t,n=this._startPos,o=this._lastPos;if(!n||!o||o.equals(i)||!this._box&&i.dist(n){this._box&&(this._box.style.transform=`translate(${s}px,${l}px)`,this._box.style.width=a-s+"px",this._box.style.height=c-l+"px")}))}mouseupWindow(t,i){if(!this._active)return;const n=this._startPos,o=i;if(n&&0===t.button){if(this.reset(),p(),n.x!==o.x||n.y!==o.y)return this._map.fire(new e.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:e=>e.fitScreenCoordinates(n,o,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),d(),delete this._startPos,delete this._lastPos}_fireEvent(t,i){return this._map.fire(new e.Event(t,{originalEvent:i}))}}function mo(e,t){const i={};for(let n=0;nthis.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=t.timeStamp),n.length===this.numTouches&&(this.centroid=function(t){const i=new e.Point(0,0);for(const e of t)i._add(e);return i.div(t.length)}(i),this.touches=mo(n,i)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;const n=mo(i,t);for(const e in this.touches){const t=n[e];(!t||t.dist(this.touches[e])>30)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class go{constructor(e){this.singleTap=new fo(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){const n=this.singleTap.touchend(e,t,i);if(n){const t=e.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(n)<30;if(t&&i||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}}class _o{constructor(){this._zoomIn=new go({numTouches:1,numTaps:2}),this._zoomOut=new go({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){const n=this._zoomIn.touchend(e,t,i),o=this._zoomOut.touchend(e,t,i);return n?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()+1,around:t.unproject(n)},{originalEvent:e})}):o?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()-1,around:t.unproject(o)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const yo={0:1,2:2};class bo{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(e,t){return!1}_move(e,t){return{}}mousedown(e,t){if(this._lastPoint)return;const i=g(e);this._correctButton(e,i)&&(this._lastPoint=t,this._eventButton=i)}mousemoveWindow(e,t){const i=this._lastPoint;if(i)if(e.preventDefault(),null!=this._eventButton&&function(e,t){const i=yo[t];return void 0===e.buttons||(e.buttons&i)!==i}(e,this._eventButton))this.reset();else if(this._moved||!(t.dist(i)0&&(this._active=!0);const o=mo(n,i),r=new e.Point(0,0),s=new e.Point(0,0);let a=0;for(const e in o){const t=o[e],i=this._touches[e];i&&(r._add(t),s._add(t.sub(i)),a++,o[e]=t)}if(this._touches=o,a{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","null")}),500)}}class Mo{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(e){}_move(e,t,i){return{}}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){const n=this._firstTwoTouches;if(!n)return;e.preventDefault();const[o,r]=n,s=To(i,t,o),a=To(i,t,r);if(!s||!a)return;const l=this._aroundCenter?null:s.add(a).div(2);return this._move([s,a],l,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;const[n,o]=this._firstTwoTouches,r=To(i,t,n),s=To(i,t,o);r&&s||(this._active&&p(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function To(e,t,i){for(let n=0;nMath.abs(e.x)}class Io extends Mo{constructor(e){super(),this._map=e}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(e){this._lastPoints=e,Ao(e[0].sub(e[1]))&&(this._valid=!1)}_move(t,i,n){const o=this._lastPoints;if(!o)return;const r=t[0].sub(o[0]),s=t[1].sub(o[1]);return this._map._cooperativeGestures&&!e.isFullscreen()&&n.touches.length<3||(this._valid=this.gestureBeginsVertically(r,s,n.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(r.y+s.y)/2*-.5})}gestureBeginsVertically(e,t,i){if(void 0!==this._valid)return this._valid;const n=e.mag()>=2,o=t.mag()>=2;if(!n&&!o)return;if(!n||!o)return null==this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const r=e.y>0==t.y>0;return Ao(e)&&Ao(t)&&r}}const Do={panStep:100,bearingStep:15,pitchStep:10};class zo{constructor(){const e=Do;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,n=0,o=0,r=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),o=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),o=1);break;case 38:e.shiftKey?n=1:(e.preventDefault(),r=-1);break;case 40:e.shiftKey?n=-1:(e.preventDefault(),r=1);break;default:return}return this._rotationDisabled&&(i=0,n=0),{cameraAnimation:s=>{const a=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:Po,zoom:t?Math.round(a)+t*(e.shiftKey?2:1):a,bearing:s.getBearing()+i*this._bearingStep,pitch:s.getPitch()+n*this._pitchStep,offset:[-o*this._panStep,-r*this._panStep],center:s.getCenter()},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Po(e){return e*(2-e)}const Oo=4.000244140625;class Bo{constructor(t,i){this._map=t,this._el=t.getCanvasContainer(),this._handler=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,e.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||e.isFullscreen()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let i=t.deltaMode===e.window.WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const n=e.exported.now(),o=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==i&&i%Oo==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":o>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(o*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),t.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=t,this._delta-=i,this._active||this._start(t)),t.preventDefault()}_onTimeout(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const t=m(this._el,e);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:t,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._map.transform;"wheel"===this._type&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const i=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(0!==this._delta){const e="wheel"===this._type&&Math.abs(this._delta)>Oo?this._wheelZoomRate:this._defaultZoomRate;let n=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==n&&(n=1/n);const o=i(),r=Math.pow(2,o),s="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):r;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(s*n))),"wheel"===this._type&&(this._startZoom=o,this._easing=this._smoothOutEasing(200)),this._delta=0}const n="number"==typeof this._targetZoom?this._targetZoom:i(),o=this._startZoom,r=this._easing;let s,a=!1;if("wheel"===this._type&&o&&r){const t=Math.min((e.exported.now()-this._lastWheelEventTime)/200,1),i=r(t);s=e.number(o,n,i),t<1?this._frameId||(this._frameId=!0):a=!0}else s=n,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!a,zoomDelta:s-i(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let i=e.ease;if(this._prevEase){const t=this._prevEase,n=(e.exported.now()-t.start)/t.duration,o=t.easing(n+.01)-t.easing(n),r=.27/Math.sqrt(o*o+1e-4)*.01,s=Math.sqrt(.0729-r*r);i=e.bezier(r,s,.25,1)}return this._prevEase={start:e.exported.now(),duration:t,easing:i},i}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=r("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(e.window.navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout((()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","null")}),200)}}class jo{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Ro{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:i.getZoom()+(e.shiftKey?-1:1),around:i.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Fo{constructor(){this._tap=new go({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(e,t,i){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=t[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(e,t,i))}touchmove(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const n=t[0],o=n.y-this._swipePoint.y;return this._swipePoint=n,e.preventDefault(),this._active=!0,{zoomDelta:o/128}}}else this._tap.touchmove(e,t,i)}touchend(e,t,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(e,t,i)&&(this._tapTime=e.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class No{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Uo{constructor(e,t,i){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=t,this._mousePitch=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Vo{constructor(e,t,i,n){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const $o=e=>e.zoom||e.drag||e.pitch||e.rotate;class qo extends e.Event{}class Go{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,i){const n=e.sub([],i,t);this.radius=e.length(n[2]<0?e.div([],n,this.constants):[n[0],n[1],0])}projectRay(t){e.div(t,t,this.constants),e.normalize(t,t),e.mul$1(t,t,this.constants);const i=e.scale$2([],t,this.radius);if(i[2]>0){const t=e.scale$2([],[0,0,1],e.dot(i,[0,0,1])),n=e.scale$2([],e.normalize([],[i[0],i[1],0]),this.radius),o=e.add([],i,e.scale$2([],e.sub([],e.add([],n,t),i),2));i[0]=o[0],i[1]=o[1]}return i}}function Zo(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class Ho{constructor(t,i){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new oo(t),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Go,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(i),e.bindAll(["handleEvent","handleWindowEvent"],this);const n=this._el;this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[e.window.document,"mousemove",{capture:!0}],[e.window.document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[e.window,"blur",void 0]];for(const[t,i,n]of this._listeners)t.addEventListener(i,t===e.window.document?this.handleWindowEvent:this.handleEvent,n)}destroy(){for(const[t,i,n]of this._listeners)t.removeEventListener(i,t===e.window.document?this.handleWindowEvent:this.handleEvent,n)}_addDefaultHandlers(e){const t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new uo(t,e));const n=t.boxZoom=new po(t,e);this._add("boxZoom",n);const o=new _o,r=new Ro;t.doubleClickZoom=new jo(r,o),this._add("tapZoom",o),this._add("clickZoom",r);const s=new Fo;this._add("tapDragZoom",s);const a=t.touchPitch=new Io(t);this._add("touchPitch",a);const l=new vo(e),c=new wo(e);t.dragRotate=new Uo(e,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const u=new xo(e),d=new Eo(t,e);t.dragPan=new No(i,u,d),this._add("mousePan",u),this._add("touchPan",d,["touchZoom","touchRotate"]);const h=new Lo,p=new ko;t.touchZoomRotate=new Vo(i,p,h,s),this._add("touchRotate",h,["touchPan","touchZoom"]),this._add("touchZoom",p,["touchPan","touchRotate"]),this._add("blockableMapEvent",new ho(t));const m=t.scrollZoom=new Bo(t,this);this._add("scrollZoom",m,["mousePan"]);const f=t.keyboard=new zo;this._add("keyboard",f);for(const i of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])e.interactive&&e[i]&&t[i].enable(e[i])}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(const{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!$o(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(e,t,i){for(const n in e)if(n!==i&&(!t||t.indexOf(n)<0))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`)}_getMapTouches(e){const t=[];for(const i of e)this._el.contains(i.target)&&t.push(i);return t}handleEvent(e,t){this._updatingCamera=!0;const i="renderFrame"===e.type,n=i?void 0:e,o={needsRenderFrame:!1},r={},s={},a=e.touches?this._getMapTouches(e.touches):void 0,l=a?f(this._el,a):i?void 0:m(this._el,e);for(const{handlerName:i,handler:c,allowed:u}of this._handlers){if(!c.isEnabled())continue;let d;this._blockedByActive(s,u,i)?c.reset():c[t||e.type]&&(d=c[t||e.type](e,l,a),this.mergeHandlerResult(o,r,d,i,n),d&&d.needsRenderFrame&&this._triggerRenderFrame()),(d||c.isActive())&&(s[i]=c)}const c={};for(const e in this._previousActiveHandlers)s[e]||(c[e]=n);this._previousActiveHandlers=s,(Object.keys(c).length||Zo(o))&&(this._changes.push([o,r,c]),this._triggerRenderFrame()),(Object.keys(s).length||Zo(o))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:u}=o;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map))}mergeHandlerResult(t,i,n,o,r){if(!n)return;e.extend(t,n);const s={handlerName:o,originalEvent:n.originalEvent||r};void 0!==n.zoomDelta&&(i.zoom=s),void 0!==n.panDelta&&(i.drag=s),void 0!==n.pitchDelta&&(i.pitch=s),void 0!==n.bearingDelta&&(i.rotate=s)}_applyChanges(){const t={},i={},n={};for(const[o,r,s]of this._changes)o.panDelta&&(t.panDelta=(t.panDelta||new e.Point(0,0))._add(o.panDelta)),o.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+o.zoomDelta),o.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+o.bearingDelta),o.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+o.pitchDelta),void 0!==o.around&&(t.around=o.around),void 0!==o.aroundCoord&&(t.aroundCoord=o.aroundCoord),void 0!==o.pinchAround&&(t.pinchAround=o.pinchAround),o.noInertia&&(t.noInertia=o.noInertia),e.extend(i,r),e.extend(n,s);this._updateMapTransform(t,i,n),this._changes=[]}_updateMapTransform(t,i,n){const o=this._map,r=o.transform,s=e=>[e.x,e.y,e.z];if((()=>{const e=this._eventsInProgress.drag;return e&&!this._handlersById[e.handlerName].isActive()})()&&!Zo(t)){const e=r.zoom;r.cameraElevationReference="sea",r.recenterOnTerrain(),r.cameraElevationReference="ground",e!==r.zoom&&this._map._update(!0)}if(r._isCameraConstrained&&o._stop(!0),!Zo(t))return void this._fireEvents(i,n,!0);let{panDelta:a,zoomDelta:l,bearingDelta:c,pitchDelta:u,around:d,aroundCoord:h,pinchAround:p}=t;r._isCameraConstrained&&(l>0&&(l=0),r._isCameraConstrained=!1),void 0!==p&&(d=p),(l||(e=>i[e]&&!this._eventsInProgress[e])("drag"))&&d&&(this._dragOrigin=s(r.pointCoordinate3D(d)),this._trackingEllipsoid.setup(r._camera.position,this._dragOrigin)),r.cameraElevationReference="sea",o._stop(!0),d=d||o.transform.centerPoint,c&&(r.bearing+=c),u&&(r.pitch+=u),r._updateCameraState();const m=[0,0,0];if(a)if("mercator"===r.projection.name){const e=this._trackingEllipsoid.projectRay(r.screenPointToMercatorRay(d).dir),t=this._trackingEllipsoid.projectRay(r.screenPointToMercatorRay(d.sub(a)).dir);m[0]=t[0]-e[0],m[1]=t[1]-e[1]}else{const t=r.pointCoordinate(d);if("globe"===r.projection.name){a=a.rotate(-r.angle);const i=r._pixelsPerMercatorPixel/r.worldSize;m[0]=-a.x*e.mercatorScale(e.latFromMercatorY(t.y))*i,m[1]=-a.y*e.mercatorScale(r.center.lat)*i}else{const e=r.pointCoordinate(d.sub(a));t&&e&&(m[0]=e.x-t.x,m[1]=e.y-t.y)}}const f=r.zoom,g=[0,0,0];if(l){const t=s(h||r.pointCoordinate3D(d)),i={dir:e.normalize([],e.sub([],t,r._camera.position))};if(i.dir[2]<0){const n=r.zoomDeltaToMovement(t,l);e.scale$2(g,i.dir,n)}}const _=e.add(m,m,g);r._translateCameraConstrained(_),l&&Math.abs(r.zoom-f)>1e-4&&r.recenterOnTerrain(),r.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(i,n,!0)}_fireEvents(t,i,n){const o=$o(this._eventsInProgress),r=$o(t),s={};for(const e in t){const{originalEvent:i}=t[e];this._eventsInProgress[e]||(s[`${e}start`]=i),this._eventsInProgress[e]=t[e]}!o&&r&&this._fireEvent("movestart",r.originalEvent);for(const e in s)this._fireEvent(e,s[e]);r&&this._fireEvent("move",r.originalEvent);for(const e in t){const{originalEvent:i}=t[e];this._fireEvent(e,i)}const a={};let l;for(const e in this._eventsInProgress){const{handlerName:t,originalEvent:n}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],l=i[t]||n,a[`${e}end`]=l)}for(const e in a)this._fireEvent(e,a[e]);const c=$o(this._eventsInProgress);if(n&&(o||r)&&!c){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=e=>0!==e&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new qo("renderFrame",{timeStamp:e})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const Wo="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class Xo extends e.Evented{constructor(t,i){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=i.bearingSnap,this._respectPrefersReducedMotion=!1!==i.respectPrefersReducedMotion,e.bindAll(["_renderFrameCallback"],this)}getCenter(){return new e.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}panBy(t,i,n){return t=e.Point.convert(t).mult(-1),this.panTo(this.transform.center,e.extend({offset:t},i),n)}panTo(t,i,n){return this.easeTo(e.extend({center:t},i),n)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(t,i,n){return this.easeTo(e.extend({zoom:t},i),n)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(t,i,n){return this.easeTo(e.extend({bearing:t},i),n)}resetNorth(t,i){return this.rotateTo(0,e.extend({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo(e.extend({bearing:0,pitch:0,duration:1e3},t),i),this}snapToNorth(e,t){return Math.abs(this.getBearing())e.aspect?i/(2*Math.tan(.5*e.fovX)*e.aspect):n/(2*Math.tan(.5*e.fovY)*e.aspect)}_cameraForBoundsOnGlobe(t,i,n,o,r,s){const a=t.clone(),l=this._extendCameraOptions(s);a.bearing=o,a.pitch=r;const c=e.LngLat.convert(i),u=e.LngLat.convert(n),d=.5*(c.lat+u.lat),h=.5*(c.lng+u.lng),p=e.latLngToECEF(d,h),m=e.normalize([],p),f=e.normalize([],e.cross([],m,[0,1,0])),g=e.cross([],f,m),_=[f[0],f[1],f[2],0,g[0],g[1],g[2],0,m[0],m[1],m[2],0,0,0,0,1],y=[p,e.latLngToECEF(c.lat,c.lng),e.latLngToECEF(u.lat,c.lng),e.latLngToECEF(u.lat,u.lng),e.latLngToECEF(c.lat,u.lng),e.latLngToECEF(d,c.lng),e.latLngToECEF(d,u.lng),e.latLngToECEF(c.lat,h),e.latLngToECEF(u.lat,h)];let b=e.Aabb.fromPoints(y.map((t=>[e.dot(f,t),e.dot(g,t),e.dot(m,t)])));const x=e.transformMat4([],b.center,_);0===e.squaredLength(x)&&e.set(x,0,0,1),e.normalize(x,x),e.scale$2(x,x,e.GLOBE_RADIUS),a.center=e.ecefToLatLng(x);const v=a.getWorldToCameraMatrix(),w=e.invert(new Float64Array(16),v);b=e.Aabb.applyTransform(b,e.multiply([],v,_)),e.transformMat4(x,x,v);const E=.5*(b.max[2]-b.min[2]),M=this._minimumAABBFrustumDistance(a,b),T=e.scale$2([],[0,0,1],E),C=e.add(T,x,T),k=M+(0===a.pitch?0:e.distance(x,C)),S=a.globeCenterInViewSpace,L=e.sub([],x,[S[0],S[1],S[2]]);e.normalize(L,L),e.scale$2(L,L,k);const A=e.add([],x,L);e.transformMat4(A,A,w);const I=e.earthRadius/e.GLOBE_RADIUS,D=e.length(A),z=e.mercatorZfromAltitude(Math.max(D*I-e.earthRadius,Number.EPSILON),0),P=Math.min(a.zoomFromMercatorZAdjusted(z),l.maxZoom);return P>.5*(e.GLOBE_ZOOM_THRESHOLD_MIN+e.GLOBE_ZOOM_THRESHOLD_MAX)?(a.setProjection({name:"mercator"}),a.zoom=P,this._cameraForBounds(a,i,n,o,r,s)):{center:a.center,zoom:P,bearing:o,pitch:r}}queryTerrainElevation(t,i){const n=this.transform.elevation;return n?(i=e.extend({},{exaggerated:!0},i),n.getAtPoint(e.MercatorCoordinate.fromLngLat(t),null,i.exaggerated)):null}_cameraForBounds(t,i,n,o,r,s){if("globe"===t.projection.name)return this._cameraForBoundsOnGlobe(t,i,n,o,r,s);const a=t.clone(),l=this._extendCameraOptions(s),c=a.padding;a.bearing=o,a.pitch=r;const u=e.LngLat.convert(i),d=e.LngLat.convert(n),h=new e.LngLat(u.lng,d.lat),p=new e.LngLat(d.lng,u.lat),m=a.project(u),f=a.project(d),g=this.queryTerrainElevation(u),_=this.queryTerrainElevation(d),y=this.queryTerrainElevation(h),b=this.queryTerrainElevation(p),x=[[m.x,m.y,Math.min(g||0,_||0,y||0,b||0)],[f.x,f.y,Math.max(g||0,_||0,y||0,b||0)]];let v=e.Aabb.fromPoints(x);const w=a.getWorldToCameraMatrix(),E=e.invert(new Float64Array(16),w);v=e.Aabb.applyTransform(v,w);const M=e.sub([],v.max,v.min),T=c.left||0,C=c.right||0,k=c.bottom||0,S=c.top||0,{left:L,right:A,top:I,bottom:D}=l.padding,z=.5*(T+C),P=.5*(S+k),O=Math.min(a.scaleZoom(a.scale*Math.min((a.width-(T+C+L+A))/M[0],(a.height-(k+S+D+I))/M[1])),l.maxZoom),B=a.scale/a.zoomScale(O);v=new e.Aabb([v.min[0]-(L+z)*B,v.min[1]-(D+P)*B,v.min[2]],[v.max[0]+(A+z)*B,v.max[1]+(I+P)*B,v.max[2]]);const j=.5*M[2],R=this._minimumAABBFrustumDistance(a,v),F=[0,0,1,0];e.transformMat4$1(F,F,w),e.normalize$2(F,F);const N=e.scale$2([],F,R+j),U=e.add([],v.center,N),V=("number"==typeof l.offset.x&&"number"==typeof l.offset.y?new e.Point(l.offset.x,l.offset.y):e.Point.convert(l.offset)).rotate(-e.degToRad(o));v.center[0]-=V.x*B,v.center[1]+=V.y*B,e.transformMat4(v.center,v.center,E),e.transformMat4(U,U,E);const $=[v.center[0],v.center[1],U[2]*a.pixelsPerMeter];e.scale$2($,$,1/a.worldSize);const q=e.lngFromMercatorX($[0]),G=e.latFromMercatorY($[1]),Z=Math.min(a._zoomFromMercatorZ($[2]),l.maxZoom),H=new e.LngLat(q,G);return a.mercatorFromTransition&&Z<.5*(e.GLOBE_ZOOM_THRESHOLD_MIN+e.GLOBE_ZOOM_THRESHOLD_MAX)?(a.setProjection({name:"globe"}),a.zoom=Z,this._cameraForBounds(a,i,n,o,r,s)):{center:H,zoom:Z,bearing:o,pitch:r}}fitBounds(e,t,i){const n=this.cameraForBounds(e,t);return this._fitInternal(n,t,i)}fitScreenCoordinates(t,i,n,o,r){const s=e.Point.convert(t),a=e.Point.convert(i),l=new e.Point(Math.min(s.x,a.x),Math.min(s.y,a.y)),c=new e.Point(Math.max(s.x,a.x),Math.max(s.y,a.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(s,a))return this;const u=this.transform.pointLocation3D(l),d=this.transform.pointLocation3D(c),h=this.transform.pointLocation3D(new e.Point(l.x,c.y)),p=this.transform.pointLocation3D(new e.Point(c.x,l.y)),m=[Math.min(u.lng,d.lng,h.lng,p.lng),Math.min(u.lat,d.lat,h.lat,p.lat)],f=[Math.max(u.lng,d.lng,h.lng,p.lng),Math.max(u.lat,d.lat,h.lat,p.lat)],g=o&&o.pitch?o.pitch:this.getPitch(),_=this._cameraForBounds(this.transform,m,f,n,g,o);return this._fitInternal(_,o,r)}_fitInternal(t,i,n){return t?(delete(i=e.extend(t,i)).padding,i.linear?this.easeTo(i,n):this.flyTo(i,n)):this}jumpTo(t,i){this.stop();const n=t.preloadOnly?this.transform.clone():this.transform;let o=!1,r=!1,s=!1;return"zoom"in t&&n.zoom!==+t.zoom&&(o=!0,n.zoom=+t.zoom),void 0!==t.center&&(n.center=e.LngLat.convert(t.center)),"bearing"in t&&n.bearing!==+t.bearing&&(r=!0,n.bearing=+t.bearing),"pitch"in t&&n.pitch!==+t.pitch&&(s=!0,n.pitch=+t.pitch),null==t.padding||n.isPaddingEqual(t.padding)||(n.padding=t.padding),t.preloadOnly?(this._preloadTiles(n),this):(this.fire(new e.Event("movestart",i)).fire(new e.Event("move",i)),o&&this.fire(new e.Event("zoomstart",i)).fire(new e.Event("zoom",i)).fire(new e.Event("zoomend",i)),r&&this.fire(new e.Event("rotatestart",i)).fire(new e.Event("rotate",i)).fire(new e.Event("rotateend",i)),s&&this.fire(new e.Event("pitchstart",i)).fire(new e.Event("pitch",i)).fire(new e.Event("pitchend",i)),this.fire(new e.Event("moveend",i)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||e.warnOnce(Wo),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,i){const n=this.transform;if(!n.projection.supportsFreeCamera)return e.warnOnce(Wo),this;this.stop();const o=n.zoom,r=n.pitch,s=n.bearing;n.setFreeCameraOptions(t);const a=o!==n.zoom,l=r!==n.pitch,c=s!==n.bearing;return this.fire(new e.Event("movestart",i)).fire(new e.Event("move",i)),a&&this.fire(new e.Event("zoomstart",i)).fire(new e.Event("zoom",i)).fire(new e.Event("zoomend",i)),c&&this.fire(new e.Event("rotatestart",i)).fire(new e.Event("rotate",i)).fire(new e.Event("rotateend",i)),l&&this.fire(new e.Event("pitchstart",i)).fire(new e.Event("pitch",i)).fire(new e.Event("pitchend",i)),this.fire(new e.Event("moveend",i)),this}easeTo(t,i){this._stop(!1,t.easeId),(!1===(t=e.extend({offset:[0,0],duration:500,easing:e.ease},t)).animate||this._prefersReducedMotion(t))&&(t.duration=0);const n=this.transform,o=this.getZoom(),r=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in t?+t.zoom:o,c="bearing"in t?this._normalizeBearing(t.bearing,r):r,u="pitch"in t?+t.pitch:s,d="padding"in t?t.padding:n.padding,h=e.Point.convert(t.offset);let p,m,f;if("globe"===n.projection.name){const i=e.MercatorCoordinate.fromLngLat(n.center),o=h.rotate(-n.angle);i.x+=o.x/n.worldSize,i.y+=o.y/n.worldSize;const r=i.toLngLat(),s=e.LngLat.convert(t.center||r);this._normalizeCenter(s),p=n.centerPoint.add(o),m=new e.Point(i.x,i.y).mult(n.worldSize),f=new e.Point(e.mercatorXfromLng(s.lng),e.mercatorYfromLat(s.lat)).mult(n.worldSize).sub(m)}else{p=n.centerPoint.add(h);const i=n.pointLocation(p),o=e.LngLat.convert(t.center||i);this._normalizeCenter(o),m=n.project(i),f=n.project(o).sub(m)}const g=n.zoomScale(l-o);let _,y;t.around&&(_=e.LngLat.convert(t.around),y=n.locationPoint(_));const b=this._zooming||l!==o,x=this._rotating||r!==c,v=this._pitching||u!==s,w=!n.isPaddingEqual(d),E=n=>E=>{if(b&&(n.zoom=e.number(o,l,E)),x&&(n.bearing=e.number(r,c,E)),v&&(n.pitch=e.number(s,u,E)),w&&(n.interpolatePadding(a,d,E),p=n.centerPoint.add(h)),_)n.setLocationAtPoint(_,y);else{const e=n.zoomScale(n.zoom-o),t=l>o?Math.min(2,g):Math.max(.5,g),i=Math.pow(t,1-E),r=n.unproject(m.add(f.mult(E*i)).mult(e));n.setLocationAtPoint(n.renderWorldCopies?r.wrap():r,p)}return t.preloadOnly||this._fireMoveEvents(i),n};if(t.preloadOnly){const e=this._emulate(E,t.duration,n);return this._preloadTiles(e),this}const M={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=b,this._rotating=x,this._pitching=v,this._padding=w,this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,M),this._ease(E(n),(e=>{n.recenterOnTerrain(),this._afterEase(i,e)}),t),this}_prepareEase(t,i,n={}){this._moving=!0,this.transform.cameraElevationReference="sea",i||n.moving||this.fire(new e.Event("movestart",t)),this._zooming&&!n.zooming&&this.fire(new e.Event("zoomstart",t)),this._rotating&&!n.rotating&&this.fire(new e.Event("rotatestart",t)),this._pitching&&!n.pitching&&this.fire(new e.Event("pitchstart",t))}_fireMoveEvents(t){this.fire(new e.Event("move",t)),this._zooming&&this.fire(new e.Event("zoom",t)),this._rotating&&this.fire(new e.Event("rotate",t)),this._pitching&&this.fire(new e.Event("pitch",t))}_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const n=this._zooming,o=this._rotating,r=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new e.Event("zoomend",t)),o&&this.fire(new e.Event("rotateend",t)),r&&this.fire(new e.Event("pitchend",t)),this.fire(new e.Event("moveend",t))}flyTo(t,i){if(this._prefersReducedMotion(t)){const n=e.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(n,i)}this.stop(),t=e.extend({offset:[0,0],speed:1.2,curve:1.42,easing:e.ease},t);const n=this.transform,o=this.getZoom(),r=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in t?e.clamp(+t.zoom,n.minZoom,n.maxZoom):o,c="bearing"in t?this._normalizeBearing(t.bearing,r):r,u="pitch"in t?+t.pitch:s,d="padding"in t?t.padding:n.padding,h=n.zoomScale(l-o),p=e.Point.convert(t.offset);let m=n.centerPoint.add(p);const f=n.pointLocation(m),g=e.LngLat.convert(t.center||f);this._normalizeCenter(g);const _=n.project(f),y=n.project(g).sub(_);let b=t.curve;const x=Math.max(n.width,n.height),v=x/h,w=y.mag();if("minZoom"in t){const i=e.clamp(Math.min(t.minZoom,o,l),n.minZoom,n.maxZoom),r=x/n.zoomScale(i-o);b=Math.sqrt(r/w*2)}const E=b*b;function M(e){const t=(v*v-x*x+(e?-1:1)*E*E*w*w)/(2*(e?v:x)*E*w);return Math.log(Math.sqrt(t*t+1)-t)}function T(e){return(Math.exp(e)-Math.exp(-e))/2}function C(e){return(Math.exp(e)+Math.exp(-e))/2}const k=M(0);let S=function(e){return C(k)/C(k+b*e)},L=function(e){return x*((C(k)*(T(t=k+b*e)/C(t))-T(k))/E)/w;var t},A=(M(1)-k)/b;if(Math.abs(w)<1e-6||!isFinite(A)){if(Math.abs(x-v)<1e-6)return this.easeTo(t,i);const e=vt.maxDuration&&(t.duration=0);const I=r!==c,D=u!==s,z=!n.isPaddingEqual(d),P=n=>h=>{const f=h*A,b=1/S(f);n.zoom=1===h?l:o+n.scaleZoom(b),I&&(n.bearing=e.number(r,c,h)),D&&(n.pitch=e.number(s,u,h)),z&&(n.interpolatePadding(a,d,h),m=n.centerPoint.add(p));const x=1===h?g:n.unproject(_.add(y.mult(L(f))).mult(b));return n.setLocationAtPoint(n.renderWorldCopies?x.wrap():x,m),n._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(i),n};if(t.preloadOnly){const e=this._emulate(P,t.duration,n);return this._preloadTiles(e),this}return this._zooming=!0,this._rotating=I,this._pitching=D,this._padding=z,this._prepareEase(i,!1),this._ease(P(n),(()=>this._afterEase(i)),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const e=this._onEaseEnd;this._onEaseEnd=void 0,e.call(this,t)}if(!e){const e=this.handlers;e&&e.stop(!1)}return this}_ease(t,i,n){!1===n.animate||0===n.duration?(t(1),i()):(this._easeStart=e.exported.now(),this._easeOptions=n,this._onEaseFrame=t,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((e.exported.now()-this._easeStart)/this._easeOptions.duration,1),i=this._onEaseFrame;i&&i(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,i){t=e.wrap(t,-180,180);const n=Math.abs(t-i);return Math.abs(t-360-i)180?-360:i<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&e.exported.prefersReducedMotion&&!(t&&t.essential)}_emulate(e,t,i){const n=Math.ceil(15*t/1e3),o=[],r=e(i.clone());for(let e=0;e<=n;e++){const t=r(e/n);o.push(t.clone())}return o}}class Yo{constructor(t={}){this.options=t,e.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(e){const t=this.options&&this.options.compact;return this._map=e,this._container=r("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=r("button","mapboxgl-ctrl-attrib-button",this._container),r("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden","true"),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=r("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),t&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===t&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_setElementTitle(e,t){const i=this._map._getUIString(`AttributionControl.${t}`);e.setAttribute("aria-label",i),e.removeAttribute("title"),e.firstElementChild&&e.firstElementChild.setAttribute("title",i)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));const i=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||e.config.ACCESS_TOKEN}];if(t){const n=i.reduce(((e,t,n)=>(t.value&&(e+=`${t.key}=${t.value}${ne.length-t.length)),e=e.filter(((t,i)=>{for(let n=i+1;n=0)return!1;return!0})),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=[...this.options.customAttribution,...e]:e.unshift(this.options.customAttribution));const i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class Ko{constructor(){e.bindAll(["_updateLogo","_updateCompact"],this)}onAdd(e){this._map=e,this._container=r("div","mapboxgl-ctrl");const t=r("a","mapboxgl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://www.mapbox.com/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(e){e&&"metadata"!==e.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const e=this._map.style._sourceCaches;if(0===Object.entries(e).length)return!0;for(const t in e){const i=e[t].getSource();if(i.hasOwnProperty("mapbox_logo")&&!i.mapbox_logo)return!1}return!0}_updateCompact(){const e=this._container.children;if(e.length){const t=e[0];this._map.getCanvasContainer().offsetWidth<250?t.classList.add("mapboxgl-compact"):t.classList.remove("mapboxgl-compact")}}}class Qo{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){const t=this._currentlyRunning,i=t?this._queue.concat(t):this._queue;for(const t of i)if(t.id===e)return void(t.cancelled=!0)}run(e=0){const t=this._currentlyRunning=this._queue;this._queue=[];for(const i of t)if(!i.cancelled&&(i.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function Jo(t,i,n){if(t=new e.LngLat(t.lng,t.lat),i){const o=new e.LngLat(t.lng-360,t.lat),r=new e.LngLat(t.lng+360,t.lat),s=360*Math.ceil(Math.abs(t.lng-n.center.lng)/360),a=n.locationPoint(t).distSqr(i),l=i.x<0||i.y<0||i.x>n.width||i.y>n.height;n.locationPoint(o).distSqr(i)180;){const e=n.locationPoint(t);if(e.x>=0&&e.y>=0&&e.x<=n.width&&e.y<=n.height)break;t.lng>n.center.lng?t.lng-=360:t.lng+=360}return t}const er={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};class tr extends e.Evented{constructor(t,i){if(super(),(t instanceof e.window.HTMLElement||i)&&(t=e.extend({element:t},i)),e.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=t&&t.occludedOpacity||.2,t&&t.element)this._element=t.element,this._offset=e.Point.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=r("div");const i=41,n=27,o=s("svg",{display:"block",height:i*this._scale+"px",width:n*this._scale+"px",viewBox:`0 0 ${n} ${i}`},this._element),a=s("radialGradient",{id:"shadowGradient"},s("defs",{},o));s("stop",{offset:"10%","stop-opacity":.4},a),s("stop",{offset:"100%","stop-opacity":.05},a),s("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},o),s("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},o),s("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},o),s("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},o),this._offset=e.Point.convert(t&&t.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",(e=>{e.preventDefault()})),this._element.addEventListener("mousedown",(e=>{e.preventDefault()}));const n=this._element.classList;for(const e in er)n.remove(`mapboxgl-marker-anchor-${e}`);n.add(`mapboxgl-marker-anchor-${this._anchor}`),this._popup=null}addTo(e){return e===this._map||(this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._updateMoving),e.on("moveend",this._update),e.on("remove",this._clearFadeTimer),e._addMarker(this),this.setDraggable(this._draggable),this._update(),e.on("click",this._onMapClick)),this}remove(){const e=this._map;return e&&(e.off("click",this._onMapClick),e.off("move",this._updateMoving),e.off("moveend",this._update),e.off("mousedown",this._addDragHandler),e.off("touchstart",this._addDragHandler),e.off("mouseup",this._onUp),e.off("touchend",this._onUp),e.off("mousemove",this._onMove),e.off("touchmove",this._onMove),e.off("remove",this._clearFadeTimer),e._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const t=38.1,i=13.5,n=Math.sqrt(Math.pow(i,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-t],"bottom-left":[n,-1*(t-i+n)],"bottom-right":[-n,-1*(t-i+n)],left:[i,-1*(t-i)],right:[-i,-1*(t-i)]}:this._offset}this._popup=e,e._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(e){const t=e.code,i=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==i&&13!==i||this.togglePopup()}_onMapClick(e){const t=e.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const e=this._popup;return e?(e.isOpen()?(e.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(e.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const e=this._map,t=this._pos;if(!e||!t)return!1;const i=e.unproject(t),n=e.getFreeCameraOptions();if(!n.position)return!1;const o=n.position.toLngLat();return o.distanceTo(i)<.9*o.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const i=this._pos;if(!i||i.x<0||i.x>t.transform.width||i.y<0||i.y>t.transform.height)return void this._clearFadeTimer();const n=t.unproject(i);let o;t._showingGlobe()&&e.isLngLatBehindGlobe(t.transform,this._lngLat)?o=0:(o=1-t._queryFogOpacity(n),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(o*=this._occludedOpacity)),this._element.style.opacity=`${o}`,this._element.style.pointerEvents=o>0?"auto":"none",this._popup&&this._popup._setOpacity(o),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const e=this._pos;if(!e||!this._map)return;const t=this._offset.mult(this._scale);this._element.style.transform=`\n translate(${e.x}px,${e.y}px)\n ${er[this._anchor]}\n ${this._calculateXYTransform()} ${this._calculateZTransform()}\n translate(${t.x}px,${t.y}px)\n `}_calculateXYTransform(){const t=this._pos,i=this._map,n=this.getPitchAlignment();if(!i||!t||"map"!==n)return"";if(!i._showingGlobe()){const e=i.getPitch();return e?`rotateX(${e}deg)`:""}const o=e.radToDeg(e.globeTiltAtLngLat(i.transform,this._lngLat)),r=t.sub(e.globeCenterToScreenPoint(i.transform)),s=Math.abs(r.x)+Math.abs(r.y);if(0===s)return"";const a=o/s;return`rotateX(${-r.y*a}deg) rotateY(${r.x*a}deg)`}_calculateZTransform(){const t=this._pos,i=this._map;if(!i||!t)return"";let n=0;const o=this.getRotationAlignment();if("map"===o)if(i._showingGlobe()){const t=i.project(new e.LngLat(this._lngLat.lng,this._lngLat.lat+.001)),o=i.project(new e.LngLat(this._lngLat.lng,this._lngLat.lat-.001)).sub(t);n=e.radToDeg(Math.atan2(o.y,o.x))-90}else n=-i.getBearing();else if("horizon"===o){const o=e.smoothstep(4,6,i.getZoom()),r=e.globeCenterToScreenPoint(i.transform);r.y+=o*i.transform.height;const s=t.sub(r),a=e.radToDeg(Math.atan2(s.y,s.x));n=(a>90?a-270:a+90)*(1-o)}return n+=this._rotation,n?`rotateZ(${n}deg)`:""}_update(t){e.window.cancelAnimationFrame(this._updateFrameId);const i=this._map;i&&(i.transform.renderWorldCopies&&(this._lngLat=Jo(this._lngLat,this._pos,i.transform)),this._pos=i.project(this._lngLat),!0===t?this._updateFrameId=e.window.requestAnimationFrame((()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())})):this._pos=this._pos.round(),i._requestDomTask((()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(i._showingGlobe()||i.getTerrain()||i.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))})))}getOffset(){return this._offset}setOffset(t){return this._offset=e.Point.convert(t),this._update(),this}_onMove(t){const i=this._map;if(!i)return;const n=this._pointerdownPos,o=this._positionDelta;if(n&&o){if(!this._isDragging){const e=this._clickTolerance||i._clickTolerance;if(t.point.dist(n)=this._endTime)return this._end;const i=e.easeCubicInOut((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-i)+this._end*i}isEasing(e){return e>=this._startTime&&e<=this._endTime}jumpTo(e){this._startTime=-1/0,this._endTime=-1/0,this._start=e,this._end=e}easeTo(e,t,i){this._start=this.getValue(t),this._end=e,this._startTime=t,this._endTime=t+i}}const sr={"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","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},ar={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0},lr={showCompass:!0,showZoom:!0,visualizePitch:!1};class cr{constructor(t,i,n=!1){this._clickTolerance=10,this.element=i,this.mouseRotate=new vo({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,n&&(this.mousePitch=new wo({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),e.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),i.addEventListener("mousedown",this.mousedown),i.addEventListener("touchstart",this.touchstart,{passive:!1}),i.addEventListener("touchmove",this.touchmove),i.addEventListener("touchend",this.touchend),i.addEventListener("touchcancel",this.reset)}down(e,t){this.mouseRotate.mousedown(e,t),this.mousePitch&&this.mousePitch.mousedown(e,t),u()}move(e,t){const i=this.map,n=this.mouseRotate.mousemoveWindow(e,t),o=n&&n.bearingDelta;if(o&&i.setBearing(i.getBearing()+o),this.mousePitch){const n=this.mousePitch.mousemoveWindow(e,t),o=n&&n.pitchDelta;o&&i.setPitch(i.getPitch()+o)}}off(){const e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart,{passive:!1}),e.removeEventListener("touchmove",this.touchmove),e.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){d(),e.window.removeEventListener("mousemove",this.mousemove),e.window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(e.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),m(this.element,t)),e.window.addEventListener("mousemove",this.mousemove),e.window.addEventListener("mouseup",this.mouseup)}mousemove(e){this.move(e,m(this.element,e))}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}touchstart(e){1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=f(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos))}touchmove(e){1!==e.targetTouches.length?this.reset():(this._lastPos=f(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos))}touchend(e){0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=t.minPitch&&null!=t.maxPitch&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=t.minPitch&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=t.maxPitch&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(t.antialias&&e.isSafariWithAntialiasingBug(e.window)&&(t.antialias=!1,e.warnOnce("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new Xn(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),t),this._interactive=t.interactive,this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._antialias=t.antialias,this._useWebGL2=t.useWebGL2,this._trackResize=t.trackResize,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles,this._fadeDuration=t.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=t.crossSourceCollisions,this._collectResourceTiming=t.collectResourceTiming,this._optimizeForTerrain=t.optimizeForTerrain,this._language=this._parseLanguage(t.language),this._worldview=t.worldview,this._renderTaskQueue=new Qo,this._domRenderTaskQueue=new Qo,this._controls=[],this._markers=[],this._popups=[],this._mapId=e.uniqueId(),this._locale=e.extend({},sr,t.locale),this._clickTolerance=t.clickTolerance,this._cooperativeGestures=t.cooperativeGestures,this._performanceMetricsCollection=t.performanceMetricsCollection,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new rr(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._requestManager=new e.RequestManager(t.transformRequest,t.accessToken,t.testMode),this._silenceAuthErrors=!!t.testMode,"string"==typeof t.container){if(this._container=e.window.document.getElementById(t.container),!this._container)throw new Error(`Container '${t.container}' not found.`)}else{if(!(t.container instanceof e.window.HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(this._container.childNodes.length>0&&e.warnOnce("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),t.maxBounds&&this.setMaxBounds(t.maxBounds),e.bindAll(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)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))),void 0!==e.window&&(e.window.addEventListener("online",this._onWindowOnline,!1),e.window.addEventListener("resize",this._onWindowResize,!1),e.window.addEventListener("orientationchange",this._onWindowResize,!1),e.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1),e.window.addEventListener("visibilitychange",this._onVisibilityChange,!1)),this.handlers=new Ho(this,t),this._localFontFamily=t.localFontFamily,this._localIdeographFontFamily=t.localIdeographFontFamily,t.style&&this.setStyle(t.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),t.projection&&this.setProjection(t.projection),this._hash=t.hash&&new Kn("string"==typeof t.hash&&t.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,e.extend({},t.fitBoundsOptions,{duration:0})))),this.resize(),t.attributionControl&&this.addControl(new Yo({customAttribution:t.customAttribution})),this._logoControl=new Ko,this.addControl(this._logoControl,t.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)})),this.on("data",(t=>{this._update("style"===t.dataType),this.fire(new e.Event(`${t.dataType}data`,t))})),this.on("dataloading",(t=>{this.fire(new e.Event(`${t.dataType}dataloading`,t))}))}_getMapId(){return this._mapId}addControl(t,i){if(void 0===i&&(i=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=t.onAdd(this);this._controls.push(t);const o=this._controlPositions[i];return-1!==i.indexOf("bottom")?o.insertBefore(n,o.firstChild):o.appendChild(n),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(t){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const i=!this._moving;return i&&this.fire(new e.Event("movestart",t)).fire(new e.Event("move",t)),this.fire(new e.Event("resize",t)),i&&this.fire(new e.Event("moveend",t)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(t){return this.transform.setMaxBounds(e.LngLatBounds.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t?this.setZoom(t):this.fire(new e.Event("zoomstart")).fire(new e.Event("zoom")).fire(new e.Event("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t?this.setPitch(t):this.fire(new e.Event("pitchstart")).fire(new e.Event("pitch")).fire(new e.Event("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(t){return"auto"===t?e.window.navigator.language:Array.isArray(t)?0===t.length?void 0:t.map((t=>"auto"===t?e.window.navigator.language:t)):t}setLanguage(e){const t=this._parseLanguage(e);if(!this.style||t===this._language)return this;this._language=t,this.style._reloadSources();for(const e of this._controls)e._setLanguage&&e._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(e){return this.style&&e!==this._worldview?(this._worldview=e,this.style._reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(e){return this._lazyInitEmptyStyle(),e?"string"==typeof e&&(e={name:e}):e=null,this._useExplicitProjection=!!e,this._prioritizeAndUpdateProjection(e,this.style.stylesheet?this.style.stylesheet.projection:null)}_updateProjectionTransition(){if("globe"!==this.getProjection().name)return;const t=this.transform,i=t.projection.name;let n;"globe"===i&&t.zoom>=e.GLOBE_ZOOM_THRESHOLD_MAX?(t.setMercatorFromTransition(),n=!0):"mercator"===i&&t.zoom=e.GLOBE_ZOOM_THRESHOLD_MAX?this.transform.setMercatorFromTransition():this.transform.setProjection(t),this.style.applyProjectionUpdate(),i){this.painter.clearBackgroundTiles();for(const e in this.style._sourceCaches)this.style._sourceCaches[e].clearTiles();this._update(!0),this._forceMarkerAndPopupUpdate(!0)}return this}project(t){return this.transform.locationPoint3D(e.LngLat.convert(t))}unproject(t){return this.transform.pointLocation3D(e.Point.convert(t))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(e,t,i){if("mouseenter"===e||"mouseover"===e){let n=!1;const o=o=>{const r=t.filter((e=>this.getLayer(e))),s=r.length?this.queryRenderedFeatures(o.point,{layers:r}):[];s.length?n||(n=!0,i.call(this,new ao(e,this,o.originalEvent,{features:s}))):n=!1},r=()=>{n=!1};return{layers:new Set(t),listener:i,delegates:{mousemove:o,mouseout:r}}}if("mouseleave"===e||"mouseout"===e){let n=!1;const o=o=>{const r=t.filter((e=>this.getLayer(e)));(r.length?this.queryRenderedFeatures(o.point,{layers:r}):[]).length?n=!0:n&&(n=!1,i.call(this,new ao(e,this,o.originalEvent)))},r=t=>{n&&(n=!1,i.call(this,new ao(e,this,t.originalEvent)))};return{layers:new Set(t),listener:i,delegates:{mousemove:o,mouseout:r}}}{const n=e=>{const n=t.filter((e=>this.getLayer(e))),o=n.length?this.queryRenderedFeatures(e.point,{layers:n}):[];o.length&&(e.features=o,i.call(this,e),delete e.features)};return{layers:new Set(t),listener:i,delegates:{[e]:n}}}}on(e,t,i){if(void 0===i)return super.on(e,t);Array.isArray(t)||(t=[t]);const n=this._createDelegatedListener(e,t,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(n);for(const e in n.delegates)this.on(e,n.delegates[e]);return this}once(e,t,i){if(void 0===i)return super.once(e,t);Array.isArray(t)||(t=[t]);const n=this._createDelegatedListener(e,t,i);for(const e in n.delegates)this.once(e,n.delegates[e]);return this}off(e,t,i){if(void 0===i)return super.off(e,t);t=new Set(Array.isArray(t)?t:[t]);const n=(e,t)=>{if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0},o=this._delegatedListeners?this._delegatedListeners[e]:void 0;return o&&(e=>{for(let o=0;o{t?this.fire(new e.ErrorEvent(t)):n&&this._updateDiff(n,i)}))}else"object"==typeof t&&this._updateDiff(t,i)}_updateDiff(t,i){try{this.style.setState(t)&&this._update(!0)}catch(n){e.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(t,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(e.warnOnce("There is no style added to the map."),!1)}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){return!!this.style&&this.style._isSourceCacheLoaded(e)}areTilesLoaded(){const e=this.style&&this.style._sourceCaches;for(const t in e){const i=e[t]._tiles;for(const e in i){const t=i[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}}return!0}addSourceType(e,t,i){this._lazyInitEmptyStyle(),this.style.addSourceType(e,t,i)}removeSource(e){return this.style.removeSource(e),this._updateTerrain(),this._update(!0)}getSource(e){return this.style.getSource(e)}addImage(t,i,{pixelRatio:n=1,sdf:o=!1,stretchX:r,stretchY:s,content:a}={}){if(this._lazyInitEmptyStyle(),i instanceof e.window.HTMLImageElement||e.window.ImageBitmap&&i instanceof e.window.ImageBitmap){const{width:l,height:c,data:u}=e.exported.getImageData(i);this.style.addImage(t,{data:new e.RGBAImage({width:l,height:c},u),pixelRatio:n,stretchX:r,stretchY:s,content:a,sdf:o,version:0})}else if(void 0===i.width||void 0===i.height)this.fire(new e.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`")));else{const{width:l,height:c}=i,u=i;this.style.addImage(t,{data:new e.RGBAImage({width:l,height:c},new Uint8Array(u.data)),pixelRatio:n,stretchX:r,stretchY:s,content:a,sdf:o,version:0,userImage:u}),u.onAdd&&u.onAdd(this,t)}}updateImage(t,i){const n=this.style.getImage(t);if(!n)return void this.fire(new e.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const o=i instanceof e.window.HTMLImageElement||e.window.ImageBitmap&&i instanceof e.window.ImageBitmap?e.exported.getImageData(i):i,{width:r,height:s}=o;void 0!==r&&void 0!==s?r===n.data.width&&s===n.data.height?(n.data.replace(o.data,!(i instanceof e.window.HTMLImageElement||e.window.ImageBitmap&&i instanceof e.window.ImageBitmap)),this.style.updateImage(t,n)):this.fire(new e.ErrorEvent(new Error(`The width and height of the updated image (${r}, ${s})\n must be that same as the previous version of the image\n (${n.data.width}, ${n.data.height})`))):this.fire(new e.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`")))}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new e.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(t,i){e.getImage(this._requestManager.transformRequest(t,e.ResourceType.Image),((t,n)=>{i(t,n instanceof e.window.HTMLImageElement?e.exported.getImageData(n):n)}))}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}setLayerZoomRange(e,t,i){return this.style.setLayerZoomRange(e,t,i),this._update(!0)}setFilter(e,t,i={}){return this.style.setFilter(e,t,i),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,i,n={}){return this.style.setPaintProperty(e,t,i,n),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,i,n={}){return this.style.setLayoutProperty(e,t,i,n),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(e){return this._lazyInitEmptyStyle(),!e&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(e),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(e){return this._lazyInitEmptyStyle(),this.style.setFog(e),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(t){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(e.LngLat.convert(t),this.transform):0}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}_updateContainerDimensions(){if(!this._container)return;const t=this._container.getBoundingClientRect().width||400,i=this._container.getBoundingClientRect().height||300;let n,o,r,s=this._container;for(;s&&(!o||!r);){const t=e.window.getComputedStyle(s).transform;t&&"none"!==t&&(n=t.match(/matrix.*\((.+)\)/)[1].split(", "),n[0]&&"0"!==n[0]&&"1"!==n[0]&&(o=n[0]),n[3]&&"0"!==n[3]&&"1"!==n[3]&&(r=n[3])),s=s.parentElement}this._containerWidth=o?Math.abs(t/o):t,this._containerHeight=r?Math.abs(i/r):i}_detectMissingCSS(){"rgb(250, 128, 114)"!==e.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&e.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const e=this._container;e.classList.add("mapboxgl-map"),(this._missingCSSCanary=r("div","mapboxgl-canary",e)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=r("div","mapboxgl-canvas-container",e);this._interactive&&t.classList.add("mapboxgl-interactive"),this._canvas=r("canvas","mapboxgl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const i=this._controlContainer=r("div","mapboxgl-control-container",e),n=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((e=>{n[e]=r("div",`mapboxgl-ctrl-${e}`,i)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,i){const n=e.exported.devicePixelRatio||1;this._canvas.width=n*Math.ceil(t),this._canvas.height=n*Math.ceil(i),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${i}px`}_addMarker(e){this._markers.push(e)}_removeMarker(e){const t=this._markers.indexOf(e);-1!==t&&this._markers.splice(t,1)}_addPopup(e){this._popups.push(e)}_removePopup(e){const t=this._popups.indexOf(e);-1!==t&&this._popups.splice(t,1)}_setupPainter(){const t=e.extend({},i.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),n=this._useWebGL2&&this._canvas.getContext("webgl2",t),o=n||this._canvas.getContext("webgl",t)||this._canvas.getContext("experimental-webgl",t);o?(this._useWebGL2&&!n&&e.warnOnce("Failed to create WebGL 2 context. Using WebGL 1."),e.storeAuthState(o,!0),this.painter=new Bn(o,this.transform,!!n),this.on("data",(e=>{"source"===e.dataType&&this.painter.setTileLoadedFlag(!0)})),e.exported$1.testSupport(o)):this.fire(new e.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(t){t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.Event("webglcontextlost",{originalEvent:t}))}_contextRestored(t){this._setupPainter(),this.resize(),this._update(),this.fire(new e.Event("webglcontextrestored",{originalEvent:t}))}_onMapScroll(e){if(e.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(e){return this.style?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_requestDomTask(e){!this.loaded()||this.loaded()&&!this.isMoving()?e():this._domRenderTaskQueue.add(e)}_render(t){let i;const n=this.painter.context.extTimerQuery,o=e.exported.now();if(this.listens("gpu-timing-frame")&&(i=n.createQueryEXT(),n.beginQueryEXT(n.TIME_ELAPSED_EXT,i)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],e.window.performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],e.window.performance.now())),this._renderTaskQueue.run(t),this._domRenderTaskQueue.run(t),this._removed)return;this._updateProjectionTransition();const r=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,i=this.transform.pitch,n=e.exported.now(),o=new e.EvaluationParameters(t,{now:n,fadeDuration:r,pitch:i,transition:this.style.getTransition()});this.style.update(o)}this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let s=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),s=this._updateAverageElevation(o),this.style._updateSources(this.transform),this._forceMarkerAndPopupUpdate()):s=this._updateAverageElevation(o),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,r,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:r,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new e.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new e.Event("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),i){const t=e.exported.now()-o;n.endQueryEXT(n.TIME_ELAPSED_EXT,i),setTimeout((()=>{const r=n.getQueryObjectEXT(i,n.QUERY_RESULT_EXT)/1e6;n.deleteQueryEXT(i),this.fire(new e.Event("gpu-timing-frame",{cpuTime:t,gpuTime:r})),e.window.performance.mark("frame-gpu",{startTime:o,detail:{gpuTime:r}})}),50)}if(this.listens("gpu-timing-layer")){const t=this.painter.collectGpuTimers();setTimeout((()=>{const i=this.painter.queryGpuTimers(t);this.fire(new e.Event("gpu-timing-layer",{layerTimes:i}))}),50)}if(this.listens("gpu-timing-deferred-render")){const t=this.painter.collectDeferredRenderGpuQueries();setTimeout((()=>{const i=this.painter.queryGpuTimeDeferredRender(t);this.fire(new e.Event("gpu-timing-deferred-render",{gpuTime:i}))}),50)}const a=this._sourcesDirty||this._styleDirty||this._placementDirty||s;if(a||this._repaint)this.triggerRepaint();else{const t=!this.isMoving()&&this.loaded();if(t&&(s=this._updateAverageElevation(o,!0)),s)this.triggerRepaint();else if(this._triggerFrame(!1),t&&(this.fire(new e.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const t=this._calculateSpeedIndex();this.fire(new e.Event("speedindexcompleted",{speedIndex:t})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||a||(this._fullyLoaded=!0,e.LivePerformanceUtils.mark(e.PerformanceMarkers.fullLoad),this._performanceMetricsCollection&&e.postPerformanceEvent(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(e){for(const t of this._markers)e&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!e||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(e,t=!1){const i=e=>(this.transform.averageElevation=e,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&i(0);if((t||e-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(e)){const t=this.transform.averageElevation;let n=this.transform.sampleAverageElevation(),o=!1;this.transform.elevation&&(o=this.transform.elevation.exaggeration()!==this._averageElevationExaggeration,this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(n)?n=0:this._averageElevationLastSampledAt=e;const r=Math.abs(t-n);if(r>1){if(this._isInitialLoad||o)return this._averageElevation.jumpTo(n),i(n);this._averageElevation.easeTo(n,e,300)}else if(r>1e-4)return this._averageElevation.jumpTo(n),i(n)}return!!this._averageElevation.isEasing(e)&&i(this._averageElevation.getValue(e))}_authenticate(){e.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(t=>{if(t&&(t.message===e.AUTH_ERR_MSG||401===t.status)){const t=this.painter.context.gl;e.storeAuthState(t,!1),this._logoControl instanceof Ko&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new e.ErrorEvent(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}})),e.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(()=>{}))}_updateTerrain(){const e=this._isDragging();this.painter.updateTerrain(this.style,e)}_calculateSpeedIndex(){const e=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const i=this.painter.context.gl,n=i.createFramebuffer();function o(e){i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0);const t=new Uint8Array(i.drawingBufferWidth*i.drawingBufferHeight*4);return i.readPixels(0,0,i.drawingBufferWidth,i.drawingBufferHeight,i.RGBA,i.UNSIGNED_BYTE,t),t}return i.bindFramebuffer(i.FRAMEBUFFER,n),this._canvasPixelComparison(o(e),t.canvasCopies.map(o),t.timeStamps)}_canvasPixelComparison(e,t,i){let n=i[1]-i[0];const o=e.length/4;for(let r=0;r{const t=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,t&&this._render(e)})))}_preloadTiles(t){const i=this.style?Object.values(this.style._sourceCaches):[];return e.asyncAll(i,((e,i)=>e._preloadTiles(t,i)),(()=>{this.triggerRepaint()})),this}_onWindowOnline(){this._update()}_onWindowResize(e){this._trackResize&&this.resize({originalEvent:e})._update()}_onVisibilityChange(){"hidden"===e.window.document.visibilityState&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(e){this._showTerrainWireframe!==e&&(this._showTerrainWireframe=e,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(e){this._speedIndexTiming!==e&&(this._speedIndexTiming=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(e){this._showTileAABBs!==e&&(this._showTileAABBs=e,e&&this._update())}_setCacheLimits(t,i){e.setCacheLimits(t,i)}get version(){return e.version}},NavigationControl:class{constructor(t){this.options=e.extend({},lr,t),this._container=r("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this.options.showZoom&&(e.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",(e=>{this._map&&this._map.zoomIn({},{originalEvent:e})})),r("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",(e=>{this._map&&this._map.zoomOut({},{originalEvent:e})})),r("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(e.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",(e=>{const t=this._map;t&&(this.options.visualizePitch?t.resetNorthPitch({},{originalEvent:e}):t.resetNorth({},{originalEvent:e}))})),this._compassIcon=r("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const e=this._map;if(!e)return;const t=e.getZoom(),i=t===e.getMaxZoom(),n=t===e.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const e=this._map;if(!e)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(e.transform.pitch*(Math.PI/180)),.5)}) rotateX(${e.transform.pitch}deg) rotateZ(${e.transform.angle*(180/Math.PI)}deg)`:`rotate(${e.transform.angle*(180/Math.PI)}deg)`;e._requestDomTask((()=>{this._compassIcon&&(this._compassIcon.style.transform=t)}))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),e.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&e.on("pitch",this._rotateCompassArrow),e.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new cr(e,this._compass,this.options.visualizePitch)),this._container}onRemove(){const e=this._map;e&&(this._container.remove(),this.options.showZoom&&e.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&e.off("pitch",this._rotateCompassArrow),e.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(e,t){const i=r("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}_setButtonTitle(e,t){if(!this._map)return;const i=this._map._getUIString(`NavigationControl.${t}`);e.setAttribute("aria-label",i),e.firstElementChild&&e.firstElementChild.setAttribute("title",i)}},GeolocateControl:class extends e.Evented{constructor(t){super(),this.options=e.extend({geolocation:e.window.navigator.geolocation},ur,t),e.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=Yn(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(e){return this._map=e,this._container=r("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(t){const i=(e=!!this.options.geolocation)=>{this._supportsGeolocation=e,t(e)};void 0!==this._supportsGeolocation?t(this._supportsGeolocation):void 0!==e.window.navigator.permissions?e.window.navigator.permissions.query({name:"geolocation"}).then((e=>i("denied"!==e.state))).catch((()=>i())):i()}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),i=e.coords;return!!t&&(i.longitudet.getEast()||i.latitudet.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(t){if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.Event("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new e.Event("geolocate",t)),this._finish()}}_updateCamera(t){const i=new e.LngLat(t.coords.longitude,t.coords.latitude),n=t.coords.accuracy,o=this._map.getBearing(),r=e.extend({bearing:o},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(n),r,{geolocateSource:!0})}_updateMarker(t){if(t){const i=new e.LngLat(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const t=this._map.transform,i=e.mercatorZfromAltitude(1,t._center.lat)*t.worldSize,n=Math.ceil(2*this._accuracy*i);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._dotElement.classList.add("mapboxgl-user-location-show-heading")):(this._dotElement.classList.remove("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(t){if(this._map){if(this.options.trackUserLocation)if(1===t.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&this._noTimeout)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new e.Event("error",t)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(t){if(void 0!==this._map){if(this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this._geolocateButton=r("button","mapboxgl-ctrl-geolocate",this._container),r("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===t){e.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=r("div","mapboxgl-user-location"),this._dotElement.appendChild(r("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(r("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new tr({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=r("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new tr({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(t=>{t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||t.originalEvent&&"resize"===t.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new e.Event("trackuserlocationend")))}))}}_onDeviceOrientation(e){this._userLocationDotMarker&&(e.webkitCompassHeading?this._heading=e.webkitCompassHeading:!0===e.absolute&&(this._heading=-1*e.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return e.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 e.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new e.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(e={maximumAge:6e5,timeout:0},this._noTimeout=!0):(e=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,e),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const t=()=>{e.window.addEventListener("ondeviceorientationabsolute"in e.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientation)};void 0!==e.window.DeviceMotionEvent&&"function"==typeof e.window.DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((e=>{"granted"===e&&t()})).catch(console.error):t()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),e.window.removeEventListener("deviceorientation",this._onDeviceOrientation),e.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Yo,ScaleControl:class{constructor(t){this.options=e.extend({},dr,t),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch(e){return!1}}(),e.bindAll(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const e=this.options.maxWidth||100,t=this._map,i=t._containerHeight/2,n=t._containerWidth/2-e/2,o=t.unproject([n,i]),r=t.unproject([n+e,i]),s=o.distanceTo(r);if("imperial"===this.options.unit){const t=3.2808*s;t>5280?this._setScale(e,t/5280,"mile"):this._setScale(e,t,"foot")}else"nautical"===this.options.unit?this._setScale(e,s/1852,"nautical-mile"):s>=1e3?this._setScale(e,s/1e3,"kilometer"):this._setScale(e,s,"meter")}_setScale(e,t,i){this._map._requestDomTask((()=>{const n=function(e){const t=Math.pow(10,`${Math.floor(e)}`.length-1);let i=e/t;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(e){const t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(i),t*i}(t),o=n/t;this._container.innerHTML=this._isNumberFormatSupported&&"nautical-mile"!==i?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:i}).format(n):`${n} ${hr[i]}`,this._container.style.width=e*o+"px"}))}onAdd(e){return this._map=e,this._language=e.getLanguage(),this._container=r("div","mapboxgl-ctrl mapboxgl-ctrl-scale",e.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(e){this._language=e,this._update()}setUnit(e){this.options.unit=e,this._update()}},FullscreenControl:class{constructor(t){this._fullscreen=!1,t&&t.container&&(t.container instanceof e.window.HTMLElement?this._container=t.container:e.warnOnce("Full screen control 'container' must be a DOM element.")),e.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in e.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in e.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=r("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",e.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,e.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!e.window.document.fullscreenEnabled&&!e.window.document.webkitFullscreenEnabled)}_setupUI(){const t=this._fullscreenButton=r("button","mapboxgl-ctrl-fullscreen",this._controlContainer);r("span","mapboxgl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),e.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",e)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(e.window.document.fullscreenElement||e.window.document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?e.window.document.exitFullscreen?e.window.document.exitFullscreen():e.window.document.webkitCancelFullScreen&&e.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends e.Evented{constructor(t){super(),this.options=e.extend(Object.create(ir),t),e.bindAll(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(t&&t.className?t.className.trim().split(/\s+/):[])}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&t.on("preclick",this._onClose),this.options.closeOnMove&&t.on("move",this._onClose),t.on("remove",this.remove),this._update(),t._addPopup(this),this._focusFirstElement(),this._trackPointer?(t.on("mousemove",this._onMouseEvent),t.on("mouseup",this._onMouseEvent),t._canvasContainer.classList.add("mapboxgl-track-pointer")):t.on("move",this._update),this.fire(new e.Event("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const t=this._map;return t&&(t.off("move",this._update),t.off("move",this._onClose),t.off("preclick",this._onClose),t.off("click",this._onClose),t.off("remove",this.remove),t.off("mousemove",this._onMouseEvent),t.off("mouseup",this._onMouseEvent),t.off("drag",this._onMouseEvent),t._canvasContainer&&t._canvasContainer.classList.remove("mapboxgl-track-pointer"),t._removePopup(this),this._map=void 0),this.fire(new e.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(t){this._lngLat=e.LngLat.convert(t),this._pos=null,this._trackPointer=!1,this._update();const i=this._map;return i&&(i.on("move",this._update),i.off("mousemove",this._onMouseEvent),i._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const e=this._map;return e&&(e.off("move",this._update),e.on("mousemove",this._onMouseEvent),e.on("drag",this._onMouseEvent),e._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(e.window.document.createTextNode(t))}setHTML(t){const i=e.window.document.createDocumentFragment(),n=e.window.document.createElement("body");let o;for(n.innerHTML=t;o=n.firstChild,o;)i.appendChild(o);return this.setDOMContent(i)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=r("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(e),this.options.closeButton){const e=this._closeButton=r("button","mapboxgl-popup-close-button",t);e.type="button",e.setAttribute("aria-label","Close popup"),e.setAttribute("aria-hidden","true"),e.innerHTML="×",e.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(e){return this._classList.add(e),this._updateClassList(),this}removeClassName(e){return this._classList.delete(e),this._updateClassList(),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){let t;return this._classList.delete(e)?t=!1:(this._classList.add(e),t=!0),this._updateClassList(),t}_onMouseEvent(e){this._update(e.point)}_getAnchor(e){if(this.options.anchor)return this.options.anchor;const t=this._map,i=this._container,n=this._pos;if(!t||!i||!n)return"bottom";const o=i.offsetWidth,r=i.offsetHeight,s=n.xt.transform.width-o/2;if(n.y+et.transform.height-r){if(s)return"bottom-left";if(a)return"bottom-right"}return s?"left":a?"right":"bottom"}_updateClassList(){const e=this._container;if(!e)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),e.className=t.join(" ")}_update(t){const i=this._map,n=this._content;if(!i||!this._lngLat&&!this._trackPointer||!n)return;let o=this._container;if(o||(o=this._container=r("div","mapboxgl-popup",i.getContainer()),this._tip=r("div","mapboxgl-popup-tip",o),o.appendChild(n)),this.options.maxWidth&&o.style.maxWidth!==this.options.maxWidth&&(o.style.maxWidth=this.options.maxWidth),i.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Jo(this._lngLat,this._pos,i.transform)),!this._trackPointer||t){const e=this._pos=this._trackPointer&&t?t:i.project(this._lngLat),n=or(this.options.offset),o=this._anchor=this._getAnchor(n.y),r=or(this.options.offset,o),s=e.add(r).round();i._requestDomTask((()=>{this._container&&o&&(this._container.style.transform=`${er[o]} translate(${s.x}px,${s.y}px)`)}))}if(!this._marker&&i._showingGlobe()){const t=e.isLngLatBehindGlobe(i.transform,this._lngLat)?0:1;this._setOpacity(t)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(nr);e&&e.focus()}_onClose(){this.remove()}_setOpacity(e){this._container&&(this._container.style.opacity=`${e}`),this._content&&(this._content.style.pointerEvents=e?"auto":"none")}},Marker:tr,Style:Kt,LngLat:e.LngLat,LngLatBounds:e.LngLatBounds,Point:e.Point,MercatorCoordinate:e.MercatorCoordinate,FreeCameraOptions:Un,Evented:e.Evented,config:e.config,prewarm:function(){Fe().acquire(Be)},clearPrewarmedResources:function(){const e=Re;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(Be),Re=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return e.config.ACCESS_TOKEN},set accessToken(t){e.config.ACCESS_TOKEN=t},get baseApiUrl(){return e.config.API_URL},set baseApiUrl(t){e.config.API_URL=t},get workerCount(){return je.workerCount},set workerCount(e){je.workerCount=e},get maxParallelImageRequests(){return e.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){e.config.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(t){e.clearTileCache(t)},workerUrl:"",workerClass:null,setNow:e.exported.setNow,restoreNow:e.exported.restoreNow};return pr})),i}()},3306:(e,t,i)=>{"use strict";var n=i(5072),o=i.n(n),r=i(7825),s=i.n(r),a=i(7659),l=i.n(a),c=i(5056),u=i.n(c),d=i(540),h=i.n(d),p=i(1113),m=i.n(p),f=i(8713),g={};g.styleTagTransform=m(),g.setAttributes=u(),g.insert=l().bind(null,"head"),g.domAPI=s(),g.insertStyleElement=h(),o()(f.A,g),f.A&&f.A.locals&&f.A.locals},5072:e=>{"use strict";var t=[];function i(e){for(var i=-1,n=0;n{"use strict";var t={};e.exports=function(e,i){var n=function(e){if(void 0===t[e]){var i=document.querySelector(e);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}t[e]=i}return t[e]}(e);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(i)}},540:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},5056:(e,t,i)=>{"use strict";e.exports=function(e){var t=i.nc;t&&e.setAttribute("nonce",t)}},7825:e=>{"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(i){!function(e,t,i){var n="";i.supports&&(n+="@supports (".concat(i.supports,") {")),i.media&&(n+="@media ".concat(i.media," {"));var o=void 0!==i.layer;o&&(n+="@layer".concat(i.layer.length>0?" ".concat(i.layer):""," {")),n+=i.css,o&&(n+="}"),i.media&&(n+="}"),i.supports&&(n+="}");var r=i.sourceMap;r&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),t.styleTagTransform(n,e,t.options)}(t,e,i)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},1113:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},1929:function(e){var t;t=function(){var e="",t=/^([a-zA-Z]{2,3})(?:[_-]+([a-zA-Z]{3})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{4})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{2}|[0-9]{3})(?=$|[_-]+))?/;function i(e){return e.match(t)||[]}function n(t){return{language:(t=i(t))[1]||e,extlang:t[2]||e,script:t[3]||e,region:t[4]||e}}function o(e,t,i){Object.defineProperty(e,t,{value:i,enumerable:!0})}function r(t,r,s){function a(n){return i(n)[t]||e}o(a,"pattern",r),o(n,s,a)}return r(1,/^[a-zA-Z]{2,3}$/,"language"),r(2,/^[a-zA-Z]{3}$/,"extlang"),r(3,/^[a-zA-Z]{4}$/,"script"),r(4,/^[a-zA-Z]{2}$|^[0-9]{3}$/,"region"),o(n,"split",(function(e){return i(e).filter((function(e,t){return e&&t}))})),n},e.exports?e.exports=t():this.subtag=t()},3326:(e,t,i)=>{"use strict";var n=i(4866);e.exports=n,"undefined"!=typeof window&&(window.Suggestions=n)},1683:e=>{"use strict";var t=function(e){return this.component=e,this.items=[],this.active=0,this.wrapper=document.createElement("div"),this.wrapper.className="suggestions-wrapper",this.element=document.createElement("ul"),this.element.className="suggestions",this.wrapper.appendChild(this.element),this.selectingListItem=!1,e.el.parentNode.insertBefore(this.wrapper,e.el.nextSibling),this};t.prototype.show=function(){this.element.style.display="block"},t.prototype.hide=function(){this.element.style.display="none"},t.prototype.add=function(e){this.items.push(e)},t.prototype.clear=function(){this.items=[],this.active=0},t.prototype.isEmpty=function(){return!this.items.length},t.prototype.isVisible=function(){return"block"===this.element.style.display},t.prototype.draw=function(){if(this.element.innerHTML="",0!==this.items.length){for(var e=0;e{"use strict";var n=i(7510),o=i(4751),r=i(1683),s=function(e,t,i){return i=i||{},this.options=n({minLength:2,limit:5,filter:!0,hideOnBlur:!0},i),this.el=e,this.data=t||[],this.list=new r(this),this.query="",this.selected=null,this.list.draw(),this.el.addEventListener("keyup",function(e){this.handleKeyUp(e.keyCode)}.bind(this),!1),this.el.addEventListener("keydown",function(e){this.handleKeyDown(e)}.bind(this)),this.el.addEventListener("focus",function(){this.handleFocus()}.bind(this)),this.el.addEventListener("blur",function(){this.handleBlur()}.bind(this)),this.el.addEventListener("paste",function(e){this.handlePaste(e)}.bind(this)),this.render=this.options.render?this.options.render.bind(this):this.render.bind(this),this.getItemValue=this.options.getItemValue?this.options.getItemValue.bind(this):this.getItemValue.bind(this),this};s.prototype.handleKeyUp=function(e){40!==e&&38!==e&&27!==e&&13!==e&&9!==e&&this.handleInputChange(this.el.value)},s.prototype.handleKeyDown=function(e){switch(e.keyCode){case 13:case 9:this.list.isEmpty()||(this.list.isVisible()&&e.preventDefault(),this.value(this.list.items[this.list.active].original),this.list.hide());break;case 27:this.list.isEmpty()||this.list.hide();break;case 38:this.list.previous();break;case 40:this.list.next()}},s.prototype.handleBlur=function(){!this.list.selectingListItem&&this.options.hideOnBlur&&this.list.hide()},s.prototype.handlePaste=function(e){if(e.clipboardData)this.handleInputChange(e.clipboardData.getData("Text"));else{var t=this;setTimeout((function(){t.handleInputChange(e.target.value)}),100)}},s.prototype.handleInputChange=function(e){this.query=this.normalize(e),this.list.clear(),this.query.length-1},s.prototype.value=function(e){if(this.selected=e,this.el.value=this.getItemValue(e),document.createEvent){var t=document.createEvent("HTMLEvents");t.initEvent("change",!0,!1),this.el.dispatchEvent(t)}else this.el.fireEvent("onchange")},s.prototype.getCandidates=function(e){var t={pre:"",post:"",extract:function(e){return this.getItemValue(e)}.bind(this)};e(this.options.filter?o.filter(this.query,this.data,t).map(function(e){return{original:e.original,string:this.render(e.original,e.string)}}.bind(this)):this.data.map(function(e){return{original:e,string:this.render(e)}}.bind(this)))},s.prototype.getItemValue=function(e){return e},s.prototype.render=function(e,t){if(t)return t;for(var i=e.original?this.getItemValue(e.original):this.getItemValue(e),n=this.normalize(i),o=n.lastIndexOf(this.query);o>-1;){var r=o+this.query.length;i=i.slice(0,o)+""+i.slice(o,r)+""+i.slice(r),o=n.slice(0,o).lastIndexOf(this.query)}return i},s.prototype.renderError=function(e){this.list.drawError(e)},e.exports=s},8526:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AddEntryDialogBox=void 0;const n=i(5603),o=i(8449),r=i(8114),s=i(7422),a=i(8448),l=i(2427),c=i(2750);class u extends c.profile_dialog_box{_invariants;_communityKey;_callback;_dlgElem=document.getElementById("cbeb-add-entry-modal");_extraOkBtnElem=void 0;_extraCancelBtnElem=void 0;_containerElem=document.getElementById("cbeb-add-entry-modal-field-container");_spinnerElem=document.getElementById("cbeb-add-entry-spinner");_titleElem=document.getElementById("cbeb-addentry-dlg-title");_editCtrls=[];constructor(e,t,i){super(),this._invariants=e,this._communityKey=t,this._callback=i,n.DialogBoxMgr.registerDialogBox(this._dlgElem),this._titleElem.innerHTML=e.config.toolbarBtnLabel("add_entry")}addButtonsToBottomOf(e,t,i){const n=document.createElement("div");n.innerHTML='
'+t.toolbarBtnLabel("add_entry")+'
Cancel
',n.className="cbeb-extra-button-row",this._extraOkBtnElem=n.querySelector("#cbeb-extra-dlg-add-btn"),this._extraOkBtnElem.addEventListener("click",(()=>{this.onOK(i)})),this._extraCancelBtnElem=n.querySelector("#cbeb-extra-dlg-cancel-btn"),this._extraCancelBtnElem.addEventListener("click",(()=>{this._dlgElem.style.display="none"})),e.appendChild(n)}empty(e){for(;e.firstChild;)e.removeChild(e.firstChild)}populateFieldInput(e,t,i,n,o){const r=document.createElement("div");r.classList.add("cbeb-add-entry-error-msg"),e.appendChild(r),this._editCtrls=i.mapFields((e=>e)).sort(((e,t)=>e.rank(0,l.FieldEditCtrlFactory)(t,e,this._invariants,this._dlgElem))),this._editCtrls.forEach((t=>e.appendChild(t.inputHtmlElem()))),this._editCtrls.forEach((e=>e.post_dom_add()));const s=document.createElement("div");s.classList.add("cbeb-add-entry-error-msg"),e.appendChild(s)}add_prologue_to(e,t){const i=t.get_wording("add-profile-prologue");if(i.length>0){const t=document.createElement("p");t.setAttribute("add-profile-prologue",""),t.textContent=i,t.style.marginTop="17px",e.appendChild(t)}}showForBox(e){this._editCtrls=[];const t=new o.EntryWrapper({addedbyKey:"",boxKey:e.box,entryKey:"",value:{}});this.empty(this._containerElem),this.add_prologue_to(this._containerElem,e.config),this.populateFieldInput(this._containerElem,t,e.template,e.config,e.box),this.addButtonsToBottomOf(this._containerElem,e.config,e.template),n.DialogBoxMgr.hideAll(),this.showButtons(),r.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e.config}),this._spinnerElem.style.display="none",this._dlgElem.style.display="block",this._containerElem.style.display="block",this._containerElem.scrollTop=0}showButtons(){this._extraOkBtnElem&&(this._extraOkBtnElem.style.visibility="visible"),this._extraCancelBtnElem&&(this._extraCancelBtnElem.style.visibility="visible")}hideButtons(){this._extraOkBtnElem&&(this._extraOkBtnElem.style.visibility="hidden"),this._extraCancelBtnElem&&(this._extraCancelBtnElem.style.visibility="hidden")}spin(){this._containerElem.style.display="none",this._spinnerElem.style.display="block"}collectEntryData(){return this._editCtrls.reduce(((e,t)=>{const i=t.data();return void 0!==i&&(e[t.fieldKey]=i),e}),{})}onOK(e){const t=this.collectEntryData(),i=this._dlgElem.querySelector(".cbeb-modal-content");"some_fields_are_missing"!==this.handle_missing_fields(t,e,i)&&(this.hideButtons(),this.spin(),(0,s.PostRequest)({url:"/memberaddboxentry",payload:{payload:{boxID:this._invariants.directory,communityID:this._communityKey,entryData:t},auth:{authID:a.AuthCache.getAuth().authID,token:a.AuthCache.getAuth().token}},callback:{onResult:e=>{n.DialogBoxMgr.hideAll(),this._callback.onAdded({profile:e.entryID,values:t})},onFailure:e=>{n.DialogBoxMgr.hideAll(),console.error(e),this._callback.onFailure(e)}}}))}}t.AddEntryDialogBox=u},8448:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AuthCache=void 0;const n=i(7422);function o(e){for(var t=e+"=",i=decodeURIComponent(document.cookie).split(";"),n=0;n{t.hasOwnProperty("outcome")&&"ok"===t.outcome?e.yes(t.type):e.no()},onFailure:t=>{e.no()}}})}static getAuth(){return this._authID&&this._authToken?{authID:this._authID,token:this._authToken}:void 0}static getMemberKey(){return this._authID}static cacheAuthLocally(e){this._authID=e.member,this._authToken=e.token,document.cookie="member_identifier="+e.member+"; path=/; domain=.communitybox.co",document.cookie="member_identifier_dev="+e.member+"; path=/",document.cookie="auth_token="+e.token+"; path=/; domain=.communitybox.co",document.cookie="auth_token_dev="+e.token+"; path=/"}static eraseCookie=function(e){document.cookie=e+"=; Max-Age=-99999999; path=/; domain=.communitybox.co",document.cookie=e+"=; Max-Age=-99999999; path=/;"};static clearCredentials(){this._authID=void 0,this._authToken=void 0,["user_identifier","user_identifier_dev","member_identifier","member_identifier_dev","auth_token","auth_token_dev","member_email","member_email_dev"].forEach((e=>{this.eraseCookie(e)}))}}t.AuthCache=r},5123:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BoxCache=void 0;const n=i(8449),o=i(1165),r=i(1613),s=i(4745),a=i(7746);t.BoxCache=class{_currBoxKey;rawBox;_config;_locationKey=void 0;_lastEntryOnDisplay=0;_categoryKey=void 0;_entries=[];_entryDict={};_paginationLimit="none";_pre_filter=new Set;constructor(e,t,i,n,o){this._currBoxKey=e,this.rawBox=t,this._config=o,this._pre_filter=new Set(Array.from(i).map((e=>e.toLowerCase()))),this.addBoxContents(t,n)}get key(){return this._currBoxKey}setPaginationLimit(e){this._paginationLimit=e}resetPagination(){this._lastEntryOnDisplay=0}moreEntriesToShow(){return this._lastEntryOnDisplay{const n=e.getAnyKeyWithInputType("location-input");n&&i.hasValueForField(n)&&t(i)}))}getEntry(e){return this._entryDict.hasOwnProperty(e)?this._entries[this._entryDict[e]]:void 0}mostRecentOutOf(e,t){const i=e.getValueOf("date_modified")||e.getValueOf("date_added")||0;return(t.getValueOf("date_modified")||t.getValueOf("date_added")||0)-i}formattedDisplayNameFrom(e){if(void 0!==e)return"string"==typeof e?e.trim().toLowerCase():e.length>0?e[0].trim().toLowerCase():void 0}shuffle(e){for(let t=e.length-1;t>0;t--){const i=Math.floor(Math.random()*(t+1));[e[t],e[i]]=[e[i],e[t]]}}sortByRecency(e,t){"date_added"===t?e.sort(((e,t)=>{const i=e.getValueOf("date_added")||0;return(t.getValueOf("date_added")||0)-i})):e.sort(((e,t)=>{const i=e.getValueOf("date_modified")||e.getValueOf("date_added")||0;return(t.getValueOf("date_modified")||t.getValueOf("date_added")||0)-i}))}sortByField(e,t,i){const n=i.getField(t);null!=n&&e.sort(((e,t)=>{const i=e.getValueOf(n.key),o=t.getValueOf(n.key);if("string"!=typeof i&&i instanceof Array==0||"string"!=typeof o&&o instanceof Array==0)return 1;const r=this.formattedDisplayNameFrom(i),s=this.formattedDisplayNameFrom(o);return void 0===r&&void 0===s?this.mostRecentOutOf(e,t):void 0===r?1:void 0===s?-1:"numerical"===n.sortingTactic()?(0,a.NumericSort)(r,s):r.localeCompare(s)}))}reSort(e,t,i){const n=e.profiles;switch(t.directory_ordering.type){case"default":case"random":case"most-recent":{const i=n.filter((e=>!0===e.isFeatured())),o=n.filter((e=>!1===e.isFeatured()));"random"===t.directory_ordering.type?(this.shuffle(i),this.shuffle(o)):(this.sortByRecency(i),this.sortByRecency(o)),e.profiles=[...i,...o]}break;case"by-field":{const o=n.filter((e=>e.isFeatured())),r=n.filter((e=>!1===e.isFeatured())),s=t.directory_ordering.field;this.sortByField(o,s,i),this.sortByField(r,s,i),e.profiles=[...o,...r]}break;case"by-profile-picture-then-mr":case"by-profile-picture":{const o={featured:{profile_picture:n.filter((e=>!0===e.isFeatured()&&!0===e.hasValidProfilePicture(i))),no_profile_picture:n.filter((e=>!0===e.isFeatured()&&!1===e.hasValidProfilePicture(i)))},not_featured:{profile_picture:n.filter((e=>!1===e.isFeatured()&&!0===e.hasValidProfilePicture(i))),no_profile_picture:n.filter((e=>!1===e.isFeatured()&&!1===e.hasValidProfilePicture(i)))}};"by-profile-picture-then-mr"===t.directory_ordering.type?(this.sortByRecency(o.featured.profile_picture,"date_added"),this.sortByRecency(o.featured.no_profile_picture,"date_added"),this.sortByRecency(o.not_featured.profile_picture,"date_added"),this.sortByRecency(o.not_featured.no_profile_picture,"date_added")):(this.shuffle(o.featured.profile_picture),this.shuffle(o.featured.no_profile_picture),this.shuffle(o.not_featured.profile_picture),this.shuffle(o.not_featured.no_profile_picture)),e.profiles=[...o.featured.profile_picture,...o.featured.no_profile_picture,...o.not_featured.profile_picture,...o.not_featured.no_profile_picture]}}}reSortEntriesBy(e,t){const i={profiles:this._entries};this.reSort(i,e,t),this._entries=i.profiles,this._entryDict=this._entries.reduce(((e,t,i)=>(e[t.key]=i,e)),{})}static isValidDownloadedField(e){return!(null==e||"object"!=typeof e||!("ctrltype"in e)||!e.ctrltype||"string"!=typeof e.ctrltype)&&r.FieldCtrlTypeArray.includes(e.ctrltype)}static ebUnpackFormat3IfNecessary(e){if(e&&e.templateEntries&&1===e.templateEntries.length&&e.templateEntries[0].hasOwnProperty("elem")&&e.templateEntries[0].elem.hasOwnProperty("template_entryID")&&"format 3"===e.templateEntries[0].elem.template_entryID){const t=JSON.parse(e.templateEntries[0].elem.template_data);for(const i in t.fields){const n=t.fields[i];this.isValidDownloadedField(n)&&e.templateEntries.push({elem:{template_entryID:i,ui_rank:n.uiRank,field_ctrltype:n.ctrltype,overview_specialfield:n.specialField,required:n.required,field_label:n.label,editable_by:n.editable_by,field_choices:n.fieldChoices?n.fieldChoices:void 0,detail_label:n.detail_label?n.detail_label:void 0,visibility:n.visibility?n.visibility:void 0,multi_select:n.multi_select,searchable:n.searchable,placeholder:n.placeholder,sortingTactic:n.sortingTactic,tagDiscoverability:n.tagDiscoverability}})}t.hasOwnProperty("rules")&&("string"==typeof t.rules&&(t.rules=JSON.parse(t.rules)),e.templateEntries.push({elem:{rules:t.rules}})),t.cookiecutter&&(e.cookiecutter={css:t.cookiecutter.css,markup:t.cookiecutter.markup,"css-detail":t.cookiecutter["css-detail"],"markup-detail":t.cookiecutter["markup-detail"]})}}forEachEntryWithValueFor(e,t){this._entries.filter((t=>t.hasValueForFieldArray(e))).map((e=>t(e)))}addBoxContents(e,t){e.templateEntries.sort((function(e,t){return(e.elem.ui_rank?e.elem.ui_rank:0)-(t.elem.ui_rank?t.elem.ui_rank:0)})),e.templateEntries.forEach((e=>{"location-input"===e.elem.field_ctrltype&&(this._locationKey=e.elem.template_entryID),"category-input"===e.elem.field_ctrltype&&(this._categoryKey=e.elem.template_entryID)}));const i=e.entries.filter((e=>void 0!==e.value));if(i.forEach((e=>{if(this._categoryKey&&e.value.hasOwnProperty(this._categoryKey)&&"string"==typeof e.value[this._categoryKey]&&(e.value[this._categoryKey]=e.value[this._categoryKey].split(",")),this._locationKey&&e.value.hasOwnProperty(this._locationKey)){const t=e.value[this._locationKey];if("string"==typeof t)try{const i=t.replace(/\\\"/g,'"');e.value[this._locationKey]=JSON.parse(i)}catch(t){e.value[this._locationKey]=void 0}}})),this._entries=i.map((e=>new n.EntryWrapper({addedbyKey:e.addedbyID,boxKey:e.boxID,entryKey:e.entryID,moderation:e.moderation,value:e.value}))),this._pre_filter.size>0){const i=new o.TemplateWrapper(e.templateEntries,e.templateDefinition);t.clearAllFilters();const n=new Map(i.fieldsOfType("category-input").map((e=>[e.key,this._pre_filter])));t.updateCategoryFilter(n);const r=this._config.filter_config.tag_match;this._config.filter_config.tag_match="some",this._entries=this._entries.filter((e=>t.Filter(e,i)===s.FilterOutcome.Keep)),this._config.filter_config.tag_match=r}this._config.only_show_featured_profiles&&(this._entries=this._entries.filter((e=>e.isFeatured()))),this._entryDict=this._entries.reduce(((e,t,i)=>(e[t.key]=i,e)),{})}for_ever_profile_owned_by_member(e,t){this.for_every_profile((function(i){i.addedByKey===e&&t(i)}))}get nb_filter_results(){return"none"===this._paginationLimit?0:this._paginationLimit}AddProfile(e){this._entries.push(e),this._entryDict[e.key]=this._entries.length-1}getMorePaginatedEntries(e,t){for(;("none"===this._paginationLimit||this._lastEntryOnDisplay0;)t(this._entries[this._lastEntryOnDisplay]),e-=1,this._lastEntryOnDisplay=this._lastEntryOnDisplay+1}any_profile_fits_filter(e){for(const t of this._entries)if(e(t)===s.FilterOutcome.Keep)return!0;return!1}map(e){return this._entries.map((t=>e(t)))}mapFiltered(e){return this._entries.filter(((e,t)=>"number"==typeof this._paginationLimit&&te(t)))}for_every_profile(e){for(const t of this._entries)e(t)}nbEntriesInBox(){return this._entries.length}reflectFilterSettings(e,t,i){const n=this.splitProfilesBy(this._entries,e),o={profiles:n.keep};if(this.reSort(o,t.ordering,i),n.keep=o.profiles,!0===t.includeFeaturedProfilesInFilterResult){const e=this.splitProfilesBy(n.reject,(e=>e.isFeatured()?s.FilterOutcome.Keep:s.FilterOutcome.Discard));this.setPaginationLimit(n.keep.length+e.keep.length),this._entries=[...n.keep,...e.keep,...e.reject]}else this.setPaginationLimit(n.keep.length),this._entries=[...n.keep,...n.reject];this._entryDict=this._entries.reduce(((e,t,i)=>(e[t.key]=i,e)),{})}splitProfilesBy(e,t){const i=[],n=[];for(const o of e)t(o)===s.FilterOutcome.Keep?i.push(o):n.push(o);return{keep:i,reject:n}}}},512:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BoxConfigWrapper=void 0,t.BoxConfigWrapper=class{input_config;_localisation_dict={"saf-mobile-open-dlg-btn":"","saf-dlg-title":"Search & Filter","saf-text-label":"Text","saf-categories":"Categories","saf-freetext-label":"Search directory for mentions of:","saf-location":"Location","saf-placename":"Placename","saf-radius":"Range of search","launch-search-btn":"Search",recover_pw_title:"Recover password",recover_pw_greeting:"Please enter your email below to start the password recovery",okay_btn:"Okay",cancel_btn:"Cancel","email-placeholder":"e.g. member@example.com",send_recovery_link_btn:"Send recovery link",please_wait:"Please wait...",pw_recovery_email_sent:"A recovery link has been sent to your email account.",close:"Close","claim-profile-dlg-title":"Claim your profile","claim-profile-dlg-greeting":"Enter your email below to claim your profile!","claim-profile-dlg-congrat":"Check your email for a link to finish claiming the profile","claim-profile-ok-btn-label":"Send link",connect:"Connect","search-fail-ack":"Browse all profiles","search-fail-body":"No profiles matched your search","search-fail-title":"Search results","share-dlg-title":"Share profile","share-dlg-msg":"Press the button below to copy a shareable link for this profile to your clipboard.","share-dlg-link-copied":"Profile link copied to clipboard!","auth-type-fail-dlg-title":"Login type not allowed","auth-type-fail-dlg-msg":"No login detected, please log in to your membership account first.","auth-type-fail-dlg-btn":"Okay","add-profile-prologue":"","pfe-select-a-tag":"Select a tag","pfe-select-tags":"Select tag(s)","rp-successful-reset":"Your password was successfully reset.","show-more":"Show More","read-more":"Read more","saf-freetext-placeholder":"Search for..."};_enforce_federated_login=[];_overview_click_action="popup";_delinquent=!1;_filter_bar={desktop:[],mobile:[],design:{desktop:{internal_frame:"",external_frame:""},mobile:{internal_frame:"",external_frame:""}}};_sharing_url;_hidemap;_mapconfiguration="onToggle";_defaultProfilePicture;_hostedPageLogo;_bannerText;_matchmaking;_bespokeMatchMakeChoice;_matchmakeBespokeDestination;_hide_contact_details;_keep_hosted_banner_size;_isExample;_fontFamily;_loginMsg;_pagination={initial_count:15,showmore_count:15};_welcomeFlow="login-and-signup";_mapDesign={map_design:{appearance:"mapbox_colour",pin_click:"popup_single"},interaction:"standard",overridden:!1};_toolbarBtnConfig={search:{label:"Search",disposition:"show"},add_entry:{label:"Add entry",disposition:"show"},map_toggle:{label:"",disposition:"show"},edit_entry:{label:"Edit",disposition:"show"},account:{label:"Account",disposition:"show"},tag:{label:"Tags",disposition:"show"},ordering:{label:"Order by...",disposition:"show"}};_moderation="open";_fontWeight;_filter_config={tag_match:"some",respect_word_boundary:"yes"};_search_type="basic";_searchLayout={show_location_field:!0};_featured={text:"Featured",includeInFilterResult:!1,only_featured_by_default:!1};_uiElemList={button:{fgColour:"ffffff",bgColour:"1fca98",label:"Button"},social_media:{fgColour:"55606b",bgColour:"inherit",label:"Social media"},link:{fgColour:"77b3f4",bgColour:"inherit",label:"Link"},tag:{fgColour:"ffffff",bgColour:"55606b",label:"Tag"},dialog_title:{fgColour:"ffffff",bgColour:"77b3f4",label:"Dialog box"},profile_name:{fgColour:"5d257c",bgColour:"inherit",label:"Title"},label:{fgColour:"5d257c",bgColour:"inherit",label:"Label"},location_text:{fgColour:"5d257c",bgColour:"inherit",label:"Location"},paragraph:{fgColour:"000000",bgColour:"inherit",label:"Paragraph"},subtitle:{fgColour:"55606b",bgColour:"inherit",label:"Subtitle"},location:{fgColour:"55606b",bgColour:"inherit",label:"Location"},connect:{fgColour:"ffffff",bgColour:"55606b",label:"Connect"},tag_dlg_title:{fgColour:"inherit",bgColour:"inherit",label:"Filter"},tag_filter_prompt:{fgColour:"inherit",bgColour:"inherit",label:"search..."}};_link_behaviour="_blank";_overviewLocDisp="default";_phoneNbFormat="freeform";_profilePicAspect="circle";_upload_img="upload-image";_overviewDesign="default";_distanceUnit="mile";_orderingConfig={directory_ordering:{type:"most-recent"}};_postAddEntryFlow={title:"Entry submitted",text:"Your entry has been submitted, it will become visible once the directory owner has reviewed it.",redirect:void 0};_layout={};_toolbar_configuration="default";_location_search_placeholder="e.g. Vancouver, British Columbia";_connect_questionnaire=[{question:"Please enter your website",input_type:"one-line",key:"matchmaker-website"},{question:"Add a note",input_type:"paragraph",key:"note-for-connection"}];_connection_made_msg="Your connection request has been submitted.";_default_proximity_distance=5;login_type_allowed(e){return!(this._enforce_federated_login.length>0)||-1!==this._enforce_federated_login.indexOf(e)}overview_click_action(){return this._overview_click_action}delinquent(){return this._delinquent}connectQuestions(){return this._connect_questionnaire}override_layout(e){try{this._layout=JSON.parse(e),this.apply_palette_to_layout()}catch(e){console.error(e)}}override_filter_bar(e){this._filter_bar=e}override_map_and_loc_config(e){this._mapDesign=e,this._mapDesign.overridden=!0}get connection_made_msg(){return this._connection_made_msg}filter_bar_design(e){return this._filter_bar.design[e]}filter_bar_components(e){return this._filter_bar[e]}get upload_image(){return this._upload_img}get filter_config(){return this._filter_config}get toolbar_active(){return"none"!==this._toolbar_configuration}get postAddEntry(){return this._postAddEntryFlow}get default_proximity_distance(){return this._default_proximity_distance}get distanceUnit(){return this._distanceUnit}get overviewDesign(){return this._overviewDesign}get profilePictureAspect(){return this._profilePicAspect}get phoneNbFormat(){return this._phoneNbFormat}get overviewLocationDisplay(){return this._overviewLocDisp}get ignoreMemberspace(){return!0===this.input_config.settings.ignore_memberspace_context}get ordering(){return this._orderingConfig}get link_behaviour(){return this._link_behaviour}get initialEntryCount(){return this._pagination.initial_count}get showmoreEntryCount(){return this._pagination.showmore_count}maxNbBioChars(){return this.input_config.settings.maxNbBioSummaryChars||100}get welcomeFlow(){return this._welcomeFlow}get has_custom_pin_design(){return void 0!==this._mapDesign.map_design.pin_dictionary}get single_map_pin_should_popup(){return"popup_single"===this._mapDesign.map_design.pin_click||void 0===this._mapDesign.map_design.pin_click}mapDesign(){return this._mapDesign}pin_design_for(e){if(void 0!==this._mapDesign.map_design.pin_dictionary)for(const t of e)if(t in this._mapDesign.map_design.pin_dictionary)return this._mapDesign.map_design.pin_dictionary[t]}get loginMsg(){return this._loginMsg}set ordering(e){this._orderingConfig=e}get only_show_featured_profiles(){return this._featured.only_featured_by_default}get includeFeaturedProfilesInFilterResult(){return this._featured.includeInFilterResult}get featuredBannerText(){return this._featured.text}get fontFamily(){return this._fontFamily||"quicksand"}get fontWeight(){return this._fontWeight}get showLocationSearch(){return this._searchLayout.show_location_field}get location_search_placeholder(){return this._location_search_placeholder}get matchMakeDestinationChoice(){return this._bespokeMatchMakeChoice}get matchMakeBespokeDestination(){return this._matchmakeBespokeDestination}get bannerText(){return this._bannerText}get keepHostedBannerSize(){return void 0!==this._keep_hosted_banner_size&&"on"===this._keep_hosted_banner_size}get hostedPageLogo(){return this._hostedPageLogo}get isExampleBox(){return void 0!==this._isExample&&!0===this._isExample}get mapConfiguration(){return this._mapconfiguration}get hideMap(){return void 0!==this._hidemap&&"on"===this._hidemap}get searchType(){return this._search_type}get sharingUrl(){return this._sharing_url||""}get grayscaleMap(){return"mapbox_grayscale"===this._mapDesign.map_design.appearance}get matchMakingEnabled(){return void 0!==this._matchmaking&&"on"===this._matchmaking}get defaultProfilePictureKey(){return this._defaultProfilePicture}get isModerated(){return"moderated"===this._moderation}domainAllowed(e){if(void 0===this.input_config.allowedDomains||void 0===this.input_config.generation)return!0;{const t=[...this.input_config.allowedDomains.map((e=>e.replace(/http[s]?\:\/\//g,""))),"my.communitybox.co","squarespace.com","localhost","thinkific.com"];return console.log(t),t.some((t=>e.includes(t)))}}preFilterTagsForThisPage(e){const t=e.toLowerCase().split(/[\?|\#]/)[0].replace(/http[s]?:\/\//,"").replace(/\/$/,"");return this.input_config.pagesettings&&t in this.input_config.pagesettings?new Set(this.input_config.pagesettings[t].prefilterList):new Set}overrideButtonConfig(e){for(const t in this._toolbarBtnConfig)-1===e.indexOf(t)?this._toolbarBtnConfig[t].disposition="hide":this._toolbarBtnConfig[t].disposition="show"}get_wording(e){return this._localisation_dict[e]}hideToolbarBtn(e,t){switch(this._toolbarBtnConfig[e].disposition){case"show":return!1;case"hide":return!0;case"msp_only":return!1===t}return!1}toolbarBtnLabel(e){return this._toolbarBtnConfig[e].label}hideContactDetails(){return"on"===this._hide_contact_details}labelOf(e){return this._uiElemList[e].label}bgColourOf(e){return this._uiElemList[e].bgColour}fgColourOf(e){return this._uiElemList[e].fgColour}get_layout(e){return e.for_component in this._layout?this._layout[e.for_component]:void 0}memberspaceConfig(){return{restrictPopupToOnlyLoggedInMembers:!0===this.input_config.settings.integration?.msp?.restrictPopupToOnlyLoggedInMembers,ignore_memberspace_context:this.input_config.settings.ignore_memberspace_context}}constructor(e,t,i){if(this.input_config=e,this._uiElemList.button.bgColour=e.settings.colour.button,this._uiElemList.social_media.fgColour=e.settings.colour.social_media,this._uiElemList.link.fgColour=e.settings.colour.link,this._uiElemList.tag.bgColour=e.settings.colour.tags,this._uiElemList.tag.fgColour=e.settings.colour.tag_label,this._uiElemList.dialog_title.bgColour=e.settings.colour.dialog_title,this._uiElemList.profile_name.fgColour=e.settings.colour.profile_name,this._uiElemList.paragraph.fgColour=e.settings.colour.paragraph,this._uiElemList.subtitle.fgColour=e.settings.colour.businessname_text,this._uiElemList.connect.bgColour=e.settings.colour.connect_bkg,this._uiElemList.connect.fgColour=e.settings.colour.connect_fg,this._uiElemList.label.fgColour=e.settings.colour.label,this._uiElemList.location.fgColour=e.settings.colour.location_text,e.settings.colour.hasOwnProperty("button_label")&&(this._uiElemList.button.fgColour=e.settings.colour.button_label),e.settings.colour.hasOwnProperty("tag_label")&&(this._uiElemList.tag.fgColour=e.settings.colour.tag_label),e.settings.toolbar_btn_config){const t=e.settings.toolbar_btn_config;Object.keys(e.settings.toolbar_btn_config).forEach((e=>{this._toolbarBtnConfig[e]=t[e]}))}if(e.settings.search_layout){const t=e.settings.search_layout;Object.keys(e.settings.search_layout).forEach((e=>{this._searchLayout[e]=t[e]}))}void 0!==e.settings.ordering_config&&void 0!==e.settings.ordering_config.directory_ordering&&(this._orderingConfig.directory_ordering=e.settings.ordering_config.directory_ordering),e["link behaviour"]&&(this._link_behaviour=e["link behaviour"]["external links"]);const n={_moderation:"moderation",_postAddEntryFlow:"post_add_entry_flow",_welcomeFlow:"welcome_flow",_pagination:"pagination",_overviewLocDisp:"overview_loc_disp",_phoneNbFormat:"phone_nb_format",_profilePicAspect:"profile_img_aspect",_overviewDesign:"overview_design",_distanceUnit:"distance_unit",_sharing_url:"sharing_url",_hidemap:"hidemap",_mapconfiguration:"mapconfiguration",_defaultProfilePicture:"defaultProfilePicture",_hostedPageLogo:"hostedPageLogo",_bannerText:"bannerText",_matchmaking:"matchmaking",_hide_contact_details:"hide_contact_details",_keep_hosted_banner_size:"keep_hosted_banner_size",_isExample:"isExample",_search_type:"search_type",_bespokeMatchMakeChoice:"connection_destination_choice",_matchmakeBespokeDestination:"bespoke_connection_destination",_fontFamily:"font_family",_fontWeight:"font_weight",_toolbar_configuration:"toolbar_configuration",_location_search_placeholder:"location_search_placeholder",_upload_img:"upload_img",_add_profile_prologue:"add_profile_prologue",_default_proximity_distance:"default_proximity_distance",_filter_config:"filter_config",_connection_made_msg:"connection_made_msg",_overview_click_action:"overview_click_action",_enforce_federated_login:"enforce_federated_login"};if(void 0!==e.wording)for(const t in e.wording)this._localisation_dict[t]=e.wording[t];!0!==this._mapDesign.overridden&&void 0!==e.settings.map_design&&(this._mapDesign={map_design:e.settings.map_design,interaction:"standard"});for(const t in n)void 0!==e.settings[n[t]]&&(this[t]=e.settings[n[t]]);if("open"===this._moderation&&void 0===e.settings.post_add_entry_flow&&(this._postAddEntryFlow=void 0),void 0!==e.settings.connect_form)try{this._connect_questionnaire=e.settings.connect_form.questions}catch(e){console.error(e)}if(void 0!==e.settings.layout&&"string"==typeof e.settings.layout&&e.settings.layout.length>0)try{this._layout=JSON.parse(e.settings.layout)}catch(e){console.error(e)}const o=e.settings.filter_bar_components;o instanceof Array?this._filter_bar={desktop:o,mobile:o,design:{desktop:{internal_frame:"",external_frame:""},mobile:{internal_frame:"",external_frame:""}}}:o&&(this._filter_bar=o,void 0===this._filter_bar.design&&(this._filter_bar.design={desktop:{internal_frame:"",external_frame:""},mobile:{internal_frame:"",external_frame:""}})),void 0!==e.settings.featured_banner_text&&(this._featured.text=e.settings.featured_banner_text),void 0!==e.settings.include_featured_in_result&&(this._featured.includeInFilterResult=e.settings.include_featured_in_result),void 0!==e.settings.login_msg&&(this._loginMsg=0===e.settings.login_msg.length?void 0:e.settings.login_msg),this.apply_palette_to_layout(),i&&this.apply_overrides(t,i),this._delinquent=!0===e.delinquent}apply_palette_to_layout(){for(const e in this._layout){let t=JSON.stringify(this._layout[e]);t=this.apply_palette_to({palette:this._layout[e].palette,data:t}),t=this.apply_type_to({fonts:this._layout[e].font,data:t}),this._layout[e]=JSON.parse(t);for(const t in this._layout[e].patterns)void 0===this._layout[e].patterns[t].type&&(this._layout[e].patterns[t].type="default")}}apply_overrides(e,t){for(const i in e)switch(i){case"map_config":switch(e[i]){case"off":this._hidemap="on";break;case"toggle":this._mapconfiguration="onToggle";break;case"front_page":this._mapconfiguration="alwaysVisible"}break;case"featured-only":this._featured.only_featured_by_default=!0;break;case"name_clr":this._uiElemList.profile_name.fgColour=e[i].slice(1);break;case"subtitle_clr":this._uiElemList.subtitle.fgColour=e[i].slice(1);break;case"button_clr":this._uiElemList.button.bgColour=e[i].slice(1);break;case"tag_clr":this._uiElemList.tag.bgColour=e[i].slice(1);break;case"h_margin":t.style.marginRight=`${e[i]}px`,t.style.marginLeft=`${e[i]}px`;break;case"v_margin":t.style.marginTop=`${e[i]}px`,t.style.marginBottom=`${e[i]}px`;break;case"font_type":"theme"===e[i]?t.style.fontFamily="inherit":t.style.fontFamily="quicksand"}}apply_type_to(e){if(void 0===e.fonts)return e.data;for(const t in e.fonts){const i=new RegExp(`f_${t}_f`,"g");e.data=e.data.replace(i,`${e.fonts[t]}`)}return e.data}apply_palette_to(e){if(void 0===e.palette)return e.data;for(const t in e.palette){const i=new RegExp(`c_${t}_c`,"g");e.data=e.data.replace(i,`#${e.palette[t]}`)}return e.data}}},1447:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.category_edit_ctrl=void 0;const n=i(1165),o=i(1045),r=i(7746),s=i(3032),a=i(3622),l=i(6196);class c extends o.field_edit_ctrl{_entry;_field;_config;_launch_search;_chosenTags=[];data(){return this._chosenTags.join(",")}has_data(){return this._chosenTags.length>0}viewHtmlElem(){let e=this.leftOfViewRow()+'
'+(this._field.detail_label?`
${this._field.detail_label}
`:"")+'
"+this.rightOfViewRow();const t=s.div("",[]);t.innerHTML=e;const i=t.querySelector("[flexrow]");return(0,r.ExtractCategoryArrayFrom)(this._entry.getValueOf(this._field.key)).forEach((e=>{if(0===e.length)return;const t=e.replace(/&/g,"&"),n=s.div("nobreak",[],{text:t,classes:["cbeb-entry-tag","cbeb-detail-tag","cbeb-custom-clr-tag"],on_click:()=>{this._launch_search&&this._launch_search(new Map([[this._field.key,new Set([e])]]))}});n.setAttribute("category",this._field.label),n.setAttribute("tag",t),i.appendChild(n)})),t}buildTagWithDelete(e,t){const i=new a.Colour(this._config.fgColourOf("tag")||"ffffff");return s.div("tag-workbench",[s.p("tag-workbench-label",e,{design:`color: ${i.colourCode()};`}),s.button("svg flex","",(()=>{t(e)}),{svg:"bin",svgColour:i,svgDim:{width:new l.Measure(15,"px"),height:new l.Measure(15,"px")}})],{design:`background-color: ${this._config.bgColourOf("tag")};`})}handleTagDeletion(e,t){setTimeout((()=>{t.availableTags.push(e),t.availableTags=(0,r.SortTags)(t.availableTags,this._field),this._chosenTags=this._chosenTags.filter((t=>t!==e)),this.buildWorkbench(t)}))}buildTagWorkbench(e){return s.div("tag-workbench-frame",this._chosenTags.map((t=>this.buildTagWithDelete(t,(()=>{this.handleTagDeletion(t,e)})))))}buildTagSelectCtrl(e,t){const i=1===(0,n.MultiSelect)(this._field)?this._config.get_wording("pfe-select-a-tag"):this._config.get_wording("pfe-select-tags"),o=1===(0,n.MultiSelect)(this._field)&&this._chosenTags.length>0?this._chosenTags[0]:void 0,r=s.select("tag-workbench-select-ctrl",e.map((e=>({value:e,label:e}))),{on_selection_change:e=>{e&&t(e)},placeholder:i,default:o});return 1===(0,n.MultiSelect)(this._field)?r:s.div("flex row",[r],{design:"column-gap: 7px"})}removeChosenTagsFrom(e){return e.filter((e=>!1===this._chosenTags.includes(e)))}onTagSelection(e,t,i){if(i.container.parentElement?.removeAttribute("missing_required_field"),1!==(0,n.MultiSelect)(this._field)){const o=(0,n.MultiSelect)(this._field);if("number"==typeof o&&this._chosenTags.length>=o)return s.remove_all_child_elements_from(t),void t.appendChild(s.p("tag-workbench-error-msg",`You may select at most ${o} tags from the list`));setTimeout((()=>{this._chosenTags.push(e),this._chosenTags=(0,r.SortTags)(this._chosenTags,this._field),i.availableTags=i.availableTags.filter((t=>t!==e)),this.buildWorkbench(i)}))}else this._chosenTags=[e]}buildWorkbench(e){const t=s.div("flex row",[]);s.remove_all_child_elements_from(e.container),1!==(0,n.MultiSelect)(this._field)&&this._chosenTags.length>0&&(e.container.appendChild(this.buildTagWorkbench(e)),e.container.appendChild(t)),e.container.appendChild(this.buildTagSelectCtrl(e.availableTags,(i=>{this.onTagSelection(i,t,e)})))}inputHtmlElem(){const e=this._field;let t;if("category-input"===e.ctrl_type){const i=(0,r.ExtractCategoryArrayFrom)(e.fieldChoices),o=(0,r.SortTags)(i,this._field),a=1===(0,n.MultiSelect)(this._field)?o:this.removeChosenTagsFrom(o);t=s.div("category-workbench-container",[]),this.buildWorkbench({container:t,availableTags:a})}const i=s.div("flex col",[s.p("cbeb-entry-input-label",`${this._field.label}${!0===this._field.required?" (required)":""}`),t]);return i.setAttribute("fieldkey",this._field.key),i}constructor(e,t,i,n){super(e,t),this._entry=e,this._field=t,this._config=i,this._launch_search=n,this._chosenTags=(0,r.SortTags)((0,r.ExtractCategoryArrayFrom)(this._entry.getValueOf(this._field.key)),this._field)}}t.category_edit_ctrl=c},5118:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.copy=function(e){let t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select();try{document.execCommand("copy")}catch(e){}document.body.removeChild(t)}},3622:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Colour=void 0,t.Colour=class{_input;colourCode(){return this._input.includes("#")?this._input:`#${this._input}`}constructor(e){this._input=e}}},9403:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CommunityCache=void 0,t.CommunityCache=class{_key;_communityDetails;constructor(e,t){this._key=e,this._communityDetails=t}get key(){return this._key}IsOnFreePlan(){return!(/positiveimpactevents/.test(window.location.href)||this._communityDetails.hasOwnProperty("plan")&&"starter - free"!==this._communityDetails.plan)}GetGDPROptinMsg(){return this._communityDetails.hasOwnProperty("gdpr_msg")?this._communityDetails.gdpr_msg:""}PromptForPword(){return!this._communityDetails.hasOwnProperty("nopword")||"on"!==this._communityDetails.nopword}GetSignupMsg(){return this._communityDetails.hasOwnProperty("signup_msg")?this._communityDetails.signup_msg:""}GetCommunityName(){return this._communityDetails&&this._communityDetails.hasOwnProperty("community_name")?this._communityDetails.community_name:"n/a"}GetEmailContact(){return this._communityDetails&&this._communityDetails.hasOwnProperty("community_email_contact")?this._communityDetails.community_email_contact:"n/a"}HasTandC(){return this._communityDetails.hasOwnProperty("t_and_c_url")&&this._communityDetails.t_and_c_url.length>0}TandC(){return this.HasTandC()?this._communityDetails.t_and_c_url:""}}},5613:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConfirmEmailDialogBox=void 0;const n=i(5603),o=i(8114),r=i(7422);t.ConfirmEmailDialogBox=class{_dlgElem=document.getElementById("cbeb-confirmemail-modal");_msgElem=document.getElementById("cbeb-confirmemail-msg");_spinnerElem=document.getElementById("cbeb-confirmemail-loader");_okButtonElem=document.getElementById("cbeb-confirmemail-ok-btn");constructor(){n.DialogBoxMgr.registerDialogBox(this._dlgElem)}show(e){this._okButtonElem.style.display="none",o.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e}),n.DialogBoxMgr.show(this._dlgElem),this.TryToVerifyMemberEmail({onSuccess:()=>{this._spinnerElem.style.display="none",this._msgElem.innerHTML="

🎉

Your email has been verified and your account is now active!

",this._okButtonElem.style.display="flex"},onFailure:e=>{this._spinnerElem.style.display="none",this._msgElem.innerHTML=JSON.stringify(e),this._okButtonElem.style.display="flex"}})}getQueryParams(e){e=e.split("+").join(" ");for(var t,i={},n=/[?&]?([^=]+)=([^&]*)/g;t=n.exec(e);)i[decodeURIComponent(t[1])]=decodeURIComponent(t[2]);return i.hasOwnProperty("a")&&i.hasOwnProperty("b")?{authID:i.a,validationToken:i.b}:i.hasOwnProperty("c")&&i.hasOwnProperty("d")?{authID:i.c,pwResetValidationToken:i.d}:i.hasOwnProperty("mk")&&i.hasOwnProperty("invite")?{memberKey:i.mk,invitationToken:i.invite}:i.hasOwnProperty("mk")&&i.hasOwnProperty("cr")?{memberKey:i.mk,connectionToken:i.cr}:i.hasOwnProperty("overlay")?{entryKey:i.overlay}:{}}getQueryPartOfUrl(){var e=window.location.href.split("?");return e.length>1?"?"+e[1]:""}TryToVerifyMemberEmail(e){var t=this.getQueryParams(this.getQueryPartOfUrl());new XMLHttpRequest,(0,r.PostRequest)({url:"https://api.communitybox.co/verify/memberemail",payload:t,callback:{onResult:t=>{t.hasOwnProperty("err")?e.onFailure(t.err):e.onSuccess()},onFailure:t=>{e.onFailure(t)}}})}Close(){n.DialogBoxMgr.close(),document.getElementById("cbeb-toolbar-post").className+=" cbeb-pulse-colour"}}},5801:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionDialogBox=void 0;const n=i(5603),o=i(8114),r=i(5397),s=i(3032),a=i(4695),l=i(9496);t.ConnectionDialogBox=class{_dlgElem=document.querySelector("[cbeb-connection-modal]");_requestingElem=this._dlgElem.querySelector("[requesting-connection]");_connectionMade=this._dlgElem.querySelector("[connection-made]");_containerElem=this._dlgElem.querySelector("[cbeb-view-connection-modal-field-container]");_answerInputs=[];constructor(){n.DialogBoxMgr.registerDialogBox(this._dlgElem),this._requestingElem.style.display="none",this._connectionMade.style.display="none"}photoFileInitValue(e,t){const i=(0,a.PictureDataFrom)(t);return[`background-image: url('${void 0!==i.key&&i.key.length>0?(0,r.PictureLinkFrom)(i,(0,a.PictureDataFrom)(e.defaultProfilePictureKey)):"https://dashboard.communitybox.co/img/uploaded/"+e.defaultProfilePictureKey+".jpeg"}');`,`transform: rotate(${i.rotation}deg);`,`background-position-x: ${i.offset.x};`,`background-position-y: ${i.offset.y};`,`border-radius: ${"circle"===e.profilePictureAspect?"50%":"0%"};`,"fit"===e.profilePictureAspect?"background-size: contain; background-color: transparent;":""].join("")}buildAnswerInput(e){return"one-line"===e.input_type?s.input("connect-dlg-question-input "+(e.required?"required":""),void 0,void 0,"your-email"===e.key?{type:"email"}:{}):s.textarea("connect-dlg-textarea-input "+(e.required?"required":""),"",80,5,!0)}buildQuestionRow(e,t){return s.div("connect-dlg-question-row",[s.p("connect-dlg-question-label",e.question),t])}buildConnectionFields(e,t,i,n,o){s.remove_all_child_elements_from(e);const r=i.fieldsOfType("image-input");r.length>0&&e.appendChild(s.div("",[s.div("",[],{design:this.photoFileInitValue(n,t.getValueOf(r[0].key)),classes:["cb-image-upload-readonly"]})],{classes:["cbeb-entry-image-input-container"]}));const a=[{question:"Your name",input_type:"one-line",required:!0,key:"your-name"},{question:"Your email address",input_type:"one-line",required:!0,key:"your-email"},...n.connectQuestions()];this._answerInputs=a.map((e=>this.buildAnswerInput(e)));const l=s.elem("form","connect-dlg-form",[s.div("connect-dlg-question-container",a.map(((e,t)=>this.buildQuestionRow(e,this._answerInputs[t])))),s.div("connect-dlg-connect-btn-row",[s.button("connect-button","Connect",null,{classes:["cbeb-dialog-title-button","cbeb-custom-clr-button"]})])]);l.addEventListener("submit",(e=>(e.preventDefault(),window.setTimeout((()=>{this.onConnect(t,n,o)})),!1))),e.appendChild(l)}showForEntry(e,t,i,r){this._containerElem.style.display="block",this._requestingElem.style.display="none",this._connectionMade.style.display="none";const s=this._dlgElem.querySelector("#cbeb-connection-dlg-title");s.textContent="Connect with "+e.getDisplayNameForTemplate(t),s.style.visibility="hidden",this.buildConnectionFields(this._containerElem,e,t,i,r),o.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:i}),n.DialogBoxMgr.show(this._dlgElem),this._containerElem.scrollTop=0}async onConnect(e,t,i){this._containerElem.style.display="none",this._requestingElem.style.display="flex";const[n,o]=this._answerInputs.splice(0,2),r=t.connectQuestions().map(((e,t)=>({question:e.question,answer:this._answerInputs[t].value})));try{await l.Matchmaking.Lambda({box:i,initiatorEmail:o.value,initiatorName:n.value,answers:r,destinationKey:e.key})}catch(e){console.log(e)}finally{this._requestingElem.style.display="none",s.remove_all_child_elements_from(this._connectionMade),this._connectionMade.appendChild(s.p("",t.connection_made_msg)),this._connectionMade.style.display="flex"}}}},7155:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionLookupDialogBox=void 0;const n=i(5603),o=i(8114),r=i(7422);t.ConnectionLookupDialogBox=class{_dlgElem=document.querySelector("[cbeb-connection-lookup-dlg]");_foundElem=this._dlgElem.querySelector("[found-connection]");_mailLink=this._dlgElem.querySelector("[mail-link]");_lookingUpElem=this._dlgElem.querySelector("[looking-up-data]");constructor(e){n.DialogBoxMgr.registerDialogBox(this._dlgElem),o.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e}),this._foundElem.style.display="none"}Show(e){n.DialogBoxMgr.show(this._dlgElem),(0,r.PostRequest)({url:"https://api.communitybox.co/matchmaking/make/connection",payload:{destinationKey:e.destinationKey,connectionToken:e.connectionToken},callback:{onResult:e=>{this._lookingUpElem.style.display="none",this._foundElem.style.display="flex",this._mailLink.href="mailto:"+e.email,this._mailLink.textContent=e.email},onFailure:function(e){console.error(e)}}})}Close(){n.DialogBoxMgr.hideAll()}}},7109:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CookieCutterTemplate=void 0,t.CookieCutterTemplate=class{_cookiecutter;getMarkup(e){return this._cookiecutter["markup"+(e||"")]}getStyle(e){return this._cookiecutter["css"+(e||"")]}constructor(e){this._cookiecutter=e}}},2703:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.write_cookie=function(e,t){document.cookie=`${e}=${t}; path=/`},t.read_cookie=function(e){if(document.cookie.length>0){let t=document.cookie.indexOf(`${e}=`);if(-1!==t){t=t+e.length+1;let i=document.cookie.indexOf(";",t);return-1===i&&(i=document.cookie.length),unescape(document.cookie.substring(t,i))}}}},5640:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HierarchicalTagEditCtrl=void 0;const n=i(1045),o=i(3032),r=i(3622),s=i(6196),a=i(7746);class l extends n.field_edit_ctrl{_entry;_field;_config;_launch_search;_chosenTags=[];data(){return this._chosenTags}has_data(){return this._chosenTags.length>0}viewHtmlElem(){return o.div("",[])}buildTagWithDelete(e,t){const i=new r.Colour(this._config.fgColourOf("tag")||"ffffff"),n=this._field.tagTree.get(e);return o.div("tag-workbench",[o.p("tag-workbench-label",n.label,{design:`color: ${i.colourCode()};`}),o.button("svg flex","",(()=>{t(e)}),{svg:"bin",svgColour:i,svgDim:{width:new s.Measure(15,"px"),height:new s.Measure(15,"px")}})],{design:`background-color: ${this._config.bgColourOf("tag")};`})}handleTagDeletion(e,t){setTimeout((()=>{t.availableTags.push(e),t.availableTags=this.sortHierarchicalTags(t.availableTags),this._chosenTags=this._chosenTags.filter((t=>t!==e)),this.buildWorkbench(t)}))}buildTagWorkbench(e){return o.div("tag-workbench-frame",this._chosenTags.map((t=>this.buildTagWithDelete(t,(()=>{this.handleTagDeletion(t,e)})))))}labelFor(e){const t=this._field.tagTree.get(e);if(null==t||null==t.parent)return"";const i=this._field.tagTree.get(t.parent);return null==i?"":`${i.label} - ${t.label}`}buildTagSelectCtrl(e,t){const i=this._config.get_wording("pfe-select-tags"),n=o.select("tag-workbench-select-ctrl",e.map((e=>({value:e,label:this.labelFor(e)}))),{on_selection_change:e=>{e&&t(e)},placeholder:i});return o.div("flex row",[n],{design:"column-gap: 7px"})}removeChosenTagsFrom(e){return e.filter((e=>!1===this._chosenTags.includes(e)))}onTagSelection(e,t,i){i.container.parentElement?.removeAttribute("missing_required_field");const n=this._field.maxSelectable||100;if(this._chosenTags.length>=n)return o.remove_all_child_elements_from(t),void t.appendChild(o.p("tag-workbench-error-msg",`You may select at most ${n} tags from the list`));setTimeout((()=>{this._chosenTags.push(e),this._chosenTags=this.sortHierarchicalTags(this._chosenTags),i.availableTags=i.availableTags.filter((t=>t!==e)),this.buildWorkbench(i)}))}buildWorkbench(e){const t=o.div("flex row",[]);o.remove_all_child_elements_from(e.container),this._chosenTags.length>0&&(e.container.appendChild(this.buildTagWorkbench(e)),e.container.appendChild(t)),e.container.appendChild(this.buildTagSelectCtrl(e.availableTags,(i=>{this.onTagSelection(i,t,e)})))}inputHtmlElem(){let e;const t=Array.from(this._field.tagTree).filter((e=>null!=e[1].parent)),i=this.sortHierarchicalTags(t.map((e=>e[0]))),n=this.removeChosenTagsFrom(i);e=o.div("category-workbench-container",[]),this.buildWorkbench({container:e,availableTags:n});const r=o.div("flex col",[o.p("cbeb-entry-input-label",`${this._field.label}${!0===this._field.required?" (required)":""}`),e]);return r.setAttribute("fieldkey",this._field.key),r}extractHierarchicalTagArrayFrom(e){return null!=e&&e instanceof Array?e.filter((e=>"string"==typeof e&&e.length>0)):[]}sortHierarchicalTags(e){switch(this._field.sortingTactic){case"alphabetical":return e.sort(((e,t)=>{const i=this._field.tagTree.get(e),n=this._field.tagTree.get(t);return i?n?i.label.localeCompare(n.label):1:-1}));case"numerical":return e.sort(((e,t)=>{const i=this._field.tagTree.get(e),n=this._field.tagTree.get(t);return i?n?(0,a.NumericSort)(i.label,n.label):1:-1}))}}constructor(e,t,i,n){super(e,t),this._entry=e,this._field=t,this._config=i,this._launch_search=n,this._chosenTags=this.sortHierarchicalTags(this.extractHierarchicalTagArrayFrom(this._entry.getValueOf(this._field.key)))}}t.HierarchicalTagEditCtrl=l},6732:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultOverviewBuilder=void 0;const n=i(7238),o=i(1165),r=i(5397),s=i(5671),a=i(4695),l=i(7746);class c extends n.OverviewBuilder{buildOverviewFeaturedBannerHtml(e,t){return["
",e.isFeatured()&&e.featureLevel()>0?`
${t.featuredBannerText}
`:"","
"].join("")}buildOverviewPhotoHtml(e,t,i){const n="circle"===i.profilePictureAspect?"50%":"0",s=t.getRuleForType(o.TemplateRuleType.Picture);if(0===s.length)return"";const l=e.getValueOf(s[0].key),c=(0,a.PictureDataFrom)(l);return`\n
\n
`}buildDisplayNameHtml(e,t,i){return[`
',e.getDisplayNameForTemplate(t),"
"].join("")}buildOverviewOtherNameHtml(e,t,i){const n=t.getRuleForType(o.TemplateRuleType.OtherTitle);let r="";if("e52472c4-095a-4670-9c79-dea8d0933421"===e.box){let t=0;return n.forEach((t=>{e.hasValueForField(t.key)&&(r+=`

${e.getValueOf(t.key)}

`)})),""!==r?[`
0?"flex-direction: column;":"flex-direction: row;"}">`,r,"
"].join(""):""}return n.forEach((t=>{e.hasValueForField(t.key)&&(r+=e.getValueOf(t.key)+t.interval)})),""!==r?['
',r,"
"].join(""):""}getRuleValue(e,t){return t&&e.hasValueForField(t)?e.getValueOf(t):void 0}buildOverviewCategoriesHtml(e,t,i){const n=t.getRuleForType(o.TemplateRuleType.Category);return['
',Object.keys(n).map((e=>n[e].key)).map((i=>({category_name:t.getLabelFor(i)||"unknown",categoryKey:i,tags:(0,l.ExtractCategoryArrayFrom)(e.getValueOf(i))}))).map((e=>e.tags.map((t=>`
\n ${t}
`)).join(""))).join(""),"
"].join("")}addOverviewBioSnippet(e,t,i){if(null===t)return"";let n="";if(t.length\n ${n}\n\n
\n ${i.get_wording("read-more")}\n
\n`}buildOverviewParagraphHtml(e,t,i){const n=t.getRuleForType(o.TemplateRuleType.Paragraph).map((t=>e.hasValueForField(t.key)?`${this.getRuleValue(e,t.key)}${t.interval}`:"")).join("");return n?this.addOverviewBioSnippet(e,n,i):""}mapsUrlFrom(e){return void 0!==e.place_URL?e.place_URL:`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(e.formatted_address)}&query_place_id=${e.placeID}`}formatted_location_display_for(e,t){switch(t){case"default":return s.default_format(e);case"street only":return s.street_only(e);case"city & state":return s.city_and_state(e);case"city only":return s.city_only(e);case"full":return e}}overviewLocationFrom(e,t){return void 0===e?"":-1===e.indexOf(",")?e:this.formatted_location_display_for(e,t.overviewLocationDisplay)}buildOverviewLocationHtml(e,t,i){const n=t.getRuleForType(o.TemplateRuleType.Location);let r=n&&n.length>0?this.getRuleValue(e,n[0].key):void 0;if("string"==typeof r)try{r=JSON.parse(r)}catch{r={formatted_address:r.trim(),lat:0,lng:0,place_URL:`https://www.google.com/maps/search/?api=1&query='${r.trim()}'`}}return"object"==typeof r&&r.hasOwnProperty("formatted_address")?['"].join(""):""}addSocialMediaSummary(e,t,i){let n='
';return t.forEach((t=>{const o=(0,l.GetURLandGlyphForSocialMedia)(e,t);n+=``})),n+="
",n}buildOverviewSocialMediaHtml(e,t,i){let n=t.getRuleForType(o.TemplateRuleType.SocialMedia).map((e=>t.getField(e.key))).filter((e=>null!=e)).filter((e=>e.isSocialMediaField())).filter((t=>e.hasValueForField(t.key)));return this.addSocialMediaSummary(e,n,i)}buildOverviewConnectHtml(e,t,i){return i.matchMakingEnabled&&e.has_valid_email_address(t)||i.matchMakingEnabled&&"bespoke"===i.matchMakeDestinationChoice?`
`:""}buildOverviewHtml(e,t,i){const n=[this.buildOverviewFeaturedBannerHtml(e,i),t.fieldsOfType("image-input").length>0?this.buildOverviewPhotoHtml(e,t,i):"",this.buildDisplayNameHtml(e,t,i),this.buildOverviewOtherNameHtml(e,t,i),this.buildOverviewCategoriesHtml(e,t,i),this.buildOverviewParagraphHtml(e,t,i),this.buildOverviewLocationHtml(e,t,i),this.buildOverviewSocialMediaHtml(e,t,i),this.buildOverviewConnectHtml(e,t,i)].join(""),o=document.createElement("div");return o.setAttribute("class","box-entry-overview-container"),o.setAttribute("id","emb-"+e.key),o.innerHTML=n,o}build_top_row(){}getProfileFlexBasis(e){var t=100,i=e.forClientWidth;return[{width:449,basis:50},{width:624,basis:33},{width:779,basis:25},{width:999,basis:20},{width:1219,basis:16},{width:1439,basis:14}].forEach((function(e){i>e.width&&(t=e.basis)})),t}}t.DefaultOverviewBuilder=c},3224:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DeleteDialogBox=void 0;const n=i(8114),o=i(8448),r=i(7422),s=i(5603);t.DeleteDialogBox=class{_dlgElem=document.getElementById("cbeb-delete-entry-modal");_loaderElem=document.getElementById("cbeb-delete-entry-loader");_callbacks={onDelete:()=>{},onFailure:e=>{}};constructor(e){n.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e}),s.DialogBoxMgr.registerDialogBox(this._dlgElem)}ShowForEntry(e,t,i,n,o){this._callbacks=e,document.getElementById("cbeb-delete-confirmation-msg").innerHTML="Are you sure you want to delete "+t.getDisplayNameForTemplate(i)+"?",this._loaderElem.style.display="none",this._dlgElem.style.display="block",document.getElementById("cbeb-confirm-delete-btn").addEventListener("click",(()=>{this.Spin(),this.TryToDeleteEntry(t,n,o,{onDelete:()=>{this._dlgElem.style.display="none",this._callbacks.onDelete()},onFailure:e=>{this._callbacks.onFailure(e)}})}))}Close(){this._dlgElem.style.display="none"}TryToDeleteEntry(e,t,i,n){const s=o.AuthCache.getAuth();if(void 0!==s){var a={payload:{entryID:e.key,boxID:t,communityID:i},auth:{authID:s.authID,token:s.token}};(0,r.PostRequest)({url:"https://api.communitybox.co/memberdeleteentry",payload:a,callback:{onResult:e=>{e.hasOwnProperty("err")?n.onFailure(e.err):n.onDelete()},onFailure:e=>{n.onFailure(e)}}})}}Spin(){this._dlgElem.style.display="none",this._loaderElem.style.display="block"}}},9479:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mobile_aspect=function(){return(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)<511}},5603:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DialogBoxMgr=void 0;class i{static _dlgBoxElems=[];static registerDialogBox(e){i._dlgBoxElems.push(e)}static hideAll(){i._dlgBoxElems.forEach((function(e){e.style.display="none",document.body.classList.remove("cbeb-noscroll")}))}static show(e){i.hideAll(),e.style.display="block",document.body.classList.add("cbeb-noscroll")}static close(){i.hideAll(),document.body.classList.remove("cbeb-noscroll")}static buildAndRegisterDialogElement(e){const t=document.createElement("div");return t.setAttribute(e.key,""),t.classList.add("cbeb-modal"),t.innerHTML=`\n
\n
\n
${e.title}
\n ${e.default_close?'\n \n \n \n \n ':""}\n
\n
\n ${e.body}\n
\n
`,this.registerDialogBox(t),t}}t.DialogBoxMgr=i},3032:(e,t)=>{"use strict";function i(e,t){for(const i of e.split(" ").filter((e=>e.length>0)))if(-1!==i.indexOf("=")){const e=i.split("=");t.setAttribute(e[0],e[1])}else t.setAttribute(i,"")}function n(e){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("height",e.dimensions?e.dimensions.height.composite():"19px"),i.setAttribute("width",e.dimensions?e.dimensions.width.composite():"19px"),i.setAttribute("viewBox",`0 0 ${t.pathDictionary[e.path].viewBox?.width||2048} ${t.pathDictionary[e.path].viewBox?.height||2048}`);const n=document.createElementNS("http://www.w3.org/2000/svg","path");n.setAttribute("d","M0 0h24v24H0V0z"),n.setAttribute("fill","none");const o=document.createElementNS("http://www.w3.org/2000/svg","path");return o.setAttribute("d",t.pathDictionary[e.path].path),e.colour?o.setAttribute("fill",e.colour.colourCode()):o.setAttribute("fill","currentColor"),i.appendChild(n),i.appendChild(o),i}Object.defineProperty(t,"__esModule",{value:!0}),t.pathDictionary=void 0,t.remove_all_child_elements_from=function(e){for(;e.firstChild;)null!==e.lastChild&&e.removeChild(e.lastChild)},t.option=function(e){const t=document.createElement("option");return t.defaultSelected=!0===e.default,t.value=e.value,t.textContent=e.text||e.value,t},t.h=function(e,t){const i=document.createElement(`h${e}`);return i.textContent=t,i},t.textarea=function(e,t,n,o,r){const s=document.createElement("textarea");return i(e,s),s.value=t,s.rows=o,s.cols=n,s.wrap=r?"wrap":"off",s},t.select=function(e,t,n){const o=document.createElement("select");if(n&&(n.dropdown_design&&o.setAttribute("style",n.dropdown_design),n.on_selection_change&&o.addEventListener("change",(()=>{n.on_selection_change&&n.on_selection_change(o.value)})),n.placeholder)){const e=document.createElement("option");e.value="placeholder-default",e.textContent=n.placeholder,e.defaultSelected=!0,e.disabled=!0,o.appendChild(e)}for(const e of t.sort(((e,t)=>e.label.localeCompare(t.label)))){const t=document.createElement("option");t.value=e.value,t.textContent=e.label,n&&n.choice_design&&t.setAttribute("style",n.choice_design),n&&n.default&&n.default===e.value&&(t.defaultSelected=!0),o.appendChild(t)}return i(e,o),o},t.anchor=function(e,t,n,o){const r=document.createElement("a");return r.textContent=t,r.href=n,o?.design&&r.setAttribute("style",o.design),"yes"===o?.open_in_new_tab&&(r.target="_blank"),i(e,r),r},t.p=function(e,t,n){const o=document.createElement("p");return o.textContent=t,i(e,o),n?.design&&o.setAttribute("style",n.design),o},t.img=function(e,t,n){const o=document.createElement("img");return o.src=t,i(e,o),n?.design&&o.setAttribute("style",n?.design),o},t.ul=function(e,t,n){const o=document.createElement("ul");o.style.listStyle="none",i(e,o);for(const e of t)o.appendChild(e);return n&&o.setAttribute("style",n),o},t.span=function(e){const t=document.createElement("span");return t.textContent=e,t},t.i=function(e){const t=document.createElement("i");return e&&e.class&&t.setAttribute("class",e.class),t},t.li=function(e,t,n,o){const r=document.createElement("li");return r.textContent=t,i(e,r),n&&r.setAttribute("style",n),o&&r.addEventListener("click",(()=>{o()})),r},t.elem=function(e,t,n){const o=document.createElement(e);if(void 0!==t&&i(t,o),void 0!==n)for(const e of n)o.appendChild(e);return o},t.title=function(e){const t=document.createElement("title");return t.textContent=e,t},t.progress=function(){const e=document.createElement("progress");return e.value=0,e.max=100,e},t.div=function(e,t,n){const o=document.createElement("div");i(e,o);for(const e of t)e&&o.appendChild(e);return n&&(n.design&&o.setAttribute("style",n.design),n.text&&(o.textContent=n.text),n.on_click&&o.addEventListener("click",n.on_click),n.classes&&o.setAttribute("class",n.classes.join(" ")),n.key&&(o.id=n.key)),o},t.spacer=function(e){const t=document.createElement("div");return e.height&&(t.style.height=`${e.height}px`),e.width&&(t.style.width=`${e.width}px`),t},t.video=function(e,t){const n=document.createElement("iframe");return n.src=t,n.frameBorder="0",n.allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",n.allowFullscreen=!0,n.style.width="71vw",n.style.height="39vw",i(e,n),n},t.datalist=function(e,t){const i=document.createElement("datalist");i.id=e;for(const e of t){const t=document.createElement("option");t.textContent=e.label,t.value=e.value,i.appendChild(t)}return i},t.input=function(e,t,n,o){const r=document.createElement("input");return i(e,r),n&&r.setAttribute("style",n),o?.classes&&r.setAttribute("class",o.classes.join(" ")),o?.placeholder&&(r.placeholder=o.placeholder),o?.datalist&&r.setAttribute("list",o.datalist),o?.type&&(r.type=o.type),o?.initialValue&&(r.value=o.initialValue),void 0!==t&&r.addEventListener("keyup",(e=>{t(e,r)})),r},t.svg=n,t.button=function(e,t,o,r){const s=document.createElement("button");return t.length>0&&(s.textContent=t),r&&r.design&&s.setAttribute("style",r.design),r?.classes&&s.setAttribute("class",r.classes.join(" ")),i(e,s),o&&s.addEventListener("click",(()=>{o(s)})),void 0!==r&&void 0!==r.svg&&s.appendChild(n({path:r.svg,colour:r.svgColour,dimensions:r.svgDim})),s},t.pathDictionary={bin:{path:"M1792 384h-128v1472q0 40-15 75t-41 61-61 41-75 15H448q-40 0-75-15t-61-41-41-61-15-75V384H128V256h512V128q0-27 10-50t27-40 41-28 50-10h384q27 0 50 10t40 27 28 41 10 50v128h512v128zM768 256h384V128H768v128zm768 128H384v1472q0 26 19 45t45 19h1024q26 0 45-19t19-45V384zM768 1664H640V640h128v1024zm256 0H896V640h128v1024zm256 0h-128V640h128v1024z"},configure:{path:"M19.43 12.98c.04-.32.07-.64.07-.98 0-.34-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.09-.16-.26-.25-.44-.25-.06 0-.12.01-.17.03l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.06-.02-.12-.03-.18-.03-.17 0-.34.09-.43.25l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98 0 .33.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.09.16.26.25.44.25.06 0 .12-.01.17-.03l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.06.02.12.03.18.03.17 0 .34-.09.43-.25l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zm-1.98-1.71c.04.31.05.52.05.73 0 .21-.02.43-.05.73l-.14 1.13.89.7 1.08.84-.7 1.21-1.27-.51-1.04-.42-.9.68c-.43.32-.84.56-1.25.73l-1.06.43-.16 1.13-.2 1.35h-1.4l-.19-1.35-.16-1.13-1.06-.43c-.43-.18-.83-.41-1.23-.71l-.91-.7-1.06.43-1.27.51-.7-1.21 1.08-.84.89-.7-.14-1.13c-.03-.31-.05-.54-.05-.74s.02-.43.05-.73l.14-1.13-.89-.7-1.08-.84.7-1.21 1.27.51 1.04.42.9-.68c.43-.32.84-.56 1.25-.73l1.06-.43.16-1.13.2-1.35h1.39l.19 1.35.16 1.13 1.06.43c.43.18.83.41 1.23.71l.91.7 1.06-.43 1.27-.51.7 1.21-1.07.85-.89.7.14 1.13zM12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"},grab:{path:"M3 15h18v-2H3v2zm0 4h18v-2H3v2zm0-8h18V9H3v2zm0-6v2h18V5H3z"},"back-arrow":{path:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"},share:{viewBox:{width:206.99,height:238.11},path:"m68.39,90.58c7.42-4.59,14.83-9.16,22.24-13.74,12.15-7.51,24.28-15.06,36.46-22.51,1.45-.89,1.78-1.65,1.32-3.34C121.81,26.81,137.82,3.25,162.79.27c24.09-2.88,45.8,17.87,44.08,42.1-1.4,19.69-15.32,34.92-34.8,37.5-11.2,1.48-21.43-1.42-30.33-8.57-.9-.72-1.77-1.49-2.71-2.27-13.75,8.5-27.45,16.98-41.14,25.45-6,3.71-11.99,7.45-18.01,11.12-1.14.7-1.56,1.28-1.14,2.76,1.87,6.68,1.97,13.42.42,20.21-.17.75.4,2.13,1.06,2.55,19.17,12.41,38.4,24.72,57.57,37.13,1.53.99,2.2.17,3.15-.64,22.41-18.8,56.43-8.65,64.43,19.4,7.26,25.45-10.94,48.56-34.27,50.88-24.72,2.46-45.79-17.64-44.16-42.46.18-2.71.68-5.46,1.46-8.06.61-2.01.04-2.89-1.61-3.94-11.23-7.11-22.38-14.32-33.56-21.5-7.27-4.67-14.56-9.3-21.78-14.04-1.46-.96-2.33-1.08-3.77.24-11.51,10.51-24.99,13.76-39.75,9.03-15-4.8-24.07-15.54-27.2-30.98-4.43-21.85,11.87-44.08,33.93-46.74,12.48-1.51,23.31,1.93,32.67,10.22.31.27.63.53,1.05.89Zm77.41-50.7c-.21,11.8,8.98,21.36,20.77,21.61,11.55.24,21.48-9.35,21.66-20.9.18-11.84-9.18-21.6-21.07-21.69-13.77-.11-21.97,11.68-21.36,20.99Zm-.06,158.29c.03,11.96,9.4,21.2,21.45,21.16,11.7-.04,21.06-9.58,21.02-21.42-.04-11.7-9.56-21.05-21.41-21.03-11.79.02-21.1,9.44-21.06,21.29ZM40.23,98.01c-11.24-.69-21.52,9.76-21.29,21.01.25,11.9,9.33,21.35,21.04,21.39,11.9.03,21.45-9.43,21.45-21.27,0-11.8-9.36-21.13-21.21-21.13Z"},close:{path:"M1169 1024l879 879-145 145-879-879-879 879L0 1903l879-879L0 145 145 0l879 879L1903 0l145 145-879 879z"},rotateRight:{path:"M1939 915l90 90-301 301-301-301 90-90 147 146v-37q0-106-27-204t-78-183-120-156-155-120-184-77-204-28q-106 0-204 27t-183 78-156 120-120 155-77 184-28 204q0 106 27 204t78 183 120 156 155 120 184 77 204 28v128q-124 0-238-32t-214-90-181-140-140-181-91-214-32-239q0-124 32-238t90-214 140-181 181-140 214-91 239-32q135 0 261 39t234 110 193 172 138 226q40 94 55 189t15 197l147-146zM896 768q53 0 99 20t82 55 55 81 20 100q0 53-20 99t-55 82-81 55-100 20q-53 0-99-20t-82-55-55-81-20-100q0-53 20-99t55-82 81-55 100-20zm0 384q27 0 50-10t40-27 28-41 10-50q0-27-10-50t-27-40-41-28-50-10q-27 0-50 10t-40 27-28 41-10 50q0 27 10 50t27 40 41 28 50 10z"},rotateLeft:{path:"M2048 1024q0 124-32 238t-90 214-140 181-181 140-214 91-239 32v-128q106 0 204-27t183-78 156-120 120-155 77-184 28-204q0-106-27-204t-78-183-120-156-155-120-184-77-204-28q-106 0-204 27t-183 78-156 120-120 155-77 184-28 204v37l147-146 90 90-301 301-301-301 90-90 147 146v-10q0-98 16-191t54-185q52-124 137-225t193-172 235-111 261-39q124 0 238 32t214 90 181 140 140 181 91 214 32 239zm-640 0q0 53-20 99t-55 82-81 55-100 20q-53 0-99-20t-82-55-55-81-20-100q0-53 20-99t55-82 81-55 100-20q53 0 99 20t82 55 55 81 20 100zm-384 0q0 27 10 50t27 40 41 28 50 10q27 0 50-10t40-27 28-41 10-50q0-27-10-50t-27-40-41-28-50-10q-27 0-50 10t-40 27-28 41-10 50z"},upload:{path:"M1536 0v128H384V0h1152zm45 979l-90 90-467-470v1449H896V599l-467 470-90-90 621-626 621 626z"},previous:{path:"M256 1792V256h128v1536H256zm448-768l1088-768v1536L704 1024zm960 521V503l-738 521 738 521z"},next:{path:"M1664 256h128v1536h-128V256zM256 1792V256l1088 768-1088 768zM384 503v1042l738-521-738-521z"}}},3863:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewElemCache=void 0,t.OverviewElemCache=class{_overviewElems=[];refresh(e){var t=document.getElementsByClassName(e);this._overviewElems=[];for(var i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditEntryDialogBox=void 0;const n=i(5603),o=i(8114),r=i(7422),s=i(8448),a=i(2427),l=i(2750);class c extends l.profile_dialog_box{_invariants;_dlgElem=document.getElementById("cbeb-edit-entry-modal");_containerElem=this._dlgElem.querySelector("#cbeb-edit-entry-modal-field-container");_spinnerElem=this._dlgElem.querySelector("#cbeb-edit-entry-spinner");_onApplyCallback=()=>{};_editCtrls=[];constructor(e){super(),this._invariants=e,n.DialogBoxMgr.registerDialogBox(this._dlgElem),this._dlgElem.addEventListener("click",(e=>{e.target.matches("button[apply-change]")&&this._onApplyCallback()}))}AddButtonsToBottomOf(e){var t=document.createElement("div");t.innerHTML='
',t.className="cbeb-extra-button-row",e.appendChild(t)}empty(e){for(;e.firstChild;)e.removeChild(e.firstChild)}populateFieldEdit(e,t,i,n,o){this.empty(e);const r=document.createElement("div");r.classList.add("cbeb-edit-entry-error-msg"),e.appendChild(r),this._editCtrls=i.mapFields((e=>e)).sort(((e,t)=>e.rank(0,a.FieldEditCtrlFactory)(t,e,this._invariants,this._dlgElem))),this._editCtrls.forEach((t=>e.appendChild(t.inputHtmlElem()))),this._editCtrls.forEach((e=>e.post_dom_add()));const s=document.createElement("div");s.classList.add("cbeb-edit-entry-error-msg"),e.appendChild(s)}ShowForEntry(e){this._editCtrls=[],this.populateFieldEdit(this._containerElem,e.entry,e.withTemplate,e.withConfig,e.box),this.AddButtonsToBottomOf(this._containerElem),o.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e.withConfig}),void 0!==e.withConfig.fontFamily?this._dlgElem.style.fontFamily=e.withConfig.fontFamily:this._dlgElem.style.fontFamily="quicksand",n.DialogBoxMgr.hideAll(),this.ShowButtons(),this._spinnerElem.style.display="none",this._dlgElem.style.display="block",this._containerElem.style.display="block",this._containerElem.scrollTop=0,this._onApplyCallback=()=>{this.onOK(e.box,e.community,e.withTemplate,e.entry,e.refreshBoxCallback,e.failureCallback)}}ShowButtons(){this._dlgElem.querySelectorAll("button").forEach((e=>{e.style.visibility="visible"}))}HideButtons(){this._dlgElem.querySelectorAll("button").forEach((e=>{e.style.visibility="hidden"}))}Spin(){this._containerElem.style.display="none",this._spinnerElem.style.display="block"}TryToUpdateEntry(e,t){(0,r.PostRequest)({url:"https://api.communitybox.co/membereditboxentry",payload:e,callback:{onResult:e=>{e.hasOwnProperty("err")?t.onFailure(e.err):t.onSuccess(e)},onFailure:e=>{t.onFailure(e)}}})}collectEntryData(){return this._editCtrls.reduce(((e,t)=>{const i=t.data();return void 0!==i&&(e[t.fieldKey]=i),e}),{})}onOK(e,t,i,o,r,a){const l=s.AuthCache.getAuth();if(void 0===l)return;const c=this.collectEntryData();c.date_modified=Date.now().toString(),o.hasValueForField("date_added")&&(c.date_added=o.getValueOf("date_added")),o.hasValueForField("user_verified")&&(c.user_verified=o.getValueOf("user_verified")),o.hasValueForField("feature_level")&&(c.feature_level=o.getValueOf("feature_level"));const u=this._dlgElem.querySelector(".cbeb-modal-content");"some_fields_are_missing"!==this.handle_missing_fields(c,i,u)&&(this.HideButtons(),this.Spin(),this.TryToUpdateEntry({payload:{boxID:e,entryID:o.key,communityID:t.key,entryData:c},auth:{authID:l.authID,token:l.token}},{onSuccess:function(){n.DialogBoxMgr.hideAll(),r()},onFailure:function(e){a(e)}}))}}t.EditEntryDialogBox=c},9577:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EmailEditCtrl=void 0;const n=i(1045);class o extends n.field_edit_ctrl{_entry;_field;_config;_inputElem;data(){return void 0!==this._inputElem&&this._inputElem.value||""}has_data(){return this._entry.hasValueForField(this._field.key)}cleanedUpLink(e){return`${e}`}viewHtmlElem(){const e=[this.leftOfViewRow(),'
',this._field.detail_label?`
${this._field.detail_label}
`:"","
",this.getDetailGlyph(this._field.ctrl_type),this.cleanedUpLink(this._entry.getValueOf(this._field.key)),"
","
",this.rightOfViewRow()].join(""),t=document.createElement("div");return t.innerHTML=e,t}inputHtmlElem(){const e="everyone"!==this._field.editable_by,t=this._entry.getValueOf(this._field.key),i=this.leftOfInputRow()+'
'+this._field.label+(!0===this._field.required?" (required)":"")+(!0===e?'  ':"")+'
'+`
"+this.rightOfInputRow(),n=document.createElement("div");return n.innerHTML=i,this.install_input_handler_for(n,"input"),this._inputElem=n.querySelector("input"),n}constructor(e,t,i){super(e,t),this._entry=e,this._field=t,this._config=i}}t.EmailEditCtrl=o},777:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ebFilterManager=t.box_cache=void 0,t.GetDocumentWideState=ve,t.cbebOnShowMore=Me,t.handle_profile_click=Te,t.ebPresentBoxContentUI=Ve;const n=i(3863),o=i(5123),r=i(4745),s=i(1165),a=i(512),l=i(7109),c=i(9403),u=i(8114),d=i(5801),h=i(8448),p=i(7422),m=i(3680),f=i(8526),g=i(9721),_=i(409),y=i(7037),b=i(3224),x=i(1887),v=i(5613),w=i(7797),E=i(4585),M=i(5843),T=i(3274),C=i(7074),k=i(5942),S=i(7155),L=i(3081),A=i(5603),I=i(234),D=i(4580),z=i(8741),P=i(7048),O=i(6732),B=i(8595),j=i(8478),R=i(5665),F=i(9479),N=i(3690),U=i(9270),V=i(3032),$=i(2703),q=i(7746),G=i(1323),Z=i(5576),H=i(9496);let W,X,Y,K,Q,J,ee,te,ie,ne,oe,re,se,ae,le,ce,ue,de,he,pe,me,fe,ge,_e="",ye=new Set;var be="";let xe=null;function ve(){return document.cbDocumentWideState}function we(e){if(!0===(0,F.mobile_aspect)())ce.forEachElem((function(e){e.style.flexBasis="auto"}));else{const t=ge.getProfileFlexBasis({forClientWidth:e});ce.forEachElem((function(e){e.style.flexBasis=`${t}%`}))}}let Ee=null;function Me(e,i,n){t.box_cache.getMorePaginatedEntries(Math.max(i,t.box_cache.nb_filter_results),(t=>{let i;if(fe){let e="";e=t.buildCookieCutterHtml(fe),i=document.createElement("div"),i.setAttribute("class","box-entry-overview-container"),i.setAttribute("id","emb-"+t.key),i.innerHTML=e}else i=ge.buildOverviewHtml(t,n,me);void 0!==i&&(u.Styling.applyButtonStyleTo({rootElem:i,withConfig:me}),u.Styling.applyParagraphStyleTo({rootElem:i,withConfig:me}),u.Styling.applyLocationStyleTo({rootElem:i,withConfig:me}),e.appendChild(i))})),ce.refresh("box-entry-overview-container");const o=document.querySelector("[cbeb-main-div]");if(o&&we(o.clientWidth),!1===t.box_cache.moreEntriesToShow()){const e=document.querySelector("[showmore-row]");e&&(e.style.visibility="hidden")}}function Te(e,t){if("popup"===t.config.overview_click_action()&&void 0!==e.bespokeDetailLink&&e.bespokeDetailLink.length>0)e.bespokeDetailLink.startsWith("http")?window.open(e.bespokeDetailLink,t.config.link_behaviour):window.open(`https://${e.bespokeDetailLink}`,t.config.link_behaviour);else{if(-1!==t.config.overview_click_action().indexOf("field-")){const i=t.config.overview_click_action().slice(6);if(e.hasValueForField(i)){const n=e.getValueOf(i);if(n&&n.length>0)return void(n.startsWith("http")?window.open(n,t.config.link_behaviour):window.open(`https://${n}`,t.config.link_behaviour))}}new j.profile_popup_dialog_box(t,(e=>{Se(e,t)})).showForEntry(e,t.template),xe=e.key}}function Ce(e,i){const n=t.box_cache.getEntry(e);n&&Te(n,i)}function ke(e,i){!0===t.box_cache.any_profile_fits_filter((i=>t.ebFilterManager.Filter(i,e.template)))?(t.box_cache.reflectFilterSettings((i=>t.ebFilterManager.Filter(i,e.template)),me,e.template),Ve(e),e.map.UpdateMarkers(t.box_cache.mapFiltered((e=>e))),e.toolbarContainer.setAttribute("search-active",""),i&&i.on_result&&i.on_result()):i&&i.on_no_result?(i.on_no_result(),t.box_cache.reflectFilterSettings((i=>t.ebFilterManager.Filter(i,e.template)),me,e.template),Ve(e)):W.Show({title:e.config.get_wording("search-fail-title"),msg:e.config.get_wording("search-fail-body"),btn_label:e.config.get_wording("search-fail-ack"),onClose:()=>{}})}function Se(e,i){t.ebFilterManager.updateCategoryFilter(e),ke(i)}function Le(e,i){t.box_cache.setPaginationLimit("none"),t.box_cache.resetPagination(),t.box_cache.reSortEntriesBy(me.ordering,i.template),t.ebFilterManager.clearAllFilters(),Ve(i),e()}let Ae,Ie=!1;function De(e){if("alwaysVisible"===e.config.mapConfiguration&&!1===e.config.hideMap||"onToggle"===e.config.mapConfiguration&&!0===Ie){const i=t.box_cache.map((e=>e));e.map.ReloadWith(i)}}function ze(e){if(e.length<15)return e;{const t=String.fromCharCode(8230);return`${(0,q.take)(Array.from(e),15).join("")}${t}`}}function Pe(e,i){switch(i){case"basic":return function(e,i){const n=V.input("cbeb-search-inputfield-basic",(()=>{}),"",{initialValue:`${t.ebFilterManager.GetFreeSearchTerm()}`,classes:["cbeb-search-inputfield"],placeholder:i.config.get_wording("saf-freetext-placeholder")});n.addEventListener("keydown",(e=>{if("Enter"===e.key){var o=n.value;t.ebFilterManager.updateFreeSearchTerm(o.split(" ")),ke(i)}}));const o=!1===e.for_desktop?V.button("","",(()=>{const e=n.value;t.ebFilterManager.updateFreeSearchTerm(e.split(" ")),ke(i)}),{design:"background-color:transparent; outline: none; border: none; flex-grow: 1; cursor: pointer;"}):void 0;return o&&o.appendChild(V.i({class:"fas fa-search"})),V.div("",[n,o],{classes:["cbeb-search-container"]})}({for_desktop:!1===(0,F.mobile_aspect)()},e);case"advanced":return function(e){const i=V.button("cb-open-search-dlg","",(()=>{X.Show()}),{classes:["cbeb-toolbar-button","cbeb-custom-clr-button"]});i.appendChild(V.i({class:"fas fa-search"})),!0!==(0,F.mobile_aspect)()?i.appendChild(V.span(me.toolbarBtnLabel("search"))):e.config.get_wording("saf-mobile-open-dlg-btn").length>0&&i.setAttribute("style",`--cb-open-search-dlg-btn-label: "${e.config.get_wording("saf-mobile-open-dlg-btn")}"`);const n=!1===me.hideToolbarBtn("tag",Oe())?V.button("","",(()=>{L.Show(e.template,me,t.box_cache,(i=>{t.ebFilterManager.updateCategoryFilter(i),ke(e)}))}),{classes:["cbeb-toolbar-button","cbeb-custom-clr-button"],design:`color: #${e.config.fgColourOf("button")}; background-color: #${e.config.bgColourOf("button")}; column-gap: 7px; font-family: "${e.config.fontFamily}";}`}):void 0;n&&(n.appendChild(V.i({class:"fas fa-tags"})),!0!==(0,F.mobile_aspect)()&&n.appendChild(V.span(e.config.toolbarBtnLabel("tag"))));const o=!1===(0,F.mobile_aspect)()&&!1===me.hideToolbarBtn("ordering",Oe())?function(e){return V.div("select-container",[V.select("entry-ordering",(i=e.template,[...i.fieldsOfType("category-input"),...i.fieldsOfType("single-line-text-input")].filter((e=>e&&e.label&&e.label.length>0)).filter((e=>!0===e.searchable)).sort(((e,t)=>e.label.localeCompare(t.label))).map((e=>({value:e.key,label:ze(e.label)})))),{dropdown_design:`font-family: "${e.config.fontFamily}";`,placeholder:e.config.toolbarBtnLabel("ordering"),on_selection_change:i=>{i&&window.setTimeout((()=>{!function(e,i){const n="most-recent"===e?{type:"most-recent"}:{type:"by-field",field:e};me.ordering.directory_ordering=n,t.box_cache.reSortEntriesBy(me.ordering,i.template),t.box_cache.reflectFilterSettings((e=>t.ebFilterManager.Filter(e,i.template)),i.config,i.template),Ve(i)}(i,e)}))}})],{classes:["cbeb-custom-clr-button"],design:`color: #${e.config.fgColourOf("button")}; background-color: #${e.config.bgColourOf("button")};`});var i}(e):void 0,r=function(e){const i=V.button("clear-search-filter","",(()=>{t.ebFilterManager.clearAllFilters(),t.box_cache.reflectFilterSettings((i=>t.ebFilterManager.Filter(i,e.template)),me,e.template),Ve(e),e.map.UpdateMarkers(t.box_cache.mapFiltered((e=>e))),e.toolbarContainer.removeAttribute("search-active")}),{classes:["cbeb-toolbar-button","cbeb-custom-clr-button"]});return i.appendChild(V.i({class:"fas fa-search-minus"})),!1===(0,F.mobile_aspect)()&&i.appendChild(V.span("Clear filter")),i}(e);return V.div("flexrow",[i,n,o,r],{design:"column-gap: 14px"})}(e)}}function Oe(){return null!=ve().cbeb_md}function Be(e,i){return new Promise(((n,r)=>{(0,p.PostRequest)({url:"https://api.communitybox.co/getboxcontents",payload:{boxID:e},callback:{onResult:r=>{r&&r.hasOwnProperty("details")&&(r.details.entries=r.details.entries.map((e=>("string"==typeof e.value&&(e.value=JSON.parse(e.value)),e))),o.BoxCache.ebUnpackFormat3IfNecessary(r.details),t.box_cache=new o.BoxCache(e,r.details,ye,t.ebFilterManager,me),t.box_cache.reSortEntriesBy({directory_ordering:{type:"most-recent"}},i),n())},onFailure:e=>{console.error(e)}}})}))}function je(e,t){const i=document.getElementById("cbeb-content-container");i.innerHTML='
',$e(),Be(e,t).then((()=>{!function(e){V.remove_all_child_elements_from(e.targetDiv);var t='
';t=(t+=['
','
','','','',"
","
"].join(""))+"
",e.targetDiv.innerHTML=t,u.Styling.applyAllStylesTo({rootElem:e.targetDiv,withConfig:me})}({userID:h.AuthCache.getMemberKey(),targetDiv:i})}))}async function Re(e){document.getElementById("cbeb-content-container").innerHTML='
',function(){const e=document.querySelector("#cbeb-map");e&&(e.style.display="none")}(),$e(),await Be(e.directory,e.template);const t=h.AuthCache.getMemberKey();void 0!==t&&Ge({member_key:t},e)}async function Fe(e,i){const n=t.box_cache.map((e=>e)).filter((t=>t.addedByKey===e));switch(n.length){case 0:Qe(i);break;case 1:Xe(n[0],i);break;default:Re(i)}}function Ne(){return me.isExampleBox}function Ue(){const e=window.location.href.split("?");return e.length>1?"?"+e[1].split("#")[0]:""}function Ve(e){Ze(e)}function $e(){const e=document.querySelector("[showmore-row]");null!==e&&null!==e.parentNode&&e.parentNode.removeChild(e)}function qe(e,t){return V.div("",[V.button("","Edit",(()=>{Xe(e,t)}),{classes:["cbeb-toolbar-button","cbeb-custom-clr-button"]}),V.button("","Delete",(()=>{!function(e,t){re.ShowForEntry({onDelete:()=>{Re(t)}},e,t.template,t.directory,ue.key)}(e,t)}),{classes:["cbeb-toolbar-button","cbeb-custom-clr-button"]})],{classes:["cbeb-act-button-group"]})}function Ge(e,i){V.remove_all_child_elements_from(i.contentContainer);const n=[];t.box_cache.for_ever_profile_owned_by_member(e.member_key,(e=>{const t=e.getDisplayNameForTemplate(i.template);var o,r;n.push({escapedName:(o=t,r=o,r=(r=r.replace(/"/gi,""")).replace(/'/gi,"’")),wrapper:e})}));const o=n.sort(((e,t)=>e.escapedName>t.escapedName?1:-1)),r=o.map((e=>function(e,t){return V.div("",[(i=e.escapedName,V.div("",[],{classes:["cbeb-act-name"],design:`color: #${me.fgColourOf("paragraph")}`,text:i})),qe(e.wrapper,t)],{classes:["cbeb-act-row"]});var i}(e,i)));i.contentContainer.appendChild(V.div("",[V.p("","Here you can edit your profiles. You can return to the directory at any time."),V.div("flex row",[V.button("cbeb-button","Return to directory",(()=>{Ye(i)}),{design:`background-color: #${i.config.bgColourOf("button")}`})]),...r],{classes:["cbeb-act-container"],design:`color: #${me.fgColourOf("paragraph")}`})),u.Styling.applyAllStylesTo({rootElem:i.contentContainer,withConfig:me})}function Ze(e){V.remove_all_child_elements_from(e.contentContainer);let i="";const n=Je()?.content_container;i+=void 0!==n?`
`:"
",i+="
",t.box_cache.moreEntriesToShow()&&me.showmoreEntryCount>0&&(i+=function(e){return`\n
\n\t\n
\n`}(e)),e.contentContainer.innerHTML=i,async function(e){if(null!=e.documentState.keyOfDirInCache)try{"free"===(await H.Directory.Lambda({request:"payment-status",directory:e.documentState.keyOfDirInCache})).status&&e.contentContainer.appendChild(V.div("cbeb-poweredby",[V.p("poweredby-footer-text","🔌 by"),V.anchor("poweredby-footer-text","Community Box","https://www.communitybox.co")]))}catch(e){console.error(e)}}(e),t.box_cache.resetPagination();const o=ge.build_top_row();var r;if(o&&Math.max(me.initialEntryCount,t.box_cache.nb_filter_results)>0&&e.contentContainer.querySelector("#cbeb-content-container").appendChild(o),Me(e.contentContainer.querySelector("#cbeb-content-container"),me.initialEntryCount,e.template),u.Styling.applyButtonStyleTo({rootElem:e.contentContainer,withConfig:me}),u.Styling.applyParagraphStyleTo({rootElem:e.contentContainer,withConfig:me}),u.Styling.applyLocationStyleTo({rootElem:e.contentContainer,withConfig:me}),0===e.contentContainer.clientWidth?window.setTimeout((()=>{we(e.contentContainer.clientWidth)}),500):we(e.contentContainer.clientWidth),(r=document.getElementById("privacy-policy"))&&r.addEventListener("click",(function(){ie.show()})),me.fgColourOf("paragraph")){var s=document.querySelectorAll("[cbeb-search-inputfield-basic]");for(let e=0;e{await Be(i.directory,i.template),Ve(i)},failureCallback:()=>{}})}async function Ye(e){await Be(e.directory,e.template),Ve(e),De(e)}function Ke(e){if(Ne())return void he.Show();const t=ve().cbeb_md;if(t&&!1===me.ignoreMemberspace)pe.show({onLogin:t=>{Fe(t,e)},identifier:t.u,community:ue,directory:e.directory,federated_auth:t.m});else{const t=h.AuthCache.getMemberKey();t?Fe(t,e):(h.AuthCache.getMemberKey(),ae.show({onLogin:t=>{Fe(t.member,e)},onFailure:e=>{console.error(e)}},ue,"manual",W))}}function Qe(e){if(Ne())he.Show();else{const t=ve().cbeb_md;t&&!1===me.ignoreMemberspace?h.AuthCache.hasValidAuth({no:()=>{t&&pe.show({onLogin:()=>{We(e)},identifier:t.u,community:ue,directory:e.directory,federated_auth:t.m})},yes:()=>{We(e)}}):h.AuthCache.hasValidAuth({no:()=>{le.Show({showTandC:()=>{se.Show((()=>{le.NowTryToSignup(e.directory,ue)}),me,ue)},allSignedUp:()=>{We(e)}},ue)},yes:()=>{We(e)}})}}function Je(){return!0===(0,F.mobile_aspect)()?me.get_layout({for_component:"mobile"}):me.get_layout({for_component:"overview"})}function et(e){let i=0;return t.box_cache.for_ever_profile_owned_by_member(e,(()=>{i++})),i}function tt(e,t,i){const n=e.split("?")[0];if("#cbeb-edit-profile"===n&&(window.location.hash="#",Ke(i)),"#cbeb-edit-m-profile"===n){if(e.split("?").length>1)return void console.log("bailing out of edit-m-profile flow because of query parameter");if(console.log("in edit-m-profile flow"),window.location.hash="#",Oe()){const e=ve().cbeb_md;e&&pe.show({onLogin:e=>{0===et(e)?Qe(i):Ke(i),A.DialogBoxMgr.hideAll()},identifier:e.u,community:ue,directory:i.directory,federated_auth:e.m})}else{const e=document.querySelector('a[href="https://members.freelancingfemales.com/member/sign_in"]');e&&e.click()}}if("#cbeb-add-or-edit-profile"===n){window.location.hash="#";const e=ve().cbeb_md;e&&(0,p.PostRequest)({stage:"cfapi",url:"/get/member/from/email",payload:{email:e.u,directory:i.directory},callback:{onResult:e=>{et(e.member_key)>0?Ke(i):Qe(i)},onFailure:()=>{Qe(i)}}})}"#cbeb-add-profile"===n&&(window.location.hash="#",Qe(i)),"#cbeb-launch-search"===n&&(window.location.hash="#",nt(i)),"#cbeb-clear-search"===n&&(window.location.hash="#",Le(t,i)),"#cbeb-show-search-options"===n&&(window.location.hash="#directory",X.Show())}function it(e){for(const t of e.template.fieldsOfType("category-input")){const i=document.body.querySelector(`[cbeb-detached-category-search="${t}"]`);i&&e.template.forEachTagInCategory(t.key,(e=>{const t=document.createElement("option");t.value=e,t.text=e,i.appendChild(t)}))}const t=document.body.querySelector("button[cbeb-launch-filter]");t&&t.addEventListener("click",(function(){nt(e)}))}function nt(e){const i=new Set(e.template.fieldsOfType("category-input").map((e=>`[cbeb-detached-category-search="${e}"]`)).map((e=>{const t=document.body.querySelector(e);return null==t?null:t.value})).filter((e=>null!=e)).filter((e=>"default"!==e))),n=document.body.querySelector("[cbeb-detached-free-text-search]");n&&t.ebFilterManager.updateFreeSearchTerm([...n.value.split(" ")]);const o=e.template.fieldsOfType("category-input").map((e=>[e.key,i]));t.ebFilterManager.updateCategoryFilter(new Map(o)),ke(e)}function ot(e){return"inherit"===e||"transparent"===e?e:`#${e}`}function rt(e,i,n,u){Ue().toLowerCase().startsWith("?tags=")&&(ye=new Set(Ue().split("=")[1].split(",").map((e=>decodeURIComponent(e))).map((e=>e.startsWith("tagref-")?atob(e.slice(7)):e))));const p=V.div((!0===(0,F.mobile_aspect)()?"mobile":"desktop")+" toolbar",[]),y=V.div("flexcol",[]),v=V.div("flexcol",[]);V.remove_all_child_elements_from(n),n.appendChild(p),n.appendChild(y),n.appendChild(v),o.BoxCache.ebUnpackFormat3IfNecessary(e);const L=new s.TemplateWrapper(e.templateEntries,e.templateDefinition),j=new a.BoxConfigWrapper(e,(N=i.attributes,Array.prototype.slice.call(N).reduce(((e,t)=>(e[t.name]=t.value,e)),{})),i);var N;t.ebFilterManager=new r.FilterManager(j),te=new E.ResetPwDialogBox(j),function(e){[["--cb-button-fg-col",ot(e.fgColourOf("button"))],["--cb-button-bg-col",ot(e.bgColourOf("button"))],["--cb-button-font-family",ot(e.fontFamily)],["--cb-readmore-fg-col",ot(e.fgColourOf("social_media"))]].forEach((e=>document.documentElement.style.setProperty(e[0],e[1])))}(j),j.preFilterTagsForThisPage(window.location.href).size>0&&(ye=j.preFilterTagsForThisPage(window.location.href)),t.box_cache=new o.BoxCache(u,e,ye,t.ebFilterManager,j),e.hasOwnProperty("layout")&&j.override_layout(e.layout),e.hasOwnProperty("filter_bar")&&j.override_filter_bar(e.filter_bar),e.hasOwnProperty("map_and_loc_config")&&j.override_map_and_loc_config(e.map_and_loc_config);const q=i.hasAttribute("buttons")?i.getAttribute("buttons").split(",").map((e=>e.toLowerCase())):void 0;q&&j.overrideButtonConfig(q),me=j;const H={contentContainer:v,mapContainer:y,toolbarContainer:p,directory:u,config:j,template:L,documentState:ve(),map:new G.PlaceholderMap};var ce,be,ze;H.map=function(e){if("string"==typeof g_allow_google_map&&"true"===g_allow_google_map)return new G.GoogleMap(e);const t=ve().mbk;return t?new G.MapboxMap(e,t):new G.PlaceholderMap}(H),ge=function(e,t){const i=Je();if(i)return new R.layout_builder(me,i,t.template,(e=>{Se(e,t)}),(e=>{Ce(e,t)}));switch(e){default:case"default":return new O.DefaultOverviewBuilder;case"horizontal":return new B.ListOverviewBuilder}}(j.overviewDesign,H),t.box_cache.reSortEntriesBy(j.ordering,L),_e=e.communityID,(ce=document.createElement("style"))&&(ce.innerHTML=[".cbeb-modal-content::-webkit-scrollbar-track","{","background-color: #fcfcfc;","}",".cbeb-modal-content::-webkit-scrollbar","{","background-color: #fcfcfc;","}",".cbeb-modal-content::-webkit-scrollbar-thumb","{","\tbackground-color: #"+me.bgColourOf("dialog_title")+";","\tborder: 0;","}"].join(" "),document.body.appendChild(ce)),!1===i.hasAttribute("font_type")&&(void 0!==(be={to:i,withConfig:j}).withConfig.fontFamily?be.to.style.fontFamily=be.withConfig.fontFamily:be.to.style.fontFamily="quicksand",void 0!==be.withConfig.fontWeight&&(be.to.style.fontWeight=be.withConfig.fontWeight)),e.hasOwnProperty("cookiecutter")&&(fe=new l.CookieCutterTemplate(e.cookiecutter)),re=new b.DeleteDialogBox(j),ue=new c.CommunityCache(_e,e.community),(ze=(0,U.extract_query_param_from)(Ue())).hasOwnProperty("authID")&&ze.hasOwnProperty("validationToken")&&oe.show(j),function(){var e=(0,U.extract_query_param_from)(Ue());return e.hasOwnProperty("authID")&&e.hasOwnProperty("pwResetValidationToken")}()&&te.show(j),function(){document.querySelector("[signup][dialogbox] [welcome-msg]").innerHTML=ue.GetSignupMsg().replace(/\n/,"
");const e=ue.GetGDPROptinMsg();e.length>0?document.getElementById("cbeb-gdpr-optin-label").innerHTML=e:document.querySelector("[gdpr-optin-container]").style.visibility="hidden"}(),le=new _.SignupDialogBox(j,ue);const Re=ve().cbeb_md;ae=new m.LoginDialogBox(j,ue,u,Re?.m),ee=new M.send_pw_reset_link_dlg(u,j),Q=new d.ConnectionDialogBox,J=new T.ShareEntryDialogBox(j),K=new C.InvitationLookupDlgBox(ue,H,He,We),X=new k.FilterAndSearchDlg(H,t.ebFilterManager,ke,t.box_cache),Y=new S.ConnectionLookupDialogBox(j),W=new D.MsgDialogBox(document.body,j),z.Init(j,i),P.Init(j,i),de=new f.AddEntryDialogBox(H,ue.key,{onAdded:e=>{!async function(e){me.postAddEntry?W.Show({title:me.postAddEntry.title,msg:me.postAddEntry.text,btn_label:"Okay",onClose:()=>{void 0!==me.postAddEntry?.redirect?window.location.href=me.postAddEntry.redirect:Be(e.directory,e.template).then((()=>{Ve(e)}))}}):(await Be(e.directory,e.template),Ve(e))}(H)},onFailure:e=>{console.error(e)}}),ne=new x.EditEntryDialogBox(H),ie=new w.PrivacyPolicyDlgBox(j),he=new g.ExampleBox(j),pe=new I.MemberSpaceAutoLoginDlg(j);const Fe=window.location.hostname.toLowerCase();void 0===Fe||!0===j.domainAllowed(Fe)?(function(e){V.remove_all_child_elements_from(e.toolbarContainer),"none"!==e.config.searchType&&e.toolbarContainer.appendChild(Pe(e,e.config.searchType)),!1===(0,F.mobile_aspect)()&&e.toolbarContainer.appendChild(V.div("flexrow grow",[])),e.toolbarContainer.appendChild(function(e){const t=`color: #${e.config.fgColourOf("button")};\nbackground-color: #${e.config.bgColourOf("button")};\ncolumn-gap: 7px;\nfont-family: ${e.config.fontFamily};`,i=V.div("flexrow",[],{design:"column-gap: 14px;"});if(!1===e.config.hideMap&&"onToggle"===me.mapConfiguration){const n=V.i({class:"fas fa-map-marker-alt cbeb-toolbar-btnlabel"}),o=V.button("toggle-map-btn","",(()=>{!function(e,t){if(!1===Ie){V.remove_all_child_elements_from(t.contentContainer);const i=V.div("cbeb-map",[],{key:"cbeb-map"});t.mapContainer.appendChild(i),Ie=!Ie,De(t),e.classList.remove("fa-map-marker-alt"),e.classList.add("fa-user-circle")}else Ie=!Ie,V.remove_all_child_elements_from(t.mapContainer),Ve(t),e.classList.remove("fa-user-circle"),e.classList.add("fa-map-marker-alt")}(n,e)}),{classes:["cbeb-toolbar-button","cbeb-custom-clr-button"],design:t});o.appendChild(n),!0!==(0,F.mobile_aspect)()&&o.appendChild(V.span(me.toolbarBtnLabel("map_toggle"))),i.appendChild(o)}if(!1===me.hideToolbarBtn("add_entry",Oe())){const n=V.button("add-entry-btn","",(()=>{Qe(e)}),{classes:["cbeb-toolbar-button","cbeb-custom-clr-button"],design:t});n.appendChild(V.i({class:"fas fa-plus cbeb-toolbar-btnlabel-plus"})),!0!==(0,F.mobile_aspect)()&&n.appendChild(V.span(me.toolbarBtnLabel("add_entry"))),i.appendChild(n)}if(!1===me.hideToolbarBtn("edit_entry",Oe())){const n=V.button("edit-entry-btn","",(()=>{Ke(e)}),{classes:["cbeb-toolbar-button","cbeb-custom-clr-button"],design:t});n.appendChild(V.i({class:"fas fa-pencil-alt cbeb-toolbar-btnlabel"})),!0!==(0,F.mobile_aspect)()&&n.appendChild(V.span(me.toolbarBtnLabel("edit_entry"))),i.appendChild(n)}if(!1===me.hideToolbarBtn("account",Oe())){const n=V.button("","",(()=>{const t=document.getElementById("cbeb-content-container");h.AuthCache.hasValidAuth({no:()=>{ae.show({onLogin:()=>{je(e.directory,e.template)},onFailure:e=>{console.error(e)}},ue,ve().cbeb_md?.m||"manual",W)},yes:()=>{t.innerHTML='
',je(e.directory,e.template)}})}),{classes:["cbeb-toolbar-button","cbeb-custom-clr-button"],design:t});n.appendChild(V.i({class:"fas fa-cog cbeb-toolbar-btnlabel"})),!0!==(0,F.mobile_aspect)()&&n.appendChild(V.span(me.toolbarBtnLabel("account"))),i.appendChild(n)}return i}(e))}(H),Ze(H)):function(e,t){const i=-1!==window.location.href.indexOf("localhost")?"localhost:4000":"account.communitybox.co";V.remove_all_child_elements_from(e),e.appendChild(V.div("maperrorcontainer",[V.h(3,"Unregistered Domain")])),e.appendChild(V.div("maperrorcontainer",[V.p("",`The current domain ${t} has not been registered.`),V.anchor("",`Register it at https://${i}/domains`,`https://${i}/domains`,{open_in_new_tab:"yes",design:"pointer-events: all !important;"})]))}(n,Fe);const Ne=at(H,t.box_cache,L,(0,F.mobile_aspect)()?"mobile":"desktop");if(function(e,t,i){e.addEventListener("click",(function(e){e.target.matches("[clear-search-filter], [clear-search-filter] > *")&&Le(t,i)}))}(n,Ne.clear_filters,H),it(H),function(e){const t=document.body.querySelector("button[cbeb-detached-add-entry-btn]");t&&t.addEventListener("click",(()=>{h.AuthCache.hasValidAuth({no:()=>{const t=ve().cbeb_md;ae.show({onLogin:()=>{We(e)},onFailure:e=>{console.error(e)}},ue,t?.m||"manual",W)},yes:()=>{We(e)}})}))}(H),function(e,t){window.addEventListener("hashchange",(function(){"true"===(0,$.read_cookie)("post_m_signup")?((0,$.write_cookie)("post_m_signup","false"),tt("#cbeb-edit-m-profile",e,t)):tt(window.location.hash,e,t)}))}(Ne.clear_filters,H),function(){const e=document.body.querySelector("[cbeb-detached-search-button]");e&&e.addEventListener("click",(function(){X.Show()}))}(),function(){var e=(0,U.extract_query_param_from)(Ue());return e.hasOwnProperty("memberKey")&&e.hasOwnProperty("invitationToken")}()){let e=(0,U.extract_query_param_from)(Ue());K.Show({memberKey:e.memberKey,invitationToken:e.invitationToken},j)}if(function(){var e=(0,U.extract_query_param_from)(Ue());return e.hasOwnProperty("memberKey")&&e.hasOwnProperty("connectionToken")}()){let e=(0,U.extract_query_param_from)(Ue());Y.Show({destinationKey:e.memberKey,connectionToken:e.connectionToken})}if(function(){const e=(0,U.extract_query_param_from)(Ue());return-1!==window.location.href.indexOf("wishlist")&&console.log({qp:e}),e.hasOwnProperty("entryKey")}()){const e=(0,U.extract_query_param_from)(Ue());if(!0===j.memberspaceConfig().restrictPopupToOnlyLoggedInMembers){if("object"==typeof MemberSpace&&null!=MemberSpace&&!0===MemberSpace.ready&&MemberSpace.getMemberInfo&&"function"==typeof MemberSpace.getMemberInfo){const t=MemberSpace.getMemberInfo();null!=t&&!0===t.isLoggedIn&&Ce(e.entryKey,H)}}else Ce(e.entryKey,H)}if("?signup"===Ue().toLowerCase()&&Qe(H),-1!==window.location.href.indexOf("#confirm-account")&&window.setTimeout((()=>{ee.show({title:j.get_wording("claim-profile-dlg-title"),greeting:j.get_wording("claim-profile-dlg-greeting"),congratulations:j.get_wording("claim-profile-dlg-congrat"),okay_btn_label:j.get_wording("claim-profile-ok-btn-label"),config:j,context:"confirm-account"})})),"true"===(0,$.read_cookie)("post_m_signup")?((0,$.write_cookie)("post_m_signup","false"),tt("#cbeb-edit-m-profile",Ne.clear_filters,H)):window.location.hash.length>1&&tt(window.location.hash,Ne.clear_filters,H),!0===function(){const e=(0,U.extract_query_param_from)(Ue());return"text"in e||"region"in e||"location"in e||"ctags"in e||"lat"in e&&"lng"in e||(t=e,Object.keys(t).filter((e=>e.startsWith("category-filter-"))).length>0);var t}()){const e=(0,U.extract_query_param_from)(Ue());if("text"in e&&t.ebFilterManager.updateFreeSearchTerm(e.text.split(" ")),"region"in e&&t.ebFilterManager.update_region(e.region),"location"in e){const[i,n]=e.location.split(",");t.ebFilterManager.updateProximityFilter({lat:Number(i),lng:Number(n)},me.default_proximity_distance)}"lng"in e&&"lat"in e&&t.ebFilterManager.updateProximityFilter({lat:Number(e.lat),lng:Number(e.lng)},"radius"in e?Number(e.radius):me.default_proximity_distance);{const i=new Map;for(const t in e)if(t.startsWith("category-filter-")){const n=decodeURIComponent(e[t]);i.set(t.slice(16),new Set(n.split(",")))}t.ebFilterManager.updateCategoryFilter(i)}"ctags"in e&&t.ebFilterManager.AddHierarchicalTagsToFilter(e.ctags.split(",")),ke(H)}!function(){const e=document.body.querySelectorAll("button[toggle-password-visibility]");for(let t=0;t
'):(e.setAttribute("type","password"),this.innerHTML='')}}))}(),function(e,i){e.addEventListener("click",(function(e){const n=e.target;if(n.matches("[show-overview-on-click], [show-overview-on-click] > *")){const e=t.box_cache.getEntry(n.getAttribute("entryKey"));e&&Te(e,i)}}))}(v,H),document.addEventListener("click",(function(e){e.target.matches("[close-dialog-btn], [close-dialog-btn] > *")&&A.DialogBoxMgr.close()})),function(e,t){e.addEventListener("click",(function(e){e.target.matches("[present-content-btn], [present-content-btn] > *")&&Ye(t)}))}(v,H),function(e,t){e.addEventListener("click",(function(e){e.target.matches("[logout], [logout] > *")&&function(e){h.AuthCache.clearCredentials(),Ve(e)}(t)}))}(v,H),function(e,t){e.addEventListener("click",(function(e){e.target.matches("[show-forgot-pw-dlg], [show-forgot-pw-dlg] > *")&&ee.show({config:t,title:t.get_wording("recover_pw_title"),greeting:t.get_wording("recover_pw_greeting"),congratulations:t.get_wording("pw_recovery_email_sent"),okay_btn_label:t.get_wording("send_recovery_link_btn"),context:"forgot-password"})}))}(document.body,j),document.addEventListener("click",(function(e){e.target.matches("[close-dialog-and-redirect-btn], [close-dialog-and-redirect-btn] > *")&&(A.DialogBoxMgr.close(),window.location.href=function(e){const t=e.indexOf("?");return e.substring(0,-1===t?e.length:t)}(window.location.href))})),function(e,t){e.addEventListener("click",(function(e){e.target.matches("[show-login-dlg], [show-login-dlg] > *")&&(A.DialogBoxMgr.hideAll(),ae.show({onLogin:e=>{Ge({member_key:e.member},t),A.DialogBoxMgr.hideAll()},onFailure:e=>{}},ue,ve().cbeb_md?.m||"manual",W))}))}(document.body,H),function(e){document.addEventListener("click",(function(t){t.target.matches("button[signup-dlg], button[signup-dlg] > *")&&(A.DialogBoxMgr.hideAll(),le.Show({showTandC:()=>{se.Show((()=>{le.NowTryToSignup(e.directory,ue)}),me,ue)},allSignedUp:()=>{We(e)}},ue))}))}(H),function(e,t){e.addEventListener("click",(function(i){i.target.matches("[showmore]")&&Me(e.querySelector("#cbeb-content-container"),me.showmoreEntryCount,t)}))}(v,L),function(e){document.addEventListener("click",(function(i){if(i.target.matches("[display-share-entry-dlg], [display-share-entry-dlg] > *")){const n=i.target.getAttribute("entryKey"),o=t.box_cache.getEntry(n);if(o)return void J.ShowFor(o,e.config,e.template);if(xe){const i=t.box_cache.getEntry(xe);if(i)return void(0,Z.handle_sharing_req)(i,e.config,e.template)}}}))}(H),function(e,i,n){e.addEventListener("click",(function(e){if(e.target.matches("[connect], [connect] > *")){const o=e.target.getAttribute("entryKey"),r=t.box_cache.getEntry(o);r&&Q.showForEntry(r,n,me,i)}}))}(v,u,L),function(e,i){e.addEventListener("click",(function(e){if(e.target.matches("[tag-button], [tag-button] > *")){const n=e.target,o=n.getAttribute("tag"),r=n.getAttribute("categoryKey");r&&(t.ebFilterManager.updateCategoryFilter(new Map([[r,new Set([o])]])),ke(i))}}))}(v,H),function(e,i){let n=(0,F.mobile_aspect)();Ee=new ResizeObserver((o=>{o.length>0&&(we(e.clientWidth),n!==(0,F.mobile_aspect)()&&(n=(0,F.mobile_aspect)(),Ve(i),at(i,t.box_cache,i.template,(0,F.mobile_aspect)()?"mobile":"desktop")),void 0!==Ae&&Ae.resize())})),Ee.observe(e)}(i,H),De(H)}function st(e){return(i,n)=>{if(n&&n.destination.length>0&&!1===n.destination.startsWith("#")){const e=document.createElement("a");if(e.href=n.destination,(0,q.Trim)(e.pathname,"/")!==(0,q.Trim)(window.location.pathname,"/"))return void(window.location.href=`${n.destination}/?${i}`)}const o=i.split("&");t.ebFilterManager.clearAllFilters();for(const i of o){const[n,o]=decodeURIComponent(i).split("=");switch(n){case"ctags":t.ebFilterManager.AddHierarchicalTagsToFilter(o.split(","));break;case"region":t.ebFilterManager.update_region(o);break;case"text":t.ebFilterManager.updateFreeSearchTerm([o]);break;case"location":{const i=o.split(",");t.ebFilterManager.updateProximityFilter({lat:Number(i[0]),lng:Number(i[1])},e.config.default_proximity_distance)}break;default:if(null!=o){const e=n.slice(16);t.ebFilterManager.add_to_category_filter(e,o)}}}if(ke(e,n),n&&!0===n.destination.startsWith("#")){const e=document.querySelector(`[name="${n.destination.replace("#","")}"]`);e&&e.scrollIntoView({block:"start",behavior:"smooth"})}}}function at(e,t,i,n){return(0,N.initialise_filter_bar)({config:e.config,directory:t,template:i,aspect:n,launch_search:st(e),documentState:ve(),queryParam:(0,U.extract_query_param_from)(Ue())})}function lt(e){return new Promise((t=>{window.setTimeout((()=>{t()}),e)}))}function ct(e,t,i){if(H.Telemetry.Lambda({request:"directory load",directory:i,origin:window.location.href}),!0===ve().expectCache)!async function(e,t,i){await async function(){for(;null==ve().cache;)await lt(100)}();const n=ve().cache;if(null==n)return void console.log("Cannot proceed with OldSchoolInit as document-wide database not yet available");const o=await(r=n.details.communityID,new Promise(((e,t)=>{const i={communityID:r},n=new XMLHttpRequest;n.open("POST","https://api.communitybox.co/get/community/parameters",!0),n.setRequestHeader("Content-type","application/json; charset=utf-8"),n.onload=function(){if(4===n.readyState&&200===n.status){var i=JSON.parse(n.responseText);i&&i.hasOwnProperty("parameters")?e(i.parameters):t(n.responseText)}else t(n.responseText)},n.send(JSON.stringify(i))})));var r;n.details.community=o,rt(n.details,e,t,i)}(e,t,i);else{const n=ve().cache;n?rt(n.details,e,t,i):window.setTimeout((()=>ct(e,t,i)),500)}}function ut(e){const t=e||document.getElementById("communitybox-target");if(t){if(!t||!1!==t.hasAttribute("initialised"))return;ht&&ht.disconnect(),t.removeAttribute("uninitialised"),t.setAttribute("initialised","");{const e=document.querySelector("[cbeb-filter-bar]")||document.querySelector("[communitybox-search-bar]");e&&e.setAttribute("initialised","")}(function(e){const t=document.getElementById("communitybox-target");t.innerHTML=e,["[tag-filter][dialogbox]","[filter-and-search]","[m-auto-login-dlg]","#cbeb-rpw-modal","#cbeb-connection-modal","#cbeb-view-entry-modal","#cbeb-add-entry-modal","#cbeb-edit-entry-modal","#cbeb-delete-entry-modal","#cbeb-login-modal","#cbeb-signup-modal","#cbeb-tc-modal"].forEach((e=>{const i=t.querySelector(e);document.body.appendChild(i)}))})(be),function(){const e=document.querySelector("[cbeb-main-div]");e.innerHTML='
';const t=document.getElementById("communitybox-target"),i=t.getAttribute("box");ye=t.hasAttribute("tags")?new Set(t.getAttribute("tags").split(",").map((e=>e.toLowerCase()))):new Set,ce=new n.OverviewElemCache,oe=new v.ConfirmEmailDialogBox,se=new y.TandCDialogBox,h.AuthCache.hasValidAuth({yes:()=>{},no:function(){h.AuthCache.clearCredentials()}}),ct(t,e,i)}()}const i=document.querySelector("[cbeb-filter-bar]")||document.querySelector("[communitybox-search-bar]");i&&!1===i.hasAttribute("initialised")&&(i.setAttribute("initialised",""),dt(i))}function dt(e){const i=ve().cache;i?function(e,i){const n=e.getAttribute("directory");o.BoxCache.ebUnpackFormat3IfNecessary(i);const r=new s.TemplateWrapper(i.templateEntries,i.templateDefinition),l=new a.BoxConfigWrapper(i,{},e),c={template:r,config:l,directory:n,toolbarContainer:document.querySelector("div[toolbar]"),contentContainer:document.querySelector("div[main-div]"),mapContainer:V.div("",[]),documentState:ve(),map:new G.PlaceholderMap};e.hasAttribute("communitybox-search-bar")?it(c):(i.hasOwnProperty("filter_bar")&&l.override_filter_bar(i.filter_bar),at(c,new o.BoxCache(n,i,new Set,t.ebFilterManager,l),r,(0,F.mobile_aspect)()?"mobile":"desktop"))}(e,i.details):window.setTimeout((()=>dt(e)),500)}be=["",'
',"","\t\t\t\t\t\t\x3c!-- Signup dialog box --\x3e",'
','
','
','
Sign Up
','
Sign up
','
Cancel
',"
",'
','\t\t\t\t\t\t\t\t\t
',"
",'
',"\t\t\t\t\t\t\t\t\t\tAlready have an account?",'\t\t\t\t\t\t\t\t\t\tYou can log in here.',"\t
","",'\t\t\t\t\t\t\t\t
','\t\t\t\t\t
','\t\t\t\t\t\t \t\t \t
email address
','\t
','\t\t ',"\t\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t
","",'\t\t\t\t\t\t\t\t
','\t\t\t\t
','\t\t\t\t\t \t\t \t
password
',"
",'\t ','',"\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t
","",'\t\t\t\t\t\t\t\t
','\t\t\t\t\t
','\t
','\t\t\t\t\t\t\t\t\t\t \t ','\t\t\t\t\t\t\t\t\t\t\t
','\t\t\t ',"\t\t\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t
","",'\t\t\t\t\t
','\t\t\t\t\t\t
Sign Up
','\t\t\t\t\t\t
Cancel
',"\t\t\t\t\t
","\t\t\t\t\t\t
","",'\t\t\t\t\t\t
',"",'\t\t\t\t\t\t
','\t\t\t\t\t\t \t
',"\t\t\t\t\t\t\t
",'\t\t\t\t\t
','\t\t\t\t\t
Try Again
','\t\t\t\t\t
Cancel
',"\t\t\t\t\t\t\t
","\t\t\t\t\t\t
","\t\t\t\t\t
","\t\t\t\t
","","\t\t\t\t\t\t\x3c!-- Login dialog box --\x3e",'
','
','
','
Log In
','
Log In
','
Cancel
',"
",'
',"

","

Don't have an account? It's quick and easy to !

","",'\t\t\t\t\t\t\t\t
','\t\t\t\t\t
','\t\t\t\t\t\t \t\t \t
email address
','\t
','\t\t ',"\t\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t
","",'\t\t\t\t\t\t\t\t
','\t\t\t\t
','\t\t\t\t\t \t\t \t
password
',"
",'\t ','',"\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t
","","\t\t\t\t\t\t\t
",'\t\t\t\t\t\t
','\t\t\t\t\t\t\t
Login
','\t\t\t\t\t\t\t
Cancel
',"\t\t\t\t\t\t
",'\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t\t\tforgot password?',"\t\t\t\t\t\t\t\t
","","\t\t\t\t\t\t
","",'\t\t\t\t\t\t
',"",'\t\t\t\t\t\t
','\t\t\t\t\t\t \t
',"\t\t\t\t\t\t\t
",'\t\t\t\t\t
','\t\t\t\t\t
Try Again
','\t\t\t\t\t
Cancel
',"\t\t\t\t\t\t\t
","\t\t\t\t\t\t
","\t\t\t\t\t
","\t\t\t\t
","\t\t\t\t\t\t\x3c!-- Password-reset dialog box --\x3e",'\t\t\t\t\t
','\t\t\t\t\t
','\t\t\t\t\t
','\t\t\t\t\t
Reset Password
','\t\t\t\t\t ','\t\t\t\t\t ','\t\t\t\t\t ','\t\t\t\t\t ',"\t\t\t\t\t ","\t\t\t\t\t ","\t\t\t\t\t
",'\t\t\t\t\t
','\t\t\t\t\t
',"\t\t\t\t\t Please enter your new password below.","\t\t\t\t\t
",'\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t
','\t\t\t\t\t\t
','\t\t\t\t\t\t
new password
','\t\t\t\t\t\t
','\t\t\t\t\t\t ',"\t\t\t\t\t\t
","\t\t\t\t\t\t
","\t\t\t\t\t\t
",'\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t
new password (again)
','\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t
","\t\t\t\t\t\t
","\t\t\t\t\t\t\t
","",'\t\t\t\t\t
','\t\t\t\t\t
Reset
','\t\t\t\t\t
Cancel
',"\t\t\t\t\t
","",'\t\t\t\t\t
',"",'\t\t\t\t\t
','\t\t\t\t\t
',"\t\t\t\t\t
",'\t\t\t\t\t
','\t\t\t\t\t
Try Again
','\t\t\t\t\t
Cancel
',"\t\t\t\t\t
","\t\t\t\t\t
","\t\t\t\t\t
","\t\t\t\t\t
","","","\t\t\t\t\t \x3c!-- Add-entry dialog box --\x3e",'
','
','
','
Add Entry
',"
",'
','\t\t\t\t\t\t\t\t
',"
","
","","","\t\t\t\t\t \x3c!-- Edit-entry dialog box --\x3e",'
','
','
','
Edit Entry
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t","\t\t\t\t\t\t\t\t\t","
",'
','\t\t\t\t\t\t\t\t
',"
","
","","",'\n\x3c!-- MemberSpace auto-login/signup dialog box --\x3e\n
\n
\n
\n
Please wait...
\n
\n
\n

Loading profile...

\n
\n
\n \n
\n
\n
\n',"","","\t\t\t\t\t \x3c!-- View-entry dialog box --\x3e",'
','
','
','
Details
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t","\t\t\t\t\t\t\t\t\t","
",'
',"
","
","
","","\t\t\t\t\t \x3c!-- Connection dialog box --\x3e",'
','
','
','
Details
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t","\t\t\t\t\t\t\t\t\t","
","
","
","\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t

Requesting connection...

",'\t\t\t\t\t\t\t\t\t
',"\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t
","
","
","","\t\t\t\t\t \x3c!-- Connection lookup dialog box --\x3e",'
','
','
','
Connection request
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t","\t\t\t\t\t\t\t\t\t","
","\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t

Fetching connection details...

",'\t\t\t\t\t\t\t\t\t
',"\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t

The person wishing to contact you is",'\t\t\t\t\t\t\t\t\t\t',"\t\t\t\t\t\t\t\t\t

","\t\t\t\t\t\t\t\t
","
","
","","\t\t\t\t\t \x3c!-- Share-entry dialog box --\x3e",'
','
','
','
Share this story
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t","\t\t\t\t\t\t\t\t\t","
","\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t
","
","
","","","\t\t\t\t\t \x3c!-- Invitation lookup dialog box --\x3e",'
','
','
','
Invitation
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t","\t\t\t\t\t\t\t\t\t","
","
","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t\t

Looking up invitation details 🔍...

",'\t\t\t\t\t\t\t\t\t\t
',"\t\t\t\t\t\t\t\t\t
","","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t\t

Signing up...📋

",'\t\t\t\t\t\t\t\t\t\t
',"\t\t\t\t\t\t\t\t\t
","","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t\t

Welcome, ! Please fill in the fields","\t\t\t\t\t\t\t\t\t\tbelow to complete your registration.

","\t\t\t\t\t\t\t\t\t\t",'\t\t\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t\t\t\t\t\t
password
','\t\t\t\t\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t\t\t\t\t\t\t',"\t\t\t\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t\t
","",'\t\t\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t\t\t\t\t\t\t\t',"\t\t\t\t\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t\t
","",'\t\t\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t\t\t\t\t',"\t\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t
","
","
","
","","\t\t\t\t\t \x3c!-- Advanced-search dialog box --\x3e",'
','
','
','
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t"," ","
","
","
","
","
"," Text","
","
","
","
","
"," Search directory for mentions of:","
",' ',"
","
","
","
","
","
"," Location","
","
","
","
","
"," Placename","
",'
','',"
"," ","
","
"," Range of search","
"," ","
","
","
","
","
","
"," Categories","
","
","
","
","
","
","
","
","
","
","
","
","
",'\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t
Search
','\t\t\t\t\t\t\t
Cancel
',"\t\t\t\t\t\t\t\t\t
","
","
","",'\n \x3c!-- Tag filter/search dialog box --\x3e\n
\n
\n \n
\n
Filter
\n \n
\n \n
\n \n
\n\n
\n
\n\n
\n
\n',"\t\t\t\t\t \x3c!-- Delete-entry dialog box --\x3e",'
','
','
','
Confirm deletion
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t"," ","
",'
','\t\t\t\t\t\t\t\t\t
',"\t
",'\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t
","
",'\t\t\t\t\t\t\t\t
',"
","
","","\t\t\t\t\t \x3c!-- Accept-T&C dialog box --\x3e",'
','
','
','
Community Guidelines
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t","\t\t\t\t\t\t\t\t\t","
",'
',"",'\t\t\t\t\t\t\t\t\t
',"\t\t\t\t\t\t\t\t\t\tPlease read through, and agree, to the following Community Guidelines.","\t
","",'\t\t\t\t\t\t\t\t\t
',"\t\t\t\t\t\t\t\t\t\tWe want to create a friendly and tolerant community that is safe for everyone. Please don't add anything that infringes on other people's copyright, violates any laws, includes images of an exploitative or sexual nature, promotes hate speech or intolerance or discriminates against groups or individuals based on their gender, race, ethnicity or sexual orientation.","\t\t\t\t\t\t\t\t\t
","",'\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t
Agree
','\t\t\t\t\t\t\t
Cancel
',"\t\t\t\t\t\t\t\t\t
","","
","
","
","","","\t\t\t\t\t \x3c!-- Confirm-email dialog box --\x3e",'
','
','
','
Confirm email
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t","\t\t\t\t\t\t\t\t\t","
",'
','\t\t\t\t\t\t\t\t\t
',"\t\t\t\t\t\t\t\t\t\tValidating your email address, please wait...","\t
",'\t\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t
","
","
","
","","\t\t\t\t\t \x3c!-- Example add-entry dialog box --\x3e",'
','
','
','
Demo Box 🎁
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t","\t\t\t\t\t\t\t\t\t","
",'
','\t\t\t\t\t\t\t\t\t
',"\t\t\t\t\t\t\t\t\t\tYou're currently viewing one of our demo listings! To set up a directory for your own Community free of charge,",'\t\t\t\t\t\t\t\t\t\tsimply head over to our website and sign up. We can\'t wait',"\t\t\t\t\t\t\t\t\t\tto help you grow your community 🌱 🚿","\t
",'\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t
Okay
',"\t\t\t\t\t\t\t\t\t
","
","
","
","","\t\t\t\t\t \x3c!-- Privacy Policy dialog box --\x3e",'
','
','
','
Privacy Policy
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t","\t\t\t\t\t\t\t\t\t","
",'
','\t\t\t\t\t\t\t\t\t
',"\t\t\t\t\t\t\t\t\t

"," In the following Policy,","

",' "We" refers to Fraction 7, Ltd, makers of Community Box',"

"," 1. What data we store on your device","

",' We may store "cookies" on your device. These enable us to customise the directory experience for you. We do not use them to track you or otherwise gain information about you.',"

"," 2. What we track","

"," We monitor activity in, and uploads to, Boxes. This is both to ensure there are no violations of the Terms and Conditions, or in order to comply with requests from law enforcement or other authorised government agencies.","

"," 3. What data we store","

"," We store any data that is necessary for the display and processing of a Box (e.g., the box contents themselves, and any settings or customisations that have been made to the Boxes). We also store your contact details so that we can get in touch with you for purposes in connection with the business. We also store usage metrics in order for our internal teams to improve the Community Box experience.","

"," 4. What data we share","

"," We are committed to your privacy and we do not share data with any 3rd parties, except in the case of requests from law enforcement and other authorised government agencies.","

"," 5. How we process your data","

"," Your data is stored and processed in the form of reports, and real-time monitoring and metrics. These are used internally within our company to allow us to improve our services so we can improve the Community Box user experience.","

"," 6. How you can obtain and erase the data we store about you","

",' If you wish to obtain copies of any data we store about you, or for us to erase that data (note that this would imply terminating your account with us), then you can email hello@communitybox.co with the subject line "GDPR request" and we will follow up with you to ascertain what action is required.

',"\t
",'\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t
Let\'s go!
',"\t\t\t\t\t\t\t\t\t
","
","
","
"].join("");const ht=new MutationObserver((function(){const e=document.body.querySelector('div[id="communitybox-target"][uninitialised]');e&&(ht.disconnect(),e.removeAttribute("uninitialised"),window.setTimeout((function(){ut(e)}),250))}));ht.observe(document.body,{childList:!0,subtree:!0}),ut()},8449:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryWrapper=void 0;const n=i(1165),o=i(4695),r=i(5397);t.EntryWrapper=class{_data;get key(){return this._data.entryKey}get box(){return this._data.boxKey}get addedByKey(){return this._data.addedbyKey}buildCookieCutterHtml(e,t){var i=document.createElement("div");i.innerHTML=e.getMarkup(t);var n=e.getStyle(t),o=new RegExp("\\[(.*?)\\]","g");do{var r=o.exec(n);if(r){const e=new RegExp("\\["+r[1]+"\\]\\s*?{(.*?)}","g").exec(n)[1],t=i.querySelectorAll("["+r[1]+"]");for(var s=0;svoid 0!==this._data.value[e.key])).map((e=>this._data.value[e.key]+e.interval)).join("")}hasValueForField(e){return!1!==this._data.value.hasOwnProperty(e)&&("string"!=typeof this._data.value[e]||0!==this._data.value[e].length)&&this._data.value.hasOwnProperty(e)}hasValueForFieldArray(e){for(const t of e)if(this._data.value.hasOwnProperty(t))return!0;return!1}get_all_tags(e){const t=e.categories,i=[];for(const e of t){const t=this.getValueOf(e);if(null==t)continue;const n="string"==typeof t?t.split(","):t;i.push(...n)}return i}try_to_parse(e){try{return JSON.parse(e)}catch(e){return}}getGeoDataForTemplate(e){return e.fieldsOfType("location-input").map((e=>e.key in this._data.value?"string"==typeof this._data.value[e.key]&&this._data.value[e.key].length>0?this.try_to_parse(this._data.value[e.key]):this._data.value[e.key]:void 0)).reduce(((e,t)=>(t&&e.push(t),e)),[])}get isNotApproved(){return"awaiting"===this._data.moderation}for_each_value_key(e){Object.keys(this._data.value).forEach((t=>e(t)))}getValueOf(e){return this._data.value[e]}get bespokeDetailLink(){return this._data.value.bespoke_detail}isFeatured(){return this._data.value&&void 0!==this._data.value.feature_level&&this.featureLevel()>0}featureLevel(){try{return parseInt(this._data.value.feature_level)}catch(e){}return 0}constructor(e){this._data=e;for(const e in this._data.value)null===this._data.value[e]&&delete this._data.value[e]}}},9721:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExampleBox=void 0;const n=i(5603),o=i(8114);t.ExampleBox=class{_dlgElem=document.getElementById("cbeb-example-modal");constructor(e){n.DialogBoxMgr.registerDialogBox(this._dlgElem),o.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e})}Show(){n.DialogBoxMgr.show(this._dlgElem)}}},1045:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.field_edit_ctrl=void 0,t.field_edit_ctrl=class{_entry;_field;get fieldKey(){return this._field.key}post_dom_add(){}leftOfViewRow(){return`
`}rightOfViewRow(e){return`
${e||""}
`}getDetailGlyph(e){switch(e){case"website-input":return'';case"email-input":return'';case"phone-input":return'';case"date-input":return'';case"location-input":return'';default:return""}}leftOfInputRow(e){return'
'+(e||"")+'
'}rightOfInputRow(e){return'
'+(e||"")+"
"}install_input_handler_for(e,t){const i=e.querySelector(t),n=e.querySelector("[fieldKey]");i&&(i.addEventListener("keyup",(()=>{i.value.length>0&&n.removeAttribute("missing_required_field")})),i.addEventListener("change",(()=>{i.value.length>0&&n.removeAttribute("missing_required_field")})))}constructor(e,t){this._entry=e,this._field=t}}},2427:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FieldEditCtrlFactory=function(e,t,i,g,_){const y=t.get();switch(y.ctrl_type){case"tag-hierarchy":return new m.HierarchicalTagEditCtrl(e,y,i.config,_);case"category-input":return new o.category_edit_ctrl(e,y,i.config,_);case"date-input":case"facebook-input":case"instagram-input":case"linkedin-input":case"pinterest-input":case"twitter-input":case"slack-input":case"single-line-text-input":default:return new n.SingleLineEditCtrl(e,y,i.config);case"email-input":return new d.EmailEditCtrl(e,y,i.config);case"image-gallery":return new r.ImageGallery(e,y,i.directory);case"phone-input":return new h.PhoneNbEditCtrl(e,y,i.config);case"product-picture":return new a.ProductPictureEditCtrl(e,y);case"multi-line-text-input":return new s.MultiLineEditCtrl(e,y);case"location-input":return new l.LocationEditCtrl(e,y,i.config,i);case"image-input":return new c.ProfilePictureEditCtrl(e,y,i.config,i.template,i.directory);case"website-input":return new u.WebsiteEditCtrl(e,y,i.config);case"file-input":return new p.FileEditCtrl(e,y,i.config,g);case"youtube-input":case"vimeo-input":case"video-input":return new f.VideoEmbedCtrl(e,y)}};const n=i(1681),o=i(1447),r=i(8739),s=i(3198),a=i(8176),l=i(8428),c=i(4695),u=i(1424),d=i(9577),h=i(5237),p=i(6981),m=i(5640),f=i(6401)},6981:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileEditCtrl=void 0;const n=i(1045),o=i(8741),r=i(6964),s=i(7048),a=i(3221);class l extends n.field_edit_ctrl{_entry;_field;_config;_parentDlg;_files=[];data(){return JSON.stringify(this._files)}has_data(){return this._files.length>0}fileDownloadHtml(e){return`\n \n
\n
\n
${e.title}
\n
${e.desc}
\n
\n
\n ${this.glyphForFileType(e)}\n
\n
\n
`}viewHtmlElem(){const e=[this.leftOfViewRow(),`
\n ${this._field.detail_label?`
${this._field.detail_label}
`:""}\n ${this._files.reduce(((e,t)=>e+this.fileDownloadHtml(t)),"")}\n
`,this.rightOfViewRow()].join(""),t=document.createElement("div");return t.innerHTML=e,t}encodeToBase64(e){return new r.Promise(((t,i)=>{const n=new FileReader;n.readAsDataURL(e),n.onload=()=>{t(n.result.slice(n.result.indexOf("base64,")+7))},n.onerror=e=>{i(e)}}))}promiseSerial(e){return e.reduce(((e,t)=>e.then((e=>t().then(Array.prototype.concat.bind(e))))),r.Promise.resolve([]))}uploadPart(e){return new r.Promise(((t,i)=>{const n=new XMLHttpRequest;n.open("post","https://api.communitybox.co/upload/file",!0),n.upload.addEventListener("progress",(function(e){o.UpdateMeter(e.loaded/e.total)})),n.onload=function(){4===n.readyState&&200===n.status?t(JSON.parse(n.responseText)):i(n.responseText)},n.send(JSON.stringify({box:this._entry.box,profile:"temp",filename:e.filename,part:e.partIdx,total_parts:e.nbParts,key:e.uploadKey,b64_data:e.b64data}))}))}uploadNewFile(e){return new r.Promise(((t,i)=>{this.encodeToBase64(e).then((i=>{const n=131072,o=Math.ceil(i.length/n),r=(0,a.uuidv4)(),s=[];for(let t=0;tthis.uploadPart({b64data:a,filename:e.name,uploadKey:r,partIdx:t,nbParts:o})))}this.promiseSerial(s).then((()=>{const s=i.length-(o-1)*n,a=i.slice(i.length-s,i.length);this.uploadPart({b64data:a,filename:e.name,uploadKey:r,partIdx:o-1,nbParts:o}).then((e=>{const i=e;t({bucket_path:i.bucket_path,tag:i.tag})}))}))}))}))}glyphForFileType(e){switch("linked-file"===e.type?e.location.toLowerCase().split(".").pop():e.bucket_path.toLowerCase().split(".").pop()){case"pdf":return'';case"doc":case"docx":return'';default:return''}}fileAmendHtml(e){return`\n
\n
\n

${e.title}

\n
${e.desc}
\n
\n \n
`}hideParentDlg(){void 0!==this._parentDlg&&(this._parentDlg.style.display="none")}showParentDlg(){void 0!==this._parentDlg&&(this._parentDlg.style.display="block")}inputKey(e){return e}handleFileUpload(e,t){this.hideParentDlg(),o.Show(),this.uploadNewFile(t.target.files[0]).then((t=>{o.Hide(),s.Show({title:"File description",inputArray:[{label:"Title of file",placeholder:"e.g., Sustainability Report 2018",key:this.inputKey("file-title")},{label:"One-line description of file",placeholder:"e.g., Our most comprehensive report yet...",key:this.inputKey("file-desc")}],onResult:i=>{const n={type:"uploaded-file",tag:t.tag,bucket_path:t.bucket_path,title:i[this.inputKey("file-title")],desc:i[this.inputKey("file-desc")],key:(0,a.uuidv4)()},o=document.createElement("div");o.innerHTML=this.fileAmendHtml(n),e.appendChild(o);const r=o.querySelector("button[delete]");this.addDeleteHandler(this,r),this._files.push(n)},onClose:()=>{s.Hide(),this.showParentDlg()}})})).catch((e=>{console.error(e),o.Hide(),this.showParentDlg()}))}addDeleteHandler(e,t){t.addEventListener("click",(function(){const t=this.getAttribute("key"),i=this.parentElement;i.parentElement.removeChild(i),e._files=e._files.filter((e=>e.key!==t))}))}handleLinkUpload(e){this.hideParentDlg(),s.Show({title:"Add report link",inputArray:[{label:"Title of report",placeholder:"e.g., Sustainability Report 2018",key:this.inputKey("file-title")},{label:"One-line description of report",placeholder:"e.g., Our most comprehensive report yet...",key:this.inputKey("file-desc")},{label:"Location of report",placeholder:"https://example.com/report.pdf",key:this.inputKey("file-location")}],onResult:t=>{const i={type:"linked-file",location:t[this.inputKey("file-location")],title:t[this.inputKey("file-title")],desc:t[this.inputKey("file-desc")],key:(0,a.uuidv4)()},n=document.createElement("div");n.innerHTML=this.fileAmendHtml(i),e.appendChild(n);const o=n.querySelector("button[delete]");this.addDeleteHandler(this,o),this._files.push(i)},onClose:()=>{s.Hide(),this.showParentDlg()}})}inputHtmlElem(){const e=this.leftOfInputRow()+'
'+this._field.label+(!0===this._field.required?" (required)":"")+("everyone"!==this._field.editable_by?'  ':"")+"
"+`
\n
\n \n \n
\n \n
\n ${this._files.map((e=>this.fileAmendHtml(e))).join("")}\n
\n
`;this.rightOfInputRow();const t=document.createElement("div");t.innerHTML=e;const i=t.querySelector("[existing-file-container]"),n=i.querySelectorAll("button[delete]");for(let e=0;e{this.handleFileUpload(i,e)})),t.querySelector("button[add-file]").addEventListener("click",(()=>{o.click()})),t.querySelector("button[add-link]").addEventListener("click",(()=>{this.handleLinkUpload(i)})),t}constructor(e,t,i,n){if(super(e,t),this._entry=e,this._field=t,this._config=i,this._parentDlg=n,e.hasValueForField(t.key))try{this._files=JSON.parse(e.getValueOf(t.key)),!1===Array.isArray(this._files)&&(this._files=[])}catch(e){this._files=[]}}}t.FileEditCtrl=l},3690:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initialise_filter_bar=function(e){const t=document.querySelector("[cbeb-filter-bar]");if(null==t)return{clear_filters:()=>{}};t.setAttribute("initialised",""),n.remove_all_child_elements_from(t);const i=n.div("",[],{design:e.config.filter_bar_design(e.aspect).external_frame}),o=n.div("",[],{design:e.config.filter_bar_design(e.aspect).internal_frame}),s=function(e){const t=e.config.filter_bar_components(e.aspect).map((t=>function(e,t,i,n,o){switch(e.type){case"linked-dropdown":{const t=i.getField(e.field);if(null==t)return null;const n=t.get();return"tag-hierarchy"!==n.ctrl_type?null:new p(e,n,o)}case"location":if(n.mbk)return new d(e.design,e.placeholder,n.mbk);throw"Can't initialise location search field as there is no Mapbox key available";case"free-text":return new h(e.design,e.placeholder);case"typable-category":return new u(e.design,e.placeholder,f(t,i,e.field),(t=>`${e.field}=${encodeURIComponent(t)}`),e.field,"");case"typable-state":return new u(e.design,e.placeholder,new Map(Object.entries(r.state_dict).map((e=>[e[0],{label:e[1],nbMatches:1,categoryField:""}]))),(e=>`region=${encodeURIComponent(e)}`),"typable-state","");case"dropdown-category":return new m(e.design,e.placeholder,g(function(e,t,i){const n=f(e,i,t);return Array.from(n).reduce(((e,t)=>(e[t[1].label]=t[1].label,e)),{})}(t,e.field,i)),(t=>`category-filter-${e.field}=${encodeURIComponent(t)}`));case"dropdown-state":return new m(e.design,e.placeholder,g(r.state_dict),(e=>`region=${encodeURIComponent(e)}`));case"launch":return new c(e.design,e.label,e.destination)}}(t,e.directory,e.template,e.documentState,e.queryParam))).filter((e=>null!=e));for(const i of t)i.set_launch_search_function((i=>{_(t,e.launch_search,i)}));return t}(e);for(const e of s)o.appendChild(e.build());for(const e of s)e.post_document_add();return i.appendChild(o),t.appendChild(i),{clear_filters:()=>{for(const e of s)e.reset()}}};const n=i(3032),o=i(6267),r=i(4745),s=i(5915),a=i(7746);class l{set_launch_search_function(e){}post_document_add(){}}class c extends l{_design;_label;_destination;_launch_search;reset(){}get_search_term(){}set_launch_search_function(e){this._launch_search=e}build(){return n.button("",this._label,(()=>{this._launch_search({destination:this._destination})}),{design:this._design})}constructor(e,t,i){super(),this._design=e,this._label=t,this._destination=i,this._launch_search=()=>{}}}class u extends l{_design;_placeholder;_tag_dict;_search_term_for;_field_key;_destination;_chosen_value;_result_display_div;_no_result_display_div;_input_field;_launch_search;reset(){this._chosen_value=void 0,this._input_field&&(this._input_field.value="")}set_launch_search_function(e){this._launch_search=e}get_search_term(){return void 0===this._chosen_value?void 0:this._search_term_for(this._chosen_value)}handle_on_result(e){if(this._result_display_div){const t=this._result_display_div.querySelector("[cbeb-fb-search-term-rf]")||null;t&&(t.textContent=e),this._result_display_div.style.display="flex",this._no_result_display_div&&(this._no_result_display_div.style.display="none")}}handle_no_result(e){if(this._no_result_display_div){const t=this._no_result_display_div.querySelector("[cbeb-fb-search-term-rf]")||null;t&&(t.textContent=e),this._no_result_display_div.style.display="flex",this._result_display_div&&(this._result_display_div.style.display="none")}}handle_enter_key(e){this._chosen_value=e,this._launch_search({on_result:this._result_display_div?()=>{this.handle_on_result(e)}:void 0,on_no_result:this._no_result_display_div?()=>{this.handle_no_result(e)}:void 0,destination:this._destination})}build(){const e=n.datalist(this._field_key,Object.keys(this._tag_dict).map((e=>({value:e,label:e}))));this._input_field=n.input("data-lpignore=true",(function(e,i){"Enter"===e.key&&t.handle_enter_key(i.value)}),this._design.input,{placeholder:this._placeholder,datalist:this._field_key});const t=this;return n.div("",[e,this._input_field],{design:this._design["typable-container"]})}constructor(e,t,i,n,o,r){super(),this._design=e,this._placeholder=t,this._tag_dict=i,this._search_term_for=n,this._field_key=o,this._destination=r,this._result_display_div=document.querySelector("[cbeb-fb-search-result]"),this._result_display_div&&(this._result_display_div.style.display="none"),this._no_result_display_div=document.querySelector("[cbeb-fb-search-no-result]"),this._no_result_display_div&&(this._no_result_display_div.style.display="none"),this._launch_search=()=>{}}}class d extends l{_design;_placeholder;_mapboxKey;_mpt_geocoder;_region;_latitude;_longitude;_container;reset(){this._region=void 0,this._latitude=void 0,this._longitude=void 0,this._mpt_geocoder.clear()}build(){return this._container=n.div("",[],{design:this._design.container}),this._container}post_document_add(){window.setTimeout((()=>{if(this._mpt_geocoder=new s({accessToken:this._mapboxKey,types:"country,region,place,postcode,locality,neighborhood",placeholder:this._placeholder}),this._mpt_geocoder.on("clear",(()=>{this._region=void 0,this._latitude=void 0,this._longitude=void 0})),this._mpt_geocoder.on("result",(e=>{if(e.result.place_type&&e.result.place_type instanceof Array&&e.result.place_type.length>0&&("region"===e.result.place_type[0]||"country"===e.result.place_type[0]))this._region=e.result.text,this._latitude=void 0,this._longitude=void 0;else{const t=e.result.center[0],i=e.result.center[1];this._latitude=i,this._longitude=t,this._region=void 0}})),this._mpt_geocoder.addTo(this._container),this._container){const e=this._container.querySelector(".mapboxgl-ctrl-geocoder--input");e&&(e.setAttribute("autocomplete","chrome-off"),e.setAttribute("data-lpignore","true"))}}),500)}get_search_term(){return void 0!==this._region&&this._region.length>0?`region=${encodeURIComponent(this._region)}`:void 0!==this._longitude&&void 0!==this._latitude?`location=${encodeURIComponent(this._latitude)},${encodeURIComponent(this._longitude)}`:void 0}constructor(e,t,i){super(),this._design=e,this._placeholder=t,this._mapboxKey=i}}class h extends l{_design;_placeholder;_input_ctrl;reset(){this._input_ctrl.value=""}build(){return this._input_ctrl}get_search_term(){return this._input_ctrl.value.length>0?`text=${encodeURIComponent(this._input_ctrl.value)}`:void 0}constructor(e,t){super(),this._design=e,this._placeholder=t,this._input_ctrl=n.input("",(()=>{}),this._design.input,{placeholder:this._placeholder}),this._input_ctrl.setAttribute("autocomplete","off")}}class p extends l{_component;_field;_queryParam;_chosen_value;_leafSelectCtrl;reset(){this._leafSelectCtrl&&(this._leafSelectCtrl.value="placeholder-default"),this._chosen_value=null}get_search_term(){return this._chosen_value?`ctags=${this._chosen_value}`:void 0}buildOptionsListofChildTags(e){return Array.from(this._field.tagTree.keys()).map((e=>({key:e,tag:this._field.tagTree.get(e)}))).filter((t=>t.tag.parent===e)).map((e=>({value:e.key,label:e.tag.label})))}build(){this._leafSelectCtrl=n.select("",this._chosen_value?this.buildOptionsListofChildTags((0,a.GetRootTagOf)(this._chosen_value,this._field.tagTree)):[],{dropdown_design:this._component.design,choice_design:"",placeholder:this._component.placeholders[1],default:this._chosen_value||void 0,on_selection_change:e=>{this._chosen_value=e}});const e=this.buildOptionsListofChildTags(null),t=n.select("",e,{dropdown_design:this._component.design,choice_design:"",placeholder:this._component.placeholders[0],default:this._chosen_value&&(0,a.GetRootTagOf)(this._chosen_value,this._field.tagTree)||void 0,on_selection_change:e=>{if(null!=e){if(null==this._leafSelectCtrl)return;n.remove_all_child_elements_from(this._leafSelectCtrl);const t=document.createElement("option");t.value="placeholder-default",t.textContent=this._component.placeholders[1],t.defaultSelected=!0,t.disabled=!0,this._leafSelectCtrl.appendChild(t);const i=this.buildOptionsListofChildTags(e);for(const e of i.sort(((e,t)=>e.label.localeCompare(t.label)))){const t=document.createElement("option");t.value=e.value,t.textContent=e.label,this._leafSelectCtrl.appendChild(t)}}}});return n.div("",[t,this._leafSelectCtrl],{design:this._component["container-design"]})}constructor(e,t,i){super(),this._component=e,this._field=t,this._queryParam=i,this._chosen_value="ctags"in i?i.ctags:null,this._leafSelectCtrl=null}}class m extends l{_design;_placeholder;_option_dict;_search_term_for;_chosen_value;_select_ctrl;reset(){this._select_ctrl&&(this._select_ctrl.value="placeholder-default"),this._chosen_value=null}get_search_term(){return null==this._chosen_value?void 0:this._search_term_for(this._chosen_value)}build(){return this._select_ctrl=n.select("",Object.keys(this._option_dict).reduce(((e,t)=>(e.push({value:this._option_dict[t],label:t}),e)),[]),{dropdown_design:this._design.selector,choice_design:this._design.option,placeholder:this._placeholder,on_selection_change:e=>{this._chosen_value=e}}),this._select_ctrl}constructor(e,t,i,n){super(),this._design=e,this._placeholder=t,this._option_dict=i,this._search_term_for=n,this._chosen_value=null}}function f(e,t,i){const n=t.getField(i);return n?o.from(e,[n]):new Map}function g(e){return Object.keys(e).reduce(((t,i)=>(t[i.split(" ").map((e=>"of"===e?"of":function(e){return e.charAt(0).toUpperCase()+e.slice(1)}(e))).join(" ")]=e[i],t)),{})}function _(e,t,i){t(e.map((e=>e.get_search_term())).filter((e=>void 0!==e)).join("&"),i)}},5942:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FilterAndSearchDlg=void 0;const n=i(5603),o=i(8114),r=i(7746),s=i(5915);t.FilterAndSearchDlg=class{_invariants;filterMgr;launchSearch;_box;_dlgElem=document.querySelector("[filter-and-search]");_tagListElem=this._dlgElem.querySelector("[tag-list]");_selectListElem=this._dlgElem.querySelector("[selectorlist]");_location_input_elem=this._dlgElem.querySelector("input[placename]");_freeTextElem=this._dlgElem.querySelector("[free-text-input]");_radiusElem=this._dlgElem.querySelector("select[radius]");_locationElem=this._dlgElem.querySelector("[location][fields]");_locLat;_locLng;_autocompleteElem=void 0;_categoryList=new Map;_selectorElem=[];_mpt_geocoder=void 0;_region;extract_category_array_from(e){if(void 0!==e)return"string"==typeof e&&e.length>0?e.split(","):e}trimTag(e){return e.trim().replace("&","&").replace("<","<")}extractTagsFrom(e,t){const i=new Set;if("category-input"===t.ctrl_type&&"all"===t.tagDiscoverability)for(const e of t.fieldChoices||[])i.add(this.trimTag(e));return e.forEachEntryWithValueFor([t.key],(e=>{(this.extract_category_array_from(e.getValueOf(t.key))||[]).forEach((e=>{i.add(this.trimTag(e))}))})),Array.from(i)}append_tag_options_to(e,t,i){const n=this.extractTagsFrom(i,t),o=(0,r.SortTags)(n,t);for(const t of o){const i=document.createElement("option");i.value=t,i.text=t.replace(/&/g,"&"),e.appendChild(i)}}location_input_is_blank(){const e=this._dlgElem.querySelector(".mapboxgl-ctrl-geocoder--input");return!e||0===e.value.length}constructor(e,t,i,r){this._invariants=e,this.filterMgr=t,this.launchSearch=i,this._box=r,this._freeTextElem.value="";const s=this._dlgElem.querySelector(".cbeb-modal-title-text");s&&(s.textContent=e.config.get_wording("saf-dlg-title"));const a=this._dlgElem.querySelector("[launch-advanced-search]");a.textContent=e.config.get_wording("launch-search-btn"),this._dlgElem.querySelector(".cbeb-extra-button-row [close-dialog-btn]").textContent=e.config.get_wording("cancel_btn");const l=["saf-text-label","saf-categories","saf-freetext-label","saf-location","saf-placename","saf-radius"];for(const t of l){const i=this._dlgElem.querySelector(`[${t}]`);i&&i instanceof HTMLElement&&(i.textContent=e.config.get_wording(t))}n.DialogBoxMgr.registerDialogBox(this._dlgElem),o.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e.config}),!1===e.config.showLocationSearch&&(this._locationElem.style.display="none");const c="kilometre"===e.config.distanceUnit?"kilometres":"miles",u=[5,10,25,50,100,250];-1===u.indexOf(e.config.default_proximity_distance)&&(u.push(e.config.default_proximity_distance),u.sort(((e,t)=>t-e))),u.forEach((t=>{const i=document.createElement("option");i.value=`${t}`,i.text=`${t} ${c}`,t===e.config.default_proximity_distance&&(i.defaultSelected=!0),this._radiusElem.appendChild(i)}));const d=e.template.fieldsOfType("category-input").filter((e=>e.searchable)).map((e=>e.get()));if(0===d.length){const e=this._dlgElem.querySelector("[categories][fields]");e&&e instanceof HTMLDivElement&&(e.style.display="none")}else{const e=d.sort(((e,t)=>e.uiRank-t.uiRank));for(const t of e){const e=document.createElement("select");e.setAttribute("category-selector",""),e.setAttribute("mb10","");const i=t.detail_label||t.label,n=document.createElement("option");n.value=i,n.text=i,n.setAttribute("disabled",""),n.setAttribute("selected",""),e.appendChild(n),this.append_tag_options_to(e,t,this._box),e.addEventListener("change",(()=>{const i=e.value,n=document.createElement("div"),o=document.createElement("button");o.textContent=String.fromCharCode(215),o.addEventListener("click",(()=>{window.setTimeout((()=>{this._tagListElem.removeChild(n);const e=this._categoryList.get(t.key);e&&(e.delete(i),this._categoryList.set(t.key,e))}),100)}));const r=document.createElement("label");r.textContent=i.replace(/&/g,"&"),n.setAttribute("tag",""),n.setAttribute("flex",""),n.setAttribute("row",""),n.appendChild(r),n.appendChild(o);const s=this._categoryList.get(t.key);s?(s.add(i),this._categoryList.set(t.key,s)):this._categoryList.set(t.key,new Set([i])),this._tagListElem.appendChild(n)})),this._selectListElem.appendChild(e),this._selectorElem.push(e)}}for(;this._tagListElem.firstChild;)this._tagListElem.removeChild(this._tagListElem.firstChild);a.addEventListener("click",(()=>{const o=this._freeTextElem.value,r=this.getSearchRadiusAsNumber();o.length>0?t.updateFreeSearchTerm(o.split(" ")):t.clear_free_search_term(),t.updateCategoryFilter(this._categoryList),this.location_input_is_blank()&&(this._locLat=void 0,this._locLng=void 0),this._region?(t.update_region(this._region),t.clearProximityFilter()):this._locLat&&this._locLng?t.updateProximityFilter({lat:this._locLat,lng:this._locLng},r):t.clearProximityFilter(),n.DialogBoxMgr.close(),i(e)}))}Show(){for(this.filterMgr.clearAllFilters(),void 0===this._autocompleteElem&&void 0===this._mpt_geocoder&&this.initLocationAutocomplete(),this._selectorElem.forEach((e=>e.selectedIndex=0)),this._categoryList=new Map;this._tagListElem.firstChild;)this._tagListElem.removeChild(this._tagListElem.firstChild);n.DialogBoxMgr.show(this._dlgElem)}getSearchRadiusAsNumber(){return Number(this._radiusElem.value)}use_google_for_autocomplete(){this._autocompleteElem=new google.maps.places.Autocomplete(this._location_input_elem,{fields:["geometry.location"]}),void 0!==this._autocompleteElem&&this._autocompleteElem.addListener("place_changed",(()=>{const e=this._autocompleteElem.getPlace();this._locLat=e.geometry.location.lat(),this._locLng=e.geometry.location.lng()}))}use_mapbox_for_autocomplete(e){const t=new s({accessToken:this._invariants.documentState.mbk,types:"country,region,place,postcode,locality,neighborhood",placeholder:e.location_search_placeholder});this._mpt_geocoder=t,this._mpt_geocoder.on("result",(e=>{if(e.result.place_type&&e.result.place_type instanceof Array&&e.result.place_type.length>0&&("region"===e.result.place_type[0]||"country"===e.result.place_type[0]))this._region=e.result.text,this._locLat=void 0,this._locLng=void 0;else{const t=e.result.center[0],i=e.result.center[1];this._locLat=i,this._locLng=t,this._region=void 0}})),this._mpt_geocoder.addTo("#cbeb-placename-autocomplete"),this._location_input_elem.style.display="none";const i=this._dlgElem.querySelector(".mapboxgl-ctrl-geocoder--input");i&&(i.setAttribute("autocomplete","chrome-off"),i.setAttribute("data-lpignore","true"))}initLocationAutocomplete(){"undefined"!=typeof google&&"undefined"!=typeof g_bespoke_google_api_key&&void 0!==g_bespoke_google_api_key?this.use_google_for_autocomplete():null!=this._invariants.documentState.mbk?this.use_mapbox_for_autocomplete(this._invariants.config):this.use_google_for_autocomplete()}}},4745:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FilterManager=t.FilterOutcome=t.reverse_state_dict=t.state_dict=void 0;const n=i(7746);var o,r;t.state_dict={alabama:"al",alaska:"ak","american samoa":"as",arizona:"az",arkansas:"ar",california:"ca",colorado:"co",connecticut:"ct",delaware:"de","district of columbia":"dc","federated states of micronesia":"fm",florida:"fl",georgia:"ga",guam:"gu",hawaii:"hi",idaho:"id",illinois:"il",indiana:"in",iowa:"ia",kansas:"ks",kentucky:"ky",louisiana:"la",maine:"me","marshall islands":"mh",maryland:"md",massachusetts:"ma",michigan:"mi",minnesota:"mn",mississippi:"ms",missouri:"mo",montana:"mt",nebraska:"ne",nevada:"nv","new hampshire":"nh","new jersey":"nj","new mexico":"nm","new york":"ny","north carolina":"nc","north dakota":"nd","northern mariana islands":"mp",ohio:"oh",oklahoma:"ok",oregon:"or",palau:"pw",pennsylvania:"pa","puerto rico":"pr","rhode island":"ri","south carolina":"sc","south dakota":"sd",tennessee:"tn",texas:"tx",utah:"ut",vermont:"vt","virgin islands":"vi",virginia:"va",washington:"wa","west virginia":"wv",wisconsin:"wi",wyoming:"wy"},t.reverse_state_dict=Object.keys(t.state_dict).reduce(((e,i)=>(e[t.state_dict[i]]=i,e)),{}),function(e){e[e.Keep=0]="Keep",e[e.Discard=1]="Discard"}(o||(t.FilterOutcome=o={})),function(e){e[e.Match=0]="Match",e[e.NoMatch=1]="NoMatch",e[e.EmptyCriterion=2]="EmptyCriterion"}(r||(r={})),t.FilterManager=class{_config;_freeSearchTerm=[];_categoryFilter=new Map;_geoLoc;_referenceDist;_bespokeSearchResults={};_bespokeSearchActive=!1;_state_lookup;_ctags=[];constructor(e){this._config=e,this._referenceDist=e.default_proximity_distance}clearAllFilters(){this._ctags=[],this._freeSearchTerm=[],this._categoryFilter=new Map,this._geoLoc=void 0,this._bespokeSearchResults={},this._bespokeSearchActive=!1,this._state_lookup=void 0}AddHierarchicalTagsToFilter(e){this._ctags.push(...e)}onlyShowTheseEntries(e){this._bespokeSearchActive=!0,this._bespokeSearchResults=e.reduce(((e,t)=>(e[t]=!1,e)),{})}HasActiveFilter(){return this._categoryFilter.size>0||void 0!==this._geoLoc||void 0!==this._state_lookup||this._freeSearchTerm.length>0||!0===this._bespokeSearchActive}update_region(e){const i=e.toLowerCase();i in t.reverse_state_dict?this._state_lookup=new RegExp(`\\b(${i}|${t.reverse_state_dict[i]})\\b`,"i"):this._state_lookup=new RegExp(`\\b(${i}|${t.state_dict[i]})\\b`,"i")}updateFreeSearchTerm(e){this._freeSearchTerm=e;const i=e.map((e=>e.toLowerCase())).filter((e=>e in t.state_dict));i.length>0&&this.update_region(t.state_dict[i[0]])}transform_category_for_filtering(e){return e.trim().toLowerCase().replace(/&(?!amp;)/g,"&")}updateCategoryFilter(e){this._categoryFilter=new Map(Array.from(e).map((e=>[e[0],new Set(Array.from(e[1]).map((e=>this.transform_category_for_filtering(e))))])))}add_to_category_filter(e,t){const i=this._categoryFilter.get(e)||new Set;i.add(this.transform_category_for_filtering(t)),this._categoryFilter.set(e,i)}GetFreeSearchTerm(){return this._freeSearchTerm}clearProximityFilter(){this._geoLoc=void 0,this._referenceDist=this._config.default_proximity_distance}updateProximityFilter(e,t){this._geoLoc=e,this._referenceDist=t}FilterByHierarchicalTags(e,t){if(0===this._ctags.length)return r.EmptyCriterion;const i=t.fieldsOfType("tag-hierarchy"),o=[];for(const t of i){const i=e.getValueOf(t.key);(0,n.IsValidArrayOfTagKeys)(i)&&o.push(...i)}return"all"===this._config.filter_config.tag_match&&this._ctags.every((e=>-1!==o.indexOf(e)))||"some"===this._config.filter_config.tag_match&&this._ctags.find((e=>-1!==o.indexOf(e)))?r.Match:r.NoMatch}profileTagsForField(e,t){if(null==e)return new Set;const i=t.getValueOf(e.key);return null==i?new Set:"string"==typeof i?new Set(i.split(",").map((e=>this.transform_category_for_filtering(e)))):i instanceof Array?new Set(i.map((e=>this.transform_category_for_filtering(e)))):new Set}intersect(e,t){return new Set([...e].filter((e=>t.has(e))))}categoryFilter(e,t){if(0===this._categoryFilter.size)return r.EmptyCriterion;const i=new Map(Array.from(this._categoryFilter).map((i=>[i[0],this.profileTagsForField(t.getField(i[0]),e)]))),n=Array.from(this._categoryFilter);if("all"===this._config.filter_config.tag_match){for(const e of n){const t=i.get(e[0])||new Set;if(this.intersect(e[1],t).size!==e[1].size)return r.NoMatch}return r.Match}for(const e of n){const t=i.get(e[0])||new Set;if(this.intersect(e[1],t).size>0)return r.Match}return r.NoMatch}anyFreeTextMatchesAllTerms(e,t,i){let n=e.map((e=>!1));const o=[...i.fieldsOfType("single-line-text-input"),...i.fieldsOfType("multi-line-text-input")].filter((e=>e.searchable));for(const i of o){const o=t.getValueOf(i.key);null!=o&&"string"==typeof o&&(n=n.map(((t,i)=>t||e[i].test(o))))}return n.every((e=>e))}mapDistConversionFactor(){switch(this._config.distanceUnit){case"mile":return.621371;case"kilometre":return 1}}distance_between(e){const t=this.deg2rad(e.b.lat-e.a.lat),i=this.deg2rad(e.b.lng-e.a.lng),n=Math.sin(t/2)*Math.sin(t/2)+Math.cos(this.deg2rad(e.a.lat))*Math.cos(this.deg2rad(e.b.lat))*Math.sin(i/2)*Math.sin(i/2);return 2*Math.atan2(Math.sqrt(n),Math.sqrt(1-n))*6371}deg2rad(e){return e*(Math.PI/180)}clear_free_search_term(){this._freeSearchTerm=[]}escape_regex_special_characters(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}init_regexp_for(e){return"yes"===this._config.filter_config.respect_word_boundary?new RegExp(`(?this.init_regexp_for(e))),n=this.categoryFilter(e,t),s=this.FilterByHierarchicalTags(e,t);let a=r.EmptyCriterion;this._freeSearchTerm.length>0&&(a=this.anyFreeTextMatchesAllTerms(i,e,t)?r.Match:r.NoMatch);let l=r.EmptyCriterion;if(void 0!==this._state_lookup){l=r.NoMatch;const i=e.getGeoDataForTemplate(t);for(const e of i)this._state_lookup.test(e.formatted_address)&&(l=r.Match)}let c=this._geoLoc?r.NoMatch:r.EmptyCriterion;if(this._geoLoc){const i=e.getGeoDataForTemplate(t);for(const e of i){if(c===r.Match)continue;const t={lat:e.lat,lng:e.lng};c=this.distance_between({a:t,b:this._geoLoc})*this.mapDistConversionFactor()e!==r.EmptyCriterion)).reduce(((e,t)=>e&&t===r.Match),!0)?o.Keep:o.Discard}}}},5843:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.send_pw_reset_link_dlg=void 0;const n=i(3032),o=i(9496);t.send_pw_reset_link_dlg=class{_directory;_button_design;_secondary_button_design;constructor(e,t){this._directory=e,this._button_design=`background-color: #${t.bgColourOf("button")};color: #${t.fgColourOf("button")}`,this._secondary_button_design=`background-color: #${t.fgColourOf("button")};color: #${t.bgColourOf("button")}; border: 1px solid ${t.bgColourOf("button")}`}cleaned_up_location(e){return e.split(/[\?\#]/g)[0]}build_stage_1_buttons(e){n.remove_all_child_elements_from(e.container),e.container.appendChild(n.div("flex row",[n.button("basic mr17",e.okay_btn_label,(()=>{e.error_text.textContent=" ",0!==e.email_input.value.length&&-1!==e.email_input.value.indexOf("@")&&-1!==e.email_input.value.indexOf(".")?(window.setTimeout((()=>{n.remove_all_child_elements_from(e.container),e.container.appendChild(n.p("mt0 mb0",e.config.get_wording("please_wait")))})),this.TryToRecover({member_email:e.email_input.value.toLowerCase().trim(),originatingURL:this.cleaned_up_location(window.location.href),directory:this._directory,context:e.context},{onResult:()=>{window.setTimeout((()=>{this.build_stage_3(e.root_container,e.outer_elem,e.config,e.congratulations)}))},onFailure:t=>{"unrecognised username"===t.err?e.error_text.textContent="Unrecognised email":e.error_text.textContent="string"==typeof t?t:JSON.stringify(t),window.setTimeout((()=>{this.build_stage_1_buttons(e)}))}})):e.error_text.textContent="Please enter a valid email"}),{design:this._button_design}),n.button("basic",e.config.get_wording("cancel_btn"),(()=>{this.close_dialog(e.outer_elem)}),{design:this._secondary_button_design})]))}build_stage_3(e,t,i,o){n.remove_all_child_elements_from(e);const r=`font-family: ${i.fontFamily||"inherit"};`;e.appendChild(n.div("flex col",[n.p("mt0 mb0",o,{design:`${r}; box-sizing: border-box; padding: 31px; background-color: white;`}),n.div("flex row justify-center",[n.button("basic mr17",i.get_wording("close"),(()=>{this.close_dialog(t)}),{design:this._button_design})])]))}show(e){const t=n.div("dialogbox block",[],{design:`font-family: ${e.config.fontFamily};`}),i=n.input("basic",(()=>{}),"",{placeholder:e.config.get_wording("email-placeholder")}),o=n.p("mt7 mb0 red"," ",{design:"font-family: inherit; font-size: 14px;"}),r=`font-family: ${e.config.fontFamily||"inherit"};`,s=n.div("flex col",[],{design:"box-sizing: border-box; padding: 31px;"}),a=n.div("flex row justify-center",[]);this.build_stage_1_buttons({root_container:s,container:a,outer_elem:t,error_text:o,email_input:i,config:e.config,congratulations:e.congratulations,okay_btn_label:e.okay_btn_label,context:e.context}),s.appendChild(n.div("flex col",[n.p("mt0 mb0",e.greeting,{design:`${r}; box-sizing: border-box; padding: 31px; background-color: white;`}),n.div("flex col justify-center",[i,o],{design:"padding: 7px 31px 31px 31px"}),n.div("h17",[]),a,n.div("h37",[])]));const l=n.div("flex col",[n.p("mt0 mb0",e.title,{design:`${r}; color: #${e.config.fgColourOf("dialog_title")}; box-sizing: border-box; padding: 31px; background-color: #${e.config.bgColourOf("dialog_title")}`}),s],{design:"width: 500px; margin-left: auto; margin-right: auto; background-color: white;"});t.appendChild(l),t.addEventListener("click",(e=>{e.target!==t&&e.target!==l||window.setTimeout((()=>{this.close_dialog(t)}))})),document.body.appendChild(t),document.body.classList.add("cbeb-noscroll")}close_dialog(e){window.setTimeout((function(){document.body.removeChild(e),document.body.classList.remove("cbeb-noscroll")}))}async TryToRecover(e,t){try{const i=await o.Member.Lambda({request:"send password reset email",member_email:e.member_email,originatingURL:e.originatingURL,directory:e.directory,context:e.context});t.onResult(i)}catch(e){t.onFailure(`${e}`)}}}},8739:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImageGallery=void 0;const n=i(3615),o=i(1045),r=i(4695),s=i(1613),a=i(3032),l=i(5397);class c extends o.field_edit_ctrl{_entry;_field;_directory;_pictures=[];_currImgIdx=0;_prevBtn;_nextBtn;_deleteBtn;_pictureElem;_img_frame;_editingControls=[];_upload_progress_container;_upload_progress_meter;_upload_progress_label;data(){return this._pictures}has_data(){return this._pictures.length>0}update(){const e=(0,r.PictureDataFrom)("img_gallery_dflt2");if(this._pictureElem)if(this._pictures.length>0){const t=(0,l.PictureLinkFrom)(this._pictures[this._currImgIdx],e,this._pictureElem.clientWidth);t?(this._pictureElem.setAttribute("src",t),this._pictureElem.style.transform=`rotate(${this._pictures[this._currImgIdx].rotation}deg)`):this._pictureElem.setAttribute("src",t)}else this._pictureElem.setAttribute("src",(0,l.PictureLinkFrom)(e,(0,r.PictureDataFrom)(null)));this.updateImageGalleryBrowseButtons()}show_progress(e,t){this._upload_progress_meter&&this._upload_progress_label&&(this._upload_progress_meter.value=100*e,this._upload_progress_label.textContent=t)}registerFileUploadCallback(e){let t=this;e.addEventListener("change",(e=>{this._upload_progress_container&&this._img_frame&&(this._upload_progress_container.style.display="flex",this._img_frame.style.display="none"),(0,n.upload_image)(e.target.files[0],this._directory,((e,t)=>this.show_progress(e,t))).then((e=>{t._pictures.push((0,r.PictureDataFrom)(e)),t._currImgIdx=t._pictures.length-1,t.update(),this._upload_progress_container&&this._img_frame&&(this._upload_progress_container.style.display="none",this._img_frame.style.display="flex")})).catch((e=>{console.error(e)}))}))}updateImageGalleryBrowseButtons(){window.setTimeout((()=>{this._nextBtn&&this._prevBtn&&this._deleteBtn&&(this._pictures.length>0?(this._deleteBtn.style.visibility="visible",this._editingControls.forEach((e=>e.style.visibility="visible"))):(this._deleteBtn.style.visibility="hidden",this._editingControls.forEach((e=>e.style.visibility="hidden"))),this._pictures.length>1?(this._nextBtn.style.visibility="visible",this._prevBtn.style.visibility="visible"):(this._nextBtn.style.visibility="hidden",this._prevBtn.style.visibility="hidden"))}))}viewHtmlElem(){const e=document.createElement("div");return e.innerHTML=`\n ${this.leftOfViewRow()}\n
\n ${this._field.detail_label?`
${this._field.detail_label}
`:""}\n
\n
\n \n \n
\n \n
\n
\n ${this.rightOfViewRow()}\n `,this._pictureElem=e.querySelector("img"),this._prevBtn=e.querySelector("button[prev-img]"),this._nextBtn=e.querySelector("button[next-img]"),this._prevBtn.addEventListener("click",(()=>{this._currImgIdx>0?this._currImgIdx--:this._pictures.length>0&&(this._currImgIdx=this._pictures.length-1),this.update()})),this._nextBtn.addEventListener("click",(()=>{this._currImgIdx{const e=this._pictures[this._currImgIdx];this._pictures=this._pictures.filter((t=>t!==e)),this._currImgIdx=0,this.update()}),{design:`${e}; padding-left: 8px; padding-top: 4px;`,svg:"bin"})}buildRotationButton(e,t,i){return a.button("","",(()=>{this._pictures[this._currImgIdx].rotation=(0,s.Degrees)((this._pictures[this._currImgIdx].rotation+t)%360),this.update()}),{design:`${e}; padding-left: 8px; padding-top: 4px;`,svg:i})}buildRotateLeftButton(e){return this.buildRotationButton(e,270,"rotateLeft")}buildRotateRightButton(e){return this.buildRotationButton(e,90,"rotateRight")}buildUploadPictureButton(e,t){return a.button("","",(()=>{t.click()}),{design:`${e}; padding-top: 5px;`,svg:"upload"})}swapToPrev(){this._currImgIdx>0?this._currImgIdx--:this._pictures.length>0&&(this._currImgIdx=this._pictures.length-1),this.update()}swapToNext(){this._currImgIdx{}),"",{type:"file"});this.registerFileUploadCallback(t),this._pictureElem=a.img("","https://dashboard.communitybox.co/img/uploaded/img_gallery_test.jpeg",{design:"width: auto;height: 100%;"}),this._nextBtn=a.button("","",(()=>{this.swapToNext()}),{design:"border: none; font-size: 27px; color: #aeb4b9; background: transparent; position: absolute; right: 50px; top: 47%; cursor: pointer;",svg:"next"}),this._prevBtn=a.button("","",(()=>{this.swapToPrev()}),{design:"border: none; font-size: 27px; color: #aeb4b9; background: transparent; position: absolute; left: 50px; top: 47%; cursor: pointer;",svg:"previous"}),this._deleteBtn=this.buildDeleteButton(e);const i=this.buildRotateRightButton(e),n=this.buildRotateLeftButton(e);return this._editingControls=[i,n],this._img_frame=a.div("image-frame",[a.div("image-gallery-overlay",[this.buildUploadPictureButton(e,t),this._deleteBtn,i,n],{design:"z-index: 1; row-gap: 7px; position: absolute; top: 0px; right: 0px; display: flex; box-sizing: border-box; flex-direction: column;"}),this._nextBtn,this._prevBtn,this._pictureElem,t],{design:"width:100%; height: 255px; margin-top: 10px; display: flex; justify-content: center; position: relative;"}),this._img_frame}buildPictureEditorProgressBar(){return this._upload_progress_label=a.elem("label"),this._upload_progress_label.textContent="Uploading",this._upload_progress_meter=a.progress(),this._upload_progress_container=a.div("flex col cntr vcntr upload-progress",[this._upload_progress_meter,this._upload_progress_label],{design:"width: 100%; height: 255px; display: none;"}),this._upload_progress_container}buildPictureEditorInnerFrame(){return a.div("inputcontent",[a.div("label",[],{text:this._field.label}),this.buildPictureEditorProgressBar(),this.buildPictureEditorEasel()])}buildPictureEditor(){return a.div("",[this.buildPictureEditorInnerFrame()],{classes:["cbeb-entry-input-label"]})}inputHtmlElem(){const e=this.buildPictureEditor();return this.update(),e}constructor(e,t,i){if(super(e,t),this._entry=e,this._field=t,this._directory=i,e.hasValueForField(t.key)){const i=e.getValueOf(t.key);if(i instanceof Array)this._pictures=i.map((e=>(0,r.PictureDataFrom)(e)));else{const e=i.length>0?i.split(","):[];this._pictures=e.map((e=>(0,r.PictureDataFrom)(e)))}}}}t.ImageGallery=c},5397:(e,t)=>{"use strict";var i;function n(e){return e.png||e.jpeg||e.avif}Object.defineProperty(t,"__esModule",{value:!0}),t.PictureLinkFrom=function(e,t,o){const r="https://dashboard.communitybox.co/img/uploaded/undefined.jpeg";if(null!=e.metadata&&e.metadata.formats.length>0)return`https://cdn.communitybox.co/${n(o?e.metadata.formats.find((e=>e.largestDim>o))||e.metadata.formats[0]:e.metadata.formats[1])}`;if(null!=e.key)switch(-1!==(s=e.key).indexOf("drive.google.com")?i.drive:-1!==s.indexOf("gravatar")?i.grav:s.length>8&&"https://"===s.substr(0,8)?i.linked:i.uploaded){case i.linked:return e.key.split("?")[0];case i.uploaded:return`https://dashboard.communitybox.co/img/uploaded/${e.key}.jpeg`;case i.drive:return function(e){const t=new RegExp("[\\/=]([_-\\w]{31,})[\\/]?").exec(e);return t&&t.length>1?`https://lh3.googleusercontent.com/d/${t[1]}`:""}(e.key);case i.grav:return function(e,t){return`${e.split("?")[0].split(",")[0]}?s=150&d=${encodeURIComponent(t)}`}(e.key,r)}var s;return null!=t.metadata?`https://cdn.communitybox.co/${n(o&&t.metadata.formats.find((e=>e.largestDim>o))||t.metadata.formats[0])}`:null!=t.key?`https://dashboard.communitybox.co/img/uploaded/${t.key}.jpeg`:r},function(e){e[e.uploaded=0]="uploaded",e[e.linked=1]="linked",e[e.drive=2]="drive",e[e.grav=3]="grav"}(i||(i={}))},3615:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.upload_image=function(e,t,i){return new n.Promise(((r,l)=>{(function(e,t,i){return new n.Promise(((r,s)=>{const l=(0,o.uuidv4)();var c;(c=e,new n.Promise(((e,t)=>{const i=new FileReader;i.readAsDataURL(c),i.onload=()=>{e(i.result.slice(i.result.indexOf("base64,")+7))},i.onerror=e=>{t(e)}}))).then((e=>{const s=131072,c=Math.ceil(e.length/s),u=(0,o.uuidv4)(),d=[];for(let n=0;n(i(n/c),a({b64data:o,filename:l,uploadKey:u,partIdx:n,nbParts:c,directory:t}))))}var h;(h=d,h.reduce(((e,t)=>e.then((e=>t().then(Array.prototype.concat.bind(e))))),n.Promise.resolve([]))).then((()=>{const n=e.length-(c-1)*s;a({b64data:e.slice(e.length-n,e.length),filename:l,uploadKey:u,partIdx:c-1,nbParts:c,directory:t}).then((e=>{i(1),r(e)}))}))}))}))})(e,t,(e=>i(.71*e,"uploading..."))).then((e=>{const t=e.bucket_path.split("/").filter(((e,t)=>t>0)).join("/");var o;i(.71,"processing..."),(o=t,new n.Promise(((e,t)=>{(0,s.PostRequest)({stage:"cfapi",url:"/resize/image",payload:{image_key:o},callback:{onResult:t=>e(t),onFailure:e=>{console.error(e),t(e)}}})}))).then((e=>{i(1,""),r(e.resized_image_key)})).catch((e=>{l(e)}))})).catch((e=>{l(e)}))}))};const n=i(6964),o=i(3221),r=i(8741),s=i(7422);function a(e){return new n.Promise(((t,i)=>{const n=new XMLHttpRequest;n.open("post","https://api.communitybox.co/upload/file",!0),n.upload.addEventListener("progress",(function(e){r.UpdateMeter(e.loaded/e.total)})),n.onload=function(){4===n.readyState&&200===n.status?t(JSON.parse(n.responseText)):i(n.responseText)},n.send(JSON.stringify({box:e.directory,profile:"temp",filename:e.filename,part:e.partIdx,total_parts:e.nbParts,key:e.uploadKey,b64_data:e.b64data}))}))}},7074:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InvitationLookupDlgBox=void 0;const n=i(5603),o=i(8114),r=i(8448),s=i(7422);t.InvitationLookupDlgBox=class{_invariants;_dlgElem=document.querySelector("[cbeb-invitation-lookup-modal]");_lookupMsgElem=this._dlgElem.querySelector("[cbeb-lookup-msg]");_okBtnElem=this._dlgElem.querySelector("[okay-button]");_containerElem=this._dlgElem.querySelector("[cbeb-signup-container]");_gdprLabelElem=this._dlgElem.querySelector("label");_gdprElem=this._dlgElem.querySelector("[cbeb-gdpr-optin]");_pwordElem=this._dlgElem.querySelector("[cbeb-pword-input] input");_inviteEmailElem=this._dlgElem.querySelector("[invite-email]");_signingUpElem=this._dlgElem.querySelector("[cbeb-signing-up]");_cachedMemberKey="";_cachedInvitationToken="";constructor(e,t,i,o){this._invariants=t,n.DialogBoxMgr.registerDialogBox(this._dlgElem),this._containerElem.style.visibility="hidden",this._signingUpElem.style.display="none",this._gdprLabelElem.textContent=e.GetGDPROptinMsg(),this._pwordElem.addEventListener("input",(e=>{this._pwordElem.value.length>0?(this._okBtnElem.removeAttribute("disabled"),this._okBtnElem.style.backgroundColor="#1abc9c"):(this._okBtnElem.removeAttribute("disabled"),this._okBtnElem.style.backgroundColor="#dddddd")})),this._okBtnElem.addEventListener("click",(()=>{this.onOK(i,o)}))}Show(e,t){this._cachedMemberKey=e.memberKey,this._cachedInvitationToken=e.invitationToken,n.DialogBoxMgr.show(this._dlgElem),o.Styling.applyDialogTitleStyleTo({dlgElem:this._dlgElem,withConfig:t}),(0,s.PostRequest)({url:"https://api.communitybox.co/verify/invitation",payload:{memberKey:e.memberKey,invitationToken:e.invitationToken},callback:{onResult:e=>{this._inviteEmailElem.textContent=e.memberEmail,this._lookupMsgElem.style.display="none",this._containerElem.style.visibility="visible"},onFailure:function(e){console.error(e)}}})}onOK(e,t){e((()=>{this._containerElem.style.display="none",this._signingUpElem.style.display="flex",n.DialogBoxMgr.show(this._dlgElem),(0,s.PostRequest)({url:"https://api.communitybox.co/member/accept/invitation",payload:{memberKey:this._cachedMemberKey,invitationToken:this._cachedInvitationToken,gdprOptin:null!==document.querySelector("[cbeb-gdpr-optin]:checked"),pword:this._pwordElem.value},callback:{onResult:e=>{r.AuthCache.cacheAuthLocally({member:this._cachedMemberKey,token:e.authToken}),t(this._invariants)},onFailure:function(e){console.error(e)}}})}))}}},6924:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.layout_renderer_generic=t.layout_renderer=void 0;const n=i(5397),o=i(5801),r=i(9479),s=i(5671),a=i(4695),l=i(3032),c=i(5576),u=i(7746),d=String.fromCharCode(8212);class h{}t.layout_renderer=h,t.layout_renderer_generic=class extends h{_config;_layout;_template;_activate_tag_filter_fun;_activate_popup_fun;build_spacer(e){const t=document.createElement("div");return t.style.height=`${e}px`,t.style.flexShrink="0",t}export_city_location(e){const t=e.formatted_address.split(",").map((e=>e.trim()));return t.length>2?t[t.length-3]:s.default_format(e.formatted_address)}export_full_location(e){return e.formatted_address}translate_timestamp_to(e){const t=Number(e),i=new Date(t);return`${i.getMonth()+1}.${i.getDate()}`}translated_field_value(e,t){if("image"===t.translator)return this.translate_image_value((0,a.PictureDataFrom)(e));if(void 0===e)return"";switch(t.translator){case"loc-city":return this.export_city_location(e);case"loc-full":return this.export_full_location(e);case"timestamp_mm.dd":return this.translate_timestamp_to(e);default:return e}}overviewLocationFrom(e,t){if(void 0===e)return"";if(-1===e.indexOf(","))return e;switch(t.overviewLocationDisplay){case"default":return s.default_format(e);case"street only":return s.street_only(e);case"city & state":return s.city_and_state(e);case"city only":return s.city_only(e);case"full":return e}}translate_image_value(e){const t=(0,a.PictureDataFrom)(this._config.defaultProfilePictureKey);return(0,n.PictureLinkFrom)((0,a.PictureDataFrom)(e),t)}remove_protocol_from(e){return-1!==(e=e.trim()).indexOf("https://")?e.slice(8,e.length):-1!==e.indexOf("http://")?e.slice(7,e.length):e}build_multi_paragraph_field(e,t,i){const n=document.createElement("div"),o=e.split("\n").filter((e=>e.length>0));for(const[e,r]of o.entries()){const s=this.build_field({value:r,pattern:t,is_tag:!1,profile:i});s&&(n.appendChild(s),e{this._activate_tag_filter_fun(new Map(e.pattern.made_up_of.map((e=>[e,new Set([i])]))))})),void 0!==e.pattern.link){const i=document.createElement("a");if(i.target="_blank",e.pattern.link.startsWith("field:")){const t=e.pattern.link.slice(6,e.pattern.link.length),n=e.profile.getValueOf(t);i.href=n||"",i.style.textDecoration="none"}else i.href=e.pattern.link.replace(/value_goes_here/gi,this.checked_link(e.value??""));return i.appendChild(t),i}return t}build_label_elem(e){const t=document.createElement("div");return t.setAttribute("style",e.design),t.textContent=e.html.replace(/value_goes_here/gi,e.label),t}properInstagramUrlFrom(e){const t="instagram",i=e.replace("@","");return-1===e.indexOf(t)?`http://www.${t}.com/${i}`:null===e.match(/http/)?`http://${i}`:e}properSocMedUrlFrom(e,t){return-1===e.indexOf(t)?`http://www.${t}.com/${e}`:null===e.match(/http/)?`http://${e}`:e}properLinkedInUrlFrom(e){return-1===e.indexOf("linkedin")?`http://www.linkedin.com/in/${e}`:null===e.match(/http/)?`http://${e}`:e}checked_link(e){return-1!==(e=e.trim()).indexOf("https://")||-1!==e.indexOf("http://")||-1!==e.indexOf("mailto:")?e:`https://${e}`}format_link(e,t){switch(t){case"slack":case"website":return this.checked_link(e);case"linkedin":return this.properLinkedInUrlFrom(e);case"instagram":return this.properInstagramUrlFrom(e);default:return this.properSocMedUrlFrom(e,t)}}is_social_media_field(e){if(null!=e)switch(e.ctrlType){case"linkedin-input":return"linkedin";case"twitter-input":return"twitter";case"facebook-input":return"facebook";case"instagram-input":return"instagram";default:return}}build_social_media_elem(e,t,i){const n=document.createElement("div");n.setAttribute("my_div",""),n.setAttribute("flex",""),n.setAttribute("row",""),n.setAttribute("wrap","");const o=e.made_up_of.map((n=>{const o=e.meta&&e.meta[n]?e.meta[n]:this.is_social_media_field(i.getField(n));if(void 0===o)return;const r=t.getValueOf(n);if(void 0===r||0===r.trim().length)return;const s=document.createElement("a");return s.href=this.format_link(r,o),s.target="_blank",s.setAttribute("style",e.design),s.setAttribute("socmed-type",i.getField(n)?.ctrlType||""),s})).filter((e=>void 0!==e));for(const e of o)n.appendChild(e);return n}mapsUrlFrom(e){return void 0!==e.place_URL?e.place_URL:`https://www.google.com/maps/search/?api=1&query="${e.formatted_address}"&query_place_id=${e.placeID}`}build_email_elem(e,t){if(0===e.made_up_of.length)return;const i=t.getValueOf(e.made_up_of[0]);if(void 0===i||0===i.length)return;const n=document.createElement("a");return n.href=`mailto:${i}`,n.textContent=e.html.replace(/value_goes_here/gi,i??""),n.setAttribute("style",e.design.replace(/value_goes_here/gi,i??"")),n}build_location_elem(e,t){let i=t.getValueOf(e.made_up_of[0]);if(void 0===i)return;if("string"==typeof i)try{i=JSON.parse(i)}catch(e){return void console.error(e)}let n="";n="loc-full"===e.translator?i.formatted_address:this.overviewLocationFrom(i.formatted_address,this._config);const o=document.createElement("div");o.setAttribute("style",e.design.replace(/value_goes_here/gi,n??""));const r=document.createElement("span");switch(r.textContent=e.html.replace(/value_goes_here/gi,n??""),void 0===e.viewmap_separator&&(r.textContent+=` ${d} `),e.viewmap_separator){case"none":o.appendChild(r);break;case"loc_is_link":{const t=document.createElement("a");t.href=this.mapsUrlFrom(i),t.textContent=e.html.replace(/value_goes_here/gi,n??""),t.target="_blank",t.style.color=this._config.fgColourOf("link"),o.appendChild(t)}break;default:{o.appendChild(r);const e=document.createElement("a");e.href=this.mapsUrlFrom(i),e.textContent="view on map",e.target="_blank",e.style.color=this._config.fgColourOf("link"),o.appendChild(e)}}return o}build_tag_elem(e,t){const i=document.createElement("div");if(i.setAttribute("flex",""),i.setAttribute("row",""),i.setAttribute("vcntr",""),void 0!==t.meta&&e in t.meta){const n=document.createElement("img");n.src=`https://cdn.communitybox.co/images/${t.meta[e]}`,n.style.objectFit="contain",n.style.width=t.dimensions?`${t.dimensions.width}px`:"25px",n.style.height=t.dimensions?`${t.dimensions.height}px`:"20px",n.style.marginRight="7px",i.appendChild(n)}{const n=document.createElement("div"),o=t.html.replace(/value_goes_here/gi,(()=>e??""));n.setAttribute("style",t.design.replace(/value_goes_here/gi,e??"")),n.addEventListener("click",(()=>{this._activate_tag_filter_fun(new Map(t.made_up_of.map((e=>[e,new Set([o])]))))})),n.textContent=o,i.appendChild(n)}return i}BuildTagHierarchyElem(e,t,i){const n=i.getField(e.made_up_of)?.get();if(null==n||"tag-hierarchy"!==n.ctrl_type)return;const o=t.getValueOf(e.made_up_of);if((0,u.IsValidArrayOfTagKeys)(o)){const t=(0,u.Uniquify)(o.map((t=>"root"===e.level?(0,u.GetRootTagLabelOf)(t,n.tagTree):(0,u.GetTagLabelFor)(t,n.tagTree))).filter((e=>null!=e))),i=t.map(((i,n)=>n!==t.length-1&&e["tag-separator"].length>0?l.div("flex row",[l.p("",`${i}`,{design:e["tag-design"]}),l.p("",e["tag-separator"],{design:e["tag-design"]})]):l.p("",`${i}`,{design:e["tag-design"]}))).flat();return l.div("",i,{design:e["container-design"]})}}build_tag_collection_elem(e,t){const i=e.made_up_of.reduce(((e,i)=>{const n=t.getValueOf(i);return void 0!==n?[...e,..."string"==typeof n?n.split(","):n]:e}),[]).filter((e=>e.length>0));if(0===i.length)return;const n=i.map((t=>this.build_tag_elem(t,e))),o=document.createElement("div");o.setAttribute("tag-collection",""),o.setAttribute("flex",""),o.style.flexWrap="wrap","column"===e.direction||"column-center"===e.direction?o.setAttribute("col",""):o.setAttribute("row",""),"column-center"===e.direction&&(o.style.alignItems="center");for(const e of n)o.appendChild(e);return o}extract_video_identifer(e){if(void 0!==e){if(-1!==e.indexOf("youtube")&&-1!==e.indexOf("playlist?list=")){const t=e.split("list=");return{player:"youtube",key:`videoseries?list=${t[t.length-1]}`}}if(e.startsWith("https://youtu.be/")){const t=e.split("/");return{player:"youtube",key:t[t.length-1]}}if(e.startsWith("https://vimeo.com")){const t=e.split("/");return{player:"vimeo",key:t[t.length-1]}}}}player_src_for(e){switch(e.player){case"youtube":return`https://www.youtube.com/embed/${e.key}`;case"vimeo":return`https://player.vimeo.com/video/${e.key}`}}build_video_elem(e,t){if(0===e.made_up_of.length)return;const i=this.extract_video_identifer(t.getValueOf(e.made_up_of[0]));if(void 0===i||0===i.key.length)return;const n=document.createElement("iframe");return n.src=this.player_src_for(i),n.allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",n.allowFullscreen=!0,n.setAttribute("style",e.design),n}get_override_value(e,t){const i=t.getValueOf(e);return void 0===i?"":"string"==typeof i?i:i instanceof Array?i.join(","):""}display_value_for(e,t){return void 0!==e.override&&-1!==this.get_override_value(e.override.if,t).indexOf(e.override.contains)?e.override.value:e.made_up_of.reduce(((i,n)=>{const o=this.translated_field_value(t.getValueOf(n),e);return void 0===o||0===o.length?i:[i,this.translated_field_value(t.getValueOf(n),e)].join(" ").trim()}),"")}crop(e,t){if(void 0!==t.max_words){const i=e.split(" ");if(i.length>t.max_words)return`${i.slice(0,t.max_words).join(" ")}...`}return e}build_regular_pattern_elem(e,t,i){switch(e.special){default:{const i=this.crop(this.display_value_for(e,t),e);return void 0===i||0===i.length?void 0:!0===e.respect_newline?this.build_multi_paragraph_field(i,e,t):this.build_field({value:i,pattern:e,is_tag:!1,profile:t})}case"socmed":return this.build_social_media_elem(e,t,i);case"tags":return this.build_tag_collection_elem(e,t);case"location":return this.build_location_elem(e,t);case"email":return this.build_email_elem(e,t);case"video":return this.build_video_elem(e,t)}}build_img_elem(e,t){const i=document.createElement("img");i.src=e.origin,i.setAttribute("style",e.design);const n=document.createElement("a");n.target="_blank";let o=t.getValueOf(e.made_up_of);return o&&-1!==o.indexOf("@")&&(o=`mailto:${o}`),n.href=o||"",n.style.textDecoration="none",n.appendChild(i),n}buildBannerElem(e){const t=e.getValueOf("feature_level");return void 0!==t&&"string"==typeof t&&"1"===t?l.div("cornerbanner",[l.p("mt0 mb0",this._config.featuredBannerText)],{design:"z-index: 4; position: absolute; top: 46px; left: -63px; background-color: #D62281; display: flex; justify-content: center; align-items: center; transform: rotate(-45deg); box-sizing: border-box; padding: 10px 100px 10px 100px; color: white; box-shadow: 7px 7px 5px 0px rgb(0 0 0 / 16%);"}):void 0}build_picture_elem(e,t){const i=t.getValueOf(e.made_up_of),o=(0,n.PictureLinkFrom)((0,a.PictureDataFrom)(i||e.made_up_of),(0,a.PictureDataFrom)(null),250);if(void 0===o)return;const r=document.createElement("img");return r.src=o,r.setAttribute("style",e.design),l.div("flex col w100p",[this.buildBannerElem(t),r],{design:"position: relative; overflow: hidden;"})}build_connect_btn_elem(e,t){const i=document.createElement("button");return i.setAttribute("style",e.design),i.textContent=e.button_label,i.addEventListener("click",(()=>{(new o.ConnectionDialogBox).showForEntry(t,this._template,this._config,t.box)})),i}build_readmore_btn_elem(e,t){const i=document.createElement("button");return i.setAttribute("style",e.design),i.textContent=e.label,i.addEventListener("click",(()=>{this._activate_popup_fun(t.key)})),i}build_share_btn_elem(e,t){return l.button("",e.button_label,(()=>{(0,c.handle_sharing_req)(t,this._config,this._template)}),{design:e.design})}build_link_btn_elem(e,t){const i=t.getValueOf(e.made_up_of);if(void 0===i||0===i.length)return;const n=t.getValueOf(e.made_up_of),o=-1!==n.indexOf("@")?`mailto:${n}`:n;return l.anchor("",e.button_label,o,{design:e.design,open_in_new_tab:"yes"})}build_directions_btn_elem(e,t){const i=t.getValueOf(e.made_up_of);if(void 0===i)return;const n=document.createElement("button");return n.setAttribute("style",e.design),n.textContent=e.button_label,n.addEventListener("click",(()=>{const e=`https://www.google.co.uk/maps/dir//${i.lat},${i.lng}`;window.location.href=e})),n}add_desktop_gallery_elem_to(e,t,i,n,o){let r=0;for(const s of(0,u.take)(t,i)){const a=document.createElement("img");a.src=s,a.style.objectFit="cover";const l=document.createElement("div");if(l.style.display="flex",l.style.flexDirection="row",l.style.justifyContent="center",l.style.height="inherit",void 0===o.dimensions||"variable"===o.dimensions?l.style.flexBasis=`${Math.floor(99/(i/n))}%`:(l.style.width=`${o.dimensions}px`,l.style.height=`${o.dimensions}px`,r>0&&(l.style.marginLeft="10px")),"yes"===o.arrows){a.style.width="85%",a.style.height="inherit";const e=this.build_img_gallery_arrow_ctrls(a,t);l.appendChild(e.left),l.appendChild(a),l.appendChild(e.right)}else a.style.width="100%",l.appendChild(a);e.appendChild(l),r+=1}}build_img_gallery_arrow_ctrls(e,t){let i=0;const n=document.createElement("div"),o=document.createElement("div");for(const e of[n,o])e.style.display="flex",e.style.justifyContent="center",e.style.alignItems="center";const r=document.createElement("button");r.textContent="<",r.addEventListener("click",(function(){0===i?i=t.length-1:i-=1,e.src=t[i]})),n.appendChild(r);const s=document.createElement("button");s.textContent=">",s.addEventListener("click",(function(){i=(i+1)%t.length,e.src=t[i]})),o.appendChild(s);for(const e of[r,s])e.style.fontSize="33px",e.style.height="35px",e.style.backgroundColor="transparent",e.style.color="#555",e.style.border="none";return{left:n,right:o}}add_mobile_gallery_elem_to(e,t){const i=document.createElement("img");i.src=t[0],i.style.objectFit="cover",i.style.width="85%",i.style.height="210px";const n=document.createElement("div");n.style.display="flex",n.style.flexDirection="row",n.style.justifyContent="center";const o=this.build_img_gallery_arrow_ctrls(i,t);n.appendChild(o.left),n.appendChild(i),n.appendChild(o.right),e.appendChild(n)}build_gallery_elem(e,t){const i=t.getValueOf(e.field);if(void 0===i)return;const o=(i instanceof Array?i:i.split(",").map((e=>(0,a.PictureDataFrom)(e)))).filter((e=>void 0!==e.key&&e.key.length>0)).map((e=>(0,n.PictureLinkFrom)(e,(0,a.PictureDataFrom)(null),250))).filter((e=>"string"==typeof e));if(0===o.length)return;const s=document.createElement("div");return s.setAttribute("style",e.design),!0===(0,r.mobile_aspect)()?this.add_mobile_gallery_elem_to(s,o):this.add_desktop_gallery_elem_to(s,o,e.nb_images_on_display||3,e.nb_rows||1,e),s}build_call_btn_elem(e,t){const i=t.getValueOf(e.made_up_of);if(void 0===i)return;const n=document.createElement("button");return n.setAttribute("style",e.design),n.textContent="value_goes_here"===e.button_label?i:e.button_label,n.addEventListener("click",(()=>{const e=`tel:${i}`;window.location.href=e})),n}build_pattern_elem(e,t,i){switch(e.type){case"tag-hierarchy":return this.BuildTagHierarchyElem(e,t,i);case"connect-btn":return this.build_connect_btn_elem(e,t);case"directions_btn":return this.build_directions_btn_elem(e,t);case"link_btn":return this.build_link_btn_elem(e,t);case"share_btn":return this.build_share_btn_elem(e,t);case"call_btn":return this.build_call_btn_elem(e,t);case"gallery":return this.build_gallery_elem(e,t);case"image":return this.build_img_elem(e,t);case"picture":return this.build_picture_elem(e,t);case"readmore-btn":return this.build_readmore_btn_elem(e,t);case"default":return this.build_regular_pattern_elem(e,t,i)}}build_top_row(){if(void 0!==this._layout.top_row){const e=document.createElement("div");return e.innerHTML=this._layout.top_row.html,e.setAttribute("style",this._layout.top_row.design),e}}build(e){const t=document.createElement("div");t.setAttribute("style",this._layout.frame.design),t.innerHTML=this._layout.frame.html;for(const i in this._layout.area_map){const n=t.querySelector(`[area='${i}']`);if(null!==n)for(const t of this._layout.area_map[i])if(t in this._layout.patterns){const i=this._layout.patterns[t],o=this.build_pattern_elem(i,e.profile,e.template);o&&(i.top_margin>0&&n.appendChild(this.build_spacer(i.top_margin)),"default"!==i.type&&"tag-hierarchy"!==i.type||void 0===i.label||void 0===this._layout.label||n.appendChild(this.build_label_elem({label:i.label,design:this._layout.label.design,html:this._layout.label.html})),"default"===i.type&&!0===i.activate_popup&&o.addEventListener("click",(()=>{this._activate_popup_fun(e.profile.key)})),n.appendChild(o))}else console.error(`No pattern for area component ${t} in area ${i}`);else console.error(`Could not find element matching selector [area='${i}']`)}return t}constructor(e,t,i,n,o){super(),this._config=e,this._layout=t,this._template=i,this._activate_tag_filter_fun=n,this._activate_popup_fun=o}}},5665:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.layout_builder=void 0;const n=i(7238),o=i(6924);class r extends n.OverviewBuilder{_config;layout;_template;_activate_tag_filter_fun;_activate_popup;_layout;constructor(e,t,i,n,r){super(),this._config=e,this.layout=t,this._template=i,this._activate_tag_filter_fun=n,this._activate_popup=r,this._layout=new o.layout_renderer_generic(e,t,i,n,r)}buildOverviewHtml(e,t){return this._layout.build({profile:e,template:t})}build_top_row(){return this._layout.build_top_row()}getProfileFlexBasis(){return 100}}t.layout_builder=r},8595:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ListOverviewBuilder=void 0;const n=i(7238),o=i(1165),r=i(5397),s=i(4695);class a extends n.OverviewBuilder{buildOverviewPhotoHtml(e,t,i){const n="https://dashboard.communitybox.co/img/uploaded/"+i.defaultProfilePictureKey+".jpeg",a="circle"===i.profilePictureAspect?"50%":"0",l=t.getRuleForType(o.TemplateRuleType.Picture),c=l.length>0?e.getValueOf(l[0].key):void 0;return`\n
0&&-1===c.indexOf("gravatar")?(0,r.PictureLinkFrom)((0,s.PictureDataFrom)(c),(0,s.PictureDataFrom)(n)):n}');\n border-radius: ${a};\n "\n show-overview-on-click\n entryKey="${e.key}" >\n
`}buildDisplayNameHtml(e,t,i){const n=`\n cursor: pointer;\n font-weight: bold;\n color: #${i.fgColourOf("profile_name")};\n line-height: 1em;\n `;return[`
`,e.getDisplayNameForTemplate(t),"
"].join("")}buildOverviewOtherNameHtml(e,t,i){var n=t.getRuleForType(o.TemplateRuleType.OtherTitle),r="";return n.forEach((t=>{e.hasValueForField(t.key)&&(r+=e.getValueOf(t.key)+t.interval)})),i.fgColourOf("subtitle"),""!==r?['
',r,"
"].join(""):""}getRuleValue(e,t){return t&&e.hasValueForField(t)?e.getValueOf(t):void 0}extractCategoryArrayFrom(e){if(void 0!==e)return"string"==typeof e&&e.length>0?e.split(","):e}isCategoryArray(e){return void 0!==e}buildOverviewCategoriesHtml(e,t,i){const n=t.getRuleForType(o.TemplateRuleType.Category),r=n&&n.length>0?n.map((t=>this.getRuleValue(e,t.key))).map((e=>this.extractCategoryArrayFrom(e))).filter((e=>this.isCategoryArray(e))).reduce(((e,t)=>e.concat(t)),[]):void 0;let s=this.extractCategoryArrayFrom(r);return s?(s=s.filter((function(e,t,i){return i.indexOf(e)===t})),['
',s.filter((e=>""!==e)).map((function(e){return[`
",e,"
"].join("")})).join(""),"
"].join("")):""}addOverviewBioSnippet(e,t,i){if(null===t)return"";let n="";if(t.length<100)n=t;else{for(var o=0,r=0;r<100;r++)" "===t[r]&&(o=r);n=t.substring(0,o)+"..."}const s=`\n display: flex;\n justify-content: flex-start;\n text-decoration: underline;\n cursor: pointer;\n font-size: 12px;\n margin-top: 17px;\n color:#${i.fgColourOf("social_media")};\n `;return["
",'
',n,"
",`
read more
","
"].join("")}buildOverviewParagraphHtml(e,t,i){const n=t.getRuleForType(o.TemplateRuleType.Paragraph),r=n&&n.length>0?this.getRuleValue(e,n[0].key):void 0;return r?this.addOverviewBioSnippet(e,r,i):""}mapsUrlFrom(e){return void 0!==e.place_URL?e.place_URL:`https://www.google.com/maps/search/?api=1&query="${e.formatted_address}"&query_place_id=${e.placeID}`}defaultLocDisp(e){var t=e.split(","),i=(t.length>1?t[t.length-2]:t[t.length-1]).split(" "),n=[];return i.forEach((e=>{!1===/\b[A-Z0-9]+?\b/.test(e)&&n.push(e)})),""===n.join(" ")&&t.length>2&&(i=t[t.length-3].split(" ")).forEach((function(e){!1===/\b[A-Z0-9]+?\b/.test(e)&&n.push(e)})),n.join(" ")}streetOnlyLocDisp(e){const t=e.split(",");return t.length>0?t[0]:e}cityAndStateLocDisp(e){const t=e.split(/[,\ ]/g).map((e=>e.trim())).filter((e=>e.length>0));let i=0;for(let e=0;e0?`${t[i-1]}, ${t[i]}`:this.defaultLocDisp(e)}overviewLocationFrom(e,t){if(void 0===e)return"";if(-1===e.indexOf(","))return e;switch(t.overviewLocationDisplay){case"default":return this.defaultLocDisp(e);case"street only":return this.streetOnlyLocDisp(e);case"city & state":return this.cityAndStateLocDisp(e)}}buildOverviewEmailHtml(e,t,i){const n=t.getAnyKeyWithInputType("email-input");if(void 0===n)return"";const o=e.getValueOf(n);return null==o||"string"!=typeof o||0===o.length?"":`
${o}
`}buildOverviewLocationHtml(e,t,i){const n=t.getRuleForType(o.TemplateRuleType.Location);let r=n&&n.length>0?this.getRuleValue(e,n[0].key):void 0;if("string"==typeof r)try{r=JSON.parse(r)}catch{r={formatted_address:r.trim(),lat:0,lng:0,place_URL:`https://www.google.com/maps/search/?api=1&query='${r.trim()}'`}}const s=`\n font-size: 16px;\n margin-top: 19px;\n margin-left: 17px;\n margin-right: 17px;\n color: #${i.fgColourOf("location")};\n `;return r?[`"].join(""):""}properSocMedUrlFrom(e,t){return-1===e.indexOf(t)?`http://www.${t}.com/${e}`:null===e.match(/http/)?`http://${e}`:e}properLinkedInUrlFrom(e){return-1===e.indexOf("linkedin")?`http://www.linkedin.com/in/${e}`:null===e.match(/http/)?`http://${e}`:e}getURLandGlyphForSocialMedia(e,t){switch(t.ctrlType){case"website-input":return{dstURL:"https://"+e.getValueOf(t.key),faGlyph:"fas fa-link"};case"twitter-input":return{dstURL:this.properSocMedUrlFrom(e.getValueOf(t.key),"twitter"),faGlyph:"fab fa-twitter"};case"linkedin-input":return{dstURL:this.properLinkedInUrlFrom(e.getValueOf(t.key)),faGlyph:"fab fa-linkedin-in"};case"facebook-input":return{dstURL:this.properSocMedUrlFrom(e.getValueOf(t.key),"facebook"),faGlyph:"fab fa-facebook-f"};case"instagram-input":return{dstURL:this.properSocMedUrlFrom(e.getValueOf(t.key),"instagram"),faGlyph:"fab fa-instagram"};case"pinterest-input":return{dstURL:this.properSocMedUrlFrom(e.getValueOf(t.key),"pinterest"),faGlyph:"fab fa-pinterest"}}return{dstURL:"",faGlyph:""}}addSocialMediaSummary(e,t,i){let n='
';return t.forEach((t=>{const o=this.getURLandGlyphForSocialMedia(e,t);n=n+''})),n+="
",n}buildOverviewSocialMediaHtml(e,t,i){let n=t.getRuleForType(o.TemplateRuleType.SocialMedia).map((e=>t.getField(e.key))).filter((e=>void 0!==e)).filter((e=>e.isSocialMediaField())).filter((t=>e.hasValueForField(t.key)));return this.addSocialMediaSummary(e,n,i)}hasEmailAddress(e,t){const i=t.getAnyKeyWithInputType("email-input");if(void 0===i)return!1;const n=e.getValueOf(i);return null!=n&&"string"==typeof n&&n.length>0}buildOverviewConnectHtml(e,t,i){return i.matchMakingEnabled&&this.hasEmailAddress(e,t)||i.matchMakingEnabled&&"bespoke"===i.matchMakeDestinationChoice?`
':""}buildOverviewHtml(e,t,i){const n=[t.fieldsOfType("image-input").length>0?this.buildOverviewPhotoHtml(e,t,i):"",'
',this.buildDisplayNameHtml(e,t,i),this.buildOverviewOtherNameHtml(e,t,i),"
",this.buildOverviewCategoriesHtml(e,t,i),this.buildOverviewParagraphHtml(e,t,i),this.buildOverviewEmailHtml(e,t,i),this.buildOverviewLocationHtml(e,t,i),this.buildOverviewSocialMediaHtml(e,t,i),this.buildOverviewConnectHtml(e,t,i)].join(""),o=document.createElement("div");return o.style.display="flex",o.style.flexDirection="row",o.style.flexBasis="100%",o.style.paddingLeft="20px",o.style.paddingRight="20px",o.setAttribute("id","emb-"+e.key),o.innerHTML=n,o}build_top_row(){}getProfileFlexBasis(e){return 100}}t.ListOverviewBuilder=a},5671:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default_format=o,t.street_only=function(e){const t=e.split(",");return t.length>0?t[0]:e},t.city_and_state=function(e){const t=/^\b([A-Za-z\ ]+?)\b\s+([0-9]+)$/,i=(s=e,s.replace("WA, District of Columbia","Washington, DC")).split(",").map((e=>e.trim())).map((e=>{if(!0===t.test(e)){const t=e.split(/\s/);return t.pop(),t.join(" ")}return e})).filter((e=>e.length>0));var s;for(let e=i.length-1;e>=0;e--){const t=i[e].toLowerCase();if(t in n.state_dict)return e>0?`${i[e-1]}, ${n.state_dict[t].toUpperCase()}`:r(t);if(t in n.reverse_state_dict)return e>0?`${i[e-1]}, ${i[e]}`:r(n.reverse_state_dict[t])}return o(e)},t.city_only=function(e){const t=/^\b([A-Za-z\ ]+?)\b\s+([0-9]+)$/,i=e.split(",").map((e=>e.trim())).filter((e=>e.length>0));if("USA"!==(n=i)[n.length-1])return i.length>2?i[i.length-3]:i.length>0?function(e){return e.trim().split(" ").filter((e=>e!==e.toUpperCase()&&!1===/[0-9]/.test(e))).join(" ")}(i[0]):"";var n;let r=0;for(let e=0;e0?`${i[r-1]}`:o(e)};const n=i(4745);function o(e){var t=e.split(","),i=(t.length>1?t[t.length-2]:t[t.length-1]).split(" "),n=[];return i.forEach((e=>{!1===/\b[A-Z0-9]+?\b/.test(e)&&n.push(e)})),""===n.join(" ")&&t.length>2&&(i=t[t.length-3].split(" ")).forEach((function(e){!1===/\b[A-Z0-9]+?\b/.test(e)&&n.push(e)})),n.join(" ").trim()}function r(e){return e.split(" ").map((e=>"of"===e?e:e.slice(0,1).toUpperCase()+e.slice(1))).join(" ")}},8428:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LocationEditCtrl=void 0;const n=i(1045),o=i(4745),r=i(5915),s=i(3032);class a extends n.field_edit_ctrl{_entry;_field;_config;_invariants;_mruPlace;_autocompleteElem;_loc_elem;_mpt_geocoder=void 0;_uuid=(new Date).getTime().toString();fillinLocation(e){this._mruPlace={formatted_address:e.formatted_address,placeID:e.place,place_URL:`https://maps.google.com/?q=${e.formatted_address.split(", ").join("+")}`,lat:e.lat,lng:e.lng}}geocoding_service(){return"undefined"!=typeof google&&"undefined"!=typeof g_bespoke_google_api_key&&void 0!==g_bespoke_google_api_key?"google":null!=this._invariants.documentState.mbk?"mapbox":"google"}init_autocomplete(e,t){"google"===this.geocoding_service()?this.use_google_for_autocomplete(e,t):this.use_mapbox_for_autocomplete(this._config)}replace_state_with_abbreviation(e){const t=e.split(","),i=[];for(const e of t){const t=e.toLowerCase().trim();t in o.state_dict?i.push(` ${o.state_dict[t].toUpperCase()}`):i.push(e)}return i.join(",")}use_mapbox_for_autocomplete(e){this._mpt_geocoder=new r({accessToken:this._invariants.documentState.mbk,types:"address,country,region,place,postcode,locality,neighborhood",placeholder:e.location_search_placeholder,mode:"mapbox.places-permanent",minLength:5}),this._mpt_geocoder.on("result",(e=>{const t=e.result.center[0],i=e.result.center[1];this.fillinLocation({formatted_address:this.replace_state_with_abbreviation(e.result.place_name),place:e.result.id,lat:i,lng:t})}))}post_dom_add(){if(this._mpt_geocoder){const e=`#for-field-${this._field.key}-${this._uuid}`;this._mpt_geocoder.addTo(e),this._mruPlace&&this._mruPlace.formatted_address&&(document.body.querySelector(e).querySelector(".mapboxgl-ctrl-geocoder--input").value=this._mruPlace.formatted_address)}}use_google_for_autocomplete(e,t){this._loc_elem=e.querySelector(`input[fieldKey="${t}"]`),this._autocompleteElem=new google.maps.places.Autocomplete(this._loc_elem,{fields:["geometry.location","place_id","formatted_address"]}),this._autocompleteElem.addListener("place_changed",(()=>{const e=this._autocompleteElem.getPlace();this.fillinLocation({formatted_address:e.formatted_address,place:e.place_id,lat:e.geometry?e.geometry.location.lat():void 0,lng:e.geometry?e.geometry.location.lng():void 0})}))}data(){return this._mruPlace?this._mruPlace:void 0}has_data(){return this._entry.hasValueForField(this._field.key)}labelHtml(){return`
${this._field.label}${!0===this._field.required?" (required)":""}${"everyone"!==this._field.editable_by?'  ':""}
`}viewHtmlElem(){let e=this._entry.getValueOf(this._field.key);if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e=void 0}let t="";if("object"==typeof e&&e.hasOwnProperty("formatted_address")&&e.hasOwnProperty("place_URL")){const t=e.manual_full?e.manual_full.split("\n"):[e.formatted_address];return s.div(`field=${this._field.key}`,[s.div("",[s.div("",[this._field.detail_label&&this._field.detail_label.length>0?s.p("detail-label",this._field.detail_label):s.i({class:"fas fa-map-marker-alt cbeb-detailleft"}),...t.map((e=>s.p("",e)))],{classes:["cbeb-entry-view","cbeb-center","cbeb-entry-viewfield-container"]})],{classes:["cbeb-entry-input-row-input"]})],{classes:["cbeb-entry-view-row"]})}t="";const i=document.createElement("div");return i.innerHTML="",i}inputHtmlElem(){var e="";if(this._entry.hasValueForField(this._field.key)){let t=this._entry.getValueOf(this._field.key);if("string"==typeof t)try{t=JSON.parse(t)}catch(e){t=void 0}"object"==typeof t&&(this._mruPlace={formatted_address:t.formatted_address,placeID:t.placeID,place_URL:t.place_URL,lat:t.lat,lng:t.lng},e=t.formatted_address)}const t=this.leftOfInputRow()+this.labelHtml()+`
`+("google"===this.geocoding_service()?`':"")+"
"+this.rightOfInputRow(),i=document.createElement("div");return i.innerHTML=t,this.init_autocomplete(i,this._field.key),i}constructor(e,t,i,n){super(e,t),this._entry=e,this._field=t,this._config=i,this._invariants=n}}t.LocationEditCtrl=a},3680:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoginDialogBox=void 0;const n=i(5603),o=i(8114),r=i(8448),s=i(2703),a=i(9496);t.LoginDialogBox=class{_config;_dlgElem=document.getElementById("cbeb-login-modal");_okBtnElem=document.getElementById("cbeb-login-dialog-ok-btn");_extraOkBtnElem=document.getElementById("cbeb-extra-logindlg-login-btn");_cancelBtnElem=document.getElementById("cbeb-login-dialog-cancel-btn");_extraCancelBtnElem=document.getElementById("cbeb-extra-logindlg-cancel-btn");_dlgBodyElem=document.getElementById("cbeb-login-field-container");_spinnerElem=document.getElementById("cbeb-login-spinner");_errorContainerElem=document.getElementById("cbeb-login-dlg-error-container");_errorMsgElem=document.getElementById("cbeb-login-dlg-error-msg");_pwordRowElem=this._dlgElem.querySelector("[pword-input-row]");_loginMsg=this._dlgElem.querySelector("[login-msg]");_signupPrompt=this._dlgElem.querySelector("[signup-prompt]");_callbacks={onLogin:()=>{},onFailure:()=>{}};constructor(e,t,i,r){this._config=e,n.DialogBoxMgr.registerDialogBox(this._dlgElem),o.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:this._config}),this._spinnerElem.style.display="none",this._errorContainerElem.style.display="none",this._okBtnElem.addEventListener("click",(()=>{this.OnOK(t,i,r)})),this._extraOkBtnElem.addEventListener("click",(()=>{this.OnOK(t,i,r)})),this._cancelBtnElem.addEventListener("click",(()=>{this._dlgElem.style.display="none"})),this._extraCancelBtnElem.addEventListener("click",(()=>{this._dlgElem.style.display="none"})),"login-only"===this._config.welcomeFlow&&(this._signupPrompt.style.display="none"),void 0===this._config.loginMsg?this._loginMsg.style.display="none":this._loginMsg.textContent=this._config.loginMsg,document.getElementById("cbeb-login-dlg-tryagain-btn").addEventListener("click",(()=>{this._dlgBodyElem.style.display="flex",this._errorContainerElem.style.display="none"}))}show(e,t,i,o){if(n.DialogBoxMgr.hideAll(),!1===this._config.login_type_allowed(i)){let e="";e="object"==typeof UserAccountApi?!0===UserAccountApi.isUserAuthenticated()?`registered login: ${(0,s.read_cookie)("logged_in_maybe")}`:"User not authenticated":"No UserAccountApi object",o.Show({onClose:()=>{},title:this._config.get_wording("auth-type-fail-dlg-title"),msg:`${this._config.get_wording("auth-type-fail-dlg-msg")} (${e} / auth type: ${i})`,btn_label:this._config.get_wording("auth-type-fail-dlg-btn")})}else!1===t.PromptForPword()&&(this._pwordRowElem.style.display="none"),this._dlgElem.style.display="block",this._dlgBodyElem.style.display="flex",this._errorContainerElem.style.display="none",this._spinnerElem.style.display="none",this._callbacks=e}CollectEmail(){return document.getElementById("cbeb-login-email").value}CollectPassword(){return document.getElementById("cbeb-login-password").value}HideButtons(){this._okBtnElem.style.visibility="hidden",this._cancelBtnElem.style.visibility="hidden"}ErrorForMissingEmail(){document.getElementById("cbeb-login-email-label").innerHTML="email address

- please provide a valid email

"}ErrorForMissingPassword(){document.getElementById("cbeb-login-password-label").innerHTML="password

- please provide a password

"}Spin(){this._dlgBodyElem.style.display="none",this._spinnerElem.style.display="block"}HideSpinner(){this._spinnerElem.style.display="none"}async TryToLogin(e,t){try{const i=await a.Member.Lambda({request:"login-with-email",email:e.email,password:e.password,directory:e.directory});t.onLogin({member:i.member,token:i.token})}catch(e){t.onFailure(`An error occurred: ${e}`)}}ProblemWithEmailField(){var e=this.CollectEmail();return 0===e.length||!1===/@/.test(e)}ProblemWithPasswordField(e){return 0===(e.PromptForPword()?this.CollectPassword():"___").length}ClearEmailError(){document.getElementById("cbeb-login-email-label").innerHTML="email address"}ClearPwError(){document.getElementById("cbeb-login-password-label").innerHTML="password"}OnOK(e,t,i){if(this.ProblemWithEmailField())return void this.ErrorForMissingEmail();if(this.ClearEmailError(),this.ProblemWithPasswordField(e))return void this.ErrorForMissingPassword();this.ClearPwError();const o=this.CollectEmail().toLowerCase(),s=e.PromptForPword()?this.CollectPassword():"___";this.HideButtons(),this.Spin(),this.TryToLogin({email:o.toLowerCase().trim(),password:s.trim(),directory:t,federated_auth:i},{onLogin:e=>{r.AuthCache.cacheAuthLocally(e),this.HideSpinner(),n.DialogBoxMgr.hideAll(),this._callbacks.onLogin(e)},onFailure:e=>{"unrecognised e-mail address"===e&&(e="Sorry, that email wasn't recognised."),this._spinnerElem.style.display="none",this._errorMsgElem.innerHTML="🤖 "+e,this._errorContainerElem.style.display="flex"}})}}},1323:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PlaceholderMap=t.MapboxMap=t.GoogleMap=t.MapBase=void 0;const n=i(3032),o=i(777),r=i(7422),s=i(842),a=i(9496);function l(e){if(null!==e){const t=Math.floor(e.getBoundingClientRect().bottom);window.scrollBy({top:t,left:0,behavior:"smooth"})}}function c(e,t){const i={};for(const r of e){const e=r.getGeoDataForTemplate(t);for(const t of e)if(void 0!==t.lat&&void 0!==t.lng){const e=(n=t.lng,o=t.lat,`${Math.round(1e4*n)/1e4}-${Math.round(1e4*o)/1e4}`);e in i?i[e].profiles.push(r):i[e]={position:{lng:t.lng,lat:t.lat},profiles:[r]}}}var n,o;return i}class u{}t.MapBase=u,t.GoogleMap=class extends u{_invariants;_activeMapMarkerList;_map;UploadTelemetry(){(0,r.PostRequest)({url:"/telemetry",stage:"cfapi",payload:{box:this._invariants.directory,origin:window.location.href,event:"google_maps_alloc"}})}UpdateMarkers(e){this._activeMapMarkerList=[];const t=c(e,this._invariants.template),i=new google.maps.LatLngBounds;Object.keys(t).forEach((e=>{const n=t[e],r=new google.maps.Marker({position:n.position,map:this._map});this._activeMapMarkerList.push(r),i.extend(n.position),r.addListener("click",(()=>{1===n.profiles.length?(0,o.handle_profile_click)(n.profiles[0],this._invariants):(o.ebFilterManager.onlyShowTheseEntries(n.profiles),(0,o.ebPresentBoxContentUI)(this._invariants))}))})),this._map.fitBounds(i)}ReloadWith(e){if("undefined"==typeof google)return;n.remove_all_child_elements_from(this._invariants.mapContainer);const t=n.div("cbeb-map",[],{key:"cbeb-map"});this._invariants.mapContainer.appendChild(t),this._invariants.config.grayscaleMap&&(t.style.filter="grayscale(100%)"),this.UploadTelemetry(),this._map=new google.maps.Map(t,{zoom:16,mapTypeId:"roadmap"}),this.UpdateMarkers(e)}constructor(e){super(),this._invariants=e,this._activeMapMarkerList=[]}},t.MapboxMap=class extends u{_invariants;_mapboxKey;_markerList;_map;_mapHasLoaded;add_markers_to_map(e){e.forEach((e=>{if(void 0===this._map)return;let t,i;if(this._invariants.config.has_custom_pin_design){const o=e.profiles[0].get_all_tags(this._invariants.template);let r=this._invariants.config.pin_design_for(o);if(void 0===r){const n=this._invariants.config.pin_design_for(["_default_"]);n&&("colour"===n.type?i=new s.Marker({color:`#${n.value}`}).setLngLat([e.position.lng,e.position.lat]).addTo(this._map):(t=document.createElement("div"),t.setAttribute("style",`\nbackground-image: url('${n.value}');\nbackground-size: cover;\nwidth: 33px;\nheight: 40px;\ncursor: pointer;`),i=new s.Marker(t).setLngLat([e.position.lng,e.position.lat]).addTo(this._map)))}void 0!==r&&("image"===r.type&&(t=n.div("",[]),t.setAttribute("style",`\nbackground-image: url('${r.value}');\nbackground-size: cover;\nwidth: 33px;\nheight: 40px;\ncursor: pointer;\n\t\t\t\t\t\t`),i=new s.Marker(t).setLngLat([e.position.lng,e.position.lat]).addTo(this._map)),"colour"===r.type&&(i=new s.Marker({color:"#"+r.value}).setLngLat([e.position.lng,e.position.lat]).addTo(this._map)))}void 0===i&&(i=new s.Marker(t).setLngLat([e.position.lng,e.position.lat]).addTo(this._map)),this._markerList.push(i),i.getElement().addEventListener("click",(()=>{1===e.profiles.length?this.single_profile_pin_click(e):this.multi_profile_pin_click(e)}))}))}multi_profile_pin_click(e){o.ebFilterManager.onlyShowTheseEntries(e.profiles.map((e=>e.key))),o.box_cache.reflectFilterSettings((e=>o.ebFilterManager.Filter(e,this._invariants.template)),this._invariants.config,this._invariants.template),n.remove_all_child_elements_from(this._invariants.contentContainer),o.box_cache.resetPagination(),(0,o.cbebOnShowMore)(this._invariants.contentContainer,this._invariants.config.initialEntryCount,this._invariants.template),l(document.getElementById("cbeb-map")),this._map&&this._map.flyTo({center:e.position,zoom:9,bearing:0,speed:.5,curve:1})}single_profile_pin_click(e){if(!0===this._invariants.config.single_map_pin_should_popup){const t=e.profiles[0];void 0!==t&&(0,o.handle_profile_click)(t,this._invariants)}else this._map&&this._map.flyTo({center:e.position,zoom:9,bearing:0,speed:.5,curve:1}),o.ebFilterManager.onlyShowTheseEntries(e.profiles.map((e=>e.key))),o.box_cache.reflectFilterSettings((e=>o.ebFilterManager.Filter(e,this._invariants.template)),this._invariants.config,this._invariants.template),n.remove_all_child_elements_from(this._invariants.contentContainer),o.box_cache.resetPagination(),(0,o.cbebOnShowMore)(this._invariants.contentContainer,this._invariants.config.initialEntryCount,this._invariants.template),l(document.getElementById("cbeb-map"))}ChunkLoadMarkers(e,t,i){const n=e.splice(0,250);this.add_markers_to_map(n),e.length>0&&window.setTimeout((()=>{this.ChunkLoadMarkers(e,t,i)}),100)}ReloadWith(e){n.remove_all_child_elements_from(this._invariants.mapContainer);const t=n.div("cbeb-map",[],{key:"cbeb-map"});this._invariants.mapContainer.appendChild(t),a.Telemetry.Lambda({request:"mapbox map load",directory:this._invariants.directory}),window.setTimeout((()=>{this._map=new s.Map({accessToken:this._mapboxKey,container:t,style:this._invariants.config.grayscaleMap?"mapbox://styles/mapbox/light-v10":"mapbox://styles/mapbox/outdoors-v11",cooperativeGestures:"cooperative gesture"===this._invariants.config.mapDesign().interaction}),this._map.addControl(new s.NavigationControl),this._map.addControl(new s.FullscreenControl),this.UpdateMarkers(e)}))}UpdateMarkers(e){if(void 0===this._map)return;for(const e of this._markerList)e.remove();this._markerList=[];const t=c(e,this._invariants.template),i=Object.keys(t).map((e=>({position:t[e].position,profiles:t[e].profiles})));let n=new s.LngLatBounds;i.length>0&&i.forEach((e=>{n.extend([e.position.lng,e.position.lat])}));try{this._map.fitBounds(0===i.length?[-10,10,-10,10]:n,{padding:{left:50,top:50,bottom:50,right:50},maxZoom:10})}catch(e){console.log("Tried to fit bounds but failed")}this._mapHasLoaded?this.ChunkLoadMarkers(i,this._invariants.contentContainer,this._invariants):this.DoPostMapLoadStuff(i),this._map.on("load",(()=>{this._mapHasLoaded=!0,window.setTimeout((()=>{this._map&&this._map.resize(),window.setTimeout((()=>{this.ChunkLoadMarkers(i,this._invariants.contentContainer,this._invariants)}))}))}))}DoPostMapLoadStuff(e){void 0!==this._map&&this._map.on("load",(()=>{this._mapHasLoaded=!0,window.setTimeout((()=>{this._map&&this._map.resize(),window.setTimeout((()=>{this.ChunkLoadMarkers(e,this._invariants.contentContainer,this._invariants)}))}))}))}constructor(e,t){super(),this._invariants=e,this._mapboxKey=t,this._markerList=[],this._mapHasLoaded=!1}},t.PlaceholderMap=class extends u{ReloadWith(){}UpdateMarkers(){}constructor(){super()}}},234:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MemberSpaceAutoLoginDlg=void 0;const n=i(5603),o=i(8114),r=i(9496),s=i(8448),a=i(7746);t.MemberSpaceAutoLoginDlg=class{_dlgElem=document.querySelector("[m-auto-login-dlg]");_closeBtnRowElem=this._dlgElem.querySelector("[btn-row]");_msgElem=this._dlgElem.querySelector("p[msg]");constructor(e){n.DialogBoxMgr.registerDialogBox(this._dlgElem),o.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e})}printErrorMsg(e){this._msgElem.textContent=(0,a.Trim)(e,'"')}async show(e){this._closeBtnRowElem.style.visibility="none",this.printErrorMsg("Logging in..."),n.DialogBoxMgr.show(this._dlgElem);const t=await async function(e,t,i){try{const n=await r.Member.Lambda({request:"federated-login",identifier:e,directory:t,federated_auth:i});return{type:"success",member:n.member,token:n.token}}catch(e){return{type:"failure",failureMsg:"string"==typeof e?e:"Unknown login problem"}}}(e.identifier,e.directory,e.federated_auth);if("success"===t.type)return n.DialogBoxMgr.hideAll(),s.AuthCache.cacheAuthLocally({member:t.member,token:t.token}),void e.onLogin(t.member);this.printErrorMsg(t.failureMsg),this._closeBtnRowElem.style.visibility="visible"}}},6196:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Measure=void 0,t.Measure=class{_value;_unit;composite(){return`${this._value}${this._unit}`}constructor(e,t){this._value=e,this._unit=t}}},4580:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MsgDialogBox=void 0;const n=i(3032);t.MsgDialogBox=class{_container;_config;constructor(e,t){this._container=e,this._config=t}close_dialog(e,t){window.setTimeout((function(){document.body.removeChild(e),document.body.classList.remove("cbeb-noscroll"),t()}))}Show(e){const t=n.div("dialogbox block",[],{design:`font-family: ${this._config.fontFamily};`}),i=`font-family: ${this._config.fontFamily||"inherit"}; font-size: 17px; color: #${this._config.fgColourOf("paragraph")};`,o=n.div("flex col",[],{design:"box-sizing: border-box; padding: 31px;"}),r=n.div("flex row justify-center",[n.button("basic mr17",e.btn_label,(()=>{this.close_dialog(t,e.onClose)}),{design:`color: #${this._config.fgColourOf("button")}; background-color: #${this._config.bgColourOf("button")}`})]);o.appendChild(n.div("flex col",[n.p("mt0 mb0 cntr-text",e.msg,{design:`${i}; box-sizing: border-box; padding: 31px; background-color: white;`}),n.div("h17",[]),r,n.div("h37",[])]));const s=n.div("flex col",[n.p("mt0 mb0",e.title,{design:`${i}; color: #${this._config.fgColourOf("dialog_title")}; box-sizing: border-box; padding: 31px; background-color: #${this._config.bgColourOf("dialog_title")}`}),o],{design:"width: 500px; margin-left: auto; margin-right: auto; background-color: white;"});t.appendChild(s),t.addEventListener("click",(i=>{i.target!==t&&i.target!==s||window.setTimeout((()=>{this.close_dialog(t,e.onClose)}))})),document.body.appendChild(t),document.body.classList.add("cbeb-noscroll")}}},3198:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MultiLineEditCtrl=void 0;const n=i(1045);class o extends n.field_edit_ctrl{_entry;_field;_inputElem;data(){return void 0!==this._inputElem&&this._inputElem.value||""}has_data(){return this._entry.hasValueForField(this._field.key)}viewHtmlElem(){const e=this._entry.getValueOf(this._field.key),t=[this.leftOfViewRow(),`
`,this._field.detail_label?`
${this._field.detail_label}
`:"",'
',e.split("\n").map((e=>["

",e,"

"].join(""))).join(""),"
","
",this.rightOfViewRow()].join(""),i=document.createElement("div");return i.innerHTML=t,i}inputHtmlElem(){const e="everyone"!==this._field.editable_by,t=this.leftOfInputRow()+'
'+this._field.label+(!0===this._field.required?" (required)":"")+(!0===e?" (locked)":"")+'
'+this.rightOfInputRow(),i=document.createElement("div");i.innerHTML=t;const n=i.querySelector(".cbeb-entry-inputfield-container");if(n){const t=document.createElement("textarea");t.readOnly=!0===e,t.rows=4,t.placeholder=this._field.placeholder??"",t.setAttribute("fieldKey",this._field.key),t.classList.add("cbeb-entry-input"),t.classList.add("cbeb-entry-multiline"),t.maxLength=this._field.maxCharInputLength||5e3,t.textContent=this._entry.getValueOf(this._field.key)?.toString()||"",n.appendChild(t)}return this.install_input_handler_for(i,"textarea"),this._inputElem=i.querySelector("textarea"),i}constructor(e,t){super(e,t),this._entry=e,this._field=t}}t.MultiLineEditCtrl=o},7422:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PostRequest=function(e){const t=-1!==window.location.href.indexOf("localhost");!0===t&&console.log(JSON.stringify(e.payload));const i=new XMLHttpRequest,n=function(e,t){return"https://"!==e.slice(0,8)?`${function(e){return"cfapi"===e?"https://cfapi.communitybox.co":"https://api.communitybox.co"}(t)}${e}`:e}(e.url,e.stage);if(!0===t&&console.log(`-> ${n}`),i){if(i.open("post",n,!0),i.setRequestHeader("Content-type","application/json; charset=utf-8"),null!=e.credentials){const n=`{"account":"${e.credentials.account}","token":"${e.credentials.token}"}`;i.setRequestHeader("credentials",n),!0===t&&console.log("setting credentials to",n)}i.onload=function(){if(4===i.readyState&&200===i.status){var n=JSON.parse(i.responseText);!0===t&&console.log(i.responseText),n.hasOwnProperty("err")?e.callback?.onFailure(n.err):e.callback?.onResult(n)}else e.callback?.onFailure(i.responseText)}}i.send(JSON.stringify(e.payload))}},7238:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewBuilder=void 0,t.OverviewBuilder=class{}},5237:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PhoneNbEditCtrl=void 0;const n=i(1045);class o extends n.field_edit_ctrl{_entry;_field;_config;_inputElem;data(){return void 0!==this._inputElem&&this._inputElem.value||""}has_data(){return this._entry.hasValueForField(this._field.key)}extractNumbersFrom(e){return e.replace(/\D/g,"").split("")}usaFormat(e){const t=this.extractNumbersFrom(e).reverse(),i=[];let n="",o=0;for(;o<=t.length;)0===i.length&&n.length<4||i.length>0&&n.length<3?n+=t[o++]:(i.push(n.split("").reverse().join("")),n="");return i.reverse().join("-")}formattedPhoneNb(e){switch(this._config.phoneNbFormat){case"freeform":return e;case"nnn-nnn-nnnn":return this.usaFormat(e)}}viewHtmlElem(){const e=this._entry.getValueOf(this._field.key),t=[this.leftOfViewRow(),'
',this._field.detail_label?`
${this._field.detail_label}
`:"",'
',this.getDetailGlyph(this._field.ctrl_type),`\n ${this.formattedPhoneNb(e)}\n `,"
","
",this.rightOfViewRow()].join(""),i=document.createElement("div");return i.innerHTML=t,i}inputHtmlElem(){const e="everyone"!==this._field.editable_by,t=this._entry.getValueOf(this._field.key),i=this.leftOfInputRow()+'
'+this._field.label+(!0===this._field.required?" (required)":"")+(!0===e?'  ':"")+'
'+`
"+this.rightOfInputRow(),n=document.createElement("div");return n.innerHTML=i,this.install_input_handler_for(n,"input"),this._inputElem=n.querySelector("input"),n}constructor(e,t,i){super(e,t),this._entry=e,this._field=t,this._config=i}}t.PhoneNbEditCtrl=o},9496:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Member=t.Directory=t.Telemetry=t.Matchmaking=void 0;const n=i(7422);var o,r,s,a;!function(e){e.Lambda=function(e){return function(e){return new Promise(((t,i)=>{(0,n.PostRequest)({url:"/matchmaking/initiate/connection",stage:void 0,payload:e,credentials:void 0,callback:{onResult:e=>{e.hasOwnProperty("err")?i(e.err):t(e)},onFailure:e=>{i(e)}}})}))}(e)}}(o||(t.Matchmaking=o={})),function(e){e.Lambda=function(e){return new Promise(((t,i)=>{(0,n.PostRequest)({url:"/telemetry",stage:"cfapi",payload:e,credentials:{account:"",token:""},callback:{onResult:e=>{e.hasOwnProperty("err")?i(e.err):t(e)},onFailure:e=>{i(e)}}})}))}}(r||(t.Telemetry=r={})),function(e){e.Lambda=function(e){return new Promise(((t,i)=>{(0,n.PostRequest)({url:"/directory",stage:"cfapi",payload:e,credentials:{account:"",token:""},callback:{onResult:e=>{e.hasOwnProperty("err")?i(e.err):t(e)},onFailure:e=>{i(e)}}})}))}}(s||(t.Directory=s={})),function(e){e.Lambda=function(e){return new Promise(((t,i)=>{(0,n.PostRequest)({url:"/members",stage:"cfapi",payload:e,callback:{onResult:e=>{e.hasOwnProperty("err")?i(e.err):t(e)},onFailure:e=>{i(e)}}})}))}}(a||(t.Member=a={}))},7797:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PrivacyPolicyDlgBox=void 0;const n=i(5603),o=i(8114);t.PrivacyPolicyDlgBox=class{_dlgElem=document.getElementById("cbeb-pp-modal");constructor(e){n.DialogBoxMgr.registerDialogBox(this._dlgElem),o.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e})}show(){n.DialogBoxMgr.show(this._dlgElem)}}},8176:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProductPictureEditCtrl=void 0;const n=i(1045);class o extends n.field_edit_ctrl{_entry;_field;_domParent;data(){const e=this._domParent;var t=[e.querySelector('[for="cbeb-img-uploader-'+this._field.key+'-0"]').getAttribute("imageKey"),e.querySelector('[for="cbeb-img-uploader-'+this._field.key+'-1"]').getAttribute("imageKey"),e.querySelector('[for="cbeb-img-uploader-'+this._field.key+'-2"]').getAttribute("imageKey")],i=[e.querySelector('input[galleryidx="0"]').value,e.querySelector('input[galleryidx="1"]').value,e.querySelector('input[galleryidx="2"]').value];return JSON.stringify({img:t,url:i})}has_data(){return this._entry.hasValueForField(this._field.key)}viewHtmlElem(){var e="",t=JSON.parse(this._entry.getValueOf(this._field.key));if(t.img&&t.url){var i=0;e+="
",t.img.forEach((function(n){n&&(e+=["
","
"].join("")),i++})),e+="
"}const n=document.createElement("div");return n.innerHTML=e,n}inputHtmlElem(){const e="everyone"!==this._field.editable_by,t=["","",""],i=[void 0,void 0,void 0],n=this._entry.getValueOf(this._field.key);if(n)for(var o=0;o<3;o++)n.img[o]&&(t[o]="style='background-image: url(\"https://dashboard.communitybox.co/img/uploaded/"+n.img[o]+".jpeg\")'",i[o]=n.img[o]);const r=[this.leftOfInputRow(),"
",'
'+this._field.label+(!0===this._field.required?" (required)":"")+(!0===e?'  ':"")+'
',"
",'
",'",'',"
",'
",'",'',"
",'
",'",'',"
","
","
","
",'
Link for picture #1
','
','',"
","
","
",'
Link for picture #2
','
','',"
","
","
",'
Link for picture #3
','
','',"
","
","
",this.rightOfInputRow()].join(""),s=document.createElement("div");return s.innerHTML=r,s}constructor(e,t){super(e,t),this._entry=e,this._field=t}}t.ProductPictureEditCtrl=o},2750:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.profile_dialog_box=void 0;const n=i(4695);t.profile_dialog_box=class{isMissingContent(e,t){return"image-input"===t.ctrlType?void 0===(0,n.PictureDataFrom)(e).key:null==e||"string"==typeof e&&0===e.length||e instanceof Array&&0===e.length}search_for_missing_fields(e,t){var i=[];return t.forEachField((t=>{!0===t.required&&this.isMissingContent(e[t.key],t)&&i.push(t)})),i.map((e=>e.key))}handle_missing_fields(e,t,i){const n=this.search_for_missing_fields(e,t);if(n.length>0){const e=i.querySelector(`[fieldkey="${n[0]}"]`);if(e){const t=e.getBoundingClientRect(),n=i.getBoundingClientRect().height/2,o=t.top-n;i.scrollBy({top:o,behavior:"smooth"}),e.setAttribute("missing_required_field","")}return"some_fields_are_missing"}return"all_filled_in"}}},4695:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProfilePictureEditCtrl=void 0,t.PictureDataFrom=c;const n=i(3615),o=i(1045),r=i(5397),s=i(1613),a=i(3032);var l;function c(e){if(null==e)return{key:void 0,metadata:void 0,rotation:0,offset:{x:"center",y:"center"}};if("object"==typeof e&&"blurhash"in e){const t={key:void 0,metadata:void 0,rotation:0,offset:{x:"center",y:"center"}};return t.metadata=e,t}switch(typeof e){case"string":return{key:0===e.length?void 0:e,metadata:void 0,rotation:0,offset:{x:"center",y:"center"}};case"object":if("metadata"in e)return e;if("rotation"in e)return"key"in e&&null!=e.key&&"string"==typeof e.key&&0===e.key.length?{key:void 0,metadata:void 0,rotation:0,offset:{x:"center",y:"center"}}:e;default:return{key:void 0,metadata:void 0,rotation:0,offset:{x:"center",y:"center"}}}}!function(e){e[e.for_viewing=0]="for_viewing",e[e.for_editing=1]="for_editing"}(l||(l={}));class u extends o.field_edit_ctrl{_entry;_field;_config;_template;_directory;_inputElem;_image_holder;_picture_data;_upload_progress_container;_upload_progress_meter;_upload_progress_label;_resizeObserver;getPicUrlFromRule(){const e=c(this._config.defaultProfilePictureKey);return(0,r.PictureLinkFrom)(this._picture_data,e,this._image_holder?this._image_holder.clientWidth:250)}updateImage(e){const t="https://dashboard.communitybox.co/img/uploaded/"+this._config.defaultProfilePictureKey+".jpeg";if(e===l.for_editing)void 0!==this._image_holder&&(void 0!==this._picture_data.key?(this._image_holder.style.backgroundImage=`url(${(0,r.PictureLinkFrom)(this._picture_data,c(t))})`,this._image_holder.style.borderRadius="circle"===this._config.profilePictureAspect?"50%":"0%",this._image_holder.style.transform=`rotate(${this._picture_data.rotation}deg)`,"fit"===this._config.profilePictureAspect&&(this._image_holder.style.backgroundSize="contain",this._image_holder.style.backgroundColor="transparent")):this._image_holder.style.backgroundImage=`url("https://dashboard.communitybox.co/img/uploaded/${this._config.upload_image}.jpeg")`);else if(void 0!==this._image_holder){const e=this.getPicUrlFromRule();this._image_holder.style.backgroundImage=`url(${e})`,this._image_holder.style.borderRadius="circle"===this._config.profilePictureAspect?"50%":"0%","fit"===this._config.profilePictureAspect&&(this._image_holder.style.backgroundSize="contain",this._image_holder.style.backgroundColor="transparent"),this._image_holder.style.transform=`rotate(${this._picture_data.rotation}deg)`,this._image_holder.style.backgroundPositionX=this._picture_data.offset.x.toString(),this._image_holder.style.backgroundPositionY=this._picture_data.offset.y.toString()}}photoLabelInitValue(e,t){return t&&t.hasOwnProperty(e)?'imageKey="'+t[e]+'"':""}data(){return this._picture_data}has_data(){return!0}viewHtmlElem(){return this._image_holder=a.div("imageholder",[a.div("",[],{design:"display: none;"})],{classes:["cb-image-upload-readonly"]}),this._resizeObserver=new ResizeObserver((e=>{this.updateImage(l.for_viewing)})),this._resizeObserver.observe(this._image_holder),this.updateImage(l.for_viewing),a.div("",[this._image_holder],{classes:["cbeb-entry-image-input-container"]})}show_progress(e,t){this._upload_progress_meter&&this._upload_progress_label&&(this._upload_progress_meter.value=100*e,this._upload_progress_label.textContent=t)}registerFileUploadCallback(e,t){if(null==e)return;let i=this;e.addEventListener("change",(e=>{this._upload_progress_container&&this._image_holder&&(this._upload_progress_container.style.display="flex",this._image_holder.style.display="none"),(0,n.upload_image)(e.target.files[0],t,((e,t)=>this.show_progress(e,t))).then((e=>{i._picture_data=c(e),i.updateImage(l.for_editing),this._upload_progress_container&&this._image_holder&&(this._upload_progress_container.style.display="none",this._image_holder.style.display="flex")})).catch((e=>{console.error(e)}))}))}inputHtmlElem(){const e="everyone"!==this._field.editable_by,t=`\n
${this._field.label}${!0===this._field.required?" (required)":""}${!0===e?'  ':""}
\n
\n
\n \n \n
\n
\n \n
\n
`,i=this.leftOfInputRow()+t+this.rightOfInputRow(),n=document.createElement("div");n.innerHTML=i,this._image_holder=n.querySelector("[imageholder]"),this._upload_progress_container=n.querySelector("[upload-progress]"),this._upload_progress_meter=n.querySelector("progress"),this._upload_progress_label=this._upload_progress_container.querySelector("label"),!1===e&&(this._inputElem=document.createElement("input"),this._inputElem.setAttribute("type","file"),this._inputElem.style.display="none",this._image_holder.addEventListener("click",(e=>{this._inputElem?.click()})),this.registerFileUploadCallback(this._inputElem,this._directory),this.install_input_handler_for(n,"input")),this.updateImage(l.for_editing);const o=a.button("svg","",(()=>{this.rotate((0,s.Degrees)(-90)),this.updateImage(l.for_editing)}),{svg:"rotateLeft"}),r=a.button("svg","",(()=>{this.rotate((0,s.Degrees)(90)),this.updateImage(l.for_editing)}),{svg:"rotateRight"}),c=a.div("flex row justify-center",[o,r],{design:"column-gap: 7px"});return a.div("flex col",[n,c])}rotate(e){this._picture_data.rotation=(0,s.Degrees)((this._picture_data.rotation+e)%360)}constructor(e,t,i,n,o){super(e,t),this._entry=e,this._field=t,this._config=i,this._template=n,this._directory=o,this._picture_data=c(e.getValueOf(t.key))}}t.ProfilePictureEditCtrl=u},8741:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Init=function(e,t){r=n.DialogBoxMgr.buildAndRegisterDialogElement({title:"Uploading file...",key:"file-upload-prog",default_close:!0,body:`\n
\n
\n
\n
\n
`}),o.Styling.applyAllStylesTo({rootElem:r,withConfig:e}),s=r.querySelector("[bar]"),t.appendChild(r)},t.UpdateMeter=a,t.Show=function(){a(0),n.DialogBoxMgr.show(r)},t.Hide=function(){n.DialogBoxMgr.hideAll()};const n=i(5603),o=i(8114);let r,s;function a(e){void 0!==s&&(s.style.width=100*e+"%")}},9270:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extract_query_param_from=function(e){-1!==window.location.href.indexOf("wishlist")&&console.log(`Extracting query parameter from [${e}]`);const t=e.split("+").join(" "),i={};let n=null;const o=/[?&]?([^=]+)=([^&]*)/g;for(;n=o.exec(t);)i[decodeURIComponent(n[1])]=decodeURIComponent(n[2]);return i.hasOwnProperty("a")&&i.hasOwnProperty("b")?{authID:i.a,validationToken:i.b}:i.hasOwnProperty("c")&&i.hasOwnProperty("d")?{authID:i.c,pwResetValidationToken:i.d}:i.hasOwnProperty("mk")&&i.hasOwnProperty("invite")?{memberKey:i.mk,invitationToken:i.invite}:i.hasOwnProperty("mk")&&i.hasOwnProperty("cr")?{memberKey:i.mk,connectionToken:i.cr}:i.hasOwnProperty("overlay")?{entryKey:i.overlay}:i}},4585:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResetPwDialogBox=void 0;const n=i(5603),o=i(8114),r=i(9270),s=i(9496);t.ResetPwDialogBox=class{_config;_dlgElem=document.getElementById("cbeb-rpw-modal");_buttonRowElem=document.getElementById("cbeb-rpw-button-row");_errorElem=document.getElementById("cbeb-rpw-dlg-error-container");_resetBtnElem=document.getElementById("cbeb-extra-rpw-reset-btn");_msgElem=document.getElementById("cbeb-rpw-msg");_inputContainerElem=document.getElementById("cbeb-rpw-input-container");_inputField1Elem=document.getElementById("cbeb-rpw-pw1");_spinnerElem=document.getElementById("cbeb-rpw-spinner");constructor(e){this._config=e,n.DialogBoxMgr.registerDialogBox(this._dlgElem),this._resetBtnElem.addEventListener("click",(async()=>{this._msgElem.innerHTML="Please wait...",this._inputContainerElem.style.display="none",this._spinnerElem.style.display="block",this._buttonRowElem.style.display="none";const t=(0,r.extract_query_param_from)(this.getQueryPartOfUrl());try{await s.Member.Lambda({request:"reset password",member:t.authID,newPassword:this._inputField1Elem.value.trim(),validationToken:t.pwResetValidationToken}),this._msgElem.innerHTML=e.get_wording("rp-successful-reset"),this._spinnerElem.style.display="none"}catch(e){this._msgElem.innerHTML=`${e}`,this._spinnerElem.style.display="none"}}))}show(e){this._errorElem.style.display="none",this._spinnerElem.style.display="none",o.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e}),n.DialogBoxMgr.show(this._dlgElem)}getQueryPartOfUrl(){var e=window.location.href.split("?");return e.length>1?"?"+e[1]:""}}},3274:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ShareEntryDialogBox=void 0;const n=i(5603),o=i(8114);t.ShareEntryDialogBox=class{_dlgElem=document.querySelector("[cbeb-share-entry-dlg]");_fbElem=this._dlgElem.querySelector("[facebook]");_twElem=this._dlgElem.querySelector("[twitter]");_liElem=this._dlgElem.querySelector("[linkedin]");constructor(e){n.DialogBoxMgr.registerDialogBox(this._dlgElem),o.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e})}ShowFor(e,t,i){this.InitFacebookParamsFor(e,t,i),this.InitTwitterParamsFor(e,t,i),this.InitLinkedInParamsFor(e,t),n.DialogBoxMgr.show(this._dlgElem)}InitLinkedInParamsFor(e,t){var i=['