<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">/*
 *   Copyright (c) 2022 Esri
 *   All rights reserved.

 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at

 *   http://www.apache.org/licenses/LICENSE-2.0

 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */
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", "esri/core/accessorSupport/decorators", "esri/widgets/Widget", "../utilites/errorUtils", "esri/widgets/support/widget", "TemplatesCommonLib/baseClasses/support/itemUtils", "TemplatesCommonLib/structuralFunctionality/a11yUtils", "ArcGISHTMLSanitizer", "TemplatesCommonLib/functionality/securityUtils"], function (require, exports, decorators_1, Widget_1, errorUtils_1, widget_1, itemUtils_1, a11yUtils_1, ArcGISHTMLSanitizer_1, securityUtils_1) {
    "use strict";
    Widget_1 = __importDefault(Widget_1);
    ArcGISHTMLSanitizer_1 = __importDefault(ArcGISHTMLSanitizer_1);
    const CSS = {
        miniMap: {
            panel: "mini-map-panel"
        },
        configApp: "configurable-application__view-container",
        hide: "hide",
        theme: "app-header",
        btnOpenMap: "btn-open-map",
        appButton: "app-button",
        calciteStyles: {
            leader: "leader-0",
            trailer: "trailer-0",
            paddingLeft: "padding-left-0",
            paddingRight: "padding-right-0",
            right: "right",
            panel: "panel"
        }
    };
    let MapPanel = class MapPanel extends Widget_1.default {
        //--------------------------------------------------------------------------
        //
        //  Public Methods
        //
        //--------------------------------------------------------------------------
        initialize() {
            this._sanitizer = (0, securityUtils_1.createSanitizerInstance)(ArcGISHTMLSanitizer_1.default);
        }
        constructor(props) {
            super(props);
            this.selectedItemTitle = null;
            const { config } = props;
            this.config = config;
        }
        render() {
            return ((0, widget_1.tsx)("div", null,
                (0, widget_1.tsx)("div", { class: this.classes(CSS.configApp) },
                    (0, widget_1.tsx)("div", { bind: this, afterCreate: this._createMap }))));
        }
        async _createMap(container) {
            const portalItem = this.base.results.applicationItem.value;
            const appProxies = portalItem?.applicationProxies ? portalItem.applicationProxies : null;
            const defaultViewProperties = (0, itemUtils_1.getConfigViewProperties)(this.config);
            const components = ["attribution"];
            const mapContainer = {
                container
            };
            const viewProperties = {
                ...defaultViewProperties,
                ui: { components },
                ...mapContainer
            };
            try {
                const map = (await (0, itemUtils_1.createMapFromItem)({
                    item: this.item,
                    mapParams: { ground: "world-elevation" },
                    appProxies
                }));
                this.view = (await (0, itemUtils_1.createView)({
                    ...viewProperties,
                    map
                }));
                const ariadesc = (0, a11yUtils_1.getMapDescription)(this.config, this.view, portalItem);
                if (ariadesc) {
                    (0, a11yUtils_1.setMapDescription)(this.view, ariadesc, this._sanitizer);
                }
                if (!this.config.mapZoom) {
                    this.view.ui.remove("zoom");
                }
                this.view.highlightOptions.fillOpacity = 0;
                const handler = this.view.watch("extent", () =&gt; {
                    handler.remove();
                    this.initialExtent = this.view.extent.clone();
                });
            }
            catch (error) {
                const title = (this.item &amp;&amp; this.item.title) || " the application";
                (0, errorUtils_1.displayError)({ title: "Error", message: `Unable to load ${title} ` });
            }
        }
        resetExtent() {
            if (this.initialExtent) {
                this.view.goTo(this.initialExtent).catch(() =&gt; { });
            }
        }
    };
    __decorate([
        (0, decorators_1.property)()
    ], MapPanel.prototype, "base", void 0);
    __decorate([
        (0, decorators_1.property)()
    ], MapPanel.prototype, "item", void 0);
    __decorate([
        (0, decorators_1.property)()
    ], MapPanel.prototype, "config", void 0);
    __decorate([
        (0, decorators_1.property)()
    ], MapPanel.prototype, "view", void 0);
    __decorate([
        (0, decorators_1.property)()
    ], MapPanel.prototype, "selectedItemTitle", void 0);
    __decorate([
        (0, decorators_1.property)()
    ], MapPanel.prototype, "message", void 0);
    __decorate([
        (0, decorators_1.property)()
    ], MapPanel.prototype, "initialExtent", void 0);
    __decorate([
        (0, decorators_1.property)()
    ], MapPanel.prototype, "initialScale", void 0);
    __decorate([
        (0, decorators_1.property)()
    ], MapPanel.prototype, "initialRotation", void 0);
    MapPanel = __decorate([
        (0, decorators_1.subclass)("app.MapPanel")
    ], MapPanel);
    return MapPanel;
});
</pre></body></html>