/*! Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements. * Licensed under the Elastic License 2.0; you may not use this file except in compliance with the Elastic License 2.0. */ (window.maps_bundle_jsonpfunction=window.maps_bundle_jsonpfunction||[]).push([[0,13],Array(72).concat([function(t,e,i){"use strict";i.d(e,"f",(function(){return n})),i.d(e,"e",(function(){return A})),i.d(e,"d",(function(){return P})),i.d(e,"a",(function(){return blended_vector_layer_BlendedVectorLayer})),i.d(e,"b",(function(){return geojson_vector_layer_GeoJsonVectorLayer})),i.d(e,"c",(function(){return mvt_vector_layer_MvtVectorLayer})),i.d(e,"g",(function(){return ct}));var r=i(0);async function n({layerId:t,syncContext:e,source:i,sourceQuery:n}){const{startLoading:o,stopLoading:a,registerCancelCallback:l,dataFilters:c,isFeatureEditorOpenForLayer:u}=e,h=Symbol(`${r.wb}-${t}`),p={sourceQuery:n||void 0,query:c.query,timeFilters:c.timeFilters,timeslice:c.timeslice,embeddableSearchContext:c.embeddableSearchContext,filters:c.filters,joinKeyFilter:c.joinKeyFilter,applyGlobalQuery:i.getApplyGlobalQuery(),applyGlobalTime:i.getApplyGlobalTime(),isFeatureEditorOpenForLayer:u,executionContext:c.executionContext};let d=null;try{o(r.wb,h,p),d=await i.getBoundsForFilters(p,l.bind(null,h))}finally{a(r.wb,h,d||{})}return d}var o=i(2),a=i.n(o),l=i(4),c=i.n(l),u=i(41),h=i(39),p=i.n(h),d=i(14),f=i(1),m=i(106),g=i(82),y=i(52),_=i(3);class term_join_key_label_TermJoinKeyLabel extends l.Component{constructor(...t){super(...t),a()(this,"_isMounted",!1),a()(this,"state",{rightSourceLabels:[]})}componentDidMount(){this._isMounted=!0,this._loadRightSourceLabels()}componentWillUnmount(){this._isMounted=!1}async _loadRightSourceLabels(){const t=await Object(y.asyncMap)(this.props.termJoins,(async t=>{const e=t.getTermField();return`'${await e.getLabel()}'`}));this._isMounted&&this.setState({rightSourceLabels:t})}render(){if(0===this.state.rightSourceLabels.length)return this.props.leftFieldName;const t=f.i18n.translate("xpack.maps.tooltip.joinPropertyTooltipContent",{defaultMessage:"Shared key '{leftFieldName}' is joined with {rightSources}",values:{leftFieldName:this.props.leftFieldName,rightSources:this.state.rightSourceLabels.join(",")}});return Object(_.jsx)(c.a.Fragment,null,this.props.leftFieldName,Object(_.jsx)(d.EuiToolTip,{position:"bottom",content:t},Object(_.jsx)(d.EuiIcon,{type:"link"})))}}class term_join_tooltip_property_TermJoinTooltipProperty{constructor(t,e){a()(this,"_tooltipProperty",void 0),a()(this,"_termJoins",void 0),this._tooltipProperty=t,this._termJoins=e}isFilterable(){return!0}getPropertyKey(){return this._tooltipProperty.getPropertyKey()}getPropertyName(){return Object(_.jsx)(term_join_key_label_TermJoinKeyLabel,{leftFieldName:this._tooltipProperty.getPropertyName(),termJoins:this._termJoins})}getRawValue(){return this._tooltipProperty.getRawValue()}getHtmlDisplayValue(){return this._tooltipProperty.getHtmlDisplayValue()}async getESFilters(){const t=[];for(let e=0;e{var i;if(!t.right)return;const n=t.right,o=null!==(i=n.id)&&void 0!==i?i:"",a=Object(u.v4)();var l;(t.right.id=a,e.style&&"properties"in e.style)&&(null!==(l=n.metrics)&&void 0!==l?l:[{type:r.b.COUNT}]).forEach((t=>{const i=Object(M.a)({aggType:t.type,aggFieldName:"field"in t?t.field:"",rightSourceId:o}),n=Object(M.a)({aggType:t.type,aggFieldName:"field"in t?t.field:"",rightSourceId:a});Object.keys(e.style.properties).forEach((t=>{const o=e.style.properties[t];if("type"in o&&o.type===r.Cb.DYNAMIC){const t=o.options;t.field&&t.field.origin===r.D.JOIN&&t.field.name===i&&(t.field.name=n)}}))}))})),[e]}getSource(){return super.getSource()}getStyleForEditing(){return this._style}getStyle(){return this._style}getCurrentStyle(){return this._style}getJoins(){return this._joins.slice()}getValidJoins(){return this.getJoins().filter((t=>t.hasCompleteConfig()))}supportsFeatureEditing(){const t=this.getDataRequest(E),e=null==t?void 0:t.getData();return!!e&&e.supportsFeatureEditing}hasJoins(){return this.getValidJoins().length>0}_isLoadingJoins(){return this.getValidJoins().some((t=>{const e=this.getDataRequest(t.getSourceDataRequestId());return!e||e.isLoading()}))}getLayerIcon(t){throw new Error("Should implement AbstractVectorLayer#getLayerIcon")}getLayerTypeIconName(){return"vector"}async hasLegendDetails(){return this.getCurrentStyle().hasLegendDetails()}renderLegendDetails(){return this.getCurrentStyle().renderLegendDetails()}async getBounds(t){return n({layerId:this.getId(),syncContext:t(this.getId()),source:this.getSource(),sourceQuery:this.getQuery()})}async getLeftJoinFields(){return await this.getSource().getLeftJoinFields()}_getJoinFields(){const t=[];return this.getValidJoins().forEach((e=>{const i=e.getJoinFields();t.push(...i)})),t}async getFields(){return[...await this.getSource().getFields(),...this._getJoinFields()]}async getStyleEditorFields(){return[...await this.getSourceForEditing().getFields(),...this._getJoinFields()]}getIndexPatternIds(){const t=this.getSource().getIndexPatternIds();return this.getValidJoins().forEach((e=>{t.push(...e.getIndexPatternIds())})),t}getQueryableIndexPatternIds(){const t=this.getSource().getQueryableIndexPatternIds();return this.getValidJoins().forEach((e=>{t.push(...e.getQueryableIndexPatternIds())})),t}async isFilteredByGlobalTime(){if(this.getSource().getApplyGlobalTime()&&await this.getSource().isTimeAware())return!0;const t=this.getValidJoins().map((async t=>t.getRightJoinSource().getApplyGlobalTime()&&await t.getRightJoinSource().isTimeAware()));return(await Promise.all(t)).some((t=>t))}async _getVectorSourceRequestMeta(t,e,i,r,n){const o=[...r.getSourceFieldNames(),...this.getValidJoins().filter((t=>!Object(w.a)(t.toDescriptor()))).map((t=>t.getLeftField().getName()))],a=await i.getTimesliceMaskFieldName();return a&&o.push(a),Object(S.a)(i,o,e,this.getQuery(),t,n)}async _syncSourceStyleMeta(t,e,i){const n=this.getQuery();return this._syncStyleMeta({source:e,style:i,sourceQuery:n||void 0,dataRequestId:r.zb,dynamicStyleProps:i.getDynamicPropertiesArray().filter((t=>t.getFieldOrigin()===r.D.SOURCE&&t.isFieldMetaEnabled())),...t})}async _syncStyleMeta({source:t,style:e,sourceQuery:i,dataRequestId:r,dynamicStyleProps:n,dataFilters:o,startLoading:a,stopLoading:l,onLoadError:c,registerCancelCallback:u,inspectorAdapters:h}){if(!t.isESSource()||0===n.length)return;const d=n.map((t=>`${t.getFieldName()}${t.getStyleMetaHash()}`)),f={dynamicStyleFields:p.a.uniq(d).sort(),sourceQuery:i,isTimeAware:this.getCurrentStyle().isTimeAware()&&await t.isTimeAware(),timeFilters:o.timeFilters,searchSessionId:o.searchSessionId},m=this.getDataRequest(r);if(Object(x.c)({prevDataRequest:m,nextMeta:f}))return;const g=Symbol(`layer-${this.getId()}-${r}`);try{a(r,g,f);const i=await this.getDisplayName(t);l(r,g,await t.loadStylePropsMeta({layerName:i,style:e,dynamicStyleProps:n,registerCancelCallback:u.bind(null,g),sourceQuery:f.sourceQuery,timeFilters:f.timeFilters,searchSessionId:o.searchSessionId,inspectorAdapters:h,executionContext:o.executionContext}),f)}catch(t){throw t instanceof v.b||c(r,g,t.message),t}}async _syncSourceFormatters(t,e,i){return this._syncFormatters({source:e,dataRequestId:r.yb,fields:i.getDynamicPropertiesArray().filter((t=>t.getFieldOrigin()===r.D.SOURCE)).map((t=>t.getField())),...t})}async _syncFormatters({source:t,dataRequestId:e,fields:i,startLoading:r,stopLoading:n,onLoadError:o}){if(0===i.length)return;const a=i.map((t=>t.getName())),l={fieldNames:p.a.uniq(a).sort()},c=this.getDataRequest(e);if(Object(x.a)({prevDataRequest:c,nextMeta:l}))return;const u=Symbol(`layer-${this.getId()}-${e}`);try{r(e,u,l);const o={},a=i.filter((t=>t.canValueBeFormatted())).map((async e=>{o[e.getName()]=await t.createFieldFormatter(e)}));await Promise.all(a),n(e,u,o,l)}catch(t){throw o(e,u,t.message),t}}async _syncJoin({join:t,featureCollection:e,startLoading:i,stopLoading:r,onLoadError:n,registerCancelCallback:o,dataFilters:a,isForceRefresh:l,isFeatureEditorOpenForLayer:c,inspectorAdapters:u}){const h=t.getRightJoinSource(),p=t.getSourceDataRequestId(),d=Symbol(`layer-join-refresh:${this.getId()} - ${p}`),f=Object(S.a)(h,[],a,h.getWhereQuery(),l,c),m=this.getDataRequest(p);if(await Object(x.b)({source:h,prevDataRequest:m,nextRequestMeta:f,extentAware:!1,getUpdateDueToTimeslice:()=>!0}))return{dataHasChanged:!1,join:t,propertiesMap:null==m?void 0:m.getData()};try{i(p,d,f);const n=await this._source.getDisplayName(),a=await h.getPropertiesMap(f,n,t.getLeftField().getName(),o.bind(null,d),u,e);return r(p,d,a),{dataHasChanged:!0,join:t,propertiesMap:a}}catch(t){throw t instanceof v.b||n(p,d,`Join error: ${t.message}`),t}}async _syncJoins(t,e,i){const r=this.getValidJoins().map((async r=>(await this._syncJoinStyleMeta(t,r,e),await this._syncJoinFormatters(t,r,e),this._syncJoin({join:r,featureCollection:i,...t}))));return await Promise.all(r)}async _syncJoinStyleMeta(t,e,i){const n=e.getRightJoinSource();return this._syncStyleMeta({source:n,style:i,sourceQuery:n.getWhereQuery(),dataRequestId:e.getSourceMetaDataRequestId(),dynamicStyleProps:this.getCurrentStyle().getDynamicPropertiesArray().filter((t=>{const e=n.getFieldByName(t.getFieldName());return t.getFieldOrigin()===r.D.JOIN&&!!e&&t.isFieldMetaEnabled()})),...t})}async _syncJoinFormatters(t,e,i){const n=e.getRightJoinSource();return this._syncFormatters({source:n,dataRequestId:e.getSourceFormattersDataRequestId(),fields:i.getDynamicPropertiesArray().filter((t=>{const e=n.getFieldByName(t.getFieldName());return t.getFieldOrigin()===r.D.JOIN&&!!e})).map((t=>t.getField())),...t})}async _syncSupportsFeatureEditing({syncContext:t,source:e}){if(t.dataFilters.isReadOnly)return;const{startLoading:i,stopLoading:r,onLoadError:n}=t,o=E,a=Symbol(`layer-${this.getId()}-${o}`);if(!this.getDataRequest(o))try{i(o,a),r(o,a,{supportsFeatureEditing:await e.supportsFeatureEditing()})}catch(t){throw n(o,a,t.message),t}}_getJoinFilterExpression(){}_createMasks(){const t=[],e=this.getSource();return"getMetricFields"in e&&e.getMetricFields().forEach((i=>{const r=i.getMask();r&&t.push(new T.d({esAggField:i,isGeometrySourceMvt:e.isMvt(),...r}))})),this.getValidJoins().forEach((i=>{const r=i.getRightJoinSource();"getMetricFields"in r&&r.getMetricFields().forEach((i=>{const r=i.getMask();r&&t.push(new T.d({esAggField:i,isGeometrySourceMvt:e.isMvt(),...r}))}))})),t}getMasks(){return this._masks}_getAlphaExpression(){const t=[];return this.getMasks().forEach((e=>{t.push(e.getMatchMaskedExpression()),t.push(0)})),t.length?["case",...t,this.getAlpha()]:this.getAlpha()}_setMbPointsProperties(t,e,i){const r=this.getId(),n=this._getMbLabelLayerId(),o=this._getMbPointLayerId(),a=this._getMbSymbolLayerId(),l=t.getLayer(o),c=t.getLayer(a);let u;if(this.getCurrentStyle().arePointsSymbolizedAsCircles()){if(u=o,!l){const i={id:o,type:"circle",source:r,paint:{}};e&&(i["source-layer"]=e),t.addLayer(i,n)}c&&t.setLayoutProperty(a,"visibility","none")}else{if(u=a,!c){const i={id:a,type:"symbol",source:r};e&&(i["source-layer"]=e),t.addLayer(i,n)}l&&t.setLayoutProperty(o,"visibility","none")}const h=!this.getSource().isMvt(),d=Object(b.e)(h,this.getSource().isESSource(),this._getJoinFilterExpression(),i);p.a.isEqual(d,t.getFilter(u))||t.setFilter(u,d),this.getCurrentStyle().arePointsSymbolizedAsCircles()?this.getCurrentStyle().setMBPaintPropertiesForPoints({alpha:this._getAlphaExpression(),mbMap:t,pointLayerId:u}):this.getCurrentStyle().setMBSymbolPropertiesForPoints({alpha:this._getAlphaExpression(),mbMap:t,symbolLayerId:u}),this.syncVisibilityWithMb(t,u),t.setLayerZoomRange(u,this.getMinZoom(),this.getMaxZoom())}_setMbLinePolygonProperties(t,e,i){const r=this.getId(),n=this._getMbLabelLayerId(),o=this._getMbPolygonLayerId(),a=this._getMbLineLayerId();if(!t.getLayer(o)){const i={id:o,type:"fill",source:r,paint:{}};e&&(i["source-layer"]=e),t.addLayer(i,n)}if(!t.getLayer(a)){const i={id:a,type:"line",source:r,paint:{}};e&&(i["source-layer"]=e),t.addLayer(i,n)}this.getCurrentStyle().setMBPaintProperties({alpha:this._getAlphaExpression(),mbMap:t,fillLayerId:o,lineLayerId:a});const l=this._getJoinFilterExpression();this.syncVisibilityWithMb(t,o),t.setLayerZoomRange(o,this.getMinZoom(),this.getMaxZoom());const c=Object(b.b)(l,i);p.a.isEqual(c,t.getFilter(o))||t.setFilter(o,c),this.syncVisibilityWithMb(t,a),t.setLayerZoomRange(a,this.getMinZoom(),this.getMaxZoom());const u=Object(b.d)(l,i);p.a.isEqual(u,t.getFilter(a))||t.setFilter(a,u)}_setMbLabelProperties(t,e,i){const r=this._getMbLabelLayerId();if(!t.getLayer(r)){const i={id:r,type:"symbol",source:this.getId()};e&&(i["source-layer"]=e),t.addLayer(i)}const n=!this.getSource().isMvt(),o=Object(b.c)(n,this.getSource().isESSource(),this._getJoinFilterExpression(),i);p.a.isEqual(o,t.getFilter(r))||t.setFilter(r,o),this.getCurrentStyle().setMBPropertiesForLabelText({alpha:this._getAlphaExpression(),mbMap:t,textLayerId:r}),this.syncVisibilityWithMb(t,r)}_getMbPointLayerId(){return this.makeMbLayerId("circle")}_getMbLabelLayerId(){return this.makeMbLayerId("label")}_getMbSymbolLayerId(){return this.makeMbLayerId("symbol")}_getMbLineLayerId(){return this.makeMbLayerId("line")}_getMbPolygonLayerId(){return this.makeMbLayerId("fill")}getMbTooltipLayerIds(){return[this._getMbPointLayerId(),this._getMbLabelLayerId(),this._getMbSymbolLayerId(),this._getMbLineLayerId(),this._getMbPolygonLayerId()]}getMbLayerIds(){return this.getMbTooltipLayerIds()}ownsMbLayerId(t){return this.getMbLayerIds().includes(t)}ownsMbSourceId(t){return this.getId()===t}_addJoinsToSourceTooltips(t){for(let e=0;e0}areTooltipsDisabled(){var t;return null!==(t=this._descriptor.disableTooltips)&&void 0!==t&&t}getFeatureId(t){throw new Error("Should implement AbstractVectorLayer#getFeatureId")}getFeatureById(t){throw new Error("Should implement AbstractVectorLayer#getFeatureById")}async getLicensedFeatures(){return await this._source.getLicensedFeatures()}async addFeature(t){const e=this.getSource();await e.addFeature(t)}async deleteFeature(t){const e=this.getSource();await e.deleteFeature(t)}async getStyleMetaDescriptorFromLocalFeatures(){throw new Error("Should implement AbstractVectorLayer#getStyleMetaDescriptorFromLocalFeatures")}}var O=i(277),k=i(468),F=i.n(k),D=i(470),z=i.n(D),j=i(471),N=i.n(j),B=i(479),V=i.n(B),U=i(86);function H(t){let e=null;if(t.geometry.type===r.J.LINE_STRING)e=G(t);else if(t.geometry.type===r.J.MULTI_LINE_STRING){const i=t.geometry.coordinates;let r=i[0],n=V()(Object(U.lineString)(r));for(let t=1;tn&&(r=e,n=o)}e=G(Object(U.lineString)(r))}else if(t.geometry.type===r.J.POLYGON)e=N()(t).geometry;else if(t.geometry.type===r.J.MULTI_POLYGON){const i=t.geometry.coordinates;let r=i[0],n=z()(Object(U.polygon)(r));for(let t=1;tn&&(r=e,n=o)}e=N()(Object(U.polygon)(r)).geometry}else if(t.geometry.type===r.J.GEOMETRY_COLLECTION&&t.geometry.geometries.length){const i=t.geometry.geometries[0];if(i.type===r.J.POINT)e=i;else{if(i.type!==r.J.MULTI_POINT)return H({...t,geometry:i});e={type:"Point",coordinates:i.coordinates[0]}}}return e?{type:"Feature",id:t.id,properties:{...t.properties,[r.U]:!0},geometry:e}:null}function G(t){const e=V()(t);return F()(t,e/2).geometry}let q=0;function Z(){const t=q{const n=i[r];return r===t?e&&n:e&&!n}),!0)}class geojson_vector_layer_GeoJsonVectorLayer extends vector_layer_AbstractVectorLayer{static createDescriptor(t,e){const i=super.createDescriptor(t);if(i.type=r.Z.GEOJSON_VECTOR,!t.style){const t=g.a.createDefaultStyleProperties(e||[]);i.style=g.a.createDescriptor(t)}return t.joins||(i.joins=[]),i}isLayerLoading(t){var e;if(super.isLayerLoading(t))return!0;const i=this._getSourceFeatureCollection();return!(!i||0===(null==i||null===(e=i.features)||void 0===e?void 0:e.length))&&this._isLoadingJoins()}_isTiled(){return!1}async getBounds(t){return!this.getSource().isBoundsAware()||this.hasJoins()?Object(O.a)(this._getSourceFeatureCollection(),this.hasJoins()):super.getBounds(t)}getLayerIcon(t){const e=this._getSourceFeatureCollection();if(!e||0===e.features.length)return P;if(this.getJoins().length&&!e.features.some((t=>{var e;return null===(e=t.properties)||void 0===e?void 0:e[r.C]})))return{icon:I,tooltipContent:f.i18n.translate("xpack.maps.vectorLayer.noResultsFoundInJoinTooltip",{defaultMessage:"No matching results found in term joins"})};const i=this.getSourceDataRequest(),{tooltipContent:n,areResultsTrimmed:o,isDeprecated:a}=this.getSource().getSourceStatus(i);return{icon:a?Object(_.jsx)(d.EuiIcon,{type:"warning",color:"danger"}):this.getCurrentStyle().getIcon(t&&o),tooltipContent:n,areResultsTrimmed:o}}getFeatureId(t){var e;return null===(e=t.properties)||void 0===e?void 0:e[r.H]}getFeatureById(t){const e=this._getSourceFeatureCollection();if(!e)return null;return e.features.find((e=>this.getFeatureId(e)===t))||null}async getStyleMetaDescriptorFromLocalFeatures(){const t=this.getSourceDataRequest();return this.getCurrentStyle()&&t?await async function(t,e,i){const n={[r.Fb.POINT]:!1,[r.Fb.LINE]:!1,[r.Fb.POLYGON]:!1};if(e.length>1)for(let e=0;e{const i=e.getFieldName();a.fieldMeta[i]||(a.fieldMeta[i]={categories:[]});const r=function(t,e){const i=t.getNumberOfCategories();if(!t.isCategorical()||i<=0)return[];const r=new Map;for(let i=0;ie.count-t.count)),n.length<=i)return n;const o=n.slice(0,i);let a=0;for(let t=i;tf(m,g)),o.inspectorAdapters),l=function(t){const e=[];for(let i=0;ithis._getUpdateDueToTimesliceFromSourceRequestMeta(e,t)});if(await this._syncSupportsFeatureEditing({syncContext:t,source:e}),!n.featureCollection||!n.featureCollection.features.length||!this.hasJoins())return;const o=await this._syncJoins(t,i,n.featureCollection);await async function(t,e,i,n){let o=t.refreshed||e.some((t=>t.dataHasChanged));if(!o)return;const a=e.map((t=>({joinedWithAtLeastOneFeature:!1,keys:[],joinState:t})));for(let c=0;c{if(!Object(C.f)(t.joinState.join.getRightJoinSource()))return!1;const e=t.joinState.propertiesMap&&t.joinState.propertiesMap.size>0;return!t.joinedWithAtLeastOneFeature&&e}));if(l.length){function x(t){return t.length<=5?t.join(","):t.slice(0,5).join(",")+f.i18n.translate("xpack.maps.vectorLayer.joinError.firstTenMsg",{defaultMessage:" (5 of {total})",values:{total:t.length}})}const b=l[0],w=await b.joinState.join.getLeftField().getLabel(),S=b.joinState.join.getRightJoinSource(),M=await S.getTermField().getLabel(),T=0===b.keys.length?f.i18n.translate("xpack.maps.vectorLayer.joinError.noLeftFieldValuesMsg",{defaultMessage:"Left field: '{leftFieldName}', does not provide any values.",values:{leftFieldName:w}}):f.i18n.translate("xpack.maps.vectorLayer.joinError.noMatchesMsg",{defaultMessage:"Left field values do not match right field values. Left field: '{leftFieldName}' has values { leftFieldValues }. Right field: '{rightFieldName}' has values: { rightFieldValues }.",values:{leftFieldName:w,leftFieldValues:x(b.keys),rightFieldName:M,rightFieldValues:x(Array.from(b.joinState.propertiesMap.keys()))}});n(f.i18n.translate("xpack.maps.vectorLayer.joinErrorMsg",{defaultMessage:"Unable to perform term join. {reason}",values:{reason:T}}))}}(n,o,t.updateSourceData,t.onJoinError)}catch(t){if(!(t instanceof v.b))throw t}}_getSourceFeatureCollection(){const t=this.getSourceDataRequest();return t?t.getData():null}_getUpdateDueToTimesliceFromSourceRequestMeta(t,e){const i=this.getSourceDataRequest(),r=null==i?void 0:i.getMeta();return!r||t.getUpdateDueToTimeslice(r,e)}}var J=i(79),tt=i(104),et=i(214);const it="ACTIVE_COUNT_DATA_ID";function ot(t){return t.isOrdinal()?r.b.AVG:r.b.TERMS}class blended_vector_layer_BlendedVectorLayer extends geojson_vector_layer_GeoJsonVectorLayer{static createDescriptor(t,e){const i=geojson_vector_layer_GeoJsonVectorLayer.createDescriptor(t,e);return i.type=r.Z.BLENDED_VECTOR,i}constructor(t){super({...t,joins:[]}),a()(this,"_isClustered",void 0),a()(this,"_clusterSource",void 0),a()(this,"_clusterStyle",void 0),a()(this,"_documentSource",void 0),a()(this,"_documentStyle",void 0),a()(this,"getSource",(()=>this._isClustered?this._clusterSource:this._documentSource)),this._documentSource=this._source,this._documentStyle=this._style,this._clusterSource=function(t,e){const i=tt.a.createDescriptor({indexPatternId:t.getIndexPatternId(),geoField:t.getGeoFieldName(),requestType:r.tb.POINT,resolution:r.L.COARSE});return i.applyGlobalQuery=t.getApplyGlobalQuery(),i.applyGlobalTime=t.getApplyGlobalTime(),i.applyForceRefresh=t.getApplyForceRefresh(),i.metrics=[{type:r.b.COUNT},...e.getDynamicPropertiesArray().map((t=>({type:ot(t),field:t.getFieldName()})))],i.id=t.getId(),new tt.a(i)}(this._documentSource,this._documentStyle);const e=function(t,e){const i=Object(J.i)(),n={type:r.Y.VECTOR,properties:{[r.Gb.LABEL_TEXT]:{type:r.Cb.DYNAMIC,options:{...i[r.Gb.LABEL_TEXT].options,field:{name:r.k,origin:r.D.SOURCE}}},[r.Gb.ICON_SIZE]:{type:r.Cb.DYNAMIC,options:{...i[r.Gb.ICON_SIZE].options,field:{name:r.k,origin:r.D.SOURCE}}}},isTimeAware:!0};return t.getAllStyleProperties().forEach((t=>{const i=t.getStyleName();if(![r.Gb.LABEL_TEXT,r.Gb.ICON_SIZE].includes(i)||t.isDynamic()&&t.isComplete())if(i===r.Gb.SYMBOLIZE_AS||i===r.Gb.LABEL_BORDER_SIZE)n.properties[i]={options:{...t.getOptions()}};else if(t.isDynamic()){const o=t.getOptions(),a=o&&o.field&&o.field.name?{...o.field,name:e.getAggKey(ot(t),o.field.name)}:void 0;n.properties[i]={type:r.Cb.DYNAMIC,options:{...o,field:a}}}else n.properties[i]={type:r.Cb.STATIC,options:{...t.getOptions()}}})),n}(this._documentStyle,this._clusterSource);this._clusterStyle=new g.a(e,this._clusterSource,this,t.customIcons,t.chartsPaletteServiceGetColor);let i=!1;const n=this.getDataRequest(it);if(n){const t=n.getData();t&&t.isSyncClustered&&(i=!0)}this._isClustered=i}async getDisplayName(t){const e=await super.getDisplayName(t);return this._isClustered?f.i18n.translate("xpack.maps.blendedVectorLayer.clusteredLayerName",{defaultMessage:"Clustered {displayName}",values:{displayName:e}}):e}getJoins(){return[]}hasJoins(){return!1}async cloneDescriptor(){const t=await super.cloneDescriptor();if(0===t.length)return[];const e=t[0],i=await super.getDisplayName();return e.label=`Clone of ${i}`,e.sourceDescriptor=this._documentSource.cloneDescriptor(),[e]}getSourceForEditing(){return this._documentSource}getCurrentStyle(){return this._isClustered?this._clusterStyle:this._documentStyle}getStyleForEditing(){return this._documentStyle}async syncData(t){const e=it,i=Symbol(`layer-active-count:${this.getId()}`),r=await this._getVectorSourceRequestMeta(t.isForceRefresh,t.dataFilters,this.getSource(),this.getCurrentStyle(),t.isFeatureEditorOpenForLayer),n=this.getSource();let o,a;if(await Object(x.b)({source:n,prevDataRequest:this.getDataRequest(e),nextRequestMeta:r,extentAware:n.isFilterByMapBounds(),getUpdateDueToTimeslice:t=>this._getUpdateDueToTimesliceFromSourceRequestMeta(n,t)}))this._isClustered?(o=this._clusterSource,a=this._clusterStyle):(o=this._documentSource,a=this._documentStyle);else{let n;try{t.startLoading(e,i,r),n=!await this._documentSource.canLoadAllDocuments(r,t.registerCancelCallback.bind(null,i)),t.stopLoading(e,i,{isSyncClustered:n},r)}catch(r){return void(r instanceof v.b&&Object(et.b)(r)||t.onLoadError(e,i,r.message))}n?(o=this._clusterSource,a=this._clusterStyle):(o=this._documentSource,a=this._documentStyle)}super._syncData(t,o,a)}async getLicensedFeatures(){return[...await this._clusterSource.getLicensedFeatures(),...await this._documentSource.getLicensedFeatures()]}}var at=i(44),lt=i(76);async function ct({buffer:t,hasLabels:e,layerId:i,layerName:n,prevDataRequest:o,requestMeta:a,source:l,syncContext:c}){const h=Symbol(`${i}-${r.xb}`),p=o?o.getData():void 0;if(p){const i=p.tileSourceLayer===l.getTileSourceLayer()&&p.tileMinZoom===l.getMinZoom()&&p.tileMaxZoom===l.getMaxZoom(),r=await Object(x.b)({extentAware:!1,source:l,prevDataRequest:o,nextRequestMeta:a,getUpdateDueToTimeslice:t=>!0});if(!c.forceRefreshDueToDrawing&&i&&r&&p.hasLabels===e&&p.buffer===t)return}c.startLoading(r.xb,h,a);try{const o=!p||c.forceRefreshDueToDrawing||a.isForceRefresh&&a.applyForceRefresh?Object(u.v4)():p.refreshToken,d=await l.getTileUrl(a,o,e,t);l.isESSource()&&c.inspectorAdapters.vectorTiles.addLayer(i,n,d);const f={tileUrl:d,tileSourceLayer:l.getTileSourceLayer(),tileMinZoom:l.getMinZoom(),tileMaxZoom:l.getMaxZoom(),refreshToken:o,hasLabels:e,buffer:t};c.stopLoading(r.xb,h,f,{})}catch(t){c.onLoadError(r.xb,h,t.message)}}var ut=i(132);const ht="maxResultWindow";class mvt_vector_layer_MvtVectorLayer extends vector_layer_AbstractVectorLayer{static createDescriptor(t,e){const i=super.createDescriptor(t,e);if(i.type=r.Z.MVT_VECTOR,!i.style){const t=g.a.createDefaultStyleProperties(e||[]);i.style=g.a.createDescriptor(t)}return i}constructor(t){super(t),a()(this,"_source",void 0),this._source=t.source}isLayerLoading(t){return!!super.isLayerLoading(t)||this._isLoadingJoins()}_isTiled(){return!0}async getBounds(t){let e;if(this.getSource().isESSource()){const{join:t,joinPropertiesMap:i}=this._getJoinResults();if(t&&i){const r=await this.getSource().getIndexPattern(),n=Object(lt.l)(r,t.getLeftField().getName());e=Object(at.buildPhrasesFilter)(n,Array.from(i.keys()),r)}}const i=t(this.getId());return n({layerId:this.getId(),syncContext:{...i,dataFilters:{...i.dataFilters,joinKeyFilter:e}},source:this.getSource(),sourceQuery:this.getQuery()})}getFeatureId(t){var e,i;return this.getSource().isESSource()?this.getSource().getType()===r.Ab.ES_SEARCH?null===(e=t.properties)||void 0===e?void 0:e._id:null===(i=t.properties)||void 0===i?void 0:i._key:t.id}getLayerIcon(t){if(!this.getSource().isESSource())return{icon:this.getCurrentStyle().getIcon(!1),tooltipContent:null,areResultsTrimmed:!1};if(this.getSource().getType()===r.Ab.ES_GEO_GRID){const{docCount:t}=Object(ut.e)(this._getMetaFromTiles());return 0===t?P:{icon:this.getCurrentStyle().getIcon(!1),tooltipContent:null,areResultsTrimmed:!1}}const e=this._getMaxResultWindow();if(void 0===e)return{icon:this.getCurrentStyle().getIcon(!1),tooltipContent:null,areResultsTrimmed:!1};const{totalFeaturesCount:i,tilesWithFeatures:n,tilesWithTrimmedResults:o}=Object(ut.f)(this._getMetaFromTiles(),e);if(0===i)return P;const a=o>0,l=!this.getStyle().getIsPointsOnly()&&i>1&&n>1,c=l?"~":"",u=a?f.i18n.translate("xpack.maps.tiles.resultsTrimmedMsg",{defaultMessage:"Results limited to {countPrefix}{count} documents.",values:{count:i.toLocaleString(),countPrefix:c}}):f.i18n.translate("xpack.maps.tiles.resultsCompleteMsg",{defaultMessage:"Found {countPrefix}{count} documents.",values:{count:i.toLocaleString(),countPrefix:c}}),h=l?u+f.i18n.translate("xpack.maps.tiles.shapeCountMsg",{defaultMessage:" This count is approximate."}):u;return{icon:this.getCurrentStyle().getIcon(t&&a),tooltipContent:h,areResultsTrimmed:a}}_getMaxResultWindow(){const t=this.getDataRequest(ht);if(!t)return;const e=t.getData();return e?e.maxResultWindow:void 0}async _syncMaxResultWindow({startLoading:t,stopLoading:e}){if(this.getDataRequest(ht))return;const i=Symbol(`${this.getId()}-${ht}`);t(ht,i);const r=await this.getSource().getMaxResultWindow();e(ht,i,{maxResultWindow:r})}async syncData(t){this.getSource().getType()===r.Ab.ES_SEARCH&&await this._syncMaxResultWindow(t),await this._syncSourceStyleMeta(t,this.getSource(),this.getCurrentStyle()),await this._syncSourceFormatters(t,this.getSource(),this.getCurrentStyle()),await this._syncSupportsFeatureEditing({syncContext:t,source:this.getSource()});let e=0;const i=this.getCurrentStyle().getAllStyleProperties().find((t=>t.getStyleName()===r.Gb.LINE_WIDTH));i&&(!i.isDynamic()&&i.isComplete()?e=i.getOptions().size:i.isDynamic()&&i.isComplete()&&(e=i.getOptions().maxSize));const n=Math.ceil(3.5*e);await ct({buffer:n,hasLabels:this.getCurrentStyle().hasLabels(),layerId:this.getId(),layerName:await this.getDisplayName(),prevDataRequest:this.getSourceDataRequest(),requestMeta:await this._getVectorSourceRequestMeta(t.isForceRefresh,t.dataFilters,this.getSource(),this.getCurrentStyle(),t.isFeatureEditorOpenForLayer),source:this.getSource(),syncContext:t}),this.hasJoins()&&await this._syncJoins(t,this.getCurrentStyle())}_syncSourceBindingWithMb(t){if(t.getSource(this.getMbSourceId()))return;const e=this.getSourceDataRequest();if(!e)return;const i=e.getData();if(!i)return;const r=this.getMbSourceId();t.addSource(r,{type:"vector",tiles:[i.tileUrl],minzoom:i.tileMinZoom,maxzoom:i.tileMaxZoom,promoteId:this._getSourcePromoteId()})}getMbLayerIds(){return[...super.getMbLayerIds(),this._getMbTooManyFeaturesLayerId()]}ownsMbSourceId(t){return this.getMbSourceId()===t}_getJoinResults(){const t=this.getValidJoins();if(!t||!t.length)return{};const e=t[0],i=this.getDataRequest(e.getSourceDataRequestId());return{join:e,joinPropertiesMap:null==i?void 0:i.getData(),joinRequestMeta:null==i?void 0:i.getMeta()}}_getMbTooManyFeaturesLayerId(){return this.makeMbLayerId("toomanyfeatures")}_getJoinFilterExpression(){const{join:t,joinPropertiesMap:e}=this._getJoinResults();if(!t)return;const i=["has","__kbn_never_prop__"];if(!e)return i;const r=Array.from(e.keys());return r.length?["match",["get",t.getLeftField().getName()],r,!0,!1]:i}_syncFeatureState(t){const{joinPropertiesMap:e,joinRequestMeta:i}=this._getJoinResults();if(!e)return;const[r]=e.keys(),n=t.getFeatureState({source:this.getMbSourceId(),sourceLayer:this._source.getTileSourceLayer(),id:r}),o=null==i?void 0:i.requestStopTime;if((null==n?void 0:n.requestStopTime)===o)return;t.removeFeatureState({source:this.getMbSourceId(),sourceLayer:this._source.getTileSourceLayer()});const a={source:this.getMbSourceId(),sourceLayer:this._source.getTileSourceLayer(),id:void 0};e.forEach(((e,i)=>{a.id=i,t.setFeatureState(a,{...e,requestStopTime:o})}))}_syncStylePropertiesWithMb(t){if(!t.getSource(this.getMbSourceId()))return;const e=this.getSourceDataRequest();if(!e)return;const i=e.getData();i&&""!==i.tileSourceLayer&&(this._setMbLabelProperties(t,i.tileSourceLayer),this._setMbPointsProperties(t,i.tileSourceLayer),this._setMbLinePolygonProperties(t,i.tileSourceLayer),this._syncTooManyFeaturesProperties(t))}_syncTooManyFeaturesProperties(t){if(this.getSource().getType()!==r.Ab.ES_SEARCH)return;const e=this._getMaxResultWindow();if(void 0===e)return;const i=this._getMbTooManyFeaturesLayerId();if(!t.getLayer(i)){const r={id:i,type:"line",source:this.getId(),paint:{}};r["source-layer"]=ut.c,t.addLayer(r),t.setFilter(i,["all",["==",["get",ut.a],"gte"],[">=",["get",ut.b],e+1]]),t.setPaintProperty(i,"line-color",this.getCurrentStyle().getPrimaryColor()),t.setPaintProperty(i,"line-width",3),t.setPaintProperty(i,"line-dasharray",[2,1]),t.setPaintProperty(i,"line-opacity",this.getAlpha())}this.syncVisibilityWithMb(t,i),t.setLayerZoomRange(i,this.getMinZoom(),this.getMaxZoom())}_getSourcePromoteId(){const{join:t}=this._getJoinResults();return t?{[this._source.getTileSourceLayer()]:t.getLeftField().getName()}:void 0}_requiresPrevSourceCleanup(t){var e;const i=t.getSource(this.getMbSourceId());if(!i)return!1;if(!("tiles"in i))return!0;const r=i,n=this.getSourceDataRequest();if(!n)return!1;const o=n.getData();if(!o)return!1;if((null===(e=r.tiles)||void 0===e?void 0:e[0])!==o.tileUrl||r.minzoom!==o.tileMinZoom||r.maxzoom!==o.tileMaxZoom||!p.a.isEqual(r.promoteId,this._getSourcePromoteId()))return!0;const a=this.getMbLayerIds();for(let e=0;e{const n=i.getFieldName();o.fieldMeta[n]||(o.fieldMeta[n]={categories:[]});const a=[];a.length&&(o.fieldMeta[n].categories=a);const l=function(t,e,i){const n=t.getField();if(!n||!t.isOrdinal())return null;const o=n.isCount();let a=o?1:1/0,l=-1/0;if(t.getFieldOrigin()===r.D.SOURCE)for(let t=0;t{const e=t[n.getName()];"number"==typeof e&&(o||(a=Math.min(e,a)),l=Math.max(e,l))}));return a===1/0||l===-1/0?null:{min:a,max:l,delta:l-a}}(i,t,e);l&&(o.fieldMeta[n].range=l)})),o):o}(this._getMetaFromTiles(),t,await this.getSource().getSupportedShapeTypes(),this.getCurrentStyle().getDynamicPropertiesArray())}}},,function(t,e,i){"use strict";i.d(e,"a",(function(){return n})),i.d(e,"f",(function(){return o})),i.d(e,"e",(function(){return a})),i.d(e,"b",(function(){return l})),i.d(e,"d",(function(){return c})),i.d(e,"c",(function(){return u}));var r=i(1);function n(){return r.i18n.translate("xpack.maps.source.dataSourceLabel",{defaultMessage:"Data source"})}function o(){return r.i18n.translate("xpack.maps.source.urlLabel",{defaultMessage:"Url"})}function a(t){switch(t){case"intersects":return r.i18n.translate("xpack.maps.common.esSpatialRelation.intersectsLabel",{defaultMessage:"intersects"});case"disjoint":return r.i18n.translate("xpack.maps.common.esSpatialRelation.disjointLabel",{defaultMessage:"disjoint"});case"within":return r.i18n.translate("xpack.maps.common.esSpatialRelation.withinLabel",{defaultMessage:"within"});case"contains":return r.i18n.translate("xpack.maps.common.esSpatialRelation.containsLabel",{defaultMessage:"contains"});default:return t}}function l(){return r.i18n.translate("xpack.maps.dataView.label",{defaultMessage:"Data view"})}function c(){return r.i18n.translate("xpack.maps.dataView.selectPlacholder",{defaultMessage:"Select data view"})}function u(t){return r.i18n.translate("xpack.maps.dataView.notFoundMessage",{defaultMessage:"Unable to find data view '{id}'",values:{id:t}})}},,function(t,e,i){"use strict";i.d(e,"l",(function(){return l})),i.d(e,"a",(function(){return c})),i.d(e,"j",(function(){return u})),i.d(e,"m",(function(){return p})),i.d(e,"o",(function(){return m})),i.d(e,"p",(function(){return g})),i.d(e,"k",(function(){return y})),i.d(e,"e",(function(){return v})),i.d(e,"f",(function(){return x})),i.d(e,"d",(function(){return b})),i.d(e,"q",(function(){return w})),i.d(e,"r",(function(){return C})),i.d(e,"h",(function(){return P})),i.d(e,"c",(function(){return O})),i.d(e,"b",(function(){return k})),i.d(e,"g",(function(){return F})),i.d(e,"i",(function(){return D})),i.d(e,"n",(function(){return z}));var r=i(1),n=i(39),o=i.n(n),a=i(0);function l(t,e){const i=t.fields.getByName(e);if(!i)throw new Error(r.i18n.translate("xpack.maps.source.esSearch.fieldNotFoundMsg",{defaultMessage:"Unable to find '{fieldName}' in index-pattern '{indexPatternName}'.",values:{fieldName:e,indexPatternName:t.getName()}}));return i}function c(t,e){return e.scripted?{...t,script:{source:e.script,lang:e.lang}}:{...t,field:e.name}}function u(t,e=[]){const i={};for(const r in t)if(!e.includes(r)&&t.hasOwnProperty(r))if(o.a.has(t[r],"value"))i[r]=t[r].value;else if(o.a.has(t[r],"buckets")){if(0===t[r].buckets.length)continue;i[r]=o.a.get(t[r],"buckets[0].key");const e=t[r].buckets[0].doc_count,n=t.doc_count;n&&e&&(i[`${r}${a.Eb}`]=Math.round(e/n*100))}else if(r.startsWith(a.b.PERCENTILE)||r.startsWith(a.T+a.b.PERCENTILE)){const e=t[r].values;for(const t in e)if(e.hasOwnProperty(t)){i[r]=e[t];break}}else i[r]=t[r];return i}function h(t){const e=[a.A.GEO_POINT,a.A.GEO_SHAPE];if(!e.includes(t)){const i=r.i18n.translate("xpack.maps.es_geo_utils.unsupportedFieldTypeErrorMessage",{defaultMessage:"Unsupported field type, expected: {expectedTypes}, you provided: {fieldType}",values:{fieldType:t,expectedTypes:e.join(",")}});throw new Error(i)}}function p(t,e,i,r,n){const o=[],l=[];for(let c=0;c=360?{top_left:[-180,o],bottom_right:[180,n]}:{top_left:[(r+180+360)%360-180,o],bottom_right:[(e+180+360)%360-180,n]},a}function g(t){for(let e=0;e360?-180:r,l=n>360?180:e,c=v(t),u=v(i),h=[o,c],p=[o,u],d=[l,u],f=[l,c];return{type:a.J.POLYGON,coordinates:[[h,p,d,f,h]]}}function v(t){return b(t,-89,89)}function x(t){return b(t,-180,180)}function b(t,e,i){return t>i?i:t360?180:o;return{minLon:a>360?-180:n,minLat:v(t.minLat-r*e),maxLon:l,maxLat:x(t.maxLat+r*e)}}function C(t){return{minLon:t[0],minLat:t[1],maxLon:t[2],maxLat:t[3]}}var S=i(272),M=i.n(S),T=i(44),E=i(74);const A=T.FILTERS.SPATIAL_FILTER;function I(t,e,i){if(0===t.length)throw new Error("Unable to create filter, geo fields not provided");return 1===t.length?{meta:{...e,isMultiIndex:!0},query:{bool:{must:[{exists:{field:t[0]}},i(t[0])]}}}:{meta:{...e,isMultiIndex:!0},query:{bool:{should:t.map((t=>({bool:{must:[{exists:{field:t}},i(t)]}})))}}}}function P(t,e){const i=m(t);return I(e,{type:A,alias:null,disabled:!1,negate:!1},(function(t){return{geo_bounding_box:{[t]:i}}}))}function O({preIndexedShape:t,geometry:e,geometryLabel:i,geoFieldNames:r,relation:n="intersects"}){return I(r,{type:A,negate:!1,alias:`${Object(E.e)(n)} ${i}`,disabled:!1},(function(i){const r={relation:n};if(t)r.indexed_shape=t;else{if(!e)throw new Error("Must supply either preIndexedShape or geometry, you did not supply either");r.shape=e}return{geo_shape:{ignore_unmapped:!0,[i]:r}}}))}function k({geoFieldNames:t,gridId:e,isHex:i}){return I(t,{type:A,negate:!1,alias:r.i18n.translate("xpack.maps.common.esSpatialRelation.clusterFilterLabel",{defaultMessage:"intersects cluster {gridId}",values:{gridId:e}}),disabled:!1},(t=>({geo_grid:{[t]:i?{geohex:e}:{geotile:e}}})))}function F({alias:t,distanceKm:e,geoFieldNames:i,point:n}){return I(i,{type:A,negate:!1,alias:t||r.i18n.translate("xpack.maps.es_geo_utils.distanceFilterAlias",{defaultMessage:"within {distanceKm}km of {pointLabel}",values:{distanceKm:e,pointLabel:n.join(", ")}}),disabled:!1},(function(t){return{geo_distance:{distance:`${e}km`,[t]:n}}}))}function D(t){const e=[];return t.filter((t=>t.meta.type===A)).forEach((t=>{var i,r,n,o,a,l,c,u,h,p,d,f;let m;const g=null!=t&&null!==(i=t.query)&&void 0!==i&&null!==(r=i.bool)&&void 0!==r&&null!==(n=r.should)&&void 0!==n&&n.length?null==t||null===(o=t.query)||void 0===o||null===(a=o.bool)||void 0===a||null===(l=a.should)||void 0===l||null===(c=l[0])||void 0===c||null===(u=c.bool)||void 0===u?void 0:u.must:null==t||null===(h=t.query)||void 0===h||null===(p=h.bool)||void 0===p?void 0:p.must,y=null==g||null===(d=g[0])||void 0===d||null===(f=d.exists)||void 0===f?void 0:f.field,_=null==g?void 0:g[1];y&&_&&(m=function(t,e){if(e.geo_distance&&e.geo_distance[t]){const i=e.geo_distance.distance.split("km"),r=parseFloat(i[0]);return M()(e.geo_distance[t],r).geometry}if(e.geo_shape&&e.geo_shape[t]&&e.geo_shape[t].shape)return e.geo_shape[t].shape}(y,_)),m&&e.push({type:"Feature",geometry:m,properties:{filter:t.meta.alias}})})),e}function z(t,e){if("eq"===t.relation)return t.value>e;if(e>t.value)throw new Error(r.i18n.translate("xpack.maps.totalHits.lowerBoundPrecisionExceeded",{defaultMessage:"Unable to determine if total hits is greater than value. Total hits precision is lower than value. Total hits: {totalHitsString}, value: {value}. Ensure _search.body.track_total_hits is at least as large as value.",values:{totalHitsString:JSON.stringify(t,null,""),value:e}}));return!0}},,function(t,e){(function(){t.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}).call(this)},function(t,e,i){"use strict";i.d(e,"g",(function(){return a})),i.d(e,"f",(function(){return l})),i.d(e,"c",(function(){return h})),i.d(e,"b",(function(){return p})),i.d(e,"a",(function(){return d})),i.d(e,"d",(function(){return g})),i.d(e,"e",(function(){return y})),i.d(e,"h",(function(){return _})),i.d(e,"j",(function(){return v})),i.d(e,"i",(function(){return x}));var r=i(0),n=i(80),o=i(5);const a=1,l=64,c=7,u=32,h=3,p=14,d=6,f=n.e[0].value,m=n.a[0].value,g=[r.Gb.LABEL_SIZE,r.Gb.LABEL_COLOR,r.Gb.LABEL_BORDER_COLOR,r.Gb.LABEL_BORDER_SIZE],y=[r.Gb.LINE_COLOR,r.Gb.LINE_WIDTH,...g],_=[r.Gb.FILL_COLOR,r.Gb.LINE_COLOR,r.Gb.LINE_WIDTH,...g];function v(t=[]){let e=0;if(t.length){const i=t[t.length-1];n.b.includes(i)&&(e=(n.b.indexOf(i)+1)%n.b.length)}const i=n.b[e],a=n.d[e],l=Object(o.y)();return{[r.Gb.ICON]:{type:r.Cb.STATIC,options:{value:r.r}},[r.Gb.FILL_COLOR]:{type:r.Cb.STATIC,options:{color:i}},[r.Gb.LINE_COLOR]:{type:r.Cb.STATIC,options:{color:a}},[r.Gb.LINE_WIDTH]:{type:r.Cb.STATIC,options:{size:1}},[r.Gb.ICON_SIZE]:{type:r.Cb.STATIC,options:{size:d}},[r.Gb.ICON_ORIENTATION]:{type:r.Cb.STATIC,options:{orientation:0}},[r.Gb.LABEL_TEXT]:{type:r.Cb.STATIC,options:{value:""}},[r.Gb.LABEL_COLOR]:{type:r.Cb.STATIC,options:{color:l?"#FFFFFF":"#000000"}},[r.Gb.LABEL_SIZE]:{type:r.Cb.STATIC,options:{size:p}},[r.Gb.LABEL_ZOOM_RANGE]:{options:{useLayerZoomRange:!0,minZoom:r.lb,maxZoom:r.hb}},[r.Gb.LABEL_BORDER_COLOR]:{type:r.Cb.STATIC,options:{color:l?"#000000":"#FFFFFF"}},[r.Gb.SYMBOLIZE_AS]:{options:{value:r.Db.CIRCLE}},[r.Gb.LABEL_BORDER_SIZE]:{options:{size:r.V.SMALL}},[r.Gb.LABEL_POSITION]:{options:{position:r.W.CENTER}}}}function x(){return{[r.Gb.ICON]:{type:r.Cb.DYNAMIC,options:{iconPaletteId:"filledShapes",field:void 0,fieldMetaOptions:{isEnabled:!0}}},[r.Gb.FILL_COLOR]:{type:r.Cb.DYNAMIC,options:{color:f,colorCategory:m,field:void 0,fieldMetaOptions:{isEnabled:!0,sigma:h}}},[r.Gb.LINE_COLOR]:{type:r.Cb.DYNAMIC,options:{color:f,colorCategory:m,field:void 0,fieldMetaOptions:{isEnabled:!0,sigma:h}}},[r.Gb.LINE_WIDTH]:{type:r.Cb.DYNAMIC,options:{minSize:1,maxSize:10,field:void 0,fieldMetaOptions:{isEnabled:!0,sigma:h}}},[r.Gb.ICON_SIZE]:{type:r.Cb.DYNAMIC,options:{minSize:c,maxSize:u,field:void 0,fieldMetaOptions:{isEnabled:!0,sigma:h}}},[r.Gb.ICON_ORIENTATION]:{type:r.Cb.DYNAMIC,options:{field:void 0,fieldMetaOptions:{isEnabled:!0,sigma:h}}},[r.Gb.LABEL_TEXT]:{type:r.Cb.DYNAMIC,options:{field:void 0}},[r.Gb.LABEL_ZOOM_RANGE]:{options:{useLayerZoomRange:!0,minZoom:r.lb,maxZoom:r.hb}},[r.Gb.LABEL_COLOR]:{type:r.Cb.DYNAMIC,options:{color:f,colorCategory:m,field:void 0,fieldMetaOptions:{isEnabled:!0,sigma:h}}},[r.Gb.LABEL_SIZE]:{type:r.Cb.DYNAMIC,options:{minSize:c,maxSize:u,field:void 0,fieldMetaOptions:{isEnabled:!0,sigma:h}}},[r.Gb.LABEL_BORDER_COLOR]:{type:r.Cb.DYNAMIC,options:{color:f,colorCategory:m,field:void 0,fieldMetaOptions:{isEnabled:!0,sigma:h}}},[r.Gb.SYMBOLIZE_AS]:{options:{value:r.Db.CIRCLE}},[r.Gb.LABEL_BORDER_SIZE]:{options:{size:r.V.SMALL}},[r.Gb.LABEL_POSITION]:{options:{position:r.W.CENTER}}}}},function(t,e,i){"use strict";i.d(e,"c",(function(){return a})),i.d(e,"b",(function(){return l})),i.d(e,"d",(function(){return c})),i.d(e,"e",(function(){return d})),i.d(e,"a",(function(){return f})),i.d(e,"f",(function(){return m})),i.d(e,"g",(function(){return g})),i.d(e,"i",(function(){return y})),i.d(e,"j",(function(){return _})),i.d(e,"h",(function(){return v}));var r=i(384),n=i.n(r),o=i(55);const a="theclassic",l=Object(o.euiPaletteColorBlind)(),c=[...l.map((t=>n()(t).darken().toHexString())),"#000","#FFF"],u=["rgb(65, 105, 225)","rgb(0, 256, 256)","rgb(0, 256, 0)","rgb(256, 256, 0)","rgb(256, 0, 0)"];function h(t){const e=Math.ceil(t/10);return Object(o.euiPaletteColorBlind)({rotations:e}).slice(0,t-1)}const p=[{value:"Blues",getPalette:t=>Object(o.euiPaletteCool)(t),palette:Object(o.euiPaletteCool)(8),type:"gradient"},{value:"Greens",getPalette:t=>Object(o.euiPalettePositive)(t),palette:Object(o.euiPalettePositive)(8),type:"gradient"},{value:"Greys",getPalette:t=>Object(o.euiPaletteGray)(t),palette:Object(o.euiPaletteGray)(8),type:"gradient"},{value:"Reds",getPalette:t=>Object(o.euiPaletteNegative)(t),palette:Object(o.euiPaletteNegative)(8),type:"gradient"},{value:"Yellow to Red",getPalette:t=>Object(o.euiPaletteWarm)(t),palette:Object(o.euiPaletteWarm)(8),type:"gradient"},{value:"Green to Red",getPalette:t=>Object(o.euiPaletteForStatus)(t),palette:Object(o.euiPaletteForStatus)(8),type:"gradient"},{value:"Blue to Red",getPalette:t=>Object(o.euiPaletteForTemperature)(t),palette:Object(o.euiPaletteForTemperature)(8),type:"gradient"},{value:a,getPalette:t=>Object(o.colorPalette)(u,t,!0,!0),palette:u,type:"gradient"},{value:"palette_0",getPalette:h,palette:Object(o.euiPaletteColorBlind)(),type:"fixed"},{value:"palette_20",getPalette:h,palette:Object(o.euiPaletteColorBlind)({rotations:2}),type:"fixed"},{value:"palette_30",getPalette:h,palette:Object(o.euiPaletteColorBlind)({rotations:3}),type:"fixed"}],d=p.filter((t=>"gradient"===t.type)),f=p.filter((t=>"fixed"===t.type));function m(t){const e=p.find((({value:e})=>e===t));return e?[...e.palette]:[]}function g(t){if(!t)return null;const e=m(t);return 0===e.length?null:e[Math.floor(e.length/2)]}function y(t,e,i,r){if(!t)return null;if(e>i)return null;const n=m(t);if(r&&n.reverse(),0===n.length)return null;if(i===e)return[i,n[n.length-1]];const o=i-e;return n.reduce(((t,i,r,n)=>{const a=e+o*r/n.length;return t.push(a,i),t}),[])}function _(t,e,i){if(!t)return null;const r=d.find((({value:e})=>e===t));if(!r)return null;const n=r.getPalette(e.length);return i&&n.reverse(),n.reduce(((t,i,r)=>(t.push(e[r].value,i),t)),[])}function v(t){const e=t.length;let i=`linear-gradient(to right, ${t[0]} 0%,`;for(let r=1;rt.timeSeriesDimension||t.timeSeriesMetric))}function h(t){return t.aggregatable?t.type!==l.A.GEO_SHAPE||Object(c.b)()?null:r.i18n.translate("xpack.maps.geoTileAgg.disabled.license",{defaultMessage:"Geo_shape clustering requires a Gold license."}):r.i18n.translate("xpack.maps.geoTileAgg.disabled.docValues",{defaultMessage:"Clustering requires aggregations. Enable aggregations by setting doc_values to true."})}async function p(t=[]){return(await Object(n.asyncMap)(t,(async t=>{try{return await Object(a.u)().get(t)}catch(t){return null}}))).filter((t=>null!==t))}function d(t){return t.filter((t=>t.aggregatable&&!o.indexPatterns.isNestedField(t)&&["number","boolean","date","ip","string"].includes(t.type)))}function f(t){return t.filter((t=>t.sortable&&!o.indexPatterns.isNestedField(t)))}function m(t){return t.filter((t=>!o.indexPatterns.isNestedField(t)&&l.B.includes(t.type)))}function g(t){return t.filter((t=>!o.indexPatterns.isNestedField(t)&&l.A.GEO_POINT===t.type))}function y(t){return t.filter(_)}function _(t){return!!t&&!!t.aggregatable&&!o.indexPatterns.isNestedField(t)&&function(){const t=[l.A.GEO_POINT];return Object(c.b)()&&t.push(l.A.GEO_SHAPE),t}().includes(t.type)}function v(t){return t.filter((t=>!t.isSubtypeMulti()&&!t.isSubtypeNested()))}},function(t,e,i){"use strict";i.d(e,"a",(function(){return vector_style_VectorStyle}));var r=i(2),n=i.n(r),o=i(4),a=i.n(o),l=i(39),c=i.n(l),u=i(1),h=i(14),p=i(23),d=i.n(p),f=i(107),m=i(0),g=i(3);const y=u.i18n.translate("xpack.maps.styles.staticDynamicSelect.staticLabel",{defaultMessage:"Fixed"}),_=u.i18n.translate("xpack.maps.styles.staticDynamicSelect.dynamicLabel",{defaultMessage:"By value"});class style_prop_editor_StylePropEditor extends o.Component{constructor(...t){super(...t),n()(this,"_prevStaticStyleOptions",this.props.defaultStaticStyleOptions),n()(this,"_prevDynamicStyleOptions",this.props.defaultDynamicStyleOptions),n()(this,"_onTypeToggle",(()=>{this.props.styleProperty.isDynamic()?(this._prevDynamicStyleOptions=this.props.styleProperty.getOptions(),this.props.onStaticStyleChange(this.props.styleProperty.getStyleName(),this._prevStaticStyleOptions)):(this._prevStaticStyleOptions=this.props.styleProperty.getOptions(),this.props.onDynamicStyleChange(this.props.styleProperty.getStyleName(),this._prevDynamicStyleOptions))})),n()(this,"_onDataMappingChange",(t=>{const e={...this.props.styleProperty.getOptions(),...t};this.props.onDynamicStyleChange(this.props.styleProperty.getStyleName(),e)}))}renderStaticDynamicSelect(){const t=[{value:m.Cb.STATIC,text:this.props.customStaticOptionLabel?this.props.customStaticOptionLabel:y},{value:m.Cb.DYNAMIC,text:_}];return Object(g.jsx)(h.EuiSelect,{options:t,value:this.props.styleProperty.isDynamic()?m.Cb.DYNAMIC:m.Cb.STATIC,onChange:this._onTypeToggle,disabled:this.props.disabled||0===this.props.fields.length,"aria-label":u.i18n.translate("xpack.maps.styles.staticDynamicSelect.ariaLabel",{defaultMessage:"Select to style by fixed value or by data value"}),compressed:!0,"data-test-subj":`staticDynamicSelect_${this.props.styleProperty.getStyleName()}`})}render(){const t=this.renderStaticDynamicSelect(),e=this.props.disabled&&this.props.disabledBy?Object(g.jsx)(h.EuiToolTip,{anchorClassName:"mapStyleFormDisabledTooltip",content:Object(f.a)(this.props.disabledBy)},Object(g.jsx)(h.EuiFlexGroup,{gutterSize:"xs"},Object(g.jsx)(h.EuiFlexItem,{grow:!1,className:"mapStyleSettings__fixedBox"},t),Object(g.jsx)(h.EuiFlexItem,null,Object(g.jsx)(h.EuiFieldText,{compressed:!0,disabled:!0})))):Object(g.jsx)(o.Fragment,null,a.a.cloneElement(this.props.children,{staticDynamicSelect:t}),this.props.styleProperty.renderDataMappingPopover(this._onDataMappingChange));return Object(g.jsx)(h.EuiFormRow,{label:Object(f.b)(this.props.styleProperty.getStyleName()),display:"rowCompressed"},e)}}var v=i(149);function x(t,e,i){const r=t.value?Object(g.jsx)(v.a,{type:t.value.type,fill:"none"}):null;return Object(g.jsx)(h.EuiFlexGroup,{className:i,gutterSize:"s",alignItems:"center"},Object(g.jsx)(h.EuiFlexItem,{grow:null},r),Object(g.jsx)(h.EuiFlexItem,null,Object(g.jsx)(h.EuiHighlight,{search:e},t.label)))}function b(t){const e=new Map;function i(t){return t.map((t=>({value:t,label:t.label,disabled:t.isUnsupported,title:t.unsupportedMsg}))).sort(((t,e)=>t.label.toLowerCase().localeCompare(e.label.toLowerCase())))}if(t.forEach((t=>{if(e.has(t.origin)){const i=e.get(t.origin);i.push(t),e.set(t.origin,i)}else e.set(t.origin,[t])})),1===e.size){const t=e.keys().next().value;return i(e.get(t))}const r=[];return e.forEach(((t,e)=>{r.push({label:u.i18n.translate("xpack.maps.style.fieldSelect.OriginLabel",{defaultMessage:"Fields from {fieldOrigin}",values:{fieldOrigin:e}}),options:i(t)})})),r.sort(((t,e)=>t.label.toLowerCase().localeCompare(e.label.toLowerCase()))),r}function w({fields:t,selectedFieldName:e,onChange:i,styleName:r,...n}){let o;if(e){const i=t.find((t=>t.name===e));i&&(o={value:i,label:i.label})}return Object(g.jsx)(h.EuiComboBox,d()({selectedOptions:o?[o]:[],options:b(t),onChange:t=>{i({field:t.length>0&&t[0].value?t[0].value:null})},singleSelection:{asPlainText:!0},isClearable:!1,fullWidth:!0,placeholder:u.i18n.translate("xpack.maps.styles.vector.selectFieldPlaceholder",{defaultMessage:"Select a field"}),renderOption:x,"data-test-subj":`styleFieldSelect_${r}`},n))}var C=i(55);const S=Object(C.euiPaletteColorBlind)({rotations:3}),M=S[0];function T(t,e){const i=t[e].stop;let r=1;return e===t.length-1?0!==e&&(r=i-t[e-1].stop):r=(t[e+1].stop-i)/2,A(t,e,i+r)}function E(t,e){return A(t,e,"")}function A(t,e,i){const r=t.lengtht.stop)),i=c.a.uniq(e);return e.length!==i.length}function k(t){return t.some(((e,i)=>{let r=!1;return 0!==i&&(r=t[i-1].stop>=e.stop),I(e.color)||P(e.stop)||r}))}var F=i(144);const D=({onChange:t,colorStops:e,isStopsInvalid:i,getStopError:r,renderStopInput:n,addNewRow:o,swatches:a})=>{const l=e.map(((l,p)=>{const{stopError:d,stopInput:f}=function(o,a){return{stopError:r(o,a),stopInput:n(o,(r=>{const n=c.a.cloneDeep(e);n[a].stop=r,t({colorStops:n,isInvalid:i(n)})}),a)}}(l.stop,p),m=l.color,y=I(m)?u.i18n.translate("xpack.maps.styles.colorStops.hexWarningLabel",{defaultMessage:"Color must provide a valid hex value"}):void 0,_=[];let v;if(d&&_.push(d),y&&_.push(y),e.length>1){const r=()=>{const r=function(t,e){return 1===t.length?t:[...t.slice(0,e),...t.slice(e+1)]}(e,p);t({colorStops:r,isInvalid:i(r)})};v=Object(g.jsx)(h.EuiButtonIcon,{iconType:"trash",color:"danger","aria-label":u.i18n.translate("xpack.maps.styles.colorStops.deleteButtonAriaLabel",{defaultMessage:"Delete"}),title:u.i18n.translate("xpack.maps.styles.colorStops.deleteButtonLabel",{defaultMessage:"Delete"}),onClick:r})}const x=Object(g.jsx)("div",null,v,Object(g.jsx)(h.EuiButtonIcon,{iconType:"plusInCircle",color:"primary","aria-label":"Add",title:"Add",onClick:()=>{const r=o(e,p);t({colorStops:r,isInvalid:i(r)})}}));return Object(g.jsx)(h.EuiFormRow,{key:p,className:"mapColorStop",isInvalid:0!==_.length,error:_,display:"rowCompressed"},Object(g.jsx)(h.EuiFlexGroup,{alignItems:"center",gutterSize:"xs"},Object(g.jsx)(h.EuiFlexItem,{grow:!0,className:"mapStyleSettings__fixedBox"},f),Object(g.jsx)(h.EuiFlexItem,null,Object(g.jsx)(F.a,{key:m,onChange:r=>{const n=c.a.cloneDeep(e);n[p].color=r,t({colorStops:n,isInvalid:i(n)})},color:m,swatches:a,append:x}))))}));return Object(g.jsx)("div",null,l,Object(g.jsx)(h.EuiSpacer,{size:"s"}))},z=({colorStops:t=[{stop:0,color:M}],onChange:e,swatches:i})=>Object(g.jsx)(D,{onChange:e,colorStops:t,isStopsInvalid:k,getStopError:(e,i)=>{let r;return P(e)?r=u.i18n.translate("xpack.maps.styles.colorStops.ordinalStop.numberWarningLabel",{defaultMessage:"Stop must be a number"}):0!==i&&t[i-1].stop>=e&&(r=u.i18n.translate("xpack.maps.styles.colorStops.ordinalStop.numberOrderingWarningLabel",{defaultMessage:"Stop must be greater than previous stop value"})),r},renderStopInput:(t,e,i)=>Object(g.jsx)(h.EuiFieldNumber,{"aria-label":u.i18n.translate("xpack.maps.styles.colorStops.ordinalStop.stopLabel",{defaultMessage:"Stop"}),value:0===i?"":t,onChange:function(t){const i=parseFloat(t.target.value),r=isNaN(i)?"":i;e(r)},compressed:!0,disabled:0===i}),addNewRow:T,swatches:i});class stop_input_StopInput extends o.Component{constructor(t){super(t),n()(this,"_isMounted",!1),n()(this,"_onFocus",(()=>{this.state.hasPrevFocus||(this.setState({hasPrevFocus:!0}),this._onSearchChange(""))})),n()(this,"_onChange",(t=>{this.props.onChange(c.a.get(t,"[0].label",""))})),n()(this,"_onCreateOption",(t=>{this.props.onChange(t)})),n()(this,"_onSearchChange",(async t=>{this.setState({isLoadingSuggestions:!0,searchValue:t},(()=>{this._loadSuggestions(t)}))})),n()(this,"_loadSuggestions",c.a.debounce((async t=>{let e=[];try{e=await this.props.getValueSuggestions(t)}catch(t){}this._isMounted&&t===this.state.searchValue&&this.setState({isLoadingSuggestions:!1,suggestions:e})}),300)),n()(this,"_onFieldTextChange",(t=>{this.setState({localFieldTextValue:t.target.value}),this._debouncedOnFieldTextChange()})),n()(this,"_debouncedOnFieldTextChange",c.a.debounce((()=>{this.props.onChange(this.state.localFieldTextValue)}),500)),this.state={suggestions:[],isLoadingSuggestions:!1,hasPrevFocus:!1,fieldDataType:null,localFieldTextValue:t.value}}componentDidMount(){this._isMounted=!0,this._loadFieldDataType()}componentWillUnmount(){this._isMounted=!1,this._loadSuggestions.cancel()}async _loadFieldDataType(){const t=await this.props.field.getDataType();this._isMounted&&this.setState({fieldDataType:t})}_renderSuggestionInput(){const t=this.state.suggestions.map((t=>({label:`${t}`}))),e=[];if(this.props.value){let i=t.find((({label:t})=>t===this.props.value));i||(i={label:this.props.value},t.unshift(i)),e.push(i)}return Object(g.jsx)(h.EuiComboBox,{options:t,selectedOptions:e,singleSelection:{asPlainText:!0},onChange:this._onChange,onSearchChange:this._onSearchChange,onCreateOption:this._onCreateOption,isClearable:!1,isLoading:this.state.isLoadingSuggestions,onFocus:this._onFocus,"data-test-subj":this.props.dataTestSubj,compressed:!0})}_renderTextInput(){return Object(g.jsx)(h.EuiFieldText,{value:this.state.localFieldTextValue,onChange:this._onFieldTextChange,compressed:!0})}render(){return this.state.fieldDataType?"string"===this.state.fieldDataType||"boolean"===this.state.fieldDataType?this._renderSuggestionInput():this._renderTextInput():null}}const j=({colorStops:t=[{stop:"",color:M}],field:e,onChange:i,getValueSuggestions:r,swatches:n})=>Object(g.jsx)(D,{onChange:i,colorStops:t,isStopsInvalid:O,getStopError:(e,i)=>{let r=0;for(let n=1;n{const o="string"==typeof t?t:"";return Object(g.jsx)(stop_input_StopInput,{key:e.getName(),field:e,getValueSuggestions:r,value:o,onChange:i,dataTestSubj:`colorStopInput${n}`})},addNewRow:E,swatches:n});var N=i(80);const B="CUSTOM_COLOR_MAP";class color_map_select_ColorMapSelect extends o.Component{constructor(...t){super(...t),n()(this,"state",{}),n()(this,"_onColorPaletteSelect",(t=>{const e=t===B;this.props.onChange({color:e?null:t,useCustomColorMap:e,type:this.props.colorMapType})})),n()(this,"_onCustomColorMapChange",(({colorStops:t,isInvalid:e})=>{e?this.setState({customColorMap:t}):this.props.onChange({useCustomColorMap:!0,customColorMap:t,type:this.props.colorMapType})}))}static getDerivedStateFromProps(t,e){return t.customColorMap===e.prevPropsCustomColorMap?null:{prevPropsCustomColorMap:t.customColorMap,customColorMap:t.customColorMap}}_renderColorMapToggle(){const t=[{value:m.j.ORDINAL,text:u.i18n.translate("xpack.maps.styles.dynamicColorSelect.quantitativeLabel",{defaultMessage:"As number"})},{value:m.j.CATEGORICAL,text:u.i18n.translate("xpack.maps.styles.dynamicColorSelect.qualitativeLabel",{defaultMessage:"As category"})}],e=this.props.styleProperty.isOrdinal()?m.j.ORDINAL:m.j.CATEGORICAL;return Object(g.jsx)(h.EuiSelect,{options:t,value:e,onChange:this.props.onColorMapTypeChange,"aria-label":u.i18n.translate("xpack.maps.styles.dynamicColorSelect.qualitativeOrQuantitativeAriaLabel",{defaultMessage:"Choose `As number` to map by number in a color range, or `As category`to categorize by color palette."}),compressed:!0})}_renderColorStopsInput(){if(!this.props.isCustomOnly&&!this.props.useCustomColorMap)return null;let t;return t=this.props.colorMapType===m.j.ORDINAL?Object(g.jsx)(z,{colorStops:this.state.customColorMap,onChange:this._onCustomColorMapChange,swatches:this.props.swatches}):Object(g.jsx)(j,{colorStops:this.state.customColorMap,field:this.props.styleProperty.getField(),getValueSuggestions:this.props.styleProperty.getValueSuggestions,onChange:this._onCustomColorMapChange,swatches:this.props.swatches}),Object(g.jsx)(h.EuiFlexGroup,null,Object(g.jsx)(h.EuiFlexItem,null,t))}_getColorPalettes(){return this.props.colorMapType===m.j.CATEGORICAL?N.a:this.props.invert?N.e.map((t=>({...t,palette:[...t.palette].reverse()}))):N.e}_renderColorMapSelections(){if(this.props.isCustomOnly)return null;const t=[{value:B,title:this.props.colorMapType===m.j.ORDINAL?u.i18n.translate("xpack.maps.style.customColorRampLabel",{defaultMessage:"Custom color ramp"}):u.i18n.translate("xpack.maps.style.customColorPaletteLabel",{defaultMessage:"Custom color palette"}),type:"text","data-test-subj":`colorMapSelectOption_${B}`},...this._getColorPalettes()],e=this.props.showColorMapTypeToggle?Object(g.jsx)(h.EuiFlexItem,{grow:!1},this._renderColorMapToggle()):null;return Object(g.jsx)(o.Fragment,null,Object(g.jsx)(h.EuiFlexGroup,{gutterSize:"xs"},e,Object(g.jsx)(h.EuiFlexItem,null,Object(g.jsx)(h.EuiColorPalettePicker,{palettes:t,onChange:this._onColorPaletteSelect,valueOfSelected:this.props.useCustomColorMap?B:this.props.colorPaletteId,compressed:!0,"data-test-subj":`colorMapSelect_${this.props.styleProperty.getStyleName()}`}))),Object(g.jsx)(h.EuiSpacer,{size:"s"}))}render(){return Object(g.jsx)(o.Fragment,null,this._renderColorMapSelections(),this._renderColorStopsInput())}}var V=i(46),U=i(98);const H=[V.euiThemeVars.euiColorLightestShade,V.euiThemeVars.euiColorLightShade,V.euiThemeVars.euiColorMediumShade,V.euiThemeVars.euiColorDarkShade,V.euiThemeVars.euiColorDarkestShade];function G(t){return Object(g.jsx)(h.EuiFormRow,null,Object(g.jsx)(h.EuiToolTip,{position:"top",content:u.i18n.translate("xpack.maps.colorStops.otherCategoryColorPickerTooltip",{defaultMessage:'When the selected field has more terms than colors in the palette, the rest of the terms are grouped under "Other" category. Select a palette with more colors to increase the number of terms colored in your map'})},Object(g.jsx)(F.a,{swatches:H,prepend:U.b,onChange:t.onChange,color:t.color?t.color:U.a})))}function q({fields:t,onDynamicStyleChange:e,staticDynamicSelect:i,styleProperty:r,swatches:n}){const o=r.getOptions(),l=({color:t,customColorMap:i,type:n,useCustomColorMap:a})=>{const l={...o,type:n};n===m.j.ORDINAL?(l.useCustomColorRamp=a,i&&(l.customColorRamp=i),t&&(l.color=t)):(l.useCustomColorPalette=a,i&&(l.customColorPalette=i),t&&(l.colorCategory=t)),e(r.getStyleName(),l)},p=t=>{const i=t.target.value;e(r.getStyleName(),{...o,type:i})},d=t=>{e(r.getStyleName(),{...o,otherCategoryColor:t})},f=t=>{e(r.getStyleName(),{...o,invert:t.target.checked})};return Object(g.jsx)(a.a.Fragment,null,Object(g.jsx)(h.EuiFlexGroup,{gutterSize:"xs",justifyContent:"flexEnd"},Object(g.jsx)(h.EuiFlexItem,{grow:!1,className:"mapStyleSettings__fixedBox"},i||null),Object(g.jsx)(h.EuiFlexItem,null,Object(g.jsx)(w,{styleName:r.getStyleName(),fields:t,selectedFieldName:r.getFieldName(),onChange:({field:t})=>{if(!t)return;const{name:i,origin:n,type:a}=t,l=m.h.includes(a)?m.j.CATEGORICAL:m.j.ORDINAL;e(r.getStyleName(),{...o,field:{name:i,origin:n},type:l})},compressed:!0}))),Object(g.jsx)(h.EuiSpacer,{size:"s"}),(()=>{const e=(()=>{const e=r.getFieldName();return e?t.find((t=>t.name===e)):null})();if(!e)return null;const i=void 0!==o.invert&&o.invert,y=!m.h.includes(e.type);return r.isOrdinal()?Object(g.jsx)(a.a.Fragment,null,Object(g.jsx)(color_map_select_ColorMapSelect,{isCustomOnly:!e.supportsAutoDomain,onChange:l,onColorMapTypeChange:p,colorMapType:m.j.ORDINAL,colorPaletteId:o.color,customColorMap:o.customColorRamp,useCustomColorMap:c.a.get(o,"useCustomColorRamp",!1),styleProperty:r,showColorMapTypeToggle:y,swatches:n,invert:i}),o.useCustomColorRamp?null:Object(g.jsx)(h.EuiFormRow,{display:"columnCompressedSwitch"},Object(g.jsx)(h.EuiSwitch,{label:u.i18n.translate("xpack.maps.style.revereseColorsLabel",{defaultMessage:"Reverse colors"}),checked:i,onChange:f,compressed:!0}))):Object(g.jsx)(a.a.Fragment,null,Object(g.jsx)(color_map_select_ColorMapSelect,{isCustomOnly:!e.supportsAutoDomain,onColorMapTypeChange:p,onChange:l,colorMapType:m.j.CATEGORICAL,colorPaletteId:o.colorCategory,customColorMap:o.customColorPalette,useCustomColorMap:c.a.get(o,"useCustomColorPalette",!1),styleProperty:r,showColorMapTypeToggle:y,swatches:n,invert:!1}),Object(g.jsx)(G,{onChange:d,color:o.otherCategoryColor}))})())}function Z({onStaticStyleChange:t,staticDynamicSelect:e,styleProperty:i,swatches:r}){return Object(g.jsx)(h.EuiFlexGroup,{gutterSize:"xs",justifyContent:"flexEnd"},Object(g.jsx)(h.EuiFlexItem,{grow:!1,className:"mapStyleSettings__fixedBox"},e||null),Object(g.jsx)(h.EuiFlexItem,null,Object(g.jsx)(F.a,{onChange:e=>{t(i.getStyleName(),{color:e})},color:i.getOptions().color,swatches:r})))}function $(t){const e=t.styleProperty.isDynamic()?Object(g.jsx)(q,d()({},t,{styleProperty:t.styleProperty})):Object(g.jsx)(Z,d()({},t,{styleProperty:t.styleProperty}));return Object(g.jsx)(style_prop_editor_StylePropEditor,d()({},t,{customStaticOptionLabel:u.i18n.translate("xpack.maps.styles.color.staticDynamicSelect.staticLabel",{defaultMessage:"Solid"})}),e)}var W=i(43),X=i(79);function Y({minSize:t,maxSize:e,onChange:i,...r}){return Object(g.jsx)(W.ValidatedDualRange,d()({min:X.g,max:X.f,step:1,value:[t,e],showInput:"inputWithPopover",showRange:!0,onChange:([t,e])=>{i({minSize:Math.max(X.g,parseInt(t,10)),maxSize:Math.min(X.f,parseInt(e,10))})},allowEmptyRange:!1,append:u.i18n.translate("xpack.maps.vector.dualSize.unitLabel",{defaultMessage:"px",description:"Shorthand for pixel"})},r))}function K({fields:t,onDynamicStyleChange:e,staticDynamicSelect:i,styleProperty:r}){const n=r.getOptions();let o;return n.field&&n.field.name&&(o=Object(g.jsx)(a.a.Fragment,null,Object(g.jsx)(Y,{onChange:({minSize:t,maxSize:i})=>{e(r.getStyleName(),{...n,minSize:t,maxSize:i})},minSize:n.minSize,maxSize:n.maxSize,showLabels:!0,compressed:!0}),Object(g.jsx)(h.EuiFormRow,{display:"columnCompressedSwitch"},Object(g.jsx)(h.EuiSwitch,{label:u.i18n.translate("xpack.maps.style.revereseSizeLabel",{defaultMessage:"Reverse size"}),checked:!!n.invert,onChange:t=>{e(r.getStyleName(),{...n,invert:t.target.checked})},compressed:!0})))),Object(g.jsx)(a.a.Fragment,null,Object(g.jsx)(h.EuiFlexGroup,{gutterSize:"xs",justifyContent:"flexEnd"},Object(g.jsx)(h.EuiFlexItem,{grow:!1,className:"mapStyleSettings__fixedBox"},i),Object(g.jsx)(h.EuiFlexItem,null,Object(g.jsx)(w,{styleName:r.getStyleName(),fields:t,selectedFieldName:r.getFieldName(),onChange:({field:t})=>{t&&e(r.getStyleName(),{...n,field:{name:t.name,origin:t.origin}})},compressed:!0}))),Object(g.jsx)(h.EuiSpacer,{size:"s"}),o)}var J=i(127);function tt({onStaticStyleChange:t,staticDynamicSelect:e,styleProperty:i}){return Object(g.jsx)(h.EuiFlexGroup,{gutterSize:"xs",justifyContent:"flexEnd"},Object(g.jsx)(h.EuiFlexItem,{grow:!1,className:"mapStyleSettings__fixedBox"},e),Object(g.jsx)(h.EuiFlexItem,null,Object(g.jsx)(J.a,{min:0,max:100,value:i.getOptions().size,onChange:e=>{t(i.getStyleName(),{size:e})},showInput:"inputWithPopover",showLabels:!0,compressed:!0,append:u.i18n.translate("xpack.maps.vector.size.unitLabel",{defaultMessage:"px",description:"Shorthand for pixel"})})))}function et(t){const e=t.styleProperty.isDynamic()?Object(g.jsx)(K,d()({},t,{styleProperty:t.styleProperty})):Object(g.jsx)(tt,d()({},t,{styleProperty:t.styleProperty}));return Object(g.jsx)(style_prop_editor_StylePropEditor,t,e)}const it=[{id:m.Db.CIRCLE,label:u.i18n.translate("xpack.maps.vector.symbolAs.circleLabel",{defaultMessage:"marker"})},{id:m.Db.ICON,label:u.i18n.translate("xpack.maps.vector.symbolAs.IconLabel",{defaultMessage:"icon"})}];function ot({disabled:t,disabledBy:e,styleProperty:i,handlePropertyChange:r}){const n=i.getOptions(),o=it.find((({id:t})=>t===n.value)),a=u.i18n.translate("xpack.maps.vector.symbolLabel",{defaultMessage:"Symbol type"}),l=Object(g.jsx)(h.EuiFormRow,{label:a,display:"columnCompressed"},Object(g.jsx)(h.EuiButtonGroup,{isDisabled:t,buttonSize:"compressed",options:it,idSelected:o?o.id:void 0,onChange:t=>{const e={options:{value:t}};r(m.Gb.SYMBOLIZE_AS,e)},isFullWidth:!0,legend:a}));return t?Object(g.jsx)(h.EuiToolTip,{anchorClassName:"mapStyleFormDisabledTooltip",content:Object(f.a)(e)},l):l}var at=i(40),lt=i(159),ct=i(99),ut=i(5),ht=i(307);class icon_select_IconSelect extends o.Component{constructor(...t){super(...t),n()(this,"state",{isPopoverOpen:!1,isModalVisible:!1}),n()(this,"_handleSave",(({symbolId:t,svg:e,cutoff:i,radius:r,label:n})=>{const o=[...this.props.customIcons.filter((e=>e.symbolId!==t)),{symbolId:t,svg:e,label:n,cutoff:i,radius:r}];this.props.onCustomIconsChange(o),this._hideModal()})),n()(this,"_closePopover",(()=>{this.setState({isPopoverOpen:!1})})),n()(this,"_hideModal",(()=>{this.setState({isModalVisible:!1})})),n()(this,"_openPopover",(()=>{this.setState({isPopoverOpen:!0})})),n()(this,"_showModal",(()=>{this.setState({isModalVisible:!0})})),n()(this,"_toggleModal",(()=>{this.setState((t=>({isModalVisible:!t.isModalVisible})))})),n()(this,"_togglePopover",(()=>{this.setState((t=>({isPopoverOpen:!t.isPopoverOpen})))})),n()(this,"_handleKeyboardActivity",(t=>{var e;"object"==typeof(e=t)&&"keyCode"in e&&(t.key===h.keys.ENTER?(t.preventDefault(),this._togglePopover()):t.key===h.keys.ARROW_DOWN&&this._openPopover())})),n()(this,"_onIconSelect",(t=>{const e=t.find((t=>"on"===t.checked));if(e){const{key:t}=e;this.props.onChange({selectedIconId:t})}this._closePopover()}))}_renderPopoverButton(){const{value:t,svg:e,label:i}=this.props.icon;return Object(g.jsx)(h.EuiFormControlLayout,{icon:{type:"arrowDown",side:"right"},readOnly:!0,fullWidth:!0,compressed:!0,onKeyDown:this._handleKeyboardActivity,append:this.props.append},Object(g.jsx)(h.EuiFieldText,{onClick:this._togglePopover,onKeyDown:this._handleKeyboardActivity,value:i||t,compressed:!0,readOnly:!0,fullWidth:!0,prepend:Object(g.jsx)(lt.a,{key:t,className:"mapIconSelectSymbol__inputButton",symbolId:t,svg:e,fill:Object(ut.y)()?"rgb(223, 229, 239)":"rgb(52, 55, 65)"})}))}_renderIconSelectable(){const t=[{label:u.i18n.translate("xpack.maps.styles.vector.iconSelect.kibanaIconsGroupLabel",{defaultMessage:"Kibana icons"}),isGroupLabel:!0},...ct.c.map((({value:t,label:e,svg:i})=>({key:t,label:e,prepend:Object(g.jsx)(lt.a,{key:t,symbolId:t,fill:Object(ut.y)()?"rgb(223, 229, 239)":"rgb(52, 55, 65)",svg:i})})))],e=this.props.customIcons.map((({symbolId:t,label:e,svg:i})=>({key:t,label:e,prepend:Object(g.jsx)(lt.a,{key:t,symbolId:t,svg:i,fill:Object(ut.y)()?"rgb(223, 229, 239)":"rgb(52, 55, 65)"})})));e.length&&e.splice(0,0,{label:u.i18n.translate("xpack.maps.styles.vector.iconSelect.customIconsGroupLabel",{defaultMessage:"Custom icons"}),isGroupLabel:!0});const i=[...e,...t];return Object(g.jsx)(h.EuiSelectable,{searchable:!0,options:i,onChange:this._onIconSelect,compressed:!0},((t,e)=>Object(g.jsx)("div",{style:{width:"300px"}},Object(g.jsx)(h.EuiPopoverTitle,null,e),t,Object(g.jsx)(h.EuiPopoverFooter,null," ",Object(g.jsx)(h.EuiButton,{fullWidth:!0,size:"s",onClick:this._toggleModal},Object(g.jsx)(at.FormattedMessage,{id:"xpack.maps.styles.vector.iconSelect.addCustomIconButtonLabel",defaultMessage:"Add custom icon"}))))))}render(){return Object(g.jsx)(o.Fragment,null,Object(g.jsx)(h.EuiPopover,{ownFocus:!0,button:this._renderPopoverButton(),isOpen:this.state.isPopoverOpen,closePopover:this._closePopover,anchorPosition:"downLeft",panelPaddingSize:"s",display:"block"},Object(g.jsx)(h.EuiFocusTrap,{clickOutsideDisables:!0},this._renderIconSelectable())),this.state.isModalVisible?Object(g.jsx)(ht.a,{title:"Add custom Icon",cutoff:m.p,radius:m.q,onSave:this._handleSave,onCancel:this._hideModal}):null)}}function pt(t,e){return e.filter((({stop:e})=>t===e)).length>1}function dt(t){const e=ct.b.find((e=>!t.some((({icon:t})=>t===e))));if(e)return e;const i=ct.c.find((({value:e})=>!t.some((({icon:t})=>t===e))));return i?i.value:m.r}function ft({field:t,getValueSuggestions:e,iconStops:i,onChange:r,onCustomIconsChange:n,customIcons:o}){return i.map((({stop:a,icon:l,iconSource:c},p)=>{const d=c===m.N.CUSTOM?o.find((({symbolId:t})=>t===l)):Object(ct.i)(l);if(void 0===d)return;const{svg:f,label:y}=d;let _;i.length>2&&0!==p&&(_=Object(g.jsx)(h.EuiButtonIcon,{iconType:"trash",color:"danger","aria-label":u.i18n.translate("xpack.maps.styles.iconStops.deleteButtonAriaLabel",{defaultMessage:"Delete"}),title:u.i18n.translate("xpack.maps.styles.iconStops.deleteButtonLabel",{defaultMessage:"Delete"}),onClick:()=>{r({customStops:[...i.slice(0,p),...i.slice(p+1)]})}}));const v=Object(g.jsx)("div",null,_,Object(g.jsx)(h.EuiButtonIcon,{iconType:"plusInCircle",color:"primary","aria-label":"Add",title:"Add",onClick:()=>{r({customStops:[...i.slice(0,p+1),{stop:"",icon:dt(i)},...i.slice(p+1)]})}})),x=[],b=0===p?Object(g.jsx)(h.EuiFieldText,{"aria-label":U.b,placeholder:U.b,disabled:!0,compressed:!0}):Object(g.jsx)(stop_input_StopInput,{key:t.getName(),field:t,getValueSuggestions:e,value:a,onChange:t=>{const e=[...i];e[p]={...i[p],stop:t},r({customStops:e,isInvalid:pt(t,i)})}});return Object(g.jsx)(h.EuiFormRow,{key:p,className:"mapColorStop",isInvalid:0!==x.length,error:x,display:"rowCompressed"},Object(g.jsx)(h.EuiFlexGroup,{alignItems:"center",gutterSize:"xs"},Object(g.jsx)(h.EuiFlexItem,{grow:!1,className:"mapStyleSettings__fixedBox"},b),Object(g.jsx)(h.EuiFlexItem,null,Object(g.jsx)(icon_select_IconSelect,{onCustomIconsChange:n,customIcons:o,onChange:({selectedIconId:t})=>{const e=[...i];e[p]={...i[p],icon:t},r({customStops:e})},icon:{value:l,svg:f,label:y},append:v}))))})).filter((t=>void 0!==t))}const mt="CUSTOM_MAP_ID",gt=[{stop:null,icon:ct.b[0],iconSource:m.N.MAKI},{stop:"",icon:ct.b[1],iconSource:m.N.MAKI}];class icon_map_select_IconMapSelect extends o.Component{constructor(...t){super(...t),n()(this,"state",{customIconStops:this.props.customIconStops?this.props.customIconStops:gt}),n()(this,"_onMapSelect",(t=>{const e=t===mt,i={iconPaletteId:e?null:t,useCustomIconMap:e};this.props.customIconStops||(i.customIconStops=gt),this.props.onChange(i)})),n()(this,"_onCustomMapChange",(({customStops:t,isInvalid:e})=>{this.setState({customIconStops:t}),e||this.props.onChange({useCustomIconMap:!0,customIconStops:t})}))}_renderCustomStopsInput(){return this.props.isCustomOnly||this.props.useCustomIconMap?Object(g.jsx)(ft,{field:this.props.styleProperty.getField(),getValueSuggestions:this.props.styleProperty.getValueSuggestions,iconStops:this.state.customIconStops,onChange:this._onCustomMapChange,onCustomIconsChange:this.props.onCustomIconsChange,customIcons:this.props.customIcons}):null}_renderMapSelect(){if(this.props.isCustomOnly)return null;const t=[{value:mt,inputDisplay:u.i18n.translate("xpack.maps.styles.icon.customMapLabel",{defaultMessage:"Custom icon palette"})},...Object(ct.h)()];let e="";return this.props.useCustomIconMap?e=mt:this.props.iconPaletteId&&(e=this.props.iconPaletteId),Object(g.jsx)(o.Fragment,null,Object(g.jsx)(h.EuiSuperSelect,{options:t,onChange:this._onMapSelect,valueOfSelected:e,hasDividers:!0,compressed:!0}),Object(g.jsx)(h.EuiSpacer,{size:"s"}))}render(){return Object(g.jsx)(o.Fragment,null,this._renderMapSelect(),this._renderCustomStopsInput())}}function yt({fields:t,onDynamicStyleChange:e,onCustomIconsChange:i,customIcons:r,staticDynamicSelect:n,styleProperty:a}){const l=a.getOptions(),u=t=>{e(a.getStyleName(),{...l,...t})};return Object(g.jsx)(o.Fragment,null,Object(g.jsx)(h.EuiFlexGroup,{gutterSize:"xs",justifyContent:"flexEnd"},Object(g.jsx)(h.EuiFlexItem,{grow:!1,className:"mapStyleSettings__fixedBox"},n),Object(g.jsx)(h.EuiFlexItem,null,Object(g.jsx)(w,{styleName:a.getStyleName(),fields:t,selectedFieldName:c.a.get(l,"field.name"),onChange:({field:t})=>{if(!t)return;const{name:i,origin:r}=t;e(a.getStyleName(),{...l,field:{name:i,origin:r}})},compressed:!0}))),Object(g.jsx)(h.EuiSpacer,{size:"s"}),function(){const t=a.getField();return t?Object(g.jsx)(icon_map_select_IconMapSelect,d()({},l,{styleProperty:a,customIcons:r,onChange:u,onCustomIconsChange:i,isCustomOnly:!t.supportsFieldMetaFromLocalData()&&!t.supportsFieldMetaFromEs()})):null}())}function _t({onStaticStyleChange:t,onCustomIconsChange:e,customIcons:i,staticDynamicSelect:r,styleProperty:n}){return Object(g.jsx)(h.EuiFlexGroup,{gutterSize:"xs",justifyContent:"flexEnd"},Object(g.jsx)(h.EuiFlexItem,{grow:!1,className:"mapStyleSettings__fixedBox"},r),Object(g.jsx)(h.EuiFlexItem,null,Object(g.jsx)(icon_select_IconSelect,{customIcons:i,onChange:({selectedIconId:e})=>{t(n.getStyleName(),{value:e})},onCustomIconsChange:e,icon:n.getOptions()})))}function vt(t){const e=t.styleProperty.isDynamic()?Object(g.jsx)(yt,d()({},t,{styleProperty:t.styleProperty})):Object(g.jsx)(_t,d()({},t,{styleProperty:t.styleProperty}));return Object(g.jsx)(style_prop_editor_StylePropEditor,t,e)}function Ct({fields:t,onDynamicStyleChange:e,staticDynamicSelect:i,styleProperty:r}){const n=r.getOptions();return Object(g.jsx)(h.EuiFlexGroup,{gutterSize:"xs",justifyContent:"flexEnd"},Object(g.jsx)(h.EuiFlexItem,{grow:!1,className:"mapStyleSettings__fixedBox"},i),Object(g.jsx)(h.EuiFlexItem,null,Object(g.jsx)(w,{styleName:r.getStyleName(),fields:t,selectedFieldName:r.getFieldName(),onChange:({field:t})=>{t&&e(r.getStyleName(),{...n,field:t})},compressed:!0})))}function St({onStaticStyleChange:t,staticDynamicSelect:e,styleProperty:i}){return Object(g.jsx)(h.EuiFlexGroup,{gutterSize:"xs",justifyContent:"flexEnd"},Object(g.jsx)(h.EuiFlexItem,{grow:!1,className:"mapStyleSettings__fixedBox"},e),Object(g.jsx)(h.EuiFlexItem,null,Object(g.jsx)(h.EuiFieldText,{placeholder:u.i18n.translate("xpack.maps.styles.staticLabel.valuePlaceholder",{defaultMessage:"symbol label"}),value:i.getOptions().value,onChange:e=>{t(i.getStyleName(),{value:e.target.value})},"aria-label":u.i18n.translate("xpack.maps.styles.staticLabel.valueAriaLabel",{defaultMessage:"symbol label"}),compressed:!0})))}function Mt(t){const e=t.styleProperty.isDynamic()?Object(g.jsx)(Ct,d()({},t,{styleProperty:t.styleProperty})):Object(g.jsx)(St,d()({},t,{styleProperty:t.styleProperty}));return Object(g.jsx)(style_prop_editor_StylePropEditor,t,e)}function Tt(t){const e=t.styleProperty.getLayerZoomRange(),i=t.styleProperty.getLabelZoomRange(),{useLayerZoomRange:r}=t.styleProperty.getOptions(),n=r?null:Object(g.jsx)(h.EuiFormRow,{hasEmptyLabelSpace:!0},Object(g.jsx)(W.ValidatedDualRange,{formRowDisplay:"columnCompressed",min:e.minZoom,max:e.maxZoom,value:[i.minZoom,i.maxZoom],showInput:"inputWithPopover",showRange:!0,showLabels:!0,onChange:i=>{t.handlePropertyChange(t.styleProperty.getStyleName(),{options:{...t.styleProperty.getOptions(),minZoom:Math.max(e.minZoom,parseInt(i[0],10)),maxZoom:Math.min(e.maxZoom,parseInt(i[1],10))}})},allowEmptyRange:!1,compressed:!0,prepend:u.i18n.translate("xpack.maps.styles.labelZoomRange.visibleZoom",{defaultMessage:"Zoom levels"})})),o=Object(g.jsx)(h.EuiForm,null,Object(g.jsx)(h.EuiFormRow,{label:Object(f.b)(t.styleProperty.getStyleName())},Object(g.jsx)(h.EuiSwitch,{label:u.i18n.translate("xpack.maps.styles.labelZoomRange.useLayerZoomLabel",{defaultMessage:"Use layer visibility"}),checked:r,onChange:e=>{t.handlePropertyChange(t.styleProperty.getStyleName(),{options:{...t.styleProperty.getOptions(),useLayerZoomRange:e.target.checked}})},compressed:!0})),n);return t.disabled?Object(g.jsx)(h.EuiToolTip,{anchorClassName:"mapStyleFormDisabledTooltip",content:Object(f.a)(t.disabledBy)},o):o}const Et=[{value:m.W.TOP,text:u.i18n.translate("xpack.maps.styles.labelPosition.top",{defaultMessage:"Top"})},{value:m.W.CENTER,text:u.i18n.translate("xpack.maps.styles.labelPosition.center",{defaultMessage:"Center"})},{value:m.W.BOTTOM,text:u.i18n.translate("xpack.maps.styles.labelBorderSize.bottom",{defaultMessage:"Bottom"})}];function At({hasLabel:t,handlePropertyChange:e,styleProperty:i}){const r=!t||i.isDisabled(),n=Object(g.jsx)(h.EuiFormRow,{label:Object(f.b)(m.Gb.LABEL_POSITION)},Object(g.jsx)(h.EuiSelect,{disabled:r,options:Et,value:r?m.W.CENTER:i.getOptions().position,onChange:function(t){e(i.getStyleName(),{options:{position:t.target.value}})},"aria-label":u.i18n.translate("xpack.maps.styles.labelPositionSelect.ariaLabel",{defaultMessage:"Select label position"}),compressed:!0}));return r?Object(g.jsx)(h.EuiToolTip,{anchorClassName:"mapStyleFormDisabledTooltip",content:t?i.getDisabledReason():Object(f.a)(m.Gb.LABEL_TEXT)},n):n}const Lt=[{value:m.V.NONE,text:u.i18n.translate("xpack.maps.styles.labelBorderSize.noneLabel",{defaultMessage:"None"})},{value:m.V.SMALL,text:u.i18n.translate("xpack.maps.styles.labelBorderSize.smallLabel",{defaultMessage:"Small"})},{value:m.V.MEDIUM,text:u.i18n.translate("xpack.maps.styles.labelBorderSize.mediumLabel",{defaultMessage:"Medium"})},{value:m.V.LARGE,text:u.i18n.translate("xpack.maps.styles.labelBorderSize.largeLabel",{defaultMessage:"Large"})}];function It({disabled:t,disabledBy:e,handlePropertyChange:i,styleProperty:r}){const n=Object(g.jsx)(h.EuiFormRow,{label:Object(f.b)(m.Gb.LABEL_BORDER_SIZE)},Object(g.jsx)(h.EuiSelect,{disabled:t,options:Lt,value:r.getOptions().size,onChange:function(t){const e={options:{size:t.target.value}};i(r.getStyleName(),e)},"aria-label":u.i18n.translate("xpack.maps.styles.labelBorderSizeSelect.ariaLabel",{defaultMessage:"Select label border size"}),compressed:!0}));return t?Object(g.jsx)(h.EuiToolTip,{anchorClassName:"mapStyleFormDisabledTooltip",content:Object(f.a)(e)},n):n}function Pt({fields:t,onDynamicStyleChange:e,staticDynamicSelect:i,styleProperty:r}){const n=r.getOptions();return Object(g.jsx)(h.EuiFlexGroup,{gutterSize:"xs",justifyContent:"flexEnd"},Object(g.jsx)(h.EuiFlexItem,{grow:!1,className:"mapStyleSettings__fixedBox"},i),Object(g.jsx)(h.EuiFlexItem,null,Object(g.jsx)(w,{styleName:r.getStyleName(),fields:t,selectedFieldName:r.getFieldName(),onChange:({field:t})=>{e(r.getStyleName(),{...n,field:t})},compressed:!0})))}function Ot({onStaticStyleChange:t,staticDynamicSelect:e,styleProperty:i}){return Object(g.jsx)(h.EuiFlexGroup,{gutterSize:"xs",justifyContent:"flexEnd"},Object(g.jsx)(h.EuiFlexItem,{grow:!1,className:"mapStyleSettings__fixedBox"},e),Object(g.jsx)(h.EuiFlexItem,null,Object(g.jsx)(J.a,{min:0,max:360,value:i.getOptions().orientation,onChange:e=>{t(i.getStyleName(),{orientation:e})},showInput:"inputWithPopover",showLabels:!0,compressed:!0,append:"°"})))}function kt(t){const e=t.styleProperty.isDynamic()?Object(g.jsx)(Pt,t):Object(g.jsx)(Ot,t);return Object(g.jsx)(style_prop_editor_StylePropEditor,t,e)}async function Ft(t){const e=t.map((async t=>({label:await t.getLabel(),name:t.getName(),origin:t.getOrigin(),type:await t.getDataType(),supportsAutoDomain:t.supportsFieldMetaFromLocalData()||t.supportsFieldMetaFromEs(),isUnsupported:!1}))),i=await Promise.all(e);return new style_fields_helper_StyleFieldsHelper(i)}class style_fields_helper_StyleFieldsHelper{constructor(t){n()(this,"_styleFields",void 0),n()(this,"_ordinalAndCategoricalFields",void 0),n()(this,"_numberFields",void 0),n()(this,"_ordinalFields",void 0);const e=[],i=[],r=[];t.forEach((t=>{(m.h.includes(t.type)||m.rb.includes(t.type))&&e.push(t),"date"!==t.type&&"number"!==t.type||("number"===t.type&&i.push(t),t.supportsAutoDomain&&r.push(t))})),this._styleFields=t,this._ordinalAndCategoricalFields=e,this._numberFields=i,this._ordinalFields=r}hasFieldForStyle(t,e){return this._getFieldsForStyle(e).some((e=>t.getName()===e.name))}_getFieldsForStyle(t){switch(t){case m.Gb.ICON_ORIENTATION:return this._numberFields;case m.Gb.FILL_COLOR:case m.Gb.LINE_COLOR:case m.Gb.LABEL_COLOR:case m.Gb.LABEL_BORDER_COLOR:case m.Gb.ICON:return this._ordinalAndCategoricalFields;case m.Gb.LINE_WIDTH:case m.Gb.LABEL_SIZE:case m.Gb.ICON_SIZE:return this._ordinalFields;case m.Gb.LABEL_TEXT:return this._styleFields;default:return[]}}getFieldsForStyle(t,e){const i=this._getFieldsForStyle(t.getStyleName());return t.isDynamic()&&!t.supportsFeatureState()?i.map((i=>e&&i.origin===m.D.JOIN?{...i,isUnsupported:!0,unsupportedMsg:u.i18n.translate("xpack.maps.style.field.unsupportedWithVectorTileMsg",{defaultMessage:"'{styleLabel}' does not support this field with vector tiles. To style '{styleLabel}' with this field, select 'Limit results' in 'Scaling'.",values:{styleLabel:Object(f.b)(t.getStyleName())}})}:i)):i}getStyleFields(){return this._styleFields}}class vector_style_editor_VectorStyleEditor extends o.Component{constructor(t){super(t),n()(this,"_isMounted",!1),n()(this,"_handleSelectedFeatureChange",(t=>{this.setState({selectedFeature:t})})),n()(this,"_onIsTimeAwareChange",(t=>{this.props.onIsTimeAwareChange(t.target.checked)})),n()(this,"_onStaticStyleChange",((t,e)=>{const i={type:m.Cb.STATIC,options:e};this.props.handlePropertyChange(t,i)})),n()(this,"_onDynamicStyleChange",((t,e)=>{const i={type:m.Cb.DYNAMIC,options:e};this.props.handlePropertyChange(t,i)}));let e=m.Fb.POLYGON;t.isPointsOnly?e=m.Fb.POINT:t.isLinesOnly&&(e=m.Fb.LINE),this.state={styleFields:[],defaultDynamicProperties:Object(X.i)(),defaultStaticProperties:Object(X.j)(),supportedFeatures:[],selectedFeature:e}}componentWillUnmount(){this._isMounted=!1}componentDidMount(){this._isMounted=!0,this._loadFields(),this._loadSupportedFeatures()}componentDidUpdate(){this._loadFields(),this._loadSupportedFeatures()}async _loadFields(){const t=await Ft(await this.props.layer.getStyleEditorFields()),e=t.getStyleFields();!this._isMounted||c.a.isEqual(e,this.state.styleFields)&&void 0!==this.state.styleFieldsHelper||this.setState({styleFields:e,styleFieldsHelper:t})}async _loadSupportedFeatures(){const t=await this.props.layer.getSource().getSupportedShapeTypes();this._isMounted&&!c.a.isEqual(t,this.state.supportedFeatures)&&this.setState({supportedFeatures:t})}_hasMarkerOrIcon(){const t=this.props.styleProperties[m.Gb.ICON_SIZE];return t.isDynamic()||t.getOptions().size>0}_hasLabelBorder(){return this.props.styleProperties[m.Gb.LABEL_BORDER_SIZE].getOptions().size!==m.V.NONE}_isLayerSourceMvt(){return this.props.layer.getSource().isMvt()}_renderFillColor(t=!1){const e=this.props.styleProperties[m.Gb.FILL_COLOR];return Object(g.jsx)($,{disabled:t&&!this._hasMarkerOrIcon(),disabledBy:m.Gb.ICON_SIZE,swatches:N.b,onStaticStyleChange:this._onStaticStyleChange,onDynamicStyleChange:this._onDynamicStyleChange,styleProperty:e,fields:this.state.styleFieldsHelper.getFieldsForStyle(e,this._isLayerSourceMvt()),defaultStaticStyleOptions:this.state.defaultStaticProperties[m.Gb.FILL_COLOR].options,defaultDynamicStyleOptions:this.state.defaultDynamicProperties[m.Gb.FILL_COLOR].options})}_renderLineColor(t=!1){const e=t&&!this._hasMarkerOrIcon(),i=this.props.styleProperties[m.Gb.LINE_COLOR];return Object(g.jsx)($,{disabled:e||!this.props.hasBorder,disabledBy:e?m.Gb.ICON_SIZE:m.Gb.LINE_WIDTH,swatches:N.d,onStaticStyleChange:this._onStaticStyleChange,onDynamicStyleChange:this._onDynamicStyleChange,styleProperty:i,fields:this.state.styleFieldsHelper.getFieldsForStyle(i,this._isLayerSourceMvt()),defaultStaticStyleOptions:this.state.defaultStaticProperties[m.Gb.LINE_COLOR].options,defaultDynamicStyleOptions:this.state.defaultDynamicProperties[m.Gb.LINE_COLOR].options})}_renderLineWidth(t=!1){const e=this.props.styleProperties[m.Gb.LINE_WIDTH];return Object(g.jsx)(et,{disabled:t&&!this._hasMarkerOrIcon(),disabledBy:m.Gb.ICON_SIZE,onStaticStyleChange:this._onStaticStyleChange,onDynamicStyleChange:this._onDynamicStyleChange,styleProperty:e,fields:this.state.styleFieldsHelper.getFieldsForStyle(e,this._isLayerSourceMvt()),defaultStaticStyleOptions:this.state.defaultStaticProperties[m.Gb.LINE_WIDTH].options,defaultDynamicStyleOptions:this.state.defaultDynamicProperties[m.Gb.LINE_WIDTH].options})}_renderLabelProperties(t){const e=Object(U.g)(this.props.styleProperties[m.Gb.LABEL_TEXT]),i=this._hasLabelBorder(),r=this.props.styleProperties[m.Gb.LABEL_TEXT],n=this.props.styleProperties[m.Gb.LABEL_COLOR],l=this.props.styleProperties[m.Gb.LABEL_SIZE],c=this.props.styleProperties[m.Gb.LABEL_BORDER_COLOR];return Object(g.jsx)(o.Fragment,null,Object(g.jsx)(Mt,{onStaticStyleChange:this._onStaticStyleChange,onDynamicStyleChange:this._onDynamicStyleChange,styleProperty:r,fields:this.state.styleFieldsHelper.getFieldsForStyle(r,this._isLayerSourceMvt()),defaultStaticStyleOptions:this.state.defaultStaticProperties[m.Gb.LABEL_TEXT].options,defaultDynamicStyleOptions:this.state.defaultDynamicProperties[m.Gb.LABEL_TEXT].options}),Object(g.jsx)(h.EuiSpacer,{size:"m"}),t?Object(g.jsx)(a.a.Fragment,null,Object(g.jsx)(At,{hasLabel:e,handlePropertyChange:this.props.handlePropertyChange,styleProperty:this.props.styleProperties[m.Gb.LABEL_POSITION]}),Object(g.jsx)(h.EuiSpacer,{size:"m"})):null,Object(g.jsx)(Tt,{disabled:!e,disabledBy:m.Gb.LABEL_TEXT,handlePropertyChange:this.props.handlePropertyChange,styleProperty:this.props.styleProperties[m.Gb.LABEL_ZOOM_RANGE]}),Object(g.jsx)(h.EuiSpacer,{size:"m"}),Object(g.jsx)($,{disabled:!e,disabledBy:m.Gb.LABEL_TEXT,swatches:N.d,onStaticStyleChange:this._onStaticStyleChange,onDynamicStyleChange:this._onDynamicStyleChange,styleProperty:n,fields:this.state.styleFieldsHelper.getFieldsForStyle(n,this._isLayerSourceMvt()),defaultStaticStyleOptions:this.state.defaultStaticProperties[m.Gb.LABEL_COLOR].options,defaultDynamicStyleOptions:this.state.defaultDynamicProperties[m.Gb.LABEL_COLOR].options}),Object(g.jsx)(h.EuiSpacer,{size:"m"}),Object(g.jsx)(et,{disabled:!e,disabledBy:m.Gb.LABEL_TEXT,onStaticStyleChange:this._onStaticStyleChange,onDynamicStyleChange:this._onDynamicStyleChange,styleProperty:l,fields:this.state.styleFieldsHelper.getFieldsForStyle(l,this._isLayerSourceMvt()),defaultStaticStyleOptions:this.state.defaultStaticProperties[m.Gb.LABEL_SIZE].options,defaultDynamicStyleOptions:this.state.defaultDynamicProperties[m.Gb.LABEL_SIZE].options}),Object(g.jsx)(h.EuiSpacer,{size:"m"}),Object(g.jsx)($,{disabled:!e||!i,disabledBy:e?m.Gb.LABEL_BORDER_SIZE:m.Gb.LABEL_TEXT,swatches:N.d,onStaticStyleChange:this._onStaticStyleChange,onDynamicStyleChange:this._onDynamicStyleChange,styleProperty:c,fields:this.state.styleFieldsHelper.getFieldsForStyle(c,this._isLayerSourceMvt()),defaultStaticStyleOptions:this.state.defaultStaticProperties[m.Gb.LABEL_BORDER_COLOR].options,defaultDynamicStyleOptions:this.state.defaultDynamicProperties[m.Gb.LABEL_BORDER_COLOR].options}),Object(g.jsx)(h.EuiSpacer,{size:"m"}),Object(g.jsx)(It,{disabled:!e,disabledBy:m.Gb.LABEL_TEXT,handlePropertyChange:this.props.handlePropertyChange,styleProperty:this.props.styleProperties[m.Gb.LABEL_BORDER_SIZE]}),Object(g.jsx)(h.EuiSpacer,{size:"m"}))}_renderPointProperties(){const t=this._hasMarkerOrIcon();let e,i;if(this.props.styleProperties[m.Gb.SYMBOLIZE_AS].isSymbolizedAsIcon()){const r=this.props.styleProperties[m.Gb.ICON_ORIENTATION],n=this.props.styleProperties[m.Gb.ICON];e=Object(g.jsx)(o.Fragment,null,Object(g.jsx)(kt,{disabled:!t,disabledBy:m.Gb.ICON_SIZE,onStaticStyleChange:this._onStaticStyleChange,onDynamicStyleChange:this._onDynamicStyleChange,styleProperty:r,fields:this.state.styleFieldsHelper.getFieldsForStyle(r,this._isLayerSourceMvt()),defaultStaticStyleOptions:this.state.defaultStaticProperties[m.Gb.ICON_ORIENTATION].options,defaultDynamicStyleOptions:this.state.defaultDynamicProperties[m.Gb.ICON_ORIENTATION].options}),Object(g.jsx)(h.EuiSpacer,{size:"m"})),i=Object(g.jsx)(o.Fragment,null,Object(g.jsx)(vt,{disabled:!t,disabledBy:m.Gb.ICON_SIZE,customIcons:this.props.customIcons,onStaticStyleChange:this._onStaticStyleChange,onDynamicStyleChange:this._onDynamicStyleChange,onCustomIconsChange:this.props.onCustomIconsChange,styleProperty:n,fields:this.state.styleFieldsHelper.getFieldsForStyle(n,this._isLayerSourceMvt()),defaultStaticStyleOptions:this.state.defaultStaticProperties[m.Gb.ICON].options,defaultDynamicStyleOptions:this.state.defaultDynamicProperties[m.Gb.ICON].options}),Object(g.jsx)(h.EuiSpacer,{size:"m"}))}const r=this.props.styleProperties[m.Gb.ICON_SIZE];return Object(g.jsx)(o.Fragment,null,Object(g.jsx)(ot,{disabled:!t,disabledBy:m.Gb.ICON_SIZE,styleProperty:this.props.styleProperties[m.Gb.SYMBOLIZE_AS],handlePropertyChange:this.props.handlePropertyChange}),Object(g.jsx)(h.EuiSpacer,{size:"m"}),i,this._renderFillColor(!0),Object(g.jsx)(h.EuiSpacer,{size:"m"}),this._renderLineColor(!0),Object(g.jsx)(h.EuiSpacer,{size:"m"}),this._renderLineWidth(!0),Object(g.jsx)(h.EuiSpacer,{size:"m"}),e,Object(g.jsx)(et,{onStaticStyleChange:this._onStaticStyleChange,onDynamicStyleChange:this._onDynamicStyleChange,styleProperty:r,fields:this.state.styleFieldsHelper.getFieldsForStyle(r,this._isLayerSourceMvt()),defaultStaticStyleOptions:this.state.defaultStaticProperties[m.Gb.ICON_SIZE].options,defaultDynamicStyleOptions:this.state.defaultDynamicProperties[m.Gb.ICON_SIZE].options}),Object(g.jsx)(h.EuiSpacer,{size:"m"}),this._renderLabelProperties(!0))}_renderLineProperties(){return Object(g.jsx)(o.Fragment,null,this._renderLineColor(),Object(g.jsx)(h.EuiSpacer,{size:"m"}),this._renderLineWidth(),Object(g.jsx)(h.EuiSpacer,{size:"m"}),this._renderLabelProperties(!1))}_renderPolygonProperties(){return Object(g.jsx)(o.Fragment,null,this._renderFillColor(),Object(g.jsx)(h.EuiSpacer,{size:"m"}),this._renderLineColor(),Object(g.jsx)(h.EuiSpacer,{size:"m"}),this._renderLineWidth(),Object(g.jsx)(h.EuiSpacer,{size:"m"}),this._renderLabelProperties(!1))}_renderProperties(){const{supportedFeatures:t,selectedFeature:e,styleFieldsHelper:i}=this.state;if(0===t.length||!i)return null;if(1===t.length)switch(t[0]){case m.Fb.POINT:return this._renderPointProperties();case m.Fb.LINE:return this._renderLineProperties();case m.Fb.POLYGON:return this._renderPolygonProperties()}const r=[{id:m.Fb.POINT,label:u.i18n.translate("xpack.maps.vectorStyleEditor.pointLabel",{defaultMessage:"Points"})},{id:m.Fb.LINE,label:u.i18n.translate("xpack.maps.vectorStyleEditor.lineLabel",{defaultMessage:"Lines"})},{id:m.Fb.POLYGON,label:u.i18n.translate("xpack.maps.vectorStyleEditor.polygonLabel",{defaultMessage:"Polygons"})}];let n=this._renderPolygonProperties();return e===m.Fb.LINE?n=this._renderLineProperties():e===m.Fb.POINT&&(n=this._renderPointProperties()),Object(g.jsx)(o.Fragment,null,Object(g.jsx)(h.EuiButtonGroup,{legend:u.i18n.translate("xpack.maps.vectorStyleEditor.featureTypeButtonGroupLegend",{defaultMessage:"vector feature button group"}),options:r,idSelected:e,onChange:this._handleSelectedFeatureChange}),Object(g.jsx)(h.EuiSpacer,{size:"m"}),n)}_renderIsTimeAwareSwitch(){return this.props.showIsTimeAware?Object(g.jsx)(h.EuiFormRow,{display:"columnCompressedSwitch"},Object(g.jsx)(h.EuiSwitch,{label:u.i18n.translate("xpack.maps.vectorStyleEditor.isTimeAwareLabel",{defaultMessage:"Apply global time to style metadata requests"}),checked:this.props.isTimeAware,onChange:this._onIsTimeAwareChange,compressed:!0})):null}render(){return Object(g.jsx)(o.Fragment,null,this._renderProperties(),this._renderIsTimeAwareSwitch())}}class style_meta_StyleMeta{constructor(t){n()(this,"_descriptor",void 0),this._descriptor=t||{fieldMeta:{}}}getRangeFieldMetaDescriptor(t){return this._descriptor.fieldMeta[t]&&this._descriptor.fieldMeta[t].range?this._descriptor.fieldMeta[t].range:null}getCategoryFieldMetaDescriptor(t){return this._descriptor.fieldMeta[t]?this._descriptor.fieldMeta[t].categories:[]}isPointsOnly(){return!!this._descriptor.geometryTypes&&!!this._descriptor.geometryTypes.isPointsOnly}isLinesOnly(){return!!this._descriptor.geometryTypes&&!!this._descriptor.geometryTypes.isLinesOnly}isPolygonsOnly(){return!!this._descriptor.geometryTypes&&!!this._descriptor.geometryTypes.isPolygonsOnly}}const Dt=({style:t})=>Object(g.jsx)("svg",{className:"euiIcon euiIcon--medium mapFillableCircle",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",style:t,viewBox:"0 0 16 16"},Object(g.jsx)("defs",null,Object(g.jsx)("path",{id:"fillableCircle",d:"M8,15 C11.8659932,15 15,11.8659932 15,8 C15,4.13400675 11.8659932, 1 8,1 C4.13400675,1 1,4.13400675 1,8 C1,11.8659932 4.13400675,15 8, 15 Z M8,16 C3.581722,16 0,12.418278 0,8 C0,3.581722 3.581722,0 8, 0 C12.418278,0 16,3.581722 16,8 C16,12.418278 12.418278,16 8,16 Z M8, 12 C10.209139,12 12,10.209139 12,8 C12,5.790861 10.209139,4 8, 4 C5.790861,4 4,5.790861 4,8 C4,10.209139 5.790861,12 8,12 Z M8, 11 C6.34314575,11 5,9.65685425 5,8 C5,6.34314575 6.34314575,5 8, 5 C9.65685425,5 11,6.34314575 11,8 C11,9.65685425 9.65685425,11 8, 11 Z M8,9 C8.55228475,9 9,8.55228475 9,8 C9,7.44771525 8.55228475,7 8, 7 C7.44771525,7 7,7.44771525 7,8 C7,8.55228475 7.44771525,9 8,9 Z"})),Object(g.jsx)("g",null,Object(g.jsx)("ellipse",{id:"path3353",cx:"8.0350437",cy:"7.9660664",rx:"7.3820276",ry:"7.3809776",transform:"matrix(0.99985753,0.01687955,0,1,0,0)"}))),zt=({style:t})=>Object(g.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",style:t},Object(g.jsx)("line",{x1:"0",y1:"6",x2:"16",y2:"6"})),Rt=({style:t})=>Object(g.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",style:t},Object(g.jsx)("rect",{width:"15",height:"15",x:".5",y:".5",rx:"4"}));function jt({borderStyle:t={},fillColor:e,isPointsOnly:i,isLinesOnly:r,strokeColor:n,symbolId:o,svg:a}){if(r){const e={stroke:n,strokeWidth:"4px",...t};return Object(g.jsx)(zt,{style:e})}const l={stroke:n,strokeWidth:"1px",fill:e,...t};return i?o?a?Object(g.jsx)(lt.a,{key:`${o}${e}${n}`,symbolId:o,fill:e,stroke:n,style:t,svg:a}):null:Object(g.jsx)(Dt,{style:l}):Object(g.jsx)(Rt,{style:l})}var Nt=i(212);function Bt({isLinesOnly:t,isPointsOnly:e,masks:i,styles:r,symbolId:n,svg:o}){const l=[];for(let i=0;ie.getEsAggField().getOrigin()===t));if(0===e.length)return null;if(1===e.length){const t=e[0];return Object(g.jsx)(Nt.a,{key:t.getEsAggField().getMbFieldName(),esAggField:t.getEsAggField(),operator:t.getOperator(),value:t.getValue()})}return Object(g.jsx)(a.a.Fragment,null,Object(g.jsx)(h.EuiText,{size:"xs",textAlign:"left",color:"subdued"},Object(g.jsx)("small",null,e[0].getFieldOriginListLabel())),Object(g.jsx)("ul",null,e.map((t=>Object(g.jsx)("li",{key:t.getEsAggField().getMbFieldName(),style:{marginLeft:V.euiThemeVars.euiSizeS}},Object(g.jsx)(Nt.a,{esAggField:t.getEsAggField(),onlyShowLabelAndValue:!0,operator:t.getOperator(),value:t.getValue()}))))))}return Object(g.jsx)(a.a.Fragment,null,c(m.D.SOURCE),c(m.D.JOIN),l)}var Vt=i(129);class static_style_property_StaticStyleProperty extends Vt.a{}n()(static_style_property_StaticStyleProperty,"type",m.Cb.STATIC);var Ut=i(123);class right_aligned_text_RightAlignedText extends o.Component{constructor(...t){super(...t),n()(this,"_textRef",a.a.createRef())}componentDidMount(){this._setWidth()}componentDidUpdate(){this._setWidth()}_setWidth(){this._textRef.current&&this.props.setWidth(this._textRef.current.getBBox().width)}render(){return Object(g.jsx)("text",{ref:this._textRef,style:this.props.style,textAnchor:"end",x:this.props.x,y:this.props.y},this.props.value)}}function Ht(t,e,i){return t&&e?`> ${i}`:i}function Gt(t,e,i){return t&&e?`< ${i}`:i}class marker_list_MarkerList{constructor(t,e){n()(this,"_minFontDistance",void 0),n()(this,"_maxMarker",void 0),n()(this,"_markers",[]),this._minFontDistance=.85*t,this._maxMarker=e}push(t){t.textY-this._maxMarker.textYthis._minFontDistance&&this._markers.push(t):this._markers.push(t))}getMarkers(){return[...this._markers.map((t=>t.svg)),this._maxMarker.svg]}}class marker_size_legend_MarkerSizeLegend extends o.Component{static getDerivedStateFromProps(t,e){const i=t.style.getRangeFieldMeta();return c.a.isEqual(i,e.fieldMeta)?null:{maxLabelWidth:0,fieldMeta:i}}constructor(t){super(t),n()(this,"_isMounted",!1),n()(this,"_onRightAlignedWidthChange",(t=>{t>this.state.maxLabelWidth&&this.setState({maxLabelWidth:t})})),this.state={label:"",maxLabelWidth:0,fieldMeta:this.props.style.getRangeFieldMeta()}}componentDidMount(){this._isMounted=!0,this._loadLabel()}componentDidUpdate(){this._loadLabel()}componentWillUnmount(){this._isMounted=!1}async _loadLabel(){const t=this.props.style.getField();if(!t)return;const e=await t.getLabel();this._isMounted&&this.state.label!==e&&this.setState({label:e})}_formatValue(t){return""===t?t:this.props.style.formatField(t)}_renderMarkers(){const t=this.state.fieldMeta,e=this.props.style.getOptions();if(!t||!e)return null;const i=void 0!==e.invert&&e.invert,r={fillOpacity:0,stroke:V.euiThemeVars.euiTextColor,strokeWidth:1},n=2*e.maxSize+5+2*r.strokeWidth,o=e.maxSize+r.strokeWidth,a=n-r.strokeWidth,l=(t,e)=>{const i=a-t,l=i-t,c=this.state.maxLabelWidth+5,u=l+5,h=u>n?n:u;return{svg:Object(g.jsx)("g",{key:t},Object(g.jsx)("line",{style:{stroke:V.euiThemeVars.euiBorderColor},x1:o,y1:l,x2:2.25*o,y2:l}),Object(g.jsx)(right_aligned_text_RightAlignedText,{setWidth:this._onRightAlignedWidthChange,style:{fontSize:10,fill:V.euiThemeVars.euiTextColor},x:2.25*o+c,y:h,value:e}),Object(g.jsx)("circle",{style:r,cx:o,cy:i,r:t})),textY:h}};function c(t){return t*(e.maxSize-e.minSize)+e.minSize}function u(e){const r=Math.pow(e*Math.sqrt(t.delta),2),n=i?t.max-r:r+t.min;return t.delta>3?Math.round(n):n}const h=Ht(this.props.style.isFieldMetaEnabled(),Boolean(t.isMaxOutsideStdRange),this._formatValue(t.max)),p=Gt(this.props.style.isFieldMetaEnabled(),Boolean(t.isMinOutsideStdRange),this._formatValue(t.min)),d=new marker_list_MarkerList(10,l(e.maxSize,i?p:h));return t.delta>0&&(d.push(l(e.minSize,i?h:p)),d.push(l(c(.25),this._formatValue(u(.25)))),d.push(l(c(.5),this._formatValue(u(.5)))),d.push(l(c(.75),this._formatValue(u(.75))))),Object(g.jsx)("svg",{height:n,xmlns:"http://www.w3.org/2000/svg"},d.getMarkers())}render(){return Object(g.jsx)("div",null,Object(g.jsx)(h.EuiFlexGroup,{gutterSize:"xs",justifyContent:"spaceBetween"},Object(g.jsx)(h.EuiFlexItem,{grow:!1},Object(g.jsx)(h.EuiToolTip,{position:"top",title:this.props.style.getDisplayStyleName(),content:this.state.label},Object(g.jsx)(h.EuiText,{className:"eui-textTruncate",size:"xs",style:{maxWidth:"180px"}},Object(g.jsx)("small",null,Object(g.jsx)("strong",null,this.state.label)))))),this._renderMarkers())}}var qt=i(213);const Zt="";class ordinal_legend_OrdinalLegend extends o.Component{constructor(...t){super(...t),n()(this,"_isMounted",!1),n()(this,"state",{label:Zt})}componentDidMount(){this._isMounted=!0,this._loadLabel()}componentDidUpdate(){this._loadLabel()}componentWillUnmount(){this._isMounted=!1}async _loadLabel(){const t=this.props.style.getField();if(!t)return;const e=await t.getLabel();this._isMounted&&!c.a.isEqual(this.state.label,e)&&this.setState({label:e})}_formatValue(t){return t===Zt?t:this.props.style.formatField(t)}_renderRangeLegendHeader(){let t;if(this.props.style.getStyleName()===m.Gb.LINE_WIDTH)t=function(){const t={stroke:"grey",fill:"none",width:"12px"};return[Object(g.jsx)(Dt,{style:{...t,strokeWidth:"1px"}}),Object(g.jsx)(Dt,{style:{...t,strokeWidth:"2px"}}),Object(g.jsx)(Dt,{style:{...t,strokeWidth:"3px"}})]}();else{if(this.props.style.getStyleName()!==m.Gb.ICON_SIZE)return null;t=function(){const t={stroke:"grey",fill:"grey"};return[Object(g.jsx)(Dt,{style:{...t,width:"4px"}}),Object(g.jsx)(Dt,{style:{...t,width:"8px"}}),Object(g.jsx)(Dt,{style:{...t,width:"12px"}})]}()}return Object(g.jsx)(h.EuiFlexGroup,{gutterSize:"xs",justifyContent:"spaceBetween",alignItems:"center"},t.map(((e,i)=>{let r;return i===t.length-1||(r=Object(g.jsx)(h.EuiFlexItem,null,Object(g.jsx)(h.EuiHorizontalRule,{margin:"xs"}))),Object(g.jsx)(o.Fragment,{key:i},Object(g.jsx)(h.EuiFlexItem,{grow:!1},e),r)})))}render(){const t=this._renderRangeLegendHeader();if(!t)return null;const e=this.props.style.getRangeFieldMeta();let i=Zt,r=Zt;if(e){const t=this._formatValue(c.a.get(e,"min",Zt));i=Gt(this.props.style.isFieldMetaEnabled(),Boolean(e.isMinOutsideStdRange),t);const n=this._formatValue(c.a.get(e,"max",Zt));r=Ht(this.props.style.isFieldMetaEnabled(),Boolean(e.isMaxOutsideStdRange),n)}const n=this.props.style.getOptions(),o=void 0!==n.invert&&n.invert;return Object(g.jsx)(qt.a,{header:t,minLabel:i,maxLabel:r,propertyLabel:this.props.style.getDisplayStyleName(),fieldLabel:this.state.label,invert:o})}}class dynamic_size_property_DynamicSizeProperty extends Ut.a{constructor(t,e,i,r,o,a){super(t,e,i,r,o),n()(this,"_isSymbolizedAsIcon",void 0),this._isSymbolizedAsIcon=a}supportsFeatureState(){return(this.getStyleName()!==m.Gb.ICON_SIZE||!this._isSymbolizedAsIcon)&&this.getStyleName()!==m.Gb.LABEL_SIZE}syncHaloWidthWithMb(t,e){e.setPaintProperty(t,"icon-halo-width",this.getMbSizeExpression())}syncIconSizeWithMb(t,e){e.setLayoutProperty(t,"icon-size",this.getMbSizeExpression())}syncCircleStrokeWidthWithMb(t,e){e.setPaintProperty(t,"circle-stroke-width",this.getMbSizeExpression())}syncCircleRadiusWithMb(t,e){e.setPaintProperty(t,"circle-radius",this.getMbSizeExpression())}syncLineWidthWithMb(t,e){e.setPaintProperty(t,"line-width",this.getMbSizeExpression())}syncLabelSizeWithMb(t,e){e.setLayoutProperty(t,"text-size",this.getMbSizeExpression())}getMbSizeExpression(t){const e=this.getRangeFieldMeta();if(!this.isSizeDynamicConfigComplete()||!e)return this._options.minSize>=0?this._options.minSize:null;const i=this.getStyleName()===m.Gb.ICON_SIZE,r=e.min<1?Math.abs(e.min)+1:0,n=i?Math.sqrt(e.max+r):e.max,o=i?Math.sqrt(e.min+r):e.min,a=null!=t&&t.maxStopOutput?t.maxStopOutput:this.getMaxStopOutput(),l=null!=t&&t.minStopOutput?t.minStopOutput:this.getMinStopOutput(),c=void 0!==this._options.invert&&this._options.invert,u=e.min===e.max?c?[n,l]:[n,a]:c?[o,a,n,l]:[o,l,n,a],h=Object(U.h)({lookupFunction:null!=t&&t.forceFeatureProperties?m.ib.GET:this.getMbLookupFunction(),maxValue:e.max,minValue:e.min,fieldName:this.getMbFieldName(),fallback:c?e.max:e.min}),p=e.min<1?["+",h,r]:h;return["interpolate",["linear"],i?["sqrt",p]:h,...u]}getMaxStopOutput(){return this.getStyleName()===m.Gb.ICON_SIZE&&this._isSymbolizedAsIcon?this._options.maxSize/m.M:this._options.maxSize}getMinStopOutput(){return this.getStyleName()===m.Gb.ICON_SIZE&&this._isSymbolizedAsIcon?this._options.minSize/m.M:this._options.minSize}isSizeDynamicConfigComplete(){return this._field&&this._field.isValid()&&this._options.minSize>=0&&this._options.maxSize>=0}renderLegendDetailRow(){return this.getStyleName()!==m.Gb.ICON_SIZE||this._isSymbolizedAsIcon?Object(g.jsx)(ordinal_legend_OrdinalLegend,{style:this}):Object(g.jsx)(marker_size_legend_MarkerSizeLegend,{style:this})}}class static_size_property_StaticSizeProperty extends static_style_property_StaticStyleProperty{constructor(t,e){"number"!=typeof t.size?super({size:1},e):super(t,e)}syncHaloWidthWithMb(t,e){e.setPaintProperty(t,"icon-halo-width",this._options.size)}syncIconSizeWithMb(t,e){e.setLayoutProperty(t,"icon-size",this._options.size/m.M)}syncCircleStrokeWidthWithMb(t,e,i){i?e.setPaintProperty(t,"circle-stroke-width",0):e.setPaintProperty(t,"circle-stroke-width",this._options.size)}syncCircleRadiusWithMb(t,e){e.setPaintProperty(t,"circle-radius",this._options.size)}syncLineWidthWithMb(t,e){e.setPaintProperty(t,"line-width",this._options.size)}syncLabelSizeWithMb(t,e){e.setLayoutProperty(t,"text-size",this._options.size)}}class static_color_property_StaticColorProperty extends static_style_property_StaticStyleProperty{syncCircleColorWithMb(t,e,i){e.setPaintProperty(t,"circle-color",this._options.color),e.setPaintProperty(t,"circle-opacity",i)}syncFillColorWithMb(t,e,i){e.setPaintProperty(t,"fill-color",this._options.color),e.setPaintProperty(t,"fill-opacity",i)}syncIconColorWithMb(t,e){e.setPaintProperty(t,"icon-color",this._options.color)}syncHaloBorderColorWithMb(t,e){e.setPaintProperty(t,"icon-halo-color",this._options.color)}syncLineColorWithMb(t,e,i){e.setPaintProperty(t,"line-color",this._options.color),e.setPaintProperty(t,"line-opacity",i)}syncCircleStrokeWithMb(t,e,i){e.setPaintProperty(t,"circle-stroke-color",this._options.color),e.setPaintProperty(t,"circle-stroke-opacity",i)}syncLabelColorWithMb(t,e,i){e.setPaintProperty(t,"text-color",this._options.color),e.setPaintProperty(t,"text-opacity",i)}syncLabelBorderColorWithMb(t,e){e.setPaintProperty(t,"text-halo-color",this._options.color)}}function $t({styleName:t,label:e,color:i,isLinesOnly:r,isPointsOnly:n,symbolId:o,svg:a}){return Object(g.jsx)(h.EuiFlexGroup,{direction:"row",gutterSize:"none"},Object(g.jsx)(h.EuiFlexItem,{className:"mapLegendIconPreview",grow:!1},t===m.Gb.LABEL_COLOR?Object(g.jsx)(h.EuiText,{size:"xs",style:{color:i}},"Tx"):Object(g.jsx)(jt,{fillColor:t===m.Gb.FILL_COLOR?i:"none",isPointsOnly:n,isLinesOnly:r,strokeColor:i,symbolId:o,svg:a})),Object(g.jsx)(h.EuiFlexItem,null,Object(g.jsx)(h.EuiText,{size:"xs"},e)))}class breaked_legend_BreakedLegend extends o.Component{constructor(...t){super(...t),n()(this,"_isMounted",!1),n()(this,"state",{label:""})}componentDidMount(){this._isMounted=!0,this._loadLabel()}componentDidUpdate(){this._loadLabel()}componentWillUnmount(){this._isMounted=!1}async _loadLabel(){const t=this.props.style.getField();if(!t)return;const e=await t.getLabel();this._isMounted&&!c.a.isEqual(this.state.label,e)&&this.setState({label:e})}render(){if(""===this.state.label)return null;const t=this.props.breaks.map((({symbolId:t,svg:e,label:i,color:r},n)=>Object(g.jsx)(h.EuiFlexItem,{key:n},Object(g.jsx)($t,{styleName:this.props.style.getStyleName(),label:i,color:r,isLinesOnly:this.props.isLinesOnly,isPointsOnly:this.props.isPointsOnly,symbolId:t,svg:e}))));return Object(g.jsx)("div",null,Object(g.jsx)(h.EuiFlexGroup,{gutterSize:"xs",justifyContent:"spaceBetween"},Object(g.jsx)(h.EuiFlexItem,{grow:!1},Object(g.jsx)(h.EuiToolTip,{position:"top",title:this.props.style.getDisplayStyleName(),content:this.state.label},Object(g.jsx)(h.EuiText,{className:"eui-textTruncate",size:"xs",style:{maxWidth:"180px"}},Object(g.jsx)("small",null,Object(g.jsx)("strong",null,this.state.label)))))),Object(g.jsx)(h.EuiFlexGroup,{direction:"column",gutterSize:"none"},t))}}var Wt=i(269);const Xt=u.i18n.translate("xpack.maps.legend.upto",{defaultMessage:"up to"}),Yt="rgba(0,0,0,0)";class dynamic_color_property_DynamicColorProperty extends Ut.a{constructor(t,e,i,r,o,a){super(t,e,i,r,o),n()(this,"_chartsPaletteServiceGetColor",void 0),this._chartsPaletteServiceGetColor=a}syncCircleColorWithMb(t,e,i){const r=this._getMbColor();e.setPaintProperty(t,"circle-color",r),e.setPaintProperty(t,"circle-opacity",i)}syncIconColorWithMb(t,e){const i=this._getMbColor();e.setPaintProperty(t,"icon-color",i)}syncHaloBorderColorWithMb(t,e){const i=this._getMbColor();e.setPaintProperty(t,"icon-halo-color",i)}syncCircleStrokeWithMb(t,e,i){const r=this._getMbColor();e.setPaintProperty(t,"circle-stroke-color",r),e.setPaintProperty(t,"circle-stroke-opacity",i)}syncFillColorWithMb(t,e,i){const r=this._getMbColor();e.setPaintProperty(t,"fill-color",r),e.setPaintProperty(t,"fill-opacity",i)}syncLineColorWithMb(t,e,i){const r=this._getMbColor();e.setPaintProperty(t,"line-color",r),e.setPaintProperty(t,"line-opacity",i)}syncLabelColorWithMb(t,e,i){const r=this._getMbColor();e.setPaintProperty(t,"text-color",r),e.setPaintProperty(t,"text-opacity",i)}syncLabelBorderColorWithMb(t,e){const i=this._getMbColor();e.setPaintProperty(t,"text-halo-color",i)}supportsFieldMeta(){return!!(this.isComplete()&&this._field&&this._field.supportsFieldMetaFromEs())&&(this.isCategorical()&&!this._options.useCustomColorPalette||this.isOrdinal()&&!this._options.useCustomColorRamp)}isOrdinal(){return void 0===this._options.type||this._options.type===m.j.ORDINAL}isCategorical(){return this._options.type===m.j.CATEGORICAL}getNumberOfCategories(){if(!this._options.colorCategory)return 0;const t=Object(N.f)(this._options.colorCategory);return t?t.length:0}_getSupportedDataMappingFunctions(){return[m.n.INTERPOLATE,m.n.PERCENTILES]}_getMbColor(){return this.getMbFieldName()?this.isCategorical()?this._getCategoricalColorMbExpression():this._getOrdinalColorMbExpression():null}_getOrdinalColorMbExpression(){const t=void 0!==this._options.invert&&this._options.invert,e=this.getMbFieldName();if(this._options.useCustomColorRamp){if(!this._options.customColorRamp||!this._options.customColorRamp.length)return null;const t=this._options.customColorRamp.reduce(((t,e)=>[...t,e.stop,e.color]),[]);return["step",Object(U.h)({minValue:t[0],maxValue:t[t.length-2],lookupFunction:this.getMbLookupFunction(),fallback:t[0]-1,fieldName:e}),Yt,...t]}if(this.getDataMappingFunction()===m.n.PERCENTILES){const i=this.getPercentilesFieldMeta();if(!i||!i.length)return null;const r=Object(N.j)(this._options.color?this._options.color:null,i,t);return r?["step",Object(U.h)({minValue:r[0],maxValue:r[r.length-2],lookupFunction:this.getMbLookupFunction(),fallback:r[0]-1,fieldName:e}),Yt,...r]:null}const i=this.getRangeFieldMeta();if(!i)return null;const r=Object(N.i)(this._options.color?this._options.color:null,i.min,i.max,t);if(!r)return null;const n=i.min-1;return["interpolate",["linear"],Object(U.h)({minValue:i.min,maxValue:i.max,lookupFunction:this.getMbLookupFunction(),fallback:n,fieldName:e}),n,Yt,...r]}_getCustomRampColorStops(){return this._options.customColorRamp?this._options.customColorRamp.reduce(((t,e)=>[...t,e.stop,e.color]),[]):[]}_getOtherCategoryColor(){return this._chartsPaletteServiceGetColor?this._chartsPaletteServiceGetColor("__other__"):this._options.otherCategoryColor?this._options.otherCategoryColor:U.a}_getColorPaletteStops(){if(this._options.useCustomColorPalette&&this._options.customColorPalette){if(O(this._options.customColorPalette))return[];const t=[];for(let e=0;et.key===Ut.b)),r=i>0?[...t.slice(0,i),...t.slice(i+1)]:[...t],n=Math.min(e.length,r.length),o=[];for(let t=0;t0?[...o,{stop:Ut.b,color:this._getOtherCategoryColor(),isOtherCategory:!0}]:o}_getCategoricalColorMbExpression(){const t=this._getOtherCategoryColor();if(this._options.useCustomColorPalette&&(!this._options.customColorPalette||!this._options.customColorPalette.length))return t;const e=this._getColorPaletteStops();if(e.length<1)return t;const i=[];for(let t=0;t= ${p}${u}`;o.push({color:h,label:d,symbolId:t,svg:e})}return o}_getCategoricalBreaks(t,e){const i=[];return this._getColorPaletteStops().forEach((({stop:r,color:n,isOtherCategory:o})=>{null!==r&&null!=n&&i.push({color:n,svg:e,symbolId:t,label:o?Object(g.jsx)(h.EuiTextColor,{color:"subdued"},U.b):this.formatField(r)})})),i}renderLegendDetailRow({isPointsOnly:t,isLinesOnly:e,symbolId:i,svg:r}){let n=[];return this.isOrdinal()?n=this._getOrdinalBreaks(i,r):this.isCategorical()&&(n=this._getCategoricalBreaks(i,r)),Object(g.jsx)(breaked_legend_BreakedLegend,{style:this,breaks:n,isPointsOnly:t,isLinesOnly:e})}}class static_orientation_property_StaticOrientationProperty extends static_style_property_StaticStyleProperty{constructor(t,e){"number"!=typeof t.orientation?super({orientation:0},e):super(t,e)}syncIconRotationWithMb(t,e){e.setLayoutProperty(t,"icon-rotate",this._options.orientation)}}class dynamic_orientation_property_DynamicOrientationProperty extends Ut.a{syncIconRotationWithMb(t,e){if(this._field&&this._field.isValid()){const i=this.getMbPropertyName();e.setLayoutProperty(t,"icon-rotate",["coalesce",[this.getMbLookupFunction(),i],0])}else e.setLayoutProperty(t,"icon-rotate",0)}supportsFieldMeta(){return!1}supportsFeatureState(){return!1}}class static_text_property_StaticTextProperty extends static_style_property_StaticStyleProperty{isComplete(){return this.getOptions().value.length>0}syncTextFieldWithMb(t,e){this.getOptions().value.length?e.setLayoutProperty(t,"text-field",this.getOptions().value):void 0!==e.getLayoutProperty(t,"text-field")&&e.setLayoutProperty(t,"text-field",void 0)}}class dynamic_text_property_DynamicTextProperty extends Ut.a{syncTextFieldWithMb(t,e){if(this._field&&this._field.isValid()){const i=this.getMbPropertyName();this._field.isCount()?e.setLayoutProperty(t,"text-field",["number-format",[this.getMbLookupFunction(),i],{locale:u.i18n.getLocale()}]):e.setLayoutProperty(t,"text-field",["coalesce",[this.getMbLookupFunction(),i],""])}else void 0!==e.getLayoutProperty(t,"text-field")&&e.setLayoutProperty(t,"text-field",void 0)}isOrdinal(){return!1}supportsFieldMeta(){return!1}supportsFeatureState(){return!1}getMbPropertyValue(t){return this.formatField(t)}}class label_zoom_range_property_LabelZoomRangeProperty extends Vt.a{constructor(t,e,i,r){super(t,e),n()(this,"_layerMinZoom",void 0),n()(this,"_layerMaxZoom",void 0),this._layerMinZoom=i,this._layerMaxZoom=r}syncLabelZoomRange(t,e){const{maxZoom:i,minZoom:r}=this.getLabelZoomRange();e.setLayerZoomRange(t,r,i)}getLayerZoomRange(){return{maxZoom:this._layerMaxZoom,minZoom:this._layerMinZoom}}getLabelZoomRange(){const{useLayerZoomRange:t,maxZoom:e,minZoom:i}=this.getOptions();return t?this.getLayerZoomRange():{maxZoom:Math.min(this._layerMaxZoom,e),minZoom:Math.max(this._layerMinZoom,i)}}}class label_border_size_property_LabelBorderSizeProperty extends Vt.a{constructor(t,e,i){super(t,e),n()(this,"_labelSizeProperty",void 0),this._labelSizeProperty=i}syncLabelBorderSizeWithMb(t,e){if(this.getOptions().size===m.V.NONE)return void e.setPaintProperty(t,"text-halo-width",0);const i=function(t){switch(t){case m.V.LARGE:return.2;case m.V.MEDIUM:return.125;default:return.0625}}(this.getOptions().size);if(this._labelSizeProperty.isDynamic()&&this._labelSizeProperty.isComplete()){const r=this._labelSizeProperty.getMbSizeExpression();if(r)return void e.setPaintProperty(t,"text-halo-width",["max",["*",r,i],1])}const r=c.a.get(this._labelSizeProperty.getOptions(),"size",X.b),n=Math.max(r*i,1);e.setPaintProperty(t,"text-halo-width",n)}}class label_position_property_LabelPositionProperty extends Vt.a{constructor(t,e,i,r,o,a){super(t,e),n()(this,"_iconProperty",void 0),n()(this,"_iconSizeProperty",void 0),n()(this,"_labelSizeProperty",void 0),n()(this,"_isSymbolizedAsIcon",void 0),this._iconProperty=i,this._iconSizeProperty=r,this._labelSizeProperty=o,this._isSymbolizedAsIcon=a}isDisabled(){return!!this._labelSizeProperty.isDynamic()||!(!this._iconSizeProperty.isDynamic()||!this._iconSizeProperty.isComplete())&&this._isIconSizeFromJoin()}getDisabledReason(){return this._labelSizeProperty.isDynamic()?u.i18n.translate("xpack.maps.labelPosition.dynamicLabelSizeNotSupported",{defaultMessage:"{labelPositionPropertyLabel} is not supported with '{byValueLabel}' {labelSizePropertyLabel}. Set {labelSizePropertyLabel} to '{fixedLabel}' to enable.",values:{byValueLabel:_.toLowerCase(),fixedLabel:y.toLowerCase(),labelSizePropertyLabel:Object(f.b)(m.Gb.LABEL_SIZE).toLowerCase(),labelPositionPropertyLabel:Object(f.b)(m.Gb.LABEL_POSITION)}}):this._isIconSizeFromJoin()?u.i18n.translate("xpack.maps.labelPosition.iconSizeJoinFieldNotSupportMsg",{defaultMessage:"{labelPositionPropertyLabel} is not supported with {iconSizePropertyLabel} join field {iconSizeFieldName}. Set {iconSizePropertyLabel} to source field to enable.",values:{iconSizePropertyLabel:Object(f.b)(m.Gb.ICON_SIZE),iconSizeFieldName:this._iconSizeProperty.getFieldName(),labelPositionPropertyLabel:Object(f.b)(m.Gb.LABEL_POSITION)}}):""}syncLabelPositionWithMb(t,e){if(this._options.position===m.W.CENTER||this.isDisabled())return e.setLayoutProperty(t,"text-offset",[0,0]),void e.setLayoutProperty(t,"text-anchor","center");e.setLayoutProperty(t,"text-anchor",this._options.position===m.W.BOTTOM?"top":"bottom");const i=this._getLabelSize();if(this._iconSizeProperty.isDynamic()&&this._iconSizeProperty.isComplete()&&this._iconSizeProperty.isSizeDynamicConfigComplete()){const r=this._iconSizeProperty.getOptions(),n=this._iconSizeProperty.getMbSizeExpression({forceFeatureProperties:!0,maxStopOutput:["literal",this._getTextOffset(r.maxSize,i)],minStopOutput:["literal",this._getTextOffset(r.minSize,i)]});return void e.setLayoutProperty(t,"text-offset",n)}const r=this._iconSizeProperty.isDynamic()?X.a:this._iconSizeProperty.getOptions().size;e.setLayoutProperty(t,"text-offset",this._getTextOffset(r,i))}_getTextOffset(t,e){const i=t/e;return[0,(this._options.position===m.W.BOTTOM?i:-1*i)*this._getIconScale()]}_getIconScale(){return this._isSymbolizedAsIcon?"center"===(this._iconProperty.isDynamic()?"center":this._iconProperty.getSymbolAnchor())?1:this._options.position===m.W.TOP?1.75:0:1}_getLabelSize(){return this._labelSizeProperty.isDynamic()?X.b:this._labelSizeProperty.getOptions().size}_isIconSizeFromJoin(){return this._iconSizeProperty.isDynamic()&&this._iconSizeProperty.getFieldOrigin()===m.D.JOIN}}function Kt(t,e){if(!t)return e;if(t.type===m.Cb.STATIC)return t.options.color;const i=t.options;if(!i.field||!i.field.name)return e;if(i.type===m.j.CATEGORICAL){if(i.useCustomColorPalette)return i.customColorPalette&&i.customColorPalette.length?i.customColorPalette[0].color:e;if(!i.colorCategory)return e;const t=Object(N.f)(i.colorCategory);return t?t[0]:e}if(i.useCustomColorRamp){if(!i.customColorRamp||!i.customColorRamp.length)return e;const t=Math.floor((i.customColorRamp.length-1)/2);return i.customColorRamp[t].color}if(!i.color)return e;return Object(N.g)(i.color)||e}class symbolize_as_property_SymbolizeAsProperty extends Vt.a{constructor(...t){super(...t),n()(this,"isSymbolizedAsIcon",(()=>this.getOptions().value===m.Db.ICON))}}class static_icon_property_StaticIconProperty extends static_style_property_StaticStyleProperty{syncIconWithMb(t,e){e.setLayoutProperty(t,"icon-anchor",this.getSymbolAnchor()),e.setLayoutProperty(t,"icon-image",this._options.value)}getSymbolAnchor(){return Object(ct.j)(this._options.value)}}class dynamic_icon_property_DynamicIconProperty extends Ut.a{isOrdinal(){return!1}isCategorical(){return!0}getNumberOfCategories(){return Object(ct.g)(this._options.iconPaletteId).length}syncIconWithMb(t,e){this._isIconDynamicConfigComplete()?(e.setLayoutProperty(t,"icon-image",this._getMbIconImageExpression()),e.setLayoutProperty(t,"icon-anchor",this._getMbIconAnchorExpression())):(e.setLayoutProperty(t,"icon-image",null),e.setLayoutProperty(t,"icon-anchor",null))}_getPaletteStops(){if(this._options.useCustomIconMap&&this._options.customIconStops){const t=[];for(let e=1;e0?this._options.customIconStops[0].icon:null,stops:t}}return Object(U.c)({categories:this.getCategoryFieldMeta(),paletteValues:Object(ct.g)(this._options.iconPaletteId)})}_getMbIconImageExpression(){const{stops:t,fallbackSymbolId:e}=this._getPaletteStops();if(t.length<1||!e)return null;const i=[];return t.forEach((({stop:t,style:e})=>{i.push(`${t}`),i.push(e)})),e&&i.push(e),["match",["to-string",["get",this.getMbFieldName()]],...i]}_getMbIconAnchorExpression(){const{stops:t,fallbackSymbolId:e}=this._getPaletteStops();if(t.length<1||!e)return null;const i=[];return t.forEach((({stop:t,style:e})=>{i.push(`${t}`),i.push(Object(ct.j)(e))})),e&&i.push(Object(ct.j)(e)),["match",["to-string",["get",this.getMbFieldName()]],...i]}_isIconDynamicConfigComplete(){return this._field&&this._field.isValid()}renderLegendDetailRow({isPointsOnly:t,isLinesOnly:e}){const{stops:i,fallbackSymbolId:r}=this._getPaletteStops(),n=[],o=this._layer.getCurrentStyle();if(i.forEach((({stop:t,style:e})=>{if(t){const i=o.getIconSvg(e);n.push({color:"grey",label:this.formatField(t),symbolId:e,svg:i})}})),r){const t=o.getIconSvg(r);n.push({color:"grey",label:Object(g.jsx)(h.EuiTextColor,{color:"success"},U.b),symbolId:r,svg:t})}return Object(g.jsx)(breaked_legend_BreakedLegend,{style:this,breaks:n,isPointsOnly:t,isLinesOnly:e})}}class vector_style_VectorStyle{static createDescriptor(t={},e=!0){return{type:m.Y.VECTOR,properties:{...Object(X.j)(),...t},isTimeAware:e}}static createDefaultStyleProperties(t){return Object(X.j)(t)}constructor(t,e,i,r,o){n()(this,"_descriptor",void 0),n()(this,"_layer",void 0),n()(this,"_customIcons",void 0),n()(this,"_source",void 0),n()(this,"_styleMeta",void 0),n()(this,"_symbolizeAs",void 0),n()(this,"_lineColor",void 0),n()(this,"_fillColor",void 0),n()(this,"_lineWidth",void 0),n()(this,"_icon",void 0),n()(this,"_iconSize",void 0),n()(this,"_iconOrientation",void 0),n()(this,"_label",void 0),n()(this,"_labelZoomRange",void 0),n()(this,"_labelSize",void 0),n()(this,"_labelColor",void 0),n()(this,"_labelBorderColor",void 0),n()(this,"_labelBorderSize",void 0),n()(this,"_labelPosition",void 0),n()(this,"getIsPointsOnly",(()=>this._styleMeta.isPointsOnly())),n()(this,"_getIsLinesOnly",(()=>this._styleMeta.isLinesOnly())),n()(this,"_getIsPolygonsOnly",(()=>this._styleMeta.isPolygonsOnly())),n()(this,"_getFieldFormatter",(t=>{const e=this._getDynamicPropertyByFieldName(t);if(!e)return null;let i;if(e.getFieldOrigin()===m.D.SOURCE)i=m.yb;else{const e=this._layer.getValidJoins().find((e=>!!e.getRightJoinSource().getFieldByName(t)));e&&(i=e.getSourceFormattersDataRequestId())}if(!i)return null;const r=this._layer.getDataRequest(i);if(!r||!r.hasData())return null;const n=r.getData();return n?n[t]:null})),n()(this,"_getLegendDetailStyleProperties",(()=>{const t=this.hasLabels();return this.getDynamicPropertiesArray().filter((e=>{const i=e.getStyleName();return![m.Gb.ICON_ORIENTATION,m.Gb.LABEL_TEXT].includes(i)&&!(!t&&X.d.includes(i))&&(this._getIsLinesOnly()?X.e.includes(i):!this._getIsPolygonsOnly()||X.h.includes(i))}))})),this._source=e,this._layer=i,this._customIcons=r,this._descriptor=t?{...t,...vector_style_VectorStyle.createDescriptor(t.properties,t.isTimeAware)}:vector_style_VectorStyle.createDescriptor(),this._styleMeta=new style_meta_StyleMeta(this._descriptor.__styleMeta),this._symbolizeAs=new symbolize_as_property_SymbolizeAsProperty(this._descriptor.properties[m.Gb.SYMBOLIZE_AS].options,m.Gb.SYMBOLIZE_AS),this._lineColor=this._makeColorProperty(this._descriptor.properties[m.Gb.LINE_COLOR],m.Gb.LINE_COLOR,o),this._fillColor=this._makeColorProperty(this._descriptor.properties[m.Gb.FILL_COLOR],m.Gb.FILL_COLOR,o),this._lineWidth=this._makeSizeProperty(this._descriptor.properties[m.Gb.LINE_WIDTH],m.Gb.LINE_WIDTH,this._symbolizeAs.isSymbolizedAsIcon()),this._icon=this._makeIconProperty(this._descriptor.properties[m.Gb.ICON]),this._iconSize=this._makeSizeProperty(this._descriptor.properties[m.Gb.ICON_SIZE],m.Gb.ICON_SIZE,this._symbolizeAs.isSymbolizedAsIcon()),this._iconOrientation=this._makeOrientationProperty(this._descriptor.properties[m.Gb.ICON_ORIENTATION],m.Gb.ICON_ORIENTATION),this._label=this._makeLabelProperty(this._descriptor.properties[m.Gb.LABEL_TEXT]),this._labelZoomRange=new label_zoom_range_property_LabelZoomRangeProperty(this._descriptor.properties[m.Gb.LABEL_ZOOM_RANGE].options,m.Gb.LABEL_ZOOM_RANGE,i.getMinZoom(),i.getMaxZoom()),this._labelSize=this._makeSizeProperty(this._descriptor.properties[m.Gb.LABEL_SIZE],m.Gb.LABEL_SIZE,this._symbolizeAs.isSymbolizedAsIcon()),this._labelColor=this._makeColorProperty(this._descriptor.properties[m.Gb.LABEL_COLOR],m.Gb.LABEL_COLOR,o),this._labelBorderColor=this._makeColorProperty(this._descriptor.properties[m.Gb.LABEL_BORDER_COLOR],m.Gb.LABEL_BORDER_COLOR,o),this._labelBorderSize=new label_border_size_property_LabelBorderSizeProperty(this._descriptor.properties[m.Gb.LABEL_BORDER_SIZE].options,m.Gb.LABEL_BORDER_SIZE,this._labelSize),this._labelPosition=new label_position_property_LabelPositionProperty(this._descriptor.properties[m.Gb.LABEL_POSITION].options,m.Gb.LABEL_POSITION,this._icon,this._iconSize,this._labelSize,this._symbolizeAs.isSymbolizedAsIcon())}async _updateFieldsInDescriptor(t,e,i,r){const n=this.getPropertiesDescriptor(),o=Object.keys(n).filter((e=>{const i=Jt(n,e);return!!(i&&i.field&&i.field.name)&&!t.some((t=>i&&i.field&&i.field.name===t.getName()))}));let a=!1;const l={...n};return o.forEach((r=>{for(let u=0;u{const i=Jt(t,e);return i&&i.field&&i.field.name})).forEach((e=>{var o;const a=this.getAllStyleProperties().find((t=>t.getStyleName()===e));if(!a)return;const l=i.getFieldsForStyle(a,this._layer.getSource().isMvt()).filter((t=>!t.isUnsupported));if(0===l.length){const t=Object(X.j)(r);return void(n[e]=t[e])}const c=t[e];if(!c||!c.options)return;const u=null===(o=c.options.field)||void 0===o?void 0:o.name;u&&(l.some((t=>u===t.name))||(n[e]={type:Ut.a.type,options:{...t[e].options}},"field"in n[e].options&&delete n[e].options.field))})),0!==Object.keys(n).length?{hasChanges:!0,nextStyleDescriptor:vector_style_VectorStyle.createDescriptor({...t,...n},this.isTimeAware())}:{hasChanges:e,nextStyleDescriptor:vector_style_VectorStyle.createDescriptor({...t},this.isTimeAware())}}async getDescriptorWithUpdatedStyleProps(t,e,i){const r=await Ft(t);return i&&i.length===t.length?await this._updateFieldsInDescriptor(t,r,i,e):await this._deleteFieldsFromDescriptorAndUpdateStyling(this.getPropertiesDescriptor(),!1,r,e)}getType(){return m.Y.VECTOR}getAllStyleProperties(){return[this._symbolizeAs,this._icon,this._lineColor,this._fillColor,this._lineWidth,this._iconSize,this._iconOrientation,this._label,this._labelZoomRange,this._labelSize,this._labelColor,this._labelBorderColor,this._labelBorderSize,this._labelPosition]}_hasBorder(){return this._lineWidth.isDynamic()?this._lineWidth.isComplete():0!==this._lineWidth.getOptions().size}renderEditor(t,e){const i=this.getPropertiesDescriptor(),r=this.getDynamicPropertiesArray().filter((t=>t.isFieldMetaEnabled())),n={};return this.getAllStyleProperties().forEach((t=>{n[t.getStyleName()]=t})),Object(g.jsx)(vector_style_editor_VectorStyleEditor,{handlePropertyChange:(e,r)=>{i[e]=r;const n=vector_style_VectorStyle.createDescriptor(i,this.isTimeAware());t(n)},styleProperties:n,layer:this._layer,isPointsOnly:this.getIsPointsOnly(),isLinesOnly:this._getIsLinesOnly(),onIsTimeAwareChange:e=>{const r=vector_style_VectorStyle.createDescriptor(i,e);t(r)},onCustomIconsChange:e,isTimeAware:this.isTimeAware(),showIsTimeAware:r.length>0,customIcons:this._customIcons,hasBorder:this._hasBorder()})}getSourceFieldNames(){const t=[];return this.getDynamicPropertiesArray().forEach((e=>{e.getFieldOrigin()===m.D.SOURCE&&t.push(e.getFieldName())})),t}isTimeAware(){return this._descriptor.isTimeAware}getPropertiesDescriptor(){return this._descriptor.properties||{}}getDynamicPropertiesArray(){return this.getAllStyleProperties().filter((t=>t.isDynamic()&&t.isComplete()))}_getDynamicPropertyByFieldName(t){return this.getDynamicPropertiesArray().find((e=>t===e.getFieldName()))}getStyleMeta(){return this._styleMeta}getIconSvg(t){const e=this._getIconMeta(t);return e?e.svg:void 0}_getSymbolId(){return this.arePointsSymbolizedAsCircles()||this._icon.isDynamic()?void 0:this._icon.getOptions().value}_getIconMeta(t){const e=this._customIcons.find((({symbolId:e})=>e===t));if(e)return{...e,iconSource:m.N.CUSTOM};const i=Object(ct.i)(t);return i?{...i,iconSource:m.N.MAKI}:void 0}getPrimaryColor(){const t=this._getIsLinesOnly()?m.Gb.LINE_COLOR:m.Gb.FILL_COLOR;return Kt(this._descriptor.properties[t],"grey")}getIcon(t){const e=this._getIsLinesOnly(),i=this.getIsPointsOnly();let r;e?r=Kt(this._descriptor.properties[m.Gb.LINE_COLOR],"grey"):this._hasBorder()&&(r=Kt(this._descriptor.properties[m.Gb.LINE_COLOR],"none"));const n=e?void 0:Kt(this._descriptor.properties[m.Gb.FILL_COLOR],"grey"),o=t?{borderColor:this.getPrimaryColor(),borderStyle:"dashed",borderWidth:"1px"}:{},a=this._getSymbolId(),l=a?this.getIconSvg(a):void 0;return Object(g.jsx)(jt,{borderStyle:o,isPointsOnly:i,isLinesOnly:e,strokeColor:r,fillColor:n,symbolId:a,svg:l})}isUsingCustomIcon(t){if(this._icon.isDynamic()){const{customIconStops:e}=this._icon.getOptions();return!!e&&e.some((({icon:e})=>e===t))}const{value:e}=this._icon.getOptions();return e===t}async hasLegendDetails(){return this._getLegendDetailStyleProperties().length>0}renderLegendDetails(){const t=this._getSymbolId(),e=t?this.getIconSvg(t):void 0;return Object(g.jsx)(Bt,{masks:this._layer.getMasks(),styles:this._getLegendDetailStyleProperties(),isPointsOnly:this.getIsPointsOnly(),isLinesOnly:this._getIsLinesOnly(),symbolId:t,svg:e})}clearFeatureState(t,e,i){const r={source:"",id:void 0};for(let n=0;n!!e.getRightJoinSource().getFieldByName(t.name)));return e?e.getRightJoinSource().getFieldByName(t.name):null}throw new Error(`Unknown origin-type ${t.origin}`)}_makeSizeProperty(t,e,i){if(t&&t.options){if(t.type===static_style_property_StaticStyleProperty.type)return new static_size_property_StaticSizeProperty(t.options,e);if(t.type===Ut.a.type){const r=t.options,n=this._makeField(r.field);return new dynamic_size_property_DynamicSizeProperty(r,e,n,this._layer,this._getFieldFormatter,i)}throw new Error(`${t} not implemented`)}return new static_size_property_StaticSizeProperty({size:0},e)}_makeColorProperty(t,e,i){if(t&&t.options){if(t.type===static_style_property_StaticStyleProperty.type)return new static_color_property_StaticColorProperty(t.options,e);if(t.type===Ut.a.type){const r=t.options,n=this._makeField(r.field);return new dynamic_color_property_DynamicColorProperty(r,e,n,this._layer,this._getFieldFormatter,i)}throw new Error(`${t} not implemented`)}return new static_color_property_StaticColorProperty({color:""},e)}_makeOrientationProperty(t,e){if(t&&t.options){if(t.type===static_style_property_StaticStyleProperty.type)return new static_orientation_property_StaticOrientationProperty(t.options,e);if(t.type===Ut.a.type){const i=t.options,r=this._makeField(i.field);return new dynamic_orientation_property_DynamicOrientationProperty(i,e,r,this._layer,this._getFieldFormatter)}throw new Error(`${t} not implemented`)}return new static_orientation_property_StaticOrientationProperty({orientation:0},e)}_makeLabelProperty(t){if(t&&t.options){if(t.type===static_style_property_StaticStyleProperty.type)return new static_text_property_StaticTextProperty(t.options,m.Gb.LABEL_TEXT);if(t.type===Ut.a.type){const e=t.options,i=this._makeField(e.field);return new dynamic_text_property_DynamicTextProperty(e,m.Gb.LABEL_TEXT,i,this._layer,this._getFieldFormatter)}throw new Error(`${t} not implemented`)}return new static_text_property_StaticTextProperty({value:""},m.Gb.LABEL_TEXT)}_makeIconProperty(t){if(t&&t.options){if(t.type===static_style_property_StaticStyleProperty.type){const{value:e}={...t.options},i=this._getIconMeta(e);let r,n,o;return i&&({svg:r,label:n,iconSource:o}=i),new static_icon_property_StaticIconProperty({value:e,svg:r,label:n,iconSource:o},m.Gb.ICON)}if(t.type===Ut.a.type){const e={...t.options};e.customIconStops&&e.customIconStops.forEach((t=>{const e=this._getIconMeta(t.icon);e&&(t.iconSource=e.iconSource)}));const i=this._makeField(e.field);return new dynamic_icon_property_DynamicIconProperty(e,m.Gb.ICON,i,this._layer,this._getFieldFormatter)}throw new Error(`${t} not implemented`)}return new static_icon_property_StaticIconProperty({value:m.r},m.Gb.ICON)}}function Jt(t,e){if(!t[e])return null;const i=t[e];return i&&"type"in i&&i.type===m.Cb.DYNAMIC&&i.options?i.options:null}},function(t,e,i){"use strict";var r,n=function(){var t={};return function(e){if(void 0===t[e]){var i=document.querySelector(e);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}t[e]=i}return t[e]}}(),o=[];function a(t){for(var e=-1,i=0;i=0))throw new Error("precision must be a positive number");var i=Math.pow(10,e||0);return Math.round(t*i)/i},e.radiansToLength=g,e.lengthToRadians=y,e.lengthToDegrees=function(t,e){return _(y(t,e))},e.bearingToAzimuth=function(t){if(null==t)throw new Error("bearing is required");var e=t%360;return e<0&&(e+=360),e},e.radiansToDegrees=_,e.degreesToRadians=function(t){if(null==t)throw new Error("degrees is required");return t%360*Math.PI/180},e.convertLength=function(t,e,i){if(null==t)throw new Error("length is required");if(!(t>=0))throw new Error("length must be a positive number");return g(y(t,e),i||"kilometers")},e.convertArea=function(t,e,i){if(null==t)throw new Error("area is required");if(!(t>=0))throw new Error("area must be a positive number");var r=a[e||"meters"];if(!r)throw new Error("invalid original units");var n=a[i||"kilometers"];if(!n)throw new Error("invalid final units");return t/r*n},e.isNumber=v,e.isObject=x,e.validateBBox=b,e.validateId=w,e.radians2degrees=function(){throw new Error("method has been renamed to `radiansToDegrees`")},e.degrees2radians=function(){throw new Error("method has been renamed to `degreesToRadians`")},e.distanceToDegrees=function(){throw new Error("method has been renamed to `lengthToDegrees`")},e.distanceToRadians=function(){throw new Error("method has been renamed to `lengthToRadians`")},e.radiansToDistance=function(){throw new Error("method has been renamed to `radiansToLength`")},e.bearingToAngle=function(){throw new Error("method has been renamed to `bearingToAzimuth`")},e.convertDistance=function(){throw new Error("method has been renamed to `convertLength`")}},function(t,e,i){"use strict";i.d(e,"a",(function(){return DataRequest})),i.d(e,"b",(function(){return DataRequestAbortError}));var r=i(2),n=i.n(r);class DataRequest{constructor(t){n()(this,"_descriptor",void 0),this._descriptor={...t}}getData(){return this._descriptor.data}isLoading(){return!!this._descriptor.dataRequestToken}getMeta(){return this._descriptor.dataRequestMetaAtStart?this._descriptor.dataRequestMetaAtStart:this._descriptor.dataRequestMeta?this._descriptor.dataRequestMeta:{}}hasData(){return!!this._descriptor.data}hasDataOrRequestInProgress(){return this.hasData()||this.isLoading()}getDataId(){return this._descriptor.dataId}getRequestToken(){return this._descriptor.dataRequestToken}}class DataRequestAbortError extends Error{constructor(){super()}}},function(t,e,i){"use strict";i.d(e,"a",(function(){return r})),i.d(e,"b",(function(){return n}));const r="__trackedLayerDescriptor";function n(t){if("object"!=typeof t||null===t)return t;const e=Array.isArray(t)?[]:{};for(const i in t)i.startsWith("__")||(e[i]=n(t[i]));return e}},function(t,e,i){(function(){var e,r,n,o,a,l,c,u,h,p,d,f,m,g,y,_,v,x={}.hasOwnProperty;v=i(103),_=v.isObject,y=v.isFunction,g=v.isEmpty,m=v.getValue,u=null,n=null,o=null,a=null,l=null,d=null,f=null,p=null,c=null,r=null,h=null,e=null,t.exports=function(){function t(t){this.parent=t,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,u||(u=i(194),n=i(196),o=i(197),a=i(198),l=i(199),d=i(204),f=i(205),p=i(206),c=i(256),r=i(78),h=i(390),i(195),e=i(391))}return Object.defineProperty(t.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(t.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(t.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(t.prototype,"childNodes",{get:function(){return this.childNodeList&&this.childNodeList.nodes||(this.childNodeList=new h(this.children)),this.childNodeList}}),Object.defineProperty(t.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(t.prototype,"previousSibling",{get:function(){var t;return t=this.parent.children.indexOf(this),this.parent.children[t-1]||null}}),Object.defineProperty(t.prototype,"nextSibling",{get:function(){var t;return t=this.parent.children.indexOf(this),this.parent.children[t+1]||null}}),Object.defineProperty(t.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(t.prototype,"textContent",{get:function(){var t,e,i,n,o;if(this.nodeType===r.Element||this.nodeType===r.DocumentFragment){for(o="",e=0,i=(n=this.children).length;e":(null!=(i=this.parent)?i.name:void 0)?"node: <"+t+">, parent: <"+this.parent.name+">":"node: <"+t+">":""},t.prototype.ele=function(t,e,i){return this.element(t,e,i)},t.prototype.nod=function(t,e,i){return this.node(t,e,i)},t.prototype.txt=function(t){return this.text(t)},t.prototype.dat=function(t){return this.cdata(t)},t.prototype.com=function(t){return this.comment(t)},t.prototype.ins=function(t,e){return this.instruction(t,e)},t.prototype.doc=function(){return this.document()},t.prototype.dec=function(t,e,i){return this.declaration(t,e,i)},t.prototype.e=function(t,e,i){return this.element(t,e,i)},t.prototype.n=function(t,e,i){return this.node(t,e,i)},t.prototype.t=function(t){return this.text(t)},t.prototype.d=function(t){return this.cdata(t)},t.prototype.c=function(t){return this.comment(t)},t.prototype.r=function(t){return this.raw(t)},t.prototype.i=function(t,e){return this.instruction(t,e)},t.prototype.u=function(){return this.up()},t.prototype.importXMLBuilder=function(t){return this.importDocument(t)},t.prototype.replaceChild=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.removeChild=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.appendChild=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.hasChildNodes=function(){return 0!==this.children.length},t.prototype.cloneNode=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.isSupported=function(t,e){return!0},t.prototype.hasAttributes=function(){return 0!==this.attribs.length},t.prototype.compareDocumentPosition=function(t){var i,r;return(i=this)===t?0:this.document()!==t.document()?(r=e.Disconnected|e.ImplementationSpecific,Math.random()<.5?r|=e.Preceding:r|=e.Following,r):i.isAncestor(t)?e.Contains|e.Preceding:i.isDescendant(t)?e.Contains|e.Following:i.isPreceding(t)?e.Preceding:e.Following},t.prototype.isSameNode=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.lookupPrefix=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.isDefaultNamespace=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.lookupNamespaceURI=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.isEqualNode=function(t){var e,i,r;if(t.nodeType!==this.nodeType)return!1;if(t.children.length!==this.children.length)return!1;for(e=i=0,r=this.children.length-1;0<=r?i<=r:i>=r;e=0<=r?++i:--i)if(!this.children[e].isEqualNode(t.children[e]))return!1;return!0},t.prototype.getFeature=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.setUserData=function(t,e,i){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.getUserData=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.contains=function(t){return!!t&&(t===this||this.isDescendant(t))},t.prototype.isDescendant=function(t){var e,i,r,n;for(i=0,r=(n=this.children).length;ii},t.prototype.treePosition=function(t){var e,i;return i=0,e=!1,this.foreachTreeNode(this.document(),(function(r){if(i++,!e&&r===t)return e=!0})),e?i:-1},t.prototype.foreachTreeNode=function(t,e){var i,r,n,o,a;for(t||(t=this.document()),r=0,n=(o=t.children).length;r{const i={value:t,label:t.displayName?t.displayName:t.name};return e&&e(t)&&(i.disabled=!0),i})).sort(((t,e)=>t.label.toLowerCase().localeCompare(e.label.toLowerCase()))):[]}function p({fields:t,getFieldDisabledReason:e,isFieldDisabled:i,onChange:r,value:o,...p}){const d=[];if(o&&t){const e=t.find((t=>t.name===o));e&&d.push({value:e,label:e.displayName?e.displayName:e.name})}return Object(u.jsx)(l.EuiComboBox,n()({singleSelection:!0,options:h(t,i),selectedOptions:d,onChange:t=>{r(a.a.get(t,"0.value.name"))},isDisabled:!t||0===t.length,renderOption:function(t,i,r){const n=Object(u.jsx)(l.EuiFlexGroup,{className:r,gutterSize:"s",alignItems:"center"},Object(u.jsx)(l.EuiFlexItem,{grow:null},Object(u.jsx)(c.a,{type:t.value.type,fill:"none"})),Object(u.jsx)(l.EuiFlexItem,null,Object(u.jsx)(l.EuiHighlight,{search:i},t.label))),o=t.disabled&&e?e(t.value):null;return o?Object(u.jsx)(l.EuiToolTip,{position:"left",content:o},n):n}},p))}},,,function(t,e,i){"use strict";i.d(e,"b",(function(){return a})),i.d(e,"a",(function(){return l})),i.d(e,"e",(function(){return c})),i.d(e,"f",(function(){return u})),i.d(e,"d",(function(){return h})),i.d(e,"c",(function(){return p})),i.d(e,"h",(function(){return d})),i.d(e,"g",(function(){return f}));var r=i(46),n=i(1),o=i(0);const a=n.i18n.translate("xpack.maps.styles.categorical.otherCategoryLabel",{defaultMessage:"Other"}),l=r.euiThemeVars.euiColorLightShade;function c(t,e){return`${u(e)}__${t}`}function u(t){return`__kbn__dynamic__${t}`}function h(t){if("number"!=typeof t)return t;let e=0,i=10;for(;t0}},function(t,e,i){"use strict";i.d(e,"a",(function(){return g})),i.d(e,"c",(function(){return y})),i.d(e,"e",(function(){return _})),i.d(e,"i",(function(){return v})),i.d(e,"j",(function(){return x})),i.d(e,"f",(function(){return b})),i.d(e,"d",(function(){return w})),i.d(e,"k",(function(){return C})),i.d(e,"b",(function(){return M})),i.d(e,"h",(function(){return T})),i.d(e,"g",(function(){return E})),i(4);var r=i(252),n=i.n(r),o=i(41),a=i(412),l=i(410),c=i.n(l),u=i(0),h=i(265),p=i(159),d=i(5),f=i(266),m=i(3);const g=Math.floor(window.devicePixelRatio*(u.m/u.cb)*.75),y=Object.entries(f.a).map((([t,{svg:e,label:i}])=>({value:t,label:i,svg:e})));async function _({svg:t,renderSize:e=64,cutoff:i=.25,radius:r=.25}){const n=e+12,o=document.createElement("canvas");o.width=n,o.height=n;const l=o.getContext("2d"),u=a.Canvg.fromString(l,t,{ignoreDimensions:!0,offsetX:1.5,offsetY:1.5});u.resize(n-3,n-3),await u.render();const h=c()(l,{channel:3,cutoff:i,radius:r*n}),p=document.createElement("canvas");p.width=n,p.height=n;const d=p.getContext("2d");if(!d)return null;const f=d.createImageData(n,n);for(let t=0;t{const r=i.map((e=>Object(m.jsx)("div",{style:{width:"10%",position:"relative",height:"100%",display:"inline-block",paddingTop:"4px"},key:e},Object(m.jsx)(p.a,{className:"mapIcon",symbolId:e,fill:t?"rgb(223, 229, 239)":"rgb(52, 55, 65)",svg:v(e).svg}))));return{value:e,inputDisplay:Object(m.jsx)("div",null,r)}}))}function E(t){const e=S.find((({id:e})=>e===t));return e?[...e.icons]:[]}S.forEach((t=>{t.icons.forEach((t=>{M.includes(t)||M.push(t)}))}))},,,function(t,e,i){t.exports=i(22)(448)},function(t,e){(function(){var e,i,r,n,o,a,l,c=[].slice,u={}.hasOwnProperty;e=function(){var t,e,i,r,n,a;if(a=arguments[0],n=2<=arguments.length?c.call(arguments,1):[],o(Object.assign))Object.assign.apply(null,arguments);else for(t=0,i=n.length;tc.a.get(t,"aggregations.compositeSplit.buckets",[])),(t=>t.key[f.I]))}function _(t,e,i,r){const n=[],o=i(t);for(let t=0;t{const e=this._sliderValueToResolution(parseInt(t.currentTarget.value,10));E(this.props.renderAs,e)&&this.props.metrics.find(I)?this.setState({showModal:!0}):this.props.onChange(e,this.props.metrics)})),n()(this,"_closeModal",(()=>{this.setState({showModal:!1})})),n()(this,"_acceptModal",(()=>{this._closeModal();const t=this.props.metrics.filter((t=>!I(t)));this.props.onChange(f.L.SUPER_FINE,t.length?t:[{type:f.b.COUNT}])}))}_getScale(){return this.props.renderAs===f.tb.HEX?{[f.L.SUPER_FINE]:3,[f.L.MOST_FINE]:2,[f.L.FINE]:2,[f.L.COARSE]:1}:{[f.L.SUPER_FINE]:4,[f.L.MOST_FINE]:3,[f.L.FINE]:2,[f.L.COARSE]:1}}_getTicks(){const t=this._getScale(),e=[{label:Object(A.jsx)("span",null," "),value:t[f.L.FINE]}];return t[f.L.FINE]!==t[f.L.MOST_FINE]&&e.push({label:Object(A.jsx)("span",null," "),value:t[f.L.MOST_FINE]}),[{label:u.i18n.translate("xpack.maps.source.esGrid.lowLabel",{defaultMessage:"low"}),value:t[f.L.COARSE]},...e,{label:u.i18n.translate("xpack.maps.source.esGrid.highLabel",{defaultMessage:"high"}),value:t[f.L.SUPER_FINE]}]}_resolutionToSliderValue(t){return this._getScale()[t]}_sliderValueToResolution(t){const e=this._getScale();return Object.keys(e).find((i=>e[i]===t))||f.L.COARSE}_renderModal(){return this.state.showModal?Object(A.jsx)(w.EuiConfirmModal,{title:u.i18n.translate("xpack.maps.source.esGrid.vectorTileModal.title",{defaultMessage:"'Top terms' metrics not supported"}),onCancel:this._closeModal,onConfirm:this._acceptModal,cancelButtonText:u.i18n.translate("xpack.maps.source.esGrid.vectorTileModal.cancelBtnLabel",{defaultMessage:"Cancel"}),confirmButtonText:u.i18n.translate("xpack.maps.source.esGrid.vectorTileModal.confirmBtnLabel",{defaultMessage:"Accept"}),buttonColor:"danger",defaultFocusedButton:"cancel"},Object(A.jsx)("p",null,Object(A.jsx)(b.FormattedMessage,{id:"xpack.maps.source.esGrid.vectorTileModal.message",defaultMessage:"High resolution uses vector tiles from the Elasticsearch vector tile API. Elasticsearch vector tile API does not support 'Top terms' metric. Switching to super fine grid resolution will remove all 'Top terms' metrics from your layer configuration."}))):null}render(){const t=this.props.renderAs!==f.tb.POINT&&this.props.renderAs!==f.tb.GRID||this.props.resolution!==f.L.SUPER_FINE?void 0:u.i18n.translate("xpack.maps.source.esGrid.superFineHelpText",{defaultMessage:"High resolution uses vector tiles."}),e=this._getTicks();return Object(A.jsx)(a.a.Fragment,null,this._renderModal(),Object(A.jsx)(w.EuiFormRow,{label:u.i18n.translate("xpack.maps.geoGrid.resolutionLabel",{defaultMessage:"Resolution"}),helpText:t,display:"columnCompressed"},Object(A.jsx)(w.EuiRange,{value:this._resolutionToSliderValue(this.props.resolution),onChange:this._onResolutionChange,min:1,max:e.length,showTicks:!0,tickInterval:1,ticks:e,compressed:!0})))}}var P=i(165),O=i(233);class update_source_editor_UpdateSourceEditor extends o.Component{constructor(...t){super(...t),n()(this,"_isMounted",void 0),n()(this,"state",{fields:[],metricsEditorKey:Object(x.v4)()}),n()(this,"_onMetricsChange",(t=>{this.props.onChange({propName:"metrics",value:t})})),n()(this,"_onResolutionChange",(async(t,e)=>{await this.props.onChange({propName:"metrics",value:e},{propName:"resolution",value:t,newLayerType:this._getNewLayerType(this.props.renderAs,t)}),this.setState({metricsEditorKey:Object(x.v4)()})})),n()(this,"_onRequestTypeSelect",(t=>{this.props.onChange({propName:"requestType",value:t,newLayerType:this._getNewLayerType(t,this.props.resolution)})}))}componentDidMount(){this._isMounted=!0,this._loadFields()}componentWillUnmount(){this._isMounted=!1}async _loadFields(){let t;try{t=await Object(T.u)().get(this.props.indexPatternId)}catch(t){return void(this._isMounted&&this.setState({loadError:Object(S.c)(this.props.indexPatternId)}))}this._isMounted&&this.setState({fields:t.fields.filter((t=>!C.indexPatterns.isNestedField(t)))})}_getNewLayerType(t,e){let i;return i=t===f.tb.HEATMAP?f.Z.HEATMAP:E(t,e)?f.Z.MVT_VECTOR:f.Z.GEOJSON_VECTOR,void 0!==i&&i!==this.props.currentLayerType?i:void 0}_getMetricsFilter(){return this.props.currentLayerType===f.Z.HEATMAP?t=>!!t.value&&Object(P.a)(t.value):t=>t.value!==f.b.TERMS}_renderMetricsPanel(){return Object(A.jsx)(w.EuiPanel,null,Object(A.jsx)(w.EuiTitle,{size:"xs"},Object(A.jsx)("h6",null,Object(A.jsx)(b.FormattedMessage,{id:"xpack.maps.source.esGrid.metricsLabel",defaultMessage:"Metrics"}))),Object(A.jsx)(w.EuiSpacer,{size:"m"}),Object(A.jsx)(M.a,{key:this.state.metricsEditorKey,allowMultipleMetrics:this.props.currentLayerType!==f.Z.HEATMAP,bucketsName:this.props.bucketsName,isJoin:!1,metricsFilter:this._getMetricsFilter(),fields:this.state.fields,metrics:this.props.metrics,onChange:this._onMetricsChange}))}render(){return Object(A.jsx)(o.Fragment,null,this._renderMetricsPanel(),Object(A.jsx)(w.EuiSpacer,{size:"s"}),Object(A.jsx)(w.EuiPanel,null,Object(A.jsx)(w.EuiTitle,{size:"xs"},Object(A.jsx)("h6",null,this.props.currentLayerType===f.Z.HEATMAP?U:V)),Object(A.jsx)(w.EuiSpacer,{size:"m"}),Object(A.jsx)(resolution_editor_ResolutionEditor,{renderAs:this.props.renderAs,resolution:this.props.resolution,onChange:this._onResolutionChange,metrics:this.props.metrics}),Object(A.jsx)(O.a,{isColumnCompressed:!0,renderAs:this.props.renderAs,onChange:this._onRequestTypeSelect})),Object(A.jsx)(w.EuiSpacer,{size:"s"}))}}var k=i(113),F=i(87),D=i(19),z=i(116),j=i(117),N=i(82),B=i(219);const V=u.i18n.translate("xpack.maps.source.esGridClustersTitle",{defaultMessage:"Clusters"}),U=u.i18n.translate("xpack.maps.source.esGridHeatmapTitle",{defaultMessage:"Heat map"});class es_geo_grid_source_ESGeoGridSource extends k.a{static createDescriptor(t){const e=k.a.createDescriptor(t);if(!Object(z.a)(e.geoField))throw new Error("Cannot create an ESGeoGridSourceDescriptor without a geoField");return{...e,type:f.Ab.ES_GEO_GRID,geoField:e.geoField,requestType:t.requestType||f.tb.POINT,resolution:t.resolution?t.resolution:f.L.COARSE}}constructor(t){const e=es_geo_grid_source_ESGeoGridSource.createDescriptor(t);super(e),n()(this,"_descriptor",void 0),this._descriptor=e}getBucketsName(){return this._descriptor.requestType===f.tb.HEX?u.i18n.translate("xpack.maps.source.esGeoGrid.hex.bucketsName",{defaultMessage:"hexagons"}):this._descriptor.requestType===f.tb.GRID?u.i18n.translate("xpack.maps.source.esGeoGrid.grid.bucketsName",{defaultMessage:"grid"}):u.i18n.translate("xpack.maps.source.esGeoGrid.cluster.bucketsName",{defaultMessage:"clusters"})}renderSourceSettingsEditor(t){return Object(A.jsx)(update_source_editor_UpdateSourceEditor,{bucketsName:this.getBucketsName(),currentLayerType:t.currentLayerType,geoFieldName:this.getGeoFieldName(),indexPatternId:this.getIndexPatternId(),onChange:async function(...e){t.onChange(...e);const i=e.find((t=>"resolution"===t.propName));if(i&&"getPropertiesDescriptor"in t.style){const e=t.style.getPropertiesDescriptor();if(e[f.Gb.ICON_SIZE].type===f.Cb.DYNAMIC){e[f.Gb.ICON_SIZE]={...e[f.Gb.ICON_SIZE],options:{...e[f.Gb.ICON_SIZE].options,...Object(B.a)(i.value)}};const r=N.a.createDescriptor(e,t.style.isTimeAware());t.onStyleDescriptorChange(r)}}},metrics:this._descriptor.metrics,renderAs:this._descriptor.requestType,resolution:this._descriptor.resolution})}getSyncMeta(t){return{...super.getSyncMeta(t),geogridPrecision:this.getGeoGridPrecision(t.zoom),requestType:this._descriptor.requestType,resolution:this._descriptor.resolution}}async getImmutableProperties(){return[{label:Object(S.a)(),value:this._descriptor.requestType===f.tb.HEATMAP?U:V},{label:Object(S.b)(),value:await this.getDisplayName()},{label:u.i18n.translate("xpack.maps.source.esGrid.geospatialFieldLabel",{defaultMessage:"Cluster field"}),value:this._descriptor.geoField}]}isMvt(){return E(this._descriptor.requestType,this._descriptor.resolution)}isGeoGridPrecisionAware(){return!this.isMvt()}supportsJoins(){return!1}getGridResolution(){return this._descriptor.resolution}getGeoGridPrecision(t){if(this.isMvt())return 0;const e=Math.ceil(t)+this._getGeoGridPrecisionResolutionDelta();return Math.min(e,29)}_getGeoGridPrecisionResolutionDelta(){if(this._descriptor.requestType===f.tb.HEX){if(this._descriptor.resolution===f.L.COARSE)return 2;if(this._descriptor.resolution===f.L.FINE||this._descriptor.resolution===f.L.MOST_FINE)return 5;if(this._descriptor.resolution===f.L.SUPER_FINE)return 8}if(this._descriptor.resolution===f.L.COARSE)return 2;if(this._descriptor.resolution===f.L.FINE)return 3;if(this._descriptor.resolution===f.L.MOST_FINE)return 4;if(this._descriptor.resolution===f.L.SUPER_FINE)return 8;throw new Error(u.i18n.translate("xpack.maps.source.esGrid.resolutionParamErrorMessage",{defaultMessage:"Grid resolution param not recognized: {resolution}",values:{resolution:this._descriptor.resolution}}))}async _compositeAggRequest({searchSource:t,searchSessionId:e,indexPattern:i,precision:r,layerName:n,registerCancelCallback:o,bucketsPerGrid:a,isRequestStillActive:l,bufferedExtent:c,inspectorAdapters:h,executionContext:p}){const m=Math.floor(f.s/a),g={compositeSplit:{composite:{size:m,sources:[{[f.I]:{geotile_grid:{bounds:Object(d.o)(c),field:this._descriptor.geoField,precision:r}}}]},aggs:{[f.G]:{geo_centroid:{field:this._descriptor.geoField}},...this.getValueAggsDsl(i)}}},_=[];let v=0,x=null;for(;;){var b;if(!l())throw new F.b;if(v++,v>5)throw new Error(u.i18n.translate("xpack.maps.source.esGrid.compositePaginationErrorMessage",{defaultMessage:'{layerName} is causing too many requests. Reduce "Grid resolution" and/or reduce the number of top term "Metrics".',values:{layerName:n}}));x&&(g.compositeSplit.composite.after=x),t.setField("aggs",g);const r=x?`${this.getId()} afterKey ${x.geoSplit}`:this.getId(),a=await this._runEsQuery({requestId:r,requestName:u.i18n.translate("xpack.maps.source.esGrid.compositeInspector.requestName",{defaultMessage:"{layerName} {bucketsName} composite request ({requestCount})",values:{bucketsName:this.getBucketsName(),layerName:n,requestCount:v}}),searchSource:t,registerCancelCallback:o,requestDescription:u.i18n.translate("xpack.maps.source.esGrid.compositeInspectorDescription",{defaultMessage:"Get {bucketsName} from data view: {dataViewName}, geospatial field: {geoFieldName}",values:{bucketsName:this.getBucketsName(),dataViewName:i.getName(),geoFieldName:this._descriptor.geoField}}),searchSessionId:e,executionContext:Object(j.b)({description:"es_geo_grid_source:cluster_composite"},p),requestsAdapter:h.requests});_.push(...y(a,this._descriptor.requestType));const c=null===(b=a.aggregations)||void 0===b?void 0:b.compositeSplit;if(x=c.after_key,c.buckets.length0===t.getBucketCount())):this.getValueAggsDsl(i);return t.setField("aggs",{[f.I]:{geotile_grid:{bounds:Object(d.o)(a),field:this._descriptor.geoField,precision:r,size:f.s,shard_size:f.s},aggs:{[f.G]:{geo_centroid:{field:this._descriptor.geoField}},...m}}}),g=await this._runEsQuery({requestId:this.getId(),requestName:u.i18n.translate("xpack.maps.source.esGrid.inspector.requestName",{defaultMessage:"{layerName} {bucketsName} request",values:{bucketsName:this.getBucketsName(),layerName:n}}),searchSource:t,registerCancelCallback:o,requestDescription:u.i18n.translate("xpack.maps.source.esGrid.inspector.requestDescription",{defaultMessage:"Get {bucketsName} from data view: {dataViewName}, geospatial field: {geoFieldName}",values:{bucketsName:this.getBucketsName(),dataViewName:i.getName(),geoFieldName:this._descriptor.geoField}}),searchSessionId:e,executionContext:Object(j.b)({description:"es_geo_grid_source:cluster"},p),requestsAdapter:h.requests}),y=this._descriptor.requestType,_(g,y,(t=>c.a.get(t,`aggregations.${f.I}.buckets`,[])),(t=>t.key));var g,y}async _isGeoShape(){try{return(await this._getGeoField()).type===f.A.GEO_SHAPE}catch(t){return!1}}async getGeoJsonWithMeta(t,e,i,r,n){if(!e.buffer)throw new Error("Cannot get GeoJson without searchFilter.buffer");const o=await this.getIndexPattern(),a=await this.makeSearchSource(e,0);a.setField("trackTotalHits",!1);let l=1;this.getMetricFields().forEach((t=>{l+=t.getBucketCount()}));const c=this._descriptor.resolution!==f.L.COARSE&&l>1,u=!await this._isGeoShape(),h=this.getGeoGridPrecision(e.zoom);return{data:{type:"FeatureCollection",features:u&&c?await this._compositeAggRequest({searchSource:a,searchSessionId:e.searchSessionId,indexPattern:o,precision:h,layerName:t,registerCancelCallback:i,bucketsPerGrid:l,isRequestStillActive:r,bufferedExtent:e.buffer,inspectorAdapters:n,executionContext:e.executionContext}):await this._nonCompositeAggRequest({searchSource:a,searchSessionId:e.searchSessionId,indexPattern:o,precision:h,layerName:t,registerCancelCallback:i,bufferedExtent:e.buffer,tooManyBuckets:c,inspectorAdapters:n,executionContext:e.executionContext})},meta:{areResultsTrimmed:!1}}}getTileSourceLayer(){return"aggs"}async getTileUrl(t,e,i,r){const n=await this.getIndexPattern(),o=await this.makeSearchSource(t,0);return o.setField("aggs",this.getValueAggsDsl(n)),`${Object(T.r)().basePath.prepend(`${f.nb}/{z}/{x}/{y}.pbf`)}?${Object(p.a)({geometryFieldName:this._descriptor.geoField,index:n.getIndexPattern(),gridPrecision:this._getGeoGridPrecisionResolutionDelta(),hasLabels:i,buffer:r,requestBody:c.a.pick(o.getSearchRequestBody(),["aggs","fields","query","runtime_mappings"]),renderAs:this._descriptor.requestType,token:e,executionContextId:Object(j.a)(t.executionContext)})}`}isFilterByMapBounds(){return!this.isMvt()}hasTooltipProperties(){return!0}async getSupportedShapeTypes(){return this._descriptor.requestType===f.tb.GRID||this._descriptor.requestType===f.tb.HEX?[f.Fb.POLYGON]:[f.Fb.POINT]}async getLicensedFeatures(){return await this._isGeoShape()?[D.a.GEO_SHAPE_AGGS_GEO_TILE]:[]}getFeatureActions({addFilters:t,featureId:e,geoFieldNames:i,onClose:r}){return 0===i.length||null===t?[]:[{label:u.i18n.translate("xpack.maps.tooltip.action.filterByClusterLabel",{defaultMessage:"Filter by cluster"}),id:"FILTER_BY_CLUSTER_ACTION",onClick:()=>{const n=Object(d.b)({geoFieldNames:i,gridId:e,isHex:this._descriptor.requestType===f.tb.HEX});t([n],h.ACTION_GLOBAL_APPLY_FILTER),r()}}]}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(86);e.getCoord=function(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")},e.getCoords=function(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")},e.containsNumber=function t(e){if(e.length>1&&r.isNumber(e[0])&&r.isNumber(e[1]))return!0;if(Array.isArray(e[0])&&e[0].length)return t(e[0]);throw new Error("coordinates must only contain numbers")},e.geojsonType=function(t,e,i){if(!e||!i)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+i+": must be a "+e+", given "+t.type)},e.featureOf=function(t,e,i){if(!t)throw new Error("No feature passed");if(!i)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+i+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+i+": must be a "+e+", given "+t.geometry.type)},e.collectionOf=function(t,e,i){if(!t)throw new Error("No featureCollection passed");if(!i)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+i+", FeatureCollection required");for(var r=0,n=t.features;r0?t.label:null,minZoom:a.a.get(t,"minZoom",h.lb),maxZoom:a.a.get(t,"maxZoom",h.hb),alpha:a.a.get(t,"alpha",.75),visible:a.a.get(t,"visible",!0),style:a.a.get(t,"style",null),includeInFitToBounds:"boolean"!=typeof t.includeInFitToBounds||t.includeInFitToBounds}}constructor({layerDescriptor:t,source:e}){n()(this,"_descriptor",void 0),n()(this,"_source",void 0),n()(this,"_dataRequests",void 0),this._descriptor=AbstractLayer.createDescriptor(t),this._source=e,this._descriptor.__dataRequests?this._dataRequests=this._descriptor.__dataRequests.map((t=>new u.a(t))):this._dataRequests=[]}static getBoundDataForSource(t,e){return t.getStyle().sources[e].data}getDescriptor(){return this._descriptor}async cloneDescriptor(){const t=Object(p.b)(this._descriptor);t.id=Object(c.v4)();const e=await this.getDisplayName();return t.label=`Clone of ${e}`,t.sourceDescriptor=this.getSource().cloneDescriptor(),[t]}makeMbLayerId(t){return`${this.getId()}${h.jb}${t}`}isPreviewLayer(){return!!this._descriptor.__isPreviewLayer}supportsElasticsearchFilters(){return this.getSource().isESSource()}async supportsFitToBounds(){return await this.getSource().supportsFitToBounds()}async isFittable(){return await this.supportsFitToBounds()&&this.isVisible()&&this.isIncludeInFitToBounds()}isIncludeInFitToBounds(){return!!this._descriptor.includeInFitToBounds}async isFilteredByGlobalTime(){return!1}async getDisplayName(t){return this._descriptor.label?this._descriptor.label:(t?await t.getDisplayName():await this.getSource().getDisplayName())||`Layer ${this._descriptor.id}`}async getAttributions(){if(this.hasErrors()||!this.isVisible())return[];const t=this.getSource().getAttributionProvider();return t?t():void 0!==this._descriptor.attribution?[this._descriptor.attribution]:[]}getStyleForEditing(){throw new Error("Should implement AbstractLayer#getStyleForEditing")}getStyle(){throw new Error("Should implement AbstractLayer#getStyle")}getCurrentStyle(){throw new Error("Should implement AbstractLayer#getCurrentStyle")}getLabel(){return this._descriptor.label?this._descriptor.label:""}getLocale(){return null}getLayerIcon(t){return{icon:Object(d.jsx)(l.EuiIcon,{size:"m",type:this.getLayerTypeIconName()})}}async hasLegendDetails(){return!1}renderLegendDetails(){return null}getId(){return this._descriptor.id}getSource(){return this._source}getSourceForEditing(){return this._source}isVisible(){return!!this._descriptor.visible}showAtZoomLevel(t){return t>=this.getMinZoom()&&t<=this.getMaxZoom()}getMinZoom(){return"number"==typeof this._descriptor.minZoom?this._descriptor.minZoom:h.lb}getMaxZoom(){return"number"==typeof this._descriptor.maxZoom?this._descriptor.maxZoom:h.hb}getMinSourceZoom(){return this._source.getMinZoom()}getMbSourceId(){return this.getId()}_requiresPrevSourceCleanup(t){return!1}_removeStaleMbSourcesAndLayers(t){if(this._requiresPrevSourceCleanup(t)){const e=t.getStyle();e.layers.forEach((e=>{this.ownsMbLayerId(e.id)&&t.removeLayer(e.id)})),Object.keys(e.sources).some((e=>{this.ownsMbSourceId(e)&&t.removeSource(e)}))}}getAlpha(){return"number"==typeof this._descriptor.alpha?this._descriptor.alpha:1}getQuery(){return this._descriptor.query?this._descriptor.query:null}renderSourceSettingsEditor(t){return this.getSourceForEditing().renderSourceSettingsEditor(t)}getPrevRequestToken(t){const e=this.getDataRequest(t);if(e)return e.getRequestToken()}getInFlightRequestTokens(){if(!this._dataRequests)return[];const t=this._dataRequests.map((t=>t.getRequestToken()));return a.a.compact(t)}getSourceDataRequest(){return this.getDataRequest(h.xb)}getDataRequest(t){return this._dataRequests.find((e=>e.getDataId()===t))}isLayerLoading(t){if(!this.isVisible()||!this.showAtZoomLevel(t))return!1;const e=this._dataRequests.some((t=>t.isLoading()));return this._isTiled()?e||void 0===this._descriptor.__areTilesLoaded||!this._descriptor.__areTilesLoaded:!this.getSourceDataRequest()||e}hasErrors(){return a.a.get(this._descriptor,"__isInErrorState",!1)}getErrors(){return this.hasErrors()&&this._descriptor.__errorMessage?this._descriptor.__errorMessage:""}async syncData(t){}getMbLayerIds(){throw new Error("Should implement AbstractLayer#getMbLayerIds")}ownsMbLayerId(t){throw new Error("Should implement AbstractLayer#ownsMbLayerId")}ownsMbSourceId(t){throw new Error("Should implement AbstractLayer#ownsMbSourceId")}syncLayerWithMB(t){throw new Error("Should implement AbstractLayer#syncLayerWithMB")}getLayerTypeIconName(){throw new Error("should implement Layer#getLayerTypeIconName")}async getBounds(t){return null}renderStyleEditor(t,e){const i=this.getStyleForEditing();return i?i.renderEditor(t,e):null}getIndexPatternIds(){return[]}getQueryableIndexPatternIds(){return[]}syncVisibilityWithMb(t,e){t.setLayoutProperty(e,"visibility",this.isVisible()?"visible":"none")}getType(){return this._descriptor.type}areLabelsOnTop(){return!1}supportsLabelsOnTop(){return!1}supportsLabelLocales(){return!1}async getLicensedFeatures(){return[]}getGeoFieldNames(){const t=this.getSource();return t.isESSource()?[t.getGeoFieldName()]:[]}async getStyleMetaDescriptorFromLocalFeatures(){return null}isBasemap(t){return!1}getParent(){return this._descriptor.parent}_getMetaFromTiles(){return this._descriptor.__metaFromTiles||[]}_isTiled(){throw new Error("Must implement AbstractLayer#_isTiled")}}},function(t,e,i){"use strict";i.d(e,"a",(function(){return o})),i.d(e,"b",(function(){return a}));var r=i(1),n=i(0);function o(t){return r.i18n.translate("xpack.maps.styles.vector.disabledByMessage",{defaultMessage:"Set '{styleLabel}' to enable",values:{styleLabel:a(t)}})}function a(t){switch(t){case n.Gb.FILL_COLOR:return r.i18n.translate("xpack.maps.styles.vector.fillColorLabel",{defaultMessage:"Fill color"});case n.Gb.LINE_COLOR:return r.i18n.translate("xpack.maps.styles.vector.borderColorLabel",{defaultMessage:"Border color"});case n.Gb.LINE_WIDTH:return r.i18n.translate("xpack.maps.styles.vector.borderWidthLabel",{defaultMessage:"Border width"});case n.Gb.ICON:return r.i18n.translate("xpack.maps.styles.vector.iconLabel",{defaultMessage:"Icon"});case n.Gb.ICON_SIZE:return r.i18n.translate("xpack.maps.styles.vector.symbolSizeLabel",{defaultMessage:"Symbol size"});case n.Gb.ICON_ORIENTATION:return r.i18n.translate("xpack.maps.styles.vector.orientationLabel",{defaultMessage:"Symbol orientation"});case n.Gb.LABEL_TEXT:return r.i18n.translate("xpack.maps.styles.vector.labelLabel",{defaultMessage:"Label"});case n.Gb.LABEL_ZOOM_RANGE:return r.i18n.translate("xpack.maps.styles.vector.labelZoomRangeLabel",{defaultMessage:"Label visibility"});case n.Gb.LABEL_COLOR:return r.i18n.translate("xpack.maps.styles.vector.labelColorLabel",{defaultMessage:"Label color"});case n.Gb.LABEL_SIZE:return r.i18n.translate("xpack.maps.styles.vector.labelSizeLabel",{defaultMessage:"Label size"});case n.Gb.LABEL_BORDER_COLOR:return r.i18n.translate("xpack.maps.styles.vector.labelBorderColorLabel",{defaultMessage:"Label border color"});case n.Gb.LABEL_BORDER_SIZE:return r.i18n.translate("xpack.maps.styles.vector.labelBorderWidthLabel",{defaultMessage:"Label border width"});case n.Gb.LABEL_POSITION:return r.i18n.translate("xpack.maps.styles.vector.labelPositionLabel",{defaultMessage:"Label position"});default:return t}}},function(t,e,i){"use strict";i.d(e,"b",(function(){return l})),i.d(e,"a",(function(){return c})),i.d(e,"c",(function(){return u})),i.d(e,"g",(function(){return m})),i.d(e,"f",(function(){return g})),i.d(e,"e",(function(){return y})),i.d(e,"d",(function(){return Mask}));var r=i(2),n=i.n(r),o=i(1),a=i(0);const l=o.i18n.translate("xpack.maps.mask.belowLabel",{defaultMessage:"below"}),c=o.i18n.translate("xpack.maps.mask.aboveLabel",{defaultMessage:"above"}),u=o.i18n.translate("xpack.maps.mask.genericBucketsName",{defaultMessage:"buckets"}),h=o.i18n.translate("xpack.maps.mask.genericFeaturesName",{defaultMessage:"features"}),p=o.i18n.translate("xpack.maps.mask.genericAggLabel",{defaultMessage:"value"}),d=o.i18n.translate("xpack.maps.mask.when",{defaultMessage:"when"}),f=o.i18n.translate("xpack.maps.mask.whenJoinMetric",{defaultMessage:"{whenLabel} join metric",values:{whenLabel:d}});function m(t,e){return`${function(t){return t===a.gb.BELOW?l:t===a.gb.ABOVE?c:t}(t)} ${e}`}function g({bucketsName:t,isJoin:e}){return o.i18n.translate("xpack.maps.mask.maskLabel",{defaultMessage:"Hide {hideNoun}",values:{hideNoun:e?h:t||u}})}function y({aggLabel:t,bucketsName:e,isJoin:i}){return o.i18n.translate("xpack.maps.mask.maskDescription",{defaultMessage:"{maskAdverb} {aggLabel} is ",values:{aggLabel:t||p,maskAdverb:i?f:d}})}class Mask{constructor({esAggField:t,isGeometrySourceMvt:e,operator:i,value:r}){n()(this,"_esAggField",void 0),n()(this,"_isGeometrySourceMvt",void 0),n()(this,"_operator",void 0),n()(this,"_value",void 0),this._esAggField=t,this._isGeometrySourceMvt=e,this._operator=i,this._value=r}_isFeatureState(){return this._esAggField.getOrigin()!==a.D.SOURCE&&!!this._isGeometrySourceMvt}getMatchMaskedExpression(){return[this._operator===a.gb.BELOW?"<":">",[this._isFeatureState()?a.ib.FEATURE_STATE:a.ib.GET,this._esAggField.getMbFieldName()],this._value]}getMatchUnmaskedExpression(){return[this._operator===a.gb.BELOW?">=":"<=",[this._isFeatureState()?a.ib.FEATURE_STATE:a.ib.GET,this._esAggField.getMbFieldName()],this._value]}getEsAggField(){return this._esAggField}getFieldOriginListLabel(){const t=this._esAggField.getSource(),e=this._esAggField.getOrigin()===a.D.JOIN;return`${g({bucketsName:"getBucketsName"in t?t.getBucketsName():void 0,isJoin:e})} ${e?f:d}`}getOperator(){return this._operator}getValue(){return this._value}isFeatureMasked(t){const e=this._isFeatureState()?null==t?void 0:t.state[this._esAggField.getMbFieldName()]:null==t?void 0:t.properties[this._esAggField.getMbFieldName()];return"number"==typeof e&&(this._operator===a.gb.BELOW?ethis._value)}}},function(t,e,i){"use strict";i.d(e,"a",(function(){return TooltipProperty}));var r=i(2),n=i.n(r),o=i(39),a=i.n(o);class TooltipProperty{constructor(t,e,i){n()(this,"_propertyKey",void 0),n()(this,"_rawValue",void 0),n()(this,"_propertyName",void 0),this._propertyKey=t,this._propertyName=e,this._rawValue=i}getPropertyKey(){return this._propertyKey}getPropertyName(){return this._propertyName}getHtmlDisplayValue(){return a.a.escape(Array.isArray(this._rawValue)?this._rawValue.join():this._rawValue)}getRawValue(){return this._rawValue}isFilterable(){return!1}async getESFilters(){return[]}}},function(t,e,i){"use strict";i.d(e,"a",(function(){return AbstractSource}));var r=i(2),n=i.n(r),o=i(88),a=i(0);class AbstractSource{constructor(t){n()(this,"_descriptor",void 0),this._descriptor=t}cloneDescriptor(){return Object(o.b)(this._descriptor)}async supportsFitToBounds(){return!1}async getImmutableProperties(){return[]}getType(){return this._descriptor.type}async getDisplayName(){return""}getAttributionProvider(){return null}isFieldAware(){return!1}isQueryAware(){return!1}renderSourceSettingsEditor(t){return null}getApplyGlobalQuery(){return!1}getApplyGlobalTime(){return!1}getApplyForceRefresh(){return!1}getIndexPatternIds(){return[]}getQueryableIndexPatternIds(){return[]}isESSource(){return!1}async createFieldFormatter(t){return null}async getValueSuggestions(t,e){return[]}async isTimeAware(){return!1}isFilterByMapBounds(){return!1}getMinZoom(){return a.lb}getMaxZoom(){return a.hb}async getLicensedFeatures(){return[]}getUpdateDueToTimeslice(t,e){return!0}}},,,function(t,e,i){"use strict";i.d(e,"a",(function(){return es_agg_source_AbstractESAggSource})),i.d(e,"b",(function(){return x})),i.d(e,"c",(function(){return _}));var r=i(2),n=i.n(r),o=i(1),a=i(271),l=i(0),c=i(131),u=i(109);class top_term_percentage_field_TopTermPercentageField{constructor(t){n()(this,"_topTermAggField",void 0),this._topTermAggField=t}supportsFieldMetaFromEs(){return!1}supportsFieldMetaFromLocalData(){return!this.getSource().isMvt()}getSource(){return this._topTermAggField.getSource()}getMbFieldName(){return this.getName()}getOrigin(){return this._topTermAggField.getOrigin()}getName(){return`${this._topTermAggField.getName()}${l.Eb}`}getRootName(){return""}async getLabel(){return`${await this._topTermAggField.getLabel()}%`}isValid(){return this._topTermAggField.isValid()}async getDataType(){return"number"}async createTooltipProperty(t){return new u.a(this.getName(),await this.getLabel(),t)}getValueAggDsl(){return null}getBucketCount(){return 0}isCount(){return!1}async getExtendedStatsFieldMetaRequest(){return null}async getPercentilesFieldMetaRequest(t){return null}async getCategoricalFieldMetaRequest(){return null}canValueBeFormatted(){return!1}isEqual(t){return t.getName()===this.getName()}pluckRangeFromTileMetaFeature(t){return null}getMask(){}}var h=i(276);class es_agg_tooltip_property_ESAggTooltipProperty extends h.a{constructor(t,e,i,r,o){super(t,e,i,o),n()(this,"_aggType",void 0),n()(this,"_aggField",void 0),this._aggType=r,this._aggField=i}getHtmlDisplayValue(){const t=this.getRawValue();return void 0!==t&&this._aggField.isCount()?parseInt(t,10).toLocaleString():super.getHtmlDisplayValue()}isFilterable(){return this._aggType===l.b.TERMS&&super.isFilterable()}}var p=i(132);class count_agg_field_CountAggField{constructor({label:t,source:e,origin:i,mask:r}){n()(this,"_source",void 0),n()(this,"_origin",void 0),n()(this,"_label",void 0),n()(this,"_mask",void 0),this._source=e,this._origin=i,this._label=t,this._mask=r}supportsFieldMetaFromEs(){return!1}supportsFieldMetaFromLocalData(){return!0}_getAggType(){return l.b.COUNT}getSource(){return this._source}getOrigin(){return this._origin}getName(){return this._source.getAggKey(this._getAggType(),this.getRootName())}getMbFieldName(){return this._source.isMvt()?"_count":this.getName()}getRootName(){return""}async getLabel(){return this._label?this._label:await this._source.getAggLabel(l.b.COUNT,"")}isValid(){return!0}async getDataType(){return"number"}async createTooltipProperty(t){const e=await this._source.getIndexPattern(),i=new u.a(this.getName(),await this.getLabel(),t);return new es_agg_tooltip_property_ESAggTooltipProperty(i,e,this,this._getAggType(),this._source.getApplyGlobalQuery())}getValueAggDsl(t){return null}getBucketCount(){return 0}isCount(){return!0}canValueBeFormatted(){return!1}async getExtendedStatsFieldMetaRequest(){return null}async getPercentilesFieldMetaRequest(t){return null}async getCategoricalFieldMetaRequest(t){return null}isEqual(t){return t.getName()===this.getName()}pluckRangeFromTileMetaFeature(t){return Object(p.d)(t,"_count")}getMask(){return this._mask}}var d=i(165),f=i(76);class agg_field_AggField extends count_agg_field_CountAggField{constructor(t){super(t),n()(this,"_esDocField",void 0),n()(this,"_aggType",void 0),this._esDocField=t.esDocField,this._aggType=t.aggType}supportsFieldMetaFromEs(){return!Object(d.a)(this._getAggType())}supportsFieldMetaFromLocalData(){return!this._source.isMvt()||"number"===this._getDataTypeSynchronous()}isValid(){return!!this._esDocField}getMbFieldName(){return this._source.isMvt()?this.getName()+".value":this.getName()}canValueBeFormatted(){return this._getAggType()!==l.b.UNIQUE_COUNT}isCount(){return this._getAggType()===l.b.UNIQUE_COUNT}_getAggType(){return this._aggType}getValueAggDsl(t){const e=Object(f.l)(t,this.getRootName()),i=this._getAggType(),r=i===l.b.TERMS?{size:1,shard_size:5}:{};return{[i]:Object(f.a)(r,e)}}getRootName(){return this._esDocField?this._esDocField.getName():""}async getLabel(){return this._label?this._label:await this._source.getAggLabel(this._aggType,this._esDocField?await this._esDocField.getLabel():"")}_getDataTypeSynchronous(){return this._getAggType()===l.b.TERMS?"string":"number"}async getDataType(){return this._getDataTypeSynchronous()}getBucketCount(){return this._getAggType()===l.b.TERMS?5:0}async getExtendedStatsFieldMetaRequest(){return this._esDocField?await this._esDocField.getExtendedStatsFieldMetaRequest():null}async getPercentilesFieldMetaRequest(t){return this._esDocField?await this._esDocField.getPercentilesFieldMetaRequest(t):null}async getCategoricalFieldMetaRequest(t){return this._esDocField?await this._esDocField.getCategoricalFieldMetaRequest(t):null}pluckRangeFromTileMetaFeature(t){return Object(p.d)(t,this.getName())}}var m=i(269);class percentile_agg_field_PercentileAggField extends agg_field_AggField{constructor(t){super({...t,aggType:l.b.PERCENTILE}),n()(this,"_percentile",void 0),this._percentile=t.percentile}supportsFieldMetaFromEs(){return!0}supportsFieldMetaFromLocalData(){return!0}getMbFieldName(){return this._source.isMvt()?this.getName()+`.values.${this._percentile}${Number.isInteger(this._percentile)?".0":""}`:this.getName()}canValueBeFormatted(){return!0}async getLabel(){if(this._label)return this._label;if(50===this._percentile)return`${o.i18n.translate("xpack.maps.fields.percentileMedianLabek",{defaultMessage:"median"})} ${this.getRootName()}`;const t=Object(m.a)(this._percentile);return`${this._percentile}${t} ${await this._source.getAggLabel(this._getAggType(),this.getRootName())}`}getName(){return`${super.getName()}_${this._percentile}`}getValueAggDsl(t){const e=Object(f.l)(t,this.getRootName()),i=Object(f.a)({},e);return i.percents=[this._percentile],{percentiles:i}}}function g(t,e,i){let r;r=t.type===l.b.COUNT?new count_agg_field_CountAggField({label:t.label,source:e,origin:i,mask:t.mask}):t.type===l.b.PERCENTILE?new percentile_agg_field_PercentileAggField({label:t.label,esDocField:"field"in t&&t.field?new c.a({fieldName:t.field,source:e,origin:i}):void 0,percentile:"percentile"in t&&"number"==typeof t.percentile?t.percentile:l.v,source:e,origin:i,mask:t.mask}):new agg_field_AggField({label:t.label,esDocField:"field"in t&&t.field?new c.a({fieldName:t.field,source:e,origin:i}):void 0,aggType:t.type,source:e,origin:i,mask:t.mask});const n=[r];return"field"in t&&t.type===l.b.TERMS&&n.push(new top_term_percentage_field_TopTermPercentageField(r)),n}var y=i(94);function _(t){switch(t){case l.b.AVG:return o.i18n.translate("xpack.maps.aggType.averageLabel",{defaultMessage:"average"});case l.b.COUNT:return o.i18n.translate("xpack.maps.aggType.countLabel",{defaultMessage:"count"});case l.b.MAX:return o.i18n.translate("xpack.maps.aggType.maximumLabel",{defaultMessage:"max"});case l.b.MIN:return o.i18n.translate("xpack.maps.aggType.minimumLabel",{defaultMessage:"min"});case l.b.PERCENTILE:return o.i18n.translate("xpack.maps.aggType.percentileLabel",{defaultMessage:"percentile"});case l.b.SUM:return o.i18n.translate("xpack.maps.aggType.sumLabel",{defaultMessage:"sum"});case l.b.TERMS:return o.i18n.translate("xpack.maps.aggType.topTermLabel",{defaultMessage:"top term"});case l.b.UNIQUE_COUNT:return o.i18n.translate("xpack.maps.aggType.cardinalityTermLabel",{defaultMessage:"unique count"});default:return t}}var v=i(108);const x={type:l.b.COUNT};class es_agg_source_AbstractESAggSource extends a.a{static createDescriptor(t){return{...a.a.createDescriptor(t),type:t.type?t.type:"",metrics:t.metrics&&t.metrics.length>0?t.metrics:[x]}}constructor(t){super(t),n()(this,"_metricFields",void 0),this._metricFields=[],t.metrics&&t.metrics.forEach((t=>{this._metricFields.push(...g(t,this,this.getOriginForField()))}))}getBucketsName(){return v.c}getFieldByName(t){return this.getMetricFieldForName(t)}createField({fieldName:t}){throw new Error("Cannot create a new field from just a fieldname for an es_agg_source.")}getMetricFieldForName(t){return this.getMetricFields().find((e=>e.getName()===t))||null}getOriginForField(){return l.D.SOURCE}getMetricFields(){const t=this._metricFields.filter((t=>t.isValid()));return 0===t.length?g({type:l.b.COUNT},this,this.getOriginForField()):t}getAggKey(t,e){return Object(y.b)({aggType:t,aggFieldName:e})}async getAggLabel(t,e){switch(t){case l.b.COUNT:return _(t);case l.b.TERMS:return o.i18n.translate("xpack.maps.source.esAggSource.topTermLabel",{defaultMessage:"top {fieldLabel}",values:{fieldLabel:e}});default:return`${_(t)} ${e}`}}async getFields(){return this.getMetricFields()}getValueAggsDsl(t,e){const i={};return this.getMetricFields().filter((t=>!e||e(t))).forEach((e=>{e.getValueAggDsl(t)&&(i[e.getName()]=e.getValueAggDsl(t))})),i}async getTooltipProperties(t){const e=await this.getFields(),i=[];return e.forEach((e=>{let r;for(const i in t)if(t.hasOwnProperty(i)&&e.getMbFieldName()===i){r=t[i];break}const n=e.createTooltipProperty(r);i.push(n)})),await Promise.all(i)}isGeoGridPrecisionAware(){return!1}isFieldAware(){return!1}getSyncMeta(t){return{metrics:this.getMetricFields().map((t=>t.getName()))}}getGeoGridPrecision(t){return 0}}},,function(t,e,i){"use strict";var r=i(162),n=Object.keys||function(t){var e=[];for(var i in t)e.push(i);return e};t.exports=p;var o=Object.create(i(145));o.inherits=i(128);var a=i(259),l=i(210);o.inherits(p,a);for(var c=n(l.prototype),u=0;u{this.setState((t=>({isPopoverOpen:!t.isPopoverOpen})))})),n()(this,"_closePopover",(()=>{this.setState({isPopoverOpen:!1})}))}_renderButton(){return Object(g.jsx)(d.EuiButtonEmpty,{onClick:this._togglePopover,size:"xs",iconType:"controlsHorizontal",iconSide:"left"},Object(g.jsx)(m.FormattedMessage,{id:"xpack.maps.styles.fieldMetaOptions.popoverToggle",defaultMessage:"Data mapping"}))}render(){return Object(g.jsx)(d.EuiPopover,{id:"dataMappingPopover",anchorPosition:"leftCenter",button:this._renderButton(),isOpen:this.state.isPopoverOpen,closePopover:this._closePopover,ownFocus:!0},this.props.children)}}function y(t){return Object(g.jsx)(data_mapping_popover_DataMappingPopover,null,Object(g.jsx)(d.EuiFormRow,{display:"columnCompressedSwitch"},Object(g.jsx)(c.a.Fragment,null,Object(g.jsx)(d.EuiSwitch,{label:f.i18n.translate("xpack.maps.styles.fieldMetaOptions.isEnabled.categoricalLabel",{defaultMessage:"Get categories from data set"}),checked:t.fieldMetaOptions.isEnabled,onChange:e=>{t.onChange({fieldMetaOptions:{...t.fieldMetaOptions,isEnabled:e.target.checked}})},disabled:!t.supportsFieldMetaFromLocalData,compressed:!0})," ",Object(g.jsx)(d.EuiToolTip,{content:Object(g.jsx)(d.EuiText,null,Object(g.jsx)("p",null,Object(g.jsx)(m.FormattedMessage,{id:"xpack.maps.styles.categoricalDataMapping.isEnabled.server",defaultMessage:"Calculate categories from the entire data set. Styling is consistent when users pan, zoom, and filter."})),Object(g.jsx)("p",null,Object(g.jsx)(m.FormattedMessage,{id:"xpack.maps.styles.categoricalDataMapping.isEnabled.local",defaultMessage:"When disabled, calculate categories from local data and recalculate categories when the data changes. Styling may be inconsistent when users pan, zoom, and filter."})))},Object(g.jsx)(d.EuiIcon,{type:"questionInCircle",color:"subdued"})))))}const _=f.i18n.translate("xpack.maps.addBtnTitle",{defaultMessage:"Add"}),v=f.i18n.translate("xpack.maps.deleteBtnTitle",{defaultMessage:"Delete"}),x=({onAdd:t,onRemove:e,showDeleteButton:i})=>Object(g.jsx)("div",null,i?Object(g.jsx)(d.EuiButtonIcon,{iconType:"trash",color:"danger","aria-label":v,title:v,onClick:e}):null,Object(g.jsx)(d.EuiButtonIcon,{iconType:"plusInCircle",color:"primary","aria-label":_,title:_,onClick:t}));function b(t){return"number"!=typeof t||t<=0||t>=100}class percentiles_form_PercentilesForm extends l.Component{constructor(t){super(t),n()(this,"_onSubmit",(()=>{this.state.percentiles.some(b)||this.props.onChange(this.state.percentiles)})),this.state={percentiles:t.initialPercentiles}}render(){const t=this.state.percentiles.map(((t,e)=>{const i=b(t),r=i?f.i18n.translate("xpack.maps.styles.invalidPercentileMsg",{defaultMessage:"Percentile must be a number between 0 and 100, exclusive"}):null;return Object(g.jsx)(d.EuiFormRow,{key:e,display:"rowCompressed",isInvalid:i,error:r},Object(g.jsx)(d.EuiFieldNumber,{isInvalid:i,value:t,onChange:t=>{const i=parseFloat(t.target.value),r=[...this.state.percentiles];r[e]=isNaN(i)?"":i,this.setState({percentiles:r},this._onSubmit)},append:Object(g.jsx)(x,{onAdd:()=>{let i="";if("number"==typeof t){let r=1;if(e===this.state.percentiles.length-1){if(0!==e){const i=this.state.percentiles[e-1];"number"==typeof i&&(r=t-i)}}else{const i=this.state.percentiles[e+1];"number"==typeof i&&(r=(i-t)/2)}i=t+r,i>=100&&(i=99)}const r=[...this.state.percentiles.slice(0,e+1),i,...this.state.percentiles.slice(e+1)];this.setState({percentiles:r},this._onSubmit)},onRemove:()=>{const t=1===this.state.percentiles.length?this.state.percentiles:[...this.state.percentiles.slice(0,e),...this.state.percentiles.slice(e+1)];this.setState({percentiles:t},this._onSubmit)},showDeleteButton:this.state.percentiles.length>1}),compressed:!0}))}));return Object(g.jsx)("div",null,t)}}const w=f.i18n.translate("xpack.maps.styles.ordinalDataMapping.interpolateTitle",{defaultMessage:"Interpolate between min and max"}),C=f.i18n.translate("xpack.maps.styles.ordinalDataMapping.percentilesTitle",{defaultMessage:"Use percentiles"}),S=[{value:p.n.INTERPOLATE,inputDisplay:w,dropdownDisplay:Object(g.jsx)(l.Fragment,null,Object(g.jsx)("strong",null,w),Object(g.jsx)(d.EuiText,{size:"s",color:"subdued"},Object(g.jsx)("p",null,Object(g.jsx)(m.FormattedMessage,{id:"xpack.maps.styles.ordinalDataMapping.interpolateDescription",defaultMessage:"Interpolate values from the data domain to the style on a linear scale"}))))},{value:p.n.PERCENTILES,inputDisplay:C,dropdownDisplay:Object(g.jsx)(l.Fragment,null,Object(g.jsx)("strong",null,C),Object(g.jsx)(d.EuiText,{size:"s",color:"subdued"},Object(g.jsx)("p",null,Object(g.jsx)(m.FormattedMessage,{id:"xpack.maps.styles.ordinalDataMapping.percentilesDescription",defaultMessage:"Divide style into bands that map to values"}))))}];function M(t){function e(e){t.onChange({fieldMetaOptions:{...t.fieldMetaOptions,isEnabled:e.target.checked}})}function i(e){t.onChange({fieldMetaOptions:{...t.fieldMetaOptions,sigma:parseInt(e.currentTarget.value,10)}})}const r=S.filter((e=>t.supportedDataMappingFunctions.includes(e.value)));return Object(g.jsx)(data_mapping_popover_DataMappingPopover,null,Object(g.jsx)(l.Fragment,null,Object(g.jsx)(d.EuiFormRow,{label:f.i18n.translate("xpack.maps.styles.ordinalDataMapping.dataMappingLabel",{defaultMessage:"Fitting"}),helpText:f.i18n.translate("xpack.maps.styles.ordinalDataMapping.dataMappingTooltipContent",{defaultMessage:"Fit values from the data domain to the style"})},Object(g.jsx)(d.EuiSuperSelect,{options:r,valueOfSelected:t.dataMappingFunction,onChange:function(e){const i=e===p.n.PERCENTILES?{dataMappingFunction:e,fieldMetaOptions:{...t.fieldMetaOptions,isEnabled:!0,percentiles:t.fieldMetaOptions.percentiles?t.fieldMetaOptions.percentiles:p.w}}:{dataMappingFunction:e};t.onChange(i)},itemLayoutAlign:"top",hasDividers:!0})),Object(g.jsx)(d.EuiHorizontalRule,null),t.dataMappingFunction===p.n.PERCENTILES?Object(g.jsx)(percentiles_form_PercentilesForm,{initialPercentiles:t.fieldMetaOptions.percentiles?t.fieldMetaOptions.percentiles:p.w,onChange:function(e){t.onChange({fieldMetaOptions:{...t.fieldMetaOptions,percentiles:a.a.uniq(e.sort())}})}}):function(){const r=t.fieldMetaOptions.isEnabled?Object(g.jsx)(d.EuiFormRow,{label:Object(g.jsx)(d.EuiToolTip,{anchorClassName:"eui-alignMiddle",content:f.i18n.translate("xpack.maps.styles.ordinalDataMapping.sigmaTooltipContent",{defaultMessage:"To de-emphasize outliers, set sigma to a smaller value. Smaller sigmas move the min and max closer to the median."})},Object(g.jsx)("span",null,f.i18n.translate("xpack.maps.styles.ordinalDataMapping.sigmaLabel",{defaultMessage:"Sigma"})," ",Object(g.jsx)(d.EuiIcon,{type:"questionInCircle",color:"subdued"}))),display:"columnCompressed"},Object(g.jsx)(d.EuiRange,{min:1,max:5,step:.25,value:a.a.get(t.fieldMetaOptions,"sigma",h.c),onChange:i,showTicks:!0,tickInterval:1,compressed:!0})):null;return Object(g.jsx)(l.Fragment,null,Object(g.jsx)(d.EuiFormRow,{display:"columnCompressedSwitch"},Object(g.jsx)(c.a.Fragment,null,Object(g.jsx)(d.EuiSwitch,{label:f.i18n.translate("xpack.maps.styles.ordinalDataMapping.isEnabledSwitchLabel",{defaultMessage:"Get min and max from data set"}),checked:t.fieldMetaOptions.isEnabled,onChange:e,disabled:!t.supportsFieldMetaFromLocalData,compressed:!0})," ",Object(g.jsx)(d.EuiToolTip,{content:Object(g.jsx)(d.EuiText,null,Object(g.jsx)("p",null,Object(g.jsx)(m.FormattedMessage,{id:"xpack.maps.styles.ordinalDataMapping.isEnabled.server",defaultMessage:"Calculate min and max from the entire data set. Styling is consistent when users pan, zoom, and filter. To minimize outliers, min and max are clamped to the standard deviation (sigma) from the medium."})),Object(g.jsx)("p",null,Object(g.jsx)(m.FormattedMessage,{id:"xpack.maps.styles.ordinalDataMapping.isEnabled.local",defaultMessage:"When disabled, calculate min and max from local data and recalculate min and max when the data changes. Styling may be inconsistent when users pan, zoom, and filter."})))},Object(g.jsx)(d.EuiIcon,{type:"questionInCircle",color:"subdued"})))),r)}()))}var T=i(98);const E="__other_bucket__";class dynamic_style_property_DynamicStyleProperty extends u.a{constructor(t,e,i,r,o){super(t,e),n()(this,"_field",void 0),n()(this,"_layer",void 0),n()(this,"_getFieldFormatter",void 0),n()(this,"getValueSuggestions",(async t=>null===this._field?[]:await this._field.getSource().getValueSuggestions(this._field,t))),this._field=i,this._layer=r,this._getFieldFormatter=o}_getStyleMetaDataRequestId(t){if(this.getFieldOrigin()===p.D.SOURCE)return p.zb;const e=this._layer.getValidJoins().find((e=>!!e.getRightJoinSource().getFieldByName(t)));return e?e.getSourceMetaDataRequestId():null}_getRangeFieldMetaFromLocalFeatures(){const t=this._layer.getStyle().getStyleMeta(),e=this.getFieldName();return t.getRangeFieldMetaDescriptor(e)}_getRangeFieldMetaFromStyleMetaRequest(){const t=this._getStyleMetaDataRequestId(this.getFieldName());if(!t)return null;const e=this._layer.getDataRequest(t);if(!e||!e.hasData())return null;const i=e.getData();return this._pluckOrdinalStyleMetaFromFieldMetaData(i)||null}getRangeFieldMeta(){const t=this._getRangeFieldMetaFromLocalFeatures();if(!this.isFieldMetaEnabled())return t;return this._getRangeFieldMetaFromStyleMetaRequest()||t}getPercentilesFieldMeta(){if(!this._field)return null;const t=this._getStyleMetaDataRequestId(this.getFieldName());if(!t)return null;const e=this._layer.getDataRequest(t);return e&&e.hasData()?function(t){if(void 0===t||void 0===t.values)return null;const e=Object.keys(t.values).map((e=>({percentile:e,value:t.values[e]})));return a.a.uniqBy(e,"value")}(e.getData()[`${this._field.getRootName()}_percentiles`]):null}_getCategoryFieldMetaFromLocalFeatures(){const t=this._layer.getStyle().getStyleMeta(),e=this.getFieldName();return t.getCategoryFieldMetaDescriptor(e)}_getCategoryFieldMetaFromStyleMetaRequest(){const t=this._getStyleMetaDataRequestId(this.getFieldName());if(!t)return[];const e=this._layer.getDataRequest(t);if(!e||!e.hasData())return[];const i=e.getData();return this._pluckCategoricalStyleMetaFromFieldMetaData(i)}getCategoryFieldMeta(){const t=this._getCategoryFieldMetaFromLocalFeatures();if(!this.isFieldMetaEnabled())return t;const e=this._getCategoryFieldMetaFromStyleMetaRequest();return e.length?e:t}getField(){return this._field}getFieldName(){return this._field?this._field.getName():""}getMbFieldName(){return this._field?this._field.getMbFieldName():""}isDynamic(){return!0}isOrdinal(){return!0}isCategorical(){return!1}getNumberOfCategories(){return 0}getStyleMetaHash(){const t=this.getFieldMetaOptions(),e=[t.isEnabled.toString()];if(this.isOrdinal()){const i=this.getDataMappingFunction();e.push(i),i===p.n.PERCENTILES&&t.percentiles&&e.push(t.percentiles.join(""))}else this.isCategorical()&&e.push(this.getNumberOfCategories().toString());return e.join("")}isComplete(){return!!this._field}getFieldOrigin(){return this._field?this._field.getOrigin():null}isFieldMetaEnabled(){const t=this.getFieldMetaOptions();return this.supportsFieldMeta()&&a.a.get(t,"isEnabled",!0)}supportsFieldMeta(){return this.isComplete()&&!!this._field&&this._field.supportsFieldMetaFromEs()}async getFieldMetaRequest(){if(!this._field)return null;if(this.isOrdinal())return this.getDataMappingFunction()===p.n.INTERPOLATE?this._field.getExtendedStatsFieldMetaRequest():this._field.getPercentilesFieldMetaRequest(void 0!==this.getFieldMetaOptions().percentiles?this.getFieldMetaOptions().percentiles:p.w);if(this.isCategorical()){const t=this.getNumberOfCategories();return this._field.getCategoricalFieldMetaRequest(t)}return null}supportsFeatureState(){return!0}usesFeatureState(){return!!this._field&&!this._field.getSource().isMvt()&&this.supportsFeatureState()}getMbLookupFunction(){return this.usesFeatureState()?p.ib.FEATURE_STATE:p.ib.GET}getFieldMetaOptions(){const t=a.a.get(this.getOptions(),"fieldMetaOptions",{isEnabled:!0});return this._field&&!this._field.supportsFieldMetaFromLocalData()?{...t,isEnabled:!0}:t}getDataMappingFunction(){return"dataMappingFunction"in this._options?this._options.dataMappingFunction:p.n.INTERPOLATE}_pluckOrdinalStyleMetaFromFieldMetaData(t){if(!this.isOrdinal()||!this._field)return null;const e=t[`${this._field.getRootName()}_range`];if(!e||!("avg"in e))return null;const i=a.a.get(this.getFieldMetaOptions(),"sigma",h.c),r=e.avg-e.std_deviation*i,n=e.avg+e.std_deviation*i,o=Math.max(e.min,r),l=Math.min(e.max,n);return{min:o,max:l,delta:l-o,isMinOutsideStdRange:e.minn}}_pluckCategoricalStyleMetaFromFieldMetaData(t){if(!this.isCategorical()||!this._field)return[];const e=t[`${this._field.getRootName()}_terms`];if(!e||!("buckets"in e))return[];const i=e.buckets.map((t=>({key:t.key,count:t.doc_count})));return e.sum_other_doc_count>0&&i.push({key:E,count:e.sum_other_doc_count}),i}formatField(t){if(this.getField()){const e=this.getFieldName(),i=this._getFieldFormatter(e);return i?i(t):super.formatField(t)}return super.formatField(t)}_getSupportedDataMappingFunctions(){return[p.n.INTERPOLATE]}renderDataMappingPopover(t){return this._field&&this.supportsFieldMeta()?this.isCategorical()?Object(g.jsx)(y,{fieldMetaOptions:this.getFieldMetaOptions(),onChange:t,supportsFieldMetaFromLocalData:this._field.supportsFieldMetaFromLocalData()}):Object(g.jsx)(M,{fieldMetaOptions:this.getFieldMetaOptions(),styleName:this.getStyleName(),onChange:t,dataMappingFunction:this.getDataMappingFunction(),supportedDataMappingFunctions:this._getSupportedDataMappingFunctions(),supportsFieldMetaFromLocalData:this._field.supportsFieldMetaFromLocalData()}):null}getMbPropertyName(){if(!this._field)return"";let t;return t=this.usesFeatureState()?this._field.getName():!this._field.getSource().isMvt()&&this._field.supportsFieldMetaFromLocalData()?Object(T.e)(this.getStyleName(),this._field.getName()):this._field.getMbFieldName(),t}getMbPropertyValue(t){return this.isOrdinal()?function(t){if("string"!=typeof t)return t;const e=parseFloat(t);return isNaN(e)?null:e}(t):t}enrichGeoJsonAndMbFeatureState(t,e,i){const r=this.usesFeatureState(),n={source:i,id:void 0},o={},a=this.getMbPropertyName();for(let i=0;iu||f>h||m>p)return c=n,u=i,h=f,p=m,void(a=0);var g=r.lineString([c,n],t.properties);if(!1===e(g,i,o,m,a))return!1;a++,c=n}))&&void 0}}}))}function h(t,e){if(!t)throw new Error("geojson is required");c(t,(function(t,i,n){if(null!==t.geometry){var o=t.geometry.type,a=t.geometry.coordinates;switch(o){case"LineString":if(!1===e(t,i,n,0,0))return!1;break;case"Polygon":for(var l=0;l0&&a.length>n&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=a.length,l=c,console&&console.warn&&console.warn(l)}return t}function d(){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 f(t,e,i){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:i},n=d.bind(r);return n.listener=i,r.wrapFn=n,n}function m(t,e,i){var r=t._events;if(void 0===r)return[];var n=r[e];return void 0===n?[]:"function"==typeof n?i?[n.listener||n]:[n]:i?function(t){for(var e=new Array(t.length),i=0;i0&&(a=e[0]),a instanceof Error)throw a;var l=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw l.context=a,l}var c=n[t];if(void 0===c)return!1;if("function"==typeof c)o(c,this,e);else{var u=c.length,h=y(c,u);for(i=0;i=0;o--)if(i[o]===e||i[o].listener===e){a=i[o].listener,n=o;break}if(n<0)return this;0===n?i.shift():function(t,e){for(;e+1=0;r--)this.removeListener(t,e[r]);return this},l.prototype.listeners=function(t){return m(this,t,!0)},l.prototype.rawListeners=function(t){return m(this,t,!1)},l.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):g.call(t,e)},l.prototype.listenerCount=g,l.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},,function(t,e,i){"use strict";i.d(e,"a",(function(){return ValidatedRange}));var r=i(23),n=i.n(r),o=i(2),a=i.n(o),l=i(4),c=i.n(l),u=i(14),h=i(40),p=i(3);function d(t,e,i){return i>=t&&i<=e}class ValidatedRange extends c.a.Component{constructor(...t){super(...t),a()(this,"state",{}),a()(this,"_onRangeChange",(t=>{const e=parseFloat(t.target.value,10);let i=isNaN(e)?"":e;i=Number(i);const r=!!d(this.props.min,this.props.max,i);this.setState({value:i,isValid:r}),r&&this.props.onChange(i)}))}static getDerivedStateFromProps(t,e){return t.value!==e.prevValue?{value:t.value,prevValue:t.value,isValid:d(t.min,t.max,t.value)}:null}render(){const{max:t,min:e,value:i,onChange:r,...o}=this.props,a=Object(p.jsx)(u.EuiRange,n()({min:e,max:t,value:this.state.value.toString(),onChange:this._onRangeChange},o));return this.state.isValid?a:Object(p.jsx)("div",null,a,Object(p.jsx)(u.EuiFormErrorText,null,Object(p.jsx)(h.FormattedMessage,{id:"xpack.maps.validatedRange.rangeErrorMessage",defaultMessage:"Must be between {min} and {max}",values:{min:e,max:t}})))}}},function(t,e,i){t.exports=i(22)(3711)},function(t,e,i){"use strict";i.d(e,"a",(function(){return AbstractStyleProperty}));var r=i(2),n=i.n(r),o=i(107);class AbstractStyleProperty{constructor(t,e){n()(this,"_options",void 0),n()(this,"_styleName",void 0),this._options=t,this._styleName=e}isDynamic(){return!1}isComplete(){return!0}formatField(t){return null==t?"":"boolean"==typeof t?t.toString():Array.isArray(t)?t.join(", "):t}getStyleName(){return this._styleName}getOptions(){return this._options}renderLegendDetailRow({isPointsOnly:t,isLinesOnly:e}){return null}renderDataMappingPopover(t){return null}getDisplayStyleName(){return Object(o.b)(this.getStyleName())}}},function(t,e,i){"use strict";i.d(e,"b",(function(){return p})),i.d(e,"c",(function(){return d})),i.d(e,"a",(function(){return f}));var r=i(39),n=i.n(r),o=i(245),a=i.n(o),l=i(246),c=i.n(l);const u=!0,h=!1;async function p({source:t,prevDataRequest:e,nextRequestMeta:i,extentAware:r,getUpdateDueToTimeslice:o}){if(i.isForceRefresh&&i.applyForceRefresh)return!1;const l=await t.isTimeAware(),p=t.isFieldAware(),d=t.isQueryAware();if(!(l||r||p||d))return!!e&&e.hasDataOrRequestInProgress();if(!e)return!1;const f=e.getMeta();if(!f)return!1;if(f.isFeatureEditorOpenForLayer!==i.isFeatureEditorOpenForLayer)return!1;let m=!1,g=!1,y=!1;l&&(m=f.applyGlobalTime!==i.applyGlobalTime,i.applyGlobalTime&&(g=!n.a.isEqual(f.timeFilters,i.timeFilters),n.a.isEqual(f.timeslice,i.timeslice)||(y=o(i.timeslice))));let _=!1;p&&(_=!n.a.isEqual(f.fieldNames,i.fieldNames));let v=!1,x=!1,b=!1,w=!1;d&&(w=f.applyGlobalQuery!==i.applyGlobalQuery,b=!n.a.isEqual(f.sourceQuery,i.sourceQuery),i.applyGlobalQuery&&(v=!n.a.isEqual(f.query,i.query),x=!n.a.isEqual(f.filters,i.filters)));let C=!1;(l||d)&&i.applyForceRefresh&&(C=f.searchSessionId!==i.searchSessionId);let S=!1;r&&(S=function(t={},e={}){const{buffer:i}=t,{buffer:r}=e;if(!i||!i||!r)return u;if(n.a.isEqual(i,r))return h;const o=a()([i.minLon,i.minLat,i.maxLon,i.maxLat]),l=a()([r.minLon,r.minLat,r.maxLon,r.maxLat]),p=c()(o,l),d=n.a.get(t,"areResultsTrimmed",!1);return p&&!d?h:u}(f,i));const M=!n.a.isEqual(f.sourceMeta,i.sourceMeta);return!(m||g||y||S||_||v||x||b||w||M||C)}function d({prevDataRequest:t,nextMeta:e}){if(!t)return!1;const i=t.getMeta();if(!i)return!1;const r=!n.a.isEqual(i.dynamicStyleFields,e.dynamicStyleFields),o=!n.a.isEqual(i.sourceQuery,e.sourceQuery),a=e.isTimeAware!==i.isTimeAware,l=!!e.isTimeAware&&!n.a.isEqual(i.timeFilters,e.timeFilters),c=i.searchSessionId!==e.searchSessionId;return!(r||o||a||l||c)}function f({prevDataRequest:t,nextMeta:e}){if(!t)return!1;const i=t.getMeta();return!!i&&n.a.isEqual(i.fieldNames,e.fieldNames)}},function(t,e,i){"use strict";i.d(e,"a",(function(){return ESDocField}));var r=i(2),n=i.n(r),o=i(24),a=i(276),l=i(109),c=i(146);class ESDocField extends c.a{constructor({fieldName:t,source:e,origin:i}){super({fieldName:t,origin:i}),n()(this,"_source",void 0),this._source=e}supportsFieldMetaFromEs(){return!0}supportsFieldMetaFromLocalData(){return!this.getSource().isMvt()}canValueBeFormatted(){return!0}getSource(){return this._source}async _getIndexPatternField(){const t=(await this._source.getIndexPattern()).fields.getByName(this.getName());return t&&o.indexPatterns.isNestedField(t)?void 0:t}async createTooltipProperty(t){const e=await this._source.getIndexPattern(),i=new l.a(this.getName(),await this.getLabel(),t);return new a.a(i,e,this,this._source.getApplyGlobalQuery())}async getDataType(){const t=await this._getIndexPatternField();return t?t.type:""}async getLabel(){const t=await this._getIndexPatternField();return t&&t.displayName?t.displayName:super.getLabel()}async getExtendedStatsFieldMetaRequest(){const t=await this._getIndexPatternField();if(!t||"number"!==t.type&&"date"!==t.type)return null;const e={};return t.scripted&&t.script?e.script={source:t.script,lang:t.lang}:e.field=this.getName(),{[`${this.getName()}_range`]:{extended_stats:e}}}async getPercentilesFieldMetaRequest(t){const e=await this._getIndexPatternField();if(!e||"number"!==e.type)return null;const i={percents:[0,...t]};return e.scripted&&e.script?i.script={source:e.script,lang:e.lang}:i.field=this.getName(),{[`${this.getName()}_percentiles`]:{percentiles:i}}}async getCategoricalFieldMetaRequest(t){const e=await this._getIndexPatternField();if(!e||t<=0)return null;const i={size:t};return e.scripted&&e.script?i.script={source:e.script,lang:e.lang}:i.field=this.getName(),{[`${this.getName()}_terms`]:{terms:i}}}}},function(t,e,i){"use strict";i.d(e,"c",(function(){return r})),i.d(e,"a",(function(){return n})),i.d(e,"b",(function(){return o})),i.d(e,"e",(function(){return a})),i.d(e,"f",(function(){return l})),i.d(e,"d",(function(){return c}));const r="meta",n="hits.total.relation",o="hits.total.value";function a(t){let e=0;return t.forEach((t=>{const i=t.properties?t.properties["aggregations._count.sum"]:0;i>0&&(e+=i)})),{docCount:e}}function l(t,e){let i=0,r=0,a=0;return t.forEach((t=>{var l,c;const u=t.properties?t.properties[o]:0;u>0&&(i+=u,r++),"gte"===(null==t||null===(l=t.properties)||void 0===l?void 0:l[n])&&(null==t||null===(c=t.properties)||void 0===c?void 0:c[o])>=e+1&&a++})),{totalFeaturesCount:i,tilesWithFeatures:r,tilesWithTrimmedResults:a}}function c(t,e){const i=`aggregations.${e}.min`,r=`aggregations.${e}.max`;return t.properties&&"number"==typeof t.properties[i]&&"number"==typeof t.properties[r]?{min:t.properties[i],max:t.properties[r]}:null}},function(t,e,i){"use strict";i.d(e,"a",(function(){return n}));var r=i(1);const n={apply:r.i18n.translate("xpack.maps.panel.applyLabel",{defaultMessage:"Apply"}),clear:r.i18n.translate("xpack.maps.panel.clearLabel",{defaultMessage:"Clear"}),close:r.i18n.translate("xpack.maps.panel.closeLabel",{defaultMessage:"Close"}),discardChanges:r.i18n.translate("xpack.maps.panel.discardChangesLabel",{defaultMessage:"Discard changes"}),edit:r.i18n.translate("xpack.maps.panel.editLabel",{defaultMessage:"Edit"}),keepChanges:r.i18n.translate("xpack.maps.panel.keepChangesLabel",{defaultMessage:"Keep changes"})}},,,function(t,e,i){"use strict";function r(t){return"getTermField"in t}function n(t){return void 0!==t.indexPatternId&&void 0!==t.geoField}i.d(e,"f",(function(){return r})),i.d(e,"e",(function(){return n})),i.d(e,"a",(function(){return g})),i.d(e,"b",(function(){return es_distance_source_ESDistanceSource})),i.d(e,"c",(function(){return es_term_source_ESTermSource})),i.d(e,"g",(function(){return _})),i.d(e,"d",(function(){return table_source_TableSource}));var o=i(2),a=i.n(o),l=i(1),c=i(0),u=i(94),h=i(113),p=i(116),d=i(117),f=i(76);const m=[c.k],g=5;class es_distance_source_ESDistanceSource extends h.a{static createDescriptor(t){const e=h.a.createDescriptor(t);if(!Object(p.a)(t.geoField))throw new Error("Cannot create an ESDistanceSource without a geoField property");return{...e,geoField:t.geoField,distance:"number"==typeof t.distance?t.distance:g,type:c.Ab.ES_DISTANCE_SOURCE}}constructor(t){const e=es_distance_source_ESDistanceSource.createDescriptor(t);super(e),a()(this,"_descriptor",void 0),this._descriptor=e}hasCompleteConfig(){return n(this._descriptor)}getOriginForField(){return c.D.JOIN}getWhereQuery(){return this._descriptor.whereQuery}getAggKey(t,e){return Object(u.a)({aggType:t,aggFieldName:e,rightSourceId:this._descriptor.id})}async getPropertiesMap(t,e,i,r,n,o){if(void 0===o)throw new Error(l.i18n.translate("xpack.maps.esDistanceSource.noFeatureCollectionMsg",{defaultMessage:"Unable to perform distance join, features not provided. To enable distance join, select 'Limit results' in 'Scaling'"}));if(!this.hasCompleteConfig())return new Map;const a=`${this._descriptor.distance}km`;let u=!1;const h={};for(let t=0;t{const i=Object(f.j)(t,x);e&&(i[e]=t.doc_count),o.set(t.key.toString(),i)})),o}(await this._runEsQuery({requestId:this.getId(),requestName:l.i18n.translate("xpack.maps.termSource.requestName",{defaultMessage:"{leftSourceName} term join request",values:{leftSourceName:e}}),searchSource:a,registerCancelCallback:r,requestDescription:l.i18n.translate("xpack.maps.termSource.requestDescription",{defaultMessage:"Get metrics from data view: {dataViewName}, term field: {termFieldName}",values:{dataViewName:o.getName(),termFieldName:this._termField.getName()}}),searchSessionId:t.searchSessionId,executionContext:Object(d.b)({description:"es_term_source:terms"},t.executionContext),requestsAdapter:n.requests}),this.getAggKey(c.b.COUNT))}isFilterByMapBounds(){return!1}async getDisplayName(){return`es_table ${this.getIndexPatternId()}`}getSyncMeta(t){return{...super.getSyncMeta(t),indexPatternId:this._descriptor.indexPatternId,size:this._descriptor.size,term:this._descriptor.term}}getRightFields(){return this.getMetricFields()}}a()(es_term_source_ESTermSource,"type",c.Ab.ES_TERM_SOURCE);var b=i(41),w=i(151),C=i(216),S=i(109);class table_source_TableSource extends w.a{static createDescriptor(t){return{type:c.Ab.TABLE_SOURCE,__rows:t.__rows||[],__columns:t.__columns||[],term:t.term||"",id:t.id||Object(b.v4)()}}constructor(t){const e=table_source_TableSource.createDescriptor(t);super(e),a()(this,"_descriptor",void 0),this._descriptor=e}async getDisplayName(){return`table source ${Object(b.v4)()}`}async getPropertiesMap(t,e,i,r){const n=new Map,o=this._descriptor.__columns.map((t=>t.name));for(let t=0;t=0&&t!==this._descriptor.term&&(r[t]=e[t]));i&&!n.has(i.toString())&&n.set(i.toString(),r)}return n}getTermField(){const t=this._descriptor.__columns.find((t=>t.name===this._descriptor.term));if(!t)throw new Error(`Cannot find column for ${this._descriptor.term} in ${JSON.stringify(this._descriptor.__columns)}`);return new C.a({fieldName:t.name,label:t.label,source:this,origin:c.D.JOIN,dataType:t.type})}getWhereQuery(){}hasCompleteConfig(){return!0}getId(){return this._descriptor.id}getRightFields(){return this._descriptor.__columns.map((t=>new C.a({fieldName:t.name,label:t.label,source:this,origin:c.D.JOIN,dataType:t.type})))}hasTooltipProperties(){return!1}createField({fieldName:t}){const e=this.getFieldByName(t);if(!e)throw new Error(`Cannot find field for ${t}`);return e}async getBoundsForFilters(t,e){return null}getFieldByName(t){const e=this._descriptor.__columns.find((e=>e.name===t));return e?new C.a({fieldName:e.name,label:e.label,source:this,origin:c.D.JOIN,dataType:e.type}):null}getFields(){throw new Error("must implement")}async getGeoJsonWithMeta(t,e,i,r){throw new Error("TableSource cannot return GeoJson")}async getLeftJoinFields(){throw new Error("TableSource cannot be used as a left-layer in a term join")}getSourceStatus(t){throw new Error("must add tooltip content")}async getSupportedShapeTypes(){return[]}isBoundsAware(){return!1}async getTooltipProperties(t){const e=[];for(const i in t)if(t.hasOwnProperty(i)){const r=this.getFieldByName(i);r&&e.push(new S.a(i,await r.getLabel(),t[i]))}return e}}a()(table_source_TableSource,"type",c.Ab.TABLE_SOURCE)},,,,,function(t,e,i){t.exports=i(22)(2943)},,,function(t,e,i){"use strict";i.d(e,"a",(function(){return MbValidatedColorPicker}));var r=i(2),n=i.n(r),o=i(4),a=i(14),l=i(3);const c="rgba(0,0,0,0)";class MbValidatedColorPicker extends o.Component{constructor(...t){super(...t),n()(this,"state",{colorInputValue:this.props.color===c?"":this.props.color}),n()(this,"_onColorChange",(t=>{this.setState({colorInputValue:t}),this.props.onChange(Object(a.isValidHex)(t)?t:c)}))}render(){return Object(l.jsx)(a.EuiColorPicker,{onChange:this._onColorChange,color:this.state.colorInputValue,swatches:this.props.swatches,append:this.props.append,prepend:this.props.prepend,compressed:!0})}}},function(t,e,i){(function(t){function i(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===i(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===i(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===i(t)},e.isError=function(t){return"[object Error]"===i(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(this,i(141).Buffer)},function(t,e,i){"use strict";i.d(e,"a",(function(){return AbstractField}));var r=i(2),n=i.n(r),o=i(0),a=i(109);class AbstractField{constructor({fieldName:t,origin:e}){n()(this,"_fieldName",void 0),n()(this,"_origin",void 0),this._fieldName=t,this._origin=e||o.D.SOURCE}supportsFieldMetaFromEs(){throw new Error("must implement AbstractField#supportsFieldMetaFromEs")}supportsFieldMetaFromLocalData(){throw new Error("must implement AbstractField#supportsFieldMetaFromLocalData")}getName(){return this._fieldName}getMbFieldName(){return this.getName()}getRootName(){return this.getName()}canValueBeFormatted(){return!1}getSource(){throw new Error("must implement AbstractField#getSource")}isValid(){return!!this._fieldName}async getDataType(){return"string"}async getLabel(){return this._fieldName}async createTooltipProperty(t){const e=await this.getLabel();return new a.a(this.getName(),e,t)}getOrigin(){return this._origin}async getExtendedStatsFieldMetaRequest(){return null}async getPercentilesFieldMetaRequest(t){return null}async getCategoricalFieldMetaRequest(t){return null}isEqual(t){return this._origin===t.getOrigin()&&this._fieldName===t.getName()}pluckRangeFromTileMetaFeature(t){return null}isCount(){return!1}}},function(t,e,i){"use strict";i.d(e,"a",(function(){return n}));var r=i(1);const n={fieldSelectPlaceholder:r.i18n.translate("xpack.maps.input.fieldSelectPlaceholder",{defaultMessage:"Select field"}),relationshipLabel:r.i18n.translate("xpack.maps.input.relationshipLabel",{defaultMessage:"Relationship"})}},,function(t,e,i){"use strict";i.d(e,"a",(function(){return p}));var r=i(23),n=i.n(r),o=(i(4),i(42)),a=i.n(o),l=i(14),c=i(3);const u={iconType:"questionInCircle",color:"gray"},h={binary:{iconType:"tokenBinary"},boolean:{iconType:"tokenBoolean"},conflict:{iconType:"warning",color:"euiColorVis9",shape:"square"},date:{iconType:"tokenDate"},date_range:{iconType:"tokenDate"},dense_vector:{iconType:"tokenDenseVector"},geo_point:{iconType:"tokenGeo"},geo_shape:{iconType:"tokenGeo"},ip:{iconType:"tokenIP"},ip_range:{iconType:"tokenIP"},flattened:{iconType:"tokenFlattened"},match_only_text:{iconType:"tokenString"},murmur3:{iconType:"tokenSearchType"},number:{iconType:"tokenNumber"},number_range:{iconType:"tokenNumber"},rank_feature:{iconType:"tokenRankFeature"},rank_features:{iconType:"tokenRankFeatures"},histogram:{iconType:"tokenHistogram"},_source:{iconType:"editorCodeBlock",color:"gray"},point:{iconType:"tokenShape"},shape:{iconType:"tokenShape"},string:{iconType:"tokenString"},text:{iconType:"tokenString"},keyword:{iconType:"tokenKeyword"},gauge:{iconType:"tokenMetricGauge"},counter:{iconType:"tokenMetricCounter"},nested:{iconType:"tokenNested"},version:{iconType:"tokenTag"}};function p({type:t,label:e,size:i="s",scripted:r,className:o,...p}){const d=h[t]||u;return Object(c.jsx)(l.EuiToken,n()({},d,{className:a()("kbnFieldIcon",o),"aria-label":e||t,title:e||t,size:i,fill:r?"dark":void 0},p))}i(379);Object.keys({xs:"kbnFieldButton--xs",s:"kbnFieldButton--s"})},,function(t,e,i){"use strict";i.d(e,"a",(function(){return vector_source_AbstractVectorSource})),i(4);var r=i(1),n=i(0),o=i(109),a=i(110),l=i(232),c=i(3);class vector_source_AbstractVectorSource extends a.a{isMvt(){return!1}createField({fieldName:t}){throw new Error("Not implemented")}getFieldByName(t){return this.createField({fieldName:t})}isFilterByMapBounds(){return!1}isBoundsAware(){return!1}async supportsFitToBounds(){return!0}async getBoundsForFilters(t,e){return null}async getFields(){return[]}async getLeftJoinFields(){return[]}async getGeoJsonWithMeta(t,e,i,r,n){throw new Error("Should implement VectorSource#getGeoJson")}hasTooltipProperties(){return!1}async getTooltipProperties(t,e){const i=[];for(const e in t)e.startsWith("__kbn")||i.push(new o.a(e,e,t[e]));return i}async isTimeAware(){return!1}supportsJoins(){return!0}async getSupportedShapeTypes(){return[n.Fb.POINT,n.Fb.LINE,n.Fb.POLYGON]}getSourceStatus(t){return{tooltipContent:null,areResultsTrimmed:!1}}getSyncMeta(t){return null}async getTimesliceMaskFieldName(){return null}async addFeature(t){throw new Error("Should implement VectorSource#addFeature")}async deleteFeature(t){throw new Error("Should implement VectorSource#deleteFeature")}async supportsFeatureEditing(){return!1}getFeatureActions({addFilters:t,geoFieldNames:e,getActionContext:i,getFilterActions:o,getGeojsonGeometry:a,mbFeature:u,onClose:h}){if(0===e.length||null===t)return[];if(u.geometry.type!==n.J.POLYGON&&u.geometry.type!==n.J.MULTI_POLYGON)return[];if(this.isMvt())return[];const p=a();return p?[{label:r.i18n.translate("xpack.maps.tooltip.action.filterByGeometryLabel",{defaultMessage:"Filter by geometry"}),id:"FILTER_BY_GEOMETRY_ACTION",form:Object(c.jsx)(l.a,{onClose:h,geoFieldNames:e,addFilters:t,getFilterActions:o,getActionContext:i,geometry:p})}]:[]}}},,function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(124);e.default=function(t){var e=[1/0,1/0,-1/0,-1/0];return r.coordEach(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]=o)throw new Error(`Tile key is malformed, expected x to be less than ${o}, you provided ${r}`);if(n>=o)throw new Error(`Tile key is malformed, expected y to be less than ${o}, you provided ${n}`);return{x:r,y:n,zoom:i,tileCount:o}}(t);return{top:m(i,r),bottom:m(i+1,r),left:g(e,r),right:g(e+1,r)}}function _(t,e){const i=Object(a.e)(t)*Math.PI/180,r=(1-Math.log(Math.tan(i)+(n=i,1/Math.cos(n)))/Math.PI)/2*e;var n;return Math.floor(r)}function v(t,e){const i=(t+180)/360*e;return Math.floor(i)}function x(t,e){const i=h(e),r=v(t.minLon,i),n=_(Math.min(t.maxLat,90),i),o=v(t.maxLon,i),a=_(Math.max(t.minLat,-90),i);return{minLon:g(r,i),minLat:m(a+1,i),maxLon:g(o+1,i),maxLat:m(n,i)}}},function(t,e,i){"use strict";i.d(e,"a",(function(){return n}));var r=i(0);function n(t){return[r.b.COUNT,r.b.SUM,r.b.UNIQUE_COUNT].includes(t)}},,,,,,function(t,e,i){"use strict";i.d(e,"a",(function(){return metrics_editor_MetricsEditor}));var r=i(2),n=i.n(r),o=i(4),a=i.n(o),l=i(40),c=i(14),u=i(1),h=i(23),p=i.n(h),d=i(0),f=i(113),m=i(3);const g=[{label:Object(f.c)(d.b.AVG),value:d.b.AVG},{label:Object(f.c)(d.b.COUNT),value:d.b.COUNT},{label:Object(f.c)(d.b.MAX),value:d.b.MAX},{label:Object(f.c)(d.b.MIN),value:d.b.MIN},{label:Object(f.c)(d.b.PERCENTILE),value:d.b.PERCENTILE},{label:Object(f.c)(d.b.SUM),value:d.b.SUM},{label:Object(f.c)(d.b.TERMS),value:d.b.TERMS},{label:Object(f.c)(d.b.UNIQUE_COUNT),value:d.b.UNIQUE_COUNT}];function y({value:t,onChange:e,metricsFilter:i,...r}){const n=i?g.filter(i):g;return Object(m.jsx)(c.EuiComboBox,p()({placeholder:u.i18n.translate("xpack.maps.metricSelect.selectAggregationPlaceholder",{defaultMessage:"Select aggregation"}),singleSelection:!0,isClearable:!1,options:n,selectedOptions:g.filter((e=>t===e.value)),onChange:function(t){if(0===t.length)return;const i=t[0].value;e(i)}},r))}var _=i(95),v=i(81),x=i(278),b=i(108),w=i(133);const C=[{value:d.gb.BELOW,text:b.b},{value:d.gb.ABOVE,text:b.a}];class mask_editor_MaskEditor extends o.Component{constructor(t){super(t),n()(this,"_onSet",(()=>{this._isValueInValid()||(this.props.onChange({...this.props.metric,mask:{operator:this.state.operator,value:this.state.value}}),this.props.onClose())})),n()(this,"_onClear",(()=>{const t={...this.props.metric};delete t.mask,this.props.onChange(t),this.props.onClose()})),n()(this,"_onOperatorChange",(t=>{this.setState({operator:t.target.value})})),n()(this,"_onValueChange",(t=>{const e=parseFloat(t.target.value);this.setState({value:isNaN(e)?t.target.value:e})})),this.state={operator:void 0!==this.props.metric.mask?this.props.metric.mask.operator:d.gb.BELOW,value:void 0!==this.props.metric.mask?this.props.metric.mask.value:""}}_hasChanges(){return void 0===this.props.metric.mask||this.props.metric.mask.operator!==this.state.operator||this.props.metric.mask.value!==this.state.value}_isValueInValid(){return"string"==typeof this.state.value}_renderForm(){return Object(m.jsx)(c.EuiFlexGroup,{gutterSize:"s"},Object(m.jsx)(c.EuiFlexItem,null,Object(m.jsx)(c.EuiFormRow,null,Object(m.jsx)(c.EuiSelect,{id:"maskOperatorSelect",options:C,value:this.state.operator,onChange:this._onOperatorChange,"aria-label":u.i18n.translate("xpack.maps.maskEditor.operatorSelectLabel",{defaultMessage:"Mask operator select"})}))),Object(m.jsx)(c.EuiFlexItem,null,Object(m.jsx)(c.EuiFormRow,null,Object(m.jsx)(c.EuiFieldNumber,{value:this.state.value,onChange:this._onValueChange,"aria-label":u.i18n.translate("xpack.maps.maskEditor.valueInputLabel",{defaultMessage:"Mask value input"})}))))}_renderFooter(){return Object(m.jsx)(c.EuiPopoverFooter,{paddingSize:"s"},Object(m.jsx)(c.EuiFlexGroup,null,Object(m.jsx)(c.EuiFlexItem,null,Object(m.jsx)(c.EuiButtonEmpty,{onClick:this.props.onClose,size:"s"},w.a.close)),Object(m.jsx)(c.EuiFlexItem,null,Object(m.jsx)(c.EuiButtonEmpty,{color:"danger",isDisabled:void 0===this.props.metric.mask,onClick:this._onClear,size:"s"},w.a.clear)),Object(m.jsx)(c.EuiFlexItem,null,Object(m.jsx)(c.EuiButton,{fill:!0,isDisabled:this._isValueInValid()||!this._hasChanges(),onClick:this._onSet,size:"s"},w.a.apply))))}render(){return Object(m.jsx)(a.a.Fragment,null,this._renderForm(),Object(m.jsx)(c.EuiSpacer,{size:"xs"}),this._renderFooter())}}class mask_expression_MaskExpression extends o.Component{constructor(...t){super(...t),n()(this,"state",{isPopoverOpen:!1}),n()(this,"_togglePopover",(()=>{this.setState((t=>({isPopoverOpen:!t.isPopoverOpen})))})),n()(this,"_closePopover",(()=>{this.setState({isPopoverOpen:!1})}))}_getMaskExpressionValue(){return void 0===this.props.metric.mask?"...":Object(b.g)(this.props.metric.mask.operator,this.props.metric.mask.value)}_getAggLabel(){const t=Object(f.c)(this.props.metric.type);if(this.props.metric.type===d.b.COUNT||void 0===this.props.metric.field)return t;const e=this.props.fields.find((t=>t.name===this.props.metric.field));return`${t} ${null!=e&&e.displayName?null==e?void 0:e.displayName:this.props.metric.field}`}render(){return this.props.metric.type===d.b.TERMS?null:Object(m.jsx)(c.EuiPopover,{id:"mask",button:Object(m.jsx)(c.EuiExpression,{color:"subdued",description:Object(b.e)({aggLabel:this._getAggLabel(),isJoin:this.props.isJoin}),value:this._getMaskExpressionValue(),onClick:this._togglePopover,uppercase:!1}),isOpen:this.state.isPopoverOpen,closePopover:this._closePopover,panelPaddingSize:"s",anchorPosition:"downCenter",repositionOnScroll:!0},Object(m.jsx)(mask_editor_MaskEditor,{metric:this.props.metric,onChange:this.props.onChange,onClose:this._closePopover}))}}var S=i(147);function M(t,e){if(!t)return[];if(e===d.b.UNIQUE_COUNT||e===d.b.TERMS)return Object(v.i)(t);const i=["number"];return e!==d.b.SUM&&i.push("date"),t.filter((t=>t.aggregatable&&i.includes(t.type)&&("counter"!==t.timeSeriesMetric||["min","max"].includes(e))))}function T({bucketsName:t,fields:e,isJoin:i,metricsFilter:r,metric:n,onChange:a,showRemoveButton:h,onRemove:p}){const f=t=>{t&&n.type!==d.b.COUNT&&a({label:n.label,type:n.type,field:t})},g=t=>{n.type===d.b.PERCENTILE&&a({...n,percentile:t})};let v,w,C,T;if(n.type&&n.type!==d.b.COUNT){const t=void 0===n.field;v=Object(m.jsx)(c.EuiFormRow,{label:u.i18n.translate("xpack.maps.metricsEditor.selectFieldLabel",{defaultMessage:"Field"}),display:"columnCompressed",isInvalid:t,error:u.i18n.translate("xpack.maps.metricsEditor.selectFieldError",{defaultMessage:"Field required for aggregation"})},Object(m.jsx)(_.a,{placeholder:S.a.fieldSelectPlaceholder,value:n.field?n.field:null,onChange:f,fields:M(e,n.type),isClearable:!1,isInvalid:t,compressed:!0}))}if(n.type===d.b.PERCENTILE){const t=u.i18n.translate("xpack.maps.metricsEditor.selectPercentileLabel",{defaultMessage:"Percentile"});w=Object(m.jsx)(x.a,{min:0,max:100,onChange:g,label:t,initialValue:"number"==typeof n.percentile?n.percentile:d.v,display:"columnCompressed"})}return n.type&&(C=Object(m.jsx)(c.EuiFormRow,{label:u.i18n.translate("xpack.maps.metricsEditor.customLabel",{defaultMessage:"Custom label"}),display:"columnCompressed"},Object(m.jsx)(c.EuiFieldText,{onChange:t=>{a({...n,label:t.target.value})},value:n.label?n.label:"",compressed:!0}))),h&&(T=Object(m.jsx)("div",{className:"mapMetricEditorPanel__metricRemoveButton"},Object(m.jsx)(c.EuiButtonEmpty,{iconType:"trash",size:"xs",color:"danger",onClick:p,"aria-label":u.i18n.translate("xpack.maps.metricsEditor.deleteMetricAriaLabel",{defaultMessage:"Delete metric"})},Object(m.jsx)(l.FormattedMessage,{id:"xpack.maps.metricsEditor.deleteMetricButtonLabel",defaultMessage:"Delete metric"})))),Object(m.jsx)(o.Fragment,null,Object(m.jsx)(c.EuiFormRow,{label:u.i18n.translate("xpack.maps.metricsEditor.aggregationLabel",{defaultMessage:"Aggregation"}),display:"columnCompressed"},Object(m.jsx)(y,{onChange:t=>{if(!t)return;const i={type:t,label:n.label};if(t===d.b.COUNT||!("field"in n)||!n.field)return void a(i);const r=M(e,t).find((t=>t.name===n.field)),o={...i,field:r?n.field:void 0};t===d.b.PERCENTILE?a({...o,percentile:"percentile"in n?n.percentile:d.v}):a(o)},value:n.type,metricsFilter:r,compressed:!0})),v,w,C,Object(m.jsx)(c.EuiFormRow,{label:Object(b.f)({bucketsName:t,isJoin:i}),display:"columnCompressed"},Object(m.jsx)(mask_expression_MaskExpression,{fields:e,isJoin:i,metric:n,onChange:a})),T)}class metrics_editor_MetricsEditor extends o.Component{constructor(t){super(t),n()(this,"_addMetric",(()=>{this.setState({metrics:[...this.state.metrics,{type:d.b.COUNT}]},this._onSubmit)})),this.state={metrics:0===this.props.metrics.length?[f.b]:this.props.metrics}}_onSubmit(){this.state.metrics.some((t=>{return!((e=t).type===d.b.COUNT||void 0!==e.field);var e}))||this.props.onChange(this.state.metrics)}_renderMetrics(){return this.state.metrics.map(((t,e)=>Object(m.jsx)("div",{key:e,className:"mapMetricEditorPanel__metricEditor"},Object(m.jsx)(T,{bucketsName:this.props.bucketsName,isJoin:this.props.isJoin,onChange:t=>{this.setState({metrics:[...this.state.metrics.slice(0,e),t,...this.state.metrics.slice(e+1)]},this._onSubmit)},metric:t,fields:this.props.fields,metricsFilter:this.props.metricsFilter,showRemoveButton:e>0,onRemove:()=>{this.setState({metrics:[...this.state.metrics.slice(0,e),...this.state.metrics.slice(e+1)]},this._onSubmit)}}))))}_renderAddMetricButton(){return this.props.allowMultipleMetrics?Object(m.jsx)(o.Fragment,null,Object(m.jsx)(c.EuiSpacer,{size:"xs"}),Object(m.jsx)(c.EuiTextAlign,{textAlign:"center"},Object(m.jsx)(c.EuiButtonEmpty,{onClick:this._addMetric,size:"xs",iconType:"plusInCircleFilled"},Object(m.jsx)(l.FormattedMessage,{id:"xpack.maps.metricsEditor.addMetricButtonLabel",defaultMessage:"Add metric"})))):null}render(){return Object(m.jsx)(o.Fragment,null,Object(m.jsx)("div",{className:"mapMapLayerPanel__metrics"},this._renderMetrics()),this._renderAddMetricButton())}}},,,,,,,,,,,,,,,,,,,,,,function(t,e){(function(){e.defaults={.1:{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},.2:{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:"\n"},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(this)},function(t,e,i){(function(){var e,r,n,o,a,l,c,u,h={}.hasOwnProperty;u=i(103),c=u.isObject,l=u.isFunction,a=u.getValue,o=i(89),e=i(78),r=i(255),n=i(195),t.exports=function(t){function i(t,r,n){var o,a,l,c;if(i.__super__.constructor.call(this,t),null==r)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(r),this.type=e.Element,this.attribs={},this.schemaTypeInfo=null,null!=n&&this.attribute(n),t.type===e.Document&&(this.isRoot=!0,this.documentObject=t,t.rootObject=this,t.children))for(a=0,l=(c=t.children).length;a=n;e=0<=n?++r:--r)if(!this.attribs[e].isEqualNode(t.attribs[e]))return!1;return!0},i}(o)}).call(this)},function(t,e){(function(){t.exports=function(){function t(t){this.nodes=t}return Object.defineProperty(t.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),t.prototype.clone=function(){return this.nodes=null},t.prototype.getNamedItem=function(t){return this.nodes[t]},t.prototype.setNamedItem=function(t){var e;return e=this.nodes[t.nodeName],this.nodes[t.nodeName]=t,e||null},t.prototype.removeNamedItem=function(t){var e;return e=this.nodes[t],delete this.nodes[t],e||null},t.prototype.item=function(t){return this.nodes[Object.keys(this.nodes)[t]]||null},t.prototype.getNamedItemNS=function(t,e){throw new Error("This DOM method is not implemented.")},t.prototype.setNamedItemNS=function(t){throw new Error("This DOM method is not implemented.")},t.prototype.removeNamedItemNS=function(t,e){throw new Error("This DOM method is not implemented.")},t}()}).call(this)},function(t,e,i){(function(){var e,r,n={}.hasOwnProperty;e=i(78),r=i(160),t.exports=function(t){function i(t,r){if(i.__super__.constructor.call(this,t),null==r)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=e.CData,this.value=this.stringify.cdata(r)}return function(t,e){for(var i in e)n.call(e,i)&&(t[i]=e[i]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(i,t),i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(t){return this.options.writer.cdata(this,this.options.writer.filterOptions(t))},i}(r)}).call(this)},function(t,e,i){(function(){var e,r,n={}.hasOwnProperty;e=i(78),r=i(160),t.exports=function(t){function i(t,r){if(i.__super__.constructor.call(this,t),null==r)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=e.Comment,this.value=this.stringify.comment(r)}return function(t,e){for(var i in e)n.call(e,i)&&(t[i]=e[i]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(i,t),i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(t){return this.options.writer.comment(this,this.options.writer.filterOptions(t))},i}(r)}).call(this)},function(t,e,i){(function(){var e,r,n,o={}.hasOwnProperty;n=i(103).isObject,r=i(89),e=i(78),t.exports=function(t){function i(t,r,o,a){var l;i.__super__.constructor.call(this,t),n(r)&&(r=(l=r).version,o=l.encoding,a=l.standalone),r||(r="1.0"),this.type=e.Declaration,this.version=this.stringify.xmlVersion(r),null!=o&&(this.encoding=this.stringify.xmlEncoding(o)),null!=a&&(this.standalone=this.stringify.xmlStandalone(a))}return function(t,e){for(var i in e)o.call(e,i)&&(t[i]=e[i]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(i,t),i.prototype.toString=function(t){return this.options.writer.declaration(this,this.options.writer.filterOptions(t))},i}(r)}).call(this)},function(t,e,i){(function(){var e,r,n,o,a,l,c,u,h={}.hasOwnProperty;u=i(103).isObject,c=i(89),e=i(78),r=i(200),o=i(201),n=i(202),a=i(203),l=i(195),t.exports=function(t){function i(t,r,n){var o,a,l,c,h,p;if(i.__super__.constructor.call(this,t),this.type=e.DocType,t.children)for(a=0,l=(c=t.children).length;a-1?r:o.nextTick;v.WritableState=_;var u=Object.create(i(145));u.inherits=i(128);var h,p={deprecate:i(402)},d=i(260),f=i(209).Buffer,m=n.Uint8Array||function(){},g=i(261);function y(){}function _(t,e){l=l||i(115),t=t||{};var r=e instanceof l;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,u=t.writableHighWaterMark,h=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r&&(u||0===u)?u:h,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var p=!1===t.decodeStrings;this.decodeStrings=!p,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var i=t._writableState,r=i.sync,n=i.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(i),e)!function(t,e,i,r,n){--e.pendingcb,i?(o.nextTick(n,r),o.nextTick(M,t,e),t._writableState.errorEmitted=!0,t.emit("error",r)):(n(r),t._writableState.errorEmitted=!0,t.emit("error",r),M(t,e))}(t,i,r,e,n);else{var a=C(i);a||i.corked||i.bufferProcessing||!i.bufferedRequest||w(t,i),r?c(b,t,i,a,n):b(t,i,a,n)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function v(t){if(l=l||i(115),!(h.call(v,this)||this instanceof l))return new v(t);this._writableState=new _(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),d.call(this)}function x(t,e,i,r,n,o,a){e.writelen=r,e.writecb=a,e.writing=!0,e.sync=!0,i?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function b(t,e,i,r){i||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),M(t,e)}function w(t,e){e.bufferProcessing=!0;var i=e.bufferedRequest;if(t._writev&&i&&i.next){var r=e.bufferedRequestCount,n=new Array(r),o=e.corkedRequestsFree;o.entry=i;for(var l=0,c=!0;i;)n[l]=i,i.isBuf||(c=!1),i=i.next,l+=1;n.allBuffers=c,x(t,e,!0,e.length,n,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new a(e),e.bufferedRequestCount=0}else{for(;i;){var u=i.chunk,h=i.encoding,p=i.callback;if(x(t,e,!1,e.objectMode?1:u.length,u,h,p),i=i.next,e.bufferedRequestCount--,e.writing)break}null===i&&(e.lastBufferedRequest=null)}e.bufferedRequest=i,e.bufferProcessing=!1}function C(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function S(t,e){t._final((function(i){e.pendingcb--,i&&t.emit("error",i),e.prefinished=!0,t.emit("prefinish"),M(t,e)}))}function M(t,e){var i=C(e);return i&&(function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(S,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),i}u.inherits(v,d),_.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(_.prototype,"buffer",{get:p.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(v,Symbol.hasInstance,{value:function(t){return!!h.call(this,t)||this===v&&t&&t._writableState instanceof _}})):h=function(t){return t instanceof this},v.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},v.prototype.write=function(t,e,i){var r,n=this._writableState,a=!1,l=!n.objectMode&&(r=t,f.isBuffer(r)||r instanceof m);return l&&!f.isBuffer(t)&&(t=function(t){return f.from(t)}(t)),"function"==typeof e&&(i=e,e=null),l?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof i&&(i=y),n.ended?function(t,e){var i=new Error("write after end");t.emit("error",i),o.nextTick(e,i)}(this,i):(l||function(t,e,i,r){var n=!0,a=!1;return null===i?a=new TypeError("May not write null values to stream"):"string"==typeof i||void 0===i||e.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(t.emit("error",a),o.nextTick(r,a),n=!1),n}(this,n,t,i))&&(n.pendingcb++,a=function(t,e,i,r,n,o){if(!i){var a=function(t,e,i){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=f.from(e,i)),e}(e,r,n);r!==a&&(i=!0,n="buffer",r=a)}var l=e.objectMode?1:r.length;e.length+=l;var c=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(v.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),v.prototype._write=function(t,e,i){i(new Error("_write() is not implemented"))},v.prototype._writev=null,v.prototype.end=function(t,e,i){var r=this._writableState;"function"==typeof t?(i=t,t=null,e=null):"function"==typeof e&&(i=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(t,e,i){e.ending=!0,M(t,e),i&&(e.finished?o.nextTick(i):t.once("finish",i)),e.ended=!0,t.writable=!1}(this,r,i)},Object.defineProperty(v.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),v.prototype.destroy=g.destroy,v.prototype._undestroy=g.undestroy,v.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,i(102),i(262).setImmediate,i(93))},function(t,e,i){"use strict";var r=i(403).Buffer,n=r.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===n||!n(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=c,this.end=u,e=4;break;case"utf8":this.fillLast=l,e=4;break;case"base64":this.text=h,this.end=p,e=3;break;default:return this.write=d,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function l(t){var e=this.lastTotal-this.lastNeed,i=function(t,e,i){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==i?i:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function c(t,e){if((t.length-e)%2==0){var i=t.toString("utf16le",e);if(i){var r=i.charCodeAt(i.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],i.slice(0,-1)}return i}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function u(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var i=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,i)}return e}function h(t,e){var i=(t.length-e)%3;return 0===i?t.toString("base64",e):(this.lastNeed=3-i,this.lastTotal=3,1===i?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-i))}function p(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function d(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,i;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i=0?(n>0&&(t.lastNeed=n-1),n):--r=0?(n>0&&(t.lastNeed=n-2),n):--r=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=i;var r=t.length-(i-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,i){"use strict";i.d(e,"a",(function(){return MaskLegend}));var r=i(2),n=i.n(r),o=i(4),a=i(1),l=i(14),c=i(0),u=i(108),h=i(3);class MaskLegend extends o.Component{constructor(...t){super(...t),n()(this,"_isMounted",!1),n()(this,"state",{}),n()(this,"_loadAggLabel",(async()=>{const t=await this.props.esAggField.getLabel();this._isMounted&&t!==this.state.aggLabel&&this.setState({aggLabel:t})}))}componentDidMount(){this._isMounted=!0,this._loadAggLabel()}componentWillUnmount(){this._isMounted=!1}componentDidUpdate(){this._loadAggLabel()}_getBucketsName(){const t=this.props.esAggField.getSource();return"getBucketsName"in t?t.getBucketsName():void 0}_getPrefix(){if(this.props.onlyShowLabelAndValue)return a.i18n.translate("xpack.maps.maskLegend.is",{defaultMessage:"{aggLabel} is",values:{aggLabel:this.state.aggLabel}});const t=this.props.esAggField.getOrigin()===c.D.JOIN;return`${Object(u.f)({bucketsName:this._getBucketsName(),isJoin:t})} ${Object(u.e)({aggLabel:this.state.aggLabel,isJoin:t})}`}render(){return Object(h.jsx)(l.EuiText,{size:"xs",textAlign:"left",color:"subdued"},Object(h.jsx)("small",null,`${this._getPrefix()} `,Object(h.jsx)("strong",null,Object(u.g)(this.props.operator,this.props.value))))}}},function(t,e,i){"use strict";i.d(e,"a",(function(){return o})),i(4);var r=i(14),n=i(3);function o({header:t,minLabel:e,maxLabel:i,propertyLabel:o,fieldLabel:a,invert:l}){return Object(n.jsx)("div",null,Object(n.jsx)(r.EuiFlexGroup,{gutterSize:"xs",justifyContent:"spaceBetween"},Object(n.jsx)(r.EuiFlexItem,{grow:!1},Object(n.jsx)(r.EuiToolTip,{position:"top",title:o,content:a},Object(n.jsx)(r.EuiText,{className:"eui-textTruncate",size:"xs",style:{maxWidth:"180px"}},Object(n.jsx)("small",null,Object(n.jsx)("strong",null,a)))))),t,Object(n.jsx)(r.EuiFlexGroup,{gutterSize:"xs",justifyContent:"spaceBetween"},Object(n.jsx)(r.EuiFlexItem,{grow:!0},Object(n.jsx)(r.EuiText,{size:"xs"},Object(n.jsx)("small",null,l?i:e))),Object(n.jsx)(r.EuiFlexItem,{grow:!0},Object(n.jsx)(r.EuiText,{textAlign:"right",size:"xs"},Object(n.jsx)("small",null,l?e:i)))))}},function(t,e,i){"use strict";i.d(e,"b",(function(){return _})),i.d(e,"a",(function(){return AbstractESSource}));var r=i(2),n=i.n(r),o=i(1),a=i(41),l=i(47),c=i(151),u=i(5),h=i(74),p=i(76),d=i(88),f=i(87),m=i(164),g=i(116),y=i(117);function _(t){return"AbortError"===t.name}class AbstractESSource extends c.a{static createDescriptor(t){if(!Object(g.a)(t.indexPatternId))throw new Error("Cannot create AbstractESSourceDescriptor when indexPatternId is not provided");return{...t,id:Object(g.a)(t.id)?t.id:Object(a.v4)(),type:Object(g.a)(t.type)?t.type:"",indexPatternId:t.indexPatternId,applyGlobalQuery:void 0===t.applyGlobalQuery||t.applyGlobalQuery,applyGlobalTime:void 0===t.applyGlobalTime||t.applyGlobalTime,applyForceRefresh:void 0===t.applyForceRefresh||t.applyForceRefresh}}constructor(t){super(AbstractESSource.createDescriptor(t)),n()(this,"indexPattern",void 0),n()(this,"_descriptor",void 0),n()(this,"getValueSuggestions",(async(t,e)=>{try{const i=await this.getIndexPattern(),r=i.fields.getByName(t.getRootName());return await Object(u.b)().getValueSuggestions({indexPattern:i,field:r,query:e})}catch(i){return console.warn(`Unable to fetch suggestions for field: ${t.getRootName()}, query: ${e}, error: ${i.message}`),[]}})),this._descriptor=t}getId(){return this._descriptor.id}getApplyGlobalQuery(){return this._descriptor.applyGlobalQuery}getApplyGlobalTime(){return this._descriptor.applyGlobalTime}getApplyForceRefresh(){return this._descriptor.applyForceRefresh}isQueryAware(){return!0}getIndexPatternIds(){return[this.getIndexPatternId()]}getQueryableIndexPatternIds(){return this.getApplyGlobalQuery()?[this.getIndexPatternId()]:[]}isESSource(){return!0}cloneDescriptor(){const t=Object(d.b)(this._descriptor);return t.id=Object(a.v4)(),t}async _runEsQuery({registerCancelCallback:t,requestDescription:e,requestId:i,requestName:r,searchSessionId:n,searchSource:a,executionContext:c,requestsAdapter:u}){const h=new AbortController;t((()=>h.abort()));try{const{rawResponse:t}=await Object(l.lastValueFrom)(a.fetch$({abortSignal:h.signal,sessionId:n,legacyHitsTotal:!1,inspector:{adapter:u,id:i,title:r,description:e},executionContext:c}));return t}catch(t){if(_(t))throw new f.b;throw new Error(o.i18n.translate("xpack.maps.source.esSource.requestFailedErrorMessage",{defaultMessage:"Elasticsearch search request failed, error: {message}",values:{message:t.message}}))}}async makeSearchSource(t,e,i){const r=await this.getIndexPattern(),n=[...t.applyGlobalQuery?t.filters:[]];if(t.joinKeyFilter&&n.push(t.joinKeyFilter),this.isFilterByMapBounds()&&"buffer"in t&&t.buffer){const e=await this._getGeoField(),i="isGeoGridPrecisionAware"in this&&"getGeoGridPrecision"in this&&this.isGeoGridPrecisionAware()?Object(m.a)(t.buffer,this.getGeoGridPrecision(t.zoom)):t.buffer,r=Object(p.h)(i,[e.name]);n.push(r)}let o=!1;if("isFeatureEditorOpenForLayer"in t&&(o=t.isFeatureEditorOpenForLayer),t.applyGlobalTime&&await this.isTimeAware()&&!o){const e=t.timeslice?{from:new Date(t.timeslice.from).toISOString(),to:new Date(t.timeslice.to).toISOString(),mode:"absolute"}:t.timeFilters,i=Object(u.P)().createFilter(r,e);i&&n.push(i)}const a=Object(u.I)(),l=await a.searchSource.create(i);l.setField("index",r),l.setField("size",e),l.setField("filter",n),t.applyGlobalQuery&&!o&&l.setField("query",t.query);const c=[];if(t.sourceQuery&&!o){const e=a.searchSource.createEmpty();e.setField("index",r),e.setField("query",t.sourceQuery),c.push(e)}if(t.embeddableSearchContext&&!o){const e=a.searchSource.createEmpty();e.setField("index",r),e.setField("query",t.embeddableSearchContext.query),e.setField("filter",t.embeddableSearchContext.filters),c.push(e)}return 1===c.length?l.setParent(c[0]):2===c.length&&(c[1].setParent(c[0]),l.setParent(c[1])),l}async getBoundsForFilters(t,e){const i=await this.makeSearchSource(t,0);let r;i.setField("trackTotalHits",!1),i.setField("aggs",{fitToBounds:{geo_bounds:{field:this.getGeoFieldName()}}});try{const n=new AbortController;e((()=>n.abort()));const{rawResponse:o}=await Object(l.lastValueFrom)(i.fetch$({abortSignal:n.signal,legacyHitsTotal:!1,executionContext:Object(y.b)({description:"es_source:bounds"},t.executionContext)}));if(!o.aggregations)return null;const a=o.aggregations.fitToBounds;if(!a.bounds)return null;r=a.bounds}catch(t){if("AbortError"===t.name)throw new f.b;return null}const n=r.top_left.lon,o=r.bottom_right.lon;return{minLon:n>o?n-360:n,maxLon:o,minLat:r.bottom_right.lat,maxLat:r.top_left.lat}}async isTimeAware(){try{return!!(await this.getIndexPattern()).timeFieldName}catch(t){return!1}}getIndexPatternId(){return this._descriptor.indexPatternId}getGeoFieldName(){if(!this._descriptor.geoField)throw new Error("Required field 'geoField' not provided in '_descriptor'");return this._descriptor.geoField}async getIndexPattern(){if(this.indexPattern)return this.indexPattern;try{return this.indexPattern=await Object(u.u)().get(this.getIndexPatternId()),this.indexPattern}catch(t){throw new Error(Object(h.c)(this.getIndexPatternId()))}}async supportsFitToBounds(){try{return!!(await this._getGeoField()).aggregatable}catch(t){return!1}}async _getGeoField(){const t=await this.getIndexPattern(),e=t.fields.getByName(this.getGeoFieldName());if(!e)throw new Error(o.i18n.translate("xpack.maps.source.esSource.noGeoFieldErrorMessage",{defaultMessage:'Data view "{indexPatternLabel}" no longer contains the geo field "{geoField}"',values:{indexPatternLabel:t.getName(),geoField:this.getGeoFieldName()}}));return e}async getDisplayName(){try{return(await this.getIndexPattern()).getName()}catch(t){return this.getIndexPatternId()}}isBoundsAware(){return!0}async createFieldFormatter(t){let e;try{e=await this.getIndexPattern()}catch(t){return null}const i=e.fields.getByName(t.getRootName());return i?e.getFormatterForField(i).getConverterFor("text"):null}async loadStylePropsMeta({layerName:t,style:e,dynamicStyleProps:i,registerCancelCallback:r,sourceQuery:n,timeFilters:a,searchSessionId:l,inspectorAdapters:c,executionContext:h}){const p=i.map((t=>t.getFieldMetaRequest())),d=(await Promise.all(p)).reduce(((t,e)=>(e&&Object.assign(t,e),t)),{}),f=await this.getIndexPattern(),m=Object(u.I)().searchSource.createEmpty();if(m.setField("index",f),m.setField("size",0),m.setField("aggs",d),n&&m.setField("query",n),e.isTimeAware()&&await this.isTimeAware()){const t=Object(u.P)().createFilter(f,a);t&&m.setField("filter",[t])}return(await this._runEsQuery({requestId:`${this.getId()}_styleMeta`,requestName:o.i18n.translate("xpack.maps.source.esSource.stylePropsMetaRequestName",{defaultMessage:"{layerName} - metadata",values:{layerName:t}}),searchSource:m,registerCancelCallback:r,requestDescription:o.i18n.translate("xpack.maps.source.esSource.stylePropsMetaRequestDescription",{defaultMessage:"Elasticsearch request retrieving field metadata used for calculating symbolization bands."}),searchSessionId:l,executionContext:Object(y.b)({description:"es_source:style_meta"},h),requestsAdapter:c.requests})).aggregations}}},function(t,e,i){"use strict";function r(t){return"URL_DRILLDOWN"===t.type}function n(t,e){return[{table:{columns:[{id:t,meta:{type:"unknown",field:t},name:t}],rows:[{[t]:e}]},column:0,row:0,value:e}]}i.d(e,"a",(function(){return r})),i.d(e,"b",(function(){return n}))},function(t,e,i){"use strict";i.d(e,"a",(function(){return InlineField}));var r=i(2),n=i.n(r),o=i(146);class InlineField extends o.a{constructor({fieldName:t,label:e,source:i,origin:r,dataType:o}){super({fieldName:t,origin:r}),n()(this,"_label",void 0),n()(this,"_source",void 0),n()(this,"_dataType",void 0),this._label=e,this._source=i,this._dataType=o}supportsFieldMetaFromEs(){return!1}supportsFieldMetaFromLocalData(){return!0}getSource(){return this._source}async getLabel(){return this._label?this._label:this.getName()}async getDataType(){return this._dataType}}},function(t,e,i){"use strict";i.d(e,"a",(function(){return o}));var r=i(39),n=i.n(r);function o(t,e,i,r,o,a){return{...i,fieldNames:n.a.uniq(e).sort(),sourceQuery:r||void 0,applyGlobalQuery:t.getApplyGlobalQuery(),applyGlobalTime:t.getApplyGlobalTime(),sourceMeta:t.getSyncMeta(i),applyForceRefresh:!!t.isESSource()&&t.getApplyForceRefresh(),isForceRefresh:o,isFeatureEditorOpenForLayer:a}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(105),n=i(86);e.default=function(t,e,i){void 0===i&&(i={});var o=r.getCoord(t),a=r.getCoord(e),l=n.degreesToRadians(a[1]-o[1]),c=n.degreesToRadians(a[0]-o[0]),u=n.degreesToRadians(o[1]),h=n.degreesToRadians(a[1]),p=Math.pow(Math.sin(l/2),2)+Math.pow(Math.sin(c/2),2)*Math.cos(u)*Math.cos(h);return n.radiansToLength(2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p)),i.units)}},function(t,e,i){"use strict";i.d(e,"a",(function(){return n}));var r=i(0);function n(t){return t===r.L.COARSE?{minSize:16,maxSize:48}:t===r.L.FINE?{minSize:8,maxSize:24}:t===r.L.MOST_FINE?{minSize:4,maxSize:12}:{minSize:2,maxSize:6}}},,,,,,,,,,,,,function(t,e,i){"use strict";i.d(e,"a",(function(){return feature_geometry_filter_form_FeatureGeometryFilterForm})),i.d(e,"b",(function(){return features_tooltip_FeaturesTooltip}));var r=i(2),n=i.n(r),o=i(4),a=i.n(o),l=i(1),c=i(49),u=i.n(c),h=i(30),p=i(48),d=i(76),f=i(274),m=i(3);class feature_geometry_filter_form_FeatureGeometryFilterForm extends o.Component{constructor(...t){super(...t),n()(this,"_isMounted",!1),n()(this,"state",{isLoading:!1,errorMsg:void 0}),n()(this,"_loadPreIndexedShape",(async()=>{if(!this.props.loadPreIndexedShape)return null;let t;this.setState({isLoading:!0});try{t=await this.props.loadPreIndexedShape()}catch(t){}return this._isMounted&&this.setState({isLoading:!1}),t})),n()(this,"_createFilter",(async({geometryLabel:t,relation:e})=>{this.setState({errorMsg:void 0});const i=await this._loadPreIndexedShape();if(!this._isMounted)return;const r=Object(d.c)({preIndexedShape:i,geometry:this.props.geometry,geometryLabel:t,geoFieldNames:this.props.geoFieldNames,relation:e});window.location.href.length+u.a.encode(r).length+100>h.URL_MAX_LENGTH?this.setState({errorMsg:l.i18n.translate("xpack.maps.tooltip.geometryFilterForm.filterTooLargeMessage",{defaultMessage:"Cannot create filter. Filters are added to the URL, and this shape has too many vertices to fit in the URL."})}):(this.props.addFilters([r],p.ACTION_GLOBAL_APPLY_FILTER),this.props.onClose())}))}componentDidMount(){this._isMounted=!0}componentWillUnmount(){this._isMounted=!1}render(){return Object(m.jsx)(f.a,{buttonLabel:l.i18n.translate("xpack.maps.tooltip.geometryFilterForm.createFilterButtonLabel",{defaultMessage:"Create filter"}),getFilterActions:this.props.getFilterActions,getActionContext:this.props.getActionContext,intitialGeometryLabel:l.i18n.translate("xpack.maps.tooltip.geometryFilterForm.initialGeometryLabel",{defaultMessage:"feature"}),onSubmit:this._createFilter,isLoading:this.state.isLoading,errorMsg:this.state.errorMsg})}}var g=i(14),y=i(39),_=i.n(y),v=i(215);class feature_properties_FeatureProperties extends o.Component{constructor(...t){super(...t),n()(this,"_isMounted",!1),n()(this,"_prevLayerId",""),n()(this,"_prevFeatureId",""),n()(this,"_prevMbProperties",void 0),n()(this,"_tableRef",a.a.createRef()),n()(this,"state",{properties:null,actions:[],loadPropertiesErrorMsg:null,prevWidth:null,prevHeight:null}),n()(this,"_loadProperties",(async()=>{this._fetchProperties({nextFeatureId:this.props.featureId,nextLayerId:this.props.layerId,mbProperties:this.props.mbProperties})})),n()(this,"_showFilterActions",((t,e,i)=>{this.props.showFilterActions(this._renderFilterActions(t,e,i))})),n()(this,"_fetchProperties",(async({nextLayerId:t,nextFeatureId:e,mbProperties:i})=>{if(this._prevLayerId===t&&this._prevFeatureId===e&&_.a.isEqual(this._prevMbProperties,i))return;let r;this._prevLayerId=t,this._prevFeatureId=e,this._prevMbProperties=i,this.setState({properties:null,loadPropertiesErrorMsg:null}),this.state.properties&&this._tableRef.current&&this.setState({prevWidth:this._tableRef.current.clientWidth,prevHeight:this._tableRef.current.clientHeight});try{r=await this.props.loadFeatureProperties({layerId:t,properties:i})}catch(t){return void(this._isMounted&&this.setState({properties:[],loadPropertiesErrorMsg:t.message}))}this._prevLayerId!==t&&this._prevFeatureId!==e||this._isMounted&&this.setState({properties:r})}))}componentDidMount(){this._isMounted=!0,this._loadProperties(),this._loadActions()}componentDidUpdate(){this._loadProperties()}componentWillUnmount(){this._isMounted=!1}async _loadActions(){if(!this.props.getFilterActions)return;const t=await this.props.getFilterActions();this._isMounted&&this.setState({actions:t})}_renderFilterActions(t,e,i){const r={id:0,items:this.state.actions.filter((t=>!Object(v.a)(t)||!!this.props.onSingleValueTrigger)).map((r=>{const n=e(),o=r.getIconType(n),a=r.getDisplayName(n);return{name:a||r.id,icon:o?Object(m.jsx)(g.EuiIcon,{type:o}):void 0,onClick:async()=>{if(this.props.onCloseTooltip(),Object(v.a)(r))this.props.onSingleValueTrigger(r.id,t.getPropertyKey(),t.getRawValue());else{const e=await t.getESFilters();i(e,r.id)}},"data-test-subj":`mapFilterActionButton__${a}`}}))};return Object(m.jsx)("div",null,Object(m.jsx)("table",{className:"eui-yScrollWithShadows mapFeatureTooltip_table",ref:this._tableRef},Object(m.jsx)("tbody",null,Object(m.jsx)("tr",null,Object(m.jsx)("td",{className:"eui-textBreakWord mapFeatureTooltip__propertyLabel"},t.getPropertyName()),Object(m.jsx)("td",{className:"eui-textBreakWord"},t.getHtmlDisplayValue())))),Object(m.jsx)(g.EuiContextMenu,{initialPanelId:0,panels:[r]}))}_renderFilterCell(t){if(!this.props.showFilterButtons||!t.isFilterable()||void 0===this.props.addFilters)return Object(m.jsx)("td",null);const e=Object(m.jsx)(g.EuiButtonEmpty,{size:"xs",title:l.i18n.translate("xpack.maps.tooltip.filterOnPropertyTitle",{defaultMessage:"Filter on property"}),onClick:async()=>{this.props.onCloseTooltip();const e=await t.getESFilters();this.props.addFilters(e,p.ACTION_GLOBAL_APPLY_FILTER)},"aria-label":l.i18n.translate("xpack.maps.tooltip.filterOnPropertyAriaLabel",{defaultMessage:"Filter on property"}),"data-test-subj":"mapTooltipCreateFilterButton"},Object(m.jsx)(g.EuiIcon,{type:"filter"}));return void 0===this.props.getActionContext||0===this.state.actions.length||1===this.state.actions.length&&this.state.actions[0].id===p.ACTION_GLOBAL_APPLY_FILTER?Object(m.jsx)("td",null,e):Object(m.jsx)("td",{className:"mapFeatureTooltip_actionsRow"},Object(m.jsx)("span",null,e,Object(m.jsx)(g.EuiButtonEmpty,{size:"xs",title:l.i18n.translate("xpack.maps.tooltip.viewActionsTitle",{defaultMessage:"View filter actions"}),onClick:()=>{this._showFilterActions(t,this.props.getActionContext,this.props.addFilters)},"aria-label":l.i18n.translate("xpack.maps.tooltip.viewActionsTitle",{defaultMessage:"View filter actions"}),"data-test-subj":"mapTooltipMoreActionsButton"},Object(m.jsx)(g.EuiIcon,{type:"arrowRight"}))))}render(){if(this.state.loadPropertiesErrorMsg)return Object(m.jsx)(g.EuiCallOut,{title:l.i18n.translate("xpack.maps.tooltip.unableToLoadContentTitle",{defaultMessage:"Unable to load tooltip content"}),color:"danger",iconType:"warning",size:"s"},Object(m.jsx)("p",null,this.state.loadPropertiesErrorMsg));if(!this.state.properties){const t=l.i18n.translate("xpack.maps.tooltip.loadingMsg",{defaultMessage:"Loading"}),e={};return this.state.prevWidth&&this.state.prevHeight&&(e.width=this.state.prevWidth,e.height=this.state.prevHeight),Object(m.jsx)(g.EuiTextAlign,{textAlign:"center",style:e},Object(m.jsx)(g.EuiLoadingSpinner,{size:"m"}),t)}const t=this.state.properties.map((t=>Object(m.jsx)("tr",{key:t.getPropertyKey(),className:"mapFeatureTooltip_row"},Object(m.jsx)("td",{className:"eui-textBreakWord mapFeatureTooltip__propertyLabel"},t.getPropertyName()),Object(m.jsx)("td",{className:"eui-textBreakWord"},t.getHtmlDisplayValue()),this._renderFilterCell(t))));return Object(m.jsx)("div",{className:"mapFeatureTooltip_tableWrapper"},Object(m.jsx)("table",{className:"eui-yScrollWithShadows mapFeatureTooltip_table",ref:this._tableRef},Object(m.jsx)("tbody",null,t)))}}var x=i(40);const b="_ALL_LAYERS_";class footer_Footer extends o.Component{constructor(...t){super(...t),n()(this,"_isMounted",!1),n()(this,"_prevFeatures",null),n()(this,"state",{filteredFeatures:this.props.features,pageNumber:0,selectedLayerId:b,layerOptions:[]}),n()(this,"_loadUniqueLayers",(async()=>{if(this._prevFeatures===this.props.features)return;this._prevFeatures=this.props.features;const t=new Map;for(let e=0;e{const r=this.props.findLayerById(i);r&&e.push(r)}));const i=e.map((t=>t.getDisplayName())),r=await Promise.all(i);this._isMounted&&this.setState({filteredFeatures:this.props.features,selectedLayerId:b,layerOptions:e.map(((e,i)=>{const n=r[i],o=t.get(e.getId());return{value:e.getId(),text:`(${o}) ${n}`}}))},(()=>this._onPageChange(0)))})),n()(this,"_onPageChange",(t=>{this.setState({pageNumber:t}),this.props.setCurrentFeature(this.state.filteredFeatures[t])})),n()(this,"_onLayerChange",(t=>{const e=t.target.value;if(this.state.selectedLayerId===e)return;const i=e===b?this.props.features:this.props.features.filter((t=>t.layerId===e));this.setState({filteredFeatures:i,selectedLayerId:e},(()=>this._onPageChange(0)))}))}componentDidMount(){this._isMounted=!0,this._loadUniqueLayers()}componentDidUpdate(){this._loadUniqueLayers()}componentWillUnmount(){this._isMounted=!1}render(){const{isLocked:t}=this.props,{filteredFeatures:e,pageNumber:i,selectedLayerId:r,layerOptions:n}=this.state,a=t&&n.length>1,c=[];return t&&e.length>1&&c.push(Object(m.jsx)(g.EuiFlexItem,{grow:!1,key:"pagination"},Object(m.jsx)(g.EuiPagination,{pageCount:e.length,activePage:i,onPageClick:this._onPageChange,compressed:!0}))),!t&&e.length>1&&c.push(Object(m.jsx)(g.EuiFlexItem,{grow:!a,key:"pageNumber"},Object(m.jsx)(g.EuiTextColor,{color:"subdued"},Object(m.jsx)(x.FormattedMessage,{id:"xpack.maps.tooltip.pageNumerText",defaultMessage:"{pageNumber} of {total}",values:{pageNumber:i+1,total:e.length}})))),a&&c.push(Object(m.jsx)(g.EuiFlexItem,{key:"layerSelect"},Object(m.jsx)(g.EuiFormRow,{display:"rowCompressed"},Object(m.jsx)(g.EuiSelect,{options:[{value:b,text:l.i18n.translate("xpack.maps.tooltip.allLayersLabel",{defaultMessage:"All layers"})},...n],onChange:this._onLayerChange,value:r,compressed:!0,fullWidth:!0,"aria-label":l.i18n.translate("xpack.maps.tooltip.layerFilterLabel",{defaultMessage:"Filter results by layer"})})))),c.length?Object(m.jsx)(o.Fragment,null,Object(m.jsx)(g.EuiHorizontalRule,{margin:"xs"}),Object(m.jsx)(g.EuiFlexGroup,{alignItems:"center",gutterSize:"s"},c)):null}}class header_Header extends o.Component{constructor(...t){super(...t),n()(this,"_isMounted",!1),n()(this,"state",{layerIcon:null,layerName:null})}componentDidMount(){this._isMounted=!0,this._loadLayerState()}componentWillUnmount(){this._isMounted=!1}async _loadLayerState(){const t=this.props.findLayerById(this.props.layerId);if(!t)return;const e=await t.getDisplayName(),{icon:i}=t.getLayerIcon(!1);this._isMounted&&this.setState({layerIcon:i,layerName:e})}render(){const t=[];return this.state.layerIcon&&t.push(Object(m.jsx)(g.EuiFlexItem,{grow:!1,key:"layerIcon",className:"mapFeatureTooltip_layerIcon"},this.state.layerIcon)),this.state.layerName&&t.push(Object(m.jsx)(g.EuiFlexItem,{grow:!0,key:"layerName",className:"eui-textTruncate"},Object(m.jsx)(g.EuiTextColor,null,Object(m.jsx)("h4",{className:"eui-textTruncate",title:this.state.layerName},this.state.layerName)))),this.props.isLocked&&(0===t.length&&t.push(Object(m.jsx)(g.EuiFlexItem,{key:"spacer"})),t.push(Object(m.jsx)(g.EuiFlexItem,{grow:!1,key:"closeButton"},Object(m.jsx)(g.EuiButtonIcon,{onClick:this.props.onClose,iconType:"cross","aria-label":l.i18n.translate("xpack.maps.tooltip.closeAriaLabel",{defaultMessage:"Close tooltip"}),"data-test-subj":"mapTooltipCloseButton"})))),t.length?Object(m.jsx)(o.Fragment,null,Object(m.jsx)(g.EuiFlexGroup,{alignItems:"center",gutterSize:"s"},t),Object(m.jsx)(g.EuiHorizontalRule,{margin:"xs"})):null}}const w="PROPERTIES_VIEW",C="FILTER_ACTIONS_VIEW";class features_tooltip_FeaturesTooltip extends o.Component{constructor(...t){super(...t),n()(this,"state",{currentFeature:null,filterView:null,prevFeatures:[],view:w}),n()(this,"_setCurrentFeature",(t=>{this.setState({currentFeature:t})})),n()(this,"_showPropertiesView",(()=>{this.setState({view:w,filterView:null})})),n()(this,"_showFilterActionsView",(t=>{this.setState({view:C,filterView:t})}))}static getDerivedStateFromProps(t,e){if(t.features!==e.prevFeatures){let i=t.features?t.features[0]:null;if(e.currentFeature){const r=t.features.find((t=>t.id===e.currentFeature.id&&t.layerId===e.currentFeature.layerId));r&&(i=r)}return{currentFeature:i,view:w,prevFeatures:t.features}}return null}_renderActions(){return this.props.isLocked&&this.state.currentFeature&&0!==this.state.currentFeature.actions.length?this.state.currentFeature.actions.map((t=>Object(m.jsx)(g.EuiLink,{className:"mapFeatureTooltip_actionLinks",onClick:()=>{t.onClick?t.onClick():t.form&&this.setState({view:t.id})},key:t.id},t.label))):null}_renderBackButton(t){return Object(m.jsx)("button",{className:"euiContextMenuPanelTitle mapFeatureTooltip_backButton",type:"button",onClick:this._showPropertiesView},Object(m.jsx)("span",{className:"euiContextMenu__itemLayout"},Object(m.jsx)(g.EuiIcon,{type:"arrowLeft",size:"m",className:"euiContextMenu__icon"}),Object(m.jsx)("span",{className:"euiContextMenu__text"},t)))}render(){if(!this.state.currentFeature)return null;const t=this.state.currentFeature.actions.find((({id:t})=>t===this.state.view));return t&&t.form?Object(m.jsx)(o.Fragment,null,this._renderBackButton(t.label),t.form):this.state.view===C?Object(m.jsx)(o.Fragment,null,this._renderBackButton(l.i18n.translate("xpack.maps.tooltip.showAddFilterActionsViewLabel",{defaultMessage:"Filter actions"})),this.state.filterView):Object(m.jsx)(o.Fragment,null,Object(m.jsx)(header_Header,{key:this.state.currentFeature.layerId,layerId:this.state.currentFeature.layerId,findLayerById:this.props.findLayerById,isLocked:this.props.isLocked,onClose:this.props.closeTooltip}),Object(m.jsx)(feature_properties_FeatureProperties,{featureId:this.state.currentFeature.id,layerId:this.state.currentFeature.layerId,mbProperties:this.state.currentFeature.mbProperties,loadFeatureProperties:this.props.loadFeatureProperties,showFilterButtons:!!this.props.addFilters&&this.props.isLocked,onCloseTooltip:this.props.closeTooltip,addFilters:this.props.addFilters,getFilterActions:this.props.getFilterActions,getActionContext:this.props.getActionContext,onSingleValueTrigger:this.props.onSingleValueTrigger,showFilterActions:this._showFilterActionsView}),this._renderActions(),Object(m.jsx)(footer_Footer,{features:this.props.features,isLocked:this.props.isLocked,findLayerById:this.props.findLayerById,setCurrentFeature:this._setCurrentFeature}))}}},function(t,e,i){"use strict";i.d(e,"a",(function(){return m})),i(4);var r=i(14),n=i(1),o=i(0),a=i(5),l=i(19);const c=n.i18n.translate("xpack.maps.source.esGeoGrid.pointsDropdownOption",{defaultMessage:"Clusters"}),u=n.i18n.translate("xpack.maps.source.esGeoGrid.gridRectangleDropdownOption",{defaultMessage:"Grids"}),h=n.i18n.translate("xpack.maps.source.esGeoGrid.hexDropdownOption",{defaultMessage:"Hexagons"});var p=i(40),d=i(3);function f(t){return Object(d.jsx)(r.EuiToolTip,{content:Object(d.jsx)(r.EuiText,{size:"s"},Object(d.jsx)("dl",null,Object(d.jsx)("dt",null,c),Object(d.jsx)("dd",null,Object(d.jsx)("p",null,Object(d.jsx)(p.FormattedMessage,{id:"xpack.maps.source.esGeoGrid.clusterDescription",defaultMessage:"Group documents into grids with a weighted center for each grid cell."}))),Object(d.jsx)("dt",null,u),Object(d.jsx)("dd",null,Object(d.jsx)("p",null,Object(d.jsx)(p.FormattedMessage,{id:"xpack.maps.source.esGeoGrid.gridDescription",defaultMessage:"Group documents into grids."}))),Object(d.jsx)("dt",null,h),Object(d.jsx)("dd",null,Object(d.jsx)("p",null,Object(d.jsx)(p.FormattedMessage,{id:"xpack.maps.source.esGeoGrid.hexDescription",defaultMessage:"Group documents into hexagons."})),t.isHexDisabled?Object(d.jsx)("em",null,t.hexDisabledReason):null)))},Object(d.jsx)("span",null,Object(d.jsx)(p.FormattedMessage,{id:"xpack.maps.source.esGeoGrid.showAsLabel",defaultMessage:"Show as"})," ",Object(d.jsx)(r.EuiIcon,{type:"questionInCircle",color:"subdued"})))}function m(t){if(t.renderAs===o.tb.HEATMAP)return null;let e=!1,i="";Object(a.x)()||Object(l.b)()||(e=!0,i=n.i18n.translate("xpack.maps.hexbin.license.disabledReason",{defaultMessage:"{hexLabel} is a subscription feature.",values:{hexLabel:h}}));const p=[{id:o.tb.POINT,label:c,value:o.tb.POINT},{id:o.tb.GRID,label:u,value:o.tb.GRID},{id:o.tb.HEX,label:h,value:o.tb.HEX,isDisabled:e}],m=p.find((e=>e.value===t.renderAs))||p[0],g=Object(d.jsx)(f,{isHexDisabled:e,hexDisabledReason:i});return Object(d.jsx)(r.EuiFormRow,{label:g,display:t.isColumnCompressed?"columnCompressed":"row"},Object(d.jsx)(r.EuiButtonGroup,{type:"single",legend:n.i18n.translate("xpack.maps.source.esGeoGrid.showAsSelector",{defaultMessage:"Choose the display method"}),options:p,idSelected:m.id,onChange:function(e){const i=p.find((t=>t.id===e));i&&t.onChange(i.value)},isFullWidth:!0,buttonSize:"compressed"}))}},,,,,,,,,,,,function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(86);e.default=function(t,e){void 0===e&&(e={});var i=Number(t[0]),n=Number(t[1]),o=Number(t[2]),a=Number(t[3]);if(6===t.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var l=[i,n],c=[i,a],u=[o,a],h=[o,n];return r.polygon([[l,h,u,c,l]],e.properties,{bbox:t,id:e.id})}},function(t,e,i){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var n=r(i(153)),o=r(i(340)),a=r(i(341)),l=i(105);function c(t,e){var i,r=!1;for(i=0;ie[0]||t[2]e[1]||t[3]":"attribute: {"+t+"}, parent: <"+this.parent.name+">"},t.prototype.isEqualNode=function(t){return t.namespaceURI===this.namespaceURI&&t.prefix===this.prefix&&t.localName===this.localName&&t.value===this.value},t}()}).call(this)},function(t,e,i){(function(){var e,r,n={}.hasOwnProperty;r=i(89),e=i(78),t.exports=function(t){function i(t){i.__super__.constructor.call(this,t),this.type=e.Dummy}return function(t,e){for(var i in e)n.call(e,i)&&(t[i]=e[i]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(i,t),i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(t){return""},i}(r)}).call(this)},function(t,e){(function(){var e=function(t,e){return function(){return t.apply(e,arguments)}},i={}.hasOwnProperty;t.exports=function(){function t(t){var r,n,o;for(r in this.assertLegalName=e(this.assertLegalName,this),this.assertLegalChar=e(this.assertLegalChar,this),t||(t={}),this.options=t,this.options.version||(this.options.version="1.0"),n=t.stringify||{})i.call(n,r)&&(o=n[r],this[r]=o)}return t.prototype.name=function(t){return this.options.noValidation?t:this.assertLegalName(""+t||"")},t.prototype.text=function(t){return this.options.noValidation?t:this.assertLegalChar(this.textEscape(""+t||""))},t.prototype.cdata=function(t){return this.options.noValidation?t:(t=(t=""+t||"").replace("]]>","]]]]>"),this.assertLegalChar(t))},t.prototype.comment=function(t){if(this.options.noValidation)return t;if((t=""+t||"").match(/--/))throw new Error("Comment text cannot contain double-hypen: "+t);return this.assertLegalChar(t)},t.prototype.raw=function(t){return this.options.noValidation?t:""+t||""},t.prototype.attValue=function(t){return this.options.noValidation?t:this.assertLegalChar(this.attEscape(t=""+t||""))},t.prototype.insTarget=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},t.prototype.insValue=function(t){if(this.options.noValidation)return t;if((t=""+t||"").match(/\?>/))throw new Error("Invalid processing instruction value: "+t);return this.assertLegalChar(t)},t.prototype.xmlVersion=function(t){if(this.options.noValidation)return t;if(!(t=""+t||"").match(/1\.[0-9]+/))throw new Error("Invalid version number: "+t);return t},t.prototype.xmlEncoding=function(t){if(this.options.noValidation)return t;if(!(t=""+t||"").match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+t);return this.assertLegalChar(t)},t.prototype.xmlStandalone=function(t){return this.options.noValidation?t:t?"yes":"no"},t.prototype.dtdPubID=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},t.prototype.dtdSysID=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},t.prototype.dtdElementValue=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},t.prototype.dtdAttType=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},t.prototype.dtdAttDefault=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},t.prototype.dtdEntityValue=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},t.prototype.dtdNData=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},t.prototype.convertAttKey="@",t.prototype.convertPIKey="?",t.prototype.convertTextKey="#text",t.prototype.convertCDataKey="#cdata",t.prototype.convertCommentKey="#comment",t.prototype.convertRawKey="#raw",t.prototype.assertLegalChar=function(t){var e,i;if(this.options.noValidation)return t;if(e="","1.0"===this.options.version){if(e=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,i=t.match(e))throw new Error("Invalid character in string: "+t+" at index "+i.index)}else if("1.1"===this.options.version&&(e=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,i=t.match(e)))throw new Error("Invalid character in string: "+t+" at index "+i.index);return t},t.prototype.assertLegalName=function(t){var e;if(this.options.noValidation)return t;if(this.assertLegalChar(t),e=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!t.match(e))throw new Error("Invalid character in name");return t},t.prototype.textEscape=function(t){var e;return this.options.noValidation?t:(e=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,t.replace(e,"&").replace(//g,">").replace(/\r/g," "))},t.prototype.attEscape=function(t){var e;return this.options.noValidation?t:(e=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,t.replace(e,"&").replace(/0?new Array(r).join(e.indent):""},t.prototype.endline=function(t,e,i){return!e.pretty||e.suppressPrettyCount?"":e.newline},t.prototype.attribute=function(t,e,i){var r;return this.openAttribute(t,e,i),r=" "+t.name+'="'+t.value+'"',this.closeAttribute(t,e,i),r},t.prototype.cdata=function(t,e,i){var n;return this.openNode(t,e,i),e.state=r.OpenTag,n=this.indent(t,e,i)+""+this.endline(t,e,i),e.state=r.None,this.closeNode(t,e,i),n},t.prototype.comment=function(t,e,i){var n;return this.openNode(t,e,i),e.state=r.OpenTag,n=this.indent(t,e,i)+"\x3c!-- ",e.state=r.InsideTag,n+=t.value,e.state=r.CloseTag,n+=" --\x3e"+this.endline(t,e,i),e.state=r.None,this.closeNode(t,e,i),n},t.prototype.declaration=function(t,e,i){var n;return this.openNode(t,e,i),e.state=r.OpenTag,n=this.indent(t,e,i)+"",n+=this.endline(t,e,i),e.state=r.None,this.closeNode(t,e,i),n},t.prototype.docType=function(t,e,i){var n,o,a,l,c;if(i||(i=0),this.openNode(t,e,i),e.state=r.OpenTag,l=this.indent(t,e,i),l+="0){for(l+=" [",l+=this.endline(t,e,i),e.state=r.InsideTag,o=0,a=(c=t.children).length;o",l+=this.endline(t,e,i),e.state=r.None,this.closeNode(t,e,i),l},t.prototype.element=function(t,i,n){var a,l,c,u,h,p,d,f,m,g,y,_,v,x;for(m in n||(n=0),g=!1,y="",this.openNode(t,i,n),i.state=r.OpenTag,y+=this.indent(t,i,n)+"<"+t.name,_=t.attribs)o.call(_,m)&&(a=_[m],y+=this.attribute(a,i,n));if(u=0===(c=t.children.length)?null:t.children[0],0===c||t.children.every((function(t){return(t.type===e.Text||t.type===e.Raw)&&""===t.value})))i.allowEmpty?(y+=">",i.state=r.CloseTag,y+=""+this.endline(t,i,n)):(i.state=r.CloseTag,y+=i.spaceBeforeSlash+"/>"+this.endline(t,i,n));else if(!i.pretty||1!==c||u.type!==e.Text&&u.type!==e.Raw||null==u.value){if(i.dontPrettyTextNodes)for(h=0,d=(v=t.children).length;h"+this.endline(t,i,n),i.state=r.InsideTag,p=0,f=(x=t.children).length;p",g&&i.suppressPrettyCount--,y+=this.endline(t,i,n),i.state=r.None}else y+=">",i.state=r.InsideTag,i.suppressPrettyCount++,g=!0,y+=this.writeChildNode(u,i,n+1),i.suppressPrettyCount--,g=!1,i.state=r.CloseTag,y+=""+this.endline(t,i,n);return this.closeNode(t,i,n),y},t.prototype.writeChildNode=function(t,i,r){switch(t.type){case e.CData:return this.cdata(t,i,r);case e.Comment:return this.comment(t,i,r);case e.Element:return this.element(t,i,r);case e.Raw:return this.raw(t,i,r);case e.Text:return this.text(t,i,r);case e.ProcessingInstruction:return this.processingInstruction(t,i,r);case e.Dummy:return"";case e.Declaration:return this.declaration(t,i,r);case e.DocType:return this.docType(t,i,r);case e.AttributeDeclaration:return this.dtdAttList(t,i,r);case e.ElementDeclaration:return this.dtdElement(t,i,r);case e.EntityDeclaration:return this.dtdEntity(t,i,r);case e.NotationDeclaration:return this.dtdNotation(t,i,r);default:throw new Error("Unknown XML node type: "+t.constructor.name)}},t.prototype.processingInstruction=function(t,e,i){var n;return this.openNode(t,e,i),e.state=r.OpenTag,n=this.indent(t,e,i)+"",n+=this.endline(t,e,i),e.state=r.None,this.closeNode(t,e,i),n},t.prototype.raw=function(t,e,i){var n;return this.openNode(t,e,i),e.state=r.OpenTag,n=this.indent(t,e,i),e.state=r.InsideTag,n+=t.value,e.state=r.CloseTag,n+=this.endline(t,e,i),e.state=r.None,this.closeNode(t,e,i),n},t.prototype.text=function(t,e,i){var n;return this.openNode(t,e,i),e.state=r.OpenTag,n=this.indent(t,e,i),e.state=r.InsideTag,n+=t.value,e.state=r.CloseTag,n+=this.endline(t,e,i),e.state=r.None,this.closeNode(t,e,i),n},t.prototype.dtdAttList=function(t,e,i){var n;return this.openNode(t,e,i),e.state=r.OpenTag,n=this.indent(t,e,i)+""+this.endline(t,e,i),e.state=r.None,this.closeNode(t,e,i),n},t.prototype.dtdElement=function(t,e,i){var n;return this.openNode(t,e,i),e.state=r.OpenTag,n=this.indent(t,e,i)+""+this.endline(t,e,i),e.state=r.None,this.closeNode(t,e,i),n},t.prototype.dtdEntity=function(t,e,i){var n;return this.openNode(t,e,i),e.state=r.OpenTag,n=this.indent(t,e,i)+""+this.endline(t,e,i),e.state=r.None,this.closeNode(t,e,i),n},t.prototype.dtdNotation=function(t,e,i){var n;return this.openNode(t,e,i),e.state=r.OpenTag,n=this.indent(t,e,i)+""+this.endline(t,e,i),e.state=r.None,this.closeNode(t,e,i),n},t.prototype.openNode=function(t,e,i){},t.prototype.closeNode=function(t,e,i){},t.prototype.openAttribute=function(t,e,i){},t.prototype.closeAttribute=function(t,e,i){},t}()}).call(this)},function(t,e,i){"use strict";(function(e,r){var n=i(162);t.exports=x;var o,a=i(397);x.ReadableState=v,i(125).EventEmitter;var l=function(t,e){return t.listeners(e).length},c=i(260),u=i(209).Buffer,h=e.Uint8Array||function(){},p=Object.create(i(145));p.inherits=i(128);var d=i(398),f=void 0;f=d&&d.debuglog?d.debuglog("stream"):function(){};var m,g=i(399),y=i(261);p.inherits(x,c);var _=["error","close","destroy","pause","resume"];function v(t,e){t=t||{};var r=e instanceof(o=o||i(115));this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,a=t.readableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r&&(a||0===a)?a:l,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(m||(m=i(211).StringDecoder),this.decoder=new m(t.encoding),this.encoding=t.encoding)}function x(t){if(o=o||i(115),!(this instanceof x))return new x(t);this._readableState=new v(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),c.call(this)}function b(t,e,i,r,n){var o,a=t._readableState;return null===e?(a.reading=!1,function(t,e){if(!e.ended){if(e.decoder){var i=e.decoder.end();i&&i.length&&(e.buffer.push(i),e.length+=e.objectMode?1:i.length)}e.ended=!0,M(t)}}(t,a)):(n||(o=function(t,e){var i,r;return r=e,u.isBuffer(r)||r instanceof h||"string"==typeof e||void 0===e||t.objectMode||(i=new TypeError("Invalid non-string/buffer chunk")),i}(a,e)),o?t.emit("error",o):a.objectMode||e&&e.length>0?("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),r?a.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):w(t,a,e,!0):a.ended?t.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!i?(e=a.decoder.write(e),a.objectMode||0!==e.length?w(t,a,e,!1):E(t,a)):w(t,a,e,!1))):r||(a.reading=!1)),function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=C?t=C:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function M(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(f("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?n.nextTick(T,t):T(t))}function T(t){f("emit readable"),t.emit("readable"),O(t)}function E(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(A,t,e))}function A(t,e){for(var i=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(i=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):i=function(t,e,i){var r;return to.length?o.length:t;if(a===o.length?n+=o:n+=o.slice(0,t),0==(t-=a)){a===o.length?(++r,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=o.slice(a));break}++r}return e.length-=r,n}(t,e):function(t,e){var i=u.allocUnsafe(t),r=e.head,n=1;for(r.data.copy(i),t-=r.data.length;r=r.next;){var o=r.data,a=t>o.length?o.length:t;if(o.copy(i,i.length-t,0,a),0==(t-=a)){a===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(a));break}++n}return e.length-=n,i}(t,e),r}(t,e.buffer,e.decoder),i);var i}function F(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,n.nextTick(D,e,t))}function D(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function z(t,e){for(var i=0,r=t.length;i=e.highWaterMark||e.ended))return f("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?F(this):M(this),null;if(0===(t=S(t,e))&&e.ended)return 0===e.length&&F(this),null;var r,n=e.needReadable;return f("need readable",n),(0===e.length||e.length-t0?k(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),i!==t&&e.ended&&F(this)),null!==r&&this.emit("data",r),r},x.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},x.prototype.pipe=function(t,e){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,f("pipe count=%d opts=%j",o.pipesCount,e);var c=e&&!1===e.end||t===r.stdout||t===r.stderr?v:u;function u(){f("onend"),t.end()}o.endEmitted?n.nextTick(c):i.once("end",c),t.on("unpipe",(function e(r,n){f("onunpipe"),r===i&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,f("cleanup"),t.removeListener("close",y),t.removeListener("finish",_),t.removeListener("drain",h),t.removeListener("error",g),t.removeListener("unpipe",e),i.removeListener("end",u),i.removeListener("end",v),i.removeListener("data",m),p=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}));var h=function(t){return function(){var e=t._readableState;f("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&l(t,"data")&&(e.flowing=!0,O(t))}}(i);t.on("drain",h);var p=!1,d=!1;function m(e){f("ondata"),d=!1,!1!==t.write(e)||d||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==z(o.pipes,t))&&!p&&(f("false write response, pause",i._readableState.awaitDrain),i._readableState.awaitDrain++,d=!0),i.pause())}function g(e){f("onerror",e),v(),t.removeListener("error",g),0===l(t,"error")&&t.emit("error",e)}function y(){t.removeListener("finish",_),v()}function _(){f("onfinish"),t.removeListener("close",y),v()}function v(){f("unpipe"),i.unpipe(t)}return i.on("data",m),function(t,e,i){if("function"==typeof t.prependListener)return t.prependListener(e,i);t._events&&t._events[e]?a(t._events[e])?t._events[e].unshift(i):t._events[e]=[i,t._events[e]]:t.on(e,i)}(t,"error",g),t.once("close",y),t.once("finish",_),t.emit("pipe",i),o.flowing||(f("pipe resume"),i.resume()),t},x.prototype.unpipe=function(t){var e=this._readableState,i={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,i)),this;if(!t){var r=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},i(401),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,i(93))},function(t,e,i){"use strict";t.exports=a;var r=i(115),n=Object.create(i(145));function o(t,e){var i=this._transformState;i.transforming=!1;var r=i.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));i.writechunk=null,i.writecb=null,null!=e&&this.push(e),r(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length{Object(r.parseString)(t,((t,r)=>{t?i(t):e(r)}))}));return await e}},function(t,e,i){"use strict";i.d(e,"a",(function(){return r}));const r={aerialway:{label:"Aerialway",svg:'\n\n \n'},airfield:{label:"Airfield",svg:'\n\n \n'},airport:{label:"Airport",svg:'\n\n \n'},"alcohol-shop":{label:"Alcohol shop",svg:'\n\n \n'},"american-football":{label:"American football",svg:'\n\n \n'},"amusement-park":{label:"Amusement park",svg:'\n\n \n'},aquarium:{label:"Aquarium",svg:'\n\n \n'},"arrow-es":{label:"Arrow",svg:'\n\n \n'},"art-gallery":{label:"Art gallery",svg:'\n\n \n'},attraction:{label:"Attraction",svg:'\n\n \n'},bakery:{label:"Bakery",svg:'\n\n \n \n'},bank:{label:"Bank",svg:'\n\n \n'},bar:{label:"Bar",svg:'\n\n \n'},barrier:{label:"Barrier",svg:'\n\n \n'},baseball:{label:"Baseball",svg:'\n\n \n'},basketball:{label:"Basketball",svg:'\n\n \n'},bbq:{label:"BBQ",svg:'\n\n \n'},beach:{label:"Beach",svg:'\n\n \n'},beer:{label:"Beer",svg:'\n\n \n'},bicycle:{label:"Bicycle",svg:'\n\n \n'},"bicycle-share":{label:"Bicycle share",svg:'\n\n \n'},"blood-bank":{label:"Blood bank",svg:'\n\n \n'},"boat-es":{label:"Boat",svg:'\n\n \n'},"bowling-alley":{label:"Bowling alley",svg:'\n\n \n'},bridge:{label:"Bridge",svg:'\n\n \n'},building:{label:"Building",svg:'\n\n \n'},"building-alt1":{label:"Building 2",svg:'\n\n \n'},bus:{label:"Bus",svg:'\n\n \n'},cafe:{label:"Cafe",svg:'\n\n \n'},campsite:{label:"Campsite",svg:'\n\n \n'},car:{label:"Car",svg:'\n\n \n'},"car-top-es":{label:"Car 2",svg:'\n\n \n'},"car-rental":{label:"Car rental",svg:'\n\n \n \n \n \n'},"car-repair":{label:"Car repair",svg:'\n\n \n \n \n \n'},casino:{label:"Casino",svg:'\n\n \n'},castle:{label:"Castle",svg:'\n\n \n'},cemetery:{label:"Cemetery",svg:'\n\n \n'},"charging-station":{label:"Charging station",svg:'\n\n \n'},cinema:{label:"Cinema",svg:'\n\n \n'},circle:{label:"Circle",svg:'\n\n \n'},"circle-stroked":{label:"Circle stroked",svg:'\n\n \n'},city:{label:"City",svg:'\n\n \n'},"clothing-store":{label:"Clothing store",svg:'\n\n \n'},college:{label:"College",svg:'\n\n \n'},commercial:{label:"Commercial",svg:'\n\n \n'},"communications-tower":{label:"Communications tower",svg:'\n\n \n \n \n'},confectionery:{label:"Confectionery",svg:'\n\n \n \n \n'},convenience:{label:"Convenience",svg:'\n\n \n \n \n'},cricket:{label:"Cricket",svg:'\n\n \n'},cross:{label:"Cross",svg:'\n\n \n'},dam:{label:"Dam",svg:'\n\n \n'},danger:{label:"Danger",svg:'\n\n \n'},defibrillator:{label:"Defibrillator",svg:'\n\n \n'},dentist:{label:"Dentist",svg:'\n\n \n'},doctor:{label:"Doctor",svg:'\n\n \n'},"dog-park":{label:"Dog park",svg:'\n\n \n \n \n'},"drinking-water":{label:"Drinking water",svg:'\n\n \n \n'},embassy:{label:"Embassy",svg:'\n\n \n'},"emergency-phone":{label:"Emergency phone",svg:'\n\n \n'},entrance:{label:"Entrance",svg:'\n\n \n \n'},"entrance-alt1":{label:"Entrance 2",svg:'\n\n \n'},farm:{label:"Farm",svg:'\n\n \n'},"fast-food":{label:"Fast food",svg:'\n\n \n'},fence:{label:"Fence",svg:'\n\n \n'},ferry:{label:"Ferry",svg:'\n\n \n'},"fire-station":{label:"Fire station",svg:'\n\n \n'},"fitness-centre":{label:"Fitness centre",svg:'\n\n \n'},florist:{label:"Florist",svg:'\n\n \n'},fuel:{label:"Fuel",svg:'\n\n \n'},furniture:{label:"Furniture",svg:'\n\n \n \n \n \n'},gaming:{label:"Gaming",svg:'\n\n \n'},garden:{label:"Garden",svg:'\n\n \n'},"garden-centre":{label:"Garden centre",svg:'\n\n \n'},gift:{label:"Gift",svg:'\n\n \n'},globe:{label:"Globe",svg:'\n\n \n \n \n \n \n \n \n \n'},golf:{label:"Golf",svg:'\n\n \n'},grocery:{label:"Grocery",svg:'\n\n \n \n \n'},hairdresser:{label:"Hairdresser",svg:'\n\n \n'},harbor:{label:"Harbor",svg:'\n\n \n'},hardware:{label:"Hardware",svg:'\n\n \n'},heart:{label:"Heart",svg:'\n\n \n'},heliport:{label:"Heliport",svg:'\n\n \n'},home:{label:"Home",svg:'\n\n \n'},"horse-riding":{label:"Horse riding",svg:'\n\n \n'},hospital:{label:"Hospital",svg:'\n\n \n'},"ice-cream":{label:"Ice cream",svg:'\n\n \n \n'},industry:{label:"Industry",svg:'\n\n \n'},information:{label:"Information",svg:'\n\n \n'},"jewelry-store":{label:"Jewelry store",svg:'\n\n \n'},karaoke:{label:"Karaoke",svg:'\n\n \n \n \n \n'},landmark:{label:"Landmark",svg:'\n\n \n'},landuse:{label:"Landuse",svg:'\n\n \n'},laundry:{label:"Laundry",svg:'\n\n \n'},library:{label:"Library",svg:'\n\n \n'},lighthouse:{label:"Lighthouse",svg:'\n\n \n'},lodging:{label:"Lodging",svg:'\n\n \n'},logging:{label:"Logging",svg:'\n\n \n'},marker:{label:"Marker",svg:'\n\n \n'},"marker-stroked":{label:"Marker stroked",svg:'\n\n \n'},"mobile-phone":{label:"Mobile phone",svg:'\n\n \n'},monument:{label:"Monument",svg:'\n\n \n'},mountain:{label:"Mountain",svg:'\n\n \n'},museum:{label:"Museum",svg:'\n\n \n'},music:{label:"Music",svg:'\n\n \n'},natural:{label:"Natural",svg:'\n\n \n'},"oil-rig-es":{label:"Oil rig",svg:'\n\n \n'},optician:{label:"Optician",svg:'\n\n \n'},paint:{label:"Paint",svg:'\n\n \n'},park:{label:"Park",svg:'\n\n \n'},"park-alt1":{label:"Park 2",svg:'\n\n \n'},parking:{label:"Parking",svg:'\n\n \n'},"parking-garage":{label:"Parking garage",svg:'\n\n \n'},pharmacy:{label:"Pharmacy",svg:'\n\n \n'},"picnic-site":{label:"Picnic site",svg:'\n\n \n'},pitch:{label:"Pitch",svg:'\n\n \n'},"place-of-worship":{label:"Place of worship",svg:'\n\n \n'},playground:{label:"Playground",svg:'\n\n \n'},police:{label:"Police",svg:'\n\n \n'},post:{label:"Post",svg:'\n\n \n'},prison:{label:"Prison",svg:'\n\n \n'},rail:{label:"Rail",svg:'\n\n \n'},"rail-light":{label:"Rail light",svg:'\n\n \n'},"rail-metro":{label:"Rail metro",svg:'\n\n \n'},"ranger-station":{label:"Ranger station",svg:'\n\n \n'},recycling:{label:"Recycling",svg:'\n\n \n'},"religious-buddhist":{label:"Religious buddhist",svg:'\n\n \n'},"religious-christian":{label:"Religious christian",svg:'\n\n \n'},"religious-jewish":{label:"Religious jewish",svg:'\n\n \n'},"religious-muslim":{label:"Religious muslim",svg:'\n\n \n'},"residential-community":{label:"Residential community",svg:'\n\n \n'},restaurant:{label:"Restaurant",svg:'\n\n \n'},"restaurant-noodle":{label:"Restaurant noodle",svg:'\n\n \n \n \n'},"restaurant-pizza":{label:"Restaurant pizza",svg:'\n\n \n \n \n'},"restaurant-seafood":{label:"Restaurant seafood",svg:'\n\n \n \n \n'},roadblock:{label:"Roadblock",svg:'\n\n \n'},rocket:{label:"Rocket",svg:'\n\n \n'},school:{label:"School",svg:'\n\n \n'},scooter:{label:"Scooter",svg:'\n\n \n'},shelter:{label:"Shelter",svg:'\n\n \n'},shoe:{label:"Shoe",svg:'\n\n \n \n \n \n'},shop:{label:"Shop",svg:'\n\n \n'},skateboard:{label:"Skateboard",svg:'\n\n \n'},skiing:{label:"Skiing",svg:'\n\n \n'},slaughterhouse:{label:"Slaughterhouse",svg:'\n\n \n'},slipway:{label:"Slipway",svg:'\n\n \n \n \n'},snowmobile:{label:"Snowmobile",svg:'\n\n \n'},soccer:{label:"Soccer",svg:'\n\n \n'},square:{label:"Square",svg:'\n\n \n'},"square-stroked":{label:"Square stroked",svg:'\n\n \n'},stadium:{label:"Stadium",svg:'\n\n \n'},star:{label:"Star",svg:'\n\n \n'},"star-stroked":{label:"Star stroked",svg:'\n\n \n'},suitcase:{label:"Suitcase",svg:'\n\n \n'},sushi:{label:"Sushi",svg:'\n\n \n'},swimming:{label:"Swimming",svg:'\n\n \n'},"table-tennis":{label:"Table tennis",svg:'\n\n \n'},teahouse:{label:"Teahouse",svg:'\n\n \n'},telephone:{label:"Telephone",svg:'\n\n \n'},tennis:{label:"Tennis",svg:'\n\n \n'},theatre:{label:"Theatre",svg:'\n\n \n'},toilet:{label:"Toilet",svg:'\n\n \n'},town:{label:"Town",svg:'\n\n \n'},"town-hall":{label:"Town hall",svg:'\n\n \n'},triangle:{label:"Triangle",svg:'\n\n \n'},"triangle-stroked":{label:"Triangle stroked",svg:'\n\n \n'},veterinary:{label:"Veterinary",svg:'\n\n \n \n \n \n \n'},viewpoint:{label:"Viewpoint",svg:'\n\n \n'},village:{label:"Village",svg:'\n\n \n'},volcano:{label:"Volcano",svg:'\n\n \n'},volleyball:{label:"Volleyball",svg:'\n\n \n'},warehouse:{label:"Warehouse",svg:'\n\n \n'},"waste-basket":{label:"Waste basket",svg:'\n\n \n'},watch:{label:"Watch",svg:'\n\n \n \n'},water:{label:"Water",svg:'\n\n \n'},waterfall:{label:"Waterfall",svg:'\n\n \n'},watermill:{label:"Watermill",svg:'\n\n \n'},wetland:{label:"Wetland",svg:'\n\n \n'},wheelchair:{label:"Wheelchair",svg:'\n\n \n'},windmill:{label:"Windmill",svg:'\n\n \n'},zoo:{label:"Zoo",svg:'\n\n \n'}}},function(t,e,i){t.exports=i(22)(1463)},function(t,e,i){"use strict";i.d(e,"a",(function(){return u}));var r=i(463),n=i.n(r),o=i(464),a=i.n(o),l=i(465),c=i.n(l);i(466);const u=n.a;u.workerUrl=c.a,u.setRTLTextPlugin(a.a)},function(t,e,i){"use strict";i.d(e,"a",(function(){return n}));var r=i(1);function n(t){const e=t%10;return 1===e&&11!==t?r.i18n.translate("xpack.maps.styles.firstOrdinalSuffix",{defaultMessage:"st"}):2===e&&12!==t?r.i18n.translate("xpack.maps.styles.secondOrdinalSuffix",{defaultMessage:"nd"}):3===e&&13!==t?r.i18n.translate("xpack.maps.styles.thirdOrdinalSuffix",{defaultMessage:"rd"}):r.i18n.translate("xpack.maps.styles.ordinalSuffix",{defaultMessage:"th"})}},function(t,e,i){"use strict";i.d(e,"a",(function(){return n})),i.d(e,"b",(function(){return a})),i.d(e,"d",(function(){return l})),i.d(e,"e",(function(){return u})),i.d(e,"c",(function(){return h}));var r=i(0);const n=["!=",["get",r.U],!0];function o(t,e,i){const r=[...t];return e&&r.push(e),i&&(r.push(["has",i.timesliceMaskField]),r.push([">=",["get",i.timesliceMaskField],i.timeslice.from]),r.push(["<",["get",i.timesliceMaskField],i.timeslice.to])),["all",...r]}function a(t,e){return o([["any",["==",["geometry-type"],r.J.POLYGON],["==",["geometry-type"],r.J.MULTI_POLYGON]]],t,e)}function l(t,e){return o([["any",["==",["geometry-type"],r.J.POLYGON],["==",["geometry-type"],r.J.MULTI_POLYGON],["==",["geometry-type"],r.J.LINE_STRING],["==",["geometry-type"],r.J.MULTI_LINE_STRING]]],t,e)}const c=["any",["==",["geometry-type"],r.J.POINT],["==",["geometry-type"],r.J.MULTI_POINT]];function u(t,e,i,r){const a=[];return t?a.push(n):!t&&e&&a.push(["!=",["get","_mvt_label_position"],!0]),a.push(c),o(a,i,r)}function h(t,e,i,r){const n=[];return t?n.push(c):!t&&e&&n.push(["==",["get","_mvt_label_position"],!0]),o(n,i,r)}},function(t,e,i){"use strict";var r=i(214);i.d(e,"a",(function(){return r.a}))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(273),n=i(86);e.default=function(t,e,i){void 0===i&&(i={});for(var o=i.steps||64,a=i.properties?i.properties:!Array.isArray(t)&&"Feature"===t.type&&t.properties?t.properties:{},l=[],c=0;c{this.setState({geometryLabel:t.target.value})})),n()(this,"_onRelationChange",(t=>{this.setState({relation:t.target.value})})),n()(this,"_onActionIdChange",(t=>{this.setState({actionId:t})})),n()(this,"_onSubmit",(()=>{this.props.onSubmit({actionId:this.state.actionId,geometryLabel:this.state.geometryLabel,relation:this.state.relation})}))}_renderRelationInput(){return Object(p.jsx)(a.EuiFormRow,{label:l.i18n.translate("xpack.maps.geometryFilterForm.relationLabel",{defaultMessage:"Spatial relation"}),display:"rowCompressed"},Object(p.jsx)(a.EuiSelect,{compressed:!0,options:d,value:this.state.relation,onChange:this._onRelationChange}))}render(){let t;return this.props.errorMsg&&(t=Object(p.jsx)(a.EuiFormErrorText,null,this.props.errorMsg)),Object(p.jsx)(a.EuiForm,{className:this.props.className},Object(p.jsx)(a.EuiFormRow,{label:l.i18n.translate("xpack.maps.geometryFilterForm.geometryLabelLabel",{defaultMessage:"Geometry label"}),display:"rowCompressed"},Object(p.jsx)(a.EuiFieldText,{compressed:!0,value:this.state.geometryLabel,onChange:this._onGeometryLabelChange})),this._renderRelationInput(),Object(p.jsx)(h.a,{getFilterActions:this.props.getFilterActions,getActionContext:this.props.getActionContext,value:this.state.actionId,onChange:this._onActionIdChange}),Object(p.jsx)(a.EuiSpacer,{size:"m"}),t,Object(p.jsx)(a.EuiTextAlign,{textAlign:"right"},Object(p.jsx)(a.EuiButton,{size:"s",fill:!0,onClick:this._onSubmit,isDisabled:!this.state.geometryLabel,isLoading:this.props.isLoading},this.props.buttonLabel)))}}},function(t,e,i){"use strict";i.d(e,"a",(function(){return ActionSelect}));var r=i(2),n=i.n(r),o=i(4),a=i(14),l=i(1),c=i(215),u=i(3);class ActionSelect extends o.Component{constructor(...t){super(...t),n()(this,"_isMounted",!1),n()(this,"state",{actions:[]})}componentDidMount(){this._isMounted=!0,this._loadActions()}componentWillUnmount(){this._isMounted=!1}async _loadActions(){if(!this.props.getFilterActions||!this.props.getActionContext)return;const t=await this.props.getFilterActions();this._isMounted&&this.setState({actions:t.filter((t=>!Object(c.a)(t)))})}render(){if(0===this.state.actions.length||!this.props.getActionContext)return null;if(1===this.state.actions.length&&this.props.value===this.state.actions[0].id)return null;const t=this.props.getActionContext(),e=this.state.actions.map((e=>{const i=e.getIconType(t);return{value:e.id,inputDisplay:Object(u.jsx)("div",null,i?Object(u.jsx)(a.EuiIcon,{className:"mapActionSelectIcon",type:i}):null,e.getDisplayName(t))}}));return Object(u.jsx)(a.EuiFormRow,{label:l.i18n.translate("xpack.maps.actionSelect.label",{defaultMessage:"Action"}),display:"rowCompressed"},Object(u.jsx)(a.EuiSuperSelect,{compressed:!0,options:e,valueOfSelected:this.props.value?this.props.value:"",onChange:this.props.onChange}))}}},function(t,e,i){"use strict";i.d(e,"a",(function(){return ESTooltipProperty}));var r=i(2),n=i.n(r),o=(i(4),i(39)),a=i.n(o),l=i(44),c=i(3);class ESTooltipProperty{constructor(t,e,i,r){n()(this,"_tooltipProperty",void 0),n()(this,"_indexPattern",void 0),n()(this,"_field",void 0),n()(this,"_applyGlobalQuery",void 0),this._tooltipProperty=t,this._indexPattern=e,this._field=i,this._applyGlobalQuery=r}getPropertyKey(){return this._tooltipProperty.getPropertyKey()}getPropertyName(){return this._tooltipProperty.getPropertyName()}getRawValue(){return this._tooltipProperty.getRawValue()}_getIndexPatternField(){return this._indexPattern.fields.getByName(this._field.getRootName())}getHtmlDisplayValue(){if(void 0===this.getRawValue())return"-";const t=this._getIndexPatternField();if(!t||!this._field.canValueBeFormatted()){const t=this.getRawValue();return Array.isArray(t)?a.a.escape(t.join()):a.a.escape(t)}const e=this._indexPattern.getFormatterForField(t),i=e.getConverterFor("html");return i?Object(c.jsx)("span",{dangerouslySetInnerHTML:{__html:i(this.getRawValue())}}):e.convert(this.getRawValue())}isFilterable(){if(!this._applyGlobalQuery)return!1;const t=this._getIndexPatternField();return!!t&&("string"===t.type||"date"===t.type||"ip"===t.type||"number"===t.type)}async getESFilters(){if(!this._applyGlobalQuery)return[];const t=this._getIndexPatternField();if(!t)return[];const e=this.getRawValue();if(null==e){const e=Object(l.buildExistsFilter)(t,this._indexPattern);return e.meta.negate=!0,[e]}return(Array.isArray(e)?e:[e]).map((e=>Object(l.buildPhraseFilter)(t,e,this._indexPattern)))}}},function(t,e,i){"use strict";i.d(e,"a",(function(){return a}));var r=i(153),n=i.n(r),o=i(0);function a(t,e){if(!t)return null;const i=e?t.features.filter((t=>t.properties&&t.properties[o.C])):t.features;if(0===i.length)return null;const r=n()({type:"FeatureCollection",features:i});return{minLon:r[0],minLat:r[1],maxLon:r[2],maxLat:r[3]}}},function(t,e,i){"use strict";i.d(e,"a",(function(){return ValidatedNumberInput}));var r=i(2),n=i.n(r),o=i(4),a=i(14),l=i(1),c=i(39),u=i.n(c),h=i(3);function p(t,e){return l.i18n.translate("xpack.maps.validatedNumberInput.invalidClampErrorMessage",{defaultMessage:"Must be between {min} and {max}",values:{min:t,max:e}})}function d(t,e,i){const r=parseFloat(t.toString());if(isNaN(r))return{isValid:!1,errorMessage:p(e,i)};const n=r>=e&&r<=i;return{parsedValue:r,isValid:n,errorMessage:n?"":p(e,i)}}class ValidatedNumberInput extends o.Component{constructor(t){super(t),n()(this,"_submit",u.a.debounce((t=>{this.props.onChange(t)}),250)),n()(this,"_onChange",(t=>{const e=t.target.value,{isValid:i,errorMessage:r,parsedValue:n}=d(e,this.props.min,this.props.max);this.setState({value:e,errorMessage:r,isValid:i}),i&&this._submit(n)}));const{isValid:e,errorMessage:i}=d(t.initialValue,this.props.min,this.props.max);this.state={value:t.initialValue,errorMessage:i,isValid:e}}render(){return Object(h.jsx)(a.EuiFormRow,{label:this.props.label,isInvalid:!this.state.isValid,error:this.state.errorMessage?[this.state.errorMessage]:[],display:this.props.display,helpText:this.props.helpText},Object(h.jsx)(a.EuiFieldNumber,{isInvalid:!this.state.isValid,min:this.props.min,max:this.props.max,value:this.state.value,onChange:this._onChange,"aria-label":`${this.props.label} number input`}))}}},,,,,,,,,,,,,,,,,,,,,,,,,,,,function(t,e,i){"use strict";i.d(e,"a",(function(){return o}));var r=i(49),n=i.n(r);function o(t){const e=new URLSearchParams;return Object.keys(t).forEach((i=>{const r=t[i];null!=r&&("object"!=typeof r?("number"!=typeof r&&"boolean"!=typeof r||e.set(i,r.toString()),e.set(i,r)):e.set(i,n.a.encode(r)))})),e.toString()}},function(t,e,i){"use strict";i.d(e,"a",(function(){return custom_icon_modal_CustomIconModal}));var r=i(2),n=i.n(r),o=i(4),a=i.n(o),l=i(14),c=i(15),u=i(1),h=i(268),p=i(99),d=i(3);class icon_preview_IconPreview extends o.Component{constructor(...t){super(...t),n()(this,"_isMounted",!1),n()(this,"_containerRef",null),n()(this,"state",{map:null,iconColor:"#E7664C"}),n()(this,"_setIconColor",(t=>{this.setState({iconColor:t},(()=>{this._syncPaintPropertiesToMap()}))})),n()(this,"_setContainerRef",(t=>{this._containerRef=t}))}componentDidMount(){this._isMounted=!0,this._initializeMap()}componentDidUpdate(t){this.props.svg===t.svg&&this.props.cutoff===t.cutoff&&this.props.radius===t.radius||this._syncImageToMap()}componentWillUnmount(){this._isMounted=!1,this.state.map&&(this.state.map.remove(),this.state.map=null)}async _syncImageToMap(){if(this._isMounted&&this.state.map){const t=this.state.map,{svg:e,cutoff:i,radius:r,isSvgInvalid:n}=this.props;if(!e||n)return void t.setLayoutProperty("icon-layer","visibility","none");const o=await Object(p.e)({svg:e,cutoff:i,radius:r});o&&(t.hasImage(icon_preview_IconPreview.iconId)?t.updateImage(icon_preview_IconPreview.iconId,o):t.addImage(icon_preview_IconPreview.iconId,o,{sdf:!0,pixelRatio:p.a})),t.setLayoutProperty("icon-layer","icon-image",icon_preview_IconPreview.iconId),t.setLayoutProperty("icon-layer","icon-size",6),t.setLayoutProperty("icon-layer","visibility","visible"),this._syncPaintPropertiesToMap()}}_syncPaintPropertiesToMap(){const{map:t,iconColor:e}=this.state;t&&(t.setPaintProperty("icon-layer","icon-halo-color","#000000"),t.setPaintProperty("icon-layer","icon-halo-width",1),t.setPaintProperty("icon-layer","icon-color",e),t.setLayoutProperty("icon-layer","icon-size",12))}_createMapInstance(){const t=new h.a.Map({container:this._containerRef,interactive:!1,center:[0,0],zoom:2,style:{version:8,name:"Empty",sources:{},layers:[{id:"background",type:"background",paint:{"background-color":"rgba(0,0,0,0)"}}]}});return t.on("load",(()=>{t.addLayer({id:"icon-layer",type:"symbol",source:{type:"geojson",data:{type:"Feature",geometry:{type:"Point",coordinates:[0,0]},properties:{}}}}),this._syncImageToMap()})),t}_initializeMap(){const t=this._createMapInstance();this.setState({map:t})}render(){const t=this.state.iconColor;return Object(d.jsx)("div",null,Object(d.jsx)(l.EuiFlexItem,null,Object(d.jsx)(l.EuiPanel,{color:"subdued",hasBorder:!0,hasShadow:!1,grow:!0},Object(d.jsx)(l.EuiTitle,{size:"xxxs"},Object(d.jsx)("h4",null,Object(d.jsx)(l.EuiToolTip,{content:u.i18n.translate("xpack.maps.customIconModal.elementPreviewTooltip",{defaultMessage:"Dynamic styling requires rendering SVG icons using a signed distance function. As a result, sharp corners and intricate details may not render correctly. You may be able to tweak the Alpha threshold and Radius for better results."})},Object(d.jsx)(a.a.Fragment,null,u.i18n.translate("xpack.maps.customIconModal.elementPreviewTitle",{defaultMessage:"Render preview"})," ",Object(d.jsx)(l.EuiIcon,{color:"subdued",type:"questionInCircle"}))))),Object(d.jsx)(l.EuiSpacer,{size:"s"}),Object(d.jsx)(l.EuiPanel,{hasBorder:!0,hasShadow:!1},Object(d.jsx)("div",{id:"mapsCustomIconPreview__mapContainer",ref:this._setContainerRef,"data-test-subj":"mapsCustomIconPreview",className:"mapsCustomIconPreview__mapContainer"})),Object(d.jsx)(l.EuiSpacer,{size:"m"}),Object(d.jsx)(l.EuiFormRow,{label:"Preview color"},Object(d.jsx)(l.EuiColorPicker,{onChange:this._setIconColor,color:t})))))}}n()(icon_preview_IconPreview,"iconId","iconPreview");var f=i(127),m=i(35),g=i(5);class custom_icon_modal_CustomIconModal extends o.Component{constructor(...t){super(...t),n()(this,"_isMounted",!1),n()(this,"state",{label:this.props.label||"",svg:this.props.svg||"",cutoff:this.props.cutoff,radius:this.props.radius,isFileInvalid:!this.props.svg}),n()(this,"_handleLabelChange",(t=>{this.setState({label:t})})),n()(this,"_handleCutoffChange",(t=>{this.setState({cutoff:t})})),n()(this,"_handleRadiusChange",(t=>{this.setState({radius:t})})),n()(this,"_resetAdvancedOptions",(()=>{this.setState({radius:this.props.radius,cutoff:this.props.cutoff})})),n()(this,"_onFileSelect",(async t=>{if(this.setState({label:"",svg:"",isFileInvalid:!1}),t&&t.length){const i=t[0],{type:r}=i;if("image/svg+xml"===r){var e;const t=null!==(e=this.props.label)&&void 0!==e?e:function(t){const e=t.split(".");return e.length>1&&e.pop(),e.join(".")}(i.name);try{const e=await i.text();if(!this._isMounted)return;this.setState({isFileInvalid:!1,label:t,svg:e})}catch(t){if(!this._isMounted)return;this.setState({isFileInvalid:!0})}}else this.setState({isFileInvalid:!0})}}))}componentWillUnmount(){this._isMounted=!1}componentDidMount(){this._isMounted=!0}_renderAdvancedOptions(){const{cutoff:t,radius:e}=this.state;return Object(d.jsx)(l.EuiAccordion,{id:"advancedOptionsAccordion",buttonContent:u.i18n.translate("xpack.maps.customIconModal.advancedOptionsLabel",{defaultMessage:"Advanced options"}),paddingSize:"xs"},Object(d.jsx)(l.EuiPanel,{color:"subdued",paddingSize:"s"},Object(d.jsx)(l.EuiFlexGroup,{justifyContent:"flexEnd",gutterSize:"xs"},Object(d.jsx)(l.EuiFlexItem,{grow:!1},Object(d.jsx)(l.EuiButtonEmpty,{size:"xs",onClick:this._resetAdvancedOptions},u.i18n.translate("xpack.maps.customIconModal.resetButtonLabel",{defaultMessage:"Reset"})))),Object(d.jsx)(l.EuiFormRow,{className:"mapsCustomIconForm__cutoff",label:Object(d.jsx)(l.EuiToolTip,{content:u.i18n.translate("xpack.maps.customIconModal.cutoffRangeTooltip",{defaultMessage:"Adjusts the balance of the signed distance function between the inside (approaching 1) and outside (approaching 0) of the icon."})},Object(d.jsx)(a.a.Fragment,null,u.i18n.translate("xpack.maps.customIconModal.cutoffRangeLabel",{defaultMessage:"Alpha threshold"})," ",Object(d.jsx)(l.EuiIcon,{color:"subdued",type:"questionInCircle"}))),display:"rowCompressed"},Object(d.jsx)(f.a,{min:0,max:1,value:t,step:.01,showInput:!0,showLabels:!0,compressed:!0,className:"mapsCutoffRange",onChange:this._handleCutoffChange})),Object(d.jsx)(l.EuiFormRow,{className:"mapsCustomIconForm__radius",label:Object(d.jsx)(l.EuiToolTip,{content:u.i18n.translate("xpack.maps.customIconModal.raduisRangeTooltip",{defaultMessage:"Adjusts the size of the signed distance function around the Alpha threshold as a percent of icon size."})},Object(d.jsx)(a.a.Fragment,null,u.i18n.translate("xpack.maps.customIconModal.radiusRangeLabel",{defaultMessage:"Radius"})," ",Object(d.jsx)(l.EuiIcon,{color:"subdued",type:"questionInCircle"}))),display:"rowCompressed"},Object(d.jsx)(f.a,{min:0,max:1,value:e,step:.01,showInput:!0,showLabels:!0,compressed:!0,className:"mapsRadiusRange",onChange:this._handleRadiusChange}))))}_renderIconForm(){const{label:t,svg:e}=this.state;return""!==e?Object(d.jsx)(a.a.Fragment,null,Object(d.jsx)(l.EuiFormRow,{label:u.i18n.translate("xpack.maps.customIconModal.nameInputLabel",{defaultMessage:"Name"}),display:"rowCompressed"},Object(d.jsx)(l.EuiFieldText,{value:t,className:"mapsCustomIconForm__label",onChange:t=>this._handleLabelChange(t.target.value),required:!0,"data-test-subj":"mapsCustomIconForm-label"})),Object(d.jsx)(l.EuiSpacer,null),this._renderAdvancedOptions()):null}_renderIconPreview(){const{svg:t,isFileInvalid:e,cutoff:i,radius:r}=this.state;return""!==t?Object(d.jsx)(l.EuiFlexItem,{className:"mapsIconPreview__wrapper mapsCustomIconForm__preview",grow:!1},Object(d.jsx)(icon_preview_IconPreview,{svg:t,isSvgInvalid:e,cutoff:i,radius:r})):null}render(){const t=Object(g.T)(),{symbolId:e,onSave:i,onCancel:r,onDelete:n,title:o}=this.props,{label:a,svg:h,cutoff:f,radius:y,isFileInvalid:_}=this.state,v=0!==a.length&&0!==h.length&&!_,x=h&&_?u.i18n.translate("xpack.maps.customIconModal.invalidFileError",{defaultMessage:"Icon must be in SVG format. Other image types are not supported."}):"";return Object(d.jsx)(l.EuiModal,{className:"mapsCustomIconModal",maxWidth:700,onClose:r,initialFocus:".mapsCustomIconForm__image"},Object(d.jsx)(l.EuiModalHeader,null,Object(d.jsx)(l.EuiModalHeaderTitle,{component:"h3"},o)),Object(d.jsx)(l.EuiModalBody,null,Object(d.jsx)(l.EuiFlexGroup,{justifyContent:"spaceBetween",alignItems:"flexStart",gutterSize:"m"},Object(d.jsx)(l.EuiFlexItem,{className:"mapsCustomIconForm",grow:2},Object(d.jsx)(l.EuiFormRow,{className:"mapsCustomIconForm__image",display:"rowCompressed",isInvalid:!!x,error:x,helpText:u.i18n.translate("xpack.maps.customIconModal.imageInputDescription",{defaultMessage:"SVGs without sharp corners and intricate details work best. Modifying the settings under Advanced options may improve rendering."})},Object(d.jsx)(l.EuiFilePicker,{initialPromptText:u.i18n.translate("xpack.maps.customIconModal.imageFilePickerPlaceholder",{defaultMessage:"Select or drag and drop an SVG icon"}),onChange:this._onFileSelect,className:"mapsImageUpload",accept:".svg",isInvalid:!!x,required:!0})),Object(d.jsx)(l.EuiSpacer,null),this._renderIconForm()),this._renderIconPreview())),Object(d.jsx)(l.EuiModalFooter,null,Object(d.jsx)(l.EuiFlexGroup,{justifyContent:"flexEnd"},Object(d.jsx)(l.EuiFlexItem,{grow:!1},Object(d.jsx)(l.EuiButtonEmpty,{onClick:r},u.i18n.translate("xpack.maps.customIconModal.cancelButtonLabel",{defaultMessage:"Cancel"}))),n&&e?Object(d.jsx)(l.EuiFlexItem,{grow:!1},Object(d.jsx)(l.EuiButton,{color:"danger",onClick:()=>{null==t||t.reportUiCounter(m.APP_ID,c.METRIC_TYPE.CLICK,"settings_custom_icons_delete"),n(e)},"data-test-subj":"mapsCustomIconForm-submit"},u.i18n.translate("xpack.maps.customIconModal.deleteButtonLabel",{defaultMessage:"Delete"}))):null,Object(d.jsx)(l.EuiFlexItem,{grow:!1},Object(d.jsx)(l.EuiButton,{fill:!0,onClick:()=>{n||null==t||t.reportUiCounter(m.APP_ID,c.METRIC_TYPE.CLICK,"settings_custom_icons_add"),i({symbolId:null!=e?e:Object(p.f)(),label:a,svg:h,cutoff:f,radius:y})},"data-test-subj":"mapsCustomIconForm-submit",isDisabled:!v},u.i18n.translate("xpack.maps.customIconModal.saveButtonLabel",{defaultMessage:"Save"}))))))}}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(105);function n(t,e,i){var r=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var n=0,o=e.length-1;nt[1]!=u>t[1]&&t[0]<(c-a)*(t[1]-l)/(u-l)+a&&(r=!r)}return r}e.default=function(t,e,i){if(void 0===i&&(i={}),!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var o=r.getCoord(t),a=r.getGeom(e),l=a.type,c=e.bbox,u=a.coordinates;if(c&&!1===function(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}(o,c))return!1;"Polygon"===l&&(u=[u]);for(var h=!1,p=0;p=Math.abs(p)?h>0?a0?l=Math.abs(p)?h>0?a<=n&&n0?l<=o&&o=Math.abs(p)?h>0?a0?l=Math.abs(p)?h>0?a<=n&&n<=c:c<=n&&n<=a:p>0?l<=o&&o<=u:u<=o&&o<=l)}e.default=function(t,e,i){void 0===i&&(i={});for(var o=r.getCoord(t),a=r.getCoords(e),l=0;l1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}if(t=D(t,360),e=D(e,100),i=D(i,100),0===e)r=n=o=i;else{var l=i<.5?i*(1+e):i+e-i*e,c=2*i-l;r=a(c,l,t+1/3),n=a(c,l,t),o=a(c,l,t-1/3)}return{r:255*r,g:255*n,b:255*o}}(t.h,p,f),m=!0,g="hsl"),t.hasOwnProperty("a")&&(c=t.a)),c=F(c),{ok:m,format:t.format||g,r:u(255,h(l.r,0)),g:u(255,h(l.g,0)),b:u(255,h(l.b,0)),a:c}}(t);this._originalInput=t,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=c(100*this._a)/100,this._format=e.format||i.format,this._gradientType=e.gradientType,this._r<1&&(this._r=c(this._r)),this._g<1&&(this._g=c(this._g)),this._b<1&&(this._b=c(this._b)),this._ok=i.ok,this._tc_id=l++}function f(t,e,i){t=D(t,255),e=D(e,255),i=D(i,255);var r,n,o=h(t,e,i),a=u(t,e,i),l=(o+a)/2;if(o==a)r=n=0;else{var c=o-a;switch(n=l>.5?c/(2-o-a):c/(o+a),o){case t:r=(e-i)/c+(e>1)+720)%360;--e;)r.h=(r.h+n)%360,o.push(d(r));return o}function P(t,e){e=e||6;for(var i=d(t).toHsv(),r=i.h,n=i.s,o=i.v,a=[],l=1/e;e--;)a.push(d({h:r,s:n,v:o})),o=(o+l)%1;return a}d.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,i,r=this.toRgb();return t=r.r/255,e=r.g/255,i=r.b/255,.2126*(t<=.03928?t/12.92:n.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:n.pow((e+.055)/1.055,2.4))+.0722*(i<=.03928?i/12.92:n.pow((i+.055)/1.055,2.4))},setAlpha:function(t){return this._a=F(t),this._roundA=c(100*this._a)/100,this},toHsv:function(){var t=m(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=m(this._r,this._g,this._b),e=c(360*t.h),i=c(100*t.s),r=c(100*t.v);return 1==this._a?"hsv("+e+", "+i+"%, "+r+"%)":"hsva("+e+", "+i+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=f(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=f(this._r,this._g,this._b),e=c(360*t.h),i=c(100*t.s),r=c(100*t.l);return 1==this._a?"hsl("+e+", "+i+"%, "+r+"%)":"hsla("+e+", "+i+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return g(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,i,r,n){var o=[N(c(t).toString(16)),N(c(e).toString(16)),N(c(i).toString(16)),N(V(r))];return n&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0):o.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:c(this._r),g:c(this._g),b:c(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+c(this._r)+", "+c(this._g)+", "+c(this._b)+")":"rgba("+c(this._r)+", "+c(this._g)+", "+c(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:c(100*D(this._r,255))+"%",g:c(100*D(this._g,255))+"%",b:c(100*D(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+c(100*D(this._r,255))+"%, "+c(100*D(this._g,255))+"%, "+c(100*D(this._b,255))+"%)":"rgba("+c(100*D(this._r,255))+"%, "+c(100*D(this._g,255))+"%, "+c(100*D(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(k[g(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+y(this._r,this._g,this._b,this._a),i=e,r=this._gradientType?"GradientType = 1, ":"";if(t){var n=d(t);i="#"+y(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+e+",endColorstr="+i+")"},toString:function(t){var e=!!t;t=t||this._format;var i=!1,r=this._a<1&&this._a>=0;return e||!r||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(i=this.toRgbString()),"prgb"===t&&(i=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(i=this.toHexString()),"hex3"===t&&(i=this.toHexString(!0)),"hex4"===t&&(i=this.toHex8String(!0)),"hex8"===t&&(i=this.toHex8String()),"name"===t&&(i=this.toName()),"hsl"===t&&(i=this.toHslString()),"hsv"===t&&(i=this.toHsvString()),i||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return d(this.toString())},_applyModification:function(t,e){var i=t.apply(null,[this].concat([].slice.call(e)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(b,arguments)},brighten:function(){return this._applyModification(w,arguments)},darken:function(){return this._applyModification(C,arguments)},desaturate:function(){return this._applyModification(_,arguments)},saturate:function(){return this._applyModification(v,arguments)},greyscale:function(){return this._applyModification(x,arguments)},spin:function(){return this._applyModification(S,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(I,arguments)},complement:function(){return this._applyCombination(M,arguments)},monochromatic:function(){return this._applyCombination(P,arguments)},splitcomplement:function(){return this._applyCombination(A,arguments)},triad:function(){return this._applyCombination(T,arguments)},tetrad:function(){return this._applyCombination(E,arguments)}},d.fromRatio=function(t,e){if("object"==typeof t){var i={};for(var r in t)t.hasOwnProperty(r)&&(i[r]="a"===r?t[r]:B(t[r]));t=i}return d(t,e)},d.equals=function(t,e){return!(!t||!e)&&d(t).toRgbString()==d(e).toRgbString()},d.random=function(){return d.fromRatio({r:p(),g:p(),b:p()})},d.mix=function(t,e,i){i=0===i?0:i||50;var r=d(t).toRgb(),n=d(e).toRgb(),o=i/100;return d({r:(n.r-r.r)*o+r.r,g:(n.g-r.g)*o+r.g,b:(n.b-r.b)*o+r.b,a:(n.a-r.a)*o+r.a})},d.readability=function(t,e){var i=d(t),r=d(e);return(n.max(i.getLuminance(),r.getLuminance())+.05)/(n.min(i.getLuminance(),r.getLuminance())+.05)},d.isReadable=function(t,e,i){var r,n,o,a,l,c=d.readability(t,e);switch(n=!1,(o=i,"AA"!==(a=((o=o||{level:"AA",size:"small"}).level||"AA").toUpperCase())&&"AAA"!==a&&(a="AA"),"small"!==(l=(o.size||"small").toLowerCase())&&"large"!==l&&(l="small"),r={level:a,size:l}).level+r.size){case"AAsmall":case"AAAlarge":n=c>=4.5;break;case"AAlarge":n=c>=3;break;case"AAAsmall":n=c>=7}return n},d.mostReadable=function(t,e,i){var r,n,o,a,l=null,c=0;n=(i=i||{}).includeFallbackColors,o=i.level,a=i.size;for(var u=0;uc&&(c=r,l=d(e[u]));return d.isReadable(t,l,{level:o,size:a})||!n?l:(i.includeFallbackColors=!1,d.mostReadable(t,["#fff","#000"],i))};var O=d.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},k=d.hexNames=function(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[t[i]]=i);return e}(O);function F(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function D(t,e){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var i=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=u(e,h(0,parseFloat(t))),i&&(t=parseInt(t*e,10)/100),n.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function z(t){return u(1,h(0,t))}function j(t){return parseInt(t,16)}function N(t){return 1==t.length?"0"+t:""+t}function B(t){return t<=1&&(t=100*t+"%"),t}function V(t){return n.round(255*parseFloat(t)).toString(16)}function U(t){return j(t)/255}var H,G,q,Z=(G="[\\s|\\(]+("+(H="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+H+")[,|\\s]+("+H+")\\s*\\)?",q="[\\s|\\(]+("+H+")[,|\\s]+("+H+")[,|\\s]+("+H+")[,|\\s]+("+H+")\\s*\\)?",{CSS_UNIT:new RegExp(H),rgb:new RegExp("rgb"+G),rgba:new RegExp("rgba"+q),hsl:new RegExp("hsl"+G),hsla:new RegExp("hsla"+q),hsv:new RegExp("hsv"+G),hsva:new RegExp("hsva"+q),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function $(t){return!!Z.CSS_UNIT.exec(t)}t.exports?t.exports=d:void 0===(r=function(){return d}.call(e,i,e,t))||(t.exports=r)}(Math)},function(t,e,i){(function(){"use strict";var t,r,n,o,a,l={}.hasOwnProperty;t=i(386),r=i(193).defaults,o=function(t){return"string"==typeof t&&(t.indexOf("&")>=0||t.indexOf(">")>=0||t.indexOf("<")>=0)},a=function(t){return""},n=function(t){return t.replace("]]>","]]]]>")},e.Builder=function(){function e(t){var e,i,n;for(e in this.options={},i=r[.2])l.call(i,e)&&(n=i[e],this.options[e]=n);for(e in t)l.call(t,e)&&(n=t[e],this.options[e]=n)}return e.prototype.buildObject=function(e){var i,n,c,u,h,p;return i=this.options.attrkey,n=this.options.charkey,1===Object.keys(e).length&&this.options.rootName===r[.2].rootName?e=e[h=Object.keys(e)[0]]:h=this.options.rootName,p=this,c=function(t,e){var r,u,h,d,f,m;if("object"!=typeof e)p.options.cdata&&o(e)?t.raw(a(e)):t.txt(e);else if(Array.isArray(e)){for(d in e)if(l.call(e,d))for(f in u=e[d])h=u[f],t=c(t.ele(f),h).up()}else for(f in e)if(l.call(e,f))if(u=e[f],f===i){if("object"==typeof u)for(r in u)m=u[r],t=t.att(r,m)}else if(f===n)t=p.options.cdata&&o(u)?t.raw(a(u)):t.txt(u);else if(Array.isArray(u))for(d in u)l.call(u,d)&&(t="string"==typeof(h=u[d])?p.options.cdata&&o(h)?t.ele(f).raw(a(h)).up():t.ele(f,h).up():c(t.ele(f),h).up());else"object"==typeof u?t=c(t.ele(f),u).up():"string"==typeof u&&p.options.cdata&&o(u)?t=t.ele(f).raw(a(u)).up():(null==u&&(u=""),t=t.ele(f,u.toString()).up());return t},u=t.create(h,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),c(u,e).end(this.options.renderOpts)},e}()}).call(this)},function(t,e,i){(function(){var e,r,n,o,a,l,c,u,h,p;p=i(103),u=p.assign,h=p.isFunction,n=i(253),o=i(254),a=i(392),c=i(207),l=i(393),e=i(78),r=i(161),t.exports.create=function(t,e,i,r){var n,a;if(null==t)throw new Error("Root element needs a name.");return r=u({},e,i,r),a=(n=new o(r)).element(t),r.headless||(n.declaration(r),null==r.pubID&&null==r.sysID||n.dtd(r)),a},t.exports.begin=function(t,e,i){var r;return h(t)&&(e=(r=[t,e])[0],i=r[1],t={}),e?new a(t,e,i):new o(t)},t.exports.stringWriter=function(t){return new c(t)},t.exports.streamWriter=function(t,e){return new l(t,e)},t.exports.implementation=new n,t.exports.nodeType=e,t.exports.writerState=r}).call(this)},function(t,e,i){(function(){var e,r;e=i(388),r=i(389),t.exports=function(){function t(){this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new e,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=Object.create(this.defaultParams)}return Object.defineProperty(t.prototype,"parameterNames",{get:function(){return new r(Object.keys(this.defaultParams))}}),t.prototype.getParameter=function(t){return this.params.hasOwnProperty(t)?this.params[t]:null},t.prototype.canSetParameter=function(t,e){return!0},t.prototype.setParameter=function(t,e){return null!=e?this.params[t]=e:delete this.params[t]},t}()}).call(this)},function(t,e){(function(){t.exports=function(){function t(){}return t.prototype.handleError=function(t){throw new Error(t)},t}()}).call(this)},function(t,e){(function(){t.exports=function(){function t(t){this.arr=t||[]}return Object.defineProperty(t.prototype,"length",{get:function(){return this.arr.length}}),t.prototype.item=function(t){return this.arr[t]||null},t.prototype.contains=function(t){return-1!==this.arr.indexOf(t)},t}()}).call(this)},function(t,e){(function(){t.exports=function(){function t(t){this.nodes=t}return Object.defineProperty(t.prototype,"length",{get:function(){return this.nodes.length||0}}),t.prototype.clone=function(){return this.nodes=null},t.prototype.item=function(t){return this.nodes[t]||null},t}()}).call(this)},function(t,e){(function(){t.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(this)},function(t,e,i){(function(){var e,r,n,o,a,l,c,u,h,p,d,f,m,g,y,_,v,x,b,w,C,S,M,T={}.hasOwnProperty;M=i(103),C=M.isObject,w=M.isFunction,S=M.isPlainObject,b=M.getValue,e=i(78),f=i(254),m=i(194),o=i(196),a=i(197),y=i(204),x=i(205),g=i(206),p=i(198),d=i(199),l=i(200),u=i(201),c=i(202),h=i(203),n=i(255),v=i(257),_=i(207),r=i(161),t.exports=function(){function t(t,i,r){var n;this.name="?xml",this.type=e.Document,t||(t={}),n={},t.writer?S(t.writer)&&(n=t.writer,t.writer=new _):t.writer=new _,this.options=t,this.writer=t.writer,this.writerOptions=this.writer.filterOptions(n),this.stringify=new v(t),this.onDataCallback=i||function(){},this.onEndCallback=r||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return t.prototype.createChildNode=function(t){var i,r,n,o,a,l,c,u;switch(t.type){case e.CData:this.cdata(t.value);break;case e.Comment:this.comment(t.value);break;case e.Element:for(r in n={},c=t.attribs)T.call(c,r)&&(i=c[r],n[r]=i.value);this.node(t.name,n);break;case e.Dummy:this.dummy();break;case e.Raw:this.raw(t.value);break;case e.Text:this.text(t.value);break;case e.ProcessingInstruction:this.instruction(t.target,t.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+t.constructor.name)}for(a=0,l=(u=t.children).length;a=0;)this.up();return this.onEnd()},t.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},t.prototype.openNode=function(t){var i,n,o,a;if(!t.isOpen){if(this.root||0!==this.currentLevel||t.type!==e.Element||(this.root=t),n="",t.type===e.Element){for(o in this.writerOptions.state=r.OpenTag,n=this.writer.indent(t,this.writerOptions,this.currentLevel)+"<"+t.name,a=t.attribs)T.call(a,o)&&(i=a[o],n+=this.writer.attribute(i,this.writerOptions,this.currentLevel));n+=(t.children?">":"/>")+this.writer.endline(t,this.writerOptions,this.currentLevel),this.writerOptions.state=r.InsideTag}else this.writerOptions.state=r.OpenTag,n=this.writer.indent(t,this.writerOptions,this.currentLevel)+""),n+=this.writer.endline(t,this.writerOptions,this.currentLevel);return this.onData(n,this.currentLevel),t.isOpen=!0}},t.prototype.closeNode=function(t){var i;if(!t.isClosed)return"",this.writerOptions.state=r.CloseTag,i=t.type===e.Element?this.writer.indent(t,this.writerOptions,this.currentLevel)+""+this.writer.endline(t,this.writerOptions,this.currentLevel):this.writer.indent(t,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(t,this.writerOptions,this.currentLevel),this.writerOptions.state=r.None,this.onData(i,this.currentLevel),t.isClosed=!0},t.prototype.onData=function(t,e){return this.documentStarted=!0,this.onDataCallback(t,e+1)},t.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},t.prototype.debugInfo=function(t){return null==t?"":"node: <"+t+">"},t.prototype.ele=function(){return this.element.apply(this,arguments)},t.prototype.nod=function(t,e,i){return this.node(t,e,i)},t.prototype.txt=function(t){return this.text(t)},t.prototype.dat=function(t){return this.cdata(t)},t.prototype.com=function(t){return this.comment(t)},t.prototype.ins=function(t,e){return this.instruction(t,e)},t.prototype.dec=function(t,e,i){return this.declaration(t,e,i)},t.prototype.dtd=function(t,e,i){return this.doctype(t,e,i)},t.prototype.e=function(t,e,i){return this.element(t,e,i)},t.prototype.n=function(t,e,i){return this.node(t,e,i)},t.prototype.t=function(t){return this.text(t)},t.prototype.d=function(t){return this.cdata(t)},t.prototype.c=function(t){return this.comment(t)},t.prototype.r=function(t){return this.raw(t)},t.prototype.i=function(t,e){return this.instruction(t,e)},t.prototype.att=function(){return this.currentNode&&this.currentNode.type===e.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},t.prototype.a=function(){return this.currentNode&&this.currentNode.type===e.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},t.prototype.ent=function(t,e){return this.entity(t,e)},t.prototype.pent=function(t,e){return this.pEntity(t,e)},t.prototype.not=function(t,e){return this.notation(t,e)},t}()}).call(this)},function(t,e,i){(function(){var e,r,n,o={}.hasOwnProperty;e=i(78),n=i(258),r=i(161),t.exports=function(t){function i(t,e){this.stream=t,i.__super__.constructor.call(this,e)}return function(t,e){for(var i in e)o.call(e,i)&&(t[i]=e[i]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(i,t),i.prototype.endline=function(t,e,n){return t.isLastRootNode&&e.state===r.CloseTag?"":i.__super__.endline.call(this,t,e,n)},i.prototype.document=function(t,e){var i,r,n,o,a,l,c,u,h;for(r=n=0,a=(c=t.children).length;n0){for(this.stream.write(" ["),this.stream.write(this.endline(t,e,i)),e.state=r.InsideTag,o=0,a=(l=t.children).length;o"),this.stream.write(this.endline(t,e,i)),e.state=r.None,this.closeNode(t,e,i)},i.prototype.element=function(t,i,n){var a,l,c,u,h,p,d,f,m;for(d in n||(n=0),this.openNode(t,i,n),i.state=r.OpenTag,this.stream.write(this.indent(t,i,n)+"<"+t.name),f=t.attribs)o.call(f,d)&&(a=f[d],this.attribute(a,i,n));if(u=0===(c=t.children.length)?null:t.children[0],0===c||t.children.every((function(t){return(t.type===e.Text||t.type===e.Raw)&&""===t.value})))i.allowEmpty?(this.stream.write(">"),i.state=r.CloseTag,this.stream.write("")):(i.state=r.CloseTag,this.stream.write(i.spaceBeforeSlash+"/>"));else if(!i.pretty||1!==c||u.type!==e.Text&&u.type!==e.Raw||null==u.value){for(this.stream.write(">"+this.endline(t,i,n)),i.state=r.InsideTag,h=0,p=(m=t.children).length;h")}else this.stream.write(">"),i.state=r.InsideTag,i.suppressPrettyCount++,this.writeChildNode(u,i,n+1),i.suppressPrettyCount--,i.state=r.CloseTag,this.stream.write("");return this.stream.write(this.endline(t,i,n)),i.state=r.None,this.closeNode(t,i,n)},i.prototype.processingInstruction=function(t,e,r){return this.stream.write(i.__super__.processingInstruction.call(this,t,e,r))},i.prototype.raw=function(t,e,r){return this.stream.write(i.__super__.raw.call(this,t,e,r))},i.prototype.text=function(t,e,r){return this.stream.write(i.__super__.text.call(this,t,e,r))},i.prototype.dtdAttList=function(t,e,r){return this.stream.write(i.__super__.dtdAttList.call(this,t,e,r))},i.prototype.dtdElement=function(t,e,r){return this.stream.write(i.__super__.dtdElement.call(this,t,e,r))},i.prototype.dtdEntity=function(t,e,r){return this.stream.write(i.__super__.dtdEntity.call(this,t,e,r))},i.prototype.dtdNotation=function(t,e,r){return this.stream.write(i.__super__.dtdNotation.call(this,t,e,r))},i}(n)}).call(this)},function(t,e,i){(function(){"use strict";var t,r,n,o,a,l,c,u,h=function(t,e){return function(){return t.apply(e,arguments)}},p={}.hasOwnProperty;c=i(395),n=i(125),t=i(409),l=i(264),u=i(262).setImmediate,r=i(193).defaults,o=function(t){return"object"==typeof t&&null!=t&&0===Object.keys(t).length},a=function(t,e,i){var r,n;for(r=0,n=t.length;r0&&(c[t.options.childkey]=h),h=c;return r.length>0?t.assignOrPush(m,u,h):(t.options.explicitRoot&&(f=h,(h=Object.create(null))[u]=f),t.resultObject=h,t.saxParser.ended=!0,t.emit("end",t.resultObject))}}(this),i=function(t){return function(i){var n,o;if(o=r[r.length-1])return o[e]+=i,t.options.explicitChildren&&t.options.preserveChildrenOrder&&t.options.charsAsChildren&&(t.options.includeWhiteChars||""!==i.replace(/\\n/g,"").trim())&&(o[t.options.childkey]=o[t.options.childkey]||[],(n={"#name":"__text__"})[e]=i,t.options.normalize&&(n[e]=n[e].replace(/\s{2,}/g," ").trim()),o[t.options.childkey].push(n)),o}}(this),this.saxParser.ontext=i,this.saxParser.oncdata=function(t){var e;if(e=i(t))return e.cdata=!0}},n.prototype.parseString=function(e,i){var r;null!=i&&"function"==typeof i&&(this.on("end",(function(t){return this.reset(),i(null,t)})),this.on("error",(function(t){return this.reset(),i(t)})));try{return""===(e=e.toString()).trim()?(this.emit("end",null),!0):(e=t.stripBOM(e),this.options.async?(this.remaining=e,u(this.processAsync),this.saxParser):this.saxParser.write(e).close())}catch(t){if(r=t,!this.saxParser.errThrown&&!this.saxParser.ended)return this.emit("error",r),this.saxParser.errThrown=!0;if(this.saxParser.ended)throw r}},n.prototype.parseStringPromise=function(t){return new Promise((e=this,function(i,r){return e.parseString(t,(function(t,e){return t?r(t):i(e)}))}));var e},n}(n),e.parseString=function(t,i,r){var n,o;return null!=r?("function"==typeof r&&(n=r),"object"==typeof i&&(o=i)):("function"==typeof i&&(n=i),o={}),new e.Parser(o).parseString(t,n)},e.parseStringPromise=function(t,i){var r;return"object"==typeof i&&(r=i),new e.Parser(r).parseStringPromise(t)}}).call(this)},function(t,e,i){(function(t){!function(e){e.parser=function(t,e){return new o(t,e)},e.SAXParser=o,e.SAXStream=l,e.createStream=function(t,e){return new l(t,e)},e.MAX_BUFFER_LENGTH=65536;var r,n=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function o(t,i){if(!(this instanceof o))return new o(t,i);var r=this;!function(t){for(var e=0,i=n.length;e"===o?(I(i,"onsgmldeclaration",i.sgmlDecl),i.sgmlDecl="",i.state=T.TEXT):v(o)?(i.state=T.SGML_DECL_QUOTED,i.sgmlDecl+=o):i.sgmlDecl+=o;continue;case T.SGML_DECL_QUOTED:o===i.q&&(i.state=T.SGML_DECL,i.q=""),i.sgmlDecl+=o;continue;case T.DOCTYPE:">"===o?(i.state=T.TEXT,I(i,"ondoctype",i.doctype),i.doctype=!0):(i.doctype+=o,"["===o?i.state=T.DOCTYPE_DTD:v(o)&&(i.state=T.DOCTYPE_QUOTED,i.q=o));continue;case T.DOCTYPE_QUOTED:i.doctype+=o,o===i.q&&(i.q="",i.state=T.DOCTYPE);continue;case T.DOCTYPE_DTD:i.doctype+=o,"]"===o?i.state=T.DOCTYPE:v(o)&&(i.state=T.DOCTYPE_DTD_QUOTED,i.q=o);continue;case T.DOCTYPE_DTD_QUOTED:i.doctype+=o,o===i.q&&(i.state=T.DOCTYPE_DTD,i.q="");continue;case T.COMMENT:"-"===o?i.state=T.COMMENT_ENDING:i.comment+=o;continue;case T.COMMENT_ENDING:"-"===o?(i.state=T.COMMENT_ENDED,i.comment=O(i.opt,i.comment),i.comment&&I(i,"oncomment",i.comment),i.comment=""):(i.comment+="-"+o,i.state=T.COMMENT);continue;case T.COMMENT_ENDED:">"!==o?(D(i,"Malformed comment"),i.comment+="--"+o,i.state=T.COMMENT):i.state=T.TEXT;continue;case T.CDATA:"]"===o?i.state=T.CDATA_ENDING:i.cdata+=o;continue;case T.CDATA_ENDING:"]"===o?i.state=T.CDATA_ENDING_2:(i.cdata+="]"+o,i.state=T.CDATA);continue;case T.CDATA_ENDING_2:">"===o?(i.cdata&&I(i,"oncdata",i.cdata),I(i,"onclosecdata"),i.cdata="",i.state=T.TEXT):"]"===o?i.cdata+="]":(i.cdata+="]]"+o,i.state=T.CDATA);continue;case T.PROC_INST:"?"===o?i.state=T.PROC_INST_ENDING:_(o)?i.state=T.PROC_INST_BODY:i.procInstName+=o;continue;case T.PROC_INST_BODY:if(!i.procInstBody&&_(o))continue;"?"===o?i.state=T.PROC_INST_ENDING:i.procInstBody+=o;continue;case T.PROC_INST_ENDING:">"===o?(I(i,"onprocessinginstruction",{name:i.procInstName,body:i.procInstBody}),i.procInstName=i.procInstBody="",i.state=T.TEXT):(i.procInstBody+="?"+o,i.state=T.PROC_INST_BODY);continue;case T.OPEN_TAG:b(m,o)?i.tagName+=o:(z(i),">"===o?B(i):"/"===o?i.state=T.OPEN_TAG_SLASH:(_(o)||D(i,"Invalid character in tag name"),i.state=T.ATTRIB));continue;case T.OPEN_TAG_SLASH:">"===o?(B(i,!0),V(i)):(D(i,"Forward-slash in opening tag not followed by >"),i.state=T.ATTRIB);continue;case T.ATTRIB:if(_(o))continue;">"===o?B(i):"/"===o?i.state=T.OPEN_TAG_SLASH:b(f,o)?(i.attribName=o,i.attribValue="",i.state=T.ATTRIB_NAME):D(i,"Invalid attribute name");continue;case T.ATTRIB_NAME:"="===o?i.state=T.ATTRIB_VALUE:">"===o?(D(i,"Attribute without value"),i.attribValue=i.attribName,N(i),B(i)):_(o)?i.state=T.ATTRIB_NAME_SAW_WHITE:b(m,o)?i.attribName+=o:D(i,"Invalid attribute name");continue;case T.ATTRIB_NAME_SAW_WHITE:if("="===o)i.state=T.ATTRIB_VALUE;else{if(_(o))continue;D(i,"Attribute without value"),i.tag.attributes[i.attribName]="",i.attribValue="",I(i,"onattribute",{name:i.attribName,value:""}),i.attribName="",">"===o?B(i):b(f,o)?(i.attribName=o,i.state=T.ATTRIB_NAME):(D(i,"Invalid attribute name"),i.state=T.ATTRIB)}continue;case T.ATTRIB_VALUE:if(_(o))continue;v(o)?(i.q=o,i.state=T.ATTRIB_VALUE_QUOTED):(D(i,"Unquoted attribute value"),i.state=T.ATTRIB_VALUE_UNQUOTED,i.attribValue=o);continue;case T.ATTRIB_VALUE_QUOTED:if(o!==i.q){"&"===o?i.state=T.ATTRIB_VALUE_ENTITY_Q:i.attribValue+=o;continue}N(i),i.q="",i.state=T.ATTRIB_VALUE_CLOSED;continue;case T.ATTRIB_VALUE_CLOSED:_(o)?i.state=T.ATTRIB:">"===o?B(i):"/"===o?i.state=T.OPEN_TAG_SLASH:b(f,o)?(D(i,"No whitespace between attributes"),i.attribName=o,i.attribValue="",i.state=T.ATTRIB_NAME):D(i,"Invalid attribute name");continue;case T.ATTRIB_VALUE_UNQUOTED:if(!x(o)){"&"===o?i.state=T.ATTRIB_VALUE_ENTITY_U:i.attribValue+=o;continue}N(i),">"===o?B(i):i.state=T.ATTRIB;continue;case T.CLOSE_TAG:if(i.tagName)">"===o?V(i):b(m,o)?i.tagName+=o:i.script?(i.script+=""===o?V(i):D(i,"Invalid characters in closing tag");continue;case T.TEXT_ENTITY:case T.ATTRIB_VALUE_ENTITY_Q:case T.ATTRIB_VALUE_ENTITY_U:var h,p;switch(i.state){case T.TEXT_ENTITY:h=T.TEXT,p="textNode";break;case T.ATTRIB_VALUE_ENTITY_Q:h=T.ATTRIB_VALUE_QUOTED,p="attribValue";break;case T.ATTRIB_VALUE_ENTITY_U:h=T.ATTRIB_VALUE_UNQUOTED,p="attribValue"}";"===o?(i[p]+=U(i),i.entity="",i.state=h):b(i.entity.length?y:g,o)?i.entity+=o:(D(i,"Invalid character in entity name"),i[p]+="&"+i.entity+o,i.entity="",i.state=h);continue;default:throw new Error(i,"Unknown state: "+i.state)}return i.position>=i.bufferCheckPosition&&function(t){for(var i=Math.max(e.MAX_BUFFER_LENGTH,10),r=0,o=0,a=n.length;oi)switch(n[o]){case"textNode":P(t);break;case"cdata":I(t,"oncdata",t.cdata),t.cdata="";break;case"script":I(t,"onscript",t.script),t.script="";break;default:k(t,"Max buffer length exceeded: "+n[o])}r=Math.max(r,l)}var c=e.MAX_BUFFER_LENGTH-r;t.bufferCheckPosition=c+t.position}(i),i} /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var t;P(t=this),""!==t.cdata&&(I(t,"oncdata",t.cdata),t.cdata=""),""!==t.script&&(I(t,"onscript",t.script),t.script="")}};try{r=i(396).Stream}catch(t){r=function(){}}var a=e.EVENTS.filter((function(t){return"error"!==t&&"end"!==t}));function l(t,e){if(!(this instanceof l))return new l(t,e);r.apply(this),this._parser=new o(t,e),this.writable=!0,this.readable=!0;var i=this;this._parser.onend=function(){i.emit("end")},this._parser.onerror=function(t){i.emit("error",t),i._parser.error=null},this._decoder=null,a.forEach((function(t){Object.defineProperty(i,"on"+t,{get:function(){return i._parser["on"+t]},set:function(e){if(!e)return i.removeAllListeners(t),i._parser["on"+t]=e,e;i.on(t,e)},enumerable:!0,configurable:!1})}))}l.prototype=Object.create(r.prototype,{constructor:{value:l}}),l.prototype.write=function(e){if("function"==typeof t&&"function"==typeof t.isBuffer&&t.isBuffer(e)){if(!this._decoder){var r=i(211).StringDecoder;this._decoder=new r("utf8")}e=this._decoder.write(e)}return this._parser.write(e.toString()),this.emit("data",e),!0},l.prototype.end=function(t){return t&&t.length&&this.write(t),this._parser.end(),!0},l.prototype.on=function(t,e){var i=this;return i._parser["on"+t]||-1===a.indexOf(t)||(i._parser["on"+t]=function(){var e=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);e.splice(0,0,t),i.emit.apply(i,e)}),r.prototype.on.call(i,t,e)};var c="[CDATA[",u="DOCTYPE",h="http://www.w3.org/XML/1998/namespace",p="http://www.w3.org/2000/xmlns/",d={xml:h,xmlns:p},f=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,m=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,g=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,y=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function _(t){return" "===t||"\n"===t||"\r"===t||"\t"===t}function v(t){return'"'===t||"'"===t}function x(t){return">"===t||_(t)}function b(t,e){return t.test(e)}function w(t,e){return!b(t,e)}var C,S,M,T=0;for(var E in e.STATE={BEGIN:T++,BEGIN_WHITESPACE:T++,TEXT:T++,TEXT_ENTITY:T++,OPEN_WAKA:T++,SGML_DECL:T++,SGML_DECL_QUOTED:T++,DOCTYPE:T++,DOCTYPE_QUOTED:T++,DOCTYPE_DTD:T++,DOCTYPE_DTD_QUOTED:T++,COMMENT_STARTING:T++,COMMENT:T++,COMMENT_ENDING:T++,COMMENT_ENDED:T++,CDATA:T++,CDATA_ENDING:T++,CDATA_ENDING_2:T++,PROC_INST:T++,PROC_INST_BODY:T++,PROC_INST_ENDING:T++,OPEN_TAG:T++,OPEN_TAG_SLASH:T++,ATTRIB:T++,ATTRIB_NAME:T++,ATTRIB_NAME_SAW_WHITE:T++,ATTRIB_VALUE:T++,ATTRIB_VALUE_QUOTED:T++,ATTRIB_VALUE_CLOSED:T++,ATTRIB_VALUE_UNQUOTED:T++,ATTRIB_VALUE_ENTITY_Q:T++,ATTRIB_VALUE_ENTITY_U:T++,CLOSE_TAG:T++,CLOSE_TAG_SAW_WHITE:T++,SCRIPT:T++,SCRIPT_ENDING:T++},e.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},e.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(e.ENTITIES).forEach((function(t){var i=e.ENTITIES[t],r="number"==typeof i?String.fromCharCode(i):i;e.ENTITIES[t]=r})),e.STATE)e.STATE[e.STATE[E]]=E;function A(t,e,i){t[e]&&t[e](i)}function I(t,e,i){t.textNode&&P(t),A(t,e,i)}function P(t){t.textNode=O(t.opt,t.textNode),t.textNode&&A(t,"ontext",t.textNode),t.textNode=""}function O(t,e){return t.trim&&(e=e.trim()),t.normalize&&(e=e.replace(/\s+/g," ")),e}function k(t,e){return P(t),t.trackPosition&&(e+="\nLine: "+t.line+"\nColumn: "+t.column+"\nChar: "+t.c),e=new Error(e),t.error=e,A(t,"onerror",e),t}function F(t){return t.sawRoot&&!t.closedRoot&&D(t,"Unclosed root tag"),t.state!==T.BEGIN&&t.state!==T.BEGIN_WHITESPACE&&t.state!==T.TEXT&&k(t,"Unexpected end"),P(t),t.c="",t.closed=!0,A(t,"onend"),o.call(t,t.strict,t.opt),t}function D(t,e){if("object"!=typeof t||!(t instanceof o))throw new Error("bad call to strictFail");t.strict&&k(t,e)}function z(t){t.strict||(t.tagName=t.tagName[t.looseCase]());var e=t.tags[t.tags.length-1]||t,i=t.tag={name:t.tagName,attributes:{}};t.opt.xmlns&&(i.ns=e.ns),t.attribList.length=0,I(t,"onopentagstart",i)}function j(t,e){var i=t.indexOf(":")<0?["",t]:t.split(":"),r=i[0],n=i[1];return e&&"xmlns"===t&&(r="xmlns",n=""),{prefix:r,local:n}}function N(t){if(t.strict||(t.attribName=t.attribName[t.looseCase]()),-1!==t.attribList.indexOf(t.attribName)||t.tag.attributes.hasOwnProperty(t.attribName))t.attribName=t.attribValue="";else{if(t.opt.xmlns){var e=j(t.attribName,!0),i=e.prefix,r=e.local;if("xmlns"===i)if("xml"===r&&t.attribValue!==h)D(t,"xml: prefix must be bound to "+h+"\nActual: "+t.attribValue);else if("xmlns"===r&&t.attribValue!==p)D(t,"xmlns: prefix must be bound to "+p+"\nActual: "+t.attribValue);else{var n=t.tag,o=t.tags[t.tags.length-1]||t;n.ns===o.ns&&(n.ns=Object.create(o.ns)),n.ns[r]=t.attribValue}t.attribList.push([t.attribName,t.attribValue])}else t.tag.attributes[t.attribName]=t.attribValue,I(t,"onattribute",{name:t.attribName,value:t.attribValue});t.attribName=t.attribValue=""}}function B(t,e){if(t.opt.xmlns){var i=t.tag,r=j(t.tagName);i.prefix=r.prefix,i.local=r.local,i.uri=i.ns[r.prefix]||"",i.prefix&&!i.uri&&(D(t,"Unbound namespace prefix: "+JSON.stringify(t.tagName)),i.uri=r.prefix);var n=t.tags[t.tags.length-1]||t;i.ns&&n.ns!==i.ns&&Object.keys(i.ns).forEach((function(e){I(t,"onopennamespace",{prefix:e,uri:i.ns[e]})}));for(var o=0,a=t.attribList.length;o",t.tagName="",void(t.state=T.SCRIPT);I(t,"onscript",t.script),t.script=""}var e=t.tags.length,i=t.tagName;t.strict||(i=i[t.looseCase]());for(var r=i;e--&&t.tags[e].name!==r;)D(t,"Unexpected close tag");if(e<0)return D(t,"Unmatched closing tag: "+t.tagName),t.textNode+="",void(t.state=T.TEXT);t.tagName=i;for(var n=t.tags.length;n-- >e;){var o=t.tag=t.tags.pop();t.tagName=t.tag.name,I(t,"onclosetag",t.tagName);var a={};for(var l in o.ns)a[l]=o.ns[l];var c=t.tags[t.tags.length-1]||t;t.opt.xmlns&&o.ns!==c.ns&&Object.keys(o.ns).forEach((function(e){var i=o.ns[e];I(t,"onclosenamespace",{prefix:e,uri:i})}))}0===e&&(t.closedRoot=!0),t.tagName=t.attribValue=t.attribName="",t.attribList.length=0,t.state=T.TEXT}function U(t){var e,i=t.entity,r=i.toLowerCase(),n="";return t.ENTITIES[i]?t.ENTITIES[i]:t.ENTITIES[r]?t.ENTITIES[r]:("#"===(i=r).charAt(0)&&("x"===i.charAt(1)?(i=i.slice(2),n=(e=parseInt(i,16)).toString(16)):(i=i.slice(1),n=(e=parseInt(i,10)).toString(10))),i=i.replace(/^0+/,""),isNaN(e)||n.toLowerCase()!==i?(D(t,"Invalid character entity"),"&"+t.entity+";"):String.fromCodePoint(e))}function H(t,e){"<"===e?(t.state=T.OPEN_WAKA,t.startTagPosition=t.position):_(e)||(D(t,"Non-whitespace before first tag."),t.textNode=e,t.state=T.TEXT)}function G(t,e){var i="";return e1114111||S(a)!==a)throw RangeError("Invalid code point: "+a);a<=65535?i.push(a):(t=55296+((a-=65536)>>10),e=a%1024+56320,i.push(t,e)),(r+1===n||i.length>16384)&&(o+=C.apply(null,i),i.length=0)}return o},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:M,configurable:!0,writable:!0}):String.fromCodePoint=M)}(e)}).call(this,i(141).Buffer)},function(t,e,i){t.exports=n;var r=i(125).EventEmitter;function n(){r.call(this)}i(128)(n,r),n.Readable=i(208),n.Writable=i(405),n.Duplex=i(406),n.Transform=i(407),n.PassThrough=i(408),n.Stream=n,n.prototype.pipe=function(t,e){var i=this;function n(e){t.writable&&!1===t.write(e)&&i.pause&&i.pause()}function o(){i.readable&&i.resume&&i.resume()}i.on("data",n),t.on("drain",o),t._isStdio||e&&!1===e.end||(i.on("end",l),i.on("close",c));var a=!1;function l(){a||(a=!0,t.end())}function c(){a||(a=!0,"function"==typeof t.destroy&&t.destroy())}function u(t){if(h(),0===r.listenerCount(this,"error"))throw t}function h(){i.removeListener("data",n),t.removeListener("drain",o),i.removeListener("end",l),i.removeListener("close",c),i.removeListener("error",u),t.removeListener("error",u),i.removeListener("end",h),i.removeListener("close",h),t.removeListener("close",h)}return i.on("error",u),t.on("error",u),i.on("end",h),i.on("close",h),t.on("close",h),t.emit("pipe",i),t}},function(t,e,i){t.exports=i(22)(2946)},function(t,e){},function(t,e,i){"use strict";var r=i(209).Buffer,n=i(400);t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,i=""+e.data;e=e.next;)i+=t+e.data;return i},t.prototype.concat=function(t){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var e,i,n=r.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=n,i=a,o.data.copy(e,i),a+=o.data.length,o=o.next;return n},t}(),n&&n.inspect&&n.inspect.custom&&(t.exports.prototype[n.inspect.custom]=function(){var t=n.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,i){(function(t,e){!function(t,i){"use strict";if(!t.setImmediate){var r,n,o,a,l,c=1,u={},h=!1,p=t.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(t);d=d&&d.setTimeout?d:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick((function(){m(t)}))}:function(){if(t.postMessage&&!t.importScripts){var e=!0,i=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=i,e}}()?(a="setImmediate$"+Math.random()+"$",l=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(a)&&m(+e.data.slice(a.length))},t.addEventListener?t.addEventListener("message",l,!1):t.attachEvent("onmessage",l),r=function(e){t.postMessage(a+e,"*")}):t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){m(t.data)},r=function(t){o.port2.postMessage(t)}):p&&"onreadystatechange"in p.createElement("script")?(n=p.documentElement,r=function(t){var e=p.createElement("script");e.onreadystatechange=function(){m(t),e.onreadystatechange=null,n.removeChild(e),e=null},n.appendChild(e)}):r=function(t){setTimeout(m,0,t)},d.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),i=0;ii?i:t:te?e:t}},function(t,e,i){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),i(413),i(414),i(415);var r=i(416),n=i(417);i(418),i(419),i(420),i(421),i(422),i(423),i(424);var o=i(425),a=i(2),l=i(426),c=i(427);i(428),i(429),i(430),i(431),i(432);var u=i(433);i(435),i(436);var h=i(437);i(438),i(439);var p=i(440),d=i(441),f=i(267);i(442),i(443),i(444),i(445),i(446);var m=i(447);i(448),i(449);var g=i(450);i(452),i(453);var y=i(454);i(455);var _=i(456);i(457),i(458),i(459),i(460),i(461);var v=i(462);function x(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var b=x(r),w=x(n),C=x(o),S=x(a),M=x(l),T=x(c),E=x(u),A=x(h),I=x(p),P=x(d),O=x(f),k=x(m),F=x(g),D=x(_),z=Object.freeze({__proto__:null,offscreen:function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).DOMParser,e={window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:t,createCanvas:function(t,e){return new OffscreenCanvas(t,e)},createImage:function(t){return w.default(b.default.mark((function e(){var i,r,n;return b.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(t);case 2:return i=e.sent,e.next=5,i.blob();case 5:return r=e.sent,e.next=8,createImageBitmap(r);case 8:return n=e.sent,e.abrupt("return",n);case 10:case"end":return e.stop()}}),e)})))()}};return"undefined"==typeof DOMParser&&void 0!==t||Reflect.deleteProperty(e,"DOMParser"),e},node:function(t){var e=t.DOMParser,i=t.canvas;return{window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:e,fetch:t.fetch,createCanvas:i.createCanvas,createImage:i.loadImage}}});function j(t){return t.replace(/(?!\u3000)\s+/gm," ")}function N(t){return t.replace(/^[\n \t]+/,"")}function B(t){return t.replace(/[\n \t]+$/,"")}function V(t){return((t||"").match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm)||[]).map(parseFloat)}var U=/^[A-Z-]+$/;function H(t){return U.test(t)?t.toLowerCase():t}function G(t){var e=/url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(t)||[];return e[2]||e[3]||e[4]}function q(t){if(!t.startsWith("rgb"))return t;var e=3;return t.replace(/\d+(\.\d+)?/g,(function(t,i){return e--&&i?String(Math.round(parseFloat(t))):t}))}var Z=/(\[[^\]]+\])/g,$=/(#[^\s+>~.[:]+)/g,W=/(\.[^\s+>~.[:]+)/g,X=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,Y=/(:[\w-]+\([^)]*\))/gi,K=/(:[^\s+>~.[:]+)/g,J=/([^\s+>~.[:]+)/g;function tt(t,e){var i=e.exec(t);return i?[t.replace(e," "),i.length]:[t,0]}function et(t){var e=[0,0,0],i=t.replace(/:not\(([^)]*)\)/g," $1 ").replace(/{[\s\S]*/gm," "),r=0,n=tt(i,Z),o=C.default(n,2);i=o[0],r=o[1],e[1]+=r;var a=tt(i,$),l=C.default(a,2);i=l[0],r=l[1],e[0]+=r;var c=tt(i,W),u=C.default(c,2);i=u[0],r=u[1],e[1]+=r;var h=tt(i,X),p=C.default(h,2);i=p[0],r=p[1],e[2]+=r;var d=tt(i,Y),f=C.default(d,2);i=f[0],r=f[1],e[1]+=r;var m=tt(i,K),g=C.default(m,2);i=g[0],r=g[1],e[1]+=r;var y=tt(i=i.replace(/[*\s+>~]/g," ").replace(/[#.]/g," "),J),_=C.default(y,2);return i=_[0],r=_[1],e[2]+=r,e.join("")}var it=1e-8;function ot(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2))}function at(t,e){return(t[0]*e[0]+t[1]*e[1])/(ot(t)*ot(e))}function lt(t,e){return(t[0]*e[1]0&&void 0!==arguments[0]?arguments[0]:" ",i=this.document,r=this.name;return j(this.getString()).trim().split(e).map((function(e){return new t(i,r,e)}))}},{key:"hasValue",value:function(t){var e=this.value;return null!==e&&""!==e&&(t||0!==e)&&void 0!==e}},{key:"isString",value:function(t){var e=this.value,i="string"==typeof e;return i&&t?t.test(e):i}},{key:"isUrlDefinition",value:function(){return this.isString(/^url\(/)}},{key:"isPixels",value:function(){if(!this.hasValue())return!1;var t=this.getString();switch(!0){case t.endsWith("px"):case/^[0-9]+$/.test(t):return!0;default:return!1}}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"getValue",value:function(t){return void 0===t||this.hasValue()?this.value:t}},{key:"getNumber",value:function(t){if(!this.hasValue())return void 0===t?0:parseFloat(t);var e=this.value,i=parseFloat(e);return this.isString(/%$/)&&(i/=100),i}},{key:"getString",value:function(t){return void 0===t||this.hasValue()?void 0===this.value?"":String(this.value):String(t)}},{key:"getColor",value:function(t){var e=this.getString(t);return this.isNormalizedColor||(this.isNormalizedColor=!0,e=q(e),this.value=e),e}},{key:"getDpi",value:function(){return 96}},{key:"getRem",value:function(){return this.document.rootEmSize}},{key:"getEm",value:function(){return this.document.emSize}},{key:"getUnits",value:function(){return this.getString().replace(/[0-9.-]/g,"")}},{key:"getPixels",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.hasValue())return 0;var i="boolean"==typeof t?[void 0,t]:[t],r=C.default(i,2),n=r[0],o=r[1],a=this.document.screen.viewPort;switch(!0){case this.isString(/vmin$/):return this.getNumber()/100*Math.min(a.computeSize("x"),a.computeSize("y"));case this.isString(/vmax$/):return this.getNumber()/100*Math.max(a.computeSize("x"),a.computeSize("y"));case this.isString(/vw$/):return this.getNumber()/100*a.computeSize("x");case this.isString(/vh$/):return this.getNumber()/100*a.computeSize("y");case this.isString(/rem$/):return this.getNumber()*this.getRem();case this.isString(/em$/):return this.getNumber()*this.getEm();case this.isString(/ex$/):return this.getNumber()*this.getEm()/2;case this.isString(/px$/):return this.getNumber();case this.isString(/pt$/):return this.getNumber()*this.getDpi()*(1/72);case this.isString(/pc$/):return 15*this.getNumber();case this.isString(/cm$/):return this.getNumber()*this.getDpi()/2.54;case this.isString(/mm$/):return this.getNumber()*this.getDpi()/25.4;case this.isString(/in$/):return this.getNumber()*this.getDpi();case this.isString(/%$/)&&o:return this.getNumber()*this.getEm();case this.isString(/%$/):return this.getNumber()*a.computeSize(n);default:var l=this.getNumber();return e&&l<1?l*a.computeSize(n):l}}},{key:"getMilliseconds",value:function(){return this.hasValue()?this.isString(/ms$/)?this.getNumber():1e3*this.getNumber():0}},{key:"getRadians",value:function(){if(!this.hasValue())return 0;switch(!0){case this.isString(/deg$/):return this.getNumber()*(Math.PI/180);case this.isString(/grad$/):return this.getNumber()*(Math.PI/200);case this.isString(/rad$/):return this.getNumber();default:return this.getNumber()*(Math.PI/180)}}},{key:"getDefinition",value:function(){var t=this.getString(),e=/#([^)'"]+)/.exec(t);return e&&(e=e[1]),e||(e=t),this.document.definitions[e]}},{key:"getFillStyleDefinition",value:function(t,e){var i=this.getDefinition();if(!i)return null;if("function"==typeof i.createGradient)return i.createGradient(this.document.ctx,t,e);if("function"==typeof i.createPattern){if(i.getHrefAttribute().hasValue()){var r=i.getAttribute("patternTransform");i=i.getHrefAttribute().getDefinition(),r.hasValue()&&i.getAttribute("patternTransform",!0).setValue(r.value)}return i.createPattern(this.document.ctx,t,e)}return null}},{key:"getTextBaseline",value:function(){return this.hasValue()?t.textBaselineMapping[this.getString()]:null}},{key:"addOpacity",value:function(e){for(var i=this.getColor(),r=i.length,n=0,o=0;o1&&void 0!==arguments[1]?arguments[1]:0,r=V(e),n=C.default(r,2),o=n[0],a=void 0===o?i:o,l=n[1];return new t(a,void 0===l?i:l)}},{key:"parseScale",value:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=V(e),n=C.default(r,2),o=n[0],a=void 0===o?i:o,l=n[1];return new t(a,void 0===l?a:l)}},{key:"parsePath",value:function(e){for(var i=V(e),r=i.length,n=[],o=0;o0}},{key:"runEvents",value:function(){if(this.working){var t=this.screen,e=this.events,i=this.eventElements,r=t.ctx.canvas.style;r&&(r.cursor=""),e.forEach((function(t,e){for(var r=t.run,n=i[e];n;)r(n),n=n.parent})),this.events=[],this.eventElements=[]}}},{key:"checkPath",value:function(t,e){if(this.working&&e){var i=this.events,r=this.eventElements;i.forEach((function(i,n){var o=i.x,a=i.y;!r[n]&&e.isPointInPath&&e.isPointInPath(o,a)&&(r[n]=t)}))}}},{key:"checkBoundingBox",value:function(t,e){if(this.working&&e){var i=this.events,r=this.eventElements;i.forEach((function(i,n){var o=i.x,a=i.y;!r[n]&&e.isPointInBox(o,a)&&(r[n]=t)}))}}},{key:"mapXY",value:function(t,e){for(var i=this.screen,r=i.window,n=i.ctx,o=new _t(t,e),a=n.canvas;a;)o.x-=a.offsetLeft,o.y-=a.offsetTop,a=a.offsetParent;return r.scrollX&&(o.x+=r.scrollX),r.scrollY&&(o.y+=r.scrollY),o}},{key:"onClick",value:function(t){var e=this.mapXY(t.clientX,t.clientY),i=e.x,r=e.y;this.events.push({type:"onclick",x:i,y:r,run:function(t){t.onClick&&t.onClick()}})}},{key:"onMouseMove",value:function(t){var e=this.mapXY(t.clientX,t.clientY),i=e.x,r=e.y;this.events.push({type:"onmousemove",x:i,y:r,run:function(t){t.onMouseMove&&t.onMouseMove()}})}}]),t}(),Ct="undefined"!=typeof window?window:null,St="undefined"!=typeof fetch?fetch.bind(void 0):null,Mt=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.fetch,n=void 0===r?St:r,o=i.window,a=void 0===o?Ct:o;M.default(this,t),this.ctx=e,this.FRAMERATE=30,this.MAX_VIRTUAL_PIXELS=3e4,this.CLIENT_WIDTH=800,this.CLIENT_HEIGHT=600,this.viewPort=new yt,this.mouse=new vt(this),this.animations=[],this.waits=[],this.frameDuration=0,this.isReadyLock=!1,this.isFirstRender=!0,this.intervalId=null,this.window=a,this.fetch=n}return T.default(t,[{key:"wait",value:function(t){this.waits.push(t)}},{key:"ready",value:function(){return this.readyPromise?this.readyPromise:Promise.resolve()}},{key:"isReady",value:function(){if(this.isReadyLock)return!0;var t=this.waits.every((function(t){return t()}));return t&&(this.waits=[],this.resolveReady&&this.resolveReady()),this.isReadyLock=t,t}},{key:"setDefaults",value:function(t){t.strokeStyle="rgba(0,0,0,0)",t.lineCap="butt",t.lineJoin="miter",t.miterLimit=4}},{key:"setViewBox",value:function(t){var e=t.document,i=t.ctx,r=t.aspectRatio,n=t.width,o=t.desiredWidth,a=t.height,l=t.desiredHeight,c=t.minX,u=void 0===c?0:c,h=t.minY,p=void 0===h?0:h,d=t.refX,f=t.refY,m=t.clip,g=void 0!==m&&m,y=t.clipX,_=void 0===y?0:y,v=t.clipY,x=void 0===v?0:v,b=j(r).replace(/^defer\s/,"").split(" "),w=C.default(b,2),S=w[0]||"xMidYMid",M=w[1]||"meet",T=n/o,E=a/l,A=Math.min(T,E),I=Math.max(T,E),P=o,O=l;"meet"===M&&(P*=A,O*=A),"slice"===M&&(P*=I,O*=I);var k=new gt(e,"refX",d),F=new gt(e,"refY",f),D=k.hasValue()&&F.hasValue();if(D&&i.translate(-A*k.getPixels("x"),-A*F.getPixels("y")),g){var z=A*_,N=A*x;i.beginPath(),i.moveTo(z,N),i.lineTo(n,N),i.lineTo(n,a),i.lineTo(z,a),i.closePath(),i.clip()}if(!D){var B="meet"===M&&A===E,V="slice"===M&&I===E,U="meet"===M&&A===T,H="slice"===M&&I===T;S.startsWith("xMid")&&(B||V)&&i.translate(n/2-P/2,0),S.endsWith("YMid")&&(U||H)&&i.translate(0,a/2-O/2),S.startsWith("xMax")&&(B||V)&&i.translate(n-P,0),S.endsWith("YMax")&&(U||H)&&i.translate(0,a-O)}switch(!0){case"none"===S:i.scale(T,E);break;case"meet"===M:i.scale(A,A);break;case"slice"===M:i.scale(I,I)}i.translate(-u,-p)}},{key:"start",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.enableRedraw,n=void 0!==r&&r,o=i.ignoreMouse,a=void 0!==o&&o,l=i.ignoreAnimation,c=void 0!==l&&l,u=i.ignoreDimensions,h=void 0!==u&&u,p=i.ignoreClear,d=void 0!==p&&p,f=i.forceRedraw,m=i.scaleWidth,g=i.scaleHeight,y=i.offsetX,_=i.offsetY,v=this.FRAMERATE,x=this.mouse,b=1e3/v;if(this.frameDuration=b,this.readyPromise=new Promise((function(t){e.resolveReady=t})),this.isReady()&&this.render(t,h,d,m,g,y,_),n){var w=Date.now(),C=w,S=0;a||x.start(),this.intervalId=E.default((function i(){w=Date.now(),(S=w-C)>=b&&(C=w-S%b,e.shouldUpdate(c,f)&&(e.render(t,h,d,m,g,y,_),x.runEvents())),e.intervalId=E.default(i)}))}}},{key:"stop",value:function(){this.intervalId&&(E.default.cancel(this.intervalId),this.intervalId=null),this.mouse.stop()}},{key:"shouldUpdate",value:function(t,e){if(!t){var i=this.frameDuration;if(this.animations.reduce((function(t,e){return e.update(i)||t}),!1))return!0}return!("function"!=typeof e||!e())||!(this.isReadyLock||!this.isReady())||!!this.mouse.hasEvents()}},{key:"render",value:function(t,e,i,r,n,o,a){var l=this.CLIENT_WIDTH,c=this.CLIENT_HEIGHT,u=this.viewPort,h=this.ctx,p=this.isFirstRender,d=h.canvas;u.clear(),d.width&&d.height?u.setCurrent(d.width,d.height):u.setCurrent(l,c);var f=t.getStyle("width"),m=t.getStyle("height");!e&&(p||"number"!=typeof r&&"number"!=typeof n)&&(f.hasValue()&&(d.width=f.getPixels("x"),d.style&&(d.style.width="".concat(d.width,"px"))),m.hasValue()&&(d.height=m.getPixels("y"),d.style&&(d.style.height="".concat(d.height,"px"))));var g=d.clientWidth||d.width,y=d.clientHeight||d.height;if(e&&f.hasValue()&&m.hasValue()&&(g=f.getPixels("x"),y=m.getPixels("y")),u.setCurrent(g,y),"number"==typeof o&&t.getAttribute("x",!0).setValue(o),"number"==typeof a&&t.getAttribute("y",!0).setValue(a),"number"==typeof r||"number"==typeof n){var _=V(t.getAttribute("viewBox").getString()),v=0,x=0;if("number"==typeof r){var b=t.getStyle("width");b.hasValue()?v=b.getPixels("x")/r:isNaN(_[2])||(v=_[2]/r)}if("number"==typeof n){var w=t.getStyle("height");w.hasValue()?x=w.getPixels("y")/n:isNaN(_[3])||(x=_[3]/n)}v||(v=x),x||(x=v),t.getAttribute("width",!0).setValue(r),t.getAttribute("height",!0).setValue(n);var C=t.getStyle("transform",!0,!0);C.setValue("".concat(C.getString()," scale(").concat(1/v,", ").concat(1/x,")"))}i||h.clearRect(0,0,g,y),t.render(h),p&&(this.isFirstRender=!1)}}]),t}();Mt.defaultWindow=Ct,Mt.defaultFetch=St;var Tt=Mt.defaultFetch,Et="undefined"!=typeof DOMParser?DOMParser:null,At=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.fetch,r=void 0===i?Tt:i,n=e.DOMParser,o=void 0===n?Et:n;M.default(this,t),this.fetch=r,this.DOMParser=o}var e,i;return T.default(t,[{key:"parse",value:(i=w.default(b.default.mark((function t(e){return b.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.startsWith("<")){t.next=2;break}return t.abrupt("return",this.parseFromString(e));case 2:return t.abrupt("return",this.load(e));case 3:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"parseFromString",value:function(t){var e=new this.DOMParser;try{return this.checkDocument(e.parseFromString(t,"image/svg+xml"))}catch(i){return this.checkDocument(e.parseFromString(t,"text/xml"))}}},{key:"checkDocument",value:function(t){var e=t.getElementsByTagName("parsererror")[0];if(e)throw new Error(e.textContent);return t}},{key:"load",value:(e=w.default(b.default.mark((function t(e){var i,r;return b.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.fetch(e);case 2:return i=t.sent,t.next=5,i.text();case 5:return r=t.sent,t.abrupt("return",this.parseFromString(r));case 7:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})}]),t}(),Lt=function(){function t(e,i){M.default(this,t),this.type="translate",this.point=null,this.point=_t.parse(i)}return T.default(t,[{key:"apply",value:function(t){var e=this.point,i=e.x,r=e.y;t.translate(i||0,r||0)}},{key:"unapply",value:function(t){var e=this.point,i=e.x,r=e.y;t.translate(-1*i||0,-1*r||0)}},{key:"applyToPoint",value:function(t){var e=this.point,i=e.x,r=e.y;t.applyTransform([1,0,0,1,i||0,r||0])}}]),t}(),It=function(){function t(e,i,r){M.default(this,t),this.type="rotate",this.angle=null,this.originX=null,this.originY=null,this.cx=0,this.cy=0;var n=V(i);this.angle=new gt(e,"angle",n[0]),this.originX=r[0],this.originY=r[1],this.cx=n[1]||0,this.cy=n[2]||0}return T.default(t,[{key:"apply",value:function(t){var e=this.cx,i=this.cy,r=this.originX,n=this.originY,o=this.angle,a=e+r.getPixels("x"),l=i+n.getPixels("y");t.translate(a,l),t.rotate(o.getRadians()),t.translate(-a,-l)}},{key:"unapply",value:function(t){var e=this.cx,i=this.cy,r=this.originX,n=this.originY,o=this.angle,a=e+r.getPixels("x"),l=i+n.getPixels("y");t.translate(a,l),t.rotate(-1*o.getRadians()),t.translate(-a,-l)}},{key:"applyToPoint",value:function(t){var e=this.cx,i=this.cy,r=this.angle.getRadians();t.applyTransform([1,0,0,1,e||0,i||0]),t.applyTransform([Math.cos(r),Math.sin(r),-Math.sin(r),Math.cos(r),0,0]),t.applyTransform([1,0,0,1,-e||0,-i||0])}}]),t}(),Pt=function(){function t(e,i,r){M.default(this,t),this.type="scale",this.scale=null,this.originX=null,this.originY=null;var n=_t.parseScale(i);0!==n.x&&0!==n.y||(n.x=it,n.y=it),this.scale=n,this.originX=r[0],this.originY=r[1]}return T.default(t,[{key:"apply",value:function(t){var e=this.scale,i=e.x,r=e.y,n=this.originX,o=this.originY,a=n.getPixels("x"),l=o.getPixels("y");t.translate(a,l),t.scale(i,r||i),t.translate(-a,-l)}},{key:"unapply",value:function(t){var e=this.scale,i=e.x,r=e.y,n=this.originX,o=this.originY,a=n.getPixels("x"),l=o.getPixels("y");t.translate(a,l),t.scale(1/i,1/r||i),t.translate(-a,-l)}},{key:"applyToPoint",value:function(t){var e=this.scale,i=e.x,r=e.y;t.applyTransform([i||0,0,0,r||0,0,0])}}]),t}(),Ot=function(){function t(e,i,r){M.default(this,t),this.type="matrix",this.matrix=[],this.originX=null,this.originY=null,this.matrix=V(i),this.originX=r[0],this.originY=r[1]}return T.default(t,[{key:"apply",value:function(t){var e=this.originX,i=this.originY,r=this.matrix,n=e.getPixels("x"),o=i.getPixels("y");t.translate(n,o),t.transform(r[0],r[1],r[2],r[3],r[4],r[5]),t.translate(-n,-o)}},{key:"unapply",value:function(t){var e=this.originX,i=this.originY,r=this.matrix,n=r[0],o=r[2],a=r[4],l=r[1],c=r[3],u=r[5],h=1/(n*(1*c-0*u)-o*(1*l-0*u)+a*(0*l-0*c)),p=e.getPixels("x"),d=i.getPixels("y");t.translate(p,d),t.transform(h*(1*c-0*u),h*(0*u-1*l),h*(0*a-1*o),h*(1*n-0*a),h*(o*u-a*c),h*(a*l-n*u)),t.translate(-p,-d)}},{key:"applyToPoint",value:function(t){t.applyTransform(this.matrix)}}]),t}();var kt=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(t,e,i){var o;return M.default(this,n),(o=r.call(this,t,e,i)).type="skew",o.angle=null,o.angle=new gt(t,"angle",e),o}return n}(Ot);var Ft=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(t,e,i){var o;return M.default(this,n),(o=r.call(this,t,e,i)).type="skewX",o.matrix=[1,0,Math.tan(o.angle.getRadians()),1,0,0],o}return n}(kt);var Dt=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(t,e,i){var o;return M.default(this,n),(o=r.call(this,t,e,i)).type="skewY",o.matrix=[1,Math.tan(o.angle.getRadians()),0,1,0,0],o}return n}(kt),zt=function(){function t(e,i,r){var n=this;M.default(this,t),this.document=e,this.transforms=[];var o=function(t){return j(t).trim().replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/)}(i);o.forEach((function(e){if("none"!==e){var i=function(t){var e=t.split("("),i=C.default(e,2),r=i[0],n=i[1];return[r.trim(),n.trim().replace(")","")]}(e),o=C.default(i,2),a=o[0],l=o[1],c=t.transformTypes[a];void 0!==c&&n.transforms.push(new c(n.document,l,r))}}))}return T.default(t,[{key:"apply",value:function(t){for(var e=this.transforms,i=e.length,r=0;r=0;i--)e[i].unapply(t)}},{key:"applyToPoint",value:function(t){for(var e=this.transforms,i=e.length,r=0;r2&&void 0!==arguments[2]&&arguments[2];if(M.default(this,t),this.document=e,this.node=i,this.captureTextNodes=n,this.attributes={},this.styles={},this.stylesSpecificity={},this.animationFrozen=!1,this.animationFrozenValue="",this.parent=null,this.children=[],i&&1===i.nodeType){Array.from(i.attributes).forEach((function(t){var i=H(t.nodeName);r.attributes[i]=new gt(e,i,t.value)})),this.addStylesFromStyleDefinition(),this.getAttribute("style").hasValue()&&this.getAttribute("style").getString().split(";").map((function(t){return t.trim()})).forEach((function(t){if(t){var i=t.split(":").map((function(t){return t.trim()})),n=C.default(i,2),o=n[0],a=n[1];r.styles[o]=new gt(e,o,a)}}));var o=e.definitions,a=this.getAttribute("id");a.hasValue()&&(o[a.getString()]||(o[a.getString()]=this)),Array.from(i.childNodes).forEach((function(t){if(1===t.nodeType)r.addChild(t);else if(n&&(3===t.nodeType||4===t.nodeType)){var i=e.createTextNode(t);i.getText().length>0&&r.addChild(i)}}))}}return T.default(t,[{key:"getAttribute",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.attributes[t];if(!i&&e){var r=new gt(this.document,t,"");return this.attributes[t]=r,r}return i||gt.empty(this.document)}},{key:"getHrefAttribute",value:function(){for(var t in this.attributes)if("href"===t||t.endsWith(":href"))return this.attributes[t];return gt.empty(this.document)}},{key:"getStyle",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.styles[t];if(r)return r;var n=this.getAttribute(t);if(null!=n&&n.hasValue())return this.styles[t]=n,n;if(!i){var o=this.parent;if(o){var a=o.getStyle(t);if(null!=a&&a.hasValue())return a}}if(e){var l=new gt(this.document,t,"");return this.styles[t]=l,l}return r||gt.empty(this.document)}},{key:"render",value:function(t){if("none"!==this.getStyle("display").getString()&&"hidden"!==this.getStyle("visibility").getString()){if(t.save(),this.getStyle("mask").hasValue()){var e=this.getStyle("mask").getDefinition();e&&(this.applyEffects(t),e.apply(t,this))}else if("none"!==this.getStyle("filter").getValue("none")){var i=this.getStyle("filter").getDefinition();i&&(this.applyEffects(t),i.apply(t,this))}else this.setContext(t),this.renderChildren(t),this.clearContext(t);t.restore()}}},{key:"setContext",value:function(t){}},{key:"applyEffects",value:function(t){var e=zt.fromElement(this.document,this);e&&e.apply(t);var i=this.getStyle("clip-path",!1,!0);if(i.hasValue()){var r=i.getDefinition();r&&r.apply(t)}}},{key:"clearContext",value:function(t){}},{key:"renderChildren",value:function(t){this.children.forEach((function(e){e.render(t)}))}},{key:"addChild",value:function(e){var i=e instanceof t?e:this.document.createElement(e);i.parent=this,t.ignoreChildTypes.includes(i.type)||this.children.push(i)}},{key:"matchesSelector",value:function(t){var e=this.node;if("function"==typeof e.matches)return e.matches(t);var i=e.getAttribute("class");return!(!i||""===i)&&i.split(" ").some((function(e){return".".concat(e)===t}))}},{key:"addStylesFromStyleDefinition",value:function(){var t=this.document,e=t.styles,i=t.stylesSpecificity;for(var r in e)if(!r.startsWith("@")&&this.matchesSelector(r)){var n=e[r],o=i[r];if(n)for(var a in n){var l=this.stylesSpecificity[a];void 0===l&&(l="000"),o>=l&&(this.styles[a]=n[a],this.stylesSpecificity[a]=o)}}}},{key:"removeStyles",value:function(t,e){return e.reduce((function(e,i){var r=t.getStyle(i);if(!r.hasValue())return e;var n=r.getString();return r.setValue(""),[].concat(k.default(e),[[i,n]])}),[])}},{key:"restoreStyles",value:function(t,e){e.forEach((function(e){var i=C.default(e,2),r=i[0],n=i[1];t.getStyle(r,!0).setValue(n)}))}}]),t}();Rt.ignoreChildTypes=["title"];var jt=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(t,e,i){return M.default(this,n),r.call(this,t,e,i)}return n}(Rt);function Nt(t){var e=t.trim();return/^('|")/.test(e)?e:'"'.concat(e,'"')}function Bt(t){if(!t)return"";var e=t.trim().toLowerCase();switch(e){case"normal":case"italic":case"oblique":case"inherit":case"initial":case"unset":return e;default:return/^oblique\s+(-|)\d+deg$/.test(e)?e:""}}function Vt(t){if(!t)return"";var e=t.trim().toLowerCase();switch(e){case"normal":case"bold":case"lighter":case"bolder":case"inherit":case"initial":case"unset":return e;default:return/^[\d.]+$/.test(e)?e:""}}var Ut=function(){function e(t,i,r,n,o,a){M.default(this,e);var l=a?"string"==typeof a?e.parse(a):a:{};this.fontFamily=o||l.fontFamily,this.fontSize=n||l.fontSize,this.fontStyle=t||l.fontStyle,this.fontWeight=r||l.fontWeight,this.fontVariant=i||l.fontVariant}return T.default(e,[{key:"toString",value:function(){return[Bt(this.fontStyle),this.fontVariant,Vt(this.fontWeight),this.fontSize,(e=this.fontFamily,void 0===t?e:e.trim().split(",").map(Nt).join(","))].join(" ").trim();var e}}],[{key:"parse",value:function(){var t=arguments.length>1?arguments[1]:void 0,i="",r="",n="",o="",a="",l=j(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").trim().split(" "),c={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1};return l.forEach((function(t){switch(!0){case!c.fontStyle&&e.styles.includes(t):"inherit"!==t&&(i=t),c.fontStyle=!0;break;case!c.fontVariant&&e.variants.includes(t):"inherit"!==t&&(r=t),c.fontStyle=!0,c.fontVariant=!0;break;case!c.fontWeight&&e.weights.includes(t):"inherit"!==t&&(n=t),c.fontStyle=!0,c.fontVariant=!0,c.fontWeight=!0;break;case!c.fontSize:if("inherit"!==t){var l=t.split("/"),u=C.default(l,1);o=u[0]}c.fontStyle=!0,c.fontVariant=!0,c.fontWeight=!0,c.fontSize=!0;break;default:"inherit"!==t&&(a+=t)}})),new e(i,r,n,o,a,t)}}]),e}();Ut.styles="normal|italic|oblique|inherit",Ut.variants="normal|small-caps|inherit",Ut.weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit";var Ht=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.NaN,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.NaN,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.NaN,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.NaN;M.default(this,t),this.x1=e,this.y1=i,this.x2=r,this.y2=n,this.addPoint(e,i),this.addPoint(r,n)}return T.default(t,[{key:"addPoint",value:function(t,e){void 0!==t&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=t,this.x2=t),tthis.x2&&(this.x2=t)),void 0!==e&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),ethis.y2&&(this.y2=e))}},{key:"addX",value:function(t){this.addPoint(t,null)}},{key:"addY",value:function(t){this.addPoint(null,t)}},{key:"addBoundingBox",value:function(t){if(t){var e=t.x1,i=t.y1,r=t.x2,n=t.y2;this.addPoint(e,i),this.addPoint(r,n)}}},{key:"sumCubic",value:function(t,e,i,r,n){return Math.pow(1-t,3)*e+3*Math.pow(1-t,2)*t*i+3*(1-t)*Math.pow(t,2)*r+Math.pow(t,3)*n}},{key:"bezierCurveAdd",value:function(t,e,i,r,n){var o=6*e-12*i+6*r,a=-3*e+9*i-9*r+3*n,l=3*i-3*e;if(0!==a){var c=Math.pow(o,2)-4*l*a;if(!(c<0)){var u=(-o+Math.sqrt(c))/(2*a);0=this.commands.length-1}},{key:"next",value:function(){var t=this.commands[++this.i];return this.previousCommand=this.command,this.command=t,t}},{key:"getPoint",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"x",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"y",i=new _t(this.command[t],this.command[e]);return this.makeAbsolute(i)}},{key:"getAsControlPoint",value:function(t,e){var i=this.getPoint(t,e);return this.control=i,i}},{key:"getAsCurrentPoint",value:function(t,e){var i=this.getPoint(t,e);return this.current=i,i}},{key:"getReflectedControlPoint",value:function(){var t=this.previousCommand.type;if(t!==y.SVGPathData.CURVE_TO&&t!==y.SVGPathData.SMOOTH_CURVE_TO&&t!==y.SVGPathData.QUAD_TO&&t!==y.SVGPathData.SMOOTH_QUAD_TO)return this.current;var e=this.current,i=e.x,r=e.y,n=this.control,o=n.x,a=n.y;return new _t(2*i-o,2*r-a)}},{key:"makeAbsolute",value:function(t){if(this.command.relative){var e=this.current,i=e.x,r=e.y;t.x+=i,t.y+=r}return t}},{key:"addMarker",value:function(t,e,i){var r=this.points,n=this.angles;i&&n.length>0&&!n[n.length-1]&&(n[n.length-1]=r[r.length-1].angleTo(i)),this.addMarkerAngle(t,e?e.angleTo(t):null)}},{key:"addMarkerAngle",value:function(t,e){this.points.push(t),this.angles.push(e)}},{key:"getMarkerPoints",value:function(){return this.points}},{key:"getMarkerAngles",value:function(){for(var t=this.angles,e=t.length,i=0;i1&&void 0!==arguments[1]&&arguments[1];if(!e){var i=this.getStyle("fill"),r=this.getStyle("fill-opacity"),n=this.getStyle("stroke"),o=this.getStyle("stroke-opacity");if(i.isUrlDefinition()){var a=i.getFillStyleDefinition(this,r);a&&(t.fillStyle=a)}else if(i.hasValue()){"currentColor"===i.getString()&&i.setValue(this.getStyle("color").getColor());var l=i.getColor();"inherit"!==l&&(t.fillStyle="none"===l?"rgba(0,0,0,0)":l)}if(r.hasValue()){var c=new gt(this.document,"fill",t.fillStyle).addOpacity(r).getColor();t.fillStyle=c}if(n.isUrlDefinition()){var u=n.getFillStyleDefinition(this,o);u&&(t.strokeStyle=u)}else if(n.hasValue()){"currentColor"===n.getString()&&n.setValue(this.getStyle("color").getColor());var h=n.getString();"inherit"!==h&&(t.strokeStyle="none"===h?"rgba(0,0,0,0)":h)}if(o.hasValue()){var p=new gt(this.document,"stroke",t.strokeStyle).addOpacity(o).getString();t.strokeStyle=p}var d=this.getStyle("stroke-width");if(d.hasValue()){var f=d.getPixels();t.lineWidth=f||it}var m=this.getStyle("stroke-linecap"),g=this.getStyle("stroke-linejoin"),y=this.getStyle("stroke-miterlimit"),_=this.getStyle("stroke-dasharray"),v=this.getStyle("stroke-dashoffset");if(m.hasValue()&&(t.lineCap=m.getString()),g.hasValue()&&(t.lineJoin=g.getString()),y.hasValue()&&(t.miterLimit=y.getNumber()),_.hasValue()&&"none"!==_.getString()){var x=V(_.getString());void 0!==t.setLineDash?t.setLineDash(x):void 0!==t.webkitLineDash?t.webkitLineDash=x:void 0===t.mozDash||1===x.length&&0===x[0]||(t.mozDash=x);var b=v.getPixels();void 0!==t.lineDashOffset?t.lineDashOffset=b:void 0!==t.webkitLineDashOffset?t.webkitLineDashOffset=b:void 0!==t.mozDashOffset&&(t.mozDashOffset=b)}}if(this.modifiedEmSizeStack=!1,void 0!==t.font){var w=this.getStyle("font"),C=this.getStyle("font-style"),S=this.getStyle("font-variant"),M=this.getStyle("font-weight"),T=this.getStyle("font-size"),E=this.getStyle("font-family"),A=new Ut(C.getString(),S.getString(),M.getString(),T.hasValue()?"".concat(T.getPixels(!0),"px"):"",E.getString(),Ut.parse(w.getString(),t.font));C.setValue(A.fontStyle),S.setValue(A.fontVariant),M.setValue(A.fontWeight),T.setValue(A.fontSize),E.setValue(A.fontFamily),t.font=A.toString(),T.isPixels()&&(this.document.emSize=T.getPixels(),this.modifiedEmSizeStack=!0)}e||(this.applyEffects(t),t.globalAlpha=this.calculateOpacity())}},{key:"clearContext",value:function(t){F.default(O.default(n.prototype),"clearContext",this).call(this,t),this.modifiedEmSizeStack&&this.document.popEmSize()}}]),n}(Rt);var Zt=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(t,e,i){var o;return M.default(this,n),(o=r.call(this,t,e,i)).type="path",o.pathParser=null,o.pathParser=new Gt(o.getAttribute("d").getString()),o}return T.default(n,[{key:"path",value:function(t){var e=this.pathParser,i=new Ht;for(e.reset(),t&&t.beginPath();!e.isEnd();)switch(e.next().type){case Gt.MOVE_TO:this.pathM(t,i);break;case Gt.LINE_TO:this.pathL(t,i);break;case Gt.HORIZ_LINE_TO:this.pathH(t,i);break;case Gt.VERT_LINE_TO:this.pathV(t,i);break;case Gt.CURVE_TO:this.pathC(t,i);break;case Gt.SMOOTH_CURVE_TO:this.pathS(t,i);break;case Gt.QUAD_TO:this.pathQ(t,i);break;case Gt.SMOOTH_QUAD_TO:this.pathT(t,i);break;case Gt.ARC:this.pathA(t,i);break;case Gt.CLOSE_PATH:this.pathZ(t,i)}return i}},{key:"getBoundingBox",value:function(t){return this.path()}},{key:"getMarkers",value:function(){var t=this.pathParser,e=t.getMarkerPoints(),i=t.getMarkerAngles();return e.map((function(t,e){return[t,i[e]]}))}},{key:"renderChildren",value:function(t){this.path(t),this.document.screen.mouse.checkPath(this,t);var e=this.getStyle("fill-rule");""!==t.fillStyle&&("inherit"!==e.getString("inherit")?t.fill(e.getString()):t.fill()),""!==t.strokeStyle&&("non-scaling-stroke"===this.getAttribute("vector-effect").getString()?(t.save(),t.setTransform(1,0,0,1,0,0),t.stroke(),t.restore()):t.stroke());var i=this.getMarkers();if(i){var r=i.length-1,n=this.getStyle("marker-start"),o=this.getStyle("marker-mid"),a=this.getStyle("marker-end");if(n.isUrlDefinition()){var l=n.getDefinition(),c=C.default(i[0],2),u=c[0],h=c[1];l.render(t,u,h)}if(o.isUrlDefinition())for(var p=o.getDefinition(),d=1;dl?a:l,_=a>l?1:a/l,v=a>l?l/a:1;t.translate(h.x,h.y),t.rotate(u),t.scale(_,v),t.arc(0,0,y,p,p+d,Boolean(1-c)),t.scale(1/_,1/v),t.rotate(-u),t.translate(-h.x,-h.y)}}},{key:"pathZ",value:function(t,e){n.pathZ(this.pathParser),t&&e.x1!==e.x2&&e.y1!==e.y2&&t.closePath()}}],[{key:"pathM",value:function(t){var e=t.getAsCurrentPoint();return t.start=t.current,{point:e}}},{key:"pathL",value:function(t){return{current:t.current,point:t.getAsCurrentPoint()}}},{key:"pathH",value:function(t){var e=t.current,i=t.command,r=new _t((i.relative?e.x:0)+i.x,e.y);return t.current=r,{current:e,point:r}}},{key:"pathV",value:function(t){var e=t.current,i=t.command,r=new _t(e.x,(i.relative?e.y:0)+i.y);return t.current=r,{current:e,point:r}}},{key:"pathC",value:function(t){return{current:t.current,point:t.getPoint("x1","y1"),controlPoint:t.getAsControlPoint("x2","y2"),currentPoint:t.getAsCurrentPoint()}}},{key:"pathS",value:function(t){return{current:t.current,point:t.getReflectedControlPoint(),controlPoint:t.getAsControlPoint("x2","y2"),currentPoint:t.getAsCurrentPoint()}}},{key:"pathQ",value:function(t){return{current:t.current,controlPoint:t.getAsControlPoint("x1","y1"),currentPoint:t.getAsCurrentPoint()}}},{key:"pathT",value:function(t){var e=t.current,i=t.getReflectedControlPoint();return t.control=i,{current:e,controlPoint:i,currentPoint:t.getAsCurrentPoint()}}},{key:"pathA",value:function(t){var e=t.current,i=t.command,r=i.rX,n=i.rY,o=i.xRot,a=i.lArcFlag,l=i.sweepFlag,c=o*(Math.PI/180),u=t.getAsCurrentPoint(),h=new _t(Math.cos(c)*(e.x-u.x)/2+Math.sin(c)*(e.y-u.y)/2,-Math.sin(c)*(e.x-u.x)/2+Math.cos(c)*(e.y-u.y)/2),p=Math.pow(h.x,2)/Math.pow(r,2)+Math.pow(h.y,2)/Math.pow(n,2);p>1&&(r*=Math.sqrt(p),n*=Math.sqrt(p));var d=(a===l?-1:1)*Math.sqrt((Math.pow(r,2)*Math.pow(n,2)-Math.pow(r,2)*Math.pow(h.y,2)-Math.pow(n,2)*Math.pow(h.x,2))/(Math.pow(r,2)*Math.pow(h.y,2)+Math.pow(n,2)*Math.pow(h.x,2)));isNaN(d)&&(d=0);var f=new _t(d*r*h.y/n,d*-n*h.x/r),m=new _t((e.x+u.x)/2+Math.cos(c)*f.x-Math.sin(c)*f.y,(e.y+u.y)/2+Math.sin(c)*f.x+Math.cos(c)*f.y),g=lt([1,0],[(h.x-f.x)/r,(h.y-f.y)/n]),y=[(h.x-f.x)/r,(h.y-f.y)/n],_=[(-h.x-f.x)/r,(-h.y-f.y)/n],v=lt(y,_);return at(y,_)<=-1&&(v=Math.PI),at(y,_)>=1&&(v=0),{currentPoint:u,rX:r,rY:n,sweepFlag:l,xAxisRotation:c,centp:m,a1:g,ad:v}}},{key:"pathZ",value:function(t){t.current=t.start}}]),n}(qt);var $t=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(t,e,i){var o;return M.default(this,n),(o=r.call(this,t,e,i)).type="glyph",o.horizAdvX=o.getAttribute("horiz-adv-x").getNumber(),o.unicode=o.getAttribute("unicode").getString(),o.arabicForm=o.getAttribute("arabic-form").getString(),o}return n}(Zt);var Wt=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(t,e,i){var o;return M.default(this,n),(o=r.call(this,t,e,(this instanceof n?this.constructor:void 0)===n||i)).type="text",o.x=0,o.y=0,o.measureCache=-1,o}return T.default(n,[{key:"setContext",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];F.default(O.default(n.prototype),"setContext",this).call(this,t,e);var i=this.getStyle("dominant-baseline").getTextBaseline()||this.getStyle("alignment-baseline").getTextBaseline();i&&(t.textBaseline=i)}},{key:"initializeCoordinates",value:function(t){this.x=this.getAttribute("x").getPixels("x"),this.y=this.getAttribute("y").getPixels("y");var e=this.getAttribute("dx"),i=this.getAttribute("dy");e.hasValue()&&(this.x+=e.getPixels("x")),i.hasValue()&&(this.y+=i.getPixels("y")),this.x+=this.getAnchorDelta(t,this,0)}},{key:"getBoundingBox",value:function(t){var e=this;if("text"!==this.type)return this.getTElementBoundingBox(t);this.initializeCoordinates(t);var i=null;return this.children.forEach((function(r,n){var o=e.getChildBoundingBox(t,e,e,n);i?i.addBoundingBox(o):i=o})),i}},{key:"getFontSize",value:function(){var t=this.document,e=this.parent,i=Ut.parse(t.ctx.font).fontSize;return e.getStyle("font-size").getNumber(i)}},{key:"getTElementBoundingBox",value:function(t){var e=this.getFontSize();return new Ht(this.x,this.y-e,this.x+this.measureText(t),this.y)}},{key:"getGlyph",value:function(t,e,i){var r=e[i],n=null;if(t.isArabic){var o=e.length,a=e[i-1],l=e[i+1],c="isolated";if((0===i||" "===a)&&i0&&" "!==a&&i0&&" "!==a&&(i===o-1||" "===l)&&(c="initial"),void 0!==t.glyphs[r]){var u=t.glyphs[r];n=u instanceof $t?u:u[c]}}else n=t.glyphs[r];return n||(n=t.missingGlyph),n}},{key:"getText",value:function(){return""}},{key:"getTextFromNode",value:function(t){var e=t||this.node,i=Array.from(e.parentNode.childNodes),r=i.indexOf(e),n=i.length-1,o=j(e.textContent||"");return 0===r&&(o=N(o)),r===n&&(o=B(o)),o}},{key:"renderChildren",value:function(t){var e=this;if("text"===this.type){this.initializeCoordinates(t),this.children.forEach((function(i,r){e.renderChild(t,e,e,r)}));var i=this.document.screen.mouse;i.isWorking()&&i.checkBoundingBox(this,this.getBoundingBox(t))}else this.renderTElementChildren(t)}},{key:"renderTElementChildren",value:function(t){var e=this.document,i=this.parent,r=this.getText(),n=i.getStyle("font-family").getDefinition();if(n)for(var o=n.fontFace.unitsPerEm,a=Ut.parse(e.ctx.font),l=i.getStyle("font-size").getNumber(a.fontSize),c=i.getStyle("font-style").getString(a.fontStyle),u=l/o,h=n.isRTL?r.split("").reverse().join(""):r,p=V(i.getAttribute("dx").getString()),d=h.length,f=0;fi&&a.getAttribute("x").hasValue()||a.getAttribute("text-anchor").hasValue()));c++)l+=a.measureTextRecursive(t);return-1*("end"===r?l:l/2)}return 0}},{key:"adjustChildCoordinates",value:function(t,e,i,r){var n=i.children[r];if("function"!=typeof n.measureText)return n;t.save(),n.setContext(t,!0);var o=n.getAttribute("x"),a=n.getAttribute("y"),l=n.getAttribute("dx"),c=n.getAttribute("dy"),u=n.getAttribute("text-anchor").getString("start");if(0===r&&"textNode"!==n.type&&(o.hasValue()||o.setValue(e.getAttribute("x").getValue("0")),a.hasValue()||a.setValue(e.getAttribute("y").getValue("0")),l.hasValue()||l.setValue(e.getAttribute("dx").getValue("0")),c.hasValue()||c.setValue(e.getAttribute("dy").getValue("0"))),o.hasValue()){if(n.x=o.getPixels("x")+e.getAnchorDelta(t,i,r),"start"!==u){var h=n.measureTextRecursive(t);n.x+=-1*("end"===u?h:h/2)}l.hasValue()&&(n.x+=l.getPixels("x"))}else{if("start"!==u){var p=n.measureTextRecursive(t);e.x+=-1*("end"===u?p:p/2)}l.hasValue()&&(e.x+=l.getPixels("x")),n.x=e.x}return e.x=n.x+n.measureText(t),a.hasValue()?(n.y=a.getPixels("y"),c.hasValue()&&(n.y+=c.getPixels("y"))):(c.hasValue()&&(e.y+=c.getPixels("y")),n.y=e.y),e.y=n.y,n.clearContext(t),t.restore(),n}},{key:"getChildBoundingBox",value:function(t,e,i,r){var n=this.adjustChildCoordinates(t,e,i,r);if("function"!=typeof n.getBoundingBox)return null;var o=n.getBoundingBox(t);return o?(n.children.forEach((function(i,r){var a=e.getChildBoundingBox(t,e,n,r);o.addBoundingBox(a)})),o):null}},{key:"renderChild",value:function(t,e,i,r){var n=this.adjustChildCoordinates(t,e,i,r);n.render(t),n.children.forEach((function(i,r){e.renderChild(t,e,n,r)}))}},{key:"measureTextRecursive",value:function(t){return this.children.reduce((function(e,i){return e+i.measureTextRecursive(t)}),this.measureText(t))}},{key:"measureText",value:function(t){var e=this.measureCache;if(~e)return e;var i=this.getText(),r=this.measureTargetText(t,i);return this.measureCache=r,r}},{key:"measureTargetText",value:function(t,e){if(!e.length)return 0;var i=this.parent,r=i.getStyle("font-family").getDefinition();if(r){for(var n=this.getFontSize(),o=r.isRTL?e.split("").reverse().join(""):e,a=V(i.getAttribute("dx").getString()),l=o.length,c=0,u=0;u0?"":o.getTextFromNode(),o}return T.default(n,[{key:"getText",value:function(){return this.text}}]),n}(Wt);var Yt=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(){var t;return M.default(this,n),(t=r.apply(this,arguments)).type="textNode",t}return n}(Xt);var Kt=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(){var t;return M.default(this,n),(t=r.apply(this,arguments)).type="svg",t.root=!1,t}return T.default(n,[{key:"setContext",value:function(t){var e,i=this.document,r=i.screen,o=i.window,a=t.canvas;if(r.setDefaults(t),a.style&&void 0!==t.font&&o&&void 0!==o.getComputedStyle){t.font=o.getComputedStyle(a).getPropertyValue("font");var l=new gt(i,"fontSize",Ut.parse(t.font).fontSize);l.hasValue()&&(i.rootEmSize=l.getPixels("y"),i.emSize=i.rootEmSize)}this.getAttribute("x").hasValue()||this.getAttribute("x",!0).setValue(0),this.getAttribute("y").hasValue()||this.getAttribute("y",!0).setValue(0);var c=r.viewPort,u=c.width,h=c.height;this.getStyle("width").hasValue()||this.getStyle("width",!0).setValue("100%"),this.getStyle("height").hasValue()||this.getStyle("height",!0).setValue("100%"),this.getStyle("color").hasValue()||this.getStyle("color",!0).setValue("black");var p=this.getAttribute("refX"),d=this.getAttribute("refY"),f=this.getAttribute("viewBox"),m=f.hasValue()?V(f.getString()):null,g=!this.root&&"visible"!==this.getStyle("overflow").getValue("hidden"),y=0,_=0,v=0,x=0;m&&(y=m[0],_=m[1]),this.root||(u=this.getStyle("width").getPixels("x"),h=this.getStyle("height").getPixels("y"),"marker"===this.type&&(v=y,x=_,y=0,_=0)),r.viewPort.setCurrent(u,h),!this.node||this.parent&&"foreignObject"!==(null===(e=this.node.parentNode)||void 0===e?void 0:e.nodeName)||!this.getStyle("transform",!1,!0).hasValue()||this.getStyle("transform-origin",!1,!0).hasValue()||this.getStyle("transform-origin",!0,!0).setValue("50% 50%"),F.default(O.default(n.prototype),"setContext",this).call(this,t),t.translate(this.getAttribute("x").getPixels("x"),this.getAttribute("y").getPixels("y")),m&&(u=m[2],h=m[3]),i.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:r.viewPort.width,desiredWidth:u,height:r.viewPort.height,desiredHeight:h,minX:y,minY:_,refX:p.getValue(),refY:d.getValue(),clip:g,clipX:v,clipY:x}),m&&(r.viewPort.removeCurrent(),r.viewPort.setCurrent(u,h))}},{key:"clearContext",value:function(t){F.default(O.default(n.prototype),"clearContext",this).call(this,t),this.document.screen.viewPort.removeCurrent()}},{key:"resize",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.getAttribute("width",!0),n=this.getAttribute("height",!0),o=this.getAttribute("viewBox"),a=this.getAttribute("style"),l=r.getNumber(0),c=n.getNumber(0);if(i)if("string"==typeof i)this.getAttribute("preserveAspectRatio",!0).setValue(i);else{var u=this.getAttribute("preserveAspectRatio");u.hasValue()&&u.setValue(u.getString().replace(/^\s*(\S.*\S)\s*$/,"$1"))}if(r.setValue(t),n.setValue(e),o.hasValue()||o.setValue("0 0 ".concat(l||t," ").concat(c||e)),a.hasValue()){var h=this.getStyle("width"),p=this.getStyle("height");h.hasValue()&&h.setValue("".concat(t,"px")),p.hasValue()&&p.setValue("".concat(e,"px"))}}}]),n}(qt);var Jt=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(){var t;return M.default(this,n),(t=r.apply(this,arguments)).type="rect",t}return T.default(n,[{key:"path",value:function(t){var e=this.getAttribute("x").getPixels("x"),i=this.getAttribute("y").getPixels("y"),r=this.getStyle("width",!1,!0).getPixels("x"),n=this.getStyle("height",!1,!0).getPixels("y"),o=this.getAttribute("rx"),a=this.getAttribute("ry"),l=o.getPixels("x"),c=a.getPixels("y");if(o.hasValue()&&!a.hasValue()&&(c=l),a.hasValue()&&!o.hasValue()&&(l=c),l=Math.min(l,r/2),c=Math.min(c,n/2),t){var u=(Math.sqrt(2)-1)/3*4;t.beginPath(),n>0&&r>0&&(t.moveTo(e+l,i),t.lineTo(e+r-l,i),t.bezierCurveTo(e+r-l+u*l,i,e+r,i+c-u*c,e+r,i+c),t.lineTo(e+r,i+n-c),t.bezierCurveTo(e+r,i+n-c+u*c,e+r-l+u*l,i+n,e+r-l,i+n),t.lineTo(e+l,i+n),t.bezierCurveTo(e+l-u*l,i+n,e,i+n-c+u*c,e,i+n-c),t.lineTo(e,i+c),t.bezierCurveTo(e,i+c-u*c,e+l-u*l,i,e+l,i),t.closePath())}return new Ht(e,i,e+r,i+n)}},{key:"getMarkers",value:function(){return null}}]),n}(Zt);var Qt=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(){var t;return M.default(this,n),(t=r.apply(this,arguments)).type="circle",t}return T.default(n,[{key:"path",value:function(t){var e=this.getAttribute("cx").getPixels("x"),i=this.getAttribute("cy").getPixels("y"),r=this.getAttribute("r").getPixels();return t&&r>0&&(t.beginPath(),t.arc(e,i,r,0,2*Math.PI,!1),t.closePath()),new Ht(e-r,i-r,e+r,i+r)}},{key:"getMarkers",value:function(){return null}}]),n}(Zt);var te=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(){var t;return M.default(this,n),(t=r.apply(this,arguments)).type="ellipse",t}return T.default(n,[{key:"path",value:function(t){var e=(Math.sqrt(2)-1)/3*4,i=this.getAttribute("rx").getPixels("x"),r=this.getAttribute("ry").getPixels("y"),n=this.getAttribute("cx").getPixels("x"),o=this.getAttribute("cy").getPixels("y");return t&&i>0&&r>0&&(t.beginPath(),t.moveTo(n+i,o),t.bezierCurveTo(n+i,o+e*r,n+e*i,o+r,n,o+r),t.bezierCurveTo(n-e*i,o+r,n-i,o+e*r,n-i,o),t.bezierCurveTo(n-i,o-e*r,n-e*i,o-r,n,o-r),t.bezierCurveTo(n+e*i,o-r,n+i,o-e*r,n+i,o),t.closePath()),new Ht(n-i,o-r,n+i,o+r)}},{key:"getMarkers",value:function(){return null}}]),n}(Zt);var ee=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(){var t;return M.default(this,n),(t=r.apply(this,arguments)).type="line",t}return T.default(n,[{key:"getPoints",value:function(){return[new _t(this.getAttribute("x1").getPixels("x"),this.getAttribute("y1").getPixels("y")),new _t(this.getAttribute("x2").getPixels("x"),this.getAttribute("y2").getPixels("y"))]}},{key:"path",value:function(t){var e=this.getPoints(),i=C.default(e,2),r=i[0],n=r.x,o=r.y,a=i[1],l=a.x,c=a.y;return t&&(t.beginPath(),t.moveTo(n,o),t.lineTo(l,c)),new Ht(n,o,l,c)}},{key:"getMarkers",value:function(){var t=this.getPoints(),e=C.default(t,2),i=e[0],r=e[1],n=i.angleTo(r);return[[i,n],[r,n]]}}]),n}(Zt);var ie=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(t,e,i){var o;return M.default(this,n),(o=r.call(this,t,e,i)).type="polyline",o.points=[],o.points=_t.parsePath(o.getAttribute("points").getString()),o}return T.default(n,[{key:"path",value:function(t){var e=this.points,i=C.default(e,1)[0],r=i.x,n=i.y,o=new Ht(r,n);return t&&(t.beginPath(),t.moveTo(r,n)),e.forEach((function(e){var i=e.x,r=e.y;o.addPoint(i,r),t&&t.lineTo(i,r)})),o}},{key:"getMarkers",value:function(){var t=this.points,e=t.length-1,i=[];return t.forEach((function(r,n){n!==e&&i.push([r,r.angleTo(t[n+1])])})),i.length>0&&i.push([t[t.length-1],i[i.length-1][1]]),i}}]),n}(Zt);var re=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(){var t;return M.default(this,n),(t=r.apply(this,arguments)).type="polygon",t}return T.default(n,[{key:"path",value:function(t){var e=F.default(O.default(n.prototype),"path",this).call(this,t),i=C.default(this.points,1)[0],r=i.x,o=i.y;return t&&(t.lineTo(r,o),t.closePath()),e}}]),n}(ie);var ne=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(){var t;return M.default(this,n),(t=r.apply(this,arguments)).type="pattern",t}return T.default(n,[{key:"createPattern",value:function(t,e,i){var r=this.getStyle("width").getPixels("x",!0),n=this.getStyle("height").getPixels("y",!0),o=new Kt(this.document,null);o.attributes.viewBox=new gt(this.document,"viewBox",this.getAttribute("viewBox").getValue()),o.attributes.width=new gt(this.document,"width","".concat(r,"px")),o.attributes.height=new gt(this.document,"height","".concat(n,"px")),o.attributes.transform=new gt(this.document,"transform",this.getAttribute("patternTransform").getValue()),o.children=this.children;var a=this.document.createCanvas(r,n),l=a.getContext("2d"),c=this.getAttribute("x"),u=this.getAttribute("y");c.hasValue()&&u.hasValue()&&l.translate(c.getPixels("x",!0),u.getPixels("y",!0)),i.hasValue()?this.styles["fill-opacity"]=i:Reflect.deleteProperty(this.styles,"fill-opacity");for(var h=-1;h<=1;h++)for(var p=-1;p<=1;p++)l.save(),o.attributes.x=new gt(this.document,"x",h*a.width),o.attributes.y=new gt(this.document,"y",p*a.height),o.render(l),l.restore();return t.createPattern(a,"repeat")}}]),n}(Rt);var se=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(){var t;return M.default(this,n),(t=r.apply(this,arguments)).type="marker",t}return T.default(n,[{key:"render",value:function(t,e,i){if(e){var r=e.x,n=e.y,o=this.getAttribute("orient").getString("auto"),a=this.getAttribute("markerUnits").getString("strokeWidth");t.translate(r,n),"auto"===o&&t.rotate(i),"strokeWidth"===a&&t.scale(t.lineWidth,t.lineWidth),t.save();var l=new Kt(this.document,null);l.type=this.type,l.attributes.viewBox=new gt(this.document,"viewBox",this.getAttribute("viewBox").getValue()),l.attributes.refX=new gt(this.document,"refX",this.getAttribute("refX").getValue()),l.attributes.refY=new gt(this.document,"refY",this.getAttribute("refY").getValue()),l.attributes.width=new gt(this.document,"width",this.getAttribute("markerWidth").getValue()),l.attributes.height=new gt(this.document,"height",this.getAttribute("markerHeight").getValue()),l.attributes.overflow=new gt(this.document,"overflow",this.getAttribute("overflow").getValue()),l.attributes.fill=new gt(this.document,"fill",this.getAttribute("fill").getColor("black")),l.attributes.stroke=new gt(this.document,"stroke",this.getAttribute("stroke").getValue("none")),l.children=this.children,l.render(t),t.restore(),"strokeWidth"===a&&t.scale(1/t.lineWidth,1/t.lineWidth),"auto"===o&&t.rotate(-i),t.translate(-r,-n)}}}]),n}(Rt);var ae=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(){var t;return M.default(this,n),(t=r.apply(this,arguments)).type="defs",t}return T.default(n,[{key:"render",value:function(){}}]),n}(Rt);var de=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(){var t;return M.default(this,n),(t=r.apply(this,arguments)).type="g",t}return T.default(n,[{key:"getBoundingBox",value:function(t){var e=new Ht;return this.children.forEach((function(i){e.addBoundingBox(i.getBoundingBox(t))})),e}}]),n}(qt);var fe=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(t,e,i){var o;M.default(this,n),(o=r.call(this,t,e,i)).attributesToInherit=["gradientUnits"],o.stops=[];var a=D.default(o),l=a.stops;return a.children.forEach((function(t){"stop"===t.type&&l.push(t)})),o}return T.default(n,[{key:"getGradientUnits",value:function(){return this.getAttribute("gradientUnits").getString("objectBoundingBox")}},{key:"createGradient",value:function(t,e,i){var r=this,n=this;this.getHrefAttribute().hasValue()&&(n=this.getHrefAttribute().getDefinition(),this.inheritStopContainer(n));var o=n.stops,a=this.getGradient(t,e);if(!a)return this.addParentOpacity(i,o[o.length-1].color);if(o.forEach((function(t){a.addColorStop(t.offset,r.addParentOpacity(i,t.color))})),this.getAttribute("gradientTransform").hasValue()){var l=this.document,c=l.screen,u=c.MAX_VIRTUAL_PIXELS,h=c.viewPort,p=C.default(h.viewPorts,1)[0],d=new Jt(l,null);d.attributes.x=new gt(l,"x",-u/3),d.attributes.y=new gt(l,"y",-u/3),d.attributes.width=new gt(l,"width",u),d.attributes.height=new gt(l,"height",u);var f=new de(l,null);f.attributes.transform=new gt(l,"transform",this.getAttribute("gradientTransform").getValue()),f.children=[d];var m=new Kt(l,null);m.attributes.x=new gt(l,"x",0),m.attributes.y=new gt(l,"y",0),m.attributes.width=new gt(l,"width",p.width),m.attributes.height=new gt(l,"height",p.height),m.children=[f];var g=l.createCanvas(p.width,p.height),y=g.getContext("2d");return y.fillStyle=a,m.render(y),y.createPattern(g,"no-repeat")}return a}},{key:"inheritStopContainer",value:function(t){var e=this;this.attributesToInherit.forEach((function(i){!e.getAttribute(i).hasValue()&&t.getAttribute(i).hasValue()&&e.getAttribute(i,!0).setValue(t.getAttribute(i).getValue())}))}},{key:"addParentOpacity",value:function(t,e){return t.hasValue()?new gt(this.document,"color",e).addOpacity(t).getColor():e}}]),n}(Rt);var me=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(t,e,i){var o;return M.default(this,n),(o=r.call(this,t,e,i)).type="linearGradient",o.attributesToInherit.push("x1","y1","x2","y2"),o}return T.default(n,[{key:"getGradient",value:function(t,e){var i="objectBoundingBox"===this.getGradientUnits(),r=i?e.getBoundingBox(t):null;if(i&&!r)return null;this.getAttribute("x1").hasValue()||this.getAttribute("y1").hasValue()||this.getAttribute("x2").hasValue()||this.getAttribute("y2").hasValue()||(this.getAttribute("x1",!0).setValue(0),this.getAttribute("y1",!0).setValue(0),this.getAttribute("x2",!0).setValue(1),this.getAttribute("y2",!0).setValue(0));var n=i?r.x+r.width*this.getAttribute("x1").getNumber():this.getAttribute("x1").getPixels("x"),o=i?r.y+r.height*this.getAttribute("y1").getNumber():this.getAttribute("y1").getPixels("y"),a=i?r.x+r.width*this.getAttribute("x2").getNumber():this.getAttribute("x2").getPixels("x"),l=i?r.y+r.height*this.getAttribute("y2").getNumber():this.getAttribute("y2").getPixels("y");return n===a&&o===l?null:t.createLinearGradient(n,o,a,l)}}]),n}(fe);var _e=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(t,e,i){var o;return M.default(this,n),(o=r.call(this,t,e,i)).type="radialGradient",o.attributesToInherit.push("cx","cy","r","fx","fy","fr"),o}return T.default(n,[{key:"getGradient",value:function(t,e){var i="objectBoundingBox"===this.getGradientUnits(),r=e.getBoundingBox(t);if(i&&!r)return null;this.getAttribute("cx").hasValue()||this.getAttribute("cx",!0).setValue("50%"),this.getAttribute("cy").hasValue()||this.getAttribute("cy",!0).setValue("50%"),this.getAttribute("r").hasValue()||this.getAttribute("r",!0).setValue("50%");var n=i?r.x+r.width*this.getAttribute("cx").getNumber():this.getAttribute("cx").getPixels("x"),o=i?r.y+r.height*this.getAttribute("cy").getNumber():this.getAttribute("cy").getPixels("y"),a=n,l=o;this.getAttribute("fx").hasValue()&&(a=i?r.x+r.width*this.getAttribute("fx").getNumber():this.getAttribute("fx").getPixels("x")),this.getAttribute("fy").hasValue()&&(l=i?r.y+r.height*this.getAttribute("fy").getNumber():this.getAttribute("fy").getPixels("y"));var c=i?(r.width+r.height)/2*this.getAttribute("r").getNumber():this.getAttribute("r").getPixels(),u=this.getAttribute("fr").getPixels();return t.createRadialGradient(a,l,u,n,o,c)}}]),n}(fe);var xe=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(t,e,i){var o;M.default(this,n),(o=r.call(this,t,e,i)).type="stop";var a=Math.max(0,Math.min(1,o.getAttribute("offset").getNumber())),l=o.getStyle("stop-opacity"),c=o.getStyle("stop-color",!0);return""===c.getString()&&c.setValue("#000"),l.hasValue()&&(c=c.addOpacity(l)),o.offset=a,o.color=c.getColor(),o}return n}(Rt);var be=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(t,e,i){var o;M.default(this,n),(o=r.call(this,t,e,i)).type="animate",o.duration=0,o.initialValue=null,o.initialUnits="",o.removed=!1,o.frozen=!1,t.screen.animations.push(D.default(o)),o.begin=o.getAttribute("begin").getMilliseconds(),o.maxDuration=o.begin+o.getAttribute("dur").getMilliseconds(),o.from=o.getAttribute("from"),o.to=o.getAttribute("to"),o.values=new gt(t,"values",null);var a=o.getAttribute("values");return a.hasValue()&&o.values.setValue(a.getString().split(";")),o}return T.default(n,[{key:"getProperty",value:function(){var t=this.getAttribute("attributeType").getString(),e=this.getAttribute("attributeName").getString();return"CSS"===t?this.parent.getStyle(e,!0):this.parent.getAttribute(e,!0)}},{key:"calcValue",value:function(){var t=this.initialUnits,e=this.getProgress(),i=e.progress,r=e.from,n=e.to,o=r.getNumber()+(n.getNumber()-r.getNumber())*i;return"%"===t&&(o*=100),"".concat(o).concat(t)}},{key:"update",value:function(t){var e=this.parent,i=this.getProperty();if(this.initialValue||(this.initialValue=i.getString(),this.initialUnits=i.getUnits()),this.duration>this.maxDuration){var r=this.getAttribute("fill").getString("remove");if("indefinite"===this.getAttribute("repeatCount").getString()||"indefinite"===this.getAttribute("repeatDur").getString())this.duration=0;else if("freeze"!==r||this.frozen){if("remove"===r&&!this.removed)return this.removed=!0,i.setValue(e.animationFrozen?e.animationFrozenValue:this.initialValue),!0}else this.frozen=!0,e.animationFrozen=!0,e.animationFrozenValue=i.getString();return!1}this.duration+=t;var n=!1;if(this.begint.length)&&(e=t.length);for(var i=0,r=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return a=t.done,t},e:function(t){l=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(l)throw o}}}}(D.default(o).children);try{for(c.s();!(a=c.n()).done;){var u=a.value;switch(u.type){case"font-face":o.fontFace=u;var h=u.getStyle("font-family");h.hasValue()&&(l[h.getString()]=D.default(o));break;case"missing-glyph":o.missingGlyph=u;break;case"glyph":var p=u;p.arabicForm?(o.isRTL=!0,o.isArabic=!0,void 0===o.glyphs[p.unicode]&&(o.glyphs[p.unicode]={}),o.glyphs[p.unicode][p.arabicForm]=p):o.glyphs[p.unicode]=p}}}catch(t){c.e(t)}finally{c.f()}return o}return T.default(n,[{key:"render",value:function(){}}]),n}(Rt);var Le=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(t,e,i){var o;return M.default(this,n),(o=r.call(this,t,e,i)).type="font-face",o.ascent=o.getAttribute("ascent").getNumber(),o.descent=o.getAttribute("descent").getNumber(),o.unitsPerEm=o.getAttribute("units-per-em").getNumber(),o}return n}(Rt);var Pe=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(){var t;return M.default(this,n),(t=r.apply(this,arguments)).type="missing-glyph",t.horizAdvX=0,t}return n}(Zt);var Oe=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(){var t;return M.default(this,n),(t=r.apply(this,arguments)).type="tref",t}return T.default(n,[{key:"getText",value:function(){var t=this.getHrefAttribute().getDefinition();if(t){var e=t.children[0];if(e)return e.getText()}return""}}]),n}(Wt);var ke=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(t,e,i){var o;M.default(this,n),(o=r.call(this,t,e,i)).type="a";var a=e.childNodes,l=a[0],c=a.length>0&&Array.from(a).every((function(t){return 3===t.nodeType}));return o.hasText=c,o.text=c?o.getTextFromNode(l):"",o}return T.default(n,[{key:"getText",value:function(){return this.text}},{key:"renderChildren",value:function(t){if(this.hasText){F.default(O.default(n.prototype),"renderChildren",this).call(this,t);var e=this.document,i=this.x,r=this.y,o=e.screen.mouse,a=new gt(e,"fontSize",Ut.parse(e.ctx.font).fontSize);o.isWorking()&&o.checkBoundingBox(this,new Ht(i,r-a.getPixels("y"),i+this.measureText(t),r))}else if(this.children.length>0){var l=new de(this.document,null);l.children=this.children,l.parent=this,l.render(t)}}},{key:"onClick",value:function(){var t=this.document.window;t&&t.open(this.getHrefAttribute().getString())}},{key:"onMouseMove",value:function(){this.document.ctx.canvas.style.cursor="pointer"}}]),n}(Wt);function Fe(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);ic?l:c,m=l>c?1:l/c,g=l>c?c/l:1;t&&(t.translate(o,a),t.rotate(p),t.scale(m,g),t.arc(0,0,f,u,u+h,Boolean(1-d)),t.scale(1/m,1/g),t.rotate(-p),t.translate(-o,-a));break;case Gt.CLOSE_PATH:t&&t.closePath()}}))}},{key:"renderChildren",value:function(t){this.setTextData(t),t.save();var e=this.parent.getStyle("text-decoration").getString(),i=this.getFontSize(),r=this.glyphInfo,n=t.fillStyle;"underline"===e&&t.beginPath(),r.forEach((function(r,n){var o=r.p0,a=r.p1,l=r.rotation,c=r.text;t.save(),t.translate(o.x,o.y),t.rotate(l),t.fillStyle&&t.fillText(c,0,0),t.strokeStyle&&t.strokeText(c,0,0),t.restore(),"underline"===e&&(0===n&&t.moveTo(o.x,o.y+i/8),t.lineTo(a.x,a.y+i/5))})),"underline"===e&&(t.lineWidth=i/20,t.strokeStyle=n,t.stroke(),t.closePath()),t.restore()}},{key:"getLetterSpacingAt",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.letterSpacingCache[t]||0}},{key:"findSegmentToFitChar",value:function(t,e,i,r,n,o,a,l,c){var u=o,h=this.measureText(t,l);" "===l&&"justify"===e&&i-1&&(u+=this.getLetterSpacingAt(c));var p=this.textHeight/20,d=this.getEquidistantPointOnPath(u,p,0),f=this.getEquidistantPointOnPath(u+h,p,0),m={p0:d,p1:f},g=d&&f?Math.atan2(f.y-d.y,f.x-d.x):0;if(a){var y=Math.cos(Math.PI/2+g)*a,_=Math.cos(-g)*a;m.p0=ze(ze({},d),{},{x:d.x+y,y:d.y+_}),m.p1=ze(ze({},f),{},{x:f.x+y,y:f.y+_})}return{offset:u+=h,segment:m,rotation:g}}},{key:"measureText",value:function(t,e){var i=this.measuresCache,r=e||this.getText();if(i.has(r))return i.get(r);var n=this.measureTargetText(t,r);return i.set(r,n),n}},{key:"setTextData",value:function(t){var e=this;if(!this.glyphInfo){var i=this.getText(),r=i.split(""),n=i.split(" ").length-1,o=this.parent.getAttribute("dx").split().map((function(t){return t.getPixels("x")})),a=this.parent.getAttribute("dy").getPixels("y"),l=this.parent.getStyle("text-anchor").getString("start"),c=this.getStyle("letter-spacing"),u=this.parent.getStyle("letter-spacing"),h=0;c.hasValue()&&"inherit"!==c.getValue()?c.hasValue()&&"initial"!==c.getValue()&&"unset"!==c.getValue()&&(h=c.getPixels()):h=u.getPixels();var p=[],d=i.length;this.letterSpacingCache=p;for(var f=0;f0&&(c-=2*Math.PI),1===n&&c<0&&(c+=2*Math.PI),[a.x,a.y,i,r,l,c,o,n]}},{key:"calcLength",value:function(t,e,i,r){var n=0,o=null,a=null,l=0;switch(i){case Gt.LINE_TO:return this.getLineLength(t,e,r[0],r[1]);case Gt.CURVE_TO:for(n=0,o=this.getPointOnCubicBezier(0,t,e,r[0],r[1],r[2],r[3],r[4],r[5]),l=.01;l<=1;l+=.01)a=this.getPointOnCubicBezier(l,t,e,r[0],r[1],r[2],r[3],r[4],r[5]),n+=this.getLineLength(o.x,o.y,a.x,a.y),o=a;return n;case Gt.QUAD_TO:for(n=0,o=this.getPointOnQuadraticBezier(0,t,e,r[0],r[1],r[2],r[3]),l=.01;l<=1;l+=.01)a=this.getPointOnQuadraticBezier(l,t,e,r[0],r[1],r[2],r[3]),n+=this.getLineLength(o.x,o.y,a.x,a.y),o=a;return n;case Gt.ARC:n=0;var c=r[4],u=r[5],h=r[4]+u,p=Math.PI/180;if(Math.abs(c-h)h;l-=p)a=this.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],l,0),n+=this.getLineLength(o.x,o.y,a.x,a.y),o=a;else for(l=c+p;l5&&void 0!==arguments[5]?arguments[5]:e,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:i,l=(n-i)/(r-e+it),c=Math.sqrt(t*t/(1+l*l));re)return null;var n,o=function(t,e){var i;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return Fe(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Fe(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0,n=function(){};return{s:n,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return a=t.done,t},e:function(t){l=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(l)throw o}}}}(this.dataArray);try{for(o.s();!(n=o.n()).done;){var a=n.value;if(!a||!(a.pathLength<5e-5||i+a.pathLength+5e-5=0&&c>p)break;r=this.getPointOnEllipticalArc(a.points[0],a.points[1],a.points[2],a.points[3],c,a.points[6]);break;case Gt.CURVE_TO:(c=l/a.pathLength)>1&&(c=1),r=this.getPointOnCubicBezier(c,a.start.x,a.start.y,a.points[0],a.points[1],a.points[2],a.points[3],a.points[4],a.points[5]);break;case Gt.QUAD_TO:(c=l/a.pathLength)>1&&(c=1),r=this.getPointOnQuadraticBezier(c,a.start.x,a.start.y,a.points[0],a.points[1],a.points[2],a.points[3])}if(r)return r;break}i+=a.pathLength}}catch(t){o.e(t)}finally{o.f()}return null}},{key:"getLineLength",value:function(t,e,i,r){return Math.sqrt((i-t)*(i-t)+(r-e)*(r-e))}},{key:"getPathLength",value:function(){return-1===this.pathLength&&(this.pathLength=this.dataArray.reduce((function(t,e){return e.pathLength>0?t+e.pathLength:t}),0)),this.pathLength}},{key:"getPointOnCubicBezier",value:function(t,e,i,r,n,o,a,l,c){return{x:l*ct(t)+o*ut(t)+r*ht(t)+e*pt(t),y:c*ct(t)+a*ut(t)+n*ht(t)+i*pt(t)}}},{key:"getPointOnQuadraticBezier",value:function(t,e,i,r,n,o,a){return{x:o*dt(t)+r*ft(t)+e*mt(t),y:a*dt(t)+n*ft(t)+i*mt(t)}}},{key:"getPointOnEllipticalArc",value:function(t,e,i,r,n,o){var a=Math.cos(o),l=Math.sin(o),c=i*Math.cos(n),u=r*Math.sin(n);return{x:t+(c*a-u*l),y:e+(c*l+u*a)}}},{key:"buildEquidistantCache",value:function(t,e){var i=this.getPathLength(),r=e||.25,n=t||i/100;if(!this.equidistantCache||this.equidistantCache.step!==n||this.equidistantCache.precision!==r){this.equidistantCache={step:n,precision:r,points:[]};for(var o=0,a=0;a<=i;a+=r){var l=this.getPointOnPath(a),c=this.getPointOnPath(a+r);l&&c&&(o+=this.getLineLength(l.x,l.y,c.x,c.y))>=n&&(this.equidistantCache.points.push({x:l.x,y:l.y,distance:a}),o-=n)}}}},{key:"getEquidistantPointOnPath",value:function(t,e,i){if(this.buildEquidistantCache(e,i),t<0||t-this.getPathLength()>5e-5)return null;var r=Math.round(t/this.getPathLength()*(this.equidistantCache.points.length-1));return this.equidistantCache.points[r]||null}}]),n}(Wt);var Ne=/^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i,Be=function(t){I.default(a,t);var e,i,r,n,o=(r=a,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=O.default(r);if(n){var i=O.default(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return P.default(this,t)});function a(t,e,i){var r;M.default(this,a),(r=o.call(this,t,e,i)).type="image",r.loaded=!1;var n=r.getHrefAttribute().getString();if(!n)return P.default(r);var l=n.endsWith(".svg")||/^\s*data:image\/svg\+xml/i.test(n);return t.images.push(D.default(r)),l?r.loadSvg(n):r.loadImage(n),r.isSvg=l,r}return T.default(a,[{key:"loadImage",value:(i=w.default(b.default.mark((function t(e){var i;return b.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.document.createImage(e);case 3:i=t.sent,this.image=i,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),console.error('Error while loading image "'.concat(e,'":'),t.t0);case 10:this.loaded=!0;case 11:case"end":return t.stop()}}),t,this,[[0,7]])}))),function(t){return i.apply(this,arguments)})},{key:"loadSvg",value:(e=w.default(b.default.mark((function t(e){var i,r,n,o;return b.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(i=Ne.exec(e))){t.next=6;break}r=i[5],"base64"===i[4]?this.image=atob(r):this.image=decodeURIComponent(r),t.next=19;break;case 6:return t.prev=6,t.next=9,this.document.fetch(e);case 9:return n=t.sent,t.next=12,n.text();case 12:o=t.sent,this.image=o,t.next=19;break;case 16:t.prev=16,t.t0=t.catch(6),console.error('Error while loading image "'.concat(e,'":'),t.t0);case 19:this.loaded=!0;case 20:case"end":return t.stop()}}),t,this,[[6,16]])}))),function(t){return e.apply(this,arguments)})},{key:"renderChildren",value:function(t){var e=this.document,i=this.image,r=this.loaded,n=this.getAttribute("x").getPixels("x"),o=this.getAttribute("y").getPixels("y"),a=this.getStyle("width").getPixels("x"),l=this.getStyle("height").getPixels("y");if(r&&i&&a&&l){if(t.save(),t.translate(n,o),this.isSvg){var c=e.canvg.forkString(t,this.image,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:0,offsetY:0,scaleWidth:a,scaleHeight:l});c.document.documentElement.parent=this,c.render()}else{var u=this.image;e.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:a,desiredWidth:u.width,height:l,desiredHeight:u.height}),this.loaded&&(void 0===u.complete||u.complete)&&t.drawImage(u,0,0)}t.restore()}}},{key:"getBoundingBox",value:function(){var t=this.getAttribute("x").getPixels("x"),e=this.getAttribute("y").getPixels("y"),i=this.getStyle("width").getPixels("x"),r=this.getStyle("height").getPixels("y");return new Ht(t,e,t+i,e+r)}}]),a}(qt);var Ve=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(){var t;return M.default(this,n),(t=r.apply(this,arguments)).type="symbol",t}return T.default(n,[{key:"render",value:function(t){}}]),n}(qt),Ue=function(){function t(e){M.default(this,t),this.document=e,this.loaded=!1,e.fonts.push(this)}var e;return T.default(t,[{key:"load",value:(e=w.default(b.default.mark((function t(e,i){var r,n,o;return b.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,r=this.document,t.next=4,r.canvg.parser.load(i);case 4:n=t.sent,o=n.getElementsByTagName("font"),Array.from(o).forEach((function(t){var i=r.createElement(t);r.definitions[e]=i})),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(0),console.error('Error while loading font "'.concat(i,'":'),t.t0);case 12:this.loaded=!0;case 13:case"end":return t.stop()}}),t,this,[[0,9]])}))),function(t,i){return e.apply(this,arguments)})}]),t}();var He=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(t,e,i){var o;return M.default(this,n),(o=r.call(this,t,e,i)).type="style",j(Array.from(e.childNodes).map((function(t){return t.textContent})).join("").replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,"").replace(/@import.*;/g,"")).split("}").forEach((function(e){var i=e.trim();if(i){var r=i.split("{"),n=r[0].split(","),o=r[1].split(";");n.forEach((function(e){var i=e.trim();if(i){var r=t.styles[i]||{};if(o.forEach((function(e){var i=e.indexOf(":"),n=e.substr(0,i).trim(),o=e.substr(i+1,e.length-i).trim();n&&o&&(r[n]=new gt(t,n,o))})),t.styles[i]=r,t.stylesSpecificity[i]=et(i),"@font-face"===i){var n=r["font-family"].getString().replace(/"|'/g,"");r.src.getString().split(",").forEach((function(e){if(e.indexOf('format("svg")')>0){var i=G(e);i&&new Ue(t).load(n,i)}}))}}}))}})),o}return n}(Rt);He.parseExternalUrl=G;var Ge=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(){var t;return M.default(this,n),(t=r.apply(this,arguments)).type="use",t}return T.default(n,[{key:"setContext",value:function(t){F.default(O.default(n.prototype),"setContext",this).call(this,t);var e=this.getAttribute("x"),i=this.getAttribute("y");e.hasValue()&&t.translate(e.getPixels("x"),0),i.hasValue()&&t.translate(0,i.getPixels("y"))}},{key:"path",value:function(t){var e=this.element;e&&e.path(t)}},{key:"renderChildren",value:function(t){var e=this.document,i=this.element;if(i){var r=i;if("symbol"===i.type&&((r=new Kt(e,null)).attributes.viewBox=new gt(e,"viewBox",i.getAttribute("viewBox").getString()),r.attributes.preserveAspectRatio=new gt(e,"preserveAspectRatio",i.getAttribute("preserveAspectRatio").getString()),r.attributes.overflow=new gt(e,"overflow",i.getAttribute("overflow").getString()),r.children=i.children,i.styles.opacity=new gt(e,"opacity",this.calculateOpacity())),"svg"===r.type){var n=this.getStyle("width",!1,!0),o=this.getStyle("height",!1,!0);n.hasValue()&&(r.attributes.width=new gt(e,"width",n.getString())),o.hasValue()&&(r.attributes.height=new gt(e,"height",o.getString()))}var a=r.parent;r.parent=this,r.render(t),r.parent=a}}},{key:"getBoundingBox",value:function(t){var e=this.element;return e?e.getBoundingBox(t):null}},{key:"elementTransform",value:function(){var t=this.document,e=this.element;return zt.fromElement(t,e)}},{key:"element",get:function(){return this.cachedElement||(this.cachedElement=this.getHrefAttribute().getDefinition()),this.cachedElement}}]),n}(qt);function $e(t,e,i,r,n,o){return t[i*r*4+4*e+o]}function We(t,e,i,r,n,o,a){t[i*r*4+4*e+o]=a}function Xe(t,e,i){return t[e]*i}function Ke(t,e,i,r){return e+Math.cos(t)*i+Math.sin(t)*r}var Je=function(t){I.default(n,t);var e,i,r=(e=n,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=O.default(e);if(i){var n=O.default(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return P.default(this,t)});function n(t,e,i){var o;M.default(this,n),(o=r.call(this,t,e,i)).type="feColorMatrix";var a=V(o.getAttribute("values").getString());switch(o.getAttribute("type").getString("matrix")){case"saturate":var l=a[0];a=[.213+.787*l,.715-.715*l,.072-.072*l,0,0,.213-.213*l,.715+.285*l,.072-.072*l,0,0,.213-.213*l,.715-.715*l,.072+.928*l,0,0,0,0,0,1,0,0,0,0,0,1];break;case"hueRotate":var c=a[0]*Math.PI/180;a=[Ke(c,.213,.787,-.213),Ke(c,.715,-.715,-.715),Ke(c,.072,-.072,.928),0,0,Ke(c,.213,-.213,.143),Ke(c,.715,.285,.14),Ke(c,.072,-.072,-.283),0,0,Ke(c,.213,-.213,-.787),Ke(c,.715,-.715,.715),Ke(c,.072,.928,.072),0,0,0,0,0,1,0,0,0,0,0,1];break;case"luminanceToAlpha":a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,.2125,.7154,.0721,0,0,0,0,0,0,1]}return o.matrix=a,o.includeOpacity=o.getAttribute("includeOpacity").hasValue(),o}return T.default(n,[{key:"apply",value:function(t,e,i,r,n){for(var o=this.includeOpacity,a=this.matrix,l=t.getImageData(0,0,r,n),c=0;c1&&void 0!==n[1]&&n[1],r=document.createElement("img"),i&&(r.crossOrigin="Anonymous"),t.abrupt("return",new Promise((function(t,i){r.onload=function(){t(r)},r.onerror=function(t,e,r,n,o){i(o)},r.src=e})));case 4:case"end":return t.stop()}}),t)}))),Ci.apply(this,arguments)}var Si=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.rootEmSize,n=void 0===r?12:r,o=i.emSize,a=void 0===o?12:o,l=i.createCanvas,c=void 0===l?t.createCanvas:l,u=i.createImage,h=void 0===u?t.createImage:u,p=i.anonymousCrossOrigin;M.default(this,t),this.canvg=e,this.definitions={},this.styles={},this.stylesSpecificity={},this.images=[],this.fonts=[],this.emSizeStack=[],this.uniqueId=0,this.screen=e.screen,this.rootEmSize=n,this.emSize=a,this.createCanvas=c,this.createImage=this.bindCreateImage(h,p),this.screen.wait(this.isImagesLoaded.bind(this)),this.screen.wait(this.isFontsLoaded.bind(this))}return T.default(t,[{key:"bindCreateImage",value:function(t,e){return"boolean"==typeof e?function(i,r){return t(i,"boolean"==typeof r?r:e)}:t}},{key:"popEmSize",value:function(){this.emSizeStack.pop()}},{key:"getUniqueId",value:function(){return"canvg".concat(++this.uniqueId)}},{key:"isImagesLoaded",value:function(){return this.images.every((function(t){return t.loaded}))}},{key:"isFontsLoaded",value:function(){return this.fonts.every((function(t){return t.loaded}))}},{key:"createDocumentElement",value:function(t){var e=this.createElement(t.documentElement);return e.root=!0,e.addStylesFromStyleDefinition(),this.documentElement=e,e}},{key:"createElement",value:function(e){var i=e.nodeName.replace(/^[^:]+:/,""),r=t.elementTypes[i];return void 0!==r?new r(this,e):new jt(this,e)}},{key:"createTextNode",value:function(t){return new Yt(this,t)}},{key:"setViewBox",value:function(t){this.screen.setViewBox(function(t){for(var e=1;e2&&void 0!==arguments[2]?arguments[2]:{};M.default(this,t),this.parser=new At(r),this.screen=new Mt(e,r),this.options=r;var n=new Si(this,r),o=n.createDocumentElement(i);this.document=n,this.documentElement=o}var e,i;return T.default(t,[{key:"fork",value:function(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.from(e,i,Ei(Ei({},this.options),r))}},{key:"forkString",value:function(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.fromString(e,i,Ei(Ei({},this.options),r))}},{key:"ready",value:function(){return this.screen.ready()}},{key:"isReady",value:function(){return this.screen.isReady()}},{key:"render",value:(i=w.default(b.default.mark((function t(){var e,i=arguments;return b.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=i.length>0&&void 0!==i[0]?i[0]:{},this.start(Ei({enableRedraw:!0,ignoreAnimation:!0,ignoreMouse:!0},e)),t.next=4,this.ready();case 4:this.stop();case 5:case"end":return t.stop()}}),t,this)}))),function(){return i.apply(this,arguments)})},{key:"start",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.documentElement,i=this.screen,r=this.options;i.start(e,Ei(Ei({enableRedraw:!0},r),t))}},{key:"stop",value:function(){this.screen.stop()}},{key:"resize",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.documentElement.resize(t,e,i)}}],[{key:"from",value:(e=w.default(b.default.mark((function e(i,r){var n,o,a,l=arguments;return b.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=new At(n=l.length>2&&void 0!==l[2]?l[2]:{}),e.next=4,o.parse(r);case 4:return a=e.sent,e.abrupt("return",new t(i,a,n));case 6:case"end":return e.stop()}}),e)}))),function(t,i){return e.apply(this,arguments)})},{key:"fromString",value:function(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new t(e,new At(r).parseFromString(i),r)}}]),t}();e.AElement=ke,e.AnimateColorElement=Ce,e.AnimateElement=be,e.AnimateTransformElement=Me,e.BoundingBox=Ht,e.CB1=ct,e.CB2=ut,e.CB3=ht,e.CB4=pt,e.Canvg=Ai,e.CircleElement=Qt,e.ClipPathElement=ii,e.DefsElement=ae,e.DescElement=yi,e.Document=Si,e.Element=Rt,e.EllipseElement=te,e.FeColorMatrixElement=Je,e.FeCompositeElement=fi,e.FeDropShadowElement=pi,e.FeGaussianBlurElement=mi,e.FeMorphologyElement=di,e.FilterElement=ui,e.Font=Ut,e.FontElement=Ee,e.FontFaceElement=Le,e.GElement=de,e.GlyphElement=$t,e.GradientElement=fe,e.ImageElement=Be,e.LineElement=ee,e.LinearGradientElement=me,e.MarkerElement=se,e.MaskElement=Qe,e.Matrix=Ot,e.MissingGlyphElement=Pe,e.Mouse=vt,e.PSEUDO_ZERO=it,e.Parser=At,e.PathElement=Zt,e.PathParser=Gt,e.PatternElement=ne,e.Point=_t,e.PolygonElement=re,e.PolylineElement=ie,e.Property=gt,e.QB1=dt,e.QB2=ft,e.QB3=mt,e.RadialGradientElement=_e,e.RectElement=Jt,e.RenderedElement=qt,e.Rotate=It,e.SVGElement=Kt,e.SVGFontLoader=Ue,e.Scale=Pt,e.Screen=Mt,e.Skew=kt,e.SkewX=Ft,e.SkewY=Dt,e.StopElement=xe,e.StyleElement=He,e.SymbolElement=Ve,e.TRefElement=Oe,e.TSpanElement=Xt,e.TextElement=Wt,e.TextPathElement=Re,e.TitleElement=gi,e.Transform=zt,e.Translate=Lt,e.UnknownElement=jt,e.UseElement=Ge,e.ViewPort=yt,e.compressSpaces=j,e.default=Ai,e.getSelectorSpecificity=et,e.normalizeAttributeName=H,e.normalizeColor=q,e.parseExternalUrl=G,e.presets=z,e.toNumbers=V,e.trimLeft=N,e.trimRight=B,e.vectorMagnitude=ot,e.vectorsAngle=lt,e.vectorsRatio=at}).call(this,i(102))},function(t,e,i){t.exports=i(22)(2786)},function(t,e,i){t.exports=i(22)(2791)},function(t,e,i){t.exports=i(22)(2807)},function(t,e,i){t.exports=i(22)(2980)},function(t,e,i){t.exports=i(22)(2951)},function(t,e,i){t.exports=i(22)(2685)},function(t,e,i){t.exports=i(22)(2789)},function(t,e,i){t.exports=i(22)(1148)},function(t,e,i){t.exports=i(22)(2832)},function(t,e,i){t.exports=i(22)(2838)},function(t,e,i){t.exports=i(22)(2842)},function(t,e,i){t.exports=i(22)(2683)},function(t,e,i){t.exports=i(22)(2968)},function(t,e,i){t.exports=i(22)(2952)},function(t,e,i){t.exports=i(22)(2957)},function(t,e,i){t.exports=i(22)(2666)},function(t,e,i){t.exports=i(22)(2668)},function(t,e,i){t.exports=i(22)(2688)},function(t,e,i){t.exports=i(22)(2828)},function(t,e,i){t.exports=i(22)(2841)},function(t,e,i){(function(e){for(var r=i(434),n="undefined"==typeof window?e:window,o=["moz","webkit"],a="AnimationFrame",l=n["request"+a],c=n["cancel"+a]||n["cancelRequest"+a],u=0;!l&&u3&&(this.alpha=l[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var t=this.r.toString(16),e=this.g.toString(16),i=this.b.toString(16);return 1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==i.length&&(i="0"+i),"#"+t+e+i},this.getHelpXML=function(){for(var t=new Array,r=0;r "+u.toRGB()+" -> "+u.toHex());c.appendChild(h),c.appendChild(p),l.appendChild(c)}catch(t){}return l}}},function(t,e,i){t.exports=i(22)(2677)},function(t,e,i){t.exports=i(22)(2912)},function(t,e,i){t.exports=i(22)(2962)},function(t,e,i){t.exports=i(22)(2961)},function(t,e,i){t.exports=i(22)(2678)},function(t,e,i){t.exports=i(22)(2680)},function(t,e,i){t.exports=i(22)(2692)},function(t,e,i){t.exports=i(22)(2830)},function(t,e,i){t.exports=i(22)(1445)},function(t,e,i){t.exports=i(22)(2973)},function(t,e,i){t.exports=i(22)(2681)},function(t,e,i){t.exports=i(22)(2690)},function(t,e,i){var r=i(451);function n(){return"undefined"!=typeof Reflect&&Reflect.get?(t.exports=n=Reflect.get.bind(),t.exports.__esModule=!0,t.exports.default=t.exports):(t.exports=n=function(t,e,i){var n=r(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:i):o.value}},t.exports.__esModule=!0,t.exports.default=t.exports),n.apply(this,arguments)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,i){var r=i(267);t.exports=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=r(t)););return t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,i){t.exports=i(22)(2747)},function(t,e,i){t.exports=i(22)(2669)},function(t,e,i){!function(t){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,i)};function i(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}var r=" ";function n(t){var e="";Array.isArray(t)||(t=[t]);for(var i=0;it.phi1&&(t.phi2-=2*l),1===t.sweepFlag&&t.phi2r)return[];if(0===r)return[[t*i/(t*t+e*e),e*i/(t*t+e*e)]];var n=Math.sqrt(r);return[[(t*i+e*n)/(t*t+e*e),(e*i-t*n)/(t*t+e*e)],[(t*i-e*n)/(t*t+e*e),(e*i+t*n)/(t*t+e*e)]]}var h=Math.PI/180;function p(t,e,i){return(1-i)*t+i*e}function d(t,e,i,r){return t+Math.cos(r/180*l)*e+Math.sin(r/180*l)*i}function f(t,e,i,r){var n=1e-6,o=e-t,a=i-e,l=3*o+3*(r-i)-6*a,c=6*(a-o),u=3*o;return Math.abs(l)y&&(n.sweepFlag=+!n.sweepFlag),n}))}t.ROUND=function(t){function e(e){return Math.round(e*t)/t}return void 0===t&&(t=1e13),a(t),function(t){return void 0!==t.x1&&(t.x1=e(t.x1)),void 0!==t.y1&&(t.y1=e(t.y1)),void 0!==t.x2&&(t.x2=e(t.x2)),void 0!==t.y2&&(t.y2=e(t.y2)),void 0!==t.x&&(t.x=e(t.x)),void 0!==t.y&&(t.y=e(t.y)),void 0!==t.rX&&(t.rX=e(t.rX)),void 0!==t.rY&&(t.rY=e(t.rY)),t}},t.TO_ABS=e,t.TO_REL=function(){return n((function(t,e,i){return t.relative||(void 0!==t.x1&&(t.x1-=e),void 0!==t.y1&&(t.y1-=i),void 0!==t.x2&&(t.x2-=e),void 0!==t.y2&&(t.y2-=i),void 0!==t.x&&(t.x-=e),void 0!==t.y&&(t.y-=i),t.relative=!0),t}))},t.NORMALIZE_HVZ=function(t,e,i){return void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i&&(i=!0),n((function(r,n,o,a,l){if(isNaN(a)&&!(r.type&b.MOVE_TO))throw new Error("path must start with moveto");return e&&r.type&b.HORIZ_LINE_TO&&(r.type=b.LINE_TO,r.y=r.relative?0:o),i&&r.type&b.VERT_LINE_TO&&(r.type=b.LINE_TO,r.x=r.relative?0:n),t&&r.type&b.CLOSE_PATH&&(r.type=b.LINE_TO,r.x=r.relative?a-n:a,r.y=r.relative?l-o:l),r.type&b.ARC&&(0===r.rX||0===r.rY)&&(r.type=b.LINE_TO,delete r.rX,delete r.rY,delete r.xRot,delete r.lArcFlag,delete r.sweepFlag),r}))},t.NORMALIZE_ST=i,t.QT_TO_C=r,t.INFO=n,t.SANITIZE=function(t){void 0===t&&(t=0),a(t);var e=NaN,i=NaN,r=NaN,o=NaN;return n((function(n,a,l,c,u){var h=Math.abs,p=!1,d=0,f=0;if(n.type&b.SMOOTH_CURVE_TO&&(d=isNaN(e)?0:a-e,f=isNaN(i)?0:l-i),n.type&(b.CURVE_TO|b.SMOOTH_CURVE_TO)?(e=n.relative?a+n.x2:n.x2,i=n.relative?l+n.y2:n.y2):(e=NaN,i=NaN),n.type&b.SMOOTH_QUAD_TO?(r=isNaN(r)?a:2*a-r,o=isNaN(o)?l:2*l-o):n.type&b.QUAD_TO?(r=n.relative?a+n.x1:n.x1,o=n.relative?l+n.y1:n.y2):(r=NaN,o=NaN),n.type&b.LINE_COMMANDS||n.type&b.ARC&&(0===n.rX||0===n.rY||!n.lArcFlag)||n.type&b.CURVE_TO||n.type&b.SMOOTH_CURVE_TO||n.type&b.QUAD_TO||n.type&b.SMOOTH_QUAD_TO){var m=void 0===n.x?0:n.relative?n.x:n.x-a,g=void 0===n.y?0:n.relative?n.y:n.y-l;d=isNaN(r)?void 0===n.x1?d:n.relative?n.x:n.x1-a:r-a,f=isNaN(o)?void 0===n.y1?f:n.relative?n.y:n.y1-l:o-l;var y=void 0===n.x2?0:n.relative?n.x:n.x2-a,_=void 0===n.y2?0:n.relative?n.y:n.y2-l;h(m)<=t&&h(g)<=t&&h(d)<=t&&h(f)<=t&&h(y)<=t&&h(_)<=t&&(p=!0)}return n.type&b.CLOSE_PATH&&h(a-c)<=t&&h(l-u)<=t&&(p=!0),p?[]:n}))},t.MATRIX=l,t.ROTATE=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),a(t,e,i);var r=Math.sin(t),n=Math.cos(t);return l(n,r,-r,n,e-e*n+i*r,i-e*r-i*n)},t.TRANSLATE=function(t,e){return void 0===e&&(e=0),a(t,e),l(1,0,0,1,t,e)},t.SCALE=function(t,e){return void 0===e&&(e=t),a(t,e),l(t,0,0,e,0,0)},t.SKEW_X=function(t){return a(t),l(1,0,Math.atan(t),1,0,0)},t.SKEW_Y=function(t){return a(t),l(1,Math.atan(t),0,1,0,0)},t.X_AXIS_SYMMETRY=function(t){return void 0===t&&(t=0),a(t),l(-1,0,0,1,t,0)},t.Y_AXIS_SYMMETRY=function(t){return void 0===t&&(t=0),a(t),l(1,0,0,-1,0,t)},t.A_TO_C=function(){return n((function(t,e,i){return b.ARC===t.type?function(t,e,i){var r,n,a,l;t.cX||c(t,e,i);for(var u=Math.min(t.phi1,t.phi2),d=Math.max(t.phi1,t.phi2)-u,f=Math.ceil(d/90),m=new Array(f),g=e,y=i,_=0;_l.maxX&&(l.maxX=t),tl.maxY&&(l.maxY=t),tD&&h(m(i,n.x1,n.x2,n.x,D));for(var _=0,v=f(r,n.y1,n.y2,n.y);_D&&p(m(r,n.y1,n.y2,n.y,D))}if(n.type&b.ARC){h(n.x),p(n.y),c(n,i,r);for(var x=n.xRot/180*Math.PI,w=Math.cos(x)*n.rX,C=Math.sin(x)*n.rX,S=-Math.sin(x)*n.rY,M=Math.cos(x)*n.rY,T=n.phi1n.phi2?[n.phi2+360,n.phi1+360]:[n.phi2,n.phi1],E=T[0],A=T[1],I=function(t){var e=t[0],i=t[1],r=180*Math.atan2(i,e)/Math.PI;return rE&&DE&&Dc)throw new SyntaxError('Expected positive number, got "'+c+'" at index "'+n+'"')}else if((3===this.curArgs.length||4===this.curArgs.length)&&"0"!==this.curNumber&&"1"!==this.curNumber)throw new SyntaxError('Expected a flag, got "'+this.curNumber+'" at index "'+n+'"');this.curArgs.push(c),this.curArgs.length===w[this.curCommandType]&&(b.HORIZ_LINE_TO===this.curCommandType?r({type:b.HORIZ_LINE_TO,relative:this.curCommandRelative,x:c}):b.VERT_LINE_TO===this.curCommandType?r({type:b.VERT_LINE_TO,relative:this.curCommandRelative,y:c}):this.curCommandType===b.MOVE_TO||this.curCommandType===b.LINE_TO||this.curCommandType===b.SMOOTH_QUAD_TO?(r({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),b.MOVE_TO===this.curCommandType&&(this.curCommandType=b.LINE_TO)):this.curCommandType===b.CURVE_TO?r({type:b.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===b.SMOOTH_CURVE_TO?r({type:b.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===b.QUAD_TO?r({type:b.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===b.ARC&&r({type:b.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=!1,this.curNumberHasExp=!1,this.curNumberHasDecimal=!1,this.canParseCommandOrComma=!0}if(!_(o))if(","===o&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if("+"!==o&&"-"!==o&&"."!==o)if(l)this.curNumber=o,this.curNumberHasDecimal=!1;else{if(0!==this.curArgs.length)throw new SyntaxError("Unterminated command at index "+n+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+o+'" at index '+n+". Command cannot follow comma");if(this.canParseCommandOrComma=!1,"z"!==o&&"Z"!==o)if("h"===o||"H"===o)this.curCommandType=b.HORIZ_LINE_TO,this.curCommandRelative="h"===o;else if("v"===o||"V"===o)this.curCommandType=b.VERT_LINE_TO,this.curCommandRelative="v"===o;else if("m"===o||"M"===o)this.curCommandType=b.MOVE_TO,this.curCommandRelative="m"===o;else if("l"===o||"L"===o)this.curCommandType=b.LINE_TO,this.curCommandRelative="l"===o;else if("c"===o||"C"===o)this.curCommandType=b.CURVE_TO,this.curCommandRelative="c"===o;else if("s"===o||"S"===o)this.curCommandType=b.SMOOTH_CURVE_TO,this.curCommandRelative="s"===o;else if("q"===o||"Q"===o)this.curCommandType=b.QUAD_TO,this.curCommandRelative="q"===o;else if("t"===o||"T"===o)this.curCommandType=b.SMOOTH_QUAD_TO,this.curCommandRelative="t"===o;else{if("a"!==o&&"A"!==o)throw new SyntaxError('Unexpected character "'+o+'" at index '+n+".");this.curCommandType=b.ARC,this.curCommandRelative="a"===o}else e.push({type:b.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1}else this.curNumber=o,this.curNumberHasDecimal="."===o}else this.curNumber+=o,this.curNumberHasDecimal=!0;else this.curNumber+=o;else this.curNumber+=o,this.curNumberHasExp=!0;else this.curNumber+=o,this.curNumberHasExpDigits=this.curNumberHasExp}return e},e.prototype.transform=function(t){return Object.create(this,{parse:{value:function(e,i){void 0===i&&(i=[]);for(var r=0,n=Object.getPrototypeOf(this).parse.call(this,e);r>M;if(h[C+3]=et,0!==et){var it=255/et;h[C]=(U*S>>M)*it,h[C+1]=(H*S>>M)*it,h[C+2]=(G*S>>M)*it}else h[C]=h[C+1]=h[C+2]=0;U-=j,H-=N,G-=B,q-=V,j-=x.r,N-=x.g,B-=x.b,V-=x.a;var ot=tt+l+1;ot=w+(ot>M,gt>0?(gt=255/gt,h[Rt]=(St*S>>M)*gt,h[Rt+1]=(Mt*S>>M)*gt,h[Rt+2]=(Tt*S>>M)*gt):h[Rt]=h[Rt+1]=h[Rt+2]=0,St-=yt,Mt-=_t,Tt-=vt,Et-=Ct,yt-=x.r,_t-=x.g,vt-=x.b,Ct-=x.a,Rt=pt+((Rt=zt+m)>M,h[E+1]=j*S>>M,h[E+2]=N*S>>M,z-=k,j-=F,N-=D,k-=w.r,F-=w.g,D-=w.b,x=T+((x=q+l+1)>M,h[x+1]=et*S>>M,h[x+2]=it*S>>M,tt-=Y,et-=K,it-=J,Y-=w.r,K-=w.g,J-=w.b,x=Z+((x=pt+m)1)return 1;for(var i=t,r=0;r<8;r++){var n=this.sampleCurveX(i)-t;if(Math.abs(n)n?a=i:l=i,i=.5*(l-a)+a;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var l=e(o);function c(t,e,i,r){const n=new l(t,e,i,r);return function(t){return n.solve(t)}}const u=c(.25,.1,.25,1);function h(t,e,i){return Math.min(i,Math.max(e,t))}function p(t,e,i){const r=i-e,n=((t-e)%r+r)%r+e;return n===e?i:n}function d(t,e,i){if(!t.length)return i(null,[]);let r=t.length;const n=new Array(t.length);let o=null;t.forEach(((t,a)=>{e(t,((t,e)=>{t&&(o=t),n[a]=e,0==--r&&i(o,n)}))}))}function f(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}function m(t,e){const i={};for(let r=0;r{e[t]&&(e[t]=e[t].bind(e))}))}function v(t,e,i){const r={};for(const n in t)r[n]=e.call(i||this,t[n],n,t);return r}function x(t,e,i){const r={};for(const n in t)e.call(i||this,t[n],n,t)&&(r[n]=t[n]);return r}function b(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i(e.y-t.y)*(i.x-t.x)}function T(t){let e=0;for(let i,r,n=0,o=t.length,a=o-1;ncancelAnimationFrame(e)}},getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){const e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,i.drawImage(t,0,0,t.width,t.height),i},resolveURL:t=>(k||(k=document.createElement("a")),k.href=t,k.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==F&&(F=matchMedia("(prefers-reduced-motion: reduce)")),F.matches)}};class L{static testProp(t){if(!L.docStyle)return t[0];for(let e=0;e{window.removeEventListener("click",L.suppressClickInternal,!0)}),0)}static mousePos(t,e){const i=t.getBoundingClientRect();return new n(e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop)}static touchPos(t,e){const i=t.getBoundingClientRect(),r=[];for(let o=0;oself.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href,N=t=>z.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))];function B(t,e){const i=new AbortController,r=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:j(),signal:i.signal});let n=!1,o=!1;return"json"===t.type&&r.headers.set("Accept","application/json"),o||fetch(r).then((i=>i.ok?(i=>{("arrayBuffer"===t.type||"image"===t.type?i.arrayBuffer():"json"===t.type?i.json():i.text()).then((t=>{o||(n=!0,e(null,t,i.headers.get("Cache-Control"),i.headers.get("Expires")))})).catch((t=>{o||e(new Error(t.message))}))})(i):i.blob().then((r=>e(new R(i.status,i.statusText,t.url,r)))))).catch((t=>{20!==t.code&&e(new Error(t.message))})),{cancel:()=>{o=!0,n||i.abort()}}}const V=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(E()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!E())return(N(t.url)||B)(t,e)}if(!(/^file:/.test(i=t.url)||/^file:/.test(j())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return B(t,e);if(E()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var i;return function(t,e){const i=new XMLHttpRequest;i.open(t.method||"GET",t.url,!0),"arrayBuffer"!==t.type&&"image"!==t.type||(i.responseType="arraybuffer");for(const e in t.headers)i.setRequestHeader(e,t.headers[e]);return"json"===t.type&&(i.responseType="text",i.setRequestHeader("Accept","application/json")),i.withCredentials="include"===t.credentials,i.onerror=()=>{e(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"===t.type)try{r=JSON.parse(i.response)}catch(t){return e(t)}e(null,r,i.getResponseHeader("Cache-Control"),i.getResponseHeader("Expires"))}else{const r=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});e(new R(i.status,i.statusText,t.url,r))}},i.send(t.body),{cancel:()=>i.abort()}}(t,e)},U=function(t,e){return V(f(t,{type:"json"}),e)},H=function(t,e){return V(f(t,{type:"arrayBuffer"}),e)};function G(t){if(!t||t.indexOf("://")<=0||0===t.indexOf("data:image/")||0===t.indexOf("blob:"))return!0;const e=new URL(t),i=window.location;return e.protocol===i.protocol&&e.host===i.host}const q={supported:!1,testSupport:function(t){!W&&$&&(X?Y(t):Z=t)}};let Z,$,W=!1,X=!1;function Y(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,$),t.isContextLost())return;q.supported=!0}catch(t){}t.deleteTexture(e),W=!0}var K;"undefined"!=typeof document&&($=document.createElement("img"),$.onload=function(){Z&&Y(Z),Z=null,X=!0},$.onerror=function(){W=!0,Z=null},$.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(t){let e,i,r,n;t.resetRequestQueue=()=>{e=[],i=0,r=0,n={}},t.addThrottleControl=t=>{const e=r++;return n[e]=t,e},t.removeThrottleControl=t=>{delete n[t],l()},t.getImage=(t,r,n=!0)=>{q.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*");const o={requestParameters:t,supportImageRefresh:n,callback:r,cancelled:!1,completed:!1,cancel:()=>{o.completed||o.cancelled||(o.cancelled=!0,o.innerRequest&&(o.innerRequest.cancel(),i--),l())}};return e.push(o),l(),o};const o=t=>{const{requestParameters:e,supportImageRefresh:i,callback:r}=t;return f(e,{type:"image"}),(!1!==i||E()||N(e.url)||e.headers&&!Object.keys(e.headers).reduce(((t,e)=>t&&"accept"===e),!0)?V:c)(e,((e,i,n,o)=>{a(t,r,e,i,n,o)}))},a=(t,e,r,n,o,a)=>{r?e(r):n instanceof HTMLImageElement||n instanceof ImageBitmap?e(null,n):n&&((t,e)=>{"function"==typeof createImageBitmap?function(t,e){const i=new Blob([new Uint8Array(t)],{type:"image/png"});createImageBitmap(i).then((t=>{e(null,t)})).catch((t=>{e(new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))}(t,e):function(t,e){const i=new Image;i.onload=()=>{e(null,i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame((()=>{i.src=O}))},i.onerror=()=>e(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(t)],{type:"image/png"});i.src=t.byteLength?URL.createObjectURL(r):O}(t,e)})(n,((t,i)=>{null!=t?e(t):null!=i&&e(null,i,{cacheControl:o,expires:a})})),t.cancelled||(t.completed=!0,i--,l())},l=()=>{const t=(()=>{const t=Object.keys(n);let e=!1;if(t.length>0)for(const i of t)if(e=n[i](),e)break;return e})()?z.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:z.MAX_PARALLEL_IMAGE_REQUESTS;for(let r=i;r0;r++){const t=e.shift();if(t.cancelled){r--;continue}const n=o(t);i++,t.innerRequest=n}},c=(t,e)=>{const i=new Image,r=t.url;let n=!1;const o=t.credentials;return o&&"include"===o?i.crossOrigin="use-credentials":(o&&"same-origin"===o||!G(r))&&(i.crossOrigin="anonymous"),i.fetchPriority="high",i.onload=()=>{e(null,i),i.onerror=i.onload=null},i.onerror=()=>{n||e(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.")),i.onerror=i.onload=null},i.src=r,{cancel:()=>{n=!0,i.src=""}}}}(K||(K={})),K.resetRequestQueue();var J,tt=K;!function(t){t.Glyphs="Glyphs",t.Image="Image",t.Source="Source",t.SpriteImage="SpriteImage",t.SpriteJSON="SpriteJSON",t.Style="Style",t.Tile="Tile",t.Unknown="Unknown"}(J||(J={}));class Q{constructor(t){this._transformRequestFn=t}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeSpriteURL(t,e,i){const r=function(t){const e=t.match(et);if(!e)throw new Error(`Unable to parse URL "${t}"`);return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}(t);return r.path+=`${e}${i}`,function(t){const e=t.params.length?`?${t.params.join("&")}`:"";return`${t.protocol}://${t.authority}${t.path}${e}`}(r)}setTransformRequest(t){this._transformRequestFn=t}}const et=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function it(t,e,i){i[t]&&-1!==i[t].indexOf(e)||(i[t]=i[t]||[],i[t].push(e))}function ot(t,e,i){if(i&&i[t]){const r=i[t].indexOf(e);-1!==r&&i[t].splice(r,1)}}class rt{constructor(t,e={}){f(this,e),this.type=t}}class st extends rt{constructor(t,e={}){super("error",f({error:t},e))}}class nt{on(t,e){return this._listeners=this._listeners||{},it(t,e,this._listeners),this}off(t,e){return ot(t,e,this._listeners),ot(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},it(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){"string"==typeof t&&(t=new rt(t,e||{}));const i=t.type;if(this.listens(i)){t.target=this;const e=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(const i of e)i.call(this,t);const r=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const e of r)ot(i,e,this._oneTimeListeners),e.call(this,t);const n=this._eventedParent;n&&(f(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),n.fire(t))}else t instanceof st&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}var at={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const lt=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function ct(t,e){const i={};for(const e in t)"ref"!==e&&(i[e]=t[e]);return lt.forEach((t=>{t in e&&(i[t]=e[t])})),i}function ut(t){t=t.slice();const e=Object.create(null);for(let i=0;i`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const Rt=[St,Mt,Tt,Et,At,Ot,Lt,Dt(It),kt,Ft];function jt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!jt(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of Rt)if(!jt(t,e))return null}return`Expected ${zt(t)} but found ${zt(e)} instead.`}function Nt(t,e){return e.some((e=>e.kind===t.kind))}function Bt(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}function Vt(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const Ut=.96422,Ht=.82521,Gt=4/29,qt=6/29,Zt=3*qt*qt,$t=qt*qt*qt,Wt=Math.PI/180,Xt=180/Math.PI;function Yt(t){return(t%=360)<0&&(t+=360),t}function Kt([t,e,i,r]){let n,o;const a=Qt((.2225045*(t=Jt(t))+.7168786*(e=Jt(e))+.0606169*(i=Jt(i)))/1);t===e&&e===i?n=o=a:(n=Qt((.4360747*t+.3850649*e+.1430804*i)/Ut),o=Qt((.0139322*t+.0971045*e+.7141733*i)/Ht));const l=116*a-16;return[l<0?0:l,500*(n-a),200*(a-o),r]}function Jt(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Qt(t){return t>$t?Math.pow(t,1/3):t/Zt+Gt}function te([t,e,i,r]){let n=(t+16)/116,o=isNaN(e)?n:n+e/500,a=isNaN(i)?n:n-i/200;return n=1*ie(n),o=Ut*ie(o),a=Ht*ie(a),[ee(3.1338561*o-1.6168667*n-.4906146*a),ee(-.9787684*o+1.9161415*n+.033454*a),ee(.0719453*o-.2289914*n+1.4052427*a),r]}function ee(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function ie(t){return t>qt?t*t*t:Zt*(t-Gt)}function re(t){return parseInt(t.padEnd(2,t),16)/255}function ne(t,e){return se(e?t/100:t,0,1)}function se(t,e,i){return Math.min(Math.max(e,t),i)}function ae(t){return!t.some(Number.isNaN)}const de={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class oe{constructor(t,e,i,r=1,n=!0){this.r=t,this.g=e,this.b=i,this.a=r,n||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[t,e,i,r]))}static parse(t){if(t instanceof oe)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase()))return[0,0,0,0];const e=de[t];if(e){const[t,i,r]=e;return[t/255,i/255,r/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let i=1;return[re(t.slice(i,i+=e)),re(t.slice(i,i+=e)),re(t.slice(i,i+=e)),re(t.slice(i,i+e)||"ff")]}if(t.startsWith("rgb")){const e=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(e){const[t,i,r,n,o,a,l,c,u,h,p,d]=e,f=[n||" ",l||" ",h].join("");if(" "===f||" /"===f||",,"===f||",,,"===f){const t=[r,a,u].join(""),e="%%%"===t?100:""===t?255:0;if(e){const t=[se(+i/e,0,1),se(+o/e,0,1),se(+c/e,0,1),p?ne(+p,d):1];if(ae(t))return t}}return}}const i=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[t,e,r,n,o,a,l,c,u]=i,h=[r||" ",o||" ",l].join("");if(" "===h||" /"===h||",,"===h||",,,"===h){const t=[+e,se(+n,0,100),se(+a,0,100),c?ne(+c,u):1];if(ae(t))return function([t,e,i,r]){function n(r){const n=(r+t/30)%12,o=e*Math.min(i,1-i);return i-o*Math.max(-1,Math.min(n-3,9-n,1))}return t=Yt(t),e/=100,i/=100,[n(0),n(8),n(4),r]}(t)}}}(t);return e?new oe(...e,!1):void 0}get rgb(){const{r:t,g:e,b:i,a:r}=this,n=r||1/0;return this.overwriteGetter("rgb",[t/n,e/n,i/n,r])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,i,r,n]=Kt(t),o=Math.sqrt(i*i+r*r);return[Math.round(1e4*o)?Yt(Math.atan2(r,i)*Xt):NaN,o,e,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Kt(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,i,r]=this.rgb;return`rgba(${[t,e,i].map((t=>Math.round(255*t))).join(",")},${r})`}}oe.black=new oe(0,0,0,1),oe.white=new oe(1,1,1,1),oe.transparent=new oe(0,0,0,0),oe.red=new oe(1,0,0,1);class le{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ce{constructor(t,e,i,r,n){this.text=t,this.image=e,this.scale=i,this.fontStack=r,this.textColor=n}}class he{constructor(t){this.sections=t}static fromString(t){return new he([new ce(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof he?t:he.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}}class ue{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ue)return t;if("number"==typeof t)return new ue([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new ue(t)}}toString(){return JSON.stringify(this.values)}}class pe{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new pe({name:t,available:!1}):null}}function fe(t,e,i,r){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[t,e,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[t,e,i,r]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function me(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof oe)return!0;if(t instanceof le)return!0;if(t instanceof he)return!0;if(t instanceof ue)return!0;if(t instanceof pe)return!0;if(Array.isArray(t)){for(const e of t)if(!me(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!me(t[e]))return!1;return!0}return!1}function _e(t){if(null===t)return St;if("string"==typeof t)return Tt;if("boolean"==typeof t)return Et;if("number"==typeof t)return Mt;if(t instanceof oe)return At;if(t instanceof le)return Pt;if(t instanceof he)return Ot;if(t instanceof ue)return kt;if(t instanceof pe)return Ft;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=_e(e);if(i){if(i===t)continue;i=It;break}i=t}return Dt(i||It,e)}return Lt}function xe(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof oe||t instanceof he||t instanceof ue||t instanceof pe?t.toString():JSON.stringify(t)}class ge{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!me(t[1]))return e.error("invalid value");const i=t[1];let r=_e(i);const n=e.expectedType;return"array"!==r.kind||0!==r.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(r=n),new ge(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class ye{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const be={string:Tt,number:Mt,boolean:Et,object:Lt};class ve{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,r=1;const n=t[0];if("array"===n){let n,o;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in be)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);n=be[i],r++}else n=It;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);o=t[2],r++}i=Dt(n,o)}else{if(!be[n])throw new Error(`Types doesn't contain name = ${n}`);i=be[n]}const o=[];for(;rt.outputDefined()))}}const Ce={"to-boolean":Et,"to-color":At,"to-number":Mt,"to-string":Tt};class we{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[0];if(!Ce[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");const r=Ce[i],n=[];for(let i=1;i4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:fe(e[0],e[1],e[2],e[3]),!i))return new oe(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new ye(i||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}if("padding"===this.type.kind){let e;for(const i of this.args){e=i.evaluate(t);const r=ue.parse(e);if(r)return r}throw new ye(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}if("number"===this.type.kind){let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const r=Number(e);if(!isNaN(r))return r}throw new ye(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?he.fromString(xe(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?pe.fromString(xe(this.args[0].evaluate(t))):xe(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const Me=["Unknown","Point","LineString","Polygon"];class Se{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Me[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=oe.parse(t)),e}}class Ie{constructor(t,e,i=[],r,n=new wt,o=[]){this.registry=t,this.path=i,this.key=i.map((t=>`[${t}]`)).join(""),this.scope=n,this.errors=o,this.expectedType=r,this._isConstant=e}parse(t,e,i,r,n={}){return e?this.concat(e,i,r)._parse(t,n):this._parse(t,n)}_parse(t,e){function i(t,e,i){return"assert"===i?new ve(e,[t]):"coerce"===i?new we(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=t[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const n=this.registry[r];if(n){let r=n.parse(t,this);if(!r)return null;if(this.expectedType){const t=this.expectedType,n=r.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==n.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==n.kind&&"string"!==n.kind)if("padding"!==t.kind||"value"!==n.kind&&"number"!==n.kind&&"array"!==n.kind){if(this.checkSubtype(t,n))return null}else r=i(r,t,e.typeAnnotation||"coerce");else r=i(r,t,e.typeAnnotation||"coerce");else r=i(r,t,e.typeAnnotation||"assert")}if(!(r instanceof ge)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){const e=new Se;try{r=new ge(r.type,r.evaluate(e))}catch(t){return this.error(t.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){const r="number"==typeof t?this.path.concat(t):this.path,n=i?this.scope.concat(i):this.scope;return new Ie(this.registry,this._isConstant,r,e||null,n,this.errors)}error(t,...e){const i=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new bt(i,t))}checkSubtype(t,e){const i=jt(t,e);return i&&this.error(i),i}}class Ae{constructor(t,e,i){this.type=Pt,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const i=t[1];if("object"!=typeof i||Array.isArray(i))return e.error("Collator options argument must be an object.");const r=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,Et);if(!r)return null;const n=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,Et);if(!n)return null;let o=null;return i.locale&&(o=e.parse(i.locale,1,Tt),!o)?null:new Ae(r,n,o)}evaluate(t){return new le(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}const Te=8192;function Ee(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function Le(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Pe(t,e){const i=(180+t[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,n=Math.pow(2,e.z);return[Math.round(i*n*Te),Math.round(r*n*Te)]}function Oe(t,e,i){const r=t[0]-e[0],n=t[1]-e[1],o=t[0]-i[0],a=t[1]-i[1];return r*a-o*n==0&&r*o<=0&&n*a<=0}function ke(t,e){let i=!1;for(let a=0,l=e.length;a(r=t)[1]!=(o=l[e+1])[1]>r[1]&&r[0]<(o[0]-n[0])*(r[1]-n[1])/(o[1]-n[1])+n[0]&&(i=!i)}}var r,n,o;return i}function Fe(t,e){for(let i=0;i0&&l<0||a<0&&l>0}function ze(t,e,i){for(const u of i)for(let i=0;ii[2]){const e=.5*r;let n=t[0]-i[0]>e?-r:i[0]-t[0]>e?r:0;0===n&&(n=t[0]-i[2]>e?-r:i[2]-t[0]>e?r:0),t[0]+=n}Ee(e,t)}function He(t,e,i,r){const n=Math.pow(2,r.z)*Te,o=[r.x*Te,r.y*Te],a=[];for(const r of t)for(const t of r){const r=[t.x+o[0],t.y+o[1]];Ue(r,e,i,n),a.push(r)}return a}function Ge(t,e,i,r){const n=Math.pow(2,r.z)*Te,o=[r.x*Te,r.y*Te],a=[];for(const i of t){const t=[];for(const r of i){const i=[r.x+o[0],r.y+o[1]];Ee(e,i),t.push(i)}a.push(t)}if(e[2]-e[0]<=n/2){(l=e)[0]=l[1]=1/0,l[2]=l[3]=-1/0;for(const t of a)for(const r of t)Ue(r,e,i,n)}var l;return a}class qe{constructor(t,e){this.type=Et,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(me(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t!Array.isArray(e)||e.length===t.length-1));let l=null;for(const[r,o]of a){l=new Ie(e.registry,$e,e.path,null,e.scope);const a=[];let c=!1;for(let e=1;e{return e=t,Array.isArray(e)?`(${e.map(zt).join(", ")})`:`(${zt(e.type)}...)`;var e})).join(" | "),r=[];for(let i=1;i{i=e?i&&$e(t):i&&t instanceof ge})),!!i&&We(t)&&Ke(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function We(t){if(t instanceof Ze){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof qe)return!1;let e=!0;return t.eachChild((t=>{e&&!We(t)&&(e=!1)})),e}function Xe(t){if(t instanceof Ze&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!Xe(t)&&(e=!1)})),e}function Ke(t,e){if(t instanceof Ze&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((t=>{i&&!Ke(t,e)&&(i=!1)})),i}function Je(t,e){const i=t.length-1;let r,n,o=0,a=i,l=0;for(;o<=a;)if(l=Math.floor((o+a)/2),r=t[l],n=t[l+1],r<=e){if(l===i||ee))throw new ye("Input is not a number.");a=l-1}return 0}class Ye{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const i=e.parse(t[1],1,Mt);if(!i)return null;const r=[];let n=null;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(let i=1;i=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',l);const u=e.parse(a,c,n);if(!u)return null;n=n||u.type,r.push([o,u])}return new Ye(n,i,r)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);const n=e.length;return r>=e[n-1]?i[n-1].evaluate(t):i[Je(e,r)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Qe(t,e,i){return t+i*(e-t)}function ti(t,e,i){return t.map(((t,r)=>Qe(t,e[r],i)))}const ii={number:Qe,color:function(t,e,i,r="rgb"){switch(r){case"rgb":{const[r,n,o,a]=ti(t.rgb,e.rgb,i);return new oe(r,n,o,a,!1)}case"hcl":{const[r,n,o,a]=t.hcl,[l,c,u,h]=e.hcl;let p,d;if(isNaN(r)||isNaN(l))isNaN(r)?isNaN(l)?p=NaN:(p=l,1!==o&&0!==o||(d=c)):(p=r,1!==u&&0!==u||(d=n));else{let t=l-r;l>r&&t>180?t-=360:l180&&(t+=360),p=r+i*t}const[f,m,g,y]=function([t,e,i,r]){return t=isNaN(t)?0:t*Wt,te([i,Math.cos(t)*e,Math.sin(t)*e,r])}([p,null!=d?d:Qe(n,c,i),Qe(o,u,i),Qe(a,h,i)]);return new oe(f,m,g,y,!1)}case"lab":{const[r,n,o,a]=te(ti(t.lab,e.lab,i));return new oe(r,n,o,a,!1)}}},array:ti,padding:function(t,e,i){return new ue(ti(t.values,e.values,i))}};class ei{constructor(t,e,i,r,n){this.type=t,this.operator=e,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(const[t,e]of n)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,i,r){let n=0;if("exponential"===t.name)n=ui(e,t.base,i,r);else if("linear"===t.name)n=ui(e,1,i,r);else if("cubic-bezier"===t.name){const o=t.controlPoints;n=new l(o[0],o[1],o[2],o[3]).solve(ui(e,1,i,r))}return n}static parse(t,e){let[i,r,n,...o]=t;if(!Array.isArray(r)||0===r.length)return e.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const t=r[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:t}}else{if("cubic-bezier"!==r[0])return e.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const t=r.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(n=e.parse(n,2,Mt),!n)return null;const a=[];let l=null;"interpolate-hcl"===i||"interpolate-lab"===i?l=At:e.expectedType&&"value"!==e.expectedType.kind&&(l=e.expectedType);for(let t=0;t=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);const u=e.parse(r,c,l);if(!u)return null;l=l||u.type,a.push([i,u])}return Vt(l,Mt)||Vt(l,At)||Vt(l,kt)||Vt(l,Dt(Mt))?new ei(l,i,r,n,a):e.error(`Type ${zt(l)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);const n=e.length;if(r>=e[n-1])return i[n-1].evaluate(t);const o=Je(e,r),a=ei.interpolationFactor(this.interpolation,r,e[o],e[o+1]),l=i[o].evaluate(t),c=i[o+1].evaluate(t);switch(this.operator){case"interpolate":return ii[this.type.kind](l,c,a);case"interpolate-hcl":return ii.color(l,c,a,"hcl");case"interpolate-lab":return ii.color(l,c,a,"lab")}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function ui(t,e,i,r){const n=r-i,o=t-i;return 0===n?0:1===e?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}class ri{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expectected at least one argument.");let i=null;const r=e.expectedType;r&&"value"!==r.kind&&(i=r);const n=[];for(const r of t.slice(1)){const t=e.parse(r,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,n.push(t)}if(!i)throw new Error("No output type");const o=r&&n.some((t=>jt(r,t.type)));return new ri(o?It:i,n)}evaluate(t){let e,i=null,r=0;for(const n of this.args)if(r++,i=n.evaluate(t),i&&i instanceof pe&&!i.available&&(e||(e=i.name),i=null,r===this.args.length&&(i=e)),null!==i)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}class si{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const i=[];for(let r=1;r=i.length)throw new ye(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new ye(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class ai{constructor(t,e){this.type=Et,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,It),r=e.parse(t[2],2,It);return i&&r?Nt(i.type,[Et,Tt,Mt,St,It])?new ai(i,r):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${zt(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!Bt(e,["boolean","string","number","null"]))throw new ye(`Expected first argument to be of type boolean, string, number or null, but found ${zt(_e(e))} instead.`);if(!Bt(i,["string","array"]))throw new ye(`Expected second argument to be of type array or string, but found ${zt(_e(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class oi{constructor(t,e,i){this.type=Mt,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,It),r=e.parse(t[2],2,It);if(!i||!r)return null;if(!Nt(i.type,[Et,Tt,Mt,St,It]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${zt(i.type)} instead`);if(4===t.length){const n=e.parse(t[3],3,Mt);return n?new oi(i,r,n):null}return new oi(i,r)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!Bt(e,["boolean","string","number","null"]))throw new ye(`Expected first argument to be of type boolean, string, number or null, but found ${zt(_e(e))} instead.`);if(!Bt(i,["string","array"]))throw new ye(`Expected second argument to be of type array or string, but found ${zt(_e(i))} instead.`);if(this.fromIndex){const r=this.fromIndex.evaluate(t);return i.indexOf(e,r)}return i.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class li{constructor(t,e,i,r,n,o){this.inputType=t,this.type=e,this.input=i,this.cases=r,this.outputs=n,this.otherwise=o}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let i,r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const n={},o=[];for(let a=2;aNumber.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return u.error("Numeric branch labels must be integer values.");if(i){if(u.checkSubtype(i,_e(t)))return null}else i=_e(t);if(void 0!==n[String(t)])return u.error("Branch labels must be unique.");n[String(t)]=o.length}const h=e.parse(c,a,r);if(!h)return null;r=r||h.type,o.push(h)}const a=e.parse(t[1],1,It);if(!a)return null;const l=e.parse(t[t.length-1],t.length-1,r);return l?"value"!==a.type.kind&&e.concat(1).checkSubtype(i,a.type)?null:new li(i,r,a,n,o,l):null}evaluate(t){const e=this.input.evaluate(t);return(_e(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}}class ci{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const r=[];for(let n=1;ne.outputDefined()))&&this.otherwise.outputDefined()}}class hi{constructor(t,e,i,r){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,It),r=e.parse(t[2],2,Mt);if(!i||!r)return null;if(!Nt(i.type,[Dt(It),Tt,It]))return e.error(`Expected first argument to be of type array or string, but found ${zt(i.type)} instead`);if(4===t.length){const n=e.parse(t[3],3,Mt);return n?new hi(i.type,i,r,n):null}return new hi(i.type,i,r)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!Bt(e,["string","array"]))throw new ye(`Expected first argument to be of type array or string, but found ${zt(_e(e))} instead.`);if(this.endIndex){const r=this.endIndex.evaluate(t);return e.slice(i,r)}return e.slice(i)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function pi(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function di(t,e,i,r){return 0===r.compare(e,i)}function fi(t,e,i){const r="=="!==t&&"!="!==t;return class s{constructor(t,e,i){this.type=Et,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const i=t[0];let n=e.parse(t[1],1,It);if(!n)return null;if(!pi(i,n.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${zt(n.type)}'.`);let o=e.parse(t[2],2,It);if(!o)return null;if(!pi(i,o.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${zt(o.type)}'.`);if(n.type.kind!==o.type.kind&&"value"!==n.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${zt(n.type)}' and '${zt(o.type)}'.`);r&&("value"===n.type.kind&&"value"!==o.type.kind?n=new ve(o.type,[n]):"value"!==n.type.kind&&"value"===o.type.kind&&(o=new ve(n.type,[o])));let a=null;if(4===t.length){if("string"!==n.type.kind&&"string"!==o.type.kind&&"value"!==n.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,Pt),!a)return null}return new s(n,o,a)}evaluate(n){const o=this.lhs.evaluate(n),a=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){const e=_e(o),i=_e(a);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new ye(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const t=_e(o),i=_e(a);if("string"!==t.kind||"string"!==i.kind)return e(n,o,a)}return this.collator?i(n,o,a,this.collator.evaluate(n)):e(n,o,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const mi=fi("==",(function(t,e,i){return e===i}),di),gi=fi("!=",(function(t,e,i){return e!==i}),(function(t,e,i,r){return!di(0,e,i,r)})),yi=fi("<",(function(t,e,i){return e",(function(t,e,i){return e>i}),(function(t,e,i,r){return r.compare(e,i)>0})),xi=fi("<=",(function(t,e,i){return e<=i}),(function(t,e,i,r){return r.compare(e,i)<=0})),Ci=fi(">=",(function(t,e,i){return e>=i}),(function(t,e,i,r){return r.compare(e,i)>=0}));class vi{constructor(t,e,i,r,n){this.type=Tt,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=r,this.maxFractionDigits=n}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,Mt);if(!i)return null;const r=t[2];if("object"!=typeof r||Array.isArray(r))return e.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=e.parse(r.locale,1,Tt),!n))return null;let o=null;if(r.currency&&(o=e.parse(r.currency,1,Tt),!o))return null;let a=null;if(r["min-fraction-digits"]&&(a=e.parse(r["min-fraction-digits"],1,Mt),!a))return null;let l=null;return r["max-fraction-digits"]&&(l=e.parse(r["max-fraction-digits"],1,Mt),!l)?null:new vi(i,n,o,a,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class bi{constructor(t){this.type=Ot,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");const r=[];let n=!1;for(let i=1;i<=t.length-1;++i){const o=t[i];if(n&&"object"==typeof o&&!Array.isArray(o)){n=!1;let t=null;if(o["font-scale"]&&(t=e.parse(o["font-scale"],1,Mt),!t))return null;let i=null;if(o["text-font"]&&(i=e.parse(o["text-font"],1,Dt(Tt)),!i))return null;let a=null;if(o["text-color"]&&(a=e.parse(o["text-color"],1,At),!a))return null;const l=r[r.length-1];l.scale=t,l.font=i,l.textColor=a}else{const o=e.parse(t[i],1,It);if(!o)return null;const a=o.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:o,scale:null,font:null,textColor:null})}}return new bi(r)}evaluate(t){return new he(this.sections.map((e=>{const i=e.content.evaluate(t);return _e(i)===Ft?new ce("",i,null,null,null):new ce(xe(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}}class wi{constructor(t){this.type=Ft,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,Tt);return i?new wi(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=pe.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class Ti{constructor(t){this.type=Mt,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error(`Expected argument of type string or array, but found ${zt(i.type)} instead.`):new Ti(i):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new ye(`Expected value to be of type string or array, but found ${zt(_e(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const Si={"==":mi,"!=":gi,">":_i,"<":yi,">=":Ci,"<=":xi,array:ve,at:ni,boolean:ve,case:ci,coalesce:ri,collator:Ae,format:bi,image:wi,in:ai,"index-of":oi,interpolate:ei,"interpolate-hcl":ei,"interpolate-lab":ei,length:Ti,let:si,literal:ge,match:li,number:ve,"number-format":vi,object:ve,slice:hi,step:Ye,string:ve,"to-boolean":we,"to-color":we,"to-number":we,"to-string":we,var:je,within:qe};function Mi(t,[e,i,r,n]){e=e.evaluate(t),i=i.evaluate(t),r=r.evaluate(t);const o=n?n.evaluate(t):1,a=fe(e,i,r,o);if(a)throw new ye(a);return new oe(e/255,i/255,r/255,o,!1)}function Ei(t,e){return t in e}function Ai(t,e){const i=e[t];return void 0===i?null:i}function Li(t){return{type:t}}function Ii(t){return{result:"success",value:t}}function Pi(t){return{result:"error",value:t}}function Oi(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function ki(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Fi(t){return!!t.expression&&t.expression.interpolated}function Di(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function zi(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Ri(t){return t}function ji(t,e){const i="color"===e.type,r=t.stops&&"object"==typeof t.stops[0][0],n=r||!(r||void 0!==t.property),o=t.type||(Fi(e)?"exponential":"interval");if(i||"padding"===e.type){const r=i?oe.parse:ue.parse;(t=Ct({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],r(t[1])]))),t.default=r(t.default?t.default:e.default)}if(t.colorSpace&&"rgb"!==(a=t.colorSpace)&&"hcl"!==a&&"lab"!==a)throw new Error(`Unknown color space: "${t.colorSpace}"`);var a;let l,c,u;if("exponential"===o)l=Ui;else if("interval"===o)l=Vi;else if("categorical"===o){l=Bi,c=Object.create(null);for(const e of t.stops)c[e[0]]=e[1];u=typeof t.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);l=Zi}if(r){const i={},r=[];for(let e=0;et[0])),evaluate:({zoom:i},r)=>Ui({stops:n,base:t.base},e,i).evaluate(i,r)}}if(n){const i="exponential"===o?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:ei.interpolationFactor.bind(void 0,i),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:i})=>l(t,e,i,c,u)}}return{kind:"source",evaluate(i,r){const n=r&&r.properties?r.properties[t.property]:void 0;return void 0===n?Ni(t.default,e.default):l(t,e,n,c,u)}}}function Ni(t,e,i){return void 0!==t?t:void 0!==e?e:void 0!==i?i:void 0}function Bi(t,e,i,r,n){return Ni(typeof i===n?r[i]:void 0,t.default,e.default)}function Vi(t,e,i){if("number"!==Di(i))return Ni(t.default,e.default);const r=t.stops.length;if(1===r)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[r-1][0])return t.stops[r-1][1];const n=Je(t.stops.map((t=>t[0])),i);return t.stops[n][1]}function Ui(t,e,i){const r=void 0!==t.base?t.base:1;if("number"!==Di(i))return Ni(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];const o=Je(t.stops.map((t=>t[0])),i),a=function(t,e,i,r){const n=r-i,o=t-i;return 0===n?0:1===e?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}(i,r,t.stops[o][0],t.stops[o+1][0]),l=t.stops[o][1],c=t.stops[o+1][1],u=ii[e.type]||Ri;return"function"==typeof l.evaluate?{evaluate(...e){const i=l.evaluate.apply(void 0,e),r=c.evaluate.apply(void 0,e);if(void 0!==i&&void 0!==r)return u(i,r,a,t.colorSpace)}}:u(l,c,a,t.colorSpace)}function Zi(t,e,i){switch(e.type){case"color":i=oe.parse(i);break;case"formatted":i=he.fromString(i.toString());break;case"resolvedImage":i=pe.fromString(i.toString());break;case"padding":i=ue.parse(i);break;default:Di(i)===e.type||"enum"===e.type&&e.values[i]||(i=void 0)}return Ni(i,t.default,e.default)}Ze.register(Si,{error:[{kind:"error"},[Tt],(t,[e])=>{throw new ye(e.evaluate(t))}],typeof:[Tt,[It],(t,[e])=>zt(_e(e.evaluate(t)))],"to-rgba":[Dt(Mt,4),[At],(t,[e])=>{const[i,r,n,o]=e.evaluate(t).rgb;return[255*i,255*r,255*n,o]}],rgb:[At,[Mt,Mt,Mt],Mi],rgba:[At,[Mt,Mt,Mt,Mt],Mi],has:{type:Et,overloads:[[[Tt],(t,[e])=>Ei(e.evaluate(t),t.properties())],[[Tt,Lt],(t,[e,i])=>Ei(e.evaluate(t),i.evaluate(t))]]},get:{type:It,overloads:[[[Tt],(t,[e])=>Ai(e.evaluate(t),t.properties())],[[Tt,Lt],(t,[e,i])=>Ai(e.evaluate(t),i.evaluate(t))]]},"feature-state":[It,[Tt],(t,[e])=>Ai(e.evaluate(t),t.featureState||{})],properties:[Lt,[],t=>t.properties()],"geometry-type":[Tt,[],t=>t.geometryType()],id:[It,[],t=>t.id()],zoom:[Mt,[],t=>t.globals.zoom],"heatmap-density":[Mt,[],t=>t.globals.heatmapDensity||0],"line-progress":[Mt,[],t=>t.globals.lineProgress||0],accumulated:[It,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[Mt,Li(Mt),(t,e)=>{let i=0;for(const r of e)i+=r.evaluate(t);return i}],"*":[Mt,Li(Mt),(t,e)=>{let i=1;for(const r of e)i*=r.evaluate(t);return i}],"-":{type:Mt,overloads:[[[Mt,Mt],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[Mt],(t,[e])=>-e.evaluate(t)]]},"/":[Mt,[Mt,Mt],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[Mt,[Mt,Mt],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[Mt,[],()=>Math.LN2],pi:[Mt,[],()=>Math.PI],e:[Mt,[],()=>Math.E],"^":[Mt,[Mt,Mt],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[Mt,[Mt],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[Mt,[Mt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[Mt,[Mt],(t,[e])=>Math.log(e.evaluate(t))],log2:[Mt,[Mt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[Mt,[Mt],(t,[e])=>Math.sin(e.evaluate(t))],cos:[Mt,[Mt],(t,[e])=>Math.cos(e.evaluate(t))],tan:[Mt,[Mt],(t,[e])=>Math.tan(e.evaluate(t))],asin:[Mt,[Mt],(t,[e])=>Math.asin(e.evaluate(t))],acos:[Mt,[Mt],(t,[e])=>Math.acos(e.evaluate(t))],atan:[Mt,[Mt],(t,[e])=>Math.atan(e.evaluate(t))],min:[Mt,Li(Mt),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[Mt,Li(Mt),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[Mt,[Mt],(t,[e])=>Math.abs(e.evaluate(t))],round:[Mt,[Mt],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[Mt,[Mt],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[Mt,[Mt],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[Et,[Tt,It],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[Et,[It],(t,[e])=>t.id()===e.value],"filter-type-==":[Et,[Tt],(t,[e])=>t.geometryType()===e.value],"filter-<":[Et,[Tt,It],(t,[e,i])=>{const r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r{const i=t.id(),r=e.value;return typeof i==typeof r&&i":[Et,[Tt,It],(t,[e,i])=>{const r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[Et,[It],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i>r}],"filter-<=":[Et,[Tt,It],(t,[e,i])=>{const r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[Et,[It],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i<=r}],"filter->=":[Et,[Tt,It],(t,[e,i])=>{const r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[Et,[It],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i>=r}],"filter-has":[Et,[It],(t,[e])=>e.value in t.properties()],"filter-has-id":[Et,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[Et,[Dt(Tt)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[Et,[Dt(It)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[Et,[Tt,Dt(It)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[Et,[Tt,Dt(It)],(t,[e,i])=>function(t,e,i,r){for(;i<=r;){const n=i+r>>1;if(e[n]===t)return!0;e[n]>t?r=n-1:i=n+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:Et,overloads:[[[Et,Et],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[Li(Et),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:Et,overloads:[[[Et,Et],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[Li(Et),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[Et,[Et],(t,[e])=>!e.evaluate(t)],"is-supported-script":[Et,[Tt],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[Tt,[Tt],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Tt,[Tt],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Tt,Li(It),(t,e)=>e.map((e=>xe(e.evaluate(t)))).join("")],"resolved-locale":[Tt,[Pt],(t,[e])=>e.evaluate(t).resolvedLocale()]});class qi{constructor(t,e){var i;this.expression=t,this._warningHistory={},this._evaluator=new Se,this._defaultValue=e?"color"===(i=e).type&&zi(i.default)?new oe(0,0,0,0):"color"===i.type?oe.parse(i.default)||null:"padding"===i.type?ue.parse(i.default)||null:void 0===i.default?null:i.default:null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,i,r,n,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,r,n,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new ye(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function $i(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Si}function Wi(t,e){const i=new Ie(Si,$e,[],e?function(t){const e={color:At,string:Tt,number:Mt,enum:Tt,boolean:Et,formatted:Ot,padding:kt,resolvedImage:Ft};return"array"===t.type?Dt(e[t.value]||It,t.length):e[t.type]}(e):void 0),r=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return r?Ii(new qi(r,e)):Pi(i.errors)}class Gi{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Xe(e.expression)}evaluateWithoutErrorHandling(t,e,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,o)}evaluate(t,e,i,r,n,o){return this._styleExpression.evaluate(t,e,i,r,n,o)}}class Hi{constructor(t,e,i,r){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Xe(e.expression),this.interpolationType=r}evaluateWithoutErrorHandling(t,e,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,o)}evaluate(t,e,i,r,n,o){return this._styleExpression.evaluate(t,e,i,r,n,o)}interpolationFactor(t,e,i){return this.interpolationType?ei.interpolationFactor(this.interpolationType,t,e,i):0}}function Yi(t,e){const i=Wi(t,e);if("error"===i.result)return i;const r=i.value.expression,n=We(r);if(!n&&!Oi(e))return Pi([new bt("","data expressions not supported")]);const o=Ke(r,["zoom"]);if(!o&&!ki(e))return Pi([new bt("","zoom expressions not supported")]);const a=Ki(r);return a||o?a instanceof bt?Pi([a]):a instanceof ei&&!Fi(e)?Pi([new bt("",'"interpolate" expressions cannot be used with this property')]):Ii(a?new Hi(n?"camera":"composite",i.value,a.labels,a instanceof ei?a.interpolation:void 0):new Gi(n?"constant":"source",i.value)):Pi([new bt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Xi{constructor(t,e){this._parameters=t,this._specification=e,Ct(this,ji(this._parameters,this._specification))}static deserialize(t){return new Xi(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Ki(t){let e=null;if(t instanceof si)e=Ki(t.result);else if(t instanceof ri){for(const i of t.args)if(e=Ki(i),e)break}else(t instanceof Ye||t instanceof ei)&&t.input instanceof Ze&&"zoom"===t.input.name&&(e=t);return e instanceof bt||t.eachChild((t=>{const i=Ki(t);i instanceof bt?e=i:!e&&i?e=new bt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new bt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Ji(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!Ji(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const Qi={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function tr(t){if(null==t)return{filter:()=>!0,needGeometry:!1};Ji(t)||(t=rr(t));const e=Wi(t,Qi);if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return{filter:(t,i,r)=>e.value.evaluate(t,i,{},r),needGeometry:ir(t)}}function er(t,e){return te?1:0}function ir(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e"===e||"<="===e||">="===e?nr(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(rr))):"all"===e?["all"].concat(t.slice(1).map(rr)):"none"===e?["all"].concat(t.slice(1).map(rr).map(ar)):"in"===e?sr(t[1],t.slice(2)):"!in"===e?ar(sr(t[1],t.slice(2))):"has"===e?or(t[1]):"!has"===e?ar(or(t[1])):"within"!==e||t;var i}function nr(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function sr(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(er)]]:["filter-in-small",t,["literal",e]]}}function or(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function ar(t){return["!",t]}function lr(t){const e=t.value;return e?[new xt(t.key,e,"constants have been deprecated as of v8")]:[]}function cr(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function ur(t){if(Array.isArray(t))return t.map(ur);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=ur(t[i]);return e}return cr(t)}function hr(t){const e=t.key,i=t.value,r=t.valueSpec||{},n=t.objectElementValidators||{},o=t.style,a=t.styleSpec,l=t.validateSpec;let c=[];const u=Di(i);if("object"!==u)return[new xt(e,i,`object expected, ${u} found`)];for(const t in i){const u=t.split(".")[0],h=r[u]||r["*"];let p;if(n[u])p=n[u];else if(r[u])p=l;else if(n["*"])p=n["*"];else{if(!r["*"]){c.push(new xt(e,i[t],`unknown property "${t}"`));continue}p=l}c=c.concat(p({key:(e?`${e}.`:e)+t,value:i[t],valueSpec:h,style:o,styleSpec:a,object:i,objectKey:t,validateSpec:l},i))}for(const t in r)n[t]||r[t].required&&void 0===r[t].default&&void 0===i[t]&&c.push(new xt(e,i,`missing required property "${t}"`));return c}function pr(t){const e=t.value,i=t.valueSpec,r=t.style,n=t.styleSpec,o=t.key,a=t.arrayElementValidator||t.validateSpec;if("array"!==Di(e))return[new xt(o,e,`array expected, ${Di(e)} found`)];if(i.length&&e.length!==i.length)return[new xt(o,e,`array length ${i.length} expected, length ${e.length} found`)];if(i["min-length"]&&e.lengthr.maximum?[new xt(e,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]}function fr(t){const e=t.valueSpec,i=cr(t.value.type);let r,n,o,a={};const l="categorical"!==i&&void 0===t.value.property,c=!l,u="array"===Di(t.value.stops)&&"array"===Di(t.value.stops[0])&&"object"===Di(t.value.stops[0][0]),h=hr({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===i)return[new xt(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const r=t.value;return e=e.concat(pr({key:t.key,value:r,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:p})),"array"===Di(r)&&0===r.length&&e.push(new xt(t.key,r,"array must have at least one stop")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===i&&l&&h.push(new xt(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||h.push(new xt(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!Fi(t.valueSpec)&&h.push(new xt(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(c&&!Oi(t.valueSpec)?h.push(new xt(t.key,t.value,"property functions not supported")):l&&!ki(t.valueSpec)&&h.push(new xt(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!u||void 0!==t.value.property||h.push(new xt(t.key,t.value,'"property" property is required')),h;function p(t){let i=[];const r=t.value,l=t.key;if("array"!==Di(r))return[new xt(l,r,`array expected, ${Di(r)} found`)];if(2!==r.length)return[new xt(l,r,`array length 2 expected, length ${r.length} found`)];if(u){if("object"!==Di(r[0]))return[new xt(l,r,`object expected, ${Di(r[0])} found`)];if(void 0===r[0].zoom)return[new xt(l,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new xt(l,r,"object stop key must have value")];if(o&&o>cr(r[0].zoom))return[new xt(l,r[0].zoom,"stop zoom values must appear in ascending order")];cr(r[0].zoom)!==o&&(o=cr(r[0].zoom),n=void 0,a={}),i=i.concat(hr({key:`${l}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:dr,value:d}}))}else i=i.concat(d({key:`${l}[0]`,value:r[0],valueSpec:{},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},r));return $i(ur(r[1]))?i.concat([new xt(`${l}[1]`,r[1],"expressions are not allowed in function stops.")]):i.concat(t.validateSpec({key:`${l}[1]`,value:r[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function d(t,o){const l=Di(t.value),c=cr(t.value),u=null!==t.value?t.value:o;if(r){if(l!==r)return[new xt(t.key,u,`${l} stop domain type must match previous stop domain type ${r}`)]}else r=l;if("number"!==l&&"string"!==l&&"boolean"!==l)return[new xt(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==l&&"categorical"!==i){let r=`number expected, ${l} found`;return Oi(e)&&void 0===i&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new xt(t.key,u,r)]}return"categorical"!==i||"number"!==l||isFinite(c)&&Math.floor(c)===c?"categorical"!==i&&"number"===l&&void 0!==n&&cnew xt(`${t.key}${e.key}`,t.value,e.message)));const i=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!i.outputDefined())return[new xt(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&&!Xe(i))return[new xt(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!Xe(i))return[new xt(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Ke(i,["zoom","feature-state"]))return[new xt(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!We(i))return[new xt(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function gr(t){const e=t.key,i=t.value,r=t.valueSpec,n=[];return Array.isArray(r.values)?-1===r.values.indexOf(cr(i))&&n.push(new xt(e,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(r.values).indexOf(cr(i))&&n.push(new xt(e,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function yr(t){return Ji(ur(t.value))?mr(Ct({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):_r(t)}function _r(t){const e=t.value,i=t.key;if("array"!==Di(e))return[new xt(i,e,`array expected, ${Di(e)} found`)];const r=t.styleSpec;let n,o=[];if(e.length<1)return[new xt(i,e,"filter array must have at least 1 element")];switch(o=o.concat(gr({key:`${i}[0]`,value:e[0],valueSpec:r.filter_operator,style:t.style,styleSpec:t.styleSpec})),cr(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===cr(e[1])&&o.push(new xt(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&o.push(new xt(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(n=Di(e[1]),"string"!==n&&o.push(new xt(`${i}[1]`,e[1],`string expected, ${n} found`)));for(let a=2;a{t in i&&e.push(new xt(r,i[t],`"${t}" is prohibited for ref layers`))})),n.layers.forEach((e=>{cr(e.id)===l&&(t=e)})),t?t.ref?e.push(new xt(r,i.ref,"ref cannot reference another ref layer")):a=cr(t.type):e.push(new xt(r,i.ref,`ref layer "${l}" not found`))}else if("background"!==a)if(i.source){const t=n.sources&&n.sources[i.source],o=t&&cr(t.type);t?"vector"===o&&"raster"===a?e.push(new xt(r,i.source,`layer "${i.id}" requires a raster source`)):"raster"===o&&"raster"!==a?e.push(new xt(r,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==o||i["source-layer"]?"raster-dem"===o&&"hillshade"!==a?e.push(new xt(r,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==a||!i.paint||!i.paint["line-gradient"]||"geojson"===o&&t.lineMetrics||e.push(new xt(r,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new xt(r,i,`layer "${i.id}" must specify a "source-layer"`)):e.push(new xt(r,i.source,`source "${i.source}" not found`))}else e.push(new xt(r,i,'missing required property "source"'));return e=e.concat(hr({key:r,value:i,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${r}.type`,value:i.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:i,objectKey:"type"}),filter:yr,layout:t=>hr({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>br(Ct({layerType:a},t))}}),paint:t=>hr({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>xr(Ct({layerType:a},t))}})}})),e}function Cr(t){const e=t.value,i=t.key,r=Di(e);return"string"!==r?[new xt(i,e,`string expected, ${r} found`)]:[]}const Sr={promoteId:function({key:t,value:e}){if("string"===Di(e))return Cr({key:t,value:e});{const i=[];for(const r in e)i.push(...Cr({key:`${t}.${r}`,value:e[r]}));return i}}};function Mr(t){const e=t.value,i=t.key,r=t.styleSpec,n=t.style,o=t.validateSpec;if(!e.type)return[new xt(i,e,'"type" is required')];const a=cr(e.type);let l;switch(a){case"vector":case"raster":case"raster-dem":return l=hr({key:i,value:e,valueSpec:r[`source_${a.replace("-","_")}`],style:t.style,styleSpec:r,objectElementValidators:Sr,validateSpec:o}),l;case"geojson":if(l=hr({key:i,value:e,valueSpec:r.source_geojson,style:n,styleSpec:r,validateSpec:o,objectElementValidators:Sr}),e.cluster)for(const t in e.clusterProperties){const[r,n]=e.clusterProperties[t],a="string"==typeof r?[r,["accumulated"],["get",t]]:r;l.push(...mr({key:`${i}.${t}.map`,value:n,validateSpec:o,expressionContext:"cluster-map"})),l.push(...mr({key:`${i}.${t}.reduce`,value:a,validateSpec:o,expressionContext:"cluster-reduce"}))}return l;case"video":return hr({key:i,value:e,valueSpec:r.source_video,style:n,validateSpec:o,styleSpec:r});case"image":return hr({key:i,value:e,valueSpec:r.source_image,style:n,validateSpec:o,styleSpec:r});case"canvas":return[new xt(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return gr({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,validateSpec:o,styleSpec:r})}}function Tr(t){const e=t.value,i=t.styleSpec,r=i.light,n=t.style;let o=[];const a=Di(e);if(void 0===e)return o;if("object"!==a)return o=o.concat([new xt("light",e,`object expected, ${a} found`)]),o;for(const a in e){const l=a.match(/^(.*)-transition$/);o=o.concat(l&&r[l[1]]&&r[l[1]].transition?t.validateSpec({key:a,value:e[a],valueSpec:i.transition,validateSpec:t.validateSpec,style:n,styleSpec:i}):r[a]?t.validateSpec({key:a,value:e[a],valueSpec:r[a],validateSpec:t.validateSpec,style:n,styleSpec:i}):[new xt(a,e[a],`unknown property "${a}"`)])}return o}function Er(t){const e=t.value,i=t.styleSpec,r=i.terrain,n=t.style;let o=[];const a=Di(e);if(void 0===e)return o;if("object"!==a)return o=o.concat([new xt("terrain",e,`object expected, ${a} found`)]),o;for(const a in e)o=o.concat(r[a]?t.validateSpec({key:a,value:e[a],valueSpec:r[a],validateSpec:t.validateSpec,style:n,styleSpec:i}):[new xt(a,e[a],`unknown property "${a}"`)]);return o}function Ar(t){let e=[];const i=t.value,r=t.key;if(Array.isArray(i)){const n=[],o=[];for(const a in i)i[a].id&&n.includes(i[a].id)&&e.push(new xt(r,i,`all the sprites' ids must be unique, but ${i[a].id} is duplicated`)),n.push(i[a].id),i[a].url&&o.includes(i[a].url)&&e.push(new xt(r,i,`all the sprites' URLs must be unique, but ${i[a].url} is duplicated`)),o.push(i[a].url),e=e.concat(hr({key:`${r}[${a}]`,value:i[a],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return Cr({key:r,value:i})}const Lr={"*":()=>[],array:pr,boolean:function(t){const e=t.value,i=t.key,r=Di(e);return"boolean"!==r?[new xt(i,e,`boolean expected, ${r} found`)]:[]},number:dr,color:function(t){const e=t.key,i=t.value,r=Di(i);return"string"!==r?[new xt(e,i,`color expected, ${r} found`)]:oe.parse(String(i))?[]:[new xt(e,i,`color expected, "${i}" found`)]},constants:lr,enum:gr,filter:yr,function:fr,layer:wr,object:hr,source:Mr,light:Tr,terrain:Er,string:Cr,formatted:function(t){return 0===Cr(t).length?[]:mr(t)},resolvedImage:function(t){return 0===Cr(t).length?[]:mr(t)},padding:function(t){const e=t.key,i=t.value;if("array"===Di(i)){if(i.length<1||i.length>4)return[new xt(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const r={type:"number"};let n=[];for(let o=0;o[]}})),t.constants&&(i=i.concat(lr({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:Ir}))),Fr(i)}function kr(t){return function(e){return t({...e,validateSpec:Ir})}}function Fr(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function Dr(t){return function(...e){return Fr(t.apply(this,e))}}Or.source=Dr(kr(Mr)),Or.sprite=Dr(kr(Ar)),Or.glyphs=Dr(kr(Pr)),Or.light=Dr(kr(Tr)),Or.terrain=Dr(kr(Er)),Or.layer=Dr(kr(wr)),Or.filter=Dr(kr(yr)),Or.paintProperty=Dr(kr(xr)),Or.layoutProperty=Dr(kr(br));const zr=Or,Rr=zr.light,jr=zr.paintProperty,Nr=zr.layoutProperty;function Br(t,e){let i=!1;if(e&&e.length)for(const r of e)t.fire(new st(new Error(r.message))),i=!0;return i}class Ur{constructor(t,e,i){const r=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const n=new Int32Array(this.arrayBuffer);t=n[0],this.d=(e=n[1])+2*(i=n[2]);for(let t=0;t=u[c+0]&&r>=u[c+1])?(a[p]=!0,o.push(n[p])):a[p]=!1}}}}_forEachCell(t,e,i,r,n,o,a,l){const c=this._convertToCellCoord(t),u=this._convertToCellCoord(e),h=this._convertToCellCoord(i),p=this._convertToCellCoord(r);for(let d=c;d<=h;d++)for(let c=u;c<=p;c++){const u=this.d*c+d;if((!l||l(this._convertFromCellCoord(d),this._convertFromCellCoord(c),this._convertFromCellCoord(d+1),this._convertFromCellCoord(c+1)))&&n.call(this,t,e,i,r,u,o,a,l))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,e=3+this.cells.length+1+1;let i=0;for(let t=0;t=0)continue;const o=t[i];n[i]=Vr[r].shallow.indexOf(i)>=0?o:Zr(o,e)}t instanceof Error&&(n.message=t.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 t)}function $r(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||qr(t)||P(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map($r);if("object"==typeof t){const e=t.$name||"Object";if(!Vr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:i}=Vr[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(t);const r=Object.create(i.prototype);for(const i of Object.keys(t)){if("$name"===i)continue;const n=t[i];r[i]=Vr[e].shallow.indexOf(i)>=0?n:$r(n)}return r}throw new Error("can't deserialize object of type "+typeof t)}class Gr{constructor(){this.first=!0}update(t,e){const i=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=e):this.lastFloorZoomt>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function Xr(t){for(const e of t)if(Yr(e.charCodeAt(0)))return!0;return!1}function Yr(t){return!(746!==t&&747!==t&&(t<4352||!(Wr["Bopomofo Extended"](t)||Wr.Bopomofo(t)||Wr["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||Wr["CJK Compatibility Ideographs"](t)||Wr["CJK Compatibility"](t)||Wr["CJK Radicals Supplement"](t)||Wr["CJK Strokes"](t)||!(!Wr["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Wr["CJK Unified Ideographs Extension A"](t)||Wr["CJK Unified Ideographs"](t)||Wr["Enclosed CJK Letters and Months"](t)||Wr["Hangul Compatibility Jamo"](t)||Wr["Hangul Jamo Extended-A"](t)||Wr["Hangul Jamo Extended-B"](t)||Wr["Hangul Jamo"](t)||Wr["Hangul Syllables"](t)||Wr.Hiragana(t)||Wr["Ideographic Description Characters"](t)||Wr.Kanbun(t)||Wr["Kangxi Radicals"](t)||Wr["Katakana Phonetic Extensions"](t)||Wr.Katakana(t)&&12540!==t||!(!Wr["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Wr["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Wr["Unified Canadian Aboriginal Syllabics"](t)||Wr["Unified Canadian Aboriginal Syllabics Extended"](t)||Wr["Vertical Forms"](t)||Wr["Yijing Hexagram Symbols"](t)||Wr["Yi Syllables"](t)||Wr["Yi Radicals"](t))))}function Kr(t){return t>=1424&&t<=2303||Wr["Arabic Presentation Forms-A"](t)||Wr["Arabic Presentation Forms-B"](t)}function Jr(t,e){return!(!e&&Kr(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Wr.Khmer(t))}function Qr(t){for(const e of t)if(Kr(e.charCodeAt(0)))return!0;return!1}const Ln="deferred",Pn="loading",On="loaded";let kn=null,Fn="unavailable",Rn=null;const jn=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(Fn="error"),kn&&kn(t)};function Nn(){Bn.fire(new rt("pluginStateChange",{pluginStatus:Fn,pluginURL:Rn}))}const Bn=new nt,Vn=function(){return Fn},Un=function(){if(Fn!==Ln||!Rn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Fn=Pn,Nn(),Rn&&H({url:Rn},(t=>{t?jn(t):(Fn=On,Nn())}))},Gn={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Fn===On||null!=Gn.applyArabicShaping,isLoading:()=>Fn===Pn,setState(t){if(!E())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Fn=t.pluginStatus,Rn=t.pluginURL},isParsed(){if(!E())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return null!=Gn.applyArabicShaping},getPluginURL(){if(!E())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Rn}};class us{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Gr,this.transition={})}isSupportedScript(t){return function(t,e){for(const i of t)if(!Jr(i.charCodeAt(0),e))return!1;return!0}(t,Gn.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),i=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*e}}}class ps{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(zi(t))return new Xi(t,e);if($i(t)){const i=Yi(t,e);if("error"===i.result)throw new Error(i.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return i.value}{let i=t;return"color"===e.type&&"string"==typeof t?i=oe.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)||(i=ue.parse(t)),{kind:"constant",evaluate:()=>i}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,i){return this.property.possiblyEvaluate(this,t,e,i)}}class ds{constructor(t){this.property=t,this.value=new ps(t,void 0)}transitioned(t,e){return new fs(this.property,this.value,e,f({},t.transition,this.transition),t.now)}untransitioned(){return new fs(this.property,this.value,null,{},0)}}class ms{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return w(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ds(this._values[t].property)),this._values[t].value=new ps(this._values[t].property,null===e?void 0:w(e))}getTransition(t){return w(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ds(this._values[t].property)),this._values[t].transition=w(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i);const r=this.getTransition(e);void 0!==r&&(t[`${e}-transition`]=r)}return t}transitioned(t,e){const i=new _s(this._properties);for(const r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(t,e._values[r]);return i}untransitioned(){const t=new _s(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class fs{constructor(t,e,i,r,n){this.property=t,this.value=e,this.begin=n+r.delay||0,this.end=this.begin+r.duration||0,t.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(t,e,i){const r=t.now||0,n=this.value.possiblyEvaluate(t,e,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=1)return 1;const e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}(a))}}return n}}class _s{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,i){const r=new xs(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(t,e,i);return r}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class gs{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}getValue(t){return w(this._values[t].value)}setValue(t,e){this._values[t]=new ps(this._values[t].property,null===e?void 0:w(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i)}return t}possiblyEvaluate(t,e,i){const r=new xs(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(t,e,i);return r}}class ys{constructor(t,e,i){this.property=t,this.value=e,this.parameters=i}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,i,r){return this.property.evaluate(this.value,this.parameters,t,e,i,r)}}class xs{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class vs{constructor(t){this.specification=t}possiblyEvaluate(t,e){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,i){const r=ii[this.specification.type];return r?r(t,e,i):t}}class bs{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,i,r){return new ys(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},i,r)}:t.expression,e)}interpolate(t,e,i){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new ys(this,{kind:"constant",value:void 0},t.parameters);const r=ii[this.specification.type];if(r){const n=r(t.value.value,e.value.value,i);return new ys(this,{kind:"constant",value:n},t.parameters)}return t}evaluate(t,e,i,r,n,o){return"constant"===t.kind?t.value:t.evaluate(e,i,r,n,o)}}class ws extends bs{possiblyEvaluate(t,e,i,r){if(void 0===t.value)return new ys(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const n=t.expression.evaluate(e,null,{},i,r),o="resolvedImage"===t.property.specification.type&&"string"!=typeof n?n.name:n,a=this._calculate(o,o,o,e);return new ys(this,{kind:"constant",value:a},e)}if("camera"===t.expression.kind){const i=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new ys(this,{kind:"constant",value:i},e)}return new ys(this,t.expression,e)}evaluate(t,e,i,r,n,o){if("source"===t.kind){const a=t.evaluate(e,i,r,n,o);return this._calculate(a,a,a,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},i,r),t.evaluate({zoom:Math.floor(e.zoom)},i,r),t.evaluate({zoom:Math.floor(e.zoom)+1},i,r),e):t.value}_calculate(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class Ts{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,r){if(void 0!==t.value){if("constant"===t.expression.kind){const n=t.expression.evaluate(e,null,{},i,r);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new us(Math.floor(e.zoom-1),e)),t.expression.evaluate(new us(Math.floor(e.zoom),e)),t.expression.evaluate(new us(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class Ss{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,r){return!!t.expression.evaluate(e,null,{},i,r)}interpolate(){return!1}}class Is{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const i=t[e];i.specification.overridable&&this.overridableProperties.push(e);const r=this.defaultPropertyValues[e]=new ps(i,void 0),n=this.defaultTransitionablePropertyValues[e]=new ds(i);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=r.possiblyEvaluate({})}}}Hr("DataDrivenProperty",bs),Hr("DataConstantProperty",vs),Hr("CrossFadedDataDrivenProperty",ws),Hr("CrossFadedProperty",Ts),Hr("ColorRampProperty",Ss);const Zn="-transition";class Es extends nt{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new gs(e.layout)),e.paint)){this._transitionablePaint=new ms(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new xs(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,i={}){null!=e&&this._validate(Nr,`layers.${this.id}.layout.${t}`,t,e,i)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return t.endsWith(Zn)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,i={}){if(null!=e&&this._validate(jr,`layers.${this.id}.paint.${t}`,t,e,i))return!1;if(t.endsWith(Zn))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{const i=this._transitionablePaint._values[t],r="cross-faded-data-driven"===i.property.specification["property-type"],n=i.value.isDataDriven(),o=i.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const a=this._transitionablePaint._values[t].value;return a.isDataDriven()||n||r||this._handleOverridablePaintPropertyUpdate(t,o,a)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,i){return!1}isHidden(t){return!!(this.minzoom&&t=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),x(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,i,r,n={}){return(!n||!1!==n.validate)&&Br(this,t.call(zr,{key:e,layerType:this.type,objectKey:i,value:r,styleSpec:at,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof ys&&Oi(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const $n={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Cs{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Ms{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ts(t,e=1){let i=0,r=0;return{members:t.map((t=>{const n=$n[t.type].BYTES_PER_ELEMENT,o=i=es(i,Math.max(e,n)),a=t.components||1;return r=Math.max(r,n),i+=n*a,{name:t.name,type:t.type,components:a,offset:o}})),size:es(i,Math.max(r,e)),alignment:e}}function es(t,e){return Math.ceil(t/e)*e}class Ds extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.int16[r+0]=e,this.int16[r+1]=i,t}}Ds.prototype.bytesPerElement=4,Hr("StructArrayLayout2i4",Ds);class Ls extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.int16[n+0]=e,this.int16[n+1]=i,this.int16[n+2]=r,t}}Ls.prototype.bytesPerElement=6,Hr("StructArrayLayout3i6",Ls);class Bs extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){const o=4*t;return this.int16[o+0]=e,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=n,t}}Bs.prototype.bytesPerElement=8,Hr("StructArrayLayout4i8",Bs);class Rs extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,r,n,o)}emplace(t,e,i,r,n,o,a){const l=6*t;return this.int16[l+0]=e,this.int16[l+1]=i,this.int16[l+2]=r,this.int16[l+3]=n,this.int16[l+4]=o,this.int16[l+5]=a,t}}Rs.prototype.bytesPerElement=12,Hr("StructArrayLayout2i4i12",Rs);class Fs extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,r,n,o)}emplace(t,e,i,r,n,o,a){const l=4*t,c=8*t;return this.int16[l+0]=e,this.int16[l+1]=i,this.uint8[c+4]=r,this.uint8[c+5]=n,this.uint8[c+6]=o,this.uint8[c+7]=a,t}}Fs.prototype.bytesPerElement=8,Hr("StructArrayLayout2i4ub8",Fs);class Os extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.float32[r+0]=e,this.float32[r+1]=i,t}}Os.prototype.bytesPerElement=8,Hr("StructArrayLayout2f8",Os);class Vs extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,a,l,c,u){const h=this.length;return this.resize(h+1),this.emplace(h,t,e,i,r,n,o,a,l,c,u)}emplace(t,e,i,r,n,o,a,l,c,u,h){const p=10*t;return this.uint16[p+0]=e,this.uint16[p+1]=i,this.uint16[p+2]=r,this.uint16[p+3]=n,this.uint16[p+4]=o,this.uint16[p+5]=a,this.uint16[p+6]=l,this.uint16[p+7]=c,this.uint16[p+8]=u,this.uint16[p+9]=h,t}}Vs.prototype.bytesPerElement=20,Hr("StructArrayLayout10ui20",Vs);class Us extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,a,l,c,u,h,p){const d=this.length;return this.resize(d+1),this.emplace(d,t,e,i,r,n,o,a,l,c,u,h,p)}emplace(t,e,i,r,n,o,a,l,c,u,h,p,d){const f=12*t;return this.int16[f+0]=e,this.int16[f+1]=i,this.int16[f+2]=r,this.int16[f+3]=n,this.uint16[f+4]=o,this.uint16[f+5]=a,this.uint16[f+6]=l,this.uint16[f+7]=c,this.int16[f+8]=u,this.int16[f+9]=h,this.int16[f+10]=p,this.int16[f+11]=d,t}}Us.prototype.bytesPerElement=24,Hr("StructArrayLayout4i4ui4i24",Us);class Ns extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.float32[n+0]=e,this.float32[n+1]=i,this.float32[n+2]=r,t}}Ns.prototype.bytesPerElement=12,Hr("StructArrayLayout3f12",Ns);class $s extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}$s.prototype.bytesPerElement=4,Hr("StructArrayLayout1ul4",$s);class qs extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,a,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,i,r,n,o,a,l,c)}emplace(t,e,i,r,n,o,a,l,c,u){const h=10*t,p=5*t;return this.int16[h+0]=e,this.int16[h+1]=i,this.int16[h+2]=r,this.int16[h+3]=n,this.int16[h+4]=o,this.int16[h+5]=a,this.uint32[p+3]=l,this.uint16[h+8]=c,this.uint16[h+9]=u,t}}qs.prototype.bytesPerElement=20,Hr("StructArrayLayout6i1ul2ui20",qs);class js extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,r,n,o)}emplace(t,e,i,r,n,o,a){const l=6*t;return this.int16[l+0]=e,this.int16[l+1]=i,this.int16[l+2]=r,this.int16[l+3]=n,this.int16[l+4]=o,this.int16[l+5]=a,t}}js.prototype.bytesPerElement=12,Hr("StructArrayLayout2i2i2i12",js);class Zs extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,n)}emplace(t,e,i,r,n,o){const a=4*t,l=8*t;return this.float32[a+0]=e,this.float32[a+1]=i,this.float32[a+2]=r,this.int16[l+6]=n,this.int16[l+7]=o,t}}Zs.prototype.bytesPerElement=16,Hr("StructArrayLayout2f1f2i16",Zs);class Gs extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){const o=12*t,a=3*t;return this.uint8[o+0]=e,this.uint8[o+1]=i,this.float32[a+1]=r,this.float32[a+2]=n,t}}Gs.prototype.bytesPerElement=12,Hr("StructArrayLayout2ub2f12",Gs);class Hs extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.uint16[n+0]=e,this.uint16[n+1]=i,this.uint16[n+2]=r,t}}Hs.prototype.bytesPerElement=6,Hr("StructArrayLayout3ui6",Hs);class Ws extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,a,l,c,u,h,p,d,f,m,g,y){const _=this.length;return this.resize(_+1),this.emplace(_,t,e,i,r,n,o,a,l,c,u,h,p,d,f,m,g,y)}emplace(t,e,i,r,n,o,a,l,c,u,h,p,d,f,m,g,y,_){const v=24*t,x=12*t,b=48*t;return this.int16[v+0]=e,this.int16[v+1]=i,this.uint16[v+2]=r,this.uint16[v+3]=n,this.uint32[x+2]=o,this.uint32[x+3]=a,this.uint32[x+4]=l,this.uint16[v+10]=c,this.uint16[v+11]=u,this.uint16[v+12]=h,this.float32[x+7]=p,this.float32[x+8]=d,this.uint8[b+36]=f,this.uint8[b+37]=m,this.uint8[b+38]=g,this.uint32[x+10]=y,this.int16[v+22]=_,t}}Ws.prototype.bytesPerElement=48,Hr("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ws);class Xs extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,a,l,c,u,h,p,d,f,m,g,y,_,v,x,b,w,C,S,M,T,E,A){const I=this.length;return this.resize(I+1),this.emplace(I,t,e,i,r,n,o,a,l,c,u,h,p,d,f,m,g,y,_,v,x,b,w,C,S,M,T,E,A)}emplace(t,e,i,r,n,o,a,l,c,u,h,p,d,f,m,g,y,_,v,x,b,w,C,S,M,T,E,A,I){const P=34*t,O=17*t;return this.int16[P+0]=e,this.int16[P+1]=i,this.int16[P+2]=r,this.int16[P+3]=n,this.int16[P+4]=o,this.int16[P+5]=a,this.int16[P+6]=l,this.int16[P+7]=c,this.uint16[P+8]=u,this.uint16[P+9]=h,this.uint16[P+10]=p,this.uint16[P+11]=d,this.uint16[P+12]=f,this.uint16[P+13]=m,this.uint16[P+14]=g,this.uint16[P+15]=y,this.uint16[P+16]=_,this.uint16[P+17]=v,this.uint16[P+18]=x,this.uint16[P+19]=b,this.uint16[P+20]=w,this.uint16[P+21]=C,this.uint16[P+22]=S,this.uint32[O+12]=M,this.float32[O+13]=T,this.float32[O+14]=E,this.float32[O+15]=A,this.float32[O+16]=I,t}}Xs.prototype.bytesPerElement=68,Hr("StructArrayLayout8i15ui1ul4f68",Xs);class Ks extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Ks.prototype.bytesPerElement=4,Hr("StructArrayLayout1f4",Ks);class Ys extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=4*t;return this.uint32[2*t+0]=e,this.uint16[n+2]=i,this.uint16[n+3]=r,t}}Ys.prototype.bytesPerElement=8,Hr("StructArrayLayout1ul2ui8",Ys);class Js extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.uint16[r+0]=e,this.uint16[r+1]=i,t}}Js.prototype.bytesPerElement=4,Hr("StructArrayLayout2ui4",Js);class Qs extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Qs.prototype.bytesPerElement=2,Hr("StructArrayLayout1ui2",Qs);class tn extends Ms{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){const o=4*t;return this.float32[o+0]=e,this.float32[o+1]=i,this.float32[o+2]=r,this.float32[o+3]=n,t}}tn.prototype.bytesPerElement=16,Hr("StructArrayLayout4f16",tn);class en extends Cs{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new n(this.anchorPointX,this.anchorPointY)}}en.prototype.size=20;class rn extends qs{get(t){return new en(this,t)}}Hr("CollisionBoxArray",rn);class sn extends Cs{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}sn.prototype.size=48;class nn extends Ws{get(t){return new sn(this,t)}}Hr("PlacedSymbolArray",nn);class an extends Cs{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}an.prototype.size=68;class on extends Xs{get(t){return new an(this,t)}}Hr("SymbolInstanceArray",on);class ln extends Ks{getoffsetX(t){return this.float32[1*t+0]}}Hr("GlyphOffsetArray",ln);class cn extends Ls{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Hr("SymbolLineVertexArray",cn);class hn extends Cs{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]}}hn.prototype.size=8;class un extends Ys{get(t){return new hn(this,t)}}Hr("FeatureIndexArray",un);class pn extends Ds{}class dn extends Ls{}class mn extends Bs{}class fn extends Ds{}class _n extends Ds{}class gn extends Rs{}class yn extends Fs{}class xn extends Os{}class vn extends Vs{}class bn extends Us{}class wn extends Ns{}class Tn extends $s{}class Sn extends js{}class In extends Zs{}class An extends Gs{}class En extends Hs{}class zn extends Hs{}class Cn extends Js{}class Mn extends Qs{}const is=ts([{name:"a_pos",components:2,type:"Int16"}],4),{members:rs}=is;class Dn{constructor(t=[]){this.segments=t}prepareSegment(t,e,i,r){let n=this.segments[this.segments.length-1];return t>Dn.MAX_VERTEX_ARRAY_LENGTH&&S(`Max vertices per segment is ${Dn.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!n||n.vertexLength+t>Dn.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==r)&&(n={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},void 0!==r&&(n.sortKey=r),this.segments.push(n)),n}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,i,r){return new Dn([{vertexOffset:t,primitiveOffset:e,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}function ns(t,e){return 256*(t=h(Math.floor(t),0,255))+h(Math.floor(e),0,255)}Dn.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Hr("SegmentVector",Dn);const ss=ts([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var os={exports:{}},as={exports:{}};!function(t){t.exports=function(t,e){var i,r,n,o,a,l,c,u;for(r=t.length-(i=3&t.length),n=e,a=3432918353,l=461845907,u=0;u>>16)*a&65535)<<16)&4294967295)<<15|c>>>17))*l+(((c>>>16)*l&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(c=0,i){case 3:c^=(255&t.charCodeAt(u+2))<<16;case 2:c^=(255&t.charCodeAt(u+1))<<8;case 1:n^=c=(65535&(c=(c=(65535&(c^=255&t.charCodeAt(u)))*a+(((c>>>16)*a&65535)<<16)&4294967295)<<15|c>>>17))*l+(((c>>>16)*l&65535)<<16)&4294967295}return n^=t.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}}(as);var ls=as.exports,cs={exports:{}};!function(t){t.exports=function(t,e){for(var i,r=t.length,n=e^r,o=0;r>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.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&t.charCodeAt(o+2))<<16;case 2:n^=(255&t.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&t.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}}(cs);var hs=ls,As=cs.exports;os.exports=hs,os.exports.murmur3=hs,os.exports.murmur2=As;var Ps=e(os.exports);class qn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,i,r){this.ids.push(ks(t)),this.positions.push(e,i,r)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const e=ks(t);let i=0,r=this.ids.length-1;for(;i>1;this.ids[t]>=e?r=t:i=t+1}const n=[];for(;this.ids[i]===e;)n.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return n}static serialize(t,e){const i=new Float64Array(t.ids),r=new Uint32Array(t.positions);return zs(i,r,0,i.length-1),e&&e.push(i.buffer,r.buffer),{ids:i,positions:r}}static deserialize(t){const e=new qn;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function ks(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Ps(String(t))}function zs(t,e,i,r){for(;i>1];let o=i-1,a=r+1;for(;;){do{o++}while(t[o]n);if(o>=a)break;to(t,o,a),to(e,3*o,3*a),to(e,3*o+1,3*a+1),to(e,3*o+2,3*a+2)}a-i`u_${t}`)),this.type=i}setUniform(t,e,i){t.set(i.constantOr(this.value))}getBinding(t,e,i){return"color"===this.type?new Qn(t,e):new Xn(t,e)}}class sa{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,i,r){const n="u_pattern_to"===r?this.patternTo:"u_pattern_from"===r?this.patternFrom:"u_pixel_ratio_to"===r?this.pixelRatioTo:"u_pixel_ratio_from"===r?this.pixelRatioFrom:null;n&&t.set(n)}getBinding(t,e,i){return"u_pattern"===i.substr(0,9)?new Jn(t,e):new Xn(t,e)}}class na{constructor(t,e,i,r){this.expression=t,this.type=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===i?2:1,offset:0}))),this.paintVertexArray=new r}populatePaintArray(t,e,i,r,n){const o=this.paintVertexArray.length,a=this.expression.evaluate(new us(0),e,{},r,[],n);this.paintVertexArray.resize(t),this._setPaintValue(o,t,a)}updatePaintArray(t,e,i,r){const n=this.expression.evaluate({zoom:0},i,r);this._setPaintValue(t,e,n)}_setPaintValue(t,e,i){if("color"===this.type){const r=io(i);for(let i=t;i`u_${t}_t`)),this.type=i,this.useIntegerZoom=r,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===i?4:2,offset:0}))),this.paintVertexArray=new o}populatePaintArray(t,e,i,r,n){const o=this.expression.evaluate(new us(this.zoom),e,{},r,[],n),a=this.expression.evaluate(new us(this.zoom+1),e,{},r,[],n),l=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(l,t,o,a)}updatePaintArray(t,e,i,r){const n=this.expression.evaluate({zoom:this.zoom},i,r),o=this.expression.evaluate({zoom:this.zoom+1},i,r);this._setPaintValue(t,e,n,o)}_setPaintValue(t,e,i,r){if("color"===this.type){const n=io(i),o=io(r);for(let i=t;i`#define HAS_UNIFORM_${t}`)))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof na||i instanceof aa)for(let e=0;e!0)){this.programConfigurations={};for(const r of t)this.programConfigurations[r.id]=new la(r,e,i);this.needsUpload=!1,this._featureMap=new qn,this._bufferOffset=0}populatePaintArrays(t,e,i,r,n,o){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(t,e,r,n,o);void 0!==e.id&&this._featureMap.add(e.id,i,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,i,r){for(const n of i)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,e,n,r)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function ro(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function so(t,e,i){const r={color:{source:Os,composite:tn},number:{source:Ks,composite:Os}},n=function(t){return{"line-pattern":{source:vn,composite:vn},"fill-pattern":{source:vn,composite:vn},"fill-extrusion-pattern":{source:vn,composite:vn}}[t]}(t);return n&&n[i]||r[e][i]}Hr("ConstantBinder",ra),Hr("CrossFadedConstantBinder",sa),Hr("SourceExpressionBinder",na),Hr("CrossFadedCompositeBinder",oa),Hr("CompositeExpressionBinder",aa),Hr("ProgramConfiguration",la,{omit:["_buffers"]}),Hr("ProgramConfigurationSet",ca);var oo=8192;const lo=Math.pow(2,14)-1,co=-lo-1;function uo(t){const e=oo/t.extent,i=t.loadGeometry();for(let t=0;ti.x+1||oi.y+1)&&S("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function ho(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?uo(t):[]}}function po(t,e,i,r,n){t.emplaceBack(2*e+(r+1)/2,2*i+(n+1)/2)}class ya{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new fn,this.indexArray=new zn,this.segments=new Dn,this.programConfigurations=new ca(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){const r=this.layers[0],n=[];let o=null,a=!1;"circle"===r.type&&(o=r.layout.get("circle-sort-key"),a=!o.isConstant());for(const{feature:e,id:r,index:l,sourceLayerIndex:c}of t){const t=this.layers[0]._featureFilter.needGeometry,u=ho(e,t);if(!this.layers[0]._featureFilter.filter(new us(this.zoom),u,i))continue;const h=a?o.evaluate(u,{},i):void 0,p={id:r,properties:e.properties,type:e.type,sourceLayerIndex:c,index:l,geometry:t?u.geometry:uo(e),patterns:{},sortKey:h};n.push(p)}a&&n.sort(((t,e)=>t.sortKey-e.sortKey));for(const r of n){const{geometry:n,index:o,sourceLayerIndex:a}=r,l=t[o].feature;this.addFeature(r,n,o,i),e.featureIndex.insert(l,n,o,a,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,rs),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,i,r){for(const i of e)for(const e of i){const i=e.x,r=e.y;if(i<0||i>=oo||r<0||r>=oo)continue;const n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),o=n.vertexLength;po(this.layoutVertexArray,i,r,-1,-1),po(this.layoutVertexArray,i,r,1,-1),po(this.layoutVertexArray,i,r,1,1),po(this.layoutVertexArray,i,r,-1,1),this.indexArray.emplaceBack(o,o+1,o+2),this.indexArray.emplaceBack(o,o+3,o+2),n.vertexLength+=4,n.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{},r)}}function fo(t,e){for(let i=0;i1){if(_o(t,e))return!0;for(let r=0;r1?i:i.sub(e)._mult(n)._add(e))}function wo(t,e){let i,r,n,o=!1;for(let a=0;ae.y!=n.y>e.y&&e.x<(n.x-r.x)*(e.y-r.y)/(n.y-r.y)+r.x&&(o=!o)}return o}function Co(t,e){let i=!1;for(let r=0,n=t.length-1;re.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(i=!i)}return i}function So(t,e,i){const r=i[0],n=i[2];if(t.xn.x&&e.x>n.x||t.yn.y&&e.y>n.y)return!1;const o=M(t,e,i[0]);return o!==M(t,e,i[1])||o!==M(t,e,i[2])||o!==M(t,e,i[3])}function Mo(t,e,i){const r=e.paint.get(t).value;return"constant"===r.kind?r.value:i.programConfigurations.get(e.id).getMaxValue(t)}function To(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Eo(t,e,i,r,o){if(!e[0]&&!e[1])return t;const a=n.convert(e)._mult(o);"viewport"===i&&a._rotate(-r);const l=[];for(let e=0;et.width||n.height>t.height||i.x>t.width-n.width||i.y>t.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const a=t.data,l=e.data;if(a===l)throw new Error("srcData equals dstData, so image is already copied");for(let c=0;c{e[t.evaluationKey]=o;const a=t.expression.evaluate(e);n.data[i+r+0]=Math.floor(255*a.r/a.a),n.data[i+r+1]=Math.floor(255*a.g/a.a),n.data[i+r+2]=Math.floor(255*a.b/a.a),n.data[i+r+3]=Math.floor(255*a.a)};if(t.clips)for(let e=0,n=0;e80*i){r=o=t[0],n=a=t[1];for(var m=i;mo&&(o=l),c>a&&(a=c);u=0!==(u=Math.max(o-r,a-n))?32767/u:0}return _a(d,f,i,r,n,u,0),f}function ma(t,e,i,r,n){var o,a;if(n===Ba(t,e,i,r)>0)for(o=e;o=e;o-=r)a=Ra(o,t[o],t[o+1],a);return a&&Pa(a,a.next)&&(ja(a),a=a.next),a}function ga(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!Pa(r,r.next)&&0!==Ia(r.prev,r,r.next))r=r.next;else{if(ja(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function _a(t,e,i,r,n,o,a){if(t){!a&&o&&function(t,e,i,r){var n=t;do{0===n.z&&(n.z=Ta(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,o,a,l,c,u=1;do{for(i=t,t=null,o=null,a=0;i;){for(a++,r=i,l=0,e=0;e0||c>0&&r;)0!==l&&(0===c||!r||i.z<=r.z)?(n=i,i=i.nextZ,l--):(n=r,r=r.nextZ,c--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;i=r}o.nextZ=null,u*=2}while(a>1)}(n)}(t,r,n,o);for(var l,c,u=t;t.prev!==t.next;)if(l=t.prev,c=t.next,o?xa(t,r,n,o):va(t))e.push(l.i/i|0),e.push(t.i/i|0),e.push(c.i/i|0),ja(t),t=c.next,u=c.next;else if((t=c)===u){a?1===a?_a(t=ba(ga(t),e,i),e,i,r,n,o,2):2===a&&wa(t,e,i,r,n,o):_a(ga(t),e,i,r,n,o,1);break}}}function va(t){var e=t.prev,i=t,r=t.next;if(Ia(e,i,r)>=0)return!1;for(var n=e.x,o=i.x,a=r.x,l=e.y,c=i.y,u=r.y,h=no?n>a?n:a:o>a?o:a,f=l>c?l>u?l:u:c>u?c:u,m=r.next;m!==e;){if(m.x>=h&&m.x<=d&&m.y>=p&&m.y<=f&&Aa(n,l,o,c,a,u,m.x,m.y)&&Ia(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function xa(t,e,i,r){var n=t.prev,o=t,a=t.next;if(Ia(n,o,a)>=0)return!1;for(var l=n.x,c=o.x,u=a.x,h=n.y,p=o.y,d=a.y,f=lc?l>u?l:u:c>u?c:u,y=h>p?h>d?h:d:p>d?p:d,_=Ta(f,m,e,i,r),v=Ta(g,y,e,i,r),x=t.prevZ,b=t.nextZ;x&&x.z>=_&&b&&b.z<=v;){if(x.x>=f&&x.x<=g&&x.y>=m&&x.y<=y&&x!==n&&x!==a&&Aa(l,h,c,p,u,d,x.x,x.y)&&Ia(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,b.x>=f&&b.x<=g&&b.y>=m&&b.y<=y&&b!==n&&b!==a&&Aa(l,h,c,p,u,d,b.x,b.y)&&Ia(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;x&&x.z>=_;){if(x.x>=f&&x.x<=g&&x.y>=m&&x.y<=y&&x!==n&&x!==a&&Aa(l,h,c,p,u,d,x.x,x.y)&&Ia(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;b&&b.z<=v;){if(b.x>=f&&b.x<=g&&b.y>=m&&b.y<=y&&b!==n&&b!==a&&Aa(l,h,c,p,u,d,b.x,b.y)&&Ia(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function ba(t,e,i){var r=t;do{var n=r.prev,o=r.next.next;!Pa(n,o)&&Oa(n,r,r.next,o)&&Da(n,o)&&Da(o,n)&&(e.push(n.i/i|0),e.push(r.i/i|0),e.push(o.i/i|0),ja(r),ja(r.next),r=t=o),r=r.next}while(r!==t);return ga(r)}function wa(t,e,i,r,n,o){var a=t;do{for(var l=a.next.next;l!==a.prev;){if(a.i!==l.i&&La(a,l)){var c=za(a,l);return a=ga(a,a.next),c=ga(c,c.next),_a(a,e,i,r,n,o,0),void _a(c,e,i,r,n,o,0)}l=l.next}a=a.next}while(a!==t)}function Ca(t,e){return t.x-e.x}function Sa(t,e){var i=function(t,e){var i,r=e,n=t.x,o=t.y,a=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var l=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(l<=n&&l>a&&(a=l,i=r.x=r.x&&r.x>=h&&n!==r.x&&Aa(oi.x||r.x===i.x&&Ma(i,r)))&&(i=r,d=c)),r=r.next}while(r!==u);return i}(t,e);if(!i)return e;var r=za(i,t);return ga(r,r.next),ga(i,i.next)}function Ma(t,e){return Ia(t.prev,t,e.prev)<0&&Ia(e.next,t,t.next)<0}function Ta(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ea(t){var e=t,i=t;do{(e.x=(t-a)*(o-l)&&(t-a)*(r-l)>=(i-a)*(e-l)&&(i-a)*(o-l)>=(n-a)*(r-l)}function La(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Oa(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Da(t,e)&&Da(e,t)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,o=(t.y+e.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!==t);return r}(t,e)&&(Ia(t.prev,t,e.prev)||Ia(t,e.prev,e))||Pa(t,e)&&Ia(t.prev,t,t.next)>0&&Ia(e.prev,e,e.next)>0)}function Ia(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Pa(t,e){return t.x===e.x&&t.y===e.y}function Oa(t,e,i,r){var n=Fa(Ia(t,e,i)),o=Fa(Ia(t,e,r)),a=Fa(Ia(i,r,t)),l=Fa(Ia(i,r,e));return n!==o&&a!==l||!(0!==n||!ka(t,i,e))||!(0!==o||!ka(t,r,e))||!(0!==a||!ka(i,t,r))||!(0!==l||!ka(i,e,r))}function ka(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Fa(t){return t>0?1:t<0?-1:0}function Da(t,e){return Ia(t.prev,t,t.next)<0?Ia(t,e,t.next)>=0&&Ia(t,t.prev,e)>=0:Ia(t,e,t.prev)<0||Ia(t,t.next,e)<0}function za(t,e){var i=new Na(t.i,t.x,t.y),r=new Na(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function Ra(t,e,i,r){var n=new Na(t,e,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 ja(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Na(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ba(t,e,i,r){for(var n=0,o=e,a=i-r;o0&&i.holes.push(r+=t[n-1].length)}return i};var Va=e(da.exports);function Ua(t,e,i,r,n){Ha(t,e,i||0,r||t.length-1,n||qa)}function Ha(t,e,i,r,n){for(;r>i;){if(r-i>600){var o=r-i+1,a=e-i+1,l=Math.log(o),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(o-c)/o)*(a-o/2<0?-1:1);Ha(t,e,Math.max(i,Math.floor(e-a*c/o+u)),Math.min(r,Math.floor(e+(o-a)*c/o+u)),n)}var h=t[e],p=i,d=r;for(Ga(t,i,e),n(t[r],h)>0&&Ga(t,i,r);p0;)d--}0===n(t[i],h)?Ga(t,i,d):Ga(t,++d,r),d<=e&&(i=d+1),e<=d&&(r=d-1)}}function Ga(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function qa(t,e){return te?1:0}function Za(t,e){const i=t.length;if(i<=1)return[t];const r=[];let n,o;for(let e=0;e1)for(let t=0;tt.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new _n,this.indexArray=new zn,this.indexArray2=new Cn,this.programConfigurations=new ca(t.layers,t.zoom),this.segments=new Dn,this.segments2=new Dn,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasPattern=Wa("fill",this.layers,e);const r=this.layers[0].layout.get("fill-sort-key"),n=!r.isConstant(),o=[];for(const{feature:a,id:l,index:c,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,h=ho(a,t);if(!this.layers[0]._featureFilter.filter(new us(this.zoom),h,i))continue;const p=n?r.evaluate(h,{},i,e.availableImages):void 0,d={id:l,properties:a.properties,type:a.type,sourceLayerIndex:u,index:c,geometry:t?h.geometry:uo(a),patterns:{},sortKey:p};o.push(d)}n&&o.sort(((t,e)=>t.sortKey-e.sortKey));for(const r of o){const{geometry:n,index:o,sourceLayerIndex:a}=r;if(this.hasPattern){const t=Xa("fill",this.layers,r,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(r,n,o,i,{});e.featureIndex.insert(t[o].feature,n,o,a,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,pa),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,i,r,n){for(const t of Za(e,500)){let e=0;for(const i of t)e+=i.length;const i=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),r=i.vertexLength,n=[],o=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&o.push(n.length/2);const i=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),r=i.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(r+e.length-1,r),n.push(e[0].x),n.push(e[0].y);for(let t=1;t>3}if(n--,1===r||2===r)o+=t.readSVarint(),a+=t.readSVarint(),1===r&&(e&&l.push(e),e=[]),e.push(new nl(o,a));else{if(7!==r)throw new Error("unknown command "+r);e&&e.push(e[0].clone())}}return e&&l.push(e),l},ol.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,r=0,n=0,o=0,a=1/0,l=-1/0,c=1/0,u=-1/0;t.pos>3}if(r--,1===i||2===i)(n+=t.readSVarint())l&&(l=n),(o+=t.readSVarint())u&&(u=o);else if(7!==i)throw new Error("unknown command "+i)}return[a,c,l,u]},ol.prototype.toGeoJSON=function(t,e,i){var r,n,o=this.extent*Math.pow(2,i),a=this.extent*t,l=this.extent*e,c=this.loadGeometry(),u=ol.types[this.type];function h(t){for(var e=0;e>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return e}(i))}hl.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new cl(this._pbf,e,this.extent,this._keys,this._values)};var dl=ul;function fl(t,e,i){if(3===t){var r=new dl(i,i.readVarint()+i.pos);r.length&&(e[r.name]=r)}}rl.VectorTile=function(t,e){this.layers=t.readFields(fl,{},e)},rl.VectorTileFeature=sl,rl.VectorTileLayer=ul;const ml=rl.VectorTileFeature.types,yl=Math.pow(2,13);function _l(t,e,i,r,n,o,a,l){t.emplaceBack(e,i,2*Math.floor(r*yl)+a,n*yl*2,o*yl*2,Math.round(l))}class gl{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new gn,this.centroidVertexArray=new pn,this.indexArray=new zn,this.programConfigurations=new ca(t.layers,t.zoom),this.segments=new Dn,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.features=[],this.hasPattern=Wa("fill-extrusion",this.layers,e);for(const{feature:r,id:n,index:o,sourceLayerIndex:a}of t){const t=this.layers[0]._featureFilter.needGeometry,l=ho(r,t);if(!this.layers[0]._featureFilter.filter(new us(this.zoom),l,i))continue;const c={id:n,sourceLayerIndex:a,index:o,geometry:t?l.geometry:uo(r),properties:r.properties,type:r.type,patterns:{}};this.hasPattern?this.features.push(Xa("fill-extrusion",this.layers,c,this.zoom,e)):this.addFeature(c,c.geometry,o,i,{}),e.featureIndex.insert(r,c.geometry,o,a,this.index,!0)}}addFeatures(t,e,i){for(const t of this.features){const{geometry:r}=t;this.addFeature(t,r,t.index,e,i)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,il),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,el.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,i,r,n){const o={x:0,y:0,vertexCount:0};for(const i of Za(e,500)){let e=0;for(const t of i)e+=t.length;let r=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const t of i){if(0===t.length)continue;if(xl(t))continue;let e=0;for(let i=0;i=1){const a=t[i-1];if(!vl(n,a)){r.vertexLength+4>Dn.MAX_VERTEX_ARRAY_LENGTH&&(r=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=n.sub(a)._perp()._unit(),i=a.dist(n);e+i>32768&&(e=0),_l(this.layoutVertexArray,n.x,n.y,t.x,t.y,0,0,e),_l(this.layoutVertexArray,n.x,n.y,t.x,t.y,0,1,e),o.x+=2*n.x,o.y+=2*n.y,o.vertexCount+=2,e+=i,_l(this.layoutVertexArray,a.x,a.y,t.x,t.y,0,0,e),_l(this.layoutVertexArray,a.x,a.y,t.x,t.y,0,1,e),o.x+=2*a.x,o.y+=2*a.y,o.vertexCount+=2;const l=r.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),r.vertexLength+=4,r.primitiveLength+=2}}}}if(r.vertexLength+e>Dn.MAX_VERTEX_ARRAY_LENGTH&&(r=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),"Polygon"!==ml[t.type])continue;const n=[],a=[],l=r.vertexLength;for(const t of i)if(0!==t.length){t!==i[0]&&a.push(n.length/2);for(let e=0;eoo)||t.y===e.y&&(t.y<0||t.y>oo)}function xl(t){return t.every((t=>t.x<0))||t.every((t=>t.x>oo))||t.every((t=>t.y<0))||t.every((t=>t.y>oo))}let bl;Hr("FillExtrusionBucket",gl,{omit:["layers","features"]});var wl={get paint(){return bl=bl||new Is({"fill-extrusion-opacity":new vs(at["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new bs(at["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new vs(at["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new vs(at["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ws(at["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new bs(at["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new bs(at["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new vs(at["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};function Cl(t,e){return t.x*e.x+t.y*e.y}function Sl(t,e){if(1===t.length){let i=0;const r=e[i++];let n;for(;!n||r.equals(n);)if(n=e[i++],!n)return 1/0;for(;it.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new yn,this.layoutVertexArray2=new xn,this.indexArray=new zn,this.programConfigurations=new ca(t.layers,t.zoom),this.segments=new Dn,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasPattern=Wa("line",this.layers,e);const r=this.layers[0].layout.get("line-sort-key"),n=!r.isConstant(),o=[];for(const{feature:e,id:a,index:l,sourceLayerIndex:c}of t){const t=this.layers[0]._featureFilter.needGeometry,u=ho(e,t);if(!this.layers[0]._featureFilter.filter(new us(this.zoom),u,i))continue;const h=n?r.evaluate(u,{},i):void 0,p={id:a,properties:e.properties,type:e.type,sourceLayerIndex:c,index:l,geometry:t?u.geometry:uo(e),patterns:{},sortKey:h};o.push(p)}n&&o.sort(((t,e)=>t.sortKey-e.sortKey));for(const r of o){const{geometry:n,index:o,sourceLayerIndex:a}=r;if(this.hasPattern){const t=Xa("line",this.layers,r,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(r,n,o,i,{});e.featureIndex.insert(t[o].feature,n,o,a,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Al)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Tl),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,i,r,n){const o=this.layers[0].layout,a=o.get("line-join").evaluate(t,{}),l=o.get("line-cap"),c=o.get("line-miter-limit"),u=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const i of e)this.addLine(i,t,a,l,c,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,n,r)}addLine(t,e,i,r,n,o){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e=2&&t[l-1].equals(t[l-2]);)l--;let c=0;for(;c0;if(w&&e>c){const t=p.dist(d);if(t>2*u){const e=p.sub(p.sub(d)._mult(u/t)._round());this.updateDistance(d,e),this.addCurrentVertex(e,m,0,0,h),d=e}}const S=d&&f;let M=S?i:a?"butt":r;if(S&&"round"===M&&(xn&&(M="bevel"),"bevel"===M&&(x>2&&(M="flipbevel"),x100)y=g.mult(-1);else{const t=x*m.add(g).mag()/m.sub(g).mag();y._perp()._mult(t*(C?-1:1))}this.addCurrentVertex(p,y,0,0,h),this.addCurrentVertex(p,y.mult(-1),0,0,h)}else if("bevel"===M||"fakeround"===M){const t=-Math.sqrt(x*x-1),e=C?t:0,i=C?0:t;if(d&&this.addCurrentVertex(p,m,e,i,h),"fakeround"===M){const t=Math.round(180*b/Math.PI/20);for(let e=1;e2*u){const e=p.add(f.sub(p)._mult(u/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,g,0,0,h),p=e}}}}addCurrentVertex(t,e,i,r,n,o=!1){const a=e.y*r-e.x,l=-e.y-e.x*r;this.addHalfVertex(t,e.x+e.y*i,e.y-e.x*i,o,!1,i,n),this.addHalfVertex(t,a,l,o,!0,-r,n),this.distance>Pl/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,i,r,n,o))}addHalfVertex({x:t,y:e},i,r,n,o,a,l){const c=.5*(this.lineClips?this.scaledDistance*(Pl-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(n?1:0),(e<<1)+(o?1:0),Math.round(63*i)+128,Math.round(63*r)+128,1+(0===a?0:a<0?-1:1)|(63&c)<<2,c>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const u=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),l.primitiveLength++),o?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}let Ol,Fl;Hr("LineBucket",kl,{omit:["layers","patternFeatures"]});var Dl={get paint(){return Fl=Fl||new Is({"line-opacity":new bs(at.paint_line["line-opacity"]),"line-color":new bs(at.paint_line["line-color"]),"line-translate":new vs(at.paint_line["line-translate"]),"line-translate-anchor":new vs(at.paint_line["line-translate-anchor"]),"line-width":new bs(at.paint_line["line-width"]),"line-gap-width":new bs(at.paint_line["line-gap-width"]),"line-offset":new bs(at.paint_line["line-offset"]),"line-blur":new bs(at.paint_line["line-blur"]),"line-dasharray":new Ts(at.paint_line["line-dasharray"]),"line-pattern":new ws(at.paint_line["line-pattern"]),"line-gradient":new Ss(at.paint_line["line-gradient"])})},get layout(){return Ol=Ol||new Is({"line-cap":new vs(at.layout_line["line-cap"]),"line-join":new bs(at.layout_line["line-join"]),"line-miter-limit":new vs(at.layout_line["line-miter-limit"]),"line-round-limit":new vs(at.layout_line["line-round-limit"]),"line-sort-key":new bs(at.layout_line["line-sort-key"])})}};class Bl extends bs{possiblyEvaluate(t,e){return e=new us(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,i,r){return e=f({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,i,r)}}let zl;function Rl(t,e){return e>0?e+2*t:t}const jl=ts([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Nl=ts([{name:"a_projected_pos",components:3,type:"Float32"}],4);ts([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Vl=ts([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);ts([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Ul=ts([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Hl=ts([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Gl(t,e,i){return t.sections.forEach((t=>{t.text=function(t,e,i){const r=e.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?t=t.toLocaleUpperCase():"lowercase"===r&&(t=t.toLocaleLowerCase()),t}(t.text,e,i)})),t}ts([{name:"triangle",components:3,type:"Uint16"}]),ts([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),ts([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),ts([{type:"Float32",name:"offsetX"}]),ts([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const ql={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Zl=Xl,$l=function(t,e,i,r,n){var o,a,l=8*n-r-1,c=(1<>1,h=-7,p=i?n-1:0,d=i?-1:1,f=t[e+p];for(p+=d,o=f&(1<<-h)-1,f>>=-h,h+=l;h>0;o=256*o+t[e+p],p+=d,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=r;h>0;a=256*a+t[e+p],p+=d,h-=8);if(0===o)o=1-u;else{if(o===c)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=u}return(f?-1:1)*a*Math.pow(2,o-r)},Wl=function(t,e,i,r,n,o){var a,l,c,u=8*o-n-1,h=(1<>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,m=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),(e+=a+p>=1?d/c:d*Math.pow(2,1-p))*c>=2&&(a++,c/=2),a+p>=h?(l=0,a=h):a+p>=1?(l=(e*c-1)*Math.pow(2,n),a+=p):(l=e*Math.pow(2,p-1)*Math.pow(2,n),a=0));n>=8;t[i+f]=255&l,f+=m,l/=256,n-=8);for(a=a<0;t[i+f]=255&a,f+=m,a/=256,u-=8);t[i+f-m]|=128*g};function Xl(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Xl.Varint=0,Xl.Fixed64=1,Xl.Bytes=2,Xl.Fixed32=5;var Yl=4294967296,Kl=1/Yl,Jl="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Ql(t){return t.type===Xl.Bytes?t.readVarint()+t.pos:t.pos+1}function tc(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function ec(t,e,i){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=t;n--)i.buf[n+r]=i.buf[n]}function ic(t,e){for(var i=0;i>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function dc(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}Xl.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos>3,o=this.pos;this.type=7&r,t(n,e,this),this.pos===o&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=hc(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=dc(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=hc(this.buf,this.pos)+hc(this.buf,this.pos+4)*Yl;return this.pos+=8,t},readSFixed64:function(){var t=hc(this.buf,this.pos)+dc(this.buf,this.pos+4)*Yl;return this.pos+=8,t},readFloat:function(){var t=$l(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=$l(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,r=this.buf;return e=127&(i=r[this.pos++]),i<128?e:(e|=(127&(i=r[this.pos++]))<<7,i<128?e:(e|=(127&(i=r[this.pos++]))<<14,i<128?e:(e|=(127&(i=r[this.pos++]))<<21,i<128?e:function(t,e,i){var r,n,o=i.buf;if(r=(112&(n=o[i.pos++]))>>4,n<128)return tc(t,r,e);if(r|=(127&(n=o[i.pos++]))<<3,n<128)return tc(t,r,e);if(r|=(127&(n=o[i.pos++]))<<10,n<128)return tc(t,r,e);if(r|=(127&(n=o[i.pos++]))<<17,n<128)return tc(t,r,e);if(r|=(127&(n=o[i.pos++]))<<24,n<128)return tc(t,r,e);if(r|=(1&(n=o[i.pos++]))<<31,n<128)return tc(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=r[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Jl?function(t,e,i){return Jl.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){for(var r="",n=e;n239?4:c>223?3:c>191?2:1;if(n+h>i)break;1===h?c<128&&(u=c):2===h?128==(192&(o=t[n+1]))&&(u=(31&c)<<6|63&o)<=127&&(u=null):3===h?(a=t[n+2],128==(192&(o=t[n+1]))&&128==(192&a)&&((u=(15&c)<<12|(63&o)<<6|63&a)<=2047||u>=55296&&u<=57343)&&(u=null)):4===h&&(a=t[n+2],l=t[n+3],128==(192&(o=t[n+1]))&&128==(192&a)&&128==(192&l)&&((u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&l)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,h=1):u>65535&&(u-=65536,r+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),r+=String.fromCharCode(u),n+=h}return r}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Xl.Bytes)return t.push(this.readVarint(e));var i=Ql(this);for(t=t||[];this.pos127;);else if(e===Xl.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Xl.Fixed32)this.pos+=4;else{if(e!==Xl.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var i,r;if(t>=0?(i=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,r=r+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,i.buf[i.pos]=127&(t>>>=7)}(i,0,e),function(t,e){var i=(7&t)<<4;e.buf[e.pos++]|=i|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(r,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,i){for(var r,n,o=0;o55295&&r<57344){if(!n){r>56319||o+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):n=r;continue}if(r<56320){t[i++]=239,t[i++]=191,t[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(t[i++]=239,t[i++]=191,t[i++]=189,n=null);r<128?t[i++]=r:(r<2048?t[i++]=r>>6|192:(r<65536?t[i++]=r>>12|224:(t[i++]=r>>18|240,t[i++]=r>>12&63|128),t[i++]=r>>6&63|128),t[i++]=63&r|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&ec(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),Wl(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Wl(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i=128&&ec(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,i){this.writeTag(t,Xl.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,ic,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,rc,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,oc,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,nc,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,sc,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,ac,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,lc,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,cc,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,uc,e)},writeBytesField:function(t,e){this.writeTag(t,Xl.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Xl.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Xl.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Xl.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Xl.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Xl.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Xl.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Xl.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Xl.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Xl.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var fc=e(Zl);const mc=3;function gc(t,e,i){1===t&&i.readMessage(yc,e)}function yc(t,e,i){if(3===t){const{id:t,bitmap:r,width:n,height:o,left:a,top:l,advance:c}=i.readMessage(_c,{});e.push({id:t,bitmap:new no({width:n+2*mc,height:o+2*mc},r),metrics:{width:n,height:o,left:a,top:l,advance:c}})}}function _c(t,e,i){1===t?e.id=i.readVarint():2===t?e.bitmap=i.readBytes():3===t?e.width=i.readVarint():4===t?e.height=i.readVarint():5===t?e.left=i.readSVarint():6===t?e.top=i.readSVarint():7===t&&(e.advance=i.readVarint())}function vc(t){let e=0,i=0;for(const r of t)e+=r.w*r.h,i=Math.max(i,r.w);t.sort(((t,e)=>e.h-t.h));const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let n=0,o=0;for(const e of t)for(let t=r.length-1;t>=0;t--){const i=r[t];if(!(e.w>i.w||e.h>i.h)){if(e.x=i.x,e.y=i.y,o=Math.max(o,e.y+e.h),n=Math.max(n,e.x+e.w),e.w===i.w&&e.h===i.h){const e=r.pop();tt.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Fo([]),this.placementViewportMatrix=Fo([]);const e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Mc(this.zoom,e["text-size"]),this.iconSizeData=Mc(this.zoom,e["icon-size"]);const i=this.layers[0].layout,r=i.get("symbol-sort-key"),n=i.get("symbol-z-order");this.canOverlap="never"!==Ac(i,"text-overlap","text-allow-overlap")||"never"!==Ac(i,"icon-overlap","icon-allow-overlap")||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==n&&!r.isConstant(),this.sortFeaturesByY=("viewport-y"===n||"auto"===n&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===i.get("symbol-placement")&&(this.writingModes=i.get("text-writing-mode").map((t=>bc[t]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=t.sourceID}createArrays(){this.text=new Dc(new ca(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new Dc(new ca(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new ln,this.lineVertexArray=new cn,this.symbolInstances=new on}calculateGlyphDependencies(t,e,i,r,n){for(let o=0;o0)&&("constant"!==o.value.kind||o.value.value.length>0),u="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=n.get("symbol-sort-key");if(this.features=[],!c&&!u)return;const p=e.iconDependencies,d=e.glyphDependencies,f=e.availableImages,m=new us(this.zoom);for(const{feature:e,id:a,index:l,sourceLayerIndex:g}of t){const t=r._featureFilter.needGeometry,y=ho(e,t);if(!r._featureFilter.filter(m,y,i))continue;let _,v;if(t||(y.geometry=uo(e)),c){const t=r.getValueAndResolveTokens("text-field",y,i,f),e=he.factory(t);Fc(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Vn()||this.hasRTLText&&Gn.isParsed())&&(_=Gl(e,r,y))}if(u){const t=r.getValueAndResolveTokens("icon-image",y,i,f);v=t instanceof pe?t:pe.fromString(t)}if(!_&&!v)continue;const x=this.sortFeaturesByKey?h.evaluate(y,{},i):void 0;if(this.features.push({id:a,text:_,icon:v,index:l,sourceLayerIndex:g,geometry:y.geometry,properties:e.properties,type:Ic[e.type],sortKey:x}),v&&(p[v.name]=!0),_){const t=o.evaluate(y,{},i).join(","),e="viewport"!==n.get("text-rotation-alignment")&&"point"!==n.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(bc.vertical)>=0;for(const i of _.sections)if(i.image)p[i.image.name]=!0;else{const r=Xr(_.toString()),n=i.fontStack||t,o=d[n]=d[n]||{};this.calculateGlyphDependencies(i.text,o,e,this.allowVerticalPlacement,r)}}}"line"===n.get("symbol-placement")&&(this.features=function(t){const e={},i={},r=[];let n=0;function o(e){r.push(t[e]),n++}function a(t,e,n){const o=i[t];return delete i[t],i[e]=o,r[o].geometry[0].pop(),r[o].geometry[0]=r[o].geometry[0].concat(n[0]),o}function l(t,i,n){const o=e[i];return delete e[i],e[t]=o,r[o].geometry[0].shift(),r[o].geometry[0]=n[0].concat(r[o].geometry[0]),o}function c(t,e,i){const r=i?e[0][e[0].length-1]:e[0][0];return`${t}:${r.x}:${r.y}`}for(let u=0;ut.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}update(t,e,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,i),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,i))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){const i=this.lineVertexArray.length;if(void 0!==t.segment){let i=t.dist(e[t.segment+1]),r=t.dist(e[t.segment]);const n={};for(let r=t.segment+1;r=0;i--)n[i]={x:e[i].x,y:e[i].y,tileUnitDistanceFromAnchor:r},i>0&&(r+=e[i-1].dist(e[i]));for(let t=0;t0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const i=t.placedSymbolArray.get(e),r=i.vertexStartIndex+4*i.numGlyphs;for(let e=i.vertexStartIndex;er[t]-r[e]||n[e]-n[t])),o}addToSortKeyRanges(t,e){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===e?i.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,i)=>{t>=0&&i.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let zc,Rc;Hr("SymbolBucket",Bc,{omit:["layers","collisionBoxArray","features","compareText"]}),Bc.MAX_GLYPHS=65535,Bc.addDynamicAttributes=kc;var jc={get paint(){return Rc=Rc||new Is({"icon-opacity":new bs(at.paint_symbol["icon-opacity"]),"icon-color":new bs(at.paint_symbol["icon-color"]),"icon-halo-color":new bs(at.paint_symbol["icon-halo-color"]),"icon-halo-width":new bs(at.paint_symbol["icon-halo-width"]),"icon-halo-blur":new bs(at.paint_symbol["icon-halo-blur"]),"icon-translate":new vs(at.paint_symbol["icon-translate"]),"icon-translate-anchor":new vs(at.paint_symbol["icon-translate-anchor"]),"text-opacity":new bs(at.paint_symbol["text-opacity"]),"text-color":new bs(at.paint_symbol["text-color"],{runtimeType:At,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new bs(at.paint_symbol["text-halo-color"]),"text-halo-width":new bs(at.paint_symbol["text-halo-width"]),"text-halo-blur":new bs(at.paint_symbol["text-halo-blur"]),"text-translate":new vs(at.paint_symbol["text-translate"]),"text-translate-anchor":new vs(at.paint_symbol["text-translate-anchor"])})},get layout(){return zc=zc||new Is({"symbol-placement":new vs(at.layout_symbol["symbol-placement"]),"symbol-spacing":new vs(at.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new vs(at.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new bs(at.layout_symbol["symbol-sort-key"]),"symbol-z-order":new vs(at.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new vs(at.layout_symbol["icon-allow-overlap"]),"icon-overlap":new vs(at.layout_symbol["icon-overlap"]),"icon-ignore-placement":new vs(at.layout_symbol["icon-ignore-placement"]),"icon-optional":new vs(at.layout_symbol["icon-optional"]),"icon-rotation-alignment":new vs(at.layout_symbol["icon-rotation-alignment"]),"icon-size":new bs(at.layout_symbol["icon-size"]),"icon-text-fit":new vs(at.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new vs(at.layout_symbol["icon-text-fit-padding"]),"icon-image":new bs(at.layout_symbol["icon-image"]),"icon-rotate":new bs(at.layout_symbol["icon-rotate"]),"icon-padding":new bs(at.layout_symbol["icon-padding"]),"icon-keep-upright":new vs(at.layout_symbol["icon-keep-upright"]),"icon-offset":new bs(at.layout_symbol["icon-offset"]),"icon-anchor":new bs(at.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new vs(at.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new vs(at.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new vs(at.layout_symbol["text-rotation-alignment"]),"text-field":new bs(at.layout_symbol["text-field"]),"text-font":new bs(at.layout_symbol["text-font"]),"text-size":new bs(at.layout_symbol["text-size"]),"text-max-width":new bs(at.layout_symbol["text-max-width"]),"text-line-height":new vs(at.layout_symbol["text-line-height"]),"text-letter-spacing":new bs(at.layout_symbol["text-letter-spacing"]),"text-justify":new bs(at.layout_symbol["text-justify"]),"text-radial-offset":new bs(at.layout_symbol["text-radial-offset"]),"text-variable-anchor":new vs(at.layout_symbol["text-variable-anchor"]),"text-anchor":new bs(at.layout_symbol["text-anchor"]),"text-max-angle":new vs(at.layout_symbol["text-max-angle"]),"text-writing-mode":new vs(at.layout_symbol["text-writing-mode"]),"text-rotate":new bs(at.layout_symbol["text-rotate"]),"text-padding":new vs(at.layout_symbol["text-padding"]),"text-keep-upright":new vs(at.layout_symbol["text-keep-upright"]),"text-transform":new bs(at.layout_symbol["text-transform"]),"text-offset":new bs(at.layout_symbol["text-offset"]),"text-allow-overlap":new vs(at.layout_symbol["text-allow-overlap"]),"text-overlap":new vs(at.layout_symbol["text-overlap"]),"text-ignore-placement":new vs(at.layout_symbol["text-ignore-placement"]),"text-optional":new vs(at.layout_symbol["text-optional"])})}};class Vc{constructor(t){if(void 0===t.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:St,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Hr("FormatSectionOverride",Vc,{omit:["defaultValue"]});class Uc extends Es{constructor(t){super(t,jc)}recalculate(t,e){if(super.recalculate(t,e),"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"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const t=this.layout.get("text-writing-mode");if(t){const e=[];for(const i of t)e.indexOf(i)<0&&e.push(i);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,i,r){const n=this.layout.get(t).evaluate(e,{},i,r),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||$i(o.value)||!n?n:function(t,e){return e.replace(/{([^{}]+)}/g,((e,i)=>i in t?String(t[i]):""))}(e.properties,n)}createBucket(t){return new Bc(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of jc.paint.overridableProperties){if(!Uc.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),i=new Vc(e),r=new qi(i,e.property.specification);let n=null;n="constant"===e.value.kind||"source"===e.value.kind?new Gi("source",r):new Hi("composite",r,e.value.zoomStops),this.paint._values[t]=new ys(e.property,n,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven())&&Uc.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const i=t.get("text-field"),r=jc.paint.properties[e];let n=!1;const o=t=>{for(const e of t)if(r.overrides&&r.overrides.hasOverride(e))return void(n=!0)};if("constant"===i.value.kind&&i.value.value instanceof he)o(i.value.value.sections);else if("source"===i.value.kind){const t=e=>{n||(e instanceof ge&&_e(e.value)===Ot?o(e.value.sections):e instanceof bi?o(e.sections):e.eachChild(t))},e=i.value;e._styleExpression&&t(e._styleExpression.expression)}return n}}let Nc;var Hc={get paint(){return Nc=Nc||new Is({"background-color":new vs(at.paint_background["background-color"]),"background-pattern":new Ts(at.paint_background["background-pattern"]),"background-opacity":new vs(at.paint_background["background-opacity"])})}};let Gc;var qc={get paint(){return Gc=Gc||new Is({"raster-opacity":new vs(at.paint_raster["raster-opacity"]),"raster-hue-rotate":new vs(at.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new vs(at.paint_raster["raster-brightness-min"]),"raster-brightness-max":new vs(at.paint_raster["raster-brightness-max"]),"raster-saturation":new vs(at.paint_raster["raster-saturation"]),"raster-contrast":new vs(at.paint_raster["raster-contrast"]),"raster-resampling":new vs(at.paint_raster["raster-resampling"]),"raster-fade-duration":new vs(at.paint_raster["raster-fade-duration"])})}};class Zc extends Es{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}const $c={circle:class extends Es{constructor(t){super(t,Io)}createBucket(t){return new ya(t)}queryRadius(t){const e=t;return Mo("circle-radius",this,e)+Mo("circle-stroke-width",this,e)+To(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,i,r,n,o,a,l){const c=Eo(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,a),u=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i),h="map"===this.paint.get("circle-pitch-alignment"),p=h?c:function(t,e){return t.map((t=>$o(t,e)))}(c,l),d=h?u*a:u;for(const t of r)for(const e of t){const t=h?e:$o(e,l);let i=d;const r=qo([],[e.x,e.y,0,1],l);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?i*=r[3]/o.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(i*=o.cameraToCenterDistance/r[3]),mo(p,t,i))return!0}return!1}},heatmap:class extends Es{createBucket(t){return new Qa(t)}constructor(t){super(t,Yo),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=ta({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}},hillshade:class extends Es{constructor(t){super(t,ua)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}},fill:class extends Es{constructor(t){super(t,Ja)}recalculate(t,e){super.recalculate(t,e);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(t){return new Xo(t)}queryRadius(){return To(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,i,r,n,o,a){return go(Eo(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,a),r)}isTileClipped(){return!0}},"fill-extrusion":class extends Es{constructor(t){super(t,wl)}createBucket(t){return new gl(t)}queryRadius(){return To(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,e,i,r,o,a,l,c){const u=Eo(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,l),h=this.paint.get("fill-extrusion-height").evaluate(e,i),p=this.paint.get("fill-extrusion-base").evaluate(e,i),d=function(t,e,i,r){const o=[];for(const i of t){const t=[i.x,i.y,0,1];qo(t,t,e),o.push(new n(t[0]/t[3],t[1]/t[3]))}return o}(u,c),f=function(t,e,i,r){const o=[],a=[],l=r[8]*e,c=r[9]*e,u=r[10]*e,h=r[11]*e,p=r[8]*i,d=r[9]*i,f=r[10]*i,m=r[11]*i;for(const e of t){const t=[],i=[];for(const o of e){const e=o.x,a=o.y,g=r[0]*e+r[4]*a+r[12],y=r[1]*e+r[5]*a+r[13],_=r[2]*e+r[6]*a+r[14],v=r[3]*e+r[7]*a+r[15],x=_+u,b=v+h,w=g+p,C=y+d,S=_+f,M=v+m,T=new n((g+l)/b,(y+c)/b);T.z=x/b,t.push(T);const E=new n(w/M,C/M);E.z=S/M,i.push(E)}o.push(t),a.push(i)}return[o,a]}(r,p,h,c);return function(t,e,i){let r=1/0;go(i,e)&&(r=Sl(i,e[0]));for(let n=0;n=3)for(let e=0;e0){const i=[];for(const{id:r,url:n}of t){const t=`${r}${n}`;-1===i.indexOf(t)&&(i.push(t),e.push({id:r,url:n}))}}return e}function Yc(t,e,i,r,n){if(r)return void t(r);if(n!==Object.values(e).length||n!==Object.values(i).length)return;const o={};for(const t in e){o[t]={};const r=D.getImageCanvasContext(i[t]),n=e[t];for(const e in n){const{width:i,height:a,x:l,y:c,sdf:u,pixelRatio:h,stretchX:p,stretchY:d,content:f}=n[e];o[t][e]={data:null,pixelRatio:h,sdf:u,stretchX:p,stretchY:d,content:f,spriteData:{width:i,height:a,x:l,y:c,context:r}}}}t(null,o)}class Kc{constructor(t,e,i,r){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this.update(e,r)}update(t,e,i){const{width:r,height:n}=t,o=!(this.size&&this.size[0]===r&&this.size[1]===n||i),{context:a}=this,{gl:l}=a;if(this.useMipmap=Boolean(e&&e.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!e||!1!==e.premultiply)),o)this.size=[r,n],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||P(t)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,t):l.texImage2D(l.TEXTURE_2D,0,this.format,r,n,0,this.format,l.UNSIGNED_BYTE,t.data);else{const{x:e,y:o}=i||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||P(t)?l.texSubImage2D(l.TEXTURE_2D,0,e,o,l.RGBA,l.UNSIGNED_BYTE,t):l.texSubImage2D(l.TEXTURE_2D,0,e,o,r,n,l.RGBA,l.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(t,e,i){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),i!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=n.LINEAR),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i||t),this.filter=t),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function Qc(t){const{userImage:e}=t;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class Jc extends nt{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new ao({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,callback:e}of this.requestors)this._notify(t,e);this.requestors=[]}}getImage(t){const e=this.images[t];if(e&&!e.data&&e.spriteData){const t=e.spriteData;e.data=new ao({width:t.width,height:t.height},t.context.getImageData(t.x,t.y,t.width,t.height).data),e.spriteData=null}return e}addImage(t,e){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,e)&&(this.images[t]=e)}_validate(t,e){let i=!0;const r=e.data||e.spriteData;return this._validateStretch(e.stretchX,r&&r.width)||(this.fire(new st(new Error(`Image "${t}" has invalid "stretchX" value`))),i=!1),this._validateStretch(e.stretchY,r&&r.height)||(this.fire(new st(new Error(`Image "${t}" has invalid "stretchY" value`))),i=!1),this._validateContent(e.content,e)||(this.fire(new st(new Error(`Image "${t}" has invalid "content" value`))),i=!1),i}_validateStretch(t,e){if(!t)return!0;let i=0;for(const r of t){if(r[0]-1);c++,o[c]=l,a[c]=u,a[c+1]=tu}for(let l=0,c=0;l{let r=this.entries[t];r||(r=this.entries[t]={glyphs:{},requests:{},ranges:{}});let n=r.glyphs[e];if(void 0!==n)return void i(null,{stack:t,id:e,glyph:n});if(n=this._tinySDF(r,t,e),n)return r.glyphs[e]=n,void i(null,{stack:t,id:e,glyph:n});const o=Math.floor(e/256);if(256*o>65535)return void i(new Error("glyphs > 65535 not supported"));if(r.ranges[o])return void i(null,{stack:t,id:e,glyph:n});if(!this.url)return void i(new Error("glyphsUrl is not set"));let a=r.requests[o];a||(a=r.requests[o]=[],ih.loadGlyphRange(t,o,this.url,this.requestManager,((t,e)=>{if(e){for(const t in e)this._doesCharSupportLocalGlyph(+t)||(r.glyphs[+t]=e[+t]);r.ranges[o]=!0}for(const i of a)i(t,e);delete r.requests[o]}))),a.push(((r,n)=>{r?i(r):n&&i(null,{stack:t,id:e,glyph:n[e]||null})}))}),((t,i)=>{if(t)e(t);else if(i){const t={};for(const{stack:e,id:r,glyph:n}of i)(t[e]||(t[e]={}))[r]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics};e(null,t)}}))}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(Wr["CJK Unified Ideographs"](t)||Wr["Hangul Syllables"](t)||Wr.Hiragana(t)||Wr.Katakana(t))}_tinySDF(t,e,i){const r=this.localIdeographFontFamily;if(!r)return;if(!this._doesCharSupportLocalGlyph(i))return;let n=t.tinySDF;if(!n){let i="400";/bold/i.test(e)?i="900":/medium/i.test(e)?i="500":/light/i.test(e)&&(i="200"),n=t.tinySDF=new ih.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:r,fontWeight:i})}const o=n.draw(String.fromCharCode(i));return{id:i,bitmap:new no({width:o.width||30,height:o.height||30},o.data),metrics:{width:o.glyphWidth||24,height:o.glyphHeight||24,left:o.glyphLeft||0,top:o.glyphTop-27||-8,advance:o.glyphAdvance||24}}}}ih.loadGlyphRange=function(t,e,i,r,n){const o=256*e,a=o+255,l=r.transformRequest(i.replace("{fontstack}",t).replace("{range}",`${o}-${a}`),J.Glyphs);H(l,((t,e)=>{if(t)n(t);else if(e){const t={};for(const i of function(t){return new fc(t).readFields(gc,[])}(e))t[i.id]=i;n(null,t)}}))},ih.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:a="normal"}={}){this.buffer=e,this.cutoff=r,this.radius=i;const l=this.size=t+4*e,c=this._createCanvas(l),u=this.ctx=c.getContext("2d",{willReadFrequently:!0});u.font=`${a} ${o} ${t}px ${n}`,u.textBaseline="alphabetic",u.textAlign="left",u.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(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(t),a=Math.ceil(i),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))),c=Math.min(this.size-this.buffer,a+Math.ceil(r)),u=l+2*this.buffer,h=c+2*this.buffer,p=Math.max(u*h,0),d=new Uint8ClampedArray(p),f={data:d,width:u,height:h,glyphWidth:l,glyphHeight:c,glyphTop:a,glyphLeft:0,glyphAdvance:e};if(0===l||0===c)return f;const{ctx:m,buffer:g,gridInner:y,gridOuter:_}=this;m.clearRect(g,g,l,c),m.fillText(t,g,g+a);const v=m.getImageData(g,g,l,c);_.fill(tu,0,p),y.fill(0,0,p);for(let t=0;t0?t*t:0,y[r]=t<0?t*t:0}}iu(_,0,0,u,h,u,this.f,this.v,this.z),iu(y,g,g,l,c,u,this.f,this.v,this.z);for(let t=0;t1&&(a=t[++o]);const c=Math.abs(l-a.left),u=Math.abs(l-a.right),h=Math.min(c,u);let p;const d=e/i*(r+1);if(a.isDash){const t=r-Math.abs(d);p=Math.sqrt(h*h+t*t)}else p=r-Math.sqrt(h*h+d*d);this.data[n+l]=Math.max(0,Math.min(255,p+128))}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){const i=t[e],r=t[e+1];i.zeroLength?t.splice(e,1):r&&r.isDash===i.isDash&&(r.left=i.left,t.splice(e,1))}const e=t[0],i=t[t.length-1];e.isDash===i.isDash&&(e.left=i.left-this.width,i.right=e.right+this.width);const r=this.width*this.nextRow;let n=0,o=t[n];for(let e=0;e1&&(o=t[++n]);const i=Math.abs(e-o.left),a=Math.abs(e-o.right),l=Math.min(i,a);this.data[r+e]=Math.max(0,Math.min(255,(o.isDash?l:-l)+128))}}addDash(t,e){const i=e?7:0,r=2*i+1;if(this.nextRow+r>this.height)return S("LineAtlas out of space"),null;let n=0;for(let e=0;e{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback()}),0))}remove(){delete this._channel,this._callback=()=>{}}}class lh{constructor(t,e,i){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=i;const r=this.workerPool.acquire(i);for(let t=0;t{i.send(t,e,r)}),i=i||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach((t=>{t.remove()})),this.actors=[],t&&this.workerPool.release(this.id)}}function ou(t,e,i){const r=function(e,r){if(e)return i(e);if(r){const e=m(f(r,t),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);r.vector_layers&&(e.vectorLayers=r.vector_layers,e.vectorLayerIds=e.vectorLayers.map((t=>t.id))),i(null,e)}};return t.url?U(e.transformRequest(t.url,J.Source),r):D.frame((()=>r(null,t)))}lh.Actor=class{constructor(t,e,i){this.target=t,this.parent=e,this.mapId=i,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},_(["receive","process"],this),this.invoker=new oh(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=E()?t:window}send(t,e,i,r,n=!1){const o=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(this.callbacks[o]=i);const a=I(this.globalScope)?void 0:[];return this.target.postMessage({id:o,type:t,hasCallback:!!i,targetMapId:r,mustQueue:n,sourceMapId:this.mapId,data:Zr(e,a)},a),{cancel:()=>{i&&delete this.callbacks[o],this.target.postMessage({id:o,type:"",targetMapId:r,sourceMapId:this.mapId})}}}receive(t){const e=t.data,i=e.id;if(i&&(!e.targetMapId||this.mapId===e.targetMapId))if(""===e.type){delete this.tasks[i];const t=this.cancelCallbacks[i];delete this.cancelCallbacks[i],t&&t()}else E()||e.mustQueue?(this.tasks[i]=e,this.taskQueue.push(i),this.invoker.trigger()):this.processTask(i,e)}process(){if(!this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(t,e){if(""===e.type){const i=this.callbacks[t];delete this.callbacks[t],i&&(e.error?i($r(e.error)):i(null,$r(e.data)))}else{let i=!1;const r=I(this.globalScope)?void 0:[],n=e.hasCallback?(e,n)=>{i=!0,delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"",sourceMapId:this.mapId,error:e?Zr(e):null,data:Zr(n,r)},r)}:t=>{i=!0};let o=null;const a=$r(e.data);if(this.parent[e.type])o=this.parent[e.type](e.sourceMapId,a,n);else if(this.parent.getWorkerSource){const t=e.type.split(".");o=this.parent.getWorkerSource(e.sourceMapId,t[0],a.source)[t[1]](a,n)}else n(new Error(`Could not find function ${e.type}`));!i&&o&&o.cancel&&(this.cancelCallbacks[t]=o.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}};const au=6371008.8;class uh{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new uh(p(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,i=this.lat*e,r=t.lat*e,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((t.lng-this.lng)*e);return au*Math.acos(Math.min(n,1))}static convert(t){if(t instanceof uh)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new uh(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new uh(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}class ph{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof uh?new uh(t.lng,t.lat):uh.convert(t),this}setSouthWest(t){return this._sw=t instanceof uh?new uh(t.lng,t.lat):uh.convert(t),this}extend(t){const e=this._sw,i=this._ne;let r,n;if(t instanceof uh)r=t,n=t;else{if(!(t instanceof ph))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(ph.convert(t)):this.extend(uh.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(uh.convert(t)):this;if(r=t._sw,n=t._ne,!r||!n)return this}return e||i?(e.lng=Math.min(r.lng,e.lng),e.lat=Math.min(r.lat,e.lat),i.lng=Math.max(n.lng,i.lng),i.lat=Math.max(n.lat,i.lat)):(this._sw=new uh(r.lng,r.lat),this._ne=new uh(n.lng,n.lat)),this}getCenter(){return new uh((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 uh(this.getWest(),this.getNorth())}getSouthEast(){return new uh(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:e,lat:i}=uh.convert(t);let r=this._sw.lng<=e&&e<=this._ne.lng;return this._sw.lng>this._ne.lng&&(r=this._sw.lng>=e&&e>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&r}static convert(t){return t instanceof ph?t:t?new ph(t):t}static fromLngLat(t,e=0){const i=360*e/40075017,r=i/Math.cos(Math.PI/180*t.lat);return new ph(new uh(t.lng-r,t.lat-i),new uh(t.lng+r,t.lat+i))}}const lu=2*Math.PI*au;function cu(t){return lu*Math.cos(t*Math.PI/180)}function uu(t){return(180+t)/360}function hu(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function pu(t,e){return t/cu(e)}function du(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class xh{constructor(t,e,i=0){this.x=+t,this.y=+e,this.z=+i}static fromLngLat(t,e=0){const i=uh.convert(t);return new xh(uu(i.lng),hu(i.lat),pu(e,i.lat))}toLngLat(){return new uh(360*this.x-180,du(this.y))}toAltitude(){return this.z*cu(du(this.y))}meterInMercatorCoordinateUnits(){return 1/lu*(t=du(this.y),1/Math.cos(t*Math.PI/180));var t}}class vh{constructor(t,e,i){this.bounds=ph.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=i||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const e=Math.pow(2,t.z),i=Math.floor(uu(this.bounds.getWest())*e),r=Math.floor(hu(this.bounds.getNorth())*e),n=Math.ceil(uu(this.bounds.getEast())*e),o=Math.ceil(hu(this.bounds.getSouth())*e);return t.x>=i&&t.x=r&&t.y{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new st(t)):e&&(f(this,e),e.bounds&&(this.tileBounds=new vh(e.bounds,this.minzoom,this.maxzoom)),this.fire(new rt("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new rt("data",{dataType:"source",sourceDataType:"content"})))}))}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return f({},this._options)}loadTile(t,e){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r={request:this.map._requestManager.transformRequest(i,J.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function n(i,r){return delete t.request,t.aborted?e(null):i&&404!==i.status?e(i):(r&&r.resourceTiming&&(t.resourceTiming=r.resourceTiming),this.map._refreshExpiredTiles&&r&&t.setExpiryData(r),t.loadVectorData(r,this.map.painter),e(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}r.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state?"loading"===t.state?t.reloadCallback=e:t.request=t.actor.send("reloadTile",r,n.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",r,n.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class wh extends nt{constructor(t,e,i,r){super(),this.id=t,this.dispatcher=i,this.setEventedParent(r),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=f({type:"raster"},e),f(this,m(e,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new rt("dataloading",{dataType:"source"})),this._tileJSONRequest=ou(this._options,this.map._requestManager,((t,e)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new st(t)):e&&(f(this,e),e.bounds&&(this.tileBounds=new vh(e.bounds,this.minzoom,this.maxzoom)),this.fire(new rt("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new rt("data",{dataType:"source",sourceDataType:"content"})))}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return f({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,e){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=tt.getImage(this.map._requestManager.transformRequest(i,J.Tile),((i,r,n)=>{if(delete t.request,t.aborted)t.state="unloaded",e(null);else if(i)t.state="errored",e(i);else if(r){this.map._refreshExpiredTiles&&n&&t.setExpiryData(n);const i=this.map.painter.context,o=i.gl;t.texture=this.map.painter.getTileTexture(r.width),t.texture?t.texture.update(r,{useMipmap:!0}):(t.texture=new Kc(i,r,o.RGBA,{useMipmap:!0}),t.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),i.extTextureFilterAnisotropic&&o.texParameterf(o.TEXTURE_2D,i.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,i.extTextureFilterAnisotropicMax)),t.state="loaded",e(null)}}),this.map._refreshExpiredTiles)}abortTile(t,e){t.request&&(t.request.cancel(),delete t.request),e()}unloadTile(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e()}hasTransition(){return!1}}let fu;function mu(t,e,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[t*r-2*Math.PI*6378137/2,e*r-2*Math.PI*6378137/2]}class Ih{constructor(t,e,i){if(t<0||t>25||i<0||i>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))throw new Error(`x=${e}, y=${i}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=e,this.y=i,this.key=gu(0,t,t,e,i)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,i){const r=(o=this.y,a=this.z,l=mu(256*(n=this.x),256*(o=Math.pow(2,a)-o-1),a),c=mu(256*(n+1),256*(o+1),a),l[0]+","+l[1]+","+c[0]+","+c[1]);var n,o,a,l,c;const u=function(t,e,i){let r,n="";for(let o=t;o>0;o--)r=1<1?"@2x":"").replace(/{quadkey}/g,u).replace(/{bbox-epsg-3857}/g,r)}isChildOf(t){const e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){const e=Math.pow(2,this.z);return new n((t.x*e-this.x)*oo,(t.y*e-this.y)*oo)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Ah{constructor(t,e){this.wrap=t,this.canonical=e,this.key=gu(t,e.z,e.z,e.x,e.y)}}class Eh{constructor(t,e,i,r,n){if(t= z; overscaledZ = ${t}; z = ${i}`);this.overscaledZ=t,this.wrap=e,this.canonical=new Ih(i,+r,+n),this.key=gu(e,t,i,r,n)}clone(){return new Eh(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const e=this.canonical.z-t;return t>this.canonical.z?new Eh(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Eh(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-t;return t>this.canonical.z?gu(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):gu(this.wrap*+e,t,t,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new Eh(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new Eh(e,this.wrap,e,i,r),new Eh(e,this.wrap,e,i+1,r),new Eh(e,this.wrap,e,i,r+1),new Eh(e,this.wrap,e,i+1,r+1)]}isLessThan(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.ythis.max&&(this.max=i),i=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}_unpackMapbox(t,e,i){return(256*t*256+256*e+i)/10-1e4}_unpackTerrarium(t,e,i){return 256*t+e+i/256-32768}getPixels(){return new ao({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,i){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let r=e*this.dim,n=e*this.dim+this.dim,o=i*this.dim,a=i*this.dim+this.dim;switch(e){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:o=a-1;break;case 1:a=o+1}const l=-e*this.dim,c=-i*this.dim;for(let e=o;e0&&(l[new Eh(t.overscaledZ,n,e.z,r,e.y-1).key]={backfilled:!1},l[new Eh(t.overscaledZ,t.wrap,e.z,e.x,e.y-1).key]={backfilled:!1},l[new Eh(t.overscaledZ,a,e.z,o,e.y-1).key]={backfilled:!1}),e.y+1{if(this._pendingLoads--,this._removed||e&&e.abandoned)return void this.fire(new rt("dataabort",{dataType:"source"}));let i=null;if(e&&e.resourceTiming&&e.resourceTiming[this.id]&&(i=e.resourceTiming[this.id].slice(0)),t)return void this.fire(new st(t));const r={dataType:"source"};this._collectResourceTiming&&i&&i.length>0&&f(r,{resourceTiming:i}),this.fire(new rt("data",{...r,sourceDataType:"metadata"})),this.fire(new rt("data",{...r,sourceDataType:"content"}))}))}loaded(){return 0===this._pendingLoads}loadTile(t,e){const i=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const r={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(i,r,((r,n)=>(delete t.request,t.unloadVectorData(),t.aborted?e(null):r?e(r):(t.loadVectorData(n,this.map.painter,"reloadTile"===i),e(null)))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return f({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var yu=ts([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ph extends nt{constructor(t,e,i,r){super(),this.id=t,this.dispatcher=i,this.coordinates=e.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=e}load(t,e){this._loaded=!1,this.fire(new rt("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=tt.getImage(this.map._requestManager.transformRequest(this.url,J.Image),((i,r)=>{this._request=null,this._loaded=!0,i?this.fire(new st(i)):r&&(this.image=r,t&&(this.coordinates=t),e&&e(),this._finishLoading())}))}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=t.url,this.load(t.coordinates,(()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new rt("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(t){this.coordinates=t;const e=t.map(xh.fromLngLat);this.tileID=function(t){let e=1/0,i=1/0,r=-1/0,n=-1/0;for(const o of t)e=Math.min(e,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);const o=Math.max(r-e,n-i),a=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),l=Math.pow(2,a);return new Ih(a,Math.floor((e+r)/2*l),Math.floor((i+n)/2*l))}(e),this.minzoom=this.maxzoom=this.tileID.z;const i=e.map((t=>this.tileID.getTilePoint(t)._round()));return this._boundsArray=new mn,this._boundsArray.emplaceBack(i[0].x,i[0].y,0,0),this._boundsArray.emplaceBack(i[1].x,i[1].y,oo,0),this._boundsArray.emplaceBack(i[3].x,i[3].y,0,oo),this._boundsArray.emplaceBack(i[2].x,i[2].y,oo,oo),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new rt("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const t=this.map.painter.context,e=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,yu.members)),this.boundsSegments||(this.boundsSegments=Dn.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Kc(t,this.image,e.RGBA),this.texture.bind(e.LINEAR,e.CLAMP_TO_EDGE));let i=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,i=!0)}i&&this.fire(new rt("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Dh extends Ph{constructor(t,e,i,r){super(t,e,i,r),this.roundZoom=!0,this.type="video",this.options=e}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const e of t.urls)this.urls.push(this.map._requestManager.transformRequest(e,J.Source).url);!function(t,e){const i=window.document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let e=0;e{this._loaded=!0,t?this.fire(new st(t)):e&&(this.video=e,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading())}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const e=this.video.seekable;te.end(0)?this.fire(new st(new xt(`sources.${this.id}`,null,`Playback for this video can be set only between the ${e.start(0)} and ${e.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,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,e=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,yu.members)),this.boundsSegments||(this.boundsSegments=Dn.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(e.LINEAR,e.CLAMP_TO_EDGE),e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,this.video)):(this.texture=new Kc(t,this.video,e.RGBA),this.texture.bind(e.LINEAR,e.CLAMP_TO_EDGE));let i=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,i=!0)}i&&this.fire(new rt("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Lh extends Ph{constructor(t,e,i,r){super(t,e,i,r),e.coordinates?Array.isArray(e.coordinates)&&4===e.coordinates.length&&!e.coordinates.some((t=>!Array.isArray(t)||2!==t.length||t.some((t=>"number"!=typeof t))))||this.fire(new st(new xt(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new st(new xt(`sources.${t}`,null,'missing required property "coordinates"'))),e.animate&&"boolean"!=typeof e.animate&&this.fire(new st(new xt(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),e.canvas?"string"==typeof e.canvas||e.canvas instanceof HTMLCanvasElement||this.fire(new st(new xt(`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 st(new xt(`sources.${t}`,null,'missing required property "canvas"'))),this.options=e,this.animate=void 0===e.animate||e.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 st(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(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const e=this.map.painter.context,i=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,yu.members)),this.boundsSegments||(this.boundsSegments=Dn.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Kc(e,this.canvas,i.RGBA,{premultiply:!0});let r=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,r=!0)}r&&this.fire(new rt("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const _u={vector:bh,raster:wh,"raster-dem":Ch,geojson:Mh,video:Dh,image:Ph,canvas:Lh};function vu(t,e){const i=ko();return Ro(i,i,[1,1,0]),jo(i,i,[.5*t.width,.5*t.height,1]),zo(i,i,t.calculatePosMatrix(e.toUnwrapped()))}function xu(t,e,i,r,n,o){const a=function(t,e,i){if(t)for(const r of t){const t=e[r];if(t&&t.source===i&&"fill-extrusion"===t.type)return!0}else for(const t in e){const r=e[t];if(r.source===i&&"fill-extrusion"===r.type)return!0}return!1}(n&&n.layers,e,t.id),l=o.maxPitchScaleFactor(),c=t.tilesIn(r,l,a);c.sort(bu);const u=[];for(const r of c)u.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(e,i,t._state,r.queryGeometry,r.cameraQueryGeometry,r.scale,n,o,l,vu(t.transform,r.tileID))});const h=function(t){const e={},i={};for(const r of t){const t=r.queryResults,n=r.wrappedTileID,o=i[n]=i[n]||{};for(const i in t){const r=t[i],n=o[i]=o[i]||{},a=e[i]=e[i]||[];for(const t of r)n[t.featureIndex]||(n[t.featureIndex]=!0,a.push(t))}}return e}(u);for(const e in h)h[e].forEach((e=>{const i=e.feature,r=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=r}));return h}function bu(t,e){const i=t.tileID,r=e.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}class Vh{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class Uh{constructor(t,e,i,r,n){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=i,t._y=r,this.properties=t.properties,this.id=n}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}function Su(t,e,i,r,n){return v(t,((t,o)=>{const a=e instanceof xs?e.get(o):null;return a&&a.evaluate?a.evaluate(i,r,n):a}))}function Eu(t){let e=1/0,i=1/0,r=-1/0,n=-1/0;for(const o of t)e=Math.min(e,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);return{minX:e,minY:i,maxX:r,maxY:n}}function Au(t,e){return e-t}Hr("FeatureIndex",class{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Ur(oo,16,0),this.grid3D=new Ur(oo,16,0),this.featureIndexArray=new un,this.promoteId=e}insert(t,e,i,r,n,o){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n);const l=o?this.grid3D:this.grid;for(let t=0;t=0&&r[3]>=0&&l.insert(a,r[0],r[1],r[2],r[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new rl.VectorTile(new fc(this.rawTileData)).layers,this.sourceLayerCoder=new Vh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,i,r){this.loadVTLayers();const o=t.params||{},a=oo/t.tileSize/t.scale,l=tr(o.filter),c=t.queryGeometry,u=t.queryPadding*a,h=Eu(c),p=this.grid.query(h.minX-u,h.minY-u,h.maxX+u,h.maxY+u),d=Eu(t.cameraQueryGeometry),f=this.grid3D.query(d.minX-u,d.minY-u,d.maxX+u,d.maxY+u,((e,i,r,o)=>function(t,e,i,r,o){for(const n of t)if(e<=n.x&&i<=n.y&&r>=n.x&&o>=n.y)return!0;const a=[new n(e,i),new n(e,o),new n(r,o),new n(r,i)];if(t.length>2)for(const e of a)if(Co(t,e))return!0;for(let e=0;e(d||(d=uo(e)),i.queryIntersectsFeature(c,e,r,d,this.z,t.transform,a,t.pixelPosMatrix))))}return m}loadMatchingFeature(t,e,i,r,n,o,a,l,c,u,h){const p=this.bucketLayerIDs[e];if(o&&!function(t,e){for(let i=0;i=0)return!0;return!1}(o,p))return;const d=this.sourceLayerCoder.decode(i),m=this.vtLayers[d].feature(r);if(n.needGeometry){const t=ho(m,!0);if(!n.filter(new us(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!n.filter(new us(this.tileID.overscaledZ),m))return;const g=this.getId(m,d);for(let e=0;ee.getLayer(t))).filter(Boolean);if(0!==t.length){r.layers=t,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)i[e.id]=r}}return i}(t.buckets,e.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const e=this.buckets[t];if(e instanceof Bc){if(this.hasSymbolBuckets=!0,!i)break;e.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const e=this.buckets[t];if(e instanceof Bc&&e.hasRTLText){this.hasRTLText=!0,Gn.isLoading()||Gn.isLoaded()||"deferred"!==Vn()||Un();break}}this.queryPadding=0;for(const t in this.buckets){const i=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(t).queryRadius(i))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new rn}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const i=this.buckets[e];i.uploadPending()&&i.upload(t)}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Kc(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Kc(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,i,r,n,o,a,l,c,u){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:n,scale:o,tileSize:this.tileSize,pixelPosMatrix:u,transform:l,params:a,queryPadding:this.queryPadding*c},t,e,i):{}}querySourceFeatures(t,e){const i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;const r=i.loadVTLayers(),n=e&&e.sourceLayer?e.sourceLayer:"",o=r._geojsonTileLayer||r[n];if(!o)return;const a=tr(e&&e.filter),{z:l,x:c,y:u}=this.tileID.canonical,h={z:l,x:c,y:u};for(let e=0;e@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,i,r,n)=>{const o=r||n;return e[i]=!o||o.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e}(t.cacheControl);e["max-age"]&&(this.expirationTime=Date.now()+1e3*e["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const t=Date.now();let i=!1;if(this.expirationTime>t)i=!1;else if(e)if(this.expirationTime{this.remove(t,n)}),i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const i=t.wrapped().key,r=void 0===e?0:this.data[i].indexOf(e),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(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){const e=[];for(const i in this.data)for(const r of this.data[i])t(r.value)||e.push(r);for(const t of e)this.remove(t.value.tileID,t)}}class Gh{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,e,i){const r=String(e);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][r]=this.stateChanges[t][r]||{},f(this.stateChanges[t][r],i),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==r&&(this.deletedStates[t][e]=null)}else if(this.deletedStates[t]&&null===this.deletedStates[t][r]){this.deletedStates[t][r]={};for(const e in this.state[t][r])i[e]||(this.deletedStates[t][r][e]=null)}else for(const e in i)this.deletedStates[t]&&this.deletedStates[t][r]&&null===this.deletedStates[t][r][e]&&delete this.deletedStates[t][r][e]}removeFeatureState(t,e,i){if(null===this.deletedStates[t])return;const r=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},i&&void 0!==e)null!==this.deletedStates[t][r]&&(this.deletedStates[t][r]=this.deletedStates[t][r]||{},this.deletedStates[t][r][i]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][r])for(i in this.deletedStates[t][r]={},this.stateChanges[t][r])this.deletedStates[t][r][i]=null;else this.deletedStates[t][r]=null;else this.deletedStates[t]=null}getState(t,e){const i=String(e),r=f({},(this.state[t]||{})[i],(this.stateChanges[t]||{})[i]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){const i=this.deletedStates[t][e];if(null===i)return{};for(const t in i)delete r[t]}return r}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(t,e){const i={};for(const t in this.stateChanges){this.state[t]=this.state[t]||{};const e={};for(const i in this.stateChanges[t])this.state[t][i]||(this.state[t][i]={}),f(this.state[t][i],this.stateChanges[t][i]),e[i]=this.state[t][i];i[t]=e}for(const t in this.deletedStates){this.state[t]=this.state[t]||{};const e={};if(null===this.deletedStates[t])for(const i in this.state[t])e[i]={},this.state[t][i]={};else for(const i in this.deletedStates[t]){if(null===this.deletedStates[t][i])this.state[t][i]={};else for(const e of Object.keys(this.deletedStates[t][i]))delete this.state[t][i][e];e[i]=this.state[t][i]}i[t]=i[t]||{},f(i[t],e)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(i).length)for(const r in t)t[r].setFeatureState(i,e)}}class Hh extends nt{constructor(t,e,i){super(),this.id=t,this.dispatcher=i,this.on("data",(t=>{"source"===t.dataType&&"metadata"===t.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)})),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=function(t,e,i,r){const n=new _u[e.type](t,e,i,r);if(n.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${n.id}`);return _(["load","abort","unload","serialize","prepare"],n),n}(t,e,i,this),this._tiles={},this._cache=new Zh(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Gh,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,e){return this._source.loadTile(t,e)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,(()=>{}))}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,(()=>{})),this._source.fire(new rt("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const i=this._tiles[e];i.upload(t),i.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((t=>t.tileID)).sort(Lu).map((t=>t.key))}getRenderableIds(t){const e=[];for(const i in this._tiles)this._isIdRenderable(i,t)&&e.push(this._tiles[i]);return t?e.sort(((t,e)=>{const i=t.tileID,r=e.tileID,o=new n(i.canonical.x,i.canonical.y)._rotate(this.transform.angle),a=new n(r.canonical.x,r.canonical.y)._rotate(this.transform.angle);return i.overscaledZ-r.overscaledZ||a.y-o.y||a.x-o.x})).map((t=>t.tileID.key)):e.map((t=>t.tileID)).sort(Lu).map((t=>t.key))}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(t,"reloading")}}_reloadTile(t,e){const i=this._tiles[t];i&&("loading"!==i.state&&(i.state=e),this._loadTile(i,this._tileLoaded.bind(this,i,t,e)))}_tileLoaded(t,e,i,r){if(r)return t.state="errored",void(404!==r.status?this._source.fire(new st(r,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=D.now(),"expired"===i&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(e,t),"raster-dem"===this.getSource().type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new rt("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const e=this.getRenderableIds();for(let r=0;r1||(Math.abs(i)>1&&(1===Math.abs(i+n)?i+=n:1===Math.abs(i-n)&&(i-=n)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,r),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,i,r){for(const n in this._tiles){let o=this._tiles[n];if(r[n]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>i)continue;let a=o.tileID;for(;o&&o.tileID.overscaledZ>e+1;){const t=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[t.key],o&&o.hasData()&&(a=t)}let l=a;for(;l.overscaledZ>e;)if(l=l.scaledTo(l.overscaledZ-1),t[l.key]){r[a.key]=a;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const i=this._loadedParentTiles[t.key];return i&&i.tileID.overscaledZ>=e?i:null}for(let i=t.overscaledZ-1;i>=e;i--){const e=t.scaledTo(i),r=this._getLoadedTile(e);if(r)return r}}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const e=Math.ceil(t.width/this._source.tileSize)+1,i=Math.ceil(t.height/this._source.tileSize)+1,r=Math.floor(e*i*(null===this._maxTileCacheZoomLevels?z.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),n="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(n)}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const i in this._tiles){const r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),t[r.tileID.key]=r}this._tiles=t;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,e){if(this.transform=t,this.terrain=e,!this._sourceLoaded||this._paused)return;let i;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?i=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((t=>new Eh(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y))):(i=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:e}),this._source.hasTile&&(i=i.filter((t=>this._source.hasTile(t))))):i=[];const r=t.coveringZoomLevel(this._source),n=Math.max(r-Hh.maxOverzooming,this._source.minzoom),o=Math.max(r+Hh.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const t={};for(const e of i)if(e.canonical.z>this._source.minzoom){const i=e.scaledTo(e.canonical.z-1);t[i.key]=i;const r=e.scaledTo(Math.max(this._source.minzoom,Math.min(e.canonical.z,5)));t[r.key]=r}i=i.concat(Object.values(t))}const a=0===i.length&&!this._updated&&this._didEmitContent;this._updated=!0,a&&this.fire(new rt("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const l=this._updateRetainedTiles(i,r);if(Iu(this._source.type)){const t={},a={},c=Object.keys(l),u=D.now();for(const e of c){const i=l[e],r=this._tiles[e];if(!r||0!==r.fadeEndTime&&r.fadeEndTime<=u)continue;const o=this.findLoadedParent(i,n);o&&(this._addTile(o.tileID),t[o.tileID.key]=o.tileID),a[e]=i}this._retainLoadedChildren(a,r,o,l);for(const e in t)l[e]||(this._coveredTiles[e]=!0,l[e]=t[e]);if(e){const t={},e={};for(const r of i)this._tiles[r.key].hasData()?t[r.key]=r:e[r.key]=r;for(const i in e){const r=e[i].children(this._source.maxzoom);this._tiles[r[0].key]&&this._tiles[r[1].key]&&this._tiles[r[2].key]&&this._tiles[r[3].key]&&(t[r[0].key]=l[r[0].key]=r[0],t[r[1].key]=l[r[1].key]=r[1],t[r[2].key]=l[r[2].key]=r[2],t[r[3].key]=l[r[3].key]=r[3],delete e[i])}for(const i in e){const r=this.findLoadedParent(e[i],this._source.minzoom);if(r){t[r.tileID.key]=l[r.tileID.key]=r.tileID;for(const e in t)t[e].isChildOf(r.tileID)&&delete t[e]}}for(const e in this._tiles)t[e]||(this._coveredTiles[e]=!0)}}for(const t in l)this._tiles[t].clearFadeHold();const c=function(t,e){const i=[];for(const r in t)r in e||i.push(r);return i}(this._tiles,l);for(const t of c){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(t)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,e){const i={},r={},n=Math.max(e-Hh.maxOverzooming,this._source.minzoom),o=Math.max(e+Hh.maxUnderzooming,this._source.minzoom),a={};for(const r of t){const t=this._addTile(r);i[r.key]=r,t.hasData()||ethis._source.maxzoom){const t=o.children(this._source.maxzoom)[0],e=this.getTile(t);if(e&&e.hasData()){i[t.key]=t;continue}}else{const t=o.children(this._source.maxzoom);if(i[t[0].key]&&i[t[1].key]&&i[t[2].key]&&i[t[3].key])continue}let a=t.wasRequested();for(let e=o.overscaledZ-1;e>=n;--e){const n=o.scaledTo(e);if(r[n.key])break;if(r[n.key]=!0,t=this.getTile(n),!t&&a&&(t=this._addTile(n)),t){const e=t.hasData();if((a||e)&&(i[n.key]=n),a=t.wasRequested(),e)break}}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let i,r=this._tiles[t].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}e.push(r.key);const t=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(t),i)break;r=t}for(const t of e)this._loadedParentTiles[t]=i}}_addTile(t){let e=this._tiles[t.key];if(e)return e;e=this._cache.getAndRemove(t),e&&(this._setTileReloadTimer(t.key,e),e.tileID=t,this._state.initializeTileState(e,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,e)));const i=e;return e||(e=new jh(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(e,this._tileLoaded.bind(this,e,t.key,e.state))),e.uses++,this._tiles[t.key]=e,i||this._source.fire(new rt("dataloading",{tile:e,coord:e.tileID,dataType:"source"})),e}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),i))}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,e,i){const r=[],n=this.transform;if(!n)return r;const o=i?n.getCameraQueryGeometry(t):t,a=t.map((t=>n.pointCoordinate(t,this.terrain))),l=o.map((t=>n.pointCoordinate(t,this.terrain))),c=this.getIds();let u=1/0,h=1/0,p=-1/0,d=-1/0;for(const t of l)u=Math.min(u,t.x),h=Math.min(h,t.y),p=Math.max(p,t.x),d=Math.max(d,t.y);for(let t=0;t=0&&g[1].y+m>=0){const t=a.map((t=>o.getTilePoint(t))),e=l.map((t=>o.getTilePoint(t)));r.push({tile:i,tileID:o,queryGeometry:t,cameraQueryGeometry:e,scale:f})}}return r}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map((t=>this._tiles[t].tileID));for(const t of e)t.posMatrix=this.transform.calculatePosMatrix(t.toUnwrapped());return e}hasTransition(){if(this._source.hasTransition())return!0;if(Iu(this._source.type)){const t=D.now();for(const e in this._tiles)if(this._tiles[e].fadeEndTime>=t)return!0}return!1}setFeatureState(t,e,i){this._state.updateState(t=t||"_geojsonTileLayer",e,i)}removeFeatureState(t,e,i){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,i)}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,i){const r=this._tiles[t];r&&r.setDependencies(e,i)}reloadTilesForDependencies(t,e){for(const i in this._tiles)this._tiles[i].hasDependency(t,e)&&this._reloadTile(i,"reloading");this._cache.filter((i=>!i.hasDependency(t,e)))}}function Lu(t,e){const i=Math.abs(2*t.wrap)-+(t.wrap<0),r=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||r-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function Iu(t){return"raster"===t||"image"===t||"video"===t}Hh.maxOverzooming=10,Hh.maxUnderzooming=3;const Ou="mapboxgl_preloaded_worker_pool";class Yh{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length{t.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Ou]}numActive(){return Object.keys(this.active).length}}const Fu=Math.floor(D.hardwareConcurrency/2);let ju;function Nu(){return ju||(ju=new Yh),ju}Yh.workerCount=I(globalThis)?Math.max(Math.min(Fu,3),1):1;class eu{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let t=1;t0?(r-o)/a:0;return this.points[n].mult(1-l).add(this.points[e].mult(l))}}function Bu(t,e){let i=!0;return"always"===t||"never"!==t&&"never"!==e||(i=!1),i}class ru{constructor(t,e,i){const r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let t=0;tthis.width||r<0||e>this.height)return[];const l=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=r){if(n)return[{key:null,x1:t,y1:e,x2:i,y2:r}];for(let t=0;t0}hitTestCircle(t,e,i,r,n){const o=t-i,a=t+i,l=e-i,c=e+i;if(a<0||o>this.width||c<0||l>this.height)return!1;const u=[];return this._forEachCell(o,l,a,c,this._queryCellCircle,u,{hitTest:!0,overlapMode:r,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},n),u.length>0}_queryCell(t,e,i,r,n,o,a,l){const{seenUids:c,hitTest:u,overlapMode:h}=a,p=this.boxCells[n];if(null!==p){const n=this.bboxes;for(const a of p)if(!c.box[a]){c.box[a]=!0;const p=4*a,d=this.boxKeys[a];if(t<=n[p+2]&&e<=n[p+3]&&i>=n[p+0]&&r>=n[p+1]&&(!l||l(d))&&(!u||!Bu(h,d.overlapMode))&&(o.push({key:d,x1:n[p],y1:n[p+1],x2:n[p+2],y2:n[p+3]}),u))return!0}}const d=this.circleCells[n];if(null!==d){const n=this.circles;for(const a of d)if(!c.circle[a]){c.circle[a]=!0;const p=3*a,d=this.circleKeys[a];if(this._circleAndRectCollide(n[p],n[p+1],n[p+2],t,e,i,r)&&(!l||l(d))&&(!u||!Bu(h,d.overlapMode))){const t=n[p],e=n[p+1],i=n[p+2];if(o.push({key:d,x1:t-i,y1:e-i,x2:t+i,y2:e+i}),u)return!0}}}return!1}_queryCellCircle(t,e,i,r,n,o,a,l){const{circle:c,seenUids:u,overlapMode:h}=a,p=this.boxCells[n];if(null!==p){const t=this.bboxes;for(const e of p)if(!u.box[e]){u.box[e]=!0;const i=4*e,r=this.boxKeys[e];if(this._circleAndRectCollide(c.x,c.y,c.radius,t[i+0],t[i+1],t[i+2],t[i+3])&&(!l||l(r))&&!Bu(h,r.overlapMode))return o.push(!0),!0}}const d=this.circleCells[n];if(null!==d){const t=this.circles;for(const e of d)if(!u.circle[e]){u.circle[e]=!0;const i=3*e,r=this.circleKeys[e];if(this._circlesCollide(t[i],t[i+1],t[i+2],c.x,c.y,c.radius)&&(!l||l(r))&&!Bu(h,r.overlapMode))return o.push(!0),!0}}}_forEachCell(t,e,i,r,n,o,a,l){const c=this._convertToXCellCoord(t),u=this._convertToYCellCoord(e),h=this._convertToXCellCoord(i),p=this._convertToYCellCoord(r);for(let d=c;d<=h;d++)for(let c=u;c<=p;c++)if(n.call(this,t,e,i,r,this.xCellCount*c+d,o,a,l))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,i,r,n,o){const a=r-t,l=n-e,c=i+o;return c*c>a*a+l*l}_circleAndRectCollide(t,e,i,r,n,o,a){const l=(o-r)/2,c=Math.abs(t-(r+l));if(c>l+i)return!1;const u=(a-n)/2,h=Math.abs(e-(n+u));if(h>u+i)return!1;if(c<=l||h<=u)return!0;const p=c-l,d=h-u;return p*p+d*d<=i*i}}function Vu(t,e,i,r,n){const o=ko();return e?(jo(o,o,[1/n,1/n,1]),i||No(o,o,r.angle)):zo(o,r.labelPlaneMatrix,t),o}function Uu(t,e,i,r,n){if(e){const e=function(t){var e=new Oo(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}(t);return jo(e,e,[n,n,1]),i||No(e,e,-r.angle),e}return r.glCoordMatrix}function Gu(t,e,i){let r;i?(r=[t.x,t.y,i(t.x,t.y),1],qo(r,r,e)):(r=[t.x,t.y,0,1],fh(r,r,e));const o=r[3];return{point:new n(r[0]/o,r[1]/o),signedDistanceFromCamera:o}}function qu(t,e){return.5+t/e*.5}function Zu(t,e){const i=t[0]/t[3],r=t[1]/t[3];return i>=-e[0]&&i<=e[0]&&r>=-e[1]&&r<=e[1]}function $u(t,e,i,r,o,a,l,c,u,h){const p=r?t.textSizeData:t.iconSizeData,d=Ec(p,i.transform.zoom),f=[256/i.width*2+1,256/i.height*2+1],m=r?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;m.clear();const g=t.lineVertexArray,y=r?t.text.placedSymbolArray:t.icon.placedSymbolArray,_=i.transform.width/i.transform.height;let v=!1;for(let r=0;rMath.abs(i.x-e.x)*r?{useVertical:!0}:(t===bc.vertical?e.yi.x)?{needsFlipping:!0}:null}function Ju(t,e,i,r,o,a,l,c,u,h,p,d,f,m,g,y){const _=e/24,v=t.lineOffsetX*_,x=t.lineOffsetY*_;let b;if(t.numGlyphs>1){const e=t.glyphStartIndex+t.numGlyphs,n=t.lineStartIndex,o=t.lineStartIndex+t.lineLength,h=Xu(_,c,v,x,i,p,d,t,u,a,f,g,y);if(!h)return{notEnoughRoom:!0};const w=Gu(h.first.point,l,y).point,C=Gu(h.last.point,l,y).point;if(r&&!i){const e=Yu(t.writingMode,w,C,m);if(e)return e}b=[h.first];for(let r=t.glyphStartIndex+1;r0?a.point:Qu(d,r,e,1,o,y),c=Yu(t.writingMode,e,l,m);if(c)return c}const e=ch(_*c.getoffsetX(t.glyphStartIndex),v,x,i,p,d,t.segment,t.lineStartIndex,t.lineStartIndex+t.lineLength,u,a,f,g,y);if(!e)return{notEnoughRoom:!0};b=[e]}for(const t of b)kc(h,t.point,t.angle);return{}}function Qu(t,e,i,r,n,o){const a=Gu(t.add(t.sub(e)._unit()),n,o).point,l=i.sub(a);return i.add(l._mult(r/l.mag()))}function th(t,e){const{projectionCache:i,lineVertexArray:r,labelPlaneMatrix:o,tileAnchorPoint:a,distanceFromAnchor:l,getElevation:c,previousVertex:u,direction:h,absOffsetX:p}=e;if(i.projections[t])return i.projections[t];const d=new n(r.getx(t),r.gety(t)),f=Gu(d,o,c);if(f.signedDistanceFromCamera>0)return i.projections[t]=f.point,f.point;const m=t-h;return Qu(0===l?a:new n(r.getx(m),r.gety(m)),d,u,p-l+1,o,c)}function eh(t,e,i){return t._unit()._perp()._mult(e*i)}function sh(t,e,i,r,o,a,l,c){const{projectionCache:u,direction:h}=c;if(u.offsets[t])return u.offsets[t];const p=i.add(e);if(t+h=o)return u.offsets[t]=p,p;const d=th(t+h,c),f=eh(d.sub(i),l,h),m=i.add(f),g=d.add(f);return u.offsets[t]=function(t,e,i,r){const o=e.y-t.y,a=e.x-t.x,l=r.y-i.y,c=r.x-i.x,u=l*a-c*o;if(0===u)return null;const h=(c*(t.y-i.y)-l*(t.x-i.x))/u;return new n(t.x+h*a,t.y+h*o)}(a,p,m,g)||p,u.offsets[t]}function ch(t,e,i,r,n,o,a,l,c,u,h,p,d,f){const m=r?t-e:t+e;let g=m>0?1:-1,y=0;r&&(g*=-1,y=Math.PI),g<0&&(y+=Math.PI);let _,v,x=g>0?l+a:l+a+1,b=n,w=n,C=0,S=0;const M=Math.abs(m),T=[];let E;for(;C+S<=M;){if(x+=g,x=c)return null;C+=S,w=b,v=_;const t={projectionCache:p,lineVertexArray:u,labelPlaneMatrix:h,tileAnchorPoint:o,distanceFromAnchor:C,getElevation:f,previousVertex:w,direction:g,absOffsetX:M};if(b=th(x,t),0===i)T.push(w),E=b.sub(w);else{let e;const r=b.sub(w);e=0===r.mag()?eh(th(x+g,t).sub(b),i,g):eh(r,i,g),v||(v=w.add(e)),_=sh(x,e,b,l,c,v,i,t),T.push(v),E=_.sub(v)}S=E.mag()}const A=E._mult((M-C)/S)._add(v||w),I=y+Math.atan2(b.y-w.y,b.x-w.x);return T.push(A),{point:A,angle:d?I:0,path:T}}const hh=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function dh(t,e){for(let i=0;i=1;t--)h.push(a.path[t]);for(let t=1;tGu(t,c,m)));h=t.some((t=>t.signedDistanceFromCamera<=0))?[]:t.map((t=>t.point))}let _=[];if(h.length>0){const t=h[0].clone(),e=h[0].clone();for(let i=1;i=i.x&&e.x<=r.x&&t.y>=i.y&&e.y<=r.y?[h]:e.xr.x||e.yr.y?[]:function(t,e,i,r,o){const a=[];for(let l=0;l=r&&h.x>=r||(l.x>=r?l=new n(r,l.y+(r-l.x)/(h.x-l.x)*(h.y-l.y))._round():h.x>=r&&(h=new n(r,l.y+(r-l.x)/(h.x-l.x)*(h.y-l.y))._round()),l.y>=o&&h.y>=o||(l.y>=o?l=new n(l.x+(o-l.y)/(h.y-l.y)*(h.x-l.x),o)._round():h.y>=o&&(h=new n(l.x+(o-l.y)/(h.y-l.y)*(h.x-l.x),o)._round()),u&&l.equals(u[u.length-1])||(u=[l],a.push(u)),u.push(h)))))}}return a}([h],i.x,i.y,r.x,r.y)}for(const i of _){o.reset(i,.25*e);let r=0;r=o.length<=.5*e?1:Math.ceil(o.paddedLength/y)+1;for(let i=0;i=this.screenRightBoundary||rthis.screenBottomBoundary}isInsideGrid(t,e,i,r){return i>=0&&t=0&&et.collisionGroupID===e}}return this.collisionGroups[t]}}function Th(t,e,i,r,o){const{horizontalAlign:a,verticalAlign:l}=wc(t),c=-(a-.5)*e,u=-(l-.5)*i,h=_h(t,r);return new n(c+h[0]*o,u+h[1]*o)}function Oh(t,e,i,r,o,a){const{x1:l,x2:c,y1:u,y2:h,anchorPointX:p,anchorPointY:d}=t,f=new n(e,i);return r&&f._rotate(o?a:-a),{x1:l+f.x,y1:u+f.y,x2:c+f.x,y2:h+f.y,anchorPointX:p,anchorPointY:d}}class Ru{constructor(t,e,i,r,n){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new wu(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new Du(r),this.collisionCircleArrays={},this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,e,i,r){const n=i.getBucket(e),o=i.latestFeatureIndex;if(!n||!o||e.id!==n.layerIds[0])return;const a=i.collisionBoxArray,l=n.layers[0].layout,c=Math.pow(2,this.transform.zoom-i.tileID.overscaledZ),u=i.tileSize/oo,h=this.transform.calculatePosMatrix(i.tileID.toUnwrapped()),p="map"===l.get("text-pitch-alignment"),d="map"===l.get("text-rotation-alignment"),f=Sh(i,1,this.transform.zoom),m=Vu(h,p,d,this.transform,f);let g=null;if(p){const t=Uu(h,p,d,this.transform,f);g=zo([],this.transform.labelPlaneMatrix,t)}this.retainedQueryData[n.bucketInstanceId]=new Pu(n.bucketInstanceId,o,n.sourceLayerIndex,n.index,i.tileID);const y={bucket:n,layout:l,posMatrix:h,textLabelPlaneMatrix:m,labelToScreenMatrix:g,scale:c,textPixelRatio:u,holdingForFade:i.holdingForFade(),collisionBoxArray:a,partiallyEvaluatedTextSize:Ec(n.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(n.sourceID)};if(r)for(const e of n.sortKeyRanges){const{sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n}=e;t.push({sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n,parameters:y})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:n.symbolInstances.length,parameters:y})}attemptAnchorPlacement(t,e,i,r,n,o,a,l,c,u,h,p,d,f,m,g){const y=[p.textOffset0,p.textOffset1],_=Th(t,i,r,y,n),v=this.collisionIndex.placeCollisionBox(Oh(e,_.x,_.y,o,a,this.transform.angle),h,l,c,u.predicate,g);if((!m||0!==this.collisionIndex.placeCollisionBox(Oh(m,_.x,_.y,o,a,this.transform.angle),h,l,c,u.predicate,g).box.length)&&v.box.length>0){let e;if(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(e=this.prevPlacement.variableOffsets[p.crossTileID].anchor),0===p.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[p.crossTileID]={textOffset:y,width:i,height:r,anchor:t,textBoxScale:n,prevAnchor:e},this.markUsedJustification(d,t,p,f),d.allowVerticalPlacement&&(this.markUsedOrientation(d,f,p),this.placedOrientations[p.crossTileID]=f),{shift:_,placedGlyphBoxes:v}}}placeLayerBucketPart(t,e,i){const{bucket:r,layout:n,posMatrix:o,textLabelPlaneMatrix:a,labelToScreenMatrix:l,textPixelRatio:c,holdingForFade:u,collisionBoxArray:h,partiallyEvaluatedTextSize:p,collisionGroup:d}=t.parameters,f=n.get("text-optional"),m=n.get("icon-optional"),g=Ac(n,"text-overlap","text-allow-overlap"),y="always"===g,_=Ac(n,"icon-overlap","icon-allow-overlap"),v="always"===_,x="map"===n.get("text-rotation-alignment"),b="map"===n.get("text-pitch-alignment"),w="none"!==n.get("icon-text-fit"),C="viewport-y"===n.get("symbol-z-order"),M=y&&(v||!r.hasIconData()||m),T=v&&(y||!r.hasTextData()||f);!r.collisionArrays&&h&&r.deserializeCollisionBoxes(h);const E=this.retainedQueryData[r.bucketInstanceId].tileID,A=this.terrain?(t,e)=>this.terrain.getElevation(E,t,e):null,I=(t,h)=>{if(e[t.crossTileID])return;if(u)return void(this.placements[t.crossTileID]=new Mu(!1,!1,!1));let v=!1,C=!1,E=!0,I=null,P={box:null,offscreen:null},O={box:null,offscreen:null},k=null,F=null,D=null,z=0,j=0,N=0;h.textFeatureIndex?z=h.textFeatureIndex:t.useRuntimeCollisionCircles&&(z=t.featureIndex),h.verticalTextFeatureIndex&&(j=h.verticalTextFeatureIndex);const B=h.textBox;if(B){const e=e=>{let i=bc.horizontal;if(r.allowVerticalPlacement&&!e&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[t.crossTileID];e&&(this.placedOrientations[t.crossTileID]=e,i=e,this.markUsedOrientation(r,i,t))}return i},i=(e,i)=>{if(r.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&h.verticalTextBox){for(const t of r.writingModes)if(t===bc.vertical?(P=i(),O=P):P=e(),P&&P.box&&P.box.length)break}else P=e()};if(n.get("text-variable-anchor")){let a=n.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[t.crossTileID]){const e=this.prevPlacement.variableOffsets[t.crossTileID];a.indexOf(e.anchor)>0&&(a=a.filter((t=>t!==e.anchor)),a.unshift(e.anchor))}const l=(e,i,n)=>{const l=e.x2-e.x1,u=e.y2-e.y1,h=t.textBoxScale,p=w&&"never"===_?i:null;let f={box:[],offscreen:!1};const m="never"!==g?2*a.length:a.length;for(let i=0;i=a.length?g:"never",t,r,n,p,A);if(m&&(f=m.placedGlyphBoxes,f&&f.box&&f.box.length)){v=!0,I=m.shift;break}}return f};i((()=>l(B,h.iconBox,bc.horizontal)),(()=>{const e=h.verticalTextBox;return r.allowVerticalPlacement&&!(P&&P.box&&P.box.length)&&t.numVerticalGlyphVertices>0&&e?l(e,h.verticalIconBox,bc.vertical):{box:null,offscreen:null}})),P&&(v=P.box,E=P.offscreen);const u=e(P&&P.box);if(!v&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[t.crossTileID];e&&(this.variableOffsets[t.crossTileID]=e,this.markUsedJustification(r,e.anchor,t,u))}}else{const n=(e,i)=>{const n=this.collisionIndex.placeCollisionBox(e,g,c,o,d.predicate,A);return n&&n.box&&n.box.length&&(this.markUsedOrientation(r,i,t),this.placedOrientations[t.crossTileID]=i),n};i((()=>n(B,bc.horizontal)),(()=>{const e=h.verticalTextBox;return r.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&e?n(e,bc.vertical):{box:null,offscreen:null}})),e(P&&P.box&&P.box.length)}}if(k=P,v=k&&k.box&&k.box.length>0,E=k&&k.offscreen,t.useRuntimeCollisionCircles){const e=r.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex),c=Tc(r.textSizeData,p,e),u=n.get("text-padding");F=this.collisionIndex.placeCollisionCircles(g,e,r.lineVertexArray,r.glyphOffsetArray,c,o,a,l,i,b,d.predicate,t.collisionCircleDiameter,u,A),F.circles.length&&F.collisionDetected&&!i&&S("Collisions detected, but collision boxes are not shown"),v=y||F.circles.length>0&&!F.collisionDetected,E=E&&F.offscreen}if(h.iconFeatureIndex&&(N=h.iconFeatureIndex),h.iconBox){const t=t=>{const e=w&&I?Oh(t,I.x,I.y,x,b,this.transform.angle):t;return this.collisionIndex.placeCollisionBox(e,_,c,o,d.predicate,A)};O&&O.box&&O.box.length&&h.verticalIconBox?(D=t(h.verticalIconBox),C=D.box.length>0):(D=t(h.iconBox),C=D.box.length>0),E=E&&D.offscreen}const V=f||0===t.numHorizontalGlyphVertices&&0===t.numVerticalGlyphVertices,U=m||0===t.numIconVertices;if(V||U?U?V||(C=C&&v):v=C&&v:C=v=C&&v,v&&k&&k.box&&this.collisionIndex.insertCollisionBox(k.box,g,n.get("text-ignore-placement"),r.bucketInstanceId,O&&O.box&&j?j:z,d.ID),C&&D&&this.collisionIndex.insertCollisionBox(D.box,_,n.get("icon-ignore-placement"),r.bucketInstanceId,N,d.ID),F&&(v&&this.collisionIndex.insertCollisionCircles(F.circles,g,n.get("text-ignore-placement"),r.bucketInstanceId,z,d.ID),i)){const t=r.bucketInstanceId;let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=new ku);for(let t=0;t=0;--t){const i=e[t];I(r.symbolInstances.get(i),r.collisionArrays[i])}}else for(let e=t.symbolInstanceStart;e=0&&(t.text.placedSymbolArray.get(e).crossTileID=n>=0&&e!==n?0:i.crossTileID)}markUsedOrientation(t,e,i){const r=e===bc.horizontal||e===bc.horizontalOnly?e:0,n=e===bc.vertical?e:0,o=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(const e of o)t.text.placedSymbolArray.get(e).placedOrientation=r;i.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=n)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const r=e?e.symbolFadeChange(t):1,n=e?e.opacities:{},o=e?e.variableOffsets:{},a=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],o=n[t];o?(this.opacities[t]=new Cu(o,r,e.text,e.icon),i=i||e.text!==o.text.placed||e.icon!==o.icon.placed):(this.opacities[t]=new Cu(null,r,e.text,e.icon,e.skipFade),i=i||e.text||e.icon)}for(const t in n){const e=n[t];if(!this.opacities[t]){const n=new Cu(e,r,!1,!1);n.isHidden()||(this.opacities[t]=n,i=i||e.text.placed||e.icon.placed)}}for(const t in o)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=o[t]);for(const t in a)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=a[t]);if(e&&void 0===e.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){const i={};for(const r of e){const e=r.getBucket(t);e&&r.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,i,r.collisionBoxArray)}}updateBucketOpacities(t,e,i){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const r=t.layers[0].layout,o=new Cu(null,0,!1,!1,!0),a=r.get("text-allow-overlap"),l=r.get("icon-allow-overlap"),c=r.get("text-variable-anchor"),u="map"===r.get("text-rotation-alignment"),h="map"===r.get("text-pitch-alignment"),p="none"!==r.get("icon-text-fit"),d=new Cu(null,0,a&&(l||!t.hasIconData()||r.get("icon-optional")),l&&(a||!t.hasTextData()||r.get("text-optional")),!0);!t.collisionArrays&&i&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(i);const f=(t,e,i)=>{for(let r=0;r0,_=this.placedOrientations[r.crossTileID],v=_===bc.vertical,x=_===bc.horizontal||_===bc.horizontalOnly;if(a>0||l>0){const e=Wh(g.text);f(t.text,a,v?Xh:e),f(t.text,l,x?Xh:e);const i=g.text.isHidden();[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex].forEach((e=>{e>=0&&(t.text.placedSymbolArray.get(e).hidden=i||v?1:0)})),r.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).hidden=i||x?1:0);const n=this.variableOffsets[r.crossTileID];n&&this.markUsedJustification(t,n.anchor,r,_);const o=this.placedOrientations[r.crossTileID];o&&(this.markUsedJustification(t,"left",r,o),this.markUsedOrientation(t,o,r))}if(y){const e=Wh(g.icon),i=!(p&&r.verticalPlacedIconSymbolIndex&&v);r.placedIconSymbolIndex>=0&&(f(t.icon,r.numIconVertices,i?e:Xh),t.icon.placedSymbolArray.get(r.placedIconSymbolIndex).hidden=g.icon.isHidden()),r.verticalPlacedIconSymbolIndex>=0&&(f(t.icon,r.numVerticalIconVertices,i?Xh:e),t.icon.placedSymbolArray.get(r.verticalPlacedIconSymbolIndex).hidden=g.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const e=t.collisionArrays[i];if(e){let i=new n(0,0);if(e.textBox||e.verticalTextBox){let r=!0;if(c){const t=this.variableOffsets[m];t?(i=Th(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),u&&i._rotate(h?this.transform.angle:-this.transform.angle)):r=!1}e.textBox&&kh(t.textCollisionBox.collisionVertexArray,g.text.placed,!r||v,i.x,i.y),e.verticalTextBox&&kh(t.textCollisionBox.collisionVertexArray,g.text.placed,!r||x,i.x,i.y)}const r=Boolean(!x&&e.verticalIconBox);e.iconBox&&kh(t.iconCollisionBox.collisionVertexArray,g.icon.placed,r,p?i.x:0,p?i.y:0),e.verticalIconBox&&kh(t.iconCollisionBox.collisionVertexArray,g.icon.placed,!r,p?i.x:0,p?i.y:0)}}}if(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.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(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(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTimet}setStale(){this.stale=!0}}function kh(t,e,i,r,n){t.emplaceBack(e?1:0,i?1:0,r||0,n||0),t.emplaceBack(e?1:0,i?1:0,r||0,n||0),t.emplaceBack(e?1:0,i?1:0,r||0,n||0),t.emplaceBack(e?1:0,i?1:0,r||0,n||0)}const Fh=Math.pow(2,25),zh=Math.pow(2,24),Rh=Math.pow(2,17),Nh=Math.pow(2,16),Bh=Math.pow(2,9),qh=Math.pow(2,8),$h=Math.pow(2,1);function Wh(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*Fh+e*zh+i*Rh+e*Nh+i*Bh+e*qh+i*$h+e}const Xh=0;class Hu{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,i,r,n){const o=this._bucketParts;for(;this._currentTileIndext.sortKey-e.sortKey)));this._currentPartIndex!this._forceFullPlacement&&D.now()-r>2;for(;this._currentPlacementIndex>=0;){const r=e[t[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if("symbol"===r.type&&(!r.minzoom||r.minzoom<=o)&&(!r.maxzoom||r.maxzoom>o)){if(this._inProgressLayer||(this._inProgressLayer=new Hu(r)),this._inProgressLayer.continuePlacement(i[r.source],this.placement,this._showCollisionBoxes,r,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Kh=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Ku{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,i]=new Uint8Array(t,0,2);if(219!==e)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=Kh[15&i];if(!n)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new Ku(a,o,n,t)}constructor(t,e=64,i=Float64Array,r){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=i,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const n=Kh.indexOf(this.ArrayType),o=2*t*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-a%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,t),this.coords=new this.ArrayType(this.data,8+a+l,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+o+a+l),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+l,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=t,this.coords[this._pos++]=e,i}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Jh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:a}=this,l=[0,n.length-1,0],c=[];for(;l.length;){const u=l.pop()||0,h=l.pop()||0,p=l.pop()||0;if(h-p<=a){for(let a=p;a<=h;a++){const l=o[2*a],u=o[2*a+1];l>=t&&l<=i&&u>=e&&u<=r&&c.push(n[a])}continue}const d=p+h>>1,f=o[2*d],m=o[2*d+1];f>=t&&f<=i&&m>=e&&m<=r&&c.push(n[d]),(0===u?t<=f:e<=m)&&(l.push(p),l.push(d-1),l.push(1-u)),(0===u?i>=f:r>=m)&&(l.push(d+1),l.push(h),l.push(1-u))}return c}within(t,e,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:n,nodeSize:o}=this,a=[0,r.length-1,0],l=[],c=i*i;for(;a.length;){const u=a.pop()||0,h=a.pop()||0,p=a.pop()||0;if(h-p<=o){for(let i=p;i<=h;i++)ip(n[2*i],n[2*i+1],t,e)<=c&&l.push(r[i]);continue}const d=p+h>>1,f=n[2*d],m=n[2*d+1];ip(f,m,t,e)<=c&&l.push(r[d]),(0===u?t-i<=f:e-i<=m)&&(a.push(p),a.push(d-1),a.push(1-u)),(0===u?t+i>=f:e+i>=m)&&(a.push(d+1),a.push(h),a.push(1-u))}return l}}function Jh(t,e,i,r,n,o){if(n-r<=i)return;const a=r+n>>1;Qh(t,e,a,r,n,o),Jh(t,e,i,r,a-1,1-o),Jh(t,e,i,a+1,n,1-o)}function Qh(t,e,i,r,n,o){for(;n>r;){if(n-r>600){const a=n-r+1,l=i-r+1,c=Math.log(a),u=.5*Math.exp(2*c/3),h=.5*Math.sqrt(c*u*(a-u)/a)*(l-a/2<0?-1:1);Qh(t,e,i,Math.max(r,Math.floor(i-l*u/a+h)),Math.min(n,Math.floor(i+(a-l)*u/a+h)),o)}const a=e[2*i+o];let l=r,c=n;for(tp(t,e,r,i),e[2*n+o]>a&&tp(t,e,r,n);la;)c--}e[2*r+o]===a?tp(t,e,r,c):(c++,tp(t,e,c,n)),c<=i&&(r=c+1),i<=c&&(n=c-1)}}function tp(t,e,i,r){ep(t,i,r),ep(e,2*i,2*r),ep(e,2*i+1,2*r+1)}function ep(t,e,i){const r=t[e];t[e]=t[i],t[i]=r}function ip(t,e,i,r){const n=t-i,o=e-r;return n*n+o*o}const op=512/oo/2;class rp{constructor(t,e,i){this.tileID=t,this.bucketInstanceId=i,this._symbolsByKey={};const r=new Map;for(let t=0;t({x:Math.floor(t.anchorX*op),y:Math.floor(t.anchorY*op)}))),crossTileIDs:e.map((t=>t.crossTileID))};if(i.positions.length>128){const t=new Ku(i.positions.length,16,Uint16Array);for(const{x:e,y:r}of i.positions)t.add(e,r);t.finish(),delete i.positions,i.index=t}this._symbolsByKey[t]=i}}getScaledCoordinates(t,e){const{x:i,y:r,z:n}=this.tileID.canonical,{x:o,y:a,z:l}=e.canonical,c=op/Math.pow(2,l-n),u=(a*oo+t.anchorY)*c,h=r*oo*op;return{x:Math.floor((o*oo+t.anchorX)*c-i*oo*op),y:Math.floor(u-h)}}findMatches(t,e,i){const r=this.tileID.canonical.zt))}}class sp{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class np{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const e=Math.round((t-this.lng)/360);if(0!==e)for(const t in this.indexes){const i=this.indexes[t],r={};for(const t in i){const n=i[t];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),r[n.tileID.key]=n}this.indexes[t]=r}this.lng=t}addBucket(t,e,i){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let t=0;tt.overscaledZ)for(const i in n){const o=n[i];o.tileID.isChildOf(t)&&o.findMatches(e.symbolInstances,t,r)}else{const o=n[t.scaledTo(Number(i)).key];o&&o.findMatches(e.symbolInstances,t,r)}}for(let t=0;t{e[t]=!0}));for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t]}}const lp=(t,e)=>Br(t,e&&e.filter((t=>"source.canvas"!==t.identifier))),cp=m(pt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),hp=m(pt,["setCenter","setZoom","setBearing","setPitch"]),pp=function(){const t={},e=at.$version;for(const i in at.$root){const r=at.$root[i];if(r.required){let n=null;n="version"===i?e:"array"===r.type?[]:{},null!=n&&(t[i]=n)}}return t}();class up extends nt{constructor(t,e={}){super(),this.map=t,this.dispatcher=new lh(Nu(),this,t._getMapId()),this.imageManager=new Jc,this.imageManager.setEventedParent(this),this.glyphManager=new ih(t._requestManager,e.localIdeographFontFamily),this.lineAtlas=new ah(256,512),this.crossTileSymbolIndex=new ap,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new Gr,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",j());const i=this;this._rtlTextPluginCallback=up.registerForPluginStateChange((t=>{i.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:t.pluginStatus,pluginURL:t.pluginURL},((t,e)=>{if(jn(t),e&&e.every((t=>t)))for(const t in i.sourceCaches){const e=i.sourceCaches[t].getSource().type;"vector"!==e&&"geojson"!==e||i.sourceCaches[t].reload()}}))})),this.on("data",(t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.sourceCaches[t.sourceId];if(!e)return;const i=e.getSource();if(i&&i.vectorLayerIds)for(const t in this._layers){const e=this._layers[t];e.source===i.id&&this._validateLayer(e)}}))}loadURL(t,e={},i){this.fire(new rt("dataloading",{dataType:"style"})),e.validate="boolean"!=typeof e.validate||e.validate;const r=this.map._requestManager.transformRequest(t,J.Style);this._request=U(r,((t,r)=>{this._request=null,t?this.fire(new st(t)):r&&this._load(r,e,i)}))}loadJSON(t,e={},i){this.fire(new rt("dataloading",{dataType:"style"})),this._request=D.frame((()=>{this._request=null,e.validate=!1!==e.validate,this._load(t,e,i)}))}loadEmpty(){this.fire(new rt("dataloading",{dataType:"style"})),this._load(pp,{validate:!1})}_load(t,e,i){const r=e.transformStyle?e.transformStyle(i,t):t;if(!e.validate||!lp(this,zr(r))){this._loaded=!0,this.stylesheet=r;for(const t in r.sources)this.addSource(t,r.sources[t],{validate:!1});r.sprite?this._loadSprite(r.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(r.glyphs),this._createLayers(),this.light=new nh(this.stylesheet.light),this.map.setTerrain(this.stylesheet.terrain),this.fire(new rt("data",{dataType:"style"})),this.fire(new rt("style.load"))}}_createLayers(){const t=ut(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",t),this._order=t.map((t=>t.id)),this._layers={},this._serializedLayers=null;for(const e of t){const t=Wc(e);t.setEventedParent(this,{layer:{id:e.id}}),this._layers[e.id]=t}}_loadSprite(t,e=!1,i=undefined){this.imageManager.setLoaded(!1),this._spriteRequest=function(t,e,i,r){const n=Xc(t),o=n.length,a=i>1?"@2x":"",l={},c={},u={};for(const{id:t,url:i}of n){const n=e.transformRequest(e.normalizeSpriteURL(i,a,".json"),J.SpriteJSON),h=`${t}_${n.url}`;l[h]=U(n,((e,i)=>{delete l[h],c[t]=i,Yc(r,c,u,e,o)}));const p=e.transformRequest(e.normalizeSpriteURL(i,a,".png"),J.SpriteImage),d=`${t}_${p.url}`;l[d]=tt.getImage(p,((e,i)=>{delete l[d],u[t]=i,Yc(r,c,u,e,o)}))}return{cancel(){for(const t of Object.values(l))t.cancel()}}}(t,this.map._requestManager,this.map.getPixelRatio(),((t,r)=>{if(this._spriteRequest=null,t)this.fire(new st(t));else if(r)for(const t in r){this._spritesImagesIds[t]=[];const i=this._spritesImagesIds[t]?this._spritesImagesIds[t].filter((t=>!(t in r))):[];for(const t of i)this.imageManager.removeImage(t),this._changedImages[t]=!0;for(const i in r[t]){const n="default"===t?i:`${t}:${i}`;this._spritesImagesIds[t].push(n),n in this.imageManager.images?this.imageManager.updateImage(n,r[t][i],!1):this.imageManager.addImage(n,r[t][i]),e&&(this._changedImages[n]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),e&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new rt("data",{dataType:"style"})),i&&i(t)}))}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new rt("data",{dataType:"style"}))}_validateLayer(t){const e=this.sourceCaches[t.source];if(!e)return;const i=t.sourceLayer;if(!i)return;const r=e.getSource();("geojson"===r.type||r.vectorLayerIds&&-1===r.vectorLayerIds.indexOf(i))&&this.fire(new st(new Error(`Source layer "${i}" does not exist on source "${r.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){const e=this._serializedAllLayers();if(!t||0===t.length)return Object.values(e);const i=[];for(const r of t)e[r]&&i.push(e[r]);return i}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const e=Object.keys(this._layers);for(const i of e){const e=this._layers[i];"custom"!==e.type&&(t[i]=e.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const e=this._changed;if(this._changed){const e=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(e.length||i.length)&&this._updateWorkerLayers(e,i);for(const t in this._updatedSources){const e=this._updatedSources[t];if("reload"===e)this._reloadSource(t);else{if("clear"!==e)throw new Error(`Invalid action ${e}`);this._clearSource(t)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const e in this._updatedPaintProps)this._layers[e].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const i={};for(const t in this.sourceCaches){const e=this.sourceCaches[t];i[t]=e.used,e.used=!1}for(const e of this._order){const i=this._layers[e];i.recalculate(t,this._availableImages),!i.isHidden(t.zoom)&&i.source&&(this.sourceCaches[i.source].used=!0)}for(const t in i){const e=this.sourceCaches[t];i[t]!==e.used&&e.fire(new rt("data",{sourceDataType:"visibility",dataType:"source",sourceId:t}))}this.light.recalculate(t),this.z=t.zoom,e&&this.fire(new rt("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,e={}){this._checkLoaded();const i=this.serialize();if(t=e.transformStyle?e.transformStyle(i,t):t,lp(this,zr(t)))return!1;(t=w(t)).layers=ut(t.layers);const r=function(t,e){if(!t)return[{command:pt.setStyle,args:[e]}];let i=[];try{if(!ht(t.version,e.version))return[{command:pt.setStyle,args:[e]}];ht(t.center,e.center)||i.push({command:pt.setCenter,args:[e.center]}),ht(t.zoom,e.zoom)||i.push({command:pt.setZoom,args:[e.zoom]}),ht(t.bearing,e.bearing)||i.push({command:pt.setBearing,args:[e.bearing]}),ht(t.pitch,e.pitch)||i.push({command:pt.setPitch,args:[e.pitch]}),ht(t.sprite,e.sprite)||i.push({command:pt.setSprite,args:[e.sprite]}),ht(t.glyphs,e.glyphs)||i.push({command:pt.setGlyphs,args:[e.glyphs]}),ht(t.transition,e.transition)||i.push({command:pt.setTransition,args:[e.transition]}),ht(t.light,e.light)||i.push({command:pt.setLight,args:[e.light]});const r={},n=[];!function(t,e,i,r){let n;for(n in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)||ft(n,i,r));for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(t,n)?ht(t[n],e[n])||("geojson"===t[n].type&&"geojson"===e[n].type&>(t,e,n)?i.push({command:pt.setGeoJSONSourceData,args:[n,e[n].data]}):mt(n,e,i,r)):dt(n,e,i))}(t.sources,e.sources,n,r);const o=[];t.layers&&t.layers.forEach((t=>{r[t.source]?i.push({command:pt.removeLayer,args:[t.id]}):o.push(t)})),i=i.concat(n),function(t,e,i){e=e||[];const r=(t=t||[]).map(_t),n=e.map(_t),o=t.reduce(vt,{}),a=e.reduce(vt,{}),l=r.slice(),c=Object.create(null);let u,h,p,d,f,m,g;for(u=0,h=0;u!(t.command in hp)));if(0===r.length)return!1;const n=r.filter((t=>!(t.command in cp)));if(n.length>0)throw new Error(`Unimplemented: ${n.map((t=>t.command)).join(", ")}.`);for(const t of r)"setTransition"!==t.command&&this[t.command].apply(this,t.args);return this.stylesheet=t,!0}addImage(t,e){if(this.getImage(t))return this.fire(new st(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,e),this._afterImageUpdated(t)}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new st(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new rt("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,e,i={}){if(this._checkLoaded(),void 0!==this.sourceCaches[t])throw new Error(`Source "${t}" already exists.`);if(!e.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(e).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(e.type)>=0&&this._validate(zr.source,`sources.${t}`,e,null,i))return;this.map&&this.map._collectResourceTiming&&(e.collectResourceTiming=!0);const r=this.sourceCaches[t]=new Hh(t,e,this.dispatcher);r.style=this,r.setEventedParent(this,(()=>({isSourceLoaded:r.loaded(),source:r.serialize(),sourceId:t}))),r.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error("There is no source with this ID");for(const e in this._layers)if(this._layers[e].source===t)return this.fire(new st(new Error(`Source "${t}" cannot be removed while layer "${e}" is using it.`)));const e=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],e.fire(new rt("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),e.setEventedParent(null),e.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,e){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error(`There is no source with this ID=${t}`);const i=this.sourceCaches[t].getSource();if("geojson"!==i.type)throw new Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(e),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,e,i={}){this._checkLoaded();const r=t.id;if(this.getLayer(r))return void this.fire(new st(new Error(`Layer "${r}" already exists on this map.`)));let n;if("custom"===t.type){if(lp(this,function(t){const e=[],i=t.id;return void 0===i&&e.push({message:`layers.${i}: missing required property "id"`}),void 0===t.render&&e.push({message:`layers.${i}: missing required method "render"`}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e}(t)))return;n=Wc(t)}else{if("object"==typeof t.source&&(this.addSource(r,t.source),t=f(t=w(t),{source:r})),this._validate(zr.layer,`layers.${r}`,t,{arrayIndex:-1},i))return;n=Wc(t),this._validateLayer(n),n.setEventedParent(this,{layer:{id:r}})}const o=e?this._order.indexOf(e):this._order.length;if(e&&-1===o)this.fire(new st(new Error(`Cannot add layer "${r}" before non-existing layer "${e}".`)));else{if(this._order.splice(o,0,r),this._layerOrderChanged=!0,this._layers[r]=n,this._removedLayers[r]&&n.source&&"custom"!==n.type){const t=this._removedLayers[r];delete this._removedLayers[r],t.type!==n.type?this._updatedSources[n.source]="clear":(this._updatedSources[n.source]="reload",this.sourceCaches[n.source].pause())}this._updateLayer(n),n.onAdd&&n.onAdd(this.map)}}moveLayer(t,e){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new st(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===e)return;const i=this._order.indexOf(t);this._order.splice(i,1);const r=e?this._order.indexOf(e):this._order.length;e&&-1===r?this.fire(new st(new Error(`Cannot move layer "${t}" before non-existing layer "${e}".`))):(this._order.splice(r,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const e=this._layers[t];if(!e)return void this.fire(new st(new Error(`Cannot remove non-existing layer "${t}".`)));e.setEventedParent(null);const i=this._order.indexOf(t);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=e,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],e.onRemove&&e.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,e,i){this._checkLoaded();const r=this.getLayer(t);r?r.minzoom===e&&r.maxzoom===i||(null!=e&&(r.minzoom=e),null!=i&&(r.maxzoom=i),this._updateLayer(r)):this.fire(new st(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,e,i={}){this._checkLoaded();const r=this.getLayer(t);if(r){if(!b(r.filter,e))return null==e?(r.filter=void 0,void this._updateLayer(r)):void(this._validate(zr.filter,`layers.${r.id}.filter`,e,null,i)||(r.filter=w(e),this._updateLayer(r)))}else this.fire(new st(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return w(this.getLayer(t).filter)}setLayoutProperty(t,e,i,r={}){this._checkLoaded();const n=this.getLayer(t);n?b(n.getLayoutProperty(e),i)||(n.setLayoutProperty(e,i,r),this._updateLayer(n)):this.fire(new st(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,e){const i=this.getLayer(t);if(i)return i.getLayoutProperty(e);this.fire(new st(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,e,i,r={}){this._checkLoaded();const n=this.getLayer(t);n?b(n.getPaintProperty(e),i)||(n.setPaintProperty(e,i,r)&&this._updateLayer(n),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new st(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(t,e){this._checkLoaded();const i=t.source,r=t.sourceLayer,n=this.sourceCaches[i];if(void 0===n)return void this.fire(new st(new Error(`The source '${i}' does not exist in the map's style.`)));const o=n.getSource().type;"geojson"===o&&r?this.fire(new st(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==o||r?(void 0===t.id&&this.fire(new st(new Error("The feature id parameter must be provided."))),n.setFeatureState(r,t.id,e)):this.fire(new st(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,e){this._checkLoaded();const i=t.source,r=this.sourceCaches[i];if(void 0===r)return void this.fire(new st(new Error(`The source '${i}' does not exist in the map's style.`)));const n=r.getSource().type,o="vector"===n?t.sourceLayer:void 0;"vector"!==n||o?e&&"string"!=typeof t.id&&"number"!=typeof t.id?this.fire(new st(new Error("A feature id is required to remove its specific state property."))):r.removeFeatureState(o,t.id,e):this.fire(new st(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const e=t.source,i=t.sourceLayer,r=this.sourceCaches[e];if(void 0!==r)return"vector"!==r.getSource().type||i?(void 0===t.id&&this.fire(new st(new Error("The feature id parameter must be provided."))),r.getFeatureState(i,t.id)):void this.fire(new st(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new st(new Error(`The source '${e}' does not exist in the map's style.`)))}getTransition(){return f({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const t=v(this.sourceCaches,(t=>t.serialize())),e=this._serializeByIds(this._order),i=this.stylesheet;return x({version:i.version,name:i.name,metadata:i.metadata,light:i.light,center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch,sprite:i.sprite,glyphs:i.glyphs,transition:i.transition,sources:t,layers:e},(t=>void 0!==t))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,i={},r=[];for(let n=this._order.length-1;n>=0;n--){const o=this._order[n];if(e(o)){i[o]=n;for(const e of t){const t=e[o];if(t)for(const e of t)r.push(e)}}}r.sort(((t,e)=>e.intersectionZ-t.intersectionZ));const n=[];for(let o=this._order.length-1;o>=0;o--){const a=this._order[o];if(e(a))for(let t=r.length-1;t>=0;t--){const e=r[t].feature;if(i[e.layer.id]{const r=i.featureSortOrder;if(r){const i=r.indexOf(t.featureIndex);return r.indexOf(e.featureIndex)-i}return e.featureIndex-t.featureIndex}));for(const t of n)e.push(t)}}for(const e in l)l[e].forEach((r=>{const n=r.feature,o=i[t[e].source].getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=o}));return l}(this._layers,o,this.sourceCaches,t,e,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(n)}querySourceFeatures(t,e){e&&e.filter&&this._validate(zr.filter,"querySourceFeatures.filter",e.filter,null,e);const i=this.sourceCaches[t];return i?function(t,e){const i=t.getRenderableIds().map((e=>t.getTileByID(e))),r=[],n={};for(let t=0;tt.getTileByID(e))).sort(((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)))}const r=this.crossTileSymbolIndex.addLayer(i,l[i.source],t.center.lng);o=o||r}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((n=n||this._layerOrderChanged||0===i)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(D.now(),t.zoom))&&(this.pauseablePlacement=new Wu(t,this.map.terrain,this._order,n,e,i,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(D.now()),a=!0),o&&this.pauseablePlacement.placement.setStale()),a||o)for(const t of this._order){const e=this._layers[t];"symbol"===e.type&&this.placement.updateLayerOpacities(e,l[e.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(D.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,e,i){this.imageManager.getImages(e.icons,i),this._updateTilesForChangedImages();const r=this.sourceCaches[e.source];r&&r.setDependencies(e.tileID.key,e.type,e.icons)}getGlyphs(t,e,i){this.glyphManager.getGlyphs(e.stacks,i);const r=this.sourceCaches[e.source];r&&r.setDependencies(e.tileID.key,e.type,[""])}getResource(t,e,i){return V(e,i)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,e={}){this._checkLoaded(),t&&this._validate(zr.glyphs,"glyphs",t,null,e)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,e,i={},r){this._checkLoaded();const n=[{id:t,url:e}],o=[...Xc(this.stylesheet.sprite),...n];this._validate(zr.sprite,"sprite",o,null,i)||(this.stylesheet.sprite=o,this._loadSprite(n,!0,r))}removeSprite(t){this._checkLoaded();const e=Xc(this.stylesheet.sprite);if(e.find((e=>e.id===t))){if(this._spritesImagesIds[t])for(const e of this._spritesImagesIds[t])this.imageManager.removeImage(e),this._changedImages[e]=!0;e.splice(e.findIndex((e=>e.id===t)),1),this.stylesheet.sprite=e.length>0?e:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new rt("data",{dataType:"style"}))}else this.fire(new st(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return Xc(this.stylesheet.sprite)}setSprite(t,e={},i){this._checkLoaded(),t&&this._validate(zr.sprite,"sprite",t,null,e)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,i):(this._unloadSprite(),i&&i(null)))}}up.getSourceType=function(t){return _u[t]},up.setSourceType=function(t,e){_u[t]=e},up.registerForPluginStateChange=function(t){return t({pluginStatus:Fn,pluginURL:Rn}),Bn.on("pluginStateChange",t),t};var dp=ts([{name:"a_pos",type:"Int16",components:2}]),fp="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const mp={prelude:gp("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\n","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\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(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}"),background:gp("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:gp("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:gp("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:gp("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:gp("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}"),heatmapTexture:gp("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:gp("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:gp("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:gp("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:gp("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),fillOutline:gp("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillOutlinePattern:gp("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillPattern:gp("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:gp("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:gp("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:gp("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:gp("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:gp("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:gp("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:gp("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\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;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:gp("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\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;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),raster:gp("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:gp("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.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(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:gp("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.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(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:gp("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.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(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:gp("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",fp),terrainDepth:gp("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",fp),terrainCoords:gp("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",fp)};function gp(t,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=e.match(/attribute ([\w]+) ([\w]+)/g),n=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(n):n,l={};return{fragmentSource:t=t.replace(i,((t,e,i,r,n)=>(l[n]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nvarying ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = u_${n};\n#endif\n`))),vertexSource:e=e.replace(i,((t,e,i,r,n)=>{const o="float"===r?"vec2":"vec4",a=n.match(/color/)?"color":o;return l[n]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nattribute ${i} ${o} a_${n};\nvarying ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nattribute ${i} ${o} a_${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`})),staticAttributes:r,staticUniforms:a}}class _p{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,i,r,n,o,a,l,c){this.context=t;let u=this.boundPaintVertexBuffers.length!==r.length;for(let t=0;!u&&t({u_depth:new Wn(t,e.u_depth),u_terrain:new Wn(t,e.u_terrain),u_terrain_dim:new Xn(t,e.u_terrain_dim),u_terrain_matrix:new ea(t,e.u_terrain_matrix),u_terrain_unpack:new Jn(t,e.u_terrain_unpack),u_terrain_exaggeration:new Xn(t,e.u_terrain_exaggeration)}))(t,w),this.binderUniforms=r?r.getUniforms(t,w):[]}draw(t,e,i,r,n,o,a,l,c,u,h,p,d,f,m,g,y,_){const v=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(r),t.setColorMode(n),t.setCullFace(o),l){t.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,l.depthTexture),t.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,l.texture);for(const t in this.terrainUniforms)this.terrainUniforms[t].set(l[t])}for(const t in this.fixedUniforms)this.fixedUniforms[t].set(a[t]);m&&m.setUniforms(t,this.binderUniforms,d,{zoom:f});let x=0;switch(e){case v.LINES:x=2;break;case v.TRIANGLES:x=3;break;case v.LINE_STRIP:x=1}for(const i of p.get()){const r=i.vaos||(i.vaos={});(r[c]||(r[c]=new _p)).bind(t,this,u,m?m.getPaintVertexBuffers():[],h,i.vertexOffset,g,y,_),v.drawElements(e,i.primitiveLength*x,v.UNSIGNED_SHORT,i.primitiveOffset*x*2)}}}function xp(t,e,i){const r=1/Sh(i,1,e.transform.tileZoom),n=Math.pow(2,i.tileID.overscaledZ),o=i.tileSize*Math.pow(2,e.transform.tileZoom)/n,a=o*(i.tileID.canonical.x+i.tileID.wrap*n),l=o*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[r,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[a>>16,l>>16],u_pixel_coord_lower:[65535&a,65535&l]}}const bp=(t,e,i,r)=>{const n=e.style.light,o=n.properties.get("position"),a=[o.x,o.y,o.z],l=function(){var t=new Oo(9);return Oo!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}();"viewport"===n.properties.get("anchor")&&function(t,e){var i=Math.sin(e),r=Math.cos(e);t[0]=r,t[1]=i,t[2]=0,t[3]=-i,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1}(l,-e.transform.angle),function(t,e,i){var r=e[0],n=e[1],o=e[2];t[0]=r*i[0]+n*i[3]+o*i[6],t[1]=r*i[1]+n*i[4]+o*i[7],t[2]=r*i[2]+n*i[5]+o*i[8]}(a,a,l);const c=n.properties.get("color");return{u_matrix:t,u_lightpos:a,u_lightintensity:n.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+i,u_opacity:r}},wp=(t,e,i,r,n,o,a)=>f(bp(t,e,i,r),xp(o,e,a),{u_height_factor:-Math.pow(2,n.overscaledZ)/a.tileSize/8}),Cp=t=>({u_matrix:t}),Sp=(t,e,i,r)=>f(Cp(t),xp(i,e,r)),Mp=(t,e)=>({u_matrix:t,u_world:e}),Tp=(t,e,i,r,n)=>f(Sp(t,e,i,r),{u_world:n}),Ep=(t,e,i,r)=>{const n=t.transform;let o,a;if("map"===r.paint.get("circle-pitch-alignment")){const t=Sh(i,1,n.zoom);o=!0,a=[t,t]}else o=!1,a=n.pixelsToGLUnits;return{u_camera_to_center_distance:n.cameraToCenterDistance,u_scale_with_map:+("map"===r.paint.get("circle-pitch-scale")),u_matrix:t.translatePosMatrix(e.posMatrix,i,r.paint.get("circle-translate"),r.paint.get("circle-translate-anchor")),u_pitch_with_map:+o,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:a}},Ap=(t,e,i)=>{const r=Sh(i,1,e.zoom),n=Math.pow(2,e.zoom-i.tileID.overscaledZ),o=i.tileID.overscaleFactor();return{u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:r,u_extrude_scale:[e.pixelsToGLUnits[0]/(r*n),e.pixelsToGLUnits[1]/(r*n)],u_overscale_factor:o}},Lp=(t,e,i=1)=>({u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:i}),Ip=t=>({u_matrix:t}),Pp=(t,e,i,r)=>({u_matrix:t,u_extrude_scale:Sh(e,1,i),u_intensity:r});function Op(t,e){const i=Math.pow(2,e.canonical.z),r=e.canonical.y;return[new xh(0,r/i).toLngLat().lat,new xh(0,(r+1)/i).toLngLat().lat]}const kp=(t,e,i,r)=>{const n=t.transform;return{u_matrix:jp(t,e,i,r),u_ratio:1/Sh(e,1,n.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},Fp=(t,e,i,r,n)=>f(kp(t,e,i,n),{u_image:0,u_image_height:r}),Dp=(t,e,i,r,n)=>{const o=t.transform,a=Rp(e,o);return{u_matrix:jp(t,e,i,n),u_texsize:e.imageAtlasTexture.size,u_ratio:1/Sh(e,1,o.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[a,r.fromScale,r.toScale],u_fade:r.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},zp=(t,e,i,r,n,o)=>{const a=t.lineAtlas,l=Rp(e,t.transform),c="round"===i.layout.get("line-cap"),u=a.getDash(r.from,c),h=a.getDash(r.to,c),p=u.width*n.fromScale,d=h.width*n.toScale;return f(kp(t,e,i,o),{u_patternscale_a:[l/p,-u.height/2],u_patternscale_b:[l/d,-h.height/2],u_sdfgamma:a.width/(256*Math.min(p,d)*t.pixelRatio)/2,u_image:0,u_tex_y_a:u.y,u_tex_y_b:h.y,u_mix:n.t})};function Rp(t,e){return 1/Sh(t,1,e.tileZoom)}function jp(t,e,i,r){return t.translatePosMatrix(r?r.posMatrix:e.tileID.posMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Np=(t,e,i,r,n)=>{return{u_matrix:t,u_tl_parent:e,u_scale_parent:i,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.opacity*n.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:n.paint.get("raster-brightness-min"),u_brightness_high:n.paint.get("raster-brightness-max"),u_saturation_factor:(a=n.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(o=n.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:Bp(n.paint.get("raster-hue-rotate"))};var o,a};function Bp(t){t*=Math.PI/180;const e=Math.sin(t),i=Math.cos(t);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const Vp=(t,e,i,r,n,o,a,l,c,u)=>{const h=n.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:h.cameraToCenterDistance,u_pitch:h.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:h.width/h.height,u_fade_change:n.options.fadeDuration?n.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:a,u_coord_matrix:l,u_is_text:+c,u_pitch_with_map:+r,u_texsize:u,u_texture:0}},Up=(t,e,i,r,n,o,a,l,c,u,h)=>{const p=n.transform;return f(Vp(t,e,i,r,n,o,a,l,c,u),{u_gamma_scale:r?Math.cos(p._pitch)*p.cameraToCenterDistance:1,u_device_pixel_ratio:n.pixelRatio,u_is_halo:+h})},Hp=(t,e,i,r,n,o,a,l,c,u)=>f(Up(t,e,i,r,n,o,a,l,!0,c,!0),{u_texsize_icon:u,u_texture_icon:1}),qp=(t,e,i)=>({u_matrix:t,u_opacity:e,u_color:i}),Zp=(t,e,i,r,n,o)=>f(function(t,e,i,r){const n=i.imageManager.getPattern(t.from.toString()),o=i.imageManager.getPattern(t.to.toString()),{width:a,height:l}=i.imageManager.getPixelSize(),c=Math.pow(2,r.tileID.overscaledZ),u=r.tileSize*Math.pow(2,i.transform.tileZoom)/c,h=u*(r.tileID.canonical.x+r.tileID.wrap*c),p=u*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:n.tl,u_pattern_br_a:n.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[a,l],u_mix:e.t,u_pattern_size_a:n.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/Sh(r,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,p>>16],u_pixel_coord_lower:[65535&h,65535&p]}}(r,o,i,n),{u_matrix:t,u_opacity:e}),$p={fillExtrusion:(t,e)=>({u_matrix:new ea(t,e.u_matrix),u_lightpos:new Yn(t,e.u_lightpos),u_lightintensity:new Xn(t,e.u_lightintensity),u_lightcolor:new Yn(t,e.u_lightcolor),u_vertical_gradient:new Xn(t,e.u_vertical_gradient),u_opacity:new Xn(t,e.u_opacity)}),fillExtrusionPattern:(t,e)=>({u_matrix:new ea(t,e.u_matrix),u_lightpos:new Yn(t,e.u_lightpos),u_lightintensity:new Xn(t,e.u_lightintensity),u_lightcolor:new Yn(t,e.u_lightcolor),u_vertical_gradient:new Xn(t,e.u_vertical_gradient),u_height_factor:new Xn(t,e.u_height_factor),u_image:new Wn(t,e.u_image),u_texsize:new Kn(t,e.u_texsize),u_pixel_coord_upper:new Kn(t,e.u_pixel_coord_upper),u_pixel_coord_lower:new Kn(t,e.u_pixel_coord_lower),u_scale:new Yn(t,e.u_scale),u_fade:new Xn(t,e.u_fade),u_opacity:new Xn(t,e.u_opacity)}),fill:(t,e)=>({u_matrix:new ea(t,e.u_matrix)}),fillPattern:(t,e)=>({u_matrix:new ea(t,e.u_matrix),u_image:new Wn(t,e.u_image),u_texsize:new Kn(t,e.u_texsize),u_pixel_coord_upper:new Kn(t,e.u_pixel_coord_upper),u_pixel_coord_lower:new Kn(t,e.u_pixel_coord_lower),u_scale:new Yn(t,e.u_scale),u_fade:new Xn(t,e.u_fade)}),fillOutline:(t,e)=>({u_matrix:new ea(t,e.u_matrix),u_world:new Kn(t,e.u_world)}),fillOutlinePattern:(t,e)=>({u_matrix:new ea(t,e.u_matrix),u_world:new Kn(t,e.u_world),u_image:new Wn(t,e.u_image),u_texsize:new Kn(t,e.u_texsize),u_pixel_coord_upper:new Kn(t,e.u_pixel_coord_upper),u_pixel_coord_lower:new Kn(t,e.u_pixel_coord_lower),u_scale:new Yn(t,e.u_scale),u_fade:new Xn(t,e.u_fade)}),circle:(t,e)=>({u_camera_to_center_distance:new Xn(t,e.u_camera_to_center_distance),u_scale_with_map:new Wn(t,e.u_scale_with_map),u_pitch_with_map:new Wn(t,e.u_pitch_with_map),u_extrude_scale:new Kn(t,e.u_extrude_scale),u_device_pixel_ratio:new Xn(t,e.u_device_pixel_ratio),u_matrix:new ea(t,e.u_matrix)}),collisionBox:(t,e)=>({u_matrix:new ea(t,e.u_matrix),u_camera_to_center_distance:new Xn(t,e.u_camera_to_center_distance),u_pixels_to_tile_units:new Xn(t,e.u_pixels_to_tile_units),u_extrude_scale:new Kn(t,e.u_extrude_scale),u_overscale_factor:new Xn(t,e.u_overscale_factor)}),collisionCircle:(t,e)=>({u_matrix:new ea(t,e.u_matrix),u_inv_matrix:new ea(t,e.u_inv_matrix),u_camera_to_center_distance:new Xn(t,e.u_camera_to_center_distance),u_viewport_size:new Kn(t,e.u_viewport_size)}),debug:(t,e)=>({u_color:new Qn(t,e.u_color),u_matrix:new ea(t,e.u_matrix),u_overlay:new Wn(t,e.u_overlay),u_overlay_scale:new Xn(t,e.u_overlay_scale)}),clippingMask:(t,e)=>({u_matrix:new ea(t,e.u_matrix)}),heatmap:(t,e)=>({u_extrude_scale:new Xn(t,e.u_extrude_scale),u_intensity:new Xn(t,e.u_intensity),u_matrix:new ea(t,e.u_matrix)}),heatmapTexture:(t,e)=>({u_matrix:new ea(t,e.u_matrix),u_world:new Kn(t,e.u_world),u_image:new Wn(t,e.u_image),u_color_ramp:new Wn(t,e.u_color_ramp),u_opacity:new Xn(t,e.u_opacity)}),hillshade:(t,e)=>({u_matrix:new ea(t,e.u_matrix),u_image:new Wn(t,e.u_image),u_latrange:new Kn(t,e.u_latrange),u_light:new Kn(t,e.u_light),u_shadow:new Qn(t,e.u_shadow),u_highlight:new Qn(t,e.u_highlight),u_accent:new Qn(t,e.u_accent)}),hillshadePrepare:(t,e)=>({u_matrix:new ea(t,e.u_matrix),u_image:new Wn(t,e.u_image),u_dimension:new Kn(t,e.u_dimension),u_zoom:new Xn(t,e.u_zoom),u_unpack:new Jn(t,e.u_unpack)}),line:(t,e)=>({u_matrix:new ea(t,e.u_matrix),u_ratio:new Xn(t,e.u_ratio),u_device_pixel_ratio:new Xn(t,e.u_device_pixel_ratio),u_units_to_pixels:new Kn(t,e.u_units_to_pixels)}),lineGradient:(t,e)=>({u_matrix:new ea(t,e.u_matrix),u_ratio:new Xn(t,e.u_ratio),u_device_pixel_ratio:new Xn(t,e.u_device_pixel_ratio),u_units_to_pixels:new Kn(t,e.u_units_to_pixels),u_image:new Wn(t,e.u_image),u_image_height:new Xn(t,e.u_image_height)}),linePattern:(t,e)=>({u_matrix:new ea(t,e.u_matrix),u_texsize:new Kn(t,e.u_texsize),u_ratio:new Xn(t,e.u_ratio),u_device_pixel_ratio:new Xn(t,e.u_device_pixel_ratio),u_image:new Wn(t,e.u_image),u_units_to_pixels:new Kn(t,e.u_units_to_pixels),u_scale:new Yn(t,e.u_scale),u_fade:new Xn(t,e.u_fade)}),lineSDF:(t,e)=>({u_matrix:new ea(t,e.u_matrix),u_ratio:new Xn(t,e.u_ratio),u_device_pixel_ratio:new Xn(t,e.u_device_pixel_ratio),u_units_to_pixels:new Kn(t,e.u_units_to_pixels),u_patternscale_a:new Kn(t,e.u_patternscale_a),u_patternscale_b:new Kn(t,e.u_patternscale_b),u_sdfgamma:new Xn(t,e.u_sdfgamma),u_image:new Wn(t,e.u_image),u_tex_y_a:new Xn(t,e.u_tex_y_a),u_tex_y_b:new Xn(t,e.u_tex_y_b),u_mix:new Xn(t,e.u_mix)}),raster:(t,e)=>({u_matrix:new ea(t,e.u_matrix),u_tl_parent:new Kn(t,e.u_tl_parent),u_scale_parent:new Xn(t,e.u_scale_parent),u_buffer_scale:new Xn(t,e.u_buffer_scale),u_fade_t:new Xn(t,e.u_fade_t),u_opacity:new Xn(t,e.u_opacity),u_image0:new Wn(t,e.u_image0),u_image1:new Wn(t,e.u_image1),u_brightness_low:new Xn(t,e.u_brightness_low),u_brightness_high:new Xn(t,e.u_brightness_high),u_saturation_factor:new Xn(t,e.u_saturation_factor),u_contrast_factor:new Xn(t,e.u_contrast_factor),u_spin_weights:new Yn(t,e.u_spin_weights)}),symbolIcon:(t,e)=>({u_is_size_zoom_constant:new Wn(t,e.u_is_size_zoom_constant),u_is_size_feature_constant:new Wn(t,e.u_is_size_feature_constant),u_size_t:new Xn(t,e.u_size_t),u_size:new Xn(t,e.u_size),u_camera_to_center_distance:new Xn(t,e.u_camera_to_center_distance),u_pitch:new Xn(t,e.u_pitch),u_rotate_symbol:new Wn(t,e.u_rotate_symbol),u_aspect_ratio:new Xn(t,e.u_aspect_ratio),u_fade_change:new Xn(t,e.u_fade_change),u_matrix:new ea(t,e.u_matrix),u_label_plane_matrix:new ea(t,e.u_label_plane_matrix),u_coord_matrix:new ea(t,e.u_coord_matrix),u_is_text:new Wn(t,e.u_is_text),u_pitch_with_map:new Wn(t,e.u_pitch_with_map),u_texsize:new Kn(t,e.u_texsize),u_texture:new Wn(t,e.u_texture)}),symbolSDF:(t,e)=>({u_is_size_zoom_constant:new Wn(t,e.u_is_size_zoom_constant),u_is_size_feature_constant:new Wn(t,e.u_is_size_feature_constant),u_size_t:new Xn(t,e.u_size_t),u_size:new Xn(t,e.u_size),u_camera_to_center_distance:new Xn(t,e.u_camera_to_center_distance),u_pitch:new Xn(t,e.u_pitch),u_rotate_symbol:new Wn(t,e.u_rotate_symbol),u_aspect_ratio:new Xn(t,e.u_aspect_ratio),u_fade_change:new Xn(t,e.u_fade_change),u_matrix:new ea(t,e.u_matrix),u_label_plane_matrix:new ea(t,e.u_label_plane_matrix),u_coord_matrix:new ea(t,e.u_coord_matrix),u_is_text:new Wn(t,e.u_is_text),u_pitch_with_map:new Wn(t,e.u_pitch_with_map),u_texsize:new Kn(t,e.u_texsize),u_texture:new Wn(t,e.u_texture),u_gamma_scale:new Xn(t,e.u_gamma_scale),u_device_pixel_ratio:new Xn(t,e.u_device_pixel_ratio),u_is_halo:new Wn(t,e.u_is_halo)}),symbolTextAndIcon:(t,e)=>({u_is_size_zoom_constant:new Wn(t,e.u_is_size_zoom_constant),u_is_size_feature_constant:new Wn(t,e.u_is_size_feature_constant),u_size_t:new Xn(t,e.u_size_t),u_size:new Xn(t,e.u_size),u_camera_to_center_distance:new Xn(t,e.u_camera_to_center_distance),u_pitch:new Xn(t,e.u_pitch),u_rotate_symbol:new Wn(t,e.u_rotate_symbol),u_aspect_ratio:new Xn(t,e.u_aspect_ratio),u_fade_change:new Xn(t,e.u_fade_change),u_matrix:new ea(t,e.u_matrix),u_label_plane_matrix:new ea(t,e.u_label_plane_matrix),u_coord_matrix:new ea(t,e.u_coord_matrix),u_is_text:new Wn(t,e.u_is_text),u_pitch_with_map:new Wn(t,e.u_pitch_with_map),u_texsize:new Kn(t,e.u_texsize),u_texsize_icon:new Kn(t,e.u_texsize_icon),u_texture:new Wn(t,e.u_texture),u_texture_icon:new Wn(t,e.u_texture_icon),u_gamma_scale:new Xn(t,e.u_gamma_scale),u_device_pixel_ratio:new Xn(t,e.u_device_pixel_ratio),u_is_halo:new Wn(t,e.u_is_halo)}),background:(t,e)=>({u_matrix:new ea(t,e.u_matrix),u_opacity:new Xn(t,e.u_opacity),u_color:new Qn(t,e.u_color)}),backgroundPattern:(t,e)=>({u_matrix:new ea(t,e.u_matrix),u_opacity:new Xn(t,e.u_opacity),u_image:new Wn(t,e.u_image),u_pattern_tl_a:new Kn(t,e.u_pattern_tl_a),u_pattern_br_a:new Kn(t,e.u_pattern_br_a),u_pattern_tl_b:new Kn(t,e.u_pattern_tl_b),u_pattern_br_b:new Kn(t,e.u_pattern_br_b),u_texsize:new Kn(t,e.u_texsize),u_mix:new Xn(t,e.u_mix),u_pattern_size_a:new Kn(t,e.u_pattern_size_a),u_pattern_size_b:new Kn(t,e.u_pattern_size_b),u_scale_a:new Xn(t,e.u_scale_a),u_scale_b:new Xn(t,e.u_scale_b),u_pixel_coord_upper:new Kn(t,e.u_pixel_coord_upper),u_pixel_coord_lower:new Kn(t,e.u_pixel_coord_lower),u_tile_units_to_pixels:new Xn(t,e.u_tile_units_to_pixels)}),terrain:(t,e)=>({u_matrix:new ea(t,e.u_matrix),u_texture:new Wn(t,e.u_texture),u_ele_delta:new Xn(t,e.u_ele_delta)}),terrainDepth:(t,e)=>({u_matrix:new ea(t,e.u_matrix),u_ele_delta:new Xn(t,e.u_ele_delta)}),terrainCoords:(t,e)=>({u_matrix:new ea(t,e.u_matrix),u_texture:new Wn(t,e.u_texture),u_terrain_coords_id:new Xn(t,e.u_terrain_coords_id),u_ele_delta:new Xn(t,e.u_ele_delta)})};class Gp{constructor(t,e,i){this.context=t;const r=t.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const e=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Xp={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Wp{constructor(t,e,i,r){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=r,this.context=t;const n=t.gl;this.buffer=n.createBuffer(),t.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let i=0;i0){const e=ko(),i=_;Vo(e,y.placementInvProjMatrix,t.transform.glCoordMatrix),Vo(e,e,y.placementViewportMatrix),h.push({circleArray:x,circleOffset:d,transform:i,invTransform:e,coord:m}),p+=x.length/4,d=p}v&&u.draw(l,c.LINES,Rd.disabled,Od.disabled,t.colorModeForRenderPass(),Vd.disabled,Ap(_,t.transform,g),t.style.map.terrain&&t.style.map.terrain.getTerrainData(m),i.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,null,t.transform.zoom,null,null,v.collisionVertexBuffer)}if(!a||!h.length)return;const f=t.useProgram("collisionCircle"),m=new In;m.resize(4*p),m._trim();let g=0;for(const t of h)for(let e=0;e=0&&(g[y.associatedIconIndex]={shiftedAnchor:T,angle:E})}else dh(y.numGlyphs,f)}if(h){m.clear();const e=t.icon.placedSymbolArray;for(let t=0;tt.style.map.terrain.getElevation(l,e,i):null,r="map"===i.layout.get("text-rotation-alignment");$u(c,l.posMatrix,t,n,j,N,y,u,r,e)}const U=t.translatePosMatrix(l.posMatrix,r,o,a),H=_||n&&C||V?Hd:j,G=t.translatePosMatrix(N,r,o,a,!0),q=d&&0!==i.paint.get(n?"text-halo-width":"icon-halo-width").constantOr(1);let Z;Z=d?c.iconsInText?Hp(w.kind,E,v,y,t,U,H,G,I,F):Up(w.kind,E,v,y,t,U,H,G,n,I,!0):Vp(w.kind,E,v,y,t,U,H,G,n,I);const $={program:T,buffers:h,uniformValues:Z,atlasTexture:P,atlasTextureIcon:D,atlasInterpolation:O,atlasInterpolationIcon:k,isSDF:d,hasHalo:q};if(x&&c.canOverlap){b=!0;const t=h.segments.get();for(const e of t)S.push({segments:new Dn([e]),sortKey:e.sortKey,state:$,terrainData:A})}else S.push({segments:h.segments,sortKey:0,state:$,terrainData:A})}b&&S.sort(((t,e)=>t.sortKey-e.sortKey));for(const e of S){const r=e.state;if(d.activeTexture.set(f.TEXTURE0),r.atlasTexture.bind(r.atlasInterpolation,f.CLAMP_TO_EDGE),r.atlasTextureIcon&&(d.activeTexture.set(f.TEXTURE1),r.atlasTextureIcon&&r.atlasTextureIcon.bind(r.atlasInterpolationIcon,f.CLAMP_TO_EDGE)),r.isSDF){const n=r.uniformValues;r.hasHalo&&(n.u_is_halo=1,Wd(r.buffers,e.segments,i,t,r.program,w,h,p,n,e.terrainData)),n.u_is_halo=0}Wd(r.buffers,e.segments,i,t,r.program,w,h,p,r.uniformValues,e.terrainData)}}function Wd(t,e,i,r,n,o,a,l,c,u){const h=r.context;n.draw(h,h.gl.TRIANGLES,o,a,l,Vd.disabled,c,u,i.id,t.layoutVertexBuffer,t.indexBuffer,e,i.paint,r.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function Xd(t,e,i,r,n){if(!i||!r||!r.imageAtlas)return;const o=r.imageAtlas.patternPositions;let a=o[i.to.toString()],l=o[i.from.toString()];if(!a||!l){const t=n.getPaintProperty(e);a=o[t],l=o[t]}a&&l&&t.setConstantPatternPositions(a,l)}function Yd(t,e,i,r,n,o,a){const l=t.context.gl,c="fill-pattern",u=i.paint.get(c),h=u&&u.constantOr(1),p=i.getCrossfadeParameters();let d,f,m,g,y;a?(f=h&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",d=l.LINES):(f=h?"fillPattern":"fill",d=l.TRIANGLES);const _=u.constantOr(null);for(const u of r){const r=e.getTile(u);if(h&&!r.patternsLoaded())continue;const v=r.getBucket(i);if(!v)continue;const x=v.programConfigurations.get(i.id),b=t.useProgram(f,x),w=t.style.map.terrain&&t.style.map.terrain.getTerrainData(u);h&&(t.context.activeTexture.set(l.TEXTURE0),r.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),x.updatePaintBuffers(p)),Xd(x,c,_,r,i);const C=w?u:null,S=t.translatePosMatrix(C?C.posMatrix:u.posMatrix,r,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor"));if(a){g=v.indexBuffer2,y=v.segments2;const e=[l.drawingBufferWidth,l.drawingBufferHeight];m="fillOutlinePattern"===f&&h?Tp(S,t,p,r,e):Mp(S,e)}else g=v.indexBuffer,y=v.segments,m=h?Sp(S,t,p,r):Cp(S);b.draw(t.context,d,n,t.stencilModeForClipping(u),o,Vd.disabled,m,w,i.id,v.layoutVertexBuffer,g,y,i.paint,t.transform.zoom,x)}}function Kd(t,e,i,r,n,o,a){const l=t.context,c=l.gl,u="fill-extrusion-pattern",h=i.paint.get(u),p=h.constantOr(1),d=i.getCrossfadeParameters(),f=i.paint.get("fill-extrusion-opacity"),m=h.constantOr(null);for(const h of r){const r=e.getTile(h),g=r.getBucket(i);if(!g)continue;const y=t.style.map.terrain&&t.style.map.terrain.getTerrainData(h),_=g.programConfigurations.get(i.id),v=t.useProgram(p?"fillExtrusionPattern":"fillExtrusion",_);p&&(t.context.activeTexture.set(c.TEXTURE0),r.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),_.updatePaintBuffers(d)),Xd(_,u,m,r,i);const x=t.translatePosMatrix(h.posMatrix,r,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),b=i.paint.get("fill-extrusion-vertical-gradient"),w=p?wp(x,t,b,f,h,d,r):bp(x,t,b,f);v.draw(l,l.gl.TRIANGLES,n,o,a,Vd.backCCW,w,y,i.id,g.layoutVertexBuffer,g.indexBuffer,g.segments,i.paint,t.transform.zoom,_,t.style.map.terrain&&g.centroidVertexBuffer)}}function Jd(t,e,i,r,n,o,a){const l=t.context,c=l.gl,u=i.fbo;if(!u)return;const h=t.useProgram("hillshade"),p=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e);l.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,u.colorAttachment.get()),h.draw(l,c.TRIANGLES,n,o,a,Vd.disabled,((t,e,i,r)=>{const n=i.paint.get("hillshade-shadow-color"),o=i.paint.get("hillshade-highlight-color"),a=i.paint.get("hillshade-accent-color");let l=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===i.paint.get("hillshade-illumination-anchor")&&(l-=t.transform.angle);const c=!t.options.moving;return{u_matrix:r?r.posMatrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped(),c),u_image:0,u_latrange:Op(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),l],u_shadow:n,u_highlight:o,u_accent:a}})(t,i,r,p?e:null),p,r.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}function Qd(t,e,i,r,n,o){const a=t.context,l=a.gl,c=e.dem;if(c&&c.data){const u=c.dim,h=c.stride,p=c.getPixels();if(a.activeTexture.set(l.TEXTURE1),a.pixelStoreUnpackPremultiplyAlpha.set(!1),e.demTexture=e.demTexture||t.getTileTexture(h),e.demTexture){const t=e.demTexture;t.update(p,{premultiply:!1}),t.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else e.demTexture=new Kc(a,p,l.RGBA,{premultiply:!1}),e.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);a.activeTexture.set(l.TEXTURE0);let d=e.fbo;if(!d){const t=new Kc(a,{width:u,height:u,data:null},l.RGBA);t.bind(l.LINEAR,l.CLAMP_TO_EDGE),d=e.fbo=a.createFramebuffer(u,u,!0,!1),d.colorAttachment.set(t.texture)}a.bindFramebuffer.set(d.framebuffer),a.viewport.set([0,0,u,u]),t.useProgram("hillshadePrepare").draw(a,l.TRIANGLES,r,n,o,Vd.disabled,((t,e)=>{const i=e.stride,r=ko();return Bo(r,0,oo,-oo,0,0,1),Ro(r,r,[0,-oo,0]),{u_matrix:r,u_image:1,u_dimension:[i,i],u_zoom:t.overscaledZ,u_unpack:e.getUnpackVector()}})(e.tileID,c),null,i.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),e.needsHillshadePrepare=!1}}function tf(t,e,i,r,n,o){const a=r.paint.get("raster-fade-duration");if(!o&&a>0){const r=D.now(),o=(r-t.timeAdded)/a,l=e?(r-e.timeAdded)/a:-1,c=i.getSource(),u=n.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),p=!e||Math.abs(e.tileID.overscaledZ-u)>Math.abs(t.tileID.overscaledZ-u),d=p&&t.refreshedUponExpiration?1:h(p?o:1-l,0,1);return t.refreshedUponExpiration&&o>=1&&(t.refreshedUponExpiration=!1),e?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}const ef=new oe(1,0,0,1),hf=new oe(0,1,0,1),pf=new oe(0,0,1,1),mf=new oe(1,0,1,1),vf=new oe(0,1,1,1);function xf(t,e,i,r){wf(t,0,e+i/2,t.transform.width,i,r)}function bf(t,e,i,r){wf(t,e-i/2,0,i,t.transform.height,r)}function wf(t,e,i,r,n,o){const a=t.context,l=a.gl;l.enable(l.SCISSOR_TEST),l.scissor(e*t.pixelRatio,i*t.pixelRatio,r*t.pixelRatio,n*t.pixelRatio),a.clear({color:o}),l.disable(l.SCISSOR_TEST)}function Sf(t,e,i){const r=t.context,n=r.gl,o=i.posMatrix,a=t.useProgram("debug"),l=Rd.disabled,c=Od.disabled,u=t.colorModeForRenderPass(),h="$debug",p=t.style.map.terrain&&t.style.map.terrain.getTerrainData(i);r.activeTexture.set(n.TEXTURE0);const d=e.getTileByID(i.key).latestRawTileData,f=Math.floor((d&&d.byteLength||0)/1024),m=e.getTile(i).tileSize,g=512/Math.min(m,512)*(i.overscaledZ/t.transform.zoom)*.5;let y=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(y+=` => ${i.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const i=t.debugOverlayCanvas,r=t.context.gl,n=t.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(e,5,5),n.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(t,`${y} ${f}kB`),a.draw(r,n.TRIANGLES,l,c,Ld.alphaBlended,Vd.disabled,Lp(o,oe.transparent,g),null,h,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),a.draw(r,n.LINE_STRIP,l,c,u,Vd.disabled,Lp(o,oe.red),p,h,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}function Tf(t,e,i){const r=t.context,n=r.gl,o=t.colorModeForRenderPass(),a=new Rd(n.LEQUAL,Rd.ReadWrite,t.depthRangeFor3D),l=t.useProgram("terrain"),c=e.getTerrainMesh();r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height]);for(const u of i){const i=t.renderToTexture.getTexture(u),h=e.getTerrainData(u.tileID);r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,i.texture);const p={u_matrix:t.transform.calculatePosMatrix(u.tileID.toUnwrapped()),u_texture:0,u_ele_delta:e.getMeshFrameDelta(t.transform.zoom)};l.draw(r,n.TRIANGLES,a,Od.disabled,o,Vd.backCCW,p,h,"terrain",c.vertexBuffer,c.indexBuffer,c.segments)}}const Ef={symbol:function(t,e,i,r,n){if("translucent"!==t.renderPass)return;const o=Od.disabled,a=t.colorModeForRenderPass();i.layout.get("text-variable-anchor")&&function(t,e,i,r,n,o,a){const l=e.transform,c="map"===n,u="map"===o;for(const n of t){const t=r.getTile(n),o=t.getBucket(i);if(!o||!o.text||!o.text.segments.get().length)continue;const h=Ec(o.textSizeData,l.zoom),p=Sh(t,1,e.transform.zoom),d=Vu(n.posMatrix,u,c,e.transform,p),f="none"!==i.layout.get("icon-text-fit")&&o.hasIconData();if(h){const i=Math.pow(2,l.zoom-t.tileID.overscaledZ);qd(o,c,u,a,l,d,n.posMatrix,i,h,f,e.style.map.terrain?(t,i)=>e.style.map.terrain.getElevation(n,t,i):null)}}}(r,t,i,e,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),n),0!==i.paint.get("icon-opacity").constantOr(1)&&$d(t,e,i,r,!1,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright"),o,a),0!==i.paint.get("text-opacity").constantOr(1)&&$d(t,e,i,r,!0,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.layout.get("text-keep-upright"),o,a),e.map.showCollisionBoxes&&(Ud(t,e,i,r,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),!0),Ud(t,e,i,r,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),!1))},circle:function(t,e,i,r){if("translucent"!==t.renderPass)return;const n=i.paint.get("circle-opacity"),o=i.paint.get("circle-stroke-width"),a=i.paint.get("circle-stroke-opacity"),l=!i.layout.get("circle-sort-key").isConstant();if(0===n.constantOr(1)&&(0===o.constantOr(1)||0===a.constantOr(1)))return;const c=t.context,u=c.gl,h=t.depthModeForSublayer(0,Rd.ReadOnly),p=Od.disabled,d=t.colorModeForRenderPass(),f=[];for(let n=0;nt.sortKey-e.sortKey));for(const e of f){const{programConfiguration:r,program:n,layoutVertexBuffer:o,indexBuffer:a,uniformValues:l,terrainData:f}=e.state;n.draw(c,u.TRIANGLES,h,p,d,Vd.disabled,l,f,i.id,o,a,e.segments,i.paint,t.transform.zoom,r)}},heatmap:function(t,e,i,r){if(0!==i.paint.get("heatmap-opacity"))if("offscreen"===t.renderPass){const n=t.context,o=n.gl,a=Od.disabled,l=new Ld([o.ONE,o.ONE],oe.transparent,[!0,!0,!0,!0]);!function(t,e,i){const r=t.gl;t.activeTexture.set(r.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);let n=i.heatmapFbo;if(n)r.bindTexture(r.TEXTURE_2D,n.colorAttachment.get()),t.bindFramebuffer.set(n.framebuffer);else{const o=r.createTexture();r.bindTexture(r.TEXTURE_2D,o),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),n=i.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1,!1),function(t,e,i,r){var n,o;const a=t.gl,l=null!==(n=t.HALF_FLOAT)&&void 0!==n?n:a.UNSIGNED_BYTE,c=null!==(o=t.RGBA16F)&&void 0!==o?o:a.RGBA;a.texImage2D(a.TEXTURE_2D,0,c,e.width/4,e.height/4,0,a.RGBA,l,null),r.colorAttachment.set(i)}(t,e,o,n)}}(n,t,i),n.clear({color:oe.transparent});for(let c=0;c{const n=ko();Bo(n,0,t.width,t.height,0,0,1);const o=t.context.gl;return{u_matrix:n,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:e.paint.get("heatmap-opacity")}})(t,e),null,e.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,e.paint,t.transform.zoom)}(t,i))},line:function(t,e,i,r){if("translucent"!==t.renderPass)return;const n=i.paint.get("line-opacity"),o=i.paint.get("line-width");if(0===n.constantOr(1)||0===o.constantOr(1))return;const a=t.depthModeForSublayer(0,Rd.ReadOnly),l=t.colorModeForRenderPass(),c=i.paint.get("line-dasharray"),u=i.paint.get("line-pattern"),p=u.constantOr(1),d=i.paint.get("line-gradient"),f=i.getCrossfadeParameters(),m=p?"linePattern":c?"lineSDF":d?"lineGradient":"line",g=t.context,y=g.gl;let _=!0;for(const n of r){const r=e.getTile(n);if(p&&!r.patternsLoaded())continue;const o=r.getBucket(i);if(!o)continue;const x=o.programConfigurations.get(i.id),b=t.context.program.get(),w=t.useProgram(m,x),C=_||w.program!==b,S=t.style.map.terrain&&t.style.map.terrain.getTerrainData(n),M=u.constantOr(null);if(M&&r.imageAtlas){const t=r.imageAtlas,e=t.patternPositions[M.to.toString()],i=t.patternPositions[M.from.toString()];e&&i&&x.setConstantPatternPositions(e,i)}const T=S?n:null,E=p?Dp(t,r,i,f,T):c?zp(t,r,i,c,f,T):d?Fp(t,r,i,o.lineClipsArray.length,T):kp(t,r,i,T);if(p)g.activeTexture.set(y.TEXTURE0),r.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),x.updatePaintBuffers(f);else if(c&&(C||t.lineAtlas.dirty))g.activeTexture.set(y.TEXTURE0),t.lineAtlas.bind(g);else if(d){const r=o.gradients[i.id];let a=r.texture;if(i.gradientVersion!==r.version){let l=256;if(i.stepInterpolant){const i=e.getSource().maxzoom,r=n.canonical.z===i?Math.ceil(1<256&&this.clearStencil(),i.setColorMode(Ld.disabled),i.setDepthMode(Rd.disabled);const n=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const t of e){const e=this._tileClippingMaskIDs[t.key]=this.nextStencilID++,o=this.style.map.terrain&&this.style.map.terrain.getTerrainData(t);n.draw(i,r.TRIANGLES,Rd.disabled,new Od({func:r.ALWAYS,mask:0},e,255,r.KEEP,r.KEEP,r.REPLACE),Ld.disabled,Vd.disabled,Ip(t.posMatrix),o,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,e=this.context.gl;return new Od({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new Od({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}stencilConfigForOverlap(t){const e=this.context.gl,i=t.sort(((t,e)=>e.overscaledZ-t.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 t={};for(let i=0;i=0;this.currentLayer--){const t=this.style._layers[i[this.currentLayer]],e=r[t.source],o=n[t.source];this._renderTileClippingMasks(t,o),this.renderLayer(this,e,t,o)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayeri.source&&!i.isHidden(e)?[t.sourceCaches[i.source]]:[])),n=r.filter((t=>"vector"===t.getSource().type)),o=r.filter((t=>"vector"!==t.getSource().type)),a=t=>{(!i||i.getSource().maxzooma(t))),i||o.forEach((t=>a(t))),i}(this.style,this.transform.zoom);t&&Ef.debug(this,t,t.getVisibleCoordinates())}this.options.showPadding&&function(t){const e=t.transform.padding;xf(t,t.transform.height-(e.top||0),3,ef),xf(t,e.bottom||0,3,hf),bf(t,e.left||0,3,pf),bf(t,t.transform.width-(e.right||0),3,mf);const i=t.transform.centerPoint;!function(t,e,i,r){wf(t,e-1,i-10,2,20,r),wf(t,e-10,i-1,20,2,r)}(t,i.x,t.transform.height-i.y,vf)}(this),this.context.setDefault()}renderLayer(t,e,i,r){i.isHidden(this.transform.zoom)||("background"===i.type||"custom"===i.type||(r||[]).length)&&(this.id=i.id,Ef[i.type](t,e,i,r,this.style.placement.variableOffsets))}translatePosMatrix(t,e,i,r,n){if(!i[0]&&!i[1])return t;const o=n?"map"===r?this.transform.angle:0:"viewport"===r?-this.transform.angle:0;if(o){const t=Math.sin(o),e=Math.cos(o);i=[i[0]*e-i[1]*t,i[0]*t+i[1]*e]}const a=[n?i[0]:Sh(e,i[0],this.transform.zoom),n?i[1]:Sh(e,i[1],this.transform.zoom),0],l=new Float32Array(16);return Ro(l,t,a),l}saveTileTexture(t){const e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const e=this._tileTextures[t];return e&&e.length>0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return!e||!i}useProgram(t,e){this.cache=this.cache||{};const i=t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[i]||(this.cache[i]=new yp(this.context,t,mp[t],e,$p[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[i]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Kc(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class pm{constructor(t,e){this.points=t,this.planes=e}static fromInvProjectionMatrix(t,e,i){const r=Math.pow(2,i),n=[[-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 n=1/(i=qo([],i,t))[3]/e*r;return function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],t}(i,i,[n,n,1/i[3],n])})),o=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((t=>{const e=function(t,e){var i=e[0],r=e[1],n=e[2],o=i*i+r*r+n*n;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}([],function(t,e,i){var r=e[0],n=e[1],o=e[2],a=i[0],l=i[1],c=i[2];return t[0]=n*c-o*l,t[1]=o*a-r*c,t[2]=r*l-n*a,t}([],Go([],n[t[0]],n[t[1]]),Go([],n[t[2]],n[t[1]]))),i=-((r=e)[0]*(o=n[t[1]])[0]+r[1]*o[1]+r[2]*o[2]);var r,o;return e.concat(i)}));return new pm(n,o)}}class dm{constructor(t,e){this.min=t,this.max=e,this.center=function(t,e,i){return t[0]=.5*e[0],t[1]=.5*e[1],t[2]=.5*e[2],t}([],function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}([],this.min,this.max))}quadrant(t){const e=[t%2==0,t<2],i=Uo(this.min),r=Uo(this.max);for(let t=0;t=0&&l++;if(0===l)return 0;l!==e.length&&(i=!1)}var r,n;if(i)return 2;for(let e=0;e<3;e++){let i=Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let n=0;nthis.max[e]-this.min[e])return 0}return 1}}class mm{constructor(t=0,e=0,i=0,r=0){if(isNaN(t)||t<0||isNaN(e)||e<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=t,this.bottom=e,this.left=i,this.right=r}interpolate(t,e,i){return null!=e.top&&null!=t.top&&(this.top=ii.number(t.top,e.top,i)),null!=e.bottom&&null!=t.bottom&&(this.bottom=ii.number(t.bottom,e.bottom,i)),null!=e.left&&null!=t.left&&(this.left=ii.number(t.left,e.left,i)),null!=e.right&&null!=t.right&&(this.right=ii.number(t.right,e.right,i)),this}getCenter(t,e){const i=h((this.left+t-this.right)/2,0,t),r=h((this.top+e-this.bottom)/2,0,e);return new n(i,r)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new mm(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class fm{constructor(t,e,i,r,n){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=void 0===n||!!n,this._minZoom=t||0,this._maxZoom=e||22,this._minPitch=null==i?0:i,this._maxPitch=null==r?60:r,this.setMaxBounds(),this.width=0,this.height=0,this._center=new uh(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new mm,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new fm(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new n(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const e=-p(t,-180,180)*Math.PI/180;this.angle!==e&&(this._unmodified=!1,this.angle=e,this._calcMatrices(),this.rotationMatrix=function(){var t=new Oo(4);return Oo!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}(),function(t,e,i){var r=e[0],n=e[1],o=e[2],a=e[3],l=Math.sin(i),c=Math.cos(i);t[0]=r*c+o*l,t[1]=n*c+a*l,t[2]=r*-l+o*c,t[3]=n*-l+a*c}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const e=h(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==e&&(this._unmodified=!1,this._pitch=e,this._calcMatrices())}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=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.tileZoom=Math.max(0,Math.floor(e)),this.scale=this.zoomScale(e),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)}getVisibleUnwrappedCoordinates(t){const e=[new Ah(0,t)];if(this._renderWorldCopies){const i=this.pointCoordinate(new n(0,0)),r=this.pointCoordinate(new n(this.width,0)),o=this.pointCoordinate(new n(this.width,this.height)),a=this.pointCoordinate(new n(0,this.height)),l=Math.floor(Math.min(i.x,r.x,o.x,a.x)),c=Math.floor(Math.max(i.x,r.x,o.x,a.x)),u=1;for(let i=l-u;i<=c+u;i++)0!==i&&e.push(new Ah(i,t))}return e}coveringTiles(t){var e,i;let r=this.coveringZoomLevel(t);const n=r;if(void 0!==t.minzoom&&rt.maxzoom&&(r=t.maxzoom);const o=this.pointCoordinate(this.getCameraPoint()),a=xh.fromLngLat(this.center),l=Math.pow(2,r),c=[l*o.x,l*o.y,0],u=[l*a.x,l*a.y,0],h=pm.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r);let p=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(p=r);const d=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,f=t=>({aabb:new dm([t*l,0,0],[(t+1)*l,l,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),m=[],g=[],y=r,_=t.reparseOverscaled?n:r;if(this._renderWorldCopies)for(let t=1;t<=3;t++)m.push(f(-t)),m.push(f(t));for(m.push(f(0));m.length>0;){const r=m.pop(),n=r.x,o=r.y;let a=r.fullyVisible;if(!a){const t=r.aabb.intersects(h);if(0===t)continue;a=2===t}const l=t.terrain?c:u,f=r.aabb.distanceX(l),v=r.aabb.distanceY(l),x=Math.max(Math.abs(f),Math.abs(v));if(r.zoom===y||x>d+(1<=p){const t=y-r.zoom,e=c[0]-.5-(n<>1),h=r.zoom+1;let p=r.aabb.quadrant(l);if(t.terrain){const n=new Eh(h,r.wrap,h,c,u),o=t.terrain.getMinMaxElevation(n),a=null!==(e=o.minElevation)&&void 0!==e?e:this.elevation,l=null!==(i=o.maxElevation)&&void 0!==i?i:this.elevation;p=new dm([p.min[0],p.min[1],a],[p.max[0],p.max[1],l])}m.push({aabb:p,zoom:h,x:c,y:u,wrap:r.wrap,fullyVisible:a})}}return g.sort(((t,e)=>t.distanceSq-e.distanceSq)).map((t=>t.tileID))}resize(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const e=h(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new n(uu(t.lng)*this.worldSize,hu(e)*this.worldSize)}unproject(t){return new xh(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0)}getElevation(t,e){const i=xh.fromLngLat(t.wrap()),r=(1<a&&(r=a-e)}if(this.lngRange){const t=(l+c)/2,e=p(d.x,t-this.worldSize/2,t+this.worldSize/2),r=u.x/2;e-rc&&(i=c-r)}void 0===i&&void 0===r||(this.center=this.unproject(new n(void 0!==i?i:d.x,void 0!==r?r:d.y)).wrap()),this._unmodified=h,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,e=this.point.x,i=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=pu(1,this.center.lat)*this.worldSize;let r=Fo(new Float64Array(16));jo(r,r,[this.width/2,-this.height/2,1]),Ro(r,r,[1,-1,0]),this.labelPlaneMatrix=r,r=Fo(new Float64Array(16)),jo(r,r,[1,-1,1]),Ro(r,r,[-1,-1,0]),jo(r,r,[2/this.width,2/this.height,1]),this.glCoordMatrix=r,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const n=this._elevation<0?this.cameraToCenterDistance:this.cameraToSeaLevelDistance,o=Math.PI/2+this._pitch,a=this._fov*(.5+t.y/this.height),l=Math.sin(a)*n/Math.sin(h(Math.PI-o-a,.01,Math.PI-.01)),c=this.getHorizon(),u=2*Math.atan(c/this.cameraToCenterDistance)*(.5+t.y/(2*c)),p=Math.sin(u)*n/Math.sin(h(Math.PI-o-u,.01,Math.PI-.01)),d=Math.min(l,p),f=1.01*(Math.cos(Math.PI/2-this._pitch)*d+n),m=this.height/50;r=new Float64Array(16),function(t,e,i,r,n){var o,a=1/Math.tan(e/2);t[0]=a/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=n&&n!==1/0?(t[10]=(n+r)*(o=1/(r-n)),t[14]=2*n*r*o):(t[10]=-1,t[14]=-2*r)}(r,this._fov,this.width/this.height,m,f),r[8]=2*-t.x/this.width,r[9]=2*t.y/this.height,jo(r,r,[1,-1,1]),Ro(r,r,[0,0,-this.cameraToCenterDistance]),function(t,e,i){var r=Math.sin(i),n=Math.cos(i),o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],p=e[10],d=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*n+u*r,t[5]=a*n+h*r,t[6]=l*n+p*r,t[7]=c*n+d*r,t[8]=u*n-o*r,t[9]=h*n-a*r,t[10]=p*n-l*r,t[11]=d*n-c*r}(r,r,this._pitch),No(r,r,this.angle),Ro(r,r,[-e,-i,0]),this.mercatorMatrix=jo([],r,[this.worldSize,this.worldSize,this.worldSize]),jo(r,r,[1,1,this._pixelPerMeter]),this.pixelMatrix=zo(new Float64Array(16),this.labelPlaneMatrix,r),Ro(r,r,[0,0,-this.elevation]),this.projMatrix=r,this.invProjMatrix=Do([],r),this.pixelMatrix3D=zo(new Float64Array(16),this.labelPlaneMatrix,r);const g=this.width%2/2,y=this.height%2/2,_=Math.cos(this.angle),v=Math.sin(this.angle),x=e-Math.round(e)+_*g+v*y,b=i-Math.round(i)+_*y+v*g,w=new Float64Array(r);if(Ro(w,w,[x>.5?x-1:x,b>.5?b-1:b,0]),this.alignedProjMatrix=w,r=Do(new Float64Array(16),this.pixelMatrix),!r)throw new Error("failed to invert matrix");this.pixelMatrixInverse=r,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new n(0,0)),e=[t.x*this.worldSize,t.y*this.worldSize,0,1];return qo(e,e,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new n(0,t))}getCameraQueryGeometry(t){const e=this.getCameraPoint();if(1===t.length)return[t[0],e];{let i=e.x,r=e.y,o=e.x,a=e.y;for(const e of t)i=Math.min(i,e.x),r=Math.min(r,e.y),o=Math.max(o,e.x),a=Math.max(a,e.y);return[new n(i,r),new n(o,r),new n(o,a),new n(i,a),new n(i,r)]}}}class _m{constructor(t){this._hashName=t&&encodeURIComponent(t),_(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(t,e){let i=!1,r=null;const n=()=>{r=null,i&&(t(),r=setTimeout(n,300),i=!1)};return()=>(i=!0,r||n(),r)}(this._updateHashUnthrottled.bind(this))}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,r=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,r),o=Math.round(e.lng*n)/n,a=Math.round(e.lat*n)/n,l=this._map.getBearing(),c=this._map.getPitch();let u="";if(u+=t?`/${o}/${a}/${i}`:`${i}/${a}/${o}`,(l||c)&&(u+="/"+Math.round(10*l)/10),c&&(u+=`/${Math.round(c)}`),this._hashName){const t=this._hashName;let e=!1;const i=window.location.hash.slice(1).split("&").map((i=>{const r=i.split("=")[0];return r===t?(e=!0,`${r}=${u}`):i})).filter((t=>t));return e||i.push(`${t}=${u}`),`#${i.join("&")}`}return`#${u}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map((t=>t.split("="))).forEach((t=>{t[0]===this._hashName&&(e=t)})),(e&&e[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some((t=>isNaN(t)))){const e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch(t){}}}const Af={linearity:.3,easing:c(0,0,.3,1)},Lf=f({deceleration:2500,maxSpeed:1400},Af),If=f({deceleration:20,maxSpeed:1400},Af),Of=f({deceleration:1e3,maxSpeed:360},Af),kf=f({deceleration:1e3,maxSpeed:90},Af);class wm{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:D.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,e=D.now();for(;t.length>0&&e-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const e={zoom:0,bearing:0,pitch:0,pan:new n(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)e.zoom+=t.zoomDelta||0,e.bearing+=t.bearingDelta||0,e.pitch+=t.pitchDelta||0,t.panDelta&&e.pan._add(t.panDelta),t.around&&(e.around=t.around),t.pinchAround&&(e.pinchAround=t.pinchAround);const i=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,r={};if(e.pan.mag()){const n=Rf(e.pan.mag(),i,f({},Lf,t||{}));r.offset=e.pan.mult(n.amount/e.pan.mag()),r.center=this._map.transform.center,Df(r,n)}if(e.zoom){const t=Rf(e.zoom,i,If);r.zoom=this._map.transform.zoom+t.amount,Df(r,t)}if(e.bearing){const t=Rf(e.bearing,i,Of);r.bearing=this._map.transform.bearing+h(t.amount,-179,179),Df(r,t)}if(e.pitch){const t=Rf(e.pitch,i,kf);r.pitch=this._map.transform.pitch+t.amount,Df(r,t)}if(r.zoom||r.bearing){const t=void 0===e.pinchAround?e.around:e.pinchAround;r.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),f(r,{noMoveStart:!0})}}function Df(t,e){(!t.duration||t.duratione.unproject(t))),l=o.reduce(((t,e,i,r)=>t.add(e.div(r.length))),new n(0,0));super(t,{points:o,point:l,lngLats:a,lngLat:e.unproject(l),originalEvent:i}),this._defaultPrevented=!1}}class Em extends rt{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,i){super(t,{originalEvent:i}),this._defaultPrevented=!1}}class zm{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Em(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new Im(t.type,this._map,t))}mouseup(t){this._map.fire(new Im(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new Im(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Im(t.type,this._map,t))}mouseover(t){this._map.fire(new Im(t.type,this._map,t))}mouseout(t){this._map.fire(new Im(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Am(t.type,this._map,t))}touchmove(t){this._map.fire(new Am(t.type,this._map,t))}touchend(t){this._map.fire(new Am(t.type,this._map,t))}touchcancel(t){this._map.fire(new Am(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Cm{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Im(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Im("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Im(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Mm{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.pointLocation(n.convert(t),this._map.terrain)}}class km{constructor(t,e){this._map=t,this._tr=new Mm(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(L.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;const i=e;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)t.fitScreenCoordinates(i,r,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(L.remove(this._box),this._box=null),L.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,e){return this._map.fire(new rt(t,{originalEvent:e}))}}function jf(t,e){if(t.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${t.length}, points ${e.length}`);const i={};for(let r=0;rthis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),i.length===this.numTouches&&(this.centroid=function(t){const e=new n(0,0);for(const i of t)e._add(i);return e.div(t.length)}(e),this.touches=jf(i,e)))}touchmove(t,e,i){if(this.aborted||!this.centroid)return;const r=jf(i,e);for(const t in this.touches){const e=r[t];(!e||e.dist(this.touches[t])>30)&&(this.aborted=!0)}}touchend(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class Lm{constructor(t){this.singleTap=new Dm(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,e,i){this.singleTap.touchstart(t,e,i)}touchmove(t,e,i){this.singleTap.touchmove(t,e,i)}touchend(t,e,i){const r=this.singleTap.touchend(t,e,i);if(r){const e=t.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(r)<30;if(e&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class Bm{constructor(t){this._tr=new Mm(t),this._zoomIn=new Lm({numTouches:1,numTaps:2}),this._zoomOut=new Lm({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i)}touchmove(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i)}touchend(t,e,i){const r=this._zoomIn.touchend(t,e,i),n=this._zoomOut.touchend(t,e,i),o=this._tr;return r?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:o.zoom+1,around:o.unproject(r)},{originalEvent:t})}):n?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:o.zoom-1,around:o.unproject(n)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Rm{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.around||e.panDelta)return this._active=!0,e}dragStart(t,e){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=e.length?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,e){if(!this.isEnabled())return;const i=this._lastPoint;if(!i)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const r=e.length?e[0]:e;return!this._moved&&r.dist(i){t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=function(t){t.preventDefault()}},Vf=({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:i=.8})=>{const r=new Om({checkCorrectEvent:t=>0===L.mouseButton(t)&&t.ctrlKey||2===L.mouseButton(t)});return new Rm({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*i}),moveStateManager:r,enable:t,assignEvents:Bf})},Uf=({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:i=-.5})=>{const r=new Om({checkCorrectEvent:t=>0===L.mouseButton(t)&&t.ctrlKey||2===L.mouseButton(t)});return new Rm({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*i}),moveStateManager:r,enable:t,assignEvents:Bf})};class qm{constructor(t,e){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=e,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new n(0,0),setTimeout((()=>{this._cancelCooperativeMessage=!1}),200)}touchstart(t,e,i){return this._calculateTransform(t,e,i)}touchmove(t,e,i){if(this._map._cooperativeGestures&&(2===this._minTouches&&i.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,i.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(i.length0&&(this._active=!0);const r=jf(i,e),o=new n(0,0),a=new n(0,0);let l=0;for(const t in r){const e=r[t],i=this._touches[t];i&&(o._add(e),a._add(e.sub(i)),l++,r[t]=e)}if(this._touches=r,lMath.abs(t.x)}class Ym extends jm{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,e,i){super.touchstart(t,e,i),this._currentTouchCount=i.length}_start(t){this._lastPoints=t,Zf(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,i){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const r=t[0].sub(this._lastPoints[0]),n=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,n,i.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(r.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(t,e,i){if(void 0!==this._valid)return this._valid;const r=t.mag()>=2,n=e.mag()>=2;if(!r&&!n)return;if(!r||!n)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=t.y>0==e.y>0;return Zf(t)&&Zf(e)&&o}}const Wf={panStep:100,bearingStep:15,pitchStep:10};class Qm{constructor(t){this._tr=new Mm(t);const e=Wf;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,i=0,r=0,n=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),n=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),n=1);break;case 38:t.shiftKey?r=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?r=-1:(t.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:a=>{const l=this._tr;a.easeTo({duration:300,easeId:"keyboardHandler",easing:Xf,zoom:e?Math.round(l.zoom)+e*(t.shiftKey?2:1):l.zoom,bearing:l.bearing+i*this._bearingStep,pitch:l.pitch+r*this._pitchStep,offset:[-n*this._panStep,-o*this._panStep],center:l.center},{originalEvent:t})}}}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 Xf(t){return t*(2-t)}const Yf=4.000244140625;class rf{constructor(t,e){this._map=t,this._tr=new Mm(t),this._el=t.getCanvasContainer(),this._handler=e,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,_(["_onTimeout"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!t[this._map._metaKey])return;t.preventDefault()}let e=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const i=D.now(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==e&&e%Yf==0?this._type="wheel":0!==e&&Math.abs(e)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(r*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&(this._lastWheelEvent=t,this._delta-=e,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){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 e=L.mousePos(this._el,t),i=this._tr;this._around=uh.convert(this._aroundCenter?i.center:i.unproject(e)),this._aroundPoint=i.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._tr.transform;if(0!==this._delta){const e="wheel"===this._type&&Math.abs(this._delta)>Yf?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==i&&(i=1/i);const r="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(r*i))),"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const e="number"==typeof this._targetZoom?this._targetZoom:t.zoom,i=this._startZoom,r=this._easing;let n,o=!1;if("wheel"===this._type&&i&&r){const t=Math.min((D.now()-this._lastWheelEventTime)/200,1),a=r(t);n=ii.number(i,e,a),t<1?this._frameId||(this._frameId=!0):o=!0}else n=e,o=!0;return this._active=!0,o&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!o,zoomDelta:n-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let e=u;if(this._prevEase){const t=this._prevEase,i=(D.now()-t.start)/t.duration,r=t.easing(i+.01)-t.easing(i),n=.27/Math.sqrt(r*r+1e-4)*.01;e=c(n,Math.sqrt(.0729-n*n),.25,1)}return this._prevEase={start:D.now(),duration:t,easing:e},e}reset(){this._active=!1}}class sf{constructor(t,e){this._clickZoom=t,this._tapZoom=e}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 nf{constructor(t){this._tr=new Mm(t),this.reset()}reset(){this._active=!1}dblclick(t,e){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(e)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class af{constructor(){this._tap=new Lm({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,e,i){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=e[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(t,e,i))}touchmove(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const r=e[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,t.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(t,e,i)}touchend(t,e,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(t,e,i)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class of{constructor(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class lf{constructor(t,e,i){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,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 cf{constructor(t,e,i,r){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-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 Kf=t=>t.zoom||t.drag||t.pitch||t.rotate;class uf extends rt{}function Jf(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}class df{constructor(t,e){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new wm(t),this._bearingSnap=e.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(e),_(["handleEvent","handleWindowEvent"],this);const i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[window,"blur",void 0]];for(const[t,e,i]of this._listeners)L.addEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(const[t,e,i]of this._listeners)L.removeEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(t){const e=this._map,i=e.getCanvasContainer();this._add("mapEvent",new zm(e,t));const r=e.boxZoom=new km(e,t);this._add("boxZoom",r);const n=new Bm(e),o=new nf(e);e.doubleClickZoom=new sf(o,n),this._add("tapZoom",n),this._add("clickZoom",o);const a=new af;this._add("tapDragZoom",a);const l=e.touchPitch=new Ym(e);this._add("touchPitch",l);const c=Vf(t),u=Uf(t);e.dragRotate=new lf(t,c,u),this._add("mouseRotate",c,["mousePitch"]),this._add("mousePitch",u,["mouseRotate"]);const h=(({enable:t,clickTolerance:e})=>{const i=new Om({checkCorrectEvent:t=>0===L.mouseButton(t)&&!t.ctrlKey});return new Rm({clickTolerance:e,move:(t,e)=>({around:e,panDelta:e.sub(t)}),activateOnStart:!0,moveStateManager:i,enable:t,assignEvents:Bf})})(t),p=new qm(t,e);e.dragPan=new of(i,h,p),this._add("mousePan",h),this._add("touchPan",p,["touchZoom","touchRotate"]);const d=new Xm,f=new Hm;e.touchZoomRotate=new cf(i,f,d,a),this._add("touchRotate",d,["touchPan","touchZoom"]),this._add("touchZoom",f,["touchPan","touchRotate"]);const m=e.scrollZoom=new rf(e,this);this._add("scrollZoom",m,["mousePan"]);const g=e.keyboard=new Qm(e);this._add("keyboard",g),this._add("blockableMapEvent",new Cm(e));for(const i of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[i]&&e[i].enable(t[i])}_add(t,e,i){this._handlers.push({handlerName:t,handler:e,allowed:i}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(Kf(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,i){for(const r in t)if(r!==i&&(!e||e.indexOf(r)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const e=[];for(const i of t)this._el.contains(i.target)&&e.push(i);return e}handleEvent(t,e){if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const i="renderFrame"===t.type?void 0:t,r={needsRenderFrame:!1},n={},o={},a=t.touches,l=a?this._getMapTouches(a):void 0,c=l?L.touchPos(this._el,l):L.mousePos(this._el,t);for(const{handlerName:a,handler:u,allowed:h}of this._handlers){if(!u.isEnabled())continue;let p;this._blockedByActive(o,h,a)?u.reset():u[e||t.type]&&(p=u[e||t.type](t,c,l),this.mergeHandlerResult(r,n,p,a,i),p&&p.needsRenderFrame&&this._triggerRenderFrame()),(p||u.isActive())&&(o[a]=u)}const u={};for(const t in this._previousActiveHandlers)o[t]||(u[t]=i);this._previousActiveHandlers=o,(Object.keys(u).length||Jf(r))&&(this._changes.push([r,n,u]),this._triggerRenderFrame()),(Object.keys(o).length||Jf(r))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:h}=r;h&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],h(this._map))}mergeHandlerResult(t,e,i,r,n){if(!i)return;f(t,i);const o={handlerName:r,originalEvent:i.originalEvent||n};void 0!==i.zoomDelta&&(e.zoom=o),void 0!==i.panDelta&&(e.drag=o),void 0!==i.pitchDelta&&(e.pitch=o),void 0!==i.bearingDelta&&(e.rotate=o)}_applyChanges(){const t={},e={},i={};for(const[r,o,a]of this._changes)r.panDelta&&(t.panDelta=(t.panDelta||new n(0,0))._add(r.panDelta)),r.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+r.pitchDelta),void 0!==r.around&&(t.around=r.around),void 0!==r.pinchAround&&(t.pinchAround=r.pinchAround),r.noInertia&&(t.noInertia=r.noInertia),f(e,o),f(i,a);this._updateMapTransform(t,e,i),this._changes=[]}_updateMapTransform(t,e,i){const r=this._map,n=r._getTransformForUpdate(),o=r.terrain;if(!(Jf(t)||o&&this._terrainMovement))return this._fireEvents(e,i,!0);let{panDelta:a,zoomDelta:l,bearingDelta:c,pitchDelta:u,around:h,pinchAround:p}=t;void 0!==p&&(h=p),r._stop(!0),h=h||r.transform.centerPoint;const d=n.pointLocation(a?h.sub(a):h);c&&(n.bearing+=c),u&&(n.pitch+=u),l&&(n.zoom+=l),o?this._terrainMovement||!e.drag&&!e.zoom?e.drag&&this._terrainMovement?n.center=n.pointLocation(n.centerPoint.sub(a)):n.setLocationAtPoint(d,h):(this._terrainMovement=!0,n.freezeElevation=!0,n.setLocationAtPoint(d,h),this._map.once("moveend",(()=>{n.freezeElevation=!1,this._terrainMovement=!1,n.recalculateZoom(r.terrain)}))):n.setLocationAtPoint(d,h),r._applyUpdatedTransform(n),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,i,!0)}_fireEvents(t,e,i){const r=Kf(this._eventsInProgress),n=Kf(t),o={};for(const e in t){const{originalEvent:i}=t[e];this._eventsInProgress[e]||(o[`${e}start`]=i),this._eventsInProgress[e]=t[e]}!r&&n&&this._fireEvent("movestart",n.originalEvent);for(const t in o)this._fireEvent(t,o[t]);n&&this._fireEvent("move",n.originalEvent);for(const e in t){const{originalEvent:i}=t[e];this._fireEvent(e,i)}const a={};let l;for(const t in this._eventsInProgress){const{handlerName:i,originalEvent:r}=this._eventsInProgress[t];this._handlersById[i].isActive()||(delete this._eventsInProgress[t],l=e[i]||r,a[`${t}end`]=l)}for(const t in a)this._fireEvent(t,a[t]);const c=Kf(this._eventsInProgress);if(i&&(r||n)&&!c){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),e=t=>0!==t&&-this._bearingSnap{delete this._frameId,this.handleEvent(new uf("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const Qf={extend:(t,...e)=>f(t,...e),run(t){t()},logToElement(t,e=!1,i="log"){const r=window.document.getElementById(i);r&&(e&&(r.innerHTML=""),r.innerHTML+=`
${t}`)}};class ff extends nt{constructor(t,e){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=e.bearingSnap,_(["_renderFrameCallback"],this),this.on("moveend",(()=>{delete this._requestedCameraState}))}getCenter(){return new uh(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}panBy(t,e,i){return t=n.convert(t).mult(-1),this.panTo(this.transform.center,f({offset:t},e),i)}panTo(t,e,i){return this.easeTo(f({center:t},e),i)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(t,e,i){return this.easeTo(f({zoom:t},e),i)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(t,e,i){return this.easeTo(f({bearing:t},e),i)}resetNorth(t,e){return this.rotateTo(0,f({duration:1e3},t),e),this}resetNorthPitch(t,e){return this.easeTo(f({bearing:0,pitch:0,duration:1e3},t),e),this}snapToNorth(t,e){return Math.abs(this.getBearing()){if(this._zooming&&(i.zoom=ii.number(r,c,n)),this._rotating&&(i.bearing=ii.number(o,h,n)),this._pitching&&(i.pitch=ii.number(a,p,n)),this._padding&&(i.interpolatePadding(l,d,n),g=i.centerPoint.add(m)),this.terrain&&!t.freezeElevation&&this._updateElevation(n),w)i.setLocationAtPoint(w,C);else{const t=i.zoomScale(i.zoom-r),e=c>r?Math.min(2,b):Math.max(.5,b),o=Math.pow(e,1-n),a=i.unproject(v.add(x.mult(n*o)).mult(t));i.setLocationAtPoint(i.renderWorldCopies?a.wrap():a,g)}this._applyUpdatedTransform(i),this._fireMoveEvents(e)}),(t=>{this.terrain&&this._finalizeElevation(),this._afterEase(e,t)}),t),this}_prepareEase(t,e,i={}){this._moving=!0,e||i.moving||this.fire(new rt("movestart",t)),this._zooming&&!i.zooming&&this.fire(new rt("zoomstart",t)),this._rotating&&!i.rotating&&this.fire(new rt("rotatestart",t)),this._pitching&&!i.pitching&&this.fire(new rt("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.transform.getElevation(t,this.terrain),this.transform.freezeElevation=!0}_updateElevation(t){const e=this.transform.getElevation(this._elevationCenter,this.terrain);if(t<1&&e!==this._elevationTarget){const i=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(i-(e-(i*t+this._elevationStart))/(1-t)),this._elevationTarget=e}this.transform.elevation=ii.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this.transform.freezeElevation=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;const e=t.clone(),{center:i,zoom:r,pitch:n,bearing:o,elevation:a}=this.transformCameraUpdate(e);i&&(e.center=i),void 0!==r&&(e.zoom=r),void 0!==n&&(e.pitch=n),void 0!==o&&(e.bearing=o),void 0!==a&&(e.elevation=a),this.transform.apply(e)}_fireMoveEvents(t){this.fire(new rt("move",t)),this._zooming&&this.fire(new rt("zoom",t)),this._rotating&&this.fire(new rt("rotate",t)),this._pitching&&this.fire(new rt("pitch",t))}_afterEase(t,e){if(this._easeId&&e&&this._easeId===e)return;delete this._easeId;const i=this._zooming,r=this._rotating,n=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,i&&this.fire(new rt("zoomend",t)),r&&this.fire(new rt("rotateend",t)),n&&this.fire(new rt("pitchend",t)),this.fire(new rt("moveend",t))}flyTo(t,e){if(!t.essential&&D.prefersReducedMotion){const i=m(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(i,e)}this.stop(),t=f({offset:[0,0],speed:1.2,curve:1.42,easing:u},t);const i=this._getTransformForUpdate(),r=this.getZoom(),o=this.getBearing(),a=this.getPitch(),l=this.getPadding(),c="zoom"in t?h(+t.zoom,i.minZoom,i.maxZoom):r,p="bearing"in t?this._normalizeBearing(t.bearing,o):o,d="pitch"in t?+t.pitch:a,g="padding"in t?t.padding:i.padding,y=i.zoomScale(c-r),_=n.convert(t.offset);let v=i.centerPoint.add(_);const x=i.pointLocation(v),b=uh.convert(t.center||x);this._normalizeCenter(b);const w=i.project(x),C=i.project(b).sub(w);let S=t.curve;const M=Math.max(i.width,i.height),T=M/y,E=C.mag();if("minZoom"in t){const e=h(Math.min(t.minZoom,r,c),i.minZoom,i.maxZoom),n=M/i.zoomScale(e-r);S=Math.sqrt(n/E*2)}const A=S*S;function I(t){const e=(T*T-M*M+(t?-1:1)*A*A*E*E)/(2*(t?T:M)*A*E);return Math.log(Math.sqrt(e*e+1)-e)}function P(t){return(Math.exp(t)-Math.exp(-t))/2}function O(t){return(Math.exp(t)+Math.exp(-t))/2}const k=I(0);let F=function(t){return O(k)/O(k+S*t)},z=function(t){return M*((O(k)*(P(e=k+S*t)/O(e))-P(k))/A)/E;var e},j=(I(1)-k)/S;if(Math.abs(E)<1e-6||!isFinite(j)){if(Math.abs(M-T)<1e-6)return this.easeTo(t,e);const i=Tt.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=o!==p,this._pitching=d!==a,this._padding=!i.isPaddingEqual(g),this._prepareEase(e,!1),this.terrain&&this._prepareElevation(b),this._ease((n=>{const u=n*j,h=1/F(u);i.zoom=1===n?c:r+i.scaleZoom(h),this._rotating&&(i.bearing=ii.number(o,p,n)),this._pitching&&(i.pitch=ii.number(a,d,n)),this._padding&&(i.interpolatePadding(l,g,n),v=i.centerPoint.add(_)),this.terrain&&!t.freezeElevation&&this._updateElevation(n);const f=1===n?b:i.unproject(w.add(C.mult(z(u))).mult(h));i.setLocationAtPoint(i.renderWorldCopies?f.wrap():f,v),this._applyUpdatedTransform(i),this._fireMoveEvents(e)}),(()=>{this.terrain&&this._finalizeElevation(),this._afterEase(e)}),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e)}if(!t){const t=this.handlers;t&&t.stop(!1)}return this}_ease(t,e,i){!1===i.animate||0===i.duration?(t(1),e()):(this._easeStart=D.now(),this._easeOptions=i,this._onEaseFrame=t,this._onEaseEnd=e,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((D.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,e){t=p(t,-180,180);const i=Math.abs(t-e);return Math.abs(t-360-e)180?-360:i<-180?360:0}queryTerrainElevation(t){return this.terrain?this.transform.getElevation(uh.convert(t),this.terrain)-this.transform.elevation:null}}class _f{constructor(t={}){this.options=t,_(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=L.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=L.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=L.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){L.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,e){const i=this._map._getUIString(`AttributionControl.${e}`);t.title=i,t.setAttribute("aria-label",i)}_toggleAttribution(){this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))}_updateData(t){!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType&&"terrain"!==t.type||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((t=>"string"!=typeof t?"":t))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style.sourceCaches;for(const i in e){const r=e[i];if(r.used||r.usedForTerrain){const e=r.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t=t.filter((t=>String(t).trim())),t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,i)=>{for(let r=i+1;r=0)return!1;return!0}));const i=t.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,t.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")}}class gf{constructor(t={}){this.options=t,_(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=L.create("div","maplibregl-ctrl");const e=L.create("a","maplibregl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){L.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add("maplibregl-compact"):e.classList.remove("maplibregl-compact")}}}class yf{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,i=e?this._queue.concat(e):this._queue;for(const e of i)if(e.id===t)return void(e.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const e=this._currentlyRunning=this._queue;this._queue=[];for(const i of e)if(!i.cancelled&&(i.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var tm;!function(t){t.create="create",t.load="load",t.fullLoad="fullLoad"}(tm||(tm={}));let em=null,im=[];const rm=1e3/60,nm="loadTime",sm="fullLoadTime",om={mark(t){performance.mark(t)},frame(t){const e=t;null!=em&&im.push(e-em),em=e},clearMetrics(){em=null,im=[],performance.clearMeasures(nm),performance.clearMeasures(sm);for(const t in tm)performance.clearMarks(tm[t])},getPerformanceMetrics(){performance.measure(nm,tm.create,tm.load),performance.measure(sm,tm.create,tm.fullLoad);const t=performance.getEntriesByName(nm)[0].duration,e=performance.getEntriesByName(sm)[0].duration,i=im.length,r=1/(im.reduce(((t,e)=>t+e),0)/i/1e3),n=im.filter((t=>t>rm)).reduce(((t,e)=>t+(e-rm)/rm),0);return{loadTime:t,fullLoadTime:e,fps:r,percentDroppedFrames:n/(i+n)*100,totalFrames:i}}},am={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var lm=ts([{name:"a_pos3d",type:"Int16",components:3}]);class zf extends nt{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,e){this.sourceCache.update(t,e),this._renderableTilesKeys=[];const i={};for(const r of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:e}))i[r.key]=!0,this._renderableTilesKeys.push(r.key),this._tiles[r.key]||(r.posMatrix=new Float64Array(16),Bo(r.posMatrix,0,oo,0,oo,0,1),this._tiles[r.key]=new jh(r,this.tileSize));for(const t in this._tiles)i[t]||delete this._tiles[t]}freeRtt(t){for(const e in this._tiles){const i=this._tiles[e];(!t||i.tileID.equals(t)||i.tileID.isChildOf(t)||t.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const e={};for(const i of this._renderableTilesKeys){const r=this._tiles[i].tileID;if(r.canonical.equals(t.canonical)){const r=t.clone();r.posMatrix=new Float64Array(16),Bo(r.posMatrix,0,oo,0,oo,0,1),e[i]=r}else if(r.canonical.isChildOf(t.canonical)){const n=t.clone();n.posMatrix=new Float64Array(16);const o=r.canonical.z-t.canonical.z,a=r.canonical.x-(r.canonical.x>>o<>o<>o;Bo(n.posMatrix,0,c,0,c,0,1),Ro(n.posMatrix,n.posMatrix,[-a*c,-l*c,0]),e[i]=n}else if(t.canonical.isChildOf(r.canonical)){const n=t.clone();n.posMatrix=new Float64Array(16);const o=t.canonical.z-r.canonical.z,a=t.canonical.x-(t.canonical.x>>o<>o<>o;Bo(n.posMatrix,0,oo,0,oo,0,1),Ro(n.posMatrix,n.posMatrix,[a*c,l*c,0]),jo(n.posMatrix,n.posMatrix,[1/2**o,1/2**o,0]),e[i]=n}}return e}getSourceTile(t,e){const i=this.sourceCache._source;let r=t.overscaledZ-this.deltaZoom;if(r>i.maxzoom&&(r=i.maxzoom),r=i.minzoom&&(!n||!n.dem);)n=this.sourceCache.getTileByID(t.scaledTo(r--).key);return n}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter((e=>e.timeAdded>=t))}}class Cf{constructor(t,e,i){this.painter=t,this.sourceCache=new zf(e),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,e,i,r=oo){if(!(e>=0&&e=0&&it.canonical.z&&(t.canonical.z>=i?r=t.canonical.z-i:S("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const n=t.canonical.x-(t.canonical.x>>r<>r<>8<<4|t>>8,e[i+3]=0;const i=new ao({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(e.buffer)),r=new Kc(t,i,t.gl.RGBA,{premultiply:!1});return r.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=r,r}pointCoordinate(t){const e=new Uint8Array(4),i=this.painter.context,r=i.gl;i.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),r.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,r.RGBA,r.UNSIGNED_BYTE,e),i.bindFramebuffer.set(null);const n=e[0]+(e[2]>>4<<8),o=e[1]+((15&e[2])<<8),a=this.coordsIndex[255-e[3]],l=a&&this.sourceCache.getTileByID(a);if(!l)return null;const c=this._coordsTextureSize,u=(1<t.id!==e)),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length!t.inUse))}}const cm={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Pf{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new Mf(t.context,30,e.sourceCache.tileSize*e.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,e){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter((i=>!t._layers[i].isHidden(e))),this._coordsDescendingInv={};for(const e in t.sourceCaches){this._coordsDescendingInv[e]={};const i=t.sourceCaches[e].getVisibleCoordinates();for(const t of i){const i=this.terrain.sourceCache.getTerrainCoords(t);for(const t in i)this._coordsDescendingInv[e][t]||(this._coordsDescendingInv[e][t]=[]),this._coordsDescendingInv[e][t].push(i[t])}}this._coordsDescendingInvStr={};for(const e of t._order){const i=t._layers[e],r=i.source;if(cm[i.type]&&!this._coordsDescendingInvStr[r]){this._coordsDescendingInvStr[r]={};for(const t in this._coordsDescendingInv[r])this._coordsDescendingInvStr[r][t]=this._coordsDescendingInv[r][t].map((t=>t.key)).sort().join()}}for(const t of this._renderableTiles)for(const e in this._coordsDescendingInvStr){const i=this._coordsDescendingInvStr[e][t.tileID.key];i&&i!==t.rttCoords[e]&&(t.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const e=t.type,i=this.painter,r=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(cm[e]&&(this._prevType&&cm[this._prevType]||this._stacks.push([]),this._prevType=e,this._stacks[this._stacks.length-1].push(t.id),!r))return!0;if(cm[this._prevType]||cm[e]&&r){this._prevType=e;const t=this._stacks.length-1,r=this._stacks[t]||[];for(const e of this._renderableTiles){if(this.pool.isFull()&&(Tf(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(e),e.rtt[t]){const i=this.pool.getObjectForId(e.rtt[t].id);if(i.stamp===e.rtt[t].stamp){this.pool.useObject(i);continue}}const n=this.pool.getOrCreateFreeObject();this.pool.useObject(n),this.pool.stampObject(n),e.rtt[t]={id:n.id,stamp:n.stamp},i.context.bindFramebuffer.set(n.fbo.framebuffer),i.context.clear({color:oe.transparent,stencil:0}),i.currentStencilSource=void 0;for(let t=0;t{t.touchstart=t.dragStart,t.touchmoveWindow=t.dragMove,t.touchend=t.dragEnd},vm={showCompass:!0,showZoom:!0,visualizePitch:!1};class Ff{constructor(t,e,i=!1){this._clickTolerance=10;const r=t.dragRotate._mouseRotate.getClickTolerance(),n=t.dragRotate._mousePitch.getClickTolerance();this.element=e,this.mouseRotate=Vf({clickTolerance:r,enable:!0}),this.touchRotate=(({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:i=.8})=>{const r=new Vm;return new Rm({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*i}),moveStateManager:r,enable:t,assignEvents:ym})})({clickTolerance:r,enable:!0}),this.map=t,i&&(this.mousePitch=Uf({clickTolerance:n,enable:!0}),this.touchPitch=(({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:i=-.5})=>{const r=new Vm;return new Rm({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*i}),moveStateManager:r,enable:t,assignEvents:ym})})({clickTolerance:n,enable:!0})),_(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),L.addEventListener(e,"mousedown",this.mousedown),L.addEventListener(e,"touchstart",this.touchstart,{passive:!1}),L.addEventListener(e,"touchcancel",this.reset)}startMouse(t,e){this.mouseRotate.dragStart(t,e),this.mousePitch&&this.mousePitch.dragStart(t,e),L.disableDrag()}startTouch(t,e){this.touchRotate.dragStart(t,e),this.touchPitch&&this.touchPitch.dragStart(t,e),L.disableDrag()}moveMouse(t,e){const i=this.map,{bearingDelta:r}=this.mouseRotate.dragMove(t,e)||{};if(r&&i.setBearing(i.getBearing()+r),this.mousePitch){const{pitchDelta:r}=this.mousePitch.dragMove(t,e)||{};r&&i.setPitch(i.getPitch()+r)}}moveTouch(t,e){const i=this.map,{bearingDelta:r}=this.touchRotate.dragMove(t,e)||{};if(r&&i.setBearing(i.getBearing()+r),this.touchPitch){const{pitchDelta:r}=this.touchPitch.dragMove(t,e)||{};r&&i.setPitch(i.getPitch()+r)}}off(){const t=this.element;L.removeEventListener(t,"mousedown",this.mousedown),L.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),L.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),L.removeEventListener(window,"touchend",this.touchend),L.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){L.enableDrag(),L.removeEventListener(window,"mousemove",this.mousemove),L.removeEventListener(window,"mouseup",this.mouseup),L.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),L.removeEventListener(window,"touchend",this.touchend)}mousedown(t){this.startMouse(f({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),L.mousePos(this.element,t)),L.addEventListener(window,"mousemove",this.mousemove),L.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.moveMouse(t,L.mousePos(this.element,t))}mouseup(t){this.mouseRotate.dragEnd(t),this.mousePitch&&this.mousePitch.dragEnd(t),this.offTemp()}touchstart(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=L.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),L.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),L.addEventListener(window,"touchend",this.touchend))}touchmove(t){1!==t.targetTouches.length?this.reset():(this._lastPos=L.touchPos(this.element,t.targetTouches)[0],this.moveTouch(t,this._lastPos))}touchend(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)180;){const e=i.locationPoint(t);if(e.x>=0&&e.y>=0&&e.x<=i.width&&e.y<=i.height)break;t.lng>i.center.lng?t.lng-=360:t.lng+=360}return t}const Sm={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Tm(t,e,i){const r=t.classList;for(const t in Sm)r.remove(`maplibregl-${i}-anchor-${t}`);r.add(`maplibregl-${i}-anchor-${e}`)}class $f extends nt{constructor(t,e){if(super(),(t instanceof HTMLElement||e)&&(t=f({element:t},e)),_(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&"auto"!==t.pitchAlignment?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=n.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=L.create("div"),this._element.setAttribute("aria-label","Map marker");const e=L.createNS("http://www.w3.org/2000/svg","svg"),i=41,r=27;e.setAttributeNS(null,"display","block"),e.setAttributeNS(null,"height",`${i}px`),e.setAttributeNS(null,"width",`${r}px`),e.setAttributeNS(null,"viewBox",`0 0 ${r} ${i}`);const o=L.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"stroke","none"),o.setAttributeNS(null,"stroke-width","1"),o.setAttributeNS(null,"fill","none"),o.setAttributeNS(null,"fill-rule","evenodd");const a=L.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");const l=L.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");const c=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const t of c){const e=L.createNS("http://www.w3.org/2000/svg","ellipse");e.setAttributeNS(null,"opacity","0.04"),e.setAttributeNS(null,"cx","10.5"),e.setAttributeNS(null,"cy","5.80029008"),e.setAttributeNS(null,"rx",t.rx),e.setAttributeNS(null,"ry",t.ry),l.appendChild(e)}const u=L.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"fill",this._color);const h=L.createNS("http://www.w3.org/2000/svg","path");h.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),u.appendChild(h);const p=L.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"opacity","0.25"),p.setAttributeNS(null,"fill","#000000");const d=L.createNS("http://www.w3.org/2000/svg","path");d.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),p.appendChild(d);const f=L.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(6.0, 7.0)"),f.setAttributeNS(null,"fill","#FFFFFF");const m=L.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(8.0, 8.0)");const g=L.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#000000"),g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962");const y=L.createNS("http://www.w3.org/2000/svg","circle");y.setAttributeNS(null,"fill","#FFFFFF"),y.setAttributeNS(null,"cx","5.5"),y.setAttributeNS(null,"cy","5.5"),y.setAttributeNS(null,"r","5.4999962"),m.appendChild(g),m.appendChild(y),a.appendChild(l),a.appendChild(u),a.appendChild(p),a.appendChild(f),a.appendChild(m),e.appendChild(a),e.setAttributeNS(null,"height",i*this._scale+"px"),e.setAttributeNS(null,"width",r*this._scale+"px"),this._element.appendChild(e),this._offset=n.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(t=>{t.preventDefault()})),this._element.addEventListener("mousedown",(t=>{t.preventDefault()})),Tm(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),L.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=uh.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const e=38.1,i=13.5,r=Math.sqrt(Math.pow(i,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-e],"bottom-left":[r,-1*(e-i+r)],"bottom-right":[-r,-1*(e-i+r)],left:[i,-1*(e-i)],right:[-i,-1*(e-i)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const e=t.code,i=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==i&&13!==i||this.togglePopup()}_onMapClick(t){const e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=bm(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let e="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?e=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(e=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let i="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?i="rotateX(0deg)":"map"===this._pitchAlignment&&(i=`rotateX(${this._map.getPitch()}deg)`),t&&"moveend"!==t.type||(this._pos=this._pos.round()),L.setTransform(this._element,`${Sm[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${i} ${e}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout((()=>{const t=this._map.unproject(this._pos),e=40075016.686*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=t.distanceTo(this._lngLat)>20*e?"0.2":"1.0",this._opacityTimeout=null}),100))}getOffset(){return this._offset}setOffset(t){return this._offset=n.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){const e=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=e}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new rt("dragstart"))),this.fire(new rt("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new rt("dragend")),this._state="inactive"}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const Pm={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Fm=0,Nm=!1;const Um={maxWidth:100,unit:"metric"};function Gm(t,e,i){const r=i&&i.maxWidth||100,n=t._container.clientHeight/2,o=t.unproject([0,n]),a=t.unproject([r,n]),l=o.distanceTo(a);if(i&&"imperial"===i.unit){const i=3.2808*l;i>5280?Zm(e,r,i/5280,t._getUIString("ScaleControl.Miles")):Zm(e,r,i,t._getUIString("ScaleControl.Feet"))}else i&&"nautical"===i.unit?Zm(e,r,l/1852,t._getUIString("ScaleControl.NauticalMiles")):l>=1e3?Zm(e,r,l/1e3,t._getUIString("ScaleControl.Kilometers")):Zm(e,r,l,t._getUIString("ScaleControl.Meters"))}function Zm(t,e,i,r){const n=function(t){const e=Math.pow(10,`${Math.floor(t)}`.length-1);let i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(i),e*i}(i);t.style.width=e*(n/i)+"px",t.innerHTML=`${n} ${r}`}const $m={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Wm=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Km(t){if(t){if("number"==typeof t){const e=Math.round(Math.sqrt(.5*Math.pow(t,2)));return{center:new n(0,0),top:new n(0,t),"top-left":new n(e,e),"top-right":new n(-e,e),bottom:new n(0,-t),"bottom-left":new n(e,-e),"bottom-right":new n(-e,-e),left:new n(t,0),right:new n(-t,0)}}if(t instanceof n||Array.isArray(t)){const e=n.convert(t);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:n.convert(t.center||[0,0]),top:n.convert(t.top||[0,0]),"top-left":n.convert(t["top-left"]||[0,0]),"top-right":n.convert(t["top-right"]||[0,0]),bottom:n.convert(t.bottom||[0,0]),"bottom-left":n.convert(t["bottom-left"]||[0,0]),"bottom-right":n.convert(t["bottom-right"]||[0,0]),left:n.convert(t.left||[0,0]),right:n.convert(t.right||[0,0])}}return Km(new n(0,0))}const Jm=t,tg={setRTLTextPlugin:function(t,e,i=!1){if(Fn===Ln||Fn===Pn||Fn===On)throw new Error("setRTLTextPlugin cannot be called multiple times.");Rn=D.resolveURL(t),Fn=Ln,kn=e,Nn(),i||Un()},getRTLTextPluginStatus:Vn,Map:class extends ff{constructor(t){var e;if(om.mark(tm.create),null!=(t=f({},gm,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(super(new fm(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),{bearingSnap:t.bearingSnap}),this._interactive=t.interactive,this._cooperativeGestures=t.cooperativeGestures,this._metaKey=0===navigator.platform.indexOf("Mac")?"metaKey":"ctrlKey",this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,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._crossSourceCollisions=t.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=t.collectResourceTiming,this._renderTaskQueue=new yf,this._controls=[],this._mapId=y(),this._locale=f({},am,t.locale),this._clickTolerance=t.clickTolerance,this._pixelRatio=null!==(e=t.pixelRatio)&&void 0!==e?e:devicePixelRatio,this.transformCameraUpdate=t.transformCameraUpdate,this._imageQueueHandle=tt.addThrottleControl((()=>this.isMoving())),this._requestManager=new Q(t.transformRequest),"string"==typeof t.container){if(this._container=document.getElementById(t.container),!this._container)throw new Error(`Container '${t.container}' not found.`)}else{if(!(t.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(t.maxBounds&&this.setMaxBounds(t.maxBounds),_(["_onWindowOnline","_onMapScroll","_cooperativeGesturesOnWheel","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)})),this.once("idle",(()=>{this._idleTriggered=!0})),"undefined"!=typeof window){addEventListener("online",this._onWindowOnline,!1);let t=!1;this._resizeObserver=new ResizeObserver((e=>{t?this._trackResize&&this.resize(e)._update():t=!0})),this._resizeObserver.observe(this._container)}this.handlers=new df(this,t),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=t.hash&&new _m("string"==typeof t.hash&&t.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,f({},t.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new _f({customAttribution:t.customAttribution})),t.maplibreLogo&&this.addControl(new gf,t.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)})),this.on("data",(t=>{this._update("style"===t.dataType),this.fire(new rt(`${t.dataType}data`,t))})),this.on("dataloading",(t=>{this.fire(new rt(`${t.dataType}dataloading`,t))})),this.on("dataabort",(t=>{this.fire(new rt("sourcedataabort",t))}))}_getMapId(){return this._mapId}addControl(t,e){if(void 0===e&&(e=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new st(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=t.onAdd(this);this._controls.push(t);const r=this._controlPositions[e];return-1!==e.indexOf("bottom")?r.insertBefore(i,r.firstChild):r.appendChild(i),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new st(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(t);return e>-1&&this._controls.splice(e,1),t.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}calculateCameraOptionsFromTo(t,e,i,r){return null==r&&this.terrain&&(r=this.transform.getElevation(i,this.terrain)),super.calculateCameraOptionsFromTo(t,e,i,r)}resize(t){var e;const i=this._containerDimensions(),r=i[0],n=i[1];this._resizeCanvas(r,n,this.getPixelRatio()),this.transform.resize(r,n),null===(e=this._requestedCameraState)||void 0===e||e.resize(r,n),this.painter.resize(r,n,this.getPixelRatio());const o=!this._moving;return o&&(this.stop(),this.fire(new rt("movestart",t)).fire(new rt("move",t))),this.fire(new rt("resize",t)),o&&this.fire(new rt("moveend",t)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(t){const[e,i]=this._containerDimensions();this._pixelRatio=t,this._resizeCanvas(e,i,t),this.painter.resize(e,i,t)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(ph.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.renderWorldCopies=t,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(t){return this._cooperativeGestures=t,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(t){return this.transform.locationPoint(uh.convert(t),this.style&&this.terrain)}unproject(t){return this.transform.pointLocation(n.convert(t),this.terrain)}isMoving(){var t;return this._moving||(null===(t=this.handlers)||void 0===t?void 0:t.isMoving())}isZooming(){var t;return this._zooming||(null===(t=this.handlers)||void 0===t?void 0:t.isZooming())}isRotating(){var t;return this._rotating||(null===(t=this.handlers)||void 0===t?void 0:t.isRotating())}_createDelegatedListener(t,e,i){if("mouseenter"===t||"mouseover"===t){let r=!1;const n=n=>{const o=this.getLayer(e)?this.queryRenderedFeatures(n.point,{layers:[e]}):[];o.length?r||(r=!0,i.call(this,new Im(t,this,n.originalEvent,{features:o}))):r=!1};return{layer:e,listener:i,delegates:{mousemove:n,mouseout:()=>{r=!1}}}}if("mouseleave"===t||"mouseout"===t){let r=!1;const n=n=>{(this.getLayer(e)?this.queryRenderedFeatures(n.point,{layers:[e]}):[]).length?r=!0:r&&(r=!1,i.call(this,new Im(t,this,n.originalEvent)))},o=e=>{r&&(r=!1,i.call(this,new Im(t,this,e.originalEvent)))};return{layer:e,listener:i,delegates:{mousemove:n,mouseout:o}}}{const r=t=>{const r=this.getLayer(e)?this.queryRenderedFeatures(t.point,{layers:[e]}):[];r.length&&(t.features=r,i.call(this,t),delete t.features)};return{layer:e,listener:i,delegates:{[t]:r}}}}on(t,e,i){if(void 0===i)return super.on(t,e);const r=this._createDelegatedListener(t,e,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(r);for(const t in r.delegates)this.on(t,r.delegates[t]);return this}once(t,e,i){if(void 0===i)return super.once(t,e);const r=this._createDelegatedListener(t,e,i);for(const t in r.delegates)this.once(t,r.delegates[t]);return this}off(t,e,i){return void 0===i?super.off(t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&(r=>{const n=this._delegatedListeners[t];for(let t=0;tthis._updateStyle(t,e)));const i=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t?(this.style=new up(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,e,i):this.style.loadJSON(t,e,i),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new up(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(t,e){if("string"==typeof t){const i=this._requestManager.transformRequest(t,J.Style);U(i,((t,i)=>{t?this.fire(new st(t)):i&&this._updateDiff(i,e)}))}else"object"==typeof t&&this._updateDiff(t,e)}_updateDiff(t,e){try{this.style.setState(t,e)&&this._update(!0)}catch(i){S(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(t,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():S("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(t){const e=this.style&&this.style.sourceCaches[t];if(void 0!==e)return e.loaded();this.fire(new st(new Error(`There is no source with ID '${t}'`)))}setTerrain(t){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),t){const e=this.style.sourceCaches[t.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);for(const e in this.style._layers){const i=this.style._layers[e];"hillshade"===i.type&&i.source===t.source&&S("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Cf(this.painter,e,t),this.painter.renderToTexture=new Pf(this.painter,this.terrain),this.transform.updateElevation(this.terrain),this._terrainDataCallback=e=>{"style"===e.dataType?this.terrain.sourceCache.freeRtt():"source"===e.dataType&&e.tile&&(e.sourceId===t.source&&this.transform.updateElevation(this.terrain),this.terrain.sourceCache.freeRtt(e.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.updateElevation(this.terrain);return this.fire(new rt("terrain",{terrain:t})),this}getTerrain(){return this.terrain&&this.terrain.options}areTilesLoaded(){const t=this.style&&this.style.sourceCaches;for(const e in t){const i=t[e]._tiles;for(const t in i){const e=i[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}}return!0}addSourceType(t,e,i){return this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,i)}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(t,e,{pixelRatio:i=1,sdf:r=!1,stretchX:n,stretchY:o,content:a}={}){if(this._lazyInitEmptyStyle(),e instanceof HTMLImageElement||P(e)){const{width:l,height:c,data:u}=D.getImageData(e);this.style.addImage(t,{data:new ao({width:l,height:c},u),pixelRatio:i,stretchX:n,stretchY:o,content:a,sdf:r,version:0})}else{if(void 0===e.width||void 0===e.height)return this.fire(new st(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`")));{const{width:l,height:c,data:u}=e,h=e;this.style.addImage(t,{data:new ao({width:l,height:c},new Uint8Array(u)),pixelRatio:i,stretchX:n,stretchY:o,content:a,sdf:r,version:0,userImage:h}),h.onAdd&&h.onAdd(this,t)}}}updateImage(t,e){const i=this.style.getImage(t);if(!i)return this.fire(new st(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const r=e instanceof HTMLImageElement||P(e)?D.getImageData(e):e,{width:n,height:o,data:a}=r;if(void 0===n||void 0===o)return this.fire(new st(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(n!==i.data.width||o!==i.data.height)return this.fire(new st(new Error("The width and height of the updated image must be that same as the previous version of the image")));const l=!(e instanceof HTMLImageElement||P(e));i.data.replace(a,l),this.style.updateImage(t,i)}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new st(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t,e){tt.getImage(this._requestManager.transformRequest(t,J.Image),e)}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}setLayerZoomRange(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)}setFilter(t,e,i={}){return this.style.setFilter(t,e,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,i,r={}){return this.style.setPaintProperty(t,e,i,r),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,i,r={}){return this.style.setLayoutProperty(t,e,i,r),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setGlyphs(t,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,e,i,(t=>{t||this._update(!0)})),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,e,(t=>{t||this._update(!0)})),this}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupContainer(){const t=this._container;t.classList.add("maplibregl-map");const e=this._canvasContainer=L.create("div","maplibregl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=L.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const i=this._containerDimensions();this._resizeCanvas(i[0],i[1],this.getPixelRatio());const r=this._controlContainer=L.create("div","maplibregl-control-container",t),n=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((t=>{n[t]=L.create("div",`maplibregl-ctrl-${t} `,r)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_cooperativeGesturesOnWheel(t){this._onCooperativeGesture(t,t[this._metaKey],1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=L.create("div","maplibregl-cooperative-gesture-screen",this._container);let t="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";0===navigator.platform.indexOf("Mac")&&(t="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=`\n
${t}
\n
${"boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}
\n `,this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){L.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(t,e,i){this._canvas.width=i*t,this._canvas.height=i*e,this._canvas.style.width=`${t}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const t={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let e=null;this._canvas.addEventListener("webglcontextcreationerror",(i=>{e={requestedAttributes:t},i&&(e.statusMessage=i.statusMessage,e.type=i.type)}),{once:!0});const i=this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t);if(!i){const t="Failed to initialize WebGL";throw e?(e.message=t,new Error(JSON.stringify(e))):new Error(t)}this.painter=new um(i,this.transform),q.testSupport(i)}_contextLost(t){t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new rt("webglcontextlost",{originalEvent:t}))}_contextRestored(t){this._setupPainter(),this.resize(),this._update(),this.fire(new rt("webglcontextrestored",{originalEvent:t}))}_onMapScroll(t){if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(t,e,i){return!e&&i<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout((()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")}),100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){const e=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let i=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,r=D.now();this.style.zoomHistory.update(t,r);const n=new us(t,{now:r,fadeDuration:e,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),o=n.crossFadingFactor();1===o&&o===this._crossFadingFactor||(i=!0,this._crossFadingFactor=o),this.style.update(n)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain&&this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.updateElevation(this.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,e,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:e,showPadding:this.showPadding}),this.fire(new rt("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,om.mark(tm.load),this.fire(new rt("load"))),this.style&&(this.style.hasTransitions()||i)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const r=this._sourcesDirty||this._styleDirty||this._placementDirty;return r||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new rt("idle")),!this._loaded||this._fullyLoaded||r||(this._fullyLoaded=!0,om.mark(tm.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var t;this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&removeEventListener("online",this._onWindowOnline,!1),tt.removeThrottleControl(this._imageQueueHandle),null===(t=this._resizeObserver)||void 0===t||t.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),L.remove(this._canvasContainer),L.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),om.clearMetrics(),this._removed=!0,this.fire(new rt("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=D.frame((t=>{om.frame(t),this._frame=null,this._render(t)})))}_onWindowOnline(){this._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return hm}getCameraTargetElevation(){return this.transform.elevation}},NavigationControl:class{constructor(t){this.options=f({},vm,t),this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(_(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),L.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),L.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(_(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=L.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())}_rotateCompassArrow(){const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Ff(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){L.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,e){const i=L.create("button",t,this._container);return i.type="button",i.addEventListener("click",e),i}_setButtonTitle(t,e){const i=this._map._getUIString(`NavigationControl.${e}`);t.title=i,t.setAttribute("aria-label",i)}},GeolocateControl:class extends nt{constructor(t){super(),this.options=f({},Pm,t),_(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(t){return this._map=t,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,e=!1){void 0===xm||e?void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then((e=>{xm="denied"!==e.state,t(xm)})).catch((()=>{xm=!!window.navigator.geolocation,t(xm)})):(xm=!!window.navigator.geolocation,t(xm)):t(xm)}(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),L.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Fm=0,Nm=!1}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitudee.getEast()||i.latitudee.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(t){if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new rt("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new rt("geolocate",t)),this._finish()}}_updateCamera(t){const e=new uh(t.coords.longitude,t.coords.latitude),i=t.coords.accuracy,r=f({bearing:this._map.getBearing()},this.options.fitBoundsOptions),n=ph.fromLngLat(e,i);this._map.fitBounds(n,r,{geolocateSource:!0})}_updateMarker(t){if(t){const e=new uh(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(e).addTo(this._map),this._userLocationDotMarker.setLngLat(e).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.getBounds(),e=t.getSouthEast(),i=t.getNorthEast(),r=e.distanceTo(i),n=Math.ceil(this._accuracy/(r/this._map._container.clientHeight)*2);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(t){if(this._map){if(this.options.trackUserLocation)if(1===t.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&Nm)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new rt("error",t)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(t){if(this._map){if(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=L.create("button","maplibregl-ctrl-geolocate",this._container),L.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===t){S("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=L.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new $f(this._dotElement),this._circleElement=L.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new $f({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(t=>{t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||t.originalEvent&&"resize"===t.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new rt("trackuserlocationend")))}))}}trigger(){if(!this._setup)return S("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 rt("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Fm--,Nm=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new rt("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new rt("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Fm++,Fm>1?(t={maximumAge:6e5,timeout:0},Nm=!0):(t=this.options.positionOptions,Nm=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:_f,LogoControl:gf,ScaleControl:class{constructor(t){this.options=f({},Um,t),_(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){Gm(this._map,this._container,this.options)}onAdd(t){return this._map=t,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){L.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(t){this.options.unit=t,Gm(this._map,this._container,this.options)}},FullscreenControl:class extends nt{constructor(t={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:S("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){L.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const t=this._fullscreenButton=L.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);L.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new rt("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new rt("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},TerrainControl:class{constructor(t){this.options=t,_(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(t){return this._map=t,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=L.create("button","maplibregl-ctrl-terrain",this._container),L.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){L.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends nt{constructor(t){super(),this.options=f(Object.create($m),t),_(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new rt("open")),this}isOpen(){return!!this._map}remove(){return this._content&&L.remove(this._content),this._container&&(L.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new rt("close")),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=uh.convert(t),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){const e=document.createDocumentFragment(),i=document.createElement("body");let r;for(i.innerHTML=t;r=i.firstChild,r;)e.appendChild(r);return this.setDOMContent(e)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=L.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){this._container&&this._container.classList.add(t)}removeClassName(t){this._container&&this._container.classList.remove(t)}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}_createCloseButton(){this.options.closeButton&&(this._closeButton=L.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(t){this._update(t.point)}_onMouseMove(t){this._update(t.point)}_onDrag(t){this._update(t.point)}_update(t){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(this._container||(this._container=L.create("div","maplibregl-popup",this._map.getContainer()),this._tip=L.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach((t=>this._container.classList.add(t))),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=bm(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const e=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let i=this.options.anchor;const r=Km(this.options.offset);if(!i){const t=this._container.offsetWidth,n=this._container.offsetHeight;let o;o=e.y+r.bottom.ythis._map.transform.height-n?["bottom"]:[],e.xthis._map.transform.width-t/2&&o.push("right"),i=0===o.length?"bottom":o.join("-")}const n=e.add(r[i]).round();L.setTransform(this._container,`${Sm[i]} translate(${n.x}px,${n.y}px)`),Tm(this._container,i,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(Wm);t&&t.focus()}_onClose(){this.remove()}},Marker:$f,Style:up,LngLat:uh,LngLatBounds:ph,Point:n,MercatorCoordinate:xh,Evented:nt,AJAXError:R,config:z,CanvasSource:Lh,GeoJSONSource:Mh,ImageSource:Ph,RasterDEMTileSource:Ch,RasterTileSource:wh,VectorTileSource:bh,VideoSource:Dh,prewarm:function(){Nu().acquire(Ou)},clearPrewarmedResources:function(){const t=ju;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(Ou),ju=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get version(){return Jm},get workerCount(){return Yh.workerCount},set workerCount(t){Yh.workerCount=t},get maxParallelImageRequests(){return z.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){z.MAX_PARALLEL_IMAGE_REQUESTS=t},get workerUrl(){return z.WORKER_URL},set workerUrl(t){z.WORKER_URL=t},addProtocol(t,e){z.REGISTERED_PROTOCOLS[t]=e},removeProtocol(t){delete z.REGISTERED_PROTOCOLS[t]}};return Qf.extend(tg,{isSafari:I,getPerformanceMetrics:om.getPerformanceMetrics}),tg}()},function(t,e,i){t.exports=i.p+"e3b1bd3256c6e2785c1c7786bf60a1a7.js"},function(t,e,i){t.exports=i.p+"c86dfb7f678440f25f72f0dd4ba5dd0d.js"},function(t,e,i){var r=i(83),n=i(467);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);r(n,{insert:"head",singleton:!1}),t.exports=n.locals||{}},function(t,e,i){(e=i(84)(!1)).push([t.i,".maplibregl-map{-webkit-tap-highlight-color:rgb(0 0 0/0);font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px #0000001a}@media (-ms-high-contrast:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:initial;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (-ms-high-contrast:active){.maplibregl-ctrl-icon{background-color:initial}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:#0000000d}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E\")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E\")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E\")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E\")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8h-8z'/%3E%3C/svg%3E\")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath fill='%23999' d='m10.5 16 4 8 4-8h-8z'/%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8h-8z'/%3E%3C/svg%3E\")}}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1 9-9z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1 9-9z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1 9-9z'/%3E%3C/svg%3E\")}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.255 1.255 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5.11 5.11 0 0 1 .314-.787l.009-.016a4.623 4.623 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.76 4.76 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 0 1 .689 1.004 4.73 4.73 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.815 5.815 0 0 1-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.778 4.778 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.47 4.47 0 0 1-1.935-.424 1.252 1.252 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.402 2.402 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 0 1-1.782 1.884 4.767 4.767 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.47 4.47 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 0 1-1.115.676h-.098a1.255 1.255 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 0 0-.668-.428l-.27-.12a3.293 3.293 0 0 0-1.235-.23c-.757 0-1.415.163-1.974.493a3.36 3.36 0 0 0-1.3 1.382c-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 0 0 1.382 1.381 3.883 3.883 0 0 0 1.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.17 2.17 0 0 0 .468-.29l.178-.161a2.163 2.163 0 0 0 .397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 0 0-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 0 0-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 0 0-.353-.389.851.851 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.626 2.626 0 0 0 .331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 0 0 1.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 0 0-.415.262l-.199.166a3.35 3.35 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 0 0-.284.136 1.99 1.99 0 0 0-.363.254 2.237 2.237 0 0 0-.46.569l-.082.162a2.56 2.56 0 0 0-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 0 0 .367.385.937.937 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a.995.995 0 0 0-.503.135l-.012.007a.859.859 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 0 0 .14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 0 0-.345-.79 1.175 1.175 0 0 0-.84-.329c-.34 0-.625.11-.855.33a1.053 1.053 0 0 0-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 0 0 .316.224l.223.122a3.21 3.21 0 0 0 1.44.322 3.785 3.785 0 0 0 1.875-.477 3.52 3.52 0 0 0 1.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 0 0-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 0 0-1.527.344l-.086.043-.165.09a3.412 3.412 0 0 0-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 0 0 .566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 0 0 .975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 0 0-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 0 0-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.868.868 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2.086 2.086 0 0 0-.411.148 2.18 2.18 0 0 0-.4.249 2.482 2.482 0 0 0-.485.499 2.659 2.659 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 0 1 .466-.636 2.52 2.52 0 0 1 .399-.253 2.19 2.19 0 0 1 .224-.099zm9.784 2.656.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 0 0-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 0 1-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 0 0-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 0 1-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 0 1 1.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 0 1 1.234.231 3.341 3.341 0 0 1 .97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 0 1-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 0 0-.807-.872 2.098 2.098 0 0 0-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 0 1-1.316 1.399 3.51 3.51 0 0 1-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 0 1-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 0 1-.856-.346 1.165 1.165 0 0 1-.346-.856 1.053 1.053 0 0 1 .346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 0 1 .345.79 1.159 1.159 0 0 1-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 0 1-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 0 1 1.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 0 1 1.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 0 1-1.382 1.366 3.785 3.785 0 0 1-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 0 0-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 0 1 1.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 0 1-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 0 1 1.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 0 0 .938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath fill='%23000' fill-opacity='.4' d='m8.166 16.146-.002.002a1.54 1.54 0 0 1-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 0 0 .113.023.286.286 0 0 0 .189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 0 0 .074.047zm-2.52-.548a16.898 16.898 0 0 1-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 0 1-1.182 1.315h.15a1.912 1.912 0 0 1 1.914 1.914v1.84a1.912 1.912 0 0 1-1.914 1.914H4.377a1.912 1.912 0 0 1-1.914-1.914v-1.84a1.912 1.912 0 0 1 1.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z'/%3E%3Cpath fill='%23e1e3e9' d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 0 1-.189.07.286.286 0 0 1-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z'/%3E%3Cpath fill='%23fff' d='M4.377 15.948a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659zm4.83 1.16H5.114v.838h4.093z'/%3E%3C/g%3E%3C/svg%3E\");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (-ms-high-contrast:active){a.maplibregl-ctrl-logo{background-color:initial;background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.255 1.255 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5.11 5.11 0 0 1 .314-.787l.009-.016a4.623 4.623 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.76 4.76 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 0 1 .689 1.004 4.73 4.73 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.815 5.815 0 0 1-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.778 4.778 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.47 4.47 0 0 1-1.935-.424 1.252 1.252 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.402 2.402 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 0 1-1.782 1.884 4.767 4.767 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.47 4.47 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 0 1-1.115.676h-.098a1.255 1.255 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 0 0-.668-.428l-.27-.12a3.293 3.293 0 0 0-1.235-.23c-.757 0-1.415.163-1.974.493a3.36 3.36 0 0 0-1.3 1.382c-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 0 0 1.382 1.381 3.883 3.883 0 0 0 1.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.17 2.17 0 0 0 .468-.29l.178-.161a2.163 2.163 0 0 0 .397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 0 0-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 0 0-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 0 0-.353-.389.851.851 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.626 2.626 0 0 0 .331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 0 0 1.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 0 0-.415.262l-.199.166a3.35 3.35 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 0 0-.284.136 1.99 1.99 0 0 0-.363.254 2.237 2.237 0 0 0-.46.569l-.082.162a2.56 2.56 0 0 0-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 0 0 .367.385.937.937 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a.995.995 0 0 0-.503.135l-.012.007a.859.859 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 0 0 .14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 0 0-.345-.79 1.175 1.175 0 0 0-.84-.329c-.34 0-.625.11-.855.33a1.053 1.053 0 0 0-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 0 0 .316.224l.223.122a3.21 3.21 0 0 0 1.44.322 3.785 3.785 0 0 0 1.875-.477 3.52 3.52 0 0 0 1.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 0 0-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 0 0-1.527.344l-.086.043-.165.09a3.412 3.412 0 0 0-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 0 0 .566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 0 0 .975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 0 0-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 0 0-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.868.868 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2.086 2.086 0 0 0-.411.148 2.18 2.18 0 0 0-.4.249 2.482 2.482 0 0 0-.485.499 2.659 2.659 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 0 1 .466-.636 2.52 2.52 0 0 1 .399-.253 2.19 2.19 0 0 1 .224-.099zm9.784 2.656.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 0 0-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 0 1-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 0 0-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 0 1-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 0 1 1.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 0 1 1.234.231 3.341 3.341 0 0 1 .97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 0 1-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 0 0-.807-.872 2.098 2.098 0 0 0-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 0 1-1.316 1.399 3.51 3.51 0 0 1-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 0 1-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 0 1-.856-.346 1.165 1.165 0 0 1-.346-.856 1.053 1.053 0 0 1 .346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 0 1 .345.79 1.159 1.159 0 0 1-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 0 1-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 0 1 1.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 0 1 1.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 0 1-1.382 1.366 3.785 3.785 0 0 1-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 0 0-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 0 1 1.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 0 1-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 0 1 1.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 0 0 .938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath fill='%23000' fill-opacity='.4' d='m8.166 16.146-.002.002a1.54 1.54 0 0 1-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 0 0 .113.023.286.286 0 0 0 .189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 0 0 .074.047zm-2.52-.548a16.898 16.898 0 0 1-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 0 1-1.182 1.315h.15a1.912 1.912 0 0 1 1.914 1.914v1.84a1.912 1.912 0 0 1-1.914 1.914H4.377a1.912 1.912 0 0 1-1.914-1.914v-1.84a1.912 1.912 0 0 1 1.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z'/%3E%3Cpath fill='%23e1e3e9' d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 0 1-.189.07.286.286 0 0 1-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z'/%3E%3Cpath fill='%23fff' d='M4.377 15.948a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659zm4.83 1.16H5.114v.838h4.093z'/%3E%3C/g%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){a.maplibregl-ctrl-logo{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.255 1.255 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5.11 5.11 0 0 1 .314-.787l.009-.016a4.623 4.623 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.76 4.76 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 0 1 .689 1.004 4.73 4.73 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.815 5.815 0 0 1-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.778 4.778 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.47 4.47 0 0 1-1.935-.424 1.252 1.252 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.402 2.402 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 0 1-1.782 1.884 4.767 4.767 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.47 4.47 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 0 1-1.115.676h-.098a1.255 1.255 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 0 0-.668-.428l-.27-.12a3.293 3.293 0 0 0-1.235-.23c-.757 0-1.415.163-1.974.493a3.36 3.36 0 0 0-1.3 1.382c-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 0 0 1.382 1.381 3.883 3.883 0 0 0 1.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.17 2.17 0 0 0 .468-.29l.178-.161a2.163 2.163 0 0 0 .397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 0 0-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 0 0-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 0 0-.353-.389.851.851 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.626 2.626 0 0 0 .331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 0 0 1.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 0 0-.415.262l-.199.166a3.35 3.35 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 0 0-.284.136 1.99 1.99 0 0 0-.363.254 2.237 2.237 0 0 0-.46.569l-.082.162a2.56 2.56 0 0 0-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 0 0 .367.385.937.937 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a.995.995 0 0 0-.503.135l-.012.007a.859.859 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 0 0 .14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 0 0-.345-.79 1.175 1.175 0 0 0-.84-.329c-.34 0-.625.11-.855.33a1.053 1.053 0 0 0-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 0 0 .316.224l.223.122a3.21 3.21 0 0 0 1.44.322 3.785 3.785 0 0 0 1.875-.477 3.52 3.52 0 0 0 1.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 0 0-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 0 0-1.527.344l-.086.043-.165.09a3.412 3.412 0 0 0-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 0 0 .566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 0 0 .975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 0 0-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 0 0-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.868.868 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2.086 2.086 0 0 0-.411.148 2.18 2.18 0 0 0-.4.249 2.482 2.482 0 0 0-.485.499 2.659 2.659 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 0 1 .466-.636 2.52 2.52 0 0 1 .399-.253 2.19 2.19 0 0 1 .224-.099zm9.784 2.656.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 0 0-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 0 1-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 0 0-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 0 1-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 0 1 1.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 0 1 1.234.231 3.341 3.341 0 0 1 .97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 0 1-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 0 0-.807-.872 2.098 2.098 0 0 0-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 0 1-1.316 1.399 3.51 3.51 0 0 1-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 0 1-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 0 1-.856-.346 1.165 1.165 0 0 1-.346-.856 1.053 1.053 0 0 1 .346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 0 1 .345.79 1.159 1.159 0 0 1-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 0 1-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 0 1 1.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 0 1 1.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 0 1-1.382 1.366 3.785 3.785 0 0 1-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 0 0-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 0 1 1.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 0 1-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 0 1 1.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 0 0 .938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath fill='%23000' fill-opacity='.4' d='m8.166 16.146-.002.002a1.54 1.54 0 0 1-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 0 0 .113.023.286.286 0 0 0 .189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 0 0 .074.047zm-2.52-.548a16.898 16.898 0 0 1-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 0 1-1.182 1.315h.15a1.912 1.912 0 0 1 1.914 1.914v1.84a1.912 1.912 0 0 1-1.914 1.914H4.377a1.912 1.912 0 0 1-1.914-1.914v-1.84a1.912 1.912 0 0 1 1.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z'/%3E%3Cpath fill='%23e1e3e9' d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 0 1-.189.07.286.286 0 0 1-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z'/%3E%3Cpath fill='%23fff' d='M4.377 15.948a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659zm4.83 1.16H5.114v.838h4.093z'/%3E%3C/g%3E%3C/svg%3E\")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:#ffffff80;margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:initial;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:#ffffff80;background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:#0000000d}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (-ms-high-contrast:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\")}}@media screen and (-ms-high-contrast:black-on-white){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\")}}.maplibregl-ctrl-attrib a{color:#000000bf;text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:#ffffffbf;border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid #0000;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:initial;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:#0000000d}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px #0000001a;padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:\"\";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px #00000059;box-sizing:border-box;content:\"\";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:#0006;color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(width <= 480px){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999}",""]),t.exports=e},function(t,e,i){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var n=r(i(469)),o=r(i(273)),a=r(i(218)),l=i(86),c=i(105);e.default=function(t,e,i){void 0===i&&(i={});for(var r=c.getGeom(t).coordinates,u=0,h=0;h=u&&h===r.length-1);h++){if(u>=e){var p=e-u;if(p){var d=n.default(r[h],r[h-1])-180;return o.default(r[h],p,d,i)}return l.point(r[h])}u+=a.default(r[h],r[h+1],i)}return l.point(r[r.length-1])}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(86),n=i(105);e.default=function t(e,i,o){if(void 0===o&&(o={}),!0===o.final)return function(e,i){var r=t(i,e);return(r+180)%360}(e,i);var a=n.getCoord(e),l=n.getCoord(i),c=r.degreesToRadians(a[0]),u=r.degreesToRadians(l[0]),h=r.degreesToRadians(a[1]),p=r.degreesToRadians(l[1]),d=Math.sin(u-c)*Math.cos(p),f=Math.cos(h)*Math.sin(p)-Math.sin(h)*Math.cos(p)*Math.cos(u-c);return r.radiansToDegrees(Math.atan2(d,f))}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(124),n=6378137;function o(t){var e=0;if(t&&t.length>0){e+=Math.abs(a(t[0]));for(var i=1;i2){for(c=0;c3?n.polygon([r]):null}},function(t,e,i){"use strict";var r=i(474),n=i(475),o=i(476);const a=i(477).orient2d;function l(t,e,i){e=Math.max(0,void 0===e?2:e),i=i||0;var n=function(t){for(var e=t[0],i=t[0],r=t[0],n=t[0],a=0;ar[0]&&(r=l),l[1]n[1]&&(n=l)}var c=[e,i,r,n],u=c.slice();for(a=0;a=2&&f(e[e.length-2],e[e.length-1],t[i])<=0;)e.pop();e.push(t[i])}for(var r=[],n=t.length-1;n>=0;n--){for(;r.length>=2&&f(r[r.length-2],r[r.length-1],t[n])<=0;)r.pop();r.push(t[n])}return r.pop(),e.pop(),e.concat(r)}(u)}(t),a=new r(16);a.toBBox=function(t){return{minX:t[0],minY:t[1],maxX:t[0],maxY:t[1]}},a.compareMinX=function(t,e){return t[0]-e[0]},a.compareMinY=function(t,e){return t[1]-e[1]},a.load(t);for(var l,u=[],h=0;ha||c.push({node:m,dist:g})}for(;c.length&&!c.peek().node.children;){var y=c.pop(),v=y.node,x=_(v,e,i),b=_(v,r,o);if(y.dist=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function d(t,e,i){for(var r,n,o,a,l=Math.min(t[0],e[0]),c=Math.min(t[1],e[1]),u=Math.max(t[0],e[0]),h=Math.max(t[1],e[1]),p=i.search({minX:l,minY:c,maxX:u,maxY:h}),d=0;d0!=f(r,n,a)>0&&f(o,a,r)>0!=f(o,a,n)>0)return!1;return!0}function f(t,e,i){return a(t[0],t[1],e[0],e[1],i[0],i[1])}function m(t){var e=t.p,i=t.next.p;return t.minX=Math.min(e[0],i[0]),t.minY=Math.min(e[1],i[1]),t.maxX=Math.max(e[0],i[0]),t.maxY=Math.max(e[1],i[1]),t}function g(t,e){var i={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return e?(i.next=e.next,i.prev=e,e.next.prev=i,e.next=i):(i.prev=i,i.next=i),i}function y(t,e){var i=t[0]-e[0],r=t[1]-e[1];return i*i+r*r}function _(t,e,i){var r=e[0],n=e[1],o=i[0]-r,a=i[1]-n;if(0!==o||0!==a){var l=((t[0]-r)*o+(t[1]-n)*a)/(o*o+a*a);l>1?(r=i[0],n=i[1]):l>0&&(r+=o*l,n+=a*l)}return(o=t[0]-r)*o+(a=t[1]-n)*a}function v(t,e,i,r,n,o,a,l){var c,u,h,p,d=i-t,f=r-e,m=a-n,g=l-o,y=t-n,_=e-o,v=d*d+f*f,x=d*m+f*g,b=m*m+g*g,w=d*y+f*_,C=m*y+g*_,S=v*b-x*x,M=S,T=S;0===S?(u=0,M=1,p=C,T=b):(p=v*C-x*w,(u=x*C-b*w)<0?(u=0,p=C,T=b):u>M&&(u=M,p=C+x,T=b)),p<0?(p=0,-w<0?u=0:-w>v?u=M:(u=-w,M=v)):p>T&&(p=T,-w+x<0?u=0:-w+x>v?u=M:(u=-w+x,M=v));var E=(1-(h=0===p?0:p/T))*n+h*a-((1-(c=0===u?0:u/M))*t+c*i),A=(1-h)*o+h*l-((1-c)*e+c*r);return E*E+A*A}function x(t,e){return t[0]===e[0]?t[1]-e[1]:t[0]-e[0]}t.exports=l,t.exports.default=l},function(t,e,i){t.exports=function(){"use strict";function t(t,r,n,o,a){!function t(i,r,n,o,a){for(;o>n;){if(o-n>600){var l=o-n+1,c=r-n+1,u=Math.log(l),h=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*h*(l-h)/l)*(c-l/2<0?-1:1);t(i,r,Math.max(n,Math.floor(r-c*h/l+p)),Math.min(o,Math.floor(r+(l-c)*h/l+p)),a)}var d=i[r],f=n,m=o;for(e(i,n,r),a(i[o],d)>0&&e(i,n,o);f0;)m--}0===a(i[n],d)?e(i,n,m):e(i,++m,o),m<=r&&(n=m+1),r<=m&&(o=m-1)}}(t,r,n||0,o||t.length-1,a||i)}function e(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function i(t,e){return te?1:0}var r=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function n(t,e,i){if(!i)return e.indexOf(t);for(var r=0;r=t.minX&&e.maxY>=t.minY}function m(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function g(e,i,r,n,o){for(var a=[i,r];a.length;)if(!((r=a.pop())-(i=a.pop())<=n)){var l=i+Math.ceil((r-i)/n/2)*n;t(e,l,i,r,o),a.push(i,l,l,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(t){var e=this.data,i=[];if(!f(t,e))return i;for(var r=this.toBBox,n=[];e;){for(var o=0;o=0&&n[e].children.length>this._maxEntries;)this._split(n,e),e--;this._adjustParentBBoxes(r,n,e)},r.prototype._split=function(t,e){var i=t[e],r=i.children.length,n=this._minEntries;this._chooseSplitAxis(i,n,r);var a=this._chooseSplitIndex(i,n,r),l=m(i.children.splice(a,i.children.length-a));l.height=i.height,l.leaf=i.leaf,o(i,this.toBBox),o(l,this.toBBox),e?t[e-1].children.push(l):this._splitRoot(i,l)},r.prototype._splitRoot=function(t,e){this.data=m([t,e]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(t,e,i){for(var r,n,o,l,c,u,p,d=1/0,f=1/0,m=e;m<=i-e;m++){var g=a(t,0,m,this.toBBox),y=a(t,m,i,this.toBBox),_=(n=g,o=y,void 0,void 0,void 0,void 0,l=Math.max(n.minX,o.minX),c=Math.max(n.minY,o.minY),u=Math.min(n.maxX,o.maxX),p=Math.min(n.maxY,o.maxY),Math.max(0,u-l)*Math.max(0,p-c)),v=h(g)+h(y);_=e;f--){var m=t.children[f];l(c,t.leaf?n(m):m),u+=p(c)}return u},r.prototype._adjustParentBBoxes=function(t,e,i){for(var r=i;r>=0;r--)l(e[r],t)},r.prototype._condense=function(t){for(var e=t.length-1,i=void 0;e>=0;e--)0===t[e].children.length?e>0?(i=t[e-1].children).splice(i.indexOf(t[e]),1):this.clear():o(t[e],this.toBBox)},r}()},function(t,e,i){t.exports=function(){"use strict";var t=function(t,i){if(void 0===t&&(t=[]),void 0===i&&(i=e),this.data=t,this.length=this.data.length,this.compare=i,this.length>0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)};function e(t,e){return te?1:0}return t.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1)},t.prototype.pop=function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}},t.prototype.peek=function(){return this.data[0]},t.prototype._up=function(t){for(var e=this.data,i=this.compare,r=e[t];t>0;){var n=t-1>>1,o=e[n];if(i(r,o)>=0)break;e[t]=o,t=n}e[t]=r},t.prototype._down=function(t){for(var e=this.data,i=this.compare,r=this.length>>1,n=e[t];t=0)break;e[t]=a,t=o}e[t]=n},t}()},function(t,e){t.exports=function(t,e){for(var i=t[0],r=t[1],n=!1,o=0,a=e.length-1;or!=h>r&&i<(u-l)*(r-c)/(h-c)+l&&(n=!n)}return n}},function(t,e,i){!function(t){"use strict";const e=134217729;function i(t,e,i,r,n){let o,a,l,c,u=e[0],h=r[0],p=0,d=0;h>u==h>-u?(o=u,u=e[++p]):(o=h,h=r[++d]);let f=0;if(pu==h>-u?(l=o-((a=u+o)-u),u=e[++p]):(l=o-((a=h+o)-h),h=r[++d]),o=a,0!==l&&(n[f++]=l);pu==h>-u?(l=o-((a=o+u)-(c=a-o))+(u-c),u=e[++p]):(l=o-((a=o+h)-(c=a-o))+(h-c),h=r[++d]),o=a,0!==l&&(n[f++]=l);for(;p0!=m>0)return g;const y=Math.abs(f+m);return Math.abs(g)>=33306690738754716e-32*y?g:-function(t,r,u,h,p,d,f){let m,g,y,_,v,x,b,w,C,S,M,T,E,A,I,P,O,k;const F=t-p,D=u-p,z=r-d,j=h-d;v=(I=(w=F-(b=(x=e*F)-(x-F)))*(S=j-(C=(x=e*j)-(x-j)))-((A=F*j)-b*C-w*C-b*S))-(M=I-(O=(w=z-(b=(x=e*z)-(x-z)))*(S=D-(C=(x=e*D)-(x-D)))-((P=z*D)-b*C-w*C-b*S))),n[0]=I-(M+v)+(v-O),v=(E=A-((T=A+M)-(v=T-A))+(M-v))-(M=E-P),n[1]=E-(M+v)+(v-P),v=(k=T+M)-T,n[2]=T-(k-v)+(M-v),n[3]=k;let N=function(t,e){let i=e[0];for(let t=1;t<4;t++)i+=e[t];return i}(0,n),B=22204460492503146e-32*f;if(N>=B||-N>=B)return N;if(m=t-(F+(v=t-F))+(v-p),y=u-(D+(v=u-D))+(v-p),g=r-(z+(v=r-z))+(v-d),_=h-(j+(v=h-j))+(v-d),0===m&&0===g&&0===y&&0===_)return N;if(B=11093356479670487e-47*f+33306690738754706e-32*Math.abs(N),(N+=F*_+j*m-(z*y+D*g))>=B||-N>=B)return N;v=(I=(w=m-(b=(x=e*m)-(x-m)))*(S=j-(C=(x=e*j)-(x-j)))-((A=m*j)-b*C-w*C-b*S))-(M=I-(O=(w=g-(b=(x=e*g)-(x-g)))*(S=D-(C=(x=e*D)-(x-D)))-((P=g*D)-b*C-w*C-b*S))),c[0]=I-(M+v)+(v-O),v=(E=A-((T=A+M)-(v=T-A))+(M-v))-(M=E-P),c[1]=E-(M+v)+(v-P),v=(k=T+M)-T,c[2]=T-(k-v)+(M-v),c[3]=k;const V=i(4,n,4,c,o);v=(I=(w=F-(b=(x=e*F)-(x-F)))*(S=_-(C=(x=e*_)-(x-_)))-((A=F*_)-b*C-w*C-b*S))-(M=I-(O=(w=z-(b=(x=e*z)-(x-z)))*(S=y-(C=(x=e*y)-(x-y)))-((P=z*y)-b*C-w*C-b*S))),c[0]=I-(M+v)+(v-O),v=(E=A-((T=A+M)-(v=T-A))+(M-v))-(M=E-P),c[1]=E-(M+v)+(v-P),v=(k=T+M)-T,c[2]=T-(k-v)+(M-v),c[3]=k;const U=i(V,o,4,c,a);v=(I=(w=m-(b=(x=e*m)-(x-m)))*(S=_-(C=(x=e*_)-(x-_)))-((A=m*_)-b*C-w*C-b*S))-(M=I-(O=(w=g-(b=(x=e*g)-(x-g)))*(S=y-(C=(x=e*y)-(x-y)))-((P=g*y)-b*C-w*C-b*S))),c[0]=I-(M+v)+(v-O),v=(E=A-((T=A+M)-(v=T-A))+(M-v))-(M=E-P),c[1]=E-(M+v)+(v-P),v=(k=T+M)-T,c[2]=T-(k-v)+(M-v),c[3]=k;const H=i(U,a,4,c,l);return l[H-1]}(t,r,u,h,p,d,y)},t.orient2dfast=function(t,e,i,r,n,o){return(e-o)*(i-n)-(t-n)*(r-o)},Object.defineProperty(t,"__esModule",{value:!0})}(e)},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(124),n=i(86);e.default=function(t,e){void 0===e&&(e={});var i=0,o=0,a=0;return r.coordEach(t,(function(t){i+=t[0],o+=t[1],a++})),n.point([i/a,o/a],e.properties)}},function(t,e,i){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var n=r(i(218)),o=i(124);e.default=function(t,e){return void 0===e&&(e={}),o.segmentReduce(t,(function(t,i){var r=i.geometry.coordinates;return t+n.default(r[0],r[1],e)}),0)}}])]);