/*!
 * KoliBri - The accessible HTML-Standard
 */
import{proxyCustomElement,HTMLElement,h}from"@stencil/core/internal/client";import{K as KolAlertFc}from"./Alert.js";import{w as watchValidator,c as watchBoolean,s as setState}from"./common.js";import{v as validateHasCloser}from"./has-closer.js";import{v as validateLabel}from"./label.js";import{d as dispatchDomEvent,K as KolEvent}from"./events.js";import{w as watchHeadingLevel}from"./validation.js";const alertTypeOptions=["default","info","success","warning","error"],isAlertTypePropType=e=>"string"==typeof e&&alertTypeOptions.includes(e),validateAlertType=(e,t)=>{watchValidator(e,"_type",isAlertTypePropType,new Set(alertTypeOptions),t)},alertVariantOptions=["card","msg"],isAlertVariantPropType=e=>"string"==typeof e&&alertVariantOptions.includes(e),validateAlertVariant=(e,t)=>{watchValidator(e,"_variant",isAlertVariantPropType,new Set(alertVariantOptions),t)},KolAlertWc$1=proxyCustomElement(class extends HTMLElement{constructor(e){super(),!1!==e&&this.__registerHost(),this.close=()=>{var e,t;null===(t=null===(e=this._on)||void 0===e?void 0:e.onClose)||void 0===t||t.call(e,new Event("Close")),this.host&&dispatchDomEvent(this.host,KolEvent.close)},this.handleAlertTimeout=()=>{this.validateAlert(!1)},this._alert=!1,this._hasCloser=!1,this._level=0,this._type="default",this._variant="msg",this.state={_level:0},this.validateOnValue=e=>"object"==typeof e&&null!==e&&"function"==typeof e.onClose}render(){const{_alert:e,_hasCloser:t,_label:a,_level:l,_type:i,_variant:s}=this.state,o={alert:e,hasCloser:t,label:a,level:l,type:i,variant:s,onCloserClick:this.close,onAlertTimeout:this.handleAlertTimeout};return h(KolAlertFc,Object.assign({key:"5db3514131f644ab76a9bddc438cdf0af412e6e8"},o),h("slot",{key:"61ef793542ae680a090596e44fcb98b9f4e55708"}))}validateAlert(e){watchBoolean(this,"_alert",e)}validateHasCloser(e){validateHasCloser(this,e)}validateLabel(e){validateLabel(this,e)}validateLevel(e){watchHeadingLevel(this,e)}validateOn(e){this.validateOnValue(e)&&setState(this,"_on",{onClose:e.onClose})}validateType(e){validateAlertType(this,e)}validateVariant(e){validateAlertVariant(this,e)}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 this}static get watchers(){return{_alert:["validateAlert"],_hasCloser:["validateHasCloser"],_label:["validateLabel"],_level:["validateLevel"],_on:["validateOn"],_type:["validateType"],_variant:["validateVariant"]}}},[260,"kol-alert-wc",{_alert:[4],_hasCloser:[4,"_has-closer"],_label:[1],_level:[2],_on:[16],_type:[1],_variant:[1],state:[32]},void 0,{_alert:["validateAlert"],_hasCloser:["validateHasCloser"],_label:["validateLabel"],_level:["validateLevel"],_on:["validateOn"],_type:["validateType"],_variant:["validateVariant"]}]);function defineCustomElement$1(){if("undefined"==typeof customElements)return;["kol-alert-wc"].forEach(e=>{if("kol-alert-wc"===e)customElements.get(e)||customElements.define(e,KolAlertWc$1)})}const KolAlertWc=KolAlertWc$1,defineCustomElement=defineCustomElement$1;export{KolAlertWc,defineCustomElement};