export const __webpack_esm_id__=4626;export const __webpack_esm_ids__=[2245,4626];export const __webpack_esm_modules__={2245(t,e,a){a(1821),a(1161),a(3477);var i,n=a(1618),s=a(9609),o=a(7154),r=a(4084),c=a(2927),l=a(8899),h=a(4955),p=a(3517),d=a(1156),m=a(1666),y=a(6325),u=function(t,e,a,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,a,i);else for(var r=t.length-1;r>=0;r--)(n=t[r])&&(o=(s<3?n(o):s>3?n(e,a,o):n(e,a))||o);return s>3&&o&&Object.defineProperty(e,a,o),o};!function(t){let e=class extends c.LitElement{constructor(){super(...arguments),this._tabIndex=0,this.alt="",this.src="",this.label="",this.title="",this.color="",this.decrypting=!1,this.role="img",this.iconName="",this.failurePresence=!1,this.type="",this.newMomentum=!1,this.typing=!1,this.size=40,this.hasNotification=!1,this.clickable=!1,this.avatarStyle="default",this.state="rest",this.imageLoaded=!1,this.imageErrored=!1,this.presenceColor="",this.presenceIcon="",this.iconNameMap={"channel-chat":"chat-filled","channel-chat-outbound":"chat-outbound-filled","channel-social":"sms-message-filled","channel-sms-inbound":"sms-filled","channel-sms-outbound":"sms-outgoing-filled","channel-email-inbound":"email-filled","channel-email-outbound":"email-outgoing-filled","channel-call":"handset-filled","channel-call-inbound":"incoming-call-legacy-filled","channel-callback":"outgoing-call-legacy-filled","channel-callback-v2":"outgoing-call-legacy-bold","channel-headset":"headset-filled","channel-campaign":"campaign-management-bold","channel-emoji":"emoji-happy-filled","channel-webex":"webex-app-icon-color-container","channel-fb-messenger":"social-fbmessenger-color","channel-facebook":"social-facebook-color","channel-apple-chat":"apple-business-chat-color","channel-line":"social-line-color","channel-twitter-x":"social-x","channel-viber":"social-viber-color","channel-whats-app":"social-whatsapp-color","channel-we-chat":"social-wechat-color","channel-spam":"participant-unknown-bold","channel-monitoring":"monitoring-bold","channel-work-item":"custom-task-ind-regular"}}get tabIndex(){return this._tabIndex}set tabIndex(t){const e=this._tabIndex;this._tabIndex=t,this.requestUpdate("tabIndex",e)}static get styles(){return[r.A,y.A]}isPresenceType(t){return n.e.includes(t)}firstUpdated(){const t=this.presenceType||(this.isPresenceType(this.type)?this.type:"");if(t){const{presenceColor:e,presenceIcon:a}=(0,n.E)(t,this.failurePresence,this.newMomentum);this.presenceColor=e,this.presenceIcon=a}}willUpdate(t){var e;null===(e=super.willUpdate)||void 0===e||e.call(this,t);const a=this.presenceType||(this.isPresenceType(this.type)?this.type:"");if(a&&(t.has("type")||t.has("presenceType")||t.has("newMomentum"))){const{presenceColor:t,presenceIcon:e}=(0,n.E)(a,this.failurePresence,this.newMomentum);this.presenceColor=t,this.presenceIcon=e}}updated(t){super.updated(t),t.has("role")&&this.style.setProperty("--avatar-cursor","button"===this.role?"pointer":"default")}get avatarClassMap(){return Object.assign(Object.assign({},this.newMomentum&&"bot"!==this.type||!this.type?{}:{[`md-avatar--${this.type}`]:!0}),{[`md-avatar--${this.size}`]:!!this.size,[`md-avatar--${this.color}`]:!!this.color,active:"active"===this.state})}get avatarLetterClassMap(){return{"md-decrypting":this.decrypting,[`md-avatar--${this.color}`]:this.color,"new-momentum":this.newMomentum,active:"active"===this.state}}get avatarStyleMap(){return{[`md-avatar--${this.color}`]:this.color}}get pretifyTitle(){if(this.title.length){const t=this.title.trim().split(" ");return 1===t.length?t[0].charAt(0):t[0].charAt(0)+t[t.length-1].charAt(0)}return this.title}get chatIconName(){return"chat-filled"}getIconName(t){return this.iconNameMap[t]||""}get chatIconSize(){return this.iconSize}get presenceSize(){return this.size<=24?10.5:this.size<=32?14:this.size<=48?13.94:this.size<=64?18.58:this.size<=72?20.9:this.size<=88?25.55:36}get iconSize(){return 24===this.size?"16":28===this.size?"18":32===this.size?"20":36===this.size?"22":40===this.size?"24":48===this.size?"28":56===this.size?"32":64===this.size?"36":72===this.size?"40":Math.round(this.size/1.7).toString()}get renderIsTyping(){return"typing"===this.type||this.typing?c.html` <md-loading></md-loading> `:c.nothing}get avatarLetter(){return this.title?c.html`
            <span class="md-avatar__letter ${(0,h.classMap)(this.avatarLetterClassMap)}">
              ${this.pretifyTitle}
              <slot></slot>
              ${this.renderIsTyping}
            </span>
          `:c.nothing}get avatarIcon(){return c.html`
        <span class="md-avatar__icon ${(0,h.classMap)(this.avatarStyleMap)}">
          <md-icon
            .name=${this.iconName}
            .iconSet=${this.newMomentum?"momentumDesign":"momentumUI"}
            .size=${this.newMomentum?this.iconSize:""}
          ></md-icon>
        </span>
      `}get avatarImage(){return c.html`
        ${(0,m.until)(this.loadImage().then(t=>(this.handleImageLoad(),c.html` ${t} `)).catch(()=>this.handleImageError()),c.html` ${this.iconName?this.avatarIcon:this.title?c.html` ${this.avatarLetter} `:c.nothing} `)}
      `}loadImage(){return t=this,e=void 0,i=function*(){return new Promise((t,e)=>{const a=document.createElement("img");a.src=this.src,a.alt=this.alt,a.onload=()=>t(a),a.onerror=t=>e(t),a.classList.add("md-avatar__img"),a.classList.toggle("md-avatar__img--hidden",!this.imageLoaded)})},new((a=void 0)||(a=Promise))(function(n,s){function o(t){try{c(i.next(t))}catch(t){s(t)}}function r(t){try{c(i.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof a?e:new a(function(t){t(e)})).then(o,r)}c((i=i.apply(t,e||[])).next())});var t,e,a,i}handleImageLoad(){this.imageLoaded=!0}handleImageError(){this.imageErrored=!0}handleKeyDown(t){if(!this.clickable)return;const{code:e}=t;(0,o.o)(e)&&this.dispatchEvent(new CustomEvent("button-keydown",{composed:!0,bubbles:!0,detail:{srcEvent:t}}))}handleClick(t){var e;this.clickable&&(null===(e=this.clickFunction)||void 0===e||e.call(this),this.dispatchEvent(new CustomEvent("button-click",{composed:!0,bubbles:!0,detail:{srcEvent:t}})))}getBrandOrDesignIconSet(t){return new Set(["webex-app-icon-color-container","social-fbmessenger-color","social-facebook-color","apple-business-chat-color","social-line-color","social-viber-color","social-x","social-whatsapp-color","social-wechat-color"]).has(t)?"momentumBrandVisuals":"momentumDesign"}get avatarContent(){return this.src&&!this.imageErrored?this.avatarImage:this.iconName?this.avatarIcon:this.title?this.avatarLetter:c.nothing}renderPresence(){return this.newMomentum&&(this.presenceType||this.type)&&"self"!==this.type&&this.presenceIcon?c.html`
            <md-presence
              class="avatar-presence"
              name="${this.presenceIcon}"
              color="${this.presenceColor}"
              size="${this.presenceSize}"
              .failurePresence=${this.failurePresence}
              .newMomentum=${this.newMomentum}
              .avatarLinked=${!0}
            >
            </md-presence>
          `:c.nothing}renderAvatarContent(){const t=this.getIconName(this.type);if("channel-custom"===this.type)return c.html`
          <span class="md-avatar__logo" data-channel-style=${this.avatarStyle} data-channel-state=${this.state}>
            <slot></slot>
          </span>
        `;if(t){const e=this.getBrandOrDesignIconSet(t);return c.html`
          <span
            class="md-avatar__logo ${this.type}"
            data-channel-style=${this.avatarStyle}
            data-channel-state=${this.state}
          >
            <md-icon
              .name=${t}
              .iconSet=${e}
              .size=${this.chatIconSize}
              color="var(--icon-color-${this.type})"
            ></md-icon>
          </span>
        `}return this.avatarContent}render(){return c.html`
        <div
          part="avatar"
          class="md-avatar 
          ${(0,h.classMap)(this.avatarClassMap)}"
          role=${this.role}
          @click=${t=>this.handleClick(t)}
          @keydown=${t=>this.handleKeyDown(t)}
          tabindex=${(0,p.ifDefined)(this.tabIndex||void 0)}
          aria-label=${(0,p.ifDefined)(this.label)}
        >
          ${"self"===this.type?c.html`
                <span class="md-avatar__self" style=${(0,d.styleMap)(this.avatarStyleMap)}>
                  <md-icon .name=${this.chatIconName} .iconSet=${"momentumDesign"} .size=${this.chatIconSize}></md-icon>
                </span>
              `:this.renderAvatarContent()}
          ${this.hasNotification?c.html` <span class="md-avatar__notification-badge"></span> `:c.nothing}
          ${this.renderPresence()}
        </div>
      `}};u([(0,l.property)({type:Number,attribute:"tab-index",reflect:!0})],e.prototype,"tabIndex",null),u([(0,l.property)({type:String})],e.prototype,"alt",void 0),u([(0,l.property)({type:String})],e.prototype,"src",void 0),u([(0,l.property)({type:String})],e.prototype,"label",void 0),u([(0,l.property)({type:String})],e.prototype,"title",void 0),u([(0,l.property)({type:String})],e.prototype,"color",void 0),u([(0,l.property)({type:Boolean})],e.prototype,"decrypting",void 0),u([(0,l.property)({type:String})],e.prototype,"role",void 0),u([(0,l.property)({type:String,attribute:"icon-name"})],e.prototype,"iconName",void 0),u([(0,l.property)({type:Boolean})],e.prototype,"failurePresence",void 0),u([(0,l.property)({type:String})],e.prototype,"type",void 0),u([(0,l.property)({type:String,attribute:"presence-type"})],e.prototype,"presenceType",void 0),u([(0,l.property)({type:Boolean})],e.prototype,"newMomentum",void 0),u([(0,l.property)({type:Boolean})],e.prototype,"typing",void 0),u([(0,l.property)({type:Number})],e.prototype,"size",void 0),u([(0,l.property)({type:Boolean,attribute:"has-notification"})],e.prototype,"hasNotification",void 0),u([(0,l.property)({type:Boolean})],e.prototype,"clickable",void 0),u([(0,l.property)({attribute:!1})],e.prototype,"clickFunction",void 0),u([(0,l.property)({type:String,attribute:"avatar-style"})],e.prototype,"avatarStyle",void 0),u([(0,l.property)({type:String})],e.prototype,"state",void 0),u([(0,l.state)()],e.prototype,"imageLoaded",void 0),u([(0,l.state)()],e.prototype,"imageErrored",void 0),u([(0,l.state)()],e.prototype,"presenceColor",void 0),u([(0,l.state)()],e.prototype,"presenceIcon",void 0),e=u([(0,s.w)("md-avatar")],e),t.ELEMENT=e}(i||(i={}))}};