/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import w from"./G46H6ZQE.js";import t from"./VWGZ3GKN.js";import s from"./MVSG5SNB.js";import"./MUY5GCNB.js";import r from"./XFBG2TQS.js";import q from"./CXIFDBX2.js";import o from"./KCIUYPNN.js";import n from"./MGMVZN2R.js";import"./OBX3FQHP.js";import k from"./ZTNWN5AQ.js";import j from"./QT7UI2ML.js";import i from"./SBOSBG32.js";import h from"./SK6MHFPK.js";import"./G5UG6XCT.js";import"./2UHME7O6.js";import e from"./EZAL5KYF.js";import c from"./HBC3TKGZ.js";import{a as f,b as C}from"./W4YXXJAS.js";import{a as b}from"./S7VQX4XX.js";import"./4Q4PZB7R.js";import{a as S}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 v}from"./ODCCVHGI.js";import{F as a,G as l,H as g,J as p,h as m,i as u,r as d}from"./42WFQ3AX.js";import"./3QPJ2JCA.js";export default $arcgis.t(([,,,{k:w,l:I,n:c},,,,{b:O},,,{g:k,h:L},,{a:y},,,{a:_,b:x}])=>{var E=m`/** @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.
 */

.back-color-override {
  background-color: var(--calcite-color-foreground-2);
  --calcite-tab-border-color: var(--calcite-color-foreground-3);
}

.display-none {
  display: none !important;
}

.height-100 {
  height: 100%;
}

/* Calcite overrides */

calcite-tab-nav {
  padding-bottom: 6px;
  padding-top: 6px;
}

calcite-tabs {
  --calcite-tab-border-color: var(--calcite-color-border-3);
  --calcite-color-focus: transparent;
  height: 100%;
}

.tab-space-0 {
  --calcite-tab-content-space-y: var(--calcite-spacing-none);
}

.tab-space-md {
  --calcite-tab-content-space-y: var(--calcite-spacing-md);
}

solutions-searchsort-toolbar,
solutions-deploy-app-nav,
solution-details-panel,
solutions-resources-shell,
solutions-deployed-shell,
solutions-all-shell,
calcite-tab-nav,
solution-deployed-card-panel {
  width: 1440px;
  display: block;
  max-width: 96vw;
  padding-right: var(--calcite-spacing-none);
  padding-left: var(--calcite-spacing-none);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.border {
  height: var(--calcite-spacing-px);
  border-bottom-color: var(--calcite-color-border-3);
  border-bottom-style: solid;
  border-bottom-width: var(--calcite-border-width-sm);
  box-sizing: border-box;
}

.overflow-auto {
  overflow: auto;
}

solution-details-panel {
  scroll-margin-top: 3rem;
}`,T=class extends g{constructor(){super(),this.initTitleOrId="",this.sortType="relevance",this.useLocalAppConfig=!1,this.authentication=void 0,this._isLoaded=!1,this.isMobile=!1,this._activeTab="all-solutions",this._translations=S({name:"solutions-deploy-app",blocking:!0}),this._agoTerms=`${I}`,this._allCards=[],this._allShell=a(),this._allTab=a(),this._allTabTitle=a(),this._resourcesTab=a(),this._resourcesTabTitle=a(),this._categories=[],this._configContextProvider=b({context:C}),this._delay=!1,this._deployAppNav=a(),this._deployedCardPanel=a(),this._deployedCardTab=a(),this._deployedCardTabTitle=a(),this._detailsShell=a(),this._detailsTab=a(),this._detailsTabTitle=a(),this._forceInit=!1,this._getSuggested=!1,this._isMobileContextProvider=b({context:f}),this._mySolutionsShell=a(),this._mySolutionsTab=a(),this._mySolutionsTabTitle=a(),this._sortField="relevance",this._sortOrder="desc",this._telemetryManager=new y,this.deployAppTabSelected=d(),this.detailsCardSelected=d(),this.deployedCardSelected=d(),this.metaTagStringsReady=d(),this.listenOn(window,"detailsCardSelected",this._detailsCardSelected),this.listenOn(window,"deployedCardSelected",this._deployedCardSelected),this.listenOn(window,"displayDeployedCard",this._handleDeployedCardDisplay),this.listenOn(window,"navTabSelected",this._setActiveTab),this._mediaQueryChange=this._mediaQueryChange.bind(this)}static{this.properties={appConfig:1,initTab:1,initTitleOrId:1,sortType:1,useLocalAppConfig:[5,{},{type:Boolean}],authentication:[16,{},{state:!0}],_isLoaded:[16,{},{state:!0}],isMobile:[16,{},{state:!0}],_activeTab:[16,{},{state:!0}],_translations:[16,{},{state:!0}]}}static{this.styles=E}get _telemetry(){return this._configContextProvider.value?.telemetrySession}async selectTab(t,e){if(console.log("selectTab"),this._isLoaded||this._forceInit){let i=this._getDefaultSearchOptions(e);switch(t.tabType){case"all-solutions":this._allTab.value.selected=!0,this._allTabTitle.value.selected=!0,i&&await this._allShell.value?.searchSolutions(i);break;case"resources":this._resourcesTab.value.selected=!0,this._resourcesTabTitle.value.selected=!0;break;case"deployed-card":if(this.authentication?.IsSignedIn){if(this._forceInit=!0,this._isLoaded=!1,this._cardsFetcherDeployed&&await this._getDeployedSolutions(),this._deployedSolutions?.cards?.length>0){let s;this._deployedSolutions.cards.some(o=>o.id===t.tabTitleOrId?(s=o,this.deployedCardSelected.emit({card:s}),!0):!1),this._isLoaded=!0,this._forceInit=!1}break}else return this.selectTab({tabTitleOrId:"",tabType:"deployments"},e);case"details":if(this._allCards){let s=k(this._allCards,t.tabTitleOrId);s=s||L(this._allCards,t.tabTitleOrId),s?(this._detailsTab.value.selected=!0,this._detailsTabTitle.value.selected=!0,this.detailsCardSelected.emit(s)):(t.tabType="all-solutions",this._allTab.value.selected=!0,this._allTabTitle.value.selected=!0)}break;case"deployments":this._mySolutionsTab.value.selected=!0,this._mySolutionsTabTitle.value.selected=!0,i&&await this._mySolutionsShell.value?.searchSolutions(i);break}return this._setActiveTab(new CustomEvent("setActiveTab",{detail:t})),this._blurTabs(),!0}else return this._initTab=t,this._initFilters=e,!1}async connectedCallback(){super.connectedCallback(),this._mediaQuery=window.matchMedia("(max-width: 800px)"),this._mediaQuery.addEventListener("change",this._mediaQueryChange),this._mediaQueryChange(this._mediaQuery)}async load(){this.useLocalAppConfig&&(this.appConfig=O)}render(){let t=this._isLoaded?"display-none":"",e=this._isLoaded?"":"display-none";return u`<calcite-shell><solutions-deploy-app-nav .appConfig=${this.appConfig} .initTab=${this.initTab} @authInit=${this._handleAuthInit} slot=header ${l(this._deployAppNav)}></solutions-deploy-app-nav>${this._isSearchToolbarShowing()&&u`<div class="border" slot=header></div>`||""}<solutions-searchsort-toolbar .isMobile=${this.isMobile} slot=header></solutions-searchsort-toolbar><calcite-loader class=${p(t)} id=solutions-loader .label=${this._translations.fetchingAllSolutions}></calcite-loader><calcite-tabs class=${p(e)} scale=l><calcite-tab-nav class="display-none" slot=title-group><calcite-tab-title ${l(this._allTabTitle)}>${this._translations.allSolutions}</calcite-tab-title><calcite-tab-title ${l(this._mySolutionsTabTitle)}>${this._translations.mySolutions}</calcite-tab-title><calcite-tab-title ${l(this._resourcesTabTitle)}>${this._translations.solutionResources}</calcite-tab-title><calcite-tab-title class="display-none" ${l(this._detailsTabTitle)}></calcite-tab-title><calcite-tab-title class="display-none" ${l(this._deployedCardTabTitle)}></calcite-tab-title></calcite-tab-nav><calcite-tab class="back-color-override tab-space-0" selected ${l(this._allTab)}><solutions-all-shell class="height-100" ${l(this._allShell)}></solutions-all-shell></calcite-tab><calcite-tab class="back-color-override tab-space-0" ${l(this._mySolutionsTab)}><solutions-deployed-shell class="height-100" ${l(this._mySolutionsShell)}></solutions-deployed-shell></calcite-tab><calcite-tab class="back-color-override tab-space-0" ${l(this._resourcesTab)}><solutions-resources-shell class="height-100"></solutions-resources-shell></calcite-tab><calcite-tab class="back-color-override" ${l(this._detailsTab)}><solution-details-panel class="height-100" ${l(this._detailsShell)}></solution-details-panel></calcite-tab><calcite-tab class="back-color-override tab-space-0" ${l(this._deployedCardTab)}><solution-deployed-card-panel class="shell-container height-100" ${l(this._deployedCardPanel)}></solution-deployed-card-panel></calcite-tab></calcite-tabs></calcite-shell>`}loaded(){this._setScrollbarGutters()}disconnectedCallback(){super.disconnectedCallback(),this._mediaQuery?.removeEventListener("change",this._mediaQueryChange)}async _handleAuthInit(t){let e=t.detail;e.telemetrySession||(e.telemetrySession=y.getDisabledSession()),this._configContextProvider.setValue(e),e.authentication&&(this.authentication=e.authentication),this._cardsFetcherDeployed=new _(e.locale,e.orgUrl,e.portalURL),this._cardsFetcher=new _(e.locale,e.orgUrl,e.portalURL),await this._getSolutions(e.primarySolutionsGroupId,e.agoBasedEnterpriseSolutionsGroupId),this._configContextProvider.value.allCards=this._allCards,this._configContextProvider.value.anonAgolSession=this._cardsFetcher.anonAgolSession,this._configContextProvider.value.agolPortalUrl=this._cardsFetcher.agolPortalUrl,await this._initializeTelemetry(),this._isLoaded=!0,this._initTab?(console.log("check here too, this does not seem right"),this.authentication?.IsSignedIn?this.selectTab(this._initTab,this._initFilters):this.selectTab({tabTitleOrId:"",tabType:"all-solutions"},this._initFilters),this._logTabViewTelemetry(this._initTab.tabType),this._initTab=void 0,this._initFilters=void 0):this.authentication?.IsSignedIn?this.initTab==="details"||this.initTab==="deployed-card"||(this._logTabViewTelemetry(this._activeTab),this._emitMetaTagStrings(this._activeTab)):this.selectTab({tabTitleOrId:"",tabType:"all-solutions"},this._initFilters)}_mediaQueryChange(t){this.isMobile=t.matches,this._isMobileContextProvider.setValue(this.isMobile)}_setActiveTab(t){let i=t.detail.tabType,s=this._activeTab!==i;switch(this._activeTab=i,s&&this._logTabViewTelemetry(i),i){case"all-solutions":this._allTabTitle.value?.click();break;case"deployments":this._mySolutionsTabTitle.value?.click();break;case"resources":this._resourcesTabTitle.value?.click();break;case"deployed-card":this._deployedCardTabTitle.value?.click();break;case"details":this._detailsTabTitle.value?.click();break}i!=="details"&&i!=="deployed-card"&&(this._deployAppNav.value.activateMenuItem(i),this.deployAppTabSelected.emit(i),this._emitMetaTagStrings(i))}_logTabViewTelemetry(t,e){let i;switch(t){case"all-solutions":i=c.ALL_SOLUTIONS;break;case"deployments":i=c.DEPLOYMENTS;break;case"resources":i=c.RESOURCES;break;case"details":i=c.SOLUTION_DETAILS;break;case"deployed-card":i=c.DEPLOYMENTS;break}if(!((t==="details"||t==="deployed-card")&&!e)&&i){let s=[];if((t==="details"||t==="deployed-card")&&e){let r=e;s.push(r.title||""),s.push(r.deployCommonId||""),s.push(r.deployVersion||"")}let o=t==="deployed-card"?"Open":"View";this._telemetry?.logEvent({category:i,action:o,dimensions:s.length>0?s:void 0})}}_emitMetaTagStrings(t,e){let i="",s="";switch(t){case"all-solutions":i=this._translations.metaAllSolutionsTitle,s=this._translations.metaAllSolutionsDescription;break;case"deployments":case"deployed-card":i=this._translations.metaDeploymentsTitle,s=this._translations.metaDeploymentsDescription;break;case"resources":i=this._translations.metaResourcesTitle,s=this._translations.metaResourcesDescription;break;case"details":e&&(i=this._translations.metaDetailsTitle.replace("{title}",e.title),s=e.snippet);break}this.metaTagStringsReady.emit({pageType:t,title:i,description:s,detailTemplate:e})}_detailsCardSelected(t){this._activeTab="details",this._detailsTabTitle.value.selected=!0,this._detailsTab.value.selected=!0,this._deployAppNav.value.clearMenuItems(),t?.detail&&(this._selectedDetailsCard=t.detail),this._logTabViewTelemetry("details",this._selectedDetailsCard),this._emitMetaTagStrings("details",this._selectedDetailsCard)}_deployedCardSelected(t){this._activeTab="deployed-card",this._deployedCardTabTitle.value.selected=!0,this._deployedCardTab.value.selected=!0,this._deployAppNav.value.clearMenuItems(),t?.detail?.card&&(this._selectedDeployedCard=t.detail.card),this._logTabViewTelemetry("deployed-card",this._selectedDeployedCard),this._emitMetaTagStrings("deployed-card")}_handleDeployedCardDisplay(t){let{card:e,cardRef:i}=t.detail;this.deployedCardSelected.emit({card:e,cardRef:i})}async _initializeTelemetry(){let t=this._configContextProvider.value;if(!this.authentication||!t)return;let e=await this._telemetryManager.initializeTelemetry(this.authentication,t);this._configContextProvider.value.telemetrySession=e}async _getSolutions(t,e){let i=await this._cardsFetcher?.requestAvailableSolutionCards({q:this._agoTerms,filter:"type:Solution",sortField:this._sortField,sortOrder:this._sortOrder,nextStart:-1,categories:this._categories,delay:this._delay,getSuggested:this._getSuggested},t,e,this._configContextProvider.value.userSession,this._configContextProvider.value.isEnterprise,{num:1e3});return this._allCards.length===0&&i?.cards&&(this._allCards=i?.cards),this._allCards}async _getDeployedSolutions(){let t=this._configContextProvider.value.authentication,e=this._configContextProvider.value.userSession;t&&e&&t.IsSignedIn&&(this._deployedSolutions=await x(t,e,this._cardsFetcher,this._cardsFetcherDeployed,w,"created"))}_blurTabs(){this._allTabTitle.value?.blur(),this._resourcesTabTitle.value?.blur(),this._detailsTabTitle.value?.blur(),this._mySolutionsTabTitle.value?.blur()}_isSearchToolbarShowing(){return this._activeTab==="all-solutions"||this._activeTab==="deployments"&&this.authentication?.IsSignedIn===!0}_getDefaultSearchOptions(t){let e;if(t){let i=t.domain,s=t.industry,o=t.offerType,r=t.searchTerm,D="",n=t.sortField,h=t.owner;e=i||s?{type:i?"domain":s?"industry":""}:void 0,i&&(e=e?{...e,domain:i}:{domain:i}),s&&(e=e?{...e,industry:s}:{industry:s}),r&&(e=e?{...e,searchTerm:r}:{searchTerm:r}),e&&(e={...e,displayValue:D}),n&&(e=e?{...e,sortType:n}:{sortType:n}),o&&(n=o.toLowerCase(),e=e?{...e,sortType:n}:{sortType:n}),h&&(e=e?{...e,owner:h}:{owner:h})}return e}_setScrollbarGutters(){let t=this._detailsTab.value?.shadowRoot?.firstElementChild;t?.style&&(t.style.scrollbarGutter="stable both-edges");let e=this._deployedCardTab.value?.shadowRoot?.firstElementChild;e?.style&&(e.style.scrollbarGutter="stable both-edges")}};v("solutions-deploy-app",T);return T},"identity/IdentityManager","identity/OAuthInfo","portal/Portal",c,e,h,i,j,k,n,o,q,r,s,t,w)