/*!
 * KoliBri - The accessible HTML-Standard
 */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const index=require("./index-87a7393a.js"),i18n=require("./i18n-1d085d07.js"),imageSource=require("./image-source-27335383.js"),label=require("./label-b8654499.js");require("./i18n-737701e2.js"),require("./reuse-8cfefa9b.js"),require("./prop.validators-96dfedce.js"),require("./index-38f5f0b2.js"),require("./dev.utils-58fde089.js");const formatNameAsInitial=e=>0===e.length?"":e[0].toUpperCase(),formatLabelAsInitials=e=>{const a=e.split(/\s+/),t=a.at(0),i=a.at(-1);return a.length>=2&&t&&i?`${formatNameAsInitial(t)}${formatNameAsInitial(i)}`:formatNameAsInitial(e)},KolAvatarWc=class{constructor(e){index.registerInstance(this,e),this._src=void 0,this._label=void 0,this.state={_src:"",_label:""}}render(){return index.h("div",{key:"3343b9da0025b1db79bc3353197ed57e1ea15624","aria-label":i18n.translate("kol-avatar-alt",{placeholders:{name:this.state._label}}),class:"kol-avatar",role:"img"},this.state._src?index.h("img",{alt:"","aria-hidden":"true",class:"kol-avatar__image",src:this.state._src}):index.h("span",{"aria-hidden":"true",class:"kol-avatar__initials"},formatLabelAsInitials(this.state._label.trim())))}validateSrc(e){imageSource.validateImageSource(this,e)}validateLabel(e){label.validateLabel(this,e,{required:!0})}componentWillLoad(){this.validateSrc(this._src),this.validateLabel(this._label)}static get watchers(){return{_src:["validateSrc"],_label:["validateLabel"]}}};exports.kol_avatar_wc=KolAvatarWc;