/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import{a as u}from"./2UHME7O6.js";import{a as h}from"./XN2LWKJE.js";import{b as r}from"./ODCCVHGI.js";import{F as a,G as n,H as c,h as o,i as s,r as i}from"./42WFQ3AX.js";var p=o`/** @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.
 */

.panel-bg-white {
  --calcite-panel-background-color: var(--calcite-color-foreground-1);
}`,l=class extends c{constructor(){super(),this.deploymentProgress=0,this.open=!1,this._isInCancelConfirmation=!1,this._showCancelConfirmation=!1,this._showIsCancelling=!1,this._translations=h({name:"solution-deploying-dialog",blocking:!0}),this._carouselKey=0,this._deployingDialogRef=a(),this._carouselRef=a(),this._carouselMessages=[],this._confirmUnload=!1,this.deployingDialogOpened=i(),this.deploymentProcessCancelled=i(),this.listenOn(window,"beforeunload",e=>{(this._confirmUnload||this._showIsCancelling)&&(e.preventDefault(),e.returnValue=!0)})}static{this.properties={abortController:[0,{},{attribute:!1}],card:[0,{},{attribute:!1}],deploymentProgress:[9,{},{type:Number}],open:[5,{},{type:Boolean}],_isInCancelConfirmation:[16,{},{state:!0}],_showCancelConfirmation:[16,{},{state:!0}],_showIsCancelling:[16,{},{state:!0}],_translations:[16,{},{state:!0}],_carouselKey:[16,{},{state:!0}]}}static{this.styles=p}close(){this._showCancelConfirmation=!1,this._showIsCancelling=!1;let e=this._deployingDialogRef.value;e&&(e.open=!1),this.open=!1}confirmCancel(){let e=this._deployingDialogRef.value;e&&(e.open=!0,e.closeDisabled=!0,this._isInCancelConfirmation=!0,this._showIsCancelling=!1),this._showCancelConfirmation=!0}cancelDeployment(){this._isInCancelConfirmation&&this.abortController&&(this.deploymentProcessCancelled.emit(),this.abortController.abort(),this._showIsCancelling=!0,this._showCancelConfirmation=!1)}async load(){}render(){return s`<calcite-dialog close-disabled .heading=${this._translations.title.replace("{{solution}}",this.card?.title??"")} modal width=m .open=${this.open} @calciteDialogBeforeClose=${e=>{e.preventDefault(),this._confirmUnload=!1}} @calciteDialogOpen=${()=>this._onDialogOpen()} outside-close-disabled ${n(this._deployingDialogRef)}>${this._showCancelConfirmation?this.renderCancelModal():this._showIsCancelling?this.renderCancellingModal():s`<calcite-panel class="panel-bg-white"><calcite-loader .label=${this._translations.deploymentInProgress} scale=l .text=${this._translations.deploymentInProgress} type=determinate-value .value=${this.deploymentProgress}></calcite-loader><div style="height: 120px; display: flex; align-items: center;">${u(this._carouselKey,s`<calcite-carousel autoplay=paused autoplay-duration=8000 .label=${this._translations.newsAndFeatures} arrow-type=inline ${n(this._carouselRef)}>${this.renderCarouselItems()}</calcite-carousel>`)}</div></calcite-panel>`}${!this._showCancelConfirmation&&!this._showIsCancelling&&s`<calcite-button appearance=outline @click=${this.confirmCancel} slot=footer-end>${this._translations.cancel}</calcite-button>`||""}${this._showCancelConfirmation&&s`<calcite-button kind=brand @click=${()=>{let e=this._deployingDialogRef.value;e&&(e.closeDisabled=!1),this._isInCancelConfirmation=!1,this._showCancelConfirmation=!1}} slot=footer-end>${this._translations.continueDeployment}</calcite-button><calcite-button appearance=outline @click=${this.cancelDeployment} slot=footer-end>${this._translations.cancelDeploymentButton}</calcite-button>`||""}</calcite-dialog>`}renderCarouselItems(){let e=[];return this._carouselMessages.forEach((t,d)=>{e.push(s`<calcite-carousel-item .label=${`carousel-item-${d}`}><calcite-label layout=inline>${t.icon&&s`<calcite-icon .icon=${t.icon} class="padding-end-0-5"></calcite-icon>`||""}<span .innerHTML=${this._processCarouselMessage(t)??""}></span></calcite-label></calcite-carousel-item>`)}),e}_getCarouselMessages(){let e=this._translations.carousel,t=[{message:e.stockMessage1,icon:"question"},{message:e.stockMessage2,icon:"model"},{message:e.stockMessage3,icon:"lightbulb"},{message:e.stockMessage4,icon:"information"},{message:e.stockMessage5,icon:"speech-bubbles"},{message:e.stockMessage6,icon:"information"}];return t.sort(()=>Math.random()-.5),t}_processCarouselMessage(e){let t=e.message||"";return t.includes("{{url}}")&&e.url&&(t=t.replace("{{url}}",e.url)),t}renderCancelModal(){return s`<calcite-panel class="panel-bg-white">${this._translations.deploymentCancelMessage}</calcite-panel>`}renderCancellingModal(){return s`<calcite-panel class="panel-bg-white"><calcite-loader .label=${this._translations.cancelCurrentDeployment} .text=${this._translations.cancelCurrentDeployment}></calcite-loader></calcite-panel>`}_onDialogOpen(){this._confirmUnload=!0,this._carouselKey++,this._translations.carousel&&(this._carouselMessages=this._getCarouselMessages()),this.deployingDialogOpened.emit(),setTimeout(()=>{let e=this._carouselRef.value;e&&e.play()},100)}};r("solution-deploying-dialog",l);export{l as a};
