/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
import { c as y } from "../../chunks/runtime.js";
import { css as $, html as c } from "lit";
import { keyed as k } from "lit/directives/keyed.js";
import { live as I } from "lit/directives/live.js";
import { watch as z } from "@arcgis/core/core/reactiveUtils.js";
import { substitute as M } from "@arcgis/core/intl.js";
import L from "@arcgis/core/widgets/FloorFilter/FloorFilterViewModel.js";
import { LitElement as T, createEvent as F, safeClassMap as s, nothing as f } from "@arcgis/lumina";
import { useDirection as B } from "@arcgis/lumina/controllers";
import { classes as l } from "@arcgis/toolkit/dom";
import { u as N } from "../../chunks/useT9n.js";
import { m as S } from "../../chunks/useViewModel.js";
import { H as w, i as C } from "../../chunks/heading.js";
import { g as d } from "../../chunks/globalCss.js";
import { createStore as E } from "@arcgis/lumina/controllers/accessor";
import { createRef as x, ref as p } from "lit/directives/ref.js";
const h = "floor-filter", v = `${h}__filter-menu`, o = {
  floorFilter: h,
  floorFilterLayout: `${h}__layout--`,
  // "expanded" | "collapsed"
  floorFilterPosition: `${h}__position`,
  buttonContainer: `${h}__button-container`,
  buttonInfo: `${h}__button-info`,
  buttonLabel: `${h}__button-label`,
  browseButton: `${h}__browse-button`,
  closeLevelsButton: `${h}__close-levels-button`,
  zoomButton: `${h}__zoom-button`,
  zoomButtonLevels: `${h}__zoom-button--levels`,
  minimizeToggleButton: `${h}__minimize-toggle-button`,
  levelsContainer: `${h}__levels-container`,
  levelButton: `${h}__level-button`,
  iconClose: `${h}__icon-close`,
  iconFlip: `${h}__icon-flip`,
  iconLeft: `${h}__icon-left`,
  iconRight: `${h}__icon-right`,
  separator: `${h}__separator`,
  filterMenu: v,
  filterMenuHeader: `${v}-header`,
  filterMenuHeaderTextGroup: `${v}-header-text-group`,
  filterMenuHeaderText: `${v}-header-text`,
  filterMenuHeaderSubtext: `${v}-header-subtext`,
  filterMenuHeaderBack: `${v}-header-back`,
  filterMenuSearch: `${v}-search`,
  filterMenuSearchInput: `${v}-search-input`,
  filterMenuItems: `${v}-items`,
  filterMenuItemName: `${v}-item-name`,
  filterMenuSelectedItem: `${v}-item-name--selected`,
  filterMenuSite: `${v}-site`,
  filterMenuFacility: `${v}-facility`,
  selectedItemCircle: `${h}__selected-item-circle`
}, A = $`.esri-widget__heading{color:var(--calcite-color-text-2);margin:0 0 .5rem;font-weight:var(--calcite-font-weight-semibold)}h1.esri-widget__heading{font-size:var(--calcite-font-size-xl)}h2.esri-widget__heading{font-size:var(--calcite-font-size-md)}h3.esri-widget__heading,h4.esri-widget__heading,h5.esri-widget__heading,h6.esri-widget__heading{font-size:var(--calcite-font-size)}.esri-widget{box-sizing:border-box;color:var(--calcite-color-text-2);background-color:var(--calcite-color-foreground-1);font-size:var(--calcite-font-size);line-height:var(--calcite-font-line-height-relative-tight)}.esri-widget *,.esri-widget :before,.esri-widget :after{box-sizing:inherit}.esri-widget.esri-widget--disabled>*{opacity:.4;pointer-events:none}.esri-widget.esri-widget--compact{--esri-widget-padding-y: 0;--esri-widget-padding-x: 0}.esri-widget__anchor{color:var(--calcite-color-text-2)}.esri-widget__anchor:hover{color:var(--calcite-color-text-3)}.esri-widget__anchor:hover,.esri-widget__anchor:focus{text-decoration:underline}.esri-widget__anchor--disabled{opacity:.4;pointer-events:none}.esri-widget__header{background-color:var(--calcite-color-foreground-1);flex:1 0 100%;justify-content:space-between;align-items:center;width:100%;min-height:48px;padding:12px 0 12px 15px;display:flex}.esri-widget__heading{word-break:break-word}.esri-widget__header .esri-widget__heading{width:calc(100% - 48px);text-align:initial;color:var(--calcite-color-text-1);align-items:center;margin:0;padding:0;display:flex}.esri-widget__header-button{appearance:none;cursor:pointer;color:var(--calcite-color-text-2);background-color:var(--calcite-color-foreground-1);border:none;flex:0 0 48px;justify-content:center;align-self:stretch;align-items:center;width:48px;padding:0;display:flex}.esri-widget__footer{background-color:var(--calcite-color-foreground-1);justify-content:center;align-items:center;width:100%;min-height:48px;display:flex}.esri-widget__footer-pagination{color:var(--calcite-color-text-2);justify-content:space-between;align-items:center;display:flex}.esri-widget__footer-pagination-previous-button,.esri-widget__footer-pagination-next-button{cursor:pointer;background-color:var(--calcite-color-foreground-1);border:0;margin:0 7px;padding:12px 15px;transition:background-color .125s ease-in-out}.esri-widget__footer-pagination-previous-button:hover,.esri-widget__footer-pagination-previous-button:focus,.esri-widget__footer-pagination-next-button:hover,.esri-widget__footer-pagination-next-button:focus{color:var(--calcite-color-text-1);background-color:var(--calcite-color-foreground-1)}.esri-menu{visibility:hidden;z-index:1;background-clip:padding;background-color:var(--calcite-color-foreground-1);background-clip:padding-box;width:100%;max-height:0;margin:2px 0 0;padding:0;font-size:var(--calcite-font-size);line-height:var(--calcite-spacing-xl);position:absolute;top:100%;left:0;overflow:hidden;box-shadow:0 1px 2px #0000004d}.esri-menu .esri-menu__header{color:var(--calcite-color-text-inverse);background-color:var(--calcite-color-inverse);padding:6px 12px}.esri-menu__list{margin:0;padding:0;list-style:none}.esri-menu__list-item{cursor:pointer;border-top:1px solid #adadad4d;border-left:3px solid #0000;padding:.8em 1em}.esri-menu__list-item [class^=esri-icon-],.esri-menu__list-item [class*=" esri-icon-"]{padding-right:2.8px}.esri-menu__list-item:first-child{border-top:none}.esri-menu__list-item--focus,.esri-menu__list-item:hover,.esri-menu__list-item:focus{background-color:var(--calcite-color-foreground-1)}.esri-menu__list-item:active{background-color:var(--calcite-color-foreground-current)}.esri-menu__list-item--active,.esri-menu__list-item--active:hover,.esri-menu__list-item--active:focus{background-color:var(--calcite-color-foreground-1);border-left-color:var(--calcite-color-brand)}.esri-widget__table{border-collapse:collapse;color:var(--calcite-color-text-1);border:none;width:100%;line-height:var(--calcite-font-line-height-relative-tight)}.esri-widget__table tr:nth-child(odd){background-color:var(--calcite-color-transparent)}.esri-widget__table tr:nth-child(2n){background-color:var(--calcite-color-transparent-press)}.esri-widget__table tr a{color:var(--calcite-color-text-2)}.esri-widget__table tr a:hover,.esri-widget__table tr a:focus{color:var(--calcite-color-text-1)}.esri-widget__table tr td,.esri-widget__table tr th{vertical-align:top;word-break:break-word;padding:.5em .7em;font-size:var(--calcite-font-size-sm);font-weight:var(--calcite-font-weight-regular)}.esri-widget__table tr th{text-align:left;border-right:3px solid #0000000d;width:50%}.esri-widget__table tr td{width:50%}.esri-input{color:var(--calcite-color-text-1);background-color:var(--calcite-color-foreground-1);border:1px solid #959595;font-size:var(--calcite-font-size)}.esri-input::-ms-clear{display:none}.esri-input::placeholder{opacity:1;color:var(--calcite-color-text-2)}.esri-input:placeholder-shown{text-overflow:ellipsis}.esri-input[type=text],.esri-input[type=password],.esri-input[type=number]{height:32px;padding:0 .5em}calcite-combobox.esri-input{border:none}.esri-widget__content--empty{text-align:center;color:var(--calcite-color-border-input);flex-flow:column wrap;align-items:center;padding:18px 22px;display:flex}.esri-widget__content--empty h1.esri-widget__heading,.esri-widget__content--empty h2.esri-widget__heading,.esri-widget__content--empty h3.esri-widget__heading,.esri-widget__content--empty h4.esri-widget__heading,.esri-widget__content--empty h5.esri-widget__heading{font-weight:var(--calcite-font-weight-regular)}.esri-widget__content-illustration--empty{width:128px;padding:1rem 0}.esri-widget__content-icon--empty{width:32px;padding:.5rem 0}.esri-select{appearance:none;cursor:pointer;color:var(--calcite-color-text-2);background:var(--calcite-color-foreground-1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-8 -8 32 32' width='32' height='32'%3E%3Cpath d='M8 11.207l-4-4V5.793l4 4 4-4v1.414z' fill='%23adadad' fillrule='nonzero'/%3E%3C/svg%3E") 100% no-repeat;border:1px solid #959595;border-radius:0;width:100%;height:32px;margin:0;padding:0 .5em;font-family:inherit;font-size:.85em;display:block}.esri-select[disabled]{cursor:auto}.esri-select::-ms-expand{display:none}.esri-disabled a,.esri-disabled [role=menu],.esri-disabled [role=checkbox],.esri-disabled [class^=esri-icon-],.esri-disabled [class*=" esri-icon-"]{color:var(--calcite-color-text-3)}.keynav-mode .esri-widget:focus,.keynav-mode .esri-widget :focus{z-index:1;outline-offset:2px;outline:2px solid #adadad}.esri-widget__loader-animation{border:.15em solid #adadad4d;border-top-color:var(--calcite-color-border-input);border-radius:100%;width:1em;height:1em;font-size:var(--calcite-font-size-md);animation:1.25s linear infinite esri-rotate;display:block;transform:translateZ(0)}:dir(rtl) .esri-widget__table th{text-align:right;border-left:3px solid #0000000d;border-right:none}:dir(rtl) .esri-select{background-position:0}:dir(rtl) .esri-menu__list-item{border-left:none;border-right:3px solid #0000}:dir(rtl) .esri-menu__list-item [class^=esri-icon-],:dir(rtl) .esri-menu__list-item [class*=" esri-icon-"]{padding-left:2px;padding-right:0}:dir(rtl) .esri-menu__list-item--active{border-right-color:var(--calcite-color-brand)}.esri-icon-font-fallback-text{clip:rect(0 0 0 0);width:1px;height:1px;position:absolute;overflow:hidden}.esri-rotating{animation:1.25s linear infinite esri-rotate;transform:translateZ(0)}.esri-clearfix:before,.esri-clearfix:after{content:" ";display:table}.esri-clearfix:after{clear:both}.esri-interactive{cursor:pointer}.esri-hidden{display:none!important}.esri-invisible{visibility:hidden!important}.esri-offscreen{position:absolute;top:-999em;left:-999em}.esri-match-height{flex-direction:column;flex:auto;display:flex;overflow:hidden}.esri-button{box-sizing:border-box;cursor:pointer;white-space:normal;word-break:normal;color:var(--calcite-color-text-1);background-color:var(--calcite-color-status-info);border:var(--calcite-spacing-px) solid var(--calcite-color-status-info);justify-content:center;align-items:center;width:100%;min-height:var(--calcite-spacing-xxxl);padding:6px 7px;font-family:inherit;font-size:var(--calcite-font-size);transition:background-color .125s ease-in-out,border .125s ease-in-out;display:flex;overflow:hidden;&:hover{color:var(--calcite-color-text-1);background-color:var(--calcite-color-status-info-hover);border:var(--calcite-spacing-px) solid var(--calcite-color-status-info-hover)}}.esri-button:hover{color:var(--calcite-color-text-1);background-color:var(--calcite-color-text-2);border:1px solid var(--calcite-color-text-2)}.esri-button.esri-button--small{min-height:var(--calcite-spacing-xl);font-size:var(--calcite-font-size-sm)}.esri-button.esri-button--half{width:50%;display:inline-block}.esri-button.esri-button--third{width:33%;display:inline-block}.esri-button--secondary{color:var(--calcite-color-text-1);background-color:var(--calcite-color-foreground-1)}.esri-button--tertiary{color:var(--calcite-color-brand);background-color:var(--calcite-color-transparent);border-color:var(--calcite-color-transparent)}.esri-button--tertiary:hover{color:var(--calcite-color-brand-hover);background-color:var(--calcite-color-foreground-2);border-color:var(--calcite-color-transparent)}.esri-button--disabled{opacity:.4;pointer-events:none}.esri-button--drill-in{outline-offset:-4px;cursor:pointer;text-align:unset;background-color:var(--calcite-color-foreground-1);border:none;border-radius:2px;justify-content:space-between;align-items:center;margin:var(--calcite-spacing-md) 7px;padding:var(--calcite-spacing-md) 7px;text-decoration:none;transition:background-color .125s ease-in-out;display:flex;box-shadow:0 0 0 1px #adadad4d}.esri-button--drill-in:hover,.esri-button--drill-in:focus{background-color:var(--calcite-color-foreground-2)}.esri-button--drill-in__title{font-size:var(--calcite-font-size)}.esri-button--drill-in [class^=esri-icon-],.esri-button--drill-in [class*=" esri-icon-"]{padding:0 7px}.esri-widget--button{cursor:pointer;text-align:center;color:var(--calcite-color-text-2);background-color:var(--calcite-color-foreground-1);flex-flow:row;justify-content:center;align-items:center;width:var(--calcite-spacing-xxxl);height:var(--calcite-spacing-xxxl);margin:0;padding:0;font-size:var(--calcite-font-size);transition:background-color .125s ease-in-out;display:flex;overflow:hidden}.esri-widget--button:is(calcite-button):not(:hover){--calcite-icon-color: var(--calcite-color-text-3)}.esri-widget--button:not([appearance]),.esri-widget--button[appearance=solid]{--calcite-color-foreground-3: var(--calcite-color-foreground-1)}.esri-widget--button:is(calcite-button){--calcite-offset-invert-focus: 1}.esri-widget--button calcite-loader[inline]{margin:auto}.esri-button--secondary{color:var(--calcite-color-brand);background-color:var(--calcite-color-foreground-1);&:hover{color:var(--calcite-color-text-inverse);background-color:var(--calcite-color-status-info);border:1px solid var(--calcite-color-status-info)}}:host{display:flex;--arcgis-internal-floor-filter-align-items: flex-start;--arcgis-internal-floor-filter-column-direction: column;--arcgis-internal-floor-filter-button-border-width: 1px 0 0;--arcgis-internal-floor-filter-button-display: flex;--arcgis-internal-floor-filter-menu-width: 300px;--arcgis-internal-floor-filter-menu-max-height: 240px;--arcgis-internal-floor-filter-levels-max-height: 156px}.floor-filter{background:0 0;border:none;flex-direction:var(--arcgis-internal-row-direction);display:flex;box-shadow:none!important}.esri-widget--button{cursor:pointer;text-align:center;color:var(--calcite-color-text-3);background:var(--calcite-color-foreground-1);flex-flow:row;justify-content:center;align-items:center;width:32px;height:32px;margin:0;padding:0;font-size:var(--calcite-font-size);transition:background-color .125s ease-in-out;display:flex;overflow:hidden}.esri-widget--button-active{color:var(--calcite-color-text-highlight)!important;background:var(--calcite-color-foreground-current)!important}.floor-filter__icon-flip{transform:var(--arcgis-internal-collapse-icon-flip)}.floor-filter__position{align-items:var(--arcgis-internal-floor-filter-align-items)}.floor-filter__position .floor-filter__levels-container,.floor-filter__position .floor-filter__close-levels-button,.floor-filter__position .floor-filter__zoom-button,.floor-filter__position .floor-filter__zoom-button--levels,.floor-filter__position .floor-filter__minimize-toggle-button{border-width:var(--arcgis-internal-floor-filter-button-border-width)}.floor-filter__button-container{display:flex;flex-direction:var(--arcgis-internal-floor-filter-column-direction)}.floor-filter__layout--collapsed .floor-filter__button-container{max-width:48px}.floor-filter__layout--expanded .floor-filter__button-container{max-width:300px}.floor-filter__layout--collapsed .floor-filter__button-container .floor-filter__browse-button{border:none;width:48px;height:48px;padding:12px}.floor-filter__layout--collapsed .floor-filter__button-container .floor-filter__zoom-button{border-style:solid;border-color:var(--calcite-color-border-1);width:48px;height:48px;padding:12px}.floor-filter__layout--collapsed .floor-filter__button-container .floor-filter__zoom-button--levels{border-style:solid;border-color:var(--calcite-color-border-1);width:48px;height:32px;padding:8px 12px}.floor-filter__layout--collapsed .floor-filter__button-container .floor-filter__minimize-toggle-button{border-style:solid;border-color:var(--calcite-color-border-1);width:48px;height:32px;padding:4px 12px}.floor-filter__layout--expanded .floor-filter__button-container .floor-filter__button-info{inline-size:100%}.floor-filter__layout--expanded .floor-filter__button-container .floor-filter__browse-button{border:none;width:auto;height:48px;padding:12px}.floor-filter__layout--expanded .floor-filter__button-container .floor-filter__level-button{text-align:start;justify-content:flex-start;padding:16px}.floor-filter__layout--expanded .floor-filter__button-container .floor-filter__zoom-button{border-style:solid;border-color:var(--calcite-color-border-1);width:auto;height:48px;padding:12px}.floor-filter__layout--expanded .floor-filter__button-container .floor-filter__zoom-button--levels{border-style:solid;border-color:var(--calcite-color-border-1);width:auto;height:32px;padding:8px 12px}.floor-filter__layout--expanded .floor-filter__button-container .floor-filter__minimize-toggle-button{border-style:solid;border-color:var(--calcite-color-border-1);width:auto;height:32px;padding:4px 12px}.floor-filter__layout--expanded .floor-filter__button-info{gap:var(--calcite-spacing-sm)}.floor-filter__button-container .floor-filter__button-info{display:flex;align-items:center}.floor-filter__level-button{border:none;width:100%;height:48px}.floor-filter__levels-container{margin:unset;padding:unset;scrollbar-width:thin;border-style:solid;border-color:var(--calcite-color-border-1);width:100%;max-height:var(--arcgis-internal-floor-filter-levels-max-height);list-style-type:none;overflow:auto}.floor-filter__levels-container .esri-widget--button-active{font-weight:var(--calcite-font-weight-semibold)}.floor-filter__levels-container::-webkit-scrollbar{width:6px}.floor-filter__levels-container::-webkit-scrollbar-track{background:var(--calcite-color-text-1)}.floor-filter__levels-container::-webkit-scrollbar-thumb{background-color:var(--calcite-color-transparent-tint);border:3px solid var(--calcite-color-transparent-tint);border-radius:20px}.floor-filter__button-container{box-shadow:0 1px 2px #0000004d}.floor-filter__filter-menu{background:var(--calcite-color-foreground-1);flex-direction:column;align-items:stretch;width:var(--arcgis-internal-floor-filter-menu-width);max-height:var(--arcgis-internal-floor-filter-menu-max-height);display:flex;box-shadow:0 1px 2px #0000004d}.floor-filter__filter-menu .floor-filter__filter-menu-header{color:var(--calcite-color-text-2);flex-direction:row;align-items:stretch;height:auto;line-height:var(--calcite-font-line-height-relative-tight);display:flex;box-shadow:0 .5px var(--calcite-color-foreground-3)}.floor-filter__filter-menu-header .floor-filter__icon-close{color:var(--calcite-color-text-2);background-color:var(--calcite-color-foreground-1);border:none;align-items:center;padding:20px 10px}.floor-filter__filter-menu .floor-filter__filter-menu-header-back{margin:unset;color:var(--calcite-color-text-2);background-color:var(--calcite-color-foreground-1);border:none;border-inline-end:1px solid var(--calcite-color-border-1);justify-content:center;align-items:center;min-width:28px;padding:20px 0;display:flex}.floor-filter__filter-menu .floor-filter__filter-menu-header-text-group{flex-direction:column;justify-content:center;padding:12px;display:flex;flex:1}.floor-filter__filter-menu .floor-filter__filter-menu-header-text{margin:unset;text-overflow:ellipsis;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;font-size:var(--calcite-font-size-md);font-style:normal;font-weight:var(--calcite-font-weight-semibold);display:-webkit-box;overflow:hidden}.floor-filter__filter-menu .floor-filter__filter-menu-header-subtext{text-overflow:ellipsis;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;margin:4px 0 0;font-size:var(--calcite-font-size);font-style:normal;font-weight:var(--calcite-font-weight-normal);display:-webkit-box;overflow:hidden}.floor-filter__filter-menu .floor-filter__icon-close:hover{cursor:pointer;color:var(--calcite-color-text-1);background:var(--calcite-color-foreground-2)}.floor-filter__filter-menu .floor-filter__filter-menu-search{background:var(--calcite-color-foreground-2);align-items:center;margin-top:.5px;margin-bottom:1px;padding:10px;display:flex;gap:6px;box-shadow:0 .5px var(--calcite-color-foreground-3)}.floor-filter__filter-menu-search-input{color:var(--calcite-color-text-2);background:0 0;border:none;outline:none;width:100%;font-size:var(--calcite-font-size)}.floor-filter__filter-menu .floor-filter__filter-menu-items{margin:unset;padding:unset;color:var(--calcite-color-text-2);width:100%;max-height:300px;list-style-type:none;overflow-y:auto}.floor-filter__filter-menu-site:hover,.floor-filter__filter-menu-site:focus,.floor-filter__filter-menu-facility:hover,.floor-filter__filter-menu-facility:focus,.floor-filter__level-button:focus,.floor-filter__level-button:hover,.esri-widget--button:hover,.floor-filter__filter-menu-header-back:hover{cursor:pointer;background:var(--calcite-color-foreground-2)}.floor-filter__filter-menu-site:active,.floor-filter__filter-menu-facility:active{color:var(--calcite-color-text-highlight);background-color:var(--calcite-color-foreground-current)}.floor-filter__filter-menu-site,.floor-filter__filter-menu-facility{color:var(--calcite-color-text-2);background:var(--calcite-color-foreground-1);border:none;flex-direction:row;align-items:center;gap:10px;inline-size:100%;line-height:var(--calcite-font-line-height-relative-tight);padding:18px;display:flex}.floor-filter__filter-menu-site .floor-filter__icon-left{transform:rotate(180deg)}.floor-filter__filter-menu-item-name{font-size:var(--calcite-font-size)}.floor-filter__filter-menu-item-name--selected{color:var(--calcite-color-text-2);font-size:var(--calcite-font-size);font-weight:var(--calcite-font-weight-bold)}.floor-filter__filter-menu-item-name,.floor-filter__filter-menu-item-name--selected{text-align:start;flex:1}.floor-filter__selected-item-circle{background:var(--calcite-color-brand-hover);border-radius:50%;width:4px;height:4px;margin-inline-start:-10px}.floor-filter__separator{box-shadow:none;background:0 0;border:none;width:10px}.esri-expand__content{width:max-content}.floor-filter__zoom-button,.floor-filter__zoom-button--levels,.floor-filter__minimize-toggle-button{display:var(--arcgis-internal-floor-filter-button-display)}.floor-filter__close-levels-button{background:var(--calcite-color-foreground-2);border-style:solid;border-color:var(--calcite-color-border-1);width:48px;height:48px;padding:12px}`, H = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "End", "Home"]), O = 50, j = S(L);
class D extends T {
  constructor() {
    super(...arguments), this.direction = B(), this.messages = N({}), this.store = E({ search: void 0 }), this.viewModel = j(this), this._activeMenu = null, this._activeMenuIndex = {
      levels: -1,
      menuItems: -1
    }, this._facilitiesListNode = x(), this._levelsListNode = x(), this._sitesListNode = x(), this.view = this.viewModel.view, this.autoDestroyDisabled = !1, this.facility = this.viewModel.facility, this.headingLevel = 2, this.icon = "urban-model", this.level = this.viewModel.level, this.longNames = this.viewModel.longNames, this.goToOverride = this.viewModel.goToOverride, this.site = this.viewModel.site, this.arcgisReady = F();
  }
  static {
    this.properties = { view: 0, autoDestroyDisabled: 5, facility: 3, headingLevel: 11, icon: 1, label: 1, level: 3, longNames: 7, messageOverrides: 0, goToOverride: 0, referenceElement: 1, site: 3 };
  }
  static {
    this.styles = A;
  }
  async destroy() {
    await this.manager.destroy();
  }
  async updateWebDocument(e) {
    this.viewModel.updateWebDocument(e);
  }
  loaded() {
    this.manager.onLifecycle(() => [
      z(() => this.store.search, () => this.store.search?.focus())
    ]);
  }
  _toggleCollapsed() {
    this.longNames = !this.longNames;
  }
  _toggleFilterMenu() {
    const e = this.viewModel?.filterMenuOpen ?? !1;
    this.viewModel.filterMenuOpen = !e;
  }
  _setFilterMenuType(e) {
    this.viewModel.filterMenuType = e;
  }
  _zoomToClicked() {
    if (this.site && this.viewModel?.filterMenuType === "site" && this.viewModel?.filterMenuOpen) {
      const e = this.viewModel?.getSite(this.site);
      this.viewModel.goTo(e);
    } else if (this.facility) {
      const e = this.viewModel?.getFacility(this.facility);
      this.viewModel.goTo(e);
    } else if (this.site) {
      const e = this.viewModel?.getSite(this.site);
      this.viewModel.goTo(e);
    }
  }
  _onSearchChange(e) {
    const r = e.target;
    r.value === "" ? this.viewModel.searchTerm = null : r.value && this.viewModel?.searchTerm !== r.value && (this.viewModel.searchTerm = r.value);
  }
  _onSearchClear() {
    this.viewModel.searchTerm = null;
  }
  _closeClicked() {
    this.viewModel.searchTerm = null, this.viewModel.filterMenuOpen = !1;
  }
  _backClicked() {
    this._setFilterMenuType("site"), this.viewModel.searchTerm = null;
  }
  _siteSelected(e) {
    const t = e.currentTarget.getAttribute("data-id"), n = this.viewModel.getSite(t);
    let i = !1;
    this.site !== t && (this.facility = null, this.level = null, i = !0, this.viewModel.levelsExpanded = !1), this.site = t, this.viewModel.searchTerm = null, this._setFilterMenuType("facility"), this.viewModel.goTo(n), i && this.viewModel.setFloors(null);
  }
  _facilitySelected(e) {
    const t = e.currentTarget.getAttribute("data-id"), n = this.viewModel.getFacility(t);
    let i = !1;
    if (this.facility !== t) {
      if (this.viewModel.filterMode === "base-floors") {
        const a = this.viewModel?.getBaseLevel(n);
        a ? this.level = a.id : this.level = null;
      } else
        this.level = null;
      i = !0, this.viewModel.levelsExpanded = !1;
    }
    if (this.facility = t, this.viewModel.goTo(n), i) {
      const a = this.viewModel.getLevel(this.level);
      this.viewModel.setFloors(a);
    }
    this.viewModel.isNormalMode || this.viewModel.getFacilityLevels(t)?.length > 1 && (this.viewModel.levelsExpanded = !0), setTimeout(() => this._focusActiveLevel(), O);
  }
  _levelSelected(e) {
    const t = e.currentTarget.getAttribute("data-id");
    this.level = t;
  }
  _closeLevels() {
    this.viewModel.levelsExpanded = !1;
  }
  _isWebScene(e) {
    return e?.declaredClass === "esri.WebScene";
  }
  _handleListKeydown(e) {
    const t = e.currentTarget.getAttribute("data-id");
    let n = null;
    t === "sites" || t === "facilities" ? (this._activeMenu !== t && (this._activeMenuIndex.menuItems = -1), this._activeMenu = t, n = "menuItems") : t === "levels" && (n = "levels");
    const i = t === "sites" ? this._sitesListNode.value : t === "facilities" ? this._facilitiesListNode.value : t === "levels" ? this._levelsListNode.value : null, { key: a } = e, u = a === "Tab", g = H.has(a);
    g && e.preventDefault();
    const _ = i?.getElementsByTagName("li");
    if (!(!_ || _.length === 0) && (g || u)) {
      this._handleItemNavigation(a, e.shiftKey, _, u, n);
      return;
    }
  }
  _handleItemNavigation(e, r, t, n, i) {
    if (!i)
      return;
    this._activeMenuIndex[i] === t.length && this._activeMenuIndex[i]--, this._activeMenuIndex[i] === -1 && this._activeMenuIndex[i]++;
    const a = this._activeMenuIndex[i];
    switch (e) {
      case "Home":
        this._activeMenuIndex[i] = 0;
        break;
      case "End":
        this._activeMenuIndex[i] = t.length - 1;
        break;
      case "ArrowUp":
        this._activeMenuIndex[i] = this._activeMenuIndex[i] <= 0 ? t.length - 1 : this._activeMenuIndex[i] - 1;
        break;
      case "ArrowDown":
        this._activeMenuIndex[i] = this._activeMenuIndex[i] === t.length - 1 ? 0 : this._activeMenuIndex[i] + 1;
        break;
    }
    if (e === "Tab" && r && this._activeMenuIndex[i] >= 0 && this._activeMenuIndex[i]--, e === "Tab" && !r && this._activeMenuIndex[i] < t.length && this._activeMenuIndex[i]++, a !== this._activeMenuIndex[i] && this._activeMenuIndex[i] > -1 && this._activeMenuIndex[i] < t.length && !n) {
      const u = t[this._activeMenuIndex[i]].getElementsByTagName("button");
      (u?.length === 1 ? u[0] : null)?.focus();
    }
  }
  _focusActiveLevel() {
    const { level: e } = this, r = this._levelsListNode.value, t = r?.getElementsByTagName("li");
    if (!e || !r || !t)
      return;
    const n = this._facilitiesListNode.value?.getElementsByTagName("li");
    this._activeMenuIndex.menuItems = n ? n.length - 1 : -1;
    const i = [];
    for (let a = 0; a < t.length; a++) {
      const g = t[a].getElementsByTagName("button");
      g?.length === 1 && i.push(g[0]);
    }
    i.forEach((a, u) => {
      a.getAttribute("data-id") === e && (a.focus(), this._activeMenuIndex.levels = u);
    });
  }
  _onItemFocus(e) {
    const r = e.currentTarget, t = r.getAttribute("data-list-id"), n = r.getAttribute("data-id"), i = t === "sites" ? this._sitesListNode.value : t === "facilities" ? this._facilitiesListNode.value : t === "levels" ? this._levelsListNode.value : null;
    if (!i)
      return;
    const a = i?.getElementsByTagName("li");
    if (!a)
      return;
    const u = [];
    Array.from(a).forEach((b) => {
      const m = b.getElementsByTagName("button");
      m?.length === 1 && u.push(m[0]);
    });
    let g = null;
    switch (t) {
      case "sites":
      case "facilities":
        g = "menuItems";
        break;
      case "levels":
        g = "levels";
        break;
    }
    if (!g)
      return;
    const _ = g;
    u.forEach((b, m) => {
      b.getAttribute("data-id") === n && this._activeMenuIndex[_] !== m && (this._activeMenuIndex[_] = m);
    });
  }
  render() {
    const { longNames: e } = this, r = e && this.viewModel.isNormalMode ? "expanded" : "collapsed", t = c`<div class=${s(l(o.separator))}></div>`;
    return k("floor-filter-menu", c`<div class=${s(l(o.floorFilter, d.widget, `${o.floorFilterLayout}${r}`, o.floorFilterPosition))}>${this._renderButtons()}${this.viewModel?.filterMenuOpen ? t : null}${this._renderFilterMenu()}</div>`);
  }
  _renderButtons() {
    return c`<div class=${s(l(d.widget, o.buttonContainer))}>${this._renderBrowseButton()}${this._renderLevelButtons()}${this._renderCloseLevelsButton()}${this._renderZoomButton()}${this._renderCollapseToggleButton()}</div>`;
  }
  _renderBrowseButton() {
    const { longNames: e } = this;
    return c`<button aria-expanded=${this.viewModel.filterMenuOpen.toString() ?? f} aria-label=${this.messages.buttons?.browse ?? f} class=${s(l(d.widget, d.widgetButton, d.interactive, (this.viewModel.state === "loading" || this.viewModel.state === "disabled") && d.buttonDisabled, o.browseButton, this.viewModel?.filterMenuOpen && d.widgetButtonActive))} @click=${this._toggleFilterMenu} title=${this.messages.buttons?.browse ?? f} type=button><div class=${s(l(o.buttonInfo))}><calcite-icon .icon=${this.icon} scale=s></calcite-icon><span class=${s(l(o.buttonLabel))}>${e && this.viewModel.isNormalMode ? this.messages.buttons?.browse : null}</span></div></button>`;
  }
  _renderLevelButtons() {
    if (!this.viewModel?.filterFeatures?.levels?.levelsInfo || !this.facility)
      return null;
    const { facility: e } = this, r = this.viewModel?.getFacility(e), n = (this.viewModel?.getFacilityLevels(e)).map((a) => this._renderLevelButton(a));
    if (!n.length)
      return null;
    const i = r && M(this.messages.selector?.levelsLabel ?? "", {
      name: `"${r.name}"`
    });
    if (this._isWebScene(this.el.view?.map) && n?.length > 1) {
      const a = {
        id: `all--${e}`,
        facilityId: e,
        shortName: this.messages.all,
        longName: this.messages.all,
        levelNumber: null,
        verticalOrder: null
      }, u = this._renderLevelButton(a);
      n.push(u);
    }
    return c`<ul aria-label=${i ?? f} class=${s(l(o.levelsContainer))} data-id=levels @keydown=${this._handleListKeydown} ${p(this._levelsListNode)}>${n}</ul>`;
  }
  _renderLevelButton(e) {
    const { longNames: r } = this, { shortName: t, longName: n, id: i } = e, a = this.level === i, u = r && this.viewModel.isNormalMode ? n : t;
    return !this.viewModel.isNormalMode && !a && !this.viewModel.levelsExpanded ? null : c`<li><button class=${s(l(d.widgetButton, a ? d.widgetButtonActive : null, d.interactive, o.levelButton))} data-id=${i ?? f} data-list-id=levels @click=${this._levelSelected} @focus=${this._onItemFocus} type=button>${u}</button></li>`;
  }
  _renderCloseLevelsButton() {
    return !this.level || this.viewModel.isNormalMode || !this.viewModel.levelsExpanded ? null : c`<button aria-label=${this.messages.close ?? f} class=${s(l(d.widget, d.widgetButton, d.interactive, o.closeLevelsButton))} @click=${this._closeLevels} title=${this.messages.close ?? f} type=button><div class=${s(l(o.buttonInfo))}><calcite-icon icon=x></calcite-icon></div></button>`;
  }
  _renderZoomButton() {
    const { longNames: e, facility: r, site: t } = this, n = this.viewModel?.filterMenuType, i = this.viewModel?.filterMenuOpen, a = this.viewModel?.getSite(t), u = this.viewModel?.getFacility(r), g = n === "site" && i ? !a : !u;
    return c`<button aria-label=${this.messages.buttons?.zoomTo ?? f} class=${s(l(d.widget, d.widgetButton, g && d.buttonDisabled, d.interactive, this.viewModel?.getFacilityLevels(r).length > 0 ? o.zoomButtonLevels : o.zoomButton))} @click=${this._zoomToClicked} title=${this.messages.buttons?.zoomTo ?? f} type=button><div class=${s(l(o.buttonInfo))}><calcite-icon icon=zoom-to-object scale=s></calcite-icon><span class=${s(l(o.buttonLabel))}>${e && this.viewModel.isNormalMode ? this.messages.buttons?.zoomTo : null}</span></div></button>`;
  }
  _renderCollapseToggleButton() {
    const { longNames: e } = this, r = e ? "chevrons-right" : "chevrons-left", t = e ? this.messages.collapse : this.messages.expand;
    return c`<button aria-label=${t ?? f} class=${s(l(d.widget, d.widgetButton, d.interactive, o.minimizeToggleButton))} @click=${this._toggleCollapsed} title=${t ?? f} type=button><div class=${s(l(o.buttonInfo))}><calcite-icon class=${s(l(o.iconFlip))} .icon=${r} scale=s></calcite-icon><span class=${s(l(o.buttonLabel))}>${e && this.viewModel.isNormalMode ? this.messages.collapse : null}</span></div></button>`;
  }
  _renderFilterMenu() {
    return this.viewModel?.filterMenuOpen ? this.viewModel?.filterMenuType === "site" ? this._renderSiteFilterMenu() : this.viewModel?.filterMenuType === "facility" ? this._renderFacilityFilterMenu() : null : null;
  }
  _renderSiteFilterMenu() {
    const e = this.site ? this.viewModel?.getSite(this.site)?.name : this.messages.selector?.selectSite, r = c`<div class=${s(l(o.filterMenuHeader))}><div class=${s(l(o.filterMenuHeaderTextGroup))}>${w({ class: l(o.filterMenuHeaderText), level: this.headingLevel, children: e })}</div><button class=${s(l(o.iconClose))} @click=${this._closeClicked} title=${this.messages.close ?? f} type=button><calcite-icon icon=x></calcite-icon></button></div>`, t = this._renderSearchInput(), n = this._renderSiteItems();
    return c`<div class=${s(l(o.filterMenu))}>${r}${t}${n}</div>`;
  }
  _renderFacilityFilterMenu() {
    const { site: e } = this, r = this.viewModel?.getSite(e)?.name, t = this.direction === "rtl", n = this.facility && this.viewModel?.getFacility(this.facility)?.name || this.messages.selector?.selectFacility, i = this.viewModel.hasMultipleSites ? c`<button class=${s(l(o.filterMenuHeaderBack))} @click=${this._backClicked} title=${this.messages.back ?? f} type=button><calcite-icon class=${s(l(t ? o.iconRight : o.iconLeft))} .icon=${t ? "chevron-right" : "chevron-left"}></calcite-icon></button>` : null, a = this.viewModel.hasMultipleSites ? w({ class: l(o.filterMenuHeaderSubtext), level: C(this.headingLevel), children: r }) : null, u = c`<div class=${s(l(o.filterMenuHeader))}>${i}<div class=${s(l(o.filterMenuHeaderTextGroup))}>${w({ class: l(o.filterMenuHeaderText), level: this.headingLevel, children: n })}${a}</div><button class=${s(l(o.iconClose))} @click=${this._closeClicked} title=${this.messages.close ?? f} type=button><calcite-icon icon=x></calcite-icon></button></div>`, g = this._renderSearchInput(), _ = this._renderFacilityItems();
    return c`<div class=${s(l(o.filterMenu))}>${u}${g}${_}</div>`;
  }
  _renderSearchInput() {
    const e = !!(this.viewModel.searchTerm && this.viewModel.searchTerm?.length > 0);
    return c`<div class=${s(l(o.filterMenuSearch))}><calcite-icon icon=search></calcite-icon><input class=${s(l(o.filterMenuSearchInput))} @input=${this._onSearchChange} @paste=${this._onSearchChange} placeholder=${this.messages.search ?? f} .value=${I(this.viewModel.searchTerm ?? void 0 ?? "")} ${p((t) => this.store.search = t)}>${e ? c`<calcite-icon class=${s(l(o.iconClose))} icon=x @click=${this._onSearchClear} title=${this.messages.clear ?? f}></calcite-icon>` : null}</div>`;
  }
  _renderBlueCircle() {
    return c`<span class=${s(l(o.selectedItemCircle))}></span>`;
  }
  _renderSiteItems() {
    if (!this.viewModel?.filterFeatures?.sites?.sitesInfo)
      return null;
    const { messages: e } = this, r = this.viewModel.filterFeatures.sites.sitesInfo, n = this.viewModel.filterSites(r).map((a) => this._renderSiteItem(a)), i = n.length === 0 && this.viewModel?.searchTerm && c`<div class=${s(l(d.empty))}>${e.noResults}</div>` || "";
    return c`<ul aria-label=${this.messages.selector?.sitesLabel ?? f} class=${s(l(o.filterMenuItems))} data-id=sites @keydown=${this._handleListKeydown} tabindex=-1 ${p(this._sitesListNode)}>${n}${i}</ul>`;
  }
  _renderSiteItem(e) {
    const { name: r, id: t } = e, n = this.site === t, i = this.direction === "rtl";
    return c`<li><button class=${s(l(o.filterMenuSite))} data-id=${t ?? f} data-list-id=sites @click=${this._siteSelected} @focus=${this._onItemFocus} type=button>${n ? this._renderBlueCircle() : null}<span class=${s(l(n ? o.filterMenuSelectedItem : o.filterMenuItemName))}>${r}</span><calcite-icon class=${s(l(i ? o.iconLeft : o.iconRight))} icon=chevron-right scale=s></calcite-icon></button></li>`;
  }
  _renderFacilityItems() {
    if (!this.viewModel?.filterFeatures?.facilities?.facilitiesInfo)
      return null;
    const { messages: e, site: r } = this, t = this.viewModel.getSite(r), n = this.viewModel.filterFeatures.facilities.facilitiesInfo, a = this.viewModel.filterFacilities(n).map((_) => this._renderFacilityItem(_)), u = a.length === 0 && this.viewModel?.searchTerm && c`<div class=${s(l(d.empty))}>${e.noResults}</div>` || "", g = t ? M(this.messages.selector?.siteFacilitiesLabel ?? "", {
      name: `"${t.name}"`
    }) : this.messages.selector?.facilitiesLabel;
    return c`<ul aria-label=${g ?? f} class=${s(l(o.filterMenuItems))} data-id=facilities @keydown=${this._handleListKeydown} tabindex=-1 ${p(this._facilitiesListNode)}>${a}${u}</ul>`;
  }
  _renderFacilityItem(e) {
    const { name: r, id: t } = e, n = this.facility === t;
    return c`<li><button class=${s(l(o.filterMenuFacility))} data-id=${t ?? f} data-list-id=facilities @click=${this._facilitySelected} @focus=${this._onItemFocus} type=button>${n ? this._renderBlueCircle() : null}<span class=${s(l(n ? o.filterMenuSelectedItem : o.filterMenuItemName))}>${r}</span></button></li>`;
  }
}
y("arcgis-floor-filter", D);
export {
  D as ArcgisFloorFilter
};
