@prodantix/sdk 0.4.2 → 0.5.0-beta.397

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/chat.js CHANGED
@@ -1,41 +1,30 @@
1
- import {c,a as a$2,b}from'./chunk-V77KYPOF.js';import {a as a$1,d}from'./chunk-VG77TYVX.js';import {a}from'./chunk-5XGN7UAV.js';var q="X-Prodantix-Conversation-Token",L="prodantix.chat.handle";function K(){let r=globalThis.localStorage;if(r)return {get:e=>r.getItem(e),remove:e=>r.removeItem(e),set:(e,t)=>r.setItem(e,t)}}var k=class{constructor(e){this.options=e;a(this,"fetchImpl");a(this,"host");a(this,"storage");a(this,"handle");a(this,"identity",null);this.fetchImpl=a$1(e.fetchImpl),this.host=d(e.host),this.storage=e.storage??K(),this.handle=this.readHandle();}get hasThread(){return this.handle!==null}avatarUrl(e){return e.startsWith("/")?`${this.host}${e}?api_key=${encodeURIComponent(this.options.apiKey)}`:e}get socketAuth(){return this.handle?{conversationId:this.handle.conversationId,conversationToken:this.handle.token,projectKey:this.options.apiKey}:null}identify(e){this.identity=e;}async ensureThread(e){if(this.handle)return true;let t=await this.request("POST","/v1/conversations",{body:{distinctId:this.options.distinctId,subject:e,userHash:this.identity?.userHash,userId:this.identity?.userId}});return !t?.conversationId||!t.token?false:(this.handle={conversationId:t.conversationId,token:t.token},this.storage?.set(L,JSON.stringify(this.handle)),true)}async send(e,t){if(!await this.ensureThread())return null;let n=this.handle;return n?(await this.request("POST",`/v1/conversations/${encodeURIComponent(n.conversationId)}/turns`,{body:{body:e,pageContext:t},token:n.token}))?.turn??null:null}async load(){let e=this.handle;return e?this.request("GET",`/v1/conversations/${encodeURIComponent(e.conversationId)}`,{token:e.token}):null}readHandle(){let e=this.storage?.get(L);if(!e)return null;try{let t=JSON.parse(e);if(typeof t.conversationId=="string"&&typeof t.token=="string")return {conversationId:t.conversationId,token:t.token}}catch{}return this.storage?.remove(L),null}async request(e,t,n={}){let a=this.fetchImpl;if(!a)return this.options.onError?.(new Error("no fetch available for prodantix chat")),null;let o={authorization:`Bearer ${this.options.apiKey}`,"content-type":"application/json"};n.token&&(o[q]=n.token);try{let d=await a(`${this.host}${t}`,{body:n.body===void 0?void 0:JSON.stringify(n.body),headers:o,method:e}),i=await d.text();return d.ok?i?JSON.parse(i):{}:(this.options.onError?.(new Error(`prodantix chat ${t}: ${d.status}`)),null)}catch(d){return this.options.onError?.(d),null}}};var j={Fri:"fri",Mon:"mon",Sat:"sat",Sun:"sun",Thu:"thu",Tue:"tue",Wed:"wed"};function T(r,e){let t=new Intl.DateTimeFormat(void 0,{hour:"2-digit",hour12:false,minute:"2-digit",timeZone:r.timezone,weekday:"short"}).formatToParts(e),n=j[t.find(i=>i.type==="weekday")?.value??""];if(!n)return false;let a=t.find(i=>i.type==="hour")?.value??"",o=t.find(i=>i.type==="minute")?.value??"",d=`${a}:${o}`;return r.windows.some(i=>i.days.includes(n)&&i.open<=d&&d<i.close)}var u={bubbleFill:"filled",bubbleShape:"tailed",composerShape:"round",dayDividers:true,launcherContent:"glyph",launcherFill:"outlined",launcherShape:"circle",launcherSize:"small",nameAvatar:true,namePlacement:"hidden",skin:"standard",stampContent:"time",stampPlacement:"none"},W=["quiet","standard"],Y=["round","square"],G=["rounded","tailed"],X=["filled","outlined"],V=["circle","pill","squircle"],Z=["filled","outlined"],J=["avatar","glyph","team_faces"],Q=["large","medium","small"],ee=["above","hidden","inline"],te=["beside_name","none","under_turn"],ne=["time","time_and_latency"],f=(r,e,t)=>typeof r=="string"&&e.includes(r)?r:t,$=(r,e)=>typeof r=="boolean"?r:e,ae={avatar_circle:["circle","outlined","avatar","large"],circle_filled:["circle","filled","glyph","medium"],circle_outlined:["circle","outlined","glyph","small"],pill_labelled:["pill","filled","glyph","medium"],pill_team:["pill","outlined","team_faces","medium"],squircle_filled:["squircle","filled","glyph","medium"]},re={above:["above",false],avatar_only:["hidden",true],gutter:["above",true],hidden:["hidden",false],inline:["inline",false]},ie={cluster:[true,"none","time"],latency:[false,"beside_name","time_and_latency"],none:[false,"none","time"],trailing:[false,"under_turn","time"],with_name:[false,"beside_name","time"]},oe={concierge:["standard","round"],console:["standard","square"],quiet:["quiet","square"]},se={hairline:["rounded","outlined"],outlined:["rounded","outlined"],rounded:["rounded","filled"],tailed:["tailed","filled"]};function C(r){let e=typeof r=="object"&&r!==null?r:{},t=typeof e.launcherStyle=="string"?e.launcherStyle:void 0,n=t===void 0?void 0:ae[t],a=typeof e.namePlacement=="string"?e.namePlacement:void 0,o=a===void 0?void 0:re[a],d=typeof e.timestampStyle=="string"?e.timestampStyle:void 0,i=d===void 0?void 0:ie[d],h=typeof e.skin=="string"?e.skin:void 0,c=h===void 0?void 0:oe[h],l=typeof e.bubbleStyle=="string"?e.bubbleStyle:void 0,p=l===void 0?void 0:se[l],m={bubbleFill:f(e.bubbleFill,X,p?.[1]??u.bubbleFill),bubbleShape:f(e.bubbleShape,G,p?.[0]??u.bubbleShape),composerShape:f(e.composerShape,Y,c?.[1]??u.composerShape),dayDividers:$(e.dayDividers,i?.[0]??u.dayDividers),launcherContent:f(e.launcherContent,J,n?.[2]??u.launcherContent),launcherFill:f(e.launcherFill,Z,n?.[1]??u.launcherFill),launcherShape:f(e.launcherShape,V,n?.[0]??u.launcherShape),launcherSize:f(e.launcherSize,Q,n?.[3]??u.launcherSize),nameAvatar:$(e.nameAvatar,o?.[1]??u.nameAvatar),namePlacement:f(e.namePlacement,ee,o?.[0]??u.namePlacement),skin:f(e.skin,W,c?.[0]??u.skin),stampContent:f(e.stampContent,ne,i?.[2]??u.stampContent),stampPlacement:f(e.stampPlacement,te,i?.[1]??u.stampPlacement)};return m.stampPlacement==="beside_name"&&m.namePlacement==="hidden"&&(m.stampPlacement="under_turn"),m}function z(r){let e=r.split(/\s+/).filter(n=>n.length>0);return (e.length>1?`${e[0]?.slice(0,1)}${e[1]?.slice(0,1)}`:e[0]?.slice(0,2)??"").toUpperCase()}var le="M20 11.6a7.4 7.4 0 0 1-7.4 7.4H8.2L4 21.8l1-4.1A7.4 7.4 0 1 1 20 11.6Z",de={large:66,medium:56,small:46},ce={circle:"width:var(--fab-size);height:var(--fab-size);border-radius:calc(var(--fab-size) / 2);",pill:"width:auto;height:var(--fab-size);border-radius:calc(var(--fab-size) / 2);padding:0 22px;gap:10px;",squircle:"width:var(--fab-size);height:var(--fab-size);border-radius:16px;"},pe={filled:"background:var(--a);color:#fff;",outlined:"background:var(--paper);border:1px solid var(--hairline);color:var(--ink-2);box-shadow:0 1px 2px rgba(0,0,0,.08);"},he={avatar:"",glyph:".launcher svg{width:calc(var(--fab-size) * 0.375);height:calc(var(--fab-size) * 0.375);}",team_faces:".launcher .faces{display:flex;}.launcher .faces .av{box-shadow:0 0 0 2px var(--paper);}.launcher .faces .av+.av{margin-left:-10px;}"},ue=".launcher .live{width:10px;height:10px;position:absolute;right:3px;bottom:3px;border-radius:50%;background:var(--online);box-shadow:0 0 0 2px var(--paper);}.launcher.closed .live{display:none}",me={circle:"",pill:".badge{position:static;box-shadow:none}",squircle:""},ge={filled:"",outlined:".badge{background:var(--a);top:-7px;right:-7px;min-width:19px;height:19px;font-size:11.5px}"},fe={circle:"",pill:".launcher .label{font-size:14px;font-weight:600;white-space:nowrap;}",squircle:""},be={circle:"",pill:"@media (max-width:480px){.launcher{width:var(--fab-size);padding:0}.launcher .label{display:none}}",squircle:""};function B(r,e,t,n){return `.launcher{--fab-size:${de[n]}px;${ce[r]}${pe[e]}}${he[t]}${ue}${me[r]}${ge[e]}${fe[r]}${be[r]}`}function O(r,e,t,n=a=>a){let a=document.createDocumentFragment();if(r==="glyph"||t.length===0){let o=document.createElement("span");return o.innerHTML=`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${le}"/></svg>`,a.append(...o.childNodes,P()),a}return r==="avatar"?(a.append(U(t[0],e,n),P()),a):(a.append(_(t,e,n),P()),a)}function _(r,e,t=a=>a,n=true){let a=document.createElement("span");a.className="faces";for(let o of r.slice(0,2))a.append(U(o,e,t,n));return a}function U(r,e,t,n=true){let a=document.createElement("span");if(a.className="av",a.setAttribute("aria-hidden","true"),r&&n&&(a.style.background=r.tone),r?.avatarUrl){let o=document.createElement("img");return o.alt="",o.src=t(r.avatarUrl),a.append(o),a}return a.textContent=r?r.initials:e.agentLabel.slice(0,2).toUpperCase(),a}function P(){let r=document.createElement("span");return r.className="live",r.setAttribute("aria-hidden","true"),r}var ye={agentLabel:"Agent",aiLabel:"AI",awayBody:"We are away right now, but we will reply as soon as we are back.",closeLabel:"Close chat",emptyBody:"We usually reply within a few minutes.",emptyTitle:"Ask us anything.",inputPlaceholder:"Type a message",launcherLabel:"Chat with us",replyTime:"Usually replying in a few minutes",retryLabel:"Not delivered. Retry",sendLabel:"Send",timeLabel:r=>{let e=new Date(r);return Number.isNaN(e.getTime())?"":`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`},title:"Support",unreadLabel:r=>`${r} unread`},x={accentColor:"#5b5bff",availability:{timezone:"UTC",windows:[]},awayMessage:"",greeting:"",launcherOffsetX:20,launcherOffsetY:20,launcherPosition:"bottom_right",starterPrompts:[],team:[],...u},xe={quiet:".composer{position:relative;padding:8px 10px 10px}.composer input{padding-right:36px}.composer button{position:absolute;top:50%;right:14px;width:28px;min-width:28px;height:28px;padding:0;background:transparent;color:var(--ink);border-radius:7px;transform:translateY(-50%)}.composer button .sendglyph{display:block;width:16px;height:16px}.composer button .sendtext{display:none}.panel{border-radius:8px;box-shadow:0 2px 8px rgba(0,0,0,.12)}.header{background:var(--paper);color:var(--ink);height:44px;padding:0 8px 0 16px;border-bottom:1px solid var(--hairline)}.header h2{font-size:11px;letter-spacing:.11em;text-transform:uppercase;color:var(--ink-3)}.header .status{color:var(--ink-3)}.header .av,.header .status .live{box-shadow:0 0 0 2px var(--paper)}.close{color:var(--ink-2)}",standard:".panel{border-radius:16px;box-shadow:0 16px 40px rgba(0,0,0,.2)}.header{background:var(--a);color:#fff;flex-direction:column;align-items:flex-start;gap:14px;padding:18px 14px 20px 20px}.header h2{font-size:19px;font-weight:640}"},ve={round:".composer{padding:10px 10px 12px;gap:6px}.composer input{height:36px;border-radius:18px;padding:0 14px}.composer button{width:36px;min-width:36px;height:36px;padding:0;border-radius:18px}.composer button .sendglyph{display:block}.composer button .sendtext{display:none}",square:".composer input{height:36px;border-radius:8px;padding:0 12px}"},Se={rounded:".turn{border-radius:18px;padding:10px 15px}",tailed:".turn.agent,.turn.ai{border-radius:12px 12px 12px 4px}.turn.end_user{border-radius:12px 12px 4px 12px}"},ke={filled:"",outlined:".turn{background:none;border:1px solid var(--hairline)}.turn.end_user{background:none;border-color:var(--a);color:var(--ink)}"},Ce={above:"",hidden:".turn.agent .author,.turn.ai .author:not(.ai){display:none}",inline:".body .author.below{display:block;margin:4px 0 0;font-size:11.5px;font-weight:500;color:var(--ink-2);text-transform:none;letter-spacing:0;opacity:1}"},we=".turn.agent,.turn.ai{display:flex;gap:10px;max-width:100%;background:none;padding:0}.turn.agent .body,.turn.ai .body{background:var(--fill);padding:9px 13px;border-radius:inherit}.author{text-transform:none;letter-spacing:0;font-size:12.5px;font-weight:600;opacity:1}",Te='.divider{display:flex;align-items:center;gap:10px;margin:0;font-size:11px;opacity:.6}.divider:before,.divider:after{content:"";flex:1;height:1px;background:var(--hairline)}',Ee={beside_name:".stamp{font-size:11px;opacity:.7;margin-left:6px}",none:"",under_turn:".stamp{display:block;font-size:11px;opacity:.7;margin-top:4px}.turn.end_user .stamp{text-align:right}"},Ae=".lat{font-size:11px;opacity:.7;margin-left:6px}",D=`--paper: oklch(24.6% 0.015 257); --ink: #fff; --ink-3: rgba(255,255,255,.55);
1
+ import {c,a as a$2,b}from'./chunk-V77KYPOF.js';import {a as a$1,d}from'./chunk-VG77TYVX.js';import {a}from'./chunk-5XGN7UAV.js';var U="X-Prodantix-Conversation-Token",A="prodantix.chat.handle";function G(){let a=globalThis.localStorage;if(a)return {get:e=>a.getItem(e),remove:e=>a.removeItem(e),set:(e,t)=>a.setItem(e,t)}}var C=class{constructor(e){this.options=e;a(this,"fetchImpl");a(this,"fileFetchImpl");a(this,"host");a(this,"storage");a(this,"handle");a(this,"identity",null);this.fetchImpl=a$1(e.fetchImpl),this.fileFetchImpl=e.fileFetchImpl??((t,n)=>fetch(t,n)),this.host=d(e.host),this.storage=e.storage??G(),this.handle=this.readHandle();}get hasThread(){return this.handle!==null}avatarUrl(e){return e.startsWith("/")?`${this.host}${e}?api_key=${encodeURIComponent(this.options.apiKey)}`:e}get socketAuth(){return this.handle?{conversationId:this.handle.conversationId,conversationToken:this.handle.token,projectKey:this.options.apiKey}:null}identify(e){this.identity=e;}async ensureThread(e){if(this.handle)return true;let t=await this.request("POST","/v1/conversations",{body:{distinctId:this.options.distinctId,subject:e,userHash:this.identity?.userHash,userId:this.identity?.userId}});return !t?.conversationId||!t.token?false:(this.handle={conversationId:t.conversationId,token:t.token},this.storage?.set(A,JSON.stringify(this.handle)),true)}async send(e,t,n){if(!await this.ensureThread())return null;let r=this.handle;return r?(await this.request("POST",`/v1/conversations/${encodeURIComponent(r.conversationId)}/turns`,{body:{attachmentIds:n,body:e,pageContext:t},token:r.token}))?.turn??null:null}async upload(e){if(!await this.ensureThread())return null;let t=this.handle;return t?this.fileRequest("POST",`/v1/conversations/${encodeURIComponent(t.conversationId)}/attachments?name=${encodeURIComponent(e.name)}`,t.token,async n=>JSON.parse(await n.text()),e):null}async file(e){let t=this.handle;return t?this.fileRequest("GET",e,t.token,n=>n.blob()):null}async load(){let e=this.handle;return e?this.request("GET",`/v1/conversations/${encodeURIComponent(e.conversationId)}`,{token:e.token}):null}readHandle(){let e=this.storage?.get(A);if(!e)return null;try{let t=JSON.parse(e);if(typeof t.conversationId=="string"&&typeof t.token=="string")return {conversationId:t.conversationId,token:t.token}}catch{}return this.storage?.remove(A),null}async fileRequest(e,t,n,r,o){let i={authorization:`Bearer ${this.options.apiKey}`,[U]:n};o&&(i["content-type"]=o.type||"application/octet-stream");try{let s=await this.fileFetchImpl(`${this.host}${t}`,{body:o,headers:i,method:e});if(s.ok)return await r(s);this.options.onError?.(new Error(`prodantix chat ${t}: ${s.status}`));}catch(s){this.options.onError?.(s);}return null}async request(e,t,n={}){let r=this.fetchImpl;if(!r)return this.options.onError?.(new Error("no fetch available for prodantix chat")),null;let o={authorization:`Bearer ${this.options.apiKey}`,"content-type":"application/json"};n.token&&(o[U]=n.token);try{let i=await r(`${this.host}${t}`,{body:n.body===void 0?void 0:JSON.stringify(n.body),headers:o,method:e}),s=await i.text();return i.ok?s?JSON.parse(s):{}:(this.options.onError?.(new Error(`prodantix chat ${t}: ${i.status}`)),null)}catch(i){return this.options.onError?.(i),null}}};var Y={Fri:"fri",Mon:"mon",Sat:"sat",Sun:"sun",Thu:"thu",Tue:"tue",Wed:"wed"};function L(a,e){let t=new Intl.DateTimeFormat(void 0,{hour:"2-digit",hour12:false,minute:"2-digit",timeZone:a.timezone,weekday:"short"}).formatToParts(e),n=Y[t.find(s=>s.type==="weekday")?.value??""];if(!n)return false;let r=t.find(s=>s.type==="hour")?.value??"",o=t.find(s=>s.type==="minute")?.value??"",i=`${r}:${o}`;return a.windows.some(s=>s.days.includes(n)&&s.open<=i&&i<s.close)}var g={bubbleFill:"filled",bubbleShape:"tailed",composerShape:"round",dayDividers:true,launcherContent:"glyph",launcherFill:"outlined",launcherShape:"circle",launcherSize:"small",nameAvatar:true,namePlacement:"hidden",skin:"standard",stampContent:"time",stampPlacement:"none"},W=["quiet","standard"],J=["round","square"],X=["rounded","tailed"],Z=["filled","outlined"],V=["circle","pill","squircle"],Q=["filled","outlined"],ee=["avatar","glyph","team_faces"],te=["large","medium","small"],ne=["above","hidden","inline"],re=["beside_name","none","under_turn"],ae=["time","time_and_latency"],x=(a,e,t)=>typeof a=="string"&&e.includes(a)?a:t,B=(a,e)=>typeof a=="boolean"?a:e,ie={avatar_circle:["circle","outlined","avatar","large"],circle_filled:["circle","filled","glyph","medium"],circle_outlined:["circle","outlined","glyph","small"],pill_labelled:["pill","filled","glyph","medium"],pill_team:["pill","outlined","team_faces","medium"],squircle_filled:["squircle","filled","glyph","medium"]},oe={above:["above",false],avatar_only:["hidden",true],gutter:["above",true],hidden:["hidden",false],inline:["inline",false]},se={cluster:[true,"none","time"],latency:[false,"beside_name","time_and_latency"],none:[false,"none","time"],trailing:[false,"under_turn","time"],with_name:[false,"beside_name","time"]},le={concierge:["standard","round"],console:["standard","square"],quiet:["quiet","square"]},ce={hairline:["rounded","outlined"],outlined:["rounded","outlined"],rounded:["rounded","filled"],tailed:["tailed","filled"]};function w(a){let e=typeof a=="object"&&a!==null?a:{},t=typeof e.launcherStyle=="string"?e.launcherStyle:void 0,n=t===void 0?void 0:ie[t],r=typeof e.namePlacement=="string"?e.namePlacement:void 0,o=r===void 0?void 0:oe[r],i=typeof e.timestampStyle=="string"?e.timestampStyle:void 0,s=i===void 0?void 0:se[i],d=typeof e.skin=="string"?e.skin:void 0,u=d===void 0?void 0:le[d],c=typeof e.bubbleStyle=="string"?e.bubbleStyle:void 0,l=c===void 0?void 0:ce[c],h={bubbleFill:x(e.bubbleFill,Z,l?.[1]??g.bubbleFill),bubbleShape:x(e.bubbleShape,X,l?.[0]??g.bubbleShape),composerShape:x(e.composerShape,J,u?.[1]??g.composerShape),dayDividers:B(e.dayDividers,s?.[0]??g.dayDividers),launcherContent:x(e.launcherContent,ee,n?.[2]??g.launcherContent),launcherFill:x(e.launcherFill,Q,n?.[1]??g.launcherFill),launcherShape:x(e.launcherShape,V,n?.[0]??g.launcherShape),launcherSize:x(e.launcherSize,te,n?.[3]??g.launcherSize),nameAvatar:B(e.nameAvatar,o?.[1]??g.nameAvatar),namePlacement:x(e.namePlacement,ne,o?.[0]??g.namePlacement),skin:x(e.skin,W,u?.[0]??g.skin),stampContent:x(e.stampContent,ae,s?.[2]??g.stampContent),stampPlacement:x(e.stampPlacement,re,s?.[1]??g.stampPlacement)};return h.stampPlacement==="beside_name"&&h.namePlacement==="hidden"&&(h.stampPlacement="under_turn"),h}function O(a){let e=a.split(/\s+/).filter(n=>n.length>0);return (e.length>1?`${e[0]?.slice(0,1)}${e[1]?.slice(0,1)}`:e[0]?.slice(0,2)??"").toUpperCase()}var de="M20 11.6a7.4 7.4 0 0 1-7.4 7.4H8.2L4 21.8l1-4.1A7.4 7.4 0 1 1 20 11.6Z",pe={large:66,medium:56,small:46},ue={circle:"width:var(--fab-size);height:var(--fab-size);border-radius:calc(var(--fab-size) / 2);",pill:"width:auto;height:var(--fab-size);border-radius:calc(var(--fab-size) / 2);padding:0 22px;gap:10px;",squircle:"width:var(--fab-size);height:var(--fab-size);border-radius:16px;"},he={filled:"background:var(--a);color:#fff;",outlined:"background:var(--paper);border:1px solid var(--hairline);color:var(--ink-2);box-shadow:0 1px 2px rgba(0,0,0,.08);"},me={avatar:"",glyph:".launcher svg{width:calc(var(--fab-size) * 0.375);height:calc(var(--fab-size) * 0.375);}",team_faces:".launcher .faces{display:flex;}.launcher .faces .av{box-shadow:0 0 0 2px var(--paper);}.launcher .faces .av+.av{margin-left:-10px;}"},ge=".launcher .live{width:10px;height:10px;position:absolute;right:3px;bottom:3px;border-radius:50%;background:var(--online);box-shadow:0 0 0 2px var(--paper);}.launcher.closed .live{display:none}",fe={circle:"",pill:".badge{position:static;box-shadow:none}",squircle:""},be={filled:"",outlined:".badge{background:var(--a);top:-7px;right:-7px;min-width:19px;height:19px;font-size:11.5px}"},xe={circle:"",pill:".launcher .label{font-size:14px;font-weight:600;white-space:nowrap;}",squircle:""},ye={circle:"",pill:"@media (max-width:480px){.launcher{width:var(--fab-size);padding:0}.launcher .label{display:none}}",squircle:""};function D(a,e,t,n){return `.launcher{--fab-size:${pe[n]}px;${ue[a]}${he[e]}}${me[t]}${ge}${fe[a]}${be[e]}${xe[a]}${ye[a]}`}function q(a,e,t,n=r=>r){let r=document.createDocumentFragment();if(a==="glyph"||t.length===0){let o=document.createElement("span");return o.innerHTML=`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${de}"/></svg>`,r.append(...o.childNodes,P()),r}return a==="avatar"?(r.append(K(t[0],e,n),P()),r):(r.append(_(t,e,n),P()),r)}function _(a,e,t=n=>n){let n=document.createElement("span");n.className="faces";for(let r of a.slice(0,2))n.append(K(r,e,t));return n}function K(a,e,t){let n=document.createElement("span");if(n.className="av",n.setAttribute("aria-hidden","true"),a&&(n.style.background=a.tone),a?.avatarUrl){let r=document.createElement("img");return r.alt="",r.src=t(a.avatarUrl),n.append(r),n}return n.textContent=a?a.initials:e.agentLabel.slice(0,2).toUpperCase(),n}function P(){let a=document.createElement("span");return a.className="live",a.setAttribute("aria-hidden","true"),a}var ve={agentLabel:"Agent",aiLabel:"AI",attachLabel:"Attach a file",awayBody:"We are away right now, but we will reply as soon as we are back.",closeLabel:"Close chat",emptyBody:"We usually reply within a few minutes.",emptyTitle:"Ask us anything.",fileRefusal:(a,e)=>`That file is ${a}. Send a PNG, JPEG, WebP, GIF or PDF up to ${e}.`,inputPlaceholder:"Type a message",launcherLabel:"Chat with us",removeFileLabel:"Remove file",replyTime:"Usually replying in a few minutes",retryLabel:"Not delivered. Retry",sendLabel:"Send",timeLabel:a=>{let e=new Date(a);return Number.isNaN(e.getTime())?"":`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`},title:"Support",unreadLabel:a=>`${a} unread`},k={accentColor:"#5b5bff",availability:{timezone:"UTC",windows:[]},awayMessage:"",greeting:"",launcherOffsetX:20,launcherOffsetY:20,launcherPosition:"bottom_right",starterPrompts:[],team:[],...g},Se={quiet:".composer{position:relative;padding:8px 10px 10px}.composer input{padding-right:36px}.composer button{position:absolute;top:50%;right:14px;width:28px;min-width:28px;height:28px;padding:0;background:transparent;color:var(--ink);border-radius:7px;transform:translateY(-50%)}.composer button .sendglyph{display:block;width:16px;height:16px}.composer button .sendtext{display:none}.panel{border-radius:8px;box-shadow:0 2px 8px rgba(0,0,0,.12)}.header{background:var(--paper);color:var(--ink);height:44px;padding:0 8px 0 16px;border-bottom:1px solid var(--hairline)}.header h2{font-size:11px;letter-spacing:.11em;text-transform:uppercase;color:var(--ink-3)}.header .faces,.header .status{display:none}.header .close{top:6px}.close{color:var(--ink-2)}",standard:".panel{border-radius:16px;box-shadow:0 16px 40px rgba(0,0,0,.2)}.header{background:var(--a);color:#fff;flex-direction:column;align-items:flex-start;gap:14px;padding:18px 14px 20px 20px}.header h2{font-size:19px;font-weight:640}"},ke={round:".composer{padding:10px 10px 12px;gap:6px}.composer input{height:36px;border-radius:18px;padding:0 14px}.composer button{width:36px;min-width:36px;height:36px;padding:0;border-radius:18px}.composer button .sendglyph{display:block}.composer button .sendtext{display:none}",square:".composer input{height:36px;border-radius:8px;padding:0 12px}"},Ce={rounded:".turn{border-radius:18px;padding:10px 15px}",tailed:".turn.agent,.turn.ai{border-radius:12px 12px 12px 4px}.turn.end_user{border-radius:12px 12px 4px 12px}"},we={filled:"",outlined:".turn{background:none;border:1px solid var(--hairline)}.turn.end_user{background:none;border-color:var(--a);color:var(--ink)}"},Ee={above:"",hidden:".turn.agent .author,.turn.ai .author:not(.ai){display:none}",inline:".body .author.below{display:block;margin:4px 0 0;font-size:11.5px;font-weight:500;color:var(--ink-2);text-transform:none;letter-spacing:0;opacity:1}"},Le=".turn.agent,.turn.ai{display:flex;gap:10px;max-width:100%;background:none;padding:0}.turn.agent .body,.turn.ai .body{background:var(--fill);padding:9px 13px;border-radius:inherit}.author{text-transform:none;letter-spacing:0;font-size:12.5px;font-weight:600;opacity:1}",Te='.divider{display:flex;align-items:center;gap:10px;margin:0;font-size:11px;opacity:.6}.divider:before,.divider:after{content:"";flex:1;height:1px;background:var(--hairline)}',Ae={beside_name:".stamp{font-size:11px;opacity:.7;margin-left:6px}",none:"",under_turn:".stamp{display:block;font-size:11px;opacity:.7;margin-top:4px}.turn.end_user .stamp{text-align:right}"},Pe=".lat{font-size:11px;opacity:.7;margin-left:6px}",_e=".att{display:block;width:180px;margin-bottom:6px;border-radius:8px;overflow:hidden}.att img{display:block;width:100%}.pdfc{display:inline-flex;gap:8px;align-items:center;margin-bottom:6px;padding:6px 8px;border-radius:8px;background:color-mix(in srgb,currentColor 16%,transparent);color:inherit;font-size:12.5px;text-decoration:none;overflow-wrap:anywhere}.pdfc b,.file b{flex:none;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:4px;font-size:9px;letter-spacing:.04em;background:color-mix(in srgb,currentColor 22%,transparent)}.att:last-child,.pdfc:last-child{margin-bottom:0}";function Ne(a){let e=a==="round"?14:12;return `.field{position:relative;flex:1;min-width:0;display:flex}.composer .field input{padding-left:${e+26}px}.composer button.clip{position:absolute;top:50%;left:${e-5}px;right:auto;width:28px;min-width:28px;height:28px;padding:0;border-radius:7px;background:none;color:var(--ink-2);transform:translateY(-50%)}.composer button.clip:hover{background:color-mix(in srgb,currentColor 14%,transparent)}.clip svg{display:block;width:18px;height:18px}.file{display:inline-flex;gap:8px;align-items:center;align-self:flex-start;max-width:calc(100% - 20px);margin:0 10px 8px;padding:6px 10px 6px 6px;font-size:12.5px;color:var(--ink);border:1px solid var(--hairline);border-radius:8px}.file .th{flex:none;width:28px;height:28px;border-radius:4px;object-fit:cover}.file .name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file .sz,.file .x{flex:none;color:var(--ink-3)}.file .x{margin-left:4px;padding:0;border:0;background:none;font:inherit;font-size:16px;line-height:1;cursor:pointer}.ferr{margin:0 10px 6px;font-size:12px;color:oklch(60% 0.2 27)}`}function N(a){return a<999500?`${Math.max(1,Math.round(a/1e3))} KB`:`${(a/1e6).toFixed(1)} MB`}var j=`--paper: oklch(24.6% 0.015 257); --ink: #fff; --ink-3: rgba(255,255,255,.55);
2
2
  --fill: rgba(255,255,255,.06); --hairline: rgba(255,255,255,.13); --ink-2: rgba(255,255,255,.70);
