import{_ as A}from"./tslib.es6-CxX45GIN-BAJoBDh7.js";import{V as v,h as a,W as f,e as C,X as L,i as k,Y as E,F as S}from"./index-BvWOSbaR.js";import{c as y}from"./clsx-eK3rPvPS-BT_IL7Fz.js";import{t as s}from"./i18n-CdSCDnmA-CsM0aySV.js";import{K as T}from"./Heading-KhwFHPZb-CVH-FD5x.js";/*!
 * KoliBri - The accessible HTML-Standard
 */const O=s("kol-error"),B=s("kol-info"),M=s("kol-warning"),I=s("kol-success"),K=s("kol-message"),n=({ariaLabel:e,icon:o})=>a(S,null,a("span",{class:"visually-hidden"},e),a(k,{class:E,_label:"",_icons:o})),N=({type:e,label:o})=>{switch(e){case"error":return a(n,{ariaLabel:O,icon:"codicon codicon-error",label:o});case"info":return a(n,{ariaLabel:B,icon:"codicon codicon-info",label:o});case"warning":return a(n,{ariaLabel:M,icon:"codicon codicon-warning",label:o});case"success":return a(n,{ariaLabel:I,icon:"codicon codicon-pass",label:o});default:return a(n,{ariaLabel:K,icon:"codicon codicon-comment",label:o})}},R=s("kol-close-alert"),w=()=>{if(typeof navigator>"u"||typeof navigator.vibrate!="function")return;const e=navigator.userActivation;if((e?.isActive||e?.hasBeenActive)&&matchMedia("(any-pointer: coarse)").matches)try{navigator.vibrate([100,75,100,75,100])}catch{}},x=(e,o)=>{const{class:c={},alert:r=!1,hasCloser:d=!1,label:t,level:u=0,type:_="default",variant:i="msg",onAlertTimeout:l,onCloserClick:m}=e,b=A(e,["class","alert","hasCloser","label","level","type","variant","onAlertTimeout","onCloserClick"]);r&&(w(),setTimeout(()=>{l?.()},1e4));const g=v("kol-alert",{hasCloser:!!d,[`type-${_}`]:!0,[`variant-${i}`]:!0}),h=v("kol-alert","heading",{[`h${u}`]:!0}),p=Object.assign({class:y(c,g)},b);return a("div",Object.assign({"aria-live":r?"assertive":"polite",role:r?"alert":"status"},p,{"data-testid":"alert"}),a("div",{class:"kol-alert__container"},a(N,{label:t,type:_}),a("div",{class:"kol-alert__container-content"},t&&a(T,{class:h,level:u,id:"heading"},t),i==="msg"&&a("span",{class:f,"aria-describedby":t?"heading":void 0},o)),d&&a(C,{class:L,"data-testid":"alert-close-button",_ariaDescription:t?.trim()||"",_hideLabel:!0,_icons:{left:{icon:"codicon codicon-close"}},_label:R,_on:{onClick:m},_tooltipAlign:"left"})),i==="card"&&a("div",{class:f,"aria-describedby":t?"heading":void 0},o))};export{x as K};
//# sourceMappingURL=Alert-yh8R3coC-BCYFPt1y.js.map
