var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; import { icon } from "@mariozechner/mini-lit"; import "@mariozechner/mini-lit/dist/CopyButton.js"; import { html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators.js"; import { createRef, ref } from "lit/directives/ref.js"; import { repeat } from "lit/directives/repeat.js"; import { ChevronDown, ChevronRight, ChevronsDown, Lock } from "lucide"; import { i18n } from "../../utils/i18n.js"; let Console = class Console extends LitElement { constructor() { super(...arguments); this.logs = []; this.expanded = false; this.autoscroll = true; this.logsContainerRef = createRef(); } createRenderRoot() { return this; // light DOM } updated() { // Autoscroll to bottom when new logs arrive if (this.autoscroll && this.expanded && this.logsContainerRef.value) { this.logsContainerRef.value.scrollTop = this.logsContainerRef.value.scrollHeight; } } getLogsText() { return this.logs.map((l) => `[${l.type}] ${l.text}`).join("\n"); } render() { const errorCount = this.logs.filter((l) => l.type === "error").length; const summary = errorCount > 0 ? `${i18n("console")} (${errorCount} ${errorCount === 1 ? "error" : "errors"})` : `${i18n("console")} (${this.logs.length})`; return html `