PageSourceSearch

https://qlaris.ai/assets/NewsletterPage-BUhevX_H.js

js qlaris.ai collected 2026-10-05 12:31:09 UTC 53,621 bytes, 102 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CBhNmMHQ.js","assets/vendor-motion-CobWHBkE.js","assets/vendor-react-u5N9NFbL.js","assets/vendor-firebase-D0b49a6f.js","assets/index-CESF4-s1.css","assets/index.esm-TtW1iwgI.js"])))=>i.map(i=>d[i]);
2import{o as ie,_ as Me,q as mt}from"./index-CBhNmMHQ.js";import{j as e}from"./vendor-motion-CobWHBkE.js";import{r as i,R as yt}from"./vendor-react-u5N9NFbL.js";import jt from"./purify.es-DSHCW8nm.js";import{u as vt}from"./CRMContext-DWGhJuBI.js";import{s as Oe}from"./emailService-sZDGRAqZ.js";import{g as wt}from"./googleAuthService-CNLfDZaX.js";import"./vendor-firebase-D0b49a6f.js";const Ct=async()=>ie("/api/admin/newsletters"),_e=async b=>b.id?ie(`/api/admin/newsletters/${b.id}`,{method:"PUT",body:JSON.stringify(b)}):ie("/api/admin/newsletters",{method:"POST",body:JSON.stringify(b)}),kt=async b=>{await ie(`/api/admin/newsletters/${b}`,{method:"DELETE"})};let St=0;const le=()=>`block_${++St}_${Date.now()}`,Bt=[{type:"heading",label:"Heading",icon:"H"},{type:"text",label:"Text",icon:"T"},{type:"image",label:"Image",icon:"🖼"},{type:"button",label:"Button",icon:"▶"},{type:"divider",label:"Divider",icon:"—"},{type:"spacer",label:"Spacer",icon:"↕"}],F=b=>{const j={id:le(),type:b};switch(b){case"heading":return{...j,content:"Your headline here",align:"center"};case"text":return{...j,content:"",bgColor:"transparent"};case"image":return{...j,url:"",alt:"",caption:"",linkUrl:""};case"button":return{...j,label:"Learn more",url:"",color:"#00f3ff",align:"center"};case"divider":return{...j};case"spacer":return{...j,height:32};default:return j}},Ge=(b,j)=>{const R=h=>{switch(h.type){case"heading":return`<h2 style="font-family:'Outfit',Arial,Helvetica,sans-serif;font-size:28px;font-weight:700;color:#ffffff;margin:0 0 8px;text-align:${h.align||"center"};line-height:1.3;">${y(h.content)}</h2>`;case"text":{const A=h.bgColor&&h.bgColor!=="transparent"?`background:${h.bgColor};border-radius:8px;padding:20px 24px;`:"";return`<div style="font-family:'Inter',Arial,Helvetica,sans-serif;font-size:15px;line-height:1.7;${h.bgColor==="#00f3ff"?"color:#000000;":"color:#d4d4d8;"}${A}margin:0 0 4px;">${h.content||'<span style="opacity:0.4;">Write something...</span>'}</div>`}case"image":{if(!h.url)return"";let A=`<img src="${y(h.url)}" alt="${y(h.alt)}" style="max-width:100%;height:auto;border-radius:8px;display:block;" />`;h.linkUrl&&(A=`<a href="${y(h.linkUrl)}" target="_blank">${A}</a>`);let E=`<div style="text-align:center;margin:0 0 4px;">${A}`;return h.caption&&(E+=`<p style="font-family:'Inter',Arial,sans-serif;font-size:12px;color:#71717a;margin:8px 0 0;text-align:center;">${y(h.caption)}</p>`),E+="</div>",E}case"button":return`<div style="text-align:${h.align||"center"};margin:8px 0;"><a href="${y(h.url||"#")}" target="_blank" style="display:inline-block;padding:13px 32px;background:${h.color||"#00f3ff"};color:#000000;border-radius:8px;text-decoration:none;font-family:'Inter',Arial,sans-serif;font-size:15px;font-weight:600;letter-spacing:0.01em;">${y(h.label||"Button")}</a></div>`;case"divider":return'<hr style="border:none;border-top:1px solid #2a2a2a;margin:24px 0;" />';case"spacer":return`<div style="height:${h.height||32}px;"></div>`;default:return""}},y=h=>(h||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),ae=b.map(R).filter(Boolean).join(`
3`);return`<!DOCTYPE html>
4<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
5<head>
6<meta charset="utf-8" />
7<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8<meta http-equiv="X-UA-Compatible" content="IE=edge" />
9<meta name="color-scheme" content="light only" />
10<meta name="supported-color-schemes" content="light only" />
11<title>${y(j)}</title>
12<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700&family=Inter:wght@400;500;600&display=swap" rel="stylesheet" />
13<style>
14:root { color-scheme: light only; }
15body, table, td, div, p, h2, span, a { -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }
16u + .body { background: #0a0a1a !important; }
17</style>
18</head>
19<body class="body dark-bg" style="margin:0;padding:0;background-color:#0a0a1a;font-family:'Inter',Arial,Helvetica,sans-serif;" bgcolor="#0a0a1a">
20<table role="presentation" class="dark-bg" width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:#0a0a1a;" bgcolor="#0a0a1a">
21<tr><td align="center" style="padding:40px 16px;" bgcolor="#0a0a1a">
22<table role="presentation" width="600" cellpadding="0" cellspacing="0" border="0" style="max-width:600px;width:100%;">
23
24<!-- Header -->
25<tr><td style="padding:0 0 32px;text-align:center;" bgcolor="#0a0a1a">
26<img src="${window.location.origin}/qlaris_logo_new.png" alt="qlaris" style="height:32px;width:auto;" height="32" />
27</td></tr>
28
29<!-- Content -->
30<tr><td class="content-bg" style="background-color:#111118;border-radius:12px;padding:40px 36px;" bgcolor="#111118">
31${ae}
32</td></tr>
33
34<!-- Footer -->
35<tr><td style="padding:32px 0 0;text-align:center;" bgcolor="#0a0a1a">
36<p style="font-family:'Inter',Arial,sans-serif;font-size:11px;color:#52525b;margin:0 0 6px;">Sent via <span style="color:#00f3ff;">qlaris</span></p>
37<p style="font-family:'Inter',Arial,sans-serif;font-size:11px;color:#52525b;margin:0;">If you no longer wish to receive these emails, <a href="mailto:[email protected]?subject=Unsubscribe" style="color:#52525b;text-decoration:underline;">unsubscribe</a>.</p>
38</td></tr>
39
40</table>
41</td></tr>
42</table>
43</body>
44</html>`},Et=()=>{const{deals:b,fundraisingDeals:j,stages:R,fundraisingStages:y,people:ae,companies:h,getPersonById:A,getCompanyById:E}=vt(),[oe,je]=i.useState(null),[qe,Ve]=i.useState(!0),[ve,L]=i.useState("overview"),[de,Je]=i.useState([]),[Ye,we]=i.useState(!0),[B,J]=i.useState(null),[k,Ce]=i.useState(!1),[Y,ce]=i.useState(!0),[pe,ge]=i.useState(null),[he,ke]=i.useState(!1),[Ke,K]=i.useState(!1),[z,N]=i.useState(1),[v,Se]=i.useState("deals"),[W,H]=i.useState(new Set),[w,M]=i.useState(""),[S,T]=i.useState([F("heading"),F("text")]),[ue,U]=i.useState(null),[Be,Ie]=i.useState(null),xe=i.useRef({}),[O,Re]=i.useState(!1),[u,fe]=i.useState(null),P=i.useRef(!1),[_,Ae]=i.useState("[email protected]"),[be,Le]=i.useState(!1),[X,Q]=i.useState(null),[$,Z]=i.useState(""),[I,G]=i.useState([]),[ze,Ne]=i.useState(!1),[ee,Te]=i.useState(!1),[De,me]=i.useState(null),te=i.useRef(null);i.useEffect(()=>{wt().then(t=>je(t?.connected||!1)).catch(()=>je(!1)).finally(()=>Ve(!1))},[]),i.useEffect(()=>{oe?ne():we(!1)},[oe]);const ne=async()=>{try{const t=await Ct();Je(t)}catch(t){console.error("Failed to load newsletters:",t)}we(!1)};i.useEffect(()=>{if(!O)return;const t=s=>{s.preventDefault(),s.returnValue=""};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[O]),i.useEffect(()=>{const t="newsletter-block-styles";if(!document.getElementById(t)){const s=document.createElement("style");s.id=t,s.textContent=`
45                @keyframes deal-email-spin { to { transform: rotate(360deg); } }
46                .nl-block-text-editor { min-height: 60px; padding: 12px 14px; font-size: 14px; color: #fff; line-height: 1.7; outline: none; background: transparent; border: none; font-family: inherit; width: 100%; }
47                .nl-block-text-editor:empty::before { content: attr(data-placeholder); color: rgba(255,255,255,0.25); }
48                .nl-block-text-editor a { color: #00f3ff; }
49                .nl-block-text-editor ul, .nl-block-text-editor ol { padding-left: 20px; }
50                .nl-block-text-editor blockquote { border-left: 2px solid rgba(255,255,255,0.15); margin: 8px 0; padding-left: 12px; color: rgba(255,255,255,0.5); }
51                .fmt-btn { background: transparent; border: none; color: rgba(255,255,255,0.5); cursor: pointer; padding: 5px 8px; border-radius: 4px; display: flex; align-items: center; justify-content: center; transition: all 0.1s; font-size: 12px; }
52                .fmt-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
53                .nl-stage-cb:hover { background: rgba(255,255,255,0.06); }
54                .nl-block:hover .nl-block-actions { opacity: 1; }
55                .nl-add-btn:hover { background: rgba(0,243,255,0.12) !important; border-color: rgba(0,243,255,0.3) !important; color: #00f3ff !important; }
56                .nl-type-btn:hover { background: rgba(255,255,255,0.08) !important; }
57                .nl-overview-row:hover { background: rgba(255,255,255,0.04) !important; }
58            `,document.head.appendChild(s)}},[]);const q=i.useMemo(()=>{const t=new Map,s=(r,o,g)=>{for(const d of r){if(!W.has(d.stageId))continue;const l=o.find(a=>a.id===d.stageId);let x=d.personIds||[];x.length===0&&d.attendees?.length&&(x=d.attendees.map(a=>
58typeof a=="string"?a:a?.id||a?.personId).filter(Boolean));for(const a of x){const p=A(a);if(!p?.email)continue;const f=p.email.toLowerCase();if(t.has(f))continue;const ye=p.companyId?E(p.companyId):null;t.set(f,{email:p.email,name:p.name||"",position:p.position||"",companyName:ye?.name||d.companyName||"",dealName:d.title||d.name||"",stageName:l?.name||"",pipeline:g})}}};return(v==="deals"||v==="both")&&s(b,R,"Deals"),(v==="fundraising"||v==="both")&&s(j,y,"Fundraising"),Array.from(t.values())},[v,W,b,j,R,y,ae,h,A,E]),Xe=i.useMemo(()=>{if(!k||!Y||!B?.sentEmails?.length)return q;const t=new Set(B.sentEmails.map(s=>s.toLowerCase()));return q.filter(s=>!t.has(s.email.toLowerCase()))},[q,k,Y,B]),m=k?Xe:q;i.useMemo(()=>v==="deals"?R.map(t=>({...t,pipeline:"deals"})):v==="fundraising"?y.map(t=>({...t,pipeline:"fundraising"})):[...R.map(t=>({...t,pipeline:"deals"})),...y.map(t=>({...t,pipeline:"fundraising"}))],[v,R,y]);const Ee=t=>{H(s=>{const r=new Set(s);return r.has(t)?r.delete(t):r.add(t),r})},We=t=>{H(s=>{const r=new Set(s);return t.forEach(o=>r.add(o.id)),r})},Ue=t=>{H(s=>{const r=new Set(s);return t.forEach(o=>r.delete(o.id)),r})},$e=i.useMemo(()=>{const t={};return b.forEach(s=>{t[s.stageId]=(t[s.stageId]||0)+1}),j.forEach(s=>{t[s.stageId]=(t[s.stageId]||0)+1}),t},[b,j]),C=i.useCallback((t,s)=>{T(r=>r.map(o=>o.id===t?{...o,...s}:o))},[]),Fe=i.useCallback((t,s)=>{T(r=>{const o=r.findIndex(l=>l.id===t);if(o<0)return r;const g=o+s;if(g<0||g>=r.length)return r;const d=[...r];return[d[o],d[g]]=[d[g],d[o]],d})},[]),Qe=i.useCallback(t=>{T(s=>s.filter(r=>r.id!==t)),ue===t&&U(null)},[ue]),Ze=i.useCallback((t,s)=>{const r=F(t);T(o=>{const g=[...o],d=s==="end"||s>=o.length?o.length:s+1;return g.splice(d,0,r),g}),Ie(null),U(r.id)},[]),D=(t,s=null)=>{document.execCommand(t,!1,s)},et=()=>{const t=prompt("Enter URL:");t&&D("createLink",t)},tt=i.useCallback(t=>{const s=xe.current[t];s&&C(t,{content:s.innerHTML})},[C]),se=i.useCallback(()=>{S.forEach(t=>{if(t.type==="text"){const s=xe.current[t.id];s&&(t.content=s.innerHTML)}})},[S]),Pe=i.useCallback(()=>(se(),Ge(S,w)),[S,w,se]),nt=async()=>{if(!(!_.trim()||!w.trim())){Le(!0),Q(null);try{const t=Pe();await Oe({to:_.trim(),subject:`[TEST] ${w}`,body:t}),Q({success:!0})}catch(t){Q({success:!1,error:t.message})}Le(!1)}},st=async()=>{if(m.length===0||!w.trim())return;const t=Pe();if(!t.trim())return;Re(!0),P.current=!1;const s={total:m.length,sent:0,success:0,failed:0,errors:[]};fe({...s});for(const r of m){if(P.current)break;let o=0,g=!1;for(;o<3&&!g;)try{await Oe({to:r.email,subject:w,body:t}),s.success++,g=!0}catch(d){d.message?.includes("429")||d.message?.includes("rate")?(o++,await new Promise(l=>setTimeout(l,2e3*Math.pow(2,o)))):(s.failed++,s.errors.push({email:r.email,name:r.name,error:d.message}),g=!0)}g||(s.failed++,s.errors.push({email:r.email,name:r.name,error:"Rate limited"})),s.sent++,fe({...s}),!P.current&&s.sent<s.total&&await new Promise(d=>setTimeout(d,1500))}Re(!1);try{const r=m.slice(0,s.sent),o=new Set(s.errors.map(l=>l.email.toLowerCase())),g=r.map(l=>l.email.toLowerCase()).filter(l=>!o.has(l)),d=k&&B?.sentEmails?[...new Set([...B.sentEmails,...g])]:g;await _e({id:k?void 0:pe||void 0,status:s.failed>0||P.current?"partial":"sent",subject:w,blocks:S,draftText:$,uploadedImages:I,htmlSnapshot:t,pipeline:v,selectedStageIds:Array.from(W),recipientCount:m.length,sentEmails:d,successCount:s.success,failedCount:s.failed,errors:s.errors,sentAt:new Date().toISOString()}),await ne()}catch(r){console.error("Failed to save newsletter record:",r)}},rt=()=>{P.current=!0},re=()=>{N(1),M(""),T([F("heading"),F("text")]),U(null),fe(null),Q(null),Ae("[email protected]"),Z(""),G([]),me(null),Se("deals"),H(new Set),ge(null),Ce(!1),ce(!0),J(null),K(!1)},lt=()=>{re(),L("editor")},it=t=>{re(),M(t.subject||""),T(t.blocks?.length?t.blocks.map(s=>({...s,id:s.id||le()})):[F("heading"),F("text")]),Z(t.draftText||""),G(t.uploadedImages||[]),ge(t.id),N(t.blocks?.length>2||t.subject?2:1),L("editor")},at=t=>{re(),M(t.subject||""),T(t.blocks?.length?t.blocks.map(s=>({...s,id:s.id||le()})):[]),Z(t.draftText||""),G(t.uploadedImages||[]),J(t),Ce(!0),ce(!0),N(3),L("editor")},ot=async()=>{se(),ke(!0),K(!1);try{const t=await _e({id:pe||void 0,status:"draft",subject:w,blocks:S,draftText:$,uploadedImages:I});ge(t.id),K(!0),await ne(),setTimeout(()=>K(!1),3e3)}catch(t){console.error("Failed to save draft:",t)}ke(!1)},dt=async t=>{const s=Array.from(t.target.files||[]);if(s.length!==0){Ne(!0);for(const r of s)try{const o=new window.FormData;o.append("image",r);const{auth:g}=await Me(async()=>{const{auth:p}=await import("./index-CBhNmMHQ.js").then(f=>f.s);return{auth:p}},__vite__mapDeps([0,1,2,3,4])),d={},l=g.currentUser;l&&!l.isAnonymous&&(d.Authorization=`Bearer ${await l.getIdToken()}`);const x=await fetch("/api/uploads",{method:"POST",body:o,headers:d});if(!x.ok)throw new Error("Upload failed");const a=await x.json();G(p=>[...p,{url:a.url,filename:a.filename}])}catch(o){console.error("Upload error:",o)}Ne(!1),te.current&&(te.current.value="")}},ct=t=>{G(s=>s.filter(r=>r.filename!==t))},pt=async()=>
58{if(!(!$.trim()&&I.length===0)){Te(!0),me(null);try{const t=await mt();if(!t)throw new Error("AI not available");const{getGenerativeModel:s}=await Me(async()=>{const{getGenerativeModel:V}=await import("./index.esm-TtW1iwgI.js");return{getGenerativeModel:V}},__vite__mapDeps([5,3])),r=s(t,{model:"gemini-2.5-pro",systemInstruction:`You are a newsletter content designer for qlaris, a professional AI-native market research platform.
59Given draft text/key points and available image URLs, generate a structured newsletter as a JSON object with a subject line and content blocks.
60
61Output format:
62{
63  "subject": "email subject line",
64  "blocks": [ ...array of content blocks... ]
65}
66
67Subject line rules (optimize for open rates):
68- 6-10 words max, concise and specific
69- Create curiosity or urgency without being clickbait
70- Use numbers, questions, or "how to" when fitting
71- Avoid ALL CAPS, excessive punctuation, or spam trigger words
72- Personalize when possible — reference the topic directly
73- No company name in subject (it's already in the sender)
74
75Block types available:
76- heading: { type: "heading", content: "text", align: "center"|"left"|"right" }
77- text: { type: "text", content: "HTML text — you may use <b>, <em>, <a href>, <ul>, <li>, <br>", bgColor: "transparent"|"#1a1a2e"|"#00f3ff" }
78- image: { type: "image", url: "image URL", alt: "description", caption: "optional caption" }
79- button: { type: "button", label: "button text", url: "link URL", color: "#00f3ff", align: "center" }
80- divider: { type: "divider" }
81- spacer: { type: "spacer", height: 32 }
82
83Content rules:
84- Start with a compelling heading
85- Use the provided images where they fit naturally in the flow
86- Keep text concise, scannable, and professional
87- Use text blocks with bgColor "#1a1a2e" for highlighted sections
88- Include a CTA button if the draft suggests a call to action
89- Use dividers and spacers for visual separation between sections
90- Output ONLY valid JSON, no markdown fences, no explanation`}),o=I.length>0?`
91
92Available images (use these exact URLs in image blocks):
93${I.map((V,c)=>`${c+1}. ${V.url}`).join(`
94`)}`:"",g=`Create a professional newsletter from these key points/draft:
95
96${$}${o}`;let x=(await r.generateContent(g)).response.text().trim();x.startsWith("```")&&(x=x.replace(/^```(?:json)?\n?/,"").replace(/\n?```$/,""));const a=JSON.parse(x);let p,f;if(Array.isArray(a))p=a;else if(a.blocks&&Array.isArray(a.blocks))p=a.blocks,f=a.subject;else throw new Error("Invalid response format");if(p.length===0)throw new Error("No blocks generated");const ye=p.map(V=>{const c={...V,id:le()};return c.type==="heading"?(c.content=c.content||"",c.align=c.align||"center"):c.type==="text"?(c.content=c.content||"",c.bgColor=c.bgColor||"transparent"):c.type==="image"?(c.url=c.url||"",c.alt=c.alt||"",c.caption=c.caption||"",c.linkUrl=c.linkUrl||""):c.type==="button"?(c.label=c.label||"Learn more",c.url=c.url||"",c.color=c.color||"#00f3ff",c.align=c.align||"center"):c.type==="spacer"&&(c.height=c.height||32),c});T(ye),f&&M(f),N(2)}catch(t){console.error("Generation error:",t),me(t.message||"Failed to generate newsletter")}Te(!1)}};if(qe)return e.jsx("div",{style:n.page,children:e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:80},children:e.jsx("div",{style:n.spinner})})});if(oe===!1)return e.jsxs("div",{style:n.page,children:[e.jsx("div",{style:n.header,children:e.jsx("h1",{style:n.title,children:"Newsletter"})}),e.jsxs("div",{style:n.emptyBox,children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"rgba(255,255,255,0.3)",strokeWidth:"1.5",style:{marginBottom:16},children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),e.jsx("p",{style:{color:"rgba(255,255,255,0.6)",fontSize:15,margin:"0 0 6px"},children:"Connect your Google account to send newsletters."}),e.jsx("p",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,margin:0},children:"Go to Settings to connect."})]})]});const gt=()=>{const t=de.filter(r=>r.status==="draft"),s=de.filter(r=>r.status!=="draft");return e.jsxs("div",{style:n.page,children:[e.jsxs("div",{style:{...n.header,display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[e.jsxs("div",{children:[e.jsx("h1",{style:n.title,children:"Newsletter"}),e.jsx("p",{style:n.subtitle,children:"Create, send, and track email newsletters."})]}),e.jsx("button",{style:n.primaryBtn,onClick:lt,children:"+ New Newsletter"})]}),Ye?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:60},children:e.jsx("div",{style:n.spinner})}):de.length===0?e.jsxs("div",{style:n.emptyBox,children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"rgba(255,255,255,0.3)",strokeWidth:"1.5",style:{marginBottom:16},children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),e.jsx("p",{style:{color:"rgba(255,255,255,0.5)",fontSize:14,margin:0},children:"No newsletters yet. Create your first one."})]}):e.jsxs(e.Fragment,{children:[t.length>0&&e.jsxs("div",{style:{marginBottom:32},children:[e.jsx("div",{style:{...n.sectionLabel,marginBottom:12},children:"Drafts"}),e.jsx("div",{style:n.recipientTable,children:t.map(r=>e.jsxs("div",{className:"nl-overview-row",style:{...n.tableRow,cursor:"pointer",alignItems:"center"},onClick:()=>it(r),children:[e.jsx("span",{style:{...n.tableCell,flex:3,color:"#fff",fontWeight:500},children:r.subject||"Untitled draft"}),e.jsx("span",{style:{...n.tableCell,flex:1},children:e.jsx("span",{style:n.badgeDraft,children:"Draft"})}),e.jsx("span",{style:{...n.tableCell,flex:2},children:r.updatedAt?new Date(r.updatedAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}),e.jsx("span",{style:{...n.tableCell,flex:.5,textAlign:"right"},children:e.jsx("button",{style:{...n.linkBtn,color:"#ef4444"},onClick:o=>{o.stopPropagation(),window.confirm("Delete this draft?")&&kt(r.id).then(ne)},children:"Delete"})})]},r.id))})]}),s.length>0&&e.jsxs("div",{children:[e.jsx("div",{style:{...n.sectionLabel,marginBottom:12},children:"Sent"}),e.jsxs("div",{style:n.recipientTable,children:[e.jsxs("div",{style:n.tableHeader,children:[e.jsx("span",{style:{...n.tableCell,flex:3},children:"Subject"}),e.jsx("span",{style:{...n.tableCell,flex:1},children:"Status"}),e.jsx("span",{style:{...n.tableCell,flex:2},children:"Sent"}),e.jsx("span",{style:{...n.tableCell,flex:1},children:"Recipients"})]}),s.map(r=>e.jsxs("div",{className:"nl-overview-row",style:{...n.tableRow,cursor:"pointer",alignItems:"center"},onClick:()=>{J(r),L("detail")},children:[e.jsx("span",{style:{...n.tableCell,flex:3,color:"#fff",fontWeight:500},children:r.subject||"Untitled"}),e.jsx("span",{style:{...n.tableCell,flex:1},children:r.status==="sent"?e.jsx("span",{style:n.badgeSent,children:"Sent"}):e.jsx("span",{style:n.badgePartial,children:"Partial"})}),e.jsx("span",{style:{...n.tableCell,flex:2},children:r.sentAt?new Date(r.sentAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}),e.jsx("span",{style:{...n.tableCell,flex:1},children:r.successCount??r.recipientCount??"—"})]},r.id))]})]})]})]})},ht=()=>{const t=B;if(!t)return null;const s=t.htmlSnapshot||(t.blocks?.length?Ge(t.blocks,t.subject||""):null);return e.jsxs("div",{style:n.page,children:[e.jsxs("div",{style:{marginBottom:24},children:[e.jsx("button",{style:{...n.linkBtn,fontSize:13,marginBottom:16},onClick:()=>{J(null),L("overview")},children:"← All Newsletters"}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[e.jsxs("div",{children:[e.jsx("h1",{style:{...n.title,marginBottom:8},children:t.subject||"Untitled"}),e.jsxs("div",{style:{display:"flex",gap:16,flexWrap:"wrap",fontSize:13,color:"rgba(255,255,255,0.5)"},children:[t.sentAt&&e.jsxs("span",{children:["Sent ",new Date(t.sentAt).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})]}),t.successCount!=null&&e.jsxs("span",{style:{color:"#10b981"},children:[t.successCount," delivered"]}),t.failedCount>0&&e.jsxs("span",{style:{color:"#ef4444"},children:[t.failedCount," failed"]}),t.status==="sent"?e.jsx("span",{style:n.badgeSent,children:"Sent"}):e.jsx("span",{style:n.badgePartial,children:"Partial"})]})]}),e.jsx("button",{style:n.primaryBtn,onClick:()=>at(t),children:"Resend to another audience"})]})]}),e.jsxs("div",{style:{marginBottom:32},children:[e.jsx("div",{style:{...n.sectionLabel,marginBottom:12},children:"Preview"}),s?e.jsx("div",{style:{background:"#0a0a1a",border:"1px solid rgba(255,255,255,0.08)",borderRadius:12,overflow:"hidden"},children:e.jsx("iframe",{srcDoc:s,title:"Newsletter preview",style:{width:"100%",height:600,border:"none",background:"#0a0a1a"},sandbox:"allow-same-origin"})}):e.jsx("div",{style:{padding:40,textAlign:"center",color:"rgba(255,255,255,0.4)",fontSize:13},children:"No preview available."})]}),t.sentEmails?.length>0&&e.jsxs("div",{children:[e.jsxs("div",{style:{...n.sectionLabel,marginBottom:12},children:["Recipients",e.jsx("span",{style:n.recipientCount,children:t.sentEmails.length})]}),e.jsx("div",{style:n.recipientTable,children:t.sentEmails.map((r,o)=>e.jsx("div",{style:n.tableRow,children:e.jsx("span",{style:{...n.tableCell,flex:1,color:"rgba(255,255,255,0.7)"},children:r})},o))})]}),t.errors?.length>0&&e.jsxs("div",{style:{marginTop:24},children:[e.jsx("div",{style:{...n.sectionLabel,marginBottom:12,color:"#ef4444"},children:"Failed"}),e.jsx("div",{style:n.errorList,children:t.errors.map((r,o)=>e.jsxs("div",{style:n.errorRow,children:[e.jsx("span",{children:r.name||r.email}),e.jsx("span",{style:{color:"rgba(255,255,255,0.35)"},children:r.error})]},o))})]})]})},ut=()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:n.section,children:[e.jsx("label",{style:n.sectionLabel,children:"Images"}),e.jsxs("div",{style:n.uploadArea,children:[I.length>0&&e.jsx("div",{style:n.imageGrid,children:I.map(t=>e.jsxs("div",{style:n.imageThumb,children:[e.jsx("img",{src:t.url,alt:"",style:{width:"100%",height:80,objectFit:"cover",borderRadius:6}}),e.jsx("button",{style:n.imageRemoveBtn,onClick:()=>ct(t.filename),title:"Remove",children:"×"})]},t.filename))}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e.jsx("button",{style:n.secondaryBtn,onClick:()=>te.current?.click(),disabled:ze,children:ze?e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{...n.spinner,width:14,height:14,borderWidth:1.5}}),"Uploading..."]}):e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"}),e.jsx("polyline",{points:"17 8 12 3 7 8"}),e.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),"Upload images"]})}),e.jsx("span",{style:{fontSize:12,color:"rgba(255,255,255,0.3)"},children:"PNG, JPG, GIF — max 5 MB each"})]}),e.jsx("input",{ref:te,type:"file",accept:"image/*",multiple:!0,onChange:dt,style:{display:"none"}})]})]}),e.jsxs("div",{style:n.section,children:[e.jsx("label",{style:n.sectionLabel,children:"Draft / Key Points"}),e.jsx("textarea",{value:$,onChange:t=>Z(t.target.value),placeholder:`Write your key points, bullet points, or rough draft here...
97
98Example:
99- New feature launch: AI-powered survey analysis
100- Customer success story with Acme Corp
101- Upcoming webinar on March 25
102- CTA: Book a demo`,style:n.draftTextarea})]}),De&&e.jsx("div",{style:{padding:"10px 14px",borderRadius:6,background:"rgba(239,68,68,0.08)",border:"1px solid rgba(239,68,68,0.2)",color:"#ef4444",fontSize:13,marginBottom:16},children:De}),e.jsxs("div",{style:n.stepActions,children:[e.jsx("button",{style:n.secondaryBtn,onClick:()=>L("overview"),children:"Cancel"}),e.jsx("button",{style:{...n.secondaryBtn,marginLeft:"auto"},onClick:()=>
102N(2),children:"Skip — compose manually"}),e.jsxs("button",{style:{...n.primaryBtn,opacity:!$.trim()&&I.length===0||ee?.5:1,display:"flex",alignItems:"center",gap:8},disabled:!$.trim()&&I.length===0||ee,onClick:pt,children:[ee&&e.jsx("span",{style:{...n.spinner,width:14,height:14,borderWidth:1.5}}),ee?"Generating...":"Generate newsletter"]})]})]}),xt=(t,s)=>{const r=ue===t.id,o=s===0,g=s===S.length-1,d={position:"relative",border:r?"1px solid rgba(0,243,255,0.3)":"1px solid rgba(255,255,255,0.06)",borderRadius:8,background:r?"rgba(0,243,255,0.03)":"rgba(255,255,255,0.02)",transition:"all 0.15s"},l=r?e.jsxs("div",{style:n.blockToolbar,children:[e.jsx("span",{style:n.blockTypeLabel,children:t.type}),e.jsxs("div",{style:{marginLeft:"auto",display:"flex",gap:2},children:[e.jsx("button",{className:"fmt-btn",onClick:()=>Fe(t.id,-1),disabled:o,style:o?{opacity:.3}:{},children:"↑"}),e.jsx("button",{className:"fmt-btn",onClick:()=>Fe(t.id,1),disabled:g,style:g?{opacity:.3}:{},children:"↓"}),e.jsx("div",{style:n.fmtDivider}),e.jsx("button",{className:"fmt-btn",style:{color:"#ef4444"},onClick:()=>Qe(t.id),children:e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6l-2 14a2 2 0 01-2 2H9a2 2 0 01-2-2L5 6"}),e.jsx("path",{d:"M10 11v6"}),e.jsx("path",{d:"M14 11v6"})]})})]})]}):null;let x;switch(t.type){case"heading":x=e.jsxs("div",{style:{padding:16},children:[r&&e.jsx("div",{style:{display:"flex",gap:4,marginBottom:8},children:["left","center","right"].map(a=>e.jsx("button",{className:"fmt-btn",style:t.align===a?{background:"rgba(0,243,255,0.12)",color:"#00f3ff"}:{},onClick:()=>C(t.id,{align:a}),children:a==="left"?"⫷":a==="center"?"⫸⫷":"⫸"},a))}),e.jsx("input",{style:{...n.blockInput,fontSize:22,fontWeight:700,fontFamily:"'Outfit', sans-serif",textAlign:t.align||"center",background:"transparent",border:"none",padding:0},value:t.content,onChange:a=>C(t.id,{content:a.target.value}),placeholder:"Headline...",onClick:()=>U(t.id)})]});break;case"text":{const a=[{value:"transparent",label:"None"},{value:"#1a1a2e",label:"Dark"},{value:"#00f3ff",label:"Cyan"}],p=t.bgColor&&t.bgColor!=="transparent"?{background:t.bgColor,padding:"12px 16px",borderRadius:6}:{};x=e.jsxs("div",{style:{padding:0},children:[r&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2,padding:"4px 8px",borderBottom:"1px solid rgba(255,255,255,0.06)"},children:[e.jsx("button",{className:"fmt-btn",onClick:()=>D("bold"),title:"Bold",children:e.jsx("b",{children:"B"})}),e.jsx("button",{className:"fmt-btn",onClick:()=>D("italic"),title:"Italic",children:e.jsx("i",{children:"I"})}),e.jsx("button",{className:"fmt-btn",onClick:()=>D("underline"),title:"Underline",children:e.jsx("u",{children:"U"})}),e.jsx("button",{className:"fmt-btn",onClick:()=>D("strikethrough"),title:"Strikethrough",children:e.jsx("s",{children:"S"})}),e.jsx("div",{style:n.fmtDivider}),e.jsx("button",{className:"fmt-btn",onClick:()=>D("insertUnorderedList"),title:"Bullet list",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),e.jsx("circle",{cx:"4",cy:"6",r:"1",fill:"currentColor"}),e.jsx("circle",{cx:"4",cy:"12",r:"1",fill:"currentColor"}),e.jsx("circle",{cx:"4",cy:"18",r:"1",fill:"currentColor"})]})}),e.jsx("button",{className:"fmt-btn",onClick:()=>D("insertOrderedList"),title:"Numbered list",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"10",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"10",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"10",y1:"18",x2:"21",y2:"18"}),e.jsx("text",{x:"2",y:"8",fontSize:"8",fill:"currentColor",fontFamily:"monospace",children:"1"}),e.jsx("text",{x:"2",y:"14",fontSize:"8",fill:"currentColor",fontFamily:"monospace",children:"2"}
102),e.jsx("text",{x:"2",y:"20",fontSize:"8",fill:"currentColor",fontFamily:"monospace",children:"3"})]})}),e.jsx("button",{className:"fmt-btn",onClick:et,title:"Insert link",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71"}),e.jsx("path",{d:"M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71"})]})}),e.jsx("button",{className:"fmt-btn",onClick:()=>D("formatBlock","blockquote"),title:"Blockquote",children:'"'}),e.jsx("div",{style:n.fmtDivider}),a.map(f=>e.jsx("button",{className:"fmt-btn",style:{width:18,height:18,borderRadius:4,padding:0,background:f.value==="transparent"?"rgba(255,255,255,0.06)":f.value,border:t.bgColor===f.value?"2px solid #fff":"2px solid transparent"},onClick:()=>C(t.id,{bgColor:f.value}),title:`Background: ${f.label}`},f.value))]}),e.jsx("div",{style:p,children:e.jsx("div",{ref:f=>{xe.current[t.id]=f},className:"nl-block-text-editor",contentEditable:!0,"data-placeholder":"Write something...",onBlur:()=>tt(t.id),dangerouslySetInnerHTML:{__html:jt.sanitize(t.content)},suppressContentEditableWarning:!0})})]});break}case"image":x=e.jsxs("div",{style:{padding:16,textAlign:"center"},children:[t.url?e.jsx("img",{src:t.url,alt:t.alt,style:{maxWidth:"100%",borderRadius:8,marginBottom:8}}):e.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.3)",fontSize:13},children:"No image URL set"}),r&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,marginTop:8,textAlign:"left"},children:[e.jsx("input",{style:n.blockInput,value:t.url,onChange:a=>C(t.id,{url:a.target.value}),placeholder:"Image URL"}),e.jsx("input",{style:n.blockInput,value:t.alt,onChange:a=>C(t.id,{alt:a.target.value}),placeholder:"Alt text"}),e.jsx("input",{style:n.blockInput,value:t.caption,onChange:a=>C(t.id,{caption:a.target.value}),placeholder:"Caption (optional)"}),e.jsx("input",{style:n.blockInput,value:t.linkUrl,onChange:a=>C(t.id,{linkUrl:a.target.value}),placeholder:"Link URL (optional)"})]})]});break;case"button":{const a=["#00f3ff","#7c5cfc","#ff6b6b","#51cf66","#ffd43b","#ff922b"];x=e.jsxs("div",{style:{padding:16},children:[e.jsx("div",{style:{textAlign:t.align||"center",marginBottom:r?12:0},children:e.jsx("span",{style:{display:"inline-block",padding:"12px 28px",background:t.color||"#00f3ff",color:"#000",borderRadius:8,fontWeight:600,fontSize:14},children:t.label||"Button"})}),r&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[e.jsx("input",{style:n.blockInput,value:t.label,onChange:p=>C(t.id,{label:p.target.value}),placeholder:"Button label"}),e.jsx("input",{style:n.blockInput,value:t.url,onChange:p=>C(t.id,{url:p.target.value}),placeholder:"Button URL"}),e.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[e.jsx("span",{style:{fontSize:12,color:"rgba(255,255,255,0.4)",marginRight:4},children:"Color:"}),a.map(p=>e.jsx("button",{style:{width:20,height:20,borderRadius:4,background:p,border:t.color===p?"2px solid #fff":"2px solid transparent",cursor:"pointer",padding:0},onClick:()=>C(t.id,{color:p})},p)),e.jsx("div",{style:n.fmtDivider}),["left","center","right"].map(p=>e.jsx("button",{className:"fmt-btn",style:t.align===p?{background:"rgba(0,243,255,0.12)",color:"#00f3ff"}:{},onClick:()=>C(t.id,{align:p}),children:p==="left"?"⫷":p==="center"?"⫸⫷":"⫸"},p))]})]})]});break}case"divider":x=e.jsx("div",{style:{padding:"12px 16px"},children:e.jsx("hr",{style:{border:"none",borderTop:"1px solid rgba(255,255,255,0.15)",margin:0}})});break;case"spacer":x=e.jsxs("div",{style:{padding:"8px 16px"},children:[e.jsx("div",{style:{height:t.height||32,background:"rgba(255,255,255,0.02)",borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("span",{style:{fontSize:11,color:"rgba(255,255,255,0.2)"},children:[t.height||32,"px"]})}),r&&e.jsxs("div",{style:{marginTop:8,display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:12,color:"rgba(255,255,255,0.4)"},children:"Height:"}),e.jsx("input",{type:"range",min:"8",max:"80",value:t.height||32,onChange:a=>C(t.id,{height:parseInt(a.target.value)}),style:{flex:1}}),e.jsx("span",{style:{fontSize:12,color:"rgba(255,255,255,0.5)",width:30,textAlign:"right"},children:t.height||32})]})]});break;default:x=e.jsx("div",{style:{padding:16,color:"rgba(255,255,255,0.3)"},children:"Unknown block type"})}return e.jsx("div",{className:"nl-block",children:e.jsxs("div",{style:d,onClick:a=>{a.target===a.currentTarget?U(r?null:t.id):r||U(t.id)},children:[l,x]})},t.id)},He=t=>e.jsxs("div",{style:{display:"flex",justifyContent:"center",padding:"4px 0",position:"relative"},children:[e.jsx("button",{className:"nl-add-btn",style:n.addBlockBtn,onClick:()=>Ie(Be===t?null:t),title:"Add block",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),Be===t&&e.jsx("div",{style:n.typePicker,children:Bt.map(s=>e.jsxs("button",{className:"nl-type-btn",style:n.typeBtn,onClick:r=>{r.stopPropagation(),Ze(s.type,t)},children:[e.jsx("span",{style:n.typeIcon,children:s.icon}),e.jsx("span",{children:s.label})]},s.type))})]}),ft=()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:n.section,children:[e.jsx("label",{style:n.sectionLabel,children:"Subject"}),e.jsx("input",{style:n.subjectInput,value:w,onChange:t=>M(t.target.value),placeholder:"Enter email subject..."})]}),e.jsxs("div",{style:n.section,children:[e.jsx("label",{style:n.sectionLabel,children:"Content"}),e.jsx("div",{style:n.editorContainer,children:e.jsxs("div",{style:n.previewFrame,children:[e.jsx("div",{style:n.previewHeader,children:e.jsx("img",{src:"/qlaris_logo_new.svg",alt:"qlaris",style:{height:24}})}),e.jsxs("div",{style:{padding:"8px 0",display:"flex",flexDirection:"column",gap:4},onClick:t=>{t.target===t.currentTarget&&U(null)},children:[S.map((t,s)=>e.jsxs(yt.Fragment,{children:[He(s-1),xt(t,s)]},t.id)),He(S.length-1)]}),e.jsx("div",{style:n.previewFooter,children:e.jsxs("span",{style:{fontSize:11,color:"rgba(255,255,255,0.2)"},children:["Sent via ",e.jsx("span",{style:{color:"rgba(0,243,255,0.4)"},children:"qlaris"})]})})]})})]}),e.jsxs("div",{style:n.section,children:[e.jsx("label",{style:n.sectionLabel,children:"Send test email"}),e.jsxs("div",{style:{display:"flex",gap:8}
102,children:[e.jsx("input",{value:_,onChange:t=>Ae(t.target.value),placeholder:"[email protected]",style:{...n.blockInput,flex:1}}),e.jsxs("button",{style:{...n.secondaryBtn,opacity:!_.trim()||!w.trim()||be?.5:1,whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:6},disabled:!_.trim()||!w.trim()||be,onClick:nt,children:[be&&e.jsx("div",{style:{...n.spinner,width:14,height:14,borderWidth:1.5}}),"Send test"]})]}),X&&e.jsx("div",{style:{marginTop:8,padding:"8px 12px",borderRadius:6,fontSize:13,...X.success?{background:"rgba(16,185,129,0.08)",border:"1px solid rgba(16,185,129,0.2)",color:"#10b981"}:{background:"rgba(239,68,68,0.08)",border:"1px solid rgba(239,68,68,0.2)",color:"#ef4444"}},children:X.success?"Test email sent successfully!":`Failed: ${X.error}`})]}),e.jsxs("div",{style:n.stepActions,children:[e.jsx("button",{style:n.secondaryBtn,onClick:()=>N(1),children:"← Back"}),e.jsxs("button",{style:{...n.secondaryBtn,display:"flex",alignItems:"center",gap:6,opacity:he?.5:1},onClick:ot,disabled:he,children:[he&&e.jsx("div",{style:{...n.spinner,width:14,height:14,borderWidth:1.5}}),Ke?"Saved!":"Save as Draft"]}),e.jsx("button",{style:{...n.primaryBtn,opacity:w.trim()?1:.4},disabled:!w.trim(),onClick:()=>{se(),N(3)},children:"Select Audience →"})]})]}),bt=()=>{const t=R.map(l=>({...l,pipeline:"deals"})),s=y.map(l=>({...l,pipeline:"fundraising"}
102)),r=v==="deals"||v==="both",o=v==="fundraising"||v==="both",g=u&&u.sent>=u.total,d=u&&P.current&&u.sent<u.total;return e.jsxs(e.Fragment,{children:[!O&&!g&&!d&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:n.section,children:[e.jsx("label",{style:n.sectionLabel,children:"Pipeline"}),e.jsx("div",{style:n.pillGroup,children:[{id:"deals",label:"Deals"},{id:"fundraising",label:"Fundraising"},{id:"both",label:"Both"}].map(l=>e.jsx("button",{style:{...n.pill,...v===l.id?n.pillActive:{}},onClick:()=>{Se(l.id),H(new Set)},children:l.label},l.id))})]}),r&&e.jsxs("div",{style:n.section,children:[e.jsxs("div",{style:n.sectionHeader,children:[e.jsx("label",{style:n.sectionLabel,children:"Deal Stages"}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{style:n.linkBtn,onClick:()=>We(t),children:"Select all"}),e.jsx("button",{style:n.linkBtn,onClick:()=>Ue(t),children:"Clear"})]})]}),e.jsx("div",{style:n.stageGrid,children:t.map(l=>e.jsxs("label",{className:"nl-stage-cb",style:{...n.stageItem,...W.has(l.id)?n.stageItemSelected:{}},children:[e.jsx("input",{type:"checkbox",checked:W.has(l.id),onChange:()=>Ee(l.id),style:{display:"none"}}),e.jsx("span",{style:{...n.stageDot,background:l.color}}),e.jsx("span",{style:n.stageName,children:l.name}),e.jsx("span",{style:n.stageCount,children:$e[l.id]||0})]},l.id))})]}),o&&e.jsxs("div",{style:n.section,children:[e.jsxs("div",{style:n.sectionHeader,children:[e.jsx("label",{style:n.sectionLabel,children:"Fundraising Stages"}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{style:n.linkBtn,onClick:()=>We(s),children:"Select all"}),e.jsx("button",{style:n.linkBtn,onClick:()=>Ue(s),children:"Clear"})]})]}),e.jsx("div",{style:n.stageGrid,children:s.map(l=>e.jsxs("label",{className:"nl-stage-cb",style:{...n.stageItem,...W.has(l.id)?n.stageItemSelected:{}},children:[e.jsx("input",{type:"checkbox",checked:W.has(l.id),onChange:()=>Ee(l.id),style:{display:"none"}}),e.jsx("span",{style:{...n.stageDot,background:l.color}}),e.jsx("span",{style:n.stageName,children:l.name}),e.jsx("span",{style:n.stageCount,children:$e[l.id]||0})]},l.id))})]}),k&&B?.sentEmails?.length>0&&e.jsx("div",{style:n.section,children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer",fontSize:13,color:"rgba(255,255,255,0.7)"},children:[e.jsx("input",{type:"checkbox",checked:Y,onChange:l=>ce(l.target.checked),style:{accentColor:"#00f3ff"}}),"Filter out ",B.sentEmails.length," already-sent email",B.sentEmails.length!==1?"s":""," (prevent duplicate sends)"]})}),e.jsxs("div",{style:n.section,children:[e.jsx("div",{style:n.sectionHeader,children:e.jsxs("label",{style:n.sectionLabel,children:["Recipients",e.jsx("span",{style:n.recipientCount,children:m.length})]})}),m.length===0?e.jsx("div",{style:{padding:24,textAlign:"center",color:"rgba(255,255,255,0.4)",fontSize:13},children:q.length>0&&k&&Y?"All recipients have already received this newsletter.":"Select stages above to see recipients."}):e.jsxs("div",{style:n.recipientTable,children:[e.jsxs("div",{style:n.tableHeader,children:[e.jsx("span",{style:{...n.tableCell,flex:2},children:"Name"}),e.jsx("span",{style:{...n.tableCell,flex:3},children:"Email"}),e.jsx("span",{style:{...n.tableCell,flex:2},children:"Company"}),e.jsx("span",{style:{...n.tableCell,flex:1.5},children:"Stage"})]}),m.slice(0,50).map(l=>e.jsxs("div",{style:n.tableRow,children:[e.jsx("span",{style:{...n.tableCell,flex:2,color:"#fff",fontWeight:500},children:l.name||"—"}),e.jsx("span",{style:{...n.tableCell,flex:3},children:l.email}),e.jsx("span",{style:{...n.tableCell,flex:2},children:l.companyName||"—"}),e.jsx("span",{style:{...n.tableCell,flex:1.5},children:e.jsx("span",{style:n.stageBadge,children:l.stageName})})]},l.email)),m.length>50&&e.jsxs("div",{style:{padding:"10px 14px",fontSize:12,color:"rgba(255,255,255,0.4)",textAlign:"center"},children:["and ",m.length-50," more..."]})]})]}),e.jsx("div",{style:n.section,children:e.jsxs("div",{style:n.summaryCard,children:[e.jsxs("div",{style:n.summaryRow,children:[e.jsx("span",{style:n.summaryLabel,children:"Subject"}),e.jsx("span",{style:n.summaryValue,children:w})]}),e.jsxs("div",{style:n.summaryRow,children:[e.jsx("span",{style:n.summaryLabel,children:"Recipients"}),e.jsxs("span",{style:n.summaryValue,children:[m.length," individual email",m.length!==1?"s":""]})]}),e.jsxs("div",{style:{...n.summaryRow,borderBottom:"none"},children:[e.jsx("span",{style:n.summaryLabel,children:"Content blocks"}),e.jsxs("span",{style:n.summaryValue,children:[S.length," block",S.length!==1?"s":""]})]})]})})]}),u&&e.jsxs("div",{style:n.section,children:[e.jsx("div",{style:n.progressContainer,children:e.jsx("div",{style:{...n.progressBar,width:`${u.sent/u.total*100}%`}})}),e.jsxs("div",{style:n.progressStats,children:[e.jsxs("span",{children:["Sent ",u.sent," of ",u.total]}),e.jsxs("span",{style:{display:"flex",gap:12},children:[e.jsxs("span",{style:{color:"#10b981"},children:[u.success," delivered"]}),u.failed>0&&e.jsxs("span",{style:{color:"#ef4444"},children:[u.failed," failed"]})]})]}),d&&e.jsxs("div",{style:n.warningBox,children:["Cancelled. ",u.sent," of ",u.total," emails were sent."]}),g&&e.jsx("div",{style:{...n.successBox,...u.failed>0?{borderColor:"rgba(245,158,11,0.3)",background:"rgba(245,158,11,0.06)"}:{}},children:u.failed===0?`All ${u.success} emails sent successfully.`:`Done. ${u.success} succeeded, ${u.failed} failed.`}),u.errors.length>0&&e.jsxs("div",{style:n.errorList,children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,color:"#ef4444",marginBottom:6},children:"Failed:"}),u.errors.map((l,x)=>e.jsxs("div",{style:n.errorRow,children:[e.jsx("span",{children:l.name||l.email}),e.jsx("span",{style:{color:"rgba(255,255,255,0.35)"},children:l.error})]},x))]})]}),e.jsxs("div",{style:n.stepActions,children:[!O&&!g&&!d&&e.jsxs(e.Fragment,{children:[!k&&e.jsx("button",{style:n.secondaryBtn,onClick:()=>N(2),children:"← Back"}),k&&e.jsx("button",{style:n.secondaryBtn,onClick:()=>L("overview"),children:"Cancel"}),e.jsxs("button",{style:{...n.primaryBtn,opacity:m.length===0?.4:1},disabled:m.length===0,onClick:st,children:["Send ",m.length," email",m.length!==1?"s":""]})]}),O&&e.jsx("button",{style:n.dangerBtn,onClick:rt,children:"Cancel sending"}),(g||d)&&e.jsx("button",{style:n.secondaryBtn,onClick:()=>{re(),L("overview")},children:"Back to Newsletters"})]})]})};return ve==="overview"?gt():ve==="detail"?ht():e.jsxs("div",{style:n.page,children:[e.jsxs("div",{style:n.header,children:[e.jsx("h1",{style:n.title,children:k?"Resend Newsletter":pe?"Edit Newsletter":"New Newsletter"}),e.jsx("p",{style:n.subtitle,children:k?"Select a new audience for this newsletter.":"Create and send email newsletters to your contacts."})]}),e.jsx("div",{style:n.steps,children:[{n:1,label:"Draft"},{n:2,label:"Compose"},{n:3,label:"Audience & Send"}].map(({n:t,label:s})=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{...n.stepDot,...z===t?n.stepDotActive:{},...z>t?n.stepDotDone:{}},children:z>t?"✓":t}),e.jsx("span",{style:{fontSize:13,color:z>
102=t?"#fff":"rgba(255,255,255,0.4)",fontWeight:z===t?600:400},children:s}),t<3&&e.jsx("div",{style:n.stepLine})]},t))}),e.jsxs("div",{style:n.content,children:[z===1&&ut(),z===2&&ft(),z===3&&bt()]})]})},n={page:{padding:"32px 40px",maxWidth:900,margin:"0 auto"},header:{marginBottom:28},title:{fontSize:24,fontWeight:700,color:"#fff",margin:"0 0 6px",fontFamily:"'Outfit', sans-serif"},subtitle:{fontSize:14,color:"rgba(255,255,255,0.45)",margin:0},spinner:{width:24,height:24,border:"2px solid rgba(255,255,255,0.1)",borderTopColor:"#00f3ff",borderRadius:"50%",animation:"deal-email-spin 0.6s linear infinite"},emptyBox:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:12,padding:48,textAlign:"center"},steps:{display:"flex",alignItems:"center",gap:8,marginBottom:28,flexWrap:"wrap"},stepDot:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,fontWeight:600,color:"rgba(255,255,255,0.4)",background:"rgba(255,255,255,0.06)",border:"1px solid rgba(255,255,255,0.08)",flexShrink:0},stepDotActive:{background:"rgba(0,243,255,0.12)",borderColor:"rgba(0,243,255,0.3)",color:"#00f3ff"},stepDotDone:{background:"rgba(16,185,129,0.12)",borderColor:"rgba(16,185,129,0.3)",color:"#10b981"},stepLine:{width:32,height:1,background:"rgba(255,255,255,0.1)"},content:{display:"flex",flexDirection:"column",gap:0},section:{marginBottom:24},sectionLabel:{display:"flex",alignItems:"center",gap:8,fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:10},sectionHeader:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},pillGroup:{display:"flex",gap:2,background:"rgba(255,255,255,0.04)",borderRadius:8,padding:2,width:"fit-content"},pill:{padding:"7px 16px",fontSize:13,fontWeight:500,color:"rgba(255,255,255,0.5)",background:"transparent",border:"none",borderRadius:6,cursor:"pointer",transition:"all 0.15s"},pillActive:{background:"rgba(255,255,255,0.1)",color:"#fff"},stageGrid:{display:"flex",flexWrap:"wrap",gap:6},stageItem:{display:"flex",alignItems:"center",gap:8,padding:"7px 12px",borderRadius:6,border:"1px solid rgba(255,255,255,0.06)",cursor:"pointer",transition:"all 0.15s",background:"transparent"},stageItemSelected:{background:"rgba(0,243,255,0.06)",borderColor:"rgba(0,243,255,0.2)"},stageDot:{width:8,height:8,borderRadius:"50%",flexShrink:0},stageName:{fontSize:13,color:"rgba(255,255,255,0.8)"},stageCount:{fontSize:11,color:"rgba(255,255,255,0.35)",marginLeft:"auto"},linkBtn:{background:"none",border:"none",color:"#00f3ff",fontSize:12,cursor:"pointer",padding:0},recipientCount:{background:"rgba(0,243,255,0.1)",color:"#00f3ff",fontSize:11,fontWeight:700,padding:"2px 8px",borderRadius:10,marginLeft:8},recipientTable:{border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,overflow:"hidden"},tableHeader:{display:"flex",padding:"8px 14px",background:"rgba(255,255,255,0.03)",borderBottom:"1px solid rgba(255,255,255,0.06)"},tableRow:{display:"flex",padding:"8px 14px",borderBottom:"1px solid rgba(255,255,255,0.03)"},tableCell:{fontSize:12,color:"rgba(255,255,255,0.55)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingRight:8},stageBadge:{fontSize:11,color:"rgba(0,243,255,0.7)",background:"rgba(0,243,255,0.06)",borderRadius:10,padding:"1px 7px"},badgeDraft:{fontSize:11,fontWeight:600,color:"#f59e0b",background:"rgba(245,158,11,0.1)",borderRadius:10,padding:"2px 8px"},badgeSent:{fontSize:11,fontWeight:600,color:"#10b981",background:"rgba(16,185,129,0.1)",borderRadius:10,padding:"2px 8px"},badgePartial:{fontSize:11,fontWeight:600,color:"#f59e0b",background:"rgba(245,158,11,0.1)",borderRadius:10,padding:"2px 8px"},subjectInput:{width:"100%",padding:"10px 14px",fontSize:14,color:"#fff",background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:8,outline:"none",boxSizing:"border-box"},fmtDivider:{width:1,height:16,background:"rgba(255,255,255,0.1)",margin:"0 4px"},editorContainer:{},previewFrame:{background:"linear-gradient(180deg, #111118 0%, #0f0f17 100%)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:12,overflow:"hidden"},previewHeader:{padding:"16px 24px",textAlign:"center",borderBottom:"1px solid rgba(255,255,255,0.06)"},previewFooter:{padding:"16px 24px",textAlign:"center",borderTop:"1px solid rgba(255,255,255,0.06)"},blockToolbar:{display:"flex",alignItems:"center",gap:8,padding:"4px 8px",borderBottom:"1px solid rgba(255,255,255,0.06)",background:"rgba(0,243,255,0.03)",borderRadius:"7px 7px 0 0"},blockTypeLabel:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"rgba(0,243,255,0.5)"}
102,blockInput:{padding:"7px 10px",fontSize:13,color:"#fff",background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:6,outline:"none",boxSizing:"border-box",width:"100%"},addBlockBtn:{width:28,height:28,borderRadius:"50%",border:"1px dashed rgba(255,255,255,0.15)",background:"rgba(255,255,255,0.02)",color:"rgba(255,255,255,0.3)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.15s",padding:0},typePicker:{position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)",background:"#1a1a24",border:"1px solid rgba(255,255,255,0.12)",borderRadius:10,padding:6,zIndex:10,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:4,minWidth:260,boxShadow:"0 8px 32px rgba(0,0,0,0.5)"},typeBtn:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",borderRadius:6,background:"transparent",border:"none",color:"rgba(255,255,255,0.7)",fontSize:12,fontWeight:500,cursor:"pointer",transition:"all 0.1s",whiteSpace:"nowrap"},typeIcon:{width:22,height:22,borderRadius:4,background:"rgba(255,255,255,0.06)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,flexShrink:0},stepActions:{display:"flex",justifyContent:"flex-end",gap:10,marginTop:8,paddingTop:16,borderTop:"1px solid rgba(255,255,255,0.06)"},primaryBtn:{padding:"9px 20px",fontSize:13,fontWeight:600,color:"#000",background:"#00f3ff",border:"none",borderRadius:8,cursor:"pointer"},secondaryBtn:{padding:"9px 20px",fontSize:13,fontWeight:500,color:"rgba(255,255,255,0.6)",background:"rgba(255,255,255,0.06)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:8,cursor:"pointer"},dangerBtn:{padding:"9px 20px",fontSize:13,fontWeight:600,color:"#fff",background:"rgba(239,68,68,0.2)",border:"1px solid rgba(239,68,68,0.4)",borderRadius:8,cursor:"pointer"},summaryCard:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:10,padding:20},summaryRow:{display:"flex",justifyContent:"space-between",padding:"8px 0",borderBottom:"1px solid rgba(255,255,255,0.04)"},summaryLabel:{fontSize:13,color:"rgba(255,255,255,0.45)"},summaryValue:{fontSize:13,color:"#fff",fontWeight:500},progressContainer:{height:6,borderRadius:3,background:"rgba(255,255,255,0.06)",overflow:"hidden",marginBottom:10},progressBar:{height:"100%",borderRadius:3,background:"#00f3ff",transition:"width 0.3s ease"},progressStats:{display:"flex",justifyContent:"space-between",fontSize:13,color:"rgba(255,255,255,0.6)",marginBottom:12},successBox:{padding:"12px 16px",background:"rgba(16,185,129,0.06)",border:"1px solid rgba(16,185,129,0.2)",borderRadius:8,color:"#10b981",fontSize:13,fontWeight:500},warningBox:{padding:"12px 16px",background:"rgba(245,158,11,0.06)",border:"1px solid rgba(245,158,11,0.2)",borderRadius:8,color:"#f59e0b",fontSize:13,fontWeight:500,marginBottom:12},errorList:{background:"rgba(239,68,68,0.04)",border:"1px solid rgba(239,68,68,0.1)",borderRadius:8,padding:12,marginTop:12},errorRow:{display:"flex",justifyContent:"space-between",fontSize:12,color:"rgba(255,255,255,0.5)",padding:"4px 0"},uploadArea:{display:"flex",flexDirection:"column",gap:12},imageGrid:{display:"flex",flexWrap:"wrap",gap:8},imageThumb:{position:"relative",width:100,borderRadius:6,overflow:"hidden",border:"1px solid rgba(255,255,255,0.1)"},imageRemoveBtn:{position:"absolute",top:4,right:4,width:20,height:20,borderRadius:"50%",background:"rgba(0,0,0,0.7)",color:"#fff",border:"none",cursor:"pointer",fontSize:14,display:"flex",alignItems:"center",justifyContent:"center",padding:0,lineHeight:1},draftTextarea:{width:"100%",minHeight:180,padding:"14px 16px",fontSize:14,color:"#fff",background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:8,outline:"none",boxSizing:"border-box",resize:"vertical",fontFamily:"inherit",lineHeight:1.6}};export{Et 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.