import { a as D, N as $, e as d, x as s, H as A, T as u, M as E, b as H, t as C, Q as J, V as P, I as S } from "./copilot-ppBO0zjz.js"; import { r as I } from "./state-B-CMA1Q2.js"; import { B as R } from "./base-panel-vYmwbGFU.js"; import { showNotification as V } from "./copilot-notification-BorVW3EP.js"; import { i as _ } from "./icons-BzskfjAz.js"; const O = "copilot-info-panel{--dev-tools-red-color: red;--dev-tools-grey-color: gray;--dev-tools-green-color: green;position:relative}copilot-info-panel div.info-tray{display:flex;flex-direction:column;gap:10px}copilot-info-panel dl{display:grid;grid-template-columns:auto auto;gap:0;margin:var(--space-100) var(--space-50);font:var(--font-xsmall)}copilot-info-panel dl>dt,copilot-info-panel dl>dd{padding:3px 10px;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}copilot-info-panel dd.live-reload-status>span{overflow:hidden;text-overflow:ellipsis;display:block;color:var(--status-color)}copilot-info-panel dd span.hidden{display:none}copilot-info-panel dd span.true{color:var(--dev-tools-green-color);font-size:large}copilot-info-panel dd span.false{color:var(--dev-tools-red-color);font-size:large}copilot-info-panel code{white-space:nowrap;-webkit-user-select:all;user-select:all}copilot-info-panel .checks{display:inline-grid;grid-template-columns:auto 1fr;gap:var(--space-50)}copilot-info-panel span.hint{font-size:var(--font-size-0);background:var(--gray-50);padding:var(--space-75);border-radius:var(--radius-2)}"; var j = function() { var e = document.getSelection(); if (!e.rangeCount) return function() { }; for (var t = document.activeElement, a = [], l = 0; l < e.rangeCount; l++) a.push(e.getRangeAt(l)); switch (t.tagName.toUpperCase()) { case "INPUT": case "TEXTAREA": t.blur(); break; default: t = null; break; } return e.removeAllRanges(), function() { e.type === "Caret" && e.removeAllRanges(), e.rangeCount || a.forEach(function(i) { e.addRange(i); }), t && t.focus(); }; }, U = j, v = { "text/plain": "Text", "text/html": "Url", default: "Text" }, T = "Copy to clipboard: #{key}, Enter"; function L(e) { var t = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C"; return e.replace(/#{\s*key\s*}/g, t); } function N(e, t) { var a, l, i, o, r, n, h = !1; t || (t = {}), a = t.debug || !1; try { i = U(), o = document.createRange(), r = document.getSelection(), n = document.createElement("span"), n.textContent = e, n.ariaHidden = "true", n.style.all = "unset", n.style.position = "fixed", n.style.top = 0, n.style.clip = "rect(0, 0, 0, 0)", n.style.whiteSpace = "pre", n.style.webkitUserSelect = "text", n.style.MozUserSelect = "text", n.style.msUserSelect = "text", n.style.userSelect = "text", n.addEventListener("copy", function(c) { if (c.stopPropagation(), t.format) if (c.preventDefault(), typeof c.clipboardData > "u") { a && console.warn("unable to use e.clipboardData"), a && console.warn("trying IE specific stuff"), window.clipboardData.clearData(); var m = v[t.format] || v.default; window.clipboardData.setData(m, e); } else c.clipboardData.clearData(), c.clipboardData.setData(t.format, e); t.onCopy && (c.preventDefault(), t.onCopy(c.clipboardData)); }), document.body.appendChild(n), o.selectNodeContents(n), r.addRange(o); var x = document.execCommand("copy"); if (!x) throw new Error("copy command was unsuccessful"); h = !0; } catch (c) { a && console.error("unable to copy using execCommand: ", c), a && console.warn("trying IE specific stuff"); try { window.clipboardData.setData(t.format || "text", e), t.onCopy && t.onCopy(window.clipboardData), h = !0; } catch (m) { a && console.error("unable to copy using clipboardData: ", m), a && console.error("falling back to prompt"), l = L("message" in t ? t.message : T), window.prompt(l, e); } } finally { r && (typeof r.removeRange == "function" ? r.removeRange(o) : r.removeAllRanges()), n && document.body.removeChild(n), i(); } return h; } var B = N; const M = /* @__PURE__ */ D(B); var F = Object.defineProperty, W = Object.getOwnPropertyDescriptor, g = (e, t, a, l) => { for (var i = l > 1 ? void 0 : l ? W(t, a) : t, o = e.length - 1, r; o >= 0; o--) (r = e[o]) && (i = (l ? r(t, a, i) : r(i)) || i); return l && i && F(t, a, i), i; }; const w = s`Get IntelliJ plugin`, b = s`Get VS Code plugin`; function k(e) { return S("get-plugin", e), !1; } let f = class extends R { constructor() { super(...arguments), this.serverInfo = [], this.clientInfo = [{ name: "Browser", version: navigator.userAgent }], this.handleServerInfoEvent = (e) => { const t = JSON.parse(e.data.info); this.serverInfo = t.versions, this.updateJdkInfo(t.jdkInfo), this.updateIdePluginInfo(), $().then((a) => { a && (this.clientInfo.unshift({ name: "Vaadin Employee", version: "true", more: void 0 }), this.requestUpdate("clientInfo")); }); }; } connectedCallback() { super.connectedCallback(), this.onCommand("copilot-info", this.handleServerInfoEvent), this.onEventBus("system-info-with-callback", (e) => { e.detail.callback(this.getInfoForClipboard(e.detail.notify)); }), this.reaction( () => d.idePluginState, () => { this.updateIdePluginInfo(), this.requestUpdate("serverInfo"); } ); } updateJdkInfo(e) { const t = e.extendedClassDefCapable && e.runningWithExtendClassDef && e.hotswapAgentFound && e.runningWitHotswap && e.hotswapVersionOk, a = e.jrebel; d.jdkInfo = { ...e, activeHotswap: a ? "jrebel" : t ? "hotswapagent" : void 0 }; } updateIdePluginInfo() { const e = this.getIndex("Copilot IDE Plugin"); let t = "false", a; d.idePluginState?.active ? t = `${d.idePluginState.version}-${d.idePluginState.ide}` : d.idePluginState?.ide === "vscode" ? a = b : d.idePluginState?.ide === "idea" ? a = w : a = s`${w} or ${b}`, this.serverInfo[e].version = t, this.serverInfo[e].more = a; } getIndex(e) { return this.serverInfo.findIndex((t) => t.name === e); } render() { return s`
${[...this.serverInfo, ...this.clientInfo].map( (e) => s`
${e.name}
${this.renderVersion(e)} ${e.more}
` )}
`; } renderVersion(e) { return e.name === "Java Hotswap" ? this.renderJavaHotswap() : this.renderValue(e.version); } renderValue(e) { return e === "false" ? p(!1) : e === "true" ? p(!0) : e; } getInfoForClipboard(e) { const t = this.renderRoot.querySelectorAll(".info-tray dt"), i = Array.from(t).map((o) => ({ key: o.textContent.trim(), value: o.nextElementSibling.textContent.trim() })).filter((o) => o.key !== "Live reload").filter((o) => !o.key.startsWith("Vaadin Emplo")).map((o) => { const { key: r } = o; let { value: n } = o; return r === "Copilot IDE Plugin" && !d.idePluginState?.active ? n = "false" : r === "Java Hotswap" && (n = String(n.includes("JRebel is in use") || n.includes("HotswapAgent is in use"))), `${r}: ${n}`; }).join(` `); return e && V({ type: A.INFORMATION, message: "Environment information copied to clipboard", dismissId: "versionInfoCopied" }), i.trim(); } renderJavaHotswap() { const e = d.jdkInfo; if (!e) return u; const t = e.activeHotswap === "jrebel"; return !e.extendedClassDefCapable && !t ? s`
${p(!1)} No Hotswap solution in use

To enable hotswap for Java, you can either use HotswapAgent or JRebel.

HotswapAgent is an open source project that utilizes the JetBrains Runtime (JDK).

If you are running IntelliJ, edit the launch configuration to use the bundled JDK.
Otherwise, download it from the JetBrains release page to get started.

JRebel is a commercial solution available from jrebel.com

` : t ? s`
${p(!0)} JRebel is in use
` : e.activeHotswap === "hotswapagent" ? s`
${p(!0)}HotswapAgent is in use
` : s`
${p(!1)} HotswapAgent is partially enabled
${p(e.extendedClassDefCapable)} JDK supports hotswapping ${p(e.runningWithExtendClassDef)} JDK hotswapping enabled ${e.runningWithExtendClassDef ? u : s`Add the -XX:+AllowEnhancedClassRedefinition JVM argument when launching the application`} ${p(e.hotswapAgentFound)} HotswapAgent installed ${e.hotswapAgentFound ? u : s`Download the latest HotswapAgent and place it in ${e.hotswapAgentLocation}`} ${p(e.hotswapVersionOk)} HotswapAgent is version 1.4.2 or newer ${e.hotswapVersionOk ? u : s`HotswapAgent version ${e.hotswapVersion} is in use
Download the latest HotswapAgent and place it in ${e.hotswapAgentLocation}
`} ${p(e.runningWitHotswap)} HotswapAgent configured ${e.runningWitHotswap ? u : s`Add the -XX:HotswapAgent=fatjar JVM argument when launching the application`} ${p(e.runningInJavaDebugMode)} Application running in Java debug mode ${e.runningInJavaDebugMode ? u : s`Start the application in debug mode in the IDE`} Read more about Hot Deploy & Live Reload
`; } }; g([ I() ], f.prototype, "serverInfo", 2); g([ I() ], f.prototype, "clientInfo", 2); f = g([ C("copilot-info-panel") ], f); let y = class extends E { createRenderRoot() { return this; } connectedCallback() { super.connectedCallback(), this.style.display = "flex"; } render() { return s``; } }; y = g([ C("copilot-info-actions") ], y); const z = { header: "Info", expanded: !0, panelOrder: 15, panel: "right", floating: !1, tag: "copilot-info-panel", actionsTag: "copilot-info-actions" }, G = { init(e) { e.addPanel(z); } }; window.Vaadin.copilot.plugins.push(G); function p(e) { return e ? s`` : s``; } export { y as Actions, f as CopilotInfoPanel };