import{r as s,d as o,a as n,h as l,k as d,s as c,g as r,n as h,w as _}from"./index-B6uGkrgD.js";import{v}from"./label-Cw7rCjUo-YeMVw3_3.js";import{c as b}from"./clsx-COFh-Vc8-D7cYsJM5.js";import{h as f}from"./tooltip-open-tracking-rBbBgPWP-DRkgcff2.js";const k=(a,t,i)=>{h(a,"_width",t,Object.assign({defaultValue:"100%"},i))},e=["blank","card"],g=(a,t)=>{_(a,"_variant",i=>typeof i=="string"&&e.includes(i),new Set(e),t)},u=class{constructor(a){s(this,a),this.on={onClose:async()=>{await this.closeModal()}},this._width="100%",this._variant="blank",this.state={_label:"",_width:"100%"}}disconnectedCallback(){this.closeModal()}handleNativeCloseEvent(){var a,t;(t=(a=this.state._on)===null||a===void 0?void 0:a.onClose)===null||t===void 0||t.call(a),this.host&&o(this.host,n.close)}async openModal(){var a;(a=this.refDialog)===null||a===void 0||a.showModal()}async closeModal(){var a,t;(t=(a=this.refDialog)===null||a===void 0?void 0:a.close)===null||t===void 0||t.call(a)}render(){return l("dialog",{key:"79eabc223c45b893a37583629c11036c2abcff99","aria-label":this.state._label,class:b("kol-dialog","kol-modal",{"kol-dialog__blank":this.state._variant==="blank","kol-dialog__card":this.state._variant==="card","kol-modal__blank":this.state._variant==="blank","kol-modal__card":this.state._variant==="card"}),onCancel:f,onClose:this.handleNativeCloseEvent.bind(this),ref:a=>{this.refDialog=a},style:{width:this.state._width}},this.state._variant==="blank"&&l("slot",{key:"27c411d199e0ad7c9812febdbf3792cf44c3ddc7"}),this.state._variant==="card"&&l(d,{key:"49c0e69ab921e40845dcf25eeabd92d52cf1c4ff",_label:this.state._label,_hasCloser:!0,_on:this.on},l("slot",{key:"46213ef9acb4b3b07d54c22fdc98dfc4597bb42e"})))}validateLabel(a){v(this,a,{required:!0})}validateOn(a){if(typeof a=="object"&&a!==null){const t={};(typeof a.onClose=="function"||a.onClose===!0)&&(t.onClose=a.onClose),c(this,"_on",t)}}validateWidth(a){k(this,a)}validateVariant(a){g(this,a)}componentWillLoad(){this.validateLabel(this._label),this.validateOn(this._on),this.validateWidth(this._width),this.validateVariant(this._variant)}get host(){return r(this)}static get watchers(){return{_label:["validateLabel"],_on:["validateOn"],_width:["validateWidth"],_variant:["validateVariant"]}}};export{u as kol_dialog_wc};
//# sourceMappingURL=kol-dialog-wc.entry-CNvpSQIm.js.map
