@linktr.ee/messaging-react 2.3.0-rc-1779427772 → 2.3.0

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.
Files changed (49) hide show
  1. package/dist/{Card-DKp7ijLV.js → Card-4takoN_-.js} +6 -6
  2. package/dist/{Card-DKp7ijLV.js.map → Card-4takoN_-.js.map} +1 -1
  3. package/dist/{Card-Djm6JjNo.js → Card-BuROm0u7.js} +19 -19
  4. package/dist/{Card-Djm6JjNo.js.map → Card-BuROm0u7.js.map} +1 -1
  5. package/dist/{Card-BlzGsGam.cjs → Card-CexShqpK.cjs} +2 -2
  6. package/dist/{Card-BlzGsGam.cjs.map → Card-CexShqpK.cjs.map} +1 -1
  7. package/dist/{Card-BkWwtS0b.cjs → Card-CgpHBx-W.cjs} +2 -2
  8. package/dist/{Card-BkWwtS0b.cjs.map → Card-CgpHBx-W.cjs.map} +1 -1
  9. package/dist/{Card-B7yHs01-.js → Card-DdpdnSh_.js} +16 -16
  10. package/dist/{Card-B7yHs01-.js.map → Card-DdpdnSh_.js.map} +1 -1
  11. package/dist/{Card-DApWNv5V.cjs → Card-ot16XqS2.cjs} +2 -2
  12. package/dist/{Card-DApWNv5V.cjs.map → Card-ot16XqS2.cjs.map} +1 -1
  13. package/dist/{LockedThumbnail-BjF6khtg.cjs → LockedThumbnail-CydtYOSA.cjs} +2 -2
  14. package/dist/{LockedThumbnail-BjF6khtg.cjs.map → LockedThumbnail-CydtYOSA.cjs.map} +1 -1
  15. package/dist/{LockedThumbnail-pm6jo2B4.js → LockedThumbnail-Drsh4B5o.js} +8 -8
  16. package/dist/{LockedThumbnail-pm6jo2B4.js.map → LockedThumbnail-Drsh4B5o.js.map} +1 -1
  17. package/dist/assets/index.css +1 -1
  18. package/dist/index-BCbVXFHI.js +4698 -0
  19. package/dist/index-BCbVXFHI.js.map +1 -0
  20. package/dist/index-CQ913euH.cjs +2 -0
  21. package/dist/index-CQ913euH.cjs.map +1 -0
  22. package/dist/index.cjs +1 -1
  23. package/dist/index.d.ts +22 -13
  24. package/dist/index.js +1 -1
  25. package/package.json +1 -1
  26. package/src/components/ChannelView.tsx +2 -8
  27. package/src/components/CustomMessage/CustomMessage.stories.tsx +0 -140
  28. package/src/components/CustomMessage/index.tsx +15 -20
  29. package/src/components/MessageAttachment/Image/ImageAttachment.stories.tsx +8 -5
  30. package/src/components/MessageAttachment/Image/index.tsx +7 -1
  31. package/src/components/MessageAttachment/MessageAttachment.test.tsx +200 -19
  32. package/src/components/MessageAttachment/Pdf/index.tsx +14 -15
  33. package/src/components/MessageAttachment/Video/VideoAttachment.stories.tsx +2 -2
  34. package/src/components/MessageAttachment/Video/index.tsx +11 -2
  35. package/src/components/MessageAttachment/_shared/CarouselNav.tsx +47 -0
  36. package/src/components/MessageAttachment/_shared/DownloadAction.tsx +27 -27
  37. package/src/components/MessageAttachment/_shared/ImageViewer.tsx +59 -261
  38. package/src/components/MessageAttachment/_shared/PdfViewer.tsx +56 -30
  39. package/src/components/MessageAttachment/_shared/VideoViewer.tsx +53 -109
  40. package/src/components/MessageAttachment/_shared/ViewerShell.tsx +127 -107
  41. package/src/components/MessageAttachment/_shared/useCarousel.ts +103 -0
  42. package/src/components/MessageAttachment/index.tsx +18 -9
  43. package/src/components/MessageAttachment/types.ts +1 -1
  44. package/src/styles.css +177 -85
  45. package/dist/index-7sLuX6s4.cjs +0 -18
  46. package/dist/index-7sLuX6s4.cjs.map +0 -1
  47. package/dist/index-Co-LV7yc.js +0 -8220
  48. package/dist/index-Co-LV7yc.js.map +0 -1
  49. package/src/components/CustomMessage/CustomMessageActions.tsx +0 -35
