// Copyright 2026 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import '//resources/cr_elements/cr_icon/cr_icon.js';
import '//resources/cr_elements/cr_collapse/cr_collapse.js';
import '//resources/cr_elements/cr_expand_button/cr_expand_button.js';
import { assert } from '//resources/js/assert.js';
import { CrLitElement } from '//resources/lit/v3_0/lit.rollup.js';
import { localizeScope } from './event_history.js';
import { getHtml } from './scope_icon.html.js';
export class ScopeIconElement extends CrLitElement {
    static get is() {
        return 'scope-icon';
    }
    render() {
        return getHtml.bind(this)();
    }
    static get properties() {
        return {
            scope: { type: String },
            icon: { type: String },
            label: { type: String },
        };
    }
    #scope_accessor_storage = undefined;
    get scope() { return this.#scope_accessor_storage; }
    set scope(value) { this.#scope_accessor_storage = value; }
    #icon_accessor_storage = undefined;
    get icon() { return this.#icon_accessor_storage; }
    set icon(value) { this.#icon_accessor_storage = value; }
    #label_accessor_storage = undefined;
    get label() { return this.#label_accessor_storage; }
    set label(value) { this.#label_accessor_storage = value; }
    willUpdate(changedProperties) {
        super.willUpdate(changedProperties);
        if (changedProperties.has('scope')) {
            this.icon = this.computeIcon();
            this.label = this.computeLabel();
        }
    }
    computeIcon() {
        assert(this.scope !== undefined);
        return this.scope === 'SYSTEM' ? 'cr:computer' : 'cr:person';
    }
    computeLabel() {
        assert(this.scope !== undefined);
        return localizeScope(this.scope);
    }
}
customElements.define(ScopeIconElement.is, ScopeIconElement);
