/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import{b as c}from"./W4YXXJAS.js";import{b as l}from"./77CU4WA2.js";import{d as u}from"./TRGFYBOH.js";import"./ED6SUP22.js";import"./E6P6PYNW.js";import"./IKKBLHLZ.js";import"./CUA2IUXX.js";import"./4UZDZNJD.js";import"./KOTG6W5Z.js";import"./6SC7YR5Y.js";import"./Z6NOHRUL.js";import"./GVM4XYEI.js";import"./NGDVSE4Z.js";import"./BTNJZZQQ.js";import"./ZYQ4P2ON.js";import"./5MKH4QDV.js";import"./3GWWHA4S.js";import"./3YYHZQJB.js";import"./JEJ23R3P.js";import"./TONS7KZJ.js";import"./Q62UEPOL.js";import"./44A5XEM4.js";import{b as r}from"./ABSRNM72.js";import{H as s,h as a,i as o}from"./5CQPQ7AE.js";import"./3QPJ2JCA.js";var m=a`/** @license
 * Copyright 2025 Esri
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

.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));
}`,n=class extends s{constructor(){super(...arguments),this.lookupProfile=!1,this.username="",this._configContextConsumer=l({context:c,subscribe:!0})}static{this.properties={fullname:1,lookupProfile:[5,{},{type:Boolean}],thumbnailUrl:1,username:1}}static{this.styles=m}loaded(){this.lookupProfile&&this._lookupOwnerProfile(this.username)}willUpdate(i){i.has("username")&&this.lookupProfile&&this._lookupOwnerProfile(this.username)}render(){return o`<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">${this.fullname??""}</span><span class="username">${this.username}</span></div></div>`}async _lookupOwnerProfile(i){if(this.fullname=void 0,this.thumbnailUrl=void 0,this.lookupProfile&&this._configContextConsumer.value){let{userSession:t}=this._configContextConsumer.value;if(t)try{let e=await u({authentication:t,username:i});e&&(e.fullName&&(this.fullname=e.fullName),e.thumbnail&&(this.thumbnailUrl=t.portal+"/community/users/"+e.id+"/info/"+e.thumbnail+"?token="+t.token))}catch{console.log("user not found")}}}};r("solution-user-avatar",n);export{n as SolutionUserAvatar};
