/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import{b as o}from"./2I5LGZNX.js";import{E as l,F as p,G as m,h as r,i}from"./FFF5HUPM.js";import"./EXBEKVP5.js";export default $arcgis.t(([d])=>{var b=r`.display-block{display:block}`,e=class extends m{constructor(){super(...arguments),this.basemapGalleryRef=l(),this._basemapGalleryReady=()=>{this._updateBasemapSource()}}static{this.properties={basemapGalleryRef:0,mapView:0,basemapConfig:0}}static{this.styles=b}willUpdate(a){a.has("basemapConfig")&&this.basemapConfigWatchHandler()}async basemapConfigWatchHandler(){await this._updateBasemapSource()}render(){return this.mapView&&i`<arcgis-basemap-gallery auto-destroy-disabled .view=${this.mapView} @arcgisReady=${this._basemapGalleryReady} ${p(this.basemapGalleryRef)}></arcgis-basemap-gallery>`||""}disconnectedCallback(){super.disconnectedCallback(),this.basemapGalleryRef.value&&this.basemapGalleryRef.value.destroy()}async _updateBasemapSource(){let a=this.basemapGalleryRef.value;if(!a)return;let c=n=>{let t=n.portalItem?.id;return!t||!this.basemapConfig?!0:!this.basemapConfig.basemapIdsToFilter.includes(t)},s=new d({query:this.basemapConfig?.basemapGroupId?`id:${this.basemapConfig.basemapGroupId}`:null,filterFunction:c});await s.refresh(),a.source=s}};o("map-basemap-gallery",e);return e},"widgets/BasemapGallery/support/PortalBasemapsSource")