<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/widgets/support/widget", "esri/core/accessorSupport/decorators", "esri/widgets/Widget", "ArcGISHTMLSanitizer", "TemplatesCommonLib/functionality/securityUtils", "../utilites/utils"], function (require, exports, widget_1, decorators_1, Widget_1, ArcGISHTMLSanitizer, securityUtils_1, utils_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    Widget_1 = __importDefault(Widget_1);
    const CSS = {
        base: "accordion",
        basejs: "js-accordion",
        single: "single",
        directions: "directions-button",
        section: "accordion-section",
        active: "is-active",
        title: "accordion-title",
        titleArea: "title-area",
        count: "accordion-count",
        content: "accordion-content",
        button: "btn",
        messageText: "message-text",
        transparentButton: "btn-transparent",
        smallButton: "btn-small",
        accordionIcon: "accordion-icon",
        paddingTrailer: "padding-right-quarter",
        left: "left",
        actions: "accordion-actions",
        templateContent: "template"
    };
    let Accordion = class Accordion extends Widget_1.default {
        constructor(params, parentNode) {
            super(params);
            // Variables
            this._calciteLoaded = false;
            // Properties
            this.selectedItem = null;
            this.messages = null;
            this._sanitizer = null;
        }
        postInitialize() {
            this._sanitizer = (0, securityUtils_1.createSanitizerInstance)(ArcGISHTMLSanitizer);
        }
        createPostText() {
            const message = (0, utils_1.substituteLinkPlaceholders)(this?.config?.resultsPanelPostText, this.view);
            return ((0, widget_1.tsx)("p", { key: "postText", id: "postText", class: CSS.messageText, innerHTML: this._sanitizer.sanitize(message) }));
        }
        createPreText() {
            const message = (0, utils_1.substituteLinkPlaceholders)(this?.config?.resultsPanelPreText, this.view);
            return ((0, widget_1.tsx)("p", { key: "preText", id: "preText", class: CSS.messageText, innerHTML: this._sanitizer.sanitize(message) }));
        }
        checkContent(feature) {
            const content = feature.viewModel.content;
            if (Array.isArray(content)) {
                if (content.length &gt; 0 &amp;&amp; content[0] &amp;&amp; content[0].type === "fields") {
                    let fieldType;
                    const empty = content.every((c) =&gt; {
                        if (c.type === "fields") {
                            fieldType = c;
                            return fieldType?.fieldInfos?.length === 0 ? true : false;
                        }
                        else if (c.type === "attachments") {
                            fieldType = c;
                            return !fieldType.attachmentInfos ? true : false;
                        }
                        else if (c.type === "media") {
                            fieldType = c;
                            return fieldType.mediaInfos.length === 0 ? true : false;
                        }
                        else if (c.type === "text") {
                            fieldType = c;
                            return !fieldType.text || fieldType.text === "" ? true : false;
                        }
                        else {
                            return false;
                        }
                    });
                    return empty;
                }
            }
            else {
                return null;
            }
        }
        createActionItem(item, graphic) {
            const { theme } = this.config;
            let themeClass = theme === "dark" ? "calcite-mode-dark" : "calcite-mode-light";
            const { id, icon, name, tip } = item;
            return ((0, widget_1.tsx)("calcite-action", { key: id, icon: icon, appearance: "solid", onclick: (e) =&gt; this.actionItemClick(e, graphic, item), title: tip ? tip : name, text: name, textEnabled: false, class: this.classes(CSS.directions, CSS.left, themeClass, id === "zoomToAction" ? "zoom-action" : "") }));
        }
        actionItemClick(button, graphic, item) {
            item.handleClick(button, item.id, graphic);
        }
        convertUnitText(distance, units) {
            let unit = this.messages.units[units];
            unit = unit ? unit.abbr : "mi";
            return this._sanitizer.sanitize(`&lt;span class="distance right" title=""&gt;
        (${distance} ${unit})&lt;/span&gt;`);
        }
    };
    __decorate([
        (0, decorators_1.property)()
    ], Accordion.prototype, "selectedItem", void 0);
    __decorate([
        (0, decorators_1.property)()
    ], Accordion.prototype, "actionBarItems", void 0);
    __decorate([
        (0, decorators_1.property)()
    ], Accordion.prototype, "view", void 0);
    __decorate([
        (0, decorators_1.property)()
    ], Accordion.prototype, "config", void 0);
    __decorate([
        (0, decorators_1.property)(),
        (0, widget_1.messageBundle)("lookup/app/t9n/common")
    ], Accordion.prototype, "messages", void 0);
    Accordion = __decorate([
        (0, decorators_1.subclass)("esri.widgets.Accordion")
    ], Accordion);
    exports.default = Accordion;
});
</pre></body></html>