import{_ as A}from"./tslib.es6-CxX45GIN-BGVaTf34.js";import{N as v,h as a,O as f,e as C,P as p,i as L,Q as E,F as S}from"./index-CekivK6a.js";import{c as y}from"./clsx-eK3rPvPS-B-dksMZM.js";import{t as o}from"./i18n-BgOmSzBT-Bv58MaPd.js";import{K as T}from"./Heading-Q9zUs0sa-BeyJrhll.js";const O=o("kol-error"),B=o("kol-info"),M=o("kol-warning"),I=o("kol-success"),K=o("kol-message"),r=({ariaLabel:e,icon:t})=>a(S,null,a("span",{class:"visually-hidden"},e),a(L,{class:E,_label:"",_icons:t})),N=({type:e,label:t})=>{switch(e){case"error":return a(r,{ariaLabel:O,icon:"kolicon-alert-error",label:t});case"info":return a(r,{ariaLabel:B,icon:"kolicon-alert-info",label:t});case"warning":return a(r,{ariaLabel:M,icon:"kolicon-alert-warning",label:t});case"success":return a(r,{ariaLabel:I,icon:"kolicon-alert-success",label:t});default:return a(r,{ariaLabel:K,icon:"kolicon-alert-info",label:t})}},R=o("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{}},D=(e,t)=>{const{class:i={},alert:c=!1,hasCloser:d=!1,label:s,level:u=0,type:_="default",variant:n="msg",onAlertTimeout:l,onCloserClick:b}=e,g=A(e,["class","alert","hasCloser","label","level","type","variant","onAlertTimeout","onCloserClick"]);c&&(w(),setTimeout(()=>{l?.()},1e4));const m=v("kol-alert",{hasCloser:!!d,[`type-${_}`]:!0,[`variant-${n}`]:!0}),k=v("kol-alert","heading",{[`h${u}`]:!0}),h=Object.assign({class:y(i,m)},g);return a("div",Object.assign({role:c?"alert":void 0},h,{"data-testid":"alert"}),a("div",{class:"kol-alert__container"},a(N,{label:s,type:_}),a("div",{class:"kol-alert__container-content"},s&&a(T,{class:k,level:u,id:"heading"},s),n==="msg"&&a("span",{class:f,"aria-describedby":s?"heading":void 0},t)),d&&a(C,{class:p,"data-testid":"alert-close-button",_ariaDescription:s?.trim()||"",_hideLabel:!0,_icons:{left:{icon:"kolicon-cross"}},_label:R,_on:{onClick:b},_tooltipAlign:"left"})),n==="card"&&a("div",{class:f,"aria-describedby":s?"heading":void 0},t))};export{D as K};
//# sourceMappingURL=Alert-DukOPIYO-BVVx5MXk.js.map