3
- --online: oklch(72% 0.13 163.23);`;function Le(r){return r==="light"?"":r==="dark"?`:host { ${D} }`:`@media (prefers-color-scheme: dark) {
3
+ --online: oklch(72% 0.13 163.23);`;function Fe(a){return a==="light"?"":a==="dark"?`:host { ${j} }`:`@media (prefers-color-scheme: dark) {
4
4
  :host {
5
- ${D}
5
+ ${j}
6
6
  }
7
- }`}function N(r,e="system"){let t=C(r),n=r.launcherPosition==="bottom_left"?"left":"right",a=r.accentColor;return `${`
7
+ }`}var He=/https?:\/\/[^\s<>"]+/g,Re=/[.,;:!?)]$/,Ie=a=>{let e=a;for(;Re.test(e);){let t=e.split("(").length-1,n=e.split(")").length-1;if(e.endsWith(")")&&t>=n)break;e=e.slice(0,-1);}return e};function $e(a,e){let t=0;for(let n of e.matchAll(He)){let r=n.index??0,o=Ie(n[0]);r>t&&a.append(e.slice(t,r));let i=document.createElement("a");i.href=o,i.target="_blank",i.rel="noopener noreferrer",i.textContent=o,a.append(i),t=r+o.length;}t<e.length&&a.append(e.slice(t));}var Me=["P","BR","STRONG","EM","A","UL","OL","LI"],ze=a=>typeof a=="object"&&a!==null&&"html"in a&&typeof a.html=="string"&&"text"in a&&typeof a.text=="string",Ue=(a,e)=>e.name==="class"||e.name==="data-block-type"?true:a!=="A"?false:e.name==="target"||e.name==="rel"?true:e.name==="href"&&/^https?:\/\//i.test(e.value.trim()),Be=a=>[...a.querySelectorAll("*")].every(e=>Me.includes(e.tagName)&&[...e.attributes].every(t=>Ue(e.tagName,t)));function F(a,e="system"){let t=w(a),n=a.launcherPosition==="bottom_left"?"left":"right",r=a.accentColor;return `${`
8
8
  :host {
9
- /* The widget sits above the host page's own furniture. The reset above sends
10
- z-index back to auto, so without this the launcher and panel stack at the
11
- document floor and anything the page raises (a cookie bar, a dev chip)
12
- draws over them: the WebMCP chip covered the launcher on clepit's landing.
13
- Below the 32-bit ceiling so a host can still put something over us
14
- deliberately. */
15
- all: initial; z-index: 2147483000; --a: ${a};
16
- --paper: #fff; --ink: #0f172a; --ink-3: var(--ink-3);
9
+ all: initial; z-index: 2147483000; --a: ${r};
10
+ --paper: #fff; --ink: #0f172a; --ink-3: rgba(0,0,0,.55);
17
11
  --fill: #f1f5f9; --hairline: #e2e8f0; --ink-2: rgba(0,0,0,.72);
18
12
  --online: oklch(53.8% 0.1274 163.23);
19
13
  color-scheme: ${e==="system"?"light dark":e};
20
14
  }
21
- ${Le(e)}
15
+ ${Fe(e)}
22
16
  * { box-sizing: border-box; font-family: system-ui, sans-serif; }
23
17
  .launcher {
24
- z-index: 2147483000; position: fixed; ${n}: ${r.launcherOffsetX}px; bottom: ${r.launcherOffsetY}px; width: 56px; height: 56px;
18
+ z-index: 2147483000; position: fixed; ${n}: ${a.launcherOffsetX}px; bottom: ${a.launcherOffsetY}px; width: 56px; height: 56px;
25
19
  border-radius: 28px; border: none; cursor: pointer;
26
20
  display: inline-flex; align-items: center; justify-content: center;
27
- background: ${a}; color: #fff; font-size: 24px;
21
+ background: ${r}; color: #fff; font-size: 24px;
28
22
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
29
23
  }
30
24
  .launcher:focus-visible { outline: 3px solid #0b0e14; outline-offset: 2px; }
31
- /* A BACKGROUND change, never a position change. Nothing else in the fleet
32
- moves under the pointer: .button[data-variant] and .iconButton all hover by
33
- background alone. This used to lift by translateY(-1px), which made the one
34
- control a visitor is meant to click the only element in the product that
35
- shifted when pointed at. */
36
25
  .launcher { transition: background-color 120ms ease; }
37
- .launcher:hover { background: color-mix(in srgb, #000 12%, ${a}); }
38
- .launcher:active { background: color-mix(in srgb, #000 20%, ${a}); }
26
+ .launcher:hover { background: color-mix(in srgb, #000 12%, ${r}); }
27
+ .launcher:active { background: color-mix(in srgb, #000 20%, ${r}); }
39
28
  @media (prefers-reduced-motion: reduce) {
40
29
  .launcher { transition: none; }
41
30
  }
@@ -44,106 +33,68 @@ ${Le(e)}
44
33
  border-radius: 10px; background: #dc2626; color: #fff; font-size: 12px;
45
34
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
46
35
  }
47
- /* renderBadge hides this with the hidden attribute, which is UA display:none
48
- and is beaten by ANY author display. The rule above is one, so the badge
49
- rendered for every visitor with no unread messages: an empty red circle on
50
- the launcher, in production, for as long as it has shipped. The hiding code
51
- read as if it worked, which is why nothing caught it. Keep this rule beside
52
- the one that needs it. */
53
36
  .badge[hidden] { display: none; }
54
37
  .panel {
55
- z-index: 2147483001; position: fixed; ${n}: ${r.launcherOffsetX}px; bottom: ${r.launcherOffsetY+68}px; width: 360px; max-width: calc(100vw - 40px);
38
+ z-index: 2147483001; position: fixed; ${n}: ${a.launcherOffsetX}px; bottom: ${a.launcherOffsetY+68}px; width: 360px; max-width: calc(100vw - 40px);
56
39
  height: 520px; max-height: calc(100vh - 120px); background: var(--paper); color: var(--ink);
57
40
  border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.24);
58
41
  display: flex; flex-direction: column; overflow: hidden;
59
42
  }
60
43
  .header { position: relative; padding: 14px 16px; background: #0b0e14; color: #fff; display: flex; align-items: center; justify-content: space-between; }
61
44
  .header h2 { margin: 0; font-size: 15px; }
62
- /* Sized from the Configure tab's own head: 36px faces overlapping by 12, the
63
- status line 12.5px at 80% under the title. The ring is the header's own
64
- ground so overlapping faces separate from it and from each other. */
65
45
  .header .faces { display: flex; }
66
- /* The fill is the stylesheet's on the header, never the face's own tone, which
67
- arrives as the project accent and would be this header's own colour. Mixed
68
- down from the accent rather than a fixed colour so it still belongs to the
69
- project's palette, and the ring stays the accent because its job is to part
70
- two OVERLAPPING discs from each other and from the header behind them. */
71
- .header .av { width: 36px; height: 36px; background: color-mix(in srgb, #000 30%, var(--a)); box-shadow: 0 0 0 2px var(--a); }
46
+ .header .av { width: 36px; height: 36px; box-shadow: 0 0 0 2px var(--a); }
72
47
  .header .av + .av { margin-left: -12px; }
73
48
  .headmain { display: flex; flex-direction: column; }
74
49
  .header .status { display: flex; align-items: center; gap: 6px; margin: 5px 0 0; font-size: 12.5px; color: rgb(255 255 255 / 80%); }
75
- /* The dot's ring is the PAPER, not the accent. An accent ring on the standard
76
- skin is the header's own background and draws nothing, which is how this
77
- shipped looking ringless beside a preview that had one. The faces above keep
78
- the accent ring, which is a different job: separating two overlapping discs
79
- from each other and from the header. */
80
50
  .header .status .live { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--online); box-shadow: 0 0 0 2px var(--paper); }
81
- /* Hours, the same fact the launcher's dot carries. A green dot and a sentence
82
- promising a reply in minutes are both claims about somebody being there, so
83
- outside the project's hours neither is drawn: the away message in the thread
84
- is what speaks then. */
85
51
  .panel.closed .status { display: none; }
86
- /* Pinned rather than laid out: the standard skin turns this header into a
87
- column so the title can carry a line under it, and a close button that is
88
- merely a flex sibling then stacks BELOW the title on the left, which is where
89
- clepit's landing showed it. */
90
52
  .header .close { position: absolute; top: 8px; right: 8px; }
91
- /* The fleet's icon button: a padded square, a radius, and a hover that tints
92
- the background. This carried none of them, so the messenger's close was the
93
- one icon button in the product with no radius and no hover at all. The tint
94
- is mixed from currentColor rather than a fixed white because the header is
95
- the accent on some skins and the paper on others. */
96
53
  .close {
97
54
  display: inline-flex; align-items: center; justify-content: center;
98
55
  width: 32px; height: 32px; padding: 0;
99
56
  background: none; border: none; border-radius: 8px;
100
- color: inherit; cursor: pointer; font-size: 18px; line-height: 1;
57
+ color: inherit; cursor: pointer;
101
58
  transition: background-color 120ms ease;
102
59
  }
60
+ .close svg { display: block; width: 22px; height: 22px; }
103
61
  .close:hover { background: color-mix(in srgb, currentColor 14%, transparent); }
104
62
  .close:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
105
63
  .log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
106
64
  .turn { max-width: 80%; padding: 8px 12px; border-radius: 12px; font-size: 14px; }
107
- .turn.end_user { align-self: flex-end; background: ${a}; color: #fff; }
65
+ .turn.end_user { align-self: flex-end; background: ${r}; color: #fff; }
108
66
  .turn.agent, .turn.ai { align-self: flex-start; background: var(--fill); color: var(--ink); }
67
+ .turn.ai a { color: ${r}; text-decoration: underline; overflow-wrap: anywhere; }
109
68
  .author { font-size: 11px; opacity: .7; margin-bottom: 2px; }
110
- /* In flight. Dimmed rather than spinner'd or greyed out: the words are already
111
- readable and the only thing not yet true is that anyone else has them. No
112
- transition, because a fade running as the bubble appears reads as the lag
113
- this change exists to remove. */
114
69
  .turn[data-pending] { opacity: .6; }
115
70
  .turn[data-failed] { opacity: 1; box-shadow: inset 0 0 0 1px #dc2626; }
116
- /* Inside the bubble, under the words it belongs to. A failure notice parked
117
- somewhere else in the panel does not say WHICH message went nowhere. */
118
71
  .retry { display: block; margin: 5px 0 0; padding: 0; background: none; border: 0; color: inherit; font: inherit; font-size: 11.5px; text-decoration: underline; cursor: pointer; opacity: .85; }
119
- .away { background: var(--fill); border: 1px solid var(--hairline); border-radius: 8px; padding: 8px 12px; font-size: 13.5px; color: var(--ink-2); }
72
+ .away { display: flex; gap: 10px; align-items: flex-start; margin: 12px 12px 0; padding: 10px 14px; font-size: 13px; line-height: 1.43; color: ${r}; background: color-mix(in srgb, ${r} 12%, transparent); border-radius: 4px; }
73
+ .awayglyph { flex: none; width: 16px; height: 16px; margin-top: 1px; border: 1.5px solid currentColor; border-radius: 50%; }
120
74
  .empty { display: flex; flex-direction: column; gap: 8px; padding: 20px 16px; }
121
75
  .empty h3 { margin: 0; font-size: 18px; font-weight: 640; letter-spacing: -.015em; }
122
- .empty p { margin: 0 0 8px; font-size: 13.5px; color: var(--ink-2); }
76
+ .empty > p { margin: 0 0 8px; font-size: 13.5px; color: var(--ink-2); }
123
77
  .prompt {
124
- display: flex; align-items: center; min-height: 44px; padding: 0 14px; text-align: left;
78
+ position: relative; display: flex; align-items: center; min-height: 44px; padding: 10px 14px; text-align: left;
125
79
  font-family: inherit; font-size: 13.5px; font-weight: 500; color: var(--ink);
126
80
  background: none; border: 1px solid var(--hairline); border-radius: 8px; cursor: pointer;
127
81
  }
128
- .prompt:focus-visible { outline: 2px solid ${a}; outline-offset: 2px; }
129
- .av { width: 30px; height: 30px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 650; color: #fff; background: #7c3f3f; }
82
+ .promptwords { min-width: 0; overflow-wrap: anywhere; }
83
+ .promptwords > :last-child { margin-bottom: 0; }
84
+ .prompt p { margin: 0 0 16px; line-height: 1.6; }
85
+ .prompt ul, .prompt ol { margin: 0 0 16px; padding-left: 32px; }
86
+ .prompt li { margin: 8px 0; line-height: 1.6; }
87
+ .prompt a { position: relative; z-index: 1; color: ${r}; text-decoration: underline; overflow-wrap: anywhere; }
88
+ .promptpress { position: absolute; inset: 0; padding: 0; background: none; border: 0; border-radius: inherit; cursor: pointer; }
89
+ .promptpress:focus-visible { outline: 2px solid ${r}; outline-offset: 2px; }
90
+ .av { width: 30px; height: 30px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 650; color: #fff; background: oklch(52% 0.17 22); }
130
91
  .av.bot { border-radius: 9px; background: var(--fill); color: var(--ink); }
131
92
  .av img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: inherit; }
132
- /* 36px, against a message bubble measured at 33px in the panel (14px type,
133
- 8px of padding, rendered). The field was 46px round and 44px square, half
134
- again the height of anything it produced, which is what read as too much air
135
- inside it; 36 sits a hair above a bubble, which is the room a field wants for
136
- a caret and a placeholder and a bubble does not. The type stays at 14px, the
137
- same size the messages are set in: the box came down, not the words.
138
-
139
- No backtick in this comment, or in any other inside this sheet. It is a
140
- template literal, so one ends the string and the rest of the CSS becomes a
141
- tagged-template call. Writing a selector as code here cost 124 tests. */
142
93
  .composer { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--hairline); }
143
94
  .composer input { flex: 1; min-width: 0; height: 36px; padding: 0 12px; border: 0; border-radius: 8px; font-size: 14px; background: var(--fill); color: var(--ink); }
144
- .composer input:focus-visible { outline: 2px solid ${a}; }
145
- .composer button { display: inline-flex; align-items: center; justify-content: center; gap: 0; min-width: 56px; height: 36px; padding: 0 14px; background: ${a}; color: #fff; border: none; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 13.5px; font-weight: 550; }
146
- .composer button:hover { background: color-mix(in srgb, #000 12%, ${a}); }
95
+ .composer input:focus-visible { outline: 2px solid ${r}; }
96
+ .composer button { display: inline-flex; align-items: center; justify-content: center; gap: 0; min-width: 56px; height: 36px; padding: 0 14px; background: ${r}; color: #fff; border: none; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 13.5px; font-weight: 550; }
97
+ .composer button:hover { background: color-mix(in srgb, #000 12%, ${r}); }
147
98
  .composer button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
148
99
  .composer button .sendglyph { display: none; width: 17px; height: 17px; }
149
100
  .composer button:focus-visible { outline: 2px solid #0b0e14; }
@@ -151,5 +102,5 @@ ${Le(e)}
151
102
  .panel { animation: rise 180ms ease-out; }
152
103
  @keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
153
104
  }
154
- `}${ve[t.composerShape]}${xe[t.skin]}${B(t.launcherShape,t.launcherFill,t.launcherContent,t.launcherSize)}${Se[t.bubbleShape]}${ke[t.bubbleFill]}${Ce[t.namePlacement]}${t.nameAvatar?we:""}${t.dayDividers?Te:""}${Ee[t.stampPlacement]}${t.stampContent==="time_and_latency"?Ae:""}`}var Pe=["end_user","agent","ai"];function _e(){let r=globalThis.location;if(r)return {host:r.host,path:r.pathname,title:document.title}}var w=class{constructor(e,t,n={},a$1={},o={}){this.host=e;this.client=t;a(this,"root");a(this,"strings");a(this,"settings");a(this,"appearance");a(this,"launcher");a(this,"badge");a(this,"panel",null);a(this,"lastFocused",null);a(this,"unread",0);a(this,"pendingTurns",0);a(this,"openNow");a(this,"style");a(this,"scheme");this.strings={...ye,...n},this.appearance={...x,...a$1},this.settings=C({...x,...a$1}),this.root=e.attachShadow({mode:o.shadowMode??"closed"}),this.openNow=T(this.appearance.availability,new Date),this.scheme=o.scheme,this.style=document.createElement("style"),this.style.textContent=N(this.appearance,this.scheme),this.root.append(this.style),this.launcher=document.createElement("button"),this.launcher.className="launcher",this.launcher.type="button",this.launcher.setAttribute("aria-haspopup","dialog"),this.launcher.addEventListener("click",()=>this.toggle()),this.badge=document.createElement("span"),this.badge.className="badge",this.badge.hidden=true,this.drawLauncher(),this.root.append(this.launcher);}drawLauncher(){if(this.launcher.setAttribute("aria-label",this.strings.launcherLabel),this.launcher.replaceChildren(),this.launcher.append(O(this.settings.launcherContent,this.strings,this.appearance.team,e=>this.client.avatarUrl(e))),this.settings.launcherShape==="pill"){let e=document.createElement("span");e.className="label",e.textContent=this.settings.launcherContent==="team_faces"?this.strings.agentLabel:this.strings.launcherLabel,this.launcher.append(e);}this.launcher.append(this.badge),this.launcher.classList.toggle("closed",!this.openNow);}update(e,t){this.appearance={...x,...e},this.settings=C(this.appearance),t!==void 0&&(this.scheme=t),this.style.textContent=N(this.appearance,this.scheme),this.drawLauncher(),this.panel&&(this.close(),this.open());}toggle(){this.panel?this.close():this.open();}setOpenNow(e){this.openNow=e,this.launcher.classList.toggle("closed",!e),this.panel?.classList.toggle("closed",!e);}async open(){if(this.panel)return;this.lastFocused=this.host.ownerDocument.activeElement,this.unread=0,this.renderBadge();let e=document.createElement("section");e.className=this.openNow?"panel":"panel closed",e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true"),e.setAttribute("aria-label",this.strings.title);let t=document.createElement("div");t.className="header";let n=this.appearance.team??[];n.length>0&&t.append(_(n,this.strings,b=>this.client.avatarUrl(b),false));let a=document.createElement("div");a.className="headmain";let o=document.createElement("h2");o.textContent=this.strings.title;let d=document.createElement("p");d.className="status";let i=document.createElement("span");i.className="live",i.setAttribute("aria-hidden","true"),d.append(i,this.strings.replyTime),a.append(o,d);let h=document.createElement("button");h.className="close",h.type="button",h.setAttribute("aria-label",this.strings.closeLabel),h.textContent="\xD7",h.addEventListener("click",()=>this.close()),t.append(a,h);let c=document.createElement("div");c.className="log",c.setAttribute("role","log"),c.setAttribute("aria-live","polite"),c.setAttribute("aria-label",this.strings.title);let l=document.createElement("form");l.className="composer";let p=document.createElement("input");p.type="text",p.setAttribute("aria-label",this.strings.inputPlaceholder),p.placeholder=this.strings.inputPlaceholder;let m=document.createElement("button");m.type="submit",m.setAttribute("aria-label",this.strings.sendLabel),m.innerHTML='<svg class="sendglyph" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4.5 12 20 4.5 15 20l-3.6-5.4L4.5 12Z"/></svg>';let v=document.createElement("span");v.className="sendtext",v.textContent=this.strings.sendLabel,m.append(v),l.append(p,m),l.addEventListener("submit",b=>{b.preventDefault(),this.submit(p,c);}),e.append(t,c,l),e.addEventListener("keydown",b=>this.onKeydown(b,e,h)),this.root.append(e),this.panel=e,p.focus();let y=await this.client.load();y&&y.turns.length>0?this.renderThread(c,y):this.renderFirstRun(c,p),this.openNow||this.renderAway(c);}renderFirstRun(e,t){let n=document.createElement("div");n.className="empty";let a=document.createElement("h3");a.textContent=this.appearance.greeting.trim()||this.strings.emptyTitle;let o=document.createElement("p");o.textContent=this.strings.emptyBody,n.append(a,o);for(let d of this.appearance.starterPrompts){let i=document.createElement("button");i.className="prompt",i.type="button",i.textContent=d,i.addEventListener("click",()=>{t.value=d,this.submit(t,e);}),n.append(i);}e.replaceChildren(n);}renderAway(e){let t=document.createElement("div");t.className="away",t.textContent=this.appearance.awayMessage.trim()||this.strings.awayBody,e.prepend(t);}close(){this.panel&&(this.panel.remove(),this.panel=null,this.lastFocused instanceof HTMLElement?this.lastFocused.focus():this.launcher.focus());}onIncomingTurn(e){if(this.panel){let t=this.panel.querySelector(".log");t instanceof HTMLElement&&!this.hasTurn(t,e.id)&&this.appendTurn(t,e);return}e.authorKind!=="end_user"&&(this.unread+=1,this.renderBadge());}async submit(e,t){let n=e.value.trim();n&&(e.value="",await this.sendBody(t,n));}async sendBody(e,t){e.querySelector(".empty")?.remove(),this.pendingTurns+=1;let n=this.appendTurn(e,{authorId:null,authorKind:"end_user",body:t,createdAt:new Date().toISOString(),id:`pending-${this.pendingTurns}`});n.setAttribute("data-pending","");let a=await this.client.send(t,_e());if(n.removeAttribute("data-pending"),a){n.dataset.turnId=a.id;return}this.markFailed(e,n,t);}markFailed(e,t,n){t.setAttribute("data-failed","");let a=document.createElement("button");a.type="button",a.className="retry",a.textContent=this.strings.retryLabel,a.addEventListener("click",()=>{t.remove(),this.sendBody(e,n);}),(t.querySelector(".body")??t).append(a);}hasTurn(e,t){for(let n of e.children)if(n instanceof HTMLElement&&n.dataset.turnId===t)return true;return false}renderThread(e,t){e.replaceChildren();for(let n of t.turns)this.appendTurn(e,n);}appendTurn(e,t){e.querySelector(".empty")?.remove();let n=Pe.includes(t.authorKind)?t.authorKind:"agent",a=this.settings,o=document.createElement("div");if(o.className=`turn ${n}`,o.dataset.turnId=t.id,n!=="end_user"&&a.nameAvatar){let l=document.createElement("span");if(l.className=n==="ai"?"av bot":"av",l.setAttribute("aria-hidden","true"),n==="agent"&&t.authorAvatarUrl){let p=document.createElement("img");p.alt="",p.src=this.client.avatarUrl(t.authorAvatarUrl),l.append(p);}else l.textContent=n==="ai"?this.strings.aiLabel:z(this.agentName(t));o.append(l);}let i=document.createElement("div");i.className="body";let h=n!=="end_user"&&a.namePlacement!=="hidden",c=document.createElement("div");if(c.textContent=t.body,h||n==="ai"&&a.namePlacement==="hidden"){let l=document.createElement("div");l.className=n==="ai"?"author ai":"author",l.textContent=n==="ai"?this.strings.aiLabel:this.agentName(t),a.stampPlacement==="beside_name"&&l.append(this.stamp(t)),a.namePlacement==="inline"?(l.classList.add("below"),i.append(c,l)):i.append(l,c);}else i.append(c);return a.stampPlacement==="under_turn"&&i.append(this.stamp(t)),o.append(i),e.append(o),e.scrollTop=e.scrollHeight,o}agentName(e){return e.authorName||this.strings.agentLabel}stamp(e){let t=document.createElement("span");return t.className="stamp",t.textContent=this.strings.timeLabel(e.createdAt),t}onKeydown(e,t,n){if(e.key==="Escape"){e.preventDefault(),this.close();return}if(e.key!=="Tab")return;let a=t.querySelectorAll('button, input, [tabindex]:not([tabindex="-1"])');if(a.length===0)return;let o=a[0],d=a[a.length-1],i=this.root.activeElement;e.shiftKey&&i===o?(e.preventDefault(),d.focus()):!e.shiftKey&&i===d?(e.preventDefault(),o.focus()):i===null&&(e.preventDefault(),n.focus());}renderBadge(){this.unread>0?(this.badge.hidden=false,this.badge.textContent=String(this.unread),this.launcher.setAttribute("aria-label",`${this.strings.launcherLabel}, ${this.strings.unreadLabel(this.unread)}`)):(this.badge.hidden=true,this.badge.textContent="",this.launcher.setAttribute("aria-label",this.strings.launcherLabel));}};var Ne="/socket.io/?EIO=4&transport=websocket",E=class{constructor(e){this.options=e;a(this,"socket",null);a(this,"heartbeat",null);a(this,"ready",false);a(this,"closed",false);a(this,"heartbeatWindow",45e3);a(this,"factory");a(this,"setTimer");a(this,"clearTimer");this.factory=e.socketFactory??He,this.setTimer=e.setTimer??((t,n)=>setTimeout(t,n)),this.clearTimer=e.clearTimer??(t=>clearTimeout(t));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${Ne}`,t;try{t=this.factory(e);}catch{this.options.onClosed(false);return}this.socket=t,t.onmessage=n=>this.receive(String(n.data)),t.onerror=()=>t.close(),t.onclose=()=>this.fell();}close(){this.closed=true,this.stopHeartbeat();let e=this.socket;this.socket=null,e?.close();}receive(e){let t=c(e);if(t.kind==="open"){this.armHeartbeat(t.pingInterval+t.pingTimeout),this.socket?.send(a$2(this.options.auth));return}if(t.kind==="ping"){this.armHeartbeat(),this.socket?.send(b());return}if(t.kind==="connectError"||t.kind==="disconnect"){this.stopHeartbeat(),this.socket?.close();return}if(t.kind==="event"){if(t.name==="ready"){this.ready=true,this.options.onReady();return}if(t.name==="conversation.turn"){let n=t.payload?.turn;n&&this.options.onTurn(n);}}}fell(){this.stopHeartbeat();let e=this.ready;this.socket=null,this.ready=false,this.closed||this.options.onClosed(e);}armHeartbeat(e){e!==void 0&&(this.heartbeatWindow=e),this.stopHeartbeat(),this.heartbeat=this.setTimer(()=>this.socket?.close(),this.heartbeatWindow);}stopHeartbeat(){this.heartbeat!==null&&this.clearTimer(this.heartbeat),this.heartbeat=null;}};function He(r){let e=globalThis.WebSocket;if(!e)throw new Error("no WebSocket");return new e(r)}var Ie=6e4;function Je(r){let e=globalThis.document;if(!e)throw new Error("prodantix chat requires a document; mount it in the browser");let t=r.mountPoint??e.createElement("div");r.mountPoint||e.body.append(t);let n=new k(r),a=new w(t,n,r.strings,r.appearance),o=r.appearance?.availability??x.availability,d,i=()=>{a.setOpenNow(T(o,new Date)),d=setTimeout(i,Ie);};i();let h=new Set,c,l=null,p=r.pollIntervalMs??15e3,m=g=>{h.has(g.id)||g.authorKind==="end_user"||(h.add(g.id),a.onIncomingTurn(g));},v=async()=>{if(!n.hasThread)return;let g=await n.load();if(g){for(let S of g.turns)m(S);h=new Set(g.turns.map(S=>S.id));}},y=()=>{c||p<=0||(c=setInterval(()=>void v(),p));},b=()=>{c&&clearInterval(c),c=void 0;},A=()=>{if(l||!r.socketHost)return;let g=n.socketAuth;g&&(l=new E({auth:g,host:r.socketHost,onClosed:S=>{l=null,y(),S&&A();},onReady:b,onTurn:m,socketFactory:r.socketFactory}),l.open());};return y(),A(),{close:()=>a.close(),destroy:()=>{b(),clearTimeout(d),l?.close(),l=null,a.close(),t.remove();},identify:g=>n.identify(g),open:()=>{a.open().then(A);}}}export{k as ChatClient,w as ChatPanel,x as DEFAULT_APPEARANCE,u as DEFAULT_APPEARANCE_SETTINGS,Je as mountChat,N as panelStyles,C as resolveAppearance};//# sourceMappingURL=chat.js.map
105
+ `}${ke[t.composerShape]}${Se[t.skin]}${D(t.launcherShape,t.launcherFill,t.launcherContent,t.launcherSize)}${Ce[t.bubbleShape]}${we[t.bubbleFill]}${Ee[t.namePlacement]}${t.nameAvatar?Le:""}${t.dayDividers?Te:""}${Ae[t.stampPlacement]}${t.stampContent==="time_and_latency"?Pe:""}${_e}${a.attachments?.enabled?Ne(t.composerShape):""}`}var Oe=["end_user","agent","ai"];function De(){let a=globalThis.location;if(a)return {host:a.host,path:a.pathname,title:document.title}}var qe='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m16.5 6.5-7.8 7.8a2.1 2.1 0 0 0 3 3l8.1-8.1a4.2 4.2 0 0 0-6-6L5.7 11.3a6.3 6.3 0 0 0 8.9 8.9l6.6-6.6"/></svg>',Ke='<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M15.88 9.29 12 13.17 8.12 9.29a.996.996 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41l4.59 4.59c.39.39 1.02.39 1.41 0l4.59-4.59c.39-.39.39-1.02 0-1.41-.39-.38-1.03-.39-1.42 0"/></svg>',E=class{constructor(e,t,n={},r={},o={}){this.host=e;this.client=t;a(this,"root");a(this,"strings");a(this,"settings");a(this,"appearance");a(this,"launcher");a(this,"badge");a(this,"panel",null);a(this,"lastFocused",null);a(this,"unread",0);a(this,"pendingTurns",0);a(this,"openNow");a(this,"style");a(this,"scheme");a(this,"picked",null);a(this,"objectUrls",[]);this.strings={...ve,...n},this.appearance={...k,...r},this.settings=w({...k,...r}),this.root=e.attachShadow({mode:o.shadowMode??"closed"}),this.openNow=L(this.appearance.availability,new Date),this.scheme=o.scheme,this.style=document.createElement("style"),this.style.textContent=F(this.appearance,this.scheme),this.root.append(this.style),this.launcher=document.createElement("button"),this.launcher.className="launcher",this.launcher.type="button",this.launcher.setAttribute("aria-haspopup","dialog"),this.launcher.addEventListener("click",()=>this.toggle()),this.badge=document.createElement("span"),this.badge.className="badge",this.badge.hidden=true,this.drawLauncher(),this.root.append(this.launcher);}drawLauncher(){if(this.launcher.setAttribute("aria-label",this.strings.launcherLabel),this.launcher.replaceChildren(),this.launcher.append(q(this.settings.launcherContent,this.strings,this.appearance.team,e=>this.client.avatarUrl(e))),this.settings.launcherShape==="pill"){let e=document.createElement("span");e.className="label",e.textContent=this.settings.launcherContent==="team_faces"?this.strings.agentLabel:this.strings.launcherLabel,this.launcher.append(e);}this.launcher.append(this.badge),this.launcher.classList.toggle("closed",!this.openNow);}update(e,t){this.appearance={...k,...e},this.settings=w(this.appearance),t!==void 0&&(this.scheme=t),this.style.textContent=F(this.appearance,this.scheme),this.drawLauncher(),this.panel&&(this.close(),this.open());}toggle(){this.panel?this.close():this.open();}setOpenNow(e){this.openNow=e,this.launcher.classList.toggle("closed",!e),this.panel?.classList.toggle("closed",!e);}async open(){if(this.panel)return;this.lastFocused=this.host.ownerDocument.activeElement,this.unread=0,this.renderBadge();let e=document.createElement("section");e.className=this.openNow?"panel":"panel closed",e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true"),e.setAttribute("aria-label",this.strings.title);let t=document.createElement("div");t.className="header";let n=this.appearance.team??[];n.length>0&&t.append(_(n,this.strings,f=>this.client.avatarUrl(f)));let r=document.createElement("div");r.className="headmain";let o=document.createElement("h2");o.textContent=this.strings.title;let i=document.createElement("p");i.className="status";let s=document.createElement("span");s.className="live",s.setAttribute("aria-hidden","true"),i.append(s,this.strings.replyTime),r.append(o,i);let d=document.createElement("button");d.className="close",d.type="button",d.setAttribute("aria-label",this.strings.closeLabel),d.innerHTML=Ke,d.addEventListener("click",()=>this.close()),t.append(r,d);let u=document.createElement("div");u.className="log",u.setAttribute("role","log"),u.setAttribute("aria-live","polite"),u.setAttribute("aria-label",this.strings.title);let c=document.createElement("form");c.className="composer";let l=document.createElement("input");l.type="text",l.setAttribute("aria-label",this.strings.inputPlaceholder),l.placeholder=this.strings.inputPlaceholder;let h=document.createElement("button");h.type="submit",h.setAttribute("aria-label",this.strings.sendLabel),h.innerHTML='<svg class="sendglyph" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4.5 12 20 4.5 15 20l-3.6-5.4L4.5 12Z"/></svg>';let y=document.createElement("span");y.className="sendtext",y.textContent=this.strings.sendLabel,h.append(y);let v=this.appearance.attachments;if(v?.enabled&&this.client.upload){let f=document.createElement("span");f.className="field";let m=document.createElement("input");m.type="file",m.accept=v.accept.join(","),m.hidden=true,m.addEventListener("change",()=>{let H=m.files?.[0];m.value="",H&&this.pick(u,c,v,H);});let b=document.createElement("button");b.type="button",b.className="clip",b.setAttribute("aria-label",this.strings.attachLabel),b.innerHTML=qe,b.addEventListener("click",()=>m.click()),f.append(b,l,m),c.append(f,h);}else c.append(l,h);c.addEventListener("submit",f=>{f.preventDefault(),this.submit(l,u);}),e.append(t,u,c),e.addEventListener("keydown",f=>this.onKeydown(f,e,d)),this.root.append(e),this.panel=e,l.focus();let S=await this.client.load();S&&S.turns.length>0?this.renderThread(u,S):this.renderFirstRun(u,l),this.openNow||this.renderAway(t);}renderFirstRun(e,t){let n=document.createElement("div");n.className="empty";let r=document.createElement("h3");r.textContent=this.appearance.greeting.trim()||this.strings.emptyTitle;let o=document.createElement("p");o.textContent=this.strings.emptyBody,n.append(r,o),this.appearance.starterPrompts.filter(ze).forEach((s,d)=>{let u=document.createElement("div");u.className="prompt";let c=document.createElement("div");c.className="promptwords",c.id=`prompt-${d}`;let l=document.createElement("template");l.innerHTML=s.html,Be(l.content)?c.append(l.content):c.textContent=s.text;for(let y of c.querySelectorAll("a"))y.target="_blank",y.rel="noopener noreferrer";let h=document.createElement("button");h.className="promptpress",h.type="button",h.setAttribute("aria-labelledby",c.id),h.addEventListener("click",()=>{t.value=s.text,this.submit(t,e);}),u.append(c,h),n.append(u);}),e.replaceChildren(n);}renderAway(e){let t=document.createElement("div");t.className="away";let n=document.createElement("span");n.className="awayglyph",n.setAttribute("aria-hidden","true");let r=document.createElement("span");r.textContent=this.appearance.awayMessage.trim()||this.strings.awayBody,t.append(n,r),e.after(t);}pick(e,t,n,r){let o=r.size>n.maxBytes||!n.accept.includes(r.type);for(let l of this.root.querySelectorAll(o?".ferr":".file,.ferr"))l.remove();if(o){let l=document.createElement("p");l.className="ferr",l.setAttribute("role","alert"),l.textContent=this.strings.fileRefusal(N(r.size),`${n.maxBytes/1e6} MB`),t.before(l),e.scrollTop=e.scrollHeight;return}this.picked=r;let i=document.createElement("span");i.className="file";let s;if(r.type==="application/pdf")s=document.createElement("b"),s.textContent="PDF";else {let l=document.createElement("img");l.className="th",l.alt="",l.src=this.objectUrl(r),s=l;}let d=document.createElement("span");d.className="name",d.textContent=r.name;let u=document.createElement("span");u.className="sz",u.textContent=`\xB7 ${N(r.size)}`;let c=document.createElement("button");c.type="button",c.className="x",c.setAttribute("aria-label",this.strings.removeFileLabel),c.textContent="\xD7",c.addEventListener("click",()=>{this.picked=null,i.remove();}),i.append(s,d,u,c),t.before(i),e.scrollTop=e.scrollHeight;}objectUrl(e){let t=URL.createObjectURL(e);return this.objectUrls.push(t),t}close(){if(this.panel){this.panel.remove(),this.panel=null,this.picked=null;for(let e of this.objectUrls)URL.revokeObjectURL(e);this.objectUrls=[],this.lastFocused instanceof HTMLElement?this.lastFocused.focus():this.launcher.focus();}}onIncomingTurn(e){if(this.panel){let t=this.panel.querySelector(".log");t instanceof HTMLElement&&!this.hasTurn(t,e.id)&&this.appendTurn(t,e);return}e.authorKind!=="end_user"&&(this.unread+=1,this.renderBadge());}async submit(e,t){let n=e.value.trim(),r=this.picked;if(!(!n&&!r)){e.value="",this.picked=null;for(let o of this.root.querySelectorAll(".file,.ferr"))o.remove();await this.sendBody(t,n,r);}}async sendBody(e,t,n=null){e.querySelector(".empty")?.remove(),this.pendingTurns+=1;let r=this.appendTurn(e,{authorId:null,authorKind:"end_user",body:t,createdAt:new Date().toISOString(),id:`pending-${this.pendingTurns}`},n);r.setAttribute("data-pending","");let o=n?await this.client.upload?.(n):void 0,i=o===null?null:await this.client.send(t,De(),o?[o.id]:void 0);if(r.removeAttribute("data-pending"),i){r.dataset.turnId=i.id;return}this.markFailed(e,r,t,n);}markFailed(e,t,n,r){t.setAttribute("data-failed","");let o=document.createElement("button");o.type="button",o.className="retry",o.textContent=this.strings.retryLabel,o.addEventListener("click",()=>{t.remove(),this.sendBody(e,n,r);}),(t.querySelector(".body")??t).append(o);}hasTurn(e,t){for(let n of e.children)if(n instanceof HTMLElement&&n.dataset.turnId===t)return true;return false}renderThread(e,t){e.replaceChildren();for(let n of t.turns)this.appendTurn(e,n);}appendTurn(e,t,n=null){e.querySelector(".empty")?.remove();let r=Oe.includes(t.authorKind)?t.authorKind:"agent",o=this.settings,i=document.createElement("div");if(i.className=`turn ${r}`,i.dataset.turnId=t.id,r!=="end_user"&&o.nameAvatar){let l=document.createElement("span");if(l.className=r==="ai"?"av bot":"av",l.setAttribute("aria-hidden","true"),r==="agent"&&t.authorAvatarUrl){let h=document.createElement("img");h.alt="",h.src=this.client.avatarUrl(t.authorAvatarUrl),l.append(h);}else {l.textContent=r==="ai"?this.strings.aiLabel:O(this.agentName(t));let h=r==="agent"?this.appearance.team?.find(y=>y.name===t.authorName)?.tone:void 0;h&&(l.style.background=h);}i.append(l);}let d=document.createElement("div");if(d.className="body",r==="end_user"){n&&this.drawFile(d,n.name,n.type,n.size,Promise.resolve(n));for(let l of t.attachments??[])this.drawFile(d,l.name,l.contentType,l.bytes,this.client.file?.(l.url)??Promise.resolve(null));}let u=r!=="end_user"&&o.namePlacement!=="hidden",c=document.createElement("div");if(r==="ai"?$e(c,t.body):c.textContent=t.body,u||r==="ai"&&o.namePlacement==="hidden"){let l=document.createElement("div");l.className=r==="ai"?"author ai":"author",l.textContent=r==="ai"?this.strings.aiLabel:this.agentName(t),o.stampPlacement==="beside_name"&&l.append(this.stamp(t)),o.namePlacement==="inline"?(l.classList.add("below"),d.append(c,l)):d.append(l,c);}else t.body&&d.append(c);return o.stampPlacement==="under_turn"&&d.append(this.stamp(t)),i.append(d),e.append(i),e.scrollTop=e.scrollHeight,i}drawFile(e,t,n,r,o){let i=document.createElement("a");if(n==="application/pdf"){i.className="pdfc",i.download=t;let s=document.createElement("b");s.textContent="PDF",i.append(s,`${t} \xB7 ${N(r)}`);}else {i.className="att",i.target="_blank",i.rel="noopener noreferrer";let s=document.createElement("img");s.alt=t,s.addEventListener("load",()=>{let d=i.closest(".log");d&&(d.scrollTop=d.scrollHeight);}),i.append(s);}e.append(i),o.then(s=>{s&&(i.href=this.objectUrl(s),i.querySelector("img")?.setAttribute("src",i.href));});}agentName(e){return e.authorName||this.strings.agentLabel}stamp(e){let t=document.createElement("span");return t.className="stamp",t.textContent=this.strings.timeLabel(e.createdAt),t}onKeydown(e,t,n){if(e.key==="Escape"){e.preventDefault(),this.close();return}if(e.key!=="Tab")return;let r=t.querySelectorAll('button, input, [tabindex]:not([tabindex="-1"])');if(r.length===0)return;let o=r[0],i=r[r.length-1],s=this.root.activeElement;e.shiftKey&&s===o?(e.preventDefault(),i.focus()):!e.shiftKey&&s===i?(e.preventDefault(),o.focus()):s===null&&(e.preventDefault(),n.focus());}renderBadge(){this.unread>0?(this.badge.hidden=false,this.badge.textContent=String(this.unread),this.launcher.setAttribute("aria-label",`${this.strings.launcherLabel}, ${this.strings.unreadLabel(this.unread)}`)):(this.badge.hidden=true,this.badge.textContent="",this.launcher.setAttribute("aria-label",this.strings.launcherLabel));}};var je="/socket.io/?EIO=4&transport=websocket",T=class{constructor(e){this.options=e;a(this,"socket",null);a(this,"heartbeat",null);a(this,"ready",false);a(this,"closed",false);a(this,"heartbeatWindow",45e3);a(this,"factory");a(this,"setTimer");a(this,"clearTimer");this.factory=e.socketFactory??Ge,this.setTimer=e.setTimer??((t,n)=>setTimeout(t,n)),this.clearTimer=e.clearTimer??(t=>clearTimeout(t));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${je}`,t;try{t=this.factory(e);}catch{this.options.onClosed(false);return}this.socket=t,t.onmessage=n=>this.receive(String(n.data)),t.onerror=()=>t.close(),t.onclose=()=>this.fell();}close(){this.closed=true,this.stopHeartbeat();let e=this.socket;this.socket=null,e?.close();}receive(e){let t=c(e);if(t.kind==="open"){this.armHeartbeat(t.pingInterval+t.pingTimeout),this.socket?.send(a$2(this.options.auth));return}if(t.kind==="ping"){this.armHeartbeat(),this.socket?.send(b());return}if(t.kind==="connectError"||t.kind==="disconnect"){this.stopHeartbeat(),this.socket?.close();return}if(t.kind==="event"){if(t.name==="ready"){this.ready=true,this.options.onReady();return}if(t.name==="conversation.turn"){let n=t.payload?.turn;n&&this.options.onTurn(n);}}}fell(){this.stopHeartbeat();let e=this.ready;this.socket=null,this.ready=false,this.closed||this.options.onClosed(e);}armHeartbeat(e){e!==void 0&&(this.heartbeatWindow=e),this.stopHeartbeat(),this.heartbeat=this.setTimer(()=>this.socket?.close(),this.heartbeatWindow);}stopHeartbeat(){this.heartbeat!==null&&this.clearTimer(this.heartbeat),this.heartbeat=null;}};function Ge(a){let e=globalThis.WebSocket;if(!e)throw new Error("no WebSocket");return new e(a)}var Ye=6e4;function ut(a){let e=globalThis.document;if(!e)throw new Error("prodantix chat requires a document; mount it in the browser");let t=a.mountPoint??e.createElement("div");a.mountPoint||e.body.append(t);let n=new C(a),r=new E(t,n,a.strings,a.appearance),o=a.appearance?.availability??k.availability,i,s=()=>{r.setOpenNow(L(o,new Date)),i=setTimeout(s,Ye);};s();let d=new Set,u,c=null,l=a.pollIntervalMs??15e3,h=m=>{d.has(m.id)||m.authorKind==="end_user"||(d.add(m.id),r.onIncomingTurn(m));},y=async()=>{if(!n.hasThread)return;let m=await n.load();if(m){for(let b of m.turns)h(b);d=new Set(m.turns.map(b=>b.id));}},v=()=>{u||l<=0||(u=setInterval(()=>void y(),l));},S=()=>{u&&clearInterval(u),u=void 0;},f=()=>{if(c||!a.socketHost)return;let m=n.socketAuth;m&&(c=new T({auth:m,host:a.socketHost,onClosed:b=>{c=null,v(),b&&f();},onReady:S,onTurn:h,socketFactory:a.socketFactory}),c.open());};return v(),f(),{close:()=>r.close(),destroy:()=>{S(),clearTimeout(i),c?.close(),c=null,r.close(),t.remove();},identify:m=>n.identify(m),open:()=>{r.open().then(f);}}}export{C as ChatClient,E as ChatPanel,k as DEFAULT_APPEARANCE,g as DEFAULT_APPEARANCE_SETTINGS,ut as mountChat,F as panelStyles,w as resolveAppearance};//# sourceMappingURL=chat.js.map
155
106
  //# sourceMappingURL=chat.js.map
@@ -8,7 +8,28 @@ interface ChatTurn {
8
8
  createdAt: string;
9
9
  authorName?: string | null;
10
10
  authorAvatarUrl?: string | null;
11
+ attachments?: ChatAttachment[];
11
12
  }
13
+ interface ChatUpload {
14
+ id: string;
15
+ name: string;
16
+ contentType: string;
17
+ bytes: number;
18
+ }
19
+ interface ChatAttachment extends ChatUpload {
20
+ url: string;
21
+ }
22
+ interface FileResponseLike {
23
+ ok: boolean;
24
+ status: number;
25
+ blob(): Promise<Blob>;
26
+ text(): Promise<string>;
27
+ }
28
+ type FileFetchLike = (url: string, init: {
29
+ body?: Blob;
30
+ headers: Record<string, string>;
31
+ method: string;
32
+ }) => Promise<FileResponseLike>;
12
33
  interface ChatThread {
13
34
  id: string;
14
35
  status: string;
@@ -20,6 +41,7 @@ interface ChatClientOptions {
20
41
  distinctId: string;
21
42
  storage?: ChatStorage;
22
43
  fetchImpl?: FetchLike;
44
+ fileFetchImpl?: FileFetchLike;
23
45
  onError?: (error: unknown) => void;
24
46
  }
25
47
  interface ChatIdentity {
@@ -39,6 +61,7 @@ interface PageContext {
39
61
  declare class ChatClient {
40
62
  private readonly options;
41
63
  private readonly fetchImpl?;
64
+ private readonly fileFetchImpl;
42
65
  private readonly host;
43
66
  private readonly storage?;
44
67
  private handle;
@@ -53,9 +76,12 @@ declare class ChatClient {
53
76
  } | null;
54
77
  identify(identity: ChatIdentity): void;
55
78
  ensureThread(subject?: string): Promise<boolean>;
56
- send(body: string, pageContext?: PageContext): Promise<ChatTurn | null>;
79
+ send(body: string, pageContext?: PageContext, attachmentIds?: string[]): Promise<ChatTurn | null>;
80
+ upload(file: File): Promise<ChatUpload | null>;
81
+ file(path: string): Promise<Blob | null>;
57
82
  load(): Promise<ChatThread | null>;
58
83
  private readHandle;
84
+ private fileRequest;
59
85
  private request;
60
86
  }
61
87
 
@@ -105,6 +131,10 @@ interface TeamFace {
105
131
  avatarUrl: string | null;
106
132
  }
107
133
 
134
+ interface StarterPrompt {
135
+ html: string;
136
+ text: string;
137
+ }
108
138
  interface MessengerConfig extends AppearanceSettings {
109
139
  enabled: boolean;
110
140
  launcherPosition: 'bottom_left' | 'bottom_right';
@@ -115,9 +145,15 @@ interface MessengerConfig extends AppearanceSettings {
115
145
  awayMessage: string;
116
146
  availability: Availability;
117
147
  version: string;
118
- starterPrompts: string[];
148
+ starterPrompts: StarterPrompt[];
119
149
  team: TeamFace[];
120
150
  socketUrl: string;
151
+ attachments?: MessengerAttachments;
152
+ }
153
+ interface MessengerAttachments {
154
+ enabled: boolean;
155
+ maxBytes: number;
156
+ accept: string[];
121
157
  }
122
158
  interface MessengerConfigOptions {
123
159
  apiKey: string;
@@ -128,7 +164,9 @@ interface MessengerConfigOptions {
128
164
  onError?: (error: unknown) => void;
129
165
  }
130
166
  declare const MESSENGER_CACHE_KEY = "prodantix.messenger.config";
131
- declare function cachedMessengerConfig(storage: ChatStorage | undefined, apiKey: string): MessengerConfig | null;
167
+ declare const localeCandidates: (win: Window) => string | undefined;
168
+ declare const cacheKeyFor: (apiKey: string, locale: string | undefined) => string;
169
+ declare function cachedMessengerConfig(storage: ChatStorage | undefined, apiKey: string, locale?: string): MessengerConfig | null;
132
170
  declare function fetchMessengerConfig(options: MessengerConfigOptions): Promise<MessengerConfig | null>;
133
171
 
134
- export { type AppearanceSettings as A, type BubbleFill as B, type ChatThread as C, DEFAULT_APPEARANCE_SETTINGS as D, type LauncherContent as L, type MessengerConfig as M, type NamePlacement as N, type PageContext as P, type StampContent as S, type ChatTurn as a, type ChatIdentity as b, type ChatClientOptions as c, type BubbleShape as d, ChatClient as e, type ChatStorage as f, type ComposerShape as g, type LauncherFill as h, type LauncherShape as i, type LauncherSize as j, type MessengerSkin as k, type StampPlacement as l, MESSENGER_CACHE_KEY as m, type MessengerConfigOptions as n, cachedMessengerConfig as o, fetchMessengerConfig as p, resolveAppearance as r };
172
+ export { type AppearanceSettings as A, type BubbleFill as B, type ChatThread as C, DEFAULT_APPEARANCE_SETTINGS as D, type FileFetchLike as F, type LauncherContent as L, type MessengerConfig as M, type NamePlacement as N, type PageContext as P, type StampContent as S, type ChatTurn as a, type ChatUpload as b, type ChatIdentity as c, type ChatClientOptions as d, type BubbleShape as e, type ChatAttachment as f, ChatClient as g, type ChatStorage as h, type ComposerShape as i, type FileResponseLike as j, type LauncherFill as k, type LauncherShape as l, type LauncherSize as m, type MessengerSkin as n, type StampPlacement as o, MESSENGER_CACHE_KEY as p, type MessengerAttachments as q, resolveAppearance as r, type MessengerConfigOptions as s, type StarterPrompt as t, cacheKeyFor as u, cachedMessengerConfig as v, fetchMessengerConfig as w, localeCandidates as x };
@@ -8,7 +8,28 @@ interface ChatTurn {
8
8
  createdAt: string;
9
9
  authorName?: string | null;
10
10
  authorAvatarUrl?: string | null;
11
+ attachments?: ChatAttachment[];
11
12
  }
13
+ interface ChatUpload {
14
+ id: string;
15
+ name: string;
16
+ contentType: string;
17
+ bytes: number;
18
+ }
19
+ interface ChatAttachment extends ChatUpload {
20
+ url: string;
21
+ }
22
+ interface FileResponseLike {
23
+ ok: boolean;
24
+ status: number;
25
+ blob(): Promise<Blob>;
26
+ text(): Promise<string>;
27
+ }
28
+ type FileFetchLike = (url: string, init: {
29
+ body?: Blob;
30
+ headers: Record<string, string>;
31
+ method: string;
32
+ }) => Promise<FileResponseLike>;
12
33
  interface ChatThread {
13
34
  id: string;
14
35
  status: string;
@@ -20,6 +41,7 @@ interface ChatClientOptions {
20
41
  distinctId: string;
21
42
  storage?: ChatStorage;
22
43
  fetchImpl?: FetchLike;
44
+ fileFetchImpl?: FileFetchLike;
23
45
  onError?: (error: unknown) => void;
24
46
  }
25
47
  interface ChatIdentity {
@@ -39,6 +61,7 @@ interface PageContext {
39
61
  declare class ChatClient {
40
62
  private readonly options;
41
63
  private readonly fetchImpl?;
64
+ private readonly fileFetchImpl;
42
65
  private readonly host;
43
66
  private readonly storage?;
44
67
  private handle;
@@ -53,9 +76,12 @@ declare class ChatClient {
53
76
  } | null;
54
77
  identify(identity: ChatIdentity): void;
55
78
  ensureThread(subject?: string): Promise<boolean>;
56
- send(body: string, pageContext?: PageContext): Promise<ChatTurn | null>;
79
+ send(body: string, pageContext?: PageContext, attachmentIds?: string[]): Promise<ChatTurn | null>;
80
+ upload(file: File): Promise<ChatUpload | null>;
81
+ file(path: string): Promise<Blob | null>;
57
82
  load(): Promise<ChatThread | null>;
58
83
  private readHandle;
84
+ private fileRequest;
59
85
  private request;
60
86
  }
61
87
 
@@ -105,6 +131,10 @@ interface TeamFace {
105
131
  avatarUrl: string | null;
106
132
  }
107
133
 
134
+ interface StarterPrompt {
135
+ html: string;
136
+ text: string;
137
+ }
108
138
  interface MessengerConfig extends AppearanceSettings {
109
139
  enabled: boolean;
110
140
  launcherPosition: 'bottom_left' | 'bottom_right';
@@ -115,9 +145,15 @@ interface MessengerConfig extends AppearanceSettings {
115
145
  awayMessage: string;
116
146
  availability: Availability;
117
147
  version: string;
118
- starterPrompts: string[];
148
+ starterPrompts: StarterPrompt[];
119
149
  team: TeamFace[];
120
150
  socketUrl: string;
151
+ attachments?: MessengerAttachments;
152
+ }
153
+ interface MessengerAttachments {
154
+ enabled: boolean;
155
+ maxBytes: number;
156
+ accept: string[];
121
157
  }
122
158
  interface MessengerConfigOptions {
123
159
  apiKey: string;
@@ -128,7 +164,9 @@ interface MessengerConfigOptions {
128
164
  onError?: (error: unknown) => void;
129
165
  }
130
166
  declare const MESSENGER_CACHE_KEY = "prodantix.messenger.config";
131
- declare function cachedMessengerConfig(storage: ChatStorage | undefined, apiKey: string): MessengerConfig | null;
167
+ declare const localeCandidates: (win: Window) => string | undefined;
168
+ declare const cacheKeyFor: (apiKey: string, locale: string | undefined) => string;
169
+ declare function cachedMessengerConfig(storage: ChatStorage | undefined, apiKey: string, locale?: string): MessengerConfig | null;
132
170
  declare function fetchMessengerConfig(options: MessengerConfigOptions): Promise<MessengerConfig | null>;
133
171
 
134
- export { type AppearanceSettings as A, type BubbleFill as B, type ChatThread as C, DEFAULT_APPEARANCE_SETTINGS as D, type LauncherContent as L, type MessengerConfig as M, type NamePlacement as N, type PageContext as P, type StampContent as S, type ChatTurn as a, type ChatIdentity as b, type ChatClientOptions as c, type BubbleShape as d, ChatClient as e, type ChatStorage as f, type ComposerShape as g, type LauncherFill as h, type LauncherShape as i, type LauncherSize as j, type MessengerSkin as k, type StampPlacement as l, MESSENGER_CACHE_KEY as m, type MessengerConfigOptions as n, cachedMessengerConfig as o, fetchMessengerConfig as p, resolveAppearance as r };
172
+ export { type AppearanceSettings as A, type BubbleFill as B, type ChatThread as C, DEFAULT_APPEARANCE_SETTINGS as D, type FileFetchLike as F, type LauncherContent as L, type MessengerConfig as M, type NamePlacement as N, type PageContext as P, type StampContent as S, type ChatTurn as a, type ChatUpload as b, type ChatIdentity as c, type ChatClientOptions as d, type BubbleShape as e, type ChatAttachment as f, ChatClient as g, type ChatStorage as h, type ComposerShape as i, type FileResponseLike as j, type LauncherFill as k, type LauncherShape as l, type LauncherSize as m, type MessengerSkin as n, type StampPlacement as o, MESSENGER_CACHE_KEY as p, type MessengerAttachments as q, resolveAppearance as r, type MessengerConfigOptions as s, type StarterPrompt as t, cacheKeyFor as u, cachedMessengerConfig as v, fetchMessengerConfig as w, localeCandidates as x };
package/dist/csp.cjs CHANGED
@@ -1,3 +1,3 @@
1
- 'use strict';function r(n){let t=n?.trim()??"";if(t==="")return null;try{return new URL(t).origin}catch{return null}}function s(n){return n.startsWith("https://")?`wss://${n.slice(8)}`:n.startsWith("http://")?`ws://${n.slice(7)}`:null}function i(n){return [...new Set(["'self'",...n.filter(t=>t!==null)])].join(" ")}function l(n,t=[]){let e=r(n.edge);return i([...t,r(n.ingest),e,e===null?null:s(e),r(n.replay)])}function o(n,t=[]){return i([...t,r(n.edge)])}
2
- exports.prodantixConnectSrc=l;exports.prodantixScriptSrc=o;//# sourceMappingURL=csp.cjs.map
1
+ 'use strict';function r(n){let t=n?.trim()??"";if(t==="")return null;try{return new URL(t).origin}catch{return null}}function s(n){return n.startsWith("https://")?`wss://${n.slice(8)}`:n.startsWith("http://")?`ws://${n.slice(7)}`:null}function i(n){return [...new Set(["'self'",...n.filter(t=>t!==null)])].join(" ")}function o(n,t=[]){let e=r(n.edge);return i([...t,r(n.ingest),e,e===null?null:s(e),r(n.replay)])}function l(n,t=[]){return i([...t,r(n.edge)])}function u(n,t=[]){return i([...t,"blob:",r(n.edge)])}
2
+ exports.prodantixConnectSrc=o;exports.prodantixImgSrc=u;exports.prodantixScriptSrc=l;//# sourceMappingURL=csp.cjs.map
3
3
  //# sourceMappingURL=csp.cjs.map
package/dist/csp.d.cts CHANGED
@@ -33,5 +33,6 @@ declare function prodantixConnectSrc(hosts: ProdantixHosts, extra?: readonly str
33
33
  * here would widen the policy for nothing, and a needlessly wide script-src is
34
34
  * the one direction of CSP error that never announces itself. */
35
35
  declare function prodantixScriptSrc(hosts: ProdantixHosts, extra?: readonly string[]): string;
36
+ declare function prodantixImgSrc(hosts: ProdantixHosts, extra?: readonly string[]): string;
36
37
 
37
- export { type ProdantixHosts, prodantixConnectSrc, prodantixScriptSrc };
38
+ export { type ProdantixHosts, prodantixConnectSrc, prodantixImgSrc, prodantixScriptSrc };
package/dist/csp.d.ts CHANGED
@@ -33,5 +33,6 @@ declare function prodantixConnectSrc(hosts: ProdantixHosts, extra?: readonly str
33
33
  * here would widen the policy for nothing, and a needlessly wide script-src is
34
34
  * the one direction of CSP error that never announces itself. */
35
35
  declare function prodantixScriptSrc(hosts: ProdantixHosts, extra?: readonly string[]): string;
36
+ declare function prodantixImgSrc(hosts: ProdantixHosts, extra?: readonly string[]): string;
36
37
 
37
- export { type ProdantixHosts, prodantixConnectSrc, prodantixScriptSrc };
38
+ export { type ProdantixHosts, prodantixConnectSrc, prodantixImgSrc, prodantixScriptSrc };
package/dist/csp.js CHANGED
@@ -1,3 +1,3 @@
1
- import'./chunk-5XGN7UAV.js';function r(n){let t=n?.trim()??"";if(t==="")return null;try{return new URL(t).origin}catch{return null}}function s(n){return n.startsWith("https://")?`wss://${n.slice(8)}`:n.startsWith("http://")?`ws://${n.slice(7)}`:null}function i(n){return [...new Set(["'self'",...n.filter(t=>t!==null)])].join(" ")}function l(n,t=[]){let e=r(n.edge);return i([...t,r(n.ingest),e,e===null?null:s(e),r(n.replay)])}function o(n,t=[]){return i([...t,r(n.edge)])}
2
- export{l as prodantixConnectSrc,o as prodantixScriptSrc};//# sourceMappingURL=csp.js.map
1
+ import'./chunk-5XGN7UAV.js';function r(n){let t=n?.trim()??"";if(t==="")return null;try{return new URL(t).origin}catch{return null}}function s(n){return n.startsWith("https://")?`wss://${n.slice(8)}`:n.startsWith("http://")?`ws://${n.slice(7)}`:null}function i(n){return [...new Set(["'self'",...n.filter(t=>t!==null)])].join(" ")}function o(n,t=[]){let e=r(n.edge);return i([...t,r(n.ingest),e,e===null?null:s(e),r(n.replay)])}function l(n,t=[]){return i([...t,r(n.edge)])}function u(n,t=[]){return i([...t,"blob:",r(n.edge)])}
2
+ export{o as prodantixConnectSrc,u as prodantixImgSrc,l as prodantixScriptSrc};//# sourceMappingURL=csp.js.map
3
3
  //# sourceMappingURL=csp.js.map
@@ -1,2 +1,2 @@
1
- 'use strict';function s(e){if(e)return e;let r=globalThis.fetch;if(typeof r=="function")return r.bind(globalThis)}function c(e){return e.replace(/\/+$/,"")}var a="prodantix.messenger.config";function f(e,r){let n=e?.get(a);if(!n)return null;try{let o=JSON.parse(n);return o?.apiKey===r?o.config:null}catch{return null}}async function h(e){let r=s(e.fetchImpl);if(!r)return e.onError?.(new Error("no fetch available for the prodantix messenger")),null;let n=c(e.host),o=e.locale?`?locale=${encodeURIComponent(e.locale)}`:"";try{let t=await r(`${n}/v1/messenger/config${o}`,{headers:{authorization:`Bearer ${e.apiKey}`},method:"GET"});if(!t.ok)return e.onError?.(new Error(`prodantix messenger config: ${t.status}`)),null;let i=JSON.parse(await t.text());return i.enabled?(e.storage?.set(a,JSON.stringify({apiKey:e.apiKey,config:i})),i):(e.storage?.remove(a),i)}catch(t){return e.onError?.(t),null}}exports.MESSENGER_CACHE_KEY=a;exports.cachedMessengerConfig=f;exports.fetchMessengerConfig=h;//# sourceMappingURL=messenger.cjs.map
1
+ 'use strict';function s(e){if(e)return e;let t=globalThis.fetch;if(typeof t=="function")return t.bind(globalThis)}function c(e){return e.replace(/\/+$/,"")}var g="prodantix.messenger.config",u=e=>{let t=e.navigator?.languages;return Array.isArray(t)&&t.length>0?t.join(","):e.navigator?.language||e.document?.documentElement?.lang||void 0},l=(e,t)=>`${g}:${e}:${t??""}`;function m(e,t,i){let r=e?.get(l(t,i));if(!r)return null;try{let o=JSON.parse(r);return o?.apiKey===t?o.config:null}catch{return null}}async function p(e){let t=s(e.fetchImpl);if(!t)return e.onError?.(new Error("no fetch available for the prodantix messenger")),null;let i=c(e.host),r=l(e.apiKey,e.locale),o=e.locale?`?locale=${encodeURIComponent(e.locale)}`:"";try{let n=await t(`${i}/v1/messenger/config${o}`,{headers:{authorization:`Bearer ${e.apiKey}`},method:"GET"});if(!n.ok)return e.onError?.(new Error(`prodantix messenger config: ${n.status}`)),null;let a=JSON.parse(await n.text());return a.enabled?(e.storage?.set(r,JSON.stringify({apiKey:e.apiKey,config:a})),a):(e.storage?.remove(r),a)}catch(n){return e.onError?.(n),null}}exports.MESSENGER_CACHE_KEY=g;exports.cacheKeyFor=l;exports.cachedMessengerConfig=m;exports.fetchMessengerConfig=p;exports.localeCandidates=u;//# sourceMappingURL=messenger.cjs.map
2
2
  //# sourceMappingURL=messenger.cjs.map
@@ -1,2 +1,2 @@
1
- export { m as MESSENGER_CACHE_KEY, M as MessengerConfig, n as MessengerConfigOptions, o as cachedMessengerConfig, p as fetchMessengerConfig } from './config-D8-uiWM8.cjs';
1
+ export { p as MESSENGER_CACHE_KEY, q as MessengerAttachments, M as MessengerConfig, s as MessengerConfigOptions, t as StarterPrompt, u as cacheKeyFor, v as cachedMessengerConfig, w as fetchMessengerConfig, x as localeCandidates } from './config-CMF9zz1a.cjs';
2
2
  import './http-BCh716Vs.cjs';
@@ -1,2 +1,2 @@
1
- export { m as MESSENGER_CACHE_KEY, M as MessengerConfig, n as MessengerConfigOptions, o as cachedMessengerConfig, p as fetchMessengerConfig } from './config-DGUsxWOL.js';
1
+ export { p as MESSENGER_CACHE_KEY, q as MessengerAttachments, M as MessengerConfig, s as MessengerConfigOptions, t as StarterPrompt, u as cacheKeyFor, v as cachedMessengerConfig, w as fetchMessengerConfig, x as localeCandidates } from './config-DqC0lcr7.js';
2
2
  import './http-BCh716Vs.js';