@botuyo/chat-widget-standalone 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AudioPlayer-Ct3Sv6yG.js → AudioPlayer-psMsUi_m.js} +2 -2
- package/dist/{AudioPlayer-Ct3Sv6yG.js.map → AudioPlayer-psMsUi_m.js.map} +1 -1
- package/dist/{Gallery-B9V--YyD.js → Gallery-DhyAxYyS.js} +2 -2
- package/dist/{Gallery-B9V--YyD.js.map → Gallery-DhyAxYyS.js.map} +1 -1
- package/dist/botuyo-chat.es.js +1 -1
- package/dist/botuyo-chat.umd.js +1 -1
- package/dist/botuyo-chat.umd.js.map +1 -1
- package/dist/src/chat-widget/components/VoiceCallOverlay.d.ts.map +1 -1
- package/dist/{standalone-C64G8PjX.js → standalone-UaQcV7og.js} +3 -3
- package/dist/{standalone-C64G8PjX.js.map → standalone-UaQcV7og.js.map} +1 -1
- package/dist/stats-umd.html +1 -1
- package/dist/stats.html +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoiceCallOverlay.d.ts","sourceRoot":"","sources":["../../../../src/chat-widget/components/VoiceCallOverlay.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAUH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAUlD,8CAA8C;AAC9C,MAAM,WAAW,kBAAkB;IACjC,0DAA0D;IAC1D,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,8DAA8D;IAC9D,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,2DAA2D;IAC3D,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,4DAA4D;IAC5D,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,yEAAyE;IACzE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,mDAAmD;IACnD,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,kDAAkD;IAClD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,wDAAwD;IACxD,aAAa,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAC/C,qCAAqC;IACrC,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAA;IACjD,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gDAAgD;IAChD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,gDAAgD;IAChD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,UAAU,qBAAqB;IAC7B,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,GAAG,CAAA;IACrB,OAAO,CAAC,EAAE,gBAAgB,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,2DAA2D;IAC3D,WAAW,CAAC,EAAE,kBAAkB,CAAA;IAChC,qEAAqE;IACrE,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,IAAI,CAAA;KAAE,KAAK,IAAI,CAAA;CAChG;AAED,KAAK,SAAS,GAAG,MAAM,GAAG,YAAY,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,CAAA;AAuY9E,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,OAAO,EACP,YAAwB,EACxB,SAAS,EACT,OAAO,EACP,OAAO,EACP,WAAW,EACX,WAAW,EACX,YAAY,GACb,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"VoiceCallOverlay.d.ts","sourceRoot":"","sources":["../../../../src/chat-widget/components/VoiceCallOverlay.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAUH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAUlD,8CAA8C;AAC9C,MAAM,WAAW,kBAAkB;IACjC,0DAA0D;IAC1D,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,8DAA8D;IAC9D,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,2DAA2D;IAC3D,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,4DAA4D;IAC5D,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,yEAAyE;IACzE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,mDAAmD;IACnD,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,kDAAkD;IAClD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,wDAAwD;IACxD,aAAa,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAC/C,qCAAqC;IACrC,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAA;IACjD,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gDAAgD;IAChD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,gDAAgD;IAChD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,UAAU,qBAAqB;IAC7B,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,GAAG,CAAA;IACrB,OAAO,CAAC,EAAE,gBAAgB,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,2DAA2D;IAC3D,WAAW,CAAC,EAAE,kBAAkB,CAAA;IAChC,qEAAqE;IACrE,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,IAAI,CAAA;KAAE,KAAK,IAAI,CAAA;CAChG;AAED,KAAK,SAAS,GAAG,MAAM,GAAG,YAAY,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,CAAA;AAuY9E,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,OAAO,EACP,YAAwB,EACxB,SAAS,EACT,OAAO,EACP,OAAO,EACP,WAAW,EACX,WAAW,EACX,YAAY,GACb,EAAE,qBAAqB,kDAk/BvB"}
|
|
@@ -15,7 +15,7 @@ return y("div",{className:Et("flex items-center w-fit transition-all duration-50
|
|
|
15
15
|
/* @__PURE__ */b(W,{size:10}),
|
|
16
16
|
/* @__PURE__ */y("span",{children:[e.length," fuente",e.length>1?"s":""]}),
|
|
17
17
|
/* @__PURE__ */b("span",{className:"transition-transform duration-200",style:{transform:t?"rotate(180deg)":"rotate(0)"},children:"▾"})]}),t&&/* @__PURE__ */b("div",{className:"flex flex-wrap gap-1 mt-1 animate-in fade-in slide-in-from-top-1 duration-200",children:e.map((e,t)=>/* @__PURE__ */y("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-[10px] font-medium rounded-md",style:{backgroundColor:"hsl(var(--muted) / 0.4)",color:"hsl(var(--muted-foreground))"},children:[
|
|
18
|
-
/* @__PURE__ */b(W,{size:9}),e]},`${e}-${t}`))})]}):null}),Ul=p(()=>import("./AudioPlayer-
|
|
18
|
+
/* @__PURE__ */b(W,{size:9}),e]},`${e}-${t}`))})]}):null}),Ul=p(()=>import("./AudioPlayer-psMsUi_m.js").then(e=>({default:e.AudioPlayer}))),Vl=p(()=>import("./Gallery-DhyAxYyS.js").then(e=>({default:e.Gallery}))),ql=d(function({message:e,primaryColor:t,botAvatar:n,botName:r="BotUyo",avatars:i,isFirst:a=!0,isLast:s=!0,index:l=0}){const{t:c}=D("extracted"),d="user"===e.sender,p="system"===e.type||"system"===e.sender,f=!d&&!p,m=Ot({primaryColor:t}),g=function(){const e=o(Tt);return e.enabled&&"none"!==e.messageEntry?{slide:"animate-message-slide",fade:"animate-message-fade",scale:"animate-message-scale",spring:"animate-message-spring"}[e.messageEntry]||"animate-message-spring":""}(),w=u(()=>{if(d)return null;if("text"===e.type){const t=e;if(t.emotion&&i?.[t.emotion])return i[t.emotion]}return n},[e,i,n,d]),x=({href:e,children:t})=>{if(!e)return null;const n=String(t).toLowerCase(),r=n.includes("reservar")||n.includes("ver")||n.includes("pagar"),o=e.includes("maps.google")||e.includes("goo.gl")||e.includes("google.com/maps");let i=!1;try{i=new URL(e,window.location.origin).hostname===window.location.hostname}catch{}const a=i?t=>{t.preventDefault(),window.location.href=e}:void 0,s=i?void 0:"_blank",l=i?void 0:"noopener noreferrer";return o?/* @__PURE__ */b("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"block my-2 no-underline group",children:/* @__PURE__ */y("span",{className:"flex items-center gap-3 p-3 border rounded-xl shadow-sm group-hover:border-primary/30 transition-all",style:{backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))"},children:[
|
|
19
19
|
/* @__PURE__ */b("span",{className:"flex-shrink-0 p-2 rounded-full",style:{backgroundColor:`${m}1a`,color:m},children:/* @__PURE__ */b(G,{size:16,strokeWidth:2.5})}),
|
|
20
20
|
/* @__PURE__ */b("span",{className:"flex flex-col min-w-0 flex-1 text-[11px] font-bold text-foreground leading-tight uppercase tracking-tight",children:c("ver_ubicacion")}),
|
|
21
21
|
/* @__PURE__ */b(q,{size:12,className:"text-muted-foreground/40 group-hover:text-primary"})]})}):r?/* @__PURE__ */y("a",{href:e,target:s,rel:l,onClick:a,className:"inline-flex items-center justify-center gap-2 px-4 py-2.5 mt-2 mx-1 text-[11px] font-black w-[calc(100%-0.5rem)] sm:w-auto rounded-xl shadow-md uppercase tracking-widest transition-transform active:scale-95 text-white",style:{backgroundColor:m},children:[t," ",
|
|
@@ -91,7 +91,7 @@ return y("div",n&&!d?{className:"relative flex flex-col items-center gap-4",chil
|
|
|
91
91
|
/* @__PURE__ */b("div",{className:"absolute rounded-full",style:{inset:"12px",border:`1px solid ${g}15`,animation:m?"spin 12s linear infinite reverse":"none"}}),
|
|
92
92
|
/* @__PURE__ */b("div",{className:"absolute rounded-full flex items-center justify-center",style:{inset:"24px",background:`radial-gradient(circle at 35% 35%, ${g}40, ${g}10 60%, transparent 80%)`,boxShadow:m?`0 0 60px ${g}35, 0 0 120px ${g}15, inset 0 0 40px ${g}10`:`0 0 30px ${g}15`,transform:`scale(${v})`,transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)"},children:/* @__PURE__ */b("div",{className:"rounded-full",style:{width:.35*w+"px",height:.35*w+"px",background:`radial-gradient(circle, ${g}90, ${g}40)`,boxShadow:`0 0 20px ${g}60`,animation:m?"pulse 2s ease-in-out infinite":"none"}})}),m&&[0,1,2].map(e=>/* @__PURE__ */b("div",{className:"absolute rounded-full",style:{width:"4px",height:"4px",backgroundColor:g,opacity:.6,top:"50%",left:"50%",transform:`rotate(${120*e}deg) translateX(${(w+48)/2}px)`,animation:`spin ${6+2*e}s linear infinite`,boxShadow:`0 0 6px ${g}`}},e))]}),s.showWaveform&&/* @__PURE__ */b(xc,{isActive:m,audioLevel:a,color:g})]})}function xc({isActive:e,audioLevel:t,color:n}){/* @__PURE__ */
|
|
93
93
|
return b("div",{className:"flex items-center gap-[3px] h-10",children:Array.from({length:12}).map((r,o)=>{const i=Math.abs(o-5.5)/5.5,a=e?Math.max(4,40*t*(1-.5*i)*(.5+.5*Math.sin(.8*o))):4;/* @__PURE__ */
|
|
94
|
-
return b("div",{className:"rounded-full transition-all duration-100",style:{width:"3px",height:`${a}px`,backgroundColor:n,opacity:e?.7-.3*i:.2}},o)})})}function kc({isOpen:e,onClose:t,primaryColor:n="#10b981",getSocket:r,avatars:o,logoUrl:l,avatar3dUrl:c,voiceConfig:d,onAddMessage:p}){const h=u(()=>function(e,t="#10b981"){return{backgroundColor:e?.backgroundColor??"#0a0a0a",listeningColor:e?.listeningColor??"#10b981",speakingColor:e?.speakingColor??t,thinkingColor:e?.thinkingColor??"#a855f7",showEmojis:e?.showEmojis??!0,showEmotionLabel:e?.showEmotionLabel??!0,showWaveform:e?.showWaveform??!0,showBadge:e?.showBadge??!1,badgeText:e?.badgeText??"",emotionEmojis:{...mc,...e?.emotionEmojis},statusLabels:{...gc,...e?.statusLabels},orbSize:e?.orbSize??128,speakingScale:e?.speakingScale??1.08,thinkingScale:e?.thinkingScale??.95,avatar3dUrl:e?.avatar3dUrl}}(d,n),[d,n]),[m,g]=i("idle"),[w,x]=i(0),[k,_]=i(!1),[S,C]=i(0),[E,z]=i(null),[N,O]=i([]),[A,I]=i(!1),[T,M]=i(""),[P,L]=i(!1),D=f(null),j=f(null),F=f(null),R=f(null),$=f(null),B=f(0),U=f(!1),V=f(null),q=f(null),W=f(()=>{}),H=f(null),Z=f(0),K=f(null),G=f([]),Y=f(!1),te=f(0),ne=f([]),oe=s(e=>`${Math.floor(e/60)}:${(e%60).toString().padStart(2,"0")}`,[]),ie=s(()=>{if(0===G.current.length)return;K.current&&"closed"!==K.current.state||(K.current=new AudioContext({sampleRate:yc})),"suspended"===K.current.state&&K.current.resume().catch(()=>{});const e=K.current;Y.current=!0,g("speaking");const t=e.currentTime;for(te.current<t&&(te.current=t);G.current.length>0;){const t=G.current.shift(),n=e.createBuffer(1,t.length,yc);n.getChannelData(0).set(t);const r=e.createBufferSource();r.buffer=n,r.connect(e.destination),r.start(te.current),ne.current.push(r),r.onended=()=>{ne.current=ne.current.filter(e=>e!==r),0===ne.current.length&&0===G.current.length&&(Y.current=!1,g(e=>"speaking"===e?"listening":e))},te.current+=t.length/yc}},[]),se=f({}),le=s(()=>{const e=r?.();if(!e||U.current)return;const n=()=>{g("listening")},o=e=>{if(!e?.data)return;const t=function(e){const t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);const r=new Int16Array(n.buffer),o=new Float32Array(r.length);for(let i=0;i<r.length;i++)o[i]=r[i]/32768;return o}(e.data);G.current.push(t),ie(),fe()},i=()=>{ne.current.forEach(e=>{try{e.stop()}catch{}}),ne.current=[],G.current.length=0,te.current=0,Y.current=!1,g("listening")},a=()=>{},s=e=>{console.error("[VoiceCall] Voice error:",e)},l=e=>{e?.emotion&&(z(e.emotion),setTimeout(()=>z(t=>t===e.emotion?null:t),4e3))},c=e=>{e?.text&&(fe(),O(t=>{if(t.length>0&&"user"===t[t.length-1].role){const n=[...t],r=n[n.length-1].text,o=r.length>0&&!r.endsWith(" ")&&!e.text.startsWith(" ");return n[n.length-1]={...n[n.length-1],text:r+(o?" ":"")+e.text},n}return[...t,{role:"user",text:e.text}]}))},u=e=>{e?.text&&O(t=>{const n=t.map(e=>e.role).lastIndexOf("user");if(n>=0){const r=[...t];return r[n]={...r[n],text:e.text},r}return[...t,{role:"user",text:e.text}]})},d=e=>{e?.text&&O(t=>{const n=[...t];for(let o=n.length-1;o>=0;o--)if("user"===n[o].role&&n[o].text===e.original)return n[o]={...n[o],text:e.text},n;const r=n.map(e=>e.role).lastIndexOf("user");return r>=0?(n[r]={...n[r],text:e.text},n):t})},p=e=>{e?.text&&(fe(),O(t=>{if(t.length>0&&"bot"===t[t.length-1].role){const n=[...t],r=n[n.length-1].text,o=r.length>0&&!r.endsWith(" ")&&!e.text.startsWith(" ");return n[n.length-1]={...n[n.length-1],text:r+(o?" ":"")+e.text},n}return[...t,{role:"bot",text:e.text}]}))},h=()=>{g("thinking"),fe()},f=e=>{if(!e?.items?.length)return;fe();const t=e.items.map(t=>{if("search_accommodations"===e.tool){const e=t.options?.[0],n=e?`${e.totalPrice} ${e.currency}`:"",r=(t.features||[]).slice(0,3).join(" • "),o=t.cover?``:"",i=e?.link?`[Ver detalles](${e.link})`:"";return`${o}\n**${t.index}. ${t.title}**\n📍 ${t.location} ${t.rating?`⭐ ${t.rating}`:""}\n💰 ${n}\n${r}\n${i}`}if("get_accommodation_details"===e.tool){const e=(t.images||[]).slice(0,4).map(e=>``).join("\n"),n=t.specs?Object.entries(t.specs).map(([e,t])=>`${e}: ${t}`).join(" • "):"",r=(t.rooms||[]).map(e=>`• ${e.name}: ${e.price}`).join("\n"),o=t.rules?`🕐 Check-in: ${t.rules.checkIn||"-"} | Check-out: ${t.rules.checkOut||"-"} | Mascotas: ${t.rules.pets||"-"}`:"",i=t.seeMoreLink?`[Ver más detalles](${t.seeMoreLink})`:"";return`${e}\n**${t.title||t.name}**\n${t.description||""}\n${n}\n${r}\n${o}\n${i}`}return JSON.stringify(t)}).join("\n\n---\n\n");O(e=>[...e,{role:"bot",text:t}])};se.current={voiceReady:n,voiceAudioChunk:o,voiceInterrupted:i,voiceTurnComplete:a,voiceError:s,voiceEmotion:l,voiceUserTranscript:c,voiceUserTranscriptFinal:u,voiceUserTranscriptCorrected:d,voiceModelTranscript:p,voiceModelThinking:h,voiceToolVisual:f},e.on("voice_ready",n),e.on("voice_audio_chunk",o),e.on("voice_interrupted",i),e.on("voice_turn_complete",a),e.on("voice_error",s),e.on("voice_emotion",l),e.on("voice_user_transcript",c),e.on("voice_user_transcript_final",u),e.on("voice_user_transcript_corrected",d),e.on("voice_model_transcript",p),e.on("voice_model_thinking",h),e.on("voice_tool_visual",f),e.on("voice_timeout",()=>{W.current()});const m=e=>{O(e=>[...e,{role:"bot",text:"📞 Llamada finalizada."}]),setTimeout(()=>{t()},2500)};e.on("voice_call_ended",m),se.current.voiceCallEnded=m,U.current=!0},[r,ie]),ce=s(()=>{const e=r?.();if(!e||!U.current)return;const t=se.current;t.voiceReady&&e.off("voice_ready",t.voiceReady),t.voiceAudioChunk&&e.off("voice_audio_chunk",t.voiceAudioChunk),t.voiceInterrupted&&e.off("voice_interrupted",t.voiceInterrupted),t.voiceTurnComplete&&e.off("voice_turn_complete",t.voiceTurnComplete),t.voiceError&&e.off("voice_error",t.voiceError),t.voiceEmotion&&e.off("voice_emotion",t.voiceEmotion),t.voiceUserTranscript&&e.off("voice_user_transcript",t.voiceUserTranscript),t.voiceUserTranscriptFinal&&e.off("voice_user_transcript_final",t.voiceUserTranscriptFinal),t.voiceUserTranscriptCorrected&&e.off("voice_user_transcript_corrected",t.voiceUserTranscriptCorrected),t.voiceModelTranscript&&e.off("voice_model_transcript",t.voiceModelTranscript),t.voiceModelThinking&&e.off("voice_model_thinking",t.voiceModelThinking),t.voiceToolVisual&&e.off("voice_tool_visual",t.voiceToolVisual),t.voiceCallEnded&&e.off("voice_call_ended",t.voiceCallEnded),e.off("voice_timeout"),se.current={},U.current=!1},[r]),ue=s(async()=>{const e=r?.();if(!e)return;const t=await navigator.mediaDevices.getUserMedia({audio:oc});F.current=t;const n=new AudioContext({sampleRate:16e3});R.current=n,"suspended"===n.state&&await n.resume();const o=n.createMediaStreamSource(t),i=function(e,t){const n=e.createBiquadFilter();n.type="highpass",n.frequency.value=ic,n.Q.value=ac;const r=e.createBiquadFilter();r.type="lowpass",r.frequency.value=sc,r.Q.value=lc;const o=e.createDynamicsCompressor();return o.threshold.value=cc,o.knee.value=uc,o.ratio.value=dc,o.attack.value=pc,o.release.value=hc,t.connect(n),n.connect(r),r.connect(o),o}(n,o),a=n.createAnalyser();if(a.fftSize=256,i.connect(a),j.current=a,!V.current){const e=new Blob(["\nclass VoicePCMProcessor extends AudioWorkletProcessor {\n constructor() {\n super();\n this.buffer = new Float32Array(1600); // 100ms at 16kHz\n this.bufferIndex = 0;\n }\n process(inputs) {\n const input = inputs[0]?.[0];\n if (!input) return true;\n for (let i = 0; i < input.length; i++) {\n this.buffer[this.bufferIndex++] = input[i];\n if (this.bufferIndex >= 1600) {\n // Convert Float32 → Int16 PCM\n const int16 = new Int16Array(1600);\n for (let j = 0; j < 1600; j++) {\n const s = Math.max(-1, Math.min(1, this.buffer[j]));\n int16[j] = s < 0 ? s * 0x8000 : s * 0x7FFF;\n }\n\n // Send ALL chunks — Gemini server-side VAD handles activity detection\n this.port.postMessage(int16.buffer, [int16.buffer]);\n\n this.buffer = new Float32Array(1600);\n this.bufferIndex = 0;\n }\n }\n return true;\n }\n}\nregisterProcessor('voice-pcm-processor', VoicePCMProcessor);\n"],{type:"application/javascript"});V.current=URL.createObjectURL(e)}await n.audioWorklet.addModule(V.current);const s=new AudioWorkletNode(n,"voice-pcm-processor");$.current=s,s.port.onmessage=t=>{if(e.connected&&!k){const n=function(e){const t=new Uint8Array(e);let n="";for(let r=0;r<t.byteLength;r++)n+=String.fromCharCode(t[r]);return btoa(n)}(t.data);e.emit("voice_audio_chunk",{data:n})}},i.connect(s);const l=()=>{if(!j.current)return;const e=new Uint8Array(j.current.frequencyBinCount);j.current.getByteFrequencyData(e);const t=e.reduce((e,t)=>e+t,0)/e.length;C(t/255),B.current=requestAnimationFrame(l)};l()},[r,k]),de=s(()=>{cancelAnimationFrame(B.current),$.current?.disconnect(),$.current=null,F.current?.getTracks().forEach(e=>e.stop()),F.current=null,R.current?.close(),R.current=null,j.current=null,C(0)},[]),pe=s(async()=>{const e=r?.();if(e?.connected){g("connecting"),x(0),O([]),z(null),G.current=[],le(),K.current&&"closed"!==K.current.state||(K.current=new AudioContext({sampleRate:yc})),K.current.resume().catch(()=>{});try{await ue()}catch(t){return console.error("[VoiceCall] Mic error:",t),void g("idle")}e.emit("voice_start",{language:"es-AR",voice:"Kore"}),D.current=setInterval(()=>{x(e=>e+1)},1e3),me()}else console.error("[VoiceCall] Socket not connected")},[r,le,ue]),he=s(()=>{de(),ne.current.forEach(e=>{try{e.stop()}catch{}}),ne.current=[],G.current=[],te.current=0,Y.current=!1,K.current?.close(),K.current=null,D.current&&(clearInterval(D.current),D.current=null),H.current&&(clearInterval(H.current),H.current=null);const e=r?.();if(e?.connected&&e.emit("voice_stop"),p&&N.length>0){const e=Date.now()-1e3*N.length;N.forEach((t,n)=>{p({sender:"user"===t.role?"user":"bot",content:t.text,timestamp:new Date(e+1e3*n)})})}ce(),g("idle"),C(0),x(0),_(!1),O([]),L(!1),t()},[r,de,ce,t,p,N]);a(()=>{W.current=he},[he]);const fe=s(()=>{Z.current=0,L(!1)},[]),me=s(()=>{Z.current=0,H.current&&clearInterval(H.current),H.current=setInterval(()=>{Z.current+=1;const e=Z.current;e>=90&&e<120&&L(!0),e>=120&&W.current()},1e3)},[]),ge=s(()=>{_(e=>!e)},[]),be=s(()=>{const e=T.trim();if(!e)return;const t=r?.();t?.connected&&(t.emit("voice_text_input",{text:e}),M(""),I(!1))},[T,r]);if(a(()=>{e&&"idle"===m&&pe()},[e]),a(()=>{q.current?.scrollIntoView({behavior:"smooth"})},[N]),a(()=>()=>{de(),D.current&&clearInterval(D.current),ce()},[]),!e)return null;const ye="speaking"===m?h.speakingColor:"thinking"===m?h.thinkingColor:"listening"===m?h.listeningColor:n;/* @__PURE__ */
|
|
94
|
+
return b("div",{className:"rounded-full transition-all duration-100",style:{width:"3px",height:`${a}px`,backgroundColor:n,opacity:e?.7-.3*i:.2}},o)})})}function kc({isOpen:e,onClose:t,primaryColor:n="#10b981",getSocket:r,avatars:o,logoUrl:l,avatar3dUrl:c,voiceConfig:d,onAddMessage:p}){const h=u(()=>function(e,t="#10b981"){return{backgroundColor:e?.backgroundColor??"#0a0a0a",listeningColor:e?.listeningColor??"#10b981",speakingColor:e?.speakingColor??t,thinkingColor:e?.thinkingColor??"#a855f7",showEmojis:e?.showEmojis??!0,showEmotionLabel:e?.showEmotionLabel??!0,showWaveform:e?.showWaveform??!0,showBadge:e?.showBadge??!1,badgeText:e?.badgeText??"",emotionEmojis:{...mc,...e?.emotionEmojis},statusLabels:{...gc,...e?.statusLabels},orbSize:e?.orbSize??128,speakingScale:e?.speakingScale??1.08,thinkingScale:e?.thinkingScale??.95,avatar3dUrl:e?.avatar3dUrl}}(d,n),[d,n]),[m,g]=i("idle"),[w,x]=i(0),[k,_]=i(!1),[S,C]=i(0),[E,z]=i(null),[N,O]=i([]),[A,I]=i(!1),[T,M]=i(""),[P,L]=i(!1),D=f(null),j=f(null),F=f(null),R=f(null),$=f(null),B=f(0),U=f(!1),V=f(null),q=f(null),W=f(()=>{}),H=f(null),Z=f(0),K=f(null),G=f([]),Y=f(!1),te=f(0),ne=f([]),oe=s(e=>`${Math.floor(e/60)}:${(e%60).toString().padStart(2,"0")}`,[]),ie=s(()=>{if(0===G.current.length)return;K.current&&"closed"!==K.current.state||(K.current=new AudioContext({sampleRate:yc})),"suspended"===K.current.state&&K.current.resume().catch(()=>{});const e=K.current;Y.current=!0,g("speaking");const t=e.currentTime;for(te.current<t&&(te.current=t);G.current.length>0;){const t=G.current.shift(),n=e.createBuffer(1,t.length,yc);n.getChannelData(0).set(t);const r=e.createBufferSource();r.buffer=n,r.connect(e.destination),r.start(te.current),ne.current.push(r),r.onended=()=>{ne.current=ne.current.filter(e=>e!==r),0===ne.current.length&&0===G.current.length&&(Y.current=!1,g(e=>"speaking"===e?"listening":e))},te.current+=t.length/yc}},[]),se=f({}),le=s(()=>{const e=r?.();if(!e||U.current)return;const n=()=>{g("listening")},o=e=>{if(!e?.data)return;const t=function(e){const t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);const r=new Int16Array(n.buffer),o=new Float32Array(r.length);for(let i=0;i<r.length;i++)o[i]=r[i]/32768;return o}(e.data);G.current.push(t),ie(),fe()},i=()=>{ne.current.forEach(e=>{try{e.stop()}catch{}}),ne.current=[],G.current.length=0,te.current=0,Y.current=!1,g("listening")},a=()=>{},s=e=>{console.error("[VoiceCall] Voice error:",e)},l=e=>{e?.emotion&&(z(e.emotion),setTimeout(()=>z(t=>t===e.emotion?null:t),4e3))},c=e=>{e?.text&&(fe(),O(t=>{if(t.length>0&&"user"===t[t.length-1].role){const n=[...t],r=n[n.length-1].text,o=r.length>0&&!r.endsWith(" ")&&!e.text.startsWith(" ");return n[n.length-1]={...n[n.length-1],text:r+(o?" ":"")+e.text},n}return[...t,{role:"user",text:e.text}]}))},u=e=>{e?.text&&O(t=>{const n=t.map(e=>e.role).lastIndexOf("user");if(n>=0){const r=[...t];return r[n]={...r[n],text:e.text},r}return[...t,{role:"user",text:e.text}]})},d=e=>{e?.text&&O(t=>{const n=[...t];for(let o=n.length-1;o>=0;o--)if("user"===n[o].role&&n[o].text===e.original)return n[o]={...n[o],text:e.text},n;const r=n.map(e=>e.role).lastIndexOf("user");return r>=0?(n[r]={...n[r],text:e.text},n):t})},p=e=>{e?.text&&(fe(),O(t=>{if(t.length>0&&"bot"===t[t.length-1].role){const n=[...t],r=n[n.length-1].text,o=r.length>0&&!r.endsWith(" ")&&!e.text.startsWith(" ");return n[n.length-1]={...n[n.length-1],text:r+(o?" ":"")+e.text},n}return[...t,{role:"bot",text:e.text}]}))},h=()=>{g("thinking"),fe()},f=e=>{if(!e?.items?.length)return;if(fe(),"show_content"===e.tool){const t=e.items.map(e=>"link"===e.type?`[${e.label||e.url}](${e.url})`:"image"===e.type?``:e.label||"").filter(Boolean).join("\n");return void(t&&O(e=>[...e,{role:"bot",text:t}]))}const t=e.items.map(t=>{if("search_accommodations"===e.tool){const e=t.options?.[0],n=e?`${e.totalPrice} ${e.currency}`:"",r=(t.features||[]).slice(0,3).join(" • "),o=t.cover?``:"",i=e?.link?`[Ver detalles](${e.link})`:"";return`${o}\n**${t.index}. ${t.title}**\n📍 ${t.location} ${t.rating?`⭐ ${t.rating}`:""}\n💰 ${n}\n${r}\n${i}`}if("get_accommodation_details"===e.tool){const e=(t.images||[]).slice(0,4).map(e=>``).join("\n"),n=t.specs?Object.entries(t.specs).map(([e,t])=>`${e}: ${t}`).join(" • "):"",r=(t.rooms||[]).map(e=>`• ${e.name}: ${e.price}`).join("\n"),o=t.rules?`🕐 Check-in: ${t.rules.checkIn||"-"} | Check-out: ${t.rules.checkOut||"-"} | Mascotas: ${t.rules.pets||"-"}`:"",i=t.seeMoreLink?`[Ver más detalles](${t.seeMoreLink})`:"";return`${e}\n**${t.title||t.name}**\n${t.description||""}\n${n}\n${r}\n${o}\n${i}`}return JSON.stringify(t)}).join("\n\n---\n\n");O(e=>[...e,{role:"bot",text:t}])};se.current={voiceReady:n,voiceAudioChunk:o,voiceInterrupted:i,voiceTurnComplete:a,voiceError:s,voiceEmotion:l,voiceUserTranscript:c,voiceUserTranscriptFinal:u,voiceUserTranscriptCorrected:d,voiceModelTranscript:p,voiceModelThinking:h,voiceToolVisual:f},e.on("voice_ready",n),e.on("voice_audio_chunk",o),e.on("voice_interrupted",i),e.on("voice_turn_complete",a),e.on("voice_error",s),e.on("voice_emotion",l),e.on("voice_user_transcript",c),e.on("voice_user_transcript_final",u),e.on("voice_user_transcript_corrected",d),e.on("voice_model_transcript",p),e.on("voice_model_thinking",h),e.on("voice_tool_visual",f),e.on("voice_timeout",()=>{W.current()});const m=e=>{O(e=>[...e,{role:"bot",text:"📞 Llamada finalizada."}]),setTimeout(()=>{t()},2500)};e.on("voice_call_ended",m),se.current.voiceCallEnded=m,U.current=!0},[r,ie]),ce=s(()=>{const e=r?.();if(!e||!U.current)return;const t=se.current;t.voiceReady&&e.off("voice_ready",t.voiceReady),t.voiceAudioChunk&&e.off("voice_audio_chunk",t.voiceAudioChunk),t.voiceInterrupted&&e.off("voice_interrupted",t.voiceInterrupted),t.voiceTurnComplete&&e.off("voice_turn_complete",t.voiceTurnComplete),t.voiceError&&e.off("voice_error",t.voiceError),t.voiceEmotion&&e.off("voice_emotion",t.voiceEmotion),t.voiceUserTranscript&&e.off("voice_user_transcript",t.voiceUserTranscript),t.voiceUserTranscriptFinal&&e.off("voice_user_transcript_final",t.voiceUserTranscriptFinal),t.voiceUserTranscriptCorrected&&e.off("voice_user_transcript_corrected",t.voiceUserTranscriptCorrected),t.voiceModelTranscript&&e.off("voice_model_transcript",t.voiceModelTranscript),t.voiceModelThinking&&e.off("voice_model_thinking",t.voiceModelThinking),t.voiceToolVisual&&e.off("voice_tool_visual",t.voiceToolVisual),t.voiceCallEnded&&e.off("voice_call_ended",t.voiceCallEnded),e.off("voice_timeout"),se.current={},U.current=!1},[r]),ue=s(async()=>{const e=r?.();if(!e)return;const t=await navigator.mediaDevices.getUserMedia({audio:oc});F.current=t;const n=new AudioContext({sampleRate:16e3});R.current=n,"suspended"===n.state&&await n.resume();const o=n.createMediaStreamSource(t),i=function(e,t){const n=e.createBiquadFilter();n.type="highpass",n.frequency.value=ic,n.Q.value=ac;const r=e.createBiquadFilter();r.type="lowpass",r.frequency.value=sc,r.Q.value=lc;const o=e.createDynamicsCompressor();return o.threshold.value=cc,o.knee.value=uc,o.ratio.value=dc,o.attack.value=pc,o.release.value=hc,t.connect(n),n.connect(r),r.connect(o),o}(n,o),a=n.createAnalyser();if(a.fftSize=256,i.connect(a),j.current=a,!V.current){const e=new Blob(["\nclass VoicePCMProcessor extends AudioWorkletProcessor {\n constructor() {\n super();\n this.buffer = new Float32Array(1600); // 100ms at 16kHz\n this.bufferIndex = 0;\n }\n process(inputs) {\n const input = inputs[0]?.[0];\n if (!input) return true;\n for (let i = 0; i < input.length; i++) {\n this.buffer[this.bufferIndex++] = input[i];\n if (this.bufferIndex >= 1600) {\n // Convert Float32 → Int16 PCM\n const int16 = new Int16Array(1600);\n for (let j = 0; j < 1600; j++) {\n const s = Math.max(-1, Math.min(1, this.buffer[j]));\n int16[j] = s < 0 ? s * 0x8000 : s * 0x7FFF;\n }\n\n // Send ALL chunks — Gemini server-side VAD handles activity detection\n this.port.postMessage(int16.buffer, [int16.buffer]);\n\n this.buffer = new Float32Array(1600);\n this.bufferIndex = 0;\n }\n }\n return true;\n }\n}\nregisterProcessor('voice-pcm-processor', VoicePCMProcessor);\n"],{type:"application/javascript"});V.current=URL.createObjectURL(e)}await n.audioWorklet.addModule(V.current);const s=new AudioWorkletNode(n,"voice-pcm-processor");$.current=s,s.port.onmessage=t=>{if(e.connected&&!k){const n=function(e){const t=new Uint8Array(e);let n="";for(let r=0;r<t.byteLength;r++)n+=String.fromCharCode(t[r]);return btoa(n)}(t.data);e.emit("voice_audio_chunk",{data:n})}},i.connect(s);const l=()=>{if(!j.current)return;const e=new Uint8Array(j.current.frequencyBinCount);j.current.getByteFrequencyData(e);const t=e.reduce((e,t)=>e+t,0)/e.length;C(t/255),B.current=requestAnimationFrame(l)};l()},[r,k]),de=s(()=>{cancelAnimationFrame(B.current),$.current?.disconnect(),$.current=null,F.current?.getTracks().forEach(e=>e.stop()),F.current=null,R.current?.close(),R.current=null,j.current=null,C(0)},[]),pe=s(async()=>{const e=r?.();if(e?.connected){g("connecting"),x(0),O([]),z(null),G.current=[],le(),K.current&&"closed"!==K.current.state||(K.current=new AudioContext({sampleRate:yc})),K.current.resume().catch(()=>{});try{await ue()}catch(t){return console.error("[VoiceCall] Mic error:",t),void g("idle")}e.emit("voice_start",{language:"es-AR",voice:"Kore"}),D.current=setInterval(()=>{x(e=>e+1)},1e3),me()}else console.error("[VoiceCall] Socket not connected")},[r,le,ue]),he=s(()=>{de(),ne.current.forEach(e=>{try{e.stop()}catch{}}),ne.current=[],G.current=[],te.current=0,Y.current=!1,K.current?.close(),K.current=null,D.current&&(clearInterval(D.current),D.current=null),H.current&&(clearInterval(H.current),H.current=null);const e=r?.();if(e?.connected&&e.emit("voice_stop"),p&&N.length>0){const e=Date.now()-1e3*N.length;N.forEach((t,n)=>{p({sender:"user"===t.role?"user":"bot",content:t.text,timestamp:new Date(e+1e3*n)})})}ce(),g("idle"),C(0),x(0),_(!1),O([]),L(!1),t()},[r,de,ce,t,p,N]);a(()=>{W.current=he},[he]);const fe=s(()=>{Z.current=0,L(!1)},[]),me=s(()=>{Z.current=0,H.current&&clearInterval(H.current),H.current=setInterval(()=>{Z.current+=1;const e=Z.current;e>=90&&e<120&&L(!0),e>=120&&W.current()},1e3)},[]),ge=s(()=>{_(e=>!e)},[]),be=s(()=>{const e=T.trim();if(!e)return;const t=r?.();t?.connected&&(t.emit("voice_text_input",{text:e}),M(""),I(!1))},[T,r]);if(a(()=>{e&&"idle"===m&&pe()},[e]),a(()=>{q.current?.scrollIntoView({behavior:"smooth"})},[N]),a(()=>()=>{de(),D.current&&clearInterval(D.current),ce()},[]),!e)return null;const ye="speaking"===m?h.speakingColor:"thinking"===m?h.thinkingColor:"listening"===m?h.listeningColor:n;/* @__PURE__ */
|
|
95
95
|
return y("div",{className:Et("absolute inset-0 z-50 flex flex-col overflow-hidden","animate-in fade-in duration-300"),style:{backgroundColor:"#0a0a0f",borderRadius:"inherit"},children:[
|
|
96
96
|
/* @__PURE__ */y("div",{className:"absolute inset-0 pointer-events-none",style:{overflow:"hidden"},children:[
|
|
97
97
|
/* @__PURE__ */b("div",{className:"absolute rounded-full",style:{width:"300px",height:"300px",top:"-80px",right:"-60px",background:`radial-gradient(circle, ${ye}18 0%, transparent 70%)`,transition:"background 1.5s ease",filter:"blur(40px)"}}),
|
|
@@ -180,4 +180,4 @@ return b("div",{style:{width:"100%",height:"100%",position:"relative",overflow:"
|
|
|
180
180
|
/* @__PURE__ */b("directionalLight",{position:[-1,1,-1],intensity:.3,color:"#b4c6e7"}),
|
|
181
181
|
/* @__PURE__ */b("pointLight",{position:[0,.5,-.5],intensity:.5,distance:3}),
|
|
182
182
|
/* @__PURE__ */b(sb,{url:e,autoRotate:o,hasCustomCamera:!(!n||!r)})]})})}):null}const ub="https://api.botuyo.com";class db extends m{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){console.error("[BotUyoChat] Widget error:",e,t)}render(){return this.state.hasError?null:this.props.children}}const pb={"--background":"240 10% 3.9%","--foreground":"0 0% 98%","--card":"240 10% 3.9%","--card-foreground":"0 0% 98%","--primary":"160 84% 39%","--primary-foreground":"0 0% 100%","--muted":"240 3.7% 15.9%","--muted-foreground":"240 5% 64.9%","--border":"240 3.7% 15.9%"},hb=p(()=>Promise.resolve().then(()=>ib).then(e=>({default:e.ChatWidgetWithProviders})));class fb{root=null;container=null;shadowRoot=null;mountPoint=null;darkModeObserver=null;darkModeMediaQuery=null;config=null;init(e){return this.config={...e,apiBaseUrl:e.apiBaseUrl||ub},this.render(),this.setupDarkModeDetection(),this}render(){if(!this.config)return void console.error("[BotUyoChat] No configuration provided");if(!this.container){this.container=document.createElement("div"),this.container.id="botuyo-chat-widget-root",document.body.appendChild(this.container),this.shadowRoot=this.container.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=L.replace(/:root/g,":host"),this.shadowRoot.appendChild(e),this.mountPoint=document.createElement("div"),this.mountPoint.id="botuyo-chat-widget-root",this.shadowRoot.appendChild(this.mountPoint)}if(this.config.theme?.cssVariables&&this.mountPoint){const e=this.config.theme.cssVariables;[["--background",e.background],["--foreground",e.foreground],["--card",e.card],["--card-foreground",e.cardForeground],["--primary",e.primary],["--primary-foreground",e.primaryForeground],["--muted",e.muted],["--muted-foreground",e.mutedForeground],["--border",e.border],["--destructive",e.destructive],["--radius",e.radius],["--window-border-radius",e.windowBorderRadius],["--launcher-border-radius",e.launcherBorderRadius],["--window-height",e.windowHeight],["--window-bottom",e.windowBottom],["--spacing-1",e.spacing1],["--spacing-2",e.spacing2],["--spacing-3",e.spacing3],["--spacing-4",e.spacing4],["--spacing-5",e.spacing5],["--spacing-6",e.spacing6],["--spacing-7",e.spacing7],["--spacing-8",e.spacing8]].forEach(([e,t])=>{void 0!==t&&this.mountPoint.style.setProperty(e,t)})}this.mountPoint&&!this.config.theme?.cssVariables&&(!function(){const e=document.documentElement.getAttribute("data-theme");return"dark"===e||"light"!==e&&window.matchMedia("(prefers-color-scheme: dark)").matches}()?Object.keys(pb).forEach(e=>{this.mountPoint.style.removeProperty(e)}):Object.entries(pb).forEach(([e,t])=>{this.mountPoint.style.setProperty(e,t)})),!this.root&&this.mountPoint&&(this.root=e(this.mountPoint));const t={apiKey:this.config.apiKey,apiBaseUrl:this.config.apiBaseUrl||ub,agentId:this.config.agentId,theme:{botName:"Asistente Virtual",position:"bottom-right",welcomeMessage:"¡Hola! 👋 ¿En qué puedo ayudarte?",inputPlaceholder:"Escribe tu mensaje...",cssVariables:{primary:"160 84% 39%",windowBorderRadius:"24px",launcherBorderRadius:"50%"},...this.config.theme},userContext:this.config.userContext,pageContext:this.config.pageContext,includeSEOMetadata:this.config.includeSEOMetadata??!1,mediaConfig:this.config.mediaConfig,onNavigate:this.config.onNavigate,onLogin:this.config.onLogin,onEvent:this.config.onEvent,onStateChange:this.config.onStateChange},r=n.createElement(h,{fallback:n.createElement("div",{style:{position:"fixed",bottom:"24px",right:"24px",width:"60px",height:"60px",borderRadius:"50%",backgroundColor:"#10b981",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",cursor:"wait"}},n.createElement("div",{style:{width:"24px",height:"24px",border:"3px solid rgba(255, 255, 255, 0.3)",borderTopColor:"#fff",borderRadius:"50%",animation:"spin 1s linear infinite"}}))},n.createElement(hb,t));this.root.render(n.createElement(db,null,n.createElement(M,{defaultLocale:this.config.theme?.defaultLocale,children:r}))),console.log("[BotUyoChat] Widget initialized",t)}update(e){this.config?(this.config={...this.config,...e,theme:{...this.config.theme,...e.theme}},this.render()):console.error("[BotUyoChat] Widget not initialized")}destroy(){this.darkModeObserver&&(this.darkModeObserver.disconnect(),this.darkModeObserver=null),this.darkModeMediaQuery&&(this.darkModeMediaQuery.removeEventListener("change",this.handleDarkModeChange),this.darkModeMediaQuery=null),this.root&&(this.root.unmount(),this.root=null),this.container&&this.container.parentNode&&(this.container.parentNode.removeChild(this.container),this.container=null,this.shadowRoot=null,this.mountPoint=null),this.config=null,console.log("[BotUyoChat] Widget destroyed")}setupDarkModeDetection(){this.config?.theme?.cssVariables||(this.handleDarkModeChange=()=>this.render(),this.darkModeObserver=new MutationObserver(this.handleDarkModeChange),this.darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),this.darkModeMediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.darkModeMediaQuery.addEventListener("change",this.handleDarkModeChange))}handleDarkModeChange=()=>{};open(){window.dispatchEvent(new CustomEvent("botuyo-chat:open"))}close(){window.dispatchEvent(new CustomEvent("botuyo-chat:close"))}sendMessage(e){window.dispatchEvent(new CustomEvent("botuyo-chat:send-message",{detail:{message:e}}))}getState(){return null}}const mb=new fb;window.BotUyoChat=mb;export{cb as A,fb as B,ob as C,K as L,ab as P,se as X,Et as a,Yg as b,$ as c,rb as d,M as e,Qg as f,Ot as g,P as h,mb as i,D as u};
|
|
183
|
-
//# sourceMappingURL=standalone-
|
|
183
|
+
//# sourceMappingURL=standalone-UaQcV7og.js.map
|