/*!
 * KoliBri - The accessible HTML-Standard
 */
import{r as registerInstance,h,g as getElement}from"./index-91489a9f.js";import{w as watchHeadingLevel}from"./validation-14b61e5a.js";import{d as dispatchDomEvent,K as KolEvent}from"./events-5adf6b62.js";import{K as KolAlertFc}from"./Alert-080adf2e.js";import{b as watchBoolean,s as setState,w as watchValidator}from"./prop.validators-9feb1d92.js";import{v as validateHasCloser}from"./has-closer-a4e62c58.js";import{v as validateLabel}from"./label-d0315384.js";import"./tslib.es6-1173d062.js";import"./clsx-09a06a12.js";import"./i18n-5fe08f1c.js";import"./i18n-7ea9f137.js";import"./reuse-32931294.js";import"./component-names-a18a51c8.js";import"./Heading-0459992b.js";import"./index-da3e0c00.js";import"./dev.utils-fab45cbc.js";const alertTypeOptions=["default","info","success","warning","error"],alertVariantOptions=["card","msg"],KolAlertWc=class{constructor(t){registerInstance(this,t),this.close=()=>{var t,e;null===(e=null===(t=this._on)||void 0===t?void 0:t.onClose)||void 0===e||e.call(t,new Event("Close")),this.host&&dispatchDomEvent(this.host,KolEvent.close)},this.handleAlertTimeout=()=>{this.validateAlert(!1)},this.validateOnValue=t=>"object"==typeof t&&null!==t&&"function"==typeof t.onClose,this._alert=!1,this._hasCloser=!1,this._label=void 0,this._level=0,this._on=void 0,this._type="default",this._variant="msg",this.state={_level:0}}render(){const{_alert:t,_hasCloser:e,_label:a,_level:l,_type:s,_variant:i}=this.state,o={alert:t,hasCloser:e,label:a,level:l,type:s,variant:i,onCloserClick:this.close,onAlertTimeout:this.handleAlertTimeout};return h(KolAlertFc,Object.assign({key:"8d045b87e0ccf5ee926c8774da3d94bda07d9660"},o),h("slot",{key:"a665623f7355e2e30b728d37d3d9e59e9ad0f43f"}))}validateAlert(t){watchBoolean(this,"_alert",t)}validateHasCloser(t){validateHasCloser(this,t)}validateLabel(t){validateLabel(this,t)}validateLevel(t){watchHeadingLevel(this,t)}validateOn(t){this.validateOnValue(t)&&setState(this,"_on",{onClose:t.onClose})}validateType(t){watchValidator(this,"_type",(t=>"string"==typeof t&&alertTypeOptions.includes(t)),new Set(`String {${alertTypeOptions.join(", ")}`),t)}validateVariant(t){watchValidator(this,"_variant",(t=>"string"==typeof t&&alertVariantOptions.includes(t)),new Set(`AlertVariant {${alertVariantOptions.join(", ")}`),t)}componentWillLoad(){this.validateAlert(this._alert),this.validateHasCloser(this._hasCloser),this.validateLabel(this._label),this.validateLevel(this._level),this.validateOn(this._on),this.validateType(this._type),this.validateVariant(this._variant)}get host(){return getElement(this)}static get watchers(){return{_alert:["validateAlert"],_hasCloser:["validateHasCloser"],_label:["validateLabel"],_level:["validateLevel"],_on:["validateOn"],_type:["validateType"],_variant:["validateVariant"]}}};export{KolAlertWc as kol_alert_wc};