import{h}from"@stencil/core";import{CancelDialogAction}from"../../../../../../api/dist/ontotext-workbench-api";import{TranslationService}from"../../../services/translation.service";export class OntoConfirmCancelDialog{constructor(){this.isOpen=!1,this.hasDontShowAgain=!1,this.onCancel=()=>this.resolve(CancelDialogAction.CANCEL),this.onExit=()=>this.resolve(CancelDialogAction.EXIT),this.onDontShowAgain=()=>this.resolve(CancelDialogAction.DONT_SHOW_AGAIN)}onConfirmCancelEvent(t){this.hasDontShowAgain=t.detail.hasDontShowAgain,this.onClose=t.detail.onClose,this.isOpen=!0}render(){if(!this.isOpen)return null;const t={dialogTitle:TranslationService.translate("guides.confirm-cancel-modal.title"),onClose:this.onCancel};return h("onto-dialog",{"data-test":"confirm-cancel-dialog",class:"confirm-cancel-dialog",config:t},h("div",{slot:"body"},h("span",{innerHTML:TranslationService.translate("guides.confirm-cancel-modal.subtitle")})),h("button",{slot:"footer",class:"onto-btn onto-btn-secondary","data-test":"cancel-btn",onClick:this.onCancel},h("translate-label",{labelKey:"common.button.cancel"})),this.hasDontShowAgain&&h("button",{slot:"footer",class:"onto-btn onto-btn-secondary","data-test":"dont-show-again-btn",onClick:this.onDontShowAgain},h("translate-label",{labelKey:"guides.confirm-cancel-modal.dont-show-again"})),h("button",{slot:"footer",class:"onto-btn onto-btn-primary","data-test":"exit-btn",onClick:this.onExit},h("translate-label",{labelKey:"guides.confirm-cancel-modal.exit-button"})))}resolve(t){var n;this.isOpen=!1,null===(n=this.onClose)||void 0===n||n.call(this,t)}static get is(){return"onto-confirm-cancel-dialog"}static get originalStyleUrls(){return{$:["onto-confirm-cancel-dialog.scss"]}}static get styleUrls(){return{$:["onto-confirm-cancel-dialog.css"]}}static get states(){return{isOpen:{},hasDontShowAgain:{}}}static get listeners(){return[{name:"confirm-cancel-event",method:"onConfirmCancelEvent",target:"body",capture:!1,passive:!1}]}}