/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import g from"./KY6RFOOO.js";import{a as C}from"./YOH3QK7R.js";import f from"./7BOA27L2.js";import"./5XHAT3I6.js";import"./DC5KIXAN.js";import{a as x}from"./S7VQX4XX.js";import"./4Q4PZB7R.js";import e from"./T2ZUVHM7.js";import a from"./HUJP6DFF.js";import{a as $}from"./XN2LWKJE.js";import"./4BPRM7CL.js";import"./NIL6NWG5.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 w,c as v}from"./ODCCVHGI.js";import{F as r,G as h,H as S,J as c,h as _,i as l,l as d,r as b,s as m,u as y}from"./42WFQ3AX.js";import"./3QPJ2JCA.js";export default $arcgis.t(([P,,{g:k,j:L},{a:E,d:T}])=>{var D=_`@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-input-message-spacing-value: 0;
}

.align-center {
  align-items: center;
}

.border-bottom-1 {
  border-width: 0px;
  border-bottom-width: 1px;
  border-style: solid;
  border-color: var(--calcite-color-border-3);
}

.action-bar-size {
  height: 3.5rem;
  width: 100%;
}

.w-1-2 {
  width: 50%;
}

.w-1-3 {
  width: 33.33%;
}

.width-full {
  width: 100%;
}

.height-full {
  height: 100%;
}

.padding-1 {
  padding: 1rem;
}

.padding-top-sides-1 {
  padding-block-start: 1rem;
  padding-inline-start: 1rem;
  padding-inline-end: 1rem;
}

.padding-sides-1 {
  padding-inline-start: 1rem;
  padding-inline-end: 1rem;
}

.padding-top-1-2 {
  padding-block-start: 0.5rem;
}

.padding-top-1 {
  padding-top: 1rem;
}

.padding-bottom-1 {
  padding-bottom: 1rem;
}

.info-blue {
  /* This would be better but not the right color in light theme */
  /* color: var(--calcite-color-info); */

  /* This is --calcite-color-info value for dark theme*/
  color: #00a0ff;
}

.info-message {
  justify-content: center;
  display: grid;
}

.font-bold {
  font-weight: bold;
}

.display-flex {
  display: flex;
}

.display-block {
  display: block;
}

.display-none {
  display: none;
}

.border-bottom {
  border-bottom: 1px solid var(--calcite-color-border-2);
}

.padding-start-1-2 {
  padding-inline-start: 0.5rem;
}

.list-border {
  border: 1px solid var(--calcite-color-border-2);
}

.margin-sides-1 {
  margin-inline-start: 1rem;
  margin-inline-end: 1rem;
}

.margin-start-1-2 {
  margin-inline-start: 0.5rem;
}

.margin-top-0 {
  margin-block-start: 0 !important;
}

.label-margin-0 {
  --calcite-label-margin-bottom: 0;
}

.list-label {
  color: var(--calcite-color-text-1);
}

.list-label,
.list-description {
  font-family: var(--calcite-sans-family);
  font-size: var(--calcite-font-size--2);
  font-weight: var(--calcite-font-weight-normal);
  overflow-wrap: break-word;
  word-break: break-word;
}

.list-description {
  margin-block-start: 0.125rem;
  color: var(--calcite-color-text-3);
}

.img-container {
  width: 100%;
  height: 100%;
}

.font-weight-500 {
  font-weight: 500;
}

.background-override {
  height: 100%;
  width: 100%;
  --calcite-color-foreground-3: var(--calcite-color-brand);
  --calcite-color-foreground-2: var(--calcite-color-brand-hover);
  --calcite-color-text-1: var(--calcite-color-text-inverse);
}

.word-wrap-anywhere {
  word-wrap: anywhere;
}

.tooltip-message {
  padding: 5px 8px;
  font-weight: var(--calcite-font-weight-normal);
  color: var(--calcite-color-text-2);
  max-width: 400px;
}

