Ask about public xBxBio modules, 21 cardiac conditions, ECG/EKG, imaging, equipment interfaces, laboratory, genetics/NGS, clinical trials, interoperability, security, Six Sigma, robustness and more.
Research-stage · Pre-commercial · General information only · Not medical advice · No IP, white papers, source code or confidential engineering content.
`;document.body.appendChild(h);const $=x=>s.getElementById(x),p=$("p"),hd=$("hd"),min=$("min"),launch=$("launch"),msgs=$("msgs"),q=$("q"),send=$("send"),voice=$("voice"),read=$("read"),mic=$("mic"),ts=$("ts"),cat=$("cat"),chips=$("chips"),W=()=>Math.min(390,innerWidth-16),H=()=>Math.min(640,innerHeight-16);h.style.width=W()+"px";h.style.height=H()+"px";D.C.forEach(x=>cat.add(new Option(x[0],x[0])));let last="",v=false,rec;const block=/\b(patent|intellectual property|trade secret|proprietary|source code|javascript|backend code|implementation code|white ?paper|whitepapers)\b/i,stop=new Set("the a an and or of to for in on with about what how does do is are can tell explain xbx xbxbio".split(" ")),norm=x=>{x=x.toLowerCase().replace(/[^a-z0-9+ ]/g," ");D.R.forEach(r=>x=x.replace(r[0],r[1]));return x.replace(/\s+/g," ").trim()},tok=x=>norm(x).split(" ").filter(w=>w.length>2&&!stop.has(w));function best(x){const z=norm(x),Q=new Set(tok(z));let b=null,n=0;T.forEach(t=>{let l=norm(t.l),k=z.includes(l)?20:0;tok(l).forEach(w=>{if(Q.has(w))k+=2});if(k>n){n=k;b=t}});return n>=2?b:null}function ans(x){if(block.test(x))return"I can discuss public xBxBio capabilities, but not IP, patents, white papers, source code, proprietary methods or confidential engineering details.";let t=best(x);if(!t)return"I can help with 200 public xBxBio topics. Search the quick-topic list above or ask using your own words.";let l=t.l,c=t.c;if(c==="Cardiac Conditions")return`xBxBio can organize longitudinal evidence related to ${l} across ECG/EKG, imaging, laboratory results, medications and patient timelines. This is general information, not diagnosis or treatment advice.`;return`${l} is part of xBxBio's public ${c} scope, designed to support connected, longitudinal, multimodal and governed cardiovascular information.`}function add(t,c){let d=document.createElement("div");d.className="m "+c;d.textContent=t;msgs.appendChild(d);msgs.scrollTop=msgs.scrollHeight}function speak(t){if(!("speechSynthesis"in window))return;speechSynthesis.cancel();let u=new SpeechSynthesisUtterance(t);u.rate=.95;speechSynthesis.speak(u)}function ask(t){t=t.trim();if(!t)return;add(t,"u");let a=ans(t);last=a;add(a,"b");if(v)speak(a)}function render(){let f=norm(ts.value),c=cat.value,a=T.filter(t=>(!c||t.c===c)&&(!f||norm(t.l).includes(f))).slice(0,12);chips.innerHTML="";a.forEach(t=>{let b=document.createElement("button");b.className="chip";b.textContent=t.l;b.onclick=()=>ask(t.l);chips.appendChild(b)})}render();ts.oninput=render;cat.onchange=render;send.onclick=()=>{ask(q.value);q.value=""};q.onkeydown=e=>{if(e.key==="Enter")send.click()};voice.onclick=()=>{v=!v;voice.textContent=v?"🔊 Voice On":"🔇 Voice Off";if(!v&&"speechSynthesis"in window)speechSynthesis.cancel()};read.onclick=()=>last&&speak(last);const SR=window.SpeechRecognition||window.webkitSpeechRecognition;if(SR){rec=new SR();rec.lang="en-US";rec.onstart=()=>{mic.textContent="■ Listening";mic.classList.add("on")};rec.onend=()=>{mic.textContent="🎤 Talk";mic.classList.remove("on")};rec.onerror=e=>add("Microphone error: "+e.error,"b");rec.onresult=e=>{let x=e.results[0][0].transcript;q.value=x;ask(x);q.value=""};mic.onclick=()=>{try{rec.start()}catch(e){rec.stop()}}}else mic.onclick=()=>add("Speech input is not supported by this browser.","b");min.onclick=()=>{let r=h.getBoundingClientRect();h.style.left=r.left+"px";h.style.top=r.top+"px";h.style.right="auto";h.style.bottom="auto";p.style.display="none";launch.style.display="block";h.style.width="64px";h.style.height="64px"};launch.onclick=()=>{h.style.width=W()+"px";h.style.height=H()+"px";launch.style.display="none";p.style.display="flex";clamp()};let drag=false,pid,ox=0,oy=0;hd.onpointerdown=e=>{if(e.target.closest("button"))return;e.preventDefault();let r=h.getBoundingClientRect();h.style.left=r.left+"px";h.style.top=r.top+"px";h.style.right="auto";h.style.bottom="auto";ox=e.clientX-r.left;oy=e.clientY-r.top;drag=true;pid=e.pointerId;hd.setPointerCapture(pid)};hd.onpointermove=e=>{if(!drag||e.pointerId!==pid)return;let r=h.getBoundingClientRect(),l=e.clientX-ox,t=e.clientY-oy;l=Math.max(0,Math.min(l,innerWidth-r.width));t=Math.max(0,Math.min(t,innerHeight-r.height));h.style.left=l+"px";h.style.top=t+"px"};hd.onpointerup=hd.onpointercancel=e=>{if(!drag)return;drag=false;if(hd.hasPointerCapture(pid))hd.releasePointerCapture(pid)};function clamp(){let r=h.getBoundingClientRect();h.style.left=Math.max(0,Math.min(r.left,innerWidth-r.width))+"px";h.style.top=Math.max(0,Math.min(r.top,innerHeight-r.height))+"px";h.style.right="auto";h.style.bottom="auto"}addEventListener("resize",()=>{if(p.style.display!=="none"){h.style.width=W()+"px";h.style.height=H()+"px"}clamp()})})();