@linktr.ee/messaging-react 3.3.9-rc-1781245496 → 3.3.9-rc-1781246583

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 (29) hide show
  1. package/dist/{Card-BCm-99bg.cjs → Card-Ch3cTL6G.cjs} +2 -2
  2. package/dist/{Card-BCm-99bg.cjs.map → Card-Ch3cTL6G.cjs.map} +1 -1
  3. package/dist/{Card-cL9lwWhR.cjs → Card-DezN34Sz.cjs} +2 -2
  4. package/dist/{Card-cL9lwWhR.cjs.map → Card-DezN34Sz.cjs.map} +1 -1
  5. package/dist/{Card-BJPVJHv-.cjs → Card-DiSXLhzw.cjs} +2 -2
  6. package/dist/{Card-BJPVJHv-.cjs.map → Card-DiSXLhzw.cjs.map} +1 -1
  7. package/dist/{Card-B7QHTOm5.js → Card-DndbBigk.js} +2 -2
  8. package/dist/{Card-B7QHTOm5.js.map → Card-DndbBigk.js.map} +1 -1
  9. package/dist/{Card-C0jnPxly.js → Card-giUAe8IB.js} +2 -2
  10. package/dist/{Card-C0jnPxly.js.map → Card-giUAe8IB.js.map} +1 -1
  11. package/dist/{Card-CokwQF6h.js → Card-qFB_y7k3.js} +3 -3
  12. package/dist/{Card-CokwQF6h.js.map → Card-qFB_y7k3.js.map} +1 -1
  13. package/dist/{LockedThumbnail-Pum0IO0v.js → LockedThumbnail-C9Y0oCjv.js} +2 -2
  14. package/dist/{LockedThumbnail-Pum0IO0v.js.map → LockedThumbnail-C9Y0oCjv.js.map} +1 -1
  15. package/dist/{LockedThumbnail-B8RE_L4Z.cjs → LockedThumbnail-DkdVuMZM.cjs} +2 -2
  16. package/dist/{LockedThumbnail-B8RE_L4Z.cjs.map → LockedThumbnail-DkdVuMZM.cjs.map} +1 -1
  17. package/dist/index-B_8de68T.cjs +2 -0
  18. package/dist/index-B_8de68T.cjs.map +1 -0
  19. package/dist/{index-BYerDRXA.js → index-DGVCJzwy.js} +6 -6
  20. package/dist/index-DGVCJzwy.js.map +1 -0
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +1 -1
  23. package/package.json +1 -1
  24. package/src/components/CustomLinkPreviewList/CustomLinkPreviewCard.stories.tsx +104 -0
  25. package/src/components/CustomLinkPreviewList/CustomLinkPreviewCard.tsx +3 -3
  26. package/src/components/CustomLinkPreviewList/index.tsx +1 -1
  27. package/dist/index-BYerDRXA.js.map +0 -1
  28. package/dist/index-CR0b7198.cjs +0 -2
  29. package/dist/index-CR0b7198.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"LockedThumbnail-Pum0IO0v.js","sources":["../src/components/LockedAttachment/components/_shared/CardBody.tsx","../src/components/LockedAttachment/components/_shared/GalleryThumbnail.tsx","../src/components/LockedAttachment/components/_shared/LockedCardShell.tsx","../src/components/LockedAttachment/components/_shared/LockBadge.tsx","../src/components/LockedAttachment/components/_shared/LockedThumbnail.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport React from 'react'\n\nimport { renderTypeIcon } from '../../../AttachmentCard'\n\nimport type { LockedCardVariant } from './LockedCardShell'\n\nexport interface CardBodyProps {\n variant: LockedCardVariant\n title?: string\n placeholderTitle?: string\n mimeType: string\n detail?: string\n statusBadge?: React.ReactNode\n action?: React.ReactNode\n /** Overrides the auto-detected type icon (used by Gallery to swap in an `Images` icon). */\n icon?: React.ReactNode\n /** Optional control rendered on the right of the title/status block (e.g. Composer edit pencil). */\n trailingAction?: React.ReactNode\n}\n\n/**\n * Title + status row layout shared by Composer / Sent / Received cards.\n * Layout matches the Figma `Container > Labels` group (16px h-padding, 12px v-padding,\n * 4px gap between title and status row, 4px gap inside status row).\n */\nconst CardBody: React.FC<CardBodyProps> = ({\n variant,\n title,\n placeholderTitle = 'Attachment title',\n mimeType,\n detail,\n statusBadge,\n action,\n icon,\n trailingAction,\n}) => {\n const isDark = variant === 'dark'\n const displayTitle = isDark ? (title ?? placeholderTitle) : (title ?? '')\n const titleDimmed = isDark && !title\n\n const typeIcon =\n icon ??\n renderTypeIcon(mimeType, {\n className: classNames(\n 'size-5 shrink-0',\n isDark ? 'text-white/55' : 'text-black/55'\n ),\n weight: 'regular',\n })\n\n return (\n <div className=\"px-4 py-3\">\n <div className=\"flex items-end gap-3\">\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n {displayTitle.trim() !== '' && (\n <p\n className={classNames('truncate text-base font-medium leading-6', {\n 'text-black/90': !isDark,\n 'text-white/30': isDark && titleDimmed,\n 'text-white': isDark && !titleDimmed,\n })}\n >\n {displayTitle}\n </p>\n )}\n\n <div className=\"flex flex-wrap items-center gap-1\">\n {typeIcon}\n\n {detail != null && detail !== '' && (\n <span\n className={classNames(\n 'text-xs font-medium',\n isDark ? 'text-white/55' : 'text-black/55'\n )}\n >\n {detail}\n </span>\n )}\n\n {statusBadge}\n </div>\n </div>\n\n {trailingAction && <div className=\"shrink-0\">{trailingAction}</div>}\n </div>\n\n {action}\n </div>\n )\n}\n\nexport default CardBody\n","import {\n CaretLeftIcon,\n CaretRightIcon,\n LockOpenIcon,\n LockSimpleIcon,\n PlayIcon,\n} from '@phosphor-icons/react'\nimport classNames from 'classnames'\nimport React, { useState } from 'react'\n\nimport { AttachmentThumbnail, getSourceType } from '../../../AttachmentCard'\nimport type {\n LockedAttachmentGalleryItem,\n PaymentStatus,\n} from '../../types'\n\nimport type { LockedCardVariant } from './LockedCardShell'\n\nexport interface GalleryThumbnailProps {\n variant: LockedCardVariant\n gallery: LockedAttachmentGalleryItem[]\n title?: string\n /** When true, all items are shown blurred + the locked/play badge is overlaid. */\n showLocked: boolean\n paymentStatus?: PaymentStatus\n /** Top-right slot (e.g. dismiss X on Composer). Rendered inside the thumbnail. */\n topRight?: React.ReactNode\n}\n\nfunction isPlayableItem(item: LockedAttachmentGalleryItem): boolean {\n const sourceType = getSourceType(item.mimeType)\n return sourceType === 'video' || sourceType === 'audio'\n}\n\n/**\n * Mixed-media carousel used by every LockedAttachment card when its `gallery`\n * prop has 2+ items. Matches the \"Gallery\" frames in the Figma design system:\n * 337/386 aspect ratio, prev/next caret buttons, a counter pill, and a center\n * lock / play indicator that swaps based on the current item.\n */\nconst GalleryThumbnail: React.FC<GalleryThumbnailProps> = ({\n variant,\n gallery,\n title,\n showLocked,\n paymentStatus,\n topRight,\n}) => {\n const [index, setIndex] = useState(0)\n const total = gallery.length\n const safeIndex = Math.min(index, total - 1)\n const current = gallery[safeIndex]\n const isVideoItem = isPlayableItem(current)\n\n // Center badge: PLAY for video items, LOCK for non-video locked items.\n // Unlocked image items show no center badge — the image is the content.\n const centerBadge = (() => {\n if (isVideoItem) {\n return <PlayIcon className=\"size-6\" weight=\"fill\" />\n }\n if (showLocked) {\n return paymentStatus === 'paid' ? (\n <LockOpenIcon className=\"size-6\" weight=\"fill\" />\n ) : (\n <LockSimpleIcon className=\"size-6\" weight=\"fill\" />\n )\n }\n return null\n })()\n\n // Stop propagation so arrow taps don't bubble up to the outer preview-toggle\n // wrapper on ComposerCard / SentCard.\n const goPrev = (e: React.MouseEvent) => {\n e.stopPropagation()\n setIndex((i) => Math.max(0, i - 1))\n }\n const goNext = (e: React.MouseEvent) => {\n e.stopPropagation()\n setIndex((i) => Math.min(total - 1, i + 1))\n }\n const atStart = safeIndex === 0\n const atEnd = safeIndex === total - 1\n\n const isDark = variant === 'dark'\n\n // Locked + unlocked render entirely separate trees so the locked state\n // doesn't end up stacking a blurred `<img>` on top of an underlying\n // `AttachmentThumbnail` (whose `bg-white/10` poster shell otherwise\n // shows through as a visible horizontal seam at the 16:9 boundary\n // inside the taller 337/386 gallery aspect).\n //\n // The locked branch uses `filter: blur` on a single full-size `<img>`\n // — not `backdrop-filter` — so the rounded corners are clipped\n // normally without any clip-path workarounds (see LockedThumbnail).\n return (\n <div className=\"relative aspect-[337/386] overflow-hidden rounded-t-md\">\n {showLocked ? (\n <div\n className={classNames(\n 'absolute inset-0',\n isDark ? 'bg-white/10' : 'bg-black/5'\n )}\n >\n {current.thumbnailUrl && (\n <img\n src={current.thumbnailUrl}\n alt=\"\"\n aria-hidden\n draggable={false}\n // `scale-110` hides the fuzzy edge that `filter: blur` leaves\n // around the image bounds.\n className=\"absolute inset-0 h-full w-full scale-110 object-cover blur-[40px]\"\n />\n )}\n </div>\n ) : (\n <AttachmentThumbnail\n mimeType={current.mimeType}\n sourceUrl={current.sourceUrl}\n thumbnailUrl={current.thumbnailUrl}\n title={title}\n variant={variant}\n />\n )}\n\n {centerBadge && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div className=\"flex size-12 items-center justify-center rounded-full bg-black/25 text-white\">\n {centerBadge}\n </div>\n </div>\n )}\n\n {total > 1 && (\n <React.Fragment>\n <button\n type=\"button\"\n onClick={goPrev}\n disabled={atStart}\n aria-label=\"Previous item\"\n className={classNames(\n 'absolute left-3 top-1/2 -translate-y-1/2 flex size-7 items-center justify-center rounded-full bg-black/30 text-white transition-opacity',\n atStart ? 'opacity-40' : 'hover:bg-black/40'\n )}\n >\n <CaretLeftIcon className=\"size-5\" weight=\"bold\" />\n </button>\n <button\n type=\"button\"\n onClick={goNext}\n disabled={atEnd}\n aria-label=\"Next item\"\n className={classNames(\n 'absolute right-3 top-1/2 -translate-y-1/2 flex size-7 items-center justify-center rounded-full bg-black/30 text-white transition-opacity',\n atEnd ? 'opacity-40' : 'hover:bg-black/40'\n )}\n >\n <CaretRightIcon className=\"size-5\" weight=\"bold\" />\n </button>\n\n <div className=\"pointer-events-none absolute bottom-5 left-1/2 -translate-x-1/2 rounded-lg bg-black/30 px-2 py-1\">\n <span className=\"text-xs font-medium leading-4 text-white\">\n {safeIndex + 1}/{total}\n </span>\n </div>\n </React.Fragment>\n )}\n\n {topRight && (\n <div className=\"pointer-events-auto absolute right-3 top-3 z-10\">\n {topRight}\n </div>\n )}\n </div>\n )\n}\n\nexport default GalleryThumbnail\n","import classNames from 'classnames'\nimport React from 'react'\n\nexport type LockedCardVariant = 'dark' | 'light'\n\nexport interface LockedCardShellProps {\n variant: LockedCardVariant\n children: React.ReactNode\n rootRef?: React.Ref<HTMLDivElement>\n 'data-testid'?: string\n}\n\n/**\n * Outer chrome for every LockedAttachment card.\n * Mirrors the `shadow-400` + 16px radius treatment from the Figma design system.\n */\nconst LockedCardShell: React.FC<LockedCardShellProps> = ({\n variant,\n children,\n rootRef,\n 'data-testid': dataTestId,\n}) => (\n <div\n ref={rootRef}\n data-testid={dataTestId}\n className={classNames(\n 'relative w-[280px] select-none overflow-hidden rounded-md',\n '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)]',\n variant === 'dark' ? 'bg-[#121110]' : 'bg-white'\n )}\n >\n {children}\n </div>\n)\n\nexport default LockedCardShell\n","import {\n LockOpenIcon,\n LockSimpleIcon,\n PlayIcon,\n} from '@phosphor-icons/react'\nimport React from 'react'\n\nimport { getSourceType } from '../../../AttachmentCard'\nimport type { PaymentStatus } from '../../types'\n\n/**\n * Centered 48x48 lock badge that overlays the thumbnail of any locked attachment.\n * Uses `bg-black/25` from the design system's `alpha-black-25` token.\n *\n * For playable media (video/audio), the badge shows a play icon instead of a\n * lock — matching the convention used by `GalleryThumbnail`.\n */\nexport const LockBadge: React.FC<{\n paymentStatus?: PaymentStatus\n mimeType?: string\n}> = ({ paymentStatus, mimeType }) => {\n const sourceType = mimeType ? getSourceType(mimeType) : undefined\n const isPlayable = sourceType === 'video' || sourceType === 'audio'\n\n const Icon = isPlayable\n ? PlayIcon\n : paymentStatus === 'paid'\n ? LockOpenIcon\n : LockSimpleIcon\n return (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div className=\"flex size-12 items-center justify-center rounded-full bg-black/25 text-white\">\n <Icon className=\"size-6\" weight=\"fill\" />\n </div>\n </div>\n )\n}\n\nexport default LockBadge\n","import classNames from 'classnames'\nimport React from 'react'\n\nimport {\n AttachmentThumbnail,\n renderTypeIcon,\n} from '../../../AttachmentCard'\nimport type { LockedAttachmentSource, PaymentStatus } from '../../types'\n\nimport { LockBadge } from './LockBadge'\nimport type { LockedCardVariant } from './LockedCardShell'\n\nexport interface LockedThumbnailProps {\n variant: LockedCardVariant\n mimeType: string\n thumbnailUrl?: string\n title?: string\n /**\n * When provided, the underlying source is shown unblurred (preview / unlocked state).\n * When undefined, the thumbnail is treated as locked: blurred with a central lock badge.\n */\n source?: LockedAttachmentSource\n /**\n * Forces the locked appearance even when a source is provided. Used for the\n * Composer card where the locked treatment is the default and the user toggles\n * a preview in place.\n */\n showLocked: boolean\n paymentStatus?: PaymentStatus\n /** Top-right overlay (e.g. dismiss X on Composer). Rendered inside the thumbnail. */\n topRight?: React.ReactNode\n /** When true, renders the unlocked image with aspect-video + object-contain. */\n containedImage?: boolean\n}\n\n/**\n * Renders the 180px-tall media area for a LockedAttachment card.\n * Handles three visual states:\n * - locked: blurred thumbnail + centered 48px lock badge\n * - preview/paid: clear thumbnail (the underlying source)\n * - empty: type-icon placeholder\n */\nconst LockedThumbnail: React.FC<LockedThumbnailProps> = ({\n variant,\n mimeType,\n thumbnailUrl,\n title,\n source,\n showLocked,\n paymentStatus,\n topRight,\n containedImage = false,\n}) => {\n const effectiveSourceUrl = showLocked ? undefined : source?.sourceUrl\n const effectiveThumbnailUrl = showLocked\n ? thumbnailUrl\n : (source?.thumbnailUrl ?? thumbnailUrl)\n\n const isDark = variant === 'dark'\n\n // Locked + unlocked render entirely separate trees so the locked state\n // doesn't end up stacking a blurred `<img>` on top of an underlying\n // `AttachmentThumbnail` (whose `bg-white/10` poster shell otherwise\n // shows through as a visible horizontal seam at the 16:9 boundary).\n //\n // The locked branch uses `filter: blur` on a single full-size `<img>`\n // — not `backdrop-filter` — because `backdrop-filter` paints in its\n // own compositing layer that escapes ancestor `overflow: hidden` on\n // Chrome/Safari and flattens the card's top corners. `filter` is\n // clipped normally, so the rounded corners stay round without any\n // clip-path workarounds.\n return (\n <div className=\"relative overflow-hidden rounded-t-md\">\n {showLocked ? (\n <div\n className={classNames(\n 'relative aspect-video overflow-hidden',\n isDark ? 'bg-white/10' : 'bg-black/5'\n )}\n >\n {effectiveThumbnailUrl ? (\n <img\n src={effectiveThumbnailUrl}\n alt=\"\"\n aria-hidden\n draggable={false}\n // `scale-110` hides the fuzzy semi-transparent edge that\n // `filter: blur` leaves around the image bounds.\n className=\"absolute inset-0 h-full w-full scale-110 object-cover blur-[40px]\"\n />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n {renderTypeIcon(mimeType, {\n className: isDark\n ? 'size-12 text-white/20'\n : 'size-12 text-black/20',\n weight: 'regular',\n })}\n </div>\n )}\n <LockBadge paymentStatus={paymentStatus} mimeType={mimeType} />\n </div>\n ) : (\n <AttachmentThumbnail\n mimeType={mimeType}\n sourceUrl={effectiveSourceUrl}\n thumbnailUrl={effectiveThumbnailUrl}\n title={title}\n variant={variant}\n containedImage={containedImage}\n mediaPlayerProps={\n effectiveSourceUrl\n ? { autoPlay: true, loop: true, controls: true, muted: false }\n : undefined\n }\n />\n )}\n\n {topRight && (\n <div className=\"pointer-events-auto absolute right-3 top-3 z-10\">\n {topRight}\n </div>\n )}\n </div>\n )\n}\n\nexport default LockedThumbnail\n"],"names":["CardBody","variant","title","placeholderTitle","mimeType","detail","statusBadge","action","icon","trailingAction","isDark","displayTitle","titleDimmed","typeIcon","renderTypeIcon","classNames","jsxs","jsx","isPlayableItem","item","sourceType","getSourceType","GalleryThumbnail","gallery","showLocked","paymentStatus","topRight","index","setIndex","useState","total","safeIndex","current","isVideoItem","centerBadge","PlayIcon","LockOpenIcon","LockSimpleIcon","goPrev","e","i","goNext","atStart","atEnd","AttachmentThumbnail","React","CaretLeftIcon","CaretRightIcon","LockedCardShell","children","rootRef","dataTestId","LockBadge","LockedThumbnail","thumbnailUrl","source","containedImage","effectiveSourceUrl","effectiveThumbnailUrl"],"mappings":";;;;;AA0BA,MAAMA,IAAoC,CAAC;AAAA,EACzC,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,kBAAAC,IAAmB;AAAA,EACnB,UAA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AAgB;AAAA,QAAA;AAAA,QAG1B,UAAA;AAAA,UAAAgD,IACC,gBAAAzC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,KAAKyC;AAAA,cACL,KAAI;AAAA,cACJ,eAAW;AAAA,cACX,WAAW;AAAA,cAGX,WAAU;AAAA,YAAA;AAAA,UAAA,IAGZ,gBAAAzC,EAAC,OAAA,EAAI,WAAU,qDACZ,YAAeb,GAAU;AAAA,YACxB,WAAWM,IACP,0BACA;AAAA,YACJ,QAAQ;AAAA,UAAA,CACT,GACH;AAAA,UAEF,gBAAAO,EAACmC,GAAA,EAAU,eAAA3B,GAA8B,UAAArB,EAAA,CAAoB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,IAG/D,gBAAAa;AAAA,MAAC2B;AAAA,MAAA;AAAA,QACC,UAAAxC;AAAA,QACA,WAAWqD;AAAA,QACX,cAAcC;AAAA,QACd,OAAAxD;AAAA,QACA,SAAAD;AAAA,QACA,gBAAAuD;AAAA,QACA,kBACEC,IACI,EAAE,UAAU,IAAM,MAAM,IAAM,UAAU,IAAM,OAAO,GAAA,IACrD;AAAA,MAAA;AAAA,IAAA;AAAA,IAKT/B,KACC,gBAAAT,EAAC,OAAA,EAAI,WAAU,mDACZ,UAAAS,EAAA,CACH;AAAA,EAAA,GAEJ;AAEJ;"}
