PageSourceSearch

https://app.xlift.ai/assets/ComposePage-BIeo3EuD.js

js xlift.ai collected 2026-10-05 13:20:46 UTC 12,014 bytes, 13 lines download raw bytes

1import{v as J,o as i,j as e,C as T,G as p,F as ee,X as E,T as m,U as k,as as te,ak as se,A as re,al as B,a4 as q,a5 as O,aM as oe,a7 as ie,$ as ae,D as U,W as F,ac as X,E as ne,L as D,I as ce}from"./index-dE8a1mPK.js";import{I as le}from"./Image-Ia4YApv6.js";import{I as de}from"./IconX-B50qDTAe.js";import{I as ue}from"./IconPhoto-Cq-lzySQ.js";import{T as he}from"./ThreadEditor-CdQzLMVP.js";import{I as pe,H as me}from"./HooksLibraryModal-DsEzYq3b.js";import{A as Y}from"./AiWriteButton-BOd6FUXb.js";import{E as xe}from"./EmptyState-BpgfYYCq.js";import{E as fe}from"./ErrorState-gVNyx0--.js";import{I as Z}from"./IconMessageCircle-BIgLQuMG.js";import{I as ge}from"./IconArrowLeft-cAVPTBNq.js";import{S as je}from"./Select-DebRlW67.js";import{S as we}from"./SegmentedControl-CNEtbfTu.js";import{T as _}from"./Textarea-BtbUvWWM.js";import{I as ve}from"./IconCalendar-OaV4qSkS.js";import{I as ke}from"./IconSend-D-OEBegQ.js";import{I as ye}from"./IconQuote-DAmadQor.js";import"./IconPlus-B47PY1MC.js";import"./IconArrowDown-DMfekS2f.js";import"./IconTrash-DIXYcrq7.js";import"./IconCopy-B63sUmw8.js";import"./Code-YtMEZkZ5.js";import"./OptionsDropdown-wonErrz5.js";import"./CheckIcon-DkMc45y2.js";import"./get-env-uyVen0u2.js";/**
2 * @license @tabler/icons-react v3.43.0 - MIT
3 *
4 * This source code is licensed under the MIT license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Se=[["path",{d:"M9 15l6 -6",key:"svg-0"}],["path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464",key:"svg-1"}],["path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463",key:"svg-2"}]],be=J("outline","link","Link",Se);/**
7 * @license @tabler/icons-react v3.43.0 - MIT
8 *
9 * This source code is licensed under the MIT license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const ze=[["path",{d:"M15 10l4.553 -2.276a1 1 0 0 1 1.447 .894v6.764a1 1 0 0 1 -1.447 .894l-4.553 -2.276v-4",key:"svg-0"}],["path",{d:"M3 8a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -8",key:"svg-1"}]],Ie=J("outline","video","Video",ze),Te="image/png,image/jpeg,image/webp,image/gif,video/mp4,video/quicktime,video/webm",K=15*1024*1024;function Ee({accountId:y,media:r=[],onChange:a,max:h=4,target:n="tweet",readOnly:w=!1}){const l=i.useRef(null),[v,d]=i.useState(!1),[g,x]=i.useState(null),A=r.some(s=>s.kind==="video"),f=n==="dm"||A?1:h,z=r.length>=f;async function S(s){var P;const o=(P=s.target.files)==null?void 0:P[0];if(s.target.value="",!o)return;if(!y)return x("Pick an account first");const j=o.type.startsWith("video/");if(r.length&&n==="dm")return x("A DM can carry one attachment");if(j&&r.length)return x("X won't mix video with other media — remove the rest first");
11if(!j&&A)return x("X won't mix images with video — remove the video first");if(r.length>=f)return x(`Max ${f} ${f===1?"attachment":"images"}`);if(o.size>K)return x(`${(o.size/1048576).toFixed(1)} MB is over the ${K/1048576} MB limit — compress it or trim the clip`);d(!0),x(null);try{const u=await Ae(o),L=`data:${o.type};base64,${u}`,C=await k.uploadMedia({accountId:y,base64:u,mime:o.type,target:n});a==null||a([...r,{mediaId:C.mediaId,kind:C.kind||(j?"video":"image"),preview:L,name:o.name,expiresAt:C.expiresAt}])}catch(u){x((u==null?void 0:u.message)||"Upload failed")}finally{d(!1)}}function M(s){a==null||a(r.filter((o,j)=>j!==s))}return e.jsxs(T,{gap:6,children:[e.jsxs(p,{gap:6,wrap:"wrap",children:[r.map((s,o)=>e.jsxs("div",{style:{position:"relative"},children:[s.kind==="video"?e.jsx("video",{src:s.preview||s.url,width:64,height:64,muted:!0,playsInline:!0,preload:"metadata",style:{objectFit:"cover",borderRadius:6,background:"#000",display:"block"},"aria-label":s.name||`video ${o+1}`}):e.jsx(le,{src:s.preview||s.url,w:64,h:64,fit:"cover",radius:6,alt:s.name||`image ${o+1}`}),!w&&e.jsx(ee,{size:"xs",color:"red",variant:"filled",style:{position:"absolute",top:-4,right:-4},onClick:()=>M(o),"aria-label":`Remove ${s.kind==="video"?"video":"image"}`,children:e.jsx(de,{size:10})})]},o)),!w&&!z&&e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:l,type:"file",accept:Te,onChange:S,style:{display:"none"}}),e.jsx(E,{variant:"default",size:"xs",leftSection:v?null:A?e.jsx(Ie,{size:14}):e.jsx(ue,{size:14}),onClick:()=>{var s;return(s=l.current)==null?void 0:s.click()},loading:v,disabled:!y,children:r.length===0?"Add image or video":"Add another"})]})]}),v&&e.jsx(m,{size:"xs",c:"dimmed",children:"Uploading… video takes a moment while X processes it."}),g&&e.jsx(m,{size:"xs",c:"red",children:g}),r.length>0&&e.jsxs(m,{size:"xs",c:"dimmed",children:[r.length,"/",f," attached. mediaIds expire ~24h after upload."]})]})}function Ae(y){return new Promise((r,a)=>{const h=new FileReader;h.onload=()=>{const n=h.result,w=String(n).indexOf("base64,");r(w>=0?String(n).slice(w+7):String(n))},h.onerror=()=>a(h.error),h.readAsDataURL(y)})}const Ce=[{value:"single",label:"Tweet",icon:e.jsx(Z,{size:14})},{value:"thread",label:"Thread",icon:e.jsx(X,{size:14})},{value:"quote",label:"Quote",icon:e.jsx(ye,{size:14})},{value:"repurpose",label:"From URL",icon:e.jsx(be,{size:14})}];function st(){const y=te(),[r]=se(),a=re({queryKey:["accounts"],queryFn:()=>k.listAccounts()}),h=i.useMemo(()=>{var t;return(((t=a.data)==null?void 0:t.accounts)||[]).filter(c=>c.executionMode==="cookie"&&c.status==="active")},[a.data]),[n,w]=i.useState(null),[l,v]=i.useState("single"),[d,g]=i.useState(""),[x,A]=i.useState([]),[f,z]=i.useState([{text:""}]),[S,M]=i.useState(""),[s,o]=i.useState(""),[j,P]=i.useState(""),[u,L]=i.useState(""),[C,W]=i.useState(!1);i.useEffect(()=>{!n&&h.length&&w(h[0].id)},[n,h]),i.useEffect(()=>{const t=r.get("mode");t&&["single","thread","quote","repurpose"].includes(t)&&v(t);const c=r.get("text");c&&g(c);const b=r.get("quoteUrl");b&&M(b);const I=r.get("sourceUrl");I&&o(I)},[r]);const G=B({mutationFn:()=>k.expandToThread({text:d.trim(),count:5}),onSuccess:t=>{z(t.posts||[]),v("thread"),O("Expanded to thread — review and tweak.")},onError:t=>q(t)}),N=B({mutationFn:()=>k.extendThread({posts:f}),onSuccess:t=>z(c=>[...c,t.post]),onError:t=>q(t)}),Q=B({mutationFn:()=>k.repurpose({url:s.trim()||void 0,text:j.trim()||void 0,count:5}),onSuccess:t=>{z(t.posts||[]),v("thread"),O(`Pulled ${(t.posts||[]).length} tweets — switch to thread or pick one.`)},onError:t=>q(t)}),H=B({mutationFn:async()=>{const t=u?new Date(u).getTime():Date.now(),c=x.map(b=>b.mediaId).filter(Boolean);if(l==="single"){if(!d.trim()&&c.length===0)throw new Error("Add text or an image first.");return k.createOneOff({type:"post",accountId:n,payload:{text:d.trim(),mediaIds:c},scheduledFor:t})}if(l==="thread"){const b=f.map(I=>({text:(I.text||"").trim()})).filter(I=>I.text);if(b.length===0)throw new Error("Thread is empty.");return k.createOneOff({type:"thread",accountId:n,payload:{posts:b},scheduledFor:t})}if(l==="quote"){if(!S.trim())throw new Error("Paste the source tweet URL.");
11if(!d.trim())throw new Error("Add your commentary.");return k.createOneOff({type:"quote",accountId:n,payload:{tweetUrl:S.trim(),text:d.trim()},scheduledFor:t})}throw l==="repurpose"?new Error('Click "Generate tweets from URL" first, then pick which ones to queue.'):new Error("Unknown mode")},onSuccess:t=>{const c=u?`scheduled for ${new Date(u).toLocaleString()}`:"queued for immediate send";O(`Done — ${c}.`),y("/history")},onError:t=>q(t)});if(a.isLoading)return e.jsx(oe,{});if(a.error)return e.jsx(fe,{error:a.error,onRetry:()=>a.refetch()});if(h.length===0)return e.jsx(xe,{icon:e.jsx(Z,{size:32,stroke:1.5}),title:"No cookie-mode accounts",description:"Compose posts and threads from any active X account. Connect one first.",cta:{label:"Connect account",to:"/accounts"}});const R=280,$=d.length,V=$>R;return e.jsxs(T,{gap:"md",children:[e.jsxs(p,{justify:"space-between",wrap:"wrap",children:[e.jsxs(p,{gap:"xs",children:[e.jsx(E,{variant:"subtle",leftSection:e.jsx(ge,{size:14}),component:ie,to:"/overview",px:"xs",children:"Back"}),e.jsx(ae,{order:2,children:"Compose"})]}),e.jsxs(p,{gap:"xs",children:[e.jsx(m,{c:"dimmed",size:"sm",children:"From"}),e.jsx(je,{size:"xs",value:n,onChange:w,data:h.map(t=>({value:t.id,label:`@${t.handle}`})),w:200})]})]}),e.jsx(we,{value:l,onChange:v,data:Ce.map(t=>({value:t.value,label:e.jsxs(p,{gap:4,children:[t.icon," ",t.label]})}))}),l==="single"&&e.jsx(U,{withBorder:!0,children:e.jsxs(T,{gap:"xs",children:[e.jsxs(p,{justify:"space-between",align:"center",children:[e.jsx(m,{size:"sm",fw:500,children:"One tweet"}),e.jsxs(p,{gap:"xs",children:[e.jsx(Y,{kind:"tweet",context:{},current:d,onResult:t=>g(t)}),e.jsx(F,{label:"Browse curated hook patterns",children:e.jsx(E,{size:"xs",variant:"default",leftSection:e.jsx(pe,{size:12}),onClick:()=>W(!0),children:"Hooks"})}),e.jsx(F,{label:"Expand this tweet into a 5-post thread via AI · 3 credits",children:e.jsx(E,{size:"xs",variant:"default",leftSection:e.jsx(X,{size:12}),onClick:()=>G.mutate(),loading:G.isPending,disabled:!d.trim(),children:"Make it a thread"})})]})]}),e.jsx(_,{placeholder:"What's the hook?",value:d,onChange:t=>g(t.currentTarget.value),autosize:!0,minRows:4,maxRows:14}),e.jsxs(p,{justify:"space-between",align:"center",children:[e.jsx(Ee,{accountId:n,media:x,onChange:A,max:4}),e.jsxs(m,{size:"xs",c:V?"red":$>R*.9?"orange":"dimmed",children:[$," / ",R]})]})]})}),l==="thread"&&e.jsx(U,{withBorder:!0,children:e.jsxs(T,{gap:"xs",children:[e.jsxs(p,{justify:"space-between",children:[e.jsx(m,{size:"sm",fw:500,children:"Thread"}),e.jsxs(ne,{variant:"light",children:[f.filter(t=>(t.text||"").trim()).length," tweet",f.length===1?"":"s"]})]}),e.jsx(he,{value:f,onChange:z,onExtend:N.isPending?void 0:()=>N.mutateAsync(),charLimit:R})]})}),l==="quote"&&e.jsx(U,{withBorder:!0,children:e.jsxs(T,{gap:"xs",children:[e.jsxs(p,{justify:"space-between",align:"center",children:[e.jsx(m,{size:"sm",fw:500,children:"Quote tweet"}),e.jsx(Y,{kind:"quote-commentary",context:{sourceUrl:S},current:d,onResult:t=>g(t),disabled:!S.trim()})]}),e.jsx(D,{label:"Source tweet URL",placeholder:"https://x.com/handle/status/1234...",value:S,onChange:t=>M(t.currentTarget.value)}),e.jsx(_,{label:"Your commentary",placeholder:"Why does this matter? What's your take?",value:d,onChange:t=>g(t.currentTarget.value),autosize:!0,minRows:3,maxRows:10}),e.jsxs(m,{size:"xs",c:V?"red":"dimmed",ta:"right",children:[$," / ",R]})]})}),l==="repurpose"&&e.jsx(U,{withBorder:!0,children:e.jsxs(T,{gap:"xs",children:[e.jsx(m,{size:"sm",fw:500,children:"Repurpose a URL or pasted content into tweets"}),e.jsx(m,{size:"xs",c:"dimmed",children:"Paste a blog URL (we fetch + extract text), or paste raw text. AI extracts 5 distinct tweet-able takeaways in your brand voice."}),e.jsx(D,{label:"URL",placeholder:"https://your.blog/post",value:s,onChange:t=>o(t.currentTarget.value)}),e.jsx(_,{label:"Or paste text",placeholder:"Or paste the source content here (overrides URL fetch)…",value:j,onChange:t=>P(t.currentTarget.value),autosize:!0,minRows:3,maxRows:10}),e.jsx(p,{justify:"flex-end",children:e.jsx(F,{label:"Costs 3 credits per generation",withArrow:!0,children:e.jsx(E,{leftSection:e.jsx(X,{size:14}),onClick:()=>Q.mutate(),loading:Q.isPending,disabled:!s.trim()&&!j.trim(),children:"Generate tweets · 3 cr"})})})]})}),e.jsxs(U,{withBorder:!0,children:[e.jsxs(p,{justify:"space-between",wrap:"wrap",gap:"sm",children:[e.jsxs(p,{gap:"xs",children:[e.jsx(ve,{size:16}),e.jsx(D,{size:"xs",type:"datetime-local",placeholder:"Send now",value:u,onChange:t=>L(t.currentTarget.value),w:220}),u&&e.jsx(ce,{size:"xs",onClick:()=>L(""),children:"Clear (send now)"})]}),e.jsx(E,{leftSection:e.jsx(ke,{size:14}),onClick:()=>H.mutate(),loading:H.isPending,disabled:l==="repurpose",children:u?"Schedule":"Send now"})]}),l==="repurpose"&&e.jsxs(m,{size:"xs",c:"dimmed",mt:6,children:["Generate first, then switch to ",e.jsx("b",{children:"Thread"})," mode to review + ship."]})]}),e.jsx(me,{opened:C,onClose:()=>W(!1),onPick:t=>g(c=>
11c?`${c}
12
13${t}`:t)})]})}export{st 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.