const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/EmojiPicker-Bj-YkY3r.js","assets/rolldown-runtime-QTnfLwEv.js","assets/lucide-icons-BjbcRgLk.js","assets/jsx-runtime-By8HlURe.js","assets/useTheme-DAiZ1C6g.js","assets/useQuery-CQCUTxAw.js","assets/useAppContext-ZpOJAKgd.js","assets/useEncryptedSettings-Mj6Bzp-m.js","assets/dist-DPmmj29U.js","assets/esm-CRVqHnq2.js","assets/sha256-Cx9u8cje.js","assets/useMutation-Du3NQIud.js","assets/fetchFreshEvent-Kkz3MzZN.js","assets/useCurrentUser-boOMG5Xx.js","assets/preload-helper-CZgWQFsJ.js","assets/dist-DQ_zK-Nr.js","assets/fontLoader-B9KxicFi.js","assets/sanitizeUrl-Bk5f35GN.js","assets/useNostrPublish-D1pQ9KV-.js","assets/useIsMobile-brkrNavj.js","assets/native-GDBYL4Zp.js","assets/webxdcMeta-BE41E4P0.js","assets/browser-C1AyMpfR.js"])))=>i.map(i=>d[i]); import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{Cn as n,Ct as r,En as i,G as a,Gr as o,J as s,Jr as c,Ln as l,Lt as u,Nn as d,Ot as f,T as p,U as m,Zt as h,a as g,b as _,bi as v,br as y,cn as b,di as x,fr as S,gr as C,hn as w,j as ee,ki as T,kr as te,kt as ne,l as re,lr as E,lt as ie,mt as ae,qr as oe,rn as se,s as ce,si as D,tn as le,wi as ue,x as de,xt as fe,yi as O}from"./lucide-icons-BjbcRgLk.js";import{t as k}from"./react-dom-B3NAB_6u.js";import{t as A}from"./jsx-runtime-By8HlURe.js";import{t as pe}from"./preload-helper-CZgWQFsJ.js";import{O as j,T as me,b as he,f as M,t as ge,w as N}from"./dist-DPmmj29U.js";import{u as P}from"./esm-CRVqHnq2.js";import{h as _e,t as F}from"./useQuery-CQCUTxAw.js";import{t as ve}from"./useMutation-Du3NQIud.js";import{B as ye,H as be,J as xe,K as Se,R as I,U as Ce,V as L,W as we,_ as Te,b as Ee,d as De,f as Oe,l as ke,p as Ae,t as je,v as Me,w as R,x as Ne,y as Pe,z as Fe}from"./EmbeddedNote-BIqVJ_l6.js";import{t as Ie}from"./useLocalStorage-CLIGOX6B.js";import{t as Le}from"./useAppContext-ZpOJAKgd.js";import{r as Re}from"./sanitizeUrl-Bk5f35GN.js";import{t as ze}from"./useLanguage--9xPt4K_.js";import"./encryptedFile-DKFYUsvG.js";import{l as Be,s as Ve,t as He}from"./useCurrentUser-boOMG5Xx.js";import{t as z}from"./utils-BFSTDHdM.js";import{n as Ue}from"./dist-DvXXZeEa.js";import{t as We}from"./dist-DEYuuXMO.js";import{t as Ge}from"./button-PfnADMEc.js";import{t as Ke}from"./useNostrPublish-D1pQ9KV-.js";import{t as B}from"./nostrId-DcIQ4FCD.js";import{n as qe}from"./appRelays-Clm5NPIe.js";import{n as Je,o as Ye,r as Xe,t as Ze}from"./avatar-BQAt2c6L.js";import{n as V}from"./chunk-62JRHF6Z-BC2Zeguv.js";import{r as Qe}from"./customEmoji-kpim4Htm.js";import{n as $e}from"./hashtag-DjDKS0mr.js";import{n as et,r as tt,t as H}from"./CustomEmoji-I2Dzbi7x.js";import{n as nt,t as rt}from"./useProfileUrl-CaWgk1iO.js";import{b as it}from"./BioContent-DDUa8M5F.js";import{r as at,t as ot}from"./dist-D7Bu0-nC.js";import{t as st}from"./dist-CcIWO21i2.js";import{t as U}from"./dist-CPSwqoBy.js";import{t as ct}from"./dist-BiDubxw8.js";import{t as W}from"./ExternalFavicon-C4RKLGFC.js";import{i as lt,n as ut,r as dt}from"./haptics-Cp_uF-bV.js";import{t as ft}from"./parseAddr-CsIsUI6W.js";import{t as pt}from"./input-CspJi8Oq.js";import{t as G}from"./dist-CxcvWxxD2.js";import{n as mt,t as K}from"./dist-CDe9cWnA.js";import{t as ht}from"./dist-VfIIxYhK.js";import{t as gt}from"./usePortalContainer-DQGL8y5W.js";import{i as _t,r as vt,t as yt}from"./popover-CpFQm40Y.js";import{t as q}from"./skeleton-CVls4GW9.js";import{t as bt}from"./useUploadFile-geM_X2W-.js";import{n as xt}from"./safeNip19-BZNpFefA.js";import{o as St}from"./useEventInteractions-D6e37IFo.js";import{d as Ct,t as wt}from"./ComposeDialogContent-DiIapF7b.js";import{t as J}from"./WikipediaIcon-Df-eqPdn.js";import{t as Tt}from"./BlueskyIcon-imVay4Hn.js";import{i as Et,n as Dt,t as Ot}from"./tooltip-ihPDheAv.js";import{c as kt,t as At}from"./dialog-CV-ki2ew.js";import{t as jt}from"./dist-3TtKm3JK.js";import{n as Mt,t as Nt}from"./useLinkPreview-BkYXhPdP.js";import{a as Y,f as Pt,n as X,o as Z,r as Ft,t as It,u as Lt}from"./bitcoinMoney-BhQyBHpS.js";import{n as Rt,r as zt}from"./countries-Du6BjHuX.js";import"./extraKinds-CF0LI2P1.js";import{b as Bt}from"./sidebarItems-BUQKy0PN.js";import{t as Vt}from"./formatNumber-D1ols1S-.js";import"./imeta-AKViBfwk.js";import{t as Ht}from"./formatTime-CT4ZmnVr.js";import{t as Ut}from"./useCustomEmojis-Dt5wlrd3.js";import{t as Wt}from"./useSearchProfiles-B9G_eYtw.js";import{t as Gt}from"./useIsMobile-brkrNavj.js";import{t as Kt}from"./useShareOrigin-CbCLa1kb.js";import{t as qt}from"./useFeedSettings-BgA2vWPo.js";import{n as Jt,r as Yt}from"./birthday-CoMNDhVK.js";import{t as Xt}from"./resizeImage-LOlp-rx5.js";import"./DecryptedImage-DwsS1fNG.js";import{t as Zt}from"./wikimedia-CCPyM-j2.js";var Q=t(T(),1),$=A(),Qt=`DismissableLayer`,$t=`dismissableLayer.update`,en=`dismissableLayer.pointerDownOutside`,tn=`dismissableLayer.focusOutside`,nn,rn=Q.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),an=Q.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=Q.useContext(rn),[u,d]=Q.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=Q.useState({}),m=Ue(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=cn(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=ln(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return ct(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),Q.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(nn=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),un(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=nn)}},[u,f,n,l]),Q.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),un())},[u,l]),Q.useEffect(()=>{let e=()=>p({});return document.addEventListener($t,e),()=>document.removeEventListener($t,e)},[]),(0,$.jsx)(K.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:G(e.onFocusCapture,S.onFocusCapture),onBlurCapture:G(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:G(e.onPointerDownCapture,x.onPointerDownCapture)})});an.displayName=Qt;var on=`DismissableLayerBranch`,sn=Q.forwardRef((e,t)=>{let n=Q.useContext(rn),r=Q.useRef(null),i=Ue(t,r);return Q.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,$.jsx)(K.div,{...e,ref:i})});sn.displayName=on;function cn(e,t=globalThis?.document){let n=U(e),r=Q.useRef(!1),i=Q.useRef(()=>{});return Q.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){dn(en,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function ln(e,t=globalThis?.document){let n=U(e),r=Q.useRef(!1);return Q.useEffect(()=>{let e=e=>{e.target&&!r.current&&dn(tn,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function un(){let e=new CustomEvent($t);document.dispatchEvent(e)}function dn(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?mt(i,a):i.dispatchEvent(a)}var fn=an,pn=sn,mn=t(k(),1),hn=`Portal`,gn=Q.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=Q.useState(!1);ot(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?mn.createPortal((0,$.jsx)(K.div,{...r,ref:t}),o):null});gn.displayName=hn;var _n=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),vn=`VisuallyHidden`,yn=Q.forwardRef((e,t)=>(0,$.jsx)(K.span,{...e,ref:t,style:{..._n,...e.style}}));yn.displayName=vn;var bn=`ToastProvider`,[xn,Sn,Cn]=jt(`Toast`),[wn,Tn]=at(`Toast`,[Cn]),[En,Dn]=wn(bn),On=e=>{let{__scopeToast:t,label:n=`Notification`,duration:r=5e3,swipeDirection:i=`right`,swipeThreshold:a=50,children:o}=e,[s,c]=Q.useState(null),[l,u]=Q.useState(0),d=Q.useRef(!1),f=Q.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${bn}\`. Expected non-empty \`string\`.`),(0,$.jsx)(xn.Provider,{scope:t,children:(0,$.jsx)(En,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:l,viewport:s,onViewportChange:c,onToastAdd:Q.useCallback(()=>u(e=>e+1),[]),onToastRemove:Q.useCallback(()=>u(e=>e-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:f,children:o})})};On.displayName=bn;var kn=`ToastViewport`,An=[`F8`],jn=`toast.viewportPause`,Mn=`toast.viewportResume`,Nn=Q.forwardRef((e,t)=>{let{__scopeToast:n,hotkey:r=An,label:i=`Notifications ({hotkey})`,...a}=e,o=Dn(kn,n),s=Sn(n),c=Q.useRef(null),l=Q.useRef(null),u=Q.useRef(null),d=Q.useRef(null),f=Ue(t,d,o.onViewportChange),p=r.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),m=o.toastCount>0;Q.useEffect(()=>{let e=e=>{r.length!==0&&r.every(t=>e[t]||e.code===t)&&d.current?.focus()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),Q.useEffect(()=>{let e=c.current,t=d.current;if(m&&e&&t){let n=()=>{if(!o.isClosePausedRef.current){let e=new CustomEvent(jn);t.dispatchEvent(e),o.isClosePausedRef.current=!0}},r=()=>{if(o.isClosePausedRef.current){let e=new CustomEvent(Mn);t.dispatchEvent(e),o.isClosePausedRef.current=!1}},i=t=>{e.contains(t.relatedTarget)||r()},a=()=>{e.contains(document.activeElement)||r()};return e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,i),e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,a),window.addEventListener(`blur`,n),window.addEventListener(`focus`,r),()=>{e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,i),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,a),window.removeEventListener(`blur`,n),window.removeEventListener(`focus`,r)}}},[m,o.isClosePausedRef]);let h=Q.useCallback(({tabbingDirection:e})=>{let t=s().map(t=>{let n=t.ref.current,r=[n,...or(n)];return e===`forwards`?r:r.reverse()});return(e===`forwards`?t.reverse():t).flat()},[s]);return Q.useEffect(()=>{let e=d.current;if(e){let t=t=>{let n=t.altKey||t.ctrlKey||t.metaKey;if(t.key===`Tab`&&!n){let n=document.activeElement,r=t.shiftKey;if(t.target===e&&r){l.current?.focus();return}let i=h({tabbingDirection:r?`backwards`:`forwards`}),a=i.findIndex(e=>e===n);sr(i.slice(a+1))?t.preventDefault():r?l.current?.focus():u.current?.focus()}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)}},[s,h]),(0,$.jsxs)(pn,{ref:c,role:`region`,"aria-label":i.replace(`{hotkey}`,p),tabIndex:-1,style:{pointerEvents:m?void 0:`none`},children:[m&&(0,$.jsx)(Fn,{ref:l,onFocusFromOutsideViewport:()=>{sr(h({tabbingDirection:`forwards`}))}}),(0,$.jsx)(xn.Slot,{scope:n,children:(0,$.jsx)(K.ol,{tabIndex:-1,...a,ref:f})}),m&&(0,$.jsx)(Fn,{ref:u,onFocusFromOutsideViewport:()=>{sr(h({tabbingDirection:`backwards`}))}})]})});Nn.displayName=kn;var Pn=`ToastFocusProxy`,Fn=Q.forwardRef((e,t)=>{let{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,a=Dn(Pn,n);return(0,$.jsx)(yn,{"aria-hidden":!0,tabIndex:0,...i,ref:t,style:{position:`fixed`},onFocus:e=>{let t=e.relatedTarget;a.viewport?.contains(t)||r()}})});Fn.displayName=Pn;var In=`Toast`,Ln=`toast.swipeStart`,Rn=`toast.swipeMove`,zn=`toast.swipeCancel`,Bn=`toast.swipeEnd`,Vn=Q.forwardRef((e,t)=>{let{forceMount:n,open:r,defaultOpen:i,onOpenChange:a,...o}=e,[s,c]=st({prop:r,defaultProp:i??!0,onChange:a,caller:In});return(0,$.jsx)(ht,{present:n||s,children:(0,$.jsx)(Wn,{open:s,...o,ref:t,onClose:()=>c(!1),onPause:U(e.onPause),onResume:U(e.onResume),onSwipeStart:G(e.onSwipeStart,e=>{e.currentTarget.setAttribute(`data-swipe`,`start`)}),onSwipeMove:G(e.onSwipeMove,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`move`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-y`,`${n}px`)}),onSwipeCancel:G(e.onSwipeCancel,e=>{e.currentTarget.setAttribute(`data-swipe`,`cancel`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-y`)}),onSwipeEnd:G(e.onSwipeEnd,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`end`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-y`,`${n}px`),c(!1)})})})});Vn.displayName=In;var[Hn,Un]=wn(In,{onClose(){}}),Wn=Q.forwardRef((e,t)=>{let{__scopeToast:n,type:r=`foreground`,duration:i,open:a,onClose:o,onEscapeKeyDown:s,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:p,...m}=e,h=Dn(In,n),[g,_]=Q.useState(null),v=Ue(t,e=>_(e)),y=Q.useRef(null),b=Q.useRef(null),x=i||h.duration,S=Q.useRef(0),C=Q.useRef(x),w=Q.useRef(0),{onToastAdd:ee,onToastRemove:T}=h,te=U(()=>{g?.contains(document.activeElement)&&h.viewport?.focus(),o()}),ne=Q.useCallback(e=>{!e||e===1/0||(window.clearTimeout(w.current),S.current=new Date().getTime(),w.current=window.setTimeout(te,e))},[te]);Q.useEffect(()=>{let e=h.viewport;if(e){let t=()=>{ne(C.current),l?.()},n=()=>{let e=new Date().getTime()-S.current;C.current-=e,window.clearTimeout(w.current),c?.()};return e.addEventListener(jn,n),e.addEventListener(Mn,t),()=>{e.removeEventListener(jn,n),e.removeEventListener(Mn,t)}}},[h.viewport,x,c,l,ne]),Q.useEffect(()=>{a&&!h.isClosePausedRef.current&&ne(x)},[a,x,h.isClosePausedRef,ne]),Q.useEffect(()=>(ee(),()=>T()),[ee,T]);let re=Q.useMemo(()=>g?tr(g):null,[g]);return h.viewport?(0,$.jsxs)($.Fragment,{children:[re&&(0,$.jsx)(Gn,{__scopeToast:n,role:`status`,"aria-live":r===`foreground`?`assertive`:`polite`,"aria-atomic":!0,children:re}),(0,$.jsx)(Hn,{scope:n,onClose:te,children:mn.createPortal((0,$.jsx)(xn.ItemSlot,{scope:n,children:(0,$.jsx)(fn,{asChild:!0,onEscapeKeyDown:G(s,()=>{h.isFocusedToastEscapeKeyDownRef.current||te(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:(0,$.jsx)(K.li,{role:`status`,"aria-live":`off`,"aria-atomic":!0,tabIndex:0,"data-state":a?`open`:`closed`,"data-swipe-direction":h.swipeDirection,...m,ref:v,style:{userSelect:`none`,touchAction:`none`,...e.style},onKeyDown:G(e.onKeyDown,e=>{e.key===`Escape`&&(s?.(e.nativeEvent),e.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,te()))}),onPointerDown:G(e.onPointerDown,e=>{e.button===0&&(y.current={x:e.clientX,y:e.clientY})}),onPointerMove:G(e.onPointerMove,e=>{if(!y.current)return;let t=e.clientX-y.current.x,n=e.clientY-y.current.y,r=!!b.current,i=[`left`,`right`].includes(h.swipeDirection),a=[`left`,`up`].includes(h.swipeDirection)?Math.min:Math.max,o=i?a(0,t):0,s=i?0:a(0,n),c=e.pointerType===`touch`?10:2,l={x:o,y:s},f={originalEvent:e,delta:l};r?(b.current=l,nr(Rn,d,f,{discrete:!1})):rr(l,h.swipeDirection,c)?(b.current=l,nr(Ln,u,f,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(n)>c)&&(y.current=null)}),onPointerUp:G(e.onPointerUp,e=>{let t=b.current,n=e.target;if(n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),b.current=null,y.current=null,t){let n=e.currentTarget,r={originalEvent:e,delta:t};rr(t,h.swipeDirection,h.swipeThreshold)?nr(Bn,p,r,{discrete:!0}):nr(zn,f,r,{discrete:!0}),n.addEventListener(`click`,e=>e.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),Gn=e=>{let{__scopeToast:t,children:n,...r}=e,i=Dn(In,t),[a,o]=Q.useState(!1),[s,c]=Q.useState(!1);return ir(()=>o(!0)),Q.useEffect(()=>{let e=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(e)},[]),s?null:(0,$.jsx)(gn,{asChild:!0,children:(0,$.jsx)(yn,{...r,children:a&&(0,$.jsxs)($.Fragment,{children:[i.label,` `,n]})})})},Kn=`ToastTitle`,qn=Q.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,$.jsx)(K.div,{...r,ref:t})});qn.displayName=Kn;var Jn=`ToastDescription`,Yn=Q.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,$.jsx)(K.div,{...r,ref:t})});Yn.displayName=Jn;var Xn=`ToastAction`,Zn=Q.forwardRef((e,t)=>{let{altText:n,...r}=e;return n.trim()?(0,$.jsx)(er,{altText:n,asChild:!0,children:(0,$.jsx)($n,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${Xn}\`. Expected non-empty \`string\`.`),null)});Zn.displayName=Xn;var Qn=`ToastClose`,$n=Q.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e,i=Un(Qn,n);return(0,$.jsx)(er,{asChild:!0,children:(0,$.jsx)(K.button,{type:`button`,...r,ref:t,onClick:G(e.onClick,i.onClose)})})});$n.displayName=Qn;var er=Q.forwardRef((e,t)=>{let{__scopeToast:n,altText:r,...i}=e;return(0,$.jsx)(K.div,{"data-radix-toast-announce-exclude":``,"data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function tr(e){let t=[];return Array.from(e.childNodes).forEach(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),ar(e)){let n=e.ariaHidden||e.hidden||e.style.display===`none`,r=e.dataset.radixToastAnnounceExclude===``;if(!n)if(r){let n=e.dataset.radixToastAnnounceAlt;n&&t.push(n)}else t.push(...tr(e))}}),t}function nr(e,t,n,{discrete:r}){let i=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?mt(i,a):i.dispatchEvent(a)}var rr=(e,t,n=0)=>{let r=Math.abs(e.x),i=Math.abs(e.y),a=r>i;return t===`left`||t===`right`?a&&r>n:!a&&i>n};function ir(e=()=>{}){let t=U(e);ot(()=>{let e=0,n=0;return e=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(n)}},[t])}function ar(e){return e.nodeType===e.ELEMENT_NODE}function or(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function sr(e){let t=document.activeElement;return e.some(e=>e===t?!0:(e.focus(),document.activeElement!==t))}var cr=On,lr=Nn,ur=Vn,dr=qn,fr=Yn,pr=Zn,mr=$n,hr=cr,gr=Q.forwardRef(({className:e,...t},n)=>(0,$.jsx)(lr,{ref:n,className:z(`fixed top-0 z-[300] flex max-h-screen w-full flex-col-reverse p-4 pt-[max(1rem,var(--safe-area-inset-top,env(safe-area-inset-top)))] md:bottom-0 md:right-0 md:top-auto md:flex-col md:pt-4 md:max-w-[420px]`,e),...t}));gr.displayName=lr.displayName;var _r=We(`group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 max-md:data-[swipe=cancel]:translate-y-0 max-md:data-[swipe=end]:translate-y-[var(--radix-toast-swipe-end-y)] max-md:data-[swipe=move]:translate-y-[var(--radix-toast-swipe-move-y)] max-md:data-[state=open]:slide-in-from-top-full max-md:data-[state=closed]:slide-out-to-top-full md:data-[swipe=cancel]:translate-x-0 md:data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] md:data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] md:data-[state=open]:slide-in-from-bottom-full md:data-[state=closed]:slide-out-to-right-full`,{variants:{variant:{default:`border bg-background text-foreground`,destructive:`destructive group border-destructive bg-destructive text-destructive-foreground`,success:`success group border-success bg-success text-success-foreground`}},defaultVariants:{variant:`default`}}),vr=Q.forwardRef(({className:e,variant:t,...n},r)=>(0,$.jsx)(ur,{ref:r,className:z(_r({variant:t}),e),...n}));vr.displayName=ur.displayName;var yr=Q.forwardRef(({className:e,...t},n)=>(0,$.jsx)(pr,{ref:n,className:z(`inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive`,e),...t}));yr.displayName=pr.displayName;var br=Q.forwardRef(({className:e,...t},n)=>(0,$.jsx)(mr,{ref:n,className:z(`absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600 group-[.success]:text-success-foreground/70 group-[.success]:hover:text-success-foreground`,e),"toast-close":``,...t,children:(0,$.jsx)(g,{className:`h-4 w-4`})}));br.displayName=mr.displayName;var xr=Q.forwardRef(({className:e,...t},n)=>(0,$.jsx)(dr,{ref:n,className:z(`text-sm font-semibold`,e),...t}));xr.displayName=dr.displayName;var Sr=Q.forwardRef(({className:e,...t},n)=>(0,$.jsx)(fr,{ref:n,className:z(`text-sm opacity-90`,e),...t}));Sr.displayName=fr.displayName;function Cr(e){if(e.startsWith(`isbn:`))return{type:`isbn`,value:e};if(e.startsWith(`iso3166:`))return{type:`iso3166`,value:e,code:e.slice(8)};let t=e.match(/^bitcoin:tx:([0-9a-f]{64})$/i);if(t)return{type:`bitcoin-tx`,value:e,txid:t[1].toLowerCase()};let n=e.match(/^bitcoin:address:(.+)$/);return n?{type:`bitcoin-address`,value:e,address:n[1]}:e.startsWith(`http://`)||e.startsWith(`https://`)?{type:`url`,value:e}:{type:`unknown`,value:e}}function wr(e){let t=e.replace(/\D/g,``);return t.length===13?`${t.slice(0,3)}-${t.slice(3,4)}-${t.slice(4,9)}-${t.slice(9,12)}-${t.slice(12)}`:t.length===10?`${t.slice(0,1)}-${t.slice(1,5)}-${t.slice(5,9)}-${t.slice(9)}`:e}function Tr(e){try{let{pathname:t}=new URL(e),n=t.split(`/`).filter(Boolean);for(let e=n.length-1;e>=0;e--){let t=decodeURIComponent(n[e]);if(!(t.length<4)&&!(/^[A-Za-z0-9_-]{6,14}$/.test(t)&&!/[- ]/.test(t))&&/[-_]/.test(t))return t.replace(/[-_]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase()).trim()}}catch{}return null}function Er(e){switch(e.type){case`url`:{let t=Tr(e.value);if(t)return t;let n=Fe(e.value);if(n)return n;try{return new URL(e.value).hostname.replace(/^www\./,``)}catch{return`Web Page`}}case`isbn`:return`Books`;case`iso3166`:{let t=Rt(e.code);return t?.subdivisionName??t?.name??`Country`}case`bitcoin-tx`:return`Bitcoin Transaction`;case`bitcoin-address`:return`Bitcoin Address`;default:return`External Content`}}function Dr(e,t){switch(e.type){case`url`:try{return`${new URL(e.value).hostname.replace(/^www\./,``)} | ${t}`}catch{return`Web Page | ${t}`}case`isbn`:return`Book (ISBN ${e.value.replace(`isbn:`,``)}) | ${t}`;case`iso3166`:{let n=Rt(e.code),r=n?.subdivisionName??n?.name;return r?`${r} | ${t}`:`Country | ${t}`}case`bitcoin-tx`:return`Bitcoin TX ${`${e.txid.slice(0,8)}...${e.txid.slice(-8)}`} | ${t}`;case`bitcoin-address`:return`Bitcoin Address ${`${e.address.slice(0,8)}...${e.address.slice(-6)}`} | ${t}`;default:return`External Content | ${t}`}}me({title:j(),authors:he(me({name:j()})).optional(),number_of_pages:N().optional(),publish_date:j().optional(),publishers:he(me({name:j()})).optional(),subjects:he(me({name:j()})).optional(),cover:me({small:j().optional(),medium:j().optional(),large:j().optional()}).optional(),excerpts:he(me({text:j()})).optional()});async function Or(e,t){try{let n=await fetch(`https://openlibrary.org/isbn/${e}.json`,{signal:t,headers:{Accept:`application/json`}});if(!n.ok)return null;let r=await n.json(),i;if(r.authors&&Array.isArray(r.authors)){let e=r.authors;e.some(e=>e.key&&!e.name)&&(i=await Promise.all(e.map(async e=>{if(e.name)return{name:e.name};if(e.key)try{let n=await fetch(`https://openlibrary.org${e.key}.json`,{signal:t});if(n.ok)return{name:(await n.json()).name??`Unknown Author`}}catch{}return{name:`Unknown Author`}})))}let a;if(r.covers&&Array.isArray(r.covers)&&r.covers.length>0){let e=r.covers[0];a={small:`https://covers.openlibrary.org/b/id/${e}-S.jpg`,medium:`https://covers.openlibrary.org/b/id/${e}-M.jpg`,large:`https://covers.openlibrary.org/b/id/${e}-L.jpg`}}return{title:r.title??`Unknown Title`,authors:i??r.authors,number_of_pages:r.number_of_pages,publish_date:r.publish_date,publishers:r.publishers,subjects:r.subjects?.slice(0,5),cover:a??r.cover,excerpts:r.excerpts}}catch{return null}}function kr(e){return F({queryKey:[`book-info`,e],queryFn:({signal:t})=>Or(e,t),enabled:!!e,staleTime:1e3*60*60*24,gcTime:1e3*60*60*24*7,retry:1})}var Ar=[`#a78bfa`,`#f472b6`,`#fbbf24`,`#38bdf8`,`#34d399`,`#fb7185`],jr=45,Mr=24,Nr=140,Pr=4,Fr=50,Ir=95,Lr=38,Rr=55;function zr(){return{confetti:Array.from({length:Nr},(e,t)=>({kind:`confetti`,left:2+Math.random()*96,speed:Fr+Math.random()*(Ir-Fr),phase:Math.random(),size:7+Math.random()*5,color:Ar[t%Ar.length],sway:(Math.random()-.5)*60,spin:270+Math.random()*360,round:t%3==0})),balloons:Array.from({length:Pr},()=>({kind:`balloon`,left:5+Math.random()*90,speed:Lr+Math.random()*(Rr-Lr),phase:Math.random(),size:44+Math.random()*20,color:``,sway:(Math.random()-.5)*50,spin:(Math.random()-.5)*40,round:!1}))}}function Br(){let e=(0,Q.useRef)(null),[t,n]=(0,Q.useState)();(0,Q.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=()=>n(t.offsetHeight+32);r();let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[]);let{confetti:r,balloons:i}=(0,Q.useMemo)(zr,[]),a=t===void 0?0:Math.min(Math.max(Math.round(t/1e3*jr),Mr),Nr),o=t===void 0?0:Pr;return(0,$.jsxs)(`div`,{ref:e,"aria-hidden":!0,className:`pointer-events-none absolute inset-0 overflow-hidden motion-reduce:hidden`,style:{"--rain-distance":`${t??0}px`},children:[t!==void 0&&r.slice(0,a).map((e,n)=>{let r=t/e.speed;return(0,$.jsx)(`span`,{className:`absolute animate-birthday-rain`,style:{top:-28,left:`${e.left}%`,width:e.size,height:e.round?e.size:e.size*.45,backgroundColor:e.color,borderRadius:e.round?`9999px`:`1px`,opacity:0,animationDelay:`${-e.phase*r}s`,"--rain-duration":`${r}s`,"--rain-sway":`${e.sway}px`,"--rain-spin":`${e.spin}deg`}},`c-${n}`)}),t!==void 0&&i.slice(0,o).map((e,n)=>{let r=t/e.speed;return(0,$.jsx)(`span`,{className:`absolute animate-birthday-float select-none`,style:{bottom:-72,left:`${e.left}%`,fontSize:e.size,lineHeight:1,opacity:0,animationDelay:`${-e.phase*r}s`,"--rain-duration":`${r}s`,"--rain-sway":`${e.sway}px`,"--rain-spin":`${e.spin}deg`},children:`🎈`},`b-${n}`)})]})}function Vr({className:e,pomScale:t=1}){let n=(0,Q.useId)(),r=5.5*t,i=Math.max(7,r+1.5);return(0,$.jsxs)(`svg`,{viewBox:`0 0 64 64`,className:e,"aria-hidden":`true`,children:[(0,$.jsx)(`defs`,{children:(0,$.jsx)(`clipPath`,{id:n,children:(0,$.jsx)(`path`,{d:`M32 7 L53 55 L11 55 Z`})})}),(0,$.jsxs)(`g`,{clipPath:`url(#${n})`,children:[(0,$.jsx)(`rect`,{x:`0`,y:`0`,width:`64`,height:`64`,fill:`#a78bfa`}),(0,$.jsx)(`path`,{d:`M2 45 Q32 36 62 45 L62 58 Q32 49 2 58 Z`,fill:`#f472b6`}),(0,$.jsx)(`path`,{d:`M8 28 Q32 21 56 28 L56 37 Q32 30 8 37 Z`,fill:`#fbbf24`}),(0,$.jsx)(`path`,{d:`M20 12 Q32 9 44 12 L44 19 Q32 16 20 19 Z`,fill:`#38bdf8`})]}),(0,$.jsx)(`path`,{d:`M11 55 Q32 48 53 55 Q32 62 11 55 Z`,fill:`#8b5cf6`}),(0,$.jsx)(`circle`,{cx:`32`,cy:i,r,fill:`#fbbf24`}),(0,$.jsx)(`circle`,{cx:32-1.8*t,cy:i-1.6*t,r:1.8*t,fill:`#fde68a`})]})}var Hr=`https://gifverse.net/api/v1`,Ur=`https://gifverse.net/media`,Wr=30;function Gr(e){let t=`${Ur}/${e.i}/original.gif`;return{id:e.i,title:e.ti||e.de||``,url:t,previewUrl:t,width:e.w||220,height:e.h||160}}function Kr(e){return e.results.filter(e=>!e.nsfw).map(Gr)}async function qr(e){let t=new URLSearchParams({q:e,limit:String(Wr),offset:`0`,sort:`relevant`}),n=await fetch(`${Hr}/search?${t}`);if(!n.ok)throw Error(`GIFverse search failed: ${n.status}`);return{results:Kr(await n.json())}}async function Jr(){let e=new URLSearchParams({limit:String(Wr),offset:`0`,sort:`popular`}),t=await fetch(`${Hr}/trending?${e}`);if(!t.ok)throw Error(`GIFverse trending failed: ${t.status}`);return{results:Kr(await t.json())}}function Yr(){let[e,t]=(0,Q.useState)(``),[n,r]=(0,Q.useState)(``),i=(0,Q.useRef)(void 0),a=(0,Q.useCallback)(e=>{t(e),clearTimeout(i.current),i.current=setTimeout(()=>{r(e.trim())},300)},[]),o=(0,Q.useCallback)(()=>{t(``),r(``),clearTimeout(i.current)},[]),s=n.length>0,c=F({queryKey:[`gifverse`,`trending`],queryFn:()=>Jr(),staleTime:300*1e3,enabled:!s}),l=F({queryKey:[`gifverse`,`search`,n],queryFn:()=>qr(n),staleTime:120*1e3,enabled:s}),u=s?l:c;return{query:e,setQuery:a,clearQuery:o,results:u.data?.results??[],isLoading:u.isLoading,isError:u.isError,isSearching:s}}function Xr({gif:e,onClick:t}){let[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null),c=e.width&&e.height?e.width/e.height:1,l=Math.round(150/c);return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>t(e),className:z(`relative w-full rounded-lg overflow-hidden cursor-pointer`,`transition-shadow duration-200 hover:ring-2 hover:ring-primary/60`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,`group`),style:{height:l},title:e.title,children:[!r&&!a&&(0,$.jsx)(q,{className:`absolute inset-0 rounded-lg`}),a&&(0,$.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-muted rounded-lg`,children:(0,$.jsx)(n,{className:`size-5 text-muted-foreground/40`})}),(0,$.jsx)(`img`,{ref:s,src:e.previewUrl,alt:e.title,loading:`lazy`,className:z(`w-full h-full object-cover rounded-lg transition-opacity duration-200`,r?`opacity-100`:`opacity-0`),onLoad:()=>i(!0),onError:()=>o(!0),decoding:`async`}),(0,$.jsx)(`div`,{className:z(`absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/60 to-transparent`,`px-2 py-1.5 opacity-0 group-hover:opacity-100 transition-opacity duration-150`),children:(0,$.jsx)(`span`,{className:`text-[10px] text-white line-clamp-1 font-medium`,children:e.title})})]})}function Zr({results:e,onSelect:t}){let n=[[],[]],r=[0,0];for(let t of e){let e=t.width&&t.height?t.width/t.height:1,i=Math.round(150/e),a=r[0]<=r[1]?0:1;n[a].push(t),r[a]+=i+8}return(0,$.jsx)(`div`,{className:`flex gap-2 px-2 pb-2`,children:n.map((e,n)=>(0,$.jsx)(`div`,{className:`flex-1 flex flex-col gap-2`,children:e.map(e=>(0,$.jsx)(Xr,{gif:e,onClick:t},e.id))},n))})}function Qr({onSelect:e,autoFocus:t=!0,onSearchActiveChange:r}){let{query:i,setQuery:a,clearQuery:o,results:s,isLoading:c,isError:l,isSearching:u}=Yr(),d=(0,Q.useRef)(null),[f,p]=(0,Q.useState)(!1),m=f||i.trim().length>0;(0,Q.useEffect)(()=>{r?.(m)},[m,r]),(0,Q.useEffect)(()=>{if(!t)return;let e=setTimeout(()=>{d.current?.focus()},100);return()=>clearTimeout(e)},[t]);let h=(0,Q.useCallback)(t=>{e(t)},[e]);return(0,$.jsxs)(`div`,{className:`flex flex-col w-full h-full overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`px-3 pt-3 pb-2`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ae,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 size-4 text-muted-foreground pointer-events-none`}),(0,$.jsx)(pt,{ref:d,value:i,onChange:e=>a(e.target.value),onFocus:()=>p(!0),onBlur:()=>p(!1),placeholder:`Search GIFs...`,className:`pl-8 pr-20 h-9 text-base md:text-sm bg-muted/50 border-0 rounded-lg`}),i?(0,$.jsx)(`button`,{type:`button`,onClick:o,className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors`,children:(0,$.jsx)(g,{className:`size-3.5`})}):(0,$.jsx)(`span`,{className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground/50 pointer-events-none select-none`,children:`Powered by GIFverse`})]})}),(0,$.jsx)(`div`,{className:`px-3 pb-1.5`,children:(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground uppercase tracking-wider`,children:u?`Results`:`Trending`})}),(0,$.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto overscroll-contain`,children:c?(0,$.jsx)(`div`,{className:`px-2 pb-2`,children:(0,$.jsx)(`div`,{className:`flex gap-2`,children:[0,1].map(e=>(0,$.jsx)(`div`,{className:`flex-1 flex flex-col gap-2`,children:Array.from({length:4}).map((e,t)=>(0,$.jsx)(q,{className:`w-full rounded-lg`,style:{height:80+Math.random()*60}},t))},e))})}):l?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-48 text-muted-foreground`,children:[(0,$.jsx)(n,{className:`size-8 mb-2 opacity-40`}),(0,$.jsx)(`p`,{className:`text-sm`,children:`Failed to load GIFs`}),(0,$.jsx)(`p`,{className:`text-xs mt-1`,children:`Please try again`})]}):s.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-48 text-muted-foreground`,children:[(0,$.jsx)(`p`,{className:`text-sm`,children:`No GIFs found`}),(0,$.jsx)(`p`,{className:`text-xs mt-1`,children:`Try a different search term`})]}):(0,$.jsx)(Zr,{results:s,onSelect:h})})]})}function $r({textareaRef:e,isOpen:t,onClose:n,dropdownHeight:r,dropdownWidth:i=280}){let a=(0,Q.useCallback)(t=>{let n=e.current;if(!n)return{top:0,left:0};let a=parseFloat(window.getComputedStyle(n).lineHeight)||20,o=n.getBoundingClientRect(),s=o.top+t.top-n.scrollTop+a+4,c=o.left+Math.max(0,Math.min(t.left,n.clientWidth-i)),l=o.top+t.top-n.scrollTop-r-4;return{top:s+r>window.innerHeight&&l>0?l:s,left:Math.max(8,Math.min(c,window.innerWidth-i-8))}},[e,r,i]);return(0,Q.useEffect)(()=>{if(!t)return;let e=e=>{let t=e.target;t instanceof Element&&t.closest(`[data-autocomplete-dropdown]`)||n()},r=()=>n();return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,r),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,r)}},[t,n]),{computePosition:a,renderPortal:mn.createPortal}}var ei=`direction.boxSizing.width.height.overflowX.overflowY.borderTopWidth.borderRightWidth.borderBottomWidth.borderLeftWidth.borderStyle.paddingTop.paddingRight.paddingBottom.paddingLeft.fontStyle.fontVariant.fontWeight.fontStretch.fontSize.fontSizeAdjust.lineHeight.fontFamily.textAlign.textTransform.textIndent.textDecoration.letterSpacing.wordSpacing.tabSize.MozTabSize.whiteSpace.wordWrap.wordBreak`.split(`.`);function ti(e,t){let n=document.createElement(`div`);n.id=`mention-mirror`;let r=window.getComputedStyle(e);for(let e of ei)n.style[e]=r.getPropertyValue(e.replace(/([A-Z])/g,`-$1`).toLowerCase());n.style.position=`absolute`,n.style.visibility=`hidden`,n.style.whiteSpace=`pre-wrap`,n.style.wordWrap=`break-word`,n.style.overflow=`hidden`,document.body.appendChild(n),n.textContent=e.value.substring(0,t);let i=document.createElement(`span`);i.textContent=`​`,n.appendChild(i);let a=n.getBoundingClientRect(),o=i.getBoundingClientRect(),s={top:o.top-a.top-e.scrollTop,left:o.left-a.left-e.scrollLeft};return document.body.removeChild(n),s}function ni({textareaRef:e,content:t,onInsertMention:n}){let[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(-1),[s,c]=(0,Q.useState)(0),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(null),{computePosition:h,renderPortal:g}=$r({textareaRef:e,isOpen:l,onClose:(0,Q.useCallback)(()=>u(!1),[]),dropdownHeight:240}),{data:_,followedPubkeys:v}=Wt(l?r:``),y=(0,Q.useCallback)((t,n)=>{let r=e.current;if(!r)return;let a=n??r.selectionStart,s=t??r.value,l=-1;for(let e=a-1;e>=0;e--){let t=s[e];if(t===` `||t===` `||t===` `)break;if(t===`@`){(e===0||/\s/.test(s[e-1]))&&(l=e);break}}if(l===-1){u(!1),i(``),o(-1);return}let d=s.slice(l+1,a);if(d.length===0||d.length>50){u(!1),i(``),o(-1);return}i(d),o(l),u(!0),c(0);let p=ti(r,l);f(h(p))},[e,h]);(0,Q.useEffect)(()=>{let t=e.current;if(!t)return;let n=()=>{y(t.value,t.selectionStart)},r=()=>y(),i=e=>{[`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key)&&y()};return t.addEventListener(`input`,n),t.addEventListener(`click`,r),t.addEventListener(`keyup`,i),()=>{t.removeEventListener(`input`,n),t.removeEventListener(`click`,r),t.removeEventListener(`keyup`,i)}},[e,y,t]),(0,Q.useEffect)(()=>{let n=e.current;n&&y(t,n.selectionStart)},[t,y,e]),(0,Q.useEffect)(()=>{if(!l||!_||_.length===0)return;let t=e.current;if(!t)return;let n=e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),c(e=>e<(_?.length??1)-1?e+1:0);break;case`ArrowUp`:e.preventDefault(),c(e=>e>0?e-1:(_?.length??1)-1);break;case`Enter`:case`Tab`:_&&_.length>0&&(e.preventDefault(),e.stopImmediatePropagation(),b(_[s]));break;case`Escape`:e.preventDefault(),u(!1);break}};return t.addEventListener(`keydown`,n),()=>t.removeEventListener(`keydown`,n)},[l,_,s,e]),(0,Q.useEffect)(()=>{s>=0&&m.current&&m.current.querySelectorAll(`[data-mention-item]`)[s]?.scrollIntoView({block:`nearest`})},[s]);let b=(0,Q.useCallback)(t=>{let s=`nostr:${P.npubEncode(t.pubkey)} `,c=e.current?.selectionStart??a+r.length+1;n({start:a,end:c,replacement:s}),u(!1),i(``),o(-1)},[a,r,e,n]);return!l||!d||!_||_.length===0?null:g((0,$.jsx)(`div`,{ref:p,"data-autocomplete-dropdown":!0,className:`fixed z-[300] w-[280px] rounded-xl border border-border bg-popover shadow-lg overflow-hidden animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-150 pointer-events-auto`,style:{top:d.top,left:d.left},children:(0,$.jsx)(`div`,{ref:m,className:`max-h-[240px] overflow-y-auto py-1`,children:_.map((e,t)=>(0,$.jsx)(ri,{profile:e,isSelected:t===s,isFollowed:v.has(e.pubkey),onSelect:()=>b(e)},e.pubkey))})}),document.body)}function ri({profile:e,isSelected:t,isFollowed:n,onSelect:r}){let{metadata:i,pubkey:a}=e,o=i.name||i.display_name||`Anonymous`,s=i.nip05,{data:c}=nt(s,a),l=c&&s?s.startsWith(`_@`)?s.slice(2):s:void 0,u=l||P.npubEncode(a);return(0,$.jsxs)(`button`,{"data-mention-item":!0,className:z(`w-full flex items-center gap-3 px-3 py-2 text-left transition-colors cursor-pointer`,t?`bg-accent text-accent-foreground`:`hover:bg-secondary/60`),onPointerDown:e=>{e.preventDefault(),r()},children:[(0,$.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,$.jsxs)(Ze,{shape:Ye(i),className:`size-8`,children:[(0,$.jsx)(Xe,{src:i.picture,alt:o}),(0,$.jsx)(Je,{className:`bg-primary/20 text-primary text-xs`,children:o[0]?.toUpperCase()||`?`})]}),n&&(0,$.jsx)(`span`,{className:`absolute -bottom-0.5 -right-0.5 size-3.5 rounded-full bg-primary flex items-center justify-center ring-2 ring-popover`,title:`Following`,children:(0,$.jsx)(p,{className:`size-2 text-primary-foreground`,strokeWidth:3})})]}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,$.jsx)(`span`,{className:`font-semibold text-sm truncate`,children:(0,$.jsx)(et,{tags:e.event.tags,children:o})})}),(0,$.jsx)(`div`,{className:`text-xs text-muted-foreground truncate`,children:l?(0,$.jsx)(`span`,{className:`truncate`,children:u}):(0,$.jsx)(`span`,{className:`truncate font-mono text-[11px]`,children:u})})]})]})}var ii=`direction.boxSizing.width.height.overflowX.overflowY.borderTopWidth.borderRightWidth.borderBottomWidth.borderLeftWidth.borderStyle.paddingTop.paddingRight.paddingBottom.paddingLeft.fontStyle.fontVariant.fontWeight.fontStretch.fontSize.fontSizeAdjust.lineHeight.fontFamily.textAlign.textTransform.textIndent.textDecoration.letterSpacing.wordSpacing.tabSize.MozTabSize.whiteSpace.wordWrap.wordBreak`.split(`.`);function ai(e,t){let n=document.createElement(`div`);n.id=`emoji-mirror`;let r=window.getComputedStyle(e);for(let e of ii)n.style[e]=r.getPropertyValue(e.replace(/([A-Z])/g,`-$1`).toLowerCase());n.style.position=`absolute`,n.style.visibility=`hidden`,n.style.whiteSpace=`pre-wrap`,n.style.wordWrap=`break-word`,n.style.overflow=`hidden`,document.body.appendChild(n),n.textContent=e.value.substring(0,t);let i=document.createElement(`span`);i.textContent=`​`,n.appendChild(i);let a=n.getBoundingClientRect(),o=i.getBoundingClientRect(),s={top:o.top-a.top-e.scrollTop,left:o.left-a.left-e.scrollLeft};return document.body.removeChild(n),s}var oi=8;function si(e){let t=e.emojis,n=e.aliases,r=[];for(let[e,i]of Object.entries(t)){let t=i.skins?.[0]?.native;if(!t)continue;let a=[];for(let[t,r]of Object.entries(n))r===e&&a.push(t);r.push({id:e,name:i.name,native:t,keywords:[...i.keywords||[],...a]})}return r}var ci=null,li=null;function ui(){return li??=pe(()=>import(`./native-GDBYL4Zp.js`).then(e=>{ci=si(e.default)}),[]),li}function di(e,t){if(!e)return[];let n=e.toLowerCase(),r=[];for(let e of t){let t=e.shortcode.toLowerCase();t===n?r.push({id:`custom:${e.shortcode}`,name:e.shortcode,customUrl:e.url,score:-1}):t.startsWith(n)?r.push({id:`custom:${e.shortcode}`,name:e.shortcode,customUrl:e.url,score:0}):t.includes(n)&&r.push({id:`custom:${e.shortcode}`,name:e.shortcode,customUrl:e.url,score:1})}let i=ci??[];for(let e of i)e.id===n?r.push({id:e.id,name:e.name,native:e.native,score:2}):e.id.startsWith(n)?r.push({id:e.id,name:e.name,native:e.native,score:3}):e.id.includes(n)?r.push({id:e.id,name:e.name,native:e.native,score:4}):e.name.toLowerCase().startsWith(n)?r.push({id:e.id,name:e.name,native:e.native,score:5}):e.name.toLowerCase().includes(n)?r.push({id:e.id,name:e.name,native:e.native,score:6}):e.keywords?.some(e=>e.startsWith(n)||e.includes(n))&&r.push({id:e.id,name:e.name,native:e.native,score:7});return r.sort((e,t)=>e.score-t.score),r.slice(0,oi)}function fi({textareaRef:e,content:t,onInsertEmoji:n,onCustomEmojiInsert:r}){let{emojis:i}=Ut(),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(-1),[l,u]=(0,Q.useState)(0),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),h=(0,Q.useRef)(null),g=(0,Q.useRef)(null),{computePosition:_,renderPortal:v}=$r({textareaRef:e,isOpen:d,onClose:(0,Q.useCallback)(()=>f(!1),[]),dropdownHeight:280}),[y,b]=(0,Q.useState)(()=>ci!==null);(0,Q.useEffect)(()=>{if(!a||y)return;let e=!1;return ui().then(()=>{e||b(!0)}),()=>{e=!0}},[a,y]);let x=(0,Q.useMemo)(()=>di(a,i),[a,i,y]),S=(0,Q.useCallback)((t,n)=>{let r=e.current;if(!r)return;let i=n??r.selectionStart,a=t??r.value,s=-1;for(let e=i-1;e>=0;e--){let t=a[e];if(t===` `||t===` `||t===` `)break;if(t===`:`&&e32){f(!1),o(``),c(-1);return}if(l.includes(`:`)){f(!1),o(``),c(-1);return}o(l),c(s),f(!0),u(0);let d=ai(r,s);m(_(d))},[e,_]);(0,Q.useEffect)(()=>{let t=e.current;if(!t)return;let n=()=>{S(t.value,t.selectionStart)},r=()=>S(),i=e=>{[`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key)&&S()};return t.addEventListener(`input`,n),t.addEventListener(`click`,r),t.addEventListener(`keyup`,i),()=>{t.removeEventListener(`input`,n),t.removeEventListener(`click`,r),t.removeEventListener(`keyup`,i)}},[e,S,t]),(0,Q.useEffect)(()=>{let n=e.current;n&&S(t,n.selectionStart)},[t,S,e]),(0,Q.useEffect)(()=>{if(!d||x.length===0)return;let t=e.current;if(!t)return;let n=e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),u(e=>ee>0?e-1:x.length-1);break;case`Enter`:case`Tab`:x.length>0&&(e.preventDefault(),e.stopImmediatePropagation(),C(x[l]));break;case`Escape`:e.preventDefault(),f(!1);break}};return t.addEventListener(`keydown`,n),()=>t.removeEventListener(`keydown`,n)},[d,x,l,e]),(0,Q.useEffect)(()=>{l>=0&&g.current&&g.current.querySelectorAll(`[data-emoji-item]`)[l]?.scrollIntoView({block:`nearest`})},[l]);let C=(0,Q.useCallback)(t=>{let l=e.current?.selectionStart??s+a.length+1;if(t.customUrl){let e=t.name;n({start:s,end:l,replacement:`:${e}: `});let a=i.find(t=>t.shortcode===e);a&&r&&r(a)}else t.native&&n({start:s,end:l,replacement:t.native});f(!1),o(``),c(-1)},[s,a,e,n,r,i]);return!d||!p||x.length===0?null:v((0,$.jsx)(`div`,{ref:h,"data-autocomplete-dropdown":!0,className:`fixed z-[300] w-[280px] rounded-xl border border-border bg-popover shadow-lg overflow-hidden animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-150 pointer-events-auto`,style:{top:p.top,left:p.left},children:(0,$.jsx)(`div`,{ref:g,className:`max-h-[280px] overflow-y-auto py-1`,children:x.map((e,t)=>(0,$.jsxs)(`button`,{"data-emoji-item":!0,className:z(`w-full flex items-center gap-3 px-3 py-1.5 text-left text-popover-foreground transition-colors cursor-pointer`,t===l?`bg-secondary/60`:`hover:bg-secondary/60`),onPointerDown:t=>{t.preventDefault(),C(e)},children:[e.customUrl?(0,$.jsx)(H,{name:e.name,url:e.customUrl,className:`size-5 object-contain shrink-0`}):(0,$.jsx)(`span`,{className:`text-xl leading-none shrink-0 font-emoji`,children:e.native}),(0,$.jsxs)(`span`,{className:`text-sm truncate`,children:[`:`,e.id.replace(`custom:`,``),`:`]})]},e.id))})}),document.body)}function pi({customEmojis:e,onSelect:t,height:n=350,autoFocus:r=!0,onSearchActiveChange:i}){let[a,o]=(0,Q.useState)(``),s=(0,Q.useRef)(null),[c,l]=(0,Q.useState)(!1),u=c||a.trim().length>0;(0,Q.useEffect)(()=>{i?.(u)},[u,i]),(0,Q.useEffect)(()=>{if(r){let e=setTimeout(()=>s.current?.focus(),100);return()=>clearTimeout(e)}},[r]);let d=(0,Q.useMemo)(()=>{if(!a.trim())return e;let t=a.toLowerCase();return e.filter(e=>e.shortcode.toLowerCase().includes(t))},[e,a]);return e.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center text-muted-foreground gap-2`,style:{height:n},children:[(0,$.jsx)(m,{className:`size-8 opacity-40`}),(0,$.jsx)(`p`,{className:`text-sm`,children:`No sticker packs yet`}),(0,$.jsx)(`p`,{className:`text-xs`,children:`Add emoji packs to your profile to use stickers`})]}):(0,$.jsxs)(`div`,{className:`flex flex-col`,style:{height:n},children:[(0,$.jsx)(`div`,{className:`px-3 pt-3 pb-2 shrink-0`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ae,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 size-4 text-muted-foreground pointer-events-none`}),(0,$.jsx)(pt,{ref:s,value:a,onChange:e=>o(e.target.value),onFocus:()=>l(!0),onBlur:()=>l(!1),placeholder:`Search stickers...`,className:`pl-8 pr-8 h-9 text-base md:text-sm bg-muted/50 border-0 rounded-lg`}),a&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>o(``),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors`,children:(0,$.jsx)(g,{className:`size-3.5`})})]})}),(0,$.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto overscroll-contain`,children:d.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-muted-foreground`,children:[(0,$.jsx)(`p`,{className:`text-sm`,children:`No stickers found`}),(0,$.jsx)(`p`,{className:`text-xs mt-1`,children:`Try a different search term`})]}):(0,$.jsx)(`div`,{className:`grid grid-cols-4 gap-1.5 p-2`,children:d.map(e=>(0,$.jsx)(`button`,{type:`button`,title:e.shortcode,onClick:()=>t(e),className:`aspect-square rounded-lg overflow-hidden hover:bg-muted transition-colors p-1 group`,children:(0,$.jsx)(H,{name:e.shortcode,url:e.url,className:`w-full h-full object-contain group-hover:scale-110 transition-transform duration-150`})},e.shortcode))})})]})}function mi(e,t){!t.id||!t.sig||e.event(t,{signal:AbortSignal.timeout(5e3)}).catch(()=>{})}var hi=new Set([`e`,`E`,`a`,`A`,`i`,`I`]),gi=[{prefix:[`replies`],rootIndex:1,order:`asc`},{prefix:[`nostr`,`comments`],rootIndex:2,order:`asc`},{prefix:[`event-comments`],rootIndex:1,order:`desc`}];function _i(e){let t=new Set;for(let[n,r]of e.tags)r&&hi.has(n)&&t.add(r);return t}function vi(e){let t=new Set;if(!e)return t;if(typeof e==`string`)return t.add(e);if(e instanceof URL)return t.add(e.toString());if(e.id&&t.add(e.id),M.addressable(e.kind)||M.replaceable(e.kind)){let n=M.addressable(e.kind)?e.tags.find(([e])=>e===`d`)?.[1]??``:``;t.add(`${e.kind}:${e.pubkey}:${n}`)}return t}function yi(e,t,n){let r=_i(t),i=vi(n);for(let{prefix:n,rootIndex:a,order:o}of gi){for(let s of e.getQueryCache().findAll({queryKey:n,type:`active`})){let n=s.queryKey[a];typeof n!=`string`||!n||e.setQueryData(s.queryKey,e=>!e||e.some(e=>e.id===t.id)||!(i.has(n)||r.has(n)||e.some(e=>r.has(e.id)))?e:[...e,t].sort((e,t)=>o===`asc`?e.created_at-t.created_at:t.created_at-e.created_at))}e.invalidateQueries({queryKey:n,refetchType:`none`})}}var bi=new Set([1111,1244]),xi=new Set([1,1222]);function Si(e){return bi.has(e.kind)||e.tags.filter(([e])=>e===`e`).some(([,,,e])=>e!==`mention`)?!0:e.tags.some(([e,,,t])=>e===`a`&&(t===`root`||t===`reply`))}function Ci(e){return Ti(e)?.[1]}function wi(e){let t=Ti(e);if(!t)return;let n=(bi.has(e.kind)?t[3]:t[4])||e.tags.find(([e])=>e===`p`)?.[1]||void 0;return{id:t[1],relayHint:t[2]||void 0,authorHint:n}}function Ti(e){if(e.kind===7)return e.tags.findLast(([e])=>e===`e`);let t=e.tags.filter(([e,,,t])=>e===`e`&&t!==`mention`);return t.length===0?void 0:t.find(([,,,e])=>e===`reply`)||t.find(([,,,e])=>e===`root`)||t[t.length-1]}function Ei(e){if(!xi.has(e.kind))return;let t=e.tags.find(([e,,,t])=>e===`a`&&t===`root`),n=ft(t?.[1]);if(t&&n)return{type:`addr`,addr:t[1],kind:n.kind,pubkey:n.pubkey,relayHint:t[2]||void 0};let r=e.tags.filter(([e,,,t])=>e===`e`&&t!==`mention`),i=r.find(([,,,e])=>e===`root`)??r[0];if(!(!i||!B(i[1])))return{type:`event`,id:i[1],kind:e.kind,pubkey:B(i[4])?i[4]:void 0,relayHint:i[2]||void 0}}function Di(e,t,n,r){let i=[e,t,n??``,r??``];for(;i.length>2&&!i[i.length-1];)i.pop();return i}function Oi(){let{nostr:e}=ge(),{mutateAsync:t}=Ke(),n=_e();return ve({mutationFn:async({root:n,reply:r,content:i,tags:a,rootTags:o,kind:s=1111})=>{let c=Ai(r),l=[];if(o?.length?l.push(...o):l.push(...ki(`root`,n,c)),r?l.push(...ki(`reply`,r,c)):l.push(...ki(`reply`,n,c)),a){let e=new Set(l.filter(([e])=>e===`p`).map(([,e])=>e));for(let t of a)t[0]===`p`&&e.has(t[1])||l.push(t)}let u=await t({kind:s,content:i,tags:l});return r&&typeof r!=`string`&&!(r instanceof URL)&&mi(e,r),typeof n!=`string`&&!(n instanceof URL)&&mi(e,n),u},onSuccess:(e,{root:t})=>{yi(n,e,t)}})}function ki(e,t,n){let r=[],{aHints:i,eHints:a,pHints:o}=n;if(typeof t==`string`)r.push([`I`,t]);else if(t instanceof URL)r.push([`I`,t.toString()]);else if((M.replaceable(t.kind)||M.addressable(t.kind))&&B(t.pubkey)){let e=t.tags.find(([e])=>e===`d`)?.[1]??``,n=`${t.kind}:${t.pubkey}:${M.addressable(t.kind)?e:``}`;r.push(Di(`A`,n,i.get(n)?.[0]))}else{let[e,n]=a.get(t.id)??[],i=B(t.pubkey)?t.pubkey:n;r.push(Di(`E`,t.id,e,i))}if(typeof t==`string`)r.push([`K`,`#`]);else if(t instanceof URL)switch(t.protocol){case`http:`:case`https:`:r.push([`K`,`web`]);break;default:r.push([`K`,t.protocol.replace(/:$/,``)]);break}else r.push([`K`,t.kind.toString()]),B(t.pubkey)&&r.push([`P`,t.pubkey,...o.get(t.pubkey)??[]]);return e===`reply`?r.map(([e,...t])=>[e.toLowerCase(),...t]):r}function Ai(e){let t=new Map,n=new Map,r=new Map;if(!ji(e))return{pHints:t,eHints:n,aHints:r};for(let[i,a,...o]of e.tags){let e=i?.toLowerCase();if(e===`p`)try{let e=new URL(o[0]);t.set(a,[e.href])}catch{}else if(e===`a`)try{let e=new URL(o[0]);r.set(a,[e.href])}catch{}else if(e===`e`){let e=B(o[1])?o[1]:void 0;try{let t=new URL(o[0]);n.set(a,[t.href,...e?[e]:[]])}catch{e&&n.set(a,[``,e])}}}return{pHints:t,eHints:n,aHints:r}}function ji(e){return!!e&&typeof e!=`string`&&!(e instanceof URL)}function Mi(e,t){return{insertAtCursor:(0,Q.useCallback)(({start:n,end:r,replacement:i})=>{let a=e.current?.value??``;t(a.slice(0,n)+i+a.slice(r)),requestAnimationFrame(()=>{let t=e.current;if(t){t.focus();let e=n+i.length;t.setSelectionRange(e,e)}})},[t,e]),insertEmoji:(0,Q.useCallback)(n=>{let r=e.current;if(r){let e=r.value,i=r.selectionStart,a=r.selectionEnd;t(e.slice(0,i)+n+e.slice(a)),requestAnimationFrame(()=>{r.focus();let e=i+n.length;r.setSelectionRange(e,e)})}else t(e=>e+n)},[t,e])}}var Ni=60,Pi=100,Fi=100;function Ii(){if(typeof MediaRecorder>`u`)return`audio/webm`;for(let e of[`audio/mp4`,`audio/mp4;codecs=aac`,`audio/aac`,`audio/webm;codecs=opus`,`audio/webm`,`audio/ogg;codecs=opus`])if(MediaRecorder.isTypeSupported(e))return e;return`audio/webm`}function Li(){let[e,t]=(0,Q.useState)(!1),[n,r]=(0,Q.useState)(0),[i,a]=(0,Q.useState)([]),o=(0,Q.useRef)(null),s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u=(0,Q.useRef)([]),d=(0,Q.useRef)([]),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),h=(0,Q.useRef)(null),g=typeof navigator<`u`&&!!navigator.mediaDevices&&!!navigator.mediaDevices.getUserMedia&&typeof MediaRecorder<`u`;(0,Q.useEffect)(()=>()=>{_()},[]);let _=(0,Q.useCallback)(()=>{f.current&&=(clearInterval(f.current),null),p.current&&=(clearInterval(p.current),null),l.current&&=(l.current.getTracks().forEach(e=>e.stop()),null),s.current&&=(s.current.close().catch(()=>{}),null),c.current=null,o.current=null,u.current=[]},[]);return{isSupported:g,isRecording:e,recordingDuration:n,liveWaveform:i,startRecording:(0,Q.useCallback)(async()=>{if(e||!g)return;let n=await navigator.mediaDevices.getUserMedia({audio:!0});l.current=n;let i=new AudioContext;s.current=i;let v=i.createMediaStreamSource(n),y=i.createAnalyser();y.fftSize=256,v.connect(y),c.current=y;let b=Ii(),x=new MediaRecorder(n,{mimeType:b});o.current=x,u.current=[],d.current=[],x.ondataavailable=e=>{e.data.size>0&&u.current.push(e.data)},x.onstop=()=>{let e=new Blob(u.current,{type:b}),n=(Date.now()-m.current)/1e3,i=d.current,o=Ri(i,Pi),s={blob:e,mimeType:b,duration:n,waveform:o};h.current&&=(h.current(s),null),_(),t(!1),r(0),a([])},x.start(250),m.current=Date.now(),t(!0),r(0),a([]),f.current=setInterval(()=>{let e=(Date.now()-m.current)/1e3;r(e),e>=Ni&&o.current?.state===`recording`&&o.current.stop()},100),p.current=setInterval(()=>{if(!c.current)return;let e=new Uint8Array(c.current.frequencyBinCount);c.current.getByteTimeDomainData(e);let t=0;for(let n=0;n[...e,r])},Fi)},[e,g,_]),stopRecording:(0,Q.useCallback)(async()=>{let e=o.current;return!e||e.state!==`recording`?null:new Promise(t=>{h.current=t,e.stop()})},[]),cancelRecording:(0,Q.useCallback)(()=>{let e=o.current;e&&e.state===`recording`?(e.onstop=()=>{_(),t(!1),r(0),a([])},e.stop()):(_(),t(!1),r(0),a([])),h.current&&=(h.current(null),null)},[_])}}function Ri(e,t){if(e.length===0)return[];if(e.length<=t)return e;let n=[],r=e.length/t;for(let i=0;io&&(o=e[n]);n.push(o)}return n}var zi=(0,Q.lazy)(()=>pe(()=>import(`./EmojiPicker-Bj-YkY3r.js`).then(e=>({default:e.EmojiPicker})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]))),Bi=5e3;function Vi(){return Math.random().toString(36).slice(2,8)}async function Hi(e){if(!e.type.startsWith(`image/`))return{};try{let t=URL.createObjectURL(e);try{let e=await new Promise((e,n)=>{let r=new Image;r.onload=()=>e(r),r.onerror=n,r.src=t}),n=e.naturalWidth,r=e.naturalHeight;if(!n||!r)return{};let i=`${n}x${r}`,a=64/n,o=Math.max(1,Math.round(r*a)),s=document.createElement(`canvas`);s.width=64,s.height=o;let c=s.getContext(`2d`);if(!c)return{dim:i};c.drawImage(e,0,0,64,o);let{data:l}=c.getImageData(0,0,64,o);return{dim:i,blurhash:St(l,64,o,4,3)}}finally{URL.revokeObjectURL(t)}}catch{return{}}}function Ui(e){return e instanceof URL||typeof e==`string`}function Wi(e){let t=[],n=!1;for(let r of e.tags){let[e,i]=r;switch(e){case`I`:i&&(t.push([...r]),n=!0);break;case`A`:ft(i)&&(t.push([...r]),n=!0);break;case`E`:i&&B(i)&&(t.push([...r]),n=!0);break;case`K`:i&&t.push([...r]);break;case`P`:i&&B(i)&&t.push([...r]);break}}return n?t:null}var Gi=new Set([1111,1244]);function Ki(e){let t=[e.type===`addr`?Di(`A`,e.addr,e.relayHint):Di(`E`,e.id,e.relayHint,e.pubkey),[`K`,e.kind.toString()]];return e.pubkey&&t.push([`P`,e.pubkey]),t}function qi(e){if(Ui(e))return{root:e};if(Gi.has(e.kind))return{root:e,reply:e,rootTags:Wi(e)??void 0};let t=Ei(e);return t?{root:e,reply:e,rootTags:Ki(t)}:{root:e}}function Ji({count:e,max:t}){let n=2*Math.PI*10,r=n*(1-Math.min(e/t,1)),i=e>t,a=e>t*.9;return(0,$.jsx)(`div`,{className:`relative flex items-center justify-center size-7`,children:(0,$.jsxs)(`svg`,{width:`28`,height:`28`,viewBox:`0 0 28 28`,className:`-rotate-90`,children:[(0,$.jsx)(`circle`,{cx:`14`,cy:`14`,r:10,fill:`none`,strokeWidth:`2.5`,className:`stroke-secondary`}),(0,$.jsx)(`circle`,{cx:`14`,cy:`14`,r:10,fill:`none`,strokeWidth:`2.5`,strokeDasharray:n,strokeDashoffset:r,strokeLinecap:`round`,className:z(`transition-all duration-150`,i?`stroke-destructive`:a?`stroke-amber-500`:`stroke-primary`)})]})})}function Yi({onSuccess:e,placeholder:t=`What's on your mind?`,compact:n=!1,replyTo:r,quotedEvent:i,forceExpanded:l=!1,hideAvatar:d=!1,hideBorder:p=!1,previewMode:_,onHasPreviewableContentChange:v,initialContent:y=``,initialMode:x=`post`}){let{user:S,metadata:C,event:w,isLoading:T}=He(),te=Ye(C),ne=rt(S?.pubkey??``,C),re=(0,Q.useMemo)(()=>Jt(Yt(w?.content)),[w?.content]),{nostr:E}=ge(),{mutateAsync:ie,isPending:ae,isPending:oe}=Ke(),{mutateAsync:se,isPending:ce}=Oi(),{mutateAsync:D,isPending:le}=bt(),{feedSettings:ue}=qt(),de=ue.showCustomEmojis!==!1,{emojis:fe}=Ut(),O=(0,Q.useMemo)(()=>de?fe:[],[de,fe]),k=_e(),{toast:A}=Ve(),{config:j}=Le(),me=j.imageQuality,he=Gt(),M=(0,Q.useMemo)(()=>r instanceof URL?`compose-draft:url:${r.href}`:typeof r==`string`?`compose-draft:ext:${r}`:r?`compose-draft:reply:${r.id}`:i?`compose-draft:quote:${i.id}`:`compose-draft:new`,[r,i]),[N,F]=(0,Q.useState)(()=>{if(y)return y;try{return localStorage.getItem(M)??``}catch{return``}}),[ve,ye]=(0,Q.useState)(!1),[be,Se]=(0,Q.useState)(!1),[I,Ce]=(0,Q.useState)(``),[L,we]=(0,Q.useState)(!1),[R,Fe]=(0,Q.useState)(`emoji`),[Ie,Re]=(0,Q.useState)(!1),[ze,Be]=(0,Q.useState)(!1),[Ue,We]=(0,Q.useState)(!1),[B,Qe]=(0,Q.useState)(!1),[et,tt]=(0,Q.useState)(x),[H,nt]=(0,Q.useState)([{id:Vi(),label:``},{id:Vi(),label:``}]),[it,at]=(0,Q.useState)(`singlechoice`),[ot,st]=(0,Q.useState)(7),[U,ct]=(0,Q.useState)(new Set),[W,ut]=(0,Q.useState)(new Map),[dt,ft]=(0,Q.useState)(new Map),[G,mt]=(0,Q.useState)(new Map),K=(0,Q.useRef)(null),ht=(0,Q.useRef)(null),{insertAtCursor:gt,insertEmoji:St}=Mi(K,F),wt=(0,Q.useRef)(null),J=Li(),[Tt,kt]=(0,Q.useState)(!1),At=(0,Q.useCallback)(()=>{F(``),Se(!1),Ce(``),ye(!1),we(!1),We(!1),Qe(!1),tt(x),nt([{id:Vi(),label:``},{id:Vi(),label:``}]),at(`singlechoice`),st(7),ct(new Set),ut(new Map),ft(new Map),mt(new Map);try{localStorage.removeItem(M)}catch{}},[x,M]),jt=_===void 0?B:_;(0,Q.useEffect)(()=>{(i||N)&&ye(!0)},[i]),(0,Q.useEffect)(()=>{let e=K.current;if(!e)return;let t=ht.current,n=t?.scrollTop??0;if(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`,l&&t&&(t.scrollTop=n,e.selectionStart===e.selectionEnd&&e.selectionStart===e.value.length)){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect().bottom-n.top+t.scrollTop-t.clientHeight;r>t.scrollTop&&(t.scrollTop=r)}},[N,jt,l]),(0,Q.useEffect)(()=>{if(y)return;let e=setTimeout(()=>{try{N.trim()?localStorage.setItem(M,N):localStorage.removeItem(M)}catch{}},300);return()=>clearTimeout(e)},[N,M,y]),(0,Q.useEffect)(()=>{he&&L&&K.current?.blur()},[L,he]);let Mt=N.length,Nt=Bi-Mt,Y=(0,Q.useCallback)(()=>{ve||ye(!0)},[ve]),Pt=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{ve&&!Pt.current&&K.current?.focus(),Pt.current=ve},[ve]);let X=(0,Q.useMemo)(()=>{let e=[],t=N.matchAll(/nostr:(nevent1|note1|naddr1)[023456789acdefghjklmnpqrstuvwxyz]+/g);for(let n of t){let t=n[0].slice(6);try{let r=P.decode(t);r.type===`nevent`?e.push({type:`nevent`,value:n[0],index:n.index,eventId:r.data.id}):r.type===`note`?e.push({type:`note`,value:n[0],index:n.index,eventId:r.data}):r.type===`naddr`&&e.push({type:`naddr`,value:n[0],index:n.index,addr:{kind:r.data.kind,pubkey:r.data.pubkey,identifier:r.data.identifier}})}catch{}}let n=N.matchAll(/\b(nevent1|note1|naddr1)[023456789acdefghjklmnpqrstuvwxyz]+\b/g);for(let t of n){let n=t[0],r=t.index-6;if(!N.substring(Math.max(0,r),t.index).endsWith(`nostr:`))try{let r=P.decode(n);r.type===`nevent`?e.push({type:`nevent`,value:t[0],index:t.index,eventId:r.data.id}):r.type===`note`?e.push({type:`note`,value:t[0],index:t.index,eventId:r.data}):r.type===`naddr`&&e.push({type:`naddr`,value:t[0],index:t.index,addr:{kind:r.data.kind,pubkey:r.data.pubkey,identifier:r.data.identifier}})}catch{}}let r=N.matchAll(/https?:\/\/[^\s]+/g);for(let t of r){let n=t[0];Me.test(n)||e.push({type:`link`,value:n,index:t.index})}return e.sort((e,t)=>e.index-t.index)},[N]),Z=(0,Q.useMemo)(()=>X.filter(e=>!U.has(e.value)),[X,U]),Ft=(0,Q.useMemo)(()=>N?Ee(N):[],[N]),It=(0,Q.useMemo)(()=>N?Pe(N):[],[N]),Lt=(0,Q.useMemo)(()=>N?/https?:\/\/[^\s]+\.(jpg|jpeg|png|gif|webp|svg|avif)(\?[^\s]*)?/i.test(N):!1,[N]),Rt=(0,Q.useMemo)(()=>/nostr:(npub1|nprofile1)[023456789acdefghjklmnpqrstuvwxyz]+/.test(N),[N]),zt=(0,Q.useMemo)(()=>{if(O.length===0||!N)return!1;let e=new Set(O.map(e=>e.shortcode)),t=N.matchAll(/:([a-zA-Z0-9_-]+):/g);for(let n of t)if(e.has(n[1]))return!0;return!1},[N,O]),Bt=(0,Q.useMemo)(()=>dt.size>0,[dt]),Vt=(0,Q.useMemo)(()=>N?Ae(N).some(({uri:e})=>{let t=Ne(e.ext);return t.startsWith(`image/`)||t.startsWith(`video/`)||t.startsWith(`audio/`)}):!1,[N]),Wt=(0,Q.useMemo)(()=>Z.length>0||Lt||Ft.length>0||It.length>0||Bt||Rt||zt||Vt,[Z,Lt,Ft,It,Bt,Rt,zt,Vt]);(0,Q.useEffect)(()=>{v&&v(Wt)},[Wt,v]);let Kt=(0,Q.useMemo)(()=>{if(!i)return null;if(i.kind>=3e4&&i.kind<4e4){let e=i.tags.find(([e])=>e===`d`)?.[1]??``;return P.naddrEncode({kind:i.kind,pubkey:i.pubkey,identifier:e,relays:[qe]})}return P.neventEncode({id:i.id,author:i.pubkey,relays:[qe]})},[i]),Zt=Kt?`nostr:${Kt}`:null,Qt=i&&Zt&&!U.has(Zt),$t=(0,Q.useMemo)(()=>{if(!S||!N)return null;let e=$e(N).map(e=>[`t`,e]);if(O.length>0){let t=new Map(O.map(e=>[e.shortcode,e.url])),n=/:([a-zA-Z0-9_-]+):/g,r=new Set,i;for(;(i=n.exec(N))!==null;){let n=i[1];t.has(n)&&!r.has(n)&&(r.add(n),e.push([`emoji`,n,t.get(n)]))}}let t=N.matchAll(new RegExp(Te.source,`gi`)),n=new Set;for(let r of t){let t=r[0];if(n.has(t))continue;n.add(t);let i=r[1].toLowerCase(),a=i===`xdc`,o=W.get(t);if(o){let n=o.map(e=>`${e[0]} ${e[1]}`);if(a){let r=n.filter(e=>!e.startsWith(`m `));r.push(`m application/x-webxdc`);let i=dt.get(t);i&&r.push(`webxdc ${i}`);let a=G.get(t);a?.name&&r.push(`summary ${a.name}`),a?.iconUrl&&r.push(`image ${a.iconUrl}`),e.push([`imeta`,...r])}else e.push([`imeta`,...n])}else{let n=Ne(i),r=[`imeta`,`url ${t}`,`m ${n}`];if(a){let e=dt.get(t);e&&r.push(`webxdc ${e}`);let n=G.get(t);n?.name&&r.push(`summary ${n.name}`),n?.iconUrl&&r.push(`image ${n.iconUrl}`)}e.push(r)}}for(let{uri:t,raw:r}of Ae(N))n.has(r)||(n.add(r),e.push(Oe(t,r)));return{id:`preview`,pubkey:S.pubkey,content:N.trim(),created_at:Math.floor(Date.now()/1e3),kind:1,tags:e,sig:``}},[S,N,O,W,dt,G]),en=(0,Q.useCallback)(e=>{St(e),Y()},[St,Y]),tn=gt,nn=gt,rn=(0,Q.useCallback)(async e=>{try{let t=e.name.endsWith(`.xdc`),n=e.type.startsWith(`image/`),r,i;if(t&&!e.type)r=new File([e],e.name,{type:`application/x-webxdc`});else if(n&&me===`compressed`){let t=await Xt(e);r=t.file,i=t.dimensions}else r=e;let a=await D(r),[[,o]]=a;if(t&&!o.endsWith(`.xdc`)){o+=`.xdc`;let e=a.find(e=>e[0]===`url`);e&&(e[1]=o)}if(!t&&n){let e=e=>a.some(t=>t[0]===e);if(i&&!e(`dim`)&&a.push([`dim`,i]),!e(`blurhash`)){let{blurhash:e}=await Hi(r);e&&a.push([`blurhash`,e])}}if(ut(e=>new Map(e).set(o,a)),F(e=>e?e+` `+o:o),t){let t=crypto.randomUUID();ft(e=>new Map(e).set(o,t));try{let{extractWebxdcMeta:t}=await pe(async()=>{let{extractWebxdcMeta:e}=await import(`./webxdcMeta-BE41E4P0.js`).then(e=>e.n);return{extractWebxdcMeta:e}},__vite__mapDeps([21,1,22])),n=await t(e),r={name:n.name};if(n.iconFile)try{let[[,e]]=await D(n.iconFile);r.iconUrl=e}catch{}mt(e=>new Map(e).set(o,r))}catch{}}Y()}catch{A({title:`Upload failed`,description:`Could not upload file.`,variant:`destructive`})}},[D,Y,A,me]),an=(0,Q.useCallback)(async e=>{let t=e.clipboardData?.items;if(t)for(let n=0;n{try{await J.startRecording(),Y()}catch{A({title:`Microphone access denied`,description:`Please allow microphone access to record voice messages.`,variant:`destructive`})}},[J,Y,A]),sn=(0,Q.useCallback)(async()=>{if(S){kt(!0);try{let t=await J.stopRecording();if(!t)return;let n={"audio/mp4":`.m4a`,"audio/mp4;codecs=aac":`.m4a`,"audio/aac":`.aac`,"audio/webm;codecs=opus":`.webm`,"audio/webm":`.webm`,"audio/ogg;codecs=opus":`.ogg`}[t.mimeType]??`.webm`,i=`voice-message-${Date.now()}${n}`,a=new File([t.blob],i,{type:t.mimeType}),[[,o]]=await D(a),s=[`imeta`,`url ${o}`,`m ${t.mimeType}`,`waveform ${t.waveform.join(` `)}`,`duration ${Math.round(t.duration)}`];if(r)await se({...qi(r),content:o,tags:[s],kind:1244}),k.invalidateQueries({queryKey:[`feed`],refetchType:`none`});else{let e=await ie({kind:1222,content:o,tags:[s]});Ct(k,e)}lt(),A({title:`Voice message sent!`,description:`Your voice message has been published.`}),e?.()}catch{A({title:`Error`,description:`Failed to send voice message.`,variant:`destructive`})}finally{kt(!1)}}},[S,J,D,ie,se,r,k,A,e]),cn=(0,Q.useCallback)(e=>j.stripTrackingParams===!1?e:De(e,new Set(W.keys())),[j.stripTrackingParams,W]),ln=async()=>{if(!(!N.trim()||!S||Mt>Bi))try{let t=$e(N).map(e=>[`t`,e]),n=N.matchAll(/nostr:((?:npub1|nprofile1)[023456789acdefghjklmnpqrstuvwxyz]+)/g),a=new Set;for(let e of n)try{let t=P.decode(e[1]);t.type===`npub`?a.add(t.data):t.type===`nprofile`&&a.add(t.data.pubkey)}catch{}a.delete(S.pubkey);for(let e of a)t.push([`p`,e]);let o=cn(N.trim());if(Qt&&i&&Kt){if(i.kind>=3e4&&i.kind<4e4){let e=i.tags.find(([e])=>e===`d`)?.[1]??``;t.push([`q`,`${i.kind}:${i.pubkey}:${e}`,qe])}else t.push([`q`,i.id,qe,i.pubkey]);let e=`nostr:${Kt}`;o.includes(e)||(o=o+` `+e)}if(be&&(t.push([`content-warning`,I||``]),t.push([`L`,`content-warning`]),I&&t.push([`l`,I,`content-warning`])),O.length>0){let e=new Map(O.map(e=>[e.shortcode,e.url])),n=/:([a-zA-Z0-9_-]+):/g,r=new Set,i;for(;(i=n.exec(o))!==null;){let n=i[1];e.has(n)&&!r.has(n)&&(r.add(n),t.push([`emoji`,n,e.get(n)]))}}let s=o.matchAll(new RegExp(Te.source,`gi`)),c=new Set;for(let e of s){let n=e[0];if(c.has(n))continue;c.add(n);let r=e[1].toLowerCase(),i=r===`xdc`,a=W.get(n);if(a){let e=a.map(e=>`${e[0]} ${e[1]}`);if(i){let r=e.filter(e=>!e.startsWith(`m `));r.push(`m application/x-webxdc`);let i=dt.get(n);i&&r.push(`webxdc ${i}`);let a=G.get(n);a?.name&&r.push(`summary ${a.name}`),a?.iconUrl&&r.push(`image ${a.iconUrl}`),t.push([`imeta`,...r])}else t.push([`imeta`,...e])}else{let e=Ne(r),a=[`imeta`,`url ${n}`,`m ${e}`];if(i){let e=dt.get(n);e&&a.push(`webxdc ${e}`);let t=G.get(n);t?.name&&a.push(`summary ${t.name}`),t?.iconUrl&&a.push(`image ${t.iconUrl}`)}t.push(a)}}for(let{uri:e,raw:n}of Ae(o))c.has(n)||(c.add(n),t.push(Oe(e,n)));let l,u;if(r){let e=qi(r);u=e.root,l=await se({...e,content:o,tags:t})}else l=await ie({kind:1,content:o,tags:t,created_at:Math.floor(Date.now()/1e3)});At(),Qt&&i&&mi(E,i),r&&!Ui(r)&&k.setQueryData([`event-stats`,r.id],e=>e&&{...e,replies:e.replies+1}),r?k.invalidateQueries({queryKey:[`feed`],refetchType:`none`}):Ct(k,l),r&&yi(k,l,u??r),i&&(k.invalidateQueries({queryKey:[`event-stats`,i.id]}),k.invalidateQueries({queryKey:[`event-interactions`,i.id]})),lt();let d=xt({id:l.id,author:l.pubkey,kind:l.kind});A({title:`Posted!`,description:r?`Your reply has been published.`:i?`Your quote has been published.`:`Your note has been published.`,action:d?(0,$.jsx)(yr,{altText:`View post`,asChild:!0,children:(0,$.jsx)(V,{to:`/${d}`,children:`View`})}):void 0}),e?.()}catch{A({title:`Error`,description:`Failed to publish note.`,variant:`destructive`})}},un=async()=>{let t=H.filter(e=>e.label.trim()),n=cn(N.trim());if(!n||t.length<2||!S||oe)return;let r=[];for(let e of t)r.push([`option`,e.id,e.label.trim()]);r.push([`polltype`,it]),ot>0&&r.push([`endsAt`,String(Math.floor(Date.now()/1e3)+ot*86400)]);let i=n.matchAll(new RegExp(Te.source,`gi`)),a=new Set;for(let e of i){let t=e[0];if(a.has(t))continue;a.add(t);let n=W.get(t);if(n)r.push([`imeta`,...n.map(e=>`${e[0]} ${e[1]}`)]);else{let n=e[1].toLowerCase();r.push([`imeta`,`url ${t}`,`m ${Ne(n)}`])}}for(let{uri:e,raw:t}of Ae(n))a.has(t)||(a.add(t),r.push(Oe(e,t)));r.push([`alt`,`Poll: ${n}`]);try{let t=await ie({kind:1068,content:n,tags:r});At(),Ct(k,t),lt(),A({title:`Poll published!`}),e?.()}catch{A({title:`Error`,description:`Failed to publish poll.`,variant:`destructive`})}},dn=H.filter(e=>e.label.trim()).length,fn=N.trim().length>0&&dn>=2,pn=l||ve||N.length>0||!n,mn=L&&(R===`gif`&&Ie||R===`stickers`&&ze);return!S&&n?null:(0,$.jsxs)(`div`,{className:z(`px-4 pt-3 bg-background/85 flex flex-col`,l?`flex-1 min-h-0 rounded-2xl`:``,L?`pb-0`:`pb-3`,!l&&!p&&`border-b border-border`),children:[Wt&&_===void 0&&(0,$.jsx)(`div`,{className:`flex items-center justify-end mb-3`,children:(0,$.jsxs)(`div`,{className:`inline-flex items-center gap-0.5 p-1 bg-muted/50 rounded-lg`,children:[(0,$.jsx)(`button`,{onClick:()=>Qe(!1),className:z(`px-3.5 py-1.5 text-xs font-medium rounded-md transition-all`,jt?`text-muted-foreground hover:text-foreground`:`bg-background text-foreground shadow-sm`),children:`Edit`}),(0,$.jsx)(`button`,{onClick:()=>Qe(!0),className:z(`px-3.5 py-1.5 text-xs font-medium rounded-md transition-all`,jt?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:`Preview`})]})}),(0,$.jsxs)(`div`,{className:z(`flex gap-3`,l&&`flex-1 min-h-0`),children:[!d&&S&&(T?(0,$.jsx)(q,{className:`size-12 shrink-0 mt-0.5 rounded-full`}):(0,$.jsxs)(V,{to:ne,className:`relative shrink-0 mt-0.5`,children:[(0,$.jsxs)(Ze,{shape:te,className:`size-12`,children:[(0,$.jsx)(Xe,{src:C?.picture,alt:C?.name}),(0,$.jsx)(Je,{className:`bg-primary/20 text-primary text-sm`,children:(C?.name||C?.display_name||`Anonymous`)[0]?.toUpperCase()??`?`})]}),re&&(0,$.jsx)(`div`,{className:`pointer-events-none absolute -top-3 -right-1.5 z-10 rotate-[18deg]`,children:(0,$.jsx)(Vr,{className:`size-8 drop-shadow-sm`,pomScale:1.15})})]})),(0,$.jsx)(`div`,{className:z(`flex-1 min-w-0`,l&&`flex flex-col min-h-0`),children:(0,$.jsxs)(`div`,{ref:ht,className:z(l&&`flex-1 min-h-0 overflow-y-auto`),children:[jt?$t&&(0,$.jsx)(`div`,{className:`pt-2.5 pb-2 min-h-[100px] overflow-hidden motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-200`,children:(0,$.jsx)(`div`,{className:`text-lg opacity-85`,children:(0,$.jsx)(ke,{event:$t,className:`text-foreground`})})}):(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`textarea`,{ref:K,dir:`auto`,value:N,onChange:e=>F(e.target.value),onPointerDown:Y,onFocus:Y,onPaste:an,placeholder:et===`poll`?`Ask a question…`:t,className:z(`w-full bg-transparent text-foreground placeholder:text-muted-foreground resize-none outline-none text-lg pt-2.5 pb-2 opacity-85 break-words overflow-hidden transition-[min-height] duration-200 ease-in-out`,pn?`min-h-[100px]`:`min-h-[44px]`),rows:1,disabled:!S,autoFocus:l,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&ln()}}),(0,$.jsx)(ni,{textareaRef:K,content:N,onInsertMention:tn}),(0,$.jsx)(fi,{textareaRef:K,content:N,onInsertEmoji:nn})]}),et===`poll`&&(0,$.jsxs)(`div`,{className:`space-y-3 pt-1 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-2 motion-safe:duration-200`,children:[x!==`poll`&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>tt(`post`),className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(o,{className:`size-3.5`}),`Back to post`]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[H.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-1 motion-safe:duration-150`,children:[(0,$.jsx)(`input`,{type:`text`,value:e.label,onChange:t=>nt(n=>n.map(n=>n.id===e.id?{...n,label:t.target.value}:n)),placeholder:`Option ${t+1}`,maxLength:100,className:`flex-1 bg-secondary/40 rounded-lg px-3 py-1.5 text-sm outline-none focus:ring-1 focus:ring-primary/40 placeholder:text-muted-foreground`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>{H.length>2&&nt(t=>t.filter(t=>t.id!==e.id))},disabled:H.length<=2,className:`p-1 rounded-full text-muted-foreground hover:text-destructive transition-colors disabled:opacity-20`,children:(0,$.jsx)(g,{className:`size-3.5`})})]},e.id)),H.length<8&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>nt(e=>[...e,{id:Vi(),label:``}]),className:`flex items-center gap-1.5 text-xs text-primary hover:text-primary/80 transition-colors pt-0.5`,children:[(0,$.jsx)(f,{className:`size-3`}),`Add option`]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2 pt-0.5`,children:[[`singlechoice`,`multiplechoice`].map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>at(e),className:z(`text-xs px-2.5 py-1 rounded-full border transition-colors`,it===e?`border-primary bg-primary/10 text-primary font-medium`:`border-border text-muted-foreground hover:text-foreground hover:border-foreground/30`),children:e===`singlechoice`?`Single choice`:`Multiple choice`},e)),(0,$.jsx)(`div`,{className:`w-px bg-border self-stretch mx-0.5`}),[1,3,7,0].map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>st(e),className:z(`text-xs px-2.5 py-1 rounded-full border transition-colors`,ot===e?`border-primary bg-primary/10 text-primary font-medium`:`border-border text-muted-foreground hover:text-foreground hover:border-foreground/30`),children:e===0?(0,$.jsx)(`span`,{style:{fontSize:`15px`,lineHeight:1,position:`relative`,top:`-1px`},children:`∞`}):`${e}d`},e))]})]}),be&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 mb-2 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-1 motion-safe:duration-200`,children:[(0,$.jsx)(ee,{className:`size-4 text-amber-500 shrink-0`}),(0,$.jsx)(pt,{value:I,onChange:e=>Ce(e.target.value),placeholder:`Content warning reason (optional)`,className:`h-8 text-base md:text-sm bg-secondary/50 border-0 rounded-lg`}),(0,$.jsx)(`button`,{onClick:()=>{Se(!1),Ce(``)},className:`p-1 rounded-full text-muted-foreground hover:text-foreground transition-colors shrink-0`,children:(0,$.jsx)(g,{className:`size-4`})})]}),Qt&&i&&Zt&&(0,$.jsx)(`div`,{className:`mt-4 mb-3 overflow-hidden`,children:i.kind>=3e4&&i.kind<4e4?(0,$.jsx)(xe,{addr:{kind:i.kind,pubkey:i.pubkey,identifier:i.tags.find(([e])=>e===`d`)?.[1]??``}}):(0,$.jsx)(je,{eventId:i.id,authorHint:i.pubkey})})]})})]}),pn&&(J.isRecording||Tt?(0,$.jsxs)(`div`,{className:`flex items-center gap-3 mt-3 rounded-xl bg-destructive/5 border border-destructive/20 px-3 py-2.5 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-bottom-1 motion-safe:duration-200`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(`div`,{className:`size-2.5 rounded-full bg-destructive animate-pulse shrink-0`}),(0,$.jsx)(`span`,{className:`text-sm font-medium tabular-nums text-destructive`,children:Ht(J.recordingDuration)})]}),(0,$.jsx)(`div`,{className:`flex-1 flex items-center gap-[2px] h-6 overflow-hidden`,children:J.liveWaveform.slice(-60).map((e,t)=>(0,$.jsx)(`div`,{className:`w-[3px] shrink-0 rounded-full bg-destructive/60`,style:{height:`${3+e/100*21}px`}},t))}),(0,$.jsxs)(Ot,{children:[(0,$.jsx)(Et,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:J.cancelRecording,disabled:Tt,className:`p-2 rounded-full text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-all motion-safe:active:scale-90 disabled:opacity-40`,children:(0,$.jsx)(g,{className:`size-[18px]`})})}),(0,$.jsx)(Dt,{children:`Cancel`})]}),(0,$.jsxs)(Ge,{onClick:sn,disabled:Tt||J.recordingDuration<.5,className:`rounded-full px-4 font-bold`,size:`sm`,children:[Tt?(0,$.jsx)(b,{className:`size-4 animate-spin mr-1.5`}):(0,$.jsx)(a,{className:`size-3.5 mr-1.5`,fill:`currentColor`}),Tt?`Sending...`:`Send`]})]}):(0,$.jsxs)(`div`,{className:z(`flex items-center justify-between mt-3 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-150`,l&&`shrink-0`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsxs)(Ot,{children:[(0,$.jsx)(Et,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:()=>wt.current?.click(),disabled:le||!S,className:`p-2 rounded-full text-muted-foreground hover:text-primary hover:bg-primary/10 transition-all motion-safe:active:scale-90 disabled:opacity-40`,children:le?(0,$.jsx)(b,{className:`size-[18px] animate-spin`}):(0,$.jsx)(u,{className:`size-[18px]`})})}),(0,$.jsx)(Dt,{children:`Attach file`})]}),(0,$.jsx)(`input`,{ref:wt,type:`file`,accept:`image/*,video/*,audio/*,.xdc`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&Array.from(t).forEach(e=>rn(e)),e.target.value=``}}),J.isSupported&&(0,$.jsxs)(Ot,{children:[(0,$.jsx)(Et,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:on,disabled:!S,className:`p-2 rounded-full text-muted-foreground hover:text-primary hover:bg-primary/10 transition-all motion-safe:active:scale-90 disabled:opacity-40`,children:(0,$.jsx)(h,{className:`size-[18px]`})})}),(0,$.jsx)(Dt,{children:`Voice message`})]}),(0,$.jsxs)(Ot,{children:[(0,$.jsx)(Et,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,disabled:!S,onClick:()=>{L&&K.current?.focus(),we(!L)},className:z(`p-2 rounded-full transition-all motion-safe:active:scale-90 disabled:opacity-40`,L?`text-primary bg-primary/10`:`text-muted-foreground hover:text-primary hover:bg-primary/10`),children:(0,$.jsx)(s,{className:`size-[18px]`})})}),!L&&(0,$.jsx)(Dt,{children:`Emoji / GIF`})]}),(0,$.jsxs)(yt,{open:Ue,onOpenChange:We,children:[(0,$.jsxs)(Ot,{children:[(0,$.jsx)(Et,{asChild:!0,children:(0,$.jsx)(_t,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,disabled:!S,className:z(`p-2 rounded-full transition-all motion-safe:active:scale-90 disabled:opacity-40`,Ue&&`motion-safe:rotate-45`,Ue||et===`poll`||be?`text-primary bg-primary/10`:`text-muted-foreground hover:text-primary hover:bg-primary/10`),children:(0,$.jsx)(f,{className:`size-[18px]`,strokeWidth:2.5})})})}),!Ue&&(0,$.jsx)(Dt,{children:`More`})]}),(0,$.jsx)(vt,{side:`top`,align:`start`,sideOffset:6,className:`w-44 p-1.5 rounded-xl border-border shadow-lg`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[!r&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{tt(e=>e===`poll`?`post`:`poll`),We(!1),Y()},className:z(`flex items-center gap-2.5 w-full px-3 py-2 rounded-lg text-sm transition-colors`,et===`poll`?`text-primary bg-primary/10`:`text-muted-foreground hover:text-foreground hover:bg-secondary/60`),children:[(0,$.jsx)(c,{className:`size-4`}),(0,$.jsx)(`span`,{className:`font-medium`,children:`Poll`})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{Se(e=>!e),We(!1),Y()},className:z(`flex items-center gap-2.5 w-full px-3 py-2 rounded-lg text-sm transition-colors`,be?`text-amber-500 bg-amber-500/10`:`text-muted-foreground hover:text-foreground hover:bg-secondary/60`),children:[(0,$.jsx)(ee,{className:`size-4`}),(0,$.jsx)(`span`,{className:`font-medium`,children:`Spoiler`})]})]})})]})]}),(0,$.jsx)(`div`,{className:`flex-1`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[et===`post`&&Mt>0&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(Ji,{count:Mt,max:Bi}),(0,$.jsx)(`span`,{className:z(`text-xs tabular-nums`,Nt<0?`text-destructive font-semibold`:Nt<500?`text-amber-500`:`text-muted-foreground`),children:Nt})]}),et===`poll`?(0,$.jsx)(Ge,{onClick:un,disabled:!fn||oe||!S,className:`rounded-full px-5 font-bold transition-all motion-safe:active:scale-95`,size:`sm`,children:oe?`Publishing...`:`Publish poll`}):(0,$.jsx)(Ge,{onClick:ln,disabled:!N.trim()||ae||ce||!S||Mt>Bi,className:`rounded-full px-5 font-bold transition-all motion-safe:active:scale-95`,size:`sm`,children:ae||ce?`Posting...`:`Post!`})]})]})),L&&(0,$.jsxs)(`div`,{className:z(`-mx-4 mt-2 shrink-0 overflow-hidden rounded-t-2xl bg-popover motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-bottom-2 motion-safe:duration-200`,l&&`rounded-b-2xl`,mn&&l&&`flex flex-col grow-[999] shrink basis-0 min-h-0 sm:grow-0 sm:shrink-0 sm:basis-auto`),children:[(0,$.jsxs)(`div`,{className:`flex gap-1 px-3 pt-2 shrink-0`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Fe(`emoji`),className:z(`flex items-center justify-center gap-1.5 px-4 py-1.5 rounded-full text-sm font-medium transition-all motion-safe:active:scale-95`,R===`emoji`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground hover:bg-muted`),children:[(0,$.jsx)(s,{className:`size-3.5`}),`Emoji`]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Fe(`gif`),className:z(`flex items-center justify-center gap-1.5 px-4 py-1.5 rounded-full text-sm font-medium transition-all motion-safe:active:scale-95`,R===`gif`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground hover:bg-muted`),children:[(0,$.jsxs)(`svg`,{className:`block size-3.5 shrink-0`,viewBox:`0 0 18 18`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,children:[(0,$.jsx)(`rect`,{x:`1`,y:`1`,width:`16`,height:`16`,rx:`3`,stroke:`currentColor`,strokeWidth:`1.5`,fill:`none`}),(0,$.jsx)(`text`,{x:`9`,y:`9`,textAnchor:`middle`,dominantBaseline:`central`,fontSize:`7`,fontWeight:`700`,fontFamily:`system-ui,sans-serif`,fill:`currentColor`,letterSpacing:`0.5`,children:`GIF`})]}),`GIF`]}),de&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Fe(`stickers`),className:z(`flex items-center justify-center gap-1.5 px-4 py-1.5 rounded-full text-sm font-medium transition-all motion-safe:active:scale-95`,R===`stickers`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground hover:bg-muted`),children:[(0,$.jsx)(m,{className:`size-3.5`}),`Stickers`]})]}),(0,$.jsx)(`div`,{className:z(`min-h-[160px]`,mn?l?`flex-1 sm:flex-none sm:h-[min(420px,50dvh)]`:`h-[min(420px,50dvh)]`:`h-[min(280px,calc(var(--visual-viewport-height,100dvh)*0.4))]`),children:(0,$.jsx)(`div`,{className:`h-full motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-bottom-1 motion-safe:duration-150`,children:R===`emoji`?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{className:`w-full h-full flex items-center justify-center`,children:(0,$.jsx)(b,{className:`size-6 animate-spin text-muted-foreground`})}),children:(0,$.jsx)(zi,{customEmojis:O,height:`100%`,onSelect:e=>{e.type===`native`?en(e.emoji):en(`:${e.shortcode}:`)}})}):R===`stickers`?(0,$.jsx)(pi,{customEmojis:O,height:`100%`,autoFocus:!he,onSearchActiveChange:Be,onSelect:e=>{F(t=>t?t+` `+e.url:e.url),we(!1),Y(),K.current?.focus()}}):(0,$.jsx)(Qr,{autoFocus:!he,onSearchActiveChange:Re,onSelect:e=>{F(t=>t?t+` `+e.url:e.url),we(!1),Y(),K.current?.focus()}})},R)})]})]})}function Xi(e){let{config:t}=Le(),{esploraApis:n}=t,{data:r,isLoading:i,error:a}=F({queryKey:[`bitcoin-tx-detail`,n,e],queryFn:({signal:t})=>Pt(e,n,t),enabled:!!e,staleTime:6e4}),{data:o}=F({queryKey:[`btc-price`,n],queryFn:({signal:e})=>It(n,e),refetchInterval:6e4,staleTime:3e4});return{tx:r,btcPrice:o,isLoading:i,error:a}}function Zi(e){let{config:t}=Le(),{esploraApis:n}=t,{data:r,isLoading:i,error:a,refetch:o}=F({queryKey:[`bitcoin-address-detail`,n,e],queryFn:({signal:t})=>Lt(e,n,t),enabled:!!e,refetchInterval:3e4}),{data:s}=F({queryKey:[`btc-price`,n],queryFn:({signal:e})=>It(n,e),refetchInterval:6e4,staleTime:3e4});return{addressDetail:r,btcPrice:s,isLoading:i,error:a,refetch:o}}function Qi(e,t=8,n=8){return e.length<=t+n+3?e:`${e.slice(0,t)}...${e.slice(-n)}`}function $i({text:e}){let[t,n]=(0,Q.useState)(!1);return(0,$.jsx)(`button`,{onClick:async()=>{try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)}catch{}},className:`p-1 rounded hover:bg-muted/50 transition-colors text-muted-foreground hover:text-foreground cursor-pointer`,title:`Copy`,children:t?(0,$.jsx)(oe,{className:`size-3.5 text-green-500`}):(0,$.jsx)(y,{className:`size-3.5`})})}function ea(e){return new Date(e*1e3).toLocaleString(`en-US`,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!0})}function ta(e){return e.toLocaleString()}function na({txid:e}){let{tx:t,btcPrice:n,isLoading:r,error:i}=Xi(e);return r?(0,$.jsx)(sa,{}):i||!t?(0,$.jsxs)(`div`,{className:`rounded-2xl border border-border p-6 text-center space-y-3`,children:[(0,$.jsx)(x,{className:`size-10 mx-auto text-muted-foreground/40`}),(0,$.jsx)(`p`,{className:`text-sm text-destructive`,children:`Failed to load transaction`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground font-mono break-all`,children:e})]}):(0,$.jsxs)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:[(0,$.jsxs)(`div`,{className:`p-5 space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`div`,{className:`flex items-center justify-center size-10 rounded-full ${t.confirmed?`bg-green-500/10 text-green-600 dark:text-green-400`:`bg-orange-500/10 text-orange-600 dark:text-orange-400`}`,children:t.confirmed?(0,$.jsx)(oe,{className:`size-5`}):(0,$.jsx)(te,{className:`size-5`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-lg font-bold`,children:t.confirmed?`Confirmed`:`Unconfirmed`}),t.blockTime&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:ea(t.blockTime)})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Transaction ID`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm font-mono text-foreground break-all`,children:t.txid}),(0,$.jsx)($i,{text:t.txid})]})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[t.confirmed&&t.blockHeight!==void 0&&(0,$.jsx)(ra,{icon:(0,$.jsx)(w,{className:`size-3.5`}),label:`Block`,value:ta(t.blockHeight)}),(0,$.jsx)(ra,{icon:(0,$.jsx)(re,{className:`size-3.5`}),label:`Size`,value:`${ta(t.weight/4)} vB`}),(0,$.jsx)(ra,{icon:(0,$.jsx)(x,{className:`size-3.5`}),label:`Fee`,value:`${Ft(t.fee)} sat`,subtitle:`${(t.fee/(t.weight/4)).toFixed(1)} sat/vB`}),(0,$.jsx)(ra,{icon:(0,$.jsx)(d,{className:`size-3.5`}),label:`Amount`,value:`${X(t.totalOutput)} BTC`,subtitle:n?Z(t.totalOutput,n):void 0})]})]}),(0,$.jsx)(`div`,{className:`border-t border-border`,children:(0,$.jsx)(ia,{tx:t,btcPrice:n})}),(0,$.jsx)(`div`,{className:`border-t border-border px-5 py-2.5`,children:(0,$.jsxs)(`a`,{href:`https://mempool.space/tx/${e}`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(x,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`View on mempool.space`}),(0,$.jsx)(E,{className:`size-3`})]})})]})}function ra({icon:e,label:t,value:n,subtitle:r}){return(0,$.jsxs)(`div`,{className:`rounded-xl bg-secondary/40 px-3.5 py-2.5 space-y-0.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[e,(0,$.jsx)(`span`,{children:t})]}),(0,$.jsx)(`p`,{className:`text-sm font-semibold`,children:n}),r&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r})]})}function ia({tx:e,btcPrice:t}){return(0,$.jsxs)(`div`,{className:`p-4 space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-muted-foreground uppercase tracking-wider px-1`,children:[(0,$.jsxs)(`span`,{children:[e.inputs.length,` Input`,e.inputs.length===1?``:`s`]}),(0,$.jsx)(v,{className:`size-3`}),(0,$.jsxs)(`span`,{children:[e.outputs.length,` Output`,e.outputs.length===1?``:`s`]})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[e.inputs.slice(0,10).map((e,n)=>(0,$.jsx)(aa,{input:e,btcPrice:t},`${e.txid}-${e.vout}-${n}`)),e.inputs.length>10&&(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center py-1`,children:[`+`,e.inputs.length-10,` more input`,e.inputs.length-10==1?``:`s`]})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[e.outputs.slice(0,10).map((e,n)=>(0,$.jsx)(oa,{output:e,btcPrice:t},`${e.address??`op_return`}-${n}`)),e.outputs.length>10&&(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center py-1`,children:[`+`,e.outputs.length-10,` more output`,e.outputs.length-10==1?``:`s`]})]})]})]})}function aa({input:e,btcPrice:t}){return e.isCoinbase?(0,$.jsx)(`div`,{className:`rounded-lg bg-amber-500/5 border border-amber-500/20 px-3 py-2`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-amber-600 dark:text-amber-400`,children:`Coinbase`}),(0,$.jsxs)(`span`,{className:`text-xs font-mono`,children:[X(e.value),` BTC`]})]})}):(0,$.jsxs)(`div`,{className:`rounded-lg bg-red-500/5 border border-red-500/10 px-3 py-2 space-y-0.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[e.address?(0,$.jsx)(V,{to:`/i/bitcoin:address:${e.address}`,className:`text-xs font-mono text-red-600 dark:text-red-400 hover:underline truncate`,children:Qi(e.address,10,6)}):(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Unknown`}),(0,$.jsxs)(`span`,{className:`text-xs font-mono shrink-0`,children:[X(e.value),` BTC`]})]}),t!==void 0&&(0,$.jsx)(`p`,{className:`text-[10px] text-muted-foreground text-right`,children:Z(e.value,t)})]})}function oa({output:e,btcPrice:t}){return e.scriptpubkeyType===`op_return`?(0,$.jsx)(`div`,{className:`rounded-lg bg-secondary/60 border border-border/50 px-3 py-2`,children:(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`OP_RETURN`})}):(0,$.jsxs)(`div`,{className:`rounded-lg bg-green-500/5 border border-green-500/10 px-3 py-2 space-y-0.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[e.address?(0,$.jsx)(V,{to:`/i/bitcoin:address:${e.address}`,className:`text-xs font-mono text-green-600 dark:text-green-400 hover:underline truncate`,children:Qi(e.address,10,6)}):(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Unknown`}),(0,$.jsxs)(`span`,{className:`text-xs font-mono shrink-0`,children:[X(e.value),` BTC`]})]}),t!==void 0&&(0,$.jsx)(`p`,{className:`text-[10px] text-muted-foreground text-right`,children:Z(e.value,t)})]})}function sa(){return(0,$.jsxs)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:[(0,$.jsxs)(`div`,{className:`p-5 space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(q,{className:`size-10 rounded-full`}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-5 w-28`}),(0,$.jsx)(q,{className:`h-3.5 w-40`})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-3 w-24`}),(0,$.jsx)(q,{className:`h-4 w-full`})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsx)(q,{className:`h-16 rounded-xl`}),(0,$.jsx)(q,{className:`h-16 rounded-xl`}),(0,$.jsx)(q,{className:`h-16 rounded-xl`}),(0,$.jsx)(q,{className:`h-16 rounded-xl`})]})]}),(0,$.jsxs)(`div`,{className:`border-t border-border p-4 space-y-3`,children:[(0,$.jsx)(q,{className:`h-3 w-32`}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-12 rounded-lg`}),(0,$.jsx)(q,{className:`h-12 rounded-lg`})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-12 rounded-lg`}),(0,$.jsx)(q,{className:`h-12 rounded-lg`})]})]})]})]})}function ca({address:e}){let{addressDetail:t,btcPrice:n,isLoading:i,error:a,refetch:o}=Zi(e);return i?(0,$.jsx)(ua,{}):a||!t?(0,$.jsxs)(`div`,{className:`rounded-2xl border border-border p-6 text-center space-y-3`,children:[(0,$.jsx)(x,{className:`size-10 mx-auto text-muted-foreground/40`}),(0,$.jsx)(`p`,{className:`text-sm text-destructive`,children:`Failed to load address`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground font-mono break-all`,children:e}),(0,$.jsxs)(Ge,{variant:`outline`,size:`sm`,onClick:()=>o(),children:[(0,$.jsx)(r,{className:`size-3.5 mr-1.5`}),`Retry`]})]}):(0,$.jsxs)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:[(0,$.jsxs)(`div`,{className:`p-5 space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`div`,{className:`flex items-center justify-center size-10 rounded-full bg-primary/10 text-primary`,children:(0,$.jsx)(x,{className:`size-5`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-lg font-bold`,children:`Bitcoin Address`}),(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[t.txCount+t.pendingTxCount,` transaction`,t.txCount+t.pendingTxCount===1?``:`s`]})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Address`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm font-mono text-foreground break-all`,children:e}),(0,$.jsx)($i,{text:e})]})]}),(0,$.jsxs)(`div`,{className:`rounded-xl bg-secondary/40 p-4 text-center space-y-1`,children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground uppercase tracking-wider`,children:`Balance`}),(0,$.jsx)(`p`,{className:`text-3xl font-bold tracking-tight`,children:n?Z(t.totalBalance,n):`${X(t.totalBalance)} BTC`}),(0,$.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[X(t.totalBalance),` BTC`]}),t.pendingBalance!==0&&(0,$.jsxs)(`p`,{className:`flex items-center justify-center gap-1 text-xs text-orange-500 dark:text-orange-400 pt-1`,children:[(0,$.jsx)(r,{className:`size-3 animate-spin`}),n?`${Z(t.pendingBalance,n)} pending`:`${X(t.pendingBalance)} BTC pending`]})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsx)(ra,{icon:(0,$.jsx)(ue,{className:`size-3.5`}),label:`Total Received`,value:`${X(t.totalReceived)} BTC`,subtitle:n?Z(t.totalReceived,n):void 0}),(0,$.jsx)(ra,{icon:(0,$.jsx)(O,{className:`size-3.5`}),label:`Total Sent`,value:`${X(t.totalSent)} BTC`,subtitle:n?Z(t.totalSent,n):void 0})]})]}),t.recentTxs.length>0&&(0,$.jsxs)(`div`,{className:`border-t border-border`,children:[(0,$.jsx)(`div`,{className:`px-5 py-3`,children:(0,$.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Recent Transactions`})}),(0,$.jsx)(`div`,{className:`divide-y divide-border`,children:t.recentTxs.slice(0,10).map(e=>(0,$.jsx)(la,{tx:e,btcPrice:n},e.txid))}),t.recentTxs.length>10&&(0,$.jsx)(`div`,{className:`px-5 py-3 text-center`,children:(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[t.txCount-10,` more transaction`,t.txCount-10==1?``:`s`]})})]}),(0,$.jsx)(`div`,{className:`border-t border-border px-5 py-2.5`,children:(0,$.jsxs)(`a`,{href:`https://mempool.space/address/${e}`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(x,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`View on mempool.space`}),(0,$.jsx)(E,{className:`size-3`})]})})]})}function la({tx:e,btcPrice:t}){let n=e.type===`receive`;return(0,$.jsxs)(V,{to:`/i/bitcoin:tx:${e.txid}`,className:`flex items-center justify-between py-3 px-5 hover:bg-muted/50 transition-colors`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`div`,{className:`flex items-center justify-center size-8 rounded-full ${n?`bg-green-500/10 text-green-600 dark:text-green-400`:`bg-red-500/10 text-red-600 dark:text-red-400`}`,children:n?(0,$.jsx)(ue,{className:`size-4`}):(0,$.jsx)(O,{className:`size-4`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium`,children:n?`Received`:`Sent`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground font-mono`,children:Qi(e.txid,8,8)})]})]}),(0,$.jsxs)(`div`,{className:`text-right`,children:[(0,$.jsxs)(`p`,{className:`text-sm font-medium ${n?`text-green-600 dark:text-green-400`:`text-red-600 dark:text-red-400`}`,children:[n?`+`:`-`,X(e.amount),` BTC`]}),t&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:Z(e.amount,t)})]})]})}function ua(){return(0,$.jsx)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:(0,$.jsxs)(`div`,{className:`p-5 space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(q,{className:`size-10 rounded-full`}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-5 w-32`}),(0,$.jsx)(q,{className:`h-3.5 w-24`})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-3 w-16`}),(0,$.jsx)(q,{className:`h-4 w-full`})]}),(0,$.jsxs)(`div`,{className:`rounded-xl bg-secondary/40 p-4 space-y-2 flex flex-col items-center`,children:[(0,$.jsx)(q,{className:`h-3 w-12`}),(0,$.jsx)(q,{className:`h-9 w-40`}),(0,$.jsx)(q,{className:`h-4 w-28`})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsx)(q,{className:`h-16 rounded-xl`}),(0,$.jsx)(q,{className:`h-16 rounded-xl`})]})]})})}function da({txid:e,link:t}){let{tx:n,btcPrice:r,isLoading:i}=Xi(e);if(i)return(0,$.jsx)(`div`,{className:`px-4 py-3 border-b border-border`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(q,{className:`size-12 rounded-lg shrink-0`}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-3 w-32`}),(0,$.jsx)(q,{className:`h-4 w-3/4`})]})]})});let a=n?n.totalOutput:0,o=n?.fee??0;return(0,$.jsxs)(V,{to:t,className:`flex items-center gap-3 px-4 py-3 border-b border-border hover:bg-secondary/30 transition-colors`,children:[(0,$.jsx)(`div`,{className:`size-12 rounded-lg bg-orange-500/10 flex items-center justify-center shrink-0`,children:(0,$.jsx)(x,{className:`size-5 text-orange-600 dark:text-orange-400`})}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(x,{className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{children:`Bitcoin Transaction`}),n&&(0,$.jsx)(`span`,{className:n.confirmed?`text-green-600 dark:text-green-400`:`text-yellow-600 dark:text-yellow-400`,children:n.confirmed?`Confirmed`:`Unconfirmed`})]}),(0,$.jsxs)(`p`,{className:`text-sm font-medium truncate mt-0.5`,children:[n?`${Y(a)} BTC`:Qi(e,12,8),n&&r?(0,$.jsxs)(`span`,{className:`text-muted-foreground font-normal`,children:[` (`,Z(a,r),`)`]}):null]}),n&&(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground truncate`,children:[`Fee `,Ft(o),` sats`,n.blockHeight?` · Block ${n.blockHeight.toLocaleString()}`:``]})]}),(0,$.jsx)(E,{className:`size-4 text-muted-foreground shrink-0`})]})}function fa({address:e,link:t}){let{addressDetail:n,btcPrice:r,isLoading:i}=Zi(e);if(i)return(0,$.jsx)(`div`,{className:`px-4 py-3 border-b border-border`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(q,{className:`size-12 rounded-lg shrink-0`}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-3 w-28`}),(0,$.jsx)(q,{className:`h-4 w-3/4`})]})]})});let a=n?.totalBalance??0,o=n?n.txCount+n.pendingTxCount:0;return(0,$.jsxs)(V,{to:t,className:`flex items-center gap-3 px-4 py-3 border-b border-border hover:bg-secondary/30 transition-colors`,children:[(0,$.jsx)(`div`,{className:`size-12 rounded-lg bg-orange-500/10 flex items-center justify-center shrink-0`,children:(0,$.jsx)(x,{className:`size-5 text-orange-600 dark:text-orange-400`})}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(x,{className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{children:`Bitcoin Address`})]}),(0,$.jsxs)(`p`,{className:`text-sm font-medium truncate mt-0.5`,children:[n?`${Y(a)} BTC`:Qi(e,12,8),n&&r?(0,$.jsxs)(`span`,{className:`text-muted-foreground font-normal`,children:[` (`,Z(a,r),`)`]}):null]}),n&&(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground truncate`,children:[o.toLocaleString(),` transaction`,o===1?``:`s`,` · `,(0,$.jsx)(`span`,{className:`font-mono`,children:Qi(e,8,6)})]})]}),(0,$.jsx)(E,{className:`size-4 text-muted-foreground shrink-0`})]})}function pa(e,t=`normal`){return e.setId&&e.artId?`https://api.scryfall.com/cards/${encodeURIComponent(e.setId.toLowerCase())}/${encodeURIComponent(e.artId)}?format=image&version=${t}`:`https://api.scryfall.com/cards/named?exact=${encodeURIComponent(e.name??``)}&format=image&version=${t}`}function ma(e){switch(e.kind){case`multiverse`:return`https://api.scryfall.com/cards/multiverse/${encodeURIComponent(e.multiverseId)}`;case`set`:{let t=`https://api.scryfall.com/cards/${encodeURIComponent(e.set.toLowerCase())}/${encodeURIComponent(e.number)}`;return e.lang&&e.lang.toLowerCase()!==`en`&&e.lang.toLowerCase()!==`en-us`?`${t}/${encodeURIComponent(e.lang.toLowerCase())}`:t}}}async function ha(e,t){let n=ma(e),r=await fetch(n,{signal:t,headers:{Accept:`application/json`}});if(!r.ok)return null;let i=await r.json();return!i||i.id==null?null:i}function ga(e,t=`large`){return e.image_uris?.[t]??e.card_faces?.[0]?.image_uris?.[t]}function _a(e){return F({queryKey:[`scryfall-card`,e],queryFn:({signal:t})=>ha(e,t),enabled:!!e,staleTime:1e3*60*60*24,gcTime:1e3*60*60*24*7,retry:1})}async function va(e,t){let n=`https://en.wikipedia.org/api/rest_v1/page/media-list/${encodeURIComponent(e.replace(/\s+/g,`_`))}`,r=await fetch(n,{signal:t,headers:{accept:`application/json`}});if(!r.ok)return null;let i=await r.json();for(let e of i.items??[])if(e.type===`audio`&&e.audio_type!==`spoken`)return e.title;return null}async function ya(e,t){let n=new URL(`https://en.wikipedia.org/w/api.php`);n.searchParams.set(`action`,`query`),n.searchParams.set(`format`,`json`),n.searchParams.set(`prop`,`videoinfo`),n.searchParams.set(`viprop`,`url|mime|derivatives|extmetadata`),n.searchParams.set(`titles`,e),n.searchParams.set(`origin`,`*`);let r=await fetch(n.toString(),{signal:t,headers:{accept:`application/json`}});if(!r.ok)return null;let i=(await r.json()).query?.pages;if(!i)return null;let a=Object.values(i)[0]?.videoinfo?.[0];if(!a)return null;let o=Re(a.derivatives?.find(e=>e.type.startsWith(`audio/mpeg`))?.src??a.url);return o?{audioUrl:o,descriptionUrl:Re(a.descriptionurl)??`https://commons.wikimedia.org/wiki/${encodeURIComponent(e)}`,attribution:xa(ba(a.extmetadata?.Artist?.value),ba(a.extmetadata?.LicenseShortName?.value),ba(a.extmetadata?.Credit?.value))}:null}function ba(e){return e?typeof DOMParser>`u`?e.replace(/<[^>]*>/g,``).trim()||null:(new DOMParser().parseFromString(e,`text/html`).body.textContent??``).trim()||null:null}function xa(e,t,n){return e&&t?`© ${e}, ${t}`:e?`© ${e}`:t||n||`Wikimedia Commons`}async function Sa(e,t){let n=await va(e,t);return n?ya(n,t):null}function Ca(e){return F({queryKey:[`bird-song`,e],enabled:!!e,staleTime:1e3*60*60*24,gcTime:1e3*60*60*24,retry:1,queryFn:({signal:t})=>Sa(e,t)})}function wa({title:e,className:t,ariaLabel:n}){let{data:r,isLoading:i}=Ca(e);return i?(0,$.jsx)(q,{className:z(`size-10 shrink-0 rounded-full`,t),"aria-hidden":!0}):r?(0,$.jsx)(Ta,{song:r,className:t,ariaLabel:n}):null}function Ta({song:e,className:t,ariaLabel:n}){let r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{a(!1)},[e.audioUrl]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>{let e=r.current;e&&(i?(e.pause(),a(!1)):e.play().then(()=>a(!0),()=>a(!1)))},"aria-label":i?`Pause ${n??`reference recording`}`:`Play ${n??`reference recording`}`,"aria-pressed":i,title:e.attribution,className:z(`group inline-flex size-10 shrink-0 items-center justify-center rounded-full`,`bg-emerald-500 text-white shadow-md ring-1 ring-emerald-400/40`,`transition-[transform,background-color,box-shadow] duration-200`,`hover:bg-emerald-600 hover:shadow-lg active:scale-95`,`focus:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/60 focus-visible:ring-offset-2`,`focus-visible:ring-offset-background`,`dark:bg-emerald-400 dark:text-emerald-950 dark:hover:bg-emerald-300`,t),children:i?(0,$.jsx)(Ea,{}):(0,$.jsx)(ne,{className:`size-4 translate-x-px fill-current`,"aria-hidden":!0})}),(0,$.jsx)(`audio`,{ref:r,src:e.audioUrl,preload:`none`,loop:!0,onPause:()=>a(!1),onPlay:()=>a(!0),className:`hidden`,children:`Your browser does not support embedded audio.`})]})}function Ea(){return(0,$.jsx)(`span`,{className:`flex h-4 items-end gap-[2px]`,"aria-hidden":!0,children:[`0ms`,`120ms`,`60ms`,`180ms`].map((e,t)=>(0,$.jsx)(`span`,{className:z(`block w-[2px] rounded-full bg-current`,`h-full origin-bottom motion-safe:animate-equaliser-bar`,`motion-reduce:scale-y-75`),style:{animationDelay:e}},t))})}async function Da(e,t,n){try{let r=t===`en`?[`enwiki`]:[`${t}wiki`,`enwiki`],i=new URL(`https://www.wikidata.org/w/api.php`);i.searchParams.set(`action`,`wbgetentities`),i.searchParams.set(`ids`,e),i.searchParams.set(`props`,`sitelinks/urls`),i.searchParams.set(`sitefilter`,r.join(`|`)),i.searchParams.set(`format`,`json`),i.searchParams.set(`origin`,`*`);let a=await fetch(i.toString(),{signal:n,headers:{Accept:`application/json`}});if(!a.ok)return null;let o=(await a.json())?.entities?.[e];if(!o||o.missing!==void 0)return null;let s=o.sitelinks?.[`${t}wiki`]??o.sitelinks?.enwiki;return{id:e,wikipediaTitle:typeof s?.title==`string`?s.title:null,wikipediaUrl:typeof s?.url==`string`?s.url:null}}catch{return null}}function Oa(e){let{locale:t}=ze();return F({queryKey:[`wikidata-entity`,t,e],queryFn:({signal:n})=>Da(e,t,n),enabled:!!e,staleTime:1e3*60*60*24,gcTime:1e3*60*60*24*7,retry:1})}async function ka(e,t,n){try{let r=encodeURIComponent(e.replace(/ /g,`_`)),i=await fetch(`https://${t}.wikipedia.org/api/rest_v1/page/summary/${r}`,{signal:n,headers:{Accept:`application/json`}});if(!i.ok)return null;let a=await i.json();return a.type===`disambiguation`||a.type===`no-extract`?null:{title:a.title??e,extract:a.extract??``,extractHtml:a.extract_html??``,description:a.description,thumbnail:a.thumbnail?{source:a.thumbnail.source,width:a.thumbnail.width,height:a.thumbnail.height}:void 0,originalImage:a.originalimage?{source:a.originalimage.source,width:a.originalimage.width,height:a.originalimage.height}:void 0,articleUrl:a.content_urls?.desktop?.page??`https://${t}.wikipedia.org/wiki/${r}`}}catch{return null}}function Aa(e){let{locale:t}=ze();return F({queryKey:[`wikipedia-summary`,t,e],queryFn:({signal:n})=>ka(e,t,n),enabled:!!e,staleTime:1e3*60*60*24,gcTime:1e3*60*60*24*7,retry:1})}var ja=[`❤️`,`👍`,`👎`,`😂`,`😮`,`😢`];function Ma(){let{user:e}=He(),[t,n]=Ie(e?`emoji-usage-${e.pubkey}`:`emoji-usage`,{});return{trackEmojiUsage:(0,Q.useCallback)(e=>{n(t=>({...t,[e]:(t[e]||0)+1}))},[n]),getTopEmojis:(0,Q.useCallback)((e=6)=>{let n=Object.entries(t).sort(([,e],[,t])=>t-e).map(([e])=>e).slice(0,e),r=e-n.length;if(r>0){let e=new Set(n),t=ja.filter(t=>!e.has(t)).slice(0,r);return[...n,...t]}return n},[t])}}var Na=(0,Q.lazy)(()=>pe(()=>import(`./EmojiPicker-Bj-YkY3r.js`).then(e=>({default:e.EmojiPicker})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])));function Pa({eventId:e,eventPubkey:t,eventKind:n,reactedEvent:r,onClose:i,onReacted:a,onExpandChange:o,onReact:s,className:c}){let{user:l}=He(),{nostr:u}=ge(),{mutate:d}=Ke(),f=_e(),{trackEmojiUsage:p,getTopEmojis:m}=Ma(),{feedSettings:h}=qt(),{emojis:g}=Ut(),_=h.showCustomEmojis!==!1,v=(0,Q.useMemo)(()=>_?g:[],[_,g]),[y,b]=(0,Q.useState)(!1),[x,C]=(0,Q.useState)(null),w=(0,Q.useMemo)(()=>{let e=new Map;for(let t of v)e.set(t.shortcode,t.url);return e},[v]),ee=(0,Q.useMemo)(()=>m(8).filter(e=>{if(!Qe(e))return!0;let t=e.slice(1,-1);return w.has(t)}).slice(0,6),[m,w]),T=(0,Q.useCallback)((o,c)=>{if(!l)return;if(dt(),i?.(),a?.(o===`+`||o===``?`👍`:o),C(o),p(o),s){s(o,c);return}let m=o===`+`||o===``?`👍`:o,h=c?{content:m,url:c[2],name:c[1]}:{content:m},g=f.getQueryData([`event-stats`,e]);g&&f.setQueryData([`event-stats`,e],{...g,reactions:g.reactions+1,reactionEmojis:g.reactionEmojis.some(e=>e.content===m)?g.reactionEmojis:[...g.reactionEmojis,h]}),f.setQueryData([`user-reaction`,e],h);let _=[[`e`,e],[`p`,t],[`k`,String(n)]];c&&_.push(c),d({kind:7,content:o,created_at:Math.floor(Date.now()/1e3),tags:_},{onSuccess:()=>{r&&mi(u,r),setTimeout(()=>{f.invalidateQueries({queryKey:[`event-stats`,e]}),f.invalidateQueries({queryKey:[`event-interactions`,e]})},3e3)},onError:()=>{C(null),g&&f.setQueryData([`event-stats`,e],g),f.removeQueries({queryKey:[`user-reaction`,e]})}})},[l,e,t,n,r,u,s,d,f,p,i,a]),te=(0,Q.useCallback)(e=>{if(Qe(e)){let t=e.slice(1,-1),n=w.get(t);if(n){T(e,[`emoji`,t,n]);return}}T(e)},[T,w]),ne=(0,Q.useCallback)(e=>{e.type===`native`?T(e.emoji):T(`:${e.shortcode}:`,[`emoji`,e.shortcode,e.url])},[T]);return l?y?(0,$.jsx)(`div`,{className:z(`rounded-xl shadow-xl overflow-hidden bg-popover border border-border`,c),onClick:e=>e.stopPropagation(),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{className:`w-[352px] max-w-[90vw] h-[400px] flex items-center justify-center text-sm text-muted-foreground`,children:`Loading…`}),children:(0,$.jsx)(Na,{customEmojis:v,onSelect:ne})})}):(0,$.jsxs)(`div`,{className:z(`inline-flex items-center gap-1 p-1.5 rounded-full bg-popover border border-border shadow-lg`,c),onClick:e=>e.stopPropagation(),children:[ee.map(e=>{let t=Qe(e),n=t?e.slice(1,-1):void 0,r=n?w.get(n):void 0;return(0,$.jsx)(`button`,{onClick:()=>te(e),className:z(`flex items-center justify-center size-9 rounded-full text-xl transition-all focus:outline-none hover:bg-secondary hover:scale-110 active:scale-95`,x===e&&`bg-secondary scale-110`),title:`React with ${t?n:e}`,children:r?(0,$.jsx)(H,{name:n??e,url:r,className:`size-6 object-contain`}):e},e)}),(0,$.jsx)(`button`,{onClick:()=>{b(!0),o?.(!0)},className:`flex items-center justify-center size-9 rounded-full text-muted-foreground transition-all focus:outline-none hover:bg-secondary hover:text-foreground hover:scale-110 active:scale-95`,title:`More reactions`,children:(0,$.jsx)(S,{className:`size-5`})})]}):null}function Fa(e){let{nostr:t}=ge(),{user:n}=He(),r=_e(),i=e?.value??``,a=r.getQueryData([`external-user-reaction`,i]),{data:o}=F({queryKey:[`external-user-reaction`,i],queryFn:async({signal:e})=>{if(!i||!n)return null;let r=await t.query([{kinds:[17],authors:[n.pubkey],"#i":[i],limit:1}],{signal:e});if(r.length===0)return null;let a=r[0].content.trim();return a===`-`?null:{emoji:a||`+`,tags:r[0].tags}},enabled:!!i&&!!n&&a===void 0,staleTime:300*1e3,gcTime:600*1e3});return a===void 0?o:a}function Ia(e){let{nostr:t}=ge(),n=e?.value??``,{data:r}=F({queryKey:[`external-reaction-count`,n],queryFn:async({signal:e})=>n?(await t.query([{kinds:[17],"#i":[n],limit:500}],{signal:e})).filter(e=>e.content.trim()!==`-`).length:0,enabled:!!n,staleTime:120*1e3,gcTime:600*1e3});return r??0}function La(e){switch(e.type){case`url`:return`web`;case`isbn`:return`isbn`;case`iso3166`:return`iso3166`;default:return`web`}}function Ra({content:e,iconSize:t=`size-5`,count:n,className:r}){let{user:a}=He(),{mutate:o}=Ke(),s=_e(),{toast:c}=Ve(),l=e.value,u=Fa(e),d=Ia(e),f=!!u,p=u?.emoji,m=u?.tags,[h,g]=(0,Q.useState)(!1),_=(0,Q.useRef)(null),v=(0,Q.useRef)(!1),y=(0,Q.useRef)(!1),b=(0,Q.useCallback)(()=>{a&&(v.current||(_.current&&=(clearTimeout(_.current),null),g(!0)))},[a]),x=(0,Q.useCallback)(()=>{y.current||(_.current=setTimeout(()=>g(!1),150))},[]),S=(0,Q.useCallback)((t,n)=>{if(!a)return;ut();let r=[[`k`,La(e)],[`i`,l]];n&&r.push(n),s.setQueryData([`external-user-reaction`,l],{emoji:t||`+`,tags:r}),s.setQueryData([`external-reaction-count`,l],e=>(e??0)+1),o({kind:17,content:t,created_at:Math.floor(Date.now()/1e3),tags:r},{onSuccess:()=>{setTimeout(()=>{s.invalidateQueries({queryKey:[`external-user-reaction`,l]}),s.invalidateQueries({queryKey:[`external-reaction-count`,l]})},3e3)},onError:()=>{c({title:`Failed to react`,variant:`destructive`}),s.setQueryData([`external-user-reaction`,l],null),s.setQueryData([`external-reaction-count`,l],e=>Math.max(0,(e??1)-1))}})},[a,e,l,o,s,c]);return(0,$.jsxs)(yt,{open:h,onOpenChange:e=>{e&&v.current||(e||(y.current=!1),g(e))},children:[(0,$.jsx)(_t,{asChild:!0,children:(0,$.jsxs)(`button`,{className:z(`flex items-center gap-1.5 p-2 rounded-full transition-colors`,f?`text-pink-500`:`text-muted-foreground hover:text-pink-500 hover:bg-pink-500/10`,r),title:`React`,onClick:e=>{e.stopPropagation(),a&&(v.current||g(e=>!e))},onMouseEnter:b,onMouseLeave:x,children:[f&&p?(0,$.jsx)(`span`,{className:z(t,`flex items-center justify-center text-base leading-none`),children:(0,$.jsx)(tt,{content:p,tags:m,className:t})}):(0,$.jsx)(i,{className:t}),(n??d)>0&&(0,$.jsx)(`span`,{className:`text-sm tabular-nums`,children:Vt(n??d)})]})}),(0,$.jsx)(vt,{className:`w-auto p-0 border-0 bg-transparent shadow-none`,side:`top`,align:`start`,onClick:e=>e.stopPropagation(),onOpenAutoFocus:e=>e.preventDefault(),onMouseEnter:b,onMouseLeave:x,children:(0,$.jsx)(Pa,{eventId:l,eventPubkey:``,eventKind:17,onExpandChange:e=>{y.current=e},onClose:()=>{y.current=!1,v.current=!0,g(!1),setTimeout(()=>{v.current=!1},300)},onReact:S})})]})}var za=e({ReplyComposeModal:()=>Ba});function Ba({event:e,quotedEvent:t,open:n,onOpenChange:r,onSuccess:i,initialContent:a,initialMode:o,title:s,placeholder:c}){let l=e instanceof URL,u=typeof e==`string`,d=l||u,f=!!e,p=!!t,[m,h]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(void 0),x=!d&&e instanceof Object&&`kind`in e&&e.kind===0,S=s??(o===`poll`?`New poll`:d?`New comment`:x?`Comment on profile`:f?`Reply to post`:p?`Quote post`:`New post`),C=c??(d?`Write a comment...`:f?`What's on your mind?`:p?`Add a comment...`:`What's happening?`);return(0,$.jsx)(At,{open:n,onOpenChange:r,children:(0,$.jsx)(wt,{ref:(0,Q.useCallback)(e=>{b(e??void 0)},[]),onOpenAutoFocus:e=>{e.preventDefault();let t=e.currentTarget.querySelector(`textarea`);t&&t.focus()},onInteractOutside:(0,Q.useCallback)(e=>{e.preventDefault()},[]),children:(0,$.jsxs)(gt,{value:y,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-4 h-12 shrink-0`,children:[(0,$.jsx)(kt,{className:`text-base font-semibold`,children:S}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_&&(0,$.jsxs)(`div`,{className:`inline-flex items-center gap-0.5 p-1 bg-muted/50 rounded-lg`,children:[(0,$.jsx)(`button`,{onClick:()=>h(!1),className:z(`px-3.5 py-1.5 text-xs font-medium rounded-md transition-all motion-safe:active:scale-95`,m?`text-muted-foreground hover:text-foreground`:`bg-background text-foreground shadow-sm`),children:`Edit`}),(0,$.jsx)(`button`,{onClick:()=>h(!0),className:z(`px-3.5 py-1.5 text-xs font-medium rounded-md transition-all motion-safe:active:scale-95`,m?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:`Preview`})]}),(0,$.jsx)(`button`,{onClick:()=>r(!1),className:`p-1.5 -mr-1.5 rounded-full text-muted-foreground hover:text-foreground hover:bg-secondary/60 transition-all motion-safe:active:scale-90`,children:(0,$.jsx)(g,{className:`size-5`})})]})]}),e&&!p&&(0,$.jsx)(`div`,{className:`overflow-y-auto max-h-[calc(var(--visual-viewport-height,100dvh)*0.2)] shrink-0`,children:l?(0,$.jsx)(`div`,{className:`mx-4 mb-2`,children:(0,$.jsx)(I,{url:e.href,showActions:!1,hideImage:!0})}):u?null:(0,$.jsx)(xo,{event:e,className:`mx-4 mb-2`,disableHoverCards:!0})}),l&&/bsky\.(app|social)/.test(e.href)&&(0,$.jsxs)(`div`,{className:`mx-4 mb-2 rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 flex items-start gap-2 shrink-0`,children:[(0,$.jsx)(`span`,{className:`text-sm leading-relaxed shrink-0`,"aria-hidden":!0,children:`⚠️`}),(0,$.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-400 leading-relaxed`,children:`People on Bluesky can't see you because they're not actually decentralized.`})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 flex flex-col overflow-hidden`,children:(0,$.jsx)(Yi,{replyTo:p?void 0:e??void 0,quotedEvent:t??void 0,onSuccess:()=>{r(!1),i?.()},placeholder:C,forceExpanded:!0,hideAvatar:!0,previewMode:m,onHasPreviewableContentChange:v,initialContent:a,initialMode:o})})]})})})}var Va=280,Ha=`rounded-[4.75%]`;function Ua({card:e,url:t}){let{data:n,isLoading:r,isError:i}=_a((0,Q.useMemo)(()=>e.kind===`multiverse`?{kind:`multiverse`,multiverseId:e.multiverseId}:{kind:`set`,set:e.set,number:e.number,lang:e.lang},[e]));return r?(0,$.jsx)(`div`,{className:`flex flex-col items-center py-4`,children:(0,$.jsx)(q,{className:z(`w-full aspect-[5/7]`,Ha),style:{maxWidth:Va}})}):i||!n?(0,$.jsx)(I,{url:t,showActions:!1}):(0,$.jsx)(Wa,{card:n,url:t})}function Wa({card:e,url:t}){let[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(0),o=(0,Q.useMemo)(()=>{if(e.card_faces&&e.card_faces[0]?.image_uris)return e.card_faces.map(e=>e.image_uris?.large).filter(e=>!!e);let t=ga(e,`large`);return t?[t]:[]},[e]),s=(0,Q.useMemo)(()=>e.card_faces&&e.card_faces.length>0?e.card_faces:[e],[e]),c=s[i]??s[0],l=o[i]??o[0],u=s.length>1;return(0,$.jsxs)(`div`,{className:`flex flex-col items-center py-4`,children:[(0,$.jsx)(`div`,{className:`w-full`,style:{maxWidth:Va},children:l?(0,$.jsx)(Ga,{src:l,name:c.name,onClick:()=>r(!0)}):(0,$.jsx)(`div`,{className:z(`w-full aspect-[5/7] bg-secondary flex items-center justify-center`,Ha),children:(0,$.jsx)(Bt,{className:`size-12 text-muted-foreground/40`})})}),u&&(0,$.jsx)(`div`,{className:`flex gap-1.5 mt-4`,children:s.map((e,t)=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>a(t),className:z(`text-xs px-2.5 py-1 rounded-full transition-colors`,t===i?`bg-primary text-primary-foreground`:`bg-secondary text-secondary-foreground hover:bg-secondary/80`),children:e.name},t))}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-x-4 gap-y-1.5 mt-4`,children:[(0,$.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(Bt,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`View on Gatherer`}),(0,$.jsx)(E,{className:`size-3`})]}),(0,$.jsxs)(`a`,{href:e.scryfall_uri,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(`span`,{children:`View on Scryfall`}),(0,$.jsx)(E,{className:`size-3`})]})]}),n&&o.length>0&&(0,$.jsx)(R,{images:o,currentIndex:i,onClose:()=>r(!1),onNext:()=>a(e=>(e+1)%o.length),onPrev:()=>a(e=>(e-1+o.length)%o.length),showDownload:!1,maxDotIndicators:10})]})}function Ga({src:e,name:t,onClick:n}){let r=it(18,1.04),i=(0,Q.useRef)(null),a=(0,Q.useRef)(void 0),o=(0,Q.useCallback)((e,t)=>{let n=r.ref.current,a=i.current;if(!n||!a)return;let o=n.getBoundingClientRect(),s=(e-o.left)/o.width*100,c=(t-o.top)/o.height*100;a.style.background=`radial-gradient(circle at ${s}% ${c}%, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0.08) 35%, transparent 65%)`,a.style.opacity=`1`},[r.ref]),s=(0,Q.useCallback)(()=>{let e=i.current;e&&(e.style.opacity=`0`)},[]),c=(0,Q.useCallback)(e=>{r.onPointerDown(e),e.pointerType===`touch`&&(clearTimeout(a.current),o(e.clientX,e.clientY))},[r,o]),l=(0,Q.useCallback)(e=>{r.onPointerMove(e),!(e.pointerType===`touch`&&!r.isTouchActive)&&o(e.clientX,e.clientY)},[r,o]),u=(0,Q.useCallback)(e=>{r.onPointerUp(e),e.pointerType===`touch`&&(clearTimeout(a.current),a.current=setTimeout(s,600))},[r,s]),d=(0,Q.useCallback)(e=>{r.onPointerLeave(e),e.pointerType===`touch`?(clearTimeout(a.current),a.current=setTimeout(s,600)):s()},[r,s]),f={...r.style,touchAction:`pan-y`,transformStyle:`preserve-3d`};return(0,$.jsxs)(`div`,{ref:r.ref,style:f,onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerLeave:d,className:`relative select-none`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`View ${t} full size`,className:z(`block w-full focus:outline-none focus-visible:ring-2 focus-visible:ring-primary`,Ha),children:(0,$.jsx)(`img`,{src:e,alt:t,loading:`eager`,draggable:!1,className:z(`w-full aspect-[5/7] object-cover shadow-[0_14px_40px_-12px_rgba(0,0,0,0.45)]`,Ha),decoding:`async`})}),(0,$.jsx)(`div`,{ref:i,"aria-hidden":`true`,className:z(`absolute inset-0 pointer-events-none`,Ha),style:{opacity:0,transition:`opacity 0.4s ease-out`,mixBlendMode:`overlay`}})]})}async function Ka(e,t){if(navigator.share)try{return await navigator.share({url:e,title:t}),`shared`}catch(e){if(e instanceof Error&&e.name===`AbortError`)return`cancelled`}return await navigator.clipboard.writeText(e),`copied`}var qa={AF:[34.53,69.17],AL:[41.33,19.82],DZ:[36.75,3.04],AD:[42.51,1.52],AO:[-8.84,13.23],AG:[17.12,-61.85],AR:[-34.6,-58.38],AM:[40.18,44.51],AU:[-35.28,149.13],AT:[48.21,16.37],AZ:[40.41,49.87],BS:[25.06,-77.35],BH:[26.23,50.58],BD:[23.81,90.41],BB:[13.1,-59.61],BY:[53.9,27.57],BE:[50.85,4.35],BZ:[17.25,-88.77],BJ:[6.5,2.6],BT:[27.47,89.64],BO:[-16.5,-68.15],BA:[43.86,18.41],BW:[-24.65,25.91],BR:[-15.79,-47.88],BN:[4.94,114.95],BG:[42.7,23.32],BF:[12.37,-1.52],BI:[-3.38,29.36],CV:[14.93,-23.51],KH:[11.56,104.92],CM:[3.87,11.52],CA:[45.42,-75.7],CF:[4.36,18.56],TD:[12.13,15.05],CL:[-33.45,-70.67],CN:[39.9,116.4],CO:[4.71,-74.07],KM:[-11.7,43.26],CG:[-4.27,15.28],CD:[-4.32,15.31],CR:[9.93,-84.08],CI:[6.85,-5.3],HR:[45.81,15.98],CU:[23.11,-82.37],CY:[35.17,33.37],CZ:[50.08,14.44],DK:[55.68,12.57],DJ:[11.59,43.15],DM:[15.3,-61.39],DO:[18.49,-69.9],EC:[-.18,-78.47],EG:[30.04,31.24],SV:[13.69,-89.19],GQ:[3.75,8.78],ER:[15.34,38.93],EE:[59.44,24.75],SZ:[-26.32,31.13],ET:[9.02,38.75],FJ:[-18.14,178.44],FI:[60.17,24.94],FR:[48.86,2.35],GA:[.39,9.45],GM:[13.45,-16.58],GE:[41.72,44.79],DE:[52.52,13.41],GH:[5.56,-.19],GR:[37.98,23.73],GD:[12.05,-61.75],GT:[14.63,-90.51],GN:[9.64,-13.58],GW:[11.86,-15.6],GY:[6.8,-58.16],HT:[18.54,-72.34],HN:[14.07,-87.19],HU:[47.5,19.04],IS:[64.15,-21.94],IN:[28.61,77.21],ID:[-6.21,106.85],IR:[35.69,51.42],IQ:[33.31,44.37],IE:[53.35,-6.26],IL:[31.77,35.23],IT:[41.9,12.5],JM:[18,-76.79],JP:[35.68,139.69],JO:[31.95,35.93],KZ:[51.17,71.43],KE:[-1.29,36.82],KI:[1.33,172.98],KP:[39.02,125.75],KR:[37.57,126.98],KW:[29.38,47.99],KG:[42.87,74.59],LA:[17.97,102.63],LV:[56.95,24.11],LB:[33.89,35.5],LS:[-29.31,27.48],LR:[6.3,-10.8],LY:[32.9,13.18],LI:[47.14,9.52],LT:[54.69,25.28],LU:[49.61,6.13],MG:[-18.91,47.52],MW:[-13.97,33.79],MY:[3.14,101.69],MV:[4.18,73.51],ML:[12.64,-8],MT:[35.9,14.51],MH:[7.09,171.38],MR:[18.09,-15.98],MU:[-20.16,57.5],MX:[19.43,-99.13],FM:[6.92,158.16],MD:[47.01,28.86],MC:[43.73,7.42],MN:[47.91,106.91],ME:[42.44,19.26],MA:[33.97,-6.85],MZ:[-25.97,32.57],MM:[19.76,96.07],NA:[-22.56,17.08],NR:[-.55,166.92],NP:[27.72,85.32],NL:[52.37,4.89],NZ:[-41.29,174.78],NI:[12.15,-86.27],NE:[13.51,2.11],NG:[9.06,7.49],MK:[42,21.43],NO:[59.91,10.75],OM:[23.61,58.59],PK:[33.69,73.04],PW:[7.5,134.62],PA:[8.98,-79.52],PG:[-6.31,147.18],PY:[-25.26,-57.58],PE:[-12.05,-77.04],PH:[14.6,120.98],PL:[52.23,21.01],PT:[38.72,-9.14],QA:[25.29,51.53],RO:[44.43,26.1],RU:[55.76,37.62],RW:[-1.94,29.87],KN:[17.3,-62.72],LC:[14.01,-60.99],VC:[13.16,-61.23],WS:[-13.83,-171.76],SM:[43.94,12.45],ST:[.34,6.73],SA:[24.69,46.72],SN:[14.69,-17.44],RS:[44.79,20.47],SC:[-4.62,55.45],SL:[8.48,-13.23],SG:[1.35,103.82],SK:[48.15,17.11],SI:[46.06,14.51],SB:[-9.43,160.03],SO:[2.05,45.32],ZA:[-25.75,28.19],SS:[4.85,31.61],ES:[40.42,-3.7],LK:[6.93,79.84],SD:[15.59,32.53],SR:[5.87,-55.17],SE:[59.33,18.07],CH:[46.95,7.45],SY:[33.51,36.29],TW:[25.03,121.57],TJ:[38.56,68.77],TZ:[-6.16,35.74],TH:[13.76,100.5],TL:[-8.56,125.57],TG:[6.14,1.21],TO:[-21.21,-175.2],TT:[10.66,-61.51],TN:[36.81,10.18],TR:[39.93,32.85],TM:[37.95,58.38],TV:[-8.52,179.2],UG:[.35,32.58],UA:[50.45,30.52],AE:[24.45,54.65],GB:[51.51,-.13],US:[38.9,-77.04],UY:[-34.88,-56.17],UZ:[41.3,69.28],VU:[-17.73,168.32],VA:[41.9,12.45],VE:[10.49,-66.88],VN:[21.03,105.85],YE:[15.35,44.21],ZM:[-15.39,28.32],ZW:[-17.83,31.05]},Ja={"US-AL":[32.38,-86.3],"US-AK":[64.84,-147.72],"US-AZ":[33.45,-112.07],"US-AR":[34.75,-92.29],"US-CA":[34.05,-118.24],"US-CO":[39.74,-104.98],"US-CT":[41.76,-72.68],"US-DE":[39.16,-75.52],"US-FL":[25.76,-80.19],"US-GA":[33.75,-84.39],"US-HI":[21.31,-157.86],"US-ID":[43.62,-116.2],"US-IL":[41.88,-87.63],"US-IN":[39.77,-86.16],"US-IA":[41.59,-93.6],"US-KS":[39.05,-95.68],"US-KY":[38.25,-85.76],"US-LA":[29.95,-90.07],"US-ME":[43.66,-70.26],"US-MD":[39.29,-76.61],"US-MA":[42.36,-71.06],"US-MI":[42.33,-83.05],"US-MN":[44.98,-93.27],"US-MS":[32.3,-90.18],"US-MO":[38.63,-90.2],"US-MT":[46.87,-114],"US-NE":[41.26,-95.94],"US-NV":[36.17,-115.14],"US-NH":[43.21,-71.54],"US-NJ":[40.74,-74.18],"US-NM":[35.08,-106.65],"US-NY":[40.71,-74.01],"US-NC":[35.78,-78.64],"US-ND":[46.88,-96.79],"US-OH":[39.96,-82.99],"US-OK":[35.47,-97.52],"US-OR":[45.52,-122.68],"US-PA":[39.95,-75.17],"US-RI":[41.82,-71.41],"US-SC":[34,-81.03],"US-SD":[43.55,-96.73],"US-TN":[36.16,-86.78],"US-TX":[30.27,-97.74],"US-UT":[40.76,-111.89],"US-VT":[44.26,-72.58],"US-VA":[37.54,-77.43],"US-WA":[47.61,-122.33],"US-WV":[38.35,-81.63],"US-WI":[43.07,-89.4],"US-WY":[41.14,-104.82],"US-DC":[38.9,-77.04],"US-PR":[18.47,-66.11],"US-GU":[13.44,144.79],"CA-AB":[51.05,-114.07],"CA-BC":[49.28,-123.12],"CA-MB":[49.9,-97.14],"CA-NB":[45.96,-66.65],"CA-NL":[47.56,-52.71],"CA-NS":[44.65,-63.57],"CA-NT":[62.45,-114.37],"CA-NU":[63.75,-68.52],"CA-ON":[43.65,-79.38],"CA-PE":[46.24,-63.13],"CA-QC":[45.5,-73.57],"CA-SK":[50.45,-104.62],"CA-YT":[60.72,-135.06],"AU-ACT":[-35.28,149.13],"AU-NSW":[-33.87,151.21],"AU-NT":[-12.46,130.84],"AU-QLD":[-27.47,153.03],"AU-SA":[-34.93,138.6],"AU-TAS":[-42.88,147.33],"AU-VIC":[-37.81,144.96],"AU-WA":[-31.95,115.86],"GB-ENG":[51.51,-.13],"GB-SCT":[55.95,-3.19],"GB-WLS":[51.48,-3.18],"GB-NIR":[54.6,-5.93],"DE-BW":[48.78,9.18],"DE-BY":[48.14,11.58],"DE-BE":[52.52,13.41],"DE-BB":[52.39,13.07],"DE-HB":[53.08,8.8],"DE-HH":[53.55,9.99],"DE-HE":[50.11,8.68],"DE-MV":[53.63,11.42],"DE-NI":[52.37,9.74],"DE-NW":[51.23,6.78],"DE-RP":[50,8.27],"DE-SL":[49.23,7],"DE-SN":[51.05,13.74],"DE-ST":[51.48,11.97],"DE-SH":[54.32,10.14],"DE-TH":[50.98,11.03],"FR-ARA":[45.76,4.84],"FR-BFC":[47.32,5.04],"FR-BRE":[48.11,-1.68],"FR-CVL":[47.39,.69],"FR-COR":[42.15,9.1],"FR-GES":[48.57,7.75],"FR-HDF":[50.63,3.06],"FR-IDF":[48.86,2.35],"FR-NAQ":[44.84,-.58],"FR-NOR":[49.44,1.1],"FR-OCC":[43.6,1.44],"FR-PDL":[47.22,-1.55],"FR-PAC":[43.3,5.37],"BR-SP":[-23.55,-46.63],"BR-RJ":[-22.91,-43.17],"BR-MG":[-19.92,-43.94],"BR-BA":[-12.97,-38.51],"BR-DF":[-15.79,-47.88],"BR-RS":[-30.03,-51.23],"BR-PR":[-25.43,-49.27],"BR-PE":[-8.05,-34.87],"BR-CE":[-3.72,-38.53],"BR-PA":[-1.46,-48.5],"BR-AM":[-3.12,-60.02],"BR-GO":[-16.68,-49.26],"IN-DL":[28.61,77.21],"IN-MH":[19.08,72.88],"IN-KA":[12.97,77.59],"IN-TN":[13.08,80.27],"IN-WB":[22.57,88.36],"IN-GJ":[23.02,72.57],"IN-RJ":[26.91,75.79],"IN-UP":[26.85,80.95],"IN-KL":[8.52,76.94],"IN-AP":[17.39,78.49],"IN-TG":[17.39,78.49],"IN-PB":[30.73,76.78],"JP-13":[35.68,139.69],"JP-27":[34.69,135.5],"JP-14":[35.44,139.64],"JP-23":[35.18,136.91],"JP-01":[43.06,141.35],"JP-26":[35.01,135.77],"JP-40":[33.59,130.4],"JP-34":[34.4,132.46],"MX-CMX":[19.43,-99.13],"MX-JAL":[20.67,-103.35],"MX-NLE":[25.67,-100.31],"MX-BCN":[32.53,-117.02],"MX-YUC":[20.97,-89.62],"CN-BJ":[39.9,116.4],"CN-SH":[31.23,121.47],"CN-GD":[23.13,113.26],"CN-HK":[22.32,114.17],"CN-TW":[25.03,121.57],"CN-MO":[22.2,113.55],"CN-SC":[30.57,104.07],"CN-ZJ":[30.27,120.15],"ES-MD":[40.42,-3.7],"ES-CT":[41.39,2.17],"ES-AN":[37.39,-5.98],"ES-PV":[43.26,-2.93],"ES-VC":[39.47,-.38],"IT-62":[41.9,12.5],"IT-25":[45.46,9.19],"IT-21":[45.07,7.69],"IT-34":[45.44,12.32],"IT-72":[40.85,14.27],"IT-82":[38.12,13.36]},Ya={AF:`Kabul`,AL:`Tirana`,DZ:`Algiers`,AD:`Andorra la Vella`,AO:`Luanda`,AG:`St. John's`,AR:`Buenos Aires`,AM:`Yerevan`,AU:`Canberra`,AT:`Vienna`,AZ:`Baku`,BS:`Nassau`,BH:`Manama`,BD:`Dhaka`,BB:`Bridgetown`,BY:`Minsk`,BE:`Brussels`,BZ:`Belmopan`,BJ:`Porto-Novo`,BT:`Thimphu`,BO:`La Paz`,BA:`Sarajevo`,BW:`Gaborone`,BR:`Brasília`,BN:`Bandar Seri Begawan`,BG:`Sofia`,BF:`Ouagadougou`,BI:`Gitega`,CV:`Praia`,KH:`Phnom Penh`,CM:`Yaoundé`,CA:`Ottawa`,CF:`Bangui`,TD:`N'Djamena`,CL:`Santiago`,CN:`Beijing`,CO:`Bogotá`,KM:`Moroni`,CG:`Brazzaville`,CD:`Kinshasa`,CR:`San José`,CI:`Yamoussoukro`,HR:`Zagreb`,CU:`Havana`,CY:`Nicosia`,CZ:`Prague`,DK:`Copenhagen`,DJ:`Djibouti`,DM:`Roseau`,DO:`Santo Domingo`,EC:`Quito`,EG:`Cairo`,SV:`San Salvador`,GQ:`Malabo`,ER:`Asmara`,EE:`Tallinn`,SZ:`Mbabane`,ET:`Addis Ababa`,FJ:`Suva`,FI:`Helsinki`,FR:`Paris`,GA:`Libreville`,GM:`Banjul`,GE:`Tbilisi`,DE:`Berlin`,GH:`Accra`,GR:`Athens`,GD:`St. George's`,GT:`Guatemala City`,GN:`Conakry`,GW:`Bissau`,GY:`Georgetown`,HT:`Port-au-Prince`,HN:`Tegucigalpa`,HU:`Budapest`,IS:`Reykjavik`,IN:`New Delhi`,ID:`Jakarta`,IR:`Tehran`,IQ:`Baghdad`,IE:`Dublin`,IL:`Jerusalem`,IT:`Rome`,JM:`Kingston`,JP:`Tokyo`,JO:`Amman`,KZ:`Astana`,KE:`Nairobi`,KI:`Tarawa`,KP:`Pyongyang`,KR:`Seoul`,KW:`Kuwait City`,KG:`Bishkek`,LA:`Vientiane`,LV:`Riga`,LB:`Beirut`,LS:`Maseru`,LR:`Monrovia`,LY:`Tripoli`,LI:`Vaduz`,LT:`Vilnius`,LU:`Luxembourg`,MG:`Antananarivo`,MW:`Lilongwe`,MY:`Kuala Lumpur`,MV:`Malé`,ML:`Bamako`,MT:`Valletta`,MH:`Majuro`,MR:`Nouakchott`,MU:`Port Louis`,MX:`Mexico City`,FM:`Palikir`,MD:`Chișinău`,MC:`Monaco`,MN:`Ulaanbaatar`,ME:`Podgorica`,MA:`Rabat`,MZ:`Maputo`,MM:`Naypyidaw`,NA:`Windhoek`,NR:`Yaren`,NP:`Kathmandu`,NL:`Amsterdam`,NZ:`Wellington`,NI:`Managua`,NE:`Niamey`,NG:`Abuja`,MK:`Skopje`,NO:`Oslo`,OM:`Muscat`,PK:`Islamabad`,PW:`Ngerulmud`,PA:`Panama City`,PG:`Port Moresby`,PY:`Asunción`,PE:`Lima`,PH:`Manila`,PL:`Warsaw`,PT:`Lisbon`,QA:`Doha`,RO:`Bucharest`,RU:`Moscow`,RW:`Kigali`,KN:`Basseterre`,LC:`Castries`,VC:`Kingstown`,WS:`Apia`,SM:`San Marino`,ST:`São Tomé`,SA:`Riyadh`,SN:`Dakar`,RS:`Belgrade`,SC:`Victoria`,SL:`Freetown`,SG:`Singapore`,SK:`Bratislava`,SI:`Ljubljana`,SB:`Honiara`,SO:`Mogadishu`,ZA:`Pretoria`,SS:`Juba`,ES:`Madrid`,LK:`Colombo`,SD:`Khartoum`,SR:`Paramaribo`,SE:`Stockholm`,CH:`Bern`,SY:`Damascus`,TW:`Taipei`,TJ:`Dushanbe`,TZ:`Dodoma`,TH:`Bangkok`,TL:`Dili`,TG:`Lomé`,TO:`Nukuʻalofa`,TT:`Port of Spain`,TN:`Tunis`,TR:`Ankara`,TM:`Ashgabat`,TV:`Funafuti`,UG:`Kampala`,UA:`Kyiv`,AE:`Abu Dhabi`,GB:`London`,US:`Washington, D.C.`,UY:`Montevideo`,UZ:`Tashkent`,VU:`Port Vila`,VA:`Vatican City`,VE:`Caracas`,VN:`Hanoi`,YE:`Sana'a`,ZM:`Lusaka`,ZW:`Harare`};function Xa(e){let t=e.toUpperCase();if(t.includes(`-`)){let e=Ja[t];if(e)return{latitude:e[0],longitude:e[1],city:``};let n=t.split(`-`)[0],r=qa[n];return r?{latitude:r[0],longitude:r[1],city:Ya[n]??``}:null}let n=qa[t];return n?{latitude:n[0],longitude:n[1],city:Ya[t]??``}:null}var Za={0:{description:`Clear sky`,icon:`☀️`},1:{description:`Mainly clear`,icon:`🌤️`},2:{description:`Partly cloudy`,icon:`⛅`},3:{description:`Overcast`,icon:`☁️`},45:{description:`Foggy`,icon:`🌫️`},48:{description:`Depositing rime fog`,icon:`🌫️`},51:{description:`Light drizzle`,icon:`🌦️`},53:{description:`Moderate drizzle`,icon:`🌦️`},55:{description:`Dense drizzle`,icon:`🌧️`},56:{description:`Light freezing drizzle`,icon:`🌧️`},57:{description:`Dense freezing drizzle`,icon:`🌧️`},61:{description:`Slight rain`,icon:`🌦️`},63:{description:`Moderate rain`,icon:`🌧️`},65:{description:`Heavy rain`,icon:`🌧️`},66:{description:`Light freezing rain`,icon:`🌧️`},67:{description:`Heavy freezing rain`,icon:`🌧️`},71:{description:`Slight snowfall`,icon:`🌨️`},73:{description:`Moderate snowfall`,icon:`🌨️`},75:{description:`Heavy snowfall`,icon:`❄️`},77:{description:`Snow grains`,icon:`❄️`},80:{description:`Slight rain showers`,icon:`🌦️`},81:{description:`Moderate rain showers`,icon:`🌧️`},82:{description:`Violent rain showers`,icon:`🌧️`},85:{description:`Slight snow showers`,icon:`🌨️`},86:{description:`Heavy snow showers`,icon:`❄️`},95:{description:`Thunderstorm`,icon:`⛈️`},96:{description:`Thunderstorm with slight hail`,icon:`⛈️`},99:{description:`Thunderstorm with heavy hail`,icon:`⛈️`}};function Qa(e){return[71,85].includes(e)?{type:`snow`,intensity:`light`}:[73].includes(e)?{type:`snow`,intensity:`moderate`}:[75,77,86].includes(e)?{type:`snow`,intensity:`heavy`}:[51,56,61,80].includes(e)?{type:`rain`,intensity:`light`}:[53,63,66,81,95].includes(e)?{type:`rain`,intensity:`moderate`}:[55,57,65,67,82,96,99].includes(e)?{type:`rain`,intensity:`heavy`}:{type:null,intensity:`light`}}async function $a(e,t,n){try{let r=new URLSearchParams({latitude:e.toString(),longitude:t.toString(),current:`temperature_2m,relative_humidity_2m,apparent_temperature,weather_code,wind_speed_10m,is_day`,timezone:`auto`}),i=await fetch(`https://api.open-meteo.com/v1/forecast?${r}`,{signal:n,headers:{Accept:`application/json`}});if(!i.ok)return null;let a=(await i.json()).current;if(!a)return null;let o=a.weather_code??0,s=Za[o]??{description:`Unknown`,icon:`🌡️`};return{temperature:Math.round(a.temperature_2m),apparentTemperature:Math.round(a.apparent_temperature),humidity:Math.round(a.relative_humidity_2m),windSpeed:Math.round(a.wind_speed_10m),weatherCode:o,description:s.description,icon:s.icon,isDay:a.is_day===1}}catch{return null}}function eo(e){let t=e?Xa(e):null;return F({queryKey:[`weather`,e],queryFn:async({signal:e})=>{if(!t)return null;let n=await $a(t.latitude,t.longitude,e);return n?{...n,city:t.city}:null},enabled:!!t,staleTime:1e3*60*15,gcTime:1e3*60*60,retry:1})}function to({url:e}){let t=(0,Q.useMemo)(()=>Ce(e),[e]),n=(0,Q.useMemo)(()=>be(e),[e]),r=(0,Q.useMemo)(()=>ye(e),[e]),i=(0,Q.useMemo)(()=>L(e),[e]);return t?(0,$.jsx)(so,{title:t,url:e}):n?(0,$.jsx)(no,{id:n,url:e}):r?(0,$.jsx)(ao,{author:r.author,rkey:r.rkey,url:e}):i?(0,$.jsx)(Ua,{card:i,url:e}):(0,$.jsx)(I,{url:e,showActions:!1})}function no({id:e,url:t}){let{data:n,isLoading:r}=Oa(e);return r?(0,$.jsxs)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:[(0,$.jsx)(q,{className:`w-full aspect-[16/9]`}),(0,$.jsxs)(`div`,{className:`p-5 space-y-3`,children:[(0,$.jsx)(q,{className:`h-3 w-24`}),(0,$.jsx)(q,{className:`h-7 w-3/4`}),(0,$.jsx)(q,{className:`h-4 w-1/2`}),(0,$.jsxs)(`div`,{className:`space-y-2 pt-2`,children:[(0,$.jsx)(q,{className:`h-4 w-full`}),(0,$.jsx)(q,{className:`h-4 w-full`}),(0,$.jsx)(q,{className:`h-4 w-3/4`})]})]})]}):n?.wikipediaTitle&&n.wikipediaUrl?(0,$.jsx)(so,{title:n.wikipediaTitle,url:n.wikipediaUrl}):(0,$.jsx)(I,{url:t,showActions:!1})}function ro(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function io(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m`;let r=Math.floor(n/60);if(r<24)return`${r}h`;let i=Math.floor(r/24);return i<30?`${i}d`:`${Math.floor(i/30)}mo`}function ao({author:e,rkey:t,url:n}){let{data:r,isLoading:i,isError:a}=Se(e,t),{toast:o}=Ve(),s=Kt(),c=`/i/${encodeURIComponent(`https://bsky.app/profile/${r?.handle??e}`)}`,l=(0,Q.useMemo)(()=>Cr(n),[n]),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),m=(0,Q.useCallback)(e=>{e.stopPropagation(),p(!0)},[]),h=(0,Q.useCallback)(e=>{e.stopPropagation(),d(!0)},[]),g=(0,Q.useCallback)(async e=>{e.stopPropagation(),await Ka(`${s}/i/${encodeURIComponent(n)}`)===`copied`&&o({title:`Link copied`})},[n,o,s]);return i?(0,$.jsx)(`div`,{className:`py-3`,children:(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[(0,$.jsx)(q,{className:`size-11 rounded-full shrink-0`}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(q,{className:`h-4 w-28`}),(0,$.jsx)(q,{className:`h-3.5 w-20`})]}),(0,$.jsx)(q,{className:`h-4 w-full`}),(0,$.jsx)(q,{className:`h-4 w-4/5`}),(0,$.jsxs)(`div`,{className:`flex gap-6 pt-1`,children:[(0,$.jsx)(q,{className:`h-4 w-10`}),(0,$.jsx)(q,{className:`h-4 w-10`}),(0,$.jsx)(q,{className:`h-4 w-10`})]})]})]})}):a||!r?(0,$.jsx)(I,{url:n,showActions:!1}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`article`,{className:`py-1`,children:[(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[(0,$.jsx)(V,{to:c,className:`shrink-0`,children:r.avatar?(0,$.jsx)(`img`,{src:r.avatar,alt:``,className:`size-11 rounded-full object-cover`,loading:`lazy`,onError:e=>{e.currentTarget.style.display=`none`},decoding:`async`}):(0,$.jsx)(`div`,{className:`size-11 rounded-full bg-gradient-to-br from-sky-400 to-blue-500 flex items-center justify-center text-white text-sm font-bold`,children:(r.displayName??r.handle).charAt(0).toUpperCase()})}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,$.jsx)(V,{to:c,className:`font-semibold text-[15px] truncate leading-tight hover:underline`,children:r.displayName??r.handle}),(0,$.jsxs)(V,{to:c,className:`text-muted-foreground text-sm truncate leading-tight hover:underline`,children:[`@`,r.handle]}),(0,$.jsx)(`span`,{className:`text-muted-foreground text-sm shrink-0`,children:`·`}),(0,$.jsx)(`span`,{className:`text-muted-foreground text-sm shrink-0`,children:io(r.createdAt)})]}),r.text&&(0,$.jsx)(`p`,{className:`mt-1 text-[15px] leading-relaxed whitespace-pre-wrap break-words`,children:r.text}),r.images&&r.images.length>0&&(0,$.jsx)(`div`,{className:z(`mt-3 rounded-xl overflow-hidden border border-border`,r.images.length===1&&`grid grid-cols-1`,r.images.length===2&&`grid grid-cols-2 gap-0.5`,r.images.length===3&&`grid grid-cols-2 gap-0.5`,r.images.length>=4&&`grid grid-cols-2 gap-0.5`),children:r.images.slice(0,4).map((e,t)=>(0,$.jsx)(`div`,{className:z(`relative overflow-hidden bg-secondary`,r.images.length===1?`aspect-video`:`aspect-square`,r.images.length===3&&t===0&&`row-span-2 aspect-auto`),children:(0,$.jsx)(`img`,{src:e.thumb,alt:e.alt||``,loading:`lazy`,className:`absolute inset-0 w-full h-full object-cover`,onError:e=>{e.currentTarget.style.display=`none`},decoding:`async`})},t))}),r.external&&r.external.thumb&&(0,$.jsxs)(`div`,{className:`mt-3 rounded-xl border border-border overflow-hidden bg-secondary/30`,children:[(0,$.jsx)(`div`,{className:`aspect-[2/1] overflow-hidden bg-secondary`,children:(0,$.jsx)(`img`,{src:r.external.thumb,alt:``,loading:`lazy`,className:`w-full h-full object-cover`,onError:e=>{e.currentTarget.style.display=`none`},decoding:`async`})}),r.external.title&&(0,$.jsx)(`div`,{className:`px-3 py-2.5`,children:(0,$.jsx)(`p`,{className:`text-sm font-semibold leading-tight line-clamp-2`,children:r.external.title})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-5 mt-3 -ml-2`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:m,className:`inline-flex items-center gap-1.5 p-2 rounded-full text-muted-foreground hover:text-sky-500 hover:bg-sky-500/10 transition-colors`,title:`Comment`,children:[(0,$.jsx)(le,{className:`size-[18px]`}),r.replyCount>0&&(0,$.jsx)(`span`,{className:`text-sm tabular-nums`,children:ro(r.replyCount)})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:h,className:`inline-flex items-center gap-1.5 p-2 rounded-full text-muted-foreground hover:text-green-500 hover:bg-green-500/10 transition-colors`,title:`Share to feed`,children:[(0,$.jsx)(fe,{className:`size-[18px]`}),r.repostCount>0&&(0,$.jsx)(`span`,{className:`text-sm tabular-nums`,children:ro(r.repostCount)})]}),(0,$.jsx)(Ra,{content:l,iconSize:`size-[18px]`,count:r.likeCount}),(0,$.jsx)(`button`,{type:`button`,onClick:g,className:`inline-flex items-center p-2 rounded-full text-muted-foreground hover:text-primary hover:bg-primary/10 transition-colors`,title:`Share link`,children:(0,$.jsx)(ie,{className:`size-[18px]`})})]})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(Tt,{className:`size-3.5 text-sky-500`}),(0,$.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`hover:text-foreground transition-colors hover:underline`,children:`View on Bluesky`}),(0,$.jsx)(E,{className:`size-3`})]})]}),f&&(0,$.jsx)(Ba,{open:f,onOpenChange:p,event:new URL(n)}),u&&(0,$.jsx)(Ba,{open:u,onOpenChange:d,initialContent:n,title:`Share to feed`})]})}var oo=160;function so({title:e,url:t}){let{data:n,isLoading:r}=Aa(e),{data:i}=Ca(e),a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),u=(0,Q.useCallback)(()=>{let e=a.current;e&&s(e.scrollHeight>oo)},[]);if((0,Q.useEffect)(()=>(u(),window.addEventListener(`resize`,u),()=>window.removeEventListener(`resize`,u)),[u]),r)return(0,$.jsxs)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:[(0,$.jsx)(q,{className:`w-full aspect-[16/9]`}),(0,$.jsxs)(`div`,{className:`p-5 space-y-3`,children:[(0,$.jsx)(q,{className:`h-3 w-24`}),(0,$.jsx)(q,{className:`h-7 w-3/4`}),(0,$.jsx)(q,{className:`h-4 w-1/2`}),(0,$.jsxs)(`div`,{className:`space-y-2 pt-2`,children:[(0,$.jsx)(q,{className:`h-4 w-full`}),(0,$.jsx)(q,{className:`h-4 w-full`}),(0,$.jsx)(q,{className:`h-4 w-3/4`})]})]})]});if(!n)return(0,$.jsx)(I,{url:t,showActions:!1});let d=Zt(n.thumbnail?.source,960,n.originalImage?.width);return(0,$.jsxs)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:[d&&(0,$.jsx)(`div`,{className:`relative w-full overflow-hidden bg-gradient-to-br from-blue-500/10 to-indigo-500/10`,children:(0,$.jsx)(`img`,{src:d,alt:n.title,className:`w-full max-h-[320px] object-cover`,loading:`eager`,decoding:`async`,onError:e=>{e.currentTarget.parentElement.style.display=`none`}})}),(0,$.jsxs)(`div`,{className:`p-5 sm:p-6`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground mb-2`,children:[(0,$.jsx)(J,{className:`size-3.5 shrink-0`}),(0,$.jsx)(`span`,{children:`Wikipedia`})]}),(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsx)(`h2`,{className:`text-2xl sm:text-3xl font-bold leading-snug mb-1 min-w-0 flex-1`,children:n.title}),(0,$.jsx)(wa,{title:e,className:`mt-1`,ariaLabel:`recording for ${n.title}`})]}),n.description&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground capitalize mb-4`,children:n.description}),n.extract&&(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`p`,{ref:a,style:!c&&o?{maxHeight:oo,overflow:`hidden`}:void 0,className:`text-sm leading-relaxed text-muted-foreground`,children:n.extract}),!c&&o&&(0,$.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 h-12 bg-gradient-to-t from-background to-transparent pointer-events-none`})]}),o&&(0,$.jsx)(`button`,{className:`text-sm text-primary hover:underline`,onClick:()=>l(e=>!e),children:c?`Show less`:`Read more`})]})]}),(0,$.jsxs)(`div`,{className:`border-t border-border px-5 py-2.5 flex flex-wrap items-center gap-x-4 gap-y-1.5`,children:[(0,$.jsxs)(`a`,{href:n.articleUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(J,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`Read on Wikipedia`}),(0,$.jsx)(E,{className:`size-3`})]}),i&&(0,$.jsxs)(`a`,{href:i.descriptionUrl,target:`_blank`,rel:`noopener noreferrer`,title:i.attribution,className:`inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(ne,{className:`size-3 fill-current`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`truncate`,children:[`Recording: `,i.attribution]}),(0,$.jsx)(E,{className:`size-3 shrink-0`})]})]})]})}function co({isbn:e}){let t=e.replace(`isbn:`,``),{data:n,isLoading:r}=kr(t),i=wr(t);if(r)return(0,$.jsx)(`div`,{className:`rounded-2xl border border-border overflow-hidden p-5`,children:(0,$.jsxs)(`div`,{className:`flex gap-5`,children:[(0,$.jsx)(q,{className:`w-[120px] h-[180px] rounded-lg shrink-0`}),(0,$.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,$.jsx)(q,{className:`h-3 w-24`}),(0,$.jsx)(q,{className:`h-6 w-3/4`}),(0,$.jsx)(q,{className:`h-4 w-1/2`}),(0,$.jsx)(q,{className:`h-4 w-1/3`}),(0,$.jsxs)(`div`,{className:`flex gap-2 pt-2`,children:[(0,$.jsx)(q,{className:`h-6 w-16 rounded-full`}),(0,$.jsx)(q,{className:`h-6 w-20 rounded-full`})]})]})]})});let a=n?.cover?.large||n?.cover?.medium,o=n?.authors?.map(e=>e.name).join(`, `),s=n?.publishers?.map(e=>e.name).join(`, `);return(0,$.jsxs)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`p-5`,children:(0,$.jsxs)(`div`,{className:`flex gap-5`,children:[a?(0,$.jsx)(`div`,{className:`shrink-0`,children:(0,$.jsx)(`img`,{src:a,alt:n?.title||`Book cover`,className:`w-[120px] sm:w-[140px] rounded-lg shadow-md object-cover`,loading:`lazy`,onError:e=>{e.currentTarget.style.display=`none`},decoding:`async`})}):(0,$.jsx)(`div`,{className:`shrink-0 w-[120px] sm:w-[140px] h-[180px] sm:h-[210px] rounded-lg bg-secondary flex items-center justify-center`,children:(0,$.jsx)(D,{className:`size-10 text-muted-foreground/40`})}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(D,{className:`size-3.5 shrink-0`}),(0,$.jsxs)(`span`,{children:[`ISBN `,i]})]}),(0,$.jsx)(`h2`,{className:`text-xl font-bold leading-snug line-clamp-3`,children:n?.title||`Unknown Book`}),o&&(0,$.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`by `,o]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground pt-1`,children:[n?.publish_date&&(0,$.jsx)(`span`,{children:n.publish_date}),s&&(0,$.jsx)(`span`,{children:s}),n?.number_of_pages&&(0,$.jsxs)(`span`,{children:[n.number_of_pages,` pages`]})]}),n?.subjects&&n.subjects.length>0&&(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-2`,children:n.subjects.map(e=>(0,$.jsx)(`span`,{className:`text-xs px-2.5 py-0.5 rounded-full bg-secondary text-muted-foreground`,children:e.name},e.name))})]})]})}),(0,$.jsx)(`div`,{className:`border-t border-border px-5 py-2.5`,children:(0,$.jsxs)(`a`,{href:`https://openlibrary.org/isbn/${t}`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(l,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`View on OpenLibrary`}),(0,$.jsx)(E,{className:`size-3`})]})})]})}var lo=100;function uo({extract:e,articleUrl:t}){let n=(0,Q.useRef)(null),[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(!1),s=(0,Q.useCallback)(()=>{let e=n.current;e&&i(e.scrollHeight>lo)},[]);return(0,Q.useEffect)(()=>(s(),window.addEventListener(`resize`,s),()=>window.removeEventListener(`resize`,s)),[s]),(0,$.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`p`,{ref:n,style:!a&&r?{maxHeight:lo,overflow:`hidden`}:void 0,className:`text-sm leading-relaxed text-muted-foreground`,children:e}),!a&&r&&(0,$.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 h-12 bg-gradient-to-t from-background to-transparent pointer-events-none`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[r&&(0,$.jsx)(`button`,{className:`text-sm text-primary hover:underline`,onClick:()=>o(e=>!e),children:a?`Show less`:`Read more`}),(0,$.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(l,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`Wikipedia`}),(0,$.jsx)(E,{className:`size-3`})]})]})]})}function fo({code:e}){let{data:t,isLoading:n}=eo(e);return n?(0,$.jsx)(`div`,{className:`mt-5 rounded-xl bg-secondary/50 p-4`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,$.jsx)(q,{className:`size-12 rounded-lg`}),(0,$.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,$.jsx)(q,{className:`h-5 w-24`}),(0,$.jsx)(q,{className:`h-3 w-32`})]}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(q,{className:`h-3 w-16`}),(0,$.jsx)(q,{className:`h-3 w-16`})]})]})}):t?(0,$.jsx)(`div`,{className:`mt-5 rounded-xl bg-gradient-to-br from-secondary/60 to-secondary/30 border border-border/50 p-4 transition-all hover:border-border`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`span`,{className:`text-4xl leading-none`,role:`img`,"aria-label":t.description,children:t.icon}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`p`,{className:`text-2xl font-bold tabular-nums leading-tight`,children:[t.temperature,`°C`]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.description})]})]}),(0,$.jsx)(`div`,{className:`h-10 w-px bg-border/60 mx-1`}),(0,$.jsxs)(`div`,{className:`flex-1 grid grid-cols-2 gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-foreground/60`,children:`Feels like`}),(0,$.jsxs)(`span`,{className:`font-medium text-foreground tabular-nums`,children:[t.apparentTemperature,`°`]})]}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(C,{className:`size-3 shrink-0`}),(0,$.jsxs)(`span`,{className:`font-medium text-foreground tabular-nums`,children:[t.humidity,`%`]})]}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(ce,{className:`size-3 shrink-0`}),(0,$.jsxs)(`span`,{className:`font-medium text-foreground tabular-nums`,children:[t.windSpeed,` km/h`]})]}),t.city&&(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(se,{className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:t.city})]})]})]})}):null}function po({code:e}){let t=Rt(e),{data:n,isLoading:r}=Aa(zt(e));return t?(0,$.jsx)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:(0,$.jsxs)(`div`,{className:`p-6 sm:p-8`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-4`,children:[t.subdivision&&n?.thumbnail?(0,$.jsx)(`img`,{src:n.thumbnail.source,alt:t.subdivisionName??t.subdivision,className:`size-16 sm:size-20 rounded-md object-cover shadow-sm border border-border`,decoding:`async`}):(0,$.jsx)(`span`,{className:`text-6xl sm:text-7xl leading-none`,role:`img`,"aria-label":`Flag of ${t.name}`,children:t.flag}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`h2`,{className:`text-2xl sm:text-3xl font-bold leading-snug`,children:t.subdivisionName??t.name}),t.subdivision&&(0,$.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[t.name,t.subdivisionName?``:` · ${t.subdivision}`]}),n?.description&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground capitalize`,children:n.description})]})]}),(0,$.jsx)(fo,{code:e}),r?(0,$.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,$.jsx)(q,{className:`h-4 w-full`}),(0,$.jsx)(q,{className:`h-4 w-full`}),(0,$.jsx)(q,{className:`h-4 w-3/4`})]}):n?.extract?(0,$.jsx)(uo,{extract:n.extract,articleUrl:n.articleUrl}):null]})}):(0,$.jsxs)(`div`,{className:`rounded-2xl border border-border p-5 text-center`,children:[(0,$.jsx)(se,{className:`size-8 mx-auto mb-2 text-muted-foreground/40`}),(0,$.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Unknown country code: `,e]})]})}function mo({identifier:e}){let t=(0,Q.useMemo)(()=>Cr(e),[e]),n=`/i/${encodeURIComponent(e)}`;switch(t.type){case`url`:{let e=L(t.value);return e?(0,$.jsx)(_o,{card:e,url:t.value,link:n}):(0,$.jsx)(ho,{url:t.value,link:n})}case`isbn`:return(0,$.jsx)(go,{isbn:t.value,link:n});case`iso3166`:return(0,$.jsx)(vo,{code:t.code,link:n});case`bitcoin-tx`:return(0,$.jsx)(da,{txid:t.txid,link:n});case`bitcoin-address`:return(0,$.jsx)(fa,{address:t.address,link:n});default:return(0,$.jsx)(V,{to:n,className:`block px-4 py-3 border-b border-border hover:bg-secondary/30 transition-colors`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(l,{className:`size-5 text-muted-foreground shrink-0`}),(0,$.jsx)(`span`,{className:`text-sm text-muted-foreground truncate`,children:e})]})})}}function ho({url:e,link:t}){let n=(0,Q.useMemo)(()=>we(e),[e]),{data:r,isLoading:i}=Nt(e),a=(0,Q.useMemo)(()=>{try{return new URL(e).hostname.replace(/^www\./,``)}catch{return e}},[e]),o=r?.title,s=r?.thumbnail_url,c=r?.provider_name||a;if(i)return(0,$.jsx)(`div`,{className:`px-4 py-3 border-b border-border`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(q,{className:`size-12 rounded-lg shrink-0`}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-3 w-24`}),(0,$.jsx)(q,{className:`h-4 w-3/4`})]})]})});let l=n?`https://img.youtube.com/vi/${n}/mqdefault.jpg`:s;return(0,$.jsxs)(V,{to:t,className:`flex items-center gap-3 px-4 py-3 border-b border-border hover:bg-secondary/30 transition-colors`,children:[l?(0,$.jsx)(`img`,{src:l,alt:``,className:`size-12 rounded-lg object-cover shrink-0`,loading:`lazy`,onError:e=>{e.currentTarget.style.display=`none`},decoding:`async`}):(0,$.jsx)(`div`,{className:`size-12 rounded-lg bg-secondary flex items-center justify-center shrink-0`,children:(0,$.jsx)(W,{url:e,size:20})}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(W,{url:e,size:12,className:`shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:c})]}),(0,$.jsx)(`p`,{className:`text-sm font-medium truncate mt-0.5`,children:o||e})]}),(0,$.jsx)(E,{className:`size-4 text-muted-foreground shrink-0`})]})}function go({isbn:e,link:t}){let n=e.replace(`isbn:`,``),{data:r,isLoading:i}=kr(n);if(i)return(0,$.jsx)(`div`,{className:`px-4 py-3 border-b border-border`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(q,{className:`w-9 h-12 rounded shrink-0`}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-3 w-16`}),(0,$.jsx)(q,{className:`h-4 w-3/4`})]})]})});let a=r?.cover?.medium||r?.cover?.large,o=r?.authors?.map(e=>e.name).join(`, `);return(0,$.jsxs)(V,{to:t,className:`flex items-center gap-3 px-4 py-3 border-b border-border hover:bg-secondary/30 transition-colors`,children:[a?(0,$.jsx)(`img`,{src:a,alt:r?.title||`Book cover`,className:`w-9 h-12 rounded object-cover shrink-0`,loading:`lazy`,decoding:`async`}):(0,$.jsx)(`div`,{className:`w-9 h-12 rounded bg-secondary flex items-center justify-center shrink-0`,children:(0,$.jsx)(D,{className:`size-4 text-muted-foreground/40`})}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(D,{className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{children:`Book`})]}),(0,$.jsx)(`p`,{className:`text-sm font-medium truncate mt-0.5`,children:r?.title||`ISBN ${n}`}),o&&(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground truncate`,children:[`by `,o]})]}),(0,$.jsx)(E,{className:`size-4 text-muted-foreground shrink-0`})]})}function _o({card:e,url:t,link:n}){let{data:r,isLoading:i}=_a((0,Q.useMemo)(()=>e.kind===`multiverse`?{kind:`multiverse`,multiverseId:e.multiverseId}:{kind:`set`,set:e.set,number:e.number,lang:e.lang},[e]));if(i)return(0,$.jsx)(`div`,{className:`px-4 py-3 border-b border-border`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(q,{className:`w-9 h-12 rounded-md shrink-0`}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-3 w-20`}),(0,$.jsx)(q,{className:`h-4 w-3/4`})]})]})});let a=r?ga(r,`small`):void 0,o;try{o=new URL(t).hostname.replace(/^www\./,``)}catch{o=t}return(0,$.jsxs)(V,{to:n,className:`flex items-center gap-3 px-4 py-3 border-b border-border hover:bg-secondary/30 transition-colors`,children:[a?(0,$.jsx)(`img`,{src:a,alt:r?.name??`Magic card`,className:`w-9 h-12 rounded-md object-cover shrink-0 shadow-sm`,loading:`lazy`,decoding:`async`}):(0,$.jsx)(`div`,{className:`w-9 h-12 rounded-md bg-secondary flex items-center justify-center shrink-0`,children:(0,$.jsx)(Bt,{className:`size-4 text-muted-foreground/40`})}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(Bt,{className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{children:`Magic Card`})]}),(0,$.jsx)(`p`,{className:`text-sm font-medium truncate mt-0.5`,children:r?.name??o}),r?.set_name&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:r.set_name})]}),(0,$.jsx)(E,{className:`size-4 text-muted-foreground shrink-0`})]})}function vo({code:e,link:t}){let n=Rt(e);return(0,$.jsxs)(V,{to:t,className:`flex items-center gap-3 px-4 py-3 border-b border-border hover:bg-secondary/30 transition-colors`,children:[(0,$.jsx)(`span`,{className:`text-2xl leading-none shrink-0`,role:`img`,"aria-label":n?`Flag of ${n.name}`:e,children:n?.flag??`🌍`}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(se,{className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{children:`Country`})]}),(0,$.jsx)(`p`,{className:`text-sm font-medium truncate mt-0.5`,children:n?.name??e})]}),(0,$.jsx)(E,{className:`size-4 text-muted-foreground shrink-0`})]})}function yo({addr:e}){let{data:t,isLoading:n}=Mt(e),r=t?.tags.find(([e])=>e===`name`)?.[1]||t?.tags.find(([e])=>e===`d`)?.[1]||`Community`,i=t?.tags.find(([e])=>e===`image`)?.[1],a=t?.tags.find(([e])=>e===`description`)?.[1],o=t?.tags.filter(([e,,,t])=>e===`p`&&t===`moderator`).length??0,s=(0,Q.useMemo)(()=>`/${P.naddrEncode({kind:e.kind,pubkey:e.pubkey,identifier:e.identifier})}`,[e]);return n?(0,$.jsx)(`div`,{className:`px-4 py-3 border-b border-border`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(q,{className:`size-12 rounded-lg shrink-0`}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-3 w-16`}),(0,$.jsx)(q,{className:`h-4 w-32`})]})]})}):(0,$.jsxs)(V,{to:s,className:`flex items-center gap-3 px-4 py-3 border-b border-border hover:bg-secondary/30 transition-colors`,children:[i?(0,$.jsx)(`img`,{src:i,alt:r,className:`size-12 rounded-lg object-cover shrink-0`,loading:`lazy`,decoding:`async`}):(0,$.jsx)(`div`,{className:`size-12 rounded-lg bg-primary/10 flex items-center justify-center shrink-0`,children:(0,$.jsx)(_,{className:`size-5 text-primary/50`})}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(_,{className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{children:`Community`}),o>0&&(0,$.jsxs)(`span`,{className:`text-muted-foreground/60`,children:[`· `,o,` mod`,o===1?``:`s`]})]}),(0,$.jsx)(`p`,{className:`text-sm font-medium truncate mt-0.5`,children:r}),a&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:a})]})]})}function bo({pubkey:e}){let t=Be(e),n=t.data?.metadata,r=Ye(n),i=n?.name??n?.display_name??`Anonymous`,a=rt(e,n);return t.isLoading?(0,$.jsx)(`div`,{className:`px-4 py-3 border-b border-border`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(q,{className:`size-12 rounded-full shrink-0`}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-3 w-16`}),(0,$.jsx)(q,{className:`h-4 w-32`})]})]})}):(0,$.jsxs)(V,{to:a,className:`flex items-center gap-3 px-4 py-3 border-b border-border hover:bg-secondary/30 transition-colors`,children:[(0,$.jsxs)(Ze,{shape:r,className:`size-12 shrink-0`,children:[(0,$.jsx)(Xe,{src:n?.picture,alt:i}),(0,$.jsx)(Je,{className:`bg-primary/20 text-primary`,children:(0,$.jsx)(de,{className:`size-5`})})]}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(de,{className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{children:`Profile`})]}),(0,$.jsx)(`p`,{className:`text-sm font-medium truncate mt-0.5`,children:i}),n?.nip05&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:n.nip05})]})]})}function xo({event:e,className:t,disableHoverCards:n}){if(e.kind===0)return(0,$.jsx)(`div`,{className:z(`rounded-xl border border-border bg-secondary/30 overflow-hidden`,t),children:(0,$.jsx)(bo,{pubkey:e.pubkey})});if(e.kind>=3e4&&e.kind<4e4){let r=e.tags.find(([e])=>e===`d`)?.[1]??``;return(0,$.jsx)(xe,{addr:{kind:e.kind,pubkey:e.pubkey,identifier:r},className:t,disableHoverCards:n})}return(0,$.jsx)(je,{eventId:e.id,authorHint:e.pubkey,className:t,disableHoverCards:n})}export{mi as A,Sr as B,fa as C,wi as D,Yi as E,Cr as F,xr as H,Dr as I,vr as L,Vr as M,kr as N,Ci as O,Er as P,yr as R,ca as S,da as T,gr as U,hr as V,wa as _,mo as a,ga as b,Qa as c,Ba as d,za as f,Oa as g,Aa as h,po as i,Br as j,Si as k,eo as l,Pa as m,co as n,bo as o,Ra as p,yo as r,to as s,xo as t,Ka as u,Ca as v,na as w,pa as x,_a as y,br as z};