1/*! For license information please see 9587.4063216a.chunk.js.LICENSE.txt */ 2(self.webpackChunksmartfire=self.webpackChunksmartfire||[]).push([[9587],{36366(e,t,i){"use strict";var r=i(88313),n=i(60049),o="value",s="\n ",a={};function l(e){var t=Array.isArray(e),i=function(i){return t?e[i]:e};return function(r){var n=c(a.plainArray,r);if(n)return n;if(t&&r.length!==e.length)return"an array with "+e.length+" items";for(var o=0;o<r.length;o++)if(n=c(i(o),r[o]))return[o].concat(n)}}function c(e,t){if(null!=t||e.hasOwnProperty("__required")){var i=e(t);return i?Array.isArray(i)?i:[i]:void 0}}function h(e,t){var i=e.length,r=e[i-1],s=e.slice(0,i-1);return 0===s.length&&(s=[o]),t=n(t,{path:s}),"function"===typeof r?r(t):u(t,function(e){return"must be "+function(e){if(/^an? /.test(e))return e;if(/^[aeiou]/i.test(e))return"an "+e;if(/^[a-z]/i.test(e))return"a "+e;return e}(e)+"."}(r))}function u(e,t){return(d(e.path)?"Item at position ":"")+(e.path.join(".")+" "+t)}function d(e){return"number"==typeof e[e.length-1]||"number"==typeof e[0]}a.assert=function(e,t){return t=t||{},function(i){var r=c(e,i);if(r){var n=h(r,t);throw t.apiName&&(n=t.apiName+": "+n),new Error(n)}}},a.shape=function(e){var t,i=(t=e,Object.keys(t||{}).map(function(e){return{key:e,value:t[e]}}));return function(e){var t,r=c(a.plainObject,e);if(r)return r;for(var n=[],l=0;l<i.length;l++)t=i[l].key,(r=c(i[l].value,e[t]))&&n.push([t].concat(r));return n.length<2?n[0]:function(e){n=n.map(function(t){return"- "+t[0]+": "+h(t,e).split("\n").join(s)});var t=e.path.join(".");return"The following properties"+(t===o?"":" of "+t)+" have invalid values:"+s+n.join(s)}}},a.strictShape=function(e){var t=a.shape(e);return function(i){var r=t(i);if(r)return r;var n=Object.keys(i).reduce(function(t,i){return void 0===e[i]&&t.push(i),t},[]);return 0!==n.length?function(){return"The following keys are invalid: "+n.join(", ")}:void 0}},a.arrayOf=function(e){return l(e)},a.tuple=function(){return l(Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments))},a.required=function(e){function t(t){return null==t?function(e){return u(e,d(e.path)?"cannot be undefined/null.":"is required.")}:e.apply(this,arguments)}return t.__required=!0,t},a.oneOfType=function(){var e=Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments);return function(t){var i=e.map(function(e){return c(e,t)}).filter(Boolean);if(i.length===e.length)return i.every(function(e){return 1===e.length&&"string"===typeof e[0]})?function(e){if(e.length<2)return e[0];if(2===e.length)return e.join(" or ");return e.slice(0,-1).join(", ")+", or "+e.slice(-1)}(i.map(function(e){return e[0]})):i.reduce(function(e,t){return t.length>e.length?t:e})}},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)||e<t||e>i)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(!r(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=h,e.exports=a},5609(e,t,i){"use strict";var r=i(19452).Ak;function n(e){this.origin=e.origin||"https://api.mapbox.com",this.endpoint="events/v2",this.access_token=e.accessToken,this.version="0.3.0",this.pluginSessionID=this.generateSessionID(),this.sessionIncrementer=0,this.userAgent=this.getUserAgent(),this.options=e,this.send=this.send.bind(this),this.countries=e.countries?e.countries.split(","):null,this.types=e.types?e.types.split(","):null,this.bbox=e.bbox?e.bbox:null,this.language=e.language?e.language.split(","):null,this.limit=e.limit?+e.limit:null,this.locale=navigator.language||null,this.enableEventLogging=this.shouldEnableLogging(e),this.eventQueue=new Array,this.flushInterval=e.flushInterval||1e3,this.maxQueueSize=e.maxQueueSize||100,this.timer=this.flushInterval?setTimeout(this.flush.bind(this),this.flushInterval):null,this.lastSentInput="",this.lastSentIndex=0}n.prototype={select:function(e,t){var i=this.getEventPayload("search.select",t,{selectedFeature:e});if(i&&(i.resultIndex!==this.lastSentIndex||i.queryString!==this.lastSentInput)&&-1!=i.resultIndex)return this.lastSentIndex=i.resultIndex,this.lastSentInput=i.queryString,this.push(i)},start:function(e){var t=this.getEventPayload("search.start",e);if(t)return this.push(t)},keyevent:function(e,t){if(e.key&&!e.metaKey&&-1===[9,27,37,39,13,38,40].indexOf(e.keyCode)){var i=this.getEventPayload("search.keystroke",t,{key:e.key});if(i)return this.push(i)}},send:function(e,t){if(!this.enableEventLogging)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){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("search.select"===e&&!i.selectedFeature||"search.keystroke"===e&&!i.key)return null;var r;if(t.options.proximity)if("object"===typeof t.options.proximity)r=[t.options.proximity.longitude,t.options.proximity.latitude];else if("ip"===t.options.proximity){var n=t._headers?t._headers["ip-proximity"]:null;r=n&&"string"===typeof n?n.split(",").map(parseFloat):[999,999]}else r=t.options.proximity;else r=null;var o=t._map?t._map.getZoom():void 0,s={event:e,version:this.getEventSchemaVersion(e),created:+new Date,sessionIdentifier:this.getSessionId(),country:this.countries,userAgent:this.userAgent,language:this.language,bbox:this.bbox,types:this.types,endpoint:"mapbox.places",autocomplete:t.options.autocomplete,fuzzyMatch:t.options.fuzzyMatch,proximity:r,limit:t.options.limit,routing:t.options.routing,worldview:t.options.worldview,mapZoom:o,keyboardLocale:this.locale};if("search.select"===e?s.queryString=t.inputString:"search.select"!=e&&t._inputEl?s.queryString=t._inputEl.value:s.queryString=t.inputString,["search.keystroke","search.select"].includes(e)&&(s.path="geocoding/v5/mapbox.places"),"search.keystroke"===e&&i.key)s.lastAction=i.key;else if("search.select"===e&&i.selectedFeature){var a=i.selectedFeature,l=this.getSelectedIndex(a,t);
2if(s.resultIndex=l,s.resultPlaceName=a.place_name,s.resultId=a.id,a.properties&&(s.resultMapboxId=a.properties.mapbox_id),t._typeahead){var c=t._typeahead.data;c&&c.length>0&&(s.suggestionIds=this.getSuggestionIds(c),s.suggestionNames=this.getSuggestionNames(c),s.suggestionTypes=this.getSuggestionTypes(c),s.suggestionSources=this.getSuggestionSources(c))}}return this.validatePayload(s)?s:null},request:function(e,t){var i=new XMLHttpRequest;for(var r 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 n=e.headers[r];i.setRequestHeader(r,n)}i.send(e.body)},handleError:function(e,t){if(t)return t(e)},generateSessionID:function(){return r()},getSessionId:function(){return this.pluginSessionID+"."+this.sessionIncrementer},getUserAgent:function(){return"mapbox-gl-geocoder."+this.version+"."+navigator.userAgent},getSelectedIndex:function(e,t){if(t._typeahead){var i=t._typeahead.data,r=e.id;return i.map(function(e){return e.id}).indexOf(r)}},getSuggestionIds:function(e){return e.map(function(e){return e.properties?e.properties.mapbox_id||"":e.id||""})},getSuggestionNames:function(e){return e.map(function(e){return e.place_name||""})},getSuggestionTypes:function(e){return e.map(function(e){return e.place_type&&Array.isArray(e.place_type)&&e.place_type[0]||""})},getSuggestionSources:function(e){return e.map(function(e){return e._source||""})},getEventSchemaVersion:function(e){return["search.keystroke","search.select"].includes(e)?"2.2":"2.0"},validatePayload:function(e){if(!e||!e.event)return!1;var t=e.event;return"search.start"===t?this.objectHasRequiredProps(e,["event","created","sessionIdentifier","queryString"]):"search.keystroke"===t?this.objectHasRequiredProps(e,["event","created","sessionIdentifier","queryString","lastAction"]):"search.select"!==t||this.objectHasRequiredProps(e,["event","created","sessionIdentifier","queryString","resultIndex","path","suggestionIds"])},objectHasRequiredProps:function(e,t){return t.every(function(t){return"queryString"===t?"string"===typeof e[t]&&e[t].length>0:void 0!==e[t]})},shouldEnableLogging:function(e){return!1!==e.enableEventLogging&&(!e.origin||"https://api.mapbox.com"===e.origin)},flush:function(){this.eventQueue.length>0&&(this.send(this.eventQueue),this.eventQueue=new Array),this.timer&&clearTimeout(this.timer),this.flushInterval&&(this.timer=setTimeout(this.flush.bind(this),this.flushInterval))},push:function(e,t){this.eventQueue.push(e),(this.eventQueue.length>=this.maxQueueSize||t)&&this.flush()},remove:function(){this.flush()}},e.exports=n},20438(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]]}}},60792(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},84066(e,t,i){"use strict";var r=i(7053),n=i(10446),o=i(60049),s=i(27284).EventEmitter,a=i(20438),l=i(47050),c=i(34012),h=i(5609),u=i(16397),d=i(13058),p=i(60792),f=i(7651);const m=0,_=1,g=2;function y(e){this._eventEmitter=new s,this.options=o({},this.options,e),this.inputString="",this.fresh=!0,this.lastSelected=null,this.geolocation=new p}y.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",useBrowserFocus:!1,getItemValue:function(e){return e.place_name},render:function(e){var t,i=(t=e.place_name,t?String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):"").split(",");return'<div class="mapboxgl-ctrl-geocoder--suggestion"><div class="mapboxgl-ctrl-geocoder--suggestion-title">'+i[0]+'</div><div class="mapboxgl-ctrl-geocoder--suggestion-address">'+i.splice(1,i.length).join(",")+"</div></div>"}},_headers:{},addTo:function(e){function t(e,t){if(!document.body.contains(t))throw new Error("Element provided to #addTo() exists, but is not in the DOM");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 h(this.options),this._onChange=this._onChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onPaste=this._onPaste.bind(this),this._onBlur=this._onBlur.bind(this),this._showButton=this._showButton.bind(this),this._hideButton=this._hideButton.bind(this),this._onQueryResult=this._onQueryResult.bind(this),this.clear=this.clear.bind(this),this._updateProximity=this._updateProximity.bind(this),this._collapse=this._collapse.bind(this),this._unCollapse=this._unCollapse.bind(this),this._clear=this._clear.bind(this),this._clearOnBlur=this._clearOnBlur.bind(this),this._geolocateUser=this._geolocateUser.bind(this),this._onSuggestionItemFocus=this._onSuggestionItemFocus.bind(this),this._onSuggestionItemKeyDown=this._onSuggestionItemKeydown.bind(this);var t=this.container=document.createElement("div");t.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl";var i=this.createIcon("search",'<path d="M7.4 2.5c-2.7 0-4.9 2.2-4.9 4.9s2.2 4.9 4.9 4.9c1 0 1.8-.2 2.5-.8l3.7 3.7c.2.2.4.3.8.3.7 0 1.1-.4 1.1-1.1 0-.3-.1-.5-.3-.8L11.4 10c.4-.8.8-1.6.8-2.5.1-2.8-2.1-5-4.8-5zm0 1.6c1.8 0 3.2 1.4 3.2 3.2s-1.4 3.2-3.2 3.2-3.3-1.3-3.3-3.1 1.4-3.3 3.3-3.3z"/>');this._inputEl=document.createElement("input"),this._inputEl.type="text",this._inputEl.className="mapboxgl-ctrl-geocoder--input",this.setPlaceholder(),this.options.collapsed&&(this._collapse(),this.container.addEventListener("mouseenter",this._unCollapse),this.container.addEventListener("mouseleave",this._collapse),this._inputEl.addEventListener("focus",this._unCollapse)),(this.options.collapsed||this.options.clearOnBlur)&&this._inputEl.addEventListener("blur",this._onBlur),this._inputEl.addEventListener("keydown",n(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 o=document.createElement("div");o.classList.add("mapboxgl-ctrl-geocoder--pin-right"),this._clearEl=document.createElement("button"),this._clearEl.setAttribute("aria-label","Clear"),this._clearEl.addEventListener("click",this.clear),this._clearEl.className="mapboxgl-ctrl-geocoder--button";var s=this.createIcon("close",'<path d="M3.8 2.5c-.6 0-1.3.7-1.3 1.3 0 .3.2.7.5.8L7.2 9 3 13.2c-.3.3-.5.7-.5 1 0 .6.7 1.3 1.3 1.3.3 0 .7-.2 1-.5L9 10.8l4.2 4.2c.2.3.7.3 1 .3.6 0 1.3-.7 1.3-1.3 0-.3-.2-.7-.3-1l-4.4-4L15 4.6c.3-.2.5-.5.5-.8 0-.7-.7-1.3-1.3-1.3-.3 0-.7.2-1 .3L9 7.1 4.8 2.8c-.3-.1-.7-.3-1-.3z"/>');if(this._clearEl.appendChild(s),this._loadingEl=this.createIcon("loading",'<path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z"/><path opacity=".1" d="M12.8 12.9c-2.1 2.1-5.5 2.1-7.6 0-2.1-2.1-2.1-5.5 0-7.7l-.8-.8c-2.5 2.5-2.5 6.7 0 9.2s6.6 2.5 9.2 0 2.5-6.
26 0-9.2l-.8.8c2.2 2.1 2.2 5.6 0 7.7z"/>'),o.appendChild(this._clearEl),o.appendChild(this._loadingEl),t.appendChild(i),t.appendChild(this._inputEl),this.options.enableGeolocation&&this.geolocation.isSupport()){this._geolocateEl=document.createElement("button"),this._geolocateEl.setAttribute("aria-label","Geolocate"),this._geolocateEl.addEventListener("click",this._geolocateUser),this._geolocateEl.className="mapboxgl-ctrl-geocoder--button";var a=this.createIcon("geolocate",'<path d="M12.999 3.677L2.042 8.269c-.962.403-.747 1.823.29 1.912l5.032.431.431 5.033c.089 1.037 1.509 1.252 1.912.29l4.592-10.957c.345-.822-.477-1.644-1.299-1.299z" fill="#4264fb"/>');this._geolocateEl.appendChild(a),o.appendChild(this._geolocateEl),this._showGeolocateButton()}var u=this._typeahead=new r(this._inputEl,[],{hideOnBlur:!this.options.useBrowserFocus,filter:!1,minLength:this.options.minLength,limit:this.options.limit});t.insertBefore(o,u.list.wrapper),this.setRenderFunction(this.options.render),u.getItemValue=this.options.getItemValue;const d=this._typeahead.handleKeyDown.bind(this._typeahead),p=this._typeahead.handleKeyUp.bind(this._typeahead);this._typeahead.handleKeyUp,this.options.useBrowserFocus&&(this._typeahead.handleKeyDown=function(e){if(9!==e.keyCode||u.list.isEmpty())return 40===e.keyCode?(this._typeahead.list.active=0,this._typeahead.list.element.querySelectorAll("li").forEach(function(e){e.classList.remove("active")}),this._typeahead.list.element.querySelectorAll("li")[0].classList.add("active"),void this._typeahead.list.element.querySelectorAll("li")[0].focus()):38===e.keyCode?(this._typeahead.list.active=u.list.items.length-1,this._typeahead.list.element.querySelectorAll("li").forEach(function(e){e.classList.remove("active")}),this._typeahead.list.element.querySelectorAll("li")[this._typeahead.list.active].classList.add("active"),void this._typeahead.list.element.querySelectorAll("li")[this._typeahead.list.active].focus()):void d(e)}.bind(this),this._typeahead.handleKeyUp=function(e){e&&16===e.keyCode?e.preventDefault():p(e)});var f=u.list.draw,m=this._footerNode=function(){var e=document.createElement("div");return e.className="mapboxgl-ctrl-geocoder--powered-by",e.innerHTML='<a href="https://www.mapbox.com/search-service" target="_blank">Powered by Mapbox</a>',e}(),_=this;return u.list.draw=function(){_.options.useBrowserFocus&&u.list.element.querySelectorAll("li").forEach(function(e){e.removeEventListener("focus",_._onSuggestionItemFocus),e.removeEventListener("keydown",_._onSuggestionItemKeyDown)}),f.call(this),_.options.useBrowserFocus&&u.list.element.querySelectorAll("li").forEach(function(e,t){0===t&&e.focus(),e.setAttribute("data-index",t),e.tabIndex=0,e.addEventListener("focus",this._onSuggestionItemFocus),e.addEventListener("keydown",this._onSuggestionItemKeyDown)}.bind(_)),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},_onSuggestionItemKeydown(e){const t=e.keyCode;if(9!==t)if(13===t){e.preventDefault();const t=this._typeahead.list.element.querySelector(".active");if(t){const e=t.getAttribute("data-index"),i=this._typeahead.list.items[e];i&&(this._typeahead.value(i.original),this._typeahead.list.hide())}}else if(38===t||40===t){const i=this._typeahead.list.element.querySelectorAll("li");if(i.length>0){if(38===t){if(!(this._typeahead.list.active>0))return void this._typeahead.el.focus();e.preventDefault(),this._typeahead.list.active--}else if(40===t){if(e.preventDefault(),!(this._typeahead.list.active<i.length-1))return;this._typeahead.list.active++}i.forEach(function(e){e.classList.remove("active")});const r=i[this._typeahead.list.active];r&&(r.classList.add("active"),r.focus())}}},_onSuggestionItemFocus(e){this._typeahead.list.active=e.target.getAttribute("data-index"),this._typeahead.list.element.querySelectorAll("li").forEach(function(e){e.classList.remove("active")}),e.target.classList.add("active")},_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=f.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 r=e.target&&e.target.shadowRoot?e.target.shadowRoot.activeElement:e.target;if(!(r?r.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)||r.value.length>=this.options.minLength&&this._geocode(r.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=o({},this.options.flyTo),this._map&&this._map.fitBounds(a[e.properties.short_code].bbox,t);else if(e.bbox){var i=e.bbox;t=o({},this.options.flyTo),this._map&&this._map.fitBounds([[i[0],i[1]],[i[2],i[3]]],t)}else{var r={zoom:this.options.zoom};t=o({},r,this.options.flyTo),e.center?t.center=e.center:e.geometry&&e.geometry.type&&"Point"===e.geometry.type&&e.geometry.coordinates&&(t.center=e.geometry.coordinates),this._map&&this._map.flyTo(t)}},_requestType:function(e,t){return e.localGeocoderOnly?_:e.reverseGeocode&&f.REVERSE_GEOCODE_COORD_RGX.test(t)?g:m},_setupConfig:function(e,t){const i=/[\s,]+/;var r=this,n=["bbox","limit","proximity","countries","types","language","reverseMode","mode","autocomplete","fuzzyMatch","routing","worldview"].reduce(function(e,t){if(void 0===r.options[t]||null===r.options[t])return e;["countries","types","language"].indexOf(t)>-1?e[t]=r.options[t].split(i):e[t]=r.options[t];const n="number"===typeof r.options[t].longitude&&"number"===typeof r.options[t].latitude;if("proximity"===t&&n){const i=r.options[t].longitude,n=r.options[t].latitude;e[t]=[i,n]}return e},{});switch(e){case g:var s=t.split(i).map(function(e){return parseFloat(e,10)});r.options.flipCoordinates||s.reverse(),!n.types||n.types[0],n=o(n,{query:s,limit:1}),["proximity","autocomplete","fuzzyMatch","bbox"].forEach(function(e){e in n&&delete n[e]});break;case m:{const e=t.trim();/^(-?\d{1,3}(\.\d{0,256})?)[, ]+(-?\d{1,3}(\.\d{0,256})?)?$/.test(e)&&(t=t.replace(/,/g," ")),n=o(n,{query:t})}}return n.session_token=this.eventManager.getSessionId(),n},_geocode:function(e){this.inputString=e,this._showLoadingIcon(),this._eventEmitter.emit("loading",{query:e});const t=this._requestType(this.options,e),i=this._setupConfig(t,e);var r;switch(t){case _:r=Promise.resolve();break;case m:r=this.geocoderService.forwardGeocode(i).send();break;case g:r=this.geocoderService.reverseGeocode(i).send()}var n=this.options.localGeocoder&&this.options.localGeocoder(e)||[],o=[],s=null;return r.catch(function(e){s=e}.bind(this)).then(function(t){this._hideLoadingIcon();var r={};return t?"200"==t.statusCode&&((r=t.body).request=t.request,r.headers=t.headers,this._headers=t.headers):r={type:"FeatureCollection",features:[]},r.config=i,this.fresh&&(this.eventManager.start(this),this.fresh=!1),r.features&&r.features.length&&r.features.map(function(e){e._source="mapbox"}),r.features=r.features?n.concat(r.features):n,this.options.externalGeocoder?(o=this.options.externalGeocoder(e,r.features)||Promise.resolve([])).then(function(e){return r.features=r.features?e.concat(r.features):e,r},function(){return r}):r}.bind(this)).then(function(e){if(s)throw s;this.options.filter&&e.features.length&&(e.features=e.features.filter(this.options.filter)),e.features.length?(this._showClearButton(),this._hideGeolocateButton(),this._showAttribution(),this._eventEmitter.emit("results",e),this._typeahead.update(e.features)):(this._hideClearButton(),this._hideAttribution(),this._typeahead.selected=null,this._renderNoResults(),this._eventEmitter.emit("results",e))}.bind(this)).catch(function(e){this._hideLoadingIcon(),this._hideAttribution(),n.length&&this.options.localGeocoder||o.length&&this.options.externalGeocoder?(this._showClearButton(),this._hideGeolocateButton(),this._typeahead.update(n)):(this._hideClearButton(),this._typeahead.selected=null,this._renderError()),this._eventEmitter.emit("results",{features:n}),this._eventEmitter.emit("error",{error:e})}.bind(this)),r},_clear:function(e){e&&e.preventDefault(),this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this.eventManager.sessionIncrementer++,this._onChange(),this._hideClearButton(),this._showGeolocateButton(),this._removeMarker(),this.lastSelected=null,this._eventEmitter.emit("clear"),this.fresh=!0},clear:function(e){this._clear(e),this._inputEl.focus(),this.options.useBrowserFocus&&this._typeahead.list.hide()},_clearOnBlur:function(e){e.relatedTarget&&this._clear(e)},_onQueryResult:function(e){var t=e.body;if(t.features.length){var i=t.features[0];this._typeahead.selected=i,this._inputEl.value=i.place_name,this._onChange()}},_updateProximity:function(){if(this._map&&this.options.trackProximity)if(this._map.getZoom()>9){var e=this._map.getCenter().wrap();this.setProximity({longitude:e.lng,latitude:e.lat},!1)}else this.setProximity(null,!1)},_collapse:function(){this._inputEl.value||this._inputEl===document.activeElement||this.container.classList.add("mapboxgl-ctrl-geocoder--collapsed")},_unCollapse:function(){this.container.classList.remove("mapboxgl-ctrl-geocoder--collapsed")},query:function(e){return this._geocode(e).then(this._onQueryResult),this},_renderError:function(){this._renderMessage("<div class='mapbox-gl-geocoder--error'>There was an error reaching the server</div>")},_renderLocationError:function(){this._renderMessage("<div class='mapbox-gl-geocoder--error'>A location error has occurred</div>")},_renderNoResults:function(){this._renderMessage("<div class='mapbox-gl-geocoder--error mapbox-gl-geocoder--no-results'>No results found</div>")},_renderUserDeniedGeolocationError:function(){this._renderMessage("<div class='mapbox-gl-geocoder--error'>Geolocation permission denied</div>")},_renderMessage:function(e){this._typeahead.update([]),this._typeahead.selected=null,this._typeahead.clear(),this._typeahead.renderError(e)},_getPlaceholderText:function(){if(this.options.placeholder)return this.options.placeholder;if(this.options.language){var e=this.options.language.split(",")[0],t=d.language(e),i=u.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){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.options.proximity=e,t&&(this.options.trackProximity=!1),this},getProximity:function(){return this.options.proximity},setRenderFunction:function(e){return e&&"function"==typeof e&&(this._typeahead.render=e),this},getRenderFunction:function(){return this._typeahead.render},setLanguage:function(e){var t=navigator.language||navigator.userLanguage||navigator.browserLanguage;return this.options.language=e||this.options.language||t,this},getLanguage:function(){return this.options.language},getZoom:function(){return this.options.zoom},setZoom:function(e){return this.options.zoom=e,this},getFlyTo:function(){return this.options.flyTo},setFlyTo:function(e){return this.options.flyTo=e,this},getPlaceholder:function(){return this.options.placeholder},setPlaceholder:function(e){return this.options.placeholder=e||this._getPlaceholderText(),this._inputEl.placeholder=this.options.placeholder,this._inputEl.setAttribute("aria-label",this.options.placeholder),this},getBbox:function(){return this.options.bbox},setBbox:function(e){return this.options.bbox=e,this},getCountries:function(){return this.options.countries},setCountries:function(e){return this.options.countries=e,this},getTypes:function(){return this.options.types},setTypes:function(e){return this.options.types=e,this},getMinLength:function(){return this.options.minLength},setMinLength:function(e){return this.options.minLength=e,this._typeahead&&(this._typeahead.options.minLength=e),this},getLimit:function(){return this.options.limit},setLimit:function(e){return this.options.limit=e,this._typeahead&&(this._typeahead.options.limit=e),this},getFilter:function(){return this.options.filter},setFilter:function(e){return this.options.filter=e,this},setOrigin:function(e){return this.options.origin=e,this.geocoderService=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},getAutoc
2omplete: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=o({},{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=y},16397(e){"use strict";e.exports={placeholder:{de:"Suche",it:"Ricerca",en:"Search",nl:"Zoeken",fr:"Chercher",ca:"Cerca",he:"\u05dc\u05d7\u05e4\u05e9",ja:"\u30b5\u30fc\u30c1",lv:"Mekl\u0113t",pt:"Procurar",sr:"\u041f\u0440\u0435\u0442\u0440\u0430\u0433\u0430",zh:"\u641c\u7d22",cs:"Vyhled\xe1v\xe1n\xed",hu:"Keres\xe9s",ka:"\u10eb\u10d8\u10d4\u10d1\u10d0",nb:"S\xf8ke",sk:"Vyh\u013ead\xe1vanie",th:"\u0e04\u0e49\u0e19\u0e2b\u0e32",fi:"Hae",is:"Leita",ko:"\uc218\uc0c9",pl:"Szukaj",sl:"Iskanje",fa:"\u062c\u0633\u062a\u062c\u0648",ru:"\u041f\u043e\u0438\u0441\u043a"}}},7651(e){function t(e){const t=e.address||"",i=e.text||"",r=e.place_name||"",n={address:r.split(",")[0],houseNumber:t,street:i,placeName:r};return e.context.forEach(function(e){const t=e.id.split(".")[0];n[t]=e.text}),n}e.exports={transformFeatureToGeolocationText:function(e,i){const r=t(e),n=["address","street","place","country"];if("function"===typeof i)return i(r);const o=n.indexOf(i);return(-1===o?n:n.slice(o)).reduce(function(e,t){return r[t]?(""!==e&&(e+=", "),e+r[t]):e},"")},getAddressInfo:t,REVERSE_GEOCODE_COORD_RGX:/^[ ]*(-?\d{1,3}(\.\d{0,256})?)[, ]+(-?\d{1,3}(\.\d{0,256})?)[ ]*$/}},47050(e,t,i){"use strict";var r=i(86537);e.exports=r},86537(e,t,i){"use strict";var r=i(73465),n=i(34690);function o(e){n.call(this,e)}o.prototype=Object.create(n.prototype),o.prototype.constructor=o,o.prototype.sendRequest=r.browserSend,o.prototype.abortRequest=r.browserAbort,e.exports=function(e){return new o(e)}},73465(e,t,i){"use strict";var r=i(56238),n=i(57227),o=i(3487),s=i(23104),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,r){t.onprogress=function(t){e.emitter.emit(o.EVENT_PROGRESS_DOWNLOAD,l(t))};var s=e.file;s&&(t.upload.onprogress=function(t){e.emitter.emit(o.EVENT_PROGRESS_UPLOAD,l(t))}),t.onerror=function(e){r(e)},t.onabort=function(){var t=new n({request:e,type:o.ERROR_REQUEST_ABORTED});r(t)},t.onload=function(){if(delete a[e.id],t.status<200||t.status>=400){var o=new n({request:e,body:t.response,statusCode:t.status});r(o)}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 r(e,{body:t.response,headers:s(t.getAllResponseHeaders()),statusCode:t.status})}(e,t)})}function h(e,t){var i=e.url(t),r=new window.XMLHttpRequest;return r.open(e.method,i),Object.keys(e.headers).forEach(function(t){r.setRequestHeader(t,e.headers[t])}),r}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=h(e,e.client.accessToken);return c(e,t)})},createRequestXhr:h}},34690(e,t,i){"use strict";var r=i(49229),n=i(33868),o=i(3487);function s(e){if(!e||!e.accessToken)throw new Error("Cannot create a client without an access token");r(e.accessToken),this.accessToken=e.accessToken,this.origin=e.origin||o.API_ORIGIN}s.prototype.createRequest=function(e){return new n(this,e)},e.exports=s},57227(e,t,i){"use strict";var r=i(3487);e.exports=function(e){var t,i=e.type||r.ERROR_HTTP;if(e.body)try{t=JSON.parse(e.body)}catch(o){t=e.body}else t=null;var n=e.message||null;n||("string"===typeof t?n=t:t&&"string"===typeof t.message?n=t.message:i===r.ERROR_REQUEST_ABORTED&&(n="Request aborted")),this.message=n,this.type=i,this.statusCode=e.statusCode||null,this.request=e.request,this.body=t}},33868(e,t,i){"use strict";var r=i(49229),n=i(60049),o=i(17283),s=i(45141),a=i(3487),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 r=n(i,t.headers),s=Object.keys(r).reduce(function(e,t){return e[t.toLowerCase()]=r[t],e},{});this.id=l++,this._options=t,this.emitter=new o,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,o=null==e?this.client.accessToken:e;if(o){t=s.appendQueryParam(t,"access_token",o);var a=r(o).user;i=n({ownerId:a},i)}
2return t=s.interpolateRouteParams(t,i),t},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,n(e))})}function r(t){e(t,null,function(){})}function n(e){e.send().then(i,r)}n(this)},c.prototype.clone=function(){return this._extend()},c.prototype._extend=function(e){var t=n(this._options,e);return new c(this.client,t)},e.exports=c},56238(e,t,i){"use strict";var r=i(97484);function n(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(i){this.body=t.body}this.links=r(this.headers.link)}n.prototype.hasNextPage=function(){return!!this.links.next},n.prototype.nextPage=function(){return this.hasNextPage()?this.request._extend({path:this.links.next.url}):null},e.exports=n},3487(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"}},23104(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}},97484(e){"use strict";e.exports=function(e){return e?e.split(/,\s*</).reduce(function(e,t){var i=function(e){var t=e.match(/<?([^>]*)>(.*)/);if(!t)return null;var i=t[1],r=t[2].split(";"),n=null,o=r.reduce(function(e,t){var i=function(e){var t=e.match(/\s*(.+)\s*=\s*"?([^"]+)"?/);return t?{key:t[1],value:t[2]}:null}(t);return i?"rel"===i.key?(n||(n=i.value),e):(e[i.key]=i.value,e):e},{});return n?{url:i,rel:n,params:o}:null}(t);return i?(i.rel.split(/\s+/).forEach(function(t){e[t]||(e[t]={url:i.url,params:i.params})}),e):e},{}):{}}},45141(e){"use strict";function t(e){return Array.isArray(e)?e.map(encodeURIComponent).join(","):encodeURIComponent(String(e))}function i(e,i,r){if(!1===r||null===r)return e;var n=/\?/.test(e)?"&":"?",o=encodeURIComponent(i);return void 0!==r&&""!==r&&!0!==r&&(o+="="+t(r)),""+e+n+o}e.exports={appendQueryObject:function(e,t){if(!t)return e;var r=e;return Object.keys(t).forEach(function(e){var n=t[e];void 0!==n&&(Array.isArray(n)&&(n=n.filter(function(e){return null!==e&&void 0!==e}).join(",")),r=i(r,e,n))}),r},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,r){var n=i[r];if(void 0===n)throw new Error("Unspecified route parameter "+r);return"/"+t(n)}):e}}},34012(e,t,i){"use strict";var r=i(60049),n=i(95217),o=i(77594),s=i(22522),a=i(80682),l={},c=["country","region","postcode","district","place","locality","neighborhood","address","poi","poi.landmark"];l.forwardGeocode=function(e){n.assertShape({query:n.required(n.string),mode:n.oneOf("mapbox.places","mapbox.places-permanent"),countries:n.arrayOf(n.string),proximity:n.oneOf(n.coordinates,"ip"),types:n.arrayOf(n.oneOf(c)),autocomplete:n.boolean,bbox:n.arrayOf(n.number),limit:n.number,language:n.arrayOf(n.string),routing:n.boolean,fuzzyMatch:n.boolean,worldview:n.string,
2session_token:n.string})(e),e.mode=e.mode||"mapbox.places";var t=s(r({country:e.countries},o(e,["proximity","types","autocomplete","bbox","limit","language","routing","fuzzyMatch","worldview","session_token"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:o(e,["mode","query"]),query:t})},l.reverseGeocode=function(e){n.assertShape({query:n.required(n.coordinates),mode:n.oneOf("mapbox.places","mapbox.places-permanent"),countries:n.arrayOf(n.string),types:n.arrayOf(n.oneOf(c)),bbox:n.arrayOf(n.number),limit:n.number,language:n.arrayOf(n.string),reverseMode:n.oneOf("distance","score"),routing:n.boolean,worldview:n.string,session_token:n.string})(e),e.mode=e.mode||"mapbox.places";var t=s(r({country:e.countries},o(e,["country","types","bbox","limit","language","reverseMode","routing","worldview","session_token"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:o(e,["mode","query"]),query:t})},e.exports=a(l)},80682(e,t,i){"use strict";var r=i(34690),n=i(86537);e.exports=function(e){return function(t){var i;i=r.prototype.isPrototypeOf(t)?t:n(t);var o=Object.create(e);return o.client=i,o}}},40743(e){"use strict";e.exports=function(e,t){return Object.keys(e).reduce(function(i,r){return i[r]=t(r,e[r]),i},{})}},77594(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},{})}},22522(e,t,i){"use strict";var r=i(40743);e.exports=function(e){return r(e,function(e,t){return"boolean"===typeof t?JSON.stringify(t):t})}},95217(e,t,i){"use strict";var r=i(60049),n=i(36366);e.exports=r(n,{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(r){return t}},coordinates:function(e){return n.tuple(n.number,n.number)(e)},assertShape:function(e,t){return n.assert(n.strictShape(e),t)}})},49229(e,t,i){"use strict";var r=i(2511),n={};function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e){if(n[e])return n[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(r.decode(e))}catch(t){throw new Error("Invalid token")}}(s),l={usage:i,user:a.u};return o(a,"a")&&(l.authorization=a.a),o(a,"exp")&&(l.expires=1e3*a.exp),o(a,"iat")&&(l.created=1e3*a.iat),o(a,"scopes")&&(l.scopes=a.scopes),o(a,"client")&&(l.client=a.client),o(a,"ll")&&(l.lastLogin=a.ll),o(a,"iu")&&(l.impersonator=a.iu),n[e]=l,l}},2511(e,t,i){var r;e=i.nmd(e),function(){var n=t,o=(e&&e.exports,"object"==typeof i.g&&i.g);o.global!==o&&o.window;var s=function(e){this.message=e};(s.prototype=new Error).name="InvalidCharacterError";var a=function(e){throw new s(e)},l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=/[\t\n\f\r ]/g,h={encode:function(e){e=String(e),/[^\0-\xFF]/.test(e)&&a("The string to be encoded contains characters outside of the Latin1 range.");for(var t,i,r,n,o=e.length%3,s="",c=-1,h=e.length-o;++c<h;)t=e.charCodeAt(c)<<16,i=e.charCodeAt(++c)<<8,r=e.charCodeAt(++c),s+=l.charAt((n=t+i+r)>>18&63)+l.charAt(n>>12&63)+l.charAt(n>>6&63)+l.charAt(63&n);return 2==o?(t=e.charCodeAt(c)<<8,i=e.charCodeAt(++c),s+=l.charAt((n=t+i)>>10)+l.charAt(n>>4&63)+l.charAt(n<<2&63)+"="):1==o&&(n=e.charCodeAt(c),s+=l.charAt(n>>2)+l.charAt(n<<4&63)+"=="),s},decode:function(e){var t=(e=String(e).replace(c,"")).length;t%4==0&&(t=(e=e.replace(/==?$/,"")).length),(t%4==1||/[^+a-zA-Z0-9/]/.test(e))&&a("Invalid character: the string to be decoded is not correctly encoded.");for(var i,r,n=0,o="",s=-1;++s<t;)r=l.indexOf(e.charAt(s)),i=n%4?64*i+r:r,n++%4&&(o+=String.fromCharCode(255&i>>(-2*n&6)));return o},version:"0.1.0"};void 0===(r=function(){return h}.call(t,i,t,e))||(e.exports=r)}()},43024(e,t,i){"use strict";function r(e){var t,i,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(i=r(e[t]))&&(n&&(n+=" "),n+=i);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}const n=function(){for(var e,t,i=0,n="";i<arguments.length;)(e=arguments[i++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n};i.d(t,["A",0,n])},17283(e){"use strict";var t=Object.prototype.hasOwnProperty,i="~";function r(){}function n(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,r,o,s){if("function"!==typeof r)throw new TypeError("The listener must be a function");var a=new n(r,o||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 r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(i=!1)),a.prototype.eventNames=function(){var e,r,n=[];if(0===this._eventsCount)return n;for(r in e=this._events)t.call(e,r)&&n.push(i?r.slice(1):r);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},a.prototype.listeners=function(e){var t=i?i+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,o=r.length,s=new Array(o);n<o;n++)s[n]=r[n].fn;return s},a.prototype.listenerCount=function(e){var t=i?i+e:e,r=this._events[t];return r?r.fn?1:r.length:0},a.prototype.emit=function(e,t,r,n,o,s){var a=i?i+e:e;if(!this._events[a])return!1;var l,c,h=this._events[a],u=arguments.length;if(h.fn){switch(h.once&&this.removeListener(e,h.fn,void 0,!0),u){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,t),!0;case 3:return h.fn.call(h.context,t,r),!0;case 4:return h.fn.call(h.context,t,r,n),!0;case 5:return h.fn.call(h.context,t,r,n,o),!0;case 6:return h.fn.call(h.context,t,r,n,o,s),!0}for(c=1,l=new Array(u-1);c<u;c++)l[c-1]=arguments[c];h.fn.apply(h.context,l)}else{var d,p=h.length;for(c=0;c<p;c++)switch(h[c].once&&this.removeListener(e,h[c].fn,void 0,!0),u){case 1:h[c].fn.call(h[c].context);break;case 2:h[c].fn.call(h[c].context,t);break;case 3:h[c].fn.call(h[c].context,t,r);break;case 4:h[c].fn.call(h[c].context,t,r,n);break;default:if(!l)for(d=1,l=new Array(u-1);d<u;d++)l[d-1]=arguments[d];
vendor: 5,435 bytes, line 2
2h[c].fn.apply(h[c].context,l)}}return!0},a.prototype.on=function(e,t,i){return o(this,e,t,i,!1)},a.prototype.once=function(e,t,i){return o(this,e,t,i,!0)},a.prototype.removeListener=function(e,t,r,n){var o=i?i+e:e;if(!this._events[o])return this;if(!t)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||n&&!a.once||r&&a.context!==r||s(this,o);else{for(var l=0,c=[],h=a.length;l<h;l++)(a[l].fn!==t||n&&!a[l].once||r&&a[l].context!==r)&&c.push(a[l]);c.length?this._events[o]=1===c.length?c[0]:c:s(this,o)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&s(this,t)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,e.exports=a},27284(e){"use strict";var t,i="object"===typeof Reflect?Reflect:null,r=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 n=Number.isNaN||function(e){return e!==e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise(function(i,r){function n(i){e.removeListener(t,o),r(i)}function o(){"function"===typeof e.removeListener&&e.removeListener("error",n),i([].slice.call(arguments))}m(e,t,o,{once:!0}),"error"!==t&&function(e,t,i){"function"===typeof e.on&&m(e,"error",t,i)}(e,n,{once:!0})})},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.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?o.defaultMaxListeners:e._maxListeners}function c(e,t,i,r){var n,o,s,c;if(a(i),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),o=e._events),s=o[t]),void 0===s)s=o[t]=i,++e._eventsCount;else if("function"===typeof s?s=o[t]=r?[i,s]:[s,i]:r?s.unshift(i):s.push(i),(n=l(e))>0&&s.length>n&&!s.warned){s.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=e,h.type=t,h.count=s.length,c=h,console&&console.warn&&console.warn(c)}return e}function h(){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 u(e,t,i){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},n=h.bind(r);return n.listener=i,r.wrapFn=n,n}function d(e,t,i){var r=e._events;if(void 0===r)return[];var n=r[t];return void 0===n?[]:"function"===typeof n?i?[n.listener||n]:[n]:i?function(e){for(var t=new Array(e.length),i=0;i<t.length;++i)t[i]=e[i].listener||e[i];return t}(n):f(n,n.length)}function p(e){var t=this._events;if(void 0!==t){var i=t[e];if("function"===typeof i)return 1;if(void 0!==i)return i.length}return 0}function f(e,t){for(var i=new Array(t),r=0;r<t;++r)i[r]=e[r];return i}function m(e,t,i,r){if("function"===typeof e.on)r.once?e.once(t,i):e.on(t,i);else{if("function"!==typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function n(o){r.once&&e.removeEventListener(t,n),i(o)})}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!==typeof e||e<0||n(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!==typeof e||e<0||n(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return l(this)},o.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var n="error"===e,o=this._events;if(void 0!==o)n=n&&void 0===o.error;else if(!n)return!1;if(n){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=o[e];if(void 0===l)return!1;if("function"===typeof l)r(l,this,t);else{var c=l.length,h=f(l,c);for(i=0;i<c;++i)r(h[i],this,t)}return!0},o.prototype.addListener=function(e,t){return c(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return c(this,e,t,!0)},o.prototype.once=function(e,t){return a(t),this.on(e,u(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,u(this,e,t)),this},o.prototype.removeListener=function(e,t){var i,r,n,o,s;if(a(t),void 0===(r=this._events))return this;if(void 0===(i=r[e]))return this;if(i===t||i.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit
2("removeListener",e,i.listener||t));else if("function"!==typeof i){for(n=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){s=i[o].listener,n=o;break}if(n<0)return this;0===n?i.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(i,n),1===i.length&&(r[e]=i[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,i,r;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete i[e]),this;if(0===arguments.length){var n,o=Object.keys(i);for(r=0;r<o.length;++r)"removeListener"!==(n=o[r])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"===typeof(t=i[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},o.prototype.listeners=function(e){return d(this,e,!0)},o.prototype.rawListeners=function(e){return d(this,e,!1)},o.listenerCount=function(e,t){return"function"===typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},o.prototype.listenerCount=p,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},65944(e){!function(){var 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 r,n=0,o=[],s=t.length,a=0,l=0,c=i.pre||"",h=i.post||"",u=i.caseSensitive&&t||t.toLowerCase();e=i.caseSensitive&&e||e.toLowerCase();for(var d=0;d<s;d++)r=t[d],u[d]===e[n]?(r=c+r+h,n+=1,l+=1+l):l=0,a+=l,o[o.length]=r;return n===e.length?(a=u===e?1/0:a,{rendered:o.join(""),score:a}):null},t.filter=function(e,i,r){return i&&0!==i.length?"string"!==typeof e?i:(r=r||{},i.reduce(function(i,n,o,s){var a=n;r.extract&&(a=r.extract(n));var l=t.match(e,a,r);return null!=l&&(i[i.length]={string:l.rendered,score:l.score,index:o,original:n}),i},[]).sort(function(e,t){var i=t.score-e.score;return i||e.index-t.index})):[]}}()},88313(e){"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({}))}},10446(e,t,i){var r=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,o=/^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,h=l||c||Function("return this")(),u=Object.prototype.toString,d=Math.max,p=Math.min,f=function(){return h.Date.now()};function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function _(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==u.call(e)}(e))return NaN;if(m(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=m(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(r,"");var i=o.test(e);return i||s.test(e)?a(e.slice(2),i?2:8):n.test(e)?NaN:+e}e.exports=function(e,t,i){var r,n,o,s,a,l,c=0,h=!1,u=!1,g=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var i=r,o=n;return r=n=void 0,c=t,s=e.apply(o,i)}function x(e){var i=e-l;return void 0===l||i>=t||i<0||u&&e-c>=o}function v(){var e=f();if(x(e))return b(e);a=setTimeout(v,function(e){var i=t-(e-l);return u?p(i,o-(e-c)):i}(e))}function b(e){return a=void 0,g&&r?y(e):(r=n=void 0,s)}function w(){var e=f(),i=x(e);if(r=arguments,n=this,l=e,i){if(void 0===a)return function(e){return c=e,a=setTimeout(v,t),h?y(e):s}(l);if(u)return a=setTimeout(v,t),y(l)}return void 0===a&&(a=setTimeout(v,t)),s}return t=_(t)||0,m(i)&&(h=!!i.leading,o=(u="maxWait"in i)?d(_(i.maxWait)||0,t):o,g="trailing"in i?!!i.trailing:g),w.cancel=function(){void 0!==a&&clearTimeout(a),c=0,r=l=n=a=void 0},w.flush=function(){return void 0===a?s:b(f())},w}},879(e){e.exports=function(){"use strict";var e,t,i;function r(r,n){if(e)if(t){var o="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+e+")(sharedChunk); ("+t+")(sharedChunk); self.onerror = null;",s={};e(s),i=n(s),"undefined"!==typeof window&&window&&window.URL&&window.URL.createObjectURL&&(i.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else t=n;else e=n}return r(["exports"],function(e){var t=1e-6,i="undefined"!=typeof Float32Array?Float32Array:Array;function r(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=i*o-n*r;return s?(e[0]=o*(s=1/s),e[1]=-r*s,e[2]=-n*s,e[3]=i*s,e):null}function n(){var e=new i(9);return i!=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 o(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],h=t[8];return e[0]=s*h-a*c,e[1]=n*c-r*h,e[2]=r*a-n*s,e[3]=a*l-o*h,e[4]=i*h-n*l,e[5]=n*o-i*a,e[6]=o*c-s*l,e[7]=r*l-i*c,e[8]=i*s-r*o,e}function s(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],h=t[7],u=t[8],d=i[0],p=i[1],f=i[2],m=i[3],_=i[4],g=i[5],y=i[6],x=i[7],v=i[8];return e[0]=d*r+p*s+f*c,e[1]=d*n+p*a+f*h,e[2]=d*o+p*l+f*u,e[3]=m*r+_*s+g*c,e[4]=m*n+_*a+g*h,e[5]=m*o+_*l+g*u,e[6]=y*r+x*s+v*c,e[7]=y*n+x*a+v*h,e[8]=y*o+x*l+v*u,e}function a(){var e=new i(16);return i!=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}function l(e){var t=new i(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}function c(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10
vendor: 2,644 bytes, line 2
2]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function h(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],h=t[8],u=t[9],d=t[10],p=t[11],f=t[12],m=t[13],_=t[14],g=t[15],y=i*a-r*s,x=i*l-n*s,v=i*c-o*s,b=r*l-n*a,w=r*c-o*a,T=n*c-o*l,S=h*m-u*f,E=h*_-d*f,I=h*g-p*f,A=u*_-d*m,M=u*g-p*m,C=d*g-p*_,P=y*C-x*M+v*A+b*I-w*E+T*S;return P?(e[0]=(a*C-l*M+c*A)*(P=1/P),e[1]=(n*M-r*C-o*A)*P,e[2]=(m*T-_*w+g*b)*P,e[3]=(d*w-u*T-p*b)*P,e[4]=(l*I-s*C-c*E)*P,e[5]=(i*C-n*I+o*E)*P,e[6]=(_*v-f*T-g*x)*P,e[7]=(h*T-d*v+p*x)*P,e[8]=(s*M-a*I+c*S)*P,e[9]=(r*I-i*M-o*S)*P,e[10]=(f*w-m*v+g*y)*P,e[11]=(u*v-h*w-p*y)*P,e[12]=(a*E-s*A-l*S)*P,e[13]=(i*A-r*E+n*S)*P,e[14]=(m*x-f*b-_*y)*P,e[15]=(h*b-u*x+d*y)*P,e):null}function u(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],h=t[7],u=t[8],d=t[9],p=t[10],f=t[11],m=t[12],_=t[13],g=t[14],y=t[15],x=i[0],v=i[1],b=i[2],w=i[3];return e[0]=x*r+v*a+b*u+w*m,e[1]=x*n+v*l+b*d+w*_,e[2]=x*o+v*c+b*p+w*g,e[3]=x*s+v*h+b*f+w*y,e[4]=(x=i[4])*r+(v=i[5])*a+(b=i[6])*u+(w=i[7])*m,e[5]=x*n+v*l+b*d+w*_,e[6]=x*o+v*c+b*p+w*g,e[7]=x*s+v*h+b*f+w*y,e[8]=(x=i[8])*r+(v=i[9])*a+(b=i[10])*u+(w=i[11])*m,e[9]=x*n+v*l+b*d+w*_,e[10]=x*o+v*c+b*p+w*g,e[11]=x*s+v*h+b*f+w*y,e[12]=(x=i[12])*r+(v=i[13])*a+(b=i[14])*u+(w=i[15])*m,e[13]=x*n+v*l+b*d+w*_,e[14]=x*o+v*c+b*p+w*g,e[15]=x*s+v*h+b*f+w*y,e}function d(e,t,i){var r,n,o,s,a,l,c,h,u,d,p,f,m=i[0],_=i[1],g=i[2];return t===e?(e[12]=t[0]*m+t[4]*_+t[8]*g+t[12],e[13]=t[1]*m+t[5]*_+t[9]*g+t[13],e[14]=t[2]*m+t[6]*_+t[10]*g+t[14],e[15]=t[3]*m+t[7]*_+t[11]*g+t[15]):(n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],h=t[7],u=t[8],d=t[9],p=t[10],f=t[11],e[0]=r=t[0],e[1]=n,e[2]=o,e[3]=s,e[4]=a,e[5]=l,e[6]=c,e[7]=h,e[8]=u,e[9]=d,e[10]=p,e[11]=f,e[12]=r*m+a*_+u*g+t[12],e[13]=n*m+l*_+d*g+t[13],e[14]=o*m+c*_+p*g+t[14],e[15]=s*m+h*_+f*g+t[15]),e}function p(e,t,i){var r=i[0],n=i[1],o=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function f(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[4],s=t[5],a=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*n+c*r,e[5]=s*n+h*r,e[6]=a*n+u*r,e[7]=l*n+d*r,e[8]=c*n-o*r,e[9]=h*n-s*r,e[10]=u*n-a*r,e[11]=d*n-l*r,e}function m(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[0],s=t[1],a=t[2],l=t[3],c=t[8],h=t[9],u=t[10],d=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*n-c*r,e[1]=s*n-h*r,e[2]=a*n-u*r,e[3]=l*n-d*r,e[8]=o*r+c*n,e[9]=s*r
vendor: 5,413 bytes, line 2
2+h*n,e[10]=a*r+u*n,e[11]=l*r+d*n,e}function _(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[0],s=t[1],a=t[2],l=t[3],c=t[4],h=t[5],u=t[6],d=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*n+c*r,e[1]=s*n+h*r,e[2]=a*n+u*r,e[3]=l*n+d*r,e[4]=c*n-o*r,e[5]=h*n-s*r,e[6]=u*n-a*r,e[7]=d*n-l*r,e}function g(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 y(e,i,r){var n,o,s,a=r[0],l=r[1],c=r[2],h=Math.sqrt(a*a+l*l+c*c);return h<t?null:(a*=h=1/h,l*=h,c*=h,n=Math.sin(i),o=Math.cos(i),e[0]=a*a*(s=1-o)+o,e[1]=l*a*s+c*n,e[2]=c*a*s-l*n,e[3]=0,e[4]=a*l*s-c*n,e[5]=l*l*s+o,e[6]=c*l*s+a*n,e[7]=0,e[8]=a*c*s+l*n,e[9]=l*c*s-a*n,e[10]=c*c*s+o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function x(e,t){var i=t[0],r=t[1],n=t[2],o=t[4],s=t[5],a=t[6],l=t[8],c=t[9],h=t[10];return e[0]=Math.sqrt(i*i+r*r+n*n),e[1]=Math.sqrt(o*o+s*s+a*a),e[2]=Math.sqrt(l*l+c*c+h*h),e}function v(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=i+i,a=r+r,l=n+n,c=i*s,h=r*s,u=r*a,d=n*s,p=n*a,f=n*l,m=o*s,_=o*a,g=o*l;return e[0]=1-u-f,e[1]=h+g,e[2]=d-_,e[3]=0,e[4]=h-g,e[5]=1-c-f,e[6]=p+m,e[7]=0,e[8]=d+_,e[9]=p-m,e[10]=1-c-u,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}var b=u;function w(){var e=new i(3);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function T(e){var t=new i(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function S(e){var t=e[0],i=e[1],r=e[2];return Math.sqrt(t*t+i*i+r*r)}function E(e,t,r){var n=new i(3);return n[0]=e,n[1]=t,n[2]=r,n}function I(e,t,i,r){return e[0]=t,e[1]=i,e[2]=r,e}function A(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function M(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e}function C(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e}function P(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e}function R(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e}function z(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function L(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e}function D(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return Math.sqrt(i*i+r*r+n*n)}function O(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return i*i+r*r+n*n}function F(e){var t=e[0],i=e[1],r=e[2];return t*t+i*i+r*r}function k(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function B(e,t){var i=t[0],r=t[1],n=t[2],o=i*i+r*r+n*n;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function N(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function V(e,t,i){var r=t[0],n=t[1],o=t[2],s=i[0],a=i[1],l=i[2];return e[0]=n*l-o*a,e[1]=o*s-r*l,e[2]=r*a-n*s,e}function U(e,t,i,r){var n=t[0],o=t[1],s=t[2];return e[0]=n+r*(i[0]-n),e[1]=o+r*(i[1]-o),e[2]=s+r*(i[2]-s),e}function j(e,t,i){var r=t[0],n=t[1],o=t[2],s=i[3]*r+i[7]*n+i[11]*o+i[15];return e[0]=(i[0]*r+i[4]*n+i[8]*o+i[12])/(s=s||1),e[1]=(i[1]*r+i[5]*n+i[9]*o+i[13])/s,e[2]=(i[2]*r+i[6]*n+i[10]*o+i[14])/s,e}function G(e,t,i){var r=t[0],n=t[1],o=t[2];return e[0]=r*i[0]+n*i[3]+o*i[6],e[1]=r*i[1]+n*i[4]+o*i[7],e[2]=r*i[2]+n*i[5]+o*i[8],e}function q(e,t,i){var r=i[0],n=i[1],o=i[2],s=i[3],a=t[0],l=t[1],c=t[2],h=n*c-o*l,u=o*a-r*c,d=r*l-n*a;return e[0]=a+s*(h+=h)+n*(d+=d)-o*(u+=u),e[1]=l+s*u+o*h-r*d,e[2]=c+s*d+r*u-n*h,e}function H(e){return e[0]=0,e[1]=0,e[2]=0,e}function $(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}var Z=M,W=C,X=S;function Y(){var e=new i(4);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function K(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 J(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=i*i+r*r+n*n+o*o;return s>0&&(s=1/Math.sqrt(s)),e[0]=i*s,e[1]=r*s,e[2]=n*s,e[3]=o*s,e}function Q(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function ee(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3];return e[0]=i[0]*r+i[4]*n+i[8]*o+i[12]*s,e[1]=i[1]*r+i[5]*n+i[9]*o+i[13]*s,e[2]=i[2]*r+i[6]*n+i[10]*o+i[14]*s,e[3]=i[3]*r+i[7]*n+i[11]*o+i[15]*s,e}function te(){var e=new i(4);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function ie(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function re(e,t,i){i*=.5;var r=t[0],n=t[1],o=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=r*l+s*a,e[1]=n*l+o*a,e[2]=o*l-n*a,e[3]=s*l-r*a,e}function ne(e,t,i){i*=.5;var r=t[0],n=t[1],o=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=r*l-o*a,e[1]=n*l+s*a,e[2]=o*l+r*a,e[3]=s*l-n*a,e}w(),Y();var oe,se,ae,le=J,ce=(oe=w(),se=E(1,0,0),ae=E(0,1,0),function(e,t,i){var r=N(t,i);return r<-.999999?(V(oe,se,t),X(oe)<1e-6&&V(oe,ae,t),B(oe,oe),function(e,t,i){i*=.5;var r=Math.sin(i);e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(i)}(e,oe,Math.PI),e):r>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(V(oe,t,i),e[0]=oe[0],e[1]=oe[1],e[2]=oe[2],e[3]=1+r,le(e,e))});function he(){var e=new i(2);return i!=Float32Array&&(e[0]=0,e[1]=0),e}function ue(e,t){var r=new i(2);return r[0]=e,r[1]=t,r}function de(e,t,i){return e[0]=t,e[1]=i,e}function pe(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e}function fe(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e}function me(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e}function _e(e){var t=e[0],i=e[1];return Math.sqrt(t*t+i*i)}function ge(e,t){var i=t[0],r=t[1],n=i*i+r*r;return n>0&&(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e}function ye(e,t){return e[0]*t[0]+e[1]*t[1]}te(),te(),n();var xe,ve,be=fe;
2function we(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}he();var Te=function(){if(ve)return xe;function e(e,t,i,r){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=r}return ve=1,xe=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,r=0;r<8;r++){var n=this.sampleCurveX(i)-e;if(Math.abs(n)<t)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i-=n/o}var s=0,a=1;for(i=e,r=0;r<20&&(n=this.sampleCurveX(i),!(Math.abs(n-e)<t));r++)e>n?s=i:a=i,i=.5*(a-s)+s;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},xe}(),Se=we(Te);function Ee(e,t){this.x=e,this.y=t}function Ie(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!Ie(e[i],t[i]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==t){if("object"!=typeof t)return!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(!Ie(e[i],t[i]))return!1;return!0}return e===t}Ee.prototype={clone(){return new Ee(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){const t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){const 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(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){const e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){const t=Math.cos(e),i=Math.sin(e),r=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=r,this},_rotateAround(e,t){const i=Math.cos(e),r=Math.sin(e),n=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-r*(this.y-t.y),this.y=n,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Ee},Ee.convert=function(e){if(e instanceof Ee)return e;if(Array.isArray(e))return new Ee(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new Ee(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};const Ae=Math.PI/180,Me=180/Math.PI;function Ce(e){return e*Ae}function Pe(e){return e*Me}const Re=[[0,0],[1,0],[1,1],[0,1]];function ze(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 Le(e,t,i,r){const n=new Se(e,t,i,r);return function(e){return n.solve(e)}}const De=Le(.25,.1,.25,1);function Oe(e,t,i){return Math.min(i,Math.max(t,e))}function Fe(e,t,i){return(i=Oe((i-e)/(t-e),0,1))*i*(3-2*i)}function ke(e,t,i){const r=i-t,n=((e-t)%r+r)%r+t;return n===t?i:n}function Be(e,t,i){if(!e.length)return i(null,[]);let r=e.length;const n=new Array(e.length);let o=null;e.forEach((e,s)=>{t(e,(e,t)=>{e&&(o=e),n[s]=t,0===--r&&i(o,n)})})}let Ne=1;function Ve(){return Ne++}function Ue(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log2(e)))}
vendor: 4,850 bytes, line 2
2function je(e,t){e.forEach(e=>{t[e]&&(t[e]=t[e].bind(t))})}function Ge(e,t,i){const r={};for(const n in e)r[n]=t.call(this,e[n],n,e);return r}function qe(e,t,i){const r={};for(const n in e)t.call(this,e[n],n,e)&&(r[n]=e[n]);return r}function He(e){return Array.isArray(e)?e.map(He):"object"==typeof e&&e?Ge(e,He):e}function $e(e,t){for(let i=0;i<e.length;i++)if(t.indexOf(e[i])>=0)return!0;return!1}const Ze={};function We(e){Ze[e]||("undefined"!=typeof console&&console.warn(e),Ze[e]=!0)}function Xe(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function Ye(e){let t=0;for(let i,r,n=0,o=e.length,s=o-1;n<o;s=n++)i=e[n],r=e[s],t+=(r.x-i.x)*(i.y+r.y);return t}function Ke([e,t,i]){const r=Ce(t+90),n=Ce(i);return{x:e*Math.cos(r)*Math.sin(n),y:e*Math.sin(r)*Math.sin(n),z:e*Math.cos(n),azimuthal:t,polar:i}}function Je(e){return("undefined"!=typeof self||void 0!==e)&&"undefined"!=typeof WorkerGlobalScope&&(void 0!==e?e:self)instanceof WorkerGlobalScope}function Qe(e){const t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,i,r,n)=>{const o=r||n;return t[i]=!o||o.toLowerCase(),""}),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}let et=null;function tt(e,t){return[e[4*t],e[4*t+1],e[4*t+2],e[4*t+3]]}function it(e,t,i,r){for(;t<i;){const n=t+i>>1;e[n]<r?t=n+1:i=n}return t}function rt(e,t,i,r){for(;t<i;){const n=t+i>>1;e[n]<=r?t=n+1:i=n}return t}function nt(e){return e>0?1/(1.001-e):1+e}function ot(e){return e>0?1-1/(1.001-e):-e}function st(e,t,i){return(e-t.min)*(i.max-i.min)/(t.max-t.min)+i.min}const at={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!at.API_URL)return null;try{const e=new URL(at.API_URL);return"api.mapbox.cn"===e.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===e.hostname?"https://events.mapbox.com/events/v2":null}catch(e){return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v1.2.4.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function lt(e){return at.API_URL_REGEX.test(e)}function ct(e){return at.API_SPRITE_REGEX.test(e)}let ht,ut,dt,pt,ft,mt;function _t(){return null==ht&&(ht=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),ht}const gt={now:()=>void 0!==pt?pt:performance.now(),setNow(e){pt=e},restoreNow(){pt=void 0},frame(e){const t=requestAnimationFrame(e);return{cancel:()=>cancelAnimationFrame(t)}},getImageData(e,t=0){const{width:i,height:r}=e;ft||(ft=document.createElement("canvas"));const n=ft.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return(i>ft.width||r>ft.height)&&(ft.width=i,ft.height=r),n.clearRect(-t,-t,i+2*t,r+2*t),n.drawImage(e,0,0,i,r),n.getImageData(-t,-t,i+2*t,r+2*t)},resolveURL:e=>(ut||(ut=document.createElement("a")),ut.href=e,ut.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(null==dt&&(dt=window.matchMedia("(prefers-reduced-motion: reduce)")),dt.matches)},hasCanvasFingerprintNoise(){if(void 0!==mt)return mt;if(!_t())return mt=!1,!1;const e=new OffscreenCanvas(85,1),t=e.getContext("2d",{willReadFrequently:!0});let i=0;for(let n=0;n<e.width;++n)t.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,t.fillRect(n,0,1,1);const r=t.getImageData(0,0,e.width,e.height);i=0;for(let n=0;n<r.data.length;++n)if(n%4!=3&&i++!==r.data[n])return mt=!0,!0;return mt=!1,!1}};function yt(e,t){const i=e.indexOf("?");if(i<0)return`${e}?${new URLSearchParams(t).toString()}`;
2const r=new URLSearchParams(e.slice(i));for(const n in t)r.set(n,t[n]);return`${e.slice(0,i)}?${r.toString()}`}function xt(e,t={persistentParams:[]}){const i=e.indexOf("?");if(i<0)return e;const r=new URLSearchParams,n=new URLSearchParams(e.slice(i));for(const s of t.persistentParams){const e=n.get(s);e&&r.set(s,e)}const o=r.toString();return`${e.slice(0,i)}${o.length>0?`?${o}`:""}`}const vt="mapbox-tiles";let bt=500,wt=50;const Tt=["language","worldview","jobid"];let St,Et;function It(){try{return caches}catch(e){}}function At(){const e=It();e&&null==St&&(St=e.open(vt))}let Mt=1/0;const Ct={supported:!1,testSupport:function(e){!zt&&Rt&&(Lt?Ot(e):Pt=e)}};let Pt,Rt,zt=!1,Lt=!1;const Dt="undefined"!=typeof self?self:{};function Ot(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,Rt),e.isContextLost())return;Ct.supported=!0}catch(e){}e.deleteTexture(t),zt=!0}Dt.document&&(Rt=Dt.document.createElement("img"),Rt.onload=function(){Pt&&Ot(Pt),Pt=null,Lt=!0},Rt.onerror=function(){zt=!0,Pt=null},Rt.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Ft={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};"function"==typeof Object.freeze&&Object.freeze(Ft);class kt extends Error{constructor(e,t,i){401===t&<(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 Bt=Je()?()=>self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href,Nt=function(e,t){if(!(/^file:/.test(i=e.url)||/^file:/.test(Bt())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(e,t){const i=new AbortController,r=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:Bt(),referrerPolicy:e.referrerPolicy,signal:i.signal});let n=!1,o=!1;const s=(a=r.url).indexOf("sku=")>0&<(a);var a;"json"===e.type&&r.headers.set("Accept","application/json");const l=(i,n,a)=>{if(o)return;if(i&&"SecurityError"!==i.message&&We(i.toString()),n&&a)return c(n);const l=Date.now();fetch(r).then(i=>{if(i.ok){const e=s?i.clone():null;return c(i,e,l)}return t(new kt(i.statusText,i.status,e.url))}).catch(i=>{"AbortError"!==i.name&&t(new Error(`${i.message} ${e.url}`))})},c=(i,s,a)=>{("arrayBuffer"===e.type?i.arrayBuffer():"json"===e.type?i.json():i.text()).then(e=>{o||(s&&a&&function(e,t,i){if(At(),null==St)return;const r=Qe(t.headers.get("Cache-Control")||"");if(r["no-store"])return;const n={status:t.status,statusText:t.statusText,headers:new Headers};t.headers.forEach((e,t)=>n.headers.set(t,e)),r["max-age"]&&n.headers.set("Expires",new Date(i+1e3*r["max-age"]).toUTCString());const o=n.headers.get("Expires");if(!o)return;if(new Date(o).getTime()-i<42e4)return;
2let s=xt(e.url,{persistentParams:Tt});if(206===t.status){const t=e.headers.get("Range");if(!t)return;n.status=200,s=yt(s,{range:t})}!function(e,t){if(void 0===Et)try{new Response(new ReadableStream),Et=!0}catch(e){Et=!1}Et?t(e.body):e.blob().then(t).catch(e=>We(e.message))}(t,e=>{const i=new Response(200!==(r=t.status)&&404!==r&&[101,103,204,205,304].includes(r)?null:e,n);var r;At(),null!=St&&St.then(e=>e.put(s,i)).catch(e=>We(e.message))})}(r,s,a),n=!0,t(null,e,i.headers))}).catch(e=>{o||t(new Error(e.message))})};return s?function(e,t){if(At(),null==St)return t(null);St.then(i=>{let r=xt(e.url,{persistentParams:Tt});const n=e.headers.get("Range");n&&(r=yt(r,{range:n})),i.match(r).then(e=>{const n=function(e){if(!e)return!1;const t=new Date(e.headers.get("Expires")||0),i=Qe(e.headers.get("Cache-Control")||"");return Number(t)>Date.now()&&!i["no-cache"]}(e);i.delete(r).catch(t),n&&i.put(r,e.clone()).catch(t),t(null,e,n)}).catch(t)}).catch(t)}(r,l):l(null,null),{cancel:()=>{o=!0,n||i.abort()}}}(e,t);if(Je(self)&&self.worker.actor)return self.worker.actor.send("getResource",e,t,void 0,!0)}var i;return function(e,t){const i=new XMLHttpRequest;i.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(i.responseType="arraybuffer");for(const r in e.headers)i.setRequestHeader(r,e.headers[r]);return"json"===e.type&&(i.responseType="text",i.setRequestHeader("Accept","application/json")),i.withCredentials="include"===e.credentials,i.onerror=()=>{t(new Error(i.statusText))},i.onload=()=>{if((i.status>=200&&i.status<300||0===i.status)&&null!==i.response){let r=i.response;if("json"===e.type)try{r=JSON.parse(i.response)}catch(e){return t(e)}const n=new Headers;i.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(e=>{const t=e.split(": "),i=t.shift(),r=t.join(": ");n.append(i,r)}),t(null,r,n)}else t(new kt(i.statusText,i.status,e.url))},i.send(e.body),{cancel:()=>i.abort()}}(e,t)},Vt=function(e,t){return Nt(Object.assign(e,{type:"arrayBuffer"}),t)};function Ut(e){const t=document.createElement("a");return t.href=e,t.protocol===location.protocol&&t.host===location.host}const jt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Gt,qt;Gt=[],qt=0;const Ht=function(e,t){if(Ct.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),qt>=at.MAX_PARALLEL_IMAGE_REQUESTS){const i={requestParameters:e,callback:t,cancelled:!1,cancel(){this.cancelled=!0}};return Gt.push(i),i}qt++;let i=!1;const r=()=>{if(!i)for(i=!0,qt--;Gt.length&&qt<at.MAX_PARALLEL_IMAGE_REQUESTS;){const e=Gt.shift(),{requestParameters:t,callback:i,cancelled:r}=e;r||(e.cancel=Ht(t,i).cancel)}},n=Vt(e,(e,i,n)=>{r(),e?t(e):i&&(self.createImageBitmap?function(e,t){const i=new Blob([new Uint8Array(e)],{type:"image/png"});createImageBitmap(i).then(e=>{t(null,e)}).catch(e=>{t(new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(i,(e,i)=>t(e,i,n)):function(e,t){const i=new Image;i.onload=()=>{t(null,i),URL.revokeObjectURL(i.src),i.onload=null,requestAnimationFrame(()=>{i.src=jt})},i.onerror=()=>t(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const r=new Blob([new Uint8Array(e)],{type:"image/png"});i.src=e.byteLength?URL.createObjectURL(r):jt}(i,(e,i)=>t(e,i,n)))});return{cancel:()=>{n.cancel(),r()}}};var $t,Zt,Wt,Xt={exports:{}},Yt={exports:{}},Kt={exports:{}},Jt=function(){if(Wt)return Xt.exports;Wt=1;
2var e=($t||($t=1,Yt.exports=function(e,t){var i,r,n,o,s,a,l,c;for(r=e.length-(i=3&e.length),n=t,s=3432918353,a=461845907,c=0;c<r;)l=255&e.charCodeAt(c)|(255&e.charCodeAt(++c))<<8|(255&e.charCodeAt(++c))<<16|(255&e.charCodeAt(++c))<<24,++c,n=27492+(65535&(o=5*(65535&(n=(n^=l=(65535&(l=(l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+(((o>>>16)+58964&65535)<<16);switch(l=0,i){case 3:l^=(255&e.charCodeAt(c+2))<<16;case 2:l^=(255&e.charCodeAt(c+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(c)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return n^=e.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0}),Yt.exports),t=(Zt||(Zt=1,Kt.exports=function(e,t){for(var i,r=e.length,n=t^r,o=0;r>=4;)i=1540483477*(65535&(i=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(i>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),r-=4,++o;switch(r){case 3:n^=(255&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}),Kt.exports);return Xt.exports=e,Xt.exports.murmur3=e,Xt.exports.murmur2=t,Xt.exports}(),Qt=we(Jt);class ei{constructor(e,...t){Object.assign(this,t[0]||{}),this.type=e}}class ti extends ei{constructor(e,t={}){super("error",Object.assign({error:e},t))}}function ii(e,t,i){i[e]&&-1!==i[e].indexOf(t)||(i[e]=i[e]||[],i[e].push(t))}function ri(e,t,i){if(i&&i[e]){const r=i[e].indexOf(t);-1!==r&&i[e].splice(r,1)}}class ni{on(e,t){return this._listeners=this._listeners||{},ii(e,t,this._listeners),this}off(e,t){return ri(e,t,this._listeners),ri(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},ii(e,t,this._oneTimeListeners),this):new Promise(t=>{this.once(e,t)})}fire(e,t){const i="string"==typeof e?new ei(e,t):e,r=i.type;if(this.listens(r)){i.target=this;const e=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(const r of e)r.call(this,i);const t=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const o of t)ri(r,o,this._oneTimeListeners),o.call(this,i);const n=this._eventedParent;if(n){const e="function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData;Object.assign(i,e),n.fire(i)}}else i instanceof ti&&console.error(i.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}class oi{constructor(e){"string"==typeof e?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new oi(e)}static toString(e){return e.iconsetId?`${e.name}\x1f${e.iconsetId}`:e.name}static parse(e){const[t,i]=e.split("\x1f");return new oi({name:t,iconsetId:i})}static isEqual(e,t){return e.name===t.name&&e.iconsetId===t.iconsetId}toString(){return oi.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var si,ai={},li=function(){if(si)return ai;si=1;var e={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 t(e){return(e=Math.round(e))<0?0:e>255?255:e}function i(e){return t("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function r(e){return(t="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:t>1?1:t;var t}function n(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{ai.parseCSSColor=function(o){var s,a=o.replace(/ /g,"").toLowerCase();if(a in e)return e[a].slice();if("#"===a[0])return 4===a.length?(s=parseInt(a.substr(1),16))>=0&&s<=4095?[(3840&s)>>4|(3840&s)>>8,240&s|(240&s)>>4,15&s|(15&s)<<4,1]:null:7===a.length&&(s=parseInt(a.substr(1),16))>=0&&s<=16777215?[(16711680&s)>>16,(65280&s)>>8,255&s,1]:null;var l=a.indexOf("("),c=a.indexOf(")");if(-1!==l&&c+1===a.length){var h=a.substr(0,l),u=a.substr(l+1,c-(l+1)).split(","),d=1;switch(h){case"rgba":if(4!==u.length)return null;d=r(u.pop());case"rgb":return 3!==u.length?null:[i(u[0]),i(u[1]),i(u[2]),d];case"hsla":if(4!==u.length)return null;d=r(u.pop());case"hsl":if(3!==u.length)return null;var p=(parseFloat(u[0])%360+360)%360/360,f=r(u[1]),m=r(u[2]),_=m<=.5?m*(f+1):m+f-m*f,g=2*m-_;return[t(255*n(g,_,p+1/3)),t(255*n(g,_,p)),t(255*n(g,_,p-1/3)),d];default:return null}}return null}}catch(e){}return ai}();class ci{constructor(e,t,i,r=1){this.r=e,this.g=t,this.b=i,this.a=r}static parse(e){if(!e)return;if(e instanceof ci)return e;if("string"!=typeof e)return;const t=li.parseCSSColor(e);return t?new ci(t[0]/255,t[1]/255,t[2]/255,t[3]):void 0}toString(){const[e,t,i,r]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*e)},${Math.round(255*t)},${Math.round(255*i)},${r})`}toNonPremultipliedRenderColor(e){const{r:t,g:i,b:r,a:n}=this;return new ui(e,t,i,r,n)}toPremultipliedRenderColor(e){const{r:t,g:i,b:r,a:n}=this;return new di(e,t*n,i*n,r*n,n)}clone(){return new ci(this.r,this.g,this.b,this.a)}}class hi{constructor(e,t,i,r,n,o=!1){if(this.premultiplied=!1,this.premultiplied=o,e){const o=e.image.height,s=o*o;this.premultiplied?(t=0===n?0:t/n*(o-1),i=0===n?0:i/n*(o-1),r=0===n?0:r/n*(o-1)):(t*=o-1,i*=o-1,r*=o-1),t=Math.max(0,Math.min(o-1,t)),i=Math.max(0,Math.min(o-1,i)),r=Math.max(0,Math.min(o-1,r));const a=Math.floor(t),l=Math.floor(i),c=Math.floor(r),h=Math.ceil(t),u=Math.ceil(i),d=Math.ceil(r),p=t-a,f=i-l,m=r-c,_=e.image.data,g=4*(a+l*s+c*o),y=4*(a+l*s+d*o),x=4*(a+u*s+c*o),v=4*(a+u*s+d*o),b=4*(h+l*s+c*o),w=4*(h+l*s+d*o),T=4*(h+u*s+c*o),S=4*(h+u*s+d*o);this.r=pi(pi(pi(_[g],_[y],m),pi(_[x],_[v],m),f),pi(pi(_[b],_[w],m),pi(_[T],_[S],m),f),p)/255*(this.premultiplied?n:1),this.g=pi(pi(pi(_[g+1],_[y+1],m),pi(_[x+1],_[v+1],m),f),pi(pi(_[b+1],_[w+1],m),pi(_[T+1],_[S+1],m),f),p)/255*(this.premultiplied?n:1),this.b=pi(pi(pi(_[g+2],_[y+2],m),pi(_[x+2],_[v+2],m),f),pi(pi(_[b+2],_[w+2],m),pi(_[T+2],_[S+2],m),f),p)/255*(this.premultiplied?n:1),this.a=n}else this.r=t,this.g=i,this.b=r,this.a=n}toArray(){const{r:e,g:t,b:i,a:r}=this;return[255*e,255*t,255*i,r]}toHslaArray(){let{r:e,g:t,b:i,a:r}=this;if(this.premultiplied){if(0===r)return[0,0,0,0];const n=1/r;e*=n,t*=n,i*=n}const n=Math.min(Math.max(e,0),1),o=Math.min(Math.max(t,0),1),s=Math.min(Math.max(i,0),1),a=Math.min(n,o,s),l=Math.max(n,o,s),c=l-a,h=.5*(a+l);if(0===c)return[0,0,100*h,r];const u=h>.5?c/(2-l-a):c/(l+a);let d;switch(l){case n:d=60*((o-s)/c+(o<s?6:0));break;case o:d=60*((s-n)/c+2);break;default:d=60*((n-o)/c+4)}return[d,100*u,100*h,r]}toArray01(){const{r:e,g:t,b:i,a:r}=this;return[e,t,i,r]}toArray01Scaled(e){const{r:t,g:i,b:r}=this;return[t*e,i*e,r*e]}toArray01Linear(){const{r:e,g:t,b:i,a:r}=this;return[Math.pow(e,2.2),Math.pow(t,2.2),Math.pow(i,2.2),r]}}class ui extends hi{constructor(e,t,i,r,n){super(e,t,i,r,n,!1)}}class di extends hi{constructor(e,t,i,r,n){super(e,t,i,r,n,!0)}}function pi(e,t,i){return e*(1-i)+t*i}function fi(e,t,i){return e.map((e,r)=>pi(e,t[r],i))}ci.black=new ci(0,0,0,1),ci.white=new ci(1,1,1,1),ci.transparent=new ci(0,0,0,0),ci.red=new ci(1,0,0,1),ci.blue=new ci(0,0,1,1);var mi=Object.freeze({__proto__:null,array:fi,color:function(e,t,i){return new ci(pi(e.r,t.r,i),pi(e.g,t.g,i),pi(e.b,t.b,i),pi(e.a,t.a,i))},number:pi});
vendor: 4,199 bytes, line 2
2class _i extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class gi{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[i,r]of t)this.bindings[i]=r}concat(e){return new gi(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const yi={kind:"null"},xi={kind:"number"},vi={kind:"string"},bi={kind:"boolean"},wi={kind:"color"},Ti={kind:"object"},Si={kind:"value"},Ei={kind:"collator"},Ii={kind:"formatted"},Ai={kind:"resolvedImage"};function Mi(e,t){return{kind:"array",itemType:e,N:t}}function Ci(e){if("array"===e.kind){const t=Ci(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const Pi=[yi,xi,vi,bi,wi,Ii,Ti,Mi(Si),Ai];function Ri(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!Ri(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 Pi)if(!Ri(e,t))return null}return`Expected ${Ci(e)} but found ${Ci(t)} instead.`}function zi(e,t){return t.some(t=>t.kind===e.kind)}function Li(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)}function Di(e,t){return"array"===e.kind&&"array"===t.kind?e.N===t.N&&Di(e.itemType,t.itemType):e.kind===t.kind}class Oi{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 Fi{constructor(e,t,i,r,n){this.text=e.normalize?e.normalize():e,this.image=t,this.scale=i,this.fontStack=r,this.textColor=n}}class ki{constructor(e){this.sections=e}static fromString(e){return new ki([new Fi(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||!!e.image&&e.image.hasPrimary())}static factory(e){return e instanceof ki?e:ki.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){const i=t.image.getPrimary().id.toString();e.push(["image",i]);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.toNonPremultipliedRenderColor(null).toArray())),e.push(i)}return e}}class Bi{constructor(e,t={}){this.id=oi.from(e),this.params=t.params,this.sx=t.sx||1,this.sy=t.sy||1}toString(){return JSON.stringify(this)}static parse(e){let t,i,r,n;try{({id:t,params:i,sx:r,sy:n}=JSON.parse(e)||{})}catch(e){return null}return t?new Bi(t,{params:i,sx:r,sy:n}):null}scaleSelf(e,t=e){return this.sx*=e,this.sy*=t,this}}class Ni{constructor(e,t,i,r,n=!1){this.primaryId=oi.from(e),this.primaryOptions=t,i&&(this.secondaryId=oi.from(i)),this.secondaryOptions=r,this.available=n}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new Bi(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new Bi(this.secondaryId,this.secondaryOptions):null}static from(e){return"string"==typeof e?Ni.build({name:e}):e}static build(e,t,i,r){return!e||"object"==typeof e&&!("name"in e)?null:new Ni(e,i,t,r)}}function Vi(e,t,i,r){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ui(e){if(null===e)return!0;
vendor: 6,171 bytes, line 2
2if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof ci)return!0;if(e instanceof Oi)return!0;if(e instanceof ki)return!0;if(e instanceof Ni)return!0;if(Array.isArray(e)){for(const t of e)if(!Ui(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!Ui(e[t]))return!1;return!0}return!1}function ji(e){if(null===e)return yi;if("string"==typeof e)return vi;if("boolean"==typeof e)return bi;if("number"==typeof e)return xi;if(e instanceof ci)return wi;if(e instanceof Oi)return Ei;if(e instanceof ki)return Ii;if(e instanceof Ni)return Ai;if(Array.isArray(e)){const t=e.length;let i;for(const r of e){const e=ji(r);if(i){if(i===e)continue;i=Si;break}i=e}return Mi(i||Si,t)}return Ti}function Gi(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof ki||e instanceof Ni||e instanceof ci?e.toString():JSON.stringify(e)}class qi{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(!Ui(e[1]))return t.error("invalid value");const i=e[1];let r=ji(i);const n=t.expectedType;return"array"!==r.kind||0!==r.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(r=n),new qi(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof ci?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof ki?this.value.serialize():this.value}}class Hi{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const $i={string:vi,number:xi,boolean:bi,object:Ti};class Zi{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i,r=1;const n=e[0];if("array"===n){let n,o;if(e.length>2){const i=e[1];if("string"!=typeof i||!(i in $i)||"object"===i)return t.error('The item type argument of "array" must be one of string, number, boolean',1);n=$i[i],r++}else n=Si;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);o=e[2],r++}i=Mi(n,o)}else i=$i[n];const o=[];for(;r<e.length;r++){const i=t.parse(e[r],r,Si);if(!i)return null;o.push(i)}return new Zi(i,o)}evaluate(e){for(let t=0;t<this.args.length;t++){const i=this.args[t].evaluate(e);if(!Ri(this.type,ji(i)))return i;if(t===this.args.length-1)throw new Hi(`The expression ${JSON.stringify(this.args[t].serialize())} evaluated to ${Ci(ji(i))} but was expected to be of type ${Ci(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,t=[e.kind];if("array"===e.kind){const i=e.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){t.push(i.kind);const r=e.N;("number"==typeof r||this.args.length>1)&&t.push(r)}}return t.concat(this.args.map(e=>e.serialize()))}}class Wi{constructor(e){this.type=Ii,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[1];if(!Array.isArray(i)&&"object"==typeof i)return t.error("First argument must be an image or text section.");const r=[];let n=!1;for(let o=1;o<=e.length-1;++o){const i=e[o];if(n&&"object"==typeof i&&!Array.isArray(i)){n=!1;let e=null;if(i["font-scale"]&&(e=t.parseObjectValue(i["font-scale"],o,"font-scale",xi),!e))return null;let s=null;if(i["text-font"]&&(s=t.parseObjectValue(i["text-font"],o,"text-font",Mi(vi)),!s))return null;let a=null;if(i["text-color"]&&(a=t.parseObjectValue(i["text-color"],o,"text-color",wi),!a))return null;const l=r[r.length-1];l.scale=e,l.font=s,l.textColor=a}else{const i=t.parse(e[o],o,Si);if(!i)return null;const s=i.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:i,scale:null,font:null,textColor:null})}}return new Wi(r)}evaluate(e){return new ki(this.sections.map(t=>{const i=t.content.evaluate(e);return Di(ji(i),Ai)?new Fi("",i,null,null,null):new Fi(Gi(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 Xi{constructor(e,t,i,r){this._imageWarnHistory={},this.type=Ai,this.namePrimary=e,this.nameSecondary=t,i&&(this.paramsPrimary=i.params,this.iconsetIdPrimary=i.iconset?i.iconset.id:void 0),r&&(this.paramsSecondary=r.params,this.iconsetIdSecondary=r.iconset?r.iconset.id:void 0)}static parse(e,t){if(e.length<2)return t.error("Expected two or more arguments.");let i=1;const r=[];function n(){if(i<e.length){const n=t.parse(e[i],i++,vi);return n?(r.push({image:n,options:{}}),!0):(t.error(r.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function o(){if(i<e.length){const o=e[i];if(null===(n=o)||"object"!=typeof n||Array.isArray(n))return!0;const s=o.params,a=o.iconset,l=t.concat(i);if(!s&&!a)return i++,!0;if(s){if("object"!=typeof s||s.constructor!==Object)return l.error('Image options "params" should be an object'),!1;const e={},t=l.concat(void 0,"params");for(const i in s){if(!i)return t.error("Image parameter name should be non-empty"),!1;const r=t.concat(void 0,i).parse(s[i],void 0,wi,void 0,{typeAnnotation:"coerce"});if(!r)return!1;e[i]=r}r[r.length-1].options.params=e}if(a){if("object"!=typeof a||a.constructor!==Object)return l.error('Image options "iconset" should be an object'),!1;if(!a.id)return l.error('Image options "iconset" should have an "i
2d" property'),!1;r[r.length-1].options.iconset=a}return i++,!0}var n;return!0}for(let s=0;s<2;s++)if(!n()||!o())return;return new Xi(r[0].image,r[1]?r[1].image:void 0,r[0].options,r[1]?r[1].options:void 0)}evaluateParams(e,t){const i={};if(t){for(const r in t)if(t[r])try{i[r]=t[r].evaluate(e)}catch(e){continue}if(0!==Object.keys(i).length)return{params:i}}}evaluate(e){const t={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},i=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,r=Ni.build(t,i,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(r&&e.availableImages){const t=r.getPrimary().id;if(r.available=e.availableImages.some(e=>oi.isEqual(e,t)),r.available){const t=r.getSecondary()?r.getSecondary().id:null;t&&(r.available=e.availableImages.some(e=>oi.isEqual(e,t)))}}return r}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(const t in this.paramsPrimary)this.paramsPrimary[t]&&e(this.paramsPrimary[t]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(const t in this.paramsSecondary)this.paramsSecondary[t]&&e(this.paramsSecondary[t])}outputDefined(){return!1}serializeOptions(e,t){const i={};if(t&&(i.iconset={id:t}),e){i.params={};
vendor: 4,938 bytes, line 2
2for(const t in e)e[t]&&(i.params[t]=e[t].serialize())}return Object.keys(i).length>0?i:void 0}serialize(){const e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const t=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);t&&e.push(t)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const t=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);t&&e.push(t)}return e}}function Yi(e){return Ji(e)?"string":Qi(e)?"number":er(e)?"boolean":Array.isArray(e)?"array":null===e?"null":Ki(e)?"object":typeof e}function Ki(e){return null!=e&&!Array.isArray(e)&&"function"!=typeof e&&!(e instanceof String||e instanceof Number||e instanceof Boolean)&&"object"==typeof e}function Ji(e){return"string"==typeof e||e instanceof String}function Qi(e){return"number"==typeof e||e instanceof Number}function er(e){return"boolean"==typeof e||e instanceof Boolean}const tr={"to-boolean":bi,"to-color":wi,"to-number":xi,"to-string":vi};class ir{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[0],r=[];let n=yi;if("to-array"===i){if(!Array.isArray(e[1]))return null;const i=e[1].length;if(t.expectedType){if("array"!==t.expectedType.kind)return t.error(`Expected ${t.expectedType.kind} but found array.`);n=Mi(t.expectedType.itemType,i)}else{if(!(i>0&&Ui(e[1][0])))return null;n=Mi(ji(e[1][0]),i)}for(let o=0;o<i;o++){const i=e[1][o];let s;if(Array.isArray(i))s=t.parse(i,void 0,n.itemType);else{const e=Yi(i);if(e!==n.itemType.kind)return t.error(`Expected ${n.itemType.kind} but found ${e}.`);s=t.registry.literal.parse(["literal",void 0===i?null:i],t)}if(!s)return null;r.push(s)}}else{if(("to-boolean"===i||"to-string"===i)&&2!==e.length)return t.error("Expected one argument.");n=tr[i];for(let i=1;i<e.length;i++){const n=t.parse(e[i],i,Si);if(!n)return null;r.push(n)}}return new ir(n,r)}evaluate(e){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(e));if("color"===this.type.kind){let t,i;for(const r of this.args){if(t=r.evaluate(e),i=null,t instanceof ci)return t;if("string"==typeof t){const i=e.parseColor(t);if(i)return i}else if(Array.isArray(t)&&(i=t.length<3||t.length>4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Vi(t[0],t[1],t[2],t[3]),!i))return new ci(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Hi(i||`Could not parse color from value '${"string"==typeof t?t:String(JSON.stringify(t))}'`)}if("number"===this.type.kind){let t=null;for(const i of this.args){if(t=i.evaluate(e),null===t)return 0;const r=Number(t);if(!isNaN(r))return r}throw new Hi(`Could not convert ${JSON.stringify(t)} to number.`)}return"formatted"===this.type.kind?ki.fromString(Gi(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?Ni.build(Gi(this.args[0].evaluate(e))):"array"===this.type.kind?this.args.map(t=>t.evaluate(e)):Gi(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 Wi([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Xi(this.args[0]).serialize();const e="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild(t=>{e.push(t.serialize())}),e}}const rr=["Unknown","Point","LineString","Polygon"];class nr{constructor(e,t,i){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=t,this.iconImageUseTheme=i}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?rr[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,t=this.featureDistanceData.scale,{x:i,y:r}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(i*t-e[0])+this.featureDistanceData.bearing[1]*(r*t-e[1])}return 0}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=ci.parse(e)),t}getConfig(e){return this.options?this.options.get(e):null}}class or{constructor(e,t,i,r,n){this.name=e,this.type=t,this._evaluate=i,this.args=r,this._overloadIndex=n}evaluate(e){if(!this._evaluate){const e=or.definitions[this.name];this._evaluate=Array.isArray(e)?e[2]:e.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}
vendor: 5,269 bytes, line 2
2eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,t){const i=e[0],r=or.definitions[i];if(!r)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,s=[];let a=null,l=-1;for(const[c,h]of o){if(Array.isArray(c)&&c.length!==e.length-1)continue;s.push(c),l++,a=new En(t.registry,t.path,null,t.scope,void 0,t._scope,t.options,t.iconImageUseTheme);const r=[];let o=!1;for(let t=1;t<e.length;t++){const i=e[t],n=Array.isArray(c)?c[t-1]:c.type,s=a.parse(i,1+r.length,n);if(!s){o=!0;break}r.push(s)}if(!o)if(Array.isArray(c)&&c.length!==r.length)a.error(`Expected ${c.length} arguments, but found ${r.length} instead.`);else{for(let e=0;e<r.length;e++){const t=Array.isArray(c)?c[e]:c.type,i=r[e];a.concat(e+1).checkSubtype(t,i.type)}if(0===a.errors.length)return new or(i,n,h,r,l)}}if(1===s.length)t.errors.push(...a.errors);else{const i=(s.length?s:o.map(([e])=>e)).map(sr).join(" | "),r=[];for(let n=1;n<e.length;n++){const i=t.parse(e[n],1+r.length);if(!i)return null;r.push(Ci(i.type))}t.error(`Expected arguments of type ${i}, but found (${r.join(", ")}) instead.`)}return null}static register(e,t){or.definitions=t;for(const i in t)e[i]=or}}function sr(e){return Array.isArray(e)?`(${e.map(Ci).join(", ")})`:`(${Ci(e.type)}...)`}class ar{constructor(e,t,i){this.type=Ei,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument.");const i=e[1];if("object"!=typeof i||Array.isArray(i))return t.error("Collator options argument must be an object.");const r=void 0===i["case-sensitive"]?t.parse(!1,1,bi):t.parseObjectValue(i["case-sensitive"],1,"case-sensitive",bi);if(!r)return null;const n=void 0===i["diacritic-sensitive"]?t.parse(!1,1,bi):t.parseObjectValue(i["diacritic-sensitive"],1,"diacritic-sensitive",bi);if(!n)return null;let o=null;return i.locale&&(o=t.parseObjectValue(i.locale,1,"locale",vi),!o)?null:new ar(r,n,o)}evaluate(e){return new Oi(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){const e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}function lr(e,t,i=0,r=e.length-1,n=hr){for(;r>i;){if(r-i>600){const o=r-i+1,s=t-i+1,a=Math.log(o),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);lr(e,t,Math.max(i,Math.floor(t-s*l/o+c)),Math.min(r,Math.floor(t+(o-s)*l/o+c)),n)}const o=e[t];let s=i,a=r;for(cr(e,i,t),n(e[r],o)>0&&cr(e,i,r);s<a;){for(cr(e,s,a),s++,a--;n(e[s],o)<0;)s++;for(;n(e[a],o)>0;)a--}0===n(e[i],o)?cr(e,i,a):(a++,cr(e,a,r)),a<=t&&(i=a+1),t<=a&&(r=a-1)}}function cr(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function hr(e,t){return e<t?-1:e>t?1:0}function ur(e){let t=0;for(let i,r,n=0,o=e.length,s=o-1;n<o;s=n++)i=e[n],r=e[s],t+=(r.x-i.x)*(i.y+r.y);return t}function dr(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function pr(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function fr(e,t,i){const r=e[0]-t[0],n=e[1]-t[1],o=e[0]-i[0],s=e[1]-i[1];return r*s-o*n===0&&r*o<=0&&n*s<=0}function mr(e,t,i){return t[1]>e[1]!=i[1]>e[1]&&e[0]<(i[0]-t[0])*(e[1]-t[1])/(i[1]-t[1])+t[0]}function _r(e,t,i=!1){let r=!1;for(let n=0,o=t.length;n<o;n++){const o=t[n];for(let t=0,n=o.length,s=n-1;t<n;s=t++){const n=o[s],a=o[t];if(fr(e,n,a))return i;mr(e,n,a)&&(r=!r)}}return r}function gr(e,t,i,r){const n=r[0]-i[0],o=r[1]-i[1],s=(e[0]-i[0])*o-n*(e[1]-i[1]),a=(t[0]-i[0])*o-n*(t[1]-i[1]);return s>0&&a<0||s<0&&a>0}function yr(e,t,i,r){return 0!==(n=[r[0]-i[0],r[1]-i[1]])[0]*(o=[t[0]-e[0],t[1]-e[1]])[1]-n[1]*o[0]&&!(!gr(e,t,i,r)||!gr(i,r,e,t));var n,o}function xr(e){const t=new Ee(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new Ee(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const r of e[0])t.x>r.x&&(t.x=r.x),t.y>r.y&&(t.y=r.y),i.x<r.x&&(i.x=r.x),i.y<r.y&&(i.y=r.y);return{min:t,max:i}}const vr=8192;function br(e,t){const i=(180+e[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,n=Math.pow(2,t.z);return[Math.round(i*n*vr),Math.round(r*n*vr)]}function wr(e,t){for(let i=0;i<t.length;i++)if(_r(e,t[i]))return!0;return!1}function Tr(e,t,i){for(const r of i)for(let i=0,n=r.length,o=n-1;i<n;o=i++)if(yr(e,t,r[o],r[i]))return!0;return!1}function Sr(e,t){for(let i=0;i<e.length;++i)if(!_r(e[i],t))return!1;for(let i=0;i<e.length-1;++i)if(Tr(e[i],e[i+1],t))return!1;return!0}function Er(e,t){for(let i=0;i<t.length;i++)if(Sr(e,t[i]))return!0;return!1}function Ir(e,t,i){const r=[];for(let n=0;n<e.length;n++){const o=[];for(let r=0;r<e[n].length;r++){const s=br(e[n][r],i);dr(t,s),o.push(s)}r.push(o)}return r}function Ar(e,t,i){const r=[];for(let n=0;n<e.length;n++){const o=Ir(e[n],t,i);r.push(o)}return r}function Mr(e,t,i,r){if(e[0]<i[0]||e[0]>i[2]){const t=.5*r;let n=e[0]-i[0]>t?-r:i[0]-e[0]>
2t?r:0;0===n&&(n=e[0]-i[2]>t?-r:i[2]-e[0]>t?r:0),e[0]+=n}dr(t,e)}function Cr(e,t,i,r){const n=Math.pow(2,r.z)*vr,o=[r.x*vr,r.y*vr],s=[];if(!e)return s;for(const a of e)for(const e of a){const r=[e.x+o[0],e.y+o[1]];Mr(r,t,i,n),s.push(r)}return s}function Pr(e,t,i,r){const n=Math.pow(2,r.z)*vr,o=[r.x*vr,r.y*vr],s=[];if(!e)return s;for(const l of e){const e=[];for(const i of l){const r=[i.x+o[0],i.y+o[1]];dr(t,r),e.push(r)}s.push(e)}if(t[2]-t[0]<=n/2){(a=t)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const e of s)for(const r of e)Mr(r,t,i,n)}var a;return s}class Rr{constructor(e,t){this.type=bi,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(Ui(e[1])){const t=e[1];if("FeatureCollection"===t.type)for(let e=0;e<t.features.length;++e){const i=t.features[e].geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new Rr(t,t.features[e].geometry)}else if("Feature"===t.type){const e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new Rr(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new Rr(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===t.type){const o=Ir(t.coordinates,r,n),s=Cr(e.geometry(),i,r,n);if(!pr(i,r))return!1;for(const e of s)if(!_r(e,o))return!1}if("MultiPolygon"===t.type){const o=Ar(t.coordinates,r,n),s=Cr(e.geometry(),i,r,n);if(!pr(i,r))return!1;for(const e of s)if(!wr(e,o))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===t.type){const o=Ir(t.coordinates,r,n),s=Pr(e.geometry(),i,r,n);if(!pr(i,r))return!1;for(const e of s)if(!Sr(e,o))return!1}if("MultiPolygon"===t.type){const o=Ar(t.coordinates,r,n),s=Pr(e.geometry(),i,r,n);if(!pr(i,r))return!1;for(const e of s)if(!Er(e,o))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const zr={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},Lr=1/298.257223563,Dr=Lr*(2-Lr),Or=Math.PI/180;class Fr{static fromTile(e,t,i){const r=Math.PI*(1-2*(e+.5)/Math.pow(2,t)),n=Math.atan(.5*(Math.exp(r)-Math.exp(-r)))/Or;return new Fr(n,i)}static get units(){return zr}constructor(e,t){if(void 0===e)throw new Error("No latitude given.");if(t&&!zr[t])throw new Error(`Unknown unit ${t}. Use one of: ${Object.keys(zr).join(", ")}`);const i=6378.137*Or*(t?zr[t]:1),r=Math.cos(e*Or),n=1/(1-Dr*(1-r*r)),o=Math.sqrt(n);this.kx=i*o*r,this.ky=i*o*n*(1-Dr)}distance(e,t){const i=Nr(e[0]-t[0])*this.kx,r=(e[1]-t[1])*this.ky;return Math.sqrt(i*i+r*r)}bearing(e,t){const i=Nr(t[0]-e[0])*this.kx;return Math.atan2(i,(t[1]-e[1])*this.ky)/Or}destination(e,t,i){const r=i*Or;return this.offset(e,Math.sin(r)*t,Math.cos(r)*t)}offset(e,t,i){return[e[0]+t/this.kx,e[1]+i/this.ky]}lineDistance(e){let t=0;for(let i=0;i<e.length-1;i++)t+=this.distance(e[i],e[i+1]);return t}area(e){let t=0;for(let i=0;i<e.length;i++){const r=e[i];for(let e=0,n=r.length,o=n-1;e<n;o=e++)t+=Nr(r[e][0]-r[o][0])*(r[e][1]+r[o][1])*(i?-1:1)}return Math.abs(t)/2*this.kx*this.ky}along(e,t){let i=0;if(t<=0)return e[0];for(let r=0;r<e.length-1;r++){const n=e[r],o=e[r+1],s=this.distance(n,o);if(i+=s,i>t)return Br(n,o,(t-(i-s))/s)}return e[e.length-1]}pointToSegmentDistance(e,t,i){let[r,n]=t,o=Nr(i[0]-r)*this.kx,s=(i[1]-n)*this.ky;if(0!==o||0!==s){const t=(Nr(e[0]-r)*this.kx*o+(e[1]-n)*this.ky*s)/(o*o+s*s);t>1?(r=i[0],n=i[1]):t>0&&(r+=o/this.kx*t,n+=s/this.ky*t)}return o=Nr(e[0]-r)*this.kx,s=(e[1]-n)*this.ky,Math.sqrt(o*o+s*s)}pointOnLine(e,t){let i=1/0,r=e[0][0],n=e[0][1],o=0,s=0;for(let a=0;a<e.length-1;a++){let l=e[a][0],c=e[a][1],h=Nr(e[a+1][0]-l)*this.kx,u=(e[a+1][1]-c)*this.ky,d=0;0===h&&0===u||(d=(Nr(t[0]-l)*this.kx*h+(t[1]-c)*this.ky*u)/(h*h+u*u),d>1?(l=e[a+1][0],c=e[a+1][1]):d>0&&(l+=h/this.kx*d,c+=u/this.ky*d)),h=Nr(t[0]-l)*this.kx,u=(t[1]-c)*this.ky;const p=h*h+u*u;p<i&&(i=p,r=l,n=c,o=a,s=d)}return{point:[r,n],index:o,t:Math.max(0,Math.min(1,s))}}lineSlice(e,t,i){let r=this.pointOnLine(i,e),n=this.pointOnLine(i,t);if(r.index>n.index||r.index===n.index&&r.t>n.t){const e=r;r=n,n=e}const o=[r.point],s=r.index+1,a=n.index;!kr(i[s],o[0])&&s<=a&&o.push(i[s]);for(let l=s+1;l<=a;l++)o.push(i[l]);return kr(i[a],n.point)||o.push(n.point),o}lineSliceAlong(e,t,i){let r=0;const n=[];for(let o=0;o<i.length-1;o++){const s=i[o],a=i[o+1],l=this.distance(s,a);if(r+=l,r>e&&0===n.length&&n.push(Br(s,a,(e-(r-l))/l)),r>=t)return n.push(Br(s,a,(t-(r-l))/l)),n;r>e&&n.push(a)}return n}bufferPoint(e,t){const i=t/this.ky,r=t/this.kx;return[e[0]-r,e[1]-i,e[0]+r,e[1]+i]}bufferBBox(e,t){const i=t/this.ky,r=t/this.kx;return[e[0]-r,e[1]-i,e[2]+r,e[3]+i]}insideBBox(e,t){return Nr(e[0]-t[0])>=0&&Nr(e[0]-t[2])<=0&&e[1]>=t[1]&&e[1]<=t[3]}}function kr(e,t){return e[0]===t[0]&&e[1]===t[1]}function Br(e,t,i){const r=Nr(t[0]-e[0]);return[e[0]+r*i,e[1]+(t[1]-e[1])*i]}function Nr(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}class Vr{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,r=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(i(r,o)>=0)break;t[e]=o,e=n}t[e]=r}_down(e){const{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e<r;){let r=1+(e<<1);const o=r+1;if(o<this.length&&i(t[o],t[r])<0&&(r=o),i(t[r],n)>=0)break;t[e]=t[r],e=r}t[e]=n}}var Ur=8192;function jr(e,t){return t.dist-e.dist}function Gr(e){const t=[1/0,1/0,-1/0,-1/0];if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}function qr(e){return e[1]-e[0]+1}function Hr(e,t){const i=e[1]>=e[0]&&e[1]<t;return i||console.warn("Distance Expression: Index is out of range"),i}function $r(e,t){if(e[0]>
vendor: 4,512 bytes, line 2
2e[1])return[null,null];const i=qr(e);if(t){if(2===i)return[e,null];const t=Math.floor(i/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}{if(1===i)return[e,null];const t=Math.floor(i/2)-1;return[[e[0],e[0]+t],[e[0]+t+1,e[1]]]}}function Zr(e,t){const i=[1/0,1/0,-1/0,-1/0];if(!Hr(t,e.length))return i;for(let r=t[0];r<=t[1];++r)dr(i,e[r]);return i}function Wr(e){const t=[1/0,1/0,-1/0,-1/0];for(let i=0;i<e.length;++i)for(let r=0;r<e[i].length;++r)dr(t,e[i][r]);return t}function Xr(e,t,i){if(Gr(e)||Gr(t))return NaN;let r=0,n=0;return e[2]<t[0]&&(r=t[0]-e[2]),e[0]>t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(n=e[1]-t[3]),e[3]<t[1]&&(n=t[1]-e[3]),i.distance([0,0],[r,n])}function Yr(e){return 360*e-180}function Kr(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function Jr(e,t){const i=Math.pow(2,t.z),r=(e.y/Ur+t.y)/i;return[Yr((e.x/Ur+t.x)/i),Kr(r)]}function Qr(e,t){const i=[];for(let r=0;r<e.length;++r)i.push(Jr(e[r],t));return i}function en(e,t,i){const r=i.pointOnLine(t,e).point;return i.distance(e,r)}function tn(e,t,i,r,n){const o=i.slice(r[0],r[1]+1);let s=1/0;for(let a=t[0];a<=t[1];++a)if(0===(s=Math.min(s,en(e[a],o,n))))return 0;return s}function rn(e,t,i,r,n){const o=Math.min(n.pointToSegmentDistance(e,i,r),n.pointToSegmentDistance(t,i,r)),s=Math.min(n.pointToSegmentDistance(i,e,t),n.pointToSegmentDistance(r,e,t));return Math.min(o,s)}function nn(e,t,i,r,n){if(!Hr(t,e.length)||!Hr(r,i.length))return NaN;let o=1/0;for(let s=t[0];s<t[1];++s)for(let t=r[0];t<r[1];++t){if(yr(e[s],e[s+1],i[t],i[t+1]))return 0;o=Math.min(o,rn(e[s],e[s+1],i[t],i[t+1],n))}return o}function on(e,t,i,r,n){if(!Hr(t,e.length)||!Hr(r,i.length))return NaN;let o=1/0;for(let s=t[0];s<=t[1];++s)for(let t=r[0];t<=r[1];++t)if(0===(o=Math.min(o,n.distance(e[s],i[t]))))return o;return o}function sn(e,t,i){if(_r(e,t,!0))return 0;let r=1/0;for(const n of t){const t=n.length;if(t<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(n[0]!==n[t-1]&&0===(r=Math.min(r,i.pointToSegmentDistance(e,n[t-1],n[0]))))return r;if(0===(r=Math.min(r,en(e,n,i))))return r}return r}function an(e,t,i,r){if(!Hr(t,e.length))return NaN;for(let o=t[0];o<=t[1];++o)if(_r(e[o],i,!0))return 0;let n=1/0;for(let o=t[0];o<t[1];++o)for(const t of i)for(let i=0,s=t.length,a=s-1;i<s;a=i++){if(yr(e[o],e[o+1],t[a],t[i]))return 0;n=Math.min(n,rn(e[o],e[o+1],t[a],t[i],r))}return n}function ln(e,t){for(const i of e)for(let e=0;e<=i.length-1;++e)if(_r(i[e],t,!0))return!0;return!1}function cn(e,t,i,r=1/0){const n=Wr(e),o=Wr(t);if(r!==1/0&&Xr(n,o,i)>=r)return r;if(pr(n,o)){if(ln(e,t))return 0}else if(ln(t,e))return 0;let s=r;for(const a of e)for(let e=0,r=a.length,n=r-1;e<r;n=e++)for(const o of t)for(let t=0,r=o.length,l=r-1;t<r;l=t++){if(yr(a[n],a[e],o[l],o[t]))return 0;s=Math.min(s,rn(a[n],a[e],o[l],o[t],i))}return s}function hn(e,t,i,r,n,o,s){if(null===o||null===s)return;const a=Xr(Zr(r,o),Zr(n,s),i);a<t&&e.push({dist:a,range1:o,range2:s})}function un(e,t,i,r,n=1/0){let o=Math.min(r.distance(e[0],i[0][0]),n);if(0===o)return o;const s=new Vr([{dist:0,range1:[0,e.length-1],range2:[0,0]}],jr),a=t?50:100,l=Wr(i);for(;s.length;){const n=s.pop();if(n.dist>=o)continue;const c=n.range1;if(qr(c)<=a){if(!Hr(c,e.length))return NaN;if(t){const t=an(e,c,i,r);if(0===(o=Math.min(o,t)))return o}else for(let t=c[0];t<=c[1];++t){const n=sn(e[t],i,r);if(0===(o=Math.min(o,n)))return o}}else{const i=$r(c,t);if(null!==i[0]){const t=Xr(Zr(e,i[0]),l,r);t<o&&s.push({dist:t,range1:i[0],range2:[0,0]})}if(null!==i[1]){const t=Xr(Zr(e,i[1]),l,r);t<o&&s.push({dist:t,range1:i[1],range2:[0,0]})}}}return o}function dn(e,t,i,r,n,o=1/0){let s=Math.min(o,n.distance(e[0],i[0]));if(0===s)return s;const a=new Vr([{dist:0,range1:[0,e.length-1],range2:[0,i.length-1]}],jr),l=t?50:100,c=r?50:100;for(;a.length;){const o=a.pop();if(o.dist>=s)continue;const h=o.range1,u=o.range2;if(qr(h)<=l&&qr(u)<=c){if(!Hr(h,e.length)||!Hr(u,i.length))return NaN;if(t&&r?s=Math.min(s,nn(e,h,i,u,n)):t||r?t&&!r?s=Math.min(s,tn(i,u,e,h,n)):!t&&r&&(s=Math.min(s,tn(e,h,i,u,n))):s=Math.min(s,on(e,h,i,u,n)),0===s)return s}else{const o=$r(h,t),l=$r(u,r);hn(a,s,n,e,i,o[0],l[0]),hn(a,s,n,e,i,o[0],l[1]),hn(a,s,n,e,i,o[1],l[0]),hn(a,s,n,e,i,o[1],l[1])}}return s}function pn(e,t,i,r,n=1/0){let o=n;const s=Zr(e,[0,e.length-1]);for(const a of i)if(!(o!==1/0&&Xr(s,Zr(a,[0,a.length-1]),r)>=o)&&(o=Math.min(o,dn(e,t,a,!0,r,o)),0===o))return o;return o}function fn(e,t,i,r,n=1/0){let o=n;const s=Zr(e,[0,e.length-1]);for(const a of i){if(o!==1/0&&Xr(s,Wr(a),r)>=o)continue;
2const i=un(e,t,a,r,o);if(isNaN(i))return i;if(0===(o=Math.min(o,i)))return o}return o}function mn(e){return"Point"===e||"MultiPoint"===e||"LineString"===e||"MultiLineString"===e||"Polygon"===e||"MultiPolygon"===e}class _n{constructor(e,t){this.type=xi,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(Ui(e[1])){const t=e[1];if("FeatureCollection"===t.type){for(let e=0;e<t.features.length;++e)if(mn(t.features[e].geometry.type))return new _n(t,t.features[e].geometry)}else if("Feature"===t.type){if(mn(t.geometry.type))return new _n(t,t.geometry)}else if(mn(t.type))return new _n(t,t)}return t.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const t=e.geometry(),i=e.canonicalID();if(null!=t&&null!=i){if("Point"===e.geometryType())return function(e,t,i){const r=[];for(const o of e)for(const e of o)r.push(Jr(e,t));const n=new Fr(r[0][1],"meters");return"Point"===i.type||"MultiPoint"===i.type||"LineString"===i.type?dn(r,!1,"Point"===i.type?[i.coordinates]:i.coordinates,"LineString"===i.type,n):"MultiLineString"===i.type?pn(r,!1,i.coordinates,n):"Polygon"===i.type||"MultiPolygon"===i.type?fn(r,!1,"Polygon"===i.type?[i.coordinates]:i.coordinates,n):null}(t,i,this.geometries);if("LineString"===e.geometryType())return function(e,t,i){const r=[];for(const o of e){const e=[];for(const i of o)e.push(Jr(i,t));r.push(e)}const n=new Fr(r[0][0][1],"meters");if("Point"===i.type||"MultiPoint"===i.type||"LineString"===i.type)return pn("Point"===i.type?[i.coordinates]:i.coordinates,"LineString"===i.type,r,n);if("MultiLineString"===i.type){let e=1/0;for(let t=0;t<i.coordinates.length;t++){const o=pn(i.coordinates[t],!0,r,n,e);if(isNaN(o))return o;if(0===(e=Math.min(e,o)))return e}return e}if("Polygon"===i.type||"MultiPolygon"===i.type){let e=1/0;for(let t=0;t<r.length;t++){const o=fn(r[t],!0,"Polygon"===i.type?[i.coordinates]:i.coordinates,n,e);if(isNaN(o))return o;if(0===(e=Math.min(e,o)))return e}return e}return null}(t,i,this.geometries);if("Polygon"===e.geometryType())return function(e,t,i){const r=[];for(const o of function(e){const t=e.length;if(t<=1)return[e];const i=[];let r,n;for(let o=0;o<t;o++){const t=ur(e[o]);0!==t&&(e[o].area=Math.abs(t),void 0===n&&(n=t<0),n===t<0?(r&&i.push(r),r=[e[o]]):r.push(e[o]))}return r&&i.push(r),i}(e)){const e=[];for(let i=0;i<o.length;++i)e.push(Qr(o[i],t));r.push(e)}const n=new Fr(r[0][0][0][1],"meters");if("Point"===i.type||"MultiPoint"===i.type||"LineString"===i.type)return fn("Point"===i.type?[i.coordinates]:i.coordinates,"LineString"===i.type,r,n);if("MultiLineString"===i.type){let e=1/0;for(let t=0;t<i.coordinates.length;t++){const o=fn(i.coordinates[t],!0,r,n,e);if(isNaN(o))return o;if(0===(e=Math.min(e,o)))return e}return e}return"Polygon"===i.type||"MultiPolygon"===i.type?function(e,t,i){let r=1/0;for(const n of e)for(const e of t){const t=cn(n,e,i,r);if(isNaN(t))return t;if(0===(r=Math.min(r,t)))return r}return r}("Polygon"===i.type?[i.coordinates]:i.coordinates,r,n):null}(t,i,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function gn(e){if(e instanceof or){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof Rr)return!1;if(e instanceof _n)return!1;if(e instanceof Tn)return e.featureConstant;let t=!0;return e.eachChild(e=>{t&&!gn(e)&&(t=!1)}),t}function yn(e){if(e instanceof or&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild(e=>{t&&!yn(e)&&(t=!1)}),t}function xn(e,t){if(e instanceof or&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild(e=>{i&&!xn(e,t)&&(i=!1)}),i}
vendor: 5,829 bytes, line 2
2function vn(e,t,i){return[e,t,i].filter(Boolean).join("\x1f")}function bn(e,t){switch(e){case"string":return Gi(t);case"number":return+t;case"boolean":return!!t;case"color":return ci.parse(t);case"formatted":return ki.fromString(Gi(t));case"resolvedImage":return Ni.build(Gi(t))}return t}function wn(e,t,i,r){return void 0!==r&&(e=r*Math.round(e/r)),void 0!==t&&e<t&&(e=t),void 0!==i&&e>i&&(e=i),e}class Tn{constructor(e,t,i,r=!1){this.type=e,this.key=t,this.scope=i,this.featureConstant=r}static parse(e,t){let i=t.expectedType;if(null==i&&(i=Si),e.length<2||e.length>3)return t.error("Invalid number of arguments for 'config' expression.");const r=t.parse(e[1],1);if(!(r instanceof qi))return t.error("Key name of 'config' expression must be a string literal.");let n,o=!0;const s=Gi(r.value);if(e.length>=3){const i=t.parse(e[2],2);if(!(i instanceof qi))return t.error("Scope of 'config' expression must be a string literal.");n=Gi(i.value)}if(t.options){const e=vn(s,n,t._scope),i=t.options.get(e);i&&(o=gn(i.value||i.default))}return new Tn(i,s,n,o)}evaluate(e){const t=vn(this.key,this.scope,e.scope),i=e.getConfig(t);if(!i)return null;const{type:r,value:n,values:o,minValue:s,maxValue:a,stepValue:l}=i,c=i.default.evaluate(e);let h=c;if(n){const t=e.scope;e.scope=(t||"").split("\x1f").slice(1).join("\x1f"),h=n.evaluate(e),e.scope=t}return r&&(h=bn(r,h)),void 0===h||void 0===s&&void 0===a&&void 0===l||("number"==typeof h?h=wn(h,s,a,l):Array.isArray(h)&&(h=h.map(e=>"number"==typeof e?wn(e,s,a,l):e))),void 0!==n&&void 0!==h&&o&&!o.includes(h)&&(h=c,r&&(h=bn(r,h))),(r&&r!==this.type||void 0!==h&&!Di(ji(h),this.type))&&(h=bn(this.type.kind,h)),h}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.scope),e}}class Sn{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 Sn(i,t.scope.get(i)):t.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class En{constructor(e,t=[],i,r=new gi,n=[],o,s,a){this.registry=e,this.path=t,this.key=t.map(e=>"string"==typeof e?`['${e}']`:`[${e}]`).join(""),this.scope=r,this.errors=n,this.expectedType=i,this._scope=o,this.options=s,this.iconImageUseTheme=a}parse(e,t,i,r,n={}){return t||i?this.concat(t,null,i,r)._parse(e,n):this._parse(e,n)}parseObjectValue(e,t,i,r,n,o={}){return this.concat(t,i,r,n)._parse(e,o)}_parse(e,t){function i(e,t,i){return"assert"===i?new Zi(t,[e]):"coerce"===i?new ir(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r="string"==typeof e[0]?this.registry[e[0]]:void 0;if(r){let n=r.parse(e,this);if(!n)return null;if(this.expectedType){const e=this.expectedType,r=n.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==r.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==r.kind&&"string"!==r.kind){if(this.checkSubtype(e,r))return null}else n=i(n,e,t.typeAnnotation||"coerce");else n=i(n,e,t.typeAnnotation||"assert")}if(!(n instanceof qi)&&"resolvedImage"!==n.type.kind&&In(n)){const t=new nr(this._scope,this.options,this.iconImageUseTheme);try{n=new qi(n.type,n.evaluate(t))}catch(e){return this.error(e.message),null}}return n}return ir.parse(["to-array",e],this)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i,r){let n="number"==typeof e?this.path.concat(e):this.path;n="string"==typeof t?n.concat(t):n;const o=r?this.scope.concat(r):this.scope;return new En(this.registry,n,i||null,o,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(e,...t){const i=`${this.key}${t.map(e=>`[${e}]`).join("")}`;this.errors.push(new _i(i,e))}checkSubtype(e,t){const i=Ri(e,t);return i&&this.error(i),i}}function In(e){if(e instanceof Sn)return In(e.boundExpression);if(e instanceof or&&"error"===e.name)return!1;if(e instanceof ar)return!1;if(e instanceof Rr)return!1;if(e instanceof _n)return!1;if(e instanceof Tn)return!1;const t=e instanceof ir||e instanceof Zi;let i=!0;return e.eachChild(e=>{i=t?i&&In(e):i&&e instanceof qi}),!!i&&gn(e)&&xn(e,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function An(e,t){const i=e.length-1;let r,n,o=0,s=i,a=0;for(;o<=s;)if(a=Math.floor((o+s)/2),r=e[a],n=e[a+1],r<=t){if(a===i||t<n)return a;o=a+1}else{if(!(r>t))throw new Hi("Input is not a number.");s=a-1}return 0}class Mn{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[r,n]of i)this.labels.push(r),this.outputs.push(n)}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,xi);if(!i)return null;const r=[];let n=null;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);for(let o=1;o<e.length;o+=2){const i=1===o?-1/0:e[o],s=e[o+1],a=o,l=o+1;if("number"!=typeof i)return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not c
2omputed expressions) for the input values.',a);if(r.length&&r[r.length-1][0]>=i)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=t.parse(s,l,n);if(!c)return null;n=n||c.type,r.push([i,c])}return new Mn(n,i,r)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;return r>=t[n-1]?i[n-1].evaluate(e):i[An(t,r)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let t=0;t<this.labels.length;t++)t>0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e}}const Cn=.95047,Pn=1.08883,Rn=4/29,zn=6/29,Ln=3*zn*zn,Dn=zn*zn*zn,On=Math.PI/180,Fn=180/Math.PI;function kn(e){return e>Dn?Math.pow(e,1/3):e/Ln+Rn}function Bn(e){return e>zn?e*e*e:Ln*(e-Rn)}function Nn(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Vn(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Un(e){const t=Vn(e.r),i=Vn(e.g),r=Vn(e.b),n=kn((.4124564*t+.3575761*i+.1804375*r)/Cn),o=kn((.2126729*t+.7151522*i+.072175*r)/1);return{l:116*o-16,a:500*(n-o),b:200*(o-kn((.0193339*t+.119192*i+.9503041*r)/Pn)),alpha:e.a}}function jn(e){let t=(e.l+16)/116,i=isNaN(e.a)?t:t+e.a/500,r=isNaN(e.b)?t:t-e.b/200;return t=1*Bn(t),i=Cn*Bn(i),r=Pn*Bn(r),new ci(Nn(3.2404542*i-1.5371385*t-.4985314*r),Nn(-.969266*i+1.8760108*t+.041556*r),Nn(.0556434*i-.2040259*t+1.0572252*r),e.alpha)}function Gn(e,t,i){const r=t-e;return e+i*(r>180||r<-180?r-360*Math.round(r/360):r)}const qn={forward:Un,reverse:jn,interpolate:function(e,t,i){return{l:pi(e.l,t.l,i),a:pi(e.a,t.a,i),b:pi(e.b,t.b,i),alpha:pi(e.alpha,t.alpha,i)}}},Hn={forward:function(e){const{l:t,a:i,b:r}=Un(e),n=Math.atan2(r,i)*Fn;return{h:n<0?n+360:n,c:Math.sqrt(i*i+r*r),l:t,alpha:e.a}},reverse:function(e){const t=e.h*On,i=e.c;return jn({l:e.l,a:Math.cos(t)*i,b:Math.sin(t)*i,alpha:e.alpha})},interpolate:function(e,t,i){return{h:Gn(e.h,t.h,i),c:pi(e.c,t.c,i),l:pi(e.l,t.l,i),alpha:pi(e.alpha,t.alpha,i)}}};var $n=Object.freeze({__proto__:null,hcl:Hn,lab:qn});class Zn{constructor(e,t,i,r,n){this.type=e,this.operator=t,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(const[o,s]of n)this.labels.push(o),this.outputs.push(s)}static interpolationFactor(e,t,i,r){let n=0;if("exponential"===e.name)n=Wn(t,e.base,i,r);else if("linear"===e.name)n=Wn(t,1,i,r);else if("cubic-bezier"===e.name){const o=e.controlPoints;n=new Se(o[0],o[1],o[2],o[3]).solve(Wn(t,1,i,r))}return n}static parse(e,t){let[i,r,n,...o]=e;if(!Array.isArray(r)||0===r.length)return t.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const e=r[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:e}}else{if("cubic-bezier"!==r[0])return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const e=r.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(n=t.parse(n,2,xi),!n)return null;const s=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=wi:t.expectedType&&"value"!==t.expectedType.kind&&(a=t.expectedType);for(let l=0;l<o.length;l+=2){const e=o[l],i=o[l+1],r=l+3,n=l+4;if("number"!=typeof e)return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',r);if(s.length&&s[s.length-1][0]>=e)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const c=t.parse(i,n,a);if(!c)return null;a=a||c.type,s.push([e,c])}return"number"===a.kind||"color"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new Zn(a,i,r,n,s):t.error(`Type ${Ci(a)} is not interpolatable.`)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;if(r>=t[n-1])return i[n-1].evaluate(e);const o=An(t,r),s=Zn.interpolationFactor(this.interpolation,r,t[o],t[o+1]),a=i[o].evaluate(e),l=i[o+1].evaluate(e);return"interpolate"===this.operator?mi[this.type.kind.toLowerCase()](a,l,s):"interpolate-hcl"===this.operator?Hn.reverse(Hn.interpolate(Hn.forward(a),Hn.forward(l),s)):qn.reverse(qn.interpolate(qn.forward(a),qn.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",...this.interpolation.controlPoints];const t=[this.operator,e,this.input.serialize()];for(let i=0;i<this.labels.length;i++)t.push(this.labels[i],this.outputs[i].serialize());return t}}function Wn(e,t,i,r){const n=r-i,o=e-i;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}class Xn{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expectected at least one argument.");let i=null;const r=t.expectedType;r&&"value"!==r.kind&&(i=r);const n=[];for(const s of e.slice(1)){const e=t.parse(s,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!e)return null;i=i||e.type,n.push(e)}const o=r&&n.some(e=>Ri(r,e.type));return new Xn(o?Si:i,n)}evaluate(e){let t,i=null,r=0;for(const n of this.args){if(r++,i=n.evaluate(e),i&&i instanceof Ni&&!i.available&&(t||(t=i),i=null,r===this.args.length))return t;if(null!==i)break}return i}
vendor: 9,913 bytes, line 2
2eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(t=>{e.push(t.serialize())}),e}}class Yn{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<e.length-1;n+=2){const r=e[n];if("string"!=typeof r)return t.error(`Expected string, but found ${typeof r} instead.`,n);if(/[^a-zA-Z0-9_]/.test(r))return t.error("Variable names must contain only alphanumeric characters or '_'.",n);const o=t.parse(e[n+1],n+1);if(!o)return null;i.push([r,o])}const r=t.parse(e[e.length-1],e.length-1,t.expectedType,i);return r?new Yn(i,r):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[t,i]of this.bindings)e.push(t,i.serialize());return e.push(this.result.serialize()),e}}class Kn{constructor(e,t,i){this.type=e,this.index=t,this.input=i}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,xi),r=t.parse(e[2],2,Mi(t.expectedType||Si));return i&&r?new Kn(r.type.itemType,i,r):null}evaluate(e){const t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new Hi("Array index out of bounds: negative index");if(t>=i.length)throw new Hi("Array index out of bounds: index exceeds array size");if(t!==Math.floor(t))throw new Hi("Array index must be an integer. Use at-interpolated for fractional indices");return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Jn{constructor(e,t,i){this.type=e,this.index=t,this.input=i}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,xi),r=t.parse(e[2],2,Mi(t.expectedType||Si));return i&&r?new Jn(r.type.itemType,i,r):null}evaluate(e){const t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new Hi(`Array index out of bounds: ${t} < 0.`);if(t>i.length-1)throw new Hi(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t===Math.floor(t))return i[t];const r=Math.floor(t),n=Math.ceil(t),o=i[r],s=i[n];if("number"!=typeof o||"number"!=typeof s)throw new Hi(`Cannot interpolate between non-number values at index ${t}.`);const a=t-r;return o*(1-a)+s*a}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class Qn{constructor(e,t){this.type=bi,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,Si),r=t.parse(e[2],2,Si);return i&&r?zi(i.type,[bi,vi,xi,yi,Si])?new Qn(i,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ci(i.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(null==i)return!1;if(!Li(t,["boolean","string","number","null"]))throw new Hi(`Expected first argument to be of type boolean, string, number or null, but found ${Ci(ji(t))} instead.`);if(!Li(i,["string","array"]))throw new Hi(`Expected second argument to be of type array or string, but found ${Ci(ji(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class eo{constructor(e,t,i){this.type=xi,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,Si),r=t.parse(e[2],2,Si);if(!i||!r)return null;if(!zi(i.type,[bi,vi,xi,yi,Si]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ci(i.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,xi);return n?new eo(i,r,n):null}return new eo(i,r)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!Li(t,["boolean","string","number","null"]))throw new Hi(`Expected first argument to be of type boolean, string, number or null, but found ${Ci(ji(t))} instead.`);if(!Li(i,["string","array"]))throw new Hi(`Expected second argument to be of type array or string, but found ${Ci(ji(i))} instead.`);if(this.fromIndex){const r=this.fromIndex.evaluate(e);return i.indexOf(t,r)}return i.indexOf(t)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class to{constructor(e,t,i,r,n,o){this.inputType=e,this.type=t,this.input=i,this.cases=r,this.outputs=n,this.otherwise=o}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let i,r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const n={},o=[];for(let l=2;l<e.length-1;l+=2){let s=e[l];const a=e[l+1];Array.isArray(s)||(s=[s]);const c=t.concat(l);if(0===s.length)return c.error("Expected at least one branch label.");for(const e of s){if("number"!=typeof e&&"string"!=typeof e)return c.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,ji(e)))return null}else i=ji(e);if(void 0!==n[String(e)])return c.error("Branch labels must be unique.");n[String(e)]=o.length}const h=t.parse(a,l,r);if(!h)return null;r=r||h.type,o.push(h)}const s=t.parse(e[1],1,Si);if(!s)return null;const a=t.parse(e[e.length-1],e.length-1,r);return a?"value"!==s.type.kind&&t.concat(1).checkSubtype(i,s.type)?null:new to(i,r,s,n,o,a):null}evaluate(e){const t=this.input.evaluate(e);return(Di(ji(t),this.inputType)&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],t=Object.keys(this.cases).sort(),i=[],r={};for(const o of t){const e=r[this.cases[o]];void 0===e?(r[this.cases[o]]=i.length,i.push([this.cases[o],[o]])):i[e][1].push(o)}const n=e=>"number"===this.inputType.kind?Number(e):e;for(const[o,s]of i)e.push(1===s.length?n(s[0]):s.map(n)),e.push(this.outputs[o].serialize());return e.push(this.otherwise.serialize()),e}}class io{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let i;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);const r=[];for(let o=1;o<e.length-1;o+=2){const n=t.parse(e[o],o,bi);if(!n)return null;const s=t.parse(e[o+1],o+1,i);if(!s)return null;r.push([n,s]),i=i||s.type}const n=t.parse(e[e.length-1],e.length-1,i);return n?new io(i,r,n):null}evaluate(e){for(const[t,i]of this.branches)if(t.evaluate(e))return i.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,i]of this.branches)e(t),e(i);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(t=>{e.push(t.serialize())}),e}}class ro{constructor(e,t,i,r){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Si),r=t.parse(e[2],2,xi);if(!i||!r)return null;if(!zi(i.type,[Mi(Si),vi,Si]))return t.error(`Expected first argument to be of type array or string, but found ${Ci(i.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,xi);return n?new ro(i.type,i,r,n):null}return new ro(i.type,i,r)}evaluate(e){const t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);if(!Li(t,["string","array"]))throw new Hi(`Expected first argument to be of type array or string, but found ${Ci(ji(t))} instead.`);if(this.endIndex){const r=this.endIndex.evaluate(e);return t.slice(i,r)}return t.slice(i)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class no{constructor(e,t){this.type=Mi(vi),this.str=e,this.delimiter=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,vi),r=t.parse(e[2],2,vi);return i&&r?new no(i,r):void 0}evaluate(e){const t=this.str.evaluate(e),i=this.delimiter.evaluate(e);return t.split(i)}eachChild(e){e(this.str),e(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function oo(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 so(e,t,i,r){return 0===r.compare(t,i)}function ao(e,t,i){const r="=="!==e&&"!="!==e;
vendor: 8,529 bytes, line 2
2return class n{constructor(e,t,i){this.type=bi,this.lhs=e,this.rhs=t,this.collator=i,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const i=e[0];let o=t.parse(e[1],1,Si);if(!o)return null;if(!oo(i,o.type))return t.concat(1).error(`"${i}" comparisons are not supported for type '${Ci(o.type)}'.`);let s=t.parse(e[2],2,Si);if(!s)return null;if(!oo(i,s.type))return t.concat(2).error(`"${i}" comparisons are not supported for type '${Ci(s.type)}'.`);if(o.type.kind!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error(`Cannot compare types '${Ci(o.type)}' and '${Ci(s.type)}'.`);r&&("value"===o.type.kind&&"value"!==s.type.kind?o=new Zi(s.type,[o]):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new Zi(o.type,[s])));let a=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error("Cannot use collator to compare non-string types.");if(a=t.parse(e[3],3,Ei),!a)return null}return new n(o,s,a)}evaluate(n){const o=this.lhs.evaluate(n),s=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){const t=ji(o),i=ji(s);if(t.kind!==i.kind||"string"!==t.kind&&"number"!==t.kind)throw new Hi(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${i.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const e=ji(o),i=ji(s);if("string"!==e.kind||"string"!==i.kind)return t(n,o,s)}return this.collator?i(n,o,s,this.collator.evaluate(n)):t(n,o,s)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}serialize(){const t=[e];return this.eachChild(e=>{t.push(e.serialize())}),t}}}const lo=ao("==",function(e,t,i){return t===i},so),co=ao("!=",function(e,t,i){return t!==i},function(e,t,i,r){return!so(0,t,i,r)}),ho=ao("<",function(e,t,i){return t<i},function(e,t,i,r){return r.compare(t,i)<0}),uo=ao(">",function(e,t,i){return t>i},function(e,t,i,r){return r.compare(t,i)>0}),po=ao("<=",function(e,t,i){return t<=i},function(e,t,i,r){return r.compare(t,i)<=0}),fo=ao(">=",function(e,t,i){return t>=i},function(e,t,i,r){return r.compare(t,i)>=0});class mo{constructor(e,t,i,r,n,o){this.type=vi,this.number=e,this.locale=t,this.currency=i,this.unit=r,this.minFractionDigits=n,this.maxFractionDigits=o}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,xi);if(!i)return null;const r=e[2];if("object"!=typeof r||Array.isArray(r))return t.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=t.parseObjectValue(r.locale,2,"locale",vi),!n))return null;let o=null;if(r.currency&&(o=t.parseObjectValue(r.currency,2,"currency",vi),!o))return null;let s=null;if(r.unit&&(s=t.parseObjectValue(r.unit,2,"unit",vi),!s))return null;let a=null;if(r["min-fraction-digits"]&&(a=t.parseObjectValue(r["min-fraction-digits"],2,"min-fraction-digits",xi),!a))return null;let l=null;return r["max-fraction-digits"]&&(l=t.parseObjectValue(r["max-fraction-digits"],2,"max-fraction-digits",xi),!l)?null:new mo(i,n,o,s,a,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class _o{constructor(e){this.type=xi,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 ${Ci(i.type)} instead.`):new _o(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 Hi(`Expected value to be of type string or array, but found ${Ci(ji(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(t=>{e.push(t.serialize())}),e}}function go(e){return function(){e=1831565813+(e|=0)|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}const yo={"==":lo,"!=":co,">":uo,"<":ho,">=":fo,"<=":po,array:Zi,at:Kn,"at-interpolated":Jn,boolean:Zi,case:io,coalesce:Xn,collator:ar,format:Wi,image:Xi,in:Qn,"index-of":eo,interpolate:Zn,"interpolate-hcl":Zn,"interpolate-lab":Zn,length:_o,let:Yn,literal:qi,match:to,number:Zi,"number-format":mo,object:Zi,slice:ro,step:Mn,string:Zi,"to-boolean":ir,"to-color":ir,"to-number":ir,"to-string":ir,var:Sn,within:Rr,distance:_n,config:Tn,split:no};function xo(e,[t,i,r,n]){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);const o=n?n.evaluate(e):1,s=Vi(t,i,r,o);if(s)throw new Hi(s);return new ci(t/255,i/255,r/255,o)}function vo(e,[t,i,r,n]){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);const o=n?n.evaluate(e):1,s=function(e,t,i,r){return"number"==typeof e&&e>=0&&e<=360?"number"==typeof t&&t>=0&&t<=100&&"number"==typeof i&&i>=0&&i<=100?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid hsla value [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 'h' must be between 0 and 360.`}(t,i,r,o);if(s)throw new Hi(s);const a=`hsla(${t}, ${i}%, ${r}%, ${o})`,l=ci.parse(a);if(!l)throw new Hi(`Failed to parse HSLA color: ${a}`);return l}function bo(e,t){return e in t}function wo(e,t){const i=t[e];return void 0===i?null:i}function To(e){return{type:e}}function So(e){if(e instanceof Tn)return new Set([e.key]);let t=new Set;return e.eachChild(e=>{t=new Set([...t,...So(e)])}),t}function Eo(e){if(e instanceof or&&"is-active-floor"===e.name)return!0;let t=!1;return e.eachChild(e=>{!t&&Eo(e)&&(t=!0)}),t}function Io(e){return{result:"success",value:e}}function Ao(e){return{result:"error",value:e}}function Mo(e,t){return!!e&&!!e.parameters&&e.parameters.indexOf(t)>-1}function Co(e){return"data-driven"===e["property-type"]}function Po(e){return Mo(e.expression,"measure-light")}function Ro(e){return Mo(e.expression,"zoom")}function zo(e){return!!e.expression&&e.expression.interpolated}function Lo(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Do(e){return e}function Oo(e,t){const i="color"===t.type,r=e.stops&&"object"==typeof e.stops[0][0],n=r||!(r||void 0!==e.property),o=e.type||(zo(t)?"exponential":"interval");if(i&&((e=Object.assign({},e)).stops&&(e.stops=e.stops.map(e=>[e[0],ci.parse(e[1])])),e.default=ci.parse(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!$n[e.colorSpace])throw new Error(`Unknown color space: ${e.colorSpace}`);let s,a,l;if("exponential"===o)s=No;else if("interval"===o)s=Bo;else if("categorical"===o){s=ko,a=Object.create(null);for(const t of e.stops)a[t[0]]=t[1];l=typeof e.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);s=Vo}if(r){const i={},r=[];for(let t=0;t<e.stops.length;t++){const n=e.stops[t],o=n[0].zoom;void 0===i[o]&&(i[o]={zoom:o,type:e.type,property:e.property,default:e.default,stops:[]},r.push(o)),i[o].stops.push([n[0].value,n[1]])}const n=[];for(const e of r)n.push([i[e].zoom,Oo(i[e],t)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:Zn.interpolationFactor.bind(void 0,o),zoomStops:n.map(e=>e[0]),evaluate:({zoom:i},r)=>No({stops:n,base:e.base},t,i).evaluate(i,r)}}if(n){const i="exponential"===o?{name:"exponential",base:void 0!==e.base?e.base
vendor: 9,872 bytes, line 2
2:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:Zn.interpolationFactor.bind(void 0,i),zoomStops:e.stops.map(e=>e[0]),evaluate:({zoom:i})=>s(e,t,i,a,l)}}return{kind:"source",evaluate(i,r){const n=r&&r.properties?r.properties[e.property]:void 0;return void 0===n?Fo(e.default,t.default):s(e,t,n,a,l)}}}function Fo(e,t,i){return void 0!==e?e:void 0!==t?t:void 0!==i?i:void 0}function ko(e,t,i,r,n){return Fo(typeof i===n?r[i]:void 0,e.default,t.default)}function Bo(e,t,i){if(!Qi(i))return Fo(e.default,t.default);const r=e.stops.length;if(1===r)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];const n=An(e.stops.map(e=>e[0]),i);return e.stops[n][1]}function No(e,t,i){const r=void 0!==e.base?e.base:1;if(!Qi(i))return Fo(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=An(e.stops.map(e=>e[0]),i),s=function(e,t,i,r){const n=r-i,o=e-i;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}(i,r,e.stops[o][0],e.stops[o+1][0]),a=e.stops[o][1],l=e.stops[o+1][1];let c=mi[t.type]||Do;if(e.colorSpace&&"rgb"!==e.colorSpace){const t=$n[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 Vo(e,t,i){return"color"===t.type?i=ci.parse(i):"formatted"===t.type?i=ki.fromString(i.toString()):"resolvedImage"===t.type?i=Ni.build(i.toString()):Yi(i)===t.type||"enum"===t.type&&t.values[i]||(i=void 0),Fo(i,e.default,t.default)}or.register(yo,{error:[{kind:"error"},[vi],(e,[t])=>{throw new Hi(t.evaluate(e))}],typeof:[vi,[Si],(e,[t])=>Ci(ji(t.evaluate(e)))],"to-rgba":[Mi(xi,4),[wi],(e,[t])=>t.evaluate(e).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Mi(xi,4),[wi],(e,[t])=>t.evaluate(e).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[wi,[xi,xi,xi],xo],rgba:[wi,[xi,xi,xi,xi],xo],hsl:[wi,[xi,xi,xi],vo],hsla:[wi,[xi,xi,xi,xi],vo],has:{type:bi,overloads:[[[vi],(e,[t])=>bo(t.evaluate(e),e.properties())],[[vi,Ti],(e,[t,i])=>bo(t.evaluate(e),i.evaluate(e))]]},get:{type:Si,overloads:[[[vi],(e,[t])=>wo(t.evaluate(e),e.properties())],[[vi,Ti],(e,[t,i])=>wo(t.evaluate(e),i.evaluate(e))]]},"feature-state":[Si,[vi],(e,[t])=>wo(t.evaluate(e),e.featureState||{})],properties:[Ti,[],e=>e.properties()],"geometry-type":[vi,[],e=>e.geometryType()],worldview:[vi,[],e=>e.globals.worldview||""],"is-active-floor":[bi,To(vi),(e,t)=>{if(!(e.globals.activeFloors&&e.globals.activeFloors.size>0))return!1;const i=e.globals.activeFloors;return t.some(t=>{const r=t.evaluate(e);return i.has(r)})}],id:[Si,[],e=>e.id()],zoom:[xi,[],e=>e.globals.zoom],pitch:[xi,[],e=>e.globals.pitch||0],"distance-from-center":[xi,[],e=>e.distanceFromCenter()],"measure-light":[xi,[vi],(e,[t])=>e.measureLight(t.evaluate(e))],"heatmap-density":[xi,[],e=>e.globals.heatmapDensity||0],"line-progress":[xi,[],e=>e.globals.lineProgress||0],"raster-value":[xi,[],e=>e.globals.rasterValue||0],"raster-particle-speed":[xi,[],e=>e.globals.rasterParticleSpeed||0],"sky-radial-progress":[xi,[],e=>e.globals.skyRadialProgress||0],accumulated:[Si,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[xi,To(xi),(e,t)=>{let i=0;for(const r of t)i+=r.evaluate(e);return i}],"*":[xi,To(xi),(e,t)=>{let i=1;for(const r of t)i*=r.evaluate(e);return i}],"-":{type:xi,overloads:[[[xi,xi],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[xi],(e,[t])=>-t.evaluate(e)]]},"/":[xi,[xi,xi],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[xi,[xi,xi],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[xi,[],()=>Math.LN2],pi:[xi,[],()=>Math.PI],e:[xi,[],()=>Math.E],"^":[xi,[xi,xi],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[xi,[xi],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[xi,[xi],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[xi,[xi],(e,[t])=>Math.log(t.evaluate(e))],log2:[xi,[xi],(e,[t])=>Math.log2(t.evaluate(e))],sin:[xi,[xi],(e,[t])=>Math.sin(t.evaluate(e))],cos:[xi,[xi],(e,[t])=>Math.cos(t.evaluate(e))],tan:[xi,[xi],(e,[t])=>Math.tan(t.evaluate(e))],asin:[xi,[xi],(e,[t])=>Math.asin(t.evaluate(e))],acos:[xi,[xi],(e,[t])=>Math.acos(t.evaluate(e))],atan:[xi,[xi],(e,[t])=>Math.atan(t.evaluate(e))],min:[xi,To(xi),(e,t)=>Math.min(...t.map(t=>t.evaluate(e)))],max:[xi,To(xi),(e,t)=>Math.max(...t.map(t=>t.evaluate(e)))],abs:[xi,[xi],(e,[t])=>Math.abs(t.evaluate(e))],round:[xi,[xi],(e,[t])=>{const i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[xi,[xi],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[xi,[xi],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[bi,[vi,Si],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[bi,[Si],(e,[t])=>e.id()===t.value],"filter-type-==":[bi,[vi],(e,[t])=>e.geometryType()===t.value],"filter-<":[bi,[vi,Si],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<n}],"filter-id-<":[bi,[Si],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i<r}],"filter->":[bi,[vi,Si],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[bi,[Si],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[bi,[vi,Si],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[bi,[Si],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[bi,[vi,Si],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[bi,[Si],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[bi,[Si],(e,[t])=>t.value in e.properties()],"filter-has-id":[bi,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[bi,[Mi(vi)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[bi,[Mi(Si)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[bi,[vi,Mi(Si)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[bi,[vi,Mi(Si)],(e,[t,i])=>function(e,t,i,r){for(;i<=r;){const n=i+r>>1;if(t[n]===e)return!0;t[n]>e?r=n-1:i=n+1}return!1}(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:bi,overloads:[[[bi,bi],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[To(bi),(e,t)=>{for(const i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:bi,overloads:[[[bi,bi],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[To(bi),(e,t)=>{for(const i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[bi,[bi],(e,[t])=>!t.evaluate(e)],"is-supported-script":[bi,[vi],(e,[t])=>{const i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[vi,[vi],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[vi,[vi],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[vi,To(Si),(e,t)=>t.map(t=>Gi(t.evaluate(e))).join("")],"resolved-locale":[vi,[Ei],(e,[t])=>t.evaluate(e).resolvedLocale()],random:[xi,[xi,xi,Si],(e,t)=>{const[i,r,n]=t.map(t=>t.evaluate(e));if(i>r)return i;if(i===r)return i;let o;if("string"==typeof n)o=function(e){let t=0;if(0===e.length)return t;for(let i=0;i<e.length;i++)t=(t<<5)-t+e.charCodeAt(i),t&=t;return t}(n);else{if("number"!=typeof n)throw new Hi(`Invalid seed input: ${n}`);o=n}return i+go(o)()*(r-i)}]});class Uo{constructor(e,t,i,r,n){this.expression=e,this._warningHistory={},this._scope=i,this._options=r,this._iconImageUseTheme=n,this._evaluator=new nr(i,r,n),this._defaultValue=t?function(e){return"color"===e.type&&(Lo(e.default)||Array.isArray(e.default))?new ci(0,0,0,0):"color"===e.type?ci.parse(e.default)||null:void 0===e.default?null:e.default}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null,this.configDependencies=So(e),this.isIndoorDependent=Eo(e)}evaluateWithoutErrorHandling(e,t,i,r,n,o,s,a){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=r||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this._evaluator.featureTileCoord=s||null,this._evaluator.featureDistanceData=a||null,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,r,n,o,s,a,l){this._evaluator||(this._evaluator=new nr(this._scope,this._options,this._iconImageUseTheme)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null,this._evaluator.featureTileCoord=s||null,this._evaluator.featureDistanceData=a||null,this._evaluator.iconImageUseTheme=l||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 Hi(`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){const t=e;return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${t.message}`)),this._defaultValue}}}function jo(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in yo}function Go(e,t,i,r,n){const o=new En(yo,[],t?function(e){const t={color:wi,string:vi,number:xi,enum:vi,boolean:bi,formatted:Ii,resolvedImage:Ai};return"array"===e.type?Mi(t[e.value]||Si,e.length):t[e.type]}(t):void 0,void 0,void 0,i,r,n),s=o.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return s?Io(new Uo(s,t,i,r,n)):Ao(o.errors)}class qo{constructor(e,t,i,r){this.kind=e,this._styleExpression=t,this.isLightConstant=i,this.isLineProgressConstant=r,this.isStateDependent="constant"!==e&&!yn(t.expression),this.configDependencies=So(t.expression),this.isIndo
2orDependent=Eo(t.expression)}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o,s){return this._styleExpression.evaluate(e,t,i,r,n,o,void 0,void 0,s)}}class Ho{constructor(e,t,i,r,n,o){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent="camera"!==e&&!yn(t.expression),this.isIndoorDependent=Eo(t.expression),this.isLightConstant=n,this.isLineProgressConstant=o,this.configDependencies=So(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._styleExpression.evaluate(e,t,i,r,n,o)}interpolationFactor(e,t,i){return this.interpolationType?Zn.interpolationFactor(this.interpolationType,e,t,i):0}}function $o(e,t,i,r,n){if("error"===(e=Go(e,t,i,r,n)).result)return e;const o=e.value.expression,s=gn(o);if(!s&&!Co(t))return Ao([new _i("","data expressions not supported")]);const a=xn(o,["zoom","pitch","distance-from-center"]);if(!a&&!Ro(t))return Ao([new _i("","zoom expressions not supported")]);const l=xn(o,["measure-light"]);if(!l&&!Po(t))return Ao([new _i("","measure-light expression not supported")]);const c=xn(o,["line-progress"]);if(!c&&!function(e){return Mo(e.expression,"line-progress")}(t))return Ao([new _i("","line-progress expression not supported")]);const h=t.expression&&t.expression.relaxZoomRestriction,u=Wo(o);return u||a||h?u instanceof _i?Ao([u]):u instanceof Zn&&!zo(t)?Ao([new _i("",'"interpolate" expressions cannot be used with this property')]):Io(u?new Ho(s&&c?"camera":"composite",e.value,u.labels,u instanceof Zn?u.interpolation:void 0,l,c):new qo(s&&c?"constant":"source",e.value,l,c)):Ao([new _i("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Zo{constructor(e,t){this._parameters=e,this._specification=t,Object.assign(this,Oo(this._parameters,this._specification))}static deserialize(e){return new Zo(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Wo(e){let t=null;if(e instanceof Yn)t=Wo(e.result);else if(e instanceof Xn){for(const i of e.args)if(t=Wo(i),t)break}else(e instanceof Mn||e instanceof Zn)&&e.input instanceof or&&"zoom"===e.input.name&&(t=e);return t instanceof _i||e.eachChild(e=>{const i=Wo(e);i instanceof _i?t=i:t&&i&&t!==i&&(t=new _i("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}var Xo,Yo,Ko=function(){if(Yo)return Xo;Yo=1,Xo=t;var e=3;function t(t,i,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var o=new Int32Array(this.arrayBuffer);t=o[0],this.d=(i=o[1])+2*(r=o[2]);for(var s=0;s<this.d*this.d;s++){var a=o[e+s],l=o[e+s+1];n.push(a===l?null:o.subarray(a,l))}var c=o[e+n.length+1];this.keys=o.subarray(o[e+n.length],c),this.bboxes=o.subarray(c),this.insert=this._insertReadonly}else{this.d=i+2*r;for(var h=0;h<this.d*this.d;h++)n.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=t,this.padding=r,this.scale=i/t,this.uid=0;var u=r/i*t;this.min=-u,this.max=t+u}return t.prototype.insert=function(e,t,i,r,n){this._forEachCell(t,i,r,n,this._insertCell,this.uid++),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)},t.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},t.prototype._insertCell=function(e,t,i,r,n,o){this.cells[n].push(o)},t.prototype.query=function(e,t,i,r,n){var o=this.min,s=this.max;if(e<=o&&t<=o&&s<=i&&s<=r&&!n)return Array.prototype.slice.call(this.keys);var a=[];return this._forEachCell(e,t,i,r,this._queryCell,a,{},n),a},t.prototype._queryCell=function(e,t,i,r,n,o,s,a){var l=this.cells[n];if(null!==l)for(var c=this.keys,h=this.bboxes,u=0;u<l.length;u++){var d=l[u];if(void 0===s[d]){var p=4*d;(a?a(h[p+0],h[p+1],h[p+2],h[p+3]):e<=h[p+2]&&t<=h[p+3]&&i>=h[p+0]&&r>=h[p+1])?(s[d]=!0,o.push(c[d])):s[d]=!1}}},t.prototype._forEachCell=function(e,t,i,r,n,o,s,a){for(var l=this._convertToCellCoord(e),c=this._convertToCellCoord(t),h=this._convertToCellCoord(i),u=this._convertToCellCoord(r),d=l;d<=h;d++)for(var p=c;p<=u;p++){var f=this.d*p+d;if((!a||a(this._convertFromCellCoord(d),this._convertFromCellCoord(p),this._convertFromCellCoord(d+1),this._convertFromCellCoord(p+1)))&&n.call(this,e,t,i,r,f,o,s,a))return}},t.prototype._convertFromCellCoord=function(e){return(e-this.padding)/this.scale},t.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},t.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,i=e+this.cells.length+1+1,r=0,n=0;n<this.cells.length;n++)r+=this.cells[n].length;var o=new Int32Array(i+r+this.keys.length+this.bboxes.length);o[0]=this.extent,o[1]=this.n,o[2]=this.padding;
2for(var s=i,a=0;a<t.length;a++){var l=t[a];o[e+a]=s,o.set(l,s),s+=l.length}return o[e+t.length]=s,o.set(this.keys,s),o[e+t.length+1]=s+=this.keys.length,o.set(this.bboxes,s),s+=this.bboxes.length,o.buffer},Xo}(),Jo=we(Ko);const Qo={};function es(e,t,i={}){Object.defineProperty(e,"_classRegistryKey",{value:t,writable:!1}),Qo[t]={klass:e,omit:i.omit||[]}}es(Object,"Object"),Jo.serialize=function(e,t){const i=e.toArrayBuffer();return t&&t.add(i),{buffer:i}},Jo.deserialize=function(e){return new Jo(e.buffer)},Object.defineProperty(Jo,"name",{value:"Grid"}),es(Jo,"Grid"),delete Ee.prototype.constructor,es(ci,"Color"),es(Error,"Error"),es(ki,"Formatted"),es(Fi,"FormattedSection"),es(kt,"AJAXError"),es(Ni,"ResolvedImage"),es(Zo,"StylePropertyFunction"),es(Uo,"StyleExpression",{omit:["_evaluator"]}),es(oi,"ImageId"),es(Bi,"ImageVariant"),es(Ho,"ZoomDependentExpression"),es(qo,"ZoomConstantExpression"),es(or,"CompoundExpression",{omit:["_evaluate"]});for(const aT in yo)Qo[yo[aT]._classRegistryKey]||es(yo[aT],`Expression${aT}`);function ts(e){return e&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function is(e,t){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp)return e;if(ts(e)||e instanceof ImageBitmap)return t&&t.add(e),e;if(ArrayBuffer.isView(e))return t&&t.add(e.buffer),e;if(e instanceof ImageData)return t&&t.add(e.data.buffer),e;if(Array.isArray(e)){const i=[];for(const r of e)i.push(is(r,t));return i}if(e instanceof Map){const i={$name:"Map",entries:[]};for(const[r,n]of e.entries())i.entries.push(is(r),is(n,t));return i}if(e instanceof Set){const t={$name:"Set"};let i=0;for(const r of e.values())t[++i]=is(r);return t}if("bigint"==typeof e)return{$name:"BigInt",value:e.toString()};if("object"==typeof e){const i=e.constructor,r=i._classRegistryKey;if(!r)throw new Error(`Can't serialize object of unregistered class "${i.name}".`);const n=i.serialize?i.serialize(e,t):{};if(!i.serialize){for(const i in e)e.hasOwnProperty(i)&&(Qo[r].omit.indexOf(i)>=0||(n[i]=is(e[i],t)));e instanceof Error&&(n.message=e.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==r&&(n.$name=r),n}throw new Error("can't serialize object of type "+typeof e)}function rs(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||ts(e)||e instanceof ImageBitmap||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(rs);if("object"==typeof e){const t=e.$name||"Object";if("Map"===t){const t=e.entries||[],i=new Map;for(let e=0;e<t.length;e+=2)i.set(rs(t[e]),rs(t[e+1]));return i}if("Set"===t){const t=new Set;for(const i of Object.keys(e))"$name"!==i&&t.add(rs(e[i]));return t}if("BigInt"===t)return BigInt(e.value);const{klass:i}=Qo[t];if(!i)throw new Error(`Can't deserialize unregistered class "${t}".`);if(i.deserialize)return i.deserialize(e);const r=Object.create(i.prototype);for(const n of Object.keys(e))"$name"!==n&&(r[n]=rs(e[n]));return r}throw new Error("can't deserialize object of type "+typeof e)}const ns=e=>e>=1536&&e<=1791,os=e=>e>=1872&&e<=1919,ss=e=>e>=2208&&e<=2303,as=e=>e>=11904&&e<=12031,ls=e=>e>=12032&&e<=12255,cs=e=>e>=12272&&e<=12287,hs=e=>e>=12288&&e<=12351,us=e=>e>=12352&&e<=12447,ds=e=>e>=12448&&e<=12543,ps=e=>e>=12544&&e<=12591,fs=e=>e>=12704&&e<=12735,ms=e=>e>=12736&&e<=12783,_s=e=>e>=12784&&e<=12799,gs=e=>e>=12800&&e<=13055,ys=e=>e>=13056&&e<=13311,xs=e=>e>=13312&&e<=19903,vs=e=>e>=19968&&e<=40959,bs=e=>e>=40960&&e<=42127,ws=e=>e>=42128&&e<=42191,Ts=e=>e>=44032&&e<=55215,Ss=e=>e>=63744&&e<=64255,Es=e=>e>=64336&&e<=65023,Is=e=>e>=65040&&e<=65055,As=e=>e>=65072&&e<=65103,Ms=e=>e>=65104&&e<=65135,Cs=e=>e>=65136&&e<=65279,Ps=e=>e>=65280&&e<=65519;function Rs(e){for(const t of e)if(Os(t.charCodeAt(0)))return!0;return!1}function zs(e){for(const t of e)if(!Ls(t.charCodeAt(0)))return!1;return!0}function Ls(e){return!(ns(e)||os(e)||ss(e)||Es(e)||Cs(e))}function Ds(e){return!(e<11904||!(fs(e)||ps(e)||As(e)||Ss(e)||ys(e)||as(e)||ms(e)||hs(e)||xs(e)||vs(e)||gs(e)||Ps(e)||us(e)||cs(e)||ls(e)||_s(e)||ds(e)||Is(e)||ws(e)||bs(e)))}function Os(e){return!(746!==e&&747!==e&&(e<4352||!(fs(e)||ps(e)||As(e)&&!(e>=65097&&e<=65103)||Ss(e)||ys(e)||as(e)||ms(e)||!(!hs(e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||xs(e)||vs(e)||gs(e)||(e=>e>=12592&&e<=12687)(e)||(e=>e>=43360&&e<=43391)(e)||(e=>e>=55216&&e<=55295)(e)||(e=>e>
vendor: 7,402 bytes, line 2
2=4352&&e<=4607)(e)||Ts(e)||us(e)||cs(e)||(e=>e>=12688&&e<=12703)(e)||ls(e)||_s(e)||ds(e)&&12540!==e||!(!Ps(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)||!(!Ms(e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||(e=>e>=5120&&e<=5759)(e)||(e=>e>=6320&&e<=6399)(e)||Is(e)||(e=>e>=19904&&e<=19967)(e)||bs(e)||ws(e))))}function Fs(e){return 12312===e||12313===e||12316===e||12540===e||12448===e}function ks(e){return!(Os(e)||function(e){return!!((e=>e>=128&&e<=255)(e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||(e=>e>=8192&&e<=8303)(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)||(e=>e>=8448&&e<=8527)(e)||(e=>e>=8528&&e<=8591)(e)||(e=>e>=8960&&e<=9215)(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)||(e=>e>=9216&&e<=9279)(e)&&9251!==e||(e=>e>=9280&&e<=9311)(e)||(e=>e>=9312&&e<=9471)(e)||(e=>e>=9632&&e<=9727)(e)||(e=>e>=9728&&e<=9983)(e)&&!(e>=9754&&e<=9759)||(e=>e>=11008&&e<=11263)(e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||hs(e)||ds(e)||(e=>e>=57344&&e<=63743)(e)||As(e)||Ms(e)||Ps(e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}(e))}function Bs(e){return ns(e)||os(e)||ss(e)||Es(e)||Cs(e)}function Ns(e){return e>=1424&&e<=2303||Es(e)||Cs(e)}function Vs(e,t){return!(!t&&Ns(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||(e=>e>=6016&&e<=6143)(e))}function Us(e){for(const t of e)if(Ns(t.charCodeAt(0)))return!0;return!1}const js={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let Gs=null,qs=js.unavailable,Hs=null;const $s=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(qs=js.error),Gs&&Gs(e)};function Zs(){Ws.fire(new ei("pluginStateChange",{pluginStatus:qs,pluginURL:Hs}))}const Ws=new ni,Xs=function(){return qs},Ys=function(){if(qs!==js.deferred||!Hs)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");qs=js.loading,Zs(),Hs&&Vt({url:Hs},e=>{e?$s(e):(qs=js.loaded,Zs())})},Ks={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>qs===js.loaded||null!=Ks.applyArabicShaping,isLoading:()=>qs===js.loading,setState(e){qs=e.pluginStatus,Hs=e.pluginURL},isParsing:()=>qs===js.parsing,isParsed:()=>qs===js.parsed,getPluginURL:()=>Hs};class Js{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.transition=t.transition,this.pitch=t.pitch,this.brightness=t.brightness,this.worldview=t.worldview,this.activeFloors=t.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(e,t){for(const i of e)if(!Vs(i.charCodeAt(0),t))return!1;return!0}(e,Ks.isLoaded())}}class Qs{constructor(e,t,i,r,n){this.property=e,this.value=t,this.expression=function(e,t,i,r,n){if(Lo(e))return new Zo(e,t);if(jo(e)||Array.isArray(e)&&e.length>0){const o=$o(e,t,i,r,n);if("error"===o.result)throw new Error(o.value.map(e=>`${e.key}: ${e.message}`).join(", "));return o.value}{let i=e;return"string"==typeof e&&"color"===t.type&&(i=ci.parse(e)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>i}}}(void 0===t?e.specification.default:t,e.specification,i,r,n)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,t,i,r){return this.property.possiblyEvaluate(this,e,t,i,r)}}class ea{constructor(e,t,i,r){this.property=e,this.value=new Qs(e,void 0,t,i,r)}transitioned(e,t){return new ia(this.property,this.value,t,Object.assign({},e.transition,this.transition),e.now)}untransitioned(){return new ia(this.property,this.value,null,{},0)}}class ta{constructor(e,t,i,r){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=t,this._options=i,this._iconImageUseTheme=r,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return He(this._values[e].value.value)}setValue(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new ea(this._values[e].property,this._scope,this._options,this._iconImageUseTheme)),this._values[e].value=new Qs(this._values[e].property,null===t?void 0:He(t),this._scope,this._options,this._iconImageUseTheme),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].value.isIndoorDependent())}setTransitionOrValue(e,t){t&&(this._options=t);const i=this._properties.properties;if(e)for(const r in e){const t=e[r];if(r.endsWith("-transition")){const e=r.slice(0,-11);i[e]&&this.setTransition(e,t)}else i.hasOwnProperty(r)&&this.setValue(r,t)}}getTransition(e){return He(this._values[e].transition)}setTransition(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new ea(this._values[e].property)),this._values[e].transition=He(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const i=this.getValue(t);void 0!==i&&(e[t]=i);const r=this.getTransition(t);void 0!==r&&(e[`${t}-transition`]=r)}return e}transitioned(e,t){const i=new ra(this._properties);for(const r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(e,t._values[r]);return i}untransitioned(){const e=new ra(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}isIndoorDependent(){return this._isIndoorDependent}}class ia{constructor(e,t,i,r,n){const o=r.delay||0,s=r.duration||0;n=n||0,this.property=e,this.value=t,this.begin=n+o,this.end=this.begin+s,e.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){const r=e.now||0,n=this.value.possiblyEvaluate(e,t,i),o=this.prior;if(o){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return o.possiblyEvaluate(e,t,i);{const s=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(e,t,i),n,ze(s))}}return n}}class ra{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,i){const r=new sa(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(e,t,i);return r}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class na{constructor(e,t,i,r){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=t,this._options=i,this._iconImageUseTheme=r,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return He(this._values[e].value)}setValue(e,t){this._values[e]=new Qs(this._values[e].property,null===t?void 0:He(t),this._scope,this._options,this._iconImageUseTheme),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].isIndo
vendor: 4,401 bytes, line 2
2orDependent())}serialize(){const e={};for(const t of Object.keys(this._values)){const i=this.getValue(t);void 0!==i&&(e[t]=i)}return e}possiblyEvaluate(e,t,i,r){const n=new sa(this._properties);for(const o of Object.keys(this._values))n._values[o]=this._values[o].possiblyEvaluate(e,t,i,r);return n}isIndoorDependent(){return this._isIndoorDependent}}class oa{constructor(e,t,i,r){this.property=e,this.value=t,this.parameters=i,this.iconImageUseTheme=r}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,t,i,r){return this.property.evaluate(this.value,this.parameters,e,t,i,r,this.iconImageUseTheme)}}class sa{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class aa{constructor(e){this.specification=e}possiblyEvaluate(e,t){return e.expression.evaluate(t)}interpolate(e,t,i){const r=mi[this.specification.type];return r?r(e,t,i):e}}class la{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,i,r,n){return"constant"===e.expression.kind||"camera"===e.expression.kind?new oa(this,{kind:"constant",value:e.expression.evaluate(t,null,{},i,r,void 0,n)},t):new oa(this,e.expression,t,n)}interpolate(e,t,i){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;if(void 0===e.value.value||void 0===t.value.value)return new oa(this,{kind:"constant",value:void 0},e.parameters);const r=mi[this.specification.type];return r?new oa(this,{kind:"constant",value:r(e.value.value,t.value.value,i)},e.parameters):e}evaluate(e,t,i,r,n,o,s){return"constant"===e.kind?e.value:e.evaluate(t,i,r,n,o,void 0,s)}}class ca{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){return!!e.expression.evaluate(t,null,{},i,r)}interpolate(){return!1}}class ha{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const t=new Js(0,{});for(const i in e){const r=e[i];r.specification.overridable&&this.overridableProperties.push(i);const n=this.defaultPropertyValues[i]=new Qs(r,void 0),o=this.defaultTransitionablePropertyValues[i]=new ea(r);this.defaultTransitioningPropertyValues[i]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[i]=n.possiblyEvaluate(t)}}}es(la,"DataDrivenProperty"),es(aa,"DataConstantProperty"),es(ca,"ColorRampProperty");var ua=JSON.parse('{"$version":8,"$root":{"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}},"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","expression":{}},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}}
2,"light-3d":{"id":{"type":"string"},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"shadow-draw-before-layer":{"type":"string"}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}},"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0}
2,"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"modelNodeOverride":{"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360}},"modelNodeOverrides":{"*":{"type":"modelNodeOverride"}},"modelMaterialOverride":{"model-color":{"type":"color"},"model-color-mix-intensity":{"type":"number"},"model-opacity":{"type":"number"},"model-emissive-strength":{"type":"number"}},"modelMaterialOverrides":{"*":{"type":"modelMaterialOverride"}},"modelSourceModel":{"uri":{"type":"string"},"position":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[-180,-90],"maximum":[180,90]},"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360},"nodeOverrides":{"type":"modelNodeOverrides"},"materialOverrides":{"type":"modelMaterialOverrides"},"nodeOverrideNames":{"type":"array","value":"string"},"materialOverrideNames":{"type":"array","value":"string"},"featureProperties":{"type":"*"}},"modelSourceModels":{"*":{"type":"modelSourceModel"}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"url":{"type":"string"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"},"models":{"type":"modelSourceModels"}},"layer":{"id":{"type":"string"},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"appearances":{"type":"array","value":"appearance","supported-layer-types":["symbol"]}},"appearance":{"condition":{"type":"boolean","expression":{"interpolated":true,"parameters":["zoom","pitch","feature","feature-state","measure-light","distance-from-center"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"model-allow-density-reduction":{"type":"boolean","default":true}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{}},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","expression":{}},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-markup":1},"default":"none","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}}},"layout_building":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","minimum":1,"maximum":200,"default":3,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-unit-width":{"type":"number","minimum":1,"maximum":20,"default":3.1,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-window":{"type":"array","length":2,"value":"number","minimum":0.1,"maximum":1,"default":[0.9,0.9],"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-roof-shape":{"type":"enum","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"default":"flat","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flip-roof-orientation":{"property-type":"data-driven","type":"boolean","default":false,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","expression":{}},"line-cross-slope":{"type":"number","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","expression":{"parameters":["zoom"]}}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"appearance":true,"use-theme":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
2,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_building":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"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","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","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"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","meas
2ure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"}
2,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"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"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default
2":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function da(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function pa(e){if(Array.isArray(e))return e.map(pa);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const i in e)t[i]=pa(e[i]);return t}return da(e)}function fa(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(!fa(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}function ma(e,t="",i=null,r="fill"){if(null==e)return{filter:()=>!0,needGeometry:!1,needFeature:!1};fa(e)||(e=wa(e));const n=e;let o=!0;try{o=function(e){if(!ya(e))return e;let t=pa(e);return ga(t),t=_a(t),t}(n)}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(n,null,2)}\n `)}let s=null,a=null;if("background"!==r&&"sky"!==r&&"slot"!==r){a=ua[`filter_${r}`];const e=Go(o,a,t,i);if("error"===e.result)throw new Error(e.value.map(e=>`${e.key}: ${e.message}`).join(", "));s=(t,i,r)=>e.value.evaluate(t,i,{},r)}let l=null,c=null;if(o!==n){const e=Go(n,a,t,i);if("error"===e.result)throw new Error(e.value.map(e=>`${e.key}: ${e.message}`).join(", "));l=(t,i,r,n,o)=>e.value.evaluate(t,i,{},r,void 0,void 0,n,o),c=!gn(e.value.expression)}return{filter:s,dynamicFilter:l||void 0,needGeometry:ba(o),needFeature:!!c}}function _a(e){if(!Array.isArray(e))return e;const t=function(e){if(xa.has(e[0]))for(let t=1;t<e.length;t++)if(ya(e[t]))return!0;return e}(e);return!0===t?t:t.map(e=>_a(e))}function ga(e){let t=!1;const i=[];if("case"===e[0]){for(let r=1;r<e.length-1;r+=2)t=t||ya(e[r]),i.push(e[r+1]);i.push(e[e.length-1])}else if("match"===e[0]){t=t||ya(e[1]);for(let t=2;t<e.length-1;t+=2)i.push(e[t+1]);i.push(e[e.length-1])}else if("step"===e[0]){t=t||ya(e[1]);for(let t=1;t<e.length-1;t+=2)i.push(e[t+1])}t&&(e.length=0,e.push("any",...i));for(let r=1;r<e.length;r++)ga(e[r])}function ya(e){if(!Array.isArray(e))return!1;if("pitch"===(t=e[0])||"distance-from-center"===t)return!0;var t;for(let i=1;i<e.length;i++)if(ya(e[i]))return!0;return!1}const xa=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function va(e,t){return e<t?-1:e>t?1:0}function ba(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t<e.length;t++)if(ba(e[t]))return!0;return!1}function wa(e){if(!e)return!0;const t=e[0];return e.length<=1?"any"!==t:"=="===t?Ta(e[1],e[2],"=="):"!="===t?Ia(Ta(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?Ta(e[1],e[2],t):"any"===t?(i=e.slice(1),["any"].concat(i.map(wa))):"all"===t?["all"].concat(e.slice(1).map(wa)):"none"===t?["all"].concat(e.slice(1).map(wa).map(Ia)):"in"===t?Sa(e[1],e.slice(2)):"!in"===t?Ia(Sa(e[1],e.slice(2))):"has"===t?Ea(e[1]):"!has"!==t||Ia(Ea(e[1]));var i}function Ta(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 Sa(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(va)]]:["filter-in-small",e,["literal",t]]}}function Ea(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Ia(e){return["!",e]}const Aa="\x1f";function Ma(e,t){return t?`${e}${Aa}${t}`:e}let Ca;const Pa=()=>Ca||(Ca=new ha({"icon-size":new la(ua.layout_symbol["icon-size"]),"icon-image":new la(ua.layout_symbol["icon-image"]),"icon-rotate":new la(ua.layout_symbol["icon-rotate"]),"icon-offset":new la(ua.layout_symbol["icon-offset"]),"text-size":new la(ua.layout_symbol["text-size"]),"text-rotate":new la(ua.layout_symbol["text-rotate"]),"text-offset":new la(ua.layout_symbol["text-offset"])}));class Ra{constructor(e,t,i,r,n,o){const s=Go(e,ua.appearance.condition);if("success"===s.result&&(this.condition=s.value),this.name=t,i){this.properties=new sa(Pa()),this.unevaluatedLayout=new na(Pa(),r,n,o);for(const e in i)this.unevaluatedLayout.setValue(e,i[e])}}
2isActive(e){return!(this.condition||!e.isHidden||"hidden"!==this.name)||this.condition.evaluate(e.globals,e.feature,e.featureState,e.canonical)}getCondition(){return this.condition}getName(){return this.name}getProperty(e){return this.properties.get(e)}getUnevaluatedProperties(){return this.unevaluatedLayout}getUnevaluatedProperty(e){return this.unevaluatedLayout._values[e]}recalculate(e,t,i){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(e,void 0,t,i))}serialize(){const e={};return e.condition=this.condition.expression.serialize(),this.name&&(e.name=this.name),this.unevaluatedLayout&&(e.properties=this.unevaluatedLayout.serialize()),e}hasIconProperties(){const e=this.hasProperty("icon-image"),t=this.hasProperty("icon-size"),i=this.hasProperty("icon-offset"),r=this.hasProperty("icon-rotate");return e||t||i||r}hasTextProperties(){const e=this.hasProperty("text-size"),t=this.hasProperty("text-offset"),i=this.hasProperty("text-rotate");return e||t||i}hasProperty(e){return void 0!==this.getUnevaluatedProperty(e).value}}const za="-transition",La=new Set(["fill","line","background","hillshade","raster"]);class Da extends ni{constructor(e,t,i,r,n,o){if(super(),this.id=e.id,this.fqid=Ma(this.id,i),this.type=e.type,this.scope=i,this.lut=r,this.options=n,this.iconImageUseTheme=o,this.appearances=new Array,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},"custom"!==e.type){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&"background"!==e.type&&"sky"!==e.type&&"slot"!==e.type){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const t=Go(this.filter,ua[`filter_${e.type}`]);"error"!==t.result&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...t.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||t.value.isIndoorDependent)}if(e.slot&&(this.slot=e.slot),e.appearances&&this.setAppearances(e.appearances),t.layout&&(this._unevaluatedLayout=new na(t.layout,this.scope,n,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),t.paint){this._transitionablePaint=new ta(t.paint,this.scope,n);for(const t in e.paint)this.setPaintProperty(t,e.paint[t]);for(const t in e.layout)this.setLayoutProperty(t,e.layout[t]);this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._transitionablePaint.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._transitionablePaint.isIndoorDependent(),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new sa(t.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&La.has(this.type)}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t){if("custom"===this.type&&"visibility"===e)return void(this.visibility=t);const i=this._unevaluatedLayout;i._properties.properties[e]&&(i.setValue(e,t),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...i.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||i.isIndoorDependent(),"visibility"===e&&this.possiblyEvaluateVisibility())}setAppearances(e){this.appearances=[],e.forEach(e=>{this.appearances.push(new Ra(e.condition,e.name,e.properties,this.scope,this.options,this.iconImageUseTheme))})}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(za)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}isPaintProperty(e){return!!this._transitionablePaint._properties.properties[e]}setPaintProperty(e,t){const i=this._transitionablePaint,r=i._properties.properties;if(e.endsWith(za)){const n=e.slice(0,-11);return r[n]&&i.setTransition(n,t||void 0),!1}if(!r[e])return!1;const n=i._values[e],o=n.value.isDataDriven(),s=n.value;i.setValue(e,t),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...i.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||i.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(e);const a=i._values[e].value,l=a.isDataDriven(),c=e.endsWith("pattern")||"line-dasharray"===e;return l||o||c||this._handleOverridablePaintPropertyUpdate(e,s,a)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,t,i){return null}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}
vendor: 5,983 bytes, line 2
2isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){const e={id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return 0!==this.appearances.length&&(e.appearances=this.appearances.map(e=>e.serialize())),qe(e,(e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length))}is3D(e){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof oa&&Co(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}for(const e of this.appearances)if(!yn(e.condition.expression))return!0;return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=ma(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&("shadow"===e.renderPass?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(e,t,i){return{}}queryRadius(e){}queryIntersectsFeature(e,t,i,r,n,o,s,a,l,c){}}const Oa={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Fa{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const ka=new ArrayBuffer(0);class Ba{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(e,t){return e._trim(),t&&e.arrayBuffer&&t.add(e.arrayBuffer),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,e.arrayBuffer?t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement:(t.capacity=0,t.arrayBuffer=ka),t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this._reallocCount++,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)}}reserveForAdditional(e){this.reserve(this.length+e)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function Na(e,t=1){let i=0,r=0;return{members:e.map(e=>{const n=Oa[e.type].BYTES_PER_ELEMENT,o=i=Va(i,Math.max(t,n)),s=e.components||1;return r=Math.max(r,n),i+=n*s,{name:e.name,type:e.type,components:s,offset:o}}),size:Va(i,Math.max(r,t)),alignment:t}}function Va(e,t){return Math.ceil(e/t)*t}class Ua extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.int16[r+0]=t,this.int16[r+1]=i,e}}Ua.prototype.bytesPerElement=4,es(Ua,"StructArrayLayout2i4");class ja extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.int16[n+2]=r,e}}ja.prototype.bytesPerElement=6,es(ja,"StructArrayLayout3i6");class Ga extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=n,e}}Ga.prototype.bytesPerElement=8,es(Ga,"StructArrayLayout4i8");class qa extends Ba{_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}}qa.prototype.bytesPerElement=4,es(qa,"StructArrayLayout1f4");class Ha extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=4*e,o=2*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.float32[o+1]=r,e}}
vendor: 18,768 bytes, line 2
2Ha.prototype.bytesPerElement=8,es(Ha,"StructArrayLayout2i1f8");class $a extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=4*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.int16[n+2]=r,e}}$a.prototype.bytesPerElement=8,es($a,"StructArrayLayout3i8");class Za extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const s=5*e;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=o,e}}Za.prototype.bytesPerElement=10,es(Za,"StructArrayLayout5i10");class Wa extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o,s)}emplace(e,t,i,r,n,o,s,a){const l=6*e,c=12*e,h=3*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.uint8[c+4]=r,this.uint8[c+5]=n,this.uint8[c+6]=o,this.uint8[c+7]=s,this.float32[h+2]=a,e}}Wa.prototype.bytesPerElement=12,es(Wa,"StructArrayLayout2i4ub1f12");class Xa extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.float32[n+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,e}}Xa.prototype.bytesPerElement=12,es(Xa,"StructArrayLayout3f12");class Ya extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const s=6*e,a=3*e;return this.uint16[s+0]=t,this.uint16[s+1]=i,this.uint16[s+2]=r,this.uint16[s+3]=n,this.float32[a+2]=o,e}}Ya.prototype.bytesPerElement=12,es(Ya,"StructArrayLayout4ui1f12");class Ka extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.uint16[o+0]=t,this.uint16[o+1]=i,this.uint16[o+2]=r,this.uint16[o+3]=n,e}}Ka.prototype.bytesPerElement=8,es(Ka,"StructArrayLayout4ui8");class Ja extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=6*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,this.int16[a+4]=o,this.int16[a+5]=s,e}}Ja.prototype.bytesPerElement=12,es(Ja,"StructArrayLayout6i12");class Qa extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c,h,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,t,i,r,n,o,s,a,l,c,h,u)}emplace(e,t,i,r,n,o,s,a,l,c,h,u,d){const p=12*e;return this.int16[p+0]=t,this.int16[p+1]=i,this.int16[p+2]=r,this.int16[p+3]=n,this.uint16[p+4]=o,this.uint16[p+5]=s,this.uint16[p+6]=a,this.uint16[p+7]=l,this.int16[p+8]=c,this.int16[p+9]=h,this.int16[p+10]=u,this.int16[p+11]=d,e}}Qa.prototype.bytesPerElement=24,es(Qa,"StructArrayLayout4i4ui4i24");class el extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=10*e,l=5*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,this.float32[l+2]=n,this.float32[l+3]=o,this.float32[l+4]=s,e}}el.prototype.bytesPerElement=20,es(el,"StructArrayLayout3i3f20");class tl extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=r,this.float32[o+3]=n,e}}tl.prototype.bytesPerElement=16,es(tl,"StructArrayLayout4f16");class il extends Ba{_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}}il.prototype.bytesPerElement=4,es(il,"StructArrayLayout1ul4");class rl extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=i,e}}rl.prototype.bytesPerElement=4,es(rl,"StructArrayLayout2ui4");class nl extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c,h,u,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,i,r,n,o,s,a,l,c,h,u,d)}emplace(e,t,i,r,n,o,s,a,l,c,h,u,d,p){const f=20*e,m=10*e;return this.int16[f+0]=t,this.int16[f+1]=i,this.int16[f+2]=r,this.int16[f+3]=n,this.int16[f+4]=o,this.float32[m+3]=s,this.float32[m+4]=a,this.float32[m+5]=l,this.float32[m+6]=c,this.int16[f+14]=h,this.uint32[m+8]=u,this.uint16[f+18]=d,this.uint16[f+19]=p,e}}nl.prototype.bytesPerElement=40,es(nl,"StructArrayLayout5i4f1i1ul2ui40");class ol extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o,s)}emplace(e,t,i,r,n,o,s,a){const l=8*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.int16[l+2]=r,this.int16[l+4]=n,this.int16[l+5]=o,this.int16[l+6]=s,this.int16[l+7]=a,e}}ol.prototype.bytesPerElement=16,es(ol,"StructArrayLayout3i2i2i16");class sl extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const s=4*e,a=8*e;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=r,this.int16[a+6]=n,this.int16[a+7]=o,e}}sl.prototype.bytesPerElement=16,es(sl,"StructArrayLayout2f1f2i16");class al extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=20*e,l=5*e;return this.uint8[a+0]=t,this.uint8[a+1]=i,this.float32[l+1]=r,this.float32[l+2]=n,this.float32[l+3]=o,this.float32[l+4]=s,e}}al.prototype.bytesPerElement=20,es(al,"StructArrayLayout2ub4f20");class ll extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.uint16[n+0]=t,this.uint16[n+1]=i,this.uint16[n+2]=r,e}}ll.prototype.bytesPerElement=6,es(ll,"StructArrayLayout3ui6");class cl extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v){const b=this.length;return this.resize(b+1),this.emplace(b,e,t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v)}emplace(e,t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b){const w=30*e,T=15*e,S=60*e;return this.int16[w+0]=t,this.int16[w+1]=i,this.int16[w+2]=r,this.float32[T+2]=n,this.float32[T+3]=o,this.uint16[w+8]=s,this.uint16[w+9]=a,this.uint32[T+5]=l,this.uint32[T+6]=c,this.uint32[T+7]=h,this.uint16[w+16]=u,this.uint16[w+17]=d,this.uint16[w+18]=p,this.float32[T+10]=f,this.float32[T+11]=m,this.uint8[S+48]=_,this.uint8[S+49]=g,this.uint8[S+50]=y,this.uint32[T+13]=x,this.int16[w+28]=v,this.uint8[S+58]=b,e}}cl.prototype.bytesPerElement=60,es(cl,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class hl extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T,S,E,I,A,M,C,P,R,z){const L=this.length;return this.resize(L+1),this.emplace(L,e,t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T,S,E,I,A,M,C,P,R,z)}emplace(e,t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T,S,E,I,A,M,C,P,R,z,L){const D=20*e,O=40*e,F=80*e;return this.float32[D+0]=t,this.float32[D+1]=i,this.int16[O+4]=r,this.int16[O+5]=n,this.int16[O+6]=o,this.int16[O+7]=s,this.int16[O+8]=a,this.int16[O+9]=l,this.int16[O+10]=c,this.int16[O+11]=h,this.int16[O+12]=u,this.uint16[O+13]=d,this.uint16[O+14]=p,this.uint16[O+15]=f,this.uint16[O+16]=m,this.uint16[O+17]=_,this.uint16[O+18]=g,this.uint16[O+19]=y,this.uint16[O+20]=x,this.uint16[O+21]=v,this.uint16[O+22]=b,this.uint16[O+23]=w,this.uint16[O+24]=T,this.uint16[O+25]=S,this.uint16[O+26]=E,this.uint16[O+27]=I,this.uint32[D+14]=A,this.float32[D+15]=M,this.float32[D+16]=C,this.float32[D+17]=P,this.float32[D+18]=R,this.uint8[F+76]=z,this.uint16[O+39]=L,e}}hl.prototype.bytesPerElement=80,es(hl,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class ul extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=6*e;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=r,this.float32[a+3]=n,this.float32[a+4]=o,this.float32[a+5]=s,e}}ul.prototype.bytesPerElement=24,es(ul,"StructArrayLayout6f24");class dl extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const s=5*e;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=r,this.float32[s+3]=n,this.float32[s+4]=o,e}}dl.prototype.bytesPerElement=20,es(dl,"StructArrayLayout5f20");class pl extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o,s)}emplace(e,t,i,r,n,o,s,a){const l=7*e;return this.float32[l+0]=t,this.float32[l+1]=i,this.float32[l+2]=r,this.float32[l+3]=n,this.float32[l+4]=o,this.float32[l+5]=s,this.float32[l+6]=a,e}}pl.prototype.bytesPerElement=28,es(pl,"StructArrayLayout7f28");class fl extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c,h){const u=this.length;return this.resize(u+1),this.emplace(u,e,t,i,r,n,o,s,a,l,c,h)}emplace(e,t,i,r,n,o,s,a,l,c,h,u){const d=11*e;return this.float32[d+0]=t,this.float32[d+1]=i,this.float32[d+2]=r,this.float32[d+3]=n,this.float32[d+4]=o,this.float32[d+5]=s,this.float32[d+6]=a,this.float32[d+7]=l,this.float32[d+8]=c,this.float32[d+9]=h,this.float32[d+10]=u,e}}fl.prototype.bytesPerElement=44,es(fl,"StructArrayLayout11f44");class ml extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,i,r,n,o,s,a,l)}emplace(e,t,i,r,n,o,s,a,l,c){const h=9*e;return this.float32[h+0]=t,this.float32[h+1]=i,this.float32[h+2]=r,this.float32[h+3]=n,this.float32[h+4]=o,this.float32[h+5]=s,this.float32[h+6]=a,this.float32[h+7]=l,this.float32[h+8]=c,e}}ml.prototype.bytesPerElement=36,es(ml,"StructArrayLayout9f36");class _l extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.float32[r+0]=t,this.float32[r+1]=i,e}}_l.prototype.bytesPerElement=8,es(_l,"StructArrayLayout2f8");class gl extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=6*e;return this.uint32[3*e+0]=t,this.uint16[o+2]=i,this.uint16[o+3]=r,this.uint16[o+4]=n,e}}gl.prototype.bytesPerElement=12,es(gl,"StructArrayLayout1ul3ui12");class yl extends Ba{_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}}yl.prototype.bytesPerElement=2,es(yl,"StructArrayLayout1ui2");class xl extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c,h,u,d,p,f,m){const _=this.length;return this.resize(_+1),this.emplace(_,e,t,i,r,n,o,s,a,l,c,h,u,d,p,f,m)}emplace(e,t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_){const g=16*e;return this.float32[g+0]=t,this.float32[g+1]=i,this.float32[g+2]=r,this.float32[g+3]=n,this.float32[g+4]=o,this.float32[g+5]=s,this.float32[g+6]=a,this.float32[g+7]=l,this.float32[g+8]=c,this.float32[g+9]=h,this.float32[g+10]=u,this.float32[g+11]=d,this.float32[g+12]=p,this.float32[g+13]=f,this.float32[g+14]=m,this.float32[g+15]=_,e}}xl.prototype.bytesPerElement=64,es(xl,"StructArrayLayout16f64");class vl extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o,s)}emplace(e,t,i,r,n,o,s,a){const l=10*e,c=5*e;return this.uint16[l+0]=t,this.uint16[l+1]=i,this.uint16[l+2]=r,this.uint16[l+3]=n,this.float32[c+2]=o,this.float32[c+3]=s,this.float32[c+4]=a,e}}vl.prototype.bytesPerElement=20,es(vl,"StructArrayLayout4ui3f20");class bl extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.int16[1*e+0]=t,e}}bl.prototype.bytesPerElement=2,es(bl,"StructArrayLayout1i2");class wl extends Ba{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint8[1*e+0]=t,e}}wl.prototype.bytesPerElement=1,es(wl,"StructArrayLayout1ub1");class Tl extends Fa{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]}}Tl.prototype.size=40;class Sl extends nl{get(e){return new Tl(this,e)}}es(Sl,"CollisionBoxArray");class El extends Fa{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}}El.prototype.size=60;class Il extends cl{get(e){return new El(this,e)}}es(Il,"PlacedSymbolArray");class Al extends Fa{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}
vendor: 19,197 bytes, line 2
2get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}Al.prototype.size=80;class Ml extends hl{get(e){return new Al(this,e)}}es(Ml,"SymbolInstanceArray");class Cl extends qa{getoffsetX(e){return this.float32[1*e+0]}}es(Cl,"GlyphOffsetArray");class Pl extends Ua{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}es(Pl,"SymbolLineVertexArray");class Rl extends Fa{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]}}Rl.prototype.size=12;class zl extends gl{get(e){return new Rl(this,e)}}es(zl,"FeatureIndexArray");class Ll extends rl{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}es(Ll,"FillExtrusionCentroidArray");class Dl extends Fa{get a_join_normal_inside0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside2(){return this._structArray.int16[this._pos2+2]}}Dl.prototype.size=6;class Ol extends ja{get(e){return new Dl(this,e)}}es(Ol,"FillExtrusionWallArray");const Fl=Na([{name:"a_pos",components:2,type:"Int16"}],4),kl=Na([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),Bl=Na([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Nl{constructor(e=[]){this.segments=e}_prepareSegment(e,t,i,r){let n=this.segments[this.segments.length-1];return e>Nl.MAX_VERTEX_ARRAY_LENGTH&&We(`Max vertices per segment is ${Nl.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!n||n.vertexLength+e>Nl.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==r)&&(n={vertexOffset:t,primitiveOffset:i,vertexLength:0,primitiveLength:0},void 0!==r&&(n.sortKey=r),this.segments.push(n)),n}prepareSegment(e,t,i,r){return this._prepareSegment(e,t.length,i.length,r)}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,i,r){return new Nl([{vertexOffset:e,primitiveOffset:t,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}function Vl(e,t){return 256*(e=Oe(Math.floor(e),0,255))+Oe(Math.floor(t),0,255)}Nl.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,es(Nl,"SegmentVector");const Ul=Na([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),jl=Na([{name:"a_pattern_b",components:4,type:"Uint16"}]),Gl=Na([{name:"a_dash",components:4,type:"Uint16"}]);class ql{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,t,i,r){this.ids.push(Hl(e)),this.positions.push(t,i,r)}eachPosition(e,t){const i=Hl(e);let r=0,n=this.ids.length-1;for(;r<n;){const e=r+n>>1;this.ids[e]>=i?n=e:r=e+1}for(;this.ids[r]===i;)t(this.positions[3*r],this.positions[3*r+1],this.positions[3*r+2]),r++}static serialize(e,t){const i=new Float64Array(e.ids),r=new Uint32Array(e.positions);return $l(i,r,0,i.length-1),t&&(t.add(i.buffer),t.add(r.buffer)),{ids:i,positions:r}}static deserialize(e){const t=new ql;let i;t.ids=e.ids,t.positions=e.positions;for(const r of t.ids)r!==i&&t.uniqueIds.push(r),i=r;return t.indexed=!0,t}}function Hl(e){const t=+e;return Number.isSafeInteger(t)?t:Qt(String(e))}function $l(e,t,i,r){for(;i<r;){const n=e[i+r>>1];let o=i-1,s=r+1;for(;;){do{o++}while(e[o]<n);do{s--}while(e[s]>n);if(o>=s)break;Zl(e,o,s),Zl(t,3*o,3*s),Zl(t,3*o+1,3*s+1),Zl(t,3*o+2,3*s+2)}s-i<r-s?($l(e,t,i,s),i=s+1):($l(e,t,s+1,r),r=s)}}function Zl(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}es(ql,"FeaturePositionMap");class Wl{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,t){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,t),this.initialized=!0),!!this.location}set(e,t,i){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class Xl extends Wl{constructor(e){super(e),this.current=0}set(e,t,i){this.fetchUniformLocation(e,t)&&this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}}class Yl extends Wl{constructor(e){super(e),this.current=0}set(e,t,i){this.fetchUniformLocation(e,t)&&this.current!==i&&(this.current=i,this.gl.uniform1f(this.location,i))}}class Kl extends Wl{constructor(e){super(e),this.current=[0,0]}set(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1])))}}class Jl extends Wl{constructor(e){super(e),this.current=[0,0,0]}set(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2])))}}class Ql extends Wl{constructor(e){super(e),this.current=[0,0,0,0]}set(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]&&i[3]===this.current[3]||(this.current=i,this.gl.uniform4f(this.location,i[0],i[1],i[2],i[3])))}}class ec extends Wl{constructor(e){super(e),this.current=ci.transparent.toPremultipliedRenderColor(null)}set(e,t,i){this.fetchUniformLocation(e,t)&&(i.r===this.current.r&&i.g===this.current.g&&i.b===this.current.b&&i.a===this.current.a||(this.current=i,this.gl.uniform4f(this.location,i.r,i.g,i.b,i.a)))}}const tc=new Float32Array(16);class ic extends Wl{constructor(e){super(e),this.current=tc}set(e,t,i){if(this.fetchUniformLocation(e,t)){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}}}const rc=new Float32Array(9),nc=new Float32Array(4);class oc extends Wl{constructor(e){super(e),this.current=nc}set(e,t,i){if(this.fetchUniformLocation(e,t))for(let r=0;r<4;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix2fv(this.location,!1,i);break}}}function sc(e){return[Vl(255*e.r,255*e.g),Vl(255*e.b,255*e.a)]}function ac(e,t,i,r,n,o,s,a){return!!e&&("composite"===e.kind||"source"===e.kind?"none"===e.evaluate(new Js(0,{brightness:o,worldview:a}),t,i,n,r,s):"none"===e.value)}class lc{constructor(e,t,i,r){this.value=e,this.uniformNames=t.map(e=>`u_${e}`),this.type=i,this.context=r}setUniform(e,t,i,r,n){const o=r.constantOr(this.value);t.set(e,n,o instanceof ci?o.toPremultipliedRenderColor(this.lutExpression&&"constant"===this.lutExpression.kind&&"none"===this.lutExpression.value?null:this.context.lut):o)}getBinding(e,t){return"color"===this.type?new ec(e):new Yl(e)}}class cc{constructor(e,t){this.uniformNames=t.map(e=>`u_${e}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(e,t){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br),this.patternTransition=t?t.tl.concat(t.br):this.pattern}setUniform(e,t,i,r,n){let o=null;"u_pattern"!==n&&"u_dash"!==n||(o=this.pattern),"u_pattern_b"===n&&(o=this.patternTransition),"u_pixel_ratio"===n&&(o=this.pixelRatio),o&&t.set(e,n,o)}getBinding(e,t){return"u_pattern"===t||"u_pattern_b"===t||"u_dash"===t?new Ql(e):new Yl(e)}}class hc{constructor(e,t,i,r){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===i?2:1,offset:0})),this.paintVertexArray=new r}populatePaintArray(e,t,i,r,n,o,s,a){const l=this.paintVertexArray.length,c="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate(new Js(0,{brightness:o,worldview:a}),t,{},n,r,s):"constant"===this.expression.kind&&this.expression.value,h=ac(this.lutExpression,t,{},r,n,o,s,a);this.paintVertexArray.resize(e),this._setPaintValue(l,e,c,h?null:this.context.lut)}updatePaintArray(e,t,i,r,n,o,s,a){const l="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate({zoom:0,brightness:s,worldview:a},i,r,void 0,n):"constant"===this.expression.kind&&this.expression.value,c=ac(this.lutExpression,i,r,n,void 0,s,void 0,a);this._setPaintValue(e,t,l,c?null:this.context.lut)}_setPaintValue(e,t,i,r){if("color"===this.type){const n=sc(i.toPremultipliedRenderColor(r));for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,n[0],n[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.lutExpression&&"constant"!==this.lutExpression.kind&&(this.lutExpression.isStateDependent||!this.lutExpression.isLightConstant)||"constant"!==this.expression.kind&&(this.expression.isStateDependent||!this.expression.isLightConstant)))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class uc{constructor(e,t,i,r,n,o){this.expression=e,this.uniformNames=t.map(e=>`u_${e}_t`),this.type=i,this.useIntegerZoom=r,this.context=n,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===i?4:2,offset:0})),this.paintVertexArray=new o}populatePaintArray(e,t,i,r,n,o,s,a){const l=this.expression.evaluate(new Js(this.context.zoom,{brightness:o,worldview:a}),t,{},n,r,s),c=this.expression.evaluate(new Js(this.context.zoom+1,{brightness:o,worldview:a}),t,{},n,r,s),h=ac(this.lutExpression,t,{},r,n,o,s,a),u=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(u,e,l,c,h?null:this.context.lut)}updatePaintArray(e,t,i,r,n,o,s,a){const l=this.expression.evaluate({zoom:this.context.zoom,brightness:s,worldview:a},i,r,void 0,n),c=this.expression.evaluate({zoom:this.context.zoom+1,brightness:s,worldview:a},i,r,void 0,n),h=ac(this.lutExpression,i,r,n,void 0,s,void 0,a);this._setPaintValue(e,t,l,c,h?null:this.context.lut)}_setPaintValue(e,t,i,r,n){if("color"===this.type){const o=sc(i.toPremultipliedRenderColor(n)),s=sc(r.toPremultipliedRenderColor(n));for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,o[0],o[1],s[0],s[1])}else{for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t,i,r,n){const o=this.useIntegerZoom?Math.floor(i.zoom):i.zoom,s=Oe(this.expression.interpolationFactor(o,this.context.zoom,this.context.zoom+1),0,1);t.set(e,n,s)}getBinding(e,t){return new Yl(e)}}class dc{constructor(e,t,i,r,n){this.expression=e,this.layerId=n,this.paintVertexAttributes=("array"===i?Gl:Ul).members;for(let o=0;o<t.length;++o);this.paintVertexArray=new r,this.paintTransitionVertexArray=new Ka}populatePaintArray(e,t,i,r){const n=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(n,e,t.patterns&&t.patterns[this.layerId],i)}updatePaintArray(e,t,i,r,n,o,s){this._setPaintValues(e,t,i.patterns&&i.patterns[this.layerId],o)}_setPaintValues(e,t,i,r){if(!r||!i)return;const n=r[i[0]],o=r[i[1]];if(n){if(n){const{tl:i,br:r,pixelRatio:o}=n;for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i[0],i[1],r[0],r[1],o)}if(o){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:i,br:r}=o;for(let n=e;n<t;n++)this.paintTransitionVertexArray.emplace(n,i[0],i[1],r[0],r[1])}}}upload(e){const t=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,t)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=e.createVertexBuffer(this.paintTransitionVertexArray,jl.members,t))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class pc{constructor(e,t,i=()=>!0){this.binders={},this._buffers=[],this.context=t;const r=[];for(const n in e.paint._values){const o=e.paint.get(n);if(n.endsWith("-use-theme"))continue;if(!i(n))continue;if(!(o instanceof oa&&Co(o.property.specification)))continue;const s=_c(n,e.type),a=o.value,l=o.property.specification.type,c=!!o.property.useIntegerZoom,h="line-dasharray"===n||n.endsWith("pattern"),u=e.paint.get(`${n}-use-theme`),d="line-dasharray"===n&&"constant"!==e.layout.get("line-cap").value.kind||u&&"constant"!==u.value.kind;if("constant"!==a.kind||d)if("source"===a.kind||d||h){const t=xc(n,l,"source");this.binders[n]=h?new dc(a,s,l,t,e.id):new hc(a,s,l,t),r.push(`/a_${n}`)}else{const e=xc(n,l,"composite");this.binders[n]=new uc(a,s,l,c,t,e),r.push(`/z_${n}`)}else this.binders[n]=h?new cc(a.value,s):new lc(a.value,s,l,t),r.push(`/u_${n}`);u&&(this.binders[n].lutExpression=u.value)}this.cacheKey=r.sort().join("")}getMaxValue(e){const t=this.binders[e];return t instanceof hc||t instanceof uc?t.maxValue:0}populatePaintArrays(e,t,i,r,n,o,s,a){for(const l in this.binders){const c=this.binders[l];c.context=this.context,(c instanceof hc||c instanceof uc||c instanceof dc)&&c.populatePaintArray(e,t,i,r,n,o,s,a)}}setConstantPatternPositions(e,t){for(const i in this.binders){const r=this.binders[i];r instanceof cc&&r.setConstantPatternPositions(e,t)}}getPatternTransitionVertexBuffer(e){const t=this.binders[e];return t instanceof dc?t.paintTransitionVertexBuffer:null}updatePaintArrays(e,t,i,r,n,o,s,a,l,c){let h=!1;const u=Object.keys(e),d=0!==u.length&&!a,p=d?u:t.uniqueIds;this.context.lut=n.lut;for(const f in this.binders){const a=this.binders[f];if(a.context=this.context,(a instanceof hc||a instanceof uc||a instanceof dc)&&a.expression&&a.expression.kind&&"constant"!==a.expression.kind&&(!0===a.expression.isStateDependent||!1===a.expression.isLightConstant)){const u=n.paint.get(f);a.expression=u.value;for(const i of p){const n=e[i.toString()];t.eachPosition(i,(e,t,i)=>{const h=r.feature(e);a.updatePaintArray(t,i,h,n,o,s,l,c)})}if(!d)for(const t of i.uniqueIds){const n=e[t.toString()];i.eachPosition(t,(e,t,i)=>{const h=r.feature(e);a.updatePaintArray(t,i,h,n,o,s,l,c)})}h=!0}}return h}defines(){const e=[];for(const t in this.binders){const i=this.binders[t];(i instanceof lc||i instanceof cc)&&e.push(...i.uniformNames.map(e=>`#define HAS_UNIFORM_${e}`))}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const t=[];for(const i in this.binders){const r=this.binders[i];if(r instanceof lc||r instanceof cc||r instanceof uc)for(const n of r.uniformNames)t.push({name:n,property:i,binding:r.getBinding(e,n)})}return t}setUniforms(e,t,i,r,n){for(const{name:o,property:s,binding:a}of i)this.binders[s].setUniform(e,a,n,r.get(s),o)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const t=this.binders[e];(t instanceof hc||t instanceof uc||t instanceof dc)&&t.paintVertexBuffer&&this._buffers.push(t.paintVertexBuffer),t instanceof dc&&t.paintTransitionVertexBuffer&&this._buffers.push(t.paintTransitionVertexBuffer)}}upload(e){for(const t in this.binders){const i=this.binders[t];(i instanceof hc||i instanceof uc||i instanceof dc)&&i.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const t=this.binders[e];(t instanceof hc||t instanceof uc||t instanceof dc)&&t.destroy()}}}class fc{constructor(e,t,i=()=>!0){this.programConfigurations={};for(const r of e)this.programConfigurations[r.id]=new pc(r,t,i);this.needsUpload=!1,this._featureMap=new ql,this._featureMapWithoutIds=new ql,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,t,i,r,n,o,s,a,l){for(const c in this.programConfigurations)this.programConfigurations[c].populatePaintArrays(e,t,r,n,o,s,a,l);void 0!==t.id?this._featureMap.add(t.id,i,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,i,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,r,n,o,s,a){for(const l of i)this.needsUpload=this.programConfigurations[l.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,t,l,r,n,o,s||0,a)||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 mc={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"symbol-z-offset":["z_offset"],"line-gap-width":["ga
2pwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"],"fill-bridge-guard-rail-color":["structure_color"],"fill-tunnel-structure-color":["structure_color"]};function _c(e,t){return mc[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}const gc={"line-pattern":{source:Ya,composite:Ya},"fill-pattern":{source:Ya,composite:Ya},"fill-extrusion-pattern":{source:Ya,composite:Ya},"line-dasharray":{source:Ka,composite:Ka}},yc={color:{source:_l,composite:tl},number:{source:qa,composite:_l}};function xc(e,t,i){const r=gc[e];return r&&r[i]||yc[t][i]}es(lc,"ConstantBinder"),es(cc,"PatternConstantBinder"),es(hc,"SourceExpressionBinder"),es(dc,"PatternCompositeBinder"),es(uc,"CompositeExpressionBinder"),es(pc,"ProgramConfiguration",{omit:["_buffers"]}),es(fc,"ProgramConfigurationSet");const vc=Ur/Math.PI/2,bc=64,wc=[bc,32,16],Tc=-vc,Sc=vc;function Ec(e,t,i,r=vc){return i=Ce(i),[e*Math.sin(i)*r,-t*r,e*Math.cos(i)*r]}function Ic(e,t,i){return Ec(Math.cos(Ce(e)),Math.sin(Ce(e)),t,i)}const Ac=6371008.8,Mc=2*Math.PI*Ac;class Cc{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 Cc(ke(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,i=this.lat*t,r=e.lat*t,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return Ac*Math.acos(Math.min(n,1))}toBounds(e=0){const t=360*e/40075017,i=t/Math.cos(Math.PI/180*this.lat);return new Pc({lng:this.lng-i,lat:this.lat-t},{lng:this.lng+i,lat:this.lat+t})}toEcef(e){return Ic(this.lat,this.lng,vc+e*vc/Ac)}static convert(e){if(e instanceof Cc)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new Cc(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new Cc(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class Pc{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&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 Cc?new Cc(e.lng,e.lat):Cc.convert(e),this}setSouthWest(e){return this._sw=e instanceof Cc?new Cc(e.lng,e.lat):Cc.convert(e),this}extend(e){const t=this._sw,i=this._ne;let r,n;if(e instanceof Cc)r=e,n=e;else{if(!(e instanceof Pc))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(Pc.convert(e)):this.extend(Cc.convert(e)):"object"==typeof e&&null!==e&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(Cc.convert(e)):this;if(r=e._sw,n=e._ne,!r||!n)return this}return t||i?(t.lng=Math.min(r.lng,t.lng),t.lat=Math.min(r.lat,t.lat),i.lng=Math.max(n.lng,i.lng),i.lat=Math.max(n.lat,i.lat)):(this._sw=new Cc(r.lng,r.lat),this._ne=new Cc(n.lng,n.lat)),this}getCenter(){return new Cc((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 Cc(this.getWest(),this.getNorth())}getSouthEast(){return new Cc(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}=Cc.convert(e);let r=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(r=this._sw.lng>=t&&t>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&r}static convert(e){if(e)return e instanceof Pc?e:new Pc(e)}}function Rc(e){return Mc*Math.cos(e*Math.PI/180)}function zc(e){return(180+e)/360}function Lc(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Dc(e,t){return e/Rc(t)}function Oc(e){return 360*e-180}function Fc(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180)
vendor: 5,553 bytes, line 2
2)-90}function kc(e,t){return e*Rc(Fc(t))}const Bc=85.051129;function Nc(e){return Math.cos(Ce(Oe(e,-85.051129,Bc)))}function Vc(e,t){const i=Oe(t,0,25.5),r=Math.pow(2,i);return Nc(e)*Mc/(512*r)}function Uc(e){return 1/Math.cos(e*Math.PI/180)}function jc(e,t=0){const i=Math.exp(Math.PI*(1-(e.y+t/Ur)/(1<<e.z)*2));return 80150034*i/(i*i+1)/Ur/(1<<e.z)}class Gc{constructor(e,t,i=0){this.x=+e,this.y=+t,this.z=+i}static fromLngLat(e,t=0){const i=Cc.convert(e);return new Gc(zc(i.lng),Lc(i.lat),Dc(t,i.lat))}toLngLat(){return new Cc(Oc(this.x),Fc(this.y))}toAltitude(){return kc(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Mc*Uc(Fc(this.y))}}function qc(e,t,i,r,n,o,s,a,l){const c=(t+r)/2,h=(i+n)/2,u=new Ee(c,h);a(u),function(e,t,i,r,n,o){const s=i-n,a=r-o;return Math.abs((r-t)*s-(i-e)*a)/Math.hypot(s,a)}(u.x,u.y,o.x,o.y,s.x,s.y)>=l?(qc(e,t,i,c,h,o,u,a,l),qc(e,c,h,r,n,u,s,a,l)):e.push(s)}function Hc(e,t,i){let r=e[0],n=r.x,o=r.y;t(r);const s=[r];for(let a=1;a<e.length;a++){const l=e[a],{x:c,y:h}=l;t(l),qc(s,n,o,c,h,r,l,t,i),n=c,o=h,r=l}return s}function $c(e,t,i,r){if(r(t,i)){const n=t.add(i)._mult(.5);$c(e,t,n,r),$c(e,n,i,r)}else e.push(i)}function Zc(e,t){let i=e[0];const r=[i];for(let n=1;n<e.length;n++){const o=e[n];$c(r,i,o,t),i=o}return r}const Wc=Math.pow(2,14)-1,Xc=-Wc-1;function Yc(e,t){const i=Math.round(e.x*t),r=Math.round(e.y*t);return e.x=Oe(i,Xc,Wc),e.y=Oe(r,Xc,Wc),(i<e.x||i>e.x+1||r<e.y||r>e.y+1)&&We("Geometry exceeds allowed extent, reduce your vector tile buffer size"),e}function Kc(e,t,i){const r=e.loadGeometry(),n=e.extent,o=Ur/n;if(t&&i&&i.projection.isReprojectedInTileSpace){const o=1<<t.z,{scale:s,x:a,y:l,projection:c}=i,h=e=>{const i=Oc((t.x+e.x/n)/o),r=Fc((t.y+e.y/n)/o),h=c.project(i,r);e.x=(h.x*s-a)*n,e.y=(h.y*s-l)*n};for(let t=0;t<r.length;t++)if(1!==e.type)r[t]=Hc(r[t],h,1);else{const e=[];for(const i of r[t])i.x<0||i.x>=n||i.y<0||i.y>=n||(h(i),e.push(i));r[t]=e}}for(const s of r)for(const e of s)Yc(e,o);return r}function Jc(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Kc(e):[]}}class Qc{constructor(e,t,i,r,n){this.properties={},this.extent=i,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=n,e.readFields(eh,this,t)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,i=[];let r,n=1,o=0,s=0,a=0;for(;e.pos<t;){if(o<=0){const t=e.readVarint();n=7&t,o=t>>3}if(o--,1===n||2===n)s+=e.readSVarint(),a+=e.readSVarint(),1===n&&(r&&i.push(r),r=[]),r&&r.push(new Ee(s,a));else{if(7!==n)throw new Error(`unknown command ${n}`);r&&r.push(r[0].clone())}}return r&&i.push(r),i}bbox(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let i=1,r=0,n=0,o=0,s=1/0,a=-1/0,l=1/0,c=-1/0;for(;e.pos<t;){if(r<=0){const t=e.readVarint();i=7&t,r=t>>3}if(r--,1===i||2===i)n+=e.readSVarint(),o+=e.readSVarint(),n<s&&(s=n),n>a&&(a=n),o<l&&(l=o),o>c&&(c=o);else if(7!==i)throw new Error(`unknown command ${i}`)}return[s,l,a,c]}toGeoJSON(e,t,i){const r=this.extent*Math.pow(2,i),n=this.extent*e,o=this.extent*t,s=this.loadGeometry();function a(e){return[360*(e.x+n)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+o)/r)*Math.PI))-90]}function l(e){return e.map(a)}let c;if(1===this.type){const e=[];for(const i of s)e.push(i[0]);const t=l(e);c=1===e.length?{type:"Point",coordinates:t[0]}:{type:"MultiPoint",coordinates:t}}else if(2===this.type){const e=s.map(l);c=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}}else{if(3!==this.type)throw new Error("unknown feature type");{const e=function(e){const t=e.length;if(t<=1)return[e];const i=[];let r,n;for(let o=0;o<t;o++){const t=th(e[o]);0!==t&&(void 0===n&&(n=t<0),n===t<0?(r&&i.push(r),r=[e[o]]):r&&r.push(e[o]))}return r&&i.push(r),i}(s),t=[];for(const i of e)t.push(i.map(l));c=1===t.length?{type:"Polygon",coordinates:t[0]}:{type:"MultiPolygon",coordinates:t}}}const h={type:"Feature",geometry:c,properties:this.properties};return null!=this.id&&(h.id=this.id),h}}function eh(e,t,i){1===e?t.id=i.readVarint():2===e?function(e,t){const i=e.readVarint()+e.pos;for(;e.pos<i;){const i=t._keys[e.readVarint()],r=t._values[e.readVarint()];t.properties[i]=r}}(i,t):3===e?t.type=i.readVarint():4===e&&(t._geometry=i.pos)}function th(e){let t=0;for(let i,r,n=0,o=e.length,s=o-1;n<o;s=n++)i=e[n],r=e[s],t+=(r.x-i.x)*(i.y+r.y);return t}Qc.types=["Unknown","Point","LineString","Polygon"];class ih{constructor(e,t){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(rh,this,t),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new Qc(this._pbf,t,this.extent,this._keys,this._values)}}function rh(e,t,i){15===e?t.version=i.readVarint():1===e?t.name=i.readString():5===e?t.extent=i.readVarint():2===e?t._features.push(i.pos):3===e?t._keys.push(i.readString()):4===e&&t._values.push(function(e){let t=null;const i=e.readVarint()+e.pos;for(;e.pos<i;){const i=e.readVarint()>>3;t=1===i?e.readString():2===i?e.readFloat():3===i?e.readDouble():4===i?e.readVarint64():5===i?e.readVarint():6===i?e.readSVarint():7===i?e.readBoolean():null}if(null==t)throw new Error("unknown feature value");return t}(i))}class nh{constructor(e,t){this.layers=e.readFields(oh,{},t)}}function oh(e,t,i){if(3===e){const e=new ih(i,i.readVarint()+i.pos);e.length&&(t[e.name]=e)}}const sh="3d_elevation_id",ah="level";
vendor: 4,463 bytes, line 2
2class lh{constructor(){this._valid=!1}reset(e){return this.feature=e,this._valid=!0,this._geometry=e.loadGeometry(),0!==this._geometry.length&&0!==this._geometry[0].length||(this._valid=!1),this}geometry(e,t){return this._valid&&e(t(this._geometry)),this}require(e,t,i){return this.get(e,!0,t,i)}optional(e,t,i){return this.get(e,!1,t,i)}success(){return this._valid}get(e,t,i,r){const n=this.feature.properties.hasOwnProperty(e)?+this.feature.properties[e]:void 0;return this._valid&&void 0!==n&&!Number.isNaN(n)?i(r?r(n):n):t&&(this._valid=!1),this}}class ch{constructor(e,t){this.featureFunc=e,this.vertexFunc=t}parseFeature(e,t,i){return this.featureFunc(e,t,i)}parseVertex(e,t,i){return this.vertexFunc(e,t,i)}}const hh=new ch((e,t,i)=>e.reset(t).require(sh,e=>{i.id=e}).optional("fixed_height_relative",e=>{i.constantHeight=e},dh.decodeRelativeHeight).geometry(e=>{i.bounds=e},xr).success(),(e,t,i)=>e.reset(t).require(sh,e=>{i.id=e}).require("elevation_idx",e=>{i.idx=e}).require("extent",e=>{i.extent=e}).require("height_relative",e=>{i.height=e},dh.decodeRelativeHeight).geometry(e=>{i.position=e},dh.getPoint).success()),uh=new ch((e,t,i)=>e.reset(t).require(sh,e=>{i.id=e}).optional("fixed_height",e=>{i.constantHeight=e},dh.decodeMetricHeight).geometry(e=>{i.bounds=e},xr).success(),(e,t,i)=>e.reset(t).require(sh,e=>{i.id=e}).require("elevation_idx",e=>{i.idx=e}).require("extent",e=>{i.extent=e}).require("height",e=>{i.height=e},dh.decodeMetricHeight).geometry(e=>{i.position=e},dh.getPoint).success());class dh{static getPoint(e){return ue(e[0][0].x,e[0][0].y)}static decodeRelativeHeight(e){return 1e-4*e*5}static decodeMetricHeight(e){return 1e-4*e}static getVersionSchema(e){return e?"1.0.1"===e?uh:void 0:hh}static parse(e){const t=[],i=[],r=e.length,n=new lh;for(let o=0;o<r;o++){const r=e.feature(o),s=r.properties.version,a=dh.getVersionSchema(s);if(void 0===a){We(`Unknown elevation feature version number ${s||"(unknown)"}`);continue}const l=r.properties.type;if(!l)continue;const c=Qc.types[r.type];if("Point"===c&&"curve_point"===l){const e={};a.parseVertex(n,r,e)&&t.push(e)}else if("Polygon"===c&&"curve_meta"===l){const e={};a.parseFeature(n,r,e)&&i.push(e)}}return{vertices:t,features:i}}}class ph{constructor(e,t){this.pos=e,this.dir=t}intersectsPlane(e,t,i){const r=ye(t,this.dir);if(Math.abs(r)<1e-6)return!1;const n=((e[0]-this.pos[0])*t[0]+(e[1]-this.pos[1])*t[1])/r;return i[0]=this.pos[0]+this.dir[0]*n,i[1]=this.pos[1]+this.dir[1]*n,!0}}class fh{constructor(e,t){this.pos=e,this.dir=t}intersectsPlane(e,t,i){const r=N(t,this.dir);if(Math.abs(r)<1e-6)return!1;const n=((e[0]-this.pos[0])*t[0]+(e[1]-this.pos[1])*t[1]+(e[2]-this.pos[2])*t[2])/r;return i[0]=this.pos[0]+this.dir[0]*n,i[1]=this.pos[1]+this.dir[1]*n,i[2]=this.pos[2]+this.dir[2]*n,!0}closestPointOnSphere(e,i,r){if(function(e,i){var r=e[0],n=e[1],o=e[2],s=i[0],a=i[1],l=i[2];return Math.abs(r-s)<=t*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-a)<=t*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(o-l)<=t*Math.max(1,Math.abs(o),Math.abs(l))}(this.pos,e)||0===i)return r[0]=r[1]=r[2]=0,!1;const[n,o,s]=this.dir,a=this.pos[0]-e[0],l=this.pos[1]-e[1],c=this.pos[2]-e[2],h=n*n+o*o+s*s,u=2*(a*n+l*o+c*s),d=u*u-4*h*(a*a+l*l+c*c-i*i);if(d<0){const e=Math.max(-u/2,0),t=a+n*e,h=l+o*e,d=c+s*e,p=Math.hypot(t,h,d);return r[0]=t*i/p,r[1]=h*i/p,r[2]=d*i/p,!1}{const e=(-u-Math.sqrt(d))/(2*h);if(e<0){const e=Math.hypot(a,l,c);return r[0]=a*i/e,r[1]=l*i/e,r[2]=c*i/e,!1}return r[0]=a+n*e,r[1]=l+o*e,r[2]=c+s*e,!0}}}class mh{constructor(e,t,i,r,n){this.TL=e,this.TR=t,this.BR=i,this.BL=r,this.horizon=n}static fromInvProjectionMatrix(e,t,i){const r=[-1,1,1],n=[1,1,1],o=[1,-1,1],s=[-1,-1,1],a=j(r,r,e),l=j(n,n,e),c=j(o,o,e),h=j(s,s,e);return new mh(a,l,c,h,t/i)}}function _h(e,t,i){let r=1/0,n=-1/0;const o=[];for(const s of e){Z(o,s,t);const e=N(o,i);r=Math.min(r,e),n=Math.max(n,e)}return[r,n]}function gh(e,t){let i=!0;for(let r=0;r<e.planes.length;r++){const n=e.planes[r];let o=0;for(let e=0;e<t.length;e++)o+=+(N(n,t[e])+n[3]>=0);if(0===o)return 0;o!==t.length&&(i=!1)}return i?2:1}function yh(e,t){for(const i of e.projections){const r=_h(t,e.points[0],i.axis);if(i.projection[1]<r[0]||i.projection[0]>r[1])return 0}return 1}function xh(e,t){let i=0;const r=[0,0,0,0];for(let n=0;n<e.length;n++)r[0]=e[n][0],r[1]=e[n][1],r[2]=e[n][2],r[3]=1,Q(r,t)>=0&&i++;return i}class vh{constructor(e,t){this.points=e||new Array(8).fill([0,0,0]),this.planes=t||new Array(6).fill([
vendor: 6,172 bytes, line 2
20,0,0,0]),this.bounds=bh.fromPoints(this.points),this.projections=[],this.frustumEdges=[Z([],this.points[2],this.points[3]),Z([],this.points[0],this.points[3]),Z([],this.points[4],this.points[0]),Z([],this.points[5],this.points[1]),Z([],this.points[6],this.points[2]),Z([],this.points[7],this.points[3])];for(const i of this.frustumEdges){const e=[0,-i[2],i[1]],t=[i[2],0,-i[0]];this.projections.push({axis:e,projection:_h(this.points,this.points[0],e)}),this.projections.push({axis:t,projection:_h(this.points,this.points[0],t)})}}static fromInvProjectionMatrix(e,t,i,r){const n=Math.pow(2,i),o=[[-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 o=ee([],i,e),s=1/o[3]/t*n;return(a=o)[0]=(l=o)[0]*(c=[s,s,r?1/o[3]:s,s])[0],a[1]=l[1]*c[1],a[2]=l[2]*c[2],a[3]=l[3]*c[3],a;var a,l,c}),s=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(e=>{const t=B([],V([],Z([],o[e[0]],o[e[1]]),Z([],o[e[2]],o[e[1]]))),i=-N(t,o[e[1]]);return t.concat(i)}),a=[];for(let l=0;l<o.length;l++)a.push([o[l][0],o[l][1],o[l][2]]);return new vh(a,s)}intersectsPrecise(e,t,i){for(let r=0;r<t.length;r++)if(!xh(e,t[r]))return 0;for(let r=0;r<this.planes.length;r++)if(!xh(e,this.planes[r]))return 0;for(const r of i)for(const t of this.frustumEdges){const i=V([],r,t),n=S(i);if(0===n)continue;z(i,i,1/n);const o=_h(this.points,this.points[0],i),s=_h(e,this.points[0],i);if(o[0]>s[1]||s[0]>o[1])return 0}return 1}containsPoint(e){for(const t of this.planes){const i=t[3];if(N([t[0],t[1],t[2]],e)+i<0)return!1}return!0}}class bh{static fromPoints(e){const t=[1/0,1/0,1/0],i=[-1/0,-1/0,-1/0];for(const r of e)P(t,t,r),R(i,i,r);return new bh(t,i)}static fromTileIdAndHeight(e,t,i){const r=1<<e.canonical.z,n=e.canonical.x,o=e.canonical.y;return new bh([n/r,o/r,t],[(n+1)/r,(o+1)/r,i])}static applyTransform(e,t){const i=e.getCorners();for(let r=0;r<i.length;++r)j(i[r],i[r],t);return bh.fromPoints(i)}static applyTransformFast(e,t){const i=[t[12],t[13],t[14]],r=[...i];for(let n=0;n<3;n++)for(let o=0;o<3;o++){const s=t[4*o+n],a=s*e.min[o],l=s*e.max[o];i[n]+=Math.min(a,l),r[n]+=Math.max(a,l)}return new bh(i,r)}static projectAabbCorners(e,t){const i=e.getCorners();for(let r=0;r<i.length;++r)j(i[r],i[r],t);return i}constructor(e,t){this.min=e,this.max=t,this.center=z([],A([],this.min,this.max),.5)}quadrant(e){const t=[e%2==0,e<2],i=T(this.min),r=T(this.max);for(let n=0;n<t.length;n++)i[n]=t[n]?this.min[n]:this.center[n],r[n]=t[n]?this.center[n]:this.max[n];return r[2]=this.max[2],new bh(i,r)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){const e=this.min,t=this.max;return[[e[0],e[1],e[2]],[t[0],e[1],e[2]],[t[0],t[1],e[2]],[e[0],t[1],e[2]],[e[0],e[1],t[2]],[t[0],e[1],t[2]],[t[0],t[1],t[2]],[e[0],t[1],t[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?gh(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?gh(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(e,t){return t||this.intersects(e)?yh(e,this.getCorners()):0}intersectsPreciseFlat(e,t){return t||this.intersectsFlat(e)?yh(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(e){for(let t=0;t<3;++t)if(this.min[t]>e.max[t]||e.min[t]>this.max[t])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e.min[t]),this.max[t]=Math.max(this.max[t],e.max[t])}encapsulatePoint(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e[t]),this.max[t]=Math.max(this.max[t],e[t])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}es(bh,"Aabb");class wh{constructor(e,t){this.feature=e,this.metersToTile=t,this.index=0}get(){const e=this.feature.vertices[this.index],t=this.feature.vertexProps[this.index].dir,i=t[1],r=-t[0],n=(e.extent+1)*this.metersToTile;return[new Ee(Math.trunc(e.position[0]+i*n),Math.trunc(e.position[1]+r*n)),new Ee(Math.trunc(e.position[0]-i*n),Math.trunc(e.position[1]-r*n))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class Th{constructor(e,t,i,r,n,o){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this._tmpVec2=[he(),he(),he(),he(),he(),he(),he()],this.id=e,this.heightRange={min:i,max:i},this.safeArea=t,this.constantHeight=i,null==this.constantHeight&&(null!=this.constantHeight||0!==r.length)){this.vertices=r,this.edges=n,this.edges=this.edges.filter(e=>{return e.a<this.vertices.length&&e.b<this.vertices.length&&!((t=this.vertices[e.a].position)[0]===(i=this.vertices[e.b].position)[0]&&t[1]===i[1]);var t,i}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const e of this.vertices)this.vertexProps.push({dir:ue(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,e.height),this.heightRange.max=Math.max(this.heightRange.max,e.height);for(const e of this.edges){const t=this.vertices[e.a].position,i=this.vertices[e.b].position,r=fe(he(),i,t),n=_e(r),o=me(he(),r,1/n);this.edgeProps.push({vec:r,dir:o,len:n});const s=this.vertexProps[e.a].dir,a=this.vertexProps[e.b].dir;pe(s,s,o),pe(a,a,o)}for(const e of this.vertexProps)0===e.dir[0]&&0===e.dir[1]||ge(e.dir,e.dir);this.tessellate(o)}}pointElevation(e){if(null!=this.constantHeight)return this.constantHeight;const t=this.getClosestEdge(e);if(null==t)return 0;const[i,r]=t;return pi(this.vertices[this.edges[i].a].height,this.vertices[this.edges[i].b].height,r)}computeSlopeNormal(e,t){const i=this.getClosestEdge(e);if(!i)return E(0,0,1);const r=i[0],n=this.edges[r],o=this.edgeProps[r].vec,s=E(o[0],o[1],(this.vertices[n.b].height-this.vertices[n.a].height)*t),a=E(s[1],-s[0],0);V(a,a,s);const l=S(a);return l>
vendor: 4,128 bytes, line 2
20?z(a,a,1/l):I(a,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(0===this.edges.length)return;let t=0,i=Number.POSITIVE_INFINITY,r=0;const[n,o,s,a,l,c,h]=this._tmpVec2;de(h,e.x,e.y);const u=new ph(h,null);for(let d=0;d<this.edges.length;d++){const e=this.edges[d],p=this.edgeProps[d].dir;u.dir=p;const f=this.vertices[e.a].position,m=this.vertices[e.b].position,_=u.intersectsPlane(f,this.vertexProps[e.a].dir,n),g=u.intersectsPlane(m,this.vertexProps[e.b].dir,o);if(!_||!g)continue;fe(s,o,n),fe(a,h,n);const y=ye(s,s),x=y>0?ye(a,s)/y:0,v=Oe(x,0,1),b=Math.abs((x-v)*this.edgeProps[d].len);fe(l,h,f),de(c,p[1],-p[0]);const w=b+Math.abs(ye(l,c));w<i&&(t=d,i=w,r=v)}return[t,r]}tessellate(e){const t=w(),i=w(),r=w(),n=w();for(let o=this.edges.length-1;o>=0;--o){const s=this.edges[o].a,a=this.edges[o].b,{position:l,height:c,extent:h}=this.vertices[s],{position:u,height:d,extent:p}=this.vertices[a],f=this.vertexProps[s].dir,m=this.vertexProps[a].dir;if(I(t,l[0]/e,l[1]/e,c),I(i,u[0]/e,u[1]/e,d),I(r,f[1],-f[0],0),z(r,r,h),I(n,m[1],-m[0],0),z(n,n,p),this.distSqLines(E(t[0]+.5*r[0],t[1]+.5*r[1],t[2]+.5*r[2]),E(i[0]-.5*n[0],i[1]-.5*n[1],i[2]-.5*n[2]),E(t[0]-.5*r[0],t[1]-.5*r[1],t[2]-.5*r[2]),E(i[0]+.5*n[0],i[1]+.5*n[1],i[2]+.5*n[2]))<=.0025000000000000005)continue;const _=this.vertices.length,g=pe(he(),l,u);this.vertices.push({position:me(g,g,.5),height:.5*(c+d),extent:.5*(h+p)});const y=pe(he(),f,m);this.vertexProps.push({dir:ge(y,y)}),this.edges.splice(o,1),this.edgeProps.splice(o,1),this.edges.push({a:s,b:_}),this.edges.push({a:_,b:a});const x=fe(he(),this.vertices[_].position,l),v=_e(x),b={vec:x,dir:me(he(),x,1/v),len:v};this.edgeProps.push(b),this.edgeProps.push(b)}}distSqLines(e,t,i,r){const n=M(w(),t,e),o=M(w(),r,i),s=M(w(),e,i),a=N(n,n),l=N(n,o),c=N(n,s),h=N(o,o),u=N(o,s),d=a*h-l*l;if(0===d)return O(U(n,i,r,N(s,o)/N(o,o)),e);const p=(a*u-l*c)/d;return O(U(n,e,t,(l*u-c*h)/d),U(o,i,r,p))}}class Sh{static parseFrom(e,t){const i=dh.parse(e);if(!i)return[];let{vertices:r,features:n}=i;const o=1/jc(t);n.sort((e,t)=>e.id-t.id),r.sort((e,t)=>e.id-t.id||e.idx-t.idx),r=r.filter((e,t,i)=>t===i.findIndex(t=>t.id===e.id&&t.idx===e.idx));const s=new Array;let a=0;const l=r.length;for(const c of n){if(c.constantHeight){s.push(new Th(c.id,c.bounds,c.constantHeight));continue}for(;a!==l&&r[a].id<c.id;)a++;if(a===l||r[a].id!==c.id)continue;const e=new Array,t=new Array,i=a;for(;a!==l&&r[a].id===c.id;){const n=r[a];if(e.push({position:n.position,height:n.height,extent:n.extent}),a!==i&&r[a-1].idx===n.idx-1){const e=a-i;t.push({a:e-1,b:e})}a++}s.push(new Th(c.id,c.bounds,void 0,e,t,o))}return s}static getElevationFeature(e,t){if(!t)return;const i=+e.properties[sh];return Number.isNaN(i)?void 0:t.find(e=>e.id===i)}}class Eh{constructor(e,t){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(t)||(this.zScale=Math.pow(2,t.z-e.z),this.xOffset=(e.x*this.zScale-t.x)*Ur,this.yOffset=(e.y*this.zScale-t.y)*Ur)}constantElevation(e,t){if(null!=e.constantHeight)return this.computeBiasedHeight(e.constantHeight,t)}pointElevation(e,t,i){const r=this.constantElevation(t,i);return null!=r?r:(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(t.pointElevation(e),i))}computeBiasedHeight(e,t){return t<=0?e:e+t*Fe(0,t,e>=0?e:Math.abs(.5*e))}}es(Th,"ElevationFeature");class Ih{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new Ua,this.indexArray=new ll,this.segments=new Nl,this.programConfigurations=new fc(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,"none"!==this.elevationMode&&(this.elevatedLayoutVertexArray=new qa),this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,i,r){}populate(e,t,i,r){const n=this.layers[0],o=[];let s=null;
vendor: 4,541 bytes, line 2
2"circle"===n.type&&(s=n.layout.get("circle-sort-key"));for(const{feature:l,id:c,index:h,sourceLayerIndex:u}of e){const e=this.layers[0]._featureFilter.needGeometry,n=Jc(l,e);if(!this.layers[0]._featureFilter.filter(new Js(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),n,i))continue;const a=s?s.evaluate(n,{},i):void 0,d={id:c,properties:l.properties,type:l.type,sourceLayerIndex:u,index:h,geometry:e?n.geometry:Kc(l,i,r),patterns:{},sortKey:a};o.push(d)}s&&o.sort((e,t)=>e.sortKey-t.sortKey);let a=null;"globe"===r.projection.name&&(this.globeExtVertexArray=new Ja,a=r.projection);for(const l of o){const{geometry:r,index:n,sourceLayerIndex:o}=l,s=e[n].feature;this.addFeature(l,r,n,t.availableImages,i,a,t.brightness,t.elevationFeatures),t.featureIndex.insert(s,r,n,o,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(e,t,i,r,n,o,s){this.programConfigurations.updatePaintArrays(e,t,n,i,r,o,s,this.worldview)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Fl.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Bl.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,kl.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(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(e,t,i,r,n,o,s,a){let l;"none"!==this.elevationMode&&(l=Sh.getElevationFeature(e,a));for(const c of t)for(const t of c){const i=t.x,r=t.y;if(i<0||i>=Ur||r<0||r>=Ur)continue;if(o){const e=o.projectTilePoint(i,r,n),t=o.upVector(n,i,r);this.addGlobeExtVertex(e,t),this.addGlobeExtVertex(e,t),this.addGlobeExtVertex(e,t),this.addGlobeExtVertex(e,t)}const s=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),a=s.vertexLength;if(this.addCircleVertex(i,r,-1,-1),this.addCircleVertex(i,r,1,-1),this.addCircleVertex(i,r,1,1),this.addCircleVertex(i,r,-1,1),"none"!==this.elevationMode){const e=l?l.pointElevation(new Ee(i,r)):0;this.hasElevation=this.hasElevation||0!==e;for(let t=0;t<4;t++)this.elevatedLayoutVertexArray.emplaceBack(e)}this.indexArray.emplaceBack(a,a+1,a+2),this.indexArray.emplaceBack(a,a+2,a+3),s.vertexLength+=4,s.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{},r,n,s,void 0,this.worldview)}addCircleVertex(e,t,i,r){this.layoutVertexArray.emplaceBack(2*e+(i+1)/2,2*t+(r+1)/2)}addGlobeExtVertex(e,t){const i=16384;this.globeExtVertexArray.emplaceBack(e.x,e.y,e.z,t[0]*i,t[1]*i,t[2]*i)}}function Ah(e,t){for(let i=0;i<e.length;i++)if(Bh(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(Bh(e,t[i]))return!0;return!!Rh(e,t)}function Mh(e,t,i){return!!Bh(e,t)||!!Oh(t,e,i)}function Ch(e,t){if(1===e.length)return kh(t,e[0]);for(let i=0;i<t.length;i++){const r=t[i];for(let t=0;t<r.length;t++)if(Bh(e,r[t]))return!0}for(let i=0;i<e.length;i++)if(kh(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(Rh(e,t[i]))return!0;return!1}function Ph(e,t,i){if(e.length>1){if(Rh(e,t))return!0;for(let r=0;r<t.length;r++)if(Oh(t[r],e,i))return!0}for(let r=0;r<e.length;r++)if(Oh(e[r],t,i))return!0;return!1}function Rh(e,t){if(0===e.length||0===t.length)return!1;for(let i=0;i<e.length-1;i++){const r=e[i],n=e[i+1];for(let e=0;e<t.length-1;e++)if(zh(r,n,t[e],t[e+1]))return!0}return!1}function zh(e,t,i,r){return Xe(e,i,r)!==Xe(t,i,r)&&Xe(e,t,i)!==Xe(e,t,r)}function Lh(e,t,i){return(e.x-i.x)*(t.y-i.y)-(e.y-i.y)*(t.x-i.x)}function Dh(e,t,i,r){const n=Lh(e,t,r),o=Lh(e,t,i);if(Math.sign(n)===Math.sign(o))return;const s=Lh(i,r,e),a=s+o-n;return Math.sign(s)!==Math.sign(a)?[s/(s-a),o/(o-n)]:void 0}function Oh(e,t,i){const r=i*i;if(1===t.length)return e.distSqr(t[0])<r;for(let n=1;n<t.length;n++)if(Fh(e,t[n-1],t[n])<r)return!0;return!1}function Fh(e,t,i){const r=t.distSqr(i);if(0===r)return e.distSqr(t);const n=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/r;return e.distSqr(n<0?t:n>1?i:i.sub(t)._mult(n)._add(t))}function kh(e,t){let i,r,n,o=!1;for(let s=0;s<e.length;s++){i=e[s];for(let e=0,s=i.length-1;e<i.length;
vendor: 7,272 bytes, line 2
2s=e++)r=i[e],n=i[s],r.y>t.y!=n.y>t.y&&t.x<(n.x-r.x)*(t.y-r.y)/(n.y-r.y)+r.x&&(o=!o)}return o}function Bh(e,t){let i=!1;for(let r=0,n=e.length-1;r<e.length;n=r++){const o=e[r],s=e[n];o.y>t.y!=s.y>t.y&&t.x<(s.x-o.x)*(t.y-o.y)/(s.y-o.y)+o.x&&(i=!i)}return i}function Nh(e,t,i,r,n){for(const s of e)if(t<=s.x&&i<=s.y&&r>=s.x&&n>=s.y)return!0;const o=[new Ee(t,i),new Ee(t,n),new Ee(r,n),new Ee(r,i)];if(e.length>2)for(const s of o)if(Bh(e,s))return!0;for(let s=0;s<e.length-1;s++)if(Vh(e[s],e[s+1],o))return!0;return!1}function Vh(e,t,i){const r=i[0],n=i[2];if(e.x<r.x&&t.x<r.x||e.x>n.x&&t.x>n.x||e.y<r.y&&t.y<r.y||e.y>n.y&&t.y>n.y)return!1;const o=Xe(e,t,i[0]);return o!==Xe(e,t,i[1])||o!==Xe(e,t,i[2])||o!==Xe(e,t,i[3])}function Uh(e,t,i,r,n,o){let s=t.y-e.y,a=e.x-t.x;if(o=o||0){const e=s*s+a*a;if(0===e)return!0;const t=Math.sqrt(e);s/=t,a/=t}return!((i.x-e.x)*s+(i.y-e.y)*a-o<0||(r.x-e.x)*s+(r.y-e.y)*a-o<0||(n.x-e.x)*s+(n.y-e.y)*a-o<0)}function jh(e,t,i,r,n,o,s){return!(Uh(e,t,r,n,o,s)||Uh(t,i,r,n,o,s)||Uh(i,e,r,n,o,s)||Uh(r,n,e,t,i,s)||Uh(n,o,e,t,i,s)||Uh(o,r,e,t,i,s))}function Gh(e,t,i){const r=t.paint.get(e).value;return"constant"===r.kind?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function qh(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Hh(e,t,i,r,n){if(!t[0]&&!t[1])return e;const o=Ee.convert(t)._mult(n);"viewport"===i&&o._rotate(-r);const s=[];for(let a=0;a<e.length;a++)s.push(e[a].sub(o));return s}function $h(e,t,i,r){const n=Ee.convert(e)._mult(r);return"viewport"===t&&n._rotate(-i),n}let Zh,Wh;function Xh(e,t,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[e*r-2*Math.PI*6378137/2,t*r-2*Math.PI*6378137/2]}es(Ih,"CircleBucket",{omit:["layers"]});class Yh{constructor(e,t,i){this.z=e,this.x=t,this.y=i,this.key=Qh(0,e,e,t,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}isChildOf(e){const t=this.z-e.z;return 0===e.z||e.z<this.z&&e.x===this.x>>t&&e.y===this.y>>t}url(e,t){const i=function(e,t,i){var r=Xh(256*e,256*(t=Math.pow(2,i)-t-1),i),n=Xh(256*(e+1),256*(t+1),i);return r[0]+","+r[1]+","+n[0]+","+n[1]}(this.x,this.y,this.z),r=function(e,t,i){let r,n="";for(let o=e;o>0;o--)r=1<<o-1,n+=(t&r?1:0)+(i&r?2:0);return n}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===t?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",r).replace("{bbox-epsg-3857}",i)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Kh{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Qh(e,t.z,t.z,t.x,t.y)}}class Jh{constructor(e,t,i,r,n){this.overscaledZ=e,this.wrap=t,this.canonical=new Yh(i,+r,+n),this.key=0===t&&e===i?this.canonical.key:Qh(t,e,i,r,n)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const t=this.canonical.z-e;return e>this.canonical.z?new Jh(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Jh(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 Qh(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y);{const i=this.canonical.z-e;return Qh(this.wrap*+t,e,e,this.canonical.x>>i,this.canonical.y>>i)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new Jh(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new Jh(t,this.wrap,t,i,r),new Jh(t,this.wrap,t,i+1,r),new Jh(t,this.wrap,t,i,r+1),new Jh(t,this.wrap,t,i+1,r+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Jh(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Jh(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Kh(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function Qh(e,t,i,r,n){const o=1<<Math.min(i,22);let s=o*(n%o)+r%o;return e&&i<22&&(s+=o*o*((e<0?-2*e-1:2*e)%(1<<2*(22-i)))),16*(32*s+i)+(t-i)}const eu=[e=>{let t=e.canonical.x-1,i=e.wrap;return t<0&&(t=(1<<e.canonical.z)-1,i--),new Jh(e.overscaledZ,i,e.canonical.z,t,e.canonical.y)},e=>{let t=e.canonical.x+1,i=e.wrap;return t===1<<e.canonical.z&&(t=0,i++),new Jh(e.overscaledZ,i,e.canonical.z,t,e.canonical.y)},e=>new Jh(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,(0===e.canonical.y?1<<e.canonical.z:e.canonical.y)-1),e=>new Jh(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y===(1<<e.canonical.z)-1?0:e.canonical.y+1)];es(Yh,"CanonicalTileID"),es(Jh,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const tu=Na([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:iu}=tu,ru=Na([{name:"a_pos_3",components:3,type:"Int16"}]);var nu=Na([{name:"a_pos",type:"Int16",components:2}]);function ou(e){return e*vc/Ac}const su=[new bh([Tc,Tc,Tc],[Sc,Sc,Sc]),new bh([Tc,Tc,Tc],[0,0,Sc]),new bh([0,Tc,Tc],[Sc,0,Sc]),new bh([Tc,0,Tc],[0,Sc,Sc]),new bh([0,0,Tc],[Sc,Sc,Sc])];function au(e,t,i,r=!0){const n=z([],e._camera.position,e.worldSize),o=[t,i,1,1];ee(o,o,e.pixelMatrixInverse),K(o,o,1/o[3]);const s=B([],Z([],o,n)),a=e.globeMatrix,l=[a[12],a[13],a[14]],c=Z([],l,n),h=S(c),u=B([],c),d=e.worldSize/(2*Math.PI),p=N(u,s),f=Math.asin(d/h);if(f<Math.acos(p)){if(!r)return null;const e=[],t=[];z(e,s,h/p),B(t,Z(t,e,c)),B(s,A(s,c,z(s,t,Math.tan(f)*h)))}const m=[];new fh(n,s).closestPointOnSphere(l,d,m);const _=B([],tt(a,0)),g=B([],tt(a,1)),y=B([],tt(a,2)),x=N(_,m),v=N(g,m),b=N(y,m),w=Pe(Math.asin(-v/d));let T=Pe(Math.atan2(x,b));T=e.center.lng+function(e,t){const i=(t-e+180)%360-180;return i<-180?i+360:i}(e.center.lng,T);const E=zc(T),I=Oe(Lc(w),0,1);return new Gc(E,I)}class lu{constructor(e,t,i){this.a=Z([],e,i),this.b=Z([],t,i),this.center=i;const r=B([],this.a),n=B([],this.b);this.angle=Math.acos(N(r,n))}}function cu(e,t){if(0===e.angle)return null;let i;return i=0===e.a[t]?1/e.angle*.5*Math.PI:1/e.angle*Math.atan(e.b[t]/e.a[t]/Math.sin(e.angle)-1/Math.tan(e.angle)),i<0||i>1?null:function(e,t,i,r){const n=Math.sin(i);return e*(Math.sin((1-r)*i)/n)+t*(Math.sin(r*i)/n)}(e.a[t],e.b[t],e.angle,Oe(i,0,1))+e.center[t]}function hu(e){if(e.z<=1)return su[e.z+2*e.y+e.x];const t=mu(fu(e));return bh.fromPoints(t)}function uu(e,t,i){return z(e,e,1-i),L(e,e,t,i)}function du(e,t,i){for(const r of e)j(r,r,t),z(r,r,i)}function pu(e,t,i,r){const n=t/e.worldSize,o=e.globeMatrix;if(i.z<=1){const e=hu(i).getCorners();return du(e,o,n),bh.fromPoints(e)}const s=fu(i,r),a=mu(s,vc+ou(e._tileCoverLift));du(a,o,n);const l=Number.MAX_VALUE,c=[-l,-l,-l],h=[l,l,l];
vendor: 5,308 bytes, line 2
2if(s.contains(e.center)){for(const e of a)P(h,h,e),R(c,c,e);c[2]=0;const t=e.point,i=[t.x*n,t.y*n,0];return P(h,h,i),R(c,c,i),new bh(h,c)}if(e._tileCoverLift>0){for(const e of a)P(h,h,e),R(c,c,e);return new bh(h,c)}const u=[o[12]*n,o[13]*n,o[14]*n],d=s.getCenter(),p=Oe(e.center.lat,-85.051129,Bc),f=Oe(d.lat,-85.051129,Bc),m=zc(e.center.lng),_=Lc(p);let g=m-zc(d.lng);const y=_-Lc(f);g>.5?g-=1:g<-.5&&(g+=1);let x=0;Math.abs(g)>Math.abs(y)?x=g>=0?1:3:(x=y>=0?0:2,L(u,u,[o[4]*n,o[5]*n,o[6]*n],-Math.sin(Ce(y>=0?s.getSouth():s.getNorth()))*vc));const v=a[x],b=a[(x+1)%4],w=new lu(v,b,u),T=[cu(w,0)||v[0],cu(w,1)||v[1],cu(w,2)||v[2]],S=Su(e.zoom);if(S>0){const r=function({x:e,y:t,z:i},r,n,o,s){const a=1/(1<<i);let l=e*a,c=l+a,h=t*a,u=h+a,d=0;const p=(l+c)/2-o;return p>.5?d=-1:p<-.5&&(d=1),l=((l+d)*r-(o*=r))*n+o,c=((c+d)*r-o)*n+o,h=(h*r-(s*=r))*n+s,u=(u*r-s)*n+s,[[l,u,0],[c,u,0],[c,h,0],[l,h,0]]}(i,t,e._pixelsPerMercatorPixel,m,_);for(let e=0;e<a.length;e++)uu(a[e],r[e],S);const n=A([],r[x],r[(x+1)%4]);z(n,n,.5),uu(T,n,S)}for(const E of a)P(h,h,E),R(c,c,E);return h[2]=Math.min(v[2],b[2]),P(h,h,T),R(c,c,T),new bh(h,c)}function fu({x:e,y:t,z:i},r=!1){const n=1/(1<<i),o=new Cc(Oc(e*n),t===(1<<i)-1&&r?-90:Fc((t+1)*n)),s=new Cc(Oc((e+1)*n),0===t&&r?90:Fc(t*n));return new Pc(o,s)}function mu(e,t=vc){const i=Ce(e.getNorth()),r=Ce(e.getSouth()),n=Math.cos(i),o=Math.cos(r),s=Math.sin(i),a=Math.sin(r),l=e.getWest(),c=e.getEast();return[Ec(o,a,l,t),Ec(o,a,c,t),Ec(n,s,c,t),Ec(n,s,l,t)]}function _u(e,t,i,r){const n=1<<i.z,o=(e/Ur+i.x)/n;return Ic(Fc((t/Ur+i.y)/n),Oc(o),r)}function gu({min:e,max:t}){return 16383/Math.max(t[0]-e[0],t[1]-e[1],t[2]-e[2])}const yu=new Float64Array(16);function xu(e){const t=gu(e),i=g(yu,[t,t,t]);return d(i,i,k([],e.min))}function vu(e){const t=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}(yu,e.min),i=1/gu(e);return p(t,t,[i,i,i])}function bu(e){const t=Ur/(2*Math.PI);return e/(2*Math.PI)/t}function wu(e,t){return Ur/(512*Math.pow(2,e))*gu(hu(t))}function Tu(e,t,i,r,n){const o=bu(i),s=[e,t,-i/(2*Math.PI)],a=c(new Float64Array(16));return d(a,a,s),p(a,a,[o,o,o]),f(a,a,Ce(-n)),m(a,a,Ce(-r)),a}function Su(e){return Fe(5,6,e)}function Eu(e,t){const i=Ic(t.lat,t.lng),r=function(e){const t=Ic(e._center.lat,e._center.lng);let i=V([],E(0,1,0),t);const r=y([],-e.angle,t);i=j(i,i,r),y(r,-e._pitch,i);const n=B([],t);return z(n,n,ou(e.cameraToCenterDistance/e.pixelsPerMeter)),j(n,n,r),A([],t,n)}(e);return s=(n=M([],r,i))[0],a=n[1],l=n[2],c=(o=i)[0],h=o[1],u=o[2],p=(d=Math.sqrt((s*s+a*a+l*l)*(c*c+h*h+u*u)))&&N(n,o)/d,Math.acos(Math.min(Math.max(p,-1),1));var n,o,s,a,l,c,h,u,d,p}function Iu(e,t){return Eu(e,t)>Math.PI/2*1.01}const Au=Ce(85),Mu=Math.cos(Au),Cu=Math.sin(Au),Pu=a(),Ru=e=>{const t=[];return"map"===e.paint.get("circle-pitch-alignment")&&t.push("PITCH_WITH_MAP"),"map"===e.paint.get("circle-pitch-scale")&&t.push("SCALE_WITH_MAP"),t};function zu(e,t,i,r,n,o,s,a,l){if(o&&e.queryGeometry.isAboveHorizon)return!1;o&&(l*=e.pixelToTileUnitsFactor);const c=e.tileID.canonical,h=i.projection.upVectorScale(c,i.center.lat,i.worldSize).metersToTile;for(const u of t)for(const t of u){const u=t.add(a),d=n&&i.elevation?i.elevation.exaggeration()*n.getElevationAt(u.x,u.y,!0):0,p=i.projection.projectTilePoint(u.x,u.y,c);if(d>0){const e=i.projection.upVector(c,u.x,u.y);p.x+=e[0]*h*d,p.y+=e[1]*h*d,p.z+=e[2]*h*d}const f=o?u:Lu(p.x,p.y,p.z,r),m=o?e.tilespaceRays.map(e=>Fu(e,d)):e.queryGeometry.screenGeometry,_=ee([],[p.x,p.y,p.z,1],r);if(!s&&o?l*=_[3]/i.cameraToCenterDistance:s&&!o&&(l*=i.cameraToCenterDistance/_[3]),o){const e=Fc((t.y/Ur+c.y)/(1<<c.z));l/=i.projection.pixelsPerMeter(e,1)/Dc(1,e)}if(Mh(m,f,l))return!0}return!1}function Lu(e,t,i,r){const n=ee([],[e,t,i,1],r);return new Ee(n[0]/n[3],n[1]/n[3])}const Du=E(0,0,0),Ou=E(0,0,1);function Fu(e,t){const i=w();return Du[2]=t,e.intersectsPlane(Du,Ou,i),new Ee(i[0],i[1])}class ku extends Ih{}let Bu,Nu,Vu,Uu;function ju(e,{width:t,height:i},r,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==t*i*r)throw new RangeError("mismatched image size")}else n=new Uint8Array(t*i*r);return e.width=t,e.height=i,e.data=n,e}function Gu(e,t,i){const{width:r,height:n}=t;r===e.width&&n===e.height||(qu(e,t,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,r),height:Math.min(e.height,n)},i,null),e.width=r,e.height=n,e.data=t.data)}function qu(e,t,i,r,n,o,s,a){if(0===n.width||0===n.height)return t;if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const l=e.data,c=t.data,h=4===o&&a;for(let u=0;u<n.height;u++){const a=((i.y+u)*e.width+i.x)*o,d=((r.y+u)*t.width+r.x)*o;if(h)for(let e=0;e<n.width;e++){const t=a+e*o+3,i=d+e*o;c[i+0]=255,c[i+1]=255,c[i+2]=255,c[i+3]=l[t]}else if(s)for(let e=0;e<n.width;e++){const t=a+e*o,i=d+e*o,r=new ci(l[t+0]/255,l[t+1]/255,l[t+2]/255,l[t+3]).toNonPremultipliedRenderColor(s).toArray();c[i+0]=r[0],c[i+1]=r[1],c[i+2]=r[2],c[i+3]=r[3]}else for(let e=0;e<n.width*o;e++)c[d+e]=l[a+e]}
vendor: 5,038 bytes, line 2
2return t}es(ku,"HeatmapBucket",{omit:["layers"]});class Hu{constructor(e,t){ju(this,e,1,t)}resize(e){Gu(this,new Hu(e),1)}clone(){return new Hu({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,r,n){qu(e,t,i,r,n,1,null)}}class $u{constructor(e,t){ju(this,e,4,t)}resize(e){Gu(this,new $u(e),4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new $u({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,r,n,o,s){qu(e,t,i,r,n,4,o,s)}}class Zu{constructor(e,t){this.width=e.width,this.height=e.height,this.data=t instanceof Uint8Array?new Float32Array(t.buffer):t}}function Wu(e){const t={},i=e.resolution||256,r=e.clips?e.clips.length:1,n=e.image||new $u({width:i,height:r}),o=(i,r,o)=>{t[e.evaluationKey]=o;const s=e.expression.evaluate(t),a=s?s.toNonPremultipliedRenderColor(null):null;a&&(n.data[i+r+0]=Math.floor(255*a.r),n.data[i+r+1]=Math.floor(255*a.g),n.data[i+r+2]=Math.floor(255*a.b),n.data[i+r+3]=Math.floor(255*a.a))};if(e.clips)for(let s=0,a=0;s<r;++s,a+=4*i)for(let t=0,r=0;t<i;t++,r+=4){const n=t/(i-1),{start:l,end:c}=e.clips[s];o(a,r,l*(1-n)+c*n)}else for(let s=0,a=0;s<i;s++,a+=4)o(0,a,s/(i-1));return n}es(Hu,"AlphaImage"),es($u,"RGBAImage");const Xu=Na([{name:"a_pos",components:2,type:"Int16"}],4),Yu=Na([{name:"a_road_z_offset",components:1,type:"Float32"}],4),Ku=Na([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),Ju=Na([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function Qu(e,t,i=2){const r=t&&t.length,n=r?t[0]*i:e.length;let o=ed(e,0,n,i,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,c;if(r&&(o=function(e,t,i,r){const n=[];for(let o=0,s=t.length;o<s;o++){const i=ed(e,t[o]*r,o<s-1?t[o+1]*r:e.length,r,!1);i===i.next&&(i.steiner=!0),n.push(ud(i))}n.sort(ad);for(let o=0;o<n.length;o++)i=ld(n[o],i);return i}(e,t,o,i)),e.length>80*i){a=e[0],l=e[1];let t=a,r=l;for(let o=i;o<n;o+=i){const i=e[o],n=e[o+1];i<a&&(a=i),n<l&&(l=n),i>t&&(t=i),n>r&&(r=n)}c=Math.max(t-a,r-l),c=0!==c?32767/c:0}return id(o,s,i,a,l,c,0),s}function ed(e,t,i,r,n){let o;if(n===function(e,t,i,r){let n=0;for(let o=t,s=i-r;o<i;o+=r)n+=(e[s]-e[o])*(e[o+1]+e[s+1]),s=o;return n}(e,t,i,r)>0)for(let s=t;s<i;s+=r)o=wd(s/r|0,e[s],e[s+1],o);else for(let s=i-r;s>=t;s-=r)o=wd(s/r|0,e[s],e[s+1],o);return o&&_d(o,o.next)&&(Td(o),o=o.next),o}function td(e,t){if(!e)return e;t||(t=e);let i,r=e;do{if(i=!1,r.steiner||!_d(r,r.next)&&0!==md(r.prev,r,r.next))r=r.next;else{if(Td(r),r=t=r.prev,r===r.next)break;i=!0}}while(i||r!==t);return t}function id(e,t,i,r,n,o,s){if(!e)return;!s&&o&&function(e,t,i,r){let n=e;do{0===n.z&&(n.z=hd(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){let t,i=1;do{let r,n=e;e=null;let o=null;for(t=0;n;){t++;let s=n,a=0;for(let e=0;e<i&&(a++,s=s.nextZ,s);e++);let l=i;for(;a>0||l>0&&s;)0!==a&&(0===l||!s||n.z<=s.z)?(r=n,n=n.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;n=s}o.nextZ=null,i*=2}while(t>1)}(n)}(e,r,n,o);let a=e;for(;e.prev!==e.next;){const l=e.prev,c=e.next;if(o?nd(e,r,n,o):rd(e))t.push(l.i,e.i,c.i),Td(e),e=c.next,a=c.next;else if((e=c)===a){s?1===s?id(e=od(td(e),t),t,i,r,n,o,2):2===s&&sd(e,t,i,r,n,o):id(td(e),t,i,r,n,o,1);break}}}function rd(e){const t=e.prev,i=e,r=e.next;if(md(t,i,r)>=0)return!1;const n=t.x,o=i.x,s=r.x,a=t.y,l=i.y,c=r.y,h=Math.min(n,o,s),u=Math.min(a,l,c),d=Math.max(n,o,s),p=Math.max(a,l,c);let f=r.next;for(;f!==t;){if(f.x>=h&&f.x<=d&&f.y>=u&&f.y<=p&&pd(n,a,o,l,s,c,f.x,f.y)&&md(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function nd(e,t,i,r){const n=e.prev,o=e,s=e.next;if(md(n,o,s)>=0)return!1;const a=n.x,l=o.x,c=s.x,h=n.y,u=o.y,d=s.y,p=Math.min(a,l,c),f=Math.min(h,u,d),m=Math.max(a,l,c),_=Math.max(h,u,d),g=hd(p,f,t,i,r),y=hd(m,_,t,i,r);let x=e.prevZ,v=e.nextZ;for(;x&&x.z>=g&&v&&v.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==s&&pd(a,h,l,u,c,d,x.x,x.y)&&md(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==s&&pd(a,h,l,u,c,d,v.x,v.y)&&md(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;x&&x.z>=g;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==s&&pd(a,h,l,u,c,d,x.x,x.y)&&md(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==s&&pd(a,h,l,u,c,d,v.x,v.y)&&md(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function od(e,t){let i=e;do{const r=i.prev,n=i.next.next;!_d(r,n)&&gd(r,i,i.next,n)&&vd(r,n)&&vd(n,r)&&(t.push(r.i,i.i,n.i),Td(i),Td(i.next),i=e=n),i=i.next}while(i!==e);return td(i)}function sd(e,t,i,r,n,o){let s=e;do{let e=s.next.next;for(;e!==s.prev;){if(s.i!==e.i&&fd(s,e)){let a=bd(s,e);return s=td(s,s.next),a=td(a,a.next),id(s,t,i,r,n,o,0),void id(a,t,i,r,n,o,0)}e=e.next}s=s.next}while(s!==e)}function ad(e,t){let i=e.x-t.x;return 0===i&&(i=e.y-t.y,0===i)&&(i=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),i}function ld(e,t){const i=function(e,t){let i=t;const r=e.x,n=e.y;let o,s=-1/0;
vendor: 12,108 bytes, line 2
2if(_d(e,i))return i;do{if(_d(e,i.next))return i.next;if(n<=i.y&&n>=i.next.y&&i.next.y!==i.y){const e=i.x+(n-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=r&&e>s&&(s=e,o=i.x<i.next.x?i:i.next,e===r))return o}i=i.next}while(i!==t);if(!o)return null;const a=o,l=o.x,c=o.y;let h=1/0;i=o;do{if(r>=i.x&&i.x>=l&&r!==i.x&&dd(n<c?r:s,n,l,c,n<c?s:r,n,i.x,i.y)){const t=Math.abs(n-i.y)/(r-i.x);vd(i,e)&&(t<h||t===h&&(i.x>o.x||i.x===o.x&&cd(o,i)))&&(o=i,h=t)}i=i.next}while(i!==a);return o}(e,t);if(!i)return t;const r=bd(i,e);return td(r,r.next),td(i,i.next)}function cd(e,t){return md(e.prev,e,t.prev)<0&&md(t.next,e,e.next)<0}function hd(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function ud(e){let t=e,i=e;do{(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next}while(t!==e);return i}function dd(e,t,i,r,n,o,s,a){return(n-s)*(t-a)>=(e-s)*(o-a)&&(e-s)*(r-a)>=(i-s)*(t-a)&&(i-s)*(o-a)>=(n-s)*(r-a)}function pd(e,t,i,r,n,o,s,a){return!(e===s&&t===a)&&dd(e,t,i,r,n,o,s,a)}function fd(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&gd(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(vd(e,t)&&vd(t,e)&&function(e,t){let i=e,r=!1;const n=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)&&(md(e.prev,e,t.prev)||md(e,t.prev,t))||_d(e,t)&&md(e.prev,e,e.next)>0&&md(t.prev,t,t.next)>0)}function md(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function _d(e,t){return e.x===t.x&&e.y===t.y}function gd(e,t,i,r){const n=xd(md(e,t,i)),o=xd(md(e,t,r)),s=xd(md(i,r,e)),a=xd(md(i,r,t));return n!==o&&s!==a||!(0!==n||!yd(e,i,t))||!(0!==o||!yd(e,r,t))||!(0!==s||!yd(i,e,r))||!(0!==a||!yd(i,t,r))}function yd(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 xd(e){return e>0?1:e<0?-1:0}function vd(e,t){return md(e.prev,e,e.next)<0?md(e,t,e.next)>=0&&md(e,e.prev,t)>=0:md(e,t,e.prev)<0||md(e,e.next,t)<0}function bd(e,t){const i=Sd(e.i,e.x,e.y),r=Sd(t.i,t.x,t.y),n=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function wd(e,t,i,r){const n=Sd(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function Td(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 Sd(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Ed(e,t){const i=e.length;if(i<=1)return[e];const r=[];let n,o;for(let s=0;s<i;s++){const t=Ye(e[s]);0!==t&&(e[s].area=Math.abs(t),void 0===o&&(o=t<0),o===t<0?(n&&r.push(n),n=[e[s]]):n.push(e[s]))}if(n&&r.push(n),t>1)for(let s=0;s<r.length;s++)r[s].length<=t||(lr(r[s],t,1,r[s].length-1,Id),r[s]=r[s].slice(0,t));return r}function Id(e,t){return t.area-e.area}function Ad(e,t,i=1){if(!e)return null;const r="string"==typeof e?Ni.from(e).getPrimary():e.getPrimary(),n="string"==typeof e?null:e.getSecondary();for(const o of[r,n]){if(!o)continue;const e=o.id.toString();t.has(e)||t.set(e,[]),o.scaleSelf(i),t.get(e).push(o)}return{primary:r.toString(),secondary:n?n.toString():null}}function Md(e,t,i,r){const n=r.patternDependencies;let o=!1;for(const s of t){const t=s.paint.get(`${e}-pattern`);t.isConstant()||(o=!0),Ad(t.constantOr(null),n,i)&&(o=!0)}return o}function Cd(e,t,i,r,n,o){const s=o.patternDependencies;for(const a of t){const t=a.paint.get(`${e}-pattern`).value;if("constant"!==t.kind){let e=t.evaluate({zoom:r},i,{},o.availableImages);e=e&&e.name?e.name:e;const l=Ad(e,s,n);if(!l)continue;const{primary:c,secondary:h}=l;c&&(i.patterns[a.id]=[c,h].filter(Boolean))}}return i}class Pd{constructor(){this.portals=[]}static isOnBorder(e,t){return e<=0&&t<=0||e>=Ur&&t>=Ur}static evaluate(e){if(0===e.length)return new Pd;let t=[];for(const a of e)t.push(...a.portals);if(0===t.length)return new Pd;for(const a of t){const e=a.va,t=a.vb;(Pd.isOnBorder(e.x,t.x)||Pd.isOnBorder(e.y,t.y))&&(a.type="border")}const i=t.filter(e=>"unevaluated"!==e.type),r=t.filter(e=>"unevaluated"===e.type);if(0===r.length)return new Pd;r.sort((e,t)=>e.hash===t.hash?e.isTunnel===t.isTunnel?0:e.isTunnel?-1:1:e.hash<t.hash?1:-1),t=i.concat(r);let n=i.length,o=n,s=n;do{if(o++,o===t.length||t[n].hash!==t[o].hash){if(o-n===2){s<n&&(t[s]=t[n],t[n]=null);const e=t[s],i=t[o-1];e.type=e.isTunnel!==i.isTunnel?"tunnel":"polygon",e.connection={a:e.connection.a,b:i.connection.a},s++}n=o}}while(n!==t.length);return t.splice(s),t.sort((e,t)=>e.hash<t.hash?1:-1),{portals:t}}}es(Pd,"ElevationPortalGraph");class Rd{constructor(e,t,i){this.outPositions=e,this.outNormals=t,this.outIndices=i,this.vertexLookup=new Map}addVertex(e,t,i){let r=e[2];null!=i&&(r*=i);const n=`${e[0]},${e[1]},${e[2]},${t[0]},${t[1]},${t[2]}`,o=this.vertexLookup.get(n);if(null!=o)return o;const s=this.outPositions.length;this.vertexLookup.set(n,s);const a=Math.trunc(16384*t[0]),l=Math.trunc(16384*t[1]),c=Math.trunc(16384*t[2]);return this.outPositions.emplaceBack(e[0],e[1],r),this.outNormals.emplaceBack(a,l,c),s}addTriangle(e,t,i){this.outIndices.emplaceBack(e,t,i)}addTriangles(e,t,i){if(0===e.length)return;const r=1===i.length,n=w(),o=w();for(let s=0;s<e.length;s+=3){const a=t[e[s+0]],l=t[e[s+1]],c=t[e[s+2]],h=r?i[0]:i[e[s+1]],u=r?i[0]:i[e[s+2]];I(n,a.x,a.y,r?i[0]:i[e[s+0]]);const d=this.addVertex(n,o);I(n,l.x,l.y,h);const p=this.addVertex(n,o);I(n,c.x,c.y,u);const f=this.addVertex(n,o);this.outIndices.emplaceBack(d,p,f)}}addQuad(e,t,i,r,n,o){const s=this.addVertex(e,n,o),a=this.addVertex(t,n,o),l=this.addVertex(i,n,o),c=this.addVertex(r,n,o);this.addTriangle(s,a,l),this.addTriangle(l,c,s)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}}class zd{constructor(e,t,i,r){this.unevaluatedPortals=new Pd,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new Ha,this.vertexNormals=new $a,this.indexArray=new ll,this.tileToMeters=jc(e),this.bridgeProgramConfigurations=new fc(t,{zoom:i,lut:r},e=>"fill-tunnel-structure-color"!==e),this.tunnelProgramConfigurations=new fc(t,{zoom:i,lut:r},e=>"fill-bridge-guard-rail-color"!==e)}addVertices(e,t){const i=this.unevalVertices.length;for(let r=0;r<e.length;r++)this.unevalVertices.push(e[r]),this.unevalHeights.push(t[r]);return i}addTriangles(e,t,i){const r=i?this.unevalTunnelTriangles:this.unevalTriangles;for(const n of e)r.push(n+t)}addRenderableRing(e,t,i,r,n,o){const s=[new Ee(n.min.x,n.min.y),new Ee(n.max.x,n.min.y),new Ee(n.max.x,n.max.y),new Ee(n.min.x,n.max.y)];for(let a=0;a<i-1;a++){const i=t+a,l=i+1,c=this.unevalVertices[i],h=this.unevalVertices[l];if(!(c.x>=n.min.x&&c.x<=n.max.x&&c.y>=n.min.y&&c.y<=n.max.y||h.x>=n.min.x&&h.x<=n.max.x&&h.y>=n.min.y&&h.y<=n.max.y||Vh(c,h,s)))continue;if(this.isOnBorder(c.x,h.x)||this.isOnBorder(c.y,h.y))continue;const u=zd.computeEdgeHash(this.unevalVertices[i],this.unevalVertices[l]);let d,p=this.vertexHashLookup.get(zd.computePosHash(c));null!=p?d=p.next:(p=this.vertexHashLookup.get(zd.computePosHash(h)),d=null!=p?p.prev:u),this.unevalEdges.push({polygonIdx:e,a:i,b:l,hash:u,portalHash:d,isTunnel:r,type:"unevaluated",featureInfo:o})}}addPortalCandidates(e,t,i,r,n){if(0!==t.length){this.vertexHashLookup.clear();for(const n of t){if(0===n.length)continue;const t=n[0];let o=zd.computeEdgeHash(t[t.length-2],t[t.length-1]);for(let n=0;n<t.length-1;n++){const s=t[n+0],a=t[n+1],l=ue(a.x-s.x,a.y-s.y),c=_e(l);if(0===c)continue;let h="unevaluated";const u=r.pointElevation(s),d=r.pointElevation(a);Math.abs(u)<.01&&Math.abs(d)<.01?h="entrance":(this.isOnBorder(s.x,a.x)||this.isOnBorder(s.y,a.y))&&(h="border");const p=zd.computeEdgeHash(s,a);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:s,vb:a,vab:l,length:c,hash:p,isTunnel:i,type:h});const f=zd.computePosHash(s);this.vertexHashLookup.set(f,{prev:o,next:p}),o=p}}}}construct(e){if(0===this.unevalVertices.length)return;const t=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),i=e=>{e.primitiveLength=this.indexArray.length-e.primitiveOffset},r=new Rd(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const n=t(),o=t(),s=t(),a=(e,t)=>{e.sort((e,i)=>e.type===t&&i.type!==t?-1:e.type!==t&&i.type===t?1:0);const i=e.findIndex(e=>e.type!==t);return i>=0?i:e.length};let l=0;this.unevalEdges.length>0&&(l=a(this.unevalEdges,"none"),this.constructBridgeStructures(r,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:l},this.tileToMeters)),i(s);const c=t(),h=t();if(this.unevalEdges.length>0){const e=this.unevalEdges.splice(l),t=a(e,"tunnel")+l;this.unevalEdges.push(...e),this.constructTunnelStructures(r,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:l},{min:l,max:t})}i(c),r.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),i(h),r.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),i(o),r.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),i(n),this.maskSegments=Nl.simpleSegment(0,h.primitiveOffset,0,h.primitiveLength),this.depthSegments=Nl.simpleSegment(0,o.primitiveOffset,0,o.primitiveLength),this.renderableBridgeSegments=Nl.simpleSegment(0,s.primitiveOffset,0,s.primitiveLength),this.renderableTunnelSegments=Nl.simpleSegment(0,c.primitiveOffset,0,c.primitiveLength),this.shadowCasterSegments=Nl.simpleSegment(0,n.primitiveOffset,0,n.primitiveLength)}update(e,t,i,r,n,o,s,a){this.bridgeProgramConfigurations.updatePaintArrays(e,t,n,i,r,o,s,a),this.tunnelProgramConfigurations.updatePaintArrays(e,t,n,i,r,o,s,a)}upload(e){this.vertexBuffer||0===this.vertexPositions.length||0===this.vertexNormals.length||0===this.indexArray.length||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,Ku.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,Ju.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(e),this.tunnelProgramConfigurations.upload(e))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableBridgeSegments.destroy(),this.renderableTunnelSegments.destroy(),this.shadowCasterSegments.destroy()),this.bridgeProgramConfigurations.destroy(),this.tunnelProgramConfigurations.destroy()}populatePaintArrays(e,t,i,r,n){const o=(o,s)=>{for(let a=0;a<s.length-1;a++){const l=s[a].featureIndex,c=s[a+1].vertexStart,h=e.feature(l);o.populatePaintArrays(c,h,l,{},i,t,r,void 0,n)}};o(this.bridgeProgramConfigurations,this.bridgeFeatureSections),o(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(e,t,i,r,n){const o=new Map;for(let s=r;s<n;s++){const r=i[s],n=r.a,a=r.b,l=zd.computePosHash(e[n]),c=zd.computePosHash(e[a]);let h=o.get(l);h||(h={},o.set(l,h));let u=o.get(c);u||(u={},o.set(c,u)),t[n]<=0&&t[a]<=0||(h.to=a,u.from=n)}return o}isTerminalVertex(e,t){const i=zd.computePosHash(this.unevalVertices[e]),r=t.get(i);return!r||!r.from||!r.to}constructBridgeStructures(e,t,i,r,n,o){e.clearVertexLookup();const s=this.computeVertexConnections(t,i,r,n.min,n.max),a=1/o,l=.5*a,c=(e,r)=>I(e,t[r].x,t[r].y,i[r]*a),h=w(),u=w(),d=w(),p=w(),f=w(),m=(e,i)=>{const r=s.get(zd.computePosHash(t[i])),n=r.from,o=r.to;if(!n||!o)return;c(h,n),c(u,i),c(d,o),H(p),$(h,u)||(Z(f,u,h),B(p,f)),$(d,u)||(Z(f,d,u),A(p,p,B(f,f)));const a=X(p);return a>0?z(e,p,1/a):void 0};let _=Number.POSITIVE_INFINITY;this.sortSubarray(r,n.min,n.max,(e,t)=>e.featureInfo.featureIndex-t.featureInfo.featureIndex);const g=w(),y=w(),x=w(),v=w(),b=w(),T=w(),S=w(),E=w(),M=w(),C=[w(),w(),w(),w()],P=[w(),w(),w(),w()],R=[{
vendor: 16,808 bytes, line 2
2coord:new Ee(0,0),height:0},{coord:new Ee(0,0),height:0}],L=(e,t)=>e>t;for(let w=n.min;w<n.max;w++){const n=r[w];if(!n.featureInfo.guardRailEnabled)continue;if(!this.prepareEdgePoints(R,t,i,n,L))continue;const[c,h]=R;if(I(g,c.coord.x,c.coord.y,a*c.height),I(y,h.coord.x,h.coord.y,a*h.height),$(g,y))continue;Z(x,y,g),B(x,x);const u=m(E,n.a)||x,d=m(M,n.b)||x;I(v,u[1],-u[0],0),B(v,v),I(b,d[1],-d[0],0),B(b,b),V(E,v,u),B(T,E),V(E,b,d),B(S,E),A(C[0],g,z(E,Z(E,v,T),l)),A(C[1],g,z(E,A(E,v,T),l)),A(C[2],g,z(E,T,l)),C[3]=g,A(P[0],y,z(E,Z(E,b,S),l)),A(P[1],y,z(E,A(E,b,S),l)),A(P[2],y,z(E,S,l)),P[3]=y,_=this.addFeatureSection(n.featureInfo.featureIndex,_,this.bridgeFeatureSections,e);const p=e.addVertex(C[0],v,o),f=e.addVertex(C[1],v,o),D=e.addVertex(P[0],b,o),O=e.addVertex(P[1],b,o);e.addTriangle(p,f,D),e.addTriangle(f,O,D);const F=e.addVertex(C[1],T,o),N=e.addVertex(C[2],T,o),U=e.addVertex(P[1],S,o),j=e.addVertex(P[2],S,o);e.addTriangle(F,N,U),e.addTriangle(N,j,U),k(v,v),k(b,b);const G=e.addVertex(C[2],v,o),q=e.addVertex(C[3],v,o),H=e.addVertex(P[2],b,o),W=e.addVertex(P[3],b,o);e.addTriangle(G,q,H),e.addTriangle(q,W,H);const X=this.isTerminalVertex(n.a,s),Y=this.isTerminalVertex(n.b,s);c.height<.01&&X&&e.addQuad(C[3],C[2],C[1],C[0],k(u,u),o),h.height<.01&&Y&&e.addQuad(P[0],P[1],P[2],P[3],d,o)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}constructTunnelStructures(e,t,i,r,n,o){e.clearVertexLookup();let s=Number.POSITIVE_INFINITY;const a=(e,t)=>e.featureInfo.featureIndex-t.featureInfo.featureIndex;this.sortSubarray(r,n.min,n.max,a),this.sortSubarray(r,o.min,o.max,a);const l=e=>B(e,e),c=[{coord:new Ee(0,0),height:0},{coord:new Ee(0,0),height:0}],h=(e,t)=>e<t,u=w(),d=w(),p=w(),f=w(),m=w();for(let _=n.min;_<n.max;_++){if(!this.prepareEdgePoints(c,t,i,r[_],h))continue;const[n,o]=c,a=l(I(m,-(o.coord.y-n.coord.y),o.coord.x-n.coord.x,0));s=this.addFeatureSection(r[_].featureInfo.featureIndex,s,this.tunnelFeatureSections,e),e.addQuad(I(u,n.coord.x,n.coord.y,n.height),I(d,o.coord.x,o.coord.y,o.height),I(p,o.coord.x,o.coord.y,r[_].isTunnel?-.1:0),I(f,n.coord.x,n.coord.y,r[_].isTunnel?-.1:0),a)}for(let _=o.min;_<o.max;_++){const n=r[_];n.isTunnel&&([n.a,n.b]=[n.b,n.a]);const o=t[n.a],a=t[n.b],c=l(I(m,-(a.y-o.y),a.x-o.x,0));s=this.addFeatureSection(n.featureInfo.featureIndex,s,this.tunnelFeatureSections,e),e.addQuad(I(u,a.x,a.y,0),I(d,o.x,o.y,0),I(p,o.x,o.y,i[n.a]+4),I(f,a.x,a.y,i[n.b]+4),c),e.addQuad(I(u,o.x,o.y,0),I(d,a.x,a.y,0),I(p,a.x,a.y,i[n.b]+4),I(f,o.x,o.y,i[n.a]+4),c)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}setElevatedPoint(e,t,i,r){e.coord.x=t,e.coord.y=i,e.height=r}prepareEdgePoints(e,t,i,r,n){let o=t[r.a].x,s=t[r.a].y,a=t[r.b].x,l=t[r.b].y,c=i[r.a],h=i[r.b];const u=n(c,0),d=n(h,0);if(u&&d)return this.setElevatedPoint(e[0],o,s,c),this.setElevatedPoint(e[1],a,l,h),!0;if(!u&&!d)return!1;if(u){if(!d){const e=h/(h-c);a=pi(a,o,e),l=pi(l,s,e),h=pi(h,c,e)}}else{const e=c/(c-h);o=pi(o,a,e),s=pi(s,l,e),c=pi(c,h,e)}return this.setElevatedPoint(e[0],o,s,c),this.setElevatedPoint(e[1],a,l,h),!0}prepareEdges(e,t){if(0===t.length)return;t.sort((e,t)=>e.hash===t.hash?t.polygonIdx-e.polygonIdx:t.hash>e.hash?1:-1);let i=0,r=0,n=0,o=t[i].polygonIdx;do{r++,(r===t.length||t[i].hash!==t[r].hash)&&((1===r-i||t[r-1].polygonIdx!==o)&&(n<i&&(t[n]=t[i],t[i]=null),t[n].type="none",n++),i=r,i!==t.length&&(o=t[i].polygonIdx))}while(i!==t.length);if(t.splice(n),0!==t.length&&0!==e.length){t.sort((e,t)=>e.portalHash<t.portalHash?1:-1);let i=0,r=0;for(;i!==t.length&&r!==e.length;){const n=t[i],o=e[r];n.portalHash>o.hash?i++:o.hash>n.portalHash?r++:(n.type=o.type,i++)}}}isOnBorder(e,t){return e<=0&&t<=0||e>=Ur&&t>=Ur}addFeatureSection(e,t,i,r){return e!==t&&(t=e,i.push({featureIndex:e,vertexStart:r.getVertexCount()}),r.clearVertexLookup()),t}sortSubarray(e,t,i,r){const n=e.slice(t,i);n.sort(r),e.splice(t,n.length,...n)}static computeEdgeHash(e,t){return(e.y===t.y&&e.x>t.x||e.y>t.y)&&([e,t]=[t,e]),BigInt(zd.computePosHash(e))<<32n|BigInt(zd.computePosHash(t))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}function Ld(e,t){return e>t?1:e<t?-1:0}class Dd{constructor(e=Ld,t=!1){this._compare=e,this._root=null,this._size=0,this._noDuplicates=!!t}rotateLeft(e){var t=e.right;t&&(e.right=t.left,t.left&&(t.left.parent=e),t.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.left=e),e.parent=t}rotateRight(e){var t=e.left;t&&(e.left=t.right,t.right&&(t.right.parent=e),t.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.right=e),e.parent=t}_splay(e){for(;e.parent;){var t=e.parent;t.parent?t.left===e&&t.parent.left===t?(this.rotateRight(t.parent),this.rotateRight(t)):t.right===e&&t.parent.right===t?(this.rotateLeft(t.parent),this.rotateLeft(t)):t.left===e&&t.parent.right===t?(this.rotateRight(t),this.rotateLeft(t)):(this.rotateLeft(t),this.rotateRight(t)):t.left===e?this.rotateRight(t):this.rotateLeft(t)}}splay(e){for(var t,i,r,n,o;e.parent;)(i=(t=e.parent).parent)&&i.parent?((r=i.parent).left===i?r.left=e:r.right=e,e.parent=r):(e.parent=null,this._root=e),n=e.left,o=e.right,e===t.left?(i&&(i.left===t?(t.right?(i.left=t.right,i.left.parent=i):i.left=null,t.right=i,i.parent=t):(n?(i.right=n,n.parent=i):i.right=null,e.left=i,i.parent=e)),o?(t.left=o,o.parent=t):t.left=null,e.right=t,t.parent=e):(i&&(i.right===t?(t.left?(i.right=t.left,i.right.parent=i):i.right=null,t.left=i,i.parent=t):(o?(i.left=o,o.parent=i):i.left=null,e.right=i,i.parent=e)),n?(t.right=n,n.parent=t):t.right=null,e.left=t,t.parent=e)}replace(e,t){e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.parent=e.parent)}minNode(e=this._root){if(e)for(;e.left;)e=e.left;return e}maxNode(e=this._root){if(e)for(;e.right;)e=e.right;return e}insert(e,t){var i=this._root,r=null,n=this._compare;if(this._noDuplicates)for(;i;){if(r=i,0===n(i.key,e))return;i=n(i.key,e)<0?i.right:i.left}else for(;i;)r=i,i=n(i.key,e)<0?i.right:i.left;return i={key:e,data:t,left:null,right:null,parent:r},r?n(r.key,i.key)<0?r.right=i:r.left=i:this._root=i,this.splay(i),this._size++,i}find(e){for(var t=this._root,i=this._compare;t;){var r=i(t.key,e);if(r<0)t=t.right;else{if(!(r>0))return t;t=t.left}}return null}contains(e){for(var t=this._root,i=this._compare;t;){var r=i(e,t.key);if(0===r)return!0;t=r<0?t.left:t.right}return!1}remove(e){var t=this.find(e);if(!t)return!1;if(this.splay(t),t.left)if(t.right){var i=this.minNode(t.right);i.parent!==t&&(this.replace(i,i.right),i.right=t.right,i.right.parent=i),this.replace(t,i),i.left=t.left,i.left.parent=i}else this.replace(t,t.left);else this.replace(t,t.right);return this._size--,!0}removeNode(e){if(!e)return!1;if(this.splay(e),e.left)if(e.right){var t=this.minNode(e.right);t.parent!==e&&(this.replace(t,t.right),t.right=e.right,t.right.parent=t),this.replace(e,t),t.left=e.left,t.left.parent=t}else this.replace(e,e.left);else this.replace(e,e.right);return this._size--,!0}erase(e){var t=this.find(e);if(t){this.splay(t);var i=t.left,r=t.right,n=null;i&&(i.parent=null,n=this.maxNode(i),this.splay(n),this._root=n),r&&(i?n.right=r:this._root=r,r.parent=n),this._size--}}pop(){var e=this._root,t=null;if(e){for(;e.left;)e=e.left;t={key:e.key,data:e.data},this.remove(e.key)}return t}next(e){var t=e;if(t)if(t.right)for(t=t.right;t&&t.left;)t=t.left;else for(t=e.parent;t&&t.right===e;)e=t,t=t.parent;return t}prev(e){var t=e;if(t)if(t.left)for(t=t.left;t&&t.right;)t=t.right;else for(t=e.parent;t&&t.left===e;)e=t,t=t.parent;return t}forEach(e){for(var t=this._root,i=[],r=!1,n=0;!r;)t?(i.push(t),t=t.left):i.length>0?(e(t=i.pop(),n++),t=t.right):r=!0;return this}range(e,t,i,r){const n=[],o=this._compare;let s,a=this._root;for(;0!==n.length||a;)if(a)n.push(a),a=a.left;else{if(a=n.pop(),s=o(a.key,t),s>0)break;if(o(a.key,e)>=0&&i.call(r,a))return this;a=a.right}return this}keys(){for(var e=this._root,t=[],i=[],r=!1;!r;)e?(t.push(e),e=e.left):t.length>0?(e=t.pop(),i.push(e.key),e=e.right):r=!0;return i}values(){for(var e=this._root,t=[],i=[],r=!1;!r;)e?(t.push(e),e=e.left):t.length>0?(e=t.pop(),i.push(e.data),e=e.right):r=!0;return i}at(e){for(var t=this._root,i=[],r=!1,n=0;!r;)if(t)i.push(t),t=t.left;else if(i.length>0){if(t=i.pop(),n===e)return t;n++,t=t.right}else r=!0;return null}load(e=[],t=[],i=!1){if(0!==this._size)throw new Error("bulk-load: tree is not empty");const r=e.length;return i&&Fd(e,t,0,r-1,this._compare),this._root=Od(null,e,t,0,r),this._size=r,this}min(){var e=this.minNode(this._root);return e?e.key:null}max(){var e=this.maxNode(this._root);return e?e.key:null}isEmpty(){return null===this._root}get size(){return this._size}static createTree(e,t,i,r,n){return new Dd(i,n).load(e,t,r)}}function Od(e,t,i,r,n){const o=n-r;if(o>0){const s=r+Math.floor(o/2),a={key:t[s],data:i[s],parent:e};return a.left=Od(a,t,i,r,s),a.right=Od(a,t,i,s+1,n),a}return null}function Fd(e,t,i,r,n){if(i>=r)return;const o=e[i+r>>1];let s=i-1,a=r+1;for(;;){do{s++}while(n(e[s],o)<0);do{a--}while(n(e[a],o)>0);if(s>=a)break;let i=e[s];e[s]=e[a],e[a]=i,i=t[s],t[s]=t[a],t[a]=i}Fd(e,t,i,a,n),Fd(e,t,a+1,r,n)}const kd=11102230246251565e-32,Bd=134217729,Nd=(3+8*kd)*kd;function Vd(e,t,i,r,n){let o,s,a,l,c=t[0],h=r[0],u=0,d=0;h>c==h>-c?(o=c,c=t[++u]):(o=h,h=r[++d]);let p=0;if(u<e&&d<i)for(h>c==h>-c?(s=c+o,a=o-(s-c),c=t[++u]):(s=h+o,a=o-(s-h),h=r[++d]),o=s,0!==a&&(n[p++]=a);u<e&&d<i;)h>c==h>-c?(s=o+c,l=s-o,a=o-(s-l)+(c-l),c=t[++u]):(s=o+h,l=s-o,a=o-(s-l)+(h-l),h=r[++d]),o=s,0!==a&&(n[p++]=a);for(;u<e;)s=o+c,l=s-o,a=o-(s-l)+(c-l),c=t[++u],o=s,0!==a&&(n[p++]=a);for(;d<i;)s=o+h,l=s-o,a=o-(s-l)+(h-l),h=r[++d],o=s,0!==a&&(n[p++]=a);return 0===o&&0!==p||(n[p++]=o),p}function Ud(e){return new Float64Array(e)}const jd=Ud(4),Gd=Ud(8),qd=Ud(12),Hd=Ud(16),$d=Ud(4);function Zd(e,t,i){null===t?(e.inOut=!1,e.otherInOut=!0):(e.isSubject===t.isSubject?(e.inOut=!t.inOut,e.otherInOut=t.otherInOut):(e.inOut=!t.otherInOut,e.otherInOut=t.isVertical()?!t.inOut:t.inOut),t&&(e.prevInResult=!Wd(t,i)||t.isVertical()?t.prevInResult:t)),e.resultTransition=Wd(e,i)?function(e,t){let i,r=!e.inOut,n=!e.otherInOut;switch(t){case 0:i=r&&n;break;case 1:i=r||n;break;case 3:i=r!==n;break;case 2:i=e.isSubject?r&&!n:n&&!r}return i?1:-1}(e,i):0}function Wd(e,t){switch(e.type){case 0:switch(t){case 0:return!e.otherInOut;case 1:return e.otherInOut;case 2:return e.isSubject&&e.otherInOut||!e.isSubject&&!e.otherInOut;case 3:return!0}break;case 2:return 0===t||1===t;case 3:return 2===t;case 1:return!1}return!1}class Xd{constructor(e,t,i,r,n){this.left=t,this.point=e,this.otherEvent=i,this.isSubject=r??!1,this.type=n||0,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0}isBelow(e){const t=this.point,i=this.otherEvent.point;return this.left?(t[0]-e[0])*(i[1]-e[1])-(i[0]-e[0])*(t[1]-e[1])>0:(i[0]-e[0])*(t[1]-e[1])-(t[0]-e[0])*(i[1]-e[1])>0}isAbove(e){return!this.isBelow(e)}isVertical(){return this.point[0]===this.otherEvent.point[0]}get inResult(){return 0!==this.resultTransition}clone(){const e=new Xd(this.point,this.left,this.otherEvent,this.isSubject,this.type);return e.contourId=this.contourId,e.resultTransition=this.resultTransition,e.prevInResult=this.prevInResult,e.isExteriorRing=this.isExteriorRing,e.inOut=this.inOut,e.otherInOut=this.otherInOut,e}}function Yd(e,t){return e[0]===t[0]&&e[1]===t[1]}function Kd(e,t,i){const r=function(e,t,i,r,n,o){const s=(t-o)*(i-n),a=(e-n)*(r-o),l=s-a;if(0===s||0===a||s>0!=a>0)return l;const c=Math.abs(s+a);return Math.abs(l)>=33306690738754716e-32*c?l:-function(e,t,i,r,n,o,s){let a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T,S;const E=e-n,I=i-n,A=t-o,M=r-o;v=E*M,d=Bd*E,p=d-(d-E),f=E-p,d=Bd*M,m=d-(d-M),_=M-m,b=f*_-(v-p*m-f*m-p*_),w=A*I,d=Bd*A,p=d-(d-A),f=A-p,d=Bd*I,m=d-(d-I),_=I-m,T=f*_-(w-p*m-f*m-p*_),g=b-T,u=b-g,jd[0]=b-(g+u)+(u-T),y=v+g,u=y-v,x=v-(y-u)+(g-u),g=x-w,u=x-g,jd[1]=x-(g+u)+(u-w),S=y+g,u=S-y,jd[2]=y-(S-u)+(g-u),jd[3]=S;let C=function(e,t){let i=t[0];for(let r=1;r<4;r++)i+=t[r];return i}(0,jd),P=22204460492503146e-32*s;if(C>=P||-C>=P)return C;if(u=e-E,a=e-(E+u)+(u-n),u=i-I,c=i-(I+u)+(u-n),u=t-A,l=t-(A+u)+(u-o),u=r-M,h=r-(M+u)+(u-o),0===a&&0===l&&0===c&&0===h)return C;if(P=11093356479670487e-47*s+Nd*Math.abs(C),C+=E*h+M*a-(A*c+I*l),C>=P||-C>=P)return C;v=a*M,d=Bd*a,p=d-(d-a),f=a-p,d=Bd*M,m=d-(d-M),_=M-m,b=f*_-(v-p*m-f*m-p*_),w=l*I,d=Bd*l,p=d-(d-l),f=l-p,d=Bd*I,m=d-(d-I),_=I-m,T=f*_-(w-p*m-f*m-p*_),g=b-T,u=b-g,$d[0]=b-(g+u)+(u-T),y=v+g,u=y-v,x=v-(y-u)+(g-u),g=x-w,u=x-g,$d[1]=x-(g+u)+(u-w),S=y+g,u=S-y,$d[2]=y-(S-u)+(g-u),$d[3]=S;const R=Vd(4,jd,4,$d,Gd);v=E*h,d=Bd*E,p=d-(d-E),f=E-p,d=Bd*h,m=d-(d-h),_=h-m,b=f*_-(v-p*m-f*m-p*_),w=A*c,d=Bd*A,p=d-(d-A),f=A-p,d=Bd*c,m=d-(d-c),_=c-m,T=f*_-(w-p*m-f*m-p*_),g=b-T,u=b-g,$d[0]=b-(g+u)+(u-T),y=v+g,u=y-v,x=v-(y-u)+(g-u),g=x-w,u=x-g,$d[1]=x-(g+u)+(u-w),S=y+g,u=S-y,$d[2]=y-(S-u)+(g-u),$d[3]=S;const z=Vd(R,Gd,4,$d,qd);v=a*h,d=Bd*a,p=d-(d-a),f=a-p,d=Bd*h,m=d-(d-h),_=h-m,b=f*_-(v-p*m-f*m-p*_),w=l*c,d=Bd*l,p=d-(d-l),f=l-p,d=Bd*c,m=d-(d-c),_=c-m,T=f*_-(w-p*m-f*m-p*_),g=b-T,u=b-g,$d[0]=b-(g+u)+(u-T),y=v+g,u=y-v,x=v-(y-u)+(g-u),g=x-w,u=x-g,$d[1]=x-(g+u)+(u-w),S=y+g,u=S-y,$d[2]=y-(S-u)+(g-u),$d[3]=S;const L=Vd(z,qd,4,$d,Hd);return Hd[L-1]}(e,t,i,r,n,o,c)}(e[0],e[1],t[0],t[1],i[0],i[1]);return r>0?-1:r<0?1:0}function Jd(e,t){const i=e.point,r=t.point;return i[0]>r[0]?1:i[0]<r[0]?-1:i[1]!==r[1]?i[1]>r[1]?1:-1:function(e,t,i){return e.left!==t.left?e.left?1:-1:0!==Kd(i,e.otherEvent.point,t.otherEvent.point)?e.isBelow(t.otherEvent.point)?-1:1:!e.isSubject&&t.isSubject?1:-1}(e,t,i)}function Qd(e,t,i){const r=new Xd(t,!1,e,e.isSubject),n=new Xd(t,!0,e.otherEvent,e.isSubject);return Yd(e.point,e.otherEvent.point)&&console.warn("what is that, a collapsed segment?",e),r.contourId=n.contourId=e.contourId,Jd(n,e.otherEvent)>0&&(e.otherEvent.left=!0,n.left=!1),e.otherEvent.otherEvent=n,e.otherEvent=r,i.push(n),i.push(r),i}function ep(e,t){return e[0]*t[1]-e[1]*t[0]}function tp(e,t){return e[0]*t[0]+e[1]*t[1]}function ip(e,t,i){const r=function(e,t,i,r){const n=[t[0]-e[0],t[1]-e[1]],o=[r[0]-i[0],r[1]-i[1]];function s(e,t,i){return[e[0]+t*i[0],e[1]+t*i[1]]}const a=[i[0]-e[0],i[1]-e[1]];let l=ep(n,o),c=l*l;const h=tp(n,n);if(c>0){const t=ep(a,o)/l;if(t<0||t>1)return null;const r=ep(a,n)/l;return r<0||r>1?null:0===t||1===t?[s(e,t,n)]:0===r||1===r?[s(i,r,o)]:[s(e,t,n)]}if(l=ep(a,n),c=l*l,c>0)return null;const u=tp(n,a)/h,d=u+tp(n,o)/h,p=Math.min(u,d),f=Math.max(u,d);return p<=1&&f>=0?1===p?[s(e,p>0?p:0,n)]:0===f?[s(e,f<1?f:1,n)]:[s(e,p>0?p:0,n),s(e,f<1?f:1,n)]:null}(e.point,e.otherEvent.point,t.point,t.otherEvent.point),n=r?r.length:0;if(0===n||1===n&&(Yd(e.point,t.point)||Yd(e.otherEvent.point,t.otherEvent.point))||2===n&&e.isSubject===t.isSubject)return 0;if(1===n)return!Yd(e.point,r[0])&&!Yd(e.otherEvent.point,r[0])&&Qd(e,r[0],i),!Yd(t.point,r[0])&&!Yd(t.otherEvent.point,r[0])&&Qd(t,r[0],i),1;const o=[];let s=!1,a=!1;return Yd(e.point,t.point)?s=!0:1===Jd(e,t)?o.push(t,e):o.push(e,t),Yd(e.otherEvent.point,t.otherEvent.point)?a=!0:1===Jd(e.otherEvent,t.otherEvent)?o.push(t.otherEvent,e.otherEvent):o.push(e.otherEvent,t.otherEvent),s&&a||s?(t.type=1,e.type=t.inOut===e.inOut?2:3,s&&!a&&Qd(o[1].otherEvent,o[0].point,i),2):a?(Qd(o[0],o[1].point,i),3):o[0]!==o[3].otherEvent?(Qd(o[0],o[1].point,i),Qd(o[1],o[2].point,i),3):(Qd(o[0],o[1].point,i),Qd(o[3].otherEvent,o[2].point,i),3)}function rp(e,t){if(e===t)return 0;if(0!==Kd(e.point,e.otherEvent.point,t.point)||0!==Kd(e.point,e.otherEvent.point,t.otherEvent.point))return Yd(e.point,t.point)?e.isBelow(t.otherEvent.point)?-1:1:e.point[0]===t.point[0]?e.point[1]<t.point[1]?-1:1:1===Jd(e,t)?t.isAbove(e.point)?-1:1:e.isBelow(t.point)?-1:1;if(e.isSubject!==t.isSubject)return e.isSubject?-1:1;{let i=e.point,r=t.point;if(i[0]===r[0]&&i[1]===r[1])return i=e.otherEvent.point,r=t.otherEvent.point,i[0]===r[0]&&i[1]===r[1]?0:(e.contourId??0)>(t.contourId??0)?1:-1}return 1===Jd(e,t)?1:-1}class np{constructor(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null}isExterior(){return null==this.holeOf}}function op(e,t,i,r){let n,o=e+1,s=t[e].point;const a=t.length;for(o<a&&(n=t[o].point);o<a&&n[0]===s[0]&&n[1]===s[1];){if(!i[o])return o;o++,o<a&&(n=t[o].point)}for(o=e-1;i[o]&&o>r;)o--;return o}function sp(e,t,i){const r=new np;if(null!=e.prevInResult){const n=e.prevInResult,o=n.outputContourId;if(n.resultTransition>0){const e=t[o];if(null!=e.holeOf){const n=e.holeOf;t[n].holeIds.push(i),r.holeOf=n,r.depth=t[o].depth}else t[o].holeIds.push(i),r.holeOf=o,r.depth=t[o].depth+1}else r.holeOf=null,r.depth=t[o].depth}else r.holeOf=null,r.depth=0;return r}const ap=Math.max,lp=Math.min;let cp=0;function hp(e,t,i,r,n,o){let s,a,l,c,h,u;
vendor: 13,398 bytes, line 2
2for(s=0,a=e.length-1;s<a;s++){if(l=e[s],c=e[s+1],h=new Xd(l,!1,void 0,t),u=new Xd(c,!1,h,t),h.otherEvent=u,l[0]===c[0]&&l[1]===c[1])continue;h.contourId=u.contourId=i,o||(h.isExteriorRing=!1,u.isExteriorRing=!1),Jd(h,u)>0?u.left=!0:h.left=!0;const a=l[0],d=l[1];n[0]=lp(n[0],a),n[1]=lp(n[1],d),n[2]=ap(n[2],a),n[3]=ap(n[3],d),r.push(h),r.push(u)}}const up=[];function dp(e,t,i){let r=e,n=t;"number"==typeof e[0][0][0]&&(r=[e]),"number"==typeof t[0][0][0]&&(n=[t]);let o=function(e,t,i){let r=null;return e.length*t.length===0&&(0===i?r=up:2===i?r=e:(1===i||3===i)&&(r=0===e.length?t:e)),r}(r,n,i);if(o)return o===up?null:o;const s=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],l=function(e,t,i,r,n){const o=new Vr(void 0,Jd);let s,a,l,c,h,u;for(l=0,c=e.length;l<c;l++)for(s=e[l],h=0,u=s.length;h<u;h++)a=0===h,a&&cp++,hp(s[h],!0,cp,o,i,a);for(l=0,c=t.length;l<c;l++)for(s=t[l],h=0,u=s.length;h<u;h++)a=0===h,2===n&&(a=!1),a&&cp++,hp(s[h],!1,cp,o,r,a);return o}(r,n,s,a,i);if(o=function(e,t,i,r,n){let o=null;return(i[0]>r[2]||r[0]>i[2]||i[1]>r[3]||r[1]>i[3])&&(0===n?o=up:2===n?o=e:(1===n||3===n)&&(o=e.concat(t))),o}(r,n,s,a,i),o)return o===up?null:o;const c=function(e,t,i,r,n,o){const s=new Dd(rp),a=[],l=Math.min(r[2],n[2]);let c,h,u;for(;0!==e.length;){let t=e.pop();if(a.push(t),0===o&&t.point[0]>l||2===o&&t.point[0]>r[2])break;if(t.left){h=c=s.insert(t),u=s.minNode(),c=c!==u?s.prev(c):null,h=s.next(h);const i=c?c.key:null;let r;if(Zd(t,i,o),h&&2===ip(t,h.key,e)&&(Zd(t,i,o),Zd(h.key,t,o)),c&&2===ip(c.key,t,e)){let e=c;e=e!==u?s.prev(e):null,r=e?e.key:null,Zd(i,r,o),Zd(t,i,o)}}else t=t.otherEvent,h=c=s.find(t),c&&h&&(c=c!==u?s.prev(c):null,h=s.next(h),s.remove(t),h&&c&&ip(c.key,h.key,e))}return a}(l,0,0,s,a,i),h=function(e){let t,i;const r=function(e){let t,i,r,n,o;const s=[];for(i=0,r=e.length;i<r;i++)t=e[i],(t.left&&t.inResult||!t.left&&t.otherEvent.inResult)&&s.push(t);let a=!1;for(;!a;)for(a=!0,i=0,r=s.length;i<r;i++)i+1<r&&1===Jd(s[i],s[i+1])&&(n=s[i],s[i]=s[i+1],s[i+1]=n,a=!1);for(i=0,r=s.length;i<r;i++)t=s[i],t.otherPos=i;for(i=0,r=s.length;i<r;i++)t=s[i],t.left||(o=t.otherPos,t.otherPos=t.otherEvent.otherPos,t.otherEvent.otherPos=o);return s}(e),n={},o=[];for(t=0,i=r.length;t<i;t++){if(n[t])continue;const e=o.length,i=sp(r[t],o,e),s=t=>{n[t]=!0,t<r.length&&r[t]&&(r[t].outputContourId=e)};let a=t,l=t;for(i.points.push(r[t].point);s(a),a=r[a].otherPos,s(a),i.points.push(r[a].point),a=op(a,r,n,l),!(a==l||a>=r.length)&&r[a];);o.push(i)}return o}(c),u=[];for(let d=0;d<h.length;d++){let e=h[d];if(e.isExterior()){let t=[e.points];for(let i=0;i<e.holeIds.length;i++)t.push(h[e.holeIds[i]].points);u.push(t)}}return u}function pp(e,t,i,r){const n=[],o=0===r?(e,t,i,r,n,o)=>{e.push(new Ee(o,i+(o-t)/(r-t)*(n-i)))}:(e,t,i,r,n,o)=>{e.push(new Ee(t+(o-i)/(n-i)*(r-t),o))};for(const s of e){const e=[];for(const n of s){if(n.length<=2)continue;const s=[];for(let e=0;e<n.length-1;e++){const a=n[e].x,l=n[e].y,c=n[e+1].x,h=n[e+1].y,u=0===r?a:l,d=0===r?c:h;u<t?d>t&&o(s,a,l,c,h,t):u>i?d<i&&o(s,a,l,c,h,i):s.push(n[e]),d<t&&u>=t&&o(s,a,l,c,h,t),d>i&&u<=i&&o(s,a,l,c,h,i)}let a=n[n.length-1];const l=0===r?a.x:a.y;l>=t&&l<=i&&s.push(a),s.length&&(a=s[s.length-1],s[0].x===a.x&&s[0].y===a.y||s.push(s[0]),e.push(s))}e.length&&n.push(e)}return n}function fp(e,t){const i=dp(_p(e),_p([t]),0);return null==i?[]:gp(i)}function mp(e,t){const i=65536;let r=_p(e,i);const n=[];for(;t.valid();t.next()){const[e,r]=t.get(),o=e.x*i,s=e.y*i,a=r.x*i,l=r.y*i,c=a-o,h=l-s,u=Math.hypot(c,h);if(0===u)continue;const d=Math.trunc(h/u*3),p=-Math.trunc(c/u*3);n.push([[[o,s],[a,l],[a+d,l+p],[o+d,s+p],[o,s]]])}return n.length>0&&(r=dp(r,n,2)),gp(r,1/i,128)}function _p(e,t=1){return[e.map(e=>e.map(e=>[e.x*t,e.y*t]))]}function gp(e,t=1,i){return e.map(e=>e.map((e,r)=>{const n=e.map(e=>{let r=e[0],n=e[1];return i&&(r=Math.round(r/i)*i,n=Math.round(n/i)*i),new Ee(r*t,n*t)._round()});return r>0&&n.reverse(),n}))}class yp{constructor(e,t){this.layoutVertexArray=new Ua,this.indexArray=new ll,this.lineIndexArray=new rl,this.triangleSegments=new Nl,this.lineSegments=new Nl,this.programConfigurations=new fc(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,t&&(this.elevatedLayoutVertexArray=new qa)}update(e,t,i,r,n,o,s,a){this.programConfigurations.updatePaintArrays(e,t,n,i,r,o,s,a)}isEmpty(){return 0===this.layoutVertexArray.length}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Xu.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,Yu.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,t,i,r,n,o,s){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,t,i,r,n,o,void 0,s)}}class xp{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=e.lut,this.bufferData=new yp(e,!1),this.elevationBufferData=new yp(e,!0),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.projection=e.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=e.sourceLayerIndex,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,i,r){}populate(e,t,i,r){this.hasPattern=Md("fill",this.layers,this.pixelRatio,t);const n=this.layers[0].layout.get("fill-sort-key"),o=[];for(const{feature:s,id:a,index:l,sourceLayerIndex:c}of e){const e=this.layers[0]._featureFilter.needGeometry,h=Jc(s,e);if(!this.layers[0]._featureFilter.filter(new Js(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),h,i))continue;const u=n?n.evaluate(h,{},i,t.availableImages):void 0,d={id:a,properties:s.properties,type:s.type,sourceLayerIndex:c,index:l,geometry:e?h.geometry:Kc(s,i,r),patterns:{},sortKey:u};o.push(d)}n&&o.sort((e,t)=>e.sortKey-t.sortKey);for(const s of o){const{geometry:r,index:n,sourceLayerIndex:o}=s;if(this.hasPattern){const e=Cd("fill",this.layers,s,this.zoom,this.pixelRatio,t);this.patternFeatures.push(e)}else this.addFeature(s,r,n,i,{},t.availableImages,t.brightness,t.elevationFeatures);t.featureIndex.insert(e[n].feature,r,n,o,this.index)}}update(e,t,i,r,n,o,s){this.bufferData.update(e,t,i,r,n,o,s,this.worldview),this.elevationBufferData.update(e,t,i,r,n,o,s,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(e,t,i,r,n,o,s,this.worldview)}addFeatures(e,t,i,r,n,o){for(const s of this.patternFeatures)this.addFeature(s,s.geometry,s.index,t,i,r,o,e.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(e){this.bufferData.upload(e),this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(e,t,i,r,n,o=[],s,a){const l=Ed(t,500);"none"!==this.elevationMode?this.addElevatedRoadFeature(e,l,r,i,a):this.addGeometry(l,this.bufferData),this.bufferData.populatePaintArrays(e,i,n,o,r,s,this.worldview),this.elevationBufferData.populatePaintArrays(e,i,n,o,r,s,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}setEvaluatedPortalGraph(e,t,i,r,n){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(t,i,r,n,this.worldview))}addElevatedRoadFeature(e,t,i,r,n){const o=new Array,s=Sh.getElevationFeature(e,n);if(!s)return void this.addGeometry(t,this.bufferData);{const e=this.clipPolygonsToTile(t,1);e.length>0&&o.push({polygons:e,elevationFeature:s,elevationTileID:i})}const a={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},i),featureIndex:r};for(const l of o)if(l.elevationFeature){if("hd-road-base"===this.elevationMode){this.elevatedStructures||(this.elevatedStructures=new zd(l.elevationTileID,this.layers,this.zoom,this.lut));const t=l.elevationFeature.isTunnel();let i=0;e.properties.hasOwnProperty(ah)&&(i=+e.properties[ah]),this.elevatedStructures.addPortalCandidates(l.elevationFeature.id,l.polygons,t,l.elevationFeature,i)}null==l.elevationFeature.constantHeight&&(l.polygons=this.prepareElevatedPolygons(l.polygons,l.elevationFeature,l.elevationTileID));const t=new Eh(i,l.elevationTileID);this.addElevatedGeometry(l.polygons,t,l.elevationFeature,"hd-road-base"===this.elevationMode?0:.05,r,a)}}addElevatedGeometry(e,t,i,r,n,o){const s={elevation:i,elevationSampler:t,bias:r,index:n,featureInfo:o},[a,l]=this.addGeometry(e,this.elevationBufferData,s);null==this.elevationBufferData.heightRange?this.elevationBufferData.heightRange={min:a,max:l}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,a),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,l))}addGeometry(e,t,i){let r=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,o=null;i&&(o=i.elevationSampler.constantElevation(i.elevation,i.bias),null!=o&&(r=o,n=o));const s=(e,s,a)=>{if(null!=i)if(s.push(e),null!=o)t.elevatedLayoutVertexArray.emplaceBack(o),a.push(o);else{const o=i.elevationSampler.pointElevation(e,i.elevation,i.bias);t.elevatedLayoutVertexArray.emplaceBack(o),a.push(o),r=Math.min(r,o),n=Math.max(n,o)}};for(const a of e){let e=0;for(const t of a)e+=t.length;const r=t.triangleSegments.prepareSegment(e,t.layoutVertexArray,t.indexArray),n=r.vertexLength,o=[],l=[],c=[],h=[],u=[],d=t.layoutVertexArray.length;for(const f of a){if(0===f.length)continue;f!==a[0]&&l.push(o.length/2);const e=t.lineSegments.prepareSegment(f.length,t.layoutVertexArray,t.lineIndexArray),r=e.vertexLength;i&&u.push(t.layoutVertexArray.length-d),s(f[0],c,h),t.layoutVertexArray.emplaceBack(f[0].x,f[0].y),t.lineIndexArray.emplaceBack(r+f.length-1,r),o.push(f[0].x),o.push(f[0].y);for(let i=1;i<f.length;i++)s(f[i],c,h),t.layoutVertexArray.emplaceBack(f[i].x,f[i].y),t.lineIndexArray.emplaceBack(r+i-1,r+i),o.push(f[i].x),o.push(f[i].y);e.vertexLength+=f.length,e.primitiveLength+=f.length}const p=Qu(o,l);for(let i=0;i<p.length;i+=3)t.indexArray.emplaceBack(n+p[i],n+p[i+1],n+p[i+2]);if(p.length>0&&i&&"hd-road-base"===this.elevationMode){const e=i.elevation.isTunnel(),t=i.elevation.safeArea,r=this.elevatedStructures.addVertices(c,h);this.elevatedStructures.addTriangles(p,r,e);const n=u.length;if(n>0){for(let o=0;o<n-1;o++)this.elevatedStructures.addRenderableRing(i.index,u[o]+r,u[o+1]-u[o],e,t,i.featureInfo);this.elevatedStructures.addRenderableRing(i.index,u[n-1]+r,c.length-u[n-1],e,t,i.featureInfo)}}r.vertexLength+=e,r.primitiveLength+=p.length/3}return[r,n]}prepareElevatedPolygons(e,t,i){const r=1/jc(i),n=[];for(const o of e){const e=mp(o,new wh(t,r));n.push(...e)}return n}clipPolygonsToTile(e,t){const i=-t,r=-t,n=Ur+t,o=Ur+t;let s=0;const a=[],l=[];for(;s<e.length;s++){const t=e[s],c=xr(t);(c.min.x>=i&&c.max.x<=n&&c.min.y>=r&&c.max.y<=o?a:l).push(t)}if(a.length===e.length)return e;const c=[new Ee(i,r),new Ee(n,r),new Ee(n,o),new Ee(i,o),new Ee(i,r)],h=a;for(const u of l)h.push(...fp(u,c));return h}}let vp,bp,wp,Tp;es(xp,"FillBucket",{omit:["layers","patternFeatures"]}),es(yp,"FillBufferData"),es(zd,"ElevatedStructures");class Sp{constructor(e,t,i,r){if(this.triangleCount=t.length/3,this.min=new Ee(0,0),this.max=new Ee(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],0===this.triangleCount||0===e.length)return;const[n,o]=[e[0].clone(),e[0].clone()];for(let h=1;h<e.length;++h){const t=e[h];n.x=Math.min(n.x,t.x),n.y=Math.min(n.y,t.y),o.x=Math.max(o.x,t.x),o.y=Math.max(o.y,t.y)}if(r){const e=Math.ceil(Math.max(o.x-n.x,o.y-n.y)/r);i=Math.max(i,e)}if(0===i)return;this.min=n,this.max=o;const s=this.max.sub(this.min);s.x=Math.max(s.x,1),s.y=Math.max(s.y,1);const a=Math.max(s.x,s.y)/i;this.cellsX=Math.max(1,Math.ceil(s.x/a)),this.cellsY=Math.max(1,Math.ceil(s.y/a)),this.xScale=1/a,this.yScale=1/a;const l=[];for(let h=0;h<this.triangleCount;h++){const i=e[t[3*h+0]].sub(this.min),r=e[t[3*h+1]].sub(this.min),n=e[t[3*h+2]].sub(this.min),o=Ep(Math.floor(Math.min(i.x,r.x,n.x)),this.xScale,this.cellsX),s=Ep(Math.floor(Math.max(i.x,r.x,n.x)),this.xScale,this.cellsX),c=Ep(Math.floor(Math.min(i.y,r.y,n.y)),this.yScale,this.cellsY),u=Ep(Math.floor(Math.max(i.y,r.y,n.y)),this.yScale,this.cellsY),d=new Ee(0,0),p=new Ee(0,0),f=new Ee(0,0),m=new Ee(0,0);for(let e=c;e<=u;++e){d.y=p.y=e*a,f.y=m.y=(e+1)*a;for(let t=o;t<=s;++t)d.x=f.x=t*a,p.x=m.x=(t+1)*a,(jh(i,r,n,d,p,m)||jh(i,r,n,d,m,f))&&l.push({cellIdx:e*this.cellsX+t,triIdx:h})}}if(0===l.length)return;l.sort((e,t)=>
vendor: 8,895 bytes, line 2
2e.cellIdx-t.cellIdx||e.triIdx-t.triIdx);let c=0;for(;c<l.length;){const e=l[c].cellIdx,t={start:this.payload.length,len:0};for(;c<l.length&&l[c].cellIdx===e;)++t.len,this.payload.push(l[c++].triIdx);this.cells[e]=t}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,t){if(0===this.triangleCount||0===this.cells.length)return;if(e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const i=Ep(e.x-this.min.x,this.xScale,this.cellsX),r=Ep(e.y-this.min.y,this.yScale,this.cellsY),n=this.cells[r*this.cellsX+i];if(n){this._lazyInitLookup();for(let e=0;e<n.len;e++){const i=this.payload[n.start+e],r=Math.floor(i/8),o=1<<i%8;if(!(this.lookup[r]&o)&&(this.lookup[r]|=o,t.push(i),t.length===this.triangleCount))return}}}query(e,t,i){if(0===this.triangleCount||0===this.cells.length)return;if(e.x>this.max.x||this.min.x>t.x)return;if(e.y>this.max.y||this.min.y>t.y)return;this._lazyInitLookup();const r=Ep(e.x-this.min.x,this.xScale,this.cellsX),n=Ep(t.x-this.min.x,this.xScale,this.cellsX),o=Ep(e.y-this.min.y,this.yScale,this.cellsY),s=Ep(t.y-this.min.y,this.yScale,this.cellsY);for(let a=o;a<=s;a++)for(let e=r;e<=n;e++){const t=this.cells[a*this.cellsX+e];if(t)for(let e=0;e<t.len;e++){const r=this.payload[t.start+e],n=Math.floor(r/8),o=1<<r%8;if(!(this.lookup[n]&o)&&(this.lookup[n]|=o,i.push(r),i.length===this.triangleCount))return}}}}function Ep(e,t,i){return Math.max(0,Math.min(i-1,Math.floor(e*t)))}es(Sp,"TriangleGridIndex");class Ip{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.footprints=[],this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){for(const i of this.footprints)t.push({footprint:i,id:e})}updateAppearances(e,t,i,r){}populate(e,t,i,r){const n=[];for(const{feature:o,id:s,index:a,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=Jc(o,e);if(!this.layers[0]._featureFilter.filter(new Js(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),c,i))continue;const h={id:s,properties:o.properties,type:o.type,sourceLayerIndex:l,index:a,geometry:e?c.geometry:Kc(o,i,r),patterns:{}};n.push(h)}for(const o of n){const{geometry:r,index:n,sourceLayerIndex:s}=o;this.addFeature(o,r,n,i,{},t.availableImages,t.brightness),t.featureIndex.insert(e[n].feature,r,n,s,this.index)}}isEmpty(){return 0===this.footprints.length}uploadPending(){return!1}upload(e){}update(e,t,i,r,n,o,s){}destroy(){}addFeature(e,t,i,r,n,o=[],s){for(const a of Ed(t,2)){const e=[],t=[],i=[],r=new Ee(1/0,1/0),n=new Ee(-1/0,-1/0);for(const l of a)if(0!==l.length){l!==a[0]&&i.push(t.length/2);for(let i=0;i<l.length;i++)t.push(l[i].x),t.push(l[i].y),e.push(l[i]),r.x=Math.min(r.x,l[i].x),r.y=Math.min(r.y,l[i].y),n.x=Math.max(n.x,l[i].x),n.y=Math.max(n.y,l[i].y)}const o=Qu(t,i),s=new Sp(e,o,8,256);this.footprints.push({vertices:e,indices:o,grid:s,min:r,max:n})}}}es(Ip,"ClipBucket",{omit:["layers"]});const Ap=Na([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),Mp=Na([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),Cp=Na([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),Pp=Na([{name:"a_centroid_pos",components:2,type:"Uint16"}]),Rp=Na([{name:"a_join_normal_inside",components:3,type:"Int16"}]),zp=Na([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),Lp=Na([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:Dp}=Ap,Op=Number.MAX_SAFE_INTEGER,Fp=Op-1;function kp(e,t,i,r){return e.order<t||e.order===Op||!(e.clipMask&i)||function(e,t){return 0!==t.length&&void 0===t.find(t=>t===e)}(r,e.clipScope)}function Bp(e,t){return e.x-t.x||e.y-t.y}function Np(e,t){return 0===Bp(e.min,t.min)&&0===Bp(e.max,t.max)}function Vp(e,t){return!(e.min.x>t.max.x||e.max.x<t.min.x||e.min.y>t.max.y||e.max.y<t.min.y)}function Up(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i].sourceId!==t[i].sourceId||!Np(e[i],t[i])||e[i].order!==t[i].order||e[i].clipMask!==t[i].clipMask||!Ie(e[i].clipScope,t[i].clipScope))return!1;return!0}function jp(e,t,i){const r=1/Ur,n=1/(1<<i.canonical.z),o=(t.x*r+i.canonical.x)*n+i.wrap,s=(t.y*r+i.canonical.y)*n;return{min:new Ee((e.x*r+i.canonical.x)*n+i.wrap,(e.y*r+i.canonical.y)*n),max:new Ee(o,s)}}function Gp(e,t,i){const r=1<<i.canonical.z,n=((t.x-i.wrap)*r-i.canonical.x)*Ur,o=(t.y*r-i.canonical.y)*Ur;return{min:new Ee(((e.x-i.wrap)*r-i.canonical.x)*Ur,(e.y*r-i.canonical.y)*Ur),max:new Ee(n,o)}}function qp(e,t,i,r,n,o,s){const a=e.indices,l=e.vertices,c=[];for(let h=r;h<r+n;h+=3){const r=t[i[h+0]+o],n=t[i[h+1]+o],u=t[i[h+2]+o],d=Math.min(r.x,n.x,u.x),p=Math.max(r.x,n.x,u.x),f=Math.min(r.y,n.y,u.y),m=Math.max(r.y,n.y,u.y);c.length=0,e.grid.query(new Ee(d,f),new Ee(p,m),c);for(let e=0;e<c.length;e++){const t=c[e];if(jh(l[a[3*t+0]],l[a[3*t+1]],l[a[3*t+2]],r,n,u,s))return!0}}return!1}function Hp(e,t,i,r){if(!e||!i)return!1;let n=e.vertices;if(!t.canonical.equals(r.canonical)||t.wrap!==r.wrap){if(i.vertices.length<e.vertices.length)return Hp(i,r,e,t);const o=t.canonical,s=r.canonical,a=Math.pow(2,s.z-o.z);n=e.vertices.map(e=>new Ee((e.x+o.x*Ur)*a-s.x*Ur,(e.y+o.y*Ur)*a-s.y*Ur))}return qp(i,n,e.indices,0,e.indices.length,0,0)}function $p(e,t,i,r){const n=Math.pow(2,r.z-i.z);return new Ee((e+i.x*Ur)*n-r.x*Ur,(t+i.y*Ur)*n-r.y*Ur)}function Zp(e,t){const i=[];t.grid.queryPoint(e,i);const r=t.indices,n=t.vertices;for(let o=0;o<i.length;o++){const t=i[o];if(Bh([n[r[3*t+0]],n[r[3*t+1]],n[r[3*t+2]]],e))return!0}return!1}const Wp=[new Ee(0,0),new Ee(Ur,0),new Ee(Ur,Ur),new Ee(0,Ur)];function Xp(e,t){const i=[];let r=[];if(!t||e.length<2)return[e];if(2===e.length)return Vh(e[0],e[1],Wp)?[e]:[];for(let n=0;n<e.length+2;n++){const t=e[n%e.length],o=e[(n+1)%e.length],s=Vh(0===n?e[e.length-1]:e[(n-1)%e.length],t,Wp),a=Vh(t,o,Wp),l=s||a;l&&r.push(t),l&&a||r.length>0&&(r.length>1&&i.push(r),r=[])}return r.length>1&&i.push(r),i}const Yp=Qc.types,Kp=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],Jp=["fill-extrusion-flood-light-ground-radius"],Qp=Math.pow(2,13),ef=Math.pow(2,15)-1,tf=new Ee(0,1),rf=2147483648;function nf(e,t,i,r,n,o,s,a){e.emplaceBack((t<<1)+s,(i<<1)+o,(Math.floor(r*Qp)<<1)+n,Math.round(a))}function of(e,t,i){e.emplaceBack(t.x*Ur,t.y*Ur,i?1:0)}function sf(e,t,i,r,n,o){e.emplaceBack(t.x,t.y,(i.x<<1)+r,(i.y<<1)+n,o)}function af(e,t,i){const r=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*r,i[1]*r,i[2]*r)}class lf{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class cf{constructor(){this.centroidXY=new Ee(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new Ee(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Ee(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new Ee(this.max.x-this.min.x,this.max.y-this.min.y)}}class hf{constructor(){this.acc=new Ee(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,t){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=t.x,e.min.y=e.max.y=t.y)}appendEdge(e,t,i){this.accCount++,this.acc._add(t);let r=!!this.borders;t.x<e.min.x?(e.min.x=t.x,r=!0):t.x>e.max.x&&(e.max.x=t.x,r=!0),t.y<e.min.y?(e.min.y=t.y,r=!0):t.y>e.max.y&&(e.max.y=t.y,r=!0),((0===t.x||t.x===Ur)&&t.x===i.x)!=((0===t.y||t.y===Ur)&&t.y===i.y)&&this.processBorderOverlap(t,i),r&&this.checkBorderIntersection(t,i)}checkBorderIntersection(e,t){t.x<0!=e.x<0&&this.addBorderIntersection(0,pi(t.y,e.y,(0-t.x)/(e.x-t.x))),t.x>Ur!=e.x>Ur&&this.addBorderIntersection(1,pi(t.y,e.y,(Ur-t.x)/(e.x-t.x))),t.y<0!=e.y<0&&this.addBorderIntersection(2,pi(t.x,e.x,(0-t.y)/(e.y-t.y))),t.y>Ur!=e.y>Ur&&this.addBorderIntersection(3,pi(t.x,e.x,(Ur-t.y)/(e.y-t.y)))}addBorderIntersection(e,t){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const i=this.borders[e];t<i[0]&&(i[0]=t),t>i[1]&&(i[1]=t)}processBorderOverlap(e,t){if(e.x===t.x){if(e.y===t.y)return;const i=0===e.x?0:1;this.addBorderIntersection(i,t.y),this.addBorderIntersection(i,e.y)}else{const i=0===e.y?2:3;this.addBorderIntersection(i,t.x),this.addBorderIntersection(i,e.x)}}centroid(){return 0===this.accCount?new Ee(0,0):new Ee(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((e,t)=>
vendor: 10,254 bytes, line 2
2e+ +(t[0]!==Number.MAX_VALUE),0):0}}function uf(e,t){const i=e.add(t)._unit(),r=Oe(e.x*i.x+e.y*i.y,-1,1);var n,o,s;return s=Math.acos(r),Math.min(4,Math.max(-4,Math.tan(s)))/4*ef*((n=e).x*(o=t).y-n.y*o.x<0?-1:1)}const df=[e=>e.x<0,e=>e.x>Ur,e=>e.y<0,e=>e.y>Ur];function pf(e,t,i,r){const n=[4];if(0===r)return n;i._mult(r);const o=e.sub(i),s=t.sub(i),a=[e,t,o,s];for(let l=0;l<4;l++)for(const e of a)if(df[l](e)){n.push(l);break}return n}class ff{constructor(e){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new Za,this.indexArray=new ll,this.programConfigurations=new fc(e.layers,{zoom:e.zoom,lut:e.lut},e=>Jp.includes(e)),this._segments=new Nl,this.hiddenByLandmarkVertexArray=new wl,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Nl}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(e,t,i,r=!1){const n=e.length;if(n>2){let o=Math.max(0,this._segments.get().length-1);const s=this._segments._prepareSegment(4*n,this.vertexArray.length,2*this._segmentToGroundQuads[o].length);let a;o!==this._segments.get().length-1&&(o++,this._segmentToGroundQuads[o]=[],this._segmentToRegionTriCounts[o]=[0,0,0,0,0]);{const t=e[0],i=e[1];a=uf(t.sub(e[n-1])._perp()._unit(),i.sub(t)._perp()._unit())}for(let l=0;l<n;l++){const c=l===n-1?0:l+1,h=e[l],u=e[c],d=e[c===n-1?0:c+1],p=u.sub(h)._perp()._unit(),f=uf(p,d.sub(u)._perp()._unit()),m=a,_=f;if(xf(h,u,t)||r&&vf(h,t)&&vf(u,t)){a=f;continue}const g=s.vertexLength;sf(this.vertexArray,h,u,1,1,m),sf(this.vertexArray,h,u,1,0,m),sf(this.vertexArray,h,u,0,1,_),sf(this.vertexArray,h,u,0,0,_),s.vertexLength+=4;const y=pf(h,u,p,i);for(const e of y)this._segmentToGroundQuads[o].push({id:g,region:e}),this._segmentToRegionTriCounts[o][e]+=2,s.primitiveLength+=2;a=f}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),t=e.length;for(let i=0;i<t;i++)this._segmentToGroundQuads[i].sort((e,t)=>e.region-t.region);for(let i=0;i<t;i++){const t=this._segmentToGroundQuads[i],r=e[i],n=this._segmentToRegionTriCounts[i];n.reduce((e,t)=>e+t,0);let o=0;for(let e=0;e<=4;e++){const t=n[e];if(0!==t){let i=this.regionSegments[e];i||(i=this.regionSegments[e]=new Nl);const n={vertexOffset:r.vertexOffset,primitiveOffset:r.primitiveOffset+o,vertexLength:r.vertexLength,primitiveLength:t};i.get().push(n)}o+=t}for(let e=0;e<t.length;e++){const i=t[e].id;this.indexArray.emplaceBack(i,i+1,i+3),this.indexArray.emplaceBack(i,i+3,i+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,t,i,r,n,o,s){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,t,i,r,n,o,void 0,s)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,Mp.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),null!=this.groundRadiusArray&&(this.groundRadiusBuffer=e.createVertexBuffer(this.groundRadiusArray,Cp.members)))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,t,i,r,n,o,s,a){this.hasData()&&this.programConfigurations.updatePaintArrays(e,t,i,r,n,o,s,a)}updateHiddenByLandmark(e){this.updateHiddenByLandmarkRange(e.groundVertexArrayOffset,e.groundVertexCount,!!(e.flags&rf))}updateHiddenByLandmarkRange(e,t,i){if(!this.hasData())return;const r=t+e;if(0!==t){for(let t=e;t<r;++t)this.hiddenByLandmarkVertexArray.emplace(t,i?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,zp.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this.groundRadiusBuffer&&this.groundRadiusBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const t=this.regionSegments[e];t&&t.destroy()}}}}class mf{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.pixelRatio=e.pixelRatio,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new ll,this.footprintVertices=new Ua,this.footprintSegments=[],this.layoutVertexArray=new Ga,this.centroidVertexArray=new Ll,this.wallVertexArray=new Ol,this.indexArray=new ll,this.programConfigurations=new fc(e.layers,{zoom:e.zoom,lut:e.lut},e=>Kp.includes(e)),this.segments=new Nl,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.groundEffect=new ff(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,i,r){}populate(e,t,i,r){this.features=[],this.hasPattern=Md("fill-extrusion",this.layers,this.pixelRatio,t),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=jc(i),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=0!==this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1);for(const{feature:n,id:o,index:s,sourceLayerIndex:a}of e){const e=this.layers[0]._featureFilter.needGeometry,l=Jc(n,e);if(!this.layers[0]._featureFilter.filter(new Js(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),l,i))continue;const c={id:o,sourceLayerIndex:a,index:s,geometry:e?l.geometry:Kc(n,i,r),properties:n.properties,type:n.type,patterns:{}},h=this.layoutVertexArray.length,u="Polygon"===Yp[c.type];if(this.hasPattern)this.features.push({featureId:n.id,feature:Cd("fill-extrusion",this.layers,c,this.zoom,this.pixelRatio,t)});else if(this.wallMode)for(const o of c.geometry)for(const e of Xp(o,u))this.addFeature(n.id,c,[e],s,i,{},t.availableImages,r,t.brightness);else this.addFeature(n.id,c,c.geometry,s,i,{},t.availableImages,r,t.brightness);t.featureIndex.insert(n,c.geometry,s,a,this.index,h)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,t,i,r,n,o){for(const{featureId:s,feature:a}of this.features){const e="Polygon"===Yp[a.type],{geometry:l}=a;if(this.wallMode)for(const c of l)for(const l of Xp(c,e))this.addFeature(s,a,[l],a.index,t,i,r,n,o);else this.addFeature(s,a,l,a.index,t,i,r,n,o)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles()}update(e,t,i,r,n,o,s){this.programConfigurations.updatePaintArrays(e,t,n,i,r,o,s,this.worldview),this.groundEffect.update(e,t,n,i,r,o,s,this.worldview)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Dp),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,Rp.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,Lp.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Pp.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,i,r,n,o,s,a,l){const c=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(t,{})/this.tileToMeter,h=[new Ee(0,0),new Ee(Ur,Ur)],u=a.projection,d="globe"===u.name,p=this.wallMode||"Polygon"===Yp[t.type],f=new hf;f.centroidDataIndex=this.centroidData.length;const m=new cf;m.buildingId=e,t.properties&&t.properties.hasOwnProperty("building_id")&&(m.buildingId=Number(t.properties.building_id));const _=this.layers[0].paint.get("fill-extrusion-base").evaluate(t,{},n)<=0,g=this.layers[0].paint.get("fill-extrusion-height").evaluate(t,{},n);let y;if(m.height=g,m.vertexArrayOffset=this.layoutVertexArray.length,m.groundVertexArrayOffset=this.groundEffect.vertexArray.length,d&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Ja),this.wallMode){if(d)return void We("Non zero fill-extrusion-line-width is not yet supported on globe.");if(1!==i.length)return;y=function(e){const t=e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y,i=function(e){let t=0;const i=e.length;for(let r=0;r<i;r++)t+=(e[(r+1)%i].x-e[r].x)*(e[(r+1)%i].y+e[r].y);return t>=0}(e);i||(e=e.reverse());const r={geometry:[],joinNormals:[],indices:[]},n=[],o=[],s=[];let a=e.length;for(;a>=2&&e[a-1].equals(e[a-2]);)a--;if(a<(t?3:2))return r;let l,c,h,u,d,p=0;for(;p<a-1&&e[p].equals(e[p+1]);)p++;t&&(l=e[a-2],d=e[p].sub(l)._unit()._perp());for(let m=p;m<a;m++){if(h=m===a-1?t?e[p+1]:void 0:e[m+1],h&&e[m].equals(h))continue;d&&(u=d),l&&(c=l),l=e[m],d=h?h.sub(l)._unit()._perp():u,u=u||d;let i=u.add(d);0===i.x&&0===i.y||i._unit();
vendor: 4,205 bytes, line 2
2const r=i.x*d.x+i.y*d.y,f=0!==r?1/r:1/0,_=u.x*d.y-u.y*d.x>0;let g="miter";const y=2;"miter"===g&&f>y&&(g="bevel"),"bevel"===g&&(f>100&&(g="flipbevel"),f<y&&(g="miter"));const x=(e,t,i,r)=>{const a=new Ee(e.x,e.y),l=new Ee(e.x,e.y);a.x+=t.x*r,a.y+=t.y*r,l.x-=t.x*Math.max(i,1),l.y-=t.y*Math.max(i,1),s.push(t),n.push(a),o.push(l)};if("miter"===g)i._mult(f),x(l,i,0,0);else if("flipbevel"===g)i=d.mult(-1),x(l,i,0,0),x(l,i.mult(-1),0,0);else{const e=-Math.sqrt(f*f-1),t=_?e:0,i=_?0:e;c&&x(l,u,t,i),h&&x(l,d,t,i)}}r.geometry=[...n,...o.reverse(),n[0]],r.joinNormals=[...s,...s.reverse(),s[s.length-1]];const f=r.geometry.length-1;for(let m=0;m<f/2;m++)if(m+1<f/2){let e=m,t=m+1,i=f-1-m,n=f-2-m;e=0===e?f-1:e-1,t=0===t?f-1:t-1,i=0===i?f-1:i-1,n=0===n?f-1:n-1,r.indices.push(i),r.indices.push(t),r.indices.push(e),r.indices.push(i),r.indices.push(n),r.indices.push(t)}return r}(i[0]),i=[y.geometry]}const x=(e,t)=>e<(t.length-1)/2||e===t.length-1,v=this.wallMode?[i]:Ed(i,500);for(let E=v.length-1;E>=0;E--){const e=v[E];(0===e.length||bf(e[0]))&&v.splice(E,1)}let b;if(d)b=Ef(v,h,n);else{b=[];for(const e of v)b.push({polygon:e,bounds:h})}const w=p?this.edgeRadius:0,T=w>0&&this.zoom<17,S=(e,t)=>{if(0===e.length)return!1;const i=e[e.length-1];return t.x===i.x&&t.y===i.y};for(const{polygon:E,bounds:I}of b){let e=0,t=0;for(const n of E)p&&!n[0].equals(n[n.length-1])&&n.push(n[0]),t+=p?n.length-1:n.length;const i=this.segments.prepareSegment((p?5:4)*t,this.layoutVertexArray,this.indexArray);m.footprintSegIdx<0&&(m.footprintSegIdx=this.footprintSegments.length),m.polygonSegIdx<0&&(m.polygonSegIdx=this.polygonSegments.length);const r={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},o=new lf;if(o.vertexOffset=this.footprintVertices.length,o.indexOffset=3*this.footprintIndices.length,o.ringIndices=[],p){const t=[],r=[];e=i.vertexLength;for(let e=0;e<E.length;e++){const s=E[e];s.length&&0!==e&&r.push(t.length/2);const a=[];let l,h;l=s[1].sub(s[0])._perp()._unit(),o.ringIndices.push(s.length-1);for(let e=1;e<s.length;e++){const r=s[e],o=s[e===s.length-1?1:e+1],c=r.clone();if(w){h=o.sub(r)._perp()._unit();const e=l.add(h)._unit(),t=w*Math.min(4,1/(l.x*e.x+l.y*e.y));c.x+=t*e.x,c.y+=t*e.y,c.x=Math.round(c.x),c.y=Math.round(c.y),l=h}if(!_||0!==w&&!T||S(a,c)||a.push(c),nf(this.layoutVertexArray,c.x,c.y,0,0,1,1,0),this.wallMode){const t=x(e,s);of(this.wallVertexArray,y.joinNormals[e],!t)}i.vertexLength++,this.footprintVertices.emplaceBack(r.x,r.y),t.push(r.x,r.y),d&&af(this.layoutVertexExtArray,u.projectTilePoint(c.x,c.y,n),u.upVector(n,c.x,c.y))}_&&(0===w||T)&&(0!==a.length&&S(a,a[0])&&a.pop(),this.groundEffect.addData(a,I,c))}const s=this.wallMode?y.indices:Qu(t,r);for(let n=0;n<s.length;n+=3)this.footprintIndices.emplaceBack(o.vertexOffset+s[n+0],o.vertexOffset+s[n+1],o.vertexOffset+s[n+2]),this.indexArray.emplaceBack(e+s[n],e+s[n+2],e+s[n+1]),i.primitiveLength++;o.indexCount+=s.length,o.vertexCount+=this.footprintVertices.length-o.vertexOffset}for(let s=0;s<E.length;s++){const t=E[s];f.startRing(m,t[0]);let r=t.length>4&&wf(t[t.length-2],t[0],t[1]),o=w?gf(t[t.length-2],t[0],t[1],w):0;const a=[];let l,h,g;h=t[1].sub(t[0])._perp()._unit();let v=!0;for(let s=1,c=0;s<t.length;s++){let p=t[s-1],b=t[s];const T=t[s===t.length-1?1:s+1];if(f.appendEdge(m,b,p),xf(b,p,I)){w&&(h=T.sub(b)._perp()._unit(),v=!v);continue}const E=b.sub(p)._perp(),A=E.x/(Math.abs(E.x)+Math.abs(E.y)),M=E.y>0?1:0,C=p.dist(b);if(c+C>32768&&(c=0),w){g=T.sub(b)._perp()._unit();let e=yf(p,b,T,_f(h,g),w);isNaN(e)&&(e=0);const t=b.sub(p)._unit();p=p.add(t.mult(o))._round(),b=b.add(t.mult(-e))._round(),o=e,h=g,_&&this.zoom>=17&&(S(a,p)||a.push(p),S(a,b)||a.push(b))}const P=i.vertexLength,R=t.length>4&&wf(p,b,T);let z=Tf(c,r,v);if(nf(this.layoutVertexArray,p.x,p.y,A,M,0,0,z),nf(this.layoutVertexArray,p.x,p.y,A,M,0,1,z),this.wallMode){const e=x(s-1,t),i=y.joinNormals[s-1];of(this.wallVertexArray,i,e),of(this.wallVertexArray,i,e)}if(c+=C,z=Tf(c,R,!v),r=R,nf(this.layoutVertexArray,b.x,b.y,A,M,0,0,z),nf(this.layoutVertexArray,b.x,b.y,A,M,0,1,z),this.wallMode){const e=x(s,t),i=y.joinNormals[s];of(this.wallVertexArray,i,e),of(this.wallVertexArray,i,e)}
vendor: 17,318 bytes, line 2
2if(i.vertexLength+=4,this.indexArray.emplaceBack(P+0,P+1,P+2),this.indexArray.emplaceBack(P+1,P+3,P+2),i.primitiveLength+=2,w){const r=e+(1===s?t.length-2:s-2),n=1===s?e:r+1;if(this.indexArray.emplaceBack(P+1,r,P+3),this.indexArray.emplaceBack(r,n,P+3),i.primitiveLength+=2,void 0===l&&(l=P),!xf(T,t[s],I)){const e=s===t.length-1?l:i.vertexLength;this.indexArray.emplaceBack(P+2,P+3,e),this.indexArray.emplaceBack(P+3,e+1,e),this.indexArray.emplaceBack(P+3,n,e+1),i.primitiveLength+=3}v=!v}if(d){const e=this.layoutVertexExtArray,t=u.projectTilePoint(p.x,p.y,n),i=u.projectTilePoint(b.x,b.y,n),r=u.upVector(n,p.x,p.y),o=u.upVector(n,b.x,b.y);af(e,t,r),af(e,t,r),af(e,i,o),af(e,i,o)}}p&&(e+=t.length-1),_&&w&&this.zoom>=17&&(0!==a.length&&S(a,a[0])&&a.pop(),this.groundEffect.addData(a,I,c,w>0))}this.footprintSegments.push(o),r.triangleCount=this.indexArray.length-r.triangleArrayOffset,this.polygonSegments.push(r),++m.footprintSegLen,++m.polygonSegLen}if(m.vertexCount=this.layoutVertexArray.length-m.vertexArrayOffset,m.groundVertexCount=this.groundEffect.vertexArray.length-m.groundVertexArrayOffset,0!==m.vertexCount){if(m.centroidXY=f.borders?tf:this.encodeCentroid(f,m),this.centroidData.push(m),f.borders){this.featuresOnBorder.push(f);const e=this.featuresOnBorder.length-1;for(let t=0;t<f.borders.length;t++)f.borders[t][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[t].push(e)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,o,s,n,l,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(t,r,o,s,n,l,this.worldview),this.maxHeight=Math.max(this.maxHeight,g)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((t,i)=>this.featuresOnBorder[t].borders[e][0]-this.featuresOnBorder[i].borders[e][0])}splitToSubtiles(){const e=[];for(let s=0;s<this.centroidData.length;s++){const t=this.centroidData[s],i=+(t.min.y+t.max.y>Ur),r=2*i+(+(t.min.x+t.max.x>Ur)^i);for(let n=0;n<t.polygonSegLen;n++){const i=t.polygonSegIdx+n;e.push({centroidIdx:s,subtile:r,polygonSegmentIdx:i,triangleSegmentIdx:this.polygonSegments[i].triangleSegIdx})}}const t=new ll;e.sort((e,t)=>e.triangleSegmentIdx===t.triangleSegmentIdx?e.subtile-t.subtile:e.triangleSegmentIdx-t.triangleSegmentIdx);let i=0,r=0,n=0;for(const s of e){if(s.triangleSegmentIdx!==i)break;n++}const o=e.length;for(;r!==e.length;){i=e[r].triangleSegmentIdx;let s=0,a=r,l=r;for(let t=a;t<n&&e[t].subtile===s;t++)l++;for(;a!==n;){const r=e[a];s=r.subtile;const o=this.centroidData[r.centroidIdx].min.clone(),c=this.centroidData[r.centroidIdx].max.clone(),h={vertexOffset:this.segments.segments[i].vertexOffset,primitiveOffset:t.length,vertexLength:this.segments.segments[i].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let i=a;i<l;i++){const r=e[i],n=this.polygonSegments[r.polygonSegmentIdx],s=this.centroidData[r.centroidIdx].min,a=this.centroidData[r.centroidIdx].max,l=this.indexArray.uint16;for(let e=n.triangleArrayOffset;e<n.triangleArrayOffset+n.triangleCount;e++)t.emplaceBack(l[3*e],l[3*e+1],l[3*e+2]);h.primitiveLength+=n.triangleCount,o.x=Math.min(o.x,s.x),o.y=Math.min(o.y,s.y),c.x=Math.max(c.x,a.x),c.y=Math.max(c.y,a.y)}h.primitiveLength>0&&this.triangleSubSegments.push({segment:h,min:o,max:c}),a=l;for(let t=a;t<n&&e[t].subtile===e[a].subtile;t++)l++}r=n;for(let t=r;t<o&&e[t].triangleSegmentIdx===e[r].triangleSegmentIdx;t++)n++}t._trim(),this.indexArray=t}getVisibleSegments(e,t,i){const r=new Nl;if(this.wallMode){for(const e of this.triangleSubSegments)r.segments.push(e.segment);return r}let n=0,o=0;const s=1<<e.canonical.z;if(t){const i=t.getMinMaxForTile(e);i&&(n=i.min,o=i.max)}o+=this.maxHeight;const a=e.toUnwrapped();let l;const c=[a.canonical.x/s+a.wrap,a.canonical.y/s],h=[(a.canonical.x+1)/s+a.wrap,(a.canonical.y+1)/s],u=(e,t,i)=>[e[0]*(1-i[0])+t[0]*i[0],e[1]*(1-i[1])+t[1]*i[1]],d=[],p=[];for(const f of this.triangleSubSegments){d[0]=f.min.x/Ur,d[1]=f.min.y/Ur,p[0]=f.max.x/Ur,p[1]=f.max.y/Ur;const e=u(c,h,d),t=u(c,h,p);if(0===new bh([e[0],e[1],n],[t[0],t[1],o]).intersectsPrecise(i)){l&&(r.segments.push(l),l=void 0);continue}const s=f.segment;l&&l.vertexOffset!==s.vertexOffset&&(r.segments.push(l),l=void 0),l?(l.vertexLength+=s.vertexLength,l.primitiveLength+=s.primitiveLength):l={vertexOffset:s.vertexOffset,primitiveLength:s.primitiveLength,vertexLength:s.vertexLength,primitiveOffset:s.primitiveOffset,sortKey:void 0,vaos:{}}}return l&&r.segments.push(l),r}encodeCentroid(e,t){const i=e.centroid(),r=t.span(),n=Math.min(7,Math.round(r.x*this.tileToMeter/10)),o=Math.min(7,Math.round(r.y*this.tileToMeter/10));return new Ee(Oe(i.x,1,8191)<<3|n,Oe(i.y,1,8191)<<3|o)}encodeBorderCentroid(e){if(!e.borders)return new Ee(0,0);const t=e.borders,i=Number.MAX_VALUE;if(t[0][0]!==i||t[1][0]!==i){const e=t[0][0]!==i?0:1;return new Ee(6|(t[0][0]!==i?0:65528),(t[e][0]+t[e][1])/2<<3|6)}{const e=t[2][0]!==i?2:3;return new Ee((t[e][0]+t[e][1])/2<<3|6,6|(t[2][0]!==i?0:65528))}}showCentroid(e){const t=this.centroidData[e.centroidDataIndex];t.flags&=2147483647,t.centroidXY.x=0,t.centroidXY.y=0,this.writeCentroidToBuffer(t)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const t=e.vertexArrayOffset,i=e.vertexCount+e.vertexArrayOffset,r=e.flags&rf?tf:e.centroidXY,n=this.centroidVertexArray.geta_centroid_pos0(t);if(this.centroidVertexArray.geta_centroid_pos1(t)!==r.y||n!==r.x){for(let e=t;e<i;++e)this.centroidVertexArray.emplace(e,r.x,r.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.centroidData)this.writeCentroidToBuffer(e)}updateReplacement(e,t,i){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const r=t.getReplacementRegionsForTile(e.toUnwrapped());if(Up(this.activeReplacements,r))return;if(this.activeReplacements=r,0===this.centroidVertexArray.length)this.createCentroidsBuffer();else for(const o of this.centroidData)o.flags&=2147483647;const n=[];for(const o of this.activeReplacements){if(o.order<i)continue;const t=Math.max(1,Math.pow(2,o.footprintTileId.canonical.z-e.canonical.z));if(o.footprint.buildingIds)for(const e of this.centroidData)e.flags&rf||o.min.x>e.max.x||e.min.x>o.max.x||o.min.y>e.max.y||e.min.y>o.max.y||o.footprint.buildingIds.has(e.buildingId)&&(e.flags|=rf);else for(const i of this.centroidData)if(!(i.flags&rf||o.min.x>i.max.x||i.min.x>o.max.x||o.min.y>i.max.y||i.min.y>o.max.y))for(let r=0;r<i.footprintSegLen;r++){const s=this.footprintSegments[i.footprintSegIdx+r];if(n.length=0,If(this.footprintVertices,s.vertexOffset,s.vertexCount,o.footprintTileId.canonical,e.canonical,n),qp(o.footprint,n,this.footprintIndices.uint16,s.indexOffset,s.indexCount,-s.vertexOffset,-t)){i.flags|=rf;break}}}for(const o of this.centroidData)this.writeCentroidToBuffer(o);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,t,i){let r=!1;for(let n=0;n<i.footprintSegLen;n++){const o=this.footprintSegments[i.footprintSegIdx+n];let s=0;for(const i of o.ringIndices){for(let n=s,a=i+s-1;n<i+s;a=n++){const i=this.footprintVertices.int16[2*(n+o.vertexOffset)+0],s=this.footprintVertices.int16[2*(n+o.vertexOffset)+1],l=this.footprintVertices.int16[2*(a+o.vertexOffset)+1];s>t!=l>t&&e<(this.footprintVertices.int16[2*(a+o.vertexOffset)+0]-i)*(t-s)/(l-s)+i&&(r=!r)}s=i}}return r}getHeightAtTileCoord(e,t){let i=Number.NEGATIVE_INFINITY,r=!0;const n=4*(e+Ur)*Ur+(t+Ur);if(this.partLookup.hasOwnProperty(n)){const e=this.partLookup[n];return e?{height:e.height,hidden:!!(e.flags&rf)}:void 0}for(const o of this.centroidData)e>o.max.x||o.min.x>e||t>o.max.y||o.min.y>t||o.height<=i||this.footprintContainsPoint(e,t,o)&&(i=o.height,this.partLookup[n]=o,r=!!(o.flags&rf));if(i!==Number.NEGATIVE_INFINITY)return{height:i,hidden:r};this.partLookup[n]=void 0}}function _f(e,t){const i=e.add(t)._unit();return e.x*i.x+e.y*i.y}function gf(e,t,i,r){const n=t.sub(e)._perp()._unit(),o=i.sub(t)._perp()._unit();return yf(e,t,i,_f(n,o),r)}function yf(e,t,i,r,n){const o=Math.sqrt(1-r*r);return Math.min(e.dist(t)/3,t.dist(i)/3,n*o/r)}function xf(e,t,i){return e.x<i[0].x&&t.x<i[0].x||e.x>i[1].x&&t.x>i[1].x||e.y<i[0].y&&t.y<i[0].y||e.y>i[1].y&&t.y>i[1].y}function vf(e,t){return e.x<t[0].x||e.x>t[1].x||e.y<t[0].y||e.y>t[1].y}function bf(e){return e.every(e=>e.x<=0)||e.every(e=>e.x>=Ur)||e.every(e=>e.y<=0)||e.every(e=>e.y>=Ur)}function wf(e,t,i){if(e.x<0||e.x>=Ur||t.x<0||t.x>=Ur||i.x<0||i.x>=Ur)return!1;const r=i.sub(t),n=r.perp(),o=e.sub(t);return(r.x*o.x+r.y*o.y)/Math.sqrt((r.x*r.x+r.y*r.y)*(o.x*o.x+o.y*o.y))>-.866&&n.x*o.x+n.y*o.y<0}function Tf(e,t,i){const r=t?2|e:-3&e;return i?1|r:-2&r}function Sf(){const e=Math.PI/32,t=Math.tan(e),i=Ac;return i*Math.sqrt(1+2*t*t)-i}function Ef(e,t,i){const r=1<<i.z,n=Oc(i.x/r),o=Oc((i.x+1)/r),s=Fc(i.y/r),a=Fc((i.y+1)/r);return function(e,t,i,r,n=0,o){const s=[];if(!e.length||!i||!r)return s;const a=(e,t)=>{for(const i of e)s.push({polygon:i,bounds:t})},l=Math.ceil(Math.log2(i)),c=Math.ceil(Math.log2(r)),h=l-c,u=[];for(let f=0;f<Math.abs(h);f++)u.push(h>0?0:1);for(let f=0;f<Math.min(l,c);f++)u.push(0),u.push(1);let d=e;if(d=pp(d,t[0].y-n,t[1].y+n,1),d=pp(d,t[0].x-n,t[1].x+n,0),!d.length)return s;const p=[];for(u.length?p.push({polygons:d,bounds:t,depth:0}):a(d,t);p.length;){const e=p.pop(),t=e.depth,i=u[t],r=e.bounds[0],s=e.bounds[1],l=0===i?r.x:r.y,c=0===i?s.x:s.y,h=o?o(i,l,c):.5*(l+c),d=pp(e.polygons,l-n,h+n,i),f=pp(e.polygons,h-n,c+n,i);if(d.length){const e=[r,new Ee(0===i?h:s.x,1===i?h:s.y)];u.length>t+1?p.push({polygons:d,bounds:e,depth:t+1}):a(d,e)}if(f.length){const e=[new Ee(0===i?h:r.x,1===i?h:r.y),s];u.length>t+1?p.push({polygons:f,bounds:e,depth:t+1}):a(f,e)}}return s}(e,t,Math.ceil((o-n)/11.25),Math.ceil((s-a)/11.25),1,(e,t,n)=>{if(0===e)return.5*(t+n);{const e=Fc((i.y+t/Ur)/r);return(Lc(.5*(Fc((i.y+n/Ur)/r)+e))*r-i.y)*Ur}})}function If(e,t,i,r,n,o){const s=Math.pow(2,r.z-n.z);for(let a=0;a<i;a++){let i=e.int16[2*(a+t)+0],l=e.int16[2*(a+t)+1];i=(i+n.x*Ur)*s-r.x*Ur,l=(l+n.y*Ur)*s-r.y*Ur,o.push(new Ee(i,l))}}let Af,Mf;es(mf,"FillExtrusionBucket",{omit:["layers","features"]}),es(cf,"PartData"),es(lf,"FootprintSegment"),es(hf,"BorderCentroidData"),es(ff,"GroundEffect");class Cf extends Ee{constructor(e,t,i){super(e,t),this.z=i}}class Pf extends Cf{constructor(e,t,i,r){super(e,t,i),this.w=r}}function Rf(e,t,i,r){const n="x"===i?"y":"x",o=(r-e[i])/(t[i]-e[i]);e[n]=Math.round(e[n]+(t[n]-e[n])*o),e[i]=r,e.hasOwnProperty("z")&&(e.z=pi(e.z,t.z,o)),e.hasOwnProperty("w")&&(e.w=pi(e.w,t.w,o))}function zf(e,t,i,r){const n=i,o=r;for(const s of["x","y"]){let i=e,r=t;i[s]>=r[s]&&(i=t,r=e),i[s]<n&&r[s]>n&&Rf(i,r,s,n),i[s]<o&&r[s]>o&&Rf(r,i,s,o)}}function Lf(e,t,i,r,n,o){const s=[];for(let a=0;a<e.length;a++){const l=e[a];let c;const h=s.length;let u=0;for(let e=0;e<l.length-1;e++){let h=l[e],d=l[e+1],p=0;const f=u;let m,_;o&&(p=Math.hypot(d.x-h.x,d.y-h.y),u+=p,m=h,_=d),h.x<t&&d.x<t||(h.x<t?h=new Ee(t,h.y+(t-h.x)/(d.x-h.x)*(d.y-h.y))._round():d.x<t&&(d=new Ee(t,h.y+(t-h.x)/(d.x-h.x)*(d.y-h.y))._round()),h.y<i&&d.y<i||(h.y<i?h=new Ee(h.x+(i-h.y)/(d.y-h.y)*(d.x-h.x),i)._round():d.y<i&&(d=new Ee(h.x+(i-h.y)/(d.y-h.y)*(d.x-h.x),i)._round()),h.x>=r&&d.x>=r||(h.x>=r?h=new Ee(r,h.y+(r-h.x)/(d.x-h.x)*(d.y-h.y))._round():d.x>=r&&(d=new Ee(r,h.y+(r-h.x)/(d.x-h.x)*(d.y-h.y))._round()),h.y>=n&&d.y>=n||(h.y>=n?h=new Ee(h.x+(n-h.y)/(d.y-h.y)*(d.x-h.x),n)._round():d.y>=n&&(d=new Ee(h.x+(n-h.y)/(d.y-h.y)*(d.x-h.x),n)._round()),c&&h.equals(c[c.length-1])||(c=[h],s.push(c),o&&o.push({progress:{min:f+Of(m,_,h)*p,max:1},parentIndex:a,prevPoint:m,nextPoint:_})),c.push(d),o&&(o[o.length-1].progress.max=f+Of(m,_,d)*p,o[o.length-1].nextPoint=_)))))}if(o&&u>0)for(let e=h;e<s.length;e++)o[e].progress.min/=u,o[e].progress.max/=u}return s}function Df(e,t,i,r,n){if(e.length<2)return void r.push(e);const o=[];for(;t.valid();){const[i,r]=t.get();for(let t=0;t<e.length-1;t++){const n=e[t],s=e[t+1],a=Dh(n,s,i,r);if(a){const[e]=a,i=new Ee(pi(n.x,s.x,e),pi(n.y,s.y,e));o.push({t:t+e,distance:0,point:i})}}t.next()}if(0===o.length)return void r.push(e);o.sort((e,t)=>e.t-t.t);let s=0,a=0,l=[];for(r.push(l);s!==e.length;){if(a===o.length){for(;s!==e.length;)0!==l.length&&l[l.length-1].equals(e[s])||l.push(e[s]),s++;break}o[a].t<=s?(0!==l.length&&l[l.length-1].equals(o[a].point)||l.push(o[a].point),Math.trunc(o[a].t),a++):(0!==l.length&&l[l.length-1].equals(e[s])||l.push(e[s]),s++)}}function Of(e,t,i){return e.x!==t.x?(i.x-e.x)/(t.x-e.x):e.y!==t.y?(i.y-e.y)/(t.y-e.y):0}function Ff(e,t){return e.x*t.x+e.y*t.y}function kf(e,t){if(1===e.length){let i=0;const r=t[i++];let n;for(;!n||r.equals(n);)if(n=t[i++],!n)return 1/0;for(;i<t.length;i++){const o=t[i],s=e[0],a=n.sub(r),l=o.sub(r),c=s.sub(r),h=Ff(a,a),u=Ff(a,l),d=Ff(l,l),p=Ff(c,a),f=Ff(c,l),m=h*d-u*u,_=(d*p-u*f)/m,g=(h*f-u*p)/m,y=r.z*(1-_-g)+n.z*_+o.z*g;if(isFinite(y))return y}return 1/0}{let e=1/0;for(const i of t)e=Math.min(e,i.z);return e}}function Bf(e,t,i){let r=1/0;Ch(i,t)&&(r=kf(i,t[0]));for(let n=0;n<t.length;n++){const o=t[n],s=e[n];for(let e=0;e<o.length-1;e++){const t=o[e],n=[t,o[e+1],s[e+1],s[e],t];Ah(i,n)&&(r=Math.min(r,kf(i,n)))}}return r!==1/0&&r}function Nf(e,t,i,r,n,o,s,a,l,c,h){return"globe"===e.projection.name?function(e,t,i,r,n,o,s,a,l,c,h){const u=[],d=[],p=e.projection.upVectorScale(h,e.center.lat,e.worldSize).metersToTile,f=[0,0,0,1],m=[0,0,0,1],_=(e,t,i,r)=>{e[0]=t,e[1]=i,e[2]=r,e[3]=1},g=Sf();i>0&&(i+=g),r+=g;for(const y of t){const t=[],g=[];for(const u of y){const d=u.x+n.x,y=u.y+n.y,x=e.projection.projectTilePoint(d,y,h),v=e.projection.upVector(h,u.x,u.y);let b=i,w=r;if(s){const e=Vf(d,y,i,r,s,a,l,c);b+=e.base,w+=e.top}0!==i?_(f,x.x+v[0]*p*b,x.y+v[1]*p*b,x.z+v[2]*p*b):_(f,x.x,x.y,x.z),_(m,x.x+v[0]*p*w,x.y+v[1]*p*w,x.z+v[2]*p*w),j(f,f,o),j(m,m,o),t.push(new Cf(f[0],f[1],f[2])),g.push(new Cf(m[0],m[1],m[2]))}u.push(t),d.push(g)}return[u,d]}(e,t,i,r,n,o,s,a,l,c,h):s?function(e,t,i,r,n,o,s,a,l){const c=[],h=[],u=[0,0,0,1];for(const d of e){const e=[],p=[];for(const c of d){const h=c.x+r.x,d=c.y+r.y,f=Vf(h,d,t,i,o,s,a,l);u[0]=h,u[1]=d,u[2]=f.base,u[3]=1,ee(u,u,n),u[3]=Math.max(u[3],1e-5);const m=new Cf(u[0]/u[3],u[1]/u[3],u[2]/u[3]);u[0]=h,u[1]=d,u[2]=f.top,u[3]=1,ee(u,u,n),u[3]=Math.max(u[3],1e-5);const _=new Cf(u[0]/u[3],u[1]/u[3],u[2]/u[3]);e.push(m),p.push(_)}c.push(e),h.push(p)}return[c,h]}(t,i,r,n,o,s,a,l,c):function(e,t,i,r,n){const o=[],s=[],a=n[8]*t,l=n[9]*t,c=n[10]*t,h=n[11]*t,u=n[8]*i,d=n[9]*i,p=n[10]*i,f=n[11]*i;for(const m of e){const e=[],t=[];for(const i of m){const o=i.x+r.x,s=i.y+r.y,m=n[0]*o+n[4]*s+n[12],_=n[1]*o+n[5]*s+n[13],g=n[2]*o+n[6]*s+n[14],y=n[3]*o+n[7]*s+n[15],x=m+a,v=_+l,b=g+c,w=Math.max(y+h,1e-5),T=m+u,S=_+d,E=g+p,I=Math.max(y+f,1e-5);e.push(new Cf(x/w,v/w,b/w)),t.push(new Cf(T/I,S/I,E/I))}o.push(e),s.push(t)}return[o,s]}(t,i,r,n,o)}function Vf(e,t,i,r,n,o,s,a){const l=s*n.getElevationAt(e,t,!0,!0),c=0!==o[0],h=c?0===o[1]?s*(o[0]/7-450):s*function(e,t,i){const r=Math.floor(t[0]/8),n=Math.floor(t[1]/8),o=10*(t[0]-8*r),s=10*(t[1]-8*n),a=e.getElevationAt(r,n,!0,!0),l=e.getMeterToDEM(i),c=Math.floor(.5*(o*l-1)),h=Math.floor(.5*(s*l-1)),u=e.tileCoordToPixel(r,n),d=2*c+1,p=2*h+1,f=function(e,t,i,r,n){return[e.getElevationAtPixel(t,i,!0),e.getElevationAtPixel(t+n,i,!0),e.getElevationAtPixel(t,i+n,!0),e.getElevationAtPixel(t+r,i+n,!0)]}(e,u.x-c,u.y-h,d,p),m=Math.abs(f[0]-f[1]),_=Math.abs(f[2]-f[3]),g=Math.abs(f[0]-f[2])+Math.abs(f[1]-f[3]),y=Math.min(.25,.5*l*(m+_)/d),x=Math.min(.25,.5*l*g/p);return a+Math.max(y*o,x*s)}(n,o,a):l;return{base:l+(0===i?-1:i),top:c?Math.max(h+r,l+i+2):l+r}}class Uf{constructor(e){this._callback=e,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class jf{constructor(){this.tasks={},this.taskQueue=[],je(["process"],this),this.invoker=new Uf(this.process),this.nextId=0}add(e,t){const i=this.nextId++,r=function({type:e,isSymbolTile:t,zoom:i}){return i=i||0,"message"===e?0:"maybePrepare"!==e||t?"parseTile"!==e||t?"parseTile"===e&&t?300-i:"maybePrepare"===e&&t?400-i:500:200-i:100-i}(t);if(0===r){try{e()}finally{}return null}return this.tasks[i]={fn:e,metadata:t,priority:r,id:i},this.taskQueue.push(i),this.invoker.trigger(),{cancel:()=>{delete this.tasks[i]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(e=>!!this.tasks[e]),!this.taskQueue.length)return;const e=this.pick();if(null===e)return;const t=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!t)return;t.fn()}finally{}}pick(){let e=null,t=1/0;for(let r=0;r<this.taskQueue.length;r++){const i=this.tasks[this.taskQueue[r]];i.priority<t&&(t=i.priority,e=r)}if(null===e)return null;const i=this.taskQueue[e];return this.taskQueue.splice(e,1),i}remove(){this.invoker.remove()}}class Gf{constructor(e,t,i){this.target=e,this.parent=t,this.mapId=i,this.callbacks={},this.cancelCallbacks={},je(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler
2=new jf}send(e,t,i,r,n=!1,o){const s=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(i.metadata=o,this.callbacks[s]=i);const a=new Set;return this.target.postMessage({id:s,type:e,hasCallback:!!i,targetMapId:r,mustQueue:n,sourceMapId:this.mapId,data:is(t,a)},a),{cancel:()=>{i&&delete this.callbacks[s],this.target.postMessage({id:s,type:"<cancel>",targetMapId:r,sourceMapId:this.mapId})}}}receive(e){const t=e.data;if(!t)return;const i=t.id;if(i&&(!t.targetMapId||this.mapId===t.targetMapId))if("<cancel>"===t.type){const e=this.cancelCallbacks[i];delete this.cancelCallbacks[i],e&&e.cancel()}else if(t.mustQueue||Je(self)){const e=this.callbacks[i],r=this.scheduler.add(()=>this.processTask(i,t),e&&e.metadata||{type:"message"});r&&(this.cancelCallbacks[i]=r)}else this.processTask(i,t)}processTask(e,t){if(delete this.cancelCallbacks[e],"<response>"===t.type){const i=this.callbacks[e];delete this.callbacks[e],i&&(t.error?i(rs(t.error)):i(null,rs(t.data)))}else{const i=new Set,r=t.hasCallback?(t,r)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:t?is(t):null,data:is(r,i)},i)}:()=>{},n=rs(t.data);if(this.parent[t.type])this.parent[t.type](t.sourceMapId,n,r);else if(this.parent.getWorkerSource){const e=t.type.split("."),{source:i,scope:o}=n;this.parent.getWorkerSource(t.sourceMapId,e[0],i,o)[e[1]](n,r)}else r(new Error(`Could not find function ${t.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var qf={workerUrl:"",workerClass:null,workerParams:void 0};function Hf(e){return null!=qf.workerClass?new qf.workerClass:new self.Worker(qf.workerUrl,Object.assign({name:e},qf.workerParams))}const $f="mapboxgl_preloaded_worker_pool";class Zf{constructor(e){this.active={},this.name=e}acquire(e,t=Zf.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<t;){const t=Hf(`${this.name||""}WorkerPool: ${e}-${this.workers.length}`);this.workers.push(t)}return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&0===this.numActive()&&(this.workers.forEach(e=>{e.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[$f]}numActive(){return Object.keys(this.active).length}}Zf.workerCount=2;class Wf{constructor(e,t,i="Worker",r=Zf.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=Ve();const n=this.workerPool.acquire(this.id,r);for(let o=0;o<n.length;o++){const e=new Wf.Actor(n[o],t,this.id);e.name=`${i} ${o}`,this.actors.push(e)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(e,t,i){Be(this.actors,(i,r)=>{i.send(e,t,r)},i=i||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}let Xf,Yf;function Kf(){return Xf||(Xf=new Zf),Xf}Wf.Actor=Gf;const Jf=4096;class Qf{constructor(e){this.module=e,this.memoryStack=this.module.malloc(Jf),this.memoryStackNextFree=this.memoryStack}createIntArray(e){const t=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Jf?-1:(new Int32Array(this.module.heap32.buffer,t,e.length).set(e),t)}createFloatArray(e){const t=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Jf?-1:(new Float32Array(this.module.heapF32.buffer,t,e.length).set(e),t)}readStringBuffer(e){let t="";for(;0!==this.module.heapU8[e];)t+=String.fromCharCode(this.module.heapU8[e]),++e;return t}setStyle(e){const t=e.normalScale;this.module.setStyle(t[0],t[1],t[2],e.tileToMeters)}setAOOptions(e,t){this.module.setAOOptions(e?1:0,t)}setMetricOptions(e,t){this.module.setMetricOptions(e?1:0,t)}setStructuralOptions(e){this.module.setStructuralOptions(e?1:0)}setFacadeOptions(e,t){this.module.setFacadeOptions(e,t?1:0)}setFauxFacadeOptions(e,t,i){this.module.setFauxFacadeOptions(e?1:0,t?1:0,i)}setFacadeClassifierOptions(e){this.module.setFacadeClassifierOptions(e)}generateMesh(e,t){this.memoryStackNextFree=this.memoryStack;for(const s of e){const e=this.createIntArray(s.ringIndices),t=this.createFloatArray(s.coordinates);if(-1===e||-1===t)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(s.id,s.sourceId,s.minHeight,s.height,s.roofType,t,e,s.ringIndices.length-1)}for(const s of t){let e;e=s.entrances?JSON.parse(s.entrances):[];const t=this.createFloatArray(e),i=this.createFloatArray(s.coordinates);if(-1===t||-1===i)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(s.sourceId,s.crossPerc,s.distanceToRoad,t,e.length,i,s.coordinates.length)}if(!this.module.generateMesh()){const e=this.module.getLastError();return this.readStringBuffer(e)}
2const i=this.module.getMeshCount(),r=new Array(i);for(let s=0;s<i;s++){const e=this.module.getPositionsPtr(s),t=this.module.getPositionsLength(s),i=new Float32Array(this.module.heapF32.buffer,e,t),n=this.module.getNormalsPtr(s),o=this.module.getNormalsLength(s),a=new Float32Array(this.module.heapF32.buffer,n,o),l=this.module.getAOPtr(s),c=this.module.getAOLength(s),h=new Float32Array(this.module.heapF32.buffer,l,c),u=this.module.getUVPtr(s),d=this.module.getUVLength(s),p=new Float32Array(this.module.heapF32.buffer,u,d),f=this.module.getFauxFacadePtr(s),m=this.module.getFauxFacadeLength(s),_=new Uint8Array(this.module.heapU8.buffer,f,m),g=this.module.getIndicesPtr(s),y=this.module.getIndicesLength(s),x=new Int16Array(this.module.heap16.buffer,g,y),v=this.module.getBuildingPart(s);r[s]={positions:i,normals:a,ao:h,uv:p,isFauxFacade:_,indices:x,buildingPart:v}}const n=this.module.getRingCount(),o=[];for(let s=0;s<n;s++){const e=this.module.getRingPtr(s),t=this.module.getRingLength(s),i=new Float32Array(this.module.heapF32.buffer,e,t);o.push(i)}return{meshes:r,outerRingLength:this.module.getOuterRingLength(),modifiedPolygonRings:o}}}let em,tm,im,rm,nm,om=null,sm=null,am=null,lm=null;function cm(){return Je(self)&&self.worker.dracoUrl?self.worker.dracoUrl:tm||at.DRACO_URL}function hm(){if(Je(self)&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(rm)return rm;const e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if("object"!=typeof WebAssembly)throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return rm=WebAssembly.validate(e)?at.MESHOPT_SIMD_URL:at.MESHOPT_URL,rm}function um(){return lm}const dm=5120,pm=5121,fm=5122,mm=5123,_m=5125,gm=5126,ym={[dm]:Int8Array,[pm]:Uint8Array,[fm]:Int16Array,[mm]:Uint16Array,[_m]:Uint32Array,[gm]:Float32Array},xm={[dm]:"DT_INT8",[pm]:"DT_UINT8",[fm]:"DT_INT16",[mm]:"DT_UINT16",[_m]:"DT_UINT32",[gm]:"DT_FLOAT32"},vm={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function bm(e,t,i){const r=i.json.bufferViews.length,n=i.buffers.length;t.bufferView=r,i.json.bufferViews[r]={buffer:n,byteLength:e.byteLength},i.buffers[n]=e}const wm="KHR_draco_mesh_compression";function Tm(e,t){const i=e.extensions&&e.extensions[wm];if(!i)return;const r=new im.Decoder,n=Pm(t,i.bufferView),o=new im.Mesh;if(!r.DecodeArrayToMesh(n,n.byteLength,o))throw new Error("Failed to decode Draco mesh");const s=t.json.accessors[e.indices],a=ym[s.componentType],l=s.count*a.BYTES_PER_ELEMENT,c=im._malloc(l);a===Uint16Array?r.GetTrianglesUInt16Array(o,l,c):r.GetTrianglesUInt32Array(o,l,c),bm(im.memory.buffer.slice(c,c+l),s,t),im._free(c);for(const h of Object.keys(i.attributes)){const n=r.GetAttributeByUniqueId(o,i.attributes[h]),s=t.json.accessors[e.attributes[h]],a=xm[s.componentType],l=s.count*vm[s.type]*ym[s.componentType].BYTES_PER_ELEMENT,c=im._malloc(l);r.GetAttributeDataArrayForAllPoints(o,n,im[a],l,c),bm(im.memory.buffer.slice(c,c+l),s,t),im._free(c)}r.destroy(),o.destroy(),delete e.extensions[wm]}const Sm="EXT_meshopt_compression";function Em(e,t){if(!e.extensions||!e.extensions[Sm])return;const i=e.extensions[Sm],r=new Uint8Array(t.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),n=new Uint8Array(i.count*i.byteStride);nm.decodeGltfBuffer(n,i.count,i.byteStride,r,i.mode,i.filter),e.buffer=t.buffers.length,e.byteOffset=0,t.buffers[e.buffer]=n.buffer,delete e.extensions[Sm]}const Im=1179937895,Am=new TextDecoder("utf8");function Mm(e,t){return new URL(e,t).href}function Cm(e,t,i,r){return fetch(Mm(e.uri,r)).then(e=>e.arrayBuffer()).then(e=>{t.buffers[i]=e})}function Pm(e,t){const i=e.json.bufferViews[t];return new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function Rm(e,t,i,r){if(e.uri){const n=Mm(e.uri,r);return fetch(n).then(e=>e.blob()).then(e=>createImageBitmap(e)).then(e=>{t.images[i]=e})}if(void 0!==e.bufferView){const r=Pm(t,e.bufferView),n=new Blob([r],{type:e.mimeType});return createImageBitmap(n).then(e=>{t.images[i]=e})}}function zm(e,t=0,i){const r={json:null,images:[],buffers:[]};
2if(new Uint32Array(e,t,1)[0]===Im){const i=new Uint32Array(e,t);let n=2;const o=(i[n++]>>2)-3,s=i[n++]>>2;if(n++,r.json=JSON.parse(Am.decode(i.subarray(n,n+s))),n+=s,n<o){const o=i[n++];n++;const s=t+(n<<2);r.buffers[0]=e.slice(s,s+o)}}else r.json=JSON.parse(Am.decode(new Uint8Array(e,t)));const{buffers:n,images:o,meshes:s,extensionsUsed:a,bufferViews:l}=r.json;let c=Promise.resolve();if(n){const e=[];for(let t=0;t<n.length;t++){const o=n[t];o.uri?e.push(Cm(o,r,t,i)):r.buffers[t]||(r.buffers[t]=null)}c=Promise.all(e)}return c.then(()=>{const e=[],t=a&&a.includes(wm),n=a&&a.includes(Sm);if(t&&e.push(function(){if(!im)return null!=em?em:(em=function(e){let t,i=null;function r(){t=new Uint8Array(i.buffer)}function n(){throw new Error("Unexpected Draco error.")}const o={a:{a:n,d:function(e,i,r){return t.copyWithin(e,i,i+r)},c:function(e){const n=t.length,o=Math.max(e>>>0,Math.ceil(1.2*n)),s=Math.ceil((o-n)/65536);try{return i.grow(s),r(),!0}catch(e){return!1}},b:n}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,o):e.then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,o))).then(e=>{const{Rb:n,Qb:o,P:s,T:a,X:l,Ja:c,La:h,Qa:u,Va:d,Wa:p,eb:f,jb:m,f:_,e:g,yb:y,zb:x,Ab:v,Bb:b,Db:w,Gb:T}=e.instance.exports;i=g;const S=(()=>{let e=0,i=0,r=0,s=0;return a=>{r&&(n(s),n(e),i+=r,r=e=0),e||(i+=128,e=o(i));const l=a.length+7&-8;let c=e;l>=i&&(r=l,c=s=o(l));for(let e=0;e<a.length;e++)t[c+e]=a[e];return c}})();return r(),_(),{memory:g,_free:n,_malloc:o,Mesh:class{constructor(){this.ptr=s()}destroy(){a(this.ptr)}},Decoder:class{constructor(){this.ptr=c()}destroy(){m(this.ptr)}DecodeArrayToMesh(e,t,i){const r=S(e),n=h(this.ptr,r,t,i.ptr);return!!l(n)}GetAttributeByUniqueId(e,t){return{ptr:u(this.ptr,e.ptr,t)}}GetTrianglesUInt16Array(e,t,i){d(this.ptr,e.ptr,t,i)}GetTrianglesUInt32Array(e,t,i){p(this.ptr,e.ptr,t,i)}GetAttributeDataArrayForAllPoints(e,t,i,r,n){f(this.ptr,e.ptr,t.ptr,i,r,n)}},DT_INT8:y(),DT_UINT8:x(),DT_INT16:v(),DT_UINT16:b(),DT_UINT32:w(),DT_FLOAT32:T()}})}(fetch(cm())),em.then(e=>{im=e,em=void 0}))}()),n&&e.push(function(){if(nm)return;const e=function(e){let t;const i=WebAssembly.instantiateStreaming(e,{}).then(e=>{t=e.instance,t.exports.__wasm_call_ctors()}),r={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},n={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:i,supported:!0,decodeGltfBuffer(e,i,o,s,a,l){!function(e,t,i,r,n,o,s){const a=e.exports.sbrk,l=r+3&-4,c=a(l*n),h=a(o.length),u=new Uint8Array(e.exports.memory.buffer);u.set(o,h);const d=t(c,r,n,h,o.length);if(0===d&&s&&s(c,l,n),i.set(u.subarray(c,c+r*n)),a(c-a(0)),0!==d)throw new Error(`Malformed buffer data: ${d}`)}(t,t.exports[n[a]],e,i,o,s,t.exports[r[l]])}}}(fetch(hm()));return e.ready.then(()=>{nm=e})}()),o)for(let s=0;s<o.length;s++)e.push(Rm(o[s],r,s,i));return(e.length?Promise.all(e):Promise.resolve()).then(()=>{if(t&&s)for(const{primitives:e}of s)for(const t of e)Tm(t,r);if(n&&s&&l)for(const e of l)Em(e,r);return r})})}function Lm(e){return fetch(e).then(e=>e.arrayBuffer()).then(t=>zm(t,0,e))}function Dm(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function Om(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class Fm{constructor(e,t,i,r){this.context=e,this.format=i,this.useMipmap=r&&r.useMipmap,this.texture=e.gl.createTexture(),this.update(t,{premultiply:r&&r.premultiply})}update(e,t){const i=e&&e instanceof HTMLVideoElement&&0===e.width?e.videoWidth:e.width,r=e&&e instanceof HTMLVideoElement&&0===e.height?e.videoHeight:e.height,{context:n}=this,{gl:o}=n,{x:s,y:a}=t&&t.position?t.position:{x:0,y:0},l=s+i,c=a+r;!this.size||this.size[0]===l&&this.size[1]===c||(o.bindTexture(o.TEXTURE_2D,null),o.deleteTexture(this.texture),this.texture=o.createTexture(),this.size=null),o.bindTexture(o.TEXTURE_2D,this.texture),n.pixelStoreUnpackFlipY.set(!1),n.pixelStoreUnpack.set(1),n.pixelStoreUnpackPremultiplyAlpha.set(this.format===o.RGBA8&&(!t||!1!==t.premultiply));const h=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&l>
vendor: 4,144 bytes, line 2
20&&c>0){const e=this.useMipmap?Math.floor(Math.log2(Math.max(l,c)))+1:1;o.texStorage2D(o.TEXTURE_2D,e,this.format,l,c),this.size=[l,c]}this.size&&(h?o.texSubImage2D(o.TEXTURE_2D,0,s,a,Dm(this.format),Om(this.format),e):"data"in e&&e.data&&o.texSubImage2D(o.TEXTURE_2D,0,s,a,i,r,Dm(this.format),Om(this.format),e.data)),this.useMipmap&&o.generateMipmap(o.TEXTURE_2D)}bind(e,t,i=!1){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),e!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,this.useMipmap&&!i?e===n.NEAREST?n.NEAREST_MIPMAP_NEAREST:n.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),t!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,t),this.wrapS=t)}bindExtraParam(e,t,i,r,n){const{context:o}=this,{gl:s}=o;s.bindTexture(s.TEXTURE_2D,this.texture),t!==this.magFilter&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,t),this.magFilter=t),e!==this.minFilter&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,this.useMipmap?e===s.NEAREST?s.NEAREST_MIPMAP_NEAREST:s.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,i),this.wrapS=i),r!==this.wrapT&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,r),this.wrapT=r),n!==this.compareMode&&(n?(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_COMPARE_FUNC,n)):s.texParameteri(s.TEXTURE_2D,s.TEXTURE_COMPARE_MODE,s.NONE),this.compareMode=n)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class km{constructor(e,t){this.context=e,this.texture=t}bind(e,t){const{context:i}=this,{gl:r}=i;r.bindTexture(r.TEXTURE_2D,this.texture),e!==this.minFilter&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,e),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,e),this.minFilter=e),t!==this.wrapS&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,t),this.wrapS=t)}}const Bm=Na([{name:"a_pos_3f",components:3,type:"Float32"}]),Nm=Na([{name:"a_color_3f",components:3,type:"Float32"}]),Vm=Na([{name:"a_color_4f",components:4,type:"Float32"}]),Um=Na([{name:"a_uv_2f",components:2,type:"Float32"}]),jm=Na([{name:"a_normal_3f",components:3,type:"Float32"}]),Gm=Na([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),qm=Na([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function Hm(e,t){const i=Zm(e.projection,e.zoom,e.width,e.height),r=function(e,t,i,r,n){const o=new Cc(i.lng-180*Wm,i.lat),s=new Cc(i.lng+180*Wm,i.lat),a=e.project(o.lng,o.lat),l=e.project(s.lng,s.lat),h=-Math.atan2(l.y-a.y,l.x-a.x),d=Gc.fromLngLat(i);d.y=Oe(d.y,-1+Wm,1-Wm);const f=d.toLngLat(),m=e.project(f.lng,f.lat),g=Gc.fromLngLat(f);g.x+=Wm;const y=g.toLngLat(),x=e.project(y.lng,y.lat),v=Ym(x.x-m.x,x.y-m.y,h),b=Gc.fromLngLat(f);b.y+=Wm;const w=b.toLngLat(),T=e.project(w.lng,w.lat),S=Ym(T.x-m.x,T.y-m.y,h),E=Math.abs(v.x)/Math.abs(S.y),I=c([]);_(I,I,-h*(1-(n?0:r)));const A=c([]);return p(A,A,[1,1-(1-E)*r,1]),A[4]=-S.x/S.y*r,_(A,A,h),u(A,I,A),A}(e.projection,0,e.center,i,t),n=$m(e);return p(r,r,[n,n,1]),r}function $m(e){const t=e.projection,i=Zm(e.projection,e.zoom,e.width,e.height),r=Xm(t,e.center),n=Xm(t,Cc.convert(t.center));return Math.pow(2,r*i+(1-i)*n)}function Zm(e,t,i,r,n=1/0){const o=e.range;if(!o)return 0;const s=Math.min(n,Math.max(i,r)),a=Math.log2(s/1024);return Fe(o[0]+a,o[1]+a,t)}const Wm=1/4e4;function Xm(e,t){const i=Oe(t.lat,-85.051129,Bc),r=new Cc(t.lng-180*Wm,i),n=new Cc(t.lng+180*Wm,i),o=e.project(r.lng,i),s=e.project(n.lng,i),a=Gc.fromLngLat(r),l=Gc.fromLngLat(n),c=s.x-o.x,h=s.y-o.y,u=l.x-a.x,d=l.y-a.y,p=Math.sqrt((u*u+d*d)/(c*c+h*h));return Math.log2(p)}function Ym(e,t,i){const r=Math.cos(i),n=Math.sin(i);return{x:e*r-t*n,y:e*n+t*r}}function Km(e,t,i){c(e),_(e,e,Ce(t[2])),f(e,e,Ce(t[0])),m(e,e,Ce(t[1])
vendor: 2,786 bytes, line 2
2),p(e,e,i),u(e,e,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function Jm(e,t,i,r,n,o,s,a){const l=[i[0]-t[0],i[1]-t[1],0],c=[r[0]-t[0],r[1]-t[1],0];if(S(l)<1e-12||S(c)<1e-12)return ie(e);const h=V([],l,c);B(h,h),M(c,r,t),l[2]=(o-n)*a,c[2]=(s-n)*a;const u=l;return V(u,l,c),B(u,u),ce(e,h,u)}function Qm(e,t,i=!1){const r=Su(t.zoom),n=function(e,t,i){const r=t.worldSize,n=[e[12],e[13],e[14]],o=Fc(n[1]/r),s=Oc(n[0]/r),a=c([]),l=Dc(1,o)*r,h=Dc(1,0)*r*Vc(o,t.zoom),f=1/bu(r);let m=h*f;if(i){const e=Zm(t.projection,t.zoom,t.width,t.height,1024);m=f*t.projection.pixelSpaceConversion(t.center.lat,r,e)}const _=Ic(o,s);A(_,_,z([],B([],_),l*m*n[2]));const g=function(e){const t=[e[0],e[1],e[2]];let i=[0,1,0];const r=V([],i,t);return V(i,t,r),0===F(i)&&(i=[0,1,0],V(r,t,i)),B(r,r),B(i,i),B(t,t),[r[0],r[1],r[2],0,i[0],i[1],i[2],0,t[0],t[1],t[2],0,e[0],e[1],e[2],1]}(_);p(a,a,[m,m,m*l]),d(a,a,[-n[0],-n[1],-n[2]]);const y=u([],t.globeMatrix,g);return u(y,y,a),u(y,y,e),y}(e,t,i);if(r>0){const i=function(e,t){const i=t.worldSize,r=Dc(1,0)*i*Vc(t.center.lat,t.zoom)/bu(i),n=Dc(1,t.center.lat)*i,o=c([]);m(o,o,Ce(t.center.lng)),f(o,o,Ce(t.center.lat)),d(o,o,[0,0,vc]),p(o,o,[r,r,r*n]);const s=t.point;return d(o,o,[-s.x,-s.y,0]),u(o,o,e),u(o,t.globeMatrix,o)}(e,t);return function(e,t,i){const r=(e,t,i)=>{const r=S(e),n=S(t),o=uu(e,t,i);return z(o,o,1/S(o)*pi(r,n,i))},n=r([e[0],e[1],e[2]],[t[0],t[1],t[2]],i),o=r([e[4],e[5],e[6]],[t[4],t[5],t[6]],i),s=r([e[8],e[9],e[10]],[t[8],t[9],t[10]],i),a=uu([e[12],e[13],e[14]],[t[12],t[13],t[14]],i);return[n[0],n[1],n[2],0,o[0],o[1],o[2],0,s[0],s[1],s[2],0,a[0],a[1],a[2],1]}(n,i,r)}return n}function e_(e,t,i,r){const n=bh.projectAabbCorners(r,i);let o=Number.MAX_VALUE;for(let a=0;a<n.length;++a){const e=n[a];e[0]=(.5*e[0]+.5)*t.width,e[1]=(.5-.5*e[1])*t.height,e[2]<o&&(o=e[2])}const s=function(e){const t=[];let i=0;for(let s=1;s<e.length;s++)(e[s][0]<e[i][0]||e[s][0]===e[i][0]&&e[s][1]<e[i][1])&&(i=s);let r,n=i;const o=new Uint8Array(e.length);do{if(o[n])break;t.push(new Ee(e[n][0],e[n][1])),o[n]=1,r=(n+1)%e.length;for(let t=0;t<e.length;t++){if(e[t][0]===e[r][0]&&e[t][1]===e[r][1]||e[t][0]===e[n][0]&&e[t][1]===e[n][1])continue;const i=[e[t][0]-e[n][0],e[t][1]-e[n][1]],o=[e[r][0]-e[n][0],e[r][1]-e[n][1]],s=i[0]*o[1]-i[1]*o[0];(s>0||0===s&&i[0]*o[0]+i[1]*o[1]>=0&&i[0]*i[0]+i[1]*i[1]>o[0]*o[0]+o[1]*o[1])&&(r=t)}n=r}while(n!==i);return t.length>0&&t.push(t[0]),t}(n);if(Ah(e,s))return o}const t_=64,i_={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function r_(e,t,i,r,n,o,s,a,l,h=!1){const f=i.zoom,m=i.project(r),_=Vc(r.lat,f),g=1/_;c(e),d(e,e,[m.x+s[0]*g,m.y+s[1]*g,s[2]]);let y=1,x=1;const b=i.worldSize;if(h){if("mercator"===i.projection.name){let e=0;i.elevation&&(e=i.elevation.getAtPointOrZero(new Gc(m.x/b,m.y/b),
vendor: 9,037 bytes, line 2
20));const t=ee([],[m.x,m.y,e,1],i.projMatrix)[3]/i.cameraToCenterDistance;y=t,x=t*Vc(i.center.lat,f)}else if("globe"===i.projection.name){const t=Qm(e,i),n=[0,0,0,1];ee(n,n,u([],i.projMatrix,t));const o=n[3]/i.cameraToCenterDistance,s=Su(f),a=i.projection.pixelsPerMeter(r.lat,b)*Vc(r.lat,f),l=i.projection.pixelsPerMeter(i.center.lat,b)*Vc(i.center.lat,f);y=o/pi(a,Nc(i.center.lat),s),x=o*_/a,y*=l,x*=l}}else y=g;p(e,e,[y,y,x]);const w=[...e],T=t.orientation,S=[];if(Km(S,[T[0]+(n?n[0]:0),T[1]+(n?n[1]:0),T[2]+(n?n[2]:0)],o),u(e,w,S),a&&i.elevation){let n=0;const o=[];if(l&&i.elevation){n=function(e,t,i,r,n){const o=t.elevation;if(!o)return 0;const s=bh.projectAabbCorners(i,r),a=Dc(1,n.lat)*t.worldSize,l=function(e,t){const i=[0,0,1],r=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const n of r){const r=e[n.corners[0]],o=e[n.corners[1]],s=e[n.corners[2]],a=[o[0]-r[0],o[1]-r[1],t*(o[2]-r[2])],l=V(a,a,[s[0]-r[0],s[1]-r[1],t*(s[2]-r[2])]);B(l,l),n.dotProductWithUp=N(l,i)}return r.sort((e,t)=>e.dotProductWithUp-t.dotProductWithUp),r[0].corners}(s,a),c=s[l[0]],h=s[l[1]],u=s[l[2]],d=s[l[3]],p=o.getAtPointOrZero(new Gc(c[0]/t.worldSize,c[1]/t.worldSize),0),f=o.getAtPointOrZero(new Gc(h[0]/t.worldSize,h[1]/t.worldSize),0),m=o.getAtPointOrZero(new Gc(u[0]/t.worldSize,u[1]/t.worldSize),0),_=o.getAtPointOrZero(new Gc(d[0]/t.worldSize,d[1]/t.worldSize),0),g=(p+_)/2,y=(f+m)/2;return g>y?f<m?Jm(e,h,d,c,f,_,p,a):Jm(e,u,c,d,m,p,_,a):p<_?Jm(e,c,h,u,p,f,m,a):Jm(e,d,u,h,_,m,f,a),Math.max(g,y)}(o,i,t.aabb,e,r);const s=u([],v([],o),S);u(e,w,s)}else n=i.elevation.getAtPointOrZero(new Gc(m.x/b,m.y/b),0);0!==n&&(e[14]+=n)}}class n_{constructor(e,t,i,r,n){this.materialOverrides=new Map,this.nodeOverrides=new Map,this.materialOverrideNames=[],this.nodeOverrideNames=[],this.featureProperties={},this.id=e,this.uri=t,this.position=null!=i?new Cc(i[0],i[1]):new Cc(0,0),this.orientation=null!=r?r:[0,0,0],this.nodes=n,this.uploaded=!1,this.aabb=new bh([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,t){u(e.globalMatrix,t,e.localMatrix);const i=this.nodeOverrides.get(e.name);if(void 0!==i){const t=[];n=i.orientation,c(r=t),m(r,r,Ce(n[1])),_(r,r,Ce(n[2])),f(r,r,Ce(n[0])),u(e.globalMatrix,e.globalMatrix,t)}var r,n;if(e.meshes)for(const o of e.meshes){const t=bh.applyTransformFast(o.aabb,e.globalMatrix);this.aabb.encapsulate(t)}if(e.children)for(const o of e.children)this._applyTransformations(o,e.globalMatrix)}computeBoundsAndApplyParent(){const e=c([]);this.aabb=new bh([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const t of this.nodes)this._applyTransformations(t,e)}computeModelMatrix(e,t,i,r,n,o,s=!1){r_(this.matrix,this,e.transform,this.position,t,i,r,n,o,s)}upload(e){if(!this.uploaded){for(const t of this.nodes)a_(t,e);for(const e of this.nodes)l_(e);this.uploaded=!0}}destroy(){for(const e of this.nodes)h_(e)}}function o_(e,t,i=!1){e.uploaded||(e.gfxTexture=new Fm(t,e.image,i?t.gl.R8:t.gl.RGBA8,{useMipmap:e.sampler.minFilter>=t.gl.NEAREST_MIPMAP_NEAREST}),e.uploaded=!0,e.image=null)}function s_(e,t,i){e.indexBuffer=t.createIndexBuffer(e.indexArray,!1,!0),e.vertexBuffer=t.createVertexBuffer(e.vertexArray,Bm.members,!1,!0),e.normalArray&&(e.normalBuffer=t.createVertexBuffer(e.normalArray,jm.members,!1,!0)),e.texcoordArray&&(e.texcoordBuffer=t.createVertexBuffer(e.texcoordArray,Um.members,!1,!0)),e.colorArray&&(e.colorBuffer=t.createVertexBuffer(e.colorArray,(12===e.colorArray.bytesPerElement?Nm:Vm).members,!1,!0)),e.featureArray&&(e.pbrBuffer=t.createVertexBuffer(e.featureArray,qm.members,!0)),e.segments=Nl.simpleSegment(0,0,e.vertexArray.length,e.indexArray.length);const r=e.material;r.pbrMetallicRoughness.baseColorTexture&&o_(r.pbrMetallicRoughness.baseColorTexture,t),r.pbrMetallicRoughness.metallicRoughnessTexture&&o_(r.pbrMetallicRoughness.metallicRoughnessTexture,t),r.normalTexture&&o_(r.normalTexture,t),r.occlusionTexture&&o_(r.occlusionTexture,t,i),r.emissionTexture&&o_(r.emissionTexture,t)}function a_(e,t,i){if(e.meshes)for(const r of e.meshes)s_(r,t,i);if(e.children)for(const r of e.children)a_(r,t,i)}function l_(e){if(e.meshes)for(const t of e.meshes)t.indexArray.destroy(),t.vertexArray.destroy(),t.colorArray&&t.colorArray.destroy(),t.normalArray&&t.normalArray.destroy(),t.texcoordArray&&t.texcoordArray.destroy(),t.featureArray&&t.featureArray.destroy();if(e.children)for(const t of e.children)l_(t)}function c_(e){e.pbrMetallicRoughness.baseColorTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),e.pbrMetallicRoughness.metallicRoughnessTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),e.normalTexture&&e.normalTexture.gfxTexture&&e.normalTexture.gfxTexture.destroy(),e.emissionTexture&&e.emissionTexture.gfxTexture&&e.emissionTexture.gfxTexture.destroy(),e.occlusionTexture&&e.occlusionTexture.gfxTexture&&e.occlusionTexture.gfxTexture.destroy()}function h_(e){if(e.meshes)for(const t of e.meshes)t.vertexBuffer&&(t.vertexBuffer.destroy(),t.indexBuffer.destroy(),t.normalBuffer&&t.normalBuffer.destroy(),t.texcoordBuffer&&t.texcoordBuffer.destroy(),t.colorBuffer&&t.colorBuffer.destroy(),t.pbrBuffer&&t.pbrBuffer.destroy(),t.segments.destroy(),t.material&&c_(t.material));if(e.children)for(const t of e.children)h_(t)}function u_(e,t){const i=e.json.bufferViews[t.bufferView],r=ym[t.componentType];return new r(e.buffers[i.buffer],(t.byteOffset||0)+(i.byteOffset||0),t.count*(i.byteStride&&i.byteStride!==vm[t.type]*r.BYTES_PER_ELEMENT?i.byteStride/r.BYTES_PER_ELEMENT:vm[t.type]))}function d_(e,t,i,r){const n=ym[t.componentType],o=function(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(n),s=e.json.bufferViews[t.bufferView],a=s.byteStride?s.byteStride/n.BYTES_PER_ELEMENT:vm[t.type],l=i.float32,c=l.length/i.capacity;for(let h=0,u=0;h<t.count*a;h+=a,u+=c)for(let e=0;e<c;e++)l[u+e]=r[h+e]*o;i._trim()}function p_(e,t,i){const r=e.indices,n=e.attributes,o={};o.indexArray=new ll;const s=t.json.accessors[r],a=s.count/3;o.indexArray.reserve(a);const l=u_(t,s);for(let d=0;d<a;d++)o.indexArray.emplaceBack(l[3*d],l[3*d+1],l[3*d+2]);o.indexArray._trim(),o.vertexArray=new Xa;const c=t.json.accessors[n.POSITION];o.vertexArray.reserve(c.count);const h=u_(t,c);for(let d=0;d<c.count;d++)o.vertexArray.emplaceBack(h[3*d],h[3*d+1],h[3*d+2]);if(o.vertexArray._trim(),o.aabb=new bh(c.min,c.max),o.centroid=function(e,t){const i=[0,0,0],r=e.length;if(r>0){for(let n=0;n<r;n++){const r=3*e[n];i[0]+=t[r],i[1]+=t[r+1],i[2]+=t[r+2]}i[0]/=r,i[1]/=r,i[2]/=r}return i}(l,h),void 0!==n.COLOR_0){const e=t.json.accessors[n.COLOR_0],i=vm[e.type],r=u_(t,e);o.colorArray=3===i?new Xa:new tl,o.colorArray.resize(e.count),d_(t,e,o.colorArray,r)}if(void 0!==n.NORMAL){o.normalArray=new Xa;const e=t.json.accessors[n.NORMAL];o.normalArray.resize(e.count);const i=u_(t,e);d_(t,e,o.normalArray,i)}if(void 0!==n.TEXCOORD_0&&i.length>0){o.texcoordArray=new _l;const e=t.json.accessors[n.TEXCOORD_0];o.texcoordArray.resize(e.count);const i=u_(t,e);d_(t,e,o.texcoordArray,i)}if(void 0!==n._FEATURE_ID_RGBA4444){const e=t.json.accessors[n._FEATURE_ID_RGBA4444];t.json.extensionsUsed&&t.json.extensionsUsed.includes("EXT_meshopt_compression")&&(o.featureData=u_(t,e))}void 0!==n._FEATURE_RGBA4444&&(o.featureData=new Uint32Array(u_(t,t.json.accessors[n._FEATURE_RGBA4444]).buffer));const u=e.material;return o.material=function(e,t){const{emissiveFactor:i=[0,0,0],alphaMode:r="OPAQUE",alphaCutoff:n=.5,normalTexture:o,occlusionTexture:s,emissiveTexture:a,doubleSided:l,name:c}=e,{baseColorFactor:h=[1,1,1,1],metallicFactor:u=1,roughnessFactor:d=1,baseColorTexture:p,metallicRoughnessTexture:f}=e.pbrMetallicRoughness||{},m=s?t[s.index]:void 0;if(s&&s.extensions&&s.extensions.KHR_texture_transform&&m){const e=s.extensions.KHR_texture_transform;m.offsetScale=[e.offset[0],e.offset[1],e.scale[0],e.scale[1]]}return{name:c,pbrMetallicRoughness:{baseColorFactor:new ci(...h),metallicFactor:u,roughnessFactor:d,baseColorTexture:p?t[p.index]:void 0,metallicRoughnessTexture:f?t[f.index]:void 0},doubleSided:l,emissiveFactor:new ci(...i),alphaMode:r,alphaCutoff:n,normalTexture:o?t[o.index]:void 0,occlusionTexture:m,emissionTexture:a?t[a.index]:void 0,defined:void 0===e.defined}}(void 0!==u?t.json.materials[u]:{defined:!1},i),o}function f_(e,t,i){const{matrix:r,rotation:n,translation:o,scale:s,mesh:a,extras:c,children:h,name:u}=e,d={};if(d.name=u,d.localMatrix=r||function(e,t,i,r){var n=t[0],o=t[1],s=t[2],a=t[3],l=n+n,c=o+o,h=s+s,u=n*l,d=n*c,p=n*h,f=o*c,m=o*h,_=s*h,g=a*l,y=a*c,x=a*h,v=r[0],b=r[1],w=r[2];return e[0]=(1-(f+_))*v,e[1]=(d+x)*v,e[2]=(p-y)*v,e[3]=0,e[4]=(d-x)*b,e[5]=(1-(u+_))*b,e[6]=(m+g)*b,e[7]=0,e[8]=(p+y)*w,e[9]=(m-g)*w,e[10
vendor: 13,815 bytes, line 2
2]=(1-(u+f))*w,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}([],n||[0,0,0,1],o||[0,0,0],s||[1,1,1]),d.globalMatrix=l(d.localMatrix),void 0!==a){d.meshes=i[a];const e=d.anchor=[0,0];for(const t of d.meshes){const{min:i,max:r}=t.aabb;e[0]+=i[0]+r[0],e[1]+=i[1]+r[1]}e[0]=Math.floor(e[0]/d.meshes.length/2),e[1]=Math.floor(e[1]/d.meshes.length/2)}if(c&&(c.id&&(d.id=c.id),c.lights&&(d.lights=function(e){if(!e.length)return[];const t=function(e){const t=atob(e),i=new Uint8Array(t.length);for(let r=0;r<t.length;r++)i[r]=t.codePointAt(r);return i}(e),i=[],r=t.length/24,n=new Uint16Array(t.buffer),o=new Float32Array(t.buffer);for(let s=0;s<r;s++){const e=n[2*s*6]/30,t=n[2*s*6+1]/30,r=n[2*s*6+10]/100,a=o[6*s+1],l=o[6*s+2],c=o[6*s+3],h=o[6*s+4],u=c-a,d=h-l,p=Math.hypot(u,d);i.push({pos:[a+.5*u,l+.5*d,t],normal:[d/p,-u/p,0],width:p,height:e,depth:r,points:[a,l,c,h]})}return i}(c.lights)),c.MAPBOX_geometry_bloom&&(d.isGeometryBloom=c.MAPBOX_geometry_bloom)),h){const e=[];for(const r of h)e.push(f_(t.json.nodes[r],t,i));d.children=e}return d}function m_(e){if(0===e.vertices.length||0===e.indices.length)return null;const t=new Sp(e.vertices,e.indices,8,256),[i,r]=[t.min.clone(),t.max.clone()];return{vertices:e.vertices,indices:e.indices,grid:t,min:i,max:r}}function __(e){if(!e.extras||!e.extras.ground)return null;const t=e.extras.ground;if(!t||!Array.isArray(t)||0===t.length)return null;const i=t[0];if(!i||!Array.isArray(i)||0===i.length)return null;const r=[];for(const s of i){if(!Array.isArray(s)||2!==s.length)continue;const e=s[0],t=s[1];"number"==typeof e&&"number"==typeof t&&r.push(new Ee(e,t))}if(r.length<3)return null;r.length>1&&r[r.length-1].equals(r[0])&&r.pop();let n=0;for(let s=0;s<r.length;s++){const e=r[s],t=r[(s+1)%r.length],i=r[(s+2)%r.length];n+=(e.x-t.x)*(i.y-t.y)-(i.x-t.x)*(e.y-t.y)}n>0&&r.reverse();const o=Qu(r.flatMap(e=>[e.x,e.y]),[]);return 0===o.length?null:{vertices:r,indices:o}}function g_(e,t){const i=[],r=[];let n=0;const o=[];for(const s of e){n=i.length;const e=s.vertexArray.float32,a=s.indexArray.uint16;for(let r=0;r<s.vertexArray.length;r++)o[0]=e[3*r+0],o[1]=e[3*r+1],o[2]=e[3*r+2],j(o,o,t),i.push(new Ee(o[0],o[1]));for(let t=0;t<3*s.indexArray.length;t++)r.push(a[t]+n)}if(r.length%3!=0)return null;for(let s=0;s<r.length;s+=3){const e=i[r[s+0]],t=i[r[s+1]],n=i[r[s+2]];(e.x-t.x)*(n.y-t.y)-(n.x-t.x)*(e.y-t.y)>0&&([r[s+1],r[s+2]]=[r[s+2],r[s+1]])}return{vertices:i,indices:r}}function y_(e){const t=function(e,t){const i=[],r=WebGL2RenderingContext;if(e.json.textures)for(const n of e.json.textures){const o={magFilter:r.LINEAR,minFilter:r.NEAREST,wrapS:r.REPEAT,wrapT:r.REPEAT};void 0!==n.sampler&&Object.assign(o,e.json.samplers[n.sampler]),i.push({image:t[n.source],sampler:o,uploaded:!1})}return i}(e,e.images),i=function(e,t){const i=[];for(const r of e.json.meshes){const n=[];for(const i of r.primitives)n.push(p_(i,e,t));i.push(n)}return i}(e,t),{scenes:r,scene:n,nodes:o}=e.json,s=r?r[n||0].nodes:[...o.keys()],a=[];for(const l of s)a.push(f_(o[l],e,i));return function(e,t,i){const r={},n=new Set;for(let o=0;o<e.length;o++){const e=i[t[o]];if(!e.extras)continue;const s=e.extras["mapbox:footprint:version"],a=e.extras["mapbox:footprint:id"];(s||a)&&n.add(o),"1.0.0"===s&&a&&(r[a]=o)}for(let o=0;o<e.length;o++){if(n.has(o))continue;const s=e[o],a=i[t[o]];if(!a.extras)continue;let l=null;s.id in r&&(l=g_(e[r[s.id]].meshes,s.localMatrix)),l||(l=__(a)),l&&(s.footprint=m_(l))}if(n.size>0){const t=Array.from(n.values()).sort((e,t)=>e-t);for(let i=t.length-1;i>=0;i--)e.splice(t[i],1)}}(a,s,e.json.nodes),a}function x_(e){e.heightmap=new Float32Array(4096),e.heightmap.fill(-1);const t=e.vertexArray.float32,i=e.aabb.min[0]-1,r=e.aabb.min[1]-1,n=t_/(e.aabb.max[0]-i+2),o=t_/(e.aabb.max[1]-r+2);for(let s=0;s<t.length;s+=3){const a=t[s+2],l=(t[s+0]-i)*n|0,c=(t[s+1]-r)*o|0;a>e.heightmap[c*t_+l]&&(e.heightmap[c*t_+l]=a)}}function v_(e,t,i,r,n){i.reserve(i.length+4*e.length),r.reserve(r.length+10*e.length),n.reserve(n.length+10*e.length);let o=r.length;for(const s of e){const e=Math.min(10,Math.max(4,1.3*s.height))*t,a=[-s.normal[1],s.normal[0],0],l=Math.min(.29,.1*s.width/s.depth),c=s.width-2*s.depth*t*(l+.01),h=L([],s.pos,a,c/2),u=L([],s.pos,a,-c/2),d=[h[0],h[1],h[2]+s.height],p=[u[0],u[1],u[2]+s.height],f=L([],s.normal,a,l);z(f,f,e);const m=L([],s.normal,a,-l);z(m,m,e),A(f,h,f),A(m,u,m),h[2]+=.1,u[2]+=.1,r.emplaceBack(f[0],f[1],f[2]),r.emplaceBack(m[0],m[1],m[2]),r.emplaceBack(h[0],h[1],h[2]),r.emplaceBack(u[0],u[1],u[2]),r.emplaceBack(d[0],d[1],d[2]),r.emplaceBack(p[0],p[1],p[2]),r.emplaceBack(h[0],h[1],h[2]),r.emplaceBack(u[0],u[1],u[2]),r.emplaceBack(f[0],f[1],f[2]),r.emplaceBack(m[0],m[1],m[2]);const _=c/e/2;n.emplaceBack(-_-l,-1,_,.8),n.emplaceBack(_+l,-1,_,.8),n.emplaceBack(-_,0,_,1.3),n.emplaceBack(_,0,_,1.3),n.emplaceBack(_+l,-.8,_,.7),n.emplaceBack(_+l,-.8,_,.7),n.emplaceBack(0,0,_,1.3),n.emplaceBack(0,0,_,1.3),n.emplaceBack(_+l,-1.2,_,.8),n.emplaceBack(_+l,-1.2,_,.8),i.emplaceBack(6+o,4+o,8+o),i.emplaceBack(7+o,9+o,5+o),i.emplaceBack(0+o,1+o,2+o),i.emplaceBack(1+o,3+o,2+o),o+=10}}function b_(e,t){const i={};i.indexArray=new ll,i.vertexArray=new Xa,i.colorArray=new tl,v_(e,t,i.indexArray,i.vertexArray,i.colorArray);const r={defined:!0};r.emissiveFactor=ci.black;const n={};return n.baseColorFactor=ci.white,r.pbrMetallicRoughness=n,i.material=r,i.aabb=new bh([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}const w_=Na([{name:"a_pos_3f",components:3,type:"Float32"}]),T_=Na([{name:"a_normal_3",components:3,type:"Int16"}]),S_=Na([{name:"a_centroid_3",components:3,type:"Int16"}]),E_=Na([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),I_=Na([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),A_=Na([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),M_=Na([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),C_=Na([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),P_=Na([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),R_=Qc.types,z_=32767;function L_(e,t){const i=Ur+t;for(const r of e)for(const e of r)if(e.x<-t||e.x>i||e.y<-t||e.y>i)return!1;return!0}function D_(e){switch(e){case"flat":return 3;case"hipped":return 1;case"gabled":return 2;case"parapet":return 0;case"mansard":return 4;case"skillion":return 5;case"pyramidal":return 6;default:throw new Error(`Unknown roof shape: ${e}`)}}class O_{constructor(){this.layoutVertexArray=new Xa,this.layoutAttenuationArray=new tl,this.layoutColorArray=new rl,this.indexArray=new ll,this.indexArrayForConflation=new ll,this.segmentsBucket=new Nl}}class F_{constructor(e){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new Nl,this.entranceBloom=new O_;const t=66560;this.layoutVertexArray=new Xa,this.layoutVertexArray.reserve(t),this.layoutNormalArray=new ja,this.layoutNormalArray.reserve(t),this.layoutCentroidArray=new ja,this.layoutCentroidArray.reserve(t),this.layoutColorArray=new rl,this.layoutColorArray.reserve(t),this.layoutFloodLightDataArray=new yl,this.layoutFloodLightDataArray.reserve(t),this.layoutAOArray=new wl,this.layoutAOArray.reserve(t),this.indexArray=new ll,this.indexArray.reserve(66560),this.indexArrayForConflation=new ll,this.segmentsBucket=new Nl,this.entranceBloom=new O_,e&&(this.layoutFacadePaintArray=new rl,this.layoutFacadeDataArray=new Ka,this.layoutFacadeVerticalRangeArray=new rl)}reserve(e,t,i){this.layoutVertexArray.reserveForAdditional(e),this.layoutCentroidArray.reserveForAdditional(e),this.layoutFloodLightDataArray.reserveForAdditional(e),this.layoutNormalArray.reserveForAdditional(e),this.layoutAOArray.reserveForAdditional(e),this.layoutColorArray.reserveForAdditional(e),this.indexArray.reserveForAdditional(t),i&&(this.layoutFacadePaintArray.reserveForAdditional(e),this.layoutFacadeDataArray.reserveForAdditional(e),this.layoutFacadeVerticalRangeArray.reserveForAdditional(e))}}class k_{constructor(e){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new _l,this.footprintsIndices=new yl,this.footprintsMin=new Ee(1/0,1/0),this.footprintsMax=new Ee(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new F_(!1),this.buildingWithFacade=new F_(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.worldview=e.worldview,this.lut=e.lut,this.programConfigurations=new fc(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.projection=e.projection,this.groundEffect=new ff(e),this.groundEffect.groundRadiusArray=new qa,this.hasAppearances=null}updateFootprints(e,t){const i=new Sp([],[],1),r={vertices:[],indices:new Uint32Array(0),grid:i,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};t.push({footprint:r,id:e})}updateAppearances(e,t,i,r){}prepare(){return function(){if(null!=lm||null!=am)return null;if(null!=sm)return sm;const e=fetch(at.BUILDING_GEN_URL);return sm=function(e){let t,i,r,n,o;function s(){t=new Uint8Array(o.buffer),i=new Int16Array(o.buffer),r=new Int32Array(o.buffer),n=new Float32Array(o.buffer)}function a(){throw new Error("Unexpected BuildingGen error.")}const l=()=>{},c={a:{a:a,f:function(e){const i=t.length,r=Math.max(e>>>0,Math.ceil(1.2*i)),n=Math.ceil((r-i)/65536);try{return o.grow(n),s(),!0}catch(e){return!1}},g:a,b:l,c:l,d:l,e:l}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,c):e.then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,c))).then(e=>{const a=e.instance.exports;return(0,a.g)(),o=a.f,s(),new Qf({setStyle:a.h,setAOOptions:a.i,setMetricOptions:a.j,setStructuralOptions:a.k,setFacadeOptions:a.l,setFauxFacadeOptions:a.m,setFacadeClassifierOptions:a.n,addFeature:a.o,addFacade:a.p,generateMesh:a.q,getLastError:a.r,getOuterRingLength:a.s,getMeshCount:a.t,getPositionsPtr:a.u,getPositionsLength:a.v,getNormalsPtr:a.w,getNormalsLength:a.x,getAOPtr:a.y,getAOLength:a.z,getUVPtr:a.A,getUVLength:a.B,getFauxFacadePtr:a.C,getFauxFacadeLength:a.D,getIndicesPtr:a.E,getIndicesLength:a.F,getBuildingPart:a.G,getRingCount:a.H,getRingPtr:a.I,getRingLength:a.J,malloc:a.K,free:a.L,heapU8:t,heap16:i,heap32:r,heapF32:n})})}(e).then(e=>(sm=null,lm=e,lm)).catch(e=>{We("Could not load building-gen"),sm=null,am=e}),sm}()}populate(e,t,i,r){const n=um();if(!n)return;const o=jc(i);this.tileToMeter=o,this.brightness=t.brightness,n.setStyle({normalScale:[1,-1,o],tileToMeters:o}),n.setAOOptions(!1,.3),n.setMetricOptions(!1,16),n.setStructuralOptions(!0),n.setFacadeClassifierOptions(3);const s=new Map,a=new Map;let l=0;for(const{feature:_}of e){if("LineString"!==R_[_.type]){s.set(_.id,_.properties.source_id);continue}const e=this.layers[0]._featureFilter.needGeometry;if(e&&!this.layers[0]._featureFilter.filter(new Js(this.zoom),_,i))continue;const t=Jc(_,e);if(!e&&!this.layers[0]._featureFilter.filter(new Js(this.zoom),t,i))continue;const n=e?t.geometry:Kc(_,i,r),o=[];for(const i of n)for(const e of i)o.push(e.x),o.push(e.y);const c={coordinates:o,crossPerc:_.properties.cross_perc,distanceToRoad:_.properties.distance_to_road,entrances:_.properties.entrances,sourceId:0},h=_.properties.source_id;let u=a.get(h);u||(u=[],a.set(h,u)),u.push(c),++l}this.maxHeight=0;const c=new Array,h=new Set,u=e=>{null!=e&&h.add(e)},d=(e,t)=>{null!=e&&c.push({buildingId:e,footprintIndex:t})},p=64*(e.length-l),f=p/2;this.buildingWithFacade.reserve(p,f,!0),this.buildingWithoutFacade.reserve(2*p,2*f,!1),this.footprintsIndices.reserve(16*(e.length-l)),this.footprintsVertices.reserve(8*(e.length-l));for(const{feature:_,id:g,index:y,sourceLayerIndex:x}of e){if("LineString"===R_[_.type])continue;const e=this.layers[0]._featureFilter.needGeometry;if(e&&!this.layers[0]._featureFilter.filter(new Js(this.zoom),_,i))continue;let l=null;if(_.properties&&_.properties.hasOwnProperty("building_id")&&(l=Number(_.properties.building_id),h.has(l)))continue;const c=Jc(_,e);if(!e&&!this.layers[0]._featureFilter.filter(new Js(this.zoom),c,i))continue;const p=e?c.geometry:Kc(_,i,r),f=Ed(p,500);let m=!1;for(const t of f)if(1!==t.length){m=!0;break}if(m){u(l);continue}if(!L_(p,163)){u(l);continue}const v=this.layers[0],b=D_(v.layout.get("building-roof-shape").evaluate(_,{},i)),w=v.layout.get("building-base").evaluate(_,{},i),T=v.layout.get("building-height").evaluate(_,{},i),S=v.layout.get("building-flood-light-ground-radius").evaluate(_,{},i),E=v.paint.get("building-ambient-occlusion-intensity"),I=S/this.tileToMeter;_.properties["building-part"]="roof";const A=v.paint.get("building-color").evaluate(_,{},this.canonical).toPremultipliedRenderColor(this.lut),M=v.paint.get("building-emissive-strength").evaluate(_,{},this.canonical);_.properties["building-part"]="wall";const C=v.paint.get("building-color").evaluate(_,{},this.canonical).toPremultipliedRenderColor(this.lut),P=v.paint.get("building-emissive-strength").evaluate(_,{},this.canonical);_.properties["building-part"]="window";const R=v.paint.get("building-color").evaluate(_,{},this.canonical).toPremultipliedRenderColor(this.lut),z=v.paint.get("building-emissive-strength").evaluate(_,{},this.canonical);_.properties["building-part"]="door";const L=v.paint.get("building-color").evaluate(_,{},this.canonical).toPremultipliedRenderColor(this.lut),D=v.paint.get("building-emissive-strength").evaluate(_,{},this.canonical);let O=v.layout.get("building-flood-light-wall-radius").evaluate(_,{},i);O=Oe(O,0,2048);const F=O/2048*z_,k=s.get(g),B=a.get(k)||[],N=0!==B.length&&v.layout.get("building-facade").evaluate(_,{},i);
vendor: 5,530 bytes, line 2
2n.setFacadeOptions(4,!0),n.setFauxFacadeOptions(N,!1,1);let V=0,U=0,j=0,G=0,q=0,H=0,$=0,Z=0,W=0,X=0,Y=0;if(N){let e=Math.round(v.layout.get("building-facade-floors").evaluate(_,{},i));if(0===w){e=Math.max(1,e-(B.length>0?1:0));let t=4;if(T>100){const e=[10,13,15];t=e[_.id?_.id%e.length:0]}else T<=10&&(t=3);n.setFacadeOptions(t,!0),q=(T<15?1.3:1.61803)*t/o}else q=w/o;H=T/o,q=Math.min(q,H),j=v.layout.get("building-facade-unit-width").evaluate(_,{},i)/o,G=(H-q)/e,n.setFauxFacadeOptions(!0,!0,j);const t=v.layout.get("building-facade-window").evaluate(_,{},i);V=t[0],U=t[1],$=Math.floor(65535*Math.min(1,q/Ur)),Z=Math.floor(65535*Math.min(1,H/Ur)),W=Math.floor(255*V)<<8|Math.floor(255*U),X=Math.floor(65535*Math.min(1,j/Ur)),Y=Math.floor(65535*Math.min(1,G/Ur))}const K=Array(f.length),J={x:1/0,y:1/0},Q={x:-1/0,y:-1/0},ee={x:0,y:0};let te=0;for(let t=0;t<f.length;t++){const e=f[t];if(e.length>0){const i=[],r=Array(e.length+1);r[0]=0;for(let t=0;t<e.length;t++){const n=e[t];for(let e=0;e<n.length;e++){const t=n[n.length-e-1];J.x=Math.min(J.x,t.x),J.y=Math.min(J.y,t.y),Q.x=Math.max(Q.x,t.x),Q.y=Math.max(Q.y,t.y),ee.x+=t.x,ee.y+=t.y,te++,i.push(t.x),i.push(t.y)}r[t+1]=i.length}K[t]={id:_.id?_.id:0,height:T,minHeight:w,sourceId:0,roofType:b,coordinates:i,ringIndices:r}}}ee.x/=te||1,ee.y/=te||1;const ie=n.generateMesh(K,B);if("string"==typeof ie){We(`Unable to generate building ${_.id}: ${ie}`),u(l);continue}if(0===ie.meshes.length||0===ie.modifiedPolygonRings.length){u(l);continue}const re=N?this.buildingWithFacade:this.buildingWithoutFacade;let ne=0;for(const t of ie.meshes)ne+=t.positions.length/3;const oe=re.segmentsBucket.prepareSegment(ne,re.layoutVertexArray,re.indexArray),se=[];let ae=null,le=0,ce=-1;const he=re.layoutVertexArray.length,ue=he+ne;re.layoutVertexArray.resize(ue),re.layoutCentroidArray.resize(ue),re.layoutNormalArray.resize(ue),re.layoutAOArray.resize(ue),re.layoutColorArray.resize(ue),re.layoutFloodLightDataArray.resize(ue),N&&(re.layoutFacadePaintArray.resize(ue),re.layoutFacadeDataArray.resize(ue),re.layoutFacadeVerticalRangeArray.resize(ue));const de=re.indexArray.length;let pe=0,fe=he;for(const t of ie.meshes){let e,i;if(1===t.buildingPart)e=A,i=M;else if(0===t.buildingPart)e=C,i=P;else if(2===t.buildingPart)e=R,i=z;else{if(3!==t.buildingPart)continue;e=L,i=D}if(i=Oe(i,0,1),3===t.buildingPart){const e=new Array;for(let o=0;o<t.positions.length;o+=12){const i=t.positions[o+0],r=t.positions[o+1],n=t.positions[o+3],s=t.positions[o+4],a=t.positions[o+2],l=t.positions[o+8]-a,c=1,h=n-i,u=s-r,d=Math.hypot(h,u);e.push({pos:[i+.5*h,r+.5*u,a],normal:[u/d,-h/d,0],width:d,height:l,depth:c,points:[i,r,n,s]})}const i=re.entranceBloom.segmentsBucket.prepareSegment(10*e.length,re.entranceBloom.layoutVertexArray,re.entranceBloom.indexArray),r=re.entranceBloom.layoutVertexArray.length;le=re.entranceBloom.indexArray.length,v_(e,.5/this.tileToMeter,re.entranceBloom.indexArray,re.entranceBloom.layoutVertexArray,re.entranceBloom.layoutAttenuationArray);const n=re.entranceBloom.layoutVertexArray.length-r;ce=re.entranceBloom.indexArray.length-le;for(let t=0;t<n;t++)re.entranceBloom.layoutColorArray.emplaceBack(255*L.r<<8|255*L.g,255*L.b<<8|51*D);i.vertexLength+=n,i.primitiveLength+=ce,ae={part:t.buildingPart,vertexOffset:r,vertexLength:n}}re.layoutVertexArray.float32.set(t.positions,3*fe);const r=t.positions.length/3;for(let h=0;h<r;++h){const r=3*h;pe=Math.max(pe,t.positions[r+2]);const n=t.normals[r+1]*z_,o=t.normals[r+2]*z_,s=3*(fe+h);re.layoutNormalArray.int16[s]=t.normals[r]*z_,re.layoutNormalArray.int16[s+1]=n,re.layoutNormalArray.int16[s+2]=o;const a=t.ao[h];re.layoutAOArray.uint8[fe+h]=255*a;const l=1+(a-1)*E,c=255*e.b*l<<8|255*i;re.layoutColorArray.uint16[2*(fe+h)]=255*e.r*l<<8|255*e.g*l,re.layoutColorArray.uint16[2*(fe+h)+1]=c}const n=Math.floor(ee.x),o=Math.floor(ee.y),s=Math.floor(T);for(let t=0;t<r;++t){const e=3*(fe+t);re.layoutCentroidArray.int16[e]=n,re.layoutCentroidArray.int16[e+1]=o,re.layoutCentroidArray.int16[e+2]=s}if(re.layoutFloodLightDataArray.uint16.fill(0===t.buildingPart?F:0,fe,fe+r),N){const e=255*R.r<<8|255*R.g,i=255*R.b<<8|255*z;for(let t=0;t<r;++t){const r=2*(fe+t);re.layoutFacadePaintArray.uint16[r]=e,re.layoutFacadePaintArray.uint16[r+1]=i}for(let n=0;n<r;++n)if(t.isFauxFacade[n]){const e=Math.min(65535,Math.floor(t.uv[2*n]*ie.outerRingLength));re.layoutFacadeDataArray.emplace(fe+n,1|e,W,X,Y),re.layoutFacadeVerticalRangeArray.emplace(fe+n,$,Z)}else re.layoutFacadeDataArray.emplace(fe+n,0,0,0,0),re.layoutFacadeVerticalRangeArray.emplace(fe+n,0,0)}const a=oe.vertexLength,l=t.indices.length/3,c=re.indexArray.length;re.indexArray.resize(c+l);for(let h=0;h<l;++h){const e=3*h,i=3*c+e;re.indexArray.uint16[i]=a+t.indices[e],re.indexArray.uint16[i+1]=a+t.indices[e+1],re.indexArray.uint16[i+2]=a+t.indices[e+2]}1!==t.buildingPart&&0!==t.buildingPart&&2!==t.buildingPart&&3!==t.buildingPart||se.push({part:t.buildingPart,vertexOffset:fe,vertexLength:t.positions.length/3}),fe+=r,oe.vertexLength+=r,oe.primitiveLength+=t.indices.length/3}this.maxHeight=Math.max(this.maxHeight,pe);const me=re.indexArray.length-de,_e=this.footprintsIndices.length,ge=this.footprintsVertices.length,ye=[],xe=new Ee(1/0,1/0),ve=new Ee(-1/0,-1/0),be=this.groundEffect.vertexArray.length;for(const t of ie.modifiedPolygonRings){const e=[],i=new Ee(1/0,1/0),r=new Ee(-1/0,-1/0);for(let n=0;n<t.length;n+=2){const o=t.length-n-2;i.x=Math.min(i.x,t[o]),i.y=Math.min(i.y,t[o+1]),r.x=Math.max(r.x,t[o]),r.y=Math.max(r.y,t[o+1]);const s=new Ee(t[o],t[o+1]);
vendor: 12,474 bytes, line 2
2e.push(s),ye.push(s.x,s.y),this.footprintsVertices.emplaceBack(s.x,s.y)}xe.x=Math.min(xe.x,i.x),xe.y=Math.min(xe.y,i.y),ve.x=Math.max(ve.x,r.x),ve.y=Math.max(ve.y,r.y),this.groundEffect.addData(e,[i,r],I)}const we=this.groundEffect.vertexArray.length-be;this.groundEffect.groundRadiusArray.reserveForAdditional(we);for(let t=0;t<we;t++)this.groundEffect.groundRadiusArray.emplaceBack(S);(J.x<0||Q.x>Ur||J.y<0||Q.y>Ur)&&this.featuresOnBorder.push({featureId:_.id,footprintIndex:this.footprints.length});{const e=Qu(ye,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+e.length),this.footprintsIndices.uint16.set(e,_e),this.buildingIds.add(null!=l?l:_.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,xe.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,xe.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,ve.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,ve.y);const t={footprintVertexOffset:ge,footprintVertexLength:this.footprintsVertices.length-ge,footprintIndexOffset:_e,footprintIndexLength:this.footprintsIndices.length-_e,min:xe,max:ve,hiddenFlags:0,indicesOffset:de,indicesLength:me,bloomIndicesOffset:le,bloomIndicesLength:ce,groundEffectVertexOffset:be,groundEffectVertexLength:we,hasFauxFacade:N,height:pe,promoteId:g,feature:c,parts:se,buildingBloom:ae},i=this.footprints.length;void 0!==_.id&&this.featureFootprintLookup.set(_.id,i),d(l,i),this.footprints.push(t)}this.programConfigurations.populatePaintArrays(re.layoutVertexArray.length,_,y,{},t.availableImages,i,t.brightness),this.groundEffect.addPaintPropertiesData(_,y,{},t.availableImages,i,t.brightness),t.featureIndex.insert(_,p,y,x,this.index,he)}c.forEach(({buildingId:e,footprintIndex:t})=>{h.has(e)&&(this.footprints[t].hiddenFlags|=4)});const m=new Set;this.buildingIds.forEach((e,t,i)=>{h.has(e)||m.add(e)}),this.buildingIds=m,this.groundEffect.prepareBorderSegments()}update(e,t,i,r,n,o,s){this.programConfigurations.updatePaintArrays(e,t,n,i,r,o,s),this.groundEffect.update(e,t,n,i,r,o,s),this.evaluate(this.layers[0],e),this.colorBufferUploaded=!1}isEmpty(){return 0===this.buildingWithoutFacade.layoutVertexArray.length&&0===this.buildingWithFacade.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){const t=t=>{t.layoutVertexBuffer=e.createVertexBuffer(t.layoutVertexArray,w_.members),t.layoutNormalBuffer=e.createVertexBuffer(t.layoutNormalArray,T_.members),t.layoutCentroidBuffer=e.createVertexBuffer(t.layoutCentroidArray,S_.members),t.layoutFloodLightDataBuffer=e.createVertexBuffer(t.layoutFloodLightDataArray,P_.members),t.layoutFacadeDataArray&&t.layoutFacadeDataArray.length&&(t.layoutFacadeDataBuffer=e.createVertexBuffer(t.layoutFacadeDataArray,A_.members)),t.layoutFacadeVerticalRangeArray&&t.layoutFacadeVerticalRangeArray.length&&(t.layoutFacadeVerticalRangeBuffer=e.createVertexBuffer(t.layoutFacadeVerticalRangeArray,M_.members)),t.entranceBloom.layoutVertexArray.length&&(t.entranceBloom.layoutVertexBuffer=e.createVertexBuffer(t.entranceBloom.layoutVertexArray,w_.members),t.entranceBloom.layoutAttenuationBuffer=e.createVertexBuffer(t.entranceBloom.layoutAttenuationArray,C_.members)),this.uploadUpdatedColorBuffer(e),this.uploadUpdatedIndexBuffer(e)};this.uploaded||(t(this.buildingWithoutFacade),t(this.buildingWithFacade),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){const e=e=>{e.layoutVertexBuffer&&(e.layoutVertexBuffer.destroy(),e.layoutNormalBuffer.destroy(),e.layoutColorBuffer.destroy(),e.segmentsBucket.destroy(),e.indexBuffer&&e.indexBuffer.destroy(),e.entranceBloom.layoutVertexBuffer&&(e.entranceBloom.layoutVertexBuffer.destroy(),e.entranceBloom.layoutColorBuffer.destroy(),e.entranceBloom.layoutAttenuationBuffer.destroy(),e.entranceBloom.indexBuffer.destroy(),e.entranceBloom.segmentsBucket.destroy()))};e(this.buildingWithoutFacade),e(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(e,t,i=!0){let r=!1;const n=i?t:0,o=0|(i?-1:~t);0===this.groundEffect.hiddenByLandmarkVertexArray.length&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const s of e){const e=this.footprints[s],t=e.hiddenFlags&o|n;e.hiddenFlags!==t&&(e.hiddenFlags=t,r=!0,this.groundEffect.updateHiddenByLandmarkRange(e.groundEffectVertexOffset,e.groundEffectVertexLength,0!==e.hiddenFlags))}return r&&(this.indexArrayForConflationUploaded=!1),r}uploadUpdatedIndexBuffer(e){if(this.groundEffect.uploadHiddenByLandmark(e),this.indexArrayForConflationUploaded)return;const t=e=>{0!==e.indexArray.length&&(e.indexArrayForConflation.resize(e.indexArray.length),e.indexArrayForConflation.uint16.set(e.indexArray.uint16),e.entranceBloom.indexArrayForConflation.resize(e.entranceBloom.indexArray.length),e.entranceBloom.indexArrayForConflation.uint16.set(e.entranceBloom.indexArray.uint16))};t(this.buildingWithoutFacade),t(this.buildingWithFacade);for(const r of this.footprints){const e=r.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,t=r.indicesOffset+r.indicesLength;if(0!==r.hiddenFlags){for(let n=r.indicesOffset;n<t;n++)e.indexArrayForConflation.uint16[3*n+0]=0,e.indexArrayForConflation.uint16[3*n+1]=0,e.indexArrayForConflation.uint16[3*n+2]=0;const i=r.bloomIndicesOffset+r.bloomIndicesLength;for(let t=r.bloomIndicesOffset;t<i;t++)e.entranceBloom.indexArrayForConflation.uint16[3*t+0]=0,e.entranceBloom.indexArrayForConflation.uint16[3*t+1]=0,e.entranceBloom.indexArrayForConflation.uint16[3*t+2]=0}}const i=t=>{0!==t.indexArray.length&&(t.indexBuffer?t.indexBuffer.updateData(t.indexArrayForConflation):t.indexBuffer=e.createIndexBuffer(t.indexArrayForConflation,!0),t.entranceBloom.indexBuffer?t.entranceBloom.indexBuffer.updateData(t.entranceBloom.indexArrayForConflation):t.entranceBloom.indexBuffer=e.createIndexBuffer(t.entranceBloom.indexArrayForConflation,!0))};i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(e){const t=t=>{t.layoutColorBuffer?t.layoutColorBuffer.updateData(t.layoutColorArray):t.layoutColorBuffer=e.createVertexBuffer(t.layoutColorArray,E_.members,!0),t.layoutFacadePaintArray&&(t.layoutFacadePaintBuffer?t.layoutFacadePaintBuffer.updateData(t.layoutFacadePaintArray):t.layoutFacadePaintBuffer=e.createVertexBuffer(t.layoutFacadePaintArray,I_.members,!0)),t.entranceBloom.layoutColorBuffer?t.entranceBloom.layoutColorBuffer.updateData(t.entranceBloom.layoutColorArray):t.entranceBloom.layoutColorBuffer=e.createVertexBuffer(t.entranceBloom.layoutColorArray,E_.members,!0)};t(this.buildingWithoutFacade),t(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(e,t){const i=e.paint.get("building-ambient-occlusion-intensity");for(const r of this.footprints){if(4&r.hiddenFlags)continue;const n=t[r.promoteId],o=r.feature;o.properties["building-part"]="roof";const s=e.paint.get("building-color").evaluate(o,n,this.canonical).toPremultipliedRenderColor(this.lut),a=e.paint.get("building-emissive-strength").evaluate(o,n,this.canonical);o.properties["building-part"]="wall";const l=e.paint.get("building-color").evaluate(o,n,this.canonical).toPremultipliedRenderColor(this.lut),c=e.paint.get("building-emissive-strength").evaluate(o,n,this.canonical);o.properties["building-part"]="window";const h=e.paint.get("building-color").evaluate(o,n,this.canonical).toPremultipliedRenderColor(this.lut),u=e.paint.get("building-emissive-strength").evaluate(o,n,this.canonical);o.properties["building-part"]="door";const d=e.paint.get("building-color").evaluate(o,n,this.canonical).toPremultipliedRenderColor(this.lut),p=e.paint.get("building-emissive-strength").evaluate(o,n,this.canonical),f=r.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const e of r.parts){let t,n=s;1===e.part?(n=s,t=a):0===e.part?(n=l,t=c):2===e.part?(n=h,t=u):3===e.part&&(n=d,t=p),t=Oe(t,0,1);for(let o=0;o<e.vertexLength;o++){const s=e.vertexOffset+o,a=1+(f.layoutAOArray.uint8[s]/255-1)*i;f.layoutColorArray.emplace(s,n.r*a*255<<8|n.g*a*255,n.b*a*255<<8|255*t),r.hasFauxFacade&&f.layoutFacadePaintArray.emplace(s,255*h.r<<8|255*h.g,255*h.b<<8|255*u)}}const m=r.buildingBloom;if(m)for(let e=0;e<m.vertexLength;e++)f.entranceBloom.layoutColorArray.emplace(m.vertexOffset+e,255*d.r<<8|255*d.g,255*d.b<<8|51*p)}}needsEvaluation(){return!this.colorBufferUploaded}updateReplacement(e,t,i){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const r=t.getReplacementRegionsForTile(e.toUnwrapped());if(Up(this.activeReplacements,r))return;this.activeReplacements=r;for(const o of this.footprints)o.hiddenFlags&=-2;const n=[];for(const o of this.activeReplacements){if(o.order<i)continue;const t=Math.max(1,Math.pow(2,o.footprintTileId.canonical.z-e.canonical.z));for(const i of this.footprints)i.min.x>o.max.x||i.max.x<o.min.x||i.min.y>o.max.y||i.max.y<o.min.y||(n.length=0,N_(this.footprintsVertices,i.footprintVertexOffset,i.footprintVertexLength,o.footprintTileId.canonical,e.canonical,n),qp(o.footprint,n,this.footprintsIndices.uint16,i.footprintIndexOffset,i.footprintIndexLength,0,-t)&&(i.hiddenFlags|=1))}0===this.groundEffect.hiddenByLandmarkVertexArray.length&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const o of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(o.groundEffectVertexOffset,o.groundEffectVertexLength,0!==o.hiddenFlags);this.indexArrayForConflationUploaded=!1}getFootprint(e){if(void 0!==e.id){const t=this.featureFootprintLookup.get(e.id);return this.footprints[t]}return null}getHeightAtTileCoord(e,t){let i=Number.NEGATIVE_INFINITY,r=!0;const n=4*(e+Ur)*Ur+(t+Ur);if(this.footprintLookup.hasOwnProperty(n)){const e=this.footprintLookup[n];return e?{height:e.height,hidden:0!==e.hiddenFlags}:void 0}const o=new Ee(e,t);for(const s of this.footprints)e>s.max.x||s.min.x>e||t>s.max.y||s.min.y>t||s.height<=i||B_(o,this.footprintsVertices.float32.subarray(2*s.footprintVertexOffset,2*(s.footprintVertexOffset+s.footprintVertexLength)),this.footprintsIndices.uint16.subarray(s.footprintIndexOffset,s.footprintIndexOffset+s.footprintIndexLength))&&(i=s.height,this.footprintLookup[n]=s,r=0!==s.hiddenFlags);if(i!==Number.NEGATIVE_INFINITY)return{height:i,hidden:r};this.footprintLookup[n]=void 0}}function B_(e,t,i){for(let r=0;r<i.length;r+=3){const n=i[r],o=i[r+1],s=i[r+2],a=t[2*n+0],l=t[2*n+1],c=t[2*o+0],h=t[2*o+1],u=t[2*s+0],d=t[2*s+1],p=(a-u)*(e.y-d)-(l-d)*(e.x-u),f=(c-a)*(e.y-l)-(h-l)*(e.x-a);if(p<0!=f<0&&0!==p&&0!==f)continue;const m=(u-c)*(e.y-h)-(d-h)*(e.x-c);if(0===m||m<0==p+f<=0)return!0}return!1}function N_(e,t,i,r,n,o){const s=Math.pow(2,r.z-n.z);for(let a=0;a<i;a++){let i=e.float32[2*(a+t)+0],l=e.float32[2*(a+t)+1];i=(i+n.x*Ur)*s-r.x*Ur,l=(l+n.y*Ur)*s-r.y*Ur,o.push(new Ee(i,l))}}let V_,U_;es(k_,"BuildingBucket",{omit:["layers"]}),es(F_,"BuildingGeometry"),es(O_,"BuildingBloomGeometry");const j_=Na([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),G_=Na([{name:"a_z_offset_width",components:3,type:"Float32"}],4),{members:q_}=j_,H_=Na([{name:"a_packed",components:3,type:"Float32"}]),{members:$_}=H_,Z_=Na([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:W_}=Z_;class X_{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.image=new Hu({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=Ue(this.nextRow);this.image.resize({width:e,height:t})}getKey(e,t){return e.join(",")+t}getDashRanges(e,t,i){const r=[];let n=e.length%2==1?-e[e.length-1]*i:0,o=e[0]*i,s=!0;r.push({left:n,right:o,isDash:s,zeroLength:0===e[0]});let a=e[0];for(let l=1;l<e.length;l++){s=!s;const t=e[l];n=a*i,a+=t,o=a*i,r.push({left:n,right:o,isDash:s,zeroLength:0===t})}return r}addRoundDash(e,t,i){const r=t/2;for(let n=-i;n<=i;n++){const t=this.width*(this.nextRow+i+n);let o=0,s=e[o];for(let a=0;a<this.width;a++){a/s.right>1&&(s=e[++o]);const l=Math.abs(a-s.left),c=Math.abs(a-s.right),h=Math.min(l,c);let u;const d=n/i*(r+1);if(s.isDash){const e=r-Math.abs(d);u=Math.sqrt(h*h+e*e)}else u=r-Math.sqrt(h*h+d*d);this.image.data[t+a]=Math.max(0,Math.min(255,u+128))}}}
vendor: 3,310 bytes, line 2
2addRegularDash(e,t){for(let a=e.length-1;a>=0;--a){const t=e[a],i=e[a+1];t.zeroLength?e.splice(a,1):i&&i.isDash===t.isDash&&(i.left=t.left,e.splice(a,1))}const i=e[0],r=e[e.length-1];i.isDash===r.isDash&&(i.left=r.left-this.width,r.right=i.right+this.width);const n=this.width*this.nextRow;let o=0,s=e[o];for(let a=0;a<this.width;a++){a/s.right>1&&(s=e[++o]);const i=Math.abs(a-s.left),r=Math.abs(a-s.right),l=Math.min(i,r);this.image.data[n+a]=Math.max(0,Math.min(255,(s.isDash?l:-l)+t+128))}}addDash(e,t){const i=this.getKey(e,t);if(this.positions[i])return this.positions[i];const r="round"===t,n=r?7:0,o=2*n+1;if(this.nextRow+o>this.height)return We("LineAtlas out of space"),null;0===e.length&&e.push(1);let s=0;for(let c=0;c<e.length;c++)e[c]<0&&(We("Negative value is found in line dasharray, replacing values with 0"),e[c]=0),s+=e[c];if(0!==s){const i=this.width/s,o=this.getDashRanges(e,this.width,i);r?this.addRoundDash(o,i,n):this.addRegularDash(o,"square"===t?.5*i:0)}const a=this.nextRow+n;this.nextRow+=o;const l={tl:[a,n],br:[s,0]};return this.positions[i]=l,l}}es(X_,"LineAtlas");const Y_=Qc.types,K_=Math.cos(Math.PI/180*37.5),J_=Math.cos(Math.PI/180*5);class Q_{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.zoom=e.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=e.overscaling,this.pixelRatio=e.pixelRatio,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(e=>{this.gradients[e.id]={}}),this.layoutVertexArray=new Wa,this.layoutVertexArray2=new Xa,this.patternVertexArray=new Xa,this.indexArray=new ll,this.programConfigurations=new fc(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new Nl,this.maxLineLength=0,this.zOffsetVertexArray=new Xa,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:128,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,i,r){}populate(e,t,i,r){this.hasPattern=Md("line",this.layers,this.pixelRatio,t);const n=this.layers[0].layout.get("line-sort-key");this.tileToMeter=jc(i);const o=this.layers[0].layout.get("line-elevation-reference");if("hd-road-markup"===o)this.elevationType="road";else{const e=this.layers[0].layout.get("line-z-offset"),t=e.isConstant()&&!e.constantOr(0);this.elevationType="sea"!==o&&"ground"!==o&&t?"none":"offset","offset"===this.elevationType&&"none"===o&&We(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const s=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope="offset"===this.elevationType&&void 0!==s;const a=[];for(const{feature:u,id:d,index:p,sourceLayerIndex:f}of e){const e=this.layers[0]._featureFilter.needGeometry,o=Jc(u,e);if(!this.layers[0]._featureFilter.filter(new Js(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),o,i))continue;const s=n?n.evaluate(o,{},i):void 0,l={id:d,properties:u.properties,type:u.type,sourceLayerIndex:f,index:p,geometry:e?o.geometry:Kc(u,i,r),patterns:{},sortKey:s};a.push(l)}n&&a.sort((e,t)=>
2e.sortKey-t.sortKey);const{lineAtlas:l,featureIndex:c}=t,h=this.addConstantDashes(l);for(const u of a){const{geometry:r,index:n,sourceLayerIndex:o}=u;if(h&&this.addFeatureDashes(u,l),this.hasPattern){const e=Cd("line",this.layers,u,this.zoom,this.pixelRatio,t);this.patternFeatures.push(e)}else this.addFeature(u,r,n,i,l.positions,t.availableImages,t.brightness,t.elevationFeatures);c.insert(e[n].feature,r,n,o,this.index)}}addConstantDashes(e){let t=!1;for(const i of this.layers){const r=i.paint.get("line-dasharray").value,n=i.layout.get("line-cap").value;if("constant"!==r.kind||"constant"!==n.kind)t=!0;else{const t=n.value,i=r.value;if(!i)continue;e.addDash(i,t)}}return t}addFeatureDashes(e,t){const i=this.zoom;for(const r of this.layers){const n=r.paint.get("line-dasharray").value,o=r.layout.get("line-cap").value;if("constant"===n.kind&&"constant"===o.kind)continue;let s,a;if("constant"===n.kind){if(s=n.value,!s)continue}else s=n.evaluate({zoom:i},e);a="constant"===o.kind?o.value:o.evaluate({zoom:i},e),t.addDash(s,a),e.patterns[r.id]=[t.getKey(s,a)]}}update(e,t,i,r,n,o,s,a){this.programConfigurations.updatePaintArrays(e,t,n,i,r,o,s,a)}addFeatures(e,t,i,r,n,o){for(const s of this.patternFeatures)this.addFeature(s,s.geometry,s.index,t,i,r,o,e.elevationFeatures)}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,$_)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,W_)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,G_.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,q_),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e,t){let i,r;if(t&&t>0?(i=`mapbox_clip_start_${t}`,r=`mapbox_clip_end_${t}`):(i="mapbox_clip_start",r="mapbox_clip_end"),e.properties&&e.properties.hasOwnProperty(i)&&e.properties.hasOwnProperty(r))return{start:+e.properties[i],end:+e.properties[r]}}addFeature(e,t,i,r,n,o,s,a){const l=this.layers[0].layout,c=l.get("line-join").evaluate(e,{}),h=l.get("line-cap").evaluate(e,{}),u=l.get("line-miter-limit"),d=l.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e;const p=!(!e.properties||!e.properties.hasOwnProperty("mapbox_line_metrics"))&&e.properties.mapbox_line_metrics;this.zOffsetValue=l.get("line-z-offset").value;const f=this.layers[0].paint.get("line-width").value;if("constant"!==f.kind&&!1===f.isLineProgressConstant&&(this.variableWidthValue=f),"road"===this.elevationType){const i=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(e,t,r,a,c,h,u,d)){const[n,o]=this.clipRuntimeLinesToTile(t,1);for(let t=0;t<n.length;t++){const i=n[t],s=o[t],a={progress:{min:s.progress.min,max:s.progress.max},nextDir:this.computeSegNextDir(s,i),prevDir:this.computeSegPrevDir(s,i)};this.addLine(i,e,r,c,h,u,d,a,p&&s.parentIndex>0?s.parentIndex:null)}this.fillNonElevatedRoadSegment(i)}}else for(let m=0;m<t.length;m++)this.addLine(t[m],e,r,c,h,u,d,void 0,p&&m>0?m:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,o,r,s,void 0,this.worldview)}computeSegNextDir(e,t){return e.nextPoint.sub(t.at(-2)).unit()}computeSegPrevDir(e,t){return t[1].sub(e.prevPoint).unit()}clipLinesToTile(e,t){return Lf(e,-t,-t,Ur+t,Ur+t)}clipRuntimeLinesToTile(e,t){const i=[];return[Lf(e,-t,-t,Ur+t,Ur+t,i),i]}addElevatedRoadFeature(e,t,i,r,n,o,s,a){const l=[],c=Sh.getElevationFeature(e,r);if(c){const e=this.clipLinesToTile(t,1),r=this.prepareElevatedLines(e,c,i);for(const t of r)l.push({geometry:t,elevation:c,elevationTileID:i,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(0===l.length)return!1;for(const h of l){const t=this.layoutVertexArray.length;this.addLine(h.geometry,e,i,n,o,s,a);const r=new Eh(i,h.elevationTileID);if(h.elevation)for(let e=t;e<this.layoutVertexArray.length;e++){const t=new Ee(this.layoutVertexArray.int16[6*e]>>1,this.layoutVertexArray.int16[6*e+1]>>1),i=r.pointElevation(t,h.elevation,.05);this.updateHeightRange(i),this.zOffsetVertexArray.emplaceBack(i,0,0)}else this.fillNonElevatedRoadSegment(t)}return!0}prepareElevatedLines(e,t,i){if(null!=t.constantHeight)return e;const r=[],n=1/jc(i);for(const o of e)Df(o,new wh(t,n),0,r);return r}fillNonElevatedRoadSegment(e){for(let t=e;t<this.layoutVertexArray.length;t++)this.zOffsetVertexArray.emplaceBack(0,0,0)}updateHeightRange(e){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,e),this.heightRange.max=Math.max(this.heightRange.max,e)):this.heightRange={min:e,max:e}}addLine(e,t,i,r,n,o,s,a,l){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineS
vendor: 16,339 bytes, line 2
2oFar=0,this.currentVertex=void 0,this.lineClips=l?this.lineFeatureClips(t,l):this.lineClips;const c="none"===r;this.patternJoinNone=this.hasPattern&&c,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const h=a&&a.progress.min>0,u=a&&a.progress.max<1;if(this.lineClips){let i={min:this.lineClips.start,max:this.lineClips.end},r=1;if(a){const e=this.lineClips.end-this.lineClips.start;i=function(e,t,i){return{min:st(e.min,t,i),max:st(e.max,t,i)}}(a.progress,{min:0,max:1},i),e>0&&(r=(i.max-i.min)/e)}const n=+t.properties.mapbox_clip_feature_len,o=+t.properties.mapbox_clip_seg_len;if(Number.isNaN(n)||Number.isNaN(o)){for(let i=0;i<e.length-1;i++)this.totalDistance+=e[i].dist(e[i+1]);const t=this.totalDistance/(i.max-i.min);this.totalFeatureLength=Number.isFinite(t)?t:0,this.lineClips.start=i.min,this.lineClips.end=i.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=n,this.distance=o*r,this.lineClips.start=i.min,this.lineClips.end=i.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const d="Polygon"===Y_[t.type];let p=e.length;for(;p>=2&&e[p-1].equals(e[p-2]);)p--;let f=0;for(;f<p-1&&e[f].equals(e[f+1]);)f++;if(p<(d?3:2))return;"bevel"===r&&(o=1.05);const m=this.segments.prepareSegment(10*p,this.layoutVertexArray,this.indexArray);let _,g,y,x,v,b,w,T;a&&a.prevDir&&(b=a.prevDir.perp()),a&&a.nextDir&&(w=a.nextDir.perp()),this.e1=this.e2=-1,d&&(_=e[p-2],v=e[f].sub(_)._unit()._perp());for(let S=f;S<p;S++){if(y=S===p-1?d?e[f+1]:void 0:e[S+1],y&&e[S].equals(y))continue;v&&(x=v),_&&(g=_),_=e[S],T=this.evaluateLineProgressFeatures(g?g.dist(_):0),v=y?y.sub(_)._unit()._perp():x,x=x||v;const t=g&&y;let i=t?r:d||c?"butt":n;const a=x.x*v.x+x.y*v.y;if(c){const e=function(e){if(e.patternJoinNone){const t=e.segmentPoints.length/2,i=e.lineSoFar-e.segmentStart;for(let r=0;r<t;++r){const t=e.segmentPoints[2*r+1],n=Math.round(e.segmentPoints[2*r])+.5+.25*t;e.patternVertexArray.emplaceBack(n,i,e.segmentStart),e.patternVertexArray.emplaceBack(n,i,e.segmentStart)}e.segmentPoints.length=0}e.e1=e.e2=-1};if(t&&a<J_){this.updateDistance(g,_),this.addCurrentVertex(_,x,1,1,m,T),e(this),this.addCurrentVertex(_,v,-1,-1,m,T);continue}if(g){if(!y){this.updateDistance(g,_),this.addCurrentVertex(_,x,1,1,m,T),e(this);continue}i="miter"}}let l=x.add(v);0===l.x&&0===l.y||l._unit();const E=l.x*v.x+l.y*v.y,I=0!==E?1/E:1/0,A=2*Math.sqrt(2-2*E),M=E<K_&&g&&y,C=x.x*v.y-x.y*v.x>0,P=this.overscaling<=16?122880/(512*this.overscaling):0;if(t&&"round"===i)if(I<s)i="miter";else if(I<=2){const e=eg(_,-10,8202);i="offset"===this.elevationType&&(e||this.hasCrossSlope)?"miter":"fakeround"}if("miter"===i&&I>o&&(i="bevel"),"bevel"===i&&(I>2&&(i="flipbevel"),I<o&&(i="miter")),g&&!("miter"===i&&M)&&this.updateDistance(g,_),"miter"===i)if(M){const e=_.dist(g);if(e>2*P){const t=_.sub(_.sub(g)._mult(P/e)._round());this.updateDistance(g,t),this.addCurrentVertex(t,x,0,0,m,T),g=t}this.updateDistance(g,_),l._mult(I),this.addCurrentVertex(_,l,0,0,m,T);const t=_.dist(y);if(t>2*P){const e=_.add(y.sub(_)._mult(P/t)._round());this.updateDistance(_,e),this.addCurrentVertex(e,v,0,0,m,T),_=e}}else l._mult(I),this.addCurrentVertex(_,l,0,0,m,T);else if("flipbevel"===i){if(I>100)l=v.mult(-1);else{const e=I*x.add(v).mag()/x.sub(v).mag();l._perp()._mult(e*(C?-1:1))}this.addCurrentVertex(_,l,0,0,m,T),this.addCurrentVertex(_,l.mult(-1),0,0,m,T)}else if("bevel"===i||"fakeround"===i){null!=T&&g&&this.addCurrentVertex(_,w||x,-1,-1,m,T);const e=_.dist(g)<=2*P&&"bevel"!==i,t=l.mult(C?1:-1);t._mult(I);const r=v.mult(C?-1:1),n=x.mult(C?-1:1),o=this.evaluateLineProgressFeatures(this.distance);if(null==T&&(this.addHalfVertex(_,t.x,t.y,!1,!C,0,m,o),e||this.addHalfVertex(_,t.x+2*n.x,t.y+2*n.y,!1,C,0,m,o)),"fakeround"===i){const e=Math.round(180*A/Math.PI/20);this.addHalfVertex(_,n.x,n.y,!1,C,0,m,o);for(let t=0;t<e;t++){let i=t/e;if(.5!==i){const e=i-.5;i+=i*e*(i-1)*((1.0904+a*(a*(3.55645-1.43519*a)-3.2452))*e*e+(.848013+a*(.215638*a-1.06021)))}const s=r.sub(n)._mult(i)._add(n)._unit();this.addHalfVertex(_,s.x,s.y,!1,C,0,m,o)}this.addHalfVertex(_,r.x,r.y,!1,C,0,m,o)}e||null!=T||this.addHalfVertex(_,t.x+2*r.x,t.y+2*r.y,!1,C,0,m,o),null!=T&&y&&this.addCurrentVertex(_,b||v,1,1,m,T)}else if("butt"===i)this.addCurrentVertex(_,l,0,0,m,T);else if("square"===i){if(!g){const e=h?0:-1;this.addCurrentVertex(_,l,e,e,m,T)}if(this.addCurrentVertex(_,l,0,0,m,T),g){const e=u?0:1;this.addCurrentVertex(_,l,e,e,m,T)}}else if("round"===i){if(g){const e=!t&&w?w:x;this.addCurrentVertex(_,e,0,0,m,T),!t&&u||this.addCurrentVertex(_,e,1,1,m,T,!0)}if(y){const e=!t&&b?b:v;!t&&h||this.addCurrentVertex(_,e,-1,-1,m,T,!0),this.addCurrentVertex(_,e,0,0,m,T)}}}}addVerticesTo(e,t,i,r,n,o,s,a,l,c){const h=(t.w-e.w)/this.tessellationStep|0;let u=0;const d=this.scaledDistance;if(h>1){this.lineSoFar=e.w;const d=(t.x-e.x)/h,p=(t.y-e.y)/h,f=(t.z-e.z)/h,m=(t.w-e.w)/h;for(let t=1;t<h;++t){e.x+=d,e.y+=p,e.z+=f,this.lineSoFar+=m,u+=m;const t=this.evaluateLineProgressFeatures(this.prevDistance+u);this.scaledDistance=(this.prevDistance+u)/this.totalDistance,this.addHalfVertex(e,i,r,c,!1,s,l,t),this.addHalfVertex(e,n,o,c,!0,-a,l,t)}}this.lineSoFar=t.w,this.scaledDistance=d;const p=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(t,i,r,c,!1,s,l,p),this.addHalfVertex(t,n,o,c,!0,-a,l,p)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&"offset"!==this.elevationType)return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):We(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let t=0;return this.variableWidthValue&&"constant"!==this.variableWidthValue.kind&&(t=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0),"offset"!==this.elevationType?{zOffset:0,variableWidth:t}:"constant"===this.zOffsetValue.kind?{zOffset:this.zOffsetValue.value,variableWidth:t}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:t}}addCurrentVertex(e,t,i,r,n,o,s=!1){const a=t.x+t.y*i,l=t.y-t.x*i,c=t.y*r-t.x,h=-t.y-t.x*r;if(null!=o){const t="offset"===this.elevationType,u=-10,d=8202,p=o.zOffset,f=new Pf(e.x,e.y,p,this.lineSoFar),m=!!t&&eg(e,u,d),_=this.lineSoFar,g=this.distance;if(this.currentVertex)if(m){const t=this.currentVertexIsOutside,o=this.currentVertex,m=new Pf(e.x,e.y,p,this.lineSoFar);if(zf(o,m,u,d),!eg(m,u,d)){if(t){this.e1=this.e2=-1,this.distance-=o.dist(f),this.lineSoFar=o.w;const e=this.evaluateLineProgressFeatures(o.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(o,a,l,s,!1,i,n,e),this.addHalfVertex(o,c,h,s,!0,-r,n,e),this.prevDistance=this.distance}this.distance=this.prevDistance+o.dist(m),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(o,m,a,l,c,h,i,r,n,s),this.distance=g,this.scaledDistance=this.distance/this.totalDistance}}else{const e=this.currentVertex;if(this.currentVertexIsOutside){zf(e,f,u,d),this.e1=this.e2=-1,this.distance-=e.dist(f),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e.w;const t=this.evaluateLineProgressFeatures(e.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(e,a,l,s,!1,i,n,t),this.addHalfVertex(e,c,h,s,!0,-r,n,t),this.prevDistance=this.distance,this.distance=g,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(e,f,a,l,c,h,i,r,n,s)}else m||(this.addHalfVertex(e,a,l,s,!1,i,n,o),this.addHalfVertex(e,c,h,s,!0,-r,n,o));this.currentVertex=f,this.currentVertexIsOutside=m,this.lineSoFar=_}else this.addHalfVertex(e,a,l,s,!1,i,n,o),this.addHalfVertex(e,c,h,s,!0,-r,n,o)}addHalfVertex({x:e,y:t},i,r,n,o,s,a,l){if(this.patternJoinNone&&(0===this.segmentPoints.length&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),o||this.segmentPoints.push(this.lineSoFar-this.segmentStart,s)),this.layoutVertexArray.emplaceBack((e<<1)+(n?1:0),(t<<1)+(o?1:0),Math.round(63*i)+128,Math.round(63*r)+128,1+(0===s?0:s<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const e=pi(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,e)}const c=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,c),a.primitiveLength++),o?this.e2=c:this.e1=c,null!=l&&this.zOffsetVertexArray.emplaceBack(l.zOffset,l.variableWidth,l.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,t){this.prevDistance=this.distance,this.distance+=e.dist(t),this.updateScaledDistance()}}function eg(e,t,i){return e.x<t||e.x>i||e.y<t||e.y>i}let tg,ig;function rg(e,t,i){return t*(Ur/(e.tileSize*Math.pow(2,i-e.tileID.overscaledZ)))}es(Q_,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const ng=(e,t,i)=>(1-i)*e+i*t;function og(e,t){return 1/rg(e,1,t.tileZoom)}function sg(e,t,i,r){return e.translatePosMatrix(r||t.tileID.projMatrix,t,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const ag=e=>{const t=[];lg(e)&&t.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&&t.push("RENDER_LINE_GRADIENT");const i=e.paint.get("line-trim-offset");0===i[0]&&0===i[1]||t.push("RENDER_LINE_TRIM_OFFSET"),0!==e.paint.get("line-border-width").constantOr(1)&&t.push("RENDER_LINE_BORDER");const r="none"===e.layout.get("line-join").constantOr("miter"),n=!!e.paint.get("line-pattern").constantOr(1);return r&&n&&t.push("LINE_JOIN_NONE"),t};function lg(e){const t=e.paint.get("line-dasharray").value;return"constant"!==t.kind||t.value}let cg;const hg=()=>cg||(cg={layout:tg||(tg=new ha({"line-cap":new la(ua.layout_line["line-cap"]),"line-join":new la(ua.layout_line["line-join"]),"line-miter-limit":new aa(ua.layout_line["line-miter-limit"]),"line-round-limit":new aa(ua.layout_line["line-round-limit"]),"line-sort-key":new la(ua.layout_line["line-sort-key"]),"line-z-offset":new la(ua.layout_line["line-z-offset"]),"line-elevation-reference":new aa(ua.layout_line["line-elevation-reference"]),"line-cross-slope":new aa(ua.layout_line["line-cross-slope"]),visibility:new aa(ua.layout_line.visibility),"line-width-unit":new aa(ua.layout_line["line-width-unit"])})),paint:ig||(ig=new ha({"line-opacity":new la(ua.paint_line["line-opacity"]),"line-color":new la(ua.paint_line["line-color"]),"line-translate":new aa(ua.paint_line["line-translate"]),"line-translate-anchor":new aa(ua.paint_line["line-translate-anchor"]),"line-width":new la(ua.paint_line["line-width"]),"line-gap-width":new la(ua.paint_line["line-gap-width"]),"line-offset":new la(ua.paint_line["line-offset"]),"line-blur":new la(ua.paint_line["line-blur"]),"line-dasharray":new la(ua.paint_line["line-dasharray"]),"line-pattern":new la(ua.paint_line["line-pattern"]),"line-pattern-cross-fade":new aa(ua.paint_line["line-pattern-cross-fade"]),"line-gradient":new ca(ua.paint_line["line-gradient"]),"line-trim-offset":new aa(ua.paint_line["line-trim-offset"]),"line-trim-fade-range":new aa(ua.paint_line["line-trim-fade-range"]),"line-trim-color":new aa(ua.paint_line["line-trim-color"]),"line-emissive-strength":new la(ua.paint_line["line-emissive-strength"]),"line-border-width":new la(ua.paint_line["line-border-width"]),"line-border-color":new la(ua.paint_line["line-border-color"]),"line-occlusion-opacity":new aa(ua.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new la({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"})}))},cg);class ug extends la{possiblyEvaluate(e,t){return t=new Js(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,transition:t.transition,worldview:t.worldview}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,r){return t=Object.assign({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,r)}}let dg;function pg(e,t){return t>0?t+2*e:e}const fg=Na([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),mg=Na([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),_g=Na([{name:"a_projected_pos",components:4,type:"Float32"}],4);Na([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const gg=Na([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),yg=Na([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),xg=Na([{name:"a_texb",components:2,type:"Uint16"}]),vg=Na([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),bg=Na([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Na([{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 wg=Na([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Tg=Na([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Na([{name:"triangle",components:3,type:"Uint16"}]),Na([{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"}]),Na([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"},{type:"Uint16",name:"elevationFeatureIndex"}
2]),Na([{type:"Float32",name:"offsetX"}]),Na([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var Sg=24;function Eg(e,t,i){return e.sections.forEach(e=>{e.text=function(e,t,i){const r=t.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?e=e.toLocaleUpperCase():"lowercase"===r&&(e=e.toLocaleLowerCase()),Ks.applyArabicShaping&&(e=Ks.applyArabicShaping(e)),e}(e.text,t,i)}),e}const Ig={"!":"\ufe15","#":"\uff03",$:"\uff04","%":"\uff05","&":"\uff06","(":"\ufe35",")":"\ufe36","*":"\uff0a","+":"\uff0b",",":"\ufe10","-":"\ufe32",".":"\u30fb","/":"\uff0f",":":"\ufe13",";":"\ufe14","<":"\ufe3f","=":"\uff1d",">":"\ufe40","?":"\ufe16","@":"\uff20","[":"\ufe47","\\":"\uff3c","]":"\ufe48","^":"\uff3e",_:"\ufe33","`":"\uff40","{":"\ufe37","|":"\u2015","}":"\ufe38","~":"\uff5e","\xa2":"\uffe0","\xa3":"\uffe1","\xa5":"\uffe5","\xa6":"\uffe4","\xac":"\uffe2","\xaf":"\uffe3","\u2013":"\ufe32","\u2014":"\ufe31","\u2018":"\ufe43","\u2019":"\ufe44","\u201c":"\ufe41","\u201d":"\ufe42","\u2026":"\ufe19","\u2027":"\u30fb","\u20a9":"\uffe6","\u3001":"\ufe11","\u3002":"\ufe12","\u3008":"\ufe3f","\u3009":"\ufe40","\u300a":"\ufe3d","\u300b":"\ufe3e","\u300c":"\ufe41","\u300d":"\ufe42","\u300e":"\ufe43","\u300f":"\ufe44","\u3010":"\ufe3b","\u3011":"\ufe3c","\u3014":"\ufe39","\u3015":"\ufe3a","\u3016":"\ufe17","\u3017":"\ufe18","\uff01":"\ufe15","\uff08":"\ufe35","\uff09":"\ufe36","\uff0c":"\ufe10","\uff0d":"\ufe32","\uff0e":"\u30fb","\uff1a":"\ufe13","\uff1b":"\ufe14","\uff1c":"\ufe3f","\uff1e":"\ufe40","\uff1f":"\ufe16","\uff3b":"\ufe47","\uff3d":"\ufe48","\uff3f":"\ufe33","\uff5b":"\ufe37","\uff5c":"\u2015","\uff5d":"\ufe38","\uff5f":"\ufe35","\uff60":"\ufe36","\uff61":"\ufe12","\uff62":"\ufe41","\uff63":"\ufe42","\u2190":"\u2191","\u2192":"\u2193"};function Ag(e){return"\ufe36"===e||"\ufe48"===e||"\ufe38"===e||"\ufe44"===e||"\ufe42"===e||"\ufe3e"===e||"\ufe3c"===e||"\ufe3a"===e||"\ufe18"===e||"\ufe40"===e||"\ufe10"===e||"\ufe13"===e||"\ufe14"===e||"\uff40"===e||"\uffe3"===e||"\ufe11"===e||"\ufe12"===e}function Mg(e){return"\ufe35"===e||"\ufe47"===e||"\ufe37"===e||"\ufe43"===e||"\ufe41"===e||"\ufe3d"===e||"\ufe3b"===e||"\ufe39"===e||"\ufe17"===e||"\ufe3f"===e}const Cg=4294967296,Pg=1/Cg,Rg="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");let zg=class{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,i=this.length){for(;this.pos<i;){const i=this.readVarint(),r=i>>3,n=this.pos;this.type=7&i,e(r,t,this),this.pos===n&&this.skip(i)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Cg;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Cg;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let i,r;return r=t[this.pos++],i=127&r,r<128?i:(r=t[this.pos++],i|=(127&r)<<7,r<128?i:(r=t[this.pos++],i|=(127&r)<<14,r<128?i:(r=t[this.pos++],i|=(127&r)<<21,r<128?i:(r=t[this.pos],i|=(15&r)<<28,function(e,t,i){const r=i.buf;let n,o;if(o=r[i.pos++],n=(112&o)>>4,o<128)return Lg(e,n,t);if(o=r[i.pos++],n|=(127&o)<<3,o<128)return Lg(e,n,t);if(o=r[i.pos++],n|=(127&o)<<10,o<128)return Lg(e,n,t);if(o=r[i.pos++],n|=(127&o)<<17,o<128)return Lg(e,n,t);if(o=r[i.pos++],n|=(127&o)<<24,o<128)return Lg(e,n,t);if(o=r[i.pos++],n|=(1&o)<<31,o<128)return Lg(e,n,t);throw new Error("Expected varint not more than 10 bytes")}(i,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return Boolean(this.readVarint())}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&Rg?Rg.decode(this.buf.subarray(t,e)):function(e,t,i){let r="",n=t;
vendor: 5,603 bytes, line 2
2for(;n<i;){const t=e[n];let o,s,a,l=null,c=t>239?4:t>223?3:t>191?2:1;if(n+c>i)break;1===c?t<128&&(l=t):2===c?(o=e[n+1],128==(192&o)&&(l=(31&t)<<6|63&o,l<=127&&(l=null))):3===c?(o=e[n+1],s=e[n+2],128==(192&o)&&128==(192&s)&&(l=(15&t)<<12|(63&o)<<6|63&s,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(o=e[n+1],s=e[n+2],a=e[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&t)<<18|(63&o)<<12|(63&s)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),n+=c}return r}(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(e){const t=7&e;if(0===t)for(;this.buf[this.pos++]>127;);else if(2===t)this.pos=this.readVarint()+this.pos;else if(5===t)this.pos+=4;else{if(1!==t)throw new Error(`Unimplemented type: ${t}`);this.pos+=8}}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const e=new Uint8Array(t);e.set(this.buf),this.buf=e,this.dataView=new DataView(e.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Pg),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Pg),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?function(e,t){let i,r;if(e>=0?(i=e%4294967296|0,r=e/4294967296|0):(i=~(-e%4294967296),r=~(-e/4294967296),4294967295^i?i=i+1|0:(i=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,i.buf[i.pos]=127&(e>>>=7)}(i,0,t),function(e,t){const i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;const t=this.pos;this.pos=function(e,t,i){for(let r,n,o=0;o<t.length;o++){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!n){r>56319||o+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):n=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(e[i++]=239,e[i++]=191,e[i++]=189,n=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);const i=this.pos-t;i>=128&&Dg(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let i=0;i<t;i++)this.buf[this.pos++]=e[i]}writeRawMessage(e,t){this.pos++;const i=this.pos;e(t,this);const r=this.pos-i;r>=128&&Dg(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r}writeMessage(e,t,i){this.writeTag(e,2),this.writeRawMessage(t,i)}writePackedVarint(e,t){t.length&&this.writeMessage(e,Og,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,Fg,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,Ng,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,kg,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,Bg,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,Vg,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,Ug,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,jg,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,Gg,t)}writeBytesField(e,t){this.writeTag(e,2),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,5),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,5),this.writeSFixed32(t)}
vendor: 5,648 bytes, line 2
2writeFixed64Field(e,t){this.writeTag(e,1),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,1),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,0),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,0),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,2),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,5),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,1),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}};function Lg(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function Dg(e,t,i){const r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(r);for(let n=i.pos-1;n>=e;n--)i.buf[n+r]=i.buf[n]}function Og(e,t){for(let i=0;i<e.length;i++)t.writeVarint(e[i])}function Fg(e,t){for(let i=0;i<e.length;i++)t.writeSVarint(e[i])}function kg(e,t){for(let i=0;i<e.length;i++)t.writeFloat(e[i])}function Bg(e,t){for(let i=0;i<e.length;i++)t.writeDouble(e[i])}function Ng(e,t){for(let i=0;i<e.length;i++)t.writeBoolean(e[i])}function Vg(e,t){for(let i=0;i<e.length;i++)t.writeFixed32(e[i])}function Ug(e,t){for(let i=0;i<e.length;i++)t.writeSFixed32(e[i])}function jg(e,t){for(let i=0;i<e.length;i++)t.writeFixed64(e[i])}function Gg(e,t){for(let i=0;i<e.length;i++)t.writeSFixed64(e[i])}function qg(e,t,i){t.glyphs=[],1===e&&i.readMessage(Hg,t)}function Hg(e,t,i){if(3===e){const{id:e,bitmap:r,width:n,height:o,left:s,top:a,advance:l}=i.readMessage($g,{});t.glyphs.push({id:e,bitmap:new Hu({width:n+6,height:o+6},r),metrics:{width:n,height:o,left:s,top:a,advance:l}})}else 4===e?t.ascender=i.readSVarint():5===e&&(t.descender=i.readSVarint())}function $g(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 Zg={horizontal:1,vertical:2,horizontalOnly:3};class Wg{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,t){const i=new Wg;return i.scale=e||1,i.fontStack=t,i}static forImage(e){const t=new Wg;return t.image=e,t}}class Xg{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,t,i){const r=new Xg;for(let n=0;n<e.sections.length;n++){const o=e.sections[n];o.image?r.addImageSection(o,i):r.addTextSection(o,t)}return r}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=function(e,t){let i="";for(let r=0;r<e.length;r++){const n=e.charCodeAt(r+1)||null,o=e.charCodeAt(r-1)||null;i+=!t&&(n&&ks(n)&&!Ig[e[r+1]]||o&&ks(o)&&!Ig[e[r-1]])||!Ig[e[r]]?e[r]:Ig[e[r]]}return i}(this.text,e)}trim(){let e=0;for(let i=0;i<this.text.length&&Kg[this.text.charCodeAt(i)];i++)e++;let t=this.text.length;for(let i=this.text.length-1;i>=0&&i>=e&&Kg[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 Xg;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(Wg.forText(e.scale,e.fontStack||t));const i=this.sections.length-1;for(let r=0;r<e.text.length;++r)this.sectionIndex.push(i)}addImageSection(e,t){const i=e.image?e.image.getPrimary():null;if(!i)return void We("Can't add FormattedSection with an empty image.");i.scaleSelf(t);const r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCodePoint(r),this.sections.push(Wg.forImage(i)),this.sectionIndex.push(this.sections.length-1)):We("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Yg(e,t,i,r,n,o,s,a,l,c,h,u,d,p,f,m=1){const _=Xg.fromFeature(e,n,m);u===Zg.vertical&&_.verticalizePunctuation(d);let g=[];const y=function(e,t,i,r,n,o){if(!e)return[];const s=[],a=function(e,t,i,r,n,o){let s=0;for(let a=0;a<e.length();a++){const i=e.getSection(a);s+=Qg(e.getCodePoint(a),i,r,n,t,o)}return s/Math.max(1,Math.ceil(s/i))}(e,t,i,r,n,o),l=e.text.indexOf("\u200b")>=0;let c=0;for(let h=0;h<e.length();h++){const i=e.getSection(h),u=e.getCodePoint(h);if(Kg[u]||(c+=Qg(u,i,r,n,t,o)),h<e.length()-1){const t=Ds(u);(Jg[u]||t||i.image)&&s.push(iy(h+1,c,a,s,ty(u,e.getCodePoint(h+1),t&&l),!1))}}return ry(iy(e.length(),c,a,s,0,!0))}(_,c,o,t,r,p),{processBidirectionalText:x,processStyledBidirectionalText:v}=Ks;if(x&&1===_.sections.length){const e=x(_.toString(),y);for(const t of e){const e=new Xg;e.text=t,e.sections=_.sections;for(let i=0;i<t.length;i++)e.sectionIndex.push(0);g.push(e)}}else if(v){const e=v(_.text,_.sectionIndex,y);for(const t of e){const e=new Xg;e.text=t[0],e.sectionIndex=t[1],e.sections=_.sections,g.push(e)}}else g=function(e,t){const i=[],r=e.text;let n=0;for(const o of t)i.push(e.substring(n,o)),n=o;return n<r.length&&i.push(e.substring(n,r.length)),i}(_,y);const b=[],w={positionedLines:b,text:_.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:u,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(e,t,i,r,n,o,s,a,l,c,h,u){let d=0,p=0,f=0;const m="right"===a?1:"left"===a?0:.5;let _=!1;for(const b of n){const e=b.getSections();for(const i of e){if(i.image)continue;const e=t[i.fontStack];
vendor: 10,686 bytes, line 2
2if(e&&(_=void 0!==e.ascender&&void 0!==e.descender,!_))break}if(!_)break}let g=0;for(const b of n){b.trim();const n=b.getMaxScale(),s=(n-1)*Sg,a={positionedGlyphs:[],lineOffset:0};e.positionedLines[g]=a;const y=a.positionedGlyphs;let x=0;if(!b.length()){p+=o,++g;continue}let v=0,w=0;for(let o=0;o<b.length();o++){const s=b.getSection(o),a=b.getSectionIndex(o),f=b.getCodePoint(o);let m=s.scale,g=null,T=null,S=null,E=Sg,I=0,A=l;A===Zg.vertical&&Fs(f)&&(A=Zg.horizontal);const M=!(A===Zg.horizontal||!h&&!Os(f)||h&&(Kg[f]||Bs(f)));if(s.image){const t=r.get(s.image.toString());if(!t)continue;S=s.image,e.iconsInText=e.iconsInText||!0,T=t.paddedRect;const i=t.displaySize;m=m*Sg/u,g={width:i[0],height:i[1],left:0,top:-3,advance:M?i[1]:i[0],localGlyph:!1},I=_?-g.height*m:n*Sg-17-i[1]*m,E=g.advance;const o=(M?i[0]:i[1])*m-Sg*n;o>0&&o>x&&(x=o)}else{const e=i[s.fontStack];if(!e)continue;e[f]&&(T=e[f]);const r=t[s.fontStack];if(!r)continue;const o=r.glyphs[f];if(!o)continue;if(g=o.metrics,E=8203!==f?Sg:0,_){const e=void 0!==r.ascender?Math.abs(r.ascender):0,t=void 0!==r.descender?Math.abs(r.descender):0,i=(e+t)*m;v<i&&(v=i,w=(e-t)/2*m),I=-e*m}else I=(n-m)*Sg-17}M?(e.verticalizable=!0,y.push({glyph:f,image:S,x:d,y:p+I,vertical:M,scale:m,localGlyph:g.localGlyph,fontStack:s.fontStack,sectionIndex:a,metrics:g,rect:T}),d+=E*m+c):(y.push({glyph:f,image:S,x:d,y:p+I,vertical:M,scale:m,localGlyph:g.localGlyph,fontStack:s.fontStack,sectionIndex:a,metrics:g,rect:T}),d+=g.advance*m+c)}0!==y.length&&(f=Math.max(d-c,f),_?oy(y,m,x,w,o*n/2):oy(y,m,x,0,o/2)),d=0;const T=o*n+x;a.lineOffset=Math.max(x,s),p+=T,++g}const y=p,{horizontalAlign:x,verticalAlign:v}=ny(s);(function(e,t,i,r,n,o){const s=(t-i)*n,a=-o*r;for(const l of e)for(const e of l.positionedGlyphs)e.x+=s,e.y+=a})(e.positionedLines,m,x,v,f,y),e.top+=-v*y,e.bottom=e.top+y,e.left+=-x*f,e.right=e.left+f,e.hasBaseline=_}(w,t,i,r,g,s,a,l,u,c,d,f),!function(e){for(const t of e)if(0!==t.positionedGlyphs.length)return!1;return!0}(b))return w}const Kg={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Jg={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Qg(e,t,i,r,n,o){if(t.image){const e=r.get(t.image.toString());return e?e.displaySize[0]*t.scale*Sg/o+n:0}{const r=i[t.fontStack],o=r&&r.glyphs[e];return o?o.metrics.advance*t.scale+n:0}}function ey(e,t,i,r){const n=Math.pow(e-t,2);return r?e<t?n/2:2*n:n+Math.abs(i)*i}function ty(e,t,i){let r=0;return 10===e&&(r-=1e4),i&&(r+=150),40!==e&&65288!==e||(r+=50),41!==t&&65289!==t||(r+=50),r}function iy(e,t,i,r,n,o){let s=null,a=ey(t,i,n,o);for(const l of r){const e=ey(t-l.x,i,n,o)+l.badness;e<=a&&(s=l,a=e)}return{index:e,x:t,priorBreak:s,badness:a}}function ry(e){return e?ry(e.priorBreak).concat(e.index):[]}function ny(e){let t=.5,i=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:t,verticalAlign:i}}function oy(e,t,i,r,n){if(!(t||i||r||n))return;const o=e.length-1,s=e[o],a=(s.x+s.metrics.advance*s.scale)*t;for(let l=0;l<=o;l++)e[l].x-=a,e[l].y+=i+r+n}function sy(e){return void 0!==e.imagePrimary&&void 0!==e.top&&void 0!==e.bottom&&void 0!==e.left&&void 0!==e.right}function ay(e,t,i,r){const{horizontalAlign:n,verticalAlign:o}=ny(r),s=i[0]-e.displaySize[0]*n,a=i[1]-e.displaySize[1]*o;return{imagePrimary:e,imageSecondary:t,top:a,bottom:a+e.displaySize[1],left:s,right:s+e.displaySize[0]}}function ly(e,t,i,r,n,o){const s=e.imagePrimary;let a;if(s.content){const e=s.content,t=s.pixelRatio||1;a=[e[0]/t,e[1]/t,s.displaySize[0]-e[2]/t,s.displaySize[1]-e[3]/t]}const l=t.left*o,c=t.right*o;let h,u,d,p;"width"===i||"both"===i?(p=n[0]+l-r[3],u=n[0]+c+r[1]):(p=n[0]+(l+c-s.displaySize[0])/2,u=p+s.displaySize[0]);const f=t.top*o,m=t.bottom*o;return"height"===i||"both"===i?(h=n[1]+f-r[0],d=n[1]+m+r[2]):(h=n[1]+(f+m-s.displaySize[1])/2,d=h+s.displaySize[1]),{imagePrimary:s,imageSecondary:void 0,top:h,right:u,bottom:d,left:p,collisionPadding:a}}function cy(e){return!e.imagePrimary.stretchX}function hy(e){return!e.imagePrimary.stretchY}function uy(e){return{width:e.right-e.left,height:e.bottom-e.top}}const dy=128;function py(e,t,i,r){const{expression:n}=t;if("constant"===n.kind)return{kind:"constant",layoutSize:n.evaluate(new Js(e+1,{worldview:i}),void 0,void 0,void 0,r)};if("source"===n.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:o}=n;let s=0;for(;s<t.length&&t[s]<=e;)s++;s=Math.max(0,s-1);let a=s;for(;a<t.length&&t[a]<e+1;)a++;a=Math.min(t.length-1,a);const l=t[s],c=t[a];return"composite"===n.kind?{kind:"composite",minZoom:l,maxZoom:c,interpolationType:o}:{kind:"camera",minZoom:l,maxZoom:c,minSize:n.evaluate(new Js(l,{worldview:i}),void 0,void 0,void 0,r),maxSize:n.evaluate(new Js(c,{worldview:i}),void 0,void 0,void 0,r),interpolationType:o}}}function fy(e,{uSize:t,uSizeT:i},{lowerSize:r,upperSize:n}){return"source"===e.kind?r/dy:"composite"===e.kind?pi(r/dy,n/dy,i):t}function my(e,t,i=1){let r=0,n=0;if("constant"===e.kind)n=e.layoutSize*i;else if("source"!==e.kind){const{interpolationType:o,minZoom:s,maxZoom:a}=e,l=o?Oe(Zn.interpolationFactor(o,t,s,a),0,1):0;"camera"===e.kind?n=pi(e.minSize,e.maxSize,l)*i:r=l*i}return{uSizeT:r,uSize:n}}class _y extends Ee{constructor(e,t,i,r,n){super(e,t),this.angle=r,this.z=i,void 0!==n&&(this.segment=n)}clone(){return new _y(this.x,this.y,this.z,this.angle,this.segment)}}function gy(e,t,i,r,n){if(void 0===t.segment)return!0;let o=t,s=t.segment+1,a=0;for(;a>-i/2;){if(s--,s<0)return!1;a-=e[s].dist(o),o=e[s]}a+=e[s].dist(e[s+1]),s++;const l=[];let c=0;for(;a<i/2;){const t=e[s],i=e[s+1];if(!i)return!1;let o=e[s-1].angleTo(t)-t.angleTo(i);for(o=Math.abs((o+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:a,angleDelta:o}),c+=o;a-l[0].distance>r;)c-=l.shift().angleDelta;if(c>n)return!1;s++,a+=t.dist(i)}return!0}function yy(e){let t=0;for(let i=0;i<e.length-1;i++)t+=e[i].dist(e[i+1]);return t}function xy(e,t,i){return e?.6*t*i:0}function vy(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function by(e,t,i,r,n,o){const s=xy(i,n,o),a=vy(i,r)*o;let l=0;const c=yy(e)/2;for(let h=0;h<e.length-1;h++){const i=e[h],r=e[h+1],n=i.dist(r);if(l+n>c){const o=(c-l)/n,u=pi(i.x,r.x,o),d=pi(i.y,r.y,o),p=new _y(u,d,0,r.angleTo(i),h);return!s||gy(e,p,a,s,t)?p:void 0}l+=n}}function wy(e,t,i,r,n,o,s,a,l){const c=xy(r,o,s),h=vy(r,n),u=h*s,d=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-u<t/4&&(t=u+t/4),Ty(e,d?t/2*a%t:(h/2+2*o)*s*a%t,t,c,i,u,d,!1,l)}function Ty(e,t,i,r,n,o,s,a,l){const c=o/2,h=yy(e);let u=0,d=t-i,p=[];for(let f=0;f<e.length-1;f++){const t=e[f],s=e[f+1],a=t.dist(s),m=s.angleTo(t);for(;d+i<u+a;){d+=i;const _=(d-u)/a,g=pi(t.x,s.x,_),y=pi(t.y,s.y,_);if(g>=0&&g<l&&y>=0&&y<l&&d-c>=0&&d+c<=h){const t=new _y(g,y,0,m,f);r&&!gy(e,t,o,r,n)||p.push(t)}}u+=a}return a||p.length||s||(p=Ty(e,u/2,i,r,n,o,s,!0,l)),p}function Sy(e){let t=0,i=0;for(const s of e)t+=s.w*s.h,i=Math.max(i,s.w);e.sort((e,t)=>t.h-e.h);const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}];let n=0,o=0;for(const s of e)for(let e=r.length-1;e>=0;e--){const t=r[e];if(!(s.w>t.w||s.h>t.h)){if(s.x=t.x,s.y=t.y,o=Math.max(o,s.y+s.h),n=Math.max(n,s.x+s.w),s.w===t.w&&s.h===t.h){const t=r.pop();t&&e<r.length&&(r[e]=t)}else s.h===t.h?(t.x+=s.w,t.w-=s.w):s.w===t.w?(t.y+=s.h,t.h-=s.h):(r.push({x:t.x+s.w,y:t.y,w:t.w-s.w,h:s.h}),t.y+=s.h,t.h-=s.h);break}}return{w:n,h:o,fill:t/(n*o)||0}}es(_y,"Anchor");class Ey{static getImagePositionScale(e,t,i){if(t&&e){const{sx:t,sy:i}=e;return{x:t,y:i}}return{x:i,y:i}}constructor(e,t,i,r){this.paddedRect=e;const{pixelRatio:n,version:o,stretchX:s,stretchY:a,content:l,sdf:c,usvg:h}=t;this.pixelRatio=n,this.stretchX=s,this.stretchY=a,this.content=l,this.version=o,this.padding=i,this.sdf=c,this.usvg=h,this.scale=Ey.getImagePositionScale(r,h,n)}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.scale.x,(this.paddedRect.h-2*this.padding)/this.scale.y]}}function Iy(e,t,i){const r=Bi.parse(e),n=function(e,t,i=[1,1]){return{x:0,y:0,w:(e.data?e.data.width:e.width*i[0])+2*t,h:(e.data?e.data.height:e.height*i[1])+2*t}}(t,i,[r.sx,r.sy]);return{bin:n,imagePosition:new Ey(n,t,i,r),imageVariant:r}}class Ay{constructor(e,t,i){const r=new Map,n=new Map;this.haveRenderCallbacks=[];const o=[];this.addImages(e,r,1,o),this.addImages(t,n,2,o);const{w:s,h:a}=Sy(o),l=new $u({width:s||1,height:a||1});for(const[c,h]of e.entries()){const e=r.get(c).paddedRect;$u.copy(h.data,l,{x:0,y:0},{x:e.x+1,y:e.y+1},h.data,null,h.sdf)}for(const[c,h]of t.entries()){const e=n.get(c),t=e.paddedRect;let r=e.padding;const o=t.x+r,s=t.y+r,a=h.data.width,u=h.data.height;r=r>1?r-1:r,$u.copy(h.data,l,{x:0,y:0},{x:o,y:s},h.data,i),$u.copy(h.data,l,{x:0,y:u-r},{x:o,y:s-r},{width:a,height:r},i),$u.copy(h.data,l,{x:0,y:0},{x:o,y:s+u},{width:a,height:r},i),$u.copy(h.data,l,{x:a-r,y:0},{x:o-r,y:s},{width:r,height:u},i),$u.copy(h.data,l,{x:0,y:0},{x:o+a,y:s},{width:r,height:u},i),$u.copy(h.data,l,{x:a-r,y:u-r},{x:o-r,y:s-r},{width:r,height:r},i),$u.copy(h.data,l,{x:0,y:u-r},{x:o+a,y:s-r},{width:r,height:r},i),$u.copy(h.data,l,{x:0,y:0},{x:o+a,y:s+u},{width:r,height:r},i),$u.copy(h.data,l,{x:a-r,y:0},{x:o-r,y:s+u},{width:r,height:r},i)}this.lut=i,this.image=l,this.iconPositions=r,this.patternPositions=n}addImages(e,t,i,r){for(const[n,o]of e.entries()){const{bin:e,imagePosition:s,imageVariant:a}=Iy(n,o,i);t.set(n,s),r.push(e),o.hasRenderCallback&&this.haveRenderCallbacks.push(a.id)}}patchUpdatedImages(e,t,i,r){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(t=>e.hasImage(t,i)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,i);for(const n of e.getUpdatedImages(i)){for(const r of this.iconPositions.keys()){const o=Bi.parse(r);if(oi.isEqual(o.id,n)){const o=e.getImage(n,i);this.patchUpdatedImage(this.iconPositions.get(r),o,t,null)}}for(const o of this.patternPositions.keys()){const s=Bi.parse(o);if(oi.isEqual(s.id,n)){const s=e.getImage(n,i);this.patchUpdatedImage(this.patternPositions.get(o),s,t,r||this.lut)}}}}patchUpdatedImage(e,t,i,r=null){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[n,o]=e.tl,s=e.sdf;if(this.lut||s){const e={width:t.data.width,height:t.data.height},a=new $u(e);$u.copy(t.data,a,{x:0,y:0},{x:0,y:0},e,r,s),i.update(a,{position:{x:n,y:o}})}else i.update(t.data,{position:{x:n,y:o}})}}es(Ey,"ImagePosition"),es(Ay,"ImageAtlas",{omit:["lut"]}
vendor: 6,140 bytes, line 2
2);const My=1e20;function Cy(e,t,i,r,n,o,s,a,l){for(let c=t;c<t+r;c++)Py(e,i*o+c,o,n,s,a,l);for(let c=i;c<i+n;c++)Py(e,c*o+t,1,r,s,a,l)}function Py(e,t,i,r,n,o,s){o[0]=0,s[0]=-My,s[1]=My,n[0]=e[t];for(let a=1,l=0,c=0;a<r;a++){n[a]=e[t+a*i];const r=a*a;do{const e=o[l];c=(n[a]-n[e]+r-e*e)/(a-e)/2}while(c<=s[l]&&--l>-1);l++,o[l]=a,s[l]=c,s[l+1]=My}for(let a=0,l=0;a<r;a++){for(;s[l+1]<a;)l++;const r=o[l],c=a-r;e[t+a*i]=n[r]+c*c}}const Ry={none:0,ideographs:1,all:2};class zy{constructor(e,t,i){this.requestManager=e,this.localGlyphMode=t,this.localFontFamily=i,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e){this.url=e}getGlyphs(e,t){const i=[],r=this.url||at.GLYPHS_URL;for(const n in e)for(const t of e[n])i.push({stack:n,id:t});Be(i,({stack:e,id:t},i)=>{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 s=Math.floor(t/256);if(256*s>65535)return We("glyphs > 65535 not supported"),void i(null,{stack:e,id:t,glyph:o});if(n.ranges[s])return void i(null,{stack:e,id:t,glyph:o});let a=n.requests[s];a||(a=n.requests[s]=[],zy.loadGlyphRange(e,s,r,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[s]=!0}for(const i of a)i(e,t);delete n.requests[s]})),a.push((r,n)=>{r?i(r):n&&i(null,{stack:e,id:t,glyph:n.glyphs[t]||null})})},(e,i)=>{if(e)t(e);else if(i){const e={};for(const{stack:t,id:r,glyph:n}of i)void 0===e[t]&&(e[t]={}),void 0===e[t].glyphs&&(e[t].glyphs={}),e[t].glyphs[r]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics},e[t].ascender=this.entries[t].ascender,e[t].descender=this.entries[t].descender;t(null,e)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==Ry.none&&(this.localGlyphMode===Ry.all?!!this.localFontFamily:!!this.localFontFamily&&(vs(e)||Ts(e)||us(e)||ds(e)||hs(e)||xs(e)||(t=e)>=131072&&t<=173791||(e=>e>=66736&&e<=66815)(e)));var t}_tinySDF(e,t,i){const r=this.localFontFamily;if(!r||!this._doesCharSupportLocalGlyph(i))return;let n=e.tinySDF;if(!n){let i="400";/bold/i.test(t)?i="900":/medium/i.test(t)?i="500":/light/i.test(t)&&(i="200"),n=e.tinySDF=new zy.TinySDF({fontFamily:r,fontWeight:i,fontSize:48,buffer:6,radius:16}),n.fontWeight=i}if(this.localGlyphs[n.fontWeight][i])return this.localGlyphs[n.fontWeight][i];const o=String.fromCodePoint(i),{data:s,width:a,height:l,glyphWidth:c,glyphHeight:h,glyphLeft:u,glyphTop:d,glyphAdvance:p}=n.draw(o);return this.localGlyphs[n.fontWeight][i]={id:i,bitmap:new Hu({width:a,height:l},s),metrics:{width:c/2,height:h/2,left:u/2,top:d/2-27,advance:p/2,localGlyph:!0}}}}function Ly(e,t){return e+t[1]-t[0]}function Dy(e,t,i,r,n=1){const o=[],s=e.imagePrimary,a=s.pixelRatio,l=s.paddedRect.w-2,c=s.paddedRect.h-2,h=(e.right-e.left)*n,u=(e.bottom-e.top)*n,d=s.stretchX||[[0,l]],p=s.stretchY||[[0,c]],f=d.reduce(Ly,0),m=p.reduce(Ly,0),_=l-f,g=c-m;let y=0,x=f,v=0,b=m,w=0,T=_,S=0,E=g;if(s.content&&r){const e=s.content;y=Fy(d,0,e[0]),v=Fy(p,0,e[1]),x=Fy(d,e[0],e[2]),b=Fy(p,e[1],e[3]),w=e[0]-y,S=e[1]-v,T=e[2]-e[0]-x,E=e[3]-e[1]-b}const I=(r,o,l,c)=>{const d=Ny(r.stretch-y,x,h,e.left*n),p=Vy(r.fixed-w,T,r.stretch,f),_=Ny(o.stretch-v,b,u,e.top*n),g=Vy(o.fixed-S,E,o.stretch,m),I=Ny(l.stretch-y,x,h,e.left*n),A=Vy(l.fixed-w,T,l.stretch,f),M=Ny(c.stretch-v,b,u,e.top*n),C=Vy(c.fixed-S,E,c.stretch,m),P=new Ee(d,_),R=new Ee(I,_),z=new Ee(I,M),L=new Ee(d,M),D=new Ee(p/a,g/a),O=new Ee(A/a,C/a),F=t*Math.PI/180;if(F){const e=Math.sin(F),t=Math.cos(F),i=[t,-e,e,t];P._matMult(i),R._matMult(i),L._matMult(i),z._matMult(i)}const k=r.stretch+r.fixed,B=l.stretch+l.fixed,N=o.stretch+o.fixed,V=c.stretch+c.fixed,U=e.imageSecondary;return{tl:P,tr:R,bl:L,br:z,texPrimary:{x:s.paddedRect.x+1+k,y:s.paddedRect.y+1+N,w:B-k,h:V-N},texSecondary:U?{x:U.paddedRect.x+1+k,y:U.paddedRect.y+1+N,w:B-k,h:V-N}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:D,pixelOffsetBR:O,minFontScaleX:T/a/h,minFontScaleY:E/a/u,isSDF:i}};if(s.stretchX||s.stretchY){const e=ky(d,_,f),t=ky(p,g,m);for(let i=0;i<e.length-1;i++){const r=e[i],n=e[i+1];for(let e=0;e<t.length-1;e++)o.push(I(r,t[e],n,t[e+1]))}}else o.push(I({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:c+1}));return o}function Oy(e,t){const i=e.stretchY||[[0,e.paddedRect.h-2]];return e.stretchX||e.stretchY?By(e.stretchX||[[0,e.paddedRect.w-2]])*By(i):1}function Fy(e,t,i){let r=0;for(const n of e)r+=Math.max(t,Math.min(i,n[1]))-Math.max(t,Math.min(i,n[0]));return r}function ky(e,t,i){const r=[{fixed:-1,stretch:0}];for(const[n,o]of e){const e=r[r.length-1];r.push({fixed:n-e.stretch,stretch:e.stretch}),r.push({fixed:n-e.stretch,stretch:e.stretch+(o-n)})}return r.push({fixed:t+1,stretch:i}),r}function By(e){return 2*e.length+1}function Ny(e,t,i,r){return e/t*i+r}function Vy(e,t,i,r){return e-t*i/r}function Uy(e,t,i,r){const n=t+e.positionedLines[r].lineOffset;return 0===r?i+n/2:i+(n+(t+e.positionedLines[r-1].lineOffset))/2}function jy(e,t,i,r,n,o,s,a,l){const c=[];if(0===t.positionedLines.length)return c;const h=(void 0!==l?l:r.layout.get("text-rotate").evaluate(o,{}))*Math.PI/180,u=function(e){const t=e[0],i=e[1],r=t*i;return r>0?[t,-i]:r<0?[-t,i]:0===t?[i,t]:[i,-t]}(i);let d=Math.abs(t.top-t.bottom);for(const _ of t.positionedLines)d-=_.lineOffset;const p=t.positionedLines.length,f=d/p;let m=t.top-i[1];for(let _=0;_<p;++_){const e=t.positionedLines[_];m=Uy(t,f,m,_);for(const r of e.positionedGlyphs){if(!r.rect)continue;const e=r.rect||{};let o=4,l=!0,d=1,p=0;if(r.image){const e=s.get(r.image.toString());if(!e)continue;if(e.sdf){We("SDF images are not supported in formatted text and will be ignored.");continue}l=!1,d=e.pixelRatio,o=1/d}const f=(n||a)&&r.vertical,_=r.metrics.advance*r.scale/2,g=r.metrics,y=r.rect;if(null===y)continue;a&&t.verticalizable&&(p=r.image?_-r.metrics.width*r.scale/2:0);const x=n?[r.x+_,r.y]:[0,0];let v=[0,0],b=[0,0],w=!1;
vendor: 5,027 bytes, line 2
2n||(f?(b=[r.x+_+u[0],r.y+u[1]-p],w=!0):v=[r.x+_+i[0],r.y+i[1]-p]);const T=y.w*r.scale/(d*(r.localGlyph?2:1)),S=y.h*r.scale/(d*(r.localGlyph?2:1));let E,I,A,M;if(f){const e=r.y-m,t=new Ee(-_,_-e),i=-Math.PI/2,n=new Ee(...b);E=new Ee(-_+v[0],v[1]),E._rotateAround(i,t)._add(n),E.x+=-e+_,E.y-=(g.left-o)*r.scale;const s=r.image?g.advance*r.scale:Sg*r.scale,a=String.fromCodePoint(r.glyph);Ag(a)?E.x+=(1-o)*r.scale:Mg(a)?E.x+=s-g.height*r.scale+(-o-1)*r.scale:E.x+=r.image||g.width+2*o===y.w&&g.height+2*o===y.h?(s-S)/2:(s-(g.height+2*o)*r.scale)/2,I=new Ee(E.x,E.y-T),A=new Ee(E.x+S,E.y),M=new Ee(E.x+S,E.y-T)}else{const e=(g.left-o)*r.scale-_+v[0],t=(-g.top-o)*r.scale+v[1],i=e+T,n=t+S;E=new Ee(e,t),I=new Ee(i,t),A=new Ee(e,n),M=new Ee(i,n)}if(h){let e;e=n?new Ee(0,0):w?new Ee(u[0],u[1]):new Ee(i[0],i[1]),E._rotateAround(h,e),I._rotateAround(h,e),A._rotateAround(h,e),M._rotateAround(h,e)}const C=new Ee(0,0),P=new Ee(0,0);c.push({tl:E,tr:I,bl:A,br:M,texPrimary:e,texSecondary:void 0,writingMode:t.writingMode,glyphOffset:x,sectionIndex:r.sectionIndex,isSDF:l,pixelOffsetTL:C,pixelOffsetBR:P,minFontScaleX:0,minFontScaleY:0})}}return c}function Gy(e,t=1,i=!1){let r=1/0,n=1/0,o=-1/0,s=-1/0;const a=e[0];for(let p=0;p<a.length;p++){const e=a[p];(!p||e.x<r)&&(r=e.x),(!p||e.y<n)&&(n=e.y),(!p||e.x>o)&&(o=e.x),(!p||e.y>s)&&(s=e.y)}const l=Math.min(o-r,s-n);let c=l/2;const h=new Vr([],qy);if(0===l)return new Ee(r,n);for(let p=r;p<o;p+=l)for(let t=n;t<s;t+=l)h.push(new Hy(p+c,t+c,c,e));let u=function(e){let t=0,i=0,r=0;const n=e[0];for(let o=0,s=n.length,a=s-1;o<s;a=o++){const e=n[o],s=n[a],l=e.x*s.y-s.x*e.y;i+=(e.x+s.x)*l,r+=(e.y+s.y)*l,t+=3*l}return new Hy(i/t,r/t,0,e)}(e),d=h.length;for(;h.length;){const r=h.pop();(r.d>u.d||!u.d)&&(u=r,i&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,d)),r.max-u.d<=t||(c=r.h/2,h.push(new Hy(r.p.x-c,r.p.y-c,c,e)),h.push(new Hy(r.p.x+c,r.p.y-c,c,e)),h.push(new Hy(r.p.x-c,r.p.y+c,c,e)),h.push(new Hy(r.p.x+c,r.p.y+c,c,e)),d+=4)}return i&&(console.log(`num probes: ${d}`),console.log(`best distance: ${u.d}`)),u.p}function qy(e,t){return t.max-e.max}zy.loadGlyphRange=function(e,t,i,r,n){const o=256*t,s=o+255,a=r.transformRequest(r.normalizeGlyphsURL(i).replace("{fontstack}",e).replace("{range}",`${o}-${s}`),Ft.Glyphs);Vt(a,(e,t)=>{if(e)n(e);else if(t){const e={},i=function(e){return new zg(e).readFields(qg,{})}(t);for(const t of i.glyphs)e[t.id]=t;n(null,{glyphs:e,ascender:i.ascender,descender:i.descender})}})},zy.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:s="normal",lang:a=null}={}){this.buffer=t,this.cutoff=r,this.radius=i,this.lang=a;const l=this.size=e+4*t,c=this._createCanvas(l),h=this.ctx=c.getContext("2d",{willReadFrequently:!0});h.font=`${s} ${o} ${e}px ${n}`,h.textBaseline="alphabetic",h.textAlign="left",h.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(e),s=Math.ceil(i),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))),l=Math.min(this.size-this.buffer,s+Math.ceil(r)),c=a+2*this.buffer,h=l+2*this.buffer,u=Math.max(c*h,0),d=new Uint8ClampedArray(u),p={data:d,width:c,height:h,glyphWidth:a,glyphHeight:l,glyphTop:s,glyphLeft:0,glyphAdvance:t};if(0===a||0===l)return p;const{ctx:f,buffer:m,gridInner:_,gridOuter:g}=this;this.lang&&(f.lang=this.lang),f.clearRect(m,m,a,l),f.fillText(e,m,m+s);const y=f.getImageData(m,m,a,l);g.fill(My,0,u),_.fill(0,0,u);for(let x=0;x<l;x++)for(let e=0;e<a;e++){const t=y.data[4*(x*a+e)+3]/255;if(0===t)continue;const i=(x+m)*c+e+m;if(1===t)g[i]=0,_[i]=My;else{const e=.5-t;g[i]=e>0?e*e:0,_[i]=e<0?e*e:0}}Cy(g,0,0,c,h,c,this.f,this.v,this.z),Cy(_,m,m,a,l,c,this.f,this.v,this.z);for(let x=0;x<u;x++){const e=Math.sqrt(g[x])-Math.sqrt(_[x]);d[x]=Math.round(255-255*(e/this.radius+this.cutoff))}return p}};class Hy{constructor(e,t,i,r){this.p=new Ee(e,t),this.h=i,this.d=function(e,t){let i=!1,r=1/0;for(let n=0;n<t.length;n++){const o=t[n];for(let t=0,n=o.length,s=n-1;t<n;s=t++){const n=o[t],a=o[s];n.y>e.y!=a.y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(i=!i),r=Math.min(r,Fh(e,n,a))}}return(i?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}}const $y=Object.keys,Zy=Number.POSITIVE_INFINITY,Wy=Math.sqrt(2);function Xy(e,t,i,r,n){const o=sy(e)&&e.collisionPadding?e.collisionPadding:[0,0,0,0],s={top:e.top-o[1],bottom:e.bottom+o[3],left:e.left-o[0],right:e.right+o[2],scaled:!1};return void 0!==r&&function(e,t){e.top*=t,e.bottom*=t,e.left*=t,e.right*=t,e.scaled=!0}(s,r),i&&function(e,t){if(!t)return;const i=Ce(t),r=new Ee(e.left,e.top),n=new Ee(e.right,e.top),o=new Ee(e.left,e.bottom),s=new Ee(e.right,e.bottom),a=new Ee(0,0);
2r._rotateAround(i,a),n._rotateAround(i,a),o._rotateAround(i,a),s._rotateAround(i,a),e.left=Math.min(r.x,n.x,o.x,s.x),e.right=Math.max(r.x,n.x,o.x,s.x),e.top=Math.min(r.y,n.y,o.y,s.y),e.bottom=Math.max(r.y,n.y,o.y,s.y)}(s,i),n&&(s.left+=n[0],s.right+=n[0],s.top+=n[1],s.bottom+=n[1]),t?{top:Math.min(t.top,s.top),bottom:Math.max(t.bottom,s.bottom),left:Math.min(t.left,s.left),right:Math.max(t.right,s.right),scaled:t.scaled||s.scaled}:s}function Yy(e,[t,i]){let r=0,n=0;if(i===Zy){t<0&&(t=0);const i=t/Wy;switch(e){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-t;break;case"top":n=t-7}switch(e){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=t;break;case"right":r=-t}}else{switch(t=Math.abs(t),i=Math.abs(i),e){case"top-right":case"top-left":case"top":n=i-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-i}switch(e){case"top-right":case"bottom-right":case"right":r=-t;break;case"top-left":case"bottom-left":case"left":r=t}}return[r,n]}function Ky(e,t,i,r,n,o,s,a,l,c,h,u,d,p,f){const m=e.layers[0],_=m.appearances;if(0===_.length)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const g={iconBBox:null,iconVerticalBBox:null},y={textBBox:null,textVerticalBBox:null},{baseIconRotate:x,baseTextRotate:v,iconScaleFactor:b}=function(e,t,i){const r=e.get("icon-rotate").evaluate(t,{},i),n=e.get("text-rotate").evaluate(t,{},i),[o,s]=e.get("icon-size-scale-range");return{baseIconRotate:r,baseTextRotate:n,iconScaleFactor:Oe(1,o,s)}}(r,n,o);t&&(g.iconBBox=Xy(t,g.iconBBox,x,s),i)&&(g.iconVerticalBBox=Xy(i,g.iconVerticalBBox,x+90,s));const w=gx(u.horizontal);w&&(y.textBBox=Xy(w,y.textBBox,v,1,p)),u.vertical&&(y.textVerticalBBox=Xy(u.vertical,y.textVerticalBBox,v+90,1,p));for(const T of _)T.hasIconProperties()&&Jy(g,e,m,T,n,o,a,x,s,l,t,c,b,h,f),T.hasTextProperties()&&ex(y,m,T,n,o,p,v,d,w,u.vertical);return{iconBBox:g.iconBBox,iconVerticalBBox:g.iconVerticalBBox,textBBox:y.textBBox,textVerticalBBox:y.textVerticalBBox}}function Jy(e,t,i,r,n,o,s,a,l,c,h,u,d,p,f){const{appearanceIconOffset:m,appearanceIconRotate:_,appearanceIconSize:g}=Qy(r,i,n,o,s,a,l,c.iconScaleFactor);let y=null,x=null,v=null;r.hasProperty("icon-image")?v=function(e,t,i,r,n,o,s,a){let l=null;const c=t.getAppearanceValueAndResolveTokens(i,"icon-image",r,n,a);if(c){const t=e.getResolvedImageFromTokens(c),h=i.getUnevaluatedProperty("icon-size"),u=nx(t,py(e.zoom,h,e.worldview,a),h,n,e.zoom,r,e.pixelRatio,s,e.worldview,a);l=o.get(u.iconPrimary.toString())}return l}(t,i,r,n,o,u,d,f):h&&(v=h.imagePrimary),v&&(y=ay(v,null,m,p),t.allowVerticalPlacement&&(x=ay(v,null,m,p))),y&&(e.iconBBox=Xy(y,e.iconBBox,_,g)),x&&(e.iconVerticalBBox=Xy(x,e.iconVerticalBBox,_+90,g))}function Qy(e,t,i,r,n,o,s,a){const l=e.hasProperty("icon-offset")?t.getAppearanceValueAndResolveTokens(e,"icon-offset",i,r,[]):null,c=l&&Array.isArray(l)?l:n,h=e.hasProperty("icon-rotate")?t.getAppearanceValueAndResolveTokens(e,"icon-rotate",i,r,[]):null,u="number"==typeof h?h:o,d=e.hasProperty("icon-size")?t.getAppearanceValueAndResolveTokens(e,"icon-size",i,r,[]):null;return{appearanceIconOffset:c,appearanceIconRotate:u,appearanceIconSize:"number"==typeof d?d*a:s}}function ex(e,t,i,r,n,o,s,a,l,c){const{appearanceTextOffset:h,appearanceTextRotate:u,appearanceTextSize:d}=tx(i,t,r,n,o,s,a),p=d/a;l&&(e.textBBox=Xy(l,e.textBBox,u,p,h)),c&&(e.textVerticalBBox=Xy(c,e.textVerticalBBox,u+90,p,h))}function tx(e,t,i,r,n,o,s){const a=e.hasProperty("text-offset")?t.getAppearanceValueAndResolveTokens(e,"text-offset",i,r,[]):null,l=a&&Array.isArray(a)?[a[0]*Sg,a[1]*Sg]:n,c=e.hasProperty("text-rotate")?t.getAppearanceValueAndResolveTokens(e,"text-rotate",i,r,[]):null,h="number"==typeof c?c:o,u=e.hasProperty("text-size")?t.getAppearanceValueAndResolveTokens(e,"text-size",i,r,[]):null;return{appearanceTextOffset:l,appearanceTextRotate:h,appearanceTextSize:"number"==typeof u?u:s}}function ix(e,t,i,r,n,o,s,a,l){if(!t||!t.usvg)return;const c=uy(r),h=uy(n),u="both"!==o&&"width"!==o||!cy(r)?1:h.width/c.width,d="both"!==o&&"height"!==o||!hy(r)?1:h.height/c.height;i.scaleSelf(u,d);const p=i.toString();s.set(p,i),a.set(p,t);const{imagePosition:f}=Iy(p,t,1);l.set(p,f)}function rx(e,t,i,r,n,o,s,a,l,c){if(!e)return;
vendor: 11,345 bytes, line 2
2const h=function(e,t,i,r,n,o,s){if("camera"===e.kind)return e.maxSize;if("composite"===e.kind){const r=t.possiblyEvaluate(new Js(e.maxZoom,{worldview:o}),i,s).evaluate(n,{},i,s),a=t.possiblyEvaluate(new Js(e.minZoom,{worldview:o}),i,s).evaluate(n,{},i,s);return Math.max(r,a)}return t.possiblyEvaluate(new Js(r,{worldview:o}),i,s).evaluate(n,{},i,s)}(t,i,r,n,o,l,c);return e.scaleSelf(h*a*s)}function nx(e,t,i,r,n,o,s,a,l,c){return{iconPrimary:rx(e.getPrimary(),t,i,r,n,o,s,a,l,c),iconSecondary:rx(e.getSecondary(),t,i,r,n,o,s,a,l,c)}}function ox(e,t,i){if(!t)return;const r=i.get(e.toString()),n=i.get(t.toString());r&&n&&(r.paddedRect.w===n.paddedRect.w&&r.paddedRect.h===n.paddedRect.h||We(`Mismatch in icon variant sizes: ${e.toString()} and ${t.toString()}`),r.usvg!==n.usvg&&We(`Mismatch in icon variant image types: ${e.id} and ${t.id}`))}function sx(e,t,i,r){if(!e)return;const n=t.get(i.toString());if(e.imagePrimary=n,r){const i=t.get(r.toString());e.imageSecondary=i}}function ax(e,t){for(const i in e.horizontal)lx(e.horizontal[i],t);lx(e.vertical,t)}function lx(e,t){if(e)for(const i of e.positionedLines)for(const e of i.positionedGlyphs)if(null!==e.image){const i=e.image.toString();e.rect=t.get(i).paddedRect}}function cx(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 hx(e,t,i,r,n,o,s,a,l){const c=gx(o.horizontal)||o.vertical,h=i.get("icon-text-fit-padding").evaluate(r,{},n);let u,d=t;return t&&"none"!==l&&(e.allowVerticalPlacement&&o.vertical&&(u=ly(t,o.vertical,l,h,a,s)),c&&(d=ly(t,c,l,h,a,s))),{defaultShapedIcon:d,verticallyShapedIcon:u}}function ux(e,t){return e*t/24}function dx(e,t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T){let S=s.textMaxSize.evaluate(t,{},d);void 0===S?S=a*s.textScaleFactor:S*=s.textScaleFactor;const E=e.layers[0].layout,I=ux(a,s.textScaleFactor),A=gx(i.horizontal)||i.vertical,M=e.hasAnyAppearanceProperty(["text-size","text-offset","text-rotate"]);if(("none"!==_||M)&&e.appearanceFeatureData&&e.featureToAppearanceIndex[t.index]<e.appearanceFeatureData.length){const i=e.appearanceFeatureData[e.featureToAppearanceIndex[t.index]];i&&(i.textShaping=A,i.iconTextFitPadding=E.get("icon-text-fit-padding").evaluate(t,{},d),i.fontScale=I,i.textScaleFactor=s.textScaleFactor)}const C="globe"===p.name,P=e.tilePixelRatio*S/24,R=(k=e.overscaling,e.zoom>18&&k>2&&(k>>=1),Math.max(Ur/(512*k),1)*E.get("symbol-spacing")),z=E.get("text-padding")*e.tilePixelRatio,L=E.get("icon-padding")*e.tilePixelRatio,D=Ce(E.get("text-max-angle")),O="map"===E.get("icon-rotation-alignment")&&"point"!==x,F=R/2;var k;!1===e.hasAnyIconTextFit&&"none"!==_&&(e.hasAnyIconTextFit=!0);const B=t.properties?+t.properties[sh]:null,N=B&&e.elevationFeatureIdToIndex?e.elevationFeatureIdToIndex.get(B):65535,V=(a,l,x)=>{if(l.x<0||l.x>=Ur||l.y<0||l.y>=Ur)return;let T=null;if(C){const{x:e,y:t,z:i}=p.projectTilePoint(l.x,l.y,x);T={anchor:new _y(e,t,i,0,void 0),up:p.upVector(x,l.x,l.y)}}!function(e,t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T,S,E,I,A,M,C,P,R){const z=e.addToLineVertexArray(t,r);let L,D,O,F,k,B,N,V=0,U=0,j=0,G=0,q=-1,H=-1;const $={};let Z=Qt("");const W=i?i.anchor:t,X="none"!==A;let Y=0,K=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")){const e=l.layout.get("text-offset").evaluate(v,{},S);Y=e[0]*Sg,K=e[1]*Sg}else Y=l.layout.get("text-radial-offset").evaluate(v,{},S)*Sg,K=Zy;if(e.allowVerticalPlacement&&n.vertical){const e=n.vertical;if(f)B=xx(e),a&&(N=xx(a));else{const i=l.layout.get("text-rotate").evaluate(v,{},S)+90;O=yx(c,W,t,h,u,d,e,p,i,m,R),a&&(F=yx(c,W,t,h,u,d,a,g,i,null,P))}}if(o){const r=l.layout.get("icon-rotate").evaluate(v,{},S),n=Dy(o,r,w,X,b.iconScaleFactor),s=a?Dy(a,r,w,X,b.iconScaleFactor):void 0;D=yx(c,W,t,h,u,d,o,g,r,null,C);const p=function(e,t,i,r,n,o,s,a,l,c){const h=e.layers[0],u=h.appearances;let d=t.length;if(i&&(d=Math.max(d,i.length)),0===u.length)return d;const[p,f]=r.get("icon-size-scale-range"),m=Oe(1,p,f);for(const _ of u){const t=_.getUnevaluatedProperties();if(void 0!==t._values["icon-image"].value){const i=h.getAppearanceValueAndResolveTokens(_,"icon-image",o,s,c);if(i){const r=e.getResolvedImageFromTokens(i);if(r){const i=_.hasProperty("icon-size")?t._values["icon-size"]:n._values["icon-size"],l=nx(r,py(e.zoom,i,e.worldview,c),i,s,e.zoom,o,e.pixelRatio,m,e.worldview,c),h=a.get(l.iconPrimary.toString());h&&(d=Math.max(d,Oy(h)))}}}}return d}(e,n,s,l.layout,l._unevaluatedLayout,v,S,e.iconAtlasPositions,0,T);V=4*p;const f=l.layout.get("icon-size").evaluate(v,{},S,T),m=b.compositeIconSizes?b.compositeIconSizes[0].evaluate(v,{},S,T):0,_=b.compositeIconSizes?b.compositeIconSizes[1].evaluate(v,{},S,T):0,A=_x(e.layerIds[0],e.iconSizeData,f,b.iconScaleFactor,m,_);e.addSymbols(e.icon,n,A,x,y,v,void 0,i,t,z.lineStartIndex,z.lineLength,-1,T,S,E,I,e.symbolInstances.length,p),q=e.icon.placedSymbolArray.length-1,s&&(U=4*p,e.addSymbols(e.icon,s,A,x,y,v,Zg.vertical,i,t,z.lineStartIndex,z.lineLength,-1,T,S,E,I,e.symbolInstances.length,p),H=e.icon.placedSymbolArray.length-1)}for(const te in n.horizontal){const r=te,o=n.horizontal[r];L||(Z=Qt(o.text),f?k=xx(o):L=yx(c,W,t,h,u,d,o,p,l.layout.get("text-rotate").evaluate(v,{},S),m,R));const a=1===o.positionedLines.length;if(j+=mx(e,i,t,o,s,l,f,v,m,z,n.vertical?Zg.horizontal:Zg.horizontalOnly,a?$y(n.horizontal):[r],$,q,b,T,S,e.symbolInstances.length,E),a)break}n.vertical&&(G+=mx(e,i,t,n.vertical,s,l,f,v,m,z,Zg.vertical,["vertical"],$,H,b,T,S,e.symbolInstances.length,E));let J=-1;const Q=(e,t)=>e?Math.max(e,t):t;J=Q(k,J),J=Q(B,J),J=Q(N,J);const ee=J>-1?1:0;e.glyphOffsetArray.length>=65535&&We("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==v.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,v.sortKey),e.symbolInstances.emplaceBack(t.x,t.y,W.x,W.y,W.z,$.right>=0?$.right:-1,$.center>=0?$.center:-1,$.left>=0?$.left:-1,$.vertical>=0?$.vertical:-1,q,H,Z,void 0!==L?L:e.collisionBoxArray.length,void 0!==L?L+1:e.collisionBoxArray.length,void 0!==O?O:e.collisionBoxArray.length,void 0!==O?O+1:e.collisionBoxArray.length,void 0!==D?D:e.collisionBoxArray.length,void 0!==D?D+1:e.collisionBoxArray.length,F||e.collisionBoxArray.length,F?F+1:e.collisionBoxArray.length,h,j,G,V,U,ee,0,Y,K,J,0,X?1:0,M)}(e,l,T,a,i,r,o,n,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,z,y,c,0,L,O,g,t,s,h,u,d,f,m,_,N,v,b,w)};if("line"===x)for(const U of Lf(t.geometry,0,0,Ur,Ur)){const t=wy(U,R,D,i.vertical||A,r,24,P,e.overscaling,Ur);for(const i of t)A&&vx(e,A.text,F,i)||V(U,i,d)}else if("line-center"===x){for(const U of t.geometry)if(U.length>1){const e=by(U,D,i.vertical||A,r,24,P);e&&V(U,e,d)}}else if("Polygon"===t.type)for(const U of Ed(t.geometry,0)){const e=Gy(U,16);V(U[0],new _y(e.x,e.y,0,0,void 0),d)}else if("LineString"===t.type)for(const U of t.geometry)V(U,new _y(U[0].x,U[0].y,0,0,void 0),d);else if("Point"===t.type)for(const U of t.geometry)for(const e of U)V([e],new _y(e.x,e.y,0,0,void 0),d)}const px=255,fx=px*dy;function mx(e,t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y){const x=jy(0,r,l,o,s,a,n,e.allowVerticalPlacement,void 0),v=o.layout.get("text-size").evaluate(a,{},_),b=f.compositeTextSizes?f.compositeTextSizes[0].evaluate(a,{},_):0,w=f.compositeTextSizes?f.compositeTextSizes[1].evaluate(a,{},_):0,T=_x(e.layerIds[0],e.textSizeData,v,f.textScaleFactor,b,w);e.addSymbols(e.text,x,T,l,s,a,h,t,i,c.lineStartIndex,c.lineLength,p,m,_,y,!1,g,x.length);for(const S of u)d[S]=e.text.placedSymbolArray.length-1;return 4*x.length}function _x(e,t,i,r,n,o){const s=t;let a=null;return"source"===s.kind?(a=[dy*i*r],a[0]>fx&&We(`${e}: Value for "text-size" is >= ${px}. Reduce your "text-size".`)):"composite"===s.kind&&(a=[dy*n*r,dy*o*r],(a[0]>fx||a[1]>fx)&&We(`${e}: Value for "text-size" is >= ${px}. Reduce your "text-size".`)),a}function gx(e){for(const t in e)return e[t];return null}function yx(e,t,i,r,n,o,s,a,l,c,h){let u,d,p,f;if(u=h?h.top:s.top,d=h?h.bottom:s.bottom,p=h?h.left:s.left,f=h?h.right:s.right,sy(s)&&s.collisionPadding){const e=s.collisionPadding;p-=e[0],u-=e[1],f+=e[2],d+=e[3]}if(l){const e=new Ee(p,u),t=new Ee(f,u),i=new Ee(p,d),r=new Ee(f,d),n=Ce(l);let o=new Ee(0,0);c&&(o=new Ee(c[0],c[1])),e._rotateAround(n,o),t._rotateAround(n,o),i._rotateAround(n,o),r._rotateAround(n,o),p=Math.min(e.x,t.x,i.x,r.x),f=Math.max(e.x,t.x,i.x,r.x),u=Math.min(e.y,t.y,i.y,r.y),d=Math.max(e.y,t.y,i.y,r.y)}return e.emplaceBack(t.x,t.y,t.z,i.x,i.y,p,u,f,d,a,r,n,o),e.length-1}function xx(e){sy(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 vx(e,t,i,r){const n=e.compareText;if(t in n){const e=n[t];for(let t=e.length-1;t>=0;t--)if(r.dist(e[t])<i)return!0}else n[t]=[];return n[t].push(r),!1}function bx(e,t){const i=e.fovAboveCenter,r=e.elevation?e.elevation.getMinElevationBelowMSL()*t:0,n=(e._camera.position[2]*e.worldSize-r)/Math.cos(e._pitch),o=Math.sin(i)*n/Math.sin(Math.max(Math.PI/2-e._pitch-i,.01));let s=Math.sin(e._pitch)*o+n;const a=n*(1/e._horizonShift);if(!e.elevation||0===e.elevation.exaggeration()){let t=Math.max(e.zoom-17,0);e.isOrthographic&&(t/=10),s*=1+t}return Math.min(1.01*s,a)}function wx(e,t){if(!t.isReprojectedInTileSpace)return{scale:1<<e.z,x:e.x,y:e.y,x2:e.x+1,y2:e.y+1,projection:t};const i=Math.pow(2,-e.z),r=e.x*i,n=(e.x+1)*i,o=e.y*i,s=(e.y+1)*i,a=Oc(r),l=Oc(n),c=Fc(o),h=Fc(s),u=t.project(a,c),d=t.project(l,c),p=t.project(l,h),f=t.project(a,h);let m=Math.min(u.x,d.x,p.x,f.x),_=Math.min(u.y,d.y,p.y,f.y),g=Math.max(u.x,d.x,p.x,f.x),y=Math.max(u.y,d.y,p.y,f.y);const x=i/16;function v(e,i,r,n,o,s){const a=(r+o)/2,l=(n+s)/2,c=t.project(Oc(a),Fc(l)),h=Math.max(0,m-c.x,_-c.y,c.x-g,c.y-y);m=Math.min(m,c.x),g=Math.max(g,c.x),_=Math.min(_,c.y),y=Math.max(y,c.y),h>x&&(v(e,c,r,n,a,l),v(c,i,a,l,o,s))}v(u,d,r,o,n,o),v(d,p,n,o,n,s),v(p,f,n,s,r,s),v(f,u,r,s,r,o),m-=x,_-=x,g+=x,y+=x;const b=1/Math.max(g-m,y-_);return{scale:b,x:m*b,y:_*b,x2:g*b,y2:y*b,projection:t}}function Tx(e,{x:t,y:i},r=0){return new Ee(((t-r)*e.scale-e.x)*Ur,(i*e.scale-e.y)*Ur)}const Sx=c(new Float32Array(16));class Ex{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 Cc(0,0)}projectTilePoint(e,t,i){return{x:e,y:t,z:0}}locationPoint(e,t,i,r=!0){return e._coordinatePoint(e.locationCoordinate(t,i),r)}pixelsPerMeter(e,t){return Dc(1,e)*t}pixelSpaceConversion(e,t,i){return 1}farthestPixelDistance(e){return bx(e,e.pixelsPerMeter)}pointCoordinate(e,t,i,r){const n=e.horizonLineFromTop(!1),o=new Ee(t,Math.max(n,i));return e.rayIntersectionCoordinate(e.pointRayIntersection(o,r))}pointCoordinate3D(e,t,i){const r=new Ee(t,i);if(e.elevation)return e.elevation.pointCoordinate(r);{const t=this.pointCoordinate(e,r.x,r.y,0);return[t.x,t.y,t.z]}}isPointAboveHorizon(e,t){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,t.x,t.y);const i=e.horizonLineFromTop();return t.y<i}createInversionMatrix(e,t){return Sx}createTileMatrix(e,t,i){let r,n,o;
vendor: 4,839 bytes, line 2
2const s=i.canonical,a=c(new Float64Array(16));if(this.isReprojectedInTileSpace){const l=wx(s,this);r=1,n=l.x+i.wrap*l.scale,o=l.y,p(a,a,[r/l.scale,r/l.scale,e.pixelsPerMeter/t])}else r=t/e.zoomScale(s.z),n=(s.x+Math.pow(2,s.z)*i.wrap)*r,o=s.y*r;return d(a,a,[n,o,0]),p(a,a,[r/Ur,r/Ur,1]),a}upVector(e,t,i){return[0,0,1]}upVectorScale(e,t,i){return{metersToTile:1}}}class Ix extends Ex{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[t,i]=this.parallels=e.parallels||[29.5,45.5],r=Math.sin(Ce(t));this.n=(r+Math.sin(Ce(i)))/2,this.c=1+r*(2*this.n-r),this.r0=Math.sqrt(this.c)/this.n}project(e,t){const{n:i,c:r,r0:n}=this,o=Ce(e-this.center[0]),s=Ce(t),a=Math.sqrt(r-2*i*Math.sin(s))/i;return{x:a*Math.sin(o*i),y:a*Math.cos(o*i)-n,z:0}}unproject(e,t){const{n:i,c:r,r0:n}=this,o=n+t;let s=Math.atan2(e,Math.abs(o))*Math.sign(o);o*i<0&&(s-=Math.PI*Math.sign(e)*Math.sign(o));const a=Ce(this.center[0])*i;s=ke(s,-Math.PI-a,Math.PI-a);const l=Oe(Pe(s/i)+this.center[0],-180,180),c=Math.asin(Oe((r-(e*e+o*o)*i*i)/(2*i),-1,1)),h=Oe(Pe(c),-85.051129,Bc);return new Cc(l,h)}}const Ax=1.340264,Mx=-.081106,Cx=893e-6,Px=.003796,Rx=Math.sqrt(3)/2;class zx extends Ex{project(e,t){t=t/180*Math.PI,e=e/180*Math.PI;const i=Math.asin(Rx*Math.sin(t)),r=i*i,n=r*r*r;return{x:.5*(e*Math.cos(i)/(Rx*(Ax+3*Mx*r+n*(7*Cx+9*Px*r)))/Math.PI+.5),y:1-.5*(i*(Ax+Mx*r+n*(Cx+Px*r))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let i=t=(2*(1-t)-1)*Math.PI,r=i*i,n=r*r*r;for(let c,h,u,d=0;d<12&&(h=i*(Ax+Mx*r+n*(Cx+Px*r))-t,u=Ax+3*Mx*r+n*(7*Cx+9*Px*r),c=h/u,i=Oe(i-c,-Math.PI/3,Math.PI/3),r=i*i,n=r*r*r,!(Math.abs(c)<1e-12));++d);const o=Rx*e*(Ax+3*Mx*r+n*(7*Cx+9*Px*r))/Math.cos(i),s=Math.asin(Math.sin(i)/Rx),a=Oe(180*o/Math.PI,-180,180),l=Oe(180*s/Math.PI,-85.051129,Bc);return new Cc(a,l)}}class Lx extends Ex{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){return{x:.5+e/360,y:.5-t/360,z:0}}unproject(e,t){const i=360*(e-.5),r=Oe(360*(.5-t),-85.051129,Bc);return new Cc(i,r)}}const Dx=Math.PI/2;function Ox(e){return Math.tan((Dx+e)/2)}class Fx extends Ex{constructor(e){super(e),this.center=e.center||[0,30];const[t,i]=this.parallels=e.parallels||[30,30];let r=Ce(t),n=Ce(i);this.southernCenter=r+n<0,this.southernCenter&&(r=-r,n=-n);const o=Math.cos(r),s=Ox(r);this.n=r===n?Math.sin(r):Math.log(o/Math.cos(n))/Math.log(Ox(n)/s),this.f=o*Math.pow(Ox(r),this.n)/this.n}project(e,t){t=Ce(t),this.southernCenter&&(t=-t),e=Ce(e-this.center[0]);const i=1e-6,{n:r,f:n}=this;n>0?t<-Dx+i&&(t=-Dx+i):t>Dx-i&&(t=Dx-i);const o=n/Math.pow(Ox(t),r);let s=o*Math.sin(r*e),a=n-o*Math.cos(r*e);return s=.5*(s/Math.PI+.5),a=.5*(a/Math.PI+.5),{x:s,y:this.southernCenter?a:1-a,z:0}}unproject(e,t){e=(2*e-.5)*Math.PI,this.southernCenter&&(t=1-t),t=(2*(1-t)-.5)*Math.PI;const{n:i,f:r}=this,n=r-t,o=Math.sign(n),s=Math.sign(i)*Math.sqrt(e*e+n*n);let a=Math.atan2(e,Math.abs(n))*o;n*i<0&&(a-=Math.PI*Math.sign(e)*o);const l=Oe(Pe(a/i)+this.center[0],-180,180),c=Oe(Pe(2*Math.atan(Math.pow(r/s,1/i))-Dx),-85.051129,Bc);return new Cc(l,this.southernCenter?-c:c)}}class kx extends Ex{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:zc(e),y:Lc(t),z:0}}unproject(e,t){const i=Oc(e),r=Fc(t);return new Cc(i,r)}}const Bx=Ce(Bc);class Nx extends Ex{project(e,t){const i=(t=Ce(t))*t,r=i*i;return{x:.5*((e=Ce(e))*(.8707-.131979*i+r*(r*(.003971*i-.001529*r)-.013791))/Math.PI+.5),y:1-.5*(t*(1.007226+i*(.015085+r*(.028874*i-.044475-.005916*r)))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let i=t=(2*(1-t)-1)*Math.PI,r=25,n=0,o=i*i;do{o=i*i;const e=o*o;n=(i*(1.007226+o*(.015085+e*(.028874*o-.044475-.005916*e)))-t)/(1.007226+o*(.045255+e*(.259866*o-.311325-.005916*11*e))),i=Oe(i-n,-Bx,Bx)}while(Math.abs(n)>1e-6&&--r>0);o=i*i;const s=Oe(Pe(e/(.8707+o*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979))),-180,180),a=Pe(i);return new Cc(s,a)}}const Vx=Ce(Bc);class Ux extends Ex{project(e,t){t=Ce(t),e=Ce(e);const i=Math.cos(t),r=2/Math.PI,n=Math.acos(i*Math.cos(e/2)),o=Math.sin(n)/n,s=.5*(e*r+2*i*Math.sin(e/2)/o)||0,a=.5*(t+Math.sin(t)/o)||0;return{x:.5*(s/Math.PI+.5),y:1-.5*(a/Math.PI+1),z:0}}unproject(e,t){let i=e=(2*e-.5)*Math.PI,r=t=(2*(1-t)-1)*Math.PI,n=25;const o=1e-6;let s=0,a=0;do{const n=Math.cos(r),o=Math.sin(r),l=2*o*n,c=o*o,h=n*n,u=Math.cos(i/2),d=Math.sin(i/2),p=2*u*d,f=d*d,m=1-h*u*u,_=m?1/m:0,g=m?Math.acos(n*u)*Math.sqrt(1/m):0,y=.5*(2*g*n*d+2*i/Math.PI)-e,x=.5*(g*o+r)-t,v=.5*_*(h*f+g*n*u*c)+1/Math.PI,b=_*(p*l/4-g*o*d),w=.125*_*(l*d-g*o*h*p),T=.5*_*(c*u+g*f*n)+.5,S=b*w-T*v;s=(x*b-y*T)/S,a=(y*w-x*v)/S,i=Oe(i-s,-Math.PI,Math.PI),r=Oe(r-a,-Vx,Vx)}while((Math.abs(s)>o||Math.abs(a)>o)&&--n>0);return new Cc(Pe(i),Pe(r))}}
vendor: 12,765 bytes, line 2
2class jx extends Ex{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Ce(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){const{scale:i,cosPhi:r}=this;return{x:Ce(e)*r*i+.5,y:-Math.sin(Ce(t))/r*i+.5,z:0}}unproject(e,t){const{scale:i,cosPhi:r}=this,n=-(t-.5)/i,o=Oe(Pe((e-.5)/i)/r,-180,180),s=Math.asin(Oe(n*r,-1,1)),a=Oe(Pe(s),-85.051129,Bc);return new Cc(o,a)}}class Gx extends kx{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 r=_u(e,t,i);return j(r,r,xu(hu(i))),{x:r[0],y:r[1],z:r[2]}}locationPoint(e,t,i){const r=Ic(t.lat,t.lng),n=B([],r),o=i?e._centerAltitude+i:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(t),e._centerAltitude):e._centerAltitude;L(r,r,n,Dc(1,0)*Ur*o);const s=c(new Float64Array(16));return u(s,e.pixelMatrix,e.globeMatrix),j(r,r,s),new Ee(r[0],r[1])}pixelsPerMeter(e,t){return Dc(1,0)*t}pixelSpaceConversion(e,t,i){const r=Dc(1,e)*t,n=pi(Dc(1,45)*t,r,i);return this.pixelsPerMeter(e,t)/n}createTileMatrix(e,t,i){const r=vu(hu(i.canonical));return u(new Float64Array(16),e.globeMatrix,r)}createInversionMatrix(e,t){const{center:i}=e,r=xu(hu(t));return m(r,r,Ce(i.lng)),f(r,r,Ce(i.lat)),p(r,r,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(r)}pointCoordinate(e,t,i,r){return au(e,t,i,!0)||new Gc(0,0)}pointCoordinate3D(e,t,i){const r=this.pointCoordinate(e,t,i,0);return[r.x,r.y,r.z]}isPointAboveHorizon(e,t){return!au(e,t.x,t.y,!1)}farthestPixelDistance(e){const t=function(e,t){const i=e.cameraToCenterDistance,r=e._centerAltitude*t,n=e._camera,o=e._camera.forward(),s=A([],z([],o,-i),[0,0,r]),a=e.worldSize/(2*Math.PI),l=[0,0,-a],c=e.width/e.height,h=Math.tan(e.fovAboveCenter),u=z([],n.up(),h),d=z([],n.right(),h*c),p=B([],A([],A([],o,u),d)),f=[];let m;if(new fh(s,p).closestPointOnSphere(l,a,f)){const t=A([],f,l),i=Z([],t,s);m=Math.cos(e.fovAboveCenter)*S(i)}else{const e=Z([],s,l),t=Z([],l,s);B(t,t);const i=S(e)-a;m=Math.sqrt(i*(i+2*a));const r=Math.acos(m/(a+i))-Math.acos(N(o,t));m*=Math.cos(r)}return 1.01*m}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),i=Su(e.zoom);if(i>0){const r=bx(e,Dc(1,e.center.lat)*e.worldSize),n=e.worldSize/(2*Math.PI),o=Math.max(e.width,e.height)/e.worldSize*Math.PI;return pi(t,r+n*(1-Math.cos(o)),Math.pow(i,10))}return t}upVector(e,t,i){return _u(t,i,e,1)}upVectorScale(e){return{metersToTile:ou(gu(hu(e)))}}}function qx(e){const t=e.parallels,i=!!t&&Math.abs(t[0]+t[1])<.01;switch(e.name){case"mercator":return new kx(e);case"equirectangular":return new Lx(e);case"naturalEarth":return new Nx(e);case"equalEarth":return new zx(e);case"winkelTripel":return new Ux(e);case"albers":return i?new jx(e):new Ix(e);case"lambertConformalConic":return i?new jx(e):new Fx(e);case"globe":return new Gx(e)}throw new Error(`Invalid projection name: ${e.name}`)}const Hx=Qc.types,$x=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Zx(e,t,i,r,n,o,s,a,l,c,h,u,d){const p=a?Math.min(fx,Math.round(a[0])):0,f=a?Math.min(fx,Math.round(a[1])):0;e.emplaceBack(t,i,Math.round(32*r),Math.round(32*n),o,s,(p<<1)+(l?1:0),0+(f<<1),16*c,16*h,256*u,256*d)}function Wx(e,t,i){e.emplaceBack(t,i)}function Xx(e,t,i,r,n,o,s){e.emplaceBack(t,i,r,n,o,s)}const Yx=(e,t,i,r)=>{for(let n=0;n<t;n++)e.emplaceBack(i[0],i[1],i[2],r[0],r[1],r[2])};function Kx(e,t,i,r,n){e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n)}function Jx(e){for(const t of e.sections)if(Us(t.text))return!0;return!1}class Qx{constructor(e){this.layoutVertexArray=new Qa,this.indexArray=new ll,this.programConfigurations=e,this.segments=new Nl,this.dynamicLayoutVertexArray=new tl,this.opacityVertexArray=new il,this.placedSymbolArray=new Il,this.iconTransitioningVertexArray=new rl,this.globeExtVertexArray=new el,this.zOffsetVertexArray=new qa,this.orientationVertexArray=new ul,this.symbolInstanceIndices=[]}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length&&0===this.iconTransitioningVertexArray.length}getSymbolVertexData(e,t){const i=[],r=this.layoutVertexArray.uint16;for(let n=0;n<t;++n){const t=12*(e+n);i.push(...r.slice(t,t+12))}return i}updateSymbolVertexData(e,t,i,r,n,o,s,a,l,c,h,u,d){const p=this.layoutVertexArray.uint16,f=12*e;p[f]=t,p[f+1]=i,p[f+2]=r,p[f+3]=n,p[f+4]=o,p[f+5]=s,p[f+6]=a,p[f+7]=l,p[f+8]=c,p[f+9]=h,p[f+10]=u,p[f+11]=d}upload(e,t,i,r,n,o){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,fg.members,!!o),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,_g.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,$x,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,xg.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,mg.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||n)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,gg.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,yg.members,!0)),this.opacityVertexBuffer.itemSize=1),(i||r)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy())}}es(Qx,"SymbolBuffers");class ev{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new Nl,this.collisionVertexArray=new al,this.collisionVertexArrayExt=new tl}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,vg.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,bg.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}es(ev,"CollisionBuffers");class tv{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.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=c([]),this.placementViewportMatrix=c([]);const t=this.layers[0]._unevaluatedLayout._values;this.worldview=e.worldview,this.localizable=e.localizable,this.textSizeData=py(this.zoom,t["text-size"],this.worldview,e.availableImages),this.iconSizeData=py(this.zoom,t["icon-size"],this.worldview,e.availableImages);const i=this.layers[0].layout,r=i.get("symbol-sort-key"),n=i.get("symbol-z-order");this.lut=e.lut,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"!==n&&void 0!==r.constantOr(1),this.sortFeaturesByY=("viewport-y"===n||"auto"===n&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=i.get("text-writing-mode").map(e=>Zg[e]),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.lastActiveApperance=null,this.featureToAppearanceIndex={}}hasAnyAppearanceProperty(e){const t=this.layers[0].getAppearances();if(!t||0===t.length)return!1;const i=Array.isArray(e)?e:[e];return t.some(e=>i.some(t=>null!=e.getProperty(t)))}createArrays(){this.text=new Qx(new fc(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new Qx(new fc(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.glyphOffsetArray=new Cl,this.lineVertexArray=new Pl,this.symbolInstances=new Ml}calculateGlyphDependencies(e,t,i,r,n){for(const o of e){const e=o.codePointAt(0);if(void 0===e)break;if(t[e]=!0,r&&n&&e<=65535){const e=Ig[o];e&&(t[e.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(e,t,i,r,n,o,s){if(!e.hasProperty("icon-size"))return s*o;let a=1;const l=e.getUnevaluatedProperties()._values["icon-size"],c=py(this.zoom,l,this.worldview,n),h=my(c,t);if("constant"!==c.kind&&"camera"!==c.kind||(a=h.uSize),"composite"===c.kind){const{minZoom:e,maxZoom:t}=c,o=l.possiblyEvaluate(new Js(e,{worldview:this.worldview}),r),s=l.possiblyEvaluate(new Js(t,{worldview:this.worldview}),r),u=o.evaluate(i,{},r,n);a=u+(s.evaluate(i,{},r,n)-u)*h.uSizeT}return"source"===c.kind&&(a=l.possiblyEvaluate(new Js(this.zoom,{worldview:this.worldview}),r).evaluate(i,{},r,n)),a*o}updateFootprints(e,t){}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const i=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!Up(this.activeReplacements,i)&&(this.activeReplacements=i,!0)}getResolvedImageFromTokens(e){return"string"==typeof e?Ni.build(e):e}populate(e,t,i,r){const n=this.layers[0],o=n.layout,s="globe"===this.projection.name,a=o.get("text-font"),l=o.get("text-field"),c=o.get("icon-image"),[h,u]=o.get("icon-size-scale-range"),d=Oe(t.scaleFactor||1,h,u),p=("constant"!==l.value.kind||l.value.value instanceof ki&&!l.value.value.isEmpty()||l.value.value.toString().length>0)&&("constant"!==a.value.kind||a.value.value.length>0),f="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,m=this.hasAnyAppearanceProperty("icon-image"),_=o.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!p&&!f&&!m)return;const g=t.iconDependencies,y=t.glyphDependencies,x=t.availableImages,v=new Js(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),b=e=>{const t=e.id.toString();g.has(t)?g.get(t).push(e):g.set(t,[e])};for(const w of e){const{feature:e,id:t,index:l,sourceLayerIndex:c}=w,h=n._featureFilter.needGeometry,u=Jc(e,h);if(!n._featureFilter.filter(v,u,i))continue;if(h||(u.geometry=Kc(e,i,r)),s&&1!==e.type&&i.z<=5){const e=u.geometry,t=.98078528056,r=(e,r)=>N(_u(e.x,e.y,i,1),_u(r.x,r.y,i,1))<t;for(let i=0;i<e.length;i++)e[i]=Zc(e[i],r)}let T,S;if(p){const e=n.getValueAndResolveTokens("text-field",u,i,x),t=ki.factory(e);Jx(t)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Xs()||this.hasRTLText&&Ks.isParsed())&&(T=Eg(t,n,u))}if(f){const e=n.getValueAndResolveTokens("icon-image",u,i,x);S=this.getResolvedImageFromTokens(e)}const E=this.layers[0];let I=!1;if(!S&&m){const e=E.getAppearances();for(const t of e)if(t.getProperty("icon-image")){const e=E.getAppearanceValueAndResolveTokens(t,"icon-image",u,i,x);if(e){S=this.getResolvedImageFromTokens(e),I=!0;break}}}if(!T&&!S)continue;const A=this.sortFeaturesByKey?_.evaluate(u,{},i):void 0,M={id:t,text:T,icon:S,index:l,sourceLayerIndex:c,geometry:u.geometry,properties:e.properties,type:Hx[e.type],sortKey:A};if(this.features.push(M),this.featureToAppearanceIndex[l]=this.appearanceFeatureData.length,this.appearanceFeatureData.push({id:t,properties:e.properties,usesAppearanceIconAsPlaceholder:I,isUsingAppearanceIconVertexData:!1,isUsingAppearanceTextVertexData:!1,layoutBasedIconVertexData:[],layoutBasedTextVertexData:[],activeAppearance:null}),S){const e=E._unevaluatedLayout._values,{iconPrimary:t,iconSecondary:r}=nx(S,this.iconSizeData,e["icon-size"],i,this.zoom,M,this.pixelRatio,d,this.worldview,x);b(t),r&&(this.hasAnySecondaryIcon=!0,b(r))}const C=E.getAppearances();
2if(0!==C.length&&C.forEach(e=>{if(!e.getProperty("icon-image"))return;const t=this.getCombinedIconPrimary(e,E,u,i,x,M,d);t&&b(t)}),T){const e=a.evaluate(u,{},i).join(","),t="map"===o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Zg.vertical)>=0;for(const i of T.sections)if(i.image){const e=i.image.getPrimary().scaleSelf(this.pixelRatio),t=e.id.toString(),r=g.get(t)||[];r.push(e),g.set(t,r)}else{const r=Rs(T.toString()),n=i.fontStack||e,o=y[n]=y[n]||{};this.calculateGlyphDependencies(i.text,o,t,this.allowVerticalPlacement,r)}}}if("line"===o.get("symbol-placement")&&(this.features=function(e){const t={},i={},r=[];let n=0;function o(t){r.push(e[t]),n++}function s(e,t,n){const o=i[e];return delete i[e],i[t]=o,r[o].geometry[0].pop(),r[o].geometry[0]=r[o].geometry[0].concat(n[0]),o}function a(e,i,n){const o=t[i];return delete t[i],t[e]=o,r[o].geometry[0].shift(),r[o].geometry[0]=n[0].concat(r[o].geometry[0]),o}function l(e,t,i){const r=i?t[0][t[0].length-1]:t[0][0];return`${e}:${r.x}:${r.y}`}for(let c=0;c<e.length;c++){const h=e[c],u=h.geometry,d=h.text?h.text.toString():null;if(!d){o(c);continue}const p=l(d,u),f=l(d,u,!0);if(p in i&&f in t&&i[p]!==t[f]){const e=a(p,f,u),n=s(p,f,r[e].geometry);delete t[p],delete i[f],i[l(d,r[n].geometry,!0)]=n,r[e].geometry=null}else p in i?s(p,f,u):f in t?a(p,f,u):(o(c),t[p]=n-1,i[f]=n-1)}return r.filter(e=>e.geometry)}(this.features)),"hd-road-markup"===o.get("symbol-elevation-reference")){if(this.elevationType="road",t.elevationFeatures){!this.elevationFeatures&&t.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const e of t.elevationFeatures)this.elevationFeatureIdToIndex.set(e.id,this.elevationFeatures.length),this.elevationFeatures.push(e)}}else o.get("symbol-z-elevate")&&(this.elevationType="offset");"none"!==this.elevationType&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((e,t)=>
vendor: 14,146 bytes, line 2
2e.sortKey-t.sortKey)}getCombinedIconPrimary(e,t,i,r,n,o,s){let a,l;const c=e.getUnevaluatedProperties();if(void 0!==c._values["icon-image"].value){const o=t.getAppearanceValueAndResolveTokens(e,"icon-image",i,r,n);a=this.getResolvedImageFromTokens(o)}else{const e=t.getValueAndResolveTokens("icon-image",i,r,n);a=this.getResolvedImageFromTokens(e)}if(a){const i=e.hasProperty("icon-size")?c._values["icon-size"]:t._unevaluatedLayout._values["icon-size"];l=nx(a,py(this.zoom,i,this.worldview,n),i,r,this.zoom,o,this.pixelRatio,s,this.worldview,n).iconPrimary}return l}updateSymbolInstanceIconVertices(e,t,i,r,n,o,s,a,l,c,h,u,d,p){if(e.placedIconSymbolIndex<0)return{vertexOffsetDelta:0,hasChanges:!1};if(t.activeAppearance===i)return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1};if(i){const f=this.getCombinedIconPrimary(i,l,r,o,s,{sortKey:void 0,text:void 0,icon:null,index:e.featureIndex,sourceLayerIndex:e.featureIndex,geometry:[],properties:t.properties,type:"Point",id:t.id},c);if(!f)return{vertexOffsetDelta:0,hasChanges:!1};const m=f.toString(),_=this.iconAtlasPositions&&this.iconAtlasPositions.get(m);if(_){const{appearanceIconOffset:f,appearanceIconRotate:m}=Qy(i,l,r,o,u,p,d,c);let g=ay(_,void 0,f,l.layout.get("icon-anchor").evaluate(r,h,o));const y=_.sdf,x=l.layout.get("icon-text-fit").constantOr("none");"none"!==x&&t.textShaping&&t.iconTextFitPadding&&t.fontScale&&(g=ly(g,t.textShaping,x,t.iconTextFitPadding,f,t.fontScale));const v=this.calculateEffectiveAppearanceIconSize(i,a.zoom,r,o,s,c,d),b=0,w=1+(Math.min(fx,Math.round(v*dy))<<1),T=Dy(g,m,y,"none"!==x,c);t.isUsingAppearanceIconVertexData||(t.isUsingAppearanceIconVertexData=!0,t.layoutBasedIconVertexData=this.icon.getSymbolVertexData(n,e.numIconVertices));let S=n;for(let i=0;i<T.length;++i){const r=T[i],n=t.layoutBasedIconVertexData[0]||e.tileAnchorX,o=t.layoutBasedIconVertexData[1]||e.tileAnchorY,s=16*r.pixelOffsetTL.x,a=16*r.pixelOffsetTL.y,l=16*r.pixelOffsetBR.x,c=16*r.pixelOffsetBR.y,h=16*r.minFontScaleX,u=16*r.minFontScaleY;this.icon.updateSymbolVertexData(S,n,o,Math.round(32*r.tl.x),Math.round(32*r.tl.y),r.texPrimary.x,r.texPrimary.y,b,w,s,a,h,u),this.icon.updateSymbolVertexData(S+1,n,o,Math.round(32*r.tr.x),Math.round(32*r.tr.y),r.texPrimary.x+r.texPrimary.w,r.texPrimary.y,b,w,l,a,h,u),this.icon.updateSymbolVertexData(S+2,n,o,Math.round(32*r.bl.x),Math.round(32*r.bl.y),r.texPrimary.x,r.texPrimary.y+r.texPrimary.h,b,w,s,c,h,u),this.icon.updateSymbolVertexData(S+3,n,o,Math.round(32*r.br.x),Math.round(32*r.br.y),r.texPrimary.x+r.texPrimary.w,r.texPrimary.y+r.texPrimary.h,b,w,l,c,h,u),S+=4}const E=e.numIconVertices-4*T.length;for(let e=0;e<E;++e)this.icon.updateSymbolVertexData(S+e,0,0,0,0,0,0,0,0,0,0,0,0);return{vertexOffsetDelta:e.numIconVertices,hasChanges:!0}}}else if(t.usesAppearanceIconAsPlaceholder){if(this.layers[0].appearances&&this.layers[0].appearances.length>0)return this.icon.updateSymbolVertexData(n,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(n+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(n+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(n+3,0,0,0,0,0,0,0,0,0,0,0,0),{vertexOffsetDelta:e.numIconVertices,hasChanges:!0}}else if(t.isUsingAppearanceIconVertexData){const e=12,i=t.layoutBasedIconVertexData.length/e;for(let r=0;r<i;++r){const i=r*e;this.icon.updateSymbolVertexData(n+r,t.layoutBasedIconVertexData[i+0],t.layoutBasedIconVertexData[i+1],t.layoutBasedIconVertexData[i+2],t.layoutBasedIconVertexData[i+3],t.layoutBasedIconVertexData[i+4],t.layoutBasedIconVertexData[i+5],t.layoutBasedIconVertexData[i+6],t.layoutBasedIconVertexData[i+7],t.layoutBasedIconVertexData[i+8],t.layoutBasedIconVertexData[i+9],t.layoutBasedIconVertexData[i+10],t.layoutBasedIconVertexData[i+11])}return t.isUsingAppearanceIconVertexData=!1,{vertexOffsetDelta:i,hasChanges:!0}}return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1}}updateSymbolInstanceTextVertices(e,t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g){const y=e.numHorizontalGlyphVertices>0||e.numVerticalGlyphVertices>0;if(!y)return{vertexOffsetDelta:y?e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices:0,hasChanges:!1};if(t.activeAppearance===i)return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1};if(i&&t.textShaping){const{appearanceTextOffset:y,appearanceTextRotate:x,appearanceTextSize:v}=tx(i,s,r,o,h,d,u);t.fontScale=ux(v,t.textScaleFactor);const b=i.getUnevaluatedProperty("text-size");let w=this.textSizeData,T=m,S=_;i.hasProperty("text-size")&&(w=py(this.zoom,b,this.worldview,g),T="composite"===this.textSizeData.kind?this.textSizeData.minZoom:0,S="composite"===this.textSizeData.kind?this.textSizeData.maxZoom:0);const E=t.textShaping.bottom-h[1],I=t.textShaping.left-h[0],A=t.textShaping.right-h[0];t.textShaping.top=y[1]+(t.textShaping.top-h[1]),t.textShaping.bottom=y[1]+E,t.textShaping.left=y[0]+I,t.textShaping.right=y[0]+A;const M=jy(0,t.textShaping,y,s,!1,r,l,this.allowVerticalPlacement,x),C=v&&"composite"===w.kind?b.possiblyEvaluate(new Js(T,{}),o).evaluate(r,c,o):p,P=v&&"composite"===w.kind?b.possiblyEvaluate(new Js(S,{}),o).evaluate(r,c,o):f,R=_x(i.name,w,v,a,C,P),z=Array.isArray(R)?R[1]:v,L=0,D=1+(Math.min(fx,Math.round(z*dy))<<1);t.isUsingAppearanceTextVertexData||(t.isUsingAppearanceTextVertexData=!0,t.layoutBasedTextVertexData=this.text.getSymbolVertexData(n,e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices));for(let t=0;t<M.length&&t<(e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices)/4;++t){const i=M[t],r=i.glyphOffset[1],o=e.tileAnchorX,s=e.tileAnchorY,a=n+4*t;this.text.updateSymbolVertexData(a,o,s,Math.round(32*i.tl.x),Math.round(32*(r+i.tl.y)),i.texPrimary.x,i.texPrimary.y,L,D,i.pixelOffsetTL.x,i.pixelOffsetTL.y,i.minFontScaleX,i.minFontScaleY),this.text.updateSymbolVertexData(a+1,o,s,Math.round(32*i.tr.x),Math.round(32*(r+i.tr.y)),i.texPrimary.x+i.texPrimary.w,i.texPrimary.y,L,D,i.pixelOffsetBR.x,i.pixelOffsetTL.y,i.minFontScaleX,i.minFontScaleY),this.text.updateSymbolVertexData(a+2,o,s,Math.round(32*i.bl.x),Math.round(32*(r+i.bl.y)),i.texPrimary.x,i.texPrimary.y+i.texPrimary.h,L,D,i.pixelOffsetTL.x,i.pixelOffsetBR.y,i.minFontScaleX,i.minFontScaleY),this.text.updateSymbolVertexData(a+3,o,s,Math.round(32*i.br.x),Math.round(32*(r+i.br.y)),i.texPrimary.x+i.texPrimary.w,i.texPrimary.y+i.texPrimary.h,L,D,i.pixelOffsetBR.x,i.pixelOffsetBR.y,i.minFontScaleX,i.minFontScaleY)}return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!0}}if(t.isUsingAppearanceTextVertexData){const e=12,i=t.layoutBasedTextVertexData.length/e;for(let r=0;r<i;++r){const i=r*e;this.text.updateSymbolVertexData(n+r,t.layoutBasedTextVertexData[i+0],t.layoutBasedTextVertexData[i+1],t.layoutBasedTextVertexData[i+2],t.layoutBasedTextVertexData[i+3],t.layoutBasedTextVertexData[i+4],t.layoutBasedTextVertexData[i+5],t.layoutBasedTextVertexData[i+6],t.layoutBasedTextVertexData[i+7],t.layoutBasedTextVertexData[i+8],t.layoutBasedTextVertexData[i+9],t.layoutBasedTextVertexData[i+10],t.layoutBasedTextVertexData[i+11])}return t.isUsingAppearanceTextVertexData=!1,{vertexOffsetDelta:i,hasChanges:!0}}return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1}}update(e,t,i,r,n,o,s){this.text.programConfigurations.updatePaintArrays(e,t,n,i,r,o,s,this.worldview),this.icon.programConfigurations.updatePaintArrays(e,t,n,i,r,o,s,this.worldview)}updateRoadElevation(e){if("road"!==this.elevationType||!this.elevationFeatures)return;if(this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let t=!1;const i=jc(e),r=1/i;let n=!1,o=!1;for(let s=0;s<this.symbolInstances.length;s++){const e=this.symbolInstances.get(s),a=E(1,0,0),l=E(0,1,0),{numHorizontalGlyphVertices:c,numVerticalGlyphVertices:h,numIconVertices:u,numVerticalIconVertices:d}=e,p=c>0||h>0,f=u>0,m=this.elevationFeatures[e.elevationFeatureIndex];if(m){const s=new Ee(e.tileAnchorX,e.tileAnchorY),c=.075+m.pointElevation(s);e.zOffset!==c&&(t=!0,e.zOffset=c),0!==c&&(this.hasAnyZOffset=!0);const h=m.computeSlopeNormal(s,r),u=ce(te(),E(0,0,1),h);q(a,a,u),q(l,l,u),a[2]*=i,l[2]*=i,1===a[0]&&0===a[1]&&0===a[2]&&0===l[0]&&1===l[1]&&0===l[2]||(n=n||p,o=o||f)}if(p&&(Yx(this.text.orientationVertexArray,c,a,l),Yx(this.text.orientationVertexArray,h,a,l)),f){const{placedIconSymbolIndex:t,verticalPlacedIconSymbolIndex:i}=e;t>=0&&Yx(this.icon.orientationVertexArray,u,a,l),i>=0&&Yx(this.icon.orientationVertexArray,d,a,l)}}n||(this.text.orientationVertexArray=void 0),o||(this.icon.orientationVertexArray=void 0),t&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const e=(e,t,r)=>{i+=t,i>e.length&&e.resize(i);for(let n=-t;n<0;n++)e.emplace(n+i,r)},t=(e,t,i)=>{r+=t,r>e.length&&e.resize(r);for(let n=-t;n<0;n++)e.emplace(n+r,i)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let i=0,r=0;for(let n=0;n<this.symbolInstances.length;n++){const i=this.symbolInstances.get(n),{numHorizontalGlyphVertices:r,numVerticalGlyphVertices:o,numIconVertices:s}=i,a=i.zOffset,l=s>0;if((r>0||o>0)&&(e(this.text.zOffsetVertexArray,r,a),e(this.text.zOffsetVertexArray,o,a)),l){const{placedIconSymbolIndex:e,verticalPlacedIconSymbolIndex:r}=i;e>=0&&t(this.icon.zOffsetVertexArray,s,a),r>=0&&t(this.icon.zOffsetVertexArray,i.numVerticalIconVertices,a)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e,t,i,r,n){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),null===this.hasAppearances&&(this.hasAppearances=this.layers.some(e=>e.appearances&&e.appearances.length>0)),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(e,t,i,r,n){if(!(e&&t&&i&&this.appearanceFeatureData))return!1;const o=this.icon.layoutVertexArray&&this.icon.layoutVertexArray.length>0&&this.icon.layoutVertexArray.arrayBuffer,s=this.text.layoutVertexArray&&this.text.layoutVertexArray.length>0&&this.text.layoutVertexArray.arrayBuffer;if(!o&&!s)return!1;const a=this.layers[0],l=a.layout;let c=1,h=0,u=!1;if(o){const[e,t]=l.get("icon-size-scale-range");c=Oe(1,e,t)}let d=1,p=0,f=!1;if(s){const[e,t]=l.get("text-size-scale-range");d=Oe(1,e,t)}const m=new Map;if(n&&i)for(const _ of i){const e=n.getImage(_,a.scope);if(e){const t=new Bi(_.toString());m.set(t.toString(),e)}}for(let _=0;_<this.symbolInstances.length;_++){const n=this.symbolInstances.get(_),g=this.featureToAppearanceIndex[n.featureIndex],y=void 0!==g?this.appearanceFeatureData[g]:void 0;if(!y)continue;const x=y.id,v=t&&void 0!==x?t[String(x)]:void 0,b={type:"Point",id:y.id,properties:y.properties,geometry:[]},w=a.appearances&&a.appearances.find(t=>t.isActive({globals:r,feature:b,canonical:e,featureState:v}));if(s){const t=l.get("text-size"),r=l.get("text-offset").evaluate(b,v,e),o=t.evaluate(b,v,e),s=l.get("text-rotate").evaluate(b,v,e),c="composite"===this.textSizeData.kind?this.textSizeData.minZoom:0,h="composite"===this.textSizeData.kind?this.textSizeData.maxZoom:0,u=t.evaluate(b,{zoom:c},e),_=t.evaluate(b,{zoom:h},e),g=this.updateSymbolInstanceTextVertices(n,y,w,b,p,e,a,d,m,v,r,o,s,u,_,c,h,i);p+=g.vertexOffsetDelta,f=f||g.hasChanges}if(o){const t=l.get("icon-offset").evaluate(b,v,e),o=l.get("icon-size").evaluate(b,v,e,i),s=l.get("icon-rotate").evaluate(b,v,e),d=this.updateSymbolInstanceIconVertices(n,y,w,b,h,e,i,r,a,c,v,t,o,s);h+=d.vertexOffsetDelta,u=u||d.hasChanges}y.activeAppearance=w}return u&&this.icon.layoutVertexBuffer&&null!==this.icon.layoutVertexArray.arrayBuffer&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray),f&&this.text.layoutVertexBuffer&&null!==this.text.layoutVertexArray.arrayBuffer&&this.text.layoutVertexArray.length===this.text.layoutVertexBuffer.length&&this.text.layoutVertexBuffer.updateData(this.text.layoutVertexArray),u||f}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=qx(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:r,y:n}of t)this.lineVertexArray.emplaceBack(r,n);return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g){const y=e.indexArray,x=e.layoutVertexArray,v=e.globeExtVertexArray,b=e.segments.prepareSegment(4*g,x,y,this.canOverlap?o.sortKey:void 0),w=this.glyphOffsetArray.length,T=b.vertexLength,S=this.allowVerticalPlacement&&s===Zg.vertical?Math.PI/2:0,E=o.text&&o.text.sections;for(let M=0;M<t.length;M++){const{tl:r,tr:n,bl:s,br:c,texPrimary:h,texSecondary:u,pixelOffsetTL:_,pixelOffsetBR:g,minFontScaleX:w,minFontScaleY:T,glyphOffset:I,isSDF:A,sectionIndex:C}=t[M],P=b.vertexLength,R=I[1];if(Zx(x,l.x,l.y,r.x,R+r.y,h.x,h.y,i,A,_.x,_.y,w,T),Zx(x,l.x,l.y,n.x,R+n.y,h.x+h.w,h.y,i,A,g.x,_.y,w,T),Zx(x,l.x,l.y,s.x,R+s.y,h.x,h.y+h.h,i,A,_.x,g.y,w,T),Zx(x,l.x,l.y,c.x,R+c.y,h.x+h.w,h.y+h.h,i,A,g.x,g.y,w,T),a){const{x:t,y:i,z:r}=a.anchor,[n,o,s]=a.up;Xx(v,t,i,r,n,o,s),Xx(v,t,i,r,n,o,s),Xx(v,t,i,r,n,o,s),Xx(v,t,i,r,n,o,s),Kx(e.dynamicLayoutVertexArray,t,i,r,S)}else Kx(e.dynamicLayoutVertexArray,l.x,l.y,l.z,S);if(m){const t=u||h;Wx(e.iconTransitioningVertexArray,t.x,t.y),Wx(e.iconTransitioningVertexArray,t.x+t.w,t.y),Wx(e.iconTransitioningVertexArray,t.x,t.y+t.h),Wx(e.iconTransitioningVertexArray,t.x+t.w,t.y+t.h)}
vendor: 16,339 bytes, line 2
2y.emplaceBack(P,P+1,P+2),y.emplaceBack(P+1,P+2,P+3),b.vertexLength+=4,b.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(I[0]),M!==t.length-1&&C===t[M+1].sectionIndex||e.programConfigurations.populatePaintArrays(x.length,o,o.index,{},d,p,f,E&&E[C],this.worldview)}const I=g-t.length;0!==I&&this._addNullVertices(I,x,i,a,v,e,m,b,y);const A=a?a.anchor:l;e.placedSymbolArray.emplaceBack(A.x,A.y,A.z,l.x,l.y,w,this.glyphOffsetArray.length-w,T,c,h,l.segment,i?i[0]:0,i?i[1]:0,r[0],r[1],s,0,0,0,u,0),e.symbolInstanceIndices.push(_)}_addNullVertices(e,t,i,r,n,o,s,a,l){for(let c=0;c<e;c++){for(let a=0;a<4;a++)Zx(t,0,0,0,0,0,0,i,!1,0,0,0,0),r?(Xx(n,0,0,0,0,0,0),Kx(o.dynamicLayoutVertexArray,0,0,0,0)):Kx(o.dynamicLayoutVertexArray,0,0,0,0),s&&Wx(o.iconTransitioningVertexArray,0,0);const e=a.vertexLength;l.emplaceBack(e,e+1,e+2),l.emplaceBack(e+1,e+2,e+3),a.vertexLength+=4,a.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(0)}}_commitLayoutVertex(e,t,i,r,n,o,s){e.emplaceBack(t,i,r,n,o,Math.round(s.x),Math.round(s.y))}_addCollisionDebugVertices(e,t,i,r,n,o,s){const a=i.segments.prepareSegment(4,i.layoutVertexArray,i.indexArray),l=a.vertexLength,c=s.tileAnchorX,h=s.tileAnchorY;for(let d=0;d<4;d++)i.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(i.collisionVertexArrayExt,t,e.padding,s.zOffset),this._commitLayoutVertex(i.layoutVertexArray,r,n,o,c,h,new Ee(e.x1,e.y1)),this._commitLayoutVertex(i.layoutVertexArray,r,n,o,c,h,new Ee(e.x2,e.y1)),this._commitLayoutVertex(i.layoutVertexArray,r,n,o,c,h,new Ee(e.x2,e.y2)),this._commitLayoutVertex(i.layoutVertexArray,r,n,o,c,h,new Ee(e.x1,e.y2)),a.vertexLength+=4;const u=i.indexArray;u.emplaceBack(l,l+1),u.emplaceBack(l+1,l+2),u.emplaceBack(l+2,l+3),u.emplaceBack(l+3,l),a.primitiveLength+=4}_addTextDebugCollisionBoxes(e,t,i,r,n,o){for(let s=r;s<n;s++){const r=i.get(s),n=this.getSymbolInstanceTextSize(e,o,t,s);this._addCollisionDebugVertices(r,n,this.textCollisionBox,r.projectedAnchorX,r.projectedAnchorY,r.projectedAnchorZ,o)}}_addIconDebugCollisionBoxes(e,t,i,r,n,o){for(let s=r;s<n;s++){const r=i.get(s),n=this.getSymbolInstanceIconSize(e,t,o.placedIconSymbolIndex);this._addCollisionDebugVertices(r,n,this.iconCollisionBox,r.projectedAnchorX,r.projectedAnchorY,r.projectedAnchorZ,o)}}generateCollisionDebugBuffers(e,t,i){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new ev(ol,wg.members,rl),this.iconCollisionBox=new ev(ol,wg.members,rl);const r=my(this.iconSizeData,e),n=my(this.textSizeData,e,i);for(let o=0;o<this.symbolInstances.length;o++){const i=this.symbolInstances.get(o);this._addTextDebugCollisionBoxes(n,e,t,i.textBoxStartIndex,i.textBoxEndIndex,i),this._addTextDebugCollisionBoxes(n,e,t,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i),this._addIconDebugCollisionBoxes(r,e,t,i.iconBoxStartIndex,i.iconBoxEndIndex,i),this._addIconDebugCollisionBoxes(r,e,t,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex,i)}}getSymbolInstanceTextSize(e,t,i,r){const n=this.text.placedSymbolArray.get(t.rightJustifiedTextSymbolIndex>=0?t.rightJustifiedTextSymbolIndex:t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.leftJustifiedTextSymbolIndex>=0?t.leftJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex>=0?t.verticalPlacedTextSymbolIndex:r),o=fy(this.textSizeData,e,n)/Sg;return this.tilePixelRatio*o}getSymbolInstanceIconSize(e,t,i){const r=this.icon.placedSymbolArray.get(i),n=fy(this.iconSizeData,e,r);return this.tilePixelRatio*n}_commitDebugCollisionVertexUpdate(e,t,i,r){e.emplaceBack(t,-i,-i,r),e.emplaceBack(t,i,-i,r),e.emplaceBack(t,i,i,r),e.emplaceBack(t,-i,i,r)}_updateTextDebugCollisionBoxes(e,t,i,r,n,o,s){for(let a=r;a<n;a++){const r=i.get(a),n=this.getSymbolInstanceTextSize(e,o,t,a);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,n,r.padding,o.zOffset)}}_updateIconDebugCollisionBoxes(e,t,i,r,n,o,s){for(let a=r;a<n;a++){const r=i.get(a),n=this.getSymbolInstanceIconSize(e,t,o.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,n,r.padding,o.zOffset)}}updateCollisionDebugBuffers(e,t,i,r){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const n=my(this.iconSizeData,e,r),o=my(this.textSizeData,e,i);for(let s=0;s<this.symbolInstances.length;s++){const a=this.symbolInstances.get(s);this._updateTextDebugCollisionBoxes(o,e,t,a.textBoxStartIndex,a.textBoxEndIndex,a,i),this._updateTextDebugCollisionBoxes(o,e,t,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a,i),this._updateIconDebugCollisionBoxes(n,e,t,a.iconBoxStartIndex,a.iconBoxEndIndex,a,r),this._updateIconDebugCollisionBoxes(n,e,t,a.verticalIconBoxStartIndex,a.verticalIconBoxEndIndex,a,r)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,t,i,r,n,o,s,a,l){const c={};if(t<i){const{x1:i,y1:r,x2:n,y2:o,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:h,tileAnchorX:u,tileAnchorY:d,featureIndex:p}=e.get(t);c.textBox={x1:i,y1:r,x2:n,y2:o,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:h,tileAnchorX:u,tileAnchorY:d},c.textFeatureIndex=p}if(r<n){const{x1:t,y1:i,x2:n,y2:o,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:h,tileAnchorX:u,tileAnchorY:d,featureIndex:p}=e.get(r);c.verticalTextBox={x1:t,y1:i,x2:n,y2:o,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:h,tileAnchorX:u,tileAnchorY:d},c.verticalTextFeatureIndex=p}if(o<s){const{x1:t,y1:i,x2:r,y2:n,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:h,tileAnchorX:u,tileAnchorY:d,featureIndex:p}=e.get(o);c.iconBox={x1:t,y1:i,x2:r,y2:n,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:h,tileAnchorX:u,tileAnchorY:d},c.iconFeatureIndex=p}if(a<l){const{x1:t,y1:i,x2:r,y2:n,padding:o,projectedAnchorX:s,projectedAnchorY:l,projectedAnchorZ:h,tileAnchorX:u,tileAnchorY:d,featureIndex:p}=e.get(a);c.verticalIconBox={x1:t,y1:i,x2:r,y2:n,padding:o,projectedAnchorX:s,projectedAnchorY:l,projectedAnchorZ:h,tileAnchorX:u,tileAnchorY:d},c.verticalIconFeatureIndex=p}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){const i=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,t){const i=e.placedSymbolArray.get(t),r=i.vertexStartIndex+4*i.numGlyphs;for(let n=i.vertexStartIndex;n<r;n+=4)e.indexArray.emplaceBack(n,n+1,n+2),e.indexArray.emplaceBack(n+1,n+2,n+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const t=Math.sin(e),i=Math.cos(e),r=[],n=[],o=[];for(let s=0;s<this.symbolInstances.length;++s){o.push(s);const e=this.symbolInstances.get(s);r.push(0|Math.round(t*e.tileAnchorX+i*e.tileAnchorY)),n.push(e.featureIndex)}return o.sort((e,t)=>r[e]-r[t]||n[t]-n[e]),o}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((e,t)=>this.symbolInstances.get(t).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,t){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex);const{rightJustifiedTextSymbolIndex:i,centerJustifiedTextSymbolIndex:r,leftJustifiedTextSymbolIndex:n,verticalPlacedTextSymbolIndex:o,placedIconSymbolIndex:s,verticalPlacedIconSymbolIndex:a}=t;i>=0&&this.addIndicesForPlacedSymbol(this.text,i),r>=0&&r!==i&&this.addIndicesForPlacedSymbol(this.text,r),n>=0&&n!==r&&n!==i&&this.addIndicesForPlacedSymbol(this.text,n),o>=0&&this.addIndicesForPlacedSymbol(this.text,o),s>=0&&this.addIndicesForPlacedSymbol(this.icon,s),a>=0&&this.addIndicesForPlacedSymbol(this.icon,a)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getElevationFeatureForText(e){const t=this.symbolInstances.get(this.text.symbolInstanceIndices[e]).elevationFeatureIndex;let i;return this.elevationFeatures&&t<this.elevationFeatures.length&&(i=this.elevationFeatures[t]),i}}function iv(e,t){return t.replace(/{([^{}]+)}/g,(t,i)=>i in e?String(e[i]):"")}let rv,nv,ov;es(tv,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),tv.addDynamicAttributes=Kx;class sv{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:yi,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}}es(sv,"FormatSectionOverride",{omit:["defaultValue"]});const av=()=>ov||(ov={layout:rv||(rv=new ha({"symbol-placement":new aa(ua.layout_symbol["symbol-placement"]),"symbol-spacing":new aa(ua.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new aa(ua.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new la(ua.layout_symbol["symbol-sort-key"]),"symbol-z-order":new aa(ua.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new aa(ua.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new aa(ua.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new aa(ua.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new aa(ua.layout_symbol["icon-ignore-placement"]),"icon-optional":new aa(ua.layout_symbol["icon-optional"]),"icon-rotation-alignment":new aa(ua.layout_symbol["icon-rotation-alignment"]),"icon-size":new la(ua.layout_symbol["icon-size"]),"icon-size-scale-range":new aa(ua.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new la(ua.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new la(ua.layout_symbol["icon-text-fit-padding"]),"icon-image":new la(ua.layout_symbol["icon-image"]),"icon-image-use-theme":new aa({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new la(ua.layout_symbol["icon-rotate"]),"icon-padding":new aa(ua.layout_symbol["icon-padding"]),"icon-keep-upright":new aa(ua.layout_symbol["icon-keep-upright"]),"icon-offset":new la(ua.layout_symbol["icon-offset"]),"icon-anchor":new la(ua.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new aa(ua.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new aa(ua.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new aa(ua.layout_symbol["text-rotation-alignment"]),"text-field":new la(ua.layout_symbol["text-field"]),"text-font":new la(ua.layout_symbol["text-font"]),"text-size":new la(ua.layout_symbol["text-size"]),"text-size-scale-range":new aa(ua.layout_symbol["text-size-scale-range"]),"text-max-width":new la(ua.layout_symbol["text-max-width"]),"text-line-height":new la(ua.layout_symbol["text-line-height"]),"text-letter-spacing":new la(ua.layout_symbol["text-letter-spacing"]),"text-justify":new la(ua.layout_symbol["text-justify"]),"text-radial-offset":new la(ua.layout_symbol["text-radial-offset"]),"text-variable-anchor":new aa(ua.layout_symbol["text-variable-anchor"]),"text-anchor":new la(ua.layout_symbol["text-anchor"]),"text-max-angle":new aa(ua.layout_symbol["text-max-angle"]),"text-writing-mode":new aa(ua.layout_symbol["text-writing-mode"]),"text-rotate":new la(ua.layout_symbol["text-rotate"]),"text-padding":new aa(ua.layout_symbol["text-padding"]),"text-keep-upright":new aa(ua.layout_symbol["text-keep-upright"]),"text-transform":new la(ua.layout_symbol["text-transform"]),"text-offset":new la(ua.layout_symbol["text-offset"]),"text-allow-overlap":new aa(ua.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new aa(ua.layout_symbol["text-ignore-placement"]),"text-optional":new aa(ua.layout_symbol["text-optional"]),visibility:new aa(ua.layout_symbol.visibility)})),paint:nv||(nv=new ha({"icon-opacity":new la(ua.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new la(ua.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new la(ua.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new la(ua.paint_symbol["text-emissive-strength"]),"icon-color":new la(ua.paint_symbol["icon-color"]),"icon-halo-color":new la(ua.paint_symbol["icon-halo-color"]),"icon-halo-width":new la(ua.paint_symbol["icon-halo-width"]),"icon-halo-blur":new la(ua.paint_symbol["icon-halo-blur"]),"icon-translate":new aa(ua.paint_symbol["icon-translate"]),"icon-translate-anchor":new aa(ua.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new aa(ua.paint_symbol["icon-image-cross-fade"]),"text-opacity":new la(ua.paint_symbol["text-opacity"]),"text-occlusion-opacity":new la(ua.paint_symbol["text-occlusion-opacity"]),"text-color":new la(ua.paint_symbol["text-color"],{runtimeType:wi,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new la(ua.paint_symbol["text-halo-color"]),"text-halo-width":new la(ua.paint_symbol["text-halo-width"]),"text-halo-blur":new la(ua.paint_symbol["text-halo-blur"]),"text-translate":new aa(ua.paint_symbol["text-translate"]),"text-translate-anchor":new aa(ua.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new aa(ua.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new aa(ua.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new aa(ua.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new aa(ua.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new la(ua.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"})}))},ov);class lv extends Da{constructor(e,t,i,r){super(e,av(),t,i,r,e.layout?e.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=c([]),this.hasOcclusionOpacityProperties=void 0!==e.paint&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}_handleSpecialPaintPropertyUpdate(e){"icon-occlusion-opacity"!==e&&"text-occlusion-opacity"!==e||(this.hasOcclusionOpacityProperties=!0)}recalculate(e,t){super.recalculate(e,t),this.appearances&&this.appearances.forEac
vendor: 28,327 bytes, line 2
2h(i=>{i.recalculate(e,t,this.iconImageUseTheme)}),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const i=this.layout.get("text-writing-mode");if(i){const e=[];for(const t of i)e.indexOf(t)<0&&e.push(t);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,t,i,r){return this._saturation===e&&this._contrast===t&&this._brightnessMin===i&&this._brightnessMax===r||(this._colorAdjustmentMatrix=function(e,t,i,r){e=ot(e),t=nt(t);const n=a(),o=e/3,s=1-2*o,l=[s,o,o,0,o,s,o,0,o,o,s,0,0,0,0,1],c=.5-.5*t,h=r-i;return u(n,[h,0,0,0,0,h,0,0,0,0,h,0,i,i,i,1],[t,0,0,0,0,t,0,0,0,0,t,0,c,c,c,1]),u(n,n,l),n}(e,t,i,r),this._saturation=e,this._contrast=t,this._brightnessMin=i,this._brightnessMax=r),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,t,i,r){const n=this.layout.get(e).evaluate(t,{},i,r),o=this._unevaluatedLayout._values[e];return o.isDataDriven()||jo(o.value)||!n?n:iv(t.properties,n)}getAppearanceValueAndResolveTokens(e,t,i,r,n){const o=e.getProperty(t);if(!o)return;const s=o.evaluate(i,{},r,n),a=e.getUnevaluatedProperties()._values[t];return a.isDataDriven()||jo(a.value)||!s||"string"!=typeof s?s:iv(i.properties,s)}createBucket(e){return new tv(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of av().paint.overridableProperties){if(!lv.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),i=new sv(t),r=new Uo(i,t.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let n=null;n="constant"===t.value.kind||"source"===t.value.kind?new qo("source",r):new Ho("composite",r,t.value.zoomStops,t.value.interpolationType),this.paint._values[e]=new oa(t.property,n,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven())&&lv.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const i=e.get("text-field"),r=av().paint.properties[t];let n=!1;const o=e=>{for(const t of e)if(r.overrides&&r.overrides.hasOverride(t))return void(n=!0)};if("constant"===i.value.kind&&i.value.value instanceof ki)o(i.value.value.sections);else if("source"===i.value.kind){const e=t=>{n||(t instanceof qi&&ji(t.value)===Ii?o(t.value.sections):t instanceof Wi?o(t.sections):t.eachChild(e))},t=i.value;t._styleExpression&&e(t._styleExpression.expression)}return n}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,t,i){return{config:new pc(this,{zoom:t,lut:i}),overrideFog:!1}}hasElevation(){return this.layout&&"hd-road-markup"===this.layout.get("symbol-elevation-reference")}}let cv,hv,uv,dv;var pv=Na([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function fv(e,t,i,r,n,a,l,c){const h=[e,t,1,i,r,1,n,a,1],u=[l,c,1],d=o([],h),[p,f,m]=G(u,u,d);return s(h,h,[p,0,0,0,f,0,0,0,m])}function mv(e,t,i,r,n,a,l,c){const h=function(e,t,i,r,n,a,l,c){const h=fv(0,0,1,0,1,1,0,1),u=fv(e,t,i,r,n,a,l,c);return s(u,u,o([],h))}(e,t,i,r,n,a,l,c);return[h[2]/h[8]/Ur,h[5]/h[8]/Ur]}function _v(e){return[e[0],Math.min(Math.max(e[1],-85.051129),Bc)]}class gv extends ni{constructor(e,t,i,r){super(),this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(r),this.options=t,this._dirty=!1}load(e,t){if(this._loaded=t||!1,this.fire(new ei("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=Ht(this.map._requestManager.transformRequest(this.url,Ft.Image),(t,i)=>{this._imageRequest=null,this._loaded=!0,t?this.fire(new ti(t)):i&&(this.image=i instanceof HTMLImageElement?gt.getImageData(i):i,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new km(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new ei("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof km||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let t=e[0][1],i=e[0][1];for(const n of e)n[1]>i&&(i=n[1]),n[1]<t&&(t=n[1]);const r=(i+t)/2;if(r>Bc?this.onNorthPole=!0:r<-85.051129&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const t=e.map(Gc.fromLngLat);this.tileID=function(e){let t=1/0,i=1/0,r=-1/0,n=-1/0;for(const c of e)t=Math.min(t,c.x),i=Math.min(i,c.y),r=Math.max(r,c.x),n=Math.max(n,c.y);const o=Math.max(r-t,n-i),s=Math.max(0,Math.floor(-Math.log2(o))),a=Math.pow(2,s);let l=Math.floor((t+r)/2*a);return l>1&&(l-=1),new Yh(s,l,Math.floor((i+n)/2*a))}(t),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new ei("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof km||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const o in this.tiles){const e=this.tiles[o];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const t=wx(new Yh(0,0,0),this.map.transform.projection),i=[t.projection.project(this.coordinates[0][0],this.coordinates[0][1]),t.projection.project(this.coordinates[1][0],this.coordinates[1][1]),t.projection.project(this.coordinates[2][0],this.coordinates[2][1]),t.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(e){const t=e[1].x-e[0].x,i=e[1].y-e[0].y,r=e[2].x-e[1].x,n=e[2].y-e[1].y,o=e[3].x-e[2].x,s=e[3].y-e[2].y,a=e[0].x-e[3].x,l=e[0].y-e[3].y,c=t*n-r*i,h=r*s-o*n,u=o*l-a*s,d=a*i-t*l;return c>0&&h>0&&u>0&&d>0||c<0&&h<0&&u<0&&d<0}(i))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const r=wx(this.tileID,this.map.transform.projection),[n,a,l,c]=this.coordinates.map(e=>{const t=r.projection.project(e[0],e[1]);return Tx(r,t)._round()});this.perspectiveTransform=mv(n.x,n.y,a.x,a.y,l.x,l.y,c.x,c.y);const h=this._boundsArray=new Ga;h.emplaceBack(n.x,n.y,0,0),h.emplaceBack(a.x,a.y,Ur,0),h.emplaceBack(c.x,c.y,0,Ur),h.emplaceBack(l.x,l.y,Ur,Ur),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(h,pv.members),this.boundsSegments=Nl.simpleSegment(0,0,4,2);const u=[],d=[_v((p=this.coordinates)[0]),_v(p[1]),_v(p[2]),_v(p[3])];var p;const[f,m,_,g]=function(e){let t=e[0][0],i=t,r=e[0][1],n=r;for(let o=1;o<e.length;o++)e[o][0]<t?t=e[o][0]:e[o][0]>i&&(i=e[o][0]),e[o][1]<r?r=e[o][1]:e[o][1]>n&&(n=e[o][1]);return[t,r,i-t,n-r]}(d);{const r=new Ga,[n,a,l,c]=function(e){let t=e[0].x,i=t,r=e[0].y,n=r;for(let o=1;o<e.length;o++)e[o].x<t?t=e[o].x:e[o].x>i&&(i=e[o].x),e[o].y<r?r=e[o].y:e[o].y>n&&(n=e[o].y);return[t,r,i-t,n-r]}(i),h=e=>[(e.x-n)/l,(e.y-a)/c],[d,p,y,x]=i.map(h),v=function(e,t,i,r,n,a,l,c){const h=fv(0,0,1,0,1,1,0,1);return s(h,h,o([],fv(e,t,i,r,n,a,l,c)))}(d[0],d[1],p[0],p[1],y[0],y[1],x[0],x[1]);this.elevatedGlobePerspectiveTransform=mv(d[0],d[1],p[0],p[1],y[0],y[1],x[0],x[1]);const b=(e,t)=>{u.push(e.lng);const i=Math.round((e.lng-f)/_*Ur),n=Math.round((e.lat-m)/g*Ur),o=h(t),s=G([],[o[0],o[1],1],v),a=Math.round(s[0]/s[2]*Ur),l=Math.round(s[1]/s[2]*Ur);r.emplaceBack(i,n,a,l)},w=i[3].x-i[0].x,T=i[3].y-i[0].y,S=i[2].x-i[1].x,E=i[2].y-i[1].y;for(let e=0;e<65;e++){const r=e/64,n=[i[0].x+r*w,i[0].y+r*T],o=[i[1].x+r*S,i[1].y+r*E],s=o[0]-n[0],a=o[1]-n[1];for(let e=0;e<65;e++){const i=e/64,r={x:n[0]+s*i,y:n[1]+a*i};b(t.projection.unproject(r.x,r.y),r)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(r,pv.members)}{this.maxLongitudeTriangleSize=0;let t=[],i=new ll;const r=(e,r,n)=>{i.emplaceBack(e,r,n);const o=u[e],s=u[r],a=u[n],l=Math.min(Math.min(o,s),a),c=Math.max(Math.max(o,s),a)-l;c>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=c),t.push(l+c/2)};for(let e=0;e<64;e++)for(let t=0;t<64;t++){const i=65*e+t,n=i+1,o=i+65,s=o+1;r(i,o,n),r(n,o,s)}[t,i]=function(e,t){const i=Array.from({length:e.length},(e,t)=>t);i.sort((t,i)=>e[t]-e[i]);const r=[],n=new ll;for(let o=0;o<i.length;o++){const s=i[o];r.push(e[s]);const a=3*s,l=a+1;n.emplaceBack(t.uint16[a],t.uint16[l],t.uint16[l+1])}return[r,n]}(t,i),this.elevatedGlobeTrianglesCenterLongitudes=t,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(i)}this.elevatedGlobeSegments=Nl.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,_/Ur,0,g/Ur,0,0,m,f,0])}prepare(){const e=0!==Object.keys(this.tiles).length;if(this.tileID&&!e)return;const t=this.map.painter.context,i=t.gl;!this._dirty||this.texture instanceof km||(this.texture?this.texture.update(this.image):(this.texture=new Fm(t,this.image,i.RGBA8),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(t)}loadTile(e,t){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},t(null)):(e.state="errored",t(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){const t=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!t)return null;const i=this.elevatedGlobeTrianglesCenterLongitudes;let r=(n=e+180)+360*Math.round((i[0]-n)/360);var n;const o=new Nl,s=(e,i)=>{o.segments.push({vertexOffset:0,primitiveOffset:e,vertexLength:t.segments[0].vertexLength,primitiveLength:i,sortKey:void 0,vaos:{}})},a=.51*this.maxLongitudeTriangleSize;if(Math.abs(i[0]-r)<=a){const e=rt(i,0,i.length,r+a);return e===i.length||s(e,it(i,e+1,i.length,r+360-a)-e),o}r<i[0]&&(r+=360);const l=it(i,0,i.length,r-a);if(l===i.length)return s(0,i.length),o;s(0,l-0);const c=rt(i,l+1,i.length,r+a);return c!==i.length&&s(c,i.length-c),o}}const yv=1024,xv=(Math.pow(yv,2)-1)/268170240;class vv extends Da{constructor(e,t,i,r){super(e,{layout:uv||(uv=new ha({visibility:new aa(ua.layout_raster.visibility)})),paint:dv||(dv=new ha({"raster-opacity":new aa(ua.paint_raster["raster-opacity"]),"raster-color":new ca(ua.paint_raster["raster-color"]),"raster-color-mix":new aa(ua.paint_raster["raster-color-mix"]),"raster-color-range":new aa(ua.paint_raster["raster-color-range"]),"raster-hue-rotate":new aa(ua.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new aa(ua.paint_raster["raster-brightness-min"]),"raster-brightness-max":new aa(ua.paint_raster["raster-brightness-max"]),"raster-saturation":new aa(ua.paint_raster["raster-saturation"]),"raster-contrast":new aa(ua.paint_raster["raster-contrast"]),"raster-resampling":new aa(ua.paint_raster["raster-resampling"]),"raster-fade-duration":new aa(ua.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new aa(ua.paint_raster["raster-emissive-strength"]),"raster-array-band":new aa(ua.paint_raster["raster-array-band"]),"raster-elevation":new aa(ua.paint_raster["raster-elevation"]),"raster-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(e){return!(e&&e._source instanceof gv&&(e._source.onNorthPole||e._source.onSouthPole))&&0===this.paint.get("raster-elevation")}_handleSpecialPaintPropertyUpdate(e){"raster-color"!==e&&"raster-color-range"!==e||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}updateColorRamp(e){if(!this.hasColorMap())return;if(!this._curRampRange)return;const t=this._transitionablePaint._values["raster-color"].value.expression,[i,r]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(i)&&isNaN(r)||i===this._curRampRange[0]&&r===this._curRampRange[1]||(this.colorRamp=Wu({expression:t,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:i,end:r}],resolution:yv}),this.colorRampTexture=null,this._curRampRange=[i,r])}is3D(e){return this.paint.get("raster-elevation")>0}}let bv,wv,Tv,Sv,Ev;class Iv extends Da{constructor(e,t,i,r){super(e,{layout:bv||(bv=new ha({visibility:new aa(ua["layout_raster-particle"].visibility)})),paint:wv||(wv=new ha({"raster-particle-array-band":new aa(ua["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new aa(ua["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new ca(ua["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new aa(ua["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new aa(ua["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new aa(ua["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new aa(ua["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new aa(ua["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),this._updateColorRamp(),this.lastInvalidatedAt=gt.now()}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this.tileFramebuffer&&(this.tileFramebuffer.destroy(),this.tileFramebuffer=null),this.particleFramebuffer&&(this.particleFramebuffer.destroy(),this.particleFramebuffer=null)}onRemove(e){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return"none"!==this.visibility}isDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){"raster-particle-color"!==e&&"raster-particle-max-speed"!==e||(this._updateColorRamp(),this._invalidateAnimationState()),"raster-particle-count"===e&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-particle-color"].value.expression,t=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=Wu({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:t}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=gt.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class Av extends Da{constructor(e,t){super(e,{},t,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(e){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}isDraped(e){return void 0!==this.implementation.renderToTile}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}function Mv(e,t,i){const r=[0,0,1],n=ie([]);return ne(n,n,i?-Ce(e)+Math.PI:Ce(e)),re(n,n,-Ce(t)),q(r,r,n),B(r,r)}const Cv={None:0,Model:1,Symbol:2,FillExtrusion:4};class Pv{constructor(e,t,i,r){this.message=(e?`${e}: `:"")+i,r&&(this.identifier=r),null!=t&&t.__line__&&(this.line=t.__line__)}}function Rv(e,t){const i=-1===e.indexOf("://");try{return new URL(e,i&&t?"http://example.com":void 0),!0}catch(e){return!1}}class zv{constructor(e,t){this.feature=e,this.instancedDataOffset=t,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class Lv{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new xl,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(e){const t=16*e,i=this.instancedDataArray.float32;let r=Math.floor(i[t+2]);const n=1.05*(i[t+2]-r);return r/=100,[i[t]%1*1.05,i[t+1]%1*1.05,n,r]}tileCoordinatesForInstance(e){const t=16*e,i=this.instancedDataArray.float32;let r=i[t+0];return r=r>Ur?r-Ur:r,new Ee(Math.trunc(r),Math.trunc(i[t+1]))}translationForInstance(e){const t=16*e,i=this.instancedDataArray.float32;return[i[t+4],i[t+5],i[t+6]]}rotationScaleForInstance(e){const t=16*e,i=this.instancedDataArray.float32;return[i[t+7],i[t+8],i[t+9],i[t+10],i[t+11],i[t+12],i[t+13],i[t+14],i[t+15]]}transformForInstance(e){const t=16*e,i=this.instancedDataArray.float32;return[i[t+7],i[t+8],i[t+9],i[t+4],i[t+10],i[t+11],i[t+12],i[t+5],i[t+13],i[t+14],i[t+15],i[t+6],0,0,0,1]}}class Dv{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaledZ=this.canonical.z+Math.log2(e.overscaling),this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.projection=e.projection,this.index=e.index,this.worldview=e.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z+1?0:this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=e.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,i,r){}populate(e,t,i,r){this.tileToMeter=jc(i);const n=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);const o="hd-road-markup"===this.layers[0].paint.get("model-elevation-reference")?t.elevationFeatures:void 0;for(const{feature:s,id:a,index:l,sourceLayerIndex:c}of e){const e=null!=a?a:s.properties&&s.properties.hasOwnProperty("id")?s.properties.id:void 0,h=Jc(s,n);if(!this.layers[0]._featureFilter.filter(new Js(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),h,i))continue;const u={id:e,sourceLayerIndex:c,index:l,geometry:n?h.geometry:Kc(s,i,r),properties:s.properties,type:s.type,patterns:{}},d=this.addFeature(u,u.geometry,h,o,i);d&&t.featureIndex.insert(s,u.geometry,l,c,this.index,this.instancesPerModel[d].instancedDataArray.length,256)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const e=this.layers[0].modelManager,t=this.layers[0].scope;let i=0;for(const r of this.modelUris){const n=e.getModel(r,t);if(!n)continue;const o=this.instancesPerModel[r];if(o){const e=.5*D(n.aabb.max,n.aabb.min)*o.maxScale+o.maxXYTranslationDistance,t=Math.min(Ur,Math.max(e/this.tileToMeter,256));i=Math.max(t,i)}}return i}update(e,t,i,r){for(const n in this.instancesPerModel){const t=this.instancesPerModel[n];for(const i in e)t.idToFeaturesIndex.hasOwnProperty(i)&&(this.evaluate(t.features[t.idToFeaturesIndex[i]],e[i],t,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const t in this.instancesPerModel){const i=this.instancesPerModel[t];for(const t of i.features){const r=this.layers[0],n=t.feature,o=this.canonical,s=r.paint.get("model-rotation").evaluate(n,{},o),a=r.paint.get("model-scale").evaluate(n,{},o),l=r.paint.get("model-translation").evaluate(n,{},o);$(t.rotation,s)&&$(t.scale,a)&&$(t.translation,l)||(this.evaluate(t,t.featureStates,i,!0),e=!0)}}return e}updateReplacement(e,t,i,r){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const n=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(Up(this.activeReplacements,n))return!1;this.activeReplacements=n;let o=!1;for(const s in this.instancesPerModel){const t=this.instancesPerModel[s],n=t.instancedDataArray;for(const s of t.features){const t=s.instancedDataOffset,a=s.instancedDataCount;for(let s=0;s<a;s++){const a=16*(s+t);let l=n.float32[a+0];const c=l>Ur;l=c?l-Ur:l;const h=Math.floor(l),u=Math.floor(n.float32[a+1]);let d=!1;for(const t of this.activeReplacements)if(!kp(t,i,Cv.Model,r)&&!(t.min.x>h||h>t.max.x||t.min.y>u||u>t.max.y)&&(d=Zp($p(h,u,e.canonical,t.footprintTileId.canonical),t.footprint),d))break;n.float32[a]=d?l+Ur:l,o=o||d!==c}}}return o}isEmpty(){for(const e in this.instancesPerModel)if(0!==this.instancesPerModel[e].instancedDataArray.length)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const t in this.instancesPerModel){const i=this.instancesPerModel[t];i.instancedDataArray.length<0||0===i.instancedDataArray.length||(i.instancedDataBuffer?i.instancedDataBuffer.updateData(i.instancedDataArray):i.instancedDataBuffer=e.createVertexBuffer(i.instancedDataArray,Gm.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(e){for(const i in this.instancesPerModel){const e=this.instancesPerModel[i];0!==e.instancedDataArray.length&&e.instancedDataBuffer&&e.instancedDataBuffer.destroy()}const t=this.layers[0].modelManager;if(e&&t&&this.modelUris&&this.modelsRequested)for(const i of this.modelUris)t.removeModel(i,"",!0)}addFeature(e,t,i,r,n){const o=this.layers[0],s=o.layout.get("model-id"),a=o.layout.get("model-allow-density-reduction"),l=s.evaluate(i,{},this.canonical);if(!l)return We(`modelId is not evaluated for layer ${o.id} and it is not going to get rendered.`),l;(Rv(l,!1)||void 0!==this.styleDefinedModelURLs[l])&&(this.modelUris.includes(l)||this.modelUris.push(l)),this.instancesPerModel[l]||(this.instancesPerModel[l]=new Lv);const c=this.instancesPerModel[l],h=c.instancedDataArray,u=new zv(i,h.length);let d;r&&(d=Sh.getElevationFeature(e,r));for(const p of t)for(const e of p){if(e.x<0||e.x>=Ur||e.y<0||e.y>=Ur)continue;if(0!==this.lookupDim&&a){const t=(this.lookupDim-1)/Ur,i=this.lookupDim*(e.y*t|0)+e.x*t|0;if(this.lookup){if(0!==this.lookup[i])continue;this.lookup[i]=1}}this.instanceCount++;const t=h.length;if(h.resize(t+1),r){c.instancesRoadElevation||(c.instancesRoadElevation=[]);const t=d?d.pointElevation(new Ee(e.x,e.y)):0;c.instancesRoadElevation.push(t)}c.instancesEvaluatedElevation.push(0),h.float32[16*t]=e.x,h.float32[16*t+1]=e.y}return u.instancedDataCount=c.instancedDataArray.length-u.instancedDataOffset,u.instancedDataCount>0&&(e.id&&(c.idToFeaturesIndex[e.id]=c.features.length),c.features.push(u),this.evaluate(u,{},c,!1)),l}getModelUris(){return this.modelUris}evaluate(e,t,i,r){const n=this.layers[0],o=e.feature,s=this.canonical,a=e.rotation=n.paint.get("model-rotation").evaluate(o,t,s),l=e.scale=n.paint.get("model-scale").evaluate(o,t,s),c=e.translation=n.paint.get("model-translation").evaluate(o,t,s),h=Object.assign({},n.paint.get("model-color").evaluate(o,t,s));h.a=n.paint.get("model-color-mix-intensity").evaluate(o,t,s);const u=[];this.maxVerticalOffset<c[2]&&(this.maxVerticalOffset=c[2]);const d=c[0]*c[0]+c[1]*c[1],p=d>0?Math.sqrt(d):0;i.maxScale=Math.max(Math.max(i.maxScale,l[0]),Math.max(l[1],l[2])),i.maxXYTranslationDistance=Math.max(i.maxXYTranslationDistance,p),this.maxScale=Math.max(Math.max(this.maxScale,l[0]),Math.max(l[1],l[2])),Km(u,a,l);const f=Math.round(100*h.a)+h.b/1.05;for(let m=0;m<e.instancedDataCount;++m){const t=e.instancedDataOffset+m,n=16*t,o=i.instancedDataArray.float32;let a=0;r&&(a=o[n+6]-i.instancesEvaluatedElevation[t]);const l=0|o[n+1];o[n]=(0|o[n])+h.r/1.05,o[n+1]=l+h.g/1.05,o[n+2]=f,o[n+3]=1/(s.z>10?this.tileToMeter:jc(s,l)),o[n+4]=c[0],o[n+5]=c[1],o[n+6]=c[2]+(i.instancesRoadElevation?i.instancesRoadElevation[t]:0)+a,o[n+7]=u[0],o[n+8]=u[1],o[n+9]=u[2],o[n+10]=u[4],o[n+11]=u[5],o[n+12]=u[6],o[n+13]=u[8],o[n+14]=u[9],o[n+15]=u[10],i.instancesEvaluatedElevation[t]=c[2]}}}let Ov,Fv;es(Dv,"ModelBucket",{omit:["layers"]}),es(Lv,"PerModelAttributes"),es(zv,"ModelFeature");class kv{constructor(e,t,i){this._demTile=e,this._dem=this._demTile.dem,this._scale=t,this._offset=i}static create(e,t,i){const r=i||e.findDEMTileFor(t);if(!r||!r.dem)return;const n=r.dem,o=r.tileID,s=1<<t.canonical.z-o.canonical.z;return new kv(r,n.dim/Ur/s,[(t.canonical.x/s-o.canonical.x)*n.dim,(t.canonical.y/s-o.canonical.y)*n.dim])}tileCoordToPixel(e,t){const i=t*this._scale+this._offset[1];return new Ee(Math.floor(e*this._scale+this._offset[0]),Math.floor(i))}getElevationAt(e,t,i,r){const n=e*this._scale+this._offset[0],o=t*this._scale+this._offset[1],s=Math.floor(n),a=Math.floor(o),l=this._dem;return r=!!r,i?pi(pi(l.get(s,a,r),l.get(s,a+1,r),o-a),pi(l.get(s+1,a,r),l.get(s+1,a+1,r),o-a),n-s):l.get(s,a,r)}getElevationAtPixel(e,t,i){return this._dem.get(e,t,!!i)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*Dc(1,e)*this._dem.stride}}const Bv=new Float32Array(262144),Nv=new Uint8Array(262144);function Vv(e){let t=0;if(e.meshes)for(const i of e.meshes)t=Math.max(t,i.aabb.max[2]);if(e.children)for(const i of e.children)t=Math.max(t,Vv(i));return t}function Uv(e,t,i){if(e.meshes)for(const r of e.meshes){if(r.aabb.min[0]===1/0)continue;const n=bh.applyTransform(r.aabb,e.globalMatrix);i.insert(t,n.min[0],n.min[1],n.max[0],n.max[1])}if(e.children)for(const r of e.children)Uv(r,t,i)}const jv=["","wall","door","roof","window","lamp","logo"];class Gv{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedTranslation=[0,0,0],this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:Vv(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new bh([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const t=new bh([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const i of this.node.meshes)this.node.lightMeshIndex!==e&&(i.transformedAabb=bh.applyTransformFast(i.aabb,this.node.globalMatrix),t.encapsulate(i.transformedAabb)),e++;this.aabb=t}return this.aabb}}class qv{constructor(e,t,i,r,n,o,s,a){this.id=i,this.layers=e,this.layerIds=this.layers.map(e=>e.fqid),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.modelTraits|=i_.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,r&&(this.modelTraits|=i_.HasMapbox
vendor: 4,695 bytes, line 2
2MeshFeatures),n&&(this.modelTraits|=i_.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=o,this.worldview=a,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const l of t)this.nodesInfo.push(new Gv(l)),Uv(l,s.featureIndexArray.length,s.grid),s.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,s.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(e,t){for(const i of this.getNodesInfo()){const r=i.node;r.footprint&&t.push({footprint:r.footprint,id:e})}}updateAppearances(e,t,i,r){}update(e){const t=0!==Object.keys(e).length;if(t&&!this.stateDependentLayers.length)return;const i=t?this.stateDependentLayers:this.layers;if(!Ie(e,this.states))for(const r of i)this.evaluate(r,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const t=this.getNodesInfo();for(const i of t){const t=i.node;this.uploaded?this.updatePbrBuffer(t):a_(t,e,!0)}for(const i of t)l_(i.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let t=!1;if(!e.meshes)return t;for(const i of e.meshes)i.pbrBuffer&&(i.pbrBuffer.updateData(i.featureArray),t=!0);return t}needsReEvaluation(e,t,i){const r=e.transform.projectionOptions,n=e.style.getBrightness(),o=this.brightness!==n;if(!this.uploaded||this.dirty||r.name!==this.projection.name||Hv(i.paint.get("model-color").value,o)||Hv(i.paint.get("model-color-mix-intensity").value,o)||Hv(i.paint.get("model-roughness").value,o)||Hv(i.paint.get("model-emissive-strength").value,o)||Hv(i.paint.get("model-height-based-emissive-strength-multiplier").value,o)){this.projection=r,this.brightness=n;const e=this.getNodesInfo();for(const t of e)t.state=null;return!0}return!1}evaluateTransform(e,t){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const i=this.getNodesInfo(),r=this.id.canonical;for(const n of i){const e=n.feature;n.evaluatedTranslation=t.paint.get("model-translation").evaluate(e,{},r),n.evaluatedScale=t.paint.get("model-scale").evaluate(e,{},r)}}evaluate(e,t){const i=this.getNodesInfo();for(const r of i){if(!r.node.meshes)continue;const i=r.feature,n=t&&t[i.id];if(Ie(n,r.state))continue;r.state=structuredClone(n);const o=r.node.meshes&&r.node.meshes[0].featureData,s=r.evaluatedColor[2],a=r.evaluatedRMEA[2],l=this.id.canonical;if(r.hasTranslucentParts=!1,o){for(let t=0;t<jv.length;t++){const o=jv[t];o.length&&(i.properties.part=o);const s=e.paint.get("model-color").evaluate(i,n,l).toPremultipliedRenderColor(null),a=e.paint.get("model-color-mix-intensity").evaluate(i,n,l);r.evaluatedColor[t]=[s.r,s.g,s.b,a],r.evaluatedRMEA[t][0]=e.paint.get("model-roughness").evaluate(i,n,l),r.evaluatedRMEA[t][2]=e.paint.get("model-emissive-strength").evaluate(i,n,l),r.evaluatedRMEA[t][3]=s.a,r.emissionHeightBasedParams[t]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(i,n,l),!r.hasTranslucentParts&&s.a<1&&(r.hasTranslucentParts=!0)}delete i.properties.part,Zv(r,s!==r.evaluatedColor[2]||a!==r.evaluatedRMEA[2],this.modelTraits)}else r.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(i,n,l);r.evaluatedTranslation=e.paint.get("model-translation").evaluate(i,n,l),r.evaluatedScale=e.paint.get("model-scale").evaluate(i,n,l),this.updatePbrBuffer(r.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,t,i,r){const n=e.findDEMTileFor(i);if(n&&(n.tileID.canonical!==this.terrainTile||t!==this.terrainExaggeration)){if(n.dem&&n.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=n.tileID.overscaledZ;const t=kv.create(e,i,n);if(!t)return;this.modelTraits&i_.HasMapboxMeshFeatures&&this.updateDEM(e,t,i,r);for(const e of this.getNodesInfo()){const i=e.node;if(!i.footprint||!i.footprint.vertices||!i.footprint.vertices.length)continue;const r=i.footprint.vertices;let n=t.getElevationAt(r[0].x,r[0].y,!0,!0);for(let e=1;e<r.length;e++)n=Math.min(n,t.getElevationAt(r[e].x,r[e].y,!0,!0));i.elevation=n}}this.terrainTile=n.tileID.canonical,this.terrainExaggeration=t}}updateDEM(e,t,i,r){let n=t._dem._modifiedForSources[r];if(void 0===n&&(t._dem._modifiedForSources[r]=[],n=t._dem._modifiedForSources[r]),n.includes(i.canonical))return;const o=t._dem.dim;n.push(i.canonical);let s=!1;for(const a of this.getNodesInfo()){const e=a.node;if(!e.footprint||!e.footprint.grid)continue;const i=e.footprint.grid,r=t.tileCoordToPixel(i.min.x,i.min.y),n=t.tileCoordToPixel(i.max.x,i.max.y),l=Math.min(Math.min(o-n.y,r.x),Math.min(r.y,o-n.x));if(l<0)continue;const c=Oe(l,2,5);
2let h=Math.max(0,r.x-c),u=Math.max(0,r.y-c),d=Math.min(n.x+c,o-1),p=Math.min(n.y+c,o-1);for(let t=u;t<=p;++t)for(let e=h;e<=d;++e)Nv[t*o+e]=255;let f=0,m=0;for(let s=0;s<i.cellsY;++s)for(let e=0;e<i.cellsX;++e){if(!i.cells[s*i.cellsX+e])continue;const r=t.tileCoordToPixel(i.min.x+e/i.xScale,i.min.y+s/i.yScale),n=t.tileCoordToPixel(i.min.x+(e+1)/i.xScale,i.min.y+(s+1)/i.yScale);for(let e=r.y;e<=Math.min(n.y+1,o-1);++e)for(let i=r.x;i<=Math.min(n.x+1,o-1);++i)255===Nv[e*o+i]&&(Nv[e*o+i]=0,f+=t.getElevationAtPixel(i,e),m++)}const _=f/m;h=Math.max(1,r.x-c),u=Math.max(1,r.y-c),d=Math.min(n.x+c,o-2),p=Math.min(n.y+c,o-2),s=!0;for(let s=u;s<=p;++s)for(let e=h;e<=d;++e)0===Nv[s*o+e]&&(Bv[s*o+e]=t._dem.set(e,s,_));for(let s=1;s<c;++s){h=Math.max(1,r.x-s),u=Math.max(1,r.y-s),d=Math.min(n.x+s,o-2),p=Math.min(n.y+s,o-2);for(let e=u;e<=p;++e)for(let i=h;i<=d;++i){const r=e*o+i;if(255===Nv[r]){let n=0,a=0,l=-1,h=-1;for(let t=-1;t<=1;++t)for(let r=-1;r<=1;++r){const c=(e+t)*o+i+r;if(Nv[c]>=s)continue;const u=Bv[c],d=Math.abs(u);d>a&&(n=u,a=d,l=r,h=t)}if(a>.1){const o=1-(s+.5*Math.abs(l*h))/c;let a=t._dem.get(i,e)+n*o;const u=t._dem.get(i+l,e+h),d=t._dem.get(i-l,e-h,!0);(a-u)*(a-d)>0&&(a=(u+d)/2),Bv[r]=t._dem.set(i,e,a),Nv[r]=s}}}}}s&&(t._demTile.needsDEMTextureUpload=!0,t._dem._timestamp=gt.now())}setFilter(e){this.filter=e?ma(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new Js(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const t of e)l_(t.node),h_(t.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const i=t.getReplacementRegionsForTile(e.toUnwrapped());for(const r of this.getNodesInfo()){const e=r.node.footprint;r.hiddenByReplacement=!!e&&!i.find(t=>t.footprint===e)}}getHeightAtTileCoord(e,t){const i=[],r=[0,0,0],n=c([]);for(const o of this.getNodesInfo()){const s=o.node.meshes[0],a=s.transformedAabb;if(e<a.min[0]||t<a.min[1]||e>a.max[0]||t>a.max[1])continue;if(!0===o.node.hidden)return{height:1/0,maxHeight:o.feature.properties.height,hidden:!1,verticalScale:o.evaluatedScale[2]};h(n,o.node.globalMatrix),r[0]=e,r[1]=t,j(r,r,n);const l=(r[0]-s.aabb.min[0])/(s.aabb.max[0]-s.aabb.min[0])*t_|0,c=Math.min(63,(r[1]-s.aabb.min[1])/(s.aabb.max[1]-s.aabb.min[1])*t_|0)*t_+Math.min(63,l),u=s.heightmap[c];if(!(u<0&&o.node.footprint)){if(o.hiddenByReplacement)return;return{height:u,maxHeight:o.feature.properties.height,hidden:!1,verticalScale:o.evaluatedScale[2]}}if(o.node.footprint.grid.query(new Ee(e,t),new Ee(e,t),i),i.length>0)return{height:void 0,maxHeight:o.feature.properties.height,hidden:o.hiddenByReplacement,verticalScale:o.evaluatedScale[2]}}}}function Hv(e,t){return e instanceof qo&&!e.isLightConstant&&t}function $v(e,t,i,r,n,o,s,a){let l=(61440&t|(61440&t)>>4)>>8,c=(3840&t|(3840&t)>>4)>>4,h=240&t|(240&t)>>4;i[3]>0&&(l=pi(l,255*i[0],i[3]),c=pi(c,255*i[1],i[3]),h=pi(h,255*i[2],i[3]));const u=l<<8|c,d=h<<8|Math.floor(255*r[3]),p=function(e){const t=Oe(e,0,2);return Math.min(Math.round(.5*t*255),255)}(r[2])<<8|15*r[0]<<4|15*r[1],f=Oe(n[0],0,1),m=Oe(n[1],0,1),_=Oe(n[2],0,1),g=Oe(n[3],0,1);let y,x,v,b;if(f!==m&&s!==o&&m!==f){const e=s-o;x=1/(e*(m-f)),v=-(o+e*f)/(e*(m-f));const t=Oe(n[4],-1,1);b=Math.pow(10,t),y=255*_<<8|255*g}else y=65535,x=0,v=1,b=1;if(e.emplaceBack(u,d,p,y,x,v,b),a){const e=a.length;a.clear();for(let t=0;t<e;t++)a.emplaceBack(u,d,p,y,x,v,b)}}function Zv(e,t,i){const r=e.node;let n=0;const o=i&i_.HasMeshoptCompression;for(const s of r.meshes){if(r.lights&&r.lightMeshIndex===n)continue;if(!s.featureData)continue;s.featureArray=new vl,s.featureArray.reserve(s.featureData.length);let i=t;for(const t of s.featureData){const n=o?65535&t:t>>16&65535,a=o?t>>16&65535:65535&t,l=(15&a)<8?15&a:0,c=e.evaluatedRMEA[l],h=e.evaluatedColor[l],u=e.emissionHeightBasedParams[l];let d;if(i&&2===l&&r.lights&&(d=new vl,d.resize(10*r.lights.length)),$v(s.featureArray,n,h,c,u,s.aabb.min[2],s.aabb.max[2],d),d&&i){i=!1;const e=r.meshes[r.lightMeshIndex];e.featureArray=d,e.featureArray._trim()}}s.featureArray._trim(),n++}}es(qv,"Tiled3dModelBucket",{omit:["layers"]}),es(Gv,"Tiled3dModelFeature");const Wv=["id","tile","layer","source","sourceLayer","state"];class Xv{constructor(e,t,i,r,n){this.type="Feature",this._vectorTileFeature=e,this._z=t,this._x=i,this._y=r,this.properties=e?e.properties:{},this.id=n}clone(){const e=new Xv(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state=Object.assign({},this.state)),this.layer&&(e.layer=Object.assign({},this.layer)),this.source&&(e.source=this.source),this.sourceLayer&&(e.sourceLayer=this.sourceLayer),e}get geometry(){return void 0===this._geometry&&this._vectorTileFeature&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const t of Wv)void 0!==this[t]&&(e[t]=this[t]);return e}}class Yv extends ni{constructor(e,t,i,r){super(),this.id=e,this.type="model",this.models=[],this._options=t,this._modelsInfo=new Map}loadGLTFFromURI(e){return Lm(this.map._requestManager.transformRequest(e,Ft.Model).url)}load(){for(const e in this._options.models){const t=this._options.models[e],i=this._modelsInfo.get(e);if(i){i.modelSpec=t;const e=i.model;e&&(e.position=null!=t.position?new Cc(t.position[0],t.position[1]):new Cc(0,0),e.orientation=null!=t.orientation?t.orientation:[0,0,0],Yv.applyModelSpecification(e,t),e.computeBoundsAndApplyParent(),this.models.push(e))}else this._modelsInfo.set(e,{modelSpec:t,model:null}),this.loadGLTFFromURI(t.uri).then(t=>{if(!t)return;const i=this._modelsInfo.get(e);if(!i)return;const r=y_(t),n=i.modelSpec,o=new n_(e,n.uri,n.position,n.orientation,r);Yv.applyModelSpecification(o,n),o.computeBoundsAndApplyParent(),this.models.push(o),i.model=o,this.loaded()&&this.fire(new ei("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(i=>{this.fire(new ti(new Error(`Could not load model ${e} from ${t.uri}: ${i.message}`)))})}this.loaded()&&this.fire(new ei("data",{dataType:"source",sourceDataType:"metadata"}))}static applyModelSpecification(e,t){t.nodeOverrides&&Yv.convertNodeOverrides(e,t.n
vendor: 4,829 bytes, line 2
2odeOverrides),t.materialOverrides&&Yv.convertMaterialOverrides(e,t.materialOverrides),t.nodeOverrideNames&&(e.nodeOverrideNames=[...t.nodeOverrideNames]),t.materialOverrideNames&&(e.materialOverrideNames=[...t.materialOverrideNames]),t.featureProperties&&(e.featureProperties=t.featureProperties)}static convertNodeOverrides(e,t){if(Array.isArray(t)&&t.every(e=>"string"==typeof e)){e.nodeOverrideNames=[];for(const i of t)e.nodeOverrideNames.push(i)}else Object.entries(t).forEach(([t,i])=>{const r={orientation:[0,0,0]};if(i.hasOwnProperty("orientation")){const e=i.orientation;e&&(r.orientation=e)}e.nodeOverrides.set(t,r)})}static convertMaterialOverrides(e,t){if(Array.isArray(t)&&t.every(e=>"string"==typeof e)){e.materialOverrideNames=[];for(const i of t)e.materialOverrideNames.push(i)}else Object.entries(t).forEach(([t,i])=>{const r={color:new ci(1,1,1),colorMix:0,emissionStrength:0,opacity:1},n=i["model-color"];void 0!==n&&(r.color.r=n[0],r.color.g=n[1],r.color.b=n[2]);const o=i["model-color-mix-intensity"];void 0!==o&&(r.colorMix=o);const s=i["model-emissive-strength"];void 0!==s&&(r.emissionStrength=s);const a=i["model-opacity"];void 0!==a&&(r.opacity=a),e.materialOverrides.set(t,r)})}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){if(0===this._modelsInfo.size)return!0;for(const e of this._modelsInfo.values())if(null==e.model)return!1;return!0}getModels(){return this.models}loadTile(e,t){}serialize(){return this._options}setProperty(e,t){return!1}reload(){const e=Ma(this.id,this.scope);this.map.style.clearSource(e),this.models=[],this._modelsInfo.clear(),this.load()}setModels(e){this.models=[];const t=new Map;for(const i in e){const r=e[i];if(this._modelsInfo.has(i)){const e=this._modelsInfo.get(i);e&&e.modelSpec.uri===r.uri&&t.set(i,e)}}this._modelsInfo=t,this._options.models=e,this.load()}}function Kv(e,t,i,r){const n=1<<e.z;t.lat=Fc((r/Ur+e.y)/n),t.lng=Oc((i/Ur+e.x)/n)}function Jv(e,t,i,r){const n=e.getNodesInfo()[t];if(!n||n.hiddenByReplacement||!n.node.meshes)return;let o=Number.MAX_VALUE;const s=n.node,a=i.tile,l=r.calculatePosMatrix(a.tileID.toUnwrapped(),r.worldSize),c=n.evaluatedScale;let h=0;r.elevation&&s.elevation&&(h=s.elevation*r.elevation.exaggeration()),d(l,l,[(s.anchor?s.anchor[0]:0)*(c[0]-1),(s.anchor?s.anchor[1]:0)*(c[1]-1),h]),p(l,l,c);const f=i.queryGeometry,m=f.isPointQuery()?f.screenBounds:f.screenGeometry,_=function(e){const t=u([],l,e.globalMatrix);u(t,r.expandedFarZProjMatrix,t);for(let i=0;i<e.meshes.length;++i){const n=e.meshes[i];if(i===e.lightMeshIndex)continue;const s=e_(m,r,t,n.aabb);null!=s&&(o=Math.min(s,o))}if(e.children)for(const i of e.children)_(i)};if(_(s),o===Number.MAX_VALUE)return;const g=new Cc(0,0);return Kv(a.tileID.canonical,g,n.node.anchor[0],n.node.anchor[1]),{intersectionZ:o,position:g,feature:n.feature}}const Qv={circle:class extends Da{constructor(e,t,i,r){super(e,{layout:Zh||(Zh=new ha({"circle-sort-key":new la(ua.layout_circle["circle-sort-key"]),"circle-elevation-reference":new aa(ua.layout_circle["circle-elevation-reference"]),visibility:new aa(ua.layout_circle.visibility)})),paint:Wh||(Wh=new ha({"circle-radius":new la(ua.paint_circle["circle-radius"]),"circle-color":new la(ua.paint_circle["circle-color"]),"circle-blur":new la(ua.paint_circle["circle-blur"]),"circle-opacity":new la(ua.paint_circle["circle-opacity"]),"circle-translate":new aa(ua.paint_circle["circle-translate"]),"circle-translate-anchor":new aa(ua.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new aa(ua.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new aa(ua.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new la(ua.paint_circle["circle-stroke-width"]),"circle-stroke-color":new la(ua.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new la(ua.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new aa(ua.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r)}createBucket(e){return new Ih(e)}queryRadius(e){const t=e;return Gh("circle-radius",this,t)+Gh("circle-stroke-width",this,t)+qh(this.paint.get("circle-translate"))}queryIntersectsFeature(e,t,i,r,n,o,s,a){const l=$h(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),c=this.paint.get("circle-radius").evaluate(t,i)+this.paint.get("circle-stroke-width").evaluate(t,i);return zu(e,r,o,s,a,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),l,c)}getProgramIds(){return["circle"]}getDefaultProgramParams(e,t,i){const r=Ru(this);return{config:new pc(this,{zoom:t,lut:i}),defines:r,overrideFog:!1}}
vendor: 18,922 bytes, line 2
2is3D(e){return!e&&!!this.layout&&"none"!==this.layout.get("circle-elevation-reference")}hasElevation(){return this.layout&&"none"!==this.layout.get("circle-elevation-reference")}},heatmap:class extends Da{createBucket(e){return new ku(e)}constructor(e,t,i,r){super(e,{layout:Bu||(Bu=new ha({visibility:new aa(ua.layout_heatmap.visibility)})),paint:Nu||(Nu=new ha({"heatmap-radius":new la(ua.paint_heatmap["heatmap-radius"]),"heatmap-weight":new la(ua.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new aa(ua.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ca(ua.paint_heatmap["heatmap-color"]),"heatmap-opacity":new aa(ua.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Wu({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)}_clear(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}queryRadius(e){return Gh("heatmap-radius",this,e)}queryIntersectsFeature(e,t,i,r,n,o,s,a){const l=this.paint.get("heatmap-radius").evaluate(t,i);return zu(e,r,o,s,a,!0,!0,new Ee(0,0),l)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(e,t,i){return"heatmap"===e?{config:new pc(this,{zoom:t,lut:i}),overrideFog:!1}:{}}},hillshade:class extends Da{constructor(e,t,i,r){super(e,{layout:Vu||(Vu=new ha({visibility:new aa(ua.layout_hillshade.visibility)})),paint:Uu||(Uu=new ha({"hillshade-illumination-direction":new aa(ua.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new aa(ua.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new aa(ua.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new aa(ua.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new aa(ua.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new aa(ua.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new aa(ua.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r)}shouldRedrape(){return this.hasOffscreenPass()&&"viewport"===this.paint.get("hillshade-illumination-anchor")}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(e,t,i){return{overrideFog:!1}}},fill:class extends Da{constructor(e,t,i,r){super(e,{layout:vp||(vp=new ha({"fill-sort-key":new la(ua.layout_fill["fill-sort-key"]),visibility:new aa(ua.layout_fill.visibility),"fill-elevation-reference":new aa(ua.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new la(ua.layout_fill["fill-construct-bridge-guard-rail"])})),paint:bp||(bp=new ha({"fill-antialias":new aa(ua.paint_fill["fill-antialias"]),"fill-opacity":new la(ua.paint_fill["fill-opacity"]),"fill-color":new la(ua.paint_fill["fill-color"]),"fill-outline-color":new la(ua.paint_fill["fill-outline-color"]),"fill-translate":new aa(ua.paint_fill["fill-translate"]),"fill-translate-anchor":new aa(ua.paint_fill["fill-translate-anchor"]),"fill-pattern":new la(ua.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new aa(ua.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new aa(ua.paint_fill["fill-emissive-strength"]),"fill-z-offset":new la(ua.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new la(ua.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new la(ua.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r)}getProgramIds(){const e=this.paint.get("fill-pattern"),t=e&&e.constantOr(1),i=[t?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(t&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(e,t,i){return{config:new pc(this,{zoom:t,lut:i}),overrideFog:!1}}recalculate(e,t){super.recalculate(e,t);const i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new xp(e)}queryRadius(){return qh(this.paint.get("fill-translate"))}queryIntersectsFeature(e,t,i,r,n,o){return!e.queryGeometry.isAboveHorizon&&Ch(Hh(e.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),r)}isTileClipped(){return 0===this.paint.get("fill-z-offset").constantOr(1)}is3D(e){if(0!==this.paint.get("fill-z-offset").constantOr(1))return!0;const t=this.layout&&"none"!==this.layout.get("fill-elevation-reference");return null!=e?t&&!e:t}hasElevation(){return this.layout&&"none"!==this.layout.get("fill-elevation-reference")}hasShadowPass(){return this.layout&&"none"!==this.layout.get("fill-elevation-reference")}},"fill-extrusion":class extends Da{constructor(e,t,i,r){super(e,{layout:Af||(Af=new ha({visibility:new aa(ua["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new aa(ua["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:Mf||(Mf=new ha({"fill-extrusion-opacity":new aa(ua["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new la(ua["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new aa(ua["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new aa(ua["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new la(ua["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new aa(ua["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new la(ua["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new la(ua["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new aa(ua["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new aa(ua["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new aa(ua["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new aa(ua["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new aa(ua["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new aa(ua["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new aa(ua["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new aa(ua["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new aa(ua["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new aa(ua["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new la(ua["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new la(ua["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new aa(ua["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new aa(ua["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new aa(ua["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new aa(ua["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new la(ua["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new la(ua["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new aa(ua["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new mf(e)}queryRadius(){return qh(this.paint.get("fill-extrusion-translate"))}is3D(e){return!0}hasShadowPass(){return this.paint.get("fill-extrusion-cast-shadows")}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(e,t,i,r,n,o,s,a,l){const c=$h(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),h=this.paint.get("fill-extrusion-height").evaluate(t,i),u=this.paint.get("fill-extrusion-base").evaluate(t,i),d=[0,0],p=a&&o.elevation,f=o.elevation?o.elevation.exaggeration():1,m=e.tile.getBucket(this);if(p&&m instanceof mf){const e=m.centroidVertexArray,t=l+1;t<e.length&&(d[0]=e.geta_centroid_pos0(t),d[1]=e.geta_centroid_pos1(t))}if(0===d[0]&&1===d[1])return!1;"globe"===o.projection.name&&(r=Ef([r],[new Ee(0,0),new Ee(Ur,Ur)],e.tileID.canonical).map(e=>e.polygon).flat());const _=p?a:null,[g,y]=Nf(o,r,u,h,c,s,_,d,f,o.center.lat,e.tileID.canonical),x=e.queryGeometry;return Bf(g,y,x.isPointQuery()?x.screenBounds:x.screenGeometry)}},building:class extends Da{constructor(e,t,i,r){super(e,{layout:V_||(V_=new ha({visibility:new aa(ua.layout_building.visibility),"building-facade":new la(ua.layout_building["building-facade"]),"building-facade-floors":new la(ua.layout_building["building-facade-floors"]),"building-facade-unit-width":new la(ua.layout_building["building-facade-unit-width"]),"building-facade-window":new la(ua.layout_building["building-facade-window"]),"building-roof-shape":new la(ua.layout_building["building-roof-shape"]),"building-height":new la(ua.layout_building["building-height"]),"building-base":new la(ua.layout_building["building-base"]),"building-flood-light-wall-radius":new la(ua.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new la(ua.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new la(ua.layout_building["building-flip-roof-orientation"])})),paint:U_||(U_=new ha({"building-opacity":new aa(ua.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new aa(ua.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new aa(ua.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new aa(ua.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new aa(ua.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new aa(ua.paint_building["building-vertical-scale"]),"building-cast-shadows":new aa(ua.paint_building["building-cast-shadows"]),"building-color":new la(ua.paint_building["building-color"]),"building-emissive-strength":new la(ua.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new aa(ua.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new aa(ua.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new aa(ua.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new aa(ua.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new aa(ua.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new k_(e)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(e){return!0}queryRadius(e){return 0}queryIntersectsFeature(e,t,i,r,n,o,s,a,l,c){let h=this.layout.get("building-height").evaluate(t,i);const u=this.layout.get("building-base").evaluate(t,i),d=e.tile.getBucket(this).getFootprint(t);if(d){if(0!==d.hiddenFlags)return!1;h=d.height}const[p,f]=Nf(o,r,u,h,new Ee(0,0),s,null,[0,0],1,o.center.lat,e.tileID.canonical),m=e.queryGeometry;return Bf(p,f,m.isPointQuery()?m.screenBounds:m.screenGeometry)}},line:class extends Da{constructor(e,t,i,r){const n=hg();super(e,n,t,i,r),n.layout&&(this.layout=new sa(n.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof Mn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}emissiveStrengthExpression(){return this._transitionablePaint._values["line-emissive-strength"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=(()=>{if(dg)return dg;const e=hg();return dg=new ug(e.paint.properties["line-width"].specification),dg.useIntegerZoom=!0,dg})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Q_(e)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(e,t,i){const r=ag(this);return{config:new pc(this,{zoom:t,lut:i}),defines:r,overrideFog:!1}}queryRadius(e){const t=e,i=pg(Gh("line-width",this,t),Gh("line-gap-width",this,t)),r=Gh("line-offset",this,t);return i/2+Math.abs(r)+qh(this.paint.get("line-translate"))}queryIntersectsFeature(e,t,i,r,n,o){if(e.queryGeometry.isAboveHorizon)return!1;const s=Hh(e.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),a=e.pixelToTileUnitsFactor/2*pg(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),l=this.paint.get("line-offset").evaluate(t,i);return l&&(r=function(e,t){const i=[],r=new Ee(0,0);for(let n=0;n<e.length;n++){const o=e[n],s=[];for(let e=0;e<o.length;e++){const i=o[e],n=o[e+1],a=0===e?r:i.sub(o[e-1])._unit()._perp(),l=e===o.length-1?r:n.sub(i)._unit()._perp(),c=a._add(l)._unit();c._mult(1/(c.x*l.x+c.y*l.y)),s.push(c._mult(t)._add(i))}i.push(s)}return i}(r,l*e.pixelToTileUnitsFactor)),function(e,t,i){for(let r=0;r<t.length;r++){const n=t[r];if(e.length>=3)for(let t=0;t<n.length;t++)if(Bh(e,n[t]))return!0;if(Ph(e,n,i))return!0}return!1}(s,r,a)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(e){return!this.hasElevatedBuckets||this.layout&&"hd-road-markup"===this.layout.get("line-elevation-reference")}hasElevation(){return this.layout&&"none"!==this.layout.get("line-elevation-reference")}},symbol:lv,background:class extends Da{constructor(e,t,i,r){super(e,{layout:cv||(cv=new ha({visibility:new aa(ua.layout_background.visibility)})),paint:hv||(hv=new ha({"background-pitch-alignment":new aa(ua.paint_background["background-pitch-alignment"]),"background-color":new aa(ua.paint_background["background-color"]),"background-pattern":new aa(ua.paint_background["background-pattern"]),"background-opacity":new aa(ua.paint_background["background-opacity"]),"background-emissive-strength":new aa(ua.paint_background["background-emissive-strength"]),"background-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(e,t,i){return{overrideFog:!1}}is3D(e){return"viewport"===this.paint.get("background-pitch-alignment")}},raster:vv,"raster-particle":Iv,sky:class extends Da{constructor(e,t,i,r){super(e,{layout:Tv||(Tv=new ha({visibility:new aa(ua.layout_sky.visibility)})),paint:Sv||(Sv=new ha({"sky-type":new aa(ua.paint_sky["sky-type"]),"sky-atmosphere-sun":new aa(ua.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new aa(ua.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new aa(ua.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new aa(ua.paint_sky["sky-gradient-radius"]),"sky-gradient":new ca(ua.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new aa(ua.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new aa(ua.paint_sky["sky-atmosphere-color"]),"sky-opacity":new aa(ua.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new la({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvalidated=!0}_handleSpecialPaintPropertyUpdate(e){"sky-gradient"===e?this._updateColorRamp():"sky-atmosphere-sun"!==e&&"sky-atmosphere-halo-color"!==e&&"sky-atmosphere-color"!==e&&"sky-atmosphere-sun-intensity"!==e||(this._skyboxInvali
vendor: 5,946 bytes, line 2
2dated=!0)}_updateColorRamp(){this.colorRamp=Wu({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(e){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const t=e.style.light.properties.get("position");return this._lightPosition.azimuthal!==t.azimuthal||this._lightPosition.polar!==t.polar}return!1}getCenter(e,t){if("atmosphere"===this.paint.get("sky-type")){const i=this.paint.get("sky-atmosphere-sun"),r=!i,n=e.style.light,o=n.properties.get("position");return r&&"viewport"===n.properties.get("anchor")&&We("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),r?Mv(o.azimuthal,90-o.polar,t):Mv(i[0],90-i[1],t)}const i=this.paint.get("sky-gradient-center");return Mv(i[0],90-i[1],t)}isSky(){return!0}markSkyboxValid(e){this._skyboxInvalidated=!1,this._lightPosition=e.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const e=this.paint.get("sky-type");return"atmosphere"===e?["skyboxCapture","skybox"]:"gradient"===e?["skyboxGradient"]:null}},slot:class extends Da{constructor(e,t,i,r){super(e,{paint:Ev||(Ev=new ha({}))},t,null)}},model:class extends Da{constructor(e,t,i,r){super(e,{layout:Ov||(Ov=new ha({visibility:new aa(ua.layout_model.visibility),"model-id":new la(ua.layout_model["model-id"]),"model-allow-density-reduction":new aa(ua.layout_model["model-allow-density-reduction"])})),paint:Fv||(Fv=new ha({"model-opacity":new la(ua.paint_model["model-opacity"]),"model-rotation":new la(ua.paint_model["model-rotation"]),"model-scale":new la(ua.paint_model["model-scale"]),"model-translation":new la(ua.paint_model["model-translation"]),"model-color":new la(ua.paint_model["model-color"]),"model-color-mix-intensity":new la(ua.paint_model["model-color-mix-intensity"]),"model-type":new aa(ua.paint_model["model-type"]),"model-cast-shadows":new aa(ua.paint_model["model-cast-shadows"]),"model-receive-shadows":new aa(ua.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new aa(ua.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new la(ua.paint_model["model-emissive-strength"]),"model-roughness":new la(ua.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new la(ua.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new aa(ua.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new aa(ua.paint_model["model-front-cutoff"]),"model-elevation-reference":new aa(ua.paint_model["model-elevation-reference"]),"model-color-use-theme":new la({type:"string",default:"default","property-type":"data-driven"})}))},t,i,r),this.layer=e,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new Dv(e)}getProgramIds(){return["model"]}is3D(e){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(e){return e instanceof qv?8191:0}queryRenderedFeatures(e,t,i){const r=t.getSource();if(!(r&&r instanceof Yv))return{};const n=r,o={};o[this.id]=[];const s=o[this.id];let a=0;for(const l of n.models){const r=t.getFeatureState(this.sourceLayer,l.id),n={type:"Unknown",id:l.id,properties:l.featureProperties},o=this.paint.get("model-rotation").evaluate(n,r),c=this.paint.get("model-scale").evaluate(n,r),h=this.paint.get("model-translation").evaluate(n,r),d=this.paint.get("model-elevation-reference");let p=[];r_(p,l,i,l.position,o,c,h,"ground"===d,"ground"===d,!1),"globe"===i.projection.name&&(p=Qm(p,i));const f=u([],i.projMatrix,p),m=e_(e.isPointQuery()?e.screenBounds:e.screenGeometry,i,f,l.aabb);if(null!=m){const e=new Xv(void 0,0,0,0,l.id);e.layer=this.layer,e.properties=structuredClone(l.featureProperties),e.properties.layer=this.id,e.properties.uri=l.uri,e.properties.orientation=l.orientation,e.sourceLayer=this.sourceLayer,e.geometry={type:"Point",coordinates:[l.position.lng,l.position.lat]},e.state=r,e.source=this.source,s.push({featureIndex:a,feature:e,intersectionZ:m})}++a}return o}queryIntersectsFeature(e,t,i,r,n,o,s,a,l,c){if(!this.modelManager)return!1;const h=this.modelManager,d=e.tile.getBucket(this);if(!(d&&d instanceof Dv))return!1;for(const p in d.instancesPerModel){const i=d.instancesPerModel[p],r=void 0!==t.id?t.id:t.properties&&t.properties.hasOwnProperty("id")?t.properties.id:void 0;if(i.idToFeaturesIndex.hasOwnProperty(r)){const t=i.features[i.idToFeaturesIndex[r]],n=h.getModel(p,c||this.scope);if(!n)return!1;let s=[];const a=new Cc(0,0),l=d.canonical;let f=Number.MAX_VALUE;for(let r=0;r<t.instancedDataCount;++r){const c=16*(t.instancedDataOffset+r),h=i.instancedDataArray.float32,d=[h[c+4],h[c+5],h[c+6]];Kv(l,a,Math.floor(h[c]),Math.floor(h[c+1])),r_(s,n,o,a,t.rotation,t.scale,d,!1,!1,!1),"globe"===o.projection.name&&(s=Qm(s,o));const p=u([],o.projMatrix,s),m=e.queryGeometry,_=e_(m.isPointQuery()?m.screenBounds:m.screenGeometry,o,p,n.aabb);null!=_&&(f=Math.min(_,f))}return f!==Number.MAX_VALUE&&f}}return!1}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven()||"model-color"!==e&&"model-color-mix-intensity"!==e&&"model-rotation"!==e&&"model-scale"!==e&&"model-translation"!==e&&"model-emissive-strength"!==e)}_isPropertyZoomDependent(e){const t=this._transitionablePaint._values[e];return null!=t&&null!=t.value&&null!=t.value.expression&&t.value.expression instanceof Ho}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends Da{constructor(e,t,i,r){super(e,{layout:wp||(wp=new ha({"clip-layer-types":ne
2w aa(ua.layout_clip["clip-layer-types"]),"clip-layer-scope":new aa(ua.layout_clip["clip-layer-scope"]),visibility:new aa(ua.layout_clip.visibility)})),paint:Tp||(Tp=new ha({}))},t,i,r)}recalculate(e,t){super.recalculate(e,t)}createBucket(e){return new Ip(e)}is3D(e){return!0}}},eb=new ci(0,0,0);function tb(e,t,i){1===e&&t.icons.push(function(e,t){return function(e){if(e.usvg_tree.height||(e.usvg_tree.height=e.usvg_tree.width),!e.metadata)return e;const{metadata:t}=e;if(t.content_area){const{content_area:i}=t;null==i.left&&(i.left=0),null==i.top&&(i.top=i.left),null==i.width&&(i.width=e.usvg_tree.width),null==i.height&&(i.height=i.width)}if(t.text_placeholder){const{text_placeholder:e}=t;null==e.top&&(e.top=e.left),null==e.height&&(e.height=e.width)}return t.stretch_x&&t.stretch_x.length&&ib(t,"x"),t.stretch_y&&t.stretch_y.length&&ib(t,"y"),e}(e.readFields(rb,{name:void 0},t))}(i,i.readVarint()+i.pos))}function ib(e,t){const i=[],r=e[`stretch_${t}`];let n=null;for(let o=0;o<r.length;o++)null===n?n=0===i.length?r[0]:i[i.length-1][1]+r[o]:(i.push([n,n+r[o]]),n=null);e[`stretch_${t}_areas`]=i}function rb(e,t,i){1===e?t.name=i.readString():2===e?t.metadata=function(e,t){return e.readFields(nb,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},t)}(i,i.readVarint()+i.pos):3===e&&(t.usvg_tree=function(e,t){return e.readFields(lb,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},t)}(i,i.readVarint()+i.pos),t.data="usvg_tree")}function nb(e,t,i){1===e?t.stretch_x=i.readPackedVarint():2===e?t.stretch_y=i.readPackedVarint():3===e?t.content_area=ob(i,i.readVarint()+i.pos):4===e?t.variables.push(function(e,t){return e.readFields(ab,{name:void 0},t)}(i,i.readVarint()+i.pos)):5===e&&(t.text_placeholder=ob(i,i.readVarint()+i.pos))}function ob(e,t){return e.readFields(sb,{},t)}function sb(e,t,i){1===e?t.left=i.readVarint():2===e?t.width=i.readVarint():3===e?t.top=i.readVarint():4===e&&(t.height=i.readVarint())}function ab(e,t,i){1===e?t.name=i.readString():2===e&&(t.rgb_color=_b(i.readVarint()),t.value="rgb_color")}function lb(e,t,i){1===e?t.width=t.height=i.readVarint():2===e?t.height=i.readVarint():3===e?t.children.push(cb(i,i.readVarint()+i.pos)):4===e?t.linear_gradients.push(function(e,t){return e.readFields(yb,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},t)}(i,i.readVarint()+i.pos)):5===e?t.radial_gradients.push(function(e,t){return e.readFields(bb,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},t)}(i,i.readVarint()+i.pos)):7===e?t.clip_paths.push(function(e,t){return e.readFields(wb,{children:[]},t)}(i,i.readVarint()+i.pos)):8===e&&t.masks.push(function(e,t){const i=e.readFields(Tb,{left:0,width:20,mask_type:1,children:[]},t);return null==i.height&&(i.height=i.width),null==i.top&&(i.top=i.left),i}(i,i.readVarint()+i.pos))}function cb(e,t){return e.readFields(hb,{},t)}function hb(e,t,i){1===e?(t.group=function(e,t){return e.readFields(ub,{opacity:255,children:[]},t)}(i,i.readVarint()+i.pos),t.node="group"):2===e&&(t.path=function(e,t){return e.readFields(fb,{paint_order:1,commands:[],step:1,diffs:[],rule:1},t)}(i,i.readVarint()+i.pos),t.node="path")}function ub(e,t,i){1===e?t.transform=db(i,i.readVarint()+i.pos):2===e?t.opacity=i.readVarint():5===e?t.clip_path_idx=i.readVarint():6===e?t.mask_idx=i.readVarint():7===e&&t.children.push(cb(i,i.readVarint()+i.pos))}function db(e,t){return e.readFields(pb,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},t)}function pb(e,t,i){1===e?t.sx=i.readFloat():2===e?t.ky=i.readFloat():3===e?t.kx=i.readFloat():4===e?t.sy=i.readFloat():5===e?t.tx=i.readFloat():6===e&&(t.ty=i.readFloat())}function fb(e,t,i){1===e?t.fill=function(e,t){return e.readFields(mb,{rgb_color:eb,paint:"rgb_color",opacity:255},t)}(i,i.readVarint()+i.pos):2===e?t.stroke=function(e,t){return e.readFields(gb,{rgb_color:eb,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},t)}(i,i.readVarint()+i.pos):3===e?t.paint_order=i.readVarint():5===e?i.readPackedVarint(t.commands):6===e?t.step=i.readFloat():7===e?i.readPackedSVarint(t.diffs):8===e&&(t.rule=i.readVarint())}function mb(e,t,i){1===e?(t.rgb_color=_b(i.readVarint()),t.paint="rgb_color"):2===e?(t.linear_gradient_idx=i.readVarint(),t.paint="linear_gradient_idx"):3===e?(t.radial_gradient_idx=i.readVarint(),t.paint="radial_gradient_idx"):5===e&&(t.opacity=i.readVarint())}function _b(e){return new ci((e>>16&255)/255,(e>>8&255)/255,(255&e)/255,1)}function gb(e,t,i){1===e?(t.rgb_color=_b(i.readVarint()),t.paint="rgb_color"):2===e?(t.linear_gradient_idx=i.readVarint(),t.paint="linear_gradient_idx"):3===e?(t.radial_gradient_idx=i.readVarint(),t.paint="radial_gradient_idx"):5===e?i.readPackedFloat(t.dasharray):6===e?t.dash
2offset=i.readFloat():7===e?t.miterlimit=i.readFloat():8===e?t.opacity=i.readVarint():9===e?t.width=i.readFloat():10===e?t.linecap=i.readVarint():11===e&&(t.linejoin=i.readVarint())}function yb(e,t,i){1===e?t.transform=db(i,i.readVarint()+i.pos):2===e?t.spread_method=i.readVarint():3===e?t.stops.push(xb(i,i.readVarint()+i.pos)):4===e?t.x1=i.readFloat():5===e?t.y1=i.readFloat():6===e?t.x2=i.readFloat():7===e&&(t.y2=i.readFloat())}function xb(e,t){return e.readFields(vb,{offset:0,opacity:255,rgb_color:eb},t)}function vb(e,t,i){1===e?t.offset=i.readFloat():2===e?t.opacity=i.readVarint():3===e&&(t.rgb_color=_b(i.readVarint()))}function bb(e,t,i){1===e?t.transform=db(i,i.readVarint()+i.pos):2===e?t.spread_method=i.readVarint():3===e?t.stops.push(xb(i,i.readVarint()+i.pos)):4===e?t.cx=i.readFloat():5===e?t.cy=i.readFloat():6===e?t.r=i.readFloat():7===e?t.fx=i.readFloat():8===e?t.fy=i.readFloat():9===e&&(t.fr=i.readFloat())}function wb(e,t,i){1===e?t.transform=db(i,i.readVarint()+i.pos):2===e?t.clip_path_idx=i.readVarint():3===e&&t.children.push(cb(i,i.readVarint()+i.pos))}function Tb(e,t,i){1===e?t.left=t.top=i.readFloat():2===e?t.width=t.height=i.readFloat():3===e?t.top=i.readFloat():4===e?t.height=i.readFloat():5===e?t.mask_type=i.readVarint():6===e?t.mask_idx=i.readVarint():7===e&&t.children.push(cb(i,i.readVarint()+i.pos))}class Sb{static calculate(e={},t=[]){const i=new Map,r=new Map;if(0===Object.keys(e).length)return i;t.forEach(e=>{r.set(e.name,e.rgb_color||new ci(0,0,0))});for(const[n,o]of Object.entries(e))r.has(n)?i.set(r.get(n).toString(),o):console.warn(`Ignoring unknown image variable "${n}"`);return i}}
vendor: 32,479 bytes, line 2
2function Eb(e,t=255,i){const r=t/255,n=e.toString(),o=i.has(n)?i.get(n).clone():e.clone();return o.a*=r,o.toString()}function Ib(e,t){if(!_t()){const i=document.createElement("canvas");return i.width=e,i.height=t,i}return new OffscreenCanvas(e,t)}let Ab,Mb=null;function Cb(e,t,i,r,n){for(const o of r.children)Pb(e,t,i,o,n)}function Pb(e,t,i,r,n){r.group?(e.save(),function(e,t,i,r,n){const o=null!=r.mask_idx?i.masks[r.mask_idx]:null,s=null!=r.clip_path_idx?i.clip_paths[r.clip_path_idx]:null;if(r.transform&&(t=Nb(r.transform).preMultiplySelf(t)),!function(e,t,i){return 255!==e.opacity||t||i}(r,null!=s,null!=o))return void Cb(e,t,i,r,n);const a=Ib(e.canvas.width,e.canvas.height),l=a.getContext("2d");Cb(l,t,i,r,n),s&&kb(l,t,i,s),o&&Bb(l,t,i,o,n),e.globalAlpha=r.opacity/255,e.drawImage(a,0,0)}(e,t,i,r.group,n),e.restore()):r.path&&(e.save(),function(e,t,i,r,n){e.setTransform(t),1===r.paint_order?(Rb(e,i,r,n),Lb(e,i,r,n)):(Lb(e,i,r,n),Rb(e,i,r,n))}(e,t,i,r.path,n),e.restore())}function Rb(e,t,i,r){const n=i.fill;if(!n)return;const o=n.opacity/255;switch(e.save(),e.beginPath(),Vb(i,e),n.paint){case"rgb_color":e.fillStyle=Eb(n.rgb_color,n.opacity,r);break;case"linear_gradient_idx":{const i=t.linear_gradients[n.linear_gradient_idx];i.transform&&e.setTransform(Nb(i.transform).preMultiplySelf(e.getTransform())),e.fillStyle=Db(e,i,o,r);break}case"radial_gradient_idx":{const i=t.radial_gradients[n.radial_gradient_idx];i.transform&&e.setTransform(Nb(i.transform).preMultiplySelf(e.getTransform())),e.fillStyle=Ob(e,i,o,r)}}e.fill(zb(i)),e.restore()}function zb(e){return 1===e.rule?"nonzero":2===e.rule?"evenodd":void 0}function Lb(e,t,i,r){const n=i.stroke;if(!n)return;const o=Ub(i);e.lineWidth=n.width,e.miterLimit=n.miterlimit,e.setLineDash(n.dasharray),e.lineDashOffset=n.dashoffset;const s=n.opacity/255;switch(n.paint){case"rgb_color":e.strokeStyle=Eb(n.rgb_color,n.opacity,r);break;case"linear_gradient_idx":e.strokeStyle=Db(e,t.linear_gradients[n.linear_gradient_idx],s,r,!0);break;case"radial_gradient_idx":e.strokeStyle=Ob(e,t.radial_gradients[n.radial_gradient_idx],s,r,!0)}switch(n.linejoin){case 2:case 1:e.lineJoin="miter";break;case 3:e.lineJoin="round";break;case 4:e.lineJoin="bevel"}switch(n.linecap){case 1:e.lineCap="butt";break;case 2:e.lineCap="round";break;case 3:e.lineCap="square"}e.stroke(o)}function Db(e,t,i,r,n=!1){if(1===t.stops.length){const e=t.stops[0];return Eb(e.rgb_color,e.opacity*i,r)}const{x1:o,y1:s,x2:a,y2:l}=t;let c=new DOMPoint(o,s),h=new DOMPoint(a,l);if(n){const e=Nb(t.transform);c=e.transformPoint(c),h=e.transformPoint(h)}const u=e.createLinearGradient(c.x,c.y,h.x,h.y);for(const d of t.stops)u.addColorStop(d.offset,Eb(d.rgb_color,d.opacity*i,r));return u}function Ob(e,t,i,r,n=!1){if(1===t.stops.length){const e=t.stops[0];return Eb(e.rgb_color,e.opacity*i,r)}const o=Nb(t.transform),{fx:s,fy:a,fr:l,cx:c,cy:h,r:u}=t;let d=new DOMPoint(s,a),p=new DOMPoint(c,h),f=l,m=u;if(n){d=o.transformPoint(d),p=o.transformPoint(p);const e=(o.a+o.d)/2;f=l*e,m=t.r*e}const _=e.createRadialGradient(d.x,d.y,f,p.x,p.y,m);for(const g of t.stops)_.addColorStop(g.offset,Eb(g.rgb_color,g.opacity*i,r));return _}function Fb(e,t,i,r){const n=r.transform?Nb(r.transform).preMultiplySelf(t):t,o=Ib(e.canvas.width,e.canvas.height),s=o.getContext("2d");for(const l of r.children)if(l.group)Fb(s,n,i,l.group);else if(l.path){const e=l.path,t=new Path2D;t.addPath(Ub(e),n),s.fill(t,zb(e))}const a=null!=r.clip_path_idx?i.clip_paths[r.clip_path_idx]:null;a&&kb(s,n,i,a),e.globalCompositeOperation="source-over",e.drawImage(o,0,0)}function kb(e,t,i,r){const n=Ib(e.canvas.width,e.canvas.height);Fb(n.getContext("2d"),t,i,r),e.globalCompositeOperation="destination-in",e.drawImage(n,0,0)}function Bb(e,t,i,r,n){if(0===r.children.length)return;const o=null!=r.mask_idx?i.masks[r.mask_idx]:null;o&&Bb(e,t,i,o,n);const s=e.canvas.width,a=e.canvas.height,l=Ib(s,a),c=l.getContext("2d"),h=r.width,u=r.height,d=r.left,p=r.top,f=new Path2D,m=new Path2D;m.rect(d,p,h,u),f.addPath(m,t),c.clip(f);for(const y of r.children)Pb(c,t,i,y,n);const _=c.getImageData(0,0,s,a),g=_.data;if(1===r.mask_type)for(let y=0;y<g.length;y+=4)g[y+3]=g[y+3]/255*(.2126*g[y]+.7152*g[y+1]+.0722*g[y+2]);c.putImageData(_,0,0),e.globalCompositeOperation="destination-in",e.drawImage(l,0,0)}function Nb(e){return e?new DOMMatrix([e.sx,e.ky,e.kx,e.sy,e.tx,e.ty]):new DOMMatrix}function Vb(e,t){const i=e.step;let r=e.diffs[0]*i,n=e.diffs[1]*i;t.moveTo(r,n);for(let o=0,s=2;o<e.commands.length;o++)switch(e.commands[o]){case 1:r+=e.diffs[s++]*i,n+=e.diffs[s++]*i,t.moveTo(r,n);break;case 2:r+=e.diffs[s++]*i,n+=e.diffs[s++]*i,t.lineTo(r,n);break;case 3:{const o=r+e.diffs[s++]*i,a=n+e.diffs[s++]*i;r=o+e.diffs[s++]*i,n=a+e.diffs[s++]*i,t.quadraticCurveTo(o,a,r,n);break}case 4:{const o=r+e.diffs[s++]*i,a=n+e.diffs[s++]*i,l=o+e.diffs[s++]*i,c=a+e.diffs[s++]*i;r=l+e.diffs[s++]*i,n=c+e.diffs[s++]*i,t.bezierCurveTo(o,a,l,c,r,n);break}case 5:t.closePath();break;default:jb()}return t}function Ub(e){return Vb(e,new Path2D)}function jb(e,t){}class Gb{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}put(e,t){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,t)}delete(e){this.cache.delete(e)}}es(Gb,"LRUCache");class qb{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(e){return new $u(e,e.data)}getFromCache(e,t,i){return this.cacheMap.has(i)||this.cacheMap.set(i,new Gb(150)),this.cacheMap.get(i).get(Ma(e.toString(),t))}setInCache(e,t,i,r){this.cacheDependenciesMap.has(r)||this.cacheDependenciesMap.set(r,new Map),this.cacheMap.has(r)||this.cacheMap.set(r,new Gb(150));const n=this.cacheDependenciesMap.get(r),o=Ma(e.id.toString(),i);n.get(o)||n.set(o,new Set);const s=this.cacheMap.get(r),a=e.toString();n.get(o).add(a),s.put(Ma(e.toString(),i),t)}removeImagesFromCacheByIds(e,t,i=0){if(!this.cacheMap.has(i)||!this.cacheDependenciesMap.has(i))return;const r=this.cacheMap.get(i),n=this.cacheDependenciesMap.get(i);for(const o of e){const e=Ma(o.toString(),t);if(n.has(e)){for(const t of n.get(e))r.delete(t);n.delete(e)}}}rasterize(e,t,i,r){const n=this.getFromCache(e,i,r);if(n)return n.clone();const o=function(e,t){const i=Sb.calculate(t.params,e.metadata?e.metadata.variables:[]),r=e.usvg_tree,n=r.width,o=r.height,s=Math.max(1,Math.round(n*t.sx)),a=Math.max(1,Math.round(o*t.sy)),l=new DOMMatrix([s/n,0,0,a/o,0,0]);return null===Mb&&(Mb=Ib(10,10),Ab=Mb.getContext("2d",{willReadFrequently:!0})),Mb.width=s,Mb.height=a,Cb(Ab,l,r,r,i),Ab.getImageData(0,0,s,a)}(t.icon,e),s=qb._getImage(o);return this.setInCache(e,s,i,r),s.clone()}}class Hb{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,t){const i=this.toIdx(e,t);return{min:this.minimums[i],max:this.maximums[i]}}isLeaf(e,t){return this.leaves[this.toIdx(e,t)]}toIdx(e,t){return t*this.size+e}}function $b(e,t,i,r){let n=0,o=Number.MAX_VALUE;for(let s=0;s<3;s++)if(Math.abs(r[s])<1e-15){if(i[s]<e[s]||i[s]>t[s])return null}else{const a=1/r[s];let l=(e[s]-i[s])*a,c=(t[s]-i[s])*a;if(l>c){const e=l;l=c,c=e}if(l>n&&(n=l),c<o&&(o=c),n>o)return null}return n}function Zb(e,t,i,r,n,o,s,a,l,c,h){const u=r-e,d=n-t,p=o-i,f=s-e,m=a-t,_=l-i,g=h[1]*_-h[2]*m,y=h[2]*f-h[0]*_,x=h[0]*m-h[1]*f,v=u*g+d*y+p*x;if(Math.abs(v)<1e-15)return null;const b=1/v,w=c[0]-e,T=c[1]-t,S=c[2]-i,E=(w*g+T*y+S*x)*b;if(E<0||E>1)return null;const I=T*p-S*d,A=S*u-w*p,M=w*d-T*u,C=(h[0]*I+h[1]*A+h[2]*M)*b;return C<0||E+C>1?null:(f*I+m*A+_*M)*b}function Wb(e,t,i){return(e-t)/(i-t)}function Xb(e,t,i,r,n,o,s,a,l){const c=1<<i,h=o-r,u=s-n,d=(e+1)/c*h+r,p=(t+0)/c*u+n,f=(t+1)/c*u+n;a[0]=(e+0)/c*h+r,a[1]=p,l[0]=d,l[1]=f}class Yb{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const t=function(e){const t=Math.ceil(Math.log2(e.dim/8)),i=[];let r=Math.ceil(Math.pow(2,t));const n=1/r,o=(e,t,i,r,n)=>{const o=r?1:0,s=(e+1)*i-o,a=t*i,l=(t+1)*i-o;n[0]=e*i,n[1]=a,n[2]=s,n[3]=l};let s=new Hb(r);const a=[];for(let l=0;l<r*r;l++){o(l%r,Math.floor(l/r),n,!1,a);const t=Jb(a[0],a[1],e),i=Jb(a[2],a[1],e),c=Jb(a[2],a[3],e),h=Jb(a[0],a[3],e);s.minimums.push(Math.min(t,i,c,h)),s.maximums.push(Math.max(t,i,c,h)),s.leaves.push(1)}for(i.push(s),r/=2;r>=1;r/=2){const e=i[i.length-1];s=new Hb(r);for(let t=0;t<r*r;t++){o(t%r,Math.floor(t/r),2,!0,a);const i=e.getElevation(a[0],a[1]),n=e.getElevation(a[2],a[1]),l=e.getElevation(a[2],a[3]),c=e.getElevation(a[0],a[3]),h=e.isLeaf(a[0],a[1]),u=e.isLeaf(a[2],a[1]),d=e.isLeaf(a[2],a[3]),p=e.isLeaf(a[0],a[3]),f=Math.min(i.min,n.min,l.min,c.min),m=Math.max(i.max,n.max,l.max,c.max),_=h&&u&&d&&p;s.maximums.push(m),s.minimums.push(f),s.leaves.push(m-f<=5&&_?1:0)}i.push(s)}return i}(this.dem),i=t.length-1,r=t[i];this._addNode(r.minimums[0],r.maximums[0],r.leaves[0]),this._construct(t,0,0,i,0)}raycastRoot(e,t,i,r,n,o,s=1){return $b([e,t,-100],[i,r,this.maximums[0]*s],n,o)}raycast(e,t,i,r,n,o,s=1){if(!this.nodeCount)return null;const a=this.raycastRoot(e,t,i,r,n,o,s);if(null==a)return null;const l=[],c=[],h=[],u=[],d=[{idx:0,t:a,nodex:0,nodey:0,depth:0}];for(;d.length>0;){const{idx:a,t:p,nodex:f,nodey:m,depth:_}=d.pop();if(this.leaves[a]){Xb(f,m,_,e,t,i,r,h,u);const a=1<<_,l=(f+0)/a,c=(f+1)/a,d=(m+0)/a,g=(m+1)/a,y=Jb(l,d,this.dem)*s,x=Jb(c,d,this.dem)*s,v=Jb(c,g,this.dem)*s,b=Jb(l,g,this.dem)*s,w=Zb(h[0],h[1],y,u[0],h[1],x,u[0],u[1],v,n,o),T=Zb(u[0],u[1],v,h[0],u[1],b,h[0],h[1],y,n,o),S=Math.min(null!==w?w:Number.MAX_VALUE,null!==T?T:Number.MAX_VALUE);if(S!==Number.MAX_VALUE)return S;{const e=L([],n,o,p);if(Kb(y,x,b,v,Wb(e[0],h[0],u[0]),Wb(e[1],h[1],u[1]))>=e[2])return p}continue}let g=0;for(let d=0;d<this._siblingOffset.length;d++){Xb((f<<1)+this._siblingOffset[d][0],(m<<1)+this._siblingOffset[d][1],_+1,e,t,i,r,h,u),h[2]=-100,u[2]=this.maximums[this.childOffsets[a]+d]*s;const p=$b(h,u,n,o);if(null!=p){const e=p;l[d]=e;let t=!1;for(let i=0;i<g&&!t;i++)e>=l[c[i]]&&(c.splice(i,0,d),t=!0);t||(c[g]=d),g++}}for(let e=0;e<g;e++){const t=c[e];d.push({idx:this.childOffsets[a]+t,t:l[t],nodex:(f<<1)+this._siblingOffset[t][0],nodey:(m<<1)+this._siblingOffset[t][1],depth:_+1})}}return null}_addNode(e,t,i){return this.minimums.push(e),this.maximums.push(t),this.leaves.push(i),this.childOffsets.push(0),this.nodeCount++}_construct(e,t,i,r,n){if(1===e[r].isLeaf(t,i))return;this.childOffsets[n]||(this.childOffsets[n]=this.nodeCount);const o=r-1,s=e[o];let a=0,l=0;for(let c=0;c<this._siblingOffset.length;c++){const e=2*t+this._siblingOffset[c][0],r=2*i+this._siblingOffset[c][1],n=s.getElevation(e,r),o=s.isLeaf(e,r),h=this._addNode(n.min,n.max,o);o&&(a|=1<<c),l||(l=h)}for(let c=0;c<this._siblingOffset.length;c++)a&1<<c||this._construct(e,2*t+this._siblingOffset[c][0],2*i+this._siblingOffset[c][1],o,l+c)}}function Kb(e,t,i,r,n,o){return pi(pi(e,i,o),pi(t,r,o),n)}function Jb(e,t,i){const r=i.dim,n=Oe(e*r-.5,0,r-1),o=Oe(t*r-.5,0,r-1),s=Math.floor(n),a=Math.floor(o),l=Math.min(s+1,r-1),c=Math.min(a+1,r-1);return Kb(i.get(s,a),i.get(l,a),i.get(s,c),i.get(l,c),n-s,o-a)}const Qb={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function ew(e,t,i){return(256*e*256+256*t+i)/10-1e4}function tw(e,t,i){return 256*e+t+i/256-32768}class iw{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,t,i,r=!1){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(i&&"mapbox"!==i&&"terrarium"!==i)return void We(`"${i}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=t.height;const n=this.dim=t.height-2,o=new Uint32Array(t.data.buffer);if(this.pixels=new Uint8Array(t.data.buffer),this.floatView=new Float32Array(t.data.buffer),this.borderReady=r,this._modifiedForSources={},!r){for(let e=0;e<n;e++)o[this._idx(-1,e)]=o[this._idx(0,e)],o[this._idx(n,e)]=o[this._idx(n-1,e)],o[this._idx(e,-1)]=o[this._idx(e,0)],o[this._idx(e,n)]=o[this._idx(e,n-1)];o[this._idx(-1,-1)]=o[this._idx(0,0)],o[this._idx(n,-1)]=o[this._idx(n-1,0)],o[this._idx(-1,n)]=o[this._idx(0,n-1)],o[this._idx(n,n)]=o[this._idx(n-1,n-1)]}const s="terrarium"===i?tw:ew;for(let a=0;a<o.length;++a){const e=4*a;this.floatView[a]=s(this.pixels[e],this.pixels[e+1],this.pixels[e+2])}this._timestamp=gt.now()}_buildQuadTree(){this._tree=new Yb(this)}get(e,t,i=!1){i&&(e=Oe(e,-1,this.dim),t=Oe(t,-1,this.dim));const r=this._idx(e,t);return this.floatView[r]}set(e,t,i){const r=this._idx(e,t),n=this.floatView[r];return this.floatView[r]=i,i-n}static getUnpackVector(e){return Qb[e]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}static pack(e,t){const i=[0,0,0,0],r=iw.getUnpackVector(t);let n=Math.floor((e+r[3])/r[2]);return i[2]=n%256,n=Math.floor(n/256),i[1]=n%256,n=Math.floor(n/256),i[0]=n,i}getPixels(){return new Zu({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let r=t*this.dim,n=t*this.dim+this.dim,o=i*this.dim,s=i*this.dim+this.dim;switch(t){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:o=s-1;break;case 1:s=o+1}const a=-t*this.dim,l=-i*this.dim;for(let c=o;c<s;c++)for(let t=r;t<n;t++){const i=4*this._idx(t,c),r=4*this._idx(t+a,c+l);this.pixels[i+0]=e.pixels[r+0],this.pixels[i+1]=e.pixels[r+1],this.pixels[i+2]=e.pixels[r+2],this.pixels[i+3]=e.pixels[r+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function rw(e,t,i){1===e?t.headerLength=i.readFixed32():2===e?t.x=i.readVarint():3===e?t.y=i.readVarint():4===e?t.z=i.readVarint():5===e&&t.layers.push(function(e,t){return e.readFields(lw,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},t)}(i,i.readVarint()+i.pos))}function nw(e,t,i){1===e?(t.delta_filter=function(e,t){return e.readFields(ow,{blockSize:0},t)}(i,i.readVarint()+i.pos),t.filter="delta_filter"):2===e?(i.readVarint(),t.filter="zigzag_filter"):3===e?(i.readVarint(),t.filter="bitshuffle_filter"):4===e&&(i.readVarint(),t.filter="byteshuffle_filter")}function ow(e,t,i){1===e&&(t.blockSize=i.readVarint())}function sw(e,t,i){1===e?(i.readVarint(),t.codec="gzip_data"):2===e?(i.readVarint(),t.codec="jpeg_image"):3===e?(i.readVarint(),t.codec="webp_image"):4===e&&(i.readVarint(),t.codec="png_image")}function aw(e,t,i){let r=0,n=0;1===e?t.firstByte=i.readFixed64():2===e?t.lastByte=i.readFixed64():3===e?t.filters.push(function(e,t){return e.readFields(nw,{},t)}(i,i.readVarint()+i.pos)):4===e?t.codec=function(e,t){return e.readFields(sw,{},t)}(i,i.readVarint()+i.pos):5===e?n=i.readFloat():6===e?r=i.readFloat():7===e?t.bands.push(i.readString()):8===e?t.offset=i.readDouble():9===e&&(t.scale=i.readDouble()),0===t.offset&&(t.offset=n),0===t.scale&&(t.scale=r)}function lw(e,t,i){1===e?t.version=i.readVarint():2===e?t.name=i.readString():3===e?t.units=i.readString():4===e?t.tileSize=i.readVarint():5===e?t.buffer=i.readVarint():6===e?t.pixelFormat=i.readVarint():7===e&&t.dataIndex.push(function(e,t){return e.readFields(aw,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},t)}(i,i.readVarint()+i.pos))}function cw(e,t,i){if(2===e)!function(e,t,i){e.readFields(hw,i,t)}(i,i.readVarint()+i.pos,t);else if(3===e)throw new Error("Not implemented")}function hw(e,t,i){if(1===e){let e=0;const r=i.readVarint()+i.pos;for(;i.pos<r;)t[e++]=i.readVarint()}}function uw(e,t){if(4!==t.length)throw new Error(`Expected data of dimension 4 but got ${t.length}.`);let i=t[3];for(let r=2;r>=1;r--){const n=1===r?1:0,o=2===r?1:0;for(let r=0;r<t[0];r++){const s=t[1]*r;for(let r=n;r<t[1];r++){const n=t[2]*(r+s);for(let r=o;r<t[2];r++){const o=t[3]*(r+n);for(let r=0;r<t[3];r++){const t=o+r;e[t]+=e[t-i]}}}}i*=t[r]}return e}function dw(e){for(let t=0,i=e.length;t<i;t++)e[t]=e[t]>>>1^-(1&e[t]);return e}function pw(e,t){switch(t){case"uint32":return e;case"uint16":for(let t=0;t<e.length;t+=2){const i=e[t],r=e[t+1];e[t]=(240&i)>>4|(61440&i)>>8|(240&r)<<4|61440&r,e[t+1]=15&i|(3840&i)>>4|(15&r)<<8|(3840&r)<<4}return e;case"uint8":for(let t=0;t<e.length;t+=4){const i=e[t],r=e[t+1],n=e[t+2],o=e[t+3];e[t+0]=(192&i)>>6|(192&r)>>4|(192&n)>>2|192&o,e[t+1]=(48&i)>>4|(48&r)>>2|48&n|(48&o)<<2,e[t+2]=(12&i)>>2|12&r|(12&n)<<2|(12&o)<<4,e[t+3]=3&i|(3&r)<<2|(3&n)<<4|(3&o)<<6}return e;default:throw new Error(`Invalid pixel format, "${t}"`)}}es(iw,"DEMData"),es(Yb,"DemMinMaxQuadTree",{omit:["dem"]});var fw=Uint8Array,mw=Uint16Array,_w=Int32Array,gw=new fw([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),yw=new fw([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),xw=new fw([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),vw=function(e,t){for(var i=new mw(31),r=0;r<31;++r)i[r]=t+=1<<e[r-1];var n=new _w(i[30]);for(r=1;r<30;++r)for(var o=i[r];o<i[r+1];++o)n[o]=o-i[r]<<5|r;return{b:i,r:n}},bw=vw(gw,2),ww=bw.b,Tw=bw.r;ww[28]=258,Tw[258]=28;for(var Sw=vw(yw,0).b,Ew=new mw(32768),Iw=0;Iw<32768;++Iw){var Aw=(43690&Iw)>>1|(21845&Iw)<<1;Ew[Iw]=((65280&(Aw=(61680&(Aw=(52428&Aw)>>2|(13107&Aw)<<2))>>4|(3855&Aw)<<4))>>8|(255&Aw)<<8)>>1}var Mw=function(e,t,i){for(var r=e.length,n=0,o=new mw(t);n<r;++n)e[n]&&++o[e[n]-1];var s,a=new mw(t);for(n=1;n<t;++n)a[n]=a[n-1]+o[n-1]<<1;s=new mw(1<<t);var l=15-t;for(n=0;n<r;++n)if(e[n])for(var c=n<<4|e[n],h=t-e[n],u=a[e[n]-1]++<<h,d=u|(1<<h)-1;u<=d;++u)s[Ew[u]>>l]=c;return s},Cw=new fw(288);for(Iw=0;Iw<144;++Iw)Cw[Iw]=8;for(Iw=144;Iw<256;++Iw)Cw[Iw]=9;for(Iw=256;Iw<280;++Iw)Cw[Iw]=7;for(Iw=280;Iw<288;++Iw)Cw[Iw]=8;var Pw=new fw(32);for(Iw=0;Iw<32;++Iw)Pw[Iw]=5;var Rw=Mw(Cw,9),zw=Mw(Pw,5),Lw=function(e){for(var t=e[0],i=1;i<e.length;++i)e[i]>t&&(t=e[i]);return t},Dw=function(e,t,i){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&i},Ow=function(e,t){var i=t/8|0;return(e[i]|e[i+1]<<8|e[i+2]<<16)>>(7&t)},Fw=function(e){return(e+7)/8|0},kw=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Bw=function(e,t,i){var r=new Error(t||kw[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Bw),!i)throw r;return r},Nw=new fw(0),Vw="undefined"!=typeof TextDecoder&&new TextDecoder;try{Vw.decode(Nw,{stream:!0})}catch(e){}const Uw={gzip_data:"gzip"};class jw extends Error{constructor(e){super(e),this.name="MRTError"}}const Gw={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},qw={uint32:1,uint16:2,uint8:4},Hw={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let $w;class Zw{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const t=this.layers[e];if(!t)throw new jw(`Layer '${e}' not found`);return t}getHeaderLength(e){const t=new Uint8Array(e),i=new DataView(e);if(13!==t[0])throw new jw("File is not a valid MRT.");return i.getUint32(1,!0)}parseHeader(e){const t=new Uint8Array(e),i=this.getHeaderLength(e);if(t.length<i)throw new jw(`Expected header with length >= ${i} but got buffer of length ${t.length}`);const r=new $w(t.subarray(0,i)).readFields(rw,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==r.x||this.y!==r.y||this.z!==r.z))throw new jw(`Invalid attempt to parse header ${r.z}/${r.x}/${r.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=r.x,this.y=r.y,this.z=r.z;for(const n of r.layers)this.layers[n.name]=new Ww(n,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const t=[],i=this.getLayer(e.layerName);for(let r of e.blockIndices){const n=i.dataIndex[r],o=n.firstByte-e.firstByte,s=n.lastByte-e.firstByte;if(i._blocksInProgress.has(r))continue;const a={layerName:i.name,firstByte:o,lastByte:s,pixelFormat:i.pixelFormat,blockIndex:r,blockShape:[n.bands.length].concat(i.bandShape),buffer:i.buffer,codec:n.codec.codec,filters:n.filters.map(e=>e.filter)};i._blocksInProgress.add(r),t.push(a)}return new Xw(t,()=>{t.forEach(e=>i._blocksInProgress.delete(e.blockIndex))},(e,r)=>{if(t.forEach(e=>i._blocksInProgress.delete(e.blockIndex)),e)throw e;r.forEach(e=>{this.getLayer(e.layerName).processDecodedData(e)})})}}class Ww{constructor({version:e,name:t,units:i,tileSize:r,pixelFormat:n,buffer:o,dataIndex:s},a){if(this.version=e,1!==this.version)throw new jw(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=t,this.units=i,this.tileSize=r,this.buffer=o,this.pixelFormat=Gw[n],this.dataIndex=s,this.bandShape=[r+2*o,r+2*o,qw[this.pixelFormat]],this._decodedBlocks=new Gb(a?a.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return qw[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const t=e.blockIndex.toString();this._decodedBlocks.get(t)||this._decodedBlocks.put(t,e.data)}getBlockForBand(e){let t=0;switch(typeof e){case"string":for(const[i,r]of this.dataIndex.entries()){for(const[n,o]of r.bands.entries())if(o===e)return{bandIndex:t+n,blockIndex:i,blockBandIndex:n};t+=r.bands.length}break;case"number":for(const[i,r]of this.dataIndex.entries()){if(e>=t&&e<t+r.bands.length)return{bandIndex:e,blockIndex:i,blockBandIndex:e-t};t+=r.bands.length}break;default:throw new jw(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let t=1/0,i=-1/0;const r=[],n=new Set;for(const o of e){const{blockIndex:e}=this.getBlockForBand(o);if(e<0)throw new jw(`Invalid band: ${JSON.stringify(o)}`);const s=this.dataIndex[e];r.includes(e)||r.push(e),n.add(e),t=Math.min(t,s.firstByte),i=Math.max(i,s.lastByte)}if(n.size>this.cacheSize)throw new jw(`Number of blocks to decode (${n.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:t,lastByte:i,blockIndices:r}}hasBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0}hasDataForBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0&&!!this._decodedBlocks.get(t.toString())}getBandView(e){const{blockIndex:t,blockBandIndex:i}=this.getBlockForBand(e);if(t<0)throw new jw(`Band not found: ${JSON.stringify(e)}`);const r=this._decodedBlocks.get(t.toString());if(!r)throw new jw(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const n=this.dataIndex[t],o=this.bandShape.reduce((e,t)=>e*t,1),s=i*o,a=r.subarray(s,s+o);return{data:a,bytes:new Uint8Array(a.buffer).subarray(a.byteOffset,a.byteOffset+a.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:n.offset,scale:n.scale}}}Zw.setPbf=function(e){$w=e};class Xw{constructor(e,t,i){this.tasks=e,this._onCancel=t,this._onComplete=i,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,t){this._finalized||(this._onComplete(e,t),this._finalized=!0)}}Zw.performDecoding=function(e,t){const i=new Uint8Array(e);return Promise.all(t.tasks.map(e=>{const{layerName:t,firstByte:r,lastByte:n,pixelFormat:o,blockShape:s,blockIndex:a,filters:l,codec:c}=e,h=i.subarray(r,n+1),u=new Uint32Array(s[0]*s[1]*s[2]);let d;if("gzip_data"!==c)throw new jw(`Unhandled codec: ${c}`);return d=function(e,t){if(!globalThis.DecompressionStream&&"gzip_data"===t)return Promise.resolve((s=function(e){31==e[0]&&139==e[1]&&8==e[2]||Bw(6,"invalid gzip data");var t=e[3],i=10;4&t&&(i+=2+(e[10]|e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[i++]);return i+(2&t)}(i=e),s+8>i.length&&Bw(6,"invalid gzip data"),function(e,t,i,r){var n=e.length;if(!n||t.f&&!t.l)return i||new fw(0);var o=!i,s=o||2!=t.i,a=t.i;o&&(i=new fw(3*n));var l=function(e){var t=i.length;if(e>t){var r=new fw(Math.max(2*t,e));r.set(i),i=r}},c=t.f||0,h=t.p||0,u=t.b||0,d=t.l,p=t.d,f=t.m,m=t.n,_=8*n;do{if(!d){c=Dw(e,h,1);var g=Dw(e,h+1,3);if(h+=3,!g){var y=e[(C=Fw(h)+4)-4]|e[C-3]<<8,x=C+y;if(x>n){a&&Bw(0);break}s&&l(u+y),i.set(e.subarray(C,x),u),t.b=u+=y,t.p=h=8*x,t.f=c;continue}if(1==g)d=Rw,p=zw,f=9,m=5;else if(2==g){var v=Dw(e,h,31)+257,b=Dw(e,h+10,15)+4,w=v+Dw(e,h+5,31)+1;h+=14;for(var T=new fw(w),S=new fw(19),E=0;E<b;++E)S[xw[E]]=Dw(e,h+3*E,7);h+=3*b;var I=Lw(S),A=(1<<I)-1,M=Mw(S,I);for(E=0;E<w;){var C,P=M[Dw(e,h,A)];if(h+=15&P,(C=P>>4)<16)T[E++]=C;else{var R=0,z=0;for(16==C?(z=3+Dw(e,h,3),h+=2,R=T[E-1]):17==C?(z=3+Dw(e,h,7),h+=3):18==C&&(z=11+Dw(e,h,127),h+=7);z--;)T[E++]=R}}var L=T.subarray(0,v),D=T.subarray(v);f=Lw(L),m=Lw(D),d=Mw(L,f),p=Mw(D,m)}else Bw(1);if(h>_){a&&Bw(0);break}}s&&l(u+131072);for(var O=(1<<f)-1,F=(1<<m)-1,k=h;;k=h){var B=(R=d[Ow(e,h)&O])>>4;if((h+=15&R)>_){a&&Bw(0);break}if(R||Bw(2),B<256)i[u++]=B;else{if(256==B){k=h,d=null;break}var N=B-254;B>264&&(N=Dw(e,h,(1<<(j=gw[E=B-257]))-1)+ww[E],h+=j);var V=p[Ow(e,h)&F],U=V>>4;if(V||Bw(3),h+=15&V,D=Sw[U],U>3){var j=yw[U];D+=Ow(e,h)&(1<<j)-1,h+=j}if(h>_){a&&Bw(0);break}s&&l(u+131072);var G=u+N;if(u<D){var q=0-D,H=Math.min(D,G);for(q+u<0&&Bw(3);u<H;++u)i[u]=r[q+u]}for(;u<G;++u)i[u]=i[u-D]}}t.l=d,t.p=k,t.b=u,t.f=c,d&&(c=1,t.m=f,t.d=p,t.n=m)}while(!c);return u!=i.length&&o?function(e,t,i){return(null==i||i>e.length)&&(i=e.length),new fw(e.subarray(0,i))}(i,0,u):i.subarray(0,u)}(i.subarray(s,-8),{i:2},new fw(((n=i)[(o=n.length)-4]|n[o-3]<<8|n[o-2]<<16|n[o-1]<<24)>>>0),r)));var i,r,n,o,s;const a=Uw[t];if(!a)throw new Error(`Unhandled codec: ${t}`);const l=new globalThis.DecompressionStream(a);return new Response(new Blob([e]).stream().pipeThrough(l)).arrayBuffer().then(e=>new Uint8Array(e))}(h,c).then(e=>(function(e,t){e.readFields(cw,t)}(new $w(e),u),new(0,Hw[o])(u.buffer))),d.then(e=>{for(let t=l.length-1;t>=0;t--)switch(l[t]){case"delta_filter":uw(e,s);break;case"zigzag_filter":dw(e);break;case"bitshuffle_filter":pw(e,o);break;default:throw new jw(`Unhandled filter "${l[t]}"`)}return{layerName:t,blockIndex:a,data:e}}).catch(e=>{throw e})}))},es(Xw,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),es(Zw,"MapboxRasterTile"),es(Ww,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class Yw{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){const i=e[t];this._stringToNumber[i]=t,this._numberToString[t]=i}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}class Kw{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Jo(Ur,16,0),this.featureIndexArray=new zl,this.promoteId=t,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,t,i,r,n,o=0,s=0){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n,o);const l=this.grid;for(let c=0;c<t.length;c++){const e=t[c],i=[1/0,1/0,-1/0,-1/0];for(let t=0;t<e.length;t++){const r=e[t];i[0]=Math.min(i[0],r.x),i[1]=Math.min(i[1],r.y),i[2]=Math.max(i[2],r.x),i[3]=Math.max(i[3],r.y)}0!==s&&(i[0]-=s,i[1]-=s,i[2]+=s,i[3]+=s),i[0]<Ur&&i[1]<Ur&&i[2]>=0&&i[3]>=0&&l.insert(a,i[0],i[1],i[2],i[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new nh(new zg(this.rawTileData)).layers,this.sourceLayerCoder=new Yw(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){const{tilespaceGeometry:i,transform:r,tileTransform:n,pixelPosMatrix:o,availableImages:s,worldview:a}=t;this.loadVTLayers(),this.serializedLayersCache.clear();const l=t.queryRadius?t.queryRadius:0,c=i.bufferedTilespaceBounds,h=this.grid.query(c.min.x,c.min.y,c.max.x,c.max.y,(e,t,r,n)=>Nh(i.bufferedTilespaceGeometry,e-l,t-l,r+l,n+l));h.sort(Qw);let u=null;r.elevation&&h.length>0&&(u=kv.create(r.elevation,this.tileID));const d={};let p;for(let f=0;f<h.length;f++){const l=h[f];if(l===p)continue;p=l;const c=this.featureIndexArray.get(l);let m=null;this.is3DTile?this.loadMatchingModelFeature(d,c,e,i,r,a):this.loadMatchingFeature(d,c,e,s,a,(e,s,a,l=0)=>(m||(m=Kc(e,this.tileID.canonical,n)),s.queryIntersectsFeature(i,e,a,m,this.z,r,o,u,l,t.scope)))}return d}loadMatchingFeature(e,t,i,r,n,o){const{featureIndex:s,bucketIndex:a,sourceLayerIndex:l,layoutVertexArrayOffset:c}=t,h=this.bucketLayerIDs[a],u=i.layers,d=Object.keys(u);if(d.length&&!$e(d,h))return;const p=i.sourceCache,f=this.sourceLayerCoder.decode(l),m=this.vtLayers[f].feature(s),_=this.getId(m,f);for(let g=0;g<h.length;g++){const t=h[g];if(!u[t])continue;const{styleLayer:i,targets:a}=u[t];let l={};void 0!==_&&(l=p.getFeatureState(i.sourceLayer,_));const d=!o||o(m,i,l,c);if(!d)continue;const f=new Xv(m,this.z,this.x,this.y,_);f.tile=this.tileID.canonical,f.state=l;let y=this.serializedLayersCache.get(t);y||(y=i.serialize(),y.id=t,this.serializedLayersCache.set(t,y)),f.source=y.source,f.sourceLayer=y["source-layer"],f.layer=Object.assign({},y),f.layer.paint=Jw(y.paint,i.paint,m,l,r),f.layer.layout=Jw(y.layout,i.layout,m,l,r);let x=!1;for(const e of a){this.updateFeatureProperties(f,e);const{filter:t}=e;if(t)if(m.properties=f.properties,t.needGeometry){const e=Jc(m,!0);if(!t.filter(new Js(this.tileID.overscaledZ,{worldview:n}),e,this.tileID.canonical))continue}else if(!t.filter(new Js(this.tileID.overscaledZ,{worldview:n}),m))continue;x=!0,e.targetId&&this.addFeatureVariant(f,e)}x&&this.appendToResult(e,t,s,f,d)}}loadMatchingModelFeature(e,t,i,r,n,o){const{featureIndex:s,bucketIndex:a}=t,l=this.bucketLayerIDs[a],c=i.layers,h=Object.keys(c);if(!h.length||$e(h,l))for(let u=0;u<l.length;u++){const t=l[u],{styleLayer:a,targets:h}=c[t];if("model"!==a.type)continue;const d=r.tile,p=d.getBucket(a);if(!(p&&p instanceof qv))continue;const f=Jv(p,s,r,n);if(!f)continue;const{z:m,x:_,y:g}=d.tileID.canonical,{feature:y,intersectionZ:x,position:v}=f;let b={};void 0!==y.id&&(b=i.sourceCache.getFeatureState(a.sourceLayer,y.id));const w=new Xv({},m,_,g,y.id);w.tile=this.tileID.canonical,w.state=b,w.properties=y.properties,w.geometry={type:"Point",coordinates:[v.lng,v.lat]};let T=this.serializedLayersCache.get(t);T||(T=a.serialize(),T.id=t,this.serializedLayersCache.set(t,T)),w.source=T.source,w.sourceLayer=T["source-layer"],w.layer=Object.assign({},T);let S=!1;for(const e of h){this.updateFeatureProperties(w,e);const{filter:t}=e;if(t)if(y.properties=w.properties,t.needGeometry){if(!t.filter(new Js(this.tileID.overscaledZ,{worldview:o}),y,this.tileID.canonical))continue}else if(!t.filter(new Js(this.tileID.overscaledZ,{worldview:o}),y))continue;S=!0,e.targetId&&this.addFeatureVariant(w,e)}S&&this.appendToResult(e,t,s,w,x)}}updateFeatureProperties(e,t,i){if(t.properties){const r={};for(const n in t.properties){const o=t.properties[n].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,i);null!=o&&(r[n]=o)}e.properties=r}}addFeatureVariant(e,t,i){const r={target:t.target,namespace:t.namespace,uniqueFeatureID:t.uniqueFeatureID};t.properties&&(r.properties=e.properties),e.variants=e.variants||{},e.variants[t.targetId]=e.variants[t.targetId]||[],e.variants[t.targetId].push(r)}appendToResult(e,t,i,r,n){let o=e[t];void 0===o&&(o=e[t]=[]),o.push({featureIndex:i,feature:r,intersectionZ:n})}lookupSymbolFeatures(e,t,i,r,n,o){const s={};this.loadVTLayers();for(const a of e)this.loadMatchingFeature(s,{bucketIndex:t,sourceLayerIndex:i,featureIndex:a,layoutVertexArrayOffset:0},r,n,o);return s}loadFeature(e){const{featureIndex:t,sourceLayerIndex:i}=e;this.loadVTLayers();const r=this.sourceLayerCoder.decode(i),n=this.vtFeatures[r];if(n[t])return n[t];const o=this.vtLayers[r].feature(t);return n[t]=o,o}hasLayer(e){for(const t of this.bucketLayerIDs)for(const i of t)if(e===i)return!0;return!1}getId(e,t){let i=e.id;if(this.promoteId){const r=Array.isArray(this.promoteId)||"object"!=typeof this.promoteId?this.promoteId:this.promoteId[t];if(null!=r)if(Array.isArray(r)){if(!this.promoteIdExpression){const e=Go(r);if("success"!==e.result)return void We(`Failed to create expression for promoteId: ${e.value.map(e=>`${e.key}: ${e.message}`).join(", ")}`);this.promoteIdExpression=e.value}i=this.promoteIdExpression.evaluate({zoom:0},e)}else i=e.properties[r];"boolean"==typeof i&&(i=Number(i))}return i}}function Jw(e,t,i,r,n){return Ge(e,(e,o)=>{const s=t instanceof sa?t.get(o):null;return s&&s.evaluate?s.evaluate(i,r,void 0,n):s})}function Qw(e,t){return t-e}es(Kw,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const eT=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array
vendor: 4,100 bytes, line 2
2];class tT{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,i]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");const r=i>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const n=eT[15&i];if(!n)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new tT(s,o,n,e)}constructor(e,t=64,i=Float64Array,r){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const n=eT.indexOf(this.ArrayType),o=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-s%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${i}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+o+s+a),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return iT(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:s}=this,a=[0,n.length-1,0],l=[];for(;a.length;){const c=a.pop()||0,h=a.pop()||0,u=a.pop()||0;if(h-u<=s){for(let s=u;s<=h;s++){const a=o[2*s],c=o[2*s+1];a>=e&&a<=i&&c>=t&&c<=r&&l.push(n[s])}continue}const d=u+h>>1,p=o[2*d],f=o[2*d+1];p>=e&&p<=i&&f>=t&&f<=r&&l.push(n[d]),(0===c?e<=p:t<=f)&&(a.push(u),a.push(d-1),a.push(1-c)),(0===c?i>=p:r>=f)&&(a.push(d+1),a.push(h),a.push(1-c))}return l}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:n,nodeSize:o}=this,s=[0,r.length-1,0],a=[],l=i*i;for(;s.length;){const c=s.pop()||0,h=s.pop()||0,u=s.pop()||0;if(h-u<=o){for(let i=u;i<=h;i++)sT(n[2*i],n[2*i+1],e,t)<=l&&a.push(r[i]);continue}const d=u+h>>1,p=n[2*d],f=n[2*d+1];sT(p,f,e,t)<=l&&a.push(r[d]),(0===c?e-i<=p:t-i<=f)&&(s.push(u),s.push(d-1),s.push(1-c)),(0===c?e+i>=p:t+i>=f)&&(s.push(d+1),s.push(h),s.push(1-c))}return a}}function iT(e,t,i,r,n,o){if(n-r<=i)return;const s=r+n>>1;rT(e,t,s,r,n,o),iT(e,t,i,r,s-1,1-o),iT(e,t,i,s+1,n,1-o)}function rT(e,t,i,r,n,o){for(;n>r;){if(n-r>600){const s=n-r+1,a=i-r+1,l=Math.log(s),c=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*c*(s-c)/s)*(a-s/2<0?-1:1);rT(e,t,i,Math.max(r,Math.floor(i-a*c/s+h)),Math.min(n,Math.floor(i+(s-a)*c/s+h)),o)}const s=t[2*i+o];let a=r,l=n;for(nT(e,t,r,i),t[2*n+o]>s&&nT(e,t,r,n);a<l;){for(nT(e,t,a,l),a++,l--;t[2*a+o]<s;)a++;for(;t[2*l+o]>s;)l--}t[2*r+o]===s?nT(e,t,r,l):(l++,nT(e,t,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function nT(e,t,i,r){oT(e,i,r),oT(t,2*i,2*r),oT(t,2*i+1,2*r+1)}function oT(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function sT(e,t,i,r){const n=e-i,o=t-r;return n*n+o*o}e.$=er,e.A=Bi,e.B=Ma,e.C=2,e.D=Wf,e.E=ni,e.F=Ey,e.G=Sy,e.H=Ki,e.I=oi,e.J=da,e.K=Yi,e.L=Qi,e.M=zo,e.N=Co,e.O=Ro,e.P=Ee,e.Q=jo,e.R=Ft,e.S=pa,e.T=Fm,e.U=Go,e.V=Pv,e.W=$o,e.X=xn,e.Y=gn,e.Z=yn,e._=or,e.a=function(e){return at.API_CDN_URL_REGEX.test(e)},e.a$=Fc,e.a0=Ji,e.a1=li,e.a2=fa,e.a3=class extends Pv{},e.a4=Lo,e.a5=Po,e.a6=ua,e.a7=function(e){const t=e.value;return t?Ji(t)?Rv(t,!0)?[]:[new Pv(e.key,t,`invalid url "${t}"`)]:[new Pv(e.key,t,`string expected, "${Yi(t)}" found`)]:[]},e.a8=ta,e.a9=ha,e.aA=Oe,e.aB=u,e.aC=ee,e.aD=vc,e.aE=Bh,e.aF=zc,e.aG=Hc,e.aH=function(e,t){const i={};for(let r=0;r<t.length;r++){const n=t[r];n in e&&(i[n]=e[n])}return i},e.aI=Pc,e.aJ=Lc,e.aK=class{constructor(e){this.entries={}
vendor: 4,807 bytes, line 2
2,this.scheduler=e}request(e,t,i,r){const n=this.entries[e]=this.entries[e]||{callbacks:[]};if(n.result){const[e,i]=n.result;return this.scheduler?this.scheduler.add(()=>{r(e,i)},t):r(e,i),()=>{}}return n.callbacks.push(r),n.cancel||(n.cancel=i((i,r)=>{n.result=[i,r];for(const e of n.callbacks)this.scheduler?this.scheduler.add(()=>{e(i,r)},t):e(i,r);setTimeout(()=>delete this.entries[e],3e3)})),()=>{n.result||(n.callbacks=n.callbacks.filter(e=>e!==r),n.callbacks.length||(n.cancel(),delete this.entries[e]))}}},e.aL=function(e,t,i){const r=JSON.stringify(e.request);return e.data&&(this.deduped.entries[r]={result:[null,e.data]}),this.deduped.request(r,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom},t=>{const r=Vt(e.request,(e,r,n)=>{e?t(e):r&&t(null,{rawData:r,vectorTile:i?void 0:new nh(new zg(r)),responseHeaders:new Map(n.entries())})});return()=>{r.cancel(),t()}},t)},e.aM=function(e){return e?{cacheControl:e.get("Cache-Control"),expires:e.get("Expires")}:{cacheControl:void 0,expires:void 0}},e.aN=kt,e.aO=function(e){Mt++,Mt>wt&&(e.getActor().send("enforceCacheSizeLimit",bt),Mt=0)},e.aP=function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log2(e)))},e.aQ=Jh,e.aR=vv,e.aS=Iv,e.aT=Cc,e.aU=gv,e.aV=function(e,t){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){t(null,i)};for(let r=0;r<e.length;r++){const t=document.createElement("source");Ut(e[r])||(i.crossOrigin="Anonymous"),t.src=e[r],i.appendChild(t)}return{cancel:()=>{}}},e.aW=km,e.aX=Yv,e.aY=je,e.aZ=wx,e.a_=Oc,e.aa=aa,e.ab=class{constructor(e){this.specification=e}possiblyEvaluate(e,t){return Ke(e.expression.evaluate(t))}interpolate(e,t,i){return{x:pi(e.x,t.x,i),y:pi(e.y,t.y,i),z:pi(e.z,t.z,i),azimuthal:pi(e.azimuthal,t.azimuthal,i),polar:pi(e.polar,t.polar,i)}}},e.ac=Js,e.ad=Ho,e.ae=Gc,e.af=j,e.ag=S,e.ah=Fe,e.ai=sa,e.aj=Su,e.ak=pi,e.al=Ur,e.am=fi,e.an=Ce,e.ao=ci,e.ap=class{constructor(e){this.specification=e}possiblyEvaluate(e,t){return function([e,t]){const i=Ke([1,e,t]);return{x:i.x,y:i.y,z:i.z}}(e.expression.evaluate(t))}interpolate(e,t,i){return{x:pi(e.x,t.x,i),y:pi(e.y,t.y,i),z:pi(e.z,t.z,i)}}},e.aq=function(e,t,i=0,r=!0){const n=new Ee(i,i),o=e.sub(n),s=t.add(n),a=[o,new Ee(s.x,o.y),s,new Ee(o.x,s.y)];return r&&a.push(o.clone()),a},e.ar=function(e,t){const i=[];for(let r=0;r<e.length;r++){const n=ke(r-1,-1,e.length-1),o=ke(r+1,-1,e.length-1),s=e[r],a=e[o],l=e[n].sub(s).unit(),c=a.sub(s).unit(),h=c.angleWithSep(l.x,l.y),u=l.add(c).unit().mult(-1*t/Math.sin(h/2));i.push(s.add(u))}return i},e.as=Tx,e.at=Nh,e.au=function(e,t,i=0){return E(((t.x-i)*e.scale-e.x)*Ur,(t.y*e.scale-e.y)*Ur,kc(t.z,t.y))},e.av=Z,e.aw=B,e.ax=fh,e.ay=rg,e.az=function(e){let t=1/0,i=1/0,r=-1/0,n=-1/0;for(const o of e)t=Math.min(t,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);return{min:new Ee(t,i),max:new Ee(r,n)}},e.b=function(e){return at.API_FONTS_REGEX.test(e)},e.b$=$p,e.b0=ll,e.b1=Ga,e.b2=Ve,e.b3=Sl,e.b4=tv,e.b5=function(){Ks.isLoading()||Ks.isLoaded()||"deferred"!==Xs()||Ys()},e.b6=ma,e.b7=Jc,e.b8=Xv,e.b9=Qe,e.bA=c,e.bB=_,e.bC=a,e.bD=function(e,t){const{x:i,y:r}=e.point,n=Tu(i,r,e.worldSize/e._pixelsPerMercatorPixel,0,0);return u(n,n,vu(hu(t)))},e.bE=r,e.bF=H,e.bG=D,e.bH=L,e.bI=V,e.bJ=N,e.bK=my,e.bL=Zg,e.bM=fy,e.bN=function(e,t,i,r,n){const o=5*t+2;e.float32[o+0]=i,e.float32[o+1]=r,e.float32[o+2]=n},e.bO=Kx,e.bP=ue,e.bQ=me,e.bR=pe,e.bS=be,e.bT=ke,e.bU=function(e,t,r,n){var o=new i(4);return o[0]=e,o[1]=t,o[2]=r,o[3]=n,o},e.bV=class{isDataAvailableAtPoint(e){const t=this._source();if(this.isUsingMockSource()||!t||e.y<0||e.y>1)return!1;const i=t.getSource().maxzoom,r=1<<i,n=Math.floor(e.x),o=Math.floor((e.x-n)*r),s=Math.floor(e.y*r),a=this.findDEMTileFor(new Jh(i,n,i,o,s));return!(!a||!a.dem)}getAtPointOrZero(e,t=0){return this.getAtPoint(e,t)||0}getAtPoint(e,t,i=!0){if(this.isUsingMockSource())return null;null==t&&(t=null);const r=this._source();if(!r)return t;if(e.y<0||e.y>1)return t;const n=r.getSource().maxzoom,o=1<<n,s=Math.floor(e.x),a=e.x-s,l=new Jh(n,s,n,Math.floor(a*o),Math.floor(e.y*o)),c=this.findDEMTileFor(l);if(!c||!c.dem)return t;const h=c.dem,u=1<<c.tileID.canonical.z,d=(a*u-c.tileID.canonical.x)*h.dim,p=(e.y*u-c.tileID.canonical.y)*h.dim,f=Math.floor(d),m=Math.floor(p);return(i?this.exaggeration():1)*pi(pi(h.get(f,m),h.get(f,m+1),p-m),pi(h.get(f+1,m),h.get(f+1,m+1),p-m),d-f)}static getAtTileOffset(e,t,i,r){const n=1<<e.canonical.z;return r?r.pointElevation(t):i?i.getAtPointOrZero(new Gc(e.wrap+(e.canonical.x+t.x/Ur)/n,(e.canonical.y+t.y/Ur)/n)):0}static getAtTileOffsetFunc(e,t,i,r){return(n,o,s)=>{const a=this.getAtTileOffset(e,n,o,s),l=r.upVector(e.canonical,n.x,n.y);return z(l,l,a*r.upVectorScale(e.canonical,t,i).metersToTile),l}}getForTilePoints(e,t,i,r){if(this.isUsingMockSource())return!1;const n=kv.create(this,e,r);
vendor: 11,694 bytes, line 2
2return!!n&&(t.forEach(e=>{e[2]=this.exaggeration()*n.getElevationAt(e[0],e[1],i)}),!0)}getMinMaxForTile(e){if(this.isUsingMockSource())return null;const t=this.findDEMTileFor(e);if(!t||!t.dem)return null;const i=t.dem.tree,r=t.tileID,n=1<<e.canonical.z-r.canonical.z;let o=e.canonical.x/n-r.canonical.x,s=e.canonical.y/n-r.canonical.y,a=0;for(let l=0;l<e.canonical.z-r.canonical.z&&!i.leaves[a];l++){o*=2,s*=2;const e=2*Math.floor(s)+Math.floor(o);a=i.childOffsets[a]+e,o%=1,s%=1}return{min:this.exaggeration()*i.minimums[a],max:this.exaggeration()*i.maximums[a]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(e,t,i){throw new Error("Pure virtual method called.")}pointCoordinate(e){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(e){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const e=this.visibleDemTiles;if(0===e.length)return null;let t=!1,i=Number.MAX_VALUE,r=Number.MIN_VALUE;for(const n of e){const e=this.getMinMaxForTile(n.tileID);e&&(i=Math.min(i,e.min),r=Math.max(r,e.max),t=!0)}return t?{min:i,max:r}:null}},e.bW=Lf,e.bX=Ah,e.bY=Sg,e.bZ=kp,e.b_=Cv,e.ba=Q_,e.bb=xp,e.bc=Kc,e.bd=Ua,e.be=yl,e.bf=nu,e.bg=Nl,e.bh=Qu,e.bi=pv,e.bj=function(e,t){const i=Su(t.zoom);if(0===i)return hu(e);const r=fu(e),n=mu(r),o=zc(r.getWest())*t.worldSize,s=zc(r.getEast())*t.worldSize,a=Lc(r.getNorth())*t.worldSize,l=Lc(r.getSouth())*t.worldSize,c=[o,a,0],u=[s,a,0],d=[o,l,0],p=[s,l,0],f=h([],t.globeMatrix);return j(c,c,f),j(u,u,f),j(d,d,f),j(p,p,f),n[0]=uu(n[0],d,i),n[1]=uu(n[1],p,i),n[2]=uu(n[2],u,i),n[3]=uu(n[3],c,i),bh.fromPoints(n)},e.bk=xu,e.bl=h,e.bm=_u,e.bn=uu,e.bo=ja,e.bp=ru,e.bq=g,e.br=d,e.bs=Zw,e.bt=zg,e.bu=Vt,e.bv=function(e,t){const i=[];for(const r in e)r in t||i.push(r);return i},e.bw=Be,e.bx=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.by=Ie,e.bz=l,e.c=ct,e.c$=function(e,t,i){let r=0;for(let n=0;n<2;++n){const i=0;e[n]>i&&(r+=(e[n]-i)*(e[n]-i)),t[n]<i&&(r+=(i-t[n])*(i-t[n]))}return r},e.c0=Zp,e.c1=ny,e.c2=Yy,e.c3=cx,e.c4=tT,e.c5=z,e.c6=X,e.c7=ie,e.c8=function(e,t,i){i*=.5;var r=t[0],n=t[1],o=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=r*l+n*a,e[1]=n*l-r*a,e[2]=o*l+s*a,e[3]=s*l-o*a,e},e.c9=re,e.cA=w,e.cB=vh,e.cC=$m,e.cD=Yh,e.cE=pu,e.cF=function(e,t,i,r,n,o,s,a,l){if("globe"===l.name)return pu(e,t,new Yh(i,r,n),!1);const c=wx({z:i,x:r,y:n},l);return new bh([(o+c.x/c.scale)*t,t*(c.y/c.scale),s],[(o+c.x2/c.scale)*t,t*(c.y2/c.scale),a])},e.cG=function(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e[3]=Math.min(t[3],i[3]),e},e.cH=function(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e[3]=Math.max(t[3],i[3]),e},e.cI=function(e){const t=Math.round((e+45+360)%360/90)%4;return Re[t]},e.cJ=Bc,e.cK=K,e.cL=6,e.cM=function(e){const t=c(new Float64Array(16));u(t,e.pixelMatrix,e.globeMatrix);const i=[0,Tc,0],r=[0,Sc,0];return j(i,i,t),j(r,r,t),[i[0]>0&&i[0]<=e.width&&i[1]>0&&i[1]<=e.height&&!Iu(e,new Cc(e.center.lat,90)),r[0]>0&&r[0]<=e.width&&r[1]>0&&r[1]<=e.height&&!Iu(e,new Cc(e.center.lat,-90))]},e.cN=function(e,t){const{scale:i}=e.tileTransform,r=i*Ur/(e.tileSize*Math.pow(2,t.zoom-e.tileID.overscaledZ+e.tileID.canonical.z));return function(e,t,i){var r=t[1],n=t[2],o=t[3],s=i[0],a=i[1];return e[0]=t[0]*s,e[1]=r*s,e[2]=n*a,e[3]=o*a,e}(new Float32Array(4),t.inverseAdjustmentMatrix,[r,r])},e.cO=Zm,e.cP=b,e.cQ=Hm,e.cR=function(e){const t=Hm(e,!0);return r([],[t[0],t[1],t[4],t[5]])},e.cS=p,e.cT=mh,e.cU=f,e.cV=function(e){const{x:t,y:i}=e.point,{lng:r,lat:n}=e._center;return Tu(t,i,e.worldSize,r,n)},e.cW=C,e.cX=Pe,e.cY=Qh,e.cZ=Vh,e.c_=5,e.ca=tt,e.cb=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},e.cc=v,e.cd=function(e,t,i,r,n){var o=1/Math.tan(t/2);if(e[0]=o/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0){var s=1/(r-n);e[10]=(n+r)*s,e[14]=2*n*r*s}else e[10]=-1,e[14]=-2*r;return e},e.ce=function(e,t,i,r,n,o,s){var a=1/(t-i),l=1/(r-n),c=1/(o-s);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+i)*a,e[13]=(n+r)*l,e[14]=(s+o)*c,e[15]=1,e},e.cf=Dc,e.cg=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.ch=Xl,e.ci=Jl,e.cj=Yl,e.ck=Kl,e.cl=ic,e.cm=qx,e.cn=function(){var e=new i(4);return i!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e},e.co=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=r*l+o*a,e[1]=n*l+s*a,e[2]=r*-a+o*l,e[3]=n*-a+s*l,e},e.cp=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},e.cq=$,e.cr=function(e){var t=e[0],i=e[1],r=e[2],n=e[3];return Math.sqrt(t*t+i*i+r*r+n*n)},e.cs=le,e.ct=q,e.cu=Kh,e.cv=3,e.cw=2,e.cx=7,e.cy=6,e.cz=U,e.d=function(e){return at.API_TILEJSON_REGEX.test(e)},e.d$=class{constructor(e,t,i,r){this.context=e,this.format=r,this.size=i,this.texture=e.gl.createTexture();const[n,o,s]=this.size,{gl:a}=e;a.bindTexture(a.TEXTURE_3D,this.texture),e.pixelStoreUnpackFlipY.set(!1),e.pixelStoreUnpack.set(1),e.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in t&&t.data&&a.texImage3D(a.TEXTURE_3D,0,this.format,n,o,s,0,Dm(this.format),Om(this.format),t.data)}bind(e,t){const{context:i}=this,{gl:r}=i;r.bindTexture(r.TEXTURE_3D,this.texture),e!==this.minFilter&&(r.texParameteri(r.TEXTURE_3D,r.TEXTURE_MAG_FILTER,e),r.texParameteri(r.TEXTURE_3D,r.TEXTURE_MIN_FILTER,e),this.minFilter=e),t!==this.wrapS&&(r.texParameteri(r.TEXTURE_3D,r.TEXTURE_WRAP_S,t),r.texParameteri(r.TEXTURE_3D,r.TEXTURE_WRAP_T,t),this.wrapS=t)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}},e.d0=function(e){return e*e*e*e*e},e.d1=Rc,e.d2=45,e.d3=Ql,e.d4=function(e,t,i){const r=Math.sqrt(e*e+t*t+i*i),n=r>0?Math.acos(i/r)*Me:0;let o=0!==e||0!==t?Math.atan2(-t,-e)*Me+90:0;return o<0&&(o+=360),[r,o,n]},e.d5=E,e.d6=Ke,e.d7=jc,e.d8=A,e.d9=bh,e.dA=function(e){return e({pluginStatus:qs,pluginURL:Hs}),Ws.on("pluginStateChange",e),e},e.dB=ec,e.dC=class extends Wl{constructor(e){super(e),this.current=rc}set(e,t,i){if(this.fetchUniformLocation(e,t))for(let r=0;r<9;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}},e.dD=ze,e.dE=function(e,t,i){const r=Su(i.zoom),n=e.style.map._antialias,o=e.terrain&&e.terrain.exaggeration()>0;return 0===r&&!n&&!o},e.dF=function(e){const t=e.pixelsPerMeter,i=t/Dc(1,e.center.lat),r=c(new Float64Array(16));return d(r,r,[e.point.x,e.point.y,0]),p(r,r,[i,i,t]),Float32Array.from(r)},e.dG=fu,e.dH=function(e){const t=80.051129;e=Oe(e,-80.051129,t)/t*90;const i=Math.pow(Math.abs(Math.sin(Ce(e))),3);return Math.round(i*(wc.length-1))},e.dI=function(e,t,i,r){const n=t.getNorth(),o=t.getSouth(),a=t.getWest(),l=t.getEast(),c=1<<e.z,h=l-a,u=n-o,d=h/bc,p=-u/wc[i],f=[0,d,0,p,0,0,n,a,0];if(e.z>0){const e=180/r;s(f,f,[e/h+1,0,0,0,e/u+1,0,-.5*e/d,.5*e/p,1])}return f[2]=c,f[5]=e.x,f[8]=e.y,f},e.dJ=hu,e.dK=function(e,t,i){const r=c(new Float64Array(16)),n=(t/(1<<e)-.5)*Math.PI*2;return m(r,i.globeMatrix,n),Float32Array.from(r)},e.dL=Zu,e.dM=ou,e.dN=function(e,t){return[Math.pow(e[0],2.2)*t,Math.pow(e[1],2.2)*t,Math.pow(e[2],2.2)*t]},e.dO=n,e.dP=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},e.dQ=G,e.dR=wu,e.dS=nt,e.dT=ot,e.dU=yv,e.dV=function(e,t){const i=[0,0,0];return j(i,i,xu(hu(t.canonical))),j(i,i,e),i},e.dW=e=>({u_matrix:new ic(e),u_texsize:new Kl(e),u_pixels_to_tile_units:new oc(e),u_device_pixel_ratio:new Yl(e),u_width_scale:new Yl(e),u_floor_width_scale:new Yl(e),u_image:new Xl(e),u_units_to_pixels:new Kl(e),u_tile_units_to_pixels:new Yl(e),u_alpha_discard_threshold:new Yl(e),u_trim_offset:new Kl(e),u_trim_fade_range:new Kl(e),u_trim_gradient_mix_range:new Kl(e),u_trim_color:new Ql(e),u_zbias_factor:new Yl(e),u_tile_to_meter:new Yl(e),u_ground_shadow_factor:new Jl(e),u_pattern_transition:new Yl(e)}),e.dX=e=>({u_matrix:new ic(e),u_pixels_to_tile_units:new oc(e),u_device_pixel_ratio:new Yl(e),u_width_scale:new Yl(e),u_floor_width_scale:new Yl(e),u_units_to_pixels:new Kl(e),u_dash_image:new Xl(e),u_gradient_image:new Xl(e),u_image_height:new Yl(e),u_texsize:new Kl(e),u_tile_units_to_pixels:new Yl(e),u_alpha_discard_threshold:new Yl(e),u_trim_offset:new Kl(e),u_trim_fade_range:new Kl(e),u_trim_gradient_mix_range:new Kl(e),u_trim_color:new Ql(e),u_zbias_factor:new Yl(e),u_tile_to_meter:new Yl(e),u_ground_shadow_factor:new Jl(e)}),e.dY=e=>({u_camera_to_center_distance:new Yl(e),u_extrude_scale:new oc(e),u_device_pixel_ratio:new Yl(e),u_matrix:new ic(e),u_inv_rot_matrix:new ic(e),u_merc_center:new Kl(e),u_tile_id:new Jl(e),u_zoom_transition:new Yl(e),u_up_dir:new Jl(e),u_emissive_strength:new Yl(e)}),e.dZ=sl,e.d_=Tg,e.da=M,e.db=function(e){return[Math.pow(e[0],1/2.2),Math.pow(e[1],1/2.2),Math.pow(e[2],1/2.2)]},e.dc=Lm,e.dd=y_,e.de=n_,e.df=Rv,e.dg=function(e,t){return e.readFields(tb,{icons:[]},t)},e.dh=Kf,e.di=zy,e.dj=Ry,e.dk=Bt,e.dl=$s,e.dm=xt,e.dn=Qt,e.dp=He,e.dq=function(e){const t=e.indexOf(Aa);return t>=0?e.slice(0,t):e},e.dr=function(e){return e.indexOf(Aa)>=0},e.ds=function(e){const t=e.lastIndexOf(Aa);return t>=0?e.slice(t+1):""},e.dt=function(e){const t=[],i=e.id;return void 0===i&&t.push({message:`layers.${i}: missing required property "id"`}),void 0===e.render&&t.push({message:`layers.${i}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),t},e.du=function(e,t,i,r){return"custom"===e.type?new Av(e,t):new Qv[e.type](e,t,i,r)},e.dv=qe,e.dw=function(e){const t=e.indexOf(Aa);return t>=0?e.slice(t+1):""},e.dx=class extends Xv{constructor(e,t){super(e._vectorTileFeature,e._z,e._x,e._y,e.id),e.state&&(this.state=Object.assign({},e.state)),this.target=t.target,this.namespace=t.namespace,t.properties&&(this.properties=t.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=e.source,this.sourceLayer=e.sourceLayer,this.layer=e.layer)}toJSON(){const e=super.toJSON();return e.target=this.target,e.namespace=this.namespace,e}},e.dy=Ws,e.dz=Nt,e.e=at,e.e$=I,e.e0=Ru,e.e1=(e,t,i,r,n,o)=>{const s=e.transform,a="globe"===s.projection.name;let l;if("map"===o.paint.get("circle-pitch-alignment"))if(a){const e=wu(s.zoom,t.canonical)*s._pixelsPerMercatorPixel;l=Float32Array.from([e,0,0,e])}else l=s.calculatePixelsToTileUnitsMatrix(i);else l=new Float32Array([s.pixelsToGLUnits[0],0,0,s.pixelsToGLUnits[1]]);const c={u_camera_to_center_distance:e.transform.getCameraToCenterDistance(s.projection),u_matrix:e.translatePosMatrix(t.projMatrix,i,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_device_pixel_ratio:gt.devicePixelRatio,u_extrude_scale:l,u_inv_rot_matrix:Pu,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:o.paint.get("circle-emissive-strength")};if(a){c.u_inv_rot_matrix=r,c.u_merc_center=n,c.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],c.u_zoom_transition=Su(s.zoom);const e=n[0]*Ur,i=n[1]*Ur;c.u_up_dir=s.projection.upVector(new Yh(0,0,0),e,i)}return c},e.e2=ag,e.e3=Ni,e.e4=(e,t,i,r,n,o,s,a,l,c)=>{const h=e.transform,u=h.pitch<15?ng(.07,.7,Oe((14-h.zoom)/5,0,1)):.07,d="none"===i.paint.get("line-trim-color-use-theme").
vendor: 7,402 bytes, line 2
2constantOr("default");return{u_matrix:sg(e,t,i,r),u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:h.calculatePixelsToTileUnitsMatrix(t),u_device_pixel_ratio:n,u_width_scale:o,u_floor_width_scale:s,u_image:0,u_tile_units_to_pixels:og(t,h),u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:a,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(d?null:i.lut).toArray01(),u_zbias_factor:u,u_tile_to_meter:jc(t.tileID.canonical,0),u_ground_shadow_factor:l,u_pattern_transition:c}},e.e5=(e,t,i,r,n,o,s,a,l,c)=>{const h=e.transform,u=h.calculatePixelsToTileUnitsMatrix(t),d="none"===i.paint.get("line-trim-color-use-theme").constantOr("default"),p=h.pitch<15?ng(.07,.7,Oe((14-h.zoom)/5,0,1)):.07;return{u_matrix:sg(e,t,i,r),u_pixels_to_tile_units:u,u_device_pixel_ratio:o,u_width_scale:s,u_floor_width_scale:a,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:n,u_texsize:lg(i)&&t.lineAtlasTexture?t.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:og(t,e.transform),u_alpha_discard_threshold:0,u_trim_offset:l,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(d?null:i.lut).toArray01(),u_zbias_factor:p,u_tile_to_meter:jc(t.tileID.canonical,0),u_ground_shadow_factor:c}},e.e6=Ue,e.e7=Wu,e.e8=kc,e.e9=eu,e.eA=function(e,i){var r=2*Math.acos(i[3]),n=Math.sin(r/2);return n>t?(e[0]=i[0]/n,e[1]=i[1]/n,e[2]=i[2]/n):(e[0]=1,e[1]=0,e[2]=0),r},e.eB=Kv,e.eC=r_,e.eD=Qm,e.eE=[1,1,1],e.eF=kv,e.eG=Y,e.eH=function(e,t,i,r){var n=t[0],o=t[1],s=t[2],a=t[3];return e[0]=n+r*(i[0]-n),e[1]=o+r*(i[1]-o),e[2]=s+r*(i[2]-s),e[3]=a+r*(i[3]-a),e},e.eI=i_,e.eJ=rl,e.eK=_l,e.eL=function(e,t,r,n,o,s,a,l,c,h,u,d,p,f,m,_){var g=new i(16);return g[0]=e,g[1]=t,g[2]=r,g[3]=n,g[4]=o,g[5]=s,g[6]=a,g[7]=l,g[8]=c,g[9]=h,g[10]=u,g[11]=d,g[12]=p,g[13]=f,g[14]=m,g[15]=_,g},e.eM=Ac,e.eN=ml,e.eO=fl,e.eP=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new Ee(1/0,1/0),max:new Ee(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(e,t=!1){const i=jp(new Ee(0,0),new Ee(Ur,Ur),e),r=[];if(t&&!Vp(i,this._globalClipBounds))return r;for(const n of this._activeRegions){if(n.hiddenByOverlap)continue;if(!Vp(i,n))continue;const t=Gp(n.min,n.max,e);r.push({min:t.min,max:t.max,sourceId:this._sourceIds[n.priority],footprint:n.footprint,footprintTileId:n.tileId,order:n.order,clipMask:n.clipMask,clipScope:n.clipScope})}return r}setSources(e){this._setSources(e.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const t=[];for(const i of e.cache.getVisibleCoordinates()){const r=e.cache.getTile(i).buckets[e.layer];r&&r.updateFootprints(i.toUnwrapped(),t)}return t},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(e){const t=e.getFootprints();if(0===t.length)return;const i=e.getOrder(),r=e.getClipMask(),n=e.getClipScope();for(const o of t){if(!o.footprint)continue;const e=jp(o.footprint.min,o.footprint.max,o.id);this._activeRegions.push({min:e.min,max:e.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:o.id,footprint:o.footprint,order:i,clipMask:r,clipScope:n})}this._sourceIds.push(e.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,t)=>e.priority-t.priority||Bp(e.min,t.min)||Bp(e.max,t.max)||e.order-t.order||e.clipMask-t.clipMask||function(e,t){const i=(e,t)=>e+t;return e.length-t.length||e.reduce(i,"").localeCompare(t.reduce(i,""))}(e.clipScope,t.clipScope));let e=this._activeRegions.length!==this._prevRegions.length;if(!e){let t=0;for(;!e&&t!==this._activeRegions.length;){const i=this._activeRegions[t],r=this._prevRegions[t];e=i.priority!==r.priority||!Np(i,r)||i.order!==r.order||i.clipMask!==r.clipMask||!Ie(i.clipScope,r.clipScope),this._activeRegions[t].hiddenByOverlap=r.hiddenByOverlap,++t}}if(e){++this._updateTime;for(const t of this._activeRegions)t.order!==Op&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,t.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,t.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,t.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,t.max.y));const e=e=>{const t=this._activeRegions;if(e>=t.length)return e;const i=t[e].priority;for(;e<t.length&&t[e].priority===i;)++e;return e};if(this._sourceIds.length>1){let t=0,i=e(t);for(;t!==i;){let r=t;const n=t;for(;r!==i;){const e=this._activeRegions[r];e.hiddenByOverlap=!1;for(let t=0;t<n;t++){const i=this._activeRegions[t];if(!i.hiddenByOverlap&&e.order===Op&&Vp(e,i)&&(e.hiddenByOverlap=Hp(e.footprint,e.tileId,i.footprint,i.tileId),e.hiddenByOverlap))break}++r}t=i,i=e(t)}}}}_setSources(e){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let t=e.length-1;t>=0;t--)this._addSource(e[t]);this._computeReplacement()}},e.eQ=Op,e.eR=class{constructor(e){this._createGrid(e),this._createPoles(e)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const e of this._poleSegments)e.destroy();for(const e of this._gridSegments)e.withSkirts.destroy(),e.withoutSkirts.destroy()}_fillGridMeshWithLods(e,t){const i=new Ua,r=new ll,n=[],o=e+1+2,s=t[0]+1,a=t[0]+1+(1+t.length),l=(e,t,i)=>{let r=e===o-1?e-2:0===e?e:e-1;return r+=i?24575:0,[r,t]};for(let c=0;c<o;++c)i.emplaceBack(...l(c,0,!0));for(let c=0;c<s;++c)for(let e=0;e<o;++e)i.emplaceBack(...l(e,c,(0===e||e===o-1)&&!0));for(let c=0;c<t.length;++c){const e=t[c];for(let t=0;t<o;++t)i.emplaceBack(...l(t,e,!0))}for(let c=0;c<t.length;++c){const e=r.length,s=t[c]+1+2,l=new ll;for(let i=0;i<s-1;i++){const e=i===s-2,n=e?o*(a-t.length+c-i):o;for(let t=0;t<o-1;t++){const s=i*o+t;0===i||e||0===t||t===o-2?(l.emplaceBack(s+1,s,s+n),l.emplaceBack(s+n,s+n+1,s+1)):(r.emplaceBack(s+1,s,s+n),r.emplaceBack(s+n,s+n+1,s+1))}}const h=Nl.simpleSegment(0,e,i.length,r.length-e);for(let t=0;t<l.uint16.length;t+=3)r.emplaceBack(l.uint16[t],l.uint16[t+1],l.uint16[t+2]);const u=Nl.simpleSegment(0,e,i.length,r.length-e);n.push({withoutSkirts:h,withSkirts:u})}return{vertices:i,indices:r,segments:n}}_createGrid(e){const t=this._fillGridMeshWithLods(bc,wc);this._gridSegments=t.segments,this._gridBuffer=e.createVertexBuffer(t.vertices,nu.members),this._gridIndexBuffer=e.createIndexBuffer(t.indices,!0)}_createPoles(e){const t=new ll;for(let s=0;s<=bc;s++)t.emplaceBack(0,s+1,s+2);this._poleIndexBuffer=e.createIndexBuffer(t,!0);const i=new dl,r=new dl,n=new dl,o=new dl;this._poleSegments=[];for(let s=0,a=0;s<5;s++){const e=360/(1<<s);i.emplaceBack(0,-vc,0,.5,0),r.emplaceBack(0,-vc,0,.5,1),n.emplaceBack(0,-vc,0,.5,.5),o.emplaceBack(0,-vc,0,.5,.5);for(let t=0;t<=bc;t++){let s=t/bc,a=0;const l=pi(0,e,s),[c,h,u]=Ec(Mu,Cu,l,vc);i.emplaceBack(c,h,u,s,a),r.emplaceBack(c,h,u,s,1-a);const d=Ce(l);s=.5+.5*Math.sin(d),a=.5+.5*Math.cos(d),n.emplaceBack(c,h,u,s,a),o.emplaceBack(c,h,u,s,1-a)}
2this._poleSegments.push(Nl.simpleSegment(a,0,66,64)),a+=66}this._poleNorthVertexBuffer=e.createVertexBuffer(i,iu,!1),this._poleSouthVertexBuffer=e.createVertexBuffer(r,iu,!1),this._texturedPoleNorthVertexBuffer=e.createVertexBuffer(n,iu,!1),this._texturedPoleSouthVertexBuffer=e.createVertexBuffer(o,iu,!1)}getGridBuffers(e,t){return[this._gridBuffer,this._gridIndexBuffer,t?this._gridSegments[e].withSkirts:this._gridSegments[e].withoutSkirts]}getPoleBuffers(e,t){return[t?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,t?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[e]]}},e.eS=Fp,e.eT=Le,e.eU=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},e.eV=De,e.eW=Uc,e.eX=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.eY=W,e.eZ=Ic,e.e_=F,e.ea=mf,e.eb=Sf,e.ec=rf,e.ed=450,e.ee=7,e.ef=Vc,e.eg=function(e,t){if(e===t){var i=t[1],r=t[2],n=t[3],o=t[6],s=t[7],a=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=i,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=o,e[11]=t[14],e[12]=n,e[13]=s,e[14]=a}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e},e.eh=xv,e.ei=Na,e.ej=bl,e.ek=256,e.el=vu,e.em=Xa,e.en=m,e.eo=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e},e.ep=dl,e.eq=go,e.er=pl,e.es=function(e,t,i,r,n){return Oe((e-t)/(i-t)*(n-r)+r,r,n)},e.et=ne,e.eu=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],h=t[8],u=h*s-a*c,d=-h*o+a*l,p=c*o-s*l,f=i*u+r*d+n*p;return f?(e[0]=u*(f=1/f),e[1]=(-h*r+n*c)*f,e[2]=(a*r-n*s)*f,e[3]=d*f,e[4]=(h*i-n*l)*f,e[5]=(-a*i+n*o)*f,e[6]=p*f,e[7]=(-c*i+r*l)*f,e[8]=(s*i-r*o)*f,e):null},e.ev=2,e.ew=k,e.ex=te,e.ey=x,e.ez=function(e,t){var r=new i(3);x(r,t);var n=1/r[0],o=1/r[1],s=1/r[2],a=t[0]*n,l=t[1]*o,c=t[2]*s,h=t[4]*n,u=t[5]*o,d=t[6]*s,p=t[8]*n,f=t[9]*o,m=t[10]*s,_=a+u+m,g=0;return _>0?(g=2*Math.sqrt(_+1),e[3]=.25*g,e[0]=(d-f)/g,e[1]=(p-c)/g,e[2]=(l-h)/g):a>u&&a>m?(g=2*Math.sqrt(1+a-u-m),e[3]=(d-f)/g,e[0]=.25*g,e[1]=(l+h)/g,e[2]=(p+c)/g):u>m?(g=2*Math.sqrt(1+u-a-m),e[3]=(p-c)/g,e[0]=(l+h)/g,e[1]=.25*g,e[2]=(d+f)/g):(g=2*Math.sqrt(1+m-a-u),e[3]=(l-h)/g,e[0]=(p+c)/g,e[1]=(d+f)/g,e[2]=.25*g),e},e.f=function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(Number("0x"+t))))},e.f0=function([e,t,i]){const r=Math.hypot(e,t,i),n=Math.atan2(e,i),o=.5*Math.PI-Math.acos(-t/r);return new Cc(Pe(n),Pe(o))},e.f1=J,e.f2=Xm,e.f3=function(e){const t=e.navigator?e.navigator.userAgent:null;return!!function(e){if(null==et){const t=e.navigator?e.navigator.userAgent:null;et=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return et}(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.f4=function(e,t){bt=e,wt=t},e.f5=Iu,e.f6=Eu,e.f7=function(e){const t=[0,0,0],i=c(new Float64Array(16));return u(i,e.pixelMatrix,e.globeMatrix),j(t,t,i),new Ee(t[0],t[1])},e.f8=function(){const e=Xf;e&&(e.isPreloaded()&&1===e.numActive()?(e.release($f),Xf=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},e.f9=function(){Kf().acquire($f)},e.fA=iw,e.fB=Qc,e.fC=function(e){let t=0;if(new Uint32Array(e,0,1)[0]!==Im){const i=new Uint32Array(e,0,7),[,,r,n,o,s]=i;t=i.byteLength+n+o+s+o,(r!==e.byteLength||t>=e.byteLength)&&We("Invalid b3dm header information.")}return zm(e,t)},e.fD=function(e,t){const i=y_(e);for(const r of i){for(const e of r.meshes)x_(e);r.lights&&(r.lightMeshIndex=r.meshes.length,r.meshes.push(b_(r.lights,t)))}return i},e.fE=qv,e.fF=Je,e.fG=Gf,e.fH=Ks,e.fI=js,e.fJ=function(e){At(),null!=St&&St.then(t=>{t.keys().then(i=>{for(let r=0;r<i.length-e;r++)t.delete(i[r]).catch(e=>We(e.message))}).catch(e=>We(e.message))}).catch(e=>We(e.message))},e.fa=Xs,e.fb=function(e,t,i=!1){if(qs===js.deferred||qs===js.loading||qs===js.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");Hs=gt.resolveURL(e),qs=js.deferred,Gs=t,Zs(),i||Ys()}
vendor: 4,634 bytes, line 2
2,e.fc=function(e){rm=gt.resolveURL(e),om||(om=new Wf(Kf(),new ni)),om.broadcast("setMeshoptUrl",rm)},e.fd=hm,e.fe=function(e){tm=gt.resolveURL(e),om||(om=new Wf(Kf(),new ni)),om.broadcast("setDracoUrl",tm)},e.ff=cm,e.fg=qf,e.fh=function(e){const t=It();if(!t)return;const i=t.delete(vt);e&&i.then(()=>e()).catch(e)},e.fi=Zf,e.fj=es,e.fk=Hu,e.fl=2,e.fm=Yw,e.fn=Kw,e.fo=X_,e.fp=sh,e.fq="hd_road_elevation",e.fr=Sh,e.fs=Ge,e.ft=Pd,e.fu=Iy,e.fv=1,e.fw=function(e,t,i,r,n,o,s,a=1,l,c,h,u){e.createArrays(),e.tilePixelRatio=Ur/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;const d=e.layers[0].layout,p=e.layers[0]._unevaluatedLayout._values,f={};f.scaleFactor=a,f.textSizeScaleRange=d.get("text-size-scale-range"),f.iconSizeScaleRange=d.get("icon-size-scale-range");const[m,_]=f.textSizeScaleRange,[g,y]=f.iconSizeScaleRange;f.textScaleFactor=Oe(f.scaleFactor,m,_),f.iconScaleFactor=Oe(f.scaleFactor,g,y);const x=p["text-size"],v=p["icon-size"];if("composite"===e.textSizeData.kind){const{minZoom:t,maxZoom:i}=e.textSizeData;f.compositeTextSizes=[x.possiblyEvaluate(new Js(t,{worldview:h}),o),x.possiblyEvaluate(new Js(i,{worldview:h}),o)]}if("composite"===e.iconSizeData.kind){const{minZoom:t,maxZoom:i}=e.iconSizeData;f.compositeIconSizes=[v.possiblyEvaluate(new Js(t,{worldview:h}),o,u),v.possiblyEvaluate(new Js(i,{worldview:h}),o,u)]}f.layoutTextSize=x.possiblyEvaluate(new Js(s+1,{worldview:h}),o),f.layoutIconSize=v.possiblyEvaluate(new Js(s+1,{worldview:h}),o,u),f.textMaxSize=x.possiblyEvaluate(new Js(18,{worldview:h}),o);const b=d.get("symbol-placement"),w="map"===d.get("text-rotation-alignment")&&"point"!==b,T=d.get("text-size");let S=!1;const E=[];for(const I of e.features){const s=d.get("text-font").evaluate(I,{},o).join(","),a=T.evaluate(I,{},o)*f.textScaleFactor,m=f.layoutTextSize.evaluate(I,{},o)*f.textScaleFactor,_=f.layoutIconSize.evaluate(I,{},o,u)*f.iconScaleFactor,g={horizontal:{},vertical:void 0},y=I.text;let x,v=[0,0];if(y){const r=y.toString(),c=d.get("text-letter-spacing").evaluate(I,{},o)*Sg,h=d.get("text-line-height").evaluate(I,{},o)*Sg,u=zs(r)?c:0,p=d.get("text-anchor").evaluate(I,{},o),f=d.get("text-variable-anchor");if(!f){const e=d.get("text-radial-offset").evaluate(I,{},o);if(e)v=Yy(p,[e*Sg,Zy]);else{const e=d.get("text-offset").evaluate(I,{},o);v=[e[0]*Sg,e[1]*Sg]}}let _=w?"center":d.get("text-justify").evaluate(I,{},o);const x="point"===b,T=x?d.get("text-max-width").evaluate(I,{},o)*Sg:1/0,S=o=>{e.allowVerticalPlacement&&Rs(r)&&(g.vertical=Yg(y,t,i,n,s,T,h,p,o,u,v,Zg.vertical,!0,m,a,l))};if(!w&&f){const e="auto"===_?f.map(e=>cx(e)):[_];let r=!1;for(let o=0;o<e.length;o++){const c=e[o];if(!g.horizontal[c])if(r)g.horizontal[c]=g.horizontal[0];else{const e=Yg(y,t,i,n,s,T,h,"center",c,u,v,Zg.horizontal,!1,m,a,l);e&&(g.horizontal[c]=e,r=1===e.positionedLines.length)}}S("left")}else{if("auto"===_&&(_=cx(p)),x||d.get("text-writing-mode").indexOf("horizontal")>=0||!Rs(r)){const e=Yg(y,t,i,n,s,T,h,p,_,u,v,Zg.horizontal,!1,m,a,l);e&&(g.horizontal[_]=e)}S(x?"left":_)}}let A,M,C,P,R,z,L=!1;const D=d.get("icon-text-fit").evaluate(I,{},o);if(I.icon&&I.icon.hasPrimary()){const t=nx(I.icon,e.iconSizeData,p["icon-size"],o,e.zoom,I,l,f.iconScaleFactor,h,u);A=t.iconPrimary,C=t.iconSecondary;const i=A.toString();if(M=r.get(i),M&&(R=d.get("icon-offset").evaluate(I,{},o),z=d.get("icon-anchor").evaluate(I,{},o),x=ay(n.get(i),C?n.get(C.toString()):void 0,R,z),L=M.sdf,void 0===e.sdfIcons?e.sdfIcons=M.sdf:e.sdfIcons!==M.sdf&&We("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(M.pixelRatio!==e.pixelRatio||0!==d.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0)),C){const e=C.toString();P=r.get(e)}}S=S||!(!I.icon||!I.icon.hasSecondary());const O=gx(g.horizontal)||g.vertical;e.iconsInText||(e.iconsInText=!!O&&O.iconsInText);const F=m*f.textScaleFactor/Sg,{defaultShapedIcon:k,verticallyShapedIcon:B}=hx(e,x,d,I,o,g,F,R,D);"none"!==D&&x&&(cy(x)||hy(x))&&(ix(0,M,A,x,k,D,c,r,n),ix(0,P,C,x,k,D,c,r,n),B&&(ix(0,M,A,x,B,D,c,r,n),ix(0,P,C,x,B,D,c,r,n))),x=k;const{iconBBox:N,iconVerticalBBox:V,textBBox:U,textVerticalBBox:j}=Ky(e,x,B,d,I,o,_,R,f,n,z,g,m,v,u);E.push({feature:I,shapedTextOrientations:g,shapedText:O,shapedIcon:x,iconPrimary:A,iconSecondary:C,iconOffset:R,iconAnchor:z,verticallyShapedIcon:B,layoutTextSize:m,layoutIconSize:_,textOffset:v,isSDFIcon:L,iconTextFit:D,iconCollisionBounds:N,iconVerticalCollisionBounds:V,textCollisionBounds:U,textVerticalCollisionBounds:j})}return{featureData:E,sizes:f,hasAnySecondaryIcon:S,textAlongLine:w,symbolPlacement:b}},e.fx=Ay,e.fy=function(e,t,i,r,n,o,s,a,l,c){e.iconAtlasPositions=c.iconPositions;
2const{featureData:h,hasAnySecondaryIcon:u,sizes:d,textAlongLine:p,symbolPlacement:f}=t;for(const m of h){const{shapedIcon:t,verticallyShapedIcon:i,feature:o,shapedTextOrientations:h,shapedText:_,layoutTextSize:g,textOffset:y,isSDFIcon:x,iconPrimary:v,iconSecondary:b,iconTextFit:w,iconOffset:T,iconCollisionBounds:S,iconVerticalCollisionBounds:E,textCollisionBounds:I}=m;sx(t,c.iconPositions,v,b),sx(i,c.iconPositions,v,b),ax(h,c.iconPositions),ox(v,b,c.iconPositions),(_||t)&&dx(e,o,h,t,i,l,d,g,0,y,x,r,n,s,a,u,w,T,p,f,S,E,I)}i&&e.generateCollisionDebugBuffers(o,e.collisionBoxArray,d.textScaleFactor)},e.fz=nh,e.g=function(e,t){return Nt(Object.assign(e,{method:"GET"}),t)},e.h=function(e){return 0===e.indexOf("mapbox:")},e.i=function(e){return at.API_STYLE_REGEX.test(e)&&!ct(e)},e.j=lt,e.k=Ct,e.l=function(e){return decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},e.m=function(e,t){return Nt(Object.assign(e,{type:"json"}),t)},e.n=Ht,e.o=gt,e.p=function(e,t){return Nt(Object.assign(e,{method:"POST"}),t)},e.q=$u,e.r=_t,e.s=function(e){try{const t=self[e];return t.setItem("_mapbox_test_",1),t.removeItem("_mapbox_test_"),!0}catch(e){return!1}},e.t=function(){return Yf||(Yf=new Zf("ImageRasterizer")),Yf},e.u=function(){return function e(t){return t?(t^Math.random()*(16>>t/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()},e.v=function(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)},e.w=We,e.x=qb,e.y=ti,e.z=ei}),r(["./shared"],function(e){function t(e){const t=e?e.url.toString():void 0;return t?performance.getEntriesByName(t):[]}function i(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){let t="[";for(const r of e)t+=`${i(r)},`;return`${t}]`}let t="{";for(const r of Object.keys(e).sort())t+=`${r}:${i(e[r])},`;return`${t}}`}function r(t){let r="";for(const n of e.bx)r+=`/${i(t[n])}`;return r}function n(e,t){return function e(i){return"string"==typeof i&&i===t||(Array.isArray(i)?i.some(e):!(!i||"object"!=typeof i)&&Object.values(i).some(e))}(e)}class o{constructor(e){this.keyCache={},this._layers={},this._layerConfigs={},e&&this.replace(e)}replace(e,t){this._layerConfigs={},this._layers={},this.update(e,[],t)}update(t,o,s){this._options=s;for(const i of t)this._layerConfigs[i.id]=i,(this._layers[i.id]=e.du(i,this.scope,null,this._options)).compileFilter(s),this.keyCache[i.id]&&delete this.keyCache[i.id];for(const e of o)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const a=function(e,t){const o={};for(let a=0;a<e.length;a++){const s=e[a];let l=t&&t[s.id];l||("symbol"===s.type?l=s.id:(l=r(s),"line"===s.type&&s.paint&&n(s.paint["line-width"],"line-progress")&&(l+=`/${i(s.paint["line-width"])}`))),t&&(t[s.id]=l);let c=o[l];c||(c=o[l]=[]),c.push(s)}const s=[];for(const i in o)s.push(o[i]);return s}(Object.values(this._layerConfigs),this.keyCache);for(const e of a){const t=e.map(e=>this._layers[e.id]),i=t[0];if("none"===i.visibility)continue;const r=i.source||"";let n=this.familiesBySource[r];n||(n=this.familiesBySource[r]={});const o=i.sourceLayer||"_geojsonTileLayer";let s=n[o];s||(s=n[o]=[]),s.push(t)}}}const s=1*e.fl;class a{constructor(t){const i={},r=[];for(const e in t){const n=t[e],o=i[e]={};for(const e in n.glyphs){const t=n.glyphs[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const i=t.metrics.localGlyph?s:1,a={x:0,y:0,w:t.bitmap.width+2*i,h:t.bitmap.height+2*i};r.push(a),o[e]=a}}const{w:n,h:o}=e.G(r),a=new e.fk({width:n||1,height:o||1});for(const l in t){const r=t[l];for(const t in r.glyphs){const n=r.glyphs[+t];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const o=i[l][t],c=n.metrics.localGlyph?s:1;e.fk.copy(n.bitmap,a,{x:0,y:0},{x:o.x+c,y:o.y+c},n.bitmap)}}this.image=a,this.positions=i}}function l(e,t,i){e[t]?i&&(e[t].center=i):e[t]={floorIds:new Set,center:i||[0,0],floors:{}}}function c(e,t,i,r){for(const n of t)l(e,n),e[n].floors[i]=r,e[n].floorIds.add(i)}function h(e){return{id:e.properties.id.toString(),center:e.properties.center.toString().split(";").map(Number)}}function u(e){return{id:e.properties.id.toString(),isDefault:!!e.properties.is_default&&e.properties.is_default,connections:e.properties.connected_floor_ids?new Set(e.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:e.properties.conflicted_floor_ids?new Set(e.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:e.properties.building_ids?new Set(e.properties.building_ids.toString().split(";")):new Set,name:e.properties.name.toString(),zIndex:e.properties.z_index}}function d(e,t){return t.every(t=>e.properties&&null!=e.properties[t])}function p(e){return d(e,["type","id","name"])&&"building"===e.properties.type}function f(e){return d(e,["type","id","name","z_index"])&&"floor"===e.properties.type}e.fj(a,"GlyphAtlas");class m{constructor(t){this.tileID=new e.aQ(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.lut=t.lut,this.canonical=t.tileID.canonical,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.scope=t.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.request&&t.request.collectResourceTiming,this.promoteId=t.promoteId,this.isSymbolTile=t.isSymbolTile,this.tileTransform=e.aZ(t.tileID.canonical,t.projection),this.projection=t.projection,this.worldview=t.worldview,this.localizableLayerIds=t.localizableLayerIds,this.brightness=t.brightness,this.extraShadowCaster=!!t.extraShadowCaster,this.tessellationStep=t.tessellationStep,this.scaleFactor=t.
2scaleFactor,this.worldview=t.worldview,this.indoor=t.indoor}parse(t,i,r,n,o,s){this.status="parsing",this.data=t,this.collisionBoxArray=new e.b3;const d=new e.fm(Object.keys(t.layers).sort()),m=new e.fn(this.tileID,this.promoteId);m.bucketLayerIDs=[];const g={},y=new e.fo(256,256),x={featureIndex:m,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:y,availableImages:r,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};if(this.indoor){const i=this.indoor.indoorState.activeFloorsVisible,r=function(t,i,r){const n=function(t,i){if(!t)return e.w("No source layers defined in indoor specification"),i;if(0===t.size)return i;const r=t.difference(i);for(const n of r)e.w(`Missing source layer required in indoor specification: ${n}`);return i.intersection(i)}(i.sourceLayers,new Set(Object.keys(t.layers))),o=i.indoorState,s=function(t,i,r,n){const o=new Set,s=new Set,a=new Set,d=new Map,m={},_=e=>{const t=d.get(e)||new Set;for(const i of o)if((d.get(i)||new Set).has(e)||t.has(i))return!0;return!1};for(const g of i){const i=t.layers[g];if(i)for(let e=0;e<i.length;e++){const t=i.feature(e);if(p(t)){const{id:e,center:i}=h(t);l(m,e,i),o.add(e);continue}if(f(t)){const{id:e,isDefault:i,connections:r,conflicts:l,buildings:h,name:p,zIndex:f}=u(t);c(m,h,e,{name:p,zIndex:f}),d.set(e,l),(e===n||r.has(n))&&o.add(e),s.add(e),i&&a.add(e)}}else e.w(`indoor source layer not found: ${g}`)}if(r)for(const e of r)s.has(e)&&(_(e)||o.add(e));for(const e of a)o.has(e)||_(e)||o.add(e);return{buildings:m,activeFloors:o}}(t,n,o.lastActiveFloors,o.selectedFloorId);return r.send("setIndoorData",s),s}(t,this.indoor,o);x.activeFloors=i?r.activeFloors:void 0}const v=[],b=i.familiesBySource[this.source];for(const a in b){const i=t.layers[a];if(!i)continue;let o=!1,s=!1,l=!1;for(const e of b[a])"symbol"===e[0].type?o=!0:s=!0,e[0].is3D()&&"model"!==e[0].type&&(l=!0);if(this.extraShadowCaster&&!l)continue;if(!0===this.isSymbolTile&&!o)continue;if(!1===this.isSymbolTile&&!s)continue;1===i.version&&e.w(`Vector tile source "${this.source}" layer "${a}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const c=d.encode(a),h=[],u=this.localizableLayerIds&&this.localizableLayerIds.has(a);let p=!1;for(let t=0,r=0;t<i.length;t++){const n=i.feature(t),o=m.getId(n,a),s=n.properties?n.properties.worldview:null;if(u&&this.worldview&&"string"==typeof s)if("all"===s)n.properties.$localized=!0;else{if(!s.split(",").includes(this.worldview))continue;n.properties.$localized=!0,n.properties.worldview=this.worldview}!p&&n.properties&&n.properties.hasOwnProperty(e.fp)&&(p=!0),h.push({feature:n,id:o,index:r,sourceLayerIndex:c}),r++}p&&!x.elevationFeatures&&t.layers.hasOwnProperty(e.fq)&&(x.elevationFeatures=e.fr.parseFrom(t.layers[e.fq],this.canonical));for(const t of b[a]){const i=t[0];if(this.extraShadowCaster&&(!i.is3D()||"model"===i.type))continue;if(void 0!==this.isSymbolTile&&"symbol"===i.type!==this.isSymbolTile)continue;if(i.minzoom&&this.zoom<Math.floor(i.minzoom))continue;if(i.maxzoom&&this.zoom>=i.maxzoom)continue;if("none"===i.visibility)continue;_(t,this.zoom,x.brightness,r,this.worldview);const o=g[i.id]=i.createBucket({index:m.bucketLayerIDs.length,layers:t,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:c,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:n,worldview:this.worldview,localizable:u,availableImages:r});m.bucketLayerIDs.push(t.map(t=>e.B(t.id,t.scope)));let s=o.prepare?o.prepare():null;null!=s?(s=s.then(()=>o.populate(h,x,this.tileID.canonical,this.tileTransform)),v.push(s)):o.populate(h,x,this.tileID.canonical,this.tileTransform)}}const w=()=>{let i,n,l,c,h,u;y.trim();const p={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},f=()=>{if(i)return this.status="done",s(i);if(this.extraShadowCaster)this.status="done",s(null,{buckets:Object.values(g).filter(e=>!e.isEmpty()),featureIndex:m,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:x.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(n&&l&&c){const t=new a(n),i=new Map;for(const[r,n]of l.entries()){const{imagePosition:t}=e.fu(r,n,e.fv);i.set(r,t)}const s={};for(const o in g){const a=g[o];a instanceof e.b4&&(_(a.layers,this.zoom,x.brightness,r,this.worldview),s[o]=e.fw(a,n,t.positions,l,i,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,h,this.worldview,r))}const d={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(o,l,h,()=>{d.iconsPending=!1,v(s,t,d)}),this.rasterizeIfNeeded(o,c,u,()=>{d.patternsPending=!1,v(s,t,d)})}},v=(t,i,n,o)=>
2{if(n.iconsPending||n.patternsPending)return;const a=new e.fx(l,c,this.lut);for(const s in g){const i=g[s];if(s in t)e.fy(i,t[s],this.showCollisionBoxes,r,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,l,a);else if(i.hasPattern&&(i instanceof e.ba||i instanceof e.bb||i instanceof e.ea)){_(i.layers,this.zoom,x.brightness,r,this.worldview);const e=Object.fromEntries(a.patternPositions);i.addFeatures(x,this.tileID.canonical,e,r,this.tileTransform,this.brightness)}}this.status="done",s(null,{buckets:Object.values(g).filter(e=>!e.isEmpty()),featureIndex:m,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:i.image,lineAtlas:y,imageAtlas:a,brightness:x.brightness})};if(!this.extraShadowCaster){const t=e.fs(x.glyphDependencies,e=>Object.keys(e).map(Number));Object.keys(t).length?o.send("getGlyphs",{uid:this.uid,stacks:t},(e,t)=>{i||(i=e,n=t,f())},void 0,!1,p):n={};const r=Array.from(x.iconDependencies.keys()).map(t=>e.I.parse(t));r.length?o.send("getImages",{images:r,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(e,t)=>{i||(i=e,l=new Map,h=this.updateImageMapAndGetImageTaskQueue(l,t,x.iconDependencies),f())},void 0,!1,p):(l=new Map,h=new Map);const s=Array.from(x.patternDependencies.keys()).map(t=>e.I.parse(t));s.length?o.send("getImages",{images:s,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(e,t)=>{i||(i=e,c=new Map,u=this.updateImageMapAndGetImageTaskQueue(c,t,x.patternDependencies),f())},void 0,!1,p):(c=new Map,u=new Map)}if(x.elevationFeatures&&x.elevationFeatures.length>0){const i=[];for(const t of Object.values(g))if(t instanceof e.bb){const e=t.getUnevaluatedPortalGraph();e&&i.push(e)}const r=e.ft.evaluate(i);for(const n of Object.values(g))if(n instanceof e.bb){const e=t.layers[d.decode(n.sourceLayerIndex)];n.setEvaluatedPortalGraph(r,e,this.tileID.canonical,x.availableImages,x.brightness)}}f()};v.length>0?Promise.allSettled(v).then(w).catch(s):w()}updateParameters(t){this.scaleFactor=t.scaleFactor,this.showCollisionBoxes=t.showCollisionBoxes,this.projection=t.projection,this.brightness=t.brightness,this.tileTransform=e.aZ(t.tileID.canonical,t.projection),this.extraShadowCaster=t.extraShadowCaster,this.lut=t.lut,this.worldview=t.worldview,this.indoor=t.indoor}rasterizeIfNeeded(e,t,i,r){Array.from(t.values()).some(e=>e.usvg)?this.rasterize(e,t,i,r):r()}updateImageMapAndGetImageTaskQueue(e,t,i){const r=new Map;for(const n of t.keys()){const o=i.get(n)||[];for(const i of o){const n=i.toString(),o=t.get(i.id.toString());o.usvg?r.has(n)||(r.set(n,i),e.set(n,Object.assign({},o))):e.set(n,o)}}return r}rasterize(e,t,i,r){this.rasterizeTask=e.send("rasterizeImages",{scope:this.scope,tasks:i},(e,i)=>{if(!e)for(const[r,n]of i.entries()){const e=Object.assign(t.get(r),{data:n});t.set(r,e)}r()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function _(t,i,r,n,o){const s=new e.ac(i,{brightness:r,worldview:o});for(const e of t)e.recalculate(s,n)}class g extends e.E{constructor(t,i,r,n,o,s,a){super(),this.actor=t,this.layerIndex=i,this.availableImages=r,this.availableModels=n,this.loadVectorData=s||e.aL,this.loading={},this.loaded={},this.deduped=new e.aK(t.scheduler),this.isSpriteLoaded=o,this.scheduler=t.scheduler,this.brightness=a}loadTile(i,r){const n=i.uid,o=i&&i.request,s=o&&o.collectResourceTiming,a=this.loading[n]=new m(i);a.abort=this.loadVectorData(i,(l,c)=>{const h=!this.loading[n];if(delete this.loading[n],a.cancelRasterize(),h||l||!c)return a.status="done",h||(this.loaded[n]=a),r(l);const u=c.rawData,d={},p=e.aM(c.responseHeaders);p&&p.expires&&(d.expires=p.expires),p&&p.cacheControl&&(d.cacheControl=p.cacheControl),a.vectorTile=c.vectorTile||new e.fz(new e.bt(u));const f=()=>{a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(e,i)=>{if(e||!i)return r(e);const n={};if(s){const e=t(o);e.length>0&&(n.resourceTiming=JSON.parse(JSON.stringify(e)))}r(null,Object.assign({rawTileData:u.slice(0),responseHeaders:c.responseHeaders},i,d,n))})};this.isSpriteLoaded?f():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(f,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom}
2):f()}),this.loaded=this.loaded||{},this.loaded[n]=a})}reloadTile(e,t){const i=this.loaded,r=e.uid;if(i&&i[r]){const n=i[r];n.updateParameters(e);const o=(e,i)=>{const r=n.reloadCallback;r&&(delete n.reloadCallback,n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,r)),t(e,i)};"parsing"===n.status?n.reloadCallback=o:"done"===n.status&&(n.vectorTile?n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,o):o())}else t(null,void 0)}abortTile(e,t){const i=e.uid,r=this.loading[i];r&&(r.abort&&r.abort(),delete this.loading[i]),t()}removeTile(e,t){const i=this.loaded,r=e.uid;i&&i[r]&&delete i[r],t()}}class y{loadTile(t,i){const{uid:r,encoding:n,rawImageData:o,padding:s}=t,a=ImageBitmap&&o instanceof ImageBitmap?this.getImageData(o,s):o;i(null,new e.fA(r,a,n,s<1))}reloadTile(e,t){t(null,null)}abortTile(e,t){t()}removeTile(e,t){t()}getImageData(e,t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);const i=this.offscreenCanvasContext.getImageData(-t,-t,e.width+2*t,e.height+2*t);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),i}}e.bs.setPbf(e.bt);class x{constructor(t){this._mrt=new e.bs(t.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=t.uid,this.tileID=t.tileID,this.source=t.source}parse(t,i){const r=this._mrt;this.status="parsing",this._entireBuffer=t;try{r.parseHeader(t),this._isHeaderLoaded=!0;const n=[];for(const i in r.layers){const o=r.getLayer(i),s=o.getDataRange(o.getBandList()),a=r.createDecodingTask(s),l=t.slice(s.firstByte,s.lastByte+1),c=e.bs.performDecoding(l,a).then(e=>a.complete(null,e)).catch(e=>a.complete(e,null));n.push(c)}Promise.allSettled(n).then(()=>i(null,r)).catch(e=>i(e))}catch(e){i(e)}}}class v{constructor(e){this.actor=e,this.loading={},this.loaded={}}loadTile(t,i){const r=t.uid,n=t.request,o=this.loading[r]=new x(t),{cancel:s}=e.bu(n,(e,t,n)=>{const s=!this.loading[r];if(delete this.loading[r],s||e||!t)return o.status="done",s||(this.loaded[r]=o),i(e);o.parse(t,(e,t)=>{if(e||!t)return i(e);i(null,t,n)}),this.loaded[r]=o});o.abort=s}reloadTile(e,t){t(null,void 0)}abortTile(e,t){const i=e.uid,r=this.loading[i];r&&(r.abort&&r.abort(),delete this.loading[i]),t()}removeTile(e,t){const i=e.uid;this.loaded[i]&&delete this.loaded[i],t()}decodeRasterArray(t,i){e.bs.performDecoding(t.buffer,t.task).then(e=>i(null,e)).catch(e=>i(e))}}const b=e.fB.prototype.toGeoJSON;class w{constructor(t){this._feature=t,this.extent=e.al,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))}loadGeometry(){if(1===this._feature.type){const t=[];for(const i of this._feature.geometry)t.push([new e.P(i[0],i[1])]);return t}{const t=[];for(const i of this._feature.geometry){const r=[];for(const t of i)r.push(new e.P(t[0],t[1]));t.push(r)}return t}}toGeoJSON(e,t,i){return b.call(this,e,t,i)}}class T{constructor(t,i){this.name=t,this.extent=e.al,this.length=i.length,this._jsonFeatures=i}feature(e){return new w(this._jsonFeatures[e])}}class S{constructor(t){this.layers={},this.extent=e.al;for(const e of Object.keys(t))this.layers[e]=new T(e,t[e])}}const E=64/4096;class I{constructor(){this.features=new Map}clear(){this.features.clear()}load(e=[],t){for(const i of e){const e=i.id;if(null==e)continue;let r=this.features.get(e);r&&this.updateCache(r,t),i.geometry?(r=M(i),this.updateCache(r,t),this.features.set(e,r)):this.features.delete(e),this.updateCache(r,t)}}updateCache(e,t){for(const{canonical:i,uid:r}of Object.values(t)){const{z:n,x:o,y:s}=i;A(e,Math.pow(2,n),o,s)&&delete t[r]}}getTile(e,t,i){const r=Math.pow(2,e),n=[];for(const o of this.features.values())A(o,r,t,i)&&n.push(z(o,r,t,i));return{features:n}}getFeatures(){return[...this.features.values()]}}function A({minX:e,minY:t,maxX:i,maxY:r},n,o,s){return e<(o+1+E)/n&&t<(s+1+E)/n&&i>(o-E)/n&&r>(s-E)/n}function M(e){const{id:t,geometry:i,properties:r}=e;if(!i)return;
vendor: 9,076 bytes, line 2
2if("GeometryCollection"===i.type)throw new Error("GeometryCollection not supported in dynamic mode.");const{type:n,coordinates:o}=i,s={id:t,type:1,geometry:[],tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},a=s.geometry;if("Point"===n)C(o,a,s);else if("MultiPoint"===n)for(const l of o)C(l,a,s);else if("LineString"===n)s.type=2,P(o,a,s);else if("MultiLineString"===n)s.type=2,R(o,a,s);else if("Polygon"===n)s.type=3,R(o,a,s,!0);else{if("MultiPolygon"!==n)throw new Error("Input data is not a valid GeoJSON object.");s.type=3;for(const e of o)R(e,a,s,!0)}return s}function C([t,i],r,n){const o=e.aF(t);let s=e.aJ(i);s=s<0?0:s>1?1:s,r.push(o,s),n.minX=Math.min(n.minX,o),n.minY=Math.min(n.minY,s),n.maxX=Math.max(n.maxX,o),n.maxY=Math.max(n.maxY,s)}function P(e,t,i,r=!1,n=!1){const o=[];for(const s of e)C(s,o,i);t.push(o),r&&function(e,t){let i=0;for(let r=0,n=e.length,o=n-2;r<n;o=r,r+=2)i+=(e[r]-e[o])*(e[r+1]+e[o+1]);if(i>0===t)for(let r=0,n=e.length;r<n/2;r+=2){const t=e[r],i=e[r+1];e[r]=e[n-2-r],e[r+1]=e[n-1-r],e[n-2-r]=t,e[n-1-r]=i}}(o,n)}function R(e,t,i,r=!1){for(let n=0;n<e.length;n++)P(e[n],t,i,r,0===n)}function z(t,i,r,n){const{id:o,type:s,geometry:a,tags:l}=t,c=[];if(1===s)!function(t,i,r,n,o){for(let s=0;s<t.length;s+=2){const a=Math.round(e.al*(t[s+0]*i-r)),l=Math.round(e.al*(t[s+1]*i-n));o.push([a,l])}}(a,i,r,n,c);else if(2===s)for(const e of a)L(e,i,r,n,c);else if(3===s)for(const e of a)D(e,i,r,n,c);return{id:o,type:s,geometry:c,tags:l}}function L(t,i,r,n,o){const s=-128,a=e.al+128;let l;for(let c=0;c<t.length-2;c+=2){let h=Math.round(e.al*(t[c+0]*i-r)),u=Math.round(e.al*(t[c+1]*i-n)),d=Math.round(e.al*(t[c+2]*i-r)),p=Math.round(e.al*(t[c+3]*i-n));const f=d-h,m=p-u;h<s&&d<s||(h<s?(u+=Math.round(m*((s-h)/f)),h=s):d<s&&(p=u+Math.round(m*((s-h)/f)),d=s),u<s&&p<s||(u<s?(h+=Math.round(f*((s-u)/m)),u=s):p<s&&(d=h+Math.round(f*((s-u)/m)),p=s),h>=a&&d>=a||(h>=a?(u+=Math.round(m*((a-h)/f)),h=a):d>=a&&(p=u+Math.round(m*((a-h)/f)),d=a),u>=a&&p>=a||(u>=a?(h+=Math.round(f*((a-u)/m)),u=a):p>=a&&(d=h+Math.round(f*((a-u)/m)),p=a),l&&h===l[l.length-1][0]&&u===l[l.length-1][1]||(l=[[h,u]],o.push(l)),l.push([d,p])))))}}function D(t,i,r,n,o){const s=(r-E)/i,a=(n-E)/i,l=(r+1+E)/i,c=(n+1+E)/i;function h(e,t){let i=0;return e<s?i|=1:e>l&&(i|=2),t<a?i|=4:t>c&&(i|=8),i}let u=[];for(let e=1;e<=8;e*=2){let i=t[t.length-2],r=t[t.length-1],n=!(h(i,r)&e);for(let o=0;o<t.length;o+=2){const d=t[o],p=t[o+1],f=!(h(d,p)&e);f!==n&&(8&e?u.push(i+(d-i)*(c-r)/(p-r),c):4&e?u.push(i+(d-i)*(a-r)/(p-r),a):2&e?u.push(l,r+(p-r)*(l-i)/(d-i)):1&e&&u.push(s,r+(p-r)*(s-i)/(d-i))),f&&u.push(d,p),i=d,r=p,n=f}if(!(t=u).length||8===e)break;u=[]}const d=[];for(let p=0;p<u.length;p+=2)d.push([Math.round(e.al*(u[p]*i-r)),Math.round(e.al*(u[p+1]*i-n))]);d.length&&o.push(d)}function O({name:t,features:i},r){r.writeStringField(1,t),r.writeVarintField(5,e.al);const n=new Map,o=new Map,s={keys:n,values:o,feature:null};for(const e of i)s.feature=e,r.writeMessage(2,F,s);for(const e of n.keys())r.writeStringField(3,e);for(const e of o.keys())r.writeMessage(4,U,e)}function F(e,t){const i=e.feature;void 0!==i.id&&Number.isSafeInteger(+i.id)&&t.writeVarintField(1,+i.id),i.tags&&t.writeMessage(2,k,e),t.writeVarintField(3,i.type),t.writeMessage(4,V,i)}function k({keys:e,values:t,feature:i},r){for(const n of Object.keys(i.tags)){let o=i.tags[n];if(null===o)continue;let s=e.get(n);void 0===s&&(s=e.size,e.set(n,s)),r.writeVarint(s);const a=typeof o;"string"!==a&&"boolean"!==a&&"number"!==a&&(o=JSON.stringify(o));let l=t.get(o);void 0===l&&(l=t.size,t.set(o,l)),r.writeVarint(l)}}function B(e,t){return(t<<3)+(7&e)}function N(e){return e<<1^e>>31}function V(e,t){const{geometry:i,type:r}=e;let n=0,o=0;if(1===r){t.writeVarint(B(1,i.length));for(const e of i){const i=e[0]-n,r=e[1]-o;t.writeVarint(N(i)),t.writeVarint(N(r)),n+=i,o+=r}}else for(const s of i){if(0===s.length)continue;t.writeVarint(B(1,1));const e=s.length-(3===r?1:0);for(let i=0;i<e;i++){1===i&&t.writeVarint(B(2,e-1));const r=s[i][0]-n,a=s[i][1]-o;t.writeVarint(N(r)),t.writeVarint(N(a)),n+=r,o+=a}3===r&&t.writeVarint(B(7,1))}}function U(e,t){const i=typeof e;"string"===i?t.writeStringField(1,e):"boolean"===i?t.writeBooleanField(7,e):"number"===i&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}const j={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},G=Math.fround||(q=new Float32Array(1),e=>(q[0]=+e,q[0]));var q;class H{constructor(e){this.options=Object.assign(Object.create(j),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:i,maxZoom:r}=this.options;t&&console.time("total time");const n=`prepare ${e.length} points`;t&&console.time(n),this.points=e;const o=[];for(let a=0;a<e.length;a++){const t=e[a];if(!t.geometry)continue;const[i,r]=t.geometry.coordinates,n=G(W(i)),s=G(X(r));o.push(n,s,1/0,a,-1,1),this.options.reduce&&o.push(0)}let s=this.trees[r+1]=this._createTree(o);t&&console.timeEnd(n);for(let a=r;a>=i;a--){const e=+Date.now();s=this.trees[a]=this._createTree(this._cluster(s,a)),t&&console.log("z%d: %d clusters in %dms",a,s.numItems,+Date.now()-e)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let i=((e[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[1]));let n=180===e[2]?180:((e[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,n=180;else if(i>n){const e=this.getClusters([i,r,180,o],t),s=this.getClusters([-180,r,n,o],t);return e.concat(s)}const s=this.trees[this._limitZoom(t)],a=s.range(W(i),X(o),W(n),X(r)),l=s.data,c=[];for(const h of a){const e=this.stride*h;c.push(l[e+5]>1?$(l,e,this.clusterProps):this.points[l[e+3]])}return c}getChildren(e){const t=this._getOriginId(e),i=this._getOriginZoom(e),r="No cluster with the specified id.",n=this.trees[i];if(!n)throw new Error(r);const o=n.data;if(t*this.stride>=o.length)throw new Error(r);const s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=n.within(o[t*this.stride],o[t*this.stride+1],s),l=[];for(const c of a){const t=c*this.stride;o[t+4]===e&&l.push(o[t+5]>1?$(o,t,this.clusterProps):this.points[o[t+3]])}if(0===l.length)throw new Error(r);return l}getLeaves(e,t,i){const r=[];return this._appendLeaves(r,e,t=t||10,i=i||0,0),r}getTile(e,t,i){const r=this.trees[this._limitZoom(e)],n=Math.pow(2,e),{extent:o,radius:s}=this.options,a=s/o,l=(i-a)/n,c=(i+1+a)/n,h={features:[]};return this._addTileFeatures(r.range((t-a)/n,l,(t+1+a)/n,c),r.data,t,i,n,h),0===t&&this._addTileFeatures(r.range(1-a/n,l,1,c),r.data,n,i,n,h),t===n-1&&this._addTileFeatures(r.range(0,l,a/n,c),r.data,-1,i,n,h),h.features.length?h:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const i=this.getChildren(e);if(t++,1!==i.length)break;e=i[0].properties.cluster_id}return t}_appendLeaves(e,t,i,r,n){const o=this.getChildren(t);for(const s of o){const t=s.properties;if(t&&t.cluster?n+t.point_count<=r?n+=t.point_count:n=this._appendLeaves(e,t.cluster_id,i,r,n):n<r?n++:e.push(s),e.length===i)break}return n}_createTree(t){const i=new e.c4(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let e=0;e<t.length;e+=this.stride)i.add(t[e],t[e+1]);return i.finish(),i.data=t,i}_addTileFeatures(e,t,i,r,n,o){for(const s of e){const e=s*this.stride,a=t[e+5]>1;let l,c,h;if(a)l=Z(t,e,this.clusterProps),c=t[e],h=t[e+1];else{const i=this.points[t[e+3]];l=i.properties;const[r,n]=i.geometry.coordinates;c=W(r),h=X(n)}const u={type:1,geometry:[[Math.round(this.options.extent*(c*n-i)),Math.round(this.options.extent*(h*n-r))]],tags:l};let d;d=a||this.options.generateId?t[e+3]:this.points[t[e+3]].id,void 0!==d&&(u.id=d),o.features.push(u)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:i,extent:r,reduce:n,minPoints:o}=this.options,s=i/(r*Math.pow(2,t)),a=e.data,l=[],c=this.stride;for(let h=0;h<a.length;h+=c){if(a[h+2]<=t)continue;a[h+2]=t;const i=a[h],r=a[h+1],u=e.within(a[h],a[h+1],s),d=a[h+5];let p=d;for(const e of u){const i=e*c;a[i+2]>t&&(p+=a[i+5])}if(p>d&&p>=o){let e,o=i*d,s=r*d,f=-1;const m=(h/c<<5)+(t+1)+this.points.length;for(const i of u){const r=i*c;if(a[r+2]<=t)continue;a[r+2]=t;const l=a[r+5];o+=a[r]*l,s+=a[r+1]*l,a[r+4]=m,n&&(e||(e=this._map(a,h,!0),f=this.clusterProps.length,this.clusterProps.push(e)),n(e,this._map(a,r)))}a[h+4]=m,l.push(o/p,s/p,1/0,m,-1,p),n&&l.push(f)}else{for(let e=0;e<c;e++)l.push(a[h+e]);if(p>1)for(const e of u){const i=e*c;if(!(a[i+2]<=t)){a[i+2]=t;for(let e=0;e<c;e++)l.push(a[i+e])}}}}return l}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,i){if(e[t+5]>1){const r=this.clusterProps[e[t+6]];return i?Object.assign({},r):r}const r=this.points[e[t+3]].properties,n=this.options.map(r);return i&&n===r?Object.assign({},n):n}}function $(e,t,i){return{type:"Feature",id:e[t+3],properties:Z(e,t,i),geometry:{type:"Point",coordinates:[(r=e[t],360*(r-.5)),Y
vendor: 5,071 bytes, line 2
2(e[t+1])]}};var r}function Z(e,t,i){const r=e[t+5],n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,o=e[t+6],s=-1===o?{}:Object.assign({},i[o]);return Object.assign(s,{cluster:!0,cluster_id:e[t+3],point_count:r,point_count_abbreviated:n})}function W(e){return e/360+.5}function X(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 Y(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function K(e,t,i,r){let n=r;const o=t+(i-t>>1);let s,a=i-t;const l=e[t],c=e[t+1],h=e[i],u=e[i+1];for(let d=t+3;d<i;d+=3){const t=J(e[d],e[d+1],l,c,h,u);if(t>n)s=d,n=t;else if(t===n){const e=Math.abs(d-o);e<a&&(s=d,a=e)}}n>r&&(s-t>3&&K(e,t,s,r),e[s+2]=n,i-s>3&&K(e,s,i,r))}function J(e,t,i,r,n,o){let s=n-i,a=o-r;if(0!==s||0!==a){const l=((e-i)*s+(t-r)*a)/(s*s+a*a);l>1?(i=n,r=o):l>0&&(i+=s*l,r+=a*l)}return s=e-i,a=t-r,s*s+a*a}function Q(e,t,i,r){const n={id:e??null,type:t,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===t||"MultiPoint"===t||"LineString"===t)ee(n,i);else if("Polygon"===t)ee(n,i[0]);else if("MultiLineString"===t)for(const o of i)ee(n,o);else if("MultiPolygon"===t)for(const o of i)ee(n,o[0]);return n}function ee(e,t){for(let i=0;i<t.length;i+=3)e.minX=Math.min(e.minX,t[i]),e.minY=Math.min(e.minY,t[i+1]),e.maxX=Math.max(e.maxX,t[i]),e.maxY=Math.max(e.maxY,t[i+1])}function te(e,t,i,r){if(!t.geometry)return;const n=t.geometry.coordinates;if(n&&0===n.length)return;const o=t.geometry.type,s=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2);let a=[],l=t.id;if(i.promoteId?l=t.properties[i.promoteId]:i.generateId&&(l=r||0),"Point"===o)ie(n,a);else if("MultiPoint"===o)for(const c of n)ie(c,a);else if("LineString"===o)re(n,a,s,!1);else if("MultiLineString"===o){if(i.lineMetrics){for(const i of n)a=[],re(i,a,s,!1),e.push(Q(l,"LineString",a,t.properties));return}ne(n,a,s,!1)}else if("Polygon"===o)ne(n,a,s,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(const n of t.geometry.geometries)te(e,{id:l,geometry:n,properties:t.properties},i,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const e of n){const t=[];ne(e,t,s,!0),a.push(t)}}e.push(Q(l,o,a,t.properties))}function ie(e,t){t.push(oe(e[0]),se(e[1]),0)}function re(e,t,i,r){let n,o,s=0;for(let l=0;l<e.length;l++){const i=oe(e[l][0]),a=se(e[l][1]);t.push(i,a,0),l>0&&(s+=r?(n*a-i*o)/2:Math.sqrt(Math.pow(i-n,2)+Math.pow(a-o,2))),n=i,o=a}const a=t.length-3;t[2]=1,K(t,0,a,i),t[a+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function ne(e,t,i,r){for(let n=0;n<e.length;n++){const o=[];re(e[n],o,i,r),t.push(o)}}function oe(e){return e/360+.5}function se(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 ae(e,t,i,r,n,o,s,a){if(r/=t,o>=(i/=t)&&s<r)return e;if(s<i||o>=r)return null;const l=[];for(const c of e){const e=c.geometry;let t=c.type;const o=0===n?c.minX:c.minY,s=0===n?c.maxX:c.maxY;if(o>=i&&s<r){l.push(c);continue}if(s<i||o>=r)continue;let h=[];if("Point"===t||"MultiPoint"===t)le(e,h,i,r,n);else if("LineString"===t)ce(e,h,i,r,n,!1,a.lineMetrics);else if("MultiLineString"===t)ue(e,h,i,r,n,!1);else if("Polygon"===t)ue(e,h,i,r,n,!0);else if("MultiPolygon"===t)for(const a of e){const e=[];ue(a,e,i,r,n,!0),e.length&&h.push(e)}if(h.length){if(a.lineMetrics&&"LineString"===t){for(const e of h)l.push(Q(c.id,t,e,c.tags));continue}"LineString"!==t&&"MultiLineString"!==t||(1===h.length?(t="LineString",h=h[0]):t="MultiLineString"),"Point"!==t&&"MultiPoint"!==t||(t=3===h.length?"Point":"MultiPoint"),l.push(Q(c.id,t,h,c.tags))}}return l.length?l:null}function le(e,t,i,r,n){for(let o=0;o<e.length;o+=3){const s=e[o+n];s>=i&&s<=r&&de(t,e[o],e[o+1],e[o+2])}}function ce(e,t,i,r,n,o,s){let a=he(e);const l=0===n?pe:fe;let c,h,u=e.start;for(let _=0;_<e.length-3;_+=3){const d=e[_],p=e[_+1],f=e[_+2],m=e[_+3],g=e[_+4],y=0===n?d:p,x=0===n?m:g;let v=!1;s&&(c=Math.sqrt(Math.pow(d-m,2)+Math.pow(p-g,2))),y<i?x>i&&(h=l(a,d,p,m,g,i),s&&(a.start=u+c*h)):y>r?x<r&&(h=l(a,d,p,m,g,r),s&&(a.start=u+c*h)):de(a,d,p,f),x<i&&y>=i&&(h=l(a,d,p,m,g,i),v=!0),x>r&&y<=r&&(h=l(a,d,p,m,g,r),v=!0),!o&&v&&(s&&(a.end=u+c*h),t.push(a),a=he(e)),s&&(u+=c)}let d=e.length-3;const p=e[d],f=e[d+1],m=0===n?p:f;m>=i&&m<=r&&de(a,p,f,e[d+2]),d=a.length-3,o&&d>=3&&(a[d]!==a[0]||a[d+1]!==a[1])&&de(a,a[0],a[1],a[2]),a.length&&t.push(a)}function he(e){const t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function ue(e,t,i,r,n,o){for(const s of e)ce(s,t,i,r,n,o,!1)}function de(e,t,i,r){e.push(t,i,r)}function pe(e,t,i,r,n,o){const s=(o-t)/(r-t);return de(e,o,i+(n-i)*s,1),s}function fe(e,t,i,r,n,o){const s=(o-i)/(n-i);return de(e,t+(r-t)*s,o,1),s}function me(e,t){const i=[];for(let r=0;r<e.length;r++){const n=e[r],o=n.type;let s;if("Point"===o||"MultiPoint"===o||"LineString"===o)s=_e(n.geometry,t);else if("MultiLineString"===o||"Polygon"===o){s=[];for(const e of n.geometry)s.push(_e(e,t))}else if("MultiPolygon"===o){s=[];for(const e of n.geometry){const i=[];for(const r of e)i.push(_e(r,t));s.push(i)}}
vendor: 6,191 bytes, line 2
2i.push(Q(n.id,o,s,n.tags))}return i}function _e(e,t){const i=[];i.size=e.size,void 0!==e.start&&(i.start=e.start,i.end=e.end);for(let r=0;r<e.length;r+=3)i.push(e[r]+t,e[r+1],e[r+2]);return i}function ge(e,t){if(e.transformed)return e;const i=1<<e.z,r=e.x,n=e.y;for(const o of e.features){const e=o.geometry,s=o.type;if(o.geometry=[],1===s)for(let a=0;a<e.length;a+=2)o.geometry.push(ye(e[a],e[a+1],t,i,r,n));else for(let a=0;a<e.length;a++){const s=[];for(let o=0;o<e[a].length;o+=2)s.push(ye(e[a][o],e[a][o+1],t,i,r,n));o.geometry.push(s)}}return e.transformed=!0,e}function ye(e,t,i,r,n,o){return[Math.round(i*(e*r-n)),Math.round(i*(t*r-o))]}function xe(e,t,i,r,n){const o=t===n.maxZoom?0:n.tolerance/((1<<t)*n.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:e.length,source:null,x:i,y:r,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const a of e)ve(s,a,o,n);return s}function ve(e,t,i,r){const n=t.geometry,o=t.type,s=[];if(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),"Point"===o||"MultiPoint"===o)for(let a=0;a<n.length;a+=3)s.push(n[a],n[a+1]),e.numPoints++,e.numSimplified++;else if("LineString"===o)be(s,n,e,i,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(let a=0;a<n.length;a++)be(s,n[a],e,i,"Polygon"===o,0===a);else if("MultiPolygon"===o)for(let a=0;a<n.length;a++){const t=n[a];for(let r=0;r<t.length;r++)be(s,t[r],e,i,!0,0===r)}if(s.length){let i=t.tags||null;if("LineString"===o&&r.lineMetrics){i={};for(const e in t.tags)i[e]=t.tags[e];i.mapbox_clip_start=n.start/n.size,i.mapbox_clip_end=n.end/n.size}const a={geometry:s,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:i};null!==t.id&&(a.id=t.id),e.features.push(a)}}function be(e,t,i,r,n,o){const s=r*r;if(r>0&&t.size<(n?s:r))return void(i.numPoints+=t.length/3);const a=[];for(let l=0;l<t.length;l+=3)(0===r||t[l+2]>s)&&(i.numSimplified++,a.push(t[l],t[l+1])),i.numPoints++;n&&function(e,t){let i=0;for(let r=0,n=e.length,o=n-2;r<n;o=r,r+=2)i+=(e[r]-e[o])*(e[r+1]+e[o+1]);if(i>0===t)for(let r=0,n=e.length;r<n/2;r+=2){const t=e[r],i=e[r+1];e[r]=e[n-2-r],e[r+1]=e[n-1-r],e[n-2-r]=t,e[n-1-r]=i}}(a,o),e.push(a)}const we={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Te{constructor(e,t){const i=(t=this.options=function(e,t){for(const i in t)e[i]=t[i];return e}(Object.create(we),t)).debug;if(i&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");let r=function(e,t){const i=[];if("FeatureCollection"===e.type)for(let r=0;r<e.features.length;r++)te(i,e.features[r],t,r);else te(i,"Feature"===e.type?e:{geometry:e},t);return i}(e,t);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(e,t){const i=t.buffer/t.extent;let r=e;const n=ae(e,1,-1-i,i,0,-1,2,t),o=ae(e,1,1-i,2+i,0,-1,2,t);return(n||o)&&(r=ae(e,1,-i,1+i,0,-1,2,t)||[],n&&(r=me(n,1).concat(r)),o&&(r=r.concat(me(o,-1)))),r}(r,t),r.length&&this.splitTile(r,0,0,0),i&&(r.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(e,t,i,r,n,o,s){const a=[e,t,i,r],l=this.options,c=l.debug;for(;a.length;){r=a.pop(),i=a.pop(),t=a.pop(),e=a.pop();const h=1<<t,u=Se(t,i,r);let d=this.tiles[u];if(!d&&(c>1&&console.time("creation"),d=this.tiles[u]=xe(e,t,i,r,l),this.tileCoords.push({z:t,x:i,y:r}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,r,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));const e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(d.source=e,null==n){if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===n)continue;if(null!=n){const e=n-t;if(i!==o>>e||r!==s>>e)continue}}if(d.source=null,0===e.length)continue;c>1&&console.time("clipping");const p=.5*l.buffer/l.extent,f=.5-p,m=.5+p,_=1+p;let g=null,y=null,x=null,v=null,b=ae(e,h,i-p,i+m,0,d.minX,d.maxX,l),w=ae(e,h,i+f,i+_,0,d.minX,d.maxX,l);e=null,b&&(g=ae(b,h,r-p,r+m,1,d.minY,d.maxY,l),y=ae(b,h,r+f,r+_,1,d.minY,d.maxY,l),b=null),w&&(x=ae(w,h,r-p,r+m,1,d.minY,d.maxY,l),v=ae(w,h,r+f,r+_,1,d.minY,d.maxY,l),w=null),c>1&&console.timeEnd("clipping"),a.push(g||[],t+1,2*i,2*r),a.push(y||[],t+1,2*i,2*r+1),a.push(x||[],t+1,2*i+1,2*r),a.push(v||[],t+1,2*i+1,2*r+1)}}getTile(e,t,i){e=+e,t=+t,i=+i;const r=this.options,{extent:n,debug:o}=r;if(e<0||e>24)return null;const s=1<<e,a=Se(e,t=t+s&s-1,i);if(this.tiles[a])return ge(this.tiles[a],n);o>1&&console.log("drilling down to z%d-%d-%d",e,t,i);let l,c=e,h=t,u=i;for(;!l&&c>0;)c--,h>>=1,u>>=1,l=this.tiles[Se(c,h,u)];return l&&l.source?(o>1&&(console.log("found parent tile z%d-%d-%d",c,h,u),console.time("drilling down")),this.splitTile(l.source,c,h,u,e,t,i),o>1&&console.timeEnd("drilling down"),this.tiles[a]?ge(this.tiles[a],n):null):null}}function Se(e,t,i){return 32*((1<<e)*i+t)+e}function Ee(t,i){const r=t.tileID.canonical;if(!this._geoJSONIndex)return void i(null,null);const n=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!n)return void i(null,null);const o=e=>e.tags&&"3d_elevation_id"in e.tags&&"source"in e.tags&&"elevation"===e.tags.source,s=n.features.filter(e=>o(e));let a={_geojsonTileLayer:n.features};s.length>0&&(a={_geojsonTileLayer:n.features.filter(e=>!o(e)),hd_road_elevation:s});const l=new S(a),c=function(t){const i=new e.bt;for(const e of Object.keys(t))i.writeMessage(3,O,{name:e,features:t[e]});return i.finish()}(a).buffer;i(null,{vectorTile:l,rawData:c})}class Ie extends g{constructor(e,t,i,r,n,o,s){super(e,t,i,r,n,Ee,s),o&&(this.loadGeoJSON=o),this._dynamicIndex=new I}loadData(i,r){const n=i&&i.request,o=n&&n.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(i,(s,a)=>
2{if(s||!a)return r(s);if("object"!=typeof a)return r(new Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`));{try{if(i.filter){const t=e.U(i.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===t.result)throw new Error(t.value.map(e=>`${e.key}: ${e.message}`).join(", "));a.features=a.features.filter(e=>t.value.evaluate({zoom:0},e))}i.dynamic?("Feature"===a.type&&(a={type:"FeatureCollection",features:[a]}),i.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(a.features,this.loaded),i.cluster&&(a.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=i.cluster?new H(function({superclusterOptions:t,clusterProperties:i}){if(!i||!t)return t;const r={},n={},o={accumulated:null,zoom:0},s={properties:null},a=Object.keys(i);for(const l of a){const[t,o]=i[l],s=e.U(o),a=e.U("string"==typeof t?[t,["accumulated"],["get",l]]:t);r[l]=s.value,n[l]=a.value}return t.map=e=>{s.properties=e;const t={};for(const i of a)t[i]=r[i].evaluate(o,s);return t},t.reduce=(e,t)=>{s.properties=t;for(const i of a)o.accumulated=e[i],e[i]=n[i].evaluate(o,s)},t}(i)).load(a.features):i.dynamic?this._dynamicIndex:function(e,t){return new Te(e,t)}(a,i.geojsonVtOptions)}catch(e){return r(e)}const s={};if(o){const e=t(n);e&&(s.resourceTiming={},s.resourceTiming[i.source]=JSON.parse(JSON.stringify(e)))}r(null,s)}})}reloadTile(e,t){const i=this.loaded;return i&&i[e.uid]?e.partial?t(null,void 0):super.reloadTile(e,t):this.loadTile(e,t)}loadGeoJSON(t,i){if(t.request)e.m(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.`));setTimeout(()=>{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.`))}},0)}}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 Ae{constructor(t,i,r){this.tileID=new e.aQ(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.canonical=t.tileID.canonical,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=t.projection,this.brightness=i,this.worldview=r}parse(t,i,r,n){this.status="parsing";const o=new e.aQ(r.tileID.overscaledZ,r.tileID.wrap,r.tileID.canonical.z,r.tileID.canonical.x,r.tileID.canonical.y),s=[],a=i.familiesBySource[r.source],l=new e.fn(o,r.promoteId);l.bucketLayerIDs=[],l.is3DTile=!0,e.fC(t).then(t=>{if(!t)return n(new Error("Could not parse tile"));const i=t.json.extensionsUsed&&t.json.extensionsUsed.includes("MAPBOX_mesh_features")||t.json.asset.extras&&t.json.asset.extras.MAPBOX_mesh_features,c=t.json.extensionsUsed&&t.json.extensionsUsed.includes("EXT_meshopt_compression"),h=new e.ac(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const n in a)for(const u of a[n]){const n=u[0];l.bucketLayerIDs.push(u.map(t=>e.B(t.id,t.scope))),n.recalculate(h,[]);const a=e.fD(t,1/e.d7(r.tileID.canonical)),d=new e.fE(u,a,o,i,c,this.brightness,l,this.worldview);i||(d.needsUpload=!0),s.push(d),d.evaluate(n)}this.status="done",n(null,{buckets:s,featureIndex:l,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(e=>n(new Error(e.message)))}}class Me{constructor(e,t,i,r,n,o,s,a){this.actor=e,this.layerIndex=t,this.availableImages=i,this.availableModels=r,this.brightness=s,this.loading={},this.loaded={},this.worldview=a}loadTile(t,i){const r=t.uid,n=this.loading[r]=new Ae(t,this.brightness,this.worldview);e.bu(t.request,(e,o)=>{const s=!this.loading[r];return delete this.loading[r],s||e?(n.status="done",s||(this.loaded[r]=n),i(e)):o&&0!==o.byteLength?void n.parse(o,this.layerIndex,t,(e,t)=>{n.status="done",this.loaded=this.loaded||{},this.loaded[r]=n,e||!t?i(e):i(null,t)}):(n.status="done",this.loaded[r]=n,i())})}reloadTile(e,t){const i=this.loaded,r=e.uid;if(i&&i[r]){const n=i[r];n.projection=e.projection,n.brightness=e.brightness;const o=(i,r)=>{n.reloadCallback&&(delete n.reloadCallback,this.loadTile(e,t)),t(i,r)};"parsing"===n.status?n.reloadCallback=o:"done"===n.status&&this.loadTile(e,t)}}abortTile(e,t){const i=e.uid;this.loading[i]&&delete this.loading[i],t()}removeTile(e,t){const i=this.loaded,r=e.uid;i&&i[r]&&delete i[r],t()}}class Ce{constructor(t){this.self=t,this.actor=new e.fG(t,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new e.x,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=e.cm({name:"mercator"}),this.workerSourceTypes={vector:g,geojson:Ie,"raster-dem":y,"raster-array":v,"batched-model":Me},this.workerSources={}
2,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.fH.isParsed())throw new Error("RTL text plugin already registered.");e.fH.setState({pluginStatus:e.fI.parsed,pluginURL:e.fH.getPluginURL()}),e.fH.applyArabicShaping=t.applyArabicShaping,e.fH.processBidirectionalText=t.processBidirectionalText,e.fH.processStyledBidirectionalText=t.processStyledBidirectionalText;for(const e of this.rtlPluginParsingListeners)e(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(e,t,i){delete this.layerIndexes[e],delete this.availableImages[e],delete this.availableModels[e],delete this.workerSources[e],i()}checkIfReady(e,t,i){i()}setReferrer(e,t){this.referrer=t}spriteLoaded(t,i){this.isSpriteLoaded[t]||(this.isSpriteLoaded[t]={});const{scope:r,isLoaded:n}=i;if(this.isSpriteLoaded[t][r]=n,this.workerSources[t]&&this.workerSources[t][r])for(const o in this.workerSources[t][r]){const i=this.workerSources[t][r][o];for(const t in i){const r=i[t];r instanceof g&&(r.isSpriteLoaded=n,r.fire(new e.z("isSpriteLoaded")))}}}setImages(e,t,i){this.availableImages[e]||(this.availableImages[e]={});const{scope:r,images:n}=t;if(this.availableImages[e][r]=n,this.workerSources[e]&&this.workerSources[e][r]){for(const t in this.workerSources[e][r]){const i=this.workerSources[e][r][t];for(const e in i)i[e].availableImages=n}i()}else i()}setModels(e,{scope:t,models:i},r){if(this.availableModels[e]||(this.availableModels[e]={}),this.availableModels[e][t]=i,this.workerSources[e]&&this.workerSources[e][t]){for(const r in this.workerSources[e][t]){const n=this.workerSources[e][t][r];for(const e in n)n[e].availableModels=i}r()}else r()}setProjection(t,i){this.projections[t]=e.cm(i)}setBrightness(e,t,i){this.brightness=t,i()}setWorldview(e,t,i){this.worldview=t,i()}setLayers(e,t,i){this.getLayerIndex(e,t.scope).replace(t.layers,t.options),i()}updateLayers(e,t,i){this.getLayerIndex(e,t.scope).update(t.layers,t.removedIds,t.options),i()}loadTile(e,t,i){t.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,t.type,t.source,t.scope).loadTile(t,i)}decodeRasterArray(e,t,i){this.getWorkerSource(e,t.type,t.source,t.scope).decodeRasterArray(t,i)}reloadTile(e,t,i){t.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,t.type,t.source,t.scope).reloadTile(t,i)}abortTile(e,t,i){this.getWorkerSource(e,t.type,t.source,t.scope).abortTile(t,i)}removeTile(e,t,i){this.getWorkerSource(e,t.type,t.source,t.scope).removeTile(t,i)}removeSource(e,t,i){if(!(this.workerSources[e]&&this.workerSources[e][t.scope]&&this.workerSources[e][t.scope][t.type]&&this.workerSources[e][t.scope][t.type][t.source]))return;const r=this.workerSources[e][t.scope][t.type][t.source];delete this.workerSources[e][t.scope][t.type][t.source],void 0!==r.removeSource?r.removeSource(t,i):i()}loadWorkerSource(e,t,i){try{this.self.importScripts(t.url),i()}catch(e){i(e)}}syncRTLPluginState(t,i,r){if(e.fH.isParsed())r(null,!0);else if(e.fH.isParsing())this.rtlPluginParsingListeners.push(r);else try{e.fH.setState(i);const t=e.fH.getPluginURL();!e.fH.isLoaded()||e.fH.isParsed()||e.fH.isParsing()||null==t||(e.fH.setState({pluginStatus:e.fI.parsing,pluginURL:e.fH.getPluginURL()}),this.self.importScripts(t),e.fH.isParsed()?r(null,!0):this.rtlPluginParsingListeners.push(r))}catch(e){r(e)}}setDracoUrl(e,t){this.dracoUrl=t}getAvailableImages(e,t){this.availableImages[e]||(this.availableImages[e]={});let i=this.availableImages[e][t];return i||(i=[]),i}getAvailableModels(e,t){this.availableModels[e]||(this.availableModels[e]={});let i=this.availableModels[e][t];return i||(i={}),i}getLayerIndex(e,t){this.layerIndexes[e]||(this.layerIndexes[e]={});let i=this.layerIndexes[e][t];return i||(i=this.layerIndexes[e][t]=new o,i.scope=t),i}getWorkerSource(e,t,i,r){const n=this.workerSources;return n[e]||(n[e]={}),n[e][r]||(n[e][r]={}),n[e][r][t]||(n[e][r][t]={}),this.isSpriteLoaded[e]||(this.isSpriteLoaded[e]={}),n[e][r][t][i]||(n[e][r][t][i]=new this.workerSourceTypes[t]({send:(t,i,r,n,o,s)=>this.actor.send(t,i,r,e,o,s),scheduler:this.actor.scheduler},this.getLayerIndex(e,r),this.getAvailableImages(e,r),this.getAvailableModels(e,r),this.isSpriteLoaded[e][r],void 0,this.brightness,this.worldview)),n[e][r][t][i]}rasterizeImagesWorker(e,t,i){const r=new Map;for(const[n,{image:o,imageVariant:s}]of t.tasks.entries()){const i=this.imageRasterizer.rasterize(s,o,t.scope,e);r.set(n,i)}i(void 0,r)}removeRasterizedImages(e,t,i){this.imageRasterizer.removeImagesFromCacheByIds(t.imageIds,t.scope,e),i()}enforceCacheSizeLimit(t,i){e.fJ(i)}getWorkerPerformanceMetrics(e,t,i){i(void 0,void 0)}}return e.fF(self)&&(self.worker=new Ce(self)),Ce}),r(["./shared"],function(e){var t="3.18.1";const i={create:"create",load:"load",fullLoad:"fullLoad"},r={mark(e){performance.mark(e)},measure(e,t,i){performance.measure(e,t,i)}};function n(t){const i=t.name.split("?")[0];return e.a(i)&&i.includes("mapbox-gl.js")?"javascript":e.a(i)&&i.includes("mapbox-gl.css")?"css":e.b(i)?"fontRange":e.c(i)?"sprite":e.i(i)?"style":e.d(i)?"tilejson":"other"}var o,s={},a=function(){if(o)return s;function e(e){return!t(e)}function t(t){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var e,t,i=new Blob([""],{type:"text/javascript"}),r=URL.createObjectURL(i);try{t=new Worker(r),e=!0}catch(t){e=!1}return t&&t.terminate(),URL.revokeObjectURL(r),e}()?function(){var e=document.createElement("canvas");e.width=e.height=1;var t=e.getContext("2d");if(!t)return!1;var i=t.getImageData(0,0,1,1);return i&&i.width===e.width}()?(void 0===i[r=t&&t.failIfMajorPerformanceCaveat]&&(i[r]=function(t){var i,r=function(t){var i=document.createElement("canvas"),r=Object.create(e.webGLContextAttributes);return r.failIfMajorPerformanceCaveat=t,i.getContext("webgl2",r)}(t);if(!r)return!1;try{i=r.createShader(r.VERTEX_SHADER)}catch(e){return!1}return!(!i||r.isContextLost())&&(r.shaderSource(i,"void main() {}"),r.compileShader(i),!0===r.getShaderParameter(i,r.COMPILE_STATUS))}(r)),i[r]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var r}o=1,s.supported=e,s.notSupportedReason=t;var i={};return e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},s}();function l(e,t,i){const r=document.createElement(e);return null!=t&&(r.className=t),i&&i.appendChild(r),r}function c(e,t,i){const r=document.createElementNS("http://www.w3.org/2000/svg",e);for(const n of Object.keys(t))r.setAttributeNS(null,n,String(t[n]));return i&&i.appendChild(r),r}const h="undefined"!=typeof document?document.documentElement&&document.documentElement.style:null,u=h&&void 0!==h.userSelect?"userSelect":"WebkitUserSelect";let d;function p(){h&&u&&(d=h[u],h[u]="none")}function f(){h&&u&&(h[u]=d)}function m(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",m,!0)}function _(){window.addEventListener("click",m,!0),window.setTimeout(()=>{window.removeEventListener("click",m,!0)},0)}function g(e,t){const i=e.getBoundingClientRect();return v(e,i,t)}function y(e,t){const i=e.getBoundingClientRect(),r=[];for(let n=0;n<t.length;
2n++)r.push(v(e,i,t[n]));return r}function x(e){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&2===e.button&&e.ctrlKey?0:e.button}function v(t,i,r){const n=t.offsetWidth===i.width?1:t.offsetWidth/i.width;return new e.P((r.clientX-i.left)*n,(r.clientY-i.top)*n)}const b="01",w="NO_ACCESS_TOKEN";class T{constructor(e,t,i){this._transformRequestFn=e,this._customAccessToken=t,this._silenceAuthErrors=!!i,this._createSkuToken()}_createSkuToken(){const e=function(){let e="";for(let t=0;t<10;t++)e+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",b,e].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=e.token,this._skuTokenExpiresAt=e.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}normalizeStyleURL(i,r){if(!e.h(i))return i;const n=E(i);return n.params.push(`sdk=js-${t}`),n.path=`/styles/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||r)}normalizeGlyphsURL(t,i){if(!e.h(t))return t;const r=E(t);return r.path=`/fonts/v1${r.path}`,this._makeAPIURL(r,this._customAccessToken||i)}normalizeModelURL(t,i){if(!e.h(t))return t;const r=E(t);return r.path=`/models/v1${r.path}`,this._makeAPIURL(r,this._customAccessToken||i)}normalizeSourceURL(t,i,r,n){if(!e.h(t))return t;const o=E(t);return o.path=`/v4/${o.authority}.json`,o.params.push("secure"),r&&o.params.push(`language=${r}`),n&&o.params.push(`worldview=${n}`),this._makeAPIURL(o,this._customAccessToken||i)}normalizeIconsetURL(t,i){const r=E(t);return e.h(t)?(r.path=`/styles/v1${r.path}/iconset.pbf`,this._makeAPIURL(r,this._customAccessToken||i)):I(r)}normalizeSpriteURL(t,i,r,n){const o=E(t);return e.h(t)?(o.path=`/styles/v1${o.path}/sprite${i}${r}`,this._makeAPIURL(o,this._customAccessToken||n)):(o.path+=`${i}${r}`,I(o))}normalizeTileURL(t,i,r){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!e.h(t))return t;const n=E(t);n.path=n.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${i||r&&"raster"!==n.authority&&512===r?"@2x":""}${e.k.supported?".webp":"$1"}`),"raster"===n.authority?n.path=`/${e.e.RASTER_URL_PREFIX}${n.path}`:"rasterarrays"===n.authority?n.path=`/${e.e.RASTERARRAYS_URL_PREFIX}${n.path}`:"3dtiles"===n.authority?n.path=`/${e.e.TILES3D_URL_PREFIX}${n.path}`:(n.path=n.path.replace(/^.+\/v4\//,"/"),n.path=`/${e.e.TILE_URL_VERSION}${n.path}`);const o=this._customAccessToken||function(e){for(const t of e){const e=t.match(/^access_token=(.*)$/);if(e)return e[1]}return null}(n.params)||e.e.ACCESS_TOKEN;return e.e.REQUIRE_ACCESS_TOKEN&&o&&this._skuToken&&n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,o)}canonicalizeTileURL(t,i){const r=E(t);if(!r.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!r.path.match(/\.[\w]+$/))return t;let n="mapbox://";r.path.match(/^\/raster\/v1\//)?n+=`raster/${r.path.replace(`/${e.e.RASTER_URL_PREFIX}/`,"")}`:r.path.match(/^\/rasterarrays\/v1\//)?n+=`rasterarrays/${r.path.replace(`/${e.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:n+=`tiles/${r.path.replace(`/${e.e.TILE_URL_VERSION}/`,"")}`;let o=r.params;return i&&(o=o.filter(e=>!e.match(/^access_token=/))),o.length&&(n+=`?${o.join("&")}`),n}canonicalizeTileset(t,i){const r=!!i&&e.h(i),n=[];for(const o of t.tiles||[])e.j(o)?n.push(this.canonicalizeTileURL(o,r)):n.push(o);return n}_makeAPIURL(t,i){const r="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",n=E(e.e.API_URL);if(t.protocol=n.protocol,t.authority=n.authority,"http"===t.protocol){const e=t.params.indexOf("secure");e>=0&&t.params.splice(e,1)}if("/"!==n.path&&(t.path=`${n.path}${t.path}`),!e.e.REQUIRE_ACCESS_TOKEN)return I(t);if(i=i||e.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!i)throw new Error(`An API access token is required to use Mapbox GL. ${r}`);if("s"===i[0])throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${r}`)}return t.params=t.params.filter(e=>-1===e.indexOf("access_token")),t.params.push(`access_token=${i||""}`),I(t)}}const S=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function E(e){const t=e.match(S);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 I(e){const t=e.params.length?`?${e.params.join("&")}`:"";return`${e.protocol}://${e.authority}${e.path}${t}`}const A="mapbox.eventData";function M(t){if(!t)return null;const i=t.split(".");if(!i||3!==i.length)return null;try{return JSON.parse(e.l(i[1]))}catch(e){return null}}class C{constructor(e){this.type=e,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const i=M(e.e.ACCESS_TOKEN);let r="";return r=i&&i.u?e.f(i.u):e.e.ACCESS_TOKEN||"",t?`${A}.${t}:${r}`:`${A}:${r}`}fetchEventData(){const t=e.s("localStorage"),i=this.getStorageKey(),r=this.getStorageKey("uuid"),n=this.getStorageKey("uuidTimestamp");if(t)try{const e=localStorage.getItem(i);e&&(this.eventData=JSON.parse(e));const t=localStorage.getItem(r);t&&(this.anonId=t);const o=localStorage.getItem(n);o&&(this.anonIdTimestamp=Number(o));const s=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp<s)&&this.refreshUUID()}catch(t){e.w("Unable to read from LocalStorage")}}refreshUUID(){this.anonId=e.u(),this.anonIdTimestamp=Date.now()}saveEventData(){const t=e.s("localStorage"),i=this.getStorageKey(),r=this.getStorageKey("uuid"),n=this.getStorageKey("uuidTimestamp"),o=this.anonId,s=this.anonIdTimestamp;if(t&&o)try{localStorage.setItem(r,o),Object.keys(this.eventData).length>=1&&localStorage.setItem(i,JSON.stringify(this.eventData)),s&&localStorage.setItem(n,s.toString())}catch(t){e.w("Unable to write to LocalStorage")}}processRequests(e){}postEvent(t,i,r,n){if(!e.e.EVENTS_URL)return;const o=E(e.e.EVENTS_URL);o.params.push(`access_token=${n||e.e.ACCESS_TOKEN||""}`);const s={event:this.type,created:new Date(t).toISOString()},a=i?Object.assign(s,i):s,l={url:I(o),headers:{"Content-Type":"text/plain"},body:JSON.stringify([a])};this.pendingRequest=e.p(l,e=>{this.pendingRequest=null,r(e),this.saveEventData(),this.processRequests(n)})}queueRequest(e,t){this.queue.push(e),this.processRequests(t)}}class P extends C{constructor(e){super("metrics"),e&&(this.data=e)}postMetricsEvent(t){if(!e.e.EVENTS_URL||!t&&!e.e.ACCESS_TOKEN)return;this.anonId||this.fetchEventData(),e.v(this.anonId)||this.refreshUUID();const i=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:i},t)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:t,payload:i}=this.queue.shift();this.postEvent(t,i,()=>{},e)}}const R=new class extends C{constructor(e){super("appUserTurnstile"),this._customAccessToken=e}postTurnstileEvent(t,i){e.e.EVENTS_URL&&e.e.ACCESS_TOKEN&&Array.isArray(t)&&t.some(t=>e.h(t)||e.j(t))&&this.queueRequest(Date.now(),i)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const r=M(e.e.ACCESS_TOKEN),n=r?r.u:e.e.ACCESS_TOKEN;let o=n!==this.eventData.tokenU;e.v(this.anonId)||(this.refreshUUID(),o=!0);const s=this.queue.shift();if(this.eventData.lastSuccess){const e=new Date(this.eventData.lastSuccess),t=new Date(s),i=(s-this.eventData.lastSuccess)/864e5;o=o||i>=1||i<-1||e.getDate()!==t.getDate()}else o=!0;o?this.postEvent(s,{sdkIdentifier:"mapbox-gl-js",sdkVersion:t,skuId:b,"enabled.telemetry":!1,userId:this.anonId},e=>{e||(this.eventData.lastSuccess=s,this.eventData.tokenU=n)},i):this.processRequests()}},z=R.postTurnstileEvent.bind(R),L=new class extends C{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(t,i,r,n){this.skuToken=i,this.errorCb=n,e.e.EVENTS_URL&&(r||e.e.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},r):this.errorCb(new Error(w)))}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;const{id:r,timestamp:n}=this.queue.shift();r&&this.success[r]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),e.v(this.anonId)||this.refreshUUID(),this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:t,skuId:b,skuToken:this.skuToken,userId:this.anonId},e=>{e?this.errorCb(e):r&&(this.success[r]=!0)},i))}remove(){this.errorCb=null}},D=L.postMapLoadEvent.bind(L),O=new class extends C{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(t){let i=this.mapInstanceIdMap.get(t);
vendor: 4,182 bytes, line 2
2return i||(i=e.u(),this.mapInstanceIdMap.set(t,i)),i}getEventId(e){const t=this.eventIdPerMapInstanceMap.get(e)||0;return this.eventIdPerMapInstanceMap.set(e,t+1),t}postStyleLoadEvent(t,i){const{map:r,style:n,importedStyles:o}=i;if(!e.e.EVENTS_URL||!t&&!e.e.ACCESS_TOKEN)return;const s=this.getMapInstanceId(r),a={mapInstanceId:s,eventId:this.getEventId(s),style:n};o.length&&(a.importedStyles=o),this.queueRequest({timestamp:Date.now(),payload:a},t)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:t,payload:i}=this.queue.shift();this.postEvent(t,i,()=>{},e)}},F=O.postStyleLoadEvent.bind(O),k=new P({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),B=k.postMetricsEvent.bind(k),N=new P({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),V=N.postMetricsEvent.bind(N),U=new class extends C{constructor(){super("gljs.performance")}postPerformanceEvent(t,i){e.e.EVENTS_URL&&(t||e.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:i},t)}processRequests(r){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:o,performanceData:s}=this.queue.shift(),a=function(r){const o=performance.getEntriesByType("resource"),s=performance.getEntriesByType("mark"),a=function(e){const t={};if(e)for(const i in e)if("other"!==i)for(const r of e[i]){const e=`${i}ResolveRangeMin`,n=`${i}ResolveRangeMax`,o=`${i}RequestCount`,s=`${i}RequestCachedCount`;t[e]=Math.min(t[e]||1/0,r.startTime),t[n]=Math.max(t[n]||-1/0,r.responseEnd);const a=e=>{void 0===t[e]&&(t[e]=0),++t[e]};void 0!==r.transferSize&&0===r.transferSize&&a(s),a(o)}return t}(function(e,t){const i={};if(e)for(const r of e){const e=t(r);void 0===i[e]&&(i[e]=[]),i[e].push(r)}return i}(o,n)),l=window.devicePixelRatio,c=navigator.connection||navigator.mozConnection||navigator.webkitConnection,h=c?c.effectiveType:void 0,u={counters:[],metadata:[],attributes:[]},d=(e,t,i)=>{null!=i&&e.push({name:t,value:i.toString()})};for(const e in a)d(u.counters,e,a[e]);if(r.interactionRange[0]!==1/0&&r.interactionRange[1]!==-1/0&&(d(u.counters,"interactionRangeMin",r.interactionRange[0]),d(u.counters,"interactionRangeMax",r.interactionRange[1])),s)for(const e of Object.values(i)){const t=s.find(t=>t.name===e);t&&d(u.counters,e,t.startTime)}return d(u.counters,"visibilityHidden",r.visibilityHidden),d(u.attributes,"style",function(t){if(t)for(const i of t){const t=i.name.split("?")[0];if(e.i(t)){const e=t.split("/").slice(-2);if(2===e.length)return`mapbox://styles/${e[0]}/${e[1]}`}}}(o)),d(u.attributes,"terrainEnabled",r.terrainEnabled?"true":"false"),d(u.attributes,"fogEnabled",r.fogEnabled?"true":"false"),d(u.attributes,"projection",r.projection),d(u.attributes,"zoom",r.zoom),d(u.metadata,"devicePixelRatio",l),d(u.metadata,"connectionEffectiveType",h),d(u.metadata,"navigatorUserAgent",navigator.userAgent),d(u.metadata,"screenWidth",window.screen.width),d(u.metadata,"screenHeight",window.screen.height),d(u.metadata,"windowWidth",window.innerWidth),d(u.metadata,"windowHeight",window.innerHeight),d(u.metadata,"mapWidth",r.width/l),d(u.metadata,"mapHeight",r.height/l),d(u.metadata,"webglRenderer",r.renderer),d(u.metadata,"webglVendor",r.vendor),d(u.metadata,"sdkVersion",t),d(u.metadata,"sdkIdentifier","mapbox-gl-js"),u}(s);for(const e of a.metadata);for(const e of a.counters);for(const e of a.attributes);this.postEvent(o,a,()=>{},r)}},j=U.postPerformanceEvent.bind(U),G=new class extends C{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(t,i,r,n){if(!e.e.API_URL||!e.e.SESSION_PATH)return;const o=E(e.e.API_URL+e.e.SESSION_PATH);o.params.push(`sku=${i||""}`),o.params.push(`access_token=${n||e.e.ACCESS_TOKEN||""}`);const s={url:I(o),headers:{"Content-Type":"text/plain"}};this.pendingRequest=e.g(s,e=>{this.pendingRequest=null,r(e),this.saveEventData(),this.processRequests(n)})}getSessionAPI(t,i,r,n){this.skuToken=i,this.errorCb=n,e.e.SESSION_PATH&&e.e.API_URL&&(r||e.e.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},r):this.errorCb(new Error(w)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{id:t,timestamp:i}=this.queue.shift();
vendor: 4,185 bytes, line 2
2t&&this.success[t]||this.getSession(i,this.skuToken,e=>{e?this.errorCb(e):t&&(this.success[t]=!0)},e)}remove(){this.errorCb=null}},q=G.getSessionAPI.bind(G),H=new Set;function $(e,t){t?H.add(e):H.delete(e)}class Z{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(e,t){this._updatedSourceCaches[e]=t,this.setDirty()}discardSourceCacheUpdate(e){delete this._updatedSourceCaches[e]}updateLayer(e){const t=e.scope;this._updatedLayers[t]=this._updatedLayers[t]||new Set,this._updatedLayers[t].add(e.id),this.setDirty()}removeLayer(e){const t=e.scope;this._removedLayers[t]=this._removedLayers[t]||{},this._updatedLayers[t]=this._updatedLayers[t]||new Set,this._removedLayers[t][e.id]=e,this._updatedLayers[t].delete(e.id),this._updatedPaintProps.delete(e.fqid),this.setDirty()}getRemovedLayer(e){return this._removedLayers[e.scope]?this._removedLayers[e.scope][e.id]:null}discardLayerRemoval(e){this._removedLayers[e.scope]&&delete this._removedLayers[e.scope][e.id]}getLayerUpdatesByScope(){const e={};for(const t in this._updatedLayers)e[t]=e[t]||{},e[t].updatedIds=Array.from(this._updatedLayers[t].values());for(const t in this._removedLayers)e[t]=e[t]||{},e[t].removedIds=Object.keys(this._removedLayers[t]);return e}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(e){this._updatedPaintProps.add(e.fqid),this.setDirty()}getUpdatedImages(e){return this._updatedImages[e]?Array.from(this._updatedImages[e].values()):[]}updateImage(t,i){this._updatedImages[i]=this._updatedImages[i]||new Set,this._updatedImages[i].add(e.I.toString(t)),this.setDirty()}resetUpdatedImages(e){this._updatedImages[e]&&this._updatedImages[e].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function W(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class X extends e.E{constructor(t){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=t,"raster"!==t&&e.r()&&(this.imageRasterizerDispatcher=new e.D(e.t(),this,"Image Rasterizer Worker",1))}addScope(t){this.loaded.set(t,!1),this.imageProviders.set(t,new Map),this.images.set(t,new Map),this.updatedImages.set(t,new Set),this.callbackDispatchedThisFrame.set(t,new Set),this.patterns.set(t,new Map),this.atlasImage.set(t,new e.q({width:1,height:1}))}removeScope(e){this.loaded.delete(e),this.imageProviders.delete(e),this.images.delete(e),this.updatedImages.delete(e),this.callbackDispatchedThisFrame.delete(e),this.patterns.delete(e),this.atlasImage.delete(e);const t=this.atlasTexture.get(e);t&&(t.destroy(),this.atlasTexture.delete(e))}addImageProvider(e,t){this.imageProviders.has(t)||this.imageProviders.set(t,new Map),this.imageProviders.get(t).set(e.id,e)}removeImageProvider(e,t){this.imageProviders.has(t)&&this.imageProviders.get(t).delete(e)}getPendingImageProviders(){const e=[];for(const t of this.imageProviders.values())for(const i of t.values())i.hasPendingRequests()&&e.push(i);return e}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new e.x),this._imageRasterizer}isLoaded(){for(const e of this.loaded.keys())if(!this.loaded.get(e))return!1;return!0}setLoaded(e,t){if(this.loaded.get(t)!==e&&(this.loaded.set(t,e),e)){for(const{ids:e,callback:i}of this.requestors)this._notify(e,t,i);this.requestors=[]}}hasImage(e,t){return!!this.getImage(e,t)}getImage(e,t){return this.images.get(t).get(e.toString())}addImage(e,t,i){this._validate(e,i)&&this.images.get(t).set(e.toString(),i)}_validate(t,i){let r=!0;return this._validateStretch(i.stretchX,i.data&&i.data.width)||(this.fire(new e.y(new Error(`Image "${t.name}
2" has invalid "stretchX" value`))),r=!1),this._validateStretch(i.stretchY,i.data&&i.data.height)||(this.fire(new e.y(new Error(`Image "${t.name}" has invalid "stretchY" value`))),r=!1),this._validateContent(i.content,i)||(this.fire(new e.y(new Error(`Image "${t.name}" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let i=0;for(const r of e){if(r[0]<i||r[1]<r[0]||t<r[1])return!1;i=r[1]}return!0}_validateContent(e,t){if(!e)return!0;if(4!==e.length)return!1;if(!t.usvg){if(e[0]<0||t.data.width<e[0])return!1;if(e[1]<0||t.data.height<e[1])return!1;if(e[2]<0||t.data.width<e[2])return!1;if(e[3]<0||t.data.height<e[3])return!1}return!(e[2]<e[0]||e[3]<e[1])}updateImage(e,t,i){const r=this.images.get(t).get(e.toString());i.version=r.version+1,this.images.get(t).set(e.toString(),i),this.updatedImages.get(t).add(e),this.removeFromImageRasterizerCache(e,t)}clearUpdatedImages(e){this.updatedImages.get(e).clear()}removeFromImageRasterizerCache(t,i){"raster"!==this.spriteFormat&&(e.r()?this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",{imageIds:[t],scope:i}):this.imageRasterizer.removeImagesFromCacheByIds([t],i))}removeImage(e,t){const i=this.images.get(t),r=i.get(e.toString());i.delete(e.toString()),this.patterns.get(t).delete(e.toString()),this.removeFromImageRasterizerCache(e,t),r.userImage&&r.userImage.onRemove&&r.userImage.onRemove()}listImages(t){return Array.from(this.images.get(t).keys()).map(t=>e.I.from(t))}getImages(e,t,i){const r=[],n=[],o=this.imageProviders.get(t);for(const c of e){if(!c.iconsetId){r.push(c);continue}const e=o.get(c.iconsetId);e&&(this.getImage(c,t)?n.push(c):e.addPendingRequest(c))}if(0===r.length)return void this._notify(n,t,i);let s=!0;const a=!!this.loaded.get(t),l=this.images.get(t);if(!a)for(const c of r)l.has(c.toString())||(s=!1);a||s?this._notify(r,t,i):this.requestors.push({ids:r,scope:t,callback:i})}rasterizeImages(e,t){const i=new Map,{tasks:r,scope:n}=e;for(const[o,s]of r.entries()){const e=this.getImage(s.id,n);e&&i.set(o,{image:e,imageVariant:s})}this._rasterizeImages(n,i,t)}_rasterizeImages(t,i,r){if(e.r())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:i,scope:t},r);else{const e=new Map;for(const[r,{image:n,imageVariant:o}]of i.entries())e.set(r,this.imageRasterizer.rasterize(o,n,t,0));r(void 0,e)}}getUpdatedImages(e){return this.updatedImages.get(e)||new Set}_notify(t,i,r){const n=this.images.get(i),o=new Map;for(const s of t){if(!n.get(s.toString())){if(s.iconsetId)continue;this.fire(new e.z("styleimagemissing",{id:s.name}))}const t=n.get(s.toString());if(!t){e.w(`Image "${s.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}const i={data:t.usvg?null:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,usvg:t.usvg,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,hasRenderCallback:Boolean(t.userImage&&t.userImage.render)};t.usvg&&Object.assign(i,{width:t.icon.usvg_tree.width,height:t.icon.usvg_tree.height}),o.set(e.I.toString(s),i)}r(null,o)}getPixelSize(e){const{width:t,height:i}=this.atlasImage.get(e);return{width:t,height:i}}getPattern(t,i,r){const n=t.toString(),o=this.patterns.get(i),s=o.get(n),a=this.getImage(t,i);if(!a)return null;if(s){if(s.position.version===a.version)return s.position;s.position.version=a.version}else{if(a.usvg&&!a.data){const o=this.getPatternInFlightId(n,i);if(this.patternsInFlight.has(o))return null;this.patternsInFlight.add(o);const s=new e.A(t).scaleSelf(e.o.devicePixelRatio),l=new Map([[s.toString(),{image:a,imageVariant:s}]]);return this._rasterizeImages(i,l,(e,t)=>this.storePatternImage(s,i,a,r,t)),null}this.storePattern(t,i,a)}return this._updatePatternAtlas(i,r),o.get(n).position}getPatternInFlightId(t,i){return e.B(t,i)}hasPatternsInFlight(){return 0!==this.patternsInFlight.size}storePatternImage(e,t,i,r,n){const o=e.toString(),s=n?n.get(o):void 0;s&&(i.data=s,this.storePattern(e.id,t,i),this._updatePatternAtlas(t,r),this.patternsInFlight.delete(this.getPatternInFlightId(e.id.toString(),t)))}storePattern(t,i,r){const n={w:r.data.width+2*e.C,h:r.data.height+2*e.C,x:0,y:0},o=new e.F(n,r,e.C);this.patterns.get(i).set(t.toString(),{bin:n,position:o})}destroyAtlasTextures(){for(const e of this.atlasTexture.values())e&&e.destroy();this.atlasTexture.clear()}bind(t,i){const r=t.gl;let n=this.atlasTexture.get(i);n?this.dirty&&(n.update(this.atlasImage.get(i)),this.dirty=!1):(n=new e.T(t,this.atlasImage.get(i),r.RGBA8),this.atlasTexture.set(i,n)),n.bind(r.LINEAR,r.CLAMP_TO_EDGE)}_updatePatternAtlas(t,i){const r=this.patterns.get(t),n=Array.from(r.values()).map(({bin:e})=>e),{w:o,h:s}=e.G(n),a=this.atlasImage.get(t);a.resize({width:o||1,height:s||1});const l=this.images.get(t);for(const[c,{bin:h,position:u}]of r.entries()){let t=u.padding;const r=h.x+t,n=h.y+t,o=l.get(c).data,s=o.width,d=o.height;t=t>1?t-1:t,e.q.copy(o,a,{x:0,y:0},{x:r,y:n},{width:s,height:d},i),e.q.copy(o,a,{x:0,y:d-t},{x:r,y:n-t},{width:s,height:t},i),e.q.copy(o,a,{x:0,y:0},{x:r,y:n+d},{width:s,height:t},i),e.q.copy(o,a,{x:s-t,y:0},{x:r-t,y:n},{width:t,height:d},i),e.q.copy(o,a,{x:0,y:0},{x:r+s,y:n},{width:t,height:d},i),e.q.copy(o,a,{x:s-t,y:d-t},{x:r-t,y:n-t},{width:t,height:t},i),e.q.copy(o,a,{x:0,y:d-t},{x:r+s,y:n-t},{width:t,height:t},i),e.q.copy(o,a,{x:0,y:0},{x:r+s,y:n+d},{width:t,height:t},i),e.q.copy(o,a,{x:s-t,y:0},{x:r-t,y:n+d},{width:t,height:t},i)}this.dirty=!0}beginFrame(){for(const e of this.images.keys())this.callbackDispatchedThisFrame.set(e,new Set)}
2dispatchRenderCallbacks(e,t){const i=this.images.get(t);for(const r of e){if(this.callbackDispatchedThisFrame.get(t).has(r.toString()))continue;this.callbackDispatchedThisFrame.get(t).add(r.toString());const e=i.get(r.toString());W(e)&&this.updateImage(r,t,e)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function Y(t){const i=t.value,r=t.valueSpec,n=t.style,o=t.styleSpec,s=t.key,a=t.arrayElementValidator||ye;if(!Array.isArray(i))return[new e.V(s,i,`array expected, ${e.K(i)} found`)];if(r.length&&i.length!==r.length)return[new e.V(s,i,`array length ${r.length} expected, length ${i.length} found`)];if(r["min-length"]&&i.length<r["min-length"])return[new e.V(s,i,`array length at least ${r["min-length"]} expected, length ${i.length} found`)];let l={type:r.value,values:r.values,minimum:r.minimum,maximum:r.maximum,function:void 0};o.$version<7&&(l.function=r.function),e.H(r.value)&&(l=r.value);let c=[];for(let e=0;e<i.length;e++)c=c.concat(a({array:i,arrayIndex:e,value:i[e],valueSpec:l,style:n,styleSpec:o,key:`${s}[${e}]`},!0));return c}function K(t){const i=t.key,r=t.value,n=t.valueSpec;if(!e.L(r))return[new e.V(i,r,`number expected, ${e.K(r)} found`)];if(r!=r)return[new e.V(i,r,"number expected, NaN found")];if("minimum"in n){let o=n.minimum;if(Array.isArray(n.minimum)&&(o=n.minimum[t.arrayIndex]),r<o)return[new e.V(i,r,`${r} is less than the minimum value ${o}`)]}if("maximum"in n){let o=n.maximum;if(Array.isArray(n.maximum)&&(o=n.maximum[t.arrayIndex]),r>o)return[new e.V(i,r,`${r} is greater than the maximum value ${o}`)]}return[]}function J(t){const i=t.key,r=t.value;if(!e.H(r))return[new e.V(i,r,`object expected, ${e.K(r)} found`)];const n=t.valueSpec,o=e.J(r.type);let s,a,l,c={};const h="categorical"!==o&&void 0===r.property,u=!h,d=function(t){const i=t.stops;return Array.isArray(i)&&Array.isArray(i[0])&&e.H(i[0][0])}(r),p=xe({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===o)return[new e.V(t.key,t.value,'identity function may not have a "stops" property')];let i=[];const r=t.value;return i=i.concat(Y({key:t.key,value:r,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:f})),Array.isArray(r)&&0===r.length&&i.push(new e.V(t.key,r,"array must have at least one stop")),i},default:function(e){return ye({key:e.key,value:e.value,valueSpec:n,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===o&&h&&p.push(new e.V(t.key,t.value,'missing required property "property"')),"identity"===o||r.stops||p.push(new e.V(t.key,t.value,'missing required property "stops"')),"exponential"===o&&n.expression&&!e.M(n)&&p.push(new e.V(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(u&&!e.N(n)?p.push(new e.V(t.key,t.value,"property functions not supported")):h&&!e.O(n)&&p.push(new e.V(t.key,t.value,"zoom functions not supported"))),"categorical"!==o&&!d||void 0!==r.property||p.push(new e.V(t.key,t.value,'"property" property is required')),p;function f(t){let i=[];const r=t.value,o=t.key;if(!Array.isArray(r))return[new e.V(o,r,`array expected, ${e.K(r)} found`)];if(2!==r.length)return[new e.V(o,r,`array length 2 expected, length ${r.length} found`)];
2if(d){if(!e.H(r[0]))return[new e.V(o,r,`object expected, ${e.K(r[0])} found`)];const n=r[0];if(void 0===n.zoom)return[new e.V(o,r,"object stop key must have zoom")];if(void 0===n.value)return[new e.V(o,r,"object stop key must have value")];const s=e.J(n.zoom);if("number"!=typeof s)return[new e.V(o,n.zoom,"stop zoom values must be numbers")];if(l&&l>s)return[new e.V(o,n.zoom,"stop zoom values must appear in ascending order")];s!==l&&(l=s,a=void 0,c={}),i=i.concat(xe({key:`${o}[0]`,value:r[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:K,value:m}}))}else i=i.concat(m({key:`${o}[0]`,value:r[0],style:t.style,styleSpec:t.styleSpec},r));return e.Q(e.S(r[1]))?i.concat([new e.V(`${o}[1]`,r[1],"expressions are not allowed in function stops.")]):i.concat(ye({key:`${o}[1]`,value:r[1],valueSpec:n,style:t.style,styleSpec:t.styleSpec}))}function m(t,i){const r=e.K(t.value),l=e.J(t.value),h=null!==t.value?t.value:i;if(s){if(r!==s)return[new e.V(t.key,h,`${r} stop domain type must match previous stop domain type ${s}`)]}else s=r;if("number"!==r&&"string"!==r&&"boolean"!==r&&"number"!=typeof l&&"string"!=typeof l&&"boolean"!=typeof l)return[new e.V(t.key,h,"stop domain value must be a number, string, or boolean")];if("number"!==r&&"categorical"!==o){let i=`number expected, ${r} found`;return e.N(n)&&void 0===o&&(i+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new e.V(t.key,h,i)]}return"categorical"!==o||"number"!==r||"number"==typeof l&&isFinite(l)&&Math.floor(l)===l?"categorical"!==o&&"number"===r&&"number"==typeof l&&"number"==typeof a&&void 0!==a&&l<a?[new e.V(t.key,h,"stop domain values must appear in ascending order")]:(a=l,"categorical"===o&&l in c?[new e.V(t.key,h,"stop domain values must be unique")]:(c[l]=!0,[])):[new e.V(t.key,h,`integer expected, found ${String(l)}`)]}}function Q(t){const i=("property"===t.expressionContext?e.W:e.U)(e.S(t.value),t.valueSpec);if("error"===i.result)return i.value.map(i=>new e.V(`${t.key}${i.key}`,t.value,i.message));const r=i.value.expression||i.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!r.outputDefined())return[new e.V(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!e.Z(r))return[new e.V(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext)return ee(r,t);if("appearance"===t.expressionContext)return te(r,t);if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!e.X(r,["zoom","feature-state"]))return[new e.V(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!e.Y(r))return[new e.V(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ee(t,i){const r=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(i.valueSpec&&i.valueSpec.expression)for(const e of i.valueSpec.expression.parameters)r.delete(e);if(0===r.size)return[];const n=[];return t instanceof e._&&r.has(t.name)?[new e.V(i.key,i.value,`["${t.name}"] expression is not supported in a filter for a ${i.object.type} layer with id: ${i.object.id}`)]:(t.eachChild(e=>{n.push(...ee(e,i))}),n)}function te(t,i){const r=new Set;if(i.valueSpec&&i.valueSpec.expression)for(const e of i.valueSpec.expression.parameters)r.add(e);if(0===r.size)return[];const n=[];return t instanceof e._&&!r.has(t.name)?[new e.V(i.key,i.value,`["${t.name}"] is not an allowed parameter`)]:(t.eachChild(e=>{n.push(...te(e,i))}),n)}function ie(t){const i=t.key,r=t.value,n=t.valueSpec,o=[];return Array.isArray(n.values)?-1===n.values.indexOf(e.J(r))&&o.push(new e.V(i,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(n.values).indexOf(e.J(r))&&o.push(new e.V(i,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),o}function re(t){return e.a2(e.S(t.value))?Q(Object.assign({},t,{expressionContext:"filter",valueSpec:t.styleSpec[`filter_${t.layerType||"fill"}`]})):ne(t)}function ne(t){const i=t.value,r=t.key;
2if(!Array.isArray(i))return[new e.V(r,i,`array expected, ${e.K(i)} found`)];if(i.length<1)return[new e.V(r,i,"filter array must have at least 1 element")];const n=t.styleSpec;let o=ie({key:`${r}[0]`,value:i[0],valueSpec:n.filter_operator});const s=()=>{i.length>=2&&(e.a0(i[1])||o.push(new e.V(`${r}[1]`,i[1],`string expected, ${e.K(i[1])} found`)));for(let t=2;t<i.length;t++)"$type"===e.J(i[1])?o=o.concat(ie({key:`${r}[${t}]`,value:i[t],valueSpec:n.geometry_type})):e.a0(i[t])||e.L(i[t])||e.$(i[t])||o.push(new e.V(`${r}[${t}]`,i[t],`string, number, or boolean expected, ${e.K(i[t])} found.`))};switch(e.J(i[0])){case"<":case"<=":case">":case">=":i.length>=2&&"$type"===e.J(i[1])&&o.push(new e.V(r,i,`"$type" cannot be use with operator "${i[0]}"`)),3!==i.length&&o.push(new e.V(r,i,`filter array for operator "${i[0]}" must have 3 elements`)),s();break;case"==":case"!=":3!==i.length&&o.push(new e.V(r,i,`filter array for operator "${i[0]}" must have 3 elements`)),s();break;case"in":case"!in":s();break;case"any":case"all":case"none":for(let e=1;e<i.length;e++)o=o.concat(ne({key:`${r}[${e}]`,value:i[e],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":2!==i.length?o.push(new e.V(r,i,`filter array for "${i[0]}" operator must have 2 elements`)):e.a0(i[1])||o.push(new e.V(`${r}[1]`,i[1],`string expected, ${e.K(i[1])} found`))}return o}function oe(t,i){const r=t.key,n=t.style,o=t.layer,s=t.styleSpec,a=t.value,l=t.objectKey,c=s[`${i}_${t.layerType}`];if(!c)return[];const h=l.match(/^(.*)-use-theme$/);if(h&&c[h[1]])return e.Q(e.S(a))?[].concat(ye({key:r,value:a,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:n,styleSpec:s,expressionContext:"property",propertyType:i,propertyKey:l})):ye({key:r,value:a,valueSpec:{type:"string"},style:n,styleSpec:s});const u=l.match(/^(.*)-transition$/);if("paint"===i&&u&&c[u[1]]&&c[u[1]].transition)return ye({key:r,value:a,valueSpec:s.transition,style:n,styleSpec:s});const d=t.valueSpec||c[l];if(!d)return[new e.a3(r,a,`unknown property "${l}"`)];let p;if(e.a0(a)&&e.N(d)&&!d.tokens&&(p=/^{([^}]+)}$/.exec(a))){const t=`\`{ "type": "identity", "property": ${p?JSON.stringify(p[1]):'"_"'} }\``;return[new e.V(r,a,`"${l}" does not support interpolation syntax\nUse an identity property function instead: ${t}.`)]}const f=[];if("symbol"===t.layerType)"text-field"!==l||!n||n.glyphs||n.imports||f.push(new e.V(r,a,'use of "text-field" requires a style "glyphs" property')),"text-font"===l&&e.a4(e.S(a))&&"identity"===e.J(a.type)&&f.push(new e.V(r,a,'"text-font" does not support identity functions'));else if("model"===t.layerType&&"paint"===i&&o&&o.layout&&o.layout.hasOwnProperty("model-id")&&e.N(d)&&(e.a5(d)||e.O(d))){const t=e.W(e.S(a),d).value,i="expression"in t&&t.expression||"_styleExpression"in t&&t._styleExpression&&t._styleExpression.expression;i&&!e.X(i,["measure-light"])&&("model-emissive-strength"===l&&e.Y(i)&&e.Z(i)||f.push(new e.V(r,a,`${l} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return f.concat(ye({key:t.key,value:a,valueSpec:d,style:n,styleSpec:s,expressionContext:"property",propertyType:i,propertyKey:l}))}function se(e){return oe(e,"paint")}function ae(e){return oe(e,"layout")}function le(t){let i=[];const r=t.value,n=t.key,o=t.style,s=t.styleSpec;if(!e.H(r))return[new e.V(n,r,"object expected")];r.type||r.ref||i.push(new e.V(n,r,'either "type" or "ref" is required'));let a=e.J(r.type);const l=e.J(r.ref);if(r.id){const s=e.J(r.id);for(let a=0;a<t.arrayIndex;a++){const t=o.layers[a];e.J(t.id)===s&&i.push(new e.V(n,r.id,`duplicate layer id "${s}", previously used at line ${t.id.__line__}`))}}if("ref"in r){let t;["type","source","source-layer","filter","layout"].forEach(t=>{t in r&&i.push(new e.V(n,r[t],`"${t}" is prohibited for ref layers`))}),o.layers.forEach(i=>{e.J(i.id)===l&&(t=i)}),t?t.ref?i.push(new e.V(n,r.ref,"ref cannot reference another ref layer")):a=e.J(t.type):"string"==typeof l&&i.push(new e.V(n,r.ref,`ref layer "${l}" not found`))}else if("background"!==a&&"sky"!==a&&"slot"!==a)if(r.source)if(e.a0(r.source)){const t=o.sources&&o.sources[r.source],s=t&&e.J(t.type);t?"vector"===s&&"raster"===a?i.push(new e.V(n,r.source,`layer "${r.id}" requires a raster source`)):"raster"===s&&"raster"!==a?i.push(new e.V(n,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==s||r["source-layer"]?"raster-dem"===s&&"hillshade"!==a?i.push(new e.V(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):"raster-array"!==s||["raster","raster-particle"].includes(a)?"line"===a&&r.paint&&(r.paint["line-gradient"]||r.paint["line-trim-offset"])&&"geojson"===s&&!t.lineMetrics?i.push(new e.V(n,r,`layer "${r.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):"raster-particle"===a&&"raster-array"!==s&&i.push(new e.V(n,r.source,`layer "${r.id}" requires a 'raster-array' source.`)):i.push(new e.V(n,r.source,"raster-array source can only be used with layer type 'raster'.")):i.push(new e.V(n,r,`layer "${r.id}" must specify a "source-layer"`)):i.push(new e.V(n,r.source,`source "${r.source}" not found`))}else i.push(new e.V(`${n}.source`,r.source,'"source" must be a string'));else i.push(new e.V(n,r,'missing required property "source"'));return i=i.concat(xe({key:n,value:r,valueSpec:s.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":()=>[],type:()=>ye({key:`${n}.type`,value:r.type,valueSpec:s.layer.type,style:t.style,styleSpec:t.styleSpec,object:r,objectKey:"type"}),filter:e=>re(Object.assign({layerType:a},e)),layout:e=>xe({layer:r,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":e=>ae(Object.assign({layerType:a},e))}}),paint:e=>xe({layer:r,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":e=>se(Object.assign({layerType:a,layer:r},e))}}),appearances(t){const i=Y({key:t.key,value:t.value,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:t=>function(t){const{key:i,layer:r,layerType:n}=t,o=e.J(t.value),s=e.J(o.name),a=e.J(o.condition),l=xe({key:i,value:o,valueSpec:t.styleSpec.appearance,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{condition:t=>function(t){const i=[];return i.push(...Q({key:t.key,value:t.object.condition,valueSpec:e.a6.appearance.condition,expressionContext:"appearance"})),i}(Object.assign({layer:r,layerType:n},t)),properties:t=>function(t){const i=[],{styleSpec:r,layer:n,layerType:o}=t,s=r[`paint_${o}`],a=r[`layout_${o}`],l=t.object[t.objectKey];for(const c in l){const r=c in s?"paint":c in a?"layout":void 0;if(!r){i.push(new e.V(t.key,c,`unknown property "${c}" for layer type "${o}"`));continue}const h=Object.assign({},t,{key:`${t.key}.${c}`,object:l,objectKey:c,layer:n,layerType:o,value:l[c],valueSpec:"paint"===r?s[c]:a[c]});i.push(...oe(h,r))}return i}(Object.assign({layer:r,layerType:n},t))}});return"hidden"!==s&&void 0===a&&l.push(new e.V(t.key,"name",'Appearance with name different than "hidden" must have a condition')),l}(Object.assign({layerType:a,layer:r},t))}),n=Array.isArray(t.value)?t.value:[],o=new Set;
2return n.forEach((n,s)=>{const a=e.J(n.name);if(a)if(o.has(a)){const n=e.J(r.id);i.push(new e.V(t.key,a,`Duplicated appearance name "${a}" for layer "${n}"`))}else o.add(a)}),i}}})),i}function ce({key:t,value:i}){return e.a0(i)?[]:[new e.V(t,i,`string expected, ${e.K(i)} found`)]}const he={promoteId:function t({key:i,value:r}){if(e.a0(r))return ce({key:i,value:r});if(Array.isArray(r)){const t=[],n=e.S(r),o=e.U(n);return"error"===o.result&&o.value.forEach(r=>{t.push(new e.V(`${i}${r.key}`,null,`${r.message}`))}),e.X(o.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||t.push(new e.V(`${i}`,null,"promoteId expression should be only feature dependent")),t}if(!e.H(r))return[new e.V(i,r,`string, expression or object expected, "${e.K(r)}" found`)];const n=[];for(const e in r)n.push(...t({key:`${i}.${e}`,value:r[e]}));return n}};function ue(t){const i=t.value,r=t.key,n=t.styleSpec,o=t.style;if(!e.H(i))return[new e.V(r,i,`object expected, ${e.K(i)} found`)];if(!("type"in i))return[new e.V(r,i,'"type" is required')];const s=e.J(i.type);let a=[];switch(["vector","raster","raster-dem","raster-array"].includes(s)&&("url"in i||"tiles"in i||a.push(new e.a3(r,i,'Either "url" or "tiles" is required.'))),s){case"vector":case"raster":case"raster-dem":case"raster-array":return a=a.concat(xe({key:r,value:i,valueSpec:n[`source_${s.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:he})),a;case"geojson":if(a=xe({key:r,value:i,valueSpec:n.source_geojson,style:o,styleSpec:n,objectElementValidators:he}),"cluster"in i&&"clusterProperties"in i){if(!e.H(i.clusterProperties))return[new e.V(`${r}.clusterProperties`,i,`object expected, ${e.K(i)} found`)];for(const t in i.clusterProperties){const n=i.clusterProperties[t];if(!Array.isArray(n))return[new e.V(`${r}.clusterProperties.${t}`,n,"array expected")];const[o,s]=n,l="string"==typeof o?[o,["accumulated"],["get",t]]:o;a.push(...Q({key:`${r}.${t}.map`,value:s,expressionContext:"cluster-map"})),a.push(...Q({key:`${r}.${t}.reduce`,value:l,expressionContext:"cluster-reduce"}))}}return a;case"video":return xe({key:r,value:i,valueSpec:n.source_video,style:o,styleSpec:n});case"image":return xe({key:r,value:i,valueSpec:n.source_image,style:o,styleSpec:n});case"canvas":return[new e.V(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ie({key:`${r}.type`,value:i.type,valueSpec:{values:de(n)}})}}function de(e){return e.source.reduce((t,i)=>{const r=e[i];return"enum"===r.type.type&&(t=t.concat(Object.keys(r.type.values||{}))),t},[])}function pe(t){const i=t.value,r=t.styleSpec,n=r.light,o=t.style;if(void 0===i)return[];if(!e.H(i))return[new e.V("light",i,`object expected, ${e.K(i)} found`)];let s=[];for(const a in i){const t=a.match(/^(.*)-transition$/),l=a.match(/^(.*)-use-theme$/);s=s.concat(l&&n[l[1]]?ye({key:a,value:i[a],valueSpec:{type:"string"},style:o,styleSpec:r}):t&&n[t[1]]&&n[t[1]].transition?ye({key:a,value:i[a],valueSpec:r.transition,style:o,styleSpec:r}):n[a]?ye({key:a,value:i[a],valueSpec:n[a],style:o,styleSpec:r}):[new e.V(a,i[a],`unknown property "${a}"`)])}return s}function fe(t){const i=t.value;if(!i)return[];const r=t.key;if(!e.H(i))return[new e.V(r,i,`object expected, ${e.K(i)} found`)];let n=[];const o=t.styleSpec,s=o["light-3d"],a=t.style,l=t.style.lights;for(const u of["type","id"])if(!(u in i))return n=n.concat([new e.V(r,i,`missing property "${u}"`)]),n;if(!e.a0(i.type))return n=n.concat([new e.V(`${r}.type`,i.type,"string expected")]),n;if(l)for(let u=0;u<t.arrayIndex;u++){const t=e.J(i.type),o=l[u];e.J(o.type)===t&&n.push(new e.V(r,i.id,`duplicate light type "${i.type}", previously defined at line ${o.id.__line__}`))}const c=`properties_light_${i.type}`;if(!(c in o))return n=n.concat([new e.V(`${r}.type`,i,`Invalid light type ${i.type}`)]),n;const h=o[c];for(const u in i)if("properties"===u){const r=i[u];if(!e.H(r))return n=n.concat([new e.V("properties",r,`object expected, ${e.K(r)} found`)]),n;for(const s in r){const l=s.match(/^(.*)-transition$/),c=s.match(/^(.*)-use-theme$/);n=n.concat(c&&h[c[1]]?ye({key:u,value:r[s],valueSpec:{type:"string"},style:a,styleSpec:o}):l&&h[l[1]]&&h[l[1]].transition?ye({key:u,value:i[u],valueSpec:o.transition,style:a,styleSpec:o}):h[s]?ye({key:s,value:r[s],valueSpec:h[s],style:a,styleSpec:o}):[new e.a3(t.key,r[s],`unknown property "${s}"`)])}}else n=n.concat(s[u]?ye({key:u,value:i[u],valueSpec:s[u],style:a,styleSpec:o}):[new e.a3(u,i[u],`unknown property "${u}"`)]);return n}function me(t){const i=t.value,r=t.key,n=t.style,o=t.styleSpec,s=o.terrain;if(null==i)return[];if(!e.H(i))return[new e.V("terrain",i,`object expected, ${e.K(i)} found`)];let a=[];for(const l in i){const t=l.match(/^(.*)-transition$/),r=l.match(/^(.*)-use-theme$/);a=a.concat(r&&s[r[1]]?ye({key:l,value:i[l],valueSpec:{type:"string"},style:n,styleSpec:o}):t&&s[t[1]]&&s[t[1]].transition?ye({key:l,value:i[l],valueSpec:o.transition,style:n,styleSpec:o}):s[l]?ye({key:l,value:i[l],valueSpec:s[l],style:n,styleSpec:o}):[new e.a3(l,i[l],`unknown property "${l}"`)])}if(i.source)if(e.a0(i.source)){const t=n.sources&&n.sources[i.source],o=t&&e.J(t.type);t?"raster-dem"!==o&&a.push(new e.V(`${r}.source`,i.source,`terrain cannot be used with a source of type ${o}, it only be used with a "raster-dem" source type`)):a.push(new e.V(`${r}.source`,i.source,`source "${i.source}" not found`))}else a.push(new e.V(`${r}.source`,i.source,"source must be a string"));
2else a.push(new e.V(r,i,'terrain is missing required property "source"'));return a}function _e(t){const i=t.value,r=t.style,n=t.styleSpec,o=n.fog;if(void 0===i)return[];if(!e.H(i))return[new e.V("fog",i,`object expected, ${e.K(i)} found`)];let s=[];for(const a in i){const t=a.match(/^(.*)-transition$/),l=a.match(/^(.*)-use-theme$/);s=s.concat(l&&o[l[1]]?ye({key:a,value:i[a],valueSpec:{type:"string"},style:r,styleSpec:n}):t&&o[t[1]]&&o[t[1]].transition?ye({key:a,value:i[a],valueSpec:n.transition,style:r,styleSpec:n}):o[a]?ye({key:a,value:i[a],valueSpec:o[a],style:r,styleSpec:n}):[new e.a3(a,i[a],`unknown property "${a}"`)])}return s}const ge={"*":()=>[],array:Y,boolean:function(t){const i=t.value,r=t.key;return e.$(i)?[]:[new e.V(r,i,`boolean expected, ${e.K(i)} found`)]},number:K,color:function({key:t,value:i}){return e.a0(i)?null===e.a1.parseCSSColor(i)?[new e.V(t,i,`color expected, "${i}" found`)]:[]:[new e.V(t,i,`color expected, ${e.K(i)} found`)]},enum:ie,filter:re,function:J,layer:le,object:xe,source:ue,model:e.a7,light:pe,"light-3d":fe,terrain:me,fog:_e,string:ce,formatted:function(e){return 0===ce(e).length?[]:Q(e)},resolvedImage:function(e){return 0===ce(e).length?[]:Q(e)},projection:function(t){const i=t.value,r=t.styleSpec,n=r.projection,o=t.style;if(e.H(i)){let e=[];for(const t in i)e=e.concat(ye({key:t,value:i[t],valueSpec:n[t],style:o,styleSpec:r}));return e}return e.a0(i)?[]:[new e.V("projection",i,`object or string expected, ${e.K(i)} found`)]},import:function(t){const i=t.key,{value:r,styleSpec:n}=t;if(!e.H(r))return[new e.V(i,r,"import must be an object")];const{data:o,...s}=r;Object.defineProperty(s,"__line__",{value:r.__line__,enumerable:!1});let a=xe(Object.assign({},t,{value:s,valueSpec:n.import}));return""===e.J(s.id)&&a.push(new e.V(`${t.key}.id`,s,"import id can't be an empty string")),o&&(a=a.concat(be(o,n,{key:`${t.key}.data`}))),a},iconset:function(t){const i=t.value,r=t.key,n=t.styleSpec,o=t.style;if(!e.H(i))return[new e.V(r,i,"object expected")];if(!i.type)return[new e.V(r,i,'"type" is required')];const s=e.J(i.type);let a=[];if(a=a.concat(xe({key:r,value:i,valueSpec:n[`iconset_${s}`],style:o,styleSpec:n})),function(e,t){return!("source"!==e||!t.source)}(s,i)){const t=o.sources&&o.sources[i.source],n=t&&e.J(t.type);t?"raster-array"!==n&&a.push(new e.V(r,i.source,`iconset cannot be used with a source of type ${String(n)}, it only be used with a "raster-array" source type`)):a.push(new e.V(r,i.source,`source "${i.source}" not found`))}return a}};function ye(t,i=!1){const r=t.value,n=t.valueSpec,o=t.styleSpec;if(n.expression){if(e.a4(e.J(r)))return J(t);if(e.Q(e.S(r)))return Q(t)}if(n.type&&ge[n.type]){const e=ge[n.type](t);return!0===i&&e.length>0&&Array.isArray(t.value)?Q(t):e}return xe(Object.assign({},t,{valueSpec:n.type?o[n.type]:n}))}function xe(t){const i=t.key,r=t.value,n=t.valueSpec||{},o=t.objectElementValidators||{},s=t.style,a=t.styleSpec;if(!e.H(r))return[new e.V(i,r,`object expected, ${e.K(r)} found`)];let l=[];for(const c in r){const t=c.split(".")[0];let h;o[t]?h=o[t]:n[t]?h=ye:o["*"]?h=o["*"]:n["*"]&&(h=ye),h?l=l.concat(h({key:(i?`${i}.`:i)+c,value:r[c],valueSpec:n[t]||n["*"],style:s,styleSpec:a,object:r,objectKey:c},r)):l.push(new e.a3(i,r[c],`unknown property "${c}"`))}for(const c in n){if(o[c])continue;const t=n[c];t.required&&void 0===t.default&&void 0===r[c]&&l.push(new e.V(i,r,`missing required property "${c}"`))}return l}function ve({key:t,value:i}){const r=ce({key:t,value:i});if(r.length)return r;const n=i;return-1===n.indexOf("{fontstack}")&&r.push(new e.V(t,i,'"glyphs" url must include a "{fontstack}" token')),-1===n.indexOf("{range}")&&r.push(new e.V(t,i,'"glyphs" url must include a "{range}" token')),r}function be(t,i=e.a6,r={}){return xe({key:r.key||"",value:t,valueSpec:Object.assign(i.$root,{"*":{type:"*"}}),styleSpec:i,style:t,objectElementValidators:{glyphs:ve}})}function we(t,i=e.a6){return Oe(be(t,i))}const Te=e=>Oe(ue(e)),Se=e=>Oe(pe(e)),Ee=e=>Oe(fe(e)),Ie=e=>Oe(me(e)),Ae=e=>Oe(_e(e)),Me=t=>Oe(function(t){const i=t.value,r=t.style,n=t.styleSpec,o=n.snow;if(void 0===i)return[];if(!e.H(i))return[new e.V("snow",i,`object expected, ${e.K(i)} found`)];let s=[];for(const a in i){const t=a.match(/^(.*)-transition$/);s=s.concat(t&&o[t[1]]&&o[t[1]].transition?ye({key:a,value:i[a],valueSpec:n.transition,style:r,styleSpec:n}):o[a]?ye({key:a,value:i[a],valueSpec:o[a],style:r,styleSpec:n}):[new e.a3(a,i[a],`unknown property "${a}"`)])}return s}(t)),Ce=t=>Oe(function(t){const i=t.value,r=t.style,n=t.styleSpec,o=n.rain;if(void 0===i)return[];if(!e.H(i))return[new e.V("rain",i,`object expected, ${e.K(i)} found`)];let s=[];for(const a in i){const t=a.match(/^(.*)-transition$/);s=s.concat(t&&o[t[1]]&&o[t[1]].transition?ye({key:a,value:i[a],valueSpec:n.transition,style:r,styleSpec:n}):o[a]?ye({key:a,value:i[a],valueSpec:o[a],style:r,styleSpec:n}):[new e.a3(a,i[a],`unknown property "${a}"`)])}return s}(t)),Pe=e=>Oe(le(e)),Re=e=>Oe(re(e)),ze=e=>Oe(se(e)),Le=e=>Oe(ae(e)),De=t=>Oe(e.a7(t));function Oe(e){return e.slice().sort((e,t)=>
2e.line&&t.line?e.line-t.line:0)}function Fe(t,i){let r=!1;if(i&&i.length)for(const n of i)n instanceof e.a3?e.w(n.message):(t.fire(new e.y(new Error(n.message))),r=!0);return r}const ke=e.a6.light;let Be;class Ne extends e.E{constructor(t,i="flat"){super(),this._transitionable=new e.a8(Be||(Be=new e.a9({anchor:new e.aa(ke.anchor),position:new e.ab(ke.position),color:new e.aa(ke.color),intensity:new e.aa(ke.intensity)}))),this.setLight(t,i),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,t,i={}){this._validate(Se,e,i)||(this._transitionable.setTransitionOrValue(e),this.id=t)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,i,r){return(!r||!1!==r.validate)&&Fe(this,t.call(we,Object.assign({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.a6})))}}const Ve=e.a6.terrain;let Ue=class extends e.E{constructor(t,i,r,n,o){super(),this.scope=r,this._transitionable=new e.a8(new e.a9({source:new e.aa(Ve.source),exaggeration:new e.aa(Ve.exaggeration)}),r,n),this._transitionable.setTransitionOrValue(t,n),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=i,this.worldview=o}get(){return this._transitionable.serialize()}set(e,t){this._transitionable.setTransitionOrValue(e,t)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}getExaggeration(t){return this._transitioning.possiblyEvaluate(new e.ac(t,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const t=this._transitionable._values.exaggeration;if(!t)return null;const i=t.value.expression;if(!i)return null;let r=-1,n=-1,o=1;for(const s of i.zoomStops)o=i.evaluate(new e.ac(s,{worldview:this.worldview})),o>.01?(r=s,n=-1):n=s;return o<.01&&r>0&&n>r?[r,n]:null}isZoomDependent(){const t=this._transitionable._values.exaggeration;return null!=t&&null!=t.value&&null!=t.value.expression&&t.value.expression instanceof e.ad}};const je=.05;function Ge(t,i,r,n){const o=e.ah(45,65,r),[s,a]=qe(t,n);let l=1-Math.min(1,Math.exp((i-s)/(a-s)*-6));return l*=l*l,l=Math.min(1,1.00747*l),l*o*t.alpha}function qe(e,t){const i=.5/Math.tan(.5*t);return[e.range[0]+i,e.range[1]+i]}
2function He(t,i,r,n,o){const s=e.af([],[i,r,n],o.mercatorFogMatrix);return Ge(t,e.ag(s),o.pitch,o._fov)}function $e(t,i,r,n,o,s,a){const l=[[r,n,0],[o,n,0],[o,s,0],[r,s,0]];let c=Number.MAX_VALUE,h=-Number.MAX_VALUE;for(const u of l){const t=e.af([],u,i),r=e.ag(t);c=Math.min(c,r),h=Math.max(h,r)}return[Ge(t,c,a.pitch,a._fov),Ge(t,h,a.pitch,a._fov)]}const Ze=e.a6.fog;class We extends e.E{constructor(t,i,r,n){super();const o=new e.a9({range:new e.aa(Ze.range),color:new e.aa(Ze.color),"color-use-theme":new e.aa({type:"string","property-type":"data-constant",default:"default"}),"high-color":new e.aa(Ze["high-color"]),"high-color-use-theme":new e.aa({type:"string","property-type":"data-constant",default:"default"}),"space-color":new e.aa(Ze["space-color"]),"space-color-use-theme":new e.aa({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new e.aa(Ze["horizon-blend"]),"star-intensity":new e.aa(Ze["star-intensity"]),"vertical-range":new e.aa(Ze["vertical-range"])});this._transitionable=new e.a8(o,r,new Map(n)),this.set(t,n),this._transitioning=this._transitionable.untransitioned(),this._transform=i,this.properties=new e.ai(o),this.scope=r}get state(){const t=this._transform,i="globe"===t.projection.name,r=e.aj(t.zoom),n=this.properties.get("range"),o=[.5,3];return{range:i?[e.ak(o[0],n[0],r),e.ak(o[1],n[1],r)]:n,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(e,t,i={}){if(this._validate(Ae,e,i))return;const r=Object.assign({},e);for(const n of Object.keys(Ze))void 0===r[n]&&(r[n]=Ze[n].default);this._options=r,this._transitionable.setTransitionOrValue(this._options,t)}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const i=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:e.ah(45,65,t))*i.a}getOpacityAtLatLng(t,i){return this._transform.projection.supportsFog?function(t,i,r){const n=e.ae.fromLngLat(i),o=r.elevation?r.elevation.getAtPointOrZero(n):0;return He(t,n.x,n.y,o,r)}(this.state,t,i):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const i=this._transform.calculateFogTileMatrix(t.toUnwrapped());return $e(this.state,i,0,0,e.al,e.al,this._transform)}getOpacityForBounds(e,t,i,r,n){return this._transform.projection.supportsFog?$e(this.state,e,t,i,r,n,this._transform):[1,1]}getFovAdjustedRange(e){return this._transform.projection.supportsFog?qe(this.state,e):[0,1]}isVisibleOnFrustum(t){if(!this._transform.projection.supportsFog)return!1;const i=[4,5,6,7];for(const r of i){const i=t.points[r];let n;if(i[2]>=0)n=i;else{const o=t.points[r-4];n=e.am(o,i,o[2]/(o[2]-i[2]))}if(He(this.state,n[0],n[1],0,this._transform)>=je)return!0}return!1}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,i,r){return(!r||!1!==r.validate)&&Fe(this,t.call(we,Object.assign({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.a6})))}}let Xe,Ye,Ke,Je=class extends e.E{constructor(t,i,r,n){super();const o=Xe||(Xe=new e.a9({density:new e.aa(e.a6.snow.density),intensity:new e.aa(e.a6.snow.intensity),color:new e.aa(e.a6.snow.color),opacity:new e.aa(e.a6.snow.opacity),vignette:new e.aa(e.a6.snow.vignette),"vignette-color":new e.aa(e.a6.snow["vignette-color"]),"center-thinning":new e.aa(e.a6.snow["center-thinning"]),direction:new e.aa(e.a6.snow.direction),"flake-size":new e.aa(e.a6.snow["flake-size"])}));this._transitionable=new e.a8(o,r,new Map(n)),this.set(t,n),this._transitioning=this._transitionable.untransitioned(),this.properties=new e.ai(o),this.scope=r}get state(){const t=this.properties.get("opacity"),i=this.properties.get("color"),r=this.properties.get("direction"),n=e.an(r[0]),o=-Math.max(e.an(r[1]),.01),s=[Math.cos(n)*Math.cos(o),Math.sin(n)*Math.cos(o),Math.sin(o)],a=this.properties.get("vignette"),l=this.properties.get("vignette-color");return l.a=a,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new e.ao(i.r,i.g,i.b,i.a*t),direction:s,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:l}}get(){return this._transitionable.serialize()}set(t,i,r={}
2){if(this._validate(Me,t,r))return;const n=Object.assign({},t),o=e.a6.snow;for(const e of Object.keys(o))void 0===n[e]&&(n[e]=o[e].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,i)}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,i,r){return(!r||!1!==r.validate)&&Fe(this,t.call(we,Object.assign({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.a6})))}},Qe=class extends e.E{constructor(t,i,r,n){super();const o=Ye||(Ye=new e.a9({density:new e.aa(e.a6.rain.density),intensity:new e.aa(e.a6.rain.intensity),color:new e.aa(e.a6.rain.color),opacity:new e.aa(e.a6.rain.opacity),vignette:new e.aa(e.a6.rain.vignette),"vignette-color":new e.aa(e.a6.rain["vignette-color"]),"center-thinning":new e.aa(e.a6.rain["center-thinning"]),direction:new e.aa(e.a6.rain.direction),"droplet-size":new e.aa(e.a6.rain["droplet-size"]),"distortion-strength":new e.aa(e.a6.rain["distortion-strength"])}));this._transitionable=new e.a8(o,r,new Map(n)),this.set(t,n),this._transitioning=this._transitionable.untransitioned(),this.properties=new e.ai(o),this.scope=r}get state(){const t=this.properties.get("opacity"),i=this.properties.get("color"),r=this.properties.get("direction"),n=e.an(r[0]),o=-Math.max(e.an(r[1]),.01),s=[Math.cos(n)*Math.cos(o),Math.sin(n)*Math.cos(o),Math.sin(o)],a=this.properties.get("vignette-color");return a.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new e.ao(i.r,i.g,i.b,i.a*t),direction:s,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:a}}get(){return this._transitionable.serialize()}set(t,i,r={}){if(this._validate(Ce,t,r))return;const n=Object.assign({},t),o=e.a6.rain;for(const e of Object.keys(o))void 0===n[e]&&(n[e]=o[e].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,i)}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,i,r){return(!r||!1!==r.validate)&&Fe(this,t.call(we,Object.assign({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.a6})))}};class et extends e.E{constructor(t,i,r,n){super(),this.scope=r,this._options=t,this.properties=new e.ai(i),this._transitionable=new e.a8(i,r,new Map(n)),this._transitionable.setTransitionOrValue(t.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(e){this._transitionable.setTransitionOrValue(this._options.properties,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(e,t){this._options=e,this._transitionable.setTransitionOrValue(e.properties,t)}shadowsEnabled(){return!!this.properties&&!0===this.properties.get("cast-shadows")}}const tt=()=>Ke||(Ke=new e.a9({color:new e.aa(e.a6.properties_light_ambient.color),"color-use-theme":new e.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new e.aa(e.a6.properties_light_ambient.intensity)}));let it;const rt=()=>it||(it=new e.a9({direction:new e.ap(e.a6.properties_light_directional.direction),color:new e.aa(e.a6.properties_light_directional.color),"color-use-theme":new e.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new e.aa(e.a6.properties_light_directional.intensity),"cast-shadows":new e.aa(e.a6.properties_light_directional["cast-shadows"]),"shadow-quality":new e.aa(e.a6.properties_light_directional["shadow-quality"]),"shadow-intensity":new e.aa(e.a6.properties_light_directional["shadow-intensity"]),"shadow-draw-before-layer":new e.aa(e.a6.properties_light_directional["shadow-draw-before-layer"])}));
vendor: 2,635 bytes, line 2
2class nt{constructor(e,t,i){this.screenBounds=e,this.cameraPoint=i.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=t,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,i)}static createFromScreenPoints(t,i){let r,n;if(t instanceof e.P||"number"==typeof t[0]){const o=e.P.convert(t);r=[o],n=i.isPointAboveHorizon(o)}else{const o=e.P.convert(t[0]),s=e.P.convert(t[1]),a=o.add(s)._div(2);r=[o,s],n=e.aq(o,s).every(e=>i.isPointAboveHorizon(e))&&i.isPointAboveHorizon(a)}return new nt(r,n,i)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(t){return e.aq(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const i=this.screenBounds[0],r=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],n=e.aq(i,r,0,!1);return this.cameraPoint.y>r.y&&(this.cameraPoint.x>i.x&&this.cameraPoint.x<r.x?n.splice(3,0,this.cameraPoint):this.cameraPoint.x>=r.x?n[2]=this.cameraPoint:this.cameraPoint.x<=i.x&&(n[3]=this.cameraPoint)),e.ar(n,t)}bufferedCameraGeometryGlobe(t){const i=this.screenBounds[0],r=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],n=e.aq(i,r,t),o=this.cameraPoint.clone();switch(3*((o.y>i.y)+(o.y>r.y))+((o.x>i.x)+(o.x>r.x))){case 0:n[0]=o,n[4]=o.clone();break;case 1:n.splice(1,0,o);break;case 2:n[1]=o;break;case 3:n.splice(4,0,o);break;case 5:n.splice(2,0,o);break;case 6:n[3]=o;break;case 7:n.splice(3,0,o);break;case 8:n[2]=o}return n}containsTile(t,i,r,n=0){const o=Math.max(t.queryPadding,t.evaluateQueryRenderedFeaturePadding())/i._pixelsPerMercatorPixel+1,s=r?this._bufferedCameraMercator(o,i):this._bufferedScreenMercator(o,i);let a=t.tileID.wrap+(s.unwrapped?n:0);const l=s.polygon.map(i=>e.as(t.tileTransform,i,a));if(!e.at(l,0,0,e.al,e.al))return;a=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?n:0);const c=this.screenGeometryMercator.polygon.map(i=>e.au(t.tileTransform,i,a)),h=c.map(t=>new e.P(t[0],t[1])),u=i.getFreeCameraOptions().position||new e.ae(0,0,0),d=e.au(t.tileTransform,u,a),p=c.map(t=>{const i=e.av(t,t,d);return e.aw(i,i),new e.ax(d,i)}),f=e.ay(t,1,i.zoom)*i._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:h,tilespaceRays:p,bufferedTilespaceGeometry:l,bufferedTilespaceBounds:(m=e.az(l),m.min.x=e.aA(m.min.x,0,e.al),m.min.y=e.aA(m.min.y,0,e.al),m.max.x=e.aA(m.max.x,0,e.al),m.max.y=e.aA(m.max.y,0,e.al),m),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:f};var m}_bufferedScreenMercator(e,t){const i=at(e);
2if(this._screenRaycastCache[i])return this._screenRaycastCache[i];{let r;return r="globe"===t.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),t):{polygon:this.bufferedScreenGeometry(e).map(e=>t.pointCoordinate3D(e)),unwrapped:!0},this._screenRaycastCache[i]=r,r}}_bufferedCameraMercator(e,t){const i=at(e);if(this._cameraRaycastCache[i])return this._cameraRaycastCache[i];{let r;return r="globe"===t.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),t):{polygon:this.bufferedCameraGeometry(e).map(e=>t.pointCoordinate3D(e)),unwrapped:!0},this._cameraRaycastCache[i]=r,r}}_projectAndResample(t,i){const r=function(t,i){const r=e.aB([],i.pixelMatrix,i.globeMatrix),n=[0,-e.aD,0,1],o=[0,e.aD,0,1],s=[0,0,0,1];e.aC(n,n,r),e.aC(o,o,r),e.aC(s,s,r);const a=new e.P(n[0]/n[3],n[1]/n[3]),l=new e.P(o[0]/o[3],o[1]/o[3]),c=e.aE(t,a)&&n[3]<s[3],h=e.aE(t,l)&&o[3]<s[3];if(!c&&!h)return null;const u=function(e,t,i){for(let r=1;r<e.length;r++){const n=st(t.pointCoordinate3D(e[r-1]).x),o=st(t.pointCoordinate3D(e[r]).x);if(i<0){if(n<o)return{idx:r,t:-n/(o-1-n)}}else if(o<n)return{idx:r,t:(1-n)/(o+1-n)}}return null}(t,i,c?-1:1);if(!u)return null;const{idx:d,t:p}=u;let f=d>1?ot(t.slice(0,d),i):[],m=d<t.length?ot(t.slice(d),i):[];f=f.map(t=>new e.P(st(t.x),t.y)),m=m.map(t=>new e.P(st(t.x),t.y));const _=[...f];0===_.length&&_.push(m[m.length-1]);const g=e.ak(_[_.length-1].y,(0===m.length?f[0]:m[0]).y,p);let y;return y=c?[new e.P(0,g),new e.P(0,0),new e.P(1,0),new e.P(1,g)]:[new e.P(1,g),new e.P(1,1),new e.P(0,1),new e.P(0,g)],_.push(...y),0===m.length?_.push(f[0]):_.push(...m),{polygon:_.map(t=>new e.ae(t.x,t.y)),unwrapped:!1}}(t,i);if(r)return r;const n=function(t,i){let r=!1,n=-1/0,o=0;for(let e=0;e<t.length-1;e++)t[e].x>n&&(n=t[e].x,o=e);for(let e=0;e<t.length-1;e++){const i=(o+e)%(t.length-1),n=t[i],s=t[i+1];Math.abs(n.x-s.x)>.5&&(n.x<s.x?(n.x+=1,0===i&&(t[t.length-1].x+=1)):(s.x+=1,i+1===t.length-1&&(t[0].x+=1)),r=!0)}const s=e.aF(i.center.lng);return r&&s<Math.abs(s-1)&&t.forEach(e=>{e.x-=1}),{polygon:t,unwrapped:r}}(ot(t,i).map(t=>new e.P(st(t.x),t.y)),i);return{polygon:n.polygon.map(t=>new e.ae(t.x,t.y)),unwrapped:n.unwrapped}}}function ot(t,i){return e.aG(t,e=>{const t=i.pointCoordinate3D(e);e.x=t.x,e.y=t.y},1/256)}function st(e){return e<0?1+e%1:e%1}function at(e){return 100*e|0}function lt(t,i,r,n,o){const s=function(r,n){if(r)return o(r);if(n){if(t.url&&n.tiles&&t.tiles&&delete t.tiles,n.variants){if(!Array.isArray(n.variants))return o(new Error("variants must be an array"));for(const e of n.variants){if(null==e||"object"!=typeof e||e.constructor!==Object)return o(new Error("variant must be an object"));if(!Array.isArray(e.capabilities))return o(new Error("capabilities must be an array"));if(1===e.capabilities.length&&"meshopt"===e.capabilities[0]){n=Object.assign(n,e);break}}}const r=e.aH(Object.assign({},n,t),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);r.tiles=i.canonicalizeTileset(r,t.url),o(null,r)}},a=function(e,t,i){if(!e)return null;if(!t&&!i)return e;i=i||e.worldview_default;const r=Object.values(e.language||{});if(0===r.length)return null;const n=Object.values(e.worldview||{});if(0===n.length)return null;const o=r.every(e=>e===t),s=n.every(e=>e===i);return o&&s?e:t in(e.language_options||{})||i in(e.worldview_options||{})?null:e.language_options&&e.worldview_options?e:null}(t.data,r,n);return a?e.o.frame(()=>s(null,a)):t.url?e.m(i.transformRequest(i.normalizeSourceURL(t.url,null,r,n),e.R.Source),s):e.o.frame(()=>{const{data:e,...i}=t;s(null,i)})}function ct(t,i){const r=Math.pow(2,i.z),n=Math.floor(e.aF(t.getWest())*r),o=Math.floor(e.aJ(t.getNorth())*r),s=Math.ceil(e.aF(t.getEast())*r),a=Math.ceil(e.aJ(t.getSouth())*r);return i.x>=n&&i.x<s&&i.y>=o&&i.y<a}class ht{constructor(t,i,r){this.bounds=t?e.aI.convert(this.validateBounds(t)):null,this.minzoom=i||0,this.maxzoom=r||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}addExtraBounds(t){if(t){this.extraBounds||(this.extraBounds=[]);for(const i of t)this.extraBounds.push(e.aI.convert(this.validateBounds(i)))}}contains(e){if(e.z>this.maxzoom||e.z<this.minzoom)return!1;if(this.bounds&&!ct(this.bounds,e))return!1;if(!this.extraBounds)return!0;for(const t of this.extraBounds)if(ct(t,e))return!0;return!1}static fromTileJSON(e){if(!e.bounds&&!e.extra_bounds)return null;const t=new ht(e.bounds,e.minzoom,e.maxzoom);return t.addExtraBounds(e.extra_bounds),t}}class ut extends e.E{constructor(t,i,r,n){if(super(),this.id=t,this.dispatcher=r,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,Object.assign(this,e.aH(i,["url","scheme","tileSize","promoteId"])),this._options=Object.assign({type:"vector"},i),this._collectResourceTiming=!!i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n),this._tileWorkers={},this._deduped=new e.aK}load(t){this._loaded=!1,this.fire(new e.z("dataloading",{dataType:"source"}));const i=Array.isArray(this.map._language)?this.map._language.join():this.map._language,r=this.map.getWorldview();this._tileJSONRequest=lt(this._options,this.map._requestManager,i,r,(n,o)=>
2{if(this._tileJSONRequest=null,this._loaded=!0,n)i&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i}`),r&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${r}`),this.fire(new e.y(n));else if(o){if(Object.assign(this,o),this.hasWorldviews=!!o.worldview_options,o.worldview_default&&(this.worldviewDefault=o.worldview_default),o.vector_layers){this.vectorLayers=o.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const e of o.vector_layers)this.vectorLayerIds.push(e.id),o.worldview&&o.worldview[e.source]&&this.localizableLayerIds.add(e.id)}this.tileBounds=ht.fromTileJSON(o),z(o.tiles,this.map._requestManager._customAccessToken),this.fire(new e.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.z("data",{dataType:"source",sourceDataType:"content"}))}t&&t(n)})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();const t=e.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(e){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}loadTile(t,i){const r=t.tileID.canonical.url(this.tiles,this.scheme),n=this.map._requestManager.normalizeTileURL(r),o=this.map._requestManager.transformRequest(n,e.R.Tile),s=this.map.style?this.map.style.getLut(this.scope):null,a=s?{image:s.image.clone()}:null,l={request:o,data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,lut:a,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
2ype,source:this.id,scope:this.scope,pixelRatio:e.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault,indoor:this.map.getIndoorTileOptions(this.id,this.scope)};if(this.hasWorldviews&&e.h(r)&&(l.localizableLayerIds=this.localizableLayerIds),l.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state)"loading"===t.state?t.reloadCallback=i:t.request=t.actor.send("reloadTile",l,c.bind(this));else if(t.actor=this._tileWorkers[n]=this._tileWorkers[n]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",l,c.bind(this),void 0,!0);else{const i=e.aL.call({deduped:this._deduped},l,(i,r)=>{if(i||!r)c.call(this,i);else{const i=e.aM(r.responseHeaders);l.data={rawData:r.rawData.slice(0),expires:i.expires,cacheControl:i.cacheControl},t.actor&&t.actor.send("loadTile",l,c.bind(this),void 0,!0)}},!0);t.request={cancel:i}}function c(r,n){return delete t.request,t.aborted?i(null):r&&r instanceof e.aN&&404!==r.status?i(r):(n&&n.resourceTiming&&(t.resourceTiming=n.resourceTiming),this.map._refreshExpiredTiles&&n&&t.setExpiryData(n),t.loadVectorData(n,this.map.painter),e.aO(this.dispatcher),i(null,n),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.t
2ype,source:this.id,scope:this.scope})}unloadTile(e,t){e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class dt extends e.E{constructor(t,i,r,n){super(),this.id=t,this.dispatcher=r,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=Object.assign({type:"raster"},i),Object.assign(this,e.aH(i,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new e.z("dataloading",{dataType:"source"}));const i=this.map.getWorldview();this._tileJSONRequest=lt(this._options,this.map._requestManager,null,i,(i,r)=>{this._tileJSONRequest=null,this._loaded=!0,i?this.fire(new e.y(i)):r&&(Object.assign(this,r),r.raster_layers&&(this.rasterLayers=r.raster_layers,this.rasterLayerIds=this.rasterLayers.map(e=>e.id)),this.tileBounds=ht.fromTileJSON(r),z(r.tiles),this.fire(new e.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.z("data",{dataType:"source",sourceDataType:"content"}))),t&&t(i)})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();const t=e.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(e){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(t,i){const r=e.o.devicePixelRatio>=2,n=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),r,this.tileSize);t.request=e.n(this.map._requestManager.transformRequest(n,e.R.Tile),(r,n,o)=>{if(delete t.request,t.aborted)return t.state="unloaded",i(null);if(r)return t.state="errored",i(r);if(!n)return i(null);const s=e.aM(o);this.map._refreshExpiredTiles&&t.setExpiryData(s),t.setTexture(n,this.map.painter),t.state="loaded",e.aO(this.dispatcher),i(null)})}abortTile(e,t){e.request&&(e.request.cancel(),delete e.request),t&&t()}unloadTile(t,i){t.texture&&t.texture instanceof e.T?(t.destroy(!1),t.texture&&t.texture instanceof e.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),i&&i()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function pt([t,i],r,n,{scaled:o=!0}={}){const{tileSize:s,buffer:a}=n,{x:l,y:c,z:h}=r;if(!isFinite(l)||!isFinite(c)||!isFinite(h))throw new Error("Invalid MRT header");const u=2**h,d=u*e.aF(t),p=u*e.aJ(i);return function([e,t],i,{scaled:r=!0}={}){if(!i)throw new Error("bandView is undefined");const{data:n,tileSize:o,buffer:s,offset:a,scale:l,dimension:c}=i;if(e<-s||e>o+s||t<-s||t>o+s)throw new Error(`Point (${e}, ${t}) out of bounds for tileSize=${o}, buffer=${s}`);const h=(t+s)*(o+2*s)+(e+s);if(4294967295===new Uint32Array(n.buffer)[h])return null;let u=[];u=r?[]:new(0,i.data.constructor)(c);for(let d=0;d<c;d++)u[d]=Math.round(1e12*(n[c*h+d]*l+a))/1e12;return u}([Math.min(Math.max(-a,Math.floor((d-l)*s)),s-1+a),Math.min(Math.max(-a,Math.floor((p-c)*s)),s-1+a)],n,{scaled:o})}class ft extends dt{constructor(e,t,i,r){super(e,t,i,r),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._loadTilePending={},this._loadTileLoaded={},this._options=Object.assign({type:"raster-array"},t)}triggerRepaint(e){const t=this.map.painter._terrain,i=this.map.style.getSourceCache(this.id);t&&t.enabled&&i&&t._clearRenderCacheForTile(i.id,e.tileID),this.map.triggerRepaint()}loadTile(t,i){const r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),n=this.map._requestManager.transformRequest(r,e.R.Tile),o={request:n,uid:t.uid,tileID:t.tileID,type:this.t
2ype,source:this.id,scope:this.scope,partial:this.partial};t.source=this.id,t.scope=this.scope,t.requestParams=n,t.actor||(t.actor=this.dispatcher.getActor());const s=(r,n,o)=>{if(delete t.request,t.aborted)return t.state="unloaded",i(null);if(r){if("AbortError"===r.name)return;return t.state="errored",i(r)}if(this.map._refreshExpiredTiles&&n){const i=e.aM(o);t.setExpiryData(i)}if(this.partial&&"expired"!==t.state)t.state="empty";else if(!this.partial){if(!n)return i(null);t.state="loaded",t._isHeaderLoaded=!0,t._mrt=n}i(null)};t.request=this.partial?t.fetchHeader(void 0,s.bind(this)):t.actor.send("loadTile",o,s.bind(this),void 0,!0)}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,scope:this.scope})}unloadTile(e,t){const i=e.texturePerLayer;if(e.flushAllQueues(),i.size){e.destroy(!1);for(const e of i.values())this.map.painter.saveTileTexture(e)}else e.destroy()}prepareTile(t,i,r,n){t._isHeaderLoaded&&("empty"!==t.state&&(t.state="reloading"),t.fetchBandForRender(i,r,n,(i,n)=>{if(i)return t.state="errored",this.fire(new e.y(i)),void this.triggerRepaint(t);n&&(t._isHeaderLoaded=!0,t.setTexturePerLayer(r,n,this.map.painter),t.state="loaded",this.triggerRepaint(t))}))}getInitialBand(e){if(!this.rasterLayers)return 0;const t=this.rasterLayers.find(({id:t})=>t===e),i=t&&t.fields,r=i&&i.bands&&i.bands;return r?r[0]:0}getTextureDescriptor(t,i,r){if(!t)return;const n=i.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!n)return;let o=null;i instanceof e.aR?o=i.paint.get("raster-array-band"):i instanceof e.aS&&(o=i.paint.get("raster-particle-array-band"));const s=o||this.getInitialBand(n);if(null==s)return;if(!t.textureDescriptorPerLayer.get(i.id))return void this.prepareTile(t,n,i.id,s);if(t.updateNeeded(i.id,s)&&!r)return;const a=t.textureDescriptorPerLayer.get(i.id);return Object.assign({},a,{texture:t.texturePerLayer.get(i.id)})}getImages(t,i){const r=new Map;for(const n of t)for(const t of i){const[i,o]=t.split("/"),s=n.getLayer(i);if(!s)continue;if(!s.hasBand(o)||!s.hasDataForBand(o))continue;const{bytes:a,tileSize:l,buffer:c}=s.getBandView(o),h=l+2*c,u={data:new e.q({width:h,height:h},a),pixelRatio:2,sdf:!1,usvg:!1,version:0};r.set(t,u)}return r}queryRasterArrayValueByBandId(t,i,r){const n=i._mrt;return new Promise(o=>{const s={},a=new Set;for(const[l,c]of Object.entries(n.layers)){if(r.layerName&&l!==r.layerName)continue;const h={};s[l]=h;for(const{bands:u}of c.dataIndex)for(const d of u)r.bands&&!r.bands.includes(d)||(a.add(e.B(l,d)),i.fetchBand(l,null,d,i=>{e.o.frame(()=>{h[d]=i?null:pt([t.lng,t.lat],n,c.getBandView(d)),a.delete(e.B(l,d)),0===a.size&&o(s)})},!1))}0===a.size&&o(s)})}_loadTileForQuery(t,i){if(this._loadTileLoaded[t.uid])return void i(null,t._mrt);if(this._loadTilePending[t.uid])return void this._loadTilePending[t.uid].push(i);this._loadTilePending[t.uid]=[i];const r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),n=this.map._requestManager.transformRequest(r,e.R.Tile);t.actor.send("loadTile",{request:n,uid:t.uid,tileID:t.tileID,type:this.t
2ype,source:this.id,scope:this.scope,partial:!1},(i,r,n)=>{if(i)return this._loadTilePending[t.uid].forEach(e=>e(i,null)),void delete this._loadTilePending[t.uid];if(!r)return this._loadTilePending[t.uid].forEach(e=>e(null,null)),void delete this._loadTilePending[t.uid];if(this.map._refreshExpiredTiles&&r){const i=e.aM(n);t.setExpiryData(i)}t._mrt=r,t._isHeaderLoaded=!0,t.state="loaded",this._loadTilePending[t.uid].forEach(e=>e(null,r)),this._loadTileLoaded[t.uid]=!0,delete this._loadTilePending[t.uid]},void 0,!0)}queryRasterArrayValueByAllBands(e,t,i){return new Promise((r,n)=>{this._loadTileForQuery(t,(o,s)=>{o?n(o):r(s?this.queryRasterArrayValueByBandId(e,t,i):null)})})}queryRasterArrayValue(t,i){const r=e.aT.convert(t),n=this.findLoadedParent(r);return n&&n._mrt?i.bands||!this.partial?this.queryRasterArrayValueByBandId(r,n,i):this.queryRasterArrayValueByAllBands(r,n,i):Promise.resolve(null)}findLoadedParent(t){const i=e.ae.fromLngLat(t,this.map.transform.tileSize),r=this.maxzoom+1,n=1<<r,o=Math.floor(i.x),s=Math.floor((i.x-o)*n),a=Math.floor(i.y*n),l=this.map.style.getSourceCache(this.id),c=new e.aQ(r,o,r,s,a);return l.findLoadedParent(c,this.minzoom)}}const mt={vector:ut,raster:dt,"raster-dem":class extends dt{constructor(e,t,i,r){super(e,t,i,r),this.type="raster-dem",this.maxzoom=22,this._options=Object.assign({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox"}loadTile(t,i){const r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function n(e,r){e&&(t.state="errored",i(e)),r&&(t.dem=r,t.dem.onDeserialize(),t.needsHillshadePrepare=!0,t.needsDEMTextureUpload=!0,t.state="loaded",i(null))}t.request=e.n(this.map._requestManager.transformRequest(r,e.R.Tile),function(r,o,s){if(delete t.request,t.aborted)t.state="unloaded",i(null);else if(r)t.state="errored",i(r);else if(o){const i=e.aM(s);this.map._refreshExpiredTiles&&t.setExpiryData(i);const r=ImageBitmap&&o instanceof ImageBitmap&&e.r(),a=1-(o.width-e.aP(o.width))/2;a<1||t.neighboringTiles||(t.neighboringTiles=this._getNeighboringTiles(t.tileID));const l=r?o:e.o.getImageData(o,a),c={uid:t.uid,tileID:t.tileID,source:this.id,type:this.t
vendor: 2,679 bytes, line 2
2ype,scope:this.scope,rawImageData:l,encoding:this.encoding,padding:a};t.actor&&"expired"!==t.state||(t.actor=this.dispatcher.getActor(),t.actor.send("loadTile",c,n.bind(this),void 0,!0))}}.bind(this))}_getNeighboringTiles(t){const i=t.canonical,r=Math.pow(2,i.z),n=(i.x-1+r)%r,o=0===i.x?t.wrap-1:t.wrap,s=(i.x+1+r)%r,a=i.x+1===r?t.wrap+1:t.wrap,l={};return l[new e.aQ(t.overscaledZ,o,i.z,n,i.y).key]={backfilled:!1},l[new e.aQ(t.overscaledZ,a,i.z,s,i.y).key]={backfilled:!1},i.y>0&&(l[new e.aQ(t.overscaledZ,o,i.z,n,i.y-1).key]={backfilled:!1},l[new e.aQ(t.overscaledZ,t.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new e.aQ(t.overscaledZ,a,i.z,s,i.y-1).key]={backfilled:!1}),i.y+1<r&&(l[new e.aQ(t.overscaledZ,o,i.z,n,i.y+1).key]={backfilled:!1},l[new e.aQ(t.overscaledZ,t.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new e.aQ(t.overscaledZ,a,i.z,s,i.y+1).key]={backfilled:!1}),l}},"raster-array":ft,geojson:class extends e.E{constructor(t,i,r,n){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=r.getActor(),this.setEventedParent(n),this._data=i.data,this._options=Object.assign({},i),this._collectResourceTiming=i.collectResourceTiming,void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),void 0!==i.minzoom&&(this.minzoom=i.minzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId;const o=e.al/this.tileSize;this.workerOptions=Object.assign({source:this.id,scope:this.scope,cluster:i.cluster||!1,geojsonVtOptions:{buffer:(void 0!==i.buffer?i.buffer:128)*o,tolerance:(void 0!==i.tolerance?i.tolerance:.375)*o,extent:e.al,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:void 0!==i.clusterMaxZoom?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:e.al,radius:(void 0!==i.clusterRadius?i.clusterRadius:50)*o,log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter,dynamic:i.dynamic},i.workerOptions)}onAdd(e){this.map=e,this.setData(this._data)}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(t){if(!this._options.dynamic)return this.fire(new e.y(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if("string"!=typeof t&&("Feature"===t.type&&(t={type:"FeatureCollection",features:[t]}),"FeatureCollection"!==t.type))return this.fire(new e.y(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&"string"!=typeof t&&"string"!=typeof this._data&&"FeatureCollection"===this._data.type){const e=new Map;
2for(const t of this._data.features)e.set(t.id,t);for(const i of t.features)e.set(i.id,i);this._data.features=[...e.values()]}else this._data=t;return this._updateWorkerData(!0),this}getClusterExpansionZoom(e,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id,scope:this.scope},t),this}getClusterChildren(e,t){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id,scope:this.scope},t),this}getClusterLeaves(e,t,i,r){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:e,limit:t,offset:i},r),this}_updateWorkerData(t=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new e.z("dataloading",{dataType:"source"})),this._loaded=!1;const i=Object.assign({append:t},this.workerOptions);i.scope=this.scope;const r=this._data;"string"==typeof r?(i.request=this.map._requestManager.transformRequest(e.o.resolveURL(r),e.R.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(r),this._pendingLoad=this.actor.send(`${this.type}.loadData`,i,(i,r)=>{if(this._loaded=!0,this._pendingLoad=null,i)this.fire(new e.y(i));else{const i={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&r&&r.resourceTiming&&r.resourceTiming[this.id]&&(i.resourceTiming=r.resourceTiming[this.id]),t&&(this._partialReload=!0),this.fire(new e.z("data",i)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(t),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const t=e.B(this.id,this.scope);this.map.style.clearSource(t),this._updateWorkerData()}loadTile(t,i){const r=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const n=this.map.style?this.map.style.getLut(this.scope):null,o=n?{image:n.image.clone()}:null,s=this._partialReload,a={type:this.type,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:o,scope:this.scope,pixelRatio:e.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:s,worldview:this.map.getWorldview(),indoor:this.map.getIndoorTileOptions(this.id,this.scope)};t.request=this.actor.send(r,a,(e,n)=>s&&!n?(t.state="loaded",i(null)):(delete t.request,t.destroy(!1),t.aborted?i(null):e?i(e):(t.loadVectorData(n,this.map.painter,"reloadTile"===r),i(null))),void 0,"loadTile"===r)}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e,t){this.actor.send("removeTile",{uid:e.uid,type:this.t
2ype,source:this.id,scope:this.scope}),e.destroy()}onRemove(e){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Object.assign({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends e.aU{constructor(e,t,i,r){super(e,t,i,r),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const i of t.urls)this.urls.push(this.map._requestManager.transformRequest(i,e.R.Source).url);e.aV(this.urls,(t,i)=>{this._loaded=!0,t?this.fire(new e.y(t)):i&&(this.video=i,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const i=this.video.seekable;t<i.start(0)||t>i.end(0)?this.fire(new e.y(new e.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const t=this.map.painter.context,i=t.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new e.T(t,this.video,i.RGBA8),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(t)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:e.aU,model:e.aX,"batched-model":class extends e.E{constructor(e,t,i,r){super(),this.type="batched-model",this.id=e,this.tileSize=512,this._options=t,this.tiles=this._options.tiles,this.maxzoom=t.maxzoom||19,this.minzoom=t.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=i,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(r)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();const t=e.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(t){this._loaded=!1,this.fire(new e.z("dataloading",{dataType:"source"}));const i=Array.isArray(this.map._language)?this.map._language.join():this.map._language,r=this.map.getWorldview();this._tileJSONRequest=lt(this._options,this.map._requestManager,i,r,(n,o)=>{this._tileJSONRequest=null,this._loaded=!0,n?(i&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i}`),r&&2!==r.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${r}`),this.fire(new e.y(n))):o&&(Object.assign(this,o),o.bounds&&(this.tileBounds=new ht(o.bounds,this.minzoom,this.maxzoom)),z(o.tiles,this.map._requestManager._customAccessToken),this.fire(new e.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.z("data",{dataType:"source",sourceDataType:"content"}))),t&&t(n)})}hasTransition(){return!1}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loaded(){return this._loaded}loadTile(t,i){const r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme)),n={request:this.map._requestManager.transformRequest(r,e.R.Tile),data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
2ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:e.o.devicePixelRatio,promoteId:this.promoteId};if(t.actor&&"expired"!==t.state)if("loading"===t.state)t.reloadCallback=i;else{if(t.buckets){const e=Object.values(t.buckets);for(const t of e)t.dirty=!0;return void(t.state="loaded")}t.request=t.actor.send("reloadTile",n,o.bind(this))}else t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",n,o.bind(this),void 0,!0);function o(e,r){return t.aborted?i(null):e&&404!==e.status?i(e):(this.map._refreshExpiredTiles&&r&&t.setExpiryData(r),t.loadModelData(r,this.map.painter),t.state="loaded",void i(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends e.aU{constructor(t,i,r,n){super(t,i,r,n),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some(e=>!Array.isArray(e)||2!==e.length||e.some(e=>"number"!=typeof e))||this.fire(new e.y(new e.V(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.y(new e.V(`sources.${t}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new e.y(new e.V(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new e.y(new e.V(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new e.y(new e.V(`sources.${t}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.y(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(e){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context;this.texture?!t&&!this._playing||this.texture instanceof e.aW||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new e.T(i,this.canvas,i.gl.RGBA8,{premultiply:!0}),this._prepareData(i)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}},custom:class extends e.E{constructor(t,i,r,n){super(),this.id=t,this.type="custom",this._dataType="raster",this._dispatcher=r,this._implementation=i,this.setEventedParent(n),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new e.y(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new e.y(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new ht(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),Object.assign(this,e.aH(i,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return e.aH(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new e.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.z("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(t){this.map=t,this._loaded=!1,this.fire(new e.z("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(t),this.load()}onRemove(e){this._implementation.onRemove&&this._implementation.onRemove(e)}hasTile(e){if(this._implementation.hasTile){const{x:t,y:i,z:r}=e.canonical;return this._implementation.hasTile({x:t,y:i,z:r})}return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e,t){const{x:i,y:r,z:n}=e.tileID.canonical,o=new AbortController;e.request=Promise.resolve(this._implementation.loadTile({x:i,y:r,z:n},{signal:o.signal})).then(function(i){return delete e.request,e.aborted?(e.state="unloaded",t(null)):void 0===i?(e.state="errored",t(null)):null===i?(this.loadTileData(e,{width:this.tileSize,height:this.tileSize,data:null}),e.state="loaded",t(null)):function(e){return e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof ImageBitmap||e instanceof HTMLImageElement}(i)?(this.loadTileData(e,i),e.state="loaded",void t(null)):(e.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}.bind(this)).catch(i=>{"AbortError"!==i.name&&(e.state="errored",t(i))}),e.request.cancel=()=>o.abort()}loadTileData(e,t){e.setTexture(t,this.map.painter)}
vendor: 19,159 bytes, line 2
2unloadTile(t,i){if(t.texture&&t.texture instanceof e.T?(t.destroy(!1),t.texture&&t.texture instanceof e.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),this._implementation.unloadTile){const{x:e,y:i,z:r}=t.tileID.canonical;this._implementation.unloadTile({x:e,y:i,z:r})}i&&i()}abortTile(e,t){e.request&&e.request.cancel&&(e.request.cancel(),delete e.request),t&&t()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(e=>({x:e.canonical.x,y:e.canonical.y,z:e.canonical.z}))}_clearTiles(){const t=e.B(this.id,this.scope);this.map.style.clearSource(t)}_update(){this.fire(new e.z("data",{dataType:"source",sourceDataType:"content"}))}}},_t=function(t,i,r,n){const o=new mt[i.type](t,i,r,n);if(o.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${o.id}`);return e.aY(["load","abort","unload","serialize","prepare"],o),o};function gt(e,t,i=""){return`${i}:${t.id||""}:${t.layer.id}:${function(e){if("layerId"in e)return`layer:${e.layerId}`;{const{featuresetId:t,importId:i}=e;return`featureset:${t}${i?`:import:${i}`:""}`}}(e.target)}`}function yt(e,t,i,r=""){if(e.uniqueFeatureID){const n=gt(e,t,r);if(i.has(n))return!0;i.add(n)}return!1}function xt(e,t,i,r,n=!1,o=void 0){const s=t.sourceCache.transform,a=t.sourceCache.tilesIn(e,t.has3DLayers,n);a.sort(wt);const l=[];for(const c of a){const e=c.tile.queryRenderedFeatures(t,c,i,r,s,n,o);Object.keys(e).length&&l.push({wrappedTileID:c.tile.tileID.wrapped().key,queryResults:e})}for(const c in t.layers){const i=t.layers[c];if(i.styleLayer){const n=i.styleLayer.queryRenderedFeatures(e,t.sourceCache,r);Object.keys(n).length&&l.push({wrappedTileID:0,queryResults:n})}}return 0===l.length?{}:function(e){const t={},i={};for(const r of e){const e=r.queryResults,n=r.wrappedTileID,o=i[n]=i[n]||{};for(const i in e){const r=e[i],n=o[i]=o[i]||{},s=t[i]=t[i]||[];for(const e of r)n[e.featureIndex]||(n[e.featureIndex]=!0,s.push(e))}}return t}(l)}function vt(e,t,i,r,n,o){const s={},a=r.queryRenderedSymbols(e),l=[];for(const c of Object.keys(a).map(Number))l.push(n[c]);l.sort(wt);for(const c of l){const e=c.featureIndex.lookupSymbolFeatures(a[c.bucketInstanceId],c.bucketIndex,c.sourceLayerIndex,t,i,o);for(const t in e){const i=s[t]=s[t]||[],r=e[t];r.sort((e,t)=>{const i=c.featureSortOrder;if(i){const r=i.indexOf(e.featureIndex);return i.indexOf(t.featureIndex)-r}return t.featureIndex-e.featureIndex});for(const e of r)i.push(e)}}return s}function bt(e,t){const i=e.getRenderableIds().map(t=>e.getTileByID(t)),r=[],n={};for(let o=0;o<i.length;o++){const e=i[o],s=e.tileID.canonical.key;n[s]||(n[s]=!0,e.querySourceFeatures(r,t))}return r}function wt(e,t){const i=e.tileID,r=t.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function Tt(e,t){const i={};if(!t)return i;for(const r of e){const e=r.layerIds.map(e=>t.getLayer(e)).filter(Boolean);if(0!==e.length){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map(t=>e.filter(e=>e.id===t)[0]));for(const t of e)i[t.fqid]=r}}return i}const St=32,Et=33,It=new Uint16Array(8184);for(let nc=0;nc<2046;nc++){let e=nc+2,t=0,i=0,r=0,n=0,o=0,s=0;for(1&e?r=n=o=St:t=i=s=St;(e>>=1)>1;){const a=t+r>>1,l=i+n>>1;1&e?(r=t,n=i,t=o,i=s):(t=r,i=n,r=o,n=s),o=a,s=l}const a=4*nc;It[a+0]=t,It[a+1]=i,It[a+2]=r,It[a+3]=n}const At=new Uint16Array(2178),Mt=new Uint8Array(1089),Ct=new Uint16Array(1089);function Pt(e){return 0===e?-.03125:32===e?.03125:0}const Rt={type:2,extent:e.al,loadGeometry:()=>[[new e.P(0,0),new e.P(e.al+1,0),new e.P(e.al+1,e.al+1),new e.P(0,e.al+1),new e.P(0,0)]]};class zt{constructor(t,i,r,n,o,s){this.tileID=t,this.uid=e.b2(),this.uses=0,this.tileSize=i,this.tileZoom=r,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=o,n&&n.style&&(this._lastUpdatedBrightness=n.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",n&&n.transform&&(this.projection=n.transform.projection),this.worldview=s,this._hasAppearances=null}registerFadeDuration(t){const i=t+this.timeAdded;i<e.o.now()||this.fadeEndTime&&i<this.fadeEndTime||(this.fadeEndTime=i)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}get tileTransform(){return this._tileTransform||(this._tileTransform=e.aZ(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(t,i,r){if(this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=Tt(t.buckets,i.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const i=this.buckets[t];if(i instanceof e.b4){if(this.hasSymbolBuckets=!0,!r)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const i=this.buckets[t];if(i instanceof e.b4&&i.hasRTLText){this.hasRTLText=!0,e.b5();break}}this.queryPadding=0;for(const e in this.buckets){const t=this.buckets[e],r=i.style.getOwnLayer(e);if(!r)continue;const n=r.queryRadius(t);this.queryPadding=Math.max(this.queryPadding,n)}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas),this._lastUpdatedBrightness=t.brightness}else this.collisionBoxArray=new e.b3}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"}}loadModelData(e,t,i){e&&(e.resourceTiming&&(this.resourceTiming=e.resourceTiming),this.buckets=Object.assign({},this.buckets,Tt(e.buckets,t.style)),e.featureIndex&&(this.latestFeatureIndex=e.featureIndex))}getBucket(e){return this.buckets[e.fqid]}upload(t,i){for(const e in this.buckets){const r=this.buckets[e];if(r.uploadPending()){let e={},n=[],o={zoom:0,pitch:0,brightness:0,worldview:""};if(i){if(i.style){n=i.style.listImages();const t=r.layers[0],o=t.sourceLayer||"_geojsonTileLayer",s=i.style.getLayerSourceCache(t);s&&(e=s._state.getState(o,void 0))}o={zoom:i.transform.zoom||0,pitch:i.transform.pitch||0,brightness:i.style.getBrightness()||0,worldview:i.worldview||""}}r.upload(t,this.tileID.canonical,e,n,o)}}const r=t.gl,n=this.imageAtlas;n&&!n.uploaded&&(this.imageAtlasTexture=new e.T(t,n.image,r.RGBA8,{useMipmap:!!n.patternPositions.size}),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new e.T(t,this.glyphAtlasImage,r.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new e.T(t,this.lineAtlas.image,r.R8),this.lineAtlas.uploaded=!0)}prepare(e,t,i){if(this.imageAtlas&&this.imageAtlasTexture&&t){const r=t.style.getLut(i);this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture,i,r)}if(!t||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const r=t.style.getBrightness();null===this._hasAppearances&&(this._hasAppearances=this.hasAppearances(t)),(this._lastUpdatedBrightness||r||this._hasAppearances)&&(!this._hasAppearances&&this._lastUpdatedBrightness&&r&&Math.abs(this._lastUpdatedBrightness-r)<.001||(this.updateBuckets(t,this._lastUpdatedBrightness!==r),this._lastUpdatedBrightness=r))}evaluateQueryRenderedFeaturePadding(){let e=0;for(const t in this.buckets){const i=this.buckets[t];i.evaluateQueryRenderedFeaturePadding&&(e=Math.max(e,i.evaluateQueryRenderedFeaturePadding()))}return e}queryRenderedFeatures(t,i,r,n,o,s,a){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const l=this.evaluateQueryRenderedFeaturePadding(),c=function(t,i){const r=e.bq([],[.5*t.width,.5*-t.height,1]);return e.br(r,r,[1,-1,0]),e.aB(r,r,t.calculateProjMatrix(i.toUnwrapped())),Float32Array.from(r)}(o,this.tileID);return this.latestFeatureIndex.query(t,{tilespaceGeometry:i,pixelPosMatrix:c,transform:n,availableImages:r,tileTransform:this.tileTransform,worldview:this.worldview,queryRadius:l,scope:a})}querySourceFeatures(t,i){const r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;const n=r.loadVTLayers(),o=i?i.sourceLayer:"",s=n._geojsonTileLayer||n[o];if(!s)return;const a=e.b6(i&&i.filter),{z:l,x:c,y:h}=this.tileID.canonical,u={z:l,x:c,y:h};for(let d=0;d<s.length;d++){const i=s.feature(d);if(a.needGeometry){const t=e.b7(i,!0);if(!a.filter(new e.ac(this.tileID.overscaledZ,{worldview:this.worldview}),t,this.tileID.canonical))continue}else if(!a.filter(new e.ac(this.tileID.overscaledZ,{worldview:this.worldview}),i))continue;const n=r.getId(i,o),p=new e.b8(i,l,c,h,n);p.tile=u,t.push(p)}}loaded(){return"loaded"===this.state||"errored"===this.state}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return!!this.imageAtlas&&!!this.imageAtlas.patternPositions.size}setExpiryData(t){const i=this.expirationTime;if(t.cacheControl){const i=e.b9(t.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const e=Date.now();let t=!1;if(this.expirationTime>e)t=!1;else if(i)if(this.expirationTime<i)t=!0;else{const r=this.expirationTime-i;r?this.expirationTime=e+Math.max(r,3e4):t=!0}else t=!0;t?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}refreshFeatureState(e){this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)&&e&&this.updateBuckets(e)}hasAppearances(e){for(const t in this.buckets)if(e.style.hasLayer(t)&&this.buckets[t].layers.some(e=>e.appearances&&e.appearances.length>0))return!0;return!1}updateBuckets(t,i){if(!this.latestFeatureIndex)return;if(!t.style)return;const r=t.style.listImages(),n=t.style.getBrightness();for(const o in this.buckets){if(!t.style.hasLayer(o))continue;const s=this.buckets[o],a=s.layers[0],l=a.sourceLayer||"_geojsonTileLayer",c=t.style.getLayerSourceCache(a);let h={};c&&(h=c._state.getState(l,void 0));const u=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},d=Object.keys(h).length>0&&!i;s.hasAppearances=s.layers.some(e=>e.appearances&&e.appearances.length>0);const p=d?s.stateDependentLayers:s.layers;if(d&&0!==s.stateDependentLayers.length||i){const e=this.latestFeatureIndex.loadVTLayers();s.update(h,e[l],r,u,p,i,n)}if(d&&0!==s.stateDependentLayers.length||i||s.hasAppearances){const e={zoom:t.transform.zoom,pitch:t.transform.pitch,brightness:t.style.getBrightness()||0,worldview:t.worldview};s.updateAppearances(this.tileID.canonical,h,r,e,t.imageManager)}(s instanceof e.ba||s instanceof e.bb)&&t._terrain&&t._terrain.enabled&&c&&s.uploadPending()&&t._terrain._clearRenderCacheForTile(c.id,this.tileID);const f=t&&t.style&&t.style.getOwnLayer(o);f&&(this.queryPadding=Math.max(this.queryPadding,f.queryRadius(s)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<e.o.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=e.o.now()+t}setTexture(t,i){const r=i.context,n=r.gl;this.texture=this.texture||i.getTileTexture(t.width),this.texture&&this.texture instanceof e.T?this.texture.update(t):(this.texture=new e.T(r,t,n.RGBA8,{useMipmap:!0}),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE))}setDependencies(e,t){const i={};for(const r of t)i[r]=!0;this.dependencies[e]=i}hasDependency(e,t){for(const i of e){const e=this.dependencies[i];if(e)for(const i of t)if(e[i])return!0}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(t,i){if(!i||"mercator"===i.name||this._tileDebugBuffer)return;const r=e.bc(Rt,this.tileID.canonical,this.tileTransform)[0],n=new e.bd,o=new e.be;for(let e=0;e<r.length;e++){const{x:t,y:i}=r[e];n.emplaceBack(t,i),o.emplaceBack(e)}o.emplaceBack(0),this._tileDebugIndexBuffer=t.createIndexBuffer(o),this._tileDebugBuffer=t.createVertexBuffer(n,e.bf.members),this._tileDebugSegments=e.bg.simpleSegment(0,0,n.length,o.length)}_makeTileBoundsBuffers(t,i){if(this._tileBoundsBuffer||!i||"mercator"===i.name)return;const r=e.bc(Rt,this.tileID.canonical,this.tileTransform)[0];let n,o;if(this.isRaster){const t=function(t,i){const r=e.aZ(t,i),n=Math.pow(2,t.z);for(let h=0;h<Et;h++)for(let o=0;o<Et;o++){const s=e.a_((t.x+(o+Pt(o))/St)/n),a=e.a$((t.y+(h+Pt(h))/St)/n),l=i.project(s,a),c=h*Et+o;At[2*c+0]=Math.round((l.x*r.scale-r.x)*e.al),At[2*c+1]=Math.round((l.y*r.scale-r.y)*e.al)}Mt.fill(0),Ct.fill(0);for(let e=2045;e>=0;e--){const t=4*e,i=It[t+0],r=It[t+1],n=It[t+2],o=It[t+3],s=i+n>>1,a=r+o>>1,l=s+a-r,c=a+i-s,h=r*Et+i,u=o*Et+n,d=a*Et+s,p=Math.hypot((At[2*h+0]+At[2*u+0])/2-At[2*d+0],(At[2*h+1]+At[2*u+1])/2-At[2*d+1])>=16;Mt[d]=Mt[d]||(p?1:0),e<1022&&(Mt[d]=Mt[d]||Mt[(r+c>>1)*Et+(i+l>>1)]||Mt[(o+c>>1)*Et+(n+l>>1)])}const o=new e.b1,s=new e.b0;let a=0;function l(t,i){const r=i*Et+t;return 0===Ct[r]&&(o.emplaceBack(At[2*r+0],At[2*r+1],t*e.al/St,i*e.al/St),Ct[r]=++a),Ct[r]-1}function c(e,t,i,r,n,o){const a=e+i>>1,h=t+r>>1;if(Math.abs(e-n)+Math.abs(t-o)>1&&Mt[h*Et+a])c(n,o,e,t,a,h),c(i,r,n,o,a,h);else{const a=l(e,t),c=l(i,r),h=l(n,o);s.emplaceBack(a,c,h)}}return c(0,0,St,St,St,0),c(St,St,0,0,0,St),{vertices:o,indices:s}}(this.tileID.canonical,i);n=t.vertices,o=t.indices}else{n=new e.b1,o=new e.b0;for(const{x:e,y:i}of r)n.emplaceBack(e,i,0,0);const t=e.bh(n.int16.subarray(0,4*n.length),void 0,4);for(let e=0;e<t.length;e+=3)o.emplaceBack(t[e],t[e+1],t[e+2])}this._tileBoundsBuffer=t.createVertexBuffer(n,e.bi.members),this._tileBoundsIndexBuffer=t.createIndexBuffer(o),this._tileBoundsSegments=e.bg.simpleSegment(0,0,n.length,o.length)}_makeGlobeTileDebugBuffers(t,i){const r=i.projection;if(!r||"globe"!==r.name||i.freezeTileCoverage)return;const n=this.tileID.canonical,o=e.bj(n,i),s=e.bk(o),a=e.aj(i.zoom);let l;a>0&&(l=e.bl(new Float64Array(16),i.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,n,i,s,l,a),this._makeGlobeTileDebugTextBuffer(t,n,i,s,l,a)}_globePoint(t,i,r,n,o,s,a){let l=e.bm(t,i,r);if(s){const o=1<<r.z,c=e.aF(n.center.lng),h=e.aJ(n.center.lat),u=(r.x+.5)/o-c;let d=0;u>.5?d=-1:u<-.5&&(d=1);let p=(t/e.al+r.x)/o+d,f=(i/e.al+r.y)/o;p=(p-c)*n._pixelsPerMercatorPixel+c,f=(f-h)*n._pixelsPerMercatorPixel+h;const m=[p*n.worldSize,f*n.worldSize,0];e.af(m,m,s),l=e.bn(l,m,a)}return e.af(l,l,o)}_makeGlobeTileDebugBorderBuffer(t,i,r,n,o,s){const a=new e.bd,l=new e.be,c=new e.bo,h=(e,t,h,u,d)=>{const p=(h-e)/(d-1),f=(u-t)/(d-1),m=a.length;for(let _=0;_<d;_++){const h=e+_*p,u=t+_*f;a.emplaceBack(h,u);const d=this._globePoint(h,u,i,r,n,o,s);c.emplaceBack(d[0],d[1],d[2]),l.emplaceBack(m+_)}},u=e.al;h(0,0,u,0,16),h(u,0,u,u,16),h(u,u,0,u,16),h(0,u,0,0,16),this._tileDebugIndexBuffer=t.createIndexBuffer(l),this._tileDebugBuffer=t.createVertexBuffer(a,e.bf.members),this._globeTileDebugBorderBuffer=t.createVertexBuffer(c,e.bp.members),this._tileDebugSegments=e.bg.simpleSegment(0,0,a.length,l.length)}_makeGlobeTileDebugTextBuffer(t,i,r,n,o,s){const a=e.al/4,l=new e.bd,c=new e.b0,h=new e.bo,u=25;c.reserve(32),l.reserve(u),h.reserve(u);const d=(e,t)=>u*e+t;for(let e=0;e<u;e++){const t=e*a;for(let e=0;e<u;e++){const c=e*a;l.emplaceBack(c,t);const u=this._globePoint(c,t,i,r,n,o,s);h.emplaceBack(u[0],u[1],u[2])}}for(let e=0;e<4;e++)for(let t=0;t<4;t++){const i=d(e,t),r=d(e,t+1),n=d(e+1,t),o=d(e+1,t+1);c.emplaceBack(i,r,n),c.emplaceBack(n,r,o)}this._tileDebugTextIndexBuffer=t.createIndexBuffer(c),this._tileDebugTextBuffer=t.createVertexBuffer(l,e.bf.members),this._globeTileDebugTextBuffer=t.createVertexBuffer(h,e.bp.members),this._tileDebugTextSegments=e.bg.simpleSegment(0,0,u,32)}destroy(t=!0){for(const e in this.buckets)this.buckets[e].destroy(t);this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),t&&this.texture&&this.texture instanceof e.T&&(this.texture.destroy(),delete this.texture),this.emissiveTexture&&this.emissiveTexture instanceof e.T&&(this.emissiveTexture.destroy(),delete this.emissiveTexture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}e.bs.setPbf(e.bt);class Lt extends zt{constructor(e,t,i,r,n){super(e,t,i,r,n),this._workQueuePerLayer=new Map,this._fetchQueuePerLayer=new Map,this._taskQueue=new Map,this._isHeaderLoaded=!1,this.textureDescriptorPerLayer=new Map,this.texturePerLayer=new Map}
vendor: 4,833 bytes, line 2
2getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(e){return this._mrt&&this._mrt.getLayer(e)}setTexturePerLayer(t,i,r){const n=r.context,o=n.gl;let s=this.texturePerLayer.get(t)||r.getTileTexture(i.width);s&&s instanceof e.T?s.update(i,{premultiply:!1}):s=new e.T(n,i,o.RGBA8,{premultiply:!1}),this.texturePerLayer.has(t)||this.texturePerLayer.set(t,s)}flushQueues(e){const t=this._workQueuePerLayer.get(e)||[],i=this._fetchQueuePerLayer.get(e)||[];for(;t.length;)t.pop()();for(;i.length;)i.pop()()}flushAllQueues(){for(const e of this._workQueuePerLayer.keys()){const t=this._workQueuePerLayer.get(e)||[];for(;t.length;)t.pop()()}for(const e of this._fetchQueuePerLayer.keys()){const t=this._fetchQueuePerLayer.get(e)||[];for(;t.length;)t.pop()()}}fetchHeader(t=16384,i){const r=this._mrt=new e.bs(30),n=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(t-1)}});return this.entireBuffer=null,this.request=e.bu(n,(e,n,o)=>{if(e)i(e);else try{const e=r.getHeaderLength(n);if(e>t)return void(this.request=this.fetchHeader(e,i));r.parseHeader(n),this._isHeaderLoaded=!0;let s=0;for(const t of Object.values(r.layers))s=Math.max(s,t.dataIndex[t.dataIndex.length-1].lastByte);n.byteLength>=s&&(this.entireBuffer=n),i(null,this.entireBuffer||n,o)}catch(e){i(e)}}),this.request}fetchBandForRender(e,t,i,r){this.fetchBand(e,t,i,n=>{if(n)return void r(n);this.updateTextureDescriptor(e,t,i);const o=this.textureDescriptorPerLayer.get(t);r(null,o?o.img:null)})}fetchBand(t,i,r,n,o=!0){const s=this._mrt;if(!this._isHeaderLoaded||!s)return void n(new Error("Tile header is not ready"));const a=this.actor;if(!a)return void n(new Error("Can't fetch tile band without an actor"));let l;const c=e.B(String(r),e.B(this.tileID.key,t));let h=this._taskQueue.get(c);h?h.add(n):(h=new Set,h.add(n),this._taskQueue.set(c,h));const u=(e,t)=>{l.complete(e,t),e?n(e):(h.forEach(e=>e(null,t)),this._taskQueue.delete(c))},d=(e,t)=>{if(e)return n(e);const r=a.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:t,task:l},u,void 0,!0);if(null!==i){const e=this._workQueuePerLayer.get(i)||[];e.push(()=>{r&&r.cancel(),l.cancel()}),this._workQueuePerLayer.has(i)||this._workQueuePerLayer.set(i,e)}};let p;try{p=s.getLayer(t)}catch(e){if("reloading"===this.state)return;throw e}if(!p)return void n(new Error(`Unknown sourceLayer "${t}"`));if(p.hasDataForBand(r))return h.forEach(e=>e(null,null)),void this._taskQueue.delete(c);const f=p.getDataRange([r]);if(l=s.createDecodingTask(f),!l||l.tasks.length)if(null!==i&&this.flushQueues(i),this.entireBuffer)d(null,this.entireBuffer.slice(f.firstByte,f.lastByte+1));else{const t=Object.assign({},this.requestParams,{headers:{Range:`bytes=${f.firstByte}-${f.lastByte}`}}),r=e.bu(t,d);if(null!==i){const e=this._fetchQueuePerLayer.get(i)||[];e.push(()=>{r.cancel(),l.cancel()}),this._fetchQueuePerLayer.has(i)||this._fetchQueuePerLayer.set(i,e)}}}updateNeeded(e,t){return(!this.textureDescriptorPerLayer.get(e)||this.textureDescriptorPerLayer.get(e).band!==t||this.refreshedUponExpiration)&&"errored"!==this.state}updateTextureDescriptor(t,i,r){if(!this._mrt)return;const n=this._mrt.getLayer(t);if(!n||!n.hasBand(r)||!n.hasDataForBand(r))return;const{bytes:o,tileSize:s,buffer:a,offset:l,scale:c}=n.getBandView(r),h=s+2*a,u=new e.q({width:h,height:h},o),d=this.texturePerLayer.get(i);d&&d instanceof e.T&&d.update(u,{premultiply:!1}),this.textureDescriptorPerLayer.set(i,{layer:t,band:r,img:u,buffer:a,offset:l,tileSize:s,format:n.pixelFormat,mix:[c,256*c,65536*c,16777216*c]})}destroy(t=!1){if(super.destroy(t),delete this._mrt,!t)for(const i of this.texturePerLayer.values())i&&i instanceof e.T&&i.destroy();this.texturePerLayer.clear(),this.textureDescriptorPerLayer.clear(),this.fbo&&(this.fbo.destroy(),delete this.fbo),delete this.request,delete this.requestParams,this._isHeaderLoaded=!1}}class Dt{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(const e in this.data)for(const t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,i){const r=e.wrapped().key;void 0===this.data[r]&&(this.data[r]=[]);const n={value:t,timeout:void 0};if(void 0!==i&&(n.timeout=setTimeout(()=>{this.remove(e,n)},i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){const t=this.data[e];return t?t[0].value:null}
vendor: 4,104 bytes, line 2
2get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;const i=e.wrapped().key,r=void 0===t?0:this.data[i].indexOf(t),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){const t=[];for(const i in this.data)for(const r of this.data[i])e(r.value)||t.push(r);for(const i of t)this.remove(i.value.tileID,i)}}class Ot{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,t,i){const r=String(t);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][r]=this.stateChanges[e][r]||{},Object.assign(this.stateChanges[e][r],i),null===this.deletedStates[e]){this.deletedStates[e]={};for(const t in this.state[e])t!==r&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&null===this.deletedStates[e][r]){this.deletedStates[e][r]={};for(const t in this.state[e][r])i[t]||(this.deletedStates[e][r][t]=null)}else for(const n in i)this.deletedStates[e]&&this.deletedStates[e][r]&&null===this.deletedStates[e][r][n]&&delete this.deletedStates[e][r][n]}removeFeatureState(e,t,i){if(null===this.deletedStates[e])return;const r=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},i&&void 0!==t)null!==this.deletedStates[e][r]&&(this.deletedStates[e][r]=this.deletedStates[e][r]||{},this.deletedStates[e][r][i]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][r])for(i in this.deletedStates[e][r]={},this.stateChanges[e][r])this.deletedStates[e][r][i]=null;else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}getState(e,t){const i=this.state[e]||{},r=this.stateChanges[e]||{},n=this.deletedStates[e];if(null===n)return{};if(void 0!==t){const e=String(t),o=Object.assign({},i[e],r[e]);if(n){const e=n[t];if(null===e)return{};for(const t in e)delete o[t]}return o}const o=Object.assign({},i,r);if(n)for(const s in n)delete o[s];return o}initializeTileState(e,t){e.refreshFeatureState(t)}coalesceChanges(e,t){const i={};for(const r in this.stateChanges){this.state[r]=this.state[r]||{};const e={};for(const t in this.stateChanges[r])this.state[r][t]||(this.state[r][t]={}),Object.assign(this.state[r][t],this.stateChanges[r][t]),e[t]=this.state[r][t];i[r]=e}for(const r in this.deletedStates){this.state[r]=this.state[r]||{};const e={};if(null===this.deletedStates[r])for(const t in this.state[r])e[t]={},this.state[r][t]={};else for(const t in this.deletedStates[r]){if(null===this.deletedStates[r][t])this.state[r][t]={};else if(this.state[r][t])for(const e of Object.keys(this.deletedStates[r][t]))delete this.state[r][t][e];e[t]=this.state[r][t]}i[r]=i[r]||{},Object.assign(i[r],e)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(i).length)for(const r in e)e[r].refreshFeatureState(t)}}class Ft extends e.E{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 Dt(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Ot,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"raster-array"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(e){this.map=e,this._minTileCacheSize=void 0===this._minTileCacheSize&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&e?e._maxTileC
vendor: 4,853 bytes, line 2
2acheSize: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)if(!this._tiles[e].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,t){return e.isSymbolTile=this._onlySymbols,e.isExtraShadowCaster=this._shadowCasterTiles[e.tileID.key],this._source.loadTile(e,t)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e)}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e)}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const t in this._tiles){const i=this._tiles[t];i.upload(e,this.map?this.map.painter:void 0),i.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(kt).map(e=>e.key)}getRenderableIds(t,i){const r=[];for(const e in this._tiles)this._isIdRenderable(+e,t,i)&&r.push(this._tiles[e]);return t?r.sort((t,i)=>{const r=t.tileID,n=i.tileID,o=new e.P(r.canonical.x,r.canonical.y)._rotate(this.transform.angle),s=new e.P(n.canonical.x,n.canonical.y)._rotate(this.transform.angle);return r.overscaledZ-n.overscaledZ||s.y-o.y||s.x-o.x}).map(e=>e.tileID.key):r.map(e=>e.tileID).sort(kt).map(e=>e.key)}hasRenderableParent(e){const t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t,i){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())&&(i||!this._shadowCasterTiles[e])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(+e,"reloading")}}_reloadTile(e,t){const i=this._tiles[e];i&&("loading"!==i.state&&(i.state=t),this._loadTile(i,this._tileLoaded.bind(this,i,e,t)))}_tileLoaded(t,i,r,n,o){if(n){if(t.state="errored",404!==n.status)this._source.fire(new e.y(n,{tile:t}));else{if(this._source.fire(new e.z("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:t})),!(t.tileID.key in this._loadedParentTiles))return;if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const e=this.map.painter.terrain;this.update(this.transform,e.getScaledDemTileSize(),!0),e.resetTileLookupCache(this.id)}else this.update(this.transform)}return}t.timeAdded=e.o.now(),"expired"===r&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(i,t),"raster-dem"===this._source.type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null);let s=new Map;o&&o.responseHeaders&&(s=o.responseHeaders),this._source.fire(new e.z("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id,responseHeaders:s}))}_backfillDEM(e){const t=this.getRenderableIds();for(let r=0;r<t.length;r++){const n=t[r];if(e.neighboringTiles&&e.neighboringTiles[n]){const t=this.getTileByID(n);i(e,t),i(t,e)}}function i(e,t){if(!e.dem||e.dem.borderReady)return;e.needsHillshadePrepare=!0,e.needsDEMTextureUpload=!0;let i=t.tileID.canonical.x-e.tileID.canonical.x;const r=t.tileID.canonical.y-e.tileID.canonical.y,n=Math.pow(2,e.tileID.canonical.z),o=t.tileID.key;0===i&&0===r||Math.abs(r)>1||(Math.abs(i)>1&&(1===Math.abs(i+n)?i+=n:1===Math.abs(i-n)&&(i-=n)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,r),e.neighboringTiles&&e.neighboringTiles[o]&&(e.neighboringTiles[o].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,i,r){for(const n in this._tiles){let o=this._tiles[n];if(r[n]||!o.hasData()||o.tileID.overscaledZ<=t||o.tileID.overscaledZ>i)continue;let s=o.tileID;for(;o&&o.tileID.overscaledZ>t+1;){const e=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[e.key],o&&o.hasData()&&(s=e)}let a=s;for(;a.overscaledZ>t;)if(a=a.scaledTo(a.overscaledZ-1),e[a.key]){r[s.key]=s;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){const i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=t?i:null}for(let i=e.overscaledZ-1;i>=t;i--){const t=e.scaledTo(i),r=this._getLoadedTile(t);if(r)return r}}_getLoadedTile(e){const t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,t){t=t||this._source.tileSize;const i=Math.ceil(e.width/t)+1,r=Math.ceil(e.height/t)+1,n=Math.floor(i*r*5),o="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,n):n,s="number"==typeof this._maxTileC
vendor: 8,640 bytes, line 2
2acheSize?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(s)}handleWrapJump(e){const t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){const e={};for(const i in this._tiles){const r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),e[r.tileID.key]=r}this._tiles=e;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(+t,this._tiles[t])}}update(t,i,r,n,o){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!r)return;this.updateCacheSize(t,i),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const s="batched-model"===this._source.type;let a,l=this._source.maxzoom;const c=this.map&&this.map.painter?this.map.painter._terrain:null;if(c&&c.sourceCache===this&&c.attenuationRange()){const e=c.attenuationRange()[0],t=Math.floor(e)-Math.log2(c.getDemUpscale());l>t&&(l=t)}if(this.used||this.usedForTerrain){if(this._source.tileID)a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(t=>new e.aQ(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y));else if(0!==this.tileCoverLift){const n=t.clone();n.tileCoverLift=this.tileCoverLift,a=n.coveringTiles({tileSize:i||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:l,roundZoom:this._source.roundZoom&&!r,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:s}),this._source.minzoom<=1&&"globe"===t.projection.name&&(a.push(new e.aQ(1,0,1,0,0)),a.push(new e.aQ(1,0,1,1,0)),a.push(new e.aQ(1,0,1,0,1)),a.push(new e.aQ(1,0,1,1,1)))}else if(a=t.coveringTiles({tileSize:i||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:l,roundZoom:this._source.roundZoom&&!r,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:s}),this._source.hasTile){const e=this._source.hasTile.bind(this._source);a=a.filter(t=>e(t))}}else a=[];if(a.length>0&&"globe"!==this.transform.projection.name&&!this.usedForTerrain&&!Bt(this._source.type)){const e=t.coveringZoomLevel({tileSize:i||this._source.tileSize,roundZoom:this._source.roundZoom&&!r}),l=Math.min(e,this._source.maxzoom);if(s){const e=t.extendTileCover(a,l);for(const t of e)a.push(t)}else if(o){const e=t.extendTileCoverToNearPlane(a,this.transform.getFrustum(l),l);for(const t of e)a.push(t)}else if(this.castsShadows&&n){const e=t.extendTileCover(a,l,n,16);for(const t of e)this._shadowCasterTiles[t.key]=!0,a.push(t)}}const h=this._updateRetainedTiles(a);if(Bt(this._source.type)&&0!==a.length){const t={},i={},r=Object.keys(h);for(const o of r){const r=h[o],n=this._tiles[o];if(!n||n.fadeEndTime&&n.fadeEndTime<=e.o.now())continue;const s=this.findLoadedParent(r,Math.max(r.overscaledZ-Ft.maxOverzooming,this._source.minzoom));s&&(this._addTile(s.tileID),t[s.tileID.key]=s.tileID),i[o]=r}const n=a[a.length-1].overscaledZ;for(const e in this._tiles){const t=this._tiles[e];if(h[e]||!t.hasData())continue;let r=t.tileID;for(;r.overscaledZ>n;){r=r.scaledTo(r.overscaledZ-1);const n=this._tiles[r.key];if(n&&n.hasData()&&i[r.key]){h[e]=t.tileID;break}}}for(const e in t)h[e]||(this._coveredTiles[e]=!0,h[e]=t[e])}for(const e in h)this._tiles[e].clearFadeHold();const u=e.bv(this._tiles,h);for(const e of u){const t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(+e)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}_updateRetainedTiles(e){const t={};if(0===e.length)return t;const i={},r=e.reduce((e,t)=>Math.min(e,t.overscaledZ),1/0),n=e[0].overscaledZ,o=Math.max(n-Ft.maxOverzooming,this._source.minzoom),s=Math.max(n+Ft.maxUnderzooming,this._source.minzoom),a={};for(const l of e){const e=this._addTile(l);t[l.key]=l,e.hasData()||r<this._source.maxzoom&&(a[l.key]=l)}this._retainLoadedChildren(a,r,s,t);for(const l of e){let e=this._tiles[l.key];if(e.hasData())continue;if(l.canonical.z>=this._source.maxzoom){const e=l.children(this._source.maxzoom)[0],i=this.getTile(e);if(i&&i.hasData()){t[e.key]=e;continue}}else{const e=l.children(this._source.maxzoom);if(t[e[0].key]&&t[e[1].key]&&t[e[2].key]&&t[e[3].key])continue}let r=e.wasRequested();for(let n=l.overscaledZ-1;n>=o;--n){const o=l.scaledTo(n);if(i[o.key])break;if(i[o.key]=!0,e=this.getTile(o),!e&&r&&(e=this._addTile(o)),e&&(t[o.key]=o,r=e.wasRequested(),e.hasData()))break}}return t}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const t=[];let i,r=this._tiles[e].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}t.push(r.key);const e=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(e),i)break;r=e}for(const e of t)this._loadedParentTiles[e]=i}}_addTile(t){let i=this._tiles[t.key];if(i)return!0!==i.isExtraShadowCaster||!!this._shadowCasterTiles[t.key]||this._reloadTile(t.key,"reloading"),i;i=this._cache.getAndRemove(t),i&&(this._setTileReloadTimer(t.key,i),i.tileID=t,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,i)));const r=Boolean(i);if(!r){const e=this.map?this.map.painter:null,r=this._source.tileSize*t.overscaleFactor();i="raster-array"===this._source.type?new Lt(t,r,this.transform.tileZoom,e,this._isRaster):new zt(t,r,this.transform.tileZoom,e,this._isRaster,this._source.worldview),this._loadTile(i,this._tileLoaded.bind(this,i,t.key,i.state))}return i.uses++,this._tiles[t.key]=i,r||this._source.fire(new e.z("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},i))}_removeTile(e){const t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&"reloading"!==t.state||"empty"===t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(t,i,r){const n=[],o=this.transform;if(!o)return n;const s="globe"===o.projection.name,a=e.aF(o.center.lng);for(const l in this._tiles){const c=this._tiles[l];if(r&&c.clearQueryDebugViz(),c.holdingForFade())continue;let h;if(s){const t=c.tileID.canonical;if(0===t.z){const i=[Math.abs(e.aA(a,...Nt(t,-1))-a),Math.abs(e.aA(a,...Nt(t,1))-a)];h=[0,2*i.indexOf(Math.min(...i))-1]}else{const i=[Math.abs(e.aA(a,...Nt(t,-1))-a),Math.abs(e.aA(a,...Nt(t,0))-a),Math.abs(e.aA(a,...Nt(t,1))-a)];h=[i.indexOf(Math.min(...i))-1]}}else h=[0];for(const e of h){const r=t.containsTile(c,o,i,e);r&&n.push(r)}}return n}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(e){return this._getRenderableCoordinates(e)}_getRenderableCoordinates(e,t){const i=this.getRenderableIds(e,t).map(e=>this._tiles[e].tileID),r="globe"===this.transform.projection.name;for(const n of i)n.projMatrix=this.transform.calculateProjMatrix(n.toUnwrapped()),n.expandedProjMatrix=r?this.transform.calculateProjMatrix(n.toUnwrapped(),!1,!0):n.projMatrix;return i}sortCoordinatesByDistance(e){const t=e.slice(),i=this.transform._camera.position,r=this.transform._camera.forward(),n={};for(const o of t){const e=1/(1<<o.canonical.z);n[o.key]=((o.canonical.x+.5)*e+o.wrap-i[0])*r[0]+((o.canonical.y+.5)*e-i[1])*r[1]-i[2]*r[2]}return t.sort((e,t)=>n[e.key]-n[t.key]),t}hasTransition(){if(this._source.hasTransition())return!0;if(Bt(this._source.type))for(const t in this._tiles){const i=this._tiles[t];if(void 0!==i.fadeEndTime&&i.fadeEndTime>=e.o.now())return!0}return!1}setFeatureState(e,t,i){this._state.updateState(e=e||"_geojsonTileLayer",t,i)}removeFeatureState(e,t,i){this._state.removeFeatureState(e=e||"_geojsonTileLayer",t,i)}getFeatureState(e,t){return this._state.getState(e=e||"_geojsonTileLayer",t)}
vendor: 4,501 bytes, line 2
2setDependencies(e,t,i){const r=this._tiles[e];r&&r.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(const i in this._tiles)this._tiles[i].hasDependency(e,t)&&this._reloadTile(+i,"reloading");this._cache.filter(i=>!i.hasDependency(e,t))}_preloadTiles(t,i){if(!this._sourceLoaded){const e=()=>{this._sourceLoaded&&(this._source.off("data",e),this._preloadTiles(t,i))};return void this._source.on("data",e)}const r=new Map,n=Array.isArray(t)?t:[t],o=this.map.painter.terrain,s=this.usedForTerrain&&o?o.getScaledDemTileSize():this._source.tileSize;for(const e of n){const t=e.coveringTiles({tileSize:s,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)r.set(e.key,e);this.usedForTerrain&&e.updateElevation(!1)}const a=Array.from(r.values());e.bw(a,(e,t)=>{const i=new zt(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(i,e=>{"raster-dem"===this._source.type&&i.dem&&this._backfillDEM(i),t(e,i)})},i)}}function kt(e,t){const i=Math.abs(2*e.wrap)-+(e.wrap<0),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function Bt(e){return"raster"===e||"image"===e||"video"===e||"custom"===e}function Nt(e,t){const i=1<<e.z;return[e.x/i+t,(e.x+1)/i+t]}Ft.maxOverzooming=10,Ft.maxUnderzooming=3;class Vt{constructor(e){this.style=e,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const e=!1,t=!1;for(const i in this.style._mergedLayers){const r=this.style._mergedLayers[i];if("fill-extrusion"===r.type||"building"===r.type)this.layers.push({layer:r,visible:e,visibilityChanged:t});else if("model"===r.type){const i=this.style.getLayerSource(r);i&&"batched-model"===i.type&&this.layers.push({layer:r,visible:e,visibilityChanged:t})}}}onNewFrame(e){this.layersGotHidden=!1;for(const t of this.layers){const i=t.layer;let r=!1;"fill-extrusion"===i.type?r=!i.isHidden(e)&&i.paint.get("fill-extrusion-opacity")>0:"building"===i.type?r=!i.isHidden(e)&&i.paint.get("building-opacity")>0:"model"===i.type&&(r=!i.isHidden(e)&&i.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!r&&t.visible,t.visible=r}}updateZOffset(e,t){this.currentBuildingBuckets=[];for(const r of this.layers){const e=r.layer,i=this.style.getLayerSourceCache(e);let n=1;"fill-extrusion"===e.type?n=r.visible?e.paint.get("fill-extrusion-vertical-scale"):0:"building"===e.type&&(n=r.visible?e.paint.get("building-vertical-scale"):0);let o=i?i.getTile(t):null;if(!o&&i)for(const r in i._tiles){const e=i._tiles[r];if(t.canonical.isChildOf(e.tileID.canonical)){o=e;break}}this.currentBuildingBuckets.push({bucket:o?o.getBucket(e):null,tileID:o?o.tileID:t,verticalScale:n})}e.hasAnyZOffset=!1;let i=!1;for(let r=0;r<e.symbolInstances.length;r++){const n=e.symbolInstances.get(r),o=n.zOffset,s=this._getHeightAtTileOffset(t,n.tileAnchorX,n.tileAnchorY);n.zOffset=s!==Number.NEGATIVE_INFINITY?s:o,i||o===n.zOffset||(i=!0),e.hasAnyZOffset||0===n.zOffset||(e.hasAnyZOffset=!0)}i&&(e.zOffsetBuffersNeedUpload=!0,e.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(t,i,r,n){let o=i,s=r;if(t.canonical.z!==n.canonical.z){const a=n.canonical,l=1/(1<<t.canonical.z-a.z);o=(i+t.canonical.x*e.al)*l-a.x*e.al|0,s=(r+t.canonical.y*e.al)*l-a.y*e.al|0}return{tileX:o,tileY:s}}_getHeightAtTileOffset(e,t,i){let r,n;for(let o=0;o<this.layers.length;++o){const s=this.layers[o].layer;if("fill-extrusion"!==s.type&&"building"!==s.type)continue;const{bucket:a,tileID:l,verticalScale:c}=this.currentBuildingBuckets[o];if(!a)continue;const{tileX:h,tileY:u}=this._mapCoordToOverlappingTile(e,t,i,l),d=a.getHeightAtTileCoord(h,u);d&&void 0!==d.height&&(d.hidden?r=d.height:n=Math.max(d.height*c,n||0))}if(void 0!==n)return n;for(let o=0;o<this.layers.length;++o){const n=this.layers[o];if("model"!==n.layer.type||!n.visible)continue;const{bucket:s,tileID:a}=this.currentBuildingBuckets[o];if(!s)continue;const{tileX:l,tileY:c}=this._mapCoordToOverlappingTile(e,t,i,a),h=s.getHeightAtTileCoord(l,c);if(h&&!h.hidden)return void 0===h.height&&void 0!==r?Math.min(h.maxHeight,r)*h.verticalScale:h.height?h.height*h.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function Ut(t,i){const r={};for(const e in t)"ref"!==e&&(r[e]=t[e]);
vendor: 4,183 bytes, line 2
2return e.bx.forEach(e=>{e in i&&(r[e]=i[e])}),r}function jt(e){e=e.slice();const t=Object.create(null);for(let i=0;i<e.length;i++)t[e[i].id]=e[i];for(let i=0;i<e.length;i++)"ref"in e[i]&&(e[i]=Ut(e[i],t[e[i].ref]));return e}const Gt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setSnow:"setSnow",setRain:"setRain",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport",addIconset:"addIconset",removeIconset:"removeIconset"};function qt(e,t,i){i.push({command:Gt.addSource,args:[e,t[e]]})}function Ht(e,t,i){t.push({command:Gt.removeSource,args:[e]}),i[e]=!0}function $t(e,t,i,r){Ht(e,i,r),qt(e,t,i)}function Zt(t,i,r){let n;for(n in t[r])if(t[r].hasOwnProperty(n)&&"data"!==n&&!e.by(t[r][n],i[r][n]))return!1;for(n in i[r])if(i[r].hasOwnProperty(n)&&"data"!==n&&!e.by(t[r][n],i[r][n]))return!1;return!0}function Wt(t,i,r,n,o,s){let a;for(a in i=i||{},t=t||{})t.hasOwnProperty(a)&&(e.by(t[a],i[a])||r.push({command:s,args:[n,a,i[a],o]}));for(a in i)i.hasOwnProperty(a)&&!t.hasOwnProperty(a)&&(e.by(t[a],i[a])||r.push({command:s,args:[n,a,i[a],o]}))}function Xt(e){return e.id}function Yt(e,t){return e[t.id]=t,e}function Kt(t,i,r){const n=i.createTileMatrix(t,t.worldSize,r.toUnwrapped());return e.aB(new Float32Array(16),t.projMatrix,n)}function Jt(e,t,i){if(t.projection.name===i.projection.name)return e.projMatrix;const r=i.clone();return r.setProjection(t.projection),Kt(r,t.getProjection(),e)}function Qt(e,t,i){return t.name===i.projection.name?e.projMatrix:Kt(i,t,e)}class ei{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(1===this.points.length)return this.points[0];t=e.aA(t,0,1);let i=1,r=this._distances[i];const n=t*this.paddedLength+this.padding;for(;r<n&&i<this._distances.length;)r=this._distances[++i];const o=i-1,s=this._distances[o],a=r-s,l=a>0?(n-s)/a:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}}class ti{constructor(e,t,i){const r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let o=0;o<this.xCellCount*this.yCellCount;o++)r.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,i,r,n){this._forEachCell(t,i,r,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}insertCircle(e,t,i,r){this._forEachCell(t-r,i-r,t+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(i),this.circles.push(r)}_insertBoxCell(e,t,i,r,n,o){this.boxCells[n].push(o)}_insertCircleCell(e,t,i,r,n,o){this.circleCells[n].push(o)}_query(e,t,i,r,n,o){if(i<0||e>this.width||r<0||t>this.height)return!n&&[];const s=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=r){if(n)return!0;for(let e=0;e<this.boxKeys.length;e++)s.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){const t=this.circles[3*e],i=this.circles[3*e+1],r=this.circles[3*e+2];s.push({key:this.circleKeys[e],x1:t-r,y1:i-r,x2:t+r,y2:i+r})}return o?s.filter(o):s}
2return this._forEachCell(e,t,i,r,this._queryCell,s,{hitTest:n,seenUids:{box:{},circle:{}}},o),n?s.length>0:s}_queryCircle(e,t,i,r,n){const o=e-i,s=e+i,a=t-i,l=t+i;if(s<0||o>this.width||l<0||a>this.height)return!r&&[];const c=[];return this._forEachCell(o,a,s,l,this._queryCellCircle,c,{hitTest:r,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}},n),r?c.length>0:c}query(e,t,i,r,n){return this._query(e,t,i,r,!1,n)}hitTest(e,t,i,r,n){return this._query(e,t,i,r,!0,n)}hitTestCircle(e,t,i,r){return this._queryCircle(e,t,i,!0,r)}_queryCell(e,t,i,r,n,o,s,a){const l=s.seenUids,c=this.boxCells[n];if(null!==c){const n=this.bboxes;for(const h of c)if(!l.box[h]){l.box[h]=!0;const c=4*h;if(e<=n[c+2]&&t<=n[c+3]&&i>=n[c+0]&&r>=n[c+1]&&(!a||a(this.boxKeys[h]))){if(s.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[h],x1:n[c],y1:n[c+1],x2:n[c+2],y2:n[c+3]})}}}const h=this.circleCells[n];if(null!==h){const n=this.circles;for(const c of h)if(!l.circle[c]){l.circle[c]=!0;const h=3*c;if(this._circleAndRectCollide(n[h],n[h+1],n[h+2],e,t,i,r)&&(!a||a(this.circleKeys[c]))){if(s.hitTest)return o.push(!0),!0;{const e=n[h],t=n[h+1],i=n[h+2];o.push({key:this.circleKeys[c],x1:e-i,y1:t-i,x2:e+i,y2:t+i})}}}}}_queryCellCircle(e,t,i,r,n,o,s,a){const l=s.circle,c=s.seenUids,h=this.boxCells[n];if(null!==h){const e=this.bboxes;for(const t of h)if(!c.box[t]){c.box[t]=!0;const i=4*t;if(this._circleAndRectCollide(l.x,l.y,l.radius,e[i+0],e[i+1],e[i+2],e[i+3])&&(!a||a(this.boxKeys[t])))return o.push(!0),!0}}const u=this.circleCells[n];if(null!==u){const e=this.circles;for(const t of u)if(!c.circle[t]){c.circle[t]=!0;const i=3*t;if(this._circlesCollide(e[i],e[i+1],e[i+2],l.x,l.y,l.radius)&&(!a||a(this.circleKeys[t])))return o.push(!0),!0}}}_forEachCell(e,t,i,r,n,o,s,a){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),h=this._convertToXCellCoord(i),u=this._convertToYCellCoord(r);for(let d=l;d<=h;d++)for(let l=c;l<=u;l++)if(n.call(this,e,t,i,r,this.xCellCount*l+d,o,s,a))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,r,n,o){const s=r-e,a=n-t,l=i+o;return l*l>s*s+a*a}_circleAndRectCollide(e,t,i,r,n,o,s){const a=(o-r)/2,l=Math.abs(e-(r+a));if(l>a+i)return!1;const c=(s-n)/2,h=Math.abs(t-(n+c));if(h>c+i)return!1;if(l<=a||h<=c)return!0;const u=l-a,d=h-c;return u*u+d*d<=i*i}}const ii=Math.tan(85*Math.PI/180);function ri(t,i,r,n,o,s,a){const l=e.bC();if(r)if("globe"===s.name){const t=e.bD(o,i);e.aB(l,l,t)}else{const t=e.bE([],a);l[0]=t[0],l[1]=t[1],l[4]=t[2],l[5]=t[3],n||e.bB(l,l,o.angle)}else e.aB(l,o.labelPlaneMatrix,t);return l}function ni(e,t,i,r,n,o,s){const a=ri(e,t,i,r,n,o,s);return"globe"===o.name&&i||(a[2]=a[6]=a[10]=a[14]=0),a}function oi(t,i,r,n,o,s,a){if(r){if("globe"===s.name){const l=ri(t,i,r,n,o,s,a);return e.bl(l,l),e.aB(l,t,l),l}{const i=e.bz(t),r=e.bA([]);return r[0]=a[0],r[1]=a[1],r[4]=a[2],r[5]=a[3],e.aB(i,i,r),n||e.bB(i,i,-o.angle),i}}return o.glCoordMatrix}function si(t,i,r,n){const o=[t,i,r,1];r?e.aC(o,o,n):gi(o,o,n);const s=o[3];return o[0]/=s,o[1]/=s,o[2]/=s,o}function ai(e,t){return Math.min(.5+e/t*.5,1.5)}function li(e,t){const i=e[0]/e[3],r=e[1]/e[3];return i>=-t[0]&&i<=t[0]&&r>=-t[1]&&r<=t[1]}function ci(t,i,r,n,o,s,a,l,c,h,u=1){const d=r.transform,p=n?t.textSizeData:t.iconSizeData,f=e.bK(p,r.transform.zoom,u),m="globe"===d.projection.name,_=[256/r.width*2+1,256/r.height*2+1],g=n?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;g.clear();let y=null;m&&(y=n?t.text.globeExtVertexArray:t.icon.globeExtVertexArray);const x=t.lineVertexArray,v=n?t.text.placedSymbolArray:t.icon.placedSymbolArray,b=r.transform.width/r.transform.height;let w,T=!1;for(let S=0;S<v.length;S++){const n=v.get(S),{numGlyphs:u,writingMode:m}=n;if(m!==e.bL.vertical||T||w===e.bL.horizontal||(T=!0),w=m,(n.hidden||m===e.bL.vertical)&&!T){_i(u,g);continue}T=!1;const E=new e.P(n.tileAnchorX,n.tileAnchorY),I="road"===t.elevationType,A=!!d.elevation||I;let{x:M,y:C,z:P}=d.projection.projectTilePoint(E.x,E.y,h.canonical),R=null;if(A){const e=I?t.getElevationFeatureForText(S):null;R={getElevation:c,elevation:d.elevation,elevationFeature:e};const[i,r,n]=c(E,d.elevation,e);M+=i,C+=r,P+=n}const z=[M,C,P,1];if(e.aC(z,z,i),!li(z,_)){_i(u,g);continue}const L=z[3],D=ai(r.transform.getCameraToCenterDistance(d.projection),L),O=e.bM(p,f,n),F=a?O/D:O*D,k=si(M,C,P,o);if(k[3]<=0){_i(u,g);continue}let B={};const N=e.an(t.layers[0].layout.get("text-max-angle")),V=Math.cos(N),U=a?null:R,j=di(n,F,!1,l,i,o,s,t.glyphOffsetArray,x,g,y,k,E,B,b,U,d.projection,h,a,V);T=j.useVertical,U&&j.needsFlipping&&(B={}),(j.notEnoughRoom||T||j.needsFlipping&&di(n,F,!0,l,i,o,s,t.glyphOffsetArray,x,g,y,k,E,B,b,U,d.projection,h,a,V).notEnoughRoom)&&_i(u,g)}n?(t.text.dynamicLayoutVertexBuffer.updateData(g),y&&t.text.globeExtVertexBuffer&&t.text.globeExtVertexBuffer.updateData(y)):(t.icon.dynamicLayoutVertexBuffer.updateData(g),y&&t.icon.globeExtVertexBuffer&&t.icon.globeExtVertexBuffer.updateData(y))}function hi(e,t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_){const{lineStartIndex:g,glyphStartIndex:y,segment:x}=a,v=y+a.numGlyphs,b=g+a.lineLength,w=t.getoffsetX(y),T=t.getoffsetX(v-1),S=mi(e*w,i,r,n,o,s,x,g,b,l,c,h,u,d,!0,p,f,m,_);if(!S)return null;const E=mi(e*T,i,r,n,o,s,x,g,b,l,c,h,u,d,!0,p,f,m,_);return E?{first:S,last:E}:null}function ui(t,i,r,n){return t===e.bL.horizontal&&Math.abs(n)>Math.abs(r)?{useVertical:!0}:t===e.bL.vertical?n>0?{needsFlipping:!0}:null:0!==i&&function(e,t){return 0===e||Math.abs(t/e)>ii}(r,n)?1===i?{needsFlipping:!0}:null:r<0?{needsFlipping:!0}:null}function di(t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v){const b=i/24,w=t.lineOffsetX*b,T=t.lineOffsetY*b,{lineStartIndex:S,glyphStartIndex:E,numGlyphs:I,segment:A,writingMode:M,flipState:C}=t,P=S+t.lineLength,R=t=>{if(u){const[i,r,n]=t.up,o=h.length;
2e.bN(u,o+0,i,r,n),e.bN(u,o+1,i,r,n),e.bN(u,o+2,i,r,n),e.bN(u,o+3,i,r,n)}const[i,r,n]=t.point;e.bO(h,i,r,n,t.angle)};if(I>1){const e=hi(b,l,w,T,r,d,p,t,c,s,f,_,!1,g,y,x,v);if(!e)return{notEnoughRoom:!0};if(n&&!r){let[i,r,n]=e.first.point,[o,s,l]=e.last.point;[i,r]=si(i,r,n,a),[o,s]=si(o,s,l,a);const c=ui(M,C,(o-i)*m,s-r);if(t.flipState=c&&c.needsFlipping?1:2,c)return c}R(e.first);for(let t=E+1;t<E+I-1;t++){const e=mi(b*l.getoffsetX(t),w,T,r,d,p,A,S,P,c,s,f,_,!1,!1,g,y,x,v);if(!e)return h.length-=4*(t-E),{notEnoughRoom:!0};R(e)}R(e.last)}else{if(n&&!r){const i=si(p.x,p.y,0,o),r=S+A+1,n=new e.P(c.getx(r),c.gety(r)),s=si(n.x,n.y,0,o),a=s[3]>0?s:fi(p,n,i,1,o,void 0,g,y.canonical),l=ui(M,C,(a[0]-i[0])*m,a[1]-i[1]);if(t.flipState=l&&l.needsFlipping?1:2,l)return l}const i=mi(b*l.getoffsetX(E),w,T,r,d,p,A,S,P,c,s,f,_,!1,!1,g,y,x,v);if(!i)return{notEnoughRoom:!0};R(i)}return{}}function pi(e,t,i,r,n){const{x:o,y:s,z:a}=r.projectTilePoint(e.x,e.y,t);if(!n)return si(o,s,a,i);const[l,c,h]=n.getElevation(e,n.elevation,n.elevationFeature);return si(o+l,s+c,a+h,i)}function fi(t,i,r,n,o,s,a,l){const c=pi(t.sub(i)._unit()._add(t),l,o,a,s);return e.av(c,r,c),e.aw(c,c),e.bH(c,r,c,n)}function mi(t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x){const v=n?t-i:t+i;let b=v>0?1:-1,w=0;n&&(b*=-1,w=Math.PI),b<0&&(w+=Math.PI);let T=l+a+(b>0?0:1)|0,S=o,E=o,I=0,A=0;const M=Math.abs(v),C=[],P=[];let R=s,z=R,L=e.bF([]);const D=()=>fi(z,R,E,M-I+1,u,p,_,g.canonical);for(;I+A<=M;){if(T+=b,T<l||T>=c)return null;if(E=S,z=R,C.push(E),f&&P.push(z),R=new e.P(h.getx(T),h.gety(T)),S=d[T],!S){const e=pi(R,g.canonical,u,_,p);S=e[3]>0?d[T]=e:D()}I+=A;const t=e.av([],S,E),i=e.bG(E,S);if(r&&i>0&&A>0&&e.bJ(L,t)/(A*i)<x)return null;A=i,L=t}m&&p&&(d[T]&&(S=D(),A=e.bG(E,S),L=e.av([],S,E)),d[T]=S);const O=(M-I)/A,F=R.sub(z)._mult(O)._add(z),k=e.bH([],E,L,O);let B=[0,0,1],N=L[0],V=L[1];if(y&&(B=_.upVector(g.canonical,F.x,F.y),0!==B[0]||0!==B[1]||1!==B[2])){const t=[B[2],0,-B[0]],i=e.bI([],B,t);e.aw(t,t),e.aw(i,i),N=e.bJ(L,t),V=e.bJ(L,i)}if(r){const t=e.bI([],B,L);e.aw(t,t),e.bH(k,k,t,r*b)}const U=w+Math.atan2(V,N);return C.push(k),f&&P.push(F),{point:k,angle:U,path:C,tilePath:P,up:B}}function _i(e,t){const i=t.length,r=i+4*e;t.resize(r),t.float32.fill(-1/0,4*i,4*r)}function gi(e,t,i){const r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e[3]=i[3]*r+i[7]*n+i[15],e}const yi=100;class xi{constructor(e,t,i=new ti(e.width+200,e.height+200,25),r=new ti(e.width+200,e.height+200,25)){this.transform=e,this.grid=i,this.ignoredGrid=r,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+yi,this.screenBottomBoundary=e.height+yi,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.fogState=t}placeCollisionBox(t,i,r,n,o,s,a,l,c,h,u){let d=r.projectedAnchorX,p=r.projectedAnchorY,f=r.projectedAnchorZ;const m=r.tileAnchorX,_=r.tileAnchorY,g=r.elevation,y=r.tileID,x=t.getProjection();if(g&&y){const[e,t,i]=x.upVector(y.canonical,r.tileAnchorX,r.tileAnchorY),n=x.upVectorScale(y.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;d+=e*g*n,p+=t*g*n,f+=i*g*n}const v="globe"===t.projection.name,b="globe"===t.projection.name?e.aj(this.transform.zoom):0;if(y&&v&&b<1&&!s){const t=1<<y.canonical.z,i=e.bP(m,_);e.bQ(i,i,1/e.al),e.bR(i,i,e.bP(y.canonical.x,y.canonical.y)),e.bQ(i,i,1/t),e.bS(i,i,e.bP(n[0],n[1])),i[0]=e.bT(i[0],-.5,.5),e.bQ(i,i,e.al);const r=e.bU(i[0],i[1],e.al/(2*Math.PI),1);e.aC(r,r,o),d=e.ak(d,r[0],b),p=e.ak(p,r[1],b),f=e.ak(f,r[2],b)}const w=this.projectAndGetPerspectiveRatio(h,d,p,f,r.tileID,"globe"===x.name||!!g||this.transform.pitch>0,x),T=c*w.perspectiveRatio,S=(r.x1*i+a.x-r.padding)*T+w.point.x,E=(r.y1*i+a.y-r.padding)*T+w.point.y,I=(r.x2*i+a.x+r.padding)*T+w.point.x,A=(r.y2*i+a.y+r.padding)*T+w.point.y,M=w.perspectiveRatio<=.55||w.occluded;return!this.isInsideGrid(S,E,I,A)||!l&&this.grid.hitTest(S,E,I,A,u)||M?{box:[],offscreen:!1,occluded:w.occluded}:{box:[S,E,I,A],offscreen:this.isOffscreen(S,E,I,A),occluded:!1}}placeCollisionCircles(t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_){const g=[],y=this.transform.elevation,x=t.getProjection(),v="road"===t.elevationType,b=!!y||v,w=e.bV.getAtTileOffsetFunc(_,this.transform.center.lat,this.transform.worldSize,x),T=new e.P(r.tileAnchorX,r.tileAnchorY),S=new e.P(r.tileAnchorX,r.tileAnchorY);let{x:E,y:I,z:A}=x.projectTilePoint(S.x,S.y,_.canonical),M=null;if(b){const e=v?t.getElevationFeatureForText(n):null;M={getElevation:w,elevation:y,elevationFeature:e};const[i,r,o]=w(T,y,e);E+=i,I+=r,A+=o}const C="globe"===x.name,P=this.projectAndGetPerspectiveRatio(l,E,I,A,_,C||!!y||this.transform.pitch>0,x),{perspectiveRatio:R}
vendor: 9,504 bytes, line 2
2=P,z=(d?a/R:a*R)/e.bY,L=si(E,I,A,c),D=r.lineOffsetX*z,O=r.lineOffsetY*z,F=e.an(t.layers[0].layout.get("text-max-angle")),k=Math.cos(F),B=P.signedDistanceFromCamera>0?hi(z,s,D,O,v&&1===r.flipState,L,S,r,o,c,{},b&&!d?M:null,d&&b,x,_,d,k):null;let N=!1,V=!1,U=!0;if(B&&!P.occluded){const t=.5*f*R+m,r=new e.P(-100,-100),n=new e.P(this.screenRightBoundary,this.screenBottomBoundary),o=new ei,{first:s,last:a}=B,l=s.path.length;let c=[];for(let e=l-1;e>=1;e--)c.push(s.path[e]);for(let e=1;e<a.path.length;e++)c.push(a.path[e]);const d=2.5*t;h&&(c=c.map(([e,t,i],r)=>(b&&!C&&(i=w(r<l-1?s.tilePath[l-1-r]:a.tilePath[r-l+2],y,M.elevationFeature)[2]),si(e,t,i,h))),c.some(e=>e[3]<=0)&&(c=[]));let _=[];if(c.length>0){let t=1/0,i=-1/0,o=1/0,s=-1/0;for(const e of c)t=Math.min(t,e[0]),o=Math.min(o,e[1]),i=Math.max(i,e[0]),s=Math.max(s,e[1]);i>=r.x&&t<=n.x&&s>=r.y&&o<=n.y&&(_=[c.map(t=>new e.P(t[0],t[1]))],(t<r.x||i>n.x||o<r.y||s>n.y)&&(_=e.bW(_,r.x,r.y,n.x,n.y)))}for(const e of _){o.reset(e,.25*t);let r=0;r=o.length<=.5*t?1:Math.ceil(o.paddedLength/d)+1;for(let e=0;e<r;e++){const n=e/Math.max(r-1,1),s=o.lerp(n),a=s.x+yi,l=s.y+yi;g.push(a,l,t,0);const c=a-t,h=l-t,d=a+t,f=l+t;if(U=U&&this.isOffscreen(c,h,d,f),V=V||this.isInsideGrid(c,h,d,f),!i&&this.grid.hitTestCircle(a,l,t,p)&&(N=!0,!u))return{circles:[],offscreen:!1,collisionDetected:N,occluded:!1}}}}return{circles:!u&&N||!V?[]:g,offscreen:U,collisionDetected:N,occluded:P.occluded}}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const i=[];let r=1/0,n=1/0,o=-1/0,s=-1/0;for(const h of t){const t=new e.P(h.x+yi,h.y+yi);r=Math.min(r,t.x),n=Math.min(n,t.y),o=Math.max(o,t.x),s=Math.max(s,t.y),i.push(t)}const a=this.grid.query(r,n,o,s).concat(this.ignoredGrid.query(r,n,o,s)),l={},c={};for(const h of a){const t=h.key;if(void 0===l[t.bucketInstanceId]&&(l[t.bucketInstanceId]={}),l[t.bucketInstanceId][t.featureIndex])continue;const r=[new e.P(h.x1,h.y1),new e.P(h.x2,h.y1),new e.P(h.x2,h.y2),new e.P(h.x1,h.y2)];e.bX(i,r)&&(l[t.bucketInstanceId][t.featureIndex]=!0,void 0===c[t.bucketInstanceId]&&(c[t.bucketInstanceId]=[]),c[t.bucketInstanceId].push(t.featureIndex))}return c}insertCollisionBox(e,t,i,r,n){(t?this.ignoredGrid:this.grid).insert({bucketInstanceId:i,featureIndex:r,collisionGroupID:n},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,i,r,n){const o=t?this.ignoredGrid:this.grid,s={bucketInstanceId:i,featureIndex:r,collisionGroupID:n};for(let a=0;a<e.length;a+=4)o.insertCircle(s,e[a],e[a+1],e[a+2])}projectAndGetPerspectiveRatio(t,i,r,n,o,s,a){const l=[i,r,n,1];let c=!1;if(n||this.transform.pitch>0){if(e.aC(l,l,t),this.fogState&&o&&"globe"!==a.name){const t=function(t,i,r,n,o,s){const a=s.calculateFogTileMatrix(o),l=[i,r,n];return e.af(l,l,a),Ge(t,e.ag(l),s.pitch,s._fov)}(this.fogState,i,r,n,o.toUnwrapped(),this.transform);c=t>.9}}else gi(l,l,t);const h=l[3];return{point:new e.P((l[0]/h+1)/2*this.transform.width+yi,(-l[1]/h+1)/2*this.transform.height+yi),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(a)/h*.5,1.5),signedDistanceFromCamera:h,occluded:s&&l[2]>h||c}}isOffscreen(e,t,i,r){return i<yi||e>=this.screenRightBoundary||r<yi||t>this.screenBottomBoundary}isInsideGrid(e,t,i,r){return i>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){const t=e.bA([]);return e.br(t,t,[-100,-100,0]),t}}class vi{constructor(e,t,i,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class bi{constructor(e,t,i,r,n,o=!1){this.text=new vi(e?e.text:null,t,i,n),this.icon=new vi(e?e.icon:null,t,r,n),this.clipped=o}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class wi{constructor(e,t,i,r=!1){this.text=e,this.icon=t,this.skipFade=i,this.clipped=r}}class Ti{constructor(){this.invProjMatrix=e.bC(),this.viewportMatrix=e.bC(),this.circles=[]}}class Si{constructor(e,t,i,r,n){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n}}class Ei{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}}function Ii(t,i,r,n,o){const{horizontalAlign:s,verticalAlign:a}=e.c1(t),l=-(s-.5)*i,c=-(a-.5)*r,h=e.c2(t,n);return new e.P(l+h[0]*o,c+h[1]*o)}function Ai(t,i,r,n,o){const s=new e.P(t,i);return r&&s._rotate(n?o:-o),s}class Mi{constructor(e,t,i,r,n,o){this.transform=e.clone(),this.projection=e.projection.name,this.collisionIndex=new xi(this.transform,n),this.buildingIndex=o,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=t,this.retainedQueryData={},this.collisionGroups=new Ei(i),this.collisionCircleArrays={},this.prevPlacement=r,r&&(r.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(t,i,r,n,o=1){const s=r.getBucket(i),a=r.latestFeatureIndex;if(!s||!a||i.fqid!==s.layerIds[0])return;const l=s.layers[0].layout,c=s.layers[0].paint,h=r.collisionBoxArray,u=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),d=r.tileSize/e.al,p=r.tileID.toUnwrapped();this.transform.setProjection(s.projection);const f=(m=r.tileID,_=s.getProjection(),g=this.transform,_.name===this.projection?g.calculateProjMatrix(m.toUnwrapped()):Kt(g,_,m));var m,_,g;const y="map"===l.get("text-pitch-alignment"),x="map"===l.get("text-rotation-alignment");i.compileFilter(i.options);const v=i.dynamicFilter(),b=i.dynamicFilterNeedsFeature(),w=this.transform.calculatePixelsToTileUnitsMatrix(r),T=ni(f,r.tileID.canonical,y,x,this.transform,s.getProjection(),w);let S=null;const E=s.getProjection().createInversionMatrix(this.transform,r.tileID.canonical);if(y){const t=oi(f,r.tileID.canonical,y,x,this.transform,s.getProjection(),w);S=e.aB([],this.transform.labelPlaneMatrix,t)}let I=null;v&&r.latestFeatureIndex&&(I={unwrappedTileID:p,dynamicFilter:v,dynamicFilterNeedsFeature:b}),this.retainedQueryData[s.bucketInstanceId]=new Si(s.bucketInstanceId,a,s.sourceLayerIndex,s.index,r.tileID);const[A,M]=s.layers[0].layout.get("text-size-scale-range"),C=e.aA(o,A,M),[P,R]=l.get("icon-size-scale-range"),z=e.aA(o,P,R),L={bucket:s,layout:l,paint:c,posMatrix:f,invMatrix:E,mercatorCenter:[e.aF(this.transform.center.lng),e.aJ(this.transform.center.lat)],textLabelPlaneMatrix:T,labelToScreenMatrix:S,clippingData:I,scale:u,textPixelRatio:d,holdingForFade:r.holdingForFade(),collisionBoxArray:h,partiallyEvaluatedTextSize:e.bK(s.textSizeData,this.transform.zoom,C),partiallyEvaluatedIconSize:e.bK(s.iconSizeData,this.transform.zoom,z),collisionGroup:this.collisionGroups.get(s.sourceID),latestFeatureIndex:r.latestFeatureIndex};if(n)for(const e of s.sortKeyRanges){const{sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n}=e;t.push({sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n,parameters:L})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:s.symbolInstances.length,parameters:L})}attemptAnchorPlacement(e,t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v){const{textOffset0:b,textOffset1:w,crossTileID:T}=f,S=[b,w],E=Ii(e,o,s,S,a),I=this.collisionIndex.placeCollisionBox(_,a,t,i,r,n,Ai(E.x,E.y,l,c,this.transform.angle),p,h,u,d.predicate);if(y){const e=_.getSymbolInstanceIconSize(v,this.transform.zoom,f.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(_,e,y,i,r,n,Ai(E.x,E.y,l,c,this.transform.angle),p,h,u,d.predicate).box.length)return}if(I.box.length>0){let t;return this.prevPlacement&&this.prevPlacement.variableOffsets[T]&&this.prevPlacement.placements[T]&&this.prevPlacement.placements[T].text&&(t=this.prevPlacement.variableOffsets[T].anchor),this.variableOffsets[T]={textOffset:S,width:o,height:s,anchor:e,textScale:a,prevAnchor:t},this.markUsedJustification(_,e,f,g),_.allowVerticalPlacement&&(this.markUsedOrientation(_,g,f),this.placedOrientations[T]=g),{shift:E,placedGlyphBoxes:I}}}placeLayerBucketPart(t,i,r,n,o=1){const{bucket:s,layout:a,paint:l,posMatrix:c,textLabelPlaneMatrix:h,labelToScreenMatrix:u,clippingData:d,textPixelRatio:p,mercatorCenter:f,invMatrix:m,holdingForFade:_,collisionBoxArray:g,partiallyEvaluatedTextSize:y,partiallyEvaluatedIconSize:x,collisionGroup:v,latestFeatureIndex:b}=t.parameters,w=a.get("text-optional"),T=a.get("icon-optional"),S=a.get("text-allow-overlap"),E=a.get("icon-allow-overlap"),I="map"===a.get("text-rotation-alignment"),A="map"===a.get("icon-rotation-alignment"),M="map"===a.get("text-pitch-alignment"),C=l.get("symbol-z-offset"),P="sea"===a.get("symbol-elevation-reference"),R=a.get("symbol-placement"),[z,L]=a.get("text-size-scale-range"),[D,O]=a.get("icon-size-scale-range"),F=e.aA(o,z,L),k=e.aA(o,D,O),B=a.get("text-variable-anchor"),N=I&&"point"!==R,V=A&&"point"!==R,U=B&&s.hasTextData(),j=s.hasIconTextFit()&&U&&s.hasIconData();this.transform.setProjection(s.projection);const G=U||N,q=V||j;let H=S&&(E||!s.hasIconData()||T),$=E&&(S||!s.hasTextData()||w);const Z=!C.isConstant();!s.collisionArrays&&g&&s.deserializeCollisionBoxes(g),r&&n&&s.updateCollisionDebugBuffers(this.transform.zoom,g,F,k);const W=(t,n,o)=>{const{crossTileID:l,numVerticalGlyphVertices:g}=t;let A=null;if(d&&d.dynamicFilterNeedsFeature||Z){const e=this.retainedQueryData[s.bucketInstanceId];A=b.loadFeature({featureIndex:t.featureIndex,bucketIndex:e.bucketIndex,sourceLayerIndex:e.s
vendor: 4,895 bytes, line 2
2ourceLayerIndex,layoutVertexArrayOffset:0});const i=A.properties?A.properties.worldview:null;if(s.localizable&&s.worldview&&"string"==typeof i)if("all"===i)A.properties.$localized=!0;else{if(!i.split(",").includes(s.worldview))return;A.properties.$localized=!0,A.properties.worldview=s.worldview}}if(d&&!(0,d.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:s.worldview},A,this.retainedQueryData[s.bucketInstanceId].tileID.canonical,new e.P(t.tileAnchorX,t.tileAnchorY),this.transform.calculateDistanceTileData(d.unwrappedTileID)))return this.placements[l]=new wi(!1,!1,!1,!0),void i.add(l);const R=C.evaluate(A,{});if(i.has(l))return;if(_)return void(this.placements[l]=new wi(!1,!1,!1));let z=!1,L=!1,D=!0,O=!1,F=!1,k=null,N={box:null,offscreen:null,occluded:null},V={box:null},U=null,j=null,W=null,X=0,Y=0,K=0;o.textFeatureIndex?X=o.textFeatureIndex:t.useRuntimeCollisionCircles&&(X=t.featureIndex),o.verticalTextFeatureIndex&&(Y=o.verticalTextFeatureIndex);const J=s.elevationFeatures?s.elevationFeatures[t.elevationFeatureIndex]:void 0,Q=i=>{i.tileID=this.retainedQueryData[s.bucketInstanceId].tileID;const r=this.transform.elevation;i.elevation=P?R:R+e.bV.getAtTileOffset(i.tileID,new e.P(i.tileAnchorX,i.tileAnchorY),r,J),i.elevation+=t.zOffset},ee=o.textBox;if(ee){Q(ee);const i=i=>{let r=e.bL.horizontal;if(s.allowVerticalPlacement&&!i&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[l];e&&(this.placedOrientations[l]=e,r=e,this.markUsedOrientation(s,r,t))}return r},r=(t,i)=>{if(s.allowVerticalPlacement&&g>0&&o.verticalTextBox){for(const r of s.writingModes)if(r===e.bL.vertical?(N=i(),V=N):N=t(),N&&N.box&&N.box.length)break}else N=t()};if(B){let a=B;if(this.prevPlacement&&this.prevPlacement.variableOffsets[l]){const e=this.prevPlacement.variableOffsets[l];a.indexOf(e.anchor)>0&&(a=a.filter(t=>t!==e.anchor),a.unshift(e.anchor))}const h=(e,i,r)=>{const o=s.getSymbolInstanceTextSize(y,t,this.transform.zoom,n),l=(e.x2-e.x1)*o+2*e.padding,h=(e.y2-e.y1)*o+2*e.padding,u=t.hasIconTextFit&&!E?i:null;u&&Q(u);let d={box:[],offscreen:!1,occluded:!1};const _=S?2*a.length:a.length;for(let g=0;g<_;++g){const i=this.attemptAnchorPlacement(a[g%a.length],e,f,m,G,l,h,o,I,M,p,c,v,g>=a.length,t,n,s,r,u,y,x);if(i&&(d=i.placedGlyphBoxes,d&&d.box&&d.box.length)){z=!0,k=i.shift;break}}return d};r(()=>h(ee,o.iconBox,e.bL.horizontal),()=>{const t=o.verticalTextBox;return t&&Q(t),s.allowVerticalPlacement&&!(N&&N.box&&N.box.length)&&g>0&&t?h(t,o.verticalIconBox,e.bL.vertical):{box:null,offscreen:null,occluded:null}}),N&&(z=N.box,D=N.offscreen,O=N.occluded);const u=i(!(!N||!N.box));if(!z&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[l];e&&(this.variableOffsets[l]=e,this.markUsedJustification(s,e.anchor,t,u))}}else{const a=(i,r)=>{const o=s.getSymbolInstanceTextSize(y,t,this.transform.zoom,n),a=this.collisionIndex.placeCollisionBox(s,o,i,f,m,G,new e.P(0,0),S,p,c,v.predicate);return a&&a.box&&a.box.length&&(this.markUsedOrientation(s,r,t),this.placedOrientations[l]=r),a};r(()=>a(ee,e.bL.horizontal),()=>{const t=o.verticalTextBox;return s.allowVerticalPlacement&&g>0&&t?(Q(t),a(t,e.bL.vertical)):{box:null,offscreen:null,occluded:null}}),i(!!(N&&N.box&&N.box.length))}}if(U=N,z=U&&U.box&&U.box.length>0,D=U&&U.offscreen,O=U&&U.occluded,t.useRuntimeCollisionCircles){const i=t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex,n=s.text.placedSymbolArray.get(i),o=e.bM(s.textSizeData,y,n),l=a.get("text-padding");j=this.collisionIndex.placeCollisionCircles(s,S,n,i,s.lineVertexArray,s.glyphOffsetArray,o,c,h,u,r,M,v.predicate,t.collisionCircleDiameter*o/e.bY,l,this.retainedQueryData[s.bucketInstanceId].tileID),z=S||j.circles.length>0&&!j.collisionDetected,D=D&&j.offscreen,O=j.occluded}if(o.iconFeatureIndex&&(K=o.iconFeatureIndex),o.iconBox){const i=i=>{Q(i);const r=t.hasIconTextFit&&k?Ai(k.x,k.y,I,M,this.transform.angle):new e.P(0,0),n=s.getSymbolInstanceIconSize(x,this.transform.zoom,t.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(s,n,i,f,m,q,r,E,p,c,v.predicate)};V&&V.box&&V.box.length&&o.verticalIconBox?(W=i(o.verticalIconBox),L=W.box.length>0):(W=i(o.iconBox),L=W.box.length>0),D=D&&W.offscreen,F=W.occluded}const te=w||0===t.numHorizontalGlyphVertices&&0===g,ie=T||0===t.numIconVertices;if(te||ie?ie?te||(L=L&&z):z=L&&z:L=z=L&&z,z&&U&&U.box&&this.collisionIndex.insertCollisionBox(U.box,a.get("text-ignore-placement"),s.bucketInstanceId,V&&V.box&&Y?Y:X,v.ID),L&&W&&this.collisionIndex.insertCollisionBox(W.box,a.get("icon-ignore-placement"),s.bucketInstanceId,K,v.ID),j&&(z&&this.collisionIndex.insertCollisionCircles(j.circles,a.get("text-ignore-placement"),s.bucketInstanceId,X,v.ID),r)){const e=s.bucketInstanceId;let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=new Ti);for(let i=0;i<j.circles.length;
vendor: 4,172 bytes, line 2
2i+=4)t.circles.push(j.circles[i+0]),t.circles.push(j.circles[i+1]),t.circles.push(j.circles[i+2]),t.circles.push(j.collisionDetected?1:0)}const re="globe"!==s.projection.name;H=H&&(re||!O),$=$&&(re||!F),this.placements[l]=new wi(z||H,L||$,D||s.justReloaded),i.add(l)},X=this.retainedQueryData[s.bucketInstanceId].tileID;if("offset"===s.elevationType&&this.buildingIndex&&this.buildingIndex.updateZOffset(s,X),"road"===s.elevationType&&s.updateRoadElevation(X.canonical),s.updateZOffset(),s.sortFeaturesByY){const t=s.getSortedSymbolIndexes(this.transform.angle);for(let e=t.length-1;e>=0;--e){const i=t[e];W(s.symbolInstances.get(i),i,s.collisionArrays[i])}s.hasAnyZOffset&&e.w(`${s.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(s.hasAnyZOffset){const e=s.getSortedIndexesByZOffset();for(let t=0;t<e.length;++t){const i=e[t];W(s.symbolInstances.get(i),i,s.collisionArrays[i])}}else for(let e=t.symbolInstanceStart;e<t.symbolInstanceEnd;e++)W(s.symbolInstances.get(e),e,s.collisionArrays[e]);if(r&&s.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[s.bucketInstanceId];e.bl(t.invProjMatrix,c),t.viewportMatrix=this.collisionIndex.getViewportMatrix()}s.justReloaded=!1}markUsedJustification(t,i,r,n){const{leftJustifiedTextSymbolIndex:o,centerJustifiedTextSymbolIndex:s,rightJustifiedTextSymbolIndex:a,verticalPlacedTextSymbolIndex:l,crossTileID:c}=r,h=e.c3(i),u=n===e.bL.vertical?l:"left"===h?o:"center"===h?s:"right"===h?a:-1;o>=0&&(t.text.placedSymbolArray.get(o).crossTileID=u>=0&&o!==u?0:c),s>=0&&(t.text.placedSymbolArray.get(s).crossTileID=u>=0&&s!==u?0:c),a>=0&&(t.text.placedSymbolArray.get(a).crossTileID=u>=0&&a!==u?0:c),l>=0&&(t.text.placedSymbolArray.get(l).crossTileID=u>=0&&l!==u?0:c)}markUsedOrientation(t,i,r){const n=i===e.bL.horizontal||i===e.bL.horizontalOnly?i:0,o=i===e.bL.vertical?i:0,{leftJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:a,rightJustifiedTextSymbolIndex:l,verticalPlacedTextSymbolIndex:c}=r,h=t.text.placedSymbolArray;s>=0&&(h.get(s).placedOrientation=n),a>=0&&(h.get(a).placedOrientation=n),l>=0&&(h.get(l).placedOrientation=n),c>=0&&(h.get(c).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const t=this.prevPlacement;let i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;const r=t?t.symbolFadeChange(e):1,n=t?t.opacities:{},o=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(const a in this.placements){const e=this.placements[a],t=n[a];t?(this.opacities[a]=new bi(t,r,e.text,e.icon,null,e.clipped),i=i||e.text!==t.text.placed||e.icon!==t.icon.placed):(this.opacities[a]=new bi(null,r,e.text,e.icon,e.skipFade,e.clipped),i=i||e.text||e.icon)}for(const a in n){const e=n[a];if(!this.opacities[a]){const t=new bi(e,r,!1,!1);t.isHidden()||(this.opacities[a]=t,i=i||e.text.placed||e.icon.placed)}}for(const a in o)this.variableOffsets[a]||!this.opacities[a]||this.opacities[a].isHidden()||(this.variableOffsets[a]=o[a]);for(const a in s)this.placedOrientations[a]||!this.opacities[a]||this.opacities[a].isHidden()||(this.placedOrientations[a]=s[a]);i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t,i,r){r&&(this.lastReplacementSourceUpdateTime=r.updateTime);const n=new Set;for(const o of t){const t=o.getBucket(e);t&&o.latestFeatureIndex&&e.fqid===t.layerIds[0]&&(this.updateBucketOpacities(t,n,o,o.collisionBoxArray,i,r,o.tileID,e.scope),"offset"===t.elevationType&&this.buildingIndex&&this.buildingIndex.updateZOffset(t,o.tileID),"road"===t.elevationType&&t.updateRoadElevation(o.tileID.canonical),t.updateZOffset())}}updateBucketOpacities(t,i,r,n,o,s,a,l){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 c=t.layers[0].layout,h=t.layers[0].paint,u=!!t.layers[0].dynamicFilter(),d=new bi(null,0,!1,!1,
vendor: 3,024 bytes, line 2
2!0),p=c.get("text-allow-overlap"),f=c.get("icon-allow-overlap"),m=c.get("text-variable-anchor"),_="map"===c.get("text-rotation-alignment"),g="map"===c.get("text-pitch-alignment"),y=h.get("symbol-z-offset"),x="sea"===c.get("symbol-elevation-reference"),v=!y.isConstant(),b=new bi(null,0,p&&(f||!t.hasIconData()||c.get("icon-optional")),f&&(p||!t.hasTextData()||c.get("text-optional")),!0);!t.collisionArrays&&n&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(n);const w=(e,t,i)=>{for(let r=0;r<t/4;r++)e.opacityVertexArray.emplaceBack(i)};let T=0;s&&t.updateReplacement(a,s);for(let S=0;S<t.symbolInstances.length;S++){const n=t.symbolInstances.get(S),{numHorizontalGlyphVertices:c,numVerticalGlyphVertices:h,crossTileID:p,numIconVertices:f,tileAnchorX:E,tileAnchorY:I}=n;let A=null;const M=this.retainedQueryData[t.bucketInstanceId];v&&n&&M&&(A=r.latestFeatureIndex.loadFeature({featureIndex:n.featureIndex,bucketIndex:M.bucketIndex,sourceLayerIndex:M.sourceLayerIndex,layoutVertexArrayOffset:0}));const C=y.evaluate(A,{}),P=i.has(p);let R=this.opacities[p];P?R=d:R||(R=b,this.opacities[p]=R),i.add(p);const z=c>0||h>0,L=f>0,D=this.placedOrientations[p],O=D===e.bL.vertical,F=D===e.bL.horizontal||D===e.bL.horizontalOnly;!z&&!L||R.isHidden()||T++;let k=!1;if((z||L)&&s)for(const i of t.activeReplacements){if(e.bZ(i,o,e.b_.Symbol,l))continue;if(i.min.x>E||E>i.max.x||i.min.y>I||I>i.max.y)continue;const t=e.b$(E,I,a.canonical,i.footprintTileId.canonical);if(k=e.c0(t,i.footprint),k)break}if(z){const e=k?Bi:ki(R.text);w(t.text,c,O?Bi:e),w(t.text,h,F?Bi:e);const i=R.text.isHidden(),{leftJustifiedTextSymbolIndex:r,centerJustifiedTextSymbolIndex:o,rightJustifiedTextSymbolIndex:s,verticalPlacedTextSymbolIndex:a}=n,l=t.text.placedSymbolArray,u=i||O?1:0;r>=0&&(l.get(r).hidden=u),o>=0&&(l.get(o).hidden=u),s>=0&&(l.get(s).hidden=u),a>=0&&(l.get(a).hidden=i||F?1:0);const d=this.variableOffsets[p];d&&this.markUsedJustification(t,d.anchor,n,D);const f=this.placedOrientations[p];f&&(this.markUsedJustification(t,"left",n,f),this.markUsedOrientation(t,f,n))}if(L){const e=k?Bi:ki(R.icon),{placedIconSymbolIndex:i,verticalPlacedIconSymbolIndex:r}=n,o=t.icon.placedSymbolArray,s=R.icon.isHidden()?1:0;i>=0&&(w(t.icon,f,O?Bi:e),o.get(i).hidden=s),r>=0&&(w(t.icon,n.numVerticalIconVertices,F?Bi:e),o.get(r).hidden=s)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const i=t.collisionArrays[S];if(i){let r=new e.P(0,0),o=!0;if(i.textBox||i.verticalTextBox){if(m){const e=this.variableOffsets[p];e?(r=Ii(e.anchor,e.width,e.height,e.textOffset,e.textScale),_&&r._rotate(g?this.transform.angle:-this.transform.angle)):o=!1}u&&(o=!R.clipped),i.textBox&&Ci(t.textCollisionBox.collisionVertexArray,R.text.placed,!o||O,C,x,r.x,r.y),i.verticalTextBox&&Ci(t.textCollisionBox.collisionVertexArray,R.text.placed,!o||F,C,x,r.x,r.y)}const s=o&&Boolean(!F&&i.verticalIconBox);i.iconBox&&Ci(t.iconCollisionBox.collisionVertexArray,R.icon.placed,s,C,x,n.hasIconTextFit?r.x:0,n.hasIconTextFit?r.
vendor: 7,697 bytes, line 2
2y:0),i.verticalIconBox&&Ci(t.iconCollisionBox.collisionVertexArray,R.icon.placed,!s,C,x,n.hasIconTextFit?r.x:0,n.hasIconTextFit?r.y:0)}}}if(t.fullyClipped=0===T,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 e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){const i=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*i>e}isStale(){return this.stale}setStale(){this.stale=!0}}function Ci(e,t,i,r,n,o,s){e.emplaceBack(t?1:0,i?1:0,o||0,s||0,r,n?1:0),e.emplaceBack(t?1:0,i?1:0,o||0,s||0,r,n?1:0),e.emplaceBack(t?1:0,i?1:0,o||0,s||0,r,n?1:0),e.emplaceBack(t?1:0,i?1:0,o||0,s||0,r,n?1:0)}const Pi=Math.pow(2,25),Ri=Math.pow(2,24),zi=Math.pow(2,17),Li=Math.pow(2,16),Di=Math.pow(2,9),Oi=Math.pow(2,8),Fi=Math.pow(2,1);function ki(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*Pi+t*Ri+i*zi+t*Li+i*Di+t*Oi+i*Fi+t}const Bi=0;class Ni{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&void 0!==e.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(e,t,i,r,n,o){const s=this._bucketParts;for(;this._currentTileIndex<e.length;)if(t.getBucketParts(s,r,e[this._currentTileIndex],this._sortAcrossTiles,o),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,s.sort((e,t)=>e.sortKey-t.sortKey));this._currentPartIndex<s.length;){const e=s[this._currentPartIndex];if(t.placeLayerBucketPart(e,this._seenCrossTileIDs,i,0===e.symbolInstanceStart,o),this._currentPartIndex++,n())return!0}return!1}}class Vi{startNewPlacement(e,t,i,r,n,o,s,a){return this.placement=new Mi(e,r,n,o,s,a),this._currentPlacementIndex=t.length-1,this._forceFullPlacement=!1,this._showCollisionBoxes=i,this._fadeDuration=r,this._done=!1,this._inProgressLayer=null,this}requestFullPlacement(){this._forceFullPlacement=!0}isFullPlacementRequested(){return this._forceFullPlacement}setStale(){this.placement&&(this.placement.stale=!0)}isStale(){return!!this.placement&&this.placement.stale}isDone(){return this._done}continuePlacement(t,i,r,n,o){const s=e.o.now(),a=()=>{const t=e.o.now()-s;return!this.isFullPlacementRequested()&&0!==this._fadeDuration&&t>2};for(;this._currentPlacementIndex>=0;){const s=i[t[this._currentPlacementIndex]],l=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&"none"!==s.visibility&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){const t=s,i=t.layout.get("symbol-z-elevate"),l=void 0!==t.layout.get("symbol-sort-key").constantOr(1),c=t.layout.get("symbol-z-order"),h="viewport-y"===c||"auto"===c&&!("viewport-y"!==c&&l),u=t.layout.get("text-allow-overlap")||t.layout.get("icon-allow-overlap")||t.layout.get("text-ignore-placement")||t.layout.get("icon-ignore-placement"),d=h&&u,p=this._inProgressLayer=this._inProgressLayer||new Ni(t),f=e.B(s.source,s.scope);if(p.continuePlacement(i||d?n[f]:r[f],this.placement,this._showCollisionBoxes,s,a,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._forceFullPlacement=!1,this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Ui=512/e.al/2;class ji{constructor(t,i,r){this.tileID=t,this.bucketInstanceId=r,this.index=new e.c4(i.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const n=t.canonical.x*e.al,o=t.canonical.y*e.al;for(let e=0;e<i.length;e++){const{key:t,crossTileID:r,tileAnchorX:s,tileAnchorY:a}=i.get(e),l=Math.floor((n+s)*Ui),c=Math.floor((o+a)*Ui);this.index.add(l,c),this.keys.push(t),this.crossTileIDs.push(r)}this.index.finish()}findMatches(t,i,r){const n=this.tileID.canonical.z<i.canonical.z?1:Math.pow(2,this.tileID.canonical.z-i.canonical.z),o=Ui/Math.pow(2,i.canonical.z-this.tileID.canonical.z),s=i.canonical.x*e.al,a=i.canonical.y*e.al;for(let e=0;e<t.length;e++){const i=t.get(e);if(i.crossTileID)continue;const{key:l,tileAnchorX:c,tileAnchorY:h}=i,u=Math.floor((s+c)*o),d=Math.floor((a+h)*o),p=this.index.range(u-n,d-n,u+n,d+n).sort((e,t)=>e-t);for(const e of p){const t=this.crossTileIDs[e];if(this.keys[e]===l&&!r.has(t)){r.add(t),i.crossTileID=t;break}}}}}class Gi{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class qi{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const t=Math.round((e-this.lng)/360);if(0!==t)for(const i in this.indexes){const e=this.indexes[i],r={};for(const i in e){const n=e[i];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),r[n.tileID.key]=n}this.indexes[i]=r}this.lng=e}addBucket(e,t,i){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let n=0;n<t.symbolInstances.length;n++)t.symbolInstances.get(n).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]=new Set);const r=this.usedCrossTileIDs[e.overscaledZ];for(const n in this.indexes){const i=this.indexes[n];if(Number(n)>e.overscaledZ)for(const n in i){const o=i[n];o.tileID.isChildOf(e)&&o.findMatches(t.symbolInstances,e,r)}else{const o=i[e.scaledTo(Number(n)).key];o&&o.findMatches(t.symbolInstances,e,r)}}for(let n=0;n<t.symbolInstances.length;n++){const e=t.symbolInstances.get(n);e.crossTileID||(e.crossTileID=i.generate(),r.add(e.crossTileID))}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new ji(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(const i of t.crossTileIDs)this.usedCrossTileIDs[e].delete(i)}removeStaleBuckets(e){let t=!1;for(const i in this.indexes){const r=this.indexes[i];for(const n in r)e[r[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[n]),delete r[n],t=!0)}return t}}class Hi{constructor(){this.layerIndexes={},this.crossTileIDs=new Gi,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,i,r){let n=this.layerIndexes[e.fqid];void 0===n&&(n=this.layerIndexes[e.fqid]=new qi);let o=!1;const s={};"globe"!==r.name&&n.handleWrapJump(i);for(const a of t){const t=a.getBucket(e);t&&e.fqid===t.layerIds[0]&&(t.bucketInstanceId||(t.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(a.tileID,t,this.crossTileIDs)&&(o=!0),s[t.bucketInstanceId]=!0)}return n.removeStaleBuckets(s)&&(o=!0),o}pruneUnusedLayers(e){const t={};
2e.forEach(e=>{t[e]=!0});for(const i in this.layerIndexes)t[i]||delete this.layerIndexes[i]}}const $i=771;class Zi{constructor(e,t,i,r){this.blendFunction=e,this.blendColor=t.toNonPremultipliedRenderColor(null),this.mask=i,this.blendEquation=r}}Zi.Replace=[1,0,1,0],Zi.disabled=new Zi(Zi.Replace,e.ao.transparent,[!1,!1,!1,!1]),Zi.unblended=new Zi(Zi.Replace,e.ao.transparent,[!0,!0,!0,!0]),Zi.alphaBlended=new Zi([1,$i,1,$i],e.ao.transparent,[!0,!0,!0,!0]),Zi.alphaBlendedNonPremultiplied=new Zi([770,$i,770,$i],e.ao.transparent,[!0,!0,!0,!0]),Zi.multiply=new Zi([774,0,774,0],e.ao.transparent,[!0,!0,!0,!0]),Zi.additive=new Zi([1,1,1,1],e.ao.transparent,[!0,!0,!0,!0]);class Wi{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}}Wi.ReadOnly=!1,Wi.ReadWrite=!0,Wi.disabled=new Wi(519,Wi.ReadOnly,[0,1]);const Xi=7680;class Yi{constructor(e,t,i,r,n,o){this.test=e,this.ref=t,this.mask=i,this.fail=r,this.depthFail=n,this.pass=o}}Yi.disabled=new Yi({func:519,mask:0},0,0,Xi,Xi,Xi);const Ki=1029,Ji=2305;class Qi{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}}function er(t,i){const r=e.ca(t,3);e.cc(t,i),e.cg(t,3,r)}function tr(t,i){const r=e.c7([]);return e.c8(r,r,-i),e.c9(r,r,-t),r}function ir(t,i){const r=[t[0],t[1],0],n=[i[0],i[1],0];if(e.ag(r)>=1e-15){const t=e.aw([],r);e.c5(n,t,e.bJ(n,t)),i[0]=n[0],i[1]=n[1]}const o=e.bI([],i,t);if(e.c6(o)<1e-15)return null;const s=Math.atan2(-o[1],o[0]);return tr(Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2]),s)}Qi.disabled=new Qi(!1,Ki,Ji),Qi.backCCW=new Qi(!0,Ki,Ji),Qi.backCW=new Qi(!0,Ki,2304),Qi.frontCW=new Qi(!0,1028,2304),Qi.frontCCW=new Qi(!0,1028,Ji);class rr{constructor(e,t){this.position=e,this.orientation=t}get position(){return this._position}set position(t){if(t){const i=t instanceof e.ae?t:new e.ae(t[0],t[1],t[2]);
vendor: 4,312 bytes, line 2
2this._renderWorldCopies&&(i.x=e.bT(i.x,0,1)),this._position=i}else this._position=null}lookAtPoint(t,i,r){if(this.orientation=null,!this.position)return;const n=this.position,o=r||(this._elevation?this._elevation.getAtPointOrZero(e.ae.fromLngLat(t)):0),s=e.ae.fromLngLat(t,o),a=[s.x-n.x,s.y-n.y,s.z-n.z];i||(i=[0,0,1]),i[2]=Math.abs(i[2]),this.orientation=ir(a,i)}setPitchBearing(t,i){this.orientation=tr(e.an(t),e.an(-i))}}class nr{constructor(t,i){this._transform=e.bA([]),this.orientation=i,this.position=t}get mercatorPosition(){const t=this.position;return new e.ae(t[0],t[1],t[2])}get position(){const t=e.ca(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var i;t&&e.cg(this._transform,3,[(i=t)[0],i[1],i[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||e.c7([]),t&&er(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=tr(e,t),er(this._transform,this._orientation)}forward(){const t=e.ca(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=e.ca(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=e.ca(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,i){const r=new Float64Array(16);return e.bl(r,this.getWorldToCamera(t,i)),r}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,i,r){const n=this.position;e.c5(n,n,-t);const o=new Float64Array(16);return e.bq(o,[r,r,r]),e.br(o,o,n),o[10]*=i,o}getWorldToCamera(t,i){const r=new Float64Array(16),n=new Float64Array(4),o=this.position;return e.cb(n,this._orientation),e.c5(o,o,-t),e.cc(r,n),e.br(r,r,o),r[1]*=-1,r[5]*=-1,r[9]*=-1,r[13]*=-1,r[8]*=i,r[9]*=i,r[10]*=i,r[11]*=i,r}getCameraToClipPerspective(t,i,r,n){const o=new Float64Array(16);return e.cd(o,t,i,r,n),o}getCameraToClipOrthographic(t,i,r,n,o,s){const a=new Float64Array(16);return e.ce(a,t,i,r,n,o,s),a}getDistanceToElevation(t,i=!1){const r=0===t?0:e.cf(t,i?e.a$(this.position[1]):this.position[1]),n=this.forward();return(r-this.position[2])/n[2]}clone(){return new nr([...this.position],[...this.orientation])}}const or=(e,t)=>({u_matrix:e,u_ground_shadow_factor:t});class sr{constructor(e=0,t=0,i=0,r=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(r)||r<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=i,this.right=r}interpolate(t,i,r){return null!=i.top&&null!=t.top&&(this.top=e.ak(t.top,i.top,r)),null!=i.bottom&&null!=t.bottom&&(this.bottom=e.ak(t.bottom,i.bottom,r)),null!=i.left&&null!=t.left&&(this.left=e.ak(t.left,i.left,r)),null!=i.right&&null!=t.right&&(this.right=e.ak(t.right,i.right,r)),this}getCenter(t,i){const r=e.aA((this.left+t-this.right)/2,0,t),n=e.aA((this.top+i-this.bottom)/2,0,i);return new e.P(r,n)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new sr(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const ar=15;class lr{constructor(t,i,r,n,o,s,a){this.tileSize=512,this._renderWorldCopies=void 0===o||o,this._minZoom=t||0,this._maxZoom=i||22,this._minPitch=r??0,this._maxPitch=n??60,this.setProjection(s),this.setMaxBounds(a),this.width=0,this.height=0,this._center=new e.aT(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 sr,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new nr,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){const e=new lr(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return e._elevation=this._elevation,e._centerAltitude=this._centerAltitude,e._centerAltitudeValidForE
vendor: 10,108 bytes, line 2
2xaggeration=this._centerAltitudeValidForExaggeration,e.tileSize=this.tileSize,e.mercatorFromTransition=this.mercatorFromTransition,e.width=this.width,e.height=this.height,e.cameraElevationReference=this.cameraElevationReference,e._center=this._center,e._setZoom(this.zoom),e._seaLevelZoom=this._seaLevelZoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._nearZ=this._nearZ,e._farZ=this._farZ,e._averageElevation=this._averageElevation,e._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._camera=this._camera.clone(),e._calcMatrices(),e.freezeTileCoverage=this.freezeTileCoverage,e.frustumCorners=this.frustumCorners,e._allowWorldUnderZoom=this._allowWorldUnderZoom,e}get isOrthographic(){return"globe"!==this.projection.name&&this._orthographicProjectionAtLowPitch&&this.pitch<ar}get elevation(){return this._elevation}set elevation(e){this._elevation!==e&&(this._elevation=e,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return"globe"!==this.projection.name&&!this.isOrthographic}updateElevation(e,t=!1){const i=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(null==this._seaLevelZoom||i)&&this._updateCameraOnTerrain(),(e||i)&&this._constrainCamera(t),this._calcMatrices()}getProjection(){return e.aH(this.projection,["name","center","parallels"])}setProjection(t){this.projectionOptions=t||{name:"mercator"};const i=this.projection?this.getProjection():void 0;this.projection=e.cm(this.projectionOptions);const r=this.getProjection(),n=!e.by(i,r);return n&&this._calcMatrices(),this.mercatorFromTransition=!1,n}setOrthographicProjectionAtLowPitch(e){return this._orthographicProjectionAtLowPitch!==e&&(this._orthographicProjectionAtLowPitch=e,this._calcMatrices(),!0)}setMercatorFromTransition(){const t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=e.cm({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.cf(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.P(this.width,this.height)}get bearing(){return e.bT(this.rotation,-180,180)}set bearing(e){this.rotation=e}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const i=-t*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=e.cn(),e.co(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const i=e.aA(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}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=e.an(t),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const e=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/e)}get averageElevation(){return this._averageElevation}set averageElevation(e){this._averageElevation=e,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(e){const t=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==t&&(this._unmodified=!1,this._setZoom(t),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(e){this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(e){this._tileCoverLift!==e&&(this._tileCoverLift=e)}_updateCameraOnTerrain(){const e=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,t=this.elevation&&e===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||e===Number.NEGATIVE_INFINITY&&(!t||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const i=this._elevation;t||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&i.exaggeration()&&this._centerAltitudeValidForExaggeration!==i.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*i.exaggeration(),this._centerAltitudeValidForExaggeration=i.exaggeration()):(this._centerAltitude=e||0,this._centerAltitudeValidForExaggeration=i.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(void 0===this._centerAltitudeValidForExaggeration)return;const e=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(e)}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,i=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],r=this.horizonLineFromTop();let n=0,o=0;for(let s=0;s<i.length;s++){const a=new e.P(i[s][0]*this.width,r+i[s][1]*(this.height-r)),l=t.pointCoordinate(a);if(!l)continue;const c=1/Math.hypot(l[0]-this._camera.position[0],l[1]-this._camera.position[1]);n+=l[3]*c,o+=c}return 0===o?NaN:n/o}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._terrainEnabled()&&("ground"===this.cameraElevationReference?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(null==this._seaLevelZoom||!this._elevation)return;const e=this._seaLevelZoom,t=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),i=this.pixelsPerMeter/this.worldSize*t,r=this._mercatorZfromZoom(e),n=this._mercatorZfromZoom(this._maxZoom),o=Math.max(r-i,n);this._setZoom(this._zoomFromMercatorZ(o))}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}equals(e){const t=this.elevation,i=e.elevation,r=null!=t!=(null!=i)||t&&i&&t.exaggeration()!==i.exaggeration();return this.width===e.width&&this.height===e.height&&this.center.lng===e.center.lng&&this.center.lat===e.center.lat&&this.zoom===e.zoom&&this.bearing===e.bearing&&this.pitch===e.pitch&&this.fov===e.fov&&this.projection.name===e.projection.name&&this._edgeInsets.equals(e.padding)&&!r}computeZoomRelativeTo(t){const i=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));let r;r=t.z<this._camera.position[2]?[i.x,i.y,i.z]:[t.x,t.y,t.z];const n=e.ag(e.av([],this._camera.position,r));return e.aA(this._zoomFromMercatorZ(n),this._minZoom,this._maxZoom)}setFreeCameraOptions(t){if(!this.height)return;if(!t.position&&!t.orientation)return;this._updateCameraState();let i=!1;if(t.orientation&&!e.cp(t.orientation,this._camera.orientation)&&(i=this._setCameraOrientation(t.orientation)),t.position){const r=[t.position.x,t.position.y,t.position.z];e.cq(r,this._camera.position)||(this._setCameraPosition(r),i=!0)}i&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const t=this._camera.position,i=new rr;return i.position=new e.ae(t[0],t[1],t[2]),i.orientation=this._camera.orientation,i._elevation=this.elevation,i._renderWorldCopies=this.renderWorldCopies,i}_setCameraOrientation(t){if(!e.cr(t))return!1;e.cs(t,t);const i=e.ct([],[0,0,-1],t),r=e.ct([],[0,-1,0],t);if(r[2]<0)return!1;const n=ir(i,r);return!!n&&(this._camera.orientation=n,!0)}_setCameraPosition(t){const i=this.zoomScale(this.minZoom)*this.tileSize,r=this.zoomScale(this.maxZoom)*this.tileSize,n=this.cameraToCenterDistance;t[2]=e.aA(t[2],n/r,n/i),this._camera.position=t}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){const t=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,t)}getVisibleUnwrappedCoordinates(t){const i=[new e.cu(0,t)];if(this.renderWorldCopies){const r=this.pointCoordinate(new e.P(0,0)),n=this.pointCoordinate(new e.P(this.width,0)),o=this.pointCoordinate(new e.P(this.width,this.height)),s=this.pointCoordinate(new e.P(0,this.height)),a=Math.floor(Math.min(r.x,n.x,o.x,s.x)),l=Math.floor(Math.max(r.x,n.x,o.x,s.x)),c=1;for(let h=a-c;h<=l+c;h++)0!==h&&i.push(new e.cu(h,t))}return i}isLODDisabled(e){return(!e||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}
vendor: 9,091 bytes, line 2
2extendTileCover(t,i,r,n){let o=[];const s=null!=r,a=!s;if(a&&this.zoom<i)return o;if(s&&0===r[0]&&0===r[1])return o;const l=new Set,c=(t,i,r,n,s)=>{const a=e.cY(i,t,r,n,s);l.has(a)||(o.push(new e.aQ(t,i,r,n,s)),l.add(a))};for(let e=0;e<t.length;e++){const o=t[e];if(a&&o.canonical.z!==i)continue;if(s&&void 0!==n&&n>o.canonical.z)continue;const l=o.canonical,h=o.overscaledZ,u=o.wrap,d=1<<l.z,p=l.x+1<d,f=l.x>0,m=l.y+1<d,_=l.y>0,g=o.wrap-(f?0:1),y=o.wrap+(p?0:1),x=f?l.x-1:d-1,v=p?l.x+1:0;if(s)r[0]<0?(c(h,y,l.z,v,l.y),r[1]<0&&m&&(c(h,u,l.z,l.x,l.y+1),c(h,y,l.z,v,l.y+1)),r[1]>0&&_&&(c(h,u,l.z,l.x,l.y-1),c(h,y,l.z,v,l.y-1))):r[0]>0?(c(h,g,l.z,x,l.y),r[1]<0&&m&&(c(h,u,l.z,l.x,l.y+1),c(h,g,l.z,x,l.y+1)),r[1]>0&&_&&(c(h,u,l.z,l.x,l.y-1),c(h,g,l.z,x,l.y-1))):r[1]<0&&m?c(h,u,l.z,l.x,l.y+1):_&&c(h,u,l.z,l.x,l.y-1);else{const e=o.visibleQuadrants;1&e&&(c(h,g,l.z,x,l.y),_&&(c(h,u,l.z,l.x,l.y-1),c(h,g,l.z,x,l.y-1))),2&e&&(c(h,y,l.z,v,l.y),_&&(c(h,u,l.z,l.x,l.y-1),c(h,y,l.z,v,l.y-1))),4&e&&(c(h,g,l.z,x,l.y),m&&(c(h,u,l.z,l.x,l.y+1),c(h,g,l.z,x,l.y+1))),8&e&&(c(h,y,l.z,v,l.y),m&&(c(h,u,l.z,l.x,l.y+1),c(h,y,l.z,v,l.y+1)))}}const h=[];for(const e of o)o.some(t=>e.isChildOf(t))||h.push(e);if(o=h.filter(e=>!t.some(t=>!!(e.overscaledZ<i&&t.isChildOf(e))||e.equals(t)||e.isChildOf(t))),a){const e=1<<i,t="globe"===this.projection.name?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),r=[e*t.x,e*t.y],n=4,s=n*n;o=o.filter(e=>{const t=e.canonical.x+.5-r[0],i=e.canonical.y+.5-r[1];return t*t+i*i<s})}return o}extendTileCoverToNearPlane(t,i,r){const n=[],o=new Set;for(const e of t)o.add(e.key);const s=(t,i,r,s,a)=>{const l=e.cY(i,t,r,s,a);o.has(l)||(n.push(new e.aQ(t,i,r,s,a)),o.add(l))},a=t.reduce((e,t)=>Math.max(e,t.overscaledZ),r),l=1<<r,c=[new e.P(0,0),new e.P(e.al,0),new e.P(e.al,e.al),new e.P(0,e.al)],h=new e.P(0,0),u=new e.P(0,0),d=(t,i)=>{const n=Math.floor(t[0]),o=Math.floor(t[1]),d=(t[0]-n)*e.al,p=(t[1]-o)*e.al,f=Math.floor(i[0]),m=Math.floor(i[1]),_=(i[0]-f)*e.al,g=(i[1]-m)*e.al;for(let y=-1;y<=1;y++){const t=n+y;if(!(t<0||t>=l)){h.x=d-y*e.al,u.x=_-(t-f)*e.al;for(let i=-1;i<=1;i++){const n=o+i;h.y=p-i*e.al,u.y=g-(n-m)*e.al,e.cZ(h,u,c)&&s(a,0,r,t,n)}}}},p=i.points,f=p[e.cv],m=p[e.cw],_=this._projectToGround(f,p[e.cx]),g=this._projectToGround(m,p[e.cy]);return d(f,_),d(m,g),n}_projectToGround(t,i){return e.cz(e.cA(),t,i,t[2]/(t[2]-i[2]))}coveringTiles(t){let i=this.coveringZoomLevel(t);const r=i,n=this.elevation&&this.elevation.exaggeration(),o=n&&!t.isTerrainDEM,s="mercator"===this.projection.name;if(void 0!==t.minzoom&&i<t.minzoom)return[];void 0!==t.maxzoom&&i>t.maxzoom&&(i=t.maxzoom);const a=this.locationCoordinate(this.center),l=this.center.lat,c=1<<i,h=[c*a.x,c*a.y,0],u="globe"===this.projection.name,d=!u,p=e.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i,d),f=u?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),m=c*e.cf(1,this.center.lat),_=this._camera.position[2]/e.cf(1,this.center.lat),g=[c*f.x,c*f.y,_*(d?1:m)],y=u||n,x=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),v=this.isLODDisabled(!0)?i:0;let b;if(this._elevation&&t.isTerrainDEM)b=1e4*this._elevation.exaggeration();else if(this._elevation){const e=this._elevation.getMinMaxForVisibleTiles();b=e?e.max:this._centerAltitude}else b=this._centerAltitude;const w=t.isTerrainDEM?-b:this._elevation?this._elevation.getMinElevationBelowMSL():0,T=this.projection.isReprojectedInTileSpace?e.cC(this):1,S=t=>{const i=1/4e4,r=new e.ae(t.x+i,t.y,t.z),n=new e.ae(t.x,t.y+i,t.z),o=t.toLngLat(),s=r.toLngLat(),a=n.toLngLat(),l=this.locationCoordinate(o),c=this.locationCoordinate(s),h=this.locationCoordinate(a),u=Math.hypot(c.x-l.x,c.y-l.y),d=Math.hypot(h.x-l.x,h.y-l.y);return Math.sqrt(u*d)*T/i},E=t=>{const i=b,r=w;return{aabb:e.cF(this,c,0,0,0,t,r,i,this.projection),zoom:0,x:0,y:0,minZ:r,maxZ:i,wrap:t,fullyVisible:!1}},I=[];let A=[];const M=i,C=t.reparseOverscaled?r:i,P=(_-this._centerAltitude)*m,R=e=>{if(!this._elevation||!e.tileID||!s)return;const t=this._elevation.getMinMaxForTile(e.tileID),i=e.aabb;t?(i.min[2]=t.min,i.max[2]=t.max,i.center[2]=(i.min[2]+i.max[2])/2):(e.shouldSplit=L(e),e.shouldSplit||(i.min[2]=i.max[2]=i.center[2]=this._centerAltitude))},z=(e,t)=>{if(.707*t<e)return 1;const i=t/e;return i/(1.4144271570014144+(Math.pow(1.1,i-1.4144271570014144+1)-1)/(1.1-1)-1)},L=t=>{if(t.zoom<v)return!0;if(t.zoom===M)return!1;if(null!=t.shouldSplit)return t.shouldSplit;const i=t.aabb.distanceX(g),n=t.aabb.distanceY(g);let a=P,c=1;if(u){a=t.aabb.distanceZ(g);const i=Math.pow(2,t.zoom),r=e.a$((t.y+1)/i),n=e.a$(t.y/i),o=Math.min(Math.max(l,r),n),s=e.d1(o)/e.d1(l);if(c=o===l?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,s/this._mercatorScaleRatio),this.zoom<=e.c_&&t.zoom===M-1&&s>=.9)return!0}else if(o&&(a=t.aabb.distanceZ(g)*m),this.projection.isReprojectedInTileSpace&&r<=5){const i=Math.pow(2,t.zoom),r=S(new e.ae((t.x+.5)/i,(t.y+.5)/i));c=r>.85?1:r}if(!s&&!u){const e=Math.sqrt(i*i+n*n+a*a);let r=(1<<M-t.zoom)*x*c;return r*=z(Math.max(a,P),e),e<r}let d=Number.MAX_VALUE,p=0;const f=t.aabb.getCorners(),_=[];for(const r of f){e.av(_,r,g),u||(o?_[2]*=m:_[2]=P);const t=e.bJ(_,this._camera.forward());t<d&&(d=t,p=Math.abs(_[2]))}let y=(1<<M-t.zoom)*x*c;if(y*=z(Math.max(p,P),d),d<y)return!0;const b=t.aabb.closestPoint(h);return b[0]===h[0]&&b[1]===h[1]};if(this.renderWorldCopies)for(let e=1;e<=3;e++)I.push(E(-e)),I.push(E(e));for(I.push(E(0));I.length>0;){const r=I.pop(),n=r.x,a=r.y;let l=r.fullyVisible;const d=()=>"globe"===this.projection.name&&(0===r.y||r.y===(1<<r.zoom)-1);if(!l){let t=y?r.aabb.intersects(p):r.aabb.intersectsFlat(p);if(0===t&&d()){const i=new e.cD(r.zoom,n,a);t=e.cE(this,c,i,!0).intersects(p)}if(0===t)continue;l=2===t}if(r.zoom===M||!L(r)){const o=r.zoom===M?C:r.zoom;if(t.minzoom&&t.minzoom>o)continue;let s=0;if(!l){let i=y?r.aabb.intersectsPrecise(p):r.aabb.intersectsPreciseFlat(p);if(0===i&&d()){const t=new e.cD(r.zoom,n,a);i=e.cE(this,c,t,!0).intersectsPrecise(p)}if(0===i)continue;if(t.calculateQuadrantVisibility)if(p.containsPoint(r.aabb.center))s=15;else for(let e=0;e<4;e++)0!==r.aabb.quadrant(e).intersects(p)&&(s|=1<<e)}const u=h[0]-(.5+n+(r.wrap<<r.zoom))*(1<<i-r.zoom),f=h[1]-.5-a,m=r.tileID?r.tileID:new e.aQ(o,r.wrap,r.zoom,n,a);t.calculateQuadrantVisibility&&(m.visibleQuadrants=s),A.push({tileID:m,distanceSq:u*u+f*f});continue}for(let t=0;t<4;t++){const i=(n<<1)+t%2,h=(a<<1)+(t>>1),d={aabb:s?r.aabb.quadrant(t):e.cF(this,c,r.zoom+1,i,h,r.wrap,r.minZ,r.maxZ,this.projection),zoom:r.zoom+1,x:i,y:h,wrap:r.wrap,fullyVisible:l,tileID:void 0,shouldSplit:void 0,minZ:r.minZ,maxZ:r.maxZ};o&&!u&&(d.tileID=new e.aQ(r.zoom+1===M?C:r.zoom+1,r.wrap,r.zoom+1,i,h),R(d)),I.push(d)}}if(this.fogCullDistSq){const i=this.fogCullDistSq,r=this.horizonLineFromTop();A=A.filter(n=>{const o=[0,0,0,1],s=[e.al,e.al,0,1],a=this.calculateFogTileMatrix(n.tileID.toUnwrapped());e.aC(o,o,a),e.aC(s,s,a);const l=e.cG([],o,s),c=e.cH([],o,s),h=e.c$(l,c);if(0===h)return!0;let u=!1;const d=this._elevation;if(d&&h>i&&0!==r){const i=this.calculateProjMatrix(n.tileID.toUnwrapped());let o;t.isTerrainDEM||(o=d.getMinMaxForTile(n.tileID)),o||(o={min:w,max:b});const s=e.cI(this.rotation),a=[s[0]*e.al,s[1]*e.al,o.max];e.af(a,a,i),u=(1-a[1])*this.height*.5<r}return h<i||u})}return A.sort((e,t)=>e.distanceSq-t.distanceSq).map(e=>e.tileID)}resize(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log2(e)}project(t){const i=e.aA(t.lat,-e.cJ,e.cJ),r=this.projection.project(t.lng,i);return new e.P(r.x*this.worldSize,r.y*this.worldSize)}unproject(e){return this.projection.unproject(e.x/this.worldSize,e.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/e.cf(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,i){let r,n;const o=this.centerPoint;if("globe"===this.projection.name){const e=this.worldSize;r=(i.x-o.x)/e,n=(i.y-o.y)/e}else{const e=this.pointCoordinate(i),t=this.pointCoordinate(o);r=e.x-t.x,n=e.y-t.y}const s=this.locationCoordinate(t);this.setLocation(new e.ae(s.x-r,s.y-n))}setLocation(e){this.center=this.coordinateLocation(e),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(e,t){return this.projection.locationPoint(this,e,t)}locationPoint3D(e,t){return this.projection.locationPoint(this,e,t,!0)}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}pointLocation3D(e,t){return this.coordinateLocation(this.pointCoordinate3D(e,t))}locationCoordinate(t,i){const r=i?e.cf(i,t.lat):void 0,n=this.projection.project(t.lng,t.lat);return new e.ae(n.x,n.y,r)}coordinateLocation(e){return this.projection.unproject(e.x,e.y)}pointRayIntersection(t,i){const r=null!=i?i:this._centerAltitude,n=[t.x,t.y,0,1],o=[t.x,t.y,1,1];e.aC(n,n,this.pixelMatrixInverse),e.aC(o,o,this.pixelMatrixInverse);const s=o[3];e.cK(n,n,1/n[3]),e.cK(o,o,1/s);const a=n[2],l=o[2];
vendor: 8,906 bytes, line 2
2return{p0:n,p1:o,t:a===l?0:(r-a)/(l-a)}}screenPointToMercatorRay(t){const i=[t.x,t.y,0,1],r=[t.x,t.y,1,1];return e.aC(i,i,this.pixelMatrixInverse),e.aC(r,r,this.pixelMatrixInverse),e.cK(i,i,1/i[3]),e.cK(r,r,1/r[3]),i[2]=e.cf(i[2],this._center.lat)*this.worldSize,r[2]=e.cf(r[2],this._center.lat)*this.worldSize,e.cK(i,i,1/this.worldSize),e.cK(r,r,1/this.worldSize),new e.ax([i[0],i[1],i[2]],e.aw([],e.av([],r,i)))}rayIntersectionCoordinate(t){const{p0:i,p1:r,t:n}=t,o=e.cf(i[2],this._center.lat),s=e.cf(r[2],this._center.lat);return new e.ae(e.ak(i[0],r[0],n)/this.worldSize,e.ak(i[1],r[1],n)/this.worldSize,e.ak(o,s,n))}pointCoordinate(e,t=this._centerAltitude){return this.projection.pointCoordinate(this,e.x,e.y,t)}pointCoordinate3D(t,i){if(!this.elevation)return this.pointCoordinate(t,i);let r=this.projection.pointCoordinate3D(this,t.x,t.y);if(r)return new e.ae(r[0],r[1],r[2]);let n=0,o=this.horizonLineFromTop();if(t.y>o)return this.pointCoordinate(t,i);const s=.02*o,a=t.clone();for(let l=0;l<10&&o-n>s;l++){a.y=e.ak(n,o,.66);const t=this.projection.pointCoordinate3D(this,a.x,a.y);t?(o=a.y,r=t):n=a.y}return r?new e.ae(r[0],r[1],r[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.cL)return!this.isPointAboveHorizon(t);const i=this.pointCoordinate(t);return i.y>=0&&i.y<=1}_coordinatePoint(t,i){const r=i&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,n=[t.x*this.worldSize,t.y*this.worldSize,r+t.toAltitude(),1];return e.aC(n,n,this.pixelMatrix),n[3]>0?new e.P(n[0]/n[3],n[1]/n[3]):new e.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:i}=this._edgeInsets,r=this.height-this._edgeInsets.bottom,n=this.width-this._edgeInsets.right,o=this.pointLocation3D(new e.P(i,t)),s=this.pointLocation3D(new e.P(n,t)),a=this.pointLocation3D(new e.P(n,r)),l=this.pointLocation3D(new e.P(i,r));let c=Math.min(o.lng,s.lng,a.lng,l.lng),h=Math.max(o.lng,s.lng,a.lng,l.lng),u=Math.min(o.lat,s.lat,a.lat,l.lat),d=Math.max(o.lat,s.lat,a.lat,l.lat);const p=Math.pow(2,-this.zoom)/16*270,f="globe"===this.projection.name?1:4,m=(t,i,r,n,o)=>{const s=(t+r)/2,a=(i+n)/2,l=new e.P(s,a),{lng:_,lat:g}=this.pointLocation3D(l),y=Math.max(0,c-_,u-g,_-h,g-d);c=Math.min(c,_),h=Math.max(h,_),u=Math.min(u,g),d=Math.max(d,g),(o<f||y>p)&&(m(t,i,s,a,o+1),m(s,a,r,n,o+1))};if(m(i,t,n,t,1),m(n,t,n,r,1),m(n,r,i,r,1),m(i,r,i,t,1),"globe"===this.projection.name){const[t,i]=e.cM(this);t?(d=90,h=180,c=-180):i&&(u=-90,h=180,c=-180)}return new e.aI(new e.aT(c,u),new e.aT(h,d))}_getBoundsRectangular(t,i){const{top:r,left:n}=this._edgeInsets,o=this.height-this._edgeInsets.bottom,s=this.width-this._edgeInsets.right,a=new e.P(n,r),l=new e.P(s,r),c=new e.P(s,o),h=new e.P(n,o);let u=this.pointCoordinate(a,t),d=this.pointCoordinate(l,t);const p=this.pointCoordinate(c,i),f=this.pointCoordinate(h,i),m=(e,t)=>(t.y-e.y)/(t.x-e.x);return u.y>1&&d.y>=0?u=new e.ae((1-f.y)/m(f,u)+f.x,1):u.y<0&&d.y<=1&&(u=new e.ae(-f.y/m(f,u)+f.x,0)),d.y>1&&u.y>=0?d=new e.ae((1-p.y)/m(p,d)+p.x,1):d.y<0&&u.y<=1&&(d=new e.ae(-p.y/m(p,d)+p.x,0)),(new e.aI).extend(this.coordinateLocation(u)).extend(this.coordinateLocation(d)).extend(this.coordinateLocation(f)).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.cJ,this.maxLat=e.cJ,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=e.aF(this.minLng)*this.tileSize,this.worldMaxX=e.aF(this.maxLng)*this.tileSize,this.worldMinY=e.aJ(this.maxLat)*this.tileSize,this.worldMaxY=e.aJ(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(e,t){return this.projection.createTileMatrix(this,t,e)}calculateDistanceTileData(t){const i=t.key,r=this._distanceTileDataCache;if(r[i])return r[i];const n=t.canonical,o=1/this.height,s=this.cameraWorldSize,a=s/this.zoomScale(n.z),l=(n.x+Math.pow(2,n.z)*t.wrap)*a,c=n.y*a,h=this.point;h.x*=s/this.worldSize,h.y*=s/this.worldSize;const u=this.angle,d=Math.sin(-u),p=-Math.cos(-u);return r[i]={bearing:[d,p],center:[(h.x-l)*o,(h.y-c)*o],scale:a/e.al*o},r[i]}calculateFogTileMatrix(t){const i=t.key,r=this._fogTileMatrixCache;if(r[i])return r[i];const n=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,t);return e.aB(n,this.worldToFogMatrix,n),r[i]=new Float32Array(n),r[i]}calculateProjMatrix(t,i=!1,r=!1){const n=t.key;let o;if(o=r?this._expandedProjMatrixCache:i?this._alignedProjMatrixCache:this._projMatrixCache,o[n])return o[n];const s=this.calculatePosMatrix(t,this.worldSize);let a;return a=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:r?this.expandedFarZProjMatrix:i?this.alignedProjMatrix:this.projMatrix,e.aB(s,a,s),o[n]=new Float32Array(s),o[n]}calculatePixelsToTileUnitsMatrix(t){const i=t.tileID.key,r=this._pixelsToTileUnitsCache;if(r[i])return r[i];const n=e.cN(t,this);return r[i]=n,r[i]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if("globe"===this.projection.name){const t=1/this.worldSize,i=e.bq([],[t,t,t]);return e.aB(i,i,this.globeMatrix),i}}recenterOnTerrain(){if(!this._elevation||"globe"===this.projection.name)return;const t=this._elevation;this._updateCameraState();const i=e.cf(1,this._center.lat)*this.worldSize,r=this._computeCameraPosition(i),n=this._camera.forward(),o=e.cf(1,this._center.lat);r[2]/=o,n[2]/=o,e.aw(n,n);const s=t.raycast(r,n,t.exaggeration());if(s){const t=e.bH([],r,n,s),i=new e.ae(t[0],t[1],e.cf(t[2],e.a$(t[1]))),a=(i.z+e.ag([i.x-r[0],i.y-r[1],i.z-r[2]*o]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(a),this._centerAltitude=i.toAltitude(),this._center=this.coordinateLocation(i),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(t=!1){if(!this._elevation)return;const i=this._elevation,r=e.cf(1,this._center.lat)*this.worldSize,n=this._computeCameraPosition(r),o=i.getAtPointOrZero(new e.ae(...n)),s=this.pixelsPerMeter/this.worldSize*o,a=this._minimumHeightOverTerrain(),l=n[2]-s;if(l<=a)if(l<0||t){const t=this.locationCoordinate(this._center,this._centerAltitude),i=[n[0],n[1],t.z-n[2]],r=e.ag(i);i[2]-=(a-l)/this._pixelsPerMercatorPixel;const o=e.ag(i);if(0===o)return;e.c5(i,i,r/o*this._pixelsPerMercatorPixel),this._camera.position=[n[0],n[1],t.z*this._pixelsPerMercatorPixel-i[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t="globe"===this.projection.name||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||t){const i=this.center;return i.lat=e.aA(i.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!t)&&(i.lng=e.aA(i.lng,this.minLng,this.maxLng)),this.center=i,void(this._constraining=!1)}const i=this._unmodified,{x:r,y:n}=this.point;let o=0,s=r,a=n;const l=this.width/2,c=this.height/2,h=this.worldMinY*this.scale,u=this.worldMaxY*this.scale;if(n-c<h&&(a=h+c),n+c>u&&(a=u-c),u-h<this.height&&(o=Math.max(o,this.height/(u-h)),a=(u+h)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const e=this.worldMinX*this.scale,t=this.worldMaxX*this.scale,i=this.worldSize/2-(e+t)/2;s=(r+i+this.worldSize)%this.worldSize-i,s-l<e&&(s=e+l),s+l>t&&(s=t-l),t-e<this.width&&(o=Math.max(o,this.width/(t-e)),s=(t+e)/2)}s===r&&a===n||this._allowWorldUnderZoom||(this.center=this.unproject(new e.P(s,a))),o&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(o)),this._constrainCamera(),this._unmodified=i,this._constraining=!1}_minZoomForBounds(){let e=Math.max(0,this.scaleZoom(Math.max(0,this.height)/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(e=Math.max(e,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),e}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}
2_calcMatrices(){if(!this.height)return;const t=this.centerOffset,i="globe"===this.projection.name,r=this.pixelsPerMeter;"globe"===this.projection.name&&(this._mercatorScaleRatio=e.cf(1,this.center.lat)/e.cf(1,e.d2));const n=e.cO(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,n),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const o="meters"===this.projection.zAxisUnit?r:1,s=this._camera.getWorldToCamera(this.worldSize,o);let a;const l=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(l[8]=2*-t.x/this.width,l[9]=2*t.y/this.height,this.isOrthographic){let i=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),r=i*this.aspect,n=-r,o=-i;r-=t.x,n-=t.x,i+=t.y,o+=t.y,a=this._camera.getCameraToClipOrthographic(n,r,o,i,this._nearZ,this._farZ),((t,i,r,n)=>{for(let o=0;o<16;o++)t[o]=e.ak(i[o],r[o],n)})(a,a,l,e.d0(this.pitch>=ar?1:this.pitch/ar))}else a=l;const c=e.cP([],l,s);let h=e.cP([],a,s);if(this.projection.isReprojectedInTileSpace){const t=this.locationCoordinate(this.center),i=e.bA([]);e.br(i,i,[t.x*this.worldSize,t.y*this.worldSize,0]),e.aB(i,i,e.cQ(this)),e.br(i,i,[-t.x*this.worldSize,-t.y*this.worldSize,0]),e.aB(h,h,i),e.aB(c,c,i),this.inverseAdjustmentMatrix=e.cR(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=e.cS([],h,[this.worldSize,this.worldSize,this.worldSize/o,1]),this.projMatrix=h,this.invProjMatrix=e.bl(new Float64Array(16),this.projMatrix),i){const i=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);i[8]=2*-t.x/this.width,i[9]=2*t.y/this.height,this.expandedFarZProjMatrix=e.cP([],i,s)}else this.expandedFarZProjMatrix=this.projMatrix;const u=e.bl([],a);this.frustumCorners=e.cT.fromInvProjectionMatrix(u,this.horizonLineFromTop(),this.height),this.cameraFrustum=e.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!i);const d=new Float32Array(16);e.bA(d),e.cS(d,d,[1,-1,1]),e.cU(d,d,this._pitch),e.bB(d,d,this.angle);const p=e.cd(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=e.bz(p);const f=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;p[8]=2*-t.x/this.width,p[9]=2*(t.y+f)/this.height,this.skyboxMatrix=e.aB(d,p,d);const m=this.point,_=m.x,g=m.y,y=this.width%2/2,x=this.height%2/2,v=Math.cos(this.angle),b=Math.sin(this.angle),w=_-Math.round(_)+v*y+b*x,T=g-Math.round(g)+v*x+b*y,S=new Float64Array(h);if(e.br(S,S,[w>.5?w-1:w,T>.5?T-1:T,0]),this.alignedProjMatrix=S,h=e.bC(),e.cS(h,h,[this.width/2,-this.height/2,1]),e.br(h,h,[1,-1,0]),this.labelPlaneMatrix=h,h=e.bC(),e.cS(h,h,[1,-1,1]),e.br(h,h,[-1,-1,0]),e.cS(h,h,[2/this.width,2/this.height,1]),this.glCoordMatrix=h,this.pixelMatrix=e.aB(new Float64Array(16),this.labelPlaneMatrix,c),this._calcFogMatrices(),this._distanceTileDataCache={},h=e.bl(new Float64Array(16),this.pixelMatrix),!h)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=h,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=e.cV(this);const t=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=e.af(t,t,s),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=h;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,i=this.cameraPixelsPerMeter,r=this._camera.position,n=1/this.height/this._pixelsPerMercatorPixel,o=[t,t,i];e.c5(o,o,n),e.c5(r,r,-1),e.cW(r,r,o);const s=e.bC();e.br(s,s,r),e.cS(s,s,o),this.mercatorFogMatrix=s,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,i,n)}_computeCameraPosition(e){const t=(e=e||this.pixelsPerMeter)/this.pixelsPerMeter,i=this._camera.forward(),r=this.point,n=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*t-e/this.worldSize*this._centerAltitude;return[r.x/this.worldSize-i[0]*n,r.y/this.worldSize-i[1]*n,e/this.worldSize*this._centerAltitude-i[2]*n]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const i=this._maxCameraBoundsDistance()*Math.cos(this._pitch),r=this._camera.position[2],n=t[2];let o=1;this.projection.wrap&&(this.center=this.center.wrap()),n>
20&&(o=Math.min((i-r)/n,1)),this._camera.position=e.bH([],this._camera.position,t,o),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,i=this._camera.forward(),{pitch:r,bearing:n}=this._camera.getPitchBearing(),o=e.cf(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,s=this._mercatorZfromZoom(this._maxZoom)*Math.cos(e.an(this._maxPitch)),a=Math.max((t[2]-o)/Math.cos(r),s),l=this._zoomFromMercatorZ(a);e.bH(t,t,i,a),this._pitch=e.aA(r,e.an(this.minPitch),e.an(this.maxPitch)),this.angle=e.bT(n,-Math.PI,Math.PI),this._setZoom(e.aA(l,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new e.ae(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(e){return Math.pow(2,e)*this.tileSize}_mercatorZfromZoom(e){return this.cameraToCenterDistance/this._worldSizeFromZoom(e)}_minimumHeightOverTerrain(){const e=Math.min(null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(e)}_zoomFromMercatorZ(e){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,e)*this.tileSize))}zoomFromMercatorZAdjusted(t){let i=0,r=e.cL,n=0,o=1/0;for(;r-i>1e-6&&r>i;){const e=i+.5*(r-i),s=this.tileSize*Math.pow(2,e),a=this.getCameraToCenterDistance(this.projection,e,s),l=this.scaleZoom(a/(Math.max(0,t)*this.tileSize)),c=Math.abs(e-l);c<o&&(o=c,n=e),e<l?i=e:r=e}return n}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(e.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(t,i){const r=Math.min(t.x,i.x),n=Math.max(t.x,i.x),o=Math.min(t.y,i.y),s=Math.max(t.y,i.y);if(o<this.horizonLineFromTop(!1))return!0;if("mercator"!==this.projection.name)return!1;const a=[new e.P(r,o),new e.P(n,s),new e.P(r,s),new e.P(n,o)],l=this.renderWorldCopies?-3:0,c=this.renderWorldCopies?4:1;for(const e of a){const t=this.pointRayIntersection(e);if(t.t<0)return!0;const i=this.rayIntersectionCoordinate(t);if(i.x<l||i.y<0||i.x>c||i.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+e.cX(this.fovAboveCenter)>88||this.anyCornerOffEdge(new e.P(0,0),new e.P(this.width,this.height))}zoomDeltaToMovement(t,i){const r=e.ag(e.av([],this._camera.position,t)),n=this._zoomFromMercatorZ(r)+i;return r-this._mercatorZfromZoom(n)}getCameraPoint(){if("globe"===this.projection.name){const t=function([t,i,r],n){const o=[t,i,r,1];e.aC(o,o,n);const s=o[3]=Math.max(o[3],1e-6);return o[0]/=s,o[1]/=s,o[2]/=s,o}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new e.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(0,t))}}getCameraToCenterDistance(t,i=this.zoom,r=this.worldSize){const n=e.cO(t,i,this.width,this.height,1024),o=t.pixelSpaceConversion(this.center.lat,r,n);let s=.5/Math.tan(.5*this._fov)*this.height*o;return this.isOrthographic&&(s=e.ak(1,s,e.d0(this.pitch>=ar?1:this.pitch/ar))),s}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&e.aB(t,t,this.globeMatrix),t}getFrustum(t){return e.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,"meters"===this.projection.zAxisUnit)}}const cr=(t,i)=>{if(i>0&&t.terrain&&e.w("Cutoff is currently disabled on terrain"),i<=0||t.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const r=t.transform,n=Math.max(Math.abs(r._zoom-(t.minCutoffZoom-1)),1),o=r.isLODDisabled(!1)?e.ah(60,45,r.pitch):e.ah(30,15,r.pitch),s=r._farZ-r._nearZ,a=i*r.height,l=((1-(c=o))*r.cameraToCenterDistance+c*(r._farZ+a))*n;var c;return{shouldRenderCutoff:o<1,uniformValues:{u_cutoff_params:[r._nearZ,r._farZ,(l-r._nearZ)/s,(l-a-r._nearZ)/s]}}},hr=2048;class ur{constructor(e,t){this.aabb=e,this.lastCascade=t}}class dr{add(e,t){const i=this.receivers[e.key];void 0!==i?(i.aabb.min[0]=Math.min(i.aabb.min[0],t.min[0]),i.aabb.min[1]=Math.min(i.aabb.min[1],t.min[1]),i.aabb.min[2]=Math.min(i.aabb.min[2],t.min[2]),i.aabb.max[0]=Math.max(i.aabb.max[0],t.max[0]),i.aabb.max[1]=Math.max(i.aabb.max[1],t.max[1]),i.aabb.max[2]=Math.max(i.aabb.max[2],t.max[2])):this.receivers[e.key]=new ur(t,null)}clear(){this.receivers={}}get(e){return this.receivers[e.key]}computeRequiredCascades(t,i,r){const n=e.d9.fromPoints(t.points);let o=0;for(const s in this.receivers){const t=this.receivers[s];if(!t)continue;if(!n.intersectsAabb(t.aabb))continue;t.aabb.min=n.closestPoint(t.aabb.min),t.aabb.max=n.closestPoint(t.aabb.max);const a=t.aabb.getCorners();for(let n=0;n<r.length;n++){let s=!0;for(const t of a){const o=[t[0]*i,t[1]*i,t[2]];if(e.af(o,o,r[n].matrix),o[0]<-1||o[0]>1||o[1]<-1||o[1]>1){s=!1;break}}if(t.lastCascade=n,o=Math.max(o,n),s)break}}return o+1}}class pr{constructor(e){this.painter=e,this._enabled=!1,this._drawShadowAfterLayer=-1,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new dr,this._depthMode=new Wi(e.context.gl.LEQUAL,Wi.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1}destroy(){for(const e of this._cascades)e.texture.destroy(),e.framebuffer.destroy();this._cascades=[]}updateShadowParameters(t,i){const r=this.painter;if(this._enabled=!1,this._drawShadowAfterLayer=-1,this._receivers.clear(),!i||!i.properties)return;const n=i.properties.get("shadow-intensity"),o=i.properties.get("shadow-draw-before-layer");if(!i.shadowsEnabled()||n<=0)return;let s=-1,a=0;for(const e of r.style.order){const i=r.style._mergedLayers[e];i.hasShadowPass()&&!i.isHidden(t.zoom)&&(s=a),o&&o===e&&(this._drawShadowAfterLayer=a>0?a-1:0),a+=1}if(this._enabled=s>=0,!this.enabled)return;this._drawShadowAfterLayer<0&&(this._drawShadowAfterLayer=s);const l=r.context,c=hr,h=hr;if(0===this._cascades.length||hr!==this._cascades[0].texture.size[0]){this._cascades=[];for(let t=0;t<2;++t){const t=r._shadowMapDebug,i=l.gl,n=l.createFramebuffer(c,h,t?1:0,"texture"),o=new e.T(l,{width:c,height:h,data:null},i.DEPTH_COMPONENT16);if(n.depthAttachment.set(o.texture),t){const t=new e.T(l,{width:c,height:h,data:null},i.RGBA8);n.colorAttachment0.set(t.texture)}this._cascades.push({framebuffer:n,texture:o,matrix:[],far:0,boundingSphereRadius:0,frustum:new e.cB,scale:0})}}this.shadowDirection=mr(i);let u=0;if(t.elevation){const e=t.elevation,i=[1e4,-1e4];e.visibleDemTiles.filter(e=>
vendor: 4,110 bytes, line 2
2e.dem).forEach(e=>{const t=e.dem.tree;i[0]=Math.min(i[0],t.minimums[0]),i[1]=Math.max(i[1],t.maximums[0])}),1e4!==i[0]&&(u=(i[1]-i[0])*e.exaggeration())}const d=1.5*t.cameraToCenterDistance,p=3*d,f=new Float64Array(16);for(let g=0;g<this._cascades.length;++g){const i=this._cascades[g];let r=t.height/50,n=1;0===g?n=d:(r=d,n=p);const[o,s]=gr(t,this.shadowDirection,r,n,hr,u);i.scale=t.scale,i.matrix=o,i.boundingSphereRadius=s,e.bl(f,i.matrix),i.frustum=e.cB.fromInvProjectionMatrix(f,1,0,!0),i.far=n}const m=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[m].far,this._cascades[m].far],this._uniformValues.u_shadow_intensity=n,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=.00048828125,this._uniformValues.u_shadow_map_resolution=hr,this._uniformValues.u_shadowmap_0=11,this._uniformValues.u_shadowmap_1=12,this._groundShadowTiles=r.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const _=r.transform.elevation;for(const e of this._groundShadowTiles){let t={min:0,max:0};if(_){const i=_.getMinMaxForTile(e);i&&(t=i)}this.addShadowReceiver(e.toUnwrapped(),t.min,t.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(e){this._enabled=e}drawShadowPass(t,i){if(!this.enabled)return;const r=this.painter,n=r.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(r.transform.getFrustum(0),r.transform.worldSize,this._cascades),n.viewport.set([0,0,hr,hr]);for(let o=0;o<this._numCascadesToRender;++o){r.currentShadowCascade=o,n.bindFramebuffer.set(this._cascades[o].framebuffer.framebuffer),n.clear({color:e.ao.white,depth:1});for(const e of t.order){const n=t._mergedLayers[e];if(!n.hasShadowPass()||n.isHidden(r.transform.zoom))continue;const o=t.getLayerSourceCache(n),s=o?i[o.id]:void 0;("model"===n.type||s&&s.length)&&r.renderLayer(r,o,n,s)}}r.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const e=this.painter,t=e.style,i=e.context,r=i.gl,n=t.directionalLight,o=t.ambientLight;if(!n||!o)return;const s=[],a=cr(e,e.longestCutoffRange);a.shouldRenderCutoff&&s.push("RENDER_CUTOFF"),s.push("RENDER_SHADOWS","DEPTH_TEXTURE"),this.useNormalOffset&&s.push("NORMAL_OFFSET");const l=_r(t,n,o),c=new Wi(r.LEQUAL,Wi.ReadOnly,e.depthRangeFor3D),h=new Yi({func:r.EQUAL,mask:255},0,255,r.KEEP,r.KEEP,r.KEEP);for(const u of this._groundShadowTiles){const t=u.toUnwrapped(),n=e.isTileAffectedByFog(u),o=e.getOrCreateProgram("groundShadow",{defines:s,overrideFog:n});this.setupShadows(t,o),e.uploadCommonUniforms(i,o,t,null,a);const d=or(e.transform.calculateProjMatrix(t),l);o.draw(e,r.TRIANGLES,c,h,Zi.multiply,Qi.disabled,d,"ground_shadow",e.tileExtentBuffer,e.quadTriangleIndexBuffer,e.tileExtentSegments,null,e.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?Zi.unblended:Zi.disabled}getShadowPassDepthMode(){return this._depthMode}getGroundShadowLayerIndex(){return this._drawShadowAfterLayer}calculateShadowPassMatrixFromTile(t){const i=this.painter.transform,r=i.calculatePosMatrix(t,i.worldSize);return e.aB(r,this._cascades[this.painter.currentShadowCascade].matrix,r),Float32Array.from(r)}calculateShadowPassMatrixFromMatrix(t){const i=e.bz(t);return e.aB(i,this._cascades[this.painter.currentShadowCascade].matrix,t),i}setupShadows(t,i,r){if(!this.enabled)return;const n=this.painter.transform,o=this.painter.context,s=o.gl,a=this._uniformValues,l=new Float64Array(16),c=n.calculatePosMatrix(t,n.worldSize);for(let h=0;h<this._cascades.length;h++)e.aB(l,this._cascades[h].matrix,c),a[0===h?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(l),o.activeTexture.set(s.TEXTURE0+11+h),this._cascades[h].texture.bindExtraParam(s.LINEAR,s.LINEAR,s.CLAMP_TO_EDGE,s.CLAMP_TO_EDGE,s.GREATER);if(this.useNormalOffset=!!r,this.useNormalOffset){const i=e.d7(t.canonical),o=2/n.tileSize*e.al/hr,s=o*this._cascades[0].boundingSphereRadius,l=o*this._cascades[this._cascades.length-1].boundingSphereRadius,c=("vector-tile"===r?1:3)*function(t){const i=e.aA((t-22)/-22,0,1
2);return.125*(1-i)+4*i}(n.zoom);a.u_shadow_normal_offset=[i,s*c,l*c],a.u_shadow_bias=[1e-4,.0012,.012]}else a.u_shadow_bias=[36e-5,.0012,.012];i.setShadowUniformValues(o,a)}setupShadowsFromMatrix(t,i,r=!1){if(!this.enabled)return;const n=this.painter.context,o=n.gl,s=this._uniformValues,a=new Float64Array(16);for(let l=0;l<2;l++)e.aB(a,this._cascades[l].matrix,t),s[0===l?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(a),n.activeTexture.set(o.TEXTURE0+11+l),this._cascades[l].texture.bindExtraParam(o.LINEAR,o.LINEAR,o.CLAMP_TO_EDGE,o.CLAMP_TO_EDGE,o.GREATER);this.useNormalOffset=r,r?(s.u_shadow_normal_offset=[1,3,3],s.u_shadow_bias=[6e-5,.0012,.012]):s.u_shadow_bias=[36e-5,.0012,.012],i.setShadowUniformValues(n,s)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(t,i,r,n){if(n[2]>=0)return{};const o=function(t,i,r){const n=r/(1<<t.canonical.z);return new e.d9([t.canonical.x*n+t.wrap*r,t.canonical.y*n+t.wrap*r,0],[(t.canonical.x+1)*n+t.wrap*r,(t.canonical.y+1)*n+t.wrap*r,i])}(t,i,r).getCorners(),s=i/-n[2];n[0]<0?(e.d8(o[0],o[0],[n[0]*s,0,0]),e.d8(o[3],o[3],[n[0]*s,0,0])):n[0]>0&&(e.d8(o[1],o[1],[n[0]*s,0,0]),e.d8(o[2],o[2],[n[0]*s,0,0])),n[1]<0?(e.d8(o[0],o[0],[0,n[1]*s,0]),e.d8(o[1],o[1],[0,n[1]*s,0])):n[1]>0&&(e.d8(o[2],o[2],[0,n[1]*s,0]),e.d8(o[3],o[3],[0,n[1]*s,0]));const a={};return a.vertices=o,a.planes=[fr(o[1],o[0],o[4]),fr(o[2],o[1],o[5]),fr(o[3],o[2],o[6]),fr(o[0],o[3],o[7])],a}addShadowReceiver(t,i,r){this._receivers.add(t,e.d9.fromTileIdAndHeight(t,i,r))}getMaxCascadeForTile(e){const t=this._receivers.get(e);return t&&t.lastCascade?t.lastCascade:0}}function fr(t,i,r){const n=e.av([],r,i),o=e.av([],t,i),s=e.bI([],n,o),a=e.ag(s);return 0===a?[0,0,1,0]:(e.c5(s,s,1/a),[s[0],s[1],s[2],-e.bJ(s,i)])}function mr(t){const i=t.properties.get("direction"),r=e.d4(i.x,i.y,i.z);r[2]=e.aA(r[2],0,75);const n=e.d6([r[0],r[1],r[2]]);return e.d5(n.x,n.y,n.z)}function _r(t,i,r){const n="none"===i.properties.get("color-use-theme"),o=i.properties.get("color"),s=i.properties.get("intensity"),a=i.properties.get("direction"),l=[a.x,a.y,a.z],c="none"===r.properties.get("color-use-theme"),h=r.properties.get("color"),u=r.properties.get("intensity"),d=Math.max(e.bJ([0,0,1],l),0),p=[0,0,0];e.c5(p,h.toPremultipliedRenderColor(c?null:t.getLut(i.scope)).toArray01Linear().slice(0,3),u);const f=[0,0,0];return e.c5(f,o.toPremultipliedRenderColor(n?null:t.getLut(r.scope)).toArray01Linear().slice(0,3),d*s),e.db([p[0]>0?p[0]/(p[0]+f[0]):0,p[1]>0?p[1]/(p[1]+f[1]):0,p[2]>0?p[2]/(p[2]+f[2]):0])}function gr(t,i,r,n,o,s){const a=t.zoom,l=t.scale,c=t.worldSize,h=1/c,u=t.aspect,d=Math.sqrt(1+u*u)*Math.tan(.5*t.fovX),p=d*d,f=n-r,m=n+r;let _,g;p>f/m?(_=n,g=n*d):(_=.5*m*(1+p),g=.5*Math.sqrt(f*f+2*(n*n+r*r)*p+m*m*p*p));const y=t.projection.pixelsPerMeter(t.center.lat,c),x=t._camera.getCameraToWorldMercator(),v=[0,0,-_*h];e.af(v,v,x);let b=g*h;const w=function(i){return i[0]/=l,i[1]/=l,i[2]=e.cf(i[2],t._center.lat),i},T=t._edgeInsets;if(!(0===T.left&&0===T.top&&0===T.right&&0===T.bottom||T.left===T.right&&T.top===T.bottom)){const i=t._camera.getWorldToCamera(t.worldSize,"meters"===t.projection.zAxisUnit?y:1),o=t._camera.getCameraToClipPerspective(t._fov,t.width/t.height,r,n);o[8]=2*-t.centerOffset.x/t.width,o[9]=2*t.centerOffset.y/t.height;const s=new Float64Array(16);e.cP(s,o,i);const l=new Float64Array(16);e.bl(l,s);const h=e.cB.fromInvProjectionMatrix(l,c,a,!0);for(const t of h.points){const i=w(t);b=Math.max(b,e.c6(e.da([],v,i)))}}b*=o/(o-1);const S=Math.acos(i[2]),E=Math.atan2(-i[0],-i[1]),I=new nr;I.position=v,I.setPitchBearing(S,E);const A=I.getWorldToCamera(c,y),M=b*c,C=Math.min(t._mercatorZfromZoom(17)*c*-2,-2*M),P=I.getCameraToClipOrthographic(-M,M,-M,M,C,(M+s*y)/i[2]),R=new Float64Array(16);e.aB(R,P,A);const z=e.d5(Math.floor(1e6*v[0])/1e6*c,Math.floor(1e6*v[1])/1e6*c,0),L=.5*o,D=[0,0,0];e.af(D,z,R),e.c5(D,D,L);const O=[Math.floor(D[0]),Math.floor(D[1]),Math.floor(D[2])],F=[0,0,0];e.av(F,D,O),e.c5(F,F,-1/L);const k=new Float64Array(16);return e.bA(k),e.br(k,k,F),e.aB(R,k,R),[R,M]}class yr extends e.E{constructor(e){super(),this.requestManager=e,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(t,i){return e.dc(this.requestManager.transformRequest(i,e.R.Model).url).then(r=>{if(!r)return;const n=e.dd(r),o=new e.de(t,i,void 0,void 0,n);return o.computeBoundsAndApplyParent(),o}
2).catch(r=>{if(r&&404===r.status)return null;this.fire(new e.y(new Error(`Could not load model ${t} from ${i}: ${r.message}`)))})}load(t,i,r={forceReload:!1}){this.models[i]||(this.models[i]={});const n=Object.keys(t),o=[],s=[];for(const e of n){const n=t[e];this.hasURLBeenRequested(n)&&!r.forceReload||(this.modelByURL[n]={modelId:e,scope:i},o.push(this.loadModel(e,n)),s.push(e)),this.models[i][e]||(this.models[i][e]={model:null,numReferences:1})}this.numModelsLoading[i]=(this.numModelsLoading[i]||0)+s.length,Promise.allSettled(o).then(t=>{for(let e=0;e<t.length;e++){const{status:r}=t[e];if("rejected"===r)continue;const{value:n}=t[e];this.models[i][s[e]]||(this.models[i][s[e]]={model:null,numReferences:1}),this.models[i][s[e]].model=n}this.numModelsLoading[i]-=s.length,this.fire(new e.z("data",{dataType:"style"}))}).catch(t=>{this.fire(new e.y(new Error(`Could not load models: ${t.message}`)))})}isLoaded(){for(const e in this.numModelsLoading)if(this.numModelsLoading[e]>0)return!1;return!0}hasModel(e,t,i={exactIdMatch:!1}){return!!(i.exactIdMatch?this.getModel(e,t):this.getModelByURL(this.modelUris[t][e]))}getModel(e,t){return this.models[t]||(this.models[t]={}),this.models[t][e]?this.models[t][e].model:void 0}getModelByURL(e){if(!e)return null;const t=this.modelByURL[e];return t?this.models[t.scope][t.modelId].model:null}hasModelBeenAdded(e,t){return this.models[t]&&void 0!==this.models[t][e]}getModelURIs(e){return this.modelUris[e]||{}}addModel(e,t,i){this.models[i]||(this.models[i]={}),this.modelUris[i]||(this.modelUris[i]={});const r=this.requestManager.normalizeModelURL(t);if((this.hasModel(e,i,{exactIdMatch:!0})||this.hasModelBeenAdded(e,i))&&this.modelUris[i][e]===r)this.models[i][e].numReferences++;else if(this.hasURLBeenRequested(r)){const{scope:e,modelId:t}=this.modelByURL[r];this.models[e][t].numReferences++}else this.modelUris[i][e]=r,this.load({[e]:this.modelUris[i][e]},i)}addModelURLs(e,t){this.models[t]||(this.models[t]={}),this.modelUris[t]||(this.modelUris[t]={});const i=this.modelUris[t];for(const r in e)i[r]=this.requestManager.normalizeModelURL(e[r])}reloadModels(e){this.load(this.modelUris[e],e,{forceReload:!0})}addModelsFromBucket(t,i){this.models[i]||(this.models[i]={}),this.modelUris[i]||(this.modelUris[i]={});const r={};for(const n of t)this.hasModel(n,i,{exactIdMatch:!0})||this.hasURLBeenRequested(n)?this.models[i][n].numReferences++:this.modelUris[i][n]&&!this.hasURLBeenRequested(n)?r[n]=this.modelUris[i][n]:!this.hasURLBeenRequested(n)&&e.df(n,!1)&&(this.modelUris[i][n]=this.requestManager.normalizeModelURL(n),r[n]=this.modelUris[i][n]);this.load(r,i)}hasURLBeenRequested(e){return void 0!==this.modelByURL[e]}removeModel(e,t,i=!1,r=!1){if(this.models[t]&&this.models[t][e]&&(this.models[t][e].numReferences--,0===this.models[t][e].numReferences||r)){const r=this.modelUris[t][e];i||delete this.modelUris[t][e],delete this.modelByURL[r];const n=this.models[t][e].model;if(!n)return;delete this.models[t][e],n.destroy()}}destroy(){for(const e of Object.keys(this.models))for(const t of Object.keys(this.models[e])){const i=this.models[e][t].model;delete this.models[e][t],i&&i.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(e){return this.models[e]||(this.models[e]={}),Object.keys(this.models[e])}upload(e,t){this.models[t]||(this.models[t]={});for(const i in this.models[t])this.models[t][i].model&&this.models[t][i].model.upload(e.context)}}const xr=e.a6.colorTheme,vr=new e.a9({data:new e.aa(xr.data)});function br(t){if(!t.metadata||!t.metadata.content_area)return;const i=e.o.devicePixelRatio,{left:r,top:n,width:o,height:s}=t.metadata.content_area,a=r*i,l=n*i;return[a,l,a+o*i,l+s*i]}function wr(t){if(t)return t.map(([t,i])=>[t*e.o.devicePixelRatio,i*e.o.devicePixelRatio])}class Tr{constructor(e,t,i){this.id=e,this.scope=t,this.sourceCache=i,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(e){this.missingRequests.has(e.name)||this.pendingRequests.has(e.name)||this.pendingRequests.add(e.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const t=new Map;if(!this.sourceCache.loaded())return t;const i=this.sourceCache.getVisibleCoordinates();if(0===i.length)return t;const r=this.sourceCache.getSource();if(!(r instanceof ft))return t;const n=i.map(e=>this.sourceCache.getTile(e)),o=r.getImages(n,Array.from(this.pendingRequests));for(const[s,a]of o)t.set(e.I.from({name:s,iconsetId:this.id}),a),this.pendingRequests.delete(s);for(const e of this.pendingRequests)this.missingRequests.add(e);return this.pendingRequests.clear(),t}}class Sr{constructor(){e.aY(["_onIndoorUpdate"],this)}onAdd(e){return this._map=e,this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.style&&this._map.style.indoorManager.on("selector-update",e=>this._onIndoorUpdate(e)),this._container}_createButton(e,t){const i=l("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}_createSeparator(){return l("div","mapboxgl-ctrl-separator",this._container)}_setButtonTitle(e,t){this._map&&(e.setAttribute("aria-label",t),e.textContent=t)}onRemove(){this._container&&this._container.remove(),this._map&&this._map.style&&(this._map.style.indoorManager.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"right"}_onIndoorUpdate(e){if(!e||!e.floors)return this._model=e,void(this._container.style.display="none");const t=this._model;this._model=e,this._container.style.display="inline-block",this._container.style.borderRadius="8px",t&&Array.from(this._container.children).forEac
2h(e=>e.remove()),e.floors.length>0&&(this.addBuildingsToggleButton(),this.addCurrentFloors(e.floors,e.activeFloorsVisible),this._updateBuildingsButtonState())}addBuildingsToggleButton(){const e=this._createButton("mapboxgl-ctrl-buildings-toggle",()=>{const e=this._map;this._model&&e&&e._setIndoorActiveFloorsVisibility(!this._model.activeFloorsVisible)});l("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.classList.add("mapboxgl-ctrl-level-button","mapboxgl-ctrl-buildings-toggle"),this._model&&!this._model.activeFloorsVisible&&e.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(e),this._createSeparator()}_updateBuildingsButtonState(){const e=this._container.querySelector(".mapboxgl-ctrl-buildings-toggle");e&&this._model&&(this._model.activeFloorsVisible?e.classList.remove("mapboxgl-ctrl-level-button-selected"):e.classList.add("mapboxgl-ctrl-level-button-selected"))}addCurrentFloors(e,t){for(let i=0;i<e.length;i++){const r=e[i],n=this._createButton("mapboxgl-ctrl-level-button",()=>{this._map._selectIndoorFloor(r.id)}),o=(r.name||"").trim(),s=r.zIndex.toString(),a=o?Array.from(o).slice(0,3).join(""):s;this._setButtonTitle(n,a),this._model&&r.id===this._model.selectedFloorId&&t&&n.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(n),i<e.length-1&&this._createSeparator()}}}class Er extends e.E{constructor(t){super(),this._style=t,this._buildings={},this._indoorControl=null,this._activeFloors=new Set,this._activeFloorsVisible=!0,this._indoorState={selectedFloorId:null,lastActiveFloors:null,activeFloorsVisible:!0},e.aY(["_updateUI"],this),this._style.on("style.load",()=>{this._style.isIndoorEnabled()&&(this._style.map.on("load",this._updateUI),this._style.map.on("move",this._updateUI),this._style.map.on("idle",this._updateUI),this._updateUI())})}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null,this._removeIndoorControl()}selectFloor(e){e===this._selectedFloorId&&this._activeFloorsVisible||(this._selectedFloorId=e,this._activeFloorsVisible=!0,this._updateActiveFloors())}setActiveFloorsVisibility(e){this._activeFloorsVisible=e,this._updateActiveFloors(),this._updateIndoorSelector()}setIndoorData(e){for(const[t,i]of Object.entries(e.buildings))if(this._buildings[t])for(const e of i.floorIds)this._buildings[t].floors[e]||(this._buildings[t].floors[e]=i.floors[e]);else this._buildings[t]=i;for(const t of e.activeFloors)this._activeFloors.add(t);this._updateIndoorSelector()}getIndoorTileOptions(e,t){const i=this._style.getIndoorSourceLayers(e,t);return i&&this._indoorState?{sourceLayers:i,indoorState:this._indoorState}:null}_addIndoorControl(){this._indoorControl||(this._indoorControl=new Sr,this._style.map.addControl(this._indoorControl,"right"))}_removeIndoorControl(){this._indoorControl&&(this._indoorControl.onRemove(),this._indoorControl=null)}_updateUI(){const t=this._style.map.transform,i=function(t,i,r,n){let o=null,s=Number.MAX_SAFE_INTEGER;if(n<16)return null;for(const[a,l]of Object.entries(t)){const t=l.center;if(t){const n=i.distanceTo(e.aT.convert(t));n<s&&r.contains(t)&&(s=n,o=a)}}return o}(this._buildings,t.center,t.getBounds(),t.zoom);i!==this._closestBuildingId&&(this._closestBuildingId=i,this._updateIndoorSelector())}_updateIndoorSelector(){const t=this._buildings,i=this._closestBuildingId,r=i&&t?t[i]:void 0;if(!r)return this._removeIndoorControl(),void this.fire(new e.z("selector-update",{selectedFloorId:null,activeFloorsVisible:this._activeFloorsVisible,floors:[]}));this._addIndoorControl();let n=null;for(const e of r.floorIds)if(this._activeFloors&&this._activeFloors.has(e)){n=e;break}const o=Array.from(r.floorIds).map(e=>({id:e,name:r.floors[e].name,zIndex:r.floors[e].zIndex})).sort((e,t)=>t.zIndex-e.zIndex).filter((e,t,i)=>0===t||e.zIndex!==i[t-1].zIndex);this.fire(new e.z("selector-update",{selectedFloorId:n,activeFloorsVisible:this._activeFloorsVisible,floors:o}))}_updateActiveFloors(){const e=this._activeFloors;this._activeFloors=new Set,this._indoorState={selectedFloorId:this._selectedFloorId,lastActiveFloors:e,activeFloorsVisible:this._activeFloorsVisible},this._style.updateIndoorDependentLayers()}}const Ir=(e,t)=>
2Fe(e,t&&t.filter(e=>"source.canvas"!==e.identifier)),Ar=e.aH(Gt,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setLayerProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),Mr=e.aH(Gt,["setCenter","setZoom","setBearing","setPitch"]),Cr=new Set(["background","sky","slot","custom"]),Pr={version:8,layers:[],sources:{}},Rr={duration:300,delay:0};class zr extends e.E{constructor(t,i={}){super(),this.map=t,this.scope=i.scope||"",this.globalId=null,this.fragments=[],this.importDepth=i.importDepth||0,this.importsCache=i.importsCache||new Map,this.resolvedImports=i.resolvedImports||new Set,this.transition=Object.assign({},Rr),this._buildingIndex=new Vt(this),this.crossTileSymbolIndex=new Hi,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedIndoor={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._hasAppearances=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._importedAsBasemap=!1,this._changes=i.styleChanges||new Z,this._hasDataDrivenEmissive=!1,this.indoorManager=new Er(this),this.dispatcher=i.dispatcher?i.dispatcher:new e.D(e.dh(),this),i.imageManager?this.imageManager=i.imageManager:(this.imageManager=new X(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=i.glyphManager?i.glyphManager:new e.di(t._requestManager,i.localFontFamily?e.dj.all:i.localIdeographFontFamily?e.dj.ideographs:e.dj.none,i.localFontFamily||i.localIdeographFontFamily),i.modelManager?this.modelManager=i.modelManager:(this.modelManager=new yr(t._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=i.configOptions?i.configOptions:new Map,this._configDependentLayers=i.configDependentLayers?i.configDependentLayers:new Set,this._indoorDependentLayers=i.indoorDependentLayers?i.indoorDependentLayers:new Set,this._config=i.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:i.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=i.initialConfig,this.dispatcher.broadcast("setReferrer",e.dk());const r=this;this._rtlTextPluginCallback=zr.registerForPluginStateChange(t=>{r.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:t.pluginStatus,pluginURL:t.pluginURL},(t,i)=>{if(e.dl(t),i&&i.every(e=>e))for(const e in r._sourceCaches){const t=r._sourceCaches[e],i=t.getSource().type;"vector"!==i&&"geojson"!==i||t.reload()}})}),this.on("data",e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const t=this.getOwnSource(e.sourceId);if(t&&t.vectorLayerIds)for(const i in this._layers){const e=this._layers[i];e.source===t.id&&this._validateLayer(e)}})}load(e){return e?("string"==typeof e?this.loadURL(e):this.loadJSON(e),this):this}_getGlobalId(t){if(!t)return null;if("string"==typeof t){if(e.h(t))return t;const i=e.dm(t);if(!i.startsWith("http"))try{return new URL(i,location.href).toString()}catch(e){return i}return i}return`json://${e.dn(JSON.stringify(t))}`}_diffStyle(t,i,r){this.globalId=this._getGlobalId(t);const n=(e,t)=>{try{t(null,this.setState(e,r))}catch(e){t(e,!1)}};if("string"==typeof t){const r=this.map._requestManager.normalizeStyleURL(t),o=this.map._requestManager.transformRequest(r,e.R.Style);e.m(o,(t,r)=>{t?this.fire(new e.y(t)):r&&n(r,i)})}else"object"==typeof t&&n(t,i)}loadURL(t,i={}){this.fire(new e.z("dataloading",{dataType:"style"}));const r="boolean"==typeof i.validate?i.validate:!e.h(t);this.globalId=this._getGlobalId(t),t=this.map._requestManager.normalizeStyleURL(t,i.accessToken),this.resolvedImports.add(t);const n=this.importsCache.get(t);if(n)return this._load(n,r);const o=this.map._requestManager.transformRequest(t,e.R.Style);this._request=e.m(o,(i,n)=>{if(this._request=null,i)this.fire(new e.y(i));else if(n)return this.importsCache.set(t,n),this._load(n,r)})}loadJSON(t,i={}){this.fire(new e.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(t),this._request=e.o.frame(()=>{this._request=null,this._load(t,!1!==i.validate)})}loadEmpty(){this.fire(new e.z("dataloading",{dataType:"style"})),this._load(Pr,!1)}_loadImports(t,i,r){if(this.importDepth>=4)return e.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const n=[];for(const e of t){const t=this._createFragmentStyle(e),o=new Promise(e=>{t.once("style.import.load",e),t.once("error",e)}).then(()=>this.mergeAll());if(n.push(o),this.resolvedImports.has(e.url)){t.loadEmpty();continue}const s=e.data||this.importsCache.get(e.url);s?(t.loadJSON(s,{validate:i}),this._isInternalStyle(s)&&(t.globalId=null)):e.url?t.loadURL(e.url,{validate:i}):t.loadEmpty();const a={style:t,id:e.id,config:e.config};if(r){const e=this.fragments.findIndex(({id:e})=>e===r);this.fragments=this.fragments.slice(0,e).concat(a).concat(this.fragments.slice(e))}else this.fragments.push(a)}return Promise.allSettled(n)}getImportGlobalIds(e=this,t=new Set){for(const i of e.fragments)i.style.globalId&&t.add(i.style.globalId),this.getImportGlobalIds(i.style,t);return[...t.values()]}_createFragmentStyle(t){const i=this.scope?e.B(t.id,this.scope):t.id;let r;const n=this._initialConfig&&this._initialConfig[i];(t.config||n)&&(r=Object.assign({},t.config,n));const o=new zr(this.map,{scope:i,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:r,configOptions:this.options,colorThemeOverride:t["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indo
2orDependentLayers});return o.setEventedParent(this.map,{style:o}),o}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this._updateLayers(this._indoorDependentLayers),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(e){return this.isRootStyle()&&(e.fragment||!!e.schema&&!1!==e.fragment)}_load(t,i){if(this._isInternalStyle(t)){const e=Object.assign({},Pr,{imports:[{id:"basemap",data:t,url:""}]},t.center?{center:t.center}:{},t.bearing?{bearing:t.bearing}:{},t.pitch?{pitch:t.pitch}:{},t.zoom?{zoom:t.zoom}:{},t.light?{light:t.light}:{});return this._importedAsBasemap=!0,void this._load(e,i)}if(this.updateConfig(this._config,t.schema),i&&Ir(this,we(t)))return;this._loaded=!0,this.stylesheet=e.dp(t);const r=()=>{for(const e in t.sources)this.addSource(e,t.sources[e],{validate:!1,isInitialLoad:!0});if(t.iconsets)for(const e in t.iconsets)this.addIconset(e,t.iconsets[e]);t.sprite?this._loadIconset(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&t.glyphs&&this.glyphManager.setURL(t.glyphs);const r=jt(this.stylesheet.layers);if(this._order=r.map(e=>e.id),this.stylesheet.light&&e.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(1===this.stylesheet.lights.length&&"flat"===this.stylesheet.lights[0].type){const e=this.stylesheet.lights[0];this.light=new Ne(e.properties,e.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new Ne(this.stylesheet.light)),this._layers={};for(const t of r){const i=e.du(t,this.scope,this._styleColorTheme.lut,this.options);0!==i.expressionDependencies.configDependencies.size&&this._configDependentLayers.add(i.fqid),i.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(i.fqid),this._hasAppearances=this._hasAppearances||0!==i.getAppearances().length,i.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=i;const r=this.getOwnLayerSourceCache(i),n=!!this.directionalLight&&this.directionalLight.shadowsEnabled();r&&i.canCastShadows()&&n&&(r.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const n=this.stylesheet.terrain;n&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(n,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new e.z("data",{dataType:"style"}));const o=this.isRootStyle();t.imports?this._loadImports(t.imports,i).then(()=>{this._reloadImports(),this.fire(new e.z(o?"style.load":"style.import.load"))}).catch(t=>{this.fire(new e.y(new Error("Failed to load imports",t))),this.fire(new e.z(o?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new e.z(o?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const n=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(n){const t=this._evaluateColorThemeData(n);this._loadColorTheme(t).then(()=>{r()}).catch(t=>{e.w(`Couldn't load color theme from the stylesheet: ${t}`),r()})}else this._styleColorTheme.lut=null,r()}isRootStyle(){return 0===this.importDepth}hasAppearances(){return this._hasAppearances||this.fragments.some(e=>e.style.hasAppearances())}mergeAll(){let e,t,i,r,n,o,s,a,l,c;const h={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(u=>{if(u.stylesheet){if(null!=u.light&&(e=u.light),u.stylesheet.lights)for(const e of u.stylesheet.lights)"ambient"===e.type&&null!=u.ambientLight&&(t=u.ambientLight),"directional"===e.type&&null!=u.directionalLight&&(i=u.directionalLight);r=this._prioritizeTerrain(r,u.terrain,u.stylesheet.terrain),u.stylesheet.fog&&null!=u.fog&&(n=u.fog),u.stylesheet.snow&&null!=u.snow&&(o=u.snow),u.stylesheet.rain&&null!=u.rain&&(s=u.rain),null!=u.stylesheet.camera&&(c=u.stylesheet.camera),null!=u.stylesheet.projection&&(a=u.stylesheet.projection),null!=u.stylesheet.transition&&(l=u.stylesheet.transition),h[u.scope]=u._styleColorTheme}}),this.light=e,this.ambientLight=t,this.directionalLight=i,this.fog=n,this.snow=o,this.rain=s,this._styleColorThemeForScope=h,null===r?delete this.terrain:this.terrain=r,this.camera=c||{"camera-projection":"perspective"},this.projection=a||{name:"mercator"},this.transition=Object.assign({},Rr,l),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}forEachFragmentStyle(e){const t=i=>{for(const e of i.fragments)t(e.style);e(i)};t(this)}_prioritizeTerrain(e,t,i){const r=e&&0===e.drapeRenderMode;return null===i?t&&0===t.drapeRenderMode?t:r?e:null:null!=t&&(!e||r||t&&1===t.drapeRenderMode)?t:e}mergeTerrain(){let e;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(t=>{e=this._prioritizeTerrain(e,t.terrain,t.stylesheet.terrain)}),null===e?delete this.terrain:this.terrain=e}mergeProjection(){let e;this.forEachFragmentStyle(t=>{null!=t.stylesheet.projection&&(e=t.stylesheet.projection)}),this.projection=e||{name:"mercator"}}mergeSources(){const t={},i={},r={};this.forEachFragmentStyle(n=>{for(const i in n._sourceCaches){const r=e.B(i,n.scope);t[r]=n._sourceCaches[i]}for(const t in n._otherSourceCaches){const r=e.B(t,n.scope);i[r]=n._otherSourceCaches[t]}for(const t in n._symbolSourceCaches){const i=e.B(t,n.scope);r[i]=n._symbolSourceCaches[t]}}),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=i,this._mergedSymbolSourceCaches=r}mergeIndoor(){this.forEachFragmentStyle(t=>{if(t.stylesheet&&t.stylesheet.indoor)for(const i of Object.values(t.stylesheet.indoor)){const r=i,n=e.B(r.sourceId,t.scope);this._mergedIndoor[n]=new Set(r.sourceLayers||[])}})}mergeLayers(){const t={},i=[],r={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(r=>{for(const n of r._order){const o=r._layers[n];if("slot"===o.type){const i=e.dq(n);if(t[i])continue;t[i]=[]}o.slot&&t[o.slot]?t[o.slot].push(o):i.push(o)}}),this._mergedOrder=[];let n=-1;const o=(i=[])=>{for(const s of i)if("slot"===s.type){const i=e.dq(s.id);t[i]&&o(t[i]),this._mergedSlots.push(i)}else{const t=e.B(s.id,s.scope);this._mergedOrder.push(t),r[t]=s,s.is3D(!!this.terrain)&&(this._has3DLayers=!0,n=this._mergedOrder.length-1),"circle"===s.type&&(this._hasCircleLayers=!0),"symbol"===s.type&&(this._hasSymbolLayers=!0),"clip"===s.type&&(this._clipLayerPresent=!0)}};if(o(i),this._has3DLayers){const e={};for(let t=0;t<this._mergedOrder.length;++t){const i=this._mergedOrder[t];e[i]=t===n?1:t<n?r[i].hasOcclusionOpacityProperties?2:0:4}this._mergedOrder.sort((t,i)=>e[t]-e[i])}this._mergedLayers=r,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}getCamera(){return this.stylesheet.camera}setCamera(e){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,e),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(t){return t.data?function(t,i,r){const n=Object.assign({},i);for(const e of Object.keys(xr))void 0===n[e]&&(n[e]=xr[e].default);const o=new e.a8(vr,t,new Map(r));return o.setTransitionOrValue(n,r),o.untransitioned().possiblyEvaluate(new e.ac(0,{worldview:void 0}))}(this.scope,t,this.options).get("data"):null}_loadColorTheme(t){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const i=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((r,n)=>{const o="data:image/png;base64,";if(!t||0===t.length)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void r();let s=t;s.startsWith(o)||(s=o+s);const a=e.I.from("mapbox-reserved-lut"),l=new Image;l.src=s,l.onerror=()=>{this._styleColorTheme.lutLoading=!1,n(new Error("Failed to load image data"))},l.onload=()=>
2{if(this._styleColorTheme.lutLoadingCorrelationID!==i)return void r();this._styleColorTheme.lutLoading=!1;const{width:o,height:s,data:c}=e.o.getImageData(l);if(s>32)return void n(new Error("The height of the image must be less than or equal to 32 pixels."));if(o!==s*s)return void n(new Error("The width of the image must be equal to the height squared."));this.getImage(a)&&this.removeImage(a),this.addImage(a,{data:new e.q({width:o,height:s},c),pixelRatio:1,sdf:!1,usvg:!1,version:0});const h=this.imageManager.getImage(a,this.scope);h?(this._styleColorTheme.lut={image:h.data,data:t},r()):n(new Error("Missing LUT image."))}})}getLut(e){const t=this._styleColorThemeForScope[e];return t?t.lut:null}setProjection(e){e?this.stylesheet.projection=e:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(t){this._spriteRequest=function(t,i,r){let n,o,s;const a=e.o.devicePixelRatio>1?"@2x":"";let l=e.m(i.transformRequest(i.normalizeSpriteURL(t,a,".json"),e.R.SpriteJSON),(e,t)=>{l=null,s||(s=e,n=t,h())}),c=e.n(i.transformRequest(i.normalizeSpriteURL(t,a,".png"),e.R.SpriteImage),(e,t)=>{c=null,s||(s=e,o=t,h())});function h(){if(s)r(s);else if(n&&o){const t=e.o.getImageData(o),i={};for(const r in n){const{width:o,height:s,x:a,y:l,sdf:c,pixelRatio:h,stretchX:u,stretchY:d,content:p}=n[r],f=new e.q({width:o,height:s});e.q.copy(t,f,{x:a,y:l},{x:0,y:0},{width:o,height:s},null),i[r]={data:f,pixelRatio:void 0!==h?h:1,sdf:void 0!==c&&c,stretchX:u,stretchY:d,content:p,usvg:!1,version:0}}r(null,i)}}return{cancel(){l&&(l.cancel(),l=null),c&&(c.cancel(),c=null)}}}(t,this.map._requestManager,(t,i)=>{if(this._spriteRequest=null,t)this.fire(new e.y(t));else if(i){const t=new Map;for(const r in i)t.set(e.I.from(r),i[r]);this.addImages(t)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new e.z("data",{dataType:"style"}))})}addIconset(t,i){if("sprite"===i.type)return void this._loadSprite(i.url);const r=this.getOwnSourceCache(i.source);if(!r)return void this.fire(new e.y(new Error(`Source "${i.source}" as specified by iconset "${t}" does not exist and cannot be used as an iconset source`)));const n=r.getSource();if("raster-array"!==n.type)return void this.fire(new e.y(new Error(`Source "${i.source}" as specified by iconset "${t}" is not a "raster-array" source and cannot be used as an iconset source`)));n.partial=!1;const o=new Tr(t,this.scope,r);this.imageManager.addImageProvider(o,this.scope)}removeIconset(e){this.imageManager.removeImageProvider(e,this.scope)}_loadIconset(t){if(!e.h(t)&&"icon_set"!==this.map._spriteFormat||"raster"===this.map._spriteFormat)return void this._loadSprite(t);const i="auto"===this.map._spriteFormat;var r,n;this._spriteRequest=(n=(r,n)=>{if(this._spriteRequest=null,r)i?this._loadSprite(t):this.fire(new e.y(r));else if(n){const t=new Map;for(const i in n)t.set(e.I.from(i),n[i]);this.addImages(t)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new e.z("data",{dataType:"style"}))},e.bu((r=this.map._requestManager).transformRequest(r.normalizeIconsetURL(t),e.R.Iconset),(t,i)=>{if(t)return void n(t);const r={},o=e.dg(new e.bt(i));for(const n of o.icons){const t={version:1,pixelRatio:e.o.devicePixelRatio,content:br(n),stretchX:n.metadata?wr(n.metadata.stretch_x_areas):void 0,stretchY:n.metadata?wr(n.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:n};r[n.name]=t}n(null,r)}))}_validateLayer(t){const i=this.getOwnSource(t.source);if(!i)return;const r=t.sourceLayer;
2r&&("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(r))&&this.fire(new e.y(new Error(`Source layer "${r}" does not exist on source "${i.id}" as specified by style layer "${t.id}"`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const e in this._sourceCaches)if(!this._sourceCaches[e].loaded())return!1;if(!this.imageManager.isLoaded())return!1;if(this.imageManager.hasPatternsInFlight())return!1;if(!this.modelManager.isLoaded())return!1;if(this._styleColorTheme.lutLoading)return!1;for(const{style:e}of this.fragments)if(!e.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((e,t)=>{const i=this.fragments[t];return i&&i.style&&(e.data=i.style.serialize()),e})}_serializeSources(){const e={};for(const t in this._sourceCaches){const i=this._sourceCaches[t].getSource();e[i.id]||(e[i.id]=i.serialize())}return e}_serializeLayers(e){const t=[];for(const i of e){const e=this._layers[i];e&&"custom"!==e.type&&t.push(e.serialize())}return t}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions())return!0;if(this.hasFogTransition())return!0;if(this.hasSnowTransition())return!0;if(this.hasRainTransition())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}_updateDataDrivenEmissiveStrength(){for(const e in this._mergedLayers){const t=this._mergedLayers[e];if(t._transitionablePaint&&t._transitionablePaint._values){const e=t._transitionablePaint._values["line-emissive-strength"];if(e&&e.value&&e.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(e){return e?this.order:this._mergedOrder}isLayerDraped(e){return!!this.terrain&&e.isDraped(this.getLayerSourceCache(e))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(t){const i=this.getOwnLayer(t);if(i)return i;this.fire(new e.y(new Error(`The layer '${t}' does not exist in the map's style.`)))}_checkSource(t){const i=this.getOwnSource(t);if(i)return i;this.fire(new e.y(new Error(`The source '${t}' does not exist in the map's style.`)))}precompilePrograms(e,t){const i=this.map.painter;if(i)for(let r=e.minzoom||0;r<(e.maxzoom||25.5);r++){const r=e.getProgramIds();if(r)for(const n of r){const r=e.getDefaultProgramParams(n,t.zoom,this._styleColorTheme.lut);r&&(i.style=this,this.fog&&(i._fogVisible=!0,r.overrideFog=!0,i.getOrCreateProgram(n,r)),i._fogVisible=!1,r.overrideFog=!1,i.getOrCreateProgram(n,r),(this.stylesheet.terrain||this.stylesheet.projection&&"globe"===this.stylesheet.projection.name)&&(r.overrideRtt=!0,i.getOrCreateProgram(n,r)))}}}update(t){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(t),this.directionalLight&&this.directionalLight.recalculate(t);const i=this.calculateLightsBrightness();t.brightness=i||0,i!==this._brightness&&(this._brightness=i,this.dispatcher.broadcast("setBrightness",i)),t.worldview!==this._worldview&&(this._worldview=t.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const r=this._changes.isDirty();let n=!1;if(this._changes.isDirty()){const e=this._changes.getLayerUpdatesByScope();for(const t in e){const{updatedIds:i,removedIds:r}=e[t];(i||r)&&(this._updateWorkerLayers(t,i,r),n=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(t),this.light&&this.light.updateTransitions(t),this.ambientLight&&this.ambientLight.updateTransitions(t),this.directionalLight&&this.directionalLight.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this.snow&&this.snow.updateTransitions(t),this.rain&&this.rain.updateTransitions(t),this._changes.reset()}const o={};for(const e in this._mergedSourceCaches){const t=this._mergedSourceCaches[e];o[e]=t.used,t.used=!1,t.tileCoverLift=0}for(const e of this._mergedOrder){const i=this._mergedLayers[e];if("none"!==i.visibility&&i.recalculate(t,this._availableImages),!i.isHidden(t.zoom)){const e=this.getLayerSourceCache(i);e&&(e.used=!0,e.tileCoverLift=Math.max(e.tileCoverLift,i.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>
2{this.precompilePrograms(i,t)}):this.precompilePrograms(i,t))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&n&&this.mergeLayers();const s=this.imageManager.getPendingImageProviders();for(const e of s)e.sourceCache.used=!0;for(const a in o){const t=this._mergedSourceCaches[a];o[a]!==t.used&&t.getSource().fire(new e.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:t.getSource().id}))}this.light&&this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.snow&&this.snow.recalculate(t),this.rain&&this.rain.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),r&&this.fire(new e.z("data",{dataType:"style"}))}updateImageProviders(){const e=this.imageManager.getPendingImageProviders();for(const t of e){const e=t.resolvePendingRequests(),i=this.getFragmentStyle(t.scope);i&&i.addImages(e)}}_updateTilesForChangedImages(){const e={};for(const t in this._mergedSourceCaches){const i=this._mergedSourceCaches[t].getSource().scope;e[i]=e[i]||this._changes.getUpdatedImages(i),0!==e[i].length&&this._mergedSourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e[i])}for(const t in e)this._changes.resetUpdatedImages(t)}_updateWorkerLayers(e,t,i){const r=this.getFragmentStyle(e);r&&this.dispatcher.broadcast("updateLayers",{layers:t?r._serializeLayers(t):[],scope:e,removedIds:i||[],options:r.options})}setState(t,i){if(this._checkLoaded(),Ir(this,we(t)))return!1;(t=e.dp(t)).layers=jt(t.layers);const r=function(t,i){if(!t)return[{command:Gt.setStyle,args:[i]}];let r=[];try{if(!e.by(t.version,i.version))return[{command:Gt.setStyle,args:[i]}];if(e.by(t.center,i.center)||r.push({command:Gt.setCenter,args:[i.center]}),e.by(t.zoom,i.zoom)||r.push({command:Gt.setZoom,args:[i.zoom]}),e.by(t.bearing,i.bearing)||r.push({command:Gt.setBearing,args:[i.bearing]}),e.by(t.pitch,i.pitch)||r.push({command:Gt.setPitch,args:[i.pitch]}),e.by(t.sprite,i.sprite)||r.push({command:Gt.setSprite,args:[i.sprite]}),e.by(t.glyphs,i.glyphs)||r.push({command:Gt.setGlyphs,args:[i.glyphs]}),e.by(t.imports,i.imports)||function(t=[],i=[],r){i=i||[];const n=(t=t||[]).map(Xt),o=i.map(Xt),s=t.reduce(Yt,{}),a=i.reduce(Yt,{}),l=n.slice();let c,h,u,d;for(c=0,h=0;c<n.length;c++)u=n[c],a.hasOwnProperty(u)?h++:(r.push({command:Gt.removeImport,args:[u]}),l.splice(l.indexOf(u,h),1));for(c=0,h=0;c<o.length;c++)u=o[o.length-1-c],l[l.length-1-c]!==u&&(s.hasOwnProperty(u)?(r.push({command:Gt.removeImport,args:[u]}),l.splice(l.lastIndexOf(u,l.length-h),1)):h++,d=l[l.length-c],r.push({command:Gt.addImport,args:[a[u],d]}),l.splice(l.length-c,0,u));for(const p of i){const t=s[p.id];t&&(delete t.data,e.by(t,p)||r.push({command:Gt.updateImport,args:[p.id,p]}))}}(t.imports,i.imports,r),e.by(t.transition,i.transition)||r.push({command:Gt.setTransition,args:[i.transition]}),e.by(t.light,i.light)||r.push({command:Gt.setLight,args:[i.light]}),e.by(t.fog,i.fog)||r.push({command:Gt.setFog,args:[i.fog]}),e.by(t.snow,i.snow)||r.push({command:Gt.setSnow,args:[i.snow]}),e.by(t.rain,i.rain)||r.push({command:Gt.setRain,args:[i.rain]}),e.by(t.projection,i.projection)||r.push({command:Gt.setProjection,args:[i.projection]}),e.by(t.lights,i.lights)||r.push({command:Gt.setLights,args:[i.lights]}),e.by(t.camera,i.camera)||r.push({command:Gt.setCamera,args:[i.camera]}),e.by(t.iconsets,i.iconsets)||function(t,i,r){let n;for(n in i=i||{},t=t||{})t.hasOwnProperty(n)&&(i.hasOwnProperty(n)||r.push({command:Gt.removeIconset,args:[n]}));for(n in i){if(!i.hasOwnProperty(n))continue;const o=i[n];t.hasOwnProperty(n)?e.by(t[n],o)||(r.push({command:Gt.removeIconset,args:[n]}),r.push({command:Gt.addIconset,args:[n,o]})):r.push({command:Gt.addIconset,args:[n,o]})}}(t.iconsets,i.iconsets,r),!e.by(t["color-theme"],i["color-theme"]))return[{command:Gt.setStyle,args:[i]}];const n={},o=[];!function(t,i,r,n){let o;for(o in i=i||{},t=t||{})t.hasOwnProperty(o)&&(i.hasOwnProperty(o)||Ht(o,r,n));for(o in i){if(!i.hasOwnProperty(o))continue;const s=i[o];t.hasOwnProperty(o)?e.by(t[o],s)||("geojson"===t[o].type&&"geojson"===s.type&&Zt(t,i,o)?r.pu
2sh({command:Gt.setGeoJSONSourceData,args:[o,s.data]}):$t(o,i,r,n)):qt(o,i,r)}}(t.sources,i.sources,o,n);const s=[];t.layers&&t.layers.forEach(e=>{e.source&&n[e.source]?r.push({command:Gt.removeLayer,args:[e.id]}):s.push(e)});let a=t.terrain;a&&n[a.source]&&(r.push({command:Gt.setTerrain,args:[void 0]}),a=void 0),r=r.concat(o),e.by(a,i.terrain)||r.push({command:Gt.setTerrain,args:[i.terrain]}),function(t,i,r){i=i||[];const n=(t=t||[]).map(Xt),o=i.map(Xt),s=t.reduce(Yt,{}),a=i.reduce(Yt,{}),l=n.slice(),c=Object.create(null);let h,u,d,p,f,m,_;for(h=0,u=0;h<n.length;h++)d=n[h],a.hasOwnProperty(d)?u++:(r.push({command:Gt.removeLayer,args:[d]}),l.splice(l.indexOf(d,u),1));for(h=0,u=0;h<o.length;h++)d=o[o.length-1-h],l[l.length-1-h]!==d&&(s.hasOwnProperty(d)?(r.push({command:Gt.removeLayer,args:[d]}),l.splice(l.lastIndexOf(d,l.length-u),1)):u++,m=l[l.length-h],r.push({command:Gt.addLayer,args:[a[d],m]}),l.splice(l.length-h,0,d),c[d]=!0);for(h=0;h<o.length;h++)if(d=o[h],p=s[d],f=a[d],!c[d]&&!e.by(p,f))if(e.by(p.source,f.source)&&e.by(p["source-layer"],f["source-layer"])&&e.by(p.type,f.type)){for(_ in Wt(p.layout,f.layout,r,d,null,Gt.setLayoutProperty),Wt(p.paint,f.paint,r,d,null,Gt.setPaintProperty),e.by(p.slot,f.slot)||r.push({command:Gt.setSlot,args:[d,f.slot]}),e.by(p.filter,f.filter)||r.push({command:Gt.setFilter,args:[d,f.filter]}),e.by(p.minzoom,f.minzoom)&&e.by(p.maxzoom,f.maxzoom)||r.push({command:Gt.setLayerZoomRange,args:[d,f.minzoom,f.maxzoom]}),p)p.hasOwnProperty(_)&&"layout"!==_&&"paint"!==_&&"filter"!==_&&"metadata"!==_&&"minzoom"!==_&&"maxzoom"!==_&&"slot"!==_&&(0===_.indexOf("paint.")?Wt(p[_],f[_],r,d,_.slice(6),Gt.setPaintProperty):e.by(p[_],f[_])||r.push({command:Gt.setLayerProperty,args:[d,_,f[_]]}));for(_ in f)f.hasOwnProperty(_)&&!p.hasOwnProperty(_)&&"layout"!==_&&"paint"!==_&&"filter"!==_&&"metadata"!==_&&"minzoom"!==_&&"maxzoom"!==_&&"slot"!==_&&(0===_.indexOf("paint.")?Wt(p[_],f[_],r,d,_.slice(6),Gt.setPaintProperty):e.by(p[_],f[_])||r.push({command:Gt.setLayerProperty,args:[d,_,f[_]]}))}else r.push({command:Gt.removeLayer,args:[d]}),m=l[l.lastIndexOf(d)+1],r.push({command:Gt.addLayer,args:[f,m]})}(s,i.layers,r)}catch(e){console.warn("Unable to compute style diff:",e),r=[{command:Gt.setStyle,args:[i]}]}return r}(this.serialize(),t).filter(e=>!(e.command in Mr));if(0===r.length)return!1;const n=r.filter(e=>!(e.command in Ar));if(n.length>0)throw new Error(`Unimplemented: ${n.map(e=>e.command).join(", ")}.`);const o=[];return r.forEach(e=>{o.push(this[e.command](...e.args))}),i&&Promise.all(o).then(i).catch(i),this.stylesheet=t,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(t){if(0===t.size)return this;for(const[i,r]of t.entries()){if(this.getImage(i))return this.fire(new e.y(new Error(`An image with the name "${i.name}" already exists.`)));this.imageManager.addImage(i,this.scope,r),this._changes.updateImage(i,this.scope)}return this._updateWorkerImages(),this.fire(new e.z("data",{dataType:"style"})),this}addImage(t,i){return this.getImage(t)?this.fire(new e.y(new Error(`An image with the name "${t.name}" already exists.`))):(this.imageManager.addImage(t,this.scope,i),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new e.z("data",{dataType:"style"})),this)}updateImage(t,i,r=!1){this.imageManager.updateImage(t,this.scope,i),r&&(this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new e.z("data",{dataType:"style"})))}getImage(e){return this.imageManager.getImage(e,this.scope)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t,this.scope),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new e.z("data",{dataType:"style"})),this):this.fire(new e.y(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}getActualScope(){return this._importedAsBasemap?"basemap":this.scope}addModelURLs(t){return this.modelManager.addModelURLs(t,this.getActualScope()),this._updateWorkerModels(),this.fire(new e.z("data",{dataType:"style"})),this}addModel(t,i,r={}
vendor: 5,397 bytes, line 2
2){return this._checkLoaded(),this._validate(De,`models.${t}`,i,null,r)||(this.modelManager.addModel(t,i,this.getActualScope()),this.fire(new e.z("data",{dataType:"style"}))),this}hasModel(e){return this.modelManager.hasModel(e,this.getActualScope())}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.getActualScope(),!1,!0),this.fire(new e.z("data",{dataType:"style"})),this):this.fire(new e.y(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(t,i,r={}){if(this._checkLoaded(),void 0!==this.getOwnSource(t))throw new Error(`There is already a source with ID "${t}".`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(Te,`sources.${t}`,i,null,r))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const n=_t(t,i,this.dispatcher,this);n.scope=this.scope,n.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(n.id),source:n.serialize(),sourceId:n.id}));const o=t=>{const i=(t?"symbol:":"other:")+n.id,r=e.B(i,this.scope),o=this._sourceCaches[i]=new Ft(r,n,t);(t?this._symbolSourceCaches:this._otherSourceCaches)[n.id]=o,o.onAdd(this.map)};o(!1),"vector"!==i.type&&"geojson"!==i.type||o(!0),n.onAdd&&n.onAdd(this.map),r.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(t){this._checkLoaded();const i=this.getOwnSource(t);if(!i)throw new Error("There is no source with this ID");for(const n in this._layers)if(this._layers[n].source===t)return this.fire(new e.y(new Error(`Source "${t}" cannot be removed while layer "${n}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===t)return this.fire(new e.y(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const i=Object.entries(this.stylesheet.iconsets).find(([e,i])=>"source"===i.type&&i.source===t);if(i)return this.fire(new e.y(new Error(`Source "${t}" cannot be removed while iconset "${i[0]}" is using it.`)))}const r=this.getOwnSourceCaches(t);for(const n of r){const t=e.dq(n.id);delete this._sourceCaches[t],this._changes.discardSourceCacheUpdate(n.id),n.fire(new e.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:n.getSource().id})),n.setEventedParent(null),n.clearTiles()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],this.mergeSources(),i.setEventedParent(null),i.onRemove&&i.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(e,t){this._checkLoaded(),this.getOwnSource(e).setData(t),this._changes.setDirty()}getOwnSource(e){const t=this.getOwnSourceCache(e);return t&&t.getSource()}getOwnSources(){const e=[];for(const t in this._otherSourceCaches){const i=this.getOwnSourceCache(t);i&&e.push(i.getSource())}return e}areTilesLoaded(){const e=this._mergedSourceCaches;for(const t in e){const i=e[t]._tiles;for(const e in i){const t=i[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}}return!0}setLights(t){if(this._checkLoaded(),!t)return delete this.ambientLight,void delete this.directionalLight;const i=this._getTransitionParameters();for(const e of t){if(this._validate(Ee,"lights",e))return;switch(e.type){case"ambient":if(this.ambientLight){const t=this.ambientLight;t.set(e),t.updateTransitions(i)}else this.ambientLight=new et(e,tt(),this.scope,this.options);break;case"directional":if(this.directionalLight){const t=this.directionalLight;t.set(e),t.updateTransitions(i)}else this.directionalLight=new et(e,rt(),this.scope,this.options)}}const r=Object.assign(i,{worldview:this.map.getWorldview()}),n=new e.ac(this.z||0,r);this.ambientLight&&this.ambientLight.recalculate(n),this.directionalLight&&this.directionalLight.recalculate(n),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const t=this.directionalLight,i=this.ambientLight;if(!t||!i)return;const r=e=>.2126*(e[0]<=.03928?e[0]/12.92:Math.pow((e[0]+.055)/1.055,2.4))+.7152*(e[1]<=.03928?e[1]/12.92:Math.pow((e[1]+.055)/1.055,2.4))+.0722*(e[2]<=.03928?e[2]/12.92:Math.pow((e[2]+.055)/1.055,2.4)),n=t.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),o=t.properties.get("intensity"),s=t.properties.get("direction"),a=1-e.d4(s.x,s.y,s.z)[2]/90,l=r(n)*o*a,c=i.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),h=i.properties.get("intensity"),u=r(c)*h;return Number(((l+u)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const e=[];return this.directionalLight&&e.push(this.directionalLight.get()),this.ambientLight&&e.push(this.ambientLight.get()),e}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(t){if(null==t||""===t&&this.isRootStyle())return this;if(e.dr(t)){const i=e.ds(t),r=this.fragments.find(({id:e})=>e===i);if(!r)return;const n=e.dq(t);return r.style.getFragmentStyle(n)}{const e=this.fragments.find(({id:e})=>e===t);return e?e.style:void 0}}setFeaturesetSelectors(t){if(!t)return;const i={},r=(e,t="")=>`${e}::${t}`;this._featuresetSelectors={};for(const n in t){const o=this._featuresetSelectors[n]=[];
2for(const s of t[n].selectors){if(s.featureNamespace){const t=this.getOwnLayer(s.layer);if(!t){e.w(`Layer is undefined for selector: ${s.layer}`);continue}const o=r(t.source,t.sourceLayer);if(o in i&&i[o]!==s.featureNamespace){e.w(`"featureNamespace ${s.featureNamespace} of featureset ${n}'s selector is not associated to the same source, skip this selector`);continue}i[o]=s.featureNamespace}let t;if(s.properties)for(const i in s.properties){const r=e.U(s.properties[i]);"success"===r.result&&(t=t||{},t[i]=r.value)}o.push({layerId:s.layer,namespace:s.featureNamespace,properties:t,uniqueFeatureID:s._uniqueFeatureID})}}}getFeaturesetDescriptors(e){const t=this.getFragmentStyle(e);if(!t||!t.stylesheet.featuresets)return[];const i=[];for(const r in t.stylesheet.featuresets)i.push({featuresetId:r,importId:t.scope?t.scope:void 0});return i}getFeaturesetLayers(t,i){const r=this.getFragmentStyle(i),n=r.stylesheet.featuresets;if(!n||!n[t])return this.fire(new e.y(new Error(`The featureset '${t}' does not exist in the map's style and cannot be queried.`))),[];const o=[];for(const e of n[t].selectors){const t=r.getOwnLayer(e.layer);t&&o.push(t)}return o}getConfigProperty(t,i){const r=this.getFragmentStyle(t);if(!r)return null;const n=e.B(i,r.scope),o=r.options.get(n),s=o?o.value||o.default:null;return s?s.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(t,i){const r=e.B(t,i);return this._mergedIndoor[r]}setIndoorData(e,t){this.indoorManager.setIndoorData(t)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(t,i,r){const n=this.getFragmentStyle(t);if(!n)return;const o=n.stylesheet.schema;if(!o||!o[i])return;const s=e.U(r);if("success"!==s.result)return void Ir(this,s.value);const a=s.value.expression,l=e.B(i,n.scope),c=n.options.get(l);if(!c)return;let h;const{minValue:u,maxValue:d,stepValue:p,type:f,values:m}=o[i],_=e.U(o[i].default);"success"===_.result&&(h=_.value.expression),h?(this.options.set(l,Object.assign({},c,{value:a,default:h,minValue:u,maxValue:d,stepValue:p,type:f,values:m})),this.updateConfigDependencies(i)):this.fire(new e.y(new Error(`No schema defined for the config option "${i}" in the "${t}" fragment.`)))}getConfig(t){const i=this.getFragmentStyle(t);if(!i)return null;const r=i.stylesheet.schema;if(!r)return null;const n={};for(const o in r){const t=e.B(o,i.scope),r=i.options.get(t),s=r?r.value||r.default:null;n[o]=s?s.serialize():null}return n}setConfig(e,t){const i=this.getFragmentStyle(e);i&&(i.updateConfig(t,i.stylesheet.schema),this.updateConfigDependencies())}getSchema(e){const t=this.getFragmentStyle(e);return t?t.stylesheet.schema:null}setSchema(e,t){const i=this.getFragmentStyle(e);i&&(i.stylesheet.schema=t,i.updateConfig(i._config,t),this.updateConfigDependencies())}updateConfig(t,i){if(this._config=t,t||i)if(i)for(const r in i){let n,o;const s=e.U(i[r].default);if("success"===s.result&&(n=s.value.expression),t&&void 0!==t[r]){const i=e.U(t[r]);"success"===i.result&&(o=i.value.expression)}const{minValue:a,maxValue:l,stepValue:c,type:h,values:u}=i[r];if(n){const t=e.B(r,this.scope);this.options.set(t,{default:n,value:o,minValue:a,maxValue:l,stepValue:c,type:h,values:u})}else this.fire(new e.y(new Error(`No schema defined for config option "${r}".`)))}else this.fire(new e.y(new Error("Attempting to set config for a style without schema.")))}_updateLayers(e,t=()=>!0){for(const i of e){const e=this.getLayer(i);e&&t(e)&&(e.possiblyEvaluateVisibility(),this._updateLayer(e),this._changes.setDirty())}}updateConfigDependencies(e){this._updateLayers(this._configDependentLayers,t=>!e||t.expressionDependencies.configDependencies.has(e)),this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(e=>{const t=e._styleColorTheme.colorThemeOverride?e._styleColorTheme.colorThemeOverride:e._styleColorTheme.colorTheme;if(t){const i=e._evaluateColorThemeData(t);(!e._styleColorTheme.lut&&""!==i||e._styleColorTheme.lut&&i!==e._styleColorTheme.lut.data)&&e.setColorTheme(t)}}),this._changes.setDirty()}addLayer(t,i,r={}){this._checkLoaded();const n=t.id;if(this._layers[n])return void this.fire(new e.y(new Error(`Layer with i
2d "${n}" already exists on this map`)));let o;if("custom"===t.type){if(Ir(this,e.dt(t)))return;o=e.du(t,this.scope,this._styleColorTheme.lut,this.options)}else{if("object"==typeof t.source&&(this.addSource(n,t.source),t=e.dp(t),t=Object.assign(t,{source:n})),this._validate(Pe,`layers.${n}`,t,{arrayIndex:-1},r))return;o=e.du(t,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(o),o.setEventedParent(this,{layer:{id:n}})}const s=e.B(o.source,o.scope);0!==o.expressionDependencies.configDependencies.size&&this._configDependentLayers.add(s),o.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(s);let a=this._order.length;if(i){const t=this._order.indexOf(i);if(-1===t)return void this.fire(new e.y(new Error(`Layer with id "${i}" does not exist on this map.`)));o.slot&&o.slot!==this._layers[i].slot?e.w(`Layer with id "${i}" has a different slot. Layers can only be rearranged within the same slot.`):a=t}this._order.splice(a,0,n),this._handleLayerOrderChange(),this._layers[n]=o;const l=this.getOwnLayerSourceCache(o),c=!!this.directionalLight&&this.directionalLight.shadowsEnabled();l&&o.canCastShadows()&&c&&(l.castsShadows=!0);const h=this._changes.getRemovedLayer(o);if(h&&o.source&&l&&"custom"!==o.type){this._changes.discardLayerRemoval(o);const t=e.B(o.source,o.scope);h.type!==o.type?this._changes.updateSourceCache(t,"clear"):(this._changes.updateSourceCache(t,"reload"),l.pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map),o.scope=this.scope,this.mergeLayers()}moveLayer(t,i){this._checkLoaded();const r=this._checkLayer(t);if(!r)return;if(t===i)return;const n=this._order.indexOf(t);this._order.splice(n,1);let o=this._order.length;if(i){const t=this._order.indexOf(i);
2if(-1===t)return void this.fire(new e.y(new Error(`Layer with id "${i}" does not exist on this map.`)));r.slot&&r.slot!==this._layers[i].slot?e.w(`Layer with id "${i}" has a different slot. Layers can only be rearranged within the same slot.`):o=t}this._order.splice(o,0,t),this._changes.setDirty(),this._handleLayerOrderChange(),this.mergeLayers()}removeLayer(e){this._checkLoaded();const t=this._checkLayer(e);if(!t)return;t.setEventedParent(null);const i=this._order.indexOf(e);this._order.splice(i,1),delete this._layers[e],this._changes.setDirty(),this._handleLayerOrderChange(),this._configDependentLayers.delete(t.fqid),this._indoorDependentLayers.delete(t.fqid),this._changes.removeLayer(t);const r=this.getOwnLayerSourceCache(t);if(r&&r.castsShadows){let e=!1;for(const i in this._layers)if(this._layers[i].source===t.source&&this._layers[i].canCastShadows()){e=!0;break}r.castsShadows=e}t.onRemove&&t.onRemove(this.map),this.mergeLayers()}getOwnLayer(e){return this._layers[e]}hasLayer(e){return e in this._mergedLayers}hasLayerType(e){for(const t in this._layers)if(this._layers[t].type===e)return!0;return!1}setLayerZoomRange(e,t,i){this._checkLoaded();const r=this._checkLayer(e);r&&(r.minzoom===t&&r.maxzoom===i||(null!=t&&(r.minzoom=t),null!=i&&(r.maxzoom=i),this._updateLayer(r)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(e,t){this._checkLoaded();const i=this._checkLayer(e);i&&i.slot!==t&&(i.slot=t,this._updateLayer(i))}setFilter(t,i,r={}){this._checkLoaded();const n=this._checkLayer(t);if(n&&!e.by(n.filter,i))return null==i?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(Re,`layers.${n.id}.filter`,i,{layerType:n.type},r)||(n.filter=e.dp(i),this._updateLayer(n)))}getFilter(t){const i=this._checkLayer(t);if(i)return e.dp(i.filter)}setLayoutProperty(t,i,r,n={}){this._checkLoaded();const o=this._checkLayer(t);if(o&&!e.by(o.getLayoutProperty(i),r)){if(null!=r&&(!n||!1!==n.validate)&&Ir(o,Le.call(we,{key:`layers.${t}.layout.${i}`,layerType:o.type,objectKey:i,value:r,styleSpec:e.a6,style:{glyphs:!0,sprite:!0}})))return;o.setLayoutProperty(i,r),0!==o.expressionDependencies.configDependencies.size&&this._configDependentLayers.add(o.fqid),o.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(o.fqid),this._updateLayer(o)}}setLayerProperty(e,t,i,r={}){this._checkLoaded();const n=this._checkLayer(e);n&&("appearances"===t?(n.setAppearances(i),this._changes.setDirty()):n.isPaintProperty(t)?this.setPaintProperty(e,t,i,r):this.setLayoutProperty(e,t,i,r))}getLayoutProperty(e,t){const i=this._checkLayer(e);if(i)return i.getLayoutProperty(t)}setPaintProperty(t,i,r,n={}){this._checkLoaded();const o=this._checkLayer(t);if(!o)return;if(e.by(o.getPaintProperty(i),r))return;if(null!=r&&(!n||!1!==n.validate)&&Ir(o,ze.call(we,{key:`layers.${t}.paint.${i}`,layerType:o.type,objectKey:i,value:r,styleSpec:e.a6})))return;const s=o.setPaintProperty(i,r);0!==o.expressionDependencies.configDependencies.size&&this._configDependentLayers.add(o.fqid),o.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(o.fqid),s&&this._updateLayer(o),this._changes.updatePaintProperties(o)}getPaintProperty(e,t){const i=this._checkLayer(e);if(i)return i.getPaintProperty(t)}setFeatureState(t,i){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:e,importId:r}=t.target,n=this.getFragmentStyle(r),o=n.getFeaturesetLayers(e);for(const{source:s,sourceLayer:a}of o)n.setFeatureState({id:t.id,source:s,sourceLayer:a},i)}else if("layerId"in t.target){const{layerId:e}=t.target,r=this.getLayer(e);this.setFeatureState({id:t.id,source:r.source,sourceLayer:r.sourceLayer},i)}return}const r=t.source,n=t.sourceLayer,o=this._checkSource(r);if(!o)return;const s=o.type;if("geojson"===s&&n)return void this.fire(new e.y(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===s&&!n)return void this.fire(new e.y(new Error("The sourceLayer parameter must be provided for vector source types.")));void 0===t.id&&this.fire(new e.y(new Error("The feature id parameter must be provided.")));const a=this.getOwnSourceCaches(r);for(const e of a)e.setFeatureState(n,t.id,i)}removeFeatureState(t,i){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:e,importId:r}=t.target,n=this.getFragmentStyle(r),o=n.getFeaturesetLayers(e);for(const{source:s,sourceLayer:a}of o)n.removeFeatureState({id:t.id,source:s,sourceLayer:a},i)}else if("layerId"in t.target){const{layerId:e}=t.target,r=this.getLayer(e);this.removeFeatureState({id:t.id,source:r.source,sourceLayer:r.sourceLayer},i)}return}const r=t.source,n=this._checkSource(r);if(!n)return;
vendor: 4,290 bytes, line 2
2const o=n.type,s="vector"===o?t.sourceLayer:void 0;if("vector"===o&&!s)return void this.fire(new e.y(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.y(new Error("A feature id is required to remove its specific state property.")));const a=this.getOwnSourceCaches(r);for(const e of a)e.removeFeatureState(s,t.id,i)}getFeatureState(t){if(this._checkLoaded(),"target"in t){let i;if("featuresetId"in t.target){const{featuresetId:r,importId:n}=t.target,o=this.getFragmentStyle(n),s=o.getFeaturesetLayers(r);for(const{source:a,sourceLayer:l}of s){const r=o.getFeatureState({id:t.id,source:a,sourceLayer:l});if(r&&!i)i=r;else if(!e.by(i,r))return void this.fire(new e.y(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in t.target){const{layerId:e}=t.target,r=this.getLayer(e);i=this.getFeatureState({id:t.id,source:r.source,sourceLayer:r.sourceLayer})}return i}const i=t.source,r=t.sourceLayer,n=this._checkSource(i);if(n){if("vector"!==n.type||r)return void 0===t.id&&this.fire(new e.y(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(i)[0].getFeatureState(r,t.id);this.fire(new e.y(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(e){return this.stylesheet.transition=Object.assign({},this.stylesheet.transition,e),this.transition=this.stylesheet.transition,this}getTransition(){return Object.assign({},this.stylesheet.transition)}serialize(){this._checkLoaded();const t=this.getTerrain(),i=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return e.dv({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,featuresets:this.stylesheet.featuresets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:i,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,indoor:this.stylesheet.indoor,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},e=>void 0!==e)}_updateFilteredLayers(e){for(const t of Object.values(this._mergedLayers))e(t)&&this._updateLayer(t)}_updateLayer(t){this._changes.updateLayer(t);const i=this.getLayerSourceCache(t),r=e.B(t.source,t.scope),n=this._changes.getUpdatedSourceCaches();t.source&&!n[r]&&i&&"raster"!==i.getSource().type&&(this._changes.updateSourceCache(r,"reload"),i.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(e){const t=e=>this._mergedLayers[e].is3D(!!this.terrain),i=this.order,r={},n=[];for(let s=i.length-1;s>=0;s--){const o=i[s];if(t(o)){r[o]=s;for(const t of e){const e=t[o];if(e)for(const t of e)n.push(t)}}}n.sort((e,t)=>t.intersectionZ-e.intersectionZ);const o=[];for(let s=i.length-1;s>=0;s--){const a=i[s];if(t(a))for(let e=n.length-1;e>=0;e--){const t=n[e].feature;if(t.layer&&r[t.layer.id]<s)break;o.push(t),n.pop()}else for(const t of e){const e=t[a];if(e)for(const t of e)o.push(t.feature)}}return o}queryRasterValue(t,i,r){const n=this.getOwnSource(t);return n?"raster-array"!==n.type?(this.fire(new e.y(new Error('queryRasterValue support only "raster-array" sources.'))),Promise.resolve(null)):n.queryRasterArrayValue(i,r):(this.fire(new e.y(new Error(`Source with id "${t}" does not exist in the style.`))),Promise.resolve(null))}queryRenderedFeatures(t,i,r){let n;i&&!Array.isArray(i)&&i.filter&&(this._validate(Re,"queryRenderedFeatures.filter",i.filter,null,i),n=e.b6(i.filter));const o={},s=e=>{if(Cr.has(e.type))return;const t=this.getOwnLayerSourceCache(e),i=o[t.id]=o[t.id]||{sourceCache:t,layers:{},has3DLayers:!1};e.is3D(!!this.terrain)&&(i.has3DLayers=!0),i.layers[e.fqid]=i.layers[e.fqid]||{styleLayer:e,targets:[]}
vendor: 8,933 bytes, line 2
2,i.layers[e.fqid].targets.push({filter:n})};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new e.y(new Error("parameters.layers must be an Array."))),[];for(const t of i.layers){const i=this._layers[t];if(!i)return this.fire(new e.y(new Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];s(i)}}else for(const e in this._layers)s(this._layers[e]);const a=this._queryRenderedFeatures(t,o,r),l=this._flattenAndSortRenderedFeatures(a),c=[];for(const h of l)e.dw(h.layer.id)===this.scope&&c.push(h);return c}queryRenderedFeatureset(t,i,r){let n;i&&!Array.isArray(i)&&i.filter&&(this._validate(Re,"queryRenderedFeatures.filter",i.filter,null,i),n=e.b6(i.filter));const o="mock",s=[];if(i&&i.target)s.push(Object.assign({},i,{targetId:o,filter:n}));else{const e=this.getFeaturesetDescriptors();for(const t of e)s.push({targetId:o,filter:n,target:t});for(const{style:t}of this.fragments){const e=t.getFeaturesetDescriptors();for(const t of e)s.push({targetId:o,filter:n,target:t})}}const a=this.queryRenderedTargets(t,s,r),l=[],c=new Set;for(const h of a)for(const t of h.variants[o])yt(t,h,c)||l.push(new e.dx(h,t));return l}queryRenderedTargets(t,i,r){const n={},o=(e,t,i,r)=>{const o=n[t.id]=n[t.id]||{sourceCache:t,layers:{},has3DLayers:!1};if(o.layers[e.fqid]=o.layers[e.fqid]||{styleLayer:e,targets:[]},e.is3D(!!this.terrain)&&(o.has3DLayers=!0),!r)return i.uniqueFeatureID=!1,void o.layers[e.fqid].targets.push(i);o.layers[e.fqid].targets.push(Object.assign({},i,{namespace:r.namespace,properties:r.properties,uniqueFeatureID:r.uniqueFeatureID}))};for(const a of i)if("featuresetId"in a.target){const{featuresetId:t,importId:i}=a.target,r=this.getFragmentStyle(i);if(!r||!r._featuresetSelectors)continue;const n=r._featuresetSelectors[t];if(!n){this.fire(new e.y(new Error(`The featureset '${t}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const e of n){const t=r.getOwnLayer(e.layerId);t&&!Cr.has(t.type)&&o(t,r.getOwnLayerSourceCache(t),a,e)}}else if("layerId"in a.target){const{layerId:e}=a.target,t=this.getLayer(e);if(!t||Cr.has(t.type))continue;o(t,this.getLayerSourceCache(t),a)}const s=this._queryRenderedFeatures(t,n,r);return this._flattenAndSortRenderedFeatures(s)}_queryRenderedFeatures(e,t,i){const r=[],n=!!this.map._showQueryGeometry,o=nt.createFromScreenPoints(e,i);for(const s in t){const e=xt(o,t[s],this._availableImages,i,n,this.getActualScope());Object.keys(e).length&&r.push(e)}if(this.placement)for(const s in t){if(!t[s].sourceCache._onlySymbols)continue;const e=vt(o.screenGeometry,t[s],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(e).length&&r.push(e)}return r}querySourceFeatures(e,t){const i=t&&t.filter;i&&this._validate(Re,"querySourceFeatures.filter",i,null,t);let r=[];const n=this.getOwnSourceCaches(e);for(const o of n)r=r.concat(bt(o,t));return r}addSourceType(e,t,i){return zr.getSourceType(e)?i(new Error(`A source type called "${e}" already exists.`)):(zr.setSourceType(e,t),t.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:t.workerSourceURL},i):i(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(t,i,r={}){this._checkLoaded();const n=this.light.getLight();let o=!1;for(const a in t)if(!e.by(t[a],n[a])){o=!0;break}if(!o)return;const s=this._getTransitionParameters();this.light.setLight(t,i,r),this.light.updateTransitions(s)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){void 0===this.disableElevatedTerrain&&(this.disableElevatedTerrain=e.o.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&e.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(t,i=1){if(this._checkLoaded(),!t)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),0===i&&delete this.terrain,null===t?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let r=t;const n=!("source"in t)||null==t.source;if(1===i){if(this.disableElevatedTerrain)return;if("source"in r&&"object"==typeof r.source){const t="terrain-dem-src";this.addSource(t,r.source),r=e.dp(r),r=Object.assign(r,{source:t})}const t=Object.assign({},r),i={};if(this.terrain&&n){t.source=this.terrain.get().source;const e=this.terrain?this.getFragmentStyle(this.terrain.scope):null;e&&(i.style=e.serialize())}if(this._validate(Ie,"terrain",t,i))return}if(!this.terrain||this.terrain.scope!==this.scope&&!n||this.terrain&&i!==this.terrain.drapeRenderMode){if(!r)return;this._createTerrain(r,i),this.fire(new e.z("data",{dataType:"style"}))}else{const i=this.terrain,n=i.get();for(const t of Object.keys(e.a6.terrain))!r.hasOwnProperty(t)&&e.a6.terrain[t].default&&(r[t]=e.a6.terrain[t].default);for(const r in t)if(!e.by(t[r],n[r])){i.set(t,this.options),this.stylesheet.terrain=t;const r=this._getTransitionParameters({duration:0});i.updateTransitions(r),this.fire(new e.z("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(e){const t=this.fog=new We(e,this.map.transform,this.scope,this.options);this.stylesheet.fog=t.get();const i=this._getTransitionParameters({duration:0});t.updateTransitions(i)}_createSnow(e){const t=this.snow=new Je(e,this.map.transform,this.scope,this.options);this.stylesheet.snow=t.get();const i=this._getTransitionParameters({duration:0});t.updateTransitions(i)}_createRain(e){const t=this.rain=new Qe(e,this.map.transform,this.scope,this.options);this.stylesheet.rain=t.get();const i=this._getTransitionParameters({duration:0});t.updateTransitions(i)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask(()=>{for(const e of this.map._markers)e._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(t){if(this._checkLoaded(),!t)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const i=this.fog;if(!e.by(i.get(),t)){i.set(t,this.options),this.stylesheet.fog=i.get();const e=this._getTransitionParameters({duration:0});i.updateTransitions(e)}}else this._createFog(t);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(t){if(this._checkLoaded(),!t)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const i=this.snow;if(!e.by(i.get(),t)){i.set(t,this.options),this.stylesheet.snow=i.get();const e=this._getTransitionParameters({duration:0});i.updateTransitions(e)}}else this._createSnow(t);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(t){if(this._checkLoaded(),!t)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const i=this.rain;if(!e.by(i.get(),t)){i.set(t,this.options),this.stylesheet.rain=i.get();const e=this._getTransitionParameters({duration:0});i.updateTransitions(e)}}else this._createRain(t);this._markersNeedUpdate=!0}_reloadColorTheme(){const t=()=>{for(const e in this._layers)this._layers[e].lut=this._styleColorTheme.lut;for(const e in this._sourceCaches)this._sourceCaches[e].clearTiles()},i=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!i)return this._styleColorTheme.lut=null,void t();const r=this._evaluateColorThemeData(i);this._loadColorTheme(r).then(()=>{this.fire(new e.z("colorthemeset")),t()}).catch(t=>{e.w(`Couldn't set color theme: ${t}`)})}setColorTheme(t){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&e.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=t,this._reloadColorTheme()}setImportColorTheme(e,t){const i=this.getFragmentStyle(e);i&&(i._styleColorTheme.colorThemeOverride=t,i._reloadColorTheme())}_getTransitionParameters(t){return{now:e.o.now(),transition:Object.assign(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const e=[],t=[];for(const i of this._mergedOrder)this.isLayerDraped(this._mergedLayers[i])?e.push(i):t.push(i);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...e),this._drapedFirstOrder.push(...t)}_createTerrain(e,t){const i=this.terrain=new Ue(e,t,this.scope,this.options,this.map.getWorldview());1===t&&(this.stylesheet.terrain=e),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const r=this._getTransitionParameters({duration:0});i.updateTransitions(r)}_force3DLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"fill-extrusion"===t.type&&this._updateLayer(t)}}
2_forceSymbolLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"symbol"===t.type&&this._updateLayer(t)}}_validate(t,i,r,n,o={}){if(o&&!1===o.validate)return!1;const s=Object.assign({},this.serialize());return Ir(this,t.call(we,Object.assign({key:i,style:s,value:r,styleSpec:e.a6},n)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),e.dy.off("pluginStateChange",this._rtlTextPluginCallback);for(const e in this._mergedLayers)this._mergedLayers[e].setEventedParent(null);for(const e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles(),this._mergedSourceCaches[e].setEventedParent(null);this.imageManager.removeScope(this.scope),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.indoorManager.destroy(),this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(e){const t=this.getSourceCaches(e);for(const i of t)i.clearTiles()}clearSources(){for(const e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles()}clearLayers(){for(const e in this._mergedLayers){const t=this._mergedLayers[e];t._clear&&t._clear()}}reloadSource(e){const t=this.getSourceCaches(e);for(const i of t)i.resume(),i.reload()}reloadSources(){for(const e of this.getSources())e.reload&&e.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(e=>{e.modelManager.reloadModels(e.scope)})}updateSources(e){let t;this.directionalLight&&(t=mr(this.directionalLight));const i=new Set,r=new Set;for(const n in this._mergedLayers){const e=this._mergedLayers[n];
vendor: 4,279 bytes, line 2
2"building"===e.type&&i.add(e.source),e.hasElevation()&&!r.has(e.source)&&r.add(e.source)}for(const n in this._mergedSourceCaches){const o=this._mergedSourceCaches[n],s=r.has(o._source.id);i.has(o._source.id)&&(o._source.reparseOverscaled=!1),o.update(e,void 0,void 0,t,s)}}_generateCollisionBoxes(){for(const e in this._sourceCaches){const t=this._sourceCaches[e];t.resume(),t.reload()}}_handleLayerOrderChange(){this._requestFullLabelPlacement(),this.fire(new e.z("neworder"))}_requestFullLabelPlacement(){this.pauseablePlacement||(this.pauseablePlacement=new Vi),this.pauseablePlacement.requestFullPlacement()}_setLabelPlacementStale(){this.placement&&this.placement.setStale()}_updatePlacement(t,i,r,n,o){this.pauseablePlacement||(this.pauseablePlacement=new Vi);let s=!1,a=!1;const l={},c={};for(const m of this._mergedOrder){const i=this._mergedLayers[m];if("symbol"!==i.type)continue;const r=e.B(i.source,i.scope);let n=l[r];if(!n){const e=this.getLayerSourceCache(i);if(!e)continue;const t=e.getRenderableIds(!0).map(t=>e.getTileByID(t));c[r]=t.slice(),n=l[r]=t.sort((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1))}const o=this.crossTileSymbolIndex.addLayer(i,n,t.center.lng,t.projection);s=s||o}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder);const h=Boolean(this.placement&&!t.equals(this.placement.transform)),u=Boolean(this.placement&&(0!==this.placement.lastReplacementSourceUpdateTime&&!o||this.placement.lastReplacementSourceUpdateTime!==o.updateTime)),d=h||u||s,p=(d||this.pauseablePlacement.isStale())&&0===r,f=this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.o.now(),t.zoom)&&0!==r;if((this.pauseablePlacement.isFullPlacementRequested()||!this.pauseablePlacement.placement||p||f)&&(this.pauseablePlacement=this.pauseablePlacement.startNewPlacement(t,this._mergedOrder,i,r,n,this.placement,this.fog&&t.projection.supportsFog?this.fog.state:null,this._buildingIndex)),this.pauseablePlacement.isDone()?d&&0!==r&&this.pauseablePlacement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,l,c,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(e.o.now()),a=!0),s&&this.pauseablePlacement.setStale()),a||s){this._buildingIndex.onNewFrame(t.zoom);for(let t=0;t<this._mergedOrder.length;t++){const i=this._mergedLayers[this._mergedOrder[t]];if("symbol"!==i.type)continue;if("none"===i.visibility)continue;const r=this.isLayerClipped(i);this.placement.updateLayerOpacities(i,l[e.B(i.source,i.scope)],t,r?o:null)}}return!this.pauseablePlacement.isDone()||this.placement.isStale()||this.placement.hasTransitions(e.o.now())}_releaseSymbolFadeTiles(){for(const e in this._sourceCaches)this._sourceCaches[e].releaseSymbolFadeTiles()}addImport(t,i){this._checkLoaded();const r=this.stylesheet.imports=this.stylesheet.imports||[];if(-1!==r.findIndex(({id:e})=>e===t.id))return void this.fire(new e.y(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!i)return r.push(t),this._loadImports([t],!0);const n=r.findIndex(({id:e})=>e===i);return-1===n&&this.fire(new e.y(new Error(`Import with id "${i}" does not exist on this map.`))),this.stylesheet.imports=r.slice(0,n).concat(t).concat(r.slice(n)),this._loadImports([t],!0,i)}updateImport(t,i){this._checkLoaded();const r=this.stylesheet.imports||[],n=this.getImportIndex(t);return-1===n?this:"string"==typeof i?(this.setImportUrl(t,i),this):(i.url&&i.url!==r[n].url&&this.setImportUrl(t,i.url),e.by(i.config,r[n].config)||this.setImportConfig(t,i.config,i.data.schema),e.by(i.data,r[n].data)||this.setImportData(t,i.data),this)}moveImport(e,t){this._checkLoaded();let i=this.stylesheet.imports||[];const r=this.getImportIndex(e);if(-1===r)return this;const n=this.getImportIndex(t);if(-1===n)return this;const o=i[r],s=this.fragments[r];return i=i.filter(({id:t})=>t!==e),this.fragments=this.fragments.filter(({id:t})=>t!==e),this.stylesheet.imports=i.slice(0,n).concat(o).concat(i.slice(n)),this.fragments=this.fragments.slice(0,n).concat(s).concat(this.fragments.slice(n)),this.mergeLayers(),this}setImportUrl(e,t){this._checkLoaded();const i=this.stylesheet.imports||[],r=this.getImportIndex(e);if(-1===r)return this;i[r].url=t;
2const n=this.fragments[r];return n.style=this._createFragmentStyle(i[r]),n.style.on("style.import.load",()=>this.mergeAll()),n.style.loadURL(t),this}setImportData(e,t){this._checkLoaded();const i=this.getImportIndex(e),r=this.stylesheet.imports||[];return-1===i?this:t?(this.fragments[i].style.setState(t),this._reloadImports(),this):(delete r[i].data,this.setImportUrl(e,r[i].url))}setImportConfig(e,t,i){this._checkLoaded();const r=this.getImportIndex(e),n=this.stylesheet.imports||[];if(-1===r)return this;t?n[r].config=t:delete n[r].config;const o=this.fragments[r];i&&o.style.stylesheet&&(o.style.stylesheet.schema=i);const s=o.style.stylesheet&&o.style.stylesheet.schema;return o.config=t,o.style.updateConfig(t,s),this.updateConfigDependencies(),this}removeImport(e){this._checkLoaded();const t=this.stylesheet.imports||[],i=this.getImportIndex(e);-1!==i&&(t.splice(i,1),this.fragments[i].style._remove(),this.fragments.splice(i,1),this._reloadImports())}getImportIndex(t){const i=(this.stylesheet.imports||[]).findIndex(e=>e.id===t);return-1===i&&this.fire(new e.y(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),i}getLayer(e){return this._mergedLayers[e]}getSources(){const e=[];for(const t in this._mergedOtherSourceCaches){const i=this._mergedOtherSourceCaches[t];i&&e.push(i.getSource())}return e}getSource(e,t){const i=this.getSourceCache(e,t);return i&&i.getSource()}getLayerSource(e){const t=this.getLayerSourceCache(e);return t&&t.getSource()}getSourceCache(t,i){const r=e.B(t,i);return this._mergedOtherSourceCaches[r]}getLayerSourceCache(t){const i=e.B(t.source,t.scope);return"symbol"===t.type?this._mergedSymbolSourceCaches[i]:this._mergedOtherSourceCaches[i]}getSourceCaches(e){if(null==e)return Object.values(this._mergedSourceCaches);const t=[];return this._mergedOtherSourceCaches[e]&&t.push(this._mergedOtherSourceCaches[e]),this._mergedSymbolSourceCaches[e]&&t.push(this._mergedSymbolSourceCaches[e]),t}updateSourceCaches(){const e=this._changes.getUpdatedSourceCaches();for(const t in e){const i=e[t];"reload"===i?this.reloadSource(t):"clear"===i&&this.clearSource(t)}}updateLayers(e){const t=this._changes.getUpdatedPaintProperties();for(const i of t){const t=this.getLayer(i);t&&t.updateTransitions(e)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(e){this.stylesheet.glyphs=e,this.glyphManager.setURL(e)}getImages(t,i,r){this.imageManager.getImages(i.images,i.scope,r),this._updateTilesForChangedImages();const n=t=>{if(t){const r=i.images.map(t=>e.I.toString(t));t.setDependencies(i.tileID.key,i.type,r)}},o=e.B(i.source,i.scope);n(this._mergedOtherSourceCaches[o]),n(this._mergedSymbolSourceCaches[o]),i.images.some(e=>e.iconsetId)&&this.fire(new e.z("data",{dataType:"style"}))}rasterizeImages(e,t,i){this.imageManager.rasterizeImages(t,i)}getGlyphs(e,t,i){this.glyphManager.getGlyphs(t.stacks,i)}getResource(t,i,r){return e.dz(i,r)}getOwnSourceCache(e){return this._otherSourceCaches[e]}getOwnLayerSourceCache(e){return"symbol"===e.type?this._symbolSourceCaches[e.source]:this._otherSourceCaches[e.source]}getOwnSourceCaches(e){const t=[];return this._otherSourceCaches[e]&&t.push(this._otherSourceCaches[e]),this._symbolSourceCaches[e]&&t.push(this._symbolSourceCaches[e]),t}_isSourceCacheLoaded(t){const i=this.getOwnSourceCaches(t);return 0===i.length?(this.fire(new e.y(new Error(`There is no source with ID '${t}'`))),!1):i.every(e=>e.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(e,t){if(!this._clipLayerPresent&&"fill-extrusion"!==e.type&&"building"!==e.type)return!1;const i="fill-extrusion"===e.type&&("building"===e.sourceLayer||"procedural_buildings"===e.sourceLayer),r="building"===e.type;if(e.is3D(!!this.terrain)){if(i||r||t&&"batched-model"===t.type)return!0;if("model"===e.type)return!0}else if("symbol"===e.type)return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(e=>{e.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}zr.getSourceType=function(e){return mt[e]},zr.setSourceType=function(e,t){mt[e]=t},zr.registerForPluginStateChange=e.dA;var Lr="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#ifdef RENDER_CUTOFF\nfloat cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}\n#endif",Dr="\n#ifdef DUAL_SOURCE_BLENDING\nlayout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1;\n#else\nlayout(location=0) out vec4 glFragColor;\n#endif\n#ifdef USE_MRT1\nlayout(location=1) out vec4 out_Target1;\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;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\n#ifdef INDICATOR_CUTOUT\nuniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;\n#endif\nvec4 applyCutout(vec4 color,float height) {\n#ifdef INDICATOR_CUTOUT\nfloat verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;
2float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);\n#else\nreturn color;\n#endif\n}\n#ifdef DEBUG_WIREFRAME\n#define HANDLE_WIREFRAME_DEBUG \\\nglFragColor=vec4(0.7,0.0,0.0,0.7); \\\ngl_FragDepth=gl_FragCoord.z-0.0001;\n#else\n#define HANDLE_WIREFRAME_DEBUG\n#endif\n#ifdef RENDER_CUTOFF\nuniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;\n#endif\nvec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb*col.a,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}",Or="\n#define EXTENT 8192.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 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 (units_to_pixels*pos+offset)/pattern_size;}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) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}\n#ifdef RENDER_CUTOFF\nuniform vec4 u_cutoff_params;out float v_cutoff_opacity;\n#endif\nconst vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}\n#ifndef HAS_SHADER_STORAGE_BLOCK_material_buffer\n#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib\n#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib\n#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib\n#define DECLARE_MATERIAL_TABLE_INFO\n#endif",Fr="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;
2void 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;}",kr="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nvec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }\n#endif\n#ifdef DEPTH_OCCLUSION\nuniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;\n#ifdef DEPTH_D24\nfloat unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}\n#else\nhighp float unpack_depth_rgba(vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;\n#ifdef CLIP_ZERO_TO_ONE\ncoord.z=-1.0+2.0*coord.z; \n#endif\n#ifdef DEPTH_D24\nfloat depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);\n#else\nfloat depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));\n#endif\nreturn coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
2size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;\n#ifdef DEPTH_D24\nhighp vec4 depth=vec4(\ntexture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r\n);depth=unpack_depth4(depth);\n#else\nhighp vec4 depth=vec4(\nunpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))\n);\n#endif\nreturn depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;\n#ifdef CLIP_ZERO_TO_ONE\ncoord.z=-1.0+2.0*coord.z; \n#endif\nint NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) {\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));\n#endif\nres+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;\n#ifdef CLIP_ZERO_TO_ONE\ncoord.z=-1.0+2.0*coord.z; \n#endif\nhighp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));}\n#else\nbool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }\n#endif",Br="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",Nr="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;\n#ifdef FLIP_Y\nuv.y=1.0-uv.y;\n#endif\nhighp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}
2vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif",Vr="#ifdef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)\n);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)\n);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}\n#endif",Ur="#ifdef RASTER_ARRAY\nuniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;}\n#endif\nuniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}",jr="#ifdef RENDER_SHADOWS\nuniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}\n#endif",Gr="#ifdef RENDER_SHADOWS\nprecision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,high
2p float bias) {\n#ifdef CLIP_ZERO_TO_ONE\nhighp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias);\n#else\nhighp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias);\n#endif\nreturn texture(shadowmap,coord);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {light_view_pos0.xyz/=light_view_pos0.w;\n#ifdef SHADOWS_SINGLE_CASCADE\nvec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);\n#else\nlight_view_pos1.xyz/=light_view_pos1.w;vec4 abs_bounds=abs(vec4(light_view_pos0.xy,light_view_pos1.xy));if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}float occlusion1=shadow_sample(u_shadowmap_1,light_view_pos1.xyz,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0);\n#endif\n}highp float calculate_shadow_bias(float NDotL) {\n#ifdef NORMAL_OFFSET\nreturn 0.5*u_shadow_bias.x;\n#else\nreturn 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));\n#endif\n}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy)\n{highp vec2 biasUV=vec2(\npos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}\n#endif";const qr=/#include\s+"([^"]+)"/g,Hr=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,$r=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,Zr=new Set(["ifdef","ifndef","elif","if","defined"]),Wr=new Set;rn(Lr,Wr),rn(Or,Wr),rn(Dr,Wr);const Xr={"_prelude_fog.vertex.glsl":Br,"_prelude_terrain.vertex.glsl":kr,"_prelude_shadow.vertex.glsl":jr,"_prelude_material_table.vertex.glsl":"#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer\n#define MATERIAL_TABLE_DEBUG 0\nuniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset;\n#if MATERIAL_TABLE_DEBUG\nvec4 colorDebug;\n#endif\n};uint read_buf_no_offset(uint iDword) {return material_data[iDword/4u][iDword % 4u];}uint read_buf(uint iDword) {iDword+=uint(u_material_offset/4);return read_buf_no_offset(iDword);}
2float read_buf_float(uint iDword){return uintBitsToFloat(read_buf(iDword));}uint read_buf_uint8(uint iDword,uint iUint8){uint dwordOffset=iDword+(iUint8/4u);uint byteOffset=iUint8 & 3u;uint bitOffset=8u*byteOffset;uint mask=0xffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint read_buf_uint16(uint iDword,uint iUint16){uint dwordOffset=iDword+(iUint16 >> 1u);uint bitOffset=(iUint16 & 1u)*16u;uint mask=0xffffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint nrDwordsForVertexIdEntries(uint nrMaterialLookupEntries) {return nrMaterialLookupEntries;}uint nrDwordsForMaterialIdEntries(uint nrMaterialLookupEntries) {return (nrMaterialLookupEntries*2u+3u)/4u;}uint findRangeBinarySearch(uint vertexId,uint numRanges,uint dwordOffset) {uint left=0u;uint right=numRanges-1u;for (uint i=0u; i < 16u; i++) { \nif (left > right) {break;}uint mid=(left+right)/2u;uint start=read_buf(dwordOffset+mid);uint nextStart=(mid+1u < numRanges) ? read_buf(dwordOffset+mid+1u) : 0xffffffffu;if (vertexId >=start && vertexId < nextStart) {return mid;} else if (vertexId < start) {if (mid==0u) {break;}right=mid-1u;} else {left=mid+1u;}}return 0u; \n}uint readVertexId(uint dwordOffset,uint iMaterialLookupEntry) {return read_buf(dwordOffset+iMaterialLookupEntry);}uint findRange(uint vertexId,uint numRanges,uint dwordOffset) {uint iRange;if(numRanges <=64u){uint vertexBegin;for(iRange=0u; iRange < numRanges;++iRange) {vertexBegin=readVertexId(dwordOffset,iRange);if(vertexBegin > vertexId) {break;}}iRange=iRange==0u? 0u : iRange-1u;} else { \niRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info;\n#if MATERIAL_TABLE_DEBUG\nconst vec4 red=vec4(1.0,0.0,0.0,1.0);const vec4 orange=vec4(1.0,0.5,0.0,1.0);const vec4 yellow=vec4(1.0,1.0,0.0,1.0);const vec4 green=vec4(0.0,1.0,0.0,1.0);const vec4 indigo=vec4(0.294,0.0,0.510,1.0);const vec4 blue=vec4(0.0,0.0,1.0,1.0);const vec4 purple=vec4(0.5,0.0,0.5,1.0);const vec4 pink=vec4(1.0,0.0,1.0,1.0);info.colorDebug=green;\n#endif\nuint offset=0u;\n#if MATERIAL_TABLE_DEBUG\nbool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;}\n#endif\noffset++;\n#if MATERIAL_TABLE_DEBUG\nuint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;}\n#endif\noffset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++);\n#if MATERIAL_TABLE_DEBUG\nif(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;}\n#endif\nuint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset);\n#if MATERIAL_TABLE_DEBUG\nif(keepFinding)\n{uint vertexBeginCheck=readVertexId(offset,iMaterialLookup);if(vertexBeginCheck > vertex_id) {info.colorDebug=red;keepFinding=false;}if(iMaterialLookup < nrMaterialLookupEntries-1u) {uint vertexEndCheck=readVertexId(offset,iMaterialLookup+1u);if(vertexEndCheck <=vertex_id) {info.colorDebug=red;keepFinding=false;}}}\n#endif\noffset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup;\n#if MATERIAL_TABLE_DEBUG\nif(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}}\n#endif\ninfo.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes)\n{uint attribFieldOffsetDwords=attribOffsetBytes/4u;return matInfo.dataOffset+attribFieldOffsetDwords;}vec4 read_material_vec4(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec4(read_buf_float(loc),read_buf_float(loc+1u),read_buf_float(loc+2u),read_buf_float(loc+3u));}vec2 read_material_vec2(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec2(read_buf_float(loc),read_buf_float(loc+1u));}float read_material_float(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return read_buf_float(loc);}\n#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset)\n#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset)\n#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset)\n#define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID));\n#define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug;\n#endif","_prelude_fog.fragment.glsl":Nr,"_prelude_shadow.fragment.glsl":Gr,"_prelude_lighting.glsl":"\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0
2));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}\n#endif","_prelude_raster_array.glsl":Vr,"_prelude_raster_particle.glsl":Ur},Yr={};nn("",kr),nn(Nr,Br),nn(Gr,jr),nn(Vr,""),nn(Ur,"");const Kr=nn(Dr,Or),Jr=Lr,Qr=["\n#if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING)\n#extension GL_EXT_blend_func_extended : require\n#endif","precision mediump float;",Jr,Kr.fragmentSource].join("\n"),en=["precision highp float;",Jr,Kr.vertexSource].join("\n");var tn={background:nn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength;\n#ifdef LIGHTING_3D_MODE\nin vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_lighting.glsl"\nin vec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength;\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec4 u_color;out 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_with_emission_ground(u_color,u_emissive_strength);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),backgroundPattern:nn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
2\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp 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_pattern_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),building:nn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nconst float window_depth=0.5;const float ao_radius=0.2;in vec4 v_color;in highp vec3 v_normal;in highp vec3 v_pos;\n#ifdef BUILDING_FAUX_FACADE\nin lowp float v_faux_facade;in highp float v_faux_facade_ed;in highp vec2 v_faux_facade_window;in highp vec2 v_faux_facade_floor;in highp vec2 v_faux_facade_range;in highp float v_aspect;in highp vec3 v_tbn_0;in highp vec3 v_tbn_1;in highp vec3 v_tbn_2;in highp vec4 v_faux_color_emissive;uniform float u_faux_facade_ao_intensity;\n#endif\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\n#ifdef FLOOD_LIGHT\nin highp float v_flood_radius;in float v_has_flood_light;\n#endif\nuniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;uniform vec3 u_flood_light_color;uniform float u_flood_light_intensity;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));}\n#ifdef BUILDING_FAUX_FACADE\nfloat hash12(in vec2 p) {vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}vec2 get_uv_mask_id(in vec2 q,out float mask,out vec2 id) {vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;vec2 uv=modf(p/v_faux_facade_floor,id);vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;vec4 edge=d/v_faux_facade_floor.xyxy;vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}float ray_unit_box(in vec3 ray_o,in vec3 ray_d,in vec3 bmin,in vec3 bmax) {vec3 planes=mix(bmin,bmax,step(0.0,ray_d));vec3 t=(planes-ray_o)/ray_d;return min3(t);}float get_emissive(in vec2 id) {if (u_facade_emissive_chance > 0.0) {return (step(hash12(id),u_facade_emissive_chance)+0.05)*v_faux_color_emissive.a;}return 0.0;}vec3 get_shade_info(in vec3 v,in vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y;\n#if 0\nif (x_major) {out_color=v.x > 0.0 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,1.0);} else if (y_major) {out_color=v.y > 0.0 ? vec3(0.0,1.0,0.0) : vec3(1.0,0.0,1.0);} else if (z_major) {out_color=v.z > 0.0 ? vec3(0.0,0.0,1.0) : vec3(1.0,1.0,0.0);}out_emissive=1.0;\n#else\nif (x_major) {out_normal=sign(v.x)*tbn[0];} else if (y_major) {out_normal=vec3(0.0,0.0,-sign(v.y));} else if (z_major) {out_color=v_faux_color_emissive.rgb;out_emissive=v.z <=0.0 ? get_emissive(id) : out_emissive;}float ao=1.0;if (u_faux_facade_ao_intensity > 0.0) {vec4 ao_range=v_faux_facade_window.xxyy*0.5-vec4(0,ao_radius,0,ao_radius);vec2 ao_range_z=vec2(window_depth*0.5)-vec2(0.0,ao_radius);if (x_major || y_major) {ao*=smoothstep(-ao_range_z.x,-ao_range_z.y,v.z);} else if (z_major) {ao*=smoothstep(-ao_range.x,-ao_range.y,v.x)*(1.0-smoothstep(ao_range.y,ao_range.x,v.x));ao*=smoothstep(-ao_range.z,-ao_range.w,v.y)*(1.0-smoothstep(ao_range.w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao;\n#endif\nreturn out_color;}\n#endif\nvec3 apply_lighting_linear(in vec3 color,in vec3 normal,in float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return color*(ambient_contrib+directional_contrib);}void main() {vec3 normal=normalize(v_normal);vec3 base_color=v_color.rgb;float emissive=v_color.a;\n#ifdef BUILDING_FAUX_FACADE\nif (v_faux_facade > 0.0) {mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;vec3 view_tangent=transpose(tbn)*v;vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;vec3 bmin=vec3(0.0,0.0,-window_depth);vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);vec3 ray_o=vec3(uv,0.0);vec3 ray_d=normalize(view_tangent);float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);vec3 hit=ray_o+t_min*ray_d;vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);}\n#endif\nvec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0;\n#ifdef RENDER_SHADOWS\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\n#else\nshadowed_lighting_factor=dot(xy_flipped_normal,u_lighting_directional_dir);\n#endif\ncolor.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb);\n#ifdef FLOOD_LIGHT\nfloat flood_radiance=(1.0-min(v_pos.z/v_flood_radiu
2s,1.0))*u_flood_light_intensity*v_has_flood_light;color.rgb=mix(color.rgb,u_flood_light_color,flood_radiance);\n#endif\ncolor.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive);\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z));\n#endif\ncolor*=u_opacity;\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color,v_pos.z);\n#endif\n#ifdef FEATURE_CUTOUT\ncolor=apply_feature_cutout(color,gl_FragCoord);\n#endif\nglFragColor=color; \n#ifdef DEBUG_SHOW_NORMALS\ncolor.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color;\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;in vec3 a_normal_3;in vec3 a_centroid_3;in float a_flood_light_wall_radius_1i16;in vec4 a_faux_facade_data;in vec2 a_faux_facade_vertical_range;uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos;\n#ifdef BUILDING_FAUX_FACADE\nout lowp float v_faux_facade;out highp float v_faux_facade_ed;out highp vec2 v_faux_facade_window;out highp vec2 v_faux_facade_floor;out highp vec2 v_faux_facade_range;out highp float v_aspect;out highp vec3 v_tbn_0;out highp vec3 v_tbn_1;out highp vec3 v_tbn_2;out highp vec4 v_faux_color_emissive;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\n#endif\n#ifdef FLOOD_LIGHT\nout highp float v_flood_radius;out float v_has_flood_light;\n#endif\nconst float MAX_UINT_16=65535.0;const float MAX_INT_16=32767.0;const float MAX_UINT_8=255.0;const float TWO_POW_8=256.0;const float FLOOD_LIGHT_MAX_RADIUS_METER=2048.0;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\n#ifdef BUILDING_FAUX_FACADE\nmat3 get_tbn(in vec3 normal) {const vec3 bitangent=vec3(0.0,0.0,1.0);vec3 tangent=normalize(vec3(normal.y,-normal.x,0.0));return mat3(tangent,bitangent,normal);}\n#endif\n#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive\n#pragma mapbox: define-attribute-vertex-shader-only highp vec2 faux_facade_color_emissive\nvoid main() {\n#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive\n#pragma mapbox: initialize-attribute-custom highp vec2 faux_facade_color_emissive\n#ifdef FLOOD_LIGHT\nv_flood_radius=(a_flood_light_wall_radius_1i16/MAX_INT_16*FLOOD_LIGHT_MAX_RADIUS_METER);v_has_flood_light=step(0.0,v_flood_radius);\n#endif\nvec4 color_emissive=decode_color(part_color_emissive);v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=a_normal_3/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;float depth_offset=0.0;\n#ifdef BUILDING_FAUX_FACADE\nv_faux_facade=a_faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=a_faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(a_faux_facade_data.y/TWO_POW_8);float window_y_perc=a_faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(a_faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(a_faux_facade_vertical_range/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(faux_facade_color_emissive);v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);float height=a_centroid_3.z;depth_offset=min(1000.0,height)*0.0000002;}\n#endif\nv_pos=a_pos_3f;\n#ifdef RENDER_CUTOFF\nvec4 ground=u_matrix*vec4(a_centroid_3,1.0);v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shadow_pos=v_pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(v_pos);\n#endif\ngl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w;}'),buildingBloom:nn("in vec4 v_color_emissive;\n#pragma mapbox: define-attribute highp vec4 bloom_attenuation\n#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation\nfloat saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0;\n#ifdef HAS_ATTRIBUTE_a_bloom_attenuation\nfloat distance=length(vec2(1.3*max(0.0,abs(bloom_attenuation.x)-bloom_attenuation.z),bloom_attenuation.y));distance+= mix(0.5,0.0,clamp(emission-1.0,0.0,1.0));
2opacity*=saturate(1.0-distance*distance);\n#endif\n#ifdef RENDER_CUTOFF\nopacity*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}","in vec3 a_pos_3f;\n#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive\n#pragma mapbox: define-attribute highp vec4 bloom_attenuation\nout vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive\n#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation\n#ifdef HAS_ATTRIBUTE_a_part_color_emissive\nvec4 color_emissive=decode_color(part_color_emissive);float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive);\n#else\nv_color_emissive=vec4(1.0);\n#endif\ngl_Position=u_matrix*vec4(a_pos_3f,1.0);\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}"),buildingDepth:nn("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}","in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);v_depth=gl_Position.z/gl_Position.w;}"),circle:nn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nuniform float u_emissive_strength;void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? \nsmoothstep(0.0,-antialiased_blur,1.0-extrude_length) : \nsmoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\nglFragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\n#ifdef ELEVATED_ROADS\nin float a_circle_z_offset;\n#endif\nout vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*v
2iew_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() {\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\n#ifdef ELEVATED_ROADS\nworld_center.z+=a_circle_z_offset+ELEVATION_BIAS;\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:nn("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:nn('#include "_prelude_fog.fragment.glsl"\nuniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
2\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\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:nn("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}","in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:nn("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",'#include "_prelude_terrain.vertex.glsl"\nin vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition;\n#endif\nout float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec3 proj_pos=a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation);\n#ifdef PROJECTION_GLOBE_VIEW\n#ifndef PROJECTED_POS_ON_VIEWPORT\nvec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,a_anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition);\n#endif\n#endif\nvec4 projectedPoint=u_matrix*vec4(proj_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:nn("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}","in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:nn("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",'#include "_prelude_terrain.vertex.glsl"\nin vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;\n#endif\nout vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1
2);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}'),elevatedStructuresDepth:nn("void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=vec4(0.);\n#endif\n}","in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:nn("#ifdef DEPTH_RECONSTRUCTION\nin float v_height;\n#endif\nvoid main() {\n#ifdef DEPTH_RECONSTRUCTION\nif (v_height >=0.0)\ndiscard;\n#else\n#ifdef FEATURE_CUTOUT\napply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord);\n#endif\n#endif\nglFragColor=vec4(1.0,0.0,0.0,1.0);}","in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth;\n#ifdef DEPTH_RECONSTRUCTION\nout float v_height;\n#endif\nvoid main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);\n#ifdef DEPTH_RECONSTRUCTION\nif (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;\n#endif\ngl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}"),elevatedStructures:nn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin vec3 v_normal;in float v_height;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;\n#endif\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
2vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color)\n{color=sRGBToLinear(color);color=color*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);color=linearTosRGB(color.rgb);return color;}uniform float u_emissive_strength;\n#pragma mapbox: define highp vec4 structure_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 structure_color\nvec3 color=structure_color.xyz;\n#ifdef LIGHTING_3D_MODE\nvec3 normal=normalize(v_normal);vec3 transformed_normal=vec3(-normal.xy,normal.z);float ndotl=calculate_NdotL(transformed_normal);float emissive_strength=u_emissive_strength;emissive_strength=0.0;vec3 emissive_color=compute_view_dependent_emissive_color(ndotl,emissive_strength,color.xyz);\n#ifdef RENDER_SHADOWS\nfloat shadowed_lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,transformed_normal,shadowed_lighting_factor);\n#else\ncolor=apply_lighting(color,transformed_normal);\n#endif\ncolor=mix(color,emissive_color,emissive_strength);if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);}\n#endif\n#ifdef FOG\ncolor=fog_apply(color,v_fog_pos);\n#endif\nvec4 out_color=vec4(color,1.0);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_height);\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\nglFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;in float a_height;in vec3 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth;\n#endif\n#pragma mapbox: define highp vec4 structure_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 structure_color\nv_normal=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(a_pos,a_height);gl_Position=u_matrix*vec4(pos,1);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(-v_normal.xy,v_normal.z));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fill:nn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nuniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\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_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=opacity;\n#ifdef INDICATOR_CUTOUT\nif (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);}\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\nglFragColor=out_color;\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;out highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=z_offset;\n#endif\n}'),fillOutline:nn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
2\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nuniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\n#ifdef FLIP_Y\nv_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;\n#else\nv_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillOutlinePattern:nn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nuniform float u_emissive_strength;\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nin highp vec2 v_pos;in highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_PATTERN_TRANSITION\nvec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;out highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);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);\n#ifdef FLIP_Y\nv_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;\n#else\nv_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillPattern:nn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nin highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_PATTERN_TRANSITION\nvec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\nout_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*opacity;\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
2\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;out highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillExtrusion:nn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec4 v_color;in vec4 v_flat;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\nuniform lowp float u_opacity;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec2 v_ao;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nin vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nin highp vec3 v_normal;\n#endif\nuniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nin float v_flood_radius;in float v_has_floodlight;\n#endif\nin float v_height;\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float emissive_strength\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nvec3 normal=normalize(v_normal);\n#endif\nfloat z;vec4 color=v_color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);\n#ifdef LIGHTING_3D_MODE\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#else\ncolor=mix(v_color,v_roof_color,z);\n#endif\n#endif\nfloat h=max(0.0,v_height);float ao_shade=1.0;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\n#else\ncolor.rgb*=ao_shade;\n#endif\n#else\ncolor.rgb*=ao_shade;\n#endif\n#endif\n#ifdef LIGHTING_3D_MODE\nfloat flood_radiance=0.0;
2\n#ifdef FLOOD_LIGHT\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef FLOOD_LIGHT\nfloat ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);\n#else\nfloat shadowed_lighting_factor;\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\ncolor.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#endif\n#else\ncolor.rgb=apply_lighting(color.rgb,normal);\n#ifdef FLOOD_LIGHT\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\n#endif\n#endif\ncolor.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\n#endif\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color,h);\n#endif\n#ifdef FEATURE_CUTOUT\ncolor=apply_feature_cutout(color,gl_FragCoord);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_material_table.vertex.glsl"\nuniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nuniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nout vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nout highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec2 v_ao;\n#endif\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nout float v_flood_radius;out float v_has_floodlight;\n#endif\nout float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define highp float flood_light_wall_radius\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp float emissive_strength\nvoid main() {DECLARE_MATERIAL_TABLE_INFO\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize highp float flood_light_wall_radius\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp float emissive_strength\nbase*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nv_normal=normal;\n#endif\nbase=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;
2float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat cutoff=1.0;vec3 scaled_pos=pos;\n#ifdef RENDER_CUTOFF\nvec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);\n#ifdef CLIP_ZERO_TO_ONE\ncutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w);\n#else\ncutoff=cutoff_opacity(u_cutoff_params,ground.z);\n#endif\nif (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\ngl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifndef LIGHTING_3D_MODE\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#endif\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(ce
2ntroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\nfloat is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;\n#endif\nv_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0);\n#else\nv_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),fillExtrusionDepth:nn("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}",'#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_material_table.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nin vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp vec4 color\nout highp float v_depth;void main() {DECLARE_MATERIAL_TABLE_INFO\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp vec4 color\nbase*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nvec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\n#else\npos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}'),fillExtrusionPattern:nn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nin vec3 v_normal;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\nin highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump vec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\n#pragma mapbox: define highp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\n#pragma mapbox: initialize highp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\nvec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
2),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,height);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_material_table.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nout highp vec2 v_pos;out vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nout vec3 v_normal;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump vec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\n#pragma mapbox: define highp float pixel_ratio\n#pragma mapbox: define highp float line_width\nvoid main() {DECLARE_MATERIAL_TABLE_INFO\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\n#pragma mapbox: initialize highp float pixel_ratio\n#pragma mapbox: initialize highp float line_width\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.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);
2\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_normal=normal;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}'),groundShadow:nn('#include "_prelude_shadow.fragment.glsl"\nprecision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\nvoid main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);\n#ifdef RENDER_CUTOFF\nshadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));\n#endif\n#ifdef FOG\nshadow=mix(shadow,vec3(1.0),v_fog_opacity);\n#endif\n#ifdef INDICATOR_CUTOUT\nshadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r);\n#endif\nglFragColor=vec4(shadow,1.0);}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);\n#endif\n}'),fillExtrusionGroundEffect:nn("uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;\n#ifdef SDF_SUBPASS\nin highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}\n#ifdef FOG\nin highp float v_fog;\n#endif\n#endif\nvoid main() {\n#ifdef CLEAR_SUBPASS\nvec4 color=vec4(1.0);\n#ifdef CLEAR_FROM_TEXTURE\ncolor=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));\n#endif\nglFragColor=color;\n#else\n#ifdef SDF_SUBPASS\nhighp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;\n#ifdef FOG\nfog=v_fog;\n#endif\n#ifdef RENDER_CUTOFF\nfog*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));\n#else\n#ifdef USE_MRT1\nout_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0);\n#else\nvec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);\n#ifdef OVERDRAW_INSPECTOR\ncolor=vec4(1.0);\n#endif\nglFragColor=color;\n#endif\n#endif\nHANDLE_WIREFRAME_DEBUG;\n#endif\n}",'#include "_prelude_fog.vertex.glsl"\nin highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;\n#ifdef SDF_SUBPASS\nout highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;\n#ifdef FOG\nout highp float v_fog;\n#endif\n#endif\nuniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;
2\n#pragma mapbox: define highp float flood_light_ground_radius\nconst float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {\n#pragma mapbox: initialize highp float flood_light_ground_radius\nvec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;\n#ifdef SDF_SUBPASS\nv_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);\n#ifdef FOG\nv_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);\n#endif\n#endif\nfloat hidden_by_landmark=0.0;\n#ifdef HAS_CENTROID\nhidden_by_landmark=a_hidden_by_landmark;\n#endif\nfloat isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}'),hillshadePrepare:nn("precision highp float;uniform highp sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:nn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef LIGHTING_3D_MODE\nglFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);\n#endif\n#ifdef FOG\nglFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));\n#endif\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
2\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),line:nn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform highp vec2 u_trim_gradient_mix_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv;\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef VARIABLE_LINE_WIDTH\nin float stub_side;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;in vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nfloat 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\n#pragma mapbox: define mediump float side_z_offset\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\n#pragma mapbox: define lowp float emissive_strength\nfloat linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float side_z_offset\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\n#pragma mapbox: initialize lowp float emissive_strength\nfloat dist=length(v_normal)*v_width2.s;\n#ifdef VARIABLE_LINE_WIDTH\nblur=mix(blur,0.0,stub_side);\n#endif\nfloat blur2=(u_width_scale*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 VARIABLE_LINE_WIDTH\nalpha=mix(alpha,1.0,stub_side);\n#endif\nalpha=side_z_offset > 0.0 ? 1.0-alpha : alpha;\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture(u_dash_image,v_tex).r;
2float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trim_alpha=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);highp float gradient_trim_color_mix_factor=0.0;\n#ifdef RENDER_LINE_GRADIENT\ngradient_trim_color_mix_factor=smoothstep(u_trim_gradient_mix_range.x,u_trim_gradient_mix_range.y,line_progress);\n#endif\nhighp vec4 trim_color=mix(u_trim_color,out_color,gradient_trim_color_mix_factor);out_color=mix(u_trim_gradient_mix_range.x < 1.0 ? color : out_color,trim_color,transition_factor);trim_alpha=1.0-transition_factor;}\n#endif\nif (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}\n#ifdef RENDER_LINE_BORDER\n#ifndef VARIABLE_LINE_WIDTH\nfloat edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}}\n#endif\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\nout_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=(alpha*opacity);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\nglFragColor=out_color;\n#ifdef DUAL_SOURCE_BLENDING\nglFragColorSrc1=vec4(vec3(0.0),emissive_strength);\n#else\n#ifdef USE_MRT1\nout_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define EXTRUDE_SCALE 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH)\nin vec3 a_z_offset_width;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nin highp vec3 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nin float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform highp float u_floor_width_scale;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv;\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef VARIABLE_LINE_WIDTH\nout float stub_side;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float side_z_offset\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float side_z_offset\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\n#pragma mapbox: initialize lowp float emissive_strength\nfloat a_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset=a_z_offset_width.x;\n#endif\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;offset=-1.0*offset*u_width_scale;gapwidth=gapwidth/2.0;float halfwidth;\n#ifdef VARIABLE_LINE_WIDTH\nbool left=normal.y==1.0;float left_width=a_z_offset_width.y;float right_width=a_z_offset_width.z;halfwidth=(u_width_scale*(left ? left_width : right_width))/2.0;a_z_offset+=left ? side_z_offset : 0.0;v_normal=side_z_offset > 0.0 && left ? vec2(0.0) : v_normal;offset=border_width >
2 0.0 ? (left_width+right_width)*u_width_scale*0.5 : offset;halfwidth=border_width > 0.0 ? border_width*u_width_scale*0.5 : halfwidth;bool zero_right_width=border_width==0.0 && right_width==0.0;stub_side=zero_right_width ?-normal.y : 0.0;v_normal=!left && zero_right_width ? vec2(0.0) : v_normal;ANTIALIASING=!left && zero_right_width ? 0.0 : ANTIALIASING;\n#else\nhalfwidth=(u_width_scale*width)/2.0;\n#endif\nfloat 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);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat epsilon=0.0001;float extrude_length_without_perspective=max(length(dist),epsilon);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),epsilon);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nhighp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2];\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=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress);\n#else\nv_uv=vec3(a_uv_x,0.0,line_progress);\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*u_floor_width_scale),(-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#ifdef INDICATOR_CUTOUT\nv_z_offset=a_z_offset;\n#endif\n}'),linePattern:nn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;
2uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef LINE_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nin vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef LINE_JOIN_NONE\nin vec2 v_pattern_data;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#pragma mapbox: define mediump vec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize lowp float emissive_strength\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\n#ifdef LINE_PATTERN_TRANSITION\nvec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);}\n#endif\n#ifdef LINE_JOIN_NONE\nhighp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}\n#endif\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting_with_emission_ground(color,emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\ncolor.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\ncolor.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color,v_z_offset);\n#endif\nglFragColor=color;\n#ifdef DUAL_SOURCE_BLENDING\nglFragColorSrc1=vec4(vec3(0.0),emissive_strength);\n#else\n#ifdef USE_MRT1\nout_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
2\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\nin vec3 a_z_offset_width;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 a_packed;\n#endif\nin highp float a_linesofar;\n#ifdef LINE_JOIN_NONE\nin highp vec3 a_pattern_data;out vec2 v_pattern_data;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nout highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define mediump float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float floorwidth\n#pragma mapbox: define mediump vec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize mediump float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize lowp float emissive_strength\nfloat a_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset=a_z_offset_width.x;\n#endif\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);\n#ifdef LINE_JOIN_NONE\nv_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=a_z_offset;\n#endif\n}'),raster:nn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_raster_array.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nin float v_split_fade;\n#endif\nuniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;\n#ifndef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;\n#endif\n#ifdef RASTER_COLOR\nuniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;\n#endif\nvoid main() {vec4 color0,color1,color;vec2 value;\n#ifdef RASTER_COLOR\n#ifdef RASTER_ARRAY\n#ifdef RASTER_ARRAY_LINEAR\nvalue=mix(\nraTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#else\nvalue=mix(\nraTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#endif\nif (value.y > 0.0) value.x/=value.y;\n#else\ncolor=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);\n#endif\ncolor=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;\n#else\ncolor0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);\n#endif\ncolor.a*=u_opacity;\n#ifdef GLOBE_POLES\ncolor.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);\n#endif\nvec3 rgb=color.rgb;rgb=vec3(\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef PROJECTION_GLOBE_VIEW\nglFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));\n#endif\n#ifdef RENDER_CUTOFF\nglFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
2\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;in vec2 a_texture_pos;\n#endif\nout vec2 v_pos0;out vec2 v_pos1;out float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nout float v_split_fade;\n#endif\nvoid main() {vec2 uv;\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos ,1.0);uv=a_uv;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);\n#endif\n#else\nfloat w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); \nv_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];
2if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\ngl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;\n#ifdef RENDER_CUTOFF\nv_depth=gl_Position.z;\n#endif\n}'),rasterParticle:nn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\nin vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nuv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}'),rasterParticleDraw:nn("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",'#include "_prelude_raster_particle.glsl"\nin float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(\nmod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}'),rasterParticleTexture:nn("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:nn('#include "_prelude_raster_particle.glsl"\nuniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;
2vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow(\nlinearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)\n);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}',"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:nn('#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor;\n#ifdef ICON_TRANSITION\nuniform float u_icon_transition;\n#endif\n#ifdef COLOR_ADJUSTMENT\nuniform mat4 u_color_adj_mat;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#else\n#ifdef RENDER_SHADOWS\nin highp float v_z_offset;\n#endif\n#endif\nin vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nin vec2 v_tex_b;\n#endif\nin float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nin float is_sdf;in vec2 v_tex_a_icon;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\nvec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];\n#ifdef RENDER_TEXT_AND_SYMBOL\nif (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nreturn;}\n#endif\n#ifdef RENDER_SDF\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;\n#else\n#ifdef ICON_TRANSITION\nvec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);\n#else\nout_color=texture(u_texture,v_tex_a);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef COLOR_ADJUSTMENT\nout_color=u_color_adj_mat*out_color;\n#endif\n#endif\nout_color*=opacity*fade_opacity;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef TERRAIN\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#else\nout_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
2\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#define USING_APPEARANCE 1.0\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_auto_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\n#endif\n#ifdef ICON_TRANSITION\nin vec2 a_texb;\n#endif\n#ifdef OCCLUSION_QUERIES\nin float a_occlusion_query_opacity;\n#endif\n#ifdef ELEVATED_ROADS\nin vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#else\n#ifdef RENDER_SHADOWS\nout highp float v_z_offset;\n#endif\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_inv_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nout vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nout vec2 v_tex_b;\n#endif\nout float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nout float is_sdf;out vec2 v_tex_a_icon;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\n#pragma mapbox: define lowp float occlusion_opacity\n#pragma mapbox: define lowp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\n#pragma mapbox: initialize lowp float occlusion_opacity\n#pragma mapbox: initialize lowp float z_offset\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 a_size_max= floor(a_size[1]*0.5);float a_apperance=a_size[1]-2.0*a_size_max;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 (a_apperance==USING_APPEARANCE) {size=a_size_max/128.0;} else if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size_max,u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_auto_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;\n#endif\nvec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\n#ifdef PROJECTED_POS_ON_VIEWPORT\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);\n#else\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); \n#endif\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\n#ifdef Z_OFFSET\nz+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0;\n#else\nz+=u_pitch_with_map ? z_offset : 0.0;\n#endif\nfloat occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));\n#ifdef DEPTH_OCCLUSION\nfloat depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;\n#endif\n#ifdef OCCLUSION_QUERIES\nfloat occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;\n#endif\n#ifdef Z_TEST_OCCLUSION\nout_fade_opacity*=occlusion_opacity;\n#endif\nfloat alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos;\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);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;\n#else\n#ifdef ELEVATED_ROADS\nvec3 xAxis=vec3(a_x_axis.xy,a_x_axis.z*u_normal_scale);vec3 yAxis=vec3(a_y_axis.xy,a_y_axis.z*u_normal_scale);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;\n#else\npos=vec3(projected_pos.xy/projected_pos.w+offset,z);\n#endif\n#endif\ngl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;\n#ifdef RENDER_TEXT_AND_SYMBOL\nis_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;\n#endif\n#ifdef ICON_TRANSITION\nv_tex_b=a_texb/u_texsize;\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=e;\n#else\n#ifdef RENDER_SHADOWS\nv_z_offset=e;\n#endif\n#endif\n}'),terrainRaster:nn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nuniform sampler2D u_image1;uniform float u_emissive_texture_available;\n#endif\nin vec2 v_pos0;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#endif\nuniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;\n#ifdef LIGHTING_3D_MODE\nconst vec3 normal=vec3(0.0,0.0,1.0);\n#ifdef RENDER_SHADOWS\nfloat cutoffOpacity=1.0;\n#ifdef RENDER_CUTOFF\ncutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);\n#endif\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nfloat emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;vec3 unlit_base=image_color.rgb*(1.0-emissive_strength);vec3 emissive_base=image_color.rgb*emissive_strength;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;\n#else\nfloat lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));\n#endif\n#else\nfloat lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nfloat emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;color.rgb=mix(color.rgb,image_color.rgb,emissive_strength);color.a=1.0;\n#endif\n#endif\n#else\ncolor=image_color;\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
2\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#endif\nvoid main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);\n#endif\n}'),terrainDepth:nn("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}'),skybox:nn('#include "_prelude_fog.fragment.glsl"\nin lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
2nd-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',Fr),skyboxGradient:nn('#include "_prelude_fog.fragment.glsl"\nin highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',Fr),skyboxCapture:nn
vendor: 3,689 bytes, line 2
2("\nin highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}","in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;
2v_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:nn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nuniform sampler2D u_image1;uniform float u_emissive_texture_available;\n#endif\nuniform float u_far_z_cutoff;in vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nhighp vec2 uv=gl_FragCoord.xy/u_viewport;\n#ifdef FLIP_Y\nuv.y=1.0-uv.y;\n#endif\nhighp 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 norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nfloat emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : raster.a;raster=apply_lighting_with_emission_ground(raster,emissive_strength);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias);\n#else\nraster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nfloat emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : color.a;color=apply_lighting_with_emission_ground(color,emissive_strength);color.a=1.0;\n#else\ncolor=apply_lighting_ground(color);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;\n#endif\nout vec2 v_pos0;void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);globe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}'),globeAtmosphere:nn('#include "_prelude_fog.fragment.glsl"\nuniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_atmosphere_fog_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {\n#ifdef ALPHA_PASS\nglFragColor=vec4(0,0,0,0);return;\n#else\n#ifdef NATIVE\nglFragColor=vec4(1,1,1,1);\n#else\nglFragColor=vec4(0,0,0,1);\n#endif\nreturn;\n#endif\n}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_atmosphere_fog_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_atmosphere_fog_color.rgb;vec3 color_stop_1=u_high_color.rgb;
2vec3 color_stop_2=u_space_color.rgb;\n#ifdef ALPHA_PASS\nfloat a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);\n#else\nvec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t);\n#endif\n}',"in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}"),model:nn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_opacity;\n#ifdef DITHERED_DISCARD\nuniform float u_dithered_discard_threshold;\n#endif\nuniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;\n#endif\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nuniform vec4 u_occlusionTextureTransform;\n#endif\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#ifdef HAS_ATTRIBUTE_a_pbr\nin lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;\n#endif\n#ifdef HAS_TEXTURE_u_baseColorTexture\nuniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;\n#endif\n#ifdef HAS_TEXTURE_u_metallicRoughnessTexture\nuniform sampler2D u_metallicRoughnessTexture;\n#endif\n#ifdef HAS_TEXTURE_u_occlusionTexture\nuniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;\n#endif\n#ifdef HAS_TEXTURE_u_normalTexture\nuniform sampler2D u_normalTexture;\n#endif\n#ifdef HAS_TEXTURE_u_emissionTexture\nuniform sampler2D u_emissionTexture;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nin highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;\n#ifdef DEPTH_D24\nhighp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}\n#else\nhighp float unpack_depth_rgba(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;\n#ifdef FLIP_Y\ncoord.y=1.0-coord.y;\n#endif\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depthTexture,coord).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));\n#endif\nreturn v_depth > depth+0.0005;}\n#endif\n#define saturate(_x) clamp(_x,0.,1.)\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)\n{\n#ifdef LIGHTING_3D_MODE\nvec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));\n#endif\nreturn apply_lighting(albedo,transformed_normal,lighting_factor);\n#else\nvec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-light
2Color),vec3(1.0));return c3;\n#endif\n}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;\n#ifdef HAS_ATTRIBUTE_a_color_3f\nalbedo*=vec4(color_3f,1.0);\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#else\n#ifdef HAS_ATTRIBUTE_a_color_4f\nalbedo*=color_4f;\n#endif\n#endif\n#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)\nvec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}\n#ifdef UNPREMULT_TEXTURE_IN_SHADER\nif(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;\n#endif\nif(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}\n#endif\nvec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\nreturn color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {\n#ifdef HAS_TEXTURE_u_normalTexture\nhighp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;\n#ifdef FLIP_Y\nT=-T;B=-B;\n#endif\nhighp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;\n#else\nreturn mat3(1.0);\n#endif\n}highp vec3 getNormal(){highp vec3 n;\n#ifdef HAS_ATTRIBUTE_a_normal_3f\nn=normalize(normal_3f);\n#else\nhighp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));\n#ifdef FLIP_Y\nn=normalize(cross(fdx,fdy));\n#else\nn=normalize(cross(fdx,fdy))*-1.0;\n#endif\n#endif\n#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);\n#endif\nreturn n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;\n#ifdef HAS_ATTRIBUTE_a_pbr\nmat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;\n#endif\n#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) \nvec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;\n#endif\nconst float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)\n{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)\n{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)\n{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)\n{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)\n{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)\n{\n#ifdef LIGHTING_3D_MODE\nreturn mat.diffuseColor;\n#else\nreturn mat.diffuseColor/PI;\n#endif\n}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)\n{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)\n{vec3 env_light=vec3(0.65,0.65,0.65);\n#ifdef LIGHTING_3D_MODE\nfloat ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;\n#endif\nvec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)\n{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=NdotL;\n#endif\nvec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
2Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;\n#if !defined(LIGHTING_3D_MODE)\nconst vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);\n#endif\ncolor*=intensityFactor;return color;}void main() {\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nif (isOccluded()) {discard;}\n#endif\nvec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;\n#ifdef LIGHTING_3D_MODE\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\n#endif\nvec4 finalColor;\n#ifdef DIFFUSE_SHADED\nvec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);\n#ifdef HAS_TEXTURE_u_occlusionTexture\nfloat ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;\n#endif\nfinalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;\n#else\nMaterial mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;\n#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nvec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;\n#else\nvec2 uv=uv_2f;\n#endif\nao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;\n#endif\nvec4 emissive=u_emissiveFactor;\n#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nemissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nfloat emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;\n#endif\ncolor+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;\n#ifdef HAS_ATTRIBUTE_a_pbr\nfloat resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;\n#ifdef APPLY_LUT_ON_GPU\ncolor_mix=applyLUT(u_lutTexture,color_mix);\n#endif\ncolor=mix(color,color_mix,min(1.0,resEmission));\n#ifdef HAS_ATTRIBUTE_a_color_4f\nfloat distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
2y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);\n#endif\n#endif\nvec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);\n#endif\n#ifdef DITHERED_DISCARD\nif (abs(u_dithered_discard_threshold) < 1.0) {float ditherValue=fract(52.9829189*fract(0.06711056*gl_FragCoord.x+0.00583715*gl_FragCoord.y));float compareValue=mix(1.0-ditherValue,ditherValue,step(0.0,u_dithered_discard_threshold));if (abs(u_dithered_discard_threshold) < compareValue) {discard;}}\n#endif\n#ifdef FOG\nfinalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));\n#endif\n#ifdef RENDER_CUTOFF\nfinalColor*=v_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\nfinalColor=applyCutout(finalColor,v_position_height.w);\n#endif\n#ifdef FEATURE_CUTOUT\nfinalColor=apply_feature_cutout(finalColor,gl_FragCoord);\n#endif\nglFragColor=finalColor;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr\n#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength\nuniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_normal_matrix;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;\n#endif\nout vec4 v_position_height;out lowp vec4 v_color_mix;\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nout highp float v_depth;\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\nout lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;\n#endif\nvec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute-custom highp vec4 pbr\n#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength\nhighp mat4 normal_matrix;\n#ifdef INSTANCED_ARRAYS\nnormal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\nnormal_matrix=u_normal_matrix;\n#endif\nvec3 local_pos;mat3 rs;\n#ifdef MODEL_POSITION_ON_GPU\nvec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;\n#else\nlocal_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);\n#endif\nv_position_height.w=a_pos_3f.z;\n#ifdef HAS_ATTRIBUTE_a_pbr\nvec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(local_pos);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nv_depth=gl_Position.z/gl_Position.w;\n#ifdef CLIP_ZERO_TO_ONE\nv_depth=-1.0+2.0*v_depth; \n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nfloat x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);
2\n#else\nnormal_3f=vec3(normal_matrix*vec4(normal_3f,0));\n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#ifdef HAS_ATTRIBUTE_a_color_4f\nv_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);\n#ifdef NORMAL_OFFSET\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nvec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#else\nvec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#endif\n#endif\n#endif\nv_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;\n#endif\n}'),modelDepth:nn("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}","in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;\n#ifdef MODEL_POSITION_ON_GPU\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_instance;\n#endif\nuniform highp mat4 u_node_matrix;\n#endif\nvoid main() {\n#ifdef MODEL_POSITION_ON_GPU\nhighp mat4 instance;\n#ifdef INSTANCED_ARRAYS\ninstance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\ninstance=u_instance;\n#endif\nvec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;
2rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);\n#else\ngl_Position=u_matrix*vec4(a_pos_3f,1);\n#endif\nv_depth=gl_Position.z/gl_Position.w;}"),stars:nn("in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)\n{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}","\nin vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}"),snowParticle:nn("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}","\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; \nuniform float u_horizontalOscillationRate; \nuniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}"),rainParticle:nn("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}","\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity; \nuniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;
2pos*=halfBoxSize; \npos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}"),vignette:nn("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),occlusion:nn("uniform vec4 u_color;void main() {glFragColor=u_color;}",'#include "_prelude_terrain.vertex.glsl"\nin highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos;\n#ifdef TERRAIN\nfloat e=elevation(world_pos.xy);world_pos.z+=e;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}')};function rn(e,t){const i=e.split("\n");for(let r of i){if(r=r.trimStart(),"#"!==r[0])continue;if(!r.includes("if"))continue;if(r.startsWith("#endif"))continue;const e=r.match($r);if(e)for(const i of e)Zr.has(i)||t.add(i)}}function nn(e,t){const i=new Set,r=[],n=[];e=e.replace(qr,(e,t)=>(n.push(t),"")),t=t.replace(qr,(e,t)=>(r.push(t),""));let o=new Set(Wr);rn(e,o),rn(t,o);for(const s of[...r,...n])Yr[s]||(Yr[s]=new Set,rn(Xr[s],Yr[s])),o=new Set([...o,...Yr[s]]);return{fragmentSource:e=e.replace(Hr,(e,t,r,n,o)=>(i.add(o),"define"===t?`\n#ifndef HAS_UNIFORM_u_${o}\nin ${r} ${n} ${o};\n#else\nuniform ${r} ${n} u_${o};\n#endif\n`:"initialize"===t?`\n#ifdef HAS_UNIFORM_u_${o}\n ${r} ${n} ${o} = u_${o};\n#endif\n`:"define-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${o}\n in ${r} ${n} ${o};\n#endif\n`:"initialize-attribute"===t?"":void 0)),vertexSource:t=t.replace(Hr,(e,t,r,n,o)=>{const s=`MATERIAL_ATTRIBUTE_OFFSET_${o}`,a="float"===n?"vec2":n,l=`GET_ATTRIBUTE_${a}(a_${o}, materialInfo, ${s})`,c=o.match(/color/)?"color":a;return"define-attribute-vertex-shader-only"===t?`\n#ifdef HAS_ATTRIBUTE_a_${o}\nin ${r} ${n} a_${o};\n#endif\n`:i.has(o)?"define"===t?`\n#ifndef HAS_UNIFORM_u_${o}\nuniform lowp float u_${o}_t;\n #if !defined(${s})\n in ${r} ${a} a_${o};\n #endif\nout ${r} ${n} ${o};\n#else\nuniform ${r} ${n} u_${o};\n#endif\n`:"initialize"===t?"vec4"===c?`\n#ifndef HAS_UNIFORM_u_${o}\n ${o} = a_${o};\n#else\n ${r} ${n} ${o} = u_${o};\n#endif\n`:`\n#if !defined(HAS_UNIFORM_u_${o})\n #ifdef ${s}\n ${o} = unpack_mix_${c}(${l}, u_${o}_t);\n #else\n ${o} = unpack_mix_${c}(a_${o}, u_${o}_t);\n #endif\n#else\n ${r} ${n} ${o} = u_${o};\n#endif\n`:"define-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${o}\n in ${r} ${n} a_${o};\n out ${r} ${n} ${o};\n#endif\n`:"initialize-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${o}\n ${o} = a_${o};\n#endif\n`:void 0:"define"===t?`\n#ifndef HAS_UNIFORM_u_${o}\nuniform lowp float u_${o}_t;\n #if !defined(${s})\n in ${r} ${a} a_${o};\n #endif\n#else\nuniform ${r} ${n} u_${o};\n#endif\n`:"define-instanced"===t?"mat4"===c?`\n#ifdef INSTANCED_ARRAYS\nin vec4 a_${o}0;\nin vec4 a_${o}1;\nin vec4 a_${o}2;\nin vec4 a_${o}3;\n#else\nuniform ${r} ${n} u_${o};\n#endif\n`:`\n#ifdef INSTANCED_ARRAYS\nin ${r} ${a} a_${o};\n#else\nuniform ${r} ${n} u_${o};\n#endif\n`:"initialize-attribute-custom"===t?`\n#ifdef HAS_ATTRIBUTE_a_${o}\n ${r} ${n} ${o} = a_${o};\n#endif\n`:"vec4"===c?`\n#ifndef HAS_UNIFORM_u_${o}\n #ifdef ${s}\n ${r} ${n} ${o} = ${l};\n #else\n ${r} ${n} ${o} = a_${o};\n #endif\n#else\n ${r} ${n} ${o} = u_${o};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${o}\n #ifdef ${s}\n ${r} ${n} ${o} = unpack_mix_${c}(${l}, u_${o}_t);\n #else\n ${r} ${n} ${o} = unpack_mix_${c}(a_${o}, u_${o}_t);\n #endif\n#else\n ${r} ${n} ${o} = u_${o};\n#endif\n`}),usedDefines:o,vertexIncludes:r,fragmentIncludes:n}}class on{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(e,t,i,r,n,o,s,a){this.context=e;let l=this.boundPaintVertexBuffers.length!==r.length;for(let h=0;!l&&h<r.length;h++)this.boundPaintVertexBuffers[h]!==r[h]&&(l=!0);let c=this.boundDynamicVertexBuffers.length!==s.length;for(let h=0;!c&&h<s.length;h++)this.boundDynamicVertexBuffers[h]!==s[h]&&(c=!0);if(!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||l||c||this.boundIndexBuffer!==n||this.boundVertexOffset!==o)this.freshBind(t,i,r,n,o,s,a);else{e.bindVertexArrayOES.set(this.vao);for(const i of s)i&&(i.bind(),a&&i.instanceCount&&i.setVertexAttribDivisor(e.gl,t,a));n&&n.dynamicDraw&&n.bind()}}freshBind(e,t,i,r,n,o,s){const a=this.context,l=a.gl;this.vao&&this.destroy(),this.vao=a.gl.createVertexArray(),a.bindVertexArrayOES.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=n,this.boundDynamicVertexBuffers=o,t.enableAttributes(l,e),t.bind(),t.setVertexAttribPointers(l,e,n);for(const c of i)c.enableAttributes(l,e),c.bind(),c.setVertexAttribPointers(l,e,n);for(const c of o)c&&(c.enableAttributes(l,e),c.bind(),c.setVertexAttribPointers(l,e,n),s&&c.instanceCount&&c.setVertexAttribDivisor(l,e,s));r&&r.bind()}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function sn(t,i){const r=Math.pow(2,i.canonical.z),n=i.canonical.y;return[new e.ae(0,n/r).toLngLat().lat,new e.ae(0,(n+1)/r).toLngLat().lat]}function an(t,i,r,n,o,s,a){const l=t.context,c=l.gl,h=r.hillshadeFBO;if(!h)return;t.prepareDrawTile();const u=t.isTileAffectedByFog(i),d=[];t.terrain&&t.terrain.renderingToTexture&&"mrt-fallback"===t.emissiveMode&&d.push("USE_MRT1");const p=t.getOrCreateProgram("hillshade",{overrideFog:u,defines:d});l.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,h.colorAttachment0.get());const f=((t,i,r,n)=>{const o=r.paint.get("hillshade-shadow-color"),s="none"===r.paint.get("hillshade-shadow-color-use-theme").
vendor: 5,660 bytes, line 2
2constantOr("default"),a=r.paint.get("hillshade-highlight-color"),l="none"===r.paint.get("hillshade-highlight-color-use-theme").constantOr("default"),c=r.paint.get("hillshade-accent-color"),h="none"===r.paint.get("hillshade-accent-color-use-theme").constantOr("default"),u=r.paint.get("hillshade-emissive-strength");let d=e.an(r.paint.get("hillshade-illumination-direction"));if("viewport"===r.paint.get("hillshade-illumination-anchor"))d-=t.transform.angle;else if(t.style&&t.style.enable3dLights()&&t.style.directionalLight){const i=t.style.directionalLight.properties.get("direction"),r=e.d4(i.x,i.y,i.z);d=e.an(r[1])}const p=!t.options.moving;return{u_matrix:n||t.transform.calculateProjMatrix(i.tileID.toUnwrapped(),p),u_image:0,u_latrange:sn(0,i.tileID),u_light:[r.paint.get("hillshade-exaggeration"),d],u_shadow:o.toPremultipliedRenderColor(s?null:r.lut),u_highlight:a.toPremultipliedRenderColor(l?null:r.lut),u_emissive_strength:u,u_accent:c.toPremultipliedRenderColor(h?null:r.lut)}})(t,r,n,t.terrain?i.projMatrix:null);t.uploadCommonUniforms(l,p,i.toUnwrapped());const{tileBoundsBuffer:m,tileBoundsIndexBuffer:_,tileBoundsSegments:g}=t.getTileBoundsBuffers(r);p.draw(t,c.TRIANGLES,o,s,a,Qi.disabled,f,n.id,m,_,g)}function ln(t,i,r){if(!i.needsDEMTextureUpload)return;const n=t.context,o=n.gl;n.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||t.getTileTexture(r.stride);const s=r.getPixels();i.demTexture?i.demTexture.update(s,{premultiply:!1}):i.demTexture=new e.T(n,s,o.R32F,{premultiply:!1}),i.needsDEMTextureUpload=!1}function cn(t,i,r){const n=t.context,o=n.gl;if(!i.dem)return;const s=i.dem;if(n.activeTexture.set(o.TEXTURE1),ln(t,i,s),!i.demTexture)return;i.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE);const a=s.dim;n.activeTexture.set(o.TEXTURE0);let l=i.hillshadeFBO;if(!l){const t=new e.T(n,{width:a,height:a,data:null},o.RGBA8);t.bind(o.LINEAR,o.CLAMP_TO_EDGE),l=i.hillshadeFBO=n.createFramebuffer(a,a,1,"renderbuffer"),l.colorAttachment0.set(t.texture)}n.bindFramebuffer.set(l.framebuffer),n.viewport.set([0,0,a,a]);const{tileBoundsBuffer:c,tileBoundsIndexBuffer:h,tileBoundsSegments:u}=t.getMercatorTileBoundsBuffers(),d=[];t.linearFloatFilteringSupported()&&d.push("TERRAIN_DEM_FLOAT_FORMAT"),t.terrain&&t.terrain.renderingToTexture&&"mrt-fallback"===t.emissiveMode&&d.push("USE_MRT1"),t.getOrCreateProgram("hillshadePrepare",{defines:d}).draw(t,o.TRIANGLES,Wi.disabled,Yi.disabled,Zi.unblended,Qi.disabled,((t,i)=>{const r=i.stride,n=e.bC();return e.ce(n,0,e.al,-e.al,0,0,1),e.br(n,n,[0,-e.al,0]),{u_matrix:n,u_image:1,u_dimension:[r,r],u_zoom:t.overscaledZ}})(i.tileID,s),r.id,c,h,u),i.needsHillshadePrepare=!1}class hn{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class un extends hn{getDefault(){return e.ao.transparent.toNonPremultipliedRenderColor(null)}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class dn extends hn{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class pn extends hn{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class fn extends hn{getDefault(){return[!0,!0,!0,!0]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class mn extends hn{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class _n extends hn{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class gn extends hn{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class yn extends hn{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class xn extends hn{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}}class vn extends hn{getDefault(){return[0,1]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class bn extends hn{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}}class wn extends hn{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Tn extends hn{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}}class Sn extends hn{getDefault(){const e=this.gl;return[e.ONE,e.ZERO,e.ONE,e.ZERO]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.blendFuncSeparate(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class En extends hn{getDefault(){return e.ao.transparent.toNonPremultipliedRenderColor(null)}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor
vendor: 5,030 bytes, line 2
2(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class In extends hn{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(e,e),this.current=e,this.dirty=!1)}}class An extends hn{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}}class Mn extends hn{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class Cn extends hn{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}let Pn=class extends hn{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}};class Rn extends hn{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class zn extends hn{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Ln extends hn{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class Dn extends hn{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class On extends hn{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class Fn extends hn{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class kn extends hn{getDefault(){return null}set(e){const t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Bn extends hn{getDefault(){return null}set(e){this.gl&&(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}}class Nn extends hn{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class Vn extends hn{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class Un extends hn{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class jn extends hn{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}}class Gn extends jn{constructor(e,t,i=0){super(e,t),this.attachmentPoint=e.gl.COLOR_ATTACHMENT0+i}setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,this.attachmentPoint,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class qn extends jn{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,this.attachment(),t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Hn extends jn{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,this.attachment(),t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class $n extends qn{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const Zn=(e,t,i,r)=>({u_matrix:e,u_image0:0,u_image1:1,u_skirt_height:t,u_ground_shadow_factor:i,u_emissive_texture_available:r}),Wn=(e,t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_)=>({u_proj_matrix:Float32Array.from(e),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(r),u_merc_matrix:i,u_zoom_transition:n,u_merc_center:o,u_image0:0,u_image1:1,u_frustum_tl:s,u_frustum_tr:a,u_frustum_br:l,u_frustum_bl:c,u_globe_pos:h,u_globe_radius:u,u_viewport:d,u_grid_matrix:_?Float32Array.from(_):new Float32Array(9),u_skirt_height:p,u_far_z_cutoff:f,u_emissive_texture_available:m});function Xn(e,t){return null!=e&&null!=t&&!(!e.hasData()||!t.hasData())&&null!=e.demTexture&&null!=t.demTexture&&e.tileID.key!==t.tileID.key}const Yn=new class{constructor(){this.operations={}}newMorphing(e,t,i,r,n){if(e in this.operations){const t=this.operations[e];t.to.tileID.key!==i.tileID.key&&(t.queued=i)}else this.operations[e]={startTime:r,phase:0,duration:n,from:t,to:i,queued:null}}getMorphValuesForProxy(e){if(!(e in this.operations))return null;const t=this.operations[e];return{from:t.from,to:t.to,phase:t.phase}}update(e){for(const t in this.operations){const i=this.operations[t];for(i.phase=(e-i.startTime)/i.duration;i.phase>
vendor: 6,061 bytes, line 2
2=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()}},Kn={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Jn(e,t,i){if(0===t)return 0;const r=t<1&&514===i?.25/t:1;return 6*Math.pow(1.5,22-e)*Math.max(t,1)*r}function Qn(e,t){const i=1<<e.z;return!t&&(0===e.x||e.x===i-1)||0===e.y||e.y===i-1}function eo(e,t){if(!e.style||!e.style.enable3dLights())return;const i=e.context,r=i.gl;i.activeTexture.set(r.TEXTURE1),t?t.bind(r.LINEAR,r.CLAMP_TO_EDGE):e.emptyTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}const to=e=>({u_matrix:e});function io(t,i,r,n,o){if(o>0){const s=e.o.now(),a=(s-t.timeAdded)/o,l=i?(s-i.timeAdded)/o:-1,c=r.getSource(),h=n.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),u=!i||Math.abs(i.tileID.overscaledZ-h)>Math.abs(t.tileID.overscaledZ-h),d=u&&t.refreshedUponExpiration?1:e.aA(u?a:1-l,0,1);return i?{opacity:1,mix:1-d,isFading:a<1}:{opacity:d,mix:0,isFading:a<1}}return{opacity:1,mix:0,isFading:!1}}class ro extends Ft{constructor(e){const t=_t("mock-dem",{type:"raster-dem",maxzoom:e.transform.maxZoom},e.style.dispatcher,e.style);super("mock-dem",t,!1),t.setEventedParent(this),this._sourceLoaded=!0}_loadTile(e,t){e.state="loaded",t(null)}}class no extends Ft{constructor(e){const t=_t("proxy",{type:"geojson",maxzoom:e.transform.maxZoom},e.style.dispatcher,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(e,t,i){if(e.freezeTileCoverage)return;this.transform=e;const r=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((t,i)=>{if(t[i.key]="",!this._tiles[i.key]){const t=new zt(i,this._source.tileSize*i.overscaleFactor(),e.tileZoom,void 0,void 0,this._source.worldview);t.state="loaded",this._tiles[i.key]=t}return t},{});for(const n in this._tiles)n in r||(this.freeFBO(n),this._tiles[n].unloadVectorData(),delete this._tiles[n])}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 oo extends e.aQ{constructor(e,t,i){super(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y),this.proxyTileKey=t,this.projMatrix=i}}class so extends e.bV{constructor(t,i){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[r,n,o]=function(){const t=new e.bd,i=new e.b0,r=131;t.reserve(17161),i.reserve(33800);const n=e.al/128,o=e.al+n/2,s=o+n;for(let l=-n;l<s;l+=n)for(let i=-n;i<s;i+=n){const r=i<0||i>o||l<0||l>o?24575:0,n=e.aA(Math.round(i),0,e.al),s=e.aA(Math.round(l),0,e.al);t.emplaceBack(n+r,s)}const a=(e,t)=>{const n=t*r+e;i.emplaceBack(n+1,n,n+r),i.emplaceBack(n+r,n+r+1,n+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(r,e.bf.members),this.gridIndexBuffer=s.createIndexBuffer(n),this.gridSegments=e.bg.simpleSegment(0,0,r.length,n.length),this.gridNoSkirtSegments=e.bg.simpleSegment(0,0,r.length,o),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new no(i.map),this.orthoMatrix=e.bC(),e.ce(this.orthoMatrix,"globe"===this.painter.transform.projection.name?.015:0,e.al,0,e.al,0,1);const a=s.gl;this._overlapStencilMode=new Yi({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 ro(i.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1}set style(e){e.on("data",this._onStyleDataEvent.bind(this)),this._style=e,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(t,i,r){if(t&&t.terrain){this._style!==t&&(this.style=t,this._evaluationZoom=void 0);const n=t.terrain.properties,o=0===t.terrain.drapeRenderMode,s=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=e.o.now();const a=t.terrain&&t.terrain.scope,l=n.get("source"),c=o?this._mockSourceCache:t.getSourceCache(l,a);if(!c)return void e.w(`Couldn't find terrain source "${l}".`);if(this.sourceCache=c,this._attenuationRange=t.terrain.getAttenuationRange(),this._exaggeration=s?this.calculateExaggeration(i):n.get("exaggeration"),!i.projection.requiresDraping&&s&&0===this._exaggeration)return void this._disable();this.enabled=!0;const h=()=>{this.sourceCache.used&&e.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.\nThis leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const t=this.getScaledDemTileSize();this.sourceCache.update(i,t,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,h(),this._initializing=!0),h(),i.updateElevation(!0,r),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(i),this._emptyDEMTextureDirty=!0,this._previousZoom=i.zoom}else this._disable()}calculateExaggeration(t){if(this._attenuationRange&&t.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(t.zoom);const i=this._previousCameraAltitude,r=t.getFreeCameraOptions().position.z/t.pixelsPerMeter*t.worldSize;this._previousCameraAltitude=r;
vendor: 4,433 bytes, line 2
2const n=null!=i?r-i:Number.MAX_VALUE;if(Math.abs(n)<2)return this._exaggeration;const o=t.zoom,s=this._style.terrain;if(!this._previousUpdateTimestamp)return s.getExaggeration(o);let a=o-this._previousZoom;const l=this._previousUpdateTimestamp;let c=o;null!=this._evaluationZoom&&(c=this._evaluationZoom,Math.abs(o-c)>.5&&(a=.5*(o-c+a)),a*n<0&&(c+=a)),this._evaluationZoom=c;const h=s.getExaggeration(c),u=h===s.getExaggeration(Math.max(0,c-.1));if(u&&Math.abs(h-this._exaggeration)<.01)return h;let d=Math.min(.1,.00375*(this._updateTimestamp-l));return(u||h<.1||Math.abs(a)<1e-4)&&(d=Math.min(.2,4*d)),e.ak(this._exaggeration,h,d)}resetTileLookupCache(e){this._findCoveringTileCache[e]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(e){"source"===e.dataType&&e.coord?this._clearRenderCacheForTile(e.sourceCacheId,e.coord):"style"===e.dataType&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const e in this._style._mergedSourceCaches)this._style._mergedSourceCaches[e].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(e=>e.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const e=2*this.proxySourceCache.getSource().tileSize;return[e,e]}set useVertexMorphing(e){this._useVertexMorphing=e}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const i=this.proxySourceCache,r=this.painter.transform;this._initializing&&(this._initializing=0===r._centerAltitude&&-1===this.getAtPointOrZero(e.ae.fromLngLat(r.center),-1),this._emptyDEMTextureDirty=!this._initializing);const n=this.proxyCoords=i.getIds().map(e=>{const t=i.getTileByID(e).tileID;return t.projMatrix=r.calculateProjMatrix(t.toUnwrapped()),t});!function(t,i){const r=i.transform.pointCoordinate(i.transform.getCameraPoint()),n=new e.P(r.x,r.y);t.sort((t,i)=>{if(i.overscaledZ-t.overscaledZ)return i.overscaledZ-t.overscaledZ;const r=new e.P(t.canonical.x+(1<<t.canonical.z)*t.wrap,t.canonical.y),o=new e.P(i.canonical.x+(1<<i.canonical.z)*i.wrap,i.canonical.y),s=n.mult(1<<t.canonical.z);return s.x-=.5,s.y-=.5,s.distSqr(r)-s.distSqr(o)})}(n,this.painter);const o=this.proxyToSource||{};this.proxyToSource={},n.forEach(e=>{this.proxyToSource[e.key]={}}),this.terrainTileForTile={};const s=this._style._mergedSourceCaches;for(const e in s){const i=s[e];if(!i.used)continue;if(i!==this.sourceCache&&this.resetTileLookupCache(i.id),this._setupProxiedCoordsForOrtho(i,t[e],o),i.usedForTerrain)continue;const r=t[e];i.getSource().reparseOverscaled&&this._assignTerrainTiles(r)}this.proxiedCoords[i.id]=n.map(e=>new oo(e,e.key,this.orthoMatrix)),this._assignTerrainTiles(n),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(o),this.renderingToTexture=!1;const a={};this._visibleDemTiles=[];for(const e of this.proxyCoords){const t=this.terrainTileForTile[e.key];if(!t)continue;const i=t.tileID.key;i in a||(this._visibleDemTiles.push(t),a[i]=i)}}_assignTerrainTiles(e){this._initializing||e.forEach(e=>{if(this.terrainTileForTile[e.key])return;const t=this._findTileCoveringTileID(e,this.sourceCache);t&&(this.terrainTileForTile[e.key]=t)})}_prepareDEMTextures(){const e=this.painter.context,t=e.gl;for(const i in this.terrainTileForTile){const r=this.terrainTileForTile[i],n=r.dem;!n||r.demTexture&&!r.needsDEMTextureUpload||(e.activeTexture.set(t.TEXTURE1),ln(this.painter,r,n))}}_prepareDemTileUniforms(e,t,i,r){if(!t||null==t.demTexture)return!1;const n=e.tileID.canonical,o=Math.pow(2,t.tileID.canonical.z-n.z),s=r||"";return i[`u_dem_tl${s}`]=[n.x*o%1,n.y*o%1],i[`u_dem_scale${s}`]=o,!0}
vendor: 9,337 bytes, line 2
2get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let e=0;const t=this._visibleDemTiles.reduce((t,i)=>{if(!i.dem)return t;const r=i.dem.tree.minimums[0];return r>0&&e++,t+r},0);return e?t/e:0}_updateEmptyDEMTexture(){const t=this.painter.context,i=t.gl;t.activeTexture.set(i.TEXTURE2);const r=this._getLoadedAreaMinimum(),n=new e.dL({width:1,height:1},new Float32Array([r]));this._emptyDEMTextureDirty=!1;let o=this._emptyDEMTexture;return o?o.update(n,{premultiply:!1}):o=this._emptyDEMTexture=new e.T(t,n,i.R32F,{premultiply:!1}),o}setupElevationDraw(t,i,r){const n=this.painter.context,o=n.gl,s={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};s.u_exaggeration=this.exaggeration();let a=null,l=null,c=1;if(r&&r.morphing&&this._useVertexMorphing){const e=r.morphing.srcDemTile,i=r.morphing.dstDemTile;c=r.morphing.phase,e&&i&&(this._prepareDemTileUniforms(t,e,s,"_prev")&&(l=e),this._prepareDemTileUniforms(t,i,s)&&(a=i))}const h=e=>e&&e.demTexture&&this.painter.linearFloatFilteringSupported()?o.LINEAR:o.NEAREST;let u=null;var d;if(this.enabled?l&&a?(u=a.demTexture,n.activeTexture.set(o.TEXTURE4),l.demTexture.bind(h(l),o.CLAMP_TO_EDGE),s.u_dem_lerp=c):(a=this.terrainTileForTile[t.tileID.key],u=this._prepareDemTileUniforms(t,a,s)?a.demTexture:this.emptyDEMTexture):u=this.emptyDEMTexture,n.activeTexture.set(o.TEXTURE2),u&&(s.u_dem_size=1===(d=u).size[0]?1:d.size[0]-2,u.bind(h(a),o.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(r&&r.useDepthForOcclusion,i,s),r&&r.useMeterToDem&&a){const t=(1<<a.tileID.canonical.z)*e.cf(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;s.u_meter_to_dem=t}if(r&&r.labelPlaneMatrixInv&&(s.u_label_plane_matrix_inv=r.labelPlaneMatrixInv),i.setTerrainUniformValues(n,s),"globe"===this.painter.transform.projection.name){const e=this.globeUniformValues(this.painter.transform,t.tileID.canonical,r&&r.useDenormalizedUpVectorScale);i.setGlobeUniformValues(n,e)}}globeUniformValues(t,i,r){const n=t.projection;return{u_tile_tl_up:n.upVector(i,0,0),u_tile_tr_up:n.upVector(i,e.al,0),u_tile_br_up:n.upVector(i,e.al,e.al),u_tile_bl_up:n.upVector(i,0,e.al),u_tile_up_scale:r?e.dM(1):n.upVectorScale(i,t.center.lat,t.worldSize).metersToTile}}renderToBackBuffer(t){const i=this.painter,r=this.painter.context;0!==t.length&&(r.bindFramebuffer.set(null),r.viewport.set([0,0,i.width,i.height]),i.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(t,i,r,n,o){if("globe"===t.transform.projection.name)!function(t,i,r,n,o){const s=t.context,a=s.gl;let l,c;const h=t.transform,u=e.dE(t,s,h),d=(e,i)=>{if(c===i)return;const r=[Kn[i],"PROJECTION_GLOBE_VIEW"];u&&r.push("CUSTOM_ANTIALIASING");const n=t.isTileAffectedByFog(e);l=t.getOrCreateProgram("globeRaster",{defines:r,overrideFog:n}),c=i},p=t.colorModeForRenderPass(),f=new Wi(a.LEQUAL,Wi.ReadWrite,t.depthRangeFor3D);Yn.update(o);const m=e.dF(h),_=[e.aF(h.center.lng),e.aJ(h.center.lat)],g=t.globeSharedBuffers,y=[h.width*e.o.devicePixelRatio,h.height*e.o.devicePixelRatio],x=Float32Array.from(h.globeMatrix),v={useDenormalizedUpVectorScale:!0};{const h=t.transform,u=Jn(h.zoom,i.exaggeration(),i.sourceCache._source.tileSize);c=-1;const b=a.TRIANGLES;for(const c of n){const n=r.getTile(c),w=Yi.disabled,T=i.prevTerrainTileForTile[c.key],S=i.terrainTileForTile[c.key];Xn(T,S)&&Yn.newMorphing(c.key,T,S,o,250),eo(t,n.emissiveTexture),s.activeTexture.set(a.TEXTURE0),n.texture&&n.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const E=Yn.getMorphValuesForProxy(c.key),I=E?1:0;E&&Object.assign(v,{morphing:{srcDemTile:E.from,dstDemTile:E.to,phase:e.dD(E.phase)}});const A=e.dG(c.canonical),M=e.dH(A.getCenter().lat),C=e.dI(c.canonical,A,M,h.worldSize/h._pixelsPerMercatorPixel),P=e.bk(e.dJ(c.canonical)),R="mrt-fallback"===t.emissiveMode?1:0,z=Wn(h.expandedFarZProjMatrix,x,m,P,e.aj(h.zoom),_,h.frustumCorners.TL,h.frustumCorners.TR,h.frustumCorners.BR,h.frustumCorners.BL,h.globeCenterInViewSpace,h.globeRadius,y,u,h._farZ,R,C);if(d(c,I),l&&(i.setupElevationDraw(n,l,v),t.uploadCommonUniforms(s,l,c.toUnwrapped()),g)){const[e,i,r]=g.getGridBuffers(M,0!==u);l.draw(t,b,f,w,p,Qi.backCCW,z,"globe_raster",e,i,r)}}}if(g&&(t.renderDefaultNorthPole||t.renderDefaultSouthPole)){const o=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];u&&o.push("CUSTOM_ANTIALIASING"),l=t.getOrCreateProgram("globeRaster",{defines:o});for(const c of n){const{x:n,y:o,z:u}=c.canonical,d=0===o,m=o===(1<<u)-1,[x,b,w,T]=g.getPoleBuffers(u,!1);if(T&&(d||m)){const o=r.getTile(c);eo(t,o.emissiveTexture),s.activeTexture.set(a.TEXTURE0),o.texture&&o.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);let g=e.dK(u,n,h);const S=e.bk(e.dJ(c.canonical)),E="mrt-fallback"===t.emissiveMode?1:0,I=(e,i)=>e.draw(t,a.TRIANGLES,f,Yi.disabled,p,Qi.disabled,Wn(h.expandedFarZProjMatrix,g,g,S,0,_,h.frustumCorners.TL,h.frustumCorners.TR,h.frustumCorners.BR,h.frustumCorners.BL,h.globeCenterInViewSpace,h.globeRadius,y,0,h._farZ,E),"globe_pole_raster",i,w,T);i.setupElevationDraw(o,l,v),t.uploadCommonUniforms(s,l,c.toUnwrapped()),d&&t.renderDefaultNorthPole&&I(l,x),m&&t.renderDefaultSouthPole&&(g=e.cS(e.bC(),g,[1,-1,1]),I(l,b))}}}}(t,i,r,n,o);else{const s=t.context,a=s.gl;let l,c;const h=t.shadowRenderer,u=cr(t,t.longestCutoffRange),d=e=>{if(c===e)return;const i=[];i.push(Kn[e]),u.shouldRenderCutoff&&i.push("RENDER_CUTOFF"),h&&(i.push("RENDER_SHADOWS","DEPTH_TEXTURE"),h.useNormalOffset&&i.push("NORMAL_OFFSET")),l=t.getOrCreateProgram("terrainRaster",{defines:i}),c=e},p=t.colorModeForRenderPass(),f=new Wi(a.LEQUAL,Wi.ReadWrite,t.depthRangeFor3D);Yn.update(o);const m=t.transform,_=Jn(m.zoom,i.exaggeration(),i.sourceCache._source.tileSize);let g=[0,0,0];if(h){const e=t.style.directionalLight,i=t.style.ambientLight;e&&i&&(g=_r(t.style,e,i))}{c=-1;const y=a.TRIANGLES,[x,v]=[i.gridIndexBuffer,i.gridSegments];for(const c of n){const n=r.getTile(c),b=Yi.disabled,w=i.prevTerrainTileForTile[c.key],T=i.terrainTileForTile[c.key];Xn(w,T)&&Yn.newMorphing(c.key,w,T,o,250),eo(t,n.emissiveTexture),s.activeTexture.set(a.TEXTURE0),n.texture&&n.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const S=Yn.getMorphValuesForProxy(c.key),E=S?1:0;let I;S&&(I={morphing:{srcDemTile:S.from,dstDemTile:S.to,phase:e.dD(S.phase)}});const A="mrt-fallback"===t.emissiveMode?1:0,M=Zn(c.projMatrix,Qn(c.canonical,m.renderWorldCopies)?_/10:_,g,A);if(d(E),!l)continue;i.setupElevationDraw(n,l,I);const C=c.toUnwrapped();h&&h.setupShadows(C,l),t.uploadCommonUniforms(s,l,C,null,u),l.draw(t,y,f,b,p,Qi.backCCW,M,"terrain_raster",i.gridBuffer,x,v)}}}}(i,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,i.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(0===this._drapedRenderBatches.length)return t+1;this.renderingToTexture=!0;const i=this.painter,r=this.painter.context,n=this.proxySourceCache,o=this.proxiedCoords[n.id],s=this._drapedRenderBatches.shift(),a=i.style.order,l=[];this._updateFBOs("mrt-fallback"===i.emissiveMode);let c=0;for(const h of o){const o=n.getTileByID(h.proxyTileKey),u=n.proxyCachedFBO[h.key]?n.proxyCachedFBO[h.key][t]:void 0,d=void 0!==u?n.renderCache[u]:this.pool[c++],p=void 0!==u;if(o.texture=d.tex,o.emissiveTexture=d.emissiveTex,p&&!d.dirty){l.push(o.tileID);continue}r.bindFramebuffer.set(d.fb.framebuffer);const f=r.gl;let m;f.drawBuffers("mrt-fallback"===i.emissiveMode?[f.COLOR_ATTACHMENT0,f.COLOR_ATTACHMENT1]:[f.COLOR_ATTACHMENT0]),this.renderedToTile=!1,d.dirty&&(r.clear({color:e.ao.transparent,stencil:0}),d.dirty=!1);for(let e=s.start;e<=s.end;++e){const t=i.style._mergedLayers[a[e]];if(t.isHidden(i.transform.zoom))continue;const n=i.style.getLayerSourceCache(t),o=n?this.proxyToSource[h.key][n.id]:[h];if(!o)continue;const s=o;r.viewport.set([0,0,d.fb.width,d.fb.height]),m!==(n?n.id:null)&&(this._setupStencil(d,o,t,n),m=n?n.id:null),i.renderLayer(i,n,t,s)}if(f.drawBuffers([f.COLOR_ATTACHMENT0]),0===this._drapedRenderBatches.length)for(const e of this._pendingGroundEffectLayers){const t=i.style._mergedLayers[a[e]];if(t.isHidden(i.transform.zoom))continue;const n=i.style.getLayerSourceCache(t),o=n?this.proxyToSource[h.key][n.id]:[h];if(!o)continue;const s=o;r.viewport.set([0,0,d.fb.width,d.fb.height]),m!==(n?n.id:null)&&(this._setupStencil(d,o,t,n),m=n?n.id:null),i.renderLayer(i,n,t,s)}this.renderedToTile?(d.dirty=!0,l.push(o.tileID)):p||--c,5===c&&(c=0,this.renderToBackBuffer(l))}return this.renderToBackBuffer(l),this.renderingToTexture=!1,r.bindFramebuffer.set(null),r.viewport.set([0,0,i.width,i.height]),s.end+1}postRender(){}isLayerOrderingCorrect(e){const t=e.order.length;let i=-1,r=t;for(let n=0;n<t;++n)this._style.isLayerDraped(e._mergedLayers[e.order[n]])?i=Math.max(i,n):r=Math.min(r,n);return r>i}getMinElevationBelowMSL(){let e=0;return this._visibleDemTiles.filter(e=>e.dem).forEach(t=>{e=Math.min(e,t.dem.tree.minimums[0])}),0===e?e:(e-30)*this._exaggeration}raycast(e,t,i){if(!this._visibleDemTiles)return null;const r=this._visibleDemTiles.filter(e=>e.dem).map(r=>{const n=r.tileID,o=1<<n.overscaledZ,{x:s,y:a}=n.canonical,l=s/o,c=(s+1)/o,h=a/o,u=(a+1)/o;
vendor: 5,170 bytes, line 2
2return{minx:l,miny:h,maxx:c,maxy:u,t:r.dem.tree.raycastRoot(l,h,c,u,e,t,i),tile:r}});r.sort((e,t)=>(null!==e.t?e.t:Number.MAX_VALUE)-(null!==t.t?t.t:Number.MAX_VALUE));for(const n of r){if(null==n.t)return null;const r=n.tile.dem.tree.raycast(n.minx,n.miny,n.maxx,n.maxy,e,t,i);if(null!=r)return r}return null}_createFBO(){const t=this.painter.context,i=t.gl,r=this.drapeBufferSize;t.activeTexture.set(i.TEXTURE0);const n=new e.T(t,{width:r[0],height:r[1],data:null},i.RGBA8);n.bind(i.LINEAR,i.CLAMP_TO_EDGE);const o=t.createFramebuffer(r[0],r[1],1,null);let s;return o.colorAttachment0.set(n.texture),this._emissiveTexture&&(s=new e.T(t,{width:r[0],height:r[1],data:null},i.R8),s.bind(i.LINEAR,i.CLAMP_TO_EDGE),o.createColorAttachment(t,1),o.colorAttachment1.set(s.texture)),o.depthAttachment=new $n(t,o.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,r[0],r[1]),this._stencilRef=0,o.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):o.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&i.texParameterf(i.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:o,tex:n,emissiveTex:s,dirty:!1}}_updateFBOs(e){if(this._emissiveTexture!==e){for(const t of this.pool)this._updateFBO(t,e);for(const t of this.proxySourceCache.renderCache)this._updateFBO(t,e);this._emissiveTexture=e}}_updateFBO(t,i){const r=t.fb,n=this.painter.context,o=n.gl,s=this.drapeBufferSize;if(i){const i=new e.T(n,{width:s[0],height:s[1],data:null},o.R8);i.bind(o.LINEAR,o.CLAMP_TO_EDGE),t.emissiveTex=i,r.createColorAttachment(n,1),r.colorAttachment1.set(i.texture)}else t.emissiveTex=void 0,r.removeColorAttachment(n,1);t.dirty=!0}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache)return!0;if(this._style.hasLightTransitions())return!0;for(const e in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[e].hasTransition())return!0;return this._style.order.some(e=>{const t=this._style._mergedLayers[e],i=t.isHidden(this.painter.transform.zoom);return"hillshade"===t.type||"custom"===t.type?!i&&t.shouldRedrape():!i&&t.hasTransition()})}_clearLineLayersFromRenderCache(){let t=!1;for(const e of this._style.getSources())if(e instanceof ut){t=!0;break}if(!t)return;const i={};for(let r=0;r<this._style.order.length;++r){const t=this._style._mergedLayers[this._style.order[r]],n=this._style.getLayerSourceCache(t);if(!n||i[n.id])continue;if(t.isHidden(this.painter.transform.zoom)||"line"!==t.type)continue;const o=t.widthExpression(),s=t.emissiveStrengthExpression();if(o instanceof e.ad||s instanceof e.ad){i[n.id]=!0;for(const e of this.proxyCoords){const t=this.proxyToSource[e.key][n.id];if(t)for(const e of t)this._clearRenderCacheForTile(n.id,e)}}}}_clearRasterLayersFromRenderCache(){let e=!1;for(const i in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[i]._source instanceof dt){e=!0;break}if(!e)return;const t={};for(let i=0;i<this._style.order.length;++i){const e=this._style._mergedLayers[this._style.order[i]],r=this._style.getLayerSourceCache(e);if(!r||t[r.id])continue;if(e.isHidden(this.painter.transform.zoom)||"raster"!==e.type)continue;const n=e.paint.get("raster-fade-duration");for(const t of this.proxyCoords){const e=this.proxyToSource[t.key][r.id];if(e)for(const t of e){const e=io(r.getTile(t),r.findLoadedParent(t,0),r,this.painter.transform,n);(1!==e.opacity||0!==e.mix)&&this._clearRenderCacheForTile(r.id,t)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();const t=this._style.order,i=t.length;if(0===i)return;const r=[];this._pendingGroundEffectLayers=[];let n,o=0,s=this._style._mergedLayers[t[o]];for(;!this._style.isLayerDraped(s)&&s.isHidden(this.painter.transform.zoom)&&++o<i;)s=this._style._mergedLayers[t[o]];for(;o<i;++o){const e=this._style._mergedLayers[t[o]];e.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(e)?void 0===n&&(n=o):("fill-extrusion"===e.type&&this._pendingGroundEffectLayers.push(o),void 0!==n&&(r.push({start:n,end:o-1}),n=void 0)))}if(void 0!==n&&r.push({start:n,end:o-1}),0!==r.length){const t=r[r.length-1];this._pendingGroundEffectLayers.every(e=>e>t.end)||e.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=r}_setupRenderCache(e){const t=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,t.renderCache.length>t.renderCachePool.length){const e=Object.values(t.proxyCachedFBO);t.proxyCachedFBO={};for(let i=0;i<e.length;++i){const r=Object.values(e[i]);t.renderCachePool.push(...r)}}return}this._clearRasterLayersFromRenderCache();const i=this.proxyCoords,r=this._tilesDirty;for(let o=i.length-1;o>=0;o--){const n=i[o];if(t.getTileByID(n.key),void 0!==t.proxyCachedFBO[n.key]){const i=e[n.key],o=this.proxyToSource[n.key];let s=0;for(const e in o){const t=o[e],n=i[e];if(!n||n.length!==t.length||t.some((t,i)=>
vendor: 5,854 bytes, line 2
2t!==n[i]||r[e]&&r[e].hasOwnProperty(t.key))){s=-1;break}++s}for(const e in t.proxyCachedFBO[n.key])t.renderCache[t.proxyCachedFBO[n.key][e]].dirty=s<0||s!==Object.values(i).length}}const n=[...this._drapedRenderBatches];n.sort((e,t)=>t.end-t.start-(e.end-e.start));for(const o of n)for(const e of i){if(t.proxyCachedFBO[e.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[e.key]={},t.proxyCachedFBO[e.key][o.start]=i,t.renderCache[i].dirty=!0)}this._tilesDirty={}}_setupStencil(e,t,i,r){if(!r||!this._sourceTilesOverlap[r.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const n=this.painter.context,o=n.gl;if(t.length<=1)return void(this._overlapStencilType=!1);let s;if(i.isTileClipped())s=t.length,this._overlapStencilMode.test={func:o.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(t[0].overscaledZ>t[t.length-1].overscaledZ))return void(this._overlapStencilType=!1);s=1,this._overlapStencilMode.test={func:o.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+s>255&&(n.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=s,this._overlapStencilMode.ref=this._stencilRef,i.isTileClipped()&&this._renderTileClippingMasks(t,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(e){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[e.key]),this._overlapStencilMode):Yi.disabled}_renderTileClippingMasks(e,t){const i=this.painter,r=this.painter.context,n=r.gl;i._tileClippingMaskIDs={},r.setColorMode(Zi.disabled),r.setDepthMode(Wi.disabled);const o=i.getOrCreateProgram("clippingMask");for(const s of e){const e=i._tileClippingMaskIDs[s.key]=--t;o.draw(i,n.TRIANGLES,Wi.disabled,new Yi({func:n.ALWAYS,mask:0},e,255,n.KEEP,n.KEEP,n.REPLACE),Zi.disabled,Qi.disabled,to(s.projMatrix),"$clipping",i.tileExtentBuffer,i.quadTriangleIndexBuffer,i.tileExtentSegments)}}pointCoordinate(t){const i=this.painter.transform;if(t.x<0||t.x>i.width||t.y<0||t.y>i.height)return null;const r=[t.x,t.y,1,1];e.aC(r,r,i.pixelMatrixInverse),e.cK(r,r,1/r[3]),r[0]/=i.worldSize,r[1]/=i.worldSize;const n=i._camera.position,o=e.cf(1,i.center.lat),s=[n[0],n[1],n[2]/o,0],a=e.da([],r.slice(0,3),s);e.aw(a,a);const l=this.raycast(s,a,this._exaggeration);return null!==l&&l?(e.bH(s,s,a,l),s[3]=s[2],s[2]*=o,s):null}_setupProxiedCoordsForOrtho(t,i,r){if(t.getSource()instanceof e.aU)return this._setupProxiedCoordsForImageSource(t,i,r);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const n=this.proxiedCoords[t.id]=[],o=this.proxyCoords;for(let e=0;e<o.length;e++){const i=o[e],s=this._findTileCoveringTileID(i,t);if(s){const e=this._createProxiedId(i,s,r[i.key]&&r[i.key][t.id]);n.push(e),this.proxyToSource[i.key][t.id]=[e]}}let s=!1;const a=new Set;for(let e=0;e<i.length;e++){const o=t.getTile(i[e]);if(!o||!o.hasData())continue;const l=this._findTileCoveringTileID(o.tileID,this.proxySourceCache);if(l&&l.tileID.canonical.z!==o.tileID.canonical.z){const e=this.proxyToSource[l.tileID.key][t.id],i=this._createProxiedId(l.tileID,o,r[l.tileID.key]&&r[l.tileID.key][t.id]);e?e.splice(e.length-1,0,i):this.proxyToSource[l.tileID.key][t.id]=[i];const c=this.proxyToSource[l.tileID.key][t.id];a.has(c)||a.add(c),n.push(i),s=!0}}if(this._sourceTilesOverlap[t.id]=s,s&&this._debugParams.sortTilesHiZFirst)for(const e of a)e.sort((e,t)=>t.overscaledZ-e.overscaledZ)}_setupProxiedCoordsForImageSource(t,i,r){if(!t.getSource().loaded())return;const n=this.proxiedCoords[t.id]=[],o=this.proxyCoords,s=t.getSource(),a=s.tileID;if(!a)return;const l=new e.P(a.x,a.y)._div(1<<a.z),c=s.coordinates.map(e.ae.fromLngLat).reduce((e,t)=>(e.min.x=Math.min(e.min.x,t.x-l.x),e.min.y=Math.min(e.min.y,t.y-l.y),e.max.x=Math.max(e.max.x,t.x-l.x),e.max.y=Math.max(e.max.y,t.y-l.y),e),{min:new e.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new e.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),h=(t,i)=>{const r=t.wrap+t.canonical.x/(1<<t.canonical.z),n=t.canonical.y/(1<<t.canonical.z),o=e.al/(1<<t.canonical.z),s=i.wrap+i.canonical.x/(1<<i.canonical.z),a=i.canonical.y/(1<<i.canonical.z);return r+o<s+c.min.x||r>s+c.max.x||n+o<a+c.min.y||n>a+c.max.y};for(let e=0;e<o.length;e++){const s=o[e];for(let e=0;e<i.length;e++){const o=t.getTile(i[e]);if(!o||!o.hasData())continue;if(h(s,o.tileID))continue;const a=this._createProxiedId(s,o,r[s.key]&&r[s.key][t.id]),l=this.proxyToSource[s.key][t.id];l?l.push(a):this.proxyToSource[s.key][t.id]=[a],n.push(a)}}}_createProxiedId(t,i,r){let n=this.orthoMatrix;if(r){const e=r.find(e=>e.key===i.tileID.key);if(e)return e}if(i.tileID.key!==t.key){const r=t.canonical.z-i.tileID.canonical.z;let o,s,a;n=e.bC();const l=i.tileID.wrap-t.wrap<<t.overscaledZ;r>0?(o=e.al>>r,s=o*((i.tileID.canonical.x<<r)-t.canonical.x+l),a=o*((i.tileID.canonical.y<<r)-t.canonical.y)):(o=e.al<<-r,s=e.al*(i.tileID.canonical.x-(t.canonical.x+l<<-r)),a=e.al*(i.tileID.canonical.y-(t.canonical.y<<-r))),e.ce(n,0,o,0,o,0,1),e.br(n,n,[s,a,0])}return new oo(i.tileID,t.key,n)}_findTileCoveringTileID(t,i){let r=i.getTile(t);if(r&&r.hasData())return r;const n=this._findCoveringTileCache[i.id],o=n[t.key];if(r=o?i.getTileByID(o):null,r&&r.hasData()||null===o)return r;let s=r?r.tileID:t,a=s.overscaledZ;const l=i.getSource().minzoom,c=[];if(!o){const n=i.getSource().maxzoom;if(t.canonical.z>=n){const r=t.canonical.z-n;i.getSource().reparseOverscaled?(a=Math.max(t.canonical.z+2,i.transform.tileZoom),s=new e.aQ(a,t.wrap,n,t.canonical.x>>r,t.canonical.y>>r)):0!==r&&(a=n,s=new e.aQ(a,t.wrap,n,t.canonical.x>>r,t.canonical.y>>r))}s.key!==t.key&&(c.push(s.key),r=i.getTile(s))}const h=e=>
2{c.forEach(t=>{n[t]=e}),c.length=0};for(a-=1;a>=l&&(!r||!r.hasData());a--){r&&h(r.tileID.key);const e=s.calculateScaledKey(a);if(r=i.getTileByID(e),r&&r.hasData())break;const t=n[e];if(null===t)break;void 0===t?c.push(e):r=i.getTileByID(t)}return h(r?r.tileID.key:null),r&&r.hasData()?r:null}findDEMTileFor(e){return this.enabled?this._findTileCoveringTileID(e,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(e,t){let i=this._tilesDirty[e];i||(i=this._tilesDirty[e]={}),i[t.key]=!0}}function ao(t,i,r){const n=function(t,i,r){const n=e.bJ(i,t),o=e.bJ(r,[.2126,.7152,.0722]),s=(e,t,i)=>(1-i)*e+i*t,a=s(1-.3*Math.min(o,1),1,Math.min(n+1,1));return s(.92,1,Math.asin(e.aA(i[2],-1,1))/Math.PI+.5)*a}(t,[0,0,1],i),o=[0,0,0];e.c5(o,r.slice(0,3),n);const s=[0,0,0];e.c5(s,i.slice(0,3),t[2]);const a=[0,0,0];return e.d8(a,o,s),e.db(a)}const lo=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],co=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class ho{static cacheKey(e,t,i,r){const n=[t];r&&n.push(r.cacheKey);for(const o of i)e.usedDefines.has(o)&&n.push(o);return n.join("/")}constructor(t,i,r,n,o,s){const a=t.gl;this.program=a.createProgram(),this.configuration=n,this.name=i,this.fixedDefines=[...s];const l=`#version 300 es\n${(n?n.defines():[]).concat(s.map(e=>`#define ${e}`)).join("\n")}`,c=[l,Qr];for(const e of r.fragmentIncludes)c.push(Xr[e]);c.push(r.fragmentSource);const h=c.join("\n"),u=[l,en];for(const e of r.vertexIncludes)u.push(Xr[e]);this.forceManualRenderingForInstanceIDShaders=t.forceManualRenderingForInstanceIDShaders&&r.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&u.push("uniform int u_instanceID;"),u.push(r.vertexSource);let d=u.join("\n");this.forceManualRenderingForInstanceIDShaders&&(d=d.replaceAll("gl_InstanceID","u_instanceID"));const p=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);a.shaderSource(p,h),a.compileShader(p),a.attachShader(this.program,p);const f=a.createShader(a.VERTEX_SHADER);a.isContextLost()?this.failedToCreate=!0:(a.shaderSource(f,d),a.compileShader(f),a.attachShader(this.program,f),this.attributes={},a.linkProgram(this.program),a.deleteShader(f),a.deleteShader(p),this.fixedUniforms=o(t),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=n?n.getUniforms(t):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(t=>({u_instanceID:new e.ch(t)}))(t)),(s.includes("TERRAIN")||i.includes("symbol")||i.includes("circle"))&&(this.terrainUniforms=(t=>({u_dem:new e.ch(t),u_dem_prev:new e.ch(t),u_dem_tl:new e.ck(t),u_dem_scale:new e.cj(t),u_dem_tl_prev:new e.ck(t),u_dem_scale_prev:new e.cj(t),u_dem_size:new e.cj(t),u_dem_lerp:new e.cj(t),u_exaggeration:new e.cj(t),u_depth:new e.ch(t),u_depth_size_inv:new e.ck(t),u_depth_range_unpack:new e.ck(t),u_occluder_half_size:new e.cj(t),u_occlusion_depth_offset:new e.cj(t),u_meter_to_dem:new e.cj(t),u_label_plane_matrix_inv:new e.cl(t)}))(t)),s.includes("GLOBE")&&(this.globeUniforms=(t=>({u_tile_tl_up:new e.ci(t),u_tile_tr_up:new e.ci(t),u_tile_br_up:new e.ci(t),u_tile_bl_up:new e.ci(t),u_tile_up_scale:new e.cj(t)}))(t)),s.includes("FOG")&&(this.fogUniforms=(t=>({u_fog_matrix:new e.cl(t),u_fog_range:new e.ck(t),u_fog_color:new e.d3(t),u_fog_horizon_blend:new e.cj(t),u_fog_vertical_limit:new e.ck(t),u_fog_temporal_offset:new e.cj(t),u_frustum_tl:new e.ci(t),u_frustum_tr:new e.ci(t),u_frustum_br:new e.ci(t),u_frustum_bl:new e.ci(t),u_globe_pos:new e.ci(t),u_globe_radius:new e.cj(t),u_globe_transition:new e.cj(t),u_is_globe:new e.ch(t),u_viewport:new e.ck(t)}))(t)),s.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(t=>({u_cutoff_params:new e.d3(t)}))(t)),s.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(t=>({u_lighting_ambient_color:new e.ci(t),u_lighting_directional_dir:new e.ci(t),u_lighting_directional_color:new e.ci(t),u_ground_radiance:new e.ci(t)}))(t)),s.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(t=>({u_light_matrix_0:new e.cl(t),u_light_matrix_1:new e.cl(t),u_fade_range:new e.ck(t),u_shadow_normal_offset:new e.ci(t),u_shadow_intensity:new e.cj(t),u_shadow_texel_size:new e.cj(t),u_shadow_map_resolution:new e.cj(t),u_shadow_direction:new e.ci(t),u_shadow_bias:new e.ci(t),u_shadowmap_0:new e.ch(t),u_shadowmap_1:new e.ch(t)}))(t)))}getAttributeLocation(e,t){let i=this.attributes[t];return void 0===i&&(i=this.attributes[t]=e.getAttribLocation(this.program,t)),i}setTerrainUniformValues(e,t){if(!this.terrainUniforms)return;const i=this.terrainUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e]&&i[e].set(this.program,e,t[e])}}setGlobeUniformValues(e,t){if(!this.globeUniforms)return;const i=this.globeUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e]&&i[e].set(this.program,e,t[e])}}setFogUniformValues(e,t){if(!this.fogUniforms)return;const i=this.fogUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}}setCutoffUniformValues(e,t){if(!this.cutoffUniforms)return;const i=this.cutoffUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}}setLightsUniformValues(e,t){if(!this.lightsUniforms)return;const i=this.lightsUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}}setShadowUniformValues(e,t){if(this.failedToCreate||!this.shadowUniforms)return;const i=this.shadowUniforms;e.program.set(this.program);for(const r in t)i[r].set(this.program,r,t[r])}_drawDebugWireframe(t,i,r,n,o,s,a,l,c,h){const u=t.options.wireframe;if(!1===u.terrain&&!1===u.layers2D&&!1===u.layers3D)return;const d=t.context;if(!(()=>!(!u.terrain||"terrainRaster"!==this.name&&"globeRaster"!==this.name)||!(!u.layers2D||t._terrain&&t._terrain.renderingToTexture||!lo.includes(this.name))||!(!u.layers3D||!co.includes(this.name)))())return;const p=d.gl,f=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,o,d);if(!f)return;
vendor: 4,229 bytes, line 2
2const m=[...this.fixedDefines,"DEBUG_WIREFRAME"],_=t.getOrCreateProgram(this.name,{config:this.configuration,defines:m});d.program.set(_.program);const g=(e,t,i)=>{if(t[e]&&i[e])for(const r in t[e])i[e][r]&&i[e][r].set(i.program,r,t[e][r].current)};c&&c.setUniforms(_.program,d,_.binderUniforms,a,{zoom:l}),g("fixedUniforms",this,_),g("terrainUniforms",this,_),g("globeUniforms",this,_),g("fogUniforms",this,_),g("lightsUniforms",this,_),g("shadowUniforms",this,_),f.bind(),d.setColorMode(new Zi([p.ONE,p.ONE_MINUS_SRC_ALPHA,p.ZERO,p.ONE],e.ao.transparent,[!0,!0,!0,!1])),d.setDepthMode(new Wi(i.func===p.LESS?p.LEQUAL:i.func,Wi.ReadOnly,i.range)),d.setStencilMode(Yi.disabled);const y=3*s.primitiveLength*2,x=3*s.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const e=h||1;for(let t=0;t<e;++t)_.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",t),p.drawElements(p.LINES,y,p.UNSIGNED_SHORT,x)}else h&&h>1?p.drawElementsInstanced(p.LINES,y,p.UNSIGNED_SHORT,x,h):p.drawElements(p.LINES,y,p.UNSIGNED_SHORT,x);o.bind(),d.program.set(this.program),d.setDepthMode(i),d.setStencilMode(r),d.setColorMode(n)}checkUniforms(e,t,i){if(this.fixedDefines.includes(t))for(const r of Object.keys(i))if(!i[r].initialized)throw new Error(`Program '${this.name}', from draw '${e}': uniform ${r} not set but required by ${t} being defined`)}draw(e,t,i,r,n,o,s,a,l,c,h,u,d,p,f,m){const _=e.context,g=_.gl;if(this.failedToCreate)return;_.program.set(this.program),_.setDepthMode(i),_.setStencilMode(r),_.setColorMode(n),_.setCullFace(o);for(const[T,S]of this.fixedUniformsEntries)S.set(this.program,T,s[T]);p&&p.setUniforms(this.program,_,this.binderUniforms,u,{zoom:d});const y={[g.POINTS]:1,[g.LINES]:2,[g.TRIANGLES]:3,[g.LINE_STRIP]:1}[t];this.checkUniforms(a,"RENDER_SHADOWS",this.shadowUniforms);const x=f||[],v=p?p.getPaintVertexBuffers():[],b=t===g.TRIANGLES&&c,w=m&&m>0?1:void 0;for(const T of h.get()){const o=T.vaos||(T.vaos={});if((o[a]||(o[a]=new on)).bind(_,this,l,v,c,T.vertexOffset,x,w),this.forceManualRenderingForInstanceIDShaders){const e=m||1;for(let i=0;i<e;++i)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",i),c?g.drawElements(t,T.primitiveLength*y,g.UNSIGNED_SHORT,T.primitiveOffset*y*2):g.drawArrays(t,T.vertexOffset,T.vertexLength)}else m&&m>1?g.drawElementsInstanced(t,T.primitiveLength*y,g.UNSIGNED_SHORT,T.primitiveOffset*y*2,m):c?g.drawElements(t,T.primitiveLength*y,g.UNSIGNED_SHORT,T.primitiveOffset*y*2):g.drawArrays(t,T.vertexOffset,T.vertexLength);b&&this._drawDebugWireframe(e,i,r,n,c,T,u,d,p,m)}}}function uo(t,i,r=0){const n=Math.pow(2,i.tileID.overscaledZ),o=i.tileSize*Math.pow(2,t.transform.tileZoom)/n,s=o*(i.tileID.canonical.x+i.tileID.wrap*n),a=o*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture?i.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/e.ay(i,1,t.transform.tileZoom),u_pixel_coord_upper:[s>>16,a>>16],u_pixel_coord_lower:[65535&s,65535&a],u_pattern_transition:r}}const po={terrain:0,flat:1},fo=e.bC(),mo=(t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y)=>{const x=i.style.light,v=x.properties.get("position"),b=[v.x,v.y,v.z],w=e.dO();"viewport"===x.properties.get("anchor")&&(e.dP(w,-i.transform.angle),e.dQ(b,b,w));const T=x.properties.get("color").toPremultipliedRenderColor(null),S=i.transform,E={u_matrix:t,u_lightpos:b,u_lightintensity:x.properties.get("intensity"),u_lightcolor:[T.r,T.g,T.b],u_vertical_gradient:+r,u_opacity:n,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:fo,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:po[h],u_base_type:po[u],u_ao:o,u_edge_radius:s,u_width_scale:a,u_flood_light_color:m,u_vertical_scale:_,u_flood_light_intensity:g,u_ground_shadow_factor:y};return"globe"===S.projection.name&&(E.u_tile_id=[l.canonical.x,l.canonical.y,1<<l.canonical.z],E.u_zoom_transition=d,E.u_inv_rot_matrix=f,E.u_merc_center=p,E.u_up_dir=S.projection.upVector(new e.cD(0,0,0),p[0]*e.al,p[1]*e.al),E.u_height_lift=c),E},_o=(e,t,i,r,n,o)=>({u_matrix:e,u_edge_radius:t,u_width_scale:i,u_vertical_scale:r,u_height_type:po[n],u_base_type:po[o]}),go=(e,t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g)=>{const y=mo(e,t,i,r,n,o,s,a,c,h,u,d,p,f,m,_,1,[0,0,0]),x={u_height_factor:-Math.pow(2,a.overscaledZ
vendor: 5,320 bytes, line 2
2)/l.tileSize/8};return Object.assign(y,uo(t,l,g),x)},yo=(e,t,i)=>({u_matrix:e,u_emissive_strength:t,u_ground_shadow_factor:i}),xo=(e,t,i,r,n,o=0)=>Object.assign(yo(e,t,n),uo(i,r,o)),vo=(e,t,i,r)=>({u_matrix:e,u_world:i,u_emissive_strength:t,u_ground_shadow_factor:r}),bo=(e,t,i,r,n,o,s=0)=>Object.assign(xo(e,t,i,r,o,s),{u_world:n}),wo=(e,t)=>({u_matrix:e,u_depth_bias:t}),To=(e,t)=>({u_matrix:e,u_ground_shadow_factor:t}),So=(e,t,i,r,n)=>({u_matrix:e,u_camera_pos:[t[0],t[1],t[2]],u_depth_bias:i,u_height_scale:r,u_reset_depth:n}),Eo=(e,t,i,r,n,o,s,a,l)=>({u_matrix:e,u_normal_matrix:t,u_opacity:i,u_faux_facade_ao_intensity:r,u_camera_pos:n,u_tile_to_meter:o,u_facade_emissive_chance:s,u_flood_light_color:a,u_flood_light_intensity:l}),Io=e=>({u_matrix:e}),Ao=e=>({u_matrix:e}),Mo=(t,i,r,n,o,s,a,l)=>{const c=e.al/s.tileSize;return{u_matrix:t,u_inv_rot_matrix:i,u_camera_to_center_distance:r.getCameraToCenterDistance(l),u_extrude_scale:[r.pixelsToGLUnits[0]/c,r.pixelsToGLUnits[1]/c],u_zoom_transition:n,u_tile_id:a,u_merc_center:o}},Co=(e,t,i,r)=>({u_matrix:e,u_inv_matrix:t,u_camera_to_center_distance:i.getCameraToCenterDistance(r),u_viewport_size:[i.width,i.height]}),Po=(e,t,i=1)=>({u_matrix:e,u_color:t,u_overlay:0,u_overlay_scale:i}),Ro=e.bC(),zo=(t,i,r,n,o,s,a)=>{const l=t.transform,c="globe"===l.projection.name,h=c?e.dR(l.zoom,i.canonical)*l._pixelsPerMercatorPixel:e.ay(r,1,s),u={u_matrix:i.projMatrix,u_extrude_scale:h,u_intensity:a,u_inv_rot_matrix:Ro,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(c){u.u_inv_rot_matrix=n,u.u_merc_center=o,u.u_tile_id=[i.canonical.x,i.canonical.y,1<<i.canonical.z],u.u_zoom_transition=e.aj(l.zoom);const t=o[0]*e.al,r=o[1]*e.al;u.u_up_dir=l.projection.upVector(new e.cD(0,0,0),t,r)}return u};function Lo(e,[t,i,r,n],[o,s]){if(o===s)return[0,0,0,0];const a=255*(e-1)/(e*(s-o));return[t*a,i*a,r*a,n*a]}function Do(e,t,[i,r]){return i===r?0:.5/e+(t-i)*(e-1)/(e*(r-i))}const Oo=(t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b)=>({u_matrix:t,u_normalize_matrix:i,u_globe_matrix:r,u_merc_matrix:n,u_grid_matrix:o,u_tl_parent:s,u_scale_parent:h,u_fade_t:u.mix,u_opacity:u.opacity*d.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:d.paint.get("raster-brightness-min"),u_brightness_high:d.paint.get("raster-brightness-max"),u_saturation_factor:e.dT(d.paint.get("raster-saturation")),u_contrast_factor:e.dS(d.paint.get("raster-contrast")),u_spin_weights:Fo(d.paint.get("raster-hue-rotate")),u_perspective_transform:p,u_raster_elevation:f,u_zoom_transition:a,u_merc_center:l,u_cutoff_params:c,u_colorization_mix:Lo(e.dU,_,y),u_colorization_offset:Do(e.dU,g,y),u_color_ramp:m,u_texture_offset:[v/(x+2*v),x/(x+2*v)],u_texture_res:[x+2*v,x+2*v],u_emissive_strength:b});function Fo(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 ko=.05,Bo=(e,t,i,r,n,o,s,a,l,c,h,u)=>({u_matrix:e,u_normalize_matrix:t,u_globe_matrix:i,u_merc_matrix:r,u_grid_matrix:n,u_tl_parent:o,u_scale_parent:c,u_fade_t:h.mix,u_opacity:h.opacity,u_image0:0,u_image1:1,u_raster_elevation:u,u_zoom_transition:s,u_merc_center:a,u_cutoff_params:l}),No=(e,t,i,r,n,o,s,a,l,c)=>({u_particle_texture:e,u_particle_texture_side_len:t,u_tile_offset:i,u_velocity:r,u_color_ramp:o,u_velocity_res:n,u_max_speed:s,u_uv_offset:a,u_data_scale:[255*l[0],255*l[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[ko,ko]}),Vo=(e,t,i,r,n,o,s,a,l,c)=>({u_particle_texture:e,u_particle_texture_side_len:t,u_velocity:i,u_velocity_res:r,u_max_speed:n,u_speed_factor:o,u_reset_rate:s,u_rand_seed:Math.random(),u_uv_offset:a,u_data_scale:[255*l[0],255*l[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[ko,ko]}),Uo=e.bC(),jo=(t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T,S)=>{const E=o.transform,I={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:E.getCameraToCenterDistance(x),u_rotate_symbol:+r,u_aspect_ratio:E.width/E.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_matrix:s,u_label_plane_matrix:a,u_coord_matrix:l,u_is_text:+h,u_elevation_from_sea:c?1:0,u_pitch_with_map:+n,u_texsize:u,u_texsize_icon:d,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Uo,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:Uo,u_up_vector:[0,-1,0],u_color_adj_mat:w,u_icon_transition:T||0,u_gamma_scale:n?o.transform.getCameraToCenterDistance(x)*Math.cos(o.terrain?0:o.transform._pitch):1,u_device_pixel_ratio:e.o.devicePixelRatio,u_is_halo:1,u_scale_factor:S||1,u_ground_shadow_factor:v,u_inv_matrix:e.bl(e.bC(),a),u_normal_scale:b,u_lutTexture:10};return"globe"===x.name&&(I.u_tile_id=[f.canonical.x,f.canonical.y,1<<f.canonical.z],I.u_zoom_transition=m,I.u_inv_rot_matrix=g,I.u_merc_center=_,I.u_camera_forward=E._camera.forward(),I.u_ecef_origin=e.dV(E.globeMatrix,f.toUnwrapped()),I.u_tile_matrix=Float32Array.from(E.globeMatrix),I.u_up_vector=y),I},Go=(e,t,i,r)=>({u_matrix:e,u_emissive_strength:t,u_opacity:i,u_color:r}),qo=(t,i,r,n,o,s,a,l,c)=>Object.assign(function(t,i,r,n,o,s){const{width:a,height:l}=n.imageManager.getPixelSize(i),c=Math.pow(2,s.tileID.overscaledZ
2),h=s.tileSize*Math.pow(2,n.transform.tileZoom)/c,u=h*(s.tileID.canonical.x+s.tileID.wrap*c),d=h*s.tileID.canonical.y;return{u_image:0,u_pattern_tl:r.tl,u_pattern_br:r.br,u_texsize:[a,l],u_pattern_size:r.displaySize,u_pattern_units_to_pixels:o?[n.transform.width,-1*n.transform.height]:[1/e.ay(s,1,n.transform.tileZoom),1/e.ay(s,1,n.transform.tileZoom)],u_pixel_coord_upper:[u>>16,d>>16],u_pixel_coord_lower:[65535&u,65535&d]}}(0,s,a,n,l,c),{u_matrix:t,u_emissive_strength:i,u_opacity:r}),Ho=new Float32Array(e.bA([])),$o=(t,i,r,n,o,s,a,l,c,h,u,d,p,f=[0,0,0],m,_,g)=>{const y=o.style.light,x=y.properties.get("position"),v=[-x.x,-x.y,x.z],b=e.dO();"viewport"===y.properties.get("anchor")&&(e.dP(b,-o.transform.angle),e.dQ(v,v,b));const w="MASK"===u.alphaMode,T=y.properties.get("color").toNonPremultipliedRenderColor(null),S=p.paint.get("model-ambient-occlusion-intensity"),E=p.paint.get("model-color").constantOr(e.ao.white).toNonPremultipliedRenderColor(null);return E.a=p.paint.get("model-color-mix-intensity").constantOr(0),g&&(E.r=g[0],E.g=g[1],E.b=g[2],E.a=g[3]),_&&(E.r=_.color.r,E.g=_.color.g,E.b=_.color.b,E.a=_.colorMix,d=_.emissionStrength,s*=_.opacity),{u_matrix:t,u_lighting_matrix:i,u_normal_matrix:r,u_node_matrix:n||Ho,u_lightpos:v,u_lightintensity:y.properties.get("intensity"),u_lightcolor:[T.r,T.g,T.b],u_camera_pos:f,u_opacity:s,u_baseTextureIsAlpha:0,u_alphaMask:+w,u_alphaCutoff:u.alphaCutoff,u_baseColorFactor:a.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:l.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:c,u_roughnessFactor:h,u_baseColorTexture:5,u_metallicRoughnessTexture:6,u_normalTexture:7,u_occlusionTexture:8,u_emissionTexture:9,u_lutTexture:10,u_color_mix:E.toArray01(),u_aoIntensity:S,u_emissive_strength:d,u_occlusionTextureTransform:m||[0,0,0,0]}},Zo=(e,t=Ho,i=Ho)=>({u_matrix:e,u_instance:t,u_node_matrix:i}),Wo={fillExtrusion:t=>({u_matrix:new e.cl(t),u_lightpos:new e.ci(t),u_lightintensity:new e.cj(t),u_lightcolor:new e.ci(t),u_vertical_gradient:new e.cj(t),u_opacity:new e.cj(t),u_edge_radius:new e.cj(t),u_width_scale:new e.cj(t),u_ao:new e.ck(t),u_height_type:new e.ch(t),u_base_type:new e.ch(t),u_tile_id:new e.ci(t),u_zoom_transition:new e.cj(t),u_inv_rot_matrix:new e.cl(t),u_merc_center:new e.ck(t),u_up_dir:new e.ci(t),u_height_lift:new e.cj(t),u_flood_light_color:new e.ci(t),u_vertical_scale:new e.cj(t),u_flood_light_intensity:new e.cj(t),u_ground_shadow_factor:new e.ci(t)}),fillExtrusionDepth:t=>({u_matrix:new e.cl(t),u_edge_radius:new e.cj(t),u_width_scale:new e.cj(t),u_vertical_scale:new e.cj(t),u_height_type:new e.ch(t),u_base_type:new e.ch(t)}),fillExtrusionPattern:t=>({u_matrix:new e.cl(t),u_lightpos:new e.ci(t),u_lightintensity:new e.cj(t),u_lightcolor:new e.ci(t),u_vertical_gradient:new e.cj(t),u_height_factor:new e.cj(t),u_edge_radius:new e.cj(t),u_width_scale:new e.cj(t),u_ao:new e.ck(t),u_height_type:new e.ch(t),u_base_type:new e.ch(t),u_tile_id:new e.ci(t),u_zoom_transition:new e.cj(t),u_inv_rot_matrix:new e.cl(t),u_merc_center:new e.ck(t),u_up_dir:new e.ci(t),u_height_lift:new e.cj(t),u_image:new e.ch(t),u_texsize:new e.ck(t),u_pixel_coord_upper:new e.ck(t),u_pixel_coord_lower:new e.ck(t),u_tile_units_to_pixels:new e.cj(t),u_opacity:new e.cj(t),u_pattern_transition:new e.cj(t)}),fillExtrusionGroundEffect:t=>({u_matrix:new e.cl(t),u_opacity:new e.cj(t),u_ao_pass:new e.cj(t),u_meter_to_tile:new e.cj(t),u_ao:new e.ck(t),u_flood_light_intensity:new e.cj(t),u_flood_light_color:new e.ci(t),u_attenuation:new e.cj(t),u_edge_radius:new e.cj(t),u_fb:new e.ch(t),u_fb_size:new e.cj(t),u_dynamic_offset:new e.cj(t)}),fill:t=>({u_matrix:new e.cl(t),u_emissive_strength:new e.cj(t),u_ground_shadow_factor:new e.ci(t)}),fillPattern:t=>({u_matrix:new e.cl(t),u_emissive_strength:new e.cj(t),u_image:new e.ch(t),u_texsize:new e.ck(t),u_pixel_coord_upper:new e.ck(t),u_pixel_coord_lower:new e.ck(t),u_tile_units_to_pixels:new e.cj(t),u_ground_shadow_factor:new e.ci(t),u_pattern_transition:new e.cj(t)}),fillOutline:t=>({u_matrix:new e.cl(t),u_emissive_strength:new e.cj(t),u_world:new e.ck(t),u_ground_shadow_factor:new e.ci(t)}),fillOutlinePattern:t=>({u_matrix:new e.cl(t),u_emissive_strength:new e.cj(t),u_world:new e.ck(t),u_image:new e.ch(t),u_texsize:new e.ck(t),u_pixel_coord_upper:new e.ck(t),u_pixel_coord_lower:new e.ck(t),u_tile_units_to_pixels:new e.cj(t),u_ground_shadow_factor:new e.ci(t),u_pattern_transition:new e.cj(t)}),building:t=>({u_matrix:new e.cl(t),u_normal_matrix:new e.cl(t),u_opacity:new e.cj(t),u_faux_facade_ao_intensity:new e.cj(t),u_camera_pos:new e.ci(t),u_tile_to_meter:new e.cj(t),u_facade_emissive_chance:new e.cj(t),u_flood_light_color:new e.ci(t),u_flood_light_intensity:new e.cj(t)}),buildingBloom:t=>({u_matrix:new e.cl(t)}),buildingDepth:t=>({u_matrix:new e.cl(t)}),elevatedStructuresDepth:t=>({u_matrix:new e.cl(t),u_depth_bias:new e.cj(t)}),elevatedStructures:t=>({u_matrix:new e.cl(t),u_ground_shadow_factor:new e.ci(t)}),elevatedStructuresDepthReconstruct:t=>({u_matrix:new e.cl(t),u_camera_pos:new e.ci(t),u_depth_bias:new e.cj(t),u_height_scale:new e.cj(t),u_reset_depth:new e.cj(t)}),circle:e.dY,collisionBox:t=>({u_matrix:new e.cl(t),u_inv_rot_matrix:new e.cl(t),u_camera_to_center_distance:new e.cj(t),u_extrude_scale:new e.ck(t),u_zoom_transition:new e.cj(t),u_merc_center:new e.ck(t),u_tile_id:new e.ci(t)}),collisionCircle:t=>({u_matrix:new e.cl(t),u_inv_matrix:new e.cl(t),u_camera_to_center_distance:new e.cj(t),u_viewport_size:new e.ck(t)}),debug:t=>
vendor: 9,432 bytes, line 2
2({u_color:new e.dB(t),u_matrix:new e.cl(t),u_overlay:new e.ch(t),u_overlay_scale:new e.cj(t)}),clippingMask:t=>({u_matrix:new e.cl(t)}),heatmap:t=>({u_extrude_scale:new e.cj(t),u_intensity:new e.cj(t),u_matrix:new e.cl(t),u_inv_rot_matrix:new e.cl(t),u_merc_center:new e.ck(t),u_tile_id:new e.ci(t),u_zoom_transition:new e.cj(t),u_up_dir:new e.ci(t)}),heatmapTexture:t=>({u_image:new e.ch(t),u_color_ramp:new e.ch(t),u_opacity:new e.cj(t)}),hillshade:t=>({u_matrix:new e.cl(t),u_image:new e.ch(t),u_latrange:new e.ck(t),u_light:new e.ck(t),u_shadow:new e.dB(t),u_highlight:new e.dB(t),u_emissive_strength:new e.cj(t),u_accent:new e.dB(t)}),hillshadePrepare:t=>({u_matrix:new e.cl(t),u_image:new e.ch(t),u_dimension:new e.ck(t),u_zoom:new e.cj(t)}),line:e.dX,linePattern:e.dW,raster:t=>({u_matrix:new e.cl(t),u_normalize_matrix:new e.cl(t),u_globe_matrix:new e.cl(t),u_merc_matrix:new e.cl(t),u_grid_matrix:new e.dC(t),u_tl_parent:new e.ck(t),u_scale_parent:new e.cj(t),u_fade_t:new e.cj(t),u_opacity:new e.cj(t),u_image0:new e.ch(t),u_image1:new e.ch(t),u_brightness_low:new e.cj(t),u_brightness_high:new e.cj(t),u_saturation_factor:new e.cj(t),u_contrast_factor:new e.cj(t),u_spin_weights:new e.ci(t),u_perspective_transform:new e.ck(t),u_raster_elevation:new e.cj(t),u_zoom_transition:new e.cj(t),u_merc_center:new e.ck(t),u_cutoff_params:new e.d3(t),u_colorization_mix:new e.d3(t),u_colorization_offset:new e.cj(t),u_color_ramp:new e.ch(t),u_texture_offset:new e.ck(t),u_texture_res:new e.ck(t),u_emissive_strength:new e.cj(t)}),rasterParticle:t=>({u_matrix:new e.cl(t),u_normalize_matrix:new e.cl(t),u_globe_matrix:new e.cl(t),u_merc_matrix:new e.cl(t),u_grid_matrix:new e.dC(t),u_tl_parent:new e.ck(t),u_scale_parent:new e.cj(t),u_fade_t:new e.cj(t),u_opacity:new e.cj(t),u_image0:new e.ch(t),u_image1:new e.ch(t),u_raster_elevation:new e.cj(t),u_zoom_transition:new e.cj(t),u_merc_center:new e.ck(t),u_cutoff_params:new e.d3(t)}),rasterParticleTexture:t=>({u_texture:new e.ch(t),u_opacity:new e.cj(t)}),rasterParticleDraw:t=>({u_particle_texture:new e.ch(t),u_particle_texture_side_len:new e.cj(t),u_tile_offset:new e.ck(t),u_velocity:new e.ch(t),u_color_ramp:new e.ch(t),u_velocity_res:new e.ck(t),u_max_speed:new e.cj(t),u_uv_offset:new e.ck(t),u_data_scale:new e.ck(t),u_data_offset:new e.cj(t),u_particle_pos_scale:new e.cj(t),u_particle_pos_offset:new e.ck(t)}),rasterParticleUpdate:t=>({u_particle_texture:new e.ch(t),u_particle_texture_side_len:new e.cj(t),u_velocity:new e.ch(t),u_velocity_res:new e.ck(t),u_max_speed:new e.cj(t),u_speed_factor:new e.cj(t),u_reset_rate:new e.cj(t),u_rand_seed:new e.cj(t),u_uv_offset:new e.ck(t),u_data_scale:new e.ck(t),u_data_offset:new e.cj(t),u_particle_pos_scale:new e.cj(t),u_particle_pos_offset:new e.ck(t)}),symbol:t=>({u_is_size_zoom_constant:new e.ch(t),u_is_size_feature_constant:new e.ch(t),u_size_t:new e.cj(t),u_size:new e.cj(t),u_camera_to_center_distance:new e.cj(t),u_rotate_symbol:new e.ch(t),u_aspect_ratio:new e.cj(t),u_fade_change:new e.cj(t),u_matrix:new e.cl(t),u_label_plane_matrix:new e.cl(t),u_coord_matrix:new e.cl(t),u_is_text:new e.ch(t),u_elevation_from_sea:new e.ch(t),u_pitch_with_map:new e.ch(t),u_texsize:new e.ck(t),u_texsize_icon:new e.ck(t),u_texture:new e.ch(t),u_texture_icon:new e.ch(t),u_gamma_scale:new e.cj(t),u_device_pixel_ratio:new e.cj(t),u_tile_id:new e.ci(t),u_zoom_transition:new e.cj(t),u_inv_rot_matrix:new e.cl(t),u_merc_center:new e.ck(t),u_camera_forward:new e.ci(t),u_tile_matrix:new e.cl(t),u_up_vector:new e.ci(t),u_ecef_origin:new e.ci(t),u_is_halo:new e.ch(t),u_icon_transition:new e.cj(t),u_color_adj_mat:new e.cl(t),u_scale_factor:new e.cj(t),u_ground_shadow_factor:new e.ci(t),u_inv_matrix:new e.cl(t),u_normal_scale:new e.cj(t),u_lutTexture:new e.ch(t)}),background:t=>({u_matrix:new e.cl(t),u_emissive_strength:new e.cj(t),u_opacity:new e.cj(t),u_color:new e.dB(t)}),backgroundPattern:t=>({u_matrix:new e.cl(t),u_emissive_strength:new e.cj(t),u_opacity:new e.cj(t),u_image:new e.ch(t),u_pattern_tl:new e.ck(t),u_pattern_br:new e.ck(t),u_texsize:new e.ck(t),u_pattern_size:new e.ck(t),u_pixel_coord_upper:new e.ck(t),u_pixel_coord_lower:new e.ck(t),u_pattern_units_to_pixels:new e.ck(t)}),terrainRaster:t=>({u_matrix:new e.cl(t),u_image0:new e.ch(t),u_image1:new e.ch(t),u_skirt_height:new e.cj(t),u_ground_shadow_factor:new e.ci(t),u_emissive_texture_available:new e.cj(t)}),skybox:t=>({u_matrix:new e.cl(t),u_sun_direction:new e.ci(t),u_cubemap:new e.ch(t),u_opacity:new e.cj(t),u_temporal_offset:new e.cj(t)}),skyboxGradient:t=>({u_matrix:new e.cl(t),u_color_ramp:new e.ch(t),u_center_direction:new e.ci(t),u_radius:new e.cj(t),u_opacity:new e.cj(t),u_temporal_offset:new e.cj(t)}),skyboxCapture:t=>({u_matrix_3f:new e.dC(t),u_sun_direction:new e.ci(t),u_sun_intensity:new e.cj(t),u_color_tint_r:new e.d3(t),u_color_tint_m:new e.d3(t),u_luminance:new e.cj(t)}),globeRaster:t=>({u_proj_matrix:new e.cl(t),u_globe_matrix:new e.cl(t),u_normalize_matrix:new e.cl(t),u_merc_matrix:new e.cl(t),u_zoom_transition:new e.cj(t),u_merc_center:new e.ck(t),u_image0:new e.ch(t),u_image1:new e.ch(t),u_grid_matrix:new e.dC(t),u_skirt_height:new e.cj(t),u_far_z_cutoff:new e.cj(t),u_frustum_tl:new e.ci(t),u_frustum_tr:new e.ci(t),u_frustum_br:new e.ci(t),u_frustum_bl:new e.ci(t),u_globe_pos:new e.ci(t),u_globe_radius:new e.cj(t),u_viewport:new e.ck(t),u_emissive_texture_available:new e.cj(t)}),globeAtmosphere:t=>({u_frustum_tl:new e.ci(t),u_frustum_tr:new e.ci(t),u_frustum_br:new e.ci(t),u_frustum_bl:new e.ci(t),u_horizon:new e.cj(t),u_transition:new e.cj(t),u_fadeout_range:new e.cj(t),u_atmosphere_fog_color:new e.d3(t),u_high_color:new e.d3(t),u_space_color:new e.d3(t),u_temporal_offset:new e.cj(t),u_horizon_angle:new e.cj(t)}),model:t=>({u_matrix:new e.cl(t),u_lighting_matrix:new e.cl(t),u_normal_matrix:new e.cl(t),u_node_matrix:new e.cl(t),u_lightpos:new e.ci(t),u_lightintensity:new e.cj(t),u_lightcolor:new e.ci(t),u_camera_pos:new e.ci(t),u_opacity:new e.cj(t),u_baseColorFactor:new e.d3(t),u_emissiveFactor:new e.d3(t),u_metallicFactor:new e.cj(t),u_roughnessFactor:new e.cj(t),u_baseTextureIsAlpha:new e.ch(t),u_alphaMask:new e.ch(t),u_alphaCutoff:new e.cj(t),u_baseColorTexture:new e.ch(t),u_metallicRoughnessTexture:new e.ch(t),u_normalTexture:new e.ch(t),u_occlusionTexture:new e.ch(t),u_emissionTexture:new e.ch(t),u_lutTexture:new e.ch(t),u_color_mix:new e.d3(t),u_aoIntensity:new e.cj(t),u_emissive_strength:new e.cj(t),u_occlusionTextureTransform:new e.d3(t)}),modelDepth:t=>({u_matrix:new e.cl(t),u_instance:new e.cl(t),u_node_matrix:new e.cl(t)}),groundShadow:t=>({u_matrix:new e.cl(t),u_ground_shadow_factor:new e.ci(t)}),stars:t=>({u_matrix:new e.cl(t),u_up:new e.ci(t),u_right:new e.ci(t),u_intensity_multiplier:new e.cj(t)}),snowParticle:t=>({u_modelview:new e.cl(t),u_projection:new e.cl(t),u_time:new e.cj(t),u_cam_pos:new e.ci(t),u_velocityConeAperture:new e.cj(t),u_velocity:new e.cj(t),u_horizontalOscillationRadius:new e.cj(t),u_horizontalOscillationRate:new e.cj(t),u_boxSize:new e.cj(t),u_billboardSize:new e.cj(t),u_simpleShapeParameters:new e.ck(t),u_screenSize:new e.ck(t),u_thinningCenterPos:new e.ck(t),u_thinningShape:new e.ci(t),u_thinningAffectedRatio:new e.cj(t),u_thinningParticleOffset:new e.cj(t),u_particleColor:new e.d3(t),u_direction:new e.ci(t)}),rainParticle:t=>({u_modelview:new e.cl(t),u_projection:new e.cl(t),u_time:new e.cj(t),u_cam_pos:new e.ci(t),u_texScreen:new e.ch(t),u_velocityConeAperture:new e.cj(t),u_velocity:new e.cj(t),u_boxSize:new e.cj(t),u_rainDropletSize:new e.ck(t),u_distortionStrength:new e.cj(t),u_rainDirection:new e.ci(t),u_color:new e.d3(t),u_screenSize:new e.ck(t),u_thinningCenterPos:new e.ck(t),u_thinningShape:new e.ci(t),u_thinningAffectedRatio:new e.cj(t),u_thinningParticleOffset:new e.cj(t),u_shapeDirectionalPower:new e.cj(t),u_shapeNormalPower:new e.cj(t),u_mode:new e.cj(t)}),vignette:t=>({u_vignetteShape:new e.ci(t),u_vignetteColor:new e.d3(t)}),occlusion:t=>({u_matrix:new e.cl(t),u_anchorPos:new e.ci(t),u_screenSizePx:new e.ck(t),u_occluderSizePx:new e.ck(t),u_color:new e.d3(t)})};class Xo{constructor(e,t,i,r){this.id=Xo.uniqueIdxCounter,Xo.uniqueIdxCounter++,this.context=e;const n=e.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||r||t.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){this.id=Xo.uniqueIdxCounter,Xo.uniqueIdxCounter++;const t=this.context.gl;this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Xo.uniqueIdxCounter=0;const Yo={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Ko{constructor(e,t,i,r,n,o){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.instanceCount=o,this.context=e;const s=e.gl;this.buffer=s.createBuffer(),e.bindVertexBuffer.set(this.buffer),s.bufferData(s.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?s.DYNAMIC_DRAW:s.STATIC_DRAW),this.dynamicDraw||n||t.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){const t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}
vendor: 22,439 bytes, line 2
2enableAttributes(e,t){for(let i=0;i<this.attributes.length;i++){const r=t.getAttributeLocation(e,this.attributes[i].name);-1!==r&&e.enableVertexAttribArray(r)}}setVertexAttribPointers(e,t,i){for(let r=0;r<this.attributes.length;r++){const n=this.attributes[r],o=t.getAttributeLocation(e,n.name);-1!==o&&e.vertexAttribPointer(o,n.components,e[Yo[n.type]],!1,this.itemSize,n.offset+this.itemSize*(i||0))}}setVertexAttribDivisor(e,t,i){for(let r=0;r<this.attributes.length;r++){const n=t.getAttributeLocation(e,this.attributes[r].name);-1!==n&&this.instanceCount&&this.instanceCount>0&&e.vertexAttribDivisor(n,i)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Jo{constructor(e,t,i,r,n){this.context=e,this.width=t,this.height=i;const o=this.framebuffer=e.gl.createFramebuffer();r>0&&(this.colorAttachment0=new Gn(e,o,0)),r>1&&(this.colorAttachment1=new Gn(e,o,1)),n&&(this.depthAttachmentType=n,this.depthAttachment="renderbuffer"===n?new qn(e,o):new Hn(e,o))}createColorAttachment(e,t){0===t?this.colorAttachment0=new Gn(e,this.framebuffer,0):1===t&&(this.colorAttachment1=new Gn(e,this.framebuffer,1))}removeColorAttachment(e,t){const i=this.context.gl;let r;0===t?(r=this.colorAttachment0.get(),this.colorAttachment0=void 0):1===t&&(r=this.colorAttachment1.get(),this.colorAttachment1=void 0),r&&i.deleteTexture(r)}destroy(){const e=this.context.gl;if(this.colorAttachment0){const t=this.colorAttachment0.get();t&&e.deleteTexture(t)}if(this.colorAttachment1){const t=this.colorAttachment1.get();t&&e.deleteTexture(t)}if(this.depthAttachment&&this.depthAttachmentType)if("renderbuffer"===this.depthAttachmentType){const t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}else{const t=this.depthAttachment.get();t&&e.deleteTexture(t)}e.deleteFramebuffer(this.framebuffer)}}class Qo{constructor(e,t){this.gl=e,this.clearColor=new un(this),this.clearDepth=new dn(this),this.clearStencil=new pn(this),this.colorMask=new fn(this),this.depthMask=new mn(this),this.stencilMask=new _n(this),this.stencilFunc=new gn(this),this.stencilOp=new yn(this),this.stencilTest=new xn(this),this.depthRange=new vn(this),this.depthTest=new bn(this),this.depthFunc=new wn(this),this.blend=new Tn(this),this.blendFunc=new Sn(this),this.blendColor=new En(this),this.blendEquation=new In(this),this.cullFace=new An(this),this.cullFaceSide=new Mn(this),this.frontFace=new Cn(this),this.program=new Pn(this),this.activeTexture=new Rn(this),this.viewport=new zn(this),this.bindFramebuffer=new Ln(this),this.bindRenderbuffer=new Dn(this),this.bindTexture=new On(this),this.bindVertexBuffer=new Fn(this),this.bindElementBuffer=new kn(this),this.bindVertexArrayOES=new Bn(this),this.pixelStoreUnpack=new Nn(this),this.pixelStoreUnpackPremultiplyAlpha=new Vn(this),this.pixelStoreUnpackFlipY=new Un(this),this.options=t?Object.assign({},t):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=e.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=e.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=e.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=t&&!!t.forceManualRenderingForInstanceIDShaders||this.renderer&&-1!==this.renderer.indexOf("PowerVR"),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=e.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=e.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=e.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.extBlendFuncExtended=e.getExtension("WEBGL_blend_func_extended")}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t,i){return new Xo(this,e,t,i)}createVertexBuffer(e,t,i,r,n){return new Ko(this,e,t,i,r,n)}createRenderbuffer(e,t,i){const r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),n}createFramebuffer(e,t,i,r){return new Jo(this,e,t,i,r)}clear({color:e,depth:t,stencil:i,colorMask:r}){const n=this.gl;let o=0;e&&(o|=n.COLOR_BUFFER_BIT,this.clearColor.set(e.toNonPremultipliedRenderColor(null)),this.colorMask.set(r||[!0,!0,!0,!0])),void 0!==t&&(o|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),void 0!==i&&(o|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),n.clear(o)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(t){e.by(t.blendFunction,Zi.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor),t.blendEquation?this.blendEquation.set(t.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(t.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let es;function ts(t,i,r,n,o,s,a){const l=t.context,c=l.gl,h=t.transform,u=[e.aF(h.center.lng),e.aJ(h.center.lat)],d=r.layout.get("symbol-placement"),p=r.layout.get("text-variable-anchor"),f="map"===r.layout.get("icon-rotation-alignment"),m="map"===r.layout.get("text-rotation-alignment"),_="point"!==d,g=[];let y=0,x=0;for(let E=0;E<n.length;E++){const l=n[E],d=i.getTile(l),v=d.getBucket(r);if(!v)continue;const b=v.getProjection().createInversionMatrix(h,l.canonical),w=[],T=Jt(l,v,h),S=!a&&f&&_,I=a&&m&&_,A=p&&v.hasTextData(),M=v.hasIconTextFit()&&A&&v.hasIconData(),C=S||I||a&&A||M,P="globe"===v.projection.name,R=P?e.aj(h.zoom):0;P&&(w.push("PROJECTION_GLOBE_VIEW"),C&&w.push("PROJECTED_POS_ON_VIEWPORT"));const z=t.getOrCreateProgram("collisionBox",{defines:w});let L=T;0===o[0]&&0===o[1]||(L=t.translatePosMatrix(T,d,o,s));const D=a?v.textCollisionBox:v.iconCollisionBox,O=v.collisionCircleArray;if(O.length>0){const t=e.bC(),i=L;e.cP(t,v.placementInvProjMatrix,h.glCoordMatrix),e.cP(t,t,v.placementViewportMatrix),g.push({circleArray:O,circleOffset:x,transform:i,invTransform:t,projection:v.getProjection()}),y+=O.length/4,x=y}if(!D)continue;t.terrain&&t.terrain.setupElevationDraw(d,z);const F=P?[l.canonical.x,l.canonical.y,1<<l.canonical.z]:[0,0,0];z.draw(t,c.LINES,Wi.disabled,Yi.disabled,t.colorModeForRenderPass(),Qi.disabled,Mo(L,b,h,R,u,d,F,v.getProjection()),r.id,D.layoutVertexBuffer,D.indexBuffer,D.segments,null,h.zoom,null,[D.collisionVertexBuffer,D.collisionVertexBufferExt])}if(!a||!g.length)return;const v=t.getOrCreateProgram("collisionCircle"),b=new e.dZ;b.resize(4*y),b._trim();let w=0;for(const e of g)for(let t=0;t<e.circleArray.length/4;t++){const i=4*t,r=e.circleArray[i+0],n=e.circleArray[i+1],o=e.circleArray[i+2],s=e.circleArray[i+3];b.emplace(w++,r,n,o,s,0),b.emplace(w++,r,n,o,s,1),b.emplace(w++,r,n,o,s,2),b.emplace(w++,r,n,o,s,3)}(!es||es.length<2*y)&&(es=function(t){const i=2*t,r=new e.b0;r.resize(i),r._trim();for(let e=0;e<i;e++){const t=6*e;r.uint16[t+0]=4*e+0,r.uint16[t+1]=4*e+1,r.uint16[t+2]=4*e+2,r.uint16[t+3]=4*e+2,r.uint16[t+4]=4*e+3,r.uint16[t+5]=4*e+0}return r}(y));const T=l.createIndexBuffer(es,!0),S=l.createVertexBuffer(b,e.d_.members,!0);for(const E of g){const i=Co(E.transform,E.invTransform,h,E.projection);v.draw(t,c.TRIANGLES,Wi.disabled,Yi.disabled,t.colorModeForRenderPass(),Qi.disabled,i,r.id,S,T,e.bg.simpleSegment(0,2*E.circleOffset,E.circleArray.length,E.circleArray.length/2),null,h.zoom)}S.destroy(),T.destroy()}const is=e.bC();function rs(t){const i=t._camera.getWorldToCamera(t.worldSize,1),r=e.aB([],i,t.globeMatrix);e.bl(r,r);const n=[0,0,0],o=[0,1,0,0];return e.aC(o,o,r),n[0]=o[0],n[1]=o[1],n[2]=o[2],e.aw(n,n),n}function ns({width:t,height:i,anchor:r,textOffset:n,textScale:o},s){const{horizontalAlign:a,verticalAlign:l}=e.c1(r),c=-(a-.5)*t,h=-(l-.5)*i,u=e.c2(r,n);return new e.P((c/o+u[0])*s,(h/o+u[1])*s)}function os(t,i,r,n,o,s,a,l,c,h){const u=t.text.placedSymbolArray,d=t.text.dynamicLayoutVertexArray,p=t.icon.dynamicLayoutVertexArray,f={},m=t.getProjection(),_=Qt(a,m,o),g=o.elevation,y=m.upVectorScale(a.canonical,o.center.lat,o.worldSize).metersToTile;d.clear();for(let x=0;x<u.length;x++){const p=u.get(x),{tileAnchorX:v,tileAnchorY:b,numGlyphs:w}=p,T=p.hidden||!p.crossTileID||t.allowVerticalPlacement&&!p.placedOrientation?null:n[p.crossTileID];if(T){let n=0,u=0,S=0;const E="road"===t.elevationType;if(g||E){const i=E?t.getElevationFeatureForText(x):null,r=e.bV.getAtTileOffset(a,new e.P(v,b),g,i),[o,s,l]=m.upVector(a.canonical,v,b);n=r*o*y,u=r*s*y,S=r*l*y}let[I,A,M,C]=si(p.projectedAnchorX+n,p.projectedAnchorY+u,p.projectedAnchorZ+S,r?_:s);const P=ai(o.getCameraToCenterDistance(m),C);let R=e.bM(t.textSizeData,c,p)*P/e.bY;r&&(R*=t.tilePixelRatio/l);const z=ns(T,R);r?(({x:I,y:A,z:M}=m.projectTilePoint(v+z.x,b+z.y,a.canonical)),[I,A,M]=si(I+n,A+u,M+S,s)):(i&&z._rotate(-o.angle),I+=z.x,A+=z.y,M=0);const L=t.allowVerticalPlacement&&p.placedOrientation===e.bL.vertical?Math.PI/2:0;for(let t=0;t<w;t++)e.bO(d,I,A,M,L);h&&p.associatedIconIndex>=0&&(f[p.associatedIconIndex]={x:I,y:A,z:M,angle:L})}else _i(w,d)}if(h){p.clear();const i=t.icon.placedSymbolArray;for(let t=0;t<i.length;t++){const r=i.get(t),{numGlyphs:n}=r,o=f[t];if(r.hidden||!o)_i(n,p);else{const{x:t,y:i,z:r,angle:s}=o;for(let o=0;o<n;o++)e.bO(p,t,i,r,s)}}t.icon.dynamicLayoutVertexBuffer.updateData(p)}t.text.dynamicLayoutVertexBuffer.updateData(d)}function ss(t,i,r,n,o,s,a={}){const l=r.paint.get("icon-translate"),c=r.paint.get("text-translate"),h=r.paint.get("icon-translate-anchor"),u=r.paint.get("text-translate-anchor"),d=r.layout.get("icon-rotation-alignment"),p=r.layout.get("text-rotation-alignment"),f=r.layout.get("icon-pitch-alignment"),m=r.layout.get("text-pitch-alignment"),_=r.layout.get("icon-keep-upright"),g=r.layout.get("text-keep-upright"),y=r.paint.get("icon-color-saturation"),x=r.paint.get("icon-color-contrast"),v=r.paint.get("icon-color-brightness-min"),b=r.paint.get("icon-color-brightness-max"),w="sea"===r.layout.get("symbol-elevation-reference"),T="none"===r.layout.get("icon-image-use-theme"),S=t.context,E=S.gl,I=t.transform,A="map"===d,M="map"===p,C="map"===f,P="map"===m,R=void 0!==r.layout.get("symbol-sort-key").constantOr(1);let z=!1;const L=t.depthModeForSublayer(0,Wi.ReadOnly),D=new Wi(t.context.gl.LEQUAL,Wi.ReadOnly,t.depthRangeFor3D),O=[e.aF(I.center.lng),e.aJ(I.center.lat)],F=r.layout.get("text-variable-anchor"),k="globe"===I.projection.name,B=[],N=[0,-1,0];for(const V of n){const n=i.getTile(V),o=n.getBucket(r);if(!o)continue;if("mercator"===o.projection.name&&k)continue;if(o.fullyClipped)continue;const s="globe"===o.projection.name,d=s?e.aj(I.zoom):0,p=Qt(V,o.getProjection(),I),f=I.calculatePixelsToTileUnitsMatrix(n),m=F&&o.hasTextData(),U=o.hasIconTextFit()&&m&&o.hasIconData(),j=o.getProjection().createInversionMatrix(I,V.canonical),G=(1<<n.tileID.canonical.z)*e.al/t.transform.worldSize,q=e=>{let i=[0,0,0];if(e){const e=t.style.directionalLight,r=t.style.ambientLight;e&&r&&(i=_r(t.style,e,r))}return i},H=e=>{I.depthOcclusionForSymbolsAndCircles&&(r.hasOcclusionOpacityProperties||t.terrain)&&(e.push("DEPTH_D24"),e.push("DEPTH_OCCLUSION"))},$=i=>{r.lut&&!T&&(r.lut.texture||(r.lut.texture=new e.d$(t.context,r.lut.image,[r.lut.image.height,r.lut.image.height,r.lut.image.height],S.gl.RGBA8)),S.activeTexture.set(S.gl.TEXTURE0+10),r.lut.texture&&r.lut.texture.bind(S.gl.LINEAR,S.gl.CLAMP_TO_EDGE),i.push("APPLY_LUT_ON_GPU"))},Z=()=>{const i=A&&"point"!==r.layout.get("symbol-placement"),a=[];H(a),$(a);const c=i||U,u="road"===o.elevationType,m=t.shadowRenderer,g=u&&C&&!!m&&m.enabled,T=q(g),S=u&&C&&!t.terrain?D:L,M=r.paint.get("icon-image-cross-fade");t.terrainRenderModeElevated()&&C&&a.push("PITCH_WITH_MAP_TERRAIN"),s&&(a.push("PROJECTION_GLOBE_VIEW"),c&&a.push("PROJECTED_POS_ON_VIEWPORT")),M>0&&o.hasAnySecondaryIcon&&a.push("ICON_TRANSITION"),!o.icon.zOffsetVertexBuffer||u&&t.terrain||a.push("Z_OFFSET"),0===y&&0===x&&0===v&&1===b||a.push("COLOR_ADJUSTMENT"),o.sdfIcons&&a.push("RENDER_SDF"),g&&a.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),u&&C&&!t.terrain&&o.icon.orientationVertexBuffer&&a.push("ELEVATED_ROADS");const P=o.icon.programConfigurations.get(r.id),R=t.getOrCreateProgram("symbol",{config:P,defines:a}),z=n.imageAtlasTexture?n.imageAtlasTexture.size:[0,0],F=o.iconSizeData,B=e.bK(F,I.zoom),Z=C||!I.isOrthographic,W=ri(p,n.tileID.canonical,C,A,I,o.getProjection(),f),X=oi(p,n.tileID.canonical,C,A,I,o.getProjection(),f),Y=t.translatePosMatrix(X,n,l,h,!0),K=t.translatePosMatrix(p,n,l,h),J=c?is:W,Q=A&&!C&&!i;let ee=N;!k&&!I.mercatorFromTransition||A||(ee=rs(I));const te=s?ee:N,ie=r.getColorAdjustmentMatrix(y,x,v,b),re=jo(F.kind,B,Q,C,t,K,J,Y,w,!1,z,[0,0],0,V,d,O,j,te,o.getProjection(),T,G,ie,M,null),ne=n.imageAtlasTexture?n.imageAtlasTexture:null,oe=1!==r.layout.get("icon-size").constantOr(0)||o.iconsNeedLinear,se=o.sdfIcons||t.options.rotating||t.options.zooming||oe||Z?E.LINEAR:E.NEAREST,ae=o.sdfIcons&&0!==r.paint.get("icon-halo-width").constantOr(1),le=t.terrain&&C&&i?e.bl(e.bC(),W):is;if(i&&o.icon){const i=e.bV.getAtTileOffsetFunc(V,I.center.lat,I.worldSize,o.getProjection()),s=ni(p,n.tileID.canonical,C,A,I,o.getProjection(),f),a=r.layout.get("icon-size-scale-range"),l=e.aA(t.scaleFactor,a[0],a[1]);ci(o,p,t,!1,s,X,C,_,i,V,l)}return{program:R,buffers:o.icon,uniformValues:re,atlasTexture:ne,atlasTextureIcon:null,atlasInterpolation:se,atlasInterpolationIcon:null,isSDF:o.sdfIcons,hasHalo:ae,depthMode:S,tile:n,renderWithShadows:g,labelPlaneMatrixInv:le}},W=()=>{const i=M&&"point"!==r.layout.get("symbol-placement"),a=[],l=i||F||U,h="road"===o.elevationType,m=t.shadowRenderer,_=h&&P&&!!m&&m.enabled,y=q(_),x=h&&P&&!t.terrain?D:L;t.terrainRenderModeElevated()&&P&&a.push("PITCH_WITH_MAP_TERRAIN"),s&&(a.push("PROJECTION_GLOBE_VIEW"),l&&a.push("PROJECTED_POS_ON_VIEWPORT")),!o.text.zOffsetVertexBuffer||h&&t.terrain||a.push("Z_OFFSET"),o.iconsInText&&a.push("RENDER_TEXT_AND_SYMBOL"),a.push("RENDER_SDF"),_&&a.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),h&&P&&!t.terrain&&o.text.orientationVertexBuffer&&a.push("ELEVATED_ROADS"),H(a);const v=o.text.programConfigurations.get(r.id),b=t.getOrCreateProgram("symbol",{config:v,defines:a});let T,S=[0,0],A=null;const C=o.textSizeData;o.iconsInText&&(S=n.imageAtlasTexture?n.imageAtlasTexture.size:[0,0],A=n.imageAtlasTexture?n.imageAtlasTexture:null,T=P||!I.isOrthographic||t.options.rotating||t.options.zooming||"composite"===C.kind||"camera"===C.kind?E.LINEAR:E.NEAREST);const R=n.glyphAtlasTexture?n.glyphAtlasTexture.size:[0,0],z=r.layout.get("text-size-scale-range"),B=e.aA(t.scaleFactor,z[0],z[1]),$=e.bK(C,I.zoom,B),Z=ri(p,n.tileID.canonical,P,M,I,o.getProjection(),f),W=oi(p,n.tileID.canonical,P,M,I,o.getProjection(),f),X=t.translatePosMatrix(W,n,c,u,!0),Y=t.translatePosMatrix(p,n,c,u),K=l?is:Z,J=M&&!P&&!i;let Q=N;!k&&!I.mercatorFromTransition||M||(Q=rs(I));const ee=jo(C.kind,$,J,P,t,Y,K,X,w,!0,R,S,0,V,d,O,j,s?Q:N,o.getProjection(),y,G,null,null,B),te=n.glyphAtlasTexture?n.glyphAtlasTexture:null,ie=E.LINEAR,re=0!==r.paint.get("text-halo-width").constantOr(1),ne=t.terrain&&P&&i?e.bl(e.bC(),Z):is;if(i&&o.text){const i=e.bV.getAtTileOffsetFunc(V,I.center.lat,I.worldSize,o.getProjection()),r=ni(p,n.tileID.canonical,P,M,I,o.getProjection(),f);ci(o,p,t,!0,r,W,P,g,i,V,B)}return{program:b,buffers:o.text,uniformValues:ee,atlasTexture:te,atlasTextureIcon:A,atlasInterpolation:ie,atlasInterpolationIcon:T,isSDF:!0,hasHalo:re,depthMode:x,tile:n,renderWithShadows:_,labelPlaneMatrixInv:ne}},X=o.icon.segments.get().length,Y=o.text.segments.get().length,K=X&&!a.onlyText?Z():null,J=Y&&!a.onlyIcons?W():null,Q=r.paint.get("icon-opacity").constantOr(1),ee=r.paint.get("text-opacity").constantOr(1);if(R&&o.canOverlap){z=!0;const t=Q&&!a.onlyText?o.icon.segments.get():[],i=ee&&!a.onlyIcons?o.text.segments.get():[];for(const r of t)B.push({segments:new e.bg([r]),sortKey:r.sortKey,state:K});for(const r of i)B.push({segments:new e.bg([r]),sortKey:r.sortKey,state:J})}else a.onlyText||B.push({segments:Q?o.icon.segments:new e.bg([]),sortKey:0,state:K}),a.onlyIcons||B.push({segments:ee?o.text.segments:new e.bg([]),sortKey:0,state:J})}z&&B.sort((e,t)=>e.sortKey-t.sortKey);for(const e of B){const i=e.state;if(i)if(t.terrain?t.terrain.setupElevationDraw(i.tile,i.program,{useDepthForOcclusion:I.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:i.labelPlaneMatrixInv}):t.setupDepthForOcclusion(I.depthOcclusionForSymbolsAndCircles,i.program),S.activeTexture.set(E.TEXTURE0),i.atlasTexture&&i.atlasTexture.bind(i.atlasInterpolation,E.CLAMP_TO_EDGE,!0),i.atlasTextureIcon&&(S.activeTexture.set(E.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,E.CLAMP_TO_EDGE,!0)),i.renderWithShadows&&t.shadowRenderer.setupShadows(i.tile.tileID.toUnwrapped(),i.program,"vector-tile"),t.uploadCommonLightUniforms(t.context,i.program),i.hasHalo){const n=i.uniformValues;n.u_is_halo=1,as(i.buffers,e.segments,r,t,i.program,i.depthMode,o,s,n,2),n.u_is_halo=0}else{if(i.isSDF){const n=i.uniformValues;i.hasHalo&&(n.u_is_halo=1,as(i.buffers,e.segments,r,t,i.program,i.depthMode,o,s,n,1)),n.u_is_halo=0}as(i.buffers,e.segments,r,t,i.program,i.depthMode,o,s,i.uniformValues,1)}}}function as(e,t,i,r,n,o,s,a,l,c){const h=[e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer,e.iconTransitioningVertexBuffer,e.globeExtVertexBuffer,e.zOffsetVertexBuffer,e.orientationVertexBuffer];n.draw(r,r.context.gl.TRIANGLES,o,s,a,Qi.disabled,l,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,r.transform.zoom,e.programConfigurations.get(i.id),h,c)}function ls(t,i){const r=1<<t.canonical.z,n=(i.x*r-t.canonical.x-t.wrap*r)*e.al,o=(i.y*r-t.canonical.y)*e.al,s=e.e8(i.z,i.y);return e.d5(n,o,s)}function cs(t,i,r,n,o){if(!r.layout||"none"===r.layout.get("fill-elevation-reference")||0===r.paint.get("fill-opacity").constantOr(1))return;const s=t.context.gl,a=new Wi(t.context.gl.LEQUAL,Wi.ReadWrite,t.depthRangeFor3D),l=new Wi(t.context.gl.GREATER,Wi.ReadWrite,t.depthRangeFor3D),c=function(t){let i=.01;return t.isOrthographic&&(i=e.ak(1e-4,i,e.d0(t.pitch>=ar?1:t.pitch/ar))),2*i}(t.transform),h=t.transform.getFreeCameraOptions().position,u="elevatedStructuresDepthReconstruct",d=t.getOrCreateProgram(u,{defines:["DEPTH_RECONSTRUCTION"]}),p=t.getOrCreateProgram(u);for(const e of n){const n=i.getTile(e),u=n.getBucket(r);if(!u)continue;const f=u.elevatedStructures;if(!f)continue;const m=u.elevationBufferData.heightRange,_=ls(e.toUnwrapped(),h),g=t.translatePosMatrix(e.projMatrix,n,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor"));let y,x,v,b;if("initialize"===o){if(!m||m.min>=1||0===f.depthSegments.segments[0].primitiveLength)continue;y=So(g,_,c,1,0),x=a,v=f.depthSegments,b=d}else if("reset"===o){if(!m||m.min>=0||0===f.maskSegments.segments[0].primitiveLength)continue;y=So(g,_,0,0,1),x=l,v=f.maskSegments,b=d}else if("geometry"===o){if(0===f.depthSegments.segments[0].primitiveLength)continue;y=So(g,_,c,1,0),x=a,v=f.depthSegments,b=p}b.draw(t,s.TRIANGLES,x,Yi.disabled,Zi.disabled,Qi.disabled,y,r.id,f.vertexBuffer,f.indexBuffer,v,r.paint,t.transform.zoom)}}function hs(t,i,r,n){const{painter:o,sourceCache:s,layer:a,coords:l,colorMode:c,elevationType:h,terrainEnabled:u,pass:d}=t,p=o.context.gl,f=a.paint.get("fill-pattern"),m=a.paint.get("fill-pattern-cross-fade"),_=f.constantOr(null);let g=h;"road"!==h||i&&!u||(g="none");const y="road"===g,x=t.painter.shadowRenderer,v=y&&!!x&&x.enabled,b=new Wi(o.context.gl.LEQUAL,Wi.ReadOnly,o.depthRangeFor3D);let w=[0,0,0];if(v){const e=o.style.directionalLight,t=o.style.ambientLight;e&&t&&(w=_r(o.style,e,t))}const T=f&&f.constantOr(1),S=o.terrain&&o.terrain.renderingToTexture,E=(t,d)=>{let f,g,E,I,A;d?(f=T&&!a.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",E=p.LINES):(f=T?"fillPattern":"fill",E=p.TRIANGLES);for(const M of l){const l=s.getTile(M);if(T&&!l.patternsLoaded())continue;const C=l.getBucket(a);if(!C)continue;const P=i?C.elevationBufferData:C.bufferData;if(P.isEmpty())continue;o.prepareDrawTile();const R=P.programConfigurations.get(a.id),z=o.isTileAffectedByFog(M
vendor: 5,192 bytes, line 2
2),L=[],D=[];y&&(L.push("ELEVATED_ROADS"),D.push(P.elevatedLayoutVertexBuffer)),v&&L.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),S&&r&&L.push("USE_MRT1"),T&&(o.context.activeTexture.set(p.TEXTURE0),l.imageAtlasTexture&&l.imageAtlasTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),R.updatePaintBuffers());let O=!1;if(_&&l.imageAtlas){const t=l.imageAtlas,i=e.e3.from(_),r=i.getPrimary().scaleSelf(e.o.devicePixelRatio).toString(),n=i.getSecondary(),o=t.patternPositions.get(r),s=n?t.patternPositions.get(n.scaleSelf(e.o.devicePixelRatio).toString()):null;O=!!o&&!!s,o&&R.setConstantPatternPositions(o,s)}m>0&&(O||R.getPatternTransitionVertexBuffer("fill-pattern"))&&L.push("FILL_PATTERN_TRANSITION");const F=o.getOrCreateProgram(f,{config:R,overrideFog:z,defines:L}),k=o.translatePosMatrix(M.projMatrix,l,a.paint.get("fill-translate"),a.paint.get("fill-translate-anchor"));v&&x.setupShadows(l.tileID.toUnwrapped(),F,"vector-tile");const B=a.paint.get("fill-emissive-strength");if(d){I=P.lineIndexBuffer,A=P.lineSegments;const e=o.terrain&&o.terrain.renderingToTexture?o.terrain.drapeBufferSize:[p.drawingBufferWidth,p.drawingBufferHeight];g="fillOutlinePattern"===f&&T?bo(k,B,o,l,e,w,m):vo(k,B,e,w)}else I=P.indexBuffer,A=P.triangleSegments,g=T?xo(k,B,o,l,w,m):yo(k,B,w);o.uploadCommonUniforms(o.context,F,M.toUnwrapped());let N=t;("road"===h&&!u||"offset"===h)&&(N=b),F.draw(o,E,N,n||o.stencilModeForClipping(M),c,Qi.disabled,g,a.id,P.layoutVertexBuffer,I,A,a.paint,o.transform.zoom,R,D)}};o.renderPass===d&&E(o.depthModeForSublayer(1,"opaque"===o.renderPass?Wi.ReadWrite:Wi.ReadOnly),!1),"none"===g&&"translucent"===o.renderPass&&a.paint.get("fill-antialias")&&E(o.depthModeForSublayer(a.getPaintProperty("fill-outline-color")?2:0,Wi.ReadOnly),!0)}function us(t,i,r,n,o,s,a,l){r.resetLayerRenderingStats(t);const c=t.context,h=c.gl,u=t.transform,d=r.paint.get("fill-extrusion-pattern"),p=r.paint.get("fill-extrusion-pattern-cross-fade"),f=d.constantOr(null),m=d.constantOr(1),_=r.paint.get("fill-extrusion-opacity"),g=t.style.enable3dLights(),y=r.paint.get(g&&!m?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),x=[r.paint.get("fill-extrusion-ambient-occlusion-intensity"),y],v=r.layout.get("fill-extrusion-edge-radius"),b=v>0&&!r.paint.get("fill-extrusion-rounded-roof"),w=b?0:v,T="globe"===u.projection.name?e.eb():0,S="globe"===u.projection.name,E=S?e.aj(u.zoom):0,I=[e.aF(u.center.lng),e.aJ(u.center.lat)],A="none"===r.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default"),M=r.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(A?null:r.lut).toArray01().slice(0,3),C=r.paint.get("fill-extrusion-flood-light-intensity"),P=r.paint.get("fill-extrusion-vertical-scale"),R=0!==r.paint.get("fill-extrusion-line-width").constantOr(1),z=r.paint.get("fill-extrusion-height-alignment"),L=r.paint.get("fill-extrusion-base-alignment"),D=cr(t,r.paint.get("fill-extrusion-cutoff-fade-range")),O=[];let F;S&&O.push("PROJECTION_GLOBE_VIEW"),x[0]>0&&O.push("FAUX_AO"),b&&O.push("ZERO_ROOF_RADIUS"),l&&O.push("HAS_CENTROID"),C>0&&O.push("FLOOD_LIGHT"),D.shouldRenderCutoff&&O.push("RENDER_CUTOFF"),R&&O.push("RENDER_WALL_MODE");const k="shadow"===t.renderPass,B=t.shadowRenderer,N=k&&!!B,V=k?Qi.disabled:Qi.backCCW;t.shadowRenderer&&(t.shadowRenderer.useNormalOffset=!0);let U=[0,0,0];if(B){const e=t.style.directionalLight,i=t.style.ambientLight;e&&i&&(U=_r(t.style,e,i)),k||(O.push("RENDER_SHADOWS","DEPTH_TEXTURE"),B.useNormalOffset&&O.push("NORMAL_OFFSET")),F=O.concat(["SHADOWS_SINGLE_CASCADE"])}const j=N?"fillExtrusionDepth":m?"fillExtrusionPattern":"fillExtrusion",G=r.getLayerRenderingStats();for(const q of n){const n=i.getTile(q),d=n.getBucket(r);if(!d||d.projection.name!==u.projection.name)continue;let g=!1;B&&(g=0===B.getMaxCascadeForTile(q.toUnwrapped()));const y=t.isTileAffectedByFog(q),v=d.programConfigurations.get(r.id);let b=!1;if(f&&n.imageAtlas){const t=n.imageAtlas,i=e.e3.from(f),r=i.getPrimary().scaleSelf(e.o.devicePixelRatio).toString(),o=i.getSecondary(),s=t.patternPositions.get(r),a=o?t.patternPositions.get(o.scaleSelf(e.o.devicePixelRatio).toString()):null;b=!!s&&!!a,s&&v.setConstantPatternPositions(s,a)}p>0&&(b||v.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&O.push("FILL_EXTRUSION_PATTERN_TRANSITION");const A=t.getOrCreateProgram(j,{config:v,defines:g?F:O,overrideFog:y});if(t.terrain&&t.terrain.setupElevationDraw(n,A,{useMeterToDem:!0}),!d.centroidVertexBuffer){const e=A.getAttributeLocation(h,"a_centroid_pos");-1!==e&&h.vertexAttrib2f(e,0,0)}!k&&B&&B.setupShadows(n.tileID.toUnwrapped(),A,"vector-tile"),m&&(t.context.activeTexture.set(h.TEXTURE0),n.imageAtlasTexture&&n.imageAtlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),v.updatePaintBuffers());const N=r.paint.get("fill-extrusion-vertical-gradient"),H=1/d.tileToMeter;let $;if(k&&B){if(ys(n.tileID,d.maxHeight,t))continue;const e=B.calculateShadowPassMatrixFromTile(n.tileID.toUnwrapped());$=_o(e,w,H,P,z,L)}else{const e=t.translatePosMatrix(q.expandedProjMatrix,n,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),i=u.projection.createInversionMatrix(u,q.canonical);
vendor: 16,131 bytes, line 2
2$=m?go(e,t,N,_,x,w,H,q,n,T,z,L,E,I,i,M,P,p):mo(e,t,N,_,x,w,H,q,T,z,L,E,I,i,M,P,C,U)}t.uploadCommonUniforms(c,A,q.toUnwrapped(),null,D);let Z=d.segments;if("mercator"===u.projection.name&&!k&&(Z=d.getVisibleSegments(n.tileID,t.terrain,t.transform.getFrustum(0)),!Z.get().length))continue;if(G)if(k)for(const e of Z.get())G.numRenderedVerticesInShadowPass+=e.primitiveLength;else for(const e of Z.get())G.numRenderedVerticesInTransparentPass+=e.primitiveLength;const W=[];(t.terrain||l)&&W.push(d.centroidVertexBuffer),S&&W.push(d.layoutVertexExtBuffer),R&&W.push(d.wallVertexBuffer),A.draw(t,c.gl.TRIANGLES,o,s,a,V,$,r.id,d.layoutVertexBuffer,d.indexBuffer,Z,r.paint,t.transform.zoom,v,W)}t.shadowRenderer&&(t.shadowRenderer.useNormalOffset=!1)}class ds{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function ps(t,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v){const b=i.context,w=b.gl,T=i.transform,S=i.transform.zoom,E=[],I=t.translate,A=t.translateAnchor,M=t.edgeRadius,C=cr(i,t.cutoffFadeRange);"clear"===u?(E.push("CLEAR_SUBPASS"),v&&(E.push("CLEAR_FROM_TEXTURE"),b.activeTexture.set(w.TEXTURE0),v.bind(w.LINEAR,w.CLAMP_TO_EDGE))):"sdf"===u?E.push("SDF_SUBPASS"):"emissive"===u&&(E.push("USE_MRT1"),b.activeTexture.set(w.TEXTURE0),v.bind(w.LINEAR,w.CLAMP_TO_EDGE)),y&&E.push("HAS_CENTROID"),C.shouldRenderCutoff&&E.push("RENDER_CUTOFF");const P=(e,t,r,o,u)=>{let x=E;null!=t.groundRadiusBuffer&&(x=E.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const w=t.programConfigurations.get(n.id),T=i.isTileAffectedByFog(e),I=i.getOrCreateProgram("fillExtrusionGroundEffect",{config:w,defines:x,overrideFog:T}),A=((e,t,i,r,n,o,s,a,l,c,h)=>({u_matrix:t,u_opacity:i,u_ao_pass:r?1:0,u_meter_to_tile:n,u_ao:o,u_flood_light_intensity:s,u_flood_light_color:a,u_attenuation:l,u_edge_radius:c,u_fb:0,u_fb_size:h,u_dynamic_offset:1}))(0,o,d,h,u,[p,f*u],m,_,g,S>=17?0:M*u,v?v.size[0]:0),P=[];y&&P.push(t.hiddenByLandmarkVertexBuffer),null!=t.groundRadiusBuffer&&P.push(t.groundRadiusBuffer),i.uploadCommonUniforms(b,I,e.toUnwrapped(),null,C),I.draw(i,b.gl.TRIANGLES,s,a,l,c,A,n.id,t.vertexBuffer,t.indexBuffer,r,n.paint,S,w,P)};for(const R of o){const t=r.getTile(R),o=t.getBucket(n);if(!o||o.projection.name!==T.projection.name||!o.groundEffect||o.groundEffect&&!o.groundEffect.hasData())continue;const s=o.groundEffect,a=1/o.tileToMeter;{const e=i.translatePosMatrix(R.projMatrix,t,I,A),r=s.getDefaultSegment();P(R,s,r,e,a)}if(x)for(let l=0;l<4;l++){const o=e.e9[l](R),s=r.getTile(o);if(!s)continue;const c=s.getBucket(n);if(!c||c.projection.name!==T.projection.name||!c.groundEffect||c.groundEffect&&!c.groundEffect.hasData())continue;const h=c.groundEffect;let u,d;0===l?(u=[-e.al,0,0],d=1):1===l?(u=[e.al,0,0],d=0):2===l?(u=[0,-e.al,0],d=3):(u=[0,e.al,0],d=2);const p=h.regionSegments[d];if(!p)continue;const f=new Float32Array(16);e.br(f,R.projMatrix,u),P(R,h,p,i.translatePosMatrix(f,t,I,A),a)}}}function fs(t,i,r,n,o,s,a){0===n.centroidVertexArray.length&&n.createCentroidsBuffer();const l=s?s.findDEMTileFor(r):null;if(!(l&&l.dem||a))return;s&&l&&l.dem&&n.selfDEMTileTimestamp!==l.dem._timestamp&&(n.borderDoneWithNeighborZ=[-1,-1,-1,-1],n.selfDEMTileTimestamp=l.dem._timestamp);const c=(t,i)=>{(t.flags|i.flags)&e.ec?(t.flags|=e.ec,i.flags|=e.ec):(t.flags&=~e.ec,i.flags&=~e.ec)},h=t=>new e.P(Math.ceil((t+e.ed)*e.ee),0),u=e=>{const t=i.getSource().minzoom,r=e=>{const t=i.getTileByID(e);if(t&&t.hasData())return t.getBucket(o)},n=[0,-1,1];for(const i of n){if(e.overscaledZ+i<t)continue;const n=r(e.calculateScaledKey(e.overscaledZ+i));if(n)return n}},d=[0,0,0],p=(t,i)=>(d[0]=Math.min(t.min.y,i.min.y),d[1]=Math.max(t.max.y,i.max.y),d[2]=e.al-i.min.x>t.max.x?i.min.x-e.al:t.max.x,d),f=(t,i)=>(d[0]=Math.min(t.min.x,i.min.x),d[1]=Math.max(t.max.x,i.max.x),d[2]=e.al-i.min.y>t.max.y?i.min.y-e.al:t.max.y,d),m=[(e,t)=>p(e,t),(e,t)=>p(t,e),(e,t)=>f(e,t),(e,t)=>f(t,e)],_=(t,i,n,o,a,c,h)=>{if(!s)return 0;const u=[[c?n:t,c?t:n,0],[c?n:i,c?i:n,0]],d=h<0?e.al+h:h,p=[c?d:(t+i)/2,c?(t+i)/2:d,0];return 0===n&&h<0||0!==n&&h>0?s.getForTilePoints(a,[p],!0,o):u.push(p),s.getForTilePoints(r,u,!0,l),Math.max(u[0][2],u[1][2],p[2])/s.exaggeration()};for(let g=0;g<4;g++){const t=n.borderFeatureIndices[g];if(0===t.length)continue;const i=e.e9[g](r),o=u(i);if(!(o&&o instanceof e.ea))continue;const l=s?s.findDEMTileFor(i):null;if(!(l&&l.dem||a))continue;if(s&&l&&l.dem&&n.borderDEMTileTimestamp[g]!==l.dem._timestamp&&(n.borderDoneWithNeighborZ[g]=-1,n.borderDEMTileTimestamp[g]=l.dem._timestamp),n.borderDoneWithNeighborZ[g]===o.canonical.z)continue;0===o.centroidVertexArray.length&&o.createCentroidsBuffer();const d=(g<2?1:5)-g,p=o.borderDoneWithNeighborZ[d]!==n.canonical.z,f=o.borderFeatureIndices[d];let y=0;if(n.canonical.z!==o.canonical.z){for(const e of t)n.showCentroid(n.featuresOnBorder[e]);if(p)for(const e of f)o.showCentroid(o.featuresOnBorder[e]);n.borderDoneWithNeighborZ[g]=o.canonical.z,o.borderDoneWithNeighborZ[d]=n.canonical.z}for(const r of t){const t=n.featuresOnBorder[r],s=n.centroidData[t.centroidDataIndex],u=t.borders[g];let p;for(;y<f.length;){p=o.featuresOnBorder[f[y]];const e=p.borders[d];if(e[1]>u[0]+3||e[0]>u[0]-3)break;o.showCentroid(p),y++}if(p&&y<f.length){const r=y;let x=0;for(;!(p.borders[d][0]>u[1]-3)&&(x++,++y!==f.length);)p=o.featuresOnBorder[f[y]];p=o.featuresOnBorder[f[r]];let v=!1;if(x>=1){const e=p.borders[d];Math.abs(u[0]-e[0])<3&&Math.abs(u[1]-e[1])<3&&(x=1,v=!0,y=r+1)}else if(0===x){n.showCentroid(t);continue}const b=o.centroidData[p.centroidDataIndex];a&&v&&c(s,b);const w=t.intersectsCount()>1||p.intersectsCount()>1;if(x>1)y=r,s.centroidXY=b.centroidXY=new e.P(0,0);else if(l&&l.dem&&!w){const t=m[g](s,b),r=g%2?e.al-1:0,n=_(t[0],Math.min(e.al-1,t[1]),r,l,i,g<2,t[2]);s.centroidXY=b.centroidXY=h(n)}else w?s.centroidXY=b.centroidXY=new e.P(0,0):(s.centroidXY=n.encodeBorderCentroid(t),b.centroidXY=o.encodeBorderCentroid(p));n.writeCentroidToBuffer(s),o.writeCentroidToBuffer(b)}else n.showCentroid(t)}n.borderDoneWithNeighborZ[g]=o.canonical.z,o.borderDoneWithNeighborZ[d]=n.canonical.z}(n.needsCentroidUpdate||!n.centroidVertexBuffer&&0!==n.centroidVertexArray.length)&&n.uploadCentroid(t)}const ms=[1,0,0],_s=[0,1,0],gs=[0,0,1];function ys(t,i,r){const n=r.transform,o=r.shadowRenderer;if(!o)return!0;const s=t.toUnwrapped(),a=n.tileSize*o._cascades[r.currentShadowCascade].scale;let l=i;if(n.elevation){const e=n.elevation.getMinMaxForTile(t);e&&(l+=e.max)}const c=[...o.shadowDirection];c[2]=-c[2];const h=o.computeSimplifiedTileShadowVolume(s,l,a,c);if(!h)return!1;const u=[ms,_s,gs,c,[c[0],0,c[2]],[0,c[1],c[2]]],d="globe"===n.projection.name,p=n.scaleZoom(a),f=e.cB.fromInvProjectionMatrix(n.invProjMatrix,n.worldSize,p,!d),m=o.getCurrentCascadeFrustum();return 0===f.intersectsPrecise(h.vertices,h.planes,u)||0===m.intersectsPrecise(h.vertices,h.planes,u)}function xs(t){const{painter:i,source:r,layer:n,coords:o}=t;let s=t.defines;const a=i.context,l="shadow"===i.renderPass,c="light-beam"===i.renderPass,h=i.shadowRenderer,u=e.ef(i.transform.center.lat,i.transform.zoom),d=cr(i,n.paint.get("building-cutoff-fade-range"));d.shouldRenderCutoff&&(s=s.concat("RENDER_CUTOFF")),t.floodLightIntensity>0&&(s=s.concat("FLOOD_LIGHT"));for(const p of o){const o=r.getTile(p),f=o.getBucket(n);if(!f)continue;h&&0===h.getMaxCascadeForTile(p.toUnwrapped())&&(s=s.concat("SHADOWS_SINGLE_CASCADE"));const m=f.programConfigurations.get(n.id);let _,g,y,x=i.translatePosMatrix(p.expandedProjMatrix,o,[0,0],"map");if(x=e.cS(e.bC(),x,[1,1,t.verticalScale]),l&&h){if(ys(o.tileID,f.maxHeight*u,i))continue;let r=h.calculateShadowPassMatrixFromTile(o.tileID.toUnwrapped());r=e.cS(e.bC(),r,[1,1,t.verticalScale]),y=Ao(r),_=g=i.getOrCreateProgram("buildingDepth",{config:m,defines:s,overrideFog:!1})}else if(c)_=g=i.getOrCreateProgram("buildingBloom",{config:m,defines:s,overrideFog:!1}),y=Io(x);else{const r=i.transform.calculatePosMatrix(p.toUnwrapped(),i.transform.worldSize);e.cS(r,r,[1,1,t.verticalScale]);const n=e.bC();e.cS(n,r,[1,-1,1/u]),e.bl(n,n),e.eg(n,n);const o=i.transform.getFreeCameraOptions().position,a=1<<p.canonical.z;if(y=Eo(x,n,t.opacity,t.facadeAOIntensity,[((o.x-p.wrap)*a-p.canonical.x)*e.al,(o.y*a-p.canonical.y)*e.al,o.z*a*e.al],f.tileToMeter,t.facadeEmissiveChance,t.floodLightColor,t.floodLightIntensity),g=i.getOrCreateProgram("building",{config:m,defines:s,overrideFog:!1}),!0===t.depthOnly)_=g;else{const e=s.concat(["BUILDING_FAUX_FACADE","HAS_ATTRIBUTE_a_faux_facade_color_emissive"]);_=i.getOrCreateProgram("building",{config:m,defines:e,overrideFog:!1})}h&&(h.setupShadowsFromMatrix(r,g,!0),_!==g&&h.setupShadowsFromMatrix(r,_,!0))}const v=(e,r)=>{if(c){const o=e.entranceBloom;r.draw(i,a.gl.TRIANGLES,t.depthMode,Yi.disabled,t.blendMode,Qi.disabled,y,n.id,o.layoutVertexBuffer,o.indexBuffer,o.segmentsBucket,n.paint,i.transform.zoom,m,[o.layoutAttenuationBuffer,o.layoutColorBuffer])}else{const o=e.segmentsBucket;let s=[e.layoutNormalBuffer,e.layoutCentroidBuffer,e.layoutColorBuffer,e.layoutFloodLightDataBuffer];e.layoutFacadePaintBuffer&&(s=s.concat([e.layoutFacadeDataBuffer,e.layoutFacadeVerticalRangeBuffer,e.layoutFacadePaintBuffer])),r.draw(i,a.gl.TRIANGLES,t.depthMode,Yi.disabled,t.blendMode,l?Qi.disabled:Qi.backCW,y,n.id,e.layoutVertexBuffer,e.indexBuffer,o,n.paint,i.transform.zoom,m,s)}};i.uploadCommonUniforms(a,g,p.toUnwrapped(),null,d),f.buildingWithoutFacade&&v(f.buildingWithoutFacade,g),f.buildingWithFacade&&(_!==g&&i.uploadCommonUniforms(a,_,p.toUnwrapped(),null,d),v(f.buildingWithFacade,_))}}function vs(t,i,r,n,o,s,a,l,c,h,u,d,p){const f=t.context.gl,m=t.depthModeForSublayer(1,Wi.ReadOnly,f.LEQUAL,!0),_=.1*(1-(g=u))+3*g;var g;const y=t._showOverdrawInspector,x=d,v=new ds;y||ps(v,t,i,r,n,m,new Yi({func:f.ALWAYS,mask:255},255,255,f.KEEP,f.KEEP,f.REPLACE),new Zi([f.ONE,f.ONE,f.ONE,f.ONE],e.ao.transparent,[!1,!1,!1,!0],f.MIN),Qi.disabled,o,"sdf",s,a,l,c,h,_,x,!1);{const u=y?Yi.disabled:new Yi({func:f.EQUAL,mask:255},255,255,f.KEEP,f.DECR,f.DECR),d=y?t.colorModeForRenderPass():new Zi([f.ONE_MINUS_DST_ALPHA,f.DST_ALPHA,f.ONE,f.ONE],e.ao.transparent,[!0,!0,!0,!0]);ps(v,t,i,r,n,m,u,d,Qi.disabled,o,"color",s,a,l,c,h,_,x,!1)}}function bs(t){return[t[0]*e.eh,t[1]*e.eh,t[2]*e.eh,0]}function ws(t,i,r,n,o,s,a,l,c){const h=n.getSource(),u=r.globeSharedBuffers;if(!u)return;let d,p,f;if(i&&(d=n.getTile(i)),h instanceof e.aU?(p=h.texture,f=e.dK(0,0,r.transform)):d&&i&&(p=d.texture,f=e.dK(i.canonical.z,i.canonical.x,r.transform)),!p||!f)return;t||(f=e.cS(e.bC(),f,[1,-1,1]));const m=r.context,_=m.gl,g="nearest"===o.paint.get("raster-resampling")?_.NEAREST:_.LINEAR,y=r.colorModeForDrapableLayerRenderPass(s),x=a.defines;x.push("GLOBE_POLES");const v=new Wi(_.LEQUAL,Wi.ReadWrite,r.depthRangeFor3D),b=Float32Array.from(r.transform.expandedFarZProjMatrix),w=Float32Array.from(e.bk(e.dJ(new e.cD(0,0,0))));r.terrain&&r.terrain.prepareDrawTile(),m.activeTexture.set(_.TEXTURE0),p.bind(g,_.CLAMP_TO_EDGE),m.activeTexture.set(_.TEXTURE1),p.bind(g,_.CLAMP_TO_EDGE),"useMipmap"in p&&m.extTextureFilterAnisotropic&&r.transform.pitch>20&&_.texParameterf(_.TEXTURE_2D,m.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,m.extTextureFilterAnisotropicMax);const[T,S,E,I]=i?u.getPoleBuffers(i.canonical.z,!1):u.getPoleBuffers(0,!0),A=o.paint.get("raster-elevation");let M;t?(M=T,r.renderDefaultNorthPole=0!==A):(M=S,r.renderDefaultSouthPole=0!==A);const C=bs(a.mix),P=((e,t,i,r,n,o,s,a,l,c,h,u,d)=>Oo(e,t,i,new Float32Array(16),new Float32Array(9),[0,0],r,[0,0],[0,0,0,0],1,{opacity:1,mix:0},o,[0,0]||0,a,2,c,h,u,1,0,d))(b,w,f,e.aj(r.transform.zoom),0,o,0,A,0,C,a.offset,a.range,s),R=r.getOrCreateProgram("raster",{defines:x});r.uploadCommonUniforms(m,R,null),R.draw(r,_.TRIANGLES,v,c,y,l,P,o.id,M,E,I)}function Ts(e){if(e.isOrthographic)return[0,0,0,0];const t=e._nearZ,i=e.projection.farthestPixelDistance(e),r=i-t,n=.2*e.height,o=t+n;return[t,i,(o-n-t)/r,(o-t)/r]}function Ss(e,t,i,r){if(e)return t instanceof ft&&e instanceof Lt?t.getTextureDescriptor(e,i,!0):{texture:e.texture,mix:bs(r.mix),offset:r.offset,buffer:0,tileSize:1}}var Es=e.ei([{name:"a_index",type:"Int16",components:1}]);class Is{constructor(t,i,r,n){const o={width:r[0],height:r[1],data:null},s=t.gl;this.targetColorTexture=new e.T(t,o,s.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new e.T(t,o,s.RGBA8,{useMipmap:!1}),this.context=t,this.updateParticleTexture(i,n),this.lastInvalidatedAt=0}updateParticleTexture(t,i){if(this.particleTextureDimension===i.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const r=this.context.gl,n=i.width*i.height;this.particleTexture0=new e.T(this.context,i,r.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new e.T(this.context,i,r.RGBA8,{premultiply:!1,useMipmap:!1});const o=new e.ej;o.reserve(n);for(let e=0;e<n;e++)o.emplaceBack(e);this.particleIndexBuffer=this.context.createVertexBuffer(o,Es.members,!0),this.particleSegment=e.bg.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=i.width}update(t){return!(this.lastInvalidatedAt<t&&(this.lastInvalidatedAt=e.o.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function As(t,i,r){if(!t)return null;const n=i.getTextureDescriptor(t,r,!0);if(!n)return null;let{texture:o,mix:s,offset:a,tileSize:l,buffer:c,format:h}=n;if(!o||!h)return null;let u=!1;return"uint32"===h&&(u=!0,s[3]=0,s=Lo(e.ek,s,[0,r.paint.get("raster-particle-max-speed")]),a=Do(e.ek,a,[0,r.paint.get("raster-particle-max-speed")])),{texture:o,textureOffset:[c/(l+2*c),l/(l+2*c)],tileSize:l,scalarData:u,scale:s,offset:a,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[h]]}}function Ms(e){const t=e._nearZ,i=e.projection.farthestPixelDistance(e),r=i-t,n=.2*e.height,o=t+n;return[t,i,(o-n-t)/r,(o-t)/r]}const Cs=new e.ao(1,0,0,1),Ps=new e.ao(0,1,0,1),Rs=new e.ao(0,0,1,1),zs=new e.ao(1,0,1,1),Ls=new e.ao(0,1,1,1);function Ds(t,i,r,n,o,s){for(let a=0;a<r.length;a++)if(o){const o=1,l=.8,c=new e.ao(n.r*l,n.g*l,n.b*l,1);Os(t,i,r[a],n,-o,-o,s),Os(t,i,r[a],n,-o,o,s),Os(t,i,r[a],n,o,o,s),Os(t,i,r[a],n,o,-o,s),Os(t,i,r[a],c,0,0,s)}else Os(t,i,r[a],n,0,0,s)}function Os(t,i,r,n,o,s,a){const l=t.context,c=t.transform,h=l.gl,u="globe"===c.projection.name,d=u?["PROJECTION_GLOBE_VIEW"]:[];let p=e.bz(r.projMatrix);if(u&&e.aj(c.zoom)>0){const t=e.bj(r.canonical,c),i=e.el(t);p=e.aB(new Float32Array(16),c.globeMatrix,i),e.aB(p,c.projMatrix,p)}const f=e.bC();f[12]+=2*o/(e.o.devicePixelRatio*c.width),f[13]+=2*s/(e.o.devicePixelRatio*c.height),e.aB(p,f,p);const m=t.getOrCreateProgram("debug",{defines:d}),_=i.getTileByID(r.key);t.terrain&&t.terrain.setupElevationDraw(_,m);const g=Wi.disabled,y=Yi.disabled,x=t.colorModeForRenderPass(),v="$debug";l.activeTexture.set(h.TEXTURE0),t.emptyTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),u?_._makeGlobeTileDebugBuffers(t.context,c):_._makeDebugTileBoundsBuffers(t.context,c.projection);const b=_._tileDebugBuffer||t.debugBuffer,w=_._tileDebugIndexBuffer||t.debugIndexBuffer,T=_._tileDebugSegments||t.debugSegments;if(m.draw(t,h.LINE_STRIP,g,y,x,Qi.disabled,Po(p,n.toPremultipliedRenderColor(null)),v,b,w,T,null,null,null,[_._globeTileDebugBorderBuffer]),a){const e=_.latestRawTileData,i=Math.floor((e&&e.byteLength||0)/1024);let n=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(n+=` => ${r.overscaledZ}`),n+=` ${_.state}`,n+=` ${i}kb`,function(e,t){e.initDebugOverlayCanvas();const i=e.debugOverlayCanvas,r=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(t,5,5),n.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}
vendor: 7,064 bytes, line 2
2(t,n)}const S=i.getTile(r).tileSize,E=512/Math.min(S,512)*(r.overscaledZ/c.zoom)*.5,I=_._tileDebugTextBuffer||t.debugBuffer,A=_._tileDebugTextIndexBuffer||t.quadTriangleIndexBuffer,M=_._tileDebugTextSegments||t.debugSegments;m.draw(t,h.TRIANGLES,g,y,Zi.alphaBlended,Qi.disabled,Po(p,e.ao.transparent.toPremultipliedRenderColor(null),E),v,I,A,M,null,null,null,[_._globeTileDebugTextBuffer])}function Fs(e,t,i,r){Bs(e,0,t+i/2,e.transform.width,i,r)}function ks(e,t,i,r){Bs(e,t-i/2,0,i,e.transform.height,r)}function Bs(t,i,r,n,o,s){const a=t.context,l=a.gl;l.enable(l.SCISSOR_TEST),l.scissor(i*e.o.devicePixelRatio,r*e.o.devicePixelRatio,n*e.o.devicePixelRatio,o*e.o.devicePixelRatio),a.clear({color:s}),l.disable(l.SCISSOR_TEST)}const Ns=e.ei([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Vs}=Ns;function Us(e,t,i,r){e.emplaceBack(t,i,r)}class js{constructor(t){this.vertexArray=new e.em,this.indices=new e.b0,Us(this.vertexArray,-1,-1,1),Us(this.vertexArray,1,-1,1),Us(this.vertexArray,-1,1,1),Us(this.vertexArray,1,1,1),Us(this.vertexArray,-1,-1,-1),Us(this.vertexArray,1,-1,-1),Us(this.vertexArray,-1,1,-1),Us(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,Vs),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=e.bg.simpleSegment(0,0,36,12)}}function Gs(t,i,r,n,o,s){const a=t.context.gl,l=i.paint.get("sky-atmosphere-color"),c=i.paint.get("sky-atmosphere-halo-color"),h=i.paint.get("sky-atmosphere-sun-intensity"),u=((e,t,i,r,n)=>({u_matrix_3f:e,u_sun_direction:t,u_sun_intensity:i,u_color_tint_r:[r.r,r.g,r.b,r.a],u_color_tint_m:[n.r,n.g,n.b,n.a],u_luminance:5e-5}))(e.eo(e.dO(),n),o,h,l.toPremultipliedRenderColor(null),c.toPremultipliedRenderColor(null));a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+s,i.skyboxTexture,0),r.draw(t,a.TRIANGLES,Wi.disabled,Yi.disabled,Zi.unblended,Qi.frontCW,u,"skyboxCapture",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}const qs=e.ei([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Hs{constructor(t){const i=new e.ep;i.emplaceBack(-1,1,1,0,0),i.emplaceBack(1,1,1,1,0),i.emplaceBack(1,-1,1,1,1),i.emplaceBack(-1,-1,1,0,1);const r=new e.b0;r.emplaceBack(0,1,2),r.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(i,qs.members),this.indexBuffer=t.createIndexBuffer(r),this.segments=e.bg.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const $s=e.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class Zs{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class Ws{constructor(t){this.colorModeAlphaBlendedWriteRGB=new Zi([1,$i,1,$i],e.ao.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new Zi([1,0,1,0],e.ao.transparent,[!1,!1,!1,!0]),this.params=new Zs,this.updateNeeded=!0}update(t){const i=t.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Hs(i);const t=this.params.sizeRange,r=this.params.intensityRange,n=function(t){const i=e.eq(30),r=[];for(let n=0;n<t;++n){const t=2*Math.PI*i(),n=Math.acos(1-2*i())-.5*Math.PI;r.push(e.d5(Math.cos(n)*Math.cos(t),Math.cos(n)*Math.sin(t),Math.sin(n)))}return r}(this.params.starsCount),o=e.eq(300),s=new e.er,a=new e.b0;let l=0;for(let i=0;i<n.length;++i){const c=e.c5([],n[i],200),h=Math.max(0,1+.01*t*(1*o()-.5)),u=Math.max(0,1+.01*r*(1*o()-.5));s.emplaceBack(c[0],c[1],c[2],-1,-1,h,u),s.emplaceBack(c[0],c[1],c[2],1,-1,h,u),s.emplaceBack(c[0],c[1],c[2],1,1,h,u),s.emplaceBack(c[0],c[1],c[2],-1,1,h,u),a.emplaceBack(l+0,l+1,l+2),a.emplaceBack(l+0,l+2,l+3),l+=4}this.starsVx=i.createVertexBuffer(s,$s.members),this.starsIdx=i.createIndexBuffer(a),this.starsSegments=e.bg.simpleSegment(0,0,s.length,a.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(t,i){const r=t.context,n=r.gl,o=t.transform,s=new Wi(n.LEQUAL,Wi.ReadOnly,[0,1]),a=e.aj(o.zoom),l=t.style.getLut(i.scope),c="none"===i.properties.get("color-use-theme"),h=i.properties.get("color").toNonPremultipliedRenderColor(c?null:l),u="none"===i.properties.get("high-color-use-theme"),d=i.properties.get("high-color").toNonPremultipliedRenderColor(u?null:l),p="none"===i.properties.get("space-color-use-theme"),f=i.properties.get("space-color").toNonPremultipliedRenderColor(p?null:l),m=5e-4,_=e.es(i.properties.get("horizon-blend"),0,1,m,.25),g=e.dE(t,r,o)&&_===m?o.worldSize/(2*Math.PI*1.025)-1:o.globeRadius,y=t.frameCounter/1e3%1,x=e.ag(o.globeCenterInViewSpace),v=Math.sqrt(Math.pow(x,2)-Math.pow(g,2)),b=Math.acos(v/x),w=e=>{const i="globe"===o.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];e&&i.push("ALPHA_PASS");const l=t.getOrCreateProgram("globeAtmosphere",{defines:i}),c=((e,t,i,r,n,o,s,a,l,c,h,u)=>({u_frustum_tl:e,u_frustum_tr:t,u_frustum_br:i,u_frustum_bl:r,u_horizon:n,u_transition:o,u_fadeout_range:s,u_atmosphere_fog_color:a.toArray01(),u_high_color:l.toArray01(),u_space_color:c.toArray01(),u_temporal_offset:h,u_horizon_angle:u}))(o.frustumCorners.TL,o.frustumCorners.TR,o.frustumCorners.BR,o.frustumCorners.BL,o.frustumCorners.horizon,a,_,h,d,f,y,b);t.uploadCommonUniforms(r,l);const u=this.atmosphereBuffer;u&&l.draw(t,n.TRIANGLES,s,Yi.disabled,e?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,Qi.backCW,c,e?"atmosphere_glow_alpha":"atmosphere_glow",u.vertexBuffer,u.indexBuffer,u.segments)};w(!1),w(!0)}drawStars(t,i){const r=e.aA(i.properties.get("star-intensity"),0,1);if(0===r)return;const n=t.context,o=n.gl,s=t.transform,a=t.getOrCreateProgram("stars"),l=e.c7([]);e.c9(l,l,-s._pitch),e.c8(l,l,-s.angle),e.c9(l,l,e.an(s._center.lat)),e.et(l,l,-e.an(s._center.lng));const c=e.cc(new Float32Array(16),l),h=e.aB([],s.starsProjMatrix,c),u=e.eo([],c),d=e.eu([],u),p=[0,1,0];e.dQ(p,p,d),e.c5(p,p,this.params.sizeMultiplier);const f=[1,0,0];e.dQ(f,f,d),e.c5(f,f,this.params.sizeMultiplier);const m=(_=p,g=f,y=r,{u_matrix:Float32Array.from(h),u_up:_,u_right:g,u_intensity_multiplier:y});var _,g,y;t.uploadCommonUniforms(n,a),this.starsVx&&this.starsIdx&&a.draw(t,o.TRIANGLES,Wi.disabled,Yi.disabled,this.colorModeAlphaBlendedWriteRGB,Qi.disabled,m,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class Xs{constructor(){this.visibleTiles=[]}updateBorders(t,i){const r=[],n=[],o=t._getRenderableCoordinates(!1,!0);for(const e of o){const o=t.getTile(e);
2if(!o.hasData())continue;const s=o.getBucket(i);s&&(s.isEmpty()||(r.push(e.key),n.push({bucket:s,tileID:e.canonical})))}let s=r.length!==this.visibleTiles.length;if(!s){r.sort();for(let e=0;e<r.length;e++)if(r[e]!==this.visibleTiles[e]){s=!0;break}}if(!s)return;const a=new Set;this.visibleTiles=r,n.sort((e,t)=>e.tileID.z-t.tileID.z||e.tileID.x-t.tileID.x||e.tileID.y-t.tileID.y);for(const l of n){const t=new Array,i=new Array,r=l.bucket;for(const e of r.featuresOnBorder)a.has(e.featureId)?i.push(e.footprintIndex):(a.add(e.featureId),t.push(e.footprintIndex));r.updateFootprintHiddenFlags(t,e.ev,!1),r.updateFootprintHiddenFlags(i,e.ev,!0)}}}function Ys(t,i){const r=[...t],n=i.cameraWorldSizeForFog/i.worldSize,o=e.bA([]);return e.cS(o,o,[n,n,1]),e.aB(r,o,r),e.aB(r,i.worldToFogMatrix,r),r}function Ks(t,i,r,n,o){const s=r.material,a=n.context,{baseColorTexture:l,metallicRoughnessTexture:c}=s.pbrMetallicRoughness,{normalTexture:h,occlusionTexture:u,emissionTexture:d}=s;function p(e,i,r){if(e&&(t.push(i),a.activeTexture.set(a.gl.TEXTURE0+r),e.gfxTexture)){const{minFilter:t,magFilter:i,wrapS:r,wrapT:n}=e.sampler;e.gfxTexture.bindExtraParam(t,i,r,n)}}p(l,"HAS_TEXTURE_u_baseColorTexture",5),p(c,"HAS_TEXTURE_u_metallicRoughnessTexture",6),p(h,"HAS_TEXTURE_u_normalTexture",7),p(u,"HAS_TEXTURE_u_occlusionTexture",8),p(d,"HAS_TEXTURE_u_emissionTexture",9),o&&(o.texture||(o.texture=new e.d$(n.context,o.image,[o.image.height,o.image.height,o.image.height],a.gl.RGBA8)),a.activeTexture.set(a.gl.TEXTURE0+10),o.texture&&o.texture.bind(a.gl.LINEAR,a.gl.CLAMP_TO_EDGE),t.push("APPLY_LUT_ON_GPU")),r.texcoordBuffer&&(t.push("HAS_ATTRIBUTE_a_uv_2f"),i.push(r.texcoordBuffer)),r.colorBuffer&&(t.push(12===r.colorBuffer.itemSize?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),i.push(r.colorBuffer)),r.normalBuffer&&(t.push("HAS_ATTRIBUTE_a_normal_3f"),i.push(r.normalBuffer)),r.pbrBuffer&&(t.push("HAS_ATTRIBUTE_a_pbr"),t.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),i.push(r.pbrBuffer)),"OPAQUE"!==s.alphaMode&&"MASK"!==s.alphaMode||t.push("UNPREMULT_TEXTURE_IN_SHADER"),s.defined||t.push("DIFFUSE_SHADED");const f=n.shadowRenderer;f&&(t.push("RENDER_SHADOWS","DEPTH_TEXTURE"),f.useNormalOffset&&t.push("NORMAL_OFFSET"))}function Js(t,i,r,n,o,s){const a=t.modelOpacity,l=i.context,c=new Wi(i.context.gl.LEQUAL,t.isLightMesh?Wi.ReadOnly:Wi.ReadWrite,i.depthRangeFor3D),h=i.transform,u=t.mesh,d=u.material,p=d.pbrMetallicRoughness,f=i.style.fog;let m;m="pixels"===i.transform.projection.zAxisUnit?[...t.nodeModelMatrix]:e.aB([],n.zScaleMatrix,t.nodeModelMatrix),e.aB(m,n.negCameraPosMatrix,m);const _=e.bl([],m);e.eg(_,_);const g="none"===r.paint.get("model-color-use-theme").constantOr("default"),y=r.paint.get("model-emissive-strength").constantOr(0),x=$o(new Float32Array(t.worldViewProjection),new Float32Array(m),new Float32Array(_),null,i,a,p.baseColorFactor,d.emissiveFactor,p.metallicFactor,p.roughnessFactor,d,y,r,void 0,void 0,t.materialOverride,t.modelColor),v={defines:[]},b=[],w=i.shadowRenderer;w&&(w.useNormalOffset=!1),Ks(v.defines,b,u,i,g?null:r.lut);let T=null;if(f){const e=Ys(t.nodeModelMatrix,i.transform);if(T=new Float32Array(e),"globe"!==h.projection.name){const t=u.aabb.min,i=u.aabb.max,[r,n]=f.getOpacityForBounds(e,t[0],t[1],i[0],i[1]);v.overrideFog=r>=je||n>=je}}const S=cr(i,r.paint.get("model-cutoff-fade-range"));S.shouldRenderCutoff&&v.defines.push("RENDER_CUTOFF");const E=i.getOrCreateProgram("model",v);i.uploadCommonUniforms(l,E,null,T,S),"shadow"!==i.renderPass&&w&&w.setupShadowsFromMatrix(t.nodeModelMatrix,E),E.draw(i,l.gl.TRIANGLES,c,o,s,u.material.doubleSided?Qi.disabled:Qi.backCCW,x,r.id,u.vertexBuffer,u.indexBuffer,u.segments,r.paint,i.transform.zoom,void 0,b)}function Qs(e,t){return e.style._importedAsBasemap?"basemap":t.scope}function ea(t,i,r,n,o,s,a,l,c,h){const u=t.transform,d=!!i.isGeometryBloom&&i.isGeometryBloom;if(d&&"shadow"===t.renderPass)return;const p="globe"===u.projection.name?e.eD(r,u):[...r];e.aB(p,p,i.globalMatrix);const f=e.aB([],n,p);if(i.meshes)for(const m of i.meshes){const t=l.get(m.material.name);if(t&&t.opacity<=0)continue;if("BLEND"!==m.material.alphaMode){a.push({mesh:m,depth:0,modelIndex:o,worldViewProjection:f,nodeModelMatrix:p,isLightMesh:d,materialOverride:t,modelOpacity:c,modelColor:h});continue}const i=e.af([],m.centroid,f);!u.isOrthographic&&i[2]<=0||s.push({mesh:m,depth:i[2],modelIndex:o,worldViewProjection:f,nodeModelMatrix:p,isLightMesh:d,materialOverride:t,modelOpacity:c,modelColor:h})}if(i.children)for(const e of i.children)ea(t,e,r,n,o,s,a,l,c,h)}function ta(e,t,i,r){const n=i.shadowRenderer;if(!n)return;
vendor: 5,031 bytes, line 2
2const o=n.getShadowPassDepthMode(),s=n.getShadowPassColorMode(),a=n.calculateShadowPassMatrixFromMatrix(t),l=Zo(a);i.getOrCreateProgram("modelDepth",{defines:i._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(i,i.context.gl.TRIANGLES,o,Yi.disabled,s,Qi.disabled,l,r.id,e.vertexBuffer,e.indexBuffer,e.segments,r.paint,i.transform.zoom,void 0,void 0)}function ia(e,t,i,r,n,o){for(const s of n){const n=Object.assign({},r);n.part=s;const a={type:"Unknown",id:t,properties:n},l={orientation:e.paint.get("model-rotation").evaluate(a,i)};o.set(s,l)}}function ra(e,t,i,r,n,o){for(const s of n){const n=Object.assign({},r);n.part=s;const a={type:"Unknown",id:t,properties:n},l={color:e.paint.get("model-color").evaluate(a,i),colorMix:e.paint.get("model-color-mix-intensity").evaluate(a,i),opacity:e.paint.get("model-opacity").evaluate(a,i),emissionStrength:e.paint.get("model-emissive-strength").evaluate(a,i)};o.set(s,l)}}function na(e,t,i,r,n){let o=!1;for(const a of r)1!==a.modelOpacity&&(Js(a,e,t,n[a.modelIndex],Yi.disabled,Zi.disabled),o=!0);for(const a of r)Js(a,e,t,n[a.modelIndex],1!==a.modelOpacity?e.stencilModeFor3D():Yi.disabled,e.colorModeForRenderPass());o&&e.resetStencilClippingMasks();const s=Zi.additive;for(const a of i)Js(a,e,t,n[a.modelIndex],Yi.disabled,a.isLightMesh?s:e.colorModeForRenderPass())}function oa(t,i,r){const n=i.updateZoomBasedPaintProperties(),o=function(t,i,r){let n,o,s,a=t.terrain?t.terrain.exaggeration():0;if(t.terrain&&a>0){const i=t.terrain,o=i.findDEMTileFor(r);o&&o.dem?n=e.eF.create(i,r,o):a=0}if(0===a&&(i.terrainElevationMin=0,i.terrainElevationMax=0),a===i.validForExaggeration&&(0===a||n&&n._demTile&&n._demTile.tileID===i.validForDEMTile.id&&n._dem._timestamp===i.validForDEMTile.timestamp))return!1;for(const e in i.instancesPerModel){const t=i.instancesPerModel[e];for(let e=0;e<t.instancedDataArray.length;++e){const r=(n?a*n.getElevationAt(0|t.instancedDataArray.float32[16*e],0|t.instancedDataArray.float32[16*e+1],!0,!0):0)+t.instancesEvaluatedElevation[e];t.instancedDataArray.float32[16*e+6]=r,o=o?Math.min(i.terrainElevationMin,r):r,s=s?Math.max(i.terrainElevationMax,r):r}}return i.terrainElevationMin=o||0,i.terrainElevationMax=s||0,i.validForExaggeration=a,i.validForDEMTile=n&&n._demTile?{id:n._demTile.tileID,timestamp:n._dem._timestamp}:{id:void 0,timestamp:0},!0}(t,i,r);(n||o)&&(i.uploaded=!1,i.upload(t.context))}const sa={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new e.d9([0,0,0],[e.al,e.al,0])};function aa(t,i){const r=1<<t.canonical.z,n=i.getFreeCameraOptions().position,o=i.elevation,s=t.canonical.x/r,a=(t.canonical.x+1)/r,l=t.canonical.y/r,c=(t.canonical.y+1)/r;let h=i._centerAltitude;if(o){const e=o.getMinMaxForTile(t);e&&e.max>h&&(h=e.max)}const u=e.aA(n.x,s,a)-n.x,d=e.aA(n.y,l,c)-n.y,p=e.cf(h,i.center.lat)-n.z;return i._zoomFromMercatorZ(Math.sqrt(u*u+d*d+p*p))}function la(e,t,i,r,n,o,s){const a=e.context,l="shadow"===e.renderPass,c=e.shadowRenderer,h=l&&c?c.getShadowPassDepthMode():new Wi(a.gl.LEQUAL,Wi.ReadWrite,e.depthRangeFor3D),u=e.isTileAffectedByFog(o),d="globe"===e.transform.projection.name;if(i.meshes)for(const p of i.meshes){const f=d?[]:["MODEL_POSITION_ON_GPU"],m=[];let _,g,y;const x=!d&&r.instancedDataArray.length>20;x&&f.push("INSTANCED_ARRAYS");const v=cr(e,t.paint.get("model-cutoff-fade-range"));if(v.shouldRenderCutoff&&f.push("RENDER_CUTOFF"),l&&c)_=e.getOrCreateProgram("modelDepth",{defines:f}),g=Zo(s.shadowTileMatrix,s.shadowTileMatrix,Float32Array.from(i.globalMatrix)),y=c.getShadowPassColorMode();else{Ks(f,m,p,e,"none"===t.paint.get("model-color-use-theme").constantOr("default")?null:t.lut),_=e.getOrCreateProgram("model",{defines:f,overrideFog:u});const r=p.material,l=r.pbrMetallicRoughness,h=t.paint.get("model-opacity").constantOr(1),d=t.paint.get("model-emissive-strength").constantOr(0);g=$o(o.expandedProjMatrix,Float32Array.from(i.globalMatrix),new Float32Array(16),null,e,h,l.baseColorFactor,r.emissiveFactor,l.metallicFactor,l.roughnessFactor,r,d,t,n),c&&(s.shadowUniformsInitialized?_.setShadowUniformValues(a,c.getShadowUniformValues()):(c.setupShadows(o.toUnwrapped(),_,"model-tile"),s.shadowUniformsInitialized=!0)),y=v.shouldRenderCutoff||h<1||"OPAQUE"!==r.alphaMode?Zi.alphaBlended:Zi.unblended}e.uploadCommonUniforms(a,_,o.toUnwrapped(),null,v);const b=p.material.doubleSided?Qi.disabled:Qi.backCCW;if(x)m.push(r.instancedDataBuffer),_.draw(e,a.gl.TRIANGLES,h,Yi.disabled,y,b,g,t.id,p.vertexBuffer,p.indexBuffer,p.segments,t.paint,e.transform.zoom,void 0,m,r.instancedDataArray.length);else{const i=l?"u_instance":"u_normal_matrix";for(let n=0;n<r.instancedDataArray.length;++n)g[i]=new Float32Array(r.instancedDataArray.arrayBuffer,64*n,16),_.draw(e,a.gl.TRIANGLES,h,Yi.disabled,y,b,g,t.id,p.vertexBuffer,p.indexBuffer,p.segments,t.paint,e.transform.zoom,void 0,m)}}if(i.children)for(const p of i.children)la(e,t,p,r,n,o,s)}const ca=[1,-1,1];function ha(t,i,r,n){if(!r.modelManager)return!0;const o=r.modelManager;
2if(!r.shadowRenderer)return!0;const s=r.shadowRenderer,a=i.aabb;let l=!0,c=t.maxHeight;if(0===c){let e=0;for(const i in t.instancesPerModel){const t=o.getModel(i,n);t?e=Math.max(e,Math.max(Math.max(t.aabb.max[0],t.aabb.max[1]),t.aabb.max[2])):l=!1}c=t.maxScale*e*1.41+t.maxVerticalOffset,l&&(t.maxHeight=c)}a.max[2]=c,a.min[2]+=t.terrainElevationMin,a.max[2]+=t.terrainElevationMax,e.af(a.min,a.min,i.tileMatrix),e.af(a.max,a.max,i.tileMatrix);const h=a.intersects(s.getCurrentCascadeFrustum());return 0===r.currentShadowCascade&&(t.isInsideFirstShadowMapFrustum=2===h),0===h}function ua(t,i){const r=t.uniformValues.u_cutoff_params[0],n=t.uniformValues.u_cutoff_params[1],o=t.uniformValues.u_cutoff_params[2],s=t.uniformValues.u_cutoff_params[3];return n===r||s===o?1:e.aA(((i-r)/(n-r)-o)/(s-o),0,1)}function da(t,i,r,n){if(i.pitch<20)return 1;const o=i.getWorldToCameraMatrix();e.aB(o,o,t);const s=e.bU(r.min[0],r.min[1],r.min[2],1);let a=e.aC(e.eG(),s,o),l=a,c=a;s[1]=r.max[1],a=e.aC(e.eG(),s,o),l=a[1]<l[1]?a:l,c=a[1]>c[1]?a:c,s[0]=r.max[0],a=e.aC(e.eG(),s,o),l=a[1]<l[1]?a:l,c=a[1]>c[1]?a:c,s[1]=r.min[1],a=e.aC(e.eG(),s,o),l=a[1]<l[1]?a:l,c=a[1]>c[1]?a:c;const h=e.aA(n[0],0,1),u=100*i.pixelsPerMeter*e.aA(n[1],0,1),d=e.aA(n[2],0,1),p=e.eH(e.eG(),l,c,h),f=Math.tan(.5*i.fovX),m=-p[2]*f;if(0===u)return p[1]<-Math.abs(m)?d:1;const _=(-Math.abs(m)-p[1])/u,g=(e,t,i)=>(1-i)*e+i*t,y=e.aA(g(1,d,_),d,1);return g(1,y,e.aA((i.pitch-20)/20,0,1))}class pa{}class fa{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(t,i,r){{const e=this._storage.get(i.id);if(e)return e.lastUsedFrameIdx=t,e.buf}const n=r.gl,o=n.getBufferParameter(n.ELEMENT_ARRAY_BUFFER,n.BUFFER_SIZE),s=new ArrayBuffer(o),a=new Int16Array(s);n.getBufferSubData(n.ELEMENT_ARRAY_BUFFER,0,new Int16Array(s));const l=new e.eJ;for(let e=0;e<o/2;e+=3){const t=a[e],i=a[e+1],r=a[e+2];l.emplaceBack(t,i),l.emplaceBack(i,r),l.emplaceBack(r,t)}const c=r.bindVertexArrayOES.current,h=new pa;return h.buf=new Xo(r,l),h.lastUsedFrameIdx=t,this._storage.set(i.id,h),r.bindVertexArrayOES.set(c),h.buf}update(e){for(const[t,i]of this._storage)e-i.lastUsedFrameIdx>30&&(i.buf.destroy(),this._storage.delete(t))}destroy(){for(const[e,t]of this._storage)t.buf.destroy(),this._storage.delete(e)}}class ma{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const _a=e.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class ga{constructor(e){this.revealStart=11,this.revealRange=2}}const ya=e.ei([{type:"Float32",name:"a_pos_2f",components:2}]);class xa{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(t,i){const r=t.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const i=new e.eK,r=new e.b0;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1),r.emplaceBack(0,1,2),r.emplaceBack(0,2,3),this.vignetteVx=t.context.createVertexBuffer(i,ya.members),this.vignetteIdx=t.context.createIndexBuffer(r)}const n=e.bg.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){t.uploadCommonUniforms(t.context,r);const e={u_vignetteShape:(o={vignetteShape:[i.start,i.range,Math.pow(10,i.fadePower)],vignetteColor:[i.color.r,i.color.g,i.color.b,i.color.a*i.strength]}).vignetteShape,u_vignetteColor:o.vignetteColor};r.draw(t,t.context.gl.TRIANGLES,Wi.disabled,Yi.disabled,Zi.alphaBlended,Qi.disabled,e,"vignette",this.vignetteVx,this.vignetteIdx,n)}var o}}class va{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(t,i){const r=t.getFreeCameraOptions().position,n=r.toAltitude(),o=r.toLngLat(),s=e.an(o.lng),a=e.an(o.lat),l=t.pixelsPerMeter/i,c=s*e.eM,h=e.eM*Math.log(Math.tan(Math.PI/4+a/2));if(void 0===this._offsetXPrev)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const e=-this._offsetYPrev+h,t=-this._elevationPrev+n;this._accumulatedOffsetX+=(-this._offsetXPrev+c)*l,this._accumulatedOffsetY+=e*l,this._accumulatedElevation+=t*l,this._offsetXPrev=c,this._offsetYPrev=h,this._elevationPrev=n}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function ba(e,t){return[-(e[0]-Math.floor(e[0]/t)*t),-(e[1]-Math.floor(e[1]/t)*t),-(e[2]-Math.floor(e[2]/t)*t)]}function wa(t){const i=e.eq(1323123451230),r=[];for(let n=0;n<t;++n){const t=2*i()-1,n=2*i()-1,o=2*i()-1;r.push(e.d5(t,n,o))}return r}function Ta(t,i,r,n,o){const s=e.aA((o-r)/(n-r),0,1);return(1-s)*t+s*i}class Sa{constructor(e){this._movement=new va,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new xa,this._ppmScaleFactor=e}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(t,i){const r=t.transform;this._movement.update(r,this._ppmScaleFactor);const n=r.starsProjMatrix,o=e.c7([]);e.c9(o,o,e.an(90)-r._pitch),e.c8(o,o,-r.angle);const s=e.cc(new Float32Array(16),o),a=e.eL(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),l=e.eg([],a),c=e.aB([],l,s),h=Date.now()/1e3;return this._accumulatedTimeFromStart+=(h-this._prevTime)*i,this._prevTime=h,{projectionMatrix:n,modelviewMatrix:c}}}class Ea extends Sa{constructor(e){super(4.25),this._params={overrideStyleParameters:!1,intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,droplet
2SizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._revealParams=new ga("Precipitation > Rain"),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(t){const i=t.context;if(!this.particlesVx){const t=wa(this.particlesCount),r=new e.eN,n=new e.b0;let o=0;const s=e.eq(1323123451230);for(let e=0;e<t.length;++e){const i=t[e],a=[2*s()-1,s(),s(),s()];r.emplaceBack(i[0],i[1],i[2],-1,-1,...a),r.emplaceBack(i[0],i[1],i[2],1,-1,...a),r.emplaceBack(i[0],i[1],i[2],1,1,...a),r.emplaceBack(i[0],i[1],i[2],-1,1,...a),n.emplaceBack(o+0,o+1,o+2),n.emplaceBack(o+0,o+2,o+3),o+=4}this.particlesVx=i.createVertexBuffer(r,_a.members),this.particlesIdx=i.createIndexBuffer(n)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.rain)return;const i=this._params.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},r=t.transform.zoom;if(i.revealStart>r)return;const n=Ta(0,1,i.revealStart,i.revealStart+i.revealRange,r);if(!this.particlesVx||!this.particlesIdx)return;const o=structuredClone(this._params);let s=[-o.direction.x,o.direction.y,-100];e.aw(s,s);const a=structuredClone(this._vignetteParams);a.strength*=n,o.overrideStyleParameters||(o.intensity=t.style.rain.state.density,o.timeFactor=t.style.rain.state.intensity,o.color=structuredClone(t.style.rain.state.color),s=structuredClone(t.style.rain.state.direction),o.screenThinning.intensity=t.style.rain.state.centerThinning,o.dropletSizeX=t.style.rain.state.dropletSize[0],o.droplet
vendor: 4,232 bytes, line 2
2SizeYScale=t.style.rain.state.dropletSize[1]/t.style.rain.state.dropletSize[0],o.distortionStrength=100*t.style.rain.state.distortionStrength,a.strength=1,a.color=structuredClone(t.style.rain.state.vignetteColor));const l=this.updateOnRender(t,o.timeFactor),c=t.context,h=c.gl,u=t.transform;this.screenTexture&&this.screenTexture.size[0]===t.width&&this.screenTexture.size[1]===t.height||(this.screenTexture=new e.T(c,{width:t.width,height:t.height,data:null},h.RGBA8)),o.distortionStrength>0&&(c.activeTexture.set(h.TEXTURE0),this.screenTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),h.copyTexSubImage2D(h.TEXTURE_2D,0,0,0,0,0,t.width,t.height));const d=t.getOrCreateProgram("rainParticle");t.uploadCommonUniforms(c,d),c.activeTexture.set(h.TEXTURE0),this.screenTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE);const p=[o.color.r,o.color.g,o.color.b,o.color.a],f=(i,r)=>{const n=ba(this._movement.getPosition(),i),a=o.dropletSizeX,c=o.dropletSizeX*o.dropletSizeYScale,f=t.width/2,m=t.height/2,_=Ta(0,o.screenThinning.start,0,1,o.screenThinning.intensity),g=Ta(.001,o.screenThinning.range,0,1,o.screenThinning.intensity),y=Ta(0,o.screenThinning.particleOffset,0,1,o.screenThinning.intensity),x=(v={modelview:l.modelviewMatrix,projection:l.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:n,velocityConeAperture:o.velocityConeAperture,velocity:o.velocity,boxSize:i,rainDropletSize:[a,c],distortionStrength:o.distortionStrength,rainDirection:s,color:p,screenSize:[u.width,u.height],thinningCenterPos:[f,m],thinningShape:[_,g,Math.pow(10,o.screenThinning.fadePower)],thinningAffectedRatio:o.screenThinning.affectedRatio,thinningParticleOffset:y,shapeDirectionalPower:o.shapeDirPower,shapeNormalPower:o.shapeNormalPower,mode:r?0:1},{u_modelview:Float32Array.from(v.modelview),u_projection:Float32Array.from(v.projection),u_time:v.time,u_cam_pos:v.camPos,u_texScreen:0,u_velocityConeAperture:v.velocityConeAperture,u_velocity:v.velocity,u_boxSize:v.boxSize,u_rainDropletSize:v.rainDropletSize,u_distortionStrength:v.distortionStrength,u_rainDirection:v.rainDirection,u_color:v.color,u_screenSize:v.screenSize,u_thinningCenterPos:v.thinningCenterPos,u_thinningShape:v.thinningShape,u_thinningAffectedRatio:v.thinningAffectedRatio,u_thinningParticleOffset:v.thinningParticleOffset,u_shapeDirectionalPower:v.shapeDirectionalPower,u_shapeNormalPower:v.shapeNormalPower,u_mode:v.mode});var v;const b=Math.round(o.intensity*this.particlesCount),w=e.bg.simpleSegment(0,0,4*b,2*b);d.draw(t,h.TRIANGLES,Wi.disabled,Yi.disabled,Zi.alphaBlended,Qi.disabled,x,"rain_particles",this.particlesVx,this.particlesIdx,w)};o.distortionStrength>0&&f(o.boxSize,!0),f(o.boxSize,!1),this._vignette.draw(t,a)}}const Ia=e.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]);class Aa extends Sa{constructor(e){super(2.25),this._params={overrideStyleParameters:!1,intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._revealParams=new ga("Precipitation > Snow"),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(t){const i=t.context;if(!this.particlesVx){const t=wa(this.particlesCount),r=new e.eO,n=new e.b0;let o=0;const s=e.eq(1323123451230);for(let e=0;e<t.length;++e){const i=t[e],a=s(),l=s(),c=s(),h=[e/t.length,a,l,c],u=[s(),s()];r.emplaceBack(i[0],i[1],i[2],-1,-1,...h,...u),r.emplaceBack(i[0],i[1],i[2],1,-1,...h,...u),r.emplaceBack(i[0],i[1],i[2],1,1,...h,...u),r.emplaceBack(i[0],i[1],i[2],-1,1,...h,...u),n.emplaceBack(o+0,o+1,o+2),n.emplaceBack(o+0,o+2,o+3),o+=4}this.particlesVx=i.createVertexBuffer(r,Ia.members),this.particlesIdx=i.createIndexBuffer(n)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.snow)return;const i=structuredClone(this._params);let r=[-i.direction.x,i.direction.y,-100];e.aw(r,r);
vendor: 4,121 bytes, line 2
2const n=structuredClone(this._vignetteParams),o=i.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},s=t.transform.zoom;if(o.revealStart>s)return;const a=Ta(0,1,o.revealStart,o.revealStart+o.revealRange,s);n.strength*=a,i.overrideStyleParameters||(i.intensity=t.style.snow.state.density,i.timeFactor=t.style.snow.state.intensity,i.color=structuredClone(t.style.snow.state.color),r=structuredClone(t.style.snow.state.direction),i.screenThinning.intensity=t.style.snow.state.centerThinning,i.billboardSize=2.79*t.style.snow.state.flakeSize,n.strength=1,n.color=structuredClone(t.style.snow.state.vignetteColor));const l=this.updateOnRender(t,i.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const c=t.context,h=c.gl,u=t.transform,d=t.getOrCreateProgram("snowParticle");t.uploadCommonUniforms(c,d),((i,n,o)=>{const s=ba(this._movement.getPosition(),i),a=u.width/2,c=u.height/2,p=Ta(0,o.screenThinning.start,0,1,o.screenThinning.intensity),f=Ta(.001,o.screenThinning.range,0,1,o.screenThinning.intensity),m=Ta(0,o.screenThinning.particleOffset,0,1,o.screenThinning.intensity),_=(g={modelview:l.modelviewMatrix,projection:l.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:s,velocityConeAperture:o.velocityConeAperture,velocity:o.velocity,horizontalOscillationRadius:o.horizontalOscillationRadius,horizontalOscillationRate:o.horizontalOscillationRate,boxSize:i,billboardSize:1*o.billboardSize,simpleShapeParameters:[o.shapeFadeStart,o.shapeFadePower],screenSize:[u.width,u.height],thinningCenterPos:[a,c],thinningShape:[p,f,Math.pow(10,o.screenThinning.fadePower)],thinningAffectedRatio:o.screenThinning.affectedRatio,thinningParticleOffset:m,color:[o.color.r,o.color.g,o.color.b,o.color.a],direction:r},{u_modelview:Float32Array.from(g.modelview),u_projection:Float32Array.from(g.projection),u_time:g.time,u_cam_pos:g.camPos,u_velocityConeAperture:g.velocityConeAperture,u_velocity:g.velocity,u_horizontalOscillationRadius:g.horizontalOscillationRadius,u_horizontalOscillationRate:g.horizontalOscillationRate,u_boxSize:g.boxSize,u_billboardSize:g.billboardSize,u_simpleShapeParameters:g.simpleShapeParameters,u_screenSize:g.screenSize,u_thinningCenterPos:g.thinningCenterPos,u_thinningShape:g.thinningShape,u_thinningAffectedRatio:g.thinningAffectedRatio,u_thinningParticleOffset:g.thinningParticleOffset,u_particleColor:g.color,u_direction:g.direction});var g;const y=Math.round(o.intensity*this.particlesCount),x=e.bg.simpleSegment(0,0,4*y,2*y);this.particlesVx&&this.particlesIdx&&d.draw(t,h.TRIANGLES,Wi.disabled,Yi.disabled,Zi.alphaBlended,Qi.disabled,_,"snow_particles",this.particlesVx,this.particlesIdx,x)})(i.boxSize,0,i),this._vignette.draw(t,n)}}const Ma={symbol:function(t,i,r,n,o){if("translucent"!==t.renderPass)return;const s=Yi.disabled,a=t.colorModeForRenderPass(),l=r.layout.get("text-variable-anchor"),c=r.layout.get("text-size-scale-range"),h=e.aA(t.scaleFactor,c[0],c[1]);l&&function(t,i,r,n,o,s,a,l){const c=i.transform,h="map"===o,u="map"===s;for(const d of t){const t=n.getTile(d),i=t.getBucket(r);if(!i||!i.text||!i.text.segments.get().length)continue;const o=e.bK(i.textSizeData,c.zoom,l),s=Qt(d,i.getProjection(),c),p=c.calculatePixelsToTileUnitsMatrix(t),f=ri(s,t.tileID.canonical,u,h,c,i.getProjection(),p),m=i.hasIconTextFit()&&i.hasIconData();o&&os(i,h,u,a,c,f,d,Math.pow(2,c.zoom-t.tileID.overscaledZ),o,m)}}(n,t,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),o,h);const u=0!==r.paint.get("icon-opacity").constantOr(1),d=0!==r.paint.get("text-opacity").constantOr(1);void 0!==r.layout.get("symbol-sort-key").constantOr(1)&&(u||d)?ss(t,i,r,n,s,a):(u&&ss(t,i,r,n,s,a,{onlyIcons:!0}),d&&ss(t,i,r,n,s,a,{onlyText:!0})),i.map.showCollisionBoxes&&(ts(t,i,r,n,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),ts(t,i,r,n,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))},circle:function(t,i,r,n){if("translucent"!==t.renderPass)return;const o=r.paint.get("circle-opacity"),s=r.paint.get("circle-stroke-width"),a=r.paint.get("circle-stroke-opacity"),l=void 0!==r.layout.get("
2circle-sort-key").constantOr(1),c=r.paint.get("circle-emissive-strength");if(0===o.constantOr(1)&&(0===s.constantOr(1)||0===a.constantOr(1)))return;const h=t.context,u=h.gl,d=t.transform,p=!(!t.terrain||!t.terrain.enabled),f=r.layout.get("circle-elevation-reference"),m=t.depthModeForSublayer(0,Wi.ReadOnly),_=new Wi(t.context.gl.LEQUAL,Wi.ReadOnly,t.depthRangeFor3D),g="none"===f||p?m:_,y=Yi.disabled,x=t.colorModeForDrapableLayerRenderPass(c),v="globe"===d.projection.name,b=[e.aF(d.center.lng),e.aJ(d.center.lat)],w=[];for(let S=0;S<n.length;S++){const o=n[S],s=i.getTile(o),a=s.getBucket(r);if(!a||a.projection.name!==d.projection.name)continue;const c=a.programConfigurations.get(r.id),h=a.layoutVertexBuffer,u=a.globeExtVertexBuffer,p=a.indexBuffer,f=e.e0(r),m=[u],_=t.isTileAffectedByFog(o);v&&f.push("PROJECTION_GLOBE_VIEW"),f.push("DEPTH_D24"),t.terrain&&d.depthOcclusionForSymbolsAndCircles&&f.push("DEPTH_OCCLUSION"),a.hasElevation&&!t.terrain&&(f.push("ELEVATED_ROADS"),m.push(a.elevatedLayoutVertexBuffer));const g=t.getOrCreateProgram("circle",{config:c,defines:f,overrideFog:_}),y=d.projection.createInversionMatrix(d,o.canonical),x={programConfiguration:c,program:g,layoutVertexBuffer:h,dynamicBuffers:m,indexBuffer:p,uniformValues:e.e1(t,o,s,y,b,r),tile:s};if(l){const t=a.segments.get();for(const i of t)w.push({segments:new e.bg([i]),sortKey:i.sortKey,state:x})}else w.push({segments:a.segments,sortKey:0,state:x})}l&&w.sort((e,t)=>
2e.sortKey-t.sortKey);const T={useDepthForOcclusion:d.depthOcclusionForSymbolsAndCircles};for(const e of w){const{programConfiguration:i,program:n,layoutVertexBuffer:o,dynamicBuffers:s,indexBuffer:a,uniformValues:l,tile:c}=e.state,p=e.segments;t.terrain&&t.terrain.setupElevationDraw(c,n,T),t.uploadCommonUniforms(h,n,c.tileID.toUnwrapped()),n.draw(t,u.TRIANGLES,g,y,x,Qi.disabled,l,r.id,o,a,p,r.paint,d.zoom,i,s)}},heatmap:function(t,i,r,n){if(0!==r.paint.get("heatmap-opacity"))if("offscreen"===t.renderPass){const o=t.context,s=o.gl,a=Yi.disabled,l=new Zi([s.ONE,s.ONE,s.ONE,s.ONE],e.ao.transparent,[!0,!0,!0,!0]);!function(e,t,i,r){const n=e.gl,o=t.width*r,s=t.height*r;e.activeTexture.set(n.TEXTURE1),e.viewport.set([0,0,o,s]);let a=i.heatmapFbo;if(!a||a&&(a.width!==o||a.height!==s)){a&&a.destroy();const t=n.createTexture();n.bindTexture(n.TEXTURE_2D,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.L
2INEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),a=i.heatmapFbo=e.createFramebuffer(o,s,1,null),function(e,t,i,r,n,o){const s=e.gl;s.texImage2D(s.TEXTURE_2D,0,e.extRenderToTextureHalfFloat?s.RGBA16F:s.RGBA,n,o,0,s.RGBA,e.extRenderToTextureHalfFloat?s.HALF_FLOAT:s.UNSIGNED_BYTE,null),r.colorAttachment0.set(i)}(e,0,t,a,o,s)}else n.bindTexture(n.TEXTURE_2D,a.colorAttachment0.get()),e.bindFramebuffer.set(a.framebuffer)}(o,t,r,"globe"===t.transform.projection.name?.5:.25),o.clear({color:e.ao.transparent});const c=t.transform,h="globe"===c.projection.name,u=h?["PROJECTION_GLOBE_VIEW"]:[],d=h?Qi.frontCCW:Qi.disabled,p=[e.aF(c.center.lng),e.aJ(c.center.lat)];for(let e=0;e<n.length;e++){const f=n[e];if(i.hasRenderableParent(f))continue;const m=i.getTile(f),_=m.getBucket(r);if(!_||_.projection.name!==c.projection.name)continue;const g=t.isTileAffectedByFog(f),y=_.programConfigurations.get(r.id),x=t.getOrCreateProgram("heatmap",{config:y,defines:u,overrideFog:g}),{zoom:v}=t.transform;t.terrain&&t.terrain.setupElevationDraw(m,x),t.uploadCommonUniforms(o,x,f.toUnwrapped());const b=c.projection.createInversionMatrix(c,f.canonical);x.draw(t,s.TRIANGLES,Wi.disabled,a,l,d,zo(t,f,m,b,p,v,r.paint.get("heatmap-intensity")),r.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,r.paint,t.transform.zoom,y,h?[_.globeExtVertexBuffer]:null)}o.viewport.set([0,0,t.width,t.height])}else"translucent"===t.renderPass&&(t.context.setColorMode(t.colorModeForRenderPass()),function(t,i){const r=t.context,n=r.gl,o=i.heatmapFbo;if(!o)return;r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,o.colorAttachment0.get()),r.activeTexture.set(n.TEXTURE1);let s=i.colorRampTexture;s||(s=i.colorRampTexture=new e.T(r,i.colorRamp,n.RGBA8)),s.bind(n.LINEAR,n.CLAMP_TO_EDGE),t.getOrCreateProgram("heatmapTexture").draw(t,n.TRIANGLES,Wi.disabled,Yi.disabled,t.colorModeForRenderPass(),Qi.disabled,((e,t)=>({u_image:0,u_color_ramp:1,u_opacity:t.paint.get("heatmap-opacity")}))(0,i),i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,i.paint,t.transform.zoom)}(t,r))},line:function(t,i,r,n){if("translucent"!==t.renderPass)return;const o=r.paint.get("line-opacity"),s=r.paint.get("line-width");if(0===o.constantOr(1)||0===s.constantOr(1))return;const a=r.paint.get("line-emissive-strength").isConstant(),l=r.paint.get("line-emissive-strength").constantOr(0),c=r.paint.get("line-occlusion-opacity"),h=r.layout.get("line-elevation-reference"),u="meters"===r.layout.get("line-width-unit"),d="sea"===h,p=!(!t.terrain||!t.terrain.enabled),f=t.context,m=f.gl;if(r.hasElevatedBuckets&&"globe"===t.transform.projection.name)return;const _=r.layout.get("line-cross-slope"),g=void 0!==_,y=_<1,x=t.colorModeForDrapableLayerRenderPass(a?l:null),v=t.terrain&&t.terrain.renderingToTexture,b=v?1:e.o.devicePixelRatio,w=r.paint.get("line-dasharray"),T=w.constantOr(1),S=r.layout.get("line-cap"),E=w.constantOr(null),I=S.constantOr(null),A=r.paint.get("line-pattern"),M=A.constantOr(1),C=r.paint.get("line-pattern-cross-fade"),P=A.constantOr(null),R=r.paint.get("line-opacity").constantOr(1);let z=!M&&1!==R||t.depthOcclusion&&c>0&&c<1;const L=r.paint.get("line-gradient"),D=M?"linePattern":"line",O=e.e2(r);let F;if(v&&t.terrain&&t.terrain.clipOrMaskOverlapStencilType()&&(z=!1),0!==c&&t.depthOcclusion){const t=r.paint._values["line-opacity"];t&&t.value&&"constant"===t.value.kind?F=t.value:e.w(`Occlusion opacity for layer ${r.id} is supported only when line-opacity isn't data-driven.`)}"constant"!==s.value.kind&&!1===s.value.isLineProgressConstant&&O.push("VARIABLE_LINE_WIDTH"),v&&("dual-source-blending"!==t.emissiveMode||a?"mrt-fallback"===t.emissiveMode&&O.push("USE_MRT1"):O.push("DUAL_SOURCE_BLENDING"));const k=(n,o,s,a,l,h)=>{for(const p of n){const n=i.getTile(p);if(M&&!n.patternsLoaded())continue;const _=n.getBucket(r);if(!_)continue;if("none"!==_.elevationType&&!l||"none"===_.elevationType&&l)continue;t.prepareDrawTile();const g=[...o],y=t.shadowRenderer,w="road"===_.elevationType&&!!y&&y.enabled;let S=[0,0,0];if(w){const e=t.style.directionalLight,i=t.style.ambientLight;e&&i&&(S=_r(t.style,e,i)),g.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const A=_.programConfigurations.get(r.id);let O=!1;if(P&&n.imageAtlas){const t=e.e3.from(P),i=t.getPrimary().scaleSelf(b).toString(),r=n.imageAtlas.patternPositions.get(i),o=t.getSecondary(),s=o?n.imageAtlas.patternPositions.get(o.scaleSelf(b).toString()):null;O=!!r&&!!s,r&&A.setConstantPatternPositions(r,s)}C>0&&(O||A.getPatternTransitionVertexBuffer("line-pattern"))&&g.push("LINE_PATTERN_TRANSITION");const k=t.isTileAffectedByFog(p),B=t.getOrCreateProgram(D,{config:A,defines:g,overrideFog:k});if(!M&&E&&I&&n.lineAtlas){const e=n.lineAtlas.getDash(E,I);e&&A.setConstantPatternPositions(e)}w&&y.setupShadows(n.tileID.toUnwrapped(),B,"vector-tile");let[N,V]=r.paint.get("line-trim-offset");if("round"===I||"square"===I){const e=1;N!==V&&(0===N&&(N-=e),1===V&&(V+=e))}const U=v?p.projMatrix:null,j=u?1/_.tileToMeter/e.ay(n,1,t.transform.zoom):1,G=u?1/_.tileToMeter/e.ay(n,1,Math.floor(t.transform.zoom)):1,q=M?e.e4(t,n,r,U,b,j,G,[N,V],S,C):e.e5(t,n,r,U,_.lineClipsArray.length,b,j,G,[N,V],S);if(L){const n=_.gradients[r.id];let o=n.texture;if(r.gradientVersion!==n.version){let s=256;if(r.stepInterpolant){const r=i.getSource().maxzoom,n=p.canonical.z===r?Math.ceil(1<<t.transform.maxZoom-p.canonical.z):1;s=e.aA(e.e6(_.maxLineLength/e.al*1024*n),256,f.maxTextureSize)}n.gradient=e.e7({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:s,image:n.gradient||void 0,clips:_.lineClipsArray}),n.texture?n.texture.update(n.gradient):n.texture=new e.T(f,n.gradient,m.RGBA8),n.version=r.gradientVersion,o=n.texture}f.activeTexture.set(m.TEXTURE1),o.bind(r.stepInterpolant?m.NEAREST:m.LINEAR,m.CLAMP_TO_EDGE)}T&&(f.activeTexture.set(m.TEXTURE0),n.lineAtlasTexture&&n.lineAtlasTexture.bind(m.LINEAR,m.REPEAT),A.updatePaintBuffers()),M&&(f.activeTexture.set(m.TEXTURE0),n.imageAtlasTexture&&n.imageAtlasTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE),A.updatePaintBuffers()),l&&!d&&t.terrain.setupElevationDraw(n,B),t.uploadCommonUniforms(f,B,p.toUnwrapped());const H=e=>{null!=F&&(F.value=R*c),B.draw(t,m.TRIANGLES,s,e,x,Qi.disabled,q,r.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,r.paint,t.transform.zoom,A,[_.layoutVertexBuffer2,_.patternVertexBuffer,_.zOffsetVertexBuffer]),null!=F&&(F.value=R)};if(z&&!l){const e=t.stencilModeForClipping(p).ref;0===e&&v&&f.clear({stencil:0});const i={func:m.EQUAL,mask:255};q.u_alpha_discard_threshold=.8,H(new Yi(i,e,255,m.KEEP,m.KEEP,m.INVERT)),q.u_alpha_discard_threshold=0,H(new Yi(i,e,255,m.KEEP,m.KEEP,m.KEEP))}else q.u_alpha_discard_threshold=z&&l&&h?.8:0,H(l?a:t.stencilModeForClipping(p))}};let B=t.depthModeForSublayer(0,Wi.ReadOnly);const N=new Wi(t.depthOcclusion?m.GREATER:m.LEQUAL,Wi.ReadOnly,t.depthRangeFor3D);if(r.hasNonElevatedBuckets){const i=!v&&t.terrain;0!==c&&i?e.w(`Occlusion opacity for layer ${r.id} is supported on terrain only if the layer has line-z-offset enabled.`):i?e.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${r.id}.`):k(n,O,B,Yi.disabled,!1,!0)}if(r.hasElevatedBuckets){"hd-road-markup"===h?p||(B=N,O.push("ELEVATED_ROADS")):(O.push("ELEVATED"),B=N,g&&O.push(y?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),d&&O.push("ELEVATION_REFERENCE_SEA"));const e=z?t.stencilModeFor3D():Yi.disabled;t.forceTerrainMode=!0,k(n,O,B,e,!0,!0),z&&k(n,O,B,e,!0,!1),t.forceTerrainMode=!1}z&&(t.resetStencilClippingMasks(),v&&f.clear({stencil:0})),0===c||t.depthOcclusion||v||t.layersWithOcclusionOpacity.push(t.currentLayer)},fill:function(t,i,r,n){const o=r.paint.get("fill-color"),s=r.paint.get("fill-opacity");if(0===s.constantOr(1))return;const a=r.paint.get("fill-emissive-strength"),l=t.colorModeForDrapableLayerRenderPass(a),c=r.paint.get("fill-pattern"),h=t.opaquePassEnabledForLayer()&&!c.constantOr(1)&&1===o.constantOr(e.ao.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";let u="none";"none"!==r.layout.get("fill-elevation-reference")?u="road":0!==r.paint.get("fill-z-offset").constantOr(1)&&(u="offset");const d=!(!t.terrain||!t.terrain.enabled),p={painter:t,sourceCache:i,layer:r,coords:n,colorMode:l,elevationType:u,terrainEnabled:d,pass:h};if("shadow"===t.renderPass)return void(t.shadowRenderer&&"road"===u&&!d&&function(e){const{painter:t,sourceCache:i,layer:r,coords:n}=e,o=t.context.gl,s=e.painter.shadowRenderer;for(const a of n){const e=i.getTile(a),n=e.getBucket(r);
vendor: 8,334 bytes, line 2
2if(!n)continue;const l=n.elevatedStructures;if(!l)continue;if(!l.shadowCasterSegments||0===l.shadowCasterSegments.segments[0].primitiveLength)continue;t.prepareDrawTile();const c=n.bufferData.programConfigurations.get(r.id),h=t.isTileAffectedByFog(a),u=t.getOrCreateProgram("elevatedStructuresDepth",{config:c,overrideFog:h}),d=s.calculateShadowPassMatrixFromTile(e.tileID.toUnwrapped());t.uploadCommonUniforms(t.context,u,a.toUnwrapped());const p=wo(d,0);u.draw(t,o.TRIANGLES,s.getShadowPassDepthMode(),Yi.disabled,s.getShadowPassColorMode(),Qi.disabled,p,r.id,l.vertexBuffer,l.indexBuffer,l.shadowCasterSegments,r.paint,t.transform.zoom,c)}}(p));const f="mrt-fallback"===t.emissiveMode;if("offset"!==u){if(hs(p,!1,f),"road"===u){const e=!d&&"translucent"===t.renderPass;e&&cs(t,i,r,n,"geometry"),hs(p,!0,f,Yi.disabled),e&&function(e){const{painter:t,sourceCache:i,layer:r,coords:n,colorMode:o}=e,s=t.context.gl,a=e.painter.shadowRenderer,l=!!a&&a.enabled,c=new Wi(t.context.gl.LEQUAL,Wi.ReadOnly,t.depthRangeFor3D);let h=[0,0,0];if(l){const e=t.style.directionalLight,i=t.style.ambientLight;e&&i&&(h=_r(t.style,e,i))}const u=e=>{for(const u of n){const n=i.getTile(u),d=n.getBucket(r);if(!d)continue;const p=d.elevatedStructures;if(!p)continue;let f,m;if(e?(f=p.renderableBridgeSegments,m=p.bridgeProgramConfigurations.get(r.id)):(f=p.renderableTunnelSegments,m=p.tunnelProgramConfigurations.get(r.id)),!f||0===f.segments[0].primitiveLength)continue;m.updatePaintBuffers(),t.prepareDrawTile();const _=t.isTileAffectedByFog(u),g=[];l&&g.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const y=t.getOrCreateProgram("elevatedStructures",{config:m,overrideFog:_,defines:g}),x=t.translatePosMatrix(u.projMatrix,n,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor"));l&&a.setupShadows(n.tileID.toUnwrapped(),y,"vector-tile");const v=To(x,h);t.uploadCommonUniforms(t.context,y,u.toUnwrapped()),y.draw(t,s.TRIANGLES,c,Yi.disabled,o,Qi.backCCW,v,r.id,p.vertexBuffer,p.indexBuffer,f,r.paint,t.transform.zoom,m,[p.vertexBufferNormal])}};u(!0),u(!1)}(p)}}else hs(p,!1,f,t.stencilModeFor3D())},"fill-extrusion":function(t,i,r,n){const o=r.paint.get("fill-extrusion-opacity"),s=t.context,a=s.gl,l=t.terrain,c=l&&l.renderingToTexture;if(0===o)return;const h="mrt-fallback"===t.emissiveMode,u=t.conflationActive&&t.style.isLayerClipped(r,i.getSource()),d=t.style.order.indexOf(r.fqid);if(u&&function(e,t,i,r,n){for(const o of r){const r=t.getTile(o).getBucket(i);r&&(r.updateReplacement(o,e.replacementSource,n),r.uploadCentroid(e.context))}}(t,i,r,n,d),l||u)for(const e of n){const n=i.getTile(e).getBucket(r);n&&fs(t.context,i,e,n,r,l,u)}if("shadow"===t.renderPass&&t.shadowRenderer){const s=t.shadowRenderer;if(l&&o<.65&&r._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof e.ad)return;const a=s.getShadowPassDepthMode(),c=s.getShadowPassColorMode();us(t,i,r,n,a,Yi.disabled,c,u)}else if("translucent"===t.renderPass){const d=!r.paint.get("fill-extrusion-pattern").constantOr(1),p=r.paint.get("fill-extrusion-color").constantOr(e.ao.white);if(!c&&0!==p.a){const e=new Wi(t.context.gl.LEQUAL,Wi.ReadWrite,t.depthRangeFor3D);1===o&&d?us(t,i,r,n,e,Yi.disabled,Zi.unblended,u):(us(t,i,r,n,e,Yi.disabled,Zi.disabled,u),us(t,i,r,n,e,t.stencilModeFor3D(),t.colorModeForRenderPass(),u),t.resetStencilClippingMasks())}if(t.style.enable3dLights()&&d&&(!l&&"globe"!==t.transform.projection.name||c)){const o=r.paint.get("fill-extrusion-opacity"),d=r.paint.get("fill-extrusion-ambient-occlusion-intensity"),p=r.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),f=r.paint.get("fill-extrusion-flood-light-intensity"),m="none"===r.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default"),_=r.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(m?null:r.lut).toArray01().slice(0,3),g=d>0&&p>0,y=f>0,x=(e,t,i)=>(1-i)*e+i*t,v=new ds;v.translate=r.paint.get("fill-extrusion-translate"),v.translateAnchor=r.paint.get("fill-extrusion-translate-anchor"),v.edgeRadius=r.layout.get("fill-extrusion-edge-radius"),v.cutoffFadeRange=r.paint.get("fill-extrusion-cutoff-fade-range");const b=s=>{const l=t.depthModeForSublayer(1,Wi.ReadOnly,a.LEQUAL,!0),c=r.paint.get(s?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),h=x(.1,3,c),m=t._showOverdrawInspector;if(!m){const c=new Yi({func:a.ALWAYS,mask:255},255,255,a.KEEP,a.KEEP,a.REPLACE),m=new Zi([a.ONE,a.ONE,a.ONE,a.ONE],e.ao.transparent,[!1,!1,!1,!0],a.MIN);ps(v,t,i,r,n,l,c,m,Qi.disabled,s,"sdf",o,d,p,f,_,h,u,!1)}{const c=m?Yi.disabled:new Yi({func:a.EQUAL,mask:255},255,255,a.KEEP,a.DECR,a.DECR),g=m?t.colorModeForRenderPass():new Zi([a.ONE_MINUS_DST_ALPHA,a.DST_ALPHA,a.ONE,a.ONE],e.ao.transparent,[!0,!0,!0,!0]);ps(v,t,i,r,n,l,c,g,Qi.disabled,s,"color",o,d,p,f,_,h,u,!1)}};if(c){const c=()=>{const t=l.drapeBufferSize[0],i=l.drapeBufferSize[1];let r=l.framebufferCopyTexture;return r&&(!r||r.size[0]===t&&r.size[1]===i)||(r&&r.destroy(),r=l.framebufferCopyTexture=new e.T(s,new e.q({width:t,height:i}),a.RGBA8)),r.bind(a.LINEAR,a.CLAMP_TO_EDGE),a.copyTexSubImage2D(a.TEXTURE_2D,0,0,0,0,0,t,i),r},m=(s,l,m)=>{const g=t.depthModeForSublayer(1,Wi.ReadOnly,a.LEQUAL,!1),y=r.paint.get(s?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),b=x(.1,3,y);{const c=new Zi([a.ONE,a.ONE,a.ONE,a.ONE],e.ao.transparent,[!1,!1,!1,!0]);ps(v,t,i,r,n,g,Yi.disabled,c,Qi.disabled,s,"clear",o,d,p,f,_,b,u,l)}{const c=new Yi({func:a.ALWAYS,mask:255},255,255,a.KEEP,a.KEEP,a.REPLACE),h=new Zi([a.ONE,a.ONE,a.ONE,a.ONE],e.ao.transparent,[!1,!1,!1,!0],a.MIN);ps(v,t,i,r,n,g,c,h,Qi.disabled,s,"sdf",o,d,p,f,_,b,u,l)}h&&!s&&(m=c());{const c=s?a.ZERO:a.ONE_MINUS_DST_ALPHA,h=new Yi({func:a.EQUAL,mask:255},255,255,a.KEEP,a.DECR,a.DECR),m=new Zi([c,a.DST_ALPHA,a.ONE_MINUS_DST_ALPHA,a.ZERO],e.ao.transparent,[!0,!0,!0,!0]);ps(v,t,i,r,n,g,h,m,Qi.disabled,s,"color",o,d,p,f,_,b,u,l)}if(!h||s){const c=new Zi([a.ONE,a.ONE,a.ONE,s?a.ZERO:a.ONE],e.ao.transparent,[!1,!1,!1,!0],s?a.FUNC_ADD:a.MAX);ps(v,t,i,r,n,g,Yi.disabled,c,Qi.disabled,s,"clear",o,d,p,f,_,b,u,l,m)}else{a.drawBuffers([a.NONE,a.COLOR_ATTACHMENT1]);const c=new Yi({func:a.EQUAL,mask:255},254,255,a.KEEP,a.DECR,a.DECR),h=new Zi([a.ONE,a.ONE,a.ONE,a.ONE],e.ao.transparent,[!0,!1,!1,!1],a.MAX);ps(v,t,i,r,n,g,c,h,Qi.disabled,s,"emissive",o,d,p,f,_,b,u,l,m),a.drawBuffers([a.COLOR_ATTACHMENT0])}};if(g||y){let e;t.prepareDrawTile(),h&&!g||(e=c()),g&&m(!0,!1,e),y&&m(!1,!0,e)}}else g&&b(!0),y&&b(!1),(g||y)&&t.resetStencilClippingMasks()}}},building:function(e,t,i,r){e.currentLayer<e.firstLightBeamLayer&&(e.firstLightBeamLayer=e.currentLayer);const n=i.paint.get("building-ambient-occlusion-ground-intensity"),o=i.paint.get("building-ambient-occlusion-ground-radius"),s=i.paint.get("building-ambient-occlusion-ground-attenuation"),a=i.paint.get("building-opacity");if(a<=0)return;let l=n>0&&o>0,c=!0;const h=i.paint.get("building-vertical-scale");if(h<=0)return;e.shadowRenderer||(c=!1);const u=e.conflationActive&&e.style.isLayerClipped(i,t.getSource()),d=e.style.order.indexOf(i.fqid);if(function(e,t,i,r,n,o){for(const s of o){const o=t.getTile(s).getBucket(i);o&&(n&&o.updateReplacement(s,e.replacementSource,r),o.uploadUpdatedIndexBuffer(e.context))}}(e,t,i,d,u,r),function(e,t,i,r){for(const n of r){const r=t.getTile(n).getBucket(i);r&&r.needsEvaluation()&&r.uploadUpdatedColorBuffer(e.context)}}(e,t,i,r),i.resetLayerRenderingStats(e),e.shadowRenderer&&(e.shadowRenderer.useNormalOffset=!0),"shadow"===e.renderPass&&e.shadowRenderer){const n=e.shadowRenderer,o=[],s=n.getShadowPassDepthMode();xs({painter:e,source:t,layer:i,coords:r,defines:o,blendMode:n.getShadowPassColorMode(),depthMode:s,opacity:a,verticalScale:h,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if("translucent"===e.renderPass){let d=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];c&&(d=d.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),e.shadowRenderer&&e.shadowRenderer.useNormalOffset&&(d=d.concat("NORMAL_OFFSET"));const p=i.paint.get("building-facade-emissive-chance"),f=i.paint.get("building-ambient-occlusion-intensity"),m=i.paint.get("building-flood-light-intensity"),_="none"===i.paint.get("building-flood-light-color-use-theme").
2constantOr("default"),g=i.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(_?null:i.lut).toArray01().slice(0,3),y=i.paint.get("building-flood-light-ground-attenuation"),x=m>0,v=new Wi(e.context.gl.LEQUAL,Wi.ReadWrite,e.depthRangeFor3D);a<1&&xs({painter:e,source:t,layer:i,coords:r,defines:d,blendMode:Zi.disabled,depthMode:v,opacity:a,verticalScale:h,facadeEmissiveChance:p,facadeAOIntensity:f,floodLightIntensity:m,floodLightColor:g,depthOnly:!0});const b=e.colorModeForRenderPass();xs({painter:e,source:t,layer:i,coords:r,defines:d,blendMode:b,depthMode:v,opacity:a,verticalScale:h,facadeEmissiveChance:p,facadeAOIntensity:f,floodLightIntensity:m,floodLightColor:g}),l&&vs(e,t,i,r,!0,a,n,o,m,g,s,u),x&&vs(e,t,i,r,!1,a,n,o,m,g,y,u)}else if("light-beam"===e.renderPass){const n=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],o=new Wi(e.context.gl.LEQUAL,Wi.ReadOnly,e.depthRangeFor3D);xs({painter:e,source:t,layer:i,coords:r,defines:n,blendMode:Zi.alphaBlended,depthMode:o,opacity:a,verticalScale:h,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}e.shadowRenderer&&(e.shadowRenderer.useNormalOffset=!1),e.resetStencilClippingMasks()},hillshade:function(e,t,i,r){if("offscreen"!==e.renderPass&&"translucent"!==e.renderPass)return;if(e.style.disableElevatedTerrain)return;const n=e.context,o=e.terrain&&e.terrain.renderingToTexture,[s,a]="translucent"!==e.renderPass||o?[{},r]:e.stencilConfigForOverlap(r);for(const l of a){const r=t.getTile(l);if(r.needsHillshadePrepare&&"offscreen"===e.renderPass)cn(e,r,i);else if("translucent"===e.renderPass){const t=e.depthModeForSublayer(0,Wi.ReadOnly),n=i.paint.get("hillshade-emissive-strength"),a=e.colorModeForDrapableLayerRenderPass(n),c=o&&e.terrain?e.terrain.stencilModeForRTTOverlap(l):s[l.overscaledZ];an(e,l,r,i,t,c,a)}}n.viewport.set([0,0,e.width,e.height]),e.resetStencilClippingMasks()},raster:function(t,i,r,n,o,s){if("translucent"!==t.renderPass)return;if(0===r.paint.get("raster-opacity"))return;const a="globe"===t.transform.projection.name,l=0!==r.paint.get("raster-elevation"),c=l&&a;if(t.renderElevatedRasterBackface&&!c)return;const h=t.context,u=h.gl,d=i.getSource(),p=function(t,i,r,n,o){const s=i.paint.get("raster-color"),a="raster-array"===t.type,l=[],c=i.paint.get("raster-resampling"),h=i.paint.get("raster-color-mix");let u=i.paint.get("raster-color-range");const d=[h[0],h[1],h[2],0],p=h[3];let f="nearest"===c?n.NEAREST:n.LINEAR;if(a&&(l.push("RASTER_ARRAY"),s||l.push("RASTER_COLOR"),"linear"===c&&l.push("RASTER_ARRAY_LINEAR"),f=n.NEAREST,!u&&t.rasterLayers)){const e=t.rasterLayers.find(({id:e})=>e===i.sourceLayer);e&&e.fields&&e.fields.range&&(u=e.fields.range)}if(u=u||[0,1],s){l.push("RASTER_COLOR"),r.activeTexture.set(n.TEXTURE2),i.updateColorRamp(u);let t=i.colorRampTexture;t||(t=i.colorRampTexture=new e.T(r,i.colorRamp,n.RGBA8)),t.bind(f,n.CLAMP_TO_EDGE)}return o&&l.push("USE_MRT1"),{mix:d,range:u,offset:p,defines:l,resampling:f}}(d,r,h,u,t.terrain&&t.terrain.renderingToTexture&&"mrt-fallback"===t.emissiveMode);if(d instanceof e.aU&&!n.length&&!a)return;const f=r.paint.get("raster-emissive-strength"),m=t.colorModeForDrapableLayerRenderPass(f),_=t.terrain&&t.terrain.renderingToTexture,g=!t.options.moving,y="nearest"===r.paint.get("raster-resampling")?u.NEAREST:u.LINEAR;if(d instanceof e.aU&&!n.length&&(d.onNorthPole||d.onSouthPole)){const e=l?t.stencilModeFor3D():Yi.disabled;return void ws(!!d.onNorthPole,null,t,i,r,f,p,Qi.disabled,e)}if(!n.length)return;const[x,v]=d instanceof e.aU||_?[{},n]:t.stencilConfigForOverlap(n),b=v[v.length-1].overscaledZ;c&&p.defines.push("PROJECTION_GLOBE_VIEW"),l&&p.defines.push("RENDER_CUTOFF");const w=(n,o,v)=>{for(const w of n){const n=w.toUnwrapped(),T=i.getTile(w);if(_&&(!T||!T.hasData()))continue;h.activeTexture.set(u.TEXTURE0);const S=Ss(T,d,r,p);if(!S||!S.texture)continue;const{texture:E,mix:I,offset:A,tileSize:M,buffer:C}=S;let P,R;_?(P=Wi.disabled,R=w.projMatrix):l?(P=new Wi(u.LEQUAL,Wi.ReadWrite,t.depthRangeFor3D),R=a?Float32Array.from(t.transform.expandedFarZProjMatrix):t.transform.calculateProjMatrix(n,g)):(P=t.depthModeForSublayer(w.overscaledZ-b,1===r.paint.get("raster-opacity")?Wi.ReadWrite:Wi.ReadOnly,u.LESS),R=t.transform.calculateProjMatrix(n,g));const z=t.terrain&&_?t.terrain.stencilModeForRTTOverlap(w):x[w.overscaledZ],L=s?0:r.paint.get("raster-fade-duration");T.registerFadeDuration(L);const D=i.findLoadedParent(w,0),O=io(T,D,i,t.transform,L);let F,k;!O.isFading&&T.refreshedUponExpiration&&(T.refreshedUponExpiration=!1),t.terrain&&t.terrain.prepareDrawTile(),h.activeTexture.set(u.TEXTURE0),E.bind(y,u.CLAMP_TO_EDGE),h.activeTexture.set(u.TEXTURE1),D?(D.texture&&D.texture.bind(y,u.CLAMP_TO_EDGE),F=Math.pow(2,D.tileID.overscaledZ-T.tileID.overscaledZ
2),k=[T.tileID.canonical.x*F%1,T.tileID.canonical.y*F%1]):E.bind(y,u.CLAMP_TO_EDGE),"useMipmap"in E&&h.extTextureFilterAnisotropic&&t.transform.pitch>20&&u.texParameterf(u.TEXTURE_2D,h.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,h.extTextureFilterAnisotropicMax);const B=t.transform;let N;const V=l?Ts(B):[0,0,0,0];let U,j,G,q,H,$=0;if(c&&d instanceof e.aU&&d.coordinates.length>3)U=Float32Array.from(e.bk(e.dJ(new e.cD(0,0,0)))),j=Float32Array.from(B.globeMatrix),G=Float32Array.from(e.dF(B)),q=[e.aF(B.center.lng),e.aJ(B.center.lat)],N=d.elevatedGlobePerspectiveTransform,H=d.elevatedGlobeGridMatrix||new Float32Array(9);else if(c){const t=e.dG(w.canonical);$=e.dH(t.getCenter().lat),U=Float32Array.from(e.bk(e.dJ(w.canonical))),j=Float32Array.from(B.globeMatrix),G=Float32Array.from(e.dF(B)),q=[e.aF(B.center.lng),e.aJ(B.center.lat)],N=[0,0],H=Float32Array.from(e.dI(w.canonical,t,$,B.worldSize/B._pixelsPerMercatorPixel))}else N=d instanceof e.aU?d.perspectiveTransform:[0,0],U=new Float32Array(16),j=new Float32Array(9),G=new Float32Array(16),q=[0,0],H=new Float32Array(9);const Z=Oo(R,U,j,G,H,k||[0,0],e.aj(t.transform.zoom),q,V,F||1,O,r,N,l?r.paint.get("raster-elevation"):0,2,I,A,p.range,M,C,f),W=t.isTileAffectedByFog(w),X=t.getOrCreateProgram("raster",{defines:p.defines,overrideFog:W});if(t.uploadCommonUniforms(h,X,n),d instanceof e.aU){const i=d.elevatedGlobeVertexBuffer,n=d.elevatedGlobeIndexBuffer;if(_||!a)d.boundsBuffer&&d.boundsSegments&&X.draw(t,u.TRIANGLES,P,Yi.disabled,m,Qi.disabled,Z,r.id,d.boundsBuffer,t.quadTriangleIndexBuffer,d.boundsSegments);else if(i&&n){const s=B.zoom<=e.c_?d.elevatedGlobeSegments:d.getSegmentsForLongitude(B.center.lng);s&&X.draw(t,u.TRIANGLES,P,Yi.disabled,m,o,Z,r.id,i,n,s)}}else if(c){P=new Wi(u.LEQUAL,Wi.ReadOnly,t.depthRangeFor3D);const e=t.globeSharedBuffers;if(e){const[i,n,s]=e.getGridBuffers($,!1);X.draw(t,u.TRIANGLES,P,v||z,t.colorModeForRenderPass(),o,Z,r.id,i,n,s)}}else{const{tileBoundsBuffer:e,tileBoundsIndexBuffer:i,tileBoundsSegments:n}=t.getTileBoundsBuffers(T);X.draw(t,u.TRIANGLES,P,z,m,Qi.disabled,Z,r.id,e,i,n)}}if(!(d instanceof e.aU)&&c)for(const e of n){const n=e.canonical.y===(1<<e.canonical.z)-1;0===e.canonical.y&&ws(!0,e,t,i,r,f,p,o,v||Yi.disabled),n&&ws(!1,e,t,i,r,f,p,o===Qi.frontCW?Qi.backCW:Qi.frontCW,v||Yi.disabled)}};c?w(v,t.renderElevatedRasterBackface?Qi.backCW:Qi.frontCW,t.stencilModeFor3D()):w(v,Qi.disabled,void 0),t.resetStencilClippingMasks()},"raster-particle":function(t,i,r,n,o,s){"offscreen"===t.renderPass&&function(t,i,r,n){if(!n.length)return;const o=t.context,s=o.gl,a=i.getSource();if(!(a instanceof ft))return;const l=Math.ceil(Math.sqrt(r.paint.get("raster-particle-count")));let c=r.particlePositionRGBAImage;if(!c||c.width!==l){const t=function(e){const t=e*e,i=new Uint8Array(4*t),r=function(e){return e|=0,e=Math.imul(2747636419^e,2654435769),e=Math.imul(e^e>>>16,2654435769),((e=Math.imul(e^e>>>16,2654435769))>>>0)/4294967296},n=.9090909090909091;for(let o=0;o<t;o++){const e=n*(r(2*o+0)+ko),t=n*(r(2*o+1)+ko),s=255*e%1,a=255*t%1,l=s,c=t-a/255,h=a;i[4*o+0]=255*(e-s/255),i[4*o+1]=255*l,i[4*o+2]=255*c,i[4*o+3]=255*h}return i}(l);c=r.particlePositionRGBAImage=new e.q({width:l,height:l},t)}let h=r.particleFramebuffer;h?h.width!==l&&(h.destroy(),h=r.particleFramebuffer=o.createFramebuffer(l,l,1,null)):h=r.particleFramebuffer=o.createFramebuffer(l,l,1,null);const u=[];for(const e of n){const t=i.getTile(e);if(!(t instanceof Lt))continue;const n=As(t,a,r);if(!n)continue;const s=[t.tileSize,t.tileSize];let h=r.tileFramebuffer;h||(h=r.tileFramebuffer=o.createFramebuffer(s[0],s[1],1,null));let d=t.rasterParticleState;d||(d=t.rasterParticleState=new Is(o,e,s,c));const p=d.update(r.lastInvalidatedAt);d.particleTextureDimension!==l&&d.updateParticleTexture(e,c);const f=d.targetColorTexture;d.targetColorTexture=d.backgroundColorTexture,d.backgroundColorTexture=f;const m=d.particleTexture0;d.particleTexture0=d.particleTexture1,d.particleTexture1=m,u.push([e,n,d,p])}if(0===u.length)return;const d=e.o.now(),p=r.previousDrawTimestamp?.001*(d-r.previousDrawTimestamp):.0167;if(r.previousDrawTimestamp=d,r.hasColorMap()){o.activeTexture.set(s.TEXTURE0+2);let t=r.colorRampTexture;t||(t=r.colorRampTexture=new e.T(o,r.colorRamp,s.RGBA8)),t.bind(s.LINEAR,s.CLAMP_TO_EDGE)}o.bindFramebuffer.set(r.tileFramebuffer.framebuffer),function(t,i,r){const n=t.context,o=n.gl,s=i.tileFramebuffer;n.activeTexture.set(o.TEXTURE0);const a={u_texture:0,u_opacity:1.05*(c=i.paint.get("raster-particle-fade-opacity-factor"))/(c+.05)},l=t.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var c;for(const h of r){const[,,r,c]=h;s.colorAttachment0.set(r.targetColorTexture.texture),n.viewport.set([0,0,s.width,s.height]),n.clear({color:e.ao.transparent}),c&&(r.backgroundColorTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE),l.draw(t,o.TRIANGLES,Wi.disabled,Yi.disabled,Zi.alphaBlended,Qi.disabled,a,i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments))}}(t,r,u),function(t,i,r,n){const o=t.context,s=o.gl,a=r.tileFramebuffer,l="globe"===t.transform.projection.name,c=r.paint.get("raster-particle-max-speed");for(const h of n){const[n,u,d]=h;o.activeTexture.set(s.TEXTURE0+0),u.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),a.colorAttachment0.set(d.targetColorTexture.texture);const p=t.getOrCreateProgram("rasterParticleDraw",{defines:u.defines,overrideFog:!1});o.activeTexture.set(s.TEXTURE0+1);const f=u.scalarData?[]:[0,1,2,3].map(t=>e.e9[t](n));f.push(n);const m=n.canonical.x,_=n.canonical.y;for(const e of f){const o=i.getTile(l?e.wrapped():e);if(!o)continue;const a=o.rasterParticleState;if(!a)continue;const h=e.canonical.x+(1<<e.canonical.z)*(e.wrap-n.wrap),d=e.canonical.y;a.particleTexture0.bind(s.NEAREST,s.CLAMP_TO_EDGE);
vendor: 4,255 bytes, line 2
2const f=No(1,a.particleTexture0.size[0],[h-m,d-_],0,u.texture.size,2,c,u.textureOffset,u.scale,u.offset);p.draw(t,s.POINTS,Wi.disabled,Yi.disabled,Zi.alphaBlended,Qi.disabled,f,r.id,a.particleIndexBuffer,void 0,a.particleSegment)}}}(t,i,r,u),o.bindFramebuffer.set(r.particleFramebuffer.framebuffer),function(t,i,r,n){const o=t.context,s=o.gl,a=i.paint.get("raster-particle-max-speed"),l=n*i.paint.get("raster-particle-speed-factor")*.15,c=function(e){return Math.pow(e,6)}(.01+1*i.paint.get("raster-particle-reset-rate-factor")),h=i.particleFramebuffer;o.viewport.set([0,0,h.width,h.height]);for(const u of r){const[,r,n]=u;o.activeTexture.set(s.TEXTURE0+0),r.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),o.activeTexture.set(s.TEXTURE0+1);const d=n.particleTexture0;d.bind(s.NEAREST,s.CLAMP_TO_EDGE);const p=Vo(1,d.size[0],0,r.texture.size,a,l,c,r.textureOffset,r.scale,r.offset);h.colorAttachment0.set(n.particleTexture1.texture),o.clear({color:e.ao.transparent}),t.getOrCreateProgram("rasterParticleUpdate",{defines:r.defines}).draw(t,s.TRIANGLES,Wi.disabled,Yi.disabled,Zi.unblended,Qi.disabled,p,i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments)}}(t,r,u,p)}(t,i,r,n),"translucent"===t.renderPass&&(function(t,i,r,n){const o=t.context,s=o.gl,a=i.getSource().tileSize,l=5*(1-e.ah(e.cL,e.cL+1,t.transform.zoom))*a+r.paint.get("raster-particle-elevation"),c=!t.options.moving,h="globe"===t.transform.projection.name;if(!n.length)return;const[u,d]=t.stencilConfigForOverlap(n),p=[];h&&p.push("PROJECTION_GLOBE_VIEW");const f=t.stencilModeFor3D();for(const m of d){const n=m.toUnwrapped(),a=i.getTile(m);if(!a.rasterParticleState)continue;const d=a.rasterParticleState,_=100;a.registerFadeDuration(_);const g=i.findLoadedParent(m,0),y=io(a,g,i,t.transform,_);let x,v;t.terrain&&t.terrain.prepareDrawTile(),o.activeTexture.set(s.TEXTURE0),d.targetColorTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),o.activeTexture.set(s.TEXTURE1),g&&g.rasterParticleState?(g.rasterParticleState.targetColorTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),x=Math.pow(2,g.tileID.overscaledZ-a.tileID.overscaledZ),v=[a.tileID.canonical.x*x%1,a.tileID.canonical.y*x%1]):d.targetColorTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE);const b=h?Float32Array.from(t.transform.expandedFarZProjMatrix):t.transform.calculateProjMatrix(n,c),w=t.transform,T=Ms(w),S=e.dG(m.canonical),E=e.dH(S.getCenter().lat);let I,A,M,C,P;h?(I=Float32Array.from(e.bk(e.dJ(m.canonical))),A=Float32Array.from(w.globeMatrix),M=Float32Array.from(e.dF(w)),C=[e.aF(w.center.lng),e.aJ(w.center.lat)],P=Float32Array.from(e.dI(m.canonical,S,E,w.worldSize/w._pixelsPerMercatorPixel))):(I=new Float32Array(16),A=new Float32Array(9),M=new Float32Array(16),C=[0,0],P=new Float32Array(9));const R=Bo(b,I,A,M,P,v||[0,0],e.aj(t.transform.zoom),C,T,x||1,y,l),z=t.isTileAffectedByFog(m),L=t.getOrCreateProgram("rasterParticle",{defines:p,overrideFog:z});if(t.uploadCommonUniforms(o,L,n),h){const e=new Wi(s.LEQUAL,Wi.ReadOnly,t.depthRangeFor3D),i=0,n=t.globeSharedBuffers;if(n){const[o,a,l]=n.getGridBuffers(E,0!==i);L.draw(t,s.TRIANGLES,e,f,Zi.alphaBlended,t.renderElevatedRasterBackface?Qi.frontCCW:Qi.backCCW,R,r.id,o,a,l)}}else{const e=t.depthModeForSublayer(0,Wi.ReadOnly),i=u[m.overscaledZ],{tileBoundsBuffer:n,tileBoundsIndexBuffer:o,tileBoundsSegments:l}=t.getTileBoundsBuffers(a);L.draw(t,s.TRIANGLES,e,i,Zi.alphaBlended,Qi.disabled,R,r.id,n,o,l)}}t.resetStencilClippingMasks()}(t,i,r,n),t.style.map.triggerRepaint())},background:function(t,i,r,n){const o=r.paint.get("background-color"),s="none"===r.paint.get("background-color-use-theme").constantOr("default"),a=r.paint.get("background-opacity"),l=r.paint.get("background-emissive-strength"),c="viewport"===r.paint.get("background-pitch-alignment");if(0===a)return;const h=t.context,u=h.gl,d=t.transform,p=d.tileSize,f=r.paint.get("background-pattern");let m;if(void 0!==f){if(null===f)return;if(m=t.imageManager.getPattern(e.I.from(f.toString()),r.scope,t.style.getLut(r.scope)),!m)return}const _=!f&&1===o.a&&1===a&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==_)return;const g=Yi.disabled,y=t.depthModeForSublayer(0,"opaque"===_?Wi.ReadWrite:Wi.ReadOnly),x=t.colorModeForDrapableLayerRenderPass(l),v=f?"backgroundPattern":"background";let b,w=n;
vendor: 1,852 bytes, line 2
2w||(b=t.getBackgroundTiles(),w=Object.values(b).map(e=>e.tileID)),f&&(h.activeTexture.set(u.TEXTURE0),t.imageManager.bind(t.context,r.scope));const T=[];if(t.terrain&&t.terrain.renderingToTexture&&"mrt-fallback"===t.emissiveMode&&T.push("USE_MRT1"),c){const i=t.getOrCreateProgram(v,{overrideFog:!1,overrideRtt:!0,defines:T}),n=new Float32Array(e.bA([])),h=new e.aQ(0,0,0,0,0),d=f?qo(n,l,a,t,0,r.scope,m,c,{tileID:h,tileSize:p}):Go(n,l,a,o.toPremultipliedRenderColor(s?null:r.lut));return void i.draw(t,u.TRIANGLES,y,g,x,Qi.disabled,d,r.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments)}for(const e of w){const _=t.isTileAffectedByFog(e),w=t.getOrCreateProgram(v,{overrideFog:_,defines:T}),S=e.toUnwrapped(),E=n?e.projMatrix:t.transform.calculateProjMatrix(S);t.prepareDrawTile();const I=i?i.getTile(e):b?b[e.key]:new zt(e,p,d.zoom,t),A=f?qo(E,l,a,t,0,r.scope,m,c,{tileID:e,tileSize:p}):Go(E,l,a,o.toPremultipliedRenderColor(s?null:r.lut));t.uploadCommonUniforms(h,w,S);const{tileBoundsBuffer:M,tileBoundsIndexBuffer:C,tileBoundsSegments:P}=t.getTileBoundsBuffers(I);w.draw(t,u.TRIANGLES,y,g,x,Qi.disabled,A,r.id,M,C,P)}},sky:function(t,i,r){const n=t._atmosphere?e.aj(t.transform.zoom):1,o=r.paint.get("sky-opacity")*n;if(0===o)return;const s=t.context,a=r.paint.get("sky-type"),l=new Wi(s.gl.LEQUAL,Wi.ReadOnly,[0,1]),c=t.frameCounter/1e3%1;"atmosphere"===a?"offscreen"===t.renderPass?r.needsSkyboxCapture(t)&&(function(t,i){const r=t.context,n=r.gl;let o=i.skyboxFbo;if(!o){o=i.skyboxFbo=r.createFramebuffer(32,32,1,null),i.skyboxGeometry=new js(r),i.skyboxTexture=r.gl.createTexture(),n.bindTexture(n.TEXTURE_CUBE_MAP,i.skyboxTexture),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MIN_FILTER,n.L
vendor: 8,599 bytes, line 2
2INEAR),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MAG_FILTER,n.LINEAR);for(let e=0;e<6;++e)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,n.RGBA,32,32,0,n.RGBA,n.UNSIGNED_BYTE,null)}r.bindFramebuffer.set(o.framebuffer),r.viewport.set([0,0,32,32]);const s=i.getCenter(t,!0),a=t.getOrCreateProgram("skyboxCapture"),l=new Float64Array(16);e.bA(l),e.en(l,l,.5*-Math.PI),Gs(t,i,a,l,s,0),e.bA(l),e.en(l,l,.5*Math.PI),Gs(t,i,a,l,s,1),e.bA(l),e.cU(l,l,.5*-Math.PI),Gs(t,i,a,l,s,2),e.bA(l),e.cU(l,l,.5*Math.PI),Gs(t,i,a,l,s,3),e.bA(l),Gs(t,i,a,l,s,4),e.bA(l),e.en(l,l,Math.PI),Gs(t,i,a,l,s,5),r.viewport.set([0,0,t.width,t.height])}(t,r),r.markSkyboxValid(t)):"sky"===t.renderPass&&function(e,t,i,r,n){const o=e.context,s=o.gl,a=e.transform,l=e.getOrCreateProgram("skybox");o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_CUBE_MAP,t.skyboxTexture);const c=((e,t,i,r,n)=>({u_matrix:e,u_sun_direction:t,u_cubemap:0,u_opacity:r,u_temporal_offset:n}))(a.skyboxMatrix,t.getCenter(e,!1),0,r,n);e.uploadCommonUniforms(o,l),l.draw(e,s.TRIANGLES,i,Yi.disabled,e.colorModeForRenderPass(),Qi.backCW,c,"skybox",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}(t,r,l,o,c):"gradient"===a&&"sky"===t.renderPass&&function(t,i,r,n,o){const s=t.context,a=s.gl,l=t.transform,c=t.getOrCreateProgram("skyboxGradient");i.skyboxGeometry||(i.skyboxGeometry=new js(s)),s.activeTexture.set(a.TEXTURE0);let h=i.colorRampTexture;h||(h=i.colorRampTexture=new e.T(s,i.colorRamp,a.RGBA8)),h.bind(a.LINEAR,a.CLAMP_TO_EDGE);const u=((t,i,r,n,o)=>({u_matrix:t,u_color_ramp:0,u_center_direction:i,u_radius:e.an(r),u_opacity:n,u_temporal_offset:o}))(l.skyboxMatrix,i.getCenter(t,!1),i.paint.get("sky-gradient-radius"),n,o);t.uploadCommonUniforms(s,c),c.draw(t,a.TRIANGLES,r,Yi.disabled,t.colorModeForRenderPass(),Qi.backCW,u,"skyboxGradient",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(t,r,l,o,c)},custom:function(t,i,r,n){const o=t.context,s=r.implementation;if(!t.transform.projection.unsupportedLayers||!t.transform.projection.unsupportedLayers.includes("custom")||t.terrain&&(t.terrain.renderingToTexture||"offscreen"===t.renderPass)&&r.isDraped(i)){if("offscreen"===t.renderPass){const i=s.prerender;if(i){if(t.setCustomLayerDefaults(),o.setColorMode(t.colorModeForRenderPass()),"globe"===t.transform.projection.name){const r=t.transform.pointMerc;i.call(s,o.gl,t.transform.customLayerMatrix(),t.transform.getProjection(),t.transform.globeToMercatorMatrix(),e.aj(t.transform.zoom),[r.x,r.y],t.transform.pixelsPerMeterRatio)}else i.call(s,o.gl,t.transform.customLayerMatrix());o.setDirty(),t.setBaseState()}}else if("translucent"===t.renderPass){if(t.terrain&&t.terrain.renderingToTexture){const e=s.renderToTile;if(e){const i=n[0].canonical,r={x:i.x+n[0].wrap*(s.wrapTileId?0:1<<i.z),y:i.y,z:i.z};o.setDepthMode(Wi.disabled),o.setStencilMode(Yi.disabled),o.setColorMode(t.colorModeForRenderPass()),t.setCustomLayerDefaults(),e.call(s,o.gl,r),o.setDirty(),t.setBaseState()}return}t.setCustomLayerDefaults(),o.setColorMode(t.colorModeForRenderPass()),o.setStencilMode(Yi.disabled);const i="3d"===s.renderingMode?new Wi(t.context.gl.LEQUAL,Wi.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,Wi.ReadOnly);if(o.setDepthMode(i),"globe"===t.transform.projection.name){const i=t.transform.pointMerc;s.render(o.gl,t.transform.customLayerMatrix(),t.transform.getProjection(),t.transform.globeToMercatorMatrix(),e.aj(t.transform.zoom),[i.x,i.y],t.transform.pixelsPerMeterRatio)}else s.render(o.gl,t.transform.customLayerMatrix());o.setDirty(),t.setBaseState(),o.bindFramebuffer.set(null)}}else e.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(t,i,r,n){if("opaque"===t.renderPass)return;const o=r.paint.get("model-opacity").constantOr(1),s=r.paint.get("model-elevation-reference"),a="ground"===s,l="ground"===s;if(0===o)return;const c=r.paint.get("model-cast-shadows");if("shadow"===t.renderPass){if(!c)return;if(t.terrain&&o<.65&&r._transitionablePaint._values["model-opacity"].value.expression instanceof e.ad)return}const h=t.shadowRenderer,u=r.paint.get("model-receive-shadows");h&&(h.useNormalOffset=!0,u||(h.enabled=!1));const d=()=>{h&&(h.useNormalOffset=!0,u||(h.enabled=!0))},p=i.getSource();if("light-beam"===t.renderPass&&"batched-model"!==p.type)return;if("vector"===p.type||"geojson"===p.type)return function(t,i,r,n,o){const s=t.transform,a="globe"===s.projection.name,l=s.getFreeCameraOptions().position;if(!t.modelManager)return;const c=t.modelManager;r.modelManager=c;const h=t.shadowRenderer;if(!r._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const u=r._unevaluatedLayout._values["model-id"],d=Object.assign({},r.layout.get("model-id").parameters),p=t.style.order.indexOf(r.fqid),f=r.paint.get("model-opacity").constantOr(1);for(const m of n){const n=i.getTile(m).getBucket(r);if(!n||n.projection.name!==s.projection.name)continue;const _=n.getModelUris();if(_&&!n.modelsRequested&&(c.addModelsFromBucket(_,o),n.modelsRequested=!0),a)d.zoom=m.overscaledZ;else{const e=aa(m,s);d.zoom=e}const g=u.possiblyEvaluate(d);if(oa(t,n,m),sa.shadowUniformsInitialized=!1,sa.useSingleShadowCascade=!!h&&0===h.getMaxCascadeForTile(m.toUnwrapped()),"shadow"===t.renderPass&&h){if(1===t.currentShadowCascade&&n.isInsideFirstShadowMapFrustum)continue;const i=s.calculatePosMatrix(m.toUnwrapped(),s.worldSize);if(sa.tileMatrix.set(i),sa.shadowTileMatrix=Float32Array.from(h.calculateShadowPassMatrixFromMatrix(i)),sa.aabb.min=[0,0,0],sa.aabb.max[0]=sa.aabb.max[1]=e.al,sa.aabb.max[2]=0,ha(n,sa,t,r.scope))continue}const y=1<<m.canonical.z,x=[((l.x-m.wrap)*y-m.canonical.x)*e.al,(l.y*y-m.canonical.y)*e.al,l.z*y*e.al];t.conflationActive&&Object.keys(n.instancesPerModel).length>0&&t.style.isLayerClipped(r,i.getSource())&&n.updateReplacement(m,t.replacementSource,p,r.scope)&&(n.uploaded=!1,n.upload(t.context));let v=0;const b=new Array,w=new Array,T=new Array;for(let i in n.instancesPerModel){const s=n.instancesPerModel[i];s.features.length>0&&!a&&(i=g.evaluate(s.features[0].feature,{}));const h=c.getModel(i,o);if(h||c.hasURLBeenRequested(i)||n.modelUris.includes(i)||(n.modelUris.push(i),n.modelsRequested=!1),h&&h.uploaded)if(a){const i=e.c5([],[l.x,l.y,l.z],t.transform.worldSize);e.ew(i,i);for(let r=0;r<s.instancedDataArray.length;++r){const o=[0,0,0],a=[1,1,1],l=e.ex(),c=s.tileCoordinatesForInstance(r),u=s.transformForInstance(r);e.ey(a,u),e.ez(l,u),e.eA(o,l);const d=s.translationForInstance(r),p=new e.aT(0,0);e.eB(n.canonical,p,c.x,c.y);const m=e.bC();e.eC(m,h,t.transform,p,o,a,d,!0,!1,!1);const _=s.colorForInstance(r),g=e.bA([]),y=e.ef(p.lat,t.transform.zoom),x=e.bq([],[1,1,1/y]);e.br(g,g,i),T.push({zScaleMatrix:x,negCameraPosMatrix:g});for(const e of h.nodes)ea(t,e,m,t.transform.expandedFarZProjMatrix,v,b,w,h.materialOverrides,f,_);++v}}else for(const e of h.nodes)la(t,r,e,s,x,m,sa)}if(a)if("shadow"===t.renderPass){for(const e of w)ta(e.mesh,e.nodeModelMatrix,t,r);for(const e of b)ta(e.mesh,e.nodeModelMatrix,t,r)}else na(t,r,b,w,T)}}(t,i,r,n,Qs(t,r)),void d();if(!p.loaded())return;if("batched-model"===p.type)return function(t,i,r,n){r.resetLayerRenderingStats(t);const o=t.context,s=t.transform,a=t.style.fog,l=t.shadowRenderer;if("mercator"!==s.projection.name)return void e.w(`Drawing 3D landmark models for ${s.projection.name} projection is not yet implemented`);const c=t.transform.getFreeCameraOptions().position,h=e.c5([],[c.x,c.y,c.z],t.transform.worldSize),u=e.ew([],h),d=e.bA([]),p=e.ef(s.center.lat,s.zoom),f=e.bq([],[1,1,1/p]);e.br(d,d,u);const m=r.paint.get("model-opacity").constantOr(1),_=new Wi(o.gl.LEQUAL,Wi.ReadWrite,t.depthRangeFor3D),g=new Wi(o.gl.LEQUAL,Wi.ReadOnly,t.depthRangeFor3D),y=new e.d9([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),x="shadow"===t.renderPass,v=x&&l?l.getCurrentCascadeFrustum():s.getFrustum(s.scaleZoom(s.worldSize)),b=r.paint.get("model-front-cutoff"),w=b[2]<1,T=cr(t,r.paint.get("model-cutoff-fade-range")),S=r.getLayerRenderingStats();(function(e,t,i,r){const n=e.terrain?e.terrain.exaggeration():0,o=e.transform.zoom;for(const s of r){const r=t.getTile(s).getBucket(i);r&&(r.setFilter(i.filter),e.conflationActive&&r.updateReplacement(s,e.replacementSource),r.evaluateTransform(e,i),e.terrain&&n>0&&r.elevationUpdate(e.terrain,n,s,i.source),r.needsReEvaluation(e,o,i)&&r.evaluate(i))}})(t,i,r,n),function(){let c,u,E;w?(c=n.length-1,u=-1,E=-1):(c=0,u=n.length,E=1);const I=new Float64Array(16),A=e.cA(),M=new e.P(0,0);for(let C=c;C!==u;C+=E){const c=n[C],u=i.getTile(c).getBucket(r);
2if(!u||!u.uploaded)continue;let E=!1;l&&(E=0===l.getMaxCascadeForTile(c.toUnwrapped()));const P=s.calculatePosMatrix(c.toUnwrapped(),s.worldSize),R=u.modelTraits;!x&&w&&(e.bl(I,P),e.af(A,h,I),M.x=A[0],M.y=A[1]);const z=[];u.setFilter(r.filter);for(const i of u.getNodesInfo()){if(i.hiddenByReplacement)continue;if(!i.node.meshes)continue;const r=i.node;let n=0;t.terrain&&r.elevation&&(n=r.elevation*t.terrain.exaggeration());const o=(()=>{const t=i.aabb;return y.min=[...t.min],y.max=[...t.max],y.min[2]+=n,y.max[2]+=n,e.af(y.min,y.min,P),e.af(y.max,y.max,P),y})(),a=i.evaluatedScale;if(a[0]<=1&&a[1]<=1&&a[2]<=1&&0===o.intersects(v))continue;if(!x&&w){const t=1/6;i.cameraCollisionOpacity=h[0]>o.min[0]&&h[0]<o.max[0]&&h[1]>o.min[1]&&h[1]<o.max[1]&&h[2]*p<o.max[2]&&r.footprint&&e.c0(M,r.footprint)?Math.max(i.cameraCollisionOpacity-t,0):Math.min(1,i.cameraCollisionOpacity+t)}const l=[...P],u=1/e.d7(c.canonical),d=r.anchor?r.anchor[0]:0,f=r.anchor?r.anchor[1]:0;e.br(l,l,[d*(a[0]-1)+i.evaluatedTranslation[0]*u,f*(a[1]-1)+i.evaluatedTranslation[1]*u,n+i.evaluatedTranslation[2]]),e.cq(a,e.eE)||e.cS(l,l,a);const _=e.aB([],l,r.globalMatrix),g=e.aB([],s.expandedFarZProjMatrix,_),S=e.aB([],s.expandedFarZProjMatrix,l),E=e.aC([],[d,f,n,1],g)[2];r.hidden=!1;let I=m;x||(w&&(I*=i.cameraCollisionOpacity,I*=da(l,s,i.aabb,b)),I*=ua(T,E)),0!==I?z.push({nodeInfo:i,depth:E,opacity:I,wvpForNode:g,wvpForTile:S,nodeModelMatrix:_,tileModelMatrix:l}):r.hidden=!0}x||z.sort((e,t)=>!w||1===e.opacity&&1===t.opacity?e.depth<t.depth?-1:1:1===e.opacity?-1:1===t.opacity?1:e.depth>t.depth?-1:1);for(const i of z){const n=i.nodeInfo,c=n.node;let h=e.aB([],f,i.tileModelMatrix);e.aB(h,d,h);const u=e.bl([],h);e.eg(u,u),e.cS(u,u,ca),h=e.aB(h,h,c.globalMatrix);const p="light-beam"===t.renderPass,m="none"===r.paint.get("model-color-use-theme").constantOr("default"),y=R&e.eI.HasMapboxMeshFeatures,v=y?0:n.evaluatedRMEA[0][2];for(let e=0;e<c.meshes.length;++e){const d=c.meshes[e],f=e===c.lightMeshIndex;let b=i.wvpForNode;if(f){if(!p&&!t.terrain&&t.shadowRenderer){t.currentLayer<t.firstLightBeamLayer&&(t.firstLightBeamLayer=t.currentLayer);continue}b=i.wvpForTile}else if(p)continue;const w={defines:[]},T=[];if(!x&&l&&(l.useNormalOffset=!!d.normalBuffer),Ks(w.defines,T,d,t,m?null:r.lut),y||w.defines.push("DIFFUSE_SHADED"),E&&w.defines.push("SHADOWS_SINGLE_CASCADE"),S&&(x?S.numRenderedVerticesInShadowPass+=d.vertexArray.length:S.numRenderedVerticesInTransparentPass+=d.vertexArray.length),x){ta(d,i.nodeModelMatrix,t,r);continue}let I=null;if(a){const e=Ys(i.nodeModelMatrix,t.transform);if(I=new Float32Array(e),"globe"!==s.projection.name){const t=d.aabb.min,i=d.aabb.max,[r,n]=a.getOpacityForBounds(e,t[0],t[1],i[0],i[1]);w.overrideFog=r>=je||n>=je}}const A=d.material;let M;A.occlusionTexture&&A.occlusionTexture.offsetScale&&(M=A.occlusionTexture.offsetScale,w.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const C=t.getOrCreateProgram("model",w);!x&&l&&l.setupShadowsFromMatrix(i.tileModelMatrix,C,l.useNormalOffset),t.uploadCommonUniforms(o,C,null,I);const P=A.pbrMetallicRoughness;P.metallicFactor=.9,P.roughnessFactor=.5;const R=$o(new Float32Array(b),new Float32Array(h),new Float32Array(u),new Float32Array(c.globalMatrix),t,i.opacity,P.baseColorFactor,A.emissiveFactor,P.metallicFactor,P.roughnessFactor,A,v,r,[0,0,0],M);!f&&(n.hasTranslucentParts||i.opacity<1)&&C.draw(t,o.gl.TRIANGLES,_,Yi.disabled,Zi.disabled,Qi.backCCW,R,r.id,d.vertexBuffer,d.indexBuffer,d.segments,r.paint,t.transform.zoom,void 0,T),C.draw(t,o.gl.TRIANGLES,f?g:_,Yi.disabled,f||i.opacity<1||n.hasTranslucentParts?Zi.alphaBlended:Zi.unblended,Qi.backCCW,R,r.id,d.vertexBuffer,d.indexBuffer,d.segments,r.paint,t.transform.zoom,void 0,T)}}}}()}(t,i,r,n),void d();if("model"!==p.type)return;const f=p.getModels(),m=[],_=t.transform.getFreeCameraOptions().position,g=e.c5([],[_.x,_.y,_.z],t.transform.worldSize);e.ew(g,g);const y=[],x=[];let v=0;for(const b of f){const n=i.getFeatureState("",b.id),o={type:"Unknown",id:b.id,properties:b.featureProperties},s=r.paint.get("model-rotation").evaluate(o,n),c=r.paint.get("model-scale").evaluate(o,n),h=r.paint.get("model-translation").evaluate(o,n),u=r.paint.get("model-opacity").evaluate(o,n);ia(r,b.id,n,b.featureProperties,b.nodeOverrideNames,b.nodeOverrides),ra(r,b.id,n,b.featureProperties,b.materialOverrideNames,b.materialOverrides),b.nodeOverrides.size>0&&b.computeBoundsAndApplyParent(),b.computeModelMatrix(t,s,c,h,l,a,!1);const d=e.bA([]),p=e.ef(b.position.lat,t.transform.zoom),f=e.bq([],[1,1,1/p]);e.br(d,d,g),m.push({zScaleMatrix:f,negCameraPosMatrix:d});for(const e of b.nodes)ea(t,e,b.matrix,t.transform.expandedFarZProjMatrix,v,y,x,b.materialOverrides,u);v++}if(y.sort((e,t)=>
2t.depth-e.depth),"shadow"!==t.renderPass)na(t,r,y,x,m),d();else{for(const e of x)ta(e.mesh,e.nodeModelMatrix,t,r);for(const e of y)ta(e.mesh,e.nodeModelMatrix,t,r);d()}}},Ca={line:function(e,t,i){if(e.hasElevatedBuckets=!1,e.hasNonElevatedBuckets=!1,void 0!==e._unevaluatedLayout.getValue("line-elevation-reference")||void 0!==e._unevaluatedLayout.getValue("line-z-offset")){if(t){const i=t.getVisibleCoordinates();for(const r of i){const i=t.getTile(r).getBucket(e);if(i&&("none"!==i.elevationType?e.hasElevatedBuckets=!0:e.hasNonElevatedBuckets=!0,e.hasElevatedBuckets&&e.hasNonElevatedBuckets))break}}}else e.hasNonElevatedBuckets=!0},model:function(e,t,i){const r=t.getSource();if(!r.loaded())return;if("vector"===r.type||"geojson"===r.type)return void(i.modelManager&&i.modelManager.upload(i,Qs(i,e)));if("batched-model"===r.type)return;if("model"!==r.type)return;const n=r.getModels();for(const o of n)o.upload(i.context)},raster:function(e,t,i){const r=t.getSource();if(!(r instanceof ft&&r.loaded()))return;const n=e.sourceLayer||r.rasterLayerIds&&r.rasterLayerIds[0];if(!n)return;const o=e.paint.get("raster-array-band")||r.getInitialBand(n);if(null==o)return;const s=t.getIds().map(e=>t.getTileByID(e));for(const a of s)a.updateNeeded(e.id,o)&&r.prepareTile(a,n,e.id,o)},"raster-particle":function(e,t,i){const r=t.getSource();if(!(r instanceof ft&&r.loaded()))return;const n=e.sourceLayer||r.rasterLayerIds&&r.rasterLayerIds[0];if(!n)return;const o=e.paint.get("raster-particle-array-band")||r.getInitialBand(n);if(null==o)return;const s=t.getIds().map(e=>t.getTileByID(e));for(const a of s)a.updateNeeded(e.id,o)&&r.prepareTile(a,n,e.id,o)}},Pa={fill:cs},Ra={fill:function(e,t,i,r){if(!i.layout||"none"===i.layout.get("fill-elevation-reference")||0===i.paint.get("fill-opacity").constantOr(1))return;const n=e.context.gl,o=new Wi(n.LEQUAL,Wi.ReadOnly,e.depthRangeFor3D),s=new Yi({func:n.ALWAYS,mask:255},255,255,n.KEEP,n.KEEP,n.REPLACE),a=e.transform.getFreeCameraOptions().position,l=e.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const c of r){const r=t.getTile(c),h=r.getBucket(i);if(!h)continue;const u=h.elevatedStructures;if(!u||0===u.depthSegments.segments[0].primitiveLength)continue;const d=ls(c.toUnwrapped(),a),p=e.translatePosMatrix(c.projMatrix,r,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor")),f=So(p,d,0,1,0);l.draw(e,n.TRIANGLES,o,s,Zi.disabled,Qi.disabled,f,i.id,u.vertexBuffer,u.indexBuffer,u.depthSegments,i.paint,e.transform.zoom)}}};class za{constructor(t,i,r,n,o){this.context=new Qo(t,i),this.transform=r,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this._timeStamp=e.o.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const s=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const e of s)this._debugParams.enabledLayers[e]=!0;for(const e of s);this.occlusionParams=new ma,this.setup(),this.numSublayers=Ft.maxUnderzooming+Ft.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new e.eP,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new pr(this),this._wireframeDebugCache=new fa,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const a=new e.q({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new e.T(this.context,a,t.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=n,this.worldview=o,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(e,t){const i=!!e&&!!e.terrain&&this.transform.projection.supportsTerrain;if(!(i||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new so(this,e));const r=this._terrain;this.transform.elevation=i?r:null,r.update(e,this.transform,t),this.transform.elevation&&!r.enabled&&(this.transform.elevation=null)}_updateFog(e){const t=e.fog;if(!t||"globe"===this.transform.projection.name||t.getOpacity(this.transform.pitch)<1||t.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[i,r]=t.getFovAdjustedRange(this.transform._fov);if(i>r)return void(this.transform.fogCullDistSq=null);const n=i+.78*(r-i);this.transform.fogCullDistSq=n*n}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(e){e&&!this._terrain&&(this._terrain=new so(this,this.style)),this._forceTerrainMode=e}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(t,i){if(this.width=t*e.o.devicePixelRatio,this.height=i*e.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const e of this.style.order)this.style._mergedLayers[e].resize()}setup(){const t=this.context,i=new e.bd;i.emplaceBack(0,0),i.emplaceBack(e.al,0),i.emplaceBack(0,e.al),i.emplaceBack(e.al,e.al),this.tileExtentBuffer=t.createVertexBuffer(i,e.bf.members),this.tileExtentSegments=e.bg.simpleSegment(0,0,4,2);const r=new e.bd;r.emplaceBack(0,0),r.emplaceBack(e.al,0),r.emplaceBack(0,e.al),r.emplaceBack(e.al,e.al),this.debugBuffer=t.createVertexBuffer(r,e.bf.members),this.debugSegments=e.bg.simpleSegment(0,0,4,5);const n=new e.bd;
vendor: 11,094 bytes, line 2
2n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(-1,1),n.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(n,e.bf.members),this.viewportSegments=e.bg.simpleSegment(0,0,4,2);const o=new e.b1;o.emplaceBack(0,0,0,0),o.emplaceBack(e.al,0,e.al,0),o.emplaceBack(0,e.al,0,e.al),o.emplaceBack(e.al,e.al,e.al,e.al),this.mercatorBoundsBuffer=t.createVertexBuffer(o,e.bi.members),this.mercatorBoundsSegments=e.bg.simpleSegment(0,0,4,2);const s=new e.b0;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(s);const a=new e.be;for(const e of[0,1,3,2,0])a.emplaceBack(e);this.debugIndexBuffer=t.createIndexBuffer(a),this.emptyTexture=new e.T(t,new e.q({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA8),this.identityMat=e.bC();const l=this.context.gl;this.stencilClearMode=new Yi({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(e){return e._makeTileBoundsBuffers(this.context,this.transform.projection),e._tileBoundsBuffer?{tileBoundsBuffer:e._tileBoundsBuffer,tileBoundsIndexBuffer:e._tileBoundsIndexBuffer,tileBoundsSegments:e._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const e=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,e.TRIANGLES,Wi.disabled,this.stencilClearMode,Zi.disabled,Qi.disabled,to(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(e,t,i){if(!t||this.currentStencilSource===t.id||!e.isTileClipped()||!i||0===i.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let e=!1;for(const t of i)if(void 0===this._tileClippingMaskIDs[t.key]){e=!0;break}if(!e)return}this.currentStencilSource=t.id;const r=this.context,n=r.gl;this.nextStencilID+i.length>256&&this.clearStencil(),r.setColorMode(Zi.disabled),r.setDepthMode(Wi.disabled);const o=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const s of i){const e=t.getTile(s),i=this._tileClippingMaskIDs[s.key]=this.nextStencilID++,{tileBoundsBuffer:r,tileBoundsIndexBuffer:a,tileBoundsSegments:l}=this.getTileBoundsBuffers(e);o.draw(this,n.TRIANGLES,Wi.disabled,new Yi({func:n.ALWAYS,mask:0},i,255,n.KEEP,n.KEEP,n.REPLACE),Zi.disabled,Qi.disabled,to(s.projMatrix),"$clipping",r,a,l)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,t=this.context.gl;return new Yi({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(e);const t=this.context.gl;return new Yi({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}stencilConfigForOverlap(e){const t=this.context.gl,i=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();const e={};for(let i=0;i<n;i++)e[i+r]=new Yi({func:t.GEQUAL,mask:255},i+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=n,[e,i]}return[{[r]:Yi.disabled},i]}colorModeForRenderPass(){const t=this.context.gl;if(this._showOverdrawInspector){const i=1/8;return new Zi([t.CONSTANT_COLOR,t.ONE,t.CONSTANT_COLOR,t.ONE],new e.ao(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?Zi.unblended:Zi.alphaBlended}colorModeForDrapableLayerRenderPass(t){const i=this.context.gl;return(()=>this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture)()&&"translucent"===this.renderPass?null!=t&&"mrt-fallback"!==this.emissiveMode||"constant"===this.emissiveMode?new Zi([i.ONE,i.ONE_MINUS_SRC_ALPHA,i.CONSTANT_ALPHA,i.ONE_MINUS_SRC_ALPHA],new e.ao(0,0,0,null!=t?t:0),[!0,!0,!0,!0]):"dual-source-blending"===this.emissiveMode?new Zi([i.ONE,i.ONE_MINUS_SRC_ALPHA,this.context.extBlendFuncExtended.SRC1_ALPHA_WEBGL,i.ONE_MINUS_SRC_ALPHA],e.ao.transparent,[!0,!0,!0,!0]):this.colorModeForRenderPass():this.colorModeForRenderPass()}depthModeForSublayer(e,t,i,r=!1){if(this.depthOcclusion)return new Wi(this.context.gl.GREATER,Wi.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!r)return Wi.disabled;const n=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Wi(i||this.context.gl.LEQUAL,t,[n,n])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const t=this.context.gl,i=Math.ceil(this.width),r=Math.ceil(this.height),n=this.context.bindFramebuffer.get(),o=t.getParameter(t.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===i&&this.depthFBO.height===r||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),0!==i&&0!==r&&(this.depthFBO=new Jo(this.context,i,r,0,"texture"),this.depthTexture=new e.T(this.context,{width:i,height:r,data:null},t.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(n),t.bindTexture(t.TEXTURE_2D,o),this.depthFBO&&(t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),t.blitFramebuffer(0,0,i,r,0,0,i,r,t.DEPTH_BUFFER_BIT,t.NEAREST),t.bindFramebuffer(t.FRAMEBUFFER,this.context.bindFramebuffer.current))}updateAverageFPS(){this._fpsHistory.push(0===this._dt?0:1e3/this._dt),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((e,t)=>e+t/this._fpsHistory.length,0))}render(t,i){const r=e.o.now();this._dt=r-this._timeStamp,this._timeStamp=r,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=t.map.repaint,this.style=t,this.options=i;const n=this.style._mergedLayers,o=!(!this.terrain||!this.terrain.enabled),s=()=>this.style._getOrder(o).filter(e=>{const t=n[e];return!(t.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[t.type]});let a=s(),l=!1,c=!1,h=null,u=0,d=!1;for(const e of a){const t=n[e];"none"!==t.visibility&&("circle"===t.type?l=!0:"building"===t.type?(h=t,++u):"symbol"===t.type&&(t.hasOcclusionOpacityProperties?c=!0:l=!0))}this.updateEmissiveMode();let p=a.map(e=>n[e]);const f=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(e.o.now()),this.imageManager.beginFrame();for(const e in f){const t=f[e];t.used&&(t.prepare(this.context),t.getSource().usedInConflation&&++u)}let m=!1;for(const e of p)e.isHidden(this.transform.zoom)||("clip"===e.type&&(m=!0),this.prepareLayer(e));const _={},g={},y={},x={},v={};for(const e in f){const t=f[e];_[e]=t.getVisibleCoordinates(),g[e]=_[e].slice().reverse(),y[e]=t.getVisibleCoordinates(!0).reverse(),x[e]=t.getShadowCasterCoordinates(),v[e]=t.sortCoordinatesByDistance(_[e])}const b=e=>{const t=this.style.getLayerSourceCache(e);return t&&t.used?t.getSource():null};if(u||m||this._clippingActiveLastFrame){const t=[],i=[];let r=0;for(const e of p)this.isSourceForClippingOrConflation(e,b(e))&&(t.push(e),i.push(r)),r++;if(t&&(m||t.length>1)||this._clippingActiveLastFrame){m=!1;const r=[];for(let n=0;n<t.length;n++){const o=t[n],s=i[n],a=this.style.getLayerSourceCache(o);if(!a||!a.used||!a.getSource().usedInConflation&&"clip"!==o.type&&"building"!==o.type)continue;let l=e.eQ,c=e.b_.None;const h=[];let u=!0;if("building"===o.type)l=e.eS;else if("clip"===o.type)if(l=s,o.isHidden(this.transform.zoom))u=!1;else{if(!o.layout){u=!1;continue}for(const t of o.layout.get("clip-layer-types"))c|="model"===t?e.b_.Model:"symbol"===t?e.b_.Symbol:e.b_.FillExtrusion;for(const e of o.layout.get("clip-layer-scope"))h.push(e);m=!0}u&&r.push({layer:o.fqid,cache:a,order:l,clipMask:c,clipScope:h})}this.replacementSource.setSources(r),d=!0}}this._clippingActiveLastFrame=m,d||this.replacementSource.clear(),this.conflationActive=d,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let e=0;e<p.length;e++){const t=p[e];if("none"===t.visibility)continue;const i=t.cutoffRange();if(this.longestCutoffRange=Math.max(i,this.longestCutoffRange),i>0){const e=b(t);e&&(this.minCutoffZoom=Math.max(e.minzoom,this.minCutoffZoom)),t.minzoom&&(this.minCutoffZoom=Math.max(t.minzoom,this.minCutoffZoom))}t.is3D(o)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=e),this._lastOcclusionLayer=e)}const w=this.style&&this.style.fog;w?(this._fogVisible=0!==w.getOpacity(this.transform.pitch),this._fogVisible&&"globe"!==this.transform.projection.name&&(this._fogVisible=w.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(y),this.opaquePassCutoff=0,a=s(),p=a.map(e=>n[e]));const T=this._shadowRenderer;if(T){T.updateShadowParameters(this.transform,this.style.directionalLight);for(const e in f)for(const t of _[e]){let e={min:0,max:0};this.terrain&&(e=this.terrain.getMinMaxForTile(t)||e),T.addShadowReceiver(t.toUnwrapped(),e.min,e.max)}}"globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new e.eR(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new Ws(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const S=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),E=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(S&&!this._snow&&(this._snow=new Aa(this)),!S&&this._snow&&(this._snow.destroy(),delete this._snow),E&&!this._rain&&(this._rain=new Ea(this)),!E&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),h){this.buildingTileBorderManager||(this.buildingTileBorderManager=new Xs);const e=this.style.getLayerSourceCache(h);this.buildingTileBorderManager.updateBorders(e,h)}if(!H.has(this.context.gl))return;this.renderPass="offscreen";for(const e of p){const i=t.getLayerSourceCache(e);if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const r=i?g[i.id]:void 0;("custom"===e.type||"raster"===e.type||"raster-particle"===e.type||e.isSky()||r&&r.length)&&this.renderLayer(this,i,e,r)}this.depthRangeFor3D=[0,1-(p.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,x)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const I="globe"===this.transform.projection.name||this.transform.isH
vendor: 4,691 bytes, line 2
2orizonVisible(),A=(()=>{if(i.showOverdrawInspector)return e.ao.black;const t=this.style.fog;if(t&&this.transform.projection.supportsFog){const i=this.style.getLut(t.scope);if(!I){const r="none"===t.properties.get("color-use-theme"),n=t.properties.get("color").toNonPremultipliedRenderColor(r?null:i).toArray01();return new e.ao(...n)}if(I){const r="none"===t.properties.get("space-color-use-theme"),n=t.properties.get("space-color").toNonPremultipliedRenderColor(r?null:i).toArray01();return new e.ao(...n)}}return e.ao.transparent})();if(this.context.clear({color:A,depth:1}),this.clearStencil(),this._showOverdrawInspector=i.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&I&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){const e=p[this.currentLayer],i=t.getLayerSourceCache(e);if(e.isSky())continue;const r=i?(e.is3D(o)?v:g)[i.id]:void 0;this._renderTileClippingMasks(e,i,r),this.renderLayer(this,i,e,r)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&I&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||e.aj(this.transform.zoom)>0)&&("globe"===this.transform.projection.name||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const e=p[this.currentLayer],i=t.getLayerSourceCache(e);e.isSky()&&this.renderLayer(this,i,e,i?g[i.id]:void 0)}function M(e,t){let i;return t&&(i=("symbol"===e.type?y:e.is3D(o)?v:g)[t.id]),i}if(this.renderPass="translucent","globe"===this.transform.projection.name){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<a.length;){const e=p[this.currentLayer];if("raster"===e.type||"raster-particle"===e.type){const i=t.getLayerSourceCache(e);this.renderLayer(this,i,e,M(e,i))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;const C=T?T.getGroundShadowLayerIndex():-1;let P=!1,R=-1;for(let e=0;e<a.length;++e){const t=p[e];t.isHidden(this.transform.zoom)||t.is3D(o)&&(R=e)}c&&-1===R&&(l=!0);let z=!1;for(;this.currentLayer<a.length;){const e=p[this.currentLayer],i=t.getLayerSourceCache(e);if(e.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(e)){if(e.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!z&&e.is3D(o)&&!o){const e=this.currentLayer,t=e=>{for(this.currentLayer=0;this.currentLayer<p.length;this.currentLayer++){const t=p[this.currentLayer];if(Pa[t.type]){const i=this.style.getLayerSourceCache(t);Pa[t.type](this,i,t,M(t,i),e)}}};t("initialize"),t("reset"),this.currentLayer=e,z=!0}if(l&&!P&&this.terrain&&!this.transform.isOrthographic&&(P=!0,this.blitDepth()),c&&-1!==R&&this.currentLayer===R+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(e,i,i?_[i.id]:void 0),this.renderLayer(this,i,e,M(e,i)),!this.terrain&&T&&this.currentLayer===C){{this.clearStencil(),this.resetStencilClippingMasks();const e=this.currentLayer;for(this.currentLayer=0;this.currentLayer<p.length;this.currentLayer++){const e=p[this.currentLayer];if(Ra[e.type]){const t=this.style.getLayerSourceCache(e);Ra[e.type](this,t,e,M(e,t))}}this.currentLayer=e}if(T.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){const e=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=e;this.currentLayer++){const e=p[this.currentLayer];if(!e.hasLightBeamPass())continue;const i=t.getLayerSourceCache(e);this.renderLayer(this,i,e,i?g[i.id]:void 0)}this.currentLayer=e,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const e=this.currentLayer;this.depthOcclusion=!0;for(const i of this.layersWithOcclusionOpacity){this.currentLayer=i;const e=p[this.currentLayer],r=t.getLayerSourceCache(e),n=r?g[r.id]:void 0;this.terrain||this._renderTileClippingMasks(e,r,r?_[r.id]:void 0),this.renderLayer(this,r,e,n)}this.depthOcclusion=!1,this.currentLayer=e,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let i=null;
2p.forEach(e=>{const r=t.getLayerSourceCache(e);r&&!e.isHidden(this.transform.zoom)&&r.getVisibleCoordinates().length&&(!i||i.getSource().maxzoom<r.getSource().maxzoom)&&(i=r)}),i&&this.options.showTileBoundaries&&Ds(this,i,i.getVisibleCoordinates(),e.ao.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&Ds(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new e.ao(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(e){const t=e.transform.padding;Fs(e,e.transform.height-(t.top||0),3,Cs),Fs(e,t.bottom||0,3,Ps),ks(e,t.left||0,3,Rs),ks(e,e.transform.width-(t.right||0),3,zs);const i=e.transform.centerPoint;!function(e,t,i,r){Bs(e,t-1,i-10,2,20,r),Bs(e,t-10,i-1,20,2,r)}(e,i.x,e.transform.height-i.y,Ls)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveCanvasCopy()),d||(this.conflationActive=!1)}prepareLayer(e){this.gpuTimingStart(e);const{unsupportedLayers:t}=this.transform.projection,i=!t||!t.includes(e.type);if(Ca[e.type]&&(i||this.terrain&&"custom"===e.type)){const t=this.style.getLayerSourceCache(e);Ca[e.type](e,t,this)}this.gpuTimingEnd()}renderLayer(e,t,i,r){i.isHidden(this.transform.zoom)||("background"===i.type||"sky"===i.type||"custom"===i.type||"model"===i.type||"raster"===i.type||"raster-particle"===i.type||r&&r.length)&&(this.id=i.id,this.gpuTimingStart(i),e.transform.projection.unsupportedLayers&&e.transform.projection.unsupportedLayers.includes(i.type)&&(!e.terrain||"custom"!==i.type)||"clip"===i.type||Ma[i.type](e,t,i,r,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(e){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery,i=this.context.gl;let r=this.gpuTimers[e.id];r||(r=this.gpuTimers[e.id]={calls:0,cpuTime:0,query:i.createQuery()}),r.calls++,i.beginQuery(t.TIME_ELAPSED_EXT,r.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const e=this.context.extTimerQuery,t=this.context.gl,i=t.createQuery();this.deferredRenderGpuTimeQueries.push(i),t.beginQuery(e.TIME_ELAPSED_EXT,i)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){const e=this.gpuTimers;return this.gpuTimers={},e}collectDeferredRenderGpuQueries(){const e=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],e}queryGpuTimers(e){const t={};for(const i in e){const r=e[i],n=this.context.extTimerQuery,o=n.getQueryParameter(r.query,this.context.gl.QUERY_RESULT)/1e6;n.deleteQueryEXT(r.query),t[i]=o}return t}queryGpuTimeDeferredRender(e){if(!this.options.gpuTimingDeferredRender)return 0;const t=this.context.gl;let i=0;for(const r of e)i+=t.getQueryParameter(r,t.QUERY_RESULT)/1e6,t.deleteQuery(r);return i}translatePosMatrix(t,i,r,n,o){if(!r[0]&&!r[1])return t;const s=o?"map"===n?this.transform.angle:0:"viewport"===n?-this.transform.angle:0;if(s){const e=Math.sin(s),t=Math.cos(s);r=[r[0]*t-r[1]*e,r[0]*e+r[1]*t]}const a=[o?r[0]:e.ay(i,r[0],this.transform.zoom),o?r[1]:e.ay(i,r[1],this.transform.zoom),0],l=new Float32Array(16);return e.br(l,t,a),l}saveTileTexture(e){if(e.context!==this.context)return;const t=e.size[0],i=this._tileTextures[t];i?i.push(e):this._tileTextures[t]=[e]}getTileTexture(e){const t=this._tileTextures[e];return t&&t.length>0?t.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return null!=this.context.extTextureFloatLinear}currentGlobalDefines(e,t,i){const r=void 0===i?this.terrain&&this.terrain.renderingToTexture:i,n=[];return this.style&&this.style.enable3dLights()&&("globeRaster"===e||"terrainRaster"===e?(n.push("LIGHTING_3D_MODE"),n.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):r||n.push("LIGHTING_3D_MODE")),"shadow"===this.renderPass&&(this._shadowMapDebug||n.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(n.push("TERRAIN"),this.linearFloatFilteringSupported()&&n.push("TERRAIN_DEM_FLOAT_FORMAT")),"globe"===this.transform.projection.name&&n.push("GLOBE"),!this._fogVisible||r||void 0!==t&&!t||n.push("FOG"),r&&n.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&n.push("OVERDRAW_INSPECTOR"),n}getOrCreateProgram(e,t){this.cache=this.cache||{};const i=t&&t.defines||[],r=t&&t.config,n=this.currentGlobalDefines(e,t&&t.overrideFog,t&&t.overrideRtt).concat(i),o=ho.cacheKey(tn[e],e,n,r);return this.cache[o]||(this.cache[o]=new ho(this.context,e,tn[e],r,Wo[e],n)),this.cache[o]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new e.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.de
vendor: 4,596 bytes, line 2
2stroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(t,i){if(this.style.enable3dLights()){const r=this.style.directionalLight,n=this.style.ambientLight;if(r&&n){const o=((t,i,r)=>{const n=t.properties.get("direction"),o="none"===t.properties.get("color-use-theme"),s=t.properties.get("color").toNonPremultipliedRenderColor(o?null:r.getLut(t.scope)).toArray01(),a=t.properties.get("intensity"),l="none"===i.properties.get("color-use-theme"),c=i.properties.get("color").toNonPremultipliedRenderColor(l?null:r.getLut(i.scope)).toArray01(),h=i.properties.get("intensity"),u=[n.x,n.y,n.z],d=e.dN(c,h),p=e.dN(s,a);return{u_lighting_ambient_color:d,u_lighting_directional_dir:u,u_lighting_directional_color:p,u_ground_radiance:ao(u,p,d)}})(r,n,this.style);i.setLightsUniformValues(t,o)}}}uploadCommonUniforms(t,i,r,n,o){if(this.uploadCommonLightUniforms(t,i),this.terrain&&this.terrain.renderingToTexture)return;const s=this.style.fog;if(s){const o=s.getOpacity(this.transform.pitch),a=((t,i,r,n,o,s,a,l,c,h,u,d)=>{const p=t.transform,f="none"===i.properties.get("color-use-theme"),m=i.properties.get("color").toNonPremultipliedRenderColor(f?null:t.style.getLut(i.scope)).toArray01();m[3]=n;const _=t.frameCounter/1e3%1,[g,y]=i.properties.get("vertical-range");return{u_fog_matrix:r?p.calculateFogTileMatrix(r):d||t.identityMat,u_fog_range:i.getFovAdjustedRange(p._fov),u_fog_color:m,u_fog_horizon_blend:i.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(g,y),y],u_fog_temporal_offset:_,u_frustum_tl:o,u_frustum_tr:s,u_frustum_br:a,u_frustum_bl:l,u_globe_pos:c,u_globe_radius:h,u_viewport:u,u_globe_transition:e.aj(p.zoom),u_is_globe:+("globe"===p.projection.name)}})(this,s,r,o,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*e.o.devicePixelRatio,this.transform.height*e.o.devicePixelRatio],n);i.setFogUniformValues(t,a)}o&&i.setCutoffUniformValues(t,o.uniformValues)}setTileLoadedFlag(e){this.tileLoaded=e}saveCanvasCopy(){const e=this.canvasCopy();e&&(this.frameCopies.push(e),this.tileLoaded=!1)}canvasCopy(){const e=this.context.gl,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,0,0,e.drawingBufferWidth,e.drawingBufferHeight,0),t}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const e=this.style&&this.style.fog;return!!e&&0!==e.getOpacity(this.transform.pitch)}getBackgroundTiles(){const e=this._backgroundTiles,t=this._backgroundTiles={},i=this.transform.coveringTiles({tileSize:512});for(const r of i)t[r.key]=e[r.key]||new zt(r,512,this.transform.tileZoom,this,void 0,this.worldview);return t}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(e,t){return!(!e.is3D(!(!this.terrain||!this.terrain.enabled))||"clip"!==e.type&&"building"!==e.type&&(e.minzoom&&e.minzoom>this.transform.zoom||(this.style._clipLayerPresent||"building"!==e.sourceLayer&&"procedural_buildings"!==e.sourceLayer)&&(!t||"batched-model"!==t.type)))}isTileAffectedByFog(e){if(!this.style||!this.style.fog)return!1;if("globe"===this.transform.projection.name)return!0;let t=this._cachedTileFogOpacities[e.key];return t||(this._cachedTileFogOpacities[e.key]=t=this.style.fog.getOpacityForTile(e)),t[0]>=je||t[1]>=je}setupDepthForOcclusion(e,t,i){const r=this.context,n=r.gl,o=!!i;var s;i||(i={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),r.activeTexture.set(n.TEXTURE3),e&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(n.NEAREST,n.CLAMP_TO_EDGE),i.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],i.u_depth_range_unpack=[2/((s=this.depthRangeFor3D)[1]-s[0]),-1-2*s[0]/(s[1]-s[0])],i.u_occluder_half_size=.5*this.occlusionParams.occluderSize,i.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.empty
vendor: 8,047 bytes, line 2
2DepthTexture.bind(n.NEAREST,n.CLAMP_TO_EDGE),r.activeTexture.set(n.TEXTURE0),o||t.setTerrainUniformValues(r,i)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const e=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=e?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function La(e,t){let i=!1,r=null;const n=()=>{r=null,i&&(e(),r=setTimeout(n,t),i=!1)};return()=>(i=!0,r||n(),r)}class Da{constructor(t){this._hashName=t&&encodeURIComponent(t),e.aY(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=La(this._updateHashUnthrottled.bind(this),300)}addTo(e){return this._map=e,window.addEventListener("hashchange",this._onHashChange,!1),e.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const e=this._map;if(!e)return"";const t=Oa(e);if(this._hashName){const e=this._hashName;let i=!1;const r=location.hash.slice(1).split("&").map(r=>{const n=r.split("=")[0];return n===e?(i=!0,`${n}=${t}`):r}).filter(e=>e);return i||r.push(`${e}=${t}`),`#${r.join("&")}`}return`#${t}`}_getCurrentHash(){const e=location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map(e=>e.split("=")).forEach(e=>{e[0]===this._hashName&&(t=e)}),(t&&t[1]||"").split("/")}return e.split("/")}_onHashChange(){const e=this._map;if(!e)return!1;const t=this._getCurrentHash();if(t.length>=3&&!t.some(e=>isNaN(Number(e)))){const i=e.dragRotate.isEnabled()&&e.touchZoomRotate.isEnabled()?+(t[3]||0):e.getBearing();return e.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:i,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function Oa(e,t){const i=e.getCenter(),r=Math.round(100*e.getZoom())/100,n=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,n),s=Math.round(i.lng*o)/o,a=Math.round(i.lat*o)/o,l=e.getBearing(),c=e.getPitch();let h=t?`/${s}/${a}/${r}`:`${r}/${a}/${s}`;return(l||c)&&(h+="/"+Math.round(10*l)/10),c&&(h+=`/${Math.round(c)}`),h}const Fa={linearity:.3,easing:e.eT(0,0,.3,1)},ka=Object.assign({deceleration:2500,maxSpeed:1400},Fa),Ba=Object.assign({deceleration:20,maxSpeed:1400},Fa),Na=Object.assign({deceleration:1e3,maxSpeed:360},Fa),Va=Object.assign({deceleration:1e3,maxSpeed:90},Fa);class Ua{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:e.o.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,i=e.o.now();for(;t.length>0&&i-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion())return;if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:e}of this._inertiaBuffer)i.zoom+=e.zoomDelta||0,i.bearing+=e.bearingDelta||0,i.pitch+=e.pitchDelta||0,e.panDelta&&i.pan._add(e.panDelta),e.around&&(i.around=e.around),e.pinchAround&&(i.pinchAround=e.pinchAround);const r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(i.pan.mag()){const e=Ga(i.pan.mag(),r,Object.assign({},ka,t||{}));n.offset=i.pan.mult(e.amount/i.pan.mag()),n.center=this._map.transform.center,ja(n,e)}if(i.zoom){const e=Ga(i.zoom,r,Ba);n.zoom=this._map.transform.zoom+e.amount,ja(n,e)}if(i.bearing){const t=Ga(i.bearing,r,Na);n.bearing=this._map.transform.bearing+e.aA(t.amount,-179,179),ja(n,t)}if(i.pitch){const e=Ga(i.pitch,r,Va);n.pitch=this._map.transform.pitch+e.amount,ja(n,e)}if(n.zoom||n.bearing){const e=void 0===i.pinchAround?i.around:i.pinchAround;n.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),n.noMoveStart=!0,n}}function ja(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function Ga(t,i,r){const{maxSpeed:n,linearity:o,deceleration:s}=r,a=e.aA(t*o/(i/1e3),-n,n),l=Math.abs(a)/(s*o);return{easing:r.easing,duration:1e3*l,amount:a*(l/2)}}class qa extends e.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i,r={}){const n=g(t.getCanvasContainer(),i),o=t.unproject(n);super(e,Object.assign({point:n,lngLat:o,originalEvent:i},r)),this._defaultPrevented=!1,this.target=t}}class Ha extends e.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,r){const n="touchend"===t?r.changedTouches:r.touches,o=y(i.getCanvasContainer(),n),s=o.map(e=>i.unproject(e)),a=o.reduce((e,t,i,r)=>e.add(t.div(r.length)),new e.P(0,0));super(t,{points:o,point:a,lngLats:s,lngLat:i.unproject(a),originalEvent:r}),this._defaultPrevented=!1}}class $a extends e.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t){super("wheel",{originalEvent:t}),this._defaultPrevented=!1}}class Za{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){this._mousedownPos=void 0}wheel(e){return this._firePreventable(new $a(this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new qa(e.type,this._map,e))}mouseup(e){this._map.fire(new qa(e.type,this._map,e))}preclick(e){const t=new MouseEvent("preclick",e);this._map.fire(new qa(t.type,this._map,t))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||(this.preclick(e),this._map.fire(new qa(e.type,this._map,e)))}dblclick(e){return this._firePreventable(new qa(e.type,this._map,e))}mouseover(e){this._map.fire(new qa(e.type,this._map,e))}mouseout(e){this._map.fire(new qa(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Ha(e.type,this._map,e))}touchmove(e){this._map.fire(new Ha(e.type,this._map,e))}touchend(e){this._map.fire(new Ha(e.type,this._map,e))}touchcancel(e){this._map.fire(new Ha(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Wa{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(e){this._map.fire(new qa(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new qa("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new qa(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Xa{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&&(p(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;const i=t,r=this._startPos,n=this._lastPos;if(!r||!n||n.equals(i)||!this._box&&i.dist(r)<this._clickTolerance)return;this._lastPos=i,this._box||(this._box=l("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",e));const o=Math.min(r.x,i.x),s=Math.max(r.x,i.x),a=Math.min(r.y,i.y),c=Math.max(r.y,i.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${o}px,${a}px)`,this._box.style.width=s-o+"px",this._box.style.height=c-a+"px")})}mouseupWindow(t,i){if(!this._active)return;const r=this._startPos,n=i;if(r&&0===t.button){if(this.reset(),_(),r.x!==n.x||r.y!==n.y)return this._map.fire(new e.z("boxzoomend",{originalEvent:t})),{cameraAnimation:e=>e.fitScreenCoordinates(r,n,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}
vendor: 5,101 bytes, line 2
2keydown(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),f(),delete this._startPos,delete this._lastPos}_fireEvent(t,i){return this._map.fire(new e.z(t,{originalEvent:i}))}}function Ya(e,t){const i={};for(let r=0;r<e.length;r++)i[e[r].identifier]=t[r];return i}class Ka{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(t,i,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=t.timeStamp),r.length===this.numTouches&&(this.centroid=function(t){const i=new e.P(0,0);for(const e of t)i._add(e);return i.div(t.length)}(i),this.touches=Ya(r,i)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;const r=Ya(i,t);for(const n in this.touches){const e=r[n];(!e||e.dist(this.touches[n])>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 Ja{constructor(e){this.singleTap=new Ka(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){const r=this.singleTap.touchend(e,t,i);if(r){const t=e.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(r)<30;if(t&&i||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class Qa{constructor(){this._zoomIn=new Ja({numTouches:1,numTaps:2}),this._zoomOut=new Ja({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){const r=this._zoomIn.touchend(e,t,i),n=this._zoomOut.touchend(e,t,i);return r?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()+1,around:t.unproject(r)},{originalEvent:e})}):n?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()-1,around:t.unproject(n)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const el=0,tl=2,il={[el]:1,[tl]:2},rl={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class nl{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=x(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=il[t];return void 0===e.buttons||(e.buttons&i)!==i}(e,this._eventButton))this.reset();else if(this._moved||!(t.dist(i)<this._clickTolerance))return this._moved=!0,this._lastPoint=t,this._move(i,t)}mouseupWindow(e){this._lastPoint&&x(e)===this._eventButton&&(this._moved&&_(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ol extends nl{mousedown(e,t){super.mousedown(e,t),this._lastPoint&&(this._active=!0)}_correctButton(e,t){return 0===t&&!e.ctrlKey}_move(e,t){return{around:t,panDelta:t.sub(e)}}}class sl extends nl{constructor(e){super(e),this._pitchRotateKey=e.pitchRotateKey?rl[e.pitchRotateKey]:void 0}_correctButton(e,t){return this._pitchRotateKey?0===t&&e[this._pitchRotateKey]:0===t&&e.ctrlKey||2===t}_move(e,t){const i=.8*(t.x-e.x);if(i)return this._active=!0,{bearingDelta:i}}contextmenu(e){this._pitchRotateKey||e.preventDefault()}}class al extends nl{constructor(e){super(e),this._pitchRotateKey=e.pitchRotateKey?rl[e.pitchRotateKey]:void 0}_correctButton(e,t){return this._pitchRotateKey?0===t&&e[this._pitchRotateKey]:0===t&&e.ctrlKey||2===t}_move(e,t){const i=-.5*(t.y-e.y);if(i)return this._active=!0,{pitchDelta:i}}contextmenu(e){this._pitchRotateKey||e.preventDefault()}}class ll{constructor(t,i){this._map=t,this._el=t.getCanvasContainer(),this._minTouches=1,this._clickTolerance=i.clickTolerance||1,this.reset(),e.aY(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new e.P(0,0)}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(t,i,r){if(this._active&&!(r.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(1===r.length&&!e.eU())return void this._showTouchPanBlockerAlert();
vendor: 4,238 bytes, line 2
2"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return t.cancelable&&t.preventDefault(),this._calculateTransform(t,i,r)}}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&i.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,i,r){r.length>0&&(this._active=!0);const n=Ya(r,i),o=new e.P(0,0),s=new e.P(0,0);let a=0;for(const e in n){const t=n[e],i=this._touches[e];i&&(o._add(t),s._add(t.sub(i)),a++,n[e]=t)}if(this._touches=n,a<this._minTouches||!s.mag())return;const l=s.div(a);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(a),panDelta:l}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=l("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class cl{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(e){}_move(e,t,i){return{}}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){const r=this._firstTwoTouches;if(!r)return;e.preventDefault();const[n,o]=r,s=hl(i,t,n),a=hl(i,t,o);if(!s||!a)return;const l=this._aroundCenter?null:s.add(a).div(2);return this._move([s,a],l,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;const[r,n]=this._firstTwoTouches,o=hl(i,t,r),s=hl(i,t,n);o&&s||(this._active&&_(),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 hl(e,t,i){for(let r=0;r<e.length;r++)if(e[r].identifier===i)return t[r]}function ul(e,t){return Math.log2(e/t)}class dl extends cl{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){const i=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(ul(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:ul(this._distance,i),pinchAround:t}}}function pl(e,t){return 180*e.angleWith(t)/Math.PI}class fl extends cl{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t){const i=this._vector;if(this._vector=e[0].sub(e[1]),i&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:pl(this._vector,i),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const t=25/(Math.PI*this._minDiameter)*360,i=this._startVector;if(!i)return!1;const r=pl(e,i);return Math.abs(r)<t}}function ml(e){return Math.abs(e.y)>Math.abs(e.x)}class _l extends cl{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,ml(e[0].sub(e[1]))&&(this._valid=!1)}_move(t,i,r){const n=this._lastPoints;if(!n)return;const o=t[0].sub(n[0]),s=t[1].sub(n[1]);return this._map._cooperativeGestures&&!e.eU()&&r.touches.length<3||(this._val
vendor: 5,087 bytes, line 2
2id=this.gestureBeginsVertically(o,s,r.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(o.y+s.y)/2*-.5})}gestureBeginsVertically(e,t,i){if(void 0!==this._valid)return this._valid;const r=e.mag()>=2,n=t.mag()>=2;if(!r&&!n)return;if(!r||!n)return null==this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=e.y>0==t.y>0;return ml(e)&&ml(t)&&o}}const gl={panStep:100,bearingStep:15,pitchStep:10};class yl{constructor(){const e=gl;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,r=0,n=0,o=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),n=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),n=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:s=>{const a=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:xl,zoom:t?Math.round(a)+t*(e.shiftKey?2:1):a,bearing:s.getBearing()+i*this._bearingStep,pitch:s.getPitch()+r*this._pitchStep,offset:[-n*this._panStep,-o*this._panStep],center:s.getCenter()},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function xl(e){return e*(2-e)}const vl=4.000244140625,bl=1/450;class wl{constructor(t,i){this._map=t,this._el=t.getCanvasContainer(),this._handler=i,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=bl,e.aY(["_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.eU()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let i=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const r=e.o.now(),n=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==i&&i%vl===0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=i,this._timeout=window.setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(n*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),t.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=t,this._delta-=i,this._active||this._start(t)),t.preventDefault()}_onTimeout(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const t=g(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)>vl?this._wheelZoomRate:this._defaultZoomRate;let r=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==r&&(r=1/r);const n=i(),o=Math.pow(2,n),s="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):o;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(s*r))),"wheel"===this._type&&(this._startZoom=n,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const r="number"==typeof this._targetZoom?this._targetZoom:i(),n=this._startZoom,o=this._easing;let s,a=!1;if("wheel"===this._type&&n&&o){const t=Math.min((e.o.now()-this._lastWheelEventTime)/200,1),i=o(t);s=e.ak(n,r,i),t<1?this._frameId||(this._frameId=!0):a=!0}else s=r,a=!0;this._active=!0,a&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>
vendor: 8,970 bytes, line 2
2{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let l=s-i();return l*this._lastDelta<0&&(l=0),{noInertia:!0,needsRenderFrame:!a,zoomDelta:l,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let i=e.eV;if(this._prevEase){const t=this._prevEase,r=(e.o.now()-t.start)/t.duration,n=t.easing(r+.01)-t.easing(r),o=.27/Math.sqrt(n*n+1e-4)*.01,s=Math.sqrt(.0729-o*o);i=e.eT(o,s,.25,1)}return this._prevEase={start:e.o.now(),duration:t,easing:i},i}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=l("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class Tl{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 Sl{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 El{constructor(){this._tap=new Ja({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(e,t,i){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=t[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(e,t,i))}touchmove(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const r=t[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(e,t,i)}touchend(e,t,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(e,t,i)&&(this._tapTime=e.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Il{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 Al{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 Ml{constructor(e,t,i,r){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Cl=e=>e.zoom||e.drag||e.pitch||e.rotate;class Pl extends e.z{}class Rl{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,i){const r=e.av([],i,t);this.radius=e.ag(r[2]<0?e.eX([],r,this.constants):[r[0],r[1],0])}projectRay(t){e.eX(t,t,this.constants),e.aw(t,t),e.eY(t,t,this.constants);const i=e.c5([],t,this.radius);if(i[2]>0){const t=e.c5([],[0,0,1],e.bJ(i,[0,0,1])),r=e.c5([],e.aw([],[i[0],i[1],0]),this.radius),n=e.d8([],i,e.c5([],e.av([],e.d8([],r,t),i),2));i[0]=n[0],i[1]=n[1]}return i}}function zl(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class Ll{constructor(t,i){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ua(t),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Rl,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(i),e.aY(["handleEvent","handleWindowEvent"],this);const r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[window,"blur",void 0]];for(const[e,n,o]of this._listeners){const t=e===document?this.handleWindowEvent:this.handleEvent;e.addEventListener(n,t,o)}}destroy(){for(const[e,t,i]of this._listeners){const r=e===document?this.handleWindowEvent:this.handleEvent;e.removeEventListener(t,r,i)}}_addDefaultHandlers(e){const t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new Za(t,e));const r=t.boxZoom=new Xa(t,e);this._add("boxZoom",r);const n=new Qa,o=new Sl;t.doubleClickZoom=new Tl(o,n),this._add("tapZoom",n),this._add("clickZoom",o);const s=new El;this._add("tapDragZoom",s);const a=t.touchPitch=new _l(t);this._add("touchPitch",a);const l=new sl(e),c=new al(e);t.dragRotate=new Al(e,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const h=new ol(e),u=new ll(t,e);t.dragPan=new Il(i,h,u),this._add("mousePan",h),this._add("touchPan",u,["touchZoom","touchRotate"]);const d=new fl,p=new dl;t.touchZoomRotate=new Ml(i,p,d,s),this._add("touchRotate",d,["touchPan","touchZoom"]),this._add("touchZoom",p,["touchPan","touchRotate"]),this._add("blockableMapEvent",new Wa(t));const f=t.scrollZoom=new wl(t,this);this._add("scrollZoom",f,["mousePan"]);const m=t.keyboard=new yl;this._add("keyboard",m);for(const _ of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])e.interactive&&e[_]&&t[_].enable(e[_])}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(const{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Cl(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(e,t,i){for(const r in e)if(r!==i&&(!t||t.indexOf(r)<0))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`)}_getMapTouches(e){const t=[];for(const i of e)this._el.contains(i.target)&&t.push(i);return t}handleEvent(e,t){this._updatingCamera=!0;const i="renderFrame"===e.type,r=i?void 0:e,n={needsRenderFrame:!1},o={},s={},a=e.touches?this._getMapTouches(e.touches):void 0,l=a?y(this._el,a):i?void 0:g(this._el,e);for(const{handlerName:u,handler:d,allowed:p}of this._handlers){if(!d.isEnabled())continue;let i;this._blockedByActive(s,p,u)?d.reset():d[t||e.type]&&(i=d[t||e.type](e,l,a),this.mergeHandlerResult(n,o,i,u,r),i&&i.needsRenderFrame&&this._triggerRe
vendor: 4,116 bytes, line 2
2nderFrame()),(i||d.isActive())&&(s[u]=d)}const c={};for(const u in this._previousActiveHandlers)s[u]||(c[u]=r);this._previousActiveHandlers=s,(Object.keys(c).length||zl(n))&&(this._changes.push([n,o,c]),this._triggerRenderFrame()),(Object.keys(s).length||zl(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:h}=n;h&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],h(this._map))}mergeHandlerResult(e,t,i,r,n){if(!i)return;Object.assign(e,i);const o={handlerName:r,originalEvent:i.originalEvent||n};void 0!==i.zoomDelta&&(t.zoom=o),void 0!==i.panDelta&&(t.drag=o),void 0!==i.pitchDelta&&(t.pitch=o),void 0!==i.bearingDelta&&(t.rotate=o)}_applyChanges(){const t={},i={},r={};for(const[n,o,s]of this._changes)n.panDelta&&(t.panDelta=(t.panDelta||new e.P(0,0))._add(n.panDelta)),n.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+n.pitchDelta),void 0!==n.around&&(t.around=n.around),void 0!==n.aroundCoord&&(t.aroundCoord=n.aroundCoord),void 0!==n.pinchAround&&(t.pinchAround=n.pinchAround),n.noInertia&&(t.noInertia=n.noInertia),Object.assign(i,o),Object.assign(r,s);this._updateMapTransform(t,i,r),this._changes=[]}_updateMapTransform(t,i,r){const n=this._map,o=n.transform,s=e=>[e.x,e.y,e.z];if((()=>{const e=this._eventsInProgress.drag;return e&&!this._handlersById[e.handlerName].isActive()})()&&!zl(t)){const e=o.zoom;o.cameraElevationReference="sea",null!=this._originalZoom&&o._orthographicProjectionAtLowPitch&&"globe"!==o.projection.name&&0===o.pitch?(o.cameraElevationReference="ground",o.zoom=this._originalZoom):(o.recenterOnTerrain(),o.cameraElevationReference="ground"),e!==o.zoom&&this._map._update(!0)}if(o._isCameraConstrained&&n._stop(!0),!zl(t))return void this._fireEvents(i,r,!0);let{panDelta:a,zoomDelta:l,bearingDelta:c,pitchDelta:h,around:u,aroundCoord:d,pinchAround:p}=t;o._isCameraConstrained&&(l>0&&(l=0),o._isCameraConstrained=!1),void 0!==p&&(u=p),(l||(e=>i[e]&&!this._eventsInProgress[e])("drag"))&&u&&(this._dragOrigin=s(o.pointCoordinate3D(u)),this._originalZoom=o.zoom,this._trackingEllipsoid.setup(o._camera.position,this._dragOrigin)),o.cameraElevationReference="sea",n._stop(!0),u=u||n.transform.centerPoint,c&&(o.bearing+=c),h&&(o.pitch+=h),o._updateCameraState();const f=[0,0,0];if(a)if("mercator"===o.projection.name){const e=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(u).dir),t=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(u.sub(a)).dir);f[0]=t[0]-e[0],f[1]=t[1]-e[1]}else{const t=o.pointCoordinate(u);if("globe"===o.projection.name){a=a.rotate(-o.angle);const i=o._pixelsPerMercatorPixel/o.worldSize;f[0]=-a.x*e.eW(e.a$(t.y))*i,f[1]=-a.y*e.eW(o.center.lat)*i}else{const e=o.pointCoordinate(u.sub(a));t&&e&&(f[0]=e.x-t.x,f[1]=e.y-t.y)}}const m=o.zoom,_=[0,0,0];if(l){const t=s(d||o.pointCoordinate3D(u)),i={dir:e.aw([],e.av([],t,o._camera.position))};if(i.dir[2]<0){const r=o.zoomDeltaToMovement(t,l);e.c5(_,i.dir,r)}}const g=e.d8(f,f,_);o._translateCameraConstrained(g),l&&Math.abs(o.zoom-m)>1e-4&&o.recenterOnTerrain(),o.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(i,r,!0)}_fireEvents(t,i,r){const n=Cl(this._eventsInProgress),o=Cl(t),s={};for(const e in t){const{originalEvent:i}=t[e];this._eventsInProgress[e]||(s[`${e}start`]=i),this._eventsInProgress[e]=t[e]}!n&&o&&this._fireEvent("movestart",o.originalEvent);for(const e in s)this._fireEvent(e,s[e]);o&&this._fireEvent("move",o.originalEvent);for(const e in t){const{originalEvent:i}=t[e];this._fireEvent(e,i)}const a={};let l;for(const e in this._eventsInProgress){const{handlerName:t,originalEvent:r}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],l=i[t]||r,a[`${e}end`]=l)}for(const e in a)this._fireEvent(e,a[e]);const c=Cl(this._eventsInProgress);if(r&&(n||o)&&!c){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=e=>0!==e&&-this._bearingSnap<e&&e<this._bearingSnap;
2t?(i(t.bearing||this._map.getBearing())&&(t.bearing=0),this._map.easeTo(t,{originalEvent:l})):(this._map.fire(new e.z("moveend",{originalEvent:l})),i(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,i){this._map.fire(new e.z(t,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{this._frameId=void 0,this.handleEvent(new Pl("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const Dl="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class Ol extends e.E{constructor(t,i){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=i.bearingSnap,this._respectPrefersReducedMotion=!1!==i.respectPrefersReducedMotion,e.aY(["_renderFrameCallback"],this)}getCenter(){return new e.aT(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}panBy(t,i,r){return t=e.P.convert(t).mult(-1),this.panTo(this.transform.center,Object.assign({offset:t},i),r)}panTo(e,t,i){return this.easeTo(Object.assign({center:e},t),i)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,t,i){return this.easeTo(Object.assign({zoom:e},t),i)}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(e,t,i){return this.easeTo(Object.assign({bearing:e},t),i)}resetNorth(e,t){return this.rotateTo(0,Object.assign({duration:1e3},e),t),this}resetNorthPitch(e,t){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},e),t),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}cameraForBounds(t,i){t=e.aI.convert(t);const r=i&&i.bearing||0,n=i&&i.pitch||0,o=t.getNorthWest(),s=t.getSouthEast();return this._cameraForBounds(this.transform,o,s,r,n,i)}_extendPadding(e){const t={top:0,right:0,bottom:0,left:0};return null==e?Object.assign({},t,this.transform.padding):"number"==typeof e?{top:e,bottom:e,right:e,left:e}:Object.assign({},t,e)}_extendCameraOptions(e){return(e=Object.assign({offset:[0,0],maxZoom:this.transform.maxZoom},e)).padding=this._extendPadding(e.padding),e}_minimumAABBFrustumDistance(e,t){const i=t.max[0]-t.min[0],r=t.max[1]-t.min[1];return i/r>e.aspect?i/(2*Math.tan(.5*e.fovX)*e.aspect):r/(2*Math.tan(.5*e.fovY)*e.aspect)}_cameraForBoundsOnGlobe(t,i,r,n,o,s){const a=t.clone(),l=this._extendCameraOptions(s);a.bearing=n,a.pitch=o;const c=e.aT.convert(i),h=e.aT.convert(r),u=.5*(c.lat+h.lat),d=.5*(c.lng+h.lng),p=e.eZ(u,d),f=e.aw([],p),m=e.aw([],e.bI([],f,[0,1,0])),_=e.bI([],m,f),g=[m[0],m[1],m[2],0,_[0],_[1],_[2],0,f[0],f[1],f[2],0,0,0,0,1],y=[p,e.eZ(c.lat,c.lng),e.eZ(h.lat,c.lng),e.eZ(h.lat,h.lng),e.eZ(c.lat,h.lng),e.eZ(u,c.lng),e.eZ(u,h.lng),e.eZ(c.lat,d),e.eZ(h.lat,d)];let x=e.d9.fromPoints(y.map(t=>[e.bJ(m,t),e.bJ(_,t),e.bJ(f,t)]));const v=e.af([],x.center,g);0===e.e_(v)&&e.e$(v,0,0,1),e.aw(v,v),e.c5(v,v,e.aD),a.center=e.f0(v);const b=a.getWorldToCameraMatrix(),w=e.bl(new Float64Array(16),b);x=e.d9.applyTransform(x,e.aB([],b,g));
vendor: 4,553 bytes, line 2
2const T=this._extendAABB(x,a,l,n);if(!T)return void e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");x=T,e.af(v,v,b);const S=.5*(x.max[2]-x.min[2]),E=this._minimumAABBFrustumDistance(a,x),I=e.c5([],[0,0,1],S),A=e.d8(I,v,I),M=E+(0===a.pitch?0:e.bG(v,A)),C=a.globeCenterInViewSpace,P=e.av([],v,[C[0],C[1],C[2]]);e.aw(P,P),e.c5(P,P,M);const R=e.d8([],v,P);e.af(R,R,w);const z=e.eM/e.aD,L=e.ag(R),D=e.cf(Math.max(L*z-e.eM,Number.EPSILON),0),O=Math.min(a.zoomFromMercatorZAdjusted(D),l.maxZoom);return O>.5*(e.c_+e.cL)?(a.setProjection({name:"mercator"}),a.zoom=O,this._cameraForBounds(a,i,r,n,o,s)):{center:a.center,zoom:O,bearing:n,pitch:o}}_extendAABB(t,i,r,n){const o=.5*((r.padding.left||0)+(r.padding.right||0)),s=.5*((r.padding.top||0)+(r.padding.bottom||0)),a=s,l=o,c=o,h=s,u=i.width-(l+c),d=i.height-(a+h),p=e.av([],t.max,t.min),f=Math.min(u/p[0],d/p[1]),m=Math.min(i.scaleZoom(i.scale*f),r.maxZoom);if(isNaN(m))return null;const _=i.scale/i.zoomScale(m),g=new e.d9([t.min[0]-l*_,t.min[1]-h*_,t.min[2]],[t.max[0]+c*_,t.max[1]+a*_,t.max[2]]),y=("number"==typeof r.offset.x&&"number"==typeof r.offset.y?new e.P(r.offset.x,r.offset.y):e.P.convert(r.offset)).rotate(-e.an(n));return g.center[0]-=y.x*_,g.center[1]+=y.y*_,g}queryTerrainElevation(t,i){const r=this.transform.elevation;return r?(i=Object.assign({},{exaggerated:!0},i),r.getAtPoint(e.ae.fromLngLat(t),null,i.exaggerated)):null}_cameraForBounds(t,i,r,n,o,s){if("globe"===t.projection.name)return this._cameraForBoundsOnGlobe(t,i,r,n,o,s);const a=t.clone(),l=this._extendCameraOptions(s);a.bearing=n,a.pitch=o;const c=e.aT.convert(i),h=e.aT.convert(r),u=new e.aT(c.lng,h.lat),d=new e.aT(h.lng,c.lat),p=a.project(c),f=a.project(h),m=this.queryTerrainElevation(c),_=this.queryTerrainElevation(h),g=this.queryTerrainElevation(u),y=this.queryTerrainElevation(d),x=[[p.x,p.y,Math.min(m||0,_||0,g||0,y||0)],[f.x,f.y,Math.max(m||0,_||0,g||0,y||0)]];let v=e.d9.fromPoints(x);const b=a.getWorldToCameraMatrix(),w=e.bl(new Float64Array(16),b);v=e.d9.applyTransform(v,b);const T=this._extendAABB(v,a,l,n);if(!T)return void e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");v=T;const S=.5*e.av([],v.max,v.min)[2],E=this._minimumAABBFrustumDistance(a,v),I=[0,0,1,0];e.aC(I,I,b),e.f1(I,I);const A=e.c5([],I,E+S),M=e.d8([],v.center,A);e.af(v.center,v.center,w),e.af(M,M,w);const C=a.unproject(new e.P(v.center[0],v.center[1])),P=e.f2(a.projection,C),R=Math.pow(2,P),z=Math.min(a._zoomFromMercatorZ(M[2]*a.pixelsPerMeter*R/a.worldSize),l.maxZoom);return a.mercatorFromTransition&&z<.5*(e.c_+e.cL)?(a.setProjection({name:"globe"}),a.zoom=z,this._cameraForBounds(a,i,r,n,o,s)):{center:C,zoom:z,bearing:n,pitch:o}}fitBounds(e,t,i){const r=this.cameraForBounds(e,t);return this._fitInternal(r,t,i)}fitScreenCoordinates(t,i,r,n,o){const s=e.P.convert(t),a=e.P.convert(i),l=new e.P(Math.min(s.x,a.x),Math.min(s.y,a.y)),c=new e.P(Math.max(s.x,a.x),Math.max(s.y,a.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(s,a))return this;const h=this.transform.pointLocation3D(l),u=this.transform.pointLocation3D(c),d=this.transform.pointLocation3D(new e.P(l.x,c.y)),p=this.transform.pointLocation3D(new e.P(c.x,l.y)),f=[Math.min(h.lng,u.lng,d.lng,p.lng),Math.min(h.lat,u.lat,d.lat,p.lat)],m=[Math.max(h.lng,u.lng,d.lng,p.lng),Math.max(h.lat,u.lat,d.lat,p.lat)],_=n&&n.pitch?n.pitch:this.getPitch(),g=this._cameraForBounds(this.transform,f,m,r,_,n);return this._fitInternal(g,n,o)}_fitInternal(e,t,i){return e?(t=Object.assign(e,t)).linear?this.easeTo(t,i):this.flyTo(t,i):this}jumpTo(t,i){this.stop();const r=t.preloadOnly?this.transform.clone():this.transform;let n=!1,o=!1,s=!1;"zoom"in t&&r.zoom!==+t.zoom&&(n=!0,r.zoom=+t.zoom),void 0!==t.center&&(r.center=e.aT.convert(t.center)),"bearing"in t&&r.bearing!==+t.bearing&&(o=!0,r.bearing=+t.bearing),"pitch"in t&&r.pitch!==+t.pitch&&(s=!0,r.pitch=+t.pitch);const a="number"==typeof t.padding?this._extendPadding(t.padding):t.padding;if(null!=t.padding&&!r.isPaddingEqual(a))if(!1===t.retainPadding){const e=r.clone();e.padding=a,r.setLocationAtPoint(r.center,e.centerPoint)}else r.padding=a;return t.preloadOnly?(this._preloadTiles(r),this):(this.fire(new e.z("movestart",i)).fire(new e.z("move",i)),n&&this.fire(new e.z("zoomstart",i)).fire(new e.z("zoom",i)).fire(new e.z("zoomend",i)),o&&this.fire(new e.z("rotatestart",i)).fire(new e.z("rotate",i)).fire(new e.z("rotateend",i)),s&&this.fire(new e.z("pitchstart",i)).fire(new e.z("pitch",i)).fire(new e.z("pitchend",
vendor: 8,985 bytes, line 2
2i)),this.fire(new e.z("moveend",i)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||e.w(Dl),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,i){const r=this.transform;if(!r.projection.supportsFreeCamera)return e.w(Dl),this;this.stop();const n=r.zoom,o=r.pitch,s=r.bearing;r.setFreeCameraOptions(t);const a=n!==r.zoom,l=o!==r.pitch,c=s!==r.bearing;return this.fire(new e.z("movestart",i)).fire(new e.z("move",i)),a&&this.fire(new e.z("zoomstart",i)).fire(new e.z("zoom",i)).fire(new e.z("zoomend",i)),c&&this.fire(new e.z("rotatestart",i)).fire(new e.z("rotate",i)).fire(new e.z("rotateend",i)),l&&this.fire(new e.z("pitchstart",i)).fire(new e.z("pitch",i)).fire(new e.z("pitchend",i)),this.fire(new e.z("moveend",i)),this}easeTo(t,i){this._stop(!1,t.easeId),(!1===(t=Object.assign({offset:[0,0],duration:500,easing:e.eV},t)).animate||this._prefersReducedMotion(t))&&(t.duration=0);const r=this.transform,n=this.getZoom(),o=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in t?+t.zoom:n,c="bearing"in t?this._normalizeBearing(t.bearing,o):o,h="pitch"in t?+t.pitch:s,u=this._extendPadding(t.padding),d=e.P.convert(t.offset);let p,f,m;if("globe"===r.projection.name){const i=e.ae.fromLngLat(r.center),n=d.rotate(-r.angle);i.x+=n.x/r.worldSize,i.y+=n.y/r.worldSize;const o=i.toLngLat(),s=e.aT.convert(t.center||o);this._normalizeCenter(s),p=r.centerPoint.add(n),f=new e.P(i.x,i.y).mult(r.worldSize),m=new e.P(e.aF(s.lng),e.aJ(s.lat)).mult(r.worldSize).sub(f)}else{p=r.centerPoint.add(d);const i=r.pointLocation(p),n=e.aT.convert(t.center||i);this._normalizeCenter(n),f=r.project(i),m=r.project(n).sub(f)}const _=r.zoomScale(l-n);let g,y;t.around&&(g=e.aT.convert(t.around),y=r.locationPoint(g));const x=this._zooming||l!==n,v=this._rotating||o!==c,b=this._pitching||h!==s,w=!r.isPaddingEqual(u),T=!1===t.retainPadding?r.clone():r,S=r=>S=>{if(x&&(r.zoom=e.ak(n,l,S)),v&&(r.bearing=e.ak(o,c,S)),b&&(r.pitch=e.ak(s,h,S)),w&&(T.interpolatePadding(a,u,S),p=T.centerPoint.add(d)),g)r.setLocationAtPoint(g,y);else{const e=r.zoomScale(r.zoom-n),t=l>n?Math.min(2,_):Math.max(.5,_),i=Math.pow(t,1-S),o=r.unproject(f.add(m.mult(S*i)).mult(e));r.setLocationAtPoint(r.renderWorldCopies?o.wrap():o,p)}return t.preloadOnly||this._fireMoveEvents(i),r};if(t.preloadOnly){const e=this._emulate(S,t.duration,r);return this._preloadTiles(e),this}const E={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=x,this._rotating=v,this._pitching=b,this._padding=w,this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,E),this._ease(S(r),e=>{"sea"===r.cameraElevationReference&&r.recenterOnTerrain(),this._afterEase(i,e)},t),this}_prepareEase(t,i,r={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&0===this.transform.pitch&&"globe"!==this.transform.projection.name&&(this.transform.cameraElevationReference="ground"),i||r.moving||this.fire(new e.z("movestart",t)),this._zooming&&!r.zooming&&this.fire(new e.z("zoomstart",t)),this._rotating&&!r.rotating&&this.fire(new e.z("rotatestart",t)),this._pitching&&!r.pitching&&this.fire(new e.z("pitchstart",t))}_fireMoveEvents(t){this.fire(new e.z("move",t)),this._zooming&&this.fire(new e.z("zoom",t)),this._rotating&&this.fire(new e.z("rotate",t)),this._pitching&&this.fire(new e.z("pitch",t))}_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const r=this._zooming,n=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new e.z("zoomend",t)),n&&this.fire(new e.z("rotateend",t)),o&&this.fire(new e.z("pitchend",t)),this.fire(new e.z("moveend",t))}flyTo(t,i){if(this._prefersReducedMotion(t)){const r=e.aH(t,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(r,i)}this.stop(),t=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:e.eV},t);const r=this.transform,n=this.getZoom(),o=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in t?e.aA(+t.zoom,r.minZoom,r.maxZoom):n,c="bearing"in t?this._normalizeBearing(t.bearing,o):o,h="pitch"in t?+t.pitch:s,u=this._extendPadding(t.padding),d=r.zoomScale(l-n),p=e.P.convert(t.offset);let f=r.centerPoint.add(p);const m=r.pointLocation(f),_=e.aT.convert(t.center||m);this._normalizeCenter(_);const g=r.project(m),y=r.project(_).sub(g);let x=t.curve;const v=Math.max(r.width,r.height),b=v/d,w=y.mag();if("minZoom"in t){const i=e.aA(Math.min(t.minZoom,n,l),r.minZoom,r.maxZoom),o=v/r.zoomScale(i-n);x=Math.sqrt(o/w*2)}const T=x*x;function S(e){const t=(b*b-v*v+(e?-1:1)*T*T*w*w)/(2*(e?b:v)*T*w);return Math.log(Math.sqrt(t*t+1)-t)}function E(e){return(Math.exp(e)-Math.exp(-e))/2}function I(e){return(Math.exp(e)+Math.exp(-e))/2}const A=S(0);let M=function(e){return I(A)/I(A+x*e)},C=function(e){return v*((I(A)*(E(t=A+x*e)/I(t))-E(A))/T)/w;var t},P=(S(1)-A)/x;if(Math.abs(w)<1e-6||!isFinite(P)){if(Math.abs(v-b)<1e-6)return this.easeTo(t,i);const e=b<v?-1:1;P=Math.abs(Math.log(b/v))/x,C=function(){return 0},M=function(t){return Math.exp(e*x*t)}}t.duration="duration"in t?+t.duration:1e3*P/("screenSpeed"in t?+t.screenSpeed/x:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0);const R=o!==c,z=h!==s,L=!r.isPaddingEqual(u),D=!1===t.retainPadding?r.clone():r,O=r=>d=>{const m=d*P,x=1/M(m);r.zoom=1===d?l:n+r.scaleZoom(x),R&&(r.bearing=e.ak(o,c,d)),z&&(r.pitch=e.ak(s,h,d)),L&&(D.interpolatePadding(a,u,d),f=D.centerPoint.add(p));const v=1===d?_:r.unproject(g.add(y.mult(C(m))).mult(x));return r.setLocationAtPoint(r.renderWorldCopies?v.wrap():v,f),r._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(i),r};if(t.preloadOnly){const e=this._emulate(O,t.duration,r);return this._preloadTiles(e),this}return this._zooming=!0,this._rotating=R,this._pitching=z,this._padding=L,this._prepareEase(i,!1),this._ease(O(r),()=>this._afterEase(i),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(e){}_cancelRenderFrame(e){}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const e=this._onEaseEnd;this._onEaseEnd=void 0,e.call(this,t)}if(!e){const e=this.handlers;e&&e.stop(!1)}return this}_ease(t,i,r){!1===r.animate||0===r.duration?(t(1),i()):(this._easeStart=e.o.now(),this._easeOptions=r,this._onEaseFrame=t,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((e.o.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.bT(t,-180,180);const r=Math.abs(t-i);return Math.abs(t-360-i)<r&&(t-=360),Math.abs(t+360-i)<r&&(t+=360),t}_normalizeCenter(e){const t=this.transform;if(t.maxBounds)return;if("globe"!==t.projection.name&&!t.renderWorldCopies)return;const i=e.lng-t.center.lng;e.lng+=i>180?-360:i<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&e.o.prefersReducedMotion&&!(t&&t.essential)}_emulate(e,t,i){const r=Math.ceil(15*t/1e3),n=[],o=e(i.clone());for(let s=0;s<=r;s++){const e=o(s/r);n.push(e.clone())}return n}_preloadTiles(e,t){}}class Fl{constructor(t={}){this.options=t,e.aY(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(e){const t=this.options&&this.options.compact,i=e._getUIString("AttributionControl.ToggleAttribution");this._map=e,this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=l("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",i);const r=l("span","mapboxgl-ctrl-icon",this._compactButton);return r.setAttribute("aria-hidden","true"),r.setAttribute("title",i),this._innerContainer=l("div","mapboxgl-ctrl-attrib-inner",this._container),t&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===t&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","fal
2se")):(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.e.ACCESS_TOKEN}];if(t){const r=i.reduce((e,t,r)=>(t.value&&(e+=`${t.key}=${t.value}${r<i.length-1?"&":""}`),e),"?");t.href=`${e.e.FEEDBACK_URL}/${r}#${Oa(this._map,!0)}`,t.rel="noopener nofollow"}}_updateData(e){!e||("source"!==e.dataType||"metadata"!==e.sourceDataType&&"visibility"!==e.sourceDataType)&&"style"!==e.dataType||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let e=[];if(this._map.style.stylesheet){const e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}const t=this._map.style._mergedSourceCaches;for(const r in t){const i=t[r];if(i.used){const t=i.getSource();t.attribution&&e.indexOf(t.attribution)<0&&e.push(t.attribution)}}e.sort((e,t)=>e.length-t.length),e=e.filter((t,i)=>{for(let r=i+1;r<e.length;r++)if(e[r].indexOf(t)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=[...this.options.customAttribution,...e]:e.unshift(this.options.customAttribution));const i=e.map(e=>function(e){const t=(new DOMParser).parseFromString(e,"text/html");return Array.from(t.body.querySelectorAll("*")).reverse().forEach(e=>{const i=e.textContent||"";if("A"!==e.tagName)return void e.replaceWith(...e.childNodes);const r=e.getAttribute("href");if(!r||!/^(https?:|mailto:)/i.test(r))return void e.replaceWith(t.createTextNode(i));const n=t.createElement("a");n.href=r,n.textContent=i,n.rel="noopener nofollow";const o=e.getAttribute("class");o&&(n.className=o),e.replaceWith(n)}),t.body.innerHTML}(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 kl{constructor(){e.aY(["_updateLogo","_updateCompact"],this)}onAdd(e){this._map=e,this._container=l("div","mapboxgl-ctrl");const t=l("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 Bl{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 r of i)if(r.id===e)return void(r.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=[]}}class Nl{constructor(e){this.jumpTo(e)}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const i=e.dD((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 Vl={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use \u2318 + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"};class Ul extends e.z{constructor(e,t,i,r){const{point:n,lngLat:o,originalEvent:s,target:a}=e;super(e.type,{point:n,lngLat:o,originalEvent:s,target:a}),this.preventDefault=()=>{e.preventDefault()},this.id=t,this.interaction=i,this.feature=r}}class jl{constructor(e){this.map=e,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}
vendor: 6,041 bytes, line 2
2add(t,i){if(this.typeById.has(t))throw new Error(`Interaction id "${t}" already exists.`);const r=i.filter;let n=i.type;r&&this.filters.set(t,e.b6(r)),"mouseover"===n&&(n="mouseenter"),"mouseout"===n&&(n="mouseleave");const o=this.interactionsByType.get(n)||new Map;"mouseenter"===n||"mouseleave"===n?(0===this.delegatedInteractions.size&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(t,i)):0===o.size&&this.map.on(n,this.handleType),0===o.size&&this.interactionsByType.set(n,o),o.set(t,i),this.typeById.set(t,n)}get(e){const t=this.typeById.get(e);if(!t)return;const i=this.interactionsByType.get(t);return i?i.get(e):void 0}remove(e){const t=this.typeById.get(e);if(!t)return;this.typeById.delete(e),this.filters.delete(e);const i=this.interactionsByType.get(t);i&&(i.delete(e),"mouseenter"===t||"mouseleave"===t?(this.delegatedInteractions.delete(e),0===this.delegatedInteractions.size&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):0===i.size&&this.map.off(t,this.handleType))}queryTargets(e,t){const i=[];for(const[r,n]of t)n.target&&i.push({targetId:r,target:n.target,filter:this.filters.get(r)});return this.map.style.queryRenderedTargets(e,i,this.map.transform)}handleMove(e){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const t=this.queryTargets(e.point,Array.from(this.delegatedInteractions).reverse());t.length&&(e.type="mouseenter",this.handleType(e,t));const i=new Map;for(const[r,{feature:n}]of this.prevHoveredFeatures)this.hoveredFeatures.has(r)||i.set(n.id,n);i.size&&(e.type="mouseleave",this.handleType(e,Array.from(i.values())))}handleOut(e){const t=Array.from(this.hoveredFeatures.values()).map(({feature:e})=>e);t.length&&(e.type="mouseleave",this.handleType(e,t)),this.hoveredFeatures.clear()}handleType(t,i){const r="mouseenter"===t.type;if(r&&!this.interactionsByType.has(t.type))return void e.w("mouseenter interaction required for mouseleave to work.");const n=Array.from(this.interactionsByType.get(t.type)).reverse(),o=!!i;i=i||this.queryTargets(t.point,n);let s=!1;const a=new Set;for(const l of i){for(const[i,c]of n){if(!c.target)continue;const n=l.variants?l.variants[i]:null;if(n){for(const h of n){if(yt(h,l,a,i))continue;const n=new e.dx(l,h),u=gt(h,l,i);o&&void 0!==n.id&&(n.state=this.map.getFeatureState(n));const d=r?this.prevHoveredFeatures.get(u):null,p=new Ul(t,i,c,n),f=d?d.stop:c.handler(p);if(r&&this.hoveredFeatures.set(u,{feature:l,stop:f}),!1!==f){s=!0;break}}if(s)break}}if(s)break}if(!s)for(const[e,l]of n){const{handler:i,target:r}=l;if(!r&&!1!==i(new Ul(t,e,l,null)))break}}}function Gl(t,i){if(Array.isArray(t)&&Array.isArray(i)){const e=new Set(t),r=new Set(i);return e.size===r.size&&t.every(e=>r.has(e))}return e.by(t,i)}const ql={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},Hl={showCompass:!0,showZoom:!0,visualizePitch:!1};class $l{constructor(t,i,r=!1){this._clickTolerance=10,this.element=i,this.mouseRotate=new sl({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,r&&(this.mousePitch=new al({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),e.aY(["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),p()}move(e,t){const i=this.map,r=this.mouseRotate.mousemoveWindow(e,t),n=r&&r.bearingDelta;if(n&&i.setBearing(i.getBearing()+n),this.mousePitch){const r=this.mousePitch.mousemoveWindow(e,t),n=r&&r.pitchDelta;n&&i.setPitch(i.getPitch()+n)}}off(){const e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart),e.removeEventListener("touchmove",this.touchmove),e.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){f(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(e){this.down(Object.assign({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),g(this.element,e)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(e){this.move(e,g(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=y(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=y(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos))}touchend(e){0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}
vendor: 5,181 bytes, line 2
2function Zl(t,i,r){if(t=new e.aT(t.lng,t.lat),i){const n=new e.aT(t.lng-360,t.lat),o=new e.aT(t.lng+360,t.lat),s=360*Math.ceil(Math.abs(t.lng-r.center.lng)/360),a=r.locationPoint3D(t).distSqr(i),l=i.x<0||i.y<0||i.x>r.width||i.y>r.height;r.locationPoint3D(n).distSqr(i)<a&&(l||Math.abs(n.lng-r.center.lng)<s)?t=n:r.locationPoint3D(o).distSqr(i)<a&&(l||Math.abs(o.lng-r.center.lng)<s)&&(t=o)}for(;Math.abs(t.lng-r.center.lng)>180;){const e=r.locationPoint3D(t);if(e.x>=0&&e.y>=0&&e.x<=r.width&&e.y<=r.height)break;t.lng>r.center.lng?t.lng-=360:t.lng+=360}return t}const Wl={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%)"},Xl={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class Yl extends e.E{constructor(t,i){super(),(t instanceof HTMLElement||i)&&(t=Object.assign({element:t},i)),e.aY(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:r="center",color:n="#3FB1CE",scale:o=1,draggable:s=!1,clickTolerance:a=0,rotation:l=Xl.rotation,rotationAlignment:c=Xl.rotationAlignment,pitchAlignment:h=Xl.pitchAlignment,occludedOpacity:u=Xl.occludedOpacity,altitude:d=Xl.altitude}=t||{};this._anchor=r,this._color=n,this._scale=o,this._draggable=s,this._clickTolerance=a,this._rotation=l,this._rotationAlignment=c,this._pitchAlignment=h,this._occludedOpacity=u,this._altitude=d,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),t&&t.element?(this._element=t.element,this._offset=e.P.convert(t&&t.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=e.P.convert(t&&t.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",e=>{e.preventDefault()}),this._element.addEventListener("mousedown",e=>{e.preventDefault()});const p=this._element.classList;for(const e in Wl)p.remove(`mapboxgl-marker-anchor-${e}`);p.add(`mapboxgl-marker-anchor-${this._anchor}`);const f=t&&t.className?t.className.trim().split(/\s+/):[];p.add(...f),this._popup=null}_createDefaultMarker(){const e=l("div"),t=c("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},e);if(0===this._altitude){const e=c("radialGradient",{id:"shadowGradient"},c("defs",{},t));c("stop",{offset:"10%","stop-opacity":.4},e),c("stop",{offset:"100%","stop-opacity":.05},e),c("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},t)}return c("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"},t),c("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"},t),c("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},t),e}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.aT.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(e){return e===this._altitude||(this._defaultMarker&&(0===this._altitude&&0!==e||0!==this._altitude&&0===e)&&(this._element=this._createDefaultMarker()),this._altitude=e||Xl.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const t=38.1,i=13.5,r=Math.sqrt(Math.pow(i,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
vendor: 3,227 bytes, line 2
20,-t],"bottom-left":[r,-1*(t-i+r)],"bottom-right":[-r,-1*(t-i+r)],left:[i,-1*(t-i)],right:[-i,-1*(t-i)]}:this._offset}this._popup=e,e._marker=this,e._altitude=this._altitude,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,this._altitude),r=e.getFreeCameraOptions();if(!r.position)return!1;const n=r.position.toLngLat();return n.distanceTo(i)<.9*n.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const i=this._pos;if(!i||i.x<0||i.x>t.transform.width||i.y<0||i.y>t.transform.height)return void this._clearFadeTimer();const r=t.unproject(i,this._altitude);let n;t._showingGlobe()&&e.f5(t.transform,this._lngLat)?n=0:(n=1-t._queryFogOpacity(r),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(n*=this._occludedOpacity)),this._element.style.opacity=`${n}`,this._element.style.pointerEvents=n>0?"auto":"none",this._popup&&this._popup._setOpacity(n),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const e=this._pos;if(!e||!this._map)return;const t=this._offset.mult(this._scale);this._element.style.transform=`\n translate(${e.x}px,${e.y}px)\n ${Wl[this._anchor]}\n ${this._calculateXYTransform()} ${this._calculateZTransform()}\n translate(${t.x}px,${t.y}px)\n `}_calculateXYTransform(){const t=this._pos,i=this._map,r=this.getPitchAlignment();if(!i||!t||"map"!==r)return"";if(!i._showingGlobe()){const e=i.getPitch();return e?`rotateX(${e}deg)`:""}const n=e.cX(e.f6(i.transform,this._lngLat)),o=t.sub(e.f7(i.transform)),s=Math.abs(o.x)+Math.abs(o.y);if(0===s)return"";const a=n/s;return`rotateX(${-o.y*a}deg) rotateY(${o.x*a}deg)`}_calculateZTransform(){const t=this._pos,i=this._map;if(!i||!t)return"";let r=0;const n=this.getRotationAlignment();if("map"===n)if(i._showingGlobe()){const t=i.project(new e.aT(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),n=i.project(new e.aT(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(t);r=e.cX(Math.atan2(n.y,n.x))-90}else r=-i.getBearing();else if("horizon"===n){const n=e.ah(4,6,i.getZoom()),o=e.f7(i.transform);o.y+=n*i.transform.height;const s=t.sub(o),a=e.cX(Math.atan2(s.y,s.x));r=(a>90?a-270:a+90)*(1-n)}return r+=this._rotation,r?`rotateZ(${r}deg)`:""}_update(e){cancelAnimationFrame(this._updateFrameId);const t=this._map;
vendor: 5,057 bytes, line 2
2t&&(t.transform.renderWorldCopies&&(this._lngLat=Zl(this._lngLat,this._pos,t.transform)),this._pos=t.project(this._lngLat,this._altitude),!0===e?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),t._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(t._showingGlobe()||t.getTerrain()||t.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(t){return this._offset=e.P.convert(t),this._update(),this}addClassName(e){return this._element.classList.add(e),this}removeClassName(e){return this._element.classList.remove(e),this}toggleClassName(e){return this._element.classList.toggle(e)}_onMove(t){const i=this._map;if(!i)return;const r=this._pointerdownPos,n=this._positionDelta;if(r&&n){if(!this._isDragging){const e=this._clickTolerance||i._clickTolerance;if(t.point.dist(r)<e)return;this._isDragging=!0}this._pos=t.point.sub(n),this._lngLat=i.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new e.z("dragstart"))),this.fire(new e.z("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const t=this._map;t&&(t.off("mousemove",this._onMove),t.off("touchmove",this._onMove)),"active"===this._state&&this.fire(new e.z("dragend")),this._state="inactive"}_addDragHandler(e){const t=this._map,i=this._pos;t&&i&&this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(i),this._pointerdownPos=e.point,this._state="pending",t.on("mousemove",this._onMove),t.on("touchmove",this._onMove),t.once("mouseup",this._onUp),t.once("touchend",this._onUp))}setDraggable(e){this._draggable=!!e;const t=this._map;return t&&(e?(t.on("mousedown",this._addDragHandler),t.on("touchstart",this._addDragHandler)):(t.off("mousedown",this._addDragHandler),t.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||Xl.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||Xl.rotationAlignment,this._update(),this}getRotationAlignment(){return"auto"===this._rotationAlignment||"horizon"===this._rotationAlignment&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e||Xl.pitchAlignment,this._update(),this}getPitchAlignment(){return"auto"===this._pitchAlignment?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(e){return this._occludedOpacity=e||Xl.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const Kl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1,showButton:!0,followUserLocation:!0},Jl={maxWidth:100,unit:"metric"},Ql={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},ec={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},tc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ic(t=new e.P(0,0),i="bottom"){if("number"==typeof t){const r=Math.round(Math.sqrt(.5*Math.pow(t,2)));switch(i){case"top":return new e.P(0,t);case"top-left":return new e.P(r,r);case"top-right":return new e.P(-r,r);case"bottom":return new e.P(0,-t);case"bottom-left":return new e.P(r,-r);case"bottom-right":return new e.P(-r,-r);case"left":return new e.P(t,0);case"right":return new e.P(-t,0)}return new e.P(0,0)}return t instanceof e.P||Array.isArray(t)?e.P.convert(t):e.P.convert(t[i]||[0,0])}const rc={version:t,supported:a.supported,setRTLTextPlugin:e.fb,getRTLTextPluginStatus:e.fa,Map:class extends Ol{constructor(t){r.mark(i.create);const n=t;if(null!=(t=Object.assign({},ql,t)).minZoom&&null!=t.maxZoom&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=t.minPitch&&null!=t.maxPitch&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=t.minPitch&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=t.maxPitch&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(t.antialias&&e.f3(window)&&(t.antialias=!1,e.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new lr(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies,null,null),t),this._repaint=!!t.repaint,this._interactive=t.interactive,this._minTileCacheSize=t.minTileCacheSize,this._maxTileC
vendor: 4,509 bytes, line 2
2acheSize=t.maxTileCacheSize,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._antialias=t.antialias,this._trackResize=t.trackResize,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles,this._fadeDuration=t.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=t.crossSourceCollisions,this._collectResourceTiming=t.collectResourceTiming,this._language=this._parseLanguage(t.language),this._worldview=t.worldview,this._renderTaskQueue=new Bl,this._domRenderTaskQueue=new Bl,this._controls=[],this._markers=[],this._popups=[],this._mapId=e.b2(),this._locale=Object.assign({},Vl,t.locale),this._clickTolerance=t.clickTolerance,this._cooperativeGestures=t.cooperativeGestures,this._performanceMetricsCollection=t.performanceMetricsCollection,this._tessellationStep=t.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=t.precompilePrograms,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Nl(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=t.scaleFactor,this._requestManager=new T(t.transformRequest,t.accessToken,t.testMode),this._silenceAuthErrors=!!t.testMode,this._contextCreateOptions=t.contextCreateOptions?Object.assign({},t.contextCreateOptions):{},"string"==typeof t.container){const e=document.getElementById(t.container);if(!e)throw new Error(`Container '${t.container.toString()}' not found.`);this._container=e}else{if(!(t.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(this._container.childNodes.length>0&&e.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),t.maxBounds&&this.setMaxBounds(t.maxBounds),this._spriteFormat=t.spriteFormat,e.aY(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new Ll(this,t),this._localFontFamily=t.localFontFamily,this._localIdeographFontFamily=t.localIdeographFontFamily,(t.style||!t.testMode)&&this.setStyle(t.style||e.e.DEFAULT_STYLE,{config:t.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),t.projection&&this.setProjection(t.projection),t.hash&&(this._hash=new Da("string"==typeof t.hash&&t.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){null==n.center&&null==n.zoom||(this.transform._unmodified=!1),this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch});const e=t.bounds;e&&(this.resize(),this.fitBounds(e,Object.assign({},t.fitBoundsOptions,{duration:0})))}this.resize(),t.attributionControl&&this.addControl(new Fl({customAttribution:t.customAttribution})),this._logoControl=new kl,this.addControl(this._logoControl,t.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent()}),this.on("data",t=>{this._update("style"===t.dataType),this.fire(new e.z(`${t.dataType}data`,t))}),this.on("dataloading",t=>{this.fire(new e.z(`${t.dataType}dataloading`,t))}),this._interactions=new jl(this)}_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.y(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const r=t.onAdd(this);this._controls.push(t);const n=this._controlPositions[i];
vendor: 4,457 bytes, line 2
2return-1!==i.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.y(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.z("movestart",t)).fire(new e.z("move",t)),this.fire(new e.z("resize",t)),i&&this.fire(new e.z("moveend",t)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(t){return this.transform.setMaxBounds(e.aI.convert(t)),this._update()}setMinZoom(t){if((t=t??-2)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t?this.setZoom(t):this.fire(new e.z("zoomstart")).fire(new e.z("zoom")).fire(new e.z("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if((t=t??22)>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t?this.setZoom(t):this.fire(new e.z("zoomstart")).fire(new e.z("zoom")).fire(new e.z("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=t??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t?this.setPitch(t):this.fire(new e.z("pitchstart")).fire(new e.z("pitch")).fire(new e.z("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if((t=t??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t?this.setPitch(t):this.fire(new e.z("pitchstart")).fire(new e.z("pitch")).fire(new e.z("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(e){return this._scaleFactor=e,this.painter.scaleFactor=e,this.style&&this.style._setLabelPlacementStale(),this.style._updateFilteredLayers(e=>"symbol"===e.type),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(e){return"auto"===e?navigator.language:Array.isArray(e)?0===e.length?void 0:e.map(e=>"auto"===e?navigator.language:e):e}setLanguage(e){const t=this._parseLanguage(e);if(!this.style||t===this._language)return this;this._language=t,this.style.reloadSources();for(const i of this._controls)i._setLanguage&&i._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(e){return this.style&&e!==this._worldview?(this._worldview=e,this._styleDirty=!0,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(e){return this._lazyInitEmptyStyle(),e?"string"==typeof e&&(e={name:e}):e=null,this._useExplicitProjection=!!e,this._prioritizeAndUpdateProjection(e,this.style.projection)}_updateProjectionTransition(){if("globe"!==this.getProjection().name)return;const t=this.transform,i=t.projection.name;let r;"globe"===i&&t.zoom>=e.cL?(t.setMercatorFromTransition(),r=!0):"mercator"===i&&t.zoom<e.cL&&(t.setProjection({name:"globe"}),r=!0),r&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayer
vendor: 4,132 bytes, line 2
2Update(),this._update(!0))}_prioritizeAndUpdateProjection(e,t){return this._updateProjection(e||t||{name:"mercator"})}_updateProjection(t){let i;const r=this.transform.mercatorFromTransition;i="globe"===t.name&&this.transform.zoom>=e.cL?this.transform.setMercatorFromTransition():this.transform.setProjection(t),this.style.applyProjectionUpdate();const n="mercator"===this.transform.getProjection().name&&r!==this.transform.mercatorFromTransition;return(i||n)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(t,i){return this.transform.locationPoint3D(e.aT.convert(t),i)}unproject(t,i){return this.transform.pointLocation3D(e.P.convert(t),i)}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){const r=e=>{let i=[];if(Array.isArray(t)){const r=t.filter(e=>this.getLayer(e));i=r.length?this.queryRenderedFeatures(e,{layers:r}):[]}else i=this.queryRenderedFeatures(e,{target:t});return i};if("mouseenter"===e||"mouseover"===e){let n=!1;const o=t=>{const o=r(t.point);o.length?n||(n=!0,i.call(this,new qa(e,this,t.originalEvent,{features:o}))):n=!1};return{listener:i,targets:t,delegates:{mousemove:o,mouseout:()=>{n=!1}}}}if("mouseleave"===e||"mouseout"===e){let n=!1;const o=t=>{r(t.point).length?n=!0:n&&(n=!1,i.call(this,new qa(e,this,t.originalEvent)))},s=t=>{n&&(n=!1,i.call(this,new qa(e,this,t.originalEvent)))};return{listener:i,targets:t,delegates:{mousemove:o,mouseout:s}}}{const n=e=>{const t=r(e.point);t.length&&(e.features=t,i.call(this,e),delete e.features)};return{listener:i,targets:t,delegates:{[e]:n}}}}on(e,t,i){if("function"==typeof t||void 0===i)return super.on(e,t);if("string"==typeof t&&(t=[t]),!this._areTargetsValid(t))return this;const r=this._createDelegatedListener(e,t,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(r);for(const n in r.delegates)this.on(n,r.delegates[n]);return this}once(e,t,i){if("function"==typeof t||void 0===i)return super.once(e,t);if("string"==typeof t&&(t=[t]),!this._areTargetsValid(t))return this;const r=this._createDelegatedListener(e,t,i);for(const n in r.delegates)this.once(n,r.delegates[n]);return this}off(e,t,i){if("function"==typeof t||void 0===i)return super.off(e,t);if("string"==typeof t&&(t=[t]),!this._areTargetsValid(t))return this;const r=this._delegatedListeners?this._delegatedListeners[e]:void 0;return r&&(e=>{for(let r=0;r<e.length;r++){const n=e[r];if(n.listener===i&&Gl(n.targets,t)){for(const e in n.delegates)this.off(e,n.delegates[e]);return e.splice(r,1),this}}})(r),this}queryRenderedFeatures(t,i){if(!this.style)return[];if(void 0===t||t instanceof e.P||Array.isArray(t)||void 0!==i||(i=t,t=void 0),t=t||[[0,0],[this.transform.width,this.transform.height]],!i){const e=this.style.queryRenderedFeatures(t,void 0,this.transform),i=this.style.queryRenderedFeatureset(t,void 0,this.transform);return e.concat(i)}let r=!0;if(i.target&&(r=this._isTargetValid(i.target),r&&!i.layers))return this.style.queryRenderedFeatureset(t,i,this.transform);let n=!0;if(i.layers&&Array.isArray(i.layers)){for(const e of i.layers)if(!this._isValidId(e)){n=!1;break}if(n&&!i.target)return this.style.queryRenderedFeatures(t,i,this.transform)}let o=[];return n&&(o=o.concat(this.style.queryRenderedFeatures(t,i,this.transform))),r&&(o=o.concat(this.style.queryRenderedFeatureset(t,i,this.transform))),o}querySourceFeatures(e,t){return!e||"string"==typeof e&&!this._isValidId(e)?[]:this.style.querySourceFeatures(e,t)}queryRasterValue(e,t,i){return this._isValidId(e)?this.style.queryRasterValue(e,t,i):Promise.resolve(null)}isPointOnSurface(t){const{name:i}=this.transform.projection;return"globe"!==i&&"mercator"!==i&&e.w(`${i} projection does not support isPointOnSurface, this API may behave unex
2pectedly.`),this.transform.isPointOnSurface(e.P.convert(t))}addInteraction(e,t){return this._interactions.add(e,t),this}removeInteraction(e){return this._interactions.remove(e),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(e){return this._cooperativeGestures=e,this}setStyle(t,i){return i=Object.assign({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},i),this.style&&t&&!1!==i.diff&&i.localFontFamily===this._localFontFamily&&i.localIdeographFontFamily===this._localIdeographFontFamily&&!i.config?(this.style._diffStyle(t,(r,n)=>{if(r){const n="string"==typeof r?r:r instanceof Error?r.message:r.error;e.w(`Unable to perform style diff: ${n}. Rebuilding the style from scratch.`),this._updateStyle(t,i)}else n&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._localFontFamily=i.localFontFamily,this._updateStyle(t,i))}_getUIString(e){const t=this._locale[e];if(null==t)throw new Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),e){const i=Object.assign({},t);t&&t.config&&(i.initialConfig=t.config,delete i.config),this.style=new zr(this,i).load(e),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new zr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(e.w("There is no style added to the map."),!1)}_isValidId(t){return null==t?(this.fire(new e.y(new Error("IDs can't be empty."))),!1):!e.dr(t)||(this.fire(new e.y(new Error(`IDs can't contain special symbols: "${t}".`))),!1)}_isTargetValid(e){return"featuresetId"in e?this._isValidId("importId"in e?e.importId:e.featuresetId):"layerId"in e&&this._isValidId(e.layerId)}_areTargetsValid(e){if(Array.isArray(e)){for(const t of e)if(!this._isValidId(t))return!1;return!0}return this._isTargetValid(e)}addSource(e,t){return this._isValidId(e)?(this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)):this}isSourceLoaded(e){return!!this._isValidId(e)&&!!this.style&&this.style._isSourceCacheLoaded(e)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(e,t,i){this._lazyInitEmptyStyle(),this.style.addSourceType(e,t,i)}removeSource(e){return this._isValidId(e)?(this.style.removeSource(e),this._updateTerrain(),this._update(!0)):this}getSource(e){return this._isValidId(e)?this.style.getOwnSource(e):null}addImage(t,i,{pixelRatio:r=1,sdf:n=!1,stretchX:o,stretchY:s,content:a}={}){this._lazyInitEmptyStyle();const l=e.I.from(t);if(i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap){const{width:t,height:c,data:h}=e.o.getImageData(i);this.style.addImage(l,{data:new e.q({width:t,height:c},h),pixelRatio:r,stretchX:o,stretchY:s,content:a,sdf:n,version:0,usvg:!1})}else if(void 0===i.width||void 0===i.height)this.fire(new e.y(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:c,height:h}=i,u=i;this.style.addImage(l,{data:new e.q({width:c,height:h},new Uint8Array(u.data)),pixelRatio:r,stretchX:o,stretchY:s,content:a,sdf:n,usvg:!1,version:0,userImage:u}),u.onAdd&&u.onAdd(this,t)}}updateImage(t,i){this._lazyInitEmptyStyle();const r=e.I.from(t),n=this.style.getImage(r);if(!n)return void this.fire(new e.y(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 HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap?e.o.getImageData(i):i,{width:s,height:a,data:l}=o;if(void 0===s||void 0===a)return void this.fire(new e.y(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(s!==(n.usvg?n.icon.usvg_tree.width:n.data.width)||a!==(n.usvg?n.icon.usvg_tree.height:n.data.height))return void this.fire(new e.y(new Error(`The width and height of the updated image (${s}, ${a})\n must be that same as the previous version of the image\n (${n.data.width}, ${n.data.height})`)));const c=!(i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap);let h=!1;n.usvg?(n.data=new e.q({width:s,height:a},new Uint8Array(l)),n.usvg=!1,n.icon=void 0,h=!0):n.data.replace(l,c),this.style.updateImage(r,n,h)}hasImage(t){return t?!!this.style&&!!this.style.getImage(e.I.from(t)):(this.fire(new e.y(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(e.I.from(t))}loadImage(t,i){e.n(this._requestManager.transformRequest(t,e.R.Image),(t,r)=>{i(t,r instanceof HTMLImageElement?e.o.getImageData(r):r)})}listImages(){return this.style.listImages().map(e=>e.name)}
vendor: 4,524 bytes, line 2
2addModel(e,t){this._lazyInitEmptyStyle(),this.style.addModel(e,t)}hasModel(t){return t?this.style.hasModel(t):(this.fire(new e.y(new Error("Missing required model id"))),!1)}removeModel(e){this.style.removeModel(e)}listModels(){return this.style.listModels()}addLayer(e,t){return this._isValidId(e.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)):this}getSlot(e){const t=this.getLayer(e);return t&&t.slot||null}setSlot(e,t){return this.style.setSlot(e,t),this.style.mergeLayers(),this._update(!0)}addImport(t,i){return this.style.addImport(t,i).catch(t=>this.fire(new e.y(new Error("Failed to add import",t)))),this}updateImport(e,t){return"string"!=typeof t&&t.id!==e?(this.removeImport(e),this.addImport(t)):(this.style.updateImport(e,t),this._update(!0))}removeImport(e){return this.style.removeImport(e),this}moveImport(e,t){return this.style.moveImport(e,t),this._update(!0)}moveLayer(e,t){return this._isValidId(e)?(this.style.moveLayer(e,t),this._update(!0)):this}removeLayer(e){return this._isValidId(e)?(this.style.removeLayer(e),this._update(!0)):this}getLayer(e){if(!this._isValidId(e))return null;const t=this.style.getOwnLayer(e);return t?"custom"===t.type?t.implementation:t.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(e,t,i){return this._isValidId(e)?(this.style.setLayerZoomRange(e,t,i),this._update(!0)):this}setFilter(e,t,i={}){return this._isValidId(e)?(this.style.setFilter(e,t,i),this._update(!0)):this}getFilter(e){return this._isValidId(e)?this.style.getFilter(e):null}setPaintProperty(e,t,i,r={}){return this._isValidId(e)?(this.style.setPaintProperty(e,t,i,r),this._update(!0)):this}getPaintProperty(e,t){return this._isValidId(e)?this.style.getPaintProperty(e,t):null}setLayoutProperty(e,t,i,r={}){return this._isValidId(e)?(this.style.setLayoutProperty(e,t,i,r),this._update(!0)):this}getLayoutProperty(e,t){return this._isValidId(e)?this.style.getLayoutProperty(e,t):null}setLayerProperty(e,t,i,r={}){return this._isValidId(e)?("appearances"===t&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(e,t,i,r),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(e){return this.style.setGlyphsUrl(e),this._update(!0)}getSchema(e){return this.style.getSchema(e)}setSchema(e,t){return this.style.setSchema(e,t),this._update(!0)}getConfig(e){return this.style.getConfig(e)}setConfig(e,t){return this.style.setConfig(e,t),this._update(!0)}getConfigProperty(e,t){return this.style.getConfigProperty(e,t)}setConfigProperty(e,t,i){return this.style.setConfigProperty(e,t,i),this._update(!0)}getFeaturesetDescriptors(e){return this.style.getFeaturesetDescriptors(e)}setLights(e){if(this._lazyInitEmptyStyle(),e&&1===e.length&&"flat"===e[0].type){const t=e[0];t.properties?this.style.setFlatLight(t.properties,t.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(e),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const e=this.style.getLights()||[];return 0===e.length&&e.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),e}setLight(e,t={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:e}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(e){return this._lazyInitEmptyStyle(),!e&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(e),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(e){return this._lazyInitEmptyStyle(),this.style.setFog(e),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(e){return this._lazyInitEmptyStyle(),this.style.setSnow(e),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(e){return this._lazyInitEmptyStyle(),this.style.setRain(e),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(e){return this._lazyInitEmptyStyle(),this.style.setColorTheme(e),this._update(!0)}setImportColorTheme(e,t){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(e,t),this._update(!0)}setCamera(e){return this.style.setCamera(e),this._triggerCameraUpdate(e)}_triggerCameraUpdate(e){return this._update(this.transform.setOrthogra
vendor: 5,376 bytes, line 2
2phicProjectionAtLowPitch("orthographic"===e["camera-projection"]))}getCamera(){return this.style.camera}_queryFogOpacity(t){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(e.aT.convert(t),this.transform):0}setFeatureState(e,t){return e.source&&!this._isValidId(e.source)?this:(this.style.setFeatureState(e,t),this._update())}removeFeatureState(e,t){return e.source&&!this._isValidId(e.source)?this:(this.style.removeFeatureState(e,t),this._update())}getFeatureState(e){return e.source&&!this._isValidId(e.source)?null:this.style.getFeatureState(e)}_selectIndoorFloor(e){this.style.indoorManager.selectFloor(e)}_setIndoorActiveFloorsVisibility(e){this.style.indoorManager.setActiveFloorsVisibility(e)}getIndoorTileOptions(e,t){return this.style.isIndoorEnabled()?this.style.indoorManager.getIndoorTileOptions(e,t):null}_updateContainerDimensions(){if(!this._container)return;const e=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let i,r,n,o=this._container;for(;o&&(!r||!n);){const e=window.getComputedStyle(o).transform;e&&"none"!==e&&(i=e.match(/matrix.*\((.+)\)/)[1].split(", "),i[0]&&"0"!==i[0]&&"1"!==i[0]&&(r=i[0]),i[3]&&"0"!==i[3]&&"1"!==i[3]&&(n=i[3])),o=o.parentElement}this._containerWidth=r?Math.abs(e/r):e,this._containerHeight=n?Math.abs(t/n):t}_detectMissingCSS(){"rgb(250, 128, 114)"!==window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&e.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const e=this._container;e.classList.add("mapboxgl-map"),(this._missingCSSCanary=l("div","mapboxgl-canary",e)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=l("div","mapboxgl-canvas-container",e);this._canvas=l("canvas","mapboxgl-canvas",t),this._interactive&&(t.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const i=this._controlContainer=l("div","mapboxgl-control-container",e),r=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(e=>{r[e]=l("div",`mapboxgl-ctrl-${e}`,i)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,i){const r=e.o.devicePixelRatio||1;this._canvas.width=r*Math.ceil(t),this._canvas.height=r*Math.ceil(i),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${i}px`}_addMarker(e){this._markers.push(e)}_removeMarker(e){const t=this._markers.indexOf(e);-1!==t&&this._markers.splice(t,1)}_addPopup(e){this._popups.push(e)}_removePopup(e){const t=this._popups.indexOf(e);-1!==t&&this._popups.splice(t,1)}_setupPainter(){const t=Object.assign({},a.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),i=this._canvas.getContext("webgl2",t);i?($(i,!0),this.painter=new za(i,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",e=>{if("source"===e.dataType){const t=this.transform.elevation?this.transform.elevation._source():null;t&&e.sourceCacheId===t.id&&this.style&&this.style._setLabelPlacementStale(),this.painter.setTileLoadedFlag(!0)}}),e.k.testSupport(i)):this.fire(new e.y(new Error("Failed to initialize WebGL")))}_contextLost(t){t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.z("webglcontextlost",{originalEvent:t}))}_contextRestored(t){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.clearLayers(),this.style.imageManager.destroyAtlasTextures(),this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new e.z("webglcontextrestored",{originalEvent:t}))}_onMapScroll(e){if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(e){return this.style?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_requestDomTask(e){!this.loaded()||this.loaded()&&!this.isMoving()?e():this._domRenderTaskQueue.add(e)}_render(t){let n;this.fire(new e.z("renderstart")),++this._frameId;const o=this.painter.context.extTimerQuery,s=e.o.now(),a=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(n=a.createQuery(),a.beginQuery(o.TIME_ELAPSED_EXT,n)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&
vendor: 11,922 bytes, line 2
2(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(t),this._domRenderTaskQueue.run(t),this._removed)return;this._updateProjectionTransition();const l=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,i=this.transform.pitch,r=e.o.now(),n=new e.ac(t,{now:r,fadeDuration:l,pitch:i,transition:this.style.transition,worldview:this._worldview});this.style.update(n)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let c=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),c=this._updateAverageElevation(s),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):c=this._updateAverageElevation(s),this.style&&(this._placementDirty=this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,l,this._crossSourceCollisions,this.painter.replacementSource)),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,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.z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,r.mark(i.load),this.fire(new e.z("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),n){const t=e.o.now()-s;a.endQuery(o.TIME_ELAPSED_EXT),setTimeout(()=>{const i=a.getQueryParameter(n,a.QUERY_RESULT)/1e6;a.deleteQuery(n),this.fire(new e.z("gpu-timing-frame",{cpuTime:t,gpuTime:i}))},50)}if(this.listens("gpu-timing-layer")){const t=this.painter.collectGpuTimers();setTimeout(()=>{const i=this.painter.queryGpuTimers(t);this.fire(new e.z("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.z("gpu-timing-deferred-render",{gpuTime:i}))},50)}const h=this._sourcesDirty||this._styleDirty||this._placementDirty||c;if(h||this._repaint)this.triggerRepaint();else{const t=this.idle();if(t&&(c=this._updateAverageElevation(s,!0)),c)this.triggerRepaint();else if(this._triggerFrame(!1),t&&(this.fire(new e.z("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const t=this._calculateSpeedIndex();this.fire(new e.z("speedindexcompleted",{speedIndex:t})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||h||(this._fullyLoaded=!0,r.mark(i.fullLoad),this._performanceMetricsCollection&&j(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(e){for(const t of this._markers)e&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!e||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(e,t=!1){const i=e=>(this.transform.averageElevation=e,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&i(0);const r=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(r||(t||e-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(e)){const t=this.transform.averageElevation;let n=this.transform.sampleAverageElevation();null!=this.transform.elevation&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(n)?n=0:this._averageElevationLastSampledAt=e;const o=Math.abs(t-n);if(o>1){if(this._isInitialLoad||r)return this._averageElevation.jumpTo(n),i(n);this._averageElevation.easeTo(n,e,300)}else if(o>1e-4)return this._averageElevation.jumpTo(n),i(n)}return!!this._averageElevation.isEasing(e)&&i(this._averageElevation.getValue(e))}_authenticate(){q(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,t=>{if(t&&(t.message===w||401===t.status)){const t=this.painter.context.gl;$(t,!1),this._logoControl instanceof kl&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new e.y(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/")))}}),D(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&F(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&B(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){V(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,r=i.createFramebuffer();function n(e){i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0);const t=new Uint8Array(i.drawingBufferWidth*i.drawingBufferHeight*4);return i.readPixels(0,0,i.drawingBufferWidth,i.drawingBufferHeight,i.RGBA,i.UNSIGNED_BYTE,t),t}return i.bindFramebuffer(i.FRAMEBUFFER,r),this._canvasPixelComparison(n(e),t.canvasCopies.map(n),t.timeStamps)}_canvasPixelComparison(e,t,i){let r=i[1]-i[0];const n=e.length/4;for(let o=0;o<t.length;o++){const s=t[o];let a=0;for(let t=0;t<s.length;t+=4)s[t]===e[t]&&s[t+1]===e[t+1]&&s[t+2]===e[t+2]&&s[t+3]===e[t+3]&&(a+=1);r+=(i[o+2]-i[o+1])*(1-a/n)}return r}remove(){this._hash&&this._hash.remove();for(const e of this._controls)e.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),H.delete(this.painter.context.gl),G.remove(),L.remove(),this._removed=!0,this.fire(new e.z("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(t){this._renderNextFrame=this._renderNextFrame||t,this.style&&!this._frame&&(this._frame=e.o.frame(e=>{const t=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,t&&this._render(e)}))}_preloadTiles(t){const i=this.style?this.style.getSourceCaches():[];return e.bw(i,(e,i)=>e._preloadTiles(t,i),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(e){this._trackResize&&this.resize({originalEvent:e})._update()}_onVisibilityChange(){"hidden"===document.visibilityState&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(e){this._showParseStatus!==e&&(this._showParseStatus=e,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(e){this._showTerrainWireframe!==e&&(this._showTerrainWireframe=e,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(e){this._showLayers2DWireframe!==e&&(this._showLayers2DWireframe=e,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(e){this._showLayers3DWireframe!==e&&(this._showLayers3DWireframe=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,this.style&&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.f4(t,i)}get version(){return t}},NavigationControl:class{constructor(t={}){this.options=Object.assign({},Hl,t),this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(e.aY(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",e=>{this._map&&this._map.zoomIn({},{originalEvent:e})}),l("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})}),l("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(e.aY(["_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=l("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const e=this._map;if(!e)return;
vendor: 4,405 bytes, line 2
2const t=e.getZoom(),i=t===e.getMaxZoom(),r=t===e.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())}_rotateCompassArrow(){const e=this._map;if(!e)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(e.transform.pitch*(Math.PI/180)),.5)}) rotateX(${e.transform.pitch}deg) rotateZ(${e.transform.angle*(180/Math.PI)}deg)`:`rotate(${e.transform.angle*(180/Math.PI)}deg)`;e._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=t)})}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),e.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&e.on("pitch",this._rotateCompassArrow),e.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new $l(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=l("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}_setButtonTitle(e,t){if(!this._map)return;const i=this._map._getUIString(`NavigationControl.${t}`);e.setAttribute("aria-label",i),e.firstElementChild&&e.firstElementChild.setAttribute("title",i)}},GeolocateControl:class extends e.E{constructor(t={}){super();const i=navigator.geolocation;this.options=Object.assign({geolocation:i},Kl,t),e.aY(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=La(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(e){return this._map=e,this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._clearRequestTimeout(),void 0!==this._geolocationWatchID&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(e){const t=(t=!!this.options.geolocation)=>{this._supportsGeolocation=t,e(t)};void 0!==this._supportsGeolocation?e(this._supportsGeolocation):void 0!==navigator.permissions?navigator.permissions.query({name:"geolocation"}).then(e=>t("denied"!==e.state)).catch(()=>t()):t()}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),i=e.coords;return!!t&&(i.longitude<t.getWest()||i.longitude>t.getEast()||i.latitude<t.getSouth()||i.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(t){if(this._map){if(this._clearRequestTimeout(),this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.z("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
2RROR":this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this.options.followUserLocation?(this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active")):(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"));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.followUserLocation&&(!this.options.trackUserLocation||"ACTIVE_LOCK"===this._watchState)&&this._updateCamera(t),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new e.z("geolocate",Object.assign({coords:t.coords,timestamp:t.timestamp},t.toJSON?{toJSON:t.toJSON.bind(t)}:{}))),this._finish()}}_updateCamera(t){const i=new e.aT(t.coords.longitude,t.coords.latitude),r=t.coords.accuracy,n=this._map.getBearing(),o=Object.assign({bearing:n},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(r),o,{geolocateSource:!0})}_updateMarker(t){if(t){const i=new e.aT(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.cf(1,t._center.lat)*t.worldSize,r=Math.ceil(2*this._accuracy*i);this._circleElement.style.width=`${r}px`,this._circleElement.style.height=`${r}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(t){if(this._map){if(this._clearRequestTimeout(),this.options.trackUserLocation)if(1===t.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&this._noTimeout)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new e.z("error",{code:t.code,message:t.message,PERMISSION_DENIED:t.PERMISSION_DENIED,POSITION_UNAVAILABLE:t.POSITION_UNAVAILABLE,TIMEOUT:t.TIMEOUT})),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_startRequestTimeout(){this._clearRequestTimeout();const e=this.options.positionOptions.timeout;e&&(this._requestTimeoutId=window.setTimeout(()=>{this._onError({code:3,message:"Geolocation request timed out"})},e))}_clearRequestTimeout(){void 0!==this._requestTimeoutId&&(clearTimeout(this._requestTimeoutId),this._requestTimeoutId=void 0)}_setupUI(t){if(void 0!==this._map){if(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=l("button","mapboxgl-ctrl-geolocate",this._container),l("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===t){e.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
2se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=l("div","mapboxgl-user-location"),this._dotElement.appendChild(l("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(l("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new Yl({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=l("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Yl({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.showButton||(this._container.style.display="none"),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.z("trackuserlocationend")))})}}_onDeviceOrientation(e){this._userLocationDotMarker&&(e.webkitCompassHeading?this._heading=e.webkitCompassHeading:!0===e.absolute&&(this._heading=-1*e.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return e.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new e.z("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.z("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.z("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._startRequestTimeout(),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._startRequestTimeout(),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}setFollowUserLocation(t){return this.options.followUserLocation=null!=t?t:Kl.followUserLocation,this.options.trackUserLocation&&"OFF"!==this._watchState&&(this.options.followUserLocation?"BACKGROUND"!==this._watchState&&"BACKGROUND_ERROR"!==this._watchState||(this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.z("trackuserlocationstart"))):"ACTIVE_LOCK"!==this._watchState&&"ACTIVE_E
2RROR"!==this._watchState||(this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this.fire(new e.z("trackuserlocationend")))),this}_addDeviceOrientationListener(){const e=()=>{const e="ondeviceorientationabsolute"in window?"deviceorientationabsolute":"deviceorientation";window.addEventListener(e,this._onDeviceOrientation)};"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(t=>{"granted"===t&&e()}).catch(console.error):e()}_clearWatch(){this._clearRequestTimeout(),this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Fl,ScaleControl:class{constructor(t={}){this.options=Object.assign({},Jl,t),e.aY(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const e=this.options.maxWidth||100,t=this._map,i=t._containerHeight/2,r=t._containerWidth/2-e/2,n=t.unproject([r,i]),o=t.unproject([r+e,i]),s=n.distanceTo(o);if("imperial"===this.options.unit){const t=3.2808*s;t>5280?this._setScale(e,t/5280,"mile"):this._setScale(e,t,"foot")}else"nautical"===this.options.unit?this._setScale(e,s/1852,"nautical-mile"):s>=1e3?this._setScale(e,s/1e3,"kilometer"):this._setScale(e,s,"meter")}_setScale(e,t,i){this._map._requestDomTask(()=>{const r=function(e){const t=Math.pow(10,`${Math.floor(e)}`.length-1);let i=e/t;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(e){const t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(i),t*i}(t),n=r/t;this._container.innerHTML="nautical-mile"!==i?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:i}).format(r):`${r} ${Ql[i]}`,this._container.style.width=e*n+"px"})}onAdd(e){return this._map=e,this._language=e.getLanguage(),this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-scale",e.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(e){this._language=e,this._update()}setUnit(e){this.options.unit=e,this._update()}},FullscreenControl:class{constructor(t={}){this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:e.w("Full screen control 'container' must be a DOM element.")),e.aY(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=l("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",e.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const e=this._fullscreenButton=l("button","mapboxgl-ctrl-fullscreen",this._controlContainer);l("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",e)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},IndoorControl:Sr,Popup:class extends e.E{constructor(t){super(),this.options=Object.assign(Object.create(ec),t),this._altitude=this.options.altitude,e.aY(["_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.z("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.z("close")),this}getLngLat(){return this._lngLat}setLngLat(t){this._lngLat=e.aT.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}getAltitude(){return this._altitude}setAltitude(e){return this._altitude=e,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const e=this._map;return e&&(e.off("move",this._update),e.on("mousemove",this._onMouseEvent),e.on("drag",this._onMouseEvent),e._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){const t=document.createDocumentFragment(),i=document.createElement("body");let r;for(i.innerHTML=e;r=i.firstChild,r;)t.appendChild(r);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=l("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(e),this.options.closeButton){const e=this._closeButton=l("button","mapboxgl-popup-close-button",t);e.type="button",e.setAttribute("aria-label","Close popup"),e.innerHTML='<span aria-hidden="true">×</span>',e.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(e){return this._classList.add(e),this._updateClassList(),this}removeClassName(e){return this._classList.delete(e),this._updateClassList(),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){let t;return this._classList.delete(e)?t=!1:(this._classList.add(e),t=!0),this._updateClassList(),t}_onMouseEvent(e){this._update(e.point)}_getAnchor(e){if(this.options.anchor)return this.options.anchor;const t=this._map,i=this._container,r=this._pos;if(!t||!i||!r)return"bottom";const n=i.offsetWidth,o=i.offsetHeight,s=r.x<n/2,a=r.x>t.transform.width-n/2;
2if(r.y+e<o)return s?"top-left":a?"top-right":"top";if(r.y>t.transform.height-o){if(s)return"bottom-left";if(a)return"bottom-right"}return s?"left":a?"right":"bottom"}_updateClassList(){const e=this._container;if(!e)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),e.className=t.join(" ")}_update(t){const i=this._map,r=this._content;if(!i||!this._lngLat&&!this._trackPointer||!r)return;let n=this._container;if(n||(n=this._container=l("div","mapboxgl-popup",i.getContainer()),this._tip=l("div","mapboxgl-popup-tip",n),n.appendChild(r)),this.options.maxWidth&&n.style.maxWidth!==this.options.maxWidth&&(n.style.maxWidth=this.options.maxWidth),i.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Zl(this._lngLat,this._pos,i.transform)),!this._trackPointer||t){const r=this._pos=this._trackPointer&&t instanceof e.P?t:i.project(this._lngLat,this._altitude),n=ic(this.options.offset),o=this._anchor=this._getAnchor(n.y),s=ic(this.options.offset,o),a=r.add(s).round();i._requestDomTask(()=>{this._container&&o&&(this._container.style.transform=`${Wl[o]} translate(${a.x}px,${a.y}px)`)})}if(!this._marker&&i._showingGlobe()){const t=e.f5(i.transform,this._lngLat)?0:1;this._setOpacity(t)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(tc);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:Yl,Style:zr,LngLat:e.aT,LngLatBounds:e.aI,Point:e.P,MercatorCoordinate:e.ae,FreeCameraOptions:rr,Evented:e.E,config:e.e,prewarm:e.f9,clearPrewarmedResources:e.f8,get accessToken(){return e.e.ACCESS_TOKEN},set accessToken(t){e.e.ACCESS_TOKEN=t},get baseApiUrl(){return e.e.API_URL},set baseApiUrl(t){e.e.API_URL=t},get workerCount(){return e.fi.workerCount},set workerCount(t){e.fi.workerCount=t},get maxParallelImageRequests(){return e.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){e.e.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(t){e.fh(t)},get workerUrl(){return e.fg.workerUrl},set workerUrl(t){e.fg.workerUrl=t},get workerClass(){return e.fg.workerClass},set workerClass(t){e.fg.workerClass=t},get workerParams(){return e.fg.workerParams},set workerParams(t){e.fg.workerParams=t},get dracoUrl(){return e.ff()},set dracoUrl(t){e.fe(t)},get meshoptUrl(){return e.fd()},set meshoptUrl(t){e.fc(t)},setNow:e.o.setNow,restoreNow:e.o.restoreNow};return rc}),i}()},51153(e,t,i){"use strict";var r=i(41594),n=Symbol.for("react.element"),o=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,i){var r,o={},c=null,h=null;for(r in void 0!==i&&(c=""+i),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(h=t.ref),t)s.call(t,r)&&!l.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===o[r]&&(o[r]=t[r]);return{$$typeof:n,type:e,key:c,ref:h,props:o,_owner:a.current}}t.Fragment=o,t.jsx=c,t.jsxs=c},70579(e,t,i){"use strict";e.exports=i(51153)},13058(e){var t,i;t=this,i=function(){var e=/^([a-zA-Z]{2,3})(?:[_-]+([a-zA-Z]{3})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{4})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{2}|[0-9]{3})(?=$|[_-]+))?/;function t(t){return t.match(e)||[]}function i(e){return{language:(e=t(e))[1]||"",extlang:e[2]||"",script:e[3]||"",region:e[4]||""}}function r(e,t,i){Object.defineProperty(e,t,{value:i,enumerable:!0})}function n(e,n,o){function s(i){return t(i)[e]||""}r(s,"pattern",n),r(i,o,s)}return n(1,/^[a-zA-Z]{2,3}$/,"language"),n(2,/^[a-zA-Z]{3}$/,"extlang"),n(3,/^[a-zA-Z]{4}$/,"script"),n(4,/^[a-zA-Z]{2}$|^[0-9]{3}$/,"region"),r(i,"split",function(e){return t(e).filter(function(e,t){return e&&t})}),i},e.exports?e.exports=i():t.subtag=i()},7053(e,t,i){"use strict";var r=i(25921);e.exports=r,"undefined"!==typeof window&&(window.Suggestions=r)},41438(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<this.items.length;e++)this.drawItem(this.items[e],this.active===e);this.show()}else this.hide()},t.prototype.drawItem=function(e,t){var i=document.createElement("li"),r=document.createElement("a");t&&(i.className+=" active"),r.innerHTML=e.string,i.appendChild(r),this.element.appendChild(i),i.addEventListener("mousedown",function(){this.selectingListItem=!0}.bind(this)),i.addEventListener("mouseup",function(){this.handleMouseUp.call(this,e)}.bind(this))},t.prototype.handleMouseUp=function(e){this.selectingListItem=!1,this.component.value(e.original),this.clear(),this.draw()},t.prototype.move=function(e){this.active=e,this.draw()},t.prototype.previous=function(){this.move(0===this.active?this.items.length-1:this.active-1)},t.prototype.next=function(){this.move(this.active===this.items.length-1?0:this.active+1)},t.prototype.drawError=function(e){var t=document.createElement("li");t.innerHTML=e,this.element.appendChild(t),this.show()},e.exports=t},25921(e,t,i){"use strict";var r=i(60049),n=i(65944),o=i(41438),s=function(e,t,i){return i=i||{},this.options=r({minLength:2,limit:5,filter:!0,hideOnBlur:!0},i),this.el=e,this.data=t||[],this.list=new o(this),this.query="",this.selected=null,this.list.draw(),this.el.addEventListener("keyup",function(e){this.handleKeyUp(e.keyCode)}.bind(this),!1),this.el.addEventListener("keydown",function(e){this.handleKeyDown(e)}.bind(this)),this.el.addEventListener("focus",function(){this.handleFocus()}.bind(this)),this.el.addEventListener("blur",function(){this.handleBlur()}.bind(this)),this.el.addEventListener("paste",function(e){this.handlePaste(e)}.bind(this)),this.render=this.options.render?this.options.render.bind(this):this.render.bind(this),this.getItemV
2alue=this.options.getItemValue?this.options.getItemValue.bind(this):this.getItemValue.bind(this),this};s.prototype.handleKeyUp=function(e){40!==e&&38!==e&&27!==e&&13!==e&&9!==e&&this.handleInputChange(this.el.value)},s.prototype.handleKeyDown=function(e){switch(e.keyCode){case 13:case 9:this.list.isEmpty()||(this.list.isVisible()&&e.preventDefault(),this.value(this.list.items[this.list.active].original),this.list.hide());break;case 27:this.list.isEmpty()||this.list.hide();break;case 38:this.list.previous();break;case 40:this.list.next()}},s.prototype.handleBlur=function(){!this.list.selectingListItem&&this.options.hideOnBlur&&this.list.hide()},s.prototype.handlePaste=function(e){if(e.clipboardData)this.handleInputChange(e.clipboardData.getData("Text"));else{var t=this;setTimeout(function(){t.handleInputChange(e.target.value)},100)}},s.prototype.handleInputChange=function(e){this.query=this.normalize(e),this.list.clear(),this.query.length<this.options.minLength?this.list.draw():this.getCandidates(function(e){for(var t=0;t<e.length&&(this.list.add(e[t]),t!==this.options.limit-1);t++);this.list.draw()}.bind(this))},s.prototype.handleFocus=function(){this.list.isEmpty()||this.list.show(),this.list.selectingListItem=!1},s.prototype.update=function(e){this.data=e,this.handleKeyUp()},s.prototype.clear=function(){this.data=[],this.list.clear()},s.prototype.normalize=function(e){return e=e.toLowerCase()},s.prototype.match=function(e,t){return e.indexOf(t)>-1},s.prototype.value=function(e){if(this.selected=e,this.el.value=this.getItemValue(e),document.createEvent){var t=document.createEvent("HTMLEvents");t.initEvent("change",!0,!1),this.el.dispatchEvent(t)}else this.el.fireEvent("onchange")},s.prototype.getCandidates=function(e){var t={pre:"<strong>",post:"</strong>",extract:function(e){return this.getItemValue(e)}.bind(this)};e(this.options.filter?n.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)))}
2,s.prototype.getItemValue=function(e){return e},s.prototype.render=function(e,t){if(t)return t;for(var i=e.original?this.getItemValue(e.original):this.getItemValue(e),r=this.normalize(i),n=r.lastIndexOf(this.query);n>-1;){var o=n+this.query.length;i=i.slice(0,n)+"<strong>"+i.slice(n,o)+"</strong>"+i.slice(o),n=r.slice(0,n).lastIndexOf(this.query)}return i},s.prototype.renderError=function(e){this.list.drawError(e)},e.exports=s},60049(e){e.exports=function(){for(var e={},i=0;i<arguments.length;i++){var r=arguments[i];for(var n in r)t.call(r,n)&&(e[n]=r[n])}return e};var t=Object.prototype.hasOwnProperty},84189(){"use strict"},89379(e,t,i){"use strict";i.d(t,{A:()=>o});var r=i(64467);function n(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function o(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?n(Object(i),!0).forEach(function(t){(0,r.A)(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}},19452(e,t,i){"use strict";i.d(t,{Ak:()=>r});let r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:21;return crypto.getRandomValues(new Uint8Array(e)).reduce((e,t)=>e+=(t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_","")}}}]); 3//# sourceMappingURL=9587.4063216a.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.