/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import a from"./RTSKNY33.js";import{b as r}from"./PZ4L77M5.js";import{d as u}from"./JE7L7M3J.js";import"./LFIJXE3U.js";import"./36I27Q5R.js";import"./GDPFKW75.js";import"./AOBFPJ2R.js";import"./JK6XUSIM.js";import"./UPHYUDLT.js";import"./QJJXVRMV.js";import"./7FMLZNDR.js";import"./LL5C4DHP.js";import"./WPAMUSBR.js";import"./XJPOVJV7.js";import"./LDNQ56OK.js";import"./3HUY3T5F.js";import"./Z6G5PBUQ.js";import"./J3QMHA2M.js";import"./TKZAMPEI.js";import"./2IHQU2FX.js";import"./CGLFPVBM.js";import"./OEJAW72H.js";import"./5JJMGPOW.js";import"./TYX345MZ.js";import"./5UWT66A7.js";import{b as l}from"./VU3OQQKP.js";import{H as o,h as s,i as n}from"./46DQNAMV.js";import"./OR4HXHSY.js";export default $arcgis.t(([{A:m,b:c}])=>{var h=s`*[tabindex]:focus-visible{outline:2px solid var(--calcite-color-brand);outline-offset:2px}.avatar-container{align-items:center;display:flex;flex-direction:row;padding-top:var(--calcite-spacing-lg)}.full-name{margin-inline-start:0px;font-size:var(--calcite-font-size--1);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-navigation-user-full-name-text-color, var(--calcite-color-text-1))}.text-container{margin-block-start:.125rem;display:flex;flex-direction:column;padding-inline:1rem;text-align:start}.username{font-size:var(--calcite-font-size--1);color:var(--calcite-navigation-user-name-text-color, var(--calcite-color-text-2))}`,a=class extends o{constructor(){super(),this.lookupProfile=!1,this.username="",this._configContextConsumer=r({context:c,subscribe:!0}),this.listenOn(window,"sessionRefreshed",t=>{this._updateThumbnailToken(t.detail)})}static{this.properties={fullname:1,lookupProfile:5,thumbnailUrl:1,username:1}}static{this.styles=h}loaded(){this.lookupProfile&&this._lookupOwnerProfile(this.username)}willUpdate(t){t.has("username")&&this.lookupProfile&&this._lookupOwnerProfile(this.username)}render(){return n`<div class="avatar-container"><calcite-avatar scale=m .username=${this.username} .thumbnail=${this.thumbnailUrl??void 0} .fullName=${this.fullname??void 0}></calcite-avatar><div class="text-container"><span class="full-name" tabindex=0>${this.fullname??""}</span><span class="username" tabindex=0>${this.username}</span></div></div>`}async _lookupOwnerProfile(t){if(this.fullname=void 0,this.thumbnailUrl="",this.lookupProfile&&this._configContextConsumer.value){let{userSession:i}=this._configContextConsumer.value;if(i)try{let e=await u({authentication:i,username:t});e&&(e.fullName&&(this.fullname=e.fullName),e.thumbnail&&(this.thumbnailUrl=i.portal+"/community/users/"+e.id+"/info/"+e.thumbnail+"?token="+i.token))}catch{console.log("user not found")}}}_updateThumbnailToken(t){this.thumbnailUrl&&this.thumbnailUrl!==""&&(this.thumbnailUrl=m(this.thumbnailUrl,t))}};l("solution-user-avatar",a);return a},a)