PageSourceSearch

https://wowworld.io/assets/ChatBot-D7sSa5fg.js

js wowworld.io collected 2026-10-07 15:40:39 UTC 6,761 bytes, 1 lines download raw bytes

1import{r as a,u as C,j as e,X as M}from"./index-DVUiJX_q.js";import{S as O}from"./send--cscCxTc.js";const R={role:"assistant",isWelcome:!0,content:"Hey! I'm **WOW**, your guide to **WOW WORLD AI Community**. Are you an artist looking to get featured, or do you have a question about something?"};function D(s){return s.split(/(\*\*[^*]+\*\*|\[[^\]]+\]\([^)]+\))/g).map((n,r)=>{if(n.startsWith("**")&&n.endsWith("**"))return e.jsx("strong",{style:{fontWeight:600},children:n.slice(2,-2)},r);const l=n.match(/^\[([^\]]+)\]\(([^)]+)\)$/);return l?e.jsx("a",{href:l[2],target:"_blank",rel:"noopener noreferrer","data-testid":`link-${r}`,style:{color:"#0e1f5e",textDecoration:"underline",fontWeight:500},children:l[1]},r):e.jsx("span",{children:n},r)})}function w({size:s=24}){return e.jsxs("svg",{width:s,height:s,viewBox:"0 0 40 40",fill:"none","aria-hidden":"true",children:[e.jsx("path",{d:"M20 7c8.3 0 15 5.2 15 11.6 0 6.4-6.7 11.6-15 11.6-1.6 0-3.2-.2-4.6-.6l-7.2 3.3a.8.8 0 0 1-1.1-.9l1.3-5.6C5 24.4 5 21.6 5 18.6 5 12.2 11.7 7 20 7Z",fill:"#fff"}),e.jsx("path",{d:"M20.4 12.4l1.5 3.6 3.6 1.5-3.6 1.5-1.5 3.6-1.5-3.6-3.6-1.5 3.6-1.5 1.5-3.6Z",fill:"#d92b2b"}),e.jsx("circle",{cx:"14",cy:"24",r:"1.5",fill:"#0e1f5e"}),e.jsx("circle",{cx:"26.6",cy:"24",r:"1.5",fill:"#0e1f5e"})]})}function z(){const[s,h]=a.useState(!1),[n,r]=a.useState([]),[l,m]=a.useState(""),[d,f]=a.useState(!1),g=a.useRef(null),b=a.useRef(null),[x]=C(),y=a.useRef(""),v=x.startsWith("/admin")||x.startsWith("/checkout/")||x.startsWith("/thenewprotocol");a.useEffect(()=>{g.current?.scrollIntoView({behavior:"smooth"})},[n,d]),a.useEffect(()=>{s&&b.current?.focus()},[s]),a.useEffect(()=>{s&&(y.current=crypto.randomUUID(),p.current=!1,r([R]))},[s]);const p=a.useRef(!1),W=()=>{if(!p.current&&n.filter(o=>o.role==="user").length>0){p.current=!0;const o=n.filter(i=>!i.isWelcome);fetch("/api/chat/summarize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:y.current,history:o,messageCount:o.length})}).catch(()=>{})}h(!1)},k=async()=>{const t=l.trim();if(!t||d)return;const o={role:"user",content:t};r(i=>[...i,o]),m(""),f(!0);try{const i=n.filter(c=>!c.isWelcome).slice(-6),u=await(await fetch("/api/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:t,history:i})})).json(),j=u.reply||"Sorry, I couldn't process that.",N=Math.min(Math.max(j.length*12,600),3e3);await new Promise(c=>setTimeout(c,N)),r(c=>[...c,{role:"assistant",content:j}]),u.upsale&&setTimeout(()=>{f(!0);const c=Math.min(Math.max(u.upsale.length*12,600),3e3);setTimeout(()=>{r(S=>[...S,{role:"assistant",content:u.upsale}]),f(!1)},c)},5e3)}catch{r(i=>[...i,{role:"assistant",content:"Sorry, I'm having trouble right now. Please try again or visit our [Contact page](/contact)."}])}finally{f(!1)}};return v?null:e.jsxs(e.Fragment,{children:[!s&&e.jsx("button",{"data-testid":"button-chatbot-toggle",onClick:()=>h(!0),className:"fixed bottom-6 right-5 z-50 w-14 h-14 rounded-full flex items-center justify-center shadow-lg transition-all duration-300 hover:opacity-90 border-none cursor-pointer ww-gradient-pulse",style:{background:"linear-gradient(135deg, #0e1f5e 0%, #1e3fae 30%, #d92b2b 60%, #0e1f5e 100%)",backgroundSize:"300% 300%",boxShadow:"0 4px 24px rgba(30,63,174,0.45)"},"aria-label":"Open WOW assistant",children:e.jsx(w,{size:30})}),s&&e.jsxs("div",{"data-testid":"panel-chatbot",className:"fixed bottom-6 right-5 z-50 flex flex-col",style:{width:"min(400px, calc(100vw - 40px))",height:"min(580px, calc(100vh - 100px))",borderRadius:"16px",overflow:"hidden",boxShadow:"0 8px 40px rgba(14,31,94,0.22)",background:"#fff"},children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 flex-shrink-0",style:{background:"#0e1f5e"},children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-9 h-9 rounded-full flex items-center justify-center",style:{background:"rgba(255,255,255,0.12)"},children:e.jsx(w,{size:22})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-heading leading-none mb-0.5",style:{color:"#fff",fontWeight:800},children:"WOW"}),e.jsx("span",{className:"text-[0.58rem] font-sans",style:{color:"rgba(255,255,255,0.5)"},children:"Your WOW WORLD Assistant"})]})]}),e.jsx("button",{"data-testid":"button-chatbot-close",onClick:W,className:"w-7 h-7 rounded-full flex items-center justify-center transition-all hover:bg-[rgba(255,255,255,0.15)] border-none cursor-pointer",style:{background:"transparent",color:"rgba(255,255,255,0.7)"},"aria-label":"Close chat",children:e.jsx(M,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 flex flex-col gap-3",style:{background:"#f8f8f8"},children:[n.map((t,o)=>e.jsx("div",{children:e.jsx("div",{className:`flex ${t.role==="user"?"justify-end":"justify-start"}`,children:e.jsx("div",{"data-testid":`chat-message-${o}`,className:"max-w-[88%] px-3.5 py-2.5 text-[0.8rem] leading-relaxed whitespace-pre-line",style:{borderRadius:t.role==="user"?"14px 14px 4px 14px":"14px 14px 14px 4px",background:t.role==="user"?"#0e1f5e":"#fff",color:t.role==="user"?"#fff":"#333",fontFamily:"'DM Sans', sans-serif",fontWeight:300,boxShadow:t.role==="assistant"?"0 1px 4px rgba(0,0,0,0.06)":"none"},children:D(t.content)})})},o)),d&&e.jsx("div",{className:"flex justify-start",children:e.jsxs("div",{className:"px-4 py-3 rounded-2xl flex gap-1.5 items-center",style:{background:"#fff",boxShadow:"0 1px 4px rgba(0,0,0,0.06)"},children:[e.jsx("span",{className:"w-2 h-2 rounded-full animate-bounce",style:{background:"#0e1f5e",animationDelay:"0ms"}}),e.jsx("span",{className:"w-2 h-2 rounded-full animate-bounce",style:{background:"#0e1f5e",animationDelay:"150ms"}}),e.jsx("span",{className:"w-2 h-2 rounded-full animate-bounce",style:{background:"#0e1f5e",animationDelay:"300ms"}})]})}),e.jsx("div",{ref:g})]}),e.jsxs("form",{onSubmit:t=>{t.preventDefault(),k()},className:"flex items-center gap-2 px-3 py-3 flex-shrink-0",style:{background:"#fff",borderTop:"1px solid rgba(14,31,94,0.08)"},children:[e.jsx("input",{ref:b,"data-testid":"input-chatbot",type:"text",placeholder:"Type your message...",value:l,onCh
1ange:t=>m(t.target.value),disabled:d,className:"flex-1 text-[0.82rem] py-2.5 px-3.5 rounded-full outline-none border-none font-sans",style:{background:"#f4f4f5",color:"#222",fontWeight:300}}),e.jsx("button",{"data-testid":"button-chatbot-send",type:"submit",disabled:d||!l.trim(),className:"w-9 h-9 rounded-full flex items-center justify-center border-none cursor-pointer transition-all duration-200 flex-shrink-0 disabled:opacity-40",style:{background:"#d92b2b",color:"#fff"},"aria-label":"Send message",children:e.jsx(O,{className:"w-4 h-4"})})]})]})]})}export{z as ChatBot};

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.