/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import { c as I } from "./runtime.js";
import { u as f } from "./useT9n.js";
import { LitElement as y, createEvent as p, safeClassMap as w, nothing as h } from "@arcgis/lumina";
import { css as M, html as a, svg as C } from "lit";
import { A as S } from "./Auth.js";
import { u as k, l as c } from "./helpers.js";
import { T as _, A as $ } from "./interfaces.js";
import { createRef as o, ref as l } from "lit-html/directives/ref.js";
import { UserSession as E } from "@esri/solution-common";
const T = M`.esri-global-nav__title{margin-block-start:0;position:relative;margin-bottom:0;font-size:var(--calcite-font-size-xl);font-weight:var(--calcite-font-weight-medium);padding-inline-end:var(--calcite-spacing-xxl);align-self:center;height:100%;display:flex;align-items:center}.esri-global-nav__logo-link{color:var(--calcite-color-text-1);text-decoration:unset;margin-block-start:0px;position:relative;margin-bottom:0;align-self:center;height:100%;display:flex;align-items:center}.esri-global-nav__logo-link:focus{outline:2px solid var(--calcite-color-brand);outline-offset:-2px}.cursor-pointer{cursor:pointer}.side{border-right:solid 1px;color:var(--calcite-color-text-1);height:34px;align-self:center}.display-flex{display:flex}.align-self-center{align-self:center}.padding-top-1{padding-top:var(--calcite-spacing-lg)}.padding-end-1{padding-inline-end:var(--calcite-spacing-lg)}.padding-start-1{padding-inline-start:var(--calcite-spacing-lg)}.padding-bottom-1{padding-bottom:var(--calcite-spacing-lg)}.margin-start-end-1{margin-inline-start:var(--calcite-spacing-lg);margin-inline-end:var(--calcite-spacing-lg)}.margin-start-end-1-5{margin-inline-start:var(--calcite-spacing-xxl);margin-inline-end:var(--calcite-spacing-xxl)}.height-full{height:100%}.user-label{--calcite-label-margin-bottom: 0px}.font-bold{font-weight:var(--calcite-font-weight-bold)}.font-normal{font-weight:var(--calcite-font-weight-normal)}.logo-padding{padding-inline-start:var(--calcite-spacing-none);height:100%}@media(max-width:800px){.logo-padding{padding-inline-start:var(--calcite-spacing-lg)}}.signin-padding{padding-inline-end:var(--calcite-spacing-none)}@media(max-width:800px){.signin-padding{padding-inline-end:var(--calcite-spacing-lg)}}calcite-action{--calcite-font-size-0: var(--calcite-font-size--1);--calcite-internal-action-padding-inline: var(--calcite-spacing-lg)}calcite-navigation{--calcite-color-border-3: transparent}.border-bottom{border-bottom-color:var(--calcite-color-border-1);border-bottom-width:var(--calcite-spacing-px);border-bottom-style:solid}.border{height:var(--calcite-spacing-px);border-bottom-color:var(--calcite-color-border-2);border-bottom-style:solid;border-bottom-width:var(--calcite-border-width-sm);box-sizing:border-box;position:absolute;top:65px;left:0;width:100%;z-index:1}.height-66{height:66px}.sub-nav-constrained{width:calc(100% - var(--assistant-panel-width, 420px));overflow:hidden}`, u = {
  name: "arcgis-solutions-app",
  version: "2.1",
  dev: {
    amazon: {
      userPoolID: "us-east-1:7345bcf2-bffa-4849-a379-a83178f63eef",
      app: {
        id: "7e2fd97553644e5f99b1129fbcee3c2e"
      }
    }
  },
  qa: {
    amazon: {
      userPoolID: "us-east-1:7345bcf2-bffa-4849-a379-a83178f63eef",
      app: {
        id: "a3beba911bd14847ada5c9ffed2a2111"
      }
    }
  },
  prod: {
    amazon: {
      userPoolID: "us-east-1:8c41b2dc-7563-403d-ba64-673b103debce",
      app: {
        id: "35a920e0e7f84680be076e57dd5cb728"
      }
    }
  }
}, v = "solutions-deployment-first-use";
class g {
  constructor() {
    this._telemetryInstance = void 0, this._logTelemetryEvents = !1;
  }
  /**
   * Get the current telemetry instance
   */
  getInstance() {
    return this._telemetryInstance;
  }
  /**
   * Check if telemetry is enabled
   */
  isEnabled() {
    return this._logTelemetryEvents;
  }
  /**
   * Set the telemetry instance
   */
  setInstance(e) {
    this._telemetryInstance = e;
  }
  /**
   * Enable or disable telemetry event logging
   */
  setEnabled(e) {
    this._logTelemetryEvents = e;
  }
  /**
   * Map dimensions array to numbered dimension fields (dimension1-20)
   */
  _mapDimensions(e) {
    const t = {};
    return e && e.slice(0, 20).forEach((n, i) => {
      const s = `dimension${i + 1}`;
      t[s] = n;
    }), t;
  }
  /**
   * Map metrics array to numbered metric fields (metric1-20)
   */
  _mapMetrics(e) {
    const t = {};
    return e && e.slice(0, 20).forEach((n, i) => {
      const s = `metric${i + 1}`;
      t[s] = n;
    }), t;
  }
  /**
   * Log an event using the telemetry instance
   *
   * @param options Event logging options
   * @param options.category The event category
   * @param options.action The event action name
   * @param options.label The label for this event (optional, defaults to empty string)
   * @param options.details Additional details to log with the event (optional, defaults to empty string)
   * @param options.dimensions Optional dimensions array (maps to dimension1-20)
   * @param options.metrics Optional metrics array (maps to metric1-20)
   */
  logEvent(e) {
    if (this._logTelemetryEvents && this._telemetryInstance) {
      const { category: t, action: n, dimensions: i, metrics: s, label: r = "", details: d = "" } = e, b = this._mapDimensions(i), m = this._mapMetrics(s);
      this._telemetryInstance.logEvent({
        category: t,
        action: n,
        label: r,
        details: d,
        ...b,
        ...m
      });
    }
  }
  /**
   * Get the telemetry session object for use in configContext
   */
  getTelemetrySession() {
    return {
      instance: this._telemetryInstance,
      logEvent: (e) => this.logEvent(e),
      enabled: this._logTelemetryEvents
    };
  }
  /**
   * Get a disabled telemetry session that is safe to call but does nothing
   * Use this as a default when telemetry is not initialized
   */
  static getDisabledSession() {
    return {
      instance: void 0,
      logEvent: () => {
      },
      // No-op function
      enabled: !1
    };
  }
  /**
   * Initialize telemetry with consent manager
   *
   * @param authentication The authentication object
   * @param appConfig The application configuration
   * @returns Promise that resolves to the telemetry session
   */
  async initializeTelemetry(e, t) {
    if (!g.shouldEnableTelemetry(e, t))
      return this.getTelemetrySession();
    let i = document.querySelector("consent-manager");
    if (!i) {
      if (!customElements.get("consent-manager"))
        return this.getTelemetrySession();
      i = document.createElement("consent-manager"), i.portal = e.Portal, i.measurementIds = t.measurementIds || [], i.firstUseVar = v;
      const r = g.getEnvironmentConfig(t, e);
      r && (i.amazonUserPoolID = r?.amazon?.userPoolID, i.amazonAppId = r?.amazon?.app?.id, i.amazonAppName = u.name, i.amazonVersion = u.version);
      const d = e.Portal?.eueiEnabled;
      (localStorage.getItem(i.firstUseVar) === "true" || d) && (this.setEnabled(!0), i.classList.add("display-none")), document.body.appendChild(i), d ? (await new Promise((m) => setTimeout(m, 100)), await this._setInstanceFromConsentManager(i)) : window.addEventListener("consentGranted", (m) => {
        m.detail?.granted && (this.setEnabled(!0), this._setInstanceFromConsentManager(i));
      });
    }
    return this.getTelemetrySession();
  }
  /**
   * Set the telemetry instance from consent manager
   *
   * @param consentManager The consent manager element
   */
  async _setInstanceFromConsentManager(e) {
    try {
      const t = new Promise(
        (i, s) => setTimeout(() => s(new Error("Timeout waiting for consent-manager instance")), 1e4)
      ), n = await Promise.race([
        e.getInstance(),
        t
      ]);
      this.setInstance(n);
    } catch {
    }
  }
  /**
   * Determine if telemetry should be enabled based on authentication and config
   *
   * @param authentication The current authentication object
   * @param appConfig The application configuration
   * @returns True if telemetry should be enabled
   */
  static shouldEnableTelemetry(e, t) {
    const n = e?.IsEnterprisePortal;
    return e?.Portal?.eueiEnabled === !1 || n ? !1 : !!((t.measurementIds || u) && v);
  }
  /**
   * Get the environment-specific telemetry configuration
   *
   * @param appConfig The application configuration object
   * @param authentication The current authentication object
   * @returns The telemetry options for the current environment, or undefined
   */
  static getEnvironmentConfig(e, t) {
    const n = e.forceTrackingEnv || k(
      document.location.hostname,
      t?.Portal?.portalHostname || ""
    );
    return n && Object.keys(u).includes(n) ? u[n] : void 0;
  }
}
class A extends y {
  constructor() {
    super(), this.assistantOpen = !1, this._isMobile = !1, this._logoFill = "", this._thumbnailUrl = "", this._translations = f({ name: "solutions-deploy-app-nav", blocking: !0 }), this._activeTab = "all-solutions", this._authentication = void 0, this._cardType = "details", this._dropdownRef = o(), this._dropdownItemAll = o(), this._dropdownItemMy = o(), this._dropdownItemMyContent = o(), this._dropdownItemResources = o(), this._handleMobileChange = (e) => {
      this._isMobile = e.matches;
    }, this._menuRef = o(), this._menuItemAll = o(), this._menuItemMy = o(), this._menuItemResources = o(), this.authInit = p(), this.navTabSelected = p(), this.tabChanged = p(), this.tokenRefreshed = p(), this.listenOn(window, "deployedCardSelected", this._deployedCardSelected), this.listenOn(window, "detailsCardSelected", this._detailsCardSelected), this.listenOn(window, "deployAppTabSelected", this._deployAppTabSelected), this.listenOn(window, "popstate", this._handleUrlChange), this.listenOn(window, "sessionRefreshed", (e) => {
      this._updateThumbnailToken(e.detail);
    }), this._mobileMediaQuery = window.matchMedia("(max-width: 800px)"), this._isMobile = this._mobileMediaQuery.matches, this._mobileMediaQuery.addEventListener("change", this._handleMobileChange);
  }
  static {
    this.properties = { appConfig: 1, assistantOpen: 5, initTab: 1, _subNavigationCard: 16, _isMobile: 16, _logoFill: 16, _thumbnailUrl: 16, _translations: 16 };
  }
  static {
    this.styles = T;
  }
  get _telemetry() {
    return this._config?.telemetrySession;
  }
  clearMenuItems() {
    this._isMobile ? (this._dropdownItemAll.value.selected = !1, this._authentication?.IsSignedIn && (this._dropdownItemMy.value.selected = !1), this._dropdownItemResources.value.selected = !1) : (this._menuItemAll.value.active = !1, this._authentication?.IsSignedIn && (this._menuItemMy.value.active = !1), this._menuItemResources.value.active = !1);
  }
  activateMenuItem(e, t = !1) {
    let n, i;
    switch (e) {
      case "all-solutions":
        n = this._isMobile ? this._dropdownItemAll : this._menuItemAll, i = this._isMobile ? [
          this._dropdownItemMy,
          this._dropdownItemResources
        ] : [
          this._menuItemMy,
          this._menuItemResources
        ];
        break;
      case "deployments":
        n = this._isMobile ? this._dropdownItemMy : this._menuItemMy, i = this._isMobile ? [
          this._dropdownItemAll,
          this._dropdownItemResources
        ] : [
          this._menuItemAll,
          this._menuItemResources
        ];
        break;
      case "resources":
        n = this._isMobile ? this._dropdownItemResources : this._menuItemResources, i = this._isMobile ? [
          this._dropdownItemAll,
          this._dropdownItemMy
        ] : [
          this._menuItemAll,
          this._menuItemMy
        ];
        break;
      case "my-content":
        this._isMobile && (n = this._dropdownItemMyContent, i = [
          this._dropdownItemAll,
          this._dropdownItemMy,
          this._dropdownItemResources
        ]);
        break;
    }
    n && i && this._handleMenuClick(e, n, i, t);
  }
  async connectedCallback() {
    super.connectedCallback();
    const e = new E({
      username: "",
      password: ""
    });
    this._userSession = e;
  }
  async load() {
    const e = window.matchMedia("(prefers-color-scheme: dark)");
    e.addEventListener("change", (d) => this._logoFill = this._getLogoFill(d.matches)), this._logoFill = this._getLogoFill(e.matches), this._mobileMediaQuery.matches && (this._isMobile = !0);
    const t = this.appConfig.locale || "en", n = this.appConfig.authentication?.PortalSubset?.orgUrl || this.appConfig.orgURL || this.appConfig.portalURL, i = this.appConfig.authentication?.PortalUrl || this.appConfig.portalURL, s = this.appConfig.primarySolutionsGroupId;
    let r = !1;
    this._authentication || (this.appConfig.authentication ? this._authentication = this.appConfig.authentication : (this._authentication = new S(this.appConfig.appId, this.appConfig.portalURL, this.appConfig.locale), await this._authentication.initialize(this.appConfig.isEnterprise, this.appConfig.agoBasedEnterpriseSolutionsGroupId), r = !0)), r || await this._authentication?.checkArcGISOnlineReachability(this.appConfig.agoBasedEnterpriseSolutionsGroupId), this._authentication.RestUserSession && (this._userSession = this._authentication.RestUserSession), this.initTab && (this._activeTab = this.initTab, this.initTab = void 0), this._config = {
      anonAgolSession: void 0,
      agolPortalUrl: "",
      allCards: [],
      appId: this.appConfig.appId,
      authentication: this._authentication,
      agoBasedEnterpriseSolutionsGroupId: this.appConfig.agoBasedEnterpriseSolutionsGroupId,
      diagramKey: this.appConfig.diagramKey,
      forceTrackingEnv: this.appConfig.forceTrackingEnv,
      isEnterprise: this.appConfig.isEnterprise,
      locale: t,
      orgUrl: n,
      portalURL: i,
      primarySolutionsGroupId: s,
      userSession: this._userSession,
      telemetrySession: g.getDisabledSession(),
      // Will be initialized after auth
      measurementIds: this.appConfig.measurementIds
    }, this.authInit.emit(this._config), this._portal = await this._userSession?.getPortal();
  }
  render() {
    return a`<div><calcite-navigation>${this._getHeading()}${this._isMobile ? this._getDropdown() : this._getMenu()}${this._isMobile ? "" : this._getSignInOut()}</calcite-navigation><div class="border" slot=header></div>${!this._isMobile && a`<div class=${w(this.assistantOpen ? "sub-nav-constrained" : "")}>${this._getSubHeading()}</div>` || ""}</div>`;
  }
  updated(e) {
    e.has("_isMobile") && e.get("_isMobile") !== void 0 && this.activateMenuItem(this._activeTab, !1);
  }
  disconnectedCallback() {
    super.disconnectedCallback(), this._mobileMediaQuery.removeEventListener("change", this._handleMobileChange);
  }
  _getSignInOut() {
    return this._authentication?.IsSignedIn ? a`<div slot=user>${this._getUserAvatar()}</div>` : a`<calcite-menu label slot=content-end><calcite-menu-item label @click=${this._handleSignIn} @keydown=${(e) => c(e, () => this._handleSignIn(e))} .text=${this._translations.signIn}></calcite-menu-item></calcite-menu>`;
  }
  _getDropdown() {
    const e = this._authentication?.IsSignedIn ? this._translations.signOut : this._translations.signIn;
    return a`<calcite-dropdown overlay-positioning=fixed slot=content-end width=m ${l(this._dropdownRef)}><calcite-button appearance=transparent icon-start=hamburger kind=neutral slot=trigger scale=l></calcite-button><calcite-dropdown-group><calcite-dropdown-item @click=${() => this._handleMenuClick("all-solutions", this._dropdownItemAll, [this._dropdownItemMy, this._dropdownItemResources, this._dropdownItemMyContent], !0)} @keydown=${(t) => c(t, () => this._handleMenuClick("all-solutions", this._dropdownItemAll, [this._dropdownItemMy, this._dropdownItemResources, this._dropdownItemMyContent], !0))} ${l(this._dropdownItemAll)}>${this._translations.allSolutions}</calcite-dropdown-item><calcite-dropdown-item @click=${() => this._handleMenuClick("deployments", this._dropdownItemMy, [this._dropdownItemAll, this._dropdownItemResources, this._dropdownItemMyContent], !0)} @keydown=${(t) => c(t, () => this._handleMenuClick("deployments", this._dropdownItemMy, [this._dropdownItemAll, this._dropdownItemResources, this._dropdownItemMyContent], !0))} ${l(this._dropdownItemMy)}>${this._translations.myDeployments}</calcite-dropdown-item>${this._authentication?.CanSearchArcGISOnline && a`<calcite-dropdown-item @click=${() => this._handleMenuClick("resources", this._dropdownItemResources, [this._dropdownItemAll, this._dropdownItemMy, this._dropdownItemMyContent], !0)} @keydown=${(t) => c(t, () => this._handleMenuClick("resources", this._dropdownItemResources, [this._dropdownItemAll, this._dropdownItemMy, this._dropdownItemMyContent], !0))} ${l(this._dropdownItemResources)}>${this._translations.solutionResources}</calcite-dropdown-item>` || ""}<calcite-dropdown-item @click=${() => {
      const t = this._activeTab === "all-solutions" ? this._dropdownItemAll : this._activeTab === "deployments" ? this._dropdownItemMy : this._activeTab === "resources" ? this._dropdownItemResources : void 0;
      setTimeout(() => this._handleMenuClick("my-content", t, [this._dropdownItemAll, this._dropdownItemMy, this._dropdownItemResources, this._dropdownItemMyContent], !1), 10);
    }} ${l(this._dropdownItemMyContent)}>${this._translations.myContent}</calcite-dropdown-item><calcite-dropdown-item @click=${(t) => {
      this._authentication?.IsSignedIn ? this._signOut() : this._handleSignIn(t);
    }}>${e}</calcite-dropdown-item></calcite-dropdown-group></calcite-dropdown>`;
  }
  _getMenu() {
    return a`<calcite-menu label slot=content-start ${l(this._menuRef)}><calcite-menu-item label @click=${() => this._handleMenuClick("all-solutions", this._menuItemAll, [this._menuItemMy, this._menuItemResources], !0)} @keydown=${(e) => c(e, () => this._handleMenuClick("all-solutions", this._menuItemAll, [this._menuItemMy, this._menuItemResources], !0))} .text=${this._translations.allSolutions} ${l(this._menuItemAll)}></calcite-menu-item><calcite-menu-item label @click=${() => this._handleMenuClick("deployments", this._menuItemMy, [this._menuItemAll, this._menuItemResources], !0)} @keydown=${(e) => c(e, () => this._handleMenuClick("deployments", this._menuItemMy, [this._menuItemAll, this._menuItemResources], !0))} .text=${this._translations.myDeployments} ${l(this._menuItemMy)}></calcite-menu-item>${this._authentication?.CanSearchArcGISOnline && a`<calcite-menu-item label @click=${() => this._handleMenuClick("resources", this._menuItemResources, [this._menuItemAll, this._menuItemMy], !0)} @keydown=${(e) => c(e, () => this._handleMenuClick("resources", this._menuItemResources, [this._menuItemAll, this._menuItemMy], !0))} .text=${this._translations.solutionResources} ${l(this._menuItemResources)}></calcite-menu-item>` || ""}</calcite-menu>`;
  }
  _getHeading() {
    return a`<div class="align-self-center display-flex cursor-pointer logo-padding" slot=logo><a aria-label=${this._translations.linkToEsriHomePage ?? h} class="esri-global-nav__logo-link" href=https://www.esri.com @click=${() => this._logLinkClickTelemetry("Esri")} rel=noopener target=_blank title=${this._translations.linkToEsriHomePage ?? h}><svg aria-hidden=true height=30 viewBox="0 0 84 30" width=84 xmlns=http://www.w3.org/2000/svg>${C`<path fill=${this._logoFill ?? h} d="M77.277.5c-1.48 0-2.554 1.175-2.554 2.488 0 1.314 1.074 2.49 2.554 2.49 1.48 0 2.622-1.071 2.622-2.49C79.899 1.572 78.756.5 77.277.5zm-1.913 23.426h3.891V8.353h-3.891v15.573zM40.515 7.965c-4.702 0-8.465 3.275-8.465 8.174 0 4.898 3.763 8.177 8.465 8.177 2.146 0 4.165-.667 5.852-2.31l-2.457-2.457c-.916.964-2.093 1.651-3.78 1.651-2.175 0-3.927-1.397-4.188-3.698h11.875v-1.07c0-5.42-2.95-8.467-7.302-8.467zm-4.573 6.617c.293-2.24 1.721-3.7 4.023-3.7 2.434 0 3.926 1.43 3.96 3.7h-7.983zm17.305-1.849c0-1.169 1.233-1.655 2.273-1.655 1.32 0 2.292.547 3.037 1.577l2.476-2.474c-1.282-1.6-3.407-2.216-5.418-2.216-3.147 0-6.262 1.555-6.262 5.028 0 5.938 8.403 3.406 8.403 6.617 0 1.233-1.46 1.784-2.595 1.784-1.65 0-2.687-.806-3.69-1.905l-2.515 2.514c1.58 1.711 3.62 2.313 5.978 2.313 3.179 0 6.717-1.299 6.717-4.998 0-6.067-8.404-3.795-8.404-6.585zm14.15-1.916h-.062V8.353h-3.892v15.573h3.892v-8.34c0-.842.518-3.925 4.185-3.925.564 0 1.127.112 1.718.253l.152-3.726c-.45-.127-.901-.223-1.382-.223-2.046 0-3.766 1.07-4.61 2.852zM14.683 2.766c-1.217-.037-1.932.12-2.651.26-.216-.056-.62.003-.643.472 0 .252.08.447.24.562.159.114 1.493 1.1 2.473 2.142-.47.052-.98.138-1.504.246-.585-1.264-2.465-.114-3.714-.064-.146.006-.286.025-.431.035-.137-1.056-.235-2.15-.21-2.92 1.618-.917 4.748-1.593 6.874-1.626l.373-.01c.312-.003.337-.251.043-.291-2.641-.361-4.929.173-7.279 1.145C5.808 3.748 2.696 6.12.8 10.596c-.444 1.247-2.219 7.195.935 12.3 2.56 4.142 5.855 6.113 9.887 6.676 4.024.561 6.207.075 8.752-1.055 5.951-2.642 10.496-12.559 5.95-19.747-1.794-3.319-6.495-6.229-11.641-6.004zm-2.259 4.647a17.754 17.754 0 0 1 2.362-.368 15.741 15.741 0 0 1 1.748 2.54c-.805.39-1.878.688-2.315 1.312-.181.26-.226.613-.232.995a23.59 23.59 0 0 0-3.877 1.286c-.453-1.332-.85-2.66-1.124-3.842 1.296-1.237 2.813-1.438 3.438-1.923zm6.61 15.88c-.354.038-.706.083-1.016.13-.77.121-1.762.379-2.685.723-.53-.843-1.95-2.891-2.667-4.437 1.442-.709 3.457-1.303 5.775-1.444.19.33.4.66.69.956.757.774-.44 1.883-.096 4.072zm-8.603-9.14c1.12-.53 2.3-.968 3.56-1.286-.008.333-.045.649-.182.903-.196.366-.106 1.428.134 1.775.755 1.099 2.008.488 2.951.883.433.181.721.482.964.84-1.974.124-3.91.584-5.706 1.41-.923-1.96-1.72-4.524-1.72-4.524zm.832 4.938c-.07.033-.145.074-.217.11a40.803 40.803 0 0 0-3.256-.78c-.995-.204-1.031-.15-2.151.175-.16.046-.313.088-.462.133a36.17 36.17 0 0 1-.445-1.202c1.436-1.106 2.884-2.034 4.821-2.985.5 1.491 1.215 3.483 1.71 4.549zm.768 4.528c.293-.765.521-1.331.605-1.89.569.958 1.248 2 1.774 2.815-.819.397-1.772 1.01-2.672 1.685.062-1.037.083-2.064.293-2.61zm5.334-14.636c-.01.014-.028.026-.04.04a23.057 23.057 0 0 0-1.376-2.111c1.007-.061 2.246-.008 3.374.108-1.014.363-1.461 1.254-1.958 1.963zm-9.028 1.094c.019-.026.039-.047.057-.072.234 1.182.513 2.16.886 3.518-1.402.618-3.881 2.148-4.976 2.972-.198-.502-.404-1.214-.589-1.946.249-.737.758-1.254 1.476-1.325 1.228-.123 2.28-1.95 3.146-3.147zm-5.41-1.784C4.24 6.455 6.023 4.666 7.65 3.773c-.016.4.086 1.567.218 2.693-.57.057-1.134.128-1.692.211a12.084 12.084 0 0 0-3.115 4.088c-.117-1.054-.178-1.933-.133-2.472zM2.07 9.731s.062 1.06.113 1.833c0 0-.781.886-1.18 1.59.159-1.443.498-2.187 1.067-3.423zm7.664 18.356C5.688 26.82 2.69 23.41 1.62 19.834a17.475 17.475 0 0 1-.651-6.473c.056.01.186.072.38.017.135-.093.616-.43.957-.728l.018.131c-.23.87-.371 1.775-.4 2.71.37.39.804 1.038 1.286 1.707-.31.23-.905.641-1.045.741-.41.292-.406.753-.114 1.015.161.144.492.084.613-.01.358-.285.656-.513 1.066-.77.15.393.292.748.43 1.086-.175.188-.3.436-.342.798-.135 1.172.979 2.092 1.918 2.36.035.01.06.014.094.023.05.076.095.147.148.224-.487.378-.82.765-1.049 1.063-.132.172-.28.43-.16.481.123.05.535 0 .719-.034.466-.09.826-.606 1.148-.796.387.534 1.017 1.22 1.672 1.88.029.12.055.246.088.351.125.403.293.804.495 1.196.471.22.962.402 1.464.561a8.344 8.344 0 0 0-.622.72zm.989.313c.155-.203.312-.454.505-.626.468.31.969.665 1.368.894-.615-.07-1.337-.085-1.873-.268zm3.113.31s-1.604-1.062-2.009-1.471c.803-.667 2.102-1.459 3.128-1.889.402.63 1.727 2.507 2.258 3.112-.963.168-2.31.294-3.377.248zM20.54 27.2c-.286.189-1.664.814-2.204.988a23.43 23.43 0 0 1-2.44-3.202c.844-.354 2.143-.67 3.346-.82.109.342.25.704.444 1.094.19.382.411.662.649.853.085-.053.164-.115.248-.17-.006.42-.018.846-.043 1.257zm-.33-21.477c-.27-.172-.607-.108-.467.193.053.117.259.314.427.512-.986-.272-3.608-.479-4.856-.364-.815-.916-1.744-2.028-2.861-2.765 4.999-.311 9.49 1.756 11.473 4.186-.661-.344-2.087-.834-2.667-.963-.313-.319-.708-.58-1.05-.8zm1.094 21.065c.023-.407.04-.922.053-1.396.487-.378.946-.79 1.37-1.238.547.063 1.094.156 1.427.24-.74.936-1.762 1.716-2.85 2.394zm3.825-3.724c-.12.253-.428.688-.633.894-.312-.126-.781-.258-1.272-.375.078-.094.163-.182.24-.279.268-1.796-.338-2.37.42-4.014l.172-.371c.418.118.812.247 1.153.386.043.616.04 2.728-.08 3.759zm-.708-4.917c.196-.407.412-.84.645-1.27.061.547.105 1.08.131 1.563a9.256 9.256 0 0 0-.776-.293zm2.218 1.126l-.194.756c-.137.515-.593 1.732-.832 2.223.091-.663.171-2.384.148-2.73.16.049.502-.147.559-.341.057-.195-.564-.495-.564-.495a20.742 20.742 0 0 0-.172-2.7c.142-.23.286-.452.434-.655a12.082 12.082 0 0 0-.186-1.575c.125.041.24.074.323.075.283.004.282-.19.192-.298-.058-.07-.328-.238-.643-.42a12.02 12.02 0 0 0-2.78-5.32c.533.202 1.214.48 1.754.774.41.516 1.585 1.675 2.212 4.92.564 2.922-.06 5.143-.251 5.786zM80.886 8.597v-.24h1.218v.24h-.468v1.191h-.283V8.597h-.467zm1.87-.24l.365 1.025.368-1.024h.406v1.43h-.262V8.634l-.396 1.154h-.229l-.4-1.154v1.154h-.261v-1.43h.409z" />`}</svg></a><div class="side margin-start-end-1-5" slot=logo></div><div class="esri-global-nav__title"><a aria-label=${this._translations.linkToArcGISSolutionsHomePage ?? h} class="esri-global-nav__logo-link" href=https://www.esri.com/en-us/arcgis/products/arcgis-solutions/overview @click=${() => this._logLinkClickTelemetry("ArcGIS Solutions")} rel=noopener target=_blank title=${this._translations.linkToArcGISSolutionsHomePage ?? h}>${this._translations.arcgisSolutions}</a></div></div>`;
  }
  _getSubHeading() {
    const e = this._cardType === "deployed" ? this._translations.myDeployments : this._translations.allSolutions;
    return this._subNavigationCard ? a`<calcite-navigation class="height-66" slot=navigation-secondary><calcite-menu class="height-66" label slot=content-start><calcite-menu-item breadcrumb .label=${e} @click=${this._navigateFromSubMenu} @keydown=${(t) => c(t, () => this._navigateFromSubMenu())} .text=${e} text-enabled></calcite-menu-item><calcite-menu-item label active .text=${this._subNavigationCard?.title} text-enabled></calcite-menu-item></calcite-menu></calcite-navigation>` : "";
  }
  _getLogoFill(e) {
    return e ? "#FFFFFF" : "#141414";
  }
  _handleMenuClick(e, t, n, i) {
    n.forEach((s) => {
      s.value && (this._isMobile ? s.value.selected = !1 : s.value.active = !1);
    }), t?.value && (this._isMobile ? t.value.selected = !0 : t.value.active = !0), e !== "my-content" ? this._activeTab = e : this._viewMyContent(), i && this._logNavClickTelemetry(e), i && this.navTabSelected.emit({ tabType: e });
  }
  _logNavClickTelemetry(e) {
    const n = {
      "all-solutions": "Solutions",
      deployments: "Deployments",
      "my-content": "My Content",
      resources: "Resources",
      details: void 0,
      "deployed-card": void 0
    }[e];
    n && this._telemetry?.logEvent({
      category: _.GLOBAL_NAVIGATION,
      action: "Navigate",
      dimensions: [n]
    });
  }
  _logLinkClickTelemetry(e) {
    this._telemetry?.logEvent({
      category: _.GLOBAL_NAVIGATION,
      action: "Navigate",
      dimensions: [e]
    });
  }
  _getUserAvatar() {
    const e = this._portal.user, t = this._authentication?.PortalUserSubset, n = e?.id ?? e?.sourceJSON?.id;
    return this._thumbnailUrl === "" && (this._thumbnailUrl = e?.thumbnailUrl ?? t?.thumbnailUrl ?? ""), a`<div class="height-full display-flex cursor-pointer signin-padding"><calcite-navigation-user class="height-full" full-name=${e?.fullName ?? h} id=instant-apps-sign-in-user-button slot=user .thumbnail=${this._thumbnailUrl} .userId=${n} .username=${e?.username}></calcite-navigation-user></div><calcite-popover placement=bottom-end scale=s reference-element=instant-apps-sign-in-user-button offset-distance=0 pointer-disabled focus-trap-disabled auto-close .label=${this._translations.userSettings}><calcite-action scale=l @click=${this._viewMyContent} .text=${this._translations.myContent} text-enabled></calcite-action><calcite-action scale=l @click=${this._signOut} .text=${this._translations.signOut} text-enabled></calcite-action></calcite-popover>`;
  }
  _viewMyContent() {
    const e = `${this._config?.portalURL}/home/content.html#my`;
    window.open(e, "_blank");
  }
  _signOut() {
    this._telemetry?.logEvent({
      category: _.GLOBAL_NAVIGATION,
      action: "Navigate",
      dimensions: ["Sign out"]
    }), this._authentication?.signOut();
  }
  _handleSignIn(e) {
    e.preventDefault(), this._telemetry?.logEvent({
      category: _.GLOBAL_NAVIGATION,
      action: "Navigate",
      dimensions: ["Sign in"]
    }), this._authentication?.signIn().then(() => {
    }).catch((t) => {
      console.error("Error creating global nav header:", t);
    });
  }
  _deployedCardSelected(e) {
    this._cardType = "deployed", this._subNavigationCard = e.detail.card;
  }
  _detailsCardSelected(e) {
    this._cardType = "details", this._subNavigationCard = e.detail;
  }
  _deployAppTabSelected() {
    this._subNavigationCard = void 0;
  }
  _handleUrlChange() {
    this._subNavigationCard = void 0;
  }
  _navigateFromSubMenu() {
    this._cardType === "details" ? this._handleMenuClick("all-solutions", this._menuItemAll, [this._menuItemMy, this._menuItemResources], !0) : this._cardType === "deployed" && this._handleMenuClick("deployments", this._menuItemMy, [this._menuItemAll, this._menuItemResources], !0);
  }
  _updateThumbnailToken(e) {
    this._thumbnailUrl !== "" && (this._thumbnailUrl = $(this._thumbnailUrl, e));
  }
}
I("solutions-deploy-app-nav", A);
export {
  A as S,
  g as T
};
