1import{c as zt,r as i,j as e,B as d,E as ce,D as J,a as X,d as Z,e as ee,g as pe,h as me,i as xe,k as ge,I,T as te,R as Et,l as Gt,u as V,n as Ne,b as y,o as It,p as Dt,H as Ot,C as Pt,S as _e,L as G,U as Je,q as Xe,t as Ze,v as et,w as tt,x as st,y as ke,z as Rt}from"./index-DkulAUme.js";import{S as rt}from"./switch-C1sOqTDP.js";import{C as F}from"./circle-check-big-mzym5U64.js";import{F as ot}from"./file-text-Fp29nkkI.js";import{U as Ft}from"./user-check-BKyk6MoH.js";import{E as Lt}from"./eye-off-eEANDYTB.js";import{L as dt}from"./link-C2hjARYF.js";import{T as Mt}from"./TagLibraryPanel-Dge34UEw.js";import{S as at}from"./save-CcxM7oJF.js";import{M as Bt}from"./mail-tn1E2PhN.js";import{F as it}from"./flask-conical-piuYYDfH.js";import{S as oe}from"./send-UlR-TO08.js";import{C as nt}from"./clock-kvWSacoh.js";import{B as Ut}from"./book-open-DvUxJ9H2.js";import{P as $t}from"./plus-CrInv8ql.js";import{P as Ht}from"./pen-line-DDo9pmmb.js";import{T as Kt}from"./trash-2-QM5ghqzE.js";/** 2 * @license lucide-react v0.475.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const qt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],de=zt("PanelsTopLeft",qt),R="https://storage.googleapis.com/star_magic_healing/schoolforintuitiveacestionlogo.png",D="https://schoolforintuitiveascension.net",W=` 7<table width="100%" cellpadding="0" cellspacing="0" style="border-top:1px solid rgba(178,138,98,0.15);margin-top:32px;"> 8 <tr> 9 <td style="padding:28px 40px 32px;text-align:center;"> 10 <img src="${R}" alt="School for Intuitive Ascension" style="height:34px;margin:0 auto 14px;display:block;" /> 11 <p style="margin:0 0 8px;font-size:13px;color:#9b8a80;font-family:Arial,sans-serif;"> 12 School for Intuitive Ascension · 13 <a href="${D}" style="color:#b28a62;text-decoration:none;">${D.replace("https://","")}</a> 14 </p> 15 <p style="margin:0;font-size:12px;color:#7a6b63;font-family:Arial,sans-serif;"> 16 <a href="{{unsubscribe_url}}" style="color:#b28a62;text-decoration:underline;">Unsubscribe</a> 17 · 18 <a href="${D}/PrivacyPolicy" style="color:#b28a62;text-decoration:underline;">Privacy Policy</a> 19 </p> 20 </td> 21 </tr> 22</table>`,Se=[{id:1,name:"Awakening Monthly",description:"Warm & soulful â hero message, featured insight, upcoming event, closing reflection",thumbnail_bg:"linear-gradient(135deg, #492533 0%, #3a1025 50%, #b28a62 100%)",subject:"{{first_name}}, something is awakening in you this month",html:`<!DOCTYPE html> 23<html lang="en"> 24<head> 25<meta charset="UTF-8"/> 26<meta name="viewport" content="width=device-width,initial-scale=1.0"/> 27<title>Awakening Monthly â Intuitive Ascension</title> 28<style> 29body{margin:0;padding:0;background:#f3f0e9;font-family:Georgia,serif;} 30img{border:0;display:block;max-width:100%;} 31a{text-decoration:none;} 32@media only screen and (max-width:600px){ 33.outer{padding:12px 0 !important;} 34.main{border-radius:16px !important;} 35.hero-td{padding:36px 24px 28px !important;} 36.hero-h1{font-size:32px !important;} 37.body-td,.card-td,.footer-td{padding-left:24px !important;padding-right:24px !important;} 38} 39</style> 40</head> 41<body> 42<table width="100%" cellpadding="0" cellspacing="0" class="outer" style="background:#f3f0e9;padding:32px 16px;"> 43<tr><td align="center"> 44<table width="600" cellpadding="0" cellspacing="0" class="main" style="max-width:600px;width:100%;background:#1e0912;border-radius:24px;overflow:hidden;box-shadow:0 16px 48px rgba(0,0,0,0.3);"> 45 46 <!-- HERO --> 47 <tr> 48 <td class="hero-td" style="background:linear-gradient(160deg,#5a1d36 0%,#492533 55%,#3a1025 100%);padding:48px 40px 36px;text-align:center;"> 49 <img src="${R}" alt="Intuitive Ascension" style="height:40px;margin:0 auto 24px;" /> 50 <p style="margin:0 0 12px;font-size:12px;letter-spacing:2.2px;text-transform:uppercase;color:#b28a62;font-family:Arial,sans-serif;">Monthly Reflection · {{month_year}}</p> 51 <h1 class="hero-h1" style="margin:0 0 20px;font-family:Georgia,serif;font-size:40px;font-weight:normal;color:#fff5ec;line-height:1.15;">Something is awakening<br>in you this month.</h1> 52 <p style="margin:0;font-size:17px;line-height:1.8;color:#f0e2d7;font-family:Georgia,serif;">You don't have to have it figured out.<br>You just have to keep choosing the path.</p> 53 </td> 54 </tr> 55 56 <!-- BODY --> 57 <tr> 58 <td class="body-td" style="padding:36px 40px 28px;"> 59 <p style="margin:0 0 18px;font-size:18px;line-height:1.85;color:#f2e7dc;font-family:Georgia,serif;">Dear {{first_name}},</p> 60 <p style="margin:0 0 18px;font-size:18px;line-height:1.85;color:#f2e7dc;font-family:Georgia,serif;">{{opening_paragraph}}</p> 61 <p style="margin:0 0 18px;font-size:18px;line-height:1.85;color:#f2e7dc;font-family:Georgia,serif;">{{main_content}}</p> 62 </td> 63 </tr> 64 65 <!-- FEATURED INSIGHT --> 66 <tr> 67 <td class="card-td" style="padding:0 40px 28px;"> 68 <table width="100%" cellpadding="0" cellspacing="0" style="background:linear-gradient(135deg,#5a1930 0%,#3a0f1f 100%);border-radius:20px;border:1px solid rgba(178,138,98,0.18);overflow:hidden;"> 69 <tr>
70 <td style="padding:28px 30px;"> 71 <p style="margin:0 0 6px;font-size:11px;letter-spacing:2px;text-transform:uppercase;color:#b28a62;font-family:Arial,sans-serif;">Featured Insight</p> 72 <h2 style="margin:0 0 14px;font-family:Georgia,serif;font-size:26px;font-weight:normal;color:#fff5ec;line-height:1.2;">{{insight_title}}</h2> 73 <p style="margin:0 0 20px;font-size:17px;line-height:1.8;color:#f0e2d7;font-family:Georgia,serif;">{{insight_body}}</p> 74 <a href="${D}" style="display:inline-block;background:linear-gradient(180deg,#c8a06c,#a67845);color:#fff7ef;font-family:Georgia,serif;font-size:16px;font-weight:bold;padding:14px 28px;border-radius:999px;">Read More â</a> 75 </td> 76 </tr> 77 </table> 78 </td> 79 </tr> 80 81 <!-- UPCOMING EVENT --> 82 <tr> 83 <td class="card-td" style="padding:0 40px 28px;"> 84 <table width="100%" cellpadding="0" cellspacing="0" style="background:rgba(178,138,98,0.08);border-radius:16px;border:1px solid rgba(178,138,98,0.15);"> 85 <tr> 86 <td style="padding:22px 26px;"> 87 <p style="margin:0 0 6px;font-size:11px;letter-spacing:2px;text-transform:uppercase;color:#b28a62;font-family:Arial,sans-serif;">Upcoming · {{event_date}}</p> 88 <h3 style="margin:0 0 10px;font-family:Georgia,serif;font-size:22px;font-weight:normal;color:#fff5ec;">{{event_name}}</h3> 89 <p style="margin:0 0 16px;font-size:16px;line-height:1.7;color:#dbc8bb;font-family:Georgia,serif;">{{event_description}}</p> 90 <a href="{{event_link}}" style="display:inline-block;border:1px solid #b28a62;color:#e5c79f;font-family:Arial,sans-serif;font-size:14px;padding:10px 22px;border-radius:999px;">Reserve Your Spot</a> 91 </td> 92 </tr> 93 </table> 94 </td> 95 </tr> 96 97 <!-- CLOSING --> 98 <tr> 99 <td class="body-td" style="padding:0 40px 36px;text-align:center;"> 100 <p style="margin:0 0 10px;font-size:17px;line-height:1.85;color:#f2e7dc;font-family:Georgia,serif;font-style:italic;">{{closing_reflection}}</p> 101 <p style="margin:0;font-size:17px;color:#b28a62;font-family:Georgia,serif;">With love,<br><strong style="font-weight:normal;color:#fff5ec;">The Intuitive Ascension Team</strong></p> 102 </td> 103 </tr> 104 105 <!-- FOOTER --> 106 <tr><td>${W}</td></tr> 107</table> 108</td></tr> 109</table> 110</body> 111</html>`},{id:2,name:"The Practitioner",description:"Professional & grounded â skill spotlight, student story, resources section",thumbnail_bg:"linear-gradient(135deg, #3a1025 0%, #b28a62 60%, #492533 100%)",subject:"Your practice, deepened â {{month_year}} edition",html:`<!DOCTYPE html> 112<html lang="en"> 113<head> 114<meta charset="UTF-8"/> 115<meta name="viewport" content="width=device-width,initial-scale=1.0"/> 116<title>The Practitioner â Intuitive Ascension</title> 117<style> 118body{margin:0;padding:0;background:#0e0608;font-family:Arial,Helvetica,sans-serif;} 119img{border:0;display:block;max-width:100%;} 120a{text-decoration:none;} 121@media only screen and (max-width:600px){ 122.outer{padding:0 !important;} 123.main{border-radius:0 !important;} 124.pad{padding-left:20px !important;padding-right:20px !important;} 125.h1large{font-size:30px !important;} 126} 127</style> 128</head> 129<body> 130<table width="100%" cellpadding="0" cellspacing="0" class="outer" style="background:#0e0608;padding:24px 16px;"> 131<tr><td align="center"> 132<table width="600" cellpadding="0" cellspacing="0" class="main" style="max-width:600px;width:100%;border-radius:20px;overflow:hidden;box-shadow:0 12px 40px rgba(0,0,0,0.4);"> 133 134 <!-- TOP BAR --> 135 <tr> 136 <td style="background:#492533;padding:14px 32px;text-align:center;"> 137 <p style="margin:0;font-size:11px;letter-spacing:2.5px;text-transform:uppercase;color:#e5c79f;font-family:Arial,sans-serif;">The Practitioner · {{month_year}}</p> 138 </td> 139 </tr> 140 141 <!-- HERO --> 142 <tr> 143 <td style="background:linear-gradient(180deg,#3a1025 0%,#1e0912 100%);padding:44px 40px 36px;" class="pad"> 144 <img src="${R}" alt="Intuitive Ascension" style="height:36px;margin:0 auto 28px;" /> 145 <h1 class="h1large" style="margin:0 0 18px;font-family:Georgia,serif;font-size:38px;font-weight:normal;color:#fff5ec;line-height:1.15;">{{newsletter_headline}}</h1> 146 <p style="margin:0;font-size:17px;line-height:1.8;color:#dbc8bb;font-family:Georgia,serif;">{{hero_subtext}}</p> 147 </td> 148 </tr> 149 150 <!-- DIVIDER --> 151 <tr><td style="background:#200812;height:1px;"><div style="height:1px;background:linear-gradient(90deg,transparent,#b28a62,transparent);"></div></td></tr> 152 153 <!-- SKILL SPOTLIGHT --> 154 <tr> 155 <td style="background:#1e0912;padding:32px 40px;" class="pad"> 156 <p style="margin:0 0 6px;font-size:11px;letter-spacing:2px;text-transform:uppercase;color:#b28a62;font-family:Arial,sans-serif;">Skill Spotlight</p> 157 <h2 style="margin:0 0 16px;font-family:Georgia,serif;font-size:26px;font-weight:normal;color:#fff5ec;">{{skill_title}}</h2> 158 <p style="margin:0 0 20px;font-size:17px;line-height:1.8;color:#f0e2d7;font-family:Georgia,serif;">{{skill_content}}</p> 159 <table cellpadding="0" cellspacing="0"><tr> 160 <td style="background:linear-gradient(180deg,#c8a06c,#a67845);border-radius:999px;"> 161 <a href="${D}" style="display:block;color:#fff7ef;font-family:Arial,sans-serif;font-size:15px;font-weight:bold;
161padding:13px 26px;">Explore This Skill â</a> 162 </td> 163 </tr></table> 164 </td> 165 </tr> 166 167 <!-- STUDENT STORY --> 168 <tr> 169 <td style="background:linear-gradient(135deg,#401126,#2c0d18);padding:32px 40px;border-top:1px solid rgba(178,138,98,0.12);border-bottom:1px solid rgba(178,138,98,0.12);" class="pad"> 170 <p style="margin:0 0 6px;font-size:11px;letter-spacing:2px;text-transform:uppercase;color:#b28a62;font-family:Arial,sans-serif;">Student Story</p> 171 <p style="margin:0 0 14px;font-size:20px;line-height:1.6;color:#fff5ec;font-family:Georgia,serif;font-style:italic;">"{{student_quote}}"</p> 172 <p style="margin:0;font-size:14px;color:#b28a62;font-family:Arial,sans-serif;">â {{student_name}}, {{student_program}}</p> 173 </td> 174 </tr> 175 176 <!-- RESOURCES --> 177 <tr> 178 <td style="background:#1a0910;padding:32px 40px;" class="pad"> 179 <p style="margin:0 0 20px;font-size:11px;letter-spacing:2px;text-transform:uppercase;color:#b28a62;font-family:Arial,sans-serif;">Resources This Month</p> 180 <table width="100%" cellpadding="0" cellspacing="0"> 181 <tr> 182 <td style="padding:12px 0;border-bottom:1px solid rgba(178,138,98,0.1);"> 183 <p style="margin:0;font-size:16px;color:#f2e7dc;font-family:Georgia,serif;">ð {{resource_1}}</p> 184 </td> 185 </tr> 186 <tr> 187 <td style="padding:12px 0;border-bottom:1px solid rgba(178,138,98,0.1);"> 188 <p style="margin:0;font-size:16px;color:#f2e7dc;font-family:Georgia,serif;">ð§ {{resource_2}}</p> 189 </td> 190 </tr> 191 <tr> 192 <td style="padding:12px 0;"> 193 <p style="margin:0;font-size:16px;color:#f2e7dc;font-family:Georgia,serif;">⨠{{resource_3}}</p> 194 </td> 195 </tr> 196 </table> 197 </td> 198 </tr> 199 200 <!-- FOOTER --> 201 <tr><td style="background:#12070d;">${W}</td></tr> 202</table> 203</td></tr> 204</table> 205</body> 206</html>`},{id:3,name:"Sacred Seasons",description:"Seasonal & ceremonial â rich atmosphere, ritual practice, community update",thumbnail_bg:"linear-gradient(135deg, #200812 0%, #5a1d36 40%, #c8a06c 100%)",subject:"The season is speaking, {{first_name}} â are you listening?",html:`<!DOCTYPE html> 207<html lang="en"> 208<head> 209<meta charset="UTF-8"/> 210<meta name="viewport" content="width=device-width,initial-scale=1.0"/> 211<title>Sacred Seasons â Intuitive Ascension</title> 212<style> 213body{margin:0;padding:0;background:#12070d;font-family:Georgia,serif;} 214img{border:0;display:block;max-width:100%;} 215a{text-decoration:none;} 216@media only screen and (max-width:600px){ 217.wrap{padding:0 !important;} 218.box{border-radius:0 !important;} 219.p40{padding:24px !important;} 220h1{font-size:34px !important;} 221} 222</style> 223</head> 224<body> 225<table width="100%" cellpadding="0" cellspacing="0" class="wrap" style="background:#12070d;padding:0;"> 226<tr><td align="center"> 227<table width="600" cellpadding="0" cellspacing="0" class="box" style="max-width:600px;width:100%;"> 228 229 <!-- FULL-BLEED HEADER --> 230 <tr> 231 <td style="background:linear-gradient(160deg,#2a0d1d 0%,#5a1d36 35%,#492533 65%,#3a1025 100%);padding:52px 40px 44px;text-align:center;" class="p40"> 232 <img src="${R}" alt="Intuitive Ascension" style="height:38px;margin:0 auto 22px;" /> 233 <p style="margin:0 0 10px;font-size:12px;letter-spacing:3px;text-transform:uppercase;color:#b28a62;font-family:Arial,sans-serif;">Sacred Seasons · {{season_name}}</p> 234 <h1 style="margin:0 0 20px;font-family:Georgia,serif;font-size:42px;font-weight:normal;color:#fff5ec;line-height:1.12;">{{seasonal_headline}}</h1> 235 <div style="width:48px;height:2px;background:linear-gradient(90deg,transparent,#b28a62,transparent);margin:0 auto 24px;"></div> 236 <p style="margin:0;font-size:18px;line-height:1.8;color:#f0e2d7;font-family:Georgia,serif;font-style:italic;">{{seasonal_opening}}</p> 237 </td> 238 </tr> 239 240 <!-- OPENING LETTER --> 241 <tr> 242 <td style="background:#1e0912;padding:36px 40px;" class="p40"> 243 <p style="margin:0 0 18px;font-size:18px;line-height:1.9;color:#f2e7dc;font-family:Georgia,serif;">Dear {{first_name}},</p> 244 <p style="margin:0 0 18px;font-size:18px;line-height:1.9;color:#f2e7dc;font-family:Georgia,serif;">{{letter_paragraph_1}}</p> 245 <p style="margin:0 0 18px;font-size:18px;line-height:1.9;color:#f2e7dc;font-family:Georgia,serif;">{{letter_paragraph_2}}</p> 246 </td> 247 </tr> 248 249 <!-- RITUAL PRACTICE --> 250 <tr> 251 <td style="padding:0 40px 28px;background:#1e0912;" class="p40"> 252 <table width="100%" cellpadding="0" cellspacing="0" style="background:linear-gradient(135deg,#401126,#2c0d18);border-radius:20px;border:1px solid rgba(178,138,98,0.15);overflow:hidden;"> 253 <tr> 254 <td style="padding:30px;"> 255 <p style="margin:0 0 8px;font-size:11px;letter-spacing:2.2px;text-transform:uppercase;color:#b28a62;font-family:Arial,sans-serif;">Ritual Practice</p> 256 <h2 style="margin:0 0 16px;font-family:Georgia,serif;font-size:26px;font-weight:normal;color:#fff5ec;line-height:1.2;">{{ritual_title}}</h2> 257 <p style="margin:0 0 18px;font-size:17px;line-height:1.85;color:#f0e2d7;font-family:Georgia,serif;">{{ritual_description}}</p> 258 <ol style="margin:0;padding:0 0 0 18px;color:#dbc8bb;font-size:16px;line-height:2.0;font-family:Georgia,serif;"> 259 <li>{{ritual_step_1}}</li> 260 <li>{{ritual_step_2}}</li> 261 <li>{{ritual_step_3}}</li> 262 </ol> 263 </td> 264 </tr> 265 </table> 266 </td> 267 </tr> 268 269 <!-- COMMUNITY CORNER --> 270 <tr> 271 <td style="background:#16090e;padding:32px 40px;border-top:1px solid rgba(178,138,98,0.08);" class="p40"> 272 <p style="margin:0 0 8px;font-size:11px;letter-spacing:2px;text-transform:uppercase;color:#b28a62;font-family:Arial,sans-serif;">Community Corner</p> 273 <p style="margin:0 0 16px;font-size:18px;line-height:1.85;color:#f2e7dc;font-family:Georgia,serif;">{{community_update}}</p> 274 <a href="${D}" style="display:inline-block;background:linear-gradient(180deg,#c8a06c,#a67845);color:#fff7ef;font-family:Georgia,serif;font-size:16px;font-weight:bold;padding:14px 30px;border-radius:999px;">Join Us â</a> 275 </td> 276 </tr> 277 278 <!-- FOOTER --> 279 <tr><td style="background:#12070d;">${W}</td></tr> 280</table> 281</td></tr> 282</table> 283</body> 284</html>`},{id:4,name:"Clarity Digest",description:"Clean & editorial â headline story, 3 quick insights, upcoming programs",thumbnail_bg:"linear-gradient(135deg, #492533 0%, #200812 40%, #b28a62 100%)",subject:"{{first_name}} â your clarity digest for {{month_year}}",html:`<!DOCTYPE html> 285<html lang="en"> 286<head> 287<meta charset="UTF-8"/> 288<meta name="viewport" content="width=device-width,initial-scale=1.0"/> 289<title>Clarity Digest â Intuitive Ascension</title> 290<style> 291body{margin:0;padding:0;background:#f3f0e9;font-family:Arial,Helvetica,sans-serif;} 292img{border:0;display:block;max-width:100%;} 293a{text-decoration:none;} 294@media only screen and (max-width:600px){ 295.main{border-radius:12px !important;} 296.p36{padding:22px !important;} 297.h1{font-size:28px !important;} 298} 299</style> 300</head> 301<body> 302<table width="100%" cellpadding="0" cellspacing="0" style="background:#f3f0e9;padding:28px 16px;"> 303<tr><td align="center"> 304<table width="600" cellpadding="0" cellspacing="0" class="main" style="max-width:600px;width:100%;border-radius:20px;overflow:hidden;box-shadow:0 8px 32px rgba(73,37,51,0.12);"> 305 306 <!-- HEADER STRIP --> 307 <tr> 308 <td style="background:#492533;padding:12px 36px;"> 309 <table width="100%" cellpadding="0" cellspacing="0"> 310 <tr> 311 <td><img src="${R}" alt="Intuitive Ascension" style="height:28px;" /></td> 312 <td style="text-align:right;"><p style="margin:0;font-size:11px;letter-spacing:2px;text-transform:uppercase;color:#e5c79f;font-family:Arial,sans-serif;">{{month_year}} Digest</p></td> 313 </tr> 314 </table> 315 </td> 316 </tr> 317 318 <!-- HERO STORY --> 319 <tr> 320 <td style="background:linear-gradient(160deg,#3a1025,#492533);padding:40px 36px 32px;" class="p36"> 321 <p style="margin:0 0 8px;font-size:11px;letter-spacing:2px;text-transform:uppercase;color:#b28a62;font-family:Arial,sans-serif;">This Month's Story</p> 322 <h1 class="h1" style="margin:0 0 18px;font-family:Georgia,serif;font-size:34px;font-weight:normal;color:#fff5ec;line-height:1.2;">{{main_story_headline}}</h1> 323 <p style="margin:0 0 22px;font-size:17px;line-height:1.8;color:#f0e2d7;font-family:Georgia,serif;">{{main_story_body}}</p> 324 <a href="{{main_story_link}}" style="display:inline-block;background:linear-gradient(180deg,#c8a06c,#a67845);color:#fff7ef;font-family:Arial,sans-serif;font-size:15px;font-weight:bold;
324padding:13px 26px;border-radius:999px;">Read the Full Story â</a> 325 </td> 326 </tr> 327 328 <!-- 3 QUICK INSIGHTS --> 329 <tr> 330 <td style="background:#fff;padding:32px 36px;" class="p36"> 331 <p style="margin:0 0 20px;font-size:11px;letter-spacing:2px;text-transform:uppercase;color:#492533;font-family:Arial,sans-serif;border-bottom:2px solid #f3e8dc;padding-bottom:10px;">3 Quick Insights</p> 332 333 <table width="100%" cellpadding="0" cellspacing="0" style="margin-bottom:18px;"> 334 <tr> 335 <td style="width:36px;vertical-align:top;padding-top:4px;"><div style="width:28px;height:28px;background:#492533;border-radius:50%;text-align:center;line-height:28px;color:#fff5ec;font-family:Georgia,serif;font-size:14px;">1</div></td> 336 <td style="padding-left:14px;"> 337 <p style="margin:0 0 4px;font-size:16px;font-weight:bold;color:#492533;font-family:Georgia,serif;">{{insight_1_title}}</p> 338 <p style="margin:0;font-size:15px;line-height:1.7;color:#5a3545;font-family:Georgia,serif;">{{insight_1_body}}</p> 339 </td> 340 </tr> 341 </table> 342 343 <table width="100%" cellpadding="0" cellspacing="0" style="margin-bottom:18px;"> 344 <tr> 345 <td style="width:36px;vertical-align:top;padding-top:4px;"><div style="width:28px;height:28px;background:#b28a62;border-radius:50%;text-align:center;line-height:28px;color:#fff5ec;font-family:Georgia,serif;font-size:14px;">2</div></td> 346 <td style="padding-left:14px;"> 347 <p style="margin:0 0 4px;font-size:16px;font-weight:bold;color:#492533;font-family:Georgia,serif;">{{insight_2_title}}</p> 348 <p style="margin:0;font-size:15px;line-height:1.7;color:#5a3545;font-family:Georgia,serif;">{{insight_2_body}}</p> 349 </td> 350 </tr> 351 </table> 352 353 <table width="100%" cellpadding="0" cellspacing="0"> 354 <tr> 355 <td style="width:36px;vertical-align:top;padding-top:4px;"><div style="width:28px;height:28px;background:#492533;border-radius:50%;text-align:center;line-height:28px;color:#fff5ec;font-family:Georgia,serif;font-size:14px;">3</div></td> 356 <td style="padding-left:14px;"> 357 <p style="margin:0 0 4px;font-size:16px;font-weight:bold;color:#492533;font-family:Georgia,serif;">{{insight_3_title}}</p> 358 <p style="margin:0;font-size:15px;line-height:1.7;color:#5a3545;font-family:Georgia,serif;">{{insight_3_body}}</p> 359 </td> 360 </tr> 361 </table> 362 </td> 363 </tr> 364 365 <!-- PROGRAMS --> 366 <tr> 367 <td style="background:linear-gradient(135deg,#492533,#3a1025);padding:32px 36px;" class="p36"> 368 <p style="margin:0 0 18px;font-size:11px;letter-spacing:2px;text-transform:uppercase;color:#b28a62;font-family:Arial,sans-serif;">Upcoming Programs</p> 369 <table width="100%" cellpadding="0" cellspacing="0"> 370 <tr> 371 <td style="padding:14px 0;border-bottom:1px solid rgba(178,138,98,0.15);"> 372 <p style="margin:0 0 3px;font-size:16px;color:#fff5ec;font-family:Georgia,serif;">{{program_1_name}}</p> 373 <p style="margin:0;font-size:13px;color:#b28a62;font-family:Arial,sans-serif;">{{program_1_date}}</p> 374 </td> 375 </tr> 376 <tr> 377 <td style="padding:14px 0;border-bottom:1px solid rgba(178,138,98,0.15);"> 378 <p style="margin:0 0 3px;font-size:16px;color:#fff5ec;font-family:Georgia,serif;">{{program_2_name}}</p> 379 <p style="margin:0;font-size:13px;color:#b28a62;font-family:Arial,sans-serif;">{{program_2_date}}</p> 380 </td> 381 </tr> 382 <tr> 383 <td style="padding:14px 0;"> 384 <p style="margin:0 0 3px;font-size:16px;color:#fff5ec;font-family:Georgia,serif;">{{program_3_name}}</p> 385 <p style="margin:0;font-size:13px;color:#b28a62;font-family:Arial,sans-serif;">{{program_3_date}}</p> 386 </td> 387 </tr> 388 </table> 389 <div style="margin-top:22px;"> 390 <a href="${D}" style="display:inline-block;border:1px solid #b28a62;color:#e5c79f;font-family:Arial,sans-serif;font-size:14px;padding:11px 24px;border-radius:999px;">View All Programs â</a> 391 </div> 392 </td> 393 </tr> 394 395 <!-- FOOTER --> 396 <tr><td style="background:#12070d;">${W}</td></tr> 397</table> 398</td></tr> 399</table> 400</body> 401</html>`}
401,{id:5,name:"Inner Compass",description:"Intimate & personal â a letter from the teacher, one question, one practice",thumbnail_bg:"linear-gradient(135deg, #3a1025 0%, #492533 30%, #a67845 100%)",subject:"A letter for you, {{first_name}} â this month's inner compass",html:`<!DOCTYPE html> 402<html lang="en"> 403<head> 404<meta charset="UTF-8"/> 405<meta name="viewport" content="width=device-width,initial-scale=1.0"/> 406<title>Inner Compass â Intuitive Ascension</title> 407<style> 408body{margin:0;padding:0;background:#1a0910;font-family:Georgia,serif;} 409img{border:0;display:block;max-width:100%;} 410a{text-decoration:none;} 411@media only screen and (max-width:600px){ 412.wrap{padding:0 !important;} 413.p40{padding:26px !important;} 414.h1{font-size:32px !important;} 415} 416</style> 417</head> 418<body> 419<table width="100%" cellpadding="0" cellspacing="0" class="wrap" style="background:#1a0910;padding:0;"> 420<tr><td align="center"> 421<table width="600" cellpadding="0" cellspacing="0" style="max-width:600px;width:100%;"> 422 423 <!-- SLIM TOP BAR --> 424 <tr> 425 <td style="background:linear-gradient(90deg,#492533,#5a1d36);padding:10px 40px;text-align:center;"> 426 <p style="margin:0;font-size:11px;letter-spacing:2.5px;text-transform:uppercase;color:#e5c79f;font-family:Arial,sans-serif;">Inner Compass · {{month_year}}</p> 427 </td> 428 </tr> 429 430 <!-- LOGO + GREETING --> 431 <tr> 432 <td style="background:linear-gradient(180deg,#3a1025 0%,#1e0912 100%);padding:44px 40px 36px;text-align:center;" class="p40"> 433 <img src="${R}" alt="Intuitive Ascension" style="height:40px;margin:0 auto 32px;" /> 434 <h1 class="h1" style="margin:0 0 14px;font-family:Georgia,serif;font-size:36px;font-weight:normal;color:#fff5ec;line-height:1.2;">{{letter_title}}</h1> 435 <div style="width:48px;height:1px;background:#b28a62;margin:0 auto 24px;"></div> 436 </td> 437 </tr> 438 439 <!-- LETTER BODY --> 440 <tr> 441 <td style="background:#1e0912;padding:0 40px 36px;" class="p40"> 442 <p style="margin:0 0 20px;font-size:18px;line-height:1.95;color:#f2e7dc;font-family:Georgia,serif;">Dear {{first_name}},</p> 443 <p style="margin:0 0 20px;font-size:18px;line-height:1.95;color:#f2e7dc;font-family:Georgia,serif;">{{letter_paragraph_1}}</p> 444 <p style="margin:0 0 20px;font-size:18px;line-height:1.95;color:#f2e7dc;font-family:Georgia,serif;">{{letter_paragraph_2}}</p> 445 <p style="margin:0 0 20px;font-size:18px;line-height:1.95;color:#f2e7dc;font-family:Georgia,serif;">{{letter_paragraph_3}}</p> 446 </td> 447 </tr> 448 449 <!-- THE QUESTION --> 450 <tr> 451 <td style="background:#1e0912;padding:0 40px 32px;" class="p40"> 452 <table width="100%" cellpadding="0" cellspacing="0" style="background:linear-gradient(135deg,#5a1930,#3a0f1f);border-radius:20px;border:1px solid rgba(178,138,98,0.2);"> 453 <tr> 454 <td style="padding:30px;text-align:center;"> 455 <p style="margin:0 0 10px;font-size:11px;letter-spacing:2.5px;text-transform:uppercase;color:#b28a62;font-family:Arial,sans-serif;">This Month's Question</p> 456 <p style="margin:0;font-size:22px;line-height:1.65;color:#fff5ec;font-family:Georgia,serif;font-style:italic;">"{{the_question}}"</p> 457 </td> 458 </tr> 459 </table> 460 </td> 461 </tr> 462 463 <!-- ONE PRACTICE --> 464 <tr> 465 <td style="background:#1a0910;padding:0 40px 32px;" class="p40"> 466 <table width="100%" cellpadding="0" cellspacing="0" style="background:rgba(178,138,98,0.07);border-radius:16px;border:1px solid rgba(178,138,98,0.12);"> 467 <tr> 468 <td style="padding:26px 28px;"> 469 <p style="margin:0 0 8px;font-size:11px;letter-spacing:2px;text-transform:uppercase;color:#b28a62;font-family:Arial,sans-serif;">One Practice</p> 470 <h3 style="margin:0 0 14px;font-family:Georgia,serif;font-size:22px;font-weight:normal;color:#fff5ec;">{{practice_title}}</h3> 471 <p style="margin:0;font-size:17px;line-height:1.85;color:#f0e2d7;font-family:Georgia,serif;">{{practice_description}}</p> 472 </td> 473 </tr> 474 </table> 475 </td> 476 </tr> 477 478 <!-- CLOSING + CTA --> 479 <tr> 480 <td style="background:#1e0912;padding:0 40px 44px;text-align:center;" class="p40"> 481 <p style="margin:0 0 8px;font-size:18px;line-height:1.85;color:#f2e7dc;font-family:Georgia,serif;font-style:italic;">{{closing_line}}</p> 482 <p style="margin:0 0 28px;font-size:17px;color:#b28a62;font-family:Georgia,serif;">{{teacher_name}}<br><span style="font-size:14px;color:#9b8a80;">School for Intuitive Ascension</span></p> 483 <a href="${D}" style="display:inline-block;background:linear-gradient(180deg,#c8a06c,#a67845);color:#fff7ef;font-family:Georgia,serif;font-size:17px;font-weight:bold;padding:16px 34px;border-radius:999px;box-shadow:0 8px 20px rgba(178,138,98,0.2);">Explore Our Programs</a> 484 </td> 485 </tr> 486 487 <!-- FOOTER --> 488 <tr><td style="background:#12070d;">${W}</td></tr> 489</table> 490</td></tr> 491</table> 492</body> 493</html>`},{id:6,name:"School Message",description:"Clean & formal â spacious white content area, formal header banner, and a clean footer",thumbnail_bg:"linear-gradient(135deg, #492533 0%, #ffffff 50%, #f3f0e9 100%)",subject:"A message from the School for Intuitive Ascension",html:`<!DOCTYPE html> 494 <html lang="en"> 495 <head> 496 <meta charset="UTF-8"/> 497 <meta name="viewport" content="width=device-width,initial-scale=1.0"/> 498 <title>A Message From The School â Intuitive Ascension</title> 499 <style> 500 body{margin:0;padding:0;background:#f3f0e9;font-family:Arial,Helvetica,sans-serif;} 501 img{border:0;display:block;max-width:100%;} 502 a{text-decoration:none;} 503 @media only screen and (max-width:600px){ 504 .content-td { padding: 40px 20px !important; } 505 .header-td { padding: 30px 20px !important; } 506 } 507 </style> 508 </head> 509 <body> 510 <table width="100%" cellpadding="0" cellspacing="0" style="background:#f3f0e9;padding:20px 0;"> 511 <tr> 512 <td align="center"> 513 <table width="760" cellpadding="0" cellspacing="0" style="max-width:760px;width:100%;background:#ffffff;
513border:1px solid #e6dccf;border-radius:18px;overflow:hidden;box-shadow:0 4px 20px rgba(0,0,0,0.05);"> 514 <!-- HEADER --> 515 <tr> 516 <td class="header-td" style="background:#492533;padding:40px 30px;text-align:center;"> 517 <img src="https://storage.googleapis.com/star_magic_healing/School_for_ia/trans_logo_bigg.png" alt="School for Intuitive Ascension" style="max-width:220px;width:70%;height:auto;margin:0 auto 20px;display:block;"> 518 <h1 style="margin:0;color:#FFF5EC;font-size:32px;font-weight:600;font-family:Arial,Helvetica,sans-serif;"> 519 A Message From The School 520 </h1> 521 </td> 522 </tr> 523 <!-- BODY CONTENT --> 524 <tr> 525 <td class="content-td" style="padding:60px 40px;min-height:450px;background:#ffffff;"> 526 {{opening_paragraph}} 527 </td> 528 </tr> 529 <!-- COMPLIANT FOOTER --> 530 <tr> 531 <td style="background:#f3f0e9;padding:24px;text-align:center;border-top:1px solid #e0d6c9;font-family:Arial,Helvetica,sans-serif;"> 532 <p style="margin:0 0 8px;color:#8E6C45;font-size:13px;font-weight:bold;"> 533 School for Intuitive Ascension 534 </p> 535 <p style="margin:0;font-size:11px;color:#7a6b63;"> 536 <a href="{{unsubscribe_url}}" style="color:#b28a62;text-decoration:underline;">Unsubscribe</a> 537 · 538 <a href="https://schoolforintuitiveascension.net/PrivacyPolicy" style="color:#b28a62;text-decoration:underline;">Privacy Policy</a> 539 </p> 540 </td> 541 </tr> 542 </table> 543 </td> 544 </tr> 545 </table> 546 </body> 547 </html>`}];function Yt({onSelect:a,selectedTemplateName:m}){const[l,o]=i.useState(null);return e.jsxs("div",{children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-3",children:Se.map(n=>{const x=m===n.subject;return e.jsxs("div",{className:`group rounded-xl border bg-white shadow-sm overflow-hidden transition-all ${x?"border-amber-500 ring-2 ring-amber-400 shadow-amber-100":"border-gray-100 hover:shadow-md hover:border-amber-200"}`,children:[e.jsxs("div",{className:"h-24 w-full flex items-center justify-center relative",style:{background:n.thumbnail_bg},children:[e.jsx("img",{src:R,alt:"",style:{height:24,opacity:.85}}),x&&e.jsxs("div",{className:"absolute top-2 right-2 bg-amber-500 text-white text-xs font-bold px-2 py-0.5 rounded-full flex items-center gap-1",children:[e.jsx(F,{className:"w-3 h-3"}),"Selected"]})]}),e.jsxs("div",{className:"p-3",children:[e.jsx("p",{className:"text-sm font-semibold",style:{color:"#492533"},children:n.name}),e.jsx("p",{className:"text-xs text-gray-400 mt-0.5 leading-snug",children:n.description}),e.jsxs("div",{className:"flex gap-1.5 mt-3",children:[e.jsxs(d,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2 text-gray-500 hover:text-gray-800",onClick:()=>o(n),children:[e.jsx(ce,{className:"w-3 h-3 mr-1"}),"Preview"]}),e.jsxs(d,{size:"sm",className:"h-7 text-xs px-2 flex-1",style:{backgroundColor:x?"#b28a62":"#492533"},onClick:()=>a(n),children:[e.jsx(F,{className:"w-3 h-3 mr-1"}),x?"Selected â":"Use"]})]})]})]},n.id)})}),e.jsx(J,{open:!!l,onOpenChange:()=>o(null),children:e.jsxs(X,{className:"max-w-3xl max-h-[90vh] overflow-hidden flex flex-col",children:[e.jsxs(Z,{children:[e.jsx(ee,{style:{color:"#492533"},children:l==null?void 0:l.name}),e.jsxs("p",{className:"text-sm text-gray-500",children:["Subject: ",l==null?void 0:l.subject]})]}),e.jsx("div",{className:"flex-1 overflow-hidden rounded-lg border border-gray-200",style:{minHeight:500},children:e.jsx("iframe",{srcDoc:(l==null?void 0:l.html)||"",title:"Template Preview",className:"w-full h-full border-0",style:{minHeight:500},sandbox:"allow-same-origin"})}),e.jsxs("div",{className:"flex justify-end gap-2 pt-3",children:[e.jsx(d,{variant:"outline",onClick:()=>o(null),children:"Close"}),e.jsxs(d,{style:{backgroundColor:"#492533"},onClick:()=>{a(l),o(null)},children:[e.jsx(F,{className:"w-4 h-4 mr-2"}),"Use This Template"]})]})]})})]})}function Qt(){const a=new Date().getMonth();return a>=2&&a<=4?"Spring":a>=5&&a<=7?"Summer":a>=8&&a<=10?"Autumn":"Winter"}
547function Vt(){return new Date().toLocaleString("en-US",{month:"long",year:"numeric"})}function Wt(a,m="#f2e7dc"){const l=`margin:0 0 18px;font-size:18px;line-height:1.85;color:${m};font-family:Georgia,serif;`;return a.split(/\n\n+/).map(o=>o.trim()).filter(Boolean).map(o=>/<[a-z][\s\S]*>/i.test(o)?`<div style="${l}">${o}</div>`:`<p style="${l}">${o.replace(/\n/g,"<br/>")}</p>`).join(` 548`)}function lt({template:a,subject:m,content:l,addGreeting:o}){const n=Vt(),x=Qt(),u=!a.html.includes("background:#fff")&&!a.html.includes("background:'#fff")?"#f2e7dc":"#492533",g=Wt(l,u),O=(o?`<p style="margin:0 0 18px;font-size:18px;line-height:1.85;color:${u};font-family:Georgia,serif;">Dear {first_name},</p> 549`:"")+g;let S=a.html,N=m;const C={month_year:n,season_name:x,opening_paragraph:O,main_content:"",letter_paragraph_1:O,letter_paragraph_2:"",letter_paragraph_3:"",hero_subtext:"",seasonal_opening:"",newsletter_headline:m,seasonal_headline:m,letter_title:m,main_story_headline:m,main_story_body:O,main_story_link:"",insight_title:"",insight_body:"",insight_1_title:"",insight_1_body:"",insight_2_title:"",insight_2_body:"",insight_3_title:"",insight_3_body:"",skill_title:"",skill_content:"",student_quote:"",student_name:"",student_program:"",resource_1:"",resource_2:"",resource_3:"",event_date:"",event_name:"",event_description:"",event_link:"",ritual_title:"",ritual_description:"",ritual_step_1:"",ritual_step_2:"",ritual_step_3:"",community_update:"",program_1_name:"",program_1_date:"",program_2_name:"",program_2_date:"",program_3_name:"",program_3_date:"",closing_reflection:"",closing_line:"",teacher_name:"The Intuitive Ascension Team",the_question:"",practice_title:"",practice_description:"",first_name:"{first_name}",unsubscribe_url:"{unsubscribe_url}"};for(const[c,_]of Object.entries(C)){const U=new RegExp(`\\{\\{${c}\\}\\}`,"g");S=S.replace(U,_),N=N.replace(U,_)}return S=S.replace(/\{\{[^}]+\}\}/g,""),N=N.replace(/\{\{[^}]+\}\}/g,"").trim(),{html:S,subject:N}}function Jt({template:a,onReady:m}){const l=c=>c?c.replace(/\{\{[^}]+\}\}/g,"").replace(/^[\s,]+|[\s,]+$/g,"").trim():"",[o,n]=i.useState(()=>l(a==null?void 0:a.subject)),[x,r]=i.useState(""),[u,g]=i.useState(!0),[A,O]=i.useState(!1),S=i.useMemo(()=>{if(!x.trim()&&!o.trim())return null;const{html:c}=lt({template:a,subject:o||"(subject)",content:x||"(your content will appear here)",addGreeting:u});return c},[a,o,x,u]),N=(a==null?void 0:a.name)||"";if(i.useEffect(()=>{n(l(a==null?void 0:a.subject)),r("")},[N]),!a)return null;const C=()=>{if(!x.trim()||!o.trim())return;const{html:c,subject:_}=lt({template:a,subject:o,content:x,addGreeting:u});m({subject:_,html_body:c})};return e.jsxs(pe,{className:"border-0 shadow-sm",children:[e.jsxs(me,{className:"pb-3",children:[e.jsxs(xe,{className:"text-base flex items-center gap-2",style:{color:"#492533"},children:[e.jsx(ot,{className:"w-4 h-4",style:{color:"#B28A62"}}),"Compose Manually"]}),e.jsxs("p",{className:"text-xs text-gray-400",children:["Paste your content below â it will be wrapped in the ",e.jsx("strong",{children:a.name})," design and sent with each person's name automatically inserted."]})]}),e.jsxs(ge,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm font-medium",style:{color:"#492533"},children:"Subject Line"}),e.jsx(I,{value:o,onChange:c=>n(c.target.value),placeholder:"Enter your email subject line..."})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border border-amber-100 bg-amber-50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ft,{className:"w-4 h-4",style:{color:"#B28A62"}}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",style:{color:"#492533"},children:"Personalized Greeting"}),e.jsx("p",{className:"text-xs text-gray-400",children:'Automatically adds "Dear [Name]," at the top for each recipient'})]})]}),e.jsx(rt,{checked:u,onCheckedChange:g})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm font-medium",style:{color:"#492533"},children:"Your Content"}),e.jsx(te,{rows:10,value:x,onChange:c=>r(c.target.value),placeholder:"Paste or type your newsletter content here. Use double line breaks to separate paragraphs...",className:"resize-y"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Separate paragraphs with a blank line. Each person's name will be inserted automatically when sent."})]}),S&&e.jsxs("div",{children:[e.jsxs(d,{variant:"outline",className:"w-full mb-3",onClick:()=>O(c=>!c),children:[A?e.jsx(Lt,{className:"w-4 h-4 mr-2"}):e.jsx(ce,{className:"w-4 h-4 mr-2"}),A?"Hide Preview":"Preview Email"]}),A&&e.jsx("div",{className:"rounded-lg border border-gray-200 overflow-hidden",style:{height:"500px"},children:e.jsx("iframe",{srcDoc:S,title:"Email Preview",className:"w-full h-full",sandbox:"allow-same-origin"})})]}),e.jsxs(d,{className:"w-full",style:{backgroundColor:"#492533"},onClick:C,disabled:!x.trim()||!o.trim(),children:[e.jsx(F,{className:"w-4 h-4 mr-2"}),"Build Email"]})]})]})}function Xt({drafts:a,onOpen:m}){return a.length?e.jsxs("section",{className:"rounded-2xl border border-amber-100 bg-white p-4 shadow-sm",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(ot,{className:"h-4 w-4 text-amber-700"}),e.jsx("h2",{className:"text-sm font-semibold text-gray-800",children:"Saved Drafts"})]}),e.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:a.map(l
549=>e.jsxs("div",{className:"flex min-w-0 items-center gap-3 rounded-xl border border-gray-100 p-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm font-medium text-gray-800",children:l.subject}),e.jsxs("p",{className:"mt-0.5 text-xs text-gray-400",children:[l.audience_name||"Newsletter subscribers"," · ",new Date(l.updated_date||l.created_date).toLocaleDateString()]})]}),e.jsx(d,{size:"sm",variant:"outline",onClick:()=>m(l),children:"Open"})]},l.id))})]}):null}function Zt({html:a,reviewed:m,onReviewedChange:l}){const o=Et.useMemo(()=>{const n=new DOMParser().parseFromString(a||"","text/html");return[...new Set([...n.querySelectorAll("a[href]")].map(x=>x.getAttribute("href")).filter(Boolean))]},[a]);return e.jsxs("div",{className:"rounded-xl border border-amber-200 bg-amber-50 p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-amber-900",children:[e.jsx(dt,{className:"h-4 w-4"})," Link review (",o.length,")"]}),o.length?e.jsx("ul",{className:"max-h-28 space-y-1 overflow-y-auto",children:o.map(n=>e.jsx("li",{className:"break-all font-mono text-xs text-amber-800",children:n},n))}):e.jsx("p",{className:"text-xs text-amber-700",children:"No linked URLs were found in this email."}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2 text-xs font-medium text-amber-900",children:[e.jsx("input",{type:"checkbox",checked:m,onChange:n=>l(n.target.checked),className:"mt-0.5 h-4 w-4"}),"I reviewed every link above and confirm these are the exact destinations to send."]})]})}const ct={brand_voice:"Brand Voice",mission_values:"Mission & Values",key_topics:"Key Topics",audience:"Audience",cta_library:"CTA Library",tone_rules:"Tone Rules",signature:"Signature",newsletter_structure:"Newsletter Structure"},es={brand_voice:"bg-purple-100 text-purple-700",mission_values:"bg-amber-100 text-amber-700",key_topics:"bg-blue-100 text-blue-700",audience:"bg-green-100 text-green-700",cta_library:"bg-orange-100 text-orange-700",tone_rules:"bg-pink-100 text-pink-700",signature:"bg-gray-100 text-gray-700",newsletter_structure:"bg-teal-100 text-teal-700"};function ts({entries:a,onAdd:m,onEdit:l,onDelete:o}){return e.jsxs(pe,{className:"border-0 shadow-sm h-full",children:[e.jsxs(me,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(xe,{className:"text-base flex items-center gap-2",style:{color:"#492533"},children:[e.jsx(Ut,{className:"w-4 h-4",style:{color:"#B28A62"}}),"Knowledge Base"]}),e.jsxs(d,{size:"sm",variant:"outline",onClick:m,children:[e.jsx($t,{className:"w-3 h-3 mr-1"}),"Add"]})]}),e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"The AI reads all active entries to craft your newsletter."})]}),e.jsx(ge,{className:"space-y-2 overflow-y-auto max-h-[520px]",children:a.length===0?e.jsx("p",{className:"text-sm text-gray-400 text-center py-8",children:"No entries yet. Add brand voice, mission, topics, and more."}):a.map(n=>e.jsx("div",{className:`p-3 rounded-lg border ${n.is_active?"border-gray-100 bg-white":"border-dashed border-gray-200 bg-gray-50 opacity-60"}`,children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx(Rt,{className:`text-xs border-0 ${es[n.category]||"bg-gray-100 text-gray-700"}`,children:ct[n.category]||n.category}),!n.is_active&&e.jsx("span",{className:"text-xs text-gray-400",children:"(inactive)"})]}),e.jsx("p",{className:"text-sm font-medium mt-1",style:{color:"#492533"},children:n.title}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5 line-clamp-2",children:n.content})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsx(d,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:()=>l(n),children:e.jsx(Ht,{className:"w-3 h-3"})}),e.jsx(d,{size:"icon",variant:"ghost",className:"h-7 w-7 text-red-400 hover:text-red-600",onClick:()=>o(n.id),children:e.jsx(Kt,{className:"w-3 h-3"})})]})]})},n.id))})]})}function Ns(){var Ve,We;const[a,m]=i.useState(""),[l,o]=i.useState(""),[n,x]=i.useState(!1),[r,u]=i.useState(null),[g,A]=i.useState(null),[O,S]=i.useState(!1),[N,C]=i.useState(null),[c,_]=i.useState({}),[U,Ce]=i.useState(!1),[pt,L]=i.useState(!1),[v,he]=i.useState([]),[se,Te]=i.useState(!1),[b,z]=i.useState(null),[ss,as]=i.useState(""),[is,mt]=i.useState(!1),[p,fe]=i.useState("saved"),[k,Ae]=i.useState(""),[ae,ze]=i.useState(""),[Ee,Ge]=i.useState(!1),[xt,ue]=i.useState(!1),[ie,Ie]=i.useState(""),[De,Oe]=i.useState(!1),[$,H]=i.useState(null),[P,Pe]=i.useState("ai"),[K,ye]=i.useState("now"),[M,Re]=i.useState(""),[B,Fe]=i.useState(""),[Le,Me]=i.useState(!1),[Be,Ue]=i.useState(!1),[ne,$e]=i.useState(null),[be,He]=i.useState(!1),q=Gt(),{data:gt=[]}=V({queryKey:["knowledge-base"],queryFn:()=>y.entities.KnowledgeBase.list("priority",200)}),{data:ht=[]}=V({queryKey:["persons-tags"],queryFn:()=>y.entities.Person.list("-created_date",2e3)}),{data:le=[]}=V({queryKey:["audiences"],queryFn:()=>y.entities.Audience.filter({status:"active"},"-updated_date",100)}),{data:ft=[]}=V({queryKey:["newsletter-drafts"],queryFn:()=>y.entities.ScheduledNewsletter.filter({status:"draft"},"-updated_date",20)}),ut=t=>{he(s=>s.includes(t)?s.filter(f=>f!==t):[...s,t])},h=le.find(t=>
549t.id===k),re=()=>p==="saved"&&h?{include:h.include_tags||[],exclude:h.exclude_tags||[],matchMode:h.match_mode||"any"}:{include:v,exclude:[],matchMode:"any"},yt=["Unsubscribed","Do Not Email","Bounced Email"],{data:bt=0,isFetching:je}=V({queryKey:["newsletter-audience-count",k],queryFn:async()=>{var s,f;return((f=(s=(await y.functions.invoke("getAudienceContacts",{audience_id:k})).data)==null?void 0:s.contacts)==null?void 0:f.length)||0},enabled:p==="saved"&&!!k}),Y=(()=>{if(p==="saved"&&h)return bt;const{include:t,exclude:s,matchMode:f}=re();return ht.filter(T=>{if(!T.email||!T.consent_newsletter||T.email_deliverability&&!["deliverable",null,void 0,""].includes(T.email_deliverability))return!1;const j=T.tags||[];return j.some(w=>yt.includes(w))||s.length>0&&j.some(w=>s.includes(w))?!1:t.length>0?f==="all"?t.every(w=>j.includes(w)):j.some(w=>t.includes(w)):!0}).length})(),jt=async()=>{if(!(!ae.trim()||v.length===0)){Ge(!0);try{await y.entities.Audience.create({name:ae.trim(),audience_type:"dynamic",match_mode:"any",include_tags:v,exclude_tags:[],status:"active",estimated_count:Y}),q.invalidateQueries({queryKey:["audiences"]}),ze(""),alert("Audience saved!")}catch(t){alert("Failed to save audience: "+t.message)}finally{Ge(!1)}}},wt=async()=>{if(r){Ue(!0);try{const{include:t}=re(),s={subject:r.subject,html_body:r.html_body,tags:t,audience_id:p==="saved"?k:"",audience_name:p==="saved"&&(h==null?void 0:h.name)||"",audience_mode:p,status:"draft"},f=ne?await y.entities.ScheduledNewsletter.update(ne,s):await y.entities.ScheduledNewsletter.create(s);$e(f.id||ne),await q.invalidateQueries({queryKey:["newsletter-drafts"]})}catch(t){alert("Failed to save draft: "+t.message)}finally{Ue(!1)}}},vt=t=>{u({subject:t.subject,html_body:t.html_body}),$e(t.id),fe(t.audience_mode||"custom"),Ae(t.audience_id||""),he(t.tags||[]),z(null)},[Nt,Ke]=i.useState(null),qe=async(t=!0)=>{Te(!0),z(null);const{include:s,exclude:f,matchMode:T}=re();try{let j=Nt;!t&&!j&&(j=(await y.entities.ScheduledNewsletter.create({subject:r.subject,html_body:r.html_body,audience_id:p==="saved"?k:"",audience_name:p==="saved"&&(h==null?void 0:h.name)||"",audience_mode:p,scheduled_at:new Date().toISOString(),status:"pending"})).id,Ke(j));const w={subject:r.subject,html_body:r.html_body,dry_run:t,scheduled_newsletter_id:j||null,override_window:!0};p==="saved"&&h?w.audience_id=h.id:w.tags=s.length>0?s:[];const E={...(await y.functions.invoke("sendNewsletterBroadcast",w)).data,was_dry_run:t};z(E),!t&&j&&!E.error&&!E.deferred&&(await y.entities.ScheduledNewsletter.update(j,{status:"sent",sent_at:new Date().toISOString(),sent_count:E.sent||0,total_recipients:E.total||0}),Ke(null))}catch(j){z({error:j.message})}finally{Te(!1)}},we=Ne({mutationFn:t=>y.entities.KnowledgeBase.create(t),onSuccess:()=>{q.invalidateQueries({queryKey:["knowledge-base"]}),C(null)}}),ve=Ne({mutationFn:({id:t,data:s})=>y.entities.KnowledgeBase.update(t,s),onSuccess:()=>{q.invalidateQueries({queryKey:["knowledge-base"]}),C(null)}}),_t=Ne({mutationFn:t=>y.entities.KnowledgeBase.delete(t),onSuccess:()=>q.invalidateQueries({queryKey:["knowledge-base"]})}),kt=()=>{_({is_active:!0,priority:1,category:"brand_voice"}),C("new")},St=t=>{_({...t}),C(t)},Ct=()=>{N==="new"?we.mutate(c):ve.mutate({id:N.id,data:c})},Ye=async()=>{x(!0),u(null);try{const t=l.split(` 550`).map(T=>T.trim()).filter(Boolean),f=(await y.functions.invoke("generateNewsletter",{content_updates:a,urls:t,template_html:(g==null?void 0:g.html)||null,template_subject:(g==null?void 0:g.subject)||null})).data;if(!f||!f.subject||!f.html_body)throw new Error("Invalid response from AI: "+JSON.stringify(f));u({subject:f.subject,html_body:f.html_body})}catch(t){console.error("Generation failed:",t),alert("Failed to generate newsletter: "+(t.message||"Please try again."))}finally{x(!1)}},Qe=async()=>{if(ie){Oe(!0),H(null);try{const t=await y.functions.invoke("sendTestNewsletter",{subject:r.subject,html_body:r.html_body,test_email:ie});H(t.data)}catch(t){H({error:t.message})}finally{Oe(!1)}}},Tt=async()=>{if(!M||!B)return;const[t,s,f]=M.split("-").map(Number),[T,j]=B.split(":").map(Number),w=new Date(t,s-1,f,T,j,0,0);if(Number.isNaN(w.getTime())||w<=new Date){alert("Please choose a valid date and time in the future.");return}Me(!0);try{const Q=w.toISOString(),{include:E}=re();await y.entities.ScheduledNewsletter.create({subject:r.subject,html_body:r.html_body,tags:E.length>0?E:[],audience_id:p==="saved"?k:"",audience_name:p==="saved"&&(h==null?void 0:h.name)||"",audience_mode:p,scheduled_at:Q,status:"pending"}),L(!1),ye("now"),Re(""),Fe(""),alert(`Newsletter scheduled for ${new Date(Q).toLocaleStr
550ing()}!`)}catch(Q){alert("Failed to schedule: "+Q.message)}finally{Me(!1)}},At=()=>{navigator.clipboard.writeText((r==null?void 0:r.html_body)||""),Ce(!0),setTimeout(()=>Ce(!1),2e3)};return e.jsxs("div",{className:"max-w-6xl mx-auto space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[e.jsxs(It,{to:Dt("Dashboard"),className:"hover:text-gray-700 flex items-center gap-1",children:[e.jsx(Ot,{className:"w-4 h-4"}),"Dashboard"]}),e.jsx(Pt,{className:"w-4 h-4"}),e.jsx("span",{className:"text-gray-900",children:"Newsletter Composer"})]}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-light",style:{color:"#492533"},children:"Newsletter Composer"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a pre-made template or let AI craft a custom newsletter from your knowledge base."})]}),e.jsx(Xt,{drafts:ft,onOpen:vt}),e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(de,{className:"w-4 h-4",style:{color:"#B28A62"}}),e.jsx("h2",{className:"text-base font-medium",style:{color:"#492533"},children:"Start with a Template"}),e.jsx("span",{className:"text-xs text-gray-400 ml-1",children:"â click Use to load it as your starting HTML"})]}),e.jsx(Yt,{onSelect:t=>{A({subject:t.subject,html:t.html,name:t.name}),u(null)},selectedTemplateName:g==null?void 0:g.subject})]}),e.jsxs("div",{className:"grid lg:grid-cols-5 gap-6",children:[e.jsx("div",{className:"lg:col-span-2",children:e.jsx(ts,{entries:gt,onAdd:kt,onEdit:St,onDelete:t=>_t.mutate(t)})}),e.jsxs("div",{className:"lg:col-span-3 space-y-4",children:[e.jsxs("div",{className:"flex rounded-xl overflow-hidden border bg-white p-1 gap-1",style:{borderColor:"rgba(73,37,51,0.12)"},children:[e.jsxs("button",{onClick:()=>{Pe("ai"),u(null)},className:"flex-1 py-2.5 text-sm font-medium transition-all rounded-lg flex items-center justify-center gap-2",style:{background:P==="ai"?"#492533":"transparent",color:P==="ai"?"white":"#786b70"},children:[e.jsx(_e,{className:"w-4 h-4"}),"AI Assistant Writer"]}),e.jsxs("button",{onClick:()=>{if(Pe("manual"),u(null),!g&&Se.length>0){const t=Se[0];A({subject:t.subject,html:t.html,name:t.name})}},className:"flex-1 py-2.5 text-sm font-medium transition-all rounded-lg flex items-center justify-center gap-2",style:{background:P==="manual"?"#492533":"transparent",color:P==="manual"?"white":"#786b70"},children:[e.jsx(de,{className:"w-4 h-4"}),"Compose Manually"]})]}),P==="ai"&&e.jsxs(pe,{className:"border-0 shadow-sm",children:[e.jsxs(me,{className:"pb-3",children:[e.jsx(xe,{className:"text-base",style:{color:"#492533"},children:"Content for This Issue"}),e.jsx("p",{className:"text-xs text-gray-400",children:"What should be in this newsletter? The AI will weave it into your brand voice."})]}),e.jsxs(ge,{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm font-medium",style:{color:"#492533"},children:"Updates, Announcements & Stories"}),e.jsx(te,{rows:6,value:a,onChange:t=>m(t.target.value),placeholder:"e.g. We just launched our new Core Intuitive Training. Sarah completed her certification. Upcoming workshop on May 10th. New healing circle forming..."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("label",{className:"text-sm font-medium flex items-center gap-1.5",style:{color:"#492533"},children:[e.jsx(dt,{className:"w-3.5 h-3.5"}),"Blog / Article URLs ",e.jsx("span",{className:"text-xs text-gray-400 font-normal",children:"(one per line, max 3)"})]}),e.jsx(te,{rows:3,value:l,onChange:t=>o(t.target.value),placeholder:`https://yoursite.com/blog/post-1 551https://yoursite.com/blog/post-2`,className:"font-mono text-xs"})]}),g&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-amber-50 border border-amber-200 text-sm",children:[e.jsx(de,{className:"w-3.5 h-3.5 text-amber-600 flex-shrink-0"}),e.jsx("span",{className:"text-amber-800 flex-1",children:"Template selected â AI will fill this layout with your content"}),e.jsx("button",{onClick:()=>A(null),className:"text-amber-500 hover:text-amber-700 text-xs underline flex-shrink-0",children:"Clear"})]}),e.jsx(d,{onClick:Ye,disabled:n||!a&&!l,className:"w-full",style:{backgroundColor:"#492533"},children:n?e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 mr-2 animate-spin"}),"Writing your newsletter..."]}
551):e.jsxs(e.Fragment,{children:[e.jsx(_e,{className:"w-4 h-4 mr-2"}),"Generate Newsletter with AI"]})}),n&&e.jsx("p",{className:"text-xs text-center text-gray-400",children:"This uses Claude Sonnet for beautiful results â takes about 15â20 seconds."})]})]}),P==="manual"&&g&&e.jsx(Jt,{template:g,onReady:t=>u({subject:t.subject,html_body:t.html_body})}),P==="manual"&&!g&&e.jsxs("div",{className:"rounded-xl border border-dashed border-amber-300 bg-amber-50 p-6 text-center text-sm text-amber-700",children:[e.jsx(de,{className:"w-6 h-6 mx-auto mb-2 text-amber-500"}),"Please select a template above to compose manually."]}),r&&e.jsxs(pe,{className:"border-0 shadow-sm",children:[e.jsx(me,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[e.jsxs("div",{children:[e.jsxs(xe,{className:"text-base flex items-center gap-2",style:{color:"#492533"},children:[e.jsx(F,{className:"w-4 h-4 text-green-500"}),"Newsletter Ready"]}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Subject: ",e.jsx("span",{className:"font-medium",children:r.subject})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(d,{size:"sm",variant:"outline",onClick:wt,disabled:Be,children:[Be?e.jsx(G,{className:"w-3 h-3 mr-1 animate-spin"}):e.jsx(at,{className:"w-3 h-3 mr-1"}),ne?"Update Draft":"Save Draft"]}),e.jsxs(d,{size:"sm",variant:"outline",onClick:()=>S(!0),children:[e.jsx(ce,{className:"w-3 h-3 mr-1"}),"Preview"]}),e.jsxs(d,{size:"sm",variant:"outline",onClick:At,children:[U?e.jsx(F,{className:"w-3 h-3 mr-1 text-green-500"}):e.jsx(Bt,{className:"w-3 h-3 mr-1"}),U?"Copied!":"Copy HTML"]}),e.jsxs(d,{size:"sm",variant:"outline",onClick:Ye,disabled:n,children:[e.jsx(_e,{className:"w-3 h-3 mr-1"}),"Regenerate"]}),e.jsxs(d,{size:"sm",variant:"outline",onClick:()=>{ue(!0),H(null),Ie("")},children:[e.jsx(it,{className:"w-3 h-3 mr-1"}),"Send Test"]}),e.jsxs(d,{size:"sm",onClick:()=>{L(!0),z(null),ye("now"),He(!1)},style:{backgroundColor:"#492533"},children:[e.jsx(oe,{className:"w-3 h-3 mr-1"}),"Send"]})]})]})}),e.jsx(ge,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-xs text-gray-500",children:"Subject Line"}),e.jsx(I,{value:r.subject,onChange:t=>u(s=>({...s,subject:t.target.value}))}),e.jsx("label",{className:"text-xs text-gray-500 mt-2 block",children:"HTML Body"}),e.jsx(te,{rows:10,value:r.html_body,onChange:t=>u(s=>({...s,html_body:t.target.value})),className:"font-mono text-xs"})]})})]})]})]}),e.jsx(J,{open:O,onOpenChange:S,children:e.jsxs(X,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(Z,{children:[e.jsx(ee,{style:{color:"#492533"},children:"Newsletter Preview"}),e.jsxs("p",{className:"text-sm text-gray-500",children:["Subject: ",r==null?void 0:r.subject]})]}),e.jsx("iframe",{srcDoc:(r==null?void 0:r.html_body)||"",title:"Newsletter Preview",className:"w-full border-0 rounded-lg",style:{height:600},sandbox:"allow-same-origin"})]})}),e.jsx(J,{open:pt,onOpenChange:L,children:e.jsxs(X,{className:"w-[calc(100%-2rem)] max-w-2xl max-h-[90vh] overflow-hidden",children:[e.jsx(Z,{children:e.jsxs(ee,{style:{color:"#492533"},className:"flex items-center gap-2",children:[e.jsx(oe,{className:"w-4 h-4"}),"Send Newsletter"]})}),b?e.jsxs("div",{className:"py-4 space-y-3",children:[b.error?e.jsx("div",{className:"bg-red-50 text-red-700 rounded-lg p-4 text-sm",children:b.error}):b.was_dry_run?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"bg-amber-50 border border-amber-200 text-amber-800 rounded-lg p-4 text-sm space-y-2",children:[e.jsx("p",{className:"font-semibold flex items-center gap-2",children:"𧪠Dry Run Complete â No Emails Sent"}),e.jsxs("p",{children:[e.jsx("strong",{children:b.total_recipients})," recipients would receive this newsletter."]}),((Ve=b.sample_recipients)==null?void 0:Ve.length)>0&&e.jsxs("div",{children:[e.jsx("p",{className:"font-medium mt-2 mb-1",children:"Sample recipients:"}),e.jsx("ul",{className:"space-y-1",children:b.sample_recipients.map((t,s)=>e.jsxs("li",{className:"text-xs text-amber-700",children:[t.name||t.email," â ",e.jsxs("span",{className:"italic",children:['"',t.subject_preview,'"']})]},s))})]})]}),e.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3 text-sm text-red-700",children:["â ï¸ ",e.jsx("strong",{children:"Ready to send for real?"})," Click below only when you have reviewed the preview above and are confident."]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(d,{variant:"outline",className:"flex-1",onClick:()=>{L(!1),z(null),mt(!1)},children:"Cancel"}),e.jsxs(d,{className:"flex-1 bg-red-700 hover:bg-red-800 text-white",disabled:se||!be,onClick:()=>{z(null),qe(!1)},children:[se?e.jsx(G,{className:"w-3 h-3 mr-1 animate-spin"}):e.jsx(oe,{className:"w-3 h-3 mr-1"}),"Send LIVE to ",b.total_recipients," people"]})]})]}):e.jsxs("div",{className:"bg-green-50 text-green-700 rounded-lg p-4 text-sm space-y-1",children:[e.jsxs("p",{className:"font-semibold flex items-center gap-2",children:[e.jsx(F,{className:"w-4 h-4"}),"Newsletter sent!"]}),e.jsxs("p",{children:["Successfully sent to ",e.jsx("strong",{children:b.sent})," of ",e.jsx("strong",{children:b.total}
551)," recipients via Gmail.",b.skipped_already_sent>0?` (${b.skipped_already_sent} already received â skipped)`:""]}),((We=b.errors)==null?void 0:We.length)>0&&e.jsxs("p",{className:"text-red-500 text-xs mt-1",children:[b.errors.length," failed. Check logs for details."]})]}),!b.was_dry_run&&e.jsx(d,{variant:"outline",className:"w-full",onClick:()=>{L(!1),z(null)},children:"Close"})]}):e.jsxs("div",{className:"min-w-0 space-y-4 overflow-y-auto py-2 pr-1",children:[e.jsx("div",{className:"bg-amber-50 rounded-lg p-3 text-sm text-amber-800",children:e.jsxs("p",{className:"font-medium",children:["Subject: ",r==null?void 0:r.subject]})}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-sm font-medium flex items-center gap-1.5 mb-2",style:{color:"#492533"},children:[e.jsx(Je,{className:"w-3.5 h-3.5"}),"Send To"]}),e.jsxs("div",{className:"flex rounded-xl overflow-hidden border",style:{borderColor:"rgba(73,37,51,0.15)"},children:[e.jsx("button",{onClick:()=>fe("saved"),className:"flex-1 py-2 text-sm font-medium transition-all",style:{background:p==="saved"?"#492533":"#fffdfb",color:p==="saved"?"white":"#786b70"},children:"Saved Audience"}),e.jsx("button",{onClick:()=>fe("custom"),className:"flex-1 py-2 text-sm font-medium transition-all",style:{background:p==="custom"?"#492533":"#fffdfb",color:p==="custom"?"white":"#786b70"},children:"Custom Tag Filter"})]})]}),p==="saved"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"space-y-2 max-h-52 overflow-y-auto",children:le.length===0?e.jsx("p",{className:"text-xs text-gray-400 italic p-2",children:"No saved audiences yet. Switch to Custom Tag Filter or create audiences in Audience Builder."}):le.map(t=>{var s;return e.jsx("button",{onClick:()=>Ae(t.id),className:"w-full min-w-0 overflow-hidden text-left p-3 rounded-xl border transition-all",style:{background:k===t.id?"linear-gradient(135deg, #FFF5EC, #fff)":"#fffdfb",border:k===t.id?"1.5px solid #B28A62":"1px solid rgba(73,37,51,0.12)",boxShadow:k===t.id?"0 4px 14px rgba(178,138,98,0.18)":"none"},children:e.jsx("div",{className:"flex items-center justify-between gap-2",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"font-semibold text-sm truncate",style:{color:"#492533"},children:[k===t.id&&e.jsx("span",{className:"mr-1.5",style:{color:"#2f8f68"},children:"â"}),t.name]}),t.description&&e.jsx("p",{className:"text-xs text-gray-400 mt-0.5 truncate",children:t.description}),e.jsxs("div",{className:"flex items-center gap-2 mt-1.5 flex-wrap",children:[e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-medium",style:{background:"#FFF5EC",color:"#8E6C45",border:"1px solid #CBAE8D"},children:t.audience_type==="dynamic"?"â¡ Dynamic":"ð¸ Snapshot"}),((s=t.include_tags)==null?void 0:s.length)>0&&e.jsxs("span",{className:"text-xs text-gray-400",children:[t.include_tags.length," include tag",t.include_tags.length!==1?"s":""]}),t.estimated_count>0&&e.jsxs("span",{className:"text-xs font-medium",style:{color:"#2f8f68"},children:["~",t.estimated_count," contacts"]})]})]})})},t.id)})}),!k&&le.length>0&&e.jsx("p",{className:"text-xs text-gray-400 italic",children:"No audience selected â will send to all newsletter subscribers."})]}),p==="custom"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"max-h-52 overflow-y-auto space-y-3 pr-1",children:Mt.map(t=>e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-black uppercase tracking-widest mb-1.5",style:{color:"#492533",letterSpacing:"0.6px"},children:t.label}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.tags.map(s=>e.jsxs("button",{onClick:()=>ut(s),className:"px-2.5 py-1.5 rounded-full text-xs font-bold border transition-all hover:-translate-y-0.5",style:{background:v.includes(s)?"linear-gradient(135deg, #FFF5EC, #fff)":"#f8f5ef",border:v.includes(s)?"1.5px solid #B28A62":"1px solid rgba(73,37,51,0.18)",color:v.includes(s)?"#492533":"#786b70",boxShadow:v.includes(s)?"0 4px 10px rgba(178,138,98,0.18)":"none"},children:[v.includes(s)&&e.jsx("span",{style:{color:"#2f8f68",marginRight:4},children:"â"}),s]},s))})]},t.key))}),v.length>0&&e.jsx("button",{onClick:()=>he([]),className:"text-xs underline",style:{color:"#786b70"},children:"Clear all tags"}),v.length>0&&e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx(I,{className:"h-8 text-xs",placeholder:"Name this audie
551nce to save it...",value:ae,onChange:t=>ze(t.target.value)}),e.jsxs(d,{size:"sm",variant:"outline",disabled:!ae.trim()||Ee,onClick:jt,className:"flex-shrink-0",children:[Ee?e.jsx(G,{className:"w-3 h-3 animate-spin"}):e.jsx(at,{className:"w-3 h-3 mr-1"}),"Save"]})]})]}),e.jsxs("div",{className:"rounded-xl p-3 text-sm",style:{background:"#f0faf5",border:"1px solid #a7dfc4"},children:[e.jsxs("div",{className:"flex items-center gap-2 text-green-800 font-semibold",children:[e.jsx(Je,{className:"w-4 h-4 flex-shrink-0"}),e.jsx("span",{children:je?"Recomputing audienceâ¦":e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:Y})," recipient",Y!==1?"s":""," after exclusions"]})})]}),e.jsxs("p",{className:"text-xs text-green-700 mt-1",children:["Unsubscribed, Do Not Email, and bounced contacts are automatically excluded.",p==="saved"&&h?` Sending to: ${h.name}.`:p==="custom"&&v.length>0?` Filtered by ${v.length} tag${v.length!==1?"s":""}.`:" Sending to all newsletter subscribers."]})]}),e.jsx(Zt,{html:r==null?void 0:r.html_body,reviewed:be,onReviewedChange:He}),e.jsxs("div",{className:"border rounded-lg p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium flex items-center gap-1.5",style:{color:"#492533"},children:[e.jsx(nt,{className:"w-3.5 h-3.5"}),"When to send"]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:K==="now"?"font-medium text-gray-800":"text-gray-400",children:"Now"}),e.jsx(rt,{checked:K==="later",onCheckedChange:t=>ye(t?"later":"now")}),e.jsx("span",{className:K==="later"?"font-medium text-gray-800":"text-gray-400",children:"Schedule"})]})]}),K==="later"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs("label",{className:"text-xs text-gray-500 flex items-center gap-1",children:[e.jsx(Xe,{className:"w-3 h-3"}),"Date"]}),e.jsx(I,{type:"date",value:M,onChange:t=>Re(t.target.value),min:new Date().toISOString().split("T")[0]})]}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs("label",{className:"text-xs text-gray-500 flex items-center gap-1",children:[e.jsx(nt,{className:"w-3 h-3"}),"Time"]}),e.jsx(I,{type:"time",value:B,onChange:t=>Fe(t.target.value)})]})]})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx(d,{variant:"outline",className:"flex-1",onClick:()=>L(!1),children:"Cancel"}),K==="later"?e.jsx(d,{className:"flex-1",style:{backgroundColor:"#492533"},disabled:Le||je||!be||!M||!B||Y===0,onClick:Tt,children:Le?e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-3 h-3 mr-1 animate-spin"}),"Scheduling..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Xe,{className:"w-3 h-3 mr-1"}),"Schedule for ",M&&B?new Date(`${M}T${B}`).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}):"..."]})}):e.jsx(d,{className:"flex-1",style:{backgroundColor:"#B28A62"},disabled:se||je||Y===0,onClick:()=>qe(!0),children:se?e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-3 h-3 mr-1 animate-spin"}),"Running dry run..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ce,{className:"w-3 h-3 mr-1"}),"Preview Send (Dry Run)"]})})]})]})]})}),e.jsx(J,{open:xt,onOpenChange:ue,children:e.jsxs(X,{className:"max-w-md",children:[e.jsx(Z,{children:e.jsxs(ee,{style:{color:"#492533"},className:"flex items-center gap-2",children:[e.jsx(it,{className:"w-4 h-4"}),"Send Test Email"]})}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("p",{className:"text-sm text-gray-500",children:["Send a preview copy to any email address. Subject will be prefixed with ",e.jsx("strong",{children:"[Review Email]"}),"."]}),$?e.jsx("div",{className:`rounded-lg p-3 text-sm ${$.error?"bg-red-50 text-red-700":"bg-green-50 text-green-700"}`,children:$.error?`â ${$.error}`:`â
Test sent to ${$.sent_to}`}):null,e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm font-medium",style:{color:"#492533"},children:"Recipient Email"}),e.jsx(I,{type:"email",value:ie,onChange:t=>Ie(t.target.value),placeholder:"[email protected]",onKeyDown:t=>t.key==="Enter"&&Qe()})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(d,{variant:"outline",className:"flex-1",onClick:()=>{ue(!1),H(null)},children:"Close"}),e.jsx(d,{className:"flex-1",style:{backgroundColor:"#492533"},disabled:De||!ie,onClick:Qe,children:De?e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-3 h-3 mr-1 animate-spin"}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"w-3 h-3 mr-1"}),"Send Test"]})})]})]})]})}),e.jsx(J,{open:!!N,onOpenChange:()=>C(null),children:e.jsxs(X,{className:"max-w-lg",children:[e.jsx(Z,{children:e.jsx(ee,{style:{color:"#492533"},children:N==="new"?"Add Knowledge Base Entry":"Edit Entry"})}),e.jsxs("div",{className:"space-y-3 py-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm font-medium",style:{color:"#492533"},children:"Category"}),e.jsxs(Ze,{value:c.category||"",onValueChange:t=>_(s=>({...s,category:t})),children:[e.jsx(et,{children:e.jsx(tt,{placeholder:"Select category..."})}),e.jsx(st,{children:Object.entries(ct).map(([t,s])=>e.jsx(ke,{value:t,children:s},t))})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm font-medium",style:{color:"#492533"},children:"Title"}),e.jsx(I,{value:c.title||"",onChange:t=>_(s=>({...s,title:t.target.value})),placeholder:"e.g., Our Brand Voice Guidelines"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm font-medium",style:{color:"#492533"},children:"Content"}),e.jsx(te,{rows:7,value:c.content||"",onChange:t=>_(s=>({...s,content:t.target.value})),placeholder:"Write the full content for this entry. Be specific â the AI will use this verbatim as context."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm font-medium",style:{color:"#492533"},children:"Priority"}
551),e.jsx(I,{type:"number",value:c.priority??1,onChange:t=>_(s=>({...s,priority:parseInt(t.target.value)})),min:1})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm font-medium",style:{color:"#492533"},children:"Status"}),e.jsxs(Ze,{value:c.is_active?"active":"inactive",onValueChange:t=>_(s=>({...s,is_active:t==="active"})),children:[e.jsx(et,{children:e.jsx(tt,{})}),e.jsxs(st,{children:[e.jsx(ke,{value:"active",children:"Active"}),e.jsx(ke,{value:"inactive",children:"Inactive"})]})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(d,{variant:"outline",onClick:()=>C(null),children:"Cancel"}),e.jsxs(d,{onClick:Ct,disabled:we.isPending||ve.isPending||!c.title||!c.content,style:{backgroundColor:"#492533"},children:[we.isPending||ve.isPending?e.jsx(G,{className:"w-3 h-3 mr-1 animate-spin"}):null,"Save Entry"]})]})]})]})})]})}export{Ns 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.