const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BlobbiStateCard-DnVg3tNE.js","assets/rolldown-runtime-QTnfLwEv.js","assets/lucide-icons-BjbcRgLk.js","assets/jsx-runtime-By8HlURe.js","assets/utils-BFSTDHdM.js","assets/blobbi-tV-LVZhE.js","assets/sha256-Cx9u8cje.js","assets/index-Bow5buFk.js","assets/react-dom-B3NAB_6u.js","assets/useNip05Resolve-DffiSbg0.js","assets/useQuery-CQCUTxAw.js","assets/nostrId-DcIQ4FCD.js","assets/dist-DPmmj29U.js","assets/esm-CRVqHnq2.js","assets/ErrorBoundary-CeoYY2tU.js","assets/preload-helper-CZgWQFsJ.js","assets/useMutation-Du3NQIud.js","assets/useInfiniteQuery-D8okYDlC.js","assets/useLocalStorage-CLIGOX6B.js","assets/useAppContext-ZpOJAKgd.js","assets/useTheme-DAiZ1C6g.js","assets/useEncryptedSettings-Mj6Bzp-m.js","assets/fetchFreshEvent-Kkz3MzZN.js","assets/useCurrentUser-boOMG5Xx.js","assets/dist-DQ_zK-Nr.js","assets/fontLoader-B9KxicFi.js","assets/sanitizeUrl-Bk5f35GN.js","assets/useNostrPublish-D1pQ9KV-.js","assets/react-intl-DZWxPhxo.js","assets/useLanguage--9xPt4K_.js","assets/credentialManager-Dv_8gYNN.js","assets/downloadFile-kpATXaJi.js","assets/encryptedFile-DKFYUsvG.js","assets/NewPostsPill-BaedKv8h.js","assets/LayoutContext-CseIvyNG.js","assets/dist-DEYuuXMO.js","assets/button-PfnADMEc.js","assets/dist-Dpfwv2h4.js","assets/dist-DvXXZeEa.js","assets/useFollowActions-DsgUKin8.js","assets/appRelays-Clm5NPIe.js","assets/letterTypes-BPWQWRGQ.js","assets/avatar-BQAt2c6L.js","assets/chunk-62JRHF6Z-BC2Zeguv.js","assets/CustomEmoji-I2Dzbi7x.js","assets/customEmoji-kpim4Htm.js","assets/profileUrl-DpJiPx2H.js","assets/useProfileUrl-CaWgk1iO.js","assets/ExternalFavicon-C4RKLGFC.js","assets/useUserStatus-B8wcD2cC.js","assets/haptics-Cp_uF-bV.js","assets/input-CspJi8Oq.js","assets/dropdown-menu-DFQx4ARb.js","assets/dist-D7Bu0-nC.js","assets/dist-CcIWO21i2.js","assets/dist-CKGV8nry.js","assets/dist-CPSwqoBy.js","assets/dist-kXp6QuJv.js","assets/dist-BiDubxw8.js","assets/dist-CGiXP6ew.js","assets/dist-l851fJFf.js","assets/dist-CogQAcR-.js","assets/Combination-CjNgozRb.js","assets/usePortalContainer-DQGL8y5W.js","assets/popover-CpFQm40Y.js","assets/skeleton-CVls4GW9.js","assets/ProfileCard-DQLNVDBD.js","assets/BioContent-DDUa8M5F.js","assets/hashtag-DjDKS0mr.js","assets/parseAddr-CsIsUI6W.js","assets/collapsible-D6IpicA3.js","assets/dist-Ds1tJnF3.js","assets/dist-CxcvWxxD2.js","assets/dist-CDe9cWnA.js","assets/dist-VfIIxYhK.js","assets/useAuthors-D2-iLlS9.js","assets/appBlossom-CsMDSd4h.js","assets/storageKey-Hu6452Ya.js","assets/useMuteList-CircRxPI.js","assets/useLoginActions-DN9mAG_d.js","assets/LoginFlow-CnOkE_pG.js","assets/dist-HCKlYXPm.js","assets/dialog-CV-ki2ew.js","assets/qrcode-BozHOxi9.js","assets/browser-B_X_RtOd.js","assets/useIsMobile-brkrNavj.js","assets/useShareOrigin-CbCLa1kb.js","assets/alert-8XHA_vtM.js","assets/useUploadFile-geM_X2W-.js","assets/safeNip19-BZNpFefA.js","assets/useEventInteractions-D6e37IFo.js","assets/nsiteSubdomain-DmdGxq_K.js","assets/ComposeDialogContent-DiIapF7b.js","assets/WikipediaIcon-Df-eqPdn.js","assets/BlueskyIcon-imVay4Hn.js","assets/tooltip-ihPDheAv.js","assets/esplora-CScU9uce.js","assets/musicHelpers-B9zs9cce.js","assets/imeta-AKViBfwk.js","assets/textarea-BgTH9QGZ.js","assets/EmbeddedPost-DITW2flc.js","assets/dist-3TtKm3JK.js","assets/useLinkPreview-BkYXhPdP.js","assets/bitcoinMoney-BhQyBHpS.js","assets/countries-Du6BjHuX.js","assets/extraKinds-CF0LI2P1.js","assets/sidebarItems-BUQKy0PN.js","assets/formatNumber-D1ols1S-.js","assets/formatTime-CT4ZmnVr.js","assets/useCustomEmojis-Dt5wlrd3.js","assets/useSearchProfiles-B9G_eYtw.js","assets/useFeedSettings-BgA2vWPo.js","assets/birthday-CoMNDhVK.js","assets/resizeImage-LOlp-rx5.js","assets/DecryptedImage-DwsS1fNG.js","assets/wikimedia-CCPyM-j2.js","assets/getDisplayName-B6lnEGRj.js","assets/optimisticEvent-1jcgWuWv.js","assets/useInView-DH5wwDuH.js","assets/NoteCard-D2oNQMft.js","assets/timeAgo-BXjjbyXp.js","assets/packUtils-2qvnOK3p.js","assets/relayList-BL1oPXvf.js","assets/memorycard-MlvJNhop.js","assets/EmbeddedPublicationCard-CB7mdYv1.js","assets/campaign-DQCR5kmK.js","assets/quiz-C4N9ueCX.js","assets/NoteMoreMenu-3p8z2oYh.js","assets/label-vPn5dXR9.js","assets/radio-group-B1VhA2GH.js","assets/dist-QlrhncJe.js","assets/dist-C7V3QC0v.js","assets/alert-dialog-CeTXY_OC.js","assets/separator-b5OgNKgY.js","assets/scroll-area-C7R5cbXG.js","assets/dist-C2J943E6.js","assets/useUserLists-DfjIOk3O.js","assets/useInteractionReaction-yS8fuYfx.js","assets/badge-CmNUd8lU.js","assets/colorMomentUtils-Bpys-FvF.js","assets/contentWarning-CNDzjeMP.js","assets/streamStatus-DVDPiDhw.js","assets/useRelayInfo-vo6x6CNq.js","assets/GitSiteLinks-Qp1PbuLj.js","assets/useOpenPost-BwUmNKcO.js","assets/switch-DKbY1cT2.js","assets/useRepostStatus-B31cmi_e.js","assets/useBitcoinSigner-FZ_QaYrL.js","assets/checkbox-PjbMGVRG.js","assets/RepostMenu-Cxcb2_YK.js","assets/lib-BtieP5-E.js","assets/lib-DhF-PQbN.js","assets/useTrending-Chl2smhy.js","assets/vineGlobalMute-Du-DhONT.js","assets/SubHeaderBar-3es_mHJE.js","assets/usePageRefresh-DfuHEbb5.js","assets/useMutedAuthorFilter-CJzmJTvY.js","assets/index-DWpLMzA2.css","assets/blobbi-shop-items-CNXfdKej.js","assets/BlobbiStageVisual-Dd-i9Ybg.js","assets/purify.es-DCh266OY.js","assets/BlobbiStageVisual-ZqmrGSeZ.css","assets/useBlobbiInteractions-BLqS6Kj4.js","assets/FloatingSocialHearts-B41ZB2oO.js","assets/bitcoin-CZvT_Ikr.js","assets/silentPaymentsCore-DNoThJua.js"])))=>i.map(i=>d[i]); import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$n as t,$t as n,Ar as r,D as i,En as a,Fn as o,Fr as s,Ft as c,Gr as l,It as u,Jn as d,Jr as f,Kr as p,Lr as m,Mr as h,Nn as g,Qr as _,Qt as v,R as y,Rn as b,Rr as x,Tt as S,W as C,Wr as w,Wt as T,Y as E,_ as D,_r as O,a as ee,ai as k,at as A,b as j,br as M,cn as te,dt as ne,ei as re,g as ie,gi as N,h as ae,in as P,ir as oe,it as se,ki as ce,kr as le,kt as ue,lr as de,on as fe,ot as pe,qn as me,qr as he,r as ge,rr as _e,st as ve,tn as ye,ui as be,ur as xe,v as Se,w as Ce,wt as we,xn as Te,xt as Ee,zn as De,zr as Oe}from"./lucide-icons-BjbcRgLk.js";import{t as ke}from"./react-dom-B3NAB_6u.js";import{t as Ae}from"./jsx-runtime-By8HlURe.js";import{t as je}from"./ErrorBoundary-CeoYY2tU.js";import{t as Me}from"./preload-helper-CZgWQFsJ.js";import{f as Ne,l as Pe,t as Fe,v as Ie}from"./dist-DPmmj29U.js";import{_ as Le,b as Re,g as ze,h as Be,i as Ve,m as He,p as Ue,s as We,u as F,v as Ge}from"./esm-CRVqHnq2.js";import{a as Ke,i as qe,o as Je,t as Ye}from"./sha256-Cx9u8cje.js";import{L as Xe,N as Ze,a as Qe,c as $e,f as et,g as tt,h as nt,i as rt,l as it,o as at,p as ot,r as st,s as ct,t as I,u as lt,y as ut}from"./useQuery-CQCUTxAw.js";import{t as dt}from"./useMutation-Du3NQIud.js";import{t as ft}from"./useAppContext-ZpOJAKgd.js";import{L as pt,M as mt,R as ht,T as gt,j as _t,t as vt,w as yt}from"./useTheme-DAiZ1C6g.js";import{n as bt,r as L}from"./sanitizeUrl-Bk5f35GN.js";import{o as xt,r as St}from"./react-intl-DZWxPhxo.js";import{t as Ct}from"./dist-DQ_zK-Nr.js";import{n as wt,s as Tt}from"./encryptedFile-DKFYUsvG.js";import{a as Et,i as Dt,n as Ot}from"./downloadFile-kpATXaJi.js";import{t as kt}from"./fetchFreshEvent-Kkz3MzZN.js";import{i as At,l as R,o as jt,p as Mt,s as Nt,t as Pt}from"./useCurrentUser-boOMG5Xx.js";import{t as z}from"./utils-BFSTDHdM.js";import{t as B}from"./button-PfnADMEc.js";import{t as Ft}from"./useNostrPublish-D1pQ9KV-.js";import{t as V}from"./nostrId-DcIQ4FCD.js";import{a as It,i as Lt}from"./letterTypes-BPWQWRGQ.js";import{n as H,o as U,r as W,t as G}from"./avatar-BQAt2c6L.js";import{c as K,n as q}from"./chunk-62JRHF6Z-BC2Zeguv.js";import{t as Rt}from"./customEmoji-kpim4Htm.js";import{t as zt}from"./hashtag-DjDKS0mr.js";import{n as Bt,t as Vt}from"./CustomEmoji-I2Dzbi7x.js";import{t as J}from"./useProfileUrl-CaWgk1iO.js";import{_ as Ht,a as Ut,b as Wt,c as Gt,g as Kt,i as qt,n as Jt,r as Y,s as Yt,v as Xt,y as Zt}from"./BioContent-DDUa8M5F.js";import{n as Qt,t as $t}from"./ExternalFavicon-C4RKLGFC.js";import{n as en}from"./haptics-Cp_uF-bV.js";import{t as tn}from"./parseAddr-CsIsUI6W.js";import{n as nn,r as rn,t as an}from"./collapsible-D6IpicA3.js";import{t as X}from"./skeleton-CVls4GW9.js";import{t as on}from"./useAuthors-D2-iLlS9.js";import{n as sn}from"./appBlossom-CsMDSd4h.js";import{t as cn}from"./storageKey-Hu6452Ya.js";import{r as ln}from"./safeNip19-BZNpFefA.js";import{a as un,c as dn,f as fn,n as pn,p as mn,r as hn,s as gn,t as _n,u as vn}from"./useEventInteractions-D6e37IFo.js";import{c as yn}from"./nsiteSubdomain-DmdGxq_K.js";import{i as bn,n as xn,t as Sn}from"./tooltip-ihPDheAv.js";import{a as Cn,c as wn,n as Tn,t as En}from"./dialog-CV-ki2ew.js";import{t as Dn}from"./timeAgo-BXjjbyXp.js";import{t as On}from"./getDisplayName-B6lnEGRj.js";import{r as kn,t as An}from"./letterUtils-rB1MsAOm.js";import{r as jn}from"./optimisticEvent-1jcgWuWv.js";import{i as Mn,n as Nn,r as Pn,t as Fn}from"./useLinkPreview-BkYXhPdP.js";import{n as In,r as Ln,t as Rn}from"./packUtils-2qvnOK3p.js";import{n as zn,r as Bn}from"./relayList-BL1oPXvf.js";import{_ as Vn,h as Hn,l as Un,m as Wn,o as Gn,r as Kn,s as qn}from"./memorycard-MlvJNhop.js";import{r as Jn,t as Yn}from"./EmbeddedArticleCard-DcmW__gy.js";import{t as Xn}from"./articleHelpers-Dhr_Z8YP.js";import{o as Zn,t as Qn}from"./EmbeddedPublicationCard-CB7mdYv1.js";import{f as $n,o as er,t as tr}from"./bitcoinMoney-BhQyBHpS.js";import{t as nr}from"./countries-Du6BjHuX.js";import{o as rr}from"./campaign-DQCR5kmK.js";import{c as ir,u as ar}from"./quiz-C4N9ueCX.js";import{c as or,o as sr,u as cr}from"./extraKinds-CF0LI2P1.js";import{t as lr}from"./formatNumber-D1ols1S-.js";import{t as ur}from"./browser-B_X_RtOd.js";import{i as dr,n as fr,o as pr,r as mr,s as hr}from"./imeta-AKViBfwk.js";import{t as gr}from"./formatTime-CT4ZmnVr.js";import{t as _r}from"./browser-C1AyMpfR.js";import{o as vr}from"./LayoutContext-CseIvyNG.js";import{t as yr}from"./useInView-DH5wwDuH.js";import{t as br}from"./useCustomEmojis-Dt5wlrd3.js";function xr(e,t){return e.filter(e=>!t.includes(e))}function Sr(e,t,n){let r=e.slice(0);return r[t]=n,r}var Cr=class extends Xe{#e;#t;#n;#r;#i;#a;#o;#s;#c=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#f(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,ut.batch(()=>{let e=this.#i,t=this.#d(this.#n);this.#c=t,t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=n.some((t,n)=>t!==e[n]);e.length===n.length&&!i||(this.#i=n,this.#t=r,this.hasListeners()&&(xr(e,n).forEach(e=>{e.destroy()}),xr(n,e).forEach(e=>{e.subscribe(t=>{this.#f(e,t)})}),this.#p()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#d(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions));return[r,e=>this.#u(e??r,t),()=>this.#l(r,n)]}#l(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#u(e,t){return t?((!this.#a||this.#t!==this.#s||t!==this.#o)&&(this.#o=t,this.#s=this.#t,this.#a=Ze(this.#a,t(e))),this.#a):e}#d(e){let t=new Map(this.#i.map(e=>[e.options.queryHash,e])),n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash);i?n.push({defaultedQueryOptions:r,observer:i}):n.push({defaultedQueryOptions:r,observer:new tt(this.#e,r)})}),n}#f(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Sr(this.#t,n,t),this.#p())}#p(){if(this.hasListeners()){let e=this.#a,t=this.#l(this.#t,this.#c);e!==this.#u(t,this.#r?.combine)&&ut.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},Z=e(ce(),1);function wr({queries:e,...t},n){let r=nt(n),i=ot(),a=et(),o=Z.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{st(e),ct(e,a)}),it(a);let[s]=Z.useState(()=>new Cr(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;Z.useSyncExternalStore(Z.useCallback(e=>d?s.subscribe(ut.batchCalls(e)):lt,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),Z.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>Qe(o[t],e))?c.flatMap((e,t)=>{let n=o[t];if(n){let t=new tt(r,n);if(Qe(n,e))return rt(n,t,a);at(e,i)&&rt(n,t,a)}return[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&$e({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}var Tr={id:`data-highlight-id`,pubkey:`data-highlight-pubkey`,kind:`data-highlight-kind`,addr:`data-highlight-addr`};function Er(e){if(!e||!V(e.id)||!V(e.pubkey))return{};let t={[Tr.id]:e.id,[Tr.pubkey]:e.pubkey,[Tr.kind]:String(e.kind)};if(Ne.replaceable(e.kind)||Ne.addressable(e.kind)){let n=e.tags.find(([e])=>e===`d`)?.[1]??``;t[Tr.addr]=`${e.kind}:${e.pubkey}:${Ne.addressable(e.kind)?n:``}`}return t}function Dr(e){if(!e)return;let t=e.getAttribute(Tr.id),n=e.getAttribute(Tr.pubkey),r=e.getAttribute(Tr.kind);if(!t||!n||!r||!V(t)||!V(n))return;let i=Number(r);if(Number.isInteger(i))return{id:t,pubkey:n,kind:i,addr:e.getAttribute(Tr.addr)??void 0}}function Or(e){let t=e instanceof Element?e:e?.parentElement??null;for(;t;){let e=Dr(t);if(e)return e;t=t.parentElement}}function kr(e,t){let n=[];return e.addr?n.push([`a`,e.addr]):n.push([`e`,e.id]),n.push([`p`,e.pubkey,``,`author`]),t&&n.push([`context`,t]),n.push([`alt`,`Highlight`]),n}var Q=Ae();function Ar({compact:e=!1,className:t}){return(0,Q.jsx)(`div`,{className:z(`rounded-2xl border border-dashed border-border`,e?`mt-1`:`mt-2`,t),children:(0,Q.jsxs)(`div`,{className:z(`flex flex-col items-center justify-center gap-2 text-center text-muted-foreground`,e?`px-3 py-3 text-xs`:`px-3.5 py-4 text-sm`),children:[(0,Q.jsx)(d,{className:z(e?`size-4`:`size-5`),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:`This post could not be displayed`})]})})}function $({pubkey:e,createdAt:t,navigateTo:n,className:r,disableHoverCards:i,children:a}){let o=K(),s=R(e),c=s.data?.metadata,l=U(c),u=c?.name||c?.display_name||`Anonymous`,d=J(e,c);return(0,Q.jsx)(`div`,{className:z(`group block rounded-2xl border border-border overflow-hidden`,`hover:bg-secondary/40 transition-colors cursor-pointer`,r),role:`link`,tabIndex:0,onClick:e=>{e.stopPropagation(),o(`/${n}`)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),o(`/${n}`))},children:(0,Q.jsxs)(`div`,{className:`px-3 py-2 space-y-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[s.isLoading?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{className:`size-5 rounded-full shrink-0`}),(0,Q.jsx)(X,{className:`h-3.5 w-24`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(jr,{pubkey:e,disabled:i,children:(0,Q.jsx)(q,{to:d,className:`shrink-0`,onClick:e=>e.stopPropagation(),children:(0,Q.jsxs)(G,{shape:l,className:`size-5`,children:[(0,Q.jsx)(W,{src:c?.picture,alt:u}),(0,Q.jsx)(H,{className:`bg-primary/20 text-primary text-[10px]`,children:u[0]?.toUpperCase()})]})})}),(0,Q.jsx)(jr,{pubkey:e,disabled:i,children:(0,Q.jsx)(q,{to:d,className:`text-sm font-semibold truncate hover:underline`,onClick:e=>e.stopPropagation(),children:s.data?.event?(0,Q.jsx)(Bt,{tags:s.data.event.tags,children:u}):u})})]}),(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:[`· `,Dn(t)]})]}),a]})})}function jr({pubkey:e,disabled:t,children:n}){return t?(0,Q.jsx)(Q.Fragment,{children:n}):(0,Q.jsx)(Y,{pubkey:e,asChild:!0,children:n})}function Mr(e){switch(e){case 1617:return{icon:_e,label:`Patch`,iconClassName:`text-orange-500 dark:text-orange-400`};case 1618:return{icon:b,label:`Pull request`,iconClassName:`text-emerald-600 dark:text-emerald-400`};case 1619:return{icon:De,label:`Pull request update`,iconClassName:`text-emerald-600 dark:text-emerald-400`};case 1621:return{icon:m,label:`Issue`,iconClassName:`text-green-600 dark:text-green-400`};case 1630:return{icon:m,label:mn(e),iconClassName:`text-green-600 dark:text-green-400`};case 1631:return{icon:Oe,label:mn(e),iconClassName:`text-purple-600 dark:text-purple-400`};case 1632:return{icon:s,label:mn(e),iconClassName:`text-red-600 dark:text-red-400`};default:return{icon:x,label:mn(e),iconClassName:`text-muted-foreground`}}}function Nr({event:e,className:t,disableHoverCards:n}){let r=(0,Z.useMemo)(()=>F.neventEncode({id:e.id,author:e.pubkey}),[e.id,e.pubkey]),{icon:i,label:a,iconClassName:o}=Mr(e.kind),s=vn(e)?.identifier,c=e.kind>=1630&&e.kind<=1633,l=e.kind===1619||c?e.content.split(` `)[0]?.trim():fn(e);return(0,Q.jsxs)($,{pubkey:e.pubkey,createdAt:e.created_at,navigateTo:r,className:t,disableHoverCards:n,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:[(0,Q.jsx)(i,{className:`size-3 ${o}`}),a]}),l&&(0,Q.jsx)(`p`,{className:`mt-1 text-sm font-medium leading-snug line-clamp-2 break-words`,children:l}),s&&(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground font-mono truncate`,children:s})]})}function Pr({event:e,className:t,timestamp:n}){let r=(0,Z.useMemo)(()=>F.npubEncode(e.pubkey),[e.pubkey]),i=e.tags.some(([e,t])=>e===`relay`&&t===`ALL_RELAYS`),a=e.content||void 0;return(0,Q.jsxs)(`div`,{className:z(`rounded-xl border-2 border-red-500/30 overflow-hidden`,t),children:[(0,Q.jsx)(`div`,{className:`vanish-stripes h-1.5`}),(0,Q.jsxs)(`div`,{className:`px-3 py-2.5 bg-red-500/[0.04] dark:bg-red-500/[0.06] space-y-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,Q.jsx)(`div`,{className:`size-8 rounded-full bg-red-500/10 border border-red-500/30 flex items-center justify-center`,children:(0,Q.jsx)(`span`,{className:`text-sm font-black vanish-glitch-text text-red-500 dark:text-red-400`,"data-text":`///`,children:`///`})}),(0,Q.jsx)(`div`,{className:`absolute -bottom-0.5 -right-0.5 size-3.5 rounded-full bg-red-600 flex items-center justify-center`,children:(0,Q.jsx)(`span`,{className:`text-[7px] font-black text-white leading-none`,children:`!`})})]}),(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-bold text-red-500 dark:text-red-400 leading-tight`,children:i?`Global Request to Vanish`:`Request to Vanish`}),(0,Q.jsx)(`p`,{className:`text-[11px] text-muted-foreground font-mono truncate mt-0.5`,children:r})]}),n&&(0,Q.jsx)(`span`,{className:`text-[11px] text-muted-foreground shrink-0`,children:n})]}),a&&(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground italic line-clamp-2 pl-[42px]`,children:[`“`,a,`”`]})]}),(0,Q.jsx)(`div`,{className:`vanish-stripes h-1.5`})]})}function Fr({event:e,compact:t}){if(t)return(0,Q.jsx)(Pr,{event:e,className:`mt-2`});let n=F.npubEncode(e.pubkey),r=e.tags.filter(([e])=>e===`relay`),i=r.some(([,e])=>e===`ALL_RELAYS`),a=r.map(([,e])=>e).filter(e=>e!==`ALL_RELAYS`),o=e.content||void 0,s=new Date(e.created_at*1e3).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`,hour12:!0});return(0,Q.jsxs)(`div`,{className:`mt-4 space-y-0`,children:[(0,Q.jsx)(`div`,{className:`vanish-stripes h-3 rounded-t-xl`}),(0,Q.jsxs)(`div`,{className:`relative border-x-2 border-red-500/30 bg-gradient-to-b from-red-500/[0.06] to-red-500/[0.02] dark:from-red-500/[0.08] dark:to-red-500/[0.03] px-5 py-6 overflow-hidden isolate`,children:[(0,Q.jsx)(`div`,{className:`absolute inset-0 opacity-[0.03] dark:opacity-[0.05] -z-10 pointer-events-none`,style:{backgroundImage:`repeating-linear-gradient(45deg, currentColor 0, currentColor 1px, transparent 0, transparent 50%)`,backgroundSize:`12px 12px`}}),(0,Q.jsx)(`div`,{className:`flex justify-center mb-5`,children:(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-red-500/20 vanish-ring-pulse`}),(0,Q.jsx)(`div`,{className:`absolute -inset-2 rounded-full border border-red-500/10 vanish-ring-pulse-delayed`}),(0,Q.jsx)(`div`,{className:`relative size-16 rounded-full bg-red-500/10 border-2 border-red-500/40 flex items-center justify-center shadow-lg shadow-red-500/10`,children:(0,Q.jsx)(`span`,{className:`text-2xl font-black vanish-glitch-text text-red-500 dark:text-red-400`,"data-text":`///`,children:`///`})}),(0,Q.jsx)(`div`,{className:`absolute -bottom-1 -right-1 size-6 rounded-full bg-red-600 border-2 border-background flex items-center justify-center shadow-md`,children:(0,Q.jsx)(`span`,{className:`text-xs font-black text-white leading-none`,children:`!`})})]})}),(0,Q.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,Q.jsx)(`h3`,{className:`text-lg font-black tracking-tight text-red-500 dark:text-red-400 uppercase`,children:i?`Global Request to Vanish`:`Request to Vanish`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed max-w-sm mx-auto`,children:i?`This identity has requested permanent erasure from all Nostr relays.`:`This identity has requested permanent erasure from ${a.length} relay${a.length===1?``:`s`}.`})]}),(0,Q.jsxs)(`div`,{className:`mt-5 rounded-lg border border-red-500/20 bg-red-500/[0.04] dark:bg-red-500/[0.06] p-4 space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground uppercase tracking-wider font-bold`,children:[(0,Q.jsx)(`div`,{className:`size-2 rounded-full bg-red-500 vanish-blink`}),(0,Q.jsx)(`span`,{children:`Identity`})]}),(0,Q.jsx)(`p`,{className:`font-mono text-xs text-foreground/80 break-all leading-relaxed select-all`,children:n})]}),o&&(0,Q.jsxs)(`div`,{className:`mt-4 rounded-lg border border-border/50 bg-background/50 p-4`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground uppercase tracking-wider font-bold mb-2`,children:`Final words`}),(0,Q.jsxs)(`blockquote`,{className:`text-sm text-foreground/80 italic leading-relaxed pl-3 border-l-2 border-red-500/40`,children:[`“`,o,`”`]})]}),!i&&a.length>0&&(0,Q.jsxs)(`div`,{className:`mt-4 rounded-lg border border-border/50 bg-background/50 p-4`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground uppercase tracking-wider font-bold mb-2`,children:`Target relays`}),(0,Q.jsx)(`div`,{className:`space-y-1`,children:a.map(e=>(0,Q.jsx)(`p`,{className:`font-mono text-xs text-foreground/70`,children:e},e))})]}),(0,Q.jsx)(`p`,{className:`text-center text-xs text-muted-foreground mt-5`,children:s})]}),(0,Q.jsx)(`div`,{className:`vanish-stripes h-3 rounded-b-xl`})]})}function Ir({pubkey:e}){let t=R(e),n=t.data?.metadata,r=U(n),i=On(n,e),a=J(e,n);return t.isLoading?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5 min-w-0`,children:[(0,Q.jsx)(X,{className:`size-10 rounded-full`}),(0,Q.jsx)(X,{className:`h-3 w-14`})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5 min-w-0`,children:[(0,Q.jsx)(Y,{pubkey:e,asChild:!0,children:(0,Q.jsx)(q,{to:a,onClick:e=>e.stopPropagation(),children:(0,Q.jsxs)(G,{shape:r,className:`size-10 ring-2 ring-background shadow-md`,children:[(0,Q.jsx)(W,{src:n?.picture,alt:i}),(0,Q.jsx)(H,{className:`bg-primary/20 text-primary text-xs font-semibold`,children:i[0]?.toUpperCase()})]})})}),(0,Q.jsx)(Y,{pubkey:e,asChild:!0,children:(0,Q.jsx)(q,{to:a,onClick:e=>e.stopPropagation(),className:`text-xs font-medium text-foreground/80 hover:text-foreground truncate max-w-[80px] transition-colors`,children:i})})]})}function Lr({event:e,compact:t,className:n}){let r=e.tags.find(([e])=>e===`p`)?.[1],i=On(R(e.pubkey).data?.metadata,e.pubkey);return r?(0,Q.jsx)(`div`,{className:z(`mt-2`,n),children:(0,Q.jsxs)(`div`,{className:`rounded-2xl border border-border px-5 py-4`,children:[(0,Q.jsxs)(`p`,{className:`text-sm text-muted-foreground text-center mb-3`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-foreground`,children:i}),` sent a direct message`]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-center gap-3`,children:[(0,Q.jsx)(Ir,{pubkey:e.pubkey}),(0,Q.jsxs)(`div`,{className:`flex-1 flex items-center justify-center min-w-0 max-w-[180px] relative`,children:[(0,Q.jsx)(`div`,{className:`absolute inset-x-0 top-1/2 -translate-y-1/2 h-px border-t-2 border-dashed border-foreground/15`}),(0,Q.jsx)(`div`,{className:`relative z-10 flex items-center justify-center`,children:(0,Q.jsx)(`div`,{className:`size-9 rounded-full bg-background border-2 border-foreground/10 flex items-center justify-center shadow-sm`,children:(0,Q.jsx)(P,{className:`size-4 text-muted-foreground`})})})]}),(0,Q.jsx)(Ir,{pubkey:r})]})]})}):(0,Q.jsx)(`div`,{className:z(`mt-2 px-4 py-3`,n),children:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground italic`,children:`Encrypted message (no recipient found)`})})}function Rr({event:e,className:t}){let n=K(),r=R(e.pubkey),i=r.data?.metadata,a=U(i),o=i?.name||i?.display_name||`Anonymous`,s=e.tags.find(([e])=>e===`p`)?.[1],c=R(s??``),l=s?On(c.data?.metadata,s):void 0,u=(0,Z.useMemo)(()=>F.neventEncode({id:e.id,author:e.pubkey}),[e.id,e.pubkey]),d=J(e.pubkey,i);return(0,Q.jsx)(`div`,{className:z(`group block rounded-2xl border border-border overflow-hidden`,`hover:bg-secondary/40 transition-colors cursor-pointer`,t),role:`link`,tabIndex:0,onClick:e=>{e.stopPropagation(),n(`/${u}`)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),n(`/${u}`))},children:(0,Q.jsxs)(`div`,{className:`px-3 py-2 space-y-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[r.isLoading?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{className:`size-5 rounded-full shrink-0`}),(0,Q.jsx)(X,{className:`h-3.5 w-24`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Y,{pubkey:e.pubkey,asChild:!0,children:(0,Q.jsx)(q,{to:d,className:`shrink-0`,onClick:e=>e.stopPropagation(),children:(0,Q.jsxs)(G,{shape:a,className:`size-5`,children:[(0,Q.jsx)(W,{src:i?.picture,alt:o}),(0,Q.jsx)(H,{className:`bg-primary/20 text-primary text-[10px]`,children:o[0]?.toUpperCase()})]})})}),(0,Q.jsx)(Y,{pubkey:e.pubkey,asChild:!0,children:(0,Q.jsx)(q,{to:d,className:`text-sm font-semibold truncate hover:underline`,onClick:e=>e.stopPropagation(),children:o})})]}),(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:[`· `,Dn(e.created_at)]})]}),(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-sm text-muted-foreground`,children:[(0,Q.jsx)(P,{className:`size-3.5 shrink-0`}),(0,Q.jsxs)(`span`,{children:[`Sent a direct message`,l?(0,Q.jsxs)(Q.Fragment,{children:[` to `,(0,Q.jsx)(`span`,{className:`font-medium text-foreground`,children:l})]}):``]})]})]})})}var zr=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Br=Array.from({length:64},(e,t)=>String.fromCodePoint(110960+t)),Vr=new Map(zr.split(``).map((e,t)=>[e,Br[t]]));function Hr(e,t=36){let n=e.replace(/[\s=]/g,``),r=[],i=Math.max(1,Math.floor(n.length/t));for(let e=0;ee.stopPropagation(),className:`font-semibold truncate hover:underline transition-colors`,style:{fontFamily:`'Caveat', 'Pacifico', cursive`,fontSize:s},children:a})})]})}function Wr({pubkey:e}){let t=R(e).data?.metadata,n=On(t,e),r=U(t);return(0,Q.jsx)(Y,{pubkey:e,asChild:!0,children:(0,Q.jsx)(q,{to:J(e,t),onClick:e=>e.stopPropagation(),children:(0,Q.jsxs)(G,{shape:r,className:`size-12 ring-2 ring-amber-900/30 shadow-lg`,children:[(0,Q.jsx)(W,{src:t?.picture,alt:n}),(0,Q.jsx)(H,{className:`bg-amber-900/20 text-amber-900 text-sm font-bold`,children:n[0]?.toUpperCase()})]})})})}function Gr({event:e,compact:t,className:n}){let[r,i]=(0,Z.useState)(`back`),a=e.tags.find(([e])=>e===`p`)?.[1],o=e.pubkey,s=(0,Z.useMemo)(()=>Hr(e.content,t?20:36),[e.content,t]),c=Wt(18,1.03,800),l=(0,Z.useCallback)(()=>{if(t){i(e=>e===`back`?`front`:`back`);return}i(e=>e===`back`?`front`:e===`front`?`open`:`back`)},[t]);if(!a)return(0,Q.jsx)(`div`,{className:z(`mt-2 px-4 py-3`,n),children:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground italic`,children:`Encrypted letter (no recipient found)`})});let u=r===`front`||r===`open`,d=r===`open`;return(0,Q.jsx)(`div`,{className:z(`mt-3`,n),children:(0,Q.jsx)(`div`,{className:z(`mx-auto`,t?`max-w-sm px-2`:`max-w-md px-4`),children:(0,Q.jsx)(`div`,{ref:c.ref,style:{...c.style,touchAction:`pan-y`},onPointerDown:c.onPointerDown,onPointerMove:c.onPointerMove,onPointerUp:c.onPointerUp,onPointerLeave:c.onPointerLeave,children:(0,Q.jsx)(`div`,{className:`cursor-pointer select-none`,style:{perspective:`1200px`},onClick:l,role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l())},"aria-label":r===`back`?`Envelope back — click to flip to the front`:r===`front`?`Sealed envelope — click to open the flap`:`Encrypted letter — click to close`,children:(0,Q.jsxs)(`div`,{className:`relative w-full transition-transform duration-700 ease-in-out`,style:{transformStyle:`preserve-3d`,transform:u?`rotateY(180deg)`:`rotateY(0deg)`,aspectRatio:t?`16 / 9`:`4 / 3`},children:[(0,Q.jsxs)(`div`,{className:`absolute inset-0 rounded-2xl overflow-hidden shadow-lg`,style:{backfaceVisibility:`hidden`},children:[(0,Q.jsx)(`div`,{className:`absolute inset-0`,style:{background:`linear-gradient(145deg, #F5E6D3 0%, #E8D5BF 40%, #D4C4AA 100%)`}}),(0,Q.jsx)(`div`,{className:`absolute inset-0 opacity-[0.03]`,style:{backgroundImage:`url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)'/%3E%3C/svg%3E")`}}),(0,Q.jsx)(`div`,{className:`absolute top-3 left-4`,style:{color:`#5C4A3A`},children:(0,Q.jsx)(Ur,{pubkey:o,size:`sm`})}),(0,Q.jsx)(`div`,{className:`absolute left-1/2 -translate-x-1/2`,style:{top:`50%`,transform:`translate(-50%, -50%)`,color:`#5C4A3A`},children:(0,Q.jsx)(Ur,{pubkey:a,size:`lg`})}),(0,Q.jsx)(`div`,{className:`absolute inset-0 rounded-2xl pointer-events-none`,style:{boxShadow:`inset 0 2px 4px rgba(255,255,255,0.3), inset 0 -2px 8px rgba(0,0,0,0.08)`}})]}),(0,Q.jsxs)(`div`,{className:`absolute inset-0 rounded-2xl overflow-hidden shadow-lg`,style:{backfaceVisibility:`hidden`,transform:`rotateY(180deg)`},children:[(0,Q.jsx)(`div`,{className:`absolute inset-0`,style:{background:`linear-gradient(145deg, #EDD9C3 0%, #E0CCAF 50%, #D0BC9C 100%)`}}),(0,Q.jsx)(`div`,{className:`absolute inset-0 opacity-[0.03]`,style:{backgroundImage:`url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)'/%3E%3C/svg%3E")`}}),(0,Q.jsxs)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none`,viewBox:`0 0 400 300`,preserveAspectRatio:`none`,style:{zIndex:1},children:[(0,Q.jsx)(`path`,{d:`M0,300 L200,160`,stroke:`#C4A882`,strokeWidth:`1`,fill:`none`,opacity:`0.25`}),(0,Q.jsx)(`path`,{d:`M400,300 L200,160`,stroke:`#C4A882`,strokeWidth:`1`,fill:`none`,opacity:`0.25`})]}),(0,Q.jsx)(`div`,{className:`absolute top-0 left-0 right-0 transition-transform duration-500 ease-in-out`,style:{zIndex:2,transformOrigin:`top center`,transform:d?`rotateX(180deg)`:`rotateX(0deg)`},children:(0,Q.jsxs)(`svg`,{viewBox:`0 0 400 200`,className:`w-full`,preserveAspectRatio:`none`,children:[(0,Q.jsx)(`defs`,{children:(0,Q.jsxs)(`linearGradient`,{id:`flap-front`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,Q.jsx)(`stop`,{offset:`0%`,stopColor:`#EDD9C3`}),(0,Q.jsx)(`stop`,{offset:`100%`,stopColor:`#E0CCAF`})]})}),(0,Q.jsx)(`path`,{d:`M0,0 L200,180 L400,0 L400,0 L0,0 Z`,fill:`url(#flap-front)`}),(0,Q.jsx)(`path`,{d:`M0,0 L200,180 L400,0`,fill:`none`,stroke:`#B5A48A`,strokeWidth:`1`,opacity:`0.4`})]})}),(0,Q.jsx)(`div`,{className:`absolute left-1/2 transition-opacity duration-300`,style:{zIndex:3,top:`50%`,transform:`translate(-50%, -50%)`,opacity:+!d},children:(0,Q.jsx)(`div`,{className:`rounded-full flex items-center justify-center`,style:{width:t?48:64,height:t?48:64,background:`radial-gradient(ellipse at 35% 30%, #d4524d 0%, #a52422 50%, #7a1a19 100%)`,boxShadow:`0 4px 12px rgba(122, 26, 25, 0.4), inset 0 2px 4px rgba(255,255,255,0.15), inset 0 -2px 4px rgba(0,0,0,0.2)`},children:(0,Q.jsx)(Wr,{pubkey:o})})}),(0,Q.jsx)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center transition-all duration-500`,style:{zIndex:d?4:0,opacity:+!!d,transform:d?`translateY(-8px)`:`translateY(20px)`},children:(0,Q.jsxs)(`div`,{className:`rounded-lg mx-4 p-5 max-h-[85%] flex flex-col`,style:{background:`linear-gradient(180deg, #FDFAF5 0%, #F8F0E5 100%)`,boxShadow:`0 2px 12px rgba(0,0,0,0.1)`,width:`calc(100% - 2rem)`},children:[(0,Q.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-y-auto relative`,children:[(0,Q.jsx)(`p`,{className:`text-center select-none`,style:{fontFamily:`'Noto Sans Nushu', serif`,fontSize:t?`1rem`:`1.25rem`,color:`#3A2E26`,lineHeight:2.2,letterSpacing:`0.25em`},"aria-label":`Encrypted content rendered as Nushu script`,children:s}),(0,Q.jsx)(`div`,{className:`sticky bottom-0 left-0 right-0 h-8 pointer-events-none`,style:{background:`linear-gradient(transparent, #F8F0E5)`}})]}),(0,Q.jsx)(`div`,{className:`mx-auto mt-2 shrink-0`,style:{width:`40%`,height:1,background:`linear-gradient(90deg, transparent, #C4A882, transparent)`}}),(0,Q.jsxs)(`p`,{className:`flex items-center justify-center gap-1.5 mt-2 text-xs shrink-0`,style:{color:`#8B7355`},children:[(0,Q.jsx)(fe,{className:`size-3`}),`This message is encrypted`]})]})}),(0,Q.jsx)(`div`,{className:`absolute inset-0 rounded-2xl pointer-events-none`,style:{boxShadow:`inset 0 2px 4px rgba(255,255,255,0.2), inset 0 -2px 8px rgba(0,0,0,0.06)`}})]})]})})})})})}function Kr({event:e,className:t}){let n=K(),r=R(e.pubkey),i=r.data?.metadata,a=U(i),o=i?.name||i?.display_name||`Anonymous`,s=e.tags.find(([e])=>e===`p`)?.[1],c=R(s??``),l=s?On(c.data?.metadata,s):void 0,u=J(e.pubkey,i),d=(0,Z.useMemo)(()=>F.neventEncode({id:e.id,author:e.pubkey}),[e.id,e.pubkey]);return(0,Q.jsx)(`div`,{className:z(`group block rounded-2xl border border-border overflow-hidden`,`hover:bg-secondary/40 transition-colors cursor-pointer`,t),role:`link`,tabIndex:0,onClick:e=>{e.stopPropagation(),n(`/${d}`)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),n(`/${d}`))},children:(0,Q.jsxs)(`div`,{className:`px-3 py-2 space-y-1`,children:[(0,Q.jsx)(`div`,{className:`flex items-center gap-2 min-w-0`,children:r.isLoading?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{className:`size-5 rounded-full shrink-0`}),(0,Q.jsx)(X,{className:`h-3.5 w-24`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Y,{pubkey:e.pubkey,asChild:!0,children:(0,Q.jsx)(q,{to:u,className:`shrink-0`,onClick:e=>e.stopPropagation(),children:(0,Q.jsxs)(G,{shape:a,className:`size-5`,children:[(0,Q.jsx)(W,{src:i?.picture,alt:o}),(0,Q.jsx)(H,{className:`bg-primary/20 text-primary text-[10px]`,children:o[0]?.toUpperCase()})]})})}),(0,Q.jsx)(Y,{pubkey:e.pubkey,asChild:!0,children:(0,Q.jsx)(q,{to:u,className:`text-sm font-semibold truncate hover:underline`,onClick:e=>e.stopPropagation(),children:o})})]})}),(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-sm text-muted-foreground`,children:[(0,Q.jsx)(P,{className:`size-3.5 shrink-0`}),(0,Q.jsxs)(`span`,{children:[`Sent a letter`,l?(0,Q.jsxs)(Q.Fragment,{children:[` to `,(0,Q.jsx)(`span`,{className:`font-medium text-foreground`,children:l})]}):``]})]})]})})}var qr=15683,Jr=`Love list: the people this user truly loves`;function Yr(e){if(!e)return[];let t=new Set,n=[];for(let[r,i]of e.tags)r===`p`&&i&&V(i)&&!t.has(i)&&(t.add(i),n.push(i));return n}function Xr(e){return cn(e,`loveListCache`)}function Zr(e,t){try{let n=localStorage.getItem(e);if(!n)return;let r=JSON.parse(n);return r.pubkey!==t||!Array.isArray(r.pubkeys)?void 0:r.pubkeys.filter(e=>typeof e==`string`&&V(e))}catch{return}}function Qr(e,t,n){try{localStorage.setItem(Xr(e),JSON.stringify({pubkey:t,pubkeys:n}))}catch{}}function $r(){let{nostr:e}=Fe(),{user:t}=Pt(),{config:n}=ft(),r=nt(),{mutateAsync:i}=Ft(),{store:a}=Mt(),o=Xr(n.appId),s=t?.pubkey,c=(0,Z.useMemo)(()=>s?Zr(o,s):void 0,[o,s]),l=(0,Z.useMemo)(()=>c?{event:null,pubkeys:c}:void 0,[c]),u=I({queryKey:[`love-list`,t?.pubkey??``],queryFn:async()=>{if(!t)return{event:null,pubkeys:[]};try{let r=await kt(e,{kinds:[qr],authors:[t.pubkey]},{store:a}),i=Yr(r);return Qr(n.appId,t.pubkey,i),{event:r??null,pubkeys:i}}catch{return{event:null,pubkeys:c??[]}}},enabled:!!t,staleTime:300*1e3,placeholderData:l}),d=u.data?.pubkeys;function f(e){return d?.includes(e)??!1}async function p(r,o){if(!t)throw Error(`User is not logged in`);let s=await kt(e,{kinds:[qr],authors:[t.pubkey]},{store:a}),c=s?.tags??[],l=c.filter(([e])=>e===`p`),u=c.filter(([e])=>e!==`p`&&e!==`alt`),d;d=o===`add`?l.some(([,e])=>e===r)?l:[...l,[`p`,r]]:l.filter(([,e])=>e!==r);let f=await i({kind:qr,content:s?.content??``,tags:[...u,[`alt`,Jr],...d],created_at:Math.floor(Date.now()/1e3),prev:s??void 0});return a.event(f),Qr(n.appId,t.pubkey,Yr(f)),f}let m=[`love-list`,t?.pubkey??``],h=e=>{r.setQueryData(m,{event:e,pubkeys:Yr(e)}),r.invalidateQueries({queryKey:[`feed`]})};function g(e,t){let n=r.getQueryData(m),i=n?.pubkeys??[],a=t===`add`?i.includes(e)?i:[...i,e]:i.filter(t=>t!==e);return r.setQueryData(m,{event:n?.event??null,pubkeys:a}),n}let _=dt({mutationFn:e=>p(e,`add`),onMutate:e=>({snapshot:g(e,`add`)}),onError:(e,t,n)=>{jn(r,m,n?.snapshot)},onSuccess:h}),v=dt({mutationFn:e=>p(e,`remove`),onMutate:e=>({snapshot:g(e,`remove`)}),onError:(e,t,n)=>{jn(r,m,n?.snapshot)},onSuccess:h});return{loveList:u.data?.event??null,lovedPubkeys:d,isLoading:u.isLoading,isLoved:f,addLove:_,removeLove:v}}var ei=Lt[0].family,ti=8,ni=4,ri=`url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)'/%3E%3C/svg%3E")`,ii=`#f283b4`,ai=`#d9518f`,oi=`#a52e68`,si=`#b03a72`,ci=` radial-gradient(ellipse at 35% 30%, rgba(255,255,255,0.22) 0%, transparent 50%), radial-gradient(ellipse at 65% 70%, rgba(0,0,0,0.14) 0%, transparent 50%), radial-gradient(circle at 50% 50%, ${ii} 0%, ${ai} 55%, ${oi} 100%) `,li=`M42 3 C50 2, 58 7, 64 13 C69 18, 76 24, 78 33 C80 41, 82 48, 77 56 C73 62, 66 70, 56 73 C48 76, 40 78, 32 74 C24 71, 14 66, 9 58 C5 50, 2 42, 4 34 C6 26, 12 18, 19 12 C26 6, 34 4, 42 3 Z`,ui=It.find(e=>e.id===`hearts`),di=28,fi=`#F0699F`,pi=[{style:{top:`-0.75rem`,right:`-0.75rem`},size:`size-20`,rotate:`rotate-12`,opacity:.12},{style:{top:`18%`,left:`-1rem`},size:`size-14`,rotate:`-rotate-[18deg]`,opacity:.09},{style:{top:`36%`,right:`8%`},size:`size-9`,rotate:`rotate-[24deg]`,opacity:.1},{style:{top:`6%`,left:`34%`},size:`size-7`,rotate:`-rotate-6`,opacity:.09},{style:{top:`12%`,right:`28%`},size:`size-6`,rotate:`rotate-[16deg]`,opacity:.08},{style:{top:`52%`,left:`6%`},size:`size-8`,rotate:`rotate-[8deg]`,opacity:.09},{style:{top:`48%`,left:`58%`},size:`size-6`,rotate:`-rotate-[22deg]`,opacity:.08},{style:{bottom:`26%`,right:`-0.75rem`},size:`size-16`,rotate:`-rotate-[14deg]`,opacity:.1},{style:{bottom:`8%`,left:`14%`},size:`size-10`,rotate:`-rotate-12`,opacity:.11},{style:{bottom:`-1rem`,right:`32%`},size:`size-16`,rotate:`rotate-[20deg]`,opacity:.08},{style:{top:`72%`,left:`44%`},size:`size-7`,rotate:`rotate-[30deg]`,opacity:.08},{style:{bottom:`14%`,right:`12%`},size:`size-7`,rotate:`rotate-6`,opacity:.09}],mi=[{left:`18%`,size:`size-5`,opacity:.5,sway:16,duration:7,delay:0},{left:`46%`,size:`size-4`,opacity:.4,sway:-14,duration:8.5,delay:2.4},{left:`68%`,size:`size-6`,opacity:.45,sway:20,duration:6.5,delay:4.2},{left:`84%`,size:`size-4`,opacity:.35,sway:-12,duration:9,delay:1.2}];function hi({pubkey:e,compact:t}){let n=R(e),r=n.data?.metadata,i=On(r,e),o=U(r),s=J(e,r);return(0,Q.jsxs)(`li`,{className:z(`relative flex items-center gap-3 min-w-0`,t?`py-2`:`py-2.5`),children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`absolute bottom-0 left-0 right-0 h-[3px] rounded-full pointer-events-none`,style:{background:`rgba(196, 134, 134, 0.3)`}}),(0,Q.jsx)(a,{"aria-hidden":!0,className:z(`shrink-0`,t?`size-4`:`size-[18px]`),style:{color:`#C0392B`,fill:`#E74C3C`}}),n.isLoading?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{className:z(`rounded-full shrink-0`,t?`size-7`:`size-8`)}),(0,Q.jsx)(X,{className:`h-5 w-28`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Y,{pubkey:e,asChild:!0,children:(0,Q.jsx)(q,{to:s,className:`shrink-0`,onClick:e=>e.stopPropagation(),children:(0,Q.jsxs)(G,{shape:o,className:z(t?`size-7`:`size-8`,`ring-1 ring-[#C48686]/40`),children:[(0,Q.jsx)(W,{src:r?.picture,alt:i}),(0,Q.jsx)(H,{className:`bg-[#E74C3C]/15 text-[#A93226] text-xs font-bold`,children:i[0]?.toUpperCase()})]})})}),(0,Q.jsx)(Y,{pubkey:e,asChild:!0,children:(0,Q.jsx)(q,{to:s,onClick:e=>e.stopPropagation(),className:`truncate hover:underline decoration-[#C0392B]/50`,style:{fontFamily:ei,fontSize:t?`1.5rem`:`1.7rem`,lineHeight:1.2,color:`#6B3A3A`},children:i})})]})]})}function gi({event:e,compact:t,className:n}){let r=(0,Z.useMemo)(()=>Yr(e),[e]),i=(0,Z.useId)();An(ei);let o=t?ni:ti,s=r.slice(0,o),c=r.length-s.length;return r.length===0?(0,Q.jsx)(`div`,{className:z(`mt-2 px-4 py-3`,n),children:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground italic`,children:`An empty love list — hearts yet to be written.`})}):(0,Q.jsx)(`div`,{className:z(`mt-3`,n),children:(0,Q.jsx)(`div`,{className:`w-full rounded-[2rem] shadow-md motion-safe:transition-shadow motion-safe:duration-300 hover:shadow-lg`,style:{padding:di},children:(0,Q.jsxs)(`div`,{className:`relative isolate`,children:[ui?.emojis&&(0,Q.jsx)(kn,{tint:fi,thickness:di,emojis:ui.emojis,defaultBg:fi,scatter:!0,keepDefaultBg:!0}),(0,Q.jsxs)(`div`,{className:`relative rounded-2xl overflow-hidden`,style:{background:`linear-gradient(165deg, #FFF8F0 0%, #FDEFE6 55%, #F9E3DC 100%)`},children:[(0,Q.jsx)(`div`,{className:`absolute inset-0 opacity-[0.04] pointer-events-none`,style:{backgroundImage:ri}}),(0,Q.jsx)(`div`,{className:`absolute inset-3 rounded-xl pointer-events-none`,style:{border:`2.5px dashed rgba(192, 57, 43, 0.4)`}}),pi.map((e,t)=>(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`absolute pointer-events-none motion-safe:animate-heart-drift`,style:{...e.style,animationDelay:`${t%4*.5}s`,animationDuration:`${4+t%3}s`},children:(0,Q.jsx)(a,{className:z(`block`,e.size,e.rotate),style:{color:`#E74C3C`,fill:`#E74C3C`,opacity:e.opacity}})},t)),mi.map((e,t)=>(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`absolute pointer-events-none motion-safe:animate-heart-float`,style:{left:e.left,animationDelay:`${e.delay}s`,"--float-sway":`${e.sway}px`,"--float-opacity":e.opacity,"--float-duration":`${e.duration}s`},children:(0,Q.jsx)(a,{className:z(`block`,e.size),style:{color:`#E74C3C`,fill:`#E74C3C`}})},`float-${t}`)),(0,Q.jsx)(`div`,{className:`absolute inset-0 rounded-2xl pointer-events-none`,style:{boxShadow:`inset 0 2px 4px rgba(255,255,255,0.6), inset 0 -2px 8px rgba(122, 26, 25, 0.06)`}}),(0,Q.jsxs)(`div`,{className:z(`relative`,t?`p-7`:`px-8 sm:px-10 py-8`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-4 mb-5`,children:[(0,Q.jsxs)(`span`,{className:z(`relative shrink-0 m-1`,t?`size-14`:`size-16`),children:[(0,Q.jsxs)(`svg`,{"aria-hidden":!0,viewBox:`0 0 84 84`,className:`absolute pointer-events-none`,style:{left:`-17%`,top:`-17%`,width:`134%`,height:`134%`},children:[(0,Q.jsx)(`defs`,{children:(0,Q.jsxs)(`radialGradient`,{id:i,children:[(0,Q.jsx)(`stop`,{offset:`0%`,stopColor:ii}),(0,Q.jsx)(`stop`,{offset:`50%`,stopColor:ai}),(0,Q.jsx)(`stop`,{offset:`85%`,stopColor:oi}),(0,Q.jsx)(`stop`,{offset:`100%`,stopColor:oi,stopOpacity:`0.6`})]})}),(0,Q.jsx)(`path`,{d:li,fill:`url(#${i})`}),(0,Q.jsx)(`path`,{d:li,fill:`none`,stroke:`rgba(255,255,255,0.08)`,strokeWidth:`1`})]}),(0,Q.jsx)(`span`,{className:`absolute rounded-full flex items-center justify-center`,style:{inset:2,background:ci,border:`2px solid ${si}`,boxShadow:`0 1px 3px rgba(0,0,0,0.14), inset 0 1.5px 2px rgba(255,255,255,0.18), inset 0 -1.5px 2px rgba(0,0,0,0.18)`},children:(0,Q.jsx)(a,{className:t?`size-7`:`size-8`,style:{color:`#FBE9E7`,fill:`#FBE9E7`},"aria-hidden":!0})})]}),(0,Q.jsx)(`span`,{style:{fontFamily:ei,fontSize:t?`2rem`:`2.4rem`,color:`#7a1a19`,lineHeight:1,transform:`translateY(-0.06em)`},children:`Love List`})]}),(0,Q.jsx)(`ul`,{className:`space-y-0`,children:s.map(e=>(0,Q.jsx)(hi,{pubkey:e,compact:t},e))}),c>0&&(0,Q.jsxs)(`p`,{className:`mt-3`,style:{fontFamily:ei,fontSize:t?`1.35rem`:`1.5rem`,color:`#A05252`},children:[`…and `,c,` more dearly loved`]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-center gap-2.5 mt-5`,"aria-hidden":!0,children:[(0,Q.jsx)(`span`,{className:`h-px flex-1 max-w-28`,style:{background:`linear-gradient(90deg, transparent, #C48686)`}}),(0,Q.jsx)(a,{className:`size-4`,style:{color:`#C0392B`,fill:`#E74C3C`,opacity:.7}}),(0,Q.jsx)(`span`,{className:`h-px flex-1 max-w-28`,style:{background:`linear-gradient(270deg, transparent, #C48686)`}})]})]})]})]})})})}function _i({event:e,className:t}){let n=K(),r=R(e.pubkey),i=r.data?.metadata,o=U(i),s=On(i,e.pubkey),c=J(e.pubkey,i),l=(0,Z.useMemo)(()=>Yr(e).length,[e]),u=(0,Z.useMemo)(()=>F.neventEncode({id:e.id,author:e.pubkey}),[e.id,e.pubkey]);return(0,Q.jsx)(`div`,{className:z(`group block rounded-2xl border overflow-hidden cursor-pointer transition-colors`,t),style:{background:`linear-gradient(165deg, #FFF8F0 0%, #F9E3DC 100%)`,borderColor:`rgba(192, 57, 43, 0.25)`},role:`link`,tabIndex:0,onClick:e=>{e.stopPropagation(),n(`/${u}`)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),n(`/${u}`))},children:(0,Q.jsxs)(`div`,{className:`px-3 py-2 space-y-1`,children:[(0,Q.jsx)(`div`,{className:`flex items-center gap-2 min-w-0`,children:r.isLoading?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{className:`size-5 rounded-full shrink-0`}),(0,Q.jsx)(X,{className:`h-3.5 w-24`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Y,{pubkey:e.pubkey,asChild:!0,children:(0,Q.jsx)(q,{to:c,className:`shrink-0`,onClick:e=>e.stopPropagation(),children:(0,Q.jsxs)(G,{shape:o,className:`size-5`,children:[(0,Q.jsx)(W,{src:i?.picture,alt:s}),(0,Q.jsx)(H,{className:`bg-[#E74C3C]/15 text-[#A93226] text-[10px]`,children:s[0]?.toUpperCase()})]})})}),(0,Q.jsx)(Y,{pubkey:e.pubkey,asChild:!0,children:(0,Q.jsx)(q,{to:c,className:`text-sm font-semibold truncate hover:underline`,style:{color:`#6B3A3A`},onClick:e=>e.stopPropagation(),children:s})})]})}),(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-sm`,style:{color:`#A05252`},children:[(0,Q.jsx)(a,{className:`size-3.5 shrink-0`,style:{fill:`#E74C3C`,color:`#C0392B`},"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[`Updated their Love List`,l>0&&(0,Q.jsxs)(Q.Fragment,{children:[` · `,(0,Q.jsxs)(`span`,{className:`font-medium`,style:{color:`#7a1a19`},children:[l,` loved `,l===1?`one`:`ones`]})]})]})]})]})})}var vi=6;function yi({event:e,className:t,disableHoverCards:n}){let r=e.kind===3,a=R(r?e.pubkey:``),o=r?a.data?.metadata:void 0,{title:s,description:c,image:l,pubkeys:d,variant:f}=(0,Z.useMemo)(()=>Ln(e,{authorMetadata:o,authorDisplayName:o?.name||o?.display_name}),[e,o]),p=(0,Z.useMemo)(()=>Mn(e),[e]),m=(0,Z.useMemo)(()=>Rn(e,d).slice(0,vi),[e,d]),{data:h}=on(m),g=(0,Z.useMemo)(()=>L(l),[l]),_=f===`follow-list`?i:f===`follow-set`?j:u,v=d.length===1?`1 member`:`${d.length} members`;return(0,Q.jsxs)($,{pubkey:e.pubkey,createdAt:e.created_at,navigateTo:p,className:t,disableHoverCards:n,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,Q.jsx)(_,{className:`size-3.5 text-primary shrink-0`}),(0,Q.jsx)(`p`,{className:`text-sm font-semibold leading-snug line-clamp-1`,children:s})]}),c&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed line-clamp-2`,children:c}),g&&(0,Q.jsx)(`div`,{className:`rounded-lg overflow-hidden`,children:(0,Q.jsx)(`img`,{src:g,alt:s,className:`w-full max-h-[140px] object-cover`,loading:`lazy`,onError:e=>{e.currentTarget.parentElement.style.display=`none`},decoding:`async`})}),d.length>0&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`div`,{className:`flex -space-x-1.5`,children:m.map(e=>{let t=h?.get(e),n=t?.metadata?.name||t?.metadata?.display_name||`Anonymous`;return(0,Q.jsxs)(G,{shape:U(t?.metadata),className:`size-5 ring-1 ring-background`,children:[(0,Q.jsx)(W,{src:t?.metadata?.picture,alt:n}),(0,Q.jsx)(H,{className:`bg-primary/20 text-primary text-[9px]`,children:n[0]?.toUpperCase()})]},e)})}),(0,Q.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:v})]})]})}var bi={sm:`size-6`,md:`size-7`},xi={sm:`-space-x-1.5`,md:`-space-x-2`},Si={sm:`size-3`,md:`size-3.5`};function Ci({relays:e,maxVisible:t=5,size:n=`md`,className:r}){let{config:i}=ft(),a=(0,Z.useMemo)(()=>e.slice(0,t),[e,t]),o=(0,Z.useMemo)(()=>a.map(e=>{let t;try{t=Qt({template:i.faviconUrl,url:e.url})}catch{t=void 0}return{entry:e,label:Bn(e.url),iconUrl:t}}),[a,i.faviconUrl]);if(e.length===0)return null;let s=e.length-a.length;return(0,Q.jsxs)(`div`,{className:z(`flex items-center gap-2`,r),children:[(0,Q.jsx)(`div`,{className:z(`flex`,xi[n]),children:o.map(({entry:e,label:t,iconUrl:r})=>(0,Q.jsxs)(Sn,{children:[(0,Q.jsx)(bn,{asChild:!0,children:(0,Q.jsx)(q,{to:`/r/${encodeURIComponent(e.url)}`,"aria-label":t,onClick:e=>e.stopPropagation(),className:z(`relative rounded-full transition-transform duration-150 ease-out`,`hover:z-10 motion-safe:hover:scale-110 focus-visible:z-10 motion-safe:focus-visible:scale-110`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background`),children:(0,Q.jsxs)(G,{className:z(bi[n],`ring-2 ring-background`),children:[(0,Q.jsx)(W,{src:r,alt:``,className:`object-contain p-0.5`}),(0,Q.jsx)(H,{className:`bg-primary/10`,children:(0,Q.jsx)(ne,{className:z(`text-primary`,Si[n])})})]})})}),(0,Q.jsx)(xn,{side:`bottom`,className:`text-xs`,children:t})]},e.url))}),s>0&&(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`+`,s,` more`]})]})}var wi=5;function Ti({event:e,className:t,disableHoverCards:n}){let r=(0,Z.useMemo)(()=>zn(e),[e]),i=(0,Z.useMemo)(()=>Mn(e),[e]);return(0,Q.jsxs)($,{pubkey:e.pubkey,createdAt:e.created_at,navigateTo:i,className:t,disableHoverCards:n,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Q.jsx)(ne,{className:`size-3.5 shrink-0 text-primary`}),(0,Q.jsx)(`p`,{className:`line-clamp-1 text-sm font-semibold leading-snug`,children:(0,Q.jsx)(St,{id:`relayList.embedTitle`,defaultMessage:`Relay list · {count, plural, one {# relay} other {# relays}}`,values:{count:r.length}})})]}),(0,Q.jsx)(Ci,{relays:r,maxVisible:wi,size:`sm`})]})}function Ei({event:e,className:t,disableHoverCards:n}){let r=(0,Z.useMemo)(()=>{let t=Ie.json().pipe(Ie.metadata()).safeParse(e.content);return t.success?t.data:{}},[e.content]),i=(0,Z.useMemo)(()=>Mn(e),[e]),a=(0,Z.useMemo)(()=>L(r.banner),[r.banner]);return(0,Q.jsxs)($,{pubkey:e.pubkey,createdAt:e.created_at,navigateTo:i,className:t,disableHoverCards:n,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Q.jsx)(Ce,{className:`size-3.5 shrink-0 text-primary`}),(0,Q.jsx)(`p`,{className:`line-clamp-1 text-sm font-semibold leading-snug`,children:(0,Q.jsx)(St,{id:`profileUpdate.embedTitle`,defaultMessage:`Profile update`})})]}),a&&(0,Q.jsx)(`div`,{className:`overflow-hidden rounded-lg`,children:(0,Q.jsx)(`img`,{src:a,alt:``,className:`max-h-[100px] w-full object-cover`,loading:`lazy`,decoding:`async`,onError:e=>{e.currentTarget.parentElement.style.display=`none`}})}),r.about?.trim()&&(0,Q.jsx)(`p`,{className:`line-clamp-3 whitespace-pre-wrap break-words text-xs leading-relaxed text-muted-foreground`,children:r.about.trim()})]})}function Di({event:e,className:t,disableHoverCards:n}){let r=(0,Z.useMemo)(()=>{try{return qn(Un(e.content))}catch{return null}},[e.content]),i=Gn(e),a=Kn(e),o=Hn(e,`state`),s=Hn(e,`filename`),c=Hn(e,`region`),l=Wn(c,s),u=ln(e.pubkey),d=u?`memory-cards/${u}${i?`/${encodeURIComponent(i)}`:``}`:``,f=!!r,p=a===0||o===`header`,m=r?.title||Hn(e,`title`)||`(untitled save)`;return(0,Q.jsx)($,{pubkey:e.pubkey,createdAt:e.created_at,navigateTo:d,className:t,disableHoverCards:n,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 pt-1`,children:[f?(0,Q.jsx)(Vn,{frames:r.frames,size:48}):(0,Q.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-md border border-border bg-muted text-muted-foreground`,children:(0,Q.jsx)(oe,{className:`size-5`})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`truncate text-sm font-semibold leading-snug`,children:f?m:p?`System block`:`Continuation block`}),f&&s&&(0,Q.jsx)(`p`,{className:`truncate font-mono text-[11px] text-muted-foreground`,children:s}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1.5 text-[11px] text-muted-foreground`,children:[i&&(0,Q.jsx)(`span`,{className:`rounded border border-border bg-background px-1.5 py-0.5 font-mono`,children:i}),a>=0&&(0,Q.jsxs)(`span`,{className:`rounded border border-border bg-background px-1.5 py-0.5 font-mono`,children:[`block #`,a]}),c&&(0,Q.jsxs)(`span`,{className:`rounded border border-border bg-background px-1.5 py-0.5`,children:[l?`${l} `:``,c]})]})]})]})})}var Oi=31871,ki=[`verifying`,`valid`,`invalid`,`revoked`];function Ai(e){if(!e)return;let t=Number(e);return Number.isFinite(t)&&t>0?Math.floor(t):void 0}function ji(e){return new Date(e*1e3).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function Mi(e,t){if(e!==void 0&&t!==void 0)return`Valid ${ji(e)} – ${ji(t)}`;if(e!==void 0)return`Valid from ${ji(e)}`;if(t!==void 0)return`Valid until ${ji(t)}`}function Ni(e){if(e.kind!==31871)return;let t=e.tags.find(([e])=>e===`s`)?.[1]?.trim().toLowerCase(),n=ki.find(e=>e===t);if(!n)return;let r,i=e.tags.find(([e,t])=>e===`a`&&t);if(i){let e=tn(i[1]);e&&(r={type:`addr`,addr:e,relays:i[2]?[i[2]]:void 0})}if(!r){let t=e.tags.find(([e,t])=>e===`e`&&t);t&&V(t[1])&&(r={type:`event`,id:t[1],relays:t[2]?[t[2]]:void 0,authorHint:V(t[3])?t[3]:void 0})}return{state:n,target:r,validFrom:Ai(e.tags.find(([e])=>e===`valid_from`)?.[1]),validTo:Ai(e.tags.find(([e])=>e===`valid_to`)?.[1]),description:e.content.trim()||void 0}}var Pi={valid:{label:`Valid`,Icon:ve,pill:`border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-400`,icon:`text-emerald-600 dark:text-emerald-400`},invalid:{label:`Invalid`,Icon:se,pill:`border-destructive/30 bg-destructive/10 text-destructive`,icon:`text-destructive`},verifying:{label:`Verifying`,Icon:A,pill:`border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-400`,icon:`text-amber-600 dark:text-amber-400`},revoked:{label:`Revoked`,Icon:pe,pill:`border-border bg-secondary text-muted-foreground`,icon:`text-muted-foreground`}};function Fi({state:e,className:t}){let n=Pi[e];return(0,Q.jsxs)(`span`,{className:z(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-semibold`,n.pill,t),children:[(0,Q.jsx)(n.Icon,{className:`size-3.5`,"aria-hidden":`true`}),n.label]})}function Ii({event:e,expanded:t=!1,className:n,disableTargetEmbed:r=!1}){let i=(0,Z.useMemo)(()=>Ni(e),[e]);if(!i)return(0,Q.jsx)(`div`,{className:z(`mt-2 rounded-xl border border-dashed border-border px-4 py-3 text-sm text-muted-foreground`,n),children:`Malformed attestation`});let{state:a,target:o,validFrom:s,validTo:c,description:l}=i,u=Pi[a],d=Mi(s,c),f=c!==void 0&&c*1e3Ni(e),[e]),i=(0,Z.useMemo)(()=>{let t=e.tags.find(([e])=>e===`d`)?.[1]??``;return F.naddrEncode({kind:e.kind,pubkey:e.pubkey,identifier:t})},[e]),a=r?Mi(r.validFrom,r.validTo):void 0;return(0,Q.jsxs)($,{pubkey:e.pubkey,createdAt:e.created_at,navigateTo:i,className:t,disableHoverCards:n,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:[(0,Q.jsx)(ve,{className:`size-3`,"aria-hidden":`true`}),`Attestation`]}),r?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(Fi,{state:r.state}),a&&(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a})]}),r.description&&(0,Q.jsx)(`p`,{dir:`auto`,className:`text-sm leading-relaxed whitespace-pre-wrap break-words line-clamp-3 text-foreground`,children:r.description})]}):(0,Q.jsx)(`p`,{className:`text-xs italic text-muted-foreground`,children:`Malformed attestation`})]})}var Ri=30402;function zi(e,t){return e.tags.find(([e])=>e===t)?.[1]}function Bi(e){return e.replace(/&#(\d+);/g,(e,t)=>{let n=parseInt(t,10);return Number.isFinite(n)&&n>0&&n<=1114111?String.fromCodePoint(n):e}).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/ /g,` `)}function Vi(e){return Bi(e).replace(/[#*_>`~]/g,``).replace(/\s+/g,` `).trim().toLowerCase()}function Hi(e){return e.replace(/(\.\.\.|…)\s*$/,``).trim()}function Ui(e){let t=Vi(e.title),n=e.summary?Hi(Vi(e.summary)):void 0,r=[];for(let i of e.content.split(` `)){let e=i.trim();if(!e){r.push(i);continue}let a=Vi(e);if(a!==t){if(n){let e=Hi(a);if(e.length>0&&(e.startsWith(n)||n.startsWith(e)))continue}/^(?:[-*+]\s+)?(?:\*\*|__)?\s*(?:price|category|type|condition|status|location|shipping)\s*(?:\*\*|__)?\s*:/i.test(e)||/^[*_]{1,2}listed by .+[*_]{1,2}$/i.test(e)||r.push(i)}}let i=r.join(` `).trim();return Vi(i)?i:``}function Wi(e){let t=e.tags.find(([e])=>e===`price`);if(!t)return;let n=Number(t[1]),r=t[2]?.trim();if(!Number.isFinite(n)||n<0||!r)return;let i=t[3]?.trim();return{amount:n,currency:r.toUpperCase(),frequency:i||void 0}}function Gi(e){let t;try{t=new Intl.NumberFormat(void 0,{style:`currency`,currency:e.currency,minimumFractionDigits:Number.isInteger(e.amount)?0:2}).format(e.amount)}catch{t=`${e.amount.toLocaleString()} ${e.currency}`}return e.frequency?`${t}/${e.frequency}`:t}function Ki(e){if(e.kind!==30402)return null;let t=zi(e,`title`)?.trim();if(!t)return null;let n=[];for(let[t,r]of e.tags){if(t!==`image`)continue;let e=L(r);e&&n.push(e)}let r=zi(e,`status`)?.trim().toLowerCase()===`sold`?`sold`:`active`,i=zi(e,`published_at`),a=i&&/^\d+$/.test(i)?parseInt(i,10):e.created_at,o=e.tags.filter(([e])=>e===`t`).map(([,e])=>e).filter(Boolean);return{event:e,pubkey:e.pubkey,identifier:zi(e,`d`)??``,title:Bi(t),summary:(()=>{let t=zi(e,`summary`)?.trim();return t?Bi(t):void 0})(),content:e.content,images:n,price:Wi(e),status:r,location:(()=>{let t=zi(e,`location`)?.trim();return t?Bi(t):void 0})(),sourceUrl:L(zi(e,`r`)),hashtags:o,publishedAt:a,createdAt:e.created_at}}function qi({event:e,className:t,disableHoverCards:n}){let r=(0,Z.useMemo)(()=>Ki(e),[e]),i=(0,Z.useMemo)(()=>{let t=e.tags.find(([e])=>e===`d`)?.[1]??``;return F.naddrEncode({kind:e.kind,pubkey:e.pubkey,identifier:t})},[e]);if(!r)return null;let{title:a,images:o,price:s,status:c}=r,l=o[0],u=c===`sold`,d=s?Gi(s):void 0;return(0,Q.jsx)($,{pubkey:e.pubkey,createdAt:e.created_at,navigateTo:i,className:t,disableHoverCards:n,children:(0,Q.jsxs)(`div`,{className:`relative isolate flex items-center gap-3 overflow-hidden rounded-xl py-1.5`,children:[(0,Q.jsx)(`div`,{className:`absolute -z-10 top-0 left-0 size-24 rounded-full bg-primary/[0.06] blur-2xl`,"aria-hidden":`true`}),l&&(0,Q.jsx)(`div`,{className:`relative size-20 shrink-0 overflow-hidden rounded-lg bg-muted sm:size-24`,children:(0,Q.jsx)(`img`,{src:l,alt:``,loading:`lazy`,decoding:`async`,className:z(`absolute inset-0 size-full object-cover`,u&&`opacity-60 grayscale`)})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-primary/15`,children:(0,Q.jsx)(y,{className:`size-3 text-primary`})}),u?`Sold`:`For Sale`]}),d&&(0,Q.jsx)(`div`,{className:z(`whitespace-nowrap text-xl font-bold leading-tight tracking-tight`,u&&`text-muted-foreground line-through decoration-2`),children:d}),(0,Q.jsx)(`p`,{dir:`auto`,className:`line-clamp-2 break-words text-sm font-medium leading-snug`,children:a})]})]})})}function Ji({text:e,label:t}){let[n,r]=(0,Z.useState)(!1);return(0,Q.jsx)(B,{variant:`ghost`,size:`icon`,onClick:()=>{navigator.clipboard.writeText(e),r(!0),jt({title:`${t} copied to clipboard`}),setTimeout(()=>r(!1),2e3)},className:`size-6 shrink-0 text-muted-foreground hover:text-foreground`,children:n?(0,Q.jsx)(he,{className:`size-3.5 text-green-500`}):(0,Q.jsx)(M,{className:`size-3.5`})})}function Yi({event:e,nip19Id:t,open:n,onOpenChange:r}){let{nostr:i}=Fe(),[a,o]=(0,Z.useState)(!1),s=t??Mn(e),c=JSON.stringify(e,null,2);return(0,Q.jsx)(En,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Tn,{className:`max-w-2xl max-h-[85dvh] flex flex-col gap-0 p-0 rounded-2xl overflow-hidden`,children:[(0,Q.jsx)(Cn,{className:`px-5 pt-5 pb-3 shrink-0`,children:(0,Q.jsx)(wn,{className:`text-base font-semibold`,children:`Event Details`})}),(0,Q.jsxs)(`div`,{className:`px-5 pb-3 shrink-0`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground mb-1`,children:`Event ID`}),(0,Q.jsxs)(`div`,{className:`relative flex items-center bg-muted rounded-lg px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`font-mono text-xs break-all text-foreground/80 flex-1 pr-2 select-all`,children:s}),(0,Q.jsx)(Ji,{text:s,label:`Event ID`})]})]}),(0,Q.jsxs)(`div`,{className:`px-5 pb-5 flex flex-col flex-1 min-h-0`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground mb-1`,children:`Raw JSON`}),(0,Q.jsxs)(`div`,{className:`relative flex-1 min-h-0 overflow-auto rounded-lg bg-muted border border-border`,children:[(0,Q.jsx)(`div`,{className:`sticky top-2 right-2 float-right mr-2`,children:(0,Q.jsx)(Ji,{text:c,label:`Event JSON`})}),(0,Q.jsx)(`pre`,{className:`p-4 text-xs font-mono text-foreground/80 whitespace-pre leading-relaxed`,children:c})]})]}),(0,Q.jsx)(`div`,{className:`px-5 pb-5 shrink-0`,children:(0,Q.jsxs)(B,{variant:`outline`,className:`w-full gap-2`,onClick:async()=>{o(!0);try{await i.event(e,{signal:AbortSignal.timeout(5e3)}),jt({title:`Event broadcast to relays`})}catch{jt({title:`Failed to broadcast event`,variant:`destructive`})}finally{o(!1)}},disabled:a,children:[(0,Q.jsx)(we,{className:`size-4`}),a?`Broadcasting...`:`Broadcast Event`]})})]})})}var Xi=[`#f0abfc`,`#c084fc`,`#818cf8`,`#38bdf8`,`#34d399`,`#fde047`,`#fb7185`];function Zi(e){let t=e||1,n=()=>(t=t*1103515245+12345&2147483647,t/2147483647);return{beams:Array.from({length:18},()=>({left:`${n()*120-20}%`,top:`${n()*120-20}%`,delay:`${(n()*1.1).toFixed(3)}s`,duration:`${(.45+n()*.35).toFixed(3)}s`,color:Xi[Math.floor(n()*Xi.length)],length:Math.round(60+n()*90)})),stars:Array.from({length:22},()=>({left:`${n()*100}%`,top:`${n()*100}%`,delay:`${(n()*1.3).toFixed(3)}s`,size:Math.round(10+n()*14),color:Xi[Math.floor(n()*Xi.length)]}))}}function Qi({event:e,expanded:t=!1,className:n}){let[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(!1),s=sr(e),c=At(e.kind),l=c!==`Kind ${e.kind}`,u=Mn(e),d=JSON.stringify(e,null,2),f=(0,Z.useMemo)(()=>{let t=0;for(let n=0;n{e.stopPropagation(),o(!1),requestAnimationFrame(()=>o(!0))},onAnimationEnd:e=>{e.animationName===`mystery-shake`&&o(!1)},children:[(0,Q.jsx)(`svg`,{"aria-hidden":`true`,className:`absolute size-0`,children:(0,Q.jsxs)(`filter`,{id:`mystery-warp`,children:[(0,Q.jsx)(`feTurbulence`,{type:`fractalNoise`,baseFrequency:`0.012 0.028`,numOctaves:`2`,seed:`7`,result:`noise`}),(0,Q.jsx)(`feDisplacementMap`,{in:`SourceGraphic`,in2:`noise`,scale:`28`,xChannelSelector:`R`,yChannelSelector:`G`})]})}),(0,Q.jsx)(`div`,{className:`mystery-waves absolute -inset-4 -z-10 pointer-events-none`,"aria-hidden":`true`}),a&&(0,Q.jsxs)(`div`,{className:`mystery-storm absolute inset-0 z-20 overflow-hidden pointer-events-none`,"aria-hidden":`true`,children:[(0,Q.jsx)(`div`,{className:`mystery-bloom absolute inset-0`}),f.beams.map((e,t)=>(0,Q.jsx)(`span`,{className:`mystery-beam absolute rounded-full`,style:{left:e.left,top:e.top,width:`${e.length}px`,background:`linear-gradient(90deg, transparent, ${e.color}, #fff)`,boxShadow:`0 0 10px 2px ${e.color}`,animationDelay:e.delay,animationDuration:e.duration}},`b${t}`)),f.stars.map((e,t)=>(0,Q.jsx)(C,{className:`mystery-star absolute fill-current`,style:{left:e.left,top:e.top,width:`${e.size}px`,height:`${e.size}px`,color:e.color,filter:`drop-shadow(0 0 6px ${e.color})`,animationDelay:e.delay}},`s${t}`))]}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`bg-gradient-to-br from-fuchsia-500 via-sky-500 to-emerald-500 bg-clip-text text-5xl font-black leading-none text-transparent drop-shadow-sm`,children:`?`}),(0,Q.jsxs)(`div`,{className:`relative z-[1] mt-3 max-w-xs text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-semibold leading-snug`,children:c}),(0,Q.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[`You’ve stumbled onto `,l?`a kind ${e.kind} event`:`an event kind`,` `,`Ditto can’t render yet.`]})]}),s&&(0,Q.jsx)(`p`,{className:z(`relative z-[1] mt-3 max-w-md whitespace-pre-wrap break-words text-center text-foreground`,t?`text-[15px] leading-relaxed`:`text-sm leading-relaxed`),children:s}),(0,Q.jsxs)(an,{open:r,onOpenChange:i,className:`relative z-[1] mt-2 w-full`,children:[(0,Q.jsx)(`div`,{className:`flex justify-center`,children:(0,Q.jsx)(rn,{asChild:!0,children:(0,Q.jsxs)(B,{variant:`ghost`,size:`sm`,className:`h-7 gap-1.5 px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:e=>e.stopPropagation(),children:[r?`Hide details`:`View event`,(0,Q.jsx)(p,{className:z(`size-3.5 transition-transform`,r&&`rotate-180`)})]})})}),(0,Q.jsxs)(nn,{className:`space-y-2 pt-2 text-left`,onClick:e=>e.stopPropagation(),children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:`Event ID`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 rounded-lg bg-muted px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 select-all break-all font-mono text-xs text-foreground/80`,children:u}),(0,Q.jsx)(Ji,{text:u,label:`Event ID`})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:`Raw JSON`}),(0,Q.jsxs)(`div`,{className:`relative max-h-64 overflow-auto rounded-lg border border-border bg-muted`,children:[(0,Q.jsx)(`div`,{className:`sticky right-2 top-2 float-right`,children:(0,Q.jsx)(Ji,{text:d,label:`Event JSON`})}),(0,Q.jsx)(`pre`,{className:`whitespace-pre p-3 font-mono text-xs leading-relaxed text-foreground/80`,children:d})]})]})]})]})]})})}var $i=new TextDecoder(`utf-8`);new TextEncoder;var ea=1,ta=65535;function na(e,t){let n=He(Ye,e,t,76);return{chacha_key:n.subarray(0,32),chacha_nonce:n.subarray(32,44),hmac_key:n.subarray(44,76)}}function ra(e){if(!Number.isSafeInteger(e)||e<1)throw Error(`expected positive integer`);if(e<=32)return 32;let t=1<ta||n.length!==t||e.length!==2+ra(t))throw Error(`invalid padding`);return $i.decode(n)}function aa(e,t,n){if(n.length!==32)throw Error(`AAD associated data must be 32 bytes`);return ze(Ye,e,Ke(n,t))}function oa(e){if(typeof e!=`string`)throw Error(`payload must be a valid string`);let t=e.length;if(t<132||t>87472)throw Error(`invalid payload length: `+t);if(e[0]===`#`)throw Error(`unknown encryption version`);let n;try{n=Re.decode(e)}catch(e){throw Error(`invalid base64: `+e.message)}let r=n.length;if(r<99||r>65603)throw Error(`invalid data length: `+r);let i=n[0];if(i!==2)throw Error(`unknown encryption version `+i);return{nonce:n.subarray(1,33),ciphertext:n.subarray(33,-32),mac:n.subarray(-32)}}function sa(e,t){let{nonce:n,ciphertext:r,mac:i}=oa(e),{chacha_key:a,chacha_nonce:o,hmac_key:s}=na(t,n);if(!Ge(aa(s,r,n),i))throw Error(`invalid MAC`);return ia(Le(a,o,r))}var ca=33301,la=`https://armada.buzz/invite/`,ua=`/invite/`;function da(e){try{let t=F.decode(e);return t.type!==`naddr`||t.data.kind!==33301||t.data.identifier!==``?void 0:t.data.pubkey}catch{return}}function fa(e){let t=e.trim(),n,r=``;if(/^naddr1[023456789acdefghjklmnpqrstuvwxyz]+/i.test(t)){let[e,...i]=t.split(`#`);n=e,r=i.join(`#`)}else{let e;try{e=new URL(t)}catch{return}if(!e.pathname.startsWith(ua))return;n=decodeURIComponent(e.pathname.slice(8)).replace(/\/$/,``),r=e.hash.replace(/^#/,``)}if(!n)return;let i=da(n);if(!i)return;let a=L(`${la}${n}${r?`#${r}`:``}`);if(a)return{naddr:n,linkSigner:i,fragment:r,openUrl:a,missingSecret:r.length===0}}var pa=16,ma=3,ha=4,ga=1,_a={1:`wss://jskitty.com/nostr`,2:`wss://asia.vectorapp.io/nostr`,3:`wss://relay.ditto.pub`,4:`wss://relay.dreamith.to`},va=[1,2,3,4].map(e=>_a[e]);function ya(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.length%4==0?``:`=`.repeat(4-t.length%4),r=atob(t+n),i=new Uint8Array(r.length);for(let e=0;en+e<=t.length;if(!r(2)||t[n++]!==ha)return;let i=t[n++],a=[];if(i&ga)a.push(...va);else{if(!r(1))return;let e=t[n++];if(e>ma)return;let i=new TextDecoder;for(let o=0;o=1&&e<=254){let t=_a[e];t&&a.push(t)}else{if(!r(1))return;let o=t[n++];if(!r(o))return;let s=i.decode(t.slice(n,n+o));n+=o,a.push(e===255?s:`wss://${s}`)}}}if(!r(pa))return;let o=t.slice(n,n+pa);if(n+=pa,n===t.length)return{token:o,relays:a}}function xa(e){let t=new TextEncoder().encode(`concord/invite-key`),n=new Uint8Array(t.length+1+32);return n.set(t,0),Be(Ye,e,new Uint8Array,n,32)}var Sa=`6`;function Ca(e,t,n){if(e.kind!==33301||e.pubkey!==t||e.tags.find(e=>e[0]===`vsk`)?.[1]!==Sa||!Ue(e))return;let r;try{r=JSON.parse(sa(e.content,xa(n)))}catch{return}if(!r||typeof r!=`object`)return;let i=typeof r.name==`string`?r.name:``,a=Array.isArray(r.channels)?r.channels:[],o=Array.isArray(r.relays)?r.relays.filter(e=>typeof e==`string`):[],s=typeof r.expires_at==`number`?r.expires_at:void 0;return{name:i,icon:wa(r.icon)?r.icon:void 0,channelCount:a.length,relays:o.slice(0,ma),expired:typeof s==`number`&&Date.now()>s}}function wa(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.url==`string`&&typeof t.key==`string`&&typeof t.nonce==`string`&&typeof t.hash==`string`}function Ta(e){let{nostr:t}=Fe(),n=(0,Z.useMemo)(()=>e&&!e.missingSecret?ba(e.fragment):void 0,[e]),r=n?qe(n.token):``;return I({queryKey:[`armada-invite-preview`,e?.linkSigner??``,r],enabled:!!e&&!!n,staleTime:300*1e3,retry:1,queryFn:async r=>{if(!e||!n)return null;let i=n.relays.filter(e=>/^wss:\/\//i.test(e)),a=await(i.length?t.group(i):t).query([{kinds:[ca],authors:[e.linkSigner],"#d":[``],limit:1}],{signal:r.signal});if(!a.length)return null;let o=a.sort((e,t)=>t.created_at-e.created_at)[0];return Ca(o,e.linkSigner,n.token)??null}})}function Ea(e){return e.length>=8&&e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71?`image/png`:e.length>=3&&e[0]===255&&e[1]===216&&e[2]===255?`image/jpeg`:e.length>=6&&e[0]===71&&e[1]===73&&e[2]===70?`image/gif`:e.length>=12&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80?`image/webp`:e.length>=5&&e[0]===60?`image/svg+xml`:`application/octet-stream`}async function Da(e,t){let n=L(e.url);if(n)try{let r=await fetch(n,{signal:t});if(!r.ok)return;let i=await Tt(await r.arrayBuffer(),Je(e.key),Je(e.nonce)),a=new Uint8Array(i);if(qe(Ye(a))!==e.hash.toLowerCase())return;let o=Ea(a);return URL.createObjectURL(new Blob([a],{type:o}))}catch{return}}function Oa(e){let[t,n]=(0,Z.useState)(null);return(0,Z.useEffect)(()=>{if(!e){n(null);return}let t,r=!1,i=new AbortController;return Da(e,i.signal).then(e=>{if(r){e&&URL.revokeObjectURL(e);return}t=e,n(e??null)}),()=>{r=!0,i.abort(),t&&URL.revokeObjectURL(t)}},[e]),t}function ka(e,t=`0.4rem`){return{borderRadius:t,clipPath:`polygon(${e} 0, 100% 0, 100% calc(100% - ${e}), calc(100% - ${e}) 100%, 0 100%, 0 ${e})`}}function Aa({className:e}){return(0,Q.jsxs)(`svg`,{viewBox:`0 0 256 256`,fill:`none`,role:`img`,"aria-label":`Armada`,className:e,children:[(0,Q.jsx)(`path`,{d:`M64 16 H232 a8 8 0 0 1 8 8 V192 L192 240 H24 a8 8 0 0 1 -8 -8 V64 Z`,fill:`none`,stroke:`currentColor`,strokeWidth:`12`}),(0,Q.jsx)(`path`,{d:`M128 56 L180 162 H158 L128 100 L98 162 H76 Z`,fill:`currentColor`}),(0,Q.jsxs)(`g`,{stroke:`currentColor`,strokeLinecap:`round`,opacity:`0.55`,children:[(0,Q.jsx)(`path`,{d:`M88 184 H168`,strokeWidth:`7`}),(0,Q.jsx)(`path`,{d:`M104 200 H152`,strokeWidth:`5`,opacity:`0.7`})]})]})}function ja({preview:e,sizeClass:t,crestClass:n,cut:r}){let i=Oa(e?.icon);return(0,Q.jsx)(`div`,{className:z(`relative flex shrink-0 items-center justify-center overflow-hidden bg-primary/15`,t),style:ka(r),children:i?(0,Q.jsx)(`img`,{src:i,alt:e?.name||`Community icon`,className:`size-full object-cover`,decoding:`async`}):(0,Q.jsx)(Aa,{className:z(`text-primary`,n)})})}function Ma(e){return e<=0?`No channels`:`${e} ${e===1?`channel`:`channels`}`}function Na({invite:e,className:t,variant:n=`embed`}){let r=L(e.openUrl),[i,a]=(0,Z.useState)(!1),{data:o,isLoading:s}=Ta(e),c=!e.missingSecret&&s,l=o?.name?.trim(),u=()=>{r&&(navigator.clipboard.writeText(r),a(!0),setTimeout(()=>a(!1),2e3))},d=()=>{r&&Et(r)};return n===`detail`?(0,Q.jsxs)(`div`,{className:z(`relative mx-auto w-full max-w-md overflow-hidden text-center`,`border border-primary/25 rounded-xl`,`bg-gradient-to-br from-primary/10 via-background to-primary/[0.06]`,`shadow-sm`,t),children:[(0,Q.jsx)(`div`,{className:`pointer-events-none absolute -right-10 -top-14 size-40 rounded-full bg-primary/20 blur-3xl`,"aria-hidden":!0}),(0,Q.jsxs)(`div`,{className:`relative flex flex-col items-center px-6 py-8 space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-primary`,children:`Armada`}),(0,Q.jsx)(`span`,{className:`text-xs font-medium uppercase tracking-wider text-muted-foreground`,children:`· Community invite`})]}),(0,Q.jsx)(ja,{preview:o,sizeClass:`size-20`,crestClass:`size-14`,cut:`1rem`}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[c?(0,Q.jsx)(X,{className:`mx-auto h-6 w-40`}):(0,Q.jsx)(`h2`,{className:`text-lg font-bold leading-tight`,children:l||`Encrypted community`}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-center gap-3 text-sm text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(fe,{className:`size-3.5 shrink-0`}),e.missingSecret?`Missing secret`:`Encrypted`]}),o&&o.channelCount>0&&(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(g,{className:`size-3.5 shrink-0`}),Ma(o.channelCount)]})]}),(0,Q.jsx)(`p`,{className:`mx-auto max-w-xs text-sm text-muted-foreground`,children:e.missingSecret?`Ask whoever shared it for a fresh link — the secret can't be recovered.`:o?.expired?`This invite has expired. Ask for a fresh link to join.`:`Ditto can't open encrypted communities. Open this invite in Armada to view and join.`})]}),(0,Q.jsxs)(`div`,{className:`flex w-full max-w-xs flex-col gap-2 pt-1`,children:[e.missingSecret?(0,Q.jsx)(B,{variant:`secondary`,style:ka(`0.85rem`),disabled:!0,children:`Invite incomplete`}):(0,Q.jsxs)(B,{style:ka(`0.85rem`),disabled:!r,onClick:d,children:[(0,Q.jsx)(de,{className:`size-4`}),`Open in Armada`]}),(0,Q.jsxs)(B,{type:`button`,variant:`secondary`,className:`bg-primary/10 text-primary hover:bg-primary/20`,style:ka(`0.85rem`),disabled:!r,onClick:u,children:[i?(0,Q.jsx)(he,{className:`size-4 text-primary`}):(0,Q.jsx)(M,{className:`size-4`}),i?`Copied`:`Copy invite link`]})]})]})]}):(0,Q.jsxs)(`div`,{className:z(`group relative block max-w-sm w-full my-2.5 overflow-hidden`,`border border-primary/25 rounded-lg`,`bg-gradient-to-br from-primary/10 via-background to-primary/[0.06]`,`shadow-sm`,t),onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(`div`,{className:`pointer-events-none absolute -right-8 -top-10 size-28 rounded-full bg-primary/20 blur-2xl`,"aria-hidden":!0}),(0,Q.jsxs)(`div`,{className:`relative px-3.5 py-3 space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-wider text-primary`,children:`Armada`}),(0,Q.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-wider text-muted-foreground`,children:`· Community invite`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,Q.jsx)(ja,{preview:o,sizeClass:`size-12`,crestClass:`size-8`,cut:`0.65rem`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[c?(0,Q.jsx)(X,{className:`h-4 w-28`}):(0,Q.jsx)(`p`,{className:`font-semibold leading-tight truncate`,children:l||`Encrypted community`}),(0,Q.jsxs)(`p`,{className:`mt-0.5 flex items-center gap-2.5 text-xs text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(fe,{className:`size-3 shrink-0`}),e.missingSecret?`Missing secret`:`Encrypted`]}),o&&o.channelCount>0&&(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(g,{className:`size-3 shrink-0`}),o.channelCount]})]})]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.missingSecret?(0,Q.jsx)(B,{variant:`secondary`,className:`flex-1`,style:ka(`0.7rem`),disabled:!0,children:`Invite incomplete`}):(0,Q.jsxs)(B,{className:`flex-1`,style:ka(`0.7rem`),disabled:!r,onClick:e=>{e.preventDefault(),e.stopPropagation(),d()},children:[(0,Q.jsx)(de,{className:`size-4`}),`Open in Armada`]}),(0,Q.jsx)(B,{type:`button`,variant:`secondary`,size:`icon`,className:`shrink-0 bg-primary/10 text-primary hover:bg-primary/20`,style:ka(`0.7rem`),"aria-label":i?`Link copied`:`Copy invite link`,disabled:!r,onClick:e=>{e.preventDefault(),e.stopPropagation(),u()},children:i?(0,Q.jsx)(he,{className:`size-4 text-primary`}):(0,Q.jsx)(M,{className:`size-4`})})]})]})]})}var Pa=(0,Z.lazy)(()=>Me(()=>import(`./BlobbiStateCard-DnVg3tNE.js`).then(e=>({default:e.BlobbiStateCard})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163]))),Fa=280;function Ia(e){let t=t=>e.tags.find(([e])=>e===t)?.[1],n=t(`title`)||t(`name`),r=t(`summary`)||t(`description`),i=t(`image`)||t(`thumb`)||t(`banner`),a=t(`alt`);if(e.content)try{let t=JSON.parse(e.content);typeof t==`object`&&t&&(!n&&t.title&&(n=t.title),!r&&t.description&&(r=t.description),!i&&t.images?.[0]&&(i=t.images[0]),!i&&t.image&&(i=t.image))}catch{!r&&e.content.length>0&&(r=e.content)}return!n&&a?n=a:!r&&a&&(r=a),{title:n,description:r,image:i}}function La(e){let{addr:t}=e;return(0,Q.jsx)(je,{fallback:(0,Q.jsx)(Ar,{compact:!0,className:e.className}),sentryLevel:`error`,sentryTags:{errorBoundary:`embedded-naddr`,kind:t.kind,pubkey:t.pubkey},resetKeys:[t.kind,t.pubkey,t.identifier],children:(0,Q.jsx)(Ra,{...e})})}function Ra({addr:e,className:t,disableHoverCards:n,sourceUrl:r}){let{data:i,isLoading:a,isError:o}=Nn(e);if(e.kind===33301){let n=F.naddrEncode({kind:e.kind,pubkey:e.pubkey,identifier:e.identifier});return(0,Q.jsx)(Na,{invite:r&&fa(r)||{naddr:n,linkSigner:e.pubkey,fragment:``,openUrl:`https://armada.buzz/invite/${n}`,missingSecret:!0},className:t})}return a?(0,Q.jsx)(Xa,{className:t}):o||!i?(0,Q.jsx)(Ya,{addr:e,className:t}):i.kind===30009?(0,Q.jsx)(za,{event:i,className:t}):Kt(i)?(0,Q.jsx)(Va,{event:i,className:t}):i.kind===31124?(0,Q.jsx)(Ua,{event:i,className:t,disableHoverCards:n}):i.kind===33863?(0,Q.jsx)(Wa,{event:i,className:t,disableHoverCards:n}):i.kind===38192?(0,Q.jsx)(Di,{event:i,className:t,disableHoverCards:n}):In(i.kind)?(0,Q.jsx)(yi,{event:i,className:t,disableHoverCards:n}):i.kind===10002?(0,Q.jsx)(Ti,{event:i,className:t,disableHoverCards:n}):i.kind===0?(0,Q.jsx)(Ei,{event:i,className:t,disableHoverCards:n}):i.kind===31871?(0,Q.jsx)(Li,{event:i,className:t,disableHoverCards:n}):i.kind===37849?(0,Q.jsx)(Ga,{event:i,className:t,disableHoverCards:n}):i.kind===30315?(0,Q.jsx)(qa,{event:i,className:t,disableHoverCards:n}):i.kind===30312||i.kind===30313?(0,Q.jsx)(Ka,{event:i,className:t,disableHoverCards:n}):i.kind===39701?(0,Q.jsx)(Ja,{event:i,className:t,disableHoverCards:n}):i.kind===30402&&Ki(i)?(0,Q.jsx)(qi,{event:i,className:t,disableHoverCards:n}):Xn.has(i.kind)?(0,Q.jsx)(Yn,{event:i,className:t,disableHoverCards:n,sourceUrl:r}):Zn.has(i.kind)?(0,Q.jsx)(Qn,{event:i,className:t,disableHoverCards:n}):(0,Q.jsx)(Ha,{event:i,className:t,disableHoverCards:n,sourceUrl:r})}function za({event:e,className:t}){let n=K(),r=(0,Z.useMemo)(()=>Ut(e),[e]),i=(0,Z.useMemo)(()=>{let t=e.tags.find(([e])=>e===`d`)?.[1]??``;return F.naddrEncode({kind:e.kind,pubkey:e.pubkey,identifier:t})},[e]);if(!r)return(0,Q.jsx)(Ha,{event:e,className:t});let a=r.image??r.thumbs.find(e=>e.dimensions===`512x512`)?.url??r.thumbs[0]?.url;return(0,Q.jsx)(`div`,{className:z(`group block rounded-2xl border border-border overflow-hidden`,`hover:bg-secondary/40 transition-colors cursor-pointer`,t),role:`link`,tabIndex:0,onClick:e=>{e.stopPropagation(),n(`/${i}`)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),n(`/${i}`))},children:(0,Q.jsxs)(`div`,{className:`relative isolate flex flex-col items-center py-6 overflow-hidden`,children:[(0,Q.jsx)(`div`,{className:`absolute -z-10 pointer-events-none`,"aria-hidden":`true`,style:{width:240,height:240,top:`50%`,left:`50%`,transform:`translate(-50%, -55%)`},children:(0,Q.jsx)(`div`,{className:`w-full h-full animate-badge-spotlight`,style:{background:`repeating-conic-gradient( hsl(var(--primary) / 0.08) 0deg 6deg, transparent 6deg 18deg )`,maskImage:`radial-gradient(circle, black 15%, transparent 70%)`,WebkitMaskImage:`radial-gradient(circle, black 15%, transparent 70%)`}})}),(0,Q.jsx)(`div`,{className:`relative z-[1]`,children:a?(0,Q.jsx)(`img`,{src:a,alt:r.name,className:`size-20 rounded-xl object-cover drop-shadow-lg`,loading:`lazy`,decoding:`async`}):(0,Q.jsx)(`div`,{className:`size-20 rounded-xl bg-gradient-to-br from-primary/10 via-primary/5 to-transparent flex items-center justify-center`,children:(0,Q.jsx)(N,{className:`size-8 text-primary/30`})})}),(0,Q.jsxs)(`div`,{className:`relative z-[1] mt-3 text-center px-4 max-w-xs`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-semibold leading-snug`,children:r.name}),r.description&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5 line-clamp-1`,children:r.description})]})]})})}var Ba=6;function Va({event:e,className:t}){let{nostr:n}=Fe(),r=K(),i=R(e.pubkey),a=i.data?.metadata,o=U(a),s=a?.name||a?.display_name||`Anonymous`,c=J(e.pubkey,a),l=(0,Z.useMemo)(()=>Yt(e),[e]),{data:u}=I({queryKey:[`badge-definitions-embed`,l.map(e=>e.aTag).join(`,`)],queryFn:async()=>{if(l.length===0)return[];let e=l.slice(0,Ba).map(e=>({kinds:[30009],authors:[e.pubkey],"#d":[e.identifier],limit:1}));return n.query(e)},enabled:l.length>0,staleTime:5*6e4}),d=(0,Z.useMemo)(()=>{let e=new Map;if(!u)return e;for(let t of u){let n=Ut(t);n&&e.set(`30009:${t.pubkey}:${n.identifier}`,n)}return e},[u]),f=(0,Z.useMemo)(()=>F.naddrEncode({kind:e.kind,pubkey:e.pubkey,identifier:``}),[e.kind,e.pubkey]),p=l.slice(0,Ba),m=Math.max(0,l.length-Ba);return(0,Q.jsx)(`div`,{className:z(`group block rounded-2xl border border-border overflow-hidden`,`hover:bg-secondary/40 transition-colors cursor-pointer`,t),role:`link`,tabIndex:0,onClick:e=>{e.stopPropagation(),r(`/${f}`)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),r(`/${f}`))},children:(0,Q.jsxs)(`div`,{className:`px-3 py-2 space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[i.isLoading?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{className:`size-5 rounded-full shrink-0`}),(0,Q.jsx)(X,{className:`h-3.5 w-24`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(q,{to:c,className:`shrink-0`,onClick:e=>e.stopPropagation(),children:(0,Q.jsxs)(G,{shape:o,className:`size-5`,children:[(0,Q.jsx)(W,{src:a?.picture,alt:s}),(0,Q.jsx)(H,{className:`bg-primary/20 text-primary text-[10px]`,children:s[0]?.toUpperCase()})]})}),(0,Q.jsx)(q,{to:c,className:`text-sm font-semibold truncate hover:underline`,onClick:e=>e.stopPropagation(),children:i.data?.event?(0,Q.jsx)(Bt,{tags:i.data.event.tags,children:s}):s})]}),(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:[`· `,Dn(e.created_at)]})]}),p.length>0&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[p.map(e=>{let t=d.get(e.aTag);return t?(0,Q.jsx)(Zt,{badge:t,size:32},e.aTag):(0,Q.jsx)(`div`,{className:`size-8 rounded-md border border-border bg-background flex items-center justify-center shrink-0`,children:(0,Q.jsx)(N,{className:`size-4 text-muted-foreground`})},e.aTag)}),m>0&&(0,Q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground font-medium ml-0.5`,children:[`+`,m]})]}),(0,Q.jsxs)(`p`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,Q.jsx)(N,{className:`size-3 shrink-0`}),l.length,` badge`,l.length===1?``:`s`]})]})})}function Ha({event:e,className:t,disableHoverCards:n,sourceUrl:r}){let i=(0,Z.useMemo)(()=>{let t=e.tags.find(([e])=>e===`d`)?.[1]??``;return F.naddrEncode({kind:e.kind,pubkey:e.pubkey,identifier:t})},[e]),a=(0,Z.useMemo)(()=>bt(r),[r]),o=cr(e.kind),s=o!==void 0,{title:c,description:l}=(0,Z.useMemo)(()=>s?Ia(e):{title:void 0,description:void 0},[s,e]),u=(0,Z.useMemo)(()=>{if(l)return l.length<=Fa?l:l.slice(0,Fa).trimEnd()+`…`},[l]),d=(0,Z.useMemo)(()=>{if(o)return{label:o,Icon:or(e.kind)}},[o,e.kind]);return(0,Q.jsxs)($,{pubkey:e.pubkey,createdAt:e.created_at,navigateTo:i,className:t,disableHoverCards:n,children:[s?(0,Q.jsxs)(Q.Fragment,{children:[c&&(0,Q.jsx)(`p`,{className:`text-sm font-semibold leading-snug line-clamp-2`,children:c}),u&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed line-clamp-3`,children:u})]}):(0,Q.jsx)(Qi,{event:e,className:`mt-0`}),(d||a)&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[d&&(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-muted-foreground`,children:[d.Icon&&(0,Q.jsx)(d.Icon,{className:`size-3 shrink-0`}),d.label]}),(0,Q.jsx)(Jn,{url:r,className:`ml-auto`})]})]})}function Ua({event:e,className:t,disableHoverCards:n}){let r=(0,Z.useMemo)(()=>{let t=e.tags.find(([e])=>e===`d`)?.[1]??``;return F.naddrEncode({kind:e.kind,pubkey:e.pubkey,identifier:t})},[e]);return(0,Q.jsx)($,{pubkey:e.pubkey,createdAt:e.created_at,navigateTo:r,className:t,disableHoverCards:n,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(X,{className:`h-24 w-full rounded-lg`}),children:(0,Q.jsx)(Pa,{event:e})})})}function Wa({event:e,className:t,disableHoverCards:n}){let r=(0,Z.useMemo)(()=>rr(e),[e]),i=(0,Z.useMemo)(()=>{let t=e.tags.find(([e])=>e===`d`)?.[1]??``;return F.naddrEncode({kind:e.kind,pubkey:e.pubkey,identifier:t})},[e]);if(!r)return(0,Q.jsx)(Ha,{event:e,className:t,disableHoverCards:n});let a=L(r.banner);return(0,Q.jsxs)($,{pubkey:r.pubkey,createdAt:r.createdAt,navigateTo:i,className:t,disableHoverCards:n,children:[(0,Q.jsx)(`div`,{className:`relative w-full overflow-hidden rounded-lg aspect-[16/9] bg-gradient-to-br from-primary/15 via-primary/5 to-secondary`,children:a?(0,Q.jsx)(`img`,{src:a,alt:``,loading:`lazy`,decoding:`async`,className:`absolute inset-0 size-full object-cover`}):(0,Q.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,Q.jsx)(o,{className:`size-10 text-primary/40`})})}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wide text-primary`,children:[(0,Q.jsx)(o,{className:`size-3`}),`Fundraiser`]}),(0,Q.jsx)(`p`,{dir:`auto`,className:`text-sm font-semibold leading-snug line-clamp-2 break-words`,children:r.title}),r.summary&&(0,Q.jsx)(`p`,{dir:`auto`,className:`text-xs text-muted-foreground leading-relaxed line-clamp-2 break-words`,children:r.summary})]})}function Ga({event:e,className:t,disableHoverCards:n}){let i=(0,Z.useMemo)(()=>ir(e),[e]),a=(0,Z.useMemo)(()=>{let t=e.tags.find(([e])=>e===`d`)?.[1]??``;return F.naddrEncode({kind:e.kind,pubkey:e.pubkey,identifier:t})},[e]);if(!i)return(0,Q.jsx)(Ha,{event:e,className:t,disableHoverCards:n});let o=i.questions.length;return(0,Q.jsxs)($,{pubkey:e.pubkey,createdAt:e.created_at,navigateTo:a,className:t,disableHoverCards:n,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wide text-primary`,children:[(0,Q.jsx)(r,{className:`size-3`}),`Quiz`]}),(0,Q.jsx)(`p`,{dir:`auto`,className:`text-sm font-semibold leading-snug line-clamp-2 break-words`,children:i.title}),i.summary&&(0,Q.jsx)(`p`,{dir:`auto`,className:`text-xs text-muted-foreground leading-relaxed line-clamp-2 break-words`,children:i.summary}),(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[o,` `,o===1?`question`:`questions`]})]})}function Ka({event:e,className:t,disableHoverCards:n}){let r=e.kind===30312,i=r?Se:re,a=t=>e.tags.find(([e])=>e===t)?.[1],o=a(`title`)||a(`room`)||(r?`Untitled Room`:`Untitled Meeting`),s=a(`summary`),c=a(`status`),l=(0,Z.useMemo)(()=>{let t=e.tags.find(([e])=>e===`d`)?.[1]??``;return F.naddrEncode({kind:e.kind,pubkey:e.pubkey,identifier:t})},[e]);return(0,Q.jsxs)($,{pubkey:e.pubkey,createdAt:e.created_at,navigateTo:l,className:t,disableHoverCards:n,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wide text-primary`,children:[(0,Q.jsx)(i,{className:`size-3`}),r?`Room`:`Meeting`,c&&(0,Q.jsx)(`span`,{className:`ml-1 rounded-full bg-secondary/60 px-2 py-0.5 text-[10px] text-muted-foreground normal-case tracking-normal`,children:c})]}),(0,Q.jsx)(`p`,{dir:`auto`,className:`text-sm font-semibold leading-snug line-clamp-2 break-words`,children:o}),s&&(0,Q.jsx)(`p`,{dir:`auto`,className:`text-xs text-muted-foreground leading-relaxed line-clamp-2 break-words`,children:s})]})}function qa({event:e,className:t,disableHoverCards:n}){let r=e.tags.find(([e])=>e===`d`)?.[1]??`general`,i=r===`music`,a=e.content.trim(),o=(0,Z.useMemo)(()=>{let t=e.tags.find(([e])=>e===`expiration`)?.[1];if(!t)return!1;let n=parseInt(t,10);return!Number.isNaN(n)&&Math.floor(Date.now()/1e3)>n},[e.tags]),s=(0,Z.useMemo)(()=>{let t=e.tags.find(([e])=>e===`d`)?.[1]??``;return F.naddrEncode({kind:e.kind,pubkey:e.pubkey,identifier:t})},[e]),c=i?T:E,l=i?`Listening to`:r===`general`?`Status`:`${r} status`,u=!a||o;return(0,Q.jsxs)($,{pubkey:e.pubkey,createdAt:e.created_at,navigateTo:s,className:t,disableHoverCards:n,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:[(0,Q.jsx)(c,{className:`size-3 shrink-0`}),l]}),u?(0,Q.jsx)(`p`,{className:`text-xs italic text-muted-foreground`,children:o?`This status has expired`:`No status set`}):(0,Q.jsx)(`p`,{dir:`auto`,className:`text-sm font-medium leading-snug break-words line-clamp-3 text-foreground`,children:(0,Q.jsx)(Bt,{tags:e.tags,children:a})})]})}function Ja({event:e,className:t,disableHoverCards:n}){let r=t=>e.tags.find(([e])=>e===t)?.[1],i=L(r(`r`)),a=r(`title`)?.trim(),o=r(`description`)?.trim(),s=L(r(`image`)),c=i?new URL(i).hostname.replace(/^www\./,``):r(`d`),l=(0,Z.useMemo)(()=>{let t=e.tags.find(([e])=>e===`d`)?.[1]??``;return F.naddrEncode({kind:e.kind,pubkey:e.pubkey,identifier:t})},[e]);return(0,Q.jsxs)($,{pubkey:e.pubkey,createdAt:e.created_at,navigateTo:l,className:t,disableHoverCards:n,children:[s&&(0,Q.jsx)(`div`,{className:`relative w-full overflow-hidden rounded-lg bg-muted/30`,style:{aspectRatio:`1.91`},children:(0,Q.jsx)(`img`,{src:s,alt:``,loading:`lazy`,decoding:`async`,className:`absolute inset-0 size-full object-cover`})}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wide text-primary`,children:[(0,Q.jsx)(k,{className:`size-3`}),`Bookmark`]}),a&&(0,Q.jsx)(`p`,{dir:`auto`,className:`text-sm font-semibold leading-snug line-clamp-2 break-words`,children:a}),o&&(0,Q.jsx)(`p`,{dir:`auto`,className:`text-xs text-muted-foreground leading-relaxed line-clamp-2 break-words`,children:o}),c&&(0,Q.jsx)(`p`,{className:`truncate text-[11px] text-muted-foreground`,children:c})]})}function Ya({addr:e,className:t}){let r=K(),i=(0,Z.useMemo)(()=>F.naddrEncode({kind:e.kind,pubkey:e.pubkey,identifier:e.identifier}),[e]);return(0,Q.jsx)(`div`,{className:z(`rounded-2xl border border-dashed border-border overflow-hidden`,`hover:bg-secondary/40 transition-colors cursor-pointer`,t),role:`link`,tabIndex:0,onClick:e=>{e.stopPropagation(),r(`/${i}`)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),r(`/${i}`))},children:(0,Q.jsxs)(`div`,{className:`px-3.5 py-4 flex items-center gap-2 text-muted-foreground`,children:[(0,Q.jsx)(n,{className:`size-4 shrink-0`}),(0,Q.jsx)(`span`,{className:`text-sm`,children:`This post could not be loaded`})]})})}function Xa({className:e}){return(0,Q.jsx)(`div`,{className:z(`rounded-2xl border border-border overflow-hidden`,e),children:(0,Q.jsxs)(`div`,{className:`px-3.5 py-2.5 space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(X,{className:`size-5 rounded-full`}),(0,Q.jsx)(X,{className:`h-3.5 w-24`}),(0,Q.jsx)(X,{className:`h-3 w-10`})]}),(0,Q.jsx)(X,{className:`h-4 w-3/4`}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(X,{className:`h-3 w-full`}),(0,Q.jsx)(X,{className:`h-3 w-4/5`})]})]})})}var Za={sm:`size-6`,md:`size-7`,lg:`size-9`},Qa={sm:`-space-x-1.5`,md:`-space-x-2`,lg:`-space-x-3`},$a={sm:`text-[10px]`,md:`text-[10px]`,lg:`text-xs`};function eo({pubkeys:e,maxVisible:t=6,size:n=`md`,className:r}){let i=(0,Z.useMemo)(()=>e.slice(0,t),[e,t]),{data:a}=on(i);if(e.length===0)return null;let o=e.length-i.length;return(0,Q.jsxs)(`div`,{className:z(`flex items-center gap-2`,r),children:[(0,Q.jsx)(`div`,{className:z(`flex`,Qa[n]),children:i.map(e=>{let t=a?.get(e),r=t?.metadata?.name||t?.metadata?.display_name||`Anonymous`,i=U(t?.metadata);return(0,Q.jsxs)(Sn,{children:[(0,Q.jsx)(bn,{asChild:!0,children:(0,Q.jsx)(q,{to:`/${F.npubEncode(e)}`,"aria-label":r,onClick:e=>e.stopPropagation(),className:z(`rounded-full relative transition-transform duration-150 ease-out`,`hover:z-10 motion-safe:hover:scale-110 focus-visible:z-10 motion-safe:focus-visible:scale-110`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background`),children:(0,Q.jsxs)(G,{shape:i,className:z(Za[n],`ring-2 ring-background`),children:[(0,Q.jsx)(W,{src:t?.metadata?.picture,alt:r}),(0,Q.jsx)(H,{className:z(`bg-primary/20 text-primary`,$a[n]),children:r[0]?.toUpperCase()})]})})}),(0,Q.jsx)(xn,{side:`bottom`,className:`text-xs`,children:r})]},e)})}),o>0&&(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`+`,o,` more`]})]})}function to(e){return I({queryKey:[`archive-org-meta`,e],queryFn:async({signal:t})=>{let n=await fetch(`https://archive.org/metadata/${e}`,{signal:t});if(!n.ok)return{dims:null,mediatype:null};let r=await n.json(),i=r.metadata?.mediatype??null,a=(r.files??[]).filter(e=>e.width&&e.height),o=a.find(e=>e.source===`original`)??a[0],s=null;if(o){let e=Number(o.width),t=Number(o.height);e&&t&&(s={width:e,height:t})}return{dims:s,mediatype:i}},staleTime:1e3*60*60,gcTime:1e3*60*60*24,retry:!1})}function no({identifier:e,className:t}){let[n,r]=(0,Z.useState)(!1),{data:i}=to(e),[a,o]=(0,Z.useState)(0),s=(0,Z.useCallback)(e=>{if(!e)return;let t=new ResizeObserver(e=>{for(let t of e)o(t.contentRect.width)});t.observe(e),o(e.getBoundingClientRect().width),c.current=t},[]),c=(0,Z.useRef)(null),l=`https://archive.org/services/img/${e}`,u=i?.mediatype===`software`,d=i?.dims?.width??640,f=i?.dims?.height??480,p=`${f/d*100}%`,m=a>0?Math.min(1,a/d):1,h=f*m;return(0,Q.jsx)(`div`,{ref:s,className:z(`rounded-2xl overflow-hidden border border-border`,t),onClick:e=>e.stopPropagation(),children:n?u?(0,Q.jsx)(`div`,{className:`relative overflow-hidden bg-black`,style:{height:h},children:(0,Q.jsx)(`iframe`,{src:`https://archive.org/embed/${e}&autoplay=1`,title:`Internet Archive`,allow:`autoplay`,allowFullScreen:!0,style:{width:d,height:f,transform:`scale(${m})`,transformOrigin:`top left`,border:`none`}})}):(0,Q.jsx)(`div`,{className:`relative w-full`,style:{paddingBottom:p},children:(0,Q.jsx)(`iframe`,{src:`https://archive.org/embed/${e}&autoplay=1`,title:`Internet Archive`,allow:`autoplay`,allowFullScreen:!0,className:`absolute inset-0 w-full h-full`})}):(0,Q.jsx)(`div`,{className:`relative w-full`,style:{paddingBottom:p},children:(0,Q.jsxs)(`button`,{type:`button`,className:`absolute inset-0 w-full h-full cursor-pointer bg-black group`,onClick:()=>r(!0),"aria-label":`Load content`,children:[(0,Q.jsx)(`img`,{src:l,alt:``,className:`absolute inset-0 w-full h-full object-contain`,decoding:`async`}),(0,Q.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,Q.jsx)(`div`,{className:z(`flex items-center justify-center`,`w-[68px] h-[48px] rounded-xl`,`bg-[#212121]/80 group-hover:bg-[#428bca] transition-colors duration-200`),children:(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,className:`w-6 h-6 text-white ml-0.5`,children:(0,Q.jsx)(`path`,{d:`M8 5v14l11-7z`})})})})]})})})}function ro(e){let t=new Date(e),n=Math.floor((Date.now()-t.getTime())/1e3);return n<60?`${n}s`:n<3600?`${Math.floor(n/60)}m`:n<86400?`${Math.floor(n/3600)}h`:n<604800?`${Math.floor(n/86400)}d`:n<2592e3?`${Math.floor(n/604800)}w`:t.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}function io({post:e,hideImage:t,className:n}){let r=K();return(0,Q.jsxs)(`div`,{className:z(`group block rounded-2xl border border-border overflow-hidden`,`hover:bg-secondary/40 transition-colors cursor-pointer`,n),role:`link`,tabIndex:0,onClick:t=>{t.stopPropagation(),r(`/i/${encodeURIComponent(e.postUrl)}`)},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),r(`/i/${encodeURIComponent(e.postUrl)}`))},children:[!t&&e.images&&e.images.length>0&&(0,Q.jsx)(`div`,{className:z(`w-full overflow-hidden`,e.images.length>1?`grid grid-cols-2 gap-px`:``),children:e.images.slice(0,4).map((t,n)=>(0,Q.jsx)(`img`,{src:t.thumb,alt:t.alt||``,className:z(`w-full object-cover`,e.images.length===1?`max-h-[300px]`:`h-[150px]`),loading:`lazy`,onError:e=>{e.currentTarget.style.display=`none`},decoding:`async`},n))}),!t&&!e.images&&e.external?.thumb&&(0,Q.jsx)(`div`,{className:`w-full overflow-hidden`,children:(0,Q.jsx)(`img`,{src:e.external.thumb,alt:``,className:`w-full h-[160px] object-cover`,loading:`lazy`,onError:e=>{e.currentTarget.parentElement.style.display=`none`},decoding:`async`})}),(0,Q.jsxs)(`div`,{className:`px-3 py-2 space-y-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,Q.jsx)(`button`,{type:`button`,className:`shrink-0`,onClick:t=>{t.stopPropagation(),r(`/i/${encodeURIComponent(e.profileUrl)}`)},children:(0,Q.jsxs)(G,{className:`size-5`,children:[(0,Q.jsx)(W,{src:e.avatar,alt:e.displayName}),(0,Q.jsx)(H,{className:`bg-primary/20 text-primary text-[10px]`,children:e.displayName[0]?.toUpperCase()})]})}),(0,Q.jsx)(`button`,{type:`button`,className:`text-sm font-semibold truncate hover:underline`,onClick:t=>{t.stopPropagation(),r(`/i/${encodeURIComponent(e.profileUrl)}`)},children:e.displayName}),(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground truncate`,children:[`@`,e.handle]}),(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:[`· `,ro(e.createdAt)]})]}),e.text&&(0,Q.jsx)(`p`,{className:`text-sm leading-relaxed text-foreground whitespace-pre-wrap break-words overflow-hidden line-clamp-6`,children:e.text}),e.external&&e.external.title&&(0,Q.jsx)(`div`,{className:`text-xs text-muted-foreground truncate`,children:e.external.title}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-4 pt-0.5`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,Q.jsx)(ye,{className:`size-3.5`}),lr(e.replyCount)]}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,Q.jsx)(Ee,{className:`size-3.5`}),lr(e.repostCount)]}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,Q.jsx)(a,{className:`size-3.5`}),lr(e.likeCount)]}),e.brandIcon&&(0,Q.jsx)(`a`,{href:e.postUrl,target:`_blank`,rel:`noopener noreferrer`,className:`ml-auto text-[11px] text-muted-foreground flex items-center gap-1 hover:text-foreground transition-colors`,onClick:e=>e.stopPropagation(),children:e.brandIcon})]})]})]})}function ao({className:e}){return(0,Q.jsx)(`div`,{className:z(`rounded-2xl border border-border overflow-hidden`,e),children:(0,Q.jsxs)(`div`,{className:`px-3 py-2.5 space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(X,{className:`size-5 rounded-full`}),(0,Q.jsx)(X,{className:`h-3.5 w-24`}),(0,Q.jsx)(X,{className:`h-3 w-20`}),(0,Q.jsx)(X,{className:`h-3 w-10`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(X,{className:`h-3.5 w-full`}),(0,Q.jsx)(X,{className:`h-3.5 w-4/5`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-4 pt-0.5`,children:[(0,Q.jsx)(X,{className:`h-3 w-10`}),(0,Q.jsx)(X,{className:`h-3 w-10`}),(0,Q.jsx)(X,{className:`h-3 w-10`})]})]})})}function oo(e,t){let n=e.startsWith(`did:`),{data:r,isLoading:i}=I({queryKey:[`bsky-resolve-handle`,e],queryFn:async({signal:t})=>{let n=await fetch(`https://public.api.bsky.app/xrpc/com.atproto.identity.resolveHandle?handle=${encodeURIComponent(e)}`,{signal:t});return n.ok?(await n.json()).did??null:null},enabled:!n,staleTime:1/0,gcTime:1e3*60*60*24,retry:!1}),a=n?e:r,o=I({queryKey:[`bsky-post`,a,t],queryFn:async({signal:e})=>{let n=`at://${a}/app.bsky.feed.post/${t}`,r=await fetch(`https://public.api.bsky.app/xrpc/app.bsky.feed.getPostThread?uri=${encodeURIComponent(n)}&depth=0`,{signal:e});if(!r.ok)return null;let i=(await r.json()).thread?.post;if(!i)return null;let o=i.author.handle,s=i.embed?.$type===`app.bsky.embed.images#view`&&i.embed.images?i.embed.images.map(e=>({thumb:e.thumb,alt:e.alt})):void 0,c=i.embed?.$type===`app.bsky.embed.external#view`&&i.embed.external?{title:i.embed.external.title,thumb:i.embed.external.thumb}:void 0;return{displayName:i.author.displayName||o,handle:o,avatar:i.author.avatar,text:i.record.text??``,createdAt:i.record.createdAt??``,postUrl:`https://bsky.app/profile/${o}/post/${t}`,profileUrl:`https://bsky.app/profile/${o}`,replyCount:i.replyCount??0,repostCount:(i.repostCount??0)+(i.quoteCount??0),likeCount:i.likeCount??0,images:s,external:c}},enabled:!!a,staleTime:1e3*60*5,gcTime:1e3*60*60,retry:!1});return{...o,isLoading:i||o.isLoading}}function so({className:e}){return(0,Q.jsx)(`svg`,{className:e,viewBox:`0 0 600 530`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,"aria-label":`Bluesky`,children:(0,Q.jsx)(`path`,{d:`m135.72 44.03c66.496 49.921 138.02 151.14 164.28 205.46 26.262-54.316 97.782-155.54 164.28-205.46 47.98-36.021 125.72-63.892 125.72 24.795 0 17.712-10.155 148.79-16.111 170.07-20.703 73.984-96.144 92.854-163.25 81.433 117.3 19.964 147.14 86.092 82.697 152.22-122.39 125.59-175.91-31.511-189.63-71.766-2.514-7.3797-3.6904-10.832-3.7077-7.8964-0.0174-2.9357-1.1937 0.51669-3.7077 7.8964-13.714 40.255-67.233 197.36-189.63 71.766-64.444-66.128-34.605-132.26 82.697-152.22-67.108 11.421-142.55-7.4491-163.25-81.433-5.9562-21.282-16.111-152.36-16.111-170.07 0-88.687 77.742-60.816 125.72-24.795z`})})}function co({author:e,rkey:t,hideImage:n,className:r}){let{data:i,isLoading:a,isError:o}=oo(e,t);return a?(0,Q.jsx)(ao,{className:r}):o||!i?null:(0,Q.jsx)(io,{post:{...i,brandIcon:(0,Q.jsx)(so,{className:`size-3.5`})},hideImage:n,className:r})}function lo(e){try{return new URL(e).hostname.replace(/^www\./,``)}catch{return e}}function uo({url:e,className:t,hideImage:n,navigateToComments:r,showActions:i=!0}){let{data:a,isLoading:o}=Fn(e),s=K();if(o)return(0,Q.jsx)(fo,{className:t});let c=a?.provider_name||lo(e),l=a?.thumbnail_url;return(0,Q.jsxs)(`a`,{href:e,target:r?void 0:`_blank`,rel:r?void 0:`noopener noreferrer`,className:z(`group block rounded-2xl border border-border overflow-hidden`,`hover:bg-secondary/40 transition-colors`,t),onClick:t=>{t.stopPropagation(),r&&(t.preventDefault(),s(`/i/${encodeURIComponent(e)}`))},children:[l&&!n&&(0,Q.jsx)(`div`,{className:`w-full overflow-hidden`,children:(0,Q.jsx)(`img`,{src:l,alt:``,className:`w-full h-[180px] object-cover`,loading:`lazy`,onError:e=>{e.currentTarget.parentElement.style.display=`none`},decoding:`async`})}),(0,Q.jsxs)(`div`,{className:`px-3.5 py-2.5 space-y-0.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)($t,{url:e,size:14,className:`shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:c}),i&&(r?(0,Q.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:z(`ml-auto flex items-center gap-1 px-2 py-0.5 rounded-full`,`text-xs text-muted-foreground`,`hover:bg-primary/10 hover:text-primary transition-colors`),onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(de,{className:`size-3`}),(0,Q.jsx)(`span`,{children:`Open`})]}):(0,Q.jsxs)(`button`,{type:`button`,className:z(`ml-auto flex items-center gap-1 px-2 py-0.5 rounded-full`,`text-xs text-muted-foreground`,`hover:bg-primary/10 hover:text-primary transition-colors`),onClick:t=>{t.preventDefault(),t.stopPropagation(),s(`/i/${encodeURIComponent(e)}`)},children:[(0,Q.jsx)(v,{className:`size-3`}),(0,Q.jsx)(`span`,{children:`Discuss`})]}))]}),a?.title&&(0,Q.jsx)(`p`,{className:`text-sm font-semibold leading-snug line-clamp-2`,children:a.title}),a?.author_name&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed line-clamp-2`,children:a.author_name})]})]})}function fo({className:e}){return(0,Q.jsxs)(`div`,{className:z(`rounded-2xl border border-border overflow-hidden`,e),children:[(0,Q.jsx)(X,{className:`w-full h-[180px] rounded-none`}),(0,Q.jsxs)(`div`,{className:`px-3.5 py-2.5 space-y-1.5`,children:[(0,Q.jsx)(X,{className:`h-3 w-24`}),(0,Q.jsx)(X,{className:`h-4 w-3/4`}),(0,Q.jsx)(X,{className:`h-3 w-full`})]})]})}function po(e){return e.replace(//gi,` `).replace(/<\/p>\s*