@@ -1,18 +0,0 @@
1
- "use strict";const r=require("react/jsx-runtime"),V=require("classnames"),f=require("react"),ho=require("@linktr.ee/messaging-core"),B=require("stream-chat-react"),P=require("@phosphor-icons/react"),De=require("stream-chat"),_n=require("react-dom");function Zs(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Y=Zs(f),go=Zs(_n),Js=f.createContext({service:null,client:null,isConnected:!1,isLoading:!1,error:null,capabilities:{},refreshConnection:async()=>{},debug:!1}),Nn=()=>f.useContext(Js),po=({children:e,user:t,serviceConfig:n,apiKey:s,capabilities:o={},debug:a=!1})=>{const i=f.useCallback((L,...F)=>{a&&console.log(`🔥 [MessagingProvider] ${L}`,...F)},[a]);i("🔄 RENDER START",{userId:t==null?void 0:t.id,apiKey:(s==null?void 0:s.substring(0,8))+"...",serviceConfig:!!n,capabilities:Object.keys(o)});const[c,d]=f.useState(null),[u,h]=f.useState(null),[m,g]=f.useState(!1),[l,p]=f.useState(!1),[x,b]=f.useState(null),v=f.useRef(!1),w=f.useRef({userId:t==null?void 0:t.id,apiKey:s,serviceConfig:n,capabilities:o}),C=f.useRef(0);C.current++,i("📊 RENDER INFO",{renderCount:C.current,currentProps:{userId:t==null?void 0:t.id,apiKey:(s==null?void 0:s.substring(0,8))+"..."},propChanges:{userChanged:w.current.userId!==(t==null?void 0:t.id),apiKeyChanged:w.current.apiKey!==s,serviceConfigChanged:w.current.serviceConfig!==n,capabilitiesChanged:w.current.capabilities!==o}}),w.current={userId:t==null?void 0:t.id,apiKey:s,serviceConfig:n,capabilities:o},f.useEffect(()=>{const L=C.current;if(i("🔧 SERVICE INIT EFFECT TRIGGERED",{renderCount:L,apiKey:!!s,serviceConfig:!!n,dependencies:{apiKey:(s==null?void 0:s.substring(0,8))+"...",serviceConfigRef:n,serviceConfigStable:w.current.serviceConfig===n,apiKeyStable:w.current.apiKey===s}}),!s||!n){i("⚠️ SERVICE INIT SKIPPED",{renderCount:L,reason:"Missing apiKey or serviceConfig"});return}i("🚀 CREATING NEW SERVICE",{renderCount:L,apiKey:(s==null?void 0:s.substring(0,8))+"...",serviceConfigChanged:w.current.serviceConfig!==n});const F=new ho.StreamChatService({...n,apiKey:s,debug:a});return d(F),i("✅ SERVICE SET",{renderCount:L,serviceInstance:!!F}),()=>{i("🧹 SERVICE CLEANUP",{renderCount:L,reason:"Effect cleanup"}),F.disconnectUser().catch(console.error)}},[s,n,a,i]);const j=f.useRef(null);f.useEffect(()=>{var F,z;if(i("🔗 USER CONNECTION EFFECT TRIGGERED",{hasService:!!c,hasUser:!!t,userId:t==null?void 0:t.id,isConnecting:v.current,isConnected:m,dependencies:{service:!!c,userId:t==null?void 0:t.id}}),!c||!t){i("⚠️ USER CONNECTION SKIPPED","Missing service or user");return}if(v.current){i("⚠️ USER CONNECTION SKIPPED","Already connecting");return}if(((F=j.current)==null?void 0:F.serviceId)===c&&((z=j.current)==null?void 0:z.userId)===t.id){i("⚠️ USER CONNECTION SKIPPED","Already connected this user with this service");return}(async()=>{i("🚀 STARTING USER CONNECTION",{userId:t.id}),v.current=!0,p(!0),b(null);try{i("📞 CALLING SERVICE.CONNECTUSER",{userId:t.id});const I=await c.connectUser(t);h(I),g(!0),j.current={serviceId:c,userId:t.id},i("✅ USER CONNECTION SUCCESS",{userId:t.id,clientId:I.userID})}catch(I){const R=I instanceof Error?I.message:"Connection failed";b(R),i("❌ USER CONNECTION ERROR",{userId:t.id,error:R})}finally{p(!1),v.current=!1,i("🔄 USER CONNECTION FINISHED",{userId:t.id,isConnected:m})}})()},[c,t,i,m]),f.useEffect(()=>(i("🔌 CLEANUP EFFECT REGISTERED",{hasService:!!c,isConnected:m}),()=>{c&&m?(i("🧹 CLEANUP EFFECT TRIGGERED","Cleaning up connection on unmount"),j.current=null,c.disconnectUser().catch(console.error)):i("🔇 CLEANUP EFFECT SKIPPED",{hasService:!!c,isConnected:m})}),[c,m,i]);const T=f.useCallback(async()=>{if(i("🔄 REFRESH CONNECTION CALLED",{hasService:!!c,hasUser:!!t}),!c||!t){i("⚠️ REFRESH CONNECTION SKIPPED","Missing service or user");return}i("🚀 STARTING CONNECTION REFRESH",{userId:t.id}),p(!0);try{i("🔌 DISCONNECTING FOR REFRESH"),await c.disconnectUser(),i("📞 RECONNECTING FOR REFRESH");const L=await c.connectUser(t);h(L),g(!0),b(null),i("✅ CONNECTION REFRESH SUCCESS",{userId:t.id})}catch(L){const F=L instanceof Error?L.message:"Refresh failed";b(F),i("❌ CONNECTION REFRESH ERROR",{userId:t.id,error:F})}finally{p(!1),i("🔄 CONNECTION REFRESH FINISHED",{userId:t.id})}},[c,t,i]),S=f.useMemo(()=>(i("💫 CONTEXT VALUE MEMOIZATION",{hasService:!!c,hasClient:!!u,isConnected:m,isLoading:l,hasError:!!x,capabilitiesKeys:Object.keys(o)}),{service:c,client:u,isConnected:m,isLoading:l,error:x,capabilities:o,refreshConnection:T,debug:a}),[c,u,m,l,x,o,T,a,i]);return i("🔄 RENDER END",{renderCount:C.current,willRenderChat:!!(u&&m),contextValueReady:!!S}),r.jsx(Js.Provider,{value:S,children:u&&m?r.jsx(B.Chat,{client:u,customClasses:{channelList:"str-chat__channel-list str-chat__channel-list-react bg-transparent lg:border-r-2 border-r-0 border-[#0000000A]"},children:e}):e})},Qs=()=>Nn();function xo(e){const t=e.state.pending_messages;if(t!=null&&t.length)for(const n of t)e.state.addMessageSorted(n.message)}const er=f.createContext({selectedChannel:void 0,onChannelSelect:()=>{},debug:!1,renderMessagePreview:void 0,viewerLanguage:void 0}),bo=er.Provider,vo=()=>f.useContext(er),tr=e=>{var s,o;const[t,n]=f.useState(!!((o=(s=e==null?void 0:e.state)==null?void 0:s.membership)!=null&&o.pinned_at));return f.useEffect(()=>{var i;if(!e){n(!1);return}n(!!((i=e.state.membership)!=null&&i.pinned_at));const a=c=>{var d;n(c!=null&&c.member?!!c.member.pinned_at:!!((d=e.state.membership)!=null&&d.pinned_at))};return e.on("member.updated",a),()=>{e.off("member.updated",a)}},[e]),t},wo=(e,t)=>{const n=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())),o=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())).getTime()-n.getTime();return Math.floor(o/(1e3*60*60*24))},nr=e=>{const t=new Date;if(Math.floor((t.getTime()-e.getTime())/1e3)<60)return"Just now";const s=wo(e,t);return s===0?e.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}):s===1?"Yesterday":s<7?`${s}d`:s<28?`${Math.floor(s/7)}w`:e.toLocaleDateString("en-US",{month:"numeric",day:"numeric",year:"2-digit"})};function sr(e){return(e==null?void 0:e.trim().toLowerCase().split(/[-_]/)[0])||void 0}function jn({message:e,viewerLanguage:t}){var o;const n=e==null?void 0:e.text,s=sr(t);return s?((o=e==null?void 0:e.i18n)==null?void 0:o[`${s}_text`])??n:n}const yo=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function rr(e){return yo.test(e.trim())}function xs(e,t){const n=e==null?void 0:e.trim();return!n||t&&n===t?!1:!rr(n)}function zt(e){return xs(e==null?void 0:e.name,e==null?void 0:e.id)?e.name.trim():xs(e==null?void 0:e.username,e==null?void 0:e.id)?e.username.trim():"Unknown member"}const bs=["🍎","🍌","🍇","🍊","🍓","🥥","🍒","🥭","🍉","🍋","🥝","🫒","🍈"];function Eo(e){let t=0;for(let n=0;n<e.length;n++){const s=e.charCodeAt(n);t=(t<<5)-t+s,t=t&t}return Math.abs(t)}function Co(e){const n=Eo(e)%bs.length;return bs[n]}const ke=({id:e,image:t,size:n=40,className:s,starred:o=!1,shape:a="squircle",dmAgentEnabled:i=!1})=>{const c=Co(e),u=n<32?"text-xs":n<56?"text-sm":n<120?"text-lg":"text-4xl",h=n>=40?2:1,m=a==="circle"?{borderRadius:"50%"}:{borderRadius:"33%",cornerShape:"superellipse(1.3)"},g=r.jsx("div",{className:"h-full w-full overflow-hidden",style:m,children:t?r.jsx("img",{src:t,alt:"",className:"h-full w-full object-cover"}):r.jsx("div",{"aria-hidden":"true",className:V("avatar-fallback flex h-full w-full items-center justify-center bg-[#E6E5E3] font-semibold select-none transition-colors",u),children:c})});return r.jsxs("div",{className:V("relative flex-shrink-0 !bg-transparent",s),style:{"--str-chat__avatar-size":`${n}px`,width:`${n}px`,height:`${n}px`},children:[o&&r.jsx("div",{"aria-hidden":"true",className:"absolute -left-1.5 -top-1.5 z-10 flex size-5 items-center justify-center rounded-full bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_4px_8px_rgba(0,0,0,0.06)]",children:r.jsx(P.StarIcon,{className:"size-3 text-yellow-600",weight:"duotone"})}),r.jsx("div",{"data-testid":"avatar-ring",className:V("h-full w-full","bg-transparent"),style:{...m,...i&&{borderWidth:`${h}px`,borderStyle:"solid",borderColor:"var(--AI-Gradient, #7F22FE)",boxShadow:"inset 0 1px 2px 0 rgba(255, 255, 255, 0.5)"}},children:g})]})},_o=({size:e=15})=>r.jsx("svg",{width:e,height:e,viewBox:"0 0 15 15",fill:"none","aria-hidden":"true",children:r.jsx("path",{d:"M12.003 9a.985.985 0 0 1-.652.934l-3.223 1.191-1.188 3.226a.995.995 0 0 1-1.867 0l-1.195-3.226L.65 9.937a.995.995 0 0 1 0-1.867l3.227-1.195 1.187-3.226a.995.995 0 0 1 1.868 0l1.195 3.226 3.226 1.187a.99.99 0 0 1 .649.938m3-5.83a.52.52 0 0 1-.344.492l-1.702.63-.627 1.703a.525.525 0 0 1-.986 0l-.63-1.704-1.704-.627a.525.525 0 0 1 0-.986l1.703-.63.627-1.704a.526.526 0 0 1 .986 0l.631 1.703 1.704.627a.52.52 0 0 1 .342.495",fill:"currentColor",fillOpacity:.55})}),No=e=>{var t;return((t=e.metadata)==null?void 0:t.custom_type)==="MESSAGE_TIP"},jo=e=>{var t;return((t=e.metadata)==null?void 0:t.custom_type)==="MESSAGE_PAID"},kt=e=>{var t;return((t=e.metadata)==null?void 0:t.custom_type)==="MESSAGE_CHATBOT"},So=e=>{var t;return((t=e.metadata)==null?void 0:t.custom_type)==="MESSAGE_ATTACHMENT"},or=e=>No(e)||jo(e),ko=e=>{var t;return or(e)&&!((t=e.text)!=null&&t.trim())},Jt=({message:e,standalone:t=!1,isMyMessage:n=!1,hasAttachment:s=!1})=>{var m;const o=or(e),a=kt(e);if(!o&&!a)return null;if(o){const g=(m=e.metadata)==null?void 0:m.amount_text;if(!g)return null;const l=t?"message-tip-standalone":"message-tag message-tag--tip",p=t?`${g} tip`:`Delivered with ${g} tip`;return r.jsxs("div",{className:l,children:[r.jsx(P.GiftIcon,{size:t?14:12}),r.jsx("span",{children:p})]})}const i=n&&s,c=i?"Sent with AI":"Sent with DM Agent",d=["message-chatbot-indicator",n?"message-chatbot-indicator--sender":"message-chatbot-indicator--receiver",i?"message-chatbot-indicator--attachment":"message-chatbot-indicator--text"].join(" "),u=r.jsx("span",{className:"message-chatbot-indicator__label",children:c}),h=r.jsx("span",{className:"message-chatbot-indicator__icon",children:r.jsx(_o,{size:i?12:15})});return r.jsx("div",{className:d,"data-testid":"message-chatbot-indicator",children:n&&!i?r.jsxs(r.Fragment,{children:[u,h]}):r.jsxs(r.Fragment,{children:[h,u]})})},ar=f.memo(({channel:e,unread:t})=>{var S,L,F;const{selectedChannel:n,onChannelSelect:s,debug:o,renderMessagePreview:a,viewerLanguage:i}=vo(),c=(n==null?void 0:n.id)===(e==null?void 0:e.id),d=()=>{e&&s(e)},u=z=>{const I=z.key==="Enter"||z.key===" ",R=z.repeat;!I||R||(z.preventDefault(),d())},m=Object.values(((S=e==null?void 0:e.state)==null?void 0:S.members)||{}).find(z=>{var I,R;return((I=z.user)==null?void 0:I.id)&&z.user.id!==((R=e==null?void 0:e._client)==null?void 0:R.userID)}),g=zt(m==null?void 0:m.user),l=(L=m==null?void 0:m.user)==null?void 0:L.image,p=(()=>{var I;const z=(I=e==null?void 0:e.state)==null?void 0:I.messages;if(z!=null&&z.length){for(let R=z.length-1;R>=0;R--)if(z[R].type!=="system")return z[R]}})(),b=(()=>{var U,W;const z=jn({message:p,viewerLanguage:i});if(z)return z;if(((U=p==null?void 0:p.metadata)==null?void 0:U.custom_type)==="MESSAGE_TIP")return"💵 Sent a tip";const R=(W=p==null?void 0:p.attachments)==null?void 0:W[0];return R?R.og_scrape_url?R.og_scrape_url:R.type==="image"?"📷 Sent an image":R.type==="video"?"🎥 Sent a video":R.type==="audio"?"🎵 Sent audio":R.type==="file"?"📎 Sent a file":"📎 Sent an attachment":"No messages yet"})(),v=p!=null&&p.created_at?nr(new Date(p.created_at)):"",w=p?kt(p):!1,C=a?a(p,b):`${w?"✨ ":""}${b}`,j=tr(e),T=t??0;return o&&console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER",{channelId:e==null?void 0:e.id,isSelected:c,participantName:g,unreadCount:T,hasTimestamp:!!v}),r.jsx("div",{role:"button",tabIndex:0,onClick:d,onKeyDown:u,className:V("group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",{"bg-primary-alt/10 border-l-4 border-l-primary":c,"hover:bg-sand":!c}),children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(ke,{id:((F=m==null?void 0:m.user)==null?void 0:F.id)||e.id||"unknown",name:g,image:l,size:44,starred:j,className:"[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"}),r.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-1",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("h3",{className:V("text-sm font-medium truncate",c?"text-primary":"text-charcoal"),children:[j&&r.jsx("span",{className:"sr-only",children:"Starred conversation. "}),g]}),v&&r.jsx("span",{className:"text-xs text-stone flex-shrink-0",children:v})]}),r.jsxs("div",{className:"flex items-center justify-between gap-2 min-w-0",children:[r.jsx("p",{className:"text-xs text-stone flex-1 line-clamp-1",children:C}),T>0&&r.jsx("span",{className:"bg-[#7f22fe] text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0",children:T>99?"99+":T})]})]})]})})});ar.displayName="CustomChannelPreview";const $o={last_message_at:-1},Sn=f.memo(({onChannelSelect:e,selectedChannel:t,filters:n,allowNewMessagesFromUnfilteredChannels:s=!1,onMessageNew:o,onAddedToChannel:a,channelRenderFilterFn:i,sort:c=$o,className:d,customEmptyStateIndicator:u,renderMessagePreview:h,viewerLanguage:m})=>{const g=f.useRef(0);g.current++;const{debug:l=!1}=Nn(),p=f.useCallback(b=>{for(const v of b)xo(v);return i?i(b):b},[i]);l&&console.log("📺 [ChannelList] 🔄 RENDER START",{renderCount:g.current,selectedChannelId:t==null?void 0:t.id,filters:n});const x=f.useMemo(()=>({selectedChannel:t,onChannelSelect:e,debug:l,renderMessagePreview:h,viewerLanguage:m}),[t,e,l,h,m]);return r.jsx("div",{className:V("messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",d),children:r.jsx("div",{className:"flex-1 overflow-hidden min-w-0",children:r.jsx(bo,{value:x,children:r.jsx(B.ChannelList,{filters:n,sort:c,options:{limit:30},allowNewMessagesFromUnfilteredChannels:s,onMessageNew:o,onAddedToChannel:a,channelRenderFilterFn:p,Preview:ar,EmptyStateIndicator:u},`${JSON.stringify(n)}:${JSON.stringify(c)}`)})})})});Sn.displayName="ChannelList";const rt=({variant:e="default",className:t,children:n,...s})=>{const o=e==="danger";return r.jsx("button",{type:"button",className:V("flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left text-sm transition-colors focus-ring disabled:cursor-not-allowed disabled:opacity-60",o?"text-danger hover:bg-danger/50":"text-charcoal hover:bg-sand",t),...s,children:n})};function Mo({label:e,className:t,children:n,...s}){return r.jsxs("button",{type:"button",className:V("inline-flex items-center justify-center rounded-full transition-colors focus-ring p-2",{"cursor-not-allowed opacity-50":s.disabled,"hover:bg-sand":!s.disabled},t),...s,children:[r.jsx("span",{className:"sr-only",children:e}),n]})}function Ro({onClick:e}){return r.jsx(Mo,{label:"Close",onClick:e,className:"p-1",children:r.jsx(P.XIcon,{className:"h-5 w-5 text-stone",weight:"bold"})})}const To=({dialogRef:e,onClose:t,participant:n,participantDisplayName:s,channel:o,followerStatusLabel:a,onLeaveConversation:i,onBlockParticipant:c,showDeleteConversation:d=!0,onDeleteConversationClick:u,onBlockParticipantClick:h,onReportParticipantClick:m,customProfileContent:g,customChannelActions:l})=>{var _,k,y,$;const{service:p,debug:x}=Nn(),[b,v]=f.useState(!1),[w,C]=f.useState(!1),[j,T]=f.useState(!1),S=f.useCallback(async()=>{var E;if(!(!p||!((E=n==null?void 0:n.user)!=null&&E.id)))try{const N=(await p.getBlockedUsers()).some(O=>{var H;return O.blocked_user_id===((H=n==null?void 0:n.user)==null?void 0:H.id)});v(N)}catch(D){console.error("[ChannelInfoDialog] Failed to check blocked status:",D)}},[p,(_=n==null?void 0:n.user)==null?void 0:_.id]);f.useEffect(()=>{S()},[S]);const L=async()=>{var E;if(!w){u==null||u(),x&&console.log("[ChannelInfoDialog] Leave conversation",o.cid),C(!0);try{const D=((E=o._client)==null?void 0:E.userID)??null;await o.hide(D,!1),i&&await i(o),t()}catch(D){console.error("[ChannelInfoDialog] Failed to leave conversation",D)}finally{C(!1)}}},F=async()=>{var E,D,N;if(!(j||!p)){h==null||h(),x&&console.log("[ChannelInfoDialog] Block member",(E=n==null?void 0:n.user)==null?void 0:E.id),T(!0);try{await p.blockUser((D=n==null?void 0:n.user)==null?void 0:D.id),c&&await c((N=n==null?void 0:n.user)==null?void 0:N.id),t()}catch(O){console.error("[ChannelInfoDialog] Failed to block member",O)}finally{T(!1)}}},z=async()=>{var E,D,N;if(!(j||!p)){h==null||h(),x&&console.log("[ChannelInfoDialog] Unblock member",(E=n==null?void 0:n.user)==null?void 0:E.id),T(!0);try{await p.unBlockUser((D=n==null?void 0:n.user)==null?void 0:D.id),c&&await c((N=n==null?void 0:n.user)==null?void 0:N.id),t()}catch(O){console.error("[ChannelInfoDialog] Failed to unblock member",O)}finally{T(!1)}}},I=()=>{m==null||m(),t(),window.open("https://linktr.ee/s/about/trust-center/report","_blank","noopener,noreferrer")};if(!n)return null;const R=s??zt(n.user),U=(k=n.user)==null?void 0:k.image,W=(y=n.user)==null?void 0:y.username,A=W?`linktr.ee/${W}`:void 0,M=(($=n.user)==null?void 0:$.id)||"unknown";return r.jsx("dialog",{ref:e,className:"mes-dialog group",onClose:t,onClick:E=>{E.target===e.current&&t()},children:r.jsxs("div",{className:"ml-auto flex h-full w-full flex-col bg-white shadow-none transition-shadow duration-200 group-open:shadow-max-elevation-light",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-sand px-4 py-3",children:[r.jsx("h2",{className:"text-base font-semibold text-charcoal",children:"Chat info"}),r.jsx(Ro,{onClick:t})]}),r.jsxs("div",{className:"flex-1 px-2 overflow-y-auto w-full",children:[r.jsxs("div",{className:"flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",style:{backgroundColor:"#FBFAF9"},children:[r.jsxs("div",{className:"flex items-center gap-3 w-full",children:[r.jsx(ke,{id:M,name:R,image:U,size:88,shape:"circle"}),r.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-base font-semibold text-charcoal",children:R}),A&&r.jsx("p",{className:"truncate text-sm text-[#00000055]",children:A}),a&&!g&&r.jsx("span",{className:"mt-1 rounded-full text-xs font-normal w-fit",style:{padding:"4px 8px",backgroundColor:a==="Subscribed to you"?"#DCFCE7":"#F5F5F4",color:a==="Subscribed to you"?"#008236":"#78716C",lineHeight:"133.333%",letterSpacing:"0.21px"},children:a})]})]}),g&&r.jsx("div",{className:"w-full",children:g})]}),r.jsxs("ul",{className:"flex flex-col gap-2 mt-2",children:[d&&r.jsx("li",{children:r.jsxs(rt,{onClick:L,disabled:w,"aria-busy":w,children:[w?r.jsx(P.SpinnerGapIcon,{className:"h-5 w-5 animate-spin"}):r.jsx(P.SignOutIcon,{className:"h-5 w-5"}),r.jsx("span",{children:"Delete Conversation"})]})}),r.jsx("li",{children:b?r.jsxs(rt,{onClick:z,disabled:j,"aria-busy":j,children:[j?r.jsx(P.SpinnerGapIcon,{className:"h-5 w-5 animate-spin"}):r.jsx(P.ProhibitInsetIcon,{className:"h-5 w-5"}),r.jsx("span",{children:"Unblock"})]}):r.jsxs(rt,{onClick:F,disabled:j,"aria-busy":j,children:[j?r.jsx(P.SpinnerGapIcon,{className:"h-5 w-5 animate-spin"}):r.jsx(P.ProhibitInsetIcon,{className:"h-5 w-5"}),r.jsx("span",{children:"Block"})]})}),r.jsx("li",{children:r.jsxs(rt,{variant:"danger",onClick:I,children:[r.jsx(P.FlagIcon,{className:"h-5 w-5"}),r.jsx("span",{children:"Report"})]})}),l]})]})]})})},Io=e=>r.jsx(B.DateSeparator,{...e,position:"center"}),dn="vote_up",fn="vote_down";function Lo(e){return e!=null&&e.length?e.some(t=>t.type===fn)?"down":e.some(t=>t.type===dn)?"up":null:null}function ir(e){const{channel:t}=B.useChannelStateContext(),{client:n}=B.useChatContext("useMessageVote"),s=f.useMemo(()=>Lo(e.own_reactions),[e.own_reactions]),o=f.useCallback(async()=>{if(n!=null&&n.userID)try{s==="up"?await t.deleteReaction(e.id,dn):await t.sendReaction(e.id,{type:dn},{enforce_unique:!0,skip_push:!0})}catch{}},[t,n==null?void 0:n.userID,e.id,s]),a=f.useCallback(async()=>{if(n!=null&&n.userID)try{s==="down"?await t.deleteReaction(e.id,fn):await t.sendReaction(e.id,{type:fn},{enforce_unique:!0,skip_push:!0})}catch{}},[t,n==null?void 0:n.userID,e.id,s]);return{selected:s,voteUp:o,voteDown:a}}const Do=f.lazy(()=>Promise.resolve().then(()=>require("./Card-DApWNv5V.cjs"))),Ao=f.lazy(()=>Promise.resolve().then(()=>require("./Card-BkWwtS0b.cjs"))),Oo=f.lazy(()=>Promise.resolve().then(()=>require("./Card-BlzGsGam.cjs"))),kn=()=>r.jsx("div",{className:"w-[280px] min-h-[200px] animate-pulse rounded-md bg-black/[0.06] shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_1px_2px_rgba(0,0,0,0.04),0_8px_32px_rgba(0,0,0,0.1)]","aria-hidden":!0}),Fo=e=>r.jsx(f.Suspense,{fallback:r.jsx(kn,{}),children:r.jsx(Do,{...e})}),cr=e=>r.jsx(f.Suspense,{fallback:r.jsx(kn,{}),children:r.jsx(Ao,{...e})}),lr=e=>r.jsx(f.Suspense,{fallback:r.jsx(kn,{}),children:r.jsx(Oo,{...e})}),Po=cr,zo=lr,mn={Composer:Fo,Sent:cr,Received:lr,Creator:Po,Visitor:zo},Bo=[[/pdf/,"pdf"],[/wordprocessingml|msword|\.doc/,"doc"],[/spreadsheetml|ms-excel|\.xls/,"xls"],[/csv/,"csv"],[/presentationml|ms-powerpoint|\.ppt/,"ppt"],[/zip|x-rar|x-7z|x-tar|x-gzip/,"zip"],[/plain|rtf/,"text"],[/markdown/,"markdown"]];function Re(e){return e.startsWith("video/")?"video":e.startsWith("audio/")?"audio":e.startsWith("image/")?"image":"document"}function ur(e){const t=Bo.find(([n])=>n.test(e));return t?t[1]:"generic"}const Vo={video:P.VideoCameraIcon,audio:P.SpeakerHighIcon,image:P.ImageIcon,document:P.FileIcon},Uo={pdf:P.FilePdfIcon,doc:P.FileDocIcon,xls:P.FileXlsIcon,csv:P.FileCsvIcon,ppt:P.FilePptIcon,zip:P.FileZipIcon,text:P.FileTextIcon,markdown:P.FileMdIcon,generic:P.FileIcon};function Ho(e){const t=Re(e);return t!=="document"?Vo[t]:Uo[ur(e)]}function Ue(e,t){return f.createElement(Ho(e),t)}const Wo=e=>{var t,n;return"touches"in e?((t=e.touches[0])==null?void 0:t.clientX)??((n=e.changedTouches[0])==null?void 0:n.clientX)??0:e.clientX},Yo=({source:e,mimeType:t,poster:n,autoPlay:s=!1,playing:o,loop:a=!1,controls:i=!0,showProgress:c=!1,muted:d=!1,onContainerClick:u})=>{const h=Re(t),m=f.useRef(null),g=f.useRef(null),l=f.useRef(null),p=f.useRef(o),[x,b]=f.useState(s),[v,w]=f.useState(0),[C,j]=f.useState(!1),[T,S]=f.useState(!1),[L,F]=f.useState(!1),[z,I]=f.useState(!1),[R,U]=f.useState(!0),[W,A]=f.useState(null),M=f.useCallback(()=>{F(!1),b(!0)},[]),_=f.useCallback(N=>{const O=g.current;if(!O)return 0;const H=O.getBoundingClientRect();return Math.max(0,Math.min(1,(Wo(N)-H.left)/H.width))},[]),k=f.useCallback(N=>{const O=m.current;O&&O.duration&&(O.currentTime=N*O.duration)},[]),y=N=>{N.stopPropagation(),j(!0);const O=_(N);w(O),k(O)};f.useEffect(()=>{o!==void 0&&o!==p.current&&(p.current=o,b(o))},[o]),f.useEffect(()=>{if(!x){l.current!==null&&(cancelAnimationFrame(l.current),l.current=null);return}const N=()=>{const O=m.current;O&&O.duration&&!C&&w(O.currentTime/O.duration),l.current=requestAnimationFrame(N)};return l.current=requestAnimationFrame(N),()=>{l.current!==null&&cancelAnimationFrame(l.current)}},[x,C]),f.useEffect(()=>{const N=m.current;N&&(x?N.play().catch(O=>{b(!1),F(!0)}):N.pause())},[x]),f.useEffect(()=>{if(!C)return;const N=H=>w(_(H)),O=H=>{j(!1),k(_(H))};return window.addEventListener("mousemove",N),window.addEventListener("mouseup",O),window.addEventListener("touchmove",N,{passive:!0}),window.addEventListener("touchend",O),()=>{window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",O),window.removeEventListener("touchmove",N),window.removeEventListener("touchend",O)}},[C,_,k]);const $=W?{aspectRatio:String(W)}:void 0,E=W?"":" aspect-video",D=Math.round(v*100);return r.jsxs("div",{role:"button",tabIndex:0,className:`relative cursor-pointer overflow-hidden bg-black ${E}`,style:$,onClick:N=>{if(u){u(N);return}L||i&&b(O=>!O)},onKeyDown:N=>{if(!(N.key!=="Enter"&&N.key!==" ")){if(N.preventDefault(),u){u(N);return}L||i&&b(O=>!O)}},children:[n&&(h==="audio"||R)&&r.jsx("img",{src:n,alt:"",className:"absolute inset-0 h-full w-full object-cover"}),!n&&(h==="audio"||R)&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:Ue(t,{className:"size-12 text-black/20",weight:"regular"})}),r.jsx("div",{className:"absolute inset-0",children:h==="audio"?r.jsx("audio",{ref:m,src:e,loop:a,muted:d,style:{width:"100%",height:"100%"},onLoadStart:()=>I(!0),onCanPlay:()=>{I(!1),U(!1)},onWaiting:()=>I(!0),onPlay:()=>F(!1),onEnded:()=>{a||(b(!1),w(0))},children:r.jsx("track",{kind:"captions"})}):r.jsx("video",{ref:m,src:e,loop:a,muted:d,playsInline:!0,style:{width:"100%",height:"100%"},onLoadStart:()=>I(!0),onCanPlay:()=>{I(!1),U(!1)},onWaiting:()=>I(!0),onPlay:()=>F(!1),onLoadedMetadata:()=>{const N=m.current;N instanceof HTMLVideoElement&&N.videoWidth&&N.videoHeight&&A(N.videoWidth/N.videoHeight)},onEnded:()=>{a||(b(!1),w(0))},children:r.jsx("track",{kind:"captions"})})}),z&&!L&&r.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:r.jsx(P.CircleNotchIcon,{className:"size-8 animate-spin text-white/80",weight:"bold"})}),L&&!i&&r.jsx("div",{className:"absolute inset-0 z-30 flex cursor-pointer items-center justify-center bg-black/35",role:"button",tabIndex:0,"aria-label":"Play preview",onClick:N=>{N.stopPropagation(),M()},onKeyDown:N=>{N.key!=="Enter"&&N.key!==" "||(N.preventDefault(),N.stopPropagation(),M())},children:r.jsx("span",{className:"flex size-16 items-center justify-center rounded-full bg-white/20 text-white backdrop-blur-sm",children:r.jsx(P.PlayIcon,{className:"size-9 translate-x-0.5",weight:"fill"})})}),c&&!i&&r.jsx("div",{className:"absolute inset-x-0 bottom-0 px-3 pb-2.5 pt-6 bg-gradient-to-t from-black/40 to-transparent",children:r.jsx("div",{role:"slider","aria-label":"Playback position","aria-valuenow":D,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0,ref:g,className:"relative flex h-4 w-full cursor-pointer items-center",onMouseDown:y,onTouchStart:y,onClick:N=>N.stopPropagation(),onKeyDown:N=>{N.key==="ArrowRight"&&k(Math.min(1,v+.05)),N.key==="ArrowLeft"&&k(Math.max(0,v-.05))},children:r.jsx("div",{className:"w-full overflow-hidden rounded-full bg-white/30 h-1",children:r.jsx("div",{className:"h-full rounded-full bg-white",style:{width:`${D}%`}})})})}),i&&r.jsxs("div",{className:"absolute inset-x-0 bottom-0 flex items-center gap-2 bg-gradient-to-t from-black/60 to-transparent px-3 pb-2.5 pt-6 transition-all duration-200",children:[r.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),b(O=>!O)},className:"shrink-0 text-white","aria-label":x?"Pause":"Play",children:x?r.jsx(P.PauseIcon,{className:"size-5",weight:"fill"}):r.jsx(P.PlayIcon,{className:"size-5 translate-x-px",weight:"fill"})}),r.jsxs("div",{role:"slider","aria-label":"Playback position","aria-valuenow":D,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0,ref:g,className:"relative flex h-4 w-full cursor-pointer items-center",onMouseDown:y,onTouchStart:y,onClick:N=>N.stopPropagation(),onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),onKeyDown:N=>{N.key==="ArrowRight"&&k(Math.min(1,v+.05)),N.key==="ArrowLeft"&&k(Math.max(0,v-.05))},children:[r.jsx("div",{className:`w-full overflow-hidden rounded-full bg-white/30 transition-all duration-200 ${T||C?"h-1.5":"h-1"}`,children:r.jsx("div",{className:"h-full rounded-full bg-white",style:{width:`${D}%`}})}),r.jsx("div",{className:`absolute size-3 -translate-x-1/2 rounded-full bg-white shadow transition-[opacity,transform] duration-200 ${T||C?"scale-100 opacity-100":"scale-0 opacity-0"}`,style:{left:`${D}%`}})]})]})]})},vs=e=>e==="dark"?"size-12 text-white/20":"size-12 text-black/20",Go=e=>e==="dark"?"aspect-video overflow-hidden bg-white/10":"aspect-video overflow-hidden bg-black/5",$n=({mimeType:e,sourceUrl:t,thumbnailUrl:n,title:s,variant:o,mediaPlayerProps:a,containedImage:i=!1})=>{const c=Re(e),[d,u]=f.useState(!1);return t&&(c==="video"||c==="audio")?r.jsx(Yo,{source:t,mimeType:e,poster:n,controls:!0,...a}):t&&c==="image"?i?r.jsx("div",{className:"relative aspect-video overflow-hidden bg-black/5",children:r.jsx("img",{src:t,alt:s??"",className:`absolute inset-0 h-full w-full object-contain transition-opacity duration-300 ${d?"opacity-100":"opacity-0"}`,draggable:!1,onLoad:()=>u(!0)})}):r.jsx("img",{src:t,alt:s??"",className:"block w-full",draggable:!1}):t&&c==="document"?n?i?r.jsx("div",{className:"relative aspect-video overflow-hidden bg-black/5",children:r.jsx("img",{src:n,alt:s??"",className:`absolute inset-0 h-full w-full object-contain transition-opacity duration-300 ${d?"opacity-100":"opacity-0"}`,draggable:!1,onLoad:()=>u(!0)})}):r.jsx("img",{src:n,alt:"",className:"block w-full",draggable:!1}):r.jsx("div",{className:`flex aspect-video w-full items-center justify-center ${o==="dark"?"bg-white/10":"bg-black/5"}`,children:Ue(e,{className:vs(o),weight:"regular"})}):n?r.jsx("div",{className:`relative ${Go(o)}`,children:r.jsx("img",{src:n,alt:s??"",draggable:!1,className:"absolute inset-0 h-full w-full object-cover"})}):r.jsx("div",{className:`flex aspect-video w-full items-center justify-center ${o==="dark"?"bg-white/10":"bg-black/5"}`,children:Ue(e,{className:vs(o),weight:"regular"})})},dr=({variant:e,thumbnail:t,title:n,placeholderTitle:s="Attachment title",mimeType:o,detail:a,statusBadge:i,action:c,topLeft:d,topRight:u,rootRef:h,"data-testid":m})=>{const g=e==="dark",l=g?n??s:n??"",p=g&&!n;return r.jsxs("div",{ref:h,"data-testid":m,className:V("relative w-[280px] select-none overflow-hidden rounded-[24px] shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_4px_8px_rgba(0,0,0,0.06)]",g?"bg-[#121110]":"bg-white"),children:[d?r.jsx("div",{className:"pointer-events-auto absolute left-3 top-3 z-50",children:d}):null,u?r.jsx("div",{className:"pointer-events-auto absolute right-3 top-3 z-50",children:u}):null,t,r.jsxs("div",{className:"px-4 pb-3 pt-3",children:[l.trim()!==""&&r.jsx("p",{className:V("mb-0.5 truncate text-base font-medium",{"text-black":!g,"text-white/30":g&&p,"text-white":g&&!p}),children:l}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[Ue(o,{className:V("size-5 shrink-0",g?"text-white/55":"text-black/55"),weight:"regular"}),a!=null&&a!==""&&r.jsx("span",{className:V("text-xs font-medium",g?"text-white/55":"text-black/55"),children:a}),i]}),c]})]})};function fr(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Mn(e){return`w-[280px] select-none overflow-hidden rounded-[24px] ${e?"bg-[#121110]":"bg-[#F3F3F1]"} shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_4px_8px_rgba(0,0,0,0.06)]`}function qo(e){return e?"bg-white/10":"bg-black/5"}function Ko(e){return e?"text-white":"text-black"}function Xo(e){return e?"text-white/55":"text-black/55"}function Zo(e){return e?"text-white/40":"text-black/40"}function Jo(e){return e?"text-white/20":"text-black/20"}const Rn=({attachment:e,isMyMessage:t})=>{const{title:n,text:s,image_url:o,og_scrape_url:a,title_link:i}=e,c=a??i,d=typeof c=="string"&&c.trim()!==""?c:void 0,u=r.jsxs(f.Fragment,{children:[r.jsx("div",{className:"p-2",children:o?r.jsx("img",{src:o,alt:n??"",className:"aspect-video w-full rounded-[20px] object-cover"}):r.jsx("div",{className:`aspect-video w-full rounded-[20px] ${qo(t)} flex items-center justify-center`,children:r.jsx(P.LinkIcon,{className:`size-12 ${Jo(t)}`})})}),r.jsxs("div",{className:"px-3 pb-3",children:[n&&r.jsx("p",{className:`truncate text-[14px] font-medium leading-5 ${Ko(t)}`,children:n}),s&&r.jsx("p",{className:`truncate text-[12px] leading-4 ${Xo(t)}`,children:s}),d&&r.jsx("p",{className:`mt-1 truncate text-[12px] leading-4 ${Zo(t)}`,children:d})]})]});return d?r.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:"block no-underline",children:u}):r.jsx("div",{className:"block",children:u})};function Tn(e){return e.type==="link"||!!e.og_scrape_url&&!e.asset_url}function Bt(e){var t;return(t=e.attachments)==null?void 0:t.find(Tn)}async function Qo(e,t){let n;try{n=t??new URL(e).pathname.split("/").pop()??"download"}catch{n=t??"download"}const s=await fetch(e,{mode:"cors"});if(!s.ok)throw new Error(`HTTP ${s.status}`);const o=await s.blob(),a=URL.createObjectURL(o),i=document.createElement("a");i.href=a,i.download=n,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(a)}const ea=({url:e,filename:t})=>{const[n,s]=f.useState(!1),o=a=>{a.stopPropagation();const i=window.open("","_blank","noopener,noreferrer");s(!0),Qo(e,t).then(()=>{i==null||i.close()}).catch(()=>{i&&(i.location.href=e)}).finally(()=>s(!1))};return r.jsx("button",{type:"button",onClick:o,disabled:n,className:"mt-3 inline-flex h-10 w-full items-center justify-center gap-2 rounded-full bg-[#121110] px-4 text-sm font-medium leading-none text-white hover:bg-[#2a2928] disabled:opacity-70",children:n?r.jsx(P.CircleNotchIcon,{className:"size-4 animate-spin text-white",weight:"bold"}):r.jsxs(f.Fragment,{children:[r.jsx(P.DownloadSimpleIcon,{className:"size-4 text-white",weight:"bold"}),"Download"]})})};function Vt(e){var m,g,l,p;const t=(m=e.attachments)==null?void 0:m.find(x=>x.type==="video"&&x.asset_url),n=(g=e.attachments)==null?void 0:g.find(x=>x.type==="image"&&x.image_url),s=(l=e.attachments)==null?void 0:l.find(x=>x.type==="audio"&&x.asset_url),o=(p=e.attachments)==null?void 0:p.find(x=>x.type==="file"&&x.asset_url),a=t??n??s??o,i=(t==null?void 0:t.asset_url)??(n==null?void 0:n.image_url)??(s==null?void 0:s.asset_url)??(o==null?void 0:o.asset_url);if(!i)return null;const c=(a==null?void 0:a.mime_type)??((a==null?void 0:a.type)==="image"?"image/jpeg":(a==null?void 0:a.type)==="video"?"video/mp4":(a==null?void 0:a.type)==="audio"?"audio/mpeg":"application/octet-stream"),d=a==null?void 0:a.title,u=a==null?void 0:a.file_size,h=t==null?void 0:t.thumb_url;return{resolvedUrl:i,resolvedType:c,title:d,fileSize:u,thumbnailUrl:h}}const mr=({resolvedUrl:e,resolvedType:t,title:n,fileSize:s,thumbnailUrl:o})=>{const a=s!==void 0?fr(s):void 0;return r.jsx(dr,{variant:"dark",title:n,placeholderTitle:"",mimeType:t,detail:a,thumbnail:r.jsx($n,{mimeType:t,sourceUrl:e,thumbnailUrl:o,title:n,variant:"dark"})})},hr=({resolvedUrl:e,resolvedType:t,title:n,fileSize:s,thumbnailUrl:o})=>{const a=Re(t),i=s!==void 0?fr(s):void 0;return r.jsx(dr,{variant:"light",title:n,mimeType:t,detail:i,thumbnail:r.jsx($n,{mimeType:t,sourceUrl:e,thumbnailUrl:o,title:n,variant:"light",containedImage:a==="image"||a==="document"}),action:r.jsx(ea,{url:e,filename:n})})},ta=({message:e,isMyMessage:t=!1})=>{const n=Bt(e),s=Vt(e);if(!n&&!s)return null;const o=t?"str-chat__message str-chat__message-simple str-chat__message--me str-chat__message-simple--me":"str-chat__message str-chat__message-simple str-chat__message--other";return r.jsxs("div",{className:o,children:[!t&&e.user&&r.jsx(ke,{className:"str-chat__avatar str-chat__message-sender-avatar",id:e.user.id,image:e.user.image,name:e.user.name??e.user.id}),r.jsx("div",{className:"str-chat__message-inner",style:{marginInlineEnd:0,marginInlineStart:0},children:r.jsx("div",{className:"str-chat__message-bubble-wrapper",children:r.jsx("div",{className:"str-chat__message-bubble",style:{padding:0,borderRadius:0,overflow:"visible",background:"transparent"},children:n?r.jsx("div",{className:Mn(t),children:r.jsx(Rn,{attachment:n,isMyMessage:t})}):t?r.jsx(mr,{...s}):r.jsx(hr,{...s})})})})]})},na=({message:e})=>{const t=Bt(e);if(t)return r.jsx("div",{className:Mn(!0),children:r.jsx(Rn,{attachment:t,isMyMessage:!0})});const n=Vt(e);return n?r.jsx(mr,{...n}):null},sa=({message:e})=>{const t=Bt(e);if(t)return r.jsx("div",{className:Mn(!1),children:r.jsx(Rn,{attachment:t,isMyMessage:!1})});const n=Vt(e);return n?r.jsx(hr,{...n}):null},ra=Object.assign(ta,{Creator:na,Visitor:sa}),oa={isUnlocking:()=>!1},aa={LockedAttachment:oa},gr=f.createContext({}),ia=gr.Provider;function pr(e){return f.useContext(gr)[e]??aa[e]}const xr=({selected:e,onVoteUp:t,onVoteDown:n})=>r.jsxs("div",{className:"message-vote-buttons",children:[r.jsx("button",{type:"button",className:V("message-vote-button focus-ring",{"message-vote-button--selected":e==="up"}),onClick:t,"aria-label":"Good response","aria-pressed":e==="up","data-tooltip":"Good response",children:r.jsx(P.ThumbsUpIcon,{size:16,weight:e==="up"?"fill":"regular"})}),r.jsx("button",{type:"button",className:V("message-vote-button focus-ring",{"message-vote-button--selected":e==="down"}),onClick:n,"aria-label":"Bad response","aria-pressed":e==="down","data-tooltip":"Bad response",children:r.jsx(P.ThumbsDownIcon,{size:16,weight:e==="down"?"fill":"regular"})})]}),ca=e=>{var ts,ns,ss,rs,os,as,is,cs,ls,us,ds,fs,ms,hs;const{additionalMessageInputProps:t,chatbotVotingEnabled:n,editing:s,endOfGroup:o,firstOfGroup:a,groupedByUser:i,handleAction:c,handleOpenThread:d,handleRetry:u,highlighted:h,isMessageAIGenerated:m,isMyMessage:g,message:l,renderText:p,threadList:x,viewerLanguage:b}=e,{client:v}=B.useChatContext("CustomMessage"),{channel:w}=B.useChannelStateContext("CustomMessage"),{isUnlocking:C,onUnlockClick:j,onFetchSource:T,onDownloadClick:S}=pr("LockedAttachment"),[L,F]=f.useState(!1),z=B.useMessageReminder(l.id),{selected:I,voteUp:R,voteDown:U}=ir(l),{Attachment:W=B.Attachment,EditMessageModal:A=B.EditMessageModal,MessageActions:M,MessageBlocked:_=B.MessageBlocked,MessageBouncePrompt:k=B.MessageBouncePrompt,MessageDeleted:y=B.MessageDeleted,MessageIsThreadReplyInChannelButtonIndicator:$=B.MessageIsThreadReplyInChannelButtonIndicator,MessageRepliesCountButton:E=B.MessageRepliesCountButton,ReminderNotification:D=B.ReminderNotification,StreamedMessageText:N=B.StreamedMessageText,PinIndicator:O}=B.useComponentContext("CustomMessage"),H=B.messageHasAttachments(l),G=B.messageHasReactions(l),re=f.useMemo(()=>m==null?void 0:m(l),[m,l]),X=f.useMemo(()=>{const tt=l.attachments??[],xt=l.shared_location?[l.shared_location,...tt]:tt;if(!kt(l))return xt;const gs=xt.filter(ps=>!("type"in ps)||!Tn(ps));return gs.length===xt.length?xt:gs},[l]),me=f.useMemo(()=>{const tt=jn({message:l,viewerLanguage:b});return tt===l.text?l:{...l,text:tt}},[l,b]);if(B.isDateSeparatorMessage(l))return null;if(l.deleted_at||l.type==="deleted")return r.jsx(y,{message:l});if(B.isMessageBlocked(l))return r.jsx(_,{});const le=!x&&!!l.reply_count,K=!x&&l.show_in_channel&&l.parent_id,Q=l.status==="failed"&&((ts=l.error)==null?void 0:ts.status)!==403,xe=B.isMessageBounced(l);let ae;Q?ae=()=>u(l):xe&&(ae=()=>F(!0));const Fe=g(),Zt=V("str-chat__message str-chat__message-simple",`str-chat__message--${l.type}`,`str-chat__message--${l.status}`,Fe?"str-chat__message--me str-chat__message-simple--me":"str-chat__message--other",l.text?"str-chat__message--has-text":"has-no-text",{"str-chat__message--has-attachment":H,"str-chat__message--highlighted":h,"str-chat__message--pinned pinned-message":l.pinned,"str-chat__message--with-reactions":G,"str-chat__message-send-can-be-retried":(l==null?void 0:l.status)==="failed"&&((ns=l==null?void 0:l.error)==null?void 0:ns.status)!==403,"str-chat__message-with-thread-link":le||K,"str-chat__virtual-message__wrapper--end":o,"str-chat__virtual-message__wrapper--first":a,"str-chat__virtual-message__wrapper--group":i}),Pe=l.poll_id&&v.polls.fromState(l.poll_id),Z=ko(l),se=kt(l),_e=So(l),Ne=!!(X!=null&&X.length&&!l.quoted_message),es=se&&Fe&&Ne;return r.jsxs(r.Fragment,{children:[s&&r.jsx(A,{additionalMessageInputProps:t}),L&&r.jsx(B.MessageBounceModal,{MessageBouncePrompt:k,onClose:()=>F(!1),open:L}),r.jsxs("div",{className:Zt,children:[O&&r.jsx(O,{}),!!z&&r.jsx(D,{reminder:z}),l.user&&r.jsx(ke,{className:"str-chat__avatar str-chat__message-sender-avatar",id:l.user.id,image:l.user.image,name:l.user.name||l.user.id,size:se?24:28,shape:"circle",dmAgentEnabled:se}),r.jsxs("div",{className:V("str-chat__message-inner",{"str-chat__simple-message--error-failed":Q||xe}),"data-testid":"message-inner",onClick:ae,onKeyDown:ae,role:ae?"button":void 0,tabIndex:ae?0:void 0,style:{marginInlineEnd:0,marginInlineStart:0},children:[_e?r.jsxs("div",{className:"str-chat__message-bubble-wrapper",children:[Fe?r.jsx(mn.Sent,{title:(ss=l.metadata)==null?void 0:ss.attachment_title,mimeType:(rs=l.metadata)==null?void 0:rs.attachment_mime_type,thumbnailUrl:(os=l.metadata)==null?void 0:os.attachment_thumbnail,amountText:(as=l.metadata)==null?void 0:as.amount_text,detail:(is=l.metadata)==null?void 0:is.attachment_detail,paymentStatus:(cs=l.metadata)==null?void 0:cs.payment_status,onPreviewClick:()=>j==null?void 0:j(l,w),onFetchSource:async()=>await(T==null?void 0:T(l,w))}):r.jsx(mn.Received,{title:(ls=l.metadata)==null?void 0:ls.attachment_title,mimeType:(us=l.metadata)==null?void 0:us.attachment_mime_type,thumbnailUrl:(ds=l.metadata)==null?void 0:ds.attachment_thumbnail,amountText:(fs=l.metadata)==null?void 0:fs.amount_text,detail:(ms=l.metadata)==null?void 0:ms.attachment_detail,paymentStatus:(hs=l.metadata)==null?void 0:hs.payment_status,isUnlocking:C(l.id),onUnlockClick:()=>j==null?void 0:j(l,w),onFetchSource:async()=>await(T==null?void 0:T(l,w)),onDownloadClick:()=>S==null?void 0:S(l,w)}),l.text&&r.jsx("div",{className:"str-chat__message-bubble",children:r.jsx(B.MessageText,{message:me,renderText:p})})]}):Z?r.jsx(Jt,{message:l,standalone:!0}):r.jsx("div",{className:"str-chat__message-bubble-wrapper",children:r.jsxs("div",{className:"str-chat__message-bubble",children:[se&&!es&&r.jsx(Jt,{message:l,hasAttachment:Ne,isMyMessage:Fe}),Pe&&r.jsx(B.Poll,{poll:Pe}),X!=null&&X.length&&!l.quoted_message?r.jsx(W,{actionHandler:c,attachments:X}):null,re?r.jsx(N,{message:me,renderText:p}):r.jsx(B.MessageText,{message:me,renderText:p}),r.jsx(B.MessageErrorIcon,{})]})}),M&&r.jsx(M,{})]}),!_e&&!Z&&r.jsxs("div",{className:"str-chat__message-footer",children:[(!se||es)&&r.jsx(Jt,{message:l,hasAttachment:Ne,isMyMessage:Fe}),n&&se&&r.jsx(xr,{selected:I,onVoteUp:R,onVoteDown:U})]}),le&&r.jsx(E,{onClick:d,reply_count:l.reply_count}),K&&r.jsx($,{})]},l.id)]})},la=f.memo(ca,(e,t)=>e.chatbotVotingEnabled!==t.chatbotVotingEnabled||e.viewerLanguage!==t.viewerLanguage?!1:B.areMessageUIPropsEqual(e,t)),ua=e=>{const t=B.useMessageContext("CustomMessage");return r.jsx(la,{...t,...e})};function br(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=br(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function $e(){for(var e,t,n=0,s="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=br(e))&&(s&&(s+=" "),s+=t);return s}const da=f.createContext(void 0),In=e=>{const t=f.useContext(da);return t||(console.warn(`The useChannelStateContext hook was called outside of the ChannelStateContext provider. Make sure this hook is called within a child of the Channel component. The errored call is located in the ${e} component.`),{})},fa=f.createContext(void 0),He=e=>{const t=f.useContext(fa);return t||(console.warn(`The useChatContext hook was called outside of the ChatContext provider. Make sure this hook is called within a child of the Chat component. The errored call is located in the ${e} component.`),{})},ma=f.createContext({}),vr=e=>f.useContext(ma);function Ln(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bt={exports:{}},Qt={};/**
2
- * @license React
3
- * use-sync-external-store-shim.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var ws;function ha(){if(ws)return Qt;ws=1;var e=f;function t(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,o=e.useEffect,a=e.useLayoutEffect,i=e.useDebugValue;function c(m,g){var l=g(),p=s({inst:{value:l,getSnapshot:g}}),x=p[0].inst,b=p[1];return a(function(){x.value=l,x.getSnapshot=g,d(x)&&b({inst:x})},[m,l,g]),o(function(){return d(x)&&b({inst:x}),m(function(){d(x)&&b({inst:x})})},[m]),i(l),l}function d(m){var g=m.getSnapshot;m=m.value;try{var l=g();return!n(m,l)}catch{return!0}}function u(m,g){return g()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:c;return Qt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,Qt}var en={};/**
10
- * @license React
11
- * use-sync-external-store-shim.development.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var ys;function ga(){return ys||(ys=1,process.env.NODE_ENV!=="production"&&(function(){function e(l,p){return l===p&&(l!==0||1/l===1/p)||l!==l&&p!==p}function t(l,p){h||o.startTransition===void 0||(h=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var x=p();if(!m){var b=p();a(x,b)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),m=!0)}b=i({inst:{value:x,getSnapshot:p}});var v=b[0].inst,w=b[1];return d(function(){v.value=x,v.getSnapshot=p,n(v)&&w({inst:v})},[l,x,p]),c(function(){return n(v)&&w({inst:v}),l(function(){n(v)&&w({inst:v})})},[l]),u(x),x}function n(l){var p=l.getSnapshot;l=l.value;try{var x=p();return!a(l,x)}catch{return!0}}function s(l,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=f,a=typeof Object.is=="function"?Object.is:e,i=o.useState,c=o.useEffect,d=o.useLayoutEffect,u=o.useDebugValue,h=!1,m=!1,g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?s:t;en.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:g,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),en}var Es;function pa(){return Es||(Es=1,process.env.NODE_ENV==="production"?bt.exports=ha():bt.exports=ga()),bt.exports}var xa=pa();const ba=()=>{};function wr(e,t){const n=f.useCallback(a=>(e==null?void 0:e.subscribeWithSelector(t,a))??ba,[e,t]),s=f.useMemo(()=>{let a;return()=>{const i=e==null?void 0:e.getLatestValue();if(!i)return;if(a&&a[0]===i)return a[1];const c=t(i);if(a){let d=!0;for(const u in a[1])if(a[1][u]!==c[u]){d=!1;break}if(d)return a[1]}return a=[i,c],a[1]}},[e,t]);return xa.useSyncExternalStore(n,s)}const Dn=({dialogManagerId:e,id:t})=>{const{dialogManager:n}=On({dialogManagerId:e});return f.useEffect(()=>()=>{n.markForRemoval(t)},[n,t]),n.getOrCreate({id:t})},An=({id:e})=>{const{dialogManager:t}=ya()??{};return{dialog:Dn({dialogManagerId:t==null?void 0:t.id,id:e}),dialogManager:t}},Ke=(e,t)=>{const{dialogManager:n}=On({dialogManagerId:t}),s=f.useCallback(({dialogsById:o})=>{var a;return{isOpen:!!((a=o[e])!=null&&a.isOpen)}},[e]);return wr(n.state,s).isOpen},va=({children:e,getPortalDestination:t,isOpen:n})=>{const[s,o]=f.useState(null);return f.useLayoutEffect(()=>{const a=t();!a||!n||o(a)},[t,n]),s?_n.createPortal(e,s):null},wa=({children:e,dialogId:t,dialogManagerId:n})=>{const{dialogManager:s}=On({dialogId:t,dialogManagerId:n}),o=Ke(t,n),a=f.useCallback(()=>document.querySelector(`div[data-str-chat__portal-id="${s.id}"]`),[s.id]);return f.createElement(va,{getPortalDestination:a,isOpen:o},e)},Cs=new De.StateStore({}),yr=f.createContext(void 0),_s=({dialogId:e,dialogManagerId:t,newState:n,previousState:s})=>{var i,c;let o,a;return t?e?((i=n[t])!=null&&i.get(e)&&(o=n[t]),(c=s==null?void 0:s[t])!=null&&c.get(e)&&(a=s[t])):(o=n[t],a=s==null?void 0:s[t]):e&&(o=Object.values(n).find(d=>e&&(d==null?void 0:d.get(e))),a=s&&Object.values(s).find(d=>e&&(d==null?void 0:d.get(e)))),{managerInNewState:o,managerInPrevState:a}},On=({dialogId:e,dialogManagerId:t}={})=>{const n=f.useContext(yr),[s,o]=f.useState(()=>{const{managerInNewState:a}=_s({dialogId:e,dialogManagerId:t,newState:Cs.getLatestValue(),previousState:void 0});return a?{dialogManager:a}:n});return f.useEffect(()=>{if(!e&&!t)return;const a=Cs.subscribeWithSelector(i=>i,(i,c)=>{const{managerInNewState:d,managerInPrevState:u}=_s({dialogId:e,dialogManagerId:t,newState:i,previousState:c});(!u||(d==null?void 0:d.id)!==u.id)&&o(h=>(h==null?void 0:h.dialogManager.id)===(d==null?void 0:d.id)?h:{dialogManager:d||(n==null?void 0:n.dialogManager)})});return()=>{a()}},[e,t,n==null?void 0:n.dialogManager]),s!=null&&s.dialogManager||console.warn(`Dialog manager (manager id: ${t}, dialog id: ${e}) is not available`),s},ya=()=>f.useContext(yr),Ea=f.createContext(void 0),te=e=>{const t=f.useContext(Ea);return t||{}};var Ct={exports:{}},Ca=Ct.exports,Ns;function _a(){return Ns||(Ns=1,(function(e,t){(function(n,s){e.exports=s()})(Ca,(function(){var n=1e3,s=6e4,o=36e5,a="millisecond",i="second",c="minute",d="hour",u="day",h="week",m="month",g="quarter",l="year",p="date",x="Invalid Date",b=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,w={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(A){var M=["th","st","nd","rd"],_=A%100;return"["+A+(M[(_-20)%10]||M[_]||M[0])+"]"}},C=function(A,M,_){var k=String(A);return!k||k.length>=M?A:""+Array(M+1-k.length).join(_)+A},j={s:C,z:function(A){var M=-A.utcOffset(),_=Math.abs(M),k=Math.floor(_/60),y=_%60;return(M<=0?"+":"-")+C(k,2,"0")+":"+C(y,2,"0")},m:function A(M,_){if(M.date()<_.date())return-A(_,M);var k=12*(_.year()-M.year())+(_.month()-M.month()),y=M.clone().add(k,m),$=_-y<0,E=M.clone().add(k+($?-1:1),m);return+(-(k+(_-y)/($?y-E:E-y))||0)},a:function(A){return A<0?Math.ceil(A)||0:Math.floor(A)},p:function(A){return{M:m,y:l,w:h,d:u,D:p,h:d,m:c,s:i,ms:a,Q:g}[A]||String(A||"").toLowerCase().replace(/s$/,"")},u:function(A){return A===void 0}},T="en",S={};S[T]=w;var L="$isDayjsObject",F=function(A){return A instanceof U||!(!A||!A[L])},z=function A(M,_,k){var y;if(!M)return T;if(typeof M=="string"){var $=M.toLowerCase();S[$]&&(y=$),_&&(S[$]=_,y=$);var E=M.split("-");if(!y&&E.length>1)return A(E[0])}else{var D=M.name;S[D]=M,y=D}return!k&&y&&(T=y),y||!k&&T},I=function(A,M){if(F(A))return A.clone();var _=typeof M=="object"?M:{};return _.date=A,_.args=arguments,new U(_)},R=j;R.l=z,R.i=F,R.w=function(A,M){return I(A,{locale:M.$L,utc:M.$u,x:M.$x,$offset:M.$offset})};var U=(function(){function A(_){this.$L=z(_.locale,null,!0),this.parse(_),this.$x=this.$x||_.x||{},this[L]=!0}var M=A.prototype;return M.parse=function(_){this.$d=(function(k){var y=k.date,$=k.utc;if(y===null)return new Date(NaN);if(R.u(y))return new Date;if(y instanceof Date)return new Date(y);if(typeof y=="string"&&!/Z$/i.test(y)){var E=y.match(b);if(E){var D=E[2]-1||0,N=(E[7]||"0").substring(0,3);return $?new Date(Date.UTC(E[1],D,E[3]||1,E[4]||0,E[5]||0,E[6]||0,N)):new Date(E[1],D,E[3]||1,E[4]||0,E[5]||0,E[6]||0,N)}}return new Date(y)})(_),this.init()},M.init=function(){var _=this.$d;this.$y=_.getFullYear(),this.$M=_.getMonth(),this.$D=_.getDate(),this.$W=_.getDay(),this.$H=_.getHours(),this.$m=_.getMinutes(),this.$s=_.getSeconds(),this.$ms=_.getMilliseconds()},M.$utils=function(){return R},M.isValid=function(){return this.$d.toString()!==x},M.isSame=function(_,k){var y=I(_);return this.startOf(k)<=y&&y<=this.endOf(k)},M.isAfter=function(_,k){return I(_)<this.startOf(k)},M.isBefore=function(_,k){return this.endOf(k)<I(_)},M.$g=function(_,k,y){return R.u(_)?this[k]:this.set(y,_)},M.unix=function(){return Math.floor(this.valueOf()/1e3)},M.valueOf=function(){return this.$d.getTime()},M.startOf=function(_,k){var y=this,$=!!R.u(k)||k,E=R.p(_),D=function(le,K){var Q=R.w(y.$u?Date.UTC(y.$y,K,le):new Date(y.$y,K,le),y);return $?Q:Q.endOf(u)},N=function(le,K){return R.w(y.toDate()[le].apply(y.toDate("s"),($?[0,0,0,0]:[23,59,59,999]).slice(K)),y)},O=this.$W,H=this.$M,G=this.$D,re="set"+(this.$u?"UTC":"");switch(E){case l:return $?D(1,0):D(31,11);case m:return $?D(1,H):D(0,H+1);case h:var X=this.$locale().weekStart||0,me=(O<X?O+7:O)-X;return D($?G-me:G+(6-me),H);case u:case p:return N(re+"Hours",0);case d:return N(re+"Minutes",1);case c:return N(re+"Seconds",2);case i:return N(re+"Milliseconds",3);default:return this.clone()}},M.endOf=function(_){return this.startOf(_,!1)},M.$set=function(_,k){var y,$=R.p(_),E="set"+(this.$u?"UTC":""),D=(y={},y[u]=E+"Date",y[p]=E+"Date",y[m]=E+"Month",y[l]=E+"FullYear",y[d]=E+"Hours",y[c]=E+"Minutes",y[i]=E+"Seconds",y[a]=E+"Milliseconds",y)[$],N=$===u?this.$D+(k-this.$W):k;if($===m||$===l){var O=this.clone().set(p,1);O.$d[D](N),O.init(),this.$d=O.set(p,Math.min(this.$D,O.daysInMonth())).$d}else D&&this.$d[D](N);return this.init(),this},M.set=function(_,k){return this.clone().$set(_,k)},M.get=function(_){return this[R.p(_)]()},M.add=function(_,k){var y,$=this;_=Number(_);var E=R.p(k),D=function(H){var G=I($);return R.w(G.date(G.date()+Math.round(H*_)),$)};if(E===m)return this.set(m,this.$M+_);if(E===l)return this.set(l,this.$y+_);if(E===u)return D(1);if(E===h)return D(7);var N=(y={},y[c]=s,y[d]=o,y[i]=n,y)[E]||1,O=this.$d.getTime()+_*N;return R.w(O,this)},M.subtract=function(_,k){return this.add(-1*_,k)},M.format=function(_){var k=this,y=this.$locale();if(!this.isValid())return y.invalidDate||x;var $=_||"YYYY-MM-DDTHH:mm:ssZ",E=R.z(this),D=this.$H,N=this.$m,O=this.$M,H=y.weekdays,G=y.months,re=y.meridiem,X=function(K,Q,xe,ae){return K&&(K[Q]||K(k,$))||xe[Q].slice(0,ae)},me=function(K){return R.s(D%12||12,K,"0")},le=re||function(K,Q,xe){var ae=K<12?"AM":"PM";return xe?ae.toLowerCase():ae};return $.replace(v,(function(K,Q){return Q||(function(xe){switch(xe){case"YY":return String(k.$y).slice(-2);case"YYYY":return R.s(k.$y,4,"0");case"M":return O+1;case"MM":return R.s(O+1,2,"0");case"MMM":return X(y.monthsShort,O,G,3);case"MMMM":return X(G,O);case"D":return k.$D;case"DD":return R.s(k.$D,2,"0");case"d":return String(k.$W);case"dd":return X(y.weekdaysMin,k.$W,H,2);case"ddd":return X(y.weekdaysShort,k.$W,H,3);case"dddd":return H[k.$W];case"H":return String(D);case"HH":return R.s(D,2,"0");case"h":return me(1);case"hh":return me(2);case"a":return le(D,N,!0);case"A":return le(D,N,!1);case"m":return String(N);case"mm":return R.s(N,2,"0");case"s":return String(k.$s);case"ss":return R.s(k.$s,2,"0");case"SSS":return R.s(k.$ms,3,"0");case"Z":return E}return null})(K)||E.replace(":","")}))},M.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},M.diff=function(_,k,y){var $,E=this,D=R.p(k),N=I(_),O=(N.utcOffset()-this.utcOffset())*s,H=this-N,G=function(){return R.m(E,N)};switch(D){case l:$=G()/12;break;case m:$=G();break;case g:$=G()/3;break;case h:$=(H-O)/6048e5;break;case u:$=(H-O)/864e5;break;case d:$=H/o;break;case c:$=H/s;break;case i:$=H/n;break;default:$=H}return y?$:R.a($)},M.daysInMonth=function(){return this.endOf(m).$D},M.$locale=function(){return S[this.$L]},M.locale=function(_,k){if(!_)return this.$L;var y=this.clone(),$=z(_,k,!0);return $&&(y.$L=$),y},M.clone=function(){return R.w(this.$d,this)},M.toDate=function(){return new Date(this.valueOf())},M.toJSON=function(){return this.isValid()?this.toISOString():null},M.toISOString=function(){return this.$d.toISOString()},M.toString=function(){return this.$d.toUTCString()},A})(),W=U.prototype;return I.prototype=W,[["$ms",a],["$s",i],["$m",c],["$H",d],["$W",u],["$M",m],["$y",l],["$D",p]].forEach((function(A){W[A[1]]=function(M){return this.$g(M,A[0],A[1])}})),I.extend=function(A,M){return A.$i||(A(M,U,I),A.$i=!0),I},I.locale=z,I.isDayjs=F,I.unix=function(A){return I(1e3*A)},I.en=S[T],I.Ls=S,I.p={},I}))})(Ct)),Ct.exports}var Na=_a();const Fn=Ln(Na);var _t={exports:{}},ja=_t.exports,js;function Sa(){return js||(js=1,(function(e,t){(function(n,s){e.exports=s()})(ja,(function(){return function(n,s,o){var a="h:mm A",i={lastDay:"[Yesterday at] "+a,sameDay:"[Today at] "+a,nextDay:"[Tomorrow at] "+a,nextWeek:"dddd [at] "+a,lastWeek:"[Last] dddd [at] "+a,sameElse:"MM/DD/YYYY"};s.prototype.calendar=function(c,d){var u=d||this.$locale().calendar||i,h=o(c||void 0).startOf("d"),m=this.diff(h,"d",!0),g="sameElse",l=m<-6?g:m<-1?"lastWeek":m<0?"lastDay":m<1?"sameDay":m<2?"nextDay":m<7?"nextWeek":g,p=u[l]||i[l];return typeof p=="function"?p.call(this,o()):this.format(p)}}}))})(_t)),_t.exports}var ka=Sa();const $a=Ln(ka);var Nt={exports:{}},Ma=Nt.exports,Ss;function Ra(){return Ss||(Ss=1,(function(e,t){(function(n,s){e.exports=s()})(Ma,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(s,o,a){var i=o.prototype,c=i.format;a.en.formats=n,i.format=function(d){d===void 0&&(d="YYYY-MM-DDTHH:mm:ssZ");var u=this.$locale().formats,h=(function(m,g){return m.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(l,p,x){var b=x&&x.toUpperCase();return p||g[x]||n[x]||g[b].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(v,w,C){return w||C.slice(1)}))}))})(d,u===void 0?{}:u);return c.call(this,h)}}}))})(Nt)),Nt.exports}var Ta=Ra();const Ia=Ln(Ta),La=(e=>e),Da=e=>Fn(e);Fn.extend($a);Fn.extend(Ia);const Aa=f.createContext({t:La,tDateTimeParser:Da,userLanguage:"en"}),oe=e=>{const t=f.useContext(Aa);return t||(console.warn(`The useTranslationContext hook was called outside of the TranslationContext provider. Make sure this hook is called within a child of the Chat component. The errored call is located in the ${e} component.`),{})},Oa=f.createContext(void 0),Fa=()=>f.useContext(Oa),Pa={User:e=>f.createElement("svg",{className:"str-chat__icon str-chat__icon--user",fill:"none",height:"16",viewBox:"0 0 16 16",width:"16",xmlns:"http://www.w3.org/2000/svg",...e},f.createElement("path",{d:"M8 2C9.1 2 10 2.9 10 4C10 5.1 9.1 6 8 6C6.9 6 6 5.1 6 4C6 2.9 6.9 2 8 2ZM8 12C10.7 12 13.8 13.29 14 14H2C2.23 13.28 5.31 12 8 12ZM8 0C5.79 0 4 1.79 4 4C4 6.21 5.79 8 8 8C10.21 8 12 6.21 12 4C12 1.79 10.21 0 8 0ZM8 10C5.33 10 0 11.34 0 14V16H16V14C16 11.34 10.67 10 8 10Z",fill:"currentColor"}))},za=(e,t)=>{const n=e.charCodeAt(t);if(Number.isNaN(n))return"";if(n<55296||n>57343)return e.charAt(t);if(55296<=n&&n<=56319){if(e.length<=t+1)throw"High surrogate without following low surrogate";const s=e.charCodeAt(t+1);if(56320>s||s>57343)throw"High surrogate without following low surrogate";return e.charAt(t)+e.charAt(t+1)}throw"Low surrogate without preceding high surrogate"},Ba=e=>{const{className:t,image:n,name:s,onClick:o=()=>{},onMouseOver:a=()=>{}}=e,[i,c]=f.useState(!1);f.useEffect(()=>{c(!1)},[n]);const d=(s==null?void 0:s.toString())||"",u=za(d,0),h=n&&!i;return f.createElement("div",{className:$e("str-chat__avatar str-chat__message-sender-avatar",t,{"str-chat__avatar--multiple-letters":u.length>1,"str-chat__avatar--no-letters":!u.length,"str-chat__avatar--one-letter":u.length===1}),"data-testid":"avatar",onClick:o,onMouseOver:a,role:"button",title:s},h?f.createElement("img",{alt:u,className:"str-chat__avatar-image","data-testid":"avatar-img",onError:()=>c(!0),src:n}):f.createElement(f.Fragment,null,!!u.length&&f.createElement("div",{className:$e("str-chat__avatar-fallback"),"data-testid":"avatar-fallback"},u),!u.length&&f.createElement(Pa.User,null)))},Va=(e,t)=>!t||!e?!1:!!t.filter(s=>{var o;return s.target.id===((o=e.user)==null?void 0:o.id)}).length,tn={markUnread:"markUnread",pin:"pin",reply:"reply"},Ua=[tn.pin,tn.reply,tn.markUnread],Ha=(e,t,n)=>{var w,C,j;const{channel:s,channelCapabilities:o={}}=In("useUserRole"),{client:a}=He("useUserRole"),i=((w=a.user)==null?void 0:w.role)==="admin"||s.state.membership.role==="admin",c=s.state.membership.role==="owner",d=((C=a.user)==null?void 0:C.role)==="channel_moderator"||s.state.membership.role==="channel_moderator"||s.state.membership.role==="moderator"||s.state.membership.is_moderator===!0||s.state.membership.channel_role==="channel_moderator",u=a.userID===((j=e.user)==null?void 0:j.id),h=!e.poll&&(o["update-any-message"]||u&&o["update-own-message"]),m=o["delete-any-message"]||u&&o["delete-own-message"],g=!u&&o["flag-message"],l=o["read-events"],p=!u&&o["mute-channel"],x=o["quote-message"],b=o["send-reaction"],v=o["send-reply"];return{canDelete:m,canEdit:h,canFlag:g,canMarkUnread:l,canMute:p,canQuote:x,canReact:b,canReply:v,isAdmin:i,isModerator:d,isMyMessage:u,isOwner:c}},Wa=e=>{const{client:t}=He(),n=f.useCallback(o=>({reminder:o.reminders.get(e)}),[e]),{reminder:s}=wr(t.reminders.state,n);return s},ee=e=>(e==null?void 0:e.ownerDocument)??document,Je=e=>e&&"window"in e&&e.window===e?e:ee(e).defaultView||window;function Ya(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function Ga(e){return Ya(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let qa=!1;function Ut(){return qa}function $t(e,t){if(!Ut())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:Ga(n)?n=n.host:n=n.parentNode}return!1}const ge=(e=document)=>{var n;if(!Ut())return e.activeElement;let t=e.activeElement;for(;t&&"shadowRoot"in t&&((n=t.shadowRoot)!=null&&n.activeElement);)t=t.shadowRoot.activeElement;return t};function de(e){if(Ut()&&e.target instanceof Element&&e.target.shadowRoot){if("composedPath"in e)return e.composedPath()[0]??null;if("composedPath"in e.nativeEvent)return e.nativeEvent.composedPath()[0]??null}return e.target}class Ka{constructor(t,n,s,o){this._walkerStack=[],this._currentSetFor=new Set,this._acceptNode=i=>{var c;if(i.nodeType===Node.ELEMENT_NODE){const d=i.shadowRoot;if(d){const u=this._doc.createTreeWalker(d,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(u),NodeFilter.FILTER_ACCEPT}else{if(typeof this.filter=="function")return this.filter(i);if((c=this.filter)!=null&&c.acceptNode)return this.filter.acceptNode(i);if(this.filter===null)return NodeFilter.FILTER_ACCEPT}}return NodeFilter.FILTER_SKIP},this._doc=t,this.root=n,this.filter=o??null,this.whatToShow=s??NodeFilter.SHOW_ALL,this._currentNode=n,this._walkerStack.unshift(t.createTreeWalker(n,s,this._acceptNode));const a=n.shadowRoot;if(a){const i=this._doc.createTreeWalker(a,this.whatToShow,{acceptNode:this._acceptNode});this._walkerStack.unshift(i)}}get currentNode(){return this._currentNode}set currentNode(t){if(!$t(this.root,t))throw new Error("Cannot set currentNode to a node that is not contained by the root node.");const n=[];let s=t,o=t;for(this._currentNode=t;s&&s!==this.root;)if(s.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const i=s,c=this._doc.createTreeWalker(i,this.whatToShow,{acceptNode:this._acceptNode});n.push(c),c.currentNode=o,this._currentSetFor.add(c),s=o=i.host}else s=s.parentNode;const a=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});n.push(a),a.currentNode=o,this._currentSetFor.add(a),this._walkerStack=n}get doc(){return this._doc}firstChild(){let t=this.currentNode,n=this.nextNode();return $t(t,n)?(n&&(this.currentNode=n),n):(this.currentNode=t,null)}lastChild(){let n=this._walkerStack[0].lastChild();return n&&(this.currentNode=n),n}nextNode(){var n;const t=this._walkerStack[0].nextNode();if(t){if(t.shadowRoot){let o;if(typeof this.filter=="function"?o=this.filter(t):(n=this.filter)!=null&&n.acceptNode&&(o=this.filter.acceptNode(t)),o===NodeFilter.FILTER_ACCEPT)return this.currentNode=t,t;let a=this.nextNode();return a&&(this.currentNode=a),a}return t&&(this.currentNode=t),t}else if(this._walkerStack.length>1){this._walkerStack.shift();let s=this.nextNode();return s&&(this.currentNode=s),s}else return null}previousNode(){var s;const t=this._walkerStack[0];if(t.currentNode===t.root){if(this._currentSetFor.has(t))if(this._currentSetFor.delete(t),this._walkerStack.length>1){this._walkerStack.shift();let o=this.previousNode();return o&&(this.currentNode=o),o}else return null;return null}const n=t.previousNode();if(n){if(n.shadowRoot){let a;if(typeof this.filter=="function"?a=this.filter(n):(s=this.filter)!=null&&s.acceptNode&&(a=this.filter.acceptNode(n)),a===NodeFilter.FILTER_ACCEPT)return n&&(this.currentNode=n),n;let i=this.lastChild();return i&&(this.currentNode=i),i}return n&&(this.currentNode=n),n}else if(this._walkerStack.length>1){this._walkerStack.shift();let o=this.previousNode();return o&&(this.currentNode=o),o}else return null}nextSibling(){return null}previousSibling(){return null}parentNode(){return null}}function Xa(e,t,n,s){return Ut()?new Ka(e,t,n,s):e.createTreeWalker(t,n,s)}function hn(e){if(Za())e.focus({preventScroll:!0});else{let t=Ja(e);e.focus(),Qa(t)}}let vt=null;function Za(){if(vt==null){vt=!1;try{document.createElement("div").focus({get preventScroll(){return vt=!0,!0}})}catch{}}return vt}function Ja(e){let t=e.parentNode,n=[],s=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==s;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return s instanceof HTMLElement&&n.push({element:s,scrollTop:s.scrollTop,scrollLeft:s.scrollLeft}),n}function Qa(e){for(let{element:t,scrollTop:n,scrollLeft:s}of e)t.scrollTop=n,t.scrollLeft=s}const ei=typeof Element<"u"&&"checkVisibility"in Element.prototype;function ti(e){const t=Je(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:n,visibility:s}=e.style,o=n!=="none"&&s!=="hidden"&&s!=="collapse";if(o){const{getComputedStyle:a}=e.ownerDocument.defaultView;let{display:i,visibility:c}=a(e);o=i!=="none"&&c!=="hidden"&&c!=="collapse"}return o}function ni(e,t){return!e.hasAttribute("hidden")&&!e.hasAttribute("data-react-aria-prevent-focus")&&(e.nodeName==="DETAILS"&&t&&t.nodeName!=="SUMMARY"?e.hasAttribute("open"):!0)}function Pn(e,t){return ei?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&ti(e)&&ni(e,t)&&(!e.parentElement||Pn(e.parentElement,e))}const zn=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable^="false"])',"permission"],si=zn.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";zn.push('[tabindex]:not([tabindex="-1"]):not([disabled])');const ri=zn.join(':not([hidden]):not([tabindex="-1"]),');function oi(e,t){return e.matches(si)&&!Er(e)&&((t==null?void 0:t.skipVisibilityCheck)||Pn(e))}function ai(e){return e.matches(ri)&&Pn(e)&&!Er(e)}function Er(e){let t=e;for(;t!=null;){if(t instanceof t.ownerDocument.defaultView.HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}const ve=typeof document<"u"?f.useLayoutEffect:()=>{};let ii=!1;function Ht(e){var n;if(typeof window>"u"||window.navigator==null)return!1;let t=(n=window.navigator.userAgentData)==null?void 0:n.brands;return Array.isArray(t)&&t.some(s=>e.test(s.brand))||e.test(window.navigator.userAgent)}function Bn(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)==null?void 0:t.platform)||window.navigator.platform):!1}function Te(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const ct=Te(function(){return Bn(/^Mac/i)}),ci=Te(function(){return Bn(/^iPhone/i)}),Cr=Te(function(){return Bn(/^iPad/i)||ct()&&navigator.maxTouchPoints>1}),li=Te(function(){return ci()||Cr()});Te(function(){return ct()||li()});const ui=Te(function(){return Ht(/AppleWebKit/i)&&!_r()}),_r=Te(function(){return Ht(/Chrome/i)}),Nr=Te(function(){return Ht(/Android/i)}),di=Te(function(){return Ht(/Firefox/i)});function fi(e){return e.pointerType===""&&e.isTrusted?!0:Nr()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function lt(e,t,n=!0){var d,u;let{metaKey:s,ctrlKey:o,altKey:a,shiftKey:i}=t;di()&&((u=(d=window.event)==null?void 0:d.type)!=null&&u.startsWith("key"))&&e.target==="_blank"&&(ct()?s=!0:o=!0);let c=ui()&&ct()&&!Cr()&&process.env.NODE_ENV!=="test"?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:s,ctrlKey:o,altKey:a,shiftKey:i}):new MouseEvent("click",{metaKey:s,ctrlKey:o,altKey:a,shiftKey:i,detail:1,bubbles:!0,cancelable:!0});lt.isOpening=n,hn(e),e.dispatchEvent(c),lt.isOpening=!1}lt.isOpening=!1;let dt=null;const mi=new Set;let at=new Map,We=!1,gn=!1;function Vn(e,t){for(let n of mi)n(e,t)}function hi(e){return!(e.metaKey||!ct()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Mt(e){We=!0,!lt.isOpening&&hi(e)&&(dt="keyboard",Vn("keyboard",e))}function ue(e){dt="pointer","pointerType"in e&&e.pointerType,(e.type==="mousedown"||e.type==="pointerdown")&&(We=!0,Vn("pointer",e))}function jr(e){!lt.isOpening&&fi(e)&&(We=!0,dt="virtual")}function Sr(e){let t=Je(de(e)),n=ee(de(e));de(e)===t||de(e)===n||ii||!e.isTrusted||(!We&&!gn&&(dt="virtual",Vn("virtual",e)),We=!1,gn=!1)}function kr(){We=!1,gn=!0}function ks(e){if(typeof window>"u"||typeof document>"u")return;const t=Je(e),n=ee(e);if(at.get(t))return;let s=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){We=!0,s.apply(this,arguments)},n.addEventListener("keydown",Mt,!0),n.addEventListener("keyup",Mt,!0),n.addEventListener("click",jr,!0),t.addEventListener("focus",Sr,!0),t.addEventListener("blur",kr,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",ue,!0),n.addEventListener("pointermove",ue,!0),n.addEventListener("pointerup",ue,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",ue,!0),n.addEventListener("mousemove",ue,!0),n.addEventListener("mouseup",ue,!0)),t.addEventListener("beforeunload",()=>{$r(e)},{once:!0}),at.set(t,{focus:s})}const $r=(e,t)=>{const n=Je(e),s=ee(e);t&&s.removeEventListener("DOMContentLoaded",t),at.has(n)&&(n.HTMLElement.prototype.focus=at.get(n).focus,s.removeEventListener("keydown",Mt,!0),s.removeEventListener("keyup",Mt,!0),s.removeEventListener("click",jr,!0),n.removeEventListener("focus",Sr,!0),n.removeEventListener("blur",kr,!1),typeof PointerEvent<"u"?(s.removeEventListener("pointerdown",ue,!0),s.removeEventListener("pointermove",ue,!0),s.removeEventListener("pointerup",ue,!0)):process.env.NODE_ENV==="test"&&(s.removeEventListener("mousedown",ue,!0),s.removeEventListener("mousemove",ue,!0),s.removeEventListener("mouseup",ue,!0)),at.delete(n))};function gi(e){const t=ee(e);let n;return t.readyState!=="loading"?ks(e):(n=()=>{ks(e)},t.addEventListener("DOMContentLoaded",n)),()=>$r(e,n)}typeof document<"u"&&gi();function Mr(){return dt}let Le=new Map,pn=new Set;function $s(){if(typeof window>"u")return;function e(s){return"propertyName"in s}let t=s=>{let o=de(s);if(!e(s)||!o)return;let a=Le.get(o);a||(a=new Set,Le.set(o,a),o.addEventListener("transitioncancel",n,{once:!0})),a.add(s.propertyName)},n=s=>{let o=de(s);if(!e(s)||!o)return;let a=Le.get(o);if(a&&(a.delete(s.propertyName),a.size===0&&(o.removeEventListener("transitioncancel",n),Le.delete(o)),Le.size===0)){for(let i of pn)i();pn.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",n)}typeof document<"u"&&(document.readyState!=="loading"?$s():document.addEventListener("DOMContentLoaded",$s));function pi(){for(const[e]of Le)"isConnected"in e&&!e.isConnected&&Le.delete(e)}function xi(e){requestAnimationFrame(()=>{pi(),Le.size===0?e():pn.add(e)})}function bi(e){if(!e.isConnected)return;const t=ee(e);if(Mr()==="virtual"){let n=ge(t);xi(()=>{const s=ge(t);(s===n||s===t.body)&&e.isConnected&&hn(e)})}else hn(e)}const Ms=f.createContext(null),xn="react-aria-focus-scope-restore";let q=null;function vi(e){let{children:t,contain:n,restoreFocus:s,autoFocus:o}=e,a=f.useRef(null),i=f.useRef(null),c=f.useRef([]),{parentNode:d}=f.useContext(Ms)||{},u=f.useMemo(()=>new vn({scopeRef:c}),[c]);ve(()=>{let g=d||J.root;if(J.getTreeNode(g.scopeRef)&&q&&!Rt(q,g.scopeRef)){let l=J.getTreeNode(q);l&&(g=l)}g.addChild(u),J.addNode(u)},[u,d]),ve(()=>{let g=J.getTreeNode(c);g&&(g.contain=!!n)},[n]),ve(()=>{var x;let g=(x=a.current)==null?void 0:x.nextSibling,l=[],p=b=>b.stopPropagation();for(;g&&g!==i.current;)l.push(g),g.addEventListener(xn,p),g=g.nextSibling;return c.current=l,()=>{for(let b of l)b.removeEventListener(xn,p)}},[t]),Ni(c,s,n),Ci(c,n),ji(c,s,n),_i(c,o),f.useEffect(()=>{const g=ge(ee(c.current?c.current[0]:void 0));let l=null;if(fe(g,c.current)){for(let p of J.traverse())p.scopeRef&&fe(g,p.scopeRef.current)&&(l=p);l===J.getTreeNode(c)&&(q=l.scopeRef)}},[c]),ve(()=>()=>{var l,p;let g=((p=(l=J.getTreeNode(c))==null?void 0:l.parent)==null?void 0:p.scopeRef)??null;(c===q||Rt(c,q))&&(!g||J.getTreeNode(g))&&(q=g),J.removeTreeNode(c)},[c]);let h=f.useMemo(()=>wi(c),[]),m=f.useMemo(()=>({focusManager:h,parentNode:u}),[u,h]);return f.createElement(Ms.Provider,{value:m},f.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:a}),t,f.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:i}))}function wi(e){return{focusNext(t={}){let n=e.current,{from:s,tabbable:o,wrap:a,accept:i}=t,c=s||ge(ee(n[0]??void 0)),d=n[0].previousElementSibling,u=Be(n),h=Ae(u,{tabbable:o,accept:i},n);h.currentNode=fe(c,n)?c:d;let m=h.nextNode();return!m&&a&&(h.currentNode=d,m=h.nextNode()),m&&je(m,!0),m},focusPrevious(t={}){let n=e.current,{from:s,tabbable:o,wrap:a,accept:i}=t,c=s||ge(ee(n[0]??void 0)),d=n[n.length-1].nextElementSibling,u=Be(n),h=Ae(u,{tabbable:o,accept:i},n);h.currentNode=fe(c,n)?c:d;let m=h.previousNode();return!m&&a&&(h.currentNode=d,m=h.previousNode()),m&&je(m,!0),m},focusFirst(t={}){let n=e.current,{tabbable:s,accept:o}=t,a=Be(n),i=Ae(a,{tabbable:s,accept:o},n);i.currentNode=n[0].previousElementSibling;let c=i.nextNode();return c&&je(c,!0),c},focusLast(t={}){let n=e.current,{tabbable:s,accept:o}=t,a=Be(n),i=Ae(a,{tabbable:s,accept:o},n);i.currentNode=n[n.length-1].nextElementSibling;let c=i.previousNode();return c&&je(c,!0),c}}}function Be(e){return e[0].parentElement}function ot(e){let t=J.getTreeNode(q);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function yi(e){if(!e.form)return Array.from(ee(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(s=>!s.form);const t=e.form.elements.namedItem(e.name);let n=Je(e);return t instanceof n.RadioNodeList?Array.from(t).filter(s=>s instanceof n.HTMLInputElement):t instanceof n.HTMLInputElement?[t]:[]}function Ei(e){if(e.checked)return!0;const t=yi(e);return t.length>0&&!t.some(n=>n.checked)}function Ci(e,t){let n=f.useRef(void 0),s=f.useRef(void 0);ve(()=>{let o=e.current;if(!t){s.current&&(cancelAnimationFrame(s.current),s.current=void 0);return}const a=ee(o?o[0]:void 0);let i=u=>{if(u.key!=="Tab"||u.altKey||u.ctrlKey||u.metaKey||!ot(e)||u.isComposing)return;let h=ge(a),m=e.current;if(!m||!fe(h,m))return;let g=Be(m),l=Ae(g,{tabbable:!0},m);if(!h)return;l.currentNode=h;let p=u.shiftKey?l.previousNode():l.nextNode();p||(l.currentNode=u.shiftKey?m[m.length-1].nextElementSibling:m[0].previousElementSibling,p=u.shiftKey?l.previousNode():l.nextNode()),u.preventDefault(),p&&(je(p,!0),p instanceof Je(p).HTMLInputElement&&p.select())},c=u=>{(!q||Rt(q,e))&&fe(de(u),e.current)?(q=e,n.current=de(u)):ot(e)&&!Ve(de(u),e)?n.current?n.current.focus():q&&q.current&&bn(q.current):ot(e)&&(n.current=de(u))},d=u=>{s.current&&cancelAnimationFrame(s.current),s.current=requestAnimationFrame(()=>{var l;let h=Mr(),m=(h==="virtual"||h===null)&&Nr()&&_r(),g=ge(a);if(!m&&g&&ot(e)&&!Ve(g,e)){q=e;let p=de(u);p&&p.isConnected?(n.current=p,(l=n.current)==null||l.focus()):q.current&&bn(q.current)}})};return a.addEventListener("keydown",i,!1),a.addEventListener("focusin",c,!1),o==null||o.forEach(u=>u.addEventListener("focusin",c,!1)),o==null||o.forEach(u=>u.addEventListener("focusout",d,!1)),()=>{a.removeEventListener("keydown",i,!1),a.removeEventListener("focusin",c,!1),o==null||o.forEach(u=>u.removeEventListener("focusin",c,!1)),o==null||o.forEach(u=>u.removeEventListener("focusout",d,!1))}},[e,t]),ve(()=>()=>{s.current&&cancelAnimationFrame(s.current)},[s])}function Rr(e){return Ve(e)}function fe(e,t){return!e||!t?!1:t.some(n=>$t(n,e))}function Ve(e,t=null){if(e instanceof Element&&e.closest("[data-react-aria-top-layer]"))return!0;for(let{scopeRef:n}of J.traverse(J.getTreeNode(t)))if(n&&fe(e,n.current))return!0;return!1}function Rt(e,t){var s;let n=(s=J.getTreeNode(t))==null?void 0:s.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function je(e,t=!1){if(e!=null&&!t)try{bi(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function Tr(e,t=!0){let n=e[0].previousElementSibling,s=Be(e),o=Ae(s,{tabbable:t},e);o.currentNode=n;let a=o.nextNode();return t&&!a&&(s=Be(e),o=Ae(s,{tabbable:!1},e),o.currentNode=n,a=o.nextNode()),a}function bn(e,t=!0){je(Tr(e,t))}function _i(e,t){const n=f.useRef(t);f.useEffect(()=>{if(n.current){q=e;const s=ee(e.current?e.current[0]:void 0);!fe(ge(s),q.current)&&e.current&&bn(e.current)}n.current=!1},[e])}function Ni(e,t,n){ve(()=>{if(t||n)return;let s=e.current;const o=ee(s?s[0]:void 0);let a=i=>{let c=de(i);fe(c,e.current)?q=e:Rr(c)||(q=null)};return o.addEventListener("focusin",a,!1),s==null||s.forEach(i=>i.addEventListener("focusin",a,!1)),()=>{o.removeEventListener("focusin",a,!1),s==null||s.forEach(i=>i.removeEventListener("focusin",a,!1))}},[e,t,n])}function Rs(e){let t=J.getTreeNode(q);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return(t==null?void 0:t.scopeRef)===e}function ji(e,t,n){const s=f.useRef(typeof document<"u"?ge(ee(e.current?e.current[0]:void 0)):null);ve(()=>{let o=e.current;const a=ee(o?o[0]:void 0);if(!t||n)return;let i=()=>{(!q||Rt(q,e))&&fe(ge(a),e.current)&&(q=e)};return a.addEventListener("focusin",i,!1),o==null||o.forEach(c=>c.addEventListener("focusin",i,!1)),()=>{a.removeEventListener("focusin",i,!1),o==null||o.forEach(c=>c.removeEventListener("focusin",i,!1))}},[e,n]),ve(()=>{const o=ee(e.current?e.current[0]:void 0);if(!t)return;let a=i=>{if(i.key!=="Tab"||i.altKey||i.ctrlKey||i.metaKey||!ot(e)||i.isComposing)return;let c=o.activeElement;if(!Ve(c,e)||!Rs(e))return;let d=J.getTreeNode(e);if(!d)return;let u=d.nodeToRestore,h=Ae(o.body,{tabbable:!0});h.currentNode=c;let m=i.shiftKey?h.previousNode():h.nextNode();if((!u||!u.isConnected||u===o.body)&&(u=void 0,d.nodeToRestore=void 0),(!m||!Ve(m,e))&&u){h.currentNode=u;do m=i.shiftKey?h.previousNode():h.nextNode();while(Ve(m,e));i.preventDefault(),i.stopPropagation(),m?je(m,!0):Rr(u)?je(u,!0):c.blur()}};return n||o.addEventListener("keydown",a,!0),()=>{n||o.removeEventListener("keydown",a,!0)}},[e,t,n]),ve(()=>{const o=ee(e.current?e.current[0]:void 0);if(!t)return;let a=J.getTreeNode(e);if(a)return a.nodeToRestore=s.current??void 0,()=>{let i=J.getTreeNode(e);if(!i)return;let c=i.nodeToRestore,d=ge(o);if(t&&c&&(d&&Ve(d,e)||d===o.body&&Rs(e))){let u=J.clone();requestAnimationFrame(()=>{if(o.activeElement===o.body){let h=u.getTreeNode(e);for(;h;){if(h.nodeToRestore&&h.nodeToRestore.isConnected){Ts(h.nodeToRestore);return}h=h.parent}for(h=u.getTreeNode(e);h;){if(h.scopeRef&&h.scopeRef.current&&J.getTreeNode(h.scopeRef)){let m=Tr(h.scopeRef.current,!0);Ts(m);return}h=h.parent}}})}}},[e,t])}function Ts(e){e.dispatchEvent(new CustomEvent(xn,{bubbles:!0,cancelable:!0}))&&je(e)}function Ae(e,t,n){let s=t!=null&&t.tabbable?ai:oi,o=(e==null?void 0:e.nodeType)===Node.ELEMENT_NODE?e:null,a=ee(o),i=Xa(a,e||a,NodeFilter.SHOW_ELEMENT,{acceptNode(c){return $t(t==null?void 0:t.from,c)||t!=null&&t.tabbable&&c.tagName==="INPUT"&&c.getAttribute("type")==="radio"&&(!Ei(c)||i.currentNode.tagName==="INPUT"&&i.currentNode.type==="radio"&&i.currentNode.name===c.name)?NodeFilter.FILTER_REJECT:s(c)&&(!n||fe(c,n))&&(!(t!=null&&t.accept)||t.accept(c))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t!=null&&t.from&&(i.currentNode=t.from),i}class Un{constructor(){this.fastMap=new Map,this.root=new vn({scopeRef:null}),this.fastMap.set(null,this.root)}get size(){return this.fastMap.size}getTreeNode(t){return this.fastMap.get(t)}addTreeNode(t,n,s){let o=this.fastMap.get(n??null);if(!o)return;let a=new vn({scopeRef:t});o.addChild(a),a.parent=o,this.fastMap.set(t,a),s&&(a.nodeToRestore=s)}addNode(t){this.fastMap.set(t.scopeRef,t)}removeTreeNode(t){if(t===null)return;let n=this.fastMap.get(t);if(!n)return;let s=n.parent;for(let a of this.traverse())a!==n&&n.nodeToRestore&&a.nodeToRestore&&n.scopeRef&&n.scopeRef.current&&fe(a.nodeToRestore,n.scopeRef.current)&&(a.nodeToRestore=n.nodeToRestore);let o=n.children;s&&(s.removeChild(n),o.size>0&&o.forEach(a=>s&&s.addChild(a))),this.fastMap.delete(n.scopeRef)}*traverse(t=this.root){if(t.scopeRef!=null&&(yield t),t.children.size>0)for(let n of t.children)yield*this.traverse(n)}clone(){var n;let t=new Un;for(let s of this.traverse())t.addTreeNode(s.scopeRef,((n=s.parent)==null?void 0:n.scopeRef)??null,s.nodeToRestore);return t}}class vn{constructor(t){this.children=new Set,this.contain=!1,this.scopeRef=t.scopeRef}addChild(t){this.children.add(t),t.parent=this}removeChild(t){this.children.delete(t),t.parent=void 0}}let J=new Un;function Wt(){return typeof window<"u"}function Qe(e){return Ir(e)?(e.nodeName||"").toLowerCase():"#document"}function ce(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ce(e){var t;return(t=(Ir(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ir(e){return Wt()?e instanceof Node||e instanceof ce(e).Node:!1}function ne(e){return Wt()?e instanceof Element||e instanceof ce(e).Element:!1}function Ie(e){return Wt()?e instanceof HTMLElement||e instanceof ce(e).HTMLElement:!1}function Is(e){return!Wt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ce(e).ShadowRoot}function ft(e){const{overflow:t,overflowX:n,overflowY:s,display:o}=pe(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&o!=="inline"&&o!=="contents"}function Si(e){return/^(table|td|th)$/.test(Qe(e))}function Yt(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const ki=/transform|translate|scale|rotate|perspective|filter/,$i=/paint|layout|strict|content/,ze=e=>!!e&&e!=="none";let nn;function Hn(e){const t=ne(e)?pe(e):e;return ze(t.transform)||ze(t.translate)||ze(t.scale)||ze(t.rotate)||ze(t.perspective)||!Wn()&&(ze(t.backdropFilter)||ze(t.filter))||ki.test(t.willChange||"")||$i.test(t.contain||"")}function Mi(e){let t=Oe(e);for(;Ie(t)&&!Xe(t);){if(Hn(t))return t;if(Yt(t))return null;t=Oe(t)}return null}function Wn(){return nn==null&&(nn=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),nn}function Xe(e){return/^(html|body|#document)$/.test(Qe(e))}function pe(e){return ce(e).getComputedStyle(e)}function Gt(e){return ne(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Oe(e){if(Qe(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Is(e)&&e.host||Ce(e);return Is(t)?t.host:t}function Lr(e){const t=Oe(e);return Xe(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ie(t)&&ft(t)?t:Lr(t)}function ut(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Lr(e),a=o===((s=e.ownerDocument)==null?void 0:s.body),i=ce(o);if(a){const c=wn(i);return t.concat(i,i.visualViewport||[],ft(o)?o:[],c&&n?ut(c):[])}else return t.concat(o,ut(o,[],n))}function wn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Ri=["top","right","bottom","left"],Ls=["start","end"],Ds=Ri.reduce((e,t)=>e.concat(t,t+"-"+Ls[0],t+"-"+Ls[1]),[]),Ze=Math.min,ie=Math.max,Tt=Math.round,wt=Math.floor,we=e=>({x:e,y:e}),Ti={left:"right",right:"left",bottom:"top",top:"bottom"};function As(e,t,n){return ie(e,Ze(t,n))}function et(e,t){return typeof e=="function"?e(t):e}function Ee(e){return e.split("-")[0]}function ye(e){return e.split("-")[1]}function Dr(e){return e==="x"?"y":"x"}function Ar(e){return e==="y"?"height":"width"}function Se(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Or(e){return Dr(Se(e))}function Fr(e,t,n){n===void 0&&(n=!1);const s=ye(e),o=Or(e),a=Ar(o);let i=o==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(i=Lt(i)),[i,Lt(i)]}function Ii(e){const t=Lt(e);return[It(e),t,It(t)]}function It(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Os=["left","right"],Fs=["right","left"],Li=["top","bottom"],Di=["bottom","top"];function Ai(e,t,n){switch(e){case"top":case"bottom":return n?t?Fs:Os:t?Os:Fs;case"left":case"right":return t?Li:Di;default:return[]}}function Oi(e,t,n,s){const o=ye(e);let a=Ai(Ee(e),n==="start",s);return o&&(a=a.map(i=>i+"-"+o),t&&(a=a.concat(a.map(It)))),a}function Lt(e){const t=Ee(e);return Ti[t]+e.slice(t.length)}function Fi(e){return{top:0,right:0,bottom:0,left:0,...e}}function Pi(e){return typeof e!="number"?Fi(e):{top:e,right:e,bottom:e,left:e}}function Dt(e){const{x:t,y:n,width:s,height:o}=e;return{width:s,height:o,top:n,left:t,right:t+s,bottom:n+o,x:t,y:n}}var zi=typeof document<"u",Bi=function(){},yn=zi?f.useLayoutEffect:Bi;const Vi={...Y},Ui=Vi.useInsertionEffect,Hi=Ui||(e=>e());function Wi(e){const t=Y.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Hi(()=>{t.current=e}),Y.useCallback(function(){for(var n=arguments.length,s=new Array(n),o=0;o<n;o++)s[o]=arguments[o];return t.current==null?void 0:t.current(...s)},[])}function Ps(e,t,n){let{reference:s,floating:o}=e;const a=Se(t),i=Or(t),c=Ar(i),d=Ee(t),u=a==="y",h=s.x+s.width/2-o.width/2,m=s.y+s.height/2-o.height/2,g=s[c]/2-o[c]/2;let l;switch(d){case"top":l={x:h,y:s.y-o.height};break;case"bottom":l={x:h,y:s.y+s.height};break;case"right":l={x:s.x+s.width,y:m};break;case"left":l={x:s.x-o.width,y:m};break;default:l={x:s.x,y:s.y}}switch(ye(t)){case"start":l[i]-=g*(n&&u?-1:1);break;case"end":l[i]+=g*(n&&u?-1:1);break}return l}async function Yi(e,t){var n;t===void 0&&(t={});const{x:s,y:o,platform:a,rects:i,elements:c,strategy:d}=e,{boundary:u="clippingAncestors",rootBoundary:h="viewport",elementContext:m="floating",altBoundary:g=!1,padding:l=0}=et(t,e),p=Pi(l),b=c[g?m==="floating"?"reference":"floating":m],v=Dt(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(b)))==null||n?b:b.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:u,rootBoundary:h,strategy:d})),w=m==="floating"?{x:s,y:o,width:i.floating.width,height:i.floating.height}:i.reference,C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c.floating)),j=await(a.isElement==null?void 0:a.isElement(C))?await(a.getScale==null?void 0:a.getScale(C))||{x:1,y:1}:{x:1,y:1},T=Dt(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:w,offsetParent:C,strategy:d}):w);return{top:(v.top-T.top+p.top)/j.y,bottom:(T.bottom-v.bottom+p.bottom)/j.y,left:(v.left-T.left+p.left)/j.x,right:(T.right-v.right+p.right)/j.x}}const Gi=50,qi=async(e,t,n)=>{const{placement:s="bottom",strategy:o="absolute",middleware:a=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Yi},d=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:h,y:m}=Ps(u,s,d),g=s,l=0;const p={};for(let x=0;x<a.length;x++){const b=a[x];if(!b)continue;const{name:v,fn:w}=b,{x:C,y:j,data:T,reset:S}=await w({x:h,y:m,initialPlacement:s,placement:g,strategy:o,middlewareData:p,rects:u,platform:c,elements:{reference:e,floating:t}});h=C??h,m=j??m,p[v]={...p[v],...T},S&&l<Gi&&(l++,typeof S=="object"&&(S.placement&&(g=S.placement),S.rects&&(u=S.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):S.rects),{x:h,y:m}=Ps(u,g,d)),x=-1)}return{x:h,y:m,placement:g,strategy:o,middlewareData:p}};function Ki(e,t,n){return(e?[...n.filter(o=>ye(o)===e),...n.filter(o=>ye(o)!==e)]:n.filter(o=>Ee(o)===o)).filter(o=>e?ye(o)===e||(t?It(o)!==o:!1):!0)}const Xi=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,s,o;const{rects:a,middlewareData:i,placement:c,platform:d,elements:u}=t,{crossAxis:h=!1,alignment:m,allowedPlacements:g=Ds,autoAlignment:l=!0,...p}=et(e,t),x=m!==void 0||g===Ds?Ki(m||null,l,g):g,b=await d.detectOverflow(t,p),v=((n=i.autoPlacement)==null?void 0:n.index)||0,w=x[v];if(w==null)return{};const C=Fr(w,a,await(d.isRTL==null?void 0:d.isRTL(u.floating)));if(c!==w)return{reset:{placement:x[0]}};const j=[b[Ee(w)],b[C[0]],b[C[1]]],T=[...((s=i.autoPlacement)==null?void 0:s.overflows)||[],{placement:w,overflows:j}],S=x[v+1];if(S)return{data:{index:v+1,overflows:T},reset:{placement:S}};const L=T.map(I=>{const R=ye(I.placement);return[I.placement,R&&h?I.overflows.slice(0,2).reduce((U,W)=>U+W,0):I.overflows[0],I.overflows]}).sort((I,R)=>I[1]-R[1]),z=((o=L.filter(I=>I[2].slice(0,ye(I[0])?2:3).every(R=>R<=0))[0])==null?void 0:o[0])||L[0][0];return z!==c?{data:{index:v+1,overflows:T},reset:{placement:z}}:{}}}},Zi=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:o,middlewareData:a,rects:i,initialPlacement:c,platform:d,elements:u}=t,{mainAxis:h=!0,crossAxis:m=!0,fallbackPlacements:g,fallbackStrategy:l="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:x=!0,...b}=et(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const v=Ee(o),w=Se(c),C=Ee(c)===c,j=await(d.isRTL==null?void 0:d.isRTL(u.floating)),T=g||(C||!x?[Lt(c)]:Ii(c)),S=p!=="none";!g&&S&&T.push(...Oi(c,x,p,j));const L=[c,...T],F=await d.detectOverflow(t,b),z=[];let I=((s=a.flip)==null?void 0:s.overflows)||[];if(h&&z.push(F[v]),m){const A=Fr(o,i,j);z.push(F[A[0]],F[A[1]])}if(I=[...I,{placement:o,overflows:z}],!z.every(A=>A<=0)){var R,U;const A=(((R=a.flip)==null?void 0:R.index)||0)+1,M=L[A];if(M&&(!(m==="alignment"?w!==Se(M):!1)||I.every(y=>Se(y.placement)===w?y.overflows[0]>0:!0)))return{data:{index:A,overflows:I},reset:{placement:M}};let _=(U=I.filter(k=>k.overflows[0]<=0).sort((k,y)=>k.overflows[1]-y.overflows[1])[0])==null?void 0:U.placement;if(!_)switch(l){case"bestFit":{var W;const k=(W=I.filter(y=>{if(S){const $=Se(y.placement);return $===w||$==="y"}return!0}).map(y=>[y.placement,y.overflows.filter($=>$>0).reduce(($,E)=>$+E,0)]).sort((y,$)=>y[1]-$[1])[0])==null?void 0:W[0];k&&(_=k);break}case"initialPlacement":_=c;break}if(o!==_)return{reset:{placement:_}}}return{}}}},Ji=new Set(["left","top"]);async function Qi(e,t){const{placement:n,platform:s,elements:o}=e,a=await(s.isRTL==null?void 0:s.isRTL(o.floating)),i=Ee(n),c=ye(n),d=Se(n)==="y",u=Ji.has(i)?-1:1,h=a&&d?-1:1,m=et(t,e);let{mainAxis:g,crossAxis:l,alignmentAxis:p}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof p=="number"&&(l=c==="end"?p*-1:p),d?{x:l*h,y:g*u}:{x:g*u,y:l*h}}const ec=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:o,y:a,placement:i,middlewareData:c}=t,d=await Qi(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(s=c.arrow)!=null&&s.alignmentOffset?{}:{x:o+d.x,y:a+d.y,data:{...d,placement:i}}}}},tc=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:o,platform:a}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:d={fn:v=>{let{x:w,y:C}=v;return{x:w,y:C}}},...u}=et(e,t),h={x:n,y:s},m=await a.detectOverflow(t,u),g=Se(Ee(o)),l=Dr(g);let p=h[l],x=h[g];if(i){const v=l==="y"?"top":"left",w=l==="y"?"bottom":"right",C=p+m[v],j=p-m[w];p=As(C,p,j)}if(c){const v=g==="y"?"top":"left",w=g==="y"?"bottom":"right",C=x+m[v],j=x-m[w];x=As(C,x,j)}const b=d.fn({...t,[l]:p,[g]:x});return{...b,data:{x:b.x-n,y:b.y-s,enabled:{[l]:i,[g]:c}}}}}},nc=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:o,rects:a,platform:i,elements:c}=t,{apply:d=()=>{},...u}=et(e,t),h=await i.detectOverflow(t,u),m=Ee(o),g=ye(o),l=Se(o)==="y",{width:p,height:x}=a.floating;let b,v;m==="top"||m==="bottom"?(b=m,v=g===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(v=m,b=g==="end"?"top":"bottom");const w=x-h.top-h.bottom,C=p-h.left-h.right,j=Ze(x-h[b],w),T=Ze(p-h[v],C),S=!t.middlewareData.shift;let L=j,F=T;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(F=C),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(L=w),S&&!g){const I=ie(h.left,0),R=ie(h.right,0),U=ie(h.top,0),W=ie(h.bottom,0);l?F=p-2*(I!==0||R!==0?I+R:ie(h.left,h.right)):L=x-2*(U!==0||W!==0?U+W:ie(h.top,h.bottom))}await d({...t,availableWidth:F,availableHeight:L});const z=await i.getDimensions(c.floating);return p!==z.width||x!==z.height?{reset:{rects:!0}}:{}}}};function Pr(e){const t=pe(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const o=Ie(e),a=o?e.offsetWidth:n,i=o?e.offsetHeight:s,c=Tt(n)!==a||Tt(s)!==i;return c&&(n=a,s=i),{width:n,height:s,$:c}}function Yn(e){return ne(e)?e:e.contextElement}function qe(e){const t=Yn(e);if(!Ie(t))return we(1);const n=t.getBoundingClientRect(),{width:s,height:o,$:a}=Pr(t);let i=(a?Tt(n.width):n.width)/s,c=(a?Tt(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const sc=we(0);function zr(e){const t=ce(e);return!Wn()||!t.visualViewport?sc:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function rc(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ce(e)?!1:t}function Ye(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),a=Yn(e);let i=we(1);t&&(s?ne(s)&&(i=qe(s)):i=qe(e));const c=rc(a,n,s)?zr(a):we(0);let d=(o.left+c.x)/i.x,u=(o.top+c.y)/i.y,h=o.width/i.x,m=o.height/i.y;if(a){const g=ce(a),l=s&&ne(s)?ce(s):s;let p=g,x=wn(p);for(;x&&s&&l!==p;){const b=qe(x),v=x.getBoundingClientRect(),w=pe(x),C=v.left+(x.clientLeft+parseFloat(w.paddingLeft))*b.x,j=v.top+(x.clientTop+parseFloat(w.paddingTop))*b.y;d*=b.x,u*=b.y,h*=b.x,m*=b.y,d+=C,u+=j,p=ce(x),x=wn(p)}}return Dt({width:h,height:m,x:d,y:u})}function qt(e,t){const n=Gt(e).scrollLeft;return t?t.left+n:Ye(Ce(e)).left+n}function Br(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-qt(e,n),o=n.top+t.scrollTop;return{x:s,y:o}}function oc(e){let{elements:t,rect:n,offsetParent:s,strategy:o}=e;const a=o==="fixed",i=Ce(s),c=t?Yt(t.floating):!1;if(s===i||c&&a)return n;let d={scrollLeft:0,scrollTop:0},u=we(1);const h=we(0),m=Ie(s);if((m||!m&&!a)&&((Qe(s)!=="body"||ft(i))&&(d=Gt(s)),m)){const l=Ye(s);u=qe(s),h.x=l.x+s.clientLeft,h.y=l.y+s.clientTop}const g=i&&!m&&!a?Br(i,d):we(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-d.scrollLeft*u.x+h.x+g.x,y:n.y*u.y-d.scrollTop*u.y+h.y+g.y}}function ac(e){return Array.from(e.getClientRects())}function ic(e){const t=Ce(e),n=Gt(e),s=e.ownerDocument.body,o=ie(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),a=ie(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let i=-n.scrollLeft+qt(e);const c=-n.scrollTop;return pe(s).direction==="rtl"&&(i+=ie(t.clientWidth,s.clientWidth)-o),{width:o,height:a,x:i,y:c}}const zs=25;function cc(e,t){const n=ce(e),s=Ce(e),o=n.visualViewport;let a=s.clientWidth,i=s.clientHeight,c=0,d=0;if(o){a=o.width,i=o.height;const h=Wn();(!h||h&&t==="fixed")&&(c=o.offsetLeft,d=o.offsetTop)}const u=qt(s);if(u<=0){const h=s.ownerDocument,m=h.body,g=getComputedStyle(m),l=h.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,p=Math.abs(s.clientWidth-m.clientWidth-l);p<=zs&&(a-=p)}else u<=zs&&(a+=u);return{width:a,height:i,x:c,y:d}}function lc(e,t){const n=Ye(e,!0,t==="fixed"),s=n.top+e.clientTop,o=n.left+e.clientLeft,a=Ie(e)?qe(e):we(1),i=e.clientWidth*a.x,c=e.clientHeight*a.y,d=o*a.x,u=s*a.y;return{width:i,height:c,x:d,y:u}}function Bs(e,t,n){let s;if(t==="viewport")s=cc(e,n);else if(t==="document")s=ic(Ce(e));else if(ne(t))s=lc(t,n);else{const o=zr(e);s={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Dt(s)}function Vr(e,t){const n=Oe(e);return n===t||!ne(n)||Xe(n)?!1:pe(n).position==="fixed"||Vr(n,t)}function uc(e,t){const n=t.get(e);if(n)return n;let s=ut(e,[],!1).filter(c=>ne(c)&&Qe(c)!=="body"),o=null;const a=pe(e).position==="fixed";let i=a?Oe(e):e;for(;ne(i)&&!Xe(i);){const c=pe(i),d=Hn(i);!d&&c.position==="fixed"&&(o=null),(a?!d&&!o:!d&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||ft(i)&&!d&&Vr(e,i))?s=s.filter(h=>h!==i):o=c,i=Oe(i)}return t.set(e,s),s}function dc(e){let{element:t,boundary:n,rootBoundary:s,strategy:o}=e;const i=[...n==="clippingAncestors"?Yt(t)?[]:uc(t,this._c):[].concat(n),s],c=Bs(t,i[0],o);let d=c.top,u=c.right,h=c.bottom,m=c.left;for(let g=1;g<i.length;g++){const l=Bs(t,i[g],o);d=ie(l.top,d),u=Ze(l.right,u),h=Ze(l.bottom,h),m=ie(l.left,m)}return{width:u-m,height:h-d,x:m,y:d}}function fc(e){const{width:t,height:n}=Pr(e);return{width:t,height:n}}function mc(e,t,n){const s=Ie(t),o=Ce(t),a=n==="fixed",i=Ye(e,!0,a,t);let c={scrollLeft:0,scrollTop:0};const d=we(0);function u(){d.x=qt(o)}if(s||!s&&!a)if((Qe(t)!=="body"||ft(o))&&(c=Gt(t)),s){const l=Ye(t,!0,a,t);d.x=l.x+t.clientLeft,d.y=l.y+t.clientTop}else o&&u();a&&!s&&o&&u();const h=o&&!s&&!a?Br(o,c):we(0),m=i.left+c.scrollLeft-d.x-h.x,g=i.top+c.scrollTop-d.y-h.y;return{x:m,y:g,width:i.width,height:i.height}}function sn(e){return pe(e).position==="static"}function Vs(e,t){if(!Ie(e)||pe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ce(e)===n&&(n=n.ownerDocument.body),n}function Ur(e,t){const n=ce(e);if(Yt(e))return n;if(!Ie(e)){let o=Oe(e);for(;o&&!Xe(o);){if(ne(o)&&!sn(o))return o;o=Oe(o)}return n}let s=Vs(e,t);for(;s&&Si(s)&&sn(s);)s=Vs(s,t);return s&&Xe(s)&&sn(s)&&!Hn(s)?n:s||Mi(e)||n}const hc=async function(e){const t=this.getOffsetParent||Ur,n=this.getDimensions,s=await n(e.floating);return{reference:mc(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function gc(e){return pe(e).direction==="rtl"}const pc={convertOffsetParentRelativeRectToViewportRelativeRect:oc,getDocumentElement:Ce,getClippingRect:dc,getOffsetParent:Ur,getElementRects:hc,getClientRects:ac,getDimensions:fc,getScale:qe,isElement:ne,isRTL:gc};function Hr(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function xc(e,t){let n=null,s;const o=Ce(e);function a(){var c;clearTimeout(s),(c=n)==null||c.disconnect(),n=null}function i(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),a();const u=e.getBoundingClientRect(),{left:h,top:m,width:g,height:l}=u;if(c||t(),!g||!l)return;const p=wt(m),x=wt(o.clientWidth-(h+g)),b=wt(o.clientHeight-(m+l)),v=wt(h),C={rootMargin:-p+"px "+-x+"px "+-b+"px "+-v+"px",threshold:ie(0,Ze(1,d))||1};let j=!0;function T(S){const L=S[0].intersectionRatio;if(L!==d){if(!j)return i();L?i(!1,L):s=setTimeout(()=>{i(!1,1e-7)},1e3)}L===1&&!Hr(u,e.getBoundingClientRect())&&i(),j=!1}try{n=new IntersectionObserver(T,{...C,root:o.ownerDocument})}catch{n=new IntersectionObserver(T,C)}n.observe(e)}return i(!0),a}function bc(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=s,u=Yn(e),h=o||a?[...u?ut(u):[],...t?ut(t):[]]:[];h.forEach(v=>{o&&v.addEventListener("scroll",n,{passive:!0}),a&&v.addEventListener("resize",n)});const m=u&&c?xc(u,n):null;let g=-1,l=null;i&&(l=new ResizeObserver(v=>{let[w]=v;w&&w.target===u&&l&&t&&(l.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var C;(C=l)==null||C.observe(t)})),n()}),u&&!d&&l.observe(u),t&&l.observe(t));let p,x=d?Ye(e):null;d&&b();function b(){const v=Ye(e);x&&!Hr(x,v)&&n(),x=v,p=requestAnimationFrame(b)}return n(),()=>{var v;h.forEach(w=>{o&&w.removeEventListener("scroll",n),a&&w.removeEventListener("resize",n)}),m==null||m(),(v=l)==null||v.disconnect(),l=null,d&&cancelAnimationFrame(p)}}const vc=ec,wc=Xi,yc=tc,Ec=Zi,Cc=nc,_c=(e,t,n)=>{const s=new Map,o={platform:pc,...n},a={...o.platform,_c:s};return qi(e,t,{...o,platform:a})};var Nc=typeof document<"u",jc=function(){},jt=Nc?f.useLayoutEffect:jc;function At(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!At(e[s],t[s]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,o[s]))return!1;for(s=n;s--!==0;){const a=o[s];if(!(a==="_owner"&&e.$$typeof)&&!At(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function Wr(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Us(e,t){const n=Wr(e);return Math.round(t*n)/n}function rn(e){const t=Y.useRef(e);return jt(()=>{t.current=e}),t}function Sc(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:o,elements:{reference:a,floating:i}={},transform:c=!0,whileElementsMounted:d,open:u}=e,[h,m]=Y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,l]=Y.useState(s);At(g,s)||l(s);const[p,x]=Y.useState(null),[b,v]=Y.useState(null),w=Y.useCallback(y=>{y!==S.current&&(S.current=y,x(y))},[]),C=Y.useCallback(y=>{y!==L.current&&(L.current=y,v(y))},[]),j=a||p,T=i||b,S=Y.useRef(null),L=Y.useRef(null),F=Y.useRef(h),z=d!=null,I=rn(d),R=rn(o),U=rn(u),W=Y.useCallback(()=>{if(!S.current||!L.current)return;const y={placement:t,strategy:n,middleware:g};R.current&&(y.platform=R.current),_c(S.current,L.current,y).then($=>{const E={...$,isPositioned:U.current!==!1};A.current&&!At(F.current,E)&&(F.current=E,go.flushSync(()=>{m(E)}))})},[g,t,n,R,U]);jt(()=>{u===!1&&F.current.isPositioned&&(F.current.isPositioned=!1,m(y=>({...y,isPositioned:!1})))},[u]);const A=Y.useRef(!1);jt(()=>(A.current=!0,()=>{A.current=!1}),[]),jt(()=>{if(j&&(S.current=j),T&&(L.current=T),j&&T){if(I.current)return I.current(j,T,W);W()}},[j,T,W,I,z]);const M=Y.useMemo(()=>({reference:S,floating:L,setReference:w,setFloating:C}),[w,C]),_=Y.useMemo(()=>({reference:j,floating:T}),[j,T]),k=Y.useMemo(()=>{const y={position:n,left:0,top:0};if(!_.floating)return y;const $=Us(_.floating,h.x),E=Us(_.floating,h.y);return c?{...y,transform:"translate("+$+"px, "+E+"px)",...Wr(_.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:$,top:E}},[n,c,_.floating,h.x,h.y]);return Y.useMemo(()=>({...h,update:W,refs:M,elements:_,floatingStyles:k}),[h,W,M,_,k])}const on=(e,t)=>{const n=vc(e);return{name:n.name,fn:n.fn,options:[e,t]}},kc=(e,t)=>{const n=yc(e);return{name:n.name,fn:n.fn,options:[e,t]}},$c=(e,t)=>{const n=Ec(e);return{name:n.name,fn:n.fn,options:[e,t]}},Mc=(e,t)=>{const n=Cc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Rc=(e,t)=>{const n=wc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tc={...Y};let Hs=!1,Ic=0;const Ws=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Ic++;function Lc(){const[e,t]=Y.useState(()=>Hs?Ws():void 0);return yn(()=>{e==null&&t(Ws())},[]),Y.useEffect(()=>{Hs=!0},[]),e}const Dc=Tc.useId,Ac=Dc||Lc;let En;process.env.NODE_ENV!=="production"&&(En=new Set);function Oc(){for(var e,t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];const o="Floating UI: "+n.join(" ");if(!((e=En)!=null&&e.has(o))){var a;(a=En)==null||a.add(o),console.error(o)}}function Fc(){const e=new Map;return{emit(t,n){var s;(s=e.get(t))==null||s.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var s;(s=e.get(t))==null||s.delete(n)}}}const Pc=Y.createContext(null),zc=Y.createContext(null),Bc=()=>{var e;return((e=Y.useContext(Pc))==null?void 0:e.id)||null},Vc=()=>Y.useContext(zc);function Uc(e){const{open:t=!1,onOpenChange:n,elements:s}=e,o=Ac(),a=Y.useRef({}),[i]=Y.useState(()=>Fc()),c=Bc()!=null;if(process.env.NODE_ENV!=="production"){const l=s.reference;l&&!ne(l)&&Oc("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[d,u]=Y.useState(s.reference),h=Wi((l,p,x)=>{a.current.openEvent=l?p:void 0,i.emit("openchange",{open:l,event:p,reason:x,nested:c}),n==null||n(l,p,x)}),m=Y.useMemo(()=>({setPositionReference:u}),[]),g=Y.useMemo(()=>({reference:d||s.reference||null,floating:s.floating||null,domReference:s.reference}),[d,s.reference,s.floating]);return Y.useMemo(()=>({dataRef:a,open:t,onOpenChange:h,elements:g,events:i,floatingId:o,refs:m}),[t,h,g,i,o,m])}function Hc(e){e===void 0&&(e={});const{nodeId:t}=e,n=Uc({...e,elements:{reference:null,floating:null,...e.elements}}),s=e.rootContext||n,o=s.elements,[a,i]=Y.useState(null),[c,d]=Y.useState(null),h=(o==null?void 0:o.domReference)||a,m=Y.useRef(null),g=Vc();yn(()=>{h&&(m.current=h)},[h]);const l=Sc({...e,elements:{...o,...c&&{reference:c}}}),p=Y.useCallback(C=>{const j=ne(C)?{getBoundingClientRect:()=>C.getBoundingClientRect(),getClientRects:()=>C.getClientRects(),contextElement:C}:C;d(j),l.refs.setReference(j)},[l.refs]),x=Y.useCallback(C=>{(ne(C)||C===null)&&(m.current=C,i(C)),(ne(l.refs.reference.current)||l.refs.reference.current===null||C!==null&&!ne(C))&&l.refs.setReference(C)},[l.refs]),b=Y.useMemo(()=>({...l.refs,setReference:x,setPositionReference:p,domReference:m}),[l.refs,x,p]),v=Y.useMemo(()=>({...l.elements,domReference:h}),[l.elements,h]),w=Y.useMemo(()=>({...l,...s,refs:b,elements:v,nodeId:t}),[l,b,v,t,s]);return yn(()=>{s.dataRef.current.floatingContext=w;const C=g==null?void 0:g.nodesRef.current.find(j=>j.id===t);C&&(C.context=w)}),Y.useMemo(()=>({...l,context:w,refs:b,elements:v}),[l,b,v,w])}const Wc=typeof window<"u"&&"ResizeObserver"in window;function Yc(e){return String(e).startsWith("auto")?Rc({alignment:e==="auto-start"?"start":e==="auto-end"?"end":void 0}):null}function Gc(e){if(e==null)return null;if(Array.isArray(e)){const[t,n]=e;return on({crossAxis:t,mainAxis:n})}return on(e)}function qc({allowFlip:e=!0,allowShift:t=!0,autoUpdateOptions:n,fitAvailableSpace:s=!1,freeze:o=!1,offset:a,placement:i="bottom-start"}){const c=Yc(i),d=Gc(a),u=i.startsWith("left")||i.startsWith("right"),h=[...d?[d]:[],...c?[c]:e&&!u?[$c()]:[],...t?[kc({padding:8})]:[],...s?[Mc({apply:()=>{}})]:[]],m=String(i).startsWith("auto")?"bottom":i;return Hc({middleware:h,placement:m,strategy:"fixed",whileElementsMounted:o?void 0:(g,l,p)=>bc(g,l,p,{ancestorResize:!0,ancestorScroll:!0,animationFrame:!1,elementResize:Wc,...n})})}function Yr({allowFlip:e,open:t,placement:n,referenceElement:s}){const[o,a]=f.useState(null),{refs:i,strategy:c,update:d,x:u,y:h}=qc({allowFlip:e,freeze:!0,placement:n});return f.useEffect(()=>{i.setReference(s)},[s,i]),f.useEffect(()=>{i.setFloating(o)},[o,i]),f.useEffect(()=>{t&&o&&(d==null||d())},[t,n,o,d]),o&&!t&&a(null),{setPopperElement:a,styles:{left:u??0,position:c,top:h??0}}}const Gr=({allowFlip:e=!0,children:t,className:n,dialogManagerId:s,focus:o=!0,id:a,placement:i="auto",referenceElement:c=null,tabIndex:d,trapFocus:u,...h})=>{const m=Dn({dialogManagerId:s,id:a}),g=Ke(a,s),{setPopperElement:l,styles:p}=Yr({allowFlip:e,open:g,placement:i,referenceElement:c});return f.useEffect(()=>{if(!g)return;const x=b=>{b.key==="Escape"&&(m==null||m.close())};return document.addEventListener("keyup",x),()=>{document.removeEventListener("keyup",x)}},[m,g]),g?f.createElement(wa,{dialogId:a,dialogManagerId:s},f.createElement(vi,{autoFocus:o,contain:u,restoreFocus:!0},f.createElement("div",{...h,className:$e("str-chat__dialog-contents",n),"data-testid":"str-chat__dialog-contents",ref:l,style:p,tabIndex:typeof d<"u"?d:0},t))):null},Kc=({children:e,className:t,placement:n,Submenu:s,submenuContainerProps:o,...a})=>{const i=f.useRef(null),[c,d]=f.useState(null),u=f.useRef(!1),h=f.useRef(null),m=f.useMemo(()=>`submenu-${Math.random().toString(36).slice(2)}`,[]),{dialog:g,dialogManager:l}=An({id:m}),p=Ke(m,l==null?void 0:l.id),{setPopperElement:x,styles:b}=Yr({open:p,placement:n,referenceElement:i.current}),v=f.useCallback(()=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{u.current||g.close()},100)},[g]),w=f.useCallback(j=>{const T=i.current;!p||!T||(j.stopPropagation(),v(),T.focus())},[v,p,i]),C=()=>{p||(g.open(),u.current=!0)};return f.useEffect(()=>{const j=i.current;if(!p||!j)return;const T=S=>{S.key==="Escape"&&(w(S),u.current=!1)};return document.addEventListener("keyup",T,{capture:!0}),()=>{document.removeEventListener("keyup",T,{capture:!0})}},[p,w]),f.createElement(f.Fragment,null,f.createElement("button",{"aria-selected":"false",className:$e(t,"str_chat__button-with-submenu",{"str_chat__button-with-submenu--submenu-open":p}),onBlur:()=>{u.current=!1,v()},onClick:j=>{j.stopPropagation(),g.toggle()},onFocus:C,onMouseEnter:C,onMouseLeave:()=>{u.current=!1,v()},ref:i,role:"option",...a},e),p&&f.createElement("div",{onBlur:j=>{j.relatedTarget instanceof Node&&(c!=null&&c.contains(j.relatedTarget))||(u.current=!1,v())},onFocus:()=>{u.current=!0},onMouseEnter:()=>{u.current=!0},onMouseLeave:()=>{u.current=!1,v()},ref:j=>{x(j),d(j)},style:b,tabIndex:-1,...o},f.createElement(s,null)))},Xc=({className:e,isMine:t})=>{const{t:n}=oe();return f.createElement(Kc,{"aria-selected":"false",className:e,placement:t?"left-start":"right-start",Submenu:Zc},n("Remind Me"))},Zc=()=>{const{t:e}=oe(),{client:t}=He(),{message:n}=te();return f.createElement("div",{"aria-label":e("aria/Remind Me Options"),className:"str-chat__message-actions-box__submenu",role:"listbox"},t.reminders.scheduledOffsetsMs.map(s=>f.createElement("button",{className:"str-chat__message-actions-list-item-button",key:`reminder-offset-option--${s}`,onClick:()=>{t.reminders.upsertReminder({messageId:n.id,remind_at:new Date(new Date().getTime()+s).toISOString()})}},e("duration/Remind Me",{milliseconds:s}))))},Jc=({className:e=""})=>f.createElement("svg",{className:e,height:"4",viewBox:"0 0 11 4",width:"11",xmlns:"http://www.w3.org/2000/svg"},f.createElement("path",{d:"M1.5 3a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm4 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm4 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z",fillRule:"nonzero"})),Qc=({className:e=""})=>f.createElement("svg",{className:e,height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg"},f.createElement("g",{clipRule:"evenodd",fillRule:"evenodd"},f.createElement("path",{d:"M6 1.2C3.3 1.2 1.2 3.3 1.2 6c0 2.7 2.1 4.8 4.8 4.8 2.7 0 4.8-2.1 4.8-4.8 0-2.7-2.1-4.8-4.8-4.8zM0 6c0-3.3 2.7-6 6-6s6 2.7 6 6-2.7 6-6 6-6-2.7-6-6z"}),f.createElement("path",{d:"M5.4 4.5c0 .5-.4.9-.9.9s-.9-.4-.9-.9.4-.9.9-.9.9.4.9.9zM8.4 4.5c0 .5-.4.9-.9.9s-.9-.4-.9-.9.4-.9.9-.9.9.4.9.9zM3.3 6.7c.3-.2.6-.1.8.1.3.4.8.9 1.5 1 .6.2 1.4.1 2.4-1 .2-.2.6-.3.8 0 .2.2.3.6 0 .8-1.1 1.3-2.4 1.7-3.5 1.5-1-.2-1.8-.9-2.2-1.5-.2-.3-.1-.7.2-.9z"}))),el=({className:e=""})=>f.createElement("svg",{className:e,height:"10",width:"14",xmlns:"http://www.w3.org/2000/svg"},f.createElement("path",{d:"M8.516 3c4.78 0 4.972 6.5 4.972 6.5-1.6-2.906-2.847-3.184-4.972-3.184v2.872L3.772 4.994 8.516.5V3zM.484 5l4.5-4.237v1.78L2.416 5l2.568 2.125v1.828L.484 5z",fillRule:"evenodd"})),tl=e=>{const{children:t,customWrapperClass:n,inline:s,toggleOpen:o}=e,a=$e("str-chat__message-simple__actions__action","str-chat__message-simple__actions__action--options","str-chat__message-actions-container"),i={className:n||a,"data-testid":"message-actions",onClick:o};return s?f.createElement("span",{...i},t):f.createElement("div",{...i},t)},nl=e=>e?e.current!==void 0:!1,sl=e=>new Promise((t,n)=>{const s=new Image;s.addEventListener("load",()=>{t([s.width,s.height])},{once:!0}),s.addEventListener("error",()=>n(`Couldn't load image from ${e}`),{once:!0}),s.src=e}),rl=({columns:e,fallback:t,height:n,position:s,rows:o,spriteUrl:a,style:i,width:c})=>{const[[d,u],h]=f.useState([0,0]);f.useEffect(()=>{sl(a).then(h).catch(console.error)},[a]);const[m,g]=s;return!u||!d?f.createElement(f.Fragment,null,t):f.createElement("div",{"data-testid":"sprite-image",style:{...i,"--str-chat__sprite-image-resize-ratio":"var(--str-chat__sprite-image-resize-ratio-x, var(--str-chat__sprite-image-resize-ratio-y, 1))","--str-chat__sprite-image-resize-ratio-x":"calc(var(--str-chat__sprite-image-width) / var(--str-chat__sprite-item-width))","--str-chat__sprite-image-resize-ratio-y":"calc(var(--str-chat__sprite-image-height) / var(--str-chat__sprite-item-height))","--str-chat__sprite-item-height":`${u/o}`,"--str-chat__sprite-item-width":`${d/e}`,...Number.isFinite(n)?{"--str-chat__sprite-image-height":`${n}px`}:{},...Number.isFinite(c)?{"--str-chat__sprite-image-width":`${c}px`}:{},backgroundImage:`url('${a}')`,backgroundPosition:`${m*(100/(e-1))}% ${g*(100/(o-1))}%`,backgroundSize:`${e*100}% ${o*100}%`,height:"var(--str-chat__sprite-image-height, calc(var(--str-chat__sprite-item-height) * var(--str-chat__sprite-image-resize-ratio)))",width:"var(--str-chat__sprite-image-width, calc(var(--str-chat__sprite-item-width) * var(--str-chat__sprite-image-resize-ratio)))"}})},ol={angry:[1,1],haha:[1,0],like:[0,0],love:[1,2],sad:[0,1],wow:[0,2]},al="https://getstream.imgix.net/images/emoji-sprite.png",nt=({fallback:e,type:t})=>{const n=ol[t];return f.createElement(rl,{columns:2,fallback:e,position:n,rows:3,spriteUrl:al,style:{"--str-chat__sprite-image-height":"var(--str-chat__stream-emoji-size, 18px)"}})},il=[{type:"haha",Component:()=>f.createElement(nt,{fallback:"😂",type:"haha"}),name:"Joy"},{type:"like",Component:()=>f.createElement(nt,{fallback:"👍",type:"like"}),name:"Thumbs up"},{type:"love",Component:()=>f.createElement(nt,{fallback:"❤️",type:"love"}),name:"Heart"},{type:"sad",Component:()=>f.createElement(nt,{fallback:"😔",type:"sad"}),name:"Sad"},{type:"wow",Component:()=>f.createElement(nt,{fallback:"😲",type:"wow"}),name:"Astonished"}],cl=e=>{var y;const{Avatar:t,detailedView:n=!0,handleReaction:s,latest_reactions:o,own_reactions:a,reaction_groups:i,reactionOptions:c,reverse:d=!1}=e,{Avatar:u,reactionOptions:h=il}=vr(),{closeReactionSelectorOnClick:m,handleReaction:g,message:l}=te(),p=`reaction-selector--${l.id}`,x=Dn({id:p}),b=c??h,v=t||u||Ba,w=s||g,C=o||(l==null?void 0:l.latest_reactions)||[],j=a||(l==null?void 0:l.own_reactions)||[],T=i||(l==null?void 0:l.reaction_groups)||{},[S,L]=f.useState(null),[F,z]=f.useState(null),I=f.useRef(null),R=f.useRef(null),U=f.useRef(null),W=f.useCallback(($,E)=>{R.current=$.currentTarget,L(E)},[]),A=f.useCallback(()=>{L(null),z(null)},[]);f.useEffect(()=>{var H,G,re;if(!S||!I.current)return;const $=(H=U.current)==null?void 0:H.getBoundingClientRect(),E=(G=R.current)==null?void 0:G.getBoundingClientRect(),D=nl(I)?(re=I.current)==null?void 0:re.getBoundingClientRect():null;if(!$||!E||!D)return;const N=$.width===D.width||$.x<D.x?0:E.left+E.width/2-D.left-$.width/2,O=E.x-$.x+E.width/2-N;z({arrow:O,tooltip:N})},[S,I]);const M=$=>C.map(E=>{var D,N;return E.type===$?((D=E.user)==null?void 0:D.name)||((N=E.user)==null?void 0:N.id):null}).filter(Boolean),_=$=>j.find(E=>E.type===$),k=$=>{var E;return((E=C.find(D=>D.type===$&&!!D.user))==null?void 0:E.user)||void 0};return f.createElement("div",{className:$e("str-chat__reaction-selector str-chat__message-reaction-selector str-chat-react__message-reaction-selector",{"str-chat__reaction-selector--reverse":d}),"data-testid":"reaction-selector",ref:I},!!S&&n&&f.createElement("div",{className:"str-chat__reaction-selector-tooltip",ref:U,style:{left:F==null?void 0:F.tooltip,visibility:F?"visible":"hidden"}},f.createElement("div",{className:"arrow",style:{left:F==null?void 0:F.arrow}}),(y=M(S))==null?void 0:y.map(($,E,D)=>f.createElement("span",{className:"latest-user-username",key:`key-${E}-${$}`},`${$}${E<D.length-1?", ":""}`))),f.createElement("ul",{className:"str-chat__message-reactions-list str-chat__message-reactions-options"},b.map(({Component:$,name:E,type:D})=>{var H;const N=k(D),O=((H=T[D])==null?void 0:H.count)??0;return f.createElement("li",{key:D},f.createElement("button",{"aria-label":`Select Reaction: ${E||D}`,className:$e("str-chat__message-reactions-list-item str-chat__message-reactions-option",{"str-chat__message-reactions-option-selected":_(D)}),"data-testid":"select-reaction-button","data-text":D,onClick:G=>{w(D,G),m&&x.close()}},!!O&&n&&f.createElement("div",{className:"latest-user str-chat__message-reactions-last-user",onClick:A,onMouseEnter:G=>W(G,D),onMouseLeave:A},N?f.createElement(v,{image:N.image,name:N.name,size:20,user:N}):f.createElement("div",{className:"latest-user-not-found"})),f.createElement("span",{className:"str-chat__message-reaction-emoji"},f.createElement($,null)),!!O&&n&&f.createElement("span",{className:"str-chat__message-reactions-list-item__count"},O||"")))})))},ll=f.memo(cl),ul=({ReactionIcon:e})=>{const{t}=oe("ReactionSelectorWithButton"),{isMyMessage:n,message:s,threadList:o}=te(),{ReactionSelector:a=ll}=vr(),i=f.useRef(null),d=`reaction-selector${o?"-thread-":""}--${s.id}`,{dialog:u,dialogManager:h}=An({id:d}),m=Ke(d,h==null?void 0:h.id);return f.createElement(f.Fragment,null,f.createElement(Gr,{dialogManagerId:h==null?void 0:h.id,id:d,placement:n()?"top-end":"top-start",referenceElement:i.current,trapFocus:!0},f.createElement(a,null)),f.createElement("button",{"aria-expanded":m,"aria-label":t("aria/Open Reaction Selector"),className:"str-chat__message-reactions-button","data-testid":"message-reaction-action",onClick:()=>u==null?void 0:u.toggle(),ref:i},f.createElement(e,{className:"str-chat__message-action-icon"})))},dl=f.createContext({legacyThread:void 0}),fl=()=>f.useContext(dl),yt=new De.FixedSizeQueueCache(64),ml=()=>{const{client:e}=He(),{channel:t}=In(),{editing:n,message:s}=te(),{legacyThread:o}=fl(),a=Fa(),i=f.useMemo(()=>{if(s)return s},[s==null?void 0:s.id]),c=f.useMemo(()=>{if(o)return o},[o==null?void 0:o.id]),d=f.useMemo(()=>{if(n&&i){const u=De.MessageComposer.constructTag(i),h=yt.get(u);return h?(h.editedMessage=i,h):new De.MessageComposer({client:e,composition:i,compositionContext:i})}else{if(a)return a.messageComposer;if(c){const u={...c,legacyThreadId:c.id},h=De.MessageComposer.constructTag(u),m=yt.get(h);return m||new De.MessageComposer({client:e,compositionContext:u})}else return t.messageComposer}},[i,c,t,e,n,a]);return["legacy_thread","message"].includes(d.contextType)&&!yt.peek(d.tag)&&yt.add(d.tag,d),f.useEffect(()=>{const u=d.registerSubscriptions();return()=>{u()}},[d]),d},hl=(e,t=!1)=>{const{initialMessage:n,message:s}=te(),{channelConfig:o}=In(),{canDelete:a,canEdit:i,canFlag:c,canMarkUnread:d,canMute:u,canQuote:h,canReact:m,canReply:g}=Ha(s),l=typeof s.parent_id=="string";return f.useMemo(()=>t?e:n||!s.type||s.type==="error"||s.type==="system"||s.type==="ephemeral"||s.status==="failed"||s.status==="sending"?[]:e.filter(({type:p})=>!(Ua.includes(p)&&l||p==="delete"&&!a||p==="edit"&&!i||p==="flag"&&!c||p==="markUnread"&&!d||p==="mute"&&!u||p==="quote"&&!h||p==="react"&&!m||p==="reply"&&!g||p==="remindMe"&&!(o!=null&&o.user_message_reminders)||p==="saveForLater"&&!(o!=null&&o.user_message_reminders))),[a,i,c,d,u,h,m,g,o,n,l,s.status,s.type,t,e])},gl=e=>f.useMemo(()=>{const t=[],n=[];for(const s of e)s.placement==="quick"&&t.push(s),s.placement==="dropdown"&&n.push(s);return{dropdownActionSet:n,quickActionSet:t}},[e]),qr="str-chat__message-actions-list-item-button",be=({"aria-selected":e="false",children:t,className:n=qr,role:s="option",...o})=>f.createElement("button",{"aria-selected":e,className:n,role:s,...o},t),he={dropdown:{Quote(){const{message:e}=te(),{t}=oe(),n=ml(),s=()=>{n.setQuotedMessage(e);const a=(e.parent_id?document.querySelectorAll(".str-chat__thread .str-chat__textarea__textarea"):document.getElementsByClassName("str-chat__textarea__textarea")).item(0);a instanceof HTMLTextAreaElement&&a.focus()};return f.createElement(be,{onClick:s},t("Quote"))},Pin(){const{handlePin:e,message:t}=te(),{t:n}=oe();return f.createElement(be,{onClick:e},t.pinned?n("Unpin"):n("Pin"))},MarkUnread(){const{handleMarkUnread:e}=te(),{t}=oe();return f.createElement(be,{onClick:e},t("Mark as unread"))},Flag(){const{handleFlag:e}=te(),{t}=oe();return f.createElement(be,{onClick:e},t("Flag"))},Mute(){const{handleMute:e,message:t}=te(),{mutes:n}=He(),{t:s}=oe();return f.createElement(be,{onClick:e},Va(t,n)?s("Unmute"):s("Mute"))},Edit(){const{handleEdit:e}=te(),{t}=oe();return f.createElement(be,{onClick:e},t("Edit Message"))},Delete(){const{handleDelete:e}=te(),{t}=oe();return f.createElement(be,{onClick:e},t("Delete"))},RemindMe(){const{isMyMessage:e}=te();return f.createElement(Xc,{className:qr,isMine:e()})},SaveForLater(){const{client:e}=He(),{message:t}=te(),{t:n}=oe(),s=Wa(t.id);return f.createElement(be,{onClick:()=>s?e.reminders.deleteReminder(s.id):e.reminders.createReminder({messageId:t.id})},n(s?"Remove reminder":"Save for later"))}},quick:{React(){return f.createElement(ul,{ReactionIcon:Qc})},Reply(){const{handleOpenThread:e}=te(),{t}=oe();return f.createElement("button",{"aria-label":t("aria/Open Thread"),className:"str-chat__message-reply-in-thread-button","data-testid":"thread-action",onClick:e},f.createElement(el,{className:"str-chat__message-action-icon"}))}}},pl=[{Component:he.quick.Reply,placement:"quick",type:"reply"},{Component:he.quick.React,placement:"quick",type:"react"},{Component:he.dropdown.Delete,placement:"dropdown",type:"delete"},{Component:he.dropdown.Edit,placement:"dropdown",type:"edit"},{Component:he.dropdown.Mute,placement:"dropdown",type:"mute"},{Component:he.dropdown.Flag,placement:"dropdown",type:"flag"},{Component:he.dropdown.Pin,placement:"dropdown",type:"pin"},{Component:he.dropdown.Quote,placement:"dropdown",type:"quote"},{Component:he.dropdown.MarkUnread,placement:"dropdown",type:"markUnread"},{Component:he.dropdown.RemindMe,placement:"dropdown",type:"remindMe"},{Component:he.dropdown.SaveForLater,placement:"dropdown",type:"saveForLater"}],xl=({disableBaseMessageActionSetFilter:e=!1,messageActionSet:t=pl})=>{const{theme:n}=He(),{isMyMessage:s,message:o}=te(),{t:a}=oe(),[i,c]=f.useState(null),d=hl(t,e),{dropdownActionSet:u,quickActionSet:h}=gl(d),m=`message-actions--${o.id}`,g=`reaction-selector--${o.id}`,{dialog:l,dialogManager:p}=An({id:m}),x=Ke(m,p==null?void 0:p.id),b=Ke(g,p==null?void 0:p.id);return u.length+h.length===0?null:f.createElement("div",{className:$e(`str-chat__message-${n}__actions str-chat__message-options`,{"str-chat__message-options--active":x||b})},u.length>0&&f.createElement(tl,{inline:!1,toggleOpen:l==null?void 0:l.toggle},f.createElement("button",{"aria-expanded":x,"aria-haspopup":"true","aria-label":a("aria/Open Message Actions Menu"),className:"str-chat__message-actions-box-button","data-testid":"message-actions-toggle-button",ref:c},f.createElement(Jc,{className:"str-chat__message-action-icon"})),f.createElement(Gr,{dialogManagerId:p==null?void 0:p.id,id:m,placement:s()?"top-end":"top-start",referenceElement:i,tabIndex:-1,trapFocus:!0},f.createElement(bl,{open:x},u.map(({Component:v,type:w})=>f.createElement(v,{key:w}))))),h.map(({Component:v,type:w})=>f.createElement(v,{key:w})))},bl=({children:e,open:t})=>{const{t:n}=oe();return f.createElement("div",{className:$e("str-chat__message-actions-box",{"str-chat__message-actions-box--open":t})},f.createElement("div",{"aria-label":n("aria/Message Options"),className:"str-chat__message-actions-list",role:"listbox"},e))},vl=()=>{const{handleDelete:e}=B.useMessageContext("CustomMessageActions"),{t}=B.useTranslationContext("CustomMessageActions");return r.jsx(be,{onClick:e,children:t("Delete")})},wl=()=>{const{handleFlag:e}=B.useMessageContext("CustomMessageActions");return r.jsx(be,{onClick:e,children:"Report"})},yl=[{Component:vl,placement:"dropdown",type:"delete"},{Component:wl,placement:"dropdown",type:"flag"}],El=()=>r.jsx(xl,{messageActionSet:yl}),Cl=e=>({linkPreviews:Array.from(e.previews.values()).filter(t=>De.LinkPreviewsManager.previewIsLoaded(t)||De.LinkPreviewsManager.previewIsLoading(t))}),_l=({link:e,onDismiss:t})=>{const{og_scrape_url:n,title:s,image_url:o}=e,a=i=>{i.preventDefault(),t(n)};return r.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"relative w-full block rounded-[24px] bg-[#121110] p-2 no-underline transition-opacity hover:opacity-90",children:[o&&r.jsx("img",{src:o,alt:s||"",className:"h-[148px] w-full rounded-[20px] object-cover"}),r.jsx("button",{type:"button",onClick:a,className:"absolute right-4 top-4 flex size-6 items-center justify-center rounded-full border border-white/40 bg-white/70 backdrop-blur-2xl focus-ring","aria-label":"Close link preview",children:r.jsx(P.XIcon,{className:"size-4 text-black/90"})}),r.jsxs("div",{className:"p-2",children:[s&&r.jsx("div",{className:"text-[14px] font-medium leading-5 text-white",children:s}),r.jsx("div",{className:"text-[12px] leading-4 text-white/55",children:n})]})]})},Nl=()=>{const{linkPreviewsManager:e}=B.useMessageComposer(),{linkPreviews:t}=B.useStateStore(e.state,Cl),n=o=>{e.dismissPreview(o)};return t.length>0?r.jsx("div",{className:"flex flex-col items-center w-full gap-2 mb-4",children:t.map(o=>r.jsx(_l,{link:o,onDismiss:n},o.og_scrape_url))}):null},jl=({sendMessage:e,disabled:t,...n})=>r.jsx("button",{...n,type:"button","aria-label":"Send",disabled:t,onClick:e,children:r.jsx(P.ArrowUpIcon,{weight:"bold",className:"size-4"})}),Sl=()=>{var c;const{channel:e}=B.useChannelStateContext(),t=((c=e==null?void 0:e.data)==null?void 0:c.frozen)===!0,{handleSubmit:n}=B.useMessageInputContext(),{SendButton:s}=B.useComponentContext("CustomMessageInput"),o=s??jl,a=B.useMessageComposerHasSendableData(),i=t||!a;return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"left-container",children:r.jsx(B.SimpleAttachmentSelector,{})}),r.jsxs("div",{className:"central-container min-w-0 w-full p-2 bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]",children:[r.jsx(B.QuotedMessagePreview,{}),r.jsx(Nl,{}),r.jsx(B.AttachmentPreviewList,{}),r.jsxs("div",{className:"flex",children:[r.jsx("div",{className:"w-full ml-2 mr-4 self-center leading-[0]",children:r.jsx(B.TextareaComposer,{"aria-disabled":t||void 0,className:"w-full resize-none outline-none leading-6",maxRows:4,readOnly:t,tabIndex:t?-1:void 0})}),r.jsx(o,{sendMessage:n,"aria-label":"Send",className:"str-chat__send-button mt-auto flex justify-center items-center flex-shrink-0 rounded-full size-8 bg-[#121110] disabled:bg-[#F1F0EE] disabled:text-black/20 text-white focus-ring","data-testid":"send-button",disabled:i,type:"button"})]})]})]})},kl=({renderActions:e})=>{var s;const{channel:t}=B.useChannelStateContext(),n=((s=t==null?void 0:t.data)==null?void 0:s.frozen)===!0;return r.jsxs("div",{inert:n?"":void 0,"aria-disabled":n||void 0,className:"message-input flex items-center gap-2 p-4 aria-disabled:opacity-40",children:[e==null?void 0:e(),r.jsx(B.MessageInput,{Input:Sl})]})},$l=["SYSTEM_DM_AGENT_PAUSED","SYSTEM_DM_AGENT_RESUMED"],Ml={SYSTEM_DM_AGENT_PAUSED:"DM Agent has left the conversation",SYSTEM_DM_AGENT_RESUMED:"DM Agent has rejoined the conversation"},Rl=["SYSTEM_AGE_SAFETY_BLOCKED"],Tl={SYSTEM_AGE_SAFETY_BLOCKED:"This user isn’t able to reply because they don’t meet our age safety guidelines."},an="age safety guidelines.",Il="https://linktr.ee/s/about/contact",Ys=e=>$l.includes(e),Ll=e=>Rl.includes(e),Dl=e=>{var s;const t=(s=e.metadata)==null?void 0:s.custom_type;if(Ys(t))return{kind:"dm-agent",type:t};if(Ll(t))return{kind:"age-safety",type:t};const n=e.dm_agent_system_type;if(Ys(n))return{kind:"dm-agent",type:n}},Al=e=>{const t=e.indexOf(an);if(t===-1)return e;const n=t+an.length;return r.jsxs(r.Fragment,{children:[e.slice(0,t),r.jsx("a",{href:Il,target:"_blank",rel:"noopener noreferrer",className:"mes-age-safety-system-message__emphasis font-medium text-inherit underline",children:an}),e.slice(n)]})},Ol=e=>{var s,o;const t=e.message.hide_date===!0,n=Dl(e.message);if((n==null?void 0:n.kind)==="dm-agent"){const a=((s=e.message.text)==null?void 0:s.trim())||Ml[n.type];return r.jsxs("div",{className:"str-chat__message--system","data-testid":"message-system",children:[r.jsxs("div",{className:"mes-dm-agent-system-message mx-auto mb-2 inline-flex w-fit max-w-[min(100%,480px)] items-center justify-center gap-[10px] rounded-[12px] border border-[rgba(0,0,0,0.08)] p-3 text-[rgba(0,0,0,0.55)]","data-testid":"dm-agent-system-message","data-dm-agent-system-type":n.type,children:[r.jsx(P.SparkleIcon,{size:16,weight:"regular","aria-hidden":!0,className:"mes-dm-agent-system-message__sparkle shrink-0"}),r.jsx("p",{className:"mes-dm-agent-system-message__text m-0 text-center text-[14px] font-normal leading-5 tracking-[0.21px]",children:a})]}),!t&&r.jsx(B.MessageTimestamp,{message:e.message})]})}if((n==null?void 0:n.kind)==="age-safety"){const a=((o=e.message.text)==null?void 0:o.trim())||Tl[n.type];return r.jsxs("div",{className:"str-chat__message--system","data-testid":"message-system",children:[r.jsxs("div",{className:"mes-age-safety-system-message box-border mx-auto mb-2 flex w-full max-w-[329px] items-start justify-center gap-3 rounded-[12px] border border-[var(--border-secondary,rgba(0,0,0,0.08))] bg-[var(--bg-warning-subtle,#fef3c6)] px-2 py-4 pl-5 text-[color:var(--text-warning-on-warning,#894b00)]","data-testid":"age-safety-system-message","data-age-safety-system-type":n.type,children:[r.jsx(P.ProhibitIcon,{size:24,weight:"duotone","aria-hidden":!0,className:"mes-age-safety-system-message__icon shrink-0 text-[color:var(--text-warning-on-warning,#894b00)]","data-testid":"age-safety-system-message-icon"}),r.jsx("div",{className:"mes-age-safety-system-message__content min-w-0 flex-[1_0_0]",children:r.jsx("p",{className:"m-0 text-balance text-left text-[12px] font-normal leading-4 tracking-[0.21px] text-[color:var(--text-warning-on-warning,#894b00)]",children:Al(a)})})]}),!t&&r.jsx(B.MessageTimestamp,{message:e.message})]})}return r.jsxs("div",{className:"str-chat__message--system","data-testid":"message-system",children:[r.jsxs("div",{className:"str-chat__message--system__text",children:[r.jsx("div",{className:"str-chat__message--system__line"}),r.jsx("p",{children:e.message.text}),r.jsx("div",{className:"str-chat__message--system__line"})]}),!t&&r.jsx(B.MessageTimestamp,{message:e.message})]})},Kr=f.createContext(!1),cn=({cx:e,index:t})=>r.jsx("circle",{cx:e,cy:"4",r:"3.9",fill:"#A0A0A0",children:r.jsx("animateTransform",{attributeName:"transform",type:"translate",values:"0 0; 0 -2.25; 0 0;",dur:"900ms",begin:`${120*t}ms`,repeatCount:"indefinite"})}),Fl=new Set([B.AIStates.Thinking,B.AIStates.Generating,B.AIStates.ExternalSources]),Pl=({threadList:e})=>{var p,x;const{channel:t,channelConfig:n,thread:s}=B.useChannelStateContext(),{client:o}=B.useChatContext(),{typing:a={}}=B.useTypingContext(),{aiState:i}=B.useAIState(t),c=f.useContext(Kr);if(!e&&c&&Fl.has(i)){const b=zl(t,(p=o.user)==null?void 0:p.id);return r.jsx(Gs,{avatarId:(b==null?void 0:b.id)??"ai-agent",avatarName:(b==null?void 0:b.name)??(b==null?void 0:b.id)??"Agent",avatarImage:b==null?void 0:b.image,testId:"typing-indicator-ai"})}if((n==null?void 0:n.typing_events)===!1)return null;const u=e?[]:Object.values(a).filter(({parent_id:b,user:v})=>{var w;return(v==null?void 0:v.id)!==((w=o.user)==null?void 0:w.id)&&!b}),h=e?Object.values(a).filter(({parent_id:b,user:v})=>{var w;return(v==null?void 0:v.id)!==((w=o.user)==null?void 0:w.id)&&b===(s==null?void 0:s.id)}):[],m=e?h:u;if(!m.length)return null;const g=(x=m[0])==null?void 0:x.user,l=g!=null&&g.id&&t.state.members[g.id]?t.state.members[g.id].user:void 0;return r.jsx(Gs,{avatarId:(g==null?void 0:g.id)??(l==null?void 0:l.id)??"typing-user",avatarName:(g==null?void 0:g.name)??(l==null?void 0:l.name)??(g==null?void 0:g.id)??"Typing user",avatarImage:(g==null?void 0:g.image)??(l==null?void 0:l.image),testId:"typing-indicator"})},Gs=({avatarId:e,avatarName:t,avatarImage:n,testId:s})=>r.jsxs("div",{className:"str-chat__typing-indicator !items-end !bg-transparent","data-testid":s,style:{insetInlineStart:0,insetInlineEnd:"auto"},children:[r.jsx("div",{className:"shrink-0","aria-hidden":"true",children:r.jsx(ke,{id:e,name:t,image:n??void 0,size:24,shape:"circle"})}),r.jsx("div",{className:"px-4 py-3 rounded-lg bg-[#E9EAED] h-12 flex flex-col justify-end",children:r.jsxs("svg",{"aria-hidden":"true",className:"block overflow-visible mb-[0.2rem]",viewBox:"0 0 32 8",width:"32",height:"8",overflow:"visible",children:[r.jsx(cn,{cx:"4",index:0}),r.jsx(cn,{cx:"16",index:1}),r.jsx(cn,{cx:"28",index:2})]})})]});function zl(e,t){var s;const n=((s=e==null?void 0:e.state)==null?void 0:s.members)??{};for(const o of Object.values(n)){const a=o==null?void 0:o.user;if(a&&a.id!==t)return a}}const Xr=()=>null,Bl=({className:e,message:t})=>r.jsxs("div",{className:V("flex items-center justify-center h-full",e),children:[r.jsxs("svg",{viewBox:"0 0 100 100",className:"size-8 fill-pebble",stroke:"none",children:[r.jsx("circle",{cx:"6",cy:"50",r:"6",children:r.jsx("animateTransform",{attributeName:"transform",dur:"1s",type:"translate",values:"0 15 ; 0 -15; 0 15",repeatCount:"indefinite",begin:"0.1"})}),r.jsx("circle",{cx:"30",cy:"50",r:"6",children:r.jsx("animateTransform",{attributeName:"transform",dur:"1s",type:"translate",values:"0 10 ; 0 -10; 0 10",repeatCount:"indefinite",begin:"0.2"})}),r.jsx("circle",{cx:"54",cy:"50",r:"6",children:r.jsx("animateTransform",{attributeName:"transform",dur:"1s",type:"translate",values:"0 5 ; 0 -5; 0 5",repeatCount:"indefinite",begin:"0.3"})})]}),t&&r.jsx("span",{className:"text-stone",children:t})]}),Ot=f.memo(()=>r.jsx("div",{className:"messaging-loading-state flex items-center justify-center h-full",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx(Bl,{className:"w-6 h-6"}),r.jsx("span",{className:"text-sm text-stone",children:"Loading messages"})]})}));Ot.displayName="LoadingState";const Ge="size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-center justify-center transition-colors duration-150 focus-ring",qs="Replies instantly with AI assistant",Vl=({onBack:e,showBackButton:t,onShowInfo:n,canShowInfo:s,showStarButton:o=!1,dmAgentEnabled:a=!1,getParticipantDisplayName:i})=>{var l,p,x,b,v;const{channel:c}=B.useChannelStateContext(),d=f.useMemo(()=>{var j,T;const w=(j=c._client)==null?void 0:j.userID;return w?Object.values(((T=c.state)==null?void 0:T.members)||{}).find(S=>{var L;return((L=S.user)==null?void 0:L.id)&&S.user.id!==w}):void 0},[(l=c._client)==null?void 0:l.userID,(p=c.state)==null?void 0:p.members]),u=i(d),h=(x=d==null?void 0:d.user)==null?void 0:x.image,m=tr(c),g=async()=>{try{m?await c.unpin():await c.pin()}catch(w){console.error("[CustomChannelHeader] Failed to update pinned status:",w)}};return r.jsxs("div",{className:"@container",children:[r.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] w-full items-center @lg:hidden",children:[r.jsx("div",{className:"flex items-center gap-2",children:t&&r.jsx("button",{className:Ge,onClick:e||(()=>{}),type:"button","aria-label":"Back to conversations",children:r.jsx(P.ArrowLeftIcon,{className:"size-5 text-black/90"})})}),r.jsxs("div",{className:"flex flex-col gap-1 items-center",children:[r.jsx(ke,{id:((b=d==null?void 0:d.user)==null?void 0:b.id)||c.id||"unknown",name:u,image:h,starred:o&&m,dmAgentEnabled:a,size:40}),r.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-0.5 rounded-full bg-black/[0.05] px-3 py-1 text-xs font-medium text-black/90 hover:bg-black/[0.08] transition-colors","aria-label":`View info for ${u}`,children:[u,r.jsx(P.CaretRightIcon,{className:"size-3 shrink-0"})]}),a&&r.jsxs("div",{className:"flex items-center gap-1 text-[10px] leading-3 text-black/55",children:[r.jsx(P.SparkleIcon,{className:"size-3 shrink-0 text-black/55"}),r.jsx("span",{children:qs})]})]}),r.jsxs("div",{className:"flex justify-end items-center gap-2",children:[o&&r.jsx("button",{className:Ge,onClick:g,type:"button","aria-label":m?"Unstar conversation":"Star conversation",children:r.jsx(P.StarIcon,{className:V("size-5",{"text-yellow-600":m,"text-black/90":!m}),weight:m?"duotone":"regular"})}),r.jsx("button",{className:Ge,onClick:n,type:"button","aria-label":"Show info",children:r.jsx(P.DotsThreeIcon,{className:"size-5 text-black/90"})})]})]}),r.jsxs("div",{className:"hidden @lg:flex items-center justify-between gap-3 min-h-12",children:[r.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[t&&e&&r.jsx("button",{type:"button",onClick:e,className:Ge,"aria-label":"Back to conversations",children:r.jsx(P.ArrowLeftIcon,{className:"size-5 text-black/90"})}),r.jsx(ke,{id:((v=d==null?void 0:d.user)==null?void 0:v.id)||c.id||"unknown",name:u,image:h,starred:o&&m,dmAgentEnabled:a,size:40}),r.jsxs("div",{className:"min-w-0",children:[s?r.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1 font-medium text-black/90 truncate hover:text-black/70 transition-colors","aria-label":`View info for ${u}`,children:[r.jsx("span",{className:"truncate",children:u}),r.jsx(P.CaretRightIcon,{className:"size-4 shrink-0"})]}):r.jsx("h1",{className:"font-medium text-black/90 truncate",children:u}),a&&r.jsxs("div",{className:"mt-0.5 flex items-center gap-1 text-[10px] leading-3 text-black/55",children:[r.jsx(P.SparkleIcon,{className:"size-3 shrink-0 text-black/55"}),r.jsx("span",{className:"truncate",children:qs})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[o&&r.jsx("button",{className:Ge,onClick:g,type:"button","aria-label":m?"Unstar conversation":"Star conversation",children:r.jsx(P.StarIcon,{className:V("size-5",{"text-yellow-600":m,"text-black/90":!m}),weight:m?"duotone":"regular"})}),s&&n&&r.jsx("button",{className:Ge,onClick:n,type:"button","aria-label":"Show info",children:r.jsx(P.DotsThreeIcon,{className:"size-5 text-black/90"})})]})]})]})},Ul=({onBack:e,showBackButton:t,renderMessageInputActions:n,renderConversationFooter:s,onLeaveConversation:o,onBlockParticipant:a,showDeleteConversation:i=!0,onDeleteConversationClick:c,onBlockParticipantClick:d,onReportParticipantClick:u,showStarButton:h=!1,chatbotVotingEnabled:m=!1,renderChannelBanner:g,customProfileContent:l,customChannelActions:p,renderMessage:x,dmAgentEnabled:b=!1,viewerLanguage:v,getParticipantDisplayName:w})=>{var A,M,_,k,y,$;const{channel:C}=B.useChannelStateContext(),j=f.useRef(null),T=f.useMemo(()=>{var N,O;const E=(N=C._client)==null?void 0:N.userID;return E?Object.values(((O=C.state)==null?void 0:O.members)||{}).find(H=>{var G;return((G=H.user)==null?void 0:G.id)&&H.user.id!==E}):void 0},[(A=C._client)==null?void 0:A.userID,(M=C.state)==null?void 0:M.members]),S=f.useMemo(()=>{var N,O;const E=(N=C._client)==null?void 0:N.userID;return E?Object.values(((O=C.state)==null?void 0:O.members)||{}).find(H=>{var G;return((G=H.user)==null?void 0:G.id)===E}):void 0},[(_=C._client)==null?void 0:_.userID,(k=C.state)==null?void 0:k.members]),L=((y=S==null?void 0:S.user)==null?void 0:y.is_account)??(S==null?void 0:S.is_account),F=(($=T==null?void 0:T.user)==null?void 0:$.is_account)??(T==null?void 0:T.is_account),z=b&&L===!1&&F===!0,I=f.useMemo(()=>{const E=C.data??{};if(E.followerStatus)return String(E.followerStatus);if(E.isFollower!==void 0)return E.isFollower?"Subscribed to you":"Not subscribed"},[C.data]),R=f.useCallback(()=>{var E;(E=j.current)==null||E.showModal()},[]),U=f.useCallback(()=>{var E;(E=j.current)==null||E.close()},[]),W=f.useCallback(E=>{const{message:D}=B.useMessageContext("ChannelView"),N=r.jsx(ua,{...E,chatbotVotingEnabled:m,viewerLanguage:v});return!x||!D?N:x(N,D)},[m,x,v]);return r.jsxs(r.Fragment,{children:[r.jsx(B.WithComponents,{overrides:{Message:W,MessageActions:El},children:r.jsxs(B.Window,{children:[r.jsx("div",{className:"p-4",children:r.jsx(Vl,{onBack:e,showBackButton:t,onShowInfo:R,canShowInfo:!!T,showStarButton:h,dmAgentEnabled:z,getParticipantDisplayName:w})},"lt-channel-header"),g?r.jsx(f.Fragment,{children:g()},"lt-channel-banner"):null,r.jsx("div",{className:"flex-1 overflow-hidden relative",children:r.jsx(B.MessageList,{hideDeletedMessages:!0,hideNewMessageSeparator:!1})},"lt-channel-message-list"),s?r.jsx(f.Fragment,{children:s(C)},"lt-channel-conversation-footer"):null,r.jsx(kl,{renderActions:()=>n==null?void 0:n(C)},"lt-channel-message-input")]})}),r.jsx(To,{dialogRef:j,onClose:U,participant:T,participantDisplayName:w(T),channel:C,followerStatusLabel:I,onLeaveConversation:o,onBlockParticipant:a,showDeleteConversation:i,onDeleteConversationClick:c,onBlockParticipantClick:d,onReportParticipantClick:u,customProfileContent:l,customChannelActions:p})]})},Gn=f.memo(({channel:e,onBack:t,showBackButton:n=!1,renderMessageInputActions:s,renderConversationFooter:o,onLeaveConversation:a,onBlockParticipant:i,className:c,CustomChannelEmptyState:d=Xr,showDeleteConversation:u=!0,onDeleteConversationClick:h,onBlockParticipantClick:m,onReportParticipantClick:g,dmAgentEnabled:l,messageMetadata:p,onMessageSent:x,showStarButton:b=!1,chatbotVotingEnabled:v=!1,renderChannelBanner:w,customProfileContent:C,customChannelActions:j,renderMessage:T,sendButton:S,viewerLanguage:L,getParticipantDisplayName:F})=>{const z=f.useCallback(R=>(F==null?void 0:F(R))??zt(R==null?void 0:R.user),[F]),I=f.useCallback(async(R,U,W)=>{var $;const A=(($=e.data)==null?void 0:$.chatbot_paused)===!0,M=l&&!A,_={...U,...M&&{silent:!0},...p&&{metadata:{...U.metadata??{},...p}}},k={...W,...M&&{skip_push:!0}},y=await e.sendMessage(_,k);return x==null||x(y),y},[e,l,p,x]);return r.jsx("div",{className:V("messaging-channel-view h-full flex flex-col",c),children:r.jsx(Kr.Provider,{value:l??!1,children:r.jsx(B.Channel,{channel:e,MessageSystem:Ol,EmptyStateIndicator:d,LoadingIndicator:Ot,DateSeparator:Io,TypingIndicator:Pl,doSendMessageRequest:I,...S?{SendButton:S}:{},children:r.jsx(Ul,{onBack:t,showBackButton:n,renderMessageInputActions:s,renderConversationFooter:o,onLeaveConversation:a,onBlockParticipant:i,CustomChannelEmptyState:d,showDeleteConversation:u,onDeleteConversationClick:h,onBlockParticipantClick:m,onReportParticipantClick:g,showStarButton:b,dmAgentEnabled:l,chatbotVotingEnabled:v,renderChannelBanner:w,customProfileContent:C,customChannelActions:j,renderMessage:T,viewerLanguage:L,getParticipantDisplayName:z})})})})});Gn.displayName="ChannelView";const Hl=({className:e})=>r.jsxs("svg",{width:"140",height:"120",viewBox:"44 -2 144 126",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[r.jsxs("g",{clipPath:"url(#clip0_empty_state)",children:[r.jsx("path",{d:"M123.68 82.1932C123.383 103.675 105.839 121 84.2417 121C77.4724 121 71.0986 119.297 65.5327 116.299L52.5873 119.687L53.8036 106.673C48.1776 99.8701 44.7994 91.1453 44.7994 81.6356C44.7994 59.8965 62.4554 42.2754 84.2374 42.2754C89.1328 42.2754 93.8175 43.1633 98.1413 44.789",fill:"#D7D4CE"}),r.jsx("path",{d:"M84.2458 86.0364C82.2851 86.0364 80.6957 84.4501 80.6957 82.4933C80.6957 80.5365 82.2851 78.9502 84.2458 78.9502C86.2065 78.9502 87.7959 80.5365 87.7959 82.4933C87.7959 84.4501 86.2065 86.0364 84.2458 86.0364Z",fill:"white"}),r.jsx("path",{d:"M68.3044 86.0364C66.3437 86.0364 64.7543 84.4501 64.7543 82.4933C64.7543 80.5365 66.3437 78.9502 68.3044 78.9502C70.2651 78.9502 71.8545 80.5365 71.8545 82.4933C71.8545 84.4501 70.2651 86.0364 68.3044 86.0364Z",fill:"white"}),r.jsx("path",{d:"M100.183 86.0364C98.2226 86.0364 96.6332 84.4501 96.6332 82.4933C96.6332 80.5365 98.2226 78.9502 100.183 78.9502C102.144 78.9502 103.733 80.5365 103.733 82.4933C103.733 84.4501 102.144 86.0364 100.183 86.0364Z",fill:"white"}),r.jsxs("g",{filter:"url(#filter0_empty_state)",children:[r.jsx("path",{d:"M171.522 68.7154C177.443 61.4539 181 52.1488 181 42C181 18.8027 162.421 0 139.5 0C116.579 0 98 18.8027 98 42C98 65.1973 116.579 84 139.5 84C146.622 84 153.328 82.1857 159.184 78.9829L172.801 82.5993L171.522 68.7154Z",fill:"white"}),r.jsx("path",{d:"M171.522 68.7154C177.443 61.4539 181 52.1488 181 42C181 18.8027 162.421 0 139.5 0C116.579 0 98 18.8027 98 42C98 65.1973 116.579 84 139.5 84C146.622 84 153.328 82.1857 159.184 78.9829L172.801 82.5993L171.522 68.7154Z",stroke:"#D7D4CE",strokeWidth:"2",strokeMiterlimit:"10"})]}),r.jsx("path",{d:"M139.502 45.5431C137.541 45.5431 135.952 43.9568 135.952 42C135.952 40.0432 137.541 38.4569 139.502 38.4569C141.462 38.4569 143.052 40.0432 143.052 42C143.052 43.9568 141.462 45.5431 139.502 45.5431Z",fill:"#D7D4CE"}),r.jsx("path",{d:"M123.561 45.5431C121.601 45.5431 120.011 43.9568 120.011 42C120.011 40.0432 121.601 38.4569 123.561 38.4569C125.522 38.4569 127.111 40.0432 127.111 42C127.111 43.9568 125.522 45.5431 123.561 45.5431Z",fill:"#D7D4CE"}),r.jsx("path",{d:"M155.439 45.5431C153.478 45.5431 151.889 43.9568 151.889 42C151.889 40.0432 153.478 38.4569 155.439 38.4569C157.4 38.4569 158.989 40.0432 158.989 42C158.989 43.9568 157.4 45.5431 155.439 45.5431Z",fill:"#D7D4CE"})]}),r.jsxs("defs",{children:[r.jsxs("filter",{id:"filter0_empty_state",x:"97",y:"-1",width:"89",height:"90",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[r.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),r.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),r.jsx("feOffset",{dx:"4",dy:"4"}),r.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),r.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.8428 0 0 0 0 0.830064 0 0 0 0 0.8095 0 0 0 1 0"}),r.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow"}),r.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow",result:"shape"})]}),r.jsx("clipPath",{id:"clip0_empty_state",children:r.jsx("rect",{width:"233",height:"233",fill:"white"})})]})]}),Zr=f.memo(({hasChannels:e,channelsLoaded:t})=>r.jsx("div",{className:"messaging-empty-state flex items-center justify-center h-full p-8 text-balance",children:r.jsxs("div",{className:"flex flex-col items-center max-w-sm text-center",children:[r.jsx(Hl,{}),t&&!e&&r.jsxs("div",{className:"mt-8",children:[r.jsx("h2",{className:"font-medium text-black text-[18px] mb-2",children:"Your inbox is empty"}),r.jsx("p",{className:"text-[#676B5F] text-sm mb-6",children:"Share with your followers to start receiving messages"})]})]})}));Zr.displayName="EmptyState";const St=f.memo(({message:e,onBack:t})=>r.jsx("div",{className:"messaging-error-state flex items-center justify-center h-full p-8",children:r.jsxs("div",{className:"text-center max-w-sm",children:[r.jsx("div",{className:"w-24 h-24 bg-danger-alt/20 rounded-full flex items-center justify-center mx-auto mb-6",children:r.jsx("span",{className:"text-4xl",children:"⚠️"})}),r.jsx("h2",{className:"font-semibold text-charcoal mb-2",children:"Oops!"}),r.jsx("p",{className:"text-stone text-sm mb-6",children:e}),t&&r.jsx("button",{type:"button",onClick:t,className:"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-[#7f22fe] hover:bg-primary-alt rounded-lg transition-colors focus-ring",children:"Go Back"})]})}));St.displayName="ErrorState";const Wl=({capabilities:e={},className:t,renderMessageInputActions:n,renderConversationFooter:s,onChannelSelect:o,initialParticipantFilter:a,initialParticipantData:i,CustomChannelEmptyState:c,showChannelList:d=!0,filters:u,channelRenderFilterFn:h,channelListCustomEmptyStateIndicator:m,onDeleteConversationClick:g,onBlockParticipantClick:l,onReportParticipantClick:p,dmAgentEnabled:x,messageMetadata:b,onMessageSent:v,showStarButton:w=!1,chatbotVotingEnabled:C=!1,viewerLanguage:j,renderMessagePreview:T,renderChannelBanner:S,customProfileContent:L,customChannelActions:F,renderMessage:z,sendButton:I})=>{const{service:R,client:U,isConnected:W,isLoading:A,error:M,refreshConnection:_,debug:k}=Qs(),[y,$]=f.useState(null),[E,D]=f.useState(!1),[N,O]=f.useState(!1),[H,G]=f.useState(!1),[re,X]=f.useState(null),{showDeleteConversation:me=!0}=e,le=f.useMemo(()=>{const Z=U==null?void 0:U.userID;return{...{type:"messaging",last_message_at:{$exists:!0},...Z&&{members:{$in:[Z]},hidden:!1}},...u}},[u,U==null?void 0:U.userID]),K=f.useRef(null),Q=f.useCallback(async()=>{if(!U||!W)return;const Z=U.userID;if(Z)try{k&&console.log("[MessagingShell] Syncing channels for user:",Z);const se=await U.queryChannels({type:"messaging",members:{$in:[Z]}},{},{limit:100});D(se.length>0),O(!0),K.current=Z,k&&console.log("[MessagingShell] Channels synced successfully:",{channelCount:se.length})}catch(se){console.error("[MessagingShell] Failed to sync channels:",se)}},[U,W,k]);f.useEffect(()=>{if(!U||!W)return;const Z=U.userID;Z&&K.current!==Z&&Q()},[U,W,Q]),f.useEffect(()=>{if(!a||!U||!W)return;(async()=>{const se=U.userID;if(se)try{k&&console.log("[MessagingShell] Loading initial conversation with:",a);const _e=await U.queryChannels({type:"messaging",members:{$eq:[se,a]}},{},{limit:1});if(_e.length>0)$(_e[0]),G(!0),X(null),o&&o(_e[0]),k&&console.log("[MessagingShell] Initial conversation loaded:",_e[0].id);else if(i&&R){k&&console.log("[MessagingShell] No conversation found, creating one for:",i);try{const Ne=await R.startChannelWithParticipant({id:i.id,name:i.name,phone:i.phone});$(Ne),G(!0),X(null),o&&o(Ne),k&&console.log("[MessagingShell] Channel created and loaded:",Ne.id)}catch(Ne){console.error("[MessagingShell] Failed to create conversation:",Ne),X("Failed to create conversation")}}else X("No conversation found with this account"),k&&console.log("[MessagingShell] No conversation found for:",a)}catch(_e){console.error("[MessagingShell] Failed to load initial conversation:",_e),X("Failed to load conversation")}})()},[a,i,U,W,R,k,o]);const xe=f.useCallback(Z=>{$(Z),o==null||o(Z)},[o]),ae=f.useCallback(()=>{H||$(null)},[H]),Fe=f.useCallback(async Z=>{k&&console.log("[MessagingShell] Leaving conversation:",Z.id),$(null),G(!1),K.current=null,await Q()},[Q,k]),Zt=f.useCallback(async Z=>{k&&console.log("[MessagingShell] Blocking participant:",Z),$(null),G(!1),K.current=null,await Q()},[Q,k]),Pe=!!y;return A?r.jsx("div",{className:V("h-full",t),children:r.jsx(Ot,{})}):M?r.jsx("div",{className:V("h-full",t),children:r.jsx(St,{message:M,onBack:_})}):!W||!U?r.jsx("div",{className:V("h-full",t),children:r.jsx(St,{message:"Not connected to messaging service",onBack:_})}):re?r.jsx("div",{className:V("h-full",t),children:r.jsx(St,{message:re})}):r.jsx("div",{className:V("messaging-shell h-full bg-background-primary overflow-hidden",t),children:r.jsxs("div",{className:"flex h-full min-h-0",children:[r.jsx("div",{className:V("messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",{"!hidden":d===!1||H,"hidden lg:flex lg:flex-1 lg:max-w-2xl":d!==!1&&!H&&Pe,"flex flex-col w-full lg:flex-1 lg:max-w-2xl":d!==!1&&!H&&!Pe}),children:r.jsx(Sn,{onChannelSelect:xe,selectedChannel:y||void 0,filters:le,channelRenderFilterFn:h,customEmptyStateIndicator:m,renderMessagePreview:T,viewerLanguage:j})}),r.jsx("div",{className:V("messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",{flex:H||Pe||a,"hidden lg:flex":!H&&!Pe&&!a}),children:y?r.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:r.jsx(Gn,{channel:y,onBack:ae,showBackButton:!H,renderMessageInputActions:n,renderConversationFooter:s,renderChannelBanner:S,onLeaveConversation:Fe,onBlockParticipant:Zt,CustomChannelEmptyState:c,showDeleteConversation:me,onDeleteConversationClick:g,onBlockParticipantClick:l,onReportParticipantClick:p,dmAgentEnabled:x,messageMetadata:b,onMessageSent:v,showStarButton:w,chatbotVotingEnabled:C,viewerLanguage:j,customProfileContent:L,customChannelActions:F,renderMessage:z,sendButton:I},y.id)}):a?r.jsx(Ot,{}):r.jsx(Zr,{hasChannels:E,channelsLoaded:N})})]})})},Yl=/^([a-z][a-z0-9+.-]*):/i,Gl=new Set(["http","https","mailto","tel","sms"]);function Jr(e){if(typeof e!="string")return;const t=e.trim();if(t==="")return;const n=Yl.exec(t);if(n){const s=n[1].toLowerCase();return Gl.has(s)?t:void 0}return t.startsWith("//")||t.startsWith("/")?t:`https://${t}`}const ql={dark:"bg-white text-[#121110] hover:bg-white/90",light:"bg-[#121110] text-white hover:bg-[#2a2928]"},Kl=({variant:e,cta:t})=>{const n=V("mt-2 inline-flex h-10 w-full items-center justify-center rounded-full px-4 text-sm font-medium leading-none transition-colors",ql[e]),s=Jr(t.href);return s?r.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",onClick:o=>{var a;o.stopPropagation(),(a=t.onClick)==null||a.call(t)},className:`${n} no-underline`,children:t.label}):r.jsx("button",{type:"button",onClick:o=>{var a;o.stopPropagation(),(a=t.onClick)==null||a.call(t)},className:n,children:t.label})},Xl={dark:"text-white",light:"text-black/90"},Zl="text-white/30",Jl={dark:"text-white/55",light:"text-black/55"},qn=({variant:e,title:t,placeholderTitle:n,description:s,url:o,appIcon:a,cta:i,trailingAction:c})=>{const d=e==="dark",u=t??(d?n:void 0)??"",h=u.trim()!=="",m=s!=null&&s.trim()!=="",g=typeof o=="string"?o.trim():"",l=g!=="",p=i!=null;if(!h&&!m&&!l&&!p)return null;const b=V("truncate text-base font-medium leading-6",d&&!t?Zl:Xl[e]),v=V("truncate text-xs leading-4",Jl[e]);return r.jsxs("div",{className:"px-4 py-3",children:[r.jsxs("div",{className:"flex items-end gap-3",children:[r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[r.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[h&&r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a?r.jsx("span",{className:"shrink-0",children:a}):null,r.jsx("p",{className:V("min-w-0",b),children:u})]}),m&&r.jsx("p",{className:v,children:s})]}),!p&&l&&r.jsx("p",{className:v,children:g})]}),c&&r.jsx("div",{className:"shrink-0",children:c})]}),i&&r.jsx(Kl,{variant:e,cta:i})]})},Ql=V("relative block w-[280px] select-none overflow-hidden rounded-md","border border-black/[0.08]","shadow-[0_1px_2px_rgba(0,0,0,0.04),0_8px_32px_rgba(0,0,0,0.1)]"),Ft=({variant:e,children:t,href:n,onClick:s,ariaLabel:o,rootRef:a,topRight:i,bgClassName:c,"data-testid":d})=>{const u=n!=null||s!=null,h=V(Ql,c??(e==="dark"?"bg-[#121110]":"bg-white"),u?"cursor-pointer no-underline focus-ring":null),m=i?r.jsx("div",{className:"pointer-events-auto absolute right-3 top-3 z-10",children:i}):null;return n?r.jsxs("a",{ref:a,href:n,target:"_blank",rel:"noopener noreferrer",onClick:s,"data-testid":d,className:h,children:[t,m]}):s?r.jsxs("button",{ref:a,type:"button",onClick:s,"aria-label":o,"data-testid":d,className:V(h,"text-left"),children:[t,m]}):r.jsxs("div",{ref:a,"data-testid":d,className:h,children:[t,m]})},eu={dark:"bg-white/10",light:"bg-black/5"},tu={dark:"size-16 text-white/25",light:"size-16 text-black/25"},Kt=(e,t)=>!!t&&!!e&&Re(e)==="audio",nu=(e,t)=>{if(!t||!e)return!1;const n=Re(e);return n==="video"||n==="audio"},Kn="bg-[#F2F3F4]",Pt=({variant:e,thumbnailUrl:t,sourceUrl:n,title:s,mimeType:o="image/*",topLeft:a,topRight:i})=>{const c=Re(o),d=!!n&&c==="video";return Kt(o,n)?r.jsx("div",{className:"p-3",children:r.jsx("audio",{src:n,controls:!0,preload:"metadata",className:"block w-full",children:r.jsx("track",{kind:"captions"})})}):r.jsxs("div",{className:V("relative h-[180px] w-full overflow-hidden",d&&"bg-black"),children:[d?r.jsx("video",{src:n,poster:t,controls:!0,playsInline:!0,preload:"metadata",className:"absolute inset-0 h-full w-full object-contain",children:r.jsx("track",{kind:"captions"})}):t?r.jsx("img",{src:t,alt:s??"",draggable:!1,className:"absolute inset-0 h-full w-full object-cover"}):r.jsx("div",{className:V("flex h-full w-full items-center justify-center",eu[e]),children:Ue(o,{className:tu[e],weight:"regular"})}),a?r.jsx("div",{className:"pointer-events-auto absolute left-3 top-3 z-10",children:a}):null,i?r.jsx("div",{className:"pointer-events-auto absolute right-3 top-3 z-10",children:i}):null]})},su=({title:e,placeholderTitle:t,description:n,url:s,mimeType:o,thumbnailUrl:a,sourceUrl:i,layout:c="featured",appIcon:d,cta:u,onDismiss:h,onEditClick:m})=>{const g=c==="classic",l=Kt(o,i),p=h?r.jsx("button",{type:"button",onClick:h,"aria-label":"Dismiss attachment",className:"flex size-6 items-center justify-center rounded-full bg-[#121110] text-white",children:r.jsx(P.XIcon,{className:"size-3",weight:"bold"})}):void 0,x=m?r.jsx("button",{type:"button",onClick:m,"aria-label":"Edit attachment",className:"flex size-10 items-center justify-center rounded-full bg-white/10 text-white hover:bg-white/15",children:r.jsx(P.PencilSimpleIcon,{className:"size-5",weight:"regular"})}):void 0;return l?r.jsx(Ft,{variant:"dark",bgClassName:Kn,children:r.jsxs("div",{className:"flex items-center gap-2 pr-3",children:[r.jsx("div",{className:"min-w-0 flex-1",children:r.jsx(Pt,{variant:"dark",sourceUrl:i,title:e,mimeType:o})}),p&&r.jsx("div",{className:"shrink-0",children:p})]})}):r.jsxs(Ft,{variant:"dark",topRight:g?p:void 0,children:[!g&&r.jsx(Pt,{variant:"dark",thumbnailUrl:a,sourceUrl:i,title:e,mimeType:o,topRight:p}),r.jsx(qn,{variant:"dark",title:e,placeholderTitle:t,description:n,url:s,appIcon:d,cta:u,trailingAction:x})]})},ru=({title:e,description:t,url:n,mimeType:s,thumbnailUrl:o,sourceUrl:a,layout:i="featured",appIcon:c,cta:d,onClick:u})=>{const h=nu(s,a),m=Jr(n),g=d==null&&m!=null&&!h?m:void 0,l=d==null&&!h?u:void 0,p=Kt(s,a)?Kn:void 0,x=d&&u?{...d,onClick:()=>{var b;u(),(b=d.onClick)==null||b.call(d)}}:d;return r.jsxs(Ft,{variant:"light",href:g,onClick:l,ariaLabel:e??"Open attachment preview",bgClassName:p,"data-testid":"link-attachment",children:[i==="featured"&&r.jsx(Pt,{variant:"light",thumbnailUrl:o,sourceUrl:a,title:e,mimeType:s}),r.jsx(qn,{variant:"light",title:e,description:t,url:n,appIcon:c,cta:x})]})},ou=({title:e,placeholderTitle:t,description:n,url:s,mimeType:o,thumbnailUrl:a,sourceUrl:i,layout:c="featured",appIcon:d,cta:u})=>r.jsxs(Ft,{variant:"dark",bgClassName:Kt(o,i)?Kn:void 0,children:[c==="featured"&&r.jsx(Pt,{variant:"dark",thumbnailUrl:a,sourceUrl:i,title:e,mimeType:o}),r.jsx(qn,{variant:"dark",title:e,placeholderTitle:t,description:n,url:s,appIcon:d,cta:u})]}),au={Composer:su,Sent:ou,Received:ru},iu={dark:"bg-[#121110]",light:"bg-[#e9eaed]"},cu={dark:"text-white",light:"text-[#080707]"},lu={dark:"border-white/[0.08]",light:"border-black/[0.08]"},uu=e=>e==="dark"?"sender":"receiver",du={sender:{single:"rounded-tl-[18px] rounded-tr-[18px] rounded-bl-[18px] rounded-br-[18px]",first:"rounded-tl-[18px] rounded-tr-[18px] rounded-bl-[18px] rounded-br-[4px]",middle:"rounded-tl-[18px] rounded-tr-[4px] rounded-bl-[18px] rounded-br-[4px]",end:"rounded-tl-[18px] rounded-tr-[4px] rounded-bl-[18px] rounded-br-[18px]"},receiver:{single:"rounded-tl-[18px] rounded-tr-[18px] rounded-bl-[18px] rounded-br-[18px]",first:"rounded-tl-[18px] rounded-tr-[18px] rounded-bl-[4px] rounded-br-[18px]",middle:"rounded-tl-[4px] rounded-tr-[18px] rounded-bl-[4px] rounded-br-[18px]",end:"rounded-tl-[4px] rounded-tr-[18px] rounded-bl-[18px] rounded-br-[18px]"}},mt=({variant:e,text:t,bordered:n=!0,groupPosition:s="single",className:o,children:a,"data-testid":i})=>{const c=t!=null&&t!=="",d=du[uu(e)][s];return r.jsxs("div",{"data-testid":i,"data-group-position":s,className:V("relative w-[280px] overflow-hidden px-2 py-2",d,iu[e],cu[e],n&&"border",n&&lu[e],o),children:[a,c?r.jsx("p",{className:V("whitespace-pre-wrap break-words leading-snug","pt-2","px-2"),children:t}):null]})},ht=({onClick:e,variant:t="overlay",ariaLabel:n="Dismiss attachment"})=>r.jsx("button",{type:"button",onClick:s=>{s.stopPropagation(),e()},"aria-label":n,className:V("flex size-6 items-center justify-center rounded-full text-white",t==="overlay"?"bg-[#121110]/85 backdrop-blur":"bg-white/15 hover:bg-white/25"),children:r.jsx(P.XIcon,{className:"size-3",weight:"bold"})}),gt=e=>e==="received"?"light":"dark",fu=({firstOfGroup:e,endOfGroup:t,groupedByUser:n})=>!n||e&&t?"single":e?"first":t?"end":"middle",mu=({src:e,mimeType:t,filename:n,items:s})=>s&&s.length>0?s:e?[{src:e,mimeType:t,filename:n}]:[],hu=({item:e,preload:t,trailingAction:n})=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("audio",{src:e.src,controls:!0,preload:e.preload??t,className:"block min-w-0 flex-1",children:e.mimeType?r.jsx("source",{src:e.src,type:e.mimeType}):null}),n??null]}),Xn=({state:e,src:t,mimeType:n,filename:s,items:o,text:a,groupPosition:i,preload:c,onDismiss:d})=>{const u=gt(e),h=e==="composer"&&!!d,m=mu({src:t,mimeType:n,filename:s,items:o});if(m.length===0)return null;const g=c??(m.length>1?"none":"metadata");return r.jsx(mt,{variant:u,text:a,groupPosition:i,"data-testid":"audio-attachment",children:r.jsx("div",{className:"flex flex-col gap-2",children:m.map((l,p)=>r.jsx(hu,{item:l,preload:g,trailingAction:h&&p===0?r.jsx(ht,{onClick:d,variant:"inline"}):void 0},`${l.src}-${p}`))})})},gu=e=>r.jsx(Xn,{...e,state:"composer"}),pu=e=>r.jsx(Xn,{...e,state:"sent"}),xu=e=>r.jsx(Xn,{...e,state:"received"}),bu={Composer:gu,Sent:pu,Received:xu};function Qr(e){return!Number.isFinite(e)||e<0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(2)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}const vu={pdf:"PDF",doc:"DOC",xls:"XLS",csv:"CSV",ppt:"PPT",zip:"ZIP",text:"TXT",markdown:"MD"};function eo(e,t){if(t){const o=t.lastIndexOf(".");if(o>0&&o<t.length-1){const a=t.slice(o+1);if(a&&a.length<=5)return a.toUpperCase()}}if(!e)return;if(Re(e)==="document"){const o=ur(e),a=vu[o];if(a)return a;if(e==="application/octet-stream")return}const s=e.split("/")[1];if(!(!s||s==="*"))return s.toUpperCase()}function to(e,t,n){const s=eo(e,t),o=typeof n=="number"&&n>0?Qr(n):void 0;return[s,o].filter(Boolean).join(" · ")||void 0}function Me(e){try{const n=new URL(e).pathname.split("/").pop();return n&&n.length>0?decodeURIComponent(n):"download"}catch{return"download"}}const wu={dark:"text-white/55",light:"text-black/65"},yu={dark:"bg-white/10",light:"bg-black/5"},Eu={dark:"text-white/85",light:"text-black/85"},no=({variant:e,filename:t,title:n,mimeType:s="application/octet-stream",fileSize:o,onActivate:a,activateLabel:i,trailingAction:c})=>{const d=n??t??"File",u=to(s,t,o),h=r.jsx("div",{className:V("flex size-10 shrink-0 items-center justify-center rounded-sm",yu[e]),"aria-hidden":!0,children:Ue(s,{className:V("size-6",Eu[e]),weight:"regular"})}),m=r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col text-left",children:[r.jsx("p",{className:"truncate font-medium leading-snug",children:d}),u?r.jsx("p",{className:V("truncate text-xs leading-4",wu[e]),children:u}):null]}),g=a?r.jsxs("button",{type:"button",onClick:a,"aria-label":i,className:V("flex min-w-0 flex-1 items-center gap-3 rounded-sm text-left transition-colors",e==="dark"?"hover:bg-white/[0.04]":"hover:bg-black/[0.04]"),children:[h,m]}):r.jsxs(r.Fragment,{children:[h,m]});return r.jsxs("div",{className:"flex items-center gap-3 px-3 py-2",children:[g,c?r.jsx("div",{className:"shrink-0",children:c}):null]})};async function so(e,t){const n=t??Me(e);try{const s=await fetch(e,{mode:"cors"});if(!s.ok)throw new Error(`HTTP ${s.status}`);const o=await s.blob(),a=URL.createObjectURL(o),i=document.createElement("a");i.href=a,i.download=n,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(a)}catch{if(!window.open(e,"_blank","noopener,noreferrer")){const o=document.createElement("a");o.href=e,o.download=n,o.target="_blank",o.rel="noopener noreferrer",o.style.display="none",document.body.appendChild(o),o.click(),document.body.removeChild(o)}}}const Cu=({src:e,filename:t,fileSize:n,mimeType:s,title:o,items:a})=>a&&a.length>0?a:e?[{src:e,filename:t,fileSize:n,mimeType:s,title:o}]:[],_u=({variant:e,item:t,index:n,onActivate:s,trailingAction:o})=>{const a=t.filename??Me(t.src);return r.jsx(no,{variant:e,filename:a,title:t.title,mimeType:t.mimeType??"application/octet-stream",fileSize:t.fileSize,onActivate:()=>s(n),activateLabel:`Download ${a}`,trailingAction:o})},Zn=({state:e,src:t,filename:n,fileSize:s,mimeType:o,title:a,items:i,text:c,groupPosition:d,onClick:u,onDismiss:h})=>{const m=gt(e),g=e==="composer"&&!!h,l=Cu({src:t,filename:n,fileSize:s,mimeType:o,title:a,items:i}),p=b=>{if((u==null?void 0:u(b))===!1)return;const v=l[b];if(!v)return;const w=v.filename??Me(v.src);so(v.src,w)};if(l.length===0)return null;const x=r.jsx("span",{className:V("flex size-8 items-center justify-center rounded-full",m==="dark"?"text-white/70":"text-black/70"),"aria-hidden":!0,children:r.jsx(P.DownloadSimpleIcon,{className:"size-5",weight:"bold"})});return r.jsx(mt,{variant:m,text:c,groupPosition:d,"data-testid":"file-attachment",children:r.jsx("div",{className:"flex flex-col gap-2",children:l.map((b,v)=>{const w=g&&v===0?r.jsx(ht,{onClick:h,variant:"inline"}):x;return r.jsx(_u,{variant:m,item:b,index:v,onActivate:p,trailingAction:w},`${b.src}-${v}`)})})})},Nu=e=>r.jsx(Zn,{...e,state:"composer"}),ju=e=>r.jsx(Zn,{...e,state:"sent"}),Su=e=>r.jsx(Zn,{...e,state:"received"}),ku={Composer:Nu,Sent:ju,Received:Su},Xt=({url:e,filename:t,variant:n="pill",label:s="Download",iconOnly:o,tone:a="dark",onTriggered:i})=>{const[c,d]=f.useState(!1),u=f.useCallback(l=>{l.stopPropagation(),!c&&(d(!0),so(e,t).catch(()=>{}).finally(()=>{d(!1),i==null||i()}))},[c,e,t,i]),h=o??n!=="pill",g={className:V(n==="pill"?"size-4":"size-5","shrink-0"),weight:"bold"};if(n==="inline"){const l={dark:"text-white/70 hover:bg-white/[0.08] hover:text-white",light:"text-black/70 hover:bg-black/[0.08] hover:text-black"};return r.jsx("button",{type:"button",onClick:u,disabled:c,"aria-label":s,className:V("flex size-8 shrink-0 items-center justify-center rounded-full transition-colors disabled:opacity-70",l[a]),children:c?r.jsx(P.CircleNotchIcon,{className:"size-4 animate-spin",weight:"bold","aria-hidden":!0}):r.jsx(P.DownloadSimpleIcon,{className:"size-5 shrink-0",weight:"bold","aria-hidden":!0})})}return n==="pill"?r.jsxs("button",{type:"button",onClick:u,disabled:c,"aria-label":h?s:void 0,className:V("mt-3 inline-flex h-10 w-full items-center justify-center gap-2 rounded-full px-4 text-sm font-medium leading-none transition-colors disabled:opacity-70",a==="dark"?"bg-[#121110] text-white hover:bg-[#2a2928]":"bg-white text-[#121110] hover:bg-white/90"),children:[c?r.jsx(P.CircleNotchIcon,{className:"size-4 animate-spin",weight:"bold","aria-hidden":!0}):r.jsx(P.DownloadSimpleIcon,{...g,"aria-hidden":!0}),h?null:s]}):r.jsx("button",{type:"button",onClick:u,disabled:c,"aria-label":s,className:V("flex size-10 shrink-0 items-center justify-center rounded-full text-white transition-colors disabled:opacity-70",n==="overlay"?"bg-black/55 backdrop-blur hover:bg-black/70":"bg-white/10 hover:bg-white/20"),children:c?r.jsx(P.CircleNotchIcon,{className:"size-5 animate-spin",weight:"bold","aria-hidden":!0}):r.jsx(P.DownloadSimpleIcon,{...g,"aria-hidden":!0})})};let it=0,Cn=null;const $u=()=>{typeof document>"u"||(it===0&&(Cn=document.body.style.overflow,document.body.style.overflow="hidden"),it+=1)},Mu=()=>{typeof document>"u"||it!==0&&(it-=1,it===0&&(document.body.style.overflow=Cn??"",Cn=null))},Jn=({open:e,onClose:t,title:n,actions:s,contentClassName:o,children:a,"data-testid":i})=>{const c=f.useRef(null),d=f.useRef(null);return f.useEffect(()=>{if(!e)return;$u();const u=typeof document<"u"?document.activeElement:null,h=d.current??c.current;h==null||h.focus();const m=g=>{g.key==="Escape"&&(g.preventDefault(),t())};return window.addEventListener("keydown",m),()=>{Mu(),window.removeEventListener("keydown",m),u&&document.body.contains(u)&&u.focus()}},[e,t]),!e||typeof document>"u"?null:_n.createPortal(r.jsxs("div",{ref:c,role:"dialog","aria-modal":"true","aria-label":n??"Attachment viewer","data-testid":i,tabIndex:-1,className:"fixed inset-0 z-[1000] flex flex-col bg-black/90 outline-none",children:[r.jsxs("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-10 flex items-center gap-3 bg-gradient-to-b from-black/70 to-transparent px-4 py-3 text-white",children:[r.jsx("p",{className:"pointer-events-auto min-w-0 flex-1 truncate text-sm font-medium",children:n}),r.jsxs("div",{className:"pointer-events-auto flex shrink-0 items-center gap-2",children:[s,r.jsx("button",{ref:d,type:"button",onClick:t,"aria-label":"Close viewer",className:"flex size-10 items-center justify-center rounded-full bg-white/10 text-white transition-colors hover:bg-white/20",children:r.jsx(P.XIcon,{className:"size-5",weight:"bold","aria-hidden":!0})})]})]}),r.jsx("div",{className:V("relative z-0 flex h-full w-full flex-1 items-center justify-center overflow-hidden",o),children:a})]}),document.body)},ln=1,Ks=8,Et=1.25,un=(e,t,n)=>Math.min(Math.max(e,t),n),st={scale:1,x:0,y:0},ro=({open:e,items:t,initialIndex:n=0,onClose:s})=>{const o=un(n,0,Math.max(t.length-1,0)),[a,i]=f.useState(o),[c,d]=f.useState(st),[u,h]=f.useState(!1),m=f.useRef(null),g=f.useRef(null);f.useEffect(()=>{e&&(i(un(n,0,Math.max(t.length-1,0))),d(st))},[e,n,t.length]),f.useEffect(()=>{d(st)},[a]);const l=f.useCallback(()=>{i(S=>S<=0?t.length-1:S-1)},[t.length]),p=f.useCallback(()=>{i(S=>S>=t.length-1?0:S+1)},[t.length]);f.useEffect(()=>{if(!e)return;const S=L=>{t.length<=1||(L.key==="ArrowRight"?(L.preventDefault(),p()):L.key==="ArrowLeft"&&(L.preventDefault(),l()))};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[e,t.length,l,p]);const x=f.useCallback(S=>{d(L=>{const F=un(L.scale*S,ln,Ks);return F===ln?st:{scale:F,x:L.x,y:L.y}})},[]);f.useEffect(()=>{if(!e)return;const S=g.current;if(!S)return;const L=F=>{F.preventDefault();const z=F.deltaY<0?Et:1/Et;x(z)};return S.addEventListener("wheel",L,{passive:!1}),()=>S.removeEventListener("wheel",L)},[e,x]);const b=f.useCallback(()=>{d(S=>S.scale>1?st:{scale:2,x:S.x,y:S.y})},[]),v=f.useCallback(S=>{c.scale<=1||(S.preventDefault(),h(!0),m.current={x:S.clientX,y:S.clientY,panX:c.x,panY:c.y})},[c.scale,c.x,c.y]);f.useEffect(()=>{if(!u)return;const S=F=>{const z=m.current;z&&d(I=>({scale:I.scale,x:z.panX+(F.clientX-z.x),y:z.panY+(F.clientY-z.y)}))},L=()=>{m.current=null,h(!1)};return window.addEventListener("mousemove",S),window.addEventListener("mouseup",L),()=>{window.removeEventListener("mousemove",S),window.removeEventListener("mouseup",L)}},[u]);const w=t[a],C=f.useMemo(()=>(w==null?void 0:w.filename)??(w?Me(w.src):"image"),[w]),j=f.useMemo(()=>c.scale<=1?"cursor-zoom-in":u?"cursor-grabbing":"cursor-grab",[c.scale,u]);if(!w)return null;const T=t.length>1?` (${a+1} / ${t.length})`:"";return r.jsxs(Jn,{open:e,onClose:s,title:`${C}${T}`,actions:r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",onClick:()=>x(1/Et),disabled:c.scale<=ln,"aria-label":"Zoom out",className:"flex size-10 items-center justify-center rounded-full bg-white/10 text-white transition-colors hover:bg-white/20 disabled:opacity-40",children:r.jsx(P.MagnifyingGlassMinusIcon,{className:"size-5",weight:"bold","aria-hidden":!0})}),r.jsx("button",{type:"button",onClick:()=>x(Et),disabled:c.scale>=Ks,"aria-label":"Zoom in",className:"flex size-10 items-center justify-center rounded-full bg-white/10 text-white transition-colors hover:bg-white/20 disabled:opacity-40",children:r.jsx(P.MagnifyingGlassPlusIcon,{className:"size-5",weight:"bold","aria-hidden":!0})}),r.jsx(Xt,{url:w.src,filename:C,variant:"overlay",label:`Download ${C}`})]}),"data-testid":"image-viewer",children:[r.jsx("div",{ref:g,role:"presentation",onDoubleClick:b,onMouseDown:v,className:V("relative flex h-full w-full select-none items-center justify-center overflow-hidden",j),children:r.jsx("img",{src:w.src,alt:w.alt??C,draggable:!1,loading:"eager",decoding:"async",style:{transform:`translate3d(${c.x}px, ${c.y}px, 0) scale(${c.scale})`,transition:u?"none":"transform 120ms ease-out"},className:"max-h-full max-w-full object-contain"})}),t.length>1?r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",onClick:l,"aria-label":"Previous image",className:"absolute left-4 top-1/2 z-10 flex size-12 -translate-y-1/2 items-center justify-center rounded-full bg-white/10 text-white transition-colors hover:bg-white/20",children:r.jsx(P.CaretLeftIcon,{className:"size-5",weight:"bold","aria-hidden":!0})}),r.jsx("button",{type:"button",onClick:p,"aria-label":"Next image",className:"absolute right-4 top-1/2 z-10 flex size-12 -translate-y-1/2 items-center justify-center rounded-full bg-white/10 text-white transition-colors hover:bg-white/20",children:r.jsx(P.CaretRightIcon,{className:"size-5",weight:"bold","aria-hidden":!0})})]}):null]})},Ru="relative block size-full overflow-hidden bg-black/5 outline-none focus-visible:ring-2 focus-visible:ring-white/80 focus-visible:ring-offset-2 focus-visible:ring-offset-black",oo=({tiles:e,onTileActivate:t,maxVisible:n=4,className:s})=>{const o=e.length;if(o===0)return null;const a=e.slice(0,Math.min(o,n)),i=o-a.length,c=(d,u,h)=>{const m=V(Ru,"h-full w-full");return t?r.jsxs("button",{type:"button",onClick:()=>t(u),"aria-label":d.ariaLabel??`Open media ${u+1}`,className:V(m,"cursor-zoom-in"),children:[d.content,h]},u):r.jsxs("div",{className:m,children:[d.content,h]},u)};return a.length===1?r.jsx("div",{className:V("aspect-square w-full",s),children:c(a[0],0)}):a.length===2?r.jsx("div",{className:V("grid aspect-[16/9] w-full grid-cols-2 gap-0.5",s),children:a.map((d,u)=>c(d,u))}):a.length===3?r.jsxs("div",{className:V("grid aspect-[4/3] w-full grid-cols-2 grid-rows-2 gap-0.5",s),children:[r.jsx("div",{className:"row-span-2",children:c(a[0],0)}),c(a[1],1),c(a[2],2)]}):r.jsx("div",{className:V("grid aspect-[4/3] w-full grid-cols-2 grid-rows-2 gap-0.5",s),children:a.map((d,u)=>{const h=i>0&&u===a.length-1;return c(d,u,h?r.jsxs("div",{className:"absolute inset-0 flex items-center justify-center bg-black/55 text-2xl font-semibold text-white",children:["+",i]}):null)})})},pt=e=>{const[t,n]=f.useState(!1),[s,o]=f.useState(0),a=f.useCallback(c=>{(e==null?void 0:e(c))!==!1&&(o(c),n(!0))},[e]),i=f.useCallback(()=>n(!1),[]);return{viewerOpen:t,viewerIndex:s,handleActivate:a,closeViewer:i}},Tu=(e,t,n,s)=>({ariaLabel:`Open image ${t+1} of ${n}`,content:r.jsx("img",{src:e.src,alt:e.alt??"",width:e.width,height:e.height,draggable:!1,loading:e.loading??s,decoding:"async",className:"absolute inset-0 size-full rounded-md object-cover"})}),Iu=({src:e,alt:t,items:n})=>n&&n.length>0?n:e?[{src:e,alt:t}]:[],ao=(e,t)=>e.map((n,s)=>({src:n.src,alt:n.alt,filename:t&&e.length===1?t:t?`${t} (${s+1})`:void 0})),Lu=({src:e,alt:t,filename:n,loading:s="lazy",onClick:o,onDismiss:a})=>{const{viewerOpen:i,viewerIndex:c,handleActivate:d,closeViewer:u}=pt(o);return r.jsxs("div",{className:"relative w-fit",children:[r.jsx("button",{type:"button",onClick:()=>d(0),"aria-label":"Open image",className:"block size-[280px] cursor-zoom-in overflow-hidden rounded-md outline-none focus-visible:ring-2 focus-visible:ring-black/40",children:r.jsx("img",{src:e,alt:t??"",draggable:!1,loading:s,decoding:"async",className:"size-full object-cover"})}),a?r.jsx("div",{className:"absolute right-2 top-2 z-10",children:r.jsx(ht,{onClick:a})}):null,r.jsx(ro,{open:i,items:ao([{src:e,alt:t}],n),initialIndex:c,onClose:u})]})},io=({state:e,src:t,alt:n,filename:s,items:o,text:a,groupPosition:i,loading:c="lazy",onClick:d})=>{const u=Iu({src:t,alt:n,items:o}),h=gt(e),{viewerOpen:m,viewerIndex:g,handleActivate:l,closeViewer:p}=pt(d);if(u.length===0)return null;const x=u.map((b,v)=>Tu(b,v,u.length,c));return r.jsxs(mt,{variant:h,text:a,groupPosition:i,"data-testid":"image-attachment",children:[r.jsx("div",{className:"relative",children:r.jsx(oo,{tiles:x,onTileActivate:l})}),r.jsx(ro,{open:m,items:ao(u,s),initialIndex:g,onClose:p})]})},Du=e=>r.jsx(Lu,{...e}),Au=e=>r.jsx(io,{...e,state:"sent"}),Ou=e=>r.jsx(io,{...e,state:"received"}),Fu={Composer:Du,Sent:Au,Received:Ou},Pu=({open:e,src:t,filename:n,onClose:s})=>{const o=f.useMemo(()=>n??Me(t),[n,t]),a=f.useMemo(()=>zu(t),[t]);return r.jsx(Jn,{open:e,onClose:s,title:o,actions:r.jsx(Xt,{url:t,filename:o,variant:"overlay",label:`Download ${o}`}),contentClassName:"bg-[#1f1e1d]","data-testid":"pdf-viewer",children:r.jsx("iframe",{src:a,title:o,className:"absolute inset-0 size-full bg-white",sandbox:"allow-scripts allow-forms allow-popups allow-downloads"})})},zu=e=>{const t=e.indexOf("#"),n=t===-1?e:e.slice(0,t),s=t===-1?"":e.slice(t+1),o=new URLSearchParams(s);return o.has("toolbar")||o.set("toolbar","0"),o.has("navpanes")||o.set("navpanes","0"),`${n}#${o.toString()}`},Bu=({src:e,filename:t,fileSize:n,title:s,items:o})=>o&&o.length>0?o:e?[{src:e,filename:t,fileSize:n,title:s}]:[],Vu=({variant:e,item:t,index:n,onActivate:s,trailingAction:o})=>{const a=t.filename??Me(t.src);return r.jsx(no,{variant:e,filename:a,title:t.title,mimeType:"application/pdf",fileSize:t.fileSize,onActivate:()=>s(n),activateLabel:`Open ${a}`,trailingAction:o})},Qn=({state:e,src:t,filename:n,fileSize:s,title:o,items:a,text:i,groupPosition:c,onClick:d,onDismiss:u})=>{const h=gt(e),m=Bu({src:t,filename:n,fileSize:s,title:o,items:a}),{viewerOpen:g,viewerIndex:l,handleActivate:p,closeViewer:x}=pt(d),b=e==="composer"&&!!u;if(m.length===0)return null;const v=Math.min(l,m.length-1),w=m[v],C=w.filename??Me(w.src);return r.jsxs(mt,{variant:h,text:i,groupPosition:c,"data-testid":"pdf-attachment",children:[r.jsx("div",{className:"flex flex-col gap-2",children:m.map((j,T)=>{const S=j.filename??Me(j.src),L=b&&T===0?r.jsx(ht,{onClick:u,variant:"inline"}):e==="composer"?void 0:r.jsx(Xt,{url:j.src,filename:S,variant:"inline",label:`Download ${S}`,tone:h});return r.jsx(Vu,{variant:h,item:j,index:T,onActivate:p,trailingAction:L},`${j.src}-${T}`)})}),r.jsx(Pu,{open:g,src:w.src,filename:C,onClose:x})]})},Uu=e=>r.jsx(Qn,{...e,state:"composer"}),Hu=e=>r.jsx(Qn,{...e,state:"sent"}),Wu=e=>r.jsx(Qn,{...e,state:"received"}),Yu={Composer:Uu,Sent:Hu,Received:Wu},Xs=(e,t,n)=>Math.min(Math.max(e,t),n),co=({open:e,items:t,initialIndex:n=0,onClose:s})=>{const o=Xs(n,0,Math.max(t.length-1,0)),[a,i]=f.useState(o);f.useEffect(()=>{e&&i(Xs(n,0,Math.max(t.length-1,0)))},[e,n,t.length]);const c=f.useCallback(()=>i(g=>g<=0?t.length-1:g-1),[t.length]),d=f.useCallback(()=>i(g=>g>=t.length-1?0:g+1),[t.length]);f.useEffect(()=>{if(!e||t.length<=1)return;const g=l=>{l.key==="ArrowRight"?(l.preventDefault(),d()):l.key==="ArrowLeft"&&(l.preventDefault(),c())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[e,t.length,c,d]);const u=t[a],h=f.useMemo(()=>(u==null?void 0:u.filename)??(u?Me(u.src):"video"),[u]);if(!u)return null;const m=t.length>1?` (${a+1} / ${t.length})`:"";return r.jsxs(Jn,{open:e,onClose:s,title:`${h}${m}`,actions:r.jsx(Xt,{url:u.src,filename:h,variant:"overlay",label:`Download ${h}`}),"data-testid":"video-viewer",children:[r.jsx("div",{className:"flex h-full w-full items-center justify-center px-6 py-16",children:r.jsx("video",{src:u.src,poster:u.poster,controls:!0,autoPlay:!0,muted:!0,playsInline:!0,preload:u.preload??"metadata",className:"max-h-full max-w-full bg-black",children:u.mimeType?r.jsx("source",{src:u.src,type:u.mimeType}):null},`${a}:${u.src}`)}),t.length>1?r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",onClick:c,"aria-label":"Previous video",className:"absolute left-4 top-1/2 z-10 flex size-12 -translate-y-1/2 items-center justify-center rounded-full bg-white/10 text-white transition-colors hover:bg-white/20",children:r.jsx(P.CaretLeftIcon,{className:"size-5",weight:"bold","aria-hidden":!0})}),r.jsx("button",{type:"button",onClick:d,"aria-label":"Next video",className:"absolute right-4 top-1/2 z-10 flex size-12 -translate-y-1/2 items-center justify-center rounded-full bg-white/10 text-white transition-colors hover:bg-white/20",children:r.jsx(P.CaretRightIcon,{className:"size-5",weight:"bold","aria-hidden":!0})})]}):null]})},Gu=()=>r.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:r.jsx("span",{className:"flex size-12 items-center justify-center rounded-full bg-black/55 text-white backdrop-blur",children:r.jsx(P.PlayIcon,{className:"size-6",weight:"fill","aria-hidden":!0})})}),lo=({item:e,index:t})=>r.jsxs("div",{className:"absolute inset-0 size-full bg-[#0d0d0d]",children:[e.poster?r.jsx("img",{src:e.poster,alt:`Video ${t+1} thumbnail`,draggable:!1,loading:"lazy",decoding:"async",className:"absolute inset-0 size-full rounded-md object-cover"}):r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsx(P.VideoCameraIcon,{className:"size-16 rounded-md text-white/30",weight:"regular","aria-hidden":!0})}),r.jsx(Gu,{})]}),qu=(e,t,n)=>({ariaLabel:`Play video ${t+1} of ${n}`,content:r.jsx(lo,{item:e,index:t})}),Ku=({src:e,poster:t,mimeType:n,preload:s,items:o})=>o&&o.length>0?s?o.map(a=>({...a,preload:a.preload??s})):o:e?[{src:e,poster:t,mimeType:n,preload:s}]:[],uo=(e,t)=>e.map((n,s)=>({src:n.src,poster:n.poster,mimeType:n.mimeType,preload:n.preload,filename:t&&e.length===1?t:t?`${t} (${s+1})`:void 0})),Xu=({src:e,poster:t,mimeType:n,filename:s,preload:o,onClick:a,onDismiss:i})=>{const{viewerOpen:c,viewerIndex:d,handleActivate:u,closeViewer:h}=pt(a);return r.jsxs("div",{className:"relative w-fit",children:[r.jsx("button",{type:"button",onClick:()=>u(0),"aria-label":"Play video",className:"relative block size-[280px] cursor-pointer overflow-hidden rounded-md outline-none focus-visible:ring-2 focus-visible:ring-black/40",children:r.jsx(lo,{item:{src:e,poster:t,mimeType:n},index:0})}),i?r.jsx("div",{className:"absolute right-2 top-2 z-10",children:r.jsx(ht,{onClick:i})}):null,r.jsx(co,{open:c,items:uo([{src:e,poster:t,mimeType:n,preload:o}],s),initialIndex:d,onClose:h})]})},fo=({state:e,src:t,poster:n,mimeType:s,filename:o,items:a,text:i,groupPosition:c,preload:d,onClick:u})=>{const h=Ku({src:t,poster:n,mimeType:s,preload:d,items:a}),m=gt(e),{viewerOpen:g,viewerIndex:l,handleActivate:p,closeViewer:x}=pt(u);if(h.length===0)return null;const b=h.map((v,w)=>qu(v,w,h.length));return r.jsxs(mt,{variant:m,text:i,groupPosition:c,"data-testid":"video-attachment",children:[r.jsx("div",{className:"relative",children:r.jsx(oo,{tiles:b,onTileActivate:p,className:"overflow-hidden rounded-md"})}),r.jsx(co,{open:g,items:uo(h,o),initialIndex:l,onClose:x})]})},Zu=e=>r.jsx(Xu,{...e}),Ju=e=>r.jsx(fo,{...e,state:"sent"}),Qu=e=>r.jsx(fo,{...e,state:"received"}),ed={Composer:Zu,Sent:Ju,Received:Qu},td={Image:Fu,Video:ed,Audio:bu,Pdf:Yu,File:ku},mo=({question:e,onClick:t,loading:n=!1,className:s})=>r.jsx("button",{type:"button",onClick:t,disabled:n,style:{backgroundColor:"#E6E5E3"},className:V("w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors focus-ring",{"hover:brightness-95 active:brightness-90":!n,"opacity-50 cursor-not-allowed":n},s),children:e}),nd=({faqs:e,onFaqClick:t,loadingFaqId:n,headerText:s,className:o,avatarImage:a,avatarName:i})=>{const c=e.filter(d=>d.enabled).sort((d,u)=>(d.order??0)-(u.order??0));return c.length===0?null:r.jsx("div",{className:o,children:r.jsxs("div",{className:"flex gap-3 items-end",children:[(a||i)&&r.jsx("div",{className:"flex-none",children:r.jsx(ke,{id:i||"account",name:i||"Account",image:a,size:24,shape:"circle"})}),r.jsxs("div",{className:"flex-1 flex flex-col gap-3 rounded-lg p-4",style:{backgroundColor:"#F1F0EE"},children:[s&&r.jsx("p",{className:"text-md text-charcoal mb-4",children:s}),c.map(d=>r.jsx(mo,{question:d.question,onClick:()=>t(d.id),loading:n===d.id},d.id))]})]})})};exports.ActionButton=rt;exports.AttachmentThumbnail=$n;exports.Avatar=ke;exports.ChannelEmptyState=Xr;exports.ChannelList=Sn;exports.ChannelView=Gn;exports.CustomMessageProvider=ia;exports.FaqList=nd;exports.FaqListItem=mo;exports.LinkAttachment=au;exports.LockedAttachment=mn;exports.MediaMessage=ra;exports.MessageAttachment=td;exports.MessageVoteButtons=xr;exports.MessagingProvider=po;exports.MessagingShell=Wl;exports.bubbleGroupPositionFromStream=fu;exports.buildCompactMetaLabel=to;exports.formatFileSize=Qr;exports.formatRelativeTime=nr;exports.getFileExtensionLabel=eo;exports.getMessageDisplayText=jn;exports.getSourceType=Re;exports.isLinkAttachment=Tn;exports.isUuidLike=rr;exports.normalizeLanguageCode=sr;exports.renderTypeIcon=Ue;exports.resolveLinkAttachment=Bt;exports.resolveMediaFromMessage=Vt;exports.resolveParticipantDisplayName=zt;exports.useCustomMessage=pr;exports.useMessageVote=ir;exports.useMessaging=Qs;
18
- //# sourceMappingURL=index-7sLuX6s4.cjs.map