/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import { c as f } from "../../chunks/runtime.js";
import { repeat as v } from "lit/directives/repeat.js";
import { u as T } from "../../chunks/useT9n.js";
import { LitElement as w, createEvent as c, safeClassMap as _, nothing as C } from "@arcgis/lumina";
import { css as S, html as d } from "lit";
import { T as m } from "../../chunks/solutions-deploy-app-nav.js";
import { a as D, T as h, y as A, B as x, e as I } from "../../chunks/interfaces.js";
import { createRef as o, ref as a } from "lit-html/directives/ref.js";
import { C as y } from "../../chunks/CardsFetcher.js";
import { g as O } from "../../chunks/cardFetchingUtils.js";
import { useContextProvider as b } from "@arcgis/lumina/context";
import { c as F, b as $, i as L } from "../../chunks/deployAppContexts.js";
import { t as M } from "../../chunks/solution-builder-assistant.js";
import { h as k, a as E } from "../../chunks/cardsHelpers.js";
import "@esri/solution-common";
import "@arcgis/core/identity/IdentityManager.js";
import "@arcgis/core/identity/OAuthInfo.js";
import "@arcgis/core/portal/Portal.js";
import { j as P } from "../../chunks/helpers.js";
import { _ as B } from "../../chunks/solution-deploy-dialog.js";
import "../solutions-all-shell/customElement.js";
import "../solutions-deployed-shell/customElement.js";
import "../solutions-resources-shell/customElement.js";
import "../solution-details-panel/customElement.js";
import "../solution-deployed-card-panel/customElement.js";
const R = S`.back-color-override{background-color:var(--calcite-color-surface-3);--calcite-tab-border-color: var(--calcite-color-surface-4)}:host{--panel-edge-adjustment: 2vw;--assistant-panel-min-width: 420px;--assistant-panel-width: max(var(--assistant-panel-min-width), calc((96vw - 1440px) / 2 + var(--panel-edge-adjustment) - 15px))}.display-none{display:none!important}.height-100{height:100%}calcite-tab-nav{padding-bottom:6px;padding-top:6px}calcite-tab{--calcite-color-focus: transparent}calcite-tab>*{--calcite-color-focus: initial}calcite-tabs{--calcite-tab-border-color: var(--calcite-color-border-2);flex:1;min-height:0}.tab-space-0{--calcite-tab-content-space-y: var(--calcite-spacing-none)}.tab-space-md{--calcite-tab-content-space-y: var(--calcite-spacing-md)}solutions-searchsort-toolbar,solutions-deploy-app-nav,solution-details-panel,solutions-deployed-shell,solutions-all-shell,solutions-resources-shell,calcite-tab-nav,solution-deployed-card-panel,.resources-menu-container{width:1440px;display:block;max-width:96vw;padding-right:var(--calcite-spacing-none);padding-left:var(--calcite-spacing-none);margin-left:auto;margin-right:auto;box-sizing:border-box}.resources-menu-container{background-color:var(--calcite-color-foreground-1)}.resources-menu-toolbar{height:65px;display:flex;align-items:center}.resources-menu-toolbar calcite-menu-item{transition:border-color .2s ease}.resources-menu-toolbar calcite-menu-item[active]{border-bottom-color:var(--calcite-color-brand)}.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}.overflow-auto{overflow:auto}solution-details-panel{scroll-margin-top:3rem}.main-content{container-type:inline-size;display:flex;flex-direction:column;height:100%;overflow:hidden}.main-content.assistant-open{margin-inline-end:var(--assistant-panel-width)}.assistant-open solutions-searchsort-toolbar,.assistant-open solution-details-panel,.assistant-open solutions-deployed-shell,.assistant-open solutions-all-shell,.assistant-open solutions-resources-shell,.assistant-open calcite-tab-nav,.assistant-open solution-deployed-card-panel,.assistant-open .resources-menu-container{margin-inline-start:max(var(--panel-edge-adjustment),calc((96vw - 1440px) / 2 + var(--panel-edge-adjustment)));margin-inline-end:0;width:auto;max-width:1440px}.assistant-open solutions-searchsort-toolbar{overflow:hidden;scrollbar-gutter:stable}.builder-panel{position:fixed;top:65px;inset-inline-start:max(var(--panel-edge-adjustment),calc((96vw - 1440px) / 2 + var(--panel-edge-adjustment)));inset-inline-end:var(--assistant-panel-width);bottom:0;z-index:400;display:flex;flex-direction:column;transition:transform .3s cubic-bezier(.4,0,.2,1);pointer-events:auto}.builder-panel.display-none{display:flex!important;transform:translate(100%);pointer-events:none}.builder-panel:dir(rtl).display-none{transform:translate(-100%)}@supports (-webkit-touch-callout: none){.builder-panel.display-none{display:none!important;transform:none}.builder-panel:dir(rtl).display-none{transform:none}}.builder-panel.display-none:has(~.assistant-panel.display-none){display:none!important;transition:none}.assistant-panel{position:fixed;top:65px;inset-inline-end:0;bottom:0;width:var(--assistant-panel-width);min-width:var(--assistant-panel-min-width);z-index:400;display:flex;flex-direction:column}@media(max-width:800px){.builder-panel{display:none!important}.assistant-panel{width:100%;box-shadow:none}.main-content.assistant-open{margin-inline-end:0}}.assistant-fab{position:fixed;bottom:var(--calcite-spacing-xxl);inset-inline-end:var(--calcite-spacing-xxl);z-index:500}calcite-tooltip{--calcite-tooltip-max-size-x: 16rem}.assistant-fab-popover{--calcite-popover-max-size-x: 16rem}.assistant-fab-popover__content{display:block;padding-block:var(--calcite-spacing-sm);padding-inline:var(--calcite-spacing-md);font-size:var(--calcite-font-size-relative-sm);line-height:var(--calcite-font-line-height-relative-snug);font-weight:var(--calcite-font-weight-medium);word-wrap:break-word;word-break:break-word}`, N = {
  solution: {
    title: "Bus Stop ADA Compliance Inspections",
    description: "Bus Stop ADA Compliance Inspections can be used to perform routine inspections of bus stops for ADA compliance and monitor inspection progress.",
    thumbnailUrl: M,
    tags: [
      "Bus Stop",
      "ADA Compliance",
      "Inspection",
      "Field",
      "Monitor",
      "ArcGIS Solutions"
    ],
    strings: [
      {
        key: "inspectionsByMonth",
        value: "Inspections by Month",
        description: "Descriptive title of dashboard chart displaying the number of inspections completed by month."
      },
      {
        key: "inspectionsCompleted",
        value: "Inspections Completed",
        description: "Descriptive title of dashboard indicator displaying the total number of inspections completed."
      },
      {
        key: "assetInventory",
        value: "Bus Stop Inventory",
        description: "Descriptive title of dashboard indicator displaying the total number of bus stops."
      }
    ]
  },
  items: [
    {
      id: "b21885d38b3c4924922ce36c90112737",
      title: "Bus Stop ADA Inspection Dashboard",
      description: "An ArcGIS Dashboards app used to monitor bus stop ADA compliance inspections.",
      type: "Dashboard"
    },
    {
      id: "54f69b6af00b4f06b1c1eef05e80dc93",
      title: "Bus Stop ADA Inspection Map",
      description: "A map used by the Bus Stop ADA Inspection Dashboard app to monitor inspections.",
      type: "Web Map"
    },
    {
      id: "2fc93fa4e07e42508669d02acb837a75",
      title: "Bus Stop ADA Inspection Field Map",
      description: "A map used in ArcGIS Field Maps to inspect bus stops in the field for ADA compliance.",
      type: "Web Map"
    },
    {
      id: "0bd4ecf9c95e4dcd8ff1744adc12f323",
      title: "BusStops_field",
      description: "A hosted feature layer view used to inspect bus stops for ADA compliance.",
      type: "Feature Layer (hosted, view)"
    },
    {
      id: "0bd4ecf9c95e4dcd8ff1744adc12f324",
      title: "BusStops_dashboard",
      description: "A hosted feature layer view used to monitor bus stop ADA inspections.",
      type: "Feature Layer (hosted, view)"
    },
    {
      id: "36d0bdce3a74436f8314c88c9667003e",
      title: "BusStops",
      description: "A hosted feature layer used to store bus stop and ADA inspection details.",
      type: "Feature Layer (hosted)"
    }
  ],
  featureLayer: {
    itemId: "36d0bdce3a74436f8314c88c9667003e",
    addLayers: !0,
    layers: [
      {
        id: "0",
        type: "Point",
        typeMutable: !0,
        name: "BusStops",
        description: "Point layer containing bus stop locations and ADA compliance information.",
        customFields: [
          {
            name: "stop_id",
            type: "string",
            alias: "Stop ID",
            description: "Identifier for the bus stop.",
            choiceList: null,
            length: 255
          },
          {
            name: "location_description",
            type: "string",
            alias: "Location Description",
            description: "Description of the bus stop location.",
            choiceList: null,
            length: 255
          },
          {
            name: "shelter_present",
            type: "string",
            alias: "Shelter Present",
            description: "Indicates if a waiting shelter is present at the bus stop.",
            choiceList: [
              "Yes",
              "No"
            ],
            length: 5
          },
          {
            name: "bench_present",
            type: "string",
            alias: "Bench Present",
            description: "Indicates if a bench is present at the bus stop.",
            choiceList: [
              "Yes",
              "No"
            ],
            length: 5
          },
          {
            name: "ada_compliant",
            type: "string",
            alias: "ADA Compliant",
            description: "Indicates if the bus stop meets ADA compliance requirements.",
            choiceList: [
              "Yes",
              "No"
            ],
            length: 5
          },
          {
            name: "capacity",
            type: "integer",
            alias: "Seating Capacity",
            description: "Number of people that can be seated at the bus stop."
          },
          {
            name: "distance_from_curb",
            type: "double",
            alias: "Distance from Curb (ft)",
            description: "Distance in feet from the curb to the shelter."
          },
          {
            name: "last_inspection_date",
            type: "date",
            alias: "Last Inspection Date",
            description: "Date of the most recent inspection."
          },
          {
            name: "installation_date",
            type: "date",
            alias: "Installation Date",
            description: "Date when the bus stop was installed."
          }
        ],
        requiredFields: [
          {
            name: "route_number",
            type: "string",
            alias: "Route Number",
            description: "Number of the bus route that uses this stop.",
            choiceList: null,
            length: 50
          },
          {
            name: "average_daily_riders",
            type: "integer",
            alias: "Average Daily Riders",
            description: "Average number of riders using this stop per day."
          },
          {
            name: "inspection_priority",
            type: "string",
            alias: "Inspection Priority",
            description: "Priority level for scheduling inspections.",
            choiceList: [
              "High",
              "Medium",
              "Low"
            ],
            length: 10
          }
        ],
        systemFields: [
          {
            name: "objectid",
            type: "oid",
            alias: "ObjectID",
            description: "Unique identifier for each record in the dataset."
          },
          {
            name: "globalid",
            type: "globalid",
            alias: "GlobalID",
            description: "Globally unique identifier for the record."
          },
          {
            name: "created_date",
            type: "date",
            alias: "Created On",
            description: "Date when the record was created."
          },
          {
            name: "created_user",
            type: "string",
            alias: "Created By",
            description: "User who created the record."
          },
          {
            name: "last_edited_date",
            type: "date",
            alias: "Last Edited On",
            description: "Date when the record was last edited."
          },
          {
            name: "last_edited_user",
            type: "string",
            alias: "Last Edited By",
            description: "User who last edited the record."
          }
        ]
      },
      {
        id: "1",
        type: "Polyline",
        typeMutable: !1,
        name: "Routes",
        description: "Polyline layer containing bus route paths.",
        customFields: [
          {
            name: "route_name",
            type: "string",
            alias: "Route Name",
            description: "Name of the bus route.",
            choiceList: null,
            length: 100
          },
          {
            name: "route_type",
            type: "string",
            alias: "Route Type",
            description: "Type of bus route service.",
            choiceList: [
              "Express",
              "Local",
              "Rapid"
            ],
            length: 20
          },
          {
            name: "frequency_minutes",
            type: "integer",
            alias: "Frequency (minutes)",
            description: "How often buses run on this route in minutes."
          },
          {
            name: "route_length_miles",
            type: "double",
            alias: "Route Length (miles)",
            description: "Total length of the route in miles."
          }
        ],
        requiredFields: [
          {
            name: "route_id",
            type: "string",
            alias: "Route ID",
            description: "Unique identifier for the route.",
            choiceList: null,
            length: 50
          },
          {
            name: "active",
            type: "string",
            alias: "Active Status",
            description: "Whether the route is currently active.",
            choiceList: [
              "Yes",
              "No"
            ],
            length: 3
          }
        ],
        systemFields: [
          {
            name: "objectid",
            type: "oid",
            alias: "ObjectID",
            description: "Unique identifier for each record in the dataset."
          },
          {
            name: "globalid",
            type: "globalid",
            alias: "GlobalID",
            description: "Globally unique identifier for the record."
          },
          {
            name: "created_date",
            type: "date",
            alias: "Created On",
            description: "Date when the record was created."
          },
          {
            name: "created_user",
            type: "string",
            alias: "Created By",
            description: "User who created the record."
          },
          {
            name: "last_edited_date",
            type: "date",
            alias: "Last Edited On",
            description: "Date when the record was last edited."
          },
          {
            name: "last_edited_user",
            type: "string",
            alias: "Last Edited By",
            description: "User who last edited the record."
          }
        ]
      },
      {
        id: "2",
        type: "Polygon",
        typeMutable: !1,
        name: "ServiceAreas",
        description: "Polygon layer defining bus service coverage areas.",
        customFields: [
          {
            name: "area_name",
            type: "string",
            alias: "Area Name",
            description: "Name of the service area.",
            choiceList: null,
            length: 100
          },
          {
            name: "service_level",
            type: "string",
            alias: "Service Level",
            description: "Level of service provided in this area.",
            choiceList: [
              "High Frequency",
              "Standard",
              "Limited"
            ],
            length: 20
          },
          {
            name: "population",
            type: "integer",
            alias: "Population",
            description: "Estimated population within the service area."
          },
          {
            name: "area_sq_miles",
            type: "double",
            alias: "Area (sq miles)",
            description: "Size of the service area in square miles."
          }
        ],
        requiredFields: [
          {
            name: "district_id",
            type: "string",
            alias: "District ID",
            description: "Unique identifier for the service district.",
            choiceList: null,
            length: 50
          }
        ],
        systemFields: [
          {
            name: "objectid",
            type: "oid",
            alias: "ObjectID",
            description: "Unique identifier for each record in the dataset."
          },
          {
            name: "globalid",
            type: "globalid",
            alias: "GlobalID",
            description: "Globally unique identifier for the record."
          },
          {
            name: "created_date",
            type: "date",
            alias: "Created On",
            description: "Date when the record was created."
          },
          {
            name: "created_user",
            type: "string",
            alias: "Created By",
            description: "User who created the record."
          },
          {
            name: "last_edited_date",
            type: "date",
            alias: "Last Edited On",
            description: "Date when the record was last edited."
          },
          {
            name: "last_edited_user",
            type: "string",
            alias: "Last Edited By",
            description: "User who last edited the record."
          }
        ]
      },
      {
        id: "3",
        type: "Point",
        typeMutable: !1,
        name: "Tasks",
        description: "Point layer containing task assignments for bus stop inspections, related to BusStops layer.",
        customFields: [
          {
            name: "task_id",
            type: "string",
            alias: "Task ID",
            description: "Unique identifier for the task assignment.",
            choiceList: null,
            length: 50
          },
          {
            name: "stop_id",
            type: "string",
            alias: "Bus Stop ID",
            description: "ID of the bus stop to be inspected (relates to BusStops layer).",
            choiceList: null,
            length: 255
          },
          {
            name: "assigned_to",
            type: "string",
            alias: "Assigned To",
            description: "Name of the inspector assigned to this task.",
            choiceList: null,
            length: 100
          },
          {
            name: "due_date",
            type: "date",
            alias: "Due Date",
            description: "Date by which the inspection should be completed."
          },
          {
            name: "priority",
            type: "string",
            alias: "Priority",
            description: "Priority level of the inspection task.",
            choiceList: [
              "High",
              "Medium",
              "Low"
            ],
            length: 10
          },
          {
            name: "notes",
            type: "string",
            alias: "Task Notes",
            description: "Additional notes or instructions for the inspection task.",
            choiceList: null,
            length: 500
          }
        ],
        requiredFields: [
          {
            name: "status",
            type: "string",
            alias: "Task Status",
            description: "Current status of the task assignment.",
            choiceList: [
              "Not Started",
              "In Progress",
              "Completed",
              "Cancelled"
            ],
            length: 20
          },
          {
            name: "assignment_date",
            type: "date",
            alias: "Assignment Date",
            description: "Date when the task was created and assigned."
          }
        ],
        systemFields: [
          {
            name: "objectid",
            type: "oid",
            alias: "ObjectID",
            description: "Unique identifier for each record in the dataset."
          },
          {
            name: "globalid",
            type: "globalid",
            alias: "GlobalID",
            description: "Globally unique identifier for the record."
          },
          {
            name: "created_date",
            type: "date",
            alias: "Created On",
            description: "Date when the record was created."
          },
          {
            name: "created_user",
            type: "string",
            alias: "Created By",
            description: "User who created the record."
          },
          {
            name: "last_edited_date",
            type: "date",
            alias: "Last Edited On",
            description: "Date when the record was last edited."
          },
          {
            name: "last_edited_user",
            type: "string",
            alias: "Last Edited By",
            description: "User who last edited the record."
          }
        ]
      },
      {
        id: "4",
        typeMutable: !1,
        type: "Table",
        name: "Inspections",
        description: "Table containing inspection records and findings.",
        customFields: [
          {
            name: "inspection_id",
            type: "string",
            alias: "Inspection ID",
            description: "Unique identifier for the inspection.",
            choiceList: null,
            length: 50
          },
          {
            name: "stop_id",
            type: "string",
            alias: "Bus Stop ID",
            description: "ID of the bus stop that was inspected.",
            choiceList: null,
            length: 255
          },
          {
            name: "inspector_name",
            type: "string",
            alias: "Inspector Name",
            description: "Name of the person who performed the inspection.",
            choiceList: null,
            length: 100
          },
          {
            name: "inspection_date",
            type: "date",
            alias: "Inspection Date",
            description: "Date when the inspection was performed."
          },
          {
            name: "overall_condition",
            type: "string",
            alias: "Overall Condition",
            description: "Overall condition assessment of the bus stop.",
            choiceList: [
              "Excellent",
              "Good",
              "Fair",
              "Poor",
              "Critical"
            ],
            length: 20
          },
          {
            name: "issues_found",
            type: "integer",
            alias: "Issues Found",
            description: "Number of issues identified during inspection."
          },
          {
            name: "notes",
            type: "string",
            alias: "Inspection Notes",
            description: "Additional notes or comments about the inspection.",
            choiceList: null,
            length: 1e3
          }
        ],
        requiredFields: [
          {
            name: "inspection_status",
            type: "string",
            alias: "Inspection Status",
            description: "Current status of the inspection.",
            choiceList: [
              "Scheduled",
              "In Progress",
              "Completed",
              "Cancelled"
            ],
            length: 20
          }
        ],
        systemFields: [
          {
            name: "objectid",
            type: "oid",
            alias: "ObjectID",
            description: "Unique identifier for each record in the dataset."
          },
          {
            name: "globalid",
            type: "globalid",
            alias: "GlobalID",
            description: "Globally unique identifier for the record."
          },
          {
            name: "created_date",
            type: "date",
            alias: "Created On",
            description: "Date when the record was created."
          },
          {
            name: "created_user",
            type: "string",
            alias: "Created By",
            description: "User who created the record."
          },
          {
            name: "last_edited_date",
            type: "date",
            alias: "Last Edited On",
            description: "Date when the record was last edited."
          },
          {
            name: "last_edited_user",
            type: "string",
            alias: "Last Edited By",
            description: "User who last edited the record."
          }
        ]
      }
    ]
  }
};
class V extends w {
  constructor() {
    super(), this.initTitleOrId = "", this.sortType = "relevance", this.useLocalAppConfig = !1, this.loadExampleBuilderData = !1, this.authentication = void 0, this._isLoaded = !1, this.isMobile = !1, this._isViewportMobile = window.innerWidth <= 800, this._isAssistantOpen = !1, this._builderVisible = !1, this._hasActiveBuilderDesign = !1, this._showFabTooltip = !0, this._fabTooltipDismissed = !1, this._activeTab = "all-solutions", this._activeResourcesMenuItem = "getStarted", this._showDeployedCardFetchFailed = !1, this._globalAlerts = [], this._translations = T({ name: "solutions-deploy-app", blocking: !0 }), this._agoTerms = `${D}`, this._allCards = [], this._allShell = o(), this._allTab = o(), this._allTabTitle = o(), this._resourcesTab = o(), this._resourcesTabTitle = o(), this._categories = [], this._configContextProvider = b({ context: F }), this._delay = !1, this._deployAppNav = o(), this._deployedCardPanel = o(), this._deployCardFetchFailedMessage = "", this._deployedCardTab = o(), this._deployedCardTabTitle = o(), this._detailsShell = o(), this._detailsTab = o(), this._detailsTabTitle = o(), this._forceInit = !1, this._getSuggested = !1, this._tabpanelsFixed = !1, this._solutionBuilderPanel = o(), this._builderDesignContextProvider = b({ context: $ }), this._isMobileContextProvider = b({ context: L }), this._handleWindowResize = () => {
      const e = window.innerWidth <= 800;
      this._isViewportMobile !== e && (this._isViewportMobile = e, e && (this._isAssistantOpen = !1, this._builderVisible = !1));
    }, this._mainContentRef = o(), this._mySolutionsShell = o(), this._mySolutionsTab = o(), this._mySolutionsTabTitle = o(), this._resourcesShell = o(), this._sortField = "relevance", this._sortOrder = "desc", this._telemetryManager = new m(), this.deployAppTabSelected = c(), this.deployedCardFetchFailed = c(), this.detailsCardSelected = c(), this.deployedCardSelected = c(), this.metaTagStringsReady = c(), this.sessionRefreshed = c(), this.tabChanged = c(), this.listenOn(window, "detailsCardSelected", this._detailsCardSelected), this.listenOn(window, "deployedCardSelected", this._deployedCardSelected), this.listenOn(window, "displayDeployedCard", this._handleDeployedCardDisplay), this.listenOn(window, "navTabSelected", this._setActiveTab), this.listenOn(window, "forceSelectTab", (e) => this.selectTab(e.detail, {})), this.listenOn(window, "showGlobalAlert", this._handleShowGlobalAlert), this.listenOn(window, "openAssistant", () => {
      this._openAssistant();
    }), this.listenOn(window, "closeAssistant", () => {
      this._isAssistantOpen = !1, this._builderVisible = !1;
    }), this.listenOn(window, "toggleSolutionBuilder", () => {
      this._builderVisible = !this._builderVisible;
    }), this.listenOn(window, "hideSolutionBuilder", () => {
      this._builderVisible = !1;
    }), this.listenOn(window, "discardBuilder", (e) => {
      this._hasActiveBuilderDesign = e.detail;
    }), this.listenOn(window, "arcgis-solution-design-update", this._solutionBuilderSelected), window.addEventListener("resize", this._handleWindowResize), this._builderDesignContextProvider.value = {
      design: this.loadExampleBuilderData ? N : null,
      updateDesign: (e) => {
        this._builderDesignContextProvider.value = {
          ...this._builderDesignContextProvider.value,
          design: e
        };
      },
      isBuilderVisible: !1,
      setBuilderVisible: (e) => {
        this._builderVisible = e, this._builderDesignContextProvider.value = {
          ...this._builderDesignContextProvider.value,
          isBuilderVisible: e
        };
      }
    }, this.loadExampleBuilderData && (this._hasActiveBuilderDesign = !0);
  }
  static {
    this.properties = { appConfig: 1, initTab: 1, initTitleOrId: 1, sortType: 1, useLocalAppConfig: 5, loadExampleBuilderData: 5, authentication: 16, _isLoaded: 16, isMobile: 16, _isViewportMobile: 16, _isAssistantOpen: 16, _builderVisible: 16, _hasActiveBuilderDesign: 16, _showFabTooltip: 16, _fabTooltipDismissed: 16, _activeTab: 16, _activeResourcesMenuItem: 16, _showDeployedCardFetchFailed: 16, _globalAlerts: 16, _translations: 16 };
  }
  static {
    this.styles = R;
  }
  get _telemetry() {
    return this._configContextProvider.value?.telemetrySession;
  }
  get _isDisconnectedEnvironment() {
    return this._configContextProvider.value?.isEnterprise === !0 && this._configContextProvider.value?.authentication?.CanSearchArcGISOnline === !1;
  }
  get _readOnlyNotice() {
    return !!this._configContextProvider.value?.isEnterprise ? this._translations.writableEnterprise || "" : (this._translations.writableOnline || "").replace("{{url}}", "https://status.arcgis.com/");
  }
  _openAssistant() {
    this._telemetry?.logEvent({
      category: h.ASSISTANT,
      action: "Open"
    }), this._isAssistantOpen = !0;
  }
  async selectTab(e, t) {
    if (this._isLoaded || this._forceInit) {
      const i = this._getDefaultSearchOptions(t);
      switch (this._searchSortToolbar && (this._searchSortToolbar.scope = e.tabType), e.tabType) {
        case "all-solutions":
          this._allTab.value.selected = !0, this._allTabTitle.value.selected = !0, i && await this._allShell.value?.searchSolutions(i);
          break;
        case "resources":
          this._resourcesTab.value.selected = !0, this._resourcesTabTitle.value.selected = !0;
          break;
        case "deployed-card":
          if (this.authentication?.IsSignedIn) {
            if (this._forceInit = !0, this._isLoaded = !1, this._cardFetcherDeployed && await this._getDeployedSolution(e.tabTitleOrId), this._deployedSolutions?.cards?.length > 0) {
              let s;
              this._deployedSolutions.cards.some((n) => n.id === e.tabTitleOrId ? (s = n, this.deployedCardSelected.emit({ card: s }), !0) : !1), this._isLoaded = !0, this._forceInit = !1;
            } else
              return this._isLoaded = !0, this._forceInit = !1, this.selectTab({ tabTitleOrId: "", tabType: "deployments" }, t);
            break;
          } else
            await this.authentication?.signIn();
        case "details":
          if (this._allCards) {
            let s = k(this._allCards, e.tabTitleOrId);
            s = s || E(this._allCards, e.tabTitleOrId), s ? (this._detailsTab.value.selected = !0, this._detailsTabTitle.value.selected = !0, this.detailsCardSelected.emit(s)) : (e.tabType = "all-solutions", this._allTab.value.selected = !0, this._allTabTitle.value.selected = !0);
          }
          break;
        case "deployments":
          this._mySolutionsTab.value.selected = !0, this._mySolutionsTabTitle.value.selected = !0, this._searchSortToolbar && i?.filter && this._searchSortToolbar.changeOwnerFilter(i.filter !== "Organization"), i && await this._mySolutionsShell.value?.searchSolutions(i);
          break;
      }
      return this._builderVisible = !1, this._setActiveTab(new CustomEvent("setActiveTab", { detail: e })), this._blurTabs(), this._showDeployedCardFetchFailed && (this.deployedCardFetchFailed.emit({ message: this._deployCardFetchFailedMessage, title: this._translations.failedToOpen }), this._showDeployedCardFetchFailed = !1), !0;
    } else
      return this._initTab = e, this._initFilters = t, !1;
  }
  updated(e) {
    this._fixTabpanelFocus(), e.has("_isAssistantOpen") && this._setScrollbarGutters(this._isAssistantOpen ? "stable" : "stable both-edges"), !this._resizeObserver && this._mainContentRef.value && (this._resizeObserver = new ResizeObserver((t) => {
      for (const i of t) {
        const s = i.contentRect.width <= 800;
        this.isMobile !== s && (this.isMobile = s, this._isMobileContextProvider.setValue(s));
      }
    }), this._resizeObserver.observe(this._mainContentRef.value));
  }
  _fixTabpanelFocus() {
    if (!this._tabpanelsFixed && this._allTab.value) {
      const e = [this._allTab, this._mySolutionsTab, this._resourcesTab, this._detailsTab, this._deployedCardTab];
      Promise.all(e.map(async (t) => {
        const i = t.value;
        if (i && (await i.componentOnReady?.(), i.shadowRoot)) {
          const s = i.shadowRoot.querySelector('[role="tabpanel"]');
          s && (s.tabIndex = -1);
        }
      })).then(() => {
        this._tabpanelsFixed = !0, this._setupTabpanelObserver();
      }).catch(() => {
        this._tabpanelsFixed = !0;
      });
    }
  }
  _setupTabpanelObserver() {
    if (this._tabpanelObserver)
      return;
    this._tabpanelObserver = new MutationObserver((t) => {
      t.forEach((i) => {
        if (i.type === "attributes" && i.attributeName === "tabindex") {
          const s = i.target;
          s.getAttribute("role") === "tabpanel" && s.tabIndex === 0 && (s.tabIndex = -1);
        }
      });
    }), [this._allTab, this._mySolutionsTab, this._resourcesTab, this._detailsTab, this._deployedCardTab].forEach((t) => {
      const i = t.value;
      if (i?.shadowRoot) {
        const s = i.shadowRoot.querySelector('[role="tabpanel"]');
        s && this._tabpanelObserver.observe(s, { attributes: !0, attributeFilter: ["tabindex"] });
      }
    });
  }
  async load() {
    this.useLocalAppConfig && (this.appConfig = B);
  }
  render() {
    const e = this._isLoaded ? "display-none" : "", t = this._isLoaded ? "" : "display-none";
    return d`<calcite-shell><solutions-deploy-app-nav .appConfig=${this.appConfig} .assistantOpen=${this._isAssistantOpen} .initTab=${this.initTab} @authInit=${this._handleAuthInit} slot=header ${a(this._deployAppNav)}></solutions-deploy-app-nav><div class=${`main-content${this._isAssistantOpen ? " assistant-open" : ""}`} ${a(this._mainContentRef)}>${this._isSearchToolbarShowing() && d`<div class="border"></div>` || ""}${this._activeTab !== "resources" && d`<solutions-searchsort-toolbar ${a(async (i) => {
      i && (await this._deployAppNav.value?.componentOnReady(), this._searchSortToolbar = i, i.scope = this._activeTab);
    })}></solutions-searchsort-toolbar>` || ""}${this._activeTab === "resources" && d`<div class="border"></div><div class="resources-menu-container"><calcite-menu .label=${this._translations.resourcesNavigationMenuLabel} class="resources-menu-toolbar"><calcite-menu-item .active=${this._activeResourcesMenuItem === "getStarted" || void 0} .label=${this._translations.resourcesGetStarted} .text=${this._translations.resourcesGetStarted} @click=${() => this._handleResourcesMenuClick("getStarted")}></calcite-menu-item><calcite-menu-item .active=${this._activeResourcesMenuItem === "documentation" || void 0} .label=${this._translations.resourcesDocumentation} .text=${this._translations.resourcesDocumentation} @click=${() => this._handleResourcesMenuClick("documentation")}></calcite-menu-item><calcite-menu-item .active=${this._activeResourcesMenuItem === "support" || void 0} .label=${this._translations.resourcesSupport} .text=${this._translations.resourcesSupport} @click=${() => this._handleResourcesMenuClick("support")}></calcite-menu-item></calcite-menu></div>` || ""}<calcite-loader class=${_(e)} id=solutions-loader .label=${this._translations.fetchingAllSolutions}></calcite-loader>${this._renderGlobalAlerts()}<calcite-tabs class=${_(t)} scale=l><calcite-tab-nav class="display-none" @calciteTabChange=${this._handleCalciteTabChanged} slot=title-group><calcite-tab-title ${a(this._allTabTitle)}>${this._translations.allSolutions}</calcite-tab-title><calcite-tab-title ${a(this._mySolutionsTabTitle)}>${this._translations.mySolutions}</calcite-tab-title><calcite-tab-title ${a(this._resourcesTabTitle)}>${this._translations.solutionResources}</calcite-tab-title><calcite-tab-title class="display-none" ${a(this._detailsTabTitle)}></calcite-tab-title><calcite-tab-title class="display-none" ${a(this._deployedCardTabTitle)}></calcite-tab-title></calcite-tab-nav><calcite-tab class="back-color-override tab-space-0" selected ${a(this._allTab)}><solutions-all-shell class="height-100" ${a(this._allShell)}></solutions-all-shell></calcite-tab><calcite-tab class="back-color-override tab-space-0" ${a(this._mySolutionsTab)}><solutions-deployed-shell class="height-100" ${a(this._mySolutionsShell)}></solutions-deployed-shell></calcite-tab><calcite-tab class="back-color-override tab-space-0" ${a(this._resourcesTab)}><solutions-resources-shell class="height-100" ${a(this._resourcesShell)}></solutions-resources-shell></calcite-tab><calcite-tab class="back-color-override" ${a(this._detailsTab)}><solution-details-panel class="height-100" .readOnlyNotice=${this._readOnlyNotice} ${a(this._detailsShell)}></solution-details-panel></calcite-tab><calcite-tab class="back-color-override tab-space-0" ${a(this._deployedCardTab)}><solution-deployed-card-panel class="shell-container height-100" .readOnlyNotice=${this._readOnlyNotice} ${a(this._deployedCardPanel)}></solution-deployed-card-panel></calcite-tab></calcite-tabs></div>${!this._configContextProvider.value?.isEnterprise && d`<div class=${`builder-panel${this._builderVisible && !this._isViewportMobile ? "" : " display-none"}`}><solution-builder-assistant class="height-100" .readOnlyNotice=${this._readOnlyNotice} ${a(this._solutionBuilderPanel)}></solution-builder-assistant></div><div class=${`assistant-panel${this._isAssistantOpen && !this._isViewportMobile ? "" : " display-none"}`}><arcgis-solutions-assistant class="height-100" .builderVisible=${this._builderVisible} .hasActiveBuilderDesign=${this._hasActiveBuilderDesign}></arcgis-solutions-assistant></div><calcite-fab aria-label=${this._translations.assistantFabTooltip ?? C} class=${`assistant-fab${this._isAssistantOpen || this._isViewportMobile ? " display-none" : ""}`} icon=effects id=assistant-fab-button @click=${() => {
      this._openAssistant(), this._fabTooltipDismissed = !0, this._showFabTooltip = !1;
    }} scale=l></calcite-fab>${!this._fabTooltipDismissed && d`<calcite-popover closable class=${`assistant-fab-popover${this._isAssistantOpen || this._isViewportMobile ? " display-none" : ""}`} .label=${this._translations.assistantFabTooltip} overlay-positioning=fixed @calcitePopoverClose=${() => {
      this._fabTooltipDismissed = !0, this._showFabTooltip = !1;
    }} .open=${this._showFabTooltip && !this._isAssistantOpen && !this._isViewportMobile} placement=leading reference-element=assistant-fab-button><span class="assistant-fab-popover__content">${this._translations.assistantFabTooltip}</span></calcite-popover>` || ""}` || ""}</calcite-shell>`;
  }
  loaded() {
    this._setScrollbarGutters();
  }
  disconnectedCallback() {
    super.disconnectedCallback(), window.removeEventListener("resize", this._handleWindowResize), this._resizeObserver?.disconnect(), this._tabpanelObserver?.disconnect();
  }
  async _handleResourcesMenuClick(e) {
    this._activeResourcesMenuItem = e, await this._resourcesShell.value?.scrollToSection(e);
  }
  _renderGlobalAlerts() {
    return v(this._globalAlerts, (e) => e.id, (e) => d`<calcite-alert .autoClose=${e.autoClose} .autoCloseDuration=${e.autoCloseDuration} .icon=${e.icon} .kind=${e.kind} .label=${e.title || ""} @calciteAlertClose=${() => this._removeGlobalAlert(e.id)} open>${e.title && d`<div slot=title>${e.title}</div>` || ""}<div slot=message>${e.message}</div></calcite-alert>`);
  }
  async _handleAuthInit(e) {
    const t = e.detail;
    t.telemetrySession || (t.telemetrySession = m.getDisabledSession()), this._configContextProvider.setValue(t), t.authentication && (this.authentication = t.authentication), this._cardFetcherDeployed = new y(t.locale, t.orgUrl, t.portalURL), this._cardsFetcher = new y(t.locale, t.orgUrl, t.portalURL), this._isDisconnectedEnvironment || await this._getSolutions(t.primarySolutionsGroupId, t.agoBasedEnterpriseSolutionsGroupId), this._configContextProvider.value.allCards = this._allCards, this._configContextProvider.value.anonAgolSession = this._cardsFetcher.anonAgolSession, this._configContextProvider.value.agolPortalUrl = this._cardsFetcher.agolPortalUrl, await this._initializeTelemetry(), this._isLoaded = !0, this._setRefreshInterval(), this._initTab ? (this.selectTab(this._initTab, this._initFilters), this._logTabViewTelemetry(this._initTab.tabType), this._initTab = void 0, this._initFilters = void 0) : this.authentication?.IsSignedIn && (this.initTab === "details" || this.initTab === "deployed-card" || (this._logTabViewTelemetry(this._activeTab), this._emitMetaTagStrings(this._activeTab)));
  }
  _setActiveTab(e) {
    const i = e.detail.tabType, s = this._activeTab !== i;
    switch (this._activeTab = i, s && this._logTabViewTelemetry(i), i) {
      case "all-solutions":
        this._allTabTitle.value?.click();
        break;
      case "deployments":
        this._mySolutionsTabTitle.value?.click();
        break;
      case "resources":
        this._resourcesTabTitle.value?.click();
        break;
      case "deployed-card":
        this._deployedCardTabTitle.value?.click();
        break;
      case "details":
        this._detailsTabTitle.value?.click();
        break;
    }
    this._builderVisible = !1, i !== "details" && i !== "deployed-card" && (this._deployAppNav.value.activateMenuItem(i), this.deployAppTabSelected.emit(i), this._emitMetaTagStrings(i));
  }
  _logTabViewTelemetry(e, t) {
    let i;
    switch (e) {
      case "all-solutions":
        i = h.ALL_SOLUTIONS;
        break;
      case "deployments":
        i = h.DEPLOYMENTS;
        break;
      case "resources":
        i = h.RESOURCES;
        break;
      case "details":
        i = h.SOLUTION_DETAILS;
        break;
      case "deployed-card":
        i = h.DEPLOYMENTS;
        break;
    }
    if (!((e === "details" || e === "deployed-card") && !t) && i) {
      const s = [];
      if ((e === "details" || e === "deployed-card") && t) {
        const l = t;
        s.push(l.title || ""), s.push(l.deployCommonId || ""), s.push(l.deployVersion || ""), s.push(""), s.push(P(l.typeKeywords));
      }
      const n = e === "deployed-card" ? "Open" : "View";
      this._telemetry?.logEvent({
        category: i,
        action: n,
        dimensions: s.length > 0 ? s : void 0
      });
    }
  }
  _emitMetaTagStrings(e, t) {
    let i = "", s = "";
    switch (e) {
      case "all-solutions":
        i = this._translations.metaAllSolutionsTitle, s = this._translations.metaAllSolutionsDescription;
        break;
      case "deployments":
      case "deployed-card":
        i = this._translations.metaDeploymentsTitle, s = this._translations.metaDeploymentsDescription;
        break;
      case "resources":
        i = this._translations.metaResourcesTitle, s = this._translations.metaResourcesDescription;
        break;
      case "details":
        t && (i = this._translations.metaDetailsTitle.replace("{title}", t.title), s = t.snippet);
        break;
    }
    this.metaTagStringsReady.emit({
      pageType: e,
      title: i,
      description: s,
      detailTemplate: t
    });
  }
  _handleCalciteTabChanged() {
    this.tabChanged.emit(this._activeTab);
  }
  _detailsCardSelected(e) {
    this._activeTab = "details", this._detailsTabTitle.value.selected = !0, this._detailsTab.value.selected = !0, this._deployAppNav.value.clearMenuItems(), e?.detail && (this._selectedDetailsCard = e.detail), this._logTabViewTelemetry("details", this._selectedDetailsCard), this._emitMetaTagStrings("details", this._selectedDetailsCard);
  }
  _deployedCardSelected(e) {
    this._activeTab = "deployed-card", this._deployedCardTabTitle.value.selected = !0, this._deployedCardTab.value.selected = !0, this._deployAppNav.value.clearMenuItems(), e?.detail?.card && (this._selectedDeployedCard = e.detail.card), this._logTabViewTelemetry("deployed-card", this._selectedDeployedCard), this._emitMetaTagStrings("deployed-card");
  }
  _solutionBuilderSelected(e) {
    e?.detail && (this._builderVisible = !0, this._hasActiveBuilderDesign = !0, this._builderDesignContextProvider.value = {
      design: e.detail,
      updateDesign: (t) => {
        this._builderDesignContextProvider.value = {
          ...this._builderDesignContextProvider.value,
          design: t
        };
      },
      isBuilderVisible: !0,
      setBuilderVisible: (t) => {
        this._builderVisible = t, this._builderDesignContextProvider.value = {
          ...this._builderDesignContextProvider.value,
          isBuilderVisible: t
        };
      }
    });
  }
  _handleDeployedCardDisplay(e) {
    const { card: t, cardRef: i } = e.detail;
    this.deployedCardSelected.emit({ card: t, cardRef: i });
  }
  _handleShowGlobalAlert(e) {
    const t = e.detail, i = t.id || `alert-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    this._globalAlerts = [...this._globalAlerts, { ...t, id: i }];
  }
  _removeGlobalAlert(e) {
    this._globalAlerts = this._globalAlerts.filter((t) => t.id !== e);
  }
  async _initializeTelemetry() {
    const e = this._configContextProvider.value;
    if (!this.authentication || !e)
      return;
    const t = await this._telemetryManager.initializeTelemetry(this.authentication, e);
    this._configContextProvider.value.telemetrySession = t;
  }
  async _getSolutions(e, t) {
    if (this._isDisconnectedEnvironment)
      return [];
    this._abortController ? (this._abortController.abort(), this._abortController = new AbortController()) : this._abortController = new AbortController();
    const i = await this._cardsFetcher?.requestAvailableSolutionCards({
      q: this._agoTerms,
      filter: "type:Solution",
      sortField: this._sortField,
      sortOrder: this._sortOrder,
      // TODO default search when old app loads is desc...may need to switch this for other
      nextStart: -1,
      categories: this._categories,
      delay: this._delay,
      getSuggested: this._getSuggested,
      num: 100
    }, e, t, this._configContextProvider.value.userSession, this._configContextProvider.value.isEnterprise, this._abortController.signal, {
      num: 1e3
    });
    return this._abortController = void 0, this._allCards.length === 0 && i?.cards && (this._allCards = i?.cards), this._allCards;
  }
  async _getDeployedSolution(e) {
    const t = this._configContextProvider.value.authentication, i = this._configContextProvider.value.userSession;
    if (t && i && t.IsSignedIn) {
      this._abortControllerDeployed ? (this._abortControllerDeployed.abort(), this._abortControllerDeployed = new AbortController()) : this._abortControllerDeployed = new AbortController();
      const s = A(t);
      try {
        const n = await O(t, i, this._cardsFetcher, this._cardFetcherDeployed, x, "created", "desc", !1, [], [], this._abortControllerDeployed.signal, s ? "My organization's solutions" : "My solutions", e);
        n.cards.length === 0 || n.cards[0].typeKeywords.indexOf("Deployed") < 0 ? (this._deployCardFetchFailedMessage = this._translations.failedToFetchNotSolution.replace("{{ITEMID}}", e), this._showDeployedCardFetchFailed = !0) : this._deployedSolutions = n;
      } catch (n) {
        const l = n.message;
        l.indexOf("CONT_0001") > -1 || l.indexOf("Item does not exist or is inaccessible.") > -1 ? (this._deployCardFetchFailedMessage = this._translations.failedToFetchWrongId.replace("{{ITEMID}}", e), this._showDeployedCardFetchFailed = !0) : l.indexOf("GWM_0003") > -1 || l.indexOf("You do not have permissions to access this resource or perform this operation.") > -1 ? (this._deployCardFetchFailedMessage = this._translations.failedToFetchWrongPermissions.replace("{{ITEMID}}", e), this._showDeployedCardFetchFailed = !0) : (this._showDeployedCardFetchFailed = !0, this._deployCardFetchFailedMessage = ""), console.warn(n);
      }
    }
  }
  _blurTabs() {
    this._allTabTitle.value?.blur(), this._resourcesTabTitle.value?.blur(), this._detailsTabTitle.value?.blur(), this._mySolutionsTabTitle.value?.blur();
  }
  _isSearchToolbarShowing() {
    return this._activeTab === "all-solutions" || this._activeTab === "deployments" && this.authentication?.IsSignedIn === !0;
  }
  _getDefaultSearchOptions(e) {
    let t;
    if (e) {
      const i = e.domain, s = e.industry === "AEC" ? I.AEC : e.industry, n = e.offerType, l = e.searchTerm, g = "";
      let r = e.sortField;
      const p = e.owner, u = e.filter;
      r === "suggested" && !this.authentication?.IsSignedIn && (r = this.sortType), t = i || s ? {
        type: i ? "domain" : s ? "industry" : ""
      } : void 0, i && (t = t ? { ...t, domain: i } : { domain: i }), s && (t = t ? { ...t, industry: s } : { industry: s }), l && (t = t ? { ...t, searchTerm: l } : { searchTerm: l }), t && (t = { ...t, displayValue: g }), r && (t = t ? { ...t, sortType: r } : { sortType: r }), n && (r = n.toLowerCase(), t = t ? { ...t, sortType: r } : { sortType: r }), p && (t = t ? { ...t, owner: p } : { owner: p }), u && (t = t ? { ...t, filter: u } : { filter: u });
    }
    return t;
  }
  _setScrollbarGutters(e = "stable both-edges") {
    [this._allTab, this._mySolutionsTab, this._resourcesTab, this._detailsTab, this._deployedCardTab].forEach((i) => {
      const s = i.value?.shadowRoot?.firstElementChild;
      s?.style && (s.style.scrollbarGutter = e);
    });
  }
  _setRefreshInterval() {
    const { userSession: e, authentication: t } = this._configContextProvider.value;
    if (e && e.tokenDuration && t?.IsSignedIn) {
      const i = Date.now(), n = (t.Credential?.expires - i) * 0.95;
      setInterval(async () => {
        if (t.Credential && t.Credential.expires) {
          await t.Credential?.refreshToken();
          const l = new Date(t.Credential.expires);
          e.updateToken(t.Credential.token, l), this.sessionRefreshed.emit(e.token);
        }
      }, n);
    }
  }
}
f("solutions-deploy-app", V);
export {
  V as SolutionsDeployApp
};
