/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import{a as d}from"./I5GF7UR6.js";import a from"./YFLYHPA6.js";import{a as f,b as A}from"./W4YXXJAS.js";import{b as g}from"./77CU4WA2.js";import{a as S}from"./6S75SIVV.js";import{b as I}from"./ABSRNM72.js";import{H as b,J as F,h as N,i as r,r as m}from"./5CQPQ7AE.js";export default $arcgis.t(([{g:E,n:y}])=>{var O=N`/** @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.
 */

.width-full {
  width: 100%
}

calcite-panel {
  --calcite-panel-background-color: var(--calcite-color-foreground-1);
  --calcite-panel-footer-space: var(--calcite-spacing-sm);
}

.border-color {
  --calcite-block-border-color: transparent;
}

calcite-block {
  margin: 0;
  --calcite-block-content-space: 0;
}

.tree-padding {
  padding: 0 0.2rem;
}

.display-none {
  display: none;
}`,T={PUBLICSAFETY:["EMERGENCYMANAGEMENT","FIRESERVICE","LAWENFORCEMENT"],STATEANDLOCALGOVERNMENT:["AGRICULTURE","AIRPORT","ASSESSMENTANDTAXATION","ELECTIONS","EMERGENCYMANAGEMENT","FIRESERVICE","FISHANDWILDLIFE","HEALTHANDHUMANSERVICES","LAWENFORCEMENT","NATURALRESOURCES","PARKS","PLANNINGANDDEVELOPMENT","PUBLICWORKS","TRANSPORTATION"],UTILITIES:["DISTRICTENERGY","ELECTRIC","GAS","SEWER","STORMWATER","WATER"]},R=Object.keys(E).reduce((u,e)=>{let t=e;return u[t]=T[t]??[],u},{}),_=class extends b{constructor(){super(),this.hideIndustryFilter=!1,this.isAIDialogOpen=!1,this.showReset=!1,this._activeFilterSettings={categories:[]},this._isMobile=!1,this._translations=S({name:"solutions-filter-panel",blocking:!0}),this._userFirstName="",this._configContextConsumer=g({context:A,subscribe:!0,callback:e=>{e?.userSession&&!this._userFirstName&&this._loadUserFirstName()}}),this._isMobileContextConsumer=g({context:f,subscribe:!0,callback:e=>this._isMobile=e}),this.applyFilter=m(),this.toggleFilter=m(),this._handleFilterRemoved=e=>{let t=e.detail;Array.isArray(t)&&(this._activeFilterSettings={...this._activeFilterSettings,categories:[...t]})},this._industryMatchName=e=>{let t=Object.keys(this._translations.industries).find(o=>o.toUpperCase()===e.replaceAll(" ","").toUpperCase());return t&&t in this._translations.industries?this._translations.industries[t]:e},this.listenOn(window,"filterRemoved",this._handleFilterRemoved),this.listenOn(window,"closeAssistant",()=>{this.isAIDialogOpen=!1}),this.listenOn(window,"openAssistant",()=>{this.isAIDialogOpen=!0})}static{this.properties={hideIndustryFilter:[5,{},{type:Boolean}],isAIDialogOpen:[5,{},{type:Boolean}],showReset:[5,{},{type:Boolean}],_activeFilterSettings:[16,{},{state:!0}],_isMobile:[16,{},{state:!0}],_translations:[16,{},{state:!0}],_userFirstName:[16,{},{state:!0}]}}static{this.styles=O}get _telemetry(){return this._configContextConsumer.value?.telemetrySession}changeIndustryFilter(e,t,o,h){if(e!==""||t!==""){let l=[];if(t!==""){let i=E[e];l=[{displayValue:this._industryMatchName(i),type:"industry",value:e,industry:e,domain:""},{displayValue:o,type:"domain",value:t,industry:e,domain:t}]}else l=[{displayValue:o,type:t!==""?"domain":"industry",value:t!==""?t:e,industry:e,domain:t}];this._activeFilterSettings={...this._activeFilterSettings,categories:[...l]},h&&this.applyFilter.emit(l)}else{let l={displayValue:o,type:"industry",value:e,industry:e,domain:t};this._activeFilterSettings={...this._activeFilterSettings,categories:[l]},h&&this.applyFilter.emit(l)}}clearFilters(){this.changeIndustryFilter("","",""),this.applyFilter.emit(null)}async load(){await this._loadUserFirstName(),this._isMobileContextConsumer.value&&(this._isMobile=this._isMobileContextConsumer.value)}render(){return r`<calcite-panel description heading>${this.showReset&&r`<calcite-action appearance=solid icon=reset @click=${()=>{this.clearFilters()}} slot=header-actions-end .text=${this._translations.resetFilters} text-enabled></calcite-action>`||""}<calcite-block-group .label=${this._translations.filters} scale=l>${!this.hideIndustryFilter&&this.renderIndustryBlock()||""}</calcite-block-group><calcite-button id=solutions-assistant-button icon-start=speech-bubbles label="Solutions Assistant" @click=${()=>{this._telemetry?.logEvent({category:y.ASSISTANT,action:"Open"}),this.isAIDialogOpen=!0}} round scale=l slot=footer-start></calcite-button><calcite-tooltip reference-element=solutions-assistant-button placement=right slot=footer-start offset-distance=10 open><span>${this._translations.assistant.welcomeTip}</span></calcite-tooltip><arcgis-solutions-assistant .open=${this.isAIDialogOpen} .userFirstName=${this._userFirstName}></arcgis-solutions-assistant></calcite-panel>`}renderIndustryBlock(){let e=(i,a)=>!this._activeFilterSettings||!this._activeFilterSettings.categories?!1:this._activeFilterSettings.categories.some(s=>s.industry===i&&(s.domain??"")===a),t=i=>!this._activeFilterSettings||!this._activeFilterSettings.categories?!1:this._activeFilterSettings.categories.some(a=>a.industry===i&&(a.domain??"")===""),o=(i,a)=>a.length>0&&(t(i)||this._activeFilterSettings.categories?.some(s=>s.industry===i&&!!s.domain&&a.includes(s.domain))===!0),h=(i,a)=>a.map(s=>{let n=Object.keys(this._translations.industriesDomain).find(C=>C.toUpperCase()===s.toUpperCase()),c=n&&n in this._translations.industriesDomain?this._translations.industriesDomain[n]:s;return e(i,s)?d(s,r`<calcite-tree-item .label=${c} @click=${()=>this.changeIndustryFilter(i,s,c,!0)} selected>${c}</calcite-tree-item>`):d(s,r`<calcite-tree-item .label=${c} @click=${()=>this.changeIndustryFilter(i,s,c,!0)}>${c}</calcite-tree-item>`)}),l=Object.entries(R).map(([i,a])=>{let s=this._industryMatchName(i),n=a,c=t(i),p=o(i,n);return c?d(i,r`<calcite-tree-item .label=${s} @click=${()=>this.changeIndustryFilter(i,"",s,!0)} selected .expanded=${p?!0:void 0}>${s}${n.length>0&&r`<calcite-tree slot=children selection-mode=multiple>${h(i,n)}</calcite-tree>`||""}</calcite-tree-item>`):d(i,r`<calcite-tree-item .label=${s} @click=${()=>this.changeIndustryFilter(i,"",s,!0)} .expanded=${p?!0:void 0}>${s}${n.length>0&&r`<calcite-tree slot=children selection-mode=multiple>${h(i,n)}</calcite-tree>`||""}</calcite-tree-item>`)});return r`<calcite-block description expanded class="border-color" .heading=${this._translations.industriesHeader} .label=${this._translations.industriesHeader}><calcite-action class=${F(this._isMobile?"":"display-none")} icon=x @click=${this._toggleFilter} slot=content-end text></calcite-action><calcite-tree selection-mode=single-persist class="tree-padding">${l}</calcite-tree></calcite-block>`}_toggleFilter(){this.toggleFilter.emit()}async _loadUserFirstName(){try{let e=await this._configContextConsumer.value?.userSession?.getUser();if(e?.fullName){let t=e.fullName.split(" ")[0];this._userFirstName=t}}catch{}}};I("solutions-filter-panel",_);return _},a)