// Goldmont Chatbot Core - injected from .txt (function () { // Avoid double init if (document.getElementById("gm-chatbot-root")) return; // ---------- CSS INJECTION ---------- const style = document.createElement("style"); style.textContent = ` :root { --gm-bg: #050816; --gm-panel: #0b101a; --gm-panel-soft: #111827; --gm-border-subtle: #1f2933; --gm-gold: #f4c15d; --gm-gold-soft: #f8d78a; --gm-ink: #f9fafb; --gm-muted: #9ca3af; --gm-error: #f87171; --gm-radius-lg: 18px; --gm-radius-pill: 999px; --gm-shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.55); --gm-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; } #gm-chatbot-root { position: fixed; inset: auto 20px 24px auto; z-index: 9999; font-family: var(--gm-font); color: var(--gm-ink); } #gm-chat-toggle { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: var(--gm-radius-pill); border: 1px solid rgba(244, 193, 93, 0.25); background: radial-gradient(circle at 0 0, rgba(244, 193, 93, 0.24), transparent 55%), #050816; color: var(--gm-gold-soft); box-shadow: var(--gm-shadow-soft); cursor: pointer; font-size: 18px; font-weight: 500; transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease; } #gm-chat-toggle:hover { transform: translateY(-1px); border-color: rgba(244, 193, 93, 0.6); box-shadow: 0 22px 55px rgba(0, 0, 0, 0.7); } #gm-chat-toggle:active { transform: translateY(0); box-shadow: var(--gm-shadow-soft); } .gm-toggle-icon { font-size: 22px; } .gm-toggle-label { white-space: nowrap; } .gm-chat-window { position: fixed; inset: auto 20px 90px auto; width: 540px; max-width: calc(100vw - 40px); background: linear-gradient(145deg, #050816 0%, #020617 35%, #050816 100%); border-radius: 22px; border: 1px solid rgba(148, 163, 184, 0.35); box-shadow: var(--gm-shadow-soft); display: none; flex-direction: column; overflow: hidden; } @media (max-width: 640px) { .gm-chat-window { inset: auto 10px 80px 10px; width: auto; } } .gm-chat-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 14px; border-bottom: 1px solid rgba(31, 41, 55, 0.9); background: radial-gradient(circle at 0 0, rgba(244, 193, 93, 0.14), transparent 55%); } .gm-chat-brand { display: flex; align-items: center; gap: 12px; } .gm-logo-circle { width: 42px; height: 42px; border-radius: 999px; border: 1px solid rgba(244, 193, 93, 0.6); display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 30% 10%, rgba(244, 193, 93, 0.3), #020617); font-size: 18px; letter-spacing: 0.06em; font-weight: 700; text-transform: uppercase; color: var(--gm-gold-soft); } .gm-brand-text { display: flex; flex-direction: column; } .gm-brand-title { font-size: 20px; font-weight: 600; color: var(--gm-ink); } .gm-brand-subtitle { font-size: 16px; color: var(--gm-muted); max-width: 320px; } .gm-close-btn { border: none; background: transparent; color: var(--gm-muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 6px 8px; border-radius: 999px; transition: background 0.15s ease, color 0.15s ease; } .gm-close-btn:hover { background: rgba(55, 65, 81, 0.6); color: var(--gm-ink); } .gm-chat-body { padding: 14px 16px 8px; max-height: 510px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(55, 65, 81, 0.8) transparent; } .gm-chat-body::-webkit-scrollbar { width: 8px; } .gm-chat-body::-webkit-scrollbar-track { background: transparent; } .gm-chat-body::-webkit-scrollbar-thumb { background-color: rgba(55, 65, 81, 0.9); border-radius: 999px; } .gm-message { margin-bottom: 14px; max-width: 92%; } .gm-message-meta { font-size: 15px; color: var(--gm-muted); margin-bottom: 6px; padding: 0 4px; } .gm-message-bubble { border-radius: 18px; padding: 12px 16px; font-size: 19px; line-height: 1.5; border: 1px solid rgba(31, 41, 55, 0.9); background: linear-gradient(135deg, #020617, #020617); color: var(--gm-ink); white-space: pre-wrap; word-wrap: break-word; } .gm-message-bot { display: flex; flex-direction: column; align-items: flex-start; } .gm-message-bot .gm-message-bubble { background: radial-gradient(circle at 0 0, rgba(244, 193, 93, 0.16), #020617); border-color: rgba(148, 163, 184, 0.5); } .gm-message-user { display: flex; flex-direction: column; align-items: flex-end; margin-left: auto; } .gm-message-user .gm-message-bubble { background: linear-gradient(135deg, #f4c15d, #f8d78a); color: #111827; border-color: rgba(248, 215, 138, 0.9); } .gm-typing-indicator { display: flex; align-items: center; gap: 8px; padding: 0 16px 8px; font-size: 16px; color: var(--gm-muted); } .gm-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--gm-muted); animation: gm-bounce 1s infinite ease-in-out; } .gm-dot:nth-child(2) { animation-delay: 0.15s; } .gm-dot:nth-child(3) { animation-delay: 0.3s; } .gm-typing-text { margin-left: 2px; } @keyframes gm-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.6; } 40% { transform: translateY(-4px); opacity: 1; } } .gm-chat-input-row { display: flex; align-items: flex-end; gap: 10px; padding: 10px 14px 14px; border-top: 1px solid rgba(31, 41, 55, 0.9); background: rgba(15, 23, 42, 0.96); } .gm-chat-input { flex: 1; resize: none; border-radius: 14px; border: 1px solid rgba(55, 65, 81, 0.9); background: rgba(15, 23, 42, 0.95); color: var(--gm-ink); font-size: 19px; padding: 9px 10px; max-height: 110px; outline: none; line-height: 1.5; } .gm-chat-input::placeholder { color: rgba(148, 163, 184, 0.9); } .gm-chat-input:focus { border-color: var(--gm-gold); box-shadow: 0 0 0 1px rgba(244, 193, 93, 0.4); } .gm-send-btn { border: none; border-radius: 999px; padding: 9px 18px; font-size: 19px; font-weight: 600; cursor: pointer; background: linear-gradient(135deg, #f4c15d, #f8d78a); color: #111827; display: flex; align-items: center; justify-content: center; white-space: nowrap; transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease; box-shadow: 0 8px 20px rgba(248, 215, 138, 0.35); } .gm-send-btn:hover { filter: brightness(1.03); transform: translateY(-0.5px); } .gm-send-btn:active { transform: translateY(0); box-shadow: 0 4px 12px rgba(248, 215, 138, 0.35); } .gm-send-btn:disabled { opacity: 0.6; cursor: default; box-shadow: none; } .gm-chat-footer { font-size: 15px; color: var(--gm-muted); padding: 6px 16px 12px; text-align: right; background: radial-gradient(circle at 100% 0, rgba(244, 193, 93, 0.16), transparent 45%); } .gm-chat-footer span { color: var(--gm-gold-soft); font-weight: 500; } `; document.head.appendChild(style); // ---------- HTML INJECTION ---------- const root = document.createElement("div"); root.id = "gm-chatbot-root"; root.innerHTML = `
GH
Goldmont Assistant
Questions on valuations, deals, or Goldmont?
Goldmont Assistant
Welcome. I can answer questions about Goldmont Holdings, valuations, deal structure, and our acquisition process. How can I help?
`; document.body.appendChild(root); // ---------- SIMPLE ANSWERING LAYER (optionally uses window.gmKnowledgeBase) ---------- const gmKB = window.gmKnowledgeBase || []; function gmFindBestAnswer(message) { const text = message.toLowerCase(); let best = null; let bestScore = 0; gmKB.forEach((item) => { let score = 0; (item.keywords || []).forEach((kw) => { if (text.includes(kw.toLowerCase())) score++; }); if (score > bestScore) { bestScore = score; best = item; } }); return bestScore > 0 ? best.answer : null; } async function sendMessageToBot(message, history) { const kbAnswer = gmFindBestAnswer(message); if (kbAnswer) return kbAnswer; return ( "Thanks for your question. I can help with topics like:\n" + "• How we think about valuation and structure\n" + "• What life looks like after closing for you and your team\n" + "• Our process, timeline, and due diligence approach\n" + "• Risk allocation, protections, and governance\n\n" + "Feel free to ask about anything on your mind as a seller—valuation, structure, people, or process." ); } // ---------- WIRE UP UI ---------- const toggleBtn = document.getElementById("gm-chat-toggle"); const chatWindow = root.querySelector(".gm-chat-window"); const closeBtn = root.querySelector(".gm-close-btn"); const bodyEl = root.querySelector(".gm-chat-body"); const formEl = root.querySelector(".gm-chat-input-row"); const inputEl = root.querySelector(".gm-chat-input"); const typingEl = root.querySelector(".gm-typing-indicator"); const sendBtn = root.querySelector(".gm-send-btn"); let isOpen = false; let isSending = false; const history = []; function openChat() { if (isOpen) return; chatWindow.style.display = "flex"; isOpen = true; inputEl.focus(); } function closeChat() { chatWindow.style.display = "none"; isOpen = false; } function scrollToBottom() { requestAnimationFrame(() => { bodyEl.scrollTop = bodyEl.scrollHeight; }); } function appendMessage(role, text) { const msg = document.createElement("div"); msg.className = "gm-message " + (role === "user" ? "gm-message-user" : "gm-message-bot"); const meta = document.createElement("div"); meta.className = "gm-message-meta"; meta.textContent = role === "user" ? "You" : "Goldmont Assistant"; const bubble = document.createElement("div"); bubble.className = "gm-message-bubble"; bubble.textContent = text; msg.appendChild(meta); msg.appendChild(bubble); bodyEl.appendChild(msg); scrollToBottom(); } function setTyping(isTyping) { typingEl.style.display = isTyping ? "flex" : "none"; scrollToBottom(); } function autoResizeTextarea() { inputEl.style.height = "auto"; inputEl.style.height = Math.min(inputEl.scrollHeight, 110) + "px"; } async function handleSubmit(event) { event.preventDefault(); if (isSending) return; const text = inputEl.value.trim(); if (!text) return; appendMessage("user", text); history.push({ role: "user", content: text }); inputEl.value = ""; autoResizeTextarea(); isSending = true; sendBtn.disabled = true; setTyping(true); try { const reply = await sendMessageToBot(text, history); history.push({ role: "assistant", content: reply }); setTyping(false); appendMessage("assistant", reply); } catch (err) { console.error("Goldmont Assistant error:", err); setTyping(false); appendMessage( "assistant", "Apologies — I ran into an issue while generating a reply. Please try again." ); } finally { isSending = false; sendBtn.disabled = false; } } toggleBtn.addEventListener("click", () => { if (isOpen) { closeChat(); } else { openChat(); } }); closeBtn.addEventListener("click", closeChat); formEl.addEventListener("submit", handleSubmit); inputEl.addEventListener("input", autoResizeTextarea); inputEl.addEventListener("keydown", (e) => { if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); formEl.dispatchEvent(new Event("submit", { cancelable: true, bubbles: true })); } }); })();