<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">var __decorate = (this &amp;&amp; this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c &lt; 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" &amp;&amp; typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i &gt;= 0; i--) if (d = decorators[i]) r = (c &lt; 3 ? d(r) : c &gt; 3 ? d(target, key, r) : d(target, key)) || r;
    return c &gt; 3 &amp;&amp; r &amp;&amp; Object.defineProperty(target, key, r), r;
};
var __importDefault = (this &amp;&amp; this.__importDefault) || function (mod) {
    return (mod &amp;&amp; mod.__esModule) ? mod : { "default": mod };
};
define(["require", "exports", "TemplatesCommonLib/functionality/esriWidgetUtils", "./utils/esriWidgetUtils", "TemplatesCommonLib/functionality/positionManager", "TemplatesCommonLib/baseClasses/support/itemUtils", "TemplatesCommonLib/baseClasses/support/domHelper", "TemplatesCommonLib/structuralFunctionality/t9nUtils", "esri/core/promiseUtils", "TemplatesCommonLib/structuralFunctionality/telemetry/telemetry", "./ConfigurationSettings", "esri/core/Handles", "./ui/Layout", "./ui/MobilePanel", "./ui/Panel", "esri/core/promiseUtils", "esri/core/reactiveUtils", "esri/geometry/support/jsonUtils", "esri/core/urlUtils", "esri/widgets/Search", "./utils/popupUtils", "./utils/themeUtils", "./utils/utils", "TemplatesCommonLib/functionality/highlight", "esri/core/accessorSupport/decorators", "esri/intl", "esri/widgets/Popup", "esri/geometry", "TemplatesCommonLib/structuralFunctionality/language-switcher/LanguageSwitcher", "TemplatesCommonLib/structuralFunctionality/landing-page/LandingPage", "TemplatesCommonLib/functionality/configurationSettings"], function (require, exports, esriWidgetUtils_1, esriWidgetUtils_2, positionManager_1, itemUtils_1, domHelper_1, t9nUtils_1, promiseUtils_1, telemetry_1, ConfigurationSettings_1, Handles_1, Layout_1, MobilePanel_1, Panel_1, promiseUtils_2, reactiveUtils_1, jsonUtils_1, urlUtils_1, Search_1, popupUtils_1, themeUtils_1, utils_1, highlight_1, decorators_1, intl_1, Popup_1, geometry_1, LanguageSwitcher_1, LandingPage_1, configurationSettings_1) {
    "use strict";
    telemetry_1 = __importDefault(telemetry_1);
    ConfigurationSettings_1 = __importDefault(ConfigurationSettings_1);
    Handles_1 = __importDefault(Handles_1);
    Layout_1 = __importDefault(Layout_1);
    MobilePanel_1 = __importDefault(MobilePanel_1);
    Panel_1 = __importDefault(Panel_1);
    Search_1 = __importDefault(Search_1);
    Popup_1 = __importDefault(Popup_1);
    LanguageSwitcher_1 = __importDefault(LanguageSwitcher_1);
    LandingPage_1 = __importDefault(LandingPage_1);
    const SEARCH_PARAMS = new URL(window.location.href)?.searchParams;
    class Sidebar {
        constructor() {
            this._handles = null;
            this._appConfig = null;
            this._mobilePanel = null;
            this._panel = null;
            this._telemetry = null;
            this.view = null;
            this._page = null;
            //--------------------------------------------------------------------------
            //
            //  Public Methods
            //
            //--------------------------------------------------------------------------
            this.bundleName = "sidebar/app/t9n/common";
        }
        async init(base) {
            if (!base) {
                console.error("ApplicationBase is not defined");
                return;
            }
            this._handles = new Handles_1.default();
            (0, promiseUtils_1.eachAlways)([
                (0, t9nUtils_1.handleT9N)("sidebar", "sidebar", "sidebar/app/t9n/common"),
                (0, t9nUtils_1.handleT9N)("instant", "instant", "instant/../t9n/common")
            ]).then((results) =&gt; {
                const [appBundle, bundle] = results;
                base.config.bundle = bundle?.value;
                base.config.appBundle = appBundle?.value;
                this._base = base;
                this._createApp();
            });
        }
        _createApp() {
            const { config, results } = this._base;
            if (config?.exportPDF) {
                config.exportToPDF = config.exportPDF;
            }
            this._appConfig = new ConfigurationSettings_1.default(config);
            this._appConfig.base = this._base;
            (0, themeUtils_1.updateThemeConfig)(this._appConfig);
            this.createTelemetry();
            const { webMapItems } = results;
            if (config.legend &amp;&amp; !this._appConfig.legendPanel) {
                this._appConfig.legendPanel = config.legend;
            }
            this.handleThemeUpdates();
            let item = null;
            webMapItems.forEach((response) =&gt; {
                if (response?.value?.id === this._appConfig?.webmap) {
                    item = response.value;
                }
                else if (this._appConfig?.webmap === "default") {
                    item = response.value;
                }
            });
            if (!item) {
                // show error page
                document.location.href = `../../shared/unavailable/index.html?appid=${config?.appid ?? null}`;
                return;
            }
            const layout = new Layout_1.default({
                applicationBase: this._base,
                applicationConfig: this._appConfig,
                item,
                container: document.getElementById("appContainer")
            });
            const layoutHandle = layout.watch("view", () =&gt; {
                layoutHandle.remove();
                const view = layout.view;
                this.view = view;
                (0, intl_1.onLocaleChange)(async () =&gt; {
                    this._appConfig.bundle = await (0, intl_1.fetchMessageBundle)("instant/../t9n/common");
                    this._appConfig.appBundle = await (0, intl_1.fetchMessageBundle)("sidebar/app/t9n/common");
                });
                this._setupPositioning(view, this._appConfig);
                (0, itemUtils_1.setImageryLayerHighlightOptions)(view);
                this?.view?.when(() =&gt; {
                    const { find, marker } = config;
                    const promises = [(0, itemUtils_1.findQuery)(find, view), (0, itemUtils_1.goToMarker)(marker, view)];
                    Promise.all(promises).then(async () =&gt; {
                        const hiddenLayers = SEARCH_PARAMS?.get("hiddenLayers")?.split(";");
                        if (hiddenLayers)
                            (0, itemUtils_1.setHiddenLayers)(this._appConfig.hiddenLayers, this?.view);
                        const selectedFeature = SEARCH_PARAMS?.get("selectedFeature")?.split(";");
                        if (selectedFeature &amp;&amp; !this._appConfig?.popupPanel) {
                            (0, itemUtils_1.findSelectedFeature)(this._appConfig.selectedFeature, this?.view);
                        }
                        this._initialExtent = this.view.extent.clone();
                        this._initialScale = view.scale;
                        this._initialRotation = view.rotation;
                    });
                });
                this._addTitle();
                // watch for option/cmd + m key
                document.addEventListener("keydown", (e) =&gt; {
                    if (e?.altKey &amp;&amp; e?.code === "KeyM") {
                        this?.view?.focus();
                    }
                });
                if (this._isHoverMobile()) {
                    this._appConfig.popupHover = false;
                }
                this._handlePopupBehavior(view);
                this._handles.add([
                    (0, reactiveUtils_1.watch)(() =&gt; [
                        this._appConfig?.highlightColor,
                        this._appConfig?.enableHighlightColor,
                        this._appConfig?.enableHighlightHaloColor,
                        this._appConfig.highlightHaloColor
                    ], () =&gt; {
                        const { highlightColor, highlightHaloColor, enableHighlightColor, enableHighlightHaloColor } = this._appConfig;
                        const highlightConfig = {
                            enableHighlightColor,
                            highlightColor,
                            enableHighlightHaloColor,
                            highlightHaloColor
                        };
                        (0, highlight_1.handleHighlightColors)(highlightConfig, view);
                    }, { initial: true })
                ]);
                // change zoom level if configured with
                // search scale
                view?.popup?.on("trigger-action", (event) =&gt; {
                    const { searchScale, enableFeatureSearchScale, popupPanel } = this._appConfig;
                    if (event?.action?.id === "zoom-to-feature" &amp;&amp; enableFeatureSearchScale &amp;&amp; searchScale) {
                        const selectedFeature = view.popup.selectedFeature;
                        const goToProps = (0, utils_1.createGoToProps)(selectedFeature, this._appConfig, view);
                        if (selectedFeature &amp;&amp; popupPanel) {
                            this.view.goTo(goToProps).catch(() =&gt; { });
                        }
                        else {
                            this.view.popup.goToOverride = (view, goToParams) =&gt; {
                                return view.goTo(goToProps).catch();
                            };
                        }
                    }
                });
                // Add widgets and side panel
                const widgetProps = {
                    view,
                    config: this._appConfig,
                    portal: this._base.portal,
                    telemetry: this._telemetry
                };
                this._languageSwitcher = new LanguageSwitcher_1.default({
                    base: this._base,
                    configurationSettings: this._appConfig,
                    view,
                    expandTooltip: this._appConfig?.appBundle.tools.languageSwitcher,
                    collapseTooltip: this._appConfig?.appBundle.tools.languageSwitcherClose,
                    messageBundleName: "sidebar/app/t9n/common",
                    collapseTooltipKey: "tools.languageSwitcherClose",
                    expandTooltipKey: "tools.languageSwitcher",
                    handles: this._handles
                });
                this._landingPage = new LandingPage_1.default({
                    base: this._base,
                    container: document.createElement("div"),
                    configurationSettings: this._appConfig,
                    handles: this._handles,
                    portal: this._base.portal
                });
                document.addEventListener("selectedLanguageUpdated", async (e) =&gt; {
                    // Update the popup if one is visible so arcade expressions are applied '
                    if (view?.popup?.selectedFeature) {
                        const location = view?.popup?.location;
                        if (location) {
                            view.popup.close();
                            view.popup.open({
                                fetchFeatures: true,
                                location
                            });
                        }
                    }
                });
                this._handles.add([
                    (0, reactiveUtils_1.watch)(() =&gt; [this?._appConfig?.landingPage, this?._appConfig?.bundle, this?._appConfig?.coverPage], () =&gt; {
                        (0, esriWidgetUtils_2.addReturnToCoverPageButton)(this._appConfig, view, this._appConfig?.bundle, this._landingPage, "bottom-right" // Hardcoded position
                        );
                    }, { initial: true }),
                    (0, reactiveUtils_1.watch)(() =&gt; [this?._appConfig?.localeSwitcher, this?._appConfig?.languageSwitcher], () =&gt; {
                        // Don't add locale switcher if Language switcher is configured
                        if (this._appConfig?.languageSwitcher)
                            return;
                        (0, esriWidgetUtils_2.addLocaleSwitcher)({ ...widgetProps, ...{ propertyName: "localeSwitcher" } });
                    }, {
                        initial: true
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; [this._appConfig?.orientedImagery], () =&gt; {
                        if (this._appConfig?.orientedImagery) {
                            this._telemetry?.logEvent({
                                category: "Sidebar",
                                action: "Oriented Imagery",
                                label: "Oriented Imagery",
                                attribute: this._appConfig?.appid ?? "",
                                details: `Oriented Imagery:${this._appConfig?.orientedImagery}`
                            });
                        }
                    }, { initial: true }),
                    (0, reactiveUtils_1.watch)(() =&gt; [this._appConfig?.utilityNetwork], () =&gt; {
                        if (this._appConfig?.utilityNetwork === true &amp;&amp; !this?._base?.portal?.isPortal) {
                            // add notice if within config experience
                            if ((0, configurationSettings_1.isWithinConfigurationExperience)()) {
                                const notice = document.createElement("calcite-notice");
                                notice.open = true;
                                notice.closable = true;
                                notice.classList.add("utility-network-notice");
                                notice.kind = "danger";
                                notice.scale = "l";
                                notice.width = "full";
                                notice.icon = "information";
                                const messageDiv = document.createElement("div");
                                messageDiv.slot = "message";
                                messageDiv.innerHTML = this?._appConfig?.appBundle?.utilNetworkDeprecationNotice;
                                notice.appendChild(messageDiv);
                                document.body.appendChild(notice);
                            }
                        }
                    }, { initial: true }),
                    (0, reactiveUtils_1.watch)(() =&gt; [
                        this?._appConfig?.customUrlParam,
                        this?._appConfig?.urlParamAsFilter,
                        this?._appConfig?.customURLParamName
                    ], (newValue, oldValue) =&gt; {
                        const { urlParamAsFilter, customURLParamName } = this._appConfig;
                        const customUrlParam = this._appConfig.customUrlParam?.layers?.[0];
                        const fieldName = customUrlParam?.fields?.[0];
                        const subLayerId = customUrlParam?.sublayerId;
                        if (!customUrlParam || !customURLParamName || !fieldName) {
                            return;
                        }
                        view.when(() =&gt; {
                            this._initialRotation = view?.rotation || 0;
                            let layer = view.map.findLayerById(customUrlParam.id);
                            layer?.load()?.then(() =&gt; {
                                if (subLayerId &gt;= 0 &amp;&amp; layer?.type === "map-image") {
                                    layer = layer.findSublayerById(subLayerId);
                                }
                                if (!layer)
                                    return;
                                const href = this._appConfig.withinConfigurationExperience
                                    ? document.referrer
                                    : document.location.href;
                                const searchResults = (0, urlUtils_1.urlToObject)(href);
                                let searchTerm = null;
                                if (searchResults?.query) {
                                    if (customURLParamName in searchResults.query) {
                                        searchTerm = searchResults.query[customURLParamName];
                                    }
                                }
                                if (!urlParamAsFilter &amp;&amp; searchTerm) {
                                    const layerSearchSource = {
                                        layer,
                                        searchFields: customUrlParam.fields,
                                        outFields: ["*"],
                                        exactMatch: true,
                                        displayField: fieldName
                                    };
                                    if (layer) {
                                        const search = new Search_1.default({
                                            view,
                                            resultGraphicEnabled: false,
                                            searchAllEnabled: false,
                                            includeDefaultSources: false,
                                            suggestionsEnabled: false,
                                            sources: [layerSearchSource],
                                            searchTerm
                                        });
                                        search.search().then((r) =&gt; {
                                            let geometry = view?.popup?.location;
                                            const searchResults = r?.results[0];
                                            searchResults?.results?.forEach((result) =&gt; {
                                                geometry = result.feature.geometry;
                                            });
                                            const goToProps = (0, utils_1.createGoToProps)(geometry, this._appConfig, view);
                                            view.goTo(goToProps).catch();
                                        });
                                    }
                                }
                                if (urlParamAsFilter &amp;&amp; searchTerm) {
                                    if (layer &amp;&amp; urlParamAsFilter) {
                                        if (layer.hasOwnProperty("definitionExpression") &amp;&amp; searchTerm &amp;&amp; fieldName) {
                                            const l = layer;
                                            let field = null;
                                            l?.fields?.some((val) =&gt; {
                                                if (val.name === fieldName) {
                                                    field = val;
                                                    return true;
                                                }
                                                else {
                                                    return false;
                                                }
                                            });
                                            let definitionExpression = `${fieldName} = ${decodeURI(searchTerm)}`;
                                            if (field.type === "string") {
                                                definitionExpression = `${fieldName} = '${decodeURI(searchTerm)}'`;
                                            }
                                            l.definitionExpression = definitionExpression;
                                            l.definitionExpression = `${fieldName} = '${decodeURI(searchTerm)}'`;
                                            const q = l.createQuery();
                                            l.queryExtent(q).then((e) =&gt; {
                                                if (e?.extent)
                                                    view.goTo(e?.extent).catch();
                                            });
                                        }
                                    }
                                }
                            });
                        });
                    }, { initial: true }),
                    (0, reactiveUtils_1.watch)(() =&gt; [this._appConfig?.applyCustomTheme, this._appConfig?.customTheme], () =&gt; {
                        let { customTheme } = this._appConfig;
                        const sharedThemeProps = this?._base?.portal?.portalProperties?.sharedTheme;
                        if (customTheme?.applySharedTheme &amp;&amp; !customTheme?.logo &amp;&amp; sharedThemeProps?.logo?.small) {
                            customTheme.logo = sharedThemeProps.logo.small;
                        }
                        if (this._appConfig?.applySharedTheme &amp;&amp; !this?._appConfig?.customTheme) {
                            this._appConfig.customTheme = {
                                applySharedTheme: true
                            };
                        }
                        (0, themeUtils_1.handleCustomTheme)(this._appConfig);
                    }, { initial: true }),
                    (0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.disableScroll, () =&gt; {
                        widgetProps.propertyName = "disableScroll";
                        (0, esriWidgetUtils_2.addOverlay)(widgetProps);
                    }, { initial: true }),
                    (0, reactiveUtils_1.watch)(() =&gt; [this?._appConfig?.mapArea, this?._appConfig?.mapAreaConfig], () =&gt; {
                        if (this._appConfig?.mapArea === true &amp;&amp; this._appConfig.mapAreaConfig) {
                            if (this._appConfig.mapAreaConfig != null) {
                                const viewPointToUse = {
                                    ...this._appConfig.mapAreaConfig,
                                    targetGeometry: geometry_1.Point.fromJSON(this._appConfig.mapAreaConfig.targetGeometry)
                                };
                                const searchParams = new URL(window.location.href)?.searchParams;
                                const center = searchParams?.get("center");
                                const level = searchParams?.get("level");
                                if (center &amp;&amp; level)
                                    return;
                                view.when(() =&gt; {
                                    view.goTo(viewPointToUse.targetGeometry).then(() =&gt; {
                                        view.scale = viewPointToUse.scale;
                                        view.rotation = viewPointToUse?.rotation ?? this?._initialRotation;
                                    });
                                });
                            }
                        }
                        else if (this._appConfig?.mapArea === false) {
                            // if mapArea is false, reset to initial extent
                            view.when(() =&gt; {
                                if (this?._initialExtent) {
                                    view.goTo(this._initialExtent).then(() =&gt; {
                                        view.scale = this._initialScale;
                                        view.rotation = this._initialRotation;
                                    });
                                }
                            });
                        }
                    }, { initial: true }),
                    (0, reactiveUtils_1.watch)(() =&gt; [this._appConfig?.extentSelector, this._appConfig?.extentSelectorConfig, this._appConfig?.mapArea], () =&gt; {
                        this.handleExtentChanges(view);
                    }, { initial: true }),
                    (0, reactiveUtils_1.watch)(() =&gt; this?._appConfig?.fullScreen, () =&gt; {
                        (0, esriWidgetUtils_2.addFullscreen)({
                            ...widgetProps,
                            ...{ propertyName: "fullScreen" }
                        });
                    }, {
                        initial: true
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; this?._appConfig?.fullScreenPosition, () =&gt; {
                        (0, esriWidgetUtils_2.addFullscreen)({
                            ...widgetProps,
                            ...{ propertyName: "fullScreenPosition" }
                        });
                    }, {
                        initial: true
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; [this._appConfig?.mapZoom, this?._appConfig?.mapZoomPosition], () =&gt; {
                        if (view?.ui?.find("zoom"))
                            view.ui.remove("zoom");
                        (0, esriWidgetUtils_1.addZoom)(config, view);
                    }, { initial: true }),
                    (0, reactiveUtils_1.watch)(() =&gt; [
                        this._appConfig?.keyboardShortcuts,
                        this._appConfig?.bundle,
                        this._appConfig?.keyboardShortcutsPosition
                    ], () =&gt; {
                        (0, esriWidgetUtils_1.addKeyboardShortcuts)(this._appConfig, view, this._appConfig.bundle);
                    }, { initial: true }),
                    (0, reactiveUtils_1.watch)(() =&gt; [this?._appConfig?.compassWidget, this._appConfig?.compassWidgetPosition], () =&gt; {
                        (0, esriWidgetUtils_1.addCompass)(this._appConfig, view);
                    }, {
                        initial: true
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; [
                        this?._appConfig?.home,
                        this?._appConfig?.homePosition,
                        this?._appConfig?.mapArea,
                        this?._appConfig?.mapAreaConfig
                    ], () =&gt; {
                        (0, esriWidgetUtils_1.addHome)(this._appConfig, view);
                    }, {
                        initial: true
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; [this?._appConfig?.locateWidget, this?._appConfig?.locateWidgetPosition], () =&gt; {
                        (0, esriWidgetUtils_1.addLocateWidget)(this._appConfig, view);
                    }, {
                        initial: true
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; [this._appConfig?.scalebar, this._appConfig?.scalebarDualMode, this._appConfig?.scalebarPosition], () =&gt; {
                        (0, esriWidgetUtils_1.addScaleBar)(this._appConfig, view);
                    }, { initial: true }),
                    (0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.splash, () =&gt; {
                        widgetProps.propertyName = "splash";
                        (0, esriWidgetUtils_2.addSplash)(widgetProps);
                    }, { initial: true }),
                    (0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.splashButtonIcon, () =&gt; {
                        widgetProps.propertyName = "splashButtonIcon";
                        (0, esriWidgetUtils_2.addSplash)(widgetProps);
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.splashFullScreen, () =&gt; {
                        widgetProps.propertyName = "splashFullScreen";
                        (0, esriWidgetUtils_2.addSplash)(widgetProps);
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.splashButtonPosition, () =&gt; {
                        widgetProps.propertyName = "splashButtonPosition";
                        (0, esriWidgetUtils_2.addSplash)(widgetProps);
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.splashButtonText, () =&gt; {
                        widgetProps.propertyName = "splashButtonText";
                        (0, esriWidgetUtils_2.addSplash)(widgetProps);
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.info, () =&gt; {
                        widgetProps.propertyName = "info";
                        (0, esriWidgetUtils_2.addSplash)(widgetProps);
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.detailsOpenAtStart, () =&gt; {
                        widgetProps.propertyName = "detailsOpenAtStart";
                        (0, esriWidgetUtils_2.addSplash)(widgetProps);
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; [
                        this._appConfig?.search,
                        this?._appConfig?.searchConfiguration,
                        this?._appConfig?.searchPosition,
                        this?._appConfig?.searchOpenAtStart,
                        this?._appConfig?.extentSelector,
                        this?._appConfig?.extentSelectorConfig,
                        this?._appConfig?.bundle
                    ], () =&gt; {
                        (0, esriWidgetUtils_1.addSearch)(this._appConfig, view, this._appConfig?.bundle);
                    }, { initial: true }),
                    (0, reactiveUtils_1.watch)(() =&gt; [this?._appConfig?.basemapToggle], () =&gt; {
                        (0, esriWidgetUtils_2.addBasemap)({
                            ...widgetProps,
                            ...{ propertyName: "basemapToggle" }
                        });
                    }, {
                        initial: true
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; [this?._appConfig?.basemapTogglePosition], () =&gt; {
                        (0, esriWidgetUtils_2.addBasemap)({
                            ...widgetProps,
                            ...{ propertyName: "basemapTogglePosition" }
                        });
                    }, {
                        initial: true
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; [this?._appConfig?.nextBasemap], () =&gt; {
                        (0, esriWidgetUtils_2.addBasemap)({ ...widgetProps, ...{ propertyName: "nextBasemap" } });
                    }, {
                        initial: true
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; [this?._appConfig?.basemapSelector], () =&gt; {
                        (0, esriWidgetUtils_2.addBasemap)({
                            ...widgetProps,
                            ...{ propertyName: "basemapSelector" }
                        });
                    }, {
                        initial: true
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.share, () =&gt; {
                        widgetProps.propertyName = "share";
                        (0, esriWidgetUtils_2.addShare)(widgetProps);
                    }, { initial: true }),
                    (0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.shareIncludeSocial, () =&gt; {
                        widgetProps.propertyName = "shareIncludeSocial";
                        (0, esriWidgetUtils_2.addShare)(widgetProps);
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.shareIncludeEmbed, () =&gt; {
                        widgetProps.propertyName = "shareIncludeEmbed";
                        (0, esriWidgetUtils_2.addShare)(widgetProps);
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.theme, () =&gt; {
                        widgetProps.propertyName = "theme";
                        (0, esriWidgetUtils_2.addShare)(widgetProps);
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.header, () =&gt; {
                        widgetProps.propertyName = "header";
                        (0, esriWidgetUtils_2.addShare)(widgetProps);
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; this?._appConfig?.measure, () =&gt; {
                        (0, esriWidgetUtils_2.addMeasurement)({ ...widgetProps, ...{ propertyName: "measure" } });
                    }, {
                        initial: true
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; this?._appConfig?.measureOpenAtStart, () =&gt; {
                        (0, esriWidgetUtils_2.addMeasurement)({
                            ...widgetProps,
                            ...{ propertyName: "measureOpenAtStart" }
                        });
                    }, {
                        initial: true
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; this?._appConfig?.measurePosition, () =&gt; {
                        (0, esriWidgetUtils_2.addMeasurement)({
                            ...widgetProps,
                            ...{ propertyName: "measurePosition" }
                        });
                    }, {
                        initial: true
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; this?._appConfig?.coordinateFormats, () =&gt; {
                        (0, esriWidgetUtils_2.addMeasurement)({
                            ...widgetProps,
                            ...{ propertyName: "coordinateFormats" }
                        });
                    }, {
                        initial: true
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; this?._appConfig?.measureAreaUnit, () =&gt; {
                        (0, esriWidgetUtils_2.addMeasurement)({
                            ...widgetProps,
                            ...{ propertyName: "measureAreaUnit" }
                        });
                    }, {
                        initial: true
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; this?._appConfig?.measureLinearUnit, () =&gt; {
                        (0, esriWidgetUtils_2.addMeasurement)({
                            ...widgetProps,
                            ...{ propertyName: "measureLinearUnit" }
                        });
                    }, {
                        initial: true
                    }),
                    (0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.exportToPDF, () =&gt; {
                        (0, esriWidgetUtils_2.addExportPDF)({ ...widgetProps, ...{ propertyName: "exportToPDF" } });
                    }, { initial: true }),
                    (0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.exportButtonIcon, () =&gt; {
                        (0, esriWidgetUtils_2.addExportPDF)({ ...widgetProps, ...{ propertyName: "exportButtonIcon" } });
                    }, { initial: true }),
                    (0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.header, () =&gt; {
                        (0, esriWidgetUtils_2.addExportPDF)({ ...widgetProps, ...{ propertyName: "header" } });
                    }, { initial: true }),
                    ...this._languageSwitcher.getLanguageSwitcherHandles(widgetProps),
                    (0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.languageSwitcherPosition, () =&gt; {
                        const group = (0, utils_1.getPosition)(this._appConfig?.languageSwitcherPosition);
                        this._languageSwitcher.setExpandGroup(group);
                    }, { initial: true })
                ], this?._appConfig?.localeSwitcher ? "" : "configuration");
                const shell = layout.calciteShell;
                this._handles.add((0, reactiveUtils_1.watch)(() =&gt; [view.resizing], () =&gt; {
                    this.createPanel(view, shell);
                }, { initial: true }));
            });
        }
        _openPopup(view, e) {
            if (!view)
                return;
            const location = view.toMap(e);
            try {
                if (!location &amp;&amp; view)
                    return;
                view.popup.open({
                    updateLocationEnabled: false,
                    location,
                    view,
                    fetchFeatures: true
                });
                (0, popupUtils_1.updatePopup)(view);
            }
            catch (error) { }
        }
        _isHoverMobile() {
            return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ? true : false;
        }
        _addTitle() {
            let { title } = this._appConfig;
            const map = this?.view?.map;
            if (!title) {
                title = this?._base?.results?.applicationItem?.value?.title
                    ? this?._base?.results?.applicationItem?.value?.title
                    : map?.portalItem?.title;
            }
            this._appConfig.title = title;
            (0, domHelper_1.setPageTitle)(title);
            this._handles.add((0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.title, domHelper_1.setPageTitle, { initial: true }), "configuration");
        }
        _handlePopupBehavior(view) {
            //enable browse features for clusters
            view.popup = new Popup_1.default();
            if (view?.popup?.viewModel)
                view.popup.viewModel.browseClusterEnabled = view?.popup?.viewModel?.selectedFeature?.isAggregate;
            this._handles.add((0, reactiveUtils_1.watch)(() =&gt; [this._appConfig?.popupHover, this._appConfig?.popupPanel], () =&gt; {
                const { popupHover, popupPanel } = this._appConfig;
                if (!popupHover) {
                    if (this?._handles) {
                        this._handles.remove("popupHover");
                    }
                    (0, popupUtils_1.updatePopup)(view);
                }
                else if (popupHover &amp;&amp; !popupPanel) {
                    (0, popupUtils_1.findPopupAction)(view, "popup-hover-action");
                    if (popupHover) {
                        const popupHoverAction = {
                            id: "popup-hover-action",
                            image: "./assets/pushpin.png",
                            title: this._appConfig.appBundle.hoverPopupTip,
                            visible: true
                        };
                        view.popup.actions.add(popupHoverAction);
                        (0, intl_1.onLocaleChange)((e) =&gt; {
                            view?.popup?.actions?.forEach((action) =&gt; {
                                if (action?.id === "popup-hover-action") {
                                    t9nUtils_1.autoUpdatedStrings.add({
                                        obj: action,
                                        property: "title",
                                        bundleName: this.bundleName,
                                        key: "hoverPopupTip"
                                    });
                                }
                            });
                        });
                    }
                    // create the handle
                    const popup = view?.popup || new Popup_1.default();
                    popup.visibleElements = { spinner: false };
                    view.popupEnabled = false;
                    popup.defaultPopupTemplateEnabled = true;
                    let lastHitTest;
                    let click = false;
                    this._handles.add(view.on("pointer-move", (0, promiseUtils_2.debounce)((e) =&gt; {
                        if (view.popupEnabled === true) {
                            return;
                        }
                        if (lastHitTest)
                            clearTimeout(lastHitTest);
                        // if they click let's open popup and stop hover
                        this._handles.add(view.on("click", () =&gt; {
                            view.popupEnabled = true;
                            click = true;
                            (0, popupUtils_1.updatePopup)(view);
                            (0, reactiveUtils_1.whenOnce)(() =&gt; popup?.visible === false).then(() =&gt; {
                                if (popupHover) {
                                    view.popupEnabled = false;
                                    click = false;
                                }
                            });
                        }), "popupHover");
                        lastHitTest = setTimeout(() =&gt; {
                            if (!click &amp;&amp; !this?._appConfig?.measuring)
                                this._openPopup(view, e);
                        }, 100);
                    })), "popupHover");
                    (0, reactiveUtils_1.watch)(() =&gt; view.popup?.selectedFeature, () =&gt; {
                        (0, popupUtils_1.updatePopup)(view);
                    }, { initial: true });
                }
            }, { initial: true }), "configuration");
        }
        createPanel(view, shell) {
            const props = {
                applicationConfig: this._appConfig,
                applicationBase: this._base,
                view
            };
            const width = window.innerWidth;
            // Mobile Panel Creation
            if (width &lt;= 700) {
                if (shell?.contains(this._mobilePanel?.container)) {
                    return;
                }
                if (!this._mobilePanel) {
                    const container = document.createElement("div");
                    container.classList.add("mobile-shell-panel");
                    this._mobilePanel = new MobilePanel_1.default({
                        ...props,
                        container
                    });
                }
                this.updatePanel("mobile", shell);
            }
            else {
                // If already desktop return
                if (shell?.contains(this._panel?.container))
                    return;
                if (!this._panel) {
                    const container = document.createElement("calcite-shell-panel");
                    container.classList.add("desktop-shell-panel");
                    this._panel = new Panel_1.default({
                        ...props,
                        container
                    });
                }
                this.updatePanel("desktop", shell);
            }
        }
        updatePanel(type, shell) {
            const panelToAdd = type === "mobile" ? this._mobilePanel : this._panel;
            const panelToRemove = type === "mobile" ? this._panel : this._mobilePanel;
            if (!shell?.contains(panelToAdd?.container))
                shell.appendChild(panelToAdd.container);
            if (shell?.contains(panelToRemove?.container))
                shell.removeChild(panelToRemove.container);
        }
        async updateAppTheme(theme) {
            const style = document.getElementById("esri-stylesheet");
            style.href =
                style.href.indexOf("light") !== -1 ? style.href.replace(/light/g, theme) : style.href.replace(/dark/g, theme);
            // toggle calcite light/dark class
            const inverseTheme = theme === "light" ? "dark" : "light";
            const container = document.getElementById("appContainer");
            container.classList.add(`calcite-mode-${theme}`);
            const elements = document.getElementsByClassName(`calcite-mode-${inverseTheme}`);
            for (let i = 0; i &lt; elements.length; i++) {
                const node = elements[i];
                node.classList.remove(`calcite-mode-${inverseTheme}`);
                node.classList.add(`calcite-mode-${theme}`);
            }
            this?.view?.when(() =&gt; {
                const uiDiv = document.getElementsByClassName("esri-ui")[0];
                uiDiv?.classList.add(`calcite-mode-${theme}`);
                uiDiv?.classList.remove(`calcite-mode-${inverseTheme}`);
            });
        }
        handleExtentChanges(view) {
            // IGNORE INITIAL EXTENT IF SEARCH PARAMS ARE PRESENT
            const searchParams = new URL(window.location.href)?.searchParams;
            const center = searchParams?.get("center");
            const zoom = searchParams?.get("level");
            if (this._appConfig?.extentSelector &amp;&amp; this._appConfig.extentSelectorConfig &amp;&amp; this._appConfig?.mapArea) {
                const constraints = this._appConfig?.extentSelectorConfig?.constraints || null;
                const geometry = constraints?.geometry;
                if (geometry) {
                    const extent = (0, jsonUtils_1.fromJSON)(geometry);
                    if (extent &amp;&amp; (extent?.type === "extent" || extent?.type === "polygon")) {
                        constraints.geometry = extent;
                        if (!center &amp;&amp; !zoom &amp;&amp; !this._appConfig?.mapArea) {
                            view.goTo(extent, { animate: false }).catch(() =&gt; { });
                        }
                    }
                    else {
                        constraints.geometry = null;
                    }
                }
                constraints.minScale = +constraints.minScale;
                constraints.maxScale = +constraints.maxScale;
                view.constraints = constraints;
                this._setMapViewRotation(view);
            }
            else {
                if (this._initialExtent) {
                    if (!center &amp;&amp; !zoom) {
                        view.goTo(this._initialExtent, { animate: false }).catch();
                    }
                }
            }
        }
        handleThemeUpdates() {
            if (!this._appConfig.theme) {
                this._appConfig.theme = window.matchMedia("(prefers-color-scheme: dark)") ? "dark" : "light";
            }
            this._handles.add[((0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.theme, this.updateAppTheme, { initial: true }),
                (0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.panelSize, () =&gt; {
                    const panelSize = this._appConfig.panelSize;
                    document.body.classList.remove("panel-m");
                    document.body.classList.contains("panel-l");
                    document.body.classList.contains("panel-s");
                    document.body.classList.add(`panel-${panelSize}`);
                }, { initial: true }),
                (0, reactiveUtils_1.watch)(() =&gt; this._appConfig?.customCSS, () =&gt; {
                    this._handleCustomCSS();
                }, { initial: true }),
                "configuration")];
        }
        async createTelemetry() {
            // add alert to container
            const { portal } = this._base;
            const appName = this._base.config?.telemetry?.name;
            const telemTS = new telemetry_1.default({
                portal,
                config: this._appConfig,
                messages: {
                    optIn: this._appConfig?.bundle?.analyticsOptIn
                },
                appName
            });
            (0, reactiveUtils_1.whenOnce)(() =&gt; telemTS.instance !== undefined).then(() =&gt; {
                if (telemTS?.instance != null) {
                    this._telemetry = telemTS.instance;
                    this._telemetry?.logPageView(`${window.location.pathname}${window.location.search}`);
                }
            });
        }
        _handleCustomCSS() {
            const customCSSStyleSheet = document.getElementById("customCSS");
            if (customCSSStyleSheet) {
                customCSSStyleSheet.remove();
            }
            const styles = document.createElement("style");
            styles.id = "customCSS";
            const styleTextNode = document.createTextNode(this._appConfig.customCSS);
            styles.appendChild(styleTextNode);
            document.head.appendChild(styles);
        }
        _setMapViewRotation(view) {
            const mapRotation = this._appConfig?.extentSelectorConfig?.mapRotation ?? this._initialRotation ?? null;
            if (!view?.constraints?.rotationEnabled) {
                // if rotation is disabled
                view.constraints.rotationEnabled = true; // set rotation to enabled
                view.rotation = mapRotation; // set rotation value
                view.constraints.rotationEnabled = false; // set rotation back to disabled
            }
            else {
                if (view)
                    view.rotation = mapRotation;
            }
        }
        _setupPositioning(view, config) {
            let positionKeyLookup = new Map();
            positionKeyLookup.set("exportPDF", "exportToPDF");
            positionKeyLookup.set("shareMap", "share");
            positionKeyLookup.set("esri-language-switcher", "languageSwitcher");
            positionKeyLookup.set("esri-fullscreen", "fullScreen");
            positionKeyLookup.set("searchExpand", "search");
            positionKeyLookup.set("infoExpand", "info");
            positionKeyLookup.set("esri-zoom", "mapZoom");
            positionKeyLookup.set("esri-scale-bar", "scalebar");
            positionKeyLookup.set("esri-searchExpand", "search");
            positionKeyLookup.set("esri-compass", "compassWidget");
            positionKeyLookup.set("esri-home", "home");
            positionKeyLookup.set("esri-locate", "locateWidget");
            positionKeyLookup.set("esri-instant-apps-keyboard-shortcuts", "keyboardShortcuts");
            positionKeyLookup.set("basemapWidget", "basemapToggle");
            positionKeyLookup.set("measureExpand", "measure");
            (0, positionManager_1.assertWidgetOrdering)(view, config, positionKeyLookup, false);
        }
    }
    __decorate([
        (0, decorators_1.property)()
    ], Sidebar.prototype, "bundleName", void 0);
    return Sidebar;
});
</pre></body></html>