1import{a as be,r as x,j as e}from"./vendor-react-DK_MHVKo.js";import{q as m,h as N,u as fe,i as ve,g as se,O as we}from"./index-Djo5SZyv.js";import{u as O,a as oe,b as ne}from"./vendor-query-Ceg45NlR.js";import{R as z,i as M,d as ae,V as ye,W as je,Y as Ne,k as ke,_ as Ce,b as _e,$ as Se,a0 as Ae,a1 as qe,j as $e,D as le,A as De}from"./vendor-icons-Dr_X1Hjo.js";function Le(t){if(!t)return NaN;const s=/(Z|[+-]\d{2}:?\d{2})$/.test(t)?t:`${t}Z`;return Date.parse(s)}const Ee=10*60*1e3;function re(t){if(!t||t.role!=="user")return!1;const s=Le(t.created_at);return Number.isFinite(s)?Date.now()-s>Ee:!1}function Ie(t){return O({queryKey:m.copilot.messages(t??0),queryFn:()=>N.getMessages(t).then(s=>s.data),enabled:t!=null,refetchInterval:s=>{var a;const n=(a=s.state.data)==null?void 0:a.messages;if(!Array.isArray(n)||n.length===0)return!1;const i=n[n.length-1];return i.role!=="user"||re(i)?!1:1500}})}function Oe(){return O({queryKey:m.copilot.latest(),queryFn:()=>N.getLatestConversation().then(t=>t.data)})}function Re(t=!0){return O({queryKey:m.copilot.conversations(),queryFn:()=>N.getConversations().then(s=>s.data),enabled:t})}function Te(t){const s=oe();return ne({mutationFn:({messageId:n,decision:i})=>N.actOnMessage(n,i).then(a=>a.data),onSettled:()=>{s.invalidateQueries({queryKey:m.copilot.messages(t??0)}),s.invalidateQueries({queryKey:m.copilot.conversations()})}})}function ze(){return O({queryKey:m.copilot.quota(),queryFn:()=>N.getQuota().then(t=>t.data)})}function Me(){const t=oe();return ne({mutationFn:s=>N.sendMessage(s).then(n=>n.data),onSuccess:s=>{const n=s.conversation_id;t.setQueryData(m.copilot.messages(n),i=>{const a=Array.isArray(i==null?void 0:i.messages)?i.messages:[];return a.some(o=>o.id===s.message.id)?i:{messages:[...a,s.message],progress:null}}),t.setQueryData(m.copilot.latest(),i=>({...i||{},id:n})),t.invalidateQueries({queryKey:m.copilot.conversations()}),s.quota&&t.setQueryData(m.copilot.quota(),s.quota)}})}const j=1e4,Pe=8e3;function Fe(t,s=""){var i,a;const n=(a=(i=t==null?void 0:t.response)==null?void 0:i.data)==null?void 0:a.details;return Array.isArray(n)&&n.some(o=>String((o==null?void 0:o.field)||"").endsWith("content")&&(o==null?void 0:o.type)==="string_too_long")?!0:s.length>j}const Ke={admin:[Ce,_e,Se,Ae],inbound:[ye,je,Ne,ke]}
1,Qe=["artisan","legal","medical","real_estate","hospitality","auto","insurance","fiscal","sales","tech","general"],Be={dentist:"medical",dentaire:"medical",sante:"medical",btp:"artisan",batiment:"artisan",plombier:"artisan",avocat:"legal",juridique:"legal",notaire:"legal",immobilier:"real_estate",restaurant:"hospitality",hotel:"hospitality",commerce:"hospitality",garage:"auto",automobile:"auto"};function Ve(t,s,n){const i=(s||"").toLowerCase().trim(),a=Qe.includes(i)?i:Be[i];if(!a)return"general";const o=`copilot.suggestions.${a}.${n}.hero`;return t(o)===o?"general":a}const Ue={"/receptionist/setup":"copilot.goto.setup","/receptionist/settings":"copilot.goto.settings","/campaigns/new":"copilot.goto.newCampaign","/campaigns":"copilot.goto.campaigns","/contacts":"copilot.goto.contacts","/billing":"copilot.goto.billing","/receptionist/appointments":"copilot.goto.appointments","/receptionist":"copilot.goto.receptionist","/calls":"copilot.goto.calls","/dashboard":"copilot.goto.dashboard","/support":"copilot.goto.support"};function I({size:t="md",active:s=!0,rings:n=!1}){const i=t==="lg"?"w-[72px] h-[72px]":"w-8 h-8";return e.jsxs("div",{className:"relative shrink-0","aria-hidden":"true",children:[n&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"vpp-ring"}),e.jsx("span",{className:"vpp-ring vpp-ring-2"})]}),e.jsx("div",{className:`${i} relative rounded-full flex items-center justify-center bg-gradient-to-br from-indigo-500/25 via-violet-500/25 to-fuchsia-500/25 ring-1 ring-indigo-400/30 shadow-[0_4px_24px_rgba(124,77,255,0.35)]`,children:e.jsx(we,{size:t==="lg"?58:26,talking:s})})]})}function We({msg:t}){return e.jsx("div",{className:"flex justify-end vpp-enter",children:e.jsx("div",{className:"max-w-[85%] rounded-3xl rounded-br-lg px-4 py-2.5 text-[15px] leading-relaxed bg-gradient-to-r from-indigo-600 to-violet-600 text-white shadow-lg shadow-indigo-950/40",children:e.jsx("p",{className:"whitespace-pre-wrap break-words",children:t.content})})})}function Ge(t,s){const n=(s("copilot.daysShort")||"").split(",");return Object.entries(t||{}).map(([i,a])=>{const o=`copilot.fields.${i}`,r=s(o)===o?i:s(o);let c;if(typeof a=="boolean")c=s(a?"copilot.on":"copilot.off");else if(a===null||a==="")c=s("copilot.fieldNone");else if(i==="profession_type"){const p=`copilot.professions.${a}`;c=s(p)===p?String(a):s(p)}else i==="active_days"&&Array.isArray(a)?c=a.map(p=>n[p-1]||p).join(", "):Array.isArray(a)?c=(s("copilot.fieldCount")||"{n}").replace("{n}",a.length):s(`copilot.fieldValues.${i}.${a}`)!==`copilot.fieldValues.${i}.${a}`?c=s(`copilot.fieldValues.${i}.${a}`):i==="min_booking_advance_hours"?c=`${a} h`:i==="voice_speed"||i==="voice_temperature"?c=`${a}Ã`:(c=String(a),c.length>60&&(c=c.slice(0,60)+"â¦"));return{label:r,display:c}})}function Ye({msg:t,t:s,navigate:n,onProposal:i,actionPending:a}){const o=t.goto&&Ue[t.goto],r=t.proposal,c=r?Ge(r.args,s):[];return e.jsxs("div",{className:"flex items-start gap-2.5 vpp-enter",children:[e.jsx(I,{size:"sm",active:!1}),e.jsxs("div",{className:"max-w-[85%]",children:[e.jsx("div",{className:"rounded-3xl rounded-tl-lg px-4 py-3 text-[15px] leading-relaxed bg-slate-800/80 dark:bg-slate-800/80 light:bg-white text-slate-100 dark:text-slate-100 light:text-slate-800 border border-slate-700/40 dark:border-slate-700/40 light:border-slate-200 backdrop-blur",children:e.jsx("p",{className:"whitespace-pre-wrap break-words",children:t.content})}),r&&e.jsxs("div",{className:"mt-2 rounded-2xl border border-indigo-500/40 bg-indigo-500/10 backdrop-blur px-4 py-3",children:[c.length>0?e.jsx("div",{className:"flex flex-col gap-1.5 mb-2.5",children:c.map(p=>e.jsxs("div",{className:"flex items-baseline justify-between gap-3 text-[13px]",children:[e.jsx("span",{className:"text-slate-400 shrink-0",children:p.label}),e.jsx("span",{className:"font-medium text-indigo-200 dark:text-indigo-200 light:text-indigo-700 text-right break-words",children:p.display})]},p.label))}):r.summary&&e.jsx("p",{className:"text-[13px] font-medium text-indigo-200 dark:text-indigo-200 light:text-indigo-700 mb-2.5",children:r.summary}),r.status==="pending"&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>i(t.id,"confirm"),disabled:a,className:"flex-1 px-4 py-2.5 rounded-full text-sm font-semibold text-white bg-gradient-to-r from-indigo-500 to-violet-600 shadow-lg shadow-indigo-950/50 disabled:opacity-50 active:scale-95 transition-transform",children:s(a?"copilot.applying":"copilot.confirm")}),e.jsx("button",{onClick:()=>i(t.id,"dismiss"),disabled:a,className:"px-4 py-2.5 rounded-full text-sm font-medium text-slate-400 hover:text-slate-200 disabled:opacity-50 transition-colors",children:s("copilot.dismiss")})]}),r.status==="applying"&&e.jsxs("p",{className:"flex items-center gap-2 text-[13px] text-slate-400",children:[e.jsx("span",{className:"w-4 h-4 rounded-full border-2 border-indigo-400 border-t-transparent animate-spin shrink-0"}),s("copilot.applying")]}),r.status==="applied"&&e.jsxs("p",{className:"flex items-center gap-1.5 text-[13px] font-medium text-emerald-400",children:[e.jsx(le,{className:"w-4 h-4",strokeWidth:3})," ",s("copilot.applied")]}),r.status==="failed"&&e.jsx("p",{className:"text-[13px] font-medium text-amber-400",children:s("copilot.actionFailed")}
1),r.status==="dismissed"&&e.jsx("p",{className:"text-[13px] text-slate-500",children:s("copilot.dismissed")})]}),t.goto&&!r&&e.jsxs("button",{onClick:()=>n(t.goto),className:"mt-2 inline-flex items-center gap-1.5 px-4 py-2.5 rounded-full text-sm font-semibold text-white bg-gradient-to-r from-indigo-500 to-violet-600 shadow-lg shadow-indigo-950/50 active:scale-95 transition-transform",children:[s(o||"copilot.gotoGeneric"),e.jsx(De,{className:"w-4 h-4"})]})]})]})}function ie({heroChip:t,chips:s,chipIcons:n,send:i,className:a=""}){return e.jsxs("div",{className:`w-full max-w-md mx-auto ${a}`,children:[e.jsx("div",{className:"vpp-chip",style:{animationDelay:".16s"},children:e.jsx("button",{onClick:()=>i(t),className:"vpp-hero w-full text-left active:scale-[0.99] transition-transform",children:e.jsxs("div",{className:"vpp-hero-inner flex items-center gap-3 p-4 bg-slate-800 dark:bg-slate-800 light:bg-white",children:[e.jsx("span",{className:"w-9 h-9 shrink-0 rounded-xl bg-gradient-to-br from-indigo-500/30 to-fuchsia-500/30 flex items-center justify-center",children:e.jsx($e,{className:"w-5 h-5 text-fuchsia-300"})}),e.jsx("span",{className:"text-[13.5px] leading-snug text-slate-100 dark:text-slate-100 light:text-slate-800 font-medium",children:t})]})})}),e.jsx("div",{className:"grid grid-cols-2 gap-2.5 mt-2.5",children:s.map((o,r)=>
1{const c=n[r];return e.jsxs("button",{onClick:()=>i(o),style:{animationDelay:`${.2+r*.06}s`},className:"vpp-chip text-left p-3.5 rounded-2xl bg-slate-800/60 dark:bg-slate-800/60 light:bg-white border border-slate-700/50 dark:border-slate-700/50 light:border-slate-200 backdrop-blur hover:border-indigo-500/60 active:scale-[0.98] transition-all",children:[e.jsx(c,{className:"w-5 h-5 text-indigo-400 mb-2"}),e.jsx("span",{className:"block text-[13px] leading-snug text-slate-200 dark:text-slate-200 light:text-slate-700",children:o})]},o)})})]})}function He({progress:t,t:s}){const n=a=>{const o=`copilot.progress.tools.${a}`,r=s(o);return r===o?s("copilot.progress.toolsGeneric"):r};let i;if(!t)i=[{label:s("copilot.progress.connecting"),state:"active"}];else{i=[{label:s("copilot.progress.reading"),state:t.stage==="reading"?"active":"done"}];let a=t.stage!=="tools";for(const o of t.tools||[]){let r="pending";o.done?r="done":a||(r="active",a=!0),i.push({label:n(o.name),state:r})}(t.stage==="writing"||(t.tools||[]).length>0)&&i.push({label:s("copilot.progress.writing"),state:t.stage==="writing"?"active":"pending"})}return e.jsxs("div",{className:"flex items-start gap-2.5 vpp-enter",children:[e.jsx(I,{size:"sm",active:!0}),e.jsx("div",{className:"rounded-3xl rounded-tl-lg px-4 py-3.5 bg-slate-800/80 dark:bg-slate-800/80 light:bg-white border border-slate-700/40 dark:border-slate-700/40 light:border-slate-200 backdrop-blur min-w-[220px]",children:e.jsx("div",{className:"flex flex-col gap-2.5",children:i.map((a,o)=>e.jsxs("div",{className:"flex items-center gap-2.5",children:[a.state==="done"&&e.jsx("span",{className:"w-4 h-4 rounded-full bg-emerald-500/20 flex items-center justify-center shrink-0",children:e.jsx(le,{className:"w-3 h-3 text-emerald-400",strokeWidth:3})}),a.state==="active"&&e.jsx("span",{className:"w-4 h-4 rounded-full border-2 border-indigo-400 border-t-transparent animate-spin shrink-0"}),a.state==="pending"&&e.jsx("span",{className:"w-4 h-4 flex items-center justify-center shrink-0",children:e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-slate-600"})}),e.jsx("span",{className:`text-[13px] leading-snug ${a.state==="active"?"text-slate-100 dark:text-slate-100 light:text-slate-800 vpp-shimmer font-medium":a.state==="done"?"text-slate-400":"text-slate-600"}`,children:a.label})]},o))})})]})}function tt(){var ee,te;const{t}=fe(),{inboundView:s}=ve(),n=be(),[i,a]=x.useState(""),[o,r]=x.useState(null),[c,p]=x.useState(null),[P,F]=x.useState(!1),[K,k]=x.useState(!1),Q=x.useRef(null),ce=x.useRef(null),{data:C,isLoading:B}=Oe(),{data:h}=Ie(o),{data:$}=ze(),{data:V}=Re(K),U=Me(),W=Te(o),de=(l,w)=>{p(null),W.mutate({messageId:l,decision:w},{onError:g=>{var _,S,A,d;const y=((S=(_=g==null?void 0:g.response)==null?void 0:_.data)==null?void 0:S.message)??((d=(A=g==null?void 0:g.response)==null?void 0:A.data)==null?void 0:d.detail),E=typeof y=="object"?y==null?void 0:y.reason:null;p(E==="custom_prompt_would_be_lost"?"customPrompt":"generic")}})};x.useEffect(()=>{try{sessionStorage.removeItem("vp_prefer_classic"),localStorage.removeItem("vp_prefer_classic")}catch{}},[]),x.useEffect(()=>{!P&&o==null&&(C!=null&&C.id)&&r(C.id)},[C,o,P]);const R=()=>{F(!0),r(null),p(null),a("")},b=Array.isArray(h==null?void 0:h.messages)?h.messages:[],f=(h==null?void 0:h.progress)||null,D=b.length>0?b[b.length-1]:null,G=re(D),v=U.isPending||(D==null?void 0:D.role)==="user"&&!G;x.useEffect(()=>{var l;(l=Q.current)==null||l.scrollIntoView({behavior:"smooth",block:"end"})},[b.length,v,f==null?void 0:f.stage,((f==null?void 0:f.tools)||[]).filter(l=>l.done).length]);const u=s?"inbound":"admin",Y=Ve(t,(ee=se())==null?void 0:ee.profession_type,u),H=t(`copilot.suggestions.${Y}.${u}.hero`),X=[1,2,3,4].map(l=>t(`copilot.suggestions.${Y}.${u}.${l}`)),Z=Ke[u],J=(((te=se())==null?void 0:te.full_name)||"").split(" ")[0],L=async l=>{var g,y,E,_,S,A;const w=(l??i).trim();if(!(!w||v)){if(w.length>j){p("tooLong");return}p(null),a("");try{const d=await U.mutateAsync({content:w,conversation_id:o,view_mode:u});d!=null&&d.conversation_id&&r(d.conversation_id)}catch(d){a(w);const q=((y=(g=d==null?void 0:d.response)==null?void 0:g.data)==null?void 0:y.message)??((_=(E=d==null?void 0:d.response)==null?void 0:E.data)==null?void 0:_.detail),he=typeof q=="object"?q==null?void 0:q.code:q;
1((S=d==null?void 0:d.response)==null?void 0:S.status)===429?p(he==="copilot_global_quota"?"busy":"quota"):((A=d==null?void 0:d.response)==null?void 0:A.status)===422&&Fe(d,w)?p("tooLong"):p("generic")}}},pe=l=>{l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),L())},T=()=>{try{sessionStorage.setItem("vp_prefer_classic","1")}catch{}n(u==="inbound"?"/receptionist":"/dashboard")},xe=b.some(l=>l.role==="user"),me=!B&&b.length===0&&!v,ue=!B&&!xe&&!v,ge=$&&!$.unlimited;return e.jsxs("div",{className:"relative flex flex-col h-full w-full overflow-hidden bg-slate-900 dark:bg-slate-900 light:bg-slate-50",children:[e.jsx("style",{children:` 2 .vpp-aurora { position: absolute; border-radius: 9999px; filter: blur(80px); pointer-events: none; } 3 .vpp-aurora-a { width: 420px; height: 420px; top: -160px; left: -120px; 4 background: radial-gradient(circle, rgba(99,102,241,.30), transparent 70%); 5 animation: vppDriftA 16s ease-in-out infinite alternate; } 6 .vpp-aurora-b { width: 380px; height: 380px; bottom: -140px; right: -110px; 7 background: radial-gradient(circle, rgba(217,70,239,.16), transparent 70%); 8 animation: vppDriftB 20s ease-in-out infinite alternate; } 9 @keyframes vppDriftA { to { transform: translate(60px, 40px) scale(1.15); } } 10 @keyframes vppDriftB { to { transform: translate(-50px, -30px) scale(1.1); } } 11 .vpp-ring { position: absolute; inset: 0; border-radius: 9999px; 12 border: 1.5px solid rgba(139,92,246,.5); animation: vppRing 2.6s ease-out infinite; } 13 .vpp-ring-2 { animation-delay: 1.3s; } 14 @keyframes vppRing { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(2.1); opacity: 0; } } 15 .vpp-wave { display: inline-flex; align-items: center; gap: 2px; } 16 .vpp-wave i { display: block; width: 2.5px; border-radius: 2px; background: rgba(255,255,255,.95); } 17 .vpp-bars-sm i { height: 8px; } .vpp-bars-lg i { height: 18px; } 18 .vpp-bars-lg { gap: 3.5px; } .vpp-bars-lg i { width: 4px; } 19 .vpp-wave:not(.vpp-wave-still) i { animation: vppBar 1.1s ease-in-out infinite; } 20 .vpp-wave i:nth-child(1) { animation-delay: 0s; } 21 .vpp-wave i:nth-child(2) { animation-delay: .15s; } 22 .vpp-wave i:nth-child(3) { animation-delay: .3s; } 23 .vpp-wave i:nth-child(4) { animation-delay: .45s; } 24 .vpp-wave i:nth-child(5) { animation-delay: .6s; } 25 .vpp-wave-still i:nth-child(odd) { transform: scaleY(.6); } 26 @keyframes vppBar { 0%,100% { transform: scaleY(.4); } 50% { transform: scaleY(1.6); } } 27 .vpp-enter { animation: vppUp .35s cubic-bezier(.2,.9,.3,1) both; } 28 @keyframes vppUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } } 29 .vpp-chip { animation: vppUp .4s cubic-bezier(.2,.9,.3,1) both; } 30 .vpp-hero { position: relative; border-radius: 22px; padding: 1.5px; overflow: hidden; } 31 .vpp-hero::before { content: ''; position: absolute; inset: -60%; 32 background: conic-gradient(from 0deg, rgba(99,102,241,.9), rgba(217,70,239,.8), rgba(56,189,248,.7), rgba(99,102,241,.9)); 33 animation: vppSpin 5s linear infinite; } 34 @keyframes vppSpin { to { transform: rotate(360deg); } } 35 .vpp-hero-inner { position: relative; border-radius: 21px; } 36 .vpp-shimmer { background: linear-gradient(90deg, currentColor 40%, rgba(165,180,252,1) 50%, currentColor 60%); 37 background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; 38 -webkit-text-fill-color: transparent; animation: vppShimmer 1.6s linear infinite; } 39 @keyframes vppShimmer { to { background-position: -200% 0; } } 40 .vpp-title { background: linear-gradient(100deg, #e0e7ff, #a78bfa, #f0abfc); 41 -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; } 42 @media (prefers-reduced-motion: reduce) { 43 .vpp-aurora-a, .vpp-aurora-b, .vpp-wave i, .vpp-enter, .vpp-chip, 44 .vpp-ring, .vpp-hero::before { animation: none !important; } 45 .vpp-shimmer { animation: none !important; -webkit-text-fill-color: currentColor; background: none; } 46 } 47 `}),e.jsx("div",{className:"vpp-aurora vpp-aurora-a"}),e.jsx("div",{className:"vpp-aurora vpp-aurora-b"}),K&&e.jsxs("div",{className:"absolute inset-0 z-40",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:()=>k(!1)}),e.jsxs("div",{className:"absolute inset-y-0 left-0 w-[78%] max-w-xs flex flex-col bg-slate-900 dark:bg-slate-900 light:bg-white border-r border-slate-800 dark:border-slate-800 light:border-slate-200 animate-slideIn",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 pt-4 pb-2",children:[e.jsx("span",{className:"text-sm font-semibold text-white dark:text-white light:text-slate-900",children:t("copilot.history")}),e.jsx("button",{onClick:()=>{R(),k(!1)},"aria-label":t("copilot.newChat"),className:"p-2 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800 transition-colors",children:e.jsx(z,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-2 py-1",children:[(V||[]).length===0&&e.jsx("p",{className:"px-3 py-4 text-[13px] text-slate-500",children:t("copilot.historyEmpty")}
47),(V||[]).map(l=>e.jsx("button",{onClick:()=>{F(!1),r(l.id),k(!1)},className:`w-full text-left px-3 py-2.5 rounded-xl text-[13.5px] truncate transition-colors ${l.id===o?"bg-indigo-500/15 text-indigo-200 dark:text-indigo-200 light:text-indigo-700":"text-slate-300 dark:text-slate-300 light:text-slate-700 hover:bg-slate-800/70"}`,children:l.title||t("copilot.newChat")},l.id))]}),e.jsx("div",{className:"p-3 border-t border-slate-800 dark:border-slate-800 light:border-slate-200",children:e.jsxs("button",{onClick:T,className:"w-full flex items-center justify-center gap-2 px-3 py-2.5 rounded-xl text-[13.5px] font-semibold text-white bg-gradient-to-r from-indigo-500 to-violet-600 shadow-lg shadow-indigo-950/40 active:scale-95 transition-transform",children:[e.jsx(M,{className:"w-4 h-4"}),t(u==="inbound"?"copilot.exitToInbound":"copilot.exitToDashboard")]})})]})]}),e.jsxs("div",{className:"relative z-10 lg:hidden flex items-center justify-between px-2 pt-2",children:[e.jsx("button",{onClick:()=>k(!0),"aria-label":t("copilot.history"),className:"p-2.5 rounded-xl text-slate-300 hover:text-white hover:bg-slate-800/70 transition-colors",children:e.jsx(ae,{className:"w-6 h-6"})}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(I,{size:"sm",active:!1}),e.jsxs("div",{className:"flex flex-col leading-tight text-left",children:[e.jsx("span",{className:"text-[15px] font-semibold text-white dark:text-white light:text-slate-900",children:t("nav.copilot")}),e.jsx("span",{className:"text-[10.5px] font-medium tracking-wide text-slate-400 dark:text-slate-400 light:text-slate-500",children:t("copilot.headerSubtitle")})]})]}),e.jsxs("button",{onClick:T,className:"flex items-center gap-1 text-[11.5px] font-semibold text-indigo-300 hover:text-indigo-200 dark:text-indigo-300 light:text-indigo-600 bg-indigo-500/12 hover:bg-indigo-500/20 border border-indigo-400/30 rounded-full px-2.5 py-1 transition-colors",children:[e.jsx(M,{className:"w-3 h-3"}),t(u==="inbound"?"copilot.exitToInbound":"copilot.exitToDashboard")]})]}),e.jsx("button",{onClick:R,"aria-label":t("copilot.newChat"),className:"p-2.5 rounded-xl text-slate-300 hover:text-white hover:bg-slate-800/70 transition-colors",children:e.jsx(z,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"relative z-10 w-full max-w-3xl mx-auto px-4 pt-2.5 flex items-center gap-2",children:[e.jsxs("div",{className:"hidden lg:flex items-center gap-1.5",children:[e.jsxs("button",{onClick:()=>k(!0),className:"flex items-center gap-1.5 px-3 py-2 rounded-full text-xs font-medium text-slate-300 hover:text-white bg-slate-800/70 dark:bg-slate-800/70 light:bg-white light:text-slate-600 border border-slate-700/50 dark:border-slate-700/50 light:border-slate-200 backdrop-blur transition-colors",children:[e.jsx(ae,{className:"w-3.5 h-3.5"}),t("copilot.history")]}),e.jsxs("button",{onClick:R,className:"flex items-center gap-1.5 px-3 py-2 rounded-full text-xs font-medium text-slate-300 hover:text-white bg-slate-800/70 dark:bg-slate-800/70 light:bg-white light:text-slate-600 border border-slate-700/50 dark:border-slate-700/50 light:border-slate-200 backdrop-blur transition-colors",children:[e.jsx(z,{className:"w-3.5 h-3.5"}),t("copilot.newChat")]})]}),e.jsxs("button",{onClick:T,className:"hidden lg:flex ml-auto items-center gap-1.5 px-3 py-1.5 rounded-full text-[11px] font-medium text-slate-400 hover:text-slate-200 dark:text-slate-400 light:text-slate-500 border border-slate-700/50 dark:border-slate-700/50 light:border-slate-200 hover:border-slate-600 transition-colors",children:[e.jsx(M,{className:"w-3 h-3"}),t(u==="inbound"?"copilot.exitToInbound":"copilot.exitToDashboard")]})]}),e.jsx("div",{className:"relative z-10 flex-1 overflow-y-auto",children:e.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-3 flex flex-col gap-4 min-h-full",children:[me?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center py-4",children:[e.jsx("div",{className:"vpp-enter mb-6",children:e.jsx(I,{size:"lg",active:!0,rings:!0})}),J&&e.jsx("p",{className:"text-sm text-slate-400 mb-1 vpp-enter",style:{animationDelay:".05s"},children:t("copilot.hello",{name:J})}),e.jsx("h2",{className:"vpp-title text-[27px] leading-tight font-bold mb-2 vpp-enter",style:{animationDelay:".08s"},children:t("copilot.emptyTitle")}),e.jsx("p",{className:"text-[13px] text-slate-400 mb-7 max-w-[270px] leading-relaxed vpp-enter",style:{animationDelay:".12s"},children:t("copilot.emptySubtitle")}
47),e.jsx(ie,{heroChip:H,chips:X,chipIcons:Z,send:L})]}):e.jsxs(e.Fragment,{children:[b.map(l=>l.role==="user"?e.jsx(We,{msg:l},l.id):e.jsx(Ye,{msg:l,t,navigate:n,onProposal:de,actionPending:W.isPending},l.id)),v&&e.jsx(He,{progress:f,t}),ue&&e.jsx(ie,{heroChip:H,chips:X,chipIcons:Z,send:L,className:"pt-1 pb-2"})]}),e.jsx("div",{ref:Q})]})}),G&&!c&&e.jsx("div",{className:"relative z-10 max-w-3xl mx-auto w-full px-4 pb-2",children:e.jsx("div",{className:"px-4 py-3 rounded-2xl bg-amber-500/10 border border-amber-500/30 text-sm text-amber-300 vpp-enter",children:t("copilot.answerLost")})}),c&&e.jsx("div",{className:"relative z-10 max-w-3xl mx-auto w-full px-4 pb-2",children:e.jsxs("div",{"data-testid":"copilot-send-error",className:"px-4 py-3 rounded-2xl bg-amber-500/10 border border-amber-500/30 text-sm text-amber-300 vpp-enter",children:[c==="quota"&&e.jsxs(e.Fragment,{children:[t("copilot.quotaReached")," ",e.jsx("button",{onClick:()=>n("/billing"),className:"underline font-medium",children:t("copilot.upgradeLink")})]}),c==="customPrompt"&&t("copilot.errorCustomPrompt"),c==="busy"&&t("copilot.busy"),c==="tooLong"&&t("copilot.tooLong",{max:j}),c==="generic"&&t("copilot.errorGeneric")]})}),e.jsxs("div",{className:"relative z-10 w-full max-w-3xl mx-auto px-4 pt-1",style:{paddingBottom:"max(1rem, env(safe-area-inset-bottom))"},children:[e.jsxs("div",{className:"flex items-end gap-2 rounded-[26px] bg-slate-800/80 dark:bg-slate-800/80 light:bg-white border border-slate-700/60 dark:border-slate-700/60 light:border-slate-300 backdrop-blur-xl px-4 py-2 shadow-2xl shadow-slate-950/50 focus-within:border-indigo-500/70 transition-colors",children:[e.jsx("textarea",{ref:ce,value:i,onChange:l=>a(l.target.value),onKeyDown:pe,rows:1,placeholder:t("copilot.placeholder"),disabled:v,className:"flex-1 resize-none bg-transparent py-2 text-white dark:text-white light:text-slate-900 placeholder-slate-500 focus:outline-none disabled:opacity-60 max-h-32",style:{fontSize:"16px"}}),e.jsx("button",{onClick:()=>L(),disabled:v||!i.trim()||i.length>j,"aria-label":t("copilot.send"),className:"mb-1 w-9 h-9 shrink-0 rounded-full bg-gradient-to-br from-indigo-500 to-violet-600 text-white flex items-center justify-center shadow-lg shadow-indigo-950/50 disabled:opacity-35 disabled:cursor-not-allowed active:scale-95 transition-all",children:e.jsx(qe,{className:"w-5 h-5",strokeWidth:2.5})})]}),i.length>=Pe&&e.jsx("p",{"data-testid":"copilot-char-count",className:`mt-1.5 text-[11px] text-right ${i.length>j?"text-amber-400":"text-slate-500"}`,children:t("copilot.charCount",{count:i.length,max:j})}),ge&&e.jsx("p",{className:"mt-1.5 text-[11px] text-slate-600 text-center",children:t("copilot.quotaLeft",{used:$.used,limit:$.limit})})]})]})}export{j as MAX_MESSAGE_CHARS,Qe as TRADES_WITH_PROMPTS,tt as default,Fe as isTooLongError,Ve as resolveTrade};
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.