1
+ {"version":3,"file":"LockedThumbnail-C9Y0oCjv.js","sources":["../src/components/LockedAttachment/components/_shared/CardBody.tsx","../src/components/LockedAttachment/components/_shared/GalleryThumbnail.tsx","../src/components/LockedAttachment/components/_shared/LockedCardShell.tsx","../src/components/LockedAttachment/components/_shared/LockBadge.tsx","../src/components/LockedAttachment/components/_shared/LockedThumbnail.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport React from 'react'\n\nimport { renderTypeIcon } from '../../../AttachmentCard'\n\nimport type { LockedCardVariant } from './LockedCardShell'\n\nexport interface CardBodyProps {\n variant: LockedCardVariant\n title?: string\n placeholderTitle?: string\n mimeType: string\n detail?: string\n statusBadge?: React.ReactNode\n action?: React.ReactNode\n /** Overrides the auto-detected type icon (used by Gallery to swap in an `Images` icon). */\n icon?: React.ReactNode\n /** Optional control rendered on the right of the title/status block (e.g. Composer edit pencil). */\n trailingAction?: React.ReactNode\n}\n\n/**\n * Title + status row layout shared by Composer / Sent / Received cards.\n * Layout matches the Figma `Container > Labels` group (16px h-padding, 12px v-padding,\n * 4px gap between title and status row, 4px gap inside status row).\n */\nconst CardBody: React.FC<CardBodyProps> = ({\n variant,\n title,\n placeholderTitle = 'Attachment title',\n mimeType,\n detail,\n statusBadge,\n action,\n icon,\n trailingAction,\n}) => {\n const isDark = variant === 'dark'\n const displayTitle = isDark ? (title ?? placeholderTitle) : (title ?? '')\n const titleDimmed = isDark && !title\n\n const typeIcon =\n icon ??\n renderTypeIcon(mimeType, {\n className: classNames(\n 'size-5 shrink-0',\n isDark ? 'text-white/55' : 'text-black/55'\n ),\n weight: 'regular',\n })\n\n return (\n <div className=\"px-4 py-3\">\n <div className=\"flex items-end gap-3\">\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n {displayTitle.trim() !== '' && (\n <p\n className={classNames('truncate text-base font-medium leading-6', {\n 'text-black/90': !isDark,\n 'text-white/30': isDark && titleDimmed,\n 'text-white': isDark && !titleDimmed,\n })}\n >\n {displayTitle}\n </p>\n )}\n\n <div className=\"flex flex-wrap items-center gap-1\">\n {typeIcon}\n\n {detail != null && detail !== '' && (\n <span\n className={classNames(\n 'text-xs font-medium',\n isDark ? 'text-white/55' : 'text-black/55'\n )}\n >\n {detail}\n </span>\n )}\n\n {statusBadge}\n </div>\n </div>\n\n {trailingAction && <div className=\"shrink-0\">{trailingAction}</div>}\n </div>\n\n {action}\n </div>\n )\n}\n\nexport default CardBody\n","import {\n CaretLeftIcon,\n CaretRightIcon,\n LockOpenIcon,\n LockSimpleIcon,\n PlayIcon,\n} from '@phosphor-icons/react'\nimport classNames from 'classnames'\nimport React, { useState } from 'react'\n\nimport { AttachmentThumbnail, getSourceType } from '../../../AttachmentCard'\nimport type {\n LockedAttachmentGalleryItem,\n PaymentStatus,\n} from '../../types'\n\nimport type { LockedCardVariant } from './LockedCardShell'\n\nexport interface GalleryThumbnailProps {\n variant: LockedCardVariant\n gallery: LockedAttachmentGalleryItem[]\n title?: string\n /** When true, all items are shown blurred + the locked/play badge is overlaid. */\n showLocked: boolean\n paymentStatus?: PaymentStatus\n /** Top-right slot (e.g. dismiss X on Composer). Rendered inside the thumbnail. */\n topRight?: React.ReactNode\n}\n\nfunction isPlayableItem(item: LockedAttachmentGalleryItem): boolean {\n const sourceType = getSourceType(item.mimeType)\n return sourceType === 'video' || sourceType === 'audio'\n}\n\n/**\n * Mixed-media carousel used by every LockedAttachment card when its `gallery`\n * prop has 2+ items. Matches the \"Gallery\" frames in the Figma design system:\n * 337/386 aspect ratio, prev/next caret buttons, a counter pill, and a center\n * lock / play indicator that swaps based on the current item.\n */\nconst GalleryThumbnail: React.FC<GalleryThumbnailProps> = ({\n variant,\n gallery,\n title,\n showLocked,\n paymentStatus,\n topRight,\n}) => {\n const [index, setIndex] = useState(0)\n const total = gallery.length\n const safeIndex = Math.min(index, total - 1)\n const current = gallery[safeIndex]\n const isVideoItem = isPlayableItem(current)\n\n // Center badge: PLAY for video items, LOCK for non-video locked items.\n // Unlocked image items show no center badge — the image is the content.\n const centerBadge = (() => {\n if (isVideoItem) {\n return <PlayIcon className=\"size-6\" weight=\"fill\" />\n }\n if (showLocked) {\n return paymentStatus === 'paid' ? (\n <LockOpenIcon className=\"size-6\" weight=\"fill\" />\n ) : (\n <LockSimpleIcon className=\"size-6\" weight=\"fill\" />\n )\n }\n return null\n })()\n\n // Stop propagation so arrow taps don't bubble up to the outer preview-toggle\n // wrapper on ComposerCard / SentCard.\n const goPrev = (e: React.MouseEvent) => {\n e.stopPropagation()\n setIndex((i) => Math.max(0, i - 1))\n }\n const goNext = (e: React.MouseEvent) => {\n e.stopPropagation()\n setIndex((i) => Math.min(total - 1, i + 1))\n }\n const atStart = safeIndex === 0\n const atEnd = safeIndex === total - 1\n\n const isDark = variant === 'dark'\n\n // Locked + unlocked render entirely separate trees so the locked state\n // doesn't end up stacking a blurred `<img>` on top of an underlying\n // `AttachmentThumbnail` (whose `bg-white/10` poster shell otherwise\n // shows through as a visible horizontal seam at the 16:9 boundary\n // inside the taller 337/386 gallery aspect).\n //\n // The locked branch uses `filter: blur` on a single full-size `<img>`\n // — not `backdrop-filter` — so the rounded corners are clipped\n // normally without any clip-path workarounds (see LockedThumbnail).\n return (\n <div className=\"relative aspect-[337/386] overflow-hidden rounded-t-md\">\n {showLocked ? (\n <div\n className={classNames(\n 'absolute inset-0',\n isDark ? 'bg-white/10' : 'bg-black/5'\n )}\n >\n {current.thumbnailUrl && (\n <img\n src={current.thumbnailUrl}\n alt=\"\"\n aria-hidden\n draggable={false}\n // `scale-110` hides the fuzzy edge that `filter: blur` leaves\n // around the image bounds.\n className=\"absolute inset-0 h-full w-full scale-110 object-cover blur-[40px]\"\n />\n )}\n </div>\n ) : (\n <AttachmentThumbnail\n mimeType={current.mimeType}\n sourceUrl={current.sourceUrl}\n thumbnailUrl={current.thumbnailUrl}\n title={title}\n variant={variant}\n />\n )}\n\n {centerBadge && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div className=\"flex size-12 items-center justify-center rounded-full bg-black/25 text-white\">\n {centerBadge}\n </div>\n </div>\n )}\n\n {total > 1 && (\n <React.Fragment>\n <button\n type=\"button\"\n onClick={goPrev}\n disabled={atStart}\n aria-label=\"Previous item\"\n className={classNames(\n 'absolute left-3 top-1/2 -translate-y-1/2 flex size-7 items-center justify-center rounded-full bg-black/30 text-white transition-opacity',\n atStart ? 'opacity-40' : 'hover:bg-black/40'\n )}\n >\n <CaretLeftIcon className=\"size-5\" weight=\"bold\" />\n </button>\n <button\n type=\"button\"\n onClick={goNext}\n disabled={atEnd}\n aria-label=\"Next item\"\n className={classNames(\n 'absolute right-3 top-1/2 -translate-y-1/2 flex size-7 items-center justify-center rounded-full bg-black/30 text-white transition-opacity',\n atEnd ? 'opacity-40' : 'hover:bg-black/40'\n )}\n >\n <CaretRightIcon className=\"size-5\" weight=\"bold\" />\n </button>\n\n <div className=\"pointer-events-none absolute bottom-5 left-1/2 -translate-x-1/2 rounded-lg bg-black/30 px-2 py-1\">\n <span className=\"text-xs font-medium leading-4 text-white\">\n {safeIndex + 1}/{total}\n </span>\n </div>\n </React.Fragment>\n )}\n\n {topRight && (\n <div className=\"pointer-events-auto absolute right-3 top-3 z-10\">\n {topRight}\n </div>\n )}\n </div>\n )\n}\n\nexport default GalleryThumbnail\n","import classNames from 'classnames'\nimport React from 'react'\n\nexport type LockedCardVariant = 'dark' | 'light'\n\nexport interface LockedCardShellProps {\n variant: LockedCardVariant\n children: React.ReactNode\n rootRef?: React.Ref<HTMLDivElement>\n 'data-testid'?: string\n}\n\n/**\n * Outer chrome for every LockedAttachment card.\n * Mirrors the `shadow-400` + 16px radius treatment from the Figma design system.\n */\nconst LockedCardShell: React.FC<LockedCardShellProps> = ({\n variant,\n children,\n rootRef,\n 'data-testid': dataTestId,\n}) => (\n <div\n ref={rootRef}\n data-testid={dataTestId}\n className={classNames(\n 'relative w-[280px] select-none overflow-hidden rounded-md',\n '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)]',\n variant === 'dark' ? 'bg-[#121110]' : 'bg-white'\n )}\n >\n {children}\n </div>\n)\n\nexport default LockedCardShell\n","import {\n LockOpenIcon,\n LockSimpleIcon,\n PlayIcon,\n} from '@phosphor-icons/react'\nimport React from 'react'\n\nimport { getSourceType } from '../../../AttachmentCard'\nimport type { PaymentStatus } from '../../types'\n\n/**\n * Centered 48x48 lock badge that overlays the thumbnail of any locked attachment.\n * Uses `bg-black/25` from the design system's `alpha-black-25` token.\n *\n * For playable media (video/audio), the badge shows a play icon instead of a\n * lock — matching the convention used by `GalleryThumbnail`.\n */\nexport const LockBadge: React.FC<{\n paymentStatus?: PaymentStatus\n mimeType?: string\n}> = ({ paymentStatus, mimeType }) => {\n const sourceType = mimeType ? getSourceType(mimeType) : undefined\n const isPlayable = sourceType === 'video' || sourceType === 'audio'\n\n const Icon = isPlayable\n ? PlayIcon\n : paymentStatus === 'paid'\n ? LockOpenIcon\n : LockSimpleIcon\n return (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div className=\"flex size-12 items-center justify-center rounded-full bg-black/25 text-white\">\n <Icon className=\"size-6\" weight=\"fill\" />\n </div>\n </div>\n )\n}\n\nexport default LockBadge\n","import classNames from 'classnames'\nimport React from 'react'\n\nimport {\n AttachmentThumbnail,\n renderTypeIcon,\n} from '../../../AttachmentCard'\nimport type { LockedAttachmentSource, PaymentStatus } from '../../types'\n\nimport { LockBadge } from './LockBadge'\nimport type { LockedCardVariant } from './LockedCardShell'\n\nexport interface LockedThumbnailProps {\n variant: LockedCardVariant\n mimeType: string\n thumbnailUrl?: string\n title?: string\n /**\n * When provided, the underlying source is shown unblurred (preview / unlocked state).\n * When undefined, the thumbnail is treated as locked: blurred with a central lock badge.\n */\n source?: LockedAttachmentSource\n /**\n * Forces the locked appearance even when a source is provided. Used for the\n * Composer card where the locked treatment is the default and the user toggles\n * a preview in place.\n */\n showLocked: boolean\n paymentStatus?: PaymentStatus\n /** Top-right overlay (e.g. dismiss X on Composer). Rendered inside the thumbnail. */\n topRight?: React.ReactNode\n /** When true, renders the unlocked image with aspect-video + object-contain. */\n containedImage?: boolean\n}\n\n/**\n * Renders the 180px-tall media area for a LockedAttachment card.\n * Handles three visual states:\n * - locked: blurred thumbnail + centered 48px lock badge\n * - preview/paid: clear thumbnail (the underlying source)\n * - empty: type-icon placeholder\n */\nconst LockedThumbnail: React.FC<LockedThumbnailProps> = ({\n variant,\n mimeType,\n thumbnailUrl,\n title,\n source,\n showLocked,\n paymentStatus,\n topRight,\n containedImage = false,\n}) => {\n const effectiveSourceUrl = showLocked ? undefined : source?.sourceUrl\n const effectiveThumbnailUrl = showLocked\n ? thumbnailUrl\n : (source?.thumbnailUrl ?? thumbnailUrl)\n\n const isDark = variant === 'dark'\n\n // Locked + unlocked render entirely separate trees so the locked state\n // doesn't end up stacking a blurred `<img>` on top of an underlying\n // `AttachmentThumbnail` (whose `bg-white/10` poster shell otherwise\n // shows through as a visible horizontal seam at the 16:9 boundary).\n //\n // The locked branch uses `filter: blur` on a single full-size `<img>`\n // — not `backdrop-filter` — because `backdrop-filter` paints in its\n // own compositing layer that escapes ancestor `overflow: hidden` on\n // Chrome/Safari and flattens the card's top corners. `filter` is\n // clipped normally, so the rounded corners stay round without any\n // clip-path workarounds.\n return (\n <div className=\"relative overflow-hidden rounded-t-md\">\n {showLocked ? (\n <div\n className={classNames(\n 'relative aspect-video overflow-hidden',\n isDark ? 'bg-white/10' : 'bg-black/5'\n )}\n >\n {effectiveThumbnailUrl ? (\n <img\n src={effectiveThumbnailUrl}\n alt=\"\"\n aria-hidden\n draggable={false}\n // `scale-110` hides the fuzzy semi-transparent edge that\n // `filter: blur` leaves around the image bounds.\n className=\"absolute inset-0 h-full w-full scale-110 object-cover blur-[40px]\"\n />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n {renderTypeIcon(mimeType, {\n className: isDark\n ? 'size-12 text-white/20'\n : 'size-12 text-black/20',\n weight: 'regular',\n })}\n </div>\n )}\n <LockBadge paymentStatus={paymentStatus} mimeType={mimeType} />\n </div>\n ) : (\n <AttachmentThumbnail\n mimeType={mimeType}\n sourceUrl={effectiveSourceUrl}\n thumbnailUrl={effectiveThumbnailUrl}\n title={title}\n variant={variant}\n containedImage={containedImage}\n mediaPlayerProps={\n effectiveSourceUrl\n ? { autoPlay: true, loop: true, controls: true, muted: false }\n : undefined\n }\n />\n )}\n\n {topRight && (\n <div className=\"pointer-events-auto absolute right-3 top-3 z-10\">\n {topRight}\n </div>\n )}\n </div>\n )\n}\n\nexport default LockedThumbnail\n"],"names":["CardBody","variant","title","placeholderTitle","mimeType","detail","statusBadge","action","icon","trailingAction","isDark","displayTitle","titleDimmed","typeIcon","renderTypeIcon","classNames","jsxs","jsx","isPlayableItem","item","sourceType","getSourceType","GalleryThumbnail","gallery","showLocked","paymentStatus","topRight","index","setIndex","useState","total","safeIndex","current","isVideoItem","centerBadge","PlayIcon","LockOpenIcon","LockSimpleIcon","goPrev","e","i","goNext","atStart","atEnd","AttachmentThumbnail","React","CaretLeftIcon","CaretRightIcon","LockedCardShell","children","rootRef","dataTestId","LockBadge","LockedThumbnail","thumbnailUrl","source","containedImage","effectiveSourceUrl","effectiveThumbnailUrl"],"mappings":";;;;;AA0BA,MAAMA,IAAoC,CAAC;AAAA,EACzC,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,kBAAAC,IAAmB;AAAA,EACnB,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC;AAAA,EACA,QAAAC;AAAA,EACA,MAAAC;AAAA,EACA,gBAAAC;AACF,MAAM;AACJ,QAAMC,IAAST,MAAY,QACrBU,IAAeD,IAAUR,KAASC,IAAqBD,KAAS,IAChEU,IAAcF,KAAU,CAACR,GAEzBW,IACJL,KACAM,EAAeV,GAAU;AAAA,IACvB,WAAWW;AAAA,MACT;AAAA,MACAL,IAAS,kBAAkB;AAAA,IAAA;AAAA,IAE7B,QAAQ;AAAA,EAAA,CACT;AAEH,SACE,gBAAAM,EAAC,OAAA,EAAI,WAAU,aACb,UAAA;AAAA,IAAA,gBAAAA,EAAC,OAAA,EAAI,WAAU,wBACb,UAAA;AAAA,MAAA,gBAAAA,EAAC,OAAA,EAAI,WAAU,sCACZ,UAAA;AAAA,QAAAL,EAAa,WAAW,MACvB,gBAAAM;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWF,EAAW,4CAA4C;AAAA,cAChE,iBAAiB,CAACL;AAAA,cAClB,iBAAiBA,KAAUE;AAAA,cAC3B,cAAcF,KAAU,CAACE;AAAA,YAAA,CAC1B;AAAA,YAEA,UAAAD;AAAA,UAAA;AAA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AAA,EAAI,WAAU,mDACZ,UAAAS,EAAA,CACH;AAAA,EAAA,GAEJ;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("react/jsx-runtime"),u=require("classnames"),h=require("./index-CR0b7198.cjs"),N=require("react"),d=require("@phosphor-icons/react"),I=({variant:l,title:t,placeholderTitle:n="Attachment title",mimeType:r,detail:a,statusBadge:o,action:b,icon:m,trailingAction:c})=>{const s=l==="dark",i=s?t??n:t??"",x=s&&!t,f=m??h.renderTypeIcon(r,{className:u("size-5 shrink-0",s?"text-white/55":"text-black/55"),weight:"regular"});return e.jsxs("div",{className:"px-4 py-3",children:[e.jsxs("div",{className:"flex items-end gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[i.trim()!==""&&e.jsx("p",{className:u("truncate text-base font-medium leading-6",{"text-black/90":!s,"text-white/30":s&&x,"text-white":s&&!x}),children:i}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[f,a!=null&&a!==""&&e.jsx("span",{className:u("text-xs font-medium",s?"text-white/55":"text-black/55"),children:a}),o]})]}),c&&e.jsx("div",{className:"shrink-0",children:c})]}),b]})};function z(l){const t=h.getSourceType(l.mimeType);return t==="video"||t==="audio"}const T=({variant:l,gallery:t,title:n,showLocked:r,paymentStatus:a,topRight:o})=>{const[b,m]=N.useState(0),c=t.length,s=Math.min(b,c-1),i=t[s],x=z(i),f=x?e.jsx(d.PlayIcon,{className:"size-6",weight:"fill"}):r?a==="paid"?e.jsx(d.LockOpenIcon,{className:"size-6",weight:"fill"}):e.jsx(d.LockSimpleIcon,{className:"size-6",weight:"fill"}):null,y=p=>{p.stopPropagation(),m(g=>Math.max(0,g-1))},k=p=>{p.stopPropagation(),m(g=>Math.min(c-1,g+1))},j=s===0,v=s===c-1,w=l==="dark";return e.jsxs("div",{className:"relative aspect-[337/386] overflow-hidden rounded-t-md",children:[r?e.jsx("div",{className:u("absolute inset-0",w?"bg-white/10":"bg-black/5"),children:i.thumbnailUrl&&e.jsx("img",{src:i.thumbnailUrl,alt:"","aria-hidden":!0,draggable:!1,className:"absolute inset-0 h-full w-full scale-110 object-cover blur-[40px]"})}):e.jsx(h.AttachmentThumbnail,{mimeType:i.mimeType,sourceUrl:i.sourceUrl,thumbnailUrl:i.thumbnailUrl,title:n,variant:l}),f&&e.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"flex size-12 items-center justify-center rounded-full bg-black/25 text-white",children:f})}),c>1&&e.jsxs(N.Fragment,{children:[e.jsx("button",{type:"button",onClick:y,disabled:j,"aria-label":"Previous item",className:u("absolute left-3 top-1/2 -translate-y-1/2 flex size-7 items-center justify-center rounded-full bg-black/30 text-white transition-opacity",j?"opacity-40":"hover:bg-black/40"),children:e.jsx(d.CaretLeftIcon,{className:"size-5",weight:"bold"})}),e.jsx("button",{type:"button",onClick:k,disabled:v,"aria-label":"Next item",className:u("absolute right-3 top-1/2 -translate-y-1/2 flex size-7 items-center justify-center rounded-full bg-black/30 text-white transition-opacity",v?"opacity-40":"hover:bg-black/40"),children:e.jsx(d.CaretRightIcon,{className:"size-5",weight:"bold"})}),e.jsx("div",{className:"pointer-events-none absolute bottom-5 left-1/2 -translate-x-1/2 rounded-lg bg-black/30 px-2 py-1",children:e.jsxs("span",{className:"text-xs font-medium leading-4 text-white",children:[s+1,"/",c]})})]}),o&&e.jsx("div",{className:"pointer-events-auto absolute right-3 top-3 z-10",children:o})]})},P=({variant:l,children:t,rootRef:n,"data-testid":r})=>e.jsx("div",{ref:n,"data-testid":r,className:u("relative w-[280px] select-none overflow-hidden rounded-md","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)]",l==="dark"?"bg-[#121110]":"bg-white"),children:t}),U=({paymentStatus:l,mimeType:t})=>{const n=t?h.getSourceType(t):void 0,a=n==="video"||n==="audio"?d.PlayIcon:l==="paid"?d.LockOpenIcon:d.LockSimpleIcon;return e.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"flex size-12 items-center justify-center rounded-full bg-black/25 text-white",children:e.jsx(a,{className:"size-6",weight:"fill"})})})},_=({variant:l,mimeType:t,thumbnailUrl:n,title:r,source:a,showLocked:o,paymentStatus:b,topRight:m,containedImage:c=!1})=>{const s=o||a==null?void 0:a.sourceUrl,i=o?n:(a==null?void 0:a.thumbnailUrl)??n,x=l==="dark";return e.jsxs("div",{className:"relative overflow-hidden rounded-t-md",children:[o?e.jsxs("div",{className:u("relative aspect-video overflow-hidden",x?"bg-white/10":"bg-black/5"),children:[i?e.jsx("img",{src:i,alt:"","aria-hidden":!0,draggable:!1,className:"absolute inset-0 h-full w-full scale-110 object-cover blur-[40px]"}):e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:h.renderTypeIcon(t,{className:x?"size-12 text-white/20":"size-12 text-black/20",weight:"regular"})}),e.jsx(U,{paymentStatus:b,mimeType:t})]}):e.jsx(h.AttachmentThumbnail,{mimeType:t,sourceUrl:s,thumbnailUrl:i,title:r,variant:l,containedImage:c,mediaPlayerProps:s?{autoPlay:!0,loop:!0,controls:!0,muted:!1}:void 0}),m&&e.jsx("div",{className:"pointer-events-auto absolute right-3 top-3 z-10",children:m})]})};exports.CardBody=I;exports.GalleryThumbnail=T;exports.LockedCardShell=P;exports.LockedThumbnail=_;
2
- //# sourceMappingURL=LockedThumbnail-B8RE_L4Z.cjs.map
1
+ "use strict";const e=require("react/jsx-runtime"),u=require("classnames"),h=require("./index-B_8de68T.cjs"),N=require("react"),d=require("@phosphor-icons/react"),I=({variant:l,title:t,placeholderTitle:n="Attachment title",mimeType:r,detail:a,statusBadge:o,action:b,icon:m,trailingAction:c})=>{const s=l==="dark",i=s?t??n:t??"",x=s&&!t,f=m??h.renderTypeIcon(r,{className:u("size-5 shrink-0",s?"text-white/55":"text-black/55"),weight:"regular"});return e.jsxs("div",{className:"px-4 py-3",children:[e.jsxs("div",{className:"flex items-end gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[i.trim()!==""&&e.jsx("p",{className:u("truncate text-base font-medium leading-6",{"text-black/90":!s,"text-white/30":s&&x,"text-white":s&&!x}),children:i}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[f,a!=null&&a!==""&&e.jsx("span",{className:u("text-xs font-medium",s?"text-white/55":"text-black/55"),children:a}),o]})]}),c&&e.jsx("div",{className:"shrink-0",children:c})]}),b]})};function z(l){const t=h.getSourceType(l.mimeType);return t==="video"||t==="audio"}const T=({variant:l,gallery:t,title:n,showLocked:r,paymentStatus:a,topRight:o})=>{const[b,m]=N.useState(0),c=t.length,s=Math.min(b,c-1),i=t[s],x=z(i),f=x?e.jsx(d.PlayIcon,{className:"size-6",weight:"fill"}):r?a==="paid"?e.jsx(d.LockOpenIcon,{className:"size-6",weight:"fill"}):e.jsx(d.LockSimpleIcon,{className:"size-6",weight:"fill"}):null,y=p=>{p.stopPropagation(),m(g=>Math.max(0,g-1))},k=p=>{p.stopPropagation(),m(g=>Math.min(c-1,g+1))},j=s===0,v=s===c-1,w=l==="dark";return e.jsxs("div",{className:"relative aspect-[337/386] overflow-hidden rounded-t-md",children:[r?e.jsx("div",{className:u("absolute inset-0",w?"bg-white/10":"bg-black/5"),children:i.thumbnailUrl&&e.jsx("img",{src:i.thumbnailUrl,alt:"","aria-hidden":!0,draggable:!1,className:"absolute inset-0 h-full w-full scale-110 object-cover blur-[40px]"})}):e.jsx(h.AttachmentThumbnail,{mimeType:i.mimeType,sourceUrl:i.sourceUrl,thumbnailUrl:i.thumbnailUrl,title:n,variant:l}),f&&e.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"flex size-12 items-center justify-center rounded-full bg-black/25 text-white",children:f})}),c>1&&e.jsxs(N.Fragment,{children:[e.jsx("button",{type:"button",onClick:y,disabled:j,"aria-label":"Previous item",className:u("absolute left-3 top-1/2 -translate-y-1/2 flex size-7 items-center justify-center rounded-full bg-black/30 text-white transition-opacity",j?"opacity-40":"hover:bg-black/40"),children:e.jsx(d.CaretLeftIcon,{className:"size-5",weight:"bold"})}),e.jsx("button",{type:"button",onClick:k,disabled:v,"aria-label":"Next item",className:u("absolute right-3 top-1/2 -translate-y-1/2 flex size-7 items-center justify-center rounded-full bg-black/30 text-white transition-opacity",v?"opacity-40":"hover:bg-black/40"),children:e.jsx(d.CaretRightIcon,{className:"size-5",weight:"bold"})}),e.jsx("div",{className:"pointer-events-none absolute bottom-5 left-1/2 -translate-x-1/2 rounded-lg bg-black/30 px-2 py-1",children:e.jsxs("span",{className:"text-xs font-medium leading-4 text-white",children:[s+1,"/",c]})})]}),o&&e.jsx("div",{className:"pointer-events-auto absolute right-3 top-3 z-10",children:o})]})},P=({variant:l,children:t,rootRef:n,"data-testid":r})=>e.jsx("div",{ref:n,"data-testid":r,className:u("relative w-[280px] select-none overflow-hidden rounded-md","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)]",l==="dark"?"bg-[#121110]":"bg-white"),children:t}),U=({paymentStatus:l,mimeType:t})=>{const n=t?h.getSourceType(t):void 0,a=n==="video"||n==="audio"?d.PlayIcon:l==="paid"?d.LockOpenIcon:d.LockSimpleIcon;return e.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"flex size-12 items-center justify-center rounded-full bg-black/25 text-white",children:e.jsx(a,{className:"size-6",weight:"fill"})})})},_=({variant:l,mimeType:t,thumbnailUrl:n,title:r,source:a,showLocked:o,paymentStatus:b,topRight:m,containedImage:c=!1})=>{const s=o||a==null?void 0:a.sourceUrl,i=o?n:(a==null?void 0:a.thumbnailUrl)??n,x=l==="dark";return e.jsxs("div",{className:"relative overflow-hidden rounded-t-md",children:[o?e.jsxs("div",{className:u("relative aspect-video overflow-hidden",x?"bg-white/10":"bg-black/5"),children:[i?e.jsx("img",{src:i,alt:"","aria-hidden":!0,draggable:!1,className:"absolute inset-0 h-full w-full scale-110 object-cover blur-[40px]"}):e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:h.renderTypeIcon(t,{className:x?"size-12 text-white/20":"size-12 text-black/20",weight:"regular"})}),e.jsx(U,{paymentStatus:b,mimeType:t})]}):e.jsx(h.AttachmentThumbnail,{mimeType:t,sourceUrl:s,thumbnailUrl:i,title:r,variant:l,containedImage:c,mediaPlayerProps:s?{autoPlay:!0,loop:!0,controls:!0,muted:!1}:void 0}),m&&e.jsx("div",{className:"pointer-events-auto absolute right-3 top-3 z-10",children:m})]})};exports.CardBody=I;exports.GalleryThumbnail=T;exports.LockedCardShell=P;exports.LockedThumbnail=_;
2
+ //# sourceMappingURL=LockedThumbnail-DkdVuMZM.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"LockedThumbnail-B8RE_L4Z.cjs","sources":["../src/components/LockedAttachment/components/_shared/CardBody.tsx","../src/components/LockedAttachment/components/_shared/GalleryThumbnail.tsx","../src/components/LockedAttachment/components/_shared/LockedCardShell.tsx","../src/components/LockedAttachment/components/_shared/LockBadge.tsx","../src/components/LockedAttachment/components/_shared/LockedThumbnail.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport React from 'react'\n\nimport { renderTypeIcon } from '../../../AttachmentCard'\n\nimport type { LockedCardVariant } from './LockedCardShell'\n\nexport interface CardBodyProps {\n variant: LockedCardVariant\n title?: string\n placeholderTitle?: string\n mimeType: string\n detail?: string\n statusBadge?: React.ReactNode\n action?: React.ReactNode\n /** Overrides the auto-detected type icon (used by Gallery to swap in an `Images` icon). */\n icon?: React.ReactNode\n /** Optional control rendered on the right of the title/status block (e.g. Composer edit pencil). */\n trailingAction?: React.ReactNode\n}\n\n/**\n * Title + status row layout shared by Composer / Sent / Received cards.\n * Layout matches the Figma `Container > Labels` group (16px h-padding, 12px v-padding,\n * 4px gap between title and status row, 4px gap inside status row).\n */\nconst CardBody: React.FC<CardBodyProps> = ({\n variant,\n title,\n placeholderTitle = 'Attachment title',\n mimeType,\n detail,\n statusBadge,\n action,\n icon,\n trailingAction,\n}) => {\n const isDark = variant === 'dark'\n const displayTitle = isDark ? (title ?? placeholderTitle) : (title ?? '')\n const titleDimmed = isDark && !title\n\n const typeIcon =\n icon ??\n renderTypeIcon(mimeType, {\n className: classNames(\n 'size-5 shrink-0',\n isDark ? 'text-white/55' : 'text-black/55'\n ),\n weight: 'regular',\n })\n\n return (\n <div className=\"px-4 py-3\">\n <div className=\"flex items-end gap-3\">\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n {displayTitle.trim() !== '' && (\n <p\n className={classNames('truncate text-base font-medium leading-6', {\n 'text-black/90': !isDark,\n 'text-white/30': isDark && titleDimmed,\n 'text-white': isDark && !titleDimmed,\n })}\n >\n {displayTitle}\n </p>\n )}\n\n <div className=\"flex flex-wrap items-center gap-1\">\n {typeIcon}\n\n {detail != null && detail !== '' && (\n <span\n className={classNames(\n 'text-xs font-medium',\n isDark ? 'text-white/55' : 'text-black/55'\n )}\n >\n {detail}\n </span>\n )}\n\n {statusBadge}\n </div>\n </div>\n\n {trailingAction && <div className=\"shrink-0\">{trailingAction}</div>}\n </div>\n\n {action}\n </div>\n )\n}\n\nexport default CardBody\n","import {\n CaretLeftIcon,\n CaretRightIcon,\n LockOpenIcon,\n LockSimpleIcon,\n PlayIcon,\n} from '@phosphor-icons/react'\nimport classNames from 'classnames'\nimport React, { useState } from 'react'\n\nimport { AttachmentThumbnail, getSourceType } from '../../../AttachmentCard'\nimport type {\n LockedAttachmentGalleryItem,\n PaymentStatus,\n} from '../../types'\n\nimport type { LockedCardVariant } from './LockedCardShell'\n\nexport interface GalleryThumbnailProps {\n variant: LockedCardVariant\n gallery: LockedAttachmentGalleryItem[]\n title?: string\n /** When true, all items are shown blurred + the locked/play badge is overlaid. */\n showLocked: boolean\n paymentStatus?: PaymentStatus\n /** Top-right slot (e.g. dismiss X on Composer). Rendered inside the thumbnail. */\n topRight?: React.ReactNode\n}\n\nfunction isPlayableItem(item: LockedAttachmentGalleryItem): boolean {\n const sourceType = getSourceType(item.mimeType)\n return sourceType === 'video' || sourceType === 'audio'\n}\n\n/**\n * Mixed-media carousel used by every LockedAttachment card when its `gallery`\n * prop has 2+ items. Matches the \"Gallery\" frames in the Figma design system:\n * 337/386 aspect ratio, prev/next caret buttons, a counter pill, and a center\n * lock / play indicator that swaps based on the current item.\n */\nconst GalleryThumbnail: React.FC<GalleryThumbnailProps> = ({\n variant,\n gallery,\n title,\n showLocked,\n paymentStatus,\n topRight,\n}) => {\n const [index, setIndex] = useState(0)\n const total = gallery.length\n const safeIndex = Math.min(index, total - 1)\n const current = gallery[safeIndex]\n const isVideoItem = isPlayableItem(current)\n\n // Center badge: PLAY for video items, LOCK for non-video locked items.\n // Unlocked image items show no center badge — the image is the content.\n const centerBadge = (() => {\n if (isVideoItem) {\n return <PlayIcon className=\"size-6\" weight=\"fill\" />\n }\n if (showLocked) {\n return paymentStatus === 'paid' ? (\n <LockOpenIcon className=\"size-6\" weight=\"fill\" />\n ) : (\n <LockSimpleIcon className=\"size-6\" weight=\"fill\" />\n )\n }\n return null\n })()\n\n // Stop propagation so arrow taps don't bubble up to the outer preview-toggle\n // wrapper on ComposerCard / SentCard.\n const goPrev = (e: React.MouseEvent) => {\n e.stopPropagation()\n setIndex((i) => Math.max(0, i - 1))\n }\n const goNext = (e: React.MouseEvent) => {\n e.stopPropagation()\n setIndex((i) => Math.min(total - 1, i + 1))\n }\n const atStart = safeIndex === 0\n const atEnd = safeIndex === total - 1\n\n const isDark = variant === 'dark'\n\n // Locked + unlocked render entirely separate trees so the locked state\n // doesn't end up stacking a blurred `<img>` on top of an underlying\n // `AttachmentThumbnail` (whose `bg-white/10` poster shell otherwise\n // shows through as a visible horizontal seam at the 16:9 boundary\n // inside the taller 337/386 gallery aspect).\n //\n // The locked branch uses `filter: blur` on a single full-size `<img>`\n // — not `backdrop-filter` — so the rounded corners are clipped\n // normally without any clip-path workarounds (see LockedThumbnail).\n return (\n <div className=\"relative aspect-[337/386] overflow-hidden rounded-t-md\">\n {showLocked ? (\n <div\n className={classNames(\n 'absolute inset-0',\n isDark ? 'bg-white/10' : 'bg-black/5'\n )}\n >\n {current.thumbnailUrl && (\n <img\n src={current.thumbnailUrl}\n alt=\"\"\n aria-hidden\n draggable={false}\n // `scale-110` hides the fuzzy edge that `filter: blur` leaves\n // around the image bounds.\n className=\"absolute inset-0 h-full w-full scale-110 object-cover blur-[40px]\"\n />\n )}\n </div>\n ) : (\n <AttachmentThumbnail\n mimeType={current.mimeType}\n sourceUrl={current.sourceUrl}\n thumbnailUrl={current.thumbnailUrl}\n title={title}\n variant={variant}\n />\n )}\n\n {centerBadge && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div className=\"flex size-12 items-center justify-center rounded-full bg-black/25 text-white\">\n {centerBadge}\n </div>\n </div>\n )}\n\n {total > 1 && (\n <React.Fragment>\n <button\n type=\"button\"\n onClick={goPrev}\n disabled={atStart}\n aria-label=\"Previous item\"\n className={classNames(\n 'absolute left-3 top-1/2 -translate-y-1/2 flex size-7 items-center justify-center rounded-full bg-black/30 text-white transition-opacity',\n atStart ? 'opacity-40' : 'hover:bg-black/40'\n )}\n >\n <CaretLeftIcon className=\"size-5\" weight=\"bold\" />\n </button>\n <button\n type=\"button\"\n onClick={goNext}\n disabled={atEnd}\n aria-label=\"Next item\"\n className={classNames(\n 'absolute right-3 top-1/2 -translate-y-1/2 flex size-7 items-center justify-center rounded-full bg-black/30 text-white transition-opacity',\n atEnd ? 'opacity-40' : 'hover:bg-black/40'\n )}\n >\n <CaretRightIcon className=\"size-5\" weight=\"bold\" />\n </button>\n\n <div className=\"pointer-events-none absolute bottom-5 left-1/2 -translate-x-1/2 rounded-lg bg-black/30 px-2 py-1\">\n <span className=\"text-xs font-medium leading-4 text-white\">\n {safeIndex + 1}/{total}\n </span>\n </div>\n </React.Fragment>\n )}\n\n {topRight && (\n <div className=\"pointer-events-auto absolute right-3 top-3 z-10\">\n {topRight}\n </div>\n )}\n </div>\n )\n}\n\nexport default GalleryThumbnail\n","import classNames from 'classnames'\nimport React from 'react'\n\nexport type LockedCardVariant = 'dark' | 'light'\n\nexport interface LockedCardShellProps {\n variant: LockedCardVariant\n children: React.ReactNode\n rootRef?: React.Ref<HTMLDivElement>\n 'data-testid'?: string\n}\n\n/**\n * Outer chrome for every LockedAttachment card.\n * Mirrors the `shadow-400` + 16px radius treatment from the Figma design system.\n */\nconst LockedCardShell: React.FC<LockedCardShellProps> = ({\n variant,\n children,\n rootRef,\n 'data-testid': dataTestId,\n}) => (\n <div\n ref={rootRef}\n data-testid={dataTestId}\n className={classNames(\n 'relative w-[280px] select-none overflow-hidden rounded-md',\n '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)]',\n variant === 'dark' ? 'bg-[#121110]' : 'bg-white'\n )}\n >\n {children}\n </div>\n)\n\nexport default LockedCardShell\n","import {\n LockOpenIcon,\n LockSimpleIcon,\n PlayIcon,\n} from '@phosphor-icons/react'\nimport React from 'react'\n\nimport { getSourceType } from '../../../AttachmentCard'\nimport type { PaymentStatus } from '../../types'\n\n/**\n * Centered 48x48 lock badge that overlays the thumbnail of any locked attachment.\n * Uses `bg-black/25` from the design system's `alpha-black-25` token.\n *\n * For playable media (video/audio), the badge shows a play icon instead of a\n * lock — matching the convention used by `GalleryThumbnail`.\n */\nexport const LockBadge: React.FC<{\n paymentStatus?: PaymentStatus\n mimeType?: string\n}> = ({ paymentStatus, mimeType }) => {\n const sourceType = mimeType ? getSourceType(mimeType) : undefined\n const isPlayable = sourceType === 'video' || sourceType === 'audio'\n\n const Icon = isPlayable\n ? PlayIcon\n : paymentStatus === 'paid'\n ? LockOpenIcon\n : LockSimpleIcon\n return (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div className=\"flex size-12 items-center justify-center rounded-full bg-black/25 text-white\">\n <Icon className=\"size-6\" weight=\"fill\" />\n </div>\n </div>\n )\n}\n\nexport default LockBadge\n","import classNames from 'classnames'\nimport React from 'react'\n\nimport {\n AttachmentThumbnail,\n renderTypeIcon,\n} from '../../../AttachmentCard'\nimport type { LockedAttachmentSource, PaymentStatus } from '../../types'\n\nimport { LockBadge } from './LockBadge'\nimport type { LockedCardVariant } from './LockedCardShell'\n\nexport interface LockedThumbnailProps {\n variant: LockedCardVariant\n mimeType: string\n thumbnailUrl?: string\n title?: string\n /**\n * When provided, the underlying source is shown unblurred (preview / unlocked state).\n * When undefined, the thumbnail is treated as locked: blurred with a central lock badge.\n */\n source?: LockedAttachmentSource\n /**\n * Forces the locked appearance even when a source is provided. Used for the\n * Composer card where the locked treatment is the default and the user toggles\n * a preview in place.\n */\n showLocked: boolean\n paymentStatus?: PaymentStatus\n /** Top-right overlay (e.g. dismiss X on Composer). Rendered inside the thumbnail. */\n topRight?: React.ReactNode\n /** When true, renders the unlocked image with aspect-video + object-contain. */\n containedImage?: boolean\n}\n\n/**\n * Renders the 180px-tall media area for a LockedAttachment card.\n * Handles three visual states:\n * - locked: blurred thumbnail + centered 48px lock badge\n * - preview/paid: clear thumbnail (the underlying source)\n * - empty: type-icon placeholder\n */\nconst LockedThumbnail: React.FC<LockedThumbnailProps> = ({\n variant,\n mimeType,\n thumbnailUrl,\n title,\n source,\n showLocked,\n paymentStatus,\n topRight,\n containedImage = false,\n}) => {\n const effectiveSourceUrl = showLocked ? undefined : source?.sourceUrl\n const effectiveThumbnailUrl = showLocked\n ? thumbnailUrl\n : (source?.thumbnailUrl ?? thumbnailUrl)\n\n const isDark = variant === 'dark'\n\n // Locked + unlocked render entirely separate trees so the locked state\n // doesn't end up stacking a blurred `<img>` on top of an underlying\n // `AttachmentThumbnail` (whose `bg-white/10` poster shell otherwise\n // shows through as a visible horizontal seam at the 16:9 boundary).\n //\n // The locked branch uses `filter: blur` on a single full-size `<img>`\n // — not `backdrop-filter` — because `backdrop-filter` paints in its\n // own compositing layer that escapes ancestor `overflow: hidden` on\n // Chrome/Safari and flattens the card's top corners. `filter` is\n // clipped normally, so the rounded corners stay round without any\n // clip-path workarounds.\n return (\n <div className=\"relative overflow-hidden rounded-t-md\">\n {showLocked ? (\n <div\n className={classNames(\n 'relative aspect-video overflow-hidden',\n isDark ? 'bg-white/10' : 'bg-black/5'\n )}\n >\n {effectiveThumbnailUrl ? (\n <img\n src={effectiveThumbnailUrl}\n alt=\"\"\n aria-hidden\n draggable={false}\n // `scale-110` hides the fuzzy semi-transparent edge that\n // `filter: blur` leaves around the image bounds.\n className=\"absolute inset-0 h-full w-full scale-110 object-cover blur-[40px]\"\n />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n {renderTypeIcon(mimeType, {\n className: isDark\n ? 'size-12 text-white/20'\n : 'size-12 text-black/20',\n weight: 'regular',\n })}\n </div>\n )}\n <LockBadge paymentStatus={paymentStatus} mimeType={mimeType} />\n </div>\n ) : (\n <AttachmentThumbnail\n mimeType={mimeType}\n sourceUrl={effectiveSourceUrl}\n thumbnailUrl={effectiveThumbnailUrl}\n title={title}\n variant={variant}\n containedImage={containedImage}\n mediaPlayerProps={\n effectiveSourceUrl\n ? { autoPlay: true, loop: true, controls: true, muted: false }\n : undefined\n }\n />\n )}\n\n {topRight && (\n <div className=\"pointer-events-auto absolute right-3 top-3 z-10\">\n {topRight}\n </div>\n )}\n </div>\n )\n}\n\nexport default LockedThumbnail\n"],"names":["CardBody","variant","title","placeholderTitle","mimeType","detail","statusBadge","action","icon","trailingAction","isDark","displayTitle","titleDimmed","typeIcon","renderTypeIcon","classNames","jsxs","jsx","isPlayableItem","item","sourceType","getSourceType","GalleryThumbnail","gallery","showLocked","paymentStatus","topRight","index","setIndex","useState","total","safeIndex","current","isVideoItem","centerBadge","PlayIcon","LockOpenIcon","LockSimpleIcon","goPrev","e","i","goNext","atStart","atEnd","AttachmentThumbnail","React","CaretLeftIcon","CaretRightIcon","LockedCardShell","children","rootRef","dataTestId","LockBadge","Icon","LockedThumbnail","thumbnailUrl","source","containedImage","effectiveSourceUrl","effectiveThumbnailUrl"],"mappings":"kKA0BMA,EAAoC,CAAC,CACzC,QAAAC,EACA,MAAAC,EACA,iBAAAC,EAAmB,mBACnB,SAAAC,EACA,OAAAC,EACA,YAAAC,EACA,OAAAC,EACA,KAAAC,EACA,eAAAC,CACF,IAAM,CACJ,MAAMC,EAAST,IAAY,OACrBU,EAAeD,EAAUR,GAASC,EAAqBD,GAAS,GAChEU,EAAcF,GAAU,CAACR,EAEzBW,EACJL,GACAM,EAAAA,eAAeV,EAAU,CACvB,UAAWW,EACT,kBACAL,EAAS,gBAAkB,eAAA,EAE7B,OAAQ,SAAA,CACT,EAEH,OACEM,EAAAA,KAAC,MAAA,CAAI,UAAU,YACb,SAAA,CAAAA,EAAAA,KAAC,MAAA,CAAI,UAAU,uBACb,SAAA,CAAAA,EAAAA,KAAC,MAAA,CAAI,UAAU,qCACZ,SAAA,CAAAL,EAAa,SAAW,IACvBM,EAAAA,IAAC,IAAA,CACC,UAAWF,EAAW,2CAA4C,CAChE,gBAAiB,CAACL,EAClB,gBAAiBA,GAAUE,EAC3B,aAAcF,GAAU,CAACE,CAAA,CAC1B,EAEA,SAAAD,CAAA,CAAA,EAILK,EAAAA,KAAC,MAAA,CAAI,UAAU,oCACZ,SAAA,CAAAH,EAEAR,GAAU,MAAQA,IAAW,IAC5BY,EAAAA,IAAC,OAAA,CACC,UAAWF,EACT,sBACAL,EAAS,gBAAkB,eAAA,EAG5B,SAAAL,CAAA,CAAA,EAIJC,CAAA,CAAA,CACH,CAAA,EACF,EAECG,GAAkBQ,EAAAA,IAAC,MAAA,CAAI,UAAU,WAAY,SAAAR,CAAA,CAAe,CAAA,EAC/D,EAECF,CAAA,EACH,CAEJ,EC9DA,SAASW,EAAeC,EAA4C,CAClE,MAAMC,EAAaC,EAAAA,cAAcF,EAAK,QAAQ,EAC9C,OAAOC,IAAe,SAAWA,IAAe,OAClD,CAQA,MAA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-DkdVuMZM.cjs","sources":["../src/components/LockedAttachment/components/_shared/CardBody.tsx","../src/components/LockedAttachment/components/_shared/GalleryThumbnail.tsx","../src/components/LockedAttachment/components/_shared/LockedCardShell.tsx","../src/components/LockedAttachment/components/_shared/LockBadge.tsx","../src/components/LockedAttachment/components/_shared/LockedThumbnail.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport React from 'react'\n\nimport { renderTypeIcon } from '../../../AttachmentCard'\n\nimport type { LockedCardVariant } from './LockedCardShell'\n\nexport interface CardBodyProps {\n variant: LockedCardVariant\n title?: string\n placeholderTitle?: string\n mimeType: string\n detail?: string\n statusBadge?: React.ReactNode\n action?: React.ReactNode\n /** Overrides the auto-detected type icon (used by Gallery to swap in an `Images` icon). */\n icon?: React.ReactNode\n /** Optional control rendered on the right of the title/status block (e.g. Composer edit pencil). */\n trailingAction?: React.ReactNode\n}\n\n/**\n * Title + status row layout shared by Composer / Sent / Received cards.\n * Layout matches the Figma `Container > Labels` group (16px h-padding, 12px v-padding,\n * 4px gap between title and status row, 4px gap inside status row).\n */\nconst CardBody: React.FC<CardBodyProps> = ({\n variant,\n title,\n placeholderTitle = 'Attachment title',\n mimeType,\n detail,\n statusBadge,\n action,\n icon,\n trailingAction,\n}) => {\n const isDark = variant === 'dark'\n const displayTitle = isDark ? (title ?? placeholderTitle) : (title ?? '')\n const titleDimmed = isDark && !title\n\n const typeIcon =\n icon ??\n renderTypeIcon(mimeType, {\n className: classNames(\n 'size-5 shrink-0',\n isDark ? 'text-white/55' : 'text-black/55'\n ),\n weight: 'regular',\n })\n\n return (\n <div className=\"px-4 py-3\">\n <div className=\"flex items-end gap-3\">\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n {displayTitle.trim() !== '' && (\n <p\n className={classNames('truncate text-base font-medium leading-6', {\n 'text-black/90': !isDark,\n 'text-white/30': isDark && titleDimmed,\n 'text-white': isDark && !titleDimmed,\n })}\n >\n {displayTitle}\n </p>\n )}\n\n <div className=\"flex flex-wrap items-center gap-1\">\n {typeIcon}\n\n {detail != null && detail !== '' && (\n <span\n className={classNames(\n 'text-xs font-medium',\n isDark ? 'text-white/55' : 'text-black/55'\n )}\n >\n {detail}\n </span>\n )}\n\n {statusBadge}\n </div>\n </div>\n\n {trailingAction && <div className=\"shrink-0\">{trailingAction}</div>}\n </div>\n\n {action}\n </div>\n )\n}\n\nexport default CardBody\n","import {\n CaretLeftIcon,\n CaretRightIcon,\n LockOpenIcon,\n LockSimpleIcon,\n PlayIcon,\n} from '@phosphor-icons/react'\nimport classNames from 'classnames'\nimport React, { useState } from 'react'\n\nimport { AttachmentThumbnail, getSourceType } from '../../../AttachmentCard'\nimport type {\n LockedAttachmentGalleryItem,\n PaymentStatus,\n} from '../../types'\n\nimport type { LockedCardVariant } from './LockedCardShell'\n\nexport interface GalleryThumbnailProps {\n variant: LockedCardVariant\n gallery: LockedAttachmentGalleryItem[]\n title?: string\n /** When true, all items are shown blurred + the locked/play badge is overlaid. */\n showLocked: boolean\n paymentStatus?: PaymentStatus\n /** Top-right slot (e.g. dismiss X on Composer). Rendered inside the thumbnail. */\n topRight?: React.ReactNode\n}\n\nfunction isPlayableItem(item: LockedAttachmentGalleryItem): boolean {\n const sourceType = getSourceType(item.mimeType)\n return sourceType === 'video' || sourceType === 'audio'\n}\n\n/**\n * Mixed-media carousel used by every LockedAttachment card when its `gallery`\n * prop has 2+ items. Matches the \"Gallery\" frames in the Figma design system:\n * 337/386 aspect ratio, prev/next caret buttons, a counter pill, and a center\n * lock / play indicator that swaps based on the current item.\n */\nconst GalleryThumbnail: React.FC<GalleryThumbnailProps> = ({\n variant,\n gallery,\n title,\n showLocked,\n paymentStatus,\n topRight,\n}) => {\n const [index, setIndex] = useState(0)\n const total = gallery.length\n const safeIndex = Math.min(index, total - 1)\n const current = gallery[safeIndex]\n const isVideoItem = isPlayableItem(current)\n\n // Center badge: PLAY for video items, LOCK for non-video locked items.\n // Unlocked image items show no center badge — the image is the content.\n const centerBadge = (() => {\n if (isVideoItem) {\n return <PlayIcon className=\"size-6\" weight=\"fill\" />\n }\n if (showLocked) {\n return paymentStatus === 'paid' ? (\n <LockOpenIcon className=\"size-6\" weight=\"fill\" />\n ) : (\n <LockSimpleIcon className=\"size-6\" weight=\"fill\" />\n )\n }\n return null\n })()\n\n // Stop propagation so arrow taps don't bubble up to the outer preview-toggle\n // wrapper on ComposerCard / SentCard.\n const goPrev = (e: React.MouseEvent) => {\n e.stopPropagation()\n setIndex((i) => Math.max(0, i - 1))\n }\n const goNext = (e: React.MouseEvent) => {\n e.stopPropagation()\n setIndex((i) => Math.min(total - 1, i + 1))\n }\n const atStart = safeIndex === 0\n const atEnd = safeIndex === total - 1\n\n const isDark = variant === 'dark'\n\n // Locked + unlocked render entirely separate trees so the locked state\n // doesn't end up stacking a blurred `<img>` on top of an underlying\n // `AttachmentThumbnail` (whose `bg-white/10` poster shell otherwise\n // shows through as a visible horizontal seam at the 16:9 boundary\n // inside the taller 337/386 gallery aspect).\n //\n // The locked branch uses `filter: blur` on a single full-size `<img>`\n // — not `backdrop-filter` — so the rounded corners are clipped\n // normally without any clip-path workarounds (see LockedThumbnail).\n return (\n <div className=\"relative aspect-[337/386] overflow-hidden rounded-t-md\">\n {showLocked ? (\n <div\n className={classNames(\n 'absolute inset-0',\n isDark ? 'bg-white/10' : 'bg-black/5'\n )}\n >\n {current.thumbnailUrl && (\n <img\n src={current.thumbnailUrl}\n alt=\"\"\n aria-hidden\n draggable={false}\n // `scale-110` hides the fuzzy edge that `filter: blur` leaves\n // around the image bounds.\n className=\"absolute inset-0 h-full w-full scale-110 object-cover blur-[40px]\"\n />\n )}\n </div>\n ) : (\n <AttachmentThumbnail\n mimeType={current.mimeType}\n sourceUrl={current.sourceUrl}\n thumbnailUrl={current.thumbnailUrl}\n title={title}\n variant={variant}\n />\n )}\n\n {centerBadge && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div className=\"flex size-12 items-center justify-center rounded-full bg-black/25 text-white\">\n {centerBadge}\n </div>\n </div>\n )}\n\n {total > 1 && (\n <React.Fragment>\n <button\n type=\"button\"\n onClick={goPrev}\n disabled={atStart}\n aria-label=\"Previous item\"\n className={classNames(\n 'absolute left-3 top-1/2 -translate-y-1/2 flex size-7 items-center justify-center rounded-full bg-black/30 text-white transition-opacity',\n atStart ? 'opacity-40' : 'hover:bg-black/40'\n )}\n >\n <CaretLeftIcon className=\"size-5\" weight=\"bold\" />\n </button>\n <button\n type=\"button\"\n onClick={goNext}\n disabled={atEnd}\n aria-label=\"Next item\"\n className={classNames(\n 'absolute right-3 top-1/2 -translate-y-1/2 flex size-7 items-center justify-center rounded-full bg-black/30 text-white transition-opacity',\n atEnd ? 'opacity-40' : 'hover:bg-black/40'\n )}\n >\n <CaretRightIcon className=\"size-5\" weight=\"bold\" />\n </button>\n\n <div className=\"pointer-events-none absolute bottom-5 left-1/2 -translate-x-1/2 rounded-lg bg-black/30 px-2 py-1\">\n <span className=\"text-xs font-medium leading-4 text-white\">\n {safeIndex + 1}/{total}\n </span>\n </div>\n </React.Fragment>\n )}\n\n {topRight && (\n <div className=\"pointer-events-auto absolute right-3 top-3 z-10\">\n {topRight}\n </div>\n )}\n </div>\n )\n}\n\nexport default GalleryThumbnail\n","import classNames from 'classnames'\nimport React from 'react'\n\nexport type LockedCardVariant = 'dark' | 'light'\n\nexport interface LockedCardShellProps {\n variant: LockedCardVariant\n children: React.ReactNode\n rootRef?: React.Ref<HTMLDivElement>\n 'data-testid'?: string\n}\n\n/**\n * Outer chrome for every LockedAttachment card.\n * Mirrors the `shadow-400` + 16px radius treatment from the Figma design system.\n */\nconst LockedCardShell: React.FC<LockedCardShellProps> = ({\n variant,\n children,\n rootRef,\n 'data-testid': dataTestId,\n}) => (\n <div\n ref={rootRef}\n data-testid={dataTestId}\n className={classNames(\n 'relative w-[280px] select-none overflow-hidden rounded-md',\n '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)]',\n variant === 'dark' ? 'bg-[#121110]' : 'bg-white'\n )}\n >\n {children}\n </div>\n)\n\nexport default LockedCardShell\n","import {\n LockOpenIcon,\n LockSimpleIcon,\n PlayIcon,\n} from '@phosphor-icons/react'\nimport React from 'react'\n\nimport { getSourceType } from '../../../AttachmentCard'\nimport type { PaymentStatus } from '../../types'\n\n/**\n * Centered 48x48 lock badge that overlays the thumbnail of any locked attachment.\n * Uses `bg-black/25` from the design system's `alpha-black-25` token.\n *\n * For playable media (video/audio), the badge shows a play icon instead of a\n * lock — matching the convention used by `GalleryThumbnail`.\n */\nexport const LockBadge: React.FC<{\n paymentStatus?: PaymentStatus\n mimeType?: string\n}> = ({ paymentStatus, mimeType }) => {\n const sourceType = mimeType ? getSourceType(mimeType) : undefined\n const isPlayable = sourceType === 'video' || sourceType === 'audio'\n\n const Icon = isPlayable\n ? PlayIcon\n : paymentStatus === 'paid'\n ? LockOpenIcon\n : LockSimpleIcon\n return (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div className=\"flex size-12 items-center justify-center rounded-full bg-black/25 text-white\">\n <Icon className=\"size-6\" weight=\"fill\" />\n </div>\n </div>\n )\n}\n\nexport default LockBadge\n","import classNames from 'classnames'\nimport React from 'react'\n\nimport {\n AttachmentThumbnail,\n renderTypeIcon,\n} from '../../../AttachmentCard'\nimport type { LockedAttachmentSource, PaymentStatus } from '../../types'\n\nimport { LockBadge } from './LockBadge'\nimport type { LockedCardVariant } from './LockedCardShell'\n\nexport interface LockedThumbnailProps {\n variant: LockedCardVariant\n mimeType: string\n thumbnailUrl?: string\n title?: string\n /**\n * When provided, the underlying source is shown unblurred (preview / unlocked state).\n * When undefined, the thumbnail is treated as locked: blurred with a central lock badge.\n */\n source?: LockedAttachmentSource\n /**\n * Forces the locked appearance even when a source is provided. Used for the\n * Composer card where the locked treatment is the default and the user toggles\n * a preview in place.\n */\n showLocked: boolean\n paymentStatus?: PaymentStatus\n /** Top-right overlay (e.g. dismiss X on Composer). Rendered inside the thumbnail. */\n topRight?: React.ReactNode\n /** When true, renders the unlocked image with aspect-video + object-contain. */\n containedImage?: boolean\n}\n\n/**\n * Renders the 180px-tall media area for a LockedAttachment card.\n * Handles three visual states:\n * - locked: blurred thumbnail + centered 48px lock badge\n * - preview/paid: clear thumbnail (the underlying source)\n * - empty: type-icon placeholder\n */\nconst LockedThumbnail: React.FC<LockedThumbnailProps> = ({\n variant,\n mimeType,\n thumbnailUrl,\n title,\n source,\n showLocked,\n paymentStatus,\n topRight,\n containedImage = false,\n}) => {\n const effectiveSourceUrl = showLocked ? undefined : source?.sourceUrl\n const effectiveThumbnailUrl = showLocked\n ? thumbnailUrl\n : (source?.thumbnailUrl ?? thumbnailUrl)\n\n const isDark = variant === 'dark'\n\n // Locked + unlocked render entirely separate trees so the locked state\n // doesn't end up stacking a blurred `<img>` on top of an underlying\n // `AttachmentThumbnail` (whose `bg-white/10` poster shell otherwise\n // shows through as a visible horizontal seam at the 16:9 boundary).\n //\n // The locked branch uses `filter: blur` on a single full-size `<img>`\n // — not `backdrop-filter` — because `backdrop-filter` paints in its\n // own compositing layer that escapes ancestor `overflow: hidden` on\n // Chrome/Safari and flattens the card's top corners. `filter` is\n // clipped normally, so the rounded corners stay round without any\n // clip-path workarounds.\n return (\n <div className=\"relative overflow-hidden rounded-t-md\">\n {showLocked ? (\n <div\n className={classNames(\n 'relative aspect-video overflow-hidden',\n isDark ? 'bg-white/10' : 'bg-black/5'\n )}\n >\n {effectiveThumbnailUrl ? (\n <img\n src={effectiveThumbnailUrl}\n alt=\"\"\n aria-hidden\n draggable={false}\n // `scale-110` hides the fuzzy semi-transparent edge that\n // `filter: blur` leaves around the image bounds.\n className=\"absolute inset-0 h-full w-full scale-110 object-cover blur-[40px]\"\n />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n {renderTypeIcon(mimeType, {\n className: isDark\n ? 'size-12 text-white/20'\n : 'size-12 text-black/20',\n weight: 'regular',\n })}\n </div>\n )}\n <LockBadge paymentStatus={paymentStatus} mimeType={mimeType} />\n </div>\n ) : (\n <AttachmentThumbnail\n mimeType={mimeType}\n sourceUrl={effectiveSourceUrl}\n thumbnailUrl={effectiveThumbnailUrl}\n title={title}\n variant={variant}\n containedImage={containedImage}\n mediaPlayerProps={\n effectiveSourceUrl\n ? { autoPlay: true, loop: true, controls: true, muted: false }\n : undefined\n }\n />\n )}\n\n {topRight && (\n <div className=\"pointer-events-auto absolute right-3 top-3 z-10\">\n {topRight}\n </div>\n )}\n </div>\n )\n}\n\nexport default LockedThumbnail\n"],"names":["CardBody","variant","title","placeholderTitle","mimeType","detail","statusBadge","action","icon","trailingAction","isDark","displayTitle","titleDimmed","typeIcon","renderTypeIcon","classNames","jsxs","jsx","isPlayableItem","item","sourceType","getSourceType","GalleryThumbnail","gallery","showLocked","paymentStatus","topRight","index","setIndex","useState","total","safeIndex","current","isVideoItem","centerBadge","PlayIcon","LockOpenIcon","LockSimpleIcon","goPrev","e","i","goNext","atStart","atEnd","AttachmentThumbnail","React","CaretLeftIcon","CaretRightIcon","LockedCardShell","children","rootRef","dataTestId","LockBadge","Icon","LockedThumbnail","thumbnailUrl","source","containedImage","effectiveSourceUrl","effectiveThumbnailUrl"],"mappings":"kKA0BMA,EAAoC,CAAC,CACzC,QAAAC,EACA,MAAAC,EACA,iBAAAC,EAAmB,mBACnB,SAAAC,EACA,OAAAC,EACA,YAAAC,EACA,OAAAC,EACA,KAAAC,EACA,eAAAC,CACF,IAAM,CACJ,MAAMC,EAAST,IAAY,OACrBU,EAAeD,EAAUR,GAASC,EAAqBD,GAAS,GAChEU,EAAcF,GAAU,CAACR,EAEzBW,EACJL,GACAM,EAAAA,eAAeV,EAAU,CACvB,UAAWW,EACT,kBACAL,EAAS,gBAAkB,eAAA,EAE7B,OAAQ,SAAA,CACT,EAEH,OACEM,EAAAA,KAAC,MAAA,CAAI,UAAU,YACb,SAAA,CAAAA,EAAAA,KAAC,MAAA,CAAI,UAAU,uBACb,SAAA,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AWD,EACT,wCACAL,EAAS,cAAgB,YAAA,EAG1B,SAAA,CAAAiD,EACC1C,EAAAA,IAAC,MAAA,CACC,IAAK0C,EACL,IAAI,GACJ,cAAW,GACX,UAAW,GAGX,UAAU,mEAAA,CAAA,EAGZ1C,EAAAA,IAAC,MAAA,CAAI,UAAU,oDACZ,0BAAeb,EAAU,CACxB,UAAWM,EACP,wBACA,wBACJ,OAAQ,SAAA,CACT,EACH,EAEFO,EAAAA,IAACmC,EAAA,CAAU,cAAA3B,EAA8B,SAAArB,CAAA,CAAoB,CAAA,CAAA,CAAA,EAG/Da,EAAAA,IAAC2B,EAAAA,oBAAA,CACC,SAAAxC,EACA,UAAWsD,EACX,aAAcC,EACd,MAAAzD,EACA,QAAAD,EACA,eAAAwD,EACA,iBACEC,EACI,CAAE,SAAU,GAAM,KAAM,GAAM,SAAU,GAAM,MAAO,EAAA,EACrD,MAAA,CAAA,EAKThC,GACCT,EAAAA,IAAC,MAAA,CAAI,UAAU,kDACZ,SAAAS,CAAA,CACH,CAAA,EAEJ,CAEJ"}
@@ -0,0 +1,2 @@
1
+ "use strict";const t=require("react/jsx-runtime"),h=require("react"),us=require("@linktr.ee/messaging-core"),_=require("stream-chat-react"),N=require("@phosphor-icons/react"),C=require("classnames"),Te=require("stream-chat-react/experimental"),gt=require("stream-chat"),yt=h.createContext({service:null,client:null,isConnected:!1,isLoading:!1,error:null,capabilities:{},refreshConnection:async()=>{},debug:!1}),Me=()=>h.useContext(yt),ms=({children:e,user:s,serviceConfig:n,apiKey:a,capabilities:r={},debug:i=!1})=>{const o=h.useCallback((k,...M)=>{i&&console.log(`🔥 [MessagingProvider] ${k}`,...M)},[i]);o("🔄 RENDER START",{userId:s==null?void 0:s.id,apiKey:(a==null?void 0:a.substring(0,8))+"...",serviceConfig:!!n,capabilities:Object.keys(r)});const[l,d]=h.useState(null),[m,g]=h.useState(null),[u,x]=h.useState(!1),[c,f]=h.useState(!1),[b,p]=h.useState(null),w=h.useRef(!1),v=h.useRef({userId:s==null?void 0:s.id,apiKey:a,serviceConfig:n,capabilities:r}),I=h.useRef(0);I.current++,o("📊 RENDER INFO",{renderCount:I.current,currentProps:{userId:s==null?void 0:s.id,apiKey:(a==null?void 0:a.substring(0,8))+"..."},propChanges:{userChanged:v.current.userId!==(s==null?void 0:s.id),apiKeyChanged:v.current.apiKey!==a,serviceConfigChanged:v.current.serviceConfig!==n,capabilitiesChanged:v.current.capabilities!==r}}),v.current={userId:s==null?void 0:s.id,apiKey:a,serviceConfig:n,capabilities:r},h.useEffect(()=>{const k=I.current;if(o("🔧 SERVICE INIT EFFECT TRIGGERED",{renderCount:k,apiKey:!!a,serviceConfig:!!n,dependencies:{apiKey:(a==null?void 0:a.substring(0,8))+"...",serviceConfigRef:n,serviceConfigStable:v.current.serviceConfig===n,apiKeyStable:v.current.apiKey===a}}),!a||!n){o("⚠️ SERVICE INIT SKIPPED",{renderCount:k,reason:"Missing apiKey or serviceConfig"});return}o("🚀 CREATING NEW SERVICE",{renderCount:k,apiKey:(a==null?void 0:a.substring(0,8))+"...",serviceConfigChanged:v.current.serviceConfig!==n});const M=new us.StreamChatService({...n,apiKey:a,debug:i});return d(M),o("✅ SERVICE SET",{renderCount:k,serviceInstance:!!M}),()=>{o("🧹 SERVICE CLEANUP",{renderCount:k,reason:"Effect cleanup"}),M.disconnectUser().catch(console.error)}},[a,n,i,o]);const E=h.useRef(null);h.useEffect(()=>{var M,y;if(o("🔗 USER CONNECTION EFFECT TRIGGERED",{hasService:!!l,hasUser:!!s,userId:s==null?void 0:s.id,isConnecting:w.current,isConnected:u,dependencies:{service:!!l,userId:s==null?void 0:s.id}}),!l||!s){o("⚠️ USER CONNECTION SKIPPED","Missing service or user");return}if(w.current){o("⚠️ USER CONNECTION SKIPPED","Already connecting");return}if(((M=E.current)==null?void 0:M.serviceId)===l&&((y=E.current)==null?void 0:y.userId)===s.id){o("⚠️ USER CONNECTION SKIPPED","Already connected this user with this service");return}(async()=>{o("🚀 STARTING USER CONNECTION",{userId:s.id}),w.current=!0,f(!0),p(null);try{o("📞 CALLING SERVICE.CONNECTUSER",{userId:s.id});const T=await l.connectUser(s);g(T),x(!0),E.current={serviceId:l,userId:s.id},o("✅ USER CONNECTION SUCCESS",{userId:s.id,clientId:T.userID})}catch(T){const L=T instanceof Error?T.message:"Connection failed";p(L),o("❌ USER CONNECTION ERROR",{userId:s.id,error:L})}finally{f(!1),w.current=!1,o("🔄 USER CONNECTION FINISHED",{userId:s.id,isConnected:u})}})()},[l,s,o,u]),h.useEffect(()=>(o("🔌 CLEANUP EFFECT REGISTERED",{hasService:!!l,isConnected:u}),()=>{l&&u?(o("🧹 CLEANUP EFFECT TRIGGERED","Cleaning up connection on unmount"),E.current=null,l.disconnectUser().catch(console.error)):o("🔇 CLEANUP EFFECT SKIPPED",{hasService:!!l,isConnected:u})}),[l,u,o]);const R=h.useCallback(async()=>{if(o("🔄 REFRESH CONNECTION CALLED",{hasService:!!l,hasUser:!!s}),!l||!s){o("⚠️ REFRESH CONNECTION SKIPPED","Missing service or user");return}o("🚀 STARTING CONNECTION REFRESH",{userId:s.id}),f(!0);try{o("🔌 DISCONNECTING FOR REFRESH"),await l.disconnectUser(),o("📞 RECONNECTING FOR REFRESH");const k=await l.connectUser(s);g(k),x(!0),p(null),o("✅ CONNECTION REFRESH SUCCESS",{userId:s.id})}catch(k){const M=k instanceof Error?k.message:"Refresh failed";p(M),o("❌ CONNECTION REFRESH ERROR",{userId:s.id,error:M})}finally{f(!1),o("🔄 CONNECTION REFRESH FINISHED",{userId:s.id})}},[l,s,o]),P=h.useMemo(()=>(o("💫 CONTEXT VALUE MEMOIZATION",{hasService:!!l,hasClient:!!m,isConnected:u,isLoading:c,hasError:!!b,capabilitiesKeys:Object.keys(r)}),{service:l,client:m,isConnected:u,isLoading:c,error:b,capabilities:r,refreshConnection:R,debug:i}),[l,m,u,c,b,r,R,i,o]);return o("🔄 RENDER END",{renderCount:I.current,willRenderChat:!!(m&&u),contextValueReady:!!P}),t.jsx(yt.Provider,{value:P,children:m&&u?t.jsx(_.Chat,{client:m,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})},Ct=()=>Me(),St=e=>{var a,r;const[s,n]=h.useState(!!((r=(a=e==null?void 0:e.state)==null?void 0:a.membership)!=null&&r.pinned_at));return h.useEffect(()=>{var o;if(!e){n(!1);return}n(!!((o=e.state.membership)!=null&&o.pinned_at));const i=l=>{var d;n(l!=null&&l.member?!!l.member.pinned_at:!!((d=e.state.membership)!=null&&d.pinned_at))};return e.on("member.updated",i),()=>{e.off("member.updated",i)}},[e]),s},hs=/^[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 kt(e){return hs.test(e.trim())}function bt(e,s){const n=e==null?void 0:e.trim();return!n||s&&n===s?!1:!kt(n)}function Ae(e){return bt(e==null?void 0:e.name,e==null?void 0:e.id)?e.name.trim():bt(e==null?void 0:e.username,e==null?void 0:e.id)?e.username.trim():"Unknown member"}const pt=["🍎","🍌","🍇","🍊","🍓","🥥","🍒","🥭","🍉","🍋","🥝","🫒","🍈"];function xs(e){let s=0;for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);s=(s<<5)-s+a,s=s&s}return Math.abs(s)}function fs(e){const n=xs(e)%pt.length;return pt[n]}const Z=({id:e,image:s,size:n=40,className:a,starred:r=!1,shape:i="squircle",dmAgentEnabled:o=!1})=>{const l=fs(e),m=n<32?"text-xs":n<56?"text-sm":n<120?"text-lg":"text-4xl",g=n>=40?2:1,u=i==="circle"?{borderRadius:"50%"}:{borderRadius:"1rem"},x=t.jsx("div",{className:"h-full w-full overflow-hidden",style:u,children:s?t.jsx("img",{src:s,alt:"",className:"h-full w-full object-cover"}):t.jsx("div",{"aria-hidden":"true",className:C("avatar-fallback flex h-full w-full items-center justify-center bg-[#E6E5E3] font-semibold select-none transition-colors",m),children:l})});return t.jsxs("div",{className:C("relative flex-shrink-0 !bg-transparent",a),style:{"--str-chat__avatar-size":`${n}px`,width:`${n}px`,height:`${n}px`},children:[r&&t.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:t.jsx(N.StarIcon,{className:"size-3 text-yellow-600",weight:"duotone"})}),t.jsx("div",{"data-testid":"avatar-ring",className:C("h-full w-full","bg-transparent"),style:{...u,...o&&{borderWidth:`${g}px`,borderStyle:"solid",borderColor:"var(--AI-Gradient, #7F22FE)",boxShadow:"inset 0 1px 2px 0 rgba(255, 255, 255, 0.5)"}},children:x})]})},gs="https://linktr.ee/s/about/trust-center/report",bs=({channel:e,participant:s,showBlockParticipant:n=!0,enabled:a=!0,onLeaveConversation:r,onBlockParticipant:i,onDeleteConversationClick:o,onBlockParticipantClick:l,onReportParticipantClick:d,onActionComplete:m,logLabel:g="useChannelModerationActions"})=>{var F;const{service:u,debug:x}=Me(),c=(F=s==null?void 0:s.user)==null?void 0:F.id,f=!!(a&&n&&u&&c),[b,p]=h.useState(!1),[w,v]=h.useState(null),[I,E]=h.useState(!1),[R,P]=h.useState(!1),k=f&&((w==null?void 0:w.participantId)!==c||(w==null?void 0:w.service)!==u);return h.useEffect(()=>{if(!f||!u||!c){p(!1),v(null);return}let A=!1;return(async()=>{try{const D=await u.getBlockedUsers();if(A)return;p(D.some(z=>z.blocked_user_id===c))}catch(D){A||console.error(`[${g}] Failed to check blocked status:`,D)}finally{A||v({participantId:c,service:u})}})(),()=>{A=!0}},[f,u,c,g]),{isParticipantBlocked:b,isCheckingBlockedStatus:k,isLeaving:I,isUpdatingBlockStatus:R,handleLeaveConversation:async()=>{var A;if(!I){o==null||o(),x&&console.log(`[${g}] Leave conversation`,e.cid),E(!0);try{const D=((A=e._client)==null?void 0:A.userID)??null;await e.hide(D,!1),r&&await r(e),m==null||m()}catch(D){console.error(`[${g}] Failed to leave conversation`,D)}finally{E(!1)}}},handleBlockUser:async()=>{var A,D,z;if(!(R||!u)){l==null||l(),x&&console.log(`[${g}] Block member`,(A=s==null?void 0:s.user)==null?void 0:A.id),P(!0);try{await u.blockUser((D=s==null?void 0:s.user)==null?void 0:D.id),i&&await i((z=s==null?void 0:s.user)==null?void 0:z.id),m==null||m()}catch(V){console.error(`[${g}] Failed to block member`,V)}finally{P(!1)}}},handleUnblockUser:async()=>{var A,D,z;if(!(R||!u)){l==null||l(),x&&console.log(`[${g}] Unblock member`,(A=s==null?void 0:s.user)==null?void 0:A.id),P(!0);try{await u.unBlockUser((D=s==null?void 0:s.user)==null?void 0:D.id),i&&await i((z=s==null?void 0:s.user)==null?void 0:z.id),m==null||m()}catch(V){console.error(`[${g}] Failed to unblock member`,V)}finally{P(!1)}}},handleReportUser:()=>{d==null||d(),m==null||m(),window.open(gs,"_blank","noopener,noreferrer")}}},ae=({variant:e="default",className:s,children:n,...a})=>{const r=e==="danger";return t.jsx("button",{type:"button",className:C("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",r?"text-danger hover:bg-danger/50":"text-charcoal hover:bg-sand",s),...a,children:n})},vt=({channel:e,participant:s,showDeleteConversation:n=!0,showBlockParticipant:a=!0,showReportParticipant:r=!0,onLeaveConversation:i,onBlockParticipant:o,onDeleteConversationClick:l,onBlockParticipantClick:d,onReportParticipantClick:m,customChannelActions:g,triggerClassName:u})=>{const[x,c]=h.useState(!1),f=h.useRef(null),b=h.useId(),p=h.useCallback(()=>c(!1),[]),{isParticipantBlocked:w,isCheckingBlockedStatus:v,isLeaving:I,isUpdatingBlockStatus:E,handleLeaveConversation:R,handleBlockUser:P,handleUnblockUser:k,handleReportUser:M}=bs({channel:e,participant:s,showBlockParticipant:a,enabled:x,onLeaveConversation:i,onBlockParticipant:o,onDeleteConversationClick:l,onBlockParticipantClick:d,onReportParticipantClick:m,onActionComplete:p,logLabel:"ChannelActionsMenu"});return h.useEffect(()=>{if(!x)return;const T=F=>{f.current&&!f.current.contains(F.target)&&c(!1)},L=F=>{F.key==="Escape"&&c(!1)};return document.addEventListener("mousedown",T),document.addEventListener("keydown",L),()=>{document.removeEventListener("mousedown",T),document.removeEventListener("keydown",L)}},[x]),!s||!(n||a||r||!!g)?null:t.jsxs("div",{ref:f,className:"relative",children:[t.jsxs("button",{className:u,type:"button","aria-haspopup":"true","aria-expanded":x,"aria-controls":x?b:void 0,onClick:()=>c(T=>!T),children:[t.jsx(N.DotsThreeIcon,{className:"size-5 text-black/90"}),t.jsx("span",{className:"sr-only",children:"More options"})]}),x&&t.jsx("div",{id:b,"aria-label":"Conversation options",className:C("absolute right-0 top-full z-50 mt-2 w-56 overflow-hidden","rounded-lg border border-sand bg-white p-1 shadow-max-elevation-light"),children:t.jsxs("ul",{className:"flex flex-col gap-1",children:[n&&t.jsx("li",{children:t.jsxs(ae,{onClick:R,disabled:I,"aria-busy":I,children:[I?t.jsx(N.SpinnerGapIcon,{className:"h-5 w-5 animate-spin"}):t.jsx(N.SignOutIcon,{className:"h-5 w-5"}),t.jsx("span",{children:"Delete Conversation"})]})}),a&&t.jsx("li",{children:v?t.jsxs(ae,{disabled:!0,"aria-busy":!0,children:[t.jsx(N.SpinnerGapIcon,{className:"h-5 w-5 animate-spin"}),t.jsx("span",{children:"Block"})]}):w?t.jsxs(ae,{onClick:k,disabled:E,"aria-busy":E,children:[E?t.jsx(N.SpinnerGapIcon,{className:"h-5 w-5 animate-spin"}):t.jsx(N.ProhibitInsetIcon,{className:"h-5 w-5"}),t.jsx("span",{children:"Unblock"})]}):t.jsxs(ae,{onClick:P,disabled:E,"aria-busy":E,children:[E?t.jsx(N.SpinnerGapIcon,{className:"h-5 w-5 animate-spin"}):t.jsx(N.ProhibitInsetIcon,{className:"h-5 w-5"}),t.jsx("span",{children:"Block"})]})}),r&&t.jsx("li",{children:t.jsxs(ae,{variant:"danger",onClick:M,children:[t.jsx(N.FlagIcon,{className:"h-5 w-5"}),t.jsx("span",{children:"Report"})]})}),g]})})]})},ps=e=>t.jsx(_.DateSeparator,{...e,position:"center"}),ke="vote_up",Ee="vote_down";function vs(e){return e!=null&&e.length?e.some(s=>s.type===Ee)?"down":e.some(s=>s.type===ke)?"up":null:null}function Et(e){const{channel:s}=_.useChannelStateContext(),{client:n}=_.useChatContext("useMessageVote"),a=h.useMemo(()=>vs(e.own_reactions),[e.own_reactions]),r=h.useCallback(async()=>{if(n!=null&&n.userID)try{a==="up"?await s.deleteReaction(e.id,ke):await s.sendReaction(e.id,{type:ke},{enforce_unique:!0,skip_push:!0})}catch{}},[s,n==null?void 0:n.userID,e.id,a]),i=h.useCallback(async()=>{if(n!=null&&n.userID)try{a==="down"?await s.deleteReaction(e.id,Ee):await s.sendReaction(e.id,{type:Ee},{enforce_unique:!0,skip_push:!0})}catch{}},[s,n==null?void 0:n.userID,e.id,a]);return{selected:a,voteUp:r,voteDown:i}}function It(e){return(e==null?void 0:e.trim().toLowerCase().split(/[-_]/)[0])||void 0}function Re({message:e,viewerLanguage:s}){var r;const n=e==null?void 0:e.text,a=It(s);return a?((r=e==null?void 0:e.i18n)==null?void 0:r[`${a}_text`])??n:n}const js=h.lazy(()=>Promise.resolve().then(()=>require("./Card-Ch3cTL6G.cjs"))),ws=h.lazy(()=>Promise.resolve().then(()=>require("./Card-DezN34Sz.cjs"))),_s=h.lazy(()=>Promise.resolve().then(()=>require("./Card-DiSXLhzw.cjs"))),Le=()=>t.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}),Ns=e=>t.jsx(h.Suspense,{fallback:t.jsx(Le,{}),children:t.jsx(js,{...e})}),Tt=e=>t.jsx(h.Suspense,{fallback:t.jsx(Le,{}),children:t.jsx(ws,{...e})}),Mt=e=>t.jsx(h.Suspense,{fallback:t.jsx(Le,{}),children:t.jsx(_s,{...e})}),ys=Tt,Cs=Mt,Ie={Composer:Ns,Sent:Tt,Received:Mt,Creator:ys,Visitor:Cs},Ss=[[/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 K(e){return e.startsWith("video/")?"video":e.startsWith("audio/")?"audio":e.startsWith("image/")?"image":"document"}function At(e){const s=Ss.find(([n])=>n.test(e));return s?s[1]:"generic"}const ks={video:N.VideoCameraIcon,audio:N.SpeakerHighIcon,image:N.ImageIcon,document:N.FileIcon},Es={pdf:N.FilePdfIcon,doc:N.FileDocIcon,xls:N.FileXlsIcon,csv:N.FileCsvIcon,ppt:N.FilePptIcon,zip:N.FileZipIcon,text:N.FileTextIcon,markdown:N.FileMdIcon,generic:N.FileIcon};function Is(e){const s=K(e);return s!=="document"?ks[s]:Es[At(e)]}function ee(e,s){return h.createElement(Is(e),s)}const Ts=e=>{var s,n;return"touches"in e?((s=e.touches[0])==null?void 0:s.clientX)??((n=e.changedTouches[0])==null?void 0:n.clientX)??0:e.clientX},Ms=({source:e,mimeType:s,poster:n,autoPlay:a=!1,playing:r,loop:i=!1,controls:o=!0,showProgress:l=!1,muted:d=!1,onContainerClick:m})=>{const g=K(s),u=h.useRef(null),x=h.useRef(null),c=h.useRef(null),f=h.useRef(r),[b,p]=h.useState(a),[w,v]=h.useState(0),[I,E]=h.useState(!1),[R,P]=h.useState(!1),[k,M]=h.useState(!1),[y,T]=h.useState(!1),[L,F]=h.useState(!0),[A,D]=h.useState(null),z=h.useCallback(()=>{M(!1),p(!0)},[]),V=h.useCallback(j=>{const S=x.current;if(!S)return 0;const U=S.getBoundingClientRect();return Math.max(0,Math.min(1,(Ts(j)-U.left)/U.width))},[]),$=h.useCallback(j=>{const S=u.current;S&&S.duration&&(S.currentTime=j*S.duration)},[]),B=j=>{j.stopPropagation(),E(!0);const S=V(j);v(S),$(S)};h.useEffect(()=>{r!==void 0&&r!==f.current&&(f.current=r,p(r))},[r]),h.useEffect(()=>{if(!b){c.current!==null&&(cancelAnimationFrame(c.current),c.current=null);return}const j=()=>{const S=u.current;S&&S.duration&&!I&&v(S.currentTime/S.duration),c.current=requestAnimationFrame(j)};return c.current=requestAnimationFrame(j),()=>{c.current!==null&&cancelAnimationFrame(c.current)}},[b,I]),h.useEffect(()=>{const j=u.current;j&&(b?j.play().catch(S=>{p(!1),M(!0)}):j.pause())},[b]),h.useEffect(()=>{if(!I)return;const j=U=>v(V(U)),S=U=>{E(!1),$(V(U))};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",S),window.addEventListener("touchmove",j,{passive:!0}),window.addEventListener("touchend",S),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",S),window.removeEventListener("touchmove",j),window.removeEventListener("touchend",S)}},[I,V,$]);const Y=A?{aspectRatio:String(A)}:void 0,G=A?"":" aspect-video",O=Math.round(w*100);return t.jsxs("div",{role:"button",tabIndex:0,className:`relative cursor-pointer overflow-hidden bg-black ${G}`,style:Y,onClick:j=>{if(m){m(j);return}k||o&&p(S=>!S)},onKeyDown:j=>{if(!(j.key!=="Enter"&&j.key!==" ")){if(j.preventDefault(),m){m(j);return}k||o&&p(S=>!S)}},children:[n&&(g==="audio"||L)&&t.jsx("img",{src:n,alt:"",className:"absolute inset-0 h-full w-full object-cover"}),!n&&(g==="audio"||L)&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:ee(s,{className:"size-12 text-black/20",weight:"regular"})}),t.jsx("div",{className:"absolute inset-0",children:g==="audio"?t.jsx("audio",{ref:u,src:e,loop:i,muted:d,style:{width:"100%",height:"100%"},onLoadStart:()=>T(!0),onCanPlay:()=>{T(!1),F(!1)},onWaiting:()=>T(!0),onPlay:()=>M(!1),onEnded:()=>{i||(p(!1),v(0))},children:t.jsx("track",{kind:"captions"})}):t.jsx("video",{ref:u,src:e,loop:i,muted:d,playsInline:!0,style:{width:"100%",height:"100%"},onLoadStart:()=>T(!0),onCanPlay:()=>{T(!1),F(!1)},onWaiting:()=>T(!0),onPlay:()=>M(!1),onLoadedMetadata:()=>{const j=u.current;j instanceof HTMLVideoElement&&j.videoWidth&&j.videoHeight&&D(j.videoWidth/j.videoHeight)},onEnded:()=>{i||(p(!1),v(0))},children:t.jsx("track",{kind:"captions"})})}),y&&!k&&t.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:t.jsx(N.CircleNotchIcon,{className:"size-8 animate-spin text-white/80",weight:"bold"})}),k&&!o&&t.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:j=>{j.stopPropagation(),z()},onKeyDown:j=>{j.key!=="Enter"&&j.key!==" "||(j.preventDefault(),j.stopPropagation(),z())},children:t.jsx("span",{className:"flex size-16 items-center justify-center rounded-full bg-white/20 text-white backdrop-blur-sm",children:t.jsx(N.PlayIcon,{className:"size-9 translate-x-0.5",weight:"fill"})})}),l&&!o&&t.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:t.jsx("div",{role:"slider","aria-label":"Playback position","aria-valuenow":O,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0,ref:x,className:"relative flex h-4 w-full cursor-pointer items-center",onMouseDown:B,onTouchStart:B,onClick:j=>j.stopPropagation(),onKeyDown:j=>{j.key==="ArrowRight"&&$(Math.min(1,w+.05)),j.key==="ArrowLeft"&&$(Math.max(0,w-.05))},children:t.jsx("div",{className:"w-full overflow-hidden rounded-full bg-white/30 h-1",children:t.jsx("div",{className:"h-full rounded-full bg-white",style:{width:`${O}%`}})})})}),o&&t.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:[t.jsx("button",{type:"button",onClick:j=>{j.stopPropagation(),p(S=>!S)},className:"shrink-0 text-white","aria-label":b?"Pause":"Play",children:b?t.jsx(N.PauseIcon,{className:"size-5",weight:"fill"}):t.jsx(N.PlayIcon,{className:"size-5 translate-x-px",weight:"fill"})}),t.jsxs("div",{role:"slider","aria-label":"Playback position","aria-valuenow":O,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0,ref:x,className:"relative flex h-4 w-full cursor-pointer items-center",onMouseDown:B,onTouchStart:B,onClick:j=>j.stopPropagation(),onMouseEnter:()=>P(!0),onMouseLeave:()=>P(!1),onKeyDown:j=>{j.key==="ArrowRight"&&$(Math.min(1,w+.05)),j.key==="ArrowLeft"&&$(Math.max(0,w-.05))},children:[t.jsx("div",{className:`w-full overflow-hidden rounded-full bg-white/30 transition-all duration-200 ${R||I?"h-1.5":"h-1"}`,children:t.jsx("div",{className:"h-full rounded-full bg-white",style:{width:`${O}%`}})}),t.jsx("div",{className:`absolute size-3 -translate-x-1/2 rounded-full bg-white shadow transition-[opacity,transform] duration-200 ${R||I?"scale-100 opacity-100":"scale-0 opacity-0"}`,style:{left:`${O}%`}})]})]})]})},jt=e=>e==="dark"?"size-12 text-white/20":"size-12 text-black/20",As=e=>e==="dark"?"aspect-video overflow-hidden bg-white/10":"aspect-video overflow-hidden bg-black/5",De=({mimeType:e,sourceUrl:s,thumbnailUrl:n,title:a,variant:r,mediaPlayerProps:i,containedImage:o=!1})=>{const l=K(e),[d,m]=h.useState(!1);return s&&(l==="video"||l==="audio")?t.jsx(Ms,{source:s,mimeType:e,poster:n,controls:!0,...i}):s&&l==="image"?o?t.jsx("div",{className:"relative aspect-video overflow-hidden bg-black/5",children:t.jsx("img",{src:s,alt:a??"",className:`absolute inset-0 h-full w-full object-contain transition-opacity duration-300 ${d?"opacity-100":"opacity-0"}`,draggable:!1,onLoad:()=>m(!0)})}):t.jsx("img",{src:s,alt:a??"",className:"block w-full",draggable:!1}):s&&l==="document"?n?o?t.jsx("div",{className:"relative aspect-video overflow-hidden bg-black/5",children:t.jsx("img",{src:n,alt:a??"",className:`absolute inset-0 h-full w-full object-contain transition-opacity duration-300 ${d?"opacity-100":"opacity-0"}`,draggable:!1,onLoad:()=>m(!0)})}):t.jsx("img",{src:n,alt:"",className:"block w-full",draggable:!1}):t.jsx("div",{className:`flex aspect-video w-full items-center justify-center ${r==="dark"?"bg-white/10":"bg-black/5"}`,children:ee(e,{className:jt(r),weight:"regular"})}):n?t.jsx("div",{className:`relative ${As(r)}`,children:t.jsx("img",{src:n,alt:a??"",draggable:!1,className:"absolute inset-0 h-full w-full object-cover"})}):t.jsx("div",{className:`flex aspect-video w-full items-center justify-center ${r==="dark"?"bg-white/10":"bg-black/5"}`,children:ee(e,{className:jt(r),weight:"regular"})})},Rt=({variant:e,thumbnail:s,title:n,placeholderTitle:a="Attachment title",mimeType:r,detail:i,statusBadge:o,action:l,topLeft:d,topRight:m,rootRef:g,"data-testid":u})=>{const x=e==="dark",c=x?n??a:n??"",f=x&&!n;return t.jsxs("div",{ref:g,"data-testid":u,className:C("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)]",x?"bg-[#121110]":"bg-white"),children:[d?t.jsx("div",{className:"pointer-events-auto absolute left-3 top-3 z-50",children:d}):null,m?t.jsx("div",{className:"pointer-events-auto absolute right-3 top-3 z-50",children:m}):null,s,t.jsxs("div",{className:"px-4 pb-3 pt-3",children:[c.trim()!==""&&t.jsx("p",{className:C("mb-0.5 truncate text-base font-medium",{"text-black":!x,"text-white/30":x&&f,"text-white":x&&!f}),children:c}),t.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[ee(r,{className:C("size-5 shrink-0",x?"text-white/55":"text-black/55"),weight:"regular"}),i!=null&&i!==""&&t.jsx("span",{className:C("text-xs font-medium",x?"text-white/55":"text-black/55"),children:i}),o]}),l]})]})};function Lt(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Pe(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 Rs(e){return e?"bg-white/10":"bg-black/5"}function Ls(e){return e?"text-white":"text-black"}function Ds(e){return e?"text-white/55":"text-black/55"}function Ps(e){return e?"text-white/40":"text-black/40"}function Os(e){return e?"text-white/20":"text-black/20"}const Oe=({attachment:e,isMyMessage:s})=>{const{title:n,text:a,image_url:r,og_scrape_url:i,title_link:o}=e,l=i??o,d=typeof l=="string"&&l.trim()!==""?l:void 0,m=t.jsxs(h.Fragment,{children:[t.jsx("div",{className:"p-2",children:r?t.jsx("img",{src:r,alt:n??"",className:"aspect-video w-full rounded-[20px] object-cover"}):t.jsx("div",{className:`aspect-video w-full rounded-[20px] ${Rs(s)} flex items-center justify-center`,children:t.jsx(N.LinkIcon,{className:`size-12 ${Os(s)}`})})}),t.jsxs("div",{className:"px-3 pb-3",children:[n&&t.jsx("p",{className:`truncate text-[14px] font-medium leading-5 ${Ls(s)}`,children:n}),a&&t.jsx("p",{className:`truncate text-[12px] leading-4 ${Ds(s)}`,children:a}),d&&t.jsx("p",{className:`mt-1 truncate text-[12px] leading-4 ${Ps(s)}`,children:d})]})]});return d?t.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:"block no-underline",children:m}):t.jsx("div",{className:"block",children:m})};function ze(e){return e.type==="link"||!!e.og_scrape_url&&!e.asset_url}function ve(e){var s;return(s=e.attachments)==null?void 0:s.find(ze)}async function zs(e,s){let n;try{n=s??new URL(e).pathname.split("/").pop()??"download"}catch{n=s??"download"}const a=await fetch(e,{mode:"cors"});if(!a.ok)throw new Error(`HTTP ${a.status}`);const r=await a.blob(),i=URL.createObjectURL(r),o=document.createElement("a");o.href=i,o.download=n,o.style.display="none",document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(i)}const Fs=({url:e,filename:s})=>{const[n,a]=h.useState(!1),r=i=>{i.stopPropagation();const o=window.open("","_blank","noopener,noreferrer");a(!0),zs(e,s).then(()=>{o==null||o.close()}).catch(()=>{o&&(o.location.href=e)}).finally(()=>a(!1))};return t.jsx("button",{type:"button",onClick:r,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?t.jsx(N.CircleNotchIcon,{className:"size-4 animate-spin text-white",weight:"bold"}):t.jsxs(h.Fragment,{children:[t.jsx(N.DownloadSimpleIcon,{className:"size-4 text-white",weight:"bold"}),"Download"]})})};function je(e){var u,x,c,f;const s=(u=e.attachments)==null?void 0:u.find(b=>b.type==="video"&&b.asset_url),n=(x=e.attachments)==null?void 0:x.find(b=>b.type==="image"&&b.image_url),a=(c=e.attachments)==null?void 0:c.find(b=>b.type==="audio"&&b.asset_url),r=(f=e.attachments)==null?void 0:f.find(b=>b.type==="file"&&b.asset_url),i=s??n??a??r,o=(s==null?void 0:s.asset_url)??(n==null?void 0:n.image_url)??(a==null?void 0:a.asset_url)??(r==null?void 0:r.asset_url);if(!o)return null;const l=(i==null?void 0:i.mime_type)??((i==null?void 0:i.type)==="image"?"image/jpeg":(i==null?void 0:i.type)==="video"?"video/mp4":(i==null?void 0:i.type)==="audio"?"audio/mpeg":"application/octet-stream"),d=i==null?void 0:i.title,m=i==null?void 0:i.file_size,g=s==null?void 0:s.thumb_url;return{resolvedUrl:o,resolvedType:l,title:d,fileSize:m,thumbnailUrl:g}}const Dt=({resolvedUrl:e,resolvedType:s,title:n,fileSize:a,thumbnailUrl:r})=>{const i=a!==void 0?Lt(a):void 0;return t.jsx(Rt,{variant:"dark",title:n,placeholderTitle:"",mimeType:s,detail:i,thumbnail:t.jsx(De,{mimeType:s,sourceUrl:e,thumbnailUrl:r,title:n,variant:"dark"})})},Pt=({resolvedUrl:e,resolvedType:s,title:n,fileSize:a,thumbnailUrl:r})=>{const i=K(s),o=a!==void 0?Lt(a):void 0;return t.jsx(Rt,{variant:"light",title:n,mimeType:s,detail:o,thumbnail:t.jsx(De,{mimeType:s,sourceUrl:e,thumbnailUrl:r,title:n,variant:"light",containedImage:i==="image"||i==="document"}),action:t.jsx(Fs,{url:e,filename:n})})},$s=({message:e,isMyMessage:s=!1})=>{const n=ve(e),a=je(e);if(!n&&!a)return null;const r=s?"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 t.jsxs("div",{className:r,children:[!s&&e.user&&t.jsx(Z,{className:"str-chat__avatar str-chat__message-sender-avatar",id:e.user.id,image:e.user.image,name:e.user.name??e.user.id}),t.jsx("div",{className:"str-chat__message-inner",style:{marginInlineEnd:0,marginInlineStart:0},children:t.jsx("div",{className:"str-chat__message-bubble-wrapper",children:t.jsx("div",{className:"str-chat__message-bubble",style:{padding:0,borderRadius:0,overflow:"visible",background:"transparent"},children:n?t.jsx("div",{className:Pe(s),children:t.jsx(Oe,{attachment:n,isMyMessage:s})}):s?t.jsx(Dt,{...a}):t.jsx(Pt,{...a})})})})]})},Bs=({message:e})=>{const s=ve(e);if(s)return t.jsx("div",{className:Pe(!0),children:t.jsx(Oe,{attachment:s,isMyMessage:!0})});const n=je(e);return n?t.jsx(Dt,{...n}):null},Us=({message:e})=>{const s=ve(e);if(s)return t.jsx("div",{className:Pe(!1),children:t.jsx(Oe,{attachment:s,isMyMessage:!1})});const n=je(e);return n?t.jsx(Pt,{...n}):null},Vs=Object.assign($s,{Creator:Bs,Visitor:Us}),Gs={isUnlocking:()=>!1},Hs={LockedAttachment:Gs},Ot=h.createContext({}),Ys=Ot.Provider;function zt(e){return h.useContext(Ot)[e]??Hs[e]}const qs=({size:e=15})=>t.jsx("svg",{width:e,height:e,viewBox:"0 0 15 15",fill:"none","aria-hidden":"true",children:t.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})}),Ws=e=>{var s;return((s=e.metadata)==null?void 0:s.custom_type)==="MESSAGE_TIP"},Xs=e=>{var s;return((s=e.metadata)==null?void 0:s.custom_type)==="MESSAGE_PAID"},fe=e=>{var s;return((s=e.metadata)==null?void 0:s.custom_type)==="MESSAGE_CHATBOT"},Ks=e=>{var s;return((s=e.metadata)==null?void 0:s.custom_type)==="MESSAGE_ATTACHMENT"},Ft=e=>Ws(e)||Xs(e),Js=e=>{var s;return Ft(e)&&!((s=e.text)!=null&&s.trim())},Ne=({message:e,standalone:s=!1,isMyMessage:n=!1,hasAttachment:a=!1})=>{var u;const r=Ft(e),i=fe(e);if(!r&&!i)return null;if(r){const x=(u=e.metadata)==null?void 0:u.amount_text;if(!x)return null;const c=s?"message-tip-standalone":"message-tag message-tag--tip",f=s?`${x} tip`:`Delivered with ${x} tip`;return t.jsxs("div",{className:c,children:[t.jsx(N.GiftIcon,{size:s?14:12}),t.jsx("span",{children:f})]})}const o=n&&a,l=o?"Sent with AI":"Sent with DM Agent",d=["message-chatbot-indicator",n?"message-chatbot-indicator--sender":"message-chatbot-indicator--receiver",o?"message-chatbot-indicator--attachment":"message-chatbot-indicator--text"].join(" "),m=t.jsx("span",{className:"message-chatbot-indicator__label",children:l}),g=t.jsx("span",{className:"message-chatbot-indicator__icon",children:t.jsx(qs,{size:o?12:15})});return t.jsx("div",{className:d,"data-testid":"message-chatbot-indicator",children:n&&!o?t.jsxs(t.Fragment,{children:[m,g]}):t.jsxs(t.Fragment,{children:[g,m]})})},$t=({selected:e,onVoteUp:s,onVoteDown:n})=>t.jsxs("div",{className:"message-vote-buttons",children:[t.jsx("button",{type:"button",className:C("message-vote-button focus-ring",{"message-vote-button--selected":e==="up"}),onClick:s,"aria-label":"Good response","aria-pressed":e==="up","data-tooltip":"Good response",children:t.jsx(N.ThumbsUpIcon,{size:16,weight:e==="up"?"fill":"regular"})}),t.jsx("button",{type:"button",className:C("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:t.jsx(N.ThumbsDownIcon,{size:16,weight:e==="down"?"fill":"regular"})})]}),Zs=e=>{var et,tt,st,nt,at,rt,it,ot,lt,ct,dt,ut,mt,ht;const{additionalMessageInputProps:s,chatbotVotingEnabled:n,editing:a,endOfGroup:r,firstOfGroup:i,groupedByUser:o,handleAction:l,handleOpenThread:d,handleRetry:m,highlighted:g,isMessageAIGenerated:u,isMyMessage:x,message:c,renderText:f,threadList:b,viewerLanguage:p}=e,{client:w}=_.useChatContext("CustomMessage"),{channel:v}=_.useChannelStateContext("CustomMessage"),{isUnlocking:I,onUnlockClick:E,onFetchSource:R,onDownloadClick:P}=zt("LockedAttachment"),[k,M]=h.useState(!1),y=_.useMessageReminder(c.id),{selected:T,voteUp:L,voteDown:F}=Et(c),{Attachment:A=_.Attachment,EditMessageModal:D=_.EditMessageModal,MessageActions:z,MessageBlocked:V=_.MessageBlocked,MessageBouncePrompt:$=_.MessageBouncePrompt,MessageDeleted:B=_.MessageDeleted,MessageIsThreadReplyInChannelButtonIndicator:Y=_.MessageIsThreadReplyInChannelButtonIndicator,MessageRepliesCountButton:G=_.MessageRepliesCountButton,ReminderNotification:O=_.ReminderNotification,StreamedMessageText:j=_.StreamedMessageText,PinIndicator:S}=_.useComponentContext("CustomMessage"),U=_.messageHasAttachments(c),H=_.messageHasReactions(c),he=h.useMemo(()=>u==null?void 0:u(c),[u,c]),q=h.useMemo(()=>{const oe=c.attachments??[],xe=c.shared_location?[c.shared_location,...oe]:oe;if(!fe(c))return xe;const xt=xe.filter(ft=>!("type"in ft)||!ze(ft));return xt.length===xe.length?xe:xt},[c]),te=h.useMemo(()=>{const oe=Re({message:c,viewerLanguage:p});return oe===c.text?c:{...c,text:oe}},[c,p]);if(_.isDateSeparatorMessage(c))return null;if(c.deleted_at||c.type==="deleted")return t.jsx(B,{message:c});if(_.isMessageBlocked(c))return t.jsx(V,{});const W=!b&&!!c.reply_count,Q=!b&&c.show_in_channel&&c.parent_id,J=c.status==="failed"&&((et=c.error)==null?void 0:et.status)!==403,Xe=_.isMessageBounced(c);let se;J?se=()=>m(c):Xe&&(se=()=>M(!0));const re=x(),ds=C("str-chat__message str-chat__message-simple",`str-chat__message--${c.type}`,`str-chat__message--${c.status}`,re?"str-chat__message--me str-chat__message-simple--me":"str-chat__message--other",c.text?"str-chat__message--has-text":"has-no-text",{"str-chat__message--has-attachment":U,"str-chat__message--highlighted":g,"str-chat__message--pinned pinned-message":c.pinned,"str-chat__message--with-reactions":H,"str-chat__message-send-can-be-retried":(c==null?void 0:c.status)==="failed"&&((tt=c==null?void 0:c.error)==null?void 0:tt.status)!==403,"str-chat__message-with-thread-link":W||Q,"str-chat__virtual-message__wrapper--end":r,"str-chat__virtual-message__wrapper--first":i,"str-chat__virtual-message__wrapper--group":o}),Ke=c.poll_id&&w.polls.fromState(c.poll_id),Je=Js(c),ie=fe(c),Ze=Ks(c),_e=!!(q!=null&&q.length&&!c.quoted_message),Qe=ie&&re&&_e;return t.jsxs(t.Fragment,{children:[a&&t.jsx(D,{additionalMessageInputProps:s}),k&&t.jsx(_.MessageBounceModal,{MessageBouncePrompt:$,onClose:()=>M(!1),open:k}),t.jsxs("div",{className:ds,"data-message-id":c.id,children:[S&&t.jsx(S,{}),!!y&&t.jsx(O,{reminder:y}),c.user&&t.jsx(Z,{className:"str-chat__avatar str-chat__message-sender-avatar",id:c.user.id,image:c.user.image,name:c.user.name||c.user.id,size:24,shape:"circle",dmAgentEnabled:ie}),t.jsx("div",{className:C("str-chat__message-inner",{"str-chat__simple-message--error-failed":J||Xe}),"data-testid":"message-inner",onClick:se,onKeyDown:se,role:se?"button":void 0,tabIndex:se?0:void 0,style:{marginInlineEnd:0,marginInlineStart:0},children:Ze?t.jsxs("div",{className:"str-chat__message-bubble-wrapper",children:[re?t.jsxs("div",{className:"flex items-center gap-2",children:[z&&t.jsx(z,{}),t.jsx(Ie.Sent,{title:(st=c.metadata)==null?void 0:st.attachment_title,mimeType:(nt=c.metadata)==null?void 0:nt.attachment_mime_type,thumbnailUrl:(at=c.metadata)==null?void 0:at.attachment_thumbnail,amountText:(rt=c.metadata)==null?void 0:rt.amount_text,detail:(it=c.metadata)==null?void 0:it.attachment_detail,paymentStatus:(ot=c.metadata)==null?void 0:ot.payment_status,onPreviewClick:()=>E==null?void 0:E(c,v),onFetchSource:async()=>await(R==null?void 0:R(c,v))})]}):t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ie.Received,{title:(lt=c.metadata)==null?void 0:lt.attachment_title,mimeType:(ct=c.metadata)==null?void 0:ct.attachment_mime_type,thumbnailUrl:(dt=c.metadata)==null?void 0:dt.attachment_thumbnail,amountText:(ut=c.metadata)==null?void 0:ut.amount_text,detail:(mt=c.metadata)==null?void 0:mt.attachment_detail,paymentStatus:(ht=c.metadata)==null?void 0:ht.payment_status,isUnlocking:I(c.id),onUnlockClick:()=>E==null?void 0:E(c,v),onFetchSource:async()=>await(R==null?void 0:R(c,v)),onDownloadClick:()=>P==null?void 0:P(c,v)}),z&&t.jsx(z,{})]}),c.text&&t.jsx("div",{className:"str-chat__message-bubble",children:t.jsx(_.MessageText,{message:te,renderText:f})})]}):Je?t.jsx(Ne,{message:c,standalone:!0}):t.jsx("div",{className:"str-chat__message-bubble-wrapper",children:t.jsxs("div",{className:"str-chat__message-bubble",children:[ie&&!Qe&&t.jsx(Ne,{message:c,hasAttachment:_e,isMyMessage:re}),Ke&&t.jsx(_.Poll,{poll:Ke}),q!=null&&q.length&&!c.quoted_message?t.jsx(A,{actionHandler:l,attachments:q}):null,he?t.jsx(j,{message:te,renderText:f}):t.jsx(_.MessageText,{message:te,renderText:f}),t.jsx(_.MessageErrorIcon,{})]})})}),!Ze&&!Je&&t.jsxs("div",{className:"str-chat__message-footer",children:[(!ie||Qe)&&t.jsx(Ne,{message:c,hasAttachment:_e,isMyMessage:re}),n&&ie&&t.jsx($t,{selected:T,onVoteUp:L,onVoteDown:F})]}),W&&t.jsx(G,{onClick:d,reply_count:c.reply_count}),Q&&t.jsx(Y,{})]},c.id)]})},Qs=h.memo(Zs,(e,s)=>e.chatbotVotingEnabled!==s.chatbotVotingEnabled||e.viewerLanguage!==s.viewerLanguage?!1:_.areMessageUIPropsEqual(e,s)),en=e=>{const s=_.useMessageContext("CustomMessage");return t.jsx(Qs,{...s,...e})},tn=()=>{var n;const{handleDelete:e,message:s}=_.useMessageContext("CustomMessageActions");return((n=s.metadata)==null?void 0:n.payment_status)==="paid"?null:t.jsx(Te.DefaultDropdownActionButton,{onClick:e,"aria-label":"Delete",title:"Delete",className:"bg-marble rounded-full p-2 hover:bg-sand transition-all",children:t.jsx(N.TrashSimpleIcon,{size:16,weight:"light","aria-hidden":!0})})},sn=()=>{const{handleFlag:e}=_.useMessageContext("CustomMessageActions");return t.jsx(Te.DefaultDropdownActionButton,{onClick:e,"aria-label":"Report",title:"Report",className:"bg-marble rounded-full p-2 hover:bg-sand transition-all",children:t.jsx(N.FlagIcon,{size:16,weight:"light","aria-hidden":!0})})},nn=()=>{var s;const{message:e}=_.useMessageContext("CustomMessageActions");return((s=e.metadata)==null?void 0:s.custom_type)!=="MESSAGE_ATTACHMENT"?null:t.jsx(Te.MessageActions,{messageActionSet:[{Component:tn,placement:"quick",type:"delete"},{Component:sn,placement:"quick",type:"flag"}]})},an=({link:e,onDismiss:s})=>{const{og_scrape_url:n,title:a,image_url:r}=e,i=o=>{o.preventDefault(),s(n)};return t.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"relative block w-full rounded-[24px] bg-[#121110] p-2 no-underline transition-opacity hover:opacity-90",children:[r&&t.jsx("img",{src:r,alt:a||"",className:"h-[180px] w-full rounded-[20px] object-cover"}),t.jsx("button",{type:"button",onClick:i,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:t.jsx(N.XIcon,{className:"size-4 text-black/90"})}),t.jsxs("div",{className:"p-2",children:[a&&t.jsx("div",{className:"truncate text-[14px] font-medium leading-5 text-white",children:a}),t.jsx("div",{className:"truncate text-[12px] leading-4 text-white/55",children:n})]})]})},rn=e=>({linkPreviews:Array.from(e.previews.values()).filter(s=>gt.LinkPreviewsManager.previewIsLoaded(s)||gt.LinkPreviewsManager.previewIsLoading(s))}),on=()=>{const{linkPreviewsManager:e}=_.useMessageComposer(),{linkPreviews:s}=_.useStateStore(e.state,rn),n=r=>{e.dismissPreview(r)};return s.length>0?t.jsx("div",{className:"flex flex-col items-stretch w-full gap-2 mb-4",children:s.map(r=>t.jsx(an,{link:r,onDismiss:n},r.og_scrape_url))}):null},Bt=h.createContext(!1),ln=({sendMessage:e,disabled:s,...n})=>t.jsx("button",{...n,type:"button","aria-label":"Send",disabled:s,onClick:e,children:t.jsx(N.ArrowUpIcon,{weight:"bold",className:"size-4"})}),cn=()=>{const e=h.useContext(Bt),{handleSubmit:s}=_.useMessageInputContext(),n=_.useMessageComposerHasSendableData(),a=e||!n,{SendButton:r=ln,AttachmentPreviewList:i=_.AttachmentPreviewList}=_.useComponentContext("CustomMessageInput");return t.jsxs("div",{className:"central-container flex flex-col gap-2 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:[t.jsx(_.QuotedMessagePreview,{}),t.jsx(on,{}),t.jsx(i,{}),t.jsxs("div",{className:"flex",children:[t.jsx("div",{className:"w-full ml-2 mr-4 self-center leading-[0]",children:t.jsx(_.TextareaComposer,{"aria-disabled":e||void 0,className:"w-full resize-none outline-none leading-5 placeholder:text-black/30 text-sm",autoFocus:!e,maxRows:4,readOnly:e,tabIndex:e?-1:void 0})}),t.jsx(r,{sendMessage:s,"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:a,type:"button"})]})]})},dn=({renderActions:e,renderFooter:s,disabled:n=!1,disabledReason:a})=>{var o;const{channel:r}=_.useChannelStateContext(),i=((o=r==null?void 0:r.data)==null?void 0:o.frozen)===!0;return n?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"messaging-composer-locked-panel flex w-full flex-col items-center justify-center gap-3 px-6 py-4",children:a?t.jsx("p",{className:"max-w-[345px] text-center text-xs font-normal leading-[1.3] tracking-[0.12px] text-black/40",children:a}):null}),s==null?void 0:s()]}):t.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[t.jsxs("div",{inert:i?"":void 0,"aria-disabled":i||void 0,className:"message-input flex items-end gap-4 aria-disabled:opacity-40",children:[e&&t.jsx("div",{className:"flex h-12 shrink-0 items-center justify-center",children:e()}),t.jsx(Bt.Provider,{value:i,children:t.jsx(_.MessageInput,{Input:cn})})]}),s==null?void 0:s()]})},un=["SYSTEM_DM_AGENT_PAUSED","SYSTEM_DM_AGENT_RESUMED"],mn={SYSTEM_DM_AGENT_PAUSED:"DM Agent has left the conversation",SYSTEM_DM_AGENT_RESUMED:"DM Agent has rejoined the conversation"},hn=["SYSTEM_AGE_SAFETY_BLOCKED"],xn={SYSTEM_AGE_SAFETY_BLOCKED:"This user isn’t able to reply because they don’t meet our age safety guidelines."},ye="age safety guidelines.",fn="https://linktr.ee/s/about/contact",wt=e=>un.includes(e),gn=e=>hn.includes(e),bn=e=>{var a;const s=(a=e.metadata)==null?void 0:a.custom_type;if(wt(s))return{kind:"dm-agent",type:s};if(gn(s))return{kind:"age-safety",type:s};const n=e.dm_agent_system_type;if(wt(n))return{kind:"dm-agent",type:n}},pn=e=>{const s=e.indexOf(ye);if(s===-1)return e;const n=s+ye.length;return t.jsxs(t.Fragment,{children:[e.slice(0,s),t.jsx("a",{href:fn,target:"_blank",rel:"noopener noreferrer",className:"mes-age-safety-system-message__emphasis font-medium text-inherit underline",children:ye}),e.slice(n)]})},vn=e=>{var a,r;const s=e.message.hide_date===!0,n=bn(e.message);if((n==null?void 0:n.kind)==="dm-agent"){const i=((a=e.message.text)==null?void 0:a.trim())||mn[n.type];return t.jsxs("div",{className:"str-chat__message--system","data-testid":"message-system",children:[t.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:[t.jsx(N.SparkleIcon,{size:16,weight:"regular","aria-hidden":!0,className:"mes-dm-agent-system-message__sparkle shrink-0"}),t.jsx("p",{className:"mes-dm-agent-system-message__text m-0 text-center text-[14px] font-normal leading-5 tracking-[0.21px]",children:i})]}),!s&&t.jsx(_.MessageTimestamp,{message:e.message})]})}if((n==null?void 0:n.kind)==="age-safety"){const i=((r=e.message.text)==null?void 0:r.trim())||xn[n.type];return t.jsxs("div",{className:"str-chat__message--system","data-testid":"message-system",children:[t.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:[t.jsx(N.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"}),t.jsx("div",{className:"mes-age-safety-system-message__content min-w-0 flex-[1_0_0]",children:t.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:pn(i)})})]}),!s&&t.jsx(_.MessageTimestamp,{message:e.message})]})}return t.jsxs("div",{className:"str-chat__message--system","data-testid":"message-system",children:[t.jsxs("div",{className:"str-chat__message--system__text",children:[t.jsx("div",{className:"str-chat__message--system__line"}),t.jsx("p",{children:e.message.text}),t.jsx("div",{className:"str-chat__message--system__line"})]}),!s&&t.jsx(_.MessageTimestamp,{message:e.message})]})},Ut=h.createContext(!1),Ce=({cx:e,index:s})=>t.jsx("circle",{cx:e,cy:"6.15",r:"3.9",fill:"#A0A0A0",children:t.jsx("animateTransform",{attributeName:"transform",type:"translate",values:"0 0; 0 -2.25; 0 0;",dur:"900ms",begin:`${120*s}ms`,repeatCount:"indefinite"})}),jn=new Set([_.AIStates.Thinking,_.AIStates.Generating,_.AIStates.ExternalSources]),wn=({threadList:e})=>{var f,b;const{channel:s,channelConfig:n,thread:a}=_.useChannelStateContext(),{client:r}=_.useChatContext(),{typing:i={}}=_.useTypingContext(),{aiState:o}=_.useAIState(s),l=h.useContext(Ut);if(!e&&l&&jn.has(o)){const p=_n(s,(f=r.user)==null?void 0:f.id);return t.jsx(_t,{avatarId:(p==null?void 0:p.id)??"ai-agent",avatarName:(p==null?void 0:p.name)??(p==null?void 0:p.id)??"Agent",avatarImage:p==null?void 0:p.image,testId:"typing-indicator-ai"})}if((n==null?void 0:n.typing_events)===!1)return null;const m=e?[]:Object.values(i).filter(({parent_id:p,user:w})=>{var v;return(w==null?void 0:w.id)!==((v=r.user)==null?void 0:v.id)&&!p}),g=e?Object.values(i).filter(({parent_id:p,user:w})=>{var v;return(w==null?void 0:w.id)!==((v=r.user)==null?void 0:v.id)&&p===(a==null?void 0:a.id)}):[],u=e?g:m;if(!u.length)return null;const x=(b=u[0])==null?void 0:b.user,c=x!=null&&x.id&&s.state.members[x.id]?s.state.members[x.id].user:void 0;return t.jsx(_t,{avatarId:(x==null?void 0:x.id)??(c==null?void 0:c.id)??"typing-user",avatarName:(x==null?void 0:x.name)??(c==null?void 0:c.name)??(x==null?void 0:x.id)??"Typing user",avatarImage:(x==null?void 0:x.image)??(c==null?void 0:c.image),testId:"typing-indicator"})},_t=({avatarId:e,avatarName:s,avatarImage:n,testId:a})=>t.jsx("div",{className:"str-chat__li str-chat__li--single str-chat__typing-indicator !static","data-testid":a,style:{marginBottom:"var(--messaging-channel-input-spacer-height, 80px)"},children:t.jsxs("div",{className:"str-chat__message str-chat__message-simple str-chat__message--regular str-chat__message--received str-chat__message--other str-chat__message--has-text",children:[t.jsx(Z,{className:"str-chat__avatar str-chat__message-sender-avatar",id:e,name:s,image:n??void 0,size:24,shape:"circle"}),t.jsx("div",{className:"str-chat__message-inner mx-0",children:t.jsx("div",{className:"str-chat__message-bubble-wrapper",children:t.jsx("div",{className:"str-chat__message-bubble",children:t.jsx("div",{className:"str-chat__message-text min-h-11 flex items-center",children:t.jsx("div",{className:"str-chat__message-text-inner str-chat__message-simple-text-inner",children:t.jsxs("svg",{"aria-hidden":"true",className:"block overflow-visible",viewBox:"0 0 32 12.3",width:"32",height:"13",overflow:"visible",children:[t.jsx(Ce,{cx:"4",index:0}),t.jsx(Ce,{cx:"16",index:1}),t.jsx(Ce,{cx:"28",index:2})]})})})})})})]})});function _n(e,s){var a;const n=((a=e==null?void 0:e.state)==null?void 0:a.members)??{};for(const r of Object.values(n)){const i=r==null?void 0:r.user;if(i&&i.id!==s)return i}}const Vt=()=>null,Nn=({className:e,message:s})=>t.jsxs("div",{className:C("flex items-center justify-center h-full",e),children:[t.jsxs("svg",{viewBox:"0 0 100 100",className:"size-8 fill-pebble",stroke:"none",children:[t.jsx("circle",{cx:"6",cy:"50",r:"6",children:t.jsx("animateTransform",{attributeName:"transform",dur:"1s",type:"translate",values:"0 15 ; 0 -15; 0 15",repeatCount:"indefinite",begin:"0.1"})}),t.jsx("circle",{cx:"30",cy:"50",r:"6",children:t.jsx("animateTransform",{attributeName:"transform",dur:"1s",type:"translate",values:"0 10 ; 0 -10; 0 10",repeatCount:"indefinite",begin:"0.2"})}),t.jsx("circle",{cx:"54",cy:"50",r:"6",children:t.jsx("animateTransform",{attributeName:"transform",dur:"1s",type:"translate",values:"0 5 ; 0 -5; 0 5",repeatCount:"indefinite",begin:"0.3"})})]}),s&&t.jsx("span",{className:"text-stone",children:s})]}),ge=h.memo(()=>t.jsx("div",{className:"messaging-loading-state flex items-center justify-center h-full",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx(Nn,{className:"w-6 h-6"}),t.jsx("span",{className:"text-sm text-stone",children:"Loading messages"})]})}));ge.displayName="LoadingState";const ne="size-10 rounded-full hover:bg-[#E5E4E1] flex items-center justify-center transition-colors duration-150 focus-ring",Nt="Replies instantly with AI assistant",yn=({onBack:e,showBackButton:s,showStarButton:n=!1,dmAgentEnabled:a=!1,onLeaveConversation:r,onBlockParticipant:i,showDeleteConversation:o=!0,showBlockParticipant:l=!0,showReportParticipant:d=!0,onDeleteConversationClick:m,onBlockParticipantClick:g,onReportParticipantClick:u,customChannelActions:x,showActionsMenu:c=!0})=>{var E,R,P,k,M;const{channel:f}=_.useChannelStateContext(),b=h.useMemo(()=>{var L,F;const y=(L=f._client)==null?void 0:L.userID;return y?Object.values(((F=f.state)==null?void 0:F.members)||{}).find(A=>{var D;return((D=A.user)==null?void 0:D.id)&&A.user.id!==y}):void 0},[(E=f._client)==null?void 0:E.userID,(R=f.state)==null?void 0:R.members]),p=Ae(b==null?void 0:b.user),w=(P=b==null?void 0:b.user)==null?void 0:P.image,v=St(f),I=async()=>{try{v?await f.unpin():await f.pin()}catch(y){console.error("[CustomChannelHeader] Failed to update pinned status:",y)}};return t.jsxs("div",{className:"@container",children:[t.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] w-full items-center @lg:hidden px-6 py-3",children:[t.jsx("div",{className:"flex items-center gap-2",children:s&&t.jsx("button",{className:C(ne,"messaging-channel-view-back-button-mobile bg-[#F1F0EE]"),onClick:e||(()=>{}),type:"button","aria-label":"Back to conversations",children:t.jsx(N.ArrowLeftIcon,{className:"size-5 text-black/90"})})}),t.jsxs("div",{className:"flex flex-col gap-1 items-center",children:[t.jsx(Z,{id:((k=b==null?void 0:b.user)==null?void 0:k.id)||f.id||"unknown",name:p,image:w,starred:n&&v,dmAgentEnabled:a,size:48}),t.jsx("p",{className:"text-center text-xs font-medium text-black/90",children:p}),a&&t.jsxs("div",{className:"flex items-center gap-1 text-[10px] leading-3 text-black/55",children:[t.jsx(N.SparkleIcon,{className:"size-3 shrink-0 text-black/55"}),t.jsx("span",{children:Nt})]})]}),t.jsxs("div",{className:"flex justify-end items-center gap-2",children:[n&&t.jsx("button",{className:ne,onClick:I,type:"button","aria-label":v?"Unstar conversation":"Star conversation",children:t.jsx(N.StarIcon,{className:C("size-5",{"text-yellow-600":v,"text-black/90":!v}),weight:v?"duotone":"regular"})}),c&&t.jsx(vt,{channel:f,participant:b,showDeleteConversation:o,showBlockParticipant:l,showReportParticipant:d,onLeaveConversation:r,onBlockParticipant:i,onDeleteConversationClick:m,onBlockParticipantClick:g,onReportParticipantClick:u,customChannelActions:x,triggerClassName:C(ne,"bg-[#F1F0EE]")})]})]}),t.jsxs("div",{className:"px-6 py-3 hidden @lg:flex items-center justify-between gap-3 min-h-12 border-b border-b-black/[0.08]",children:[t.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[s&&e&&t.jsx("button",{className:C(ne,"messaging-channel-view-back-button-desktop"),type:"button",onClick:e,"aria-label":"Back to conversations",children:t.jsx(N.ArrowLeftIcon,{className:"size-5 text-black/90"})}),t.jsx(Z,{id:((M=b==null?void 0:b.user)==null?void 0:M.id)||f.id||"unknown",name:p,image:w,starred:n&&v,dmAgentEnabled:a,size:48}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h1",{className:"font-medium text-black/90 truncate",children:p}),a&&t.jsxs("div",{className:"mt-0.5 flex items-center gap-1 text-[10px] leading-3 text-black/55",children:[t.jsx(N.SparkleIcon,{className:"size-3 shrink-0 text-black/55"}),t.jsx("span",{className:"truncate",children:Nt})]})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[n&&t.jsx("button",{className:ne,onClick:I,type:"button","aria-label":v?"Unstar conversation":"Star conversation",children:t.jsx(N.StarIcon,{className:C("size-6",{"text-yellow-600":v,"text-black/90":!v}),weight:v?"duotone":"regular"})}),c&&t.jsx(vt,{channel:f,participant:b,showDeleteConversation:o,showBlockParticipant:l,showReportParticipant:d,onLeaveConversation:r,onBlockParticipant:i,onDeleteConversationClick:m,onBlockParticipantClick:g,onReportParticipantClick:u,customChannelActions:x,triggerClassName:ne})]})]})]})},Cn=({onBack:e,showBackButton:s,renderMessageInputActions:n,renderMessageInputFooter:a,renderConversationFooter:r,onLeaveConversation:i,onBlockParticipant:o,showDeleteConversation:l=!0,onDeleteConversationClick:d,onBlockParticipantClick:m,onReportParticipantClick:g,showBlockParticipant:u=!0,showReportParticipant:x=!0,composerDisabled:c=!1,composerDisabledReason:f,showStarButton:b=!1,chatbotVotingEnabled:p=!1,renderChannelBanner:w,customChannelActions:v,renderMessage:I,dmAgentEnabled:E=!1,viewerLanguage:R,showChannelInfo:P=!0})=>{var D,z,V,$,B,Y;const{channel:k}=_.useChannelStateContext(),M=h.useMemo(()=>{var j,S;const G=(j=k._client)==null?void 0:j.userID;return G?Object.values(((S=k.state)==null?void 0:S.members)||{}).find(U=>{var H;return((H=U.user)==null?void 0:H.id)&&U.user.id!==G}):void 0},[(D=k._client)==null?void 0:D.userID,(z=k.state)==null?void 0:z.members]),y=h.useMemo(()=>{var j,S;const G=(j=k._client)==null?void 0:j.userID;return G?Object.values(((S=k.state)==null?void 0:S.members)||{}).find(U=>{var H;return((H=U.user)==null?void 0:H.id)===G}):void 0},[(V=k._client)==null?void 0:V.userID,($=k.state)==null?void 0:$.members]),T=((B=y==null?void 0:y.user)==null?void 0:B.is_account)??(y==null?void 0:y.is_account),L=((Y=M==null?void 0:M.user)==null?void 0:Y.is_account)??(M==null?void 0:M.is_account),F=E&&T===!1&&L===!0,A=h.useCallback(G=>{const{message:O}=_.useMessageContext("ChannelView"),j=t.jsx(en,{...G,chatbotVotingEnabled:p,viewerLanguage:R});return!I||!O?j:I(j,O)},[p,I,R]);return t.jsx(t.Fragment,{children:t.jsx(_.WithComponents,{overrides:{Message:A,MessageActions:nn},children:t.jsxs(_.Window,{children:[t.jsx("div",{children:t.jsx(yn,{onBack:e,showBackButton:s,showActionsMenu:P,showStarButton:b,dmAgentEnabled:F,onLeaveConversation:i,onBlockParticipant:o,showDeleteConversation:l,showBlockParticipant:u,showReportParticipant:x,onDeleteConversationClick:d,onBlockParticipantClick:m,onReportParticipantClick:g,customChannelActions:v})},"lt-channel-header"),w?t.jsx(h.Fragment,{children:w()},"lt-channel-banner"):null,t.jsx("div",{className:"flex-1 overflow-hidden relative",children:t.jsx(_.MessageList,{hideDeletedMessages:!0,hideNewMessageSeparator:!1})},"lt-channel-message-list"),r?t.jsx(h.Fragment,{children:r(k)},"lt-channel-conversation-footer"):null,t.jsx(dn,{...n&&{renderActions:()=>n==null?void 0:n(k)},renderFooter:()=>a==null?void 0:a(k),disabled:c,disabledReason:f},"lt-channel-message-input")]})})})},Fe=h.memo(({channel:e,onBack:s,showBackButton:n=!1,renderMessageInputActions:a,renderMessageInputFooter:r,renderConversationFooter:i,onLeaveConversation:o,onBlockParticipant:l,className:d,CustomChannelEmptyState:m=Vt,showDeleteConversation:g=!0,onDeleteConversationClick:u,onBlockParticipantClick:x,onReportParticipantClick:c,showBlockParticipant:f=!0,showReportParticipant:b=!0,composerDisabled:p=!1,composerDisabledReason:w,dmAgentEnabled:v,messageMetadata:I,onMessageSent:E,showStarButton:R=!1,chatbotVotingEnabled:P=!1,renderChannelBanner:k,customChannelActions:M,renderMessage:y,onMessageLinkClick:T,sendButton:L,attachmentPreviewList:F,viewerLanguage:A,showChannelInfo:D=!0})=>{const z=h.useCallback(async($,B,Y)=>{var H;const G=((H=e.data)==null?void 0:H.chatbot_paused)===!0,O=v&&!G,j={...B,...O&&{silent:!0},...I&&{metadata:{...B.metadata??{},...I}}},S={...Y,...O&&{skip_push:!0}},U=await e.sendMessage(j,S);return E==null||E(U),U},[e,v,I,E]),V=h.useRef(null);return h.useEffect(()=>{if(!T)return;const $=V.current;if(!$)return;const B=Y=>{const G=Y.target,O=G==null?void 0:G.closest("a[href]"),j=O==null?void 0:O.getAttribute("href");if(!j)return;const S=O==null?void 0:O.closest("[data-message-id]"),U=S==null?void 0:S.getAttribute("data-message-id"),H=U?e.state.messages.find(he=>he.id===U):void 0;T(j,H)};return $.addEventListener("click",B),()=>$.removeEventListener("click",B)},[T,e]),t.jsx("div",{ref:V,className:C("messaging-channel-view h-full flex flex-col",d),children:t.jsx(Ut.Provider,{value:v??!1,children:t.jsx(_.Channel,{channel:e,MessageSystem:vn,EmptyStateIndicator:m,LoadingIndicator:ge,DateSeparator:ps,TypingIndicator:wn,doSendMessageRequest:z,...L?{SendButton:L}:{},...F?{AttachmentPreviewList:F}:{},children:t.jsx(Cn,{onBack:s,showBackButton:n,renderMessageInputActions:a,renderMessageInputFooter:r,renderConversationFooter:i,onLeaveConversation:o,onBlockParticipant:l,CustomChannelEmptyState:m,showDeleteConversation:g,onDeleteConversationClick:u,onBlockParticipantClick:x,onReportParticipantClick:c,showBlockParticipant:f,showReportParticipant:b,composerDisabled:p,composerDisabledReason:w,showStarButton:R,dmAgentEnabled:v,chatbotVotingEnabled:P,renderChannelBanner:k,customChannelActions:M,renderMessage:y,viewerLanguage:A,showChannelInfo:D})})})})});Fe.displayName="ChannelView";const le=h.memo(({message:e,onBack:s})=>t.jsx("div",{className:"messaging-error-state flex items-center justify-center h-full p-8",children:t.jsxs("div",{className:"text-center max-w-sm",children:[t.jsx("div",{className:"w-24 h-24 bg-danger-alt/20 rounded-full flex items-center justify-center mx-auto mb-6",children:t.jsx("span",{className:"text-4xl",children:"⚠️"})}),t.jsx("h2",{className:"font-semibold text-charcoal mb-2",children:"Oops!"}),t.jsx("p",{className:"text-stone text-sm mb-6",children:e}),s&&t.jsx("button",{type:"button",onClick:s,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"})]})}));le.displayName="ErrorState";const Sn=({capabilities:e={},renderMessageInputActions:s,renderConversationFooter:n,onChannelSelect:a,onExitConversation:r,initialParticipantFilter:i,initialParticipantData:o,CustomChannelEmptyState:l,onBlockParticipantClick:d,onReportParticipantClick:m,dmAgentEnabled:g,onMessageSent:u,chatbotVotingEnabled:x=!1,viewerLanguage:c,renderChannelBanner:f,customChannelActions:b,renderMessage:p,onMessageLinkClick:w,showChannelInfo:v})=>{const{client:I,isConnected:E,isLoading:R,error:P,refreshConnection:k,service:M,debug:y}=Ct(),[T,L]=h.useState(null),[F,A]=h.useState(null),[D,z]=h.useState(!1),{showDeleteConversation:V=!0}=e,$=h.useRef(o);$.current=o;const B=h.useRef(a);B.current=a;const Y=h.useRef(null),G=h.useRef(null);h.useEffect(()=>{G.current=T},[T]),h.useEffect(()=>{if(!I||!E)return;const S=I.userID;if(!S)return;const U=`${S}::${i}`;if(Y.current===U)return;Y.current=U;const H=()=>{Y.current===U&&(Y.current=null)};(async()=>{var q,te;try{y&&console.log("[MessagingShell] Loading initial conversation with:",i);const W=await I.queryChannels({type:"messaging",members:{$eq:[S,i]}},{},{limit:1});if(W.length>0){L(W[0]),A(null),(q=B.current)==null||q.call(B,W[0]),y&&console.log("[MessagingShell] Initial conversation loaded:",W[0].id);return}const Q=$.current;if(!Q||!M){H(),A("No conversation found with this account"),y&&console.log("[MessagingShell] No conversation found for:",i);return}try{const J=await M.startChannelWithParticipant({id:Q.id,name:Q.name,phone:Q.phone});L(J),A(null),(te=B.current)==null||te.call(B,J),y&&console.log("[MessagingShell] Channel created and loaded:",J.id)}catch(J){console.error("[MessagingShell] Failed to create conversation:",J),H(),A("Failed to create conversation")}}catch(W){console.error("[MessagingShell] Failed to load initial conversation:",W),H(),G.current||A("Failed to load conversation")}})()},[i,I,E,M,y]);const O=h.useRef(r);O.current=r;const j=h.useCallback(()=>{var S;L(null),z(!0),(S=O.current)==null||S.call(O)},[]);return R?t.jsx(ge,{}):P?t.jsx(le,{message:P,onBack:k}):!E||!I?t.jsx(le,{message:"Not connected to messaging service",onBack:k}):F?t.jsx(le,{message:F}):D&&!T?t.jsx(le,{message:"Conversation ended"}):T?t.jsx("div",{className:"messaging-shell h-full bg-background-primary overflow-hidden",children:t.jsx("div",{className:"flex h-full min-h-0 flex-col",children:t.jsx(Fe,{channel:T,renderMessageInputActions:s,renderConversationFooter:n,renderChannelBanner:f,onLeaveConversation:j,onBlockParticipant:j,CustomChannelEmptyState:l,showDeleteConversation:V,onBlockParticipantClick:d,onReportParticipantClick:m,dmAgentEnabled:g,onMessageSent:u,chatbotVotingEnabled:x,viewerLanguage:c,customChannelActions:b,renderMessage:p,onMessageLinkClick:w,showChannelInfo:v},T.id)})}):t.jsx(ge,{})};function kn(e){const s=e.state.pending_messages;if(s!=null&&s.length)for(const n of s)e.state.addMessageSorted(n.message)}const Gt=h.createContext({selectedChannel:void 0,onChannelSelect:()=>{},debug:!1,renderMessagePreview:void 0,viewerLanguage:void 0}),En=Gt.Provider,In=()=>h.useContext(Gt),Tn=(e,s)=>{const n=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())),r=new Date(Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate())).getTime()-n.getTime();return Math.floor(r/(1e3*60*60*24))},Ht=e=>{const s=new Date;if(Math.floor((s.getTime()-e.getTime())/1e3)<60)return"Just now";const a=Tn(e,s);return a===0?e.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}):a===1?"Yesterday":a<7?`${a}d`:a<28?`${Math.floor(a/7)}w`:e.toLocaleDateString("en-US",{month:"numeric",day:"numeric",year:"2-digit"})},Yt=h.memo(({channel:e,unread:s})=>{var P,k,M;const{selectedChannel:n,onChannelSelect:a,debug:r,renderMessagePreview:i,viewerLanguage:o}=In(),l=(n==null?void 0:n.id)===(e==null?void 0:e.id),d=()=>{e&&a(e)},m=y=>{const T=y.key==="Enter"||y.key===" ",L=y.repeat;!T||L||(y.preventDefault(),d())},u=Object.values(((P=e==null?void 0:e.state)==null?void 0:P.members)||{}).find(y=>{var T,L;return((T=y.user)==null?void 0:T.id)&&y.user.id!==((L=e==null?void 0:e._client)==null?void 0:L.userID)}),x=Ae(u==null?void 0:u.user),c=(k=u==null?void 0:u.user)==null?void 0:k.image,f=(()=>{var T;const y=(T=e==null?void 0:e.state)==null?void 0:T.messages;if(y!=null&&y.length){for(let L=y.length-1;L>=0;L--)if(y[L].type!=="system")return y[L]}})(),p=(()=>{var D,z,V,$;const y=Re({message:f,viewerLanguage:o});if(((D=f==null?void 0:f.metadata)==null?void 0:D.custom_type)==="MESSAGE_TIP")return y?`💵 ${y}`:"💵 Sent a tip";if(((z=f==null?void 0:f.metadata)==null?void 0:z.custom_type)==="MESSAGE_PAID")return y?`💰 ${y}`:"💰 Sent a message";if(((V=f==null?void 0:f.metadata)==null?void 0:V.custom_type)==="MESSAGE_ATTACHMENT")return y?`📎 ${y}`:"📎 Sent an attachment";if(y)return y;const A=($=f==null?void 0:f.attachments)==null?void 0:$[0];return A?A.og_scrape_url?A.og_scrape_url:A.type==="image"?"📷 Sent an image":A.type==="video"?"🎥 Sent a video":A.type==="audio"?"🎵 Sent audio":A.type==="file"?"📎 Sent a file":"📎 Sent an attachment":"No messages yet"})(),w=f!=null&&f.created_at?Ht(new Date(f.created_at)):"",v=f?fe(f):!1,I=i?i(f,p):`${v?"✨ ":""}${p}`,E=St(e),R=s??0;return r&&console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER",{channelId:e==null?void 0:e.id,isSelected:l,participantName:x,unreadCount:R,hasTimestamp:!!w}),t.jsx("div",{role:"button",tabIndex:0,onClick:d,onKeyDown:m,className:C("group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring rounded-[12px] [&+&]:mt-2",{"bg-black/[0.04]":l,"hover:bg-black/[0.02]":!l}),children:t.jsxs("div",{className:"flex items-start gap-4",children:[t.jsx(Z,{id:((M=u==null?void 0:u.user)==null?void 0:M.id)||e.id||"unknown",name:x,image:c,size:48,starred:E}),t.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("h3",{className:C("text-sm font-medium truncate text-[#191918]"),children:[E&&t.jsx("span",{className:"sr-only",children:"Starred conversation. "}),x]}),w&&t.jsx("span",{className:"text-xs text-[#717070] flex-shrink-0",children:w})]}),t.jsxs("div",{className:"flex items-center justify-between gap-2 min-w-0",children:[t.jsx("p",{className:"text-sm text-[#717070] flex-1 line-clamp-1",children:I}),R>0&&t.jsx("span",{className:"bg-[#7f22fe] text-white text-[10px] rounded-full h-4 flex items-center justify-center p-1 min-w-4 text-center flex-shrink-0",children:R>99?"99+":R})]})]})]})})});Yt.displayName="CustomChannelPreview";const Mn={last_message_at:-1},qt=h.memo(({onChannelSelect:e,selectedChannel:s,filters:n,allowNewMessagesFromUnfilteredChannels:a=!1,channelRenderFilterFn:r,sort:i=Mn,className:o,customEmptyStateIndicator:l,renderMessagePreview:d,viewerLanguage:m})=>{const g=h.useRef(0);g.current++;const{debug:u=!1}=Me(),x=h.useCallback(f=>{for(const b of f)kn(b);return r?r(f):f},[r]);u&&console.log("📺 [ChannelList] 🔄 RENDER START",{renderCount:g.current,selectedChannelId:s==null?void 0:s.id,filters:n});const c=h.useMemo(()=>({selectedChannel:s,onChannelSelect:e,debug:u,renderMessagePreview:d,viewerLanguage:m}),[s,e,u,d,m]);return t.jsx("div",{className:C("messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",o),children:t.jsx("div",{className:"flex-1 overflow-hidden min-w-0",children:t.jsx(En,{value:c,children:t.jsx(_.ChannelList,{filters:n,sort:i,options:{limit:30},allowNewMessagesFromUnfilteredChannels:a,channelRenderFilterFn:x,Paginator:_.InfiniteScroll,Preview:Yt,EmptyStateIndicator:l},`${JSON.stringify(n)}:${JSON.stringify(i)}`)})})})});qt.displayName="ChannelList";const An=/^([a-z][a-z0-9+.-]*):/i,Rn=new Set(["http","https","mailto","tel","sms"]);function $e(e){if(typeof e!="string")return;const s=e.trim();if(s==="")return;const n=An.exec(s);if(n){const a=n[1].toLowerCase();return Rn.has(a)?s:void 0}return s.startsWith("//")||s.startsWith("/")?s:`https://${s}`}const Ln={dark:"bg-white text-[#121110] hover:bg-white/90",light:"bg-[#121110] text-white hover:bg-[#2a2928]"},Dn=({variant:e,cta:s})=>{const n=C("mt-2 inline-flex h-10 w-full items-center justify-center rounded-full px-4 text-sm font-medium leading-none transition-colors",Ln[e]),a=$e(s.href);return a?t.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>{var i;r.stopPropagation(),(i=s.onClick)==null||i.call(s)},className:`${n} no-underline`,children:s.label}):t.jsx("button",{type:"button",onClick:r=>{var i;r.stopPropagation(),(i=s.onClick)==null||i.call(s)},className:n,children:s.label})},Pn={dark:"text-white",light:"text-black/90"},On="text-white/30",zn={dark:"text-white/55",light:"text-black/55"},Be=({variant:e,title:s,placeholderTitle:n,description:a,url:r,appIcon:i,cta:o,trailingAction:l})=>{const d=e==="dark",m=s??(d?n:void 0)??"",g=m.trim()!=="",u=a!=null&&a.trim()!=="",x=typeof r=="string"?r.trim():"",c=x!=="",f=o!=null;if(!g&&!u&&!c&&!f)return null;const p=C("truncate text-base font-medium leading-6",d&&!s?On:Pn[e]),w=C("truncate text-xs leading-4",zn[e]);return t.jsxs("div",{className:"px-4 py-3",children:[t.jsxs("div",{className:"flex items-end gap-3",children:[t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[t.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[g&&t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i?t.jsx("span",{className:"shrink-0",children:i}):null,t.jsx("p",{className:C("min-w-0",p),children:m})]}),u&&t.jsx("p",{className:w,children:a})]}),!f&&c&&t.jsx("p",{className:w,children:x})]}),l&&t.jsx("div",{className:"shrink-0",children:l})]}),o&&t.jsx(Dn,{variant:e,cta:o})]})},Fn=C("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)]"),be=({variant:e,children:s,href:n,onClick:a,ariaLabel:r,rootRef:i,topRight:o,bgClassName:l,"data-testid":d})=>{const m=n!=null||a!=null,g=C(Fn,l??(e==="dark"?"bg-[#121110]":"bg-white"),m?"cursor-pointer no-underline focus-ring":null),u=o?t.jsx("div",{className:"pointer-events-auto absolute right-3 top-3 z-10",children:o}):null;return n?t.jsxs("a",{ref:i,href:n,target:"_blank",rel:"noopener noreferrer",onClick:a,"data-testid":d,className:g,children:[s,u]}):a?t.jsxs("button",{ref:i,type:"button",onClick:a,"aria-label":r,"data-testid":d,className:C(g,"text-left"),children:[s,u]}):t.jsxs("div",{ref:i,"data-testid":d,className:g,children:[s,u]})},$n={dark:"bg-white/10",light:"bg-black/5"},Bn={dark:"size-16 text-white/25",light:"size-16 text-black/25"},we=(e,s)=>!!s&&!!e&&K(e)==="audio",Wt=(e,s)=>{if(!s||!e)return!1;const n=K(e);return n==="video"||n==="audio"},Ue="bg-[#F2F3F4]",pe=({variant:e,thumbnailUrl:s,sourceUrl:n,title:a,mimeType:r="image/*",topLeft:i,topRight:o})=>{const l=K(r),d=!!n&&l==="video";return we(r,n)?t.jsx("div",{className:"p-3",children:t.jsx("audio",{src:n,controls:!0,preload:"metadata",className:"block w-full",children:t.jsx("track",{kind:"captions"})})}):t.jsxs("div",{className:C("relative h-[180px] w-full overflow-hidden",d&&"bg-black"),children:[d?t.jsx("video",{src:n,poster:s,controls:!0,playsInline:!0,preload:"metadata",className:"absolute inset-0 h-full w-full object-contain",children:t.jsx("track",{kind:"captions"})}):s?t.jsx("img",{src:s,alt:a??"",draggable:!1,className:"absolute inset-0 h-full w-full object-cover"}):t.jsx("div",{className:C("flex h-full w-full items-center justify-center",$n[e]),children:ee(r,{className:Bn[e],weight:"regular"})}),i?t.jsx("div",{className:"pointer-events-auto absolute left-3 top-3 z-10",children:i}):null,o?t.jsx("div",{className:"pointer-events-auto absolute right-3 top-3 z-10",children:o}):null]})},Un=({title:e,placeholderTitle:s,description:n,url:a,mimeType:r,thumbnailUrl:i,sourceUrl:o,layout:l="featured",appIcon:d,cta:m,onDismiss:g,onEditClick:u})=>{const x=l==="classic",c=we(r,o),f=g?t.jsx("button",{type:"button",onClick:g,"aria-label":"Dismiss attachment",className:"flex size-6 items-center justify-center rounded-full bg-[#121110] text-white",children:t.jsx(N.XIcon,{className:"size-3",weight:"bold"})}):void 0,b=u?t.jsx("button",{type:"button",onClick:u,"aria-label":"Edit attachment",className:"flex size-10 items-center justify-center rounded-full bg-white/10 text-white hover:bg-white/15",children:t.jsx(N.PencilSimpleIcon,{className:"size-5",weight:"regular"})}):void 0;return c?t.jsx(be,{variant:"dark",bgClassName:Ue,children:t.jsxs("div",{className:"flex items-center gap-2 pr-3",children:[t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(pe,{variant:"dark",sourceUrl:o,title:e,mimeType:r})}),f&&t.jsx("div",{className:"shrink-0",children:f})]})}):t.jsxs(be,{variant:"dark",topRight:x?f:void 0,children:[!x&&t.jsx(pe,{variant:"dark",thumbnailUrl:i,sourceUrl:o,title:e,mimeType:r,topRight:f}),t.jsx(Be,{variant:"dark",title:e,placeholderTitle:s,description:n,url:a,appIcon:d,cta:m,trailingAction:b})]})},Vn=({title:e,description:s,url:n,mimeType:a,thumbnailUrl:r,sourceUrl:i,layout:o="featured",appIcon:l,cta:d,onClick:m})=>{const g=Wt(a,i),u=$e(n),x=d==null&&u!=null&&!g?u:void 0,c=d==null&&!g?m:void 0,f=we(a,i)?Ue:void 0,b=d&&m?{...d,onClick:()=>{var p;m(),(p=d.onClick)==null||p.call(d)}}:d;return t.jsxs(be,{variant:"light",href:x,onClick:c,ariaLabel:e??"Open attachment preview",bgClassName:f,"data-testid":"link-attachment",children:[o==="featured"&&t.jsx(pe,{variant:"light",thumbnailUrl:r,sourceUrl:i,title:e,mimeType:a}),t.jsx(Be,{variant:"light",title:e,description:s,url:n,appIcon:l,cta:b})]})},Gn=({title:e,placeholderTitle:s,description:n,url:a,mimeType:r,thumbnailUrl:i,sourceUrl:o,layout:l="featured",appIcon:d,cta:m,onClick:g})=>{const u=Wt(r,o),x=$e(a),c=m==null&&x!=null&&!u?x:void 0,f=m==null&&!u&&c!=null?g:void 0;return t.jsxs(be,{variant:"dark",href:c,onClick:f,bgClassName:we(r,o)?Ue:void 0,children:[l==="featured"&&t.jsx(pe,{variant:"dark",thumbnailUrl:i,sourceUrl:o,title:e,mimeType:r}),t.jsx(Be,{variant:"dark",title:e,placeholderTitle:s,description:n,url:a,appIcon:d,cta:m})]})},Hn={Composer:Un,Sent:Gn,Received:Vn},Yn={dark:"bg-[#121110]",light:"bg-[#e9eaed]"},qn={dark:"text-white",light:"text-[#080707]"},Wn={dark:"border-white/[0.08]",light:"border-black/[0.08]"},Xn=e=>e==="dark"?"sender":"receiver",Kn={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]"}},ce=({variant:e,text:s,bordered:n=!0,groupPosition:a="single",className:r,children:i,"data-testid":o})=>{const l=s!=null&&s!=="",d=Kn[Xn(e)][a];return t.jsxs("div",{"data-testid":o,"data-group-position":a,className:C("relative w-[280px] overflow-hidden px-2 py-2",d,Yn[e],qn[e],n&&"border",n&&Wn[e],r),children:[i,l?t.jsx("p",{className:C("whitespace-pre-wrap break-words leading-snug","pt-2","px-2"),children:s}):null]})},de=({onClick:e,variant:s="overlay",ariaLabel:n="Dismiss attachment"})=>t.jsx("button",{type:"button",onClick:a=>{a.stopPropagation(),e()},"aria-label":n,className:C("flex size-6 items-center justify-center rounded-full text-white",s==="overlay"?"bg-[#121110]/85 backdrop-blur":"bg-white/15 hover:bg-white/25"),children:t.jsx(N.XIcon,{className:"size-3",weight:"bold"})}),ue=e=>e==="received"?"light":"dark",Jn=({firstOfGroup:e,endOfGroup:s,groupedByUser:n})=>!n||e&&s?"single":e?"first":s?"end":"middle",Zn=({src:e,mimeType:s,filename:n,items:a})=>a&&a.length>0?a:e?[{src:e,mimeType:s,filename:n}]:[],Qn=({item:e,preload:s,trailingAction:n})=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("audio",{src:e.src,controls:!0,preload:e.preload??s,className:"block min-w-0 flex-1",children:e.mimeType?t.jsx("source",{src:e.src,type:e.mimeType}):null}),n??null]}),Ve=({state:e,src:s,mimeType:n,filename:a,items:r,text:i,groupPosition:o,preload:l,onDismiss:d})=>{const m=ue(e),g=e==="composer"&&!!d,u=Zn({src:s,mimeType:n,filename:a,items:r});if(u.length===0)return null;const x=l??(u.length>1?"none":"metadata");return t.jsx(ce,{variant:m,text:i,groupPosition:o,"data-testid":"audio-attachment",children:t.jsx("div",{className:"flex flex-col gap-2",children:u.map((c,f)=>t.jsx(Qn,{item:c,preload:x,trailingAction:g&&f===0?t.jsx(de,{onClick:d,variant:"inline"}):void 0},`${c.src}-${f}`))})})},ea=e=>t.jsx(Ve,{...e,state:"composer"}),ta=e=>t.jsx(Ve,{...e,state:"sent"}),sa=e=>t.jsx(Ve,{...e,state:"received"}),na={Composer:ea,Sent:ta,Received:sa};function Xt(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 aa={pdf:"PDF",doc:"DOC",xls:"XLS",csv:"CSV",ppt:"PPT",zip:"ZIP",text:"TXT",markdown:"MD"};function Kt(e,s){if(s){const r=s.lastIndexOf(".");if(r>0&&r<s.length-1){const i=s.slice(r+1);if(i&&i.length<=5)return i.toUpperCase()}}if(!e)return;if(K(e)==="document"){const r=At(e),i=aa[r];if(i)return i;if(e==="application/octet-stream")return}const a=e.split("/")[1];if(!(!a||a==="*"))return a.toUpperCase()}function Jt(e,s,n){const a=Kt(e,s),r=typeof n=="number"&&n>0?Xt(n):void 0;return[a,r].filter(Boolean).join(" · ")||void 0}function X(e){try{const n=new URL(e).pathname.split("/").pop();return n&&n.length>0?decodeURIComponent(n):"download"}catch{return"download"}}const ra={dark:"text-white/55",light:"text-black/65"},ia={dark:"bg-white/10",light:"bg-black/5"},oa={dark:"text-white/85",light:"text-black/85"},Zt=({variant:e,filename:s,title:n,mimeType:a="application/octet-stream",fileSize:r,onActivate:i,activateLabel:o,trailingAction:l})=>{const d=n??s??"File",m=Jt(a,s,r),g=t.jsx("div",{className:C("flex size-10 shrink-0 items-center justify-center rounded-sm",ia[e]),"aria-hidden":!0,children:ee(a,{className:C("size-6",oa[e]),weight:"regular"})}),u=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col text-left",children:[t.jsx("p",{className:"truncate font-medium leading-snug",children:d}),m?t.jsx("p",{className:C("truncate text-xs leading-4",ra[e]),children:m}):null]}),x=i?t.jsxs("button",{type:"button",onClick:i,"aria-label":o,className:C("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:[g,u]}):t.jsxs(t.Fragment,{children:[g,u]});return t.jsxs("div",{className:"flex items-center gap-3 px-3 py-2",children:[x,l?t.jsx("div",{className:"shrink-0",children:l}):null]})};async function Qt(e,s){const n=s??X(e);try{const a=await fetch(e,{mode:"cors"});if(!a.ok)throw new Error(`HTTP ${a.status}`);const r=await a.blob(),i=URL.createObjectURL(r),o=document.createElement("a");o.href=i,o.download=n,o.style.display="none",document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(i)}catch{if(!window.open(e,"_blank","noopener,noreferrer")){const r=document.createElement("a");r.href=e,r.download=n,r.target="_blank",r.rel="noopener noreferrer",r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r)}}}const la=({src:e,filename:s,fileSize:n,mimeType:a,title:r,items:i})=>i&&i.length>0?i:e?[{src:e,filename:s,fileSize:n,mimeType:a,title:r}]:[],ca=({variant:e,item:s,index:n,onActivate:a,trailingAction:r})=>{const i=s.filename??X(s.src);return t.jsx(Zt,{variant:e,filename:i,title:s.title,mimeType:s.mimeType??"application/octet-stream",fileSize:s.fileSize,onActivate:()=>a(n),activateLabel:`Download ${i}`,trailingAction:r})},Ge=({state:e,src:s,filename:n,fileSize:a,mimeType:r,title:i,items:o,text:l,groupPosition:d,onClick:m,onDismiss:g})=>{const u=ue(e),x=e==="composer"&&!!g,c=la({src:s,filename:n,fileSize:a,mimeType:r,title:i,items:o}),f=p=>{if((m==null?void 0:m(p))===!1)return;const w=c[p];if(!w)return;const v=w.filename??X(w.src);Qt(w.src,v)};if(c.length===0)return null;const b=t.jsx("span",{className:C("flex size-8 items-center justify-center rounded-full",u==="dark"?"text-white/70":"text-black/70"),"aria-hidden":!0,children:t.jsx(N.DownloadSimpleIcon,{className:"size-5",weight:"bold"})});return t.jsx(ce,{variant:u,text:l,groupPosition:d,"data-testid":"file-attachment",children:t.jsx("div",{className:"flex flex-col gap-2",children:c.map((p,w)=>{const v=x&&w===0?t.jsx(de,{onClick:g,variant:"inline"}):b;return t.jsx(ca,{variant:u,item:p,index:w,onActivate:f,trailingAction:v},`${p.src}-${w}`)})})})},da=e=>t.jsx(Ge,{...e,state:"composer"}),ua=e=>t.jsx(Ge,{...e,state:"sent"}),ma=e=>t.jsx(Ge,{...e,state:"received"}),ha={Composer:da,Sent:ua,Received:ma},He=({onPrev:e,onNext:s,prevLabel:n="Previous",nextLabel:a="Next"})=>t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:e,"aria-label":n,className:"mes-media-viewer__nav mes-media-viewer__nav--prev",children:t.jsx(N.CaretLeftIcon,{size:20,weight:"bold","aria-hidden":!0})}),t.jsx("button",{type:"button",onClick:s,"aria-label":a,className:"mes-media-viewer__nav mes-media-viewer__nav--next",children:t.jsx(N.CaretRightIcon,{size:20,weight:"bold","aria-hidden":!0})})]}),es=({url:e,filename:s,variant:n="pill",label:a="Download",iconOnly:r,tone:i="dark",onTriggered:o})=>{const[l,d]=h.useState(!1),m=h.useCallback(c=>{c.stopPropagation(),!l&&(d(!0),Qt(e,s).catch(()=>{}).finally(()=>{d(!1),o==null||o()}))},[l,e,s,o]),g=r??n!=="pill",x={className:C(n==="pill"?"size-4":"size-5","shrink-0"),weight:"bold"};if(n==="inline"){const c={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 t.jsx("button",{type:"button",onClick:m,disabled:l,"aria-label":a,className:C("flex size-8 shrink-0 items-center justify-center rounded-full transition-colors disabled:opacity-70",c[i]),children:l?t.jsx(N.CircleNotchIcon,{className:"size-4 animate-spin",weight:"bold","aria-hidden":!0}):t.jsx(N.DownloadSimpleIcon,{className:"size-5 shrink-0",weight:"bold","aria-hidden":!0})})}return n==="viewer"?t.jsx("button",{type:"button",onClick:m,disabled:l,"aria-label":a,className:"mes-media-viewer__action",children:l?t.jsx(N.CircleNotchIcon,{size:20,weight:"bold","aria-hidden":!0}):t.jsx(N.DownloadSimpleIcon,{size:20,weight:"bold","aria-hidden":!0})}):t.jsxs("button",{type:"button",onClick:m,disabled:l,"aria-label":g?a:void 0,className:C("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",i==="dark"?"bg-[#121110] text-white hover:bg-[#2a2928]":"bg-white text-[#121110] hover:bg-white/90"),children:[l?t.jsx(N.CircleNotchIcon,{className:"size-4 animate-spin",weight:"bold","aria-hidden":!0}):t.jsx(N.DownloadSimpleIcon,{...x,"aria-hidden":!0}),g?null:a]})},Se=(e,s,n)=>Math.min(Math.max(e,s),n),Ye=({length:e,initialIndex:s,open:n})=>{const a=Se(s,0,Math.max(e-1,0)),[r,i]=h.useState(a);h.useEffect(()=>{n&&i(Se(s,0,Math.max(e-1,0)))},[n,s,e]),h.useEffect(()=>{i(d=>Se(d,0,Math.max(e-1,0)))},[e]);const o=h.useCallback(()=>{e<=1||i(d=>d<=0?e-1:d-1)},[e]),l=h.useCallback(()=>{e<=1||i(d=>d>=e-1?0:d+1)},[e]);return h.useEffect(()=>{if(!n||e<=1)return;const d=m=>{if(m.key!=="ArrowLeft"&&m.key!=="ArrowRight")return;const g=document.activeElement;g&&(g.tagName==="VIDEO"||g.tagName==="AUDIO")||(m.preventDefault(),m.key==="ArrowLeft"?o():l())};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[n,e,o,l]),{index:r,prev:o,next:l}},qe=({open:e,onClose:s,ariaLabel:n,counter:a,actions:r,children:i,"data-testid":o})=>{const l=h.useRef(null),d=h.useRef(null);h.useEffect(()=>{var x;const u=l.current;if(u){if(e){if(!u.open)if(typeof u.showModal=="function")try{u.showModal()}catch{u.setAttribute("open","")}else u.setAttribute("open","");const c=typeof document<"u"?document.activeElement:null;return(x=d.current)==null||x.focus(),()=>{if(u.open)if(typeof u.close=="function")try{u.close()}catch{u.removeAttribute("open")}else u.removeAttribute("open");c&&document.body.contains(c)&&c.focus()}}if(u.open)if(typeof u.close=="function")try{u.close()}catch{u.removeAttribute("open")}else u.removeAttribute("open")}},[e]);const m=()=>{s()},g=u=>{u.target===l.current&&s()};return t.jsxs("dialog",{ref:l,className:"mes-media-viewer","aria-label":n??"Attachment viewer","data-testid":o,onClose:m,onClick:g,children:[t.jsxs("div",{className:"mes-media-viewer__chrome",children:[a?t.jsx("span",{className:"mes-media-viewer__counter",children:a}):null,t.jsxs("div",{className:"mes-media-viewer__actions",children:[r,t.jsx("button",{ref:d,type:"button",onClick:s,"aria-label":"Close viewer",className:"mes-media-viewer__action",children:t.jsx(N.XIcon,{size:20,weight:"bold","aria-hidden":!0})})]})]}),t.jsx("div",{className:"mes-media-viewer__body",children:i})]})},ts=({open:e,items:s,initialIndex:n=0,onClose:a})=>{const{index:r,prev:i,next:o}=Ye({length:s.length,initialIndex:n,open:e}),l=s[r],d=h.useMemo(()=>(l==null?void 0:l.filename)??(l?X(l.src):"image"),[l]);return l?t.jsxs(qe,{open:e,onClose:a,ariaLabel:d,counter:s.length>1?`${r+1} / ${s.length}`:void 0,actions:t.jsx(es,{url:l.src,filename:d,variant:"viewer",label:`Download ${d}`}),"data-testid":"image-viewer",children:[t.jsx("img",{src:l.src,alt:l.alt??d,draggable:!1,loading:"eager",decoding:"async",className:"mes-media-viewer__image"},`${r}:${l.src}`),s.length>1?t.jsx(He,{onPrev:i,onNext:o,prevLabel:"Previous image",nextLabel:"Next image"}):null]}):null},xa="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",ss=({tiles:e,onTileActivate:s,maxVisible:n=4,className:a})=>{const r=e.length;if(r===0)return null;const i=e.slice(0,Math.min(r,n)),o=r-i.length,l=(d,m,g)=>{const u=C(xa,"h-full w-full");return s?t.jsxs("button",{type:"button",onClick:()=>s(m),"aria-label":d.ariaLabel??`Open media ${m+1}`,className:C(u,"cursor-zoom-in"),children:[d.content,g]},m):t.jsxs("div",{className:u,children:[d.content,g]},m)};return i.length===1?t.jsx("div",{className:C("aspect-square w-full",a),children:l(i[0],0)}):i.length===2?t.jsx("div",{className:C("grid aspect-[16/9] w-full grid-cols-2 gap-0.5",a),children:i.map((d,m)=>l(d,m))}):i.length===3?t.jsxs("div",{className:C("grid aspect-[4/3] w-full grid-cols-2 grid-rows-2 gap-0.5",a),children:[t.jsx("div",{className:"row-span-2",children:l(i[0],0)}),l(i[1],1),l(i[2],2)]}):t.jsx("div",{className:C("grid aspect-[4/3] w-full grid-cols-2 grid-rows-2 gap-0.5",a),children:i.map((d,m)=>{const g=o>0&&m===i.length-1;return l(d,m,g?t.jsxs("div",{className:"absolute inset-0 flex items-center justify-center bg-black/55 text-2xl font-semibold text-white",children:["+",o]}):null)})})},me=e=>{const[s,n]=h.useState(!1),[a,r]=h.useState(0),i=h.useCallback(l=>{(e==null?void 0:e(l))!==!1&&(r(l),n(!0))},[e]),o=h.useCallback(()=>n(!1),[]);return{viewerOpen:s,viewerIndex:a,handleActivate:i,closeViewer:o}},fa=(e,s,n,a)=>({ariaLabel:`Open image ${s+1} of ${n}`,content:t.jsx("img",{src:e.src,alt:e.alt??"",width:e.width,height:e.height,draggable:!1,loading:e.loading??a,decoding:"async",className:"absolute inset-0 size-full rounded-md object-cover"})}),ga=({src:e,alt:s,items:n})=>n&&n.length>0?n:e?[{src:e,alt:s}]:[],ns=(e,s)=>e.map((n,a)=>({src:n.src,alt:n.alt,filename:s&&e.length===1?s:s?`${s} (${a+1})`:void 0})),ba=({src:e,alt:s,filename:n,loading:a="lazy",onClick:r,onDismiss:i})=>{const{viewerOpen:o,viewerIndex:l,handleActivate:d,closeViewer:m}=me(r);return t.jsxs("div",{className:"relative w-fit",children:[t.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:t.jsx("img",{src:e,alt:s??"",draggable:!1,loading:a,decoding:"async",className:"size-full object-cover"})}),i?t.jsx("div",{className:"absolute right-2 top-2 z-10",children:t.jsx(de,{onClick:i})}):null,t.jsx(ts,{open:o,items:ns([{src:e,alt:s}],n),initialIndex:l,onClose:m})]})},as=({state:e,src:s,alt:n,filename:a,items:r,text:i,groupPosition:o,loading:l="lazy",onClick:d})=>{const m=ga({src:s,alt:n,items:r}),g=ue(e),{viewerOpen:u,viewerIndex:x,handleActivate:c,closeViewer:f}=me(d);if(m.length===0)return null;const b=m.map((p,w)=>fa(p,w,m.length,l));return t.jsxs(ce,{variant:g,text:i,groupPosition:o,"data-testid":"image-attachment",children:[t.jsx("div",{className:"relative",children:t.jsx(ss,{tiles:b,onTileActivate:c})}),t.jsx(ts,{open:u,items:ns(m,a),initialIndex:x,onClose:f})]})},pa=e=>t.jsx(ba,{...e}),va=e=>t.jsx(as,{...e,state:"sent"}),ja=e=>t.jsx(as,{...e,state:"received"}),wa={Composer:pa,Sent:va,Received:ja},_a=({open:e,items:s,initialIndex:n=0,onClose:a})=>{const{index:r,prev:i,next:o}=Ye({length:s.length,initialIndex:n,open:e}),l=s[r],d=h.useMemo(()=>(l==null?void 0:l.filename)??(l?X(l.src):"document"),[l]),m=h.useMemo(()=>l?Na(l.src):void 0,[l]);return!l||!m?null:t.jsxs(qe,{open:e,onClose:a,ariaLabel:d,counter:s.length>1?`${r+1} / ${s.length}`:void 0,"data-testid":"pdf-viewer",children:[t.jsx("iframe",{src:m,title:d,className:"mes-media-viewer__iframe",sandbox:"allow-scripts allow-forms allow-popups allow-downloads"},`${r}:${l.src}`),s.length>1?t.jsx(He,{onPrev:i,onNext:o,prevLabel:"Previous document",nextLabel:"Next document"}):null]})},Na=e=>{const s=e.indexOf("#"),n=s===-1?e:e.slice(0,s),a=s===-1?"":e.slice(s+1),r=new URLSearchParams(a);return r.has("toolbar")||r.set("toolbar","0"),r.has("navpanes")||r.set("navpanes","0"),`${n}#${r.toString()}`},ya=({src:e,filename:s,fileSize:n,title:a,items:r})=>r&&r.length>0?r:e?[{src:e,filename:s,fileSize:n,title:a}]:[],Ca=({variant:e,item:s,index:n,onActivate:a,trailingAction:r})=>{const i=s.filename??X(s.src);return t.jsx(Zt,{variant:e,filename:i,title:s.title,mimeType:"application/pdf",fileSize:s.fileSize,onActivate:()=>a(n),activateLabel:`Open ${i}`,trailingAction:r})},We=({state:e,src:s,filename:n,fileSize:a,title:r,items:i,text:o,groupPosition:l,onClick:d,onDismiss:m})=>{const g=ue(e),u=ya({src:s,filename:n,fileSize:a,title:r,items:i}),{viewerOpen:x,viewerIndex:c,handleActivate:f,closeViewer:b}=me(d),p=e==="composer"&&!!m;if(u.length===0)return null;const w=u.map(v=>({src:v.src,filename:v.filename??X(v.src)}));return t.jsxs(ce,{variant:g,text:o,groupPosition:l,"data-testid":"pdf-attachment",children:[t.jsx("div",{className:"flex flex-col gap-2",children:u.map((v,I)=>{const E=v.filename??X(v.src),R=p&&I===0?t.jsx(de,{onClick:m,variant:"inline"}):e==="composer"?void 0:t.jsx(es,{url:v.src,filename:E,variant:"inline",label:`Download ${E}`,tone:g});return t.jsx(Ca,{variant:g,item:v,index:I,onActivate:f,trailingAction:R},`${v.src}-${I}`)})}),t.jsx(_a,{open:x,items:w,initialIndex:c,onClose:b})]})},Sa=e=>t.jsx(We,{...e,state:"composer"}),ka=e=>t.jsx(We,{...e,state:"sent"}),Ea=e=>t.jsx(We,{...e,state:"received"}),Ia={Composer:Sa,Sent:ka,Received:Ea},rs=({open:e,items:s,initialIndex:n=0,onClose:a})=>{const{index:r,prev:i,next:o}=Ye({length:s.length,initialIndex:n,open:e}),l=s[r],d=h.useMemo(()=>(l==null?void 0:l.filename)??(l?X(l.src):"video"),[l]);return l?t.jsxs(qe,{open:e,onClose:a,ariaLabel:d,counter:s.length>1?`${r+1} / ${s.length}`:void 0,"data-testid":"video-viewer",children:[t.jsx("video",{src:l.src,poster:l.poster,controls:!0,autoPlay:!0,muted:!0,playsInline:!0,preload:l.preload??"metadata",className:"mes-media-viewer__video",children:l.mimeType?t.jsx("source",{src:l.src,type:l.mimeType}):null},`${r}:${l.src}`),s.length>1?t.jsx(He,{onPrev:i,onNext:o,prevLabel:"Previous video",nextLabel:"Next video"}):null]}):null},Ta=()=>t.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:t.jsx("span",{className:"flex size-12 items-center justify-center rounded-full bg-black/55 text-white backdrop-blur",children:t.jsx(N.PlayIcon,{className:"size-6",weight:"fill","aria-hidden":!0})})}),is=({item:e,index:s})=>t.jsxs("div",{className:"absolute inset-0 size-full bg-[#0d0d0d]",children:[e.poster?t.jsx("img",{src:e.poster,alt:`Video ${s+1} thumbnail`,draggable:!1,loading:"lazy",decoding:"async",className:"absolute inset-0 size-full rounded-md object-cover"}):t.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:t.jsx(N.VideoCameraIcon,{className:"size-16 rounded-md text-white/30",weight:"regular","aria-hidden":!0})}),t.jsx(Ta,{})]}),Ma=(e,s,n)=>({ariaLabel:`Play video ${s+1} of ${n}`,content:t.jsx(is,{item:e,index:s})}),Aa=({src:e,poster:s,mimeType:n,preload:a,items:r})=>r&&r.length>0?a?r.map(i=>({...i,preload:i.preload??a})):r:e?[{src:e,poster:s,mimeType:n,preload:a}]:[],os=(e,s)=>e.map((n,a)=>({src:n.src,poster:n.poster,mimeType:n.mimeType,preload:n.preload,filename:s&&e.length===1?s:s?`${s} (${a+1})`:void 0})),Ra=({src:e,poster:s,mimeType:n,filename:a,preload:r,onClick:i,onDismiss:o})=>{const{viewerOpen:l,viewerIndex:d,handleActivate:m,closeViewer:g}=me(i);return t.jsxs("div",{className:"relative w-fit",children:[t.jsx("button",{type:"button",onClick:()=>m(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:t.jsx(is,{item:{src:e,poster:s,mimeType:n},index:0})}),o?t.jsx("div",{className:"absolute right-2 top-2 z-10",children:t.jsx(de,{onClick:o})}):null,t.jsx(rs,{open:l,items:os([{src:e,poster:s,mimeType:n,preload:r}],a),initialIndex:d,onClose:g})]})},ls=({state:e,src:s,poster:n,mimeType:a,filename:r,items:i,text:o,groupPosition:l,preload:d,onClick:m})=>{const g=Aa({src:s,poster:n,mimeType:a,preload:d,items:i}),u=ue(e),{viewerOpen:x,viewerIndex:c,handleActivate:f,closeViewer:b}=me(m);if(g.length===0)return null;const p=g.map((w,v)=>Ma(w,v,g.length));return t.jsxs(ce,{variant:u,text:o,groupPosition:l,"data-testid":"video-attachment",children:[t.jsx("div",{className:"relative",children:t.jsx(ss,{tiles:p,onTileActivate:f,className:"overflow-hidden rounded-md"})}),t.jsx(rs,{open:x,items:os(g,r),initialIndex:c,onClose:b})]})},La=e=>t.jsx(Ra,{...e}),Da=e=>t.jsx(ls,{...e,state:"sent"}),Pa=e=>t.jsx(ls,{...e,state:"received"}),Oa={Composer:La,Sent:Da,Received:Pa},za={Image:wa,Video:Oa,Audio:na,Pdf:Ia,File:ha},cs=({question:e,onClick:s,loading:n=!1,className:a})=>t.jsx("button",{type:"button",onClick:s,disabled:n,style:{backgroundColor:"#E6E5E3"},className:C("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},a),children:e}),Fa=({faqs:e,onFaqClick:s,loadingFaqId:n,headerText:a,className:r,avatarImage:i,avatarName:o})=>{const l=e.filter(d=>d.enabled).sort((d,m)=>(d.order??0)-(m.order??0));return l.length===0?null:t.jsx("div",{className:r,children:t.jsxs("div",{className:"flex gap-3 items-end",children:[(i||o)&&t.jsx("div",{className:"flex-none",children:t.jsx(Z,{id:o||"account",name:o||"Account",image:i,size:24,shape:"circle"})}),t.jsxs("div",{className:"flex-1 flex flex-col gap-3 rounded-lg p-4",style:{backgroundColor:"#F1F0EE"},children:[a&&t.jsx("p",{className:"text-md text-charcoal mb-4",children:a}),l.map(d=>t.jsx(cs,{question:d.question,onClick:()=>s(d.id),loading:n===d.id},d.id))]})]})})};exports.ActionButton=ae;exports.AttachmentThumbnail=De;exports.Avatar=Z;exports.ChannelEmptyState=Vt;exports.ChannelList=qt;exports.ChannelView=Fe;exports.CustomMessageProvider=Ys;exports.FaqList=Fa;exports.FaqListItem=cs;exports.LinkAttachment=Hn;exports.LockedAttachment=Ie;exports.MediaMessage=Vs;exports.MessageAttachment=za;exports.MessageVoteButtons=$t;exports.MessagingProvider=ms;exports.MessagingShell=Sn;exports.bubbleGroupPositionFromStream=Jn;exports.buildCompactMetaLabel=Jt;exports.formatFileSize=Xt;exports.formatRelativeTime=Ht;exports.getFileExtensionLabel=Kt;exports.getMessageDisplayText=Re;exports.getSourceType=K;exports.isLinkAttachment=ze;exports.isUuidLike=kt;exports.normalizeLanguageCode=It;exports.renderTypeIcon=ee;exports.resolveLinkAttachment=ve;exports.resolveMediaFromMessage=je;exports.resolveParticipantDisplayName=Ae;exports.useCustomMessage=zt;exports.useMessageVote=Et;exports.useMessaging=Ct;
2
+ //# sourceMappingURL=index-B_8de68T.cjs.map