/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import{a as S}from"./XMXQOWXC.js";import"./YMMGYOOO.js";import f from"./U2FD6RFU.js";import e from"./YFLYHPA6.js";import"./W4YXXJAS.js";import"./77CU4WA2.js";import"./TRGFYBOH.js";import c from"./N6IQW2WT.js";import a from"./C2LXNVZ5.js";import{a as L}from"./6S75SIVV.js";import"./5IZMQFRP.js";import"./FOQPGXXA.js";import"./ED6SUP22.js";import"./E6P6PYNW.js";import"./IKKBLHLZ.js";import"./CUA2IUXX.js";import"./4UZDZNJD.js";import"./KOTG6W5Z.js";import"./6SC7YR5Y.js";import"./Z6NOHRUL.js";import"./GVM4XYEI.js";import"./NGDVSE4Z.js";import"./BTNJZZQQ.js";import"./ZYQ4P2ON.js";import"./5MKH4QDV.js";import"./3GWWHA4S.js";import"./3YYHZQJB.js";import"./JEJ23R3P.js";import"./TONS7KZJ.js";import"./Q62UEPOL.js";import"./44A5XEM4.js";import{b as v}from"./ABSRNM72.js";import{F as p,G as r,H as I,J as b,h as _,i as l,l as m,r as d,u as g}from"./5CQPQ7AE.js";import"./3QPJ2JCA.js";export default $arcgis.t(([k,F,x,,{c:w,j:M},{f:u},{n:$}])=>{function C(n){return n?.indexOf("http://")!==-1}function f(n){return C(n)?n.replace(/^http:\/\//,"https://"):n}function T(n,e,t){return t&&t.forEach(a=>{n.allLayers.forEach(i=>{i&&i.url===a.sourceUrl&&(i.url=f(a.proxyUrl),i.portalItem&&i.portalItem.when(()=>{i.portalItem.url=f(a.proxyUrl)}),e.request?.interceptors?.push({urls:a.sourceUrl,before:s=>{s.url&&s.url===a.sourceUrl&&(s.url=f(a.proxyUrl))}}))})}),n}var V=_`@layer{
/** @license
 * Copyright 2025 Esri
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

:host {
  display: block;
  --calcite-label-margin-bottom: 0;
  --calcite-block-padding: 0;
}

.map-height {
  height: calc(100% - 53px);
}

.height-full {
  height: 100%;
}

.height-49-px {
  height: 49px;
}

.box-shadow {
  box-shadow: none !important;
}

.visibility-hidden-1 {
  visibility: hidden;
  height: 1px;
  /* setting to 1 as 0 would cause the editor to not load in some cases */
}

.hidden {
  visibility: hidden !important;
}

.display-flex {
  display: flex;
}

.display-none {
  display: none;
}

.display-block {
  display: block;
}

.absolute-right {
  position: absolute;
  right: 0;
  left: unset;
}

.esri-ui-inner-container.esri-ui-corner-container {
  direction: ltr;
}

html[dir='rtl'] .absolute-right {
  left: 0;
  right: unset;
}

.panel-header-override {
  --calcite-panel-header-content-space: 0px;
  --calcite-internal-panel-action-spacing: 0px !important;
}

@media only screen and (max-width: 1024px) {
  .esri-zoom {
    display: none !important;
  }
}

calcite-action-bar {
  --calcite-internal-action-bar-gap: 0px;
  --calcite-internal-action-bar-padding: 0px;
}
}`,y=class extends I{constructor(){super(),this.defaultWebmapId="",this.defaultLayerId="",this.enableHome=!1,this.enableLegend=!1,this.enableLayerList=!0,this.enableFloorFilter=!1,this.enableFullscreen=!1,this.enableShare=!1,this.enableMapLayerPicker=!1,this.enableMapPicker=!1,this.enableSingleExpand=!1,this.enableSearch=!1,this.enableBasemap=!1,this.featureSelectionMode="multiple",this.hide=!1,this.zoomToolsSize="m",this.mapInfos=[],this.mapWidgetsIndex=0,this.mapWidgetsPosition="top-leading",this.mobileMapWidgetsPosition="top-right",this.mapWidgetsSize="m",this.stackTools=!1,this.mapToolsOrder=[],this.mobileToolsOrder=[],this.isMapLayout=!1,this.shareIncludeEmbed=!1,this.shareIncludeSocial=!1,this.selectedFeaturesIds=[],this.showOnlyUpdatableLayers=!1,this.isMobile=!1,this.enableSelectionTool=!1,this.visibilityIcon="eyeball",this._configLayerOrderDefined=!1,this._translations=L({name:"map-card",blocking:!0}),this._toolInfos=[],this._filterActive=!1,this._layerIds=[],this._enabledLayerIds=[],this._defaultWebmapHonored=!1,this._loadedId="",this._mapDiv=p(),this._mapPicker=p(),this._mapTools=p(),this._mobMapTools=p(),this._mapLayerPicker=p(),this._selectedWebMapId="",this._isValidWebMap=!0,this.mapChanged=d(),this.beforeMapChanged=d(),this.toggleFilter=d(),this.clearSelection=d(),this.editMultipleFeatures=d(),this.listenOn(window,"mapInfoChange",this.mapInfoChange),this.listenOn(window,"noLayersFound",this.noLayersFound),this.listenOn(window,"layerSelectionChange",this.layerSelectionChange),this.listenOn(window,"idsFound",this._idsFound),this.enableSingleExpand=!0,this.stackTools=!0,S(window)}static{this.properties={appLayout:1,appProxies:1,defaultWebmapId:1,defaultLayerId:1,enableHome:[5,{},{type:Boolean}],enableLegend:[5,{},{type:Boolean}],enableLayerList:[5,{},{type:Boolean}],enableFloorFilter:[5,{},{type:Boolean}],enableFullscreen:[5,{},{type:Boolean}],enableShare:[5,{},{type:Boolean}],enableMapLayerPicker:[5,{},{type:Boolean}],enableMapPicker:[5,{},{type:Boolean}],enableSingleExpand:[5,{},{type:Boolean}],enableSearch:[5,{},{type:Boolean}],enableBasemap:[5,{},{type:Boolean}],featureSelectionMode:1,basemapConfig:[0,{},{attribute:!1}],hide:[5,{},{type:Boolean}],zoomToolsSize:1,mapInfos:[0,{},{attribute:!1}],mapWidgetsIndex:[9,{},{type:Number}],mapWidgetsPosition:1,mobileMapWidgetsPosition:1,mapWidgetsSize:1,mapView:[0,{},{attribute:!1}],stackTools:[5,{},{type:Boolean}],theme:1,mapToolsOrder:[0,{},{attribute:!1}],mobileToolsOrder:[0,{},{attribute:!1}],isMapLayout:[5,{},{type:Boolean}],shareIncludeEmbed:[5,{},{type:Boolean}],shareIncludeSocial:[5,{},{type:Boolean}],selectedFeaturesIds:[0,{},{attribute:!1}],selectedLayer:[0,{},{attribute:!1}],zoomToScale:[9,{},{type:Number}],showOnlyUpdatableLayers:[5,{},{type:Boolean}],isMobile:[5,{},{type:Boolean}],mapInfo:[0,{},{attribute:!1}],enableSelectionTool:[5,{},{type:Boolean}],visibilityIcon:1,_configLayerOrderDefined:[16,{},{state:!0}],_translations:[16,{},{state:!0}],_searchConfiguration:[16,{},{state:!0}],_webMapInfo:[16,{},{state:!0}],_toolInfos:[16,{},{state:!0}],_filterActive:[16,{},{state:!0}],_mapDivHeight:[16,{},{state:!0}],_mapDivWidth:[16,{},{state:!0}],_layerIds:[16,{},{state:!0}]}}static{this.styles=V}static{this.shadowRootOptions=g}willUpdate(e){e.has("appLayout")&&this.appLayoutWatchHandler(),e.has("mapView")&&this.mapViewWatchHandler(),e.has("mapInfo")&&this.mapInfoWatchHandler(),e.has("selectedFeaturesIds")&&this.selectedFeaturesIdsWatchHandler()}appLayoutWatchHandler(){this._updateShareUrl()}async mapInfoWatchHandler(){this._configLayerOrderDefined="configLayerOrder"in(this.mapInfo?.layerOptions||{}),this._enabledLayerIds=$(this.mapInfo?.layerOptions?.layers||[],this.mapInfo?.layerOptions?.configLayerOrder)}async mapViewWatchHandler(){this.mapView&&this._updateShareUrl()}async selectedFeaturesIdsWatchHandler(){this._updateShareUrl(),this._validateEnabledActions()}async resetFilter(){this._filterActive=!1,this._updateShareUrl()}async updateFilterState(e){this._filterActive=e,this._updateShareUrl()}async updateLayer(){this._mapLayerPicker.value&&this._mapLayerPicker.value.updateLayer()}async mapInfoChange(e){this._selectedWebMapId=e.detail.id,await this._loadMap(e.detail)}noLayersFound(){this.selectedLayer=void 0,this.selectedFeaturesIds=[]}layerSelectionChange(){setTimeout(()=>{this._initToolInfos()},50)}_idsFound(e){this._layerIds=e.detail}async load(){this._initToolInfos(),this._mapSizeObserver||(this._mapSizeObserver=new ResizeObserver(()=>{this._mapDivWidth&&this._mapDiv.value&&(this._mapDivWidth=this._mapDiv.value.offsetWidth)}))}render(){let e=this.hide?"visibility-hidden-1":"",t=this.theme==="dark"?"calcite-mode-dark":"calcite-mode-light",a="height-full",i=this.isMapLayout?"":"display-none",s=this._isValidWebMap?"":"hidden",h=this.isMobile?"":"hidden",o=this.enableMapPicker&&this.mapInfos.length>1,c=this.enableMapLayerPicker&&this._layerIds.length>1;return this._handleMapVisibility(),this._validateActiveActions(),l`<calcite-panel class="height-full width-full panel-header-override">${this._getMapLayerPicker()}${this._getHeaderActions()}<div slot=header-actions-end>${this.enableShare&&this.isMapLayout?this._getShare("share"):void 0}</div><calcite-progress class=${b(i)} value=0></calcite-progress><div class=${`${e} ${a}`}><div class="height-full" ${r(this._mapDiv)}></div></div>${l`<map-tools .basemapConfig=${this.basemapConfig} class=${`box-shadow ${t} ${s}`} .defaultLayerId=${this.defaultLayerId} .enableBasemap=${this.enableBasemap} .enableFloorFilter=${this.enableFloorFilter} .enableFullscreen=${this.enableFullscreen} .enableHome=${this.enableHome} .enableLegend=${this.enableLegend} .enableLayerList=${this.enableLayerList} .enableSearch=${this.enableSearch} .enableSingleExpand=${this.enableSingleExpand} .enableSelectionTool=${this.enableSelectionTool} .isMobile=${this.isMobile} .parentComponentHeight=${this._mapDivHeight} .parentComponentWidth=${this._mapDivWidth} .zoomToolsSize=${this.zoomToolsSize} layout=horizontal .mapView=${this.mapView} .mapWidgetsSize=${this.mapWidgetsSize} .position=${this.mapWidgetsPosition} .selectedFeaturesIds=${this.selectedFeaturesIds} .selectedLayer=${this.selectedLayer} .searchConfiguration=${this._searchConfiguration} .stackTools=${this.stackTools} .toolOrder=${this.mapToolsOrder} .visibilityIcon=${this.visibilityIcon} ${r(this._mapTools)}></map-tools><map-tools class=${`box-shadow ${t} ${h}`} .defaultLayerId=${this.defaultLayerId} .enabledLayerIds=${this._enabledLayerIds} .enableMapLayerPicker=${c} .enableMapPicker=${o} .isMobile=${this.isMobile} .zoomToolsSize=${this.zoomToolsSize} layout=vertical .mapInfos=${this.mapInfos} .mapView=${this.mapView} .mapWidgetsSize=${this.mapWidgetsSize} .parentComponentHeight=${this._mapDivHeight} .position=${this.mobileMapWidgetsPosition} .selectedLayer=${this.selectedLayer} .selectedWebMapId=${this._selectedWebMapId} .showOnlyUpdatableLayers=${this.showOnlyUpdatableLayers} .stackTools=${this.stackTools} .toolOrder=${this.mobileToolsOrder} ${r(this._mobMapTools)}></map-tools>`}</calcite-panel>`}updated(){this._mapDivHeight=this._mapDiv.value?.offsetHeight??0,document.onclick=e=>this._handleDocumentClick(e)}loaded(){this._mapDiv.value&&this._mapSizeObserver?.observe(this._mapDiv.value),this._updateShareUrl()}async _loadMap(e){let t=!this._defaultWebmapHonored&&this.defaultWebmapId,a=this.mapInfos?.filter(o=>o.id===this.defaultWebmapId),i=JSON.stringify(e)!==JSON.stringify(this._webMapInfo);this._webMapInfo=t&&a?a[0]:!e?.id&&this.mapInfos.length>0?this.mapInfos[0]:e;let s=this._webMapInfo.id,h=t&&e?.id===this.defaultWebmapId;if(this._loadedId!==s&&!t||h){let o=new x({portalItem:{id:s}});try{o&&await o.load(),this.appProxies&&o&&await T(o,k,this.appProxies),this.mapView=new F({container:this._mapDiv.value,map:o,resizeAlign:"center"}),this._loadedId=s,this._searchConfiguration=this._webMapInfo.searchConfiguration,this.beforeMapChanged.emit(),this.mapView&&await this.mapView.when(()=>{this.mapView&&(this._mapDivWidth=this._mapDiv.value&&this._mapDiv.value.offsetWidth,this._mapTools.value&&this.mapView.ui.add(this._mapTools.value,{position:this.mapWidgetsPosition,index:this.mapWidgetsIndex}),this._mobMapTools.value&&this.mapView.ui.add(this._mobMapTools.value,{position:this.mobileMapWidgetsPosition,index:this.mapWidgetsIndex}),this._defaultWebmapHonored=h?!0:this._defaultWebmapHonored,this._isValidWebMap=!0,this.mapChanged.emit({id:s,mapView:this.mapView,isValid:!0}),this.isMobile||document.getElementsByClassName("esri-zoom")[0]?.classList.remove("display-none"))})}catch(c){console.error(c),this._loadedId=s,this._isValidWebMap=!1,this.mapChanged.emit({id:s,mapView:void 0,isValid:!1}),document.getElementsByClassName("esri-zoom")[0]?.classList.add("display-none");return}}else t?(this._defaultWebmapHonored=!0,this._mapPicker.value&&this._mapPicker.value.setMapByID(s)):i&&this.mapView&&(this._searchConfiguration=this._webMapInfo.searchConfiguration,this.beforeMapChanged.emit(),this.mapChanged.emit({id:s,mapView:this.mapView,isValid:!0}));this._updateShareUrl()}_getMapLayerPicker(){let e=this.isMapLayout?"header-actions-start":"",t=this.mapInfos?.length>1?"":"display-none",a=this.isMapLayout?"height-0":"width-full",i="display-flex",s=this.isMapLayout?"":"display-none";return l`${!this.isMobile&&l`<div slot=${e??m}><map-picker class=${`${t} ${a}`} id=map-picker .isMapLayout=${this.isMapLayout} .mapInfos=${this.mapInfos} .selectedWebMapId=${this._selectedWebMapId} ${r(this._mapPicker)}></map-picker></div>`||""}<div slot=header-actions-start class=${`mapView-header display-flex ${s}`} id=solutions-map-layer-picker-container><div class=${`border-end ${i}`}>${this.mapView&&l`<map-layer-picker appearance=transparent .configLayerOrderDefined=${this._configLayerOrderDefined} .defaultLayerId=${this.defaultLayerId} display=inline-flex .enabledLayerIds=${this._enabledLayerIds} height=50 .isMobile=${this.isMobile} .mapView=${this.mapView} .showOnlyUpdatableLayers=${this.showOnlyUpdatableLayers} placeholder-icon=layers scale=l .selectedIds=${this.selectedLayer?[this.selectedLayer.id]:[]} show-single-layer-as-label show-tables show-tables-disabled type=dropdown ${r(this._mapLayerPicker)}></map-layer-picker>`||""}</div></div>`}_getHeaderActions(){return l`<div slot=header-content><calcite-action-bar class=${b("display-flex")} expand-disabled expanded id=${this._getId("bar")??m} layout=horizontal><calcite-action-group>${this.isMapLayout?this._getActions():void 0}</calcite-action-group></calcite-action-bar></div>`}_getShare(e){return l`<div class="share-action" id=${this._getId(e)??m}>${this.mapView&&l`<instant-apps-social-share class="instant-app-share" .embed=${this.shareIncludeEmbed} flip-rtl popover-button-icon-scale=s scale=m share-button-color=neutral share-button-type=action .socialMedia=${this.shareIncludeSocial} .view=${this.mapView} ${r(t=>{t&&(this._shareNode=t,this._updateShareUrl())})}></instant-apps-social-share>`||""}${this._getToolTip("bottom",`map-${e}`,this._translations?.share)}</div>`}_updateShareUrl(){let e=this._shareNode?.shareUrl;if(!e)return;let t=new URL(e);this._loadedId?t.searchParams.set("webmap",this._loadedId):t.searchParams.delete("webmap"),this.selectedLayer?.id?t.searchParams.set("layer",this.selectedLayer.id):t.searchParams.delete("layer"),this.selectedFeaturesIds?.length>0?t.searchParams.set("oid",this.selectedFeaturesIds.join(",")):t.searchParams.delete("oid"),this.appLayout&&t.searchParams.set("applayout",this.appLayout),this._shareNode&&(this._shareNode.autoUpdateShareUrl=!1,this._shareNode.shareUrl=t.href)}_initToolInfos(){let e=this.selectedFeaturesIds.length>0,t=this.selectedFeaturesIds.length<2||this.selectedFeaturesIds.length>u,a=this.featureSelectionMode==="multiple"&&this.selectedLayer?.capabilities?.operations.supportsUpdate,i=[];i.push({active:!1,icon:"filter",indicator:!1,label:this._translations.filters,func:()=>void this._toggleFilter(),disabled:!1,toolTip:this._translations.filters}),i.push({active:!1,icon:"zoom-to-object",indicator:!1,label:this._translations.zoom,func:()=>void this._zoom(),disabled:!e,toolTip:this._translations.zoom}),a&&i.push({active:!1,icon:"pencil",indicator:!1,label:this._translations.editMultiple,func:()=>this.editMultipleFeatures.emit(this.selectedFeaturesIds),disabled:t,toolTip:this._translations.editMultiple}),i.push({active:!1,icon:"refresh",indicator:!1,label:this._translations.refresh,func:()=>this.selectedLayer?.refresh(),disabled:!1,toolTip:this._translations.refresh}),i.push({active:!1,icon:"erase",indicator:!1,label:this._translations.clearSelection,func:()=>this.clearSelection.emit(),disabled:!e,toolTip:this._translations.clearSelection}),this._toolInfos=[...i]}_validateActiveActions(){let e=["filter"];this._toolInfos?.forEach(t=>{t&&e.indexOf(t.icon)>-1&&t.icon==="filter"&&(t.indicator=this._filterActive)})}_handleMapVisibility(){if(this._mapDiv.value){let e=this._mapDiv.value.getElementsByClassName("esri-view-surface")[0],t=this._mapDiv.value.getElementsByClassName("esri-attribution")[0];this._isValidWebMap?(e?.classList.remove("hidden"),t?.classList.remove("hidden")):(e?.classList.add("hidden"),t?.classList.add("hidden"))}}_validateEnabledActions(){let e=this.selectedFeaturesIds.length>0,t=this.selectedFeaturesIds.length<2||this.selectedFeaturesIds.length>u,a=["zoom-to-object","pencil","erase"];this._toolInfos?.forEach(i=>{i&&a.indexOf(i.icon)>-1&&(i.disabled=i.icon==="pencil"?t:!e,i.toolTip=i.icon==="pencil"?this.selectedFeaturesIds.length>u?this._translations.featureEditLimitNotice:this._translations.editMultiple:i.toolTip)})}_handleDocumentClick(e){e.target.tagName!=="MAP-PICKER"&&this._mapPicker.value&&this._mapPicker.value.close()}async _zoom(){if(this.selectedLayer&&this.mapView){let e=await w(this.mapView,this.selectedLayer.id);e&&await M(this.selectedFeaturesIds,e,this.mapView,!0,void 0,this.zoomToScale)}}async _toggleFilter(){this.toggleFilter.emit()}_getActions(){return this._toolInfos?.reduce((e,t)=>(t&&e.push(this._getAction(t.active,t.icon,t.indicator,t.label,t.func,t.disabled,t.loading,t.toolTip)),e),[])}_getToolTip(e,t,a){return l`<calcite-tooltip .placement=${e} .referenceElement=${t}><span>${a}</span></calcite-tooltip>`}_getAction(e,t,a,i,s,h,o,c){let W=this.selectedLayer===void 0?!0:h;return l`<calcite-action .active=${e} appearance=solid .disabled=${W} .icon=${t} .id=${`map-${t}`} .indicator=${a} .label=${i} .loading=${o} @click=${s} .text=${i} text-enabled></calcite-action>${this._getToolTip("auto",`map-${t}`,c)}`}_getId(e){return`solutions-action-${e}`}};v("map-card",y);return y},"config","views/MapView","WebMap",a,c,e,f)