/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import c from"./MITVRON5.js";import b from"./XLDH3RFW.js";import a from"./YFLYHPA6.js";import{b as _}from"./W4YXXJAS.js";import{b as x}from"./77CU4WA2.js";import{a as f}from"./6S75SIVV.js";import{b as m}from"./ABSRNM72.js";import{G as g,H as u,J as h,L as n,h as p,i,r as o}from"./5CQPQ7AE.js";export default $arcgis.t(([{a:v,c:y,n:l},{a:b},{d:s,h:w,i:S}])=>{var C=p`/** @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.
 */

.font-weight-med {
  font-weight: var(--calcite-font-weight-medium);
}

.font-weight-bold {
  font-weight: var(--calcite-font-weight-bold);
}

.heading-font {
  font-size: var(--calcite-font-size-0);
  font-weight: var(--calcite-font-weight-medium);
}

.title-font {
  font-size: 1.8rem;
  font-weight: var(--calcite-font-weight-medium);
  color: var(--calcite-color-text-1);
}

.font-1 {
  font-size: var(--calcite-spacing-lg);
}

.display-flex {
  display: flex;
}

.display-none {
  display: none;
}

.flex-direction-column {
  flex-direction: column;
}

.flex-direction-row {
  flex-direction: row;
}

.icon-color {
  color: var(--calcite-color-text-3);
}

.padding-end-xxl {
  padding-inline-end: var(--calcite-spacing-xxl);
}

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

.padding-bottom-xxl {
  padding-bottom: var(--calcite-spacing-xxl);
}

.item-padding {
  --calcite-internal-accordion-item-padding: var(--calcite-spacing-xl);
}

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

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

.font-size-override {
  --calcite-font-size--2: var(--calcite-font-size--1);
}

.background-color-2 {
  background-color: var(--calcite-color-foreground-2);
}

.label-override {
  --calcite-label-margin-bottom: var(--calcite-spacing-none);
}

.position-relative {
  position: relative;
}

.overflow-hidden {
  overflow: hidden;
}

.overflow-auto {
  overflow: auto;
}

.margin-block-start-end-0 {
  margin-block-start: var(--calcite-spacing-none);
  margin-block-end: var(--calcite-spacing-none);
}

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

.panel-background-1 {
  --calcite-panel-background-color: var(--calcite-color-foreground-1);
  --calcite-shell-panel-background-color: var(--calcite-color-foreground-1);
}

.border-none {
  border: none;
}

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

.panel-bg-color {
  --calcite-panel-header-background-color: var(--calcite-color-foreground-1);
  --calcite-panel-background-color: var(--calcite-color-foreground-1);
}

.dialog-y-size {
  --calcite-dialog-size-y: 90%
}

.dialog-x-size {
  --calcite-dialog-size-x: 90%
}

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

.margin-start-end-xxl {
  margin-inline-start: var(--calcite-spacing-xxl);
  margin-inline-end: var(--calcite-spacing-xxl);
}

.justify-between {
  justify-content: space-between;
}

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

.padding-xxl {
  padding: var(--calcite-spacing-xxl);
}

.padding-top-xxl {
  padding-top: var(--calcite-spacing-xxl);
}

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

.padding-bottom-xxl {
  padding-bottom: var(--calcite-spacing-xxl);
}

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

.padding-end-xxl {
  padding-inline-end: var(--calcite-spacing-xxl);
}

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

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

.image-width {
  width: 300px;
  flex-grow: 0;
  flex-shrink: 0;
}

@media (max-width: 1280px) {
  .image-width {
    flex-grow: 2;
    flex-shrink: 0.5;
  }
}

img {
  max-width: 100%;
  height: auto;
  overflow-clip-margin: content-box;
  overflow: clip;
  display: block;
}

.margin-xl {
  margin: var(--calcite-spacing-xl);
}

.line-height-1 {
  line-height: 1.1;
}

.line-height-xxl {
  line-height: var(--calcite-line-height-xxl);
}

@media (max-width: 800px) {
  .image-width {
    display: none;
  }
}

calcite-shell-panel {
  --calcite-shell-panel-max-width: 20rem;
  --calcite-shell-panel-width: 24vw;
}

calcite-shell {
  block-size: unset;
}

.solution-deployed-action {
  --calcite-color-focus: initial;
}`,c=class extends u{constructor(){super(),this.diagramKey="",this.open=!1,this.templateInfos=[],this._accordionLoading=!1,this._configureTitlesOpen=!1,this._deleteDialogOpen=!1,this._hasNewVersion=!1,this._isDiagramOpen=!1,this._isNameConflict=!1,this._invalidNameMessage="",this._showSuccessAlert=!1,this._showFailedAlert=!1,this._showItemUpdateLoading=!1,this._templateInfoGraph=[],this._translations=f({name:"solution-deployed-card-panel",blocking:!0}),this._configContextConsumer=x({context:_,subscribe:!0,callback:async e=>{e&&(this._isOrgAdmin=e.authentication?.PortalUserSubset?.role==="org_admin"||y(e.authentication),this._user=e.authentication?.Portal?.user)}}),this._isOrgAdmin=!1,this.navTabSelected=o(),this.forceSelectTab=o(),this.sortTypeChanged=o(),this.solutionConfigureDialogClose=o(),this._nonSolutionDependencyItems=[],this.listenOn(window,"deployedCardSelected",this._deployedCardSelected),this.listenOn(window,"deployAppTabSelected",this._handleDeployAppTabSelected),this.listenOn(window,"displayDeployedCard",()=>{this._showSuccessAlert=!0})}static{this.properties={card:[0,{},{attribute:!1}],cardRef:1,diagramKey:1,open:[5,{},{type:Boolean}],templateInfos:[0,{},{attribute:!1}],_accordionLoading:[16,{},{state:!0}],_configureTitlesOpen:[16,{},{state:!0}],_deleteDialogOpen:[16,{},{state:!0}],_hasNewVersion:[16,{},{state:!0}],_isDiagramOpen:[16,{},{state:!0}],_isNameConflict:[16,{},{state:!0}],_invalidNameMessage:[16,{},{state:!0}],_showSuccessAlert:[16,{},{state:!0}],_showFailedAlert:[16,{},{state:!0}],_showItemUpdateLoading:[16,{},{state:!0}],_templateInfoGraph:[16,{},{state:!0}],_translations:[16,{},{state:!0}],_nonSolutionDependencyItems:[16,{},{state:!0}]}}static{this.styles=C}get _telemetry(){return this._configContextConsumer.value?.telemetrySession}render(){return i`<calcite-shell class="position-relative background-color-2"><calcite-panel class="padding-end-xxl panel-background-2 border-none" slot=panel-bottom><div class="display-flex flex-direction-column overflow-hidden"><div class="background-color-2 padding-top-xxl">${this._getSolutionPanel()}</div>${this._getSolutionContents()}</div></calcite-panel><calcite-shell-panel class="panel-background-1" slot=panel-end>${this._getButtons()}${this._getOwnerSection()}<div class="bottom-border margin-start-end-xxl"></div>${this._getSolutionVersionCard()}</calcite-shell-panel>${this._renderDiagramDialog()}${this._getConfigureTitlesDialog()}${this._getDeleteDialog()}${this._getSuccessDeployAlert()}</calcite-shell>`}async _deployedCardSelected(e){let t=e.detail;this.card=t.card,this.cardRef=t.cardRef,this.templateInfos=[],this._accordionLoading=!0,this.templateInfos=await this._getTemplates(),this._accordionLoading=!1;let a=await b(this._configContextConsumer.value.userSession,this.card);this._nonSolutionDependencyItems=a._nonSolutionDependencyItems,setTimeout(async()=>{await this._accordionRef.expandFirstItem(),a.uniqueIitemIds.length>0&&(this._accordionRef.listSelectionMode="multiple",this._accordionRef.selectItems(a.uniqueIitemIds))},250);let r=w(this._configContextConsumer.value?.allCards||[],this.card.deployCommonId),d=!1;if(r){let D=s(r),$=s(this.card);d=D>$}this._hasNewVersion=d}_handleDeployAppTabSelected(e){e.detail==="deployed-card"&&this.sortTypeChanged.emit("")}_getButtons(){let e=this._configContextConsumer.value?.userSession?.username,t=this.card?.owner===e||this._isOrgAdmin,a=t?"display-none":"";return i`<div class="display-flex flex-direction-column padding-xxl"><calcite-button appearance=outline class="padding-bottom-lg solution-deployed-action" kind=neutral @click=${this._openDiagram}>${this._translations.viewTheDiagram}</calcite-button><calcite-button appearance=outline class="padding-bottom-lg solution-deployed-action" kind=neutral @click=${this._viewDocumentation}>${this._translations.solutionDocumentation}</calcite-button><calcite-button appearance=outline class="padding-bottom-lg solution-deployed-action" kind=neutral @click=${this._openItemDetails}>${this._translations.itemDetails}</calcite-button><calcite-button appearance=outline class="padding-bottom-lg solution-deployed-action" .disabled=${!t} id=solution-configure-titles-button kind=neutral @click=${this._openConfigureTitlesDialog}>${this._translations.updateTitles}</calcite-button><calcite-tooltip class=${h(a)} overlay-positioning=fixed reference-element=solution-configure-titles-button><span>${this._translations.mustOwnSolution}</span></calcite-tooltip><calcite-button appearance=outline class="padding-bottom-lg solution-deployed-action" kind=neutral @click=${this._deleteSolution}>${this._translations.deleteSolution}</calcite-button></div>`}_openConfigureTitlesDialog(){this._configureTitlesOpen=!0}_getConfigureTitlesDialog(){return this._configureTitlesOpen?i`<solution-configure-titles .card=${this.card} @solutionConfigureTitlesBeforeClose=${async()=>{this.templateInfos=await this._getTemplates(),this._configureTitlesOpen=!1}} @solutionItemsTitlesChanged=${async()=>{this.templateInfos=await this._getTemplates()}} .open=${this._configureTitlesOpen} source="Details Page" .templateInfos=${this.templateInfos}></solution-configure-titles>`:""}_viewDocumentation(e){e.stopPropagation(),this._telemetry?.logEvent({category:l.DEPLOYMENTS,action:"Open Help",dimensions:[this.card?.title||"",this.card?.deployCommonId||"",this.card?.deployVersion||"","Details Page"]}),window.open(this.card.learnMoreUrl,"_blank")}_openItemDetails(e){e.stopPropagation(),this._telemetry?.logEvent({category:l.DEPLOYMENTS,action:"Open Item Details",dimensions:[this.card?.title||"",this.card?.deployCommonId||"",this.card?.deployVersion||"","Details Page"]}),window.open(this.card.itemUrl,"_blank")}_getOwnerSection(){if(this._configContextConsumer?.value)return i`<div class="display-flex padding-bottom-xxl margin-start-end-xxl flex-direction-column"><div class="display-flex justify-between items-baseline"><calcite-label class="font-weight-med label-override" layout=inline scale=l>${this._translations.aboutYourSolutionOwner}</calcite-label></div><solution-user-avatar .fullname=${this._user?.username===this.card?.owner?this._user?.fullName:void 0} .lookupProfile=${this._user?.username!==this.card?.owner} .thumbnailUrl=${this._user?.username===this.card?.owner?this._user?.thumbnailUrl:void 0} .username=${this.card?.owner}></solution-user-avatar></div>`}async _openDiagram(e){e.stopPropagation();let t=await this._getTemplates();t&&(this._telemetry?.logEvent({category:l.DEPLOYMENTS,action:"View Diagram",dimensions:[this.card?.title||"",this.card?.deployCommonId||"",this.card?.deployVersion||"","Details Page"]}),this._templateInfoGraph=t,this._isDiagramOpen=!0)}async _getTemplates(){return this.cardRef?await this.cardRef.getTemplates():this.card?await v(this.card.id,this._configContextConsumer.value.userSession):void 0}_getSolutionVersionCard(){let e=this._hasNewVersion?this._translations.newVersionAvailable:this._translations.youHaveTheLatestVersion;return i`<div class="padding-xxl display-flex flex-direction-column"><calcite-label class="font-weight-med label-override" layout=inline scale=l slot=heading>${this._translations.solutionVersion.replace("{{version}}",this.card?.deployVersion||"")}</calcite-label><div class="display-flex"><div class="display-flex flex-direction-row padding-top-lg align-items-center"><calcite-icon class="icon-color" icon=clock-forward scale=m></calcite-icon><div class="display-flex flex-direction-column padding-start-xxl"><span>${e}</span></div></div></div>${this._hasNewVersion?i`<calcite-button appearance=outline class="padding-top-lg solution-deployed-action" kind=neutral @click=${this._openNewVersionSolution} width=full>${this._translations.learnMoreNewVersion}</calcite-button>`:""}</div>`}async _openNewVersionSolution(e){e.stopPropagation(),this._telemetry?.logEvent({category:l.DEPLOYMENTS,action:"View Latest Version",dimensions:[this.card?.title||"",this.card?.deployCommonId||"",this.card?.deployVersion||""]}),await new Promise(a=>setTimeout(a,100));let t=S(this._configContextConsumer.value.allCards,this.card.deployCommonId);t&&this.forceSelectTab.emit({tabType:"details",tabTitleOrId:t})}_getSolutionPanel(){let e=this.card?.thumbnailUrl.replace(/w=\d+/,"w=400"),t=this._configContextConsumer.value?.userSession;return i`<calcite-panel class="font-size-override panel-background-1"><div class="display-flex flex-direction-row"><div class="image-width margin-xl"><img alt=${this.card?.title??n} src=${e?`${e}&token=${t?.token}`:""}></div><div class="display-flex flex-direction-column"><h1 class="title-font margin-block-start-end-0 padding-end-xxl padding-start-sm padding-top-xxl padding-bottom-xxl line-height-1">${this.card?.title}</h1><div class="display-flex flex-direction-column padding-bottom-xxl padding-start-sm"><div class="display-flex align-items-start padding-bottom-xxl"><div class="font-1 padding-end-1 line-height-xxl">${this.card?.snippet}</div></div><div class="display-flex"><div class="display-flex"><calcite-label class="label-override icon-color" layout=inline><calcite-icon class="icon-color" icon=projects scale=s></calcite-icon>${this._translations.aboutYourSolutionDeployedDate.replace("{{deployedDate}}",this.card?.created||"")}</calcite-label></div></div></div></div></div></calcite-panel>`}_getSolutionContents(){let e=[...new Set(this._nonSolutionDependencyItems.map(t=>t.controlItemId))];return i`<calcite-panel class="panel-background-1 padding-top-xxl"><calcite-accordion class="accordion-bg " icon-position=start scale=l appearance=transparent><calcite-accordion-item class="item-padding" expanded><div class="margin-block-start-end-0 heading-font " slot=content-start>${this._translations.solutionsContentsAndCount.replace("{{numberOfSolutions}}",this.templateInfos.length.toString())}</div><div class="overflow-auto">${this._accordionLoading?i`<calcite-loader .label=${this._translations.loadingText} scale=m></calcite-loader>`:i`<solution-item-accordion .itemRelationshipDependencies=${e} .listSelectionMode=${e.length>0?"multiple":"single"} .reuseWarning=${this._translations.itemUsedInOtherSolutions} .templateInfos=${this.templateInfos} .typeKeywords=${this.card?.typeKeywords} ${g(async t=>{t&&(this._accordionRef=t)})}></solution-item-accordion>`}</div></calcite-accordion-item></calcite-accordion></calcite-panel>`}_getDeleteDialog(){return this._deleteDialogOpen?i`<solution-delete-dialog .card=${this.card} @solutionDeleted=${()=>setTimeout(()=>this.navTabSelected.emit({tabType:"deployments"}),100)} @solutionDeleteDialogBeforeClose=${()=>{this._deleteDialogOpen=!1}} .open=${this._deleteDialogOpen} source="Details Page"></solution-delete-dialog>`:""}_getSuccessDeployAlert(){return i`<calcite-alert auto-close auto-close-duration=medium icon=check-circle kind=success .label=${this._translations.deploySuccessAlert.replace("{{solutionTitle}}",this.card?.title??"")} .open=${this._showSuccessAlert} @calciteAlertClose=${()=>{this._showSuccessAlert=!1}}><div slot=title>${this._translations.deploySuccessAlert.replace("{{solutionTitle}}",this.card?.title??"")}</div></calcite-alert>`}_renderDiagramDialog(){return this._isDiagramOpen?i`<calcite-dialog class="dialog-y-size dialog-x-size panel-bg-color" .heading=${this._translations.diagramOfTheSolution.replace("{{solution}}",this.card?.title??"")} id=${this._translations.diagramOfTheSolution.replace("{{solution}}",this.card?.title??"")??n} modal .open=${this._isDiagramOpen} @calciteDialogClose=${()=>{this._isDiagramOpen=!1}} outside-close-disabled scale=m width=l><solution-item-diagram .diagramKey=${this.diagramKey!==""?this.diagramKey:this._configContextConsumer.value?.diagramKey??""} .templateInfoGraph=${this._templateInfoGraph} .typeKeywords=${this.card?.typeKeywords}></solution-item-diagram></calcite-dialog>`:""}async _deleteSolution(){this._deleteDialogOpen=!0}};m("solution-deployed-card-panel",c);return c},a,b,c)