(function () { 'use strict'; // ── inject styles ───────────────────────────────────────────────────────── const style = document.createElement('style'); style.textContent = ` #cb-fab{ position:fixed;bottom:24px;right:24px;z-index:9999; width:52px;height:52px;border-radius:50%;border:none;cursor:pointer; background:linear-gradient(135deg,#047e7e,#065f46); box-shadow:0 4px 16px rgba(4,126,126,.45); display:flex;align-items:center;justify-content:center; transition:transform .2s,box-shadow .2s; } #cb-fab:hover{transform:scale(1.08);box-shadow:0 6px 20px rgba(4,126,126,.6)} #cb-fab svg{width:26px;height:26px;fill:#fff} #cb-fab .cb-badge{ position:absolute;top:-3px;right:-3px; background:#ef4444;color:#fff;font-size:10px;font-weight:700; border-radius:50%;width:18px;height:18px; display:none;align-items:center;justify-content:center; } #cb-panel{ position:fixed;bottom:84px;right:24px;z-index:9998; width:420px;height:540px;border-radius:16px; background:#fff;box-shadow:0 8px 40px rgba(0,0,0,.18); display:flex;flex-direction:column;overflow:hidden; transform:scale(.85) translateY(20px);opacity:0;pointer-events:none; transition:transform .22s cubic-bezier(.34,1.56,.64,1),opacity .18s; } #cb-panel.cb-open{transform:scale(1) translateY(0);opacity:1;pointer-events:all} #cb-header{ background:linear-gradient(135deg,#047e7e,#065f46); padding:14px 16px;display:flex;align-items:center;gap:10px;flex-shrink:0; } #cb-header .cb-avatar{ width:36px;height:36px;border-radius:50%;background:rgba(255,255,255,.2); display:flex;align-items:center;justify-content:center;flex-shrink:0; } #cb-header .cb-avatar svg{width:20px;height:20px;fill:#fff} #cb-header .cb-info{flex:1;min-width:0} #cb-header .cb-name{font-size:14px;font-weight:700;color:#fff;letter-spacing:.2px} #cb-header .cb-status{font-size:11px;color:rgba(255,255,255,.75);display:flex;align-items:center;gap:4px} #cb-header .cb-dot{width:7px;height:7px;border-radius:50%;background:#4ade80} #cb-close{ background:none;border:none;cursor:pointer;padding:4px; color:rgba(255,255,255,.8);border-radius:6px;line-height:0; transition:background .15s; } #cb-close:hover{background:rgba(255,255,255,.15);color:#fff} #cb-close svg{width:18px;height:18px;fill:currentColor} #cb-msgs{ flex:1;overflow-y:auto;padding:14px 14px 6px; display:flex;flex-direction:column;gap:8px; scroll-behavior:smooth; } #cb-msgs::-webkit-scrollbar{width:4px} #cb-msgs::-webkit-scrollbar-thumb{background:#d1dae3;border-radius:4px} .cb-msg{display:flex;gap:8px;align-items:flex-end;max-width:100%} .cb-msg.cb-user{flex-direction:row-reverse} .cb-bubble{ padding:8px 12px;border-radius:14px;font-size:13px;line-height:1.5; max-width:82%;word-break:break-word;white-space:pre-wrap; } .cb-msg.cb-bot .cb-bubble{background:#f0f4f8;color:#1a1a2e;border-bottom-left-radius:4px} .cb-msg.cb-user .cb-bubble{background:linear-gradient(135deg,#047e7e,#065f46);color:#fff;border-bottom-right-radius:4px} .cb-msg-avatar{ width:28px;height:28px;border-radius:50%;flex-shrink:0; display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700; } .cb-msg.cb-bot .cb-msg-avatar{background:#e0f4f4;color:#047e7e} .cb-msg.cb-user .cb-msg-avatar{background:#065f46;color:#fff} .cb-typing{display:flex;gap:5px;padding:10px 14px;align-items:center} .cb-typing span{ width:7px;height:7px;border-radius:50%;background:#9ca3af; animation:cb-bounce .9s infinite; } .cb-typing span:nth-child(2){animation-delay:.15s} .cb-typing span:nth-child(3){animation-delay:.3s} @keyframes cb-bounce{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-6px)}} #cb-footer{ padding:10px 12px;border-top:1px solid #f0f2f4;flex-shrink:0; display:flex;gap:8px;align-items:flex-end;background:#fff; } #cb-input{ flex:1;border:1.5px solid #e8eaed;border-radius:12px; padding:9px 12px;font-size:13px;font-family:inherit;color:#1a1a2e; resize:none;max-height:100px;overflow-y:auto;outline:none; transition:border-color .15s;line-height:1.4; } #cb-input:focus{border-color:#047e7e} #cb-input::placeholder{color:#9ca3af} #cb-send{ width:38px;height:38px;border-radius:10px;border:none;cursor:pointer; background:linear-gradient(135deg,#047e7e,#065f46); display:flex;align-items:center;justify-content:center;flex-shrink:0; transition:opacity .15s,transform .1s; } #cb-send:hover{opacity:.88;transform:scale(1.05)} #cb-send:disabled{opacity:.4;cursor:not-allowed;transform:none} #cb-send svg{width:18px;height:18px;fill:#fff} #cb-suggestions{ padding:0 12px 10px;display:flex;flex-wrap:wrap;gap:6px;flex-shrink:0; } .cb-chip{ padding:5px 10px;border-radius:20px;font-size:11.5px;cursor:pointer; background:#f0f4f8;color:#047e7e;border:1px solid #d1e8e8; transition:background .15s;white-space:nowrap; } .cb-chip:hover{background:#e0f4f4} /* ── markdown rendering inside bot bubbles ── */ .cb-bubble.cb-md{white-space:normal} .cb-bubble.cb-md p{margin:0 0 6px} .cb-bubble.cb-md p:last-child{margin-bottom:0} .cb-bubble.cb-md strong{font-weight:700} .cb-bubble.cb-md em{font-style:italic} .cb-bubble.cb-md code{background:rgba(0,0,0,.07);padding:1px 5px;border-radius:4px;font-family:monospace;font-size:11.5px} .cb-bubble.cb-md h3{font-size:13px;font-weight:700;margin:8px 0 4px;color:#004d40} .cb-bubble.cb-md h4{font-size:12px;font-weight:700;margin:6px 0 3px;color:#047e7e} .cb-bubble.cb-md ul,.cb-bubble.cb-md ol{padding-left:18px;margin:4px 0} .cb-bubble.cb-md li{margin:2px 0} .cb-bubble.cb-md table{border-collapse:collapse;width:100%;margin:8px 0;font-size:11.5px} .cb-bubble.cb-md th{background:#047e7e;color:#fff;padding:5px 9px;text-align:left;font-weight:700;white-space:nowrap} .cb-bubble.cb-md td{padding:4px 9px;border-bottom:1px solid #e8eaed;white-space:nowrap} .cb-bubble.cb-md tr:nth-child(even) td{background:rgba(4,126,126,.05)} .cb-bubble.cb-md .cb-tbl-wrap{overflow-x:auto;border-radius:6px;border:1px solid #d1e8e8} .cb-bubble.cb-md hr{border:none;border-top:1px solid #e8eaed;margin:8px 0} `; document.head.appendChild(style); // ── inject HTML ─────────────────────────────────────────────────────────── const fab = document.createElement('button'); fab.id = 'cb-fab'; fab.title = 'AI Assistant'; fab.innerHTML = ` `; const panel = document.createElement('div'); panel.id = 'cb-panel'; panel.innerHTML = `
$1');
}
function renderMd(raw) {
const lines = raw.split('\n');
let html = '', i = 0;
while (i < lines.length) {
const line = lines[i];
const trim = line.trim();
// Blank line
if (!trim) { html += '| ${inlineMd(h)} | `; }); tbl += '
|---|
| ${inlineMd(c)} | `; }); tbl += '
${inlineMd(line)}
`; i++; } // Clean up excess