import{r as s,h as o}from"./index-DCi8lcS0.js";import{h as i,v as d}from"./color-Rjy4ux-w-C917hka1.js";import{v as c}from"./image-source-CvUc2vv--D3i75yOe.js";import{v as h}from"./label-pIlPsS_A-DDeB9XCl.js";import{t as n}from"./i18n-DaJ9SqJN-E9me0qMQ.js";const l=t=>t.length===0?"":t[0].toUpperCase(),b=t=>{const a=t.split(/\s+/),r=a[0],e=a[a.length-1];return a.length>=2&&r&&e?`${l(r)}${l(e)}`:l(t)},C=class{constructor(t){s(this,t),this.bgColorStr="#d3d3d3",this.colorStr="#000",this.handleColorChange=a=>{const r=i(a);this.bgColorStr=r.backgroundColor,this.colorStr=r.foregroundColor},this._color="#d3d3d3",this.state={_src:"",_label:"",_color:{backgroundColor:"#d3d3d3",foregroundColor:"#000"}}}render(){return o("div",{key:"04d0b5653648f532391c0b8f611ef3bd7d4e8bbf","aria-label":n("kol-avatar-alt",{placeholders:{name:this.state._label}}),class:"kol-avatar",role:"img",style:{backgroundColor:this.bgColorStr,color:this.colorStr}},this.state._src?o("img",{alt:"","aria-hidden":"true",class:"kol-avatar__image",src:this.state._src}):o("span",{"aria-hidden":"true",class:"kol-avatar__initials"},b(this.state._label.trim())))}validateColor(t){d(this,t,{defaultValue:"#d3d3d3",hooks:{beforePatch:this.handleColorChange}})}validateSrc(t){c(this,t)}validateLabel(t){h(this,t,{required:!0})}componentWillLoad(){this.validateColor(this._color),this.validateSrc(this._src),this.validateLabel(this._label)}static get watchers(){return{_color:["validateColor"],_src:["validateSrc"],_label:["validateLabel"]}}};export{C as kol_avatar_wc};
//# sourceMappingURL=kol-avatar-wc.entry-D83N9zrX.js.map