calcite-action-bar {
  --calcite-internal-action-bar-gap: 0px;
  --calcite-internal-action-bar-padding: 0px;
}
}`,g=class extends m{constructor(){super(),this.managedLayers={},this.managedTables=[],this.highlightHandles=[]}removeHandles(){this.highlightHandles.forEach(e=>{e?.remove()}),this.highlightHandles=[]}},f=class extends S{constructor(){super(),this.addresseeLayerIds=[],this.bufferColor=[227,139,79,.8],this.bufferOutlineColor=[255,255,255],this.customLabelEnabled=!1,this.defaultBufferDistance=0,this.defaultBufferUnit="feet",this.defaultExportTitle="",this.defaultNumLabelsPerPage=6,this.enableLayerFeatures=!0,this.enableLayerFeaturesOnLoad=!1,this.enableSearchDistance=!0,this.enableSearchDistanceOnLoad=!1,this.enableSketchTools=!0,this.featureHighlightEnabled=!1,this.noResultText="",this.initialNotice="",this.selectionLayerIds=[],this.showRefineSelection=!1,this.showSearchSettings=!0,this._exportGraphics=!1,this._addMap=!1,this._addResults=!0,this._addTitle=!1,this._downloadActive=!0,this._exportType="PDF",this._fetchingData=!1,this._isMobile=!1,this._numDuplicates=0,this._pageType="LIST",this._saveEnabled=!1,this._selectionSets=[],this._translations=$({name:"public-notification",blocking:!0}),this._downloadTools=r(),this._onboardingImageUrl="",this._popupsEnabled=!1,this._removeDuplicates=r(),this._selectTools=r(),this._refineSelection=r(),this._titleElement=r(),this._titleValue=void 0,this._numSelected=0,this._pnStateContextProvider=x({context:C}),this._refineGraphics=[],this.searchConfigurationChange=b(),this.listenOn(window,"selectionSetsChanged",this.selectionSetsChanged),this._pnState=new g,this._pnStateContextProvider.setValue(this._pnState)}static{this.properties={addresseeLayerIds:[0,{},{attribute:!1}],bufferColor:1,bufferOutlineColor:1,customLabelEnabled:[5,{},{type:Boolean}],defaultBufferDistance:[9,{},{type:Number}],defaultBufferUnit:1,defaultExportTitle:1,defaultNumLabelsPerPage:[9,{},{type:Number}],enableLayerFeatures:[5,{},{type:Boolean}],enableLayerFeaturesOnLoad:[5,{},{type:Boolean}],enableSearchDistance:[5,{},{type:Boolean}],enableSearchDistanceOnLoad:[5,{},{type:Boolean}],enableSketchTools:[5,{},{type:Boolean}],featureEffect:[0,{},{attribute:!1}],featureHighlightEnabled:[5,{},{type:Boolean}],mapView:[0,{},{attribute:!1}],noResultText:1,initialNotice:1,searchConfiguration:[0,{},{attribute:!1}],selectionLayerIds:[0,{},{attribute:!1}],showRefineSelection:[5,{},{type:Boolean}],showSearchSettings:[5,{},{type:Boolean}],sketchLineSymbol:[0,{},{attribute:!1}],sketchPointSymbol:[0,{},{attribute:!1}],sketchPolygonSymbol:[0,{},{attribute:!1}],_exportGraphics:[16,{},{state:!0}],_addMap:[16,{},{state:!0}],_addResults:[16,{},{state:!0}],_addTitle:[16,{},{state:!0}],_downloadActive:[16,{},{state:!0}],_exportType:[16,{},{state:!0}],_fetchingData:[16,{},{state:!0}],_isMobile:[16,{},{state:!0}],_numDuplicates:[16,{},{state:!0}],_pageType:[16,{},{state:!0}],_saveEnabled:[16,{},{state:!0}],_selectionSets:[16,{},{state:!0}],_translations:[16,{},{state:!0}]}}static{this.styles=D}static{this.shadowRootOptions=y}willUpdate(e){e.has("mapView")&&this.mapView&&this.mapViewWatchHandler(this.mapView),e.has("searchConfiguration")&&this.searchConfiguration&&this.watchSearchConfigurationHandler(this.searchConfiguration,e.get("searchConfiguration")),e.has("sketchLineSymbol")&&this.sketchLineSymbolWatchHandler(this.sketchLineSymbol,e.get("sketchLineSymbol")),e.has("sketchPointSymbol")&&this.sketchPointSymbolWatchHandler(this.sketchPointSymbol,e.get("sketchPointSymbol")),e.has("sketchPolygonSymbol")&&this.sketchPolygonSymbolWatchHandler(this.sketchPolygonSymbol,e.get("sketchPolygonSymbol")),e.has("_pageType")&&(this.hasUpdated||this._pageType!=="LIST")&&this.pageTypeWatchHandler(this._pageType,e.get("_pageType"))}async mapViewWatchHandler(e){e?.popup&&(this._popupsEnabled=e?.popupEnabled),this.searchConfiguration&&this._initSearchConfiguration(this.searchConfiguration)}async watchSearchConfigurationHandler(e,t){let i=JSON.stringify(e);this.mapView&&(i!==JSON.stringify(t)||i&&!this._searchConfiguration)&&(this._searchConfiguration=JSON.parse(i),this._searchConfiguration&&this.searchConfigurationChange.emit(this._searchConfiguration),this._home())}async sketchLineSymbolWatchHandler(e,t){e&&JSON.stringify(e)!==JSON.stringify(t)&&this._setLineSymbol(e)}async sketchPointSymbolWatchHandler(e,t){e&&JSON.stringify(e)!==JSON.stringify(t)&&this._setPointSymbol(e)}async sketchPolygonSymbolWatchHandler(e,t){e&&JSON.stringify(e)!==JSON.stringify(t)&&this._setPolygonSymbol(e)}async pageTypeWatchHandler(e,t){if(this._checkPopups(),this.mapView?.popup&&(this.mapView.popupEnabled=e!=="LIST"?!1:this._popupsEnabled),e==="EXPORT"&&(this._fetchingData=!0,this._numDuplicates=await this._getNumDuplicates(),this._updateExportGraphics(),this._fetchingData=!1),this._clearHighlight(),(t==="SELECT"||t==="REFINE")&&await this._clearSelection(),t==="EXPORT"&&this._removeExportGraphics(),e!=="SELECT")return this._highlightFeatures()}selectionSetsChanged(e){this._selectionSets=[...e.detail]}connectedCallback(){super.connectedCallback(),this._mediaQuery=window.matchMedia("(max-width: 600px)"),this.listenOn(this._mediaQuery,"change",e=>this._setIsMobile(e))}async load(){this._initSymbols(),this._onboardingImageUrl=v("assets/public-notification/images/onboarding.png")}render(){let e=this._isMobile?"footer":"header";return l`<calcite-shell><calcite-action-bar class="border-bottom-1 action-bar-size" expand-disabled layout=horizontal slot=${e??d}>${this._getActionGroup("list-check","LIST",this._translations.myLists)}${this.showRefineSelection?this._getActionGroup("test-data","REFINE",this._translations.refineSelection):null}${this._getActionGroup("export","EXPORT",this._translations.export)}</calcite-action-bar>${this._getPage(this._pageType)}</calcite-shell>`}loaded(){this.searchConfiguration&&this._initSearchConfiguration(this.searchConfiguration)}_initSearchConfiguration(e){this.searchConfiguration&&!this._searchConfiguration&&this.mapView&&(this._searchConfiguration=e,this.searchConfigurationChange.emit(this._searchConfiguration),this._home())}_initSymbols(){this._setLineSymbol(this.sketchLineSymbol),this._setPointSymbol(this.sketchPointSymbol),this._setPolygonSymbol(this.sketchPolygonSymbol)}_setLineSymbol(e){let t=e?.type==="simple-line";this.sketchLineSymbol=t?e:this._jsonUtils?.fromJSON(e||{type:"esriSLS",color:[130,130,130,255],width:2,style:"esriSLSSolid"})}_setPointSymbol(e){let t=e?.type==="simple-marker";this.sketchPointSymbol=t?e:this._jsonUtils?.fromJSON(e||{type:"esriSMS",color:[255,255,255,255],angle:0,xoffset:0,yoffset:0,size:6,style:"esriSMSCircle",outline:{type:"esriSLS",color:[50,50,50,255],width:1,style:"esriSLSSolid"}})}_setPolygonSymbol(e){let t=e?.type==="simple-fill";this.sketchPolygonSymbol=t?e:this._jsonUtils?.fromJSON(e||{type:"esriSFS",color:[150,150,150,51],outline:{type:"esriSLS",color:[50,50,50,255],width:2,style:"esriSLSSolid"},style:"esriSFSSolid"})}_setIsMobile(e){this._isMobile=e.matches}_getActionGroup(e,t,i){let s=this.showRefineSelection?"w-1-3":"w-1-2";return l`<calcite-action-group class=${c(s)} layout=horizontal><div class="background-override"><calcite-action .active=${this._pageType===t} alignment=center appearance=solid class="width-full height-full" .icon=${e} id=${e??d} @click=${()=>{this._setPageType(t)}} text></calcite-action></div><calcite-tooltip label placement=bottom .referenceElement=${e}><span>${i}</span></calcite-tooltip></calcite-action-group>`}_setPageType(e){this._pageType=e}_getPage(e){let t;switch(e){case"LIST":t=this._getListPage();break;case"SELECT":t=this._getSelectPage();break;case"EXPORT":t=this._getExportPage();break;case"REFINE":t=this._getRefinePage();break}return t}_getListPage(){let e=this._hasSelections(),t=e?this._translations.listHasSetsTip:this.initialNotice!==""?this.initialNotice:this._translations.selectLayerAndAdd;return l`<calcite-panel>${this._getLabel(this._translations.myLists)}${this._getNotice(t||"","padding-sides-1 padding-bottom-1","word-wrap-anywhere")}${e?this._getSelectionSetList():this._getOnboardingImage()}<div class="display-flex padding-1"><calcite-button @click=${()=>{this._setPageType("SELECT")}} width=full><span class="font-weight-500">${this._translations.add}</span></calcite-button></div></calcite-panel>`}_getOnboardingImage(){return l`<div class="display-flex padding-sides-1"><img class="img-container" role=presentation src=${this._onboardingImageUrl??d}></div>`}_getSelectionSetList(){return l`<div class="padding-top-1-2 padding-bottom-1-2"><calcite-list class="list-border margin-sides-1" label>${this._selectionSets.reduce((e,t,i)=>{let s=this._getSelectionSetIds(t),a=!0;return t.workflowType==="REFINE"&&(a=Object.keys(t.refineInfos).reduce((n,p)=>{let u=t.refineInfos[p];return n+=u.addIds.length+u.removeIds.length,n},0)>0),a&&e.push(l`<calcite-list-item .label=${t.label} @click=${()=>this.mapView&&this._gotoSelection(t,this.mapView)}><div slot=content><div class="list-label">${t.label}</div><div class="list-description">${t?.layerView?.layer.title}</div><div class="list-description">${this._translations.selectedFeatures.replace("{{n}}",s.length.toString())}</div></div>${this._getAction(!0,"pencil","",o=>this._openSelection(t,o),!1,"actions-end")}${this._getAction(!0,"x","",o=>this._deleteSelection(i,o),!1,"actions-end")}</calcite-list-item>`),e},[])}</calcite-list></div>`}_getSelectionSetIds(e){return e.workflowType!=="REFINE"?e.selectedIds:Object.keys(e.refineInfos).reduce((t,i)=>[...t,...e.refineInfos[i].addIds],[])}_hasSelections(e=!1){let t=[],i=this._selectionSets.some(s=>s.workflowType==="REFINE"?(t=this._getSelectionSetIds(s),!0):!1);return e&&i?t.length>0||this._selectionSets.length>1:this._selectionSets.length>0}async _getNumDuplicates(){let e=this._getExportInfos(),t=this.mapView?.map&&await E(this.mapView.map,e),i=t&&T(t);return t&&i?t.length-i.length:0}_getExportInfos(){return this._selectionSets.reduce((e,t)=>{if(t.download)if(t.workflowType!=="REFINE"&&t?.layerView){let i=t.layerView.layer.id;i!==void 0&&this._updateIds(i,t.layerView,t.selectedIds,e)}else Object.keys(t.refineInfos).forEach(i=>{let s=t.refineInfos[i];s.addIds.length>0&&this._updateIds(i,s.layerView,s.addIds,e)});return e},{})}_updateIds(e,t,i,s){return s[e]?s[e].ids=s[e].ids.concat(i):s[e]={layerView:t,ids:i},s}_getSelectPage(){let e=this._translations.selectSearchTip;return l`<calcite-panel>${this._getLabel(this._translations?.stepTwoFull,!0)}${this._getNotice(e,"padding-1","word-wrap-anywhere")}<div><map-select-tools .bufferColor=${this.bufferColor} .bufferOutlineColor=${this.bufferOutlineColor} class="font-bold" .customLabelEnabled=${this.customLabelEnabled} .defaultBufferDistance=${this.defaultBufferDistance} .defaultBufferUnit=${this.defaultBufferUnit} .enableLayerFeatures=${this.enableLayerFeatures} .enableLayerFeaturesOnLoad=${this.enableLayerFeaturesOnLoad} .enableSearchDistance=${this.enableSearchDistance} .enableSearchDistanceOnLoad=${this.enableSearchDistanceOnLoad} .enableSketchTools=${this.enableSketchTools} .enabledLayerIds=${this.addresseeLayerIds} .isUpdate=${!!this._activeSelection} .mapView=${this.mapView} .noResultText=${this.noResultText} @selectionSetChange=${this._updateForSelection} .searchConfiguration=${this._searchConfiguration} .searchDistanceEnabled=${this.enableSearchDistanceOnLoad} .selectionLayerIds=${this.selectionLayerIds} .selectionSet=${this._activeSelection} .sketchLineSymbol=${this.sketchLineSymbol} .sketchPointSymbol=${this.sketchPointSymbol} .sketchPolygonSymbol=${this.sketchPolygonSymbol} .useLayerFeaturesEnabled=${this.enableLayerFeaturesOnLoad} ${h(this._selectTools)}></map-select-tools></div>${this._getPageNavButtons(this._translations.done,this._numSelected===0,()=>{this._saveSelection()},this._translations.cancel,!1,()=>{this._home()})}</calcite-panel>`}_getExportPage(){let e=this._hasSelections(this.showRefineSelection),t=this._numDuplicates>0?"display-block":"display-none";return l`<calcite-panel><div>${this._getLabel(this._translations.export,!1)}${e?l`<div>${this._getNotice(this._translations.exportTip,"padding-sides-1")}${this._getLabel(this._translations.exportListsLabel)}${this._getExportSelectionLists()}<div class=${`padding-sides-1 ${t}`}><div class="display-flex"><calcite-label layout=inline><calcite-checkbox ${h(this._removeDuplicates)}></calcite-checkbox><div class="display-flex">${this._translations.removeDuplicate}<div class="info-message padding-start-1-2"><calcite-input-message class="info-blue margin-top-0" scale=m>${` ${this._translations.numDuplicates.replace("{{n}}",this._numDuplicates.toString())}`}</calcite-input-message></div></div></calcite-label><calcite-icon class="padding-start-1-2 icon" .flipRtl=${this._translations._lang?.toLowerCase()!=="he"} icon=question id=remove-duplicates-icon scale=s></calcite-icon></div><calcite-popover closable label overlay-positioning=fixed reference-element=remove-duplicates-icon><span class="tooltip-message">${this._translations.duplicatesTip}</span></calcite-popover></div><div class="border-bottom"></div><div class="padding-top-sides-1"><calcite-segmented-control class="w-100" @calciteSegmentedControlChange=${this._exportTypeChange} width=full><calcite-segmented-control-item .checked=${this._exportType==="PDF"} class="w-50 end-border" value=PDF><span class="font-weight-500">${this._translations.pdf}</span></calcite-segmented-control-item><calcite-segmented-control-item .checked=${this._exportType==="CSV"} class="w-50" value=CSV><span class="font-weight-500">${this._translations.csv}</span></calcite-segmented-control-item></calcite-segmented-control></div><div class="padding-bottom-1">${this._getExportOptions()}</div><div class="padding-1 display-flex"><calcite-button .disabled=${!this._downloadActive||this._fetchingData||!this._addMap&&!this._addResults} .loading=${this._fetchingData} @click=${()=>void this._export()} width=full><span class="font-weight-500">${this._translations.export}</span></calcite-button></div></div>`:this._getNotice(this._translations.downloadNoLists,"padding-sides-1 padding-bottom-1")}</div></calcite-panel>`}_exportTypeChange(e){this._exportType=e.target.value}_getExportOptions(){let e=this._exportType==="PDF"?"display-block":"display-none",t=this._addTitle?"display-block":"display-none",i=this._addMap?"display-flex":"display-none",s=this._titleValue?this._titleValue:this.defaultExportTitle?this.defaultExportTitle:"",a=this._addResults?"":"display-none";return l`<div class=${c(e)}>${this._getLabel(this._translations.pdfOptions,!0)}<div class="padding-top-sides-1"><calcite-label class="label-margin-0" layout=inline><calcite-checkbox .checked=${this._addResults} @calciteCheckboxChange=${()=>this._addResults=!this._addResults}></calcite-checkbox>${this._translations.addResults}</calcite-label></div><div class=${`padding-top-sides-1 ${a}`}><calcite-label class="label-margin-0">${this._translations.selectPDFLabelOption}</calcite-label></div><div class=${`padding-sides-1 ${a}`}><pdf-download .defaultNumLabelsPerPage=${Number.parseInt(this.defaultNumLabelsPerPage.toString(),10)} .disabled=${!this._downloadActive} ${h(this._downloadTools)}></pdf-download></div><div class="padding-top-sides-1"><calcite-label class="label-margin-0" layout=inline><calcite-checkbox .checked=${this._addTitle} @calciteCheckboxChange=${()=>this._addTitle=!this._addTitle}></calcite-checkbox>${this._translations.title}</calcite-label></div><div class=${c(t)}>${this._getLabel(this._translations.title,!0,"")}<calcite-input-text class="padding-sides-1" @calciteInputTextInput=${()=>this._changeTitle()} .placeholder=${this._translations.titlePlaceholder} .value=${s} ${h(this._titleElement)}></calcite-input-text></div><div class="padding-top-sides-1"><calcite-label class="label-margin-0" layout=inline><calcite-checkbox .checked=${this._addMap} @calciteCheckboxChange=${()=>this._handleAddMapChange()}></calcite-checkbox>${this._translations.includeMap}</calcite-label></div><div class=${`padding-top-sides-1 ${i}`}><calcite-label class="label-margin-0" layout=inline><calcite-checkbox .checked=${this._exportGraphics} @calciteCheckboxChange=${()=>this._handleExportGraphicsChange()}></calcite-checkbox>${this._translations.listGraphics}</calcite-label><calcite-icon class="padding-start-1-2 icon" .flipRtl=${this._translations._lang?.toLowerCase()!=="he"} icon=question id=list-graphics-icon scale=s></calcite-icon><calcite-popover closable label overlay-positioning=fixed reference-element=list-graphics-icon><span class="tooltip-message">${this._translations.listGraphicsTip}</span></calcite-popover></div></div>`}_handleAddMapChange(){this._addMap=!this._addMap,this._updateExportGraphics()}_handleExportGraphicsChange(){this._exportGraphics=!this._exportGraphics,this._updateExportGraphics()}_getManagedLayer(e){let t,i=this._pnStateContextProvider.value;return Object.keys(i.managedLayers).some(s=>{let a=this.mapView?.map.layers.findIndex(o=>o.title===s);return i.managedLayers[s]===e&&a!==void 0?(t=this.mapView?.map.layers.getItemAt(a),!0):!1}),t}_updateExportGraphics(e=!1){(e||!this._exportGraphics||!this._addMap)&&this._removeExportGraphics(),this._exportGraphics&&this._addMap&&this._addExportGraphics()}_removeExportGraphics(){let e=this._getManagedLayer("sketch"),t=this._getManagedLayer("buffer");e&&e.graphics.removeAll(),t&&t.graphics.removeAll()}_addExportGraphics(){let e=this._getManagedLayer("sketch"),t=this._getManagedLayer("buffer");this._refineGraphics.forEach(i=>{e?.add(i.drawnGraphics),t?.add(i.bufferGraphics)}),this._selectionSets.forEach(i=>{if(i.download&&(e&&i.sketchGraphic&&e.graphics.add(i.sketchGraphic),t)){let s={type:"simple-fill",color:this.bufferColor,outline:{color:this.bufferOutlineColor,width:1}},a=new P({geometry:i.buffer,symbol:s});a&&t.graphics.add(a)}})}_getRefinePage(){let e=this._hasSelections();return l`<calcite-panel>${this._getLabel(this._translations.refineSelection)}${e?l`<div>${this._getNotice(this._translations.refineTip,"padding-sides-1")}<refine-selection .enabledLayerIds=${this.selectionLayerIds} .mapView=${this.mapView} .drawnGraphicsArr=${this._refineGraphics} .selectionSets=${this._selectionSets} .sketchLineSymbol=${this.sketchLineSymbol} .sketchPointSymbol=${this.sketchPointSymbol} .sketchPolygonSymbol=${this.sketchPolygonSymbol} .bufferColor=${this.bufferColor} .bufferOutlineColor=${this.bufferOutlineColor} .defaultBufferDistance=${this.defaultBufferDistance} .defaultBufferUnit=${this.defaultBufferUnit} .enableSearchDistance=${this.enableSearchDistance} .enableSearchDistanceOnLoad=${this.enableSearchDistanceOnLoad} .searchDistanceEnabled=${this.enableSearchDistanceOnLoad} ${h(this._refineSelection)}></refine-selection></div>`:this._getNotice(this._translations.refineTipNoSelections,"padding-sides-1")}</calcite-panel>`}_getPageNavButtons(e,t,i,s,a,o){return l`<div class="padding-bottom-1"><div class="display-flex padding-top-sides-1"><calcite-button .disabled=${t} @click=${i} width=full><span class="font-weight-500">${e}</span></calcite-button></div><div class="display-flex padding-top-1-2 padding-sides-1"><calcite-button appearance=outline .disabled=${a} @click=${o} width=full><span class="font-weight-500">${s}</span></calcite-button></div></div>`}_changeTitle(){this._titleElement.value?.value&&(this._titleValue=this._titleElement.value.value||"")}_getNotice(e,t="padding-1",i=""){return l`<calcite-notice class=${c(t)} icon=lightbulb kind=success open><div class=${c(i)} slot=message>${e}</div></calcite-notice>`}_getLabel(e,t=!1,i="font-bold"){return i+=t?" label-margin-0":"",l`<div class=padding-top-sides-1><calcite-label class=${c(i)}>${e}</calcite-label></div>`}_getExportSelectionLists(){return this._selectionSets.reduce((e,t)=>{let i=this._getSelectionSetIds(t),s=t.workflowType!=="REFINE"||i.length>0;return!this._downloadActive&&t.download&&s&&(this._downloadActive=!0),s&&e.push(l`<div class="display-flex padding-sides-1 padding-bottom-1"><calcite-checkbox .checked=${t.download} class="align-center" @calciteCheckboxChange=${()=>{this._toggleDownload(t.id)}}></calcite-checkbox><calcite-list class="list-border margin-start-1-2 width-full" id=download-list label><calcite-list-item .disabled=${!t.download} .label=${t.label} @click=${()=>{this._toggleDownload(t.id)}}><div slot=content><div class="list-label">${t.label}</div><div class="list-description">${t?.layerView?.layer.title}</div><div class="list-description">${this._translations.selectedFeatures.replace("{{n}}",i.length.toString())}</div></div></calcite-list-item></calcite-list></div>`),e},[])||l`<div></div>`}async _toggleDownload(e){let t=!1;this._selectionSets=this._selectionSets.map(i=>(i.download=i.id===e?!i.download:i.download,t=i.download?!0:t,i)),this._updateExportGraphics(!0),this._downloadActive=t,this._fetchingData=!0,this._numDuplicates=await this._getNumDuplicates(),this._fetchingData=!1,await this._highlightFeatures()}async _export(){let e=this._addResults?this._getSelectionIdsAndViews(this._selectionSets,!0):{};if(this._exportType==="PDF"){let t="";this._addMap&&this.mapView&&(t=(await this.mapView.takeScreenshot({width:1500,height:2e3}))?.dataUrl),this._fetchingData=!0,this._downloadTools.value&&this._removeDuplicates.value&&this.mapView?.map&&await this._downloadTools.value.downloadPDF(this.mapView.map,e,this._removeDuplicates.value.checked,this._addTitle&&this._titleElement.value?this._titleElement.value.value:"",t),this._fetchingData=!1}this._exportType==="CSV"&&(this._fetchingData=!0,this._downloadTools.value&&this.mapView?.map&&await this._downloadTools.value.downloadCSV(this.mapView.map,e,this._removeDuplicates.value?.checked||!1),this._fetchingData=!1)}_getSelectionIdsAndViews(e,t=!1){return(t?e.filter(s=>s.download):e).reduce((s,a)=>{if(a.workflowType==="REFINE")Object.keys(a.refineInfos).forEach(o=>{let n=a.refineInfos[o];if(n.addIds){let p=n.layerView.layer.id;s=this._updateExportInfos(s,p,a.label,n.addIds,n.layerView)}});else{let o=a?.layerView?.layer.id;o!==void 0&&a.layerView&&(s=this._updateExportInfos(s,o,a.label,a.selectedIds,a.layerView))}return s},{})}_updateExportInfos(e,t,i,s,a){return t&&Object.keys(e).indexOf(t)>-1?(e[t].ids=[...new Set([...e[t].ids,...s])],e[t].selectionSetNames.push(i)):t&&(e[t]={ids:s,layerView:a,selectionSetNames:[i]}),e}_getAction(e,t,i,s,a=!1,o=""){return l`<calcite-action appearance=solid .disabled=${!e} .icon=${t} icon-flip-rtl .indicator=${a} @click=${s} slot=${o??d} .text=${i}></calcite-action>`}_updateForSelection(e){this._numSelected=e.detail,this._saveEnabled=this._numSelected>0}async _home(){await this._clearSelection(),this._setPageType("LIST")}async _saveSelection(){let e=await this._selectTools.value?.getSelection();if(e){let t=this._selectTools.value?.isUpdate;this._selectionSets=t?this._selectionSets.map(i=>i.id===e.id?e:i):[...this._selectionSets,e]}return this._home()}async _clearSelection(){await this._selectTools.value?.clearSelection(),this._numSelected=0,this._activeSelection=void 0}async _deleteSelection(e,t){return t.stopPropagation(),this._selectionSets=this._selectionSets.filter((i,s)=>(i.workflowType==="REFINE"&&(this._refineGraphics=[]),s!==e?i:!1)),this._highlightFeatures()}_gotoSelection(e,t){e.selectedIds&&e.layerView&&L(e.selectedIds,e.layerView,t,this.featureHighlightEnabled,this.featureEffect)}_openSelection(e,t){t.stopPropagation(),this._activeSelection=e,this._pageType=e.workflowType==="REFINE"?"REFINE":"SELECT"}async _highlightFeatures(){let e=this._pnStateContextProvider.value;this._clearHighlight();let t=this._getSelectionIdsAndViews(this._selectionSets,this._pageType==="EXPORT"),i=Object.keys(t);if(i.length>0)for(let s=0;s<i.length;s++){let a=t[i[s]];if(a.layerView&&this.mapView){let o=await k(a.ids,a.layerView,this.mapView);e.highlightHandles.push(o)}}}_checkPopups(){typeof this._popupsEnabled!="boolean"&&(this._popupsEnabled=!!this.mapView?.popupEnabled)}_clearHighlight(){let e=this._pnStateContextProvider.value;e&&e.highlightHandles&&e.removeHandles()}};w("public-notification",f);return f},"Graphic",a,e,f,g)