@arcgis/map-components
Version:
ArcGIS Map Components
594 lines (593 loc) • 27.2 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import { c as j } from "../../chunks/runtime.js";
import { css as H, html as h } from "lit";
import { LitElement as J, createEvent as P } from "@arcgis/lumina";
import { u as T } from "../../chunks/useView.js";
import { H as B } from "../../chunks/heading.js";
import p from "@arcgis/core/core/Collection.js";
import { u as G } from "../../chunks/useT9n.js";
import { watch as M } from "@arcgis/core/core/reactiveUtils.js";
import z from "@arcgis/core/core/Accessor.js";
import { property as o, subclass as E } from "/core/core/accessorSupport/decorators.js";
import { c as X, a as I } from "../../chunks/building-layer-utils.js";
import { signal as N } from "@arcgis/core/applications/Components/reactiveUtils.js";
import { isAbortError as Z } from "@arcgis/core/core/promiseUtils.js";
import q from "@arcgis/core/layers/support/BuildingFilter.js";
import { V as F } from "../../chunks/visible-element.js";
import { C as K } from "../../chunks/component-wrapper.js";
const Q = H`.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-widget--panel{min-width:300px;min-height:32px;padding:var(--arcgis-internal-padding);transition:max-height .25s ease-in-out;overflow-y:auto}:host{transition:max-height .25s ease-in-out;overflow-y:auto}.root{position:relative;display:flex;flex-direction:column;gap:var(--calcite-spacing-xxxl)}.esri-widget__heading{font-weight:var(--calcite-font-weight-normal)}calcite-scrim{--calcite-scrim-background: var(--calcite-color-foreground-1)}.disabled{color:var(--calcite-color-status-danger)}.esri-widget--panel{min-width:unset}`, D = "__BUILDING_EXPLORER_FILTER__";
function Y() {
return `${crypto.randomUUID()}${D}`;
}
function O(t) {
const e = typeof t == "string" ? t : t.id;
return !!e && e.includes(D);
}
function S(t, e) {
for (const i of t)
for (const s of i.filters) {
if (!O(s))
continue;
const r = e(s);
if (r != null)
return r;
}
return null;
}
function ee(t, e) {
for (const i of t) {
const s = i.filters.filter((l) => !O(l));
e != null && s.push(e), te(i.filters, s) || (i.filters = s);
const r = i.filters.find((l) => O(l));
i.activeFilterId = r != null ? r.id : null;
}
}
function te(t, e) {
const i = e.length;
if (t?.length !== i)
return !1;
for (let s = 0; s < i; ++s) {
const r = e.at(s).toJSON(), l = t.at(s).toJSON();
if (r.id = "", l.id = "", JSON.stringify(r) !== JSON.stringify(l))
return !1;
}
return !0;
}
function ie(t) {
const e = A(t);
return e ? {
filterExpression: e,
// @ts-expect-error TODO: support autocasting in BuildingFilterBlock?
filterMode: { type: "x-ray" }
} : null;
}
function re(t) {
const e = A(t);
return e ? {
filterExpression: e,
// @ts-expect-error TODO: support autocasting in BuildingFilterBlock?
filterMode: { type: "solid" }
} : null;
}
function A(t) {
return t.filter((e) => !!e).map((e) => `(${e})`).join(" AND ");
}
function V(t) {
const e = {
fieldValueMap: /* @__PURE__ */ new Map(),
allowedValues: []
};
for (const i of t) {
const s = i.fieldValueMap, r = e.fieldValueMap;
s.forEach((l, a) => {
r.has(a) || (r.set(a, l), e.allowedValues.push(a));
});
}
return e.allowedValues.sort((i, s) => i - s), e;
}
function L(t, e) {
return e.allowedValues.length > 0 ? se(t, e.allowedValues) : null;
}
function se(t, e) {
if (e.length === 0)
return t;
if (t === 1 / 0)
return e[e.length - 1];
if (t === -1 / 0)
return e[0];
let i = e[0], s = Math.abs(i - t);
for (const r of e) {
const l = Math.abs(r - t);
l < s && (i = r, s = l);
}
return i;
}
var le = Object.defineProperty, ae = Object.getOwnPropertyDescriptor, W = (t) => {
throw TypeError(t);
}, d = (t, e, i, s) => {
for (var r = s > 1 ? void 0 : s ? ae(e, i) : e, l = t.length - 1, a; l >= 0; l--)
(a = t[l]) && (r = (s ? a(e, i, r) : a(r)) || r);
return s && r && le(e, i, r), r;
}, oe = (t, e, i) => e.has(t) || W("Cannot " + i), c = (t, e, i) => (oe(t, e, "read from private field"), i ? i.call(t) : e.get(t)), w = (t, e, i) => e.has(t) ? W("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), x, b, _, m;
let n = class extends z {
constructor(t) {
super(t), w(this, x, N(!0)), w(this, b, N(void 0)), w(this, _, N(null)), w(this, m, new p()), this._state = "disabled", this._domainInfo = V([]), this._loadLayers = X(), this.layers = new p();
}
initialize() {
this.addHandles(this.layers.on("change", () => {
this._onLayersChange();
})), this._onLayersChange();
}
destroy() {
this._state = "disabled";
}
get disabled() {
return this.allowedValues.length === 0 || c(this, x).value;
}
/**
* Whether the filter is disabled. If true, the filter's expression won't be
* used to filter a [BuildingSceneLayer](https://next.gha.afd.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/).
*
* @default true
*/
set disabled(t) {
c(this, x).value = t;
}
get value() {
return (this.state === "ready" ? c(this, b).value : this._valueBeforeReady) ?? 0;
}
set value(t) {
if (this.state !== "ready") {
this._valueBeforeReady = t;
return;
}
if (t === this.value)
return;
const e = L(t, this);
e != null && (c(this, b).value = e);
}
get min() {
return this.allowedValues.length === 0 ? null : Math.min(...this.allowedValues);
}
get max() {
return this.allowedValues.length === 0 ? null : Math.max(...this.allowedValues);
}
get allowedValues() {
return c(this, _).value ?? this._domainInfo.allowedValues;
}
set allowedValues(t) {
t == null ? c(this, _).value = null : c(this, _).value = t;
const e = L(this.value, this);
e != null && (this.value = e);
}
get hasNext() {
if (this.disabled)
return !0;
const t = this._valueIndex;
return t >= 0 && t < this.allowedValues.length - 1;
}
get hasPrevious() {
return this.disabled ? !0 : this._valueIndex > 0;
}
get layers() {
return c(this, m);
}
set layers(t) {
c(this, m).removeAll(), c(this, m).addMany(t);
}
get state() {
return this._state;
}
set state(t) {
this._state = t;
}
/**
* The expressions used to show only components which match this filter.
*/
get filterExpressions() {
return { solid: null, xRay: null };
}
get _valueIndex() {
return this.allowedValues.indexOf(this.value);
}
/**
* Selects the specified value for the filter. In case the filter is disabled, this
* method also enables it by setting [disabled](#disabled) to `false`.
*
* @param value - The value which is to be selected.
*/
select(t) {
if (this.state !== "ready") {
this._valueBeforeReady = t;
return;
}
L(t, this) != null && (this.disabled = !1, this.value = t);
}
/**
* Removes the filter by setting [enabled](#enabled) to `false`.
*/
clear() {
if (this.state !== "ready") {
this._valueBeforeReady = void 0;
return;
}
this.disabled = !0;
}
/**
* Selects the next value, if available. If [disabled](#disabled) is `true`,
* the first allowed value is selected.
*/
next() {
const { state: t, allowedValues: e, disabled: i, hasNext: s, _valueIndex: r } = this;
if (t !== "ready" && this._valueBeforeReady != null) {
this._valueBeforeReady++;
return;
}
if (e.length !== 0) {
if (i) {
this.disabled = !1, this.value = e[0];
return;
}
s && (this.value = e[r + 1]);
}
}
/**
* Selects the previous value, if available. If [disabled](#disabled) is `true`,
* the last allowed value is selected.
*/
previous() {
const { state: t, allowedValues: e, disabled: i, hasPrevious: s, _valueIndex: r } = this;
if (t !== "ready" && this._valueBeforeReady != null) {
this._valueBeforeReady++;
return;
}
if (e.length !== 0) {
if (i) {
this.disabled = !1, this.value = e[e.length - 1];
return;
}
s && (this.value = e[r - 1]);
}
}
/**
* If the field that is used for filtering has a coded value domain, the label for the value can
* be used to be displayed in a tooltip or in the component UI. This method returns the label
* corresponding to a certain value.
*
* @param value - A filter value.
* @returns The label corresponding to the filter value.
*/
getValueLabel(t) {
return this.layers.length === 0 ? null : this._domainInfo.fieldValueMap.get(t) ?? null;
}
async _onLayersChange() {
if (this._state = "loading", this._domainInfo = V([]), this.layers.length !== 0)
try {
await this._loadLayers(this.layers), this.state = "ready", this._setup(), this.changeEmitter?.();
} catch (t) {
Z(t) || (this._state = "failed");
}
}
};
x = /* @__PURE__ */ new WeakMap();
b = /* @__PURE__ */ new WeakMap();
_ = /* @__PURE__ */ new WeakMap();
m = /* @__PURE__ */ new WeakMap();
d([
o()
], n.prototype, "changeEmitter", 2);
d([
o()
], n.prototype, "disabled", 1);
d([
o()
], n.prototype, "value", 1);
d([
o({ readOnly: !0 })
], n.prototype, "min", 1);
d([
o({ readOnly: !0 })
], n.prototype, "max", 1);
d([
o()
], n.prototype, "allowedValues", 1);
d([
o({ readOnly: !0 })
], n.prototype, "hasNext", 1);
d([
o({ readOnly: !0 })
], n.prototype, "hasPrevious", 1);
d([
o({ type: p })
], n.prototype, "layers", 1);
d([
o()
], n.prototype, "_state", 2);
d([
o()
], n.prototype, "state", 1);
d([
o({})
], n.prototype, "_valueBeforeReady", 2);
d([
o({ readOnly: !0 })
], n.prototype, "_valueIndex", 1);
d([
o()
], n.prototype, "_domainInfo", 2);
n = d([
E("esri.components.BuildingExplorer.BuildingNumericFilterViewModel")
], n);
var ne = Object.defineProperty, de = Object.getOwnPropertyDescriptor, U = (t) => {
throw TypeError(t);
}, $ = (t, e, i, s) => {
for (var r = s > 1 ? void 0 : s ? de(e, i) : e, l = t.length - 1, a; l >= 0; l--)
(a = t[l]) && (r = (s ? a(e, i, r) : a(r)) || r);
return s && r && ne(e, i, r), r;
}, ce = (t, e, i) => e.has(t) || U("Cannot " + i), he = (t, e, i) => (ce(t, e, "read from private field"), i ? i.call(t) : e.get(t)), ue = (t, e, i) => e.has(t) ? U("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), k;
const pe = "bldglevel";
let f = class extends n {
constructor(t) {
super(t), ue(this, k, (e) => {
const i = new RegExp(`${this._levelFieldName}\\s*=\\s*(\\d+)`, "giu"), s = new RegExp(`${this._levelFieldName}\\s*<\\s*(\\d+)`, "giu");
for (const { filterMode: r, filterExpression: l } of e.filterBlocks ?? []) {
if (l == null)
continue;
let a = null;
if (r?.type === "solid" ? a = i.exec(l) : r?.type === "x-ray" && (a = s.exec(l)), a)
return Number.parseInt(a[1], 10);
}
return null;
});
}
get filterExpressions() {
return this.disabled || !this._levelFieldName ? { solid: null, xRay: null } : {
xRay: `${this._levelFieldName} < ${this.value}`,
solid: `${this._levelFieldName} = ${this.value}`
};
}
get _firstValue() {
const t = this.allowedValues;
return t.length > 0 ? t[0] : 0;
}
_setup() {
const t = [];
for (const s of this.layers) {
const r = I(s, pe);
r != null && (this._levelFieldName = r.fieldName, t.push(r));
}
this._domainInfo = V(t);
const e = this._valueBeforeReady;
this._valueBeforeReady = void 0;
const i = e ?? S(this.layers, he(this, k));
i != null ? this.select(i) : (this.disabled = !0, this.value = this._firstValue);
}
};
k = /* @__PURE__ */ new WeakMap();
$([
o()
], f.prototype, "filterExpressions", 1);
$([
o()
], f.prototype, "_levelFieldName", 2);
$([
o()
], f.prototype, "_firstValue", 1);
f = $([
E("esri.components.BuildingExplorer.BuildingLevel")
], f);
var ge = Object.defineProperty, fe = Object.getOwnPropertyDescriptor, y = (t, e, i, s) => {
for (var r = s > 1 ? void 0 : s ? fe(e, i) : e, l = t.length - 1, a; l >= 0; l--)
(a = t[l]) && (r = (s ? a(e, i, r) : a(r)) || r);
return s && r && ge(e, i, r), r;
};
const ve = "demolishedphase", _e = "createdphase";
let g = class extends n {
constructor(t) {
super(t), this._parseValueFromFilter = (e) => {
const i = this._createdPhaseFieldName, s = new RegExp(`${i}\\s*<=\\s*(\\d+)\\s*OR\\s*${i}\\s*IS\\s*NULL`, "giu"), r = this._demolishedPhaseFieldName, l = new RegExp(`${r}\\s*>\\s*(\\d+)\\s*OR\\s*${r}\\s*IS\\s*NULL`, "giu");
for (const { filterExpression: a } of e.filterBlocks ?? []) {
const C = a ? s.exec(a) ?? l.exec(a) : null;
if (C)
return Number.parseInt(C[1], 10);
}
return null;
};
}
get filterExpressions() {
if (this.disabled)
return { solid: null, xRay: null };
const t = [], e = this._createdPhaseFieldName;
e && t.push(`(${e} <= ${this.value} OR ${e} IS NULL)`);
const i = this._demolishedPhaseFieldName;
i && t.push(`(${i} > ${this.value} OR ${i} IS NULL)`);
const s = t.join(" AND ");
return {
solid: s,
xRay: s
};
}
get _lastValue() {
const t = this.allowedValues;
return t.length > 0 ? t[t.length - 1] : 0;
}
_setup() {
const t = [];
for (const i of this.layers) {
const s = I(i, _e);
s != null && (this._createdPhaseFieldName = s.fieldName, t.push(s));
const r = I(i, ve);
r != null && (this._demolishedPhaseFieldName = r.fieldName, t.push(r));
}
this._domainInfo = V(t);
const e = this._valueBeforeReady;
if (this._valueBeforeReady = void 0, this.allowedValues.length > 0) {
const i = e ?? S(this.layers, this._parseValueFromFilter);
this.select(i ?? this._lastValue);
} else
this.clear();
}
};
y([
o()
], g.prototype, "filterExpressions", 1);
y([
o()
], g.prototype, "_createdPhaseFieldName", 2);
y([
o()
], g.prototype, "_demolishedPhaseFieldName", 2);
y([
o()
], g.prototype, "_lastValue", 1);
g = y([
E("esri.components.BuildingExplorer.BuildingPhase")
], g);
var me = Object.defineProperty, ye = Object.getOwnPropertyDescriptor, v = (t, e, i, s) => {
for (var r = s > 1 ? void 0 : s ? ye(e, i) : e, l = t.length - 1, a; l >= 0; l--)
(a = t[l]) && (r = (s ? a(e, i, r) : a(r)) || r);
return s && r && me(e, i, r), r;
};
let u = class extends z {
constructor() {
super(...arguments), this.level = new f(), this.phase = new g();
}
get layers() {
return this._layers;
}
set layers(t) {
this._layers = t, this.level.layers = t ?? new p(), this.phase.layers = t ?? new p();
}
get filter() {
const t = this.level.filterExpressions, e = this.phase.filterExpressions, i = [], s = re([t.solid, e.solid]);
s != null && i.push(s);
const r = ie([t.xRay, e.xRay]);
return r != null && i.push(r), i.length === 0 ? null : new q({
id: Y(),
name: "Building Explorer Filter",
filterBlocks: i
});
}
};
v([
o()
], u.prototype, "_layers", 2);
v([
o()
], u.prototype, "layers", 1);
v([
o()
], u.prototype, "level", 2);
v([
o()
], u.prototype, "phase", 2);
v([
o({ readOnly: !0 })
], u.prototype, "filter", 1);
u = v([
E()
], u);
class we extends J {
constructor() {
super(...arguments), this.messages = G({ blocking: !0 }), this.#i = new p(), this.#r = new u(), this.view = T(this), this.autoDestroyDisabled = !1, this.headingLevel = 3, this.hideDisciplines = !1, this.hideLevels = !1, this.hidePhases = !1, this.icon = "organization", this.arcgisBuildingLevelChange = P({ bubbles: !0, composed: !0 }), this.arcgisBuildingPhaseChange = P({ bubbles: !0, composed: !0 }), this.arcgisReady = P();
}
static {
this.properties = { view: 0, autoDestroyDisabled: 5, headingLevel: 9, hideDisciplines: 5, hideLevels: 5, hidePhases: 5, icon: 1, label: 1, layers: 0, level: 9, phase: 9, levels: 0, phases: 0, levelDisabled: 32, phaseDisabled: 32, referenceElement: 1 };
}
static {
this.styles = Q;
}
#i;
#r;
get #e() {
return this.#r.level;
}
get #t() {
return this.#r.phase;
}
get minLevel() {
return this.#e.min;
}
get maxLevel() {
return this.#e.max;
}
get minPhase() {
return this.#t.min;
}
get maxPhase() {
return this.#t.max;
}
get supported() {
return this.view?.type === "3d";
}
get layers() {
return this.#i.toArray();
}
set layers(e) {
this.#i.removeAll(), this.#i.addMany(e);
}
get level() {
return this.#e.value;
}
set level(e) {
e == null ? this.#e.clear() : this.#e.value = e;
}
get phase() {
return this.#t.value;
}
set phase(e) {
e == null ? this.#t.clear() : this.#t.value = e;
}
get levels() {
return this.#e.allowedValues;
}
set levels(e) {
e == null ? this.#e.allowedValues = null : this.#e.allowedValues = e;
}
get phases() {
return this.#t.allowedValues;
}
set phases(e) {
e == null ? this.#t.allowedValues = null : this.#t.allowedValues = e;
}
get levelDisabled() {
return this.#e.disabled;
}
get phaseDisabled() {
return this.#t.disabled;
}
async destroy() {
await this.manager.destroy();
}
loaded() {
this.#e.changeEmitter = () => this.arcgisBuildingLevelChange.emit(), this.#t.changeEmitter = () => this.arcgisBuildingPhaseChange.emit(), this.manager.onLifecycle(() => [
M(() => ({
layers: this.#i.toArray(),
filter: this.#r.filter,
levelState: this.#e.state,
phaseState: this.#t.state
}), ({ layers: e, filter: i, levelState: s, phaseState: r }) => {
s !== "ready" || r !== "ready" || ee(e, i);
}, { initial: !0 }),
M(() => this.layers, (e) => {
this.#r.layers = new p(e);
}, { initial: !0 })
]);
}
render() {
const e = this.messages;
if (!this.supported)
return R({ label: e.componentLabel, children: h`<p class="disabled">${e.unsupported}</p>` });
if (this.layers.length === 0)
return R({ label: e.componentLabel, children: h`<p class="disabled">${e.noData}</p>` });
const i = this.hideLevels || this.#e.allowedValues.length === 0, s = this.hidePhases || this.#t.allowedValues.length === 0, r = this.#e.state !== "ready" || this.#t.state !== "ready";
return R({ label: e.componentLabel, loading: r, children: h`${F({ hidden: i, children: h`<div>${B({ level: this.headingLevel, children: this.messages.level.title })}<arcgis-building-level-picker .messages=${e.level} .level=${this.#e}></arcgis-building-level-picker></div>` })}${F({ hidden: s, children: h`<div>${B({ level: this.headingLevel, children: this.messages.phase.title })}<arcgis-building-phase-picker .messages=${e.phase} .phase=${this.#t}></arcgis-building-phase-picker></div>` })}${F({ hidden: this.hideDisciplines, children: h`<div>${B({ level: this.headingLevel, children: this.messages.disciplines.title })}<arcgis-building-discipline-tree .layers=${this.layers} .messages=${this.messages.disciplines}></arcgis-building-discipline-tree></div>` })}` });
}
}
function R(t) {
return K({ class: "root", hideHeader: !0, label: t.label, children: h`${t.children}${t.loading ? h`<calcite-scrim .loading=${t.loading}></calcite-scrim>` : null}` });
}
j("arcgis-building-explorer", we);
export {
we as ArcgisBuildingExplorer
};