1import{o as h,al as w,a4 as b,U as z,j as e,C as m,$ as I,T as l,D as y,G as n,L as v,O as j,X as u,ac as k,aM as S,H as E,I as C,E as $,a7 as g}from"./index-dE8a1mPK.js";import{E as R}from"./ErrorState-gVNyx0--.js";import{E as T}from"./EmptyState-BpgfYYCq.js";import{N as B}from"./NumberInput-EbCp_odp.js";import{I as f}from"./IconExternalLink-DcQXcLz7.js";import{I as L}from"./IconHeart-CFNXoJCy.js";import{I as M}from"./IconRepeat-BAxCrsfr.js";import{I as P}from"./IconBookmark-OdqwEN7V.js";import{I as U}from"./IconQuote-DAmadQor.js";import"./IconCopy-B63sUmw8.js";import"./Code-YtMEZkZ5.js";function D(){var c;const[r,o]=h.useState(""),[t,d]=h.useState(100),s=w({mutationFn:()=>z.inspirationFeed({q:r.trim(),count:25,minLikes:t}),onError:i=>b(i)}),a=((c=s.data)==null?void 0:c.tweets)||[];return e.jsxs(m,{gap:"md",children:[e.jsxs("div",{children:[e.jsx(I,{order:2,children:"Inspiration"}),e.jsxs(l,{c:"dimmed",size:"sm",mt:2,children:["Top-performing X posts matching your niche, ranked by engagement. Click ",e.jsx("b",{children:"Generate your version"})," on any tweet to drop it into the composer and let AI rewrite it in your voice."]})]}),e.jsx(y,{withBorder:!0,children:e.jsxs(n,{align:"flex-end",wrap:"wrap",gap:"sm",children:[e.jsx(v,{label:"Search topic / keywords",description:"X search operators work: from:handle, lang:en, min_faves:1000, etc.",placeholder:"ai founders OR shopify SEO ORâ¦",value:r,onChange:i=>o(i.currentTarget.value),leftSection:e.jsx(j,{size:14}),style:{flex:"1 1 320px",minWidth:240}}),e.jsx(B,{label:"Min likes",description:"Hide low-engagement noise",value:t,onChange:i=>d(Number(i)||0),min:0,step:50,w:140}),e.jsx(u,{leftSection:e.jsx(k,{size:14}),onClick:()=>s.mutate(),loading:s.isPending,disabled:!r.trim(),children:"Pull feed"})]})}),s.isPending&&e.jsx(S,{inline:!0,label:"Searching X â typically 10â30s"}),s.error&&e.jsx(R,{error:s.error,onRetry:()=>s.mutate()}),!s.isPending&&!s.error&&s.data&&a.length===0&&e.jsx(T,{icon:e.jsx(j,{size:28,stroke:1.5}),title:"Nothing matched",description:`No tweets with â¥${t} likes for "${r}". Try lowering Min likes or broadening the query.`}),a.length>0&&e.jsxs(m,{gap:"sm",children:[e.jsxs(l,{size:"xs",c:"dimmed",children:[a.length," tweets, sorted by engagement"]}),a.map(i=>e.jsx(q,{tweet:i},i.id))]})]})}function q({tweet:r}){var o,t,d,s,a,c,i;return e.jsxs(y,{withBorder:!0,padding:"sm",children:[e.jsxs(n,{justify:"space-between",wrap:"nowrap",align:"flex-start",mb:6,children:[e.jsxs(n,{gap:8,wrap:"nowrap",style:{minWidth:0,flex:1},children:[e.jsx(E,{src:(o=r.author)==null?void 0:o.avatar,radius:"xl",size:"sm",children:(((t=r.author)==null?void 0:t.handle)||"?").slice(0,1).toUpperCase()}),e.jsxs(m,{gap:0,style:{minWidth:0},children:[e.jsxs(n,{gap:4,wrap:"nowrap",children:[e.jsx(l,{size:"sm",fw:600,truncate:!0,children:((d=r.author)==null?void 0:d.name)||`@${(s=r.author)==null?void 0:s.handle}`}),((a=r.author)==null?void 0:a.verified)&&e.jsx(f,{size:10,color:"var(--mantine-color-blue-5)"})]}),e.jsxs(l,{size:"xs",c:"dimmed",truncate:!0,children:["@",(c=r.author)==null?void 0:c.handle,(i=r.author)!=null&&i.followers?` · ${x(r.author.followers)} followers`:""]})]})]}),r.url&&e.jsxs(C,{href:r.url,target:"_blank",rel:"noreferrer",size:"xs",children:["View on X ",e.jsx(f,{size:10})]})]}),e.jsx(l,{size:"sm",style:{whiteSpace:"pre-wrap",wordBreak:"break-word",background:"var(--xb-bg-soft, rgba(0,0,0,0.03))",padding:10,borderRadius:6,lineHeight:1.55},children:r.text}),e.jsxs(n,{justify:"space-between",mt:8,wrap:"wrap",gap:"xs",children:[e.jsxs(n,{gap:10,wrap:"wrap",children:[e.jsx(p,{icon:e.jsx(L,{size:12}),value:r.likes}),e.jsx(p,{icon:e.jsx(M,{size:12}),value:r.retweets}),e.jsx(p,{icon:e.jsx(P,{size:12}),value:r.bookmarks}),r.replies>0&&e.jsxs($,{variant:"dot",size:"xs",color:"gray",children:[x(r.replies)," replies"]})]}),e.jsxs(n,{gap:"xs",children:[e.jsx(u,{size:"xs",variant:"default",leftSection:e.jsx(U,{size:12}),component:g,to:`/compose?mode=quote"eUrl=${encodeURIComponent(r.url||"")}`,children:"Quote"}),e.jsx(u,{size:"xs",leftSection:e.jsx(k,{size:12}),component:g,to:`/compose?mode=repurpose&sourceUrl=${encodeURIComponent(r.url||"")}`,children:"Generate your version"})]})]})]})}function p({icon:r,value:o}){return o?e.jsxs(n,{gap:3,wrap:"nowrap",style:{color:"var(--mantine-color-dimmed)"},children:[r,e.jsx(l,{size:"xs",children:x(o)})]}):null}function x(r){return r==null?"":r>=1e6?`${(r/1e6).toFixed(1)}M`:r>=1e3?`${(r/1e3).toFixed(1)}K`:String(r)}export{D as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.