import { G as c, l as k, H as d, x as l, J as M, K as R, M as D, b as T, L as C, t as x } from "./copilot-ppBO0zjz.js"; import { r as v } from "./state-B-CMA1Q2.js"; import { B as L } from "./base-panel-vYmwbGFU.js"; import { i as n } from "./icons-BzskfjAz.js"; const S = "copilot-log-panel{padding:var(--space-100);font:var(--font-xsmall);display:flex;flex-direction:column;gap:var(--space-50);overflow-y:auto}copilot-log-panel .row{display:flex;align-items:flex-start;padding:var(--space-50) var(--space-100);border-radius:var(--radius-2);gap:var(--space-100)}copilot-log-panel .row.information{background-color:var(--blue-50)}copilot-log-panel .row.warning{background-color:var(--yellow-50)}copilot-log-panel .row.error{background-color:var(--red-50)}copilot-log-panel .type{margin-top:var(--space-25)}copilot-log-panel .type.error{color:var(--red)}copilot-log-panel .type.warning{color:var(--yellow)}copilot-log-panel .type.info{color:var(--color)}copilot-log-panel .message{display:flex;flex-direction:column;flex-grow:1;gap:var(--space-25);overflow:hidden}copilot-log-panel .message>*{white-space:nowrap}copilot-log-panel .firstrow{display:flex;align-items:baseline;gap:.5em;flex-direction:column}copilot-log-panel .firstrowmessage{width:100%}copilot-log-panel button{padding:0;border:0;background:transparent}copilot-log-panel svg{height:12px;width:12px}copilot-log-panel .secondrow,copilot-log-panel .timestamp{font-size:var(--font-size-0);line-height:var(--line-height-1)}copilot-log-panel .expand span{height:12px;width:12px}"; var I = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, h = (e, t, a, o) => { for (var s = o > 1 ? void 0 : o ? _(t, a) : t, p = e.length - 1, i; p >= 0; p--) (i = e[p]) && (s = (o ? i(t, a, s) : i(s)) || s); return o && s && I(t, a, s), s; }; class b { constructor() { this.showTimestamps = !1, C(this); } toggleShowTimestamps() { this.showTimestamps = !this.showTimestamps; } } const g = new b(); let r = class extends L { constructor() { super(), this.unreadErrors = !1, this.messages = [], this.nextMessageId = 1, this.transitionDuration = 0, this.catchErrors(); } connectedCallback() { super.connectedCallback(), this.onCommand("log", (e) => { this.handleLogEventData({ type: e.data.type, message: e.data.message }); }), this.onEventBus("log", (e) => this.handleLogEvent(e)), this.onEventBus("update-log", (e) => this.updateLog(e.detail)), this.onEventBus("notification-shown", (e) => this.handleNotification(e)), this.onEventBus("clear-log", () => this.clear()), this.transitionDuration = parseInt( window.getComputedStyle(this).getPropertyValue("--dev-tools-transition-duration"), 10 ); } clear() { this.messages = []; } handleNotification(e) { this.log(e.detail.type, e.detail.message, !0, e.detail.details, e.detail.link, void 0); } handleLogEvent(e) { this.handleLogEventData(e.detail); } handleLogEventData(e) { this.log( e.type, e.message, !!e.internal, e.details, e.link, c(e.expandedMessage), c(e.expandedDetails), e.id ); } activate() { this.unreadErrors = !1, this.updateComplete.then(() => { const e = this.renderRoot.querySelector(".message:last-child"); e && e.scrollIntoView(); }); } format(e) { return e.message ? e.message.toString() : e.toString(); } catchErrors() { const e = window.Vaadin.ConsoleErrors; window.Vaadin.ConsoleErrors = { push: (t) => { k.attentionRequiredPanelTag = y.tag, t[0].type !== void 0 && t[0].message !== void 0 ? this.log(t[0].type, t[0].message, !!t[0].internal, t[0].details, t[0].link) : this.log(d.ERROR, t.map((a) => this.format(a)).join(" "), !1), e.push(t); } }; } render() { return l` ${this.messages.map((e) => this.renderMessage(e))} `; } renderMessage(e) { let t, a, o; return e.type === d.ERROR ? (t = "error", o = n.exclamationMark, a = "Error") : e.type === d.WARNING ? (t = "warning", o = n.warning, a = "Warning") : (t = "info", o = n.info, a = "Info"), e.internal && (t += " internal"), l`