/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import{a as d}from"./I5GF7UR6.js";import{a as h}from"./6S75SIVV.js";import{b as c}from"./ABSRNM72.js";import{F as i,G as l,H as r,h as o,i as t,r as a}from"./5CQPQ7AE.js";var u=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);
}

calcite-loader {
  --calcite-loader-spacing: var(--calcite-spacing-md);
}

.loader-text {
  margin-top: var(--calcite-spacing-sm);
  margin-bottom: var(--calcite-spacing-xxxl);
  text-align: center;
  font-size: var(--calcite-font-size-relative-base);
  color: var(--calcite-color-text-1);
}
`,n=class extends r{constructor(){super(),this.deploymentProgress=0,this.open=!1,this.isWaitingForCard=!1,this._isInCancelConfirmation=!1,this._showCancelConfirmation=!1,this._showIsCancelling=!1,this._translations=h({name:"solution-deploying-dialog",blocking:!0}),this._carouselKey=0,this._deployingDialogRef=i(),this._carouselRef=i(),this._carouselMessages=[],this._confirmUnload=!1,this.deployingDialogOpened=a(),this.deploymentProcessCancelled=a(),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}],isWaitingForCard:[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=u}close(){this._showCancelConfirmation=!1,this._showIsCancelling=!1,this.isWaitingForCard=!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 t`<calcite-dialog close-disabled .heading=${this._translations.title.replace("{{solution}}",this.card?.title??"")} escape-disabled modal width=m .open=${this.open} @calciteDialogBeforeClose=${e=>{e.preventDefault(),this._confirmUnload=!1}} @calciteDialogOpen=${()=>this._onDialogOpen()} outside-close-disabled ${l(this._deployingDialogRef)}>${this._showCancelConfirmation?this.renderCancelModal():this._showIsCancelling?this.renderCancellingModal():t`<calcite-panel class="panel-bg-white">${this.isWaitingForCard?t`<calcite-loader .label=${this._translations.deploymentInProgress} scale=l type=indeterminate></calcite-loader><div class="loader-text">${this._translations.deploymentInProgress}</div>`:t`<calcite-loader .label=${this._translations.deploymentInProgress} scale=l type=determinate-value .value=${this.deploymentProgress}></calcite-loader><div class="loader-text">${this._translations.deploymentInProgress}</div>`}<div style="height: 120px; display: flex; align-items: center;">${d(this._carouselKey,t`<calcite-carousel autoplay=paused autoplay-duration=8000 .label=${this._translations.newsAndFeatures} arrow-type=inline ${l(this._carouselRef)}>${this.renderCarouselItems()}</calcite-carousel>`)}</div></calcite-panel>`}${!this._showCancelConfirmation&&!this._showIsCancelling&&t`<calcite-button appearance=outline @click=${this.confirmCancel} slot=footer-end>${this._translations.cancel}</calcite-button>`||""}${this._showCancelConfirmation&&t`<calcite-button kind=brand @click=${()=>{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((s,p)=>{e.push(t`<calcite-carousel-item .label=${`carousel-item-${p}`}><calcite-label layout=inline>${s.icon&&t`<calcite-icon .icon=${s.icon} class="padding-end-0-5"></calcite-icon>`||""}<span .innerHTML=${this._processCarouselMessage(s)??""}></span></calcite-label></calcite-carousel-item>`)}),e}_getCarouselMessages(){let e=this._translations.carousel,s=[{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 s.sort(()=>Math.random()-.5),s}_processCarouselMessage(e){let s=e.message||"";return s.includes("{{url}}")&&e.url&&(s=s.replace("{{url}}",e.url)),s}renderCancelModal(){return t`<calcite-panel class="panel-bg-white">${this._translations.deploymentCancelMessage}</calcite-panel>`}renderCancellingModal(){return t`<calcite-panel class="panel-bg-white"><calcite-loader .label=${this._translations.cancelCurrentDeployment}></calcite-loader><div class="loader-text">${this._translations.cancelCurrentDeployment}</div></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)}};c("solution-deploying-dialog",n);export{n as a};
