/*!
 * KoliBri - The accessible HTML-Standard
 */
import{_ as __rest}from"./tslib.es6.js";import{h,Fragment}from"@stencil/core/internal/client";import{c as clsx}from"./clsx.js";import{t as translate}from"./i18n2.js";import{e as KolIconTag,b as KolHeadingWcTag,c as KolButtonWcTag}from"./component-names.js";import{L as Log}from"./dev.utils.js";const Icon=({ariaLabel:o,icon:l})=>h(Fragment,null,h("span",{class:"visually-hidden"},o),h(KolIconTag,{class:"heading-icon",_label:"",_icons:l})),AlertIcon=({type:o,label:l})=>{switch(o){case"error":return h(Icon,{ariaLabel:translate("kol-error"),icon:"codicon codicon-error",label:l});case"info":return h(Icon,{ariaLabel:translate("kol-info"),icon:"codicon codicon-info",label:l});case"warning":return h(Icon,{ariaLabel:translate("kol-warning"),icon:"codicon codicon-warning",label:l});case"success":return h(Icon,{ariaLabel:translate("kol-success"),icon:"codicon codicon-pass",label:l});default:return h(Icon,{ariaLabel:translate("kol-message"),icon:"codicon codicon-comment",label:l})}},AlertIcon$1=AlertIcon,KolAlertFc=(o,l)=>{const{class:e={},type:a="default",variant:n="msg",label:c,hasCloser:t,alert:s,onAlertTimeout:r,onCloserClick:i,level:d}=o,g=__rest(o,["class","type","variant","label","hasCloser","alert","onAlertTimeout","onCloserClick","level"]);if(s){try{Log.debug(["Navigator should vibrate ...",navigator.vibrate([100,75,100,75,100])])}catch(o){Log.debug("Navigator does not support vibration.")}setTimeout((()=>{null==r||r()}),1e4)}const b=Object.assign({class:clsx("kol-alert-wc","alert",a,n,{hasCloser:!!t},e),role:s?"alert":void 0},g);return h("div",Object.assign({},b),h("div",{class:"heading"},h(AlertIcon$1,{label:c,type:a}),h("div",{class:"heading-content"},c?h(KolHeadingWcTag,{_label:c,_level:d}):null,"msg"===n&&h("div",{class:"content"},l)),t&&h(KolButtonWcTag,{class:"close",_ariaDescription:(null==c?void 0:c.trim())||"",_hideLabel:!0,_icons:{left:{icon:"codicon codicon-close"}},_label:translate("kol-close-alert"),_on:{onClick:i},_tooltipAlign:"left"})),"card"===n&&h("div",{class:"content"},l))},KolAlertFc$1=KolAlertFc;export{KolAlertFc$1 as K};