PageSourceSearch

https://mnlafrica.com/assets/ChatBot-CuUFKpMy.js

js mnlafrica.com collected 2026-10-04 22:13:36 UTC 10,606 bytes, 8 lines download raw bytes

1import{c as Y,r as o,j as e,X as C,M as P,S as $,a as K,L as Z,b as H}from"./index-BHy_VioW.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const W=Y("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),q="https://mmvlfjjuoahbbywprdic.supabase.co/functions/v1/chat",I="mnl-chat-history-v1",B="mnl-chat-session-id",D="mnl-chat-nudge-dismissed",Q=30;function ee(){var a;if(typeof window>"u")return"ssr";let s=localStorage.getItem(B);return s||(s=((a=crypto.randomUUID)==null?void 0:a.call(crypto))??`${Date.now()}-${Math.random().toString(36).slice(2)}`,localStorage.setItem(B,s)),s}const k={role:"assistant",content:"Welcome. I am the **Summit Concierge** for the MNL Africa Leadership Circle 2026. How may I assist with the programme archive, institutional sponsorship, or 2027 priority enrolment?"},te=["View the 2-day programme","Sponsorship tiers & benefits","How to pre-register for 2027","About the scholarship initiative"],E={register:{label:"Register interest",target:"contact",type:"scroll"},sponsor:{label:"Explore partnership tiers",target:"sponsorship",type:"scroll"},schedule:{label:"Inspect programme",target:"schedule",type:"scroll"},calendar:{label:"Add to calendar",target:"contact",type:"scroll"},contact:{label:"Contact secretariat",target:"contact",type:"scroll"}},se=/\[ACTION:(\w+)\]/gi;function re(s){const a=[];return{text:s.replace(se,(g,y)=>{const p=String(y).toLowerCase();return E[p]&&!a.includes(p)&&a.push(p),""}).trim(),actions:a}}function ne(){const[s,a]=o.useState(!1),[i,g]=o.useState(()=>{if(typeof window>"u")return[k];try{const t=localStorage.getItem(I);if(t){const r=JSON.parse(t);if(Array.isArray(r)&&r.length)return r}}catch{}return[k]}),[y,p]=o.useState(""),[f,O]=o.useState(!1),[z,v]=o.useState(!1),A=o.useRef(null),R=o.useRef(null);o.useEffect(()=>{try{const t=i.slice(-Q);localStorage.setItem(I,JSON.stringify(t))}catch{}},[i]),o.useEffect(()=>{var t;(t=A.current)==null||t.scrollIntoView({behavior:"smooth"})},[i,s]),o.useEffect(()=>{if(s||sessionStorage.getItem(D))return;const t=setTimeout(()=>{v(!0);const r=setTimeout(()=>v(!1),8e3);return()=>clearTimeout(r)},2e4);return()=>clearTimeout(t)},[s]);const T=()=>{v(!1),sessionStorage.setItem(D,"1")},L=()=>{a(t=>!t),T(),setTimeout(()=>{var t;return(t=R.current)==null?void 0:t.focus()},100)},G=()=>{g([k]);try{localStorage.removeItem(I)}catch{}},F=t=>{const r=E[t];if(!r)return;const l=document.getElementById(r.target);l&&(l.scrollIntoView({behavior:"smooth",block:"start"}),a(!1))},j=async t=>{var u,x,M;const r=(t??y).trim();if(!r||f)return;const l={role:"user",content:r};p(""),g(n=>[...n,l]),O(!0);let m="";try{const n=await fetch(q,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im1tdmxmamp1b2FoYmJ5d3ByZGljIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzE0ODE1MTcsImV4cCI6MjA4NzA1NzUxN30.r4EY1BSK85R0CRmuR-iEZGBvuse61CLJmJTVzUmffHo"},body:JSON.stringify({messages:[...i,l],sessionId:ee(),pageUrl:typeof window<"u"?window.location.href:void 0})});if(n.status===429)throw new Error("Our concierge is currently engaged. Please re-attempt shortly.");if(n.status===402)throw new Error("Service temporarily unavailable.");if(!n.ok||!n.body)throw new Error("Connection failed");const N=n.body.getReader(),w=new TextDecoder;let d="",_=!1;const X=S=>{m+=S,g(b=>_?b.map((h,c)=>c===b.length-1?{...h,content:m}:h):(_=!0,[...b,{role:"assistant",content:m}]))};for(;;){const{done:S,value:b}=await N.read();if(S)break;d+=w.decode(b,{stream:!0});let h;for(;(h=d.indexOf(`
7`))!==-1;){let c=d.slice(0,h);if(d=d.slice(h+1),c.endsWith("\r")&&(c=c.slice(0,-1)),!c.startsWith("data: "))continue;const J=c.slice(6).trim();if(J==="[DONE]")break;try{const U=(M=(x=(u=JSON.parse(J).choices)==null?void 0:u[0])==null?void 0:x.delta)==null?void 0:M.content;U&&X(U)}catch{d=c+`
8`+d;break}}}}catch(n){const N=n instanceof Error?n.message:"Connection interruption";g(w=>[...w,{role:"assistant",content:`${N} Please re-attempt or contact the secretariat at [email protected].`}])}finally{O(!1)}},V=o.useMemo(()=>!f&&i.length<=1,[f,i.length]);return e.jsxs(e.Fragment,{children:[z&&!s&&e.jsxs("div",{className:"fixed bottom-20 right-6 z-50 max-w-[270px] px-4 py-3 rounded-[2px] shadow-2xl animate-fade-up cursor-pointer",style:{background:"hsl(var(--ivory))",border:"1px solid hsl(var(--navy) / 0.15)",borderTop:"2px solid hsl(var(--gold))"},onClick:L,children:[e.jsx("span",{className:"dispatch-badge-subtle mb-1 block",children:"[ EXECUTIVE CONCIERGE ]"}),e.jsx("p",{className:"text-xs leading-snug font-display font-bold text-navy-deep",children:"Summit Inquiries & 2027 Enrolment?"}),e.jsx("p",{className:"text-[11px] mt-1 text-navy/70",children:"Click here to consult the Summit Concierge."}),e.jsx("button",{onClick:t=>{t.stopPropagation(),T()},className:"absolute top-1.5 right-1.5 p-1 opacity-50 hover:opacity-100","aria-label":"Dismiss",children:e.jsx(C,{size:12,style:{color:"hsl(var(--navy))"}})})]}),e.jsxs("button",{onClick:L,className:"fixed bottom-6 right-6 z-50 h-11 px-3.5 rounded-[2px] flex items-center gap-2 shadow-2xl transition-all duration-200 group",style:{background:"hsl(var(--navy-deep))",border:"1px solid hsl(var(--gold) / 0.7)",boxShadow:"0 10px 30px rgba(7,11,20,0.4)"},"aria-label":"Open concierge chat",children:[s?e.jsxs(e.Fragment,{children:[e.jsx(C,{size:14,style:{color:"hsl(var(--gold))"}}),e.jsx("span",{className:"font-mono text-[11px] uppercase tracking-[0.2em] font-semibold text-ivory",children:"Close"})]}):e.jsxs(e.Fragment,{children:[e.jsx(P,{size:14,style:{color:"hsl(var(--gold))"}}),e.jsx("span",{className:"font-mono text-[11px] uppercase tracking-[0.2em] font-semibold text-ivory",children:"[ Concierge ]"})]}),z&&!s&&e.jsx("span",{className:"w-2 h-2 rounded-[1px] rotate-45 bg-gold animate-pulse"})]}),s&&e.jsxs("div",{className:"fixed bottom-20 right-6 z-50 w-[380px] max-w-[calc(100vw-2rem)] h-[560px] max-h-[calc(100vh-7rem)] flex flex-col overflow-hidden rounded-[2px] animate-fade-up",style:{background:"hsl(var(--cream))",border:"1px solid hsl(var(--gold) / 0.5)",boxShadow:"0 24px 60px rgba(7,11,20,0.35)"},children:[e.jsx("div",{className:"px-5 pt-4 pb-3",style:{background:"hsl(var(--ivory))",borderBottom:"1px solid hsl(var(--gold) / 0.4)"},children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-[1px] rotate-45 flex items-center justify-center flex-shrink-0",style:{background:"hsl(var(--burgundy))",border:"1px solid hsl(var(--gold) / 0.7)"},children:e.jsx($,{size:13,className:"-rotate-45",style:{color:"hsl(var(--gold))"}})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-display text-base font-bold leading-tight",style:{color:"hsl(var(--navy-deep))"},children:"Summit Concierge"}),e.jsx("p",{className:"font-mono text-[9px] uppercase tracking-[0.22em] text-burgundy font-semibold",children:"MNL Africa Secretariat"})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[i.length>1&&e.jsx("button",{onClick:G,className:"p-1.5 rounded-[2px] transition-opacity opacity-60 hover:opacity-100",style:{color:"hsl(var(--navy-deep))"},"aria-label":"Reset conversation",title:"Clear session",children:e.jsx(W,{size:14})}),e.jsx("button",{onClick:()=>a(!1),className:"p-1.5 rounded-[2px] transition-opacity opacity-60 hover:opacity-100",style:{color:"hsl(var(--navy-deep))"},"aria-label":"Close",children:e.jsx(C,{size:16})})]})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-3",children:[i.map((t,r)=>{const{text:l,actions:m}=t.role==="assistant"?re(t.content):{text:t.content,actions:[]},u=t.role==="user";return e.jsx("div",{className:`flex ${u?"justify-end":"justify-start"}`,children:e.jsx("div",{className:"max-w-[85%] px-3.5 py-2.5 text-[13px] leading-relaxed rounded-[2px]",style:u?{background:"hsl(var(--navy-deep))",color:"hsl(var(--ivory))",border:"1px solid hsl(var(--gold) / 0.3)"}:{background:"hsl(var(--ivory))",color:"hsl(var(--navy-deep))",border:"1px solid hsl(var(--navy) / 0.12)",borderLeft:"2px s
8olid hsl(var(--burgundy))"},children:u?l:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"prose prose-sm max-w-none [&_p]:m-0 [&_p+p]:mt-2 [&_ul]:my-1.5 [&_ul]:pl-4 [&_li]:my-0.5 [&_strong]:text-burgundy [&_strong]:font-semibold",children:e.jsx(K,{children:l||"…"})}),m.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3 pt-2.5 border-t border-navy/10",children:m.map(x=>e.jsx("button",{onClick:()=>F(x),className:"font-mono text-[10px] uppercase tracking-[0.14em] px-2.5 py-1.5 rounded-[2px] transition-colors",style:{background:"hsl(var(--burgundy))",color:"hsl(var(--ivory))"},children:E[x].label},x))})]})})},r)}),f&&e.jsx("div",{className:"flex justify-start",children:e.jsxs("div",{className:"px-3.5 py-2.5 flex items-center gap-2 rounded-[2px] bg-ivory border",style:{borderColor:"hsl(var(--navy) / 0.12)",borderLeft:"2px solid hsl(var(--burgundy))"},children:[e.jsx(Z,{size:13,className:"animate-spin text-burgundy"}),e.jsx("span",{className:"font-mono text-[11px] text-navy/60 uppercase tracking-wider",children:"Synthesizing response…"})]})}),e.jsx("div",{ref:A})]}),V&&e.jsxs("div",{className:"px-4 pb-2",children:[e.jsx("p",{className:"font-mono text-[9px] uppercase tracking-[0.2em] text-navy/50 mb-1.5 font-semibold",children:"Suggested Prompts"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:te.map(t=>e.jsx("button",{onClick:()=>j(t),className:"font-mono text-[10px] uppercase tracking-wider px-2.5 py-1.5 rounded-[2px] transition-colors bg-ivory text-navy-deep border border-navy/15 hover:border-gold hover:bg-navy-deep hover:text-gold",children:t},t))})]}),e.jsxs("div",{className:"px-3 py-3 flex gap-2 border-t",style:{borderColor:"hsl(var(--navy) / 0.12)",background:"hsl(var(--ivory))"},children:[e.jsx("input",{ref:R,value:y,onChange:t=>p(t.target.value),onKeyDown:t=>t.key==="Enter"&&j(),placeholder:"Ask the Summit Concierge…",className:"flex-1 px-3 py-2 text-xs rounded-[2px] bg-cream border border-navy/20 focus:border-burgundy outline-none transition-colors text-navy-deep"}),e.jsx("button",{onClick:()=>j(),disabled:f||!y.trim(),className:"w-9 h-9 flex items-center justify-center rounded-[2px] disabled:opacity-40 transition-all btn-arch-burgundy !p-0","aria-label":"Send inquiry",children:e.jsx(H,{size:13})})]})]})]})}export{ne 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.