PageSourceSearch

https://slickbot.ai/assets/OperatorPage-DyEZEOgb.js

js slickbot.ai collected 2026-10-05 14:28:09 UTC 27,851 bytes, 19 lines download raw bytes

1import{d as xe,u as G,b as C,j as e}from"./vendor-query-DPZO-Gta.js";import{b as he,u as pe,h as fe,r as p,L as ye}from"./vendor-react-BomFe3BT.js";import{m as g,z as j,S as be}from"./index-BLzMsaFd.js";import{R as ve,P as ge,a as je,C as we,T as R,L as ke,b as Y,X as J,Y as X,d as Z,e as Ne,B as Le,f as _e}from"./vendor-charts-DodUWJ0z.js";const k=["#6366f1","#8b5cf6","#a78bfa","#c4b5fd","#14b8a6","#f59e0b","#ef4444","#3b82f6","#10b981","#f97316"];function Ce({spec:s}){const{type:l,title:a,data:r}=s;if(!r||r.length===0)return null;const o=Object.keys(r[0]),n=s.xKey||o[0],d=s.yKeys||o.filter(i=>i!==n&&typeof r[0][i]=="number"),f=s.nameKey||o[0],m=s.valueKey||o.find(i=>typeof r[0][i]=="number")||o[1];return e.jsxs("div",{className:"my-3 p-3 bg-white rounded-lg border border-surface-200",children:[a&&e.jsx("p",{className:"text-xs font-semibold text-gray-700 mb-2",children:a}),e.jsx(ve,{width:"100%",height:220,children:l==="pie"?e.jsxs(ge,{children:[e.jsx(je,{data:r,dataKey:m,nameKey:f,cx:"50%",cy:"50%",outerRadius:80,label:({name:i,percent:h})=>`${i} ${(h*100).toFixed(0)}%`,children:r.map((i,h)=>e.jsx(we,{fill:k[h%k.length]},h))}),e.jsx(R,{})]}):l==="line"?e.jsxs(ke,{data:r,children:[e.jsx(Y,{strokeDasharray:"3 3",stroke:"#f0f0f0"}),e.jsx(J,{dataKey:n,tick:{fontSize:11}}),e.jsx(X,{tick:{fontSize:11}}),e.jsx(R,{}),d.length>1&&e.jsx(Z,{}),d.map((i,h)=>e.jsx(Ne,{type:"monotone",dataKey:i,stroke:k[h%k.length],strokeWidth:2,dot:{r:3}},i))]}):e.jsxs(Le,{data:r,children:[e.jsx(Y,{strokeDasharray:"3 3",stroke:"#f0f0f0"}),e.jsx(J,{dataKey:n,tick:{fontSize:11}}),e.jsx(X,{tick:{fontSize:11}}),e.jsx(R,{}),d.length>1&&e.jsx(Z,{}),d.map((i,h)=>e.jsx(_e,{dataKey:i,fill:k[h%k.length],radius:[4,4,0,0]},i))]})})]})}function Me(s){const l=s.trim().split(`
2`);if(l.length<2)return s;const a=m=>m.split("|").map(i=>i.trim()).filter((i,h,N)=>h>0&&h<N.length),r=a(l[0]),o=l.slice(2).map(a),n="px-3 py-2 text-left text-xs font-semibold text-gray-600 bg-surface-100 whitespace-nowrap",d="px-3 py-1.5 text-xs text-gray-700 whitespace-nowrap";let f='<div class="overflow-x-auto my-2"><table class="min-w-full border border-surface-200 rounded-lg overflow-hidden text-sm">';f+="<thead><tr>";for(const m of r)f+=`<th class="${n}">${m}</th>`;f+="</tr></thead><tbody>";for(let m=0;m<o.length;m++){const i=m%2===1?" bg-surface-50":"";f+=`<tr class="${i}">`;for(const h of o[m])f+=`<td class="${d}">${h}</td>`;f+="</tr>"}return f+="</tbody></table></div>",f}function Se(s){const l=/((?:^\|.+\|[ \t]*\n)(?:^\|[\s:|-]+\|[ \t]*\n)(?:(?:^\|.+\|[ \t]*\n?)+))/gm,a=[];let o=s.replace(l,n=>{const d=`__TABLE_${a.length}__`;return a.push(Me(n)),d}).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/^### (.+)$/gm,'<h4 class="font-semibold text-sm mt-3 mb-1">$1</h4>').replace(/^## (.+)$/gm,'<h3 class="font-semibold text-base mt-3 mb-1">$1</h3>').replace(/^# (.+)$/gm,'<h2 class="font-bold text-base mt-3 mb-1">$1</h2>').replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/`([^`]+)`/g,'<code class="bg-surface-100 px-1 py-0.5 rounded text-xs font-mono">$1</code>').replace(/^[-*] (.+)$/gm,'<li class="ml-4 list-disc">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal">$1</li>').replace(/\n\n/g,"<br/><br/>").replace(/\n/g,"<br/>");for(let n=0;n<a.length;n++)o=o.replace(`__TABLE_${n}__`,a[n]);return o}function Ie(s){const l=s.split(`
3`),a=[];for(const o of l){const n=o.trim();/^[a-z_]+$/.test(n)||/^[a-z_]+\(.*\)$/.test(n)||a.push(o)}let r=a.join(`
4`).replace(/^\s+/,"");return r=r.replace(/^(?:Let me |I'll |I will |I'm going to |Looking at |Analyzing |Checking )[^\n]*\n\s*\n/i,""),r}function ee({content:s}){const l=p.useMemo(()=>{const a=Ie(s),r=[],o=/```chart\n([\s\S]*?)```/g;let n=0,d;for(;(d=o.exec(a))!==null;)d.index>n&&r.push({type:"text",content:a.slice(n,d.index)}),r.push({type:"chart",content:d[1].trim()}),n=d.index+d[0].length;return n<a.length&&r.push({type:"text",content:a.slice(n)}),r},[s]);return e.jsx("div",{className:"text-sm prose-sm [&_li]:my-0.5 [&_h2]:first:mt-0 [&_h3]:first:mt-0 [&_h4]:first:mt-0",children:l.map((a,r)=>
4{if(a.type==="chart")try{const o=JSON.parse(a.content);return e.jsx(Ce,{spec:o},r)}catch{return e.jsx("pre",{className:"bg-surface-100 p-2 rounded text-xs overflow-x-auto my-2",children:a.content},r)}return e.jsx("div",{dangerouslySetInnerHTML:{__html:Se(a.content)}},r)})})}const Ae={voicebot:{name:"Voicebot",description:"Handle calls and set up an AI receptionist for after-hours coverage.",route:"bots",icon:e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 6.75c0 8.284 6.716 15 15 15h2.25a2.25 2.25 0 002.25-2.25v-1.372c0-.516-.351-.966-.852-1.091l-4.423-1.106c-.44-.11-.902.055-1.173.417l-.97 1.293c-.282.376-.769.542-1.21.38a12.035 12.035 0 01-7.143-7.143c-.162-.441.004-.928.38-1.21l1.293-.97c.363-.271.527-.734.417-1.173L6.963 3.102a1.125 1.125 0 00-1.091-.852H4.5A2.25 2.25 0 002.25 4.5v2.25z"})})},chatbot:{name:"Website Chatbot",description:"Capture leads 24/7 with an AI chatbot on your website.",route:"bots",icon:e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 8.511c.884.284 1.5 1.128 1.5 2.097v4.286c0 1.136-.847 2.1-1.98 2.193-.34.027-.68.052-1.02.072v3.091l-3-3c-1.354 0-2.694-.055-4.02-.163a2.115 2.115 0 01-.825-.242m9.345-8.334a2.126 2.126 0 00-.476-.095 48.64 48.64 0 00-8.048 0c-1.131.094-1.976 1.057-1.976 2.192v4.286c0 .837.46 1.58 1.155 1.951m9.345-8.334V6.637c0-1.621-1.152-3.026-2.76-3.235A48.455 48.455 0 0011.25 3c-2.115 0-4.198.137-6.24.402-1.608.209-2.76 1.614-2.76 3.235v6.226c0 1.621 1.152 3.026 2.76 3.235.577.075 1.157.14 1.74.194V21l4.155-4.155"})})},crm:{name:"CRM",description:"Track contacts, manage your pipeline, and never lose a lead.",route:"customers",icon:e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19.128a9.38 9.38 0 002.625.372 9.337 9.337 0 004.121-.952 4.125 4.125 0 00-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 018.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0111.964-3.07M12 6.375a3.375 3.375 0 11-6.75 0 3.375 3.375 0 016.75 0zm8.25 2.25a2.625 2.625 0 11-5.25 0 2.625 2.625 0 015.25 0z"})})},scheduling:{name:"Scheduling",description:"Automate appointment booking and reduce no-shows.",route:"calendar",icon:e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5"})})},social_inbox:{name:"Unified Inbox",description:"Manage all your social media messages in one place.",route:"unibox",icon:e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 13.5h3.86a2.25 2.25 0 012.012 1.244l.256.512a2.25 2.25 0 002.013 1.244h3.218a2.25 2.25 0 002.013-1.244l.256-.512a2.25 2.25 0 012.013-1.244h3.859m-19.5.338V18a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18v-4.162c0-.224-.034-.447-.1-.661L19.24 5.338a2.25 2.25 0 00-2.15-1.588H6.911a2.25 2.25 0 00-2.15 1.588L2.35 13.177a2.25 2.25 0 00-.1.661z"})})},invoicing:{name:"Invoicing",description:"Send and track invoices to get paid faster.",route:"invoicing",icon:e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 18.75a60.07 60.07 0 0115.797 2.101c.727.198 1.453-.342 1.453-1.096V18.75M3.75 4.5v.75A.75.75 0 013 6h-.75m0 0v-.375c0-.621.504-1.125 1.125-1.125H20.25M2.25 6v9m18-10.5v.75c0 .414.336.75.75.75h.75m-1.5-1.5h.375c.621 0 1.125.504 1.125 1.125v9.75c0 .621-.504 1.125-1.125 1.125h-.375m1.5-1.5H21a.75.75 0 00-.75.75v.75m0 0H3.75m0 0h-.375a1.125 1.125 0 01-1.125-1.125V15m1.5 1.5v-.75A.75.75 0 003 15h-.75M15 10.5a3 3 0 11-6 0 3 3 0 016 0zm3 0h.008v.008H18V10.5zm-12 0h.008v.008H6V10.5z"})})}};function $e(s){let l=`**${s.title}**`;return s.description&&(l+=`
5
6${s.description}`),l+=`
7
8Feel free to ask me for more details — I can dig deeper into the data, explain what this means for your business, or suggest actions you can take.`,l}function ze(s){const l=s.event_subtype;return s.event_type==="data_insight"?l==="alert"?["What caused this alert?","How can I fix this?","Show me the full history"]:l==="recommendation"?["Tell me more about this recommendation","What impact would this have?","How do I implement this?"]:l==="trend"?["What's driving this trend?","Show me the data behind this","How does this compare to last month?"]:["Break this down for me","How does this compare to last period?","What should I focus on?"]:s.event_type==="data_analysis"?["Summarize the key findings","What actions should I take?","Show me the underlying data"]:s.event_type==="alert"?["What caused this?","How can I resolve this?","Is this urgent?"]:["Tell me more about this","What should I do next?","Give me a full overview"]}function Fe(){var H,T,O;const{id:s}=he(),l=pe(),a=fe(),r=xe(),[o,n]=p.useState(""),[d,f]=p.useState(!1),[m,i]=p.useState(""),[h,N]=p.useState(!1),F=p.useRef(null),M=p.useRef(null),S=((H=a.state)==null?void 0:H.feedItem)||null,[y,te]=p.useState(S),[se,re]=p.useState(!!S),I=p.useRef(!1);p.useEffect(()=>{S&&window.history.replaceState({},"")},[]);const{data:c,isLoading:D,error:ae}=G({queryKey:["operator-config",s],queryFn:async()=>(await g.getConfig(s)).data,enabled:!!s,retry:!1}),L=(c==null?void 0:c.discovery_status)||"not_started",{data:A}=G({queryKey:["operator-messages",s],queryFn:async()=>(await g.getMessages(s,0,200)).data,enabled:!!s&&!!(c!=null&&c.enabled)}),$=C({mutationFn:()=>g.activate(s),onSuccess:()=>{r.invalidateQueries({queryKey:["operator-config",s]}),r.invalidateQueries({queryKey:["operator-messages",s]}),j.success("AI Operator activated")},onError:()=>j.error("Failed to activate operator")}),z=C({mutationFn:()=>g.startDiscovery(s),onSuccess:t=>{var v;r.invalidateQueries({queryKey:["operator-config",s]});const u=(v=t.data)==null?void 0:v.message;u&&r.setQueryData(["operator-messages",s],b=>({items:[...(b==null?void 0:b.items)||[],u],total:((b==null?void 0:b.total)||0)+1}))},onError:()=>j.error("Failed to start discovery")}),E=C({mutationFn:()=>g.skipDiscovery(s),onSuccess:()=>{r.invalidateQueries({queryKey:["operator-config",s]}),j.success("Discovery skipped")},onError:()=>j.error("Failed to skip discovery")}),q=C({mutationFn:()=>g.resetDiscovery(s),onSuccess:()=>{r.invalidateQueries({queryKey:["operator-config",s]}),r.invalidateQueries({queryKey:["operator-messages",s]}),N(!1),j.success("Discovery reset — start fresh anytime")},onError:()=>j.error("Failed to reset discovery")});p.useEffect(()=>{y&&c&&s&&!I.current&&(I.current=!0,g.addMessage(s,$e(y),"feed_insight").then(()=>{r.invalidateQueries({queryKey:["operator-messages",s]})}).catch(()=>{I.current=!1}))},[y,c,s,r]);const K=((A==null?void 0:A.items)||[]).map(t=>{if(t.role==="user"&&t.content.startsWith("[Feed Insight")){const u=`
9
10User question: `,v=t.content.indexOf(u);if(v!==-1)return{...t,content:t.content.slice(v+u.length)}}return t}),ne=()=>{var t;(t=F.current)==null||t.scrollIntoView({behavior:"smooth"})};p.useEffect(()=>{ne()},[K,m]),p.useEffect(()=>{var t;(t=M.current)==null||t.focus()},[c]);const W=async t=>{var P,V;const u=t||o.trim();if(!u||d||!s)return;const v=u;n(""),f(!0),i("");let b=v;if(y){const x=[`[Feed Insight — ${y.title}]`];y.description&&x.push(y.description),x.push(`(type: ${y.event_type}, subtype: ${y.event_subtype})`),b=`${x.join(`
11`)}
12
13User question: ${v}`,te(null)}re(!1);const le={id:`temp-${Date.now()}`,role:"user",content:v,created_at:new Date().toISOString()};r.setQueryData(["operator-messages",s],x=>({items:[...(x==null?void 0:x.items)||[],le],total:((x==null?void 0:x.total)||0)+1}));try{if(be){const x=await g.chatStream(s,b);if(!x.ok)throw new Error("Stream request failed");const w=(P=x.body)==null?void 0:P.getReader();if(!w)throw new Error("No reader");const ce=new TextDecoder;let Q="";for(;;){const{done:de,value:ue}=await w.read();if(de)break;const me=ce.decode(ue,{stream:!0});for(const U of me.split(`
14`))if(U.startsWith("data: "))try{const _=JSON.parse(U.slice(6));_.content&&(Q+=_.content,i(Q)),_.error&&j.error(_.error)}catch{}}}else{const w=(await g.chat(s,b)).data;(V=w==null?void 0:w.message)!=null&&V.content&&i(w.message.content)}}catch(x){j.error("Failed to send message"),console.error("Chat error:",x)}finally{f(!1),i(""),r.invalidateQueries({queryKey:["operator-messages",s]}),L==="in_progress"&&r.invalidateQueries({queryKey:["operator-config",s]})}},oe=t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),W())},B=(T=c==null?void 0:c.business_profile)==null?void 0:T.recommended_features,ie=L==="completed"&&B&&B.length>0&&!h;return ae||!D&&!c?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20",children:[e.jsx("div",{className:"w-20 h-20 mb-6 bg-gradient-to-br from-primary-500 to-purple-500 rounded-3xl flex items-center justify-center shadow-glow-indigo",children:e.jsx("svg",{className:"w-10 h-10 text-white",f
14ill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 00-2.455 2.456zM16.894 20.567L16.5 21.75l-.394-1.183a2.25 2.25 0 00-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 001.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 001.423 1.423l1.183.394-1.183.394a2.25 2.25 0 00-1.423 1.423z"})})}),e.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"AI Business Operator"}),e.jsx("p",{className:"text-muted-500 text-center max-w-md mb-8",children:"Get data-driven business insights, pipeline analysis, and strategic advice powered by AI with full access to your business data."}),e.jsx("button",{onClick:()=>$.mutate(),disabled:$.isPending,className:"btn btn-primary px-8 py-3 text-base",children:$.isPending?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsxs("svg",{className:"w-5 h-5 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Activating..."]}):"Activate AI Operator"})]}):D?e.jsx("div",{className:"flex items-center justify-center py-24",children:e.jsx("div",{className:"w-8 h-8 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}):L==="not_started"?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20",children:[e.jsx("div",{className:"w-20 h-20 mb-6 bg-gradient-to-br from-primary-500 to-purple-500 rounded-3xl flex items-center justify-center shadow-glow-indigo",children:e.jsx("svg",{className:"w-10 h-10 text-white",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 00-2.455 2.456zM16.894 20.567L16.5 21.75l-.394-1.183a2.25 2.25 0 00-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 001.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 001.423 1.423l1.183.394-1.183.394a2.25 2.25 0 00-1.423 1.423z"})})}),e.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Let's Set Up Your AI Operator"}),e.jsx("p",{className:"text-muted-500 text-center max-w-md mb-2",children:"Answer a few questions so your AI Operator understands your business and can make personalized recommendations."}),e.jsx("p",{className:"text-muted-400 text-sm mb-8",children:"Takes about 2 minutes"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:()=>z.mutate(),disabled:z.isPending,className:"btn btn-primary px-8 py-3 text-base",children:z.isPending?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsxs("svg",{className:"w-5 h-5 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Starting..."]}):"Start Discovery"}),e.jsx("button",{onClick:()=>E.mutate(),disabled:E.isPending,className:"text-sm text-muted-400 hover:text-muted-600 transition-colors",children:"Skip for now"})]})]}):e.jsxs("div",{className:"flex flex-col h-[calc(100vh-7rem)]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-primary-500 to-purple-500 rounded-xl flex items-center justify-center",children:e.jsx("svg",{className:"w-5 h-5 text-white",f
14ill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09z"})})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"AI Operator"}),e.jsxs("p",{className:"text-xs text-muted-400",children:[(c==null?void 0:c.status)==="active"?e.jsx("span",{className:"text-emerald-500",children:"Active"}):e.jsx("span",{className:"text-amber-500",children:c==null?void 0:c.status})," · ",(O=c==null?void 0:c.llm_model)==null?void 0:O.split("/").pop()]})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(ye,{to:`/business/${s}/intelligence/settings`,className:"btn btn-ghost text-sm",children:[e.jsxs("svg",{className:"w-4 h-4 mr-1.5",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),"Settings"]})})]}),L==="in_progress"&&e.jsxs("div",{className:"mb-3 px-4 py-2.5 bg-primary-50 border border-primary-200 rounded-xl flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 text-primary-500 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09z"})}),e.jsx("span",{className:"text-sm text-primary-700",children:"Discovery Phase — Your AI Operator is learning about your business"})]}),ie&&e.jsxs("div",{className:"mb-3 bg-white border border-surface-200 rounded-2xl p-4",children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-gray-900 text-sm",children:"Recommended for your business"}),e.jsx("p",{className:"text-xs text-muted-400 mt-0.5",children:"Based on your discovery conversation"})]}),e.jsx("button",{onClick:()=>N(!0),className:"text-muted-300 hover:text-muted-500 transition-colors p-1",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"space-y-2",children:B.map(t=>{const u=Ae[t];return u?e.jsxs("div",{className:"flex items-center justify-between p-2.5 bg-surface-50 rounded-xl",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-primary-100 text-primary-600 rounded-lg flex items-center justify-center flex-shrink-0",children:u.icon}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:u.name}),e.jsx("p",{className:"text-xs text-muted-400",children:u.description})]})]}),e.jsx("button",{onClick:()=>l(`/business/${s}/${u.route}`),className:"text-xs text-primary-500 hover:text-primary-700 font-medium whitespace-nowrap ml-3",children:"Set up →"})]},t):null})}),e.jsx("div",{className:"mt-3 flex items-center justify-between",children:e.jsx("button",{onClick:()=>q.mutate(),disabled:q.isPending,className:"text-xs text-muted-400 hover:text-muted-600 transition-colors",children:"Redo Discovery"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto bg-surface-50 rounded-2xl border border-surface-200 p-4 space-y-4",children:[K.length===0&&!m&&e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[e.jsx("svg",{className:"w-12 h-12 text-muted-300 mb-3",fill:"none",viewBox:"0 0 24 24",strokeWidth:1,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 8.511c.884.284 1.5 1.128 1.5 2.097v4.286c0 1.136-.847 2.1-1.98 2.193-.34.027-.68.052-1.02.072v3.091l-3-3c-1.354 0-2.694-.055-4.02-.163a2.115 2.115 0 01-.825-.242m9.345-8.334a2.126 2.126 0 00-.476-.095 48.64 48.64 0 00-8.048 0c-1.131.094-1.976 1.057-1.976 2.192v4.286c0 .837.46 1.58 1.155 1.951m9.345-8.334V6.637c0-1.621-1.152-3.026-2.76-3.235A48.455 48.455 0 0011.25 3c-2.115 0-4.198.137-6.24.402-1.608.209-2.76 1.614-2.76 3.235v6.226c0 1.621 1.152 3.026 2.76 3.235.577.075 1.157.14 1.74.194V21l4.155-4.155"})}),e.jsx("p",{className:"text-muted-400 font-medium mb-1",children:"Start a conversation"}),e.jsx("p",{className:"text-muted-300 text-sm max-w-sm",children:"Ask about your business performance, leads, invoices, or get strategic advice."}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-4 max-w-lg justify-center",children:["Give me a business overview","Any overdue invoices?","How are my leads doing?","Summarize recent conversations"].map(t=>e.jsx("button",{onClick:()=>{var u;n(t),(u=M.current)==null||u.focus()},className:"px-3 py-1.5 text-xs bg-white border border-surface-200 rounded-full text-muted-500 hover:text-gray-700 hover:border-primary-300 transition-all",children:t},t))})]}),K.map(t=>e.jsx("div",{className:`flex ${t.source==="alert"?"justify-center":t.role==="user"?"justify-end":"justify-start"}`,children:e.jsxs("div",{className:`max-w-[80%] rounded-2xl px-4 py-3 ${t.source==="alert"?"bg-amber-50 border border-amber-200 text-amber-900 rounded-xl":t.source==="feed_insight"?"bg-gradient-to-br from-violet-50 to-white border border-violet-200 text-gray-800 rounded-bl-md":t.role==="user"?"bg-primary-500 text-white rounded-br-md":"bg-white border border-surface-200 text-gray-800 rounded-bl-md"}`,children:[t.source&&t.source!=="web_chat"&&e.jsx("div",{className:"mb-1",children:e.jsx("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium ${t.source==="telegram"?"bg-blue-100 text-blue-700":t.source==="alert"?"bg-amber-100 text-amber-700":t.source==="heartbeat"?"bg-purple-100 text-purple-700":t.source==="feed_insight"?"bg-violet-100 text-violet-700":"bg-gray-100 text-gray-600"}`,children:t.source==="telegram"?"Telegram":t.source==="alert"?"Alert":t.source==="heartbeat"?"Periodic Report":t.source==="feed_insight"?"Feed Insight":t.source})}),t.role==="assistant"?e.jsx(ee,{content:t.content}):e.jsx("div",{className:"whitespace-pre-wrap text-sm",children:t.content}),t.response_time_ms&&e.jsxs("div",{className:"text-xs opacity-50 mt-1",children:[(t.response_time_ms/1e3).toFixed(1),"s"]})]})},t.id)),se&&y&&e.jsx("div",{className:"flex justify-start",children:e.jsx("div",{className:"max-w-[80%]",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:ze(y).map(t=>e.jsx("button",{onClick:()=>W(t),className:"px-3 py-1.5 text-xs bg-white border border-violet-200 rounded-full text-violet-600 hover:text-violet-800 hover:border-violet-400 transition-all",children:t},t))})})}),m&&e.jsx("div",{className:"flex justify-start",children:e.jsx("div",{className:"max-w-[80%] rounded-2xl rounded-bl-md px-4 py-3 bg-white border border-surface-200 text-gray-800",children:e.jsx(ee,{content:m})})}),d&&!m&&e.jsx("div",{className:"flex justify-start",children:e.jsxs("div",{className:"rounded-2xl rounded-bl-md px-4 py-3 bg-white border border-surface-200",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-[blink_1.4s_ease-in-out_infinite]"}),e.jsx("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-[blink_1.4s_ease-in-out_0.2s_infinite]"}),e.jsx("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-[blink_1.4s_ease-in-out_0.4s_infinite]"})]}),e.jsx("style",{children:`
15                @keyframes blink {
16                  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
17                  40% { opacity: 1; transform: scale(1); }
18                }
19              `})]})}),e.jsx("div",{ref:F})]}),e.jsx("div",{className:"mt-4",children:e.jsxs("div",{className:"flex gap-3 items-end",children:[e.jsx("div",{className:"flex-1 relative",children:e.jsx("textarea",{ref:M,value:o,onChange:t=>n(t.target.value),onKeyDown:oe,placeholder:"Ask about your business...",rows:1,className:"input-field w-full resize-none pr-12",style:{minHeight:"44px",maxHeight:"120px"},disabled:d})}),e.jsx("button",{onClick:()=>W(),disabled:!o.trim()||d,className:"btn btn-primary h-11 w-11 p-0 flex items-center justify-center rounded-xl flex-shrink-0",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.876L5.999 12zm0 0h7.5"})})})]})})]})}export{Fe as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.