@botpress/webchat 5.5.3 → 5.5.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/.turbo/turbo-build.log +5 -5
- package/dist/index.d.ts +6 -1
- package/dist/index.js +24 -24
- package/dist/index.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -452,7 +452,7 @@ Please start a new conversation.`,Sl={ResourceNotFound:{type:"configuration",mes
|
|
|
452
452
|
[zustand devtools middleware] Unsupported __setState action format.
|
|
453
453
|
When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
|
|
454
454
|
and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
|
|
455
|
-
`);const b=v.state[s];if(b==null)return;JSON.stringify(r.getState())!==JSON.stringify(b)&&u(b);return}Bv(r)&&r.dispatch(v)});case"DISPATCH":switch(h.payload.type){case"RESET":return u(m),s===void 0?c==null?void 0:c.init(r.getState()):c==null?void 0:c.init(Fo(l.name));case"COMMIT":if(s===void 0){c==null||c.init(r.getState());return}return c==null?void 0:c.init(Fo(l.name));case"ROLLBACK":return rc(h.state,v=>{if(s===void 0){u(v),c==null||c.init(r.getState());return}u(v[s]),c==null||c.init(Fo(l.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return rc(h.state,v=>{if(s===void 0){u(v);return}JSON.stringify(r.getState())!==JSON.stringify(v[s])&&u(v[s])});case"IMPORT_STATE":{const{nextLiftedState:v}=h.payload,b=(g=v.computedStates.slice(-1)[0])==null?void 0:g.state;if(!b)return;u(s===void 0?b:b[s]),c==null||c.send(null,v);return}case"PAUSE_RECORDING":return p=!p}return}}),m},rc=(e,n)=>{let t;try{t=JSON.parse(e)}catch(i){console.error("[zustand devtools middleware] Could not parse the received json",i)}t!==void 0&&n(t)};function Io(e,n){let t;try{t=e()}catch{return}return{getItem:r=>{var a;const o=l=>l===null?null:JSON.parse(l,void 0),s=(a=t.getItem(r))!=null?a:null;return s instanceof Promise?s.then(o):o(s)},setItem:(r,a)=>t.setItem(r,JSON.stringify(a,void 0)),removeItem:r=>t.removeItem(r)}}const ac=e=>n=>{try{const t=e(n);return t instanceof Promise?t:{then(i){return ac(i)(t)},catch(i){return this}}}catch(t){return{then(i){return this},catch(i){return ac(i)(t)}}}},Po=(e,n)=>(t,i,r)=>{let a={storage:Io(()=>window.localStorage),partialize:g=>g,version:0,merge:(g,v)=>({...v,...g}),...n},o=!1,s=0;const l=new Set,f=new Set;let c=a.storage;if(!c)return e((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),t(...g)},i,r);const d=()=>{const g=a.partialize({...i()});return c.setItem(a.name,{state:g,version:a.version})},p=r.setState;r.setState=(g,v)=>(p(g,v),d());const u=e((...g)=>(t(...g),d()),i,r);r.getInitialState=()=>u;let m;const h=()=>{var g,v;if(!c)return;const b=++s;o=!1,l.forEach(w=>{var x;return w((x=i())!=null?x:u)});const k=((v=a.onRehydrateStorage)==null?void 0:v.call(a,(g=i())!=null?g:u))||void 0;return ac(c.getItem.bind(c))(a.name).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==a.version){if(a.migrate){const x=a.migrate(w.state,w.version);return x instanceof Promise?x.then(S=>[!0,S]):[!0,x]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,w.state];return[!1,void 0]}).then(w=>{var x;if(b!==s)return;const[S,M]=w;if(m=a.merge(M,(x=i())!=null?x:u),t(m,!0),S)return d()}).then(()=>{b===s&&(k==null||k(i(),void 0),m=i(),o=!0,f.forEach(w=>w(m)))}).catch(w=>{b===s&&(k==null||k(void 0,w))})};return r.persist={setOptions:g=>{a={...a,...g},g.storage&&(c=g.storage)},clearStorage:()=>{c==null||c.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>h(),hasHydrated:()=>o,onHydrate:g=>(l.add(g),()=>{l.delete(g)}),onFinishHydration:g=>(f.add(g),()=>{f.delete(g)})},a.skipHydration||h(),m||u},b8=(e,n)=>Nt()(Ki(Po(t=>({messageHistory:[],addMessageToHistory:i=>t(r=>({...r,messageHistory:[i,...(r.messageHistory??[]).slice(0,100).filter(String)]})),clearHistory:()=>t(()=>({messageHistory:[]}))}),{name:e,storage:Io(()=>n==="sessionStorage"?sessionStorage:localStorage)}))),oc={},$v=(e,n,t)=>{const r=`${n||"bp-webchat"}-message-history-${e}`;return oc[r]||(oc[r]=b8(r,t)),oc[r]};let y8="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Oo=(e=21)=>{let n="",t=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)n+=y8[t[e]&63];return n};function vt(e){var o;const{metadata:n,conversationId:t,userId:i}=e,{payload:r,disableInput:a}=k8(e.payload);return{id:e.id,conversationId:t,authorId:i,timestamp:new Date(e.createdAt),block:r,disableInput:a,feedback:(o=e.feedback)==null?void 0:o.value,metadata:n}}const k8=e=>{switch(e.type){case"text":return{payload:{type:"text",text:e.text,value:e.value,citationPath:"root.text"}};case"markdown":return{payload:{type:"text",text:e.markdown,citationPath:"root.markdown"}};case"image":return{payload:{type:"image",url:e.imageUrl}};case"video":return{payload:{type:"video",url:e.videoUrl}};case"audio":return{payload:{type:"audio",url:e.audioUrl}};case"file":return{payload:{type:"file",url:e.fileUrl,title:e.title}};case"location":return{payload:{type:"location",latitude:e.latitude,longitude:e.longitude,title:e.title??e.address??"View on map"}};case"card":return{payload:Rv(e,"root")};case"carousel":return{payload:{type:"carousel",cards:e.items.map((n,t)=>Rv({...n},`root.items.${t}`))}};case"choice":return w8(e);case"dropdown":return _8(e);case"bloc":return{payload:x8(e)};case"custom":return{payload:{type:"custom",name:e.name,url:e.url,data:e}};default:{const n=e;throw new Error(`Unsupported message type ${n}`)}}},Rv=(e,n)=>({type:"card",imageUrl:e.imageUrl,title:e.title,subtitle:e.subtitle,actions:e.actions.map(t=>({label:t.label,value:t.value,variant:t.action==="url"?"link":"action"})),citationBasePath:n}),w8=e=>{const n=Oo();return{disableInput:e.disableFreeText,payload:{type:"choice",text:e.text,options:e.options.map(t=>({label:t.label,value:t.value})),groupId:n,disableFreeText:e.disableFreeText}}},_8=e=>({disableInput:!0,payload:{type:"dropdown",text:e.text,options:e.options.map(n=>({label:n.label,value:n.value}))}}),x8=e=>{var t;const n=e.items.map((i,r)=>{switch(i.type){case"text":return{type:"text",text:i.payload.text,value:i.payload.value,citationPath:`root.items.${r}.payload.text`};case"markdown":return{type:"text",text:i.payload.markdown,citationPath:`root.items.${r}.payload.markdown`};case"image":return{type:"image",url:i.payload.imageUrl};case"video":return{type:"video",url:i.payload.videoUrl};case"audio":return{type:"audio",url:i.payload.audioUrl};case"file":return{type:"file",url:i.payload.fileUrl,title:i.payload.title};case"location":return{type:"location",latitude:i.payload.latitude,longitude:i.payload.longitude,title:i.payload.title??i.payload.address??"View on map"};default:throw new Error("Unsupported bloc item type")}});return n.length===1&&((t=n[0])==null?void 0:t.type)==="text"?n[0]:{type:"bloc",items:n}},S8=e=>typeof requestAnimationFrame=="function"?{type:"animation",id:requestAnimationFrame(e)}:{type:"timeout",id:setTimeout(()=>e(Date.now()),16)},C8=e=>{if(e.type==="animation"){cancelAnimationFrame(e.id);return}clearTimeout(e.id)},Lt=(e,n)=>{var i;const t=(i=e.metadata)==null?void 0:i[n];return typeof t=="string"?t:void 0},jv=(e,n)=>{const t=Lt(n,"clientMessageId");let i=-1;return t&&(i=e.findIndex(r=>Lt(r,"clientMessageId")===t)),i===-1&&(i=e.findIndex(r=>r.id===n.id)),i===-1?[...e,n]:[...e.slice(0,i),{...e[i],...n},...e.slice(i+1)]},Hv=e=>{const n={id:`stream:${e.streamId}`,conversationId:e.conversationId,userId:e.userId,createdAt:e.createdAt,payload:{type:"bloc",items:[{type:"text",payload:{text:e.content}}]},metadata:{streamId:e.streamId,clientMessageId:e.clientMessageId,messageStreamStatus:"streaming"}};return vt(n)},E8=e=>{const n=new Map;let t,i=0;const r=()=>{t!==void 0&&(C8(t),t=void 0)},a=l=>{n.delete(l),n.size===0&&r()},o=l=>{const f=Lt(l,"streamId"),c=Lt(l,"clientMessageId");f&&n.delete(f),c&&n.forEach((d,p)=>{const u=d.values().next().value;(u==null?void 0:u.clientMessageId)===c&&n.delete(p)}),n.size===0&&r()},s=(l,f,c)=>{const d=c??Lt(f,"streamId"),p=Lt(f,"clientMessageId");let u=!1;const m={...l};for(const[h,g]of Object.entries(l))(h===d||p&&g.clientMessageId===p)&&(delete m[h],u=!0);return u?m:l};return Nt()(Ki((l,f)=>{const c=()=>n.size>0||Object.keys(f().messageStreams).length>0,d=()=>{if(t=void 0,n.size===0)return;const u=Array.from(n.entries());l(m=>{const{messageStreams:h}=m,g={...h};let v=!1;for(const[b,k]of u){const w=g[b];let x=(w==null?void 0:w.sequence)??0,S;const M=[];for(;;){const O=k.get(x+1);if(!O)break;k.delete(O.sequence),S??(S=O),x=O.sequence,M.push(O.delta)}if(k.size===0&&n.delete(b),!S||M.length===0)continue;const I={streamId:b,conversationId:e,userId:(w==null?void 0:w.userId)??S.userId,createdAt:(w==null?void 0:w.createdAt)??S.createdAt,clientMessageId:(w==null?void 0:w.clientMessageId)??S.clientMessageId,sequence:x,content:((w==null?void 0:w.content)??"")+M.join("")};g[b]={...I,message:Hv(I),order:(w==null?void 0:w.order)??i++},v=!0}return v?{messageStreams:g}:m})},p=()=>{t===void 0&&(t=S8(d))};return{messages:[],messageStreams:{},setMessages:u=>{for(const m of u)o(m);l(({messageStreams:m})=>({messages:u,messageStreams:u.reduce((h,g)=>s(h,g),m)}))},saveMessage:u=>{o(u),l(({messages:m,messageStreams:h})=>({messages:jv(m,u),messageStreams:s(h,u)}))},updateMessage:(u,m)=>l(({messages:h})=>({messages:h.map(g=>g.id===u?{...g,...m}:g)})),removeMessage:u=>l(({messages:m})=>({messages:m.filter(h=>h.id!==u)})),clearMessages:()=>{r(),n.clear(),l({messages:[],messageStreams:{}})},upsertMessageStream:u=>{if(u.conversationId!==e||u.sequence<1)return{status:"ignored"};const m=f().messageStreams[u.streamId],h=(m==null?void 0:m.sequence)??0,g=n.get(u.streamId)??new Map;if(u.sequence<=h||g.has(u.sequence))return{status:"ignored"};let v=h;for(;g.has(v+1);)v++;const b=u.sequence!==v+1,k=!m&&!b&&v===0;return g.set(u.sequence,u),n.set(u.streamId,g),b||p(),{status:b?"gap":k?"started":"queued"}},completeMessageStream:({streamId:u,message:m})=>(a(u),o(m),l(({messages:h,messageStreams:g})=>({messages:jv(h,m),messageStreams:s(g,m,u)})),c()),abortMessageStream:({streamId:u,conversationId:m})=>(m!==e||(a(u),l(({messageStreams:h})=>{if(!h[u])return{messageStreams:h};const g={...h};return delete g[u],{messageStreams:g}})),c()),setMessageStreamSnapshots:u=>{r(),n.clear();const m=u.reduce((h,g)=>(g.conversationId!==e||f().messages.some(b=>{const k=Lt(b,"streamId"),w=Lt(b,"clientMessageId");return k===g.streamId||!!w&&w===g.clientMessageId})||(h[g.streamId]={...g,message:Hv(g),order:i++}),h),{});l({messageStreams:m})},clearMessageStreams:()=>{r(),n.clear(),l({messageStreams:{}})}}},{name:`messages-${e}`}))},sc={},bt=e=>{const n=`messages-${e}`;return sc[n]||(sc[n]=E8(e)),sc[n]},T8=31536e3,Vv=4096,A8=()=>typeof location<"u"&&location.protocol==="https:",M8=e=>/[\s/:]/.test(e),Wv=e=>(e&&M8(e)&&console.warn(`[webchat] cookieDomain "${e}" looks invalid — use a bare domain like ".acme.com" or "acme.com"; cross-subdomain sharing may fail`),{getItem:n=>{if(typeof document>"u")return null;for(const t of document.cookie.split(";")){const i=t.trim(),r=i.indexOf("=");if(r!==-1&&i.slice(0,r)===n)return decodeURIComponent(i.slice(r+1))}return null},setItem:(n,t)=>{if(typeof document>"u")return;const i=`${n}=${encodeURIComponent(t)}`;i.length>Vv&&console.warn(`[webchat] cookie "${n}" is ${i.length} bytes, exceeding the ~${Vv} byte limit; it may be dropped by the browser`);const r=[i,"Path=/",`Max-Age=${T8}`,"SameSite=Lax"];e&&r.push(`Domain=${e}`),A8()&&r.push("Secure"),document.cookie=r.join("; ")},removeItem:n=>{if(typeof document>"u")return;const t=[`${n}=`,"Path=/","Max-Age=0"];e&&t.push(`Domain=${e}`),document.cookie=t.join("; ")}}),F8=(e,n,t)=>Nt()(Ki(Po(i=>({setUser:r=>i(a=>({...a,user:r})),setConversationId:r=>i(a=>({...a,conversationId:r})),clearAll:()=>{i(r=>({...r,user:void 0,conversationId:void 0}))}}),{name:e,storage:Io(()=>n==="cookieStorage"?Wv(t):n==="sessionStorage"?sessionStorage:localStorage)}))),lc={},qv=(e="bp-webchat",n,t)=>{const i=`${e}-client`;return lc[i]||(lc[i]=F8(i,n,t)),lc[i]},rt=Nt()(Ki(e=>({eventEmitter:kp(),messageContainerRef:E.createRef(),setMessageContainerRef:n=>e({messageContainerRef:n}),portalContainer:null,setPortalContainer:n=>e({portalContainer:n})}),{name:"webchatStore"})),I8=8,P8=e=>Nt()(Po((n,t)=>({files:[],setFiles:i=>n({files:i}),upsertFile:i=>n(({files:r})=>({files:r.some(s=>s.name===i.name)?r.map(s=>s.name===i.name?{...s,...i}:s):[...r,{...i}]})),uploadFile:async(i,r)=>{if(t().files.length===I8)return;const a=i.name.lastIndexOf("."),o=a>0&&a<i.name.length-1,s=o?i.name.substring(0,a):i.name,l=o?i.name.substring(a):"",f=kx(s,t().files,p=>p.name),c=f+l,d=new File([i],c,{type:i.type});t().upsertFile({name:f,type:"file",instance:d,status:"loading"});try{const{fileUrl:p,type:u,fileId:m}=await r(d);t().upsertFile({fileId:m,name:f,type:u,url:p,instance:d,status:"uploaded"})}catch{t().upsertFile({name:f,type:"file",instance:d,status:"error"})}},deleteFile:i=>n(({files:r})=>({files:r.filter(a=>a.name!=i)}))}),{name:e,storage:Io(()=>sessionStorage)})),fc={},Uv=(e,n)=>{const i=`${n||"bp-webchat"}-composer-files-${e}`;return fc[i]||(fc[i]=P8(i)),fc[i]},O8=e=>Nt()(Ki(n=>({participants:[],setParticipants:t=>n({participants:t}),addParticipant:t=>n(i=>({participants:[...i.participants,t]})),removeParticipant:t=>n(i=>({participants:i.participants.filter(r=>r.id!==t)})),clearParticipants:()=>n({participants:[]})}),{name:e})),cc={},dc=e=>{const n=`participants-${e}`;return cc[n]||(cc[n]=O8(n)),cc[n]},D8=e=>Nt()(Ki(Po((n,t)=>({soundOn:!0,setSoundEnabled:i=>n({soundOn:i}),toggleSound:()=>n({soundOn:!t().soundOn})}),{name:e}))),uc={},Gv=(e="bp-webchat")=>{const n=`${e}-sound`;return uc[n]||(uc[n]=D8(n)),uc[n]},N8=Nt()((e,n)=>({components:{},getCustomComponent:async t=>{const i=n().components[t];if(i)return i;const r=await fetch(t).then(f=>f.text()),a=new Blob([r],{type:"application/javascript"}),s=await import(URL.createObjectURL(a)),l=()=>s.default;return e(f=>({components:{...f.components,[t]:l}})),l}}));function Do({source:e}){const[n,t]=E.useState(!1),i=hA(e);return!i||n?y.jsx("span",{className:"bpCitationFavicon bpCitationFaviconFallback","aria-hidden":!0,children:y.jsx(xg,{size:11,strokeWidth:2})}):y.jsx("img",{className:"bpCitationFavicon",src:i,alt:"",loading:"lazy",onError:()=>t(!0)})}function L8({source:e}){const n=wf(e),t=Ig(e),i=e.url?String(e.url):null,r=typeof e.description=="string"?e.description:null,a=i?"a":"div";return y.jsxs(a,{className:"bpCitationCard",...i?{href:i,target:"_blank",rel:"noopener noreferrer"}:{},children:[y.jsxs("span",{className:"bpCitationCardHead",children:[y.jsx(Do,{source:e}),y.jsx("span",{className:"bpCitationCardSource",children:t??n})]}),y.jsx("span",{className:"bpCitationCardTitle",children:n}),r&&y.jsx("span",{className:"bpCitationCardSnippet",children:r})]})}function z8({sources:e}){const n=Fg(e),[t,i]=E.useState(!1),[r,a]=E.useState(0),o=rt(g=>g.portalContainer),s=rt(g=>g.messageContainerRef),l=(s==null?void 0:s.current)??void 0,{refs:f,floatingStyles:c,context:d}=Xf({open:t,onOpenChange:g=>{i(g),g||a(0)},placement:"top-start",middleware:[Nf(6),fv({padding:8,boundary:l}),Lf({padding:8,boundary:l,crossAxis:!0}),zf({padding:8,boundary:l,apply({availableWidth:g,availableHeight:v,elements:b}){Object.assign(b.floating.style,{maxWidth:`${Math.min(340,g)}px`,maxHeight:`${v}px`})}})],whileElementsMounted:Of}),{getReferenceProps:p,getFloatingProps:u}=nc([jM(d,{delay:{open:120,close:80},handleClose:l8()}),i8(d),Zf(d),ic(d,{role:"dialog"})]);if(n.length===0)return null;const m=n.length>1,h=n[Math.min(r,n.length-1)];return y.jsxs(y.Fragment,{children:[y.jsxs("span",{className:"bpCitationPill",role:"button",tabIndex:0,ref:f.setReference,...p(),children:[y.jsx(Do,{source:n[0]}),y.jsx("span",{className:"bpCitationPillLabel",children:wf(n[0])}),m&&y.jsxs("span",{className:"bpCitationPillMore",children:["+",n.length-1]})]}),t&&y.jsx(Jf,{root:o,children:y.jsxs("div",{ref:f.setFloating,style:{...c,pointerEvents:"auto"},className:"bpReset bpCitationTooltip",...u(),children:[m&&y.jsxs("div",{className:"bpCitationPager",children:[y.jsx("button",{type:"button",className:"bpCitationPagerButton",onClick:g=>{g.preventDefault(),a(v=>(v-1+n.length)%n.length)},"aria-label":"Previous source",children:y.jsx(lT,{size:14})}),y.jsx("button",{type:"button",className:"bpCitationPagerButton",onClick:g=>{g.preventDefault(),a(v=>(v+1)%n.length)},"aria-label":"Next source",children:y.jsx(fT,{size:14})}),y.jsxs("span",{className:"bpCitationPagerCount",children:[Math.min(r,n.length-1)+1,"/",n.length]})]}),h&&y.jsx(L8,{source:h})]})})]})}function pc(e,n){var t;if(n.length===0)return e;if(typeof e=="string"){if(!e.includes(xf))return e;const i=[];let r=0,a;const o=vA();for(;a=o.exec(e);){a.index>r&&i.push(e.slice(r,a.index));const s=Number(a[1]),l=n[s];l&&i.push(y.jsx(z8,{sources:l},`c${s}-${a.index}`)),r=a.index+a[0].length}return r<e.length&&i.push(e.slice(r)),i}if(Array.isArray(e))return e.map((i,r)=>y.jsx(E.Fragment,{children:pc(i,n)},r));if(E.isValidElement(e)){const i=e;if(((t=i.props)==null?void 0:t.children)!=null)return E.cloneElement(i,void 0,pc(i.props.children,n))}return e}function B8(){const e=this.data();(e.micromarkExtensions??(e.micromarkExtensions=[])).push({disable:{null:["codeIndented"]}})}function $8(e){const n=E.Children.toArray(e);return n.length===1&&E.isValidElement(n[0])&&n[0].type==="img"}function R8(e){const n=E.Children.toArray(e);return n.length===0?!0:n.every(t=>typeof t=="string"&&t.trim()==="")}const j8=8,Yi=({text:e,ctx:n,bare:t,citationPath:i,citationOffsetShift:r})=>{const[a,o]=E.useState(new Map),{presentedText:s,shouldAnimate:l}=H8(e,n.isStreaming===!0);E.useEffect(()=>{const b=/!\[.*?\]\((.*?)\)/g;let k;for(;(k=b.exec(e))!==null;){const w=k[1];if(w&&!a.has(w)){const x=new Image;x.src=w,x.onerror=()=>o(S=>new Map(S).set(w,!0)),x.onload=()=>o(S=>new Map(S).set(w,!1))}}},[e]);const f=i?uA(n.citations??[],i):[],{text:c,groups:d}=E.useMemo(()=>bA(s,f,r??0),[s,JSON.stringify(f),r]),p=E.useRef(d),u=E.useRef(l);p.current=d,u.current=l;const m=E.useCallback((b,k=!0)=>{const w=k&&p.current.length>0?pc(b,p.current):b;return u.current?y.jsx(W8,{children:w}):w},[]),g={...E.useMemo(()=>V8(m,()=>u.current),[m]),a:({node:b,href:k,children:w,...x})=>$8(w)?y.jsx(y.Fragment,{children:w}):R8(w)?null:y.jsx("a",{...x,className:"bpMessageBlocksTextLink",onMouseUp:()=>k&&window.open(k,"_blank","noopener,noreferrer"),children:m(w)}),img:({node:b,...k})=>a.get(k.src)?y.jsx("div",{"data-error":!0,className:"bpMessageBlocksTextImage",children:y.jsx(Sg,{strokeWidth:"1"})}):y.jsx("img",{...k,className:"bpMessageBlocksTextImage"}),pre:({node:b,...k})=>y.jsx(U8,{node:b,...k})},v=y.jsx(B1,{urlTransform:b=>b.startsWith("tel:")?b:$1(b),components:g,remarkPlugins:[B8,tT,Q9],children:d.length>0?c:s});return t?v:y.jsx(lo,{ctx:n,children:v})},H8=(e,n)=>{const t=E.useRef(n),[i,r]=E.useState(()=>n?mc(e):e);return n&&(t.current=!0),E.useLayoutEffect(()=>{r(a=>e.startsWith(a)?a:t.current?mc(e):e)},[e]),E.useEffect(()=>{if(!t.current||i===e||!e.startsWith(i))return;const a=()=>{r(s=>{if(!e.startsWith(s))return mc(e);const l=Array.from(e.slice(s.length)).slice(0,j8).join("");return l?s+l:s})};if(typeof requestAnimationFrame=="function"){const s=requestAnimationFrame(a);return()=>cancelAnimationFrame(s)}const o=setTimeout(a,16);return()=>clearTimeout(o)},[i,e]),{presentedText:i,shouldAnimate:t.current}},mc=e=>Array.from(e)[0]??"",V8=(e,n)=>({h1:({node:t,children:i,...r})=>y.jsx("h1",{...r,className:"bpMessageBlocksTextHeading1",children:e(i)}),h2:({node:t,children:i,...r})=>y.jsx("h2",{...r,className:"bpMessageBlocksTextHeading2",children:e(i)}),h3:({node:t,children:i,...r})=>y.jsx("h3",{...r,className:"bpMessageBlocksTextHeading3",children:e(i)}),h4:({node:t,children:i,...r})=>y.jsx("h4",{...r,className:"bpMessageBlocksTextHeading4",children:e(i)}),h5:({node:t,children:i,...r})=>y.jsx("h4",{...r,className:n()?"bpMessageBlocksTextHeading4":void 0,children:e(i)}),h6:({node:t,children:i,...r})=>y.jsx("h4",{...r,className:n()?"bpMessageBlocksTextHeading4":void 0,children:e(i)}),em:({node:t,children:i,...r})=>y.jsx("em",{...r,className:"bpMessageBlocksTextItalic",children:e(i)}),strong:({node:t,children:i,...r})=>y.jsx("strong",{...r,className:"bpMessageBlocksTextBold",children:e(i)}),p:({node:t,children:i,...r})=>y.jsx("p",{...r,className:"bpMessageBlocksTextText",children:e(i)}),hr:({node:t,...i})=>y.jsx("hr",{...i,className:"bpMessageBlocksTextHorizontalRule"}),ol:({node:t,...i})=>y.jsx("ol",{...i,className:"bpMessageBlocksTextOrderedList"}),ul:({node:t,...i})=>y.jsx("ul",{...i,className:"bpMessageBlocksTextUnorderedList"}),li:({node:t,children:i,...r})=>y.jsx("li",{...r,className:"bpMessageBlocksTextListItem",children:e(i)}),br:({node:t,...i})=>y.jsx("br",{...i,className:"bpMessageBlocksTextLineBreak"}),input:({node:t,...i})=>y.jsx("input",{...i,className:"bpMessageBlocksTextInput",disabled:!1}),code:({node:t,children:i,...r})=>y.jsx("code",{...r,className:"bpMessageBlocksTextCode",children:e(i,!1)}),table:({node:t,...i})=>y.jsx("div",{className:"bpMessageBlocksTextTableContainer",children:y.jsx("table",{...i,className:"bpMessageBlocksTextTable"})}),th:({node:t,children:i,...r})=>y.jsx("th",{...r,className:"bpMessageBlocksTextTableHeader",children:e(i)}),tr:({node:t,...i})=>y.jsx("tr",{...i,className:"bpMessageBlocksTextTableRow"}),td:({node:t,children:i,...r})=>y.jsx("td",{...r,className:"bpMessageBlocksTextTableData",children:e(i)})}),W8=({children:e})=>E.Children.map(e,(n,t)=>typeof n=="string"?y.jsx(q8,{text:n},`stream-fragment:${t}`):n),q8=({text:e})=>{const[n,t]=E.useState(()=>({sourceText:e,settledText:"",chunks:Kv(e,0)}));E.useLayoutEffect(()=>{t(r=>{if(r.sourceText===e)return r;const a=e.startsWith(r.sourceText),o=a?e.slice(r.sourceText.length):e,s=Kv(o,a?r.sourceText.length:0);if(!a)return{sourceText:e,settledText:"",chunks:s};const l=[...r.chunks,...s],f=Math.max(0,l.length-160);return{sourceText:e,settledText:r.settledText+l.slice(0,f).map(c=>c.text).join(""),chunks:l.slice(f)}})},[e]);const i=r=>{t(a=>{const o=a.chunks.findIndex(l=>l.id===r);if(o===-1)return a;const s=a.chunks.slice(0,o+1);return{...a,settledText:a.settledText+s.map(l=>l.text).join(""),chunks:a.chunks.slice(o+1)}})};return y.jsxs(y.Fragment,{children:[n.settledText,n.chunks.map(r=>y.jsx("span",{className:"bpMessageStreamChunk",onAnimationEnd:()=>i(r.id),children:r.text},r.id))]})},Kv=(e,n)=>e?[{id:`${n}`,text:e}]:[],U8=({node:e,...n})=>{var l,f;const t=e==null?void 0:e.children[0],i=G8(((f=(l=t==null?void 0:t.properties)==null?void 0:l.className)==null?void 0:f[0])||""),[r,a]=E.useState(!1),o=E.useRef(null),s=()=>{var d;const c=((d=o.current)==null?void 0:d.textContent)||"";navigator.clipboard.writeText(c).then(()=>{a(!0),setTimeout(()=>a(!1),1500)})};return y.jsxs("div",{className:"bpMessageBlocksTextCodeBlockContainer",children:[y.jsxs("div",{className:"bpMessageBlocksTextCodeBlockTitle",children:[i?y.jsx("span",{children:i}):"Code",r?y.jsx(yf,{className:"bpMessageBlocksTextCodeBlockCopyIcon"}):y.jsx(ST,{className:"bpMessageBlocksTextCodeBlockCopyIcon",onClick:s})]}),y.jsx("pre",{ref:o,...n,className:"bpMessageBlocksTextCodeBlock"})]})},G8=e=>{var n;return((n=e==null?void 0:e.match(/language-(\w+)/))==null?void 0:n[1])??""},hc=E.createContext(null);function Yv(){const e=E.useContext(hc);if(!e)throw new Error("useMessageContext must be used within a Message");return e}const gc=E.createContext({showInputModal:void 0});function vc(){return E.useContext(gc)}const Jv=({className:e,...n})=>y.jsx("div",{"data-slot":"skeleton",className:`bpSkeleton ${e||""}`,...n});Jv.displayName="Skeleton";var Dn=function(){return Dn=Object.assign||function(n){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(n[a]=t[a])}return n},Dn.apply(this,arguments)};function Zv(e,n){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(e);r<i.length;r++)n.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(t[i[r]]=e[i[r]]);return t}function Ji(e,n,t,i){function r(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(c){try{f(i.next(c))}catch(d){o(d)}}function l(c){try{f(i.throw(c))}catch(d){o(d)}}function f(c){c.done?a(c.value):r(c.value).then(s,l)}f((i=i.apply(e,n||[])).next())})}function Zi(e,n){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,r,a,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(f){return function(c){return l([f,c])}}function l(f){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(t=0)),t;)try{if(i=1,r&&(a=f[0]&2?r.return:f[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,f[1])).done)return a;switch(r=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return t.label++,{value:f[1],done:!1};case 5:t.label++,r=f[1],f=[0];continue;case 7:f=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){t=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){t.label=f[1];break}if(f[0]===6&&t.label<a[1]){t.label=a[1],a=f;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(f);break}a[2]&&t.ops.pop(),t.trys.pop();continue}f=n.call(e,t)}catch(c){f=[6,c],r=0}finally{i=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function Qv(e,n){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var i=t.call(e),r,a=[],o;try{for(;(n===void 0||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function bc(e,n,t){if(t||arguments.length===2)for(var i=0,r=n.length,a;i<r;i++)(a||!(i in n))&&(a||(a=Array.prototype.slice.call(n,0,i)),a[i]=n[i]);return e.concat(a||Array.prototype.slice.call(n))}typeof SuppressedError=="function"&&SuppressedError;function K8(){var e=E.useRef(!1),n=E.useCallback(function(){return e.current},[]);return E.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),n}function Y8(e,n,t){n===void 0&&(n=[]),t===void 0&&(t={loading:!1});var i=E.useRef(0),r=K8(),a=E.useState(t),o=a[0],s=a[1],l=E.useCallback(function(){for(var f=[],c=0;c<arguments.length;c++)f[c]=arguments[c];var d=++i.current;return o.loading||s(function(p){return Dn(Dn({},p),{loading:!0})}),e.apply(void 0,f).then(function(p){return r()&&d===i.current&&s({value:p,loading:!1}),p},function(p){return r()&&d===i.current&&s({error:p,loading:!1}),p})},n);return[o,l]}function J8(e,n){n===void 0&&(n=[]);var t=Y8(e,n,{loading:!0}),i=t[0],r=t[1];return E.useEffect(function(){r()},[r]),i}const No=E.forwardRef(({url:e,orientation:n="auto",...t},i)=>{const r=E.useId(),{setIsLoading:a}=Yv(),[o,s]=E.useState(n==="auto"?"square":n),[l,f]=E.useState("initial");return E.useLayoutEffect(()=>(a(c=>[...c,r]),()=>{a(c=>c.filter(d=>d!==r))}),[r,a]),J8(async()=>{if(!e)return;const c=new Image;try{const{width:d,height:p}=await N_(e);n==="auto"&&s(Z8(d,p)),c.onload=()=>{f("loaded"),a(u=>u.filter(m=>m!==r))},c.onerror=()=>{f("error"),s("square"),a(u=>u.filter(m=>m!==r))},c.src=e,c.complete&&(c.naturalWidth>0?(f("loaded"),a(u=>u.filter(m=>m!==r))):(f("error"),s("square"),a(u=>u.filter(m=>m!==r))))}catch(d){console.error(d),f("error"),a(p=>p.filter(u=>u!==r))}return()=>{c.onload=null,c.onerror=null}},[e,r,a,n]),e?l==="error"?y.jsx("div",{"data-error":"true","data-orientation":o,...t,className:"bpMessageBlocksImageImage",ref:i,children:y.jsx(Sg,{size:"25%",strokeWidth:"5%"})}):l==="initial"?y.jsx(Jv,{"data-orientation":o,className:"bpMessageBlocksImagePlaceholder"}):y.jsx("img",{"data-orientation":o,"data-loaded":l==="loaded",...t,className:"bpMessageBlocksImageImage",src:e,alt:"",ref:i}):null});No.displayName="Image";function Z8(e,n){const t={square:1,portrait:.75,landscape:1.3333333333333333},i=e/n;return Object.keys(t).reduce((a,o)=>Math.abs(t[o]-i)<Math.abs(t[a]-i)?o:a)}const Xv=({url:e,isReadOnly:n})=>y.jsx("div",{children:y.jsx("video",{"data-chromatic":"ignore",style:n?{pointerEvents:"none"}:void 0,controls:!0,src:e,className:"bpMessageBlocksVideo"})}),e0=({url:e,isReadOnly:n})=>y.jsx("div",{children:y.jsx("audio",{controls:!0,style:n?{pointerEvents:"none"}:void 0,src:e,className:"bpMessageBlocksAudio"})}),n0=({title:e,url:n,isReadOnly:t})=>y.jsxs("a",{className:"bpMessageBlocksFileContainer",href:n,style:t?{pointerEvents:"none"}:void 0,download:!0,target:"_blank",rel:"noreferrer",children:[y.jsx("p",{className:"bpMessageBlocksFileTitle",children:e||n}),y.jsx(xT,{className:"bpMessageBlocksFileIcon"})]}),t0=({latitude:e,longitude:n,title:t,isReadOnly:i})=>{const r=`https://www.google.com/maps/search/?api=1&query=${e},${n}`;return y.jsxs("a",{className:"bpMessageBlocksLocationContainer",style:i?{pointerEvents:"none"}:void 0,href:r,target:"_blank",rel:"noopener",children:[y.jsx("p",{className:"bpMessageBlocksLocationTitle",children:t}),y.jsx(Cg,{className:"bpMessageBlocksLocationIcon"})]})},yc=({text:e,buttonValue:n,variant:t,groupId:i,reusable:r,sendMessage:a,isReadOnly:o})=>{const s=rt(v=>v.eventEmitter),[l,f]=E.useState(!1),[c,d]=E.useState(!1),[p,u]=E.useState(!1);E.useEffect(()=>{if(i)return s.on(`button-group-${i}-click`,()=>{d(!0),r||u(!0)})},[s,i,r]);const h={onClick:v=>{if((p||o)&&t==="link"){v.preventDefault();return}f(!0),r||u(!0),i&&s.emit(`button-group-${i}-click`),t!=="link"&&a&&a({type:"text",text:e,value:n},{})},"data-activated":l?"":void 0,"data-group-activated":c?"":void 0,"data-type":t,className:"bpMessageBlocksButton"},g=p||o;return t==="link"?y.jsx("a",{...h,style:o?{pointerEvents:"none"}:void 0,href:n,target:"_blank",rel:"noopener noreferrer",children:e}):y.jsx("button",{...h,style:o?{pointerEvents:"none"}:void 0,disabled:g,children:e})},Q8=yc,kc=({actions:e,groupId:n,reusable:t,sendMessage:i,isReadOnly:r})=>e.length===0?null:y.jsx("div",{className:"bpMessageBlocksRow",children:e.map((a,o)=>y.jsx(yc,{text:a.label,buttonValue:a.value,variant:a.variant,groupId:n,reusable:t,sendMessage:i,isReadOnly:r},o))}),wc=({imageUrl:e,title:n,subtitle:t,actions:i,ctx:r,citationBasePath:a})=>y.jsx(lo,{ctx:r,children:y.jsxs("div",{className:"bpMessageBlocksColumn","data-horizontal":"center",children:[e&&y.jsx(No,{url:e}),n&&y.jsx(Yi,{text:`#### ${n}`,ctx:r,bare:!0,citationPath:a?`${a}.title`:void 0,citationOffsetShift:5}),t&&y.jsx(Yi,{text:t,ctx:r,bare:!0,citationPath:a?`${a}.subtitle`:void 0}),y.jsx(kc,{actions:i,reusable:!0,sendMessage:r.sendMessage,isReadOnly:r.isReadOnly})]})});function X8(e){return Object.prototype.toString.call(e)==="[object Object]"}function i0(e){return X8(e)||Array.isArray(e)}function eF(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function _c(e,n){const t=Object.keys(e),i=Object.keys(n);if(t.length!==i.length)return!1;const r=JSON.stringify(Object.keys(e.breakpoints||{})),a=JSON.stringify(Object.keys(n.breakpoints||{}));return r!==a?!1:t.every(o=>{const s=e[o],l=n[o];return typeof s=="function"?`${s}`==`${l}`:!i0(s)||!i0(l)?s===l:_c(s,l)})}function r0(e){return e.concat().sort((n,t)=>n.name>t.name?1:-1).map(n=>n.options)}function nF(e,n){if(e.length!==n.length)return!1;const t=r0(e),i=r0(n);return t.every((r,a)=>{const o=i[a];return _c(r,o)})}function xc(e){return typeof e=="number"}function Sc(e){return typeof e=="string"}function Lo(e){return typeof e=="boolean"}function a0(e){return Object.prototype.toString.call(e)==="[object Object]"}function He(e){return Math.abs(e)}function Cc(e){return Math.sign(e)}function ia(e,n){return He(e-n)}function tF(e,n){if(e===0||n===0||He(e)<=He(n))return 0;const t=ia(He(e),He(n));return He(t/e)}function iF(e){return Math.round(e*100)/100}function ra(e){return oa(e).map(Number)}function Gn(e){return e[aa(e)]}function aa(e){return Math.max(0,e.length-1)}function Ec(e,n){return n===aa(e)}function o0(e,n=0){return Array.from(Array(e),(t,i)=>n+i)}function oa(e){return Object.keys(e)}function s0(e,n){return[e,n].reduce((t,i)=>(oa(i).forEach(r=>{const a=t[r],o=i[r],s=a0(a)&&a0(o);t[r]=s?s0(a,o):o}),t),{})}function Tc(e,n){return typeof n.MouseEvent<"u"&&e instanceof n.MouseEvent}function rF(e,n){const t={start:i,center:r,end:a};function i(){return 0}function r(l){return a(l)/2}function a(l){return n-l}function o(l,f){return Sc(e)?t[e](l):e(n,l,f)}return{measure:o}}function sa(){let e=[];function n(r,a,o,s={passive:!0}){let l;if("addEventListener"in r)r.addEventListener(a,o,s),l=()=>r.removeEventListener(a,o,s);else{const f=r;f.addListener(o),l=()=>f.removeListener(o)}return e.push(l),i}function t(){e=e.filter(r=>r())}const i={add:n,clear:t};return i}function aF(e,n,t,i){const r=sa(),a=1e3/60;let o=null,s=0,l=0;function f(){r.add(e,"visibilitychange",()=>{e.hidden&&m()})}function c(){u(),r.clear()}function d(g){if(!l)return;o||(o=g,t(),t());const v=g-o;for(o=g,s+=v;s>=a;)t(),s-=a;const b=s/a;i(b),l&&(l=n.requestAnimationFrame(d))}function p(){l||(l=n.requestAnimationFrame(d))}function u(){n.cancelAnimationFrame(l),o=null,s=0,l=0}function m(){o=null,s=0}return{init:f,destroy:c,start:p,stop:u,update:t,render:i}}function oF(e,n){const t=n==="rtl",i=e==="y",r=i?"y":"x",a=i?"x":"y",o=!i&&t?-1:1,s=c(),l=d();function f(m){const{height:h,width:g}=m;return i?h:g}function c(){return i?"top":t?"right":"left"}function d(){return i?"bottom":t?"left":"right"}function p(m){return m*o}return{scroll:r,cross:a,startEdge:s,endEdge:l,measureSize:f,direction:p}}function ui(e=0,n=0){const t=He(e-n);function i(f){return f<e}function r(f){return f>n}function a(f){return i(f)||r(f)}function o(f){return a(f)?i(f)?e:n:f}function s(f){return t?f-t*Math.ceil((f-n)/t):f}return{length:t,max:n,min:e,constrain:o,reachedAny:a,reachedMax:r,reachedMin:i,removeOffset:s}}function l0(e,n,t){const{constrain:i}=ui(0,e),r=e+1;let a=o(n);function o(p){return t?He((r+p)%r):i(p)}function s(){return a}function l(p){return a=o(p),d}function f(p){return c().set(s()+p)}function c(){return l0(e,s(),t)}const d={get:s,set:l,add:f,clone:c};return d}function sF(e,n,t,i,r,a,o,s,l,f,c,d,p,u,m,h,g,v,b){const{cross:k,direction:w}=e,x=["INPUT","SELECT","TEXTAREA"],S={passive:!1},M=sa(),I=sa(),O=ui(50,225).constrain(u.measure(20)),T={mouse:300,touch:400},P={mouse:500,touch:600},R=m?43:25;let z=!1,F=0,D=0,L=!1,j=!1,N=!1,V=!1;function _(H){if(!b)return;function Y(Te){(Lo(b)||b(H,Te))&&K(Te)}const de=n;M.add(de,"dragstart",Te=>Te.preventDefault(),S).add(de,"touchmove",()=>{},S).add(de,"touchend",()=>{}).add(de,"touchstart",Y).add(de,"mousedown",Y).add(de,"touchcancel",G).add(de,"contextmenu",G).add(de,"click",ne,!0)}function $(){M.clear(),I.clear()}function B(){const H=V?t:n;I.add(H,"touchmove",U,S).add(H,"touchend",G).add(H,"mousemove",U,S).add(H,"mouseup",G)}function C(H){const Y=H.nodeName||"";return x.includes(Y)}function q(){return(m?P:T)[V?"mouse":"touch"]}function Q(H,Y){const de=d.add(Cc(H)*-1),Te=c.byDistance(H,!m).distance;return m||He(H)<O?Te:g&&Y?Te*.5:c.byIndex(de.get(),0).distance}function K(H){const Y=Tc(H,i);V=Y,N=m&&Y&&!H.buttons&&z,z=ia(r.get(),o.get())>=2,!(Y&&H.button!==0)&&(C(H.target)||(L=!0,a.pointerDown(H),f.useFriction(0).useDuration(0),r.set(o),B(),F=a.readPoint(H),D=a.readPoint(H,k),p.emit("pointerDown")))}function U(H){if(!Tc(H,i)&&H.touches.length>=2)return G(H);const de=a.readPoint(H),Te=a.readPoint(H,k),te=ia(de,F),pe=ia(Te,D);if(!j&&!V&&(!H.cancelable||(j=te>pe,!j)))return G(H);const ge=a.pointerMove(H);te>h&&(N=!0),f.useFriction(.3).useDuration(.75),s.start(),r.add(w(ge)),H.preventDefault()}function G(H){const de=c.byDistance(0,!1).index!==d.get(),Te=a.pointerUp(H)*q(),te=Q(w(Te),de),pe=tF(Te,te),ge=R-10*pe,ve=v+pe/50;j=!1,L=!1,I.clear(),f.useDuration(ge).useFriction(ve),l.distance(te,!m),V=!1,p.emit("pointerUp")}function ne(H){N&&(H.stopPropagation(),H.preventDefault(),N=!1)}function Z(){return L}return{init:_,destroy:$,pointerDown:Z}}function lF(e,n){let i,r;function a(d){return d.timeStamp}function o(d,p){const m=`client${(p||e.scroll)==="x"?"X":"Y"}`;return(Tc(d,n)?d:d.touches[0])[m]}function s(d){return i=d,r=d,o(d)}function l(d){const p=o(d)-o(r),u=a(d)-a(i)>170;return r=d,u&&(i=d),p}function f(d){if(!i||!r)return 0;const p=o(r)-o(i),u=a(d)-a(i),m=a(d)-a(r)>170,h=p/u;return u&&!m&&He(h)>.1?h:0}return{pointerDown:s,pointerMove:l,pointerUp:f,readPoint:o}}function fF(){function e(t){const{offsetTop:i,offsetLeft:r,offsetWidth:a,offsetHeight:o}=t;return{top:i,right:r+a,bottom:i+o,left:r,width:a,height:o}}return{measure:e}}function cF(e){function n(i){return e*(i/100)}return{measure:n}}function dF(e,n,t,i,r,a,o){const s=[e].concat(i);let l,f,c=[],d=!1;function p(g){return r.measureSize(o.measure(g))}function u(g){if(!a)return;f=p(e),c=i.map(p);function v(b){for(const k of b){if(d)return;const w=k.target===e,x=i.indexOf(k.target),S=w?f:c[x],M=p(w?e:i[x]);if(He(M-S)>=.5){g.reInit(),n.emit("resize");break}}}l=new ResizeObserver(b=>{(Lo(a)||a(g,b))&&v(b)}),t.requestAnimationFrame(()=>{s.forEach(b=>l.observe(b))})}function m(){d=!0,l&&l.disconnect()}return{init:u,destroy:m}}function uF(e,n,t,i,r,a){let o=0,s=0,l=r,f=a,c=e.get(),d=0;function p(){const S=i.get()-e.get(),M=!l;let I=0;return M?(o=0,t.set(i),e.set(i),I=S):(t.set(e),o+=S/l,o*=f,c+=o,e.add(o),I=c-d),s=Cc(I),d=c,x}function u(){const S=i.get()-n.get();return He(S)<.001}function m(){return l}function h(){return s}function g(){return o}function v(){return k(r)}function b(){return w(a)}function k(S){return l=S,x}function w(S){return f=S,x}const x={direction:h,duration:m,velocity:g,seek:p,settled:u,useBaseFriction:b,useBaseDuration:v,useFriction:w,useDuration:k};return x}function pF(e,n,t,i,r){const a=r.measure(10),o=r.measure(50),s=ui(.1,.99);let l=!1;function f(){return!(l||!e.reachedAny(t.get())||!e.reachedAny(n.get()))}function c(u){if(!f())return;const m=e.reachedMin(n.get())?"min":"max",h=He(e[m]-n.get()),g=t.get()-n.get(),v=s.constrain(h/o);t.subtract(g*v),!u&&He(g)<a&&(t.set(e.constrain(t.get())),i.useDuration(25).useBaseFriction())}function d(u){l=!u}return{shouldConstrain:f,constrain:c,toggleActive:d}}function mF(e,n,t,i,r){const a=ui(-n+e,0),o=d(),s=c(),l=p();function f(m,h){return ia(m,h)<=1}function c(){const m=o[0],h=Gn(o),g=o.lastIndexOf(m),v=o.indexOf(h)+1;return ui(g,v)}function d(){return t.map((m,h)=>{const{min:g,max:v}=a,b=a.constrain(m),k=!h,w=Ec(t,h);return k?v:w||f(g,b)?g:f(v,b)?v:b}).map(m=>parseFloat(m.toFixed(3)))}function p(){if(n<=e+r)return[a.max];if(i==="keepSnaps")return o;const{min:m,max:h}=s;return o.slice(m,h)}return{snapsContained:l,scrollContainLimit:s}}function hF(e,n,t){const i=n[0],r=t?i-e:Gn(n);return{limit:ui(r,i)}}function gF(e,n,t,i){const a=n.min+.1,o=n.max+.1,{reachedMin:s,reachedMax:l}=ui(a,o);function f(p){return p===1?l(t.get()):p===-1?s(t.get()):!1}function c(p){if(!f(p))return;const u=e*(p*-1);i.forEach(m=>m.add(u))}return{loop:c}}function vF(e){const{max:n,length:t}=e;function i(a){const o=a-n;return t?o/-t:0}return{get:i}}function bF(e,n,t,i,r){const{startEdge:a,endEdge:o}=e,{groupSlides:s}=r,l=d().map(n.measure),f=p(),c=u();function d(){return s(i).map(h=>Gn(h)[o]-h[0][a]).map(He)}function p(){return i.map(h=>t[a]-h[a]).map(h=>-He(h))}function u(){return s(f).map(h=>h[0]).map((h,g)=>h+l[g])}return{snaps:f,snapsAligned:c}}function yF(e,n,t,i,r,a){const{groupSlides:o}=r,{min:s,max:l}=i,f=c();function c(){const p=o(a),u=!e||n==="keepSnaps";return t.length===1?[a]:u?p:p.slice(s,l).map((m,h,g)=>{const v=!h,b=Ec(g,h);if(v){const k=Gn(g[0])+1;return o0(k)}if(b){const k=aa(a)-Gn(g)[0]+1;return o0(k,Gn(g)[0])}return m})}return{slideRegistry:f}}function kF(e,n,t,i,r){const{reachedAny:a,removeOffset:o,constrain:s}=i;function l(m){return m.concat().sort((h,g)=>He(h)-He(g))[0]}function f(m){const h=e?o(m):s(m),g=n.map((b,k)=>({diff:c(b-h,0),index:k})).sort((b,k)=>He(b.diff)-He(k.diff)),{index:v}=g[0];return{index:v,distance:h}}function c(m,h){const g=[m,m+t,m-t];if(!e)return m;if(!h)return l(g);const v=g.filter(b=>Cc(b)===h);return v.length?l(v):Gn(g)-t}function d(m,h){const g=n[m]-r.get(),v=c(g,h);return{index:m,distance:v}}function p(m,h){const g=r.get()+m,{index:v,distance:b}=f(g),k=!e&&a(g);if(!h||k)return{index:v,distance:m};const w=n[v]-b,x=m+c(w,0);return{index:v,distance:x}}return{byDistance:p,byIndex:d,shortcut:c}}function wF(e,n,t,i,r,a,o){function s(d){const p=d.distance,u=d.index!==n.get();a.add(p),p&&(i.duration()?e.start():(e.update(),e.render(1),e.update())),u&&(t.set(n.get()),n.set(d.index),o.emit("select"))}function l(d,p){const u=r.byDistance(d,p);s(u)}function f(d,p){const u=n.clone().set(d),m=r.byIndex(u.get(),p);s(m)}return{distance:l,index:f}}function _F(e,n,t,i,r,a,o,s){const l={passive:!0,capture:!0};let f=0;function c(u){if(!s)return;function m(h){if(new Date().getTime()-f>10)return;o.emit("slideFocusStart"),e.scrollLeft=0;const b=t.findIndex(k=>k.includes(h));xc(b)&&(r.useDuration(0),i.index(b,0),o.emit("slideFocus"))}a.add(document,"keydown",d,!1),n.forEach((h,g)=>{a.add(h,"focus",v=>{(Lo(s)||s(u,v))&&m(g)},l)})}function d(u){u.code==="Tab"&&(f=new Date().getTime())}return{init:c}}function la(e){let n=e;function t(){return n}function i(l){n=o(l)}function r(l){n+=o(l)}function a(l){n-=o(l)}function o(l){return xc(l)?l:l.get()}return{get:t,set:i,add:r,subtract:a}}function f0(e,n){const t=e.scroll==="x"?o:s,i=n.style;let r=null,a=!1;function o(p){return`translate3d(${p}px,0px,0px)`}function s(p){return`translate3d(0px,${p}px,0px)`}function l(p){if(a)return;const u=iF(e.direction(p));u!==r&&(i.transform=t(u),r=u)}function f(p){a=!p}function c(){a||(i.transform="",n.getAttribute("style")||n.removeAttribute("style"))}return{clear:c,to:l,toggleActive:f}}function xF(e,n,t,i,r,a,o,s,l){const c=ra(r),d=ra(r).reverse(),p=v().concat(b());function u(M,I){return M.reduce((O,T)=>O-r[T],I)}function m(M,I){return M.reduce((O,T)=>u(O,I)>0?O.concat([T]):O,[])}function h(M){return a.map((I,O)=>({start:I-i[O]+.5+M,end:I+n-.5+M}))}function g(M,I,O){const T=h(I);return M.map(P=>{const R=O?0:-t,z=O?t:0,F=O?"end":"start",D=T[P][F];return{index:P,loopPoint:D,slideLocation:la(-1),translate:f0(e,l[P]),target:()=>s.get()>D?R:z}})}function v(){const M=o[0],I=m(d,M);return g(I,t,!1)}function b(){const M=n-o[0]-1,I=m(c,M);return g(I,-t,!0)}function k(){return p.every(({index:M})=>{const I=c.filter(O=>O!==M);return u(I,n)<=.1})}function w(){p.forEach(M=>{const{target:I,translate:O,slideLocation:T}=M,P=I();P!==T.get()&&(O.to(P),T.set(P))})}function x(){p.forEach(M=>M.translate.clear())}return{canLoop:k,clear:x,loop:w,loopPoints:p}}function SF(e,n,t){let i,r=!1;function a(l){if(!t)return;function f(c){for(const d of c)if(d.type==="childList"){l.reInit(),n.emit("slidesChanged");break}}i=new MutationObserver(c=>{r||(Lo(t)||t(l,c))&&f(c)}),i.observe(e,{childList:!0})}function o(){i&&i.disconnect(),r=!0}return{init:a,destroy:o}}function CF(e,n,t,i){const r={};let a=null,o=null,s,l=!1;function f(){s=new IntersectionObserver(m=>{l||(m.forEach(h=>{const g=n.indexOf(h.target);r[g]=h}),a=null,o=null,t.emit("slidesInView"))},{root:e.parentElement,threshold:i}),n.forEach(m=>s.observe(m))}function c(){s&&s.disconnect(),l=!0}function d(m){return oa(r).reduce((h,g)=>{const v=parseInt(g),{isIntersecting:b}=r[v];return(m&&b||!m&&!b)&&h.push(v),h},[])}function p(m=!0){if(m&&a)return a;if(!m&&o)return o;const h=d(m);return m&&(a=h),m||(o=h),h}return{init:f,destroy:c,get:p}}function EF(e,n,t,i,r,a){const{measureSize:o,startEdge:s,endEdge:l}=e,f=t[0]&&r,c=m(),d=h(),p=t.map(o),u=g();function m(){if(!f)return 0;const b=t[0];return He(n[s]-b[s])}function h(){if(!f)return 0;const b=a.getComputedStyle(Gn(i));return parseFloat(b.getPropertyValue(`margin-${l}`))}function g(){return t.map((b,k,w)=>{const x=!k,S=Ec(w,k);return x?p[k]+c:S?p[k]+d:w[k+1][s]-b[s]}).map(He)}return{slideSizes:p,slideSizesWithGaps:u,startGap:c,endGap:d}}function TF(e,n,t,i,r,a,o,s,l){const{startEdge:f,endEdge:c,direction:d}=e,p=xc(t);function u(v,b){return ra(v).filter(k=>k%b===0).map(k=>v.slice(k,k+b))}function m(v){return v.length?ra(v).reduce((b,k,w)=>{const x=Gn(b)||0,S=x===0,M=k===aa(v),I=r[f]-a[x][f],O=r[f]-a[k][c],T=!i&&S?d(o):0,P=!i&&M?d(s):0,R=He(O-P-(I+T));return w&&R>n+l&&b.push(k),M&&b.push(v.length),b},[]).map((b,k,w)=>{const x=Math.max(w[k-1]||0);return v.slice(x,b)}):[]}function h(v){return p?u(v,t):m(v)}return{groupSlides:h}}function AF(e,n,t,i,r,a,o){const{align:s,axis:l,direction:f,startIndex:c,loop:d,duration:p,dragFree:u,dragThreshold:m,inViewThreshold:h,slidesToScroll:g,skipSnaps:v,containScroll:b,watchResize:k,watchSlides:w,watchDrag:x,watchFocus:S}=a,M=2,I=fF(),O=I.measure(n),T=t.map(I.measure),P=oF(l,f),R=P.measureSize(O),z=cF(R),F=rF(s,R),D=!d&&!!b,L=d||!!b,{slideSizes:j,slideSizesWithGaps:N,startGap:V,endGap:_}=EF(P,O,T,t,L,r),$=TF(P,R,g,d,O,T,V,_,M),{snaps:B,snapsAligned:C}=bF(P,F,O,T,$),q=-Gn(B)+Gn(N),{snapsContained:Q,scrollContainLimit:K}=mF(R,q,C,b,M),U=D?Q:C,{limit:G}=hF(q,U,d),ne=l0(aa(U),c,d),Z=ne.clone(),re=ra(t),H=({dragHandler:be,scrollBody:Ke,scrollBounds:nn,options:{loop:rn}})=>{rn||nn.constrain(be.pointerDown()),Ke.seek()},Y=({scrollBody:be,translate:Ke,location:nn,offsetLocation:rn,previousLocation:Bn,scrollLooper:Qn,slideLooper:tn,dragHandler:$n,animation:yn,eventHandler:js,scrollBounds:z$,options:{loop:u_}},p_)=>{const m_=be.settled(),B$=!z$.shouldConstrain(),h_=u_?m_:m_&&B$,g_=h_&&!$n.pointerDown();g_&&yn.stop();const $$=nn.get()*p_+Bn.get()*(1-p_);rn.set($$),u_&&(Qn.loop(be.direction()),tn.loop()),Ke.to(rn.get()),g_&&js.emit("settle"),h_||js.emit("scroll")},de=aF(i,r,()=>H(ue),be=>Y(ue,be)),Te=.68,te=U[ne.get()],pe=la(te),ge=la(te),ve=la(te),Ae=la(te),Le=uF(pe,ve,ge,Ae,p,Te),Fe=kF(d,U,q,G,Ae),$e=wF(de,ne,Z,Le,Fe,Ae,o),ae=vF(G),fe=sa(),W=CF(n,t,o,h),{slideRegistry:J}=yF(D,b,U,K,$,re),oe=_F(e,t,J,$e,Le,fe,o,S),ue={ownerDocument:i,ownerWindow:r,eventHandler:o,containerRect:O,slideRects:T,animation:de,axis:P,dragHandler:sF(P,e,i,r,Ae,lF(P,r),pe,de,$e,Le,Fe,ne,o,z,u,m,v,Te,x),eventStore:fe,percentOfView:z,index:ne,indexPrevious:Z,limit:G,location:pe,offsetLocation:ve,previousLocation:ge,options:a,resizeHandler:dF(n,o,r,t,P,k,I),scrollBody:Le,scrollBounds:pF(G,ve,Ae,Le,z),scrollLooper:gF(q,G,ve,[pe,ve,ge,Ae]),scrollProgress:ae,scrollSnapList:U.map(ae.get),scrollSnaps:U,scrollTarget:Fe,scrollTo:$e,slideLooper:xF(P,R,q,j,N,B,U,ve,t),slideFocus:oe,slidesHandler:SF(n,o,w),slidesInView:W,slideIndexes:re,slideRegistry:J,slidesToScroll:$,target:Ae,translate:f0(P,n)};return ue}function MF(){let e={},n;function t(f){n=f}function i(f){return e[f]||[]}function r(f){return i(f).forEach(c=>c(n,f)),l}function a(f,c){return e[f]=i(f).concat([c]),l}function o(f,c){return e[f]=i(f).filter(d=>d!==c),l}function s(){e={}}const l={init:t,emit:r,off:o,on:a,clear:s};return l}const FF={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function IF(e){function n(a,o){return s0(a,o||{})}function t(a){const o=a.breakpoints||{},s=oa(o).filter(l=>e.matchMedia(l).matches).map(l=>o[l]).reduce((l,f)=>n(l,f),{});return n(a,s)}function i(a){return a.map(o=>oa(o.breakpoints||{})).reduce((o,s)=>o.concat(s),[]).map(e.matchMedia)}return{mergeOptions:n,optionsAtMedia:t,optionsMediaQueries:i}}function PF(e){let n=[];function t(a,o){return n=o.filter(({options:s})=>e.optionsAtMedia(s).active!==!1),n.forEach(s=>s.init(a,e)),o.reduce((s,l)=>Object.assign(s,{[l.name]:l}),{})}function i(){n=n.filter(a=>a.destroy())}return{init:t,destroy:i}}function zo(e,n,t){const i=e.ownerDocument,r=i.defaultView,a=IF(r),o=PF(a),s=sa(),l=MF(),{mergeOptions:f,optionsAtMedia:c,optionsMediaQueries:d}=a,{on:p,off:u,emit:m}=l,h=P;let g=!1,v,b=f(FF,zo.globalOptions),k=f(b),w=[],x,S,M;function I(){const{container:re,slides:H}=k;S=(Sc(re)?e.querySelector(re):re)||e.children[0];const de=Sc(H)?S.querySelectorAll(H):H;M=[].slice.call(de||S.children)}function O(re){const H=AF(e,S,M,i,r,re,l);if(re.loop&&!H.slideLooper.canLoop()){const Y=Object.assign({},re,{loop:!1});return O(Y)}return H}function T(re,H){g||(b=f(b,re),k=c(b),w=H||w,I(),v=O(k),d([b,...w.map(({options:Y})=>Y)]).forEach(Y=>s.add(Y,"change",P)),k.active&&(v.translate.to(v.location.get()),v.animation.init(),v.slidesInView.init(),v.slideFocus.init(Z),v.eventHandler.init(Z),v.resizeHandler.init(Z),v.slidesHandler.init(Z),v.options.loop&&v.slideLooper.loop(),S.offsetParent&&M.length&&v.dragHandler.init(Z),x=o.init(Z,w)))}function P(re,H){const Y=$();R(),T(f({startIndex:Y},re),H),l.emit("reInit")}function R(){v.dragHandler.destroy(),v.eventStore.clear(),v.translate.clear(),v.slideLooper.clear(),v.resizeHandler.destroy(),v.slidesHandler.destroy(),v.slidesInView.destroy(),v.animation.destroy(),o.destroy(),s.clear()}function z(){g||(g=!0,s.clear(),R(),l.emit("destroy"),l.clear())}function F(re,H,Y){!k.active||g||(v.scrollBody.useBaseFriction().useDuration(H===!0?0:k.duration),v.scrollTo.index(re,Y||0))}function D(re){const H=v.index.add(1).get();F(H,re,-1)}function L(re){const H=v.index.add(-1).get();F(H,re,1)}function j(){return v.index.add(1).get()!==$()}function N(){return v.index.add(-1).get()!==$()}function V(){return v.scrollSnapList}function _(){return v.scrollProgress.get(v.offsetLocation.get())}function $(){return v.index.get()}function B(){return v.indexPrevious.get()}function C(){return v.slidesInView.get()}function q(){return v.slidesInView.get(!1)}function Q(){return x}function K(){return v}function U(){return e}function G(){return S}function ne(){return M}const Z={canScrollNext:j,canScrollPrev:N,containerNode:G,internalEngine:K,destroy:z,off:u,on:p,emit:m,plugins:Q,previousScrollSnap:B,reInit:h,rootNode:U,scrollNext:D,scrollPrev:L,scrollProgress:_,scrollSnapList:V,scrollTo:F,selectedScrollSnap:$,slideNodes:ne,slidesInView:C,slidesNotInView:q};return T(n,t),setTimeout(()=>l.emit("init"),0),Z}zo.globalOptions=void 0;function Ac(e={},n=[]){const t=E.useRef(e),i=E.useRef(n),[r,a]=E.useState(),[o,s]=E.useState(),l=E.useCallback(()=>{r&&r.reInit(t.current,i.current)},[r]);return E.useEffect(()=>{_c(t.current,e)||(t.current=e,l())},[e,l]),E.useEffect(()=>{nF(i.current,n)||(i.current=n,l())},[n,l]),E.useEffect(()=>{if(eF()&&o){zo.globalOptions=Ac.globalOptions;const f=zo(o,t.current,i.current);return a(f),()=>f.destroy()}else a(void 0)},[o,a]),[s,r]}Ac.globalOptions=void 0;const c0=({cards:e,ctx:n})=>{const[t,i]=Ac({skipSnaps:!0,loop:!0}),[r,a]=E.useState(!0),[o,s]=E.useState(!0),l=E.useCallback(()=>i==null?void 0:i.scrollPrev(),[i]),f=E.useCallback(()=>i==null?void 0:i.scrollNext(),[i]),c=E.useCallback(d=>{a(!(d!=null&&d.canScrollPrev())),s(!(d!=null&&d.canScrollNext()))},[]);return E.useEffect(()=>{i&&(c(i),i.on("reInit",c),i.on("select",c))},[i,c]),y.jsxs("div",{className:"bpMessageBlocksCarouselContainer","data-container":"carousel",ref:t,children:[y.jsx("div",{className:"bpMessageBlocksCarouselSlidesContainer",children:e.map((d,p)=>y.jsx(wc,{...d,ctx:n},p))}),e.length>1&&y.jsxs(y.Fragment,{children:[y.jsx(kg,{className:"bpMessageBlocksCarouselBackButton","data-disabled":r?"":void 0,onClick:l}),y.jsx(wg,{className:"bpMessageBlocksCarouselNextButton","data-disabled":o?"":void 0,onClick:f})]})]})},d0=({text:e,options:n,groupId:t,ctx:i})=>y.jsxs("div",{className:"bpMessageBlocksColumn",children:[y.jsx(Yi,{text:e,ctx:i}),i.footer,y.jsx(kc,{actions:n.map(r=>({label:r.label,value:r.value,variant:"action"})),groupId:t,sendMessage:i.sendMessage,isReadOnly:i.isReadOnly})]}),u0={"composer.placeholder":"Écrivez votre message...","composer.sendButton.ariaLabel":"Bouton Envoyer le message","composer.voiceButton.ariaLabel":"Bouton Saisie vocale","composer.fileButton.ariaLabel":"Bouton Téléverser un fichier","composer.messageInput.ariaLabel":"Saisie du message","fileAttachment.uploadError":"Erreur de téléversement","fileAttachment.fallbackExtension":"Fichier","fileAttachment.removeButton.ariaLabel":"Bouton Supprimer le fichier","header.defaultBotName":"Bot","header.expandButton.ariaLabel":"Bouton Développer l'en-tête","header.sound.enable":"Activer les sons du chat","header.sound.disable":"Désactiver les sons du chat","conversationHistory.title":"Conversations","conversationHistory.empty":"Aucune conversation commencée","conversationHistory.newConversation":"Nouvelle conversation","conversationHistory.sentAttachment":"A envoyé une pièce jointe","conversationHistory.showButton.ariaLabel":"Bouton Afficher les conversations récentes","restartConversation.title":"Créer une nouvelle conversation","restartConversation.description":"Cela effacera la conversation en cours et en démarrera une nouvelle.","restartConversation.confirm":"Nouvelle conversation","restartConversation.cancel":"Annuler","restartConversation.button.ariaLabel":"Bouton Redémarrer la conversation","closeButton.ariaLabel":"Bouton Fermer le chatbot","feedback.title":"Aidez-nous à nous améliorer","feedback.description":"Veuillez nous faire part de vos commentaires pour nous aider à nous améliorer.","feedback.confirm":"Envoyer le commentaire","feedback.cancel":"Annuler","feedback.placeholder":"Dites-nous ce qui n'a pas fonctionné...","error.configuration":"Erreur de configuration","error.bot":"Erreur du bot","error.network":"Erreur réseau","error.disconnected":"Déconnecté","error.unexpected":"Erreur inattendue","dropdown.placeholder":"Sélectionner...","message.status.delivered":"Distribué","date.today":"Aujourd'hui","date.yesterday":"Hier","composer.emojiButton.ariaLabel":"Bouton sélecteur d'émojis","header.menu.ariaLabel":"Plus d'options","header.expand":"Agrandir la fenêtre","header.collapse":"Réduire la fenêtre","header.mute":"Couper le son","header.unmute":"Activer le son","hitl.passedToTeam":"Transmis à l’équipe support","hitl.findingAgent":"Recherche d’un agent…","hitl.supportAgent":"Agent de support","hitl.defaultAgentName":"Un agent","hitl.agentJoined":"{name} a rejoint la conversation","hitl.agentTransferred":"Transféré à {name}","hitl.agentLabel":"{name} · Support","hitl.ticketClosedBy":"{name} a clôturé le ticket","hitl.ticketClosed":"Ticket clôturé","hitl.waiting.title":"En attente d’un agent…","hitl.waiting.sub":"Généralement quelques minutes. Les réponses arrivent ici.","hitl.waiting.longTitle":"Toujours en attente — plus long que d’habitude","hitl.waiting.longSub":"Vous pouvez fermer cette fenêtre — la réponse arrivera ici.","csat.question":"Comment s’est passé l’échange avec {name} ?","csat.questionGeneric":"Comment ça s’est passé ?","csat.sub":"Un seul clic — optionnel. Vous pouvez continuer à écrire.","csat.rate":"Évaluer cette conversation","csat.commentPlaceholder":"Ajouter un commentaire — optionnel","csat.sendComment":"Envoyer le commentaire","csat.thanks":"Merci — transmis à l’équipe"},p0={"composer.placeholder":"Escribe tu mensaje...","composer.sendButton.ariaLabel":"Botón Enviar mensaje","composer.voiceButton.ariaLabel":"Botón Entrada de voz","composer.fileButton.ariaLabel":"Botón Subir archivo","composer.messageInput.ariaLabel":"Entrada de mensaje","fileAttachment.uploadError":"Error de carga","fileAttachment.fallbackExtension":"Archivo","fileAttachment.removeButton.ariaLabel":"Botón Eliminar archivo","header.defaultBotName":"Bot","header.expandButton.ariaLabel":"Botón Expandir encabezado","header.sound.enable":"Activar sonidos del chat","header.sound.disable":"Desactivar sonidos del chat","conversationHistory.title":"Conversaciones","conversationHistory.empty":"Aún no se ha iniciado ninguna conversación","conversationHistory.newConversation":"Nueva conversación","conversationHistory.sentAttachment":"Envió un archivo adjunto","conversationHistory.showButton.ariaLabel":"Botón Mostrar conversaciones recientes","restartConversation.title":"Crear nueva conversación","restartConversation.description":"Esto borrará la conversación actual y comenzará una nueva.","restartConversation.confirm":"Nueva conversación","restartConversation.cancel":"Cancelar","restartConversation.button.ariaLabel":"Botón Reiniciar conversación","closeButton.ariaLabel":"Botón Cerrar chatbot","feedback.title":"Ayúdanos a mejorar","feedback.description":"Por favor, envíanos tus comentarios para ayudarnos a mejorar.","feedback.confirm":"Enviar comentario","feedback.cancel":"Cancelar","feedback.placeholder":"Cuéntanos qué salió mal...","error.configuration":"Error de configuración","error.bot":"Error del bot","error.network":"Error de red","error.disconnected":"Desconectado","error.unexpected":"Error inesperado","dropdown.placeholder":"Seleccionar...","message.status.delivered":"Entregado","date.today":"Hoy","date.yesterday":"Ayer","composer.emojiButton.ariaLabel":"Botón selector de emojis","header.menu.ariaLabel":"Más opciones","header.expand":"Ampliar ventana","header.collapse":"Contraer ventana","header.mute":"Silenciar","header.unmute":"Activar sonido","hitl.passedToTeam":"Transferido al equipo de soporte","hitl.findingAgent":"Buscando un agente…","hitl.supportAgent":"Agente de soporte","hitl.defaultAgentName":"Un agente","hitl.agentJoined":"{name} se unió a la conversación","hitl.agentTransferred":"Transferido a {name}","hitl.agentLabel":"{name} · Soporte","hitl.ticketClosedBy":"{name} cerró el ticket","hitl.ticketClosed":"Ticket cerrado","hitl.waiting.title":"Esperando un agente…","hitl.waiting.sub":"Normalmente unos minutos. Las respuestas llegan aquí.","hitl.waiting.longTitle":"Aún esperando — está tardando más de lo habitual","hitl.waiting.longSub":"Puedes cerrar esta ventana — la respuesta llegará aquí.","csat.question":"¿Qué tal lo hizo {name}?","csat.questionGeneric":"¿Qué tal lo hicimos?","csat.sub":"Un toque — opcional. Puedes seguir escribiendo abajo.","csat.rate":"Valora este chat","csat.commentPlaceholder":"Añade un comentario — opcional","csat.sendComment":"Enviar comentario","csat.thanks":"Gracias — enviado al equipo"},m0={"composer.placeholder":"Digite sua mensagem...","composer.sendButton.ariaLabel":"Botão Enviar mensagem","composer.voiceButton.ariaLabel":"Botão Entrada de voz","composer.fileButton.ariaLabel":"Botão Enviar arquivo","composer.messageInput.ariaLabel":"Entrada de mensagem","fileAttachment.uploadError":"Erro no envio","fileAttachment.fallbackExtension":"Arquivo","fileAttachment.removeButton.ariaLabel":"Botão Remover arquivo","header.defaultBotName":"Bot","header.expandButton.ariaLabel":"Botão Expandir cabeçalho","header.sound.enable":"Ativar sons do chat","header.sound.disable":"Desativar sons do chat","conversationHistory.title":"Conversas","conversationHistory.empty":"Nenhuma conversa iniciada ainda","conversationHistory.newConversation":"Nova conversa","conversationHistory.sentAttachment":"Enviou um anexo","conversationHistory.showButton.ariaLabel":"Botão Mostrar conversas recentes","restartConversation.title":"Criar nova conversa","restartConversation.description":"Isso apagará a conversa atual e iniciará uma nova.","restartConversation.confirm":"Nova conversa","restartConversation.cancel":"Cancelar","restartConversation.button.ariaLabel":"Botão Reiniciar conversa","closeButton.ariaLabel":"Botão Fechar chatbot","feedback.title":"Ajude-nos a melhorar","feedback.description":"Por favor, envie seu feedback para nos ajudar a melhorar.","feedback.confirm":"Enviar feedback","feedback.cancel":"Cancelar","feedback.placeholder":"Conte-nos o que deu errado...","error.configuration":"Erro de configuração","error.bot":"Erro do bot","error.network":"Erro de rede","error.disconnected":"Desconectado","error.unexpected":"Erro inesperado","dropdown.placeholder":"Selecionar...","message.status.delivered":"Entregue","date.today":"Hoje","date.yesterday":"Ontem","composer.emojiButton.ariaLabel":"Botão seletor de emojis","header.menu.ariaLabel":"Mais opções","header.expand":"Expandir janela","header.collapse":"Recolher janela","header.mute":"Silenciar","header.unmute":"Ativar som","hitl.passedToTeam":"Encaminhado para a equipe de suporte","hitl.findingAgent":"Procurando um agente…","hitl.supportAgent":"Agente de suporte","hitl.defaultAgentName":"Um agente","hitl.agentJoined":"{name} entrou na conversa","hitl.agentTransferred":"Transferido para {name}","hitl.agentLabel":"{name} · Suporte","hitl.ticketClosedBy":"{name} encerrou o ticket","hitl.ticketClosed":"Ticket encerrado","hitl.waiting.title":"Aguardando um agente…","hitl.waiting.sub":"Geralmente alguns minutos. As respostas chegam aqui.","hitl.waiting.longTitle":"Ainda aguardando — está demorando mais que o normal","hitl.waiting.longSub":"Você pode fechar esta janela — a resposta chegará aqui.","csat.question":"Como foi o atendimento de {name}?","csat.questionGeneric":"Como foi o atendimento?","csat.sub":"Um toque — opcional. Você pode continuar digitando abaixo.","csat.rate":"Avalie esta conversa","csat.commentPlaceholder":"Adicionar um comentário — opcional","csat.sendComment":"Enviar comentário","csat.thanks":"Obrigado — enviado para a equipe"},h0={"composer.placeholder":"Nachricht eingeben...","composer.sendButton.ariaLabel":"Schaltfläche Nachricht senden","composer.voiceButton.ariaLabel":"Schaltfläche Spracheingabe","composer.fileButton.ariaLabel":"Schaltfläche Datei hochladen","composer.messageInput.ariaLabel":"Nachrichteneingabe","fileAttachment.uploadError":"Fehler beim Hochladen","fileAttachment.fallbackExtension":"Datei","fileAttachment.removeButton.ariaLabel":"Schaltfläche Datei entfernen","header.defaultBotName":"Bot","header.expandButton.ariaLabel":"Schaltfläche Kopfzeile erweitern","header.sound.enable":"Chat-Töne aktivieren","header.sound.disable":"Chat-Töne deaktivieren","conversationHistory.title":"Unterhaltungen","conversationHistory.empty":"Noch keine Unterhaltung begonnen","conversationHistory.newConversation":"Neue Unterhaltung","conversationHistory.sentAttachment":"Anhang gesendet","conversationHistory.showButton.ariaLabel":"Schaltfläche Letzte Unterhaltungen anzeigen","restartConversation.title":"Neue Unterhaltung erstellen","restartConversation.description":"Dies löscht die aktuelle Unterhaltung und startet eine neue.","restartConversation.confirm":"Neue Unterhaltung","restartConversation.cancel":"Abbrechen","restartConversation.button.ariaLabel":"Schaltfläche Unterhaltung neu starten","closeButton.ariaLabel":"Schaltfläche Chatbot schließen","feedback.title":"Helfen Sie uns, besser zu werden","feedback.description":"Bitte geben Sie uns Feedback, damit wir uns verbessern können.","feedback.confirm":"Feedback senden","feedback.cancel":"Abbrechen","feedback.placeholder":"Sagen Sie uns, was schiefgelaufen ist...","error.configuration":"Konfigurationsfehler","error.bot":"Bot-Fehler","error.network":"Netzwerkfehler","error.disconnected":"Getrennt","error.unexpected":"Unerwarteter Fehler","dropdown.placeholder":"Auswählen...","message.status.delivered":"Zugestellt","date.today":"Heute","date.yesterday":"Gestern","composer.emojiButton.ariaLabel":"Emoji-Auswahl-Schaltfläche","header.menu.ariaLabel":"Weitere Optionen","header.expand":"Fenster vergrößern","header.collapse":"Fenster verkleinern","header.mute":"Stummschalten","header.unmute":"Stummschaltung aufheben","hitl.passedToTeam":"An das Support-Team übergeben","hitl.findingAgent":"Wir suchen einen Agenten…","hitl.supportAgent":"Support-Agent","hitl.defaultAgentName":"Ein Agent","hitl.agentJoined":"{name} ist dem Gespräch beigetreten","hitl.agentTransferred":"An {name} übergeben","hitl.agentLabel":"{name} · Support","hitl.ticketClosedBy":"{name} hat das Ticket geschlossen","hitl.ticketClosed":"Ticket geschlossen","hitl.waiting.title":"Warten auf einen Agenten…","hitl.waiting.sub":"Meist nur wenige Minuten. Antworten erscheinen hier.","hitl.waiting.longTitle":"Immer noch am Warten — dauert länger als üblich","hitl.waiting.longSub":"Sie können dieses Fenster schließen — die Antwort erscheint hier.","csat.question":"Wie war {name}?","csat.questionGeneric":"Wie waren wir?","csat.sub":"Ein Klick — optional. Sie können unten weiterschreiben.","csat.rate":"Chat bewerten","csat.commentPlaceholder":"Kommentar hinzufügen — optional","csat.sendComment":"Kommentar senden","csat.thanks":"Danke — an das Team gesendet"},g0={"composer.placeholder":"Scrivi il tuo messaggio...","composer.sendButton.ariaLabel":"Pulsante Invia messaggio","composer.voiceButton.ariaLabel":"Pulsante Inserimento vocale","composer.fileButton.ariaLabel":"Pulsante Carica file","composer.messageInput.ariaLabel":"Campo di inserimento messaggio","fileAttachment.uploadError":"Errore di caricamento","fileAttachment.fallbackExtension":"File","fileAttachment.removeButton.ariaLabel":"Pulsante Rimuovi file","header.defaultBotName":"Bot","header.expandButton.ariaLabel":"Pulsante Espandi intestazione","header.sound.enable":"Attiva suoni della chat","header.sound.disable":"Disattiva suoni della chat","conversationHistory.title":"Conversazioni","conversationHistory.empty":"Nessuna conversazione avviata","conversationHistory.newConversation":"Nuova conversazione","conversationHistory.sentAttachment":"Ha inviato un allegato","conversationHistory.showButton.ariaLabel":"Pulsante Mostra conversazioni recenti","restartConversation.title":"Crea nuova conversazione","restartConversation.description":"Questo cancellerà la conversazione corrente e ne avvierà una nuova.","restartConversation.confirm":"Nuova conversazione","restartConversation.cancel":"Annulla","restartConversation.button.ariaLabel":"Pulsante Riavvia conversazione","closeButton.ariaLabel":"Pulsante Chiudi chatbot","feedback.title":"Aiutaci a migliorare","feedback.description":"Inviaci il tuo feedback per aiutarci a migliorare.","feedback.confirm":"Invia feedback","feedback.cancel":"Annulla","feedback.placeholder":"Dicci cosa non ha funzionato...","error.configuration":"Errore di configurazione","error.bot":"Errore del bot","error.network":"Errore di rete","error.disconnected":"Disconnesso","error.unexpected":"Errore imprevisto","dropdown.placeholder":"Seleziona...","message.status.delivered":"Consegnato","date.today":"Oggi","date.yesterday":"Ieri","composer.emojiButton.ariaLabel":"Pulsante selettore emoji","header.menu.ariaLabel":"Altre opzioni","header.expand":"Espandi finestra","header.collapse":"Comprimi finestra","header.mute":"Disattiva audio","header.unmute":"Riattiva audio","hitl.passedToTeam":"Inoltrato al team di supporto","hitl.findingAgent":"Stiamo cercando un agente…","hitl.supportAgent":"Agente di supporto","hitl.defaultAgentName":"Un agente","hitl.agentJoined":"{name} si è unito alla conversazione","hitl.agentTransferred":"Trasferito a {name}","hitl.agentLabel":"{name} · Supporto","hitl.ticketClosedBy":"{name} ha chiuso il ticket","hitl.ticketClosed":"Ticket chiuso","hitl.waiting.title":"In attesa di un agente…","hitl.waiting.sub":"Di solito pochi minuti. Le risposte arrivano qui.","hitl.waiting.longTitle":"Ancora in attesa — ci sta volendo più del solito","hitl.waiting.longSub":"Puoi chiudere questa finestra — la risposta arriverà qui.","csat.question":"Com’è andata con {name}?","csat.questionGeneric":"Com’è andata?","csat.sub":"Un tocco — facoltativo. Puoi continuare a scrivere qui sotto.","csat.rate":"Valuta questa chat","csat.commentPlaceholder":"Aggiungi un commento — facoltativo","csat.sendComment":"Invia commento","csat.thanks":"Grazie — inviato al team"},v0={"composer.placeholder":"メッセージを入力...","composer.sendButton.ariaLabel":"メッセージ送信ボタン","composer.voiceButton.ariaLabel":"音声入力ボタン","composer.fileButton.ariaLabel":"ファイルアップロードボタン","composer.messageInput.ariaLabel":"メッセージ入力","fileAttachment.uploadError":"アップロードエラー","fileAttachment.fallbackExtension":"ファイル","fileAttachment.removeButton.ariaLabel":"ファイル削除ボタン","header.defaultBotName":"ボット","header.expandButton.ariaLabel":"ヘッダー展開ボタン","header.sound.enable":"チャット音を有効にする","header.sound.disable":"チャット音を無効にする","conversationHistory.title":"会話履歴","conversationHistory.empty":"まだ会話がありません","conversationHistory.newConversation":"新しい会話","conversationHistory.sentAttachment":"添付ファイルを送信しました","conversationHistory.showButton.ariaLabel":"最近の会話を表示ボタン","restartConversation.title":"新しい会話を作成","restartConversation.description":"現在の会話を消去し、新しい会話を開始します。","restartConversation.confirm":"新しい会話","restartConversation.cancel":"キャンセル","restartConversation.button.ariaLabel":"会話を再開ボタン","closeButton.ariaLabel":"チャットボットを閉じるボタン","feedback.title":"改善にご協力ください","feedback.description":"サービス向上のため、フィードバックをお寄せください。","feedback.confirm":"フィードバックを送信","feedback.cancel":"キャンセル","feedback.placeholder":"問題点をお知らせください...","error.configuration":"設定エラー","error.bot":"ボットエラー","error.network":"ネットワークエラー","error.disconnected":"切断されました","error.unexpected":"予期しないエラー","dropdown.placeholder":"選択...","message.status.delivered":"配信済み","date.today":"今日","date.yesterday":"昨日","composer.emojiButton.ariaLabel":"絵文字選択ボタン","header.menu.ariaLabel":"その他のオプション","header.expand":"ウィンドウを拡大","header.collapse":"ウィンドウを縮小","header.mute":"ミュート","header.unmute":"ミュート解除","hitl.passedToTeam":"サポートチームに引き継ぎました","hitl.findingAgent":"担当者をお探ししています…","hitl.supportAgent":"サポート担当者","hitl.defaultAgentName":"担当者","hitl.agentJoined":"{name}さんが会話に参加しました","hitl.agentTransferred":"{name}さんに引き継がれました","hitl.agentLabel":"{name} · サポート","hitl.ticketClosedBy":"{name}さんがチケットをクローズしました","hitl.ticketClosed":"チケットがクローズされました","hitl.waiting.title":"担当者をお待ちください…","hitl.waiting.sub":"通常は数分です。返信はここに届きます。","hitl.waiting.longTitle":"お待たせしています — 通常より時間がかかっています","hitl.waiting.longSub":"このウィンドウを閉じても、返信はここに届きます。","csat.question":"{name}さんの対応はいかがでしたか?","csat.questionGeneric":"対応はいかがでしたか?","csat.sub":"ワンタップ — 任意です。続けて入力できます。","csat.rate":"このチャットを評価","csat.commentPlaceholder":"コメントを追加 — 任意","csat.sendComment":"コメントを送信","csat.thanks":"ありがとうございます — チームに送信しました"},b0={"composer.placeholder":"메시지를 입력하세요...","composer.sendButton.ariaLabel":"메시지 보내기 버튼","composer.voiceButton.ariaLabel":"음성 입력 버튼","composer.fileButton.ariaLabel":"파일 업로드 버튼","composer.messageInput.ariaLabel":"메시지 입력","fileAttachment.uploadError":"업로드 오류","fileAttachment.fallbackExtension":"파일","fileAttachment.removeButton.ariaLabel":"파일 삭제 버튼","header.defaultBotName":"봇","header.expandButton.ariaLabel":"헤더 펼치기 버튼","header.sound.enable":"채팅 소리 켜기","header.sound.disable":"채팅 소리 끄기","conversationHistory.title":"대화 목록","conversationHistory.empty":"아직 시작된 대화가 없습니다","conversationHistory.newConversation":"새 대화","conversationHistory.sentAttachment":"첨부 파일을 보냈습니다","conversationHistory.showButton.ariaLabel":"최근 대화 보기 버튼","restartConversation.title":"새 대화 만들기","restartConversation.description":"현재 대화를 지우고 새 대화를 시작합니다.","restartConversation.confirm":"새 대화","restartConversation.cancel":"취소","restartConversation.button.ariaLabel":"대화 다시 시작 버튼","closeButton.ariaLabel":"챗봇 닫기 버튼","feedback.title":"개선에 도움을 주세요","feedback.description":"서비스 개선을 위해 피드백을 보내주세요.","feedback.confirm":"피드백 보내기","feedback.cancel":"취소","feedback.placeholder":"어떤 점이 문제였는지 알려주세요...","error.configuration":"설정 오류","error.bot":"봇 오류","error.network":"네트워크 오류","error.disconnected":"연결 끊김","error.unexpected":"예기치 않은 오류","dropdown.placeholder":"선택...","message.status.delivered":"전달됨","date.today":"오늘","date.yesterday":"어제","composer.emojiButton.ariaLabel":"이모지 선택 버튼","header.menu.ariaLabel":"추가 옵션","header.expand":"창 확대","header.collapse":"창 축소","header.mute":"음소거","header.unmute":"음소거 해제","hitl.passedToTeam":"지원팀에 전달되었습니다","hitl.findingAgent":"상담원을 찾는 중…","hitl.supportAgent":"지원 상담원","hitl.defaultAgentName":"상담원","hitl.agentJoined":"{name}님이 대화에 참여했습니다","hitl.agentTransferred":"{name}님에게 이관되었습니다","hitl.agentLabel":"{name} · 지원팀","hitl.ticketClosedBy":"{name}님이 티켓을 종료했습니다","hitl.ticketClosed":"티켓이 종료되었습니다","hitl.waiting.title":"상담원을 기다리는 중…","hitl.waiting.sub":"보통 몇 분 정도 걸립니다. 답변은 여기에 도착합니다.","hitl.waiting.longTitle":"아직 기다리는 중 — 평소보다 오래 걸리고 있어요","hitl.waiting.longSub":"이 창을 닫아도 답변은 여기에 도착합니다.","csat.question":"{name}님의 응대는 어땠나요?","csat.questionGeneric":"응대는 어땠나요?","csat.sub":"한 번의 탭 — 선택 사항입니다. 계속 입력하셔도 됩니다.","csat.rate":"이 채팅 평가하기","csat.commentPlaceholder":"의견 추가 — 선택 사항","csat.sendComment":"의견 보내기","csat.thanks":"감사합니다 — 팀에 전달되었습니다"},y0={"composer.placeholder":"اكتب رسالتك...","composer.sendButton.ariaLabel":"زر إرسال الرسالة","composer.voiceButton.ariaLabel":"زر الإدخال الصوتي","composer.fileButton.ariaLabel":"زر رفع ملف","composer.messageInput.ariaLabel":"إدخال الرسالة","fileAttachment.uploadError":"خطأ في الرفع","fileAttachment.fallbackExtension":"ملف","fileAttachment.removeButton.ariaLabel":"زر إزالة الملف","header.defaultBotName":"بوت","header.expandButton.ariaLabel":"زر توسيع الرأس","header.sound.enable":"تفعيل أصوات المحادثة","header.sound.disable":"تعطيل أصوات المحادثة","conversationHistory.title":"المحادثات","conversationHistory.empty":"لم تبدأ أي محادثة بعد","conversationHistory.newConversation":"محادثة جديدة","conversationHistory.sentAttachment":"أرسل مرفقاً","conversationHistory.showButton.ariaLabel":"زر عرض المحادثات الأخيرة","restartConversation.title":"إنشاء محادثة جديدة","restartConversation.description":"سيؤدي هذا إلى مسح المحادثة الحالية وبدء محادثة جديدة.","restartConversation.confirm":"محادثة جديدة","restartConversation.cancel":"إلغاء","restartConversation.button.ariaLabel":"زر إعادة بدء المحادثة","closeButton.ariaLabel":"زر إغلاق الشات بوت","feedback.title":"ساعدنا على التحسين","feedback.description":"يرجى تقديم ملاحظاتك لمساعدتنا على التحسين.","feedback.confirm":"إرسال الملاحظات","feedback.cancel":"إلغاء","feedback.placeholder":"أخبرنا ما الخطأ الذي حدث...","error.configuration":"خطأ في الإعدادات","error.bot":"خطأ في البوت","error.network":"خطأ في الشبكة","error.disconnected":"غير متصل","error.unexpected":"خطأ غير متوقع","dropdown.placeholder":"اختر...","message.status.delivered":"تم التسليم","date.today":"اليوم","date.yesterday":"أمس","composer.emojiButton.ariaLabel":"زر منتقي الرموز التعبيرية","header.menu.ariaLabel":"خيارات إضافية","header.expand":"توسيع النافذة","header.collapse":"تصغير النافذة","header.mute":"كتم الصوت","header.unmute":"إلغاء كتم الصوت","hitl.passedToTeam":"تم التحويل إلى فريق الدعم","hitl.findingAgent":"نبحث لك عن موظف دعم…","hitl.supportAgent":"موظف دعم","hitl.defaultAgentName":"موظف دعم","hitl.agentJoined":"انضم {name} إلى المحادثة","hitl.agentTransferred":"تم التحويل إلى {name}","hitl.agentLabel":"{name} · الدعم","hitl.ticketClosedBy":"أغلق {name} التذكرة","hitl.ticketClosed":"تم إغلاق التذكرة","hitl.waiting.title":"في انتظار موظف دعم…","hitl.waiting.sub":"عادةً بضع دقائق. ستصل الردود هنا.","hitl.waiting.longTitle":"ما زلنا في الانتظار — يستغرق الأمر وقتًا أطول من المعتاد","hitl.waiting.longSub":"يمكنك إغلاق هذه النافذة — سيصلك الرد هنا.","csat.question":"كيف كان أداء {name}؟","csat.questionGeneric":"كيف كان أداؤنا؟","csat.sub":"نقرة واحدة — اختياري. يمكنك متابعة الكتابة أدناه.","csat.rate":"قيّم هذه المحادثة","csat.commentPlaceholder":"أضف تعليقًا — اختياري","csat.sendComment":"إرسال التعليق","csat.thanks":"شكرًا — أُرسل إلى الفريق"},Mc={"composer.placeholder":"Type your message...","composer.sendButton.ariaLabel":"Send Message Button","composer.voiceButton.ariaLabel":"Voice Input Button","composer.fileButton.ariaLabel":"Upload File Button","composer.messageInput.ariaLabel":"Message Input","composer.emojiButton.ariaLabel":"Emoji Picker Button","fileAttachment.uploadError":"Upload Error","fileAttachment.fallbackExtension":"File","fileAttachment.removeButton.ariaLabel":"Remove File Button","header.defaultBotName":"Bot","header.expandButton.ariaLabel":"Expand Header Button","header.sound.enable":"Enable chat sounds","header.sound.disable":"Disable chat sounds","header.menu.ariaLabel":"More options","header.expand":"Expand window","header.collapse":"Collapse window","header.mute":"Mute","header.unmute":"Unmute","conversationHistory.title":"Conversations","conversationHistory.empty":"No conversation started yet","conversationHistory.newConversation":"New conversation","conversationHistory.sentAttachment":"Sent an attachment","conversationHistory.showButton.ariaLabel":"Show Recent Conversations Button","restartConversation.title":"Create New Conversation","restartConversation.description":"This will clear the current conversation and start a new one.","restartConversation.confirm":"New conversation","restartConversation.cancel":"Cancel","restartConversation.button.ariaLabel":"Restart Conversation Button","closeButton.ariaLabel":"Close Chatbot Button","feedback.title":"Help us improve","feedback.description":"Please provide feedback to help us improve.","feedback.confirm":"Send feedback","feedback.cancel":"Cancel","feedback.placeholder":"Let us know what went wrong...","error.configuration":"Configuration error","error.bot":"Bot error","error.network":"Network error","error.disconnected":"Disconnected","error.unexpected":"Unexpected error","dropdown.placeholder":"Select...","message.status.delivered":"Delivered","date.today":"Today","date.yesterday":"Yesterday","hitl.passedToTeam":"Passed to the support team","hitl.findingAgent":"Finding you an agent…","hitl.supportAgent":"Support agent","hitl.defaultAgentName":"An agent","hitl.agentJoined":"{name} joined the conversation","hitl.agentTransferred":"Transferred to {name}","hitl.agentLabel":"{name} · Support","hitl.ticketClosedBy":"{name} closed the ticket","hitl.ticketClosed":"Ticket closed","hitl.waiting.title":"Waiting for an agent…","hitl.waiting.sub":"Usually a few minutes. Replies arrive here.","hitl.waiting.longTitle":"Still waiting — this is taking longer than usual","hitl.waiting.longSub":"You can close this window — the reply will land right here.","csat.question":"How did {name} do?","csat.questionGeneric":"How did we do?","csat.sub":"One tap — optional. You can keep typing below.","csat.rate":"Rate this chat","csat.commentPlaceholder":"Add a comment — optional","csat.sendComment":"Send comment","csat.thanks":"Thanks — sent to the team"},OF={fr:u0,es:p0,pt:m0,de:h0,it:g0,ja:v0,ko:b0,ar:y0};function k0(e){const t=(((e==null?void 0:e.trim())||(typeof navigator<"u"?navigator.language:"en")).split("-")[0]??"en").toLowerCase();return OF[t]??Mc}function w0(e,n){const t=k0(e);return n&&Object.keys(n).length?{...t,...n}:t}const _0=E.createContext(Mc),DF=_0.Provider;function un(){return E.useContext(_0)}const x0=({text:e,options:n,reusable:t,ctx:i})=>{const{sendMessage:r,isReadOnly:a}=i,o=un(),s=rt(j=>j.messageContainerRef),l=rt(j=>j.portalContainer),[f,c]=A.useState(!1),[d,p]=A.useState(null),[u,m]=A.useState(null),h=n.map(j=>j.label),g=Object.fromEntries(n.map(j=>[j.label,j.value])),v=j=>{c(u!==null&&!t?!1:j)},{refs:b,floatingStyles:k,context:w}=Xf({placement:"bottom-start",open:f,onOpenChange:v,whileElementsMounted:Of,middleware:[Nf(5),Lf({padding:10,boundary:(s==null?void 0:s.current)??void 0,crossAxis:!0}),zf({apply({rects:j,elements:N,availableHeight:V}){Object.assign(N.floating.style,{maxHeight:`${V}px`,minWidth:`${j.reference.width}px`})},padding:10})]}),x=A.useRef([]),S=A.useRef(h),M=A.useRef(!1),I=Iv(w,{event:"mousedown"}),O=Zf(w),T=ic(w,{role:"listbox"}),P=a8(w,{listRef:x,activeIndex:d,selectedIndex:u,onNavigate:p,loop:!0}),R=o8(w,{listRef:S,activeIndex:d,selectedIndex:u,onMatch:f?p:m,onTypingChange(j){M.current=j}}),{getReferenceProps:z,getFloatingProps:F,getItemProps:D}=nc([O,T,P,R,I]),L=j=>{m(j),h[j]!==void 0&&(r==null||r({type:"text",text:h[j]??"",value:g[h[j]]??""},{})),c(!1)};return y.jsxs(lo,{ctx:i,children:[y.jsxs("div",{className:"bpMessageBlocksColumn",children:[e&&y.jsx(Yi,{text:e,ctx:i,bare:!0}),i.footer,y.jsxs("div",{tabIndex:0,ref:b.setReference,"aria-labelledby":"select-label","aria-autocomplete":"none","data-disabled":u!==null&&!t?"":void 0,style:a?{pointerEvents:"none"}:void 0,className:"bpMessageBlocksDropdownButtonContainer",...z(),children:[y.jsx("span",{className:"bpMessageBlocksDropdownButtonText",children:u!==null?h[u]:o["dropdown.placeholder"]}),y.jsx(hT,{className:"bpMessageBlocksDropdownButtonIcon"})]})]}),f&&y.jsx(Jf,{root:l??void 0,children:y.jsx(QM,{context:w,modal:!1,children:y.jsx("div",{ref:b.setFloating,className:"bpMessageBlocksDropdownContentContainer",style:{...k,pointerEvents:"auto"},...F(),children:h.map((j,N)=>y.jsx("div",{ref:V=>{x.current[N]=V},role:"option",tabIndex:N===d?0:-1,"aria-selected":N===u&&N===d,"data-active":N===d?"":void 0,className:"bpMessageBlocksDropdownContentItem",...D({onClick(){L(N)},onKeyDown(V){V.key==="Enter"&&(V.preventDefault(),L(N)),V.key===" "&&!M.current&&(V.preventDefault(),L(N))}}),children:j},j))})})})]})},S0=({items:e,ctx:n})=>y.jsx("div",{className:"bpMessageBlocksColumn",children:e.map((t,i)=>y.jsx("div",{children:Fc(t,n)},i))});globalThis.React=E;const NF=({url:e,name:n,data:t,...i})=>{const r=N8(f=>f.getCustomComponent),[a,o]=E.useState(null),[s,l]=E.useState(null);return E.useEffect(()=>{r(e).then(o).catch(f=>{l(f.message)})},[e]),s?y.jsx("div",{style:{color:"red"},children:s}):a?y.jsx(a,{...t,...i}):null};function Fc(e,n){switch(e.type){case"text":return y.jsx(Yi,{text:e.text,ctx:n,citationPath:e.citationPath});case"image":return y.jsx(No,{url:e.url,orientation:e.orientation});case"video":return y.jsx(Xv,{url:e.url,isReadOnly:n.isReadOnly});case"audio":return y.jsx(e0,{url:e.url,isReadOnly:n.isReadOnly});case"file":return y.jsx(n0,{url:e.url,title:e.title,isReadOnly:n.isReadOnly});case"location":return y.jsx(t0,{latitude:e.latitude,longitude:e.longitude,title:e.title,isReadOnly:n.isReadOnly});case"card":return y.jsx(wc,{...e,ctx:n});case"carousel":return y.jsx(c0,{cards:e.cards,ctx:n});case"choice":return y.jsx(d0,{...e,ctx:n});case"dropdown":return y.jsx(x0,{...e,ctx:n});case"bloc":return y.jsx(S0,{items:e.items,ctx:n});case"custom":return y.jsx(NF,{url:e.url,name:e.name,data:e.data,...n})}}function C0(e){var n,t,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(n=0;n<r;n++)e[n]&&(t=C0(e[n]))&&(i&&(i+=" "),i+=t)}else for(t in e)e[t]&&(i&&(i+=" "),i+=t);return i}function pi(){for(var e,n,t=0,i="",r=arguments.length;t<r;t++)(e=arguments[t])&&(n=C0(e))&&(i&&(i+=" "),i+=n);return i}const E0=E.createContext({});function Ic(e){const n=E.useRef(null);return n.current===null&&(n.current=e()),n.current}const T0=typeof window<"u"?E.useLayoutEffect:E.useEffect,Bo=E.createContext(null);function LF(e,n){e.indexOf(n)===-1&&e.push(n)}function zF(e,n){const t=e.indexOf(n);t>-1&&e.splice(t,1)}const zt=(e,n,t)=>t>n?n:t<e?e:t;function Pc(e,n){return n?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${n}`:e}let fa=()=>{},mi=()=>{};typeof process<"u"&&((l_=process.env)==null?void 0:l_.NODE_ENV)!=="production"&&(fa=(e,n,t)=>{!e&&typeof console<"u"&&console.warn(Pc(n,t))},mi=(e,n,t)=>{if(!e)throw new Error(Pc(n,t))});const Bt={},A0=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),BF=e=>typeof e=="object"&&e!==null,M0=e=>/^0[^.\s]+$/u.test(e);function F0(e){let n;return()=>(n===void 0&&(n=e()),n)}const Qi=e=>e,$o=(...e)=>e.reduce((n,t)=>i=>t(n(i))),I0=(e,n,t)=>{const i=n-e;return i?(t-e)/i:1};class P0{constructor(){this.subscriptions=[]}add(n){return LF(this.subscriptions,n),()=>zF(this.subscriptions,n)}notify(n,t,i){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](n,t,i);else for(let a=0;a<r;a++){const o=this.subscriptions[a];o&&o(n,t,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Nn=e=>e*1e3,Kn=e=>e/1e3,O0=(e,n)=>n?e*(1e3/n):0,D0=new Set;function N0(e,n,t){e||D0.has(n)||(console.warn(Pc(n,t)),D0.add(n))}const L0=(e,n,t)=>(((1-3*t+3*n)*e+(3*t-6*n))*e+3*n)*e,$F=1e-7,RF=12;function jF(e,n,t,i,r){let a,o,s=0;do o=n+(t-n)/2,a=L0(o,i,r)-e,a>0?t=o:n=o;while(Math.abs(a)>$F&&++s<RF);return o}function ca(e,n,t,i){if(e===n&&t===i)return Qi;const r=a=>jF(a,0,1,e,t);return a=>a===0||a===1?a:L0(r(a),n,i)}const z0=e=>n=>n<=.5?e(2*n)/2:(2-e(2*(1-n)))/2,B0=e=>n=>1-e(1-n),$0=ca(.33,1.53,.69,.99),Oc=B0($0),R0=z0(Oc),j0=e=>e>=1?1:(e*=2)<1?.5*Oc(e):.5*(2-Math.pow(2,-10*(e-1))),Dc=e=>1-Math.sin(Math.acos(e)),HF=B0(Dc),H0=z0(Dc),VF=ca(.42,0,1,1),WF=ca(0,0,.58,1),V0=ca(.42,0,.58,1),qF=e=>Array.isArray(e)&&typeof e[0]!="number",W0=e=>Array.isArray(e)&&typeof e[0]=="number",q0={linear:Qi,easeIn:VF,easeInOut:V0,easeOut:WF,circIn:Dc,circInOut:H0,circOut:HF,backIn:Oc,backInOut:R0,backOut:$0,anticipate:j0},UF=e=>typeof e=="string",U0=e=>{if(W0(e)){mi(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[n,t,i,r]=e;return ca(n,t,i,r)}else if(UF(e))return mi(q0[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),q0[e];return e},Ro=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function GF(e,n){let t=new Set,i=new Set,r=!1,a=!1;const o=new WeakSet;let s={delta:0,timestamp:0,isProcessing:!1};function l(c){o.has(c)&&(f.schedule(c),e()),c(s)}const f={schedule:(c,d=!1,p=!1)=>{const m=p&&r?t:i;return d&&o.add(c),m.add(c),c},cancel:c=>{i.delete(c),o.delete(c)},process:c=>{if(s=c,r){a=!0;return}r=!0;const d=t;t=i,i=d,t.forEach(l),t.clear(),r=!1,a&&(a=!1,f.process(c))}};return f}const KF=40;function G0(e,n){let t=!1,i=!0;const r={delta:0,timestamp:0,isProcessing:!1},a=()=>t=!0,o=Ro.reduce((k,w)=>(k[w]=GF(a),k),{}),{setup:s,read:l,resolveKeyframes:f,preUpdate:c,update:d,preRender:p,render:u,postRender:m}=o,h=()=>{const k=Bt.useManualTiming,w=k?r.timestamp:performance.now();t=!1,k||(r.delta=i?1e3/60:Math.max(Math.min(w-r.timestamp,KF),1)),r.timestamp=w,r.isProcessing=!0,s.process(r),l.process(r),f.process(r),c.process(r),d.process(r),p.process(r),u.process(r),m.process(r),r.isProcessing=!1,t&&n&&(i=!1,e(h))},g=()=>{t=!0,i=!0,r.isProcessing||e(h)};return{schedule:Ro.reduce((k,w)=>{const x=o[w];return k[w]=(S,M=!1,I=!1)=>(t||g(),x.schedule(S,M,I)),k},{}),cancel:k=>{for(let w=0;w<Ro.length;w++)o[Ro[w]].cancel(k)},state:r,steps:o}}const{schedule:Ln,cancel:Nc,state:jo}=G0(typeof requestAnimationFrame<"u"?requestAnimationFrame:Qi,!0);let Ho;function YF(){Ho=void 0}const Mn={now:()=>(Ho===void 0&&Mn.set(jo.isProcessing||Bt.useManualTiming?jo.timestamp:performance.now()),Ho),set:e=>{Ho=e,queueMicrotask(YF)}},K0=e=>n=>typeof n=="string"&&n.startsWith(e),Y0=K0("--"),JF=K0("var(--"),Lc=e=>JF(e)?ZF.test(e.split("/*")[0].trim()):!1,ZF=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function J0(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Xi={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},da={...Xi,transform:e=>zt(0,1,e)},Vo={...Xi,default:1},ua=e=>Math.round(e*1e5)/1e5,zc=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function QF(e){return e==null}const XF=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Bc=(e,n)=>t=>!!(typeof t=="string"&&XF.test(t)&&t.startsWith(e)||n&&!QF(t)&&Object.prototype.hasOwnProperty.call(t,n)),Z0=(e,n,t)=>i=>{if(typeof i!="string")return i;const[r,a,o,s]=i.match(zc);return{[e]:parseFloat(r),[n]:parseFloat(a),[t]:parseFloat(o),alpha:s!==void 0?parseFloat(s):1}},e7=e=>zt(0,255,e),$c={...Xi,transform:e=>Math.round(e7(e))},hi={test:Bc("rgb","red"),parse:Z0("red","green","blue"),transform:({red:e,green:n,blue:t,alpha:i=1})=>"rgba("+$c.transform(e)+", "+$c.transform(n)+", "+$c.transform(t)+", "+ua(da.transform(i))+")"};function n7(e){let n="",t="",i="",r="";return e.length>5?(n=e.substring(1,3),t=e.substring(3,5),i=e.substring(5,7),r=e.substring(7,9)):(n=e.substring(1,2),t=e.substring(2,3),i=e.substring(3,4),r=e.substring(4,5),n+=n,t+=t,i+=i,r+=r),{red:parseInt(n,16),green:parseInt(t,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const Rc={test:Bc("#"),parse:n7,transform:hi.transform},pa=e=>({test:n=>typeof n=="string"&&n.endsWith(e)&&n.split(" ").length===1,parse:parseFloat,transform:n=>`${n}${e}`}),yt=pa("deg"),er=pa("%"),ce=pa("px"),t7=pa("vh"),i7=pa("vw"),Q0={...er,parse:e=>er.parse(e)/100,transform:e=>er.transform(e*100)},nr={test:Bc("hsl","hue"),parse:Z0("hue","saturation","lightness"),transform:({hue:e,saturation:n,lightness:t,alpha:i=1})=>"hsla("+Math.round(e)+", "+er.transform(ua(n))+", "+er.transform(ua(t))+", "+ua(da.transform(i))+")"},Qe={test:e=>hi.test(e)||Rc.test(e)||nr.test(e),parse:e=>hi.test(e)?hi.parse(e):nr.test(e)?nr.parse(e):Rc.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?hi.transform(e):nr.transform(e),getAnimatableNone:e=>{const n=Qe.parse(e);return n.alpha=0,Qe.transform(n)}},r7=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function a7(e){var n,t;return isNaN(e)&&typeof e=="string"&&(((n=e.match(zc))==null?void 0:n.length)||0)+(((t=e.match(r7))==null?void 0:t.length)||0)>0}const X0="number",eb="color",o7="var",s7="var(",nb="${}",l7=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function tr(e){const n=e.toString(),t=[],i={color:[],number:[],var:[]},r=[];let a=0;const s=n.replace(l7,l=>(Qe.test(l)?(i.color.push(a),r.push(eb),t.push(Qe.parse(l))):l.startsWith(s7)?(i.var.push(a),r.push(o7),t.push(l)):(i.number.push(a),r.push(X0),t.push(parseFloat(l))),++a,nb)).split(nb);return{values:t,split:s,indexes:i,types:r}}function f7(e){return tr(e).values}function tb({split:e,types:n}){const t=e.length;return i=>{let r="";for(let a=0;a<t;a++)if(r+=e[a],i[a]!==void 0){const o=n[a];o===X0?r+=ua(i[a]):o===eb?r+=Qe.transform(i[a]):r+=i[a]}return r}}function c7(e){return tb(tr(e))}const d7=e=>typeof e=="number"?0:Qe.test(e)?Qe.getAnimatableNone(e):e,u7=(e,n)=>typeof e=="number"?n!=null&&n.trim().endsWith("/")?e:0:d7(e);function p7(e){const n=tr(e);return tb(n)(n.values.map((i,r)=>u7(i,n.split[r])))}const Yn={test:a7,parse:f7,createTransformer:c7,getAnimatableNone:p7};function jc(e,n,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?e+(n-e)*6*t:t<1/2?n:t<2/3?e+(n-e)*(2/3-t)*6:e}function m7({hue:e,saturation:n,lightness:t,alpha:i}){e/=360,n/=100,t/=100;let r=0,a=0,o=0;if(!n)r=a=o=t;else{const s=t<.5?t*(1+n):t+n-t*n,l=2*t-s;r=jc(l,s,e+1/3),a=jc(l,s,e),o=jc(l,s,e-1/3)}return{red:Math.round(r*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:i}}function Wo(e,n){return t=>t>0?n:e}const ma=(e,n,t)=>e+(n-e)*t,Hc=(e,n,t)=>{const i=e*e,r=t*(n*n-i)+i;return r<0?0:Math.sqrt(r)},h7=[Rc,hi,nr],g7=e=>h7.find(n=>n.test(e));function ib(e){const n=g7(e);if(fa(!!n,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!n)return!1;let t=n.parse(e);return n===nr&&(t=m7(t)),t}const rb=(e,n)=>{const t=ib(e),i=ib(n);if(!t||!i)return Wo(e,n);const r={...t};return a=>(r.red=Hc(t.red,i.red,a),r.green=Hc(t.green,i.green,a),r.blue=Hc(t.blue,i.blue,a),r.alpha=ma(t.alpha,i.alpha,a),hi.transform(r))},Vc=new Set(["none","hidden"]);function v7(e,n){return Vc.has(e)?t=>t<=0?e:n:t=>t>=1?n:e}function b7(e,n){return t=>ma(e,n,t)}function Wc(e){return typeof e=="number"?b7:typeof e=="string"?Lc(e)?Wo:Qe.test(e)?rb:w7:Array.isArray(e)?ab:typeof e=="object"?Qe.test(e)?rb:y7:Wo}function ab(e,n){const t=[...e],i=t.length,r=e.map((a,o)=>Wc(a)(a,n[o]));return a=>{for(let o=0;o<i;o++)t[o]=r[o](a);return t}}function y7(e,n){const t={...e,...n},i={};for(const r in t)e[r]!==void 0&&n[r]!==void 0&&(i[r]=Wc(e[r])(e[r],n[r]));return r=>{for(const a in i)t[a]=i[a](r);return t}}function k7(e,n){const t=[],i={color:0,var:0,number:0};for(let r=0;r<n.values.length;r++){const a=n.types[r],o=e.indexes[a][i[a]],s=e.values[o]??0;t[r]=s,i[a]++}return t}const w7=(e,n)=>{const t=Yn.createTransformer(n),i=tr(e),r=tr(n);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?Vc.has(e)&&!r.values.length||Vc.has(n)&&!i.values.length?v7(e,n):$o(ab(k7(i,r),r.values),t):(fa(!0,`Complex values '${e}' and '${n}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),Wo(e,n))};function ob(e,n,t){return typeof e=="number"&&typeof n=="number"&&typeof t=="number"?ma(e,n,t):Wc(e)(e,n)}const _7=e=>{const n=({timestamp:t})=>e(t);return{start:(t=!0)=>Ln.update(n,t),stop:()=>Nc(n),now:()=>jo.isProcessing?jo.timestamp:Mn.now()}},sb=(e,n,t=10)=>{let i="";const r=Math.max(Math.round(n/t),2);for(let a=0;a<r;a++)i+=Math.round(e(a/(r-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},qo=2e4;function qc(e){let n=0;const t=50;let i=e.next(n);for(;!i.done&&n<qo;)n+=t,i=e.next(n);return n>=qo?1/0:n}function x7(e,n=100,t){const i=t({...e,keyframes:[0,n]}),r=Math.min(qc(i),qo);return{type:"keyframes",ease:a=>i.next(r*a).value/n,duration:Kn(r)}}const Ve={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Uc(e,n){return e*Math.sqrt(1-n*n)}const S7=12;function C7(e,n,t){let i=t;for(let r=1;r<S7;r++)i=i-e(i)/n(i);return i}const Gc=.001;function E7({duration:e=Ve.duration,bounce:n=Ve.bounce,velocity:t=Ve.velocity,mass:i=Ve.mass}){let r,a;fa(e<=Nn(Ve.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let o=1-n;o=zt(Ve.minDamping,Ve.maxDamping,o),e=zt(Ve.minDuration,Ve.maxDuration,Kn(e)),o<1?(r=f=>{const c=f*o,d=c*e,p=c-t,u=Uc(f,o),m=Math.exp(-d);return Gc-p/u*m},a=f=>{const d=f*o*e,p=d*t+t,u=Math.pow(o,2)*Math.pow(f,2)*e,m=Math.exp(-d),h=Uc(Math.pow(f,2),o);return(-r(f)+Gc>0?-1:1)*((p-u)*m)/h}):(r=f=>{const c=Math.exp(-f*e),d=(f-t)*e+1;return-Gc+c*d},a=f=>{const c=Math.exp(-f*e),d=(t-f)*(e*e);return c*d});const s=5/e,l=C7(r,a,s);if(e=Nn(e),isNaN(l))return{stiffness:Ve.stiffness,damping:Ve.damping,duration:e};{const f=Math.pow(l,2)*i;return{stiffness:f,damping:o*2*Math.sqrt(i*f),duration:e}}}const T7=["duration","bounce"],A7=["stiffness","damping","mass"];function lb(e,n){return n.some(t=>e[t]!==void 0)}function M7(e){let n={velocity:Ve.velocity,stiffness:Ve.stiffness,damping:Ve.damping,mass:Ve.mass,isResolvedFromDuration:!1,...e};if(!lb(e,A7)&&lb(e,T7))if(n.velocity=0,e.visualDuration){const t=e.visualDuration,i=2*Math.PI/(t*1.2),r=i*i,a=2*zt(.05,1,1-(e.bounce||0))*Math.sqrt(r);n={...n,mass:Ve.mass,stiffness:r,damping:a}}else{const t=E7({...e,velocity:0});n={...n,...t,mass:Ve.mass},n.isResolvedFromDuration=!0}return n}function Uo(e=Ve.visualDuration,n=Ve.bounce){const t=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:n}:e;let{restSpeed:i,restDelta:r}=t;const a=t.keyframes[0],o=t.keyframes[t.keyframes.length-1],s={done:!1,value:a},{stiffness:l,damping:f,mass:c,duration:d,velocity:p,isResolvedFromDuration:u}=M7({...t,velocity:-Kn(t.velocity||0)}),m=p||0,h=f/(2*Math.sqrt(l*c)),g=o-a,v=Kn(Math.sqrt(l/c)),b=Math.abs(g)<5;i||(i=b?Ve.restSpeed.granular:Ve.restSpeed.default),r||(r=b?Ve.restDelta.granular:Ve.restDelta.default);let k,w,x,S,M,I;if(h<1)x=Uc(v,h),S=(m+h*v*g)/x,k=T=>{const P=Math.exp(-h*v*T);return o-P*(S*Math.sin(x*T)+g*Math.cos(x*T))},M=h*v*S+g*x,I=h*v*g-S*x,w=T=>Math.exp(-h*v*T)*(M*Math.sin(x*T)+I*Math.cos(x*T));else if(h===1){k=P=>o-Math.exp(-v*P)*(g+(m+v*g)*P);const T=m+v*g;w=P=>Math.exp(-v*P)*(v*T*P-m)}else{const T=v*Math.sqrt(h*h-1);k=F=>{const D=Math.exp(-h*v*F),L=Math.min(T*F,300);return o-D*((m+h*v*g)*Math.sinh(L)+T*g*Math.cosh(L))/T};const P=(m+h*v*g)/T,R=h*v*P-g*T,z=h*v*g-P*T;w=F=>{const D=Math.exp(-h*v*F),L=Math.min(T*F,300);return D*(R*Math.sinh(L)+z*Math.cosh(L))}}const O={calculatedDuration:u&&d||null,velocity:T=>Nn(w(T)),next:T=>{if(!u&&h<1){const R=Math.exp(-h*v*T),z=Math.sin(x*T),F=Math.cos(x*T),D=o-R*(S*z+g*F),L=Nn(R*(M*z+I*F));return s.done=Math.abs(L)<=i&&Math.abs(o-D)<=r,s.value=s.done?o:D,s}const P=k(T);if(u)s.done=T>=d;else{const R=Nn(w(T));s.done=Math.abs(R)<=i&&Math.abs(o-P)<=r}return s.value=s.done?o:P,s},toString:()=>{const T=Math.min(qc(O),qo),P=sb(R=>O.next(T*R).value,T,30);return T+"ms "+P},toTransition:()=>{}};return O}Uo.applyToOptions=e=>{const n=x7(e,100,Uo);return e.ease=n.ease,e.duration=Nn(n.duration),e.type="keyframes",e};const F7=5;function fb(e,n,t){const i=Math.max(n-F7,0);return O0(t-e(i),n-i)}function Kc({keyframes:e,velocity:n=0,power:t=.8,timeConstant:i=325,bounceDamping:r=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:l,restDelta:f=.5,restSpeed:c}){const d=e[0],p={done:!1,value:d},u=I=>s!==void 0&&I<s||l!==void 0&&I>l,m=I=>s===void 0?l:l===void 0||Math.abs(s-I)<Math.abs(l-I)?s:l;let h=t*n;const g=d+h,v=o===void 0?g:o(g);v!==g&&(h=v-d);const b=I=>-h*Math.exp(-I/i),k=I=>v+b(I),w=I=>{const O=b(I),T=k(I);p.done=Math.abs(O)<=f,p.value=p.done?v:T};let x,S;const M=I=>{u(p.value)&&(x=I,S=Uo({keyframes:[p.value,m(p.value)],velocity:fb(k,I,p.value),damping:r,stiffness:a,restDelta:f,restSpeed:c}))};return M(0),{calculatedDuration:null,next:I=>{let O=!1;return!S&&x===void 0&&(O=!0,w(I),M(I)),x!==void 0&&I>=x?S.next(I-x):(!O&&w(I),p)}}}function I7(e,n,t){const i=[],r=t||Bt.mix||ob,a=e.length-1;for(let o=0;o<a;o++){let s=r(e[o],e[o+1]);if(n){const l=Array.isArray(n)?n[o]||Qi:n;s=$o(l,s)}i.push(s)}return i}function P7(e,n,{clamp:t=!0,ease:i,mixer:r}={}){const a=e.length;if(mi(a===n.length,"Both input and output ranges must be the same length","range-length"),a===1)return()=>n[0];if(a===2&&n[0]===n[1])return()=>n[1];const o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),n=[...n].reverse());const s=I7(n,i,r),l=s.length,f=c=>{if(o&&c<e[0])return n[0];let d=0;if(l>1)for(;d<e.length-2&&!(c<e[d+1]);d++);const p=I0(e[d],e[d+1],c);return s[d](p)};return t?c=>f(zt(e[0],e[a-1],c)):f}function O7(e,n){const t=e[e.length-1];for(let i=1;i<=n;i++){const r=I0(0,n,i);e.push(ma(t,1,r))}}function D7(e){const n=[0];return O7(n,e.length-1),n}function N7(e,n){return e.map(t=>t*n)}function L7(e,n){return e.map(()=>n||V0).splice(0,e.length-1)}function ir({duration:e=300,keyframes:n,times:t,ease:i="easeInOut"}){const r=qF(i)?i.map(U0):U0(i),a={done:!1,value:n[0]},o=N7(t&&t.length===n.length?t:D7(n),e),s=P7(o,n,{ease:Array.isArray(r)?r:L7(n,r)});return{calculatedDuration:e,next:l=>(a.value=s(l),a.done=l>=e,a)}}const z7=e=>e!==null;function Go(e,{repeat:n,repeatType:t="loop"},i,r=1){const a=e.filter(z7),s=r<0||n&&t!=="loop"&&n%2===1?0:a.length-1;return!s||i===void 0?a[s]:i}const B7={decay:Kc,inertia:Kc,tween:ir,keyframes:ir,spring:Uo};function cb(e){typeof e.type=="string"&&(e.type=B7[e.type])}class Yc{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(n=>{this.resolve=n})}notifyFinished(){this.resolve()}then(n,t){return this.finished.then(n,t)}}const $7=e=>e/100;class Ko extends Yc{constructor(n){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var i,r;const{motionValue:t}=this.options;t&&t.updatedAt!==Mn.now()&&this.tick(Mn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(r=(i=this.options).onStop)==null||r.call(i))},this.options=n,this.initAnimation(),this.play(),n.autoplay===!1&&this.pause()}initAnimation(){const{options:n}=this;cb(n);const{type:t=ir,repeat:i=0,repeatDelay:r=0,repeatType:a,velocity:o=0}=n;let{keyframes:s}=n;const l=t||ir;process.env.NODE_ENV!=="production"&&l!==ir&&mi(s.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${s}`,"spring-two-frames"),l!==ir&&typeof s[0]!="number"&&(this.mixKeyframes=$o($7,ob(s[0],s[1])),s=[0,100]);const f=l({...n,keyframes:s});a==="mirror"&&(this.mirroredGenerator=l({...n,keyframes:[...s].reverse(),velocity:-o})),f.calculatedDuration===null&&(f.calculatedDuration=qc(f));const{calculatedDuration:c}=f;this.calculatedDuration=c,this.resolvedDuration=c+r,this.totalDuration=this.resolvedDuration*(i+1)-r,this.generator=f}updateTime(n){const t=Math.round(n-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=t}tick(n,t=!1){const{generator:i,totalDuration:r,mixKeyframes:a,mirroredGenerator:o,resolvedDuration:s,calculatedDuration:l}=this;if(this.startTime===null)return i.next(0);const{delay:f=0,keyframes:c,repeat:d,repeatType:p,repeatDelay:u,type:m,onUpdate:h,finalKeyframe:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,n):this.speed<0&&(this.startTime=Math.min(n-r/this.speed,this.startTime)),t?this.currentTime=n:this.updateTime(n);const v=this.currentTime-f*(this.playbackSpeed>=0?1:-1),b=this.playbackSpeed>=0?v<0:v>r;this.currentTime=Math.max(v,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let k=this.currentTime,w=i;if(d){const I=Math.min(this.currentTime,r)/s;let O=Math.floor(I),T=I%1;!T&&I>=1&&(T=1),T===1&&O--,O=Math.min(O,d+1),!!(O%2)&&(p==="reverse"?(T=1-T,u&&(T-=u/s)):p==="mirror"&&(w=o)),k=zt(0,1,T)*s}let x;b?(this.delayState.value=c[0],x=this.delayState):x=w.next(k),a&&!b&&(x.value=a(x.value));let{done:S}=x;!b&&l!==null&&(S=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const M=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&S);return M&&m!==Kc&&(x.value=Go(c,this.options,g,this.speed)),h&&h(x.value),M&&this.finish(),x}then(n,t){return this.finished.then(n,t)}get duration(){return Kn(this.calculatedDuration)}get iterationDuration(){const{delay:n=0}=this.options||{};return this.duration+Kn(n)}get time(){return Kn(this.currentTime)}set time(n){n=Nn(n),this.currentTime=n,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=n:this.driver&&(this.startTime=this.driver.now()-n/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=n,this.tick(n))}getGeneratorVelocity(){const n=this.currentTime;if(n<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(n);const t=this.generator.next(n).value;return fb(i=>this.generator.next(i).value,n,t)}get speed(){return this.playbackSpeed}set speed(n){const t=this.playbackSpeed!==n;t&&this.driver&&this.updateTime(Mn.now()),this.playbackSpeed=n,t&&this.driver&&(this.time=Kn(this.currentTime))}play(){var r,a;if(this.isStopped)return;const{driver:n=_7,startTime:t}=this.options;this.driver||(this.driver=n(o=>this.tick(o))),(a=(r=this.options).onPlay)==null||a.call(r);const i=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=i):this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime||(this.startTime=t??i),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Mn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var n,t;this.notifyFinished(),this.teardown(),this.state="finished",(t=(n=this.options).onComplete)==null||t.call(n)}cancel(){var n,t;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(t=(n=this.options).onCancel)==null||t.call(n)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(n){return this.startTime=0,this.tick(n,!0)}attachTimeline(n){var t;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(t=this.driver)==null||t.stop(),n.observe(this)}}function R7(e){for(let n=1;n<e.length;n++)e[n]??(e[n]=e[n-1])}const gi=e=>e*180/Math.PI,Jc=e=>{const n=gi(Math.atan2(e[1],e[0]));return Zc(n)},j7={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Jc,rotateZ:Jc,skewX:e=>gi(Math.atan(e[1])),skewY:e=>gi(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Zc=e=>(e=e%360,e<0&&(e+=360),e),db=Jc,ub=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),pb=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),H7={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:ub,scaleY:pb,scale:e=>(ub(e)+pb(e))/2,rotateX:e=>Zc(gi(Math.atan2(e[6],e[5]))),rotateY:e=>Zc(gi(Math.atan2(-e[2],e[0]))),rotateZ:db,rotate:db,skewX:e=>gi(Math.atan(e[4])),skewY:e=>gi(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Qc(e){return e.includes("scale")?1:0}function Xc(e,n){if(!e||e==="none")return Qc(n);const t=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,r;if(t)i=H7,r=t;else{const s=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=j7,r=s}if(!r)return Qc(n);const a=i[n],o=r[1].split(",").map(W7);return typeof a=="function"?a(o):o[a]}const V7=(e,n)=>{const{transform:t="none"}=getComputedStyle(e);return Xc(t,n)};function W7(e){return parseFloat(e.trim())}const rr=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ar=new Set([...rr,"pathRotation"]),mb=e=>e===Xi||e===ce,q7=new Set(["x","y","z"]),U7=rr.filter(e=>!q7.has(e));function G7(e){const n=[];return U7.forEach(t=>{const i=e.getValue(t);i!==void 0&&(n.push([t,i.get()]),i.set(t.startsWith("scale")?1:0))}),n}const $t={width:({x:e},{paddingLeft:n="0",paddingRight:t="0",boxSizing:i})=>{const r=e.max-e.min;return i==="border-box"?r:r-parseFloat(n)-parseFloat(t)},height:({y:e},{paddingTop:n="0",paddingBottom:t="0",boxSizing:i})=>{const r=e.max-e.min;return i==="border-box"?r:r-parseFloat(n)-parseFloat(t)},top:(e,{top:n})=>parseFloat(n),left:(e,{left:n})=>parseFloat(n),bottom:({y:e},{top:n})=>parseFloat(n)+(e.max-e.min),right:({x:e},{left:n})=>parseFloat(n)+(e.max-e.min),x:(e,{transform:n})=>Xc(n,"x"),y:(e,{transform:n})=>Xc(n,"y")};$t.translateX=$t.x,$t.translateY=$t.y;const vi=new Set;let ed=!1,nd=!1,td=!1;function hb(){if(nd){const e=Array.from(vi).filter(i=>i.needsMeasurement),n=new Set(e.map(i=>i.element)),t=new Map;n.forEach(i=>{const r=G7(i);r.length&&(t.set(i,r),i.render())}),e.forEach(i=>i.measureInitialState()),n.forEach(i=>{i.render();const r=t.get(i);r&&r.forEach(([a,o])=>{var s;(s=i.getValue(a))==null||s.set(o)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}nd=!1,ed=!1,vi.forEach(e=>e.complete(td)),vi.clear()}function gb(){vi.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(nd=!0)})}function K7(){td=!0,gb(),hb(),td=!1}class id{constructor(n,t,i,r,a,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...n],this.onComplete=t,this.name=i,this.motionValue=r,this.element=a,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(vi.add(this),ed||(ed=!0,Ln.read(gb),Ln.resolveKeyframes(hb))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:n,name:t,element:i,motionValue:r}=this;if(n[0]===null){const a=r==null?void 0:r.get(),o=n[n.length-1];if(a!==void 0)n[0]=a;else if(i&&t){const s=i.readValue(t,o);s!=null&&(n[0]=s)}n[0]===void 0&&(n[0]=o),r&&a===void 0&&r.set(n[0])}R7(n)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(n=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,n),vi.delete(this)}cancel(){this.state==="scheduled"&&(vi.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Y7=e=>e.startsWith("--");function vb(e,n,t){Y7(n)?e.style.setProperty(n,t):e.style[n]=t}const J7={};function bb(e,n){const t=F0(e);return()=>J7[n]??t()}const Z7=bb(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),yb=bb(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),ha=([e,n,t,i])=>`cubic-bezier(${e}, ${n}, ${t}, ${i})`,kb={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ha([0,.65,.55,1]),circOut:ha([.55,0,1,.45]),backIn:ha([.31,.01,.66,-.59]),backOut:ha([.33,1.53,.69,.99])};function wb(e,n){if(e)return typeof e=="function"?yb()?sb(e,n):"ease-out":W0(e)?ha(e):Array.isArray(e)?e.map(t=>wb(t,n)||kb.easeOut):kb[e]}function Q7(e,n,t,{delay:i=0,duration:r=300,repeat:a=0,repeatType:o="loop",ease:s="easeOut",times:l}={},f=void 0){const c={[n]:t};l&&(c.offset=l);const d=wb(s,r);Array.isArray(d)&&(c.easing=d);const p={delay:i,duration:r,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:a+1,direction:o==="reverse"?"alternate":"normal"};return f&&(p.pseudoElement=f),e.animate(c,p)}function _b(e){return typeof e=="function"&&"applyToOptions"in e}function X7({type:e,...n}){return _b(e)&&yb()?e.applyToOptions(n):(n.duration??(n.duration=300),n.ease??(n.ease="easeOut"),n)}class xb extends Yc{constructor(n){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!n)return;const{element:t,name:i,keyframes:r,pseudoElement:a,allowFlatten:o=!1,finalKeyframe:s,onComplete:l}=n;this.isPseudoElement=!!a,this.allowFlatten=o,this.options=n,mi(typeof n.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const f=X7(n);this.animation=Q7(t,i,r,f,a),f.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const c=Go(r,this.options,s,this.speed);this.updateMotionValue&&this.updateMotionValue(c),vb(t,i,c),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var n,t;(t=(n=this.animation).finish)==null||t.call(n)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:n}=this;n==="idle"||n==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,i,r;const n=(t=this.options)==null?void 0:t.element;!this.isPseudoElement&&(n!=null&&n.isConnected)&&((r=(i=this.animation).commitStyles)==null||r.call(i))}get duration(){var t,i;const n=((i=(t=this.animation.effect)==null?void 0:t.getComputedTiming)==null?void 0:i.call(t).duration)||0;return Kn(Number(n))}get iterationDuration(){const{delay:n=0}=this.options||{};return this.duration+Kn(n)}get time(){return Kn(Number(this.animation.currentTime)||0)}set time(n){const t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Nn(n),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(n){n<0&&(this.finishedTime=null),this.animation.playbackRate=n}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(n){this.manualStartTime=this.animation.startTime=n}attachTimeline({timeline:n,rangeStart:t,rangeEnd:i,observe:r}){var a;return this.allowFlatten&&((a=this.animation.effect)==null||a.updateTiming({easing:"linear"})),this.animation.onfinish=null,n&&Z7()?(this.animation.timeline=n,t&&(this.animation.rangeStart=t),i&&(this.animation.rangeEnd=i),Qi):r(this)}}const Sb={anticipate:j0,backInOut:R0,circInOut:H0};function eI(e){return e in Sb}function nI(e){typeof e.ease=="string"&&eI(e.ease)&&(e.ease=Sb[e.ease])}const rd=10;class tI extends xb{constructor(n){nI(n),cb(n),super(n),n.startTime!==void 0&&n.autoplay!==!1&&(this.startTime=n.startTime),this.options=n}updateMotionValue(n){const{motionValue:t,onUpdate:i,onComplete:r,element:a,...o}=this.options;if(!t)return;if(n!==void 0){t.set(n);return}const s=new Ko({...o,autoplay:!1}),l=Math.max(rd,Mn.now()-this.startTime),f=zt(0,rd,l-rd),c=s.sample(l).value,{name:d}=this.options;a&&d&&vb(a,d,c),t.setWithVelocity(s.sample(Math.max(0,l-f)).value,c,f),s.stop()}}const Cb=(e,n)=>n==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Yn.test(e)||e==="0")&&!e.startsWith("url("));function iI(e){const n=e[0];if(e.length===1)return!0;for(let t=0;t<e.length;t++)if(e[t]!==n)return!0}function rI(e,n,t,i){const r=e[0];if(r===null)return!1;if(n==="display"||n==="visibility")return!0;const a=e[e.length-1],o=Cb(r,n),s=Cb(a,n);return fa(o===s,`You are trying to animate ${n} from "${r}" to "${a}". "${o?a:r}" is not an animatable value.`,"value-not-animatable"),!o||!s?!1:iI(e)||(t==="spring"||_b(t))&&i}function ad(e){e.duration=0,e.type="keyframes"}const Eb=new Set(["opacity","clipPath","filter","transform"]),aI=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function oI(e){for(let n=0;n<e.length;n++)if(typeof e[n]=="string"&&aI.test(e[n]))return!0;return!1}const sI=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),lI=F0(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function fI(e){var d;const{motionValue:n,name:t,repeatDelay:i,repeatType:r,damping:a,type:o,keyframes:s}=e;if(!(((d=n==null?void 0:n.owner)==null?void 0:d.current)instanceof HTMLElement))return!1;const{onUpdate:f,transformTemplate:c}=n.owner.getProps();return lI()&&t&&(Eb.has(t)||sI.has(t)&&oI(s))&&(t!=="transform"||!c)&&!f&&!i&&r!=="mirror"&&a!==0&&o!=="inertia"}const cI=40;class dI extends Yc{constructor({autoplay:n=!0,delay:t=0,type:i="keyframes",repeat:r=0,repeatDelay:a=0,repeatType:o="loop",keyframes:s,name:l,motionValue:f,element:c,...d}){var m;super(),this.stop=()=>{var h,g;this._animation&&(this._animation.stop(),(h=this.stopTimeline)==null||h.call(this)),(g=this.keyframeResolver)==null||g.cancel()},this.createdAt=Mn.now();const p={autoplay:n,delay:t,type:i,repeat:r,repeatDelay:a,repeatType:o,name:l,motionValue:f,element:c,...d},u=(c==null?void 0:c.KeyframeResolver)||id;this.keyframeResolver=new u(s,(h,g,v)=>this.onKeyframesResolved(h,g,p,!v),l,f,c),(m=this.keyframeResolver)==null||m.scheduleResolve()}onKeyframesResolved(n,t,i,r){var v,b;this.keyframeResolver=void 0;const{name:a,type:o,velocity:s,delay:l,isHandoff:f,onUpdate:c}=i;this.resolvedAt=Mn.now();let d=!0;rI(n,a,o,s)||(d=!1,(Bt.instantAnimations||!l)&&(c==null||c(Go(n,i,t))),n[0]=n[n.length-1],ad(i),i.repeat=0);const u={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>cI?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:t,...i,keyframes:n},m=d&&!f&&fI(u),h=(b=(v=u.motionValue)==null?void 0:v.owner)==null?void 0:b.current;let g;if(m)try{g=new tI({...u,element:h})}catch{g=new Ko(u)}else g=new Ko(u);g.finished.then(()=>{this.notifyFinished()}).catch(Qi),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(n,t){return this.finished.finally(n).then(()=>{})}get animation(){var n;return this._animation||((n=this.keyframeResolver)==null||n.resume(),K7()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(n){this.animation.time=n}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(n){this.animation.speed=n}get startTime(){return this.animation.startTime}attachTimeline(n){return this._animation?this.stopTimeline=this.animation.attachTimeline(n):this.pendingTimeline=n,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var n;this._animation&&this.animation.cancel(),(n=this.keyframeResolver)==null||n.cancel()}}function Tb(e,n,t,i=0,r=1){const a=Array.from(e).sort((f,c)=>f.sortNodePosition(c)).indexOf(n),o=e.size,s=(o-1)*i;return typeof t=="function"?t(a,o):r===1?a*i:s-a*i}const Ab=30,uI=e=>!isNaN(parseFloat(e));class pI{constructor(n,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{var a;const r=Mn.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&((a=this.events.change)==null||a.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(n),this.owner=t.owner}setCurrent(n){this.current=n,this.updatedAt=Mn.now(),this.canTrackVelocity===null&&n!==void 0&&(this.canTrackVelocity=uI(this.current))}setPrevFrameValue(n=this.current){this.prevFrameValue=n,this.prevUpdatedAt=this.updatedAt}onChange(n){return process.env.NODE_ENV!=="production"&&N0(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",n)}on(n,t){this.events[n]||(this.events[n]=new P0);const i=this.events[n].add(t);return n==="change"?()=>{i(),Ln.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const n in this.events)this.events[n].clear()}attach(n,t){this.passiveEffect=n,this.stopPassiveEffect=t}set(n){this.passiveEffect?this.passiveEffect(n,this.updateAndNotify):this.updateAndNotify(n)}setWithVelocity(n,t,i){this.set(t),this.prev=void 0,this.prevFrameValue=n,this.prevUpdatedAt=this.updatedAt-i}jump(n,t=!0){this.updateAndNotify(n),this.prev=n,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var n;(n=this.events.change)==null||n.notify(this.current)}addDependent(n){this.dependents||(this.dependents=new Set),this.dependents.add(n)}removeDependent(n){this.dependents&&this.dependents.delete(n)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const n=Mn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||n-this.updatedAt>Ab)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,Ab);return O0(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(n){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=n(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var n,t;(n=this.dependents)==null||n.clear(),(t=this.events.destroy)==null||t.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Yo(e,n){return new pI(e,n)}function Mb(e,n){if(e!=null&&e.inherit&&n){const{inherit:t,...i}=e;return{...n,...i}}return e}function Fb(e,n){const t=(e==null?void 0:e[n])??(e==null?void 0:e.default)??e;return t!==e?Mb(t,e):t}const mI={type:"spring",stiffness:500,damping:25,restSpeed:10},hI=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),gI={type:"keyframes",duration:.8},vI={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},bI=(e,{keyframes:n})=>n.length>2?gI:ar.has(e)?e.startsWith("scale")?hI(n[1]):mI:vI,yI=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function kI(e){for(const n in e)if(!yI.has(n))return!0;return!1}const wI=(e,n,t,i={},r,a)=>o=>{const s=Fb(i,e)||{},l=s.delay||i.delay||0;let{elapsed:f=0}=i;f=f-Nn(l);const c={keyframes:Array.isArray(t)?t:[null,t],ease:"easeOut",velocity:n.getVelocity(),...s,delay:-f,onUpdate:p=>{n.set(p),s.onUpdate&&s.onUpdate(p)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:n,element:a?void 0:r};kI(s)||Object.assign(c,bI(e,c)),c.duration&&(c.duration=Nn(c.duration)),c.repeatDelay&&(c.repeatDelay=Nn(c.repeatDelay)),c.from!==void 0&&(c.keyframes[0]=c.from);let d=!1;if((c.type===!1||c.duration===0&&!c.repeatDelay)&&(ad(c),c.delay===0&&(d=!0)),(Bt.instantAnimations||Bt.skipAnimations||r!=null&&r.shouldSkipAnimations||s.skipAnimations)&&(d=!0,ad(c),c.delay=0),c.allowFlatten=!s.type&&!s.ease,d&&!a&&n.get()!==void 0){const p=Go(c.keyframes,s);if(p!==void 0){Ln.update(()=>{c.onUpdate(p),c.onComplete()});return}}return s.isSync?new Ko(c):new dI(c)},_I=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function xI(e){const n=_I.exec(e);if(!n)return[,];const[,t,i,r]=n;return[`--${t??i}`,r]}const SI=4;function Ib(e,n,t=1){mi(t<=SI,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[i,r]=xI(e);if(!i)return;const a=window.getComputedStyle(n).getPropertyValue(i);if(a){const o=a.trim();return A0(o)?parseFloat(o):o}return Lc(r)?Ib(r,n,t+1):r}function Pb(e){const n=[{},{}];return e==null||e.values.forEach((t,i)=>{n[0][i]=t.get(),n[1][i]=t.getVelocity()}),n}function od(e,n,t,i){if(typeof n=="function"){const[r,a]=Pb(i);n=n(t!==void 0?t:e.custom,r,a)}if(typeof n=="string"&&(n=e.variants&&e.variants[n]),typeof n=="function"){const[r,a]=Pb(i);n=n(t!==void 0?t:e.custom,r,a)}return n}function bi(e,n,t){const i=e.getProps();return od(i,n,t!==void 0?t:i.custom,e)}const Ob=new Set(["width","height","top","left","right","bottom",...rr]),sd=e=>Array.isArray(e);function CI(e,n,t){e.hasValue(n)?e.getValue(n).set(t):e.addValue(n,Yo(t))}function EI(e){return sd(e)?e[e.length-1]||0:e}function TI(e,n){const t=bi(e,n);let{transitionEnd:i={},transition:r={},...a}=t||{};a={...a,...i};for(const o in a){const s=EI(a[o]);CI(e,o,s)}}const pn=e=>!!(e&&e.getVelocity);function AI(e){return!!(pn(e)&&e.add)}function MI(e,n){const t=e.getValue("willChange");if(AI(t))return t.add(n);if(!t&&Bt.WillChange){const i=new Bt.WillChange("auto");e.addValue("willChange",i),i.add(n)}}function ld(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}const Db="data-"+ld("framerAppearId");function FI(e){return e.props[Db]}function II({protectedKeys:e,needsAnimating:n},t){const i=e.hasOwnProperty(t)&&n[t]!==!0;return n[t]=!1,i}function Nb(e,n,{delay:t=0,transitionOverride:i,type:r}={}){let{transition:a,transitionEnd:o,...s}=n;const l=e.getDefaultTransition();a=a?Mb(a,l):l;const f=a==null?void 0:a.reduceMotion,c=a==null?void 0:a.skipAnimations;i&&(a=i);const d=[],p=r&&e.animationState&&e.animationState.getState()[r],u=a==null?void 0:a.path;u&&u.animateVisualElement(e,s,a,t,d);for(const m in s){const h=e.getValue(m,e.latestValues[m]??null),g=s[m];if(g===void 0||p&&II(p,m))continue;const v={delay:t,...Fb(a||{},m)};c&&(v.skipAnimations=!0);const b=h.get();if(b!==void 0&&!h.isAnimating()&&!Array.isArray(g)&&g===b&&!v.velocity){Ln.update(()=>h.set(g));continue}let k=!1;if(window.MotionHandoffAnimation){const S=FI(e);if(S){const M=window.MotionHandoffAnimation(S,m,Ln);M!==null&&(v.startTime=M,k=!0)}}MI(e,m);const w=f??e.shouldReduceMotion;h.start(wI(m,h,g,w&&Ob.has(m)?{type:!1}:v,e,k));const x=h.animation;x&&d.push(x)}if(o){const m=()=>Ln.update(()=>{o&&TI(e,o)});d.length?Promise.all(d).then(m):m()}return d}function fd(e,n,t={}){var l;const i=bi(e,n,t.type==="exit"?(l=e.presenceContext)==null?void 0:l.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=i||{};t.transitionOverride&&(r=t.transitionOverride);const a=i?()=>Promise.all(Nb(e,i,t)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(f=0)=>{const{delayChildren:c=0,staggerChildren:d,staggerDirection:p}=r;return PI(e,n,f,c,d,p,t)}:()=>Promise.resolve(),{when:s}=r;if(s){const[f,c]=s==="beforeChildren"?[a,o]:[o,a];return f().then(()=>c())}else return Promise.all([a(),o(t.delay)])}function PI(e,n,t=0,i=0,r=0,a=1,o){const s=[];for(const l of e.variantChildren)l.notify("AnimationStart",n),s.push(fd(l,n,{...o,delay:t+(typeof i=="function"?0:i)+Tb(e.variantChildren,l,i,r,a)}).then(()=>l.notify("AnimationComplete",n)));return Promise.all(s)}function OI(e,n,t={}){e.notify("AnimationStart",n);let i;if(Array.isArray(n)){const r=n.map(a=>fd(e,a,t));i=Promise.all(r)}else if(typeof n=="string")i=fd(e,n,t);else{const r=typeof n=="function"?bi(e,n,t.custom):n;i=Promise.all(Nb(e,r,t))}return i.then(()=>{e.notify("AnimationComplete",n)})}const DI={test:e=>e==="auto",parse:e=>e},Lb=e=>n=>n.test(e),zb=[Xi,ce,er,yt,i7,t7,DI],Bb=e=>zb.find(Lb(e));function NI(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||M0(e):!0}const LI=new Set(["brightness","contrast","saturate","opacity"]);function zI(e){const[n,t]=e.slice(0,-1).split("(");if(n==="drop-shadow")return e;const[i]=t.match(zc)||[];if(!i)return e;const r=t.replace(i,"");let a=LI.has(n)?1:0;return i!==t&&(a*=100),n+"("+a+r+")"}const BI=/\b([a-z-]*)\(.*?\)/gu,cd={...Yn,getAnimatableNone:e=>{const n=e.match(BI);return n?n.map(zI).join(" "):e}},dd={...Yn,getAnimatableNone:e=>{const n=Yn.parse(e);return Yn.createTransformer(e)(n.map(i=>typeof i=="number"?0:typeof i=="object"?{...i,alpha:1}:i))}},$b={...Xi,transform:Math.round},Jo={borderWidth:ce,borderTopWidth:ce,borderRightWidth:ce,borderBottomWidth:ce,borderLeftWidth:ce,borderRadius:ce,borderTopLeftRadius:ce,borderTopRightRadius:ce,borderBottomRightRadius:ce,borderBottomLeftRadius:ce,width:ce,maxWidth:ce,height:ce,maxHeight:ce,top:ce,right:ce,bottom:ce,left:ce,inset:ce,insetBlock:ce,insetBlockStart:ce,insetBlockEnd:ce,insetInline:ce,insetInlineStart:ce,insetInlineEnd:ce,padding:ce,paddingTop:ce,paddingRight:ce,paddingBottom:ce,paddingLeft:ce,paddingBlock:ce,paddingBlockStart:ce,paddingBlockEnd:ce,paddingInline:ce,paddingInlineStart:ce,paddingInlineEnd:ce,margin:ce,marginTop:ce,marginRight:ce,marginBottom:ce,marginLeft:ce,marginBlock:ce,marginBlockStart:ce,marginBlockEnd:ce,marginInline:ce,marginInlineStart:ce,marginInlineEnd:ce,fontSize:ce,backgroundPositionX:ce,backgroundPositionY:ce,...{rotate:yt,pathRotation:yt,rotateX:yt,rotateY:yt,rotateZ:yt,scale:Vo,scaleX:Vo,scaleY:Vo,scaleZ:Vo,skew:yt,skewX:yt,skewY:yt,distance:ce,translateX:ce,translateY:ce,translateZ:ce,x:ce,y:ce,z:ce,perspective:ce,transformPerspective:ce,opacity:da,originX:Q0,originY:Q0,originZ:ce},zIndex:$b,fillOpacity:da,strokeOpacity:da,numOctaves:$b},$I={...Jo,color:Qe,backgroundColor:Qe,outlineColor:Qe,fill:Qe,stroke:Qe,borderColor:Qe,borderTopColor:Qe,borderRightColor:Qe,borderBottomColor:Qe,borderLeftColor:Qe,filter:cd,WebkitFilter:cd,mask:dd,WebkitMask:dd},Rb=e=>$I[e],RI=new Set([cd,dd]);function jb(e,n){let t=Rb(e);return RI.has(t)||(t=Yn),t.getAnimatableNone?t.getAnimatableNone(n):void 0}const jI=new Set(["auto","none","0"]);function HI(e,n,t){let i=0,r;for(;i<e.length&&!r;){const a=e[i];typeof a=="string"&&!jI.has(a)&&tr(a).values.length&&(r=e[i]),i++}if(r&&t)for(const a of n)e[a]=jb(t,r)}class VI extends id{constructor(n,t,i,r,a){super(n,t,i,r,a,!0)}readKeyframes(){const{unresolvedKeyframes:n,element:t,name:i}=this;if(!t||!t.current)return;super.readKeyframes();for(let c=0;c<n.length;c++){let d=n[c];if(typeof d=="string"&&(d=d.trim(),Lc(d))){const p=Ib(d,t.current);p!==void 0&&(n[c]=p),c===n.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!Ob.has(i)||n.length!==2)return;const[r,a]=n,o=Bb(r),s=Bb(a),l=J0(r),f=J0(a);if(l!==f&&$t[i]){this.needsMeasurement=!0;return}if(o!==s)if(mb(o)&&mb(s))for(let c=0;c<n.length;c++){const d=n[c];typeof d=="string"&&(n[c]=parseFloat(d))}else $t[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:n,name:t}=this,i=[];for(let r=0;r<n.length;r++)(n[r]===null||NI(n[r]))&&i.push(r);i.length&&HI(n,i,t)}measureInitialState(){const{element:n,unresolvedKeyframes:t,name:i}=this;if(!n||!n.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=$t[i](n.measureViewportBox(),window.getComputedStyle(n.current)),t[0]=this.measuredOrigin;const r=t[t.length-1];r!==void 0&&n.getValue(i,r).jump(r,!1)}measureEndState(){var s;const{element:n,name:t,unresolvedKeyframes:i}=this;if(!n||!n.current)return;const r=n.getValue(t);r&&r.jump(this.measuredOrigin,!1);const a=i.length-1,o=i[a];i[a]=$t[t](n.measureViewportBox(),window.getComputedStyle(n.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(s=this.removedTransforms)!=null&&s.length&&this.removedTransforms.forEach(([l,f])=>{n.getValue(l).set(f)}),this.resolveNoneKeyframes()}}function WI(e,n,t){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let i=document;const r=(t==null?void 0:t[e])??i.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e).filter(i=>i!=null)}const ud=(e,n)=>n&&typeof e=="number"?n.transform(e):e;function Zo(e){return BF(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:qI}=G0(queueMicrotask,!1),UI={y:!1};function GI(){return UI.y}function Hb(e,n){const t=WI(e),i=new AbortController,r={passive:!0,...n,signal:i.signal};return[t,r,()=>i.abort()]}function KI(e){return!(e.pointerType==="touch"||GI())}function YI(e,n,t={}){const[i,r,a]=Hb(e,t);return i.forEach(o=>{let s=!1,l=!1,f;const c=()=>{o.removeEventListener("pointerleave",m)},d=g=>{f&&(f(g),f=void 0),c()},p=g=>{s=!1,window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p),l&&(l=!1,d(g))},u=()=>{s=!0,window.addEventListener("pointerup",p,r),window.addEventListener("pointercancel",p,r)},m=g=>{if(g.pointerType!=="touch"){if(s){l=!0;return}d(g)}},h=g=>{if(!KI(g))return;l=!1;const v=n(o,g);typeof v=="function"&&(f=v,o.addEventListener("pointerleave",m,r))};o.addEventListener("pointerenter",h,r),o.addEventListener("pointerdown",u,r)}),a}const Vb=(e,n)=>n?e===n?!0:Vb(e,n.parentElement):!1,JI=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,ZI=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function QI(e){return ZI.has(e.tagName)||e.isContentEditable===!0}const Qo=new WeakSet;function Wb(e){return n=>{n.key==="Enter"&&e(n)}}function pd(e,n){e.dispatchEvent(new PointerEvent("pointer"+n,{isPrimary:!0,bubbles:!0}))}const XI=(e,n)=>{const t=e.currentTarget;if(!t)return;const i=Wb(()=>{if(Qo.has(t))return;pd(t,"down");const r=Wb(()=>{pd(t,"up")}),a=()=>pd(t,"cancel");t.addEventListener("keyup",r,n),t.addEventListener("blur",a,n)});t.addEventListener("keydown",i,n),t.addEventListener("blur",()=>t.removeEventListener("keydown",i),n)};function qb(e){return JI(e)&&!0}const Ub=new WeakSet;function eP(e,n,t={}){const[i,r,a]=Hb(e,t),o=s=>{const l=s.currentTarget;if(!qb(s)||Ub.has(s))return;Qo.add(l),t.stopPropagation&&Ub.add(s);const f=n(l,s),c=(u,m)=>{window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",p),Qo.has(l)&&Qo.delete(l),qb(u)&&typeof f=="function"&&f(u,{success:m})},d=u=>{c(u,l===window||l===document||t.useGlobalTarget||Vb(l,u.target))},p=u=>{c(u,!1)};window.addEventListener("pointerup",d,r),window.addEventListener("pointercancel",p,r)};return i.forEach(s=>{(t.useGlobalTarget?window:s).addEventListener("pointerdown",o,r),Zo(s)&&(s.addEventListener("focus",f=>XI(f,r)),!QI(s)&&!s.hasAttribute("tabindex")&&(s.tabIndex=0))}),a}const nP=[...zb,Qe,Yn],tP=e=>nP.find(Lb(e)),Gb=()=>({min:0,max:0}),Kb=()=>({x:Gb(),y:Gb()}),iP=new WeakMap;function Xo(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function ga(e){return typeof e=="string"||Array.isArray(e)}const md=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],hd=["initial",...md];function es(e){return Xo(e.animate)||hd.some(n=>ga(e[n]))}function Yb(e){return!!(es(e)||e.variants)}function rP(e,n,t){for(const i in n){const r=n[i],a=t[i];if(pn(r))e.addValue(i,r);else if(pn(a))e.addValue(i,Yo(r,{owner:e}));else if(a!==r)if(e.hasValue(i)){const o=e.getValue(i);o.liveStyle===!0?o.jump(r):o.hasAnimated||o.set(r)}else{const o=e.getStaticValue(i);e.addValue(i,Yo(o!==void 0?o:r,{owner:e}))}}for(const i in t)n[i]===void 0&&e.removeValue(i);return n}const gd={current:null},Jb={current:!1},aP=typeof window<"u";function oP(){if(Jb.current=!0,!!aP)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),n=()=>gd.current=e.matches;e.addEventListener("change",n),n()}else gd.current=!1}const Zb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let ns={};function Qb(e){ns=e}function sP(){return ns}class lP{scrapeMotionValuesFromProps(n,t,i){return{}}constructor({parent:n,props:t,presenceContext:i,reducedMotionConfig:r,skipAnimations:a,blockInitialAnimation:o,visualState:s},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=id,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const u=Mn.now();this.renderScheduledAt<u&&(this.renderScheduledAt=u,Ln.render(this.render,!1,!0))};const{latestValues:f,renderState:c}=s;this.latestValues=f,this.baseTarget={...f},this.initialValues=t.initial?{...f}:{},this.renderState=c,this.parent=n,this.props=t,this.presenceContext=i,this.depth=n?n.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=a,this.options=l,this.blockInitialAnimation=!!o,this.isControllingVariants=es(t),this.isVariantNode=Yb(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(n&&n.current);const{willChange:d,...p}=this.scrapeMotionValuesFromProps(t,{},this);for(const u in p){const m=p[u];f[u]!==void 0&&pn(m)&&m.set(f[u])}}mount(n){var t,i;if(this.hasBeenMounted)for(const r in this.initialValues)(t=this.values.get(r))==null||t.jump(this.initialValues[r]),this.latestValues[r]=this.initialValues[r];this.current=n,iP.set(n,this),this.projection&&!this.projection.instance&&this.projection.mount(n),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,a)=>this.bindToMotionValue(a,r)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Jb.current||oP(),this.shouldReduceMotion=gd.current),process.env.NODE_ENV!=="production"&&N0(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected.","reduced-motion-disabled"),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(i=this.parent)==null||i.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var n;this.projection&&this.projection.unmount(),Nc(this.notifyUpdate),Nc(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(n=this.parent)==null||n.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const i=this.features[t];i&&(i.unmount(),i.isMounted=!1)}this.current=null}addChild(n){this.children.add(n),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(n)}removeChild(n){this.children.delete(n),this.enteringChildren&&this.enteringChildren.delete(n)}bindToMotionValue(n,t){if(this.valueSubscriptions.has(n)&&this.valueSubscriptions.get(n)(),t.accelerate&&Eb.has(n)&&this.current instanceof HTMLElement){const{factory:o,keyframes:s,times:l,ease:f,duration:c}=t.accelerate,d=new xb({element:this.current,name:n,keyframes:s,times:l,ease:f,duration:Nn(c)}),p=o(d);this.valueSubscriptions.set(n,()=>{p(),d.cancel()});return}const i=ar.has(n);i&&this.onBindTransform&&this.onBindTransform();const r=t.on("change",o=>{this.latestValues[n]=o,this.props.onUpdate&&Ln.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;typeof window<"u"&&window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,n,t)),this.valueSubscriptions.set(n,()=>{r(),a&&a()})}sortNodePosition(n){return!this.current||!this.sortInstanceNodePosition||this.type!==n.type?0:this.sortInstanceNodePosition(this.current,n.current)}updateFeatures(){let n="animation";for(n in ns){const t=ns[n];if(!t)continue;const{isEnabled:i,Feature:r}=t;if(!this.features[n]&&r&&i(this.props)&&(this.features[n]=new r(this)),this.features[n]){const a=this.features[n];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Kb()}getStaticValue(n){return this.latestValues[n]}setStaticValue(n,t){this.latestValues[n]=t}update(n,t){(n.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=n,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let i=0;i<Zb.length;i++){const r=Zb[i];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const a="on"+r,o=n[a];o&&(this.propEventSubscriptions[r]=this.on(r,o))}this.prevMotionValues=rP(this,this.scrapeMotionValuesFromProps(n,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(n){return this.props.variants?this.props.variants[n]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(n){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(n),()=>t.variantChildren.delete(n)}addValue(n,t){const i=this.values.get(n);t!==i&&(i&&this.removeValue(n),this.bindToMotionValue(n,t),this.values.set(n,t),this.latestValues[n]=t.get())}removeValue(n){this.values.delete(n);const t=this.valueSubscriptions.get(n);t&&(t(),this.valueSubscriptions.delete(n)),delete this.latestValues[n],this.removeValueFromRenderState(n,this.renderState)}hasValue(n){return this.values.has(n)}getValue(n,t){if(this.props.values&&this.props.values[n])return this.props.values[n];let i=this.values.get(n);return i===void 0&&t!==void 0&&(i=Yo(t===null?void 0:t,{owner:this}),this.addValue(n,i)),i}readValue(n,t){let i=this.latestValues[n]!==void 0||!this.current?this.latestValues[n]:this.getBaseTargetFromProps(this.props,n)??this.readValueFromInstance(this.current,n,this.options);return i!=null&&(typeof i=="string"&&(A0(i)||M0(i))?i=parseFloat(i):!tP(i)&&Yn.test(t)&&(i=jb(n,t)),this.setBaseTarget(n,pn(i)?i.get():i)),pn(i)?i.get():i}setBaseTarget(n,t){this.baseTarget[n]=t}getBaseTarget(n){var a;const{initial:t}=this.props;let i;if(typeof t=="string"||typeof t=="object"){const o=od(this.props,t,(a=this.presenceContext)==null?void 0:a.custom);o&&(i=o[n])}if(t&&i!==void 0)return i;const r=this.getBaseTargetFromProps(this.props,n);return r!==void 0&&!pn(r)?r:this.initialValues[n]!==void 0&&i===void 0?void 0:this.baseTarget[n]}on(n,t){return this.events[n]||(this.events[n]=new P0),this.events[n].add(t)}notify(n,...t){this.events[n]&&this.events[n].notify(...t)}scheduleRenderMicrotask(){qI.render(this.render)}}class Xb extends lP{constructor(){super(...arguments),this.KeyframeResolver=VI}sortInstanceNodePosition(n,t){return n.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(n,t){const i=n.style;return i?i[t]:void 0}removeValueFromRenderState(n,{vars:t,style:i}){delete t[n],delete i[n]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:n}=this.props;pn(n)&&(this.childSubscription=n.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}class or{constructor(n){this.isMounted=!1,this.node=n}update(){}}function fP({top:e,left:n,right:t,bottom:i}){return{x:{min:n,max:t},y:{min:e,max:i}}}function cP(e,n){if(!n)return e;const t=n({x:e.left,y:e.top}),i=n({x:e.right,y:e.bottom});return{top:t.y,left:t.x,bottom:i.y,right:i.x}}function dP(e,n){return fP(cP(e.getBoundingClientRect(),n))}const uP={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},pP=rr.length;function mP(e,n,t){let i="",r=!0;for(let o=0;o<pP;o++){const s=rr[o],l=e[s];if(l===void 0)continue;let f=!0;if(typeof l=="number")f=l===(s.startsWith("scale")?1:0);else{const c=parseFloat(l);f=s.startsWith("scale")?c===1:c===0}if(!f||t){const c=ud(l,Jo[s]);if(!f){r=!1;const d=uP[s]||s;i+=`${d}(${c}) `}t&&(n[s]=c)}}const a=e.pathRotation;return a&&(r=!1,i+=`rotate(${ud(a,Jo.pathRotation)}) `),i=i.trim(),t?i=t(n,r?"":i):r&&(i="none"),i}function vd(e,n,t){const{style:i,vars:r,transformOrigin:a}=e;let o=!1,s=!1;for(const l in n){const f=n[l];if(ar.has(l)){o=!0;continue}else if(Y0(l)){r[l]=f;continue}else{const c=ud(f,Jo[l]);l.startsWith("origin")?(s=!0,a[l]=c):i[l]=c}}if(n.transform||(o||t?i.transform=mP(n,e.transform,t):i.transform&&(i.transform="none")),s){const{originX:l="50%",originY:f="50%",originZ:c=0}=a;i.transformOrigin=`${l} ${f} ${c}`}}function ey(e,{style:n,vars:t},i,r){const a=e.style;let o;for(o in n)a[o]=n[o];r==null||r.applyProjectionStyles(a,i);for(o in t)a.setProperty(o,t[o])}function ny(e,n){return n.max===n.min?0:e/(n.max-n.min)*100}const va={correct:(e,n)=>{if(!n.target)return e;if(typeof e=="string")if(ce.test(e))e=parseFloat(e);else return e;const t=ny(e,n.target.x),i=ny(e,n.target.y);return`${t}% ${i}%`}},hP={correct:(e,{treeScale:n,projectionDelta:t})=>{const i=e,r=Yn.parse(e);if(r.length>5)return i;const a=Yn.createTransformer(e),o=typeof r[0]!="number"?1:0,s=t.x.scale*n.x,l=t.y.scale*n.y;r[0+o]/=s,r[1+o]/=l;const f=ma(s,l,.5);return typeof r[2+o]=="number"&&(r[2+o]/=f),typeof r[3+o]=="number"&&(r[3+o]/=f),a(r)}},gP={borderRadius:{...va,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:va,borderTopRightRadius:va,borderBottomLeftRadius:va,borderBottomRightRadius:va,boxShadow:hP};function ty(e,{layout:n,layoutId:t}){return ar.has(e)||e.startsWith("origin")||(n||t!==void 0)&&(!!gP[e]||e==="opacity")}function bd(e,n,t){var o;const i=e.style,r=n==null?void 0:n.style,a={};if(!i)return a;for(const s in i)(pn(i[s])||r&&pn(r[s])||ty(s,e)||((o=t==null?void 0:t.getValue(s))==null?void 0:o.liveStyle)!==void 0)&&(a[s]=i[s]);return a}function vP(e){return window.getComputedStyle(e)}class bP extends Xb{constructor(){super(...arguments),this.type="html",this.renderInstance=ey}readValueFromInstance(n,t){var i;if(ar.has(t))return(i=this.projection)!=null&&i.isProjecting?Qc(t):V7(n,t);{const r=vP(n),a=(Y0(t)?r.getPropertyValue(t):r[t])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(n,{transformPagePoint:t}){return dP(n,t)}build(n,t,i){vd(n,t,i.transformTemplate)}scrapeMotionValuesFromProps(n,t,i){return bd(n,t,i)}}const yP={offset:"stroke-dashoffset",array:"stroke-dasharray"},kP={offset:"strokeDashoffset",array:"strokeDasharray"};function wP(e,n,t=1,i=0,r=!0){e.pathLength=1;const a=r?yP:kP;e[a.offset]=`${-i}`,e[a.array]=`${n} ${t}`}const _P=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function iy(e,{attrX:n,attrY:t,attrScale:i,pathLength:r,pathSpacing:a=1,pathOffset:o=0,...s},l,f,c){if(vd(e,s,f),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:d,style:p}=e;d.transform&&(p.transform=d.transform,delete d.transform),(p.transform||d.transformOrigin)&&(p.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),p.transform&&(p.transformBox=(c==null?void 0:c.transformBox)??"fill-box",delete d.transformBox);for(const u of _P)d[u]!==void 0&&(p[u]=d[u],delete d[u]);n!==void 0&&(d.x=n),t!==void 0&&(d.y=t),i!==void 0&&(d.scale=i),r!==void 0&&wP(d,r,a,o,!1)}const ry=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),ay=e=>typeof e=="string"&&e.toLowerCase()==="svg";function xP(e,n,t,i){ey(e,n,void 0,i);for(const r in n.attrs)e.setAttribute(ry.has(r)?r:ld(r),n.attrs[r])}function oy(e,n,t){const i=bd(e,n,t);for(const r in e)if(pn(e[r])||pn(n[r])){const a=rr.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;i[a]=e[r]}return i}class SP extends Xb{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Kb}getBaseTargetFromProps(n,t){return n[t]}readValueFromInstance(n,t){if(ar.has(t)){const i=Rb(t);return i&&i.default||0}return t=ry.has(t)?t:ld(t),n.getAttribute(t)}scrapeMotionValuesFromProps(n,t,i){return oy(n,t,i)}build(n,t,i){iy(n,t,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(n,t,i,r){xP(n,t,i,r)}mount(n){this.isSVGTag=ay(n.tagName),super.mount(n)}}const CP=hd.length;function sy(e){if(!e)return;if(!e.isControllingVariants){const t=e.parent?sy(e.parent)||{}:{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}const n={};for(let t=0;t<CP;t++){const i=hd[t],r=e.props[i];(ga(r)||r===!1)&&(n[i]=r)}return n}function ly(e,n){if(!Array.isArray(n))return!1;const t=n.length;if(t!==e.length)return!1;for(let i=0;i<t;i++)if(n[i]!==e[i])return!1;return!0}const EP=[...md].reverse(),TP=md.length;function AP(e){return n=>Promise.all(n.map(({animation:t,options:i})=>OI(e,t,i)))}function MP(e){let n=AP(e),t=fy(),i=!0,r=!1;const a=f=>(c,d)=>{var u;const p=bi(e,d,f==="exit"?(u=e.presenceContext)==null?void 0:u.custom:void 0);if(p){const{transition:m,transitionEnd:h,...g}=p;c={...c,...g,...h}}return c};function o(f){n=f(e)}function s(f){const{props:c}=e,d=sy(e.parent)||{},p=[],u=new Set;let m={},h=1/0;for(let v=0;v<TP;v++){const b=EP[v],k=t[b],w=c[b]!==void 0?c[b]:d[b],x=ga(w),S=b===f?k.isActive:null;S===!1&&(h=v);let M=w===d[b]&&w!==c[b]&&x;if(M&&(i||r)&&e.manuallyAnimateOnMount&&(M=!1),k.protectedKeys={...m},!k.isActive&&S===null||!w&&!k.prevProp||Xo(w)||typeof w=="boolean")continue;if(b==="exit"&&k.isActive&&S!==!0){k.prevResolvedValues&&(m={...m,...k.prevResolvedValues});continue}const I=FP(k.prevProp,w);let O=I||b===f&&k.isActive&&!M&&x||v>h&&x,T=!1;const P=Array.isArray(w)?w:[w];let R=P.reduce(a(b),{});S===!1&&(R={});const{prevResolvedValues:z={}}=k,F={...z,...R},D=N=>{O=!0,u.has(N)&&(T=!0,u.delete(N)),k.needsAnimating[N]=!0;const V=e.getValue(N);V&&(V.liveStyle=!1)};for(const N in F){const V=R[N],_=z[N];if(m.hasOwnProperty(N))continue;let $=!1;sd(V)&&sd(_)?$=!ly(V,_)||I:$=V!==_,$?V!=null?D(N):u.add(N):V!==void 0&&u.has(N)?D(N):k.protectedKeys[N]=!0}k.prevProp=w,k.prevResolvedValues=R,k.isActive&&(m={...m,...R}),(i||r)&&e.blockInitialAnimation&&(O=!1);const L=M&&I;O&&(!L||T)&&p.push(...P.map(N=>{const V={type:b};if(typeof N=="string"&&(i||r)&&!L&&e.manuallyAnimateOnMount&&e.parent){const{parent:_}=e,$=bi(_,N);if(_.enteringChildren&&$){const{delayChildren:B}=$.transition||{};V.delay=Tb(_.enteringChildren,e,B)}}return{animation:N,options:V}}))}if(u.size){const v={};if(typeof c.initial!="boolean"){const b=bi(e,Array.isArray(c.initial)?c.initial[0]:c.initial);b&&b.transition&&(v.transition=b.transition)}u.forEach(b=>{const k=e.getBaseTarget(b),w=e.getValue(b);w&&(w.liveStyle=!0),v[b]=k??null}),p.push({animation:v})}let g=!!p.length;return i&&(c.initial===!1||c.initial===c.animate)&&!e.manuallyAnimateOnMount&&(g=!1),i=!1,r=!1,g?n(p):Promise.resolve()}function l(f,c){var p;if(t[f].isActive===c)return Promise.resolve();(p=e.variantChildren)==null||p.forEach(u=>{var m;return(m=u.animationState)==null?void 0:m.setActive(f,c)}),t[f].isActive=c;const d=s(f);for(const u in t)t[u].protectedKeys={};return d}return{animateChanges:s,setActive:l,setAnimateFunction:o,getState:()=>t,reset:()=>{t=fy(),r=!0}}}function FP(e,n){return typeof n=="string"?n!==e:Array.isArray(n)?!ly(n,e):!1}function yi(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function fy(){return{animate:yi(!0),whileInView:yi(),whileHover:yi(),whileTap:yi(),whileDrag:yi(),whileFocus:yi(),exit:yi()}}function cy(e,n,t,i={passive:!0}){return e.addEventListener(n,t,i),()=>e.removeEventListener(n,t)}function IP(e){return pn(e)?e.get():e}const yd=E.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function dy(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function PP(...e){return n=>{let t=!1;const i=e.map(r=>{const a=dy(r,n);return!t&&typeof a=="function"&&(t=!0),a});if(t)return()=>{for(let r=0;r<i.length;r++){const a=i[r];typeof a=="function"?a():dy(e[r],null)}}}}function OP(...e){return A.useCallback(PP(...e),e)}class DP extends A.Component{getSnapshotBeforeUpdate(n){const t=this.props.childRef.current;if(Zo(t)&&n.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const i=t.offsetParent,r=Zo(i)&&i.offsetWidth||0,a=Zo(i)&&i.offsetHeight||0,o=getComputedStyle(t),s=this.props.sizeRef.current;s.height=parseFloat(o.height),s.width=parseFloat(o.width),s.top=t.offsetTop,s.left=t.offsetLeft,s.right=r-s.width-s.left,s.bottom=a-s.height-s.top,s.direction=o.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function NP({children:e,isPresent:n,anchorX:t,anchorY:i,root:r,pop:a}){var p;const o=E.useId(),s=E.useRef(null),l=E.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:f}=E.useContext(yd),c=((p=e.props)==null?void 0:p.ref)??(e==null?void 0:e.ref),d=OP(s,c);return E.useInsertionEffect(()=>{const{width:u,height:m,top:h,left:g,right:v,bottom:b,direction:k}=l.current;if(n||a===!1||!s.current||!u||!m)return;const w=k==="rtl",x=t==="left"?w?`right: ${v}`:`left: ${g}`:w?`left: ${g}`:`right: ${v}`,S=i==="bottom"?`bottom: ${b}`:`top: ${h}`;s.current.dataset.motionPopId=o;const M=document.createElement("style");f&&(M.nonce=f);const I=r??document.head;return I.appendChild(M),M.sheet&&M.sheet.insertRule(`
|
|
455
|
+
`);const b=v.state[s];if(b==null)return;JSON.stringify(r.getState())!==JSON.stringify(b)&&u(b);return}Bv(r)&&r.dispatch(v)});case"DISPATCH":switch(h.payload.type){case"RESET":return u(m),s===void 0?c==null?void 0:c.init(r.getState()):c==null?void 0:c.init(Fo(l.name));case"COMMIT":if(s===void 0){c==null||c.init(r.getState());return}return c==null?void 0:c.init(Fo(l.name));case"ROLLBACK":return rc(h.state,v=>{if(s===void 0){u(v),c==null||c.init(r.getState());return}u(v[s]),c==null||c.init(Fo(l.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return rc(h.state,v=>{if(s===void 0){u(v);return}JSON.stringify(r.getState())!==JSON.stringify(v[s])&&u(v[s])});case"IMPORT_STATE":{const{nextLiftedState:v}=h.payload,b=(g=v.computedStates.slice(-1)[0])==null?void 0:g.state;if(!b)return;u(s===void 0?b:b[s]),c==null||c.send(null,v);return}case"PAUSE_RECORDING":return p=!p}return}}),m},rc=(e,n)=>{let t;try{t=JSON.parse(e)}catch(i){console.error("[zustand devtools middleware] Could not parse the received json",i)}t!==void 0&&n(t)};function Io(e,n){let t;try{t=e()}catch{return}return{getItem:r=>{var a;const o=l=>l===null?null:JSON.parse(l,void 0),s=(a=t.getItem(r))!=null?a:null;return s instanceof Promise?s.then(o):o(s)},setItem:(r,a)=>t.setItem(r,JSON.stringify(a,void 0)),removeItem:r=>t.removeItem(r)}}const ac=e=>n=>{try{const t=e(n);return t instanceof Promise?t:{then(i){return ac(i)(t)},catch(i){return this}}}catch(t){return{then(i){return this},catch(i){return ac(i)(t)}}}},Po=(e,n)=>(t,i,r)=>{let a={storage:Io(()=>window.localStorage),partialize:g=>g,version:0,merge:(g,v)=>({...v,...g}),...n},o=!1,s=0;const l=new Set,f=new Set;let c=a.storage;if(!c)return e((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),t(...g)},i,r);const d=()=>{const g=a.partialize({...i()});return c.setItem(a.name,{state:g,version:a.version})},p=r.setState;r.setState=(g,v)=>(p(g,v),d());const u=e((...g)=>(t(...g),d()),i,r);r.getInitialState=()=>u;let m;const h=()=>{var g,v;if(!c)return;const b=++s;o=!1,l.forEach(w=>{var x;return w((x=i())!=null?x:u)});const k=((v=a.onRehydrateStorage)==null?void 0:v.call(a,(g=i())!=null?g:u))||void 0;return ac(c.getItem.bind(c))(a.name).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==a.version){if(a.migrate){const x=a.migrate(w.state,w.version);return x instanceof Promise?x.then(S=>[!0,S]):[!0,x]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,w.state];return[!1,void 0]}).then(w=>{var x;if(b!==s)return;const[S,M]=w;if(m=a.merge(M,(x=i())!=null?x:u),t(m,!0),S)return d()}).then(()=>{b===s&&(k==null||k(i(),void 0),m=i(),o=!0,f.forEach(w=>w(m)))}).catch(w=>{b===s&&(k==null||k(void 0,w))})};return r.persist={setOptions:g=>{a={...a,...g},g.storage&&(c=g.storage)},clearStorage:()=>{c==null||c.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>h(),hasHydrated:()=>o,onHydrate:g=>(l.add(g),()=>{l.delete(g)}),onFinishHydration:g=>(f.add(g),()=>{f.delete(g)})},a.skipHydration||h(),m||u},b8=(e,n)=>Nt()(Ki(Po(t=>({messageHistory:[],addMessageToHistory:i=>t(r=>({...r,messageHistory:[i,...(r.messageHistory??[]).slice(0,100).filter(String)]})),clearHistory:()=>t(()=>({messageHistory:[]}))}),{name:e,storage:Io(()=>n==="sessionStorage"?sessionStorage:localStorage)}))),oc={},$v=(e,n,t)=>{const r=`${n||"bp-webchat"}-message-history-${e}`;return oc[r]||(oc[r]=b8(r,t)),oc[r]};let y8="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Oo=(e=21)=>{let n="",t=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)n+=y8[t[e]&63];return n};function vt(e){var o;const{metadata:n,conversationId:t,userId:i}=e,{payload:r,disableInput:a}=k8(e.payload);return{id:e.id,conversationId:t,authorId:i,timestamp:new Date(e.createdAt),block:r,disableInput:a,feedback:(o=e.feedback)==null?void 0:o.value,metadata:n}}const k8=e=>{switch(e.type){case"text":return{payload:{type:"text",text:e.text,value:e.value,citationPath:"root.text"}};case"markdown":return{payload:{type:"text",text:e.markdown,citationPath:"root.markdown"}};case"image":return{payload:{type:"image",url:e.imageUrl}};case"video":return{payload:{type:"video",url:e.videoUrl}};case"audio":return{payload:{type:"audio",url:e.audioUrl}};case"file":return{payload:{type:"file",url:e.fileUrl,title:e.title}};case"location":return{payload:{type:"location",latitude:e.latitude,longitude:e.longitude,title:e.title??e.address??"View on map"}};case"card":return{payload:Rv(e,"root")};case"carousel":return{payload:{type:"carousel",cards:e.items.map((n,t)=>Rv({...n},`root.items.${t}`))}};case"choice":return w8(e);case"dropdown":return _8(e);case"bloc":return{payload:x8(e)};case"custom":return{payload:{type:"custom",name:e.name,url:e.url,data:e}};default:{const n=e;throw new Error(`Unsupported message type ${n}`)}}},Rv=(e,n)=>({type:"card",imageUrl:e.imageUrl,title:e.title,subtitle:e.subtitle,actions:e.actions.map(t=>({label:t.label,value:t.value,variant:t.action==="url"?"link":"action"})),citationBasePath:n}),w8=e=>{const n=Oo();return{disableInput:e.disableFreeText,payload:{type:"choice",text:e.text,options:e.options.map(t=>({label:t.label,value:t.value})),groupId:n,disableFreeText:e.disableFreeText}}},_8=e=>({disableInput:!0,payload:{type:"dropdown",text:e.text,options:e.options.map(n=>({label:n.label,value:n.value}))}}),x8=e=>{var t;const n=e.items.map((i,r)=>{switch(i.type){case"text":return{type:"text",text:i.payload.text,value:i.payload.value,citationPath:`root.items.${r}.payload.text`};case"markdown":return{type:"text",text:i.payload.markdown,citationPath:`root.items.${r}.payload.markdown`};case"image":return{type:"image",url:i.payload.imageUrl};case"video":return{type:"video",url:i.payload.videoUrl};case"audio":return{type:"audio",url:i.payload.audioUrl};case"file":return{type:"file",url:i.payload.fileUrl,title:i.payload.title};case"location":return{type:"location",latitude:i.payload.latitude,longitude:i.payload.longitude,title:i.payload.title??i.payload.address??"View on map"};default:throw new Error("Unsupported bloc item type")}});return n.length===1&&((t=n[0])==null?void 0:t.type)==="text"?n[0]:{type:"bloc",items:n}},S8=e=>typeof requestAnimationFrame=="function"?{type:"animation",id:requestAnimationFrame(e)}:{type:"timeout",id:setTimeout(()=>e(Date.now()),16)},C8=e=>{if(e.type==="animation"){cancelAnimationFrame(e.id);return}clearTimeout(e.id)},Lt=(e,n)=>{var i;const t=(i=e.metadata)==null?void 0:i[n];return typeof t=="string"?t:void 0},jv=(e,n)=>{const t=Lt(n,"clientMessageId");let i=-1;return t&&(i=e.findIndex(r=>Lt(r,"clientMessageId")===t)),i===-1&&(i=e.findIndex(r=>r.id===n.id)),i===-1?[...e,n]:[...e.slice(0,i),{...e[i],...n},...e.slice(i+1)]},Hv=e=>{const n={id:`stream:${e.streamId}`,conversationId:e.conversationId,userId:e.userId,createdAt:e.createdAt,payload:{type:"bloc",items:[{type:"text",payload:{text:e.content}}]},metadata:{streamId:e.streamId,clientMessageId:e.clientMessageId,messageStreamStatus:"streaming"}};return vt(n)},E8=e=>{const n=new Map;let t,i=0;const r=()=>{t!==void 0&&(C8(t),t=void 0)},a=l=>{n.delete(l),n.size===0&&r()},o=l=>{const f=Lt(l,"streamId"),c=Lt(l,"clientMessageId");f&&n.delete(f),c&&n.forEach((d,p)=>{const u=d.values().next().value;(u==null?void 0:u.clientMessageId)===c&&n.delete(p)}),n.size===0&&r()},s=(l,f,c)=>{const d=c??Lt(f,"streamId"),p=Lt(f,"clientMessageId");let u=!1;const m={...l};for(const[h,g]of Object.entries(l))(h===d||p&&g.clientMessageId===p)&&(delete m[h],u=!0);return u?m:l};return Nt()(Ki((l,f)=>{const c=()=>n.size>0||Object.keys(f().messageStreams).length>0,d=()=>{if(t=void 0,n.size===0)return;const u=Array.from(n.entries());l(m=>{const{messageStreams:h}=m,g={...h};let v=!1;for(const[b,k]of u){const w=g[b];let x=(w==null?void 0:w.sequence)??0,S;const M=[];for(;;){const O=k.get(x+1);if(!O)break;k.delete(O.sequence),S??(S=O),x=O.sequence,M.push(O.delta)}if(k.size===0&&n.delete(b),!S||M.length===0)continue;const I={streamId:b,conversationId:e,userId:(w==null?void 0:w.userId)??S.userId,createdAt:(w==null?void 0:w.createdAt)??S.createdAt,clientMessageId:(w==null?void 0:w.clientMessageId)??S.clientMessageId,sequence:x,content:((w==null?void 0:w.content)??"")+M.join("")};g[b]={...I,message:Hv(I),order:(w==null?void 0:w.order)??i++},v=!0}return v?{messageStreams:g}:m})},p=()=>{t===void 0&&(t=S8(d))};return{messages:[],messageStreams:{},setMessages:u=>{for(const m of u)o(m);l(({messageStreams:m})=>({messages:u,messageStreams:u.reduce((h,g)=>s(h,g),m)}))},saveMessage:u=>{o(u),l(({messages:m,messageStreams:h})=>({messages:jv(m,u),messageStreams:s(h,u)}))},updateMessage:(u,m)=>l(({messages:h})=>({messages:h.map(g=>g.id===u?{...g,...m}:g)})),removeMessage:u=>l(({messages:m})=>({messages:m.filter(h=>h.id!==u)})),clearMessages:()=>{r(),n.clear(),l({messages:[],messageStreams:{}})},upsertMessageStream:u=>{if(u.conversationId!==e||u.sequence<1)return{status:"ignored"};const m=f().messageStreams[u.streamId],h=(m==null?void 0:m.sequence)??0,g=n.get(u.streamId)??new Map;if(u.sequence<=h||g.has(u.sequence))return{status:"ignored"};let v=h;for(;g.has(v+1);)v++;const b=u.sequence!==v+1,k=!m&&!b&&v===0;return g.set(u.sequence,u),n.set(u.streamId,g),b||p(),{status:b?"gap":k?"started":"queued"}},completeMessageStream:({streamId:u,message:m})=>(a(u),o(m),l(({messages:h,messageStreams:g})=>({messages:jv(h,m),messageStreams:s(g,m,u)})),c()),abortMessageStream:({streamId:u,conversationId:m})=>(m!==e||(a(u),l(({messageStreams:h})=>{if(!h[u])return{messageStreams:h};const g={...h};return delete g[u],{messageStreams:g}})),c()),setMessageStreamSnapshots:u=>{r(),n.clear();const m=u.reduce((h,g)=>(g.conversationId!==e||f().messages.some(b=>{const k=Lt(b,"streamId"),w=Lt(b,"clientMessageId");return k===g.streamId||!!w&&w===g.clientMessageId})||(h[g.streamId]={...g,message:Hv(g),order:i++}),h),{});l({messageStreams:m})},clearMessageStreams:()=>{r(),n.clear(),l({messageStreams:{}})}}},{name:`messages-${e}`}))},sc={},bt=e=>{const n=`messages-${e}`;return sc[n]||(sc[n]=E8(e)),sc[n]},T8=31536e3,Vv=4096,A8=()=>typeof location<"u"&&location.protocol==="https:",M8=e=>/[\s/:]/.test(e),Wv=e=>(e&&M8(e)&&console.warn(`[webchat] cookieDomain "${e}" looks invalid — use a bare domain like ".acme.com" or "acme.com"; cross-subdomain sharing may fail`),{getItem:n=>{if(typeof document>"u")return null;for(const t of document.cookie.split(";")){const i=t.trim(),r=i.indexOf("=");if(r!==-1&&i.slice(0,r)===n)return decodeURIComponent(i.slice(r+1))}return null},setItem:(n,t)=>{if(typeof document>"u")return;const i=`${n}=${encodeURIComponent(t)}`;i.length>Vv&&console.warn(`[webchat] cookie "${n}" is ${i.length} bytes, exceeding the ~${Vv} byte limit; it may be dropped by the browser`);const r=[i,"Path=/",`Max-Age=${T8}`,"SameSite=Lax"];e&&r.push(`Domain=${e}`),A8()&&r.push("Secure"),document.cookie=r.join("; ")},removeItem:n=>{if(typeof document>"u")return;const t=[`${n}=`,"Path=/","Max-Age=0"];e&&t.push(`Domain=${e}`),document.cookie=t.join("; ")}}),F8=(e,n,t)=>Nt()(Ki(Po(i=>({setUser:r=>i(a=>({...a,user:r})),setConversationId:r=>i(a=>({...a,conversationId:r})),clearAll:()=>{i(r=>({...r,user:void 0,conversationId:void 0}))}}),{name:e,storage:Io(()=>n==="cookieStorage"?Wv(t):n==="sessionStorage"?sessionStorage:localStorage)}))),lc={},qv=(e="bp-webchat",n,t)=>{const i=`${e}-client`;return lc[i]||(lc[i]=F8(i,n,t)),lc[i]},rt=Nt()(Ki(e=>({eventEmitter:kp(),messageContainerRef:E.createRef(),setMessageContainerRef:n=>e({messageContainerRef:n}),portalContainer:null,setPortalContainer:n=>e({portalContainer:n})}),{name:"webchatStore"})),I8=8,P8=e=>Nt()(Po((n,t)=>({files:[],setFiles:i=>n({files:i}),upsertFile:i=>n(({files:r})=>({files:r.some(s=>s.name===i.name)?r.map(s=>s.name===i.name?{...s,...i}:s):[...r,{...i}]})),uploadFile:async(i,r)=>{if(t().files.length===I8)return;const a=i.name.lastIndexOf("."),o=a>0&&a<i.name.length-1,s=o?i.name.substring(0,a):i.name,l=o?i.name.substring(a):"",f=kx(s,t().files,p=>p.name),c=f+l,d=new File([i],c,{type:i.type});t().upsertFile({name:f,type:"file",instance:d,status:"loading"});try{const{fileUrl:p,type:u,fileId:m}=await r(d);t().upsertFile({fileId:m,name:f,type:u,url:p,instance:d,status:"uploaded"})}catch{t().upsertFile({name:f,type:"file",instance:d,status:"error"})}},deleteFile:i=>n(({files:r})=>({files:r.filter(a=>a.name!=i)}))}),{name:e,storage:Io(()=>sessionStorage)})),fc={},Uv=(e,n)=>{const i=`${n||"bp-webchat"}-composer-files-${e}`;return fc[i]||(fc[i]=P8(i)),fc[i]},O8=e=>Nt()(Ki(n=>({participants:[],setParticipants:t=>n({participants:t}),addParticipant:t=>n(i=>({participants:[...i.participants,t]})),removeParticipant:t=>n(i=>({participants:i.participants.filter(r=>r.id!==t)})),clearParticipants:()=>n({participants:[]})}),{name:e})),cc={},dc=e=>{const n=`participants-${e}`;return cc[n]||(cc[n]=O8(n)),cc[n]},D8=e=>Nt()(Ki(Po((n,t)=>({soundOn:!0,setSoundEnabled:i=>n({soundOn:i}),toggleSound:()=>n({soundOn:!t().soundOn})}),{name:e}))),uc={},Gv=(e="bp-webchat")=>{const n=`${e}-sound`;return uc[n]||(uc[n]=D8(n)),uc[n]},N8=Nt()((e,n)=>({components:{},getCustomComponent:async t=>{const i=n().components[t];if(i)return i;const r=await fetch(t).then(f=>f.text()),a=new Blob([r],{type:"application/javascript"}),s=await import(URL.createObjectURL(a)),l=()=>s.default;return e(f=>({components:{...f.components,[t]:l}})),l}}));function Do({source:e}){const[n,t]=E.useState(!1),i=hA(e);return!i||n?y.jsx("span",{className:"bpCitationFavicon bpCitationFaviconFallback","aria-hidden":!0,children:y.jsx(xg,{size:11,strokeWidth:2})}):y.jsx("img",{className:"bpCitationFavicon",src:i,alt:"",loading:"lazy",onError:()=>t(!0)})}function L8({source:e}){const n=wf(e),t=Ig(e),i=e.url?String(e.url):null,r=typeof e.description=="string"?e.description:null,a=i?"a":"div";return y.jsxs(a,{className:"bpCitationCard",...i?{href:i,target:"_blank",rel:"noopener noreferrer"}:{},children:[y.jsxs("span",{className:"bpCitationCardHead",children:[y.jsx(Do,{source:e}),y.jsx("span",{className:"bpCitationCardSource",children:t??n})]}),y.jsx("span",{className:"bpCitationCardTitle",children:n}),r&&y.jsx("span",{className:"bpCitationCardSnippet",children:r})]})}function z8({sources:e}){const n=Fg(e),[t,i]=E.useState(!1),[r,a]=E.useState(0),o=rt(g=>g.portalContainer),s=rt(g=>g.messageContainerRef),l=(s==null?void 0:s.current)??void 0,{refs:f,floatingStyles:c,context:d}=Xf({open:t,onOpenChange:g=>{i(g),g||a(0)},placement:"top-start",middleware:[Nf(6),fv({padding:8,boundary:l}),Lf({padding:8,boundary:l,crossAxis:!0}),zf({padding:8,boundary:l,apply({availableWidth:g,availableHeight:v,elements:b}){Object.assign(b.floating.style,{maxWidth:`${Math.min(340,g)}px`,maxHeight:`${v}px`})}})],whileElementsMounted:Of}),{getReferenceProps:p,getFloatingProps:u}=nc([jM(d,{delay:{open:120,close:80},handleClose:l8()}),i8(d),Zf(d),ic(d,{role:"dialog"})]);if(n.length===0)return null;const m=n.length>1,h=n[Math.min(r,n.length-1)];return y.jsxs(y.Fragment,{children:[y.jsxs("span",{className:"bpCitationPill",role:"button",tabIndex:0,ref:f.setReference,...p(),children:[y.jsx(Do,{source:n[0]}),y.jsx("span",{className:"bpCitationPillLabel",children:wf(n[0])}),m&&y.jsxs("span",{className:"bpCitationPillMore",children:["+",n.length-1]})]}),t&&y.jsx(Jf,{root:o,children:y.jsxs("div",{ref:f.setFloating,style:{...c,pointerEvents:"auto"},className:"bpReset bpCitationTooltip",...u(),children:[m&&y.jsxs("div",{className:"bpCitationPager",children:[y.jsx("button",{type:"button",className:"bpCitationPagerButton",onClick:g=>{g.preventDefault(),a(v=>(v-1+n.length)%n.length)},"aria-label":"Previous source",children:y.jsx(lT,{size:14})}),y.jsx("button",{type:"button",className:"bpCitationPagerButton",onClick:g=>{g.preventDefault(),a(v=>(v+1)%n.length)},"aria-label":"Next source",children:y.jsx(fT,{size:14})}),y.jsxs("span",{className:"bpCitationPagerCount",children:[Math.min(r,n.length-1)+1,"/",n.length]})]}),h&&y.jsx(L8,{source:h})]})})]})}function pc(e,n){var t;if(n.length===0)return e;if(typeof e=="string"){if(!e.includes(xf))return e;const i=[];let r=0,a;const o=vA();for(;a=o.exec(e);){a.index>r&&i.push(e.slice(r,a.index));const s=Number(a[1]),l=n[s];l&&i.push(y.jsx(z8,{sources:l},`c${s}-${a.index}`)),r=a.index+a[0].length}return r<e.length&&i.push(e.slice(r)),i}if(Array.isArray(e))return e.map((i,r)=>y.jsx(E.Fragment,{children:pc(i,n)},r));if(E.isValidElement(e)){const i=e;if(((t=i.props)==null?void 0:t.children)!=null)return E.cloneElement(i,void 0,pc(i.props.children,n))}return e}function B8(){const e=this.data();(e.micromarkExtensions??(e.micromarkExtensions=[])).push({disable:{null:["codeIndented"]}})}function $8(e){const n=E.Children.toArray(e);return n.length===1&&E.isValidElement(n[0])&&n[0].type==="img"}function R8(e){const n=E.Children.toArray(e);return n.length===0?!0:n.every(t=>typeof t=="string"&&t.trim()==="")}const j8=8,Yi=({text:e,ctx:n,bare:t,citationPath:i,citationOffsetShift:r})=>{const[a,o]=E.useState(new Map),{presentedText:s,shouldAnimate:l}=H8(e,n.isStreaming===!0);E.useEffect(()=>{const b=/!\[.*?\]\((.*?)\)/g;let k;for(;(k=b.exec(e))!==null;){const w=k[1];if(w&&!a.has(w)){const x=new Image;x.src=w,x.onerror=()=>o(S=>new Map(S).set(w,!0)),x.onload=()=>o(S=>new Map(S).set(w,!1))}}},[e]);const f=i?uA(n.citations??[],i):[],{text:c,groups:d}=E.useMemo(()=>bA(s,f,r??0),[s,JSON.stringify(f),r]),p=E.useRef(d),u=E.useRef(l);p.current=d,u.current=l;const m=E.useCallback((b,k=!0)=>{const w=k&&p.current.length>0?pc(b,p.current):b;return u.current?y.jsx(W8,{children:w}):w},[]),g={...E.useMemo(()=>V8(m,()=>u.current),[m]),a:({node:b,href:k,children:w,...x})=>$8(w)?y.jsx(y.Fragment,{children:w}):R8(w)?null:y.jsx("a",{...x,className:"bpMessageBlocksTextLink",onMouseUp:()=>k&&window.open(k,"_blank","noopener,noreferrer"),children:m(w)}),img:({node:b,...k})=>a.get(k.src)?y.jsx("div",{"data-error":!0,className:"bpMessageBlocksTextImage",children:y.jsx(Sg,{strokeWidth:"1"})}):y.jsx("img",{...k,className:"bpMessageBlocksTextImage"}),pre:({node:b,...k})=>y.jsx(U8,{node:b,...k})},v=y.jsx(B1,{urlTransform:b=>b.startsWith("tel:")?b:$1(b),components:g,remarkPlugins:[B8,tT,Q9],children:d.length>0?c:s});return t?v:y.jsx(lo,{ctx:n,children:v})},H8=(e,n)=>{const t=E.useRef(n),[i,r]=E.useState(()=>n?mc(e):e);return n&&(t.current=!0),E.useLayoutEffect(()=>{r(a=>e.startsWith(a)?a:t.current?mc(e):e)},[e]),E.useEffect(()=>{if(!t.current||i===e||!e.startsWith(i))return;const a=()=>{r(s=>{if(!e.startsWith(s))return mc(e);const l=Array.from(e.slice(s.length)).slice(0,j8).join("");return l?s+l:s})};if(typeof requestAnimationFrame=="function"){const s=requestAnimationFrame(a);return()=>cancelAnimationFrame(s)}const o=setTimeout(a,16);return()=>clearTimeout(o)},[i,e]),{presentedText:i,shouldAnimate:t.current}},mc=e=>Array.from(e)[0]??"",V8=(e,n)=>({h1:({node:t,children:i,...r})=>y.jsx("h1",{...r,className:"bpMessageBlocksTextHeading1",children:e(i)}),h2:({node:t,children:i,...r})=>y.jsx("h2",{...r,className:"bpMessageBlocksTextHeading2",children:e(i)}),h3:({node:t,children:i,...r})=>y.jsx("h3",{...r,className:"bpMessageBlocksTextHeading3",children:e(i)}),h4:({node:t,children:i,...r})=>y.jsx("h4",{...r,className:"bpMessageBlocksTextHeading4",children:e(i)}),h5:({node:t,children:i,...r})=>y.jsx("h4",{...r,className:n()?"bpMessageBlocksTextHeading4":void 0,children:e(i)}),h6:({node:t,children:i,...r})=>y.jsx("h4",{...r,className:n()?"bpMessageBlocksTextHeading4":void 0,children:e(i)}),em:({node:t,children:i,...r})=>y.jsx("em",{...r,className:"bpMessageBlocksTextItalic",children:e(i)}),strong:({node:t,children:i,...r})=>y.jsx("strong",{...r,className:"bpMessageBlocksTextBold",children:e(i)}),p:({node:t,children:i,...r})=>y.jsx("p",{...r,className:"bpMessageBlocksTextText",children:e(i)}),hr:({node:t,...i})=>y.jsx("hr",{...i,className:"bpMessageBlocksTextHorizontalRule"}),ol:({node:t,...i})=>y.jsx("ol",{...i,className:"bpMessageBlocksTextOrderedList"}),ul:({node:t,...i})=>y.jsx("ul",{...i,className:"bpMessageBlocksTextUnorderedList"}),li:({node:t,children:i,...r})=>y.jsx("li",{...r,className:"bpMessageBlocksTextListItem",children:e(i)}),br:({node:t,...i})=>y.jsx("br",{...i,className:"bpMessageBlocksTextLineBreak"}),input:({node:t,...i})=>y.jsx("input",{...i,className:"bpMessageBlocksTextInput",disabled:!1}),code:({node:t,children:i,...r})=>y.jsx("code",{...r,className:"bpMessageBlocksTextCode",children:e(i,!1)}),table:({node:t,...i})=>y.jsx("div",{className:"bpMessageBlocksTextTableContainer",children:y.jsx("table",{...i,className:"bpMessageBlocksTextTable"})}),th:({node:t,children:i,...r})=>y.jsx("th",{...r,className:"bpMessageBlocksTextTableHeader",children:e(i)}),tr:({node:t,...i})=>y.jsx("tr",{...i,className:"bpMessageBlocksTextTableRow"}),td:({node:t,children:i,...r})=>y.jsx("td",{...r,className:"bpMessageBlocksTextTableData",children:e(i)})}),W8=({children:e})=>E.Children.map(e,(n,t)=>typeof n=="string"?y.jsx(q8,{text:n},`stream-fragment:${t}`):n),q8=({text:e})=>{const[n,t]=E.useState(()=>({sourceText:e,settledText:"",chunks:Kv(e,0)}));E.useLayoutEffect(()=>{t(r=>{if(r.sourceText===e)return r;const a=e.startsWith(r.sourceText),o=a?e.slice(r.sourceText.length):e,s=Kv(o,a?r.sourceText.length:0);if(!a)return{sourceText:e,settledText:"",chunks:s};const l=[...r.chunks,...s],f=Math.max(0,l.length-160);return{sourceText:e,settledText:r.settledText+l.slice(0,f).map(c=>c.text).join(""),chunks:l.slice(f)}})},[e]);const i=r=>{t(a=>{const o=a.chunks.findIndex(l=>l.id===r);if(o===-1)return a;const s=a.chunks.slice(0,o+1);return{...a,settledText:a.settledText+s.map(l=>l.text).join(""),chunks:a.chunks.slice(o+1)}})};return y.jsxs(y.Fragment,{children:[n.settledText,n.chunks.map(r=>y.jsx("span",{className:"bpMessageStreamChunk",onAnimationEnd:()=>i(r.id),children:r.text},r.id))]})},Kv=(e,n)=>e?[{id:`${n}`,text:e}]:[],U8=({node:e,...n})=>{var l,f;const t=e==null?void 0:e.children[0],i=G8(((f=(l=t==null?void 0:t.properties)==null?void 0:l.className)==null?void 0:f[0])||""),[r,a]=E.useState(!1),o=E.useRef(null),s=()=>{var d;const c=((d=o.current)==null?void 0:d.textContent)||"";navigator.clipboard.writeText(c).then(()=>{a(!0),setTimeout(()=>a(!1),1500)})};return y.jsxs("div",{className:"bpMessageBlocksTextCodeBlockContainer",children:[y.jsxs("div",{className:"bpMessageBlocksTextCodeBlockTitle",children:[i?y.jsx("span",{children:i}):"Code",r?y.jsx(yf,{className:"bpMessageBlocksTextCodeBlockCopyIcon"}):y.jsx(ST,{className:"bpMessageBlocksTextCodeBlockCopyIcon",onClick:s})]}),y.jsx("pre",{ref:o,...n,className:"bpMessageBlocksTextCodeBlock"})]})},G8=e=>{var n;return((n=e==null?void 0:e.match(/language-(\w+)/))==null?void 0:n[1])??""},hc=E.createContext(null);function Yv(){const e=E.useContext(hc);if(!e)throw new Error("useMessageContext must be used within a Message");return e}const gc=E.createContext({showInputModal:void 0});function vc(){return E.useContext(gc)}const Jv=({className:e,...n})=>y.jsx("div",{"data-slot":"skeleton",className:`bpSkeleton ${e||""}`,...n});Jv.displayName="Skeleton";var Dn=function(){return Dn=Object.assign||function(n){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(n[a]=t[a])}return n},Dn.apply(this,arguments)};function Zv(e,n){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(e);r<i.length;r++)n.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(t[i[r]]=e[i[r]]);return t}function Ji(e,n,t,i){function r(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(c){try{f(i.next(c))}catch(d){o(d)}}function l(c){try{f(i.throw(c))}catch(d){o(d)}}function f(c){c.done?a(c.value):r(c.value).then(s,l)}f((i=i.apply(e,n||[])).next())})}function Zi(e,n){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,r,a,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(f){return function(c){return l([f,c])}}function l(f){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(t=0)),t;)try{if(i=1,r&&(a=f[0]&2?r.return:f[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,f[1])).done)return a;switch(r=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return t.label++,{value:f[1],done:!1};case 5:t.label++,r=f[1],f=[0];continue;case 7:f=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){t=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){t.label=f[1];break}if(f[0]===6&&t.label<a[1]){t.label=a[1],a=f;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(f);break}a[2]&&t.ops.pop(),t.trys.pop();continue}f=n.call(e,t)}catch(c){f=[6,c],r=0}finally{i=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function Qv(e,n){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var i=t.call(e),r,a=[],o;try{for(;(n===void 0||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function bc(e,n,t){if(t||arguments.length===2)for(var i=0,r=n.length,a;i<r;i++)(a||!(i in n))&&(a||(a=Array.prototype.slice.call(n,0,i)),a[i]=n[i]);return e.concat(a||Array.prototype.slice.call(n))}typeof SuppressedError=="function"&&SuppressedError;function K8(){var e=E.useRef(!1),n=E.useCallback(function(){return e.current},[]);return E.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),n}function Y8(e,n,t){n===void 0&&(n=[]),t===void 0&&(t={loading:!1});var i=E.useRef(0),r=K8(),a=E.useState(t),o=a[0],s=a[1],l=E.useCallback(function(){for(var f=[],c=0;c<arguments.length;c++)f[c]=arguments[c];var d=++i.current;return o.loading||s(function(p){return Dn(Dn({},p),{loading:!0})}),e.apply(void 0,f).then(function(p){return r()&&d===i.current&&s({value:p,loading:!1}),p},function(p){return r()&&d===i.current&&s({error:p,loading:!1}),p})},n);return[o,l]}function J8(e,n){n===void 0&&(n=[]);var t=Y8(e,n,{loading:!0}),i=t[0],r=t[1];return E.useEffect(function(){r()},[r]),i}const No=E.forwardRef(({url:e,orientation:n="auto",...t},i)=>{const r=E.useId(),{setIsLoading:a}=Yv(),[o,s]=E.useState(n==="auto"?"square":n),[l,f]=E.useState("initial");return E.useLayoutEffect(()=>(a(c=>[...c,r]),()=>{a(c=>c.filter(d=>d!==r))}),[r,a]),J8(async()=>{if(!e)return;const c=new Image;try{const{width:d,height:p}=await N_(e);n==="auto"&&s(Z8(d,p)),c.onload=()=>{f("loaded"),a(u=>u.filter(m=>m!==r))},c.onerror=()=>{f("error"),s("square"),a(u=>u.filter(m=>m!==r))},c.src=e,c.complete&&(c.naturalWidth>0?(f("loaded"),a(u=>u.filter(m=>m!==r))):(f("error"),s("square"),a(u=>u.filter(m=>m!==r))))}catch(d){console.error(d),f("error"),a(p=>p.filter(u=>u!==r))}return()=>{c.onload=null,c.onerror=null}},[e,r,a,n]),e?l==="error"?y.jsx("div",{"data-error":"true","data-orientation":o,...t,className:"bpMessageBlocksImageImage",ref:i,children:y.jsx(Sg,{size:"25%",strokeWidth:"5%"})}):l==="initial"?y.jsx(Jv,{"data-orientation":o,className:"bpMessageBlocksImagePlaceholder"}):y.jsx("img",{"data-orientation":o,"data-loaded":l==="loaded",...t,className:"bpMessageBlocksImageImage",src:e,alt:"",ref:i}):null});No.displayName="Image";function Z8(e,n){const t={square:1,portrait:.75,landscape:1.3333333333333333},i=e/n;return Object.keys(t).reduce((a,o)=>Math.abs(t[o]-i)<Math.abs(t[a]-i)?o:a)}const Xv=({url:e,isReadOnly:n})=>y.jsx("div",{children:y.jsx("video",{"data-chromatic":"ignore",style:n?{pointerEvents:"none"}:void 0,controls:!0,src:e,className:"bpMessageBlocksVideo"})}),e0=({url:e,isReadOnly:n})=>y.jsx("div",{children:y.jsx("audio",{controls:!0,style:n?{pointerEvents:"none"}:void 0,src:e,className:"bpMessageBlocksAudio"})}),n0=({title:e,url:n,isReadOnly:t})=>y.jsxs("a",{className:"bpMessageBlocksFileContainer",href:n,style:t?{pointerEvents:"none"}:void 0,download:!0,target:"_blank",rel:"noreferrer",children:[y.jsx("p",{className:"bpMessageBlocksFileTitle",children:e||n}),y.jsx(xT,{className:"bpMessageBlocksFileIcon"})]}),t0=({latitude:e,longitude:n,title:t,isReadOnly:i})=>{const r=`https://www.google.com/maps/search/?api=1&query=${e},${n}`;return y.jsxs("a",{className:"bpMessageBlocksLocationContainer",style:i?{pointerEvents:"none"}:void 0,href:r,target:"_blank",rel:"noopener",children:[y.jsx("p",{className:"bpMessageBlocksLocationTitle",children:t}),y.jsx(Cg,{className:"bpMessageBlocksLocationIcon"})]})},yc=({text:e,buttonValue:n,variant:t,groupId:i,reusable:r,sendMessage:a,isReadOnly:o})=>{const s=rt(v=>v.eventEmitter),[l,f]=E.useState(!1),[c,d]=E.useState(!1),[p,u]=E.useState(!1);E.useEffect(()=>{if(i)return s.on(`button-group-${i}-click`,()=>{d(!0),r||u(!0)})},[s,i,r]);const h={onClick:v=>{if((p||o)&&t==="link"){v.preventDefault();return}f(!0),r||u(!0),i&&s.emit(`button-group-${i}-click`),t!=="link"&&a&&a({type:"text",text:e,value:n},{})},"data-activated":l?"":void 0,"data-group-activated":c?"":void 0,"data-type":t,className:"bpMessageBlocksButton"},g=p||o;return t==="link"?y.jsx("a",{...h,style:o?{pointerEvents:"none"}:void 0,href:n,target:"_blank",rel:"noopener noreferrer",children:e}):y.jsx("button",{...h,style:o?{pointerEvents:"none"}:void 0,disabled:g,children:e})},Q8=yc,kc=({actions:e,groupId:n,reusable:t,sendMessage:i,isReadOnly:r})=>e.length===0?null:y.jsx("div",{className:"bpMessageBlocksRow",children:e.map((a,o)=>y.jsx(yc,{text:a.label,buttonValue:a.value,variant:a.variant,groupId:n,reusable:t,sendMessage:i,isReadOnly:r},o))}),wc=({imageUrl:e,title:n,subtitle:t,actions:i,ctx:r,citationBasePath:a})=>y.jsx(lo,{ctx:r,children:y.jsxs("div",{className:"bpMessageBlocksColumn","data-horizontal":"center",children:[e&&y.jsx(No,{url:e}),n&&y.jsx(Yi,{text:`#### ${n}`,ctx:r,bare:!0,citationPath:a?`${a}.title`:void 0,citationOffsetShift:5}),t&&y.jsx(Yi,{text:t,ctx:r,bare:!0,citationPath:a?`${a}.subtitle`:void 0}),y.jsx(kc,{actions:i,reusable:!0,sendMessage:r.sendMessage,isReadOnly:r.isReadOnly})]})});function X8(e){return Object.prototype.toString.call(e)==="[object Object]"}function i0(e){return X8(e)||Array.isArray(e)}function eF(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function _c(e,n){const t=Object.keys(e),i=Object.keys(n);if(t.length!==i.length)return!1;const r=JSON.stringify(Object.keys(e.breakpoints||{})),a=JSON.stringify(Object.keys(n.breakpoints||{}));return r!==a?!1:t.every(o=>{const s=e[o],l=n[o];return typeof s=="function"?`${s}`==`${l}`:!i0(s)||!i0(l)?s===l:_c(s,l)})}function r0(e){return e.concat().sort((n,t)=>n.name>t.name?1:-1).map(n=>n.options)}function nF(e,n){if(e.length!==n.length)return!1;const t=r0(e),i=r0(n);return t.every((r,a)=>{const o=i[a];return _c(r,o)})}function xc(e){return typeof e=="number"}function Sc(e){return typeof e=="string"}function Lo(e){return typeof e=="boolean"}function a0(e){return Object.prototype.toString.call(e)==="[object Object]"}function He(e){return Math.abs(e)}function Cc(e){return Math.sign(e)}function ia(e,n){return He(e-n)}function tF(e,n){if(e===0||n===0||He(e)<=He(n))return 0;const t=ia(He(e),He(n));return He(t/e)}function iF(e){return Math.round(e*100)/100}function ra(e){return oa(e).map(Number)}function Gn(e){return e[aa(e)]}function aa(e){return Math.max(0,e.length-1)}function Ec(e,n){return n===aa(e)}function o0(e,n=0){return Array.from(Array(e),(t,i)=>n+i)}function oa(e){return Object.keys(e)}function s0(e,n){return[e,n].reduce((t,i)=>(oa(i).forEach(r=>{const a=t[r],o=i[r],s=a0(a)&&a0(o);t[r]=s?s0(a,o):o}),t),{})}function Tc(e,n){return typeof n.MouseEvent<"u"&&e instanceof n.MouseEvent}function rF(e,n){const t={start:i,center:r,end:a};function i(){return 0}function r(l){return a(l)/2}function a(l){return n-l}function o(l,f){return Sc(e)?t[e](l):e(n,l,f)}return{measure:o}}function sa(){let e=[];function n(r,a,o,s={passive:!0}){let l;if("addEventListener"in r)r.addEventListener(a,o,s),l=()=>r.removeEventListener(a,o,s);else{const f=r;f.addListener(o),l=()=>f.removeListener(o)}return e.push(l),i}function t(){e=e.filter(r=>r())}const i={add:n,clear:t};return i}function aF(e,n,t,i){const r=sa(),a=1e3/60;let o=null,s=0,l=0;function f(){r.add(e,"visibilitychange",()=>{e.hidden&&m()})}function c(){u(),r.clear()}function d(g){if(!l)return;o||(o=g,t(),t());const v=g-o;for(o=g,s+=v;s>=a;)t(),s-=a;const b=s/a;i(b),l&&(l=n.requestAnimationFrame(d))}function p(){l||(l=n.requestAnimationFrame(d))}function u(){n.cancelAnimationFrame(l),o=null,s=0,l=0}function m(){o=null,s=0}return{init:f,destroy:c,start:p,stop:u,update:t,render:i}}function oF(e,n){const t=n==="rtl",i=e==="y",r=i?"y":"x",a=i?"x":"y",o=!i&&t?-1:1,s=c(),l=d();function f(m){const{height:h,width:g}=m;return i?h:g}function c(){return i?"top":t?"right":"left"}function d(){return i?"bottom":t?"left":"right"}function p(m){return m*o}return{scroll:r,cross:a,startEdge:s,endEdge:l,measureSize:f,direction:p}}function ui(e=0,n=0){const t=He(e-n);function i(f){return f<e}function r(f){return f>n}function a(f){return i(f)||r(f)}function o(f){return a(f)?i(f)?e:n:f}function s(f){return t?f-t*Math.ceil((f-n)/t):f}return{length:t,max:n,min:e,constrain:o,reachedAny:a,reachedMax:r,reachedMin:i,removeOffset:s}}function l0(e,n,t){const{constrain:i}=ui(0,e),r=e+1;let a=o(n);function o(p){return t?He((r+p)%r):i(p)}function s(){return a}function l(p){return a=o(p),d}function f(p){return c().set(s()+p)}function c(){return l0(e,s(),t)}const d={get:s,set:l,add:f,clone:c};return d}function sF(e,n,t,i,r,a,o,s,l,f,c,d,p,u,m,h,g,v,b){const{cross:k,direction:w}=e,x=["INPUT","SELECT","TEXTAREA"],S={passive:!1},M=sa(),I=sa(),O=ui(50,225).constrain(u.measure(20)),T={mouse:300,touch:400},P={mouse:500,touch:600},R=m?43:25;let z=!1,F=0,D=0,L=!1,j=!1,N=!1,V=!1;function _(H){if(!b)return;function Y(Te){(Lo(b)||b(H,Te))&&K(Te)}const de=n;M.add(de,"dragstart",Te=>Te.preventDefault(),S).add(de,"touchmove",()=>{},S).add(de,"touchend",()=>{}).add(de,"touchstart",Y).add(de,"mousedown",Y).add(de,"touchcancel",G).add(de,"contextmenu",G).add(de,"click",ne,!0)}function $(){M.clear(),I.clear()}function B(){const H=V?t:n;I.add(H,"touchmove",U,S).add(H,"touchend",G).add(H,"mousemove",U,S).add(H,"mouseup",G)}function C(H){const Y=H.nodeName||"";return x.includes(Y)}function q(){return(m?P:T)[V?"mouse":"touch"]}function Q(H,Y){const de=d.add(Cc(H)*-1),Te=c.byDistance(H,!m).distance;return m||He(H)<O?Te:g&&Y?Te*.5:c.byIndex(de.get(),0).distance}function K(H){const Y=Tc(H,i);V=Y,N=m&&Y&&!H.buttons&&z,z=ia(r.get(),o.get())>=2,!(Y&&H.button!==0)&&(C(H.target)||(L=!0,a.pointerDown(H),f.useFriction(0).useDuration(0),r.set(o),B(),F=a.readPoint(H),D=a.readPoint(H,k),p.emit("pointerDown")))}function U(H){if(!Tc(H,i)&&H.touches.length>=2)return G(H);const de=a.readPoint(H),Te=a.readPoint(H,k),te=ia(de,F),pe=ia(Te,D);if(!j&&!V&&(!H.cancelable||(j=te>pe,!j)))return G(H);const ge=a.pointerMove(H);te>h&&(N=!0),f.useFriction(.3).useDuration(.75),s.start(),r.add(w(ge)),H.preventDefault()}function G(H){const de=c.byDistance(0,!1).index!==d.get(),Te=a.pointerUp(H)*q(),te=Q(w(Te),de),pe=tF(Te,te),ge=R-10*pe,ve=v+pe/50;j=!1,L=!1,I.clear(),f.useDuration(ge).useFriction(ve),l.distance(te,!m),V=!1,p.emit("pointerUp")}function ne(H){N&&(H.stopPropagation(),H.preventDefault(),N=!1)}function Z(){return L}return{init:_,destroy:$,pointerDown:Z}}function lF(e,n){let i,r;function a(d){return d.timeStamp}function o(d,p){const m=`client${(p||e.scroll)==="x"?"X":"Y"}`;return(Tc(d,n)?d:d.touches[0])[m]}function s(d){return i=d,r=d,o(d)}function l(d){const p=o(d)-o(r),u=a(d)-a(i)>170;return r=d,u&&(i=d),p}function f(d){if(!i||!r)return 0;const p=o(r)-o(i),u=a(d)-a(i),m=a(d)-a(r)>170,h=p/u;return u&&!m&&He(h)>.1?h:0}return{pointerDown:s,pointerMove:l,pointerUp:f,readPoint:o}}function fF(){function e(t){const{offsetTop:i,offsetLeft:r,offsetWidth:a,offsetHeight:o}=t;return{top:i,right:r+a,bottom:i+o,left:r,width:a,height:o}}return{measure:e}}function cF(e){function n(i){return e*(i/100)}return{measure:n}}function dF(e,n,t,i,r,a,o){const s=[e].concat(i);let l,f,c=[],d=!1;function p(g){return r.measureSize(o.measure(g))}function u(g){if(!a)return;f=p(e),c=i.map(p);function v(b){for(const k of b){if(d)return;const w=k.target===e,x=i.indexOf(k.target),S=w?f:c[x],M=p(w?e:i[x]);if(He(M-S)>=.5){g.reInit(),n.emit("resize");break}}}l=new ResizeObserver(b=>{(Lo(a)||a(g,b))&&v(b)}),t.requestAnimationFrame(()=>{s.forEach(b=>l.observe(b))})}function m(){d=!0,l&&l.disconnect()}return{init:u,destroy:m}}function uF(e,n,t,i,r,a){let o=0,s=0,l=r,f=a,c=e.get(),d=0;function p(){const S=i.get()-e.get(),M=!l;let I=0;return M?(o=0,t.set(i),e.set(i),I=S):(t.set(e),o+=S/l,o*=f,c+=o,e.add(o),I=c-d),s=Cc(I),d=c,x}function u(){const S=i.get()-n.get();return He(S)<.001}function m(){return l}function h(){return s}function g(){return o}function v(){return k(r)}function b(){return w(a)}function k(S){return l=S,x}function w(S){return f=S,x}const x={direction:h,duration:m,velocity:g,seek:p,settled:u,useBaseFriction:b,useBaseDuration:v,useFriction:w,useDuration:k};return x}function pF(e,n,t,i,r){const a=r.measure(10),o=r.measure(50),s=ui(.1,.99);let l=!1;function f(){return!(l||!e.reachedAny(t.get())||!e.reachedAny(n.get()))}function c(u){if(!f())return;const m=e.reachedMin(n.get())?"min":"max",h=He(e[m]-n.get()),g=t.get()-n.get(),v=s.constrain(h/o);t.subtract(g*v),!u&&He(g)<a&&(t.set(e.constrain(t.get())),i.useDuration(25).useBaseFriction())}function d(u){l=!u}return{shouldConstrain:f,constrain:c,toggleActive:d}}function mF(e,n,t,i,r){const a=ui(-n+e,0),o=d(),s=c(),l=p();function f(m,h){return ia(m,h)<=1}function c(){const m=o[0],h=Gn(o),g=o.lastIndexOf(m),v=o.indexOf(h)+1;return ui(g,v)}function d(){return t.map((m,h)=>{const{min:g,max:v}=a,b=a.constrain(m),k=!h,w=Ec(t,h);return k?v:w||f(g,b)?g:f(v,b)?v:b}).map(m=>parseFloat(m.toFixed(3)))}function p(){if(n<=e+r)return[a.max];if(i==="keepSnaps")return o;const{min:m,max:h}=s;return o.slice(m,h)}return{snapsContained:l,scrollContainLimit:s}}function hF(e,n,t){const i=n[0],r=t?i-e:Gn(n);return{limit:ui(r,i)}}function gF(e,n,t,i){const a=n.min+.1,o=n.max+.1,{reachedMin:s,reachedMax:l}=ui(a,o);function f(p){return p===1?l(t.get()):p===-1?s(t.get()):!1}function c(p){if(!f(p))return;const u=e*(p*-1);i.forEach(m=>m.add(u))}return{loop:c}}function vF(e){const{max:n,length:t}=e;function i(a){const o=a-n;return t?o/-t:0}return{get:i}}function bF(e,n,t,i,r){const{startEdge:a,endEdge:o}=e,{groupSlides:s}=r,l=d().map(n.measure),f=p(),c=u();function d(){return s(i).map(h=>Gn(h)[o]-h[0][a]).map(He)}function p(){return i.map(h=>t[a]-h[a]).map(h=>-He(h))}function u(){return s(f).map(h=>h[0]).map((h,g)=>h+l[g])}return{snaps:f,snapsAligned:c}}function yF(e,n,t,i,r,a){const{groupSlides:o}=r,{min:s,max:l}=i,f=c();function c(){const p=o(a),u=!e||n==="keepSnaps";return t.length===1?[a]:u?p:p.slice(s,l).map((m,h,g)=>{const v=!h,b=Ec(g,h);if(v){const k=Gn(g[0])+1;return o0(k)}if(b){const k=aa(a)-Gn(g)[0]+1;return o0(k,Gn(g)[0])}return m})}return{slideRegistry:f}}function kF(e,n,t,i,r){const{reachedAny:a,removeOffset:o,constrain:s}=i;function l(m){return m.concat().sort((h,g)=>He(h)-He(g))[0]}function f(m){const h=e?o(m):s(m),g=n.map((b,k)=>({diff:c(b-h,0),index:k})).sort((b,k)=>He(b.diff)-He(k.diff)),{index:v}=g[0];return{index:v,distance:h}}function c(m,h){const g=[m,m+t,m-t];if(!e)return m;if(!h)return l(g);const v=g.filter(b=>Cc(b)===h);return v.length?l(v):Gn(g)-t}function d(m,h){const g=n[m]-r.get(),v=c(g,h);return{index:m,distance:v}}function p(m,h){const g=r.get()+m,{index:v,distance:b}=f(g),k=!e&&a(g);if(!h||k)return{index:v,distance:m};const w=n[v]-b,x=m+c(w,0);return{index:v,distance:x}}return{byDistance:p,byIndex:d,shortcut:c}}function wF(e,n,t,i,r,a,o){function s(d){const p=d.distance,u=d.index!==n.get();a.add(p),p&&(i.duration()?e.start():(e.update(),e.render(1),e.update())),u&&(t.set(n.get()),n.set(d.index),o.emit("select"))}function l(d,p){const u=r.byDistance(d,p);s(u)}function f(d,p){const u=n.clone().set(d),m=r.byIndex(u.get(),p);s(m)}return{distance:l,index:f}}function _F(e,n,t,i,r,a,o,s){const l={passive:!0,capture:!0};let f=0;function c(u){if(!s)return;function m(h){if(new Date().getTime()-f>10)return;o.emit("slideFocusStart"),e.scrollLeft=0;const b=t.findIndex(k=>k.includes(h));xc(b)&&(r.useDuration(0),i.index(b,0),o.emit("slideFocus"))}a.add(document,"keydown",d,!1),n.forEach((h,g)=>{a.add(h,"focus",v=>{(Lo(s)||s(u,v))&&m(g)},l)})}function d(u){u.code==="Tab"&&(f=new Date().getTime())}return{init:c}}function la(e){let n=e;function t(){return n}function i(l){n=o(l)}function r(l){n+=o(l)}function a(l){n-=o(l)}function o(l){return xc(l)?l:l.get()}return{get:t,set:i,add:r,subtract:a}}function f0(e,n){const t=e.scroll==="x"?o:s,i=n.style;let r=null,a=!1;function o(p){return`translate3d(${p}px,0px,0px)`}function s(p){return`translate3d(0px,${p}px,0px)`}function l(p){if(a)return;const u=iF(e.direction(p));u!==r&&(i.transform=t(u),r=u)}function f(p){a=!p}function c(){a||(i.transform="",n.getAttribute("style")||n.removeAttribute("style"))}return{clear:c,to:l,toggleActive:f}}function xF(e,n,t,i,r,a,o,s,l){const c=ra(r),d=ra(r).reverse(),p=v().concat(b());function u(M,I){return M.reduce((O,T)=>O-r[T],I)}function m(M,I){return M.reduce((O,T)=>u(O,I)>0?O.concat([T]):O,[])}function h(M){return a.map((I,O)=>({start:I-i[O]+.5+M,end:I+n-.5+M}))}function g(M,I,O){const T=h(I);return M.map(P=>{const R=O?0:-t,z=O?t:0,F=O?"end":"start",D=T[P][F];return{index:P,loopPoint:D,slideLocation:la(-1),translate:f0(e,l[P]),target:()=>s.get()>D?R:z}})}function v(){const M=o[0],I=m(d,M);return g(I,t,!1)}function b(){const M=n-o[0]-1,I=m(c,M);return g(I,-t,!0)}function k(){return p.every(({index:M})=>{const I=c.filter(O=>O!==M);return u(I,n)<=.1})}function w(){p.forEach(M=>{const{target:I,translate:O,slideLocation:T}=M,P=I();P!==T.get()&&(O.to(P),T.set(P))})}function x(){p.forEach(M=>M.translate.clear())}return{canLoop:k,clear:x,loop:w,loopPoints:p}}function SF(e,n,t){let i,r=!1;function a(l){if(!t)return;function f(c){for(const d of c)if(d.type==="childList"){l.reInit(),n.emit("slidesChanged");break}}i=new MutationObserver(c=>{r||(Lo(t)||t(l,c))&&f(c)}),i.observe(e,{childList:!0})}function o(){i&&i.disconnect(),r=!0}return{init:a,destroy:o}}function CF(e,n,t,i){const r={};let a=null,o=null,s,l=!1;function f(){s=new IntersectionObserver(m=>{l||(m.forEach(h=>{const g=n.indexOf(h.target);r[g]=h}),a=null,o=null,t.emit("slidesInView"))},{root:e.parentElement,threshold:i}),n.forEach(m=>s.observe(m))}function c(){s&&s.disconnect(),l=!0}function d(m){return oa(r).reduce((h,g)=>{const v=parseInt(g),{isIntersecting:b}=r[v];return(m&&b||!m&&!b)&&h.push(v),h},[])}function p(m=!0){if(m&&a)return a;if(!m&&o)return o;const h=d(m);return m&&(a=h),m||(o=h),h}return{init:f,destroy:c,get:p}}function EF(e,n,t,i,r,a){const{measureSize:o,startEdge:s,endEdge:l}=e,f=t[0]&&r,c=m(),d=h(),p=t.map(o),u=g();function m(){if(!f)return 0;const b=t[0];return He(n[s]-b[s])}function h(){if(!f)return 0;const b=a.getComputedStyle(Gn(i));return parseFloat(b.getPropertyValue(`margin-${l}`))}function g(){return t.map((b,k,w)=>{const x=!k,S=Ec(w,k);return x?p[k]+c:S?p[k]+d:w[k+1][s]-b[s]}).map(He)}return{slideSizes:p,slideSizesWithGaps:u,startGap:c,endGap:d}}function TF(e,n,t,i,r,a,o,s,l){const{startEdge:f,endEdge:c,direction:d}=e,p=xc(t);function u(v,b){return ra(v).filter(k=>k%b===0).map(k=>v.slice(k,k+b))}function m(v){return v.length?ra(v).reduce((b,k,w)=>{const x=Gn(b)||0,S=x===0,M=k===aa(v),I=r[f]-a[x][f],O=r[f]-a[k][c],T=!i&&S?d(o):0,P=!i&&M?d(s):0,R=He(O-P-(I+T));return w&&R>n+l&&b.push(k),M&&b.push(v.length),b},[]).map((b,k,w)=>{const x=Math.max(w[k-1]||0);return v.slice(x,b)}):[]}function h(v){return p?u(v,t):m(v)}return{groupSlides:h}}function AF(e,n,t,i,r,a,o){const{align:s,axis:l,direction:f,startIndex:c,loop:d,duration:p,dragFree:u,dragThreshold:m,inViewThreshold:h,slidesToScroll:g,skipSnaps:v,containScroll:b,watchResize:k,watchSlides:w,watchDrag:x,watchFocus:S}=a,M=2,I=fF(),O=I.measure(n),T=t.map(I.measure),P=oF(l,f),R=P.measureSize(O),z=cF(R),F=rF(s,R),D=!d&&!!b,L=d||!!b,{slideSizes:j,slideSizesWithGaps:N,startGap:V,endGap:_}=EF(P,O,T,t,L,r),$=TF(P,R,g,d,O,T,V,_,M),{snaps:B,snapsAligned:C}=bF(P,F,O,T,$),q=-Gn(B)+Gn(N),{snapsContained:Q,scrollContainLimit:K}=mF(R,q,C,b,M),U=D?Q:C,{limit:G}=hF(q,U,d),ne=l0(aa(U),c,d),Z=ne.clone(),re=ra(t),H=({dragHandler:be,scrollBody:Ke,scrollBounds:nn,options:{loop:rn}})=>{rn||nn.constrain(be.pointerDown()),Ke.seek()},Y=({scrollBody:be,translate:Ke,location:nn,offsetLocation:rn,previousLocation:Bn,scrollLooper:Qn,slideLooper:tn,dragHandler:$n,animation:yn,eventHandler:js,scrollBounds:z$,options:{loop:u_}},p_)=>{const m_=be.settled(),B$=!z$.shouldConstrain(),h_=u_?m_:m_&&B$,g_=h_&&!$n.pointerDown();g_&&yn.stop();const $$=nn.get()*p_+Bn.get()*(1-p_);rn.set($$),u_&&(Qn.loop(be.direction()),tn.loop()),Ke.to(rn.get()),g_&&js.emit("settle"),h_||js.emit("scroll")},de=aF(i,r,()=>H(ue),be=>Y(ue,be)),Te=.68,te=U[ne.get()],pe=la(te),ge=la(te),ve=la(te),Ae=la(te),Le=uF(pe,ve,ge,Ae,p,Te),Fe=kF(d,U,q,G,Ae),$e=wF(de,ne,Z,Le,Fe,Ae,o),ae=vF(G),fe=sa(),W=CF(n,t,o,h),{slideRegistry:J}=yF(D,b,U,K,$,re),oe=_F(e,t,J,$e,Le,fe,o,S),ue={ownerDocument:i,ownerWindow:r,eventHandler:o,containerRect:O,slideRects:T,animation:de,axis:P,dragHandler:sF(P,e,i,r,Ae,lF(P,r),pe,de,$e,Le,Fe,ne,o,z,u,m,v,Te,x),eventStore:fe,percentOfView:z,index:ne,indexPrevious:Z,limit:G,location:pe,offsetLocation:ve,previousLocation:ge,options:a,resizeHandler:dF(n,o,r,t,P,k,I),scrollBody:Le,scrollBounds:pF(G,ve,Ae,Le,z),scrollLooper:gF(q,G,ve,[pe,ve,ge,Ae]),scrollProgress:ae,scrollSnapList:U.map(ae.get),scrollSnaps:U,scrollTarget:Fe,scrollTo:$e,slideLooper:xF(P,R,q,j,N,B,U,ve,t),slideFocus:oe,slidesHandler:SF(n,o,w),slidesInView:W,slideIndexes:re,slideRegistry:J,slidesToScroll:$,target:Ae,translate:f0(P,n)};return ue}function MF(){let e={},n;function t(f){n=f}function i(f){return e[f]||[]}function r(f){return i(f).forEach(c=>c(n,f)),l}function a(f,c){return e[f]=i(f).concat([c]),l}function o(f,c){return e[f]=i(f).filter(d=>d!==c),l}function s(){e={}}const l={init:t,emit:r,off:o,on:a,clear:s};return l}const FF={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function IF(e){function n(a,o){return s0(a,o||{})}function t(a){const o=a.breakpoints||{},s=oa(o).filter(l=>e.matchMedia(l).matches).map(l=>o[l]).reduce((l,f)=>n(l,f),{});return n(a,s)}function i(a){return a.map(o=>oa(o.breakpoints||{})).reduce((o,s)=>o.concat(s),[]).map(e.matchMedia)}return{mergeOptions:n,optionsAtMedia:t,optionsMediaQueries:i}}function PF(e){let n=[];function t(a,o){return n=o.filter(({options:s})=>e.optionsAtMedia(s).active!==!1),n.forEach(s=>s.init(a,e)),o.reduce((s,l)=>Object.assign(s,{[l.name]:l}),{})}function i(){n=n.filter(a=>a.destroy())}return{init:t,destroy:i}}function zo(e,n,t){const i=e.ownerDocument,r=i.defaultView,a=IF(r),o=PF(a),s=sa(),l=MF(),{mergeOptions:f,optionsAtMedia:c,optionsMediaQueries:d}=a,{on:p,off:u,emit:m}=l,h=P;let g=!1,v,b=f(FF,zo.globalOptions),k=f(b),w=[],x,S,M;function I(){const{container:re,slides:H}=k;S=(Sc(re)?e.querySelector(re):re)||e.children[0];const de=Sc(H)?S.querySelectorAll(H):H;M=[].slice.call(de||S.children)}function O(re){const H=AF(e,S,M,i,r,re,l);if(re.loop&&!H.slideLooper.canLoop()){const Y=Object.assign({},re,{loop:!1});return O(Y)}return H}function T(re,H){g||(b=f(b,re),k=c(b),w=H||w,I(),v=O(k),d([b,...w.map(({options:Y})=>Y)]).forEach(Y=>s.add(Y,"change",P)),k.active&&(v.translate.to(v.location.get()),v.animation.init(),v.slidesInView.init(),v.slideFocus.init(Z),v.eventHandler.init(Z),v.resizeHandler.init(Z),v.slidesHandler.init(Z),v.options.loop&&v.slideLooper.loop(),S.offsetParent&&M.length&&v.dragHandler.init(Z),x=o.init(Z,w)))}function P(re,H){const Y=$();R(),T(f({startIndex:Y},re),H),l.emit("reInit")}function R(){v.dragHandler.destroy(),v.eventStore.clear(),v.translate.clear(),v.slideLooper.clear(),v.resizeHandler.destroy(),v.slidesHandler.destroy(),v.slidesInView.destroy(),v.animation.destroy(),o.destroy(),s.clear()}function z(){g||(g=!0,s.clear(),R(),l.emit("destroy"),l.clear())}function F(re,H,Y){!k.active||g||(v.scrollBody.useBaseFriction().useDuration(H===!0?0:k.duration),v.scrollTo.index(re,Y||0))}function D(re){const H=v.index.add(1).get();F(H,re,-1)}function L(re){const H=v.index.add(-1).get();F(H,re,1)}function j(){return v.index.add(1).get()!==$()}function N(){return v.index.add(-1).get()!==$()}function V(){return v.scrollSnapList}function _(){return v.scrollProgress.get(v.offsetLocation.get())}function $(){return v.index.get()}function B(){return v.indexPrevious.get()}function C(){return v.slidesInView.get()}function q(){return v.slidesInView.get(!1)}function Q(){return x}function K(){return v}function U(){return e}function G(){return S}function ne(){return M}const Z={canScrollNext:j,canScrollPrev:N,containerNode:G,internalEngine:K,destroy:z,off:u,on:p,emit:m,plugins:Q,previousScrollSnap:B,reInit:h,rootNode:U,scrollNext:D,scrollPrev:L,scrollProgress:_,scrollSnapList:V,scrollTo:F,selectedScrollSnap:$,slideNodes:ne,slidesInView:C,slidesNotInView:q};return T(n,t),setTimeout(()=>l.emit("init"),0),Z}zo.globalOptions=void 0;function Ac(e={},n=[]){const t=E.useRef(e),i=E.useRef(n),[r,a]=E.useState(),[o,s]=E.useState(),l=E.useCallback(()=>{r&&r.reInit(t.current,i.current)},[r]);return E.useEffect(()=>{_c(t.current,e)||(t.current=e,l())},[e,l]),E.useEffect(()=>{nF(i.current,n)||(i.current=n,l())},[n,l]),E.useEffect(()=>{if(eF()&&o){zo.globalOptions=Ac.globalOptions;const f=zo(o,t.current,i.current);return a(f),()=>f.destroy()}else a(void 0)},[o,a]),[s,r]}Ac.globalOptions=void 0;const c0=({cards:e,ctx:n})=>{const[t,i]=Ac({skipSnaps:!0,loop:!0}),[r,a]=E.useState(!0),[o,s]=E.useState(!0),l=E.useCallback(()=>i==null?void 0:i.scrollPrev(),[i]),f=E.useCallback(()=>i==null?void 0:i.scrollNext(),[i]),c=E.useCallback(d=>{a(!(d!=null&&d.canScrollPrev())),s(!(d!=null&&d.canScrollNext()))},[]);return E.useEffect(()=>{i&&(c(i),i.on("reInit",c),i.on("select",c))},[i,c]),y.jsxs("div",{className:"bpMessageBlocksCarouselContainer","data-container":"carousel",ref:t,children:[y.jsx("div",{className:"bpMessageBlocksCarouselSlidesContainer",children:e.map((d,p)=>y.jsx(wc,{...d,ctx:n},p))}),e.length>1&&y.jsxs(y.Fragment,{children:[y.jsx(kg,{className:"bpMessageBlocksCarouselBackButton","data-disabled":r?"":void 0,onClick:l}),y.jsx(wg,{className:"bpMessageBlocksCarouselNextButton","data-disabled":o?"":void 0,onClick:f})]})]})},d0=({text:e,options:n,groupId:t,ctx:i})=>y.jsxs("div",{className:"bpMessageBlocksColumn",children:[y.jsx(Yi,{text:e,ctx:i}),i.footer,y.jsx(kc,{actions:n.map(r=>({label:r.label,value:r.value,variant:"action"})),groupId:t,sendMessage:i.sendMessage,isReadOnly:i.isReadOnly})]}),u0={"composer.placeholder":"Écrivez votre message...","composer.sendButton.ariaLabel":"Bouton Envoyer le message","composer.voiceButton.ariaLabel":"Bouton Saisie vocale","composer.fileButton.ariaLabel":"Bouton Téléverser un fichier","composer.messageInput.ariaLabel":"Saisie du message","fileAttachment.uploadError":"Erreur de téléversement","fileAttachment.fallbackExtension":"Fichier","fileAttachment.removeButton.ariaLabel":"Bouton Supprimer le fichier","header.defaultBotName":"Bot","header.expandButton.ariaLabel":"Bouton Développer l'en-tête","header.sound.enable":"Activer les sons du chat","header.sound.disable":"Désactiver les sons du chat","conversationHistory.title":"Conversations","conversationHistory.empty":"Aucune conversation commencée","conversationHistory.newConversation":"Nouvelle conversation","conversationHistory.sentAttachment":"A envoyé une pièce jointe","conversationHistory.showButton.ariaLabel":"Bouton Afficher les conversations récentes","restartConversation.title":"Créer une nouvelle conversation","restartConversation.description":"Cela effacera la conversation en cours et en démarrera une nouvelle.","restartConversation.confirm":"Nouvelle conversation","restartConversation.cancel":"Annuler","restartConversation.button.ariaLabel":"Bouton Redémarrer la conversation","closeButton.ariaLabel":"Bouton Fermer le chatbot","feedback.title":"Aidez-nous à nous améliorer","feedback.description":"Veuillez nous faire part de vos commentaires pour nous aider à nous améliorer.","feedback.confirm":"Envoyer le commentaire","feedback.cancel":"Annuler","feedback.placeholder":"Dites-nous ce qui n'a pas fonctionné...","error.configuration":"Erreur de configuration","error.bot":"Erreur du bot","error.network":"Erreur réseau","error.disconnected":"Déconnecté","error.unexpected":"Erreur inattendue","dropdown.placeholder":"Sélectionner...","message.status.delivered":"Distribué","date.today":"Aujourd'hui","date.yesterday":"Hier","composer.emojiButton.ariaLabel":"Bouton sélecteur d'émojis","header.menu.ariaLabel":"Plus d'options","header.expand":"Agrandir la fenêtre","header.collapse":"Réduire la fenêtre","header.mute":"Couper le son","header.unmute":"Activer le son","hitl.passedToTeam":"Transmis à l’équipe support","hitl.findingAgent":"Recherche d’un agent…","hitl.supportAgent":"Agent de support","hitl.defaultAgentName":"Un agent","hitl.agentJoined":"{name} a rejoint la conversation","hitl.agentTransferred":"Transféré à {name}","hitl.agentLabel":"{name} · Support","hitl.ticketClosedBy":"{name} a clôturé le ticket","hitl.ticketClosed":"Ticket clôturé","hitl.waiting.title":"En attente d’un agent…","hitl.waiting.sub":"Généralement quelques minutes. Les réponses arrivent ici.","hitl.waiting.longTitle":"Toujours en attente — plus long que d’habitude","hitl.waiting.longSub":"Vous pouvez fermer cette fenêtre — la réponse arrivera ici.","csat.question":"Comment s’est passé l’échange avec {name} ?","csat.questionGeneric":"Comment ça s’est passé ?","csat.sub":"Un seul clic — optionnel. Vous pouvez continuer à écrire.","csat.rate":"Évaluer cette conversation","csat.commentPlaceholder":"Ajouter un commentaire — optionnel","csat.sendComment":"Envoyer le commentaire","csat.thanks":"Merci — transmis à l’équipe"},p0={"composer.placeholder":"Escribe tu mensaje...","composer.sendButton.ariaLabel":"Botón Enviar mensaje","composer.voiceButton.ariaLabel":"Botón Entrada de voz","composer.fileButton.ariaLabel":"Botón Subir archivo","composer.messageInput.ariaLabel":"Entrada de mensaje","fileAttachment.uploadError":"Error de carga","fileAttachment.fallbackExtension":"Archivo","fileAttachment.removeButton.ariaLabel":"Botón Eliminar archivo","header.defaultBotName":"Bot","header.expandButton.ariaLabel":"Botón Expandir encabezado","header.sound.enable":"Activar sonidos del chat","header.sound.disable":"Desactivar sonidos del chat","conversationHistory.title":"Conversaciones","conversationHistory.empty":"Aún no se ha iniciado ninguna conversación","conversationHistory.newConversation":"Nueva conversación","conversationHistory.sentAttachment":"Envió un archivo adjunto","conversationHistory.showButton.ariaLabel":"Botón Mostrar conversaciones recientes","restartConversation.title":"Crear nueva conversación","restartConversation.description":"Esto borrará la conversación actual y comenzará una nueva.","restartConversation.confirm":"Nueva conversación","restartConversation.cancel":"Cancelar","restartConversation.button.ariaLabel":"Botón Reiniciar conversación","closeButton.ariaLabel":"Botón Cerrar chatbot","feedback.title":"Ayúdanos a mejorar","feedback.description":"Por favor, envíanos tus comentarios para ayudarnos a mejorar.","feedback.confirm":"Enviar comentario","feedback.cancel":"Cancelar","feedback.placeholder":"Cuéntanos qué salió mal...","error.configuration":"Error de configuración","error.bot":"Error del bot","error.network":"Error de red","error.disconnected":"Desconectado","error.unexpected":"Error inesperado","dropdown.placeholder":"Seleccionar...","message.status.delivered":"Entregado","date.today":"Hoy","date.yesterday":"Ayer","composer.emojiButton.ariaLabel":"Botón selector de emojis","header.menu.ariaLabel":"Más opciones","header.expand":"Ampliar ventana","header.collapse":"Contraer ventana","header.mute":"Silenciar","header.unmute":"Activar sonido","hitl.passedToTeam":"Transferido al equipo de soporte","hitl.findingAgent":"Buscando un agente…","hitl.supportAgent":"Agente de soporte","hitl.defaultAgentName":"Un agente","hitl.agentJoined":"{name} se unió a la conversación","hitl.agentTransferred":"Transferido a {name}","hitl.agentLabel":"{name} · Soporte","hitl.ticketClosedBy":"{name} cerró el ticket","hitl.ticketClosed":"Ticket cerrado","hitl.waiting.title":"Esperando un agente…","hitl.waiting.sub":"Normalmente unos minutos. Las respuestas llegan aquí.","hitl.waiting.longTitle":"Aún esperando — está tardando más de lo habitual","hitl.waiting.longSub":"Puedes cerrar esta ventana — la respuesta llegará aquí.","csat.question":"¿Qué tal lo hizo {name}?","csat.questionGeneric":"¿Qué tal lo hicimos?","csat.sub":"Un toque — opcional. Puedes seguir escribiendo abajo.","csat.rate":"Valora este chat","csat.commentPlaceholder":"Añade un comentario — opcional","csat.sendComment":"Enviar comentario","csat.thanks":"Gracias — enviado al equipo"},m0={"composer.placeholder":"Digite sua mensagem...","composer.sendButton.ariaLabel":"Botão Enviar mensagem","composer.voiceButton.ariaLabel":"Botão Entrada de voz","composer.fileButton.ariaLabel":"Botão Enviar arquivo","composer.messageInput.ariaLabel":"Entrada de mensagem","fileAttachment.uploadError":"Erro no envio","fileAttachment.fallbackExtension":"Arquivo","fileAttachment.removeButton.ariaLabel":"Botão Remover arquivo","header.defaultBotName":"Bot","header.expandButton.ariaLabel":"Botão Expandir cabeçalho","header.sound.enable":"Ativar sons do chat","header.sound.disable":"Desativar sons do chat","conversationHistory.title":"Conversas","conversationHistory.empty":"Nenhuma conversa iniciada ainda","conversationHistory.newConversation":"Nova conversa","conversationHistory.sentAttachment":"Enviou um anexo","conversationHistory.showButton.ariaLabel":"Botão Mostrar conversas recentes","restartConversation.title":"Criar nova conversa","restartConversation.description":"Isso apagará a conversa atual e iniciará uma nova.","restartConversation.confirm":"Nova conversa","restartConversation.cancel":"Cancelar","restartConversation.button.ariaLabel":"Botão Reiniciar conversa","closeButton.ariaLabel":"Botão Fechar chatbot","feedback.title":"Ajude-nos a melhorar","feedback.description":"Por favor, envie seu feedback para nos ajudar a melhorar.","feedback.confirm":"Enviar feedback","feedback.cancel":"Cancelar","feedback.placeholder":"Conte-nos o que deu errado...","error.configuration":"Erro de configuração","error.bot":"Erro do bot","error.network":"Erro de rede","error.disconnected":"Desconectado","error.unexpected":"Erro inesperado","dropdown.placeholder":"Selecionar...","message.status.delivered":"Entregue","date.today":"Hoje","date.yesterday":"Ontem","composer.emojiButton.ariaLabel":"Botão seletor de emojis","header.menu.ariaLabel":"Mais opções","header.expand":"Expandir janela","header.collapse":"Recolher janela","header.mute":"Silenciar","header.unmute":"Ativar som","hitl.passedToTeam":"Encaminhado para a equipe de suporte","hitl.findingAgent":"Procurando um agente…","hitl.supportAgent":"Agente de suporte","hitl.defaultAgentName":"Um agente","hitl.agentJoined":"{name} entrou na conversa","hitl.agentTransferred":"Transferido para {name}","hitl.agentLabel":"{name} · Suporte","hitl.ticketClosedBy":"{name} encerrou o ticket","hitl.ticketClosed":"Ticket encerrado","hitl.waiting.title":"Aguardando um agente…","hitl.waiting.sub":"Geralmente alguns minutos. As respostas chegam aqui.","hitl.waiting.longTitle":"Ainda aguardando — está demorando mais que o normal","hitl.waiting.longSub":"Você pode fechar esta janela — a resposta chegará aqui.","csat.question":"Como foi o atendimento de {name}?","csat.questionGeneric":"Como foi o atendimento?","csat.sub":"Um toque — opcional. Você pode continuar digitando abaixo.","csat.rate":"Avalie esta conversa","csat.commentPlaceholder":"Adicionar um comentário — opcional","csat.sendComment":"Enviar comentário","csat.thanks":"Obrigado — enviado para a equipe"},h0={"composer.placeholder":"Nachricht eingeben...","composer.sendButton.ariaLabel":"Schaltfläche Nachricht senden","composer.voiceButton.ariaLabel":"Schaltfläche Spracheingabe","composer.fileButton.ariaLabel":"Schaltfläche Datei hochladen","composer.messageInput.ariaLabel":"Nachrichteneingabe","fileAttachment.uploadError":"Fehler beim Hochladen","fileAttachment.fallbackExtension":"Datei","fileAttachment.removeButton.ariaLabel":"Schaltfläche Datei entfernen","header.defaultBotName":"Bot","header.expandButton.ariaLabel":"Schaltfläche Kopfzeile erweitern","header.sound.enable":"Chat-Töne aktivieren","header.sound.disable":"Chat-Töne deaktivieren","conversationHistory.title":"Unterhaltungen","conversationHistory.empty":"Noch keine Unterhaltung begonnen","conversationHistory.newConversation":"Neue Unterhaltung","conversationHistory.sentAttachment":"Anhang gesendet","conversationHistory.showButton.ariaLabel":"Schaltfläche Letzte Unterhaltungen anzeigen","restartConversation.title":"Neue Unterhaltung erstellen","restartConversation.description":"Dies löscht die aktuelle Unterhaltung und startet eine neue.","restartConversation.confirm":"Neue Unterhaltung","restartConversation.cancel":"Abbrechen","restartConversation.button.ariaLabel":"Schaltfläche Unterhaltung neu starten","closeButton.ariaLabel":"Schaltfläche Chatbot schließen","feedback.title":"Helfen Sie uns, besser zu werden","feedback.description":"Bitte geben Sie uns Feedback, damit wir uns verbessern können.","feedback.confirm":"Feedback senden","feedback.cancel":"Abbrechen","feedback.placeholder":"Sagen Sie uns, was schiefgelaufen ist...","error.configuration":"Konfigurationsfehler","error.bot":"Bot-Fehler","error.network":"Netzwerkfehler","error.disconnected":"Getrennt","error.unexpected":"Unerwarteter Fehler","dropdown.placeholder":"Auswählen...","message.status.delivered":"Zugestellt","date.today":"Heute","date.yesterday":"Gestern","composer.emojiButton.ariaLabel":"Emoji-Auswahl-Schaltfläche","header.menu.ariaLabel":"Weitere Optionen","header.expand":"Fenster vergrößern","header.collapse":"Fenster verkleinern","header.mute":"Stummschalten","header.unmute":"Stummschaltung aufheben","hitl.passedToTeam":"An das Support-Team übergeben","hitl.findingAgent":"Wir suchen einen Agenten…","hitl.supportAgent":"Support-Agent","hitl.defaultAgentName":"Ein Agent","hitl.agentJoined":"{name} ist dem Gespräch beigetreten","hitl.agentTransferred":"An {name} übergeben","hitl.agentLabel":"{name} · Support","hitl.ticketClosedBy":"{name} hat das Ticket geschlossen","hitl.ticketClosed":"Ticket geschlossen","hitl.waiting.title":"Warten auf einen Agenten…","hitl.waiting.sub":"Meist nur wenige Minuten. Antworten erscheinen hier.","hitl.waiting.longTitle":"Immer noch am Warten — dauert länger als üblich","hitl.waiting.longSub":"Sie können dieses Fenster schließen — die Antwort erscheint hier.","csat.question":"Wie war {name}?","csat.questionGeneric":"Wie waren wir?","csat.sub":"Ein Klick — optional. Sie können unten weiterschreiben.","csat.rate":"Chat bewerten","csat.commentPlaceholder":"Kommentar hinzufügen — optional","csat.sendComment":"Kommentar senden","csat.thanks":"Danke — an das Team gesendet"},g0={"composer.placeholder":"Scrivi il tuo messaggio...","composer.sendButton.ariaLabel":"Pulsante Invia messaggio","composer.voiceButton.ariaLabel":"Pulsante Inserimento vocale","composer.fileButton.ariaLabel":"Pulsante Carica file","composer.messageInput.ariaLabel":"Campo di inserimento messaggio","fileAttachment.uploadError":"Errore di caricamento","fileAttachment.fallbackExtension":"File","fileAttachment.removeButton.ariaLabel":"Pulsante Rimuovi file","header.defaultBotName":"Bot","header.expandButton.ariaLabel":"Pulsante Espandi intestazione","header.sound.enable":"Attiva suoni della chat","header.sound.disable":"Disattiva suoni della chat","conversationHistory.title":"Conversazioni","conversationHistory.empty":"Nessuna conversazione avviata","conversationHistory.newConversation":"Nuova conversazione","conversationHistory.sentAttachment":"Ha inviato un allegato","conversationHistory.showButton.ariaLabel":"Pulsante Mostra conversazioni recenti","restartConversation.title":"Crea nuova conversazione","restartConversation.description":"Questo cancellerà la conversazione corrente e ne avvierà una nuova.","restartConversation.confirm":"Nuova conversazione","restartConversation.cancel":"Annulla","restartConversation.button.ariaLabel":"Pulsante Riavvia conversazione","closeButton.ariaLabel":"Pulsante Chiudi chatbot","feedback.title":"Aiutaci a migliorare","feedback.description":"Inviaci il tuo feedback per aiutarci a migliorare.","feedback.confirm":"Invia feedback","feedback.cancel":"Annulla","feedback.placeholder":"Dicci cosa non ha funzionato...","error.configuration":"Errore di configurazione","error.bot":"Errore del bot","error.network":"Errore di rete","error.disconnected":"Disconnesso","error.unexpected":"Errore imprevisto","dropdown.placeholder":"Seleziona...","message.status.delivered":"Consegnato","date.today":"Oggi","date.yesterday":"Ieri","composer.emojiButton.ariaLabel":"Pulsante selettore emoji","header.menu.ariaLabel":"Altre opzioni","header.expand":"Espandi finestra","header.collapse":"Comprimi finestra","header.mute":"Disattiva audio","header.unmute":"Riattiva audio","hitl.passedToTeam":"Inoltrato al team di supporto","hitl.findingAgent":"Stiamo cercando un agente…","hitl.supportAgent":"Agente di supporto","hitl.defaultAgentName":"Un agente","hitl.agentJoined":"{name} si è unito alla conversazione","hitl.agentTransferred":"Trasferito a {name}","hitl.agentLabel":"{name} · Supporto","hitl.ticketClosedBy":"{name} ha chiuso il ticket","hitl.ticketClosed":"Ticket chiuso","hitl.waiting.title":"In attesa di un agente…","hitl.waiting.sub":"Di solito pochi minuti. Le risposte arrivano qui.","hitl.waiting.longTitle":"Ancora in attesa — ci sta volendo più del solito","hitl.waiting.longSub":"Puoi chiudere questa finestra — la risposta arriverà qui.","csat.question":"Com’è andata con {name}?","csat.questionGeneric":"Com’è andata?","csat.sub":"Un tocco — facoltativo. Puoi continuare a scrivere qui sotto.","csat.rate":"Valuta questa chat","csat.commentPlaceholder":"Aggiungi un commento — facoltativo","csat.sendComment":"Invia commento","csat.thanks":"Grazie — inviato al team"},v0={"composer.placeholder":"メッセージを入力...","composer.sendButton.ariaLabel":"メッセージ送信ボタン","composer.voiceButton.ariaLabel":"音声入力ボタン","composer.fileButton.ariaLabel":"ファイルアップロードボタン","composer.messageInput.ariaLabel":"メッセージ入力","fileAttachment.uploadError":"アップロードエラー","fileAttachment.fallbackExtension":"ファイル","fileAttachment.removeButton.ariaLabel":"ファイル削除ボタン","header.defaultBotName":"ボット","header.expandButton.ariaLabel":"ヘッダー展開ボタン","header.sound.enable":"チャット音を有効にする","header.sound.disable":"チャット音を無効にする","conversationHistory.title":"会話履歴","conversationHistory.empty":"まだ会話がありません","conversationHistory.newConversation":"新しい会話","conversationHistory.sentAttachment":"添付ファイルを送信しました","conversationHistory.showButton.ariaLabel":"最近の会話を表示ボタン","restartConversation.title":"新しい会話を作成","restartConversation.description":"現在の会話を消去し、新しい会話を開始します。","restartConversation.confirm":"新しい会話","restartConversation.cancel":"キャンセル","restartConversation.button.ariaLabel":"会話を再開ボタン","closeButton.ariaLabel":"チャットボットを閉じるボタン","feedback.title":"改善にご協力ください","feedback.description":"サービス向上のため、フィードバックをお寄せください。","feedback.confirm":"フィードバックを送信","feedback.cancel":"キャンセル","feedback.placeholder":"問題点をお知らせください...","error.configuration":"設定エラー","error.bot":"ボットエラー","error.network":"ネットワークエラー","error.disconnected":"切断されました","error.unexpected":"予期しないエラー","dropdown.placeholder":"選択...","message.status.delivered":"配信済み","date.today":"今日","date.yesterday":"昨日","composer.emojiButton.ariaLabel":"絵文字選択ボタン","header.menu.ariaLabel":"その他のオプション","header.expand":"ウィンドウを拡大","header.collapse":"ウィンドウを縮小","header.mute":"ミュート","header.unmute":"ミュート解除","hitl.passedToTeam":"サポートチームに引き継ぎました","hitl.findingAgent":"担当者をお探ししています…","hitl.supportAgent":"サポート担当者","hitl.defaultAgentName":"担当者","hitl.agentJoined":"{name}さんが会話に参加しました","hitl.agentTransferred":"{name}さんに引き継がれました","hitl.agentLabel":"{name} · サポート","hitl.ticketClosedBy":"{name}さんがチケットをクローズしました","hitl.ticketClosed":"チケットがクローズされました","hitl.waiting.title":"担当者をお待ちください…","hitl.waiting.sub":"通常は数分です。返信はここに届きます。","hitl.waiting.longTitle":"お待たせしています — 通常より時間がかかっています","hitl.waiting.longSub":"このウィンドウを閉じても、返信はここに届きます。","csat.question":"{name}さんの対応はいかがでしたか?","csat.questionGeneric":"対応はいかがでしたか?","csat.sub":"ワンタップ — 任意です。続けて入力できます。","csat.rate":"このチャットを評価","csat.commentPlaceholder":"コメントを追加 — 任意","csat.sendComment":"コメントを送信","csat.thanks":"ありがとうございます — チームに送信しました"},b0={"composer.placeholder":"메시지를 입력하세요...","composer.sendButton.ariaLabel":"메시지 보내기 버튼","composer.voiceButton.ariaLabel":"음성 입력 버튼","composer.fileButton.ariaLabel":"파일 업로드 버튼","composer.messageInput.ariaLabel":"메시지 입력","fileAttachment.uploadError":"업로드 오류","fileAttachment.fallbackExtension":"파일","fileAttachment.removeButton.ariaLabel":"파일 삭제 버튼","header.defaultBotName":"봇","header.expandButton.ariaLabel":"헤더 펼치기 버튼","header.sound.enable":"채팅 소리 켜기","header.sound.disable":"채팅 소리 끄기","conversationHistory.title":"대화 목록","conversationHistory.empty":"아직 시작된 대화가 없습니다","conversationHistory.newConversation":"새 대화","conversationHistory.sentAttachment":"첨부 파일을 보냈습니다","conversationHistory.showButton.ariaLabel":"최근 대화 보기 버튼","restartConversation.title":"새 대화 만들기","restartConversation.description":"현재 대화를 지우고 새 대화를 시작합니다.","restartConversation.confirm":"새 대화","restartConversation.cancel":"취소","restartConversation.button.ariaLabel":"대화 다시 시작 버튼","closeButton.ariaLabel":"챗봇 닫기 버튼","feedback.title":"개선에 도움을 주세요","feedback.description":"서비스 개선을 위해 피드백을 보내주세요.","feedback.confirm":"피드백 보내기","feedback.cancel":"취소","feedback.placeholder":"어떤 점이 문제였는지 알려주세요...","error.configuration":"설정 오류","error.bot":"봇 오류","error.network":"네트워크 오류","error.disconnected":"연결 끊김","error.unexpected":"예기치 않은 오류","dropdown.placeholder":"선택...","message.status.delivered":"전달됨","date.today":"오늘","date.yesterday":"어제","composer.emojiButton.ariaLabel":"이모지 선택 버튼","header.menu.ariaLabel":"추가 옵션","header.expand":"창 확대","header.collapse":"창 축소","header.mute":"음소거","header.unmute":"음소거 해제","hitl.passedToTeam":"지원팀에 전달되었습니다","hitl.findingAgent":"상담원을 찾는 중…","hitl.supportAgent":"지원 상담원","hitl.defaultAgentName":"상담원","hitl.agentJoined":"{name}님이 대화에 참여했습니다","hitl.agentTransferred":"{name}님에게 이관되었습니다","hitl.agentLabel":"{name} · 지원팀","hitl.ticketClosedBy":"{name}님이 티켓을 종료했습니다","hitl.ticketClosed":"티켓이 종료되었습니다","hitl.waiting.title":"상담원을 기다리는 중…","hitl.waiting.sub":"보통 몇 분 정도 걸립니다. 답변은 여기에 도착합니다.","hitl.waiting.longTitle":"아직 기다리는 중 — 평소보다 오래 걸리고 있어요","hitl.waiting.longSub":"이 창을 닫아도 답변은 여기에 도착합니다.","csat.question":"{name}님의 응대는 어땠나요?","csat.questionGeneric":"응대는 어땠나요?","csat.sub":"한 번의 탭 — 선택 사항입니다. 계속 입력하셔도 됩니다.","csat.rate":"이 채팅 평가하기","csat.commentPlaceholder":"의견 추가 — 선택 사항","csat.sendComment":"의견 보내기","csat.thanks":"감사합니다 — 팀에 전달되었습니다"},y0={"composer.placeholder":"اكتب رسالتك...","composer.sendButton.ariaLabel":"زر إرسال الرسالة","composer.voiceButton.ariaLabel":"زر الإدخال الصوتي","composer.fileButton.ariaLabel":"زر رفع ملف","composer.messageInput.ariaLabel":"إدخال الرسالة","fileAttachment.uploadError":"خطأ في الرفع","fileAttachment.fallbackExtension":"ملف","fileAttachment.removeButton.ariaLabel":"زر إزالة الملف","header.defaultBotName":"بوت","header.expandButton.ariaLabel":"زر توسيع الرأس","header.sound.enable":"تفعيل أصوات المحادثة","header.sound.disable":"تعطيل أصوات المحادثة","conversationHistory.title":"المحادثات","conversationHistory.empty":"لم تبدأ أي محادثة بعد","conversationHistory.newConversation":"محادثة جديدة","conversationHistory.sentAttachment":"أرسل مرفقاً","conversationHistory.showButton.ariaLabel":"زر عرض المحادثات الأخيرة","restartConversation.title":"إنشاء محادثة جديدة","restartConversation.description":"سيؤدي هذا إلى مسح المحادثة الحالية وبدء محادثة جديدة.","restartConversation.confirm":"محادثة جديدة","restartConversation.cancel":"إلغاء","restartConversation.button.ariaLabel":"زر إعادة بدء المحادثة","closeButton.ariaLabel":"زر إغلاق الشات بوت","feedback.title":"ساعدنا على التحسين","feedback.description":"يرجى تقديم ملاحظاتك لمساعدتنا على التحسين.","feedback.confirm":"إرسال الملاحظات","feedback.cancel":"إلغاء","feedback.placeholder":"أخبرنا ما الخطأ الذي حدث...","error.configuration":"خطأ في الإعدادات","error.bot":"خطأ في البوت","error.network":"خطأ في الشبكة","error.disconnected":"غير متصل","error.unexpected":"خطأ غير متوقع","dropdown.placeholder":"اختر...","message.status.delivered":"تم التسليم","date.today":"اليوم","date.yesterday":"أمس","composer.emojiButton.ariaLabel":"زر منتقي الرموز التعبيرية","header.menu.ariaLabel":"خيارات إضافية","header.expand":"توسيع النافذة","header.collapse":"تصغير النافذة","header.mute":"كتم الصوت","header.unmute":"إلغاء كتم الصوت","hitl.passedToTeam":"تم التحويل إلى فريق الدعم","hitl.findingAgent":"نبحث لك عن موظف دعم…","hitl.supportAgent":"موظف دعم","hitl.defaultAgentName":"موظف دعم","hitl.agentJoined":"انضم {name} إلى المحادثة","hitl.agentTransferred":"تم التحويل إلى {name}","hitl.agentLabel":"{name} · الدعم","hitl.ticketClosedBy":"أغلق {name} التذكرة","hitl.ticketClosed":"تم إغلاق التذكرة","hitl.waiting.title":"في انتظار موظف دعم…","hitl.waiting.sub":"عادةً بضع دقائق. ستصل الردود هنا.","hitl.waiting.longTitle":"ما زلنا في الانتظار — يستغرق الأمر وقتًا أطول من المعتاد","hitl.waiting.longSub":"يمكنك إغلاق هذه النافذة — سيصلك الرد هنا.","csat.question":"كيف كان أداء {name}؟","csat.questionGeneric":"كيف كان أداؤنا؟","csat.sub":"نقرة واحدة — اختياري. يمكنك متابعة الكتابة أدناه.","csat.rate":"قيّم هذه المحادثة","csat.commentPlaceholder":"أضف تعليقًا — اختياري","csat.sendComment":"إرسال التعليق","csat.thanks":"شكرًا — أُرسل إلى الفريق"},Mc={"composer.placeholder":"Type your message...","composer.sendButton.ariaLabel":"Send Message Button","composer.voiceButton.ariaLabel":"Voice Input Button","composer.fileButton.ariaLabel":"Upload File Button","composer.messageInput.ariaLabel":"Message Input","composer.emojiButton.ariaLabel":"Emoji Picker Button","fileAttachment.uploadError":"Upload Error","fileAttachment.fallbackExtension":"File","fileAttachment.removeButton.ariaLabel":"Remove File Button","header.defaultBotName":"Bot","header.expandButton.ariaLabel":"Expand Header Button","header.sound.enable":"Enable chat sounds","header.sound.disable":"Disable chat sounds","header.menu.ariaLabel":"More options","header.expand":"Expand window","header.collapse":"Collapse window","header.mute":"Mute","header.unmute":"Unmute","conversationHistory.title":"Conversations","conversationHistory.empty":"No conversation started yet","conversationHistory.newConversation":"New conversation","conversationHistory.sentAttachment":"Sent an attachment","conversationHistory.showButton.ariaLabel":"Show Recent Conversations Button","restartConversation.title":"Create New Conversation","restartConversation.description":"This will clear the current conversation and start a new one.","restartConversation.confirm":"New conversation","restartConversation.cancel":"Cancel","restartConversation.button.ariaLabel":"Restart Conversation Button","closeButton.ariaLabel":"Close Chatbot Button","feedback.title":"Help us improve","feedback.description":"Please provide feedback to help us improve.","feedback.confirm":"Send feedback","feedback.cancel":"Cancel","feedback.placeholder":"Let us know what went wrong...","error.configuration":"Configuration error","error.bot":"Bot error","error.network":"Network error","error.disconnected":"Disconnected","error.unexpected":"Unexpected error","dropdown.placeholder":"Select...","message.status.delivered":"Delivered","date.today":"Today","date.yesterday":"Yesterday","hitl.passedToTeam":"Passed to the support team","hitl.findingAgent":"Finding you an agent…","hitl.supportAgent":"Support agent","hitl.defaultAgentName":"An agent","hitl.agentJoined":"{name} joined the conversation","hitl.agentTransferred":"Transferred to {name}","hitl.agentLabel":"{name} · Support","hitl.ticketClosedBy":"{name} closed the ticket","hitl.ticketClosed":"Ticket closed","hitl.waiting.title":"Waiting for an agent…","hitl.waiting.sub":"Usually a few minutes. Replies arrive here.","hitl.waiting.longTitle":"Still waiting — this is taking longer than usual","hitl.waiting.longSub":"You can close this window — the reply will land right here.","csat.question":"How did {name} do?","csat.questionGeneric":"How did we do?","csat.sub":"One tap — optional. You can keep typing below.","csat.rate":"Rate this chat","csat.commentPlaceholder":"Add a comment — optional","csat.sendComment":"Send comment","csat.thanks":"Thanks — sent to the team"},OF={fr:u0,es:p0,pt:m0,de:h0,it:g0,ja:v0,ko:b0,ar:y0};function k0(e){const t=(((e==null?void 0:e.trim())||(typeof navigator<"u"?navigator.language:"en")).split("-")[0]??"en").toLowerCase();return OF[t]??Mc}function w0(e,n){const t=k0(e);return n&&Object.keys(n).length?{...t,...n}:t}const _0=E.createContext(Mc),DF=_0.Provider;function un(){return E.useContext(_0)}const x0=({text:e,options:n,reusable:t,ctx:i})=>{const{sendMessage:r,isReadOnly:a}=i,o=un(),s=rt(j=>j.messageContainerRef),l=rt(j=>j.portalContainer),[f,c]=A.useState(!1),[d,p]=A.useState(null),[u,m]=A.useState(null),h=n.map(j=>j.label),g=Object.fromEntries(n.map(j=>[j.label,j.value])),v=j=>{c(u!==null&&!t?!1:j)},{refs:b,floatingStyles:k,context:w}=Xf({placement:"bottom-start",open:f,onOpenChange:v,whileElementsMounted:Of,middleware:[Nf(5),Lf({padding:10,boundary:(s==null?void 0:s.current)??void 0,crossAxis:!0}),zf({apply({rects:j,elements:N,availableHeight:V}){Object.assign(N.floating.style,{maxHeight:`min(200px, ${Math.max(0,V)}px)`,minWidth:`${j.reference.width}px`})},padding:10})]}),x=A.useRef([]),S=A.useRef(h),M=A.useRef(!1),I=Iv(w,{event:"mousedown"}),O=Zf(w),T=ic(w,{role:"listbox"}),P=a8(w,{listRef:x,activeIndex:d,selectedIndex:u,onNavigate:p,loop:!0}),R=o8(w,{listRef:S,activeIndex:d,selectedIndex:u,onMatch:f?p:m,onTypingChange(j){M.current=j}}),{getReferenceProps:z,getFloatingProps:F,getItemProps:D}=nc([O,T,P,R,I]),L=j=>{m(j),h[j]!==void 0&&(r==null||r({type:"text",text:h[j]??"",value:g[h[j]]??""},{})),c(!1)};return y.jsxs(lo,{ctx:i,children:[y.jsxs("div",{className:"bpMessageBlocksColumn",children:[e&&y.jsx(Yi,{text:e,ctx:i,bare:!0}),i.footer,y.jsxs("div",{tabIndex:0,ref:b.setReference,"aria-labelledby":"select-label","aria-autocomplete":"none","data-disabled":u!==null&&!t?"":void 0,style:a?{pointerEvents:"none"}:void 0,className:"bpMessageBlocksDropdownButtonContainer",...z(),children:[y.jsx("span",{className:"bpMessageBlocksDropdownButtonText",children:u!==null?h[u]:o["dropdown.placeholder"]}),y.jsx(hT,{className:"bpMessageBlocksDropdownButtonIcon"})]})]}),f&&y.jsx(Jf,{root:l??void 0,children:y.jsx(QM,{context:w,modal:!1,children:y.jsx("div",{ref:b.setFloating,className:"bpMessageBlocksDropdownContentContainer",style:{...k,pointerEvents:"auto"},...F(),children:h.map((j,N)=>y.jsx("div",{ref:V=>{x.current[N]=V},role:"option",tabIndex:N===d?0:-1,"aria-selected":N===u&&N===d,"data-active":N===d?"":void 0,className:"bpMessageBlocksDropdownContentItem",...D({onClick(){L(N)},onKeyDown(V){V.key==="Enter"&&(V.preventDefault(),L(N)),V.key===" "&&!M.current&&(V.preventDefault(),L(N))}}),children:j},j))})})})]})},S0=({items:e,ctx:n})=>y.jsx("div",{className:"bpMessageBlocksColumn",children:e.map((t,i)=>y.jsx("div",{children:Fc(t,n)},i))});globalThis.React=E;const NF=({url:e,name:n,data:t,...i})=>{const r=N8(f=>f.getCustomComponent),[a,o]=E.useState(null),[s,l]=E.useState(null);return E.useEffect(()=>{r(e).then(o).catch(f=>{l(f.message)})},[e]),s?y.jsx("div",{style:{color:"red"},children:s}):a?y.jsx(a,{...t,...i}):null};function Fc(e,n){switch(e.type){case"text":return y.jsx(Yi,{text:e.text,ctx:n,citationPath:e.citationPath});case"image":return y.jsx(No,{url:e.url,orientation:e.orientation});case"video":return y.jsx(Xv,{url:e.url,isReadOnly:n.isReadOnly});case"audio":return y.jsx(e0,{url:e.url,isReadOnly:n.isReadOnly});case"file":return y.jsx(n0,{url:e.url,title:e.title,isReadOnly:n.isReadOnly});case"location":return y.jsx(t0,{latitude:e.latitude,longitude:e.longitude,title:e.title,isReadOnly:n.isReadOnly});case"card":return y.jsx(wc,{...e,ctx:n});case"carousel":return y.jsx(c0,{cards:e.cards,ctx:n});case"choice":return y.jsx(d0,{...e,ctx:n});case"dropdown":return y.jsx(x0,{...e,ctx:n});case"bloc":return y.jsx(S0,{items:e.items,ctx:n});case"custom":return y.jsx(NF,{url:e.url,name:e.name,data:e.data,...n})}}function C0(e){var n,t,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(n=0;n<r;n++)e[n]&&(t=C0(e[n]))&&(i&&(i+=" "),i+=t)}else for(t in e)e[t]&&(i&&(i+=" "),i+=t);return i}function pi(){for(var e,n,t=0,i="",r=arguments.length;t<r;t++)(e=arguments[t])&&(n=C0(e))&&(i&&(i+=" "),i+=n);return i}const E0=E.createContext({});function Ic(e){const n=E.useRef(null);return n.current===null&&(n.current=e()),n.current}const T0=typeof window<"u"?E.useLayoutEffect:E.useEffect,Bo=E.createContext(null);function LF(e,n){e.indexOf(n)===-1&&e.push(n)}function zF(e,n){const t=e.indexOf(n);t>-1&&e.splice(t,1)}const zt=(e,n,t)=>t>n?n:t<e?e:t;function Pc(e,n){return n?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${n}`:e}let fa=()=>{},mi=()=>{};typeof process<"u"&&((l_=process.env)==null?void 0:l_.NODE_ENV)!=="production"&&(fa=(e,n,t)=>{!e&&typeof console<"u"&&console.warn(Pc(n,t))},mi=(e,n,t)=>{if(!e)throw new Error(Pc(n,t))});const Bt={},A0=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),BF=e=>typeof e=="object"&&e!==null,M0=e=>/^0[^.\s]+$/u.test(e);function F0(e){let n;return()=>(n===void 0&&(n=e()),n)}const Qi=e=>e,$o=(...e)=>e.reduce((n,t)=>i=>t(n(i))),I0=(e,n,t)=>{const i=n-e;return i?(t-e)/i:1};class P0{constructor(){this.subscriptions=[]}add(n){return LF(this.subscriptions,n),()=>zF(this.subscriptions,n)}notify(n,t,i){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](n,t,i);else for(let a=0;a<r;a++){const o=this.subscriptions[a];o&&o(n,t,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Nn=e=>e*1e3,Kn=e=>e/1e3,O0=(e,n)=>n?e*(1e3/n):0,D0=new Set;function N0(e,n,t){e||D0.has(n)||(console.warn(Pc(n,t)),D0.add(n))}const L0=(e,n,t)=>(((1-3*t+3*n)*e+(3*t-6*n))*e+3*n)*e,$F=1e-7,RF=12;function jF(e,n,t,i,r){let a,o,s=0;do o=n+(t-n)/2,a=L0(o,i,r)-e,a>0?t=o:n=o;while(Math.abs(a)>$F&&++s<RF);return o}function ca(e,n,t,i){if(e===n&&t===i)return Qi;const r=a=>jF(a,0,1,e,t);return a=>a===0||a===1?a:L0(r(a),n,i)}const z0=e=>n=>n<=.5?e(2*n)/2:(2-e(2*(1-n)))/2,B0=e=>n=>1-e(1-n),$0=ca(.33,1.53,.69,.99),Oc=B0($0),R0=z0(Oc),j0=e=>e>=1?1:(e*=2)<1?.5*Oc(e):.5*(2-Math.pow(2,-10*(e-1))),Dc=e=>1-Math.sin(Math.acos(e)),HF=B0(Dc),H0=z0(Dc),VF=ca(.42,0,1,1),WF=ca(0,0,.58,1),V0=ca(.42,0,.58,1),qF=e=>Array.isArray(e)&&typeof e[0]!="number",W0=e=>Array.isArray(e)&&typeof e[0]=="number",q0={linear:Qi,easeIn:VF,easeInOut:V0,easeOut:WF,circIn:Dc,circInOut:H0,circOut:HF,backIn:Oc,backInOut:R0,backOut:$0,anticipate:j0},UF=e=>typeof e=="string",U0=e=>{if(W0(e)){mi(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[n,t,i,r]=e;return ca(n,t,i,r)}else if(UF(e))return mi(q0[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),q0[e];return e},Ro=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function GF(e,n){let t=new Set,i=new Set,r=!1,a=!1;const o=new WeakSet;let s={delta:0,timestamp:0,isProcessing:!1};function l(c){o.has(c)&&(f.schedule(c),e()),c(s)}const f={schedule:(c,d=!1,p=!1)=>{const m=p&&r?t:i;return d&&o.add(c),m.add(c),c},cancel:c=>{i.delete(c),o.delete(c)},process:c=>{if(s=c,r){a=!0;return}r=!0;const d=t;t=i,i=d,t.forEach(l),t.clear(),r=!1,a&&(a=!1,f.process(c))}};return f}const KF=40;function G0(e,n){let t=!1,i=!0;const r={delta:0,timestamp:0,isProcessing:!1},a=()=>t=!0,o=Ro.reduce((k,w)=>(k[w]=GF(a),k),{}),{setup:s,read:l,resolveKeyframes:f,preUpdate:c,update:d,preRender:p,render:u,postRender:m}=o,h=()=>{const k=Bt.useManualTiming,w=k?r.timestamp:performance.now();t=!1,k||(r.delta=i?1e3/60:Math.max(Math.min(w-r.timestamp,KF),1)),r.timestamp=w,r.isProcessing=!0,s.process(r),l.process(r),f.process(r),c.process(r),d.process(r),p.process(r),u.process(r),m.process(r),r.isProcessing=!1,t&&n&&(i=!1,e(h))},g=()=>{t=!0,i=!0,r.isProcessing||e(h)};return{schedule:Ro.reduce((k,w)=>{const x=o[w];return k[w]=(S,M=!1,I=!1)=>(t||g(),x.schedule(S,M,I)),k},{}),cancel:k=>{for(let w=0;w<Ro.length;w++)o[Ro[w]].cancel(k)},state:r,steps:o}}const{schedule:Ln,cancel:Nc,state:jo}=G0(typeof requestAnimationFrame<"u"?requestAnimationFrame:Qi,!0);let Ho;function YF(){Ho=void 0}const Mn={now:()=>(Ho===void 0&&Mn.set(jo.isProcessing||Bt.useManualTiming?jo.timestamp:performance.now()),Ho),set:e=>{Ho=e,queueMicrotask(YF)}},K0=e=>n=>typeof n=="string"&&n.startsWith(e),Y0=K0("--"),JF=K0("var(--"),Lc=e=>JF(e)?ZF.test(e.split("/*")[0].trim()):!1,ZF=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function J0(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Xi={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},da={...Xi,transform:e=>zt(0,1,e)},Vo={...Xi,default:1},ua=e=>Math.round(e*1e5)/1e5,zc=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function QF(e){return e==null}const XF=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Bc=(e,n)=>t=>!!(typeof t=="string"&&XF.test(t)&&t.startsWith(e)||n&&!QF(t)&&Object.prototype.hasOwnProperty.call(t,n)),Z0=(e,n,t)=>i=>{if(typeof i!="string")return i;const[r,a,o,s]=i.match(zc);return{[e]:parseFloat(r),[n]:parseFloat(a),[t]:parseFloat(o),alpha:s!==void 0?parseFloat(s):1}},e7=e=>zt(0,255,e),$c={...Xi,transform:e=>Math.round(e7(e))},hi={test:Bc("rgb","red"),parse:Z0("red","green","blue"),transform:({red:e,green:n,blue:t,alpha:i=1})=>"rgba("+$c.transform(e)+", "+$c.transform(n)+", "+$c.transform(t)+", "+ua(da.transform(i))+")"};function n7(e){let n="",t="",i="",r="";return e.length>5?(n=e.substring(1,3),t=e.substring(3,5),i=e.substring(5,7),r=e.substring(7,9)):(n=e.substring(1,2),t=e.substring(2,3),i=e.substring(3,4),r=e.substring(4,5),n+=n,t+=t,i+=i,r+=r),{red:parseInt(n,16),green:parseInt(t,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const Rc={test:Bc("#"),parse:n7,transform:hi.transform},pa=e=>({test:n=>typeof n=="string"&&n.endsWith(e)&&n.split(" ").length===1,parse:parseFloat,transform:n=>`${n}${e}`}),yt=pa("deg"),er=pa("%"),ce=pa("px"),t7=pa("vh"),i7=pa("vw"),Q0={...er,parse:e=>er.parse(e)/100,transform:e=>er.transform(e*100)},nr={test:Bc("hsl","hue"),parse:Z0("hue","saturation","lightness"),transform:({hue:e,saturation:n,lightness:t,alpha:i=1})=>"hsla("+Math.round(e)+", "+er.transform(ua(n))+", "+er.transform(ua(t))+", "+ua(da.transform(i))+")"},Qe={test:e=>hi.test(e)||Rc.test(e)||nr.test(e),parse:e=>hi.test(e)?hi.parse(e):nr.test(e)?nr.parse(e):Rc.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?hi.transform(e):nr.transform(e),getAnimatableNone:e=>{const n=Qe.parse(e);return n.alpha=0,Qe.transform(n)}},r7=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function a7(e){var n,t;return isNaN(e)&&typeof e=="string"&&(((n=e.match(zc))==null?void 0:n.length)||0)+(((t=e.match(r7))==null?void 0:t.length)||0)>0}const X0="number",eb="color",o7="var",s7="var(",nb="${}",l7=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function tr(e){const n=e.toString(),t=[],i={color:[],number:[],var:[]},r=[];let a=0;const s=n.replace(l7,l=>(Qe.test(l)?(i.color.push(a),r.push(eb),t.push(Qe.parse(l))):l.startsWith(s7)?(i.var.push(a),r.push(o7),t.push(l)):(i.number.push(a),r.push(X0),t.push(parseFloat(l))),++a,nb)).split(nb);return{values:t,split:s,indexes:i,types:r}}function f7(e){return tr(e).values}function tb({split:e,types:n}){const t=e.length;return i=>{let r="";for(let a=0;a<t;a++)if(r+=e[a],i[a]!==void 0){const o=n[a];o===X0?r+=ua(i[a]):o===eb?r+=Qe.transform(i[a]):r+=i[a]}return r}}function c7(e){return tb(tr(e))}const d7=e=>typeof e=="number"?0:Qe.test(e)?Qe.getAnimatableNone(e):e,u7=(e,n)=>typeof e=="number"?n!=null&&n.trim().endsWith("/")?e:0:d7(e);function p7(e){const n=tr(e);return tb(n)(n.values.map((i,r)=>u7(i,n.split[r])))}const Yn={test:a7,parse:f7,createTransformer:c7,getAnimatableNone:p7};function jc(e,n,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?e+(n-e)*6*t:t<1/2?n:t<2/3?e+(n-e)*(2/3-t)*6:e}function m7({hue:e,saturation:n,lightness:t,alpha:i}){e/=360,n/=100,t/=100;let r=0,a=0,o=0;if(!n)r=a=o=t;else{const s=t<.5?t*(1+n):t+n-t*n,l=2*t-s;r=jc(l,s,e+1/3),a=jc(l,s,e),o=jc(l,s,e-1/3)}return{red:Math.round(r*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:i}}function Wo(e,n){return t=>t>0?n:e}const ma=(e,n,t)=>e+(n-e)*t,Hc=(e,n,t)=>{const i=e*e,r=t*(n*n-i)+i;return r<0?0:Math.sqrt(r)},h7=[Rc,hi,nr],g7=e=>h7.find(n=>n.test(e));function ib(e){const n=g7(e);if(fa(!!n,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!n)return!1;let t=n.parse(e);return n===nr&&(t=m7(t)),t}const rb=(e,n)=>{const t=ib(e),i=ib(n);if(!t||!i)return Wo(e,n);const r={...t};return a=>(r.red=Hc(t.red,i.red,a),r.green=Hc(t.green,i.green,a),r.blue=Hc(t.blue,i.blue,a),r.alpha=ma(t.alpha,i.alpha,a),hi.transform(r))},Vc=new Set(["none","hidden"]);function v7(e,n){return Vc.has(e)?t=>t<=0?e:n:t=>t>=1?n:e}function b7(e,n){return t=>ma(e,n,t)}function Wc(e){return typeof e=="number"?b7:typeof e=="string"?Lc(e)?Wo:Qe.test(e)?rb:w7:Array.isArray(e)?ab:typeof e=="object"?Qe.test(e)?rb:y7:Wo}function ab(e,n){const t=[...e],i=t.length,r=e.map((a,o)=>Wc(a)(a,n[o]));return a=>{for(let o=0;o<i;o++)t[o]=r[o](a);return t}}function y7(e,n){const t={...e,...n},i={};for(const r in t)e[r]!==void 0&&n[r]!==void 0&&(i[r]=Wc(e[r])(e[r],n[r]));return r=>{for(const a in i)t[a]=i[a](r);return t}}function k7(e,n){const t=[],i={color:0,var:0,number:0};for(let r=0;r<n.values.length;r++){const a=n.types[r],o=e.indexes[a][i[a]],s=e.values[o]??0;t[r]=s,i[a]++}return t}const w7=(e,n)=>{const t=Yn.createTransformer(n),i=tr(e),r=tr(n);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?Vc.has(e)&&!r.values.length||Vc.has(n)&&!i.values.length?v7(e,n):$o(ab(k7(i,r),r.values),t):(fa(!0,`Complex values '${e}' and '${n}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),Wo(e,n))};function ob(e,n,t){return typeof e=="number"&&typeof n=="number"&&typeof t=="number"?ma(e,n,t):Wc(e)(e,n)}const _7=e=>{const n=({timestamp:t})=>e(t);return{start:(t=!0)=>Ln.update(n,t),stop:()=>Nc(n),now:()=>jo.isProcessing?jo.timestamp:Mn.now()}},sb=(e,n,t=10)=>{let i="";const r=Math.max(Math.round(n/t),2);for(let a=0;a<r;a++)i+=Math.round(e(a/(r-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},qo=2e4;function qc(e){let n=0;const t=50;let i=e.next(n);for(;!i.done&&n<qo;)n+=t,i=e.next(n);return n>=qo?1/0:n}function x7(e,n=100,t){const i=t({...e,keyframes:[0,n]}),r=Math.min(qc(i),qo);return{type:"keyframes",ease:a=>i.next(r*a).value/n,duration:Kn(r)}}const Ve={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Uc(e,n){return e*Math.sqrt(1-n*n)}const S7=12;function C7(e,n,t){let i=t;for(let r=1;r<S7;r++)i=i-e(i)/n(i);return i}const Gc=.001;function E7({duration:e=Ve.duration,bounce:n=Ve.bounce,velocity:t=Ve.velocity,mass:i=Ve.mass}){let r,a;fa(e<=Nn(Ve.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let o=1-n;o=zt(Ve.minDamping,Ve.maxDamping,o),e=zt(Ve.minDuration,Ve.maxDuration,Kn(e)),o<1?(r=f=>{const c=f*o,d=c*e,p=c-t,u=Uc(f,o),m=Math.exp(-d);return Gc-p/u*m},a=f=>{const d=f*o*e,p=d*t+t,u=Math.pow(o,2)*Math.pow(f,2)*e,m=Math.exp(-d),h=Uc(Math.pow(f,2),o);return(-r(f)+Gc>0?-1:1)*((p-u)*m)/h}):(r=f=>{const c=Math.exp(-f*e),d=(f-t)*e+1;return-Gc+c*d},a=f=>{const c=Math.exp(-f*e),d=(t-f)*(e*e);return c*d});const s=5/e,l=C7(r,a,s);if(e=Nn(e),isNaN(l))return{stiffness:Ve.stiffness,damping:Ve.damping,duration:e};{const f=Math.pow(l,2)*i;return{stiffness:f,damping:o*2*Math.sqrt(i*f),duration:e}}}const T7=["duration","bounce"],A7=["stiffness","damping","mass"];function lb(e,n){return n.some(t=>e[t]!==void 0)}function M7(e){let n={velocity:Ve.velocity,stiffness:Ve.stiffness,damping:Ve.damping,mass:Ve.mass,isResolvedFromDuration:!1,...e};if(!lb(e,A7)&&lb(e,T7))if(n.velocity=0,e.visualDuration){const t=e.visualDuration,i=2*Math.PI/(t*1.2),r=i*i,a=2*zt(.05,1,1-(e.bounce||0))*Math.sqrt(r);n={...n,mass:Ve.mass,stiffness:r,damping:a}}else{const t=E7({...e,velocity:0});n={...n,...t,mass:Ve.mass},n.isResolvedFromDuration=!0}return n}function Uo(e=Ve.visualDuration,n=Ve.bounce){const t=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:n}:e;let{restSpeed:i,restDelta:r}=t;const a=t.keyframes[0],o=t.keyframes[t.keyframes.length-1],s={done:!1,value:a},{stiffness:l,damping:f,mass:c,duration:d,velocity:p,isResolvedFromDuration:u}=M7({...t,velocity:-Kn(t.velocity||0)}),m=p||0,h=f/(2*Math.sqrt(l*c)),g=o-a,v=Kn(Math.sqrt(l/c)),b=Math.abs(g)<5;i||(i=b?Ve.restSpeed.granular:Ve.restSpeed.default),r||(r=b?Ve.restDelta.granular:Ve.restDelta.default);let k,w,x,S,M,I;if(h<1)x=Uc(v,h),S=(m+h*v*g)/x,k=T=>{const P=Math.exp(-h*v*T);return o-P*(S*Math.sin(x*T)+g*Math.cos(x*T))},M=h*v*S+g*x,I=h*v*g-S*x,w=T=>Math.exp(-h*v*T)*(M*Math.sin(x*T)+I*Math.cos(x*T));else if(h===1){k=P=>o-Math.exp(-v*P)*(g+(m+v*g)*P);const T=m+v*g;w=P=>Math.exp(-v*P)*(v*T*P-m)}else{const T=v*Math.sqrt(h*h-1);k=F=>{const D=Math.exp(-h*v*F),L=Math.min(T*F,300);return o-D*((m+h*v*g)*Math.sinh(L)+T*g*Math.cosh(L))/T};const P=(m+h*v*g)/T,R=h*v*P-g*T,z=h*v*g-P*T;w=F=>{const D=Math.exp(-h*v*F),L=Math.min(T*F,300);return D*(R*Math.sinh(L)+z*Math.cosh(L))}}const O={calculatedDuration:u&&d||null,velocity:T=>Nn(w(T)),next:T=>{if(!u&&h<1){const R=Math.exp(-h*v*T),z=Math.sin(x*T),F=Math.cos(x*T),D=o-R*(S*z+g*F),L=Nn(R*(M*z+I*F));return s.done=Math.abs(L)<=i&&Math.abs(o-D)<=r,s.value=s.done?o:D,s}const P=k(T);if(u)s.done=T>=d;else{const R=Nn(w(T));s.done=Math.abs(R)<=i&&Math.abs(o-P)<=r}return s.value=s.done?o:P,s},toString:()=>{const T=Math.min(qc(O),qo),P=sb(R=>O.next(T*R).value,T,30);return T+"ms "+P},toTransition:()=>{}};return O}Uo.applyToOptions=e=>{const n=x7(e,100,Uo);return e.ease=n.ease,e.duration=Nn(n.duration),e.type="keyframes",e};const F7=5;function fb(e,n,t){const i=Math.max(n-F7,0);return O0(t-e(i),n-i)}function Kc({keyframes:e,velocity:n=0,power:t=.8,timeConstant:i=325,bounceDamping:r=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:l,restDelta:f=.5,restSpeed:c}){const d=e[0],p={done:!1,value:d},u=I=>s!==void 0&&I<s||l!==void 0&&I>l,m=I=>s===void 0?l:l===void 0||Math.abs(s-I)<Math.abs(l-I)?s:l;let h=t*n;const g=d+h,v=o===void 0?g:o(g);v!==g&&(h=v-d);const b=I=>-h*Math.exp(-I/i),k=I=>v+b(I),w=I=>{const O=b(I),T=k(I);p.done=Math.abs(O)<=f,p.value=p.done?v:T};let x,S;const M=I=>{u(p.value)&&(x=I,S=Uo({keyframes:[p.value,m(p.value)],velocity:fb(k,I,p.value),damping:r,stiffness:a,restDelta:f,restSpeed:c}))};return M(0),{calculatedDuration:null,next:I=>{let O=!1;return!S&&x===void 0&&(O=!0,w(I),M(I)),x!==void 0&&I>=x?S.next(I-x):(!O&&w(I),p)}}}function I7(e,n,t){const i=[],r=t||Bt.mix||ob,a=e.length-1;for(let o=0;o<a;o++){let s=r(e[o],e[o+1]);if(n){const l=Array.isArray(n)?n[o]||Qi:n;s=$o(l,s)}i.push(s)}return i}function P7(e,n,{clamp:t=!0,ease:i,mixer:r}={}){const a=e.length;if(mi(a===n.length,"Both input and output ranges must be the same length","range-length"),a===1)return()=>n[0];if(a===2&&n[0]===n[1])return()=>n[1];const o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),n=[...n].reverse());const s=I7(n,i,r),l=s.length,f=c=>{if(o&&c<e[0])return n[0];let d=0;if(l>1)for(;d<e.length-2&&!(c<e[d+1]);d++);const p=I0(e[d],e[d+1],c);return s[d](p)};return t?c=>f(zt(e[0],e[a-1],c)):f}function O7(e,n){const t=e[e.length-1];for(let i=1;i<=n;i++){const r=I0(0,n,i);e.push(ma(t,1,r))}}function D7(e){const n=[0];return O7(n,e.length-1),n}function N7(e,n){return e.map(t=>t*n)}function L7(e,n){return e.map(()=>n||V0).splice(0,e.length-1)}function ir({duration:e=300,keyframes:n,times:t,ease:i="easeInOut"}){const r=qF(i)?i.map(U0):U0(i),a={done:!1,value:n[0]},o=N7(t&&t.length===n.length?t:D7(n),e),s=P7(o,n,{ease:Array.isArray(r)?r:L7(n,r)});return{calculatedDuration:e,next:l=>(a.value=s(l),a.done=l>=e,a)}}const z7=e=>e!==null;function Go(e,{repeat:n,repeatType:t="loop"},i,r=1){const a=e.filter(z7),s=r<0||n&&t!=="loop"&&n%2===1?0:a.length-1;return!s||i===void 0?a[s]:i}const B7={decay:Kc,inertia:Kc,tween:ir,keyframes:ir,spring:Uo};function cb(e){typeof e.type=="string"&&(e.type=B7[e.type])}class Yc{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(n=>{this.resolve=n})}notifyFinished(){this.resolve()}then(n,t){return this.finished.then(n,t)}}const $7=e=>e/100;class Ko extends Yc{constructor(n){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var i,r;const{motionValue:t}=this.options;t&&t.updatedAt!==Mn.now()&&this.tick(Mn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(r=(i=this.options).onStop)==null||r.call(i))},this.options=n,this.initAnimation(),this.play(),n.autoplay===!1&&this.pause()}initAnimation(){const{options:n}=this;cb(n);const{type:t=ir,repeat:i=0,repeatDelay:r=0,repeatType:a,velocity:o=0}=n;let{keyframes:s}=n;const l=t||ir;process.env.NODE_ENV!=="production"&&l!==ir&&mi(s.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${s}`,"spring-two-frames"),l!==ir&&typeof s[0]!="number"&&(this.mixKeyframes=$o($7,ob(s[0],s[1])),s=[0,100]);const f=l({...n,keyframes:s});a==="mirror"&&(this.mirroredGenerator=l({...n,keyframes:[...s].reverse(),velocity:-o})),f.calculatedDuration===null&&(f.calculatedDuration=qc(f));const{calculatedDuration:c}=f;this.calculatedDuration=c,this.resolvedDuration=c+r,this.totalDuration=this.resolvedDuration*(i+1)-r,this.generator=f}updateTime(n){const t=Math.round(n-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=t}tick(n,t=!1){const{generator:i,totalDuration:r,mixKeyframes:a,mirroredGenerator:o,resolvedDuration:s,calculatedDuration:l}=this;if(this.startTime===null)return i.next(0);const{delay:f=0,keyframes:c,repeat:d,repeatType:p,repeatDelay:u,type:m,onUpdate:h,finalKeyframe:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,n):this.speed<0&&(this.startTime=Math.min(n-r/this.speed,this.startTime)),t?this.currentTime=n:this.updateTime(n);const v=this.currentTime-f*(this.playbackSpeed>=0?1:-1),b=this.playbackSpeed>=0?v<0:v>r;this.currentTime=Math.max(v,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let k=this.currentTime,w=i;if(d){const I=Math.min(this.currentTime,r)/s;let O=Math.floor(I),T=I%1;!T&&I>=1&&(T=1),T===1&&O--,O=Math.min(O,d+1),!!(O%2)&&(p==="reverse"?(T=1-T,u&&(T-=u/s)):p==="mirror"&&(w=o)),k=zt(0,1,T)*s}let x;b?(this.delayState.value=c[0],x=this.delayState):x=w.next(k),a&&!b&&(x.value=a(x.value));let{done:S}=x;!b&&l!==null&&(S=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const M=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&S);return M&&m!==Kc&&(x.value=Go(c,this.options,g,this.speed)),h&&h(x.value),M&&this.finish(),x}then(n,t){return this.finished.then(n,t)}get duration(){return Kn(this.calculatedDuration)}get iterationDuration(){const{delay:n=0}=this.options||{};return this.duration+Kn(n)}get time(){return Kn(this.currentTime)}set time(n){n=Nn(n),this.currentTime=n,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=n:this.driver&&(this.startTime=this.driver.now()-n/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=n,this.tick(n))}getGeneratorVelocity(){const n=this.currentTime;if(n<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(n);const t=this.generator.next(n).value;return fb(i=>this.generator.next(i).value,n,t)}get speed(){return this.playbackSpeed}set speed(n){const t=this.playbackSpeed!==n;t&&this.driver&&this.updateTime(Mn.now()),this.playbackSpeed=n,t&&this.driver&&(this.time=Kn(this.currentTime))}play(){var r,a;if(this.isStopped)return;const{driver:n=_7,startTime:t}=this.options;this.driver||(this.driver=n(o=>this.tick(o))),(a=(r=this.options).onPlay)==null||a.call(r);const i=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=i):this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime||(this.startTime=t??i),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Mn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var n,t;this.notifyFinished(),this.teardown(),this.state="finished",(t=(n=this.options).onComplete)==null||t.call(n)}cancel(){var n,t;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(t=(n=this.options).onCancel)==null||t.call(n)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(n){return this.startTime=0,this.tick(n,!0)}attachTimeline(n){var t;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(t=this.driver)==null||t.stop(),n.observe(this)}}function R7(e){for(let n=1;n<e.length;n++)e[n]??(e[n]=e[n-1])}const gi=e=>e*180/Math.PI,Jc=e=>{const n=gi(Math.atan2(e[1],e[0]));return Zc(n)},j7={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Jc,rotateZ:Jc,skewX:e=>gi(Math.atan(e[1])),skewY:e=>gi(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Zc=e=>(e=e%360,e<0&&(e+=360),e),db=Jc,ub=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),pb=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),H7={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:ub,scaleY:pb,scale:e=>(ub(e)+pb(e))/2,rotateX:e=>Zc(gi(Math.atan2(e[6],e[5]))),rotateY:e=>Zc(gi(Math.atan2(-e[2],e[0]))),rotateZ:db,rotate:db,skewX:e=>gi(Math.atan(e[4])),skewY:e=>gi(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Qc(e){return e.includes("scale")?1:0}function Xc(e,n){if(!e||e==="none")return Qc(n);const t=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,r;if(t)i=H7,r=t;else{const s=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=j7,r=s}if(!r)return Qc(n);const a=i[n],o=r[1].split(",").map(W7);return typeof a=="function"?a(o):o[a]}const V7=(e,n)=>{const{transform:t="none"}=getComputedStyle(e);return Xc(t,n)};function W7(e){return parseFloat(e.trim())}const rr=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ar=new Set([...rr,"pathRotation"]),mb=e=>e===Xi||e===ce,q7=new Set(["x","y","z"]),U7=rr.filter(e=>!q7.has(e));function G7(e){const n=[];return U7.forEach(t=>{const i=e.getValue(t);i!==void 0&&(n.push([t,i.get()]),i.set(t.startsWith("scale")?1:0))}),n}const $t={width:({x:e},{paddingLeft:n="0",paddingRight:t="0",boxSizing:i})=>{const r=e.max-e.min;return i==="border-box"?r:r-parseFloat(n)-parseFloat(t)},height:({y:e},{paddingTop:n="0",paddingBottom:t="0",boxSizing:i})=>{const r=e.max-e.min;return i==="border-box"?r:r-parseFloat(n)-parseFloat(t)},top:(e,{top:n})=>parseFloat(n),left:(e,{left:n})=>parseFloat(n),bottom:({y:e},{top:n})=>parseFloat(n)+(e.max-e.min),right:({x:e},{left:n})=>parseFloat(n)+(e.max-e.min),x:(e,{transform:n})=>Xc(n,"x"),y:(e,{transform:n})=>Xc(n,"y")};$t.translateX=$t.x,$t.translateY=$t.y;const vi=new Set;let ed=!1,nd=!1,td=!1;function hb(){if(nd){const e=Array.from(vi).filter(i=>i.needsMeasurement),n=new Set(e.map(i=>i.element)),t=new Map;n.forEach(i=>{const r=G7(i);r.length&&(t.set(i,r),i.render())}),e.forEach(i=>i.measureInitialState()),n.forEach(i=>{i.render();const r=t.get(i);r&&r.forEach(([a,o])=>{var s;(s=i.getValue(a))==null||s.set(o)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}nd=!1,ed=!1,vi.forEach(e=>e.complete(td)),vi.clear()}function gb(){vi.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(nd=!0)})}function K7(){td=!0,gb(),hb(),td=!1}class id{constructor(n,t,i,r,a,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...n],this.onComplete=t,this.name=i,this.motionValue=r,this.element=a,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(vi.add(this),ed||(ed=!0,Ln.read(gb),Ln.resolveKeyframes(hb))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:n,name:t,element:i,motionValue:r}=this;if(n[0]===null){const a=r==null?void 0:r.get(),o=n[n.length-1];if(a!==void 0)n[0]=a;else if(i&&t){const s=i.readValue(t,o);s!=null&&(n[0]=s)}n[0]===void 0&&(n[0]=o),r&&a===void 0&&r.set(n[0])}R7(n)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(n=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,n),vi.delete(this)}cancel(){this.state==="scheduled"&&(vi.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Y7=e=>e.startsWith("--");function vb(e,n,t){Y7(n)?e.style.setProperty(n,t):e.style[n]=t}const J7={};function bb(e,n){const t=F0(e);return()=>J7[n]??t()}const Z7=bb(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),yb=bb(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),ha=([e,n,t,i])=>`cubic-bezier(${e}, ${n}, ${t}, ${i})`,kb={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ha([0,.65,.55,1]),circOut:ha([.55,0,1,.45]),backIn:ha([.31,.01,.66,-.59]),backOut:ha([.33,1.53,.69,.99])};function wb(e,n){if(e)return typeof e=="function"?yb()?sb(e,n):"ease-out":W0(e)?ha(e):Array.isArray(e)?e.map(t=>wb(t,n)||kb.easeOut):kb[e]}function Q7(e,n,t,{delay:i=0,duration:r=300,repeat:a=0,repeatType:o="loop",ease:s="easeOut",times:l}={},f=void 0){const c={[n]:t};l&&(c.offset=l);const d=wb(s,r);Array.isArray(d)&&(c.easing=d);const p={delay:i,duration:r,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:a+1,direction:o==="reverse"?"alternate":"normal"};return f&&(p.pseudoElement=f),e.animate(c,p)}function _b(e){return typeof e=="function"&&"applyToOptions"in e}function X7({type:e,...n}){return _b(e)&&yb()?e.applyToOptions(n):(n.duration??(n.duration=300),n.ease??(n.ease="easeOut"),n)}class xb extends Yc{constructor(n){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!n)return;const{element:t,name:i,keyframes:r,pseudoElement:a,allowFlatten:o=!1,finalKeyframe:s,onComplete:l}=n;this.isPseudoElement=!!a,this.allowFlatten=o,this.options=n,mi(typeof n.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const f=X7(n);this.animation=Q7(t,i,r,f,a),f.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const c=Go(r,this.options,s,this.speed);this.updateMotionValue&&this.updateMotionValue(c),vb(t,i,c),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var n,t;(t=(n=this.animation).finish)==null||t.call(n)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:n}=this;n==="idle"||n==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,i,r;const n=(t=this.options)==null?void 0:t.element;!this.isPseudoElement&&(n!=null&&n.isConnected)&&((r=(i=this.animation).commitStyles)==null||r.call(i))}get duration(){var t,i;const n=((i=(t=this.animation.effect)==null?void 0:t.getComputedTiming)==null?void 0:i.call(t).duration)||0;return Kn(Number(n))}get iterationDuration(){const{delay:n=0}=this.options||{};return this.duration+Kn(n)}get time(){return Kn(Number(this.animation.currentTime)||0)}set time(n){const t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Nn(n),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(n){n<0&&(this.finishedTime=null),this.animation.playbackRate=n}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(n){this.manualStartTime=this.animation.startTime=n}attachTimeline({timeline:n,rangeStart:t,rangeEnd:i,observe:r}){var a;return this.allowFlatten&&((a=this.animation.effect)==null||a.updateTiming({easing:"linear"})),this.animation.onfinish=null,n&&Z7()?(this.animation.timeline=n,t&&(this.animation.rangeStart=t),i&&(this.animation.rangeEnd=i),Qi):r(this)}}const Sb={anticipate:j0,backInOut:R0,circInOut:H0};function eI(e){return e in Sb}function nI(e){typeof e.ease=="string"&&eI(e.ease)&&(e.ease=Sb[e.ease])}const rd=10;class tI extends xb{constructor(n){nI(n),cb(n),super(n),n.startTime!==void 0&&n.autoplay!==!1&&(this.startTime=n.startTime),this.options=n}updateMotionValue(n){const{motionValue:t,onUpdate:i,onComplete:r,element:a,...o}=this.options;if(!t)return;if(n!==void 0){t.set(n);return}const s=new Ko({...o,autoplay:!1}),l=Math.max(rd,Mn.now()-this.startTime),f=zt(0,rd,l-rd),c=s.sample(l).value,{name:d}=this.options;a&&d&&vb(a,d,c),t.setWithVelocity(s.sample(Math.max(0,l-f)).value,c,f),s.stop()}}const Cb=(e,n)=>n==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Yn.test(e)||e==="0")&&!e.startsWith("url("));function iI(e){const n=e[0];if(e.length===1)return!0;for(let t=0;t<e.length;t++)if(e[t]!==n)return!0}function rI(e,n,t,i){const r=e[0];if(r===null)return!1;if(n==="display"||n==="visibility")return!0;const a=e[e.length-1],o=Cb(r,n),s=Cb(a,n);return fa(o===s,`You are trying to animate ${n} from "${r}" to "${a}". "${o?a:r}" is not an animatable value.`,"value-not-animatable"),!o||!s?!1:iI(e)||(t==="spring"||_b(t))&&i}function ad(e){e.duration=0,e.type="keyframes"}const Eb=new Set(["opacity","clipPath","filter","transform"]),aI=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function oI(e){for(let n=0;n<e.length;n++)if(typeof e[n]=="string"&&aI.test(e[n]))return!0;return!1}const sI=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),lI=F0(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function fI(e){var d;const{motionValue:n,name:t,repeatDelay:i,repeatType:r,damping:a,type:o,keyframes:s}=e;if(!(((d=n==null?void 0:n.owner)==null?void 0:d.current)instanceof HTMLElement))return!1;const{onUpdate:f,transformTemplate:c}=n.owner.getProps();return lI()&&t&&(Eb.has(t)||sI.has(t)&&oI(s))&&(t!=="transform"||!c)&&!f&&!i&&r!=="mirror"&&a!==0&&o!=="inertia"}const cI=40;class dI extends Yc{constructor({autoplay:n=!0,delay:t=0,type:i="keyframes",repeat:r=0,repeatDelay:a=0,repeatType:o="loop",keyframes:s,name:l,motionValue:f,element:c,...d}){var m;super(),this.stop=()=>{var h,g;this._animation&&(this._animation.stop(),(h=this.stopTimeline)==null||h.call(this)),(g=this.keyframeResolver)==null||g.cancel()},this.createdAt=Mn.now();const p={autoplay:n,delay:t,type:i,repeat:r,repeatDelay:a,repeatType:o,name:l,motionValue:f,element:c,...d},u=(c==null?void 0:c.KeyframeResolver)||id;this.keyframeResolver=new u(s,(h,g,v)=>this.onKeyframesResolved(h,g,p,!v),l,f,c),(m=this.keyframeResolver)==null||m.scheduleResolve()}onKeyframesResolved(n,t,i,r){var v,b;this.keyframeResolver=void 0;const{name:a,type:o,velocity:s,delay:l,isHandoff:f,onUpdate:c}=i;this.resolvedAt=Mn.now();let d=!0;rI(n,a,o,s)||(d=!1,(Bt.instantAnimations||!l)&&(c==null||c(Go(n,i,t))),n[0]=n[n.length-1],ad(i),i.repeat=0);const u={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>cI?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:t,...i,keyframes:n},m=d&&!f&&fI(u),h=(b=(v=u.motionValue)==null?void 0:v.owner)==null?void 0:b.current;let g;if(m)try{g=new tI({...u,element:h})}catch{g=new Ko(u)}else g=new Ko(u);g.finished.then(()=>{this.notifyFinished()}).catch(Qi),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(n,t){return this.finished.finally(n).then(()=>{})}get animation(){var n;return this._animation||((n=this.keyframeResolver)==null||n.resume(),K7()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(n){this.animation.time=n}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(n){this.animation.speed=n}get startTime(){return this.animation.startTime}attachTimeline(n){return this._animation?this.stopTimeline=this.animation.attachTimeline(n):this.pendingTimeline=n,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var n;this._animation&&this.animation.cancel(),(n=this.keyframeResolver)==null||n.cancel()}}function Tb(e,n,t,i=0,r=1){const a=Array.from(e).sort((f,c)=>f.sortNodePosition(c)).indexOf(n),o=e.size,s=(o-1)*i;return typeof t=="function"?t(a,o):r===1?a*i:s-a*i}const Ab=30,uI=e=>!isNaN(parseFloat(e));class pI{constructor(n,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{var a;const r=Mn.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&((a=this.events.change)==null||a.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(n),this.owner=t.owner}setCurrent(n){this.current=n,this.updatedAt=Mn.now(),this.canTrackVelocity===null&&n!==void 0&&(this.canTrackVelocity=uI(this.current))}setPrevFrameValue(n=this.current){this.prevFrameValue=n,this.prevUpdatedAt=this.updatedAt}onChange(n){return process.env.NODE_ENV!=="production"&&N0(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",n)}on(n,t){this.events[n]||(this.events[n]=new P0);const i=this.events[n].add(t);return n==="change"?()=>{i(),Ln.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const n in this.events)this.events[n].clear()}attach(n,t){this.passiveEffect=n,this.stopPassiveEffect=t}set(n){this.passiveEffect?this.passiveEffect(n,this.updateAndNotify):this.updateAndNotify(n)}setWithVelocity(n,t,i){this.set(t),this.prev=void 0,this.prevFrameValue=n,this.prevUpdatedAt=this.updatedAt-i}jump(n,t=!0){this.updateAndNotify(n),this.prev=n,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var n;(n=this.events.change)==null||n.notify(this.current)}addDependent(n){this.dependents||(this.dependents=new Set),this.dependents.add(n)}removeDependent(n){this.dependents&&this.dependents.delete(n)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const n=Mn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||n-this.updatedAt>Ab)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,Ab);return O0(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(n){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=n(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var n,t;(n=this.dependents)==null||n.clear(),(t=this.events.destroy)==null||t.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Yo(e,n){return new pI(e,n)}function Mb(e,n){if(e!=null&&e.inherit&&n){const{inherit:t,...i}=e;return{...n,...i}}return e}function Fb(e,n){const t=(e==null?void 0:e[n])??(e==null?void 0:e.default)??e;return t!==e?Mb(t,e):t}const mI={type:"spring",stiffness:500,damping:25,restSpeed:10},hI=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),gI={type:"keyframes",duration:.8},vI={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},bI=(e,{keyframes:n})=>n.length>2?gI:ar.has(e)?e.startsWith("scale")?hI(n[1]):mI:vI,yI=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function kI(e){for(const n in e)if(!yI.has(n))return!0;return!1}const wI=(e,n,t,i={},r,a)=>o=>{const s=Fb(i,e)||{},l=s.delay||i.delay||0;let{elapsed:f=0}=i;f=f-Nn(l);const c={keyframes:Array.isArray(t)?t:[null,t],ease:"easeOut",velocity:n.getVelocity(),...s,delay:-f,onUpdate:p=>{n.set(p),s.onUpdate&&s.onUpdate(p)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:n,element:a?void 0:r};kI(s)||Object.assign(c,bI(e,c)),c.duration&&(c.duration=Nn(c.duration)),c.repeatDelay&&(c.repeatDelay=Nn(c.repeatDelay)),c.from!==void 0&&(c.keyframes[0]=c.from);let d=!1;if((c.type===!1||c.duration===0&&!c.repeatDelay)&&(ad(c),c.delay===0&&(d=!0)),(Bt.instantAnimations||Bt.skipAnimations||r!=null&&r.shouldSkipAnimations||s.skipAnimations)&&(d=!0,ad(c),c.delay=0),c.allowFlatten=!s.type&&!s.ease,d&&!a&&n.get()!==void 0){const p=Go(c.keyframes,s);if(p!==void 0){Ln.update(()=>{c.onUpdate(p),c.onComplete()});return}}return s.isSync?new Ko(c):new dI(c)},_I=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function xI(e){const n=_I.exec(e);if(!n)return[,];const[,t,i,r]=n;return[`--${t??i}`,r]}const SI=4;function Ib(e,n,t=1){mi(t<=SI,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[i,r]=xI(e);if(!i)return;const a=window.getComputedStyle(n).getPropertyValue(i);if(a){const o=a.trim();return A0(o)?parseFloat(o):o}return Lc(r)?Ib(r,n,t+1):r}function Pb(e){const n=[{},{}];return e==null||e.values.forEach((t,i)=>{n[0][i]=t.get(),n[1][i]=t.getVelocity()}),n}function od(e,n,t,i){if(typeof n=="function"){const[r,a]=Pb(i);n=n(t!==void 0?t:e.custom,r,a)}if(typeof n=="string"&&(n=e.variants&&e.variants[n]),typeof n=="function"){const[r,a]=Pb(i);n=n(t!==void 0?t:e.custom,r,a)}return n}function bi(e,n,t){const i=e.getProps();return od(i,n,t!==void 0?t:i.custom,e)}const Ob=new Set(["width","height","top","left","right","bottom",...rr]),sd=e=>Array.isArray(e);function CI(e,n,t){e.hasValue(n)?e.getValue(n).set(t):e.addValue(n,Yo(t))}function EI(e){return sd(e)?e[e.length-1]||0:e}function TI(e,n){const t=bi(e,n);let{transitionEnd:i={},transition:r={},...a}=t||{};a={...a,...i};for(const o in a){const s=EI(a[o]);CI(e,o,s)}}const pn=e=>!!(e&&e.getVelocity);function AI(e){return!!(pn(e)&&e.add)}function MI(e,n){const t=e.getValue("willChange");if(AI(t))return t.add(n);if(!t&&Bt.WillChange){const i=new Bt.WillChange("auto");e.addValue("willChange",i),i.add(n)}}function ld(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}const Db="data-"+ld("framerAppearId");function FI(e){return e.props[Db]}function II({protectedKeys:e,needsAnimating:n},t){const i=e.hasOwnProperty(t)&&n[t]!==!0;return n[t]=!1,i}function Nb(e,n,{delay:t=0,transitionOverride:i,type:r}={}){let{transition:a,transitionEnd:o,...s}=n;const l=e.getDefaultTransition();a=a?Mb(a,l):l;const f=a==null?void 0:a.reduceMotion,c=a==null?void 0:a.skipAnimations;i&&(a=i);const d=[],p=r&&e.animationState&&e.animationState.getState()[r],u=a==null?void 0:a.path;u&&u.animateVisualElement(e,s,a,t,d);for(const m in s){const h=e.getValue(m,e.latestValues[m]??null),g=s[m];if(g===void 0||p&&II(p,m))continue;const v={delay:t,...Fb(a||{},m)};c&&(v.skipAnimations=!0);const b=h.get();if(b!==void 0&&!h.isAnimating()&&!Array.isArray(g)&&g===b&&!v.velocity){Ln.update(()=>h.set(g));continue}let k=!1;if(window.MotionHandoffAnimation){const S=FI(e);if(S){const M=window.MotionHandoffAnimation(S,m,Ln);M!==null&&(v.startTime=M,k=!0)}}MI(e,m);const w=f??e.shouldReduceMotion;h.start(wI(m,h,g,w&&Ob.has(m)?{type:!1}:v,e,k));const x=h.animation;x&&d.push(x)}if(o){const m=()=>Ln.update(()=>{o&&TI(e,o)});d.length?Promise.all(d).then(m):m()}return d}function fd(e,n,t={}){var l;const i=bi(e,n,t.type==="exit"?(l=e.presenceContext)==null?void 0:l.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=i||{};t.transitionOverride&&(r=t.transitionOverride);const a=i?()=>Promise.all(Nb(e,i,t)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(f=0)=>{const{delayChildren:c=0,staggerChildren:d,staggerDirection:p}=r;return PI(e,n,f,c,d,p,t)}:()=>Promise.resolve(),{when:s}=r;if(s){const[f,c]=s==="beforeChildren"?[a,o]:[o,a];return f().then(()=>c())}else return Promise.all([a(),o(t.delay)])}function PI(e,n,t=0,i=0,r=0,a=1,o){const s=[];for(const l of e.variantChildren)l.notify("AnimationStart",n),s.push(fd(l,n,{...o,delay:t+(typeof i=="function"?0:i)+Tb(e.variantChildren,l,i,r,a)}).then(()=>l.notify("AnimationComplete",n)));return Promise.all(s)}function OI(e,n,t={}){e.notify("AnimationStart",n);let i;if(Array.isArray(n)){const r=n.map(a=>fd(e,a,t));i=Promise.all(r)}else if(typeof n=="string")i=fd(e,n,t);else{const r=typeof n=="function"?bi(e,n,t.custom):n;i=Promise.all(Nb(e,r,t))}return i.then(()=>{e.notify("AnimationComplete",n)})}const DI={test:e=>e==="auto",parse:e=>e},Lb=e=>n=>n.test(e),zb=[Xi,ce,er,yt,i7,t7,DI],Bb=e=>zb.find(Lb(e));function NI(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||M0(e):!0}const LI=new Set(["brightness","contrast","saturate","opacity"]);function zI(e){const[n,t]=e.slice(0,-1).split("(");if(n==="drop-shadow")return e;const[i]=t.match(zc)||[];if(!i)return e;const r=t.replace(i,"");let a=LI.has(n)?1:0;return i!==t&&(a*=100),n+"("+a+r+")"}const BI=/\b([a-z-]*)\(.*?\)/gu,cd={...Yn,getAnimatableNone:e=>{const n=e.match(BI);return n?n.map(zI).join(" "):e}},dd={...Yn,getAnimatableNone:e=>{const n=Yn.parse(e);return Yn.createTransformer(e)(n.map(i=>typeof i=="number"?0:typeof i=="object"?{...i,alpha:1}:i))}},$b={...Xi,transform:Math.round},Jo={borderWidth:ce,borderTopWidth:ce,borderRightWidth:ce,borderBottomWidth:ce,borderLeftWidth:ce,borderRadius:ce,borderTopLeftRadius:ce,borderTopRightRadius:ce,borderBottomRightRadius:ce,borderBottomLeftRadius:ce,width:ce,maxWidth:ce,height:ce,maxHeight:ce,top:ce,right:ce,bottom:ce,left:ce,inset:ce,insetBlock:ce,insetBlockStart:ce,insetBlockEnd:ce,insetInline:ce,insetInlineStart:ce,insetInlineEnd:ce,padding:ce,paddingTop:ce,paddingRight:ce,paddingBottom:ce,paddingLeft:ce,paddingBlock:ce,paddingBlockStart:ce,paddingBlockEnd:ce,paddingInline:ce,paddingInlineStart:ce,paddingInlineEnd:ce,margin:ce,marginTop:ce,marginRight:ce,marginBottom:ce,marginLeft:ce,marginBlock:ce,marginBlockStart:ce,marginBlockEnd:ce,marginInline:ce,marginInlineStart:ce,marginInlineEnd:ce,fontSize:ce,backgroundPositionX:ce,backgroundPositionY:ce,...{rotate:yt,pathRotation:yt,rotateX:yt,rotateY:yt,rotateZ:yt,scale:Vo,scaleX:Vo,scaleY:Vo,scaleZ:Vo,skew:yt,skewX:yt,skewY:yt,distance:ce,translateX:ce,translateY:ce,translateZ:ce,x:ce,y:ce,z:ce,perspective:ce,transformPerspective:ce,opacity:da,originX:Q0,originY:Q0,originZ:ce},zIndex:$b,fillOpacity:da,strokeOpacity:da,numOctaves:$b},$I={...Jo,color:Qe,backgroundColor:Qe,outlineColor:Qe,fill:Qe,stroke:Qe,borderColor:Qe,borderTopColor:Qe,borderRightColor:Qe,borderBottomColor:Qe,borderLeftColor:Qe,filter:cd,WebkitFilter:cd,mask:dd,WebkitMask:dd},Rb=e=>$I[e],RI=new Set([cd,dd]);function jb(e,n){let t=Rb(e);return RI.has(t)||(t=Yn),t.getAnimatableNone?t.getAnimatableNone(n):void 0}const jI=new Set(["auto","none","0"]);function HI(e,n,t){let i=0,r;for(;i<e.length&&!r;){const a=e[i];typeof a=="string"&&!jI.has(a)&&tr(a).values.length&&(r=e[i]),i++}if(r&&t)for(const a of n)e[a]=jb(t,r)}class VI extends id{constructor(n,t,i,r,a){super(n,t,i,r,a,!0)}readKeyframes(){const{unresolvedKeyframes:n,element:t,name:i}=this;if(!t||!t.current)return;super.readKeyframes();for(let c=0;c<n.length;c++){let d=n[c];if(typeof d=="string"&&(d=d.trim(),Lc(d))){const p=Ib(d,t.current);p!==void 0&&(n[c]=p),c===n.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!Ob.has(i)||n.length!==2)return;const[r,a]=n,o=Bb(r),s=Bb(a),l=J0(r),f=J0(a);if(l!==f&&$t[i]){this.needsMeasurement=!0;return}if(o!==s)if(mb(o)&&mb(s))for(let c=0;c<n.length;c++){const d=n[c];typeof d=="string"&&(n[c]=parseFloat(d))}else $t[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:n,name:t}=this,i=[];for(let r=0;r<n.length;r++)(n[r]===null||NI(n[r]))&&i.push(r);i.length&&HI(n,i,t)}measureInitialState(){const{element:n,unresolvedKeyframes:t,name:i}=this;if(!n||!n.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=$t[i](n.measureViewportBox(),window.getComputedStyle(n.current)),t[0]=this.measuredOrigin;const r=t[t.length-1];r!==void 0&&n.getValue(i,r).jump(r,!1)}measureEndState(){var s;const{element:n,name:t,unresolvedKeyframes:i}=this;if(!n||!n.current)return;const r=n.getValue(t);r&&r.jump(this.measuredOrigin,!1);const a=i.length-1,o=i[a];i[a]=$t[t](n.measureViewportBox(),window.getComputedStyle(n.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(s=this.removedTransforms)!=null&&s.length&&this.removedTransforms.forEach(([l,f])=>{n.getValue(l).set(f)}),this.resolveNoneKeyframes()}}function WI(e,n,t){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let i=document;const r=(t==null?void 0:t[e])??i.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e).filter(i=>i!=null)}const ud=(e,n)=>n&&typeof e=="number"?n.transform(e):e;function Zo(e){return BF(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:qI}=G0(queueMicrotask,!1),UI={y:!1};function GI(){return UI.y}function Hb(e,n){const t=WI(e),i=new AbortController,r={passive:!0,...n,signal:i.signal};return[t,r,()=>i.abort()]}function KI(e){return!(e.pointerType==="touch"||GI())}function YI(e,n,t={}){const[i,r,a]=Hb(e,t);return i.forEach(o=>{let s=!1,l=!1,f;const c=()=>{o.removeEventListener("pointerleave",m)},d=g=>{f&&(f(g),f=void 0),c()},p=g=>{s=!1,window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p),l&&(l=!1,d(g))},u=()=>{s=!0,window.addEventListener("pointerup",p,r),window.addEventListener("pointercancel",p,r)},m=g=>{if(g.pointerType!=="touch"){if(s){l=!0;return}d(g)}},h=g=>{if(!KI(g))return;l=!1;const v=n(o,g);typeof v=="function"&&(f=v,o.addEventListener("pointerleave",m,r))};o.addEventListener("pointerenter",h,r),o.addEventListener("pointerdown",u,r)}),a}const Vb=(e,n)=>n?e===n?!0:Vb(e,n.parentElement):!1,JI=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,ZI=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function QI(e){return ZI.has(e.tagName)||e.isContentEditable===!0}const Qo=new WeakSet;function Wb(e){return n=>{n.key==="Enter"&&e(n)}}function pd(e,n){e.dispatchEvent(new PointerEvent("pointer"+n,{isPrimary:!0,bubbles:!0}))}const XI=(e,n)=>{const t=e.currentTarget;if(!t)return;const i=Wb(()=>{if(Qo.has(t))return;pd(t,"down");const r=Wb(()=>{pd(t,"up")}),a=()=>pd(t,"cancel");t.addEventListener("keyup",r,n),t.addEventListener("blur",a,n)});t.addEventListener("keydown",i,n),t.addEventListener("blur",()=>t.removeEventListener("keydown",i),n)};function qb(e){return JI(e)&&!0}const Ub=new WeakSet;function eP(e,n,t={}){const[i,r,a]=Hb(e,t),o=s=>{const l=s.currentTarget;if(!qb(s)||Ub.has(s))return;Qo.add(l),t.stopPropagation&&Ub.add(s);const f=n(l,s),c=(u,m)=>{window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",p),Qo.has(l)&&Qo.delete(l),qb(u)&&typeof f=="function"&&f(u,{success:m})},d=u=>{c(u,l===window||l===document||t.useGlobalTarget||Vb(l,u.target))},p=u=>{c(u,!1)};window.addEventListener("pointerup",d,r),window.addEventListener("pointercancel",p,r)};return i.forEach(s=>{(t.useGlobalTarget?window:s).addEventListener("pointerdown",o,r),Zo(s)&&(s.addEventListener("focus",f=>XI(f,r)),!QI(s)&&!s.hasAttribute("tabindex")&&(s.tabIndex=0))}),a}const nP=[...zb,Qe,Yn],tP=e=>nP.find(Lb(e)),Gb=()=>({min:0,max:0}),Kb=()=>({x:Gb(),y:Gb()}),iP=new WeakMap;function Xo(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function ga(e){return typeof e=="string"||Array.isArray(e)}const md=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],hd=["initial",...md];function es(e){return Xo(e.animate)||hd.some(n=>ga(e[n]))}function Yb(e){return!!(es(e)||e.variants)}function rP(e,n,t){for(const i in n){const r=n[i],a=t[i];if(pn(r))e.addValue(i,r);else if(pn(a))e.addValue(i,Yo(r,{owner:e}));else if(a!==r)if(e.hasValue(i)){const o=e.getValue(i);o.liveStyle===!0?o.jump(r):o.hasAnimated||o.set(r)}else{const o=e.getStaticValue(i);e.addValue(i,Yo(o!==void 0?o:r,{owner:e}))}}for(const i in t)n[i]===void 0&&e.removeValue(i);return n}const gd={current:null},Jb={current:!1},aP=typeof window<"u";function oP(){if(Jb.current=!0,!!aP)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),n=()=>gd.current=e.matches;e.addEventListener("change",n),n()}else gd.current=!1}const Zb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let ns={};function Qb(e){ns=e}function sP(){return ns}class lP{scrapeMotionValuesFromProps(n,t,i){return{}}constructor({parent:n,props:t,presenceContext:i,reducedMotionConfig:r,skipAnimations:a,blockInitialAnimation:o,visualState:s},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=id,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const u=Mn.now();this.renderScheduledAt<u&&(this.renderScheduledAt=u,Ln.render(this.render,!1,!0))};const{latestValues:f,renderState:c}=s;this.latestValues=f,this.baseTarget={...f},this.initialValues=t.initial?{...f}:{},this.renderState=c,this.parent=n,this.props=t,this.presenceContext=i,this.depth=n?n.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=a,this.options=l,this.blockInitialAnimation=!!o,this.isControllingVariants=es(t),this.isVariantNode=Yb(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(n&&n.current);const{willChange:d,...p}=this.scrapeMotionValuesFromProps(t,{},this);for(const u in p){const m=p[u];f[u]!==void 0&&pn(m)&&m.set(f[u])}}mount(n){var t,i;if(this.hasBeenMounted)for(const r in this.initialValues)(t=this.values.get(r))==null||t.jump(this.initialValues[r]),this.latestValues[r]=this.initialValues[r];this.current=n,iP.set(n,this),this.projection&&!this.projection.instance&&this.projection.mount(n),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,a)=>this.bindToMotionValue(a,r)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Jb.current||oP(),this.shouldReduceMotion=gd.current),process.env.NODE_ENV!=="production"&&N0(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected.","reduced-motion-disabled"),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(i=this.parent)==null||i.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var n;this.projection&&this.projection.unmount(),Nc(this.notifyUpdate),Nc(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(n=this.parent)==null||n.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const i=this.features[t];i&&(i.unmount(),i.isMounted=!1)}this.current=null}addChild(n){this.children.add(n),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(n)}removeChild(n){this.children.delete(n),this.enteringChildren&&this.enteringChildren.delete(n)}bindToMotionValue(n,t){if(this.valueSubscriptions.has(n)&&this.valueSubscriptions.get(n)(),t.accelerate&&Eb.has(n)&&this.current instanceof HTMLElement){const{factory:o,keyframes:s,times:l,ease:f,duration:c}=t.accelerate,d=new xb({element:this.current,name:n,keyframes:s,times:l,ease:f,duration:Nn(c)}),p=o(d);this.valueSubscriptions.set(n,()=>{p(),d.cancel()});return}const i=ar.has(n);i&&this.onBindTransform&&this.onBindTransform();const r=t.on("change",o=>{this.latestValues[n]=o,this.props.onUpdate&&Ln.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;typeof window<"u"&&window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,n,t)),this.valueSubscriptions.set(n,()=>{r(),a&&a()})}sortNodePosition(n){return!this.current||!this.sortInstanceNodePosition||this.type!==n.type?0:this.sortInstanceNodePosition(this.current,n.current)}updateFeatures(){let n="animation";for(n in ns){const t=ns[n];if(!t)continue;const{isEnabled:i,Feature:r}=t;if(!this.features[n]&&r&&i(this.props)&&(this.features[n]=new r(this)),this.features[n]){const a=this.features[n];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Kb()}getStaticValue(n){return this.latestValues[n]}setStaticValue(n,t){this.latestValues[n]=t}update(n,t){(n.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=n,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let i=0;i<Zb.length;i++){const r=Zb[i];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const a="on"+r,o=n[a];o&&(this.propEventSubscriptions[r]=this.on(r,o))}this.prevMotionValues=rP(this,this.scrapeMotionValuesFromProps(n,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(n){return this.props.variants?this.props.variants[n]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(n){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(n),()=>t.variantChildren.delete(n)}addValue(n,t){const i=this.values.get(n);t!==i&&(i&&this.removeValue(n),this.bindToMotionValue(n,t),this.values.set(n,t),this.latestValues[n]=t.get())}removeValue(n){this.values.delete(n);const t=this.valueSubscriptions.get(n);t&&(t(),this.valueSubscriptions.delete(n)),delete this.latestValues[n],this.removeValueFromRenderState(n,this.renderState)}hasValue(n){return this.values.has(n)}getValue(n,t){if(this.props.values&&this.props.values[n])return this.props.values[n];let i=this.values.get(n);return i===void 0&&t!==void 0&&(i=Yo(t===null?void 0:t,{owner:this}),this.addValue(n,i)),i}readValue(n,t){let i=this.latestValues[n]!==void 0||!this.current?this.latestValues[n]:this.getBaseTargetFromProps(this.props,n)??this.readValueFromInstance(this.current,n,this.options);return i!=null&&(typeof i=="string"&&(A0(i)||M0(i))?i=parseFloat(i):!tP(i)&&Yn.test(t)&&(i=jb(n,t)),this.setBaseTarget(n,pn(i)?i.get():i)),pn(i)?i.get():i}setBaseTarget(n,t){this.baseTarget[n]=t}getBaseTarget(n){var a;const{initial:t}=this.props;let i;if(typeof t=="string"||typeof t=="object"){const o=od(this.props,t,(a=this.presenceContext)==null?void 0:a.custom);o&&(i=o[n])}if(t&&i!==void 0)return i;const r=this.getBaseTargetFromProps(this.props,n);return r!==void 0&&!pn(r)?r:this.initialValues[n]!==void 0&&i===void 0?void 0:this.baseTarget[n]}on(n,t){return this.events[n]||(this.events[n]=new P0),this.events[n].add(t)}notify(n,...t){this.events[n]&&this.events[n].notify(...t)}scheduleRenderMicrotask(){qI.render(this.render)}}class Xb extends lP{constructor(){super(...arguments),this.KeyframeResolver=VI}sortInstanceNodePosition(n,t){return n.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(n,t){const i=n.style;return i?i[t]:void 0}removeValueFromRenderState(n,{vars:t,style:i}){delete t[n],delete i[n]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:n}=this.props;pn(n)&&(this.childSubscription=n.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}class or{constructor(n){this.isMounted=!1,this.node=n}update(){}}function fP({top:e,left:n,right:t,bottom:i}){return{x:{min:n,max:t},y:{min:e,max:i}}}function cP(e,n){if(!n)return e;const t=n({x:e.left,y:e.top}),i=n({x:e.right,y:e.bottom});return{top:t.y,left:t.x,bottom:i.y,right:i.x}}function dP(e,n){return fP(cP(e.getBoundingClientRect(),n))}const uP={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},pP=rr.length;function mP(e,n,t){let i="",r=!0;for(let o=0;o<pP;o++){const s=rr[o],l=e[s];if(l===void 0)continue;let f=!0;if(typeof l=="number")f=l===(s.startsWith("scale")?1:0);else{const c=parseFloat(l);f=s.startsWith("scale")?c===1:c===0}if(!f||t){const c=ud(l,Jo[s]);if(!f){r=!1;const d=uP[s]||s;i+=`${d}(${c}) `}t&&(n[s]=c)}}const a=e.pathRotation;return a&&(r=!1,i+=`rotate(${ud(a,Jo.pathRotation)}) `),i=i.trim(),t?i=t(n,r?"":i):r&&(i="none"),i}function vd(e,n,t){const{style:i,vars:r,transformOrigin:a}=e;let o=!1,s=!1;for(const l in n){const f=n[l];if(ar.has(l)){o=!0;continue}else if(Y0(l)){r[l]=f;continue}else{const c=ud(f,Jo[l]);l.startsWith("origin")?(s=!0,a[l]=c):i[l]=c}}if(n.transform||(o||t?i.transform=mP(n,e.transform,t):i.transform&&(i.transform="none")),s){const{originX:l="50%",originY:f="50%",originZ:c=0}=a;i.transformOrigin=`${l} ${f} ${c}`}}function ey(e,{style:n,vars:t},i,r){const a=e.style;let o;for(o in n)a[o]=n[o];r==null||r.applyProjectionStyles(a,i);for(o in t)a.setProperty(o,t[o])}function ny(e,n){return n.max===n.min?0:e/(n.max-n.min)*100}const va={correct:(e,n)=>{if(!n.target)return e;if(typeof e=="string")if(ce.test(e))e=parseFloat(e);else return e;const t=ny(e,n.target.x),i=ny(e,n.target.y);return`${t}% ${i}%`}},hP={correct:(e,{treeScale:n,projectionDelta:t})=>{const i=e,r=Yn.parse(e);if(r.length>5)return i;const a=Yn.createTransformer(e),o=typeof r[0]!="number"?1:0,s=t.x.scale*n.x,l=t.y.scale*n.y;r[0+o]/=s,r[1+o]/=l;const f=ma(s,l,.5);return typeof r[2+o]=="number"&&(r[2+o]/=f),typeof r[3+o]=="number"&&(r[3+o]/=f),a(r)}},gP={borderRadius:{...va,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:va,borderTopRightRadius:va,borderBottomLeftRadius:va,borderBottomRightRadius:va,boxShadow:hP};function ty(e,{layout:n,layoutId:t}){return ar.has(e)||e.startsWith("origin")||(n||t!==void 0)&&(!!gP[e]||e==="opacity")}function bd(e,n,t){var o;const i=e.style,r=n==null?void 0:n.style,a={};if(!i)return a;for(const s in i)(pn(i[s])||r&&pn(r[s])||ty(s,e)||((o=t==null?void 0:t.getValue(s))==null?void 0:o.liveStyle)!==void 0)&&(a[s]=i[s]);return a}function vP(e){return window.getComputedStyle(e)}class bP extends Xb{constructor(){super(...arguments),this.type="html",this.renderInstance=ey}readValueFromInstance(n,t){var i;if(ar.has(t))return(i=this.projection)!=null&&i.isProjecting?Qc(t):V7(n,t);{const r=vP(n),a=(Y0(t)?r.getPropertyValue(t):r[t])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(n,{transformPagePoint:t}){return dP(n,t)}build(n,t,i){vd(n,t,i.transformTemplate)}scrapeMotionValuesFromProps(n,t,i){return bd(n,t,i)}}const yP={offset:"stroke-dashoffset",array:"stroke-dasharray"},kP={offset:"strokeDashoffset",array:"strokeDasharray"};function wP(e,n,t=1,i=0,r=!0){e.pathLength=1;const a=r?yP:kP;e[a.offset]=`${-i}`,e[a.array]=`${n} ${t}`}const _P=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function iy(e,{attrX:n,attrY:t,attrScale:i,pathLength:r,pathSpacing:a=1,pathOffset:o=0,...s},l,f,c){if(vd(e,s,f),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:d,style:p}=e;d.transform&&(p.transform=d.transform,delete d.transform),(p.transform||d.transformOrigin)&&(p.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),p.transform&&(p.transformBox=(c==null?void 0:c.transformBox)??"fill-box",delete d.transformBox);for(const u of _P)d[u]!==void 0&&(p[u]=d[u],delete d[u]);n!==void 0&&(d.x=n),t!==void 0&&(d.y=t),i!==void 0&&(d.scale=i),r!==void 0&&wP(d,r,a,o,!1)}const ry=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),ay=e=>typeof e=="string"&&e.toLowerCase()==="svg";function xP(e,n,t,i){ey(e,n,void 0,i);for(const r in n.attrs)e.setAttribute(ry.has(r)?r:ld(r),n.attrs[r])}function oy(e,n,t){const i=bd(e,n,t);for(const r in e)if(pn(e[r])||pn(n[r])){const a=rr.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;i[a]=e[r]}return i}class SP extends Xb{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Kb}getBaseTargetFromProps(n,t){return n[t]}readValueFromInstance(n,t){if(ar.has(t)){const i=Rb(t);return i&&i.default||0}return t=ry.has(t)?t:ld(t),n.getAttribute(t)}scrapeMotionValuesFromProps(n,t,i){return oy(n,t,i)}build(n,t,i){iy(n,t,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(n,t,i,r){xP(n,t,i,r)}mount(n){this.isSVGTag=ay(n.tagName),super.mount(n)}}const CP=hd.length;function sy(e){if(!e)return;if(!e.isControllingVariants){const t=e.parent?sy(e.parent)||{}:{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}const n={};for(let t=0;t<CP;t++){const i=hd[t],r=e.props[i];(ga(r)||r===!1)&&(n[i]=r)}return n}function ly(e,n){if(!Array.isArray(n))return!1;const t=n.length;if(t!==e.length)return!1;for(let i=0;i<t;i++)if(n[i]!==e[i])return!1;return!0}const EP=[...md].reverse(),TP=md.length;function AP(e){return n=>Promise.all(n.map(({animation:t,options:i})=>OI(e,t,i)))}function MP(e){let n=AP(e),t=fy(),i=!0,r=!1;const a=f=>(c,d)=>{var u;const p=bi(e,d,f==="exit"?(u=e.presenceContext)==null?void 0:u.custom:void 0);if(p){const{transition:m,transitionEnd:h,...g}=p;c={...c,...g,...h}}return c};function o(f){n=f(e)}function s(f){const{props:c}=e,d=sy(e.parent)||{},p=[],u=new Set;let m={},h=1/0;for(let v=0;v<TP;v++){const b=EP[v],k=t[b],w=c[b]!==void 0?c[b]:d[b],x=ga(w),S=b===f?k.isActive:null;S===!1&&(h=v);let M=w===d[b]&&w!==c[b]&&x;if(M&&(i||r)&&e.manuallyAnimateOnMount&&(M=!1),k.protectedKeys={...m},!k.isActive&&S===null||!w&&!k.prevProp||Xo(w)||typeof w=="boolean")continue;if(b==="exit"&&k.isActive&&S!==!0){k.prevResolvedValues&&(m={...m,...k.prevResolvedValues});continue}const I=FP(k.prevProp,w);let O=I||b===f&&k.isActive&&!M&&x||v>h&&x,T=!1;const P=Array.isArray(w)?w:[w];let R=P.reduce(a(b),{});S===!1&&(R={});const{prevResolvedValues:z={}}=k,F={...z,...R},D=N=>{O=!0,u.has(N)&&(T=!0,u.delete(N)),k.needsAnimating[N]=!0;const V=e.getValue(N);V&&(V.liveStyle=!1)};for(const N in F){const V=R[N],_=z[N];if(m.hasOwnProperty(N))continue;let $=!1;sd(V)&&sd(_)?$=!ly(V,_)||I:$=V!==_,$?V!=null?D(N):u.add(N):V!==void 0&&u.has(N)?D(N):k.protectedKeys[N]=!0}k.prevProp=w,k.prevResolvedValues=R,k.isActive&&(m={...m,...R}),(i||r)&&e.blockInitialAnimation&&(O=!1);const L=M&&I;O&&(!L||T)&&p.push(...P.map(N=>{const V={type:b};if(typeof N=="string"&&(i||r)&&!L&&e.manuallyAnimateOnMount&&e.parent){const{parent:_}=e,$=bi(_,N);if(_.enteringChildren&&$){const{delayChildren:B}=$.transition||{};V.delay=Tb(_.enteringChildren,e,B)}}return{animation:N,options:V}}))}if(u.size){const v={};if(typeof c.initial!="boolean"){const b=bi(e,Array.isArray(c.initial)?c.initial[0]:c.initial);b&&b.transition&&(v.transition=b.transition)}u.forEach(b=>{const k=e.getBaseTarget(b),w=e.getValue(b);w&&(w.liveStyle=!0),v[b]=k??null}),p.push({animation:v})}let g=!!p.length;return i&&(c.initial===!1||c.initial===c.animate)&&!e.manuallyAnimateOnMount&&(g=!1),i=!1,r=!1,g?n(p):Promise.resolve()}function l(f,c){var p;if(t[f].isActive===c)return Promise.resolve();(p=e.variantChildren)==null||p.forEach(u=>{var m;return(m=u.animationState)==null?void 0:m.setActive(f,c)}),t[f].isActive=c;const d=s(f);for(const u in t)t[u].protectedKeys={};return d}return{animateChanges:s,setActive:l,setAnimateFunction:o,getState:()=>t,reset:()=>{t=fy(),r=!0}}}function FP(e,n){return typeof n=="string"?n!==e:Array.isArray(n)?!ly(n,e):!1}function yi(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function fy(){return{animate:yi(!0),whileInView:yi(),whileHover:yi(),whileTap:yi(),whileDrag:yi(),whileFocus:yi(),exit:yi()}}function cy(e,n,t,i={passive:!0}){return e.addEventListener(n,t,i),()=>e.removeEventListener(n,t)}function IP(e){return pn(e)?e.get():e}const yd=E.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function dy(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function PP(...e){return n=>{let t=!1;const i=e.map(r=>{const a=dy(r,n);return!t&&typeof a=="function"&&(t=!0),a});if(t)return()=>{for(let r=0;r<i.length;r++){const a=i[r];typeof a=="function"?a():dy(e[r],null)}}}}function OP(...e){return A.useCallback(PP(...e),e)}class DP extends A.Component{getSnapshotBeforeUpdate(n){const t=this.props.childRef.current;if(Zo(t)&&n.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const i=t.offsetParent,r=Zo(i)&&i.offsetWidth||0,a=Zo(i)&&i.offsetHeight||0,o=getComputedStyle(t),s=this.props.sizeRef.current;s.height=parseFloat(o.height),s.width=parseFloat(o.width),s.top=t.offsetTop,s.left=t.offsetLeft,s.right=r-s.width-s.left,s.bottom=a-s.height-s.top,s.direction=o.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function NP({children:e,isPresent:n,anchorX:t,anchorY:i,root:r,pop:a}){var p;const o=E.useId(),s=E.useRef(null),l=E.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:f}=E.useContext(yd),c=((p=e.props)==null?void 0:p.ref)??(e==null?void 0:e.ref),d=OP(s,c);return E.useInsertionEffect(()=>{const{width:u,height:m,top:h,left:g,right:v,bottom:b,direction:k}=l.current;if(n||a===!1||!s.current||!u||!m)return;const w=k==="rtl",x=t==="left"?w?`right: ${v}`:`left: ${g}`:w?`left: ${g}`:`right: ${v}`,S=i==="bottom"?`bottom: ${b}`:`top: ${h}`;s.current.dataset.motionPopId=o;const M=document.createElement("style");f&&(M.nonce=f);const I=r??document.head;return I.appendChild(M),M.sheet&&M.sheet.insertRule(`
|
|
456
456
|
[data-motion-pop-id="${o}"] {
|
|
457
457
|
position: absolute !important;
|
|
458
458
|
width: ${u}px !important;
|
|
@@ -1206,7 +1206,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1206
1206
|
`&&i++}}return[n,t]}class vw extends Event{constructor(n,t){var i,r;super(n),this.code=(i=t==null?void 0:t.code)!=null?i:void 0,this.message=(r=t==null?void 0:t.message)!=null?r:void 0}[Symbol.for("nodejs.util.inspect.custom")](n,t,i){return i(bw(this),t)}[Symbol.for("Deno.customInspect")](n,t){return n(bw(this),t)}}function PL(e){const n=globalThis.DOMException;return typeof n=="function"?new n(e,"SyntaxError"):new SyntaxError(e)}function ru(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(ru).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${ru(e.cause)}`:e.message:`${e}`}function bw(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var yw=e=>{throw TypeError(e)},au=(e,n,t)=>n.has(e)||yw("Cannot "+t),xe=(e,n,t)=>(au(e,n,"read from private field"),t?t.call(e):n.get(e)),en=(e,n,t)=>n.has(e)?yw("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(e):n.set(e,t),Re=(e,n,t,i)=>(au(e,n,"write to private field"),n.set(e,t),t),xt=(e,n,t)=>(au(e,n,"access private method"),t),xn,wi,cr,xs,Ss,wa,dr,_a,Ht,ur,pr,mr,xa,Zn,ou,su,lu,kw,fu,cu,Sa,du,uu;let Cs=class extends EventTarget{constructor(n,t){var i,r;super(),en(this,Zn),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,en(this,xn),en(this,wi),en(this,cr),en(this,xs),en(this,Ss),en(this,wa),en(this,dr),en(this,_a,null),en(this,Ht),en(this,ur),en(this,pr,null),en(this,mr,null),en(this,xa,null),en(this,su,async a=>{var o;xe(this,ur).reset();const{body:s,redirected:l,status:f,headers:c}=a;if(f===204){xt(this,Zn,Sa).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?Re(this,cr,new URL(a.url)):Re(this,cr,void 0),f!==200){xt(this,Zn,Sa).call(this,`Non-200 status code (${f})`,f);return}if(!(c.get("content-type")||"").startsWith("text/event-stream")){xt(this,Zn,Sa).call(this,'Invalid content type, expected "text/event-stream"',f);return}if(xe(this,xn)===this.CLOSED)return;Re(this,xn,this.OPEN);const d=new Event("open");if((o=xe(this,xa))==null||o.call(this,d),this.dispatchEvent(d),typeof s!="object"||!s||!("getReader"in s)){xt(this,Zn,Sa).call(this,"Invalid response body, expected a web ReadableStream",f),this.close();return}const p=new TextDecoder,u=s.getReader();let m=!0;do{const{done:h,value:g}=await u.read();g&&xe(this,ur).feed(p.decode(g,{stream:!h})),h&&(m=!1,xe(this,ur).reset(),xt(this,Zn,du).call(this))}while(m)}),en(this,lu,a=>{Re(this,Ht,void 0),!(a.name==="AbortError"||a.type==="aborted")&&xt(this,Zn,du).call(this,ru(a))}),en(this,fu,a=>{typeof a.id=="string"&&Re(this,_a,a.id);const o=new MessageEvent(a.event||"message",{data:a.data,origin:xe(this,cr)?xe(this,cr).origin:xe(this,wi).origin,lastEventId:a.id||""});xe(this,mr)&&(!a.event||a.event==="message")&&xe(this,mr).call(this,o),this.dispatchEvent(o)}),en(this,cu,a=>{Re(this,wa,a)}),en(this,uu,()=>{Re(this,dr,void 0),xe(this,xn)===this.CONNECTING&&xt(this,Zn,ou).call(this)});try{if(n instanceof URL)Re(this,wi,n);else if(typeof n=="string")Re(this,wi,new URL(n,OL()));else throw new Error("Invalid URL")}catch{throw PL("An invalid or illegal string was specified")}Re(this,ur,FL({onEvent:xe(this,fu),onRetry:xe(this,cu)})),Re(this,xn,this.CONNECTING),Re(this,wa,3e3),Re(this,Ss,(i=t==null?void 0:t.fetch)!=null?i:globalThis.fetch),Re(this,xs,(r=t==null?void 0:t.withCredentials)!=null?r:!1),xt(this,Zn,ou).call(this)}get readyState(){return xe(this,xn)}get url(){return xe(this,wi).href}get withCredentials(){return xe(this,xs)}get onerror(){return xe(this,pr)}set onerror(n){Re(this,pr,n)}get onmessage(){return xe(this,mr)}set onmessage(n){Re(this,mr,n)}get onopen(){return xe(this,xa)}set onopen(n){Re(this,xa,n)}addEventListener(n,t,i){const r=t;super.addEventListener(n,r,i)}removeEventListener(n,t,i){const r=t;super.removeEventListener(n,r,i)}close(){xe(this,dr)&&clearTimeout(xe(this,dr)),xe(this,xn)!==this.CLOSED&&(xe(this,Ht)&&xe(this,Ht).abort(),Re(this,xn,this.CLOSED),Re(this,Ht,void 0))}};xn=new WeakMap,wi=new WeakMap,cr=new WeakMap,xs=new WeakMap,Ss=new WeakMap,wa=new WeakMap,dr=new WeakMap,_a=new WeakMap,Ht=new WeakMap,ur=new WeakMap,pr=new WeakMap,mr=new WeakMap,xa=new WeakMap,Zn=new WeakSet,ou=function(){Re(this,xn,this.CONNECTING),Re(this,Ht,new AbortController),xe(this,Ss)(xe(this,wi),xt(this,Zn,kw).call(this)).then(xe(this,su)).catch(xe(this,lu))},su=new WeakMap,lu=new WeakMap,kw=function(){var e;const n={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...xe(this,_a)?{"Last-Event-ID":xe(this,_a)}:void 0},cache:"no-store",signal:(e=xe(this,Ht))==null?void 0:e.signal};return"window"in globalThis&&(n.credentials=this.withCredentials?"include":"same-origin"),n},fu=new WeakMap,cu=new WeakMap,Sa=function(e,n){var t;xe(this,xn)!==this.CLOSED&&Re(this,xn,this.CLOSED);const i=new vw("error",{code:n,message:e});(t=xe(this,pr))==null||t.call(this,i),this.dispatchEvent(i)},du=function(e,n){var t;if(xe(this,xn)===this.CLOSED)return;Re(this,xn,this.CONNECTING);const i=new vw("error",{code:n,message:e});(t=xe(this,pr))==null||t.call(this,i),this.dispatchEvent(i),Re(this,dr,setTimeout(xe(this,uu),xe(this,wa)))},uu=new WeakMap,Cs.CONNECTING=0,Cs.OPEN=1,Cs.CLOSED=2;function OL(){const e="document"in globalThis?globalThis.document:void 0;return e&&typeof e=="object"&&"baseURI"in e&&typeof e.baseURI=="string"?e.baseURI:void 0}async function DL(e){var n;const t=await e.clone().json();if((n=t==null?void 0:t.id)!=null&&n.startsWith("err_")){const i=new Error(t.message);throw i.id=t.id,i.code=t.code,i.type=t.type,i}return e}const ww=()=>{const e={};return{on:(n,t)=>{var i;return e[n]||(e[n]=new Set),(i=e[n])==null||i.add(t),()=>{var r;return(r=e[n])==null?void 0:r.delete(t)}},emit:(n,t)=>{var i,r;(i=e[n])==null||i.forEach(a=>a(t)),(r=e["*"])==null||r.forEach(a=>a({type:n,payload:t}))},cleanup:()=>{for(const n in e)delete e[n]}}},Ue=e=>e.data,_w=10,xw=3e3,NL="60000",Sw=(e,n)=>{const t=(...i)=>e.on(...i);return new Proxy(t,{get:(i,r)=>r==="on"?e.on:r==="disconnect"?n:r==="cleanup"?e.cleanup:Reflect.get(i,r)})},LL={throwOnError:!0},zL=({conversationId:e,userToken:n,clientId:t,apiUrl:i,adminSecret:r})=>{let a=0,o=null,s=null;const l=ww();let f=e,c=n;const d=()=>{o&&(clearTimeout(o),o=null),s&&(s.close(),s=null)},p=()=>{s&&s.close();const u=`${`${i||Be.getConfig().baseUrl}/${t}`}/initialize${f?`?conversationId=${f}`:""}`,m={...r?{"x-admin-secret":r}:{},...c?{"x-user-key":c}:{}};s=Ew(u,m),s.addEventListener("open",()=>l.emit("open")),s.addEventListener("error",h=>{a<_w?(a++,o=setTimeout(()=>p(),xw)):l.emit("error",h)}),s.addEventListener("message",h=>{const g=Cw(h.data);g.type==="init"&&(f=g.data.conversation.id??f,c=g.data.user.userKey??c),l.emit(g.type,g.data)})};return p(),Sw(l,d)},BL=({userKey:e,clientId:n,apiUrl:t,customHeaders:i,advancedOptions:r})=>{const a={"x-user-key":e,...i},o=`${t||Be.getConfig().baseUrl}/${n}`,s={...LL,baseUrl:o};return Be.interceptors.response._fns.length===0&&Be.interceptors.response.use(DL),{createConversation:()=>dL({...s,headers:a,body:{}}).then(Ue),getConversation:({conversationId:l})=>fL({...s,headers:a,path:{id:l}}).then(Ue),deleteConversation:({conversationId:l})=>lL({...s,headers:a,path:{id:l}}).then(Ue),listConversations:({nextToken:l})=>cL({...s,headers:a,query:{nextToken:l}}).then(Ue),listConversationMessages:({conversationId:l,nextToken:f})=>uL({...s,headers:a,path:{id:l},query:{nextToken:f}}).then(Ue),addParticipant:({conversationId:l,userId:f})=>mL({...s,headers:a,path:{id:l},body:{userId:f}}).then(Ue),removeParticipant:({conversationId:l,userId:f})=>hL({...s,headers:a,path:{id:l,userId:f}}).then(Ue),getParticipant:({conversationId:l,userId:f})=>gL({...s,headers:a,path:{id:l,userId:f}}).then(Ue),listParticipants:({conversationId:l,nextToken:f})=>pL({...s,headers:a,path:{id:l},query:{nextToken:f}}).then(Ue),createMessage:l=>kL({...s,headers:a,body:l}).then(Ue),updateMessage:({messageId:l,...f})=>yL({...s,headers:a,path:{id:l},body:f}).then(Ue),getMessage:({messageId:l})=>bL({...s,headers:a,path:{id:l}}).then(Ue),deleteMessage:({messageId:l})=>vL({...s,headers:a,path:{id:l}}).then(Ue),createFile:l=>ML({...s,headers:a,body:l}).then(Ue),getUser:()=>SL({...s,headers:a}).then(Ue),updateUser:l=>CL({...s,headers:a,body:l}).then(Ue),deleteUser:()=>xL({...s,headers:a}).then(Ue),createEvent:l=>AL({...s,headers:a,body:l}).then(Ue),getEvent:({eventId:l})=>TL({...s,headers:a,path:{id:l}}).then(Ue),addMessageFeedback:({messageId:l,...f})=>_L({...s,headers:a,path:{id:l},body:f}).then(Ue),removeMessageFeedback:({messageId:l})=>wL({...s,headers:a,path:{id:l}}).then(Ue),generateUserKey:({adminSecret:l,...f})=>EL({...s,headers:{"x-admin-secret":l},body:f}).then(Ue),listenConversation:({conversationId:l})=>{let f=0,c=null,d=null;const p=ww(),u=()=>{c&&(clearTimeout(c),c=null),d&&(d.close(),d=null)},m=()=>{d&&d.close();const h=`${o}/conversations/${l}/listen`,g=r==null?void 0:r.eventSource;d=g?g({url:h,headers:a}):Ew(h,a),d.addEventListener("open",()=>p.emit("open")),d.addEventListener("error",v=>{f<_w?(f++,c=setTimeout(()=>m(),xw)):p.emit("error",v)}),d.addEventListener("message",v=>{const b=Cw(v.data);p.emit(b.type,b.data)})};return m(),Sw(p,u)}}},Cw=e=>{try{return JSON.parse(e)}catch{return e}},Ew=(e,n)=>new Cs(e,{fetch:(t,i)=>fetch(t,{...i,headers:{...i==null?void 0:i.headers,...n,timeout:NL}})}),$L=async({apiUrl:e,clientId:n,adminSecret:t,clientHeaders:i,emitter:r,conversationId:a,userToken:o})=>new Promise((s,l)=>{const f=zL({apiUrl:e,clientId:n,userToken:o,conversationId:a,adminSecret:t});let c=!1,d,p;p=f("error",u=>{c||(c=!0,d==null||d(),p==null||p(),l(u))}),d=f("init",({conversation:u,messages:m,participants:h,user:g,messageStreams:v})=>{if(c)return;c=!0,p==null||p();const b=BL({clientId:n,apiUrl:e,userKey:g.userKey,customHeaders:i});b.createEvent({conversationId:u.id,payload:{type:"conversation_started",data:{}}}).then(({event:S})=>{var M,I;(I=(M=S.payload.data)==null?void 0:M.status)!=null&&I.isInitial&&r.emit("conversation",u.id)});const k=bt(u.id),w=[...m].reverse().map(vt).filter(Boolean);k.getState().setMessages(w),k.getState().setMessageStreamSnapshots(v??[]),dc(u.id).getState().setParticipants(h),s({on:f,conversation:u,messages:m,participants:h,user:g,client:b,onCleanup:()=>{d(),f.disconnect(),f.cleanup()}})})}),RL={webchat:"#9C27B0",client:"#2196F3",store:"#4CAF50",events:"#00BCD4"},jL={debug:"#9E9E9E",info:"#2196F3",warn:"#FF9800",error:"#F44336"};let Tw=!1,pu=null,Aw=Date.now();const HL=e=>{Tw=e,Aw=Date.now()},VL=e=>{pu=e},WL=()=>{const e=Date.now()-Aw,n=Math.floor(e/1e3),t=e%1e3;return`+${n}.${t.toString().padStart(3,"0")}s`},qL=e=>e===void 0?"undefined":e===null?"null":e instanceof Error?{error:e.message,stack:e.stack}:e,Es=e=>{const n=RL[e]||"#666",t=(i,...r)=>{if(!Tw&&i!=="warn"&&i!=="error")return;const a=WL(),o=`%c[bp:${e}]%c ${a} %c${i.toUpperCase()}%c`,s=[`color: ${n}; font-weight: bold;`,"color: #999; font-size: 10px;",`color: ${jL[i]}; font-weight: bold;`,"color: inherit;"],l=r.map(qL);if(console[i](o,...s,...l),pu){const[f,c]=r;pu(`debug:${e}:${i}`,{message:typeof f=="string"?f:void 0,...typeof c=="object"&&c!==null?c:{}})}};return{debug:(...i)=>t("debug",...i),info:(...i)=>t("info",...i),warn:(...i)=>t("warn",...i),error:(...i)=>t("error",...i)}},mu={webchat:Es("webchat"),client:Es("client"),store:Es("store"),events:Es("events")},Ca=mu.webchat,UL=1e3,GL=3e4;function KL({clientState:e,setClientState:n,setError:t}){const i=E.useRef(null),r=E.useRef(0),a=E.useRef(!1),o=E.useRef({}),s=E.useRef(e);s.current=e;const l=E.useRef(null),f=()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)},c=(p,u=!1)=>{o.current=p,f();const m=r.current,h=u?0:Math.min(UL*Math.pow(2,m),GL);Ca.info("scheduling reconnect",{attempt:m,delayMs:h}),i.current=setTimeout(async()=>{var g;i.current=null;try{a.current=!0,await((g=l.current)==null?void 0:g.call(l,o.current)),r.current=0,a.current=!1,Ca.info("reconnection successful")}catch(v){a.current=!1;const b=ti(v);b.type==="network"||b.type==="disconnected"?(r.current++,Ca.warn("reconnection attempt failed, retrying",{attempt:r.current,error:v}),c(o.current)):(Ca.error("reconnection failed with non-network error",{error:v}),r.current=0,t(b),n("error"))}},h)};return E.useEffect(()=>{const p=()=>{a.current||document.visibilityState==="visible"&&s.current==="disconnected"&&(Ca.info("page became visible while disconnected, attempting immediate reconnect"),r.current=0,c(o.current,!0))};return document.addEventListener("visibilitychange",p),()=>document.removeEventListener("visibilitychange",p)},[]),{scheduleReconnect:c,clearReconnectTimer:f,resetReconnectState:()=>{f(),r.current=0,a.current=!1},isReconnectingRef:a,openConversationRef:l}}function Mw(){const[e,n]=E.useState(!1),t=E.useRef(null);return{state:e,setState:(i,r)=>{if(n(i),!i)return()=>{};if(t.current=new Date,!r)return()=>{};const a=setTimeout(()=>{const o=t.current;o&&new Date().getTime()-o.getTime()>r&&n(!1)},r+100);return()=>clearTimeout(a)}}}const _i=mu.webchat;function Fw({apiUrl:e="https://webchat.botpress.cloud",clientId:n,storageKey:t,storageLocation:i,adminSecret:r,clientHeaders:a,playNotificationSound:o,...s}){const l=qv(t,i),f=l(B=>B.conversationId),c=l(B=>B.user),d=l(B=>B.setConversationId),p=l(B=>B.setUser),{state:u,setState:m}=Mw(),{state:h,setState:g}=Mw(),v=E.useMemo(()=>kp(),[]),[b,k]=E.useState("connecting"),[w,x]=E.useState(void 0),[S,M]=E.useState(void 0),I=E.useRef(null),O=E.useRef(void 0),{scheduleReconnect:T,clearReconnectTimer:P,resetReconnectState:R,isReconnectingRef:z,openConversationRef:F}=KL({clientState:b,setClientState:k,setError:M}),D=yx(s.conversationId,s.userToken,f,c==null?void 0:c.userToken),L=()=>{m(!1),g(!1),v.emit("isTyping",{isTyping:!1,timeout:0})},j=B=>{const C=bt(B.conversationId).getState().upsertMessageStream(B);C.status==="started"&&O.current===B.conversationId&&L(),C.status==="gap"&&_i.warn("message stream sequence gap",{streamId:B.streamId,conversationId:B.conversationId,sequence:B.sequence})},N=({streamId:B,message:C},q)=>{const Q=vt(C),K=bt(C.conversationId).getState().completeMessageStream({streamId:B,message:Q});q&&q!==Q.authorId&&(o==null||o(),K||L()),v.emit("message",Q)},V=B=>{N(B,c==null?void 0:c.userId)},_=B=>{const C=bt(B.conversationId).getState().abortMessageStream(B);O.current===B.conversationId&&!C&&L()};E.useEffect(()=>{let B=!1;_i.info("starting initialization",{clientId:n,apiUrl:e,storageKey:t});const C=async()=>{var Q;try{await $(D)}catch(K){if(B)return;_i.error("initial connection failed",{error:K});const U=ti(K);U.type==="network"||U.type==="disconnected"?(k("disconnected"),T(D)):(M(U),k("error"));return}B&&(_i.debug("initialization completed but effect was cleaned up, tearing down"),(Q=I.current)==null||Q.call(I),I.current=null,O.current&&(bt(O.current).getState().clearMessageStreams(),O.current=void 0))},q=vx(n,e);if(q){_i.error("configuration error",q),M(q),k("error");return}return C(),()=>{B=!0,R(),I.current&&(I.current(),I.current=null),O.current&&(bt(O.current).getState().clearMessageStreams(),O.current=void 0)}},[s.conversationId,s.userToken,n,e]);const $=async({conversationId:B,userToken:C})=>{var H;(H=I.current)==null||H.call(I),P(),O.current&&O.current!==B&&(bt(O.current).getState().clearMessageStreams(),O.current=void 0),M(void 0),m(!1),z.current||k("connecting");const{on:q,conversation:Q,user:K,client:U,onCleanup:G}=await $L({apiUrl:e,clientId:n,clientHeaders:a,emitter:v,adminSecret:r,conversationId:B,userToken:C});x(U),d(Q.id),p({userId:K.id,userToken:K.userKey});const ne=bt(Q.id),Z=dc(Q.id);O.current=Q.id;const re=[G,q("error",Y=>{_i.error("connection error",{error:Y,conversationId:Q.id});const de=ti(Y);de.type==="network"||de.type==="disconnected"?(k("disconnected"),T({conversationId:Q.id,userToken:K.userKey})):(ne.getState().clearMessageStreams(),M(Te=>Te||de),k("error")),v.emit("error",new Error(`Connection to conversation lost: ${Y==null?void 0:Y.message}`))}),q("message_created",Y=>{const de=vt(Y);ne.getState().saveMessage(de),K.id!==de.authorId&&(o==null||o(),m(!1),g(!1),v.emit("isTyping",{isTyping:!1,timeout:0})),v.emit("message",de)}),q("message_updated",Y=>{const de=vt(Y);ne.getState().saveMessage(de),v.emit("messageUpdated",de)}),q("message_stream_delta",j),q("message_stream_complete",Y=>N(Y,K.id)),q("message_stream_abort",_),q("init",Y=>{if(Y.conversation.id!==Q.id)return;const de=[...Y.messages].reverse().map(vt).filter(Boolean);ne.getState().setMessages(de),ne.getState().setMessageStreamSnapshots(Y.messageStreams??[]),Z.getState().setParticipants(Y.participants)}),q("message_status_changed",Y=>{var de;Y.newStatus==="processing"&&ne.getState().updateMessage((de=Y.message.metadata)==null?void 0:de.clientMessageId,{status:Y.newStatus})}),q("typing_stopped",()=>{m(!1),g(!1)}),q("typing_started",()=>{m(!0,5e3),g(!0,5e3),v.emit("isTyping",{isTyping:!0,timeout:5e3})}),q("participant_added",Y=>{Z.getState().addParticipant(Y.participant),v.emit("participantAdded",Y.participant)}),q("participant_removed",Y=>{Z.getState().removeParticipant(Y.participantId),v.emit("participantRemoved",Y.participantId)}),q("webchat_visibility",Y=>v.emit("webchatVisibility",Y.visibility)),q("webchat_config",Y=>v.emit("webchatConfig",Y.config)),q("custom",Y=>v.emit("customEvent",Y.event))];k("connected"),_i.info("client fully connected with event handlers ready",{conversationId:Q.id}),I.current=()=>{re.forEach(Y=>Y())}};return F.current=$,{clientState:b,httpClient:w,error:S,activeConversationId:f,userCredentials:c,isTyping:u,isAwaitingResponse:h,openConversation:$,scheduleReconnect:T,setAwaitingResponse:g,upsertMessageStream:j,completeMessageStream:V,abortMessageStream:_,emitter:v,setError:M,setClientState:k}}const Iw=E.createContext(null);function Vt(){const e=E.useContext(Iw);if(!e)throw new Error("useWebchatContext must be used inside <WebchatProvider>");return e}function Pw({clientId:e,apiUrl:n,storageKey:t,storageLocation:i,adminSecret:r,clientHeaders:a,children:o,...s}){var I;const{clientState:l,httpClient:f,error:c,activeConversationId:d,userCredentials:p,isTyping:u,isAwaitingResponse:m,openConversation:h,setClientState:g,setError:v,setAwaitingResponse:b,upsertMessageStream:k,completeMessageStream:w,abortMessageStream:x,emitter:S}=Fw({apiUrl:n,clientId:e,storageKey:t,storageLocation:i,adminSecret:r,clientHeaders:a,conversationId:s.conversationId,userToken:(I=s.userCredentials)==null?void 0:I.userToken}),M={client:f,clientState:l,setClientState:g,conversationId:d,userCredentials:p,error:c,setError:v,isTyping:u,isAwaitingResponse:m,openConversation:h,setAwaitingResponse:b,upsertMessageStream:k,completeMessageStream:w,abortMessageStream:x,emitter:S};return y.jsx(Iw.Provider,{value:M,children:o})}const hu=({children:e,className:n,uploadFile:t,allowFileUpload:i,storageKey:r,conversationId:a,...o})=>{const s=rt(v=>v.setMessageContainerRef),l=rt(v=>v.setPortalContainer),c=Uv(a||"default",r)(v=>v.uploadFile),[d,p]=E.useState(0),u=E.useRef(null),m=E.useRef(null);E.useEffect(()=>(s(u),l(m.current),()=>l(null)),[u,s,l]);const h=E.useCallback(v=>{t&&(v.forEach(b=>c(b,t)),p(0))},[c,t]),{getRootProps:g}=rw({noClick:!0,noKeyboard:!0,onDrop:h,disabled:!(i&&t),onDragEnter:()=>p(v=>v+1),onDragLeave:()=>p(v=>v-1)});return y.jsxs("div",{...o,className:pi("bpReset bpContainer bpFont",n),...g(),ref:u,children:[y.jsxs("div",{"data-hover":d>0,className:"bpDropzoneOverlay",children:["Drop files to upload",y.jsx(kT,{style:{width:"50px"}})]}),y.jsx("div",{ref:m,style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:10}}),y.jsx(sw,{children:y.jsx(ow,{children:e})})]})};hu.displayName="Container";const Ow=E.forwardRef(({onClick:e,imgUrl:n,...t},i)=>n?y.jsx("img",{src:n,role:"button",tabIndex:0,className:"bpFabImage",draggable:"false",onClick:e}):y.jsx("div",{...t,className:"bpReset bpFabContainer",ref:i,onClick:e,children:y.jsx("div",{className:"bpFabIcon"})}));Ow.displayName="Fab";const Ea=e=>y.jsx(pT,{strokeWidth:1.75,style:{width:"60%",height:"60%"},...e}),xi=({icon:e,label:n,onClick:t,className:i,style:r,size:a})=>y.jsx(e,{className:i??"bpHeaderContentActionsIcons",role:"button",tabIndex:0,"aria-label":n,style:r,size:a,onClick:o=>{o.stopPropagation(),t==null||t(o)},onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),o.stopPropagation(),t==null||t(o))}}),Dw=({closeWindow:e,configuration:n,showConversationHistory:t,soundOn:i,toggleSound:r,clientId:a,expanded:o,onToggleExpand:s,hitlStatus:l})=>{const f=un(),[c,d]=E.useState(!1),p=E.useRef(null);return E.useEffect(()=>{var h;if(!c)return;const u=g=>{p.current&&!p.current.contains(g.target)&&d(!1)},m=(h=p.current)==null?void 0:h.getRootNode();return(m??document).addEventListener("mousedown",u),()=>(m??document).removeEventListener("mousedown",u)},[c]),y.jsxs("div",{className:"bpReset bpHeaderContainer bpFont",children:[t&&y.jsx(xi,{icon:kg,label:f["conversationHistory.showButton.ariaLabel"],onClick:t}),y.jsx(kt,{mode:"popLayout",initial:!1,children:y.jsx(Jn,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.32,ease:"easeInOut"},style:{display:"flex",alignItems:"center",gap:"inherit",flex:1,minWidth:0},children:(l==null?void 0:l.mode)==="agent"?y.jsxs(y.Fragment,{children:[y.jsx(dt,{userId:l.agentName,src:l.agentAvatarUrl,containerClassName:"bpReset bpHeaderContentAvatarContainer",imageClassName:"bpHeaderContentAvatarImage",fallbackClassName:"bpHeaderContentAvatarFallback",children:(l.agentName||"A").slice(0,1).toUpperCase()}),y.jsxs("div",{className:"bpHeaderContentInfo",children:[y.jsx("h2",{className:"bpHeaderContentTitle",children:l.agentName||f["hitl.defaultAgentName"]}),y.jsx("p",{className:"bpHeaderContentDescription",children:f["hitl.supportAgent"]})]})]}):y.jsxs(y.Fragment,{children:[y.jsx(dt,{userId:a,src:n.botAvatar,containerClassName:"bpReset bpHeaderContentAvatarContainer",imageClassName:"bpHeaderContentAvatarImage",fallbackClassName:"bpHeaderContentAvatarFallback",children:y.jsx(Ea,{})}),y.jsxs("div",{className:"bpHeaderContentInfo",children:[y.jsx("h2",{className:"bpHeaderContentTitle",children:n.botName||f["header.defaultBotName"]}),(l==null?void 0:l.mode)==="waiting"?y.jsxs("p",{className:"bpHeaderContentDescription bpHitlHeaderStatus",children:[y.jsx("i",{className:"bpHitlHeaderDot"})," ",f["hitl.findingAgent"]]}):n.botDescription&&y.jsx("p",{className:"bpHeaderContentDescription",children:n.botDescription})]})]})},(l==null?void 0:l.mode)==="agent"?`agent-${l.agentName??""}`:"bot")}),y.jsxs("div",{className:"bpReset bpHeaderContentActionsContainer",children:[(s||n.soundEnabled&&r)&&y.jsxs("div",{ref:p,className:"bpHeaderMenuContainer",children:[y.jsx(xi,{icon:_T,label:f["header.menu.ariaLabel"],onClick:()=>d(u=>!u)}),y.jsx(kt,{children:c&&y.jsxs(Jn,{className:"bpHeaderMenu",initial:{opacity:0,scale:.9,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,y:-4},transition:{type:"spring",stiffness:500,damping:30,mass:.8},children:[s&&y.jsxs("button",{className:"bpHeaderMenuItem",onClick:()=>{s(),d(!1)},children:[o?y.jsx(BT,{size:14,className:"bpHeaderMenuItemIcon"}):y.jsx(NT,{size:14,className:"bpHeaderMenuItemIcon"}),y.jsx("span",{children:o?f["header.collapse"]:f["header.expand"]})]}),n.soundEnabled&&i!==void 0&&r&&y.jsxs("button",{className:"bpHeaderMenuItem",onClick:()=>{r(),d(!1)},children:[i?y.jsx(oA,{size:14,className:"bpHeaderMenuItemIcon"}):y.jsx(Mg,{size:14,className:"bpHeaderMenuItemIcon"}),y.jsx("span",{children:i?f["header.mute"]:f["header.unmute"]})]})]})})]}),y.jsx(xi,{icon:so,label:f["closeButton.ariaLabel"],onClick:e})]})]})},gu=E.memo(({...e})=>y.jsx("div",{...e,className:"bpTypingIndicatorContainer",children:y.jsx("div",{className:"bpTypingIndicatorLoader"})}));gu.displayName="TypingIndicator";function YL({source:e}){const n=wf(e),t=Ig(e),i=e.url?String(e.url):null,r=typeof e.description=="string"?e.description:null,a=i?"a":"div";return y.jsxs(a,{className:"bpCitationSourcesRow",...i?{href:i,target:"_blank",rel:"noopener noreferrer"}:{},children:[y.jsxs("span",{className:"bpCitationSourcesRowHead",children:[y.jsx(Do,{source:e}),y.jsx("span",{className:"bpCitationCardSource",children:t??n})]}),y.jsx("span",{className:"bpCitationSourcesRowTitle",children:n}),r&&y.jsx("span",{className:"bpCitationCardSnippet",children:r})]})}function JL({citations:e}){const[n,t]=E.useState(!1),i=rt(p=>p.portalContainer),r=rt(p=>p.messageContainerRef),a=(r==null?void 0:r.current)??void 0,{refs:o,floatingStyles:s,context:l}=Xf({open:n,onOpenChange:t,placement:"top-start",middleware:[Nf(8),fv({padding:8,boundary:a}),Lf({padding:8,boundary:a,crossAxis:!0}),zf({padding:8,boundary:a,apply({availableWidth:p,availableHeight:u,elements:m}){Object.assign(m.floating.style,{maxWidth:`${Math.min(380,p)}px`,maxHeight:`${u}px`})}})],whileElementsMounted:Of}),{getReferenceProps:f,getFloatingProps:c}=nc([Iv(l),Zf(l),ic(l,{role:"dialog"})]),d=pA(e);return d.length===0?null:y.jsxs(y.Fragment,{children:[y.jsxs("button",{type:"button",className:"bpCitationSources","aria-label":`Sources (${d.length})`,ref:o.setReference,...f(),children:[y.jsx("span",{className:"bpCitationSourcesFavicons",children:d.slice(0,5).map(({id:p,source:u})=>y.jsx("span",{className:"bpCitationSourcesFaviconWrap",children:y.jsx(Do,{source:u})},p))}),y.jsx("span",{className:"bpCitationSourcesLabel",children:"Sources"})]}),n&&y.jsx(Jf,{root:i,children:y.jsxs("div",{ref:o.setFloating,style:{...s,pointerEvents:"auto"},className:"bpReset bpCitationTooltip bpCitationSourcesPopover",...c(),children:[y.jsx("div",{className:"bpCitationSourcesPopoverHead",children:"Sources"}),y.jsx("div",{className:"bpCitationSourcesList",children:d.map(({id:p,source:u})=>y.jsx(YL,{source:u},p))})]})})]})}const ZL=["ticket_opened","agent_assigned","ticket_closed","csat_request"];function QL(e){const n=e.block;if(!n||n.type!=="text"||!n.value)return!1;try{return JSON.parse(n.value).type==="csat_response"}catch{return!1}}function Ts(e){const n=e==null?void 0:e.hitl;if(!n||typeof n!="object")return null;const t=n;return typeof t.kind!="string"||ZL.indexOf(t.kind)===-1?null:t}function Nw(e){let n={mode:"bot"};for(const t of e){const i=Ts(t.metadata);if(i)switch(i.kind){case"ticket_opened":n={mode:"waiting",since:t.timestamp,message:i.waitingMessage,hidden:i.showWaiting===!1};break;case"agent_assigned":n={mode:"agent",agentName:i.agentName,agentAvatarUrl:i.agentAvatarUrl};break;case"ticket_closed":n={mode:"bot"};break}}return n}const XL=({name:e,avatarUrl:n})=>y.jsx(dt,{userId:e,src:n,containerClassName:"bpReset bpHitlChipAvatar",imageClassName:"bpHitlChipAvatarImage",fallbackClassName:"bpHitlChipAvatarFallback",children:(e||"A").slice(0,1).toUpperCase()}),ez=({meta:e,timestamp:n,text:t})=>{const i=un(),r=wr(n).format("h:mm A"),a=t==null?void 0:t.trim();let o=null,s="",l=!1;switch(e.kind){case"ticket_opened":o=y.jsx(ET,{size:13}),s=a||i["hitl.passedToTeam"];break;case"agent_assigned":o=y.jsx(XL,{name:e.agentName,avatarUrl:e.agentAvatarUrl}),s=a||(e.reassigned?i["hitl.agentTransferred"]:i["hitl.agentJoined"]).replace("{name}",e.agentName||i["hitl.defaultAgentName"]);break;case"ticket_closed":o=y.jsx(yf,{size:13}),s=a||(e.agentName?i["hitl.ticketClosedBy"].replace("{name}",e.agentName):i["hitl.ticketClosed"]),l=!0;break;default:return null}return y.jsx("div",{className:"bpReset bpHitlEvent bpFont",children:y.jsxs("span",{className:"bpHitlEventChip"+(l?" bpHitlEventChipDone":""),children:[o,y.jsx("span",{children:s}),y.jsxs("span",{className:"bpHitlEventTime",children:["· ",r]})]})})},Lw=["negative","neutral","positive"],zw=({score:e,size:n=21})=>{const t={positive:y.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),neutral:y.jsx("line",{x1:"8",y1:"15",x2:"16",y2:"15"}),negative:y.jsx("path",{d:"M16 16s-1.5-2-4-2-4 2-4 2"})}[e];return y.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("circle",{cx:"12",cy:"12",r:"10"}),t,y.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),y.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})},nz=({meta:e,collapsed:n,onSubmit:t})=>{var b,k,w;const i=un(),[r,a]=E.useState(((b=e.response)==null?void 0:b.score)??null),[o,s]=E.useState(((k=e.response)==null?void 0:k.comment)??null),[l,f]=E.useState(""),[c,d]=E.useState(!1),p=(w=e.agentName)==null?void 0:w.split(" ")[0],u=p?i["csat.question"].replace("{name}",p):i["csat.questionGeneric"],m=x=>{a(x),d(!0),t==null||t(x)},h=()=>{if(!r)return;const x=l.trim();s(x||null),d(!1),x&&(t==null||t(r,x))},g=r!==null&&!c,v=r!==null;return n&&r===null?y.jsxs("div",{className:"bpReset bpHitlCsat bpHitlCsatRow bpFont",children:[y.jsx("span",{className:"bpHitlCsatQuestion",children:i["csat.rate"]}),y.jsx("div",{className:"bpHitlCsatFaces",children:Lw.map(x=>y.jsx("button",{type:"button",className:"bpHitlCsatFace",onClick:()=>m(x),children:y.jsx(zw,{score:x,size:19})},x))})]}):y.jsxs("div",{className:"bpReset bpHitlCsat bpFont",children:[y.jsx("div",{className:"bpHitlCsatQuestion",children:u}),r===null&&y.jsx("div",{className:"bpHitlCsatSub",children:i["csat.sub"]}),y.jsx("div",{className:"bpHitlCsatFaces",children:Lw.map(x=>y.jsx("button",{type:"button",className:"bpHitlCsatFace"+(r===x?" bpHitlCsatFaceOn":""),disabled:v,onClick:()=>m(x),children:y.jsx(zw,{score:x})},x))}),y.jsx(kt,{initial:!1,children:c&&y.jsx(Jn,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.22,ease:[.4,0,.2,1]},style:{overflow:"hidden"},children:y.jsxs("div",{className:"bpHitlCsatComment",children:[y.jsx("input",{className:"bpHitlCsatCommentInput",placeholder:i["csat.commentPlaceholder"],value:l,onChange:x=>f(x.target.value),onKeyDown:x=>x.key==="Enter"&&h(),autoFocus:!0}),y.jsx("button",{type:"button",className:"bpHitlCsatCommentSend","aria-label":i["csat.sendComment"],onClick:h,children:y.jsx(Tg,{size:13})})]})},"csat-comment")}),g&&y.jsxs(y.Fragment,{children:[o&&y.jsxs("div",{className:"bpHitlCsatQuote",children:["“",o,"”"]}),y.jsxs("div",{className:"bpHitlCsatThanks",children:[y.jsx(yf,{size:14})," ",i["csat.thanks"]]})]})]})},vu=({direction:e,block:n,disableInput:t,children:i,sender:r,id:a,authorId:o,isReadOnly:s,isLastDeliveredMessage:l,isLastMessage:f,sendMessage:c,showAvatar:d=e==="incoming",renderers:p,addMessageFeedback:u,feedback:m,timestamp:h,metadata:g,citationsEnabled:v})=>{const[b,k]=E.useState([]),{showInputModal:w}=vc(),x=un(),S=(g==null?void 0:g.messageStreamStatus)==="streaming",M=Ts(g);if(M){if(M.kind==="csat_request"){const F=(n==null?void 0:n.type)==="choice"?n.options:[],D=(L,j)=>{const N=F.find($=>{try{return JSON.parse($.value).score===L}catch{return!1}}),V=N?JSON.parse(N.value):{type:"csat_response",requestId:M.requestId,score:L},_=j??(N==null?void 0:N.label)??{positive:"😊",neutral:"😐",negative:"☹️"}[L];c==null||c({type:"text",text:_,value:JSON.stringify(j?{...V,comment:j}:V)},{})};return y.jsx(nz,{meta:M,collapsed:!f,onSubmit:D})}return y.jsx(ez,{meta:M,timestamp:h,text:(n==null?void 0:n.type)==="text"?n.text:void 0})}const I=e==="incoming"?g==null?void 0:g.adminName:void 0,O=v!==!1&&e==="incoming"?dA(g):[],T=O.length>0?y.jsx(JL,{citations:O}):void 0,P={direction:e,messageId:a,isStreaming:S,isReadOnly:s,sendMessage:c,citations:O,footer:T},R=e==="incoming"&&!!u&&!!w&&((n==null?void 0:n.type)==="text"||(n==null?void 0:n.type)==="bloc"),z=()=>{if(!n)return null;if(n.type==="custom"&&(p!=null&&p.custom)){const D=p.custom;return y.jsx(D,{...n,direction:e})}const F=Fc(n,P);return O.length>0?n.type==="choice"||n.type==="dropdown"?F:y.jsxs("div",{className:"bpMessageContentWithCitations",children:[F,T]}):F};return y.jsx(hc.Provider,{value:{isLoading:b,setIsLoading:k},children:y.jsxs(Jn,{...S?{}:gD,className:pi("bpReset bpMessageContainer",l&&"bpMessageDeliveryStatus"),"data-loaded":b.length===0,"data-disable-input":!!t,"data-direction":e,dir:"auto",children:[e==="incoming"&&d&&y.jsx(Bw,{authorId:o,sender:r}),R?y.jsxs("div",{className:"bpMessageWithFeedback",children:[I&&y.jsx("div",{className:"bpHitlAgentName",children:x["hitl.agentLabel"].replace("{name}",I)}),z(),y.jsxs("div",{className:"bpMessageFeedbackContainer",children:[y.jsx(eA,{className:"bpMessageFeedbackIcon",role:"button","data-selected":m==="positive",onClick:()=>void(u==null?void 0:u(a,{value:"positive"}))}),y.jsx(XT,{className:"bpMessageFeedbackIcon",role:"button","data-selected":m==="negative",onClick:async()=>{const F=w?await w({title:x["feedback.title"],description:x["feedback.description"],confirmButtonText:x["feedback.confirm"],cancelButtonText:x["feedback.cancel"],Content:tz}):void 0;await(u==null?void 0:u(a,{value:"negative",comment:F}))}})]})]}):I?y.jsxs("div",{className:"bpMessageWithFeedback",children:[y.jsx("div",{className:"bpHitlAgentName",children:x["hitl.agentLabel"].replace("{name}",I)}),z()]}):z(),e==="outgoing"&&d&&y.jsx(Bw,{authorId:o,sender:r}),i,l&&y.jsx("span",{className:"bpMessageDeliveryStatusLabel",children:x["message.status.delivered"]})]})})},tz=({setValue:e})=>{const n=un();return y.jsx("textarea",{className:"bpMessageFeedbackTextarea",placeholder:n["feedback.placeholder"],onChange:t=>e(t.target.value)})},Bw=({authorId:e,sender:n})=>{const[t,i]=E.useState("idle"),r=dp(e??"",15);return y.jsxs(Js,{"data-color":r,"data-loading-status":t,className:"bpReset bpMessageAvatarContainer",children:[y.jsx(Zs,{className:"bpMessageAvatarImage",onLoadingStatusChange:i,src:n==null?void 0:n.avatar}),y.jsx(Qs,{className:"bpMessageAvatarFallback",children:y.jsx(Ea,{})})]})};/*!---------------------------------------------------------------------------------------------
|
|
1207
1207
|
* Copyright (c) StackBlitz. All rights reserved.
|
|
1208
1208
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
1209
|
-
*--------------------------------------------------------------------------------------------*/const iz={damping:.7,stiffness:.05,mass:1.25},rz=70,az=1e3/60,oz=350;let As=!1;(f_=globalThis.document)==null||f_.addEventListener("mousedown",()=>{As=!0}),(c_=globalThis.document)==null||c_.addEventListener("mouseup",()=>{As=!1}),(d_=globalThis.document)==null||d_.addEventListener("click",()=>{As=!1});const sz=(e={})=>{const[n,t]=E.useState(!1),[i,r]=E.useState(e.initial!==!1),[a,o]=E.useState(!1),s=E.useRef(null);s.current=e;const l=E.useCallback(()=>{var w;if(!As)return!1;const b=window.getSelection();if(!b||!b.rangeCount)return!1;const k=b.getRangeAt(0);return k.commonAncestorContainer.contains(g.current)||((w=g.current)==null?void 0:w.contains(k.commonAncestorContainer))},[]),f=E.useCallback(b=>{d.isAtBottom=b,r(b)},[]),c=E.useCallback(b=>{d.escapedFromLock=b,t(b)},[]),d=E.useMemo(()=>{let b;return{escapedFromLock:n,isAtBottom:i,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){var k;return((k=g.current)==null?void 0:k.scrollTop)??0},set scrollTop(k){if(g.current){const{scrollBehavior:w}=getComputedStyle(g.current);w!=="auto"&&(g.current.style.scrollBehavior="auto"),g.current.scrollTop=k,d.ignoreScrollToTop=g.current.scrollTop,w!=="auto"&&(g.current.style.scrollBehavior=w)}},get targetScrollTop(){return!g.current||!v.current?0:g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!v.current)return 0;const{targetScrollTop:k}=this;if(!e.targetScrollTop)return k;if((b==null?void 0:b.targetScrollTop)===k)return b.calculatedScrollTop;const w=Math.max(Math.min(e.targetScrollTop(k,{scrollElement:g.current,contentElement:v.current}),k),0);return b={targetScrollTop:k,calculatedScrollTop:w},requestAnimationFrame(()=>{b=void 0}),w},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=rz}}},[]),p=E.useCallback((b={})=>{var O;typeof b=="string"&&(b={animation:b}),b.preserveScrollPosition||f(!0);const k=Date.now()+(Number(b.wait)||0),w=yu(s.current,b.animation),{ignoreEscapes:x=!1}=b;let S,M=d.calculatedTargetScrollTop;b.duration instanceof Promise?b.duration.finally(()=>{S=Date.now()}):S=k+(b.duration??0);const I=async()=>{const T=new Promise(requestAnimationFrame).then(()=>{var F;if(!d.isAtBottom)return d.animation=void 0,!1;const{scrollTop:P}=d,R=performance.now(),z=(R-(d.lastTick??R))/az;if(d.animation||(d.animation={behavior:w,promise:T,ignoreEscapes:x}),d.animation.behavior===w&&(d.lastTick=R),l()||k>Date.now())return I();if(P<Math.min(M,d.calculatedTargetScrollTop)){if(((F=d.animation)==null?void 0:F.behavior)===w){if(w==="instant")return d.scrollTop=d.calculatedTargetScrollTop,I();d.velocity=(w.damping*d.velocity+w.stiffness*d.scrollDifference)/w.mass,d.accumulated+=d.velocity*z,d.scrollTop+=d.accumulated,d.scrollTop!==P&&(d.accumulated=0)}return I()}return S>Date.now()?(M=d.calculatedTargetScrollTop,I()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?p({animation:yu(s.current,s.current.resize),ignoreEscapes:x,duration:Math.max(0,S-Date.now())||void 0}):d.isAtBottom)});return T.then(P=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),P))};return b.wait!==!0&&(d.animation=void 0),((O=d.animation)==null?void 0:O.behavior)===w?d.animation.promise:I()},[f,l,d]),u=E.useCallback(()=>{c(!0),f(!1)},[c,f]),m=E.useCallback(({target:b})=>{if(b!==g.current)return;const{scrollTop:k,ignoreScrollToTop:w}=d;let{lastScrollTop:x=k}=d;d.lastScrollTop=k,d.ignoreScrollToTop=void 0,w&&w>k&&(x=w),o(d.isNearBottom),setTimeout(()=>{var I;if(d.resizeDifference||k===w)return;if(l()){c(!0),f(!1);return}const S=k>x,M=k<x;if((I=d.animation)!=null&&I.ignoreEscapes){d.scrollTop=x;return}M&&(c(!0),f(!1)),S&&c(!1),!d.escapedFromLock&&d.isNearBottom&&f(!0)},1)},[c,f,l,d]),h=E.useCallback(({target:b,deltaY:k})=>{var x;let w=b;for(;!["scroll","auto"].includes(getComputedStyle(w).overflow);){if(!w.parentElement)return;w=w.parentElement}w===g.current&&k<0&&g.current.scrollHeight>g.current.clientHeight&&!((x=d.animation)!=null&&x.ignoreEscapes)&&(c(!0),f(!1))},[c,f,d]),g=$w(b=>{var k,w;(k=g.current)==null||k.removeEventListener("scroll",m),(w=g.current)==null||w.removeEventListener("wheel",h),b==null||b.addEventListener("scroll",m,{passive:!0}),b==null||b.addEventListener("wheel",h,{passive:!0})},[]),v=$w(b=>{var w,x;if((w=d.resizeObserver)==null||w.disconnect(),!b)return;let k;d.resizeObserver=new ResizeObserver(([S])=>{const{height:M}=S.contentRect,I=M-(k??M);if(d.resizeDifference=I,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),o(d.isNearBottom),I>=0){const O=yu(s.current,k?s.current.resize:s.current.initial);p({animation:O,wait:!0,preserveScrollPosition:!0,duration:O==="instant"?void 0:oz})}else d.isNearBottom&&(c(!1),f(!0));k=M,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===I&&(d.resizeDifference=0)},1)})}),(x=d.resizeObserver)==null||x.observe(b)},[]);return{contentRef:v,scrollRef:g,scrollToBottom:p,stopScroll:u,isAtBottom:i||a,isNearBottom:a,escapedFromLock:n,state:d}};function $w(e,n){const t=E.useCallback(i=>(t.current=i,e(i)),n);return t}const bu=new Map;function yu(...e){const n={...iz};let t=!1;for(const r of e){if(r==="instant"){t=!0;continue}typeof r=="object"&&(t=!1,n.damping=r.damping??n.damping,n.stiffness=r.stiffness??n.stiffness,n.mass=r.mass??n.mass)}const i=JSON.stringify(n);return bu.has(i)||bu.set(i,Object.freeze(n)),t?"instant":bu.get(i)}const lz=({botAvatar:e,botName:n,botDescription:t})=>y.jsxs("li",{className:"bpReset bpMessageListMarqueeContainer",children:[y.jsx(dt,{src:e,containerClassName:"bpReset bpMessageListMarqueeAvatarContainer",imageClassName:"bpMessageListMarqueeAvatarImage",fallbackClassName:"bpMessageListMarqueeAvatarFallback",children:y.jsx(Ea,{})}),y.jsxs("div",{className:"bpMessageListMarqueeContent",children:[y.jsx("h1",{className:"bpMessageListMarqueeTitle",children:n||"Bot"}),t&&y.jsx("p",{className:"bpMessageListMarqueeDescription",children:t})]})]}),Rw={sparkles:Ag,"message-circle":LT,package:RT,truck:nA,zap:cA,"rotate-ccw":Eg,headset:TT,"circle-help":vT,"credit-card":wT,gift:CT,user:iA,users:rA,settings:UT,search:WT,calendar:mT,mail:DT,star:ZT,phone:HT,"map-pin":Cg,"shopping-cart":YT,"shopping-bag":KT,tag:QT,wallet:sA,receipt:VT,"file-text":_g,"book-open":uT,"life-buoy":PT,shield:GT,bell:dT,heart:AT,info:IT,clock:yT,globe:xg,home:MT,wrench:fA,send:Tg},fz=Object.keys(Rw),cz=Ag,jw=e=>e&&Rw[e]||cz,ku=E.memo(({enabled:e,starters:n,displayStyle:t="cards",sendMessage:i})=>{const r=E.useMemo(()=>(n??[]).filter(o=>o.enabled!==!1),[n]);if(!e||r.length===0||!i)return null;const a=o=>{var l;const s=o.text.trim()||((l=o.title)==null?void 0:l.trim())||"";s&&i({type:"text",text:s},{source:"starter"})};return y.jsx("ul",{className:"bpReset bpStartersContainer","data-display-style":t,children:r.map(o=>{const s=o.title||o.text,l=t!=="chips",f=t!=="chips"&&!!o.description,c=jw(o.icon);return y.jsx("li",{className:"bpReset bpStartersItem",children:y.jsxs("button",{type:"button",className:pi("bpReset bpStartersButton"),onClick:()=>a(o),title:s,children:[l&&y.jsx("span",{className:"bpStartersIcon","aria-hidden":"true",children:y.jsx(c,{})}),y.jsxs("span",{className:"bpStartersContent",children:[y.jsx("span",{className:"bpStartersTitle",children:s}),f&&y.jsx("span",{className:"bpStartersDescription",children:o.description})]}),t==="cards"&&y.jsx("span",{className:"bpStartersChevron","aria-hidden":"true",children:y.jsx(wg,{})})]})},o.id)})})});ku.displayName="Starters";const Hw=({heading:e,subtitle:n})=>y.jsxs("div",{className:"bpReset bpWelcomeHero",children:[y.jsx("h1",{className:"bpWelcomeHeroHeading",children:e}),n&&y.jsx("p",{className:"bpWelcomeHeroSubtitle",children:n})]}),Vw=({title:e,subtitle:n,botAvatar:t,botName:i,onClick:r})=>y.jsxs("button",{type:"button",className:"bpReset bpMainCard",onClick:r,children:[y.jsxs("div",{className:"bpMainCardContent",children:[y.jsx("span",{className:"bpMainCardTitle",children:e}),n&&y.jsx("span",{className:"bpMainCardSubtitle",children:n})]}),y.jsx(dt,{src:t,containerClassName:"bpReset bpMainCardAvatarContainer",imageClassName:"bpMainCardAvatarImage",fallbackClassName:"bpMainCardAvatarFallback",children:i||y.jsx(Ea,{})})]}),Ww=5*60*1e3,dz=({since:e,message:n})=>{const t=un(),[i,r]=E.useState(()=>Date.now()-e.getTime()>=Ww);return E.useEffect(()=>{if(i)return;const a=Ww-(Date.now()-e.getTime()),o=setTimeout(()=>r(!0),Math.max(0,a));return()=>clearTimeout(o)},[i,e]),y.jsxs("div",{className:"bpReset bpHitlWaiting bpFont"+(i?" bpHitlWaitingLong":""),children:[y.jsxs("div",{className:"bpHitlWaitingDots","aria-hidden":!0,children:[y.jsx("i",{}),y.jsx("i",{}),y.jsx("i",{})]}),y.jsx("div",{className:"bpHitlWaitingTitle",children:i?t["hitl.waiting.longTitle"]:(n==null?void 0:n.trim())||t["hitl.waiting.title"]}),y.jsx("div",{className:"bpHitlWaitingSub",children:i?t["hitl.waiting.longSub"]:t["hitl.waiting.sub"]})]})},wu=E.memo(({className:e,messages:n=[],isTyping:t,botAvatar:i,botName:r,botDescription:a,sendMessage:o,hitlWaiting:s,addMessageFeedback:l,citationsEnabled:f,showMarquee:c=!0,showDateSystemMessage:d=!0,showMessageStatus:p=!0,showIncomingMessageAvatar:u=!0,showOutgoingMessageAvatar:m=!1,homePageEnabled:h,welcomeHeading:g,welcomeSubtitle:v,mainCardEnabled:b,mainCardTitle:k,mainCardSubtitle:w,onMainCardClick:x,conversationStartersEnabled:S,conversationStarters:M,conversationStartersDisplayStyle:I,renderers:O,...T})=>{var K;const P=un(),R={today:P["date.today"],yesterday:P["date.yesterday"]},z=E.useMemo(()=>{const U=n.filter(H=>!QL(H)),G=U.findIndex(H=>{var Y;return((Y=Ts(H.metadata))==null?void 0:Y.kind)==="ticket_closed"}),ne=U.findIndex(H=>{var Y;return((Y=Ts(H.metadata))==null?void 0:Y.kind)==="csat_request"});if(G===-1||ne===-1||ne>G)return U;const Z=[...U],[re]=Z.splice(ne,1);return re?(Z.splice(G,0,re),Z):U},[n]),F=E.useMemo(()=>d?j_(z,"day",R):z,[z,R.today,R.yesterday]),D=E.useMemo(()=>{var G;const U=F.filter(ne=>ne.direction==="outgoing"&&ne.status!=="pending");return(G=U[U.length-1])==null?void 0:G.id},[F]),L=U=>{if(U.direction==="incoming")return u;if(U.direction==="outgoing")return m},j=n.some(U=>{var G;return((G=U.metadata)==null?void 0:G.messageStreamStatus)==="streaming"}),{scrollRef:N,contentRef:V,scrollToBottom:_,isAtBottom:$}=sz({resize:j?"instant":"smooth",initial:"instant"}),B=n.length===0,C=E.useRef(null),q=E.useCallback(U=>{C.current=U,B||N(U)},[B,N]),Q=E.useCallback(U=>{B||V(U)},[B,V]);return E.useEffect(()=>{B&&C.current&&(C.current.scrollTop=0)},[B]),y.jsxs("div",{...T,ref:q,className:pi("bpMessageListContainer",e),children:[y.jsxs("div",{ref:Q,className:"bpMessageListViewport",style:{marginTop:B?0:void 0},children:[c&&!(h&&g)&&y.jsx(lz,{botAvatar:i,botName:r,botDescription:a}),y.jsx(kt,{initial:!1,children:h&&n.length===0&&!t&&y.jsxs(Jn,{animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.3,ease:[.4,0,.2,1]},style:{display:"flex",flexDirection:"column",gap:"var(--bpSpacing-2)",overflow:"hidden"},children:[c&&g&&y.jsx(Hw,{heading:g,subtitle:v}),b&&y.jsx(Vw,{title:k||"Ask a question",subtitle:w,botAvatar:i,botName:r,onClick:x}),y.jsx(ku,{enabled:S,starters:M,displayStyle:I,sendMessage:o})]},"bpWelcome")}),F.map(U=>{var G,ne;return y.jsx(vu,{sendMessage:o,addMessageFeedback:l,citationsEnabled:f,isLastDeliveredMessage:p&&U.id===D,isLastMessage:U.id===((G=z[z.length-1])==null?void 0:G.id),showAvatar:L(U),renderers:O,...U},((ne=U.metadata)==null?void 0:ne.clientMessageId)||U.id)}),s&&y.jsx(dz,{since:s.since,message:s.message}),t&&y.jsx(vu,{id:Oo(),sendMessage:o,direction:"incoming",timestamp:new Date,showAvatar:u,sender:((K=n.filter(U=>U.direction==="incoming").at(-1))==null?void 0:K.sender)??{name:r||"Bot",avatar:i},children:y.jsx(gu,{})})]}),y.jsx(kt,{children:!$&&y.jsx(hD,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"bpMessageListScrollDownButton",onClick:()=>_()},"scroll-down")})]})});wu.displayName="MessageList";const qw=({className:e,...n})=>y.jsx("div",{...n,className:pi(e,"bpReset bpLoader")}),uz={configuration:$T,bot:yg,network:lA,disconnected:tA},Uw={color:"white",backgroundColor:"transparent"};function Gw({error:e,restartConversation:n,closeWindow:t}){const{showInputModal:i}=vc(),r=un(),o={configuration:r["error.configuration"],bot:r["error.bot"],network:r["error.network"],disconnected:r["error.disconnected"]}[e.type]??r["error.unexpected"],s=uz[e.type]??yg,l=async()=>{i?i({title:r["restartConversation.title"],description:r["restartConversation.description"],confirmButtonText:r["restartConversation.confirm"],cancelButtonText:r["restartConversation.cancel"]}).then(()=>n==null?void 0:n()):n==null||n()};return y.jsxs("div",{className:"bpReset bpErrorContainer",children:[y.jsxs("div",{className:"bpErrorHeader",children:[o,y.jsxs("div",{className:"bpErrorHeaderActions",children:[n&&y.jsx(xi,{icon:Eg,label:r["restartConversation.button.ariaLabel"],onClick:l,style:Uw}),t&&y.jsx(xi,{icon:so,label:r["closeButton.ariaLabel"],onClick:t,style:Uw})]})]}),y.jsxs("div",{className:"bpErrorContent",children:[y.jsx(s,{className:"bpErrorIcon"}),y.jsx("div",{className:"bpErrorTitle",children:o}),y.jsx("div",{className:"bpErrorMessage",children:e.message}),e.id&&y.jsx("div",{className:"bpErrorId",children:e.id})]})]})}const Ta=mu.webchat;async function pz(e,n){const{userId:t,conversationId:i,userToken:r,openConversation:a,setClientState:o,setError:s,emitter:l}=n;Ta.warn("handleWebchatError",{userId:t,conversationId:i,type:e.type,message:e.message});const c=[{name:"startNewConversation",predicate:d=>d.message===xl||d.type==="ResourceNotFound",recover:async()=>a({userToken:r})},{name:"reopenConversation",predicate:d=>d.type==="network",recover:async()=>a({userToken:r,conversationId:i})}].find(d=>d.predicate(e));if(!c){Ta.error("no recovery strategy found, setting error state",{userId:t,conversationId:i}),o("error"),s(e);return}Ta.info("attempting recovery",{userId:t,conversationId:i,strategy:c.name});try{await dh(c.recover,3,5e3),Ta.info("recovery successful",{userId:t,conversationId:i}),s(void 0),o("connected")}catch(d){Ta.error("recovery failed",{error:d,userId:t,conversationId:i}),s(ti(d)),o("error"),l.emit("error",d)}}function mz(e,n){return async(...t)=>{try{return await e(...t)}catch(i){await pz(ti(i),n)}}}function Kw(e,n){const t={};for(const[i,r]of Object.entries(e))t[i]=mz(r,n);return t}function Yw({client:e,conversationId:n}){return{sendEvent:async(i,r)=>{if(!e||!n)throw new Error("Cannot send event: client or conversationId not available");await e.createEvent({conversationId:n,payload:{type:"custom",data:i},bindConversation:(r==null?void 0:r.bindConversation)??!0,bindUser:(r==null?void 0:r.bindUser)??!0})}}}function Jw({client:e,conversationId:n,user:t}){return{uploadFile:async r=>{if(!e)throw new Error("Client not initialized");if(!n)throw new Error("No active conversation");if(!t)throw new Error("User not authenticated");const{size:a,name:o}=r,s=await bx(r),l=new Date;l.setDate(l.getDate()+30);const{file:{uploadUrl:f,contentType:c,url:d,id:p}}=await e.createFile({size:a,key:`${Oo(6)}-${r.name}`,accessPolicies:["public_content"],index:!1,tags:{source:"integration",integrationName:"webchat",conversation:n,user:t.userId},expiresAt:l.toISOString()});await fetch(f,{method:"PUT",headers:{"x-amz-tagging":"public=true","content-type":c},body:s});const u=c.split("/").shift()??"",m=Qm(u)?u:"file";return{fileUrl:d,name:o,type:m,fileId:p}}}}function Zw({client:e,conversationId:n,userId:t,setAwaitingResponse:i}){const r=bt(n||"default"),a=r(h=>h.messages),o=r(h=>h.messageStreams),s=r(h=>h.saveMessage),l=r(h=>h.setMessages),f=r(h=>h.clearMessages),c=r(h=>h.updateMessage);return{messages:E.useMemo(()=>{const h=Object.values(o).sort((g,v)=>g.order-v.order).map(g=>g.message);return h.length===0?a:h.reduce((g,v)=>{const b=g.findIndex(k=>k.timestamp>v.timestamp);return b===-1?[...g,v]:[...g.slice(0,b),v,...g.slice(b)]},a)},[o,a]),sendMessage:async h=>{if(!e||!n||!t)throw console.log("Cannot send message: client, conversationId, or userId not available",e,n,t),new Error("Cannot send message: client, conversationId, or userId not available");i==null||i(!0);const g=Oo(),v={id:g,createdAt:new Date().toISOString(),userId:t,conversationId:n,payload:h,metadata:{clientMessageId:g,delivered:!1}},b=vt(v);b.status="pending",s(b),await e.createMessage({conversationId:n,payload:h,metadata:{clientMessageId:g}})},saveMessageFeedback:async(h,g)=>{if(!e)throw new Error("Cannot save feedback: client not available");c(h,{feedback:g.value}),await e.addMessageFeedback({messageId:h,...g})},setMessages:h=>{const g=h.map(v=>vt(v)).filter(Boolean);l(g)},clearMessages:f}}function Qw({client:e,conversationId:n}){const t=dc(n||"default"),i=t(f=>f.participants),r=t(f=>f.setParticipants),a=t(f=>f.addParticipant),o=t(f=>f.removeParticipant),s=t(f=>f.clearParticipants);return{participants:i,setParticipants:r,fetchParticipants:async()=>{if(!e||!n)return;const{participants:f}=await e.listParticipants({conversationId:n});r(f)},clearParticipants:s,addParticipant:a,removeParticipant:o}}const Xw={chatMessageNotification:new URL("data:audio/ogg;base64,T2dnUwACAAAAAAAAAAAVJAEzAAAAAOU+A6UBHgF2b3JiaXMAAAAAASJWAAD/////AH0AAP////+pAU9nZ1MAAAAAAAAAAAAAFSQBMwEAAAD3T/UfDpz////////////////FA3ZvcmJpcwwAAABMYXZmNjEuNy4xMDAEAAAAHwAAAGVuY29kZXI9TGF2YzYxLjE5LjEwMSBsaWJ2b3JiaXMrAAAAZW5jb2RlZF9ieT1BZG9iZSBQcmVtaWVyZSBQcm8gMjAyNS4wIChNYWNpbhcAAAB0aW1lX3JlZmVyZW5jZT0xMjExMDQwMA8AAABkYXRlPTIwMjUtMDgtMDUBBXZvcmJpcyJCQ1YBAEAAABhCECoFrWOOOsgVIYwZoqBCyinHHULQIaMkQ4g6xjXHGGNHuWSKQsmB0JBVAABAAACkHFdQckkt55xzoxhXzHHoIOecc+UgZ8xxCSXnnHOOOeeSco4x55xzoxhXDnIpLeecc4EUR4pxpxjnnHOkHEeKcagY55xzbTG3knLOOeecc+Ygh1JyrjXnnHOkGGcOcgsl55xzxiBnzHHrIOecc4w1t9RyzjnnnHPOOeecc84555xzjDHnnHPOOeecc24x5xZzrjnnnHPOOeccc84555xzIDRkFQCQAACgoSiK4igOEBqyCgDIAAAQQHEUR5EUS7Ecy9EkDQgNWQUAAAEACAAAoEiGpEiKpViOZmmeJnqiKJqiKquyacqyLMuy67ouEBqyCgBIAABQURTFcBQHCA1ZBQBkAAAIYCiKoziO5FiSpVmeB4SGrAIAgAAABAAAUAxHsRRN8STP8jzP8zzP8zzP8zzP8zzP8zzP8zwNCA1ZBQAgAAAAgihkGANCQ1YBAEAAAAghGhlDnVISXAoWQhwRQx1CzkOppYPgKYUlY9JTrEEIIXzvPffee++B0JBVAAAQAABhFDiIgcckCCGEYhQnRHGmIAghhOUkWMp56CQI3YMQQrice8u59957IDRkFQAACADAIIQQQgghhBBCCCmklFJIKaaYYoopxxxzzDHHIIMMMuigk046yaSSTjrKJKOOUmsptRRTTLHlFmOttdacc69BKWOMMcYYY4wxxhhjjDHGGCMIDVkFAIAAABAGGWSQQQghhBRSSCmmmHLMMcccA0JDVgEAgAAAAgAAABxFUiRHciRHkiTJkixJkzzLszzLszxN1ERNFVXVVW3X9m1f9m3f1WXf9mXb1WVdlmXdtW1d1l1d13Vd13Vd13Vd13Vd13Vd14HQkFUAgAQAgI7kOI7kOI7kSI6kSAoQGrIKAJABABAAgKM4iuNIjuRYjiVZkiZplmd5lqd5mqiJHhAasgoAAAQAEAAAAAAAgKIoiqM4jiRZlqZpnqd6oiiaqqqKpqmqqmqapmmapmmapmmapmmapmmapmmapmmapmmapmmapmmapmkCoSGrAAAJAAAdx3EcR3Ecx3EkR5IkIDRkFQAgAwAgAABDURxFcizHkjRLszzL00TP9FxRNnVTV20gNGQVAAAIACAAAAAAAADHczzHczzJkzzLczzHkzxJ0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRNA0JDVgIAZAAAEJOQSk6xV0YpxiS0XiqkFJPUe6iYYkw67alCBikHuYdKIaWg094ypZBSDHunmELIGOqhg5AxhbDX2nPPvfceCA1ZEQBEAQAAxiDGEGPIMSYlgxIxxyRkUiLnnJROSialpFZazKSEmEqLkXNOSiclk1JaC6llkkprJaYCAAACHAAAAiyEQkNWBABRAACIMUgppBRSSjGnmENKKceUY0gp5ZxyTjnHmHQQKucYdA5KpJRyjjmnnHMSMgeVcw5CJp0AAIAABwCAAAuh0JAVAUCcAACAkHOKMQgRYxBCCSmFUFKqnJPSQUmpg5JSSanFklKMlXNSOgkpdRJSKinFWFKKLaRUY2kt19JSjS3GnFuMvYaUYi2p1Vpaq7nFWHOLNffIOUqdlNY6Ka2l1mpNrdXaSWktpNZiaS3G1mLNKcacMymthZZiK6nF2GLLNbWYc2kt1xRjzynGnmusucecgzCt1ZxayznFmHvMseeYcw+Sc5Q6Ka11UlpLrdWaWqs1k9Jaaa3GkFqLLcacW4sxZ1JaLKnFWFqKMcWYc4st19BarinGnFOLOcdag5Kx9l5aqznFmHuKreeYczA2x547SrmW1nourfVecy5C1tyLaC3n1GoPKsaec87B2NyDEK3lnGrsPcXYe+45GNtz8K3W4FvNRcicg9C5+KZ7MEbV2oPMtQiZcxA66CJ08Ml4lGoureVcWus91hp8zTkI0VruKcbeU4u9156bsL0HIVrLPcXYg4ox+JpzMDrnYlStwcecg5C1FqF7L0rnIJSqtQeZa1Ay1yJ08MXooIsvAABgwAEAIMCEMlBoyIoAIE4AgEHIOaUYhEopCKGElEIoKVWMSciYg5IxJ6WUUloIJbWKMQiZY1Iyx6SEEloqJbQSSmmplNJaKKW1llqMKbUWQymphVJaK6W0llqqMbVWY8SYlMw5KZljUkoprZVSWqsck5IxKKmDkEopKcVSUouVc1Iy6Kh0EEoqqcRUUmmtpNJSKaXFklJsKcVUW4u1hlJaLKnEVlJqMbVUW4sx14gxKRlzUjLnpJRSUiultJY5J6WDjkrmoKSSUmulpBQz5qR0DkrKIKNSUootpRJTKKW1klJspaTWWoy1ptRaLSW1VlJqsZQSW4sx1xZLTZ2U1koqMYZSWmsx5ppaizGUElspKcaSSmytxZpbbDmGUlosqcRWSmqx1ZZja7Hm1FKNKbWaW2y5xpRTj7X2nFqrNbVUY2ux5lhbb7XWnDsprYVSWislxZhai7HFWHMoJbaSUmylpBhbbLm2FmMPobRYSmqxpBJjazHmGFuOqbVaW2y5ptRirbX2HFtuPaUWa4ux5tJSjTXX3mNNORUAADDgAAAQYEIZKDRkJQAQBQAAGMMYYxAapZxzTkqDlHPOScmcgxBCSplzEEJIKXNOQkotZc5BSKm1UEpKrcUWSkmptRYLAAAocAAACLBBU2JxgEJDVgIAUQAAiDFKMQahMUYp5yA0xijFGIRKKcack1ApxZhzUDLHnINQSuaccxBKCSGUUkpKIYRSSkmpAACAAgcAgAAbNCUWByg0ZEUAEAUAABhjnDPOIQqdpc5SJKmj1lFrKKUaS4ydxlZ767nTGnttuTeUSo2p1o5ry7nV3mlNPbccCwAAO3AAADuwEAoNWQkA5AEAEMYoxZhzzhmFGHPOOecMUow555xzijHnnIMQQsWYc85BCCFzzjkIoYSSOecchBBK6JyDUEoppXTOQQihlFI65yCEUkopnXMQSimllAIAgAocAAACbBTZnGAkqNCQlQBAHgAAYAxCzklprWHMOQgt1dgwxhyUlGKLnIOQUou5RsxBSCnGoDsoKbUYbPCdhJRaizkHk1KLNefeg0iptZqDzj3VVnPPvfecYqw1595zLwAAd8EBAOzARpHNCUaCCg1ZCQDkAQAQCCnFmHPOGaUYc8w554xSjDHmnHOKMcacc85BxRhjzjkHIWPMOecghJAx5pxzEELonHMOQgghdM45ByGEEDrnoIMQQgidcxBCCCGEAgCAChwAAAJsFNmcYCSo0JCVAEA4AAAAIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEELonHPOOeecc84555xzzjnnnHPOOScAyLfCAcD/wcYZVpLOCkeDCw1ZCQCEAwAACkEopWIQSiklkk46KZ2TUEopkYNSSumklFJKCaWUUkoIpZRSSggdlFJCKaWUUkoppZRSSimllFI6KaWUUkoppZTKOSmlk1JKKaVEzkkpIZRSSimlhFJKKaWUUkoppZRSSimllFJKKaWEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQCALgbHAAgEmycYSXprHA0uNCQlQBASAAAoBRzjkoIKZSQUqiYoo5CKSmkUkoKEWPOSeochVBSKKmDyjkIpaSUQiohdc5BByWFkFIJIZWOOugolFBSKiWU0jkopYQUSkoplZBCSKl0lFIoJZWUQiohlVJKSCWVEEoKnaRUSgqppFRSCJ10kEInJaSSSgqpk5RSKiWllEpKJXRSQioppRBCSqmUEEpIKaVOUkmppBRCKCGFlFJKJaWSSkohlVRCCaWklFIooaRUUkoppZJSKQAA4MABACDACDrJqLIIG0248AAUGrISACADAECUdNZpp0kiCDFFmScNKcYgtaQswxBTkonxFGOMOShGQw4x5JQYF0oIoYNiPCaVQ8pQUbm31DkFxRZjfO+xFwEAAAgCAASEBAAYICiYAQAGBwgjBwIdAQQObQCAgQiZCQwKocFBJgA8QERIBQCJCYrShS4IIYJ0EWTxwIUTN5644YQObRAAAAAAABAA8AEAkFAAERHRzFVYXGBkaGxwdHh8gIQEAAAAAAAIAHwAACQiQERENHMVFhcYGRobHB0eHyAhAQAAAAAAAAAAQEBAAAAAAAAgAAAAQEBPZ2dTAASuMwAAAAAAABUkATMCAAAACYS6sR4BAUQxGR89NxobGiEkKCknJiYmJSUhISEaFgwBAQEAAnyfvULHAlAEJgh2vpgQBMHIyMjIyNhIQOjz+ePz58+fL89xAwYBAFaH//3//7/xNw0MBoNB6qlPfWrUKQng+/0FABAAhLEjKuHFBwA4AHC9Fx4Oh7EwDEOgvnJ3RtV+Op0+nU6n5cyzEwAoltTpwed5dgVKMPoru90zNHGA7F0CP98BAAAAAHl9ePviAgCW+3rugPIDwC6BbWoTAFEAAADh5GpCCACgc+0zxlAAVKddkjDsA14GDoJtf7R+NkE4W23hI5mF3d74iVGvzg9PpA4cCQs66joePTmOfhgl7vNZzYzQADDyz30FAGSvVUZ6wJ4MAKbCGeb4+v5NLIdK3YvrLkCu98uV//FpXQNyKAKAV7r186fTktcJJgjAlVp1fUmaGgtrdAAuDXYJSPs/AAAAAHDnAeHxciEUAB76CvfarGjDzIjALoEd+/0EAAAAQNYeMrkBAF6ZKm8xuw94NtgloHDUCAAAAIAMJ5Qz2iUAvjhKL8lkfmA6wi6BWfNHgiAAAABq4eeqGgCg8+LAAXQAfhgqz2RKHzAVYJeAynEAIQEAALwq6tFbIQAEEIIO8iULngMAXhgajrw3D5iFWhe7BLZNrwCVKAAA0t2TfT8mADx0aMfS4CULeACvA14YWnasNht80ZpdAhv8BEiiAADgcbm4jo0JANAVCTRV6JqQS0OTADoAXhg6zWy+AZ3GsiDRAYJzgiQAAICnb9FLAQAUNQFd44AioMNJICUAfhi67ZRjA2IMSHTAJK0KkgAAAG7W0uLlEgC6KnQdDkgBlAAdJAB+GHpL40hATAASHSC5CZIAAAAGZ3J60ioBoKsBTQKE5KFJIJFAAp4Y+jp7cg4qINEBi+MASQAAAM8rmdZcAKApwFhNPHQkQEBRQwIAnhj6OZ8KIBwDiQ4Q9ApIFAAAQHRFd6FEALA0NaApQAegnPrDA54Y+nN+AYAIJDoAfgIkCgAAcLRlPVsLALqmKqFpHIwUwQEJCwCeKPpzEQA8kOgAyTlBAgAAgPnK3q8jAWAuJFBYOsbAAgCeKPolEQA8rMFCohQAAMxD2BdSAJYFdNThKcCkBQCOgwKeGPpzEQA8rEEhCQAAoCz4MRGA41gaQMBRjACexHugAACeGPqFCAAeugQAAHryFgBdRYGFhGeow8x7AJ4Y+iURADyIigIAliFAAcYWCQC11gGeGPolEQA8UAAAABoODg4=",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Hs&&Hs.tagName.toUpperCase()==="SCRIPT"&&Hs.src||new URL("index.umd.cjs",document.baseURI).href).href};function _u({storageKey:e,soundEnabled:n}){const t=Gv(e||"bp-webchat"),i=t(f=>f.soundOn),r=t(f=>f.toggleSound),a=E.useRef(null),o=E.useRef(n??!1),s=E.useRef(i);E.useEffect(()=>{try{a.current=new Audio,a.current.preload="auto",a.current.src=Xw.chatMessageNotification,a.current.volume=.9}catch(f){console.error("Error loading sound effect:",f),a.current=null}},[]),E.useEffect(()=>{o.current=n??!1},[n]),E.useEffect(()=>{s.current=i},[i]);const l=E.useCallback(()=>{o.current&&s.current&&a.current&&a.current.play().catch(()=>{})},[]);return{soundOn:i,toggleSound:r,playNotificationSound:l}}function hz({apiUrl:e="https://webchat.botpress.dev",clientId:n,storageKey:t,storageLocation:i,adminSecret:r,soundEnabled:a,clientHeaders:o,...s}){var D;const{soundOn:l,toggleSound:f,playNotificationSound:c}=_u({storageKey:t,soundEnabled:a}),{clientState:d,httpClient:p,error:u,activeConversationId:m,userCredentials:h,isTyping:g,isAwaitingResponse:v,openConversation:b,setAwaitingResponse:k,emitter:w,setError:x,setClientState:S}=Fw({apiUrl:e,clientId:n,storageKey:t,storageLocation:i,adminSecret:r,clientHeaders:o,conversationId:s.conversationId,userToken:(D=s.user)==null?void 0:D.userToken,playNotificationSound:c}),{messages:M,sendMessage:I}=Zw({client:p,conversationId:m,userId:h==null?void 0:h.userId,setAwaitingResponse:k}),{participants:O}=Qw({client:p,conversationId:m}),{uploadFile:T}=Jw({client:p,conversationId:m,user:h}),{sendEvent:P}=Yw({client:p,conversationId:m});if(d!=="connected"||!h||!m||!p)return{clientState:d,on:w.on,client:void 0,messages:[],conversationId:void 0,newConversation:L=>{b({conversationId:L,userToken:h==null?void 0:h.userToken}).catch(j=>{w.emit("error",j)})},user:void 0,isTyping:void 0,participants:[],toggleSound:f,soundOn:l,error:u,disableSendButton:v};const R={userId:h==null?void 0:h.userId,conversationId:m,userToken:h==null?void 0:h.userToken,openConversation:b,setClientState:S,setError:x,emitter:w},F={...Kw({sendMessage:I,sendEvent:P,uploadFile:T},R),getUser:async()=>{const{user:L}=await p.getUser();return L},updateUser:async L=>{const{user:j}=await p.updateUser({name:L.name,pictureUrl:L.pictureUrl,userData:L.data});return j},listConversations:async()=>p.listConversations({})};return{clientState:"connected",on:w.on,client:F,messages:M,conversationId:m,newConversation:L=>{b({conversationId:L,userToken:h.userToken}).catch(j=>{w.emit("error",j)})},user:h,isTyping:g,participants:O,error:u,soundOn:l,toggleSound:f,disableSendButton:v}}const e2=()=>{const{client:e,userCredentials:n}=Vt();return e?{userCredentials:n,getUser:async()=>(await e.getUser()).user,updateUser:async r=>(await e.updateUser(r)).user}:{userCredentials:n,getUser:void 0,updateUser:void 0}};function n2(){const{client:e,conversationId:n,userCredentials:t,setAwaitingResponse:i,emitter:r,clientState:a,setClientState:o,setError:s,openConversation:l,error:f,isAwaitingResponse:c,isTyping:d,upsertMessageStream:p,completeMessageStream:u,abortMessageStream:m}=Vt(),{messages:h,sendMessage:g,saveMessageFeedback:v}=Zw({client:e,conversationId:n,userId:t==null?void 0:t.userId,setAwaitingResponse:i}),{participants:b}=Qw({client:e,conversationId:n}),{sendEvent:k}=Yw({client:e,conversationId:n}),{uploadFile:w}=Jw({client:e,conversationId:n,user:t}),x={userId:t==null?void 0:t.userId,userToken:t==null?void 0:t.userToken,conversationId:n,openConversation:l,setClientState:o,setError:s,emitter:r},S=Kw({sendMessage:g,saveMessageFeedback:v,sendEvent:k,uploadFile:w},x);return{conversationId:n,messages:h,participants:b,sendMessage:S.sendMessage,saveMessageFeedback:S.saveMessageFeedback,sendEvent:S.sendEvent,uploadFile:S.uploadFile,on:r.on,status:a,error:f,isAwaitingResponse:c,isTyping:d,upsertMessageStream:p,completeMessageStream:u,abortMessageStream:m}}function t2(){const{client:e,openConversation:n,userCredentials:t}=Vt();return e?{listConversations:async()=>e.listConversations({}),openConversation:r=>n({conversationId:r,userToken:t==null?void 0:t.userToken})}:{listConversations:void 0,openConversation:r=>n({conversationId:r,userToken:t==null?void 0:t.userToken})}}const i2=0,r2=1,a2=2,o2=3;var s2=Object.prototype.hasOwnProperty;function xu(e,n){var t,i;if(e===n)return!0;if(e&&n&&(t=e.constructor)===n.constructor){if(t===Date)return e.getTime()===n.getTime();if(t===RegExp)return e.toString()===n.toString();if(t===Array){if((i=e.length)===n.length)for(;i--&&xu(e[i],n[i]););return i===-1}if(!t||typeof e=="object"){i=0;for(t in e)if(s2.call(e,t)&&++i&&!s2.call(n,t)||!(t in n)||!xu(e[t],n[t]))return!1;return Object.keys(n).length===i}}return e!==e&&n!==n}const St=new WeakMap,Ct=()=>{},hn=Ct(),Su=Object,Se=e=>e===hn,st=e=>typeof e=="function",Wt=(e,n)=>({...e,...n}),l2=e=>st(e.then),Cu={},Ms={},Eu="undefined",Aa=typeof window!=Eu,Tu=typeof document!=Eu,gz=Aa&&"Deno"in window,vz=()=>Aa&&typeof window.requestAnimationFrame!=Eu,f2=(e,n)=>{const t=St.get(e);return[()=>!Se(n)&&e.get(n)||Cu,i=>{if(!Se(n)){const r=e.get(n);n in Ms||(Ms[n]=r),t[5](n,Wt(r,i),r||Cu)}},t[6],()=>!Se(n)&&n in Ms?Ms[n]:!Se(n)&&e.get(n)||Cu]};let Au=!0;const bz=()=>Au,[Mu,Fu]=Aa&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Ct,Ct],yz=()=>{const e=Tu&&document.visibilityState;return Se(e)||e!=="hidden"},kz=e=>(Tu&&document.addEventListener("visibilitychange",e),Mu("focus",e),()=>{Tu&&document.removeEventListener("visibilitychange",e),Fu("focus",e)}),wz=e=>{const n=()=>{Au=!0,e()},t=()=>{Au=!1};return Mu("online",n),Mu("offline",t),()=>{Fu("online",n),Fu("offline",t)}},_z={isOnline:bz,isVisible:yz},xz={initFocus:kz,initReconnect:wz},c2=!E.useId,hr=!Aa||gz,Sz=e=>vz()?window.requestAnimationFrame(e):setTimeout(e,1),Iu=hr?E.useEffect:E.useLayoutEffect,Pu=typeof navigator<"u"&&navigator.connection,d2=!hr&&Pu&&(["slow-2g","2g"].includes(Pu.effectiveType)||Pu.saveData),Fs=new WeakMap,Cz=e=>Su.prototype.toString.call(e),Ou=(e,n)=>e===`[object ${n}]`;let Ez=0;const Du=e=>{const n=typeof e,t=Cz(e),i=Ou(t,"Date"),r=Ou(t,"RegExp"),a=Ou(t,"Object");let o,s;if(Su(e)===e&&!i&&!r){if(o=Fs.get(e),o)return o;if(o=++Ez+"~",Fs.set(e,o),Array.isArray(e)){for(o="@",s=0;s<e.length;s++)o+=Du(e[s])+",";Fs.set(e,o)}if(a){o="#";const l=Su.keys(e).sort();for(;!Se(s=l.pop());)Se(e[s])||(o+=s+":"+Du(e[s])+",");Fs.set(e,o)}}else o=i?e.toJSON():n=="symbol"?e.toString():n=="string"?JSON.stringify(e):""+e;return o},Nu=e=>{if(st(e))try{e=e()}catch{e=""}const n=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Du(e):"",[e,n]};let Tz=0;const Lu=()=>++Tz;async function u2(...e){const[n,t,i,r]=e,a=Wt({populateCache:!0,throwOnError:!0},typeof r=="boolean"?{revalidate:r}:r||{});let o=a.populateCache;const s=a.rollbackOnError;let l=a.optimisticData;const f=p=>typeof s=="function"?s(p):s!==!1,c=a.throwOnError;if(st(t)){const p=t,u=[],m=n.keys();for(const h of m)!/^\$(inf|sub)\$/.test(h)&&p(n.get(h)._k)&&u.push(h);return Promise.all(u.map(d))}return d(t);async function d(p){const[u]=Nu(p);if(!u)return;const[m,h]=f2(n,u),[g,v,b,k]=St.get(n),w=()=>{const F=g[u];return(st(a.revalidate)?a.revalidate(m().data,p):a.revalidate!==!1)&&(delete b[u],delete k[u],F&&F[0])?F[0](a2).then(()=>m().data):m().data};if(e.length<3)return w();let x=i,S,M=!1;const I=Lu();v[u]=[I,0];const O=!Se(l),T=m(),P=T.data,R=T._c,z=Se(R)?P:R;if(O&&(l=st(l)?l(z,P):l,h({data:l,_c:z})),st(x))try{x=x(z)}catch(F){S=F,M=!0}if(x&&l2(x))if(x=await x.catch(F=>{S=F,M=!0}),I!==v[u][0]){if(M)throw S;return x}else M&&O&&f(S)&&(o=!0,h({data:z,_c:hn}));if(o&&!M)if(st(o)){const F=o(x,z);h({data:F,error:hn,_c:hn})}else h({data:x,error:hn,_c:hn});if(v[u][1]=Lu(),Promise.resolve(w()).then(()=>{h({_c:hn})}),M){if(c)throw S;return}return x}}const p2=(e,n)=>{for(const t in e)e[t][0]&&e[t][0](n)},Az=(e,n)=>{if(!St.has(e)){const t=Wt(xz,n),i=Object.create(null),r=u2.bind(hn,e);let a=Ct;const o=Object.create(null),s=(c,d)=>{const p=o[c]||[];return o[c]=p,p.push(d),()=>p.splice(p.indexOf(d),1)},l=(c,d,p)=>{e.set(c,d);const u=o[c];if(u)for(const m of u)m(d,p)},f=()=>{if(!St.has(e)&&(St.set(e,[i,Object.create(null),Object.create(null),Object.create(null),r,l,s]),!hr)){const c=t.initFocus(setTimeout.bind(hn,p2.bind(hn,i,i2))),d=t.initReconnect(setTimeout.bind(hn,p2.bind(hn,i,r2)));a=()=>{c&&c(),d&&d(),St.delete(e)}}};return f(),[e,r,f,a]}return[e,St.get(e)[4]]},Mz=(e,n,t,i,r)=>{const a=t.errorRetryCount,o=r.retryCount,s=~~((Math.random()+.5)*(1<<(o<8?o:8)))*t.errorRetryInterval;!Se(a)&&o>a||setTimeout(i,s,r)},Fz=xu,[m2,Iz]=Az(new Map),Pz=Wt({onLoadingSlow:Ct,onSuccess:Ct,onError:Ct,onErrorRetry:Mz,onDiscarded:Ct,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:d2?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:d2?5e3:3e3,compare:Fz,isPaused:()=>!1,cache:m2,mutate:Iz,fallback:{}},_z),Oz=(e,n)=>{const t=Wt(e,n);if(n){const{use:i,fallback:r}=e,{use:a,fallback:o}=n;i&&a&&(t.use=i.concat(a)),r&&o&&(t.fallback=Wt(r,o))}return t},Dz=E.createContext({}),Nz="$inf$",h2=Aa&&window.__SWR_DEVTOOLS_USE__,Lz=h2?window.__SWR_DEVTOOLS_USE__:[],zz=()=>{h2&&(window.__SWR_DEVTOOLS_REACT__=E)},Bz=e=>st(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],$z=()=>{const e=E.useContext(Dz);return E.useMemo(()=>Wt(Pz,e),[e])},Rz=e=>(n,t,i)=>e(n,t&&((...a)=>{const[o]=Nu(n),[,,,s]=St.get(m2);if(o.startsWith(Nz))return t(...a);const l=s[o];return Se(l)?t(...a):(delete s[o],l)}),i),jz=Lz.concat(Rz),Hz=e=>function(...t){const i=$z(),[r,a,o]=Bz(t),s=Oz(i,o);let l=e;const{use:f}=s,c=(f||[]).concat(jz);for(let d=c.length;d--;)l=c[d](l);return l(r,a||s.fetcher||null,s)},Vz=(e,n,t)=>{const i=n[e]||(n[e]=[]);return i.push(t),()=>{const r=i.indexOf(t);r>=0&&(i[r]=i[i.length-1],i.pop())}};zz();const zu=E.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(n=>{e.status="fulfilled",e.value=n},n=>{e.status="rejected",e.reason=n}),e}}),Bu={dedupe:!0},g2=Promise.resolve(hn),Wz=()=>Ct,qz=Hz((e,n,t)=>{const{cache:i,compare:r,suspense:a,fallbackData:o,revalidateOnMount:s,revalidateIfStale:l,refreshInterval:f,refreshWhenHidden:c,refreshWhenOffline:d,keepPreviousData:p,strictServerPrefetchWarning:u}=t,[m,h,g,v]=St.get(i),[b,k]=Nu(e),w=E.useRef(!1),x=E.useRef(!1),S=E.useRef(b),M=E.useRef(n),I=E.useRef(t),O=()=>I.current,T=()=>O().isVisible()&&O().isOnline(),[P,R,z,F]=f2(i,b),D=E.useRef({}).current,L=Se(o)?Se(t.fallback)?hn:t.fallback[b]:o,j=(te,pe)=>{for(const ge in D){const ve=ge;if(ve==="data"){if(!r(te[ve],pe[ve])&&(!Se(te[ve])||!r(K,pe[ve])))return!1}else if(pe[ve]!==te[ve])return!1}return!0},N=!w.current,V=E.useMemo(()=>{const te=P(),pe=F(),ge=Fe=>{const $e=Wt(Fe);return delete $e._k,(()=>{if(!b||!n||O().isPaused())return!1;if(N&&!Se(s))return s;const fe=Se(L)?$e.data:L;return Se(fe)||l})()?{isValidating:!0,isLoading:!0,...$e}:$e},ve=ge(te),Ae=te===pe?ve:ge(pe);let Le=ve;return[()=>{const Fe=ge(P());return j(Fe,Le)?(Le.data=Fe.data,Le.isLoading=Fe.isLoading,Le.isValidating=Fe.isValidating,Le.error=Fe.error,Le):(Le=Fe,Fe)},()=>Ae]},[i,b]),_=Ks.useSyncExternalStore(E.useCallback(te=>z(b,(pe,ge)=>{j(ge,pe)||te()}),[i,b]),V[0],V[1]),$=m[b]&&m[b].length>0,B=_.data,C=Se(B)?L&&l2(L)?zu(L):L:B,q=_.error,Q=E.useRef(C),K=p?Se(B)?Se(Q.current)?C:Q.current:B:C,U=b&&Se(C),G=E.useRef(null);!hr&&Ks.useSyncExternalStore(Wz,()=>(G.current=!1,G),()=>(G.current=!0,G));const ne=G.current;u&&ne&&!a&&U&&console.warn(`Missing pre-initiated data for serialized key "${b}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);const Z=!b||!n||O().isPaused()||$&&!Se(q)?!1:N&&!Se(s)?s:a?Se(C)?!1:l:Se(C)||l,re=Se(_.isValidating)?Z:_.isValidating,H=Se(_.isLoading)?Z:_.isLoading,Y=E.useCallback(async te=>{const pe=M.current;if(!b||!pe||x.current||O().isPaused())return!1;let ge,ve,Ae=!0;const Le=te||{},Fe=!g[b]||!Le.dedupe,$e=()=>c2?!x.current&&b===S.current&&w.current:b===S.current,ae={isValidating:!1,isLoading:!1},fe=()=>{R(ae)},W=()=>{const oe=g[b];oe&&oe[1]===ve&&delete g[b]},J={isValidating:!0};Se(P().data)&&(J.isLoading=!0);try{if(Fe&&(R(J),t.loadingTimeout&&Se(P().data)&&setTimeout(()=>{Ae&&$e()&&O().onLoadingSlow(b,t)},t.loadingTimeout),g[b]=[pe(k),Lu()]),[ge,ve]=g[b],ge=await ge,Fe&&setTimeout(W,t.dedupingInterval),!g[b]||g[b][1]!==ve)return Fe&&$e()&&O().onDiscarded(b),!1;ae.error=hn;const oe=h[b];if(!Se(oe)&&(ve<=oe[0]||ve<=oe[1]||oe[1]===0))return fe(),Fe&&$e()&&O().onDiscarded(b),!1;const ue=P().data;ae.data=r(ue,ge)?ue:ge,Fe&&$e()&&O().onSuccess(ge,b,t)}catch(oe){W();const ue=O(),{shouldRetryOnError:be}=ue;ue.isPaused()||(ae.error=oe,Fe&&$e()&&(ue.onError(oe,b,ue),(be===!0||st(be)&&be(oe))&&(!O().revalidateOnFocus||!O().revalidateOnReconnect||T())&&ue.onErrorRetry(oe,b,ue,Ke=>{const nn=m[b];nn&&nn[0]&&nn[0](o2,Ke)},{retryCount:(Le.retryCount||0)+1,dedupe:!0})))}return Ae=!1,fe(),!0},[b,i]),de=E.useCallback((...te)=>u2(i,S.current,...te),[]);if(Iu(()=>{M.current=n,I.current=t,Se(B)||(Q.current=B)}),Iu(()=>{if(!b)return;const te=Y.bind(hn,Bu);let pe=0;O().revalidateOnFocus&&(pe=Date.now()+O().focusThrottleInterval);const ve=Vz(b,m,(Ae,Le={})=>{if(Ae==i2){const Fe=Date.now();O().revalidateOnFocus&&Fe>pe&&T()&&(pe=Fe+O().focusThrottleInterval,te())}else if(Ae==r2)O().revalidateOnReconnect&&T()&&te();else{if(Ae==a2)return Y();if(Ae==o2)return Y(Le)}});return x.current=!1,S.current=b,w.current=!0,R({_k:k}),Z&&(g[b]||(Se(C)||hr?te():Sz(te))),()=>{x.current=!0,ve()}},[b]),Iu(()=>{let te;function pe(){const ve=st(f)?f(P().data):f;ve&&te!==-1&&(te=setTimeout(ge,ve))}function ge(){!P().error&&(c||O().isVisible())&&(d||O().isOnline())?Y(Bu).then(pe):pe()}return pe(),()=>{te&&(clearTimeout(te),te=-1)}},[f,c,d,b]),E.useDebugValue(K),a){if(!c2&&hr&&U)throw new Error("Fallback data is required when using Suspense in SSR.");U&&(M.current=n,I.current=t,x.current=!1);const te=v[b],pe=!Se(te)&&U?de(te):g2;if(zu(pe),!Se(q)&&U)throw q;const ge=U?Y(Bu):g2;!Se(K)&&U&&(ge.status="fulfilled",ge.value=!0),zu(ge)}return{mutate:de,get data(){return D.data=!0,K},get error(){return D.error=!0,q},get isValidating(){return D.isValidating=!0,re},get isLoading(){return D.isLoading=!0,H}}});function v2({userCredentials:e,listConversations:n,clientId:t}){const i=!!e&&t&&n,{data:r,error:a,isLoading:o,mutate:s}=qz(i?[t,"conversations",e==null?void 0:e.userId]:null,async()=>(await n({})).conversations.filter(Uz).sort((f,c)=>new Date(c.updatedAt).getTime()-new Date(f.updatedAt).getTime()).map(f=>({...f,lastMessage:{...f.lastMessage,author:{type:f.lastMessage.userId===(e==null?void 0:e.userId)?"user":"bot"}}})),{revalidateOnFocus:!1,revalidateOnReconnect:!0,dedupingInterval:2e3});return{conversations:r??[],isLoading:o,error:a&&ti(a),refresh:async()=>await s()}}const Uz=e=>!!e.lastMessage;function Gz(){const{client:e,userCredentials:n,conversationId:t,emitter:i}=Vt(),[r,a]=E.useState(!0),[o,s]=E.useState(null),[l,f]=E.useState(null);E.useEffect(()=>{const p=i.on("message",u=>{(n==null?void 0:n.userId)!==u.authorId&&s(u.id)});return()=>{p()}},[i,n==null?void 0:n.userId]),E.useEffect(()=>{r&&c()},[o]);const c=()=>{o!==l?d(o??""):o===null&&l===null&&(s(""),d(""))},d=p=>{!t||!e||(f(p),e.createEvent({conversationId:t,payload:{type:"custom",data:{type:"lastReadMessageUpdate",payload:{conversationId:t,userKey:n==null?void 0:n.userToken}}}}))};return E.useEffect(()=>{const p=()=>{a(!0),c()},u=()=>a(!1);return window.addEventListener("focus",p),window.addEventListener("blur",u),()=>{window.removeEventListener("focus",p),window.removeEventListener("blur",u)}},[c]),{onMessageReceived:p=>{s(p)}}}const Kz=4e3,Yz=2e3;function b2({enabled:e}){const{client:n,conversationId:t}=Vt(),i=E.useRef(0),r=E.useRef(null),a=E.useCallback(l=>{!n||!t||n.createEvent({conversationId:t,payload:{type:"custom",data:{type:"userTyping",payload:{conversationId:t,isTyping:l}}}}).catch(()=>{})},[n,t]),o=E.useCallback(()=>{r.current&&(clearTimeout(r.current),r.current=null),i.current!==0&&(i.current=0,a(!1))},[a]),s=E.useCallback(l=>{if(!e)return;if(!l.trim()){o();return}const f=Date.now();f-i.current>=Kz&&(i.current=f,a(!0)),r.current&&clearTimeout(r.current),r.current=setTimeout(o,Yz)},[e,a,o]);return E.useEffect(()=>()=>o(),[e,t,o]),{onTextChange:e?s:void 0}}const Jz=6e4;function y2({enabled:e,connected:n}){const{client:t,conversationId:i}=Vt(),r=E.useRef(null),a=E.useRef(0),o=E.useRef(null),s=typeof document>"u"?!0:document.hasFocus()&&!document.hidden,l=E.useRef(s),f=E.useRef(!s),c=E.useCallback(h=>{if(!t||!i||r.current===h)return;r.current=h;const g=++a.current;t.createEvent({conversationId:i,payload:{type:"custom",data:{type:"userPresence",payload:{conversationId:i,state:h}}}}).catch(()=>{a.current===g&&(r.current=null)})},[t,i]),d=E.useCallback(()=>n?f.current?"away":"online":"offline",[n]),p=E.useCallback(()=>{e&&c(d())},[e,c,d]),u=E.useCallback(()=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{f.current||(f.current=!0,p())},Jz)},[p]),m=E.useCallback(()=>{f.current=!1,u(),p()},[u,p]);E.useEffect(()=>()=>{e&&c("offline"),r.current=null},[i,e,c]),E.useEffect(()=>{p()},[n,e,p]),E.useEffect(()=>{if(!e)return;const h=()=>{l.current=!0,m()},g=()=>{l.current=!1,u()},v=()=>{l.current&&m()},b=()=>c("offline");return window.addEventListener("focus",h),window.addEventListener("blur",g),window.addEventListener("pointerdown",v),window.addEventListener("keydown",v),window.addEventListener("pagehide",b),window.addEventListener("beforeunload",b),f.current||u(),p(),()=>{window.removeEventListener("focus",h),window.removeEventListener("blur",g),window.removeEventListener("pointerdown",v),window.removeEventListener("keydown",v),window.removeEventListener("pagehide",b),window.removeEventListener("beforeunload",b),o.current&&clearTimeout(o.current)}},[e,u,m,p,c])}const Zz=e=>e!=null&&e.length?e.charAt(0).toUpperCase()+e.slice(1):"",$u=({className:e,onConversationClick:n,onNewConversation:t,onClose:i,isLoading:r,conversations:a,botAvatar:o,botName:s,...l})=>{const f=un();return y.jsxs("div",{...l,className:pi("bpReset bpConversationHistoryContainer bpFont",e),children:[y.jsxs("div",{className:"bpConversationHistoryHeader",children:[f["conversationHistory.title"],i&&y.jsx("div",{className:"bpConversationHistoryCloseButton",children:y.jsx(xi,{icon:so,label:f["closeButton.ariaLabel"],onClick:i})})]}),r?y.jsx("div",{className:"bpConversationHistoryLoaderContainer",children:y.jsx(qw,{})}):y.jsx("div",{className:"bpConversationHistoryScrollContainer",children:a.length===0?y.jsx("div",{className:"bpConversationHistoryLoaderContainer",children:f["conversationHistory.empty"]}):a.map(({id:c,lastMessage:d},p)=>{const u=d.author.type==="bot",m=u?s||"Bot":"You";let h="";if(d.payload.type==="text")h=d.payload.text;else if(d.payload.type==="bloc"&&d.payload.items.some(g=>g.type==="text")){const g=d.payload.items.find(v=>v.type==="text");h=(g==null?void 0:g.payload.text)??""}else h=f["conversationHistory.sentAttachment"];return y.jsxs("div",{children:[y.jsxs("button",{className:"bpConversationHistoryConversationContainer",onClick:()=>n==null?void 0:n(c),children:[u?y.jsx(dt,{userId:d.userId,src:o,containerClassName:"bpReset bpConversationHistoryConversationAvatarContainer",imageClassName:"bpConversationHistoryConversationAvatarImage",fallbackClassName:"bpConversationHistoryConversationAvatarFallback",children:y.jsx(Ea,{})}):y.jsx(dt,{userId:d.userId,containerClassName:"bpReset bpConversationHistoryConversationAvatarContainer",imageClassName:"bpConversationHistoryConversationAvatarImage",fallbackClassName:"bpConversationHistoryConversationUserAvatarFallback",children:m}),y.jsxs("div",{className:"bpConversationHistoryConversationContent",children:[y.jsxs("div",{className:"bpConversationHistoryConversationTitleRow",children:[y.jsx("span",{className:"bpConversationHistoryConversationTitle",children:s||"Bot"}),y.jsx("span",{className:"bpConversationHistoryConversationTimestamp",children:Zz(W4(d.createdAt))})]}),y.jsx("div",{className:"bpConversationHistoryConversationMessageRow",children:y.jsxs("span",{className:"bpConversationHistoryConversationPreview",children:[m,": ",h]})})]})]}),p<a.length-1&&y.jsx("div",{className:"bpConversationHistorySeparator"})]},c)})}),y.jsxs("button",{className:"bpConversationHistoryNewConversationButton",onClick:t,children:[f["conversationHistory.newConversation"],y.jsx(qT,{className:"bpConversationHistoryNewConversationButtonIcon"})]})]})};$u.displayName="ConversationHistory";const k2=({connected:e,configuration:n,isTyping:t,messages:i,user:r,isLoading:a,isReadOnly:o,disableComposer:s,error:l,participants:f,closeWindow:c,sendMessage:d,addMessageFeedback:p,uploadFile:u,listConversations:m,restartConversation:h,clientId:g,storageKey:v,soundOn:b,toggleSound:k,disableSendButton:w,conversationId:x,expanded:S,onToggleExpand:M,locale:I,onComposerTextChange:O,...T})=>{const{color:P,fontFamily:R,themeMode:z,headerVariant:F,botAvatar:D,botName:L,botDescription:j,composerPlaceholder:N,footer:V,allowFileUpload:_,conversationHistory:$,feedbackEnabled:B,homePageEnabled:C,welcomeHeading:q,welcomeSubtitle:Q,mainCardEnabled:K,mainCardTitle:U,mainCardSubtitle:G,conversationStartersEnabled:ne,conversationStarters:Z,conversationStartersDisplayStyle:re,citationsEnabled:H,language:Y,translations:de}=n,Te={color:P,fontFamily:R,themeMode:z,headerVariant:F},te=E.useMemo(()=>{const J={...de,...I};return Object.keys(J).length?JSON.stringify(J):void 0},[de,I]),pe=E.useMemo(()=>w0(Y,te?JSON.parse(te):void 0),[Y,te]),[ge,ve]=E.useState("chat"),Ae=E.useRef(1),Le=E.useRef(null),Fe=()=>{var J,oe;(oe=(J=Le.current)==null?void 0:J.querySelector(".bpComposerInput"))==null||oe.focus()},$e=J=>{Ae.current=J==="conversations"?-1:1,ve(J)},ae=v2({clientId:g,listConversations:m,userCredentials:r});E.useEffect(()=>{ge==="conversations"&&ae.refresh()},[ge]);const fe=E.useMemo(()=>r?hp(i,f,r.userId,L,D):[],[D,L,i,r,f]),W=E.useMemo(()=>Nw(i),[i]);return y.jsxs(DF,{value:pe,children:[y.jsx(lw,{...Te}),y.jsx(hu,{allowFileUpload:_,uploadFile:u,storageKey:v,conversationId:x,...T,children:l||ae.error?y.jsx(Gw,{error:l||ae.error,restartConversation:h,closeWindow:c}):y.jsx("div",{style:{position:"relative",display:"flex",flexDirection:"column",flexGrow:1,minHeight:0,overflowX:"clip",overflowY:"visible"},children:y.jsx(kt,{initial:!1,custom:Ae.current,children:ge==="conversations"?y.jsx(Jn,{initial:{x:"-100%",filter:"blur(4px)"},animate:{x:0,filter:"blur(0px)"},exit:{x:"-100%",filter:"blur(4px)"},transition:{type:"tween",duration:.25,ease:[.4,0,.2,1]},style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",overflow:"hidden",background:"var(--bpGray-25)"},children:y.jsx($u,{onClose:c,conversations:ae.conversations,isLoading:ae.isLoading,onNewConversation:()=>{h==null||h(),$e("chat")},onConversationClick:J=>{h==null||h(J),$e("chat")},botAvatar:D,botName:L})},"conversations"):y.jsxs(Jn,{ref:Le,initial:{x:"100%",filter:"blur(4px)"},animate:{x:0,filter:"blur(0px)"},exit:{x:"100%",filter:"blur(4px)"},transition:{type:"tween",duration:.25,ease:[.4,0,.2,1]},style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",overflowX:"clip",overflowY:"visible",background:"var(--bpGray-25)"},children:[y.jsx(Dw,{showConversationHistory:$===!1?void 0:()=>$e("conversations"),closeWindow:c,configuration:n,clientId:g,soundOn:b,toggleSound:k,expanded:S,onToggleExpand:M,hitlStatus:W}),a?y.jsx(qw,{}):y.jsx(wu,{botAvatar:D,botName:L,botDescription:j,isTyping:t,sendMessage:d,hitlWaiting:W.mode==="waiting"&&!W.hidden?{since:W.since,message:W.message}:void 0,citationsEnabled:H===!0,addMessageFeedback:B?p:void 0,homePageEnabled:C,welcomeHeading:q,welcomeSubtitle:Q,mainCardEnabled:K,mainCardTitle:U,mainCardSubtitle:G,onMainCardClick:Fe,conversationStartersEnabled:ne,conversationStarters:Z,conversationStartersDisplayStyle:re,messages:fe}),y.jsx(Tk,{sendMessage:d,uploadFile:u,connected:e,isReadOnly:o,disableComposer:s,footer:V,composerPlaceholder:N,allowFileUpload:_,storageKey:v,disableSendButton:w,conversationId:x,onTextChange:O})]},"chat")})})})]})};function Qz({configuration:e,storageKey:n,clientId:t,onMessageSent:i,...r}){const{messages:a,participants:o,sendMessage:s,uploadFile:l,conversationId:f,status:c,error:d,isTyping:p}=n2(),{emitter:u}=Vt(),m=E.useCallback((...S)=>{try{u.emit("messageSent",S[0]),i==null||i(S[0],f)}catch{}return s(...S)},[f,u,i,s]),{openConversation:h,listConversations:g}=t2(),{userCredentials:v}=e2(),{soundOn:b,toggleSound:k}=_u({storageKey:n,soundEnabled:e==null?void 0:e.soundEnabled}),w=(e==null?void 0:e.agentPresenceEnabled)===!0,{onTextChange:x}=b2({enabled:w});return y2({enabled:w,connected:c==="connected"}),y.jsx(k2,{configuration:e??{},user:v,isLoading:c==="connecting",isTyping:p,onComposerTextChange:x,connected:c==="connected"?!0:c==="disconnected"?!1:void 0,messages:a,sendMessage:m,uploadFile:l,listConversations:g,restartConversation:h,participants:o,error:d,clientId:t,soundOn:b,toggleSound:k,conversationId:f,storageKey:n,...r})}const Xz=({clientId:e,storageKey:n,configuration:t,apiUrl:i,user:r,conversationId:a,...o})=>{const s=n||`bp-webchat-${e}`;return y.jsx(Pw,{clientId:e,apiUrl:i,userCredentials:r,conversationId:a,storageKey:s,storageLocation:t==null?void 0:t.storageLocation,adminSecret:t==null?void 0:t.adminSecret,children:y.jsx(Qz,{configuration:t,storageKey:s,clientId:e,...o})})};function qt(e,n,{checkForDefaultPrevented:t=!0}={}){return function(r){if(e==null||e(r),t===!1||!r.defaultPrevented)return n==null?void 0:n(r)}}function eB(e,n){const t=A.createContext(n),i=a=>{const{children:o,...s}=a,l=A.useMemo(()=>s,Object.values(s));return y.jsx(t.Provider,{value:l,children:o})};i.displayName=e+"Provider";function r(a){const o=A.useContext(t);if(o)return o;if(n!==void 0)return n;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[i,r]}function nB(e,n=[]){let t=[];function i(a,o){const s=A.createContext(o),l=t.length;t=[...t,o];const f=d=>{var v;const{scope:p,children:u,...m}=d,h=((v=p==null?void 0:p[e])==null?void 0:v[l])||s,g=A.useMemo(()=>m,Object.values(m));return y.jsx(h.Provider,{value:g,children:u})};f.displayName=a+"Provider";function c(d,p){var h;const u=((h=p==null?void 0:p[e])==null?void 0:h[l])||s,m=A.useContext(u);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${a}\``)}return[f,c]}const r=()=>{const a=t.map(o=>A.createContext(o));return function(s){const l=(s==null?void 0:s[e])||a;return A.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return r.scopeName=e,[i,tB(r,...n)]}function tB(...e){const n=e[0];if(e.length===1)return n;const t=()=>{const i=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(a){const o=i.reduce((s,{useScope:l,scopeName:f})=>{const d=l(a)[`__scope${f}`];return{...s,...d}},{});return A.useMemo(()=>({[`__scope${n.scopeName}`]:o}),[o])}};return t.scopeName=n.scopeName,t}var iB=A[" useId ".trim().toString()]||(()=>{}),rB=0;function Ru(e){const[n,t]=A.useState(iB());return Kt(()=>{t(i=>i??String(rB++))},[e]),e||(n?`radix-${n}`:"")}var aB=A[" useInsertionEffect ".trim().toString()]||Kt;function oB({prop:e,defaultProp:n,onChange:t=()=>{},caller:i}){const[r,a,o]=sB({defaultProp:n,onChange:t}),s=e!==void 0,l=s?e:r;{const c=A.useRef(e!==void 0);A.useEffect(()=>{const d=c.current;d!==s&&console.warn(`${i} is changing from ${d?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=s},[s,i])}const f=A.useCallback(c=>{var d;if(s){const p=lB(c)?c(e):c;p!==e&&((d=o.current)==null||d.call(o,p))}else a(c)},[s,e,a,o]);return[l,f]}function sB({defaultProp:e,onChange:n}){const[t,i]=A.useState(e),r=A.useRef(t),a=A.useRef(n);return aB(()=>{a.current=n},[n]),A.useEffect(()=>{var o;r.current!==t&&((o=a.current)==null||o.call(a,t),r.current=t)},[t,r]),[t,i,a]}function lB(e){return typeof e=="function"}function w2(e){const n=fB(e),t=A.forwardRef((i,r)=>{const{children:a,...o}=i,s=A.Children.toArray(a),l=s.find(dB);if(l){const f=l.props.children,c=s.map(d=>d===l?A.Children.count(f)>1?A.Children.only(null):A.isValidElement(f)?f.props.children:null:d);return y.jsx(n,{...o,ref:r,children:A.isValidElement(f)?A.cloneElement(f,void 0,c):null})}return y.jsx(n,{...o,ref:r,children:a})});return t.displayName=`${e}.Slot`,t}function fB(e){const n=A.forwardRef((t,i)=>{const{children:r,...a}=t;if(A.isValidElement(r)){const o=pB(r),s=uB(a,r.props);return r.type!==A.Fragment&&(s.ref=i?Vs(i,o):o),A.cloneElement(r,s)}return A.Children.count(r)>1?A.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var cB=Symbol("radix.slottable");function dB(e){return A.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===cB}function uB(e,n){const t={...n};for(const i in n){const r=e[i],a=n[i];/^on[A-Z]/.test(i)?r&&a?t[i]=(...s)=>{const l=a(...s);return r(...s),l}:r&&(t[i]=r):i==="style"?t[i]={...r,...a}:i==="className"&&(t[i]=[r,a].filter(Boolean).join(" "))}return{...e,...t}}function pB(e){var i,r;let n=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,t=n&&"isReactWarning"in n&&n.isReactWarning;return t?e.ref:(n=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,t=n&&"isReactWarning"in n&&n.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var mB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ut=mB.reduce((e,n)=>{const t=w2(`Primitive.${n}`),i=A.forwardRef((r,a)=>{const{asChild:o,...s}=r,l=o?t:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),y.jsx(l,{...s,ref:a})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{});function hB(e,n){e&&np.flushSync(()=>e.dispatchEvent(n))}function gB(e,n=globalThis==null?void 0:globalThis.document){const t=Ci(e);A.useEffect(()=>{const i=r=>{r.key==="Escape"&&t(r)};return n.addEventListener("keydown",i,{capture:!0}),()=>n.removeEventListener("keydown",i,{capture:!0})},[t,n])}var vB="DismissableLayer",ju="dismissableLayer.update",bB="dismissableLayer.pointerDownOutside",yB="dismissableLayer.focusOutside",_2,x2=A.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),S2=A.forwardRef((e,n)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:i,onPointerDownOutside:r,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...l}=e,f=A.useContext(x2),[c,d]=A.useState(null),p=(c==null?void 0:c.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,u]=A.useState({}),m=Yt(n,M=>d(M)),h=Array.from(f.layers),[g]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),v=h.indexOf(g),b=c?h.indexOf(c):-1,k=f.layersWithOutsidePointerEventsDisabled.size>0,w=b>=v,x=_B(M=>{const I=M.target,O=[...f.branches].some(T=>T.contains(I));!w||O||(r==null||r(M),o==null||o(M),M.defaultPrevented||s==null||s())},p),S=xB(M=>{const I=M.target;[...f.branches].some(T=>T.contains(I))||(a==null||a(M),o==null||o(M),M.defaultPrevented||s==null||s())},p);return gB(M=>{b===f.layers.size-1&&(i==null||i(M),!M.defaultPrevented&&s&&(M.preventDefault(),s()))},p),A.useEffect(()=>{if(c)return t&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(_2=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(c)),f.layers.add(c),C2(),()=>{t&&f.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=_2)}},[c,p,t,f]),A.useEffect(()=>()=>{c&&(f.layers.delete(c),f.layersWithOutsidePointerEventsDisabled.delete(c),C2())},[c,f]),A.useEffect(()=>{const M=()=>u({});return document.addEventListener(ju,M),()=>document.removeEventListener(ju,M)},[]),y.jsx(Ut.div,{...l,ref:m,style:{pointerEvents:k?w?"auto":"none":void 0,...e.style},onFocusCapture:qt(e.onFocusCapture,S.onFocusCapture),onBlurCapture:qt(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:qt(e.onPointerDownCapture,x.onPointerDownCapture)})});S2.displayName=vB;var kB="DismissableLayerBranch",wB=A.forwardRef((e,n)=>{const t=A.useContext(x2),i=A.useRef(null),r=Yt(n,i);return A.useEffect(()=>{const a=i.current;if(a)return t.branches.add(a),()=>{t.branches.delete(a)}},[t.branches]),y.jsx(Ut.div,{...e,ref:r})});wB.displayName=kB;function _B(e,n=globalThis==null?void 0:globalThis.document){const t=Ci(e),i=A.useRef(!1),r=A.useRef(()=>{});return A.useEffect(()=>{const a=s=>{if(s.target&&!i.current){let l=function(){E2(bB,t,f,{discrete:!0})};const f={originalEvent:s};s.pointerType==="touch"?(n.removeEventListener("click",r.current),r.current=l,n.addEventListener("click",r.current,{once:!0})):l()}else n.removeEventListener("click",r.current);i.current=!1},o=window.setTimeout(()=>{n.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),n.removeEventListener("pointerdown",a),n.removeEventListener("click",r.current)}},[n,t]),{onPointerDownCapture:()=>i.current=!0}}function xB(e,n=globalThis==null?void 0:globalThis.document){const t=Ci(e),i=A.useRef(!1);return A.useEffect(()=>{const r=a=>{a.target&&!i.current&&E2(yB,t,{originalEvent:a},{discrete:!1})};return n.addEventListener("focusin",r),()=>n.removeEventListener("focusin",r)},[n,t]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function C2(){const e=new CustomEvent(ju);document.dispatchEvent(e)}function E2(e,n,t,{discrete:i}){const r=t.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:t});n&&r.addEventListener(e,n,{once:!0}),i?hB(r,a):r.dispatchEvent(a)}var Hu="focusScope.autoFocusOnMount",Vu="focusScope.autoFocusOnUnmount",T2={bubbles:!1,cancelable:!0},SB="FocusScope",A2=A.forwardRef((e,n)=>{const{loop:t=!1,trapped:i=!1,onMountAutoFocus:r,onUnmountAutoFocus:a,...o}=e,[s,l]=A.useState(null),f=Ci(r),c=Ci(a),d=A.useRef(null),p=Yt(n,h=>l(h)),u=A.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;A.useEffect(()=>{if(i){let h=function(k){if(u.paused||!s)return;const w=k.target;s.contains(w)?d.current=w:Gt(d.current,{select:!0})},g=function(k){if(u.paused||!s)return;const w=k.relatedTarget;w!==null&&(s.contains(w)||Gt(d.current,{select:!0}))},v=function(k){if(document.activeElement===document.body)for(const x of k)x.removedNodes.length>0&&Gt(s)};document.addEventListener("focusin",h),document.addEventListener("focusout",g);const b=new MutationObserver(v);return s&&b.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",g),b.disconnect()}}},[i,s,u.paused]),A.useEffect(()=>{if(s){I2.add(u);const h=document.activeElement;if(!s.contains(h)){const v=new CustomEvent(Hu,T2);s.addEventListener(Hu,f),s.dispatchEvent(v),v.defaultPrevented||(CB(FB(M2(s)),{select:!0}),document.activeElement===h&&Gt(s))}return()=>{s.removeEventListener(Hu,f),setTimeout(()=>{const v=new CustomEvent(Vu,T2);s.addEventListener(Vu,c),s.dispatchEvent(v),v.defaultPrevented||Gt(h??document.body,{select:!0}),s.removeEventListener(Vu,c),I2.remove(u)},0)}}},[s,f,c,u]);const m=A.useCallback(h=>{if(!t&&!i||u.paused)return;const g=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,v=document.activeElement;if(g&&v){const b=h.currentTarget,[k,w]=EB(b);k&&w?!h.shiftKey&&v===w?(h.preventDefault(),t&&Gt(k,{select:!0})):h.shiftKey&&v===k&&(h.preventDefault(),t&&Gt(w,{select:!0})):v===b&&h.preventDefault()}},[t,i,u.paused]);return y.jsx(Ut.div,{tabIndex:-1,...o,ref:p,onKeyDown:m})});A2.displayName=SB;function CB(e,{select:n=!1}={}){const t=document.activeElement;for(const i of e)if(Gt(i,{select:n}),document.activeElement!==t)return}function EB(e){const n=M2(e),t=F2(n,e),i=F2(n.reverse(),e);return[t,i]}function M2(e){const n=[],t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const r=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||r?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)n.push(t.currentNode);return n}function F2(e,n){for(const t of e)if(!TB(t,{upTo:n}))return t}function TB(e,{upTo:n}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(n!==void 0&&e===n)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function AB(e){return e instanceof HTMLInputElement&&"select"in e}function Gt(e,{select:n=!1}={}){if(e&&e.focus){const t=document.activeElement;e.focus({preventScroll:!0}),e!==t&&AB(e)&&n&&e.select()}}var I2=MB();function MB(){let e=[];return{add(n){const t=e[0];n!==t&&(t==null||t.pause()),e=P2(e,n),e.unshift(n)},remove(n){var t;e=P2(e,n),(t=e[0])==null||t.resume()}}}function P2(e,n){const t=[...e],i=t.indexOf(n);return i!==-1&&t.splice(i,1),t}function FB(e){return e.filter(n=>n.tagName!=="A")}function IB(e,n){return A.useReducer((t,i)=>n[t][i]??t,e)}var Wu=e=>{const{present:n,children:t}=e,i=PB(n),r=typeof t=="function"?t({present:i.isPresent}):A.Children.only(t),a=Yt(i.ref,OB(r));return typeof t=="function"||i.isPresent?A.cloneElement(r,{ref:a}):null};Wu.displayName="Presence";function PB(e){const[n,t]=A.useState(),i=A.useRef(null),r=A.useRef(e),a=A.useRef("none"),o=e?"mounted":"unmounted",[s,l]=IB(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return A.useEffect(()=>{const f=Is(i.current);a.current=s==="mounted"?f:"none"},[s]),Kt(()=>{const f=i.current,c=r.current;if(c!==e){const p=a.current,u=Is(f);e?l("MOUNT"):u==="none"||(f==null?void 0:f.display)==="none"?l("UNMOUNT"):l(c&&p!==u?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,l]),Kt(()=>{if(n){let f;const c=n.ownerDocument.defaultView??window,d=u=>{const h=Is(i.current).includes(CSS.escape(u.animationName));if(u.target===n&&h&&(l("ANIMATION_END"),!r.current)){const g=n.style.animationFillMode;n.style.animationFillMode="forwards",f=c.setTimeout(()=>{n.style.animationFillMode==="forwards"&&(n.style.animationFillMode=g)})}},p=u=>{u.target===n&&(a.current=Is(i.current))};return n.addEventListener("animationstart",p),n.addEventListener("animationcancel",d),n.addEventListener("animationend",d),()=>{c.clearTimeout(f),n.removeEventListener("animationstart",p),n.removeEventListener("animationcancel",d),n.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[n,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:A.useCallback(f=>{i.current=f?getComputedStyle(f):null,t(f)},[])}}function Is(e){return(e==null?void 0:e.animationName)||"none"}function OB(e){var i,r;let n=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,t=n&&"isReactWarning"in n&&n.isReactWarning;return t?e.ref:(n=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,t=n&&"isReactWarning"in n&&n.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var qu=0;function DB(){A.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??O2()),document.body.insertAdjacentElement("beforeend",e[1]??O2()),qu++,()=>{qu===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(n=>n.remove()),qu--}},[])}function O2(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Ps="right-scroll-bar-position",Os="width-before-scroll-bar",NB="with-scroll-bars-hidden",LB="--removed-body-scroll-bar-size";function Uu(e,n){return typeof e=="function"?e(n):e&&(e.current=n),e}function zB(e,n){var t=E.useState(function(){return{value:e,callback:n,facade:{get current(){return t.value},set current(i){var r=t.value;r!==i&&(t.value=i,t.callback(i,r))}}}})[0];return t.callback=n,t.facade}var BB=typeof window<"u"?A.useLayoutEffect:A.useEffect,D2=new WeakMap;function $B(e,n){var t=zB(null,function(i){return e.forEach(function(r){return Uu(r,i)})});return BB(function(){var i=D2.get(t);if(i){var r=new Set(i),a=new Set(e),o=t.current;r.forEach(function(s){a.has(s)||Uu(s,null)}),a.forEach(function(s){r.has(s)||Uu(s,o)})}D2.set(t,e)},[e]),t}function RB(e){return e}function jB(e,n){n===void 0&&(n=RB);var t=[],i=!1,r={read:function(){if(i)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return t.length?t[t.length-1]:e},useMedium:function(a){var o=n(a,i);return t.push(o),function(){t=t.filter(function(s){return s!==o})}},assignSyncMedium:function(a){for(i=!0;t.length;){var o=t;t=[],o.forEach(a)}t={push:function(s){return a(s)},filter:function(){return t}}},assignMedium:function(a){i=!0;var o=[];if(t.length){var s=t;t=[],s.forEach(a),o=t}var l=function(){var c=o;o=[],c.forEach(a)},f=function(){return Promise.resolve().then(l)};f(),t={push:function(c){o.push(c),f()},filter:function(c){return o=o.filter(c),t}}}};return r}function HB(e){e===void 0&&(e={});var n=jB(null);return n.options=Dn({async:!0,ssr:!1},e),n}var N2=function(e){var n=e.sideCar,t=Zv(e,["sideCar"]);if(!n)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=n.read();if(!i)throw new Error("Sidecar medium not found");return A.createElement(i,Dn({},t))};N2.isSideCarExport=!0;function VB(e,n){return e.useMedium(n),N2}var L2=HB(),Gu=function(){},Ds=A.forwardRef(function(e,n){var t=A.useRef(null),i=A.useState({onScrollCapture:Gu,onWheelCapture:Gu,onTouchMoveCapture:Gu}),r=i[0],a=i[1],o=e.forwardProps,s=e.children,l=e.className,f=e.removeScrollBar,c=e.enabled,d=e.shards,p=e.sideCar,u=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,v=e.as,b=v===void 0?"div":v,k=e.gapMode,w=Zv(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=p,S=$B([t,n]),M=Dn(Dn({},w),r);return A.createElement(A.Fragment,null,c&&A.createElement(x,{sideCar:L2,removeScrollBar:f,shards:d,noRelative:u,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:t,gapMode:k}),o?A.cloneElement(A.Children.only(s),Dn(Dn({},M),{ref:S})):A.createElement(b,Dn({},M,{className:l,ref:S}),s))});Ds.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Ds.classNames={fullWidth:Os,zeroRight:Ps};var WB=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function qB(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var n=WB();return n&&e.setAttribute("nonce",n),e}function UB(e,n){e.styleSheet?e.styleSheet.cssText=n:e.appendChild(document.createTextNode(n))}function GB(e){var n=document.head||document.getElementsByTagName("head")[0];n.appendChild(e)}var KB=function(){var e=0,n=null;return{add:function(t){e==0&&(n=qB())&&(UB(n,t),GB(n)),e++},remove:function(){e--,!e&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}}},YB=function(){var e=KB();return function(n,t){A.useEffect(function(){return e.add(n),function(){e.remove()}},[n&&t])}},z2=function(){var e=YB(),n=function(t){var i=t.styles,r=t.dynamic;return e(i,r),null};return n},JB={left:0,top:0,right:0,gap:0},Ku=function(e){return parseInt(e||"",10)||0},ZB=function(e){var n=window.getComputedStyle(document.body),t=n[e==="padding"?"paddingLeft":"marginLeft"],i=n[e==="padding"?"paddingTop":"marginTop"],r=n[e==="padding"?"paddingRight":"marginRight"];return[Ku(t),Ku(i),Ku(r)]},QB=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return JB;var n=ZB(e),t=document.documentElement.clientWidth,i=window.innerWidth;return{left:n[0],top:n[1],right:n[2],gap:Math.max(0,i-t+n[2]-n[0])}},XB=z2(),gr="data-scroll-locked",e$=function(e,n,t,i){var r=e.left,a=e.top,o=e.right,s=e.gap;return t===void 0&&(t="margin"),`
|
|
1209
|
+
*--------------------------------------------------------------------------------------------*/const iz={damping:.7,stiffness:.05,mass:1.25},rz=70,az=1e3/60,oz=350;let As=!1;(f_=globalThis.document)==null||f_.addEventListener("mousedown",()=>{As=!0}),(c_=globalThis.document)==null||c_.addEventListener("mouseup",()=>{As=!1}),(d_=globalThis.document)==null||d_.addEventListener("click",()=>{As=!1});const sz=(e={})=>{const[n,t]=E.useState(!1),[i,r]=E.useState(e.initial!==!1),[a,o]=E.useState(!1),s=E.useRef(null);s.current=e;const l=E.useCallback(()=>{var w;if(!As)return!1;const b=window.getSelection();if(!b||!b.rangeCount)return!1;const k=b.getRangeAt(0);return k.commonAncestorContainer.contains(g.current)||((w=g.current)==null?void 0:w.contains(k.commonAncestorContainer))},[]),f=E.useCallback(b=>{d.isAtBottom=b,r(b)},[]),c=E.useCallback(b=>{d.escapedFromLock=b,t(b)},[]),d=E.useMemo(()=>{let b;return{escapedFromLock:n,isAtBottom:i,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){var k;return((k=g.current)==null?void 0:k.scrollTop)??0},set scrollTop(k){if(g.current){const{scrollBehavior:w}=getComputedStyle(g.current);w!=="auto"&&(g.current.style.scrollBehavior="auto"),g.current.scrollTop=k,d.ignoreScrollToTop=g.current.scrollTop,w!=="auto"&&(g.current.style.scrollBehavior=w)}},get targetScrollTop(){return!g.current||!v.current?0:g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!v.current)return 0;const{targetScrollTop:k}=this;if(!e.targetScrollTop)return k;if((b==null?void 0:b.targetScrollTop)===k)return b.calculatedScrollTop;const w=Math.max(Math.min(e.targetScrollTop(k,{scrollElement:g.current,contentElement:v.current}),k),0);return b={targetScrollTop:k,calculatedScrollTop:w},requestAnimationFrame(()=>{b=void 0}),w},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=rz}}},[]),p=E.useCallback((b={})=>{var O;typeof b=="string"&&(b={animation:b}),b.preserveScrollPosition||f(!0);const k=Date.now()+(Number(b.wait)||0),w=yu(s.current,b.animation),{ignoreEscapes:x=!1}=b;let S,M=d.calculatedTargetScrollTop;b.duration instanceof Promise?b.duration.finally(()=>{S=Date.now()}):S=k+(b.duration??0);const I=async()=>{const T=new Promise(requestAnimationFrame).then(()=>{var F;if(!d.isAtBottom)return d.animation=void 0,!1;const{scrollTop:P}=d,R=performance.now(),z=(R-(d.lastTick??R))/az;if(d.animation||(d.animation={behavior:w,promise:T,ignoreEscapes:x}),d.animation.behavior===w&&(d.lastTick=R),l()||k>Date.now())return I();if(P<Math.min(M,d.calculatedTargetScrollTop)){if(((F=d.animation)==null?void 0:F.behavior)===w){if(w==="instant")return d.scrollTop=d.calculatedTargetScrollTop,I();d.velocity=(w.damping*d.velocity+w.stiffness*d.scrollDifference)/w.mass,d.accumulated+=d.velocity*z,d.scrollTop+=d.accumulated,d.scrollTop!==P&&(d.accumulated=0)}return I()}return S>Date.now()?(M=d.calculatedTargetScrollTop,I()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?p({animation:yu(s.current,s.current.resize),ignoreEscapes:x,duration:Math.max(0,S-Date.now())||void 0}):d.isAtBottom)});return T.then(P=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),P))};return b.wait!==!0&&(d.animation=void 0),((O=d.animation)==null?void 0:O.behavior)===w?d.animation.promise:I()},[f,l,d]),u=E.useCallback(()=>{c(!0),f(!1)},[c,f]),m=E.useCallback(({target:b})=>{if(b!==g.current)return;const{scrollTop:k,ignoreScrollToTop:w}=d;let{lastScrollTop:x=k}=d;d.lastScrollTop=k,d.ignoreScrollToTop=void 0,w&&w>k&&(x=w),o(d.isNearBottom),setTimeout(()=>{var I;if(d.resizeDifference||k===w)return;if(l()){c(!0),f(!1);return}const S=k>x,M=k<x;if((I=d.animation)!=null&&I.ignoreEscapes){d.scrollTop=x;return}M&&(c(!0),f(!1)),S&&c(!1),!d.escapedFromLock&&d.isNearBottom&&f(!0)},1)},[c,f,l,d]),h=E.useCallback(({target:b,deltaY:k})=>{var x;let w=b;for(;!["scroll","auto"].includes(getComputedStyle(w).overflow);){if(!w.parentElement)return;w=w.parentElement}w===g.current&&k<0&&g.current.scrollHeight>g.current.clientHeight&&!((x=d.animation)!=null&&x.ignoreEscapes)&&(c(!0),f(!1))},[c,f,d]),g=$w(b=>{var k,w;(k=g.current)==null||k.removeEventListener("scroll",m),(w=g.current)==null||w.removeEventListener("wheel",h),b==null||b.addEventListener("scroll",m,{passive:!0}),b==null||b.addEventListener("wheel",h,{passive:!0})},[]),v=$w(b=>{var w,x;if((w=d.resizeObserver)==null||w.disconnect(),!b)return;let k;d.resizeObserver=new ResizeObserver(([S])=>{const{height:M}=S.contentRect,I=M-(k??M);if(d.resizeDifference=I,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),o(d.isNearBottom),I>=0){const O=yu(s.current,k?s.current.resize:s.current.initial);p({animation:O,wait:!0,preserveScrollPosition:!0,duration:O==="instant"?void 0:oz})}else d.isNearBottom&&(c(!1),f(!0));k=M,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===I&&(d.resizeDifference=0)},1)})}),(x=d.resizeObserver)==null||x.observe(b)},[]);return{contentRef:v,scrollRef:g,scrollToBottom:p,stopScroll:u,isAtBottom:i||a,isNearBottom:a,escapedFromLock:n,state:d}};function $w(e,n){const t=E.useCallback(i=>(t.current=i,e(i)),n);return t}const bu=new Map;function yu(...e){const n={...iz};let t=!1;for(const r of e){if(r==="instant"){t=!0;continue}typeof r=="object"&&(t=!1,n.damping=r.damping??n.damping,n.stiffness=r.stiffness??n.stiffness,n.mass=r.mass??n.mass)}const i=JSON.stringify(n);return bu.has(i)||bu.set(i,Object.freeze(n)),t?"instant":bu.get(i)}const lz=({botAvatar:e,botName:n,botDescription:t})=>y.jsxs("li",{className:"bpReset bpMessageListMarqueeContainer",children:[y.jsx(dt,{src:e,containerClassName:"bpReset bpMessageListMarqueeAvatarContainer",imageClassName:"bpMessageListMarqueeAvatarImage",fallbackClassName:"bpMessageListMarqueeAvatarFallback",children:y.jsx(Ea,{})}),y.jsxs("div",{className:"bpMessageListMarqueeContent",children:[y.jsx("h1",{className:"bpMessageListMarqueeTitle",children:n||"Bot"}),t&&y.jsx("p",{className:"bpMessageListMarqueeDescription",children:t})]})]}),Rw={sparkles:Ag,"message-circle":LT,package:RT,truck:nA,zap:cA,"rotate-ccw":Eg,headset:TT,"circle-help":vT,"credit-card":wT,gift:CT,user:iA,users:rA,settings:UT,search:WT,calendar:mT,mail:DT,star:ZT,phone:HT,"map-pin":Cg,"shopping-cart":YT,"shopping-bag":KT,tag:QT,wallet:sA,receipt:VT,"file-text":_g,"book-open":uT,"life-buoy":PT,shield:GT,bell:dT,heart:AT,info:IT,clock:yT,globe:xg,home:MT,wrench:fA,send:Tg},fz=Object.keys(Rw),cz=Ag,jw=e=>e&&Rw[e]||cz,ku=E.memo(({enabled:e,starters:n,displayStyle:t="cards",sendMessage:i})=>{const r=E.useMemo(()=>(n??[]).filter(o=>o.enabled!==!1),[n]);if(!e||r.length===0||!i)return null;const a=o=>{var l;const s=o.text.trim()||((l=o.title)==null?void 0:l.trim())||"";s&&i({type:"text",text:s},{source:"starter"})};return y.jsx("ul",{className:"bpReset bpStartersContainer","data-display-style":t,children:r.map(o=>{const s=o.title||o.text,l=t!=="chips",f=t!=="chips"&&!!o.description,c=jw(o.icon);return y.jsx("li",{className:"bpReset bpStartersItem",children:y.jsxs("button",{type:"button",className:pi("bpReset bpStartersButton"),onClick:()=>a(o),title:s,children:[l&&y.jsx("span",{className:"bpStartersIcon","aria-hidden":"true",children:y.jsx(c,{})}),y.jsxs("span",{className:"bpStartersContent",children:[y.jsx("span",{className:"bpStartersTitle",children:s}),f&&y.jsx("span",{className:"bpStartersDescription",children:o.description})]}),t==="cards"&&y.jsx("span",{className:"bpStartersChevron","aria-hidden":"true",children:y.jsx(wg,{})})]})},o.id)})})});ku.displayName="Starters";const Hw=({heading:e,subtitle:n})=>y.jsxs("div",{className:"bpReset bpWelcomeHero",children:[y.jsx("h1",{className:"bpWelcomeHeroHeading",children:e}),n&&y.jsx("p",{className:"bpWelcomeHeroSubtitle",children:n})]}),Vw=({title:e,subtitle:n,botAvatar:t,botName:i,onClick:r})=>y.jsxs("button",{type:"button",className:"bpReset bpMainCard",onClick:r,children:[y.jsxs("div",{className:"bpMainCardContent",children:[y.jsx("span",{className:"bpMainCardTitle",children:e}),n&&y.jsx("span",{className:"bpMainCardSubtitle",children:n})]}),y.jsx(dt,{src:t,containerClassName:"bpReset bpMainCardAvatarContainer",imageClassName:"bpMainCardAvatarImage",fallbackClassName:"bpMainCardAvatarFallback",children:i||y.jsx(Ea,{})})]}),Ww=5*60*1e3,dz=({since:e,message:n})=>{const t=un(),[i,r]=E.useState(()=>Date.now()-e.getTime()>=Ww);return E.useEffect(()=>{if(i)return;const a=Ww-(Date.now()-e.getTime()),o=setTimeout(()=>r(!0),Math.max(0,a));return()=>clearTimeout(o)},[i,e]),y.jsxs("div",{className:"bpReset bpHitlWaiting bpFont"+(i?" bpHitlWaitingLong":""),children:[y.jsxs("div",{className:"bpHitlWaitingDots","aria-hidden":!0,children:[y.jsx("i",{}),y.jsx("i",{}),y.jsx("i",{})]}),y.jsx("div",{className:"bpHitlWaitingTitle",children:i?t["hitl.waiting.longTitle"]:(n==null?void 0:n.trim())||t["hitl.waiting.title"]}),y.jsx("div",{className:"bpHitlWaitingSub",children:i?t["hitl.waiting.longSub"]:t["hitl.waiting.sub"]})]})},wu=E.memo(({className:e,messages:n=[],isTyping:t,botAvatar:i,botName:r,botDescription:a,sendMessage:o,hitlWaiting:s,addMessageFeedback:l,citationsEnabled:f,showMarquee:c=!0,showDateSystemMessage:d=!0,showMessageStatus:p=!0,showIncomingMessageAvatar:u=!0,showOutgoingMessageAvatar:m=!1,homePageEnabled:h,welcomeHeading:g,welcomeSubtitle:v,mainCardEnabled:b,mainCardTitle:k,mainCardSubtitle:w,onMainCardClick:x,conversationStartersEnabled:S,conversationStarters:M,conversationStartersDisplayStyle:I,renderers:O,...T})=>{var K;const P=un(),R={today:P["date.today"],yesterday:P["date.yesterday"]},z=E.useMemo(()=>{const U=n.filter(H=>!QL(H)),G=U.findIndex(H=>{var Y;return((Y=Ts(H.metadata))==null?void 0:Y.kind)==="ticket_closed"}),ne=U.findIndex(H=>{var Y;return((Y=Ts(H.metadata))==null?void 0:Y.kind)==="csat_request"});if(G===-1||ne===-1||ne>G)return U;const Z=[...U],[re]=Z.splice(ne,1);return re?(Z.splice(G,0,re),Z):U},[n]),F=E.useMemo(()=>d?j_(z,"day",R):z,[z,R.today,R.yesterday]),D=E.useMemo(()=>{var G;const U=F.filter(ne=>ne.direction==="outgoing"&&ne.status!=="pending");return(G=U[U.length-1])==null?void 0:G.id},[F]),L=U=>{if(U.direction==="incoming")return u;if(U.direction==="outgoing")return m},j=n.some(U=>{var G;return((G=U.metadata)==null?void 0:G.messageStreamStatus)==="streaming"}),{scrollRef:N,contentRef:V,scrollToBottom:_,isAtBottom:$}=sz({resize:j?"instant":"smooth",initial:"instant"}),B=n.length===0,C=E.useRef(null),q=E.useCallback(U=>{C.current=U,B||N(U)},[B,N]),Q=E.useCallback(U=>{B||V(U)},[B,V]);return E.useEffect(()=>{B&&C.current&&(C.current.scrollTop=0)},[B]),y.jsxs("div",{...T,ref:q,className:pi("bpMessageListContainer",e),children:[y.jsxs("div",{ref:Q,className:"bpMessageListViewport",style:{marginTop:B?0:void 0},children:[c&&!(h&&g)&&y.jsx(lz,{botAvatar:i,botName:r,botDescription:a}),y.jsx(kt,{initial:!1,children:h&&n.length===0&&!t&&y.jsxs(Jn,{animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.3,ease:[.4,0,.2,1]},style:{display:"flex",flexDirection:"column",gap:"var(--bpSpacing-2)",overflow:"hidden"},children:[c&&g&&y.jsx(Hw,{heading:g,subtitle:v}),b&&y.jsx(Vw,{title:k||"Ask a question",subtitle:w,botAvatar:i,botName:r,onClick:x}),y.jsx(ku,{enabled:S,starters:M,displayStyle:I,sendMessage:o})]},"bpWelcome")}),F.map(U=>{var G,ne;return y.jsx(vu,{sendMessage:o,addMessageFeedback:l,citationsEnabled:f,isLastDeliveredMessage:p&&U.id===D,isLastMessage:U.id===((G=z[z.length-1])==null?void 0:G.id),showAvatar:L(U),renderers:O,...U},((ne=U.metadata)==null?void 0:ne.clientMessageId)||U.id)}),s&&y.jsx(dz,{since:s.since,message:s.message}),t&&y.jsx(vu,{id:Oo(),sendMessage:o,direction:"incoming",timestamp:new Date,showAvatar:u,sender:((K=n.filter(U=>U.direction==="incoming").at(-1))==null?void 0:K.sender)??{name:r||"Bot",avatar:i},children:y.jsx(gu,{})})]}),y.jsx(kt,{children:!$&&y.jsx(hD,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"bpMessageListScrollDownButton",onClick:()=>_()},"scroll-down")})]})});wu.displayName="MessageList";const qw=({className:e,...n})=>y.jsx("div",{...n,className:pi(e,"bpReset bpLoader")}),uz={configuration:$T,bot:yg,network:lA,disconnected:tA},Uw={color:"white",backgroundColor:"transparent"};function Gw({error:e,restartConversation:n,closeWindow:t}){const{showInputModal:i}=vc(),r=un(),o={configuration:r["error.configuration"],bot:r["error.bot"],network:r["error.network"],disconnected:r["error.disconnected"]}[e.type]??r["error.unexpected"],s=uz[e.type]??yg,l=async()=>{i?i({title:r["restartConversation.title"],description:r["restartConversation.description"],confirmButtonText:r["restartConversation.confirm"],cancelButtonText:r["restartConversation.cancel"]}).then(()=>n==null?void 0:n()):n==null||n()};return y.jsxs("div",{className:"bpReset bpErrorContainer",children:[y.jsxs("div",{className:"bpErrorHeader",children:[o,y.jsxs("div",{className:"bpErrorHeaderActions",children:[n&&y.jsx(xi,{icon:Eg,label:r["restartConversation.button.ariaLabel"],onClick:l,style:Uw}),t&&y.jsx(xi,{icon:so,label:r["closeButton.ariaLabel"],onClick:t,style:Uw})]})]}),y.jsxs("div",{className:"bpErrorContent",children:[y.jsx(s,{className:"bpErrorIcon"}),y.jsx("div",{className:"bpErrorTitle",children:o}),y.jsx("div",{className:"bpErrorMessage",children:e.message}),e.id&&y.jsx("div",{className:"bpErrorId",children:e.id})]})]})}const Ta=mu.webchat;async function pz(e,n){const{userId:t,conversationId:i,userToken:r,openConversation:a,setClientState:o,setError:s,emitter:l}=n;Ta.warn("handleWebchatError",{userId:t,conversationId:i,type:e.type,message:e.message});const c=[{name:"startNewConversation",predicate:d=>d.message===xl||d.type==="ResourceNotFound",recover:async()=>a({userToken:r})},{name:"reopenConversation",predicate:d=>d.type==="network",recover:async()=>a({userToken:r,conversationId:i})}].find(d=>d.predicate(e));if(!c){Ta.error("no recovery strategy found, setting error state",{userId:t,conversationId:i}),o("error"),s(e);return}Ta.info("attempting recovery",{userId:t,conversationId:i,strategy:c.name});try{await dh(c.recover,3,5e3),Ta.info("recovery successful",{userId:t,conversationId:i}),s(void 0),o("connected")}catch(d){Ta.error("recovery failed",{error:d,userId:t,conversationId:i}),s(ti(d)),o("error"),l.emit("error",d)}}function mz(e,n){return async(...t)=>{try{return await e(...t)}catch(i){await pz(ti(i),n)}}}function Kw(e,n){const t={};for(const[i,r]of Object.entries(e))t[i]=mz(r,n);return t}function Yw({client:e,conversationId:n}){return{sendEvent:async(i,r)=>{if(!e||!n)throw new Error("Cannot send event: client or conversationId not available");await e.createEvent({conversationId:n,payload:{type:"custom",data:i},bindConversation:(r==null?void 0:r.bindConversation)??!0,bindUser:(r==null?void 0:r.bindUser)??!0})}}}function Jw({client:e,conversationId:n,user:t}){return{uploadFile:async r=>{if(!e)throw new Error("Client not initialized");if(!n)throw new Error("No active conversation");if(!t)throw new Error("User not authenticated");const{size:a,name:o}=r,s=await bx(r),l=new Date;l.setDate(l.getDate()+30);const{file:{uploadUrl:f,contentType:c,url:d,id:p}}=await e.createFile({size:a,key:`${Oo(6)}-${r.name}`,accessPolicies:["public_content"],index:!1,tags:{source:"integration",integrationName:"webchat",conversation:n,user:t.userId},expiresAt:l.toISOString()});await fetch(f,{method:"PUT",headers:{"x-amz-tagging":"public=true","content-type":c},body:s});const u=c.split("/").shift()??"",m=Qm(u)?u:"file";return{fileUrl:d,name:o,type:m,fileId:p}}}}function Zw({client:e,conversationId:n,userId:t,setAwaitingResponse:i}){const r=bt(n||"default"),a=r(h=>h.messages),o=r(h=>h.messageStreams),s=r(h=>h.saveMessage),l=r(h=>h.setMessages),f=r(h=>h.clearMessages),c=r(h=>h.updateMessage);return{messages:E.useMemo(()=>{const h=Object.values(o).sort((g,v)=>g.order-v.order).map(g=>g.message);return h.length===0?a:h.reduce((g,v)=>{const b=g.findIndex(k=>k.timestamp>v.timestamp);return b===-1?[...g,v]:[...g.slice(0,b),v,...g.slice(b)]},a)},[o,a]),sendMessage:async h=>{if(!e||!n||!t)throw console.log("Cannot send message: client, conversationId, or userId not available",e,n,t),new Error("Cannot send message: client, conversationId, or userId not available");i==null||i(!0);const g=Oo(),v={id:g,createdAt:new Date().toISOString(),userId:t,conversationId:n,payload:h,metadata:{clientMessageId:g,delivered:!1}},b=vt(v);b.status="pending",s(b),await e.createMessage({conversationId:n,payload:h,metadata:{clientMessageId:g}})},saveMessageFeedback:async(h,g)=>{if(!e)throw new Error("Cannot save feedback: client not available");c(h,{feedback:g.value}),await e.addMessageFeedback({messageId:h,...g})},setMessages:h=>{const g=h.map(v=>vt(v)).filter(Boolean);l(g)},clearMessages:f}}function Qw({client:e,conversationId:n}){const t=dc(n||"default"),i=t(f=>f.participants),r=t(f=>f.setParticipants),a=t(f=>f.addParticipant),o=t(f=>f.removeParticipant),s=t(f=>f.clearParticipants);return{participants:i,setParticipants:r,fetchParticipants:async()=>{if(!e||!n)return;const{participants:f}=await e.listParticipants({conversationId:n});r(f)},clearParticipants:s,addParticipant:a,removeParticipant:o}}const Xw={chatMessageNotification:new URL("data:audio/ogg;base64,T2dnUwACAAAAAAAAAAAVJAEzAAAAAOU+A6UBHgF2b3JiaXMAAAAAASJWAAD/////AH0AAP////+pAU9nZ1MAAAAAAAAAAAAAFSQBMwEAAAD3T/UfDpz////////////////FA3ZvcmJpcwwAAABMYXZmNjEuNy4xMDAEAAAAHwAAAGVuY29kZXI9TGF2YzYxLjE5LjEwMSBsaWJ2b3JiaXMrAAAAZW5jb2RlZF9ieT1BZG9iZSBQcmVtaWVyZSBQcm8gMjAyNS4wIChNYWNpbhcAAAB0aW1lX3JlZmVyZW5jZT0xMjExMDQwMA8AAABkYXRlPTIwMjUtMDgtMDUBBXZvcmJpcyJCQ1YBAEAAABhCECoFrWOOOsgVIYwZoqBCyinHHULQIaMkQ4g6xjXHGGNHuWSKQsmB0JBVAABAAACkHFdQckkt55xzoxhXzHHoIOecc+UgZ8xxCSXnnHOOOeeSco4x55xzoxhXDnIpLeecc4EUR4pxpxjnnHOkHEeKcagY55xzbTG3knLOOeecc+Ygh1JyrjXnnHOkGGcOcgsl55xzxiBnzHHrIOecc4w1t9RyzjnnnHPOOeecc84555xzjDHnnHPOOeecc24x5xZzrjnnnHPOOeccc84555xzIDRkFQCQAACgoSiK4igOEBqyCgDIAAAQQHEUR5EUS7Ecy9EkDQgNWQUAAAEACAAAoEiGpEiKpViOZmmeJnqiKJqiKquyacqyLMuy67ouEBqyCgBIAABQURTFcBQHCA1ZBQBkAAAIYCiKoziO5FiSpVmeB4SGrAIAgAAABAAAUAxHsRRN8STP8jzP8zzP8zzP8zzP8zzP8zzP8zwNCA1ZBQAgAAAAgihkGANCQ1YBAEAAAAghGhlDnVISXAoWQhwRQx1CzkOppYPgKYUlY9JTrEEIIXzvPffee++B0JBVAAAQAABhFDiIgcckCCGEYhQnRHGmIAghhOUkWMp56CQI3YMQQrice8u59957IDRkFQAACADAIIQQQgghhBBCCCmklFJIKaaYYoopxxxzzDHHIIMMMuigk046yaSSTjrKJKOOUmsptRRTTLHlFmOttdacc69BKWOMMcYYY4wxxhhjjDHGGCMIDVkFAIAAABAGGWSQQQghhBRSSCmmmHLMMcccA0JDVgEAgAAAAgAAABxFUiRHciRHkiTJkixJkzzLszzLszxN1ERNFVXVVW3X9m1f9m3f1WXf9mXb1WVdlmXdtW1d1l1d13Vd13Vd13Vd13Vd13Vd14HQkFUAgAQAgI7kOI7kOI7kSI6kSAoQGrIKAJABABAAgKM4iuNIjuRYjiVZkiZplmd5lqd5mqiJHhAasgoAAAQAEAAAAAAAgKIoiqM4jiRZlqZpnqd6oiiaqqqKpqmqqmqapmmapmmapmmapmmapmmapmmapmmapmmapmmapmmapmkCoSGrAAAJAAAdx3EcR3Ecx3EkR5IkIDRkFQAgAwAgAABDURxFcizHkjRLszzL00TP9FxRNnVTV20gNGQVAAAIACAAAAAAAADHczzHczzJkzzLczzHkzxJ0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRNA0JDVgIAZAAAEJOQSk6xV0YpxiS0XiqkFJPUe6iYYkw67alCBikHuYdKIaWg094ypZBSDHunmELIGOqhg5AxhbDX2nPPvfceCA1ZEQBEAQAAxiDGEGPIMSYlgxIxxyRkUiLnnJROSialpFZazKSEmEqLkXNOSiclk1JaC6llkkprJaYCAAACHAAAAiyEQkNWBABRAACIMUgppBRSSjGnmENKKceUY0gp5ZxyTjnHmHQQKucYdA5KpJRyjjmnnHMSMgeVcw5CJp0AAIAABwCAAAuh0JAVAUCcAACAkHOKMQgRYxBCCSmFUFKqnJPSQUmpg5JSSanFklKMlXNSOgkpdRJSKinFWFKKLaRUY2kt19JSjS3GnFuMvYaUYi2p1Vpaq7nFWHOLNffIOUqdlNY6Ka2l1mpNrdXaSWktpNZiaS3G1mLNKcacMymthZZiK6nF2GLLNbWYc2kt1xRjzynGnmusucecgzCt1ZxayznFmHvMseeYcw+Sc5Q6Ka11UlpLrdWaWqs1k9Jaaa3GkFqLLcacW4sxZ1JaLKnFWFqKMcWYc4st19BarinGnFOLOcdag5Kx9l5aqznFmHuKreeYczA2x547SrmW1nourfVecy5C1tyLaC3n1GoPKsaec87B2NyDEK3lnGrsPcXYe+45GNtz8K3W4FvNRcicg9C5+KZ7MEbV2oPMtQiZcxA66CJ08Ml4lGoureVcWus91hp8zTkI0VruKcbeU4u9156bsL0HIVrLPcXYg4ox+JpzMDrnYlStwcecg5C1FqF7L0rnIJSqtQeZa1Ay1yJ08MXooIsvAABgwAEAIMCEMlBoyIoAIE4AgEHIOaUYhEopCKGElEIoKVWMSciYg5IxJ6WUUloIJbWKMQiZY1Iyx6SEEloqJbQSSmmplNJaKKW1llqMKbUWQymphVJaK6W0llqqMbVWY8SYlMw5KZljUkoprZVSWqsck5IxKKmDkEopKcVSUouVc1Iy6Kh0EEoqqcRUUmmtpNJSKaXFklJsKcVUW4u1hlJaLKnEVlJqMbVUW4sx14gxKRlzUjLnpJRSUiultJY5J6WDjkrmoKSSUmulpBQz5qR0DkrKIKNSUootpRJTKKW1klJspaTWWoy1ptRaLSW1VlJqsZQSW4sx1xZLTZ2U1koqMYZSWmsx5ppaizGUElspKcaSSmytxZpbbDmGUlosqcRWSmqx1ZZja7Hm1FKNKbWaW2y5xpRTj7X2nFqrNbVUY2ux5lhbb7XWnDsprYVSWislxZhai7HFWHMoJbaSUmylpBhbbLm2FmMPobRYSmqxpBJjazHmGFuOqbVaW2y5ptRirbX2HFtuPaUWa4ux5tJSjTXX3mNNORUAADDgAAAQYEIZKDRkJQAQBQAAGMMYYxAapZxzTkqDlHPOScmcgxBCSplzEEJIKXNOQkotZc5BSKm1UEpKrcUWSkmptRYLAAAocAAACLBBU2JxgEJDVgIAUQAAiDFKMQahMUYp5yA0xijFGIRKKcack1ApxZhzUDLHnINQSuaccxBKCSGUUkpKIYRSSkmpAACAAgcAgAAbNCUWByg0ZEUAEAUAABhjnDPOIQqdpc5SJKmj1lFrKKUaS4ydxlZ767nTGnttuTeUSo2p1o5ry7nV3mlNPbccCwAAO3AAADuwEAoNWQkA5AEAEMYoxZhzzhmFGHPOOecMUow555xzijHnnIMQQsWYc85BCCFzzjkIoYSSOecchBBK6JyDUEoppXTOQQihlFI65yCEUkopnXMQSimllAIAgAocAAACbBTZnGAkqNCQlQBAHgAAYAxCzklprWHMOQgt1dgwxhyUlGKLnIOQUou5RsxBSCnGoDsoKbUYbPCdhJRaizkHk1KLNefeg0iptZqDzj3VVnPPvfecYqw1595zLwAAd8EBAOzARpHNCUaCCg1ZCQDkAQAQCCnFmHPOGaUYc8w554xSjDHmnHOKMcacc85BxRhjzjkHIWPMOecghJAx5pxzEELonHMOQgghdM45ByGEEDrnoIMQQgidcxBCCCGEAgCAChwAAAJsFNmcYCSo0JCVAEA4AAAAIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEELonHPOOeecc84555xzzjnnnHPOOScAyLfCAcD/wcYZVpLOCkeDCw1ZCQCEAwAACkEopWIQSiklkk46KZ2TUEopkYNSSumklFJKCaWUUkoIpZRSSggdlFJCKaWUUkoppZRSSimllFI6KaWUUkoppZTKOSmlk1JKKaVEzkkpIZRSSimlhFJKKaWUUkoppZRSSimllFJKKaWEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQCALgbHAAgEmycYSXprHA0uNCQlQBASAAAoBRzjkoIKZSQUqiYoo5CKSmkUkoKEWPOSeochVBSKKmDyjkIpaSUQiohdc5BByWFkFIJIZWOOugolFBSKiWU0jkopYQUSkoplZBCSKl0lFIoJZWUQiohlVJKSCWVEEoKnaRUSgqppFRSCJ10kEInJaSSSgqpk5RSKiWllEpKJXRSQioppRBCSqmUEEpIKaVOUkmppBRCKCGFlFJKJaWSSkohlVRCCaWklFIooaRUUkoppZJSKQAA4MABACDACDrJqLIIG0248AAUGrISACADAECUdNZpp0kiCDFFmScNKcYgtaQswxBTkonxFGOMOShGQw4x5JQYF0oIoYNiPCaVQ8pQUbm31DkFxRZjfO+xFwEAAAgCAASEBAAYICiYAQAGBwgjBwIdAQQObQCAgQiZCQwKocFBJgA8QERIBQCJCYrShS4IIYJ0EWTxwIUTN5644YQObRAAAAAAABAA8AEAkFAAERHRzFVYXGBkaGxwdHh8gIQEAAAAAAAIAHwAACQiQERENHMVFhcYGRobHB0eHyAhAQAAAAAAAAAAQEBAAAAAAAAgAAAAQEBPZ2dTAASuMwAAAAAAABUkATMCAAAACYS6sR4BAUQxGR89NxobGiEkKCknJiYmJSUhISEaFgwBAQEAAnyfvULHAlAEJgh2vpgQBMHIyMjIyNhIQOjz+ePz58+fL89xAwYBAFaH//3//7/xNw0MBoNB6qlPfWrUKQng+/0FABAAhLEjKuHFBwA4AHC9Fx4Oh7EwDEOgvnJ3RtV+Op0+nU6n5cyzEwAoltTpwed5dgVKMPoru90zNHGA7F0CP98BAAAAAHl9ePviAgCW+3rugPIDwC6BbWoTAFEAAADh5GpCCACgc+0zxlAAVKddkjDsA14GDoJtf7R+NkE4W23hI5mF3d74iVGvzg9PpA4cCQs66joePTmOfhgl7vNZzYzQADDyz30FAGSvVUZ6wJ4MAKbCGeb4+v5NLIdK3YvrLkCu98uV//FpXQNyKAKAV7r186fTktcJJgjAlVp1fUmaGgtrdAAuDXYJSPs/AAAAAHDnAeHxciEUAB76CvfarGjDzIjALoEd+/0EAAAAQNYeMrkBAF6ZKm8xuw94NtgloHDUCAAAAIAMJ5Qz2iUAvjhKL8lkfmA6wi6BWfNHgiAAAABq4eeqGgCg8+LAAXQAfhgqz2RKHzAVYJeAynEAIQEAALwq6tFbIQAEEIIO8iULngMAXhgajrw3D5iFWhe7BLZNrwCVKAAA0t2TfT8mADx0aMfS4CULeACvA14YWnasNht80ZpdAhv8BEiiAADgcbm4jo0JANAVCTRV6JqQS0OTADoAXhg6zWy+AZ3GsiDRAYJzgiQAAICnb9FLAQAUNQFd44AioMNJICUAfhi67ZRjA2IMSHTAJK0KkgAAAG7W0uLlEgC6KnQdDkgBlAAdJAB+GHpL40hATAASHSC5CZIAAAAGZ3J60ioBoKsBTQKE5KFJIJFAAp4Y+jp7cg4qINEBi+MASQAAAM8rmdZcAKApwFhNPHQkQEBRQwIAnhj6OZ8KIBwDiQ4Q9ApIFAAAQHRFd6FEALA0NaApQAegnPrDA54Y+nN+AYAIJDoAfgIkCgAAcLRlPVsLALqmKqFpHIwUwQEJCwCeKPpzEQA8kOgAyTlBAgAAgPnK3q8jAWAuJFBYOsbAAgCeKPolEQA8rMFCohQAAMxD2BdSAJYFdNThKcCkBQCOgwKeGPpzEQA8rEEhCQAAoCz4MRGA41gaQMBRjACexHugAACeGPqFCAAeugQAAHryFgBdRYGFhGeow8x7AJ4Y+iURADyIigIAliFAAcYWCQC11gGeGPolEQA8UAAAABoODg4=",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Hs&&Hs.tagName.toUpperCase()==="SCRIPT"&&Hs.src||new URL("index.umd.cjs",document.baseURI).href).href};function _u({storageKey:e,soundEnabled:n}){const t=Gv(e||"bp-webchat"),i=t(f=>f.soundOn),r=t(f=>f.toggleSound),a=E.useRef(null),o=E.useRef(n??!1),s=E.useRef(i);E.useEffect(()=>{try{a.current=new Audio,a.current.preload="auto",a.current.src=Xw.chatMessageNotification,a.current.volume=.9}catch(f){console.error("Error loading sound effect:",f),a.current=null}},[]),E.useEffect(()=>{o.current=n??!1},[n]),E.useEffect(()=>{s.current=i},[i]);const l=E.useCallback(()=>{o.current&&s.current&&a.current&&a.current.play().catch(()=>{})},[]);return{soundOn:i,toggleSound:r,playNotificationSound:l}}function hz({apiUrl:e="https://webchat.botpress.dev",clientId:n,storageKey:t,storageLocation:i,adminSecret:r,soundEnabled:a,clientHeaders:o,...s}){var D;const{soundOn:l,toggleSound:f,playNotificationSound:c}=_u({storageKey:t,soundEnabled:a}),{clientState:d,httpClient:p,error:u,activeConversationId:m,userCredentials:h,isTyping:g,isAwaitingResponse:v,openConversation:b,setAwaitingResponse:k,emitter:w,setError:x,setClientState:S}=Fw({apiUrl:e,clientId:n,storageKey:t,storageLocation:i,adminSecret:r,clientHeaders:o,conversationId:s.conversationId,userToken:(D=s.user)==null?void 0:D.userToken,playNotificationSound:c}),{messages:M,sendMessage:I}=Zw({client:p,conversationId:m,userId:h==null?void 0:h.userId,setAwaitingResponse:k}),{participants:O}=Qw({client:p,conversationId:m}),{uploadFile:T}=Jw({client:p,conversationId:m,user:h}),{sendEvent:P}=Yw({client:p,conversationId:m});if(d!=="connected"||!h||!m||!p)return{clientState:d,on:w.on,client:void 0,messages:[],conversationId:void 0,newConversation:L=>{b({conversationId:L,userToken:h==null?void 0:h.userToken}).catch(j=>{w.emit("error",j)})},user:void 0,isTyping:void 0,participants:[],toggleSound:f,soundOn:l,error:u,disableSendButton:v};const R={userId:h==null?void 0:h.userId,conversationId:m,userToken:h==null?void 0:h.userToken,openConversation:b,setClientState:S,setError:x,emitter:w},F={...Kw({sendMessage:I,sendEvent:P,uploadFile:T},R),getUser:async()=>{const{user:L}=await p.getUser();return L},updateUser:async L=>{const{user:j}=await p.updateUser({name:L.name,pictureUrl:L.pictureUrl,userData:L.data});return j},listConversations:async()=>p.listConversations({})};return{clientState:"connected",on:w.on,client:F,messages:M,conversationId:m,newConversation:L=>{b({conversationId:L,userToken:h.userToken}).catch(j=>{w.emit("error",j)})},user:h,isTyping:g,participants:O,error:u,soundOn:l,toggleSound:f,disableSendButton:v}}const e2=()=>{const{client:e,userCredentials:n}=Vt();return e?{userCredentials:n,getUser:async()=>(await e.getUser()).user,updateUser:async r=>(await e.updateUser(r)).user}:{userCredentials:n,getUser:void 0,updateUser:void 0}};function n2(){const{client:e,conversationId:n,userCredentials:t,setAwaitingResponse:i,emitter:r,clientState:a,setClientState:o,setError:s,openConversation:l,error:f,isAwaitingResponse:c,isTyping:d,upsertMessageStream:p,completeMessageStream:u,abortMessageStream:m}=Vt(),{messages:h,sendMessage:g,saveMessageFeedback:v}=Zw({client:e,conversationId:n,userId:t==null?void 0:t.userId,setAwaitingResponse:i}),{participants:b}=Qw({client:e,conversationId:n}),{sendEvent:k}=Yw({client:e,conversationId:n}),{uploadFile:w}=Jw({client:e,conversationId:n,user:t}),x={userId:t==null?void 0:t.userId,userToken:t==null?void 0:t.userToken,conversationId:n,openConversation:l,setClientState:o,setError:s,emitter:r},S=Kw({sendMessage:g,saveMessageFeedback:v,sendEvent:k,uploadFile:w},x);return{conversationId:n,messages:h,participants:b,sendMessage:S.sendMessage,saveMessageFeedback:S.saveMessageFeedback,sendEvent:S.sendEvent,uploadFile:S.uploadFile,on:r.on,status:a,error:f,isAwaitingResponse:c,isTyping:d,upsertMessageStream:p,completeMessageStream:u,abortMessageStream:m}}function t2(){const{client:e,openConversation:n,userCredentials:t}=Vt();return e?{listConversations:async()=>e.listConversations({}),openConversation:r=>n({conversationId:r,userToken:t==null?void 0:t.userToken})}:{listConversations:void 0,openConversation:r=>n({conversationId:r,userToken:t==null?void 0:t.userToken})}}const i2=0,r2=1,a2=2,o2=3;var s2=Object.prototype.hasOwnProperty;function xu(e,n){var t,i;if(e===n)return!0;if(e&&n&&(t=e.constructor)===n.constructor){if(t===Date)return e.getTime()===n.getTime();if(t===RegExp)return e.toString()===n.toString();if(t===Array){if((i=e.length)===n.length)for(;i--&&xu(e[i],n[i]););return i===-1}if(!t||typeof e=="object"){i=0;for(t in e)if(s2.call(e,t)&&++i&&!s2.call(n,t)||!(t in n)||!xu(e[t],n[t]))return!1;return Object.keys(n).length===i}}return e!==e&&n!==n}const St=new WeakMap,Ct=()=>{},hn=Ct(),Su=Object,Se=e=>e===hn,st=e=>typeof e=="function",Wt=(e,n)=>({...e,...n}),l2=e=>st(e.then),Cu={},Ms={},Eu="undefined",Aa=typeof window!=Eu,Tu=typeof document!=Eu,gz=Aa&&"Deno"in window,vz=()=>Aa&&typeof window.requestAnimationFrame!=Eu,f2=(e,n)=>{const t=St.get(e);return[()=>!Se(n)&&e.get(n)||Cu,i=>{if(!Se(n)){const r=e.get(n);n in Ms||(Ms[n]=r),t[5](n,Wt(r,i),r||Cu)}},t[6],()=>!Se(n)&&n in Ms?Ms[n]:!Se(n)&&e.get(n)||Cu]};let Au=!0;const bz=()=>Au,[Mu,Fu]=Aa&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Ct,Ct],yz=()=>{const e=Tu&&document.visibilityState;return Se(e)||e!=="hidden"},kz=e=>(Tu&&document.addEventListener("visibilitychange",e),Mu("focus",e),()=>{Tu&&document.removeEventListener("visibilitychange",e),Fu("focus",e)}),wz=e=>{const n=()=>{Au=!0,e()},t=()=>{Au=!1};return Mu("online",n),Mu("offline",t),()=>{Fu("online",n),Fu("offline",t)}},_z={isOnline:bz,isVisible:yz},xz={initFocus:kz,initReconnect:wz},c2=!E.useId,hr=!Aa||gz,Sz=e=>vz()?window.requestAnimationFrame(e):setTimeout(e,1),Iu=hr?E.useEffect:E.useLayoutEffect,Pu=typeof navigator<"u"&&navigator.connection,d2=!hr&&Pu&&(["slow-2g","2g"].includes(Pu.effectiveType)||Pu.saveData),Fs=new WeakMap,Cz=e=>Su.prototype.toString.call(e),Ou=(e,n)=>e===`[object ${n}]`;let Ez=0;const Du=e=>{const n=typeof e,t=Cz(e),i=Ou(t,"Date"),r=Ou(t,"RegExp"),a=Ou(t,"Object");let o,s;if(Su(e)===e&&!i&&!r){if(o=Fs.get(e),o)return o;if(o=++Ez+"~",Fs.set(e,o),Array.isArray(e)){for(o="@",s=0;s<e.length;s++)o+=Du(e[s])+",";Fs.set(e,o)}if(a){o="#";const l=Su.keys(e).sort();for(;!Se(s=l.pop());)Se(e[s])||(o+=s+":"+Du(e[s])+",");Fs.set(e,o)}}else o=i?e.toJSON():n=="symbol"?e.toString():n=="string"?JSON.stringify(e):""+e;return o},Nu=e=>{if(st(e))try{e=e()}catch{e=""}const n=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Du(e):"",[e,n]};let Tz=0;const Lu=()=>++Tz;async function u2(...e){const[n,t,i,r]=e,a=Wt({populateCache:!0,throwOnError:!0},typeof r=="boolean"?{revalidate:r}:r||{});let o=a.populateCache;const s=a.rollbackOnError;let l=a.optimisticData;const f=p=>typeof s=="function"?s(p):s!==!1,c=a.throwOnError;if(st(t)){const p=t,u=[],m=n.keys();for(const h of m)!/^\$(inf|sub)\$/.test(h)&&p(n.get(h)._k)&&u.push(h);return Promise.all(u.map(d))}return d(t);async function d(p){const[u]=Nu(p);if(!u)return;const[m,h]=f2(n,u),[g,v,b,k]=St.get(n),w=()=>{const F=g[u];return(st(a.revalidate)?a.revalidate(m().data,p):a.revalidate!==!1)&&(delete b[u],delete k[u],F&&F[0])?F[0](a2).then(()=>m().data):m().data};if(e.length<3)return w();let x=i,S,M=!1;const I=Lu();v[u]=[I,0];const O=!Se(l),T=m(),P=T.data,R=T._c,z=Se(R)?P:R;if(O&&(l=st(l)?l(z,P):l,h({data:l,_c:z})),st(x))try{x=x(z)}catch(F){S=F,M=!0}if(x&&l2(x))if(x=await x.catch(F=>{S=F,M=!0}),I!==v[u][0]){if(M)throw S;return x}else M&&O&&f(S)&&(o=!0,h({data:z,_c:hn}));if(o&&!M)if(st(o)){const F=o(x,z);h({data:F,error:hn,_c:hn})}else h({data:x,error:hn,_c:hn});if(v[u][1]=Lu(),Promise.resolve(w()).then(()=>{h({_c:hn})}),M){if(c)throw S;return}return x}}const p2=(e,n)=>{for(const t in e)e[t][0]&&e[t][0](n)},Az=(e,n)=>{if(!St.has(e)){const t=Wt(xz,n),i=Object.create(null),r=u2.bind(hn,e);let a=Ct;const o=Object.create(null),s=(c,d)=>{const p=o[c]||[];return o[c]=p,p.push(d),()=>p.splice(p.indexOf(d),1)},l=(c,d,p)=>{e.set(c,d);const u=o[c];if(u)for(const m of u)m(d,p)},f=()=>{if(!St.has(e)&&(St.set(e,[i,Object.create(null),Object.create(null),Object.create(null),r,l,s]),!hr)){const c=t.initFocus(setTimeout.bind(hn,p2.bind(hn,i,i2))),d=t.initReconnect(setTimeout.bind(hn,p2.bind(hn,i,r2)));a=()=>{c&&c(),d&&d(),St.delete(e)}}};return f(),[e,r,f,a]}return[e,St.get(e)[4]]},Mz=(e,n,t,i,r)=>{const a=t.errorRetryCount,o=r.retryCount,s=~~((Math.random()+.5)*(1<<(o<8?o:8)))*t.errorRetryInterval;!Se(a)&&o>a||setTimeout(i,s,r)},Fz=xu,[m2,Iz]=Az(new Map),Pz=Wt({onLoadingSlow:Ct,onSuccess:Ct,onError:Ct,onErrorRetry:Mz,onDiscarded:Ct,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:d2?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:d2?5e3:3e3,compare:Fz,isPaused:()=>!1,cache:m2,mutate:Iz,fallback:{}},_z),Oz=(e,n)=>{const t=Wt(e,n);if(n){const{use:i,fallback:r}=e,{use:a,fallback:o}=n;i&&a&&(t.use=i.concat(a)),r&&o&&(t.fallback=Wt(r,o))}return t},Dz=E.createContext({}),Nz="$inf$",h2=Aa&&window.__SWR_DEVTOOLS_USE__,Lz=h2?window.__SWR_DEVTOOLS_USE__:[],zz=()=>{h2&&(window.__SWR_DEVTOOLS_REACT__=E)},Bz=e=>st(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],$z=()=>{const e=E.useContext(Dz);return E.useMemo(()=>Wt(Pz,e),[e])},Rz=e=>(n,t,i)=>e(n,t&&((...a)=>{const[o]=Nu(n),[,,,s]=St.get(m2);if(o.startsWith(Nz))return t(...a);const l=s[o];return Se(l)?t(...a):(delete s[o],l)}),i),jz=Lz.concat(Rz),Hz=e=>function(...t){const i=$z(),[r,a,o]=Bz(t),s=Oz(i,o);let l=e;const{use:f}=s,c=(f||[]).concat(jz);for(let d=c.length;d--;)l=c[d](l);return l(r,a||s.fetcher||null,s)},Vz=(e,n,t)=>{const i=n[e]||(n[e]=[]);return i.push(t),()=>{const r=i.indexOf(t);r>=0&&(i[r]=i[i.length-1],i.pop())}};zz();const zu=E.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(n=>{e.status="fulfilled",e.value=n},n=>{e.status="rejected",e.reason=n}),e}}),Bu={dedupe:!0},g2=Promise.resolve(hn),Wz=()=>Ct,qz=Hz((e,n,t)=>{const{cache:i,compare:r,suspense:a,fallbackData:o,revalidateOnMount:s,revalidateIfStale:l,refreshInterval:f,refreshWhenHidden:c,refreshWhenOffline:d,keepPreviousData:p,strictServerPrefetchWarning:u}=t,[m,h,g,v]=St.get(i),[b,k]=Nu(e),w=E.useRef(!1),x=E.useRef(!1),S=E.useRef(b),M=E.useRef(n),I=E.useRef(t),O=()=>I.current,T=()=>O().isVisible()&&O().isOnline(),[P,R,z,F]=f2(i,b),D=E.useRef({}).current,L=Se(o)?Se(t.fallback)?hn:t.fallback[b]:o,j=(te,pe)=>{for(const ge in D){const ve=ge;if(ve==="data"){if(!r(te[ve],pe[ve])&&(!Se(te[ve])||!r(K,pe[ve])))return!1}else if(pe[ve]!==te[ve])return!1}return!0},N=!w.current,V=E.useMemo(()=>{const te=P(),pe=F(),ge=Fe=>{const $e=Wt(Fe);return delete $e._k,(()=>{if(!b||!n||O().isPaused())return!1;if(N&&!Se(s))return s;const fe=Se(L)?$e.data:L;return Se(fe)||l})()?{isValidating:!0,isLoading:!0,...$e}:$e},ve=ge(te),Ae=te===pe?ve:ge(pe);let Le=ve;return[()=>{const Fe=ge(P());return j(Fe,Le)?(Le.data=Fe.data,Le.isLoading=Fe.isLoading,Le.isValidating=Fe.isValidating,Le.error=Fe.error,Le):(Le=Fe,Fe)},()=>Ae]},[i,b]),_=Ks.useSyncExternalStore(E.useCallback(te=>z(b,(pe,ge)=>{j(ge,pe)||te()}),[i,b]),V[0],V[1]),$=m[b]&&m[b].length>0,B=_.data,C=Se(B)?L&&l2(L)?zu(L):L:B,q=_.error,Q=E.useRef(C),K=p?Se(B)?Se(Q.current)?C:Q.current:B:C,U=b&&Se(C),G=E.useRef(null);!hr&&Ks.useSyncExternalStore(Wz,()=>(G.current=!1,G),()=>(G.current=!0,G));const ne=G.current;u&&ne&&!a&&U&&console.warn(`Missing pre-initiated data for serialized key "${b}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);const Z=!b||!n||O().isPaused()||$&&!Se(q)?!1:N&&!Se(s)?s:a?Se(C)?!1:l:Se(C)||l,re=Se(_.isValidating)?Z:_.isValidating,H=Se(_.isLoading)?Z:_.isLoading,Y=E.useCallback(async te=>{const pe=M.current;if(!b||!pe||x.current||O().isPaused())return!1;let ge,ve,Ae=!0;const Le=te||{},Fe=!g[b]||!Le.dedupe,$e=()=>c2?!x.current&&b===S.current&&w.current:b===S.current,ae={isValidating:!1,isLoading:!1},fe=()=>{R(ae)},W=()=>{const oe=g[b];oe&&oe[1]===ve&&delete g[b]},J={isValidating:!0};Se(P().data)&&(J.isLoading=!0);try{if(Fe&&(R(J),t.loadingTimeout&&Se(P().data)&&setTimeout(()=>{Ae&&$e()&&O().onLoadingSlow(b,t)},t.loadingTimeout),g[b]=[pe(k),Lu()]),[ge,ve]=g[b],ge=await ge,Fe&&setTimeout(W,t.dedupingInterval),!g[b]||g[b][1]!==ve)return Fe&&$e()&&O().onDiscarded(b),!1;ae.error=hn;const oe=h[b];if(!Se(oe)&&(ve<=oe[0]||ve<=oe[1]||oe[1]===0))return fe(),Fe&&$e()&&O().onDiscarded(b),!1;const ue=P().data;ae.data=r(ue,ge)?ue:ge,Fe&&$e()&&O().onSuccess(ge,b,t)}catch(oe){W();const ue=O(),{shouldRetryOnError:be}=ue;ue.isPaused()||(ae.error=oe,Fe&&$e()&&(ue.onError(oe,b,ue),(be===!0||st(be)&&be(oe))&&(!O().revalidateOnFocus||!O().revalidateOnReconnect||T())&&ue.onErrorRetry(oe,b,ue,Ke=>{const nn=m[b];nn&&nn[0]&&nn[0](o2,Ke)},{retryCount:(Le.retryCount||0)+1,dedupe:!0})))}return Ae=!1,fe(),!0},[b,i]),de=E.useCallback((...te)=>u2(i,S.current,...te),[]);if(Iu(()=>{M.current=n,I.current=t,Se(B)||(Q.current=B)}),Iu(()=>{if(!b)return;const te=Y.bind(hn,Bu);let pe=0;O().revalidateOnFocus&&(pe=Date.now()+O().focusThrottleInterval);const ve=Vz(b,m,(Ae,Le={})=>{if(Ae==i2){const Fe=Date.now();O().revalidateOnFocus&&Fe>pe&&T()&&(pe=Fe+O().focusThrottleInterval,te())}else if(Ae==r2)O().revalidateOnReconnect&&T()&&te();else{if(Ae==a2)return Y();if(Ae==o2)return Y(Le)}});return x.current=!1,S.current=b,w.current=!0,R({_k:k}),Z&&(g[b]||(Se(C)||hr?te():Sz(te))),()=>{x.current=!0,ve()}},[b]),Iu(()=>{let te;function pe(){const ve=st(f)?f(P().data):f;ve&&te!==-1&&(te=setTimeout(ge,ve))}function ge(){!P().error&&(c||O().isVisible())&&(d||O().isOnline())?Y(Bu).then(pe):pe()}return pe(),()=>{te&&(clearTimeout(te),te=-1)}},[f,c,d,b]),E.useDebugValue(K),a){if(!c2&&hr&&U)throw new Error("Fallback data is required when using Suspense in SSR.");U&&(M.current=n,I.current=t,x.current=!1);const te=v[b],pe=!Se(te)&&U?de(te):g2;if(zu(pe),!Se(q)&&U)throw q;const ge=U?Y(Bu):g2;!Se(K)&&U&&(ge.status="fulfilled",ge.value=!0),zu(ge)}return{mutate:de,get data(){return D.data=!0,K},get error(){return D.error=!0,q},get isValidating(){return D.isValidating=!0,re},get isLoading(){return D.isLoading=!0,H}}});function v2({userCredentials:e,listConversations:n,clientId:t}){const i=!!e&&t&&n,{data:r,error:a,isLoading:o,mutate:s}=qz(i?[t,"conversations",e==null?void 0:e.userId]:null,async()=>(await n({})).conversations.filter(Uz).sort((f,c)=>new Date(c.updatedAt).getTime()-new Date(f.updatedAt).getTime()).map(f=>({...f,lastMessage:{...f.lastMessage,author:{type:f.lastMessage.userId===(e==null?void 0:e.userId)?"user":"bot"}}})),{revalidateOnFocus:!1,revalidateOnReconnect:!0,dedupingInterval:2e3});return{conversations:r??[],isLoading:o,error:a&&ti(a),refresh:async()=>await s()}}const Uz=e=>!!e.lastMessage;function Gz({enabled:e}={}){const{client:n,userCredentials:t,conversationId:i,emitter:r}=Vt(),[a,o]=E.useState(!0),[s,l]=E.useState(null),[f,c]=E.useState(null);E.useEffect(()=>{const u=r.on("message",m=>{(t==null?void 0:t.userId)!==m.authorId&&l(m.id)});return()=>{u()}},[r,t==null?void 0:t.userId]),E.useEffect(()=>{a&&d()},[s]);const d=()=>{s!==f?p(s??""):s===null&&f===null&&(l(""),p(""))},p=u=>{!e||!i||!n||(c(u),n.createEvent({conversationId:i,payload:{type:"custom",data:{type:"lastReadMessageUpdate",payload:{conversationId:i,userKey:t==null?void 0:t.userToken}}}}))};return E.useEffect(()=>{const u=()=>{o(!0),d()},m=()=>o(!1);return window.addEventListener("focus",u),window.addEventListener("blur",m),()=>{window.removeEventListener("focus",u),window.removeEventListener("blur",m)}},[d]),{onMessageReceived:u=>{l(u)}}}const Kz=4e3,Yz=2e3;function b2({enabled:e}){const{client:n,conversationId:t}=Vt(),i=E.useRef(0),r=E.useRef(null),a=E.useCallback(l=>{!n||!t||n.createEvent({conversationId:t,payload:{type:"custom",data:{type:"userTyping",payload:{conversationId:t,isTyping:l}}}}).catch(()=>{})},[n,t]),o=E.useCallback(()=>{r.current&&(clearTimeout(r.current),r.current=null),i.current!==0&&(i.current=0,a(!1))},[a]),s=E.useCallback(l=>{if(!e)return;if(!l.trim()){o();return}const f=Date.now();f-i.current>=Kz&&(i.current=f,a(!0)),r.current&&clearTimeout(r.current),r.current=setTimeout(o,Yz)},[e,a,o]);return E.useEffect(()=>()=>o(),[e,t,o]),{onTextChange:e?s:void 0}}const Jz=6e4;function y2({enabled:e,connected:n}){const{client:t,conversationId:i}=Vt(),r=E.useRef(null),a=E.useRef(0),o=E.useRef(null),s=typeof document>"u"?!0:document.hasFocus()&&!document.hidden,l=E.useRef(s),f=E.useRef(!s),c=E.useCallback(h=>{if(!t||!i||r.current===h)return;r.current=h;const g=++a.current;t.createEvent({conversationId:i,payload:{type:"custom",data:{type:"userPresence",payload:{conversationId:i,state:h}}}}).catch(()=>{a.current===g&&(r.current=null)})},[t,i]),d=E.useCallback(()=>n?f.current?"away":"online":"offline",[n]),p=E.useCallback(()=>{e&&c(d())},[e,c,d]),u=E.useCallback(()=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{f.current||(f.current=!0,p())},Jz)},[p]),m=E.useCallback(()=>{f.current=!1,u(),p()},[u,p]);E.useEffect(()=>()=>{e&&c("offline"),r.current=null},[i,e,c]),E.useEffect(()=>{p()},[n,e,p]),E.useEffect(()=>{if(!e)return;const h=()=>{l.current=!0,m()},g=()=>{l.current=!1,u()},v=()=>{l.current&&m()},b=()=>c("offline");return window.addEventListener("focus",h),window.addEventListener("blur",g),window.addEventListener("pointerdown",v),window.addEventListener("keydown",v),window.addEventListener("pagehide",b),window.addEventListener("beforeunload",b),f.current||u(),p(),()=>{window.removeEventListener("focus",h),window.removeEventListener("blur",g),window.removeEventListener("pointerdown",v),window.removeEventListener("keydown",v),window.removeEventListener("pagehide",b),window.removeEventListener("beforeunload",b),o.current&&clearTimeout(o.current)}},[e,u,m,p,c])}const Zz=e=>e!=null&&e.length?e.charAt(0).toUpperCase()+e.slice(1):"",$u=({className:e,onConversationClick:n,onNewConversation:t,onClose:i,isLoading:r,conversations:a,botAvatar:o,botName:s,...l})=>{const f=un();return y.jsxs("div",{...l,className:pi("bpReset bpConversationHistoryContainer bpFont",e),children:[y.jsxs("div",{className:"bpConversationHistoryHeader",children:[f["conversationHistory.title"],i&&y.jsx("div",{className:"bpConversationHistoryCloseButton",children:y.jsx(xi,{icon:so,label:f["closeButton.ariaLabel"],onClick:i})})]}),r?y.jsx("div",{className:"bpConversationHistoryLoaderContainer",children:y.jsx(qw,{})}):y.jsx("div",{className:"bpConversationHistoryScrollContainer",children:a.length===0?y.jsx("div",{className:"bpConversationHistoryLoaderContainer",children:f["conversationHistory.empty"]}):a.map(({id:c,lastMessage:d},p)=>{const u=d.author.type==="bot",m=u?s||"Bot":"You";let h="";if(d.payload.type==="text")h=d.payload.text;else if(d.payload.type==="bloc"&&d.payload.items.some(g=>g.type==="text")){const g=d.payload.items.find(v=>v.type==="text");h=(g==null?void 0:g.payload.text)??""}else h=f["conversationHistory.sentAttachment"];return y.jsxs("div",{children:[y.jsxs("button",{className:"bpConversationHistoryConversationContainer",onClick:()=>n==null?void 0:n(c),children:[u?y.jsx(dt,{userId:d.userId,src:o,containerClassName:"bpReset bpConversationHistoryConversationAvatarContainer",imageClassName:"bpConversationHistoryConversationAvatarImage",fallbackClassName:"bpConversationHistoryConversationAvatarFallback",children:y.jsx(Ea,{})}):y.jsx(dt,{userId:d.userId,containerClassName:"bpReset bpConversationHistoryConversationAvatarContainer",imageClassName:"bpConversationHistoryConversationAvatarImage",fallbackClassName:"bpConversationHistoryConversationUserAvatarFallback",children:m}),y.jsxs("div",{className:"bpConversationHistoryConversationContent",children:[y.jsxs("div",{className:"bpConversationHistoryConversationTitleRow",children:[y.jsx("span",{className:"bpConversationHistoryConversationTitle",children:s||"Bot"}),y.jsx("span",{className:"bpConversationHistoryConversationTimestamp",children:Zz(W4(d.createdAt))})]}),y.jsx("div",{className:"bpConversationHistoryConversationMessageRow",children:y.jsxs("span",{className:"bpConversationHistoryConversationPreview",children:[m,": ",h]})})]})]}),p<a.length-1&&y.jsx("div",{className:"bpConversationHistorySeparator"})]},c)})}),y.jsxs("button",{className:"bpConversationHistoryNewConversationButton",onClick:t,children:[f["conversationHistory.newConversation"],y.jsx(qT,{className:"bpConversationHistoryNewConversationButtonIcon"})]})]})};$u.displayName="ConversationHistory";const k2=({connected:e,configuration:n,isTyping:t,messages:i,user:r,isLoading:a,isReadOnly:o,disableComposer:s,error:l,participants:f,closeWindow:c,sendMessage:d,addMessageFeedback:p,uploadFile:u,listConversations:m,restartConversation:h,clientId:g,storageKey:v,soundOn:b,toggleSound:k,disableSendButton:w,conversationId:x,expanded:S,onToggleExpand:M,locale:I,onComposerTextChange:O,...T})=>{const{color:P,fontFamily:R,themeMode:z,headerVariant:F,botAvatar:D,botName:L,botDescription:j,composerPlaceholder:N,footer:V,allowFileUpload:_,conversationHistory:$,feedbackEnabled:B,homePageEnabled:C,welcomeHeading:q,welcomeSubtitle:Q,mainCardEnabled:K,mainCardTitle:U,mainCardSubtitle:G,conversationStartersEnabled:ne,conversationStarters:Z,conversationStartersDisplayStyle:re,citationsEnabled:H,language:Y,translations:de}=n,Te={color:P,fontFamily:R,themeMode:z,headerVariant:F},te=E.useMemo(()=>{const J={...de,...I};return Object.keys(J).length?JSON.stringify(J):void 0},[de,I]),pe=E.useMemo(()=>w0(Y,te?JSON.parse(te):void 0),[Y,te]),[ge,ve]=E.useState("chat"),Ae=E.useRef(1),Le=E.useRef(null),Fe=()=>{var J,oe;(oe=(J=Le.current)==null?void 0:J.querySelector(".bpComposerInput"))==null||oe.focus()},$e=J=>{Ae.current=J==="conversations"?-1:1,ve(J)},ae=v2({clientId:g,listConversations:m,userCredentials:r});E.useEffect(()=>{ge==="conversations"&&ae.refresh()},[ge]);const fe=E.useMemo(()=>r?hp(i,f,r.userId,L,D):[],[D,L,i,r,f]),W=E.useMemo(()=>Nw(i),[i]);return y.jsxs(DF,{value:pe,children:[y.jsx(lw,{...Te}),y.jsx(hu,{allowFileUpload:_,uploadFile:u,storageKey:v,conversationId:x,...T,children:l||ae.error?y.jsx(Gw,{error:l||ae.error,restartConversation:h,closeWindow:c}):y.jsx("div",{style:{position:"relative",display:"flex",flexDirection:"column",flexGrow:1,minHeight:0,overflowX:"clip",overflowY:"visible"},children:y.jsx(kt,{initial:!1,custom:Ae.current,children:ge==="conversations"?y.jsx(Jn,{initial:{x:"-100%",filter:"blur(4px)"},animate:{x:0,filter:"blur(0px)"},exit:{x:"-100%",filter:"blur(4px)"},transition:{type:"tween",duration:.25,ease:[.4,0,.2,1]},style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",overflow:"hidden",background:"var(--bpGray-25)"},children:y.jsx($u,{onClose:c,conversations:ae.conversations,isLoading:ae.isLoading,onNewConversation:()=>{h==null||h(),$e("chat")},onConversationClick:J=>{h==null||h(J),$e("chat")},botAvatar:D,botName:L})},"conversations"):y.jsxs(Jn,{ref:Le,initial:{x:"100%",filter:"blur(4px)"},animate:{x:0,filter:"blur(0px)"},exit:{x:"100%",filter:"blur(4px)"},transition:{type:"tween",duration:.25,ease:[.4,0,.2,1]},style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",overflowX:"clip",overflowY:"visible",background:"var(--bpGray-25)"},children:[y.jsx(Dw,{showConversationHistory:$===!1?void 0:()=>$e("conversations"),closeWindow:c,configuration:n,clientId:g,soundOn:b,toggleSound:k,expanded:S,onToggleExpand:M,hitlStatus:W}),a?y.jsx(qw,{}):y.jsx(wu,{botAvatar:D,botName:L,botDescription:j,isTyping:t,sendMessage:d,hitlWaiting:W.mode==="waiting"&&!W.hidden?{since:W.since,message:W.message}:void 0,citationsEnabled:H===!0,addMessageFeedback:B?p:void 0,homePageEnabled:C,welcomeHeading:q,welcomeSubtitle:Q,mainCardEnabled:K,mainCardTitle:U,mainCardSubtitle:G,onMainCardClick:Fe,conversationStartersEnabled:ne,conversationStarters:Z,conversationStartersDisplayStyle:re,messages:fe}),y.jsx(Tk,{sendMessage:d,uploadFile:u,connected:e,isReadOnly:o,disableComposer:s,footer:V,composerPlaceholder:N,allowFileUpload:_,storageKey:v,disableSendButton:w,conversationId:x,onTextChange:O})]},"chat")})})})]})};function Qz({configuration:e,storageKey:n,clientId:t,onMessageSent:i,...r}){const{messages:a,participants:o,sendMessage:s,uploadFile:l,conversationId:f,status:c,error:d,isTyping:p}=n2(),{emitter:u}=Vt(),m=E.useCallback((...S)=>{try{u.emit("messageSent",S[0]),i==null||i(S[0],f)}catch{}return s(...S)},[f,u,i,s]),{openConversation:h,listConversations:g}=t2(),{userCredentials:v}=e2(),{soundOn:b,toggleSound:k}=_u({storageKey:n,soundEnabled:e==null?void 0:e.soundEnabled}),w=(e==null?void 0:e.agentPresenceEnabled)===!0,{onTextChange:x}=b2({enabled:w});return y2({enabled:w,connected:c==="connected"}),y.jsx(k2,{configuration:e??{},user:v,isLoading:c==="connecting",isTyping:p,onComposerTextChange:x,connected:c==="connected"?!0:c==="disconnected"?!1:void 0,messages:a,sendMessage:m,uploadFile:l,listConversations:g,restartConversation:h,participants:o,error:d,clientId:t,soundOn:b,toggleSound:k,conversationId:f,storageKey:n,...r})}const Xz=({clientId:e,storageKey:n,configuration:t,apiUrl:i,user:r,conversationId:a,...o})=>{const s=n||`bp-webchat-${e}`;return y.jsx(Pw,{clientId:e,apiUrl:i,userCredentials:r,conversationId:a,storageKey:s,storageLocation:t==null?void 0:t.storageLocation,adminSecret:t==null?void 0:t.adminSecret,children:y.jsx(Qz,{configuration:t,storageKey:s,clientId:e,...o})})};function qt(e,n,{checkForDefaultPrevented:t=!0}={}){return function(r){if(e==null||e(r),t===!1||!r.defaultPrevented)return n==null?void 0:n(r)}}function eB(e,n){const t=A.createContext(n),i=a=>{const{children:o,...s}=a,l=A.useMemo(()=>s,Object.values(s));return y.jsx(t.Provider,{value:l,children:o})};i.displayName=e+"Provider";function r(a){const o=A.useContext(t);if(o)return o;if(n!==void 0)return n;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[i,r]}function nB(e,n=[]){let t=[];function i(a,o){const s=A.createContext(o),l=t.length;t=[...t,o];const f=d=>{var v;const{scope:p,children:u,...m}=d,h=((v=p==null?void 0:p[e])==null?void 0:v[l])||s,g=A.useMemo(()=>m,Object.values(m));return y.jsx(h.Provider,{value:g,children:u})};f.displayName=a+"Provider";function c(d,p){var h;const u=((h=p==null?void 0:p[e])==null?void 0:h[l])||s,m=A.useContext(u);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${a}\``)}return[f,c]}const r=()=>{const a=t.map(o=>A.createContext(o));return function(s){const l=(s==null?void 0:s[e])||a;return A.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return r.scopeName=e,[i,tB(r,...n)]}function tB(...e){const n=e[0];if(e.length===1)return n;const t=()=>{const i=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(a){const o=i.reduce((s,{useScope:l,scopeName:f})=>{const d=l(a)[`__scope${f}`];return{...s,...d}},{});return A.useMemo(()=>({[`__scope${n.scopeName}`]:o}),[o])}};return t.scopeName=n.scopeName,t}var iB=A[" useId ".trim().toString()]||(()=>{}),rB=0;function Ru(e){const[n,t]=A.useState(iB());return Kt(()=>{t(i=>i??String(rB++))},[e]),e||(n?`radix-${n}`:"")}var aB=A[" useInsertionEffect ".trim().toString()]||Kt;function oB({prop:e,defaultProp:n,onChange:t=()=>{},caller:i}){const[r,a,o]=sB({defaultProp:n,onChange:t}),s=e!==void 0,l=s?e:r;{const c=A.useRef(e!==void 0);A.useEffect(()=>{const d=c.current;d!==s&&console.warn(`${i} is changing from ${d?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=s},[s,i])}const f=A.useCallback(c=>{var d;if(s){const p=lB(c)?c(e):c;p!==e&&((d=o.current)==null||d.call(o,p))}else a(c)},[s,e,a,o]);return[l,f]}function sB({defaultProp:e,onChange:n}){const[t,i]=A.useState(e),r=A.useRef(t),a=A.useRef(n);return aB(()=>{a.current=n},[n]),A.useEffect(()=>{var o;r.current!==t&&((o=a.current)==null||o.call(a,t),r.current=t)},[t,r]),[t,i,a]}function lB(e){return typeof e=="function"}function w2(e){const n=fB(e),t=A.forwardRef((i,r)=>{const{children:a,...o}=i,s=A.Children.toArray(a),l=s.find(dB);if(l){const f=l.props.children,c=s.map(d=>d===l?A.Children.count(f)>1?A.Children.only(null):A.isValidElement(f)?f.props.children:null:d);return y.jsx(n,{...o,ref:r,children:A.isValidElement(f)?A.cloneElement(f,void 0,c):null})}return y.jsx(n,{...o,ref:r,children:a})});return t.displayName=`${e}.Slot`,t}function fB(e){const n=A.forwardRef((t,i)=>{const{children:r,...a}=t;if(A.isValidElement(r)){const o=pB(r),s=uB(a,r.props);return r.type!==A.Fragment&&(s.ref=i?Vs(i,o):o),A.cloneElement(r,s)}return A.Children.count(r)>1?A.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var cB=Symbol("radix.slottable");function dB(e){return A.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===cB}function uB(e,n){const t={...n};for(const i in n){const r=e[i],a=n[i];/^on[A-Z]/.test(i)?r&&a?t[i]=(...s)=>{const l=a(...s);return r(...s),l}:r&&(t[i]=r):i==="style"?t[i]={...r,...a}:i==="className"&&(t[i]=[r,a].filter(Boolean).join(" "))}return{...e,...t}}function pB(e){var i,r;let n=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,t=n&&"isReactWarning"in n&&n.isReactWarning;return t?e.ref:(n=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,t=n&&"isReactWarning"in n&&n.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var mB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ut=mB.reduce((e,n)=>{const t=w2(`Primitive.${n}`),i=A.forwardRef((r,a)=>{const{asChild:o,...s}=r,l=o?t:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),y.jsx(l,{...s,ref:a})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{});function hB(e,n){e&&np.flushSync(()=>e.dispatchEvent(n))}function gB(e,n=globalThis==null?void 0:globalThis.document){const t=Ci(e);A.useEffect(()=>{const i=r=>{r.key==="Escape"&&t(r)};return n.addEventListener("keydown",i,{capture:!0}),()=>n.removeEventListener("keydown",i,{capture:!0})},[t,n])}var vB="DismissableLayer",ju="dismissableLayer.update",bB="dismissableLayer.pointerDownOutside",yB="dismissableLayer.focusOutside",_2,x2=A.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),S2=A.forwardRef((e,n)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:i,onPointerDownOutside:r,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...l}=e,f=A.useContext(x2),[c,d]=A.useState(null),p=(c==null?void 0:c.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,u]=A.useState({}),m=Yt(n,M=>d(M)),h=Array.from(f.layers),[g]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),v=h.indexOf(g),b=c?h.indexOf(c):-1,k=f.layersWithOutsidePointerEventsDisabled.size>0,w=b>=v,x=_B(M=>{const I=M.target,O=[...f.branches].some(T=>T.contains(I));!w||O||(r==null||r(M),o==null||o(M),M.defaultPrevented||s==null||s())},p),S=xB(M=>{const I=M.target;[...f.branches].some(T=>T.contains(I))||(a==null||a(M),o==null||o(M),M.defaultPrevented||s==null||s())},p);return gB(M=>{b===f.layers.size-1&&(i==null||i(M),!M.defaultPrevented&&s&&(M.preventDefault(),s()))},p),A.useEffect(()=>{if(c)return t&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(_2=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(c)),f.layers.add(c),C2(),()=>{t&&f.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=_2)}},[c,p,t,f]),A.useEffect(()=>()=>{c&&(f.layers.delete(c),f.layersWithOutsidePointerEventsDisabled.delete(c),C2())},[c,f]),A.useEffect(()=>{const M=()=>u({});return document.addEventListener(ju,M),()=>document.removeEventListener(ju,M)},[]),y.jsx(Ut.div,{...l,ref:m,style:{pointerEvents:k?w?"auto":"none":void 0,...e.style},onFocusCapture:qt(e.onFocusCapture,S.onFocusCapture),onBlurCapture:qt(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:qt(e.onPointerDownCapture,x.onPointerDownCapture)})});S2.displayName=vB;var kB="DismissableLayerBranch",wB=A.forwardRef((e,n)=>{const t=A.useContext(x2),i=A.useRef(null),r=Yt(n,i);return A.useEffect(()=>{const a=i.current;if(a)return t.branches.add(a),()=>{t.branches.delete(a)}},[t.branches]),y.jsx(Ut.div,{...e,ref:r})});wB.displayName=kB;function _B(e,n=globalThis==null?void 0:globalThis.document){const t=Ci(e),i=A.useRef(!1),r=A.useRef(()=>{});return A.useEffect(()=>{const a=s=>{if(s.target&&!i.current){let l=function(){E2(bB,t,f,{discrete:!0})};const f={originalEvent:s};s.pointerType==="touch"?(n.removeEventListener("click",r.current),r.current=l,n.addEventListener("click",r.current,{once:!0})):l()}else n.removeEventListener("click",r.current);i.current=!1},o=window.setTimeout(()=>{n.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),n.removeEventListener("pointerdown",a),n.removeEventListener("click",r.current)}},[n,t]),{onPointerDownCapture:()=>i.current=!0}}function xB(e,n=globalThis==null?void 0:globalThis.document){const t=Ci(e),i=A.useRef(!1);return A.useEffect(()=>{const r=a=>{a.target&&!i.current&&E2(yB,t,{originalEvent:a},{discrete:!1})};return n.addEventListener("focusin",r),()=>n.removeEventListener("focusin",r)},[n,t]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function C2(){const e=new CustomEvent(ju);document.dispatchEvent(e)}function E2(e,n,t,{discrete:i}){const r=t.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:t});n&&r.addEventListener(e,n,{once:!0}),i?hB(r,a):r.dispatchEvent(a)}var Hu="focusScope.autoFocusOnMount",Vu="focusScope.autoFocusOnUnmount",T2={bubbles:!1,cancelable:!0},SB="FocusScope",A2=A.forwardRef((e,n)=>{const{loop:t=!1,trapped:i=!1,onMountAutoFocus:r,onUnmountAutoFocus:a,...o}=e,[s,l]=A.useState(null),f=Ci(r),c=Ci(a),d=A.useRef(null),p=Yt(n,h=>l(h)),u=A.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;A.useEffect(()=>{if(i){let h=function(k){if(u.paused||!s)return;const w=k.target;s.contains(w)?d.current=w:Gt(d.current,{select:!0})},g=function(k){if(u.paused||!s)return;const w=k.relatedTarget;w!==null&&(s.contains(w)||Gt(d.current,{select:!0}))},v=function(k){if(document.activeElement===document.body)for(const x of k)x.removedNodes.length>0&&Gt(s)};document.addEventListener("focusin",h),document.addEventListener("focusout",g);const b=new MutationObserver(v);return s&&b.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",g),b.disconnect()}}},[i,s,u.paused]),A.useEffect(()=>{if(s){I2.add(u);const h=document.activeElement;if(!s.contains(h)){const v=new CustomEvent(Hu,T2);s.addEventListener(Hu,f),s.dispatchEvent(v),v.defaultPrevented||(CB(FB(M2(s)),{select:!0}),document.activeElement===h&&Gt(s))}return()=>{s.removeEventListener(Hu,f),setTimeout(()=>{const v=new CustomEvent(Vu,T2);s.addEventListener(Vu,c),s.dispatchEvent(v),v.defaultPrevented||Gt(h??document.body,{select:!0}),s.removeEventListener(Vu,c),I2.remove(u)},0)}}},[s,f,c,u]);const m=A.useCallback(h=>{if(!t&&!i||u.paused)return;const g=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,v=document.activeElement;if(g&&v){const b=h.currentTarget,[k,w]=EB(b);k&&w?!h.shiftKey&&v===w?(h.preventDefault(),t&&Gt(k,{select:!0})):h.shiftKey&&v===k&&(h.preventDefault(),t&&Gt(w,{select:!0})):v===b&&h.preventDefault()}},[t,i,u.paused]);return y.jsx(Ut.div,{tabIndex:-1,...o,ref:p,onKeyDown:m})});A2.displayName=SB;function CB(e,{select:n=!1}={}){const t=document.activeElement;for(const i of e)if(Gt(i,{select:n}),document.activeElement!==t)return}function EB(e){const n=M2(e),t=F2(n,e),i=F2(n.reverse(),e);return[t,i]}function M2(e){const n=[],t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const r=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||r?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)n.push(t.currentNode);return n}function F2(e,n){for(const t of e)if(!TB(t,{upTo:n}))return t}function TB(e,{upTo:n}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(n!==void 0&&e===n)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function AB(e){return e instanceof HTMLInputElement&&"select"in e}function Gt(e,{select:n=!1}={}){if(e&&e.focus){const t=document.activeElement;e.focus({preventScroll:!0}),e!==t&&AB(e)&&n&&e.select()}}var I2=MB();function MB(){let e=[];return{add(n){const t=e[0];n!==t&&(t==null||t.pause()),e=P2(e,n),e.unshift(n)},remove(n){var t;e=P2(e,n),(t=e[0])==null||t.resume()}}}function P2(e,n){const t=[...e],i=t.indexOf(n);return i!==-1&&t.splice(i,1),t}function FB(e){return e.filter(n=>n.tagName!=="A")}function IB(e,n){return A.useReducer((t,i)=>n[t][i]??t,e)}var Wu=e=>{const{present:n,children:t}=e,i=PB(n),r=typeof t=="function"?t({present:i.isPresent}):A.Children.only(t),a=Yt(i.ref,OB(r));return typeof t=="function"||i.isPresent?A.cloneElement(r,{ref:a}):null};Wu.displayName="Presence";function PB(e){const[n,t]=A.useState(),i=A.useRef(null),r=A.useRef(e),a=A.useRef("none"),o=e?"mounted":"unmounted",[s,l]=IB(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return A.useEffect(()=>{const f=Is(i.current);a.current=s==="mounted"?f:"none"},[s]),Kt(()=>{const f=i.current,c=r.current;if(c!==e){const p=a.current,u=Is(f);e?l("MOUNT"):u==="none"||(f==null?void 0:f.display)==="none"?l("UNMOUNT"):l(c&&p!==u?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,l]),Kt(()=>{if(n){let f;const c=n.ownerDocument.defaultView??window,d=u=>{const h=Is(i.current).includes(CSS.escape(u.animationName));if(u.target===n&&h&&(l("ANIMATION_END"),!r.current)){const g=n.style.animationFillMode;n.style.animationFillMode="forwards",f=c.setTimeout(()=>{n.style.animationFillMode==="forwards"&&(n.style.animationFillMode=g)})}},p=u=>{u.target===n&&(a.current=Is(i.current))};return n.addEventListener("animationstart",p),n.addEventListener("animationcancel",d),n.addEventListener("animationend",d),()=>{c.clearTimeout(f),n.removeEventListener("animationstart",p),n.removeEventListener("animationcancel",d),n.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[n,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:A.useCallback(f=>{i.current=f?getComputedStyle(f):null,t(f)},[])}}function Is(e){return(e==null?void 0:e.animationName)||"none"}function OB(e){var i,r;let n=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,t=n&&"isReactWarning"in n&&n.isReactWarning;return t?e.ref:(n=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,t=n&&"isReactWarning"in n&&n.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var qu=0;function DB(){A.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??O2()),document.body.insertAdjacentElement("beforeend",e[1]??O2()),qu++,()=>{qu===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(n=>n.remove()),qu--}},[])}function O2(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Ps="right-scroll-bar-position",Os="width-before-scroll-bar",NB="with-scroll-bars-hidden",LB="--removed-body-scroll-bar-size";function Uu(e,n){return typeof e=="function"?e(n):e&&(e.current=n),e}function zB(e,n){var t=E.useState(function(){return{value:e,callback:n,facade:{get current(){return t.value},set current(i){var r=t.value;r!==i&&(t.value=i,t.callback(i,r))}}}})[0];return t.callback=n,t.facade}var BB=typeof window<"u"?A.useLayoutEffect:A.useEffect,D2=new WeakMap;function $B(e,n){var t=zB(null,function(i){return e.forEach(function(r){return Uu(r,i)})});return BB(function(){var i=D2.get(t);if(i){var r=new Set(i),a=new Set(e),o=t.current;r.forEach(function(s){a.has(s)||Uu(s,null)}),a.forEach(function(s){r.has(s)||Uu(s,o)})}D2.set(t,e)},[e]),t}function RB(e){return e}function jB(e,n){n===void 0&&(n=RB);var t=[],i=!1,r={read:function(){if(i)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return t.length?t[t.length-1]:e},useMedium:function(a){var o=n(a,i);return t.push(o),function(){t=t.filter(function(s){return s!==o})}},assignSyncMedium:function(a){for(i=!0;t.length;){var o=t;t=[],o.forEach(a)}t={push:function(s){return a(s)},filter:function(){return t}}},assignMedium:function(a){i=!0;var o=[];if(t.length){var s=t;t=[],s.forEach(a),o=t}var l=function(){var c=o;o=[],c.forEach(a)},f=function(){return Promise.resolve().then(l)};f(),t={push:function(c){o.push(c),f()},filter:function(c){return o=o.filter(c),t}}}};return r}function HB(e){e===void 0&&(e={});var n=jB(null);return n.options=Dn({async:!0,ssr:!1},e),n}var N2=function(e){var n=e.sideCar,t=Zv(e,["sideCar"]);if(!n)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=n.read();if(!i)throw new Error("Sidecar medium not found");return A.createElement(i,Dn({},t))};N2.isSideCarExport=!0;function VB(e,n){return e.useMedium(n),N2}var L2=HB(),Gu=function(){},Ds=A.forwardRef(function(e,n){var t=A.useRef(null),i=A.useState({onScrollCapture:Gu,onWheelCapture:Gu,onTouchMoveCapture:Gu}),r=i[0],a=i[1],o=e.forwardProps,s=e.children,l=e.className,f=e.removeScrollBar,c=e.enabled,d=e.shards,p=e.sideCar,u=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,v=e.as,b=v===void 0?"div":v,k=e.gapMode,w=Zv(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=p,S=$B([t,n]),M=Dn(Dn({},w),r);return A.createElement(A.Fragment,null,c&&A.createElement(x,{sideCar:L2,removeScrollBar:f,shards:d,noRelative:u,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:t,gapMode:k}),o?A.cloneElement(A.Children.only(s),Dn(Dn({},M),{ref:S})):A.createElement(b,Dn({},M,{className:l,ref:S}),s))});Ds.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Ds.classNames={fullWidth:Os,zeroRight:Ps};var WB=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function qB(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var n=WB();return n&&e.setAttribute("nonce",n),e}function UB(e,n){e.styleSheet?e.styleSheet.cssText=n:e.appendChild(document.createTextNode(n))}function GB(e){var n=document.head||document.getElementsByTagName("head")[0];n.appendChild(e)}var KB=function(){var e=0,n=null;return{add:function(t){e==0&&(n=qB())&&(UB(n,t),GB(n)),e++},remove:function(){e--,!e&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}}},YB=function(){var e=KB();return function(n,t){A.useEffect(function(){return e.add(n),function(){e.remove()}},[n&&t])}},z2=function(){var e=YB(),n=function(t){var i=t.styles,r=t.dynamic;return e(i,r),null};return n},JB={left:0,top:0,right:0,gap:0},Ku=function(e){return parseInt(e||"",10)||0},ZB=function(e){var n=window.getComputedStyle(document.body),t=n[e==="padding"?"paddingLeft":"marginLeft"],i=n[e==="padding"?"paddingTop":"marginTop"],r=n[e==="padding"?"paddingRight":"marginRight"];return[Ku(t),Ku(i),Ku(r)]},QB=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return JB;var n=ZB(e),t=document.documentElement.clientWidth,i=window.innerWidth;return{left:n[0],top:n[1],right:n[2],gap:Math.max(0,i-t+n[2]-n[0])}},XB=z2(),gr="data-scroll-locked",e$=function(e,n,t,i){var r=e.left,a=e.top,o=e.right,s=e.gap;return t===void 0&&(t="margin"),`
|
|
1210
1210
|
.`.concat(NB,` {
|
|
1211
1211
|
overflow: hidden `).concat(i,`;
|
|
1212
1212
|
padding-right: `).concat(s,"px ").concat(i,`;
|