/gi,` `).replace(/<[^>]+>/g,``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/'/g,`'`).trim()}function mo(e){return I({queryKey:[`mastodon-post`,e],queryFn:async({signal:t})=>{let n;try{n=new URL(e)}catch{return null}let r=n.origin,i=n.pathname.split(`/`),a=i[i.length-1];if(!a||!/^\d+$/.test(a))return null;let o=await fetch(`${r}/api/v1/statuses/${a}`,{signal:t});if(!o.ok)return null;let s=await o.json(),c=s.media_attachments.length>0?s.media_attachments.filter(e=>e.type===`image`).map(e=>({thumb:e.preview_url||e.url,alt:e.description||``})):void 0,l=!c&&s.card?.title?{title:s.card.title,thumb:s.card.image??void 0}:void 0,u=s.account.acct.includes(`@`)?s.account.acct:`${s.account.acct}@${n.hostname}`;return{displayName:s.account.display_name||s.account.username,handle:u,avatar:s.account.avatar,text:po(s.content),createdAt:s.created_at,postUrl:s.url||e,profileUrl:s.account.url,replyCount:s.replies_count,repostCount:s.reblogs_count,likeCount:s.favourites_count,images:c&&c.length>0?c:void 0,external:l}},staleTime:1e3*60*5,gcTime:1e3*60*60,retry:!1})}function ho({className:e}){return(0,Q.jsxs)(`svg`,{className:e,viewBox:`0 0 216.4 232`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,"aria-label":`Mastodon`,children:[(0,Q.jsx)(`path`,{d:`M211.8 139.1c-3.2 16.4-28.6 34.3-57.8 37.8-15.2 1.8-30.2 3.5-46.1 2.8-26.1-1.2-46.7-6.2-46.7-6.2 0 2.5.2 4.9.5 7.2 3.8 28.6 28.4 30.3 51.7 31.1 23.5.7 44.5-5.8 44.5-5.8l1 21.7s-16.5 8.8-45.8 10.5c-16.2.9-36.3-.4-59.7-6.7C7.5 213.8 1.2 165.4.2 116.3c-.3-14.6-.1-28.3-.1-39.8 0-50.2 32.9-64.9 32.9-64.9C49.6 3.5 78.1.2 107.8 0h.7c29.7.2 58.2 3.5 74.9 11.6 0 0 32.9 14.7 32.9 64.9 0 0 .4 37.1-4.5 62.6`}),(0,Q.jsx)(`path`,{d:`M177.5 80.5v60.3h-23.9v-58.5c0-12.3-5.2-18.6-15.5-18.6-11.4 0-17.2 7.4-17.2 22.1v32h-23.8V85.8c0-14.7-5.7-22.1-17.2-22.1-10.3 0-15.5 6.3-15.5 18.6v58.5H40.5V80.5c0-12.3 3.1-22.1 9.4-29.4 6.5-7.3 15-11 25.5-11 12.2 0 21.4 4.7 27.4 14.1l5.9 9.9 5.9-9.9c6-9.4 15.2-14.1 27.4-14.1 10.5 0 19 3.7 25.5 11 6.3 7.3 9.4 17.1 9.4 29.4`,fill:`var(--background, #fff)`})]})}function go({url:e,className:t}){let{data:n,isLoading:r,isError:i}=mo(e);return r?(0,Q.jsx)(ao,{className:t}):i||!n?null:(0,Q.jsx)(io,{post:{...n,brandIcon:(0,Q.jsx)(ho,{className:`size-3.5`})},className:t})}function _o({url:e,className:t}){let n=(0,Z.useRef)(null),r=(()=>{try{let t=new URL(e);return t.hostname=`embed.reddit.com`,t.search=``,t.hash=``,t.toString()}catch{return e}})();return(0,Z.useEffect)(()=>{let e=e=>{if(e.origin!==`https://embed.reddit.com`||!n.current||e.source!==n.current.contentWindow)return;let t=e.data;typeof t!=`object`||!t||t.type===`resize.embed`&&typeof t.data==`number`&&t.data>0&&(n.current.style.height=`${t.data}px`,n.current.style.minHeight=`0`)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[]),(0,Q.jsx)(`div`,{className:z(`rounded-2xl border border-border overflow-hidden`,t),children:(0,Q.jsx)(`iframe`,{ref:n,src:r,title:`Reddit post`,className:`w-full border-0`,style:{minHeight:320},allowFullScreen:!0,loading:`lazy`,sandbox:`allow-scripts allow-same-origin allow-popups allow-forms`})})}var vo={track:152,episode:152,album:352,playlist:352,show:352};function yo({type:e,id:t,className:n}){let r=vo[e]??352,i=`https://open.spotify.com/embed/${e}/${t}?utm_source=generator&theme=0`;return(0,Q.jsx)(`div`,{className:z(`overflow-hidden rounded-2xl`,n),children:(0,Q.jsx)(`iframe`,{src:i,title:`Spotify`,className:`w-full border-0 rounded-2xl`,height:r,allowFullScreen:!0,loading:`lazy`,allow:`autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture`,sandbox:`allow-scripts allow-same-origin allow-popups allow-forms`})})}function bo({tweetId:e,className:t}){vt();let n=(0,Z.useRef)(null),r=yt(),i=new URLSearchParams({id:e,dnt:`true`,theme:r});return(0,Z.useEffect)(()=>{let e=e=>{if(e.origin!==`https://platform.twitter.com`||!n.current||e.source!==n.current.contentWindow)return;let t=e.data?.[`twttr.embed`];if(!(!t||typeof t!=`object`)&&t.method===`twttr.private.resize`){let e=t.params?.[0]?.height;typeof e==`number`&&e>0&&(n.current.style.height=`${e}px`)}};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[]),(0,Q.jsx)(`div`,{className:z(`overflow-hidden`,t),children:(0,Q.jsx)(`iframe`,{ref:n,src:`https://platform.twitter.com/embed/Tweet.html?${i}`,title:`Tweet`,className:`w-full border-0`,style:{minHeight:250},scrolling:`no`,allowFullScreen:!0,loading:`lazy`,sandbox:`allow-scripts allow-same-origin allow-popups`})})}var xo=[`sddefault`,`hqdefault`];function So(e,t){return`https://i.ytimg.com/vi/${e}/${t}.jpg`}function Co(e){return new Promise(t=>{let n=!1;function r(i){if(i>=xo.length){n||(n=!0,t(null));return}let a=new Image;a.onload=()=>{n||(a.naturalWidth<=120&&a.naturalHeight<=90?r(i+1):(n=!0,t(So(e,xo[i]))))},a.onerror=()=>{n||r(i+1)},a.src=So(e,xo[i])}r(0)})}function wo({videoId:e,className:t}){let[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(null);return(0,Z.useEffect)(()=>{let t=!1;return a(null),Co(e).then(e=>{t||a(e)}),()=>{t=!0}},[e]),(0,Q.jsx)(`div`,{className:z(`rounded-2xl overflow-hidden border border-border`,t),onClick:e=>e.stopPropagation(),children:(0,Q.jsx)(`div`,{className:`relative w-full`,style:{paddingBottom:`56.25%`},children:n?(0,Q.jsx)(`iframe`,{src:`https://www.youtube-nocookie.com/embed/${e}?autoplay=1`,title:`YouTube video`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share`,allowFullScreen:!0,className:`absolute inset-0 w-full h-full`}):(0,Q.jsxs)(`button`,{type:`button`,className:`absolute inset-0 w-full h-full cursor-pointer bg-black group`,onClick:()=>r(!0),"aria-label":`Play video`,children:[i&&(0,Q.jsx)(`img`,{src:i,alt:``,className:`absolute inset-0 w-full h-full object-cover`,decoding:`async`}),(0,Q.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,Q.jsx)(`div`,{className:z(`flex items-center justify-center`,`w-[68px] h-[48px] rounded-xl`,`bg-[#212121]/80 group-hover:bg-[#ff0000] transition-colors duration-200`),children:(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,className:`w-6 h-6 text-white ml-0.5`,children:(0,Q.jsx)(`path`,{d:`M8 5v14l11-7z`})})})})]})})})}var To=new Set(`23.illuminati.org,4bear.com,ailbhean.co-shaoghal.net,ani.work,apobangpo.space,archaeo.social,arvr.social,augsburg.social,aus.social,babka.social,bahn.social,balkan.fedive.rs,bark.lgbt,biplus.social,birdon.social,blorbo.social,bologna.one,bonn.social,bookstodon.com,burma.social,burningboard.net,bvb.social,bzh.social,c.im,camp.smolnet.org,ceilidh.online,ciberlandia.pt,climatejustice.social,colorid.es,computerfairi.es,corteximplant.com,cultur.social,cupoftea.social,cville.online,cwb.social,cyberplace.social,dariox.club,darmstadt.social,darticulate.com,datasci.social,defcon.social,det.social,devianze.city,disabled.social,discuss.systems,dizl.de,dmv.community,donphan.social,dresden.network,drumstodon.net,drupal.community,elekk.xyz,elizur.me,epicure.social,episcodon.net,epsilon.social,esq.social,est.social,eupolicy.social,expressional.social,fairmove.net,fairy.id,famichiki.jp,fandom.ink,fedi.at,feuerwehr.social,fikaverse.club,flipboard.social,fpl.social,freeradical.zone,freiburg.social,fribygda.no,friendsofdesoto.social,frikiverse.zone,frontrange.co,fulda.social,furries.club,furry.engineer,gamepad.club,gardenstate.social,gaygeek.social,genealysis.social,glasgow.social,graphics.social,growers.social,h-net.social,h4.io,hachyderm.io,hcommons.social,hear-me.social,hessen.social,hispagatos.space,hometech.social,hoosier.social,hostux.social,ieji.de,indieauthors.social,indieweb.social,infosec.exchange,ioc.exchange,is.nota.live,k8s.social,kanoa.de,kcmo.social,khiar.net,kjas.no,kolektiva.social,kurry.social,kzoo.to,learningdisability.social,leipzig.town,lewacki.space,lgbtqia.space,library.love,libretooth.gr,livellosegreto.it,lou.lt,lounge.town,lsbt.me,ludosphere.fr,m.cmx.im,m.otter.homes,machteburch.social,mapstodon.space,mast.dragon-fly.club,mast.hpc.social,mast.lat,masto.es,masto.nobigtech.es,masto.nu,masto.nyc,masto.pt,masto.yttrx.com,mastoart.social,mastodon-belgium.be,mastodon-swiss.org,mastodon.africa,mastodon.au,mastodon.babb.no,mastodon.bachgau.social,mastodon.bahia.no,mastodon.berlin,mastodon.bida.im,mastodon.bot,mastodon.cipherbliss.com,mastodon.com.pl,mastodon.cr,mastodon.education,mastodon.ee,mastodon.energy,mastodon.escepticos.es,mastodon.eus,mastodon.free-solutions.org,mastodon.frl,mastodon.gal,mastodon.gamedev.place,mastodon.green,mastodon.hosnet.fr,mastodon.ie,mastodon.iow.social,mastodon.london,mastodon.me.uk,mastodon.mg,mastodon.ml,mastodon.nl,mastodon.nu,mastodon.ph,mastodon.pirateparty.be,mastodon.pnpde.social,mastodon.scot,mastodon.sdf.org,mastodon.sg,mastodon.social,mastodon.uno,mastodon.uy,mastodon.vlaanderen,mastodon.wien,mastodon.world,mastodonapp.uk,mastodont.cat,mastodontech.de,mastodontti.fi,mastorol.es,mastoturk.org,mastouille.fr,mathstodon.xyz,mcr.wtf,metalhead.club,mikumikudance.cloud,mindly.social,mograph.social,mountains.social,ms.maritime.social,mstdn.animexx.de,mstdn.business,mstdn.ca,mstdn.dk,mstdn.games,mstdn.jp,mstdn.party,mstdn.plus,mstdn.social,muenchen.social,muenster.im,muri.network,musician.social,musicians.today,musicworld.social,mustard.blog,nautical.social,nfld.me,noc.social,nomanssky.social,norcal.social,norden.social,nrw.social,nutmeg.social,nwb.social,occm.cc,ohai.social,okla.social,opalstack.social,opencoaster.net,oslo.town,paktodon.asia,pawb.fun,peoplemaking.games,phpc.social,piaille.fr,planetearth.social,pnw.zone,polsci.social,pouet.chapril.org,poweredbygay.social,privacysafe.social,puntarella.party,qaf.men,qdon.space,rail.chat,raphus.social,retro.pizza,rheinhessen.social,rheinneckar.social,rivals.space,rollenspiel.social,ruby.social,ruhr.social,ruhrpott.social,sakurajima.moe,sciences.social,seocommunity.social,sfba.social,shelter.moe,silversword.online,skastodon.com,snabelen.no,socel.net,social.anoxinon.de,social.cologne,social.diva.exchange,social.ferrocarril.net,social.linux.pizza,social.politicaconciencia.org,social.seattle.wa.us,social.silicon.moe,social.sndevs.com,social.tchncs.de,social.vivaldi.net,squawk.mytransponder.com,stereodon.social,stranger.social,sueden.social,sunny.garden,synapse.cafe,tchafia.be,tea.codes,tech.lgbt,techhub.social,techtoots.com,theatl.social,theblower.au,thecanadian.social,tilde.zone,tkz.one,toad.social,tooot.im,toot.aquilenet.fr,toot.community,toot.funami.tech,toot.garden,toot.kif.rocks,toot.re,toot.si,toot.wales,tooting.ch,toots.nu,troet.cafe,troet.fediverse.at,tuiter.rocks,tyrol.social,union.place,universeodon.com,urbanists.social,uri.life,ursal.zone,urusai.social,veganism.social,vkl.world,vmst.io,voi.social,wargamers.social,wehavecookies.social,wien.rocks,witter.cz,woof.tech,wxw.moe,xarxa.cloud`.split(`,`));function Eo(e){try{let t=new URL(e);if((t.hostname===`www.youtube.com`||t.hostname===`youtube.com`||t.hostname===`m.youtube.com`)&&t.pathname===`/watch`)return t.searchParams.get(`v`);if((t.hostname===`www.youtube.com`||t.hostname===`youtube.com`)&&t.pathname.startsWith(`/embed/`)||(t.hostname===`www.youtube.com`||t.hostname===`youtube.com`)&&t.pathname.startsWith(`/shorts/`))return t.pathname.split(`/`)[2]||null;if(t.hostname===`youtu.be`)return t.pathname.slice(1)||null}catch{}return null}function Do(e){try{let t=new URL(e),n=t.hostname.replace(/^www\./,``).replace(/^mobile\./,``);if(n!==`twitter.com`&&n!==`x.com`)return null;let r=t.pathname.match(/^\/[^/]+\/status\/(\d+)/);return r?r[1]:null}catch{return null}}function Oo(e){try{let t=new URL(e);if(t.hostname.replace(/^www\./,``)!==`bsky.app`)return null;let n=t.pathname.match(/^\/profile\/([^/]+)\/post\/([a-z0-9]+)$/i);return n?{author:n[1],rkey:n[2]}:null}catch{return null}}function ko(e){try{let t=new URL(e),n=t.hostname.replace(/^www\./,``);return To.has(n)&&/^\/@[^/]+\/\d+$/.test(t.pathname)?e:null}catch{return null}}function Ao(e){try{let t=new URL(e);if(t.hostname.replace(/^www\./,``)!==`open.spotify.com`)return null;let n=t.pathname.match(/^\/(track|album|playlist|episode|show)\/([a-zA-Z0-9]+)/);return n?{type:n[1],id:n[2]}:null}catch{return null}}function jo(e){try{let t=new URL(e);return t.hostname.replace(/^www\./,``).replace(/^old\./,``).replace(/^new\./,``)===`reddit.com`&&/^\/r\/[^/]+\/comments\/[a-z0-9]+/i.test(t.pathname)?e:null}catch{return null}}function Mo(e){try{let t=new URL(e);if(t.hostname.replace(/^www\./,``)!==`archive.org`)return null;let n=t.pathname.match(/^\/(details|embed)\/([^/?#]+)/);return n?n[2]:null}catch{return null}}function No(e){try{let t=new URL(e);if(t.hostname.replace(/^www\./,``)!==`wikidata.org`)return null;let n=t.pathname.match(/^\/(?:entity|wiki)\/([QPL]\d+)$/);return n?n[1]:null}catch{return null}}function Po(e){try{let t=new URL(e);if(!t.hostname.replace(/^www\./,``).endsWith(`.wikipedia.org`))return null;let n=t.pathname.match(/^\/wiki\/([^:][^#]*)$/);return n?decodeURIComponent(n[1].replace(/_/g,` `)):null}catch{return null}}function Fo(e){try{let t=new URL(e);if(t.hostname.replace(/^www\./,``)!==`gatherer.wizards.com`)return null;if(/\/Pages\/Card\/[^/]+\.aspx$/i.test(t.pathname)){let e=t.searchParams.get(`multiverseid`);return e&&/^\d+$/.test(e)?{kind:`multiverse`,multiverseId:e}:null}let n=t.pathname.match(/^\/([A-Za-z0-9]{2,6})\/([a-z]{2}(?:-[a-z]{2})?)\/([^/]+)(?:\/[^/]*)?$/);if(n){let[,e,t,r]=n;return{kind:`set`,set:e,number:decodeURIComponent(r),lang:t}}return null}catch{return null}}function Io(e){return Eo(e)?`YouTube`:Do(e)?`Twitter`:Oo(e)?`Bluesky`:ko(e)?`Mastodon`:Ao(e)?`Spotify`:jo(e)?`Reddit`:Mo(e)?`Internet Archive`:Fo(e)?`Gatherer`:null}function Lo({url:e,className:t,navigateToComments:n,showActions:r=!0,hideImage:i}){let a=(0,Z.useMemo)(()=>Eo(e),[e]),o=(0,Z.useMemo)(()=>Do(e),[e]),s=(0,Z.useMemo)(()=>Oo(e),[e]),c=(0,Z.useMemo)(()=>ko(e),[e]),l=(0,Z.useMemo)(()=>Ao(e),[e]),u=(0,Z.useMemo)(()=>jo(e),[e]),d=(0,Z.useMemo)(()=>Mo(e),[e]),f;if(a)f=(0,Q.jsx)(wo,{videoId:a});else if(o)f=(0,Q.jsx)(bo,{tweetId:o});else if(s)return(0,Q.jsx)(co,{author:s.author,rkey:s.rkey,hideImage:i,className:t});else if(c)return(0,Q.jsx)(go,{url:c,className:t});else if(l)f=(0,Q.jsx)(yo,{type:l.type,id:l.id});else if(u)f=(0,Q.jsx)(_o,{url:u});else if(d)f=(0,Q.jsx)(no,{identifier:d});else return(0,Q.jsx)(uo,{url:e,className:t,hideImage:i,navigateToComments:n,showActions:r});return(0,Q.jsxs)(`div`,{className:z(`space-y-0`,t),children:[f,(0,Q.jsx)(Ro,{url:e,showActions:r})]})}function Ro({url:e,showActions:t=!0}){let n=K(),{data:r}=Fn(e),i=(0,Z.useMemo)(()=>{try{return new URL(e).hostname.replace(/^www\./,``)}catch{return e}},[e]),a=r?.provider_name||i;return(0,Q.jsxs)(`div`,{className:`px-3.5 py-2.5 space-y-0.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)($t,{url:e,size:14,className:`shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:a}),(0,Q.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:z(`ml-auto flex items-center gap-1 px-2 py-0.5 rounded-full`,`text-xs text-muted-foreground`,`hover:bg-primary/10 hover:text-primary transition-colors`),onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(de,{className:`size-3`}),(0,Q.jsx)(`span`,{children:`Open`})]}),t&&(0,Q.jsxs)(`button`,{type:`button`,className:z(`flex items-center gap-1 px-2 py-0.5 rounded-full`,`text-xs text-muted-foreground`,`hover:bg-primary/10 hover:text-primary transition-colors`),onClick:t=>{t.preventDefault(),t.stopPropagation(),n(`/i/${encodeURIComponent(e)}`)},children:[(0,Q.jsx)(v,{className:`size-3`}),(0,Q.jsx)(`span`,{children:`Discuss`})]})]}),r?.title&&(0,Q.jsx)(`p`,{className:`text-sm font-semibold leading-snug line-clamp-2`,children:r.title}),r?.author_name&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed line-clamp-2`,children:r.author_name})]})}var zo=3,Bo=15,Vo=20,Ho=80;function Uo(e){if(typeof document>`u`)return null;let t=getComputedStyle(document.documentElement).getPropertyValue(e).trim();if(!t)return null;let{h:n,s:r,l:i}=pt(t);return[n,r,i].some(isNaN)?null:{h:n,s:r,l:i}}function Wo(e,t){let n=e.l,r=_t(e.h,e.s,n),i=gt(r,t);for(;n>0&&i=Bo&&t.l>=Vo&&t.l<=Ho))return e;let r=_t(e.h,e.s,e.l),i=_t(t.h,t.s,t.l),a=gt(r,n);return gt(i,n)>a*1.5?t:e}function qo(){let e=Uo(`--primary`),t=Uo(`--foreground`),n=Uo(`--background`);if(!e)return{dark:`#000000`,light:`#ffffff`};if(!(n&&mt(`${n.h} ${n.s}% ${n.l}%`))){let n=[255,255,255];return{dark:Wo(Ko(e,t,n),n),light:`#ffffff`}}if(!n)return{dark:`#ffffff`,light:`#000000`};let r=_t(n.h,n.s,n.l);return{dark:Go(Ko(e,t,r),r),light:ht(...r)}}var Jo=e(ur(),1);function Yo(e){let t=e.toLowerCase().match(/^ln\w+?(\d+)([munp]?)1/);if(!t)return null;let n=parseInt(t[1],10);if(isNaN(n))return null;switch(t[2]){case`m`:return n*1e5;case`u`:return n*100;case`n`:return n/10;case`p`:return n/1e4;default:return n*1e8}}function Xo(e){return e<1?`<1`:Math.round(e).toLocaleString()}function Zo({invoice:e,className:t}){let{toast:n}=Nt(),[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(!1),d=Yo(e);(0,Z.useEffect)(()=>{let t=!1,{dark:n,light:r}=qo();return Jo.toDataURL(e.toUpperCase(),{width:400,margin:2,color:{dark:n,light:r},errorCorrectionLevel:`M`}).then(e=>{t||c(e)}).catch(()=>{}),()=>{t=!0}},[e]);let f=(0,Z.useCallback)(async t=>{t.stopPropagation();try{await navigator.clipboard.writeText(e),i(!0),n({title:`Copied`,description:`Lightning invoice copied to clipboard`})}catch{n({title:`Failed to copy`,variant:`destructive`})}},[e,n]);(0,Z.useEffect)(()=>{if(!r)return;let e=setTimeout(()=>i(!1),2e3);return()=>clearTimeout(e)},[r]);let p=(0,Z.useCallback)(async t=>{t.stopPropagation();try{await Et(`lightning:${e}`)}catch{n({title:`Could not open wallet`,description:`No lightning wallet app is installed to handle this invoice.`,variant:`destructive`})}},[e,n]),m=(0,Z.useCallback)(async t=>{t.stopPropagation();let r=globalThis.webln;if(r?.sendPayment)try{o(!0),r.enable&&await r.enable(),await r.sendPayment(e),n({title:`Payment sent`})}catch{n({title:`Payment failed`,variant:`destructive`})}finally{o(!1)}},[e,n]),h=(0,Z.useCallback)(e=>{e.stopPropagation(),u(e=>!e)},[]),g=typeof globalThis<`u`&&!!globalThis.webln,_=s?(0,Q.jsx)(`img`,{src:s,alt:`Lightning Invoice QR`,className:`rounded-xl`,style:{imageRendering:`pixelated`},decoding:`async`}):(0,Q.jsx)(`div`,{className:`aspect-square rounded-xl bg-muted animate-pulse`});return(0,Q.jsxs)(`div`,{className:z(`isolate my-2.5 relative rounded-2xl border border-border overflow-hidden @container`,t),onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(`div`,{className:`absolute -z-10 top-0 left-0 w-44 h-44 bg-primary/[0.06] rounded-full blur-2xl`}),l?(0,Q.jsx)(`button`,{onClick:h,className:`w-full aspect-square cursor-pointer p-5`,children:s?(0,Q.jsx)(`img`,{src:s,alt:`Lightning Invoice QR`,className:`w-full h-full rounded-xl`,style:{imageRendering:`pixelated`},decoding:`async`}):(0,Q.jsx)(`div`,{className:`w-full h-full rounded-xl bg-muted animate-pulse`})}):(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Q.jsx)(`button`,{onClick:h,className:`shrink-0 p-3 cursor-pointer`,children:(0,Q.jsx)(`div`,{className:`size-28 sm:size-40`,children:_})}),(0,Q.jsxs)(`div`,{className:`flex flex-col justify-between py-3.5 pr-3.5 min-w-0 flex-1 gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground font-medium whitespace-nowrap`,style:{fontSize:`clamp(0.8rem, 3.5cqw, 1.05rem)`},children:[(0,Q.jsx)(`span`,{className:`flex items-center justify-center size-5 sm:size-6 rounded-full bg-primary/15 shrink-0`,children:(0,Q.jsx)(ge,{className:`size-3 sm:size-3.5 text-primary fill-primary`})}),`Lightning Invoice`]}),d!==null&&(0,Q.jsxs)(`div`,{className:`font-bold tracking-tight leading-none mt-1 whitespace-nowrap`,style:{fontSize:`clamp(1.5rem, 8cqw, 2.5rem)`},children:[Xo(d),(0,Q.jsx)(`span`,{className:`font-normal text-muted-foreground ml-1`,style:{fontSize:`clamp(0.75rem, 3.5cqw, 1.125rem)`},children:`sats`})]})]}),(0,Q.jsxs)(`button`,{onClick:f,className:`flex items-center gap-1.5 group max-w-full`,children:[(0,Q.jsx)(`span`,{className:`truncate text-xs font-mono text-muted-foreground group-hover:text-foreground transition-colors`,children:e}),r?(0,Q.jsx)(he,{className:`size-3.5 text-primary shrink-0`}):(0,Q.jsx)(M,{className:`size-3.5 text-muted-foreground group-hover:text-foreground shrink-0 transition-colors`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[g&&(0,Q.jsxs)(B,{size:`sm`,onClick:m,disabled:a,className:`gap-1.5 h-9 rounded-xl`,children:[(0,Q.jsx)(ge,{className:`size-3.5`}),a?`Paying...`:`Pay`]}),(0,Q.jsxs)(B,{size:`sm`,variant:`outline`,onClick:p,className:`gap-1.5 h-9 rounded-xl`,children:[(0,Q.jsx)(de,{className:`size-3.5`}),`Open in Wallet`]})]})]})]})]})}var Qo=Object.defineProperty,$o=Object.defineProperties,es=Object.getOwnPropertyDescriptors,ts=Object.getOwnPropertySymbols,ns=Object.prototype.hasOwnProperty,rs=Object.prototype.propertyIsEnumerable,is=(e,t,n)=>t in e?Qo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,as=(e,t)=>{for(var n in t||={})ns.call(t,n)&&is(e,n,t[n]);if(ts)for(var n of ts(t))rs.call(t,n)&&is(e,n,t[n]);return e},os=(e,t)=>$o(e,es(t)),ss=(e,t)=>{var n={};for(var r in e)ns.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ts)for(var r of ts(e))t.indexOf(r)<0&&rs.call(e,r)&&(n[r]=e[r]);return n},cs=class extends Z.PureComponent{constructor(){super(...arguments),this.canvas=null,this.handleRef=e=>{this.canvas=e,this.draw()},this.draw=()=>{let{hash:e,height:t,punch:n,width:r}=this.props;if(this.canvas){let i=gn(e,r,t,n),a=this.canvas.getContext(`2d`),o=a.createImageData(r,t);o.data.set(i),a.putImageData(o,0,0)}}}componentDidUpdate(){this.draw()}render(){let e=this.props,{hash:t,height:n,width:r}=e,i=ss(e,[`hash`,`height`,`width`]);return Z.createElement(`canvas`,os(as({},i),{height:n,width:r,ref:this.handleRef}))}};cs.defaultProps={height:128,width:128};var ls={position:`absolute`,top:0,bottom:0,left:0,right:0,width:`100%`,height:`100%`},us=class extends Z.PureComponent{componentDidUpdate(){if(this.props.resolutionX<=0)throw Error(`resolutionX must be larger than zero`);if(this.props.resolutionY<=0)throw Error(`resolutionY must be larger than zero`)}render(){let e=this.props,{hash:t,height:n,width:r,punch:i,resolutionX:a,resolutionY:o,style:s}=e,c=ss(e,[`hash`,`height`,`width`,`punch`,`resolutionX`,`resolutionY`,`style`]);return Z.createElement(`div`,os(as({},c),{style:os(as({display:`inline-block`,height:n,width:r},s),{position:`relative`})}),Z.createElement(cs,{hash:t,height:o,width:a,punch:i,style:ls}))}};us.defaultProps={height:128,width:128,resolutionX:32,resolutionY:32};function ds(e){return e?un(e).result:!1}function fs({mediaRef:e,containerRef:t,isPlaying:n}){let[r,i]=(0,Z.useState)(!0),a=(0,Z.useRef)(void 0),o=(0,Z.useCallback)(()=>{a.current&&clearTimeout(a.current),n&&(a.current=setTimeout(()=>i(!1),2500))},[n]),s=(0,Z.useCallback)(()=>{i(!0),o()},[o]);(0,Z.useEffect)(()=>(n?o():(i(!0),a.current&&clearTimeout(a.current)),()=>{a.current&&clearTimeout(a.current)}),[n,o]),(0,Z.useEffect)(()=>{let n=e.current,r=t.current;if(!n||!r)return;let i=new IntersectionObserver(([e])=>{!e.isIntersecting&&!n.paused&&n.pause()},{threshold:.25});return i.observe(r),()=>i.disconnect()},[e,t]);let[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(1),f=(0,Z.useRef)(1);return(0,Z.useEffect)(()=>{let t=e.current;if(!t)return;let n=()=>{l(t.muted),d(t.muted?0:t.volume)};return n(),t.addEventListener(`volumechange`,n),()=>t.removeEventListener(`volumechange`,n)},[e]),{showControls:r,revealControls:s,scheduleHide:o,isMuted:c,volume:u,toggleMute:(0,Z.useCallback)(t=>{t.stopPropagation();let n=e.current;if(n)if(n.muted||n.volume===0){let e=f.current>0?f.current:.5;n.muted=!1,n.volume=e,l(!1),d(e)}else f.current=n.volume,n.muted=!0,l(!0)},[e]),handleVolumeChange:(0,Z.useCallback)(t=>{t.stopPropagation();let n=e.current;if(!n)return;let r=parseFloat(t.target.value);n.volume=r,n.muted=r===0,r>0&&(f.current=r),d(r),l(r===0)},[e])}}function ps(e,t){let[n,r]=(0,Z.useState)(t);return(0,Z.useEffect)(()=>{if(t||!e)return;let n=!1;function i(e){let t=document.createElement(`video`);t.crossOrigin=`anonymous`,t.muted=!0,t.playsInline=!0,t.preload=`metadata`,t.src=e;function i(){if(!n){try{let e=document.createElement(`canvas`);e.width=t.videoWidth||320,e.height=t.videoHeight||180;let n=e.getContext(`2d`);if(n){n.drawImage(t,0,0,e.width,e.height);let i=e.toDataURL(`image/jpeg`,.7);i.length>1e3&&r(i)}}catch{}t.src=``,t.load()}}let a=()=>{t.currentTime=.1},o=()=>i();return t.addEventListener(`loadedmetadata`,a,{once:!0}),t.addEventListener(`seeked`,o,{once:!0}),()=>{t.removeEventListener(`loadedmetadata`,a),t.removeEventListener(`seeked`,o),t.src=``,t.load()}}if(/\.m3u8(\?|$)/i.test(e)){let t=document.createElement(`video`);if(t.crossOrigin=`anonymous`,t.muted=!0,t.playsInline=!0,t.canPlayType(`application/vnd.apple.mpegurl`)){let i=()=>{n||t.play().then(()=>{t.pause();try{let e=document.createElement(`canvas`);e.width=t.videoWidth||320,e.height=t.videoHeight||180;let n=e.getContext(`2d`);if(n){n.drawImage(t,0,0,e.width,e.height);let i=e.toDataURL(`image/jpeg`,.7);i.length>1e3&&r(i)}}catch{}t.src=``}).catch(()=>{})};return t.src=e,t.addEventListener(`loadeddata`,i,{once:!0}),()=>{n=!0,t.removeEventListener(`loadeddata`,i),t.src=``}}let i=null;return Me(async()=>{let{default:e}=await import(`./hls-DRk412my.js`);return{default:e}},[]).then(({default:a})=>{if(n||!a.isSupported())return;let o=()=>{n||t.play().then(()=>{t.pause();try{let e=document.createElement(`canvas`);e.width=t.videoWidth||320,e.height=t.videoHeight||180;let n=e.getContext(`2d`);if(n){n.drawImage(t,0,0,e.width,e.height);let i=e.toDataURL(`image/jpeg`,.7);i.length>1e3&&r(i)}}catch{}i?.destroy(),i=null,t.src=``}).catch(()=>{i?.destroy(),i=null})},s=new a({startLevel:-1,maxBufferLength:5});i=s,s.loadSource(e),s.attachMedia(t),s.on(a.Events.MANIFEST_PARSED,()=>{if(n){s.destroy();return}o()})}),()=>{n=!0,i?.destroy(),i=null,t.src=``}}let a=i(e);return()=>{n=!0,a()}},[e,t]),n}var ms=`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`;function hs(e){if(!e)return;let[t,n]=e.split(`x`).map(Number);if(!(!t||!n||isNaN(t)||isNaN(n)))return{width:t,height:n}}function gs(e,t){let n=(0,Z.useRef)(null),r=/\.m3u8(\?|$)/i.test(t),i=(0,Z.useCallback)(()=>{let i=e.current;if(!(!i||!r)){if(i.canPlayType(`application/vnd.apple.mpegurl`)){i.src=t;return}Me(async()=>{let{default:e}=await import(`./hls-DRk412my.js`);return{default:e}},[]).then(({default:r})=>{if(e.current!==i||!r.isSupported())return;let a=new r({startLevel:-1,autoStartLoad:!0});n.current=a,a.loadSource(t),a.attachMedia(i)})}},[e,t,r]);return(0,Z.useEffect)(()=>(i(),()=>{n.current?.destroy(),n.current=null}),[i]),{isHls:r}}function _s({src:e,poster:t,className:n,dim:r,blurhash:i,title:a,artist:o,autoPlay:s,encryption:l}){let u=(0,Z.useRef)(null),d=(0,Z.useRef)(null),f=(0,Z.useRef)(null),p=hr(e),m=pr(e,l),h=pr(t??``,t&&l?wt(l):void 0),g=m.encrypted?m.src??``:p.src,_=t?h.src:void 0,v=m.encrypted?()=>{}:p.onError,{isHls:y}=gs(u,g),{config:b}=ft(),x=s??b.autoplayVideos,S=ps(g,_),[C,w]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(0),[O,ee]=(0,Z.useState)(0),[k,A]=(0,Z.useState)(!1),[j,M]=(0,Z.useState)(!1),[te,ne]=(0,Z.useState)(!1),[re,N]=(0,Z.useState)(void 0),P=hs(r),oe=P?`${P.width} / ${P.height}`:re??`16 / 9`,se=O>0?T/O*100:0,{showControls:ce,revealControls:le,scheduleHide:de,isMuted:fe,volume:pe,toggleMute:me,handleVolumeChange:he}=fs({mediaRef:u,containerRef:f,isPlaying:C}),ge=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{if(!x)return;ge.current=!1;let e=u.current;if(!e)return;let t=()=>{ge.current||(ge.current=!0,e.muted=!0,e.play().catch(()=>{}))};if(e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA)t();else return e.addEventListener(`loadeddata`,t,{once:!0}),()=>e.removeEventListener(`loadeddata`,t)},[x]),(0,Z.useEffect)(()=>{if(!(`mediaSession`in navigator)||!k)return;let e=u.current;if(!e)return;let t=S||_?[{src:S||_,sizes:`512x512`,type:`image/jpeg`}]:[];return navigator.mediaSession.metadata=new MediaMetadata({title:a||`Video`,artist:o||``,artwork:t}),navigator.mediaSession.setActionHandler(`play`,()=>e.play().catch(()=>{})),navigator.mediaSession.setActionHandler(`pause`,()=>e.pause()),navigator.mediaSession.setActionHandler(`seekto`,t=>{t.seekTime!=null&&(e.currentTime=t.seekTime)}),navigator.mediaSession.setActionHandler(`previoustrack`,null),navigator.mediaSession.setActionHandler(`nexttrack`,null),()=>{`mediaSession`in navigator&&(navigator.mediaSession.metadata=null,navigator.mediaSession.setActionHandler(`play`,null),navigator.mediaSession.setActionHandler(`pause`,null),navigator.mediaSession.setActionHandler(`seekto`,null))}},[k,a,o,_,S]),(0,Z.useEffect)(()=>{!(`mediaSession`in navigator)||!k||(navigator.mediaSession.playbackState=C?`playing`:`paused`)},[C,k]),(0,Z.useEffect)(()=>{if(!(!(`mediaSession`in navigator)||!k||O<=0))try{navigator.mediaSession.setPositionState({duration:O,playbackRate:u.current?.playbackRate??1,position:Math.min(T,O)})}catch{}},[T,O,k]);let _e=e=>{e.stopPropagation();let t=u.current;t&&(t.paused?t.play():t.pause())},ve=e=>{e.stopPropagation();let t=u.current;t&&t.requestFullscreen&&t.requestFullscreen()},ye=e=>{e.stopPropagation();let t=u.current,n=d.current;if(!t||!n||!O)return;let r=n.getBoundingClientRect();t.currentTime=Math.max(0,Math.min(1,(e.clientX-r.left)/r.width))*O},be=e=>{if(e.stopPropagation(),!k){let e=u.current;e&&e.play();return}_e(e),le()},Se=m.encrypted&&!m.src;return(0,Q.jsxs)(`div`,{ref:f,className:z(`relative mt-3 rounded-2xl overflow-hidden border border-border bg-black group`,n),style:{aspectRatio:oe},onMouseMove:le,onMouseLeave:()=>{C&&de()},onClick:e=>e.stopPropagation(),children:[ds(i)&&!k&&!(S&&te)&&(0,Q.jsx)(us,{hash:i,width:`100%`,height:`100%`,resolutionX:32,resolutionY:32,punch:1,style:{position:`absolute`,inset:0}}),(0,Q.jsx)(`video`,{ref:u,src:y||!g?void 0:g,"data-no-native-poster":``,poster:ms,className:z(`w-full cursor-pointer`,`absolute inset-0 h-full object-cover`,`fullscreen:object-contain fullscreen:static fullscreen:max-h-none fullscreen:h-full fullscreen:w-full`,`transition-opacity duration-150`,k||j&&!S?`opacity-100`:`opacity-0`),playsInline:!0,preload:`metadata`,"webkit-playsinline":`true`,"x-webkit-airplay":`allow`,onClick:be,onPlay:()=>{w(!0),A(!0)},onPause:()=>w(!1),onTimeUpdate:()=>E(u.current?.currentTime??0),onLoadedMetadata:()=>{let e=u.current;e&&(ee(e.duration??0),!P&&e.videoWidth>0&&e.videoHeight>0&&N(t=>t??`${e.videoWidth} / ${e.videoHeight}`))},onDurationChange:()=>ee(u.current?.duration??0),onLoadedData:()=>M(!0),onError:v}),Se&&(0,Q.jsx)(dr,{fill:!0,className:`bg-background`,loading:m.loading,unsupported:m.unsupported,tooLarge:m.tooLarge,byteSize:m.byteSize,onDecryptAnyway:m.decryptAnyway}),S&&!k&&(0,Q.jsx)(`img`,{src:S,alt:``,"aria-hidden":!0,className:z(`absolute inset-0 w-full h-full object-cover pointer-events-none transition-opacity duration-150`,te?`opacity-100`:`opacity-0`),onLoad:e=>{ne(!0);let t=e.currentTarget;!P&&t.naturalWidth>0&&t.naturalHeight>0&&N(e=>e??`${t.naturalWidth} / ${t.naturalHeight}`)},decoding:`async`}),!k&&(j||te)&&(0,Q.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/30 cursor-pointer`,onClick:be,children:(0,Q.jsx)(`div`,{className:`size-16 rounded-full bg-black/60 flex items-center justify-center backdrop-blur-sm`,children:(0,Q.jsx)(ue,{className:`size-8 text-white ml-1`,fill:`white`})})}),k&&(0,Q.jsxs)(`div`,{className:z(`absolute bottom-0 left-0 right-0 transition-opacity duration-200`,`bg-gradient-to-t from-black/80 via-black/40 to-transparent pt-8 pb-2 px-3`,ce?`opacity-100`:`opacity-0 pointer-events-none`),children:[(0,Q.jsx)(`div`,{ref:d,className:`w-full h-1 bg-white/30 rounded-full cursor-pointer mb-2 group/progress`,onClick:ye,children:(0,Q.jsx)(`div`,{className:`h-full bg-primary rounded-full relative`,style:{width:`${se}%`},children:(0,Q.jsx)(`div`,{className:`absolute right-0 top-1/2 -translate-y-1/2 size-3 bg-primary rounded-full opacity-0 group-hover/progress:opacity-100 transition-opacity`})})}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(`button`,{onClick:_e,className:`text-white hover:text-white/80 transition-colors`,"aria-label":C?`Pause`:`Play`,children:C?(0,Q.jsx)(c,{className:`size-5`,fill:`white`}):(0,Q.jsx)(ue,{className:`size-5 ml-0.5`,fill:`white`})}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 group/vol`,children:[(0,Q.jsx)(`button`,{onClick:me,className:`text-white hover:text-white/80 transition-colors shrink-0`,"aria-label":fe?`Unmute`:`Mute`,children:fe||pe===0?(0,Q.jsx)(ae,{className:`size-5`}):pe<.5?(0,Q.jsx)(D,{className:`size-5`}):(0,Q.jsx)(ie,{className:`size-5`})}),(0,Q.jsx)(`input`,{type:`range`,min:0,max:1,step:.02,value:fe?0:pe,onChange:he,onClick:e=>e.stopPropagation(),"aria-label":`Volume`,className:z(`w-0 opacity-0 group-hover/vol:w-16 group-hover/vol:opacity-100 group-focus-within/vol:w-16 group-focus-within/vol:opacity-100`,`transition-all duration-200 cursor-pointer accent-white h-1`)})]}),(0,Q.jsxs)(`span`,{className:`text-white text-xs tabular-nums min-w-0`,children:[gr(T),` / `,gr(O)]}),(0,Q.jsx)(`div`,{className:`flex-1`}),(0,Q.jsx)(`button`,{onClick:ve,className:`text-white hover:text-white/80 transition-colors`,"aria-label":`Fullscreen`,children:(0,Q.jsx)(xe,{className:`size-[18px]`})})]})]})]})}function vs({src:e,mime:t,encryption:n,avatarUrl:r,avatarFallback:i=`?`,avatarShape:a,className:o}){let s=pr(e,n),l=s.src??``,u=s.mime??t,d=(0,Z.useRef)(null),f=(0,Z.useRef)(null),p=(0,Z.useRef)(null),m=(0,Z.useRef)(null),h=(0,Z.useRef)(0),g=(0,Z.useRef)(null),_=(0,Z.useRef)(null),v=(0,Z.useRef)(0),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(0),[C,w]=(0,Z.useState)(0),[T,E]=(0,Z.useState)(!1),O=C>0?x/C*100:0,{showControls:ee,revealControls:k,scheduleHide:A,isMuted:j,volume:M,toggleMute:te,handleVolumeChange:ne}=fs({mediaRef:d,containerRef:m,isPlaying:y}),re=s.encrypted&&!s.src,N=(0,Z.useCallback)(()=>{let e=f.current;if(!e){h.current=requestAnimationFrame(N);return}let t=e.getContext(`2d`);if(!t)return;let n=e.clientWidth,r=e.clientHeight,i=window.devicePixelRatio||1;(e.width!==Math.round(n*i)||e.height!==Math.round(r*i))&&(e.width=Math.round(n*i),e.height=Math.round(r*i)),t.save(),t.scale(i,i),t.clearRect(0,0,n,r);let a=getComputedStyle(e).getPropertyValue(`--primary`).trim(),o=`hsl(${a})`,s=`hsl(${a} / 0.15)`,c=`hsl(${a} / 0.85)`,l=`hsl(${a} / 0.55)`,u=g.current,d=null;u&&y&&(d=new Uint8Array(u.frequencyBinCount),u.getByteTimeDomainData(d));let p=n/2,m=r/2,_=t.createLinearGradient(0,0,n,0);if(_.addColorStop(0,s),_.addColorStop(.35,c),_.addColorStop(.5,o),_.addColorStop(.65,c),_.addColorStop(1,s),t.beginPath(),t.strokeStyle=_,t.lineWidth=2.5,t.shadowBlur=10,t.shadowColor=l,d){let e=n/d.length;for(let n=0;n(cancelAnimationFrame(h.current),h.current=requestAnimationFrame(N),()=>cancelAnimationFrame(h.current)),[N]);let P=(0,Z.useCallback)(()=>{let e=d.current;if(!e||_.current)return;let t=new AudioContext;_.current=t;let n=t.createAnalyser();n.fftSize=2048,g.current=n,t.createMediaElementSource(e).connect(n),n.connect(t.destination)},[]),oe=(0,Z.useCallback)(e=>{e.stopPropagation();let t=d.current;t&&(P(),_.current?.state===`suspended`&&_.current.resume(),t.paused?t.play():t.pause())},[P]),se=e=>{e.stopPropagation();let t=d.current,n=p.current;if(!t||!n||!C)return;let r=n.getBoundingClientRect();t.currentTime=Math.max(0,Math.min(1,(e.clientX-r.left)/r.width))*C},ce=e=>{if(e.stopPropagation(),!T){let e=d.current;e&&(P(),e.play());return}oe(e),k()};return(0,Z.useEffect)(()=>{let e=d.current;if(!e)return;let t=()=>{b(!0),E(!0)},n=()=>b(!1),r=()=>b(!1),i=()=>S(e.currentTime),a=()=>w(e.duration);return e.addEventListener(`play`,t),e.addEventListener(`pause`,n),e.addEventListener(`ended`,r),e.addEventListener(`timeupdate`,i),e.addEventListener(`durationchange`,a),e.addEventListener(`loadedmetadata`,a),()=>{e.removeEventListener(`play`,t),e.removeEventListener(`pause`,n),e.removeEventListener(`ended`,r),e.removeEventListener(`timeupdate`,i),e.removeEventListener(`durationchange`,a),e.removeEventListener(`loadedmetadata`,a)}},[]),(0,Z.useEffect)(()=>()=>{cancelAnimationFrame(h.current),_.current?.close()},[]),(0,Q.jsxs)(`div`,{ref:m,className:z(`relative mt-3 rounded-2xl overflow-hidden border border-border bg-background group`,o),style:{aspectRatio:`16 / 9`},onMouseMove:k,onMouseLeave:()=>{y&&A()},onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(`audio`,{ref:d,preload:`metadata`,crossOrigin:`anonymous`,className:`hidden`,children:l?u?(0,Q.jsx)(`source`,{src:l,type:u}):(0,Q.jsx)(`source`,{src:l}):null}),re&&(0,Q.jsx)(dr,{fill:!0,loading:s.loading,unsupported:s.unsupported,tooLarge:s.tooLarge,byteSize:s.byteSize,onDecryptAnyway:s.decryptAnyway}),!re&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`canvas`,{ref:f,className:`absolute inset-0 w-full h-full`,onClick:ce,style:{cursor:`pointer`}}),(0,Q.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center pointer-events-none`,children:(0,Q.jsx)(`div`,{className:z(`rounded-full ring-4 transition-all duration-300`,y?`ring-primary/40 shadow-[0_0_28px_8px_hsl(var(--primary)/0.4)]`:`ring-border`),children:(0,Q.jsxs)(G,{className:`size-20 border-2 border-white/20`,shape:a,children:[(0,Q.jsx)(W,{src:r,alt:i}),(0,Q.jsx)(H,{className:`bg-primary/20 text-primary text-2xl font-semibold`,children:i})]})})}),!T&&(0,Q.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/30 cursor-pointer`,onClick:ce,children:(0,Q.jsx)(`div`,{className:`size-16 rounded-full bg-black/60 flex items-center justify-center backdrop-blur-sm`,children:(0,Q.jsx)(ue,{className:`size-8 text-white ml-1`,fill:`white`})})}),T&&(0,Q.jsxs)(`div`,{className:z(`absolute bottom-0 left-0 right-0 transition-opacity duration-200`,`bg-gradient-to-t from-black/80 via-black/40 to-transparent pt-8 pb-2 px-3`,ee?`opacity-100`:`opacity-0 pointer-events-none`),children:[(0,Q.jsx)(`div`,{ref:p,className:`w-full h-1 bg-white/30 rounded-full cursor-pointer mb-2 group/progress`,onClick:se,children:(0,Q.jsx)(`div`,{className:`h-full bg-primary rounded-full relative`,style:{width:`${O}%`},children:(0,Q.jsx)(`div`,{className:`absolute right-0 top-1/2 -translate-y-1/2 size-3 bg-primary rounded-full opacity-0 group-hover/progress:opacity-100 transition-opacity`})})}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(`button`,{onClick:oe,className:`text-white hover:text-white/80 transition-colors`,"aria-label":y?`Pause`:`Play`,children:y?(0,Q.jsx)(c,{className:`size-5`,fill:`white`}):(0,Q.jsx)(ue,{className:`size-5 ml-0.5`,fill:`white`})}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 group/vol`,children:[(0,Q.jsx)(`button`,{onClick:te,className:`text-white hover:text-white/80 transition-colors shrink-0`,"aria-label":j?`Unmute`:`Mute`,children:j||M===0?(0,Q.jsx)(ae,{className:`size-5`}):M<.5?(0,Q.jsx)(D,{className:`size-5`}):(0,Q.jsx)(ie,{className:`size-5`})}),(0,Q.jsx)(`input`,{type:`range`,min:0,max:1,step:.02,value:j?0:M,onChange:ne,onClick:e=>e.stopPropagation(),"aria-label":`Volume`,className:z(`w-0 opacity-0 group-hover/vol:w-16 group-hover/vol:opacity-100`,`transition-all duration-200 cursor-pointer accent-white h-1`)})]}),(0,Q.jsxs)(`span`,{className:`text-white text-xs tabular-nums min-w-0`,children:[gr(x),` / `,gr(C)]}),(0,Q.jsx)(`div`,{className:`flex-1`})]})]})]})]})}var ys={".html":`text/html`,".htm":`text/html`,".css":`text/css`,".js":`application/javascript`,".mjs":`application/javascript`,".json":`application/json`,".png":`image/png`,".jpg":`image/jpeg`,".jpeg":`image/jpeg`,".gif":`image/gif`,".svg":`image/svg+xml`,".webp":`image/webp`,".ico":`image/x-icon`,".bmp":`image/bmp`,".avif":`image/avif`,".woff":`font/woff`,".woff2":`font/woff2`,".ttf":`font/ttf`,".otf":`font/otf`,".mp3":`audio/mpeg`,".ogg":`audio/ogg`,".wav":`audio/wav`,".opus":`audio/opus`,".weba":`audio/webm`,".mp4":`video/mp4`,".webm":`video/webm`,".xml":`application/xml`,".txt":`text/plain`,".md":`text/markdown`,".wasm":`application/wasm`,".pdf":`application/pdf`,".toml":`application/toml`};function bs(e){let t=e.lastIndexOf(`.`);return t===-1?`application/octet-stream`:ys[e.slice(t).toLowerCase()]??`application/octet-stream`}function xs(e){let t=``;for(let n=0;n=0;e--){let r=n.createElement(`script`);r.src=t[e],n.head.prepend(r)}let r=/^ `+i:i}async function ws(e,t,n,r,i,a){let o=n.find(t=>e===`/${t.path}`||e===t.path);if(o){let e={"Content-Type":`application/javascript`,"Cache-Control":`no-cache`};r&&(e[`Content-Security-Policy`]=r),i({status:200,statusText:`OK`,headers:e,body:Ss(o.content)});return}try{let a=await t(e);if(!a){let e={"Content-Type":`text/plain`};r&&(e[`Content-Security-Policy`]=r),i({status:404,statusText:`Not Found`,headers:e,body:Ss(`Not Found`)});return}let o;o=a.contentType===`text/html`&&n.length>0?Ss(Cs(new TextDecoder().decode(a.body),n.map(e=>`/${e.path}`))):xs(a.body);let s={"Content-Type":a.contentType,"Cache-Control":`no-cache`};r&&(s[`Content-Security-Policy`]=r),a.contentType!==`text/html`&&(s[`Content-Length`]=String(a.body.byteLength)),i({status:a.status,statusText:`OK`,headers:s,body:o})}catch(e){a(-32002,String(e))}}var Ts=`accelerometer.ambient-light-sensor.autoplay.battery.camera.clipboard-write.compute-pressure.display-capture.encrypted-media.fullscreen.gamepad.geolocation.gyroscope.idle-detection.keyboard-map.magnetometer.microphone.midi.picture-in-picture.pointer-lock.screen-wake-lock.speaker-selection.storage-access.web-share.window-management.xr-spatial-tracking`.split(`.`).join(`; `),Es=(0,Z.forwardRef)(function({id:e,resolveFile:t,onRpc:n,injectedScripts:r,csp:i,onReady:a,...o},s){let c=(0,Z.useRef)(null),{config:l}=ft(),u=(0,Z.useMemo)(()=>`https://${e}.${l.sandboxDomain}`,[e,l.sandboxDomain]),d=(0,Z.useRef)(t),f=(0,Z.useRef)(n),p=(0,Z.useRef)(r),m=(0,Z.useRef)(i),h=(0,Z.useRef)(a);(0,Z.useEffect)(()=>{d.current=t},[t]),(0,Z.useEffect)(()=>{f.current=n},[n]),(0,Z.useEffect)(()=>{p.current=r},[r]),(0,Z.useEffect)(()=>{m.current=i},[i]),(0,Z.useEffect)(()=>{h.current=a},[a]);let g=(0,Z.useCallback)((e,t)=>{c.current?.contentWindow?.postMessage(e,u,t??[])},[u]);return(0,Z.useImperativeHandle)(s,()=>({postMessage:(e,t)=>{c.current?.contentWindow?.postMessage(e,u,t??[])},focus:()=>{c.current?.focus()}}),[u]),(0,Z.useEffect)(()=>{function e(e){if(e.origin!==u||e.source!==c.current?.contentWindow)return;let i=e.data;if(!(!i||typeof i!=`object`||i.jsonrpc!==`2.0`)){if(i.method===`ready`&&i.id===void 0){t();return}i.id!==void 0&&i.method&&(i.method===`fetch`?n(i.id,i.params):f.current&&r(i.id,i.method,i.params??{}))}}async function t(){try{await h.current?.()}catch(e){console.error(`[SandboxFrame] onReady failed:`,e)}g({jsonrpc:`2.0`,method:`init`,params:{version:1}})}async function n(e,t){let n=t?.request?.url;if(!n){g({jsonrpc:`2.0`,id:e,error:{code:-32001,message:`Invalid request`}});return}let r;try{let t=new URL(n);if(t.origin!==u){g({jsonrpc:`2.0`,id:e,error:{code:-32003,message:`Origin mismatch`}});return}r=t.pathname}catch{g({jsonrpc:`2.0`,id:e,error:{code:-32003,message:`Invalid URL`}});return}await ws(r,d.current,p.current??[],m.current,t=>g({jsonrpc:`2.0`,id:e,result:t}),(t,n)=>g({jsonrpc:`2.0`,id:e,error:{code:t,message:n}}))}async function r(e,t,n){try{let r=await f.current(t,n,g);g({jsonrpc:`2.0`,id:e,result:r??null})}catch(t){g({jsonrpc:`2.0`,id:e,error:{code:-1,message:String(t)}})}}return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[u,g]),(0,Q.jsx)(`iframe`,{ref:c,src:`${u}/`,allow:Ts,sandbox:`allow-scripts allow-same-origin allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-downloads allow-pointer-lock`,...o})}),Ds=[`default-src 'self' 'unsafe-inline' 'unsafe-eval' 'wasm-unsafe-eval' data: blob:`,`base-uri 'self'`,`form-action 'self'`].join(`; `);async function Os(e){if(typeof e==`string`){let t=await fetch(e);if(!t.ok)throw Error(`Failed to fetch xdc: ${t.status}`);return new Uint8Array(await t.arrayBuffer())}return e}function ks(e){let t=_r(e),n=new Map;for(let[e,r]of Object.entries(t)){let t=e.replace(/^\/+/,``).replace(/\\/g,`/`);t.endsWith(`/`)||n.set(t,r)}return n}function As(e){return`(function(){ var nextId = 1; var pending = {}; var updateListener = null; var updateListenerReady = null; var realtimeDataListener = null; var realtimeChannelId = null; function send(msg) { window.parent.postMessage(msg, "*"); } function sendRequest(method, params) { var id = nextId++; return new Promise(function(resolve, reject) { pending[id] = { resolve: resolve, reject: reject }; send({ jsonrpc: "2.0", id: id, method: method, params: params }); }); } function sendNotification(method, params) { send({ jsonrpc: "2.0", method: method, params: params }); } window.addEventListener("message", function(event) { var data = event.data; if (!data || typeof data !== "object" || data.jsonrpc !== "2.0") return; // JSON-RPC response if (data.id !== undefined && !data.method) { var p = pending[data.id]; if (p) { delete pending[data.id]; if (data.error) { p.reject(new Error(data.error.message)); } else { p.resolve(data.result); } } return; } // Notifications from parent if (data.method && data.id === undefined) { switch (data.method) { case "webxdc.update": if (updateListener) updateListener(data.params.update); break; case "webxdc.realtimeChannel.data": if (realtimeDataListener) realtimeDataListener(new Uint8Array(data.params.data)); break; case "webxdc.keyboard": var p2 = data.params; var evt = new KeyboardEvent(p2.type, { key: p2.key, code: p2.code, keyCode: p2.keyCode, bubbles: true, cancelable: true, composed: true }); window.dispatchEvent(evt); document.dispatchEvent(new KeyboardEvent(p2.type, { key: p2.key, code: p2.code, keyCode: p2.keyCode, bubbles: true, cancelable: true })); break; } } }); window.webxdc = { selfAddr: ${JSON.stringify(e.selfAddr)}, selfName: ${JSON.stringify(e.selfName)}, sendUpdateInterval: ${e.sendUpdateInterval}, sendUpdateMaxSize: ${e.sendUpdateMaxSize}, sendUpdate: function(update, descr) { sendRequest("webxdc.sendUpdate", { update: update, descr: descr }); }, setUpdateListener: function(cb, serial) { updateListener = cb; return new Promise(function(resolve) { updateListenerReady = resolve; sendRequest("webxdc.setUpdateListener", { serial: serial || 0 }).then(function() { if (updateListenerReady) { updateListenerReady(); updateListenerReady = null; } }); }); }, getAllUpdates: function() { return sendRequest("webxdc.getAllUpdates"); }, sendToChat: function(message) { return sendRequest("webxdc.sendToChat", { message: message }); }, importFiles: function(filter) { return sendRequest("webxdc.importFiles", { filter: filter || {} }); }, joinRealtimeChannel: function() { if (realtimeChannelId) throw new Error("Already joined a realtime channel. Leave first."); var channelIdPromise = sendRequest("webxdc.joinRealtimeChannel"); var joined = true; channelIdPromise.then(function(r) { realtimeChannelId = r.channelId; }); return { setListener: function(cb) { if (!joined) throw new Error("Channel has been left."); realtimeDataListener = cb; }, send: function(data) { if (!joined) throw new Error("Channel has been left."); channelIdPromise.then(function(r) { sendRequest("webxdc.realtimeChannel.send", { channelId: r.channelId, data: Array.from(data) }); }); }, leave: function() { if (!joined) return; joined = false; realtimeDataListener = null; channelIdPromise.then(function(r) { sendRequest("webxdc.realtimeChannel.leave", { channelId: r.channelId }); realtimeChannelId = null; }); } }; } }; })();`}var js=(0,Z.forwardRef)(function({id:e,xdc:t,webxdc:n,...r},i){let a=(0,Z.useRef)(null),o=(0,Z.useRef)(n),s=(0,Z.useRef)(t);(0,Z.useEffect)(()=>{o.current=n},[n]),(0,Z.useEffect)(()=>{s.current=t},[t]);let c=(0,Z.useRef)(null),l=(0,Z.useRef)(``),u=(0,Z.useRef)(new Map);(0,Z.useImperativeHandle)(i,()=>({postMessage:(e,t)=>{a.current?.postMessage(e,t)},focus:()=>{a.current?.focus()}}),[]),(0,Z.useEffect)(()=>{let e=u.current;return()=>{for(let t of e.values())t.leave();e.clear()}},[]);let d=(0,Z.useCallback)(async()=>{try{let e=await Os(s.current);c.current=ks(e),l.current=As(o.current)}catch(e){console.error(`[Webxdc] Failed to initialise:`,e)}},[]),f=(0,Z.useCallback)(async e=>{let t=c.current;if(!t)return{status:503,contentType:`text/plain`,body:new TextEncoder().encode(`Archive not loaded`)};let n=e===`/`?`index.html`:decodeURIComponent(e.slice(1)),r=t.get(n);return r?{status:200,contentType:bs(n),body:r}:null},[]);return(0,Q.jsx)(Es,{ref:a,id:e,resolveFile:(0,Z.useCallback)(async e=>{if(e===`/webxdc.js`)return{status:200,contentType:`application/javascript`,body:new TextEncoder().encode(l.current)};let t=await f(e);if(!t)return null;if(t.contentType.includes(`text/html`)){let e=Cs(new TextDecoder().decode(t.body),[`/webxdc.js`]);return{...t,body:new TextEncoder().encode(e)}}return t},[f]),onRpc:(0,Z.useCallback)(async(e,t,n)=>{let r=o.current;switch(e){case`webxdc.sendUpdate`:return r.sendUpdate(t.update,``),null;case`webxdc.setUpdateListener`:{let e=t.serial??0;return await r.setUpdateListener(e=>{n({jsonrpc:`2.0`,method:`webxdc.update`,params:{update:e}})},e),null}case`webxdc.getAllUpdates`:return await r.getAllUpdates();case`webxdc.sendToChat`:return await r.sendToChat(t.message),null;case`webxdc.importFiles`:{let e=await r.importFiles(t.filter??{});return await Promise.all(e.map(async e=>({name:e.name,type:e.type,data:xs(new Uint8Array(await e.arrayBuffer()))})))}case`webxdc.joinRealtimeChannel`:{let e=r.joinRealtimeChannel(),t=crypto.randomUUID();return e.setListener(e=>{n({jsonrpc:`2.0`,method:`webxdc.realtimeChannel.data`,params:{channelId:t,data:Array.from(e)}})}),u.current.set(t,e),{channelId:t}}case`webxdc.realtimeChannel.send`:{let e=u.current.get(t.channelId);return e&&e.send(new Uint8Array(t.data)),null}case`webxdc.realtimeChannel.leave`:{let e=u.current.get(t.channelId);return e&&(e.leave(),u.current.delete(t.channelId)),null}default:throw Error(`Method not found: ${e}`)}},[]),csp:Ds,onReady:d,...r})}),Ms={up:{key:`ArrowUp`,code:`ArrowUp`,keyCode:38},down:{key:`ArrowDown`,code:`ArrowDown`,keyCode:40},left:{key:`ArrowLeft`,code:`ArrowLeft`,keyCode:37},right:{key:`ArrowRight`,code:`ArrowRight`,keyCode:39},a:{key:`x`,code:`KeyX`,keyCode:88},b:{key:`z`,code:`KeyZ`,keyCode:90},start:{key:`Enter`,code:`Enter`,keyCode:13},select:{key:`Shift`,code:`ShiftRight`,keyCode:16}},Ns=new Set([`a`,`b`]);function Ps(){en()}function Fs({webxdcHandle:e,className:t}){let n=(0,Z.useRef)(new Set),r=(0,Z.useCallback)((t,r)=>{if(!e)return;let{key:i,code:a,keyCode:o}=Ms[r];if(t===`keydown`){if(n.current.has(a))return;n.current.add(a),Ns.has(r)&&Ps()}else n.current.delete(a);e.postMessage({jsonrpc:`2.0`,method:`webxdc.keyboard`,params:{type:t,key:i,code:a,keyCode:o}})},[e]),i=e=>({onPointerDown:t=>{t.preventDefault(),t.target.setPointerCapture(t.pointerId),r(`keydown`,e)},onPointerUp:t=>{t.preventDefault(),r(`keyup`,e)},onPointerCancel:t=>{t.preventDefault(),r(`keyup`,e)},onContextMenu:e=>e.preventDefault()});return(0,Q.jsxs)(`div`,{className:z(`flex flex-col gap-2 px-4 pb-4 pt-2 select-none touch-none`,t),style:{WebkitTouchCallout:`none`,WebkitUserSelect:`none`},children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsxs)(`div`,{className:`relative size-[132px]`,children:[(0,Q.jsxs)(`div`,{className:`absolute inset-0 flex items-center justify-center pointer-events-none`,children:[(0,Q.jsx)(`div`,{className:`w-11 h-full rounded-lg bg-muted/80 backdrop-blur-sm border border-border/50`}),(0,Q.jsx)(`div`,{className:`absolute w-full h-11 rounded-lg bg-muted/80 backdrop-blur-sm border border-border/50`})]}),(0,Q.jsx)(`button`,{className:`absolute top-0 left-1/2 -translate-x-1/2 w-11 h-11 flex items-center justify-center rounded-lg active:bg-primary/20 transition-colors z-10`,"aria-label":`D-pad up`,...i(`up`),children:(0,Q.jsx)(`svg`,{width:`16`,height:`10`,viewBox:`0 0 16 10`,className:`text-foreground/70`,children:(0,Q.jsx)(`path`,{d:`M8 1L14 9H2L8 1Z`,fill:`currentColor`})})}),(0,Q.jsx)(`button`,{className:`absolute bottom-0 left-1/2 -translate-x-1/2 w-11 h-11 flex items-center justify-center rounded-lg active:bg-primary/20 transition-colors z-10`,"aria-label":`D-pad down`,...i(`down`),children:(0,Q.jsx)(`svg`,{width:`16`,height:`10`,viewBox:`0 0 16 10`,className:`text-foreground/70`,children:(0,Q.jsx)(`path`,{d:`M8 9L2 1H14L8 9Z`,fill:`currentColor`})})}),(0,Q.jsx)(`button`,{className:`absolute left-0 top-1/2 -translate-y-1/2 w-11 h-11 flex items-center justify-center rounded-lg active:bg-primary/20 transition-colors z-10`,"aria-label":`D-pad left`,...i(`left`),children:(0,Q.jsx)(`svg`,{width:`10`,height:`16`,viewBox:`0 0 10 16`,className:`text-foreground/70`,children:(0,Q.jsx)(`path`,{d:`M1 8L9 2V14L1 8Z`,fill:`currentColor`})})}),(0,Q.jsx)(`button`,{className:`absolute right-0 top-1/2 -translate-y-1/2 w-11 h-11 flex items-center justify-center rounded-lg active:bg-primary/20 transition-colors z-10`,"aria-label":`D-pad right`,...i(`right`),children:(0,Q.jsx)(`svg`,{width:`10`,height:`16`,viewBox:`0 0 10 16`,className:`text-foreground/70`,children:(0,Q.jsx)(`path`,{d:`M9 8L1 14V2L9 8Z`,fill:`currentColor`})})})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(`button`,{className:`size-14 rounded-full bg-muted/80 backdrop-blur-sm border border-border/50 flex items-center justify-center active:bg-primary/20 active:scale-95 transition-all text-sm font-bold text-foreground/70`,"aria-label":`B button`,...i(`b`),children:`B`}),(0,Q.jsx)(`button`,{className:`size-14 rounded-full bg-muted/80 backdrop-blur-sm border border-border/50 flex items-center justify-center active:bg-primary/20 active:scale-95 transition-all text-sm font-bold text-foreground/70 -mt-8`,"aria-label":`A button`,...i(`a`),children:`A`})]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-center gap-6`,children:[(0,Q.jsx)(`button`,{className:`h-8 px-4 rounded-full bg-muted/80 backdrop-blur-sm border border-border/50 flex items-center justify-center active:bg-primary/20 active:scale-95 transition-all text-[10px] font-bold uppercase tracking-wider text-foreground/60`,"aria-label":`Select`,...i(`select`),children:`Select`}),(0,Q.jsx)(`button`,{className:`h-8 px-4 rounded-full bg-muted/80 backdrop-blur-sm border border-border/50 flex items-center justify-center active:bg-primary/20 active:scale-95 transition-all text-[10px] font-bold uppercase tracking-wider text-foreground/60`,"aria-label":`Start`,...i(`start`),children:`Start`})]})]})}var Is=new Map,Ls=32,Rs=128,zs=.15,Bs=.08;function Vs(e,t,n){let r=e/255,i=t/255,a=n/255,o=Math.max(r,i,a),s=Math.min(r,i,a),c=(o+s)/2,l=0,u=0;if(o!==s){let e=o-s;switch(u=c>.5?e/(2-o-s):e/(o+s),o){case r:l=(i-a)/e+(i(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),a=n<.5?n*(1+t):n+t-n*t,o=2*n-a;return{r:Math.round(i(o,a,r+1/3)*255),g:Math.round(i(o,a,r)*255),b:Math.round(i(o,a,r-1/3)*255)}}function Us(e){let[t,n]=(0,Z.useState)(()=>e&&Is.has(e)?Is.get(e):null);return(0,Z.useEffect)(()=>{if(!e){n(null);return}if(Is.has(e)){n(Is.get(e));return}let t=!1,r=new Image;return r.crossOrigin=`anonymous`,r.onload=()=>{if(!t)try{let t=document.createElement(`canvas`);t.width=Ls,t.height=Ls;let i=t.getContext(`2d`,{willReadFrequently:!0});if(!i){Is.set(e,null),n(null);return}i.drawImage(r,0,0,Ls,Ls);let{data:a}=i.getImageData(0,0,Ls,Ls),o=new Float32Array(18),s=new Float32Array(18),c=new Float32Array(18),l=new Uint32Array(18);for(let e=0;e1-Bs)continue;let f=Math.min(17,Math.floor(i/360*18)),p=u;o[f]+=p,s[f]+=u*p,c[f]+=d*p,l[f]+=1}let u=-1,d=0;for(let e=0;e<18;e++)o[e]>d&&(d=o[e],u=e);if(u<0||l[u]<4){Is.set(e,null),n(null);return}let f=(u+.5)*(360/18),p=s[u]/o[u],m=c[u]/o[u],h={...Hs(f,p,m),h:f,s:p,l:m};Is.set(e,h),n(h)}catch{Is.set(e,null),n(null)}},r.onerror=()=>{t||(Is.set(e,null),n(null))},r.src=e,()=>{t=!0}},[e]),t}function Ws(e){let{nostr:t}=Fe(),{user:n,metadata:r}=Pt(),{mutate:i}=Ft(),a=nt(),o=(0,Z.useRef)(null);o.current||=Ve();let s=(0,Z.useMemo)(()=>new Pe(o.current),[]),c=(0,Z.useMemo)(()=>We(o.current),[]),l=(0,Z.useRef)(null),u=(0,Z.useRef)(0),{data:d}=I({queryKey:[`webxdc-updates`,e],queryFn:async()=>(await t.query([{kinds:[4932],"#i":[e],limit:500}])).sort((e,t)=>e.created_at-t.created_at),refetchInterval:3e3}),f=(0,Z.useMemo)(()=>d?d.map((e,t)=>{let n=t+1,r;try{r=JSON.parse(e.content)}catch{r=e.content}let i=e.tags.find(([e])=>e===`info`)?.[1],a=e.tags.find(([e])=>e===`document`)?.[1],o=e.tags.find(([e])=>e===`summary`)?.[1];return{payload:r,serial:n,max_serial:d.length,...i&&{info:i},...a&&{document:a},...o&&{summary:o}}}):[],[d]);(0,Z.useEffect)(()=>{if(!l.current||!f.length)return;let e=l.current,t=u.current;for(let n of f)n.serial>t&&(e(n),u.current=n.serial)},[f]);let p=(0,Z.useRef)(!1),m=(0,Z.useRef)(null);(0,Z.useEffect)(()=>()=>{m.current&&(m.current.abort(),p.current=!1)},[]);let h=n?n.pubkey:c,g=F.npubEncode(h),_=r?.name||r?.display_name||F.npubEncode(h).slice(0,12),v=(0,Z.useCallback)(async e=>{if(n)i(e);else{let n=await s.signEvent(e);await t.event(n,{signal:AbortSignal.timeout(5e3)})}},[n,i,s,t]),y=(0,Z.useCallback)((t,n)=>{let r=[[`i`,e],[`alt`,`Webxdc update`]];t.info&&r.push([`info`,t.info]),t.document&&r.push([`document`,t.document]),t.summary&&r.push([`summary`,t.summary]),v({kind:4932,content:JSON.stringify(t.payload),tags:r,created_at:Math.floor(Date.now()/1e3)}).then(()=>{a.invalidateQueries({queryKey:[`webxdc-updates`,e]})}).catch(e=>{console.error(`Failed to publish webxdc update:`,e)})},[e,v,a]),b=(0,Z.useCallback)(async(e,t)=>{l.current=e,u.current=t??0;for(let n of f)n.serial>(t??0)&&(e(n),u.current=n.serial)},[f]),x=(0,Z.useCallback)(async()=>f,[f]),S=(0,Z.useCallback)(async()=>{throw Error(`sendToChat is not supported in Nostr`)},[]),C=(0,Z.useCallback)(async()=>[],[]),w=(0,Z.useCallback)(()=>{if(p.current)throw Error(`Already joined a realtime channel. Call leave() first.`);p.current=!0;let n=new AbortController;m.current=n;let r=null;return(async()=>{try{for await(let i of t.req([{kinds:[20932],"#i":[e],since:Math.floor(Date.now()/1e3)}],{signal:n.signal}))if(i[0]===`EVENT`){let e=i[2];if(e.pubkey===h||!r)continue;try{let t=Uint8Array.from(atob(e.content),e=>e.charCodeAt(0));r(t)}catch{}}else if(i[0]===`CLOSED`)break}catch{}})(),{setListener(e){r=e},send(t){if(!p.current)return;if(t.length>128e3)throw Error(`Realtime payload exceeds 128,000 byte limit`);let n=``;for(let e=0;e{console.error(`Failed to publish webxdc realtime event:`,e)})},leave(){p.current=!1,n.abort(),m.current=null}}},[e,t,h,v]);return(0,Z.useMemo)(()=>({selfAddr:g,selfName:_,sendUpdateInterval:1e3,sendUpdateMaxSize:65536,sendUpdate:y,setUpdateListener:b,getAllUpdates:x,sendToChat:S,importFiles:C,joinRealtimeChannel:w}),[g,_,y,b,x,S,C,w])}function Gs(e){let t=cn(e,`seed`),n=localStorage.getItem(t);if(n)return n;let r=crypto.randomUUID();return localStorage.setItem(t,r),r}function Ks(e,t,n){let r=Gs(e),i=new TextEncoder;return yn(qe(ze(Ye,i.encode(r),i.encode(`${t}|${n}`))))}var qs=e(ke(),1);function Js(e){let[t,n]=(0,Z.useState)(null);return(0,Z.useEffect)(()=>{if(!e){n(null);return}let t=()=>{let t=e.getBoundingClientRect();n({left:t.left,top:t.top,width:t.width,height:t.height})};t();let r=new ResizeObserver(t);return r.observe(e),window.addEventListener(`resize`,t),()=>{r.disconnect(),window.removeEventListener(`resize`,t)}},[e]),t}function Ys({url:e,uuid:t,name:n,icon:r,encryption:i,showNameCard:a=!0,className:o}){let[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),d=(0,Z.useRef)(null),f=vr(),p=Js(s?f:null),{config:m}=ft(),h=pr(e,i),g=pr(r??``,r&&i?wt(i):void 0),_=h.src??e,v=r?g.src:void 0,y=t??e,b=Ks(m.appId,`webxdc`,y),x=(0,Z.useCallback)(()=>{c(!1),u(!1)},[]),S=(0,Z.useCallback)(()=>{u(e=>(e||d.current?.focus(),!e))},[]);if(!s){let e=n??`Webxdc App`;return(0,Q.jsxs)(`div`,{className:z(`mt-3 flex flex-col items-center`,o),onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(Xs,{appName:e,icon:v,onLaunch:()=>c(!0)}),a&&(0,Q.jsx)(`div`,{className:`mt-2.5 w-full max-w-sm rounded-xl bg-secondary/50 px-3.5 py-2.5`,children:(0,Q.jsx)(`p`,{className:`text-base font-semibold text-foreground break-words`,children:e})})]})}if(!f||!p)return null;let C=Math.max(0,p.top),w=window.innerHeight-C;return(0,qs.createPortal)((0,Q.jsxs)(`div`,{className:`fixed z-50 flex flex-col bg-background`,style:{left:p.left,top:C,width:p.width,height:w},onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(`div`,{className:`min-h-11 border-b bg-muted/30 shrink-0 safe-area-top`,children:(0,Q.jsxs)(`div`,{className:`px-3 py-2 flex items-center gap-2 w-full`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:[v?(0,Q.jsx)(`img`,{src:v,alt:n??`Webxdc App`,className:`size-6 rounded-md object-cover shrink-0`,decoding:`async`}):(0,Q.jsx)(`div`,{className:`size-6 rounded-md bg-primary/10 flex items-center justify-center shrink-0`,children:(0,Q.jsx)(be,{className:`size-3.5 text-primary/50`})}),(0,Q.jsx)(`span`,{className:`text-sm font-medium truncate`,children:n??`Webxdc App`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,Q.jsx)(B,{variant:`ghost`,size:`sm`,className:z(`h-7 w-7 p-0 shrink-0`,l&&`text-primary`),onClick:S,title:l?`Hide gamepad`:`Show gamepad`,children:(0,Q.jsx)(me,{className:`size-3.5`})}),(0,Q.jsx)(B,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 shrink-0`,onClick:x,title:`Close`,children:(0,Q.jsx)(ee,{className:`size-3.5`})})]})]})}),(0,Q.jsx)(`div`,{className:`flex-1 min-h-0 bg-white relative`,children:(0,Q.jsx)(Zs,{ref:d,id:b,url:_,uuid:t})}),l&&(0,Q.jsx)(`div`,{className:`border-t border-border bg-background/80 backdrop-blur-sm`,children:(0,Q.jsx)(Fs,{webxdcHandle:d.current})})]}),document.body)}function Xs({appName:e,icon:t,onLaunch:n}){let r=Wt(18,1.03,800),i=Us(t),a=i?`hsl(${i.h.toFixed(1)}, ${Math.min(100,Math.max(70,i.s*100+20)).toFixed(1)}%, 50%)`:null;return(0,Q.jsx)(`div`,{ref:r.ref,style:{...r.style,touchAction:`pan-y`},onPointerDown:r.onPointerDown,onPointerMove:r.onPointerMove,onPointerUp:r.onPointerUp,onPointerLeave:r.onPointerLeave,className:`w-full max-w-sm`,children:(0,Q.jsxs)(`button`,{type:`button`,onClick:n,"aria-label":`Launch ${e}`,className:z(`relative block w-full bg-transparent p-0 border-0`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-xl`,`isolate`),children:[(0,Q.jsx)(`img`,{src:`/cartridge.png`,alt:``,"aria-hidden":`true`,className:`w-full h-auto block select-none pointer-events-none drop-shadow-md`,draggable:!1,decoding:`async`}),a&&(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`absolute inset-0 pointer-events-none`,style:{backgroundColor:a,WebkitMaskImage:`url(/cartridge.png)`,maskImage:`url(/cartridge.png)`,WebkitMaskSize:`100% 100%`,maskSize:`100% 100%`,WebkitMaskRepeat:`no-repeat`,maskRepeat:`no-repeat`,mixBlendMode:`color`}}),(0,Q.jsx)(`div`,{className:`absolute flex items-center justify-center`,style:{left:`21.48%`,top:`29.66%`,width:`57.32%`,height:`45.99%`},children:t?(0,Q.jsx)(`img`,{src:t,alt:``,"aria-hidden":`true`,className:`w-[70%] aspect-square rounded-[12%] object-cover drop-shadow-md`,draggable:!1,decoding:`async`}):(0,Q.jsx)(`div`,{className:`w-[70%] aspect-square rounded-[12%] bg-primary/15 flex items-center justify-center drop-shadow-md`,children:(0,Q.jsx)(be,{className:`w-1/2 h-1/2 text-primary`})})})]})})}var Zs=(0,Z.forwardRef)(function({id:e,url:t,uuid:n},r){return(0,Q.jsx)(js,{ref:r,id:e,xdc:t,webxdc:Ws(n??``),className:`w-full h-full border-0`})});function Qs(e){let t=(0,Z.useRef)(e);t.current=e,(0,Z.useEffect)(()=>{let e=!1;window.history.pushState({dittoBackDismiss:!0},``);let n=()=>{e=!0,t.current()};return window.addEventListener(`popstate`,n),()=>{window.removeEventListener(`popstate`,n),e||window.history.back()}},[])}function $s({images:e,className:t,maxVisible:n=4,maxGridHeight:r=`400px`,imetaMap:i,lightboxBottomBar:a,lightboxTopBarLeft:o,lightboxIndex:s,onLightboxOpen:c,onLightboxClose:l}){let[u,d]=(0,Z.useState)(null),f=s===void 0?u:s,p=e.slice(0,n),m=e.length-n,h=(0,Z.useMemo)(()=>i?e.map(e=>i.get(e)??{}):void 0,[e,i]),g=(e,t)=>{t.preventDefault(),t.stopPropagation(),c?c(e):d(e)},_=(0,Z.useCallback)(e=>{e&&(e.stopPropagation(),e.preventDefault()),l?l():d(null)},[l]),v=(0,Z.useCallback)(()=>{c&&f!=null?c(f+1t===null?null:Math.min(t+1,e.length-1))},[e.length,f,c]),y=(0,Z.useCallback)(()=>{c&&f!=null?c(f-1>=0?f-1:f):d(e=>e===null?null:Math.max(e-1,0))},[f,c]);return e.length===0?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:z(`mt-3 rounded-2xl overflow-hidden`,p.length>1&&`grid grid-cols-2 gap-0.5`,t),children:p.map((e,t)=>(0,Q.jsx)(tc,{url:e,index:t,visibleCount:p.length,maxGridHeight:r,overflow:t===p.length-1?m:0,onOpen:e=>g(t,e),dim:i?.get(e)?.dim,blurhash:i?.get(e)?.blurhash,encryption:i?.get(e)?.encryption},t))}),f!=null&&(0,Q.jsx)(rc,{images:e,currentIndex:f,onClose:_,onNext:v,onPrev:y,mediaMeta:h,topBarLeft:o,bottomBar:a})]})}function ec(e){if(!e)return;let[t,n]=e.split(`x`).map(Number);if(!(!t||!n||isNaN(t)||isNaN(n)))return{width:t,height:n}}function tc({url:e,index:t,visibleCount:n,maxGridHeight:r,overflow:i,onOpen:a,dim:o,blurhash:s,encryption:c}){let[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(void 0),p=(0,Z.useRef)(null),m=hr(e),{ref:h,inView:g}=yr({rootMargin:`400px`,skip:!c}),_=pr(e,c,{enabled:g}),v=_.encrypted?_.src:m.src,y=_.encrypted?void 0:m.onError;(0,Z.useEffect)(()=>{if(p.current?.complete&&p.current.naturalWidth>0&&(u(!0),!o)){let{naturalWidth:e,naturalHeight:t}=p.current;e&&t&&f(`${e} / ${t}`)}},[o]);let b=n===1,x=ec(o),S=x?`${x.width} / ${x.height}`:d,C=b?{aspectRatio:S,maxHeight:`85dvh`,minHeight:S?void 0:`200px`}:{height:n===3&&t===0?r:`calc(${r} / 2)`};return(0,Q.jsxs)(`button`,{ref:h,type:`button`,className:z(`relative block w-full overflow-hidden focus:outline-none focus-visible:ring-2 focus-visible:ring-primary`,n===3&&t===0&&`row-span-2`),style:C,onClick:a,children:[!l&&!_.error&&!_.tooLarge&&(ds(s)?(0,Q.jsx)(us,{hash:s,width:32,height:32,resolutionX:32,resolutionY:32,punch:1,style:{position:`absolute`,inset:0,width:`100%`,height:`100%`}}):(0,Q.jsx)(X,{className:`absolute inset-0 w-full h-full rounded-none`})),_.error||_.tooLarge?(0,Q.jsx)(dr,{fill:!0,unsupported:_.unsupported,tooLarge:_.tooLarge,byteSize:_.byteSize,onDecryptAnyway:_.decryptAnyway}):(0,Q.jsx)(`img`,{ref:p,src:v,alt:``,width:x?.width,height:x?.height,className:z(`absolute inset-0 w-full h-full object-cover transition-all duration-300 hover:scale-[1.02]`,l?`opacity-100`:`opacity-0`),loading:`lazy`,onLoad:e=>{if(u(!0),!o){let t=e.currentTarget;t.naturalWidth&&t.naturalHeight&&f(`${t.naturalWidth} / ${t.naturalHeight}`)}},onError:y,decoding:`async`}),i>0&&(0,Q.jsx)(`div`,{className:`absolute inset-0 bg-black/50 flex items-center justify-center backdrop-blur-[2px]`,children:(0,Q.jsxs)(`span`,{className:`text-white text-2xl font-bold`,children:[`+`,i]})})]})}var nc=`__lightbox_loading__`;function rc({images:e,currentIndex:t,onClose:n,onNext:r,onPrev:i,mediaTypes:a,mediaMeta:o,topBarLeft:s,showDownload:c=!0,maxDotIndicators:u=10,bottomBar:d}){let[f,p]=(0,Z.useState)(new Set),m=(0,Z.useCallback)(e=>{p(t=>{let n=new Set(t);return n.add(e),n})},[]),{toast:h}=Nt(),g=xt(),[_,v]=(0,Z.useState)(!1),y=e[t],b=f.has(y),x=e.length>1,S=t0;(0,Z.useEffect)(()=>{let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}},[]),Qs(n),(0,Z.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n(),e.key===`ArrowRight`&&S&&r(),e.key===`ArrowLeft`&&C&&i()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[n,r,i,S,C]);let T=(0,Z.useRef)(null),E=(0,Z.useRef)(0),D=(0,Z.useRef)(null),k=(0,Z.useRef)(null),A=(0,Z.useRef)(null),j=(0,Z.useRef)(!1),M=`cubic-bezier(0.25, 0.46, 0.45, 0.94)`,ne=(0,Z.useRef)(0),re=(0,Z.useRef)(!1),ie=(0,Z.useRef)(new Map),N=(0,Z.useCallback)((e,n,r)=>{let i=ie.current.get(e);if(!i)return;let a=(e-t)*window.innerWidth;i.style.transition=r,i.style.transform=`translateX(${a+n}px)`},[t]),ae=(0,Z.useCallback)((e=0)=>{ie.current.forEach((t,n)=>N(n,e,`none`))},[N]),P=(0,Z.useCallback)((e,t)=>{let n=T.current;if(!n)return;let r=Math.min(Math.abs(e)/(window.innerHeight*.4),1);n.style.transition=t?`opacity ${t.split(` `).slice(1).join(` `)}`:`none`,n.style.opacity=String(1-r*.6);let i=n.querySelector(`[data-lightbox-content]`);i&&(i.style.transition=t,i.style.transform=`translateY(${e}px)`)},[]);(0,Z.useEffect)(()=>{E.current=0,ae(0)},[t,ae]),(0,Z.useEffect)(()=>()=>{j.current=!1},[]);let oe=e=>{if(!j.current){if(e.touches.length>=2){D.current=null,k.current=null;return}D.current=e.touches[0].clientX,k.current=e.touches[0].clientY,A.current=null,ie.current.forEach((e,t)=>N(t,E.current,`none`)),P(0,`none`),ne.current=0}},se=(0,Z.useRef)(e=>{});se.current=e=>{if(D.current===null||k.current===null||j.current)return;let t=e.touches[0].clientX-D.current,n=e.touches[0].clientY-k.current;if(!A.current){if(Math.abs(t)<4&&Math.abs(n)<4)return;A.current=Math.abs(t)>=Math.abs(n)?`h`:`v`}if(A.current===`v`){if(re.current)return;e.preventDefault(),ne.current=n,P(n,`none`);return}A.current===`h`&&(e.preventDefault(),E.current=t>0&&!C||t<0&&!S?t*.2:t,ie.current.forEach((e,t)=>N(t,E.current,`none`)))},(0,Z.useEffect)(()=>{let e=T.current;if(!e)return;let t=e=>se.current(e);return e.addEventListener(`touchmove`,t,{passive:!1}),()=>e.removeEventListener(`touchmove`,t)},[]);let ce=e=>{if(A.current===`v`&&k.current!==null&&!re.current){let t=e.changedTouches[0].clientY-k.current;if(D.current=null,k.current=null,A.current=null,Math.abs(t)>window.innerHeight*.15){j.current=!0;let e=t>0?window.innerHeight:-window.innerHeight;P(e,`transform 280ms ${M}`),setTimeout(()=>{ne.current=0,n(),j.current=!1},280)}else P(0,`transform 280ms ${M}`),ne.current=0;return}if(D.current===null||A.current!==`h`){D.current=null,k.current=null,A.current=null,ie.current.forEach((e,t)=>N(t,0,`transform 280ms ${M}`)),E.current=0;return}let t=e.changedTouches[0].clientX-D.current;D.current=null,k.current=null,A.current=null;let a=Math.abs(t)>window.innerWidth*.2,o=t<0&&S&&a;if(o||t>0&&C&&a){j.current=!0;let e=o?-window.innerWidth:window.innerWidth,t=`transform 280ms ${M}`;ie.current.forEach((n,r)=>N(r,e,t)),setTimeout(()=>{j.current=!1,E.current=0,o?r():i()},280)}else ie.current.forEach((e,t)=>N(t,0,`transform 280ms ${M}`)),E.current=0},le=e=>{let t=e.target;t.tagName===`IMG`||t.closest(`button`)||t.closest(`[data-gallery-topbar]`)||(e.stopPropagation(),e.preventDefault(),n())},ue=async e=>{if(e.stopPropagation(),e.preventDefault(),!_){v(!0);try{let e=o?.[t]?.encryption;if((e?await Ot(y,e):await Dt(y))===`downloaded`){let e=Ct.getPlatform();h(e===`android`?{title:g.formatMessage({id:`gallery.savedAndroid`,defaultMessage:`Downloading`}),description:g.formatMessage({id:`gallery.savedAndroidDescription`,defaultMessage:`Saving to your Downloads folder.`})}:e===`ios`?{title:g.formatMessage({id:`gallery.savedNative`,defaultMessage:`Saved to your device`}),description:g.formatMessage({id:`gallery.savedNativeDescription`,defaultMessage:`You'll find it in the Ditto folder in Files.`})}:{title:g.formatMessage({id:`gallery.savedWeb`,defaultMessage:`Saved`}),description:g.formatMessage({id:`gallery.savedWebDescription`,defaultMessage:`Check your downloads folder.`})})}else h({title:g.formatMessage({id:`gallery.downloadOpened`,defaultMessage:`Opened in a new tab`}),description:g.formatMessage({id:`gallery.downloadOpenedDescription`,defaultMessage:`This file couldn't be downloaded directly, so it opened in a new tab. Save it from there.`})})}catch{h({title:g.formatMessage({id:`gallery.downloadFailed`,defaultMessage:`Download failed`}),description:g.formatMessage({id:`gallery.downloadFailedDescription`,defaultMessage:`Could not download this file. Please try again.`}),variant:`destructive`})}finally{v(!1)}}},de=[t-1,t,t+1].filter(t=>t>=0&&t{for(let n=-3;n<=3;n++){if(Math.abs(n)<=1)continue;let r=t+n;if(r<0||r>=e.length||(a?.[r]??`image`)!==`image`||o?.[r]?.encryption)continue;let i=e[r];if(!i||i===`__lightbox_loading__`||fe.current.has(i))continue;fe.current.add(i);let s=new Image;for(s.fetchPriority=`low`,s.onload=()=>m(i),s.src=i,pe.current.push(s);pe.current.length>12;)pe.current.shift()}},[t,e,a,o,m]),(0,Z.useEffect)(()=>{let e=fe.current,t=pe.current;return()=>{e.clear(),t.length=0}},[]),(0,qs.createPortal)((0,Q.jsxs)(`div`,{ref:T,className:`fixed inset-0 z-[100] animate-in fade-in duration-200`,onClick:le,onTouchStart:oe,onTouchEnd:ce,children:[(0,Q.jsx)(`div`,{className:`absolute inset-0 bg-black/90 backdrop-blur-md`}),(0,Q.jsxs)(`div`,{"data-lightbox-content":!0,className:`absolute inset-0`,children:[(0,Q.jsxs)(`div`,{"data-gallery-topbar":!0,className:`absolute left-0 right-0 z-10 flex items-center justify-between px-4 py-3 safe-area-inset-top`,children:[s===void 0?(0,Q.jsxs)(Q.Fragment,{children:[x&&(0,Q.jsxs)(`span`,{className:`text-white/80 text-sm font-medium tabular-nums`,children:[t+1,` / `,e.length]}),!x&&(0,Q.jsx)(`span`,{})]}):s,(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[c&&(0,Q.jsx)(`button`,{onClick:ue,disabled:_,className:`p-2.5 rounded-full text-white/70 hover:text-white hover:bg-white/10 transition-colors disabled:opacity-60 disabled:cursor-wait`,title:`Download`,children:_?(0,Q.jsx)(te,{className:`size-5 animate-spin`}):(0,Q.jsx)(O,{className:`size-5`})}),(0,Q.jsx)(`button`,{onClick:e=>{e.stopPropagation(),e.preventDefault(),n()},className:`p-2.5 rounded-full text-white/70 hover:text-white hover:bg-white/10 transition-colors`,title:`Close (Esc)`,children:(0,Q.jsx)(ee,{className:`size-5`})})]})]}),C&&(0,Q.jsx)(`button`,{onClick:e=>{e.stopPropagation(),i()},className:`absolute left-3 top-1/2 -translate-y-1/2 z-10 p-2 rounded-full bg-black/40 text-white/80 hover:text-white hover:bg-black/60 backdrop-blur-sm transition-all hidden sm:flex`,title:`Previous`,children:(0,Q.jsx)(l,{className:`size-6`})}),S&&(0,Q.jsx)(`button`,{onClick:e=>{e.stopPropagation(),r()},className:`absolute right-3 top-1/2 -translate-y-1/2 z-10 p-2 rounded-full bg-black/40 text-white/80 hover:text-white hover:bg-black/60 backdrop-blur-sm transition-all hidden sm:flex`,title:`Next`,children:(0,Q.jsx)(w,{className:`size-6`})}),(0,Q.jsx)(`div`,{"data-lightbox-strip":!0,className:`absolute inset-0 overflow-hidden`,children:de.map(n=>{let r=e[n],i=n===t,s=(n-t)*window.innerWidth;return(0,Q.jsxs)(`div`,{ref:e=>{e?ie.current.set(n,e):ie.current.delete(n)},className:z(`absolute inset-0 flex items-center justify-center will-change-transform`,d?`pb-24 pt-14 px-4 sm:px-12`:`py-6 pt-14 px-4 sm:px-12`),style:{transform:`translateX(${s}px)`},children:[i&&!b&&(a?.[n]??`image`)===`image`&&(0,Q.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center pointer-events-none`,children:(0,Q.jsx)(`div`,{className:`size-8 border-2 border-white/20 border-t-white/80 rounded-full animate-spin`})}),(0,Q.jsx)(sc,{url:r,type:a?.[n]??`image`,meta:o?.[n],isActive:i,isLoaded:i?b:!0,onLoad:m,onSwipeBlocked:()=>{D.current=null,A.current=null},onZoomChange:e=>{re.current=e}})]},r)})}),x&&e.length<=u&&(0,Q.jsx)(`div`,{className:z(`absolute left-1/2 -translate-x-1/2 z-10 flex items-center gap-1.5 sm:hidden`,d?`bottom-20`:`bottom-6`),children:e.map((e,n)=>(0,Q.jsx)(`div`,{className:z(`rounded-full transition-all duration-200`,n===t?`size-2 bg-white`:`size-1.5 bg-white/40`)},n))}),d&&(0,Q.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 z-10`,onClick:e=>e.stopPropagation(),children:d})]})]}),document.body)}var ic=1,ac=8;function oc({url:e,encryption:t,isLoaded:n,onLoad:r,onSwipeBlocked:i,onZoomChange:a}){let o=hr(e),s=pr(e,t),c=s.encrypted?s.src:o.src,l=s.encrypted?void 0:o.onError,u=(0,Z.useRef)(null),d=(0,Z.useRef)(null),f=(0,Z.useRef)(1),p=(0,Z.useRef)(0),m=(0,Z.useRef)(0),h=(0,Z.useRef)(null),g=(0,Z.useRef)(null),_=(0,Z.useRef)(0),v=(0,Z.useRef)(null),y=(0,Z.useCallback)(()=>r(e),[r,e]);(0,Z.useEffect)(()=>{u.current?.complete&&u.current.naturalWidth>0&&y()},[c,y]),(0,Z.useEffect)(()=>{(s.error||s.tooLarge)&&y()},[s.error,s.tooLarge,y]);let b=(0,Z.useCallback)(()=>{a?.(f.current>1)},[a]);(0,Z.useEffect)(()=>{f.current=1,p.current=0,m.current=0,x(),b()},[e,b]);function x(e=!1){let t=d.current;t&&(t.style.transition=e?`transform 0.25s ease`:`none`,t.style.transform=`translate(${p.current}px, ${m.current}px) scale(${f.current})`)}function S(e=f.current){let t=u.current,n=d.current;if(!t||!n)return;let r=t.offsetWidth*e,i=t.offsetHeight*e,a=n.parentElement?.offsetWidth??window.innerWidth,o=n.parentElement?.offsetHeight??window.innerHeight,s=Math.max(0,(r-a)/2),c=Math.max(0,(i-o)/2);p.current=Math.max(-s,Math.min(s,p.current)),m.current=Math.max(-c,Math.min(c,m.current))}function C(e){let t=e[1].clientX-e[0].clientX,n=e[1].clientY-e[0].clientY;return Math.sqrt(t*t+n*n)}let w=e=>{if(e.touches.length===2)h.current={dist:C(e.touches),midX:(e.touches[0].clientX+e.touches[1].clientX)/2,midY:(e.touches[0].clientY+e.touches[1].clientY)/2,scale:f.current,panX:p.current,panY:m.current},g.current=null;else if(e.touches.length===1){f.current>1&&(g.current={x:e.touches[0].clientX,y:e.touches[0].clientY,panX:p.current,panY:m.current});let t=Date.now();if(t-_.current<300){if(e.preventDefault(),f.current>1)f.current=1,p.current=0,m.current=0;else{f.current=2.5;let t=d.current?.getBoundingClientRect();if(t){let n=e.touches[0].clientX-t.left-t.width/2,r=e.touches[0].clientY-t.top-t.height/2;p.current=-n*(f.current-1)/f.current,m.current=-r*(f.current-1)/f.current,S()}}x(!0),b()}_.current=t}},T=e=>{if(e.touches.length===2&&h.current){e.preventDefault();let t=h.current,n=Math.max(ic,Math.min(ac,t.scale*C(e.touches)/t.dist)),r=(e.touches[0].clientX+e.touches[1].clientX)/2,i=(e.touches[0].clientY+e.touches[1].clientY)/2;f.current=n,p.current=t.panX+(r-t.midX),m.current=t.panY+(i-t.midY),S(n),x(),b()}else if(e.touches.length===1&&g.current&&f.current>1){e.preventDefault();let t=g.current;p.current=t.panX+(e.touches[0].clientX-t.x),m.current=t.panY+(e.touches[0].clientY-t.y),S(),x(),i?.()}},E=e=>{e.touches.length<2&&(h.current=null),e.touches.length===0&&(g.current=null,f.current{if(e.ctrlKey||e.metaKey){e.preventDefault();let t=e.deltaY<0?1.1:.9;f.current=Math.max(ic,Math.min(ac,f.current*t)),f.current===ic?(p.current=0,m.current=0):S(),x(),b()}else f.current>1&&(e.preventDefault(),p.current-=e.deltaX,m.current-=e.deltaY,S(),x())},O=e=>{f.current<=1||(e.preventDefault(),v.current={x:e.clientX,y:e.clientY,panX:p.current,panY:m.current})},ee=e=>{v.current&&(p.current=v.current.panX+(e.clientX-v.current.x),m.current=v.current.panY+(e.clientY-v.current.y),S(),x())},k=()=>{v.current&&(v.current=null,S(),x(!0))},A=(0,Z.useRef)(null);return(0,Z.useEffect)(()=>{let e=A.current;if(!e)return;let t=e=>T(e),n=e=>D(e);return e.addEventListener(`touchmove`,t,{passive:!1}),e.addEventListener(`wheel`,n,{passive:!1}),()=>{e.removeEventListener(`touchmove`,t),e.removeEventListener(`wheel`,n)}},[]),(0,Q.jsx)(`div`,{ref:A,className:`w-full h-full flex items-center justify-center overflow-hidden`,onTouchStart:w,onTouchEnd:E,onMouseDown:O,onMouseMove:ee,onMouseUp:k,onMouseLeave:k,style:{cursor:f.current>1?`grab`:`default`},children:(0,Q.jsx)(`div`,{ref:d,style:{transformOrigin:`center center`,willChange:`transform`,width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:s.error||s.tooLarge?(0,Q.jsx)(dr,{unsupported:s.unsupported,tooLarge:s.tooLarge,byteSize:s.byteSize,onDecryptAnyway:s.decryptAnyway,className:`max-w-sm bg-white/10 text-white/80`}):(0,Q.jsx)(`img`,{ref:u,src:c,alt:``,className:z(`block max-w-full max-h-full object-contain select-none transition-opacity duration-300`,n?`opacity-100`:`opacity-0`),onLoad:y,onError:l,draggable:!1,decoding:`async`})})})}function sc({url:e,type:t,meta:n,isLoaded:r,onLoad:i,onSwipeBlocked:a,onZoomChange:o}){let s=R(t===`audio`?n?.pubkey:void 0).data?.metadata,c=n?.pubkey?`Anonymous`:`?`;return e===`__lightbox_loading__`?(0,Q.jsx)(`div`,{className:`size-10 border-2 border-white/20 border-t-white/80 rounded-full animate-spin`}):t===`video`?(0,Q.jsx)(`div`,{className:`w-full flex items-center justify-center px-4`,onClick:e=>e.stopPropagation(),children:(0,Q.jsx)(_s,{src:e,encryption:n?.encryption,dim:n?.dim,blurhash:n?.blurhash,className:`w-full max-w-lg`})}):t===`audio`?(0,Q.jsx)(`div`,{className:`w-full flex items-center justify-center px-4`,onClick:e=>e.stopPropagation(),children:(0,Q.jsx)(vs,{src:e,mime:n?.mime,encryption:n?.encryption,avatarUrl:s?.picture,avatarFallback:c[0]?.toUpperCase(),avatarShape:U(s),className:`w-full max-w-lg`})}):(0,Q.jsx)(oc,{url:e,encryption:n?.encryption,isLoaded:r,onLoad:i,onSwipeBlocked:a,onZoomChange:o})}var cc=`jpg|jpeg|png|gif|webp|svg|avif`,lc=`mp4|webm|mov|qt|avi|mkv|flv`,uc=`mp3|mpga|wav|ogg|flac|m4a|aac|opus`,dc=`${cc}|${lc}|${uc}|xdc`,fc=RegExp(`https?:\\/\\/[^\\s]+\\.(${cc})(\\?[^\\s]*)?`,`i`),pc=RegExp(`https?:\\/\\/[^\\s]+\\.(${lc})(\\?[^\\s]*)?`,`gi`),mc=RegExp(`https?:\\/\\/[^\\s]+\\.(${uc})(\\?[^\\s]*)?`,`gi`),hc=RegExp(`https?:\\/\\/[^\\s]+\\.(${lc}|${uc}|xdc)(\\?[^\\s]*)?`,`i`),gc=RegExp(`https?:\\/\\/[^\\s]+\\.(${dc})(\\?[^\\s]*)?`,`gi`),_c=new RegExp(gc.source,`i`);function vc(e){switch(e){case`jpg`:case`jpeg`:return`image/jpeg`;case`png`:return`image/png`;case`gif`:return`image/gif`;case`webp`:return`image/webp`;case`svg`:return`image/svg+xml`;case`avif`:return`image/avif`;case`mp4`:return`video/mp4`;case`webm`:return`video/webm`;case`mov`:return`video/quicktime`;case`qt`:return`video/quicktime`;case`avi`:return`video/x-msvideo`;case`mkv`:return`video/x-matroska`;case`flv`:return`video/x-flv`;case`mp3`:case`mpga`:return`audio/mpeg`;case`wav`:return`audio/wav`;case`ogg`:return`audio/ogg`;case`flac`:return`audio/flac`;case`m4a`:return`audio/mp4`;case`aac`:return`audio/aac`;case`opus`:return`audio/opus`;case`xdc`:return`application/x-webxdc`;default:return`application/octet-stream`}}function yc(e){return e.match(new RegExp(pc.source,`gi`))??[]}function bc(e){return e.match(new RegExp(mc.source,`gi`))??[]}var xc=/blossom:[a-f0-9]{64}\.[a-z0-9]+(?:\?[^\s]*)?/i;function Sc(e){if(!e.toLowerCase().startsWith(`blossom:`))return;let t=e.slice(8),n=t.indexOf(`?`),r=n===-1?t:t.slice(0,n),i=n===-1?``:t.slice(n+1),a=/^([a-f0-9]{64})\.([a-z0-9]+)$/i.exec(r);if(!a)return;let o=a[1].toLowerCase(),s=a[2].toLowerCase();if(!V(o))return;let c=new URLSearchParams(i),l=[];for(let e of c.getAll(`xs`)){let t=Ec(e);t&&!l.includes(t)&&l.push(t)}let u=[];for(let e of c.getAll(`as`)){let t=e.toLowerCase();V(t)&&!u.includes(t)&&u.push(t)}let d,f=c.get(`sz`);if(f&&/^\d+$/.test(f)){let e=Number(f);Number.isSafeInteger(e)&&e>0&&(d=e)}return{sha256:o,ext:s,path:`${o}.${s}`,servers:l,authors:u,size:d}}function Cc(e,t){if(!e.toLowerCase().startsWith(`blossom:`))return e;let n=Sc(e);if(n)return Dc(n,t)[0]}function wc(e){let t=e.match(new RegExp(xc.source,`gi`))??[],n=[];for(let e of t){let t=Sc(e);t&&n.push({uri:t,raw:e})}return n}function Tc(e,t){let n=[`url ${t}`,`x ${e.sha256}`,`m ${vc(e.ext)}`];return typeof e.size==`number`&&n.push(`size ${e.size}`),[`imeta`,...n]}function Ec(e){if(!e)return;let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e)?e:`https://${e}`;try{let e=new URL(t);return e.protocol=`https:`,e.origin}catch{return}}function Dc(e,t){let n=[],r=new Set,i=t=>{let i;try{let e=new URL(t);e.protocol=`https:`,i=e.origin}catch{return}let a=L(`${i}/${e.path}`);a&&!r.has(a)&&(r.add(a),n.push(a))};for(let t of e.servers)i(t);for(let e of t)i(e);return n}function Oc(e){let{config:t}=ft(),[n,r]=(0,Z.useState)(0),i=(0,Z.useRef)(!1),a=(0,Z.useMemo)(()=>Dc(e,sn(t.blossomServerMetadata,t.useAppBlossomServers)),[e.path,e.servers,t.blossomServerMetadata,t.useAppBlossomServers]);return{src:a[n],onError:(0,Z.useCallback)(()=>{r(e=>{let t=e+1;return t{let t=/\/(?:dp|gp\/product|gp\/aw\/d)\/([A-Za-z0-9]{10})(?:[/?]|$)/.exec(e.pathname);if(t)return{pathname:`/dp/${t[1]}`,dropQuery:!0}}},{hosts:[`spotify.com`,`spotify.link`],params:[`si`,`nd`,`_branch_match_id`,`_branch_referrer`]},{hosts:[`apple.com`],params:[`at`,`ct`,`uo`,`ls`,`itscg`,`itsct`,`app`]},{hosts:[`soundcloud.com`],params:[`si`,`ref`]},{hosts:[`twitch.tv`],params:[`tt_content`,`tt_medium`,`sr`]},{hosts:[`bilibili.com`,`b23.tv`],params:[`spm_id_from`,`from_source`,`from_spmid`,`share_source`,`share_medium`,`share_plat`,`share_session_id`,`share_tag`,`unique_k`,`vd_source`,`buvid`,`is_story_h5`,`plat_id`,`bbid`,`ts`,`timestamp`,`mid`]},{hosts:[`linkedin.com`],params:[`trk`,`trkinfo`,`traceid`,`trackingid`,`originalsubdomain`,`refid`,`midtoken`,`midsig`,`ebp`,`li_fat_id`,`licu`,`lipi`,`lici`]},{hosts:[`medium.com`],params:[`source`,`sk`,`gi`]},{hosts:[`substack.com`],params:[`r`,`showwelcome`,`triedredirect`,`triggershare`,`isfreemail`,`post_id`,`publication_id`]},{hosts:[`google.com`],matchHost:Nc,params:[`ved`,`ei`,`usg`,`sa`,`source`,`oq`,`aqs`,`sourceid`,`client`,`sclient`,`uact`,`sxsrf`,`iflsig`,`gws_rd`,`bih`,`biw`,`dpr`],prefixes:[`gs_`]},{hosts:[`ebay.com`,`ebay.co.uk`,`ebay.de`,`ebay.fr`,`ebay.it`,`ebay.es`,`ebay.ca`,`ebay.com.au`],params:[`_trkparms`,`_trksid`,`hash`,`amdata`,`mkevt`,`mkcid`,`mkrid`,`campid`,`customid`,`toolid`,`ul_noapp`]},{hosts:[`aliexpress.com`,`aliexpress.us`],params:[`spm`,`scm`,`scm_id`,`scm-url`,`pvid`,`btsid`,`ws_ab_test`,`gatewayadapt`,`srcsns`,`businesstype`,`curpageloguid`],prefixes:[`aff_`,`pdp_`,`algo_`]},{hosts:[`etsy.com`],params:[`click_key`,`click_sum`,`ref`,`frs`,`sts`,`organic_search_click`,`plkey`],prefixes:[`ga_`]},{hosts:[`walmart.com`],params:[`from`,`sid`,`adsredirect`,`classtype`],prefixes:[`ath`]},{hosts:[`target.com`],params:[`preselect`,`lnk`,`clkid`,`afid`,`ref`]},{hosts:[`imdb.com`],params:[`ref_`,`pf_rd_p`,`pf_rd_r`]},{hosts:[`steampowered.com`,`steamcommunity.com`],params:[`snr`]},{hosts:[`bandcamp.com`],params:[`from`,`search_item_id`,`search_page_id`,`search_rank`,`search_sig`,`label`]},{hosts:[`pinterest.com`],params:[`nic_v1`,`nic_v2`,`nic_v3`,`sender`]}];function Mc(e,t){return e===t||e.endsWith(`.${t}`)}function Nc(e){return/(^|\.)google(\.[a-z]{2,3})+$/.test(e)}function Pc(e){return jc.find(t=>t.matchHost?.(e)||t.hosts.some(t=>Mc(e,t)))}function Fc(e,t){let n=e.toLowerCase();return kc.has(n)||Ac.some(e=>n.startsWith(e))?!0:t?!!(t.params?.includes(n)||t.prefixes?.some(e=>n.startsWith(e))):!1}function Ic(e){if(!e.includes(`?`)&&!e.includes(`/dp/`)&&!e.includes(`/gp/`))return e;let t;try{t=new URL(e)}catch{return e}if(t.protocol!==`https:`&&t.protocol!==`http:`)return e;let n=Pc(t.hostname.toLowerCase()),r=e.indexOf(`#`),i=r===-1?e:e.slice(0,r),a=r===-1?``:e.slice(r),o=i.indexOf(`?`),s=o===-1?i:i.slice(0,o),c=o===-1?``:i.slice(o+1),l=!1,u=!1,d=n?.canonical?.(t);d?.pathname&&d.pathname!==t.pathname&&(s=`${t.protocol}//${t.host}${d.pathname}`,l=!0,u=d.dropQuery??!1);let f=``;if(c&&!u){let e=c.split(`&`).filter(e=>{if(!e)return!1;let t=e.indexOf(`=`),r=t===-1?e:e.slice(0,t),i=r;try{i=decodeURIComponent(r)}catch{}return!Fc(i,n)});e.length!==c.split(`&`).filter(Boolean).length&&(l=!0),f=e.join(`&`)}else c&&u&&(l=!0);return l?`${s}${f?`?${f}`:``}${a}`:e}var Lc=/https?:\/\/[^\s]+/gi;function Rc(e){let t=/^(.*?)([.,;:!?)\]]+)$/.exec(e);if(!t)return[e,``];let[,n,r]=t;for(;r.startsWith(`)`)&&!((n.match(/\(/g)??[]).length<=(n.match(/\)/g)??[]).length);)n+=`)`,r=r.slice(1);return!r||!n||n.length<=10?[e,``]:[n,r]}function zc(e,t){if(!e.includes(`http`))return e;let n=!1,r=e.replace(Lc,e=>{let[r,i]=Rc(e);if(t?.has(r))return e;let a=Ic(r);return a===r?e:(n=!0,`${a}${i}`)});return n?r:e}function Bc(e,t){let n=t.replace(/\s+/g,` `).trim();if(!n)return e;let r=n.split(` `).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`\\s+`),i=new RegExp(r,`gi`),a=[],o=0;for(let t of e){if(typeof t!=`string`){a.push(t);continue}i.lastIndex=0;let e=0,n,r=!1;for(;(n=i.exec(t))!==null;)r=!0,n.index>e&&a.push(t.slice(e,n.index)),a.push((0,Q.jsx)(`mark`,{className:`rounded bg-primary/25 text-foreground`,children:n[0]},`mark-${o++}`)),e=n.index+n[0].length,n[0].length===0&&i.lastIndex++;r?ei&&r.push(e.substring(i,a.index)),r.push((0,Q.jsx)(Vt,{name:s,url:c,className:n},`emoji-${a.index}`)),i=a.index+o.length)}return i0?r:[e]}var Wc=RegExp(`naddr1[023456789acdefghjklmnpqrstuvwxyz]{10,}`,`i`),Gc=`[^\\p{L}\\p{N}_/:.@+=?&%#~\\\\-]`;function Kc(e){let t=e.match(Wc);if(!t)return null;try{let e=F.decode(t[0]);if(e.type===`naddr`)return e.data}catch{}return null}var qc=/([\u{1F1E6}-\u{1F1FF}]{2})/gu;function Jc(e){let t=[...e];if(t.length!==2)return null;let n=t[0].codePointAt(0)-127462+65,r=t[1].codePointAt(0)-127462+65,i=String.fromCharCode(n)+String.fromCharCode(r);return nr[i]?i:null}function Yc(e){let t=[],n=0;for(let r of e){if(typeof r!=`string`){t.push(r);continue}let e=0;qc.lastIndex=0;let i;for(;(i=qc.exec(r))!==null;){let a=i[1],o=Jc(a);o&&(i.index>e&&t.push(r.substring(e,i.index)),t.push((0,Q.jsx)(q,{to:`/i/iso3166:${o}`,className:`hover:opacity-70 transition-opacity`,onClick:e=>e.stopPropagation(),children:a},`flag-${n++}`)),e=i.index+i[0].length)}esn(l.blossomServerMetadata,l.useAppBlossomServers),[l.blossomServerMetadata,l.useAppBlossomServers]),d=l.stripTrackingParams!==!1,f=(0,Z.useMemo)(()=>{let t=e.content,n=new Set(fr(e.tags).map(e=>e.url)),r=RegExp(`(?:lightning:)?(ln(?:bc|tb|bcrt|tbs)\\d*[munp]?1[023456789acdefghjklmnpqrstuvwxyz]+)|((?:https?|wss?):\\/\\/[^\\s]+)|nostr:(npub1|note1|nprofile1|nevent1|naddr1)([023456789acdefghjklmnpqrstuvwxyz]+)|(^|${Gc})@?(npub1|note1|nprofile1|nevent1|naddr1)([023456789acdefghjklmnpqrstuvwxyz]+)|(${zt})|(blossom:[a-f0-9]{64}\\.[a-z0-9]+(?:\\?[^\\s]*)?)`,`giu`),i=[],a=0,o,s=!1;for(;(o=r.exec(t))!==null;){let[e]=o,r=o[1],c=o[2],l=o[8],f=o[9],{3:p,4:m,5:h,6:g,7:_}=o,v=o.index;if(s=!0,h&&(v+=h.length,e=e.slice(h.length)),v>a&&i.push({type:`text`,value:t.substring(a,v)}),r)i.push({type:`lightning-invoice`,invoice:r.toLowerCase()});else if(c){let r=c.match(/^(.*?)([.,;:!?)\]]+)$/);if(r){let[,t]=r;t&&t.length>10&&(c=t,e=t)}if(d&&!n.has(c)&&(c=Ic(c)),/^wss?:\/\//i.test(c)){i.push({type:`relay-link`,url:c}),a=v+e.length;continue}if(fc.test(c)){if(i.length>0){let e=i[i.length-1];e.type===`text`&&(e.value=e.value.replace(/\s+$/,``))}i.push({type:`image-embed`,url:c}),a=v+e.length;let n=t.substring(a).match(/^\s+/);n&&(a+=n[0].length);continue}if(hc.test(c)){if(i.length>0){let e=i[i.length-1];e.type===`text`&&(e.value=e.value.replace(/\s+$/,``))}i.push({type:`media-embed`,url:c}),a=v+e.length;let n=t.substring(a).match(/^\s+/);n&&(a+=n[0].length);continue}let o=t.substring(v+e.length),s=o.indexOf(` `),l=(s===-1?o:o.substring(0,s)).trim()===``,u=Kc(c),f=fa(c);f?i.push({type:`armada-invite`,invite:f}):u?i.push({type:`naddr-embed`,addr:u,url:c}):l?i.push({type:`link-embed`,url:c}):i.push({type:`inline-link`,url:c})}else if(p&&m||g&&_){let t=p||g,n=m||_;try{let r=`${t}${n}`,a=F.decode(r);if(a.type===`npub`)i.push({type:`mention`,pubkey:a.data});else if(a.type===`nprofile`)i.push({type:`mention`,pubkey:a.data.pubkey});else if(a.type===`note`)i.push({type:`nevent-embed`,eventId:a.data});else if(a.type===`nevent`)i.push({type:`nevent-embed`,eventId:a.data.id,relays:a.data.relays,author:a.data.author});else if(a.type===`naddr`){let e=fa(r);e?i.push({type:`armada-invite`,invite:e}):i.push({type:`naddr-embed`,addr:a.data})}else i.push({type:`nostr-link`,id:r,raw:e})}catch{i.push({type:`text`,value:e})}}else if(l){let e=l.slice(1);i.push({type:`hashtag`,tag:e,raw:l})}else if(f){let n=Sc(f);if(n){if(i.length>0){let e=i[i.length-1];e.type===`text`&&(e.value=e.value.replace(/\s+$/,``))}if(vc(n.ext).startsWith(`image/`)){let[e]=Dc(n,u);e?i.push({type:`image-embed`,url:e}):i.push({type:`blossom-uri`,uri:n,raw:f})}else i.push({type:`blossom-uri`,uri:n,raw:f});a=v+e.length;let r=t.substring(a).match(/^\s+/);r&&(a+=r[0].length);continue}i.push({type:`text`,value:e})}a=v+e.length}a0){for(let e of i)if(e.type===`nevent-embed`){let t=l.get(e.eventId);t&&((!e.relays||e.relays.length===0)&&t.relay&&(e.relays=[t.relay]),!e.author&&t.author&&(e.author=t.author))}}if(new Set([1,11,1111]).has(e.kind)){let t=new Set(i.filter(e=>e.type===`media-embed`).map(e=>e.url));for(let{url:n,mime:r}of fr(e.tags)){let e=L(n);!e||t.has(e)||(r?.startsWith(`audio/`)||r?.startsWith(`video/`)||r===`application/x-webxdc`||r===`application/vnd.webxdc+zip`)&&i.push({type:`media-embed`,url:e})}}for(let e=0;e0){let t=i[e-1];t.type===`text`&&(t.value=t.value.replace(/\s+$/,``))}if(e0){let e=i[0];e.type===`text`&&(e.value=e.value.replace(/^\s+/,``));let t=i[i.length-1];t.type===`text`&&(t.value=t.value.replace(/\s+$/,``))}return i.filter(e=>!(e.type===`text`&&e.value===``))},[e,c,u,d]),{emojis:p}=br(),m=(0,Z.useMemo)(()=>{let t=Rt(e.tags);for(let e of p)t.has(e.shortcode)||t.set(e.shortcode,e.url);return t},[e.tags,p]),h=(0,Z.useMemo)(()=>mr(e.tags),[e.tags]),g=R(f.some(e=>e.type===`media-embed`)?e.pubkey:void 0).data?.metadata,_=(0,Z.useMemo)(()=>On(g,e.pubkey)??`Anonymous`,[g,e.pubkey]),v=(0,Z.useMemo)(()=>{let e=[],t=0;for(;t=2?e.push({type:`image-gallery`,urls:r}):e.push(n),t=i}else e.push(n),t++}return e},[f]),y=(0,Z.useMemo)(()=>v.flatMap(e=>e.type===`image-embed`?[e.url]:e.type===`image-gallery`?e.urls:[]),[v]),b=(0,Z.useMemo)(()=>y.map(e=>h.get(e)??{}),[y,h]),[x,S]=(0,Z.useState)(null),C=(0,Z.useCallback)(()=>S(null),[]),w=(0,Z.useCallback)(()=>S(e=>e===null?null:(e+1)%y.length),[y.length]),T=(0,Z.useCallback)(()=>S(e=>e===null?null:(e-1+y.length)%y.length),[y.length]),E=v.length===1&&v[0].type===`text`&&Qc(v[0].value,m),D=(0,Z.useMemo)(()=>{let e=new Map,t=0;return v.forEach((n,r)=>{n.type===`image-embed`?e.set(r,t++):n.type===`image-gallery`&&(e.set(r,t),t+=n.urls.length)}),e},[v]);return(0,Q.jsxs)(o,{dir:`auto`,...Er(e),className:z(`whitespace-pre-wrap break-words overflow-hidden`,t,E&&`text-5xl leading-tight`),children:[v.map((t,o)=>{switch(t.type){case`text`:return(0,Q.jsx)(`span`,{children:Yc(Vc(Uc(t.value,m,E?`inline h-12 w-12 object-contain align-text-bottom`:void 0),s))},o);case`image-embed`:{if(n||a)return null;let e=D.get(o)??0;return(0,Q.jsx)(el,{url:t.url,encryption:h.get(t.url)?.encryption,onClick:t=>{t.stopPropagation(),S(e)}},o)}case`image-gallery`:{if(n||a)return null;let e=D.get(o)??0,r=x!==null&&x>=e&&x{S(e+t)},onLightboxClose:C},o)}case`link-embed`:return n?(0,Q.jsx)(`a`,{href:t.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary hover:underline break-all`,onClick:e=>e.stopPropagation(),children:t.url},o):(0,Q.jsx)(Lo,{url:t.url,className:`my-2.5`,hideImage:r},o);case`inline-link`:return(0,Q.jsx)(`a`,{href:t.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary hover:underline break-all`,onClick:e=>e.stopPropagation(),children:t.url},o);case`media-embed`:{if(n||a)return null;let e=h.get(t.url),r=e?.mime??``,i=r===`application/x-webxdc`||r===`application/vnd.webxdc+zip`||t.url.endsWith(`.xdc`),s=r.startsWith(`audio/`)||/\.(mp3|mpga|wav|ogg|flac|m4a|aac|opus)(\?[^\s]*)?$/i.test(t.url);return i&&e?(0,Q.jsx)(Ys,{url:t.url,uuid:e.webxdc,name:e.summary,icon:e.thumbnail,encryption:e.encryption},o):(0,Q.jsx)(tl,{url:t.url,imeta:e,isAudio:s,authorMetadata:g,authorDisplayName:_},o)}case`nevent-embed`:if(i){let e=F.neventEncode({id:t.eventId,...t.author?{author:t.author}:{},...t.relays?.length?{relays:t.relays}:{}});return(0,Q.jsxs)(q,{to:`/${e}`,className:`text-primary hover:underline break-all`,onClick:e=>e.stopPropagation(),children:[e.slice(0,16),`…`]},o)}return(0,Q.jsx)(_l,{eventId:t.eventId,relays:t.relays,authorHint:t.author,fallbackAuthorHint:e.pubkey,className:`my-2.5`},o);case`naddr-embed`:if(i){let e=F.naddrEncode({kind:t.addr.kind,pubkey:t.addr.pubkey,identifier:t.addr.identifier});return(0,Q.jsxs)(q,{to:`/${e}`,className:`text-primary hover:underline break-all`,onClick:e=>e.stopPropagation(),children:[e.slice(0,16),`…`]},o)}return(0,Q.jsx)(La,{addr:t.addr,className:`my-2.5`,sourceUrl:t.url},o);case`armada-invite`:return(0,Q.jsx)(Na,{invite:t.invite},o);case`mention`:return(0,Q.jsx)(Jt,{pubkey:t.pubkey},o);case`nostr-link`:return(0,Q.jsx)(q,{to:`/${t.id}`,className:`text-primary hover:underline break-all`,onClick:e=>e.stopPropagation(),children:t.raw},o);case`hashtag`:return(0,Q.jsx)(q,{to:`/t/${t.tag}`,className:`text-primary hover:underline break-all`,onClick:e=>e.stopPropagation(),children:t.raw},o);case`relay-link`:return(0,Q.jsx)(q,{to:`/r/${encodeURIComponent(t.url)}`,className:`text-primary hover:underline break-all`,onClick:e=>e.stopPropagation(),children:t.url},o);case`lightning-invoice`:return n?(0,Q.jsx)(`span`,{className:`text-primary break-all`,children:t.invoice},o):(0,Q.jsx)(Zo,{invoice:t.invoice},o);case`blossom-uri`:return n||a?null:(0,Q.jsx)(nl,{uri:t.uri,raw:t.raw,artist:_,avatarUrl:g?.picture,avatarFallback:_[0]?.toUpperCase()??`?`,avatarShape:U(g)},o)}}),x!==null&&!v.some((e,t)=>e.type===`image-gallery`&&x>=(D.get(t)??0)&&x<(D.get(t)??0)+e.urls.length)&&(0,Q.jsx)(rc,{images:y,currentIndex:x,onClose:C,onNext:w,onPrev:T,mediaMeta:b})]})}function el({url:e,encryption:t,onClick:n}){let r=hr(e),i=pr(e,t),[a,o]=(0,Z.useState)(!1);return i.encrypted&&!i.src?(0,Q.jsx)(dr,{loading:i.loading,unsupported:i.unsupported,tooLarge:i.tooLarge,byteSize:i.byteSize,onDecryptAnyway:i.decryptAnyway}):(0,Q.jsx)(`button`,{type:`button`,className:`block my-2 rounded-lg overflow-hidden w-full cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-primary`,onClick:n,children:(0,Q.jsx)(`div`,{className:z(`relative w-full rounded-lg overflow-hidden`,!a&&`bg-muted`),style:a?void 0:{minHeight:200},children:(0,Q.jsx)(`img`,{src:i.encrypted?i.src:r.src,alt:``,className:`block w-full h-auto rounded-lg hover:opacity-90 transition-opacity`,loading:`lazy`,onLoad:()=>o(!0),onError:()=>{o(!0),i.encrypted||r.onError()},decoding:`async`})})})}function tl({url:e,imeta:t,isAudio:n,authorMetadata:r,authorDisplayName:i}){return n?(0,Q.jsx)(vs,{src:e,mime:t?.mime,encryption:t?.encryption,avatarUrl:r?.picture,avatarFallback:i[0]?.toUpperCase()??`?`,avatarShape:U(r)}):(0,Q.jsx)(_s,{src:e,poster:t?.thumbnail,encryption:t?.encryption,dim:t?.dim,blurhash:t?.blurhash,artist:i})}function nl({uri:e,raw:t,artist:n,avatarUrl:r,avatarFallback:i,avatarShape:a}){let{src:o,onError:s,failed:c}=Oc(e),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(!1),p=vc(e.ext),m=p.startsWith(`image/`)?`image`:p.startsWith(`video/`)?`video`:p.startsWith(`audio/`)?`audio`:`file`;return!o||c?(0,Q.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary hover:underline break-all`,onClick:e=>e.stopPropagation(),children:t}):m===`image`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`button`,{type:`button`,className:`block my-2 rounded-lg overflow-hidden w-full cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-primary`,onClick:e=>{e.stopPropagation(),f(!0)},children:(0,Q.jsx)(`div`,{className:z(`relative w-full rounded-lg overflow-hidden`,!l&&`bg-muted`),style:l?void 0:{minHeight:200},children:(0,Q.jsx)(`img`,{src:o,alt:``,className:`block w-full h-auto rounded-lg hover:opacity-90 transition-opacity`,loading:`lazy`,onLoad:()=>u(!0),onError:()=>{u(!0),s()},decoding:`async`})})}),d&&(0,Q.jsx)(rc,{images:[o],currentIndex:0,onClose:()=>f(!1),onNext:()=>{},onPrev:()=>{}})]}):m===`video`?(0,Q.jsx)(_s,{src:o,artist:n}):m===`audio`?(0,Q.jsx)(vs,{src:o,mime:p,avatarUrl:r,avatarFallback:i,avatarShape:a}):(0,Q.jsxs)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-2 my-2 px-3 py-2 rounded-lg border bg-muted/40 hover:bg-muted text-primary break-all`,onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Blossom file`}),(0,Q.jsxs)(`span`,{className:`text-muted-foreground text-sm`,children:[e.sha256.slice(0,8),`…`,e.ext?`.${e.ext}`:``,typeof e.size==`number`?` · ${rl(e.size)}`:``]})]})}function rl(e){if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=e/1024,r=0;for(;n>=1024&&re===`a`)?.[1];if(!t)return;let[n,r,...i]=t.split(`:`),a=Number(n);if(!(!Number.isFinite(a)||!V(r)))return{kind:a,pubkey:r,identifier:i.join(`:`)}}function al({event:e,className:t}){let n=(0,Z.useMemo)(()=>il(e),[e]),{data:r}=Nn(n),i=(0,Z.useMemo)(()=>n?F.naddrEncode({kind:n.kind,pubkey:n.pubkey,identifier:n.identifier}):void 0,[n]);if(!n||!i)return null;let a=r?.tags.find(([e])=>e===`title`)?.[1]?.trim()||`a live stream`;return(0,Q.jsxs)(`div`,{className:t||`flex items-center gap-1.5 text-sm text-muted-foreground mt-2 mb-1 min-w-0 overflow-hidden`,children:[(0,Q.jsx)(we,{className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`shrink-0`,children:`in`}),(0,Q.jsx)(q,{to:`/${i}`,className:`text-primary hover:underline truncate`,onClick:e=>e.stopPropagation(),children:a})]})}function ol(e){let t=e.tags.find(([e,t])=>e===`i`&&typeof t==`string`&&t.startsWith(`bitcoin:tx:`));if(!t?.[1])return null;let n=t[1].slice(11).toLowerCase();return/^[0-9a-f]{64}$/.test(n)?n:null}function sl(e){let t=e.tags.find(([e])=>e===`amount`);if(!t?.[1])return 0;let n=parseInt(t[1],10);return Number.isFinite(n)&&n>0?n:0}function cl(e){let t=new Set,n=[];for(let r of e.tags){if(r[0]!==`p`)continue;let e=r[1];!e||!V(e)||t.has(e)||(t.add(e),n.push(e))}return n}async function ll(e,t,n){let r=ol(e),i=cl(e);if(!r||i.length===0||i.includes(e.pubkey))return null;let{nostrPubkeyToBitcoinAddress:a}=await Me(async()=>{let{nostrPubkeyToBitcoinAddress:e}=await import(`./bitcoin-CZvT_Ikr.js`).then(e=>e.t);return{nostrPubkeyToBitcoinAddress:e}},__vite__mapDeps([164,1,13,6,103,96,165])),o=new Set;for(let e of i){let t=a(e);t&&o.add(t)}if(o.size===0)return null;let s=a(e.pubkey),c;try{c=await $n(r,t,n)}catch{return null}let l=c.outputs.filter(e=>e.address!==s&&o.has(e.address??``)).reduce((e,t)=>e+t.value,0);if(l===0)return null;let u=sl(e),d=Math.min(u||l,l);return{event:e,txid:r,senderPubkey:e.pubkey,recipientPubkey:i[0],recipientPubkeys:i,amountSats:d,claimedAmountSats:u,comment:e.content,createdAt:e.created_at,confirmed:c.confirmed}}function ul(e){let{nostr:t}=Fe(),{config:n}=ft(),{esploraApis:r}=n,i=e&&e.kind>=3e4&&e.kind<4e4,a=i?e.tags.find(([e])=>e===`d`)?.[1]??``:``,o=i&&e?`${e.kind}:${e.pubkey}:${a}`:``,s=I({queryKey:[`onchain-zaps`,`events`,e?.id??``,o],queryFn:async({signal:n})=>{if(!e)return[];let r=AbortSignal.timeout(5e3),i=AbortSignal.any([n,r]),a=[{kinds:[8333],"#e":[e.id],limit:100}];o&&a.push({kinds:[8333],"#a":[o],limit:100});let s=await t.query(a,{signal:i}),c=new Map;for(let e of s)c.set(e.id,e);let l=new Map;for(let e of c.values()){let t=ol(e);if(!t)continue;let n=l.get(t);(!n||e.created_at({queryKey:[`onchain-zaps`,`verify`,r,ol(e),cl(e).slice().sort().join(`,`)],queryFn:({signal:t})=>ll(e,r,t),staleTime:6e4}))}),l=c.map(e=>e.data).filter(e=>!!e);l.sort((e,t)=>t.amountSats-e.amountSats);let u=l.reduce((e,t)=>e+t.amountSats,0),d=s.isLoading||c.some(e=>e.isLoading);return{zaps:l,totalSats:u,count:l.length,isLoading:d}}function dl(e){let{config:t}=ft(),{esploraApis:n}=t,r=e?ol(e):null,i=e?cl(e):[],{data:a}=I({queryKey:[`onchain-zaps`,`verify`,n,r,i.slice().sort().join(`,`)],queryFn:({signal:t})=>ll(e,n,t),enabled:!!e&&!!r&&i.length>0,staleTime:6e4});return e?a:null}function fl(){let{config:e}=ft(),t=e.currencyDisplay??`usd`,n=(0,Z.useRef)(!1),[r,i]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{n.current&&!r&&i(!0)});let{data:a}=I({queryKey:[`btc-price`,e.esploraApis],queryFn:({signal:t})=>tr(e.esploraApis,t),staleTime:6e4,retry:1,enabled:t===`usd`&&r,select:e=>Math.round(e/10)*10});return{format:(0,Z.useCallback)((e,r)=>{let i=r?.layout??`long`;return t===`usd`&&Number.isFinite(e)&&e>0&&(n.current=!0),t===`usd`&&a&&Number.isFinite(a)&&a>0?er(e,a):i===`compact`?lr(e):`${lr(e)} ${e===1?`sat`:`sats`}`},[t,a]),currency:t,btcPrice:a}}function pl(e){let t=(0,Z.useMemo)(()=>e.kind===1018?e.tags.find(([e])=>e===`e`):void 0,[e]),n=t?.[1],r=t?.[2]||void 0,i=t?.[4]||(e.kind===1018?e.tags.find(([e])=>e===`p`)?.[1]:void 0)||void 0,{data:a}=Pn(n,r?[r]:void 0,i);return(0,Z.useMemo)(()=>{let t=e.kind===1018?e.tags.filter(([e])=>e===`response`).map(([,e])=>e):[];if(t.length===0)return``;if(!a)return t.join(`, `);let n=new Map;for(let e of a.tags)e[0]===`option`&&n.set(e[1],e[2]);return t.map(e=>n.get(e)??e).join(`, `)},[e,a])}var ml=(0,Z.lazy)(()=>Me(()=>import(`./BlobbiStateCard-DnVg3tNE.js`).then(e=>({default:e.BlobbiStateCard})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163]))),hl=62,gl=260;function _l(e){return(0,Q.jsx)(je,{fallback:(0,Q.jsx)(Ar,{compact:!0,className:e.className}),sentryLevel:`error`,sentryTags:{errorBoundary:`embedded-note`,eventId:e.eventId},resetKeys:[e.eventId],children:(0,Q.jsx)(vl,{...e})})}function vl({eventId:e,relays:t,authorHint:n,fallbackAuthorHint:r,className:i,disableHoverCards:a,highlightText:o}){let s=n??r,{data:c,isLoading:l,isError:u}=Pn(e,t,s);return l?(0,Q.jsx)(Ml,{className:i}):u||!c?(0,Q.jsx)(Al,{eventId:e,relays:t,authorHint:s,className:i}):c.kind===hl?(0,Q.jsx)(kl,{event:c,className:i}):c.kind===4?(0,Q.jsx)(Rr,{event:c,className:i}):c.kind===8211?(0,Q.jsx)(Kr,{event:c,className:i}):c.kind===15683?(0,Q.jsx)(_i,{event:c,className:i}):Kt(c)?(0,Q.jsx)(Va,{event:c,className:i}):c.kind===9735?(0,Q.jsx)(Tl,{event:c,className:i,disableHoverCards:a}):c.kind===8333?(0,Q.jsx)(El,{event:c,className:i,disableHoverCards:a}):c.kind===8?(0,Q.jsx)(wl,{event:c,className:i,disableHoverCards:a}):c.kind===9802?(0,Q.jsx)(bl,{event:c,className:i,disableHoverCards:a}):c.kind===1311?(0,Q.jsx)(yl,{event:c,className:i,disableHoverCards:a}):c.kind===31871?(0,Q.jsx)(Li,{event:c,className:i,disableHoverCards:a}):c.kind===7849?(0,Q.jsx)(xl,{event:c,className:i,disableHoverCards:a}):c.kind===1068?(0,Q.jsx)(Sl,{event:c,className:i,disableHoverCards:a}):c.kind===1018?(0,Q.jsx)(Cl,{event:c,className:i,disableHoverCards:a}):dn.has(c.kind)?(0,Q.jsx)(Nr,{event:c,className:i,disableHoverCards:a}):c.kind===38192?(0,Q.jsx)(Di,{event:c,className:i,disableHoverCards:a}):In(c.kind)?(0,Q.jsx)(yi,{event:c,className:i,disableHoverCards:a}):c.kind===10002?(0,Q.jsx)(Ti,{event:c,className:i,disableHoverCards:a}):c.kind===0?(0,Q.jsx)(Ei,{event:c,className:i,disableHoverCards:a}):c.kind===30402&&Ki(c)?(0,Q.jsx)(qi,{event:c,className:i,disableHoverCards:a}):Xn.has(c.kind)?(0,Q.jsx)(Yn,{event:c,className:i,disableHoverCards:a}):Zn.has(c.kind)?(0,Q.jsx)(Qn,{event:c,className:i,disableHoverCards:a}):(0,Q.jsx)(Dl,{event:c,className:i,disableHoverCards:a,highlightText:o})}function yl({event:e,className:t,disableHoverCards:n}){let r=(0,Z.useMemo)(()=>F.neventEncode({id:e.id,author:e.pubkey}),[e.id,e.pubkey]),i=e.content.trim();return(0,Q.jsxs)($,{pubkey:e.pubkey,createdAt:e.created_at,navigateTo:r,className:t,disableHoverCards:n,children:[(0,Q.jsx)(al,{event:e,className:`flex items-center gap-1.5 text-xs text-muted-foreground min-w-0 overflow-hidden`}),i?(0,Q.jsx)(`p`,{className:`text-sm whitespace-pre-wrap break-words line-clamp-4 text-foreground`,children:i}):(0,Q.jsx)(`p`,{className:`text-xs italic text-muted-foreground`,children:`Live chat message`})]})}function bl({event:e,className:t,disableHoverCards:n}){let r=(0,Z.useMemo)(()=>F.neventEncode({id:e.id,author:e.pubkey}),[e.id,e.pubkey]),i=e.content.trim(),a=i.length>0;return(0,Q.jsxs)($,{pubkey:e.pubkey,createdAt:e.created_at,navigateTo:r,className:t,disableHoverCards:n,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:[(0,Q.jsx)(S,{className:`size-3`}),`Highlight`]}),a?(0,Q.jsx)(`blockquote`,{className:`relative rounded-r-lg border-l-[3px] border-primary/70 bg-primary/5 pl-3 pr-2 py-2`,children:(0,Q.jsx)(`p`,{className:`font-serif text-[14px] leading-relaxed whitespace-pre-wrap break-words line-clamp-4 text-foreground`,children:i})}):(0,Q.jsx)(`p`,{className:`text-xs italic text-muted-foreground`,children:`Highlighted media`})]})}function xl({event:e,className:t,disableHoverCards:n}){let r=(0,Z.useMemo)(()=>F.neventEncode({id:e.id,author:e.pubkey}),[e.id,e.pubkey]),i=(0,Z.useMemo)(()=>ar(e),[e]),a=i?i.outcomes.length>0?i.outcomes.map(e=>e.label).join(`, `):i.scores.map(e=>`${e.label??e.dimension}: ${e.value}`).join(` · `):void 0,o=i?.outcomes.find(e=>e.image)?.image;return(0,Q.jsxs)($,{pubkey:e.pubkey,createdAt:e.created_at,navigateTo:r,className:t,disableHoverCards:n,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:[(0,Q.jsx)(h,{className:`size-3`}),`Quiz result`]}),i?.comment&&(0,Q.jsx)(`p`,{className:`text-sm whitespace-pre-wrap break-words line-clamp-2 text-foreground`,children:i.comment}),o&&(0,Q.jsx)(`img`,{src:o,alt:``,loading:`lazy`,decoding:`async`,className:`max-h-32 w-full rounded-lg border object-cover`}),a?(0,Q.jsx)(`p`,{className:`text-base font-bold text-foreground line-clamp-2`,children:a}):(0,Q.jsx)(`p`,{className:`text-xs italic text-muted-foreground`,children:`Took a quiz`})]})}function Sl({event:e,className:t,disableHoverCards:n}){let r=(0,Z.useMemo)(()=>F.neventEncode({id:e.id,author:e.pubkey}),[e.id,e.pubkey]),i=(0,Z.useMemo)(()=>e.tags.filter(([e])=>e===`option`).map(([,,e])=>(e??``).trim()).filter(e=>e.length>0),[e.tags]),a=e.tags.find(([e])=>e===`polltype`)?.[1]??`singlechoice`,o=e.tags.find(([e])=>e===`endsAt`)?.[1],s=o?Number(o):void 0,c=typeof s==`number`&&Number.isFinite(s)&&s0&&(0,Q.jsx)(`div`,{className:`text-sm leading-relaxed font-medium break-words`,children:(0,Q.jsx)($c,{event:e,disableMediaEmbeds:!0,disableNoteEmbeds:!0})}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] font-medium text-muted-foreground bg-secondary/60 px-2 py-0.5 rounded-full`,children:[(0,Q.jsx)(f,{className:`size-3`}),a===`multiplechoice`?`Multiple choice`:`Poll`]}),c&&(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] font-medium text-muted-foreground bg-secondary/60 px-2 py-0.5 rounded-full`,children:[(0,Q.jsx)(le,{className:`size-3`}),`Ended`]})]}),l.length>0&&(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[l.map((e,t)=>(0,Q.jsx)(`div`,{className:`rounded-md border border-border px-2.5 py-1.5 text-xs text-foreground bg-secondary/20 break-words line-clamp-1`,children:e},t)),u>0&&(0,Q.jsxs)(`p`,{className:`text-[11px] text-muted-foreground pl-1`,children:[`+`,u,` more option`,u===1?``:`s`]})]})]})}function Cl({event:e,className:t,disableHoverCards:n}){let r=(0,Z.useMemo)(()=>F.neventEncode({id:e.id,author:e.pubkey}),[e.id,e.pubkey]),i=pl(e);return(0,Q.jsxs)($,{pubkey:e.pubkey,createdAt:e.created_at,navigateTo:r,className:t,disableHoverCards:n,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:[(0,Q.jsx)(f,{className:`size-3`}),`Poll vote`]}),i?(0,Q.jsx)(`p`,{className:`text-sm font-semibold leading-snug line-clamp-2 break-words`,children:i}):(0,Q.jsx)(`p`,{className:`text-xs italic text-muted-foreground`,children:`Voted`})]})}function wl({event:e,className:t,disableHoverCards:n}){let r=K(),i=(0,Z.useMemo)(()=>F.neventEncode({id:e.id,author:e.pubkey}),[e.id,e.pubkey]),a=(0,Z.useMemo)(()=>Ht(e),[e]),o=a&&a.pubkey===e.pubkey?a:void 0,{badgeMap:s}=qt((0,Z.useMemo)(()=>o?[o]:[],[o])),c=o?`${Gt}:${o.pubkey}:${o.identifier}`:void 0,l=c?s.get(c):void 0,u=l?.name||(o?Xt(o.identifier):`Badge`),d=R(e.pubkey),f=d.data?.metadata,p=f?.name||f?.display_name||`Anonymous`,m=J(e.pubkey,f);return(0,Q.jsx)(`div`,{className:z(`group block rounded-2xl border border-border overflow-hidden`,`hover:bg-secondary/40 transition-colors cursor-pointer`,t),role:`link`,tabIndex:0,onClick:e=>{e.stopPropagation(),r(`/${i}`)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),r(`/${i}`))},children:(0,Q.jsxs)(`div`,{className:`px-3 py-2.5 flex items-center gap-2.5 min-w-0`,children:[l?(0,Q.jsx)(Zt,{badge:l,size:36,className:`shrink-0`}):(0,Q.jsx)(`div`,{className:`flex items-center justify-center size-9 rounded-lg bg-gradient-to-br from-primary/10 via-primary/5 to-transparent shrink-0`,children:(0,Q.jsx)(N,{className:`size-4 text-primary`})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,Q.jsx)(jl,{pubkey:e.pubkey,disabled:n,children:(0,Q.jsx)(q,{to:m,className:`text-sm font-semibold truncate hover:underline`,onClick:e=>e.stopPropagation(),children:d.data?.event?(0,Q.jsx)(Bt,{tags:d.data.event.tags,children:p}):p})}),(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`awarded a badge`}),(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:[`· `,Dn(e.created_at)]})]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground truncate mt-0.5`,children:u})]})]})})}function Tl({event:e,className:t,disableHoverCards:n}){let r=K(),i=(0,Z.useMemo)(()=>F.neventEncode({id:e.id,author:e.pubkey}),[e.id,e.pubkey]),a=(0,Z.useMemo)(()=>hn(e),[e]),o=(0,Z.useMemo)(()=>Math.floor(_n(e)/1e3),[e]),s=(0,Z.useMemo)(()=>pn(e),[e]),c=R(a||void 0),l=c.data?.metadata,u=l?.name||l?.display_name||(a?`Anonymous`:`Someone`),d=U(l),f=J(a,l),{format:p}=fl();return(0,Q.jsx)(`div`,{className:z(`group block rounded-2xl border border-border overflow-hidden`,`hover:bg-secondary/40 transition-colors cursor-pointer`,t),role:`link`,tabIndex:0,onClick:e=>{e.stopPropagation(),r(`/${i}`)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),r(`/${i}`))},children:(0,Q.jsxs)(`div`,{className:`px-3 py-2.5 flex items-center gap-2.5 min-w-0`,children:[(0,Q.jsx)(`div`,{className:`flex items-center justify-center size-9 rounded-full bg-amber-500/10 shrink-0`,children:(0,Q.jsx)(ge,{className:`size-4 text-amber-500 fill-amber-500`})}),a&&(0,Q.jsx)(jl,{pubkey:a,disabled:n,children:(0,Q.jsx)(q,{to:f,className:`shrink-0`,onClick:e=>e.stopPropagation(),children:(0,Q.jsxs)(G,{shape:d,className:`size-5`,children:[(0,Q.jsx)(W,{src:l?.picture,alt:u}),(0,Q.jsx)(H,{className:`bg-primary/20 text-primary text-[10px]`,children:u[0]?.toUpperCase()})]})})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[a?(0,Q.jsx)(jl,{pubkey:a,disabled:n,children:(0,Q.jsx)(q,{to:f,className:`text-sm font-semibold truncate hover:underline`,onClick:e=>e.stopPropagation(),children:c.data?.event?(0,Q.jsx)(Bt,{tags:c.data.event.tags,children:u}):u})}):(0,Q.jsx)(`span`,{className:`text-sm font-semibold truncate`,children:`Someone`}),(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`zapped`}),o>0&&(0,Q.jsx)(`span`,{className:`text-sm font-semibold text-amber-500 shrink-0`,children:p(o)}),(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:[`· `,Dn(e.created_at)]})]}),s&&(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground italic mt-0.5 line-clamp-2`,children:[`“`,s,`”`]})]})]})})}function El({event:e,className:t,disableHoverCards:n}){let r=K(),i=(0,Z.useMemo)(()=>F.neventEncode({id:e.id,author:e.pubkey}),[e.id,e.pubkey]),a=e.pubkey,o=(0,Z.useMemo)(()=>sl(e),[e]),s=(0,Z.useMemo)(()=>cl(e),[e]),c=s.length>1,l=dl(e),u=l?.amountSats??o,d=l===void 0,f=l===null,p=e.content,m=R(a),h=m.data?.metadata,g=h?.name||h?.display_name||`Anonymous`,_=U(h),v=J(a,h),{format:y}=fl();return(0,Q.jsx)(`div`,{className:z(`group block rounded-2xl border border-border overflow-hidden`,`hover:bg-secondary/40 transition-colors cursor-pointer`,t),role:`link`,tabIndex:0,onClick:e=>{e.stopPropagation(),r(`/${i}`)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),r(`/${i}`))},children:(0,Q.jsxs)(`div`,{className:`px-3 py-2.5 flex items-center gap-2.5 min-w-0`,children:[(0,Q.jsx)(`div`,{className:`flex items-center justify-center size-9 rounded-full bg-amber-500/10 shrink-0`,children:(0,Q.jsx)(ge,{className:`size-4 text-amber-500 fill-amber-500`})}),(0,Q.jsx)(jl,{pubkey:a,disabled:n,children:(0,Q.jsx)(q,{to:v,className:`shrink-0`,onClick:e=>e.stopPropagation(),children:(0,Q.jsxs)(G,{shape:_,className:`size-5`,children:[(0,Q.jsx)(W,{src:h?.picture,alt:g}),(0,Q.jsx)(H,{className:`bg-primary/20 text-primary text-[10px]`,children:g[0]?.toUpperCase()})]})})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,Q.jsx)(jl,{pubkey:a,disabled:n,children:(0,Q.jsx)(q,{to:v,className:`text-sm font-semibold truncate hover:underline`,onClick:e=>e.stopPropagation(),children:m.data?.event?(0,Q.jsx)(Bt,{tags:m.data.event.tags,children:g}):g})}),(0,Q.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[`zapped`,c&&` ${s.length} people`]}),c&&(0,Q.jsx)(eo,{pubkeys:s,size:`sm`,maxVisible:4,className:`shrink-0`}),u>0&&(0,Q.jsx)(`span`,{className:`text-sm font-semibold text-amber-500 shrink-0`,children:y(u)}),f?(0,Q.jsx)(`span`,{className:`text-[11px] text-muted-foreground shrink-0`,children:`· unverified`}):d?(0,Q.jsx)(`span`,{className:`text-[11px] text-muted-foreground shrink-0`,children:`· verifying…`}):null,(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:[`· `,Dn(e.created_at)]})]}),p&&(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground italic mt-0.5 line-clamp-2`,children:[`“`,p,`”`]})]})]})})}function Dl({event:e,className:n,disableHoverCards:r,highlightText:i}){let{config:a}=ft(),o=(0,Z.useMemo)(()=>F.neventEncode({id:e.id,author:e.pubkey}),[e.id,e.pubkey]),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),d=e.kind===31124,f=e.kind===20,p=e.kind===21||e.kind===22||e.kind===34236,m=e.kind===1||e.kind===11||e.kind===1111||f,h=(0,Z.useMemo)(()=>d?{imgs:0,vids:0,auds:0,apps:0,links:0,photos:0}:f?{imgs:0,vids:0,auds:0,apps:0,links:0,photos:e.tags.filter(([e])=>e===`imeta`).length}:{imgs:(e.content.match(new RegExp(fc.source,`gi`))||[]).length,vids:yc(e.content).length,auds:bc(e.content).length,apps:(e.content.match(/https?:\/\/[^\s]+\.xdc(\?[^\s]*)?/gi)||[]).length,links:(e.content.match(/https?:\/\/[^\s]+/g)||[]).filter(e=>!_c.test(e)).length,photos:0},[e.content,e.tags,f,d]),g=(0,Z.useMemo)(()=>mr(e.tags),[e.tags]),_=(0,Z.useMemo)(()=>{if(d)return{images:[]};if(f)return{images:fr(e.tags).map(e=>L(e.url)).filter(e=>!!e)};if(p)return{images:[],video:fr(e.tags).map(e=>L(e.url)).find(e=>!!e)};let t=(e.content.match(new RegExp(fc.source,`gi`))||[]).map(e=>L(e)).filter(e=>!!e),n=yc(e.content).map(e=>L(e)).filter(e=>!!e);return{images:t,video:t.length===0?n[0]:void 0}},[e.content,e.tags,f,d,p]),v=_.images.length>0||!!_.video,y=(0,Z.useMemo)(()=>{let t=cr(e.kind);if(t)return{label:t,Icon:or(e.kind)}},[e.kind]),b=e.content.trim().length>0,x=(0,Z.useMemo)(()=>{if(m&&b||(f||p)&&v)return;let t=sr(e);if(t)return{title:t,description:void 0}},[m,b,f,p,v,e]),S=p&&v,C=!m&&!d&&!x&&!y&&!S,w=!m&&!d&&!x&&!!y&&!S,E=e.tags.find(([e])=>e===`content-warning`),D=!!E;if(D&&a.contentWarningPolicy===`hide`)return null;let O=v&&!d&&!x&&!C&&!w&&!(D&&a.contentWarningPolicy===`blur`),ee=!D&&(h.photos>0||h.imgs>0||h.vids>0||h.auds>0||h.apps>0||h.links>0||y&&!w)||s;return(0,Q.jsxs)($,{pubkey:e.pubkey,createdAt:e.created_at,navigateTo:o,className:n,disableHoverCards:r,children:[D&&a.contentWarningPolicy===`blur`?(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground italic`,children:[`Content warning`,E?.[1]?(0,Q.jsxs)(Q.Fragment,{children:[` `,`“`,E[1],`”`]}):``]}):d?(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(X,{className:`h-24 w-full rounded-lg`}),children:(0,Q.jsx)(ml,{event:e})}):x?(0,Q.jsxs)(Q.Fragment,{children:[x.title&&(0,Q.jsx)(`p`,{className:`text-sm font-semibold leading-snug line-clamp-2`,children:x.title}),x.description&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed line-clamp-3`,children:x.description})]}):w&&y?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 py-1 text-muted-foreground`,children:[y.Icon&&(0,Q.jsx)(y.Icon,{className:`size-4 shrink-0`}),(0,Q.jsx)(`span`,{className:`text-sm font-medium capitalize`,children:y.label})]}):C?(0,Q.jsxs)(`p`,{className:`text-sm italic text-muted-foreground`,children:[`Kind `,e.kind,` · not supported`]}):(0,Q.jsxs)(Q.Fragment,{children:[p&&(()=>{let t=e.tags.find(([e])=>e===`title`)?.[1];return t?(0,Q.jsx)(`p`,{className:`text-sm font-semibold leading-snug line-clamp-2`,children:t}):null})(),(0,Q.jsx)(Ol,{event:e,expanded:l,onOverflowChange:c,highlightText:i}),O&&(0,Q.jsx)(`div`,{onClick:e=>e.stopPropagation(),children:_.images.length>0?(0,Q.jsx)($s,{images:_.images,maxVisible:4,maxGridHeight:`320px`,imetaMap:g,className:`mt-1.5`}):_.video?(0,Q.jsx)(`div`,{className:`mt-1.5 overflow-hidden rounded-2xl`,children:(0,Q.jsx)(_s,{src:_.video,poster:g.get(_.video)?.thumbnail,encryption:g.get(_.video)?.encryption,dim:g.get(_.video)?.dim,blurhash:g.get(_.video)?.blurhash})}):null})]}),ee&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[y&&!w&&(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[y.Icon&&(0,Q.jsx)(y.Icon,{className:`size-3 shrink-0`}),y.label]}),h.photos>0&&(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,Q.jsx)(Te,{className:`size-3`}),h.photos>1?`${h.photos} photos`:`Photo`]}),h.imgs>0&&(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,Q.jsx)(Te,{className:`size-3`}),h.imgs>1?`${h.imgs} images`:`Image`]}),h.vids>0&&(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,Q.jsx)(t,{className:`size-3`}),h.vids>1?`${h.vids} videos`:`Video`]}),h.auds>0&&(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,Q.jsx)(T,{className:`size-3`}),h.auds>1?`${h.auds} audio files`:`Audio`]}),h.apps>0&&(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,Q.jsx)(be,{className:`size-3`}),`App`]}),h.links>0&&(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,Q.jsx)(de,{className:`size-3`}),h.links>1?`${h.links} links`:`Link`]}),s&&(0,Q.jsx)(`button`,{className:`ml-auto text-xs text-primary hover:underline shrink-0`,onClick:e=>{e.stopPropagation(),u(e=>!e)},children:l?`Show less`:`Read more`})]})]})}function Ol({event:e,expanded:t,onOverflowChange:n,highlightText:r}){let i=(0,Z.useRef)(null),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(0),l=(0,Z.useCallback)(()=>{let e=i.current;if(!e)return;let t=e.scrollHeight>gl;if(o(t),n(t),!t||!r){c(0);return}let a=e.querySelector(`mark`);if(!a){c(0);return}let s=e.getBoundingClientRect().top,l=a.getBoundingClientRect(),u=l.top-s,d=l.bottom-s;if(d<=gl){c(0);return}let f=d-u,p=f>=gl?u:u-(gl-f)/2,m=e.scrollHeight-gl;c(Math.max(0,Math.min(p,m)))},[n,r]);(0,Z.useEffect)(()=>(l(),window.addEventListener(`resize`,l),()=>window.removeEventListener(`resize`,l)),[l]),(0,Z.useEffect)(()=>{let e=i.current;if(!e)return;let t=e.querySelectorAll(`img`);if(t.length!==0)return t.forEach(e=>e.addEventListener(`load`,l,{once:!0})),()=>t.forEach(e=>e.removeEventListener(`load`,l))},[l]);let u=!t&&a,d=u?s:0;return(0,Q.jsxs)(`div`,{className:`relative overflow-hidden`,style:u?{maxHeight:gl}:void 0,children:[(0,Q.jsx)(`div`,{style:d>0?{marginTop:-d}:void 0,children:(0,Q.jsx)(`div`,{ref:i,children:(0,Q.jsx)($c,{event:e,className:`text-sm leading-relaxed`,disableMediaEmbeds:!0,disableNoteEmbeds:!0,highlightText:r})})}),u&&d>0&&(0,Q.jsx)(`div`,{className:`absolute top-0 left-0 right-0 h-8 bg-gradient-to-b from-background to-transparent pointer-events-none`}),u&&(0,Q.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 h-10 bg-gradient-to-t from-background to-transparent pointer-events-none`})]})}function kl({event:e,className:t}){let n=K(),r=(0,Z.useMemo)(()=>F.neventEncode({id:e.id,author:e.pubkey}),[e.id,e.pubkey]);return(0,Q.jsx)(`div`,{className:z(`group cursor-pointer`,t),role:`link`,tabIndex:0,onClick:e=>{e.stopPropagation(),n(`/${r}`)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),n(`/${r}`))},children:(0,Q.jsx)(Pr,{event:e,timestamp:Dn(e.created_at),className:`rounded-2xl group-hover:border-red-500/50 transition-colors`})})}function Al({eventId:e,relays:t,authorHint:r,className:i}){let a=K(),o=(0,Z.useMemo)(()=>F.neventEncode({id:e,...r?{author:r}:{},...t?.length?{relays:t}:{}}),[e,r,t]);return(0,Q.jsx)(`div`,{className:z(`rounded-2xl border border-dashed border-border overflow-hidden`,`hover:bg-secondary/40 transition-colors cursor-pointer`,i),role:`link`,tabIndex:0,onClick:e=>{e.stopPropagation(),a(`/${o}`)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),a(`/${o}`))},children:(0,Q.jsxs)(`div`,{className:`px-3.5 py-4 flex items-center gap-2 text-muted-foreground`,children:[(0,Q.jsx)(n,{className:`size-4 shrink-0`}),(0,Q.jsx)(`span`,{className:`text-sm`,children:`This post could not be loaded`})]})})}function jl({pubkey:e,disabled:t,children:n}){return t?(0,Q.jsx)(Q.Fragment,{children:n}):(0,Q.jsx)(Y,{pubkey:e,asChild:!0,children:n})}function Ml({className:e}){return(0,Q.jsx)(`div`,{className:z(`rounded-2xl border border-border overflow-hidden`,e),children:(0,Q.jsxs)(`div`,{className:`px-3.5 py-2.5 space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(X,{className:`size-5 rounded-full`}),(0,Q.jsx)(X,{className:`h-3.5 w-24`}),(0,Q.jsx)(X,{className:`h-3 w-10`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(X,{className:`h-3.5 w-full`}),(0,Q.jsx)(X,{className:`h-3.5 w-4/5`})]})]})})}export{Ri as $,vs as A,Oo as B,nc as C,Ks as D,Ys as E,ds as F,uo as G,No as H,us as I,La as J,oo as K,qo as L,ms as M,ps as N,Es as O,fs as P,Yi as Q,Lo as R,$s as S,Qs as T,Po as U,Fo as V,Eo as W,ca as X,Na as Y,Qi as Z,gc as _,Er as _t,cl as a,Ci as at,yc as b,al as c,Yr as ct,zc as d,Lr as dt,Gi as et,Tc as f,Pr as ft,dc as g,Or as gt,Cc as h,kr as ht,sl as i,Oi as it,_s as j,bs as k,$c as l,$r as lt,Dc as m,Ar as mt,pl as n,Ki as nt,ul as o,gi as ot,wc as p,Fr as pt,eo as q,fl as r,Ii as rt,dl as s,qr as st,_l as t,Ui as tt,Ic as u,Gr as ut,_c as v,wr as vt,rc as w,vc as x,bc as y,Io as z};