/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import{a as u,b as m}from"./W4YXXJAS.js";import{b as n}from"./77CU4WA2.js";import{a as g}from"./6S75SIVV.js";import{b as p}from"./ABSRNM72.js";import{F as a,G as c,H as d,K as h,h as s,i,j as r,r as l}from"./5CQPQ7AE.js";var f=s`/** @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.
 */

calcite-shell-panel {
  z-index: var(--calcite-z-index-1);
}

.position-relative {
  position: relative;
}

.display-flex {
  display: flex;
}

.flex-1 {
  flex: 1;
}

.flex-grow {
  flex: 1;
  /* This allows the label to grow and take up available space */
}

.flex-shrink-0 {
  flex: 0 0 auto;
  /* This prevents the label from growing and allows it to take only the space it needs */
}

.leader-1 {
  margin-top: var(--calcite-spacing-xxl);
}

.trailer-1 {
  margin-bottom: var(--calcite-spacing-xxl);
}

.warning-text {
  max-width: 35em;
  margin-left: auto;
  margin-right: auto;
  font-size: var(--calcite-font-size-md);
}

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

.border-override {
  border-top-width: var(--calcite-border-width-none);
  border-bottom-width: var(--calcite-border-width-none);
}

.header-override {
  --calcite-panel-header-content-space: var(--calcite-spacing-none);
  --calcite-panel-header-background-color: var(--calcite-color-foreground-2);
}

.panel-override {
  --calcite-panel-background-color: var(--calcite-color-foreground-2);
  --calcite-panel-border-color: none;
}

.label-override {
  --calcite-label-margin-bottom: var(--calcite-spacing-none);
  padding-inline-start: var(--calcite-spacing-base);
  font-weight: var(--calcite-font-weight-medium);
}

.header-button-padding {
  padding-top: var(--calcite-spacing-sm);
  padding-bottom: var(--calcite-spacing-sm);
  padding-inline-start: var(--calcite-spacing-lg);
  padding-inline-end: var(--calcite-spacing-lg);
}

.padding-start {
  padding-inline-start: var(--calcite-spacing-lg);
}

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

.justify-content-end {
  justify-content: end;
}

.filter-width-350 {
  --calcite-shell-panel-width: 350px;
}

.z-index-2 {
  z-index: 2;
}

.mock-fab {
  --calcite-fab-shadow-internal: 0 6px 20px -4px rgba(0, 0, 0, .1), 0 4px 12px -2px rgba(0, 0, 0, .08);
  box-shadow: var(--calcite-fab-shadow, var(--calcite-fab-shadow-internal));
  --calcite-button-background-color: var(--calcite-fab-background-color);
  --calcite-button-border-color: var(--calcite-fab-border-color);
  --calcite-button-text-color: var(--calcite-fab-text-color);
  --calcite-button-loader-color: var(--calcite-fab-loader-color);
}

.position-relative {
  position: relative;
}

.height-100 {
  height: 100%;
}

.height-50 {
  height: 50px;
}

.sign-in-prompt {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.sign-in-icon {
  transform: translateX(-20px)
}

.height-150 {
  height: 150px;
}

.width-150 {
  width: 150px;
}

.padding-top-3 {
  padding-top: 3px;
}`,o=class extends d{constructor(){super(),this.solutionsCount=0,this.filterOpen=!0,this.isMobile=!1,this._showAlertFailed=!1,this._translations=g({name:"solutions-deployed-shell",blocking:!0}),this._configContextConsumer=n({context:m,subscribe:!0}),this._deployedCardFetchFailedMessage="",this._deployedCardFetchFailedTitle="",this._isMobileContextConsumer=n({context:u,subscribe:!0,callback:e=>this.isMobile=e}),this._solutionsDeployedFilterPanel=a(),this._solutionsDeployedPanelRef=a(),this.filterRemoved=l(),this.tokenRefreshed=l(),this._handleSignIn=()=>{let e=window.location.pathname.endsWith("deployments")?"":"deployments";this._configContextConsumer.value?.authentication?.signIn(e)},this.listenOn(window,"deployedCardFetchFailed",e=>{let t=e.detail;this._deployedCardFetchFailedTitle=t.title,this._deployedCardFetchFailedMessage=t.message,this._showAlertFailed=!0})}static{this.properties={solutionsCount:[9,{},{type:Number}],filterOpen:[16,{},{state:!0}],isMobile:[16,{},{state:!0}],_showAlertFailed:[16,{},{state:!0}],_translations:[16,{},{state:!0}]}}static{this.styles=f}willUpdate(e){e.has("isMobile")&&(this.filterOpen=!this.isMobile)}async searchSolutions(e){if(this._solutionsDeployedPanelRef.value?.setSearchOptions(e),"owner"in e){let t=e.owner==="organization";this._solutionsDeployedFilterPanel.value.changeOwnerFilter(!t,!0)}else("sortType"in e||"searchTerm"in e)&&this._solutionsDeployedPanelRef.value?.searchSolutions(e)}async load(){this._isMobileContextConsumer.value&&(this.isMobile=this._isMobileContextConsumer.value)}render(){if(!this._configContextConsumer.value?.authentication?.IsSignedIn)return this._getSignInPrompt();let e=this.isMobile?"justify-content-end":"";return i`<calcite-shell class="position-relative"><calcite-panel class="border-override header-override panel-override z-index-1"><div class=${`display-flex align-items-center height-50 ${e}`} slot=header-content><calcite-label class="label-override flex-shrink-0 padding-top-3" layout=inline>${this._translations.numberOfDeployments?.replace("{{count}}",this.solutionsCount.toString())}</calcite-label></div>${this._getSolutionsDeployedPanel()}</calcite-panel></calcite-shell>`}_getSignInPrompt(){return i`<div class="sign-in-prompt">${this._getSignInIcon()}<div class="text-center leader-1 warning-text trailer-1">${this._translations.signInMessage}</div><calcite-button appearance=outline @click=${this._handleSignIn} scale=l>${this._translations.signIn}</calcite-button></div>`}_getSolutionsDeployedPanel(){console.log("_getSolutionsDeployedPanel called");let e=this.isMobile&&this.filterOpen?{display:"none"}:"";return i`<div><solutions-deployed-panel @deployedCardsFetched=${this._updateSolutionCount} @searchTermSet=${t=>this._solutionsDeployedFilterPanel.value.changeSearchFilter(t.detail.searchTerm,!1)} style=${h(e)} ${c(this._solutionsDeployedPanelRef)}></solutions-deployed-panel><calcite-alert icon=exclamation-mark-triangle kind=danger .label=${this._deployedCardFetchFailedTitle} @calciteAlertClose=${()=>{this._showAlertFailed=!1}} .open=${this._showAlertFailed}><div slot=title>${this._deployedCardFetchFailedTitle}</div><div slot=message>${this._deployedCardFetchFailedMessage}</div></calcite-alert></div>`}_updateSolutionCount(e){this.solutionsCount=e.detail}_getSignInIcon(){return i`<div class="sign-in-icon"><svg viewBox="0 0 64 64" width=200 height=200 xmlns=http://www.w3.org/2000/svg>${r`<path d="M56.9 4.1V60h-.8V4.9H23.3l25.6 7.47v39.26l-28.8 8.4V35h.8v23.97l27.2-7.94V12.97L20.9 5.03V30h-.8V4.1h36.8zM30.735 41.7l.565.566 9.766-9.766-9.766-9.766-.565.567 8.799 8.799H5v.8h34.534l-8.8 8.8z" fill=var(--calcite-color-text-3) />`}</svg></div>`}};p("solutions-deployed-shell",o);export{o as a};
