PageSourceSearch

https://socialloop.ai/_next/static/chunks/99.4bfb3cc94d01abb0.js

js socialloop.ai collected 2026-10-05 12:45:44 UTC 77,655 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[99],{50099:(e,t,s)=>{s.r(t),s.d(t,{default:()=>E});var a=s(95155),n=s(12115),i=s(14585),l=s(39390),d=s(37401),r=s(82146),o=s(8683),c=s(12711),u=s(76849);function m(e){let{title:t,body:s,persona:n}=e,i="white_rabbit"===n;return(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"studio-label mb-3",children:"Preview"}),(0,a.jsx)("div",{className:"w-[320px]",children:(0,a.jsxs)("div",{className:"bg-[#E8E8ED] rounded-[22px] p-[14px] shadow-lg",children:[(0,a.jsxs)("div",{className:"flex items-center gap-[6px] mb-[6px]",children:[(0,a.jsx)("div",{className:"w-[20px] h-[20px] rounded-[5px] bg-black flex items-center justify-center shrink-0",children:(0,a.jsx)("span",{className:"text-[11px] leading-none",children:"S"})}),(0,a.jsx)("span",{className:"text-[11px] font-medium text-[#8E8E93] tracking-wide uppercase",children:"SOCIALLOOP"}),(0,a.jsx)("span",{className:"flex-1"}),(0,a.jsx)("span",{className:"text-[11px] text-[#8E8E93]",children:"now"})]}),(0,a.jsx)("p",{className:"text-[15px] font-bold text-black leading-snug",children:i?"White Rabbit":t||"Notification Title"}),(0,a.jsxs)("p",{className:"text-[15px] text-[#3C3C43] leading-snug mt-[1px]",style:{display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden"},children:[i&&t?"".concat(t," — "):"",s||"Message preview will appear here..."]})]})})]})}let x=[{key:"firstName",label:"First Name"},{key:"lastName",label:"Last Name"},{key:"city",label:"City"},{key:"lastEventName",label:"Last Event"}],p=["Playful weekend reminder for our audience — get them excited about upcoming events","Re-engage contacts who might have missed recent events, mention what's coming up","Hype up a new event dropping this weekend, energetic and fun tone","Thank attendees from our last event and tease what's next"];function h(e){var t,s,a,n,i,l,d,r,o,c,u;let m=e.data();return{id:e.id,name:m.name||"",persona:m.persona||"host",title:m.title||"",body:m.body||"",useAiPersonalization:null!=(o=m.useAiPersonalization)&&o,aiContext:m.aiContext,audienceType:m.audienceType||"all",segmentFilters:m.segmentFilters,manualUserIds:m.manualUserIds,distributionListId:m.distributionListId,eventId:m.eventId||void 0,eventName:m.eventName||void 0,hostName:m.hostName||void 0,estimatedAudienceSize:null!=(c=m.estimatedAudienceSize)?c:void 0,status:m.status||"draft",scheduledAt:null==(s=m.scheduledAt)||null==(t=s.toDate)?void 0:t.call(s),sentAt:null==(n=m.sentAt)||null==(a=n.toDate)?void 0:a.call(n),createdAt:(null==(l=m.createdAt)||null==(i=l.toDate)?void 0:i.call(l))||new Date,updatedAt:(null==(r=m.updatedAt)||null==(d=r.toDate)?void 0:d.call(r))||new Date,createdBy:m.createdBy||"",producerUserId:m.producerUserId,stats:m.stats||{audienceSize:0,sent:0,delivered:0,failed:0},sequenceId:m.sequenceId,sequenceName:m.sequenceName||void 0,sequenceOrder:m.sequenceOrder,sequenceTotalSteps:null!=(u=m.sequenceTotalSteps)?u:void 0}}function b(e){let{campaignId:t,duplicateFromId:s,viewMode:o="build",viewCampaignId:b,onClose:v}=e,{user:g,userProfile:f,notify:j}=(0,d.Y)(),[N,y]=(0,n.useState)(t?"edit":"prompt"),[w,k]=(0,n.useState)(""),[S,C]=(0,n.useState)(!1),L=[null==f?void 0:f.firstName,null==f?void 0:f.lastName].filter(Boolean).join(" ")||(null==g?void 0:g.displayName)||"",[A,D]=(0,n.useState)(""),[M,z]=(0,n.useState)("host"),[I,q]=(0,n.useState)(""),[E,T]=(0,n.use
1State)("now"),{eventId:B,eventData:P}=(0,r._)(),W=(null==P?void 0:P.eventName)||"",[_,F]=(0,n.useState)(""),[U,R]=(0,n.useState)(""),[O,$]=(0,n.useState)(!1),[H,Y]=(0,n.useState)(!1),[V,K]=(0,n.useState)(!1),[G,Q]=(0,n.useState)(""),[J,X]=(0,n.useState)(!1),Z=(0,n.useRef)(!1),[ee,et]=(0,n.useState)(null);(0,n.useEffect)(()=>{Z.current=!0},[A,I,M]),(0,n.useEffect)(()=>{t&&($(!0),y("edit"),(0,l.getDoc)((0,l.doc)(i.db,"notification_campaigns",t)).then(e=>{if(e.exists()){let t=h(e);if(D(t.name),z(t.persona),q(t.body),t.scheduledAt){T("later");let e=new Date(t.scheduledAt);F(e.toISOString().slice(0,10)),R(e.toTimeString().slice(0,5))}Z.current=!1}}).finally(()=>$(!1)))},[t]),(0,n.useEffect)(()=>{s&&($(!0),y("edit"),(0,l.getDoc)((0,l.doc)(i.db,"notification_campaigns",s)).then(e=>{if(e.exists()){let t=h(e);D("".concat(t.name," (copy)")),z("host"),q(t.body)}}).finally(()=>$(!1)))},[s]),(0,n.useEffect)(()=>{"detail"===o&&b&&($(!0),(0,l.getDoc)((0,l.doc)(i.db,"notification_campaigns",b)).then(e=>{e.exists()&&et(h(e))}).finally(()=>$(!1)))},[o,b]);let es=(0,n.useCallback)(e=>{q(t=>t+"{{".concat(e,"}}"))},[]),ea=async()=>{if(!w.trim())return void j({type:"error",message:"Describe what campaign you want"});C(!0);try{let s=(0,u.httpsCallable)(i.functions,"generateCampaignFromPrompt"),a={prompt:w.trim()};if(P){var e,t;a.eventContext={name:P.eventName,date:P.eventDate.toISOString(),endDate:(null==(e=P.eventEndDate)?void 0:e.toISOString())||null,description:P.eventDescription||null,venueName:P.locationAddress||null,city:null,participantCount:null!=(t=P.attendeeCount)?t:null}}let{campaign:n}=(await s(a)).data;D(n.name),z("host"),q(n.body),y("edit")}catch(e){j({type:"error",message:"Generation failed: ".concat(e.message)})}finally{C(!1)}},en=(()=>{if(null==P?void 0:P.attendeeCount)return P.attendeeCount})(),ei=()=>{let e={name:A||"Push Blast ".concat(new Date().toLocaleDateString()),persona:M,title:W,body:I,useAiPersonalization:!1,audienceType:"event_participants",status:"draft",createdBy:(null==g?void 0:g.uid)||"",producerUserId:(null==g?void 0:g.uid)||"",hostName:L||"Your host",stats:{audienceSize:0,sent:0,delivered:0,failed:0},updatedAt:(0,l.serverTimestamp)()};return B&&(e.eventId=B,e.eventName=(null==P?void 0:P.eventName)||"",e.eventImageUrl=(null==P?void 0:P.imageURL)||null),"number"==typeof en&&(e.estimatedAudienceSize=en),e},el=()=>{(!Z.current||!A&&!I||window.confirm("You have unsaved changes. Discard?"))&&v()},ed=async()=>{if(!A.trim())return void j({type:"error",message:"Campaign name is required"});Y(!0);try{let e=ei();if(t&&!s)await (0,l.updateDoc)((0,l.doc)(i.db,"notification_campaigns",t),e),j({type:"success",message:"Campaign updated"});else{let t=(0,l.doc)((0,l.collection)(i.db,"notification_campaigns"));await (0,l.setDoc)(t,{...e,createdAt:(0,l.serverTimestamp)()}),j({type:"success",message:s?"Campaign duplicated as draft":"Campaign saved as draft"})}Z.current=!1,v()}catch(e){j({type:"error",message:"Failed to save: ".concat(e.message)})}finally{Y(!1)}},er=async()=>{X(!1),K(!0);try{let e;"later"===E&&_&&U&&(e=new Date("".concat(_,"T").concat(U)));let a=ei();e&&(a.scheduledAt=l.Timestamp.fromDate(e),a.status="scheduled");let n=t;if(s||!n){let e=(0,l.doc)((0,l.collection)(i.db,"notification_campaigns"));await (0,l.setDoc)(e,{...a,createdAt:(0,l.serverTimestamp)()}),n=e.id}else await (0,l.updateDoc)((0,l.doc)(i.db,"notification_campaigns",n),a);if("now"===E){let e=(0,u.httpsCallable)(i.functions,"sendNotificationCampaign");await e({campaignId:n}),j({type:"success",message:"Push blast sent successfully!"})}else j({type:"success",message:"Push blast scheduled!"});Z.current=!1,v()}catch(e){Q("Failed: ".concat(e.message)),j({type:"error",message:"Failed: ".concat(e.message)})}finally{K(!1)}};if(O)return(0,a.jsx)("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center",children:(0,a.jsx)("div",{className:"studio-body",children:"Loading campaign..."})});if("detail"===o&&ee){let{stats:e}=ee,t=e.sent||1,s=Math.round(e.delivered/t*100),n=Math.round(e.failed/t*100),i=Math.max(0,100-s-n);return(0,a.jsxs)("div",{className:"fixed inset-0 z-50 bg-surface-base overflow-y-auto",children:[(0,a.jsx)("div",{className:"sticky top-0 z-10 bg-surface-base/95 backdrop-blur-md border-b border-white/[0.06]",children:(0,a.jsxs)("div",{className:"max-w-3xl mx-auto flex items-center justify-between px-6 py-3.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("button",{onClick:v,className:"p-1.5 rounded-lg text-t3 hover:text-t2 transition-colors",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M6 18L18 6M6 6l12 12"})})}),(0,a.jsx)("h2",{className:"studio-subtitle",children:"Campaign Details"})]}),(0,a.jsx)("button",{onClick:()=>{b&&(v(),setTimeout(()=>{},100))},className:"px-3.5 py-1.5 text-[13px] text-t3 hover:text-t2 transition-colors",children:"Close"})]})}),(0,a.jsxs)("div",{className:"max-w-3xl mx-auto px-6 py-8 space-y-6",children:[(0,a.jsxs)("div",{className:"bg-card border border-card rounded-xl p-5",children:[(0,a.jsx)("h3",{className:"studio-subtitle mb-1",children:ee.name}),(0,a.jsx)("p",{className:"studio-caption mb-4",children:ee.sentAt?"Sent ".concat(ee.sentAt.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})):"Created ".concat(ee.createdAt.toLocaleDateString())}),(0,a.jsxs)("div",{className:"bg-white/[0.03] border border-white/[0.06] rounded-lg p-4 mb-4",children:[(0,a.jsx)("p",{className:"studio-label mb-1",children:"host"===ee.persona?"Host":"white_rabbit"===ee.persona?"White Rabbit":"System"}),(0,a.jsx)("p",{className:"studio-body-strong mb-1",children:ee.title}),(0,a.jsx)("p",{className:"studio-body",children:ee.body})]}),(0,a.jsx)("div",{className:"flex items-center gap-4 studio-caption",children:(0,a.jsx)("span",{children:"Event Participants"})})]}),(0,a.jsxs)("div",{className:"bg-card border border-card rounded-xl p-5",children:[(0,a.jsx)("h3",{className:"studio-body-strong mb-4",children:"Delivery Stats"}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4 mb-5",children:[(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("p",{className:"text-[24px] font-bold text-t1",children:e.sent}),(0,a.jsx)("p",{className:"studio-label",children:"Sent"})]}),(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("p",{className:"text-[24px] font-bold text-positive-ink/80",children:e.delivered}),(0,a.jsx)("p",{className:"studio-label",children:"Delivered"})]}),(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("p",{className:"text-[24px] font-bold text-negative-ink/80",children:e.failed}),(0,a.jsx)("p",{className:"studio-label",children:"Failed"})]})]}),e.sent>0&&(0,a.jsxs)("div",{className:"flex items-center justify-center gap-6",children:[(0,a.jsx)("div",{className:"w-24 h-24 rounded-full",style:{background:"conic-gradient(\n                      rgb(var(--color-green)) 0% ".concat(s,"%,\n                      rgb(var(--color-red)) ").concat(s,"% ").concat(s+n,"%,\n                      rgba(255,255,255,0.1) ").concat(s+n,"% 100%\n                    )")}}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-3 h-3 rounded-full bg-success"}),(0,a.jsxs)("span",{className:"studio-caption",children:["Delivered (",s,"%)"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-3 h-3 rounded-full bg-danger"}),(0,a.jsxs)("span",{className:"studio-caption",children:["Failed (",n,"%)"]})]}),i>0&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-3 h-3 rounded-full bg-white/10"}),(0,a.jsxs)("span",{className:"studio-caption",children:["Pending (",i,"%)"]})]})]})]})]})]})]})}if("prompt"===N){var eo;return(0,a.jsxs)("div",{className:"fixed inset-0 z-50 bg-surface-base overflow-y-auto",children:[(0,a.jsx)("div",{className:"sticky top-0 z-10 bg-surface-base/95 backdrop-blur-md border-b border-white/[0.06]",children:(0,a.jsxs)("div",{className:"max-w-2xl mx-auto flex items-center justify-between px-6 py-4",children:[(0,a.jsx)("button",{onClick:el,className:"p-1.5 rounded-lg text-t3 hover:text-t2 transition-colors",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M6 18L18 6M6 6l12 12"})})}),(0,a.jsx)("button",{onClick:()=>y("edit"),className:"text-[13px] text-t3 hover:text-t2 transition-colors",children:"Manual setup"})]})}),(0,a.jsxs)("div",{className:"max-w-xl mx-auto px-6 pt-16 pb-16",children:[(0,a.jsxs)("div",{className:"text-center mb-10",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-white/[0.04] mb-5",children:(0,a.jsx)("svg",{className:"w-6 h-6 text-t2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09
1L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 00-2.455 2.456z"})})}),(0,a.jsx)("h1",{className:"studio-title mb-2",children:"Describe your push blast"}),(0,a.jsxs)("p",{className:"studio-body max-w-sm mx-auto leading-relaxed",children:["Describe what you want. AI will tailor the message to ",(0,a.jsx)("span",{className:"text-t2 font-medium",children:null==P?void 0:P.eventName}),"."]})]}),(0,a.jsxs)("div",{className:"relative mb-5",children:[(0,a.jsx)("textarea",{value:w,onChange:e=>k(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&!S&&ea()},placeholder:"e.g. Exciting weekend reminder about our upcoming rooftop event...",rows:4,autoFocus:!0,className:"w-full bg-white/[0.03] border border-white/[0.08] rounded-xl px-4 py-3.5 text-[15px] text-t1 placeholder-white/20 focus:outline-none focus:border-white/20 transition-colors resize-none leading-relaxed"}),(0,a.jsxs)("div",{className:"absolute bottom-2.5 right-3 text-[10px] text-t4",children:["undefined"!=typeof navigator&&(null==(eo=navigator.platform)?void 0:eo.includes("Mac"))?"⌘":"Ctrl","+Enter"]})]}),(0,a.jsx)("button",{onClick:ea,disabled:S||!w.trim(),className:"w-full py-3 rounded-xl text-sm font-medium transition-all disabled:opacity-30 disabled:cursor-not-allowed bg-brand text-surface-base hover:bg-brand-bright",children:S?(0,a.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,a.jsx)("span",{className:"w-4 h-4 border-2 border-black/20 border-t-black rounded-full animate-spin"}),"Building campaign..."]}):"Generate"}),(0,a.jsxs)("div",{className:"mt-12",children:[(0,a.jsx)("p",{className:"studio-label mb-3",children:"Examples"}),(0,a.jsx)("div",{className:"space-y-1.5",children:p.map((e,t)=>(0,a.jsx)("button",{onClick:()=>k(e),className:"w-full text-left px-4 py-3 rounded-lg text-[13px] text-t3 hover:text-t2 hover:bg-white/[0.03] transition-all leading-relaxed",children:e},t))})]})]})]})}return(0,a.jsxs)("div",{className:"fixed inset-0 z-50 bg-surface-base overflow-y-auto",children:[(0,a.jsx)("div",{className:"sticky top-0 z-10 bg-surface-base/95 backdrop-blur-md border-b border-white/[0.06]",children:(0,a.jsxs)("div",{className:"max-w-5xl mx-auto flex items-center justify-between px-6 py-3.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[t||s?(0,a.jsx)("button",{onClick:el,className:"p-1.5 rounded-lg text-t3 hover:text-t2 transition-colors",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M6 18L18 6M6 6l12 12"})})}):(0,a.jsx)("button",{onClick:()=>y("prompt"),className:"p-1.5 rounded-lg text-t3 hover:text-t2 transition-colors",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M15 19l-7-7 7-7"})})}),(0,a.jsx)("h2",{className:"studio-subtitle",children:s?"Duplicate Push Blast":t?"Edit Push Blast":"New Push Blast"}),w&&!t&&!s&&(0,a.jsx)("span",{className:"px-2 py-0.5 bg-white/[0.05] rounded text-[10px] text-t3",children:"AI"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{onClick:el,className:"px-3.5 py-1.5 text-[13px] text-t3 hover:text-t2 transition-colors",children:"Cancel"}),(0,a.jsx)(c.$n,{variant:"secondary",size:"md",onClick:ed,disabled:H,children:H?"Saving...":"Save Draft"})]})]})}),(0,a.jsxs)("div",{className:"max-w-5xl mx-auto px-4 sm:px-6 py-6",children:[!t&&!s&&w&&(0,a.jsxs)("div",{className:"mb-6 flex items-center gap-3 bg-card border border-card rounded-lg px-4 py-2.5",children:[(0,a.jsx)("svg",{className:"w-4 h-4 text-t4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09
1L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09z"})}),(0,a.jsx)("input",{type:"text",value:w,onChange:e=>k(e.target.value),onKeyDown:e=>{"Enter"!==e.key||S||ea()},placeholder:"Adjust prompt and regenerate...",className:"flex-1 bg-transparent text-[13px] text-t2 placeholder-white/20 focus:outline-none"}),(0,a.jsx)("button",{onClick:ea,disabled:S||!w.trim(),className:"px-3 py-1 bg-white/[0.06] text-t2 hover:text-t2 hover:bg-white/[0.1] rounded-md text-[12px] font-medium whitespace-nowrap disabled:opacity-30 transition-all",children:S?"Working...":"Regenerate"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[(0,a.jsxs)("div",{className:"lg:col-span-2 space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"studio-label block mb-2",children:"Event"}),(0,a.jsx)("div",{className:"bg-white/[0.03] border border-white/[0.06] rounded-lg px-4 py-2.5 studio-body",children:(null==P?void 0:P.eventName)||"No event selected"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"studio-label block mb-2",children:"Campaign Name"}),(0,a.jsx)("input",{type:"text",value:A,onChange:e=>D(e.target.value),placeholder:"e.g., Weekend Plans February",className:"w-full bg-white/[0.03] border border-white/[0.08] rounded-lg px-4 py-2.5 text-sm text-t1 placeholder-white/15 focus:outline-none focus:border-white/20 transition-colors"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"studio-label block mb-2",children:"Sender"}),(0,a.jsxs)("div",{className:"flex items-center gap-2.5 bg-white/[0.03] border border-white/[0.06] rounded-lg px-4 py-2.5",children:[(0,a.jsx)("svg",{className:"w-4 h-4 text-t3 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"})}),(0,a.jsx)("span",{className:"studio-body",children:"From you (the host)"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"studio-label block mb-2",children:"Title"}),(0,a.jsx)("div",{className:"bg-white/[0.03] border border-white/[0.06] rounded-lg px-4 py-2.5 studio-body",children:W||"No event selected"}),(0,a.jsx)("p",{className:"text-[10px] text-t4 mt-1.5",children:"Title is set to the event name so recipients know which event this is about"})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-baseline justify-between mb-2",children:[(0,a.jsx)("label",{className:"studio-label",children:"Message"}),(0,a.jsxs)("span",{className:"text-[10px] text-t4",children:[I.length,"/80"]})]}),(0,a.jsx)("textarea",{value:I,onChange:e=>q(e.target.value),placeholder:"Don't miss out — this Sunday at Stable Cafe!",maxLength:80,rows:2,className:"w-full bg-white/[0.03] border border-white/[0.08] rounded-lg px-4 py-2.5 text-sm text-t1 placeholder-white/15 focus:outline-none focus:border-white/20 transition-colors resize-none"}),(0,a.jsx)("div",{className:"flex gap-1.5 mt-2 flex-wrap",children:x.map(e=>(0,a.jsx)("button",{onClick:()=>es(e.key),className:"px-2 py-0.5 bg-card border border-card rounded text-[10px] text-t3 hover:text-t2 hover:bg-white/[0.07] transition-all",children:"{{".concat(e.label,"}}")},e.key))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"studio-label block mb-2",children:"Audience"}),(0,a.jsxs)("div",{className:"flex items-center gap-2.5 bg-white/[0.03] border border-white/[0.06] rounded-lg px-4 py-2.5",children:[(0,a.jsx)("svg",{className:"w-4 h-4 text-t3 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18 18.72a9.094 9.094 0 003.741-.479 3 3 0 00-4.682-2.72m.94 3.198l.001.031c0 .225-.012.447-.037.666A11.944 11.944 0 0112 21c-2.17 0-4.207-.576-5.963-1.584A6.062 6.062 0 016 18.719m12 0a5.971 5.971 0 00-.941-3.197m0 0A5.995 5.995 0 0012 12.75a5.995 5.995 0 00-5.058 2.772m0 0a3 3 0 00-4.681 2.72 8.986 8.986 0 003.74.477m.94-3.197a5.971 5.971 0 00-.94 3.197M15 6.75a3 3 0 11-6 0 3 3 0 016 0zm6 3a2.25 2.25 0 11-4.5 0 2.25 2.25 0 014.5 0zm-13.5 0a2.25 2.25 0 11-4.5 0 2.25 2.25 0 014.5 0z"})}),(0,a.jsx)("span",{className:"studio-body",children:"Event Participants"}),(null==P?void 0:P.attendeeCount)!=null&&(0,a.jsxs)("span",{className:"ml-auto studio-caption",children:[P.attendeeCount," users"]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"studio-label block mb-2",children:"Delivery"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{onClick:()=>T("now"),className:"flex-1 px-4 py-2.5 rounded-lg border text-[13px] transition-all ".concat("now"===E?"bg-white/[0.08] border-white/[0.15] text-t1":"border-white/[0.06] text-t3 hover:text-t2 hover:bg-white/[0.02]"),children:"Immediately"}),(0,a.jsx)("button",{onClick:()=>T("later"),className:"flex-1 px-4 py-2.5 rounded-lg border text-[13px] transition-all ".concat("later"===E?"bg-white/[0.08] border-white/[0.15] text-t1":"border-white/[0.06] text-t3 hover:text-t2 hover:bg-white/[0.02]"),children:"Schedule"})]}),"later"===E&&(0,a.jsxs)("div",{className:"flex gap-3 mt-3",children:[(0,a.jsx)("input",{type:"date",value:_,onCh
1ange:e=>F(e.target.value),className:"flex-1 bg-white/[0.03] border border-white/[0.08] rounded-lg px-3 py-2 text-sm text-t2 focus:outline-none focus:border-white/20 transition-colors [color-scheme:dark]"}),(0,a.jsx)("input",{type:"time",value:U,onChange:e=>R(e.target.value),className:"w-32 bg-white/[0.03] border border-white/[0.08] rounded-lg px-3 py-2 text-sm text-t2 focus:outline-none focus:border-white/20 transition-colors [color-scheme:dark]"})]})]}),(0,a.jsxs)("div",{className:"pt-2 pb-4",children:[G&&(0,a.jsx)("p",{className:"text-[13px] text-negative-ink/80 mb-3",children:G}),(0,a.jsx)(c.$n,{variant:"primary",size:"lg",onClick:()=>{Q("");let e=I.trim()?"later"!==E||_&&U?null:"Set a scheduled date and time":"Message body is required";if(e)return void Q(e);X(!0)},disabled:V,className:"w-full py-3.5 rounded-xl text-[14px]",children:V?(0,a.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,a.jsx)("span",{className:"w-4 h-4 border-2 border-black/20 border-t-black rounded-full animate-spin"}),"Sending..."]}):"later"===E?"Schedule Blast":"Send Blast"})]})]}),(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)(m,{title:W||"Event Name",body:I||"Your message here...",persona:M}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"studio-label mb-3",children:"Summary"}),(0,a.jsxs)("div",{className:"bg-card border border-card rounded-xl p-4 space-y-3",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"studio-caption",children:"Sender"}),(0,a.jsx)("span",{className:"studio-caption",children:"host"===M?"You (Host)":"white_rabbit"===M?"White Rabbit":"System"})]}),(0,a.jsx)("div",{className:"h-px bg-white/[0.04]"}),P&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"studio-caption",children:"Event"}),(0,a.jsx)("span",{className:"studio-caption truncate ml-2 max-w-[160px]",children:P.eventName})]}),(0,a.jsx)("div",{className:"h-px bg-white/[0.04]"})]}),(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"studio-caption",children:"Audience"}),(0,a.jsx)("span",{className:"studio-caption",children:"Event Participants"})]}),"number"==typeof en&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"h-px bg-white/[0.04]"}),(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"studio-caption",children:"Est. reach"}),(0,a.jsxs)("span",{className:"text-[12px] text-positive-ink/60 font-medium",children:["~",en," users"]})]})]}),(0,a.jsx)("div",{className:"h-px bg-white/[0.04]"}),(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"studio-caption",children:"Delivery"}),(0,a.jsx)("span",{className:"studio-caption",children:"now"===E?"Immediate":"Scheduled"})]})]})]})]})]})]}),J&&(0,a.jsx)("div",{className:"fixed inset-0 z-[60] bg-black/60 backdrop-blur-sm flex items-center justify-center",children:(0,a.jsxs)("div",{className:"bg-card border border-card rounded-2xl p-6 max-w-sm w-full mx-4 shadow-2xl",children:[(0,a.jsx)("h3",{className:"studio-subtitle mb-2",children:"later"===E?"Schedule this blast?":"Send this blast?"}),(0,a.jsx)("p",{className:"studio-body mb-1",children:(0,a.jsx)("span",{className:"font-medium text-t2",children:W})}),(0,a.jsxs)("p",{className:"studio-caption mb-4",children:["later"===E?"Scheduled for ".concat(_," at ").concat(U):"This will send immediately and cannot be undone.",P&&(0,a.jsxs)("span",{className:"block mt-1",children:["To ",(0,a.jsx)("span",{className:"text-t2",children:P.eventName}),"number"==typeof en&&" (~".concat(en," users)")]})]}),(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsx)(c.$n,{variant:"secondary",size:"md",onClick:()=>X(!1),className:"flex-1 rounded-xl",children:"Cancel"}),(0,a.jsx)(c.$n,{variant:"primary",size:"md",onClick:er,className:"flex-1 rounded-xl",children:"later"===E?"Schedule":"Send Now"})]})]})})]})}let v=[{key:"firstName",label:"First Name"},{key:"lastName",label:"Last Name"},{key:"city",label:"City"},{key:"lastEventName",label:"Last Event"}],g=["Event countdown for our rooftop party — build hype over the week leading up","Post-event follow-up thanking attendees and teasing next events","Re-engage people who haven't attended in a while with upcoming highlights","Welcome sequence for new followers — introduce what we do and upcoming plans"],f=[{value:1,label:"Minutes"},{value:60,label:"Hours"},{value:1440,label:"Days"}];function j(e){return{id:"step-".concat(Date.now(),"-").concat(e),order:e,title:"",body:"",useAiPersonalization:!1,aiContext:"",delayMinutes:120*(0!==e),delayValue:2*(0!==e),delayUnit:0===e?1:60}}function N(e,t){let s,a,n=t.delayMinutes;return 0===e?(s=0,a=1):n>=1440?(s=n/1440,a=1440):n>=60?(s=n/60,a=60):(s=n,a=1),{id:"step-".concat(Date.now(),"-").concat(e),order:e,title:t.title,body:t.body,useAiPersonalization:!1,aiContext:"",delayMinutes:0===e?0:n,delayValue:s,delayUnit:a}}function y(e){let{sequenceId:t,templateSteps:s,templateName:o,onClose:x}=e,{user:p,userProfile:h,notify:b}
1=(0,d.Y)(),[y,w]=(0,n.useState)(t||s?"edit":"prompt"),[k,S]=(0,n.useState)(""),[C,L]=(0,n.useState)(!1),[A,D]=(0,n.useState)(""),[M,z]=(0,n.useState)("host"),I=[null==h?void 0:h.firstName,null==h?void 0:h.lastName].filter(Boolean).join(" ")||(null==p?void 0:p.displayName)||"",[q,E]=(0,n.useState)([j(0)]),{eventId:T,eventData:B}=(0,r._)(),[P,W]=(0,n.useState)(0),[_,F]=(0,n.useState)("draft"),[U,R]=(0,n.useState)(!1),[O,$]=(0,n.useState)(!1),[H,Y]=(0,n.useState)(!1),[V,K]=(0,n.useState)(""),[G,Q]=(0,n.useState)(!1),J=(0,n.useRef)(!1);(0,n.useEffect)(()=>{J.current=!0},[A,M,q]);let X=async()=>{if(!k.trim())return void b({type:"error",message:"Describe what sequence you want"});L(!0);try{let s=(0,u.httpsCallable)(i.functions,"generateSequenceFromPrompt"),a={prompt:k.trim()};if(B){var e,t;a.eventContext={name:B.eventName,date:B.eventDate.toISOString(),endDate:(null==(e=B.eventEndDate)?void 0:e.toISOString())||null,description:B.eventDescription||null,venueName:B.locationAddress||null,city:null,participantCount:null!=(t=B.attendeeCount)?t:null}}let{sequence:n}=(await s(a)).data;D(n.name),E(n.steps.map((e,t)=>N(t,e))),w("edit")}catch(e){b({type:"error",message:"Generation failed: ".concat(e.message)})}finally{L(!1)}};(0,n.useEffect)(()=>{s&&s.length>0&&(E(s.map((e,t)=>N(t,e))),o&&D(o))},[s,o]),(0,n.useEffect)(()=>{t&&(R(!0),(0,l.getDoc)((0,l.doc)(i.db,"notification_sequences",t)).then(e=>{if(e.exists()){let t=e.data();D(t.name||""),z("host"),F(t.status||"draft"),E((t.steps||[]).map(e=>{var t;return{id:e.id||"step-".concat(Date.now(),"-").concat(e.order),order:e.order||0,title:e.title||"",body:e.body||"",useAiPersonalization:null!=(t=e.useAiPersonalization)&&t,aiContext:e.aiContext||"",delayMinutes:e.delayMinutes||0,delayValue:e.delayMinutes>=1440?e.delayMinutes/1440:e.delayMinutes>=60?e.delayMinutes/60:e.delayMinutes||0,delayUnit:e.delayMinutes>=1440?1440:e.delayMinutes>=60?60:1,status:e.status,campaignId:e.campaignId}}))}}).finally(()=>R(!1)))},[t]);let Z=(0,n.useCallback)((e,t)=>{E(s=>s.map((s,a)=>
1{if(a!==e)return s;let n={...s,...t};return(void 0!==t.delayValue||void 0!==t.delayUnit)&&(n.delayMinutes=n.delayValue*n.delayUnit),n}))},[]),ee=(()=>{if(null==B?void 0:B.attendeeCount)return B.attendeeCount})(),et="active"===_,es=()=>{let e={name:A,persona:M,audienceType:"event_participants",steps:q.map(e=>{let t={id:e.id,order:e.order,title:(null==B?void 0:B.eventName)||e.title,body:e.body,useAiPersonalization:e.useAiPersonalization,aiContext:e.aiContext||"",delayMinutes:e.delayMinutes};return et&&(e.status&&(t.status=e.status),e.campaignId&&(t.campaignId=e.campaignId)),t}),status:et?"active":"draft",createdBy:(null==p?void 0:p.uid)||"",producerUserId:(null==p?void 0:p.uid)||"",hostName:I||"Your host",updatedAt:(0,l.serverTimestamp)()};return T&&(e.eventId=T,e.eventName=(null==B?void 0:B.eventName)||"",e.eventImageUrl=(null==B?void 0:B.imageURL)||null),"number"==typeof ee&&(e.estimatedAudienceSize=ee),e},ea=()=>A.trim()?q.some(e=>!e.body.trim())?"All steps must have a message body":null:"Sequence name is required",en=()=>{(!(J.current&&(A||q.some(e=>e.body)))||window.confirm("You have unsaved changes. Discard?"))&&x()},ei=async()=>{let e=et?null:ea();if(e)return void b({type:"error",message:e});$(!0);try{let e=es();if(t){if(await (0,l.updateDoc)((0,l.doc)(i.db,"notification_sequences",t),e),et){let e=q.find(e=>"scheduled"===e.status&&e.campaignId);(null==e?void 0:e.campaignId)&&await (0,l.updateDoc)((0,l.doc)(i.db,"notification_campaigns",e.campaignId),{title:(null==B?void 0:B.eventName)||e.title,body:e.body,useAiPersonalization:e.useAiPersonalization,aiContext:e.aiContext||"",updatedAt:(0,l.serverTimestamp)()})}b({type:"success",message:et?"Sequence steps updated":"Sequence updated"})}else{let t=(0,l.doc)((0,l.collection)(i.db,"notification_sequences"));await (0,l.setDoc)(t,{...e,createdAt:(0,l.serverTimestamp)()}),b({type:"success",message:"Sequence saved as draft"})}J.current=!1,x()}catch(e){b({type:"error",message:"Failed to save: ".concat(e.message)})}finally{$(!1)}},el=async()=>{Q(!1),Y(!0),K("");let e=t;try{let t=es();if(e)await (0,l.updateDoc)((0,l.doc)(i.db,"notification_sequences",e),t);else{let s=(0,l.doc)((0,l.collection)(i.db,"notification_sequences"));await (0,l.setDoc)(s,{...t,createdAt:(0,l.serverTimestamp)()}),e=s.id}}catch(e){K("Failed to save sequence: ".concat(e.message)),Y(!1);return}try{let t=(0,u.httpsCallable)(i.functions,"startNotificationSequence"),{campaignId:s}=(await t({sequenceId:e})).data,a=(0,u.httpsCallable)(i.functions,"sendNotificationCampaign");await a({campaignId:s}),J.current=!1,b({type:"success",message:"Sequence started! Step 1 sent."}),x()}catch(e){K("Sequence saved but failed to start: ".concat(e.message,". You can retry from the Sequences tab.")),b({type:"error",message:"Sequence saved but start failed. Retry from Sequences tab."})}finally{Y(!1)}},ed=e=>{if(0===e.order)return"Immediately";let t=e.delayMinutes;return t>=1440?"".concat(Math.round(t/1440),"d after previous"):t>=60?"".concat(Math.round(t/60),"h after previous"):"".concat(t,"m after previous")};if(U)return(0,a.jsx)("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center",children:(0,a.jsx)("div",{className:"studio-body",children:"Loading sequence..."})});let er=q[P];if("prompt"===y){var eo;return(0,a.jsxs)("div",{className:"fixed inset-0 z-50 bg-surface-base overflow-y-auto",children:[(0,a.jsx)("div",{className:"sticky top-0 z-10 bg-surface-base/95 backdrop-blur-md border-b border-white/[0.06]",children:(0,a.jsxs)("div",{className:"max-w-2xl mx-auto flex items-center justify-between px-6 py-4",children:[(0,a.jsx)("button",{onClick:en,className:"p-1.5 rounded-lg text-t3 hover:text-t2 transition-colors",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M6 18L18 6M6 6l12 12"})})}),(0,a.jsx)("button",{onClick:()=>w("edit"),className:"text-[13px] text-t3 hover:text-t2 transition-colors",children:"Manual setup"})]})}),(0,a.jsxs)("div",{className:"max-w-xl mx-auto px-6 pt-16 pb-16",children:[(0,a.jsxs)("div",{className:"text-center mb-10",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-white/[0.04] mb-5",children:(0,a.jsx)("svg",{className:"w-6 h-6 text-t2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09
1L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 00-2.455 2.456z"})})}),(0,a.jsx)("h1",{className:"studio-title mb-2",children:"Describe your notification sequence"}),(0,a.jsxs)("p",{className:"studio-body max-w-sm mx-auto leading-relaxed",children:["Describe what you want. AI will tailor the sequence to ",(0,a.jsx)("span",{className:"text-t2 font-medium",children:null==B?void 0:B.eventName}),"."]})]}),(0,a.jsxs)("div",{className:"relative mb-5",children:[(0,a.jsx)("textarea",{value:k,onChange:e=>S(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&!C&&X()},placeholder:"e.g. Event countdown for our rooftop party — 1 week before, day before, and 2 hours before...",rows:4,autoFocus:!0,className:"w-full bg-white/[0.03] border border-white/[0.08] rounded-xl px-4 py-3.5 text-[15px] text-t1 placeholder-white/20 focus:outline-none focus:border-white/20 transition-colors resize-none leading-relaxed"}),(0,a.jsxs)("div",{className:"absolute bottom-2.5 right-3 text-[10px] text-t4",children:["undefined"!=typeof navigator&&(null==(eo=navigator.platform)?void 0:eo.includes("Mac"))?"⌘":"Ctrl","+Enter"]})]}),(0,a.jsx)(c.$n,{variant:"primary",size:"lg",onClick:X,disabled:C||!k.trim(),className:"w-full py-3 rounded-xl",children:C?(0,a.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,a.jsx)("span",{className:"w-4 h-4 border-2 border-black/20 border-t-black rounded-full animate-spin"}),"Building sequence..."]}):"Generate Sequence"}),(0,a.jsxs)("div",{className:"mt-12",children:[(0,a.jsx)("p",{className:"studio-label mb-3",children:"Examples"}),(0,a.jsx)("div",{className:"space-y-1.5",children:g.map((e,t)=>(0,a.jsx)("button",{onClick:()=>S(e),className:"w-full text-left px-4 py-3 rounded-lg text-[13px] text-t3 hover:text-t2 hover:bg-white/[0.03] transition-all leading-relaxed",children:e},t))})]})]})]})}return(0,a.jsxs)("div",{className:"fixed inset-0 z-50 bg-surface-base overflow-y-auto",children:[(0,a.jsx)("div",{className:"sticky top-0 z-10 bg-surface-base/95 backdrop-blur-md border-b border-white/[0.06]",children:(0,a.jsxs)("div",{className:"max-w-6xl mx-auto flex items-center justify-between px-6 py-3.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[t||s?(0,a.jsx)("button",{onClick:en,className:"p-1.5 rounded-lg text-t3 hover:text-t2 transition-colors",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M6 18L18 6M6 6l12 12"})})}):(0,a.jsx)("button",{onClick:()=>w("prompt"),className:"p-1.5 rounded-lg text-t3 hover:text-t2 transition-colors",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M15 19l-7-7 7-7"})})}),(0,a.jsx)("h2",{className:"studio-subtitle",children:et?"Edit Active Sequence":t?"Edit Sequence":s?"New Sequence from Template":"New Sequence"}),k&&!t&&!s&&(0,a.jsx)("span",{className:"px-2 py-0.5 bg-white/[0.05] rounded text-[10px] text-t3",children:"AI"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{onClick:en,className:"px-3.5 py-1.5 text-[13px] text-t3 hover:text-t2 transition-colors",children:"Cancel"}),et?(0,a.jsx)(c.$n,{variant:"primary",size:"md",onClick:ei,disabled:O,children:O?"Saving...":"Save Changes"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c.$n,{variant:"secondary",size:"md",onClick:ei,disabled:O,children:O?"Saving...":"Save Draft"}),(0,a.jsx)(c.$n,{variant:"primary",size:"md",onClick:()=>{K("");let e=ea();if(e)return void K(e);Q(!0)},disabled:H,children:H?"Starting...":"Start Sequence"})]})]})]})}),V&&(0,a.jsx)("div",{className:"max-w-6xl mx-auto px-6 pt-3",children:(0,a.jsx)("div",{className:"bg-red-500/10 border border-red-500/20 rounded-lg px-4 py-2.5 text-[13px] text-negative-ink/80",children:V})}),(0,a.jsxs)("div",{className:"max-w-6xl mx-auto px-6 py-6",children:[!t&&!s&&k&&(0,a.jsxs)("div",{className:"mb-6 flex items-center gap-3 bg-card border border-card rounded-lg px-4 py-2.5",children:[(0,a.jsx)("svg",{className:"w-4 h-4 text-t4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09
1L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09z"})}),(0,a.jsx)("input",{type:"text",value:k,onChange:e=>S(e.target.value),onKeyDown:e=>{"Enter"!==e.key||C||X()},placeholder:"Adjust prompt and regenerate...",className:"flex-1 bg-transparent text-[13px] text-t2 placeholder-white/20 focus:outline-none"}),(0,a.jsx)("button",{onClick:X,disabled:C||!k.trim(),className:"px-3 py-1 bg-white/[0.06] text-t2 hover:text-t2 hover:bg-white/[0.1] rounded-md text-[12px] font-medium whitespace-nowrap disabled:opacity-30 transition-all",children:C?"Working...":"Regenerate"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[(0,a.jsxs)("div",{className:"lg:col-span-2 space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"studio-label block mb-2",children:"Sequence Name"}),(0,a.jsx)("input",{type:"text",value:A,onChange:e=>D(e.target.value),placeholder:"e.g., Event Countdown, Welcome Flow",className:"w-full bg-white/[0.03] border border-white/[0.08] rounded-lg px-4 py-2.5 text-sm text-t1 placeholder-white/15 focus:outline-none focus:border-white/20 transition-colors"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"studio-label block mb-2",children:"Event"}),(0,a.jsx)("div",{className:"bg-white/[0.03] border border-white/[0.06] rounded-lg px-4 py-2.5 studio-body",children:(null==B?void 0:B.eventName)||"No event selected"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"studio-label block mb-2",children:"Sender"}),(0,a.jsxs)("div",{className:"flex items-center gap-2.5 bg-white/[0.03] border border-white/[0.06] rounded-lg px-4 py-2.5",children:[(0,a.jsx)("svg",{className:"w-4 h-4 text-t3 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"})}),(0,a.jsx)("span",{className:"studio-body",children:"From you (the host)"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"studio-label block mb-2",children:"Audience"}),(0,a.jsxs)("div",{className:"flex items-center gap-2.5 bg-white/[0.03] border border-white/[0.06] rounded-lg px-4 py-2.5",children:[(0,a.jsx)("svg",{className:"w-4 h-4 text-t3 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18 18.72a9.094 9.094 0 003.741-.479 3 3 0 00-4.682-2.72m.94 3.198l.001.031c0 .225-.012.447-.037.666A11.944 11.944 0 0112 21c-2.17 0-4.207-.576-5.963-1.584A6.062 6.062 0 016 18.719m12 0a5.971 5.971 0 00-.941-3.197m0 0A5.995 5.995 0 0012 12.75a5.995 5.995 0 00-5.058 2.772m0 0a3 3 0 00-4.681 2.72 8.986 8.986 0 003.74.477m.94-3.197a5.971 5.971 0 00-.94 3.197M15 6.75a3 3 0 11-6 0 3 3 0 016 0zm6 3a2.25 2.25 0 11-4.5 0 2.25 2.25 0 014.5 0zm-13.5 0a2.25 2.25 0 11-4.5 0 2.25 2.25 0 014.5 0z"})}),(0,a.jsx)("span",{className:"studio-body",children:"Event Participants"}),(null==B?void 0:B.attendeeCount)!=null&&(0,a.jsxs)("span",{className:"ml-auto studio-caption",children:[B.attendeeCount," users"]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsxs)("label",{className:"studio-label",children:["Steps (",q.length,")"]}),!et&&(0,a.jsx)(c.$n,{variant:"ghost",size:"sm",onClick:()=>{E(e=>[...e,j(e.length)]),W(q.length)},children:"+ Add Step"})]}),(0,a.jsx)("div",{className:"space-y-2 mb-4",children:q.map((e,t)=>{let s="sent"===e.status||"completed"===e.status;return(0,a.jsxs)("div",{onClick:()=>W(t),className:"flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ".concat(P===t?"bg-white/[0.06] border-white/[0.15]":"bg-white/[0.02] border-white/[0.06] hover:bg-white/[0.04]"," ").concat(s?"opacity-60":""),children:[(0,a.jsx)("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-[11px] font-bold shrink-0 ".concat(s?"bg-[var(--state-positive-bg)] text-[color:var(--state-positive-fg)]":"bg-white/[0.08] text-t2"),children:s?(0,a.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):t+1}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("p",{className:"studio-body-strong truncate",children:(null==B?void 0:B.eventName)||"Step ".concat(t+1)}),s&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium bg-emerald-500/15 text-positive-ink/80 uppercase tracking-wider shrink-0",children:"Sent"}),"scheduled"===e.status&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium bg-amber-500/15 text-attention-ink/80 uppercase tracking-wider shrink-0",children:"Scheduled"})]}),(0,a.jsx)("p",{className:"studio-caption",children:ed(e)})]}),!s&&e.body?(0,a.jsx)("div",{className:"w-4 h-4 rounded-full bg-green-500/20 flex items-center justify-center shrink-0",children:(0,a.jsx)("svg",{className:"w-2.5 h-2.5 text-positive-ink",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})}):s?null:(0,a.jsx)("div",{className:"w-4 h-4 rounded-full bg-white/[0.06] shrink-0"}),q.length>1&&!et&&(0,a.jsx)("button",{onClick:e=>{e.stopPropagation(),!(q.length<=1)&&(E(e=>e.filter((e,s)=>s!==t).map((e,t)=>({...e,order:t}))),P>=t&&P>0&&W(P-1))},className:"p-1 rounded text-t4 hover:text-negative-ink transition-colors shrink-0",children:(0,a.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},e.id)})}),er&&(()=>{let e="sent"===er.status||"completed"===er.status;return(0,a.jsxs)("div",{className:"bg-card border border-card rounded-lg p-5 space-y-4 ".concat(e?"opacity-60":""),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] font-bold ".concat(e?"bg-[var(--state-positive-bg)] text-[color:var(--state-positive-fg)]":"bg-white/[0.08] text-t2"),children:e?(0,a.jsx)("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):P+1}),(0,a.jsxs)("span",{className:"studio-body-strong",children:["Step ",P+1]}),e&&(0,a.jsx)("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-medium bg-emerald-500/15 text-positive-ink/80",children:"Sent — Read Only"})]}),P>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"studio-label block mb-2",children:"Delay after previous step"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"number",min:1,value:er.delayValue,onChange:e=>Z(P,{delayValue:Math.max(1,parseInt(e.target.value)||1)}),disabled:e,className:"w-20 bg-white/[0.03] border border-white/[0.08] rounded-lg px-3 py-2 text-sm text-t2 focus:outline-none focus:border-white/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"}),(0,a.jsx)("select",{value:er.delayUnit,onChange:e=>Z(P,{delayUnit:parseInt(e.target.value)}),disabled:e,className:"bg-white/[0.03] border border-white/[0.08] rounded-lg px-3 py-2 text-sm text-t2 focus:outline-none focus:border-white/20 transition-colors [color-scheme:dark] disabled:opacity-50 disabled:cursor-not-allowed",children:f.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"studio-label block mb-2",children:"Title"}),(0,a.jsx)("div",{className:"bg-white/[0.03] border border-white/[0.06] rounded-lg px-4 py-2.5 studio-body",children:(null==B?void 0:B.eventName)||"Event Name"}),(0,a.jsx)("p",{className:"text-[10px] text-t4 mt-1.5",children:"Title is set to the event name so recipients know which event this is about"})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-baseline justify-between mb-2",children:[(0,a.jsx)("label",{className:"studio-label",children:"Body"}),(0,a.jsxs)("span",{className:"text-[10px] text-t4",children:[er.body.length,"/80"]})]}),(0,a.jsx)("textarea",{value:er.body,onChange:e=>Z(P,{body:e.target.value}),placeholder:"We found amazing events near you this weekend...",maxLength:80,rows:3,disabled:e,className:"w-full bg-white/[0.03] border border-white/[0.08] rounded-lg px-4 py-2.5 text-sm text-t1 placeholder-white/15 focus:outline-none focus:border-white/20 transition-colors resize-none disabled:opacity-50 disabled:cursor-not-allowed"}),!e&&(0,a.jsx)("div",{className:"flex gap-1.5 mt-2 flex-wrap",children:v.map(e=>(0,a.jsx)("button",{onClick:()=>Z(P,{body:er.body+"{{".concat(e.key,"}}")}),className:"px-2 py-0.5 bg-card border border-card rounded text-[10px] text-t3 hover:text-t2 hover:bg-white/[0.07] transition-all",children:"{{".concat(e.label,"}}")},e.key))})]})]})})()]})]}),(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"studio-label mb-3",children:"Timeline"}),(0,a.jsx)("div",{className:"bg-card border border-card rounded-xl p-4",children:q.map((e,t)=>(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col items-center",children:[(0,a.jsx)("div",{className:"w-3 h-3 rounded-full border-2 shrink-0 ".concat(P===t?"border-white/60 bg-white/20":"border-white/20 bg-transparent")}),t<q.length-1&&(0,a.jsx)("div",{className:"w-px flex-1 bg-white/[0.08] my-1"})]}),(0,a.jsxs)("div",{className:t===q.length-1?"pb-0":"pb-4",children:[(0,a.jsxs)("p",{className:"studio-caption leading-tight",children:["Step ",t+1,": ",(null==B?void 0:B.eventName)||"(untitled)"]}),(0,a.jsx)("p",{className:"studio-micro mt-0.5",children:ed(e)})]})]},e.id))})]}),er&&(0,a.jsx)(m,{title:(null==B?void 0:B.eventName)||"Event Name",body:er.body||"Step body...",persona:M}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"studio-label mb-3",children:"Summary"}),(0,a.jsxs)("div",{className:"bg-card border border-card rounded-xl p-4 space-y-3",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"studio-caption",children:"Steps"}),(0,a.jsx)("span",{className:"studio-caption",children:q.length})]}),(0,a.jsx)("div",{className:"h-px bg-white/[0.04]"}),(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"studio-caption",children:"Sender"}),(0,a.jsx)("span",{className:"studio-caption",children:"host"===M?"You (Host)":"white_rabbit"===M?"White Rabbit":"System"})]}),(0,a.jsx)("div",{className:"h-px bg-white/[0.04]"}),B&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"studio-caption",children:"Event"}),(0,a.jsx)("span",{className:"studio-caption truncate ml-2 max-w-[140px]",children:B.eventName})]}),(0,a.jsx)("div",{className:"h-px bg-white/[0.04]"})]}),(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"studio-caption",children:"Audience"}),(0,a.jsx)("span",{className:"studio-caption",children:"Event Participants"})]}),"number"==typeof ee&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"h-px bg-white/[0.04]"}),(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"studio-caption",children:"Est. reach"}),(0,a.jsxs)("span",{className:"text-[12px] text-positive-ink/60 font-medium",children:["~",ee," users"]})]})]}),(0,a.jsx)("div",{className:"h-px bg-white/[0.04]"}),(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"studio-caption",children:"Total duration"}),(0,a.jsx)("span",{className:"studio-caption",children:(()=>{let e=q.reduce((e,t)=>
1e+t.delayMinutes,0);return e>=1440?"".concat(Math.round(e/1440*10)/10," days"):e>=60?"".concat(Math.round(e/60*10)/10," hours"):"".concat(e," min")})()})]})]})]})]})]})]}),G&&(0,a.jsx)("div",{className:"fixed inset-0 z-[60] bg-black/60 backdrop-blur-sm flex items-center justify-center",children:(0,a.jsxs)("div",{className:"bg-card border border-card rounded-2xl p-6 max-w-sm w-full mx-4 shadow-2xl",children:[(0,a.jsx)("h3",{className:"studio-subtitle mb-2",children:"Start this sequence?"}),(0,a.jsxs)("p",{className:"studio-body mb-1",children:[(0,a.jsx)("span",{className:"font-medium text-t2",children:A})," — ",q.length," step",1!==q.length?"s":""]}),(0,a.jsxs)("p",{className:"studio-caption mb-4",children:["Step 1 will send immediately. Subsequent steps follow the configured delays. This cannot be undone.",B&&(0,a.jsxs)("span",{className:"block mt-1",children:["To ",(0,a.jsx)("span",{className:"text-t2",children:B.eventName}),"number"==typeof ee&&" (~".concat(ee," users)")]})]}),(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsx)(c.$n,{variant:"secondary",size:"md",onClick:()=>Q(!1),className:"flex-1 rounded-xl",children:"Cancel"}),(0,a.jsx)(c.$n,{variant:"primary",size:"md",onClick:el,className:"flex-1 rounded-xl",children:"Start Sequence"})]})]})})]})}let w=[{key:"all",label:"All"},{key:"draft",label:"Draft"},{key:"active",label:"Active"},{key:"completed",label:"Completed"},{key:"failed",label:"Failed"}],k={all:[],draft:["draft"],active:["scheduled","sending"],completed:["sent"],failed:["failed"]},S={all:[],draft:["draft"],active:["active"],completed:["completed"],failed:[]},C={draft:{label:"Draft",className:"bg-white/[0.06] text-t2"},scheduled:{label:"Scheduled",className:"bg-blue-500/15 text-info-ink"},sending:{label:"Sending",className:"bg-amber-500/15 text-attention-ink"},sent:{label:"Sent",className:"bg-emerald-500/15 text-positive-ink/80"},failed:{label:"Failed",className:"bg-red-500/15 text-negative-ink"}},L={draft:{label:"Draft",className:"bg-white/[0.06] text-t2"},active:{label:"Active",className:"bg-emerald-500/15 text-positive-ink/80"},completed:{label:"Completed",className:"bg-blue-500/15 text-info-ink"}};function A(e){var t,s,a,n,i,l,d,r,o,c,u;let m=e.data();return{id:e.id,name:m.name||"",persona:m.persona||"host",title:m.title||"",body:m.body||"",useAiPersonalization:null!=(o=m.useAiPersonalization)&&o,aiContext:m.aiContext,audienceType:m.audienceType||"all",segmentFilters:m.segmentFilters,manualUserIds:m.manualUserIds,distributionListId:m.distributionListId,eventId:m.eventId||void 0,eventName:m.eventName||void 0,hostName:m.hostName||void 0,estimatedAudienceSize:null!=(c=m.estimatedAudienceSize)?c:void 0,status:m.status||"draft",scheduledAt:null==(s=m.scheduledAt)||null==(t=s.toDate)?void 0:t.call(s),sentAt:null==(n=m.sentAt)||null==(a=n.toDate)?void 0:a.call(n),createdAt:(null==(l=m.createdAt)||null==(i=l.toDate)?void 0:i.call(l))||new Date,updatedAt:(null==(r=m.updatedAt)||null==(d=r.toDate)?void 0:d.call(r))||new Date,createdBy:m.createdBy||"",producerUserId:m.producerUserId,stats:m.stats||{audienceSize:0,sent:0,delivered:0,failed:0},sequenceId:m.sequenceId,sequenceName:m.sequenceName||void 0,sequenceOrder:m.sequenceOrder,sequenceTotalSteps:null!=(u=m.sequenceTotalSteps)?u:void 0}}function D(e){if(e){if(e instanceof Date)return e;if("object"==typeof e&&null!==e&&"toDate"in e&&"function"==typeof e.toDate)return e.toDate();if("string"==typeof e||"number"==typeof e)return new Date(e)}}function M(e){var t,s,a,n,i;let l=e.data();return{id:e.id,name:l.name||"",persona:l.persona||"host",audienceType:l.audienceType||"all",segmentFilters:l.segmentFilters,manualUserIds:l.manualUserIds,distributionListId:l.distributionListId,eventId:l.eventId||void 0,eventName:l.eventName||void 0,hostName:l.hostName||void 0,estimatedAudienceSize:null!=(i=l.estimatedAudienceSize)?i:void 0,steps:(l.steps||[]).map(e=>{var t;return{id:e.id||"",order:e.order||0,title:e.title||"",body:e.body||"",useAiPersonalization:null!=(t=e.useAiPersonalization)&&t,aiContext:e.aiContext,delayMinutes:e.delayMinutes||0,campaignId:e.campaignId,status:e.status,scheduledAt:D(e.scheduledAt),sentAt:D(e.sentAt)}}),status:l.status||"draft",createdBy:l.createdBy||"",producerUserId:l.producerUserId,createdAt:(null==(s=l.createdAt)||null==(t=s.toDate)?void 0:t.call(s))||new Date,updatedAt:(null==(n=l.updatedAt)||null==(a=n.toDate)?void 0:a.call(n))||new Date}}
1let z=[{name:"Event Countdown",description:"Build anticipation with timed reminders before your event",steps:[{title:"Your event is in 1 week!",body:"{{firstName}}, one week until the big day! Make sure to invite your friends.",delayMinutes:0},{title:"Tomorrow is the day!",body:"Get ready — the event is tomorrow! Here's what you need to know.",delayMinutes:8640},{title:"Starting in 2 hours!",body:"Almost time! Head over soon to get the best spot.",delayMinutes:1320}]},{name:"Post-Event Follow-up",description:"Thank attendees and keep the connection alive",steps:[{title:"Thanks for coming!",body:"We loved seeing you there, {{firstName}}! Hope you had an amazing time.",delayMinutes:0},{title:"Share your favorite moments",body:"Got any great photos or stories? We'd love to see them!",delayMinutes:4320}]},{name:"Re-engagement",description:"Bring back contacts who have been inactive",steps:[{title:"We miss you, {{firstName}}!",body:"It's been a while! Check out what's happening in your area this week.",delayMinutes:0},{title:"Don't miss out",body:"New events are dropping every week. Come back and discover something amazing.",delayMinutes:23040}]}];function I(e){return"blast"===e.kind?e.data.sentAt||e.data.scheduledAt||e.data.createdAt:e.data.updatedAt}function q(e){let t=e.steps.reduce((e,t)=>e+t.delayMinutes,0);return t>=1440?"".concat(Math.round(t/1440*10)/10," days"):t>=60?"".concat(Math.round(t/60*10)/10," hours"):"".concat(t," min")}function E(){let{user:e,notify:t}=(0,d.Y)(),{eventId:s}=(0,r._)(),[u,m]=(0,n.useState)([]),[x,p]=(0,n.useState)([]),[h,v]=(0,n.use
1State)(!0),[g,f]=(0,n.useState)("all"),[j,N]=(0,n.useState)(""),[D,E]=(0,n.useState)(!1),[T,B]=(0,n.useState)(null),[P,W]=(0,n.useState)(null),[_,F]=(0,n.useState)(null),[U,R]=(0,n.useState)(!1),[O,$]=(0,n.useState)(null),[H,Y]=(0,n.useState)(null),[V,K]=(0,n.useState)(null),[G,Q]=(0,n.useState)(null);(0,n.useEffect)(()=>{if(!G)return;let e=(0,l.onSnapshot)((0,l.doc)(i.db,"notification_sequences",G.id),e=>{if(e.exists()){let t=M(e);Q(t),p(e=>e.map(e=>e.id===t.id?t:e))}});return()=>e()},[null==G?void 0:G.id]);let[J,X]=(0,n.useState)(!1),Z=(0,n.useRef)(null),[ee,et]=(0,n.useState)(!1),es=async()=>{if((null==e?void 0:e.uid)&&s){v(!0);try{let t=async()=>{try{let t=(0,l.query)((0,l.collection)(i.db,"notification_campaigns"),(0,l.where)("producerUserId","==",e.uid),(0,l.where)("eventId","==",s),(0,l.orderBy)("createdAt","desc"),(0,l.limit)(100));return(await (0,l.getDocs)(t)).docs.map(e=>A(e)).filter(e=>!e.sequenceId)}catch(t){try{let t=(0,l.query)((0,l.collection)(i.db,"notification_campaigns"),(0,l.where)("producerUserId","==",e.uid),(0,l.limit)(200));return(await (0,l.getDocs)(t)).docs.map(e=>A(e)).filter(e=>!e.sequenceId&&e.eventId===s).sort((e,t)=>t.createdAt.getTime()-e.createdAt.getTime())}catch(e){return[]}}},a=async()=>{try{let t=(0,l.query)((0,l.collection)(i.db,"notification_sequences"),(0,l.where)("producerUserId","==",e.uid),(0,l.where)("eventId","==",s),(0,l.orderBy)("updatedAt","desc"),(0,l.limit)(100));return(await (0,l.getDocs)(t)).docs.map(e=>M(e))}catch(t){try{let t=(0,l.query)((0,l.collection)(i.db,"notification_sequences"),(0,l.where)("producerUserId","==",e.uid),(0,l.limit)(200)),a=(await (0,l.getDocs)(t)).docs.map(e=>M(e)).filter(e=>e.eventId===s);return a.sort((e,t)=>t.updatedAt.getTime()-e.updatedAt.getTime()),a}catch(e){return[]}}},[n,d]=await Promise.all([t(),a()]);m(n),p(d)}finally{v(!1)}}};(0,n.useEffect)(()=>{es()},[null==e?void 0:e.uid,s]),(0,n.useEffect)(()=>{let e=e=>{Z.current&&!Z.current.contains(e.target)&&X(!1)};return J&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[J]);let ea=(0,n.useMemo)(()=>{let e=[...u.map(e=>({kind:"blast",data:e})),...x.map(e=>({kind:"sequence",data:e}))];return e.sort((e,t)=>I(t).getTime()-I(e).getTime()),e},[u,x]),en=(0,n.useMemo)(()=>{let e=ea;"all"!==g&&(e=e.filter(e=>"blast"===e.kind?k[g].includes(e.data.status):S[g].includes(e.data.status)));let t=j.toLowerCase().trim();if(t){let s=RegExp("\\b".concat(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),"i");return e.map(e=>{var a;let n=(e.data.name||"").toLowerCase(),i=e.data.name||"",l=0;return n===t?l=100:n.startsWith(t)?l=80:s.test(i)?l=60:n.includes(t)?l=40:"blast"===e.kind&&(null==(a=e.data.title)?void 0:a.toLowerCase().includes(t))&&(l=20),{item:e,score:l}}).filter(e=>e.score>0).sort((e,t)=>t.score-e.score).map(e=>e.item)}return e},[ea,g,j]),ei=(0,n.useMemo)(()=>{let e={all:ea.length,draft:0,active:0,completed:0,failed:0};for(let t of ea)"blast"===t.kind?(k.draft.includes(t.data.status)&&e.draft++,k.active.includes(t.data.status)&&e.active++,k.completed.includes(t.data.status)&&e.completed++,k.failed.includes(t.data.status)&&e.failed++):(S.draft.includes(t.data.status)&&e.draft++,S.active.includes(t.data.status)&&e.active++,S.completed.includes(t.data.status)&&e.completed++);return e},[ea]),el=(0,n.useMemo)(()=>{let e=u.reduce((e,t)=>e+(t.stats.sent||0),0),t=u.reduce((e,t)=>e+(t.stats.delivered||0),0),s=u.filter(e=>"scheduled"===e.status||"sending"===e.status).length+x.filter(e=>"active"===e.status).length,a=e>0?Math.round(t/e*100):0;return{sent:e,delivered:t,deliveryRate:a,active:s}},[u,x]),ed=async e=>{try{await (0,l.deleteDoc)((0,l.doc)(i.db,"notification_campaigns",e)),m(t=>t.filter(t=>t.id!==e)),t({type:"success",message:"Campaign deleted"})}catch(e){t({type:"error",message:"Delete failed: ".concat(e.message)})}},er=async e=>{try{await (0,l.deleteDoc)((0,l.doc)(i.db,"notification_sequences",e)),p(t=>t.filter(t=>t.id!==e)),t({type:"success",message:"Sequence deleted"})}catch(e){t({type:"error",message:"Delete failed: ".concat(e.message)})}};return(0,a.jsxs)(a.Fragment,{children:[u.length>0&&el.sent>0&&(0,a.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4",children:[{label:"Total Sent",value:el.sent.toLocaleStr
1ing()},{label:"Delivered",value:el.delivered.toLocaleString()},{label:"Delivery Rate",value:"".concat(el.deliveryRate,"%")},{label:"Active",value:el.active.toString()}].map(e=>(0,a.jsxs)("div",{className:"bg-card border border-card rounded-xl px-4 py-3",children:[(0,a.jsx)("p",{className:"studio-label",children:e.label}),(0,a.jsx)("p",{className:"text-[18px] font-semibold text-t1 mt-0.5",children:e.value})]},e.label))}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-4",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsx)("div",{className:"flex gap-1 p-1 bg-surface-raised rounded-lg",children:w.map(e=>(0,a.jsxs)("button",{onClick:()=>f(e.key),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-colors ".concat(g===e.key?"bg-white/[0.1] text-white border border-white/[0.15]":"text-t3 hover:text-t2"),children:[e.label,"all"!==e.key&&(0,a.jsx)("span",{className:"ml-1 text-[10px] opacity-60",children:ei[e.key]})]},e.key))}),(0,a.jsx)("input",{type:"text",placeholder:"Search campaigns...",value:j,onChange:e=>N(e.target.value),className:"px-3 py-1.5 bg-card border border-card rounded-lg text-[13px] text-t1 placeholder-t3 w-full sm:w-[180px] outline-none focus:border-white/20 transition-colors"}),(0,a.jsx)("button",{onClick:()=>et(!ee),className:"px-3 py-1 bg-card border border-card rounded-lg text-[12px] text-t3 hover:text-t2 hover:bg-white/[0.07] transition-all",children:"Templates"})]}),(0,a.jsxs)("div",{className:"relative",ref:Z,children:[(0,a.jsxs)(c.$n,{variant:"primary",size:"md",onClick:()=>X(!J),icon:(0,a.jsx)(o.c1,{className:"w-4 h-4"}),className:"rounded-xl",children:["New Campaign",(0,a.jsx)("svg",{className:"w-3.5 h-3.5 ml-0.5 opacity-60",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),J&&(0,a.jsxs)("div",{className:"absolute right-0 mt-1.5 w-56 bg-modal-glass backdrop-blur-xl border border-card rounded-xl shadow-xl z-50 overflow-hidden",children:[(0,a.jsxs)("button",{onClick:()=>{X(!1),B(null),W(null),F(null),E(!0)},className:"w-full px-4 py-3 text-left hover:bg-white/[0.06] transition-colors",children:[(0,a.jsx)("p",{className:"studio-body-strong",children:"One-time Push"}),(0,a.jsx)("p",{className:"studio-caption mt-0.5",children:"Send a single push notification blast"})]}),(0,a.jsx)("div",{className:"border-t border-white/[0.06]"}),(0,a.jsxs)("button",{onClick:()=>{X(!1),$(null),Y(null),K(null),R(!0)},className:"w-full px-4 py-3 text-left hover:bg-white/[0.06] transition-colors",children:[(0,a.jsx)("p",{className:"studio-body-strong",children:"Multi-step Sequence"}),(0,a.jsx)("p",{className:"studio-caption mt-0.5",children:"Create an automated notification series"})]})]})]})]}),(ee||!h&&0===ea.length)&&(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)("p",{className:"studio-label mb-3",children:"Quick Start Templates"}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:z.map(e=>(0,a.jsxs)("div",{className:"bg-card border border-card rounded-xl p-4 hover:bg-surface-raised transition-colors",children:[(0,a.jsx)("h4",{className:"studio-body-strong mb-1",children:e.name}),(0,a.jsx)("p",{className:"studio-caption mb-3",children:e.description}),(0,a.jsx)("div",{className:"space-y-1.5 mb-4",children:e.steps.map((e,t)=>{var s;return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-4 h-4 rounded-full bg-white/[0.06] flex items-center justify-center text-[9px] font-bold text-t3 shrink-0",children:t+1}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"studio-caption truncate",children:e.title}),(0,a.jsx)("p",{className:"text-[10px] text-t4",children:(s=e.delayMinutes,0===t?"Immediately":s>=1440?"".concat(Math.round(s/1440*10)/10," days later"):s>=60?"".concat(Math.round(s/60*10)/10," hours later"):"".concat(s," min later"))})]})]},t)})}),(0,a.jsx)(c.$n,{variant:"ghost",size:"sm",onClick:()=>{Y(e.steps),K(e.name),$(null),et(!1),R(!0)},className:"w-full",children:"Use Template"})]},e.name))})]}),h?(0,a.jsx)("div",{className:"flex items-center justify-center h-48",children:(0,a.jsx)("div",{className:"w-6 h-6 border-2 border-white/10 border-t-white rounded-full animate-spin"})}):0===en.length?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,a.jsx)("div",{className:"w-14 h-14 roun
1ded-full bg-card border border-card flex items-center justify-center mb-3",children:(0,a.jsx)("svg",{className:"w-6 h-6 text-t2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"})})}),(0,a.jsx)("h3",{className:"studio-subtitle mb-1",children:j.trim()?"No campaigns match your search":"No campaigns yet"}),(0,a.jsx)("p",{className:"studio-body max-w-xs",children:j.trim()?"Try a different search term":"Send one-time push blasts or create automated multi-step sequences to reach your audience."})]}):(0,a.jsx)("div",{className:"space-y-2",children:en.map(e=>(0,a.jsx)("div",{className:"group bg-card border border-card rounded-xl p-4 hover:bg-surface-raised transition-colors cursor-pointer",onClick:()=>(e=>{if("blast"===e.kind){let t=e.data;"draft"===t.status||"scheduled"===t.status?(B(t.id),W(null),F(null),E(!0)):("sent"===t.status||"sending"===t.status||"failed"===t.status)&&(F(t.id),B(null),W(null),E(!0))}else{let t=e.data;"draft"===t.status?($(t.id),Y(null),K(null),R(!0)):Q(t)}})(e),children:(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium tracking-wide uppercase ".concat("blast"===e.kind?"bg-violet-500/10 text-[rgb(var(--accent-purple)/0.70)]":"bg-cyan-500/10 text-cyan-400/70"),children:"blast"===e.kind?"Push":"Sequence"}),(0,a.jsx)("h4",{className:"studio-body-strong truncate",children:e.data.name||("blast"===e.kind?"Untitled Campaign":"Untitled Sequence")}),"blast"===e.kind?(0,a.jsx)("span",{className:"px-2 py-0.5 rounded-full text-[11px] font-medium ".concat(C[e.data.status].className),children:C[e.data.status].label}):(0,a.jsx)("span",{className:"px-2 py-0.5 rounded-full text-[11px] font-medium ".concat(L[e.data.status].className),children:L[e.data.status].label})]}),(0,a.jsx)("p",{className:"studio-caption truncate mb-2",children:"blast"===e.kind?e.data.title?"".concat(e.data.title," — ").concat(e.data.body):"No content yet":"".concat(e.data.steps.length," step").concat(1!==e.data.steps.length?"s":""," \xb7 ").concat(q(e.data))}),(0,a.jsxs)("div",{className:"flex items-center gap-4 text-[11px] text-t4",children:[(0,a.jsx)("span",{children:function(e){let t=e.data;return"event_participants"===t.audienceType&&t.eventName?t.eventName:"distribution_list"===t.audienceType?"Distribution List":"event_participants"===t.audienceType?"Event Participants":"all"===t.audienceType?"All Users":"segment"===t.audienceType?"Segment":"community_members"===t.audienceType?"Community Members":"Manual"}(e)}),"blast"===e.kind&&(0,a.jsxs)(a.Fragment,{children:[null!=e.data.estimatedAudienceSize&&0===e.data.stats.sent&&(0,a.jsxs)("span",{children:["~",e.data.estimatedAudienceSize," recipients"]}),e.data.stats.sent>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("span",{children:["Sent: ",e.data.stats.sent]}),(0,a.jsxs)("span",{children:["Delivered: ",e.data.stats.delivered]}),e.data.stats.failed>0&&(0,a.jsxs)("span",{className:"text-negative-ink/60",children:["Failed: ",e.data.stats.failed]})]})]}),e.data.hostName&&(0,a.jsxs)("span",{children:["By ",e.data.hostName]}),(0,a.jsx)("span",{children:"blast"===e.kind?e.data.sentAt?"Sent ".concat(e.data.sentAt.toLocaleDateString()):e.data.scheduledAt?"Scheduled ".concat(e.data.scheduledAt.toLocaleDateString()):"Created ".concat(e.data.createdAt.toLocaleDateString()):e.data.updatedAt.toLocaleDateString()})]}),"sequence"===e.kind&&"active"===e.data.status&&(0,a.jsx)("div",{className:"flex items-center gap-1.5 mt-2",children:e.data.steps.map((e,t)=>(0,a.jsx)("div",{className:"h-1.5 rounded-full flex-1 ".concat("sent"===e.status||"completed"===e.status?"bg-emerald-500/40":"scheduled"===e.status?"bg-amber-500/30":"bg-white/[0.06]"),title:"Step ".concat(t+1,": ").concat(e.title||"(untitled)")},e.id))})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity ml-3",children:["blast"===e.kind&&("sent"===e.data.status||"failed"===e.data.status)&&(0,a.jsx)("button",{onClick:t=>{t.stopPropagation(),W(e.data.id),B(null),F(null),E(!0)},className:"p-1.5 rounded-lg hover:bg-white/5 text-t4 hover:text-t2 transition-colors",title:"Duplicate campaign",children:(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.7
15"})})}),"blast"===e.kind&&("draft"===e.data.status||"failed"===e.data.status)&&(0,a.jsx)("button",{onClick:t=>{t.stopPropagation(),ed(e.data.id)},className:"p-1.5 rounded-lg hover:bg-white/5 text-t4 hover:text-negative-ink transition-colors",children:(0,a.jsx)(o.uc,{className:"w-4 h-4"})}),"sequence"===e.kind&&(0,a.jsx)("button",{onClick:t=>{t.stopPropagation(),("active"!==e.data.status||window.confirm("This sequence is active. Deleting it will stop all pending steps. Continue?"))&&er(e.data.id)},className:"p-1.5 rounded-lg hover:bg-white/5 text-t4 hover:text-negative-ink transition-colors",children:(0,a.jsx)(o.uc,{className:"w-4 h-4"})})]})]})},"".concat(e.kind,"-").concat(e.data.id)))}),D&&(0,a.jsx)(b,{campaignId:T,duplicateFromId:P,viewMode:_?"detail":"build",viewCampaignId:_,onClose:()=>{E(!1),B(null),W(null),F(null),es()}}),U&&(0,a.jsx)(y,{sequenceId:O,templateSteps:H,templateName:V,onClose:()=>{R(!1),$(null),Y(null),K(null),es()}}),G&&(0,a.jsxs)("div",{className:"fixed inset-0 z-50 bg-surface-base overflow-y-auto",children:[(0,a.jsx)("div",{className:"sticky top-0 z-10 bg-surface-base/95 backdrop-blur-md border-b border-white/[0.06]",children:(0,a.jsxs)("div",{className:"max-w-3xl mx-auto flex items-center justify-between px-6 py-3.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("button",{onClick:()=>Q(null),className:"p-1.5 rounded-lg text-t3 hover:text-t2 transition-colors",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M6 18L18 6M6 6l12 12"})})}),(0,a.jsx)("h2",{className:"studio-subtitle",children:"Sequence Details"}),(0,a.jsx)("span",{className:"px-2 py-0.5 rounded-full text-[11px] font-medium ".concat(L[G.status].className),children:L[G.status].label})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:["active"===G.status&&(0,a.jsxs)("button",{onClick:()=>{Q(null),$(G.id),Y(null),K(null),R(!0)},className:"flex items-center gap-1.5 px-3 py-1.5 text-[13px] text-t2 hover:text-t1 hover:bg-white/[0.06] rounded-lg transition-all",children:[(0,a.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"})}),"Edit Steps"]}),(0,a.jsxs)("button",{onClick:()=>{("active"!==G.status||window.confirm("This sequence is active. Deleting it will stop all pending steps. Continue?"))&&(er(G.id),Q(null))},className:"flex items-center gap-1.5 px-3 py-1.5 text-[13px] text-negative-ink/60 hover:text-negative-ink hover:bg-red-500/10 rounded-lg transition-all",children:[(0,a.jsx)(o.uc,{className:"w-3.5 h-3.5"}),"Delete"]})]})]})}),(0,a.jsxs)("div",{className:"max-w-3xl mx-auto px-6 py-8 space-y-6",children:[(0,a.jsxs)("div",{className:"bg-card border border-card rounded-xl p-5",children:[(0,a.jsx)("h3",{className:"studio-subtitle mb-1",children:G.name}),(0,a.jsxs)("div",{className:"flex items-center gap-4 studio-caption mt-1",children:[G.eventName&&(0,a.jsx)("span",{children:G.eventName}),(0,a.jsxs)("span",{children:[G.steps.length," step",1!==G.steps.length?"s":""]}),(0,a.jsxs)("span",{children:["Total: ",q(G)]}),(0,a.jsxs)("span",{children:["Created ",G.createdAt.toLocaleDateString()]})]})]}),(0,a.jsxs)("div",{className:"bg-card border border-card rounded-xl p-5",children:[(0,a.jsx)("h3",{className:"studio-body-strong mb-4",children:"Steps"}),(0,a.jsx)("div",{className:"space-y-0",children:G.steps.map((e,t)=>{let s="sent"===e.status||"completed"===e.status,n="scheduled"===e.status;return(0,a.jsxs)("div",{className:"flex gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col items-center",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-[12px] font-bold shrink-0 ".concat(s?"bg-emerald-500/20 text-positive-ink":n?"bg-amber-500/20 text-attention-ink":"bg-white/[0.06] text-t3"),children:s?(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):t+1}
1),t<G.steps.length-1&&(0,a.jsx)("div",{className:"w-px flex-1 my-1 ".concat(s?"bg-emerald-500/20":"bg-white/[0.06]")})]}),(0,a.jsxs)("div",{className:"flex-1 pb-5 ".concat(t===G.steps.length-1?"pb-0":""),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-0.5",children:[(0,a.jsx)("p",{className:"studio-body-strong",children:e.title||"Step ".concat(t+1)}),s&&(0,a.jsx)("span",{className:"text-[10px] text-positive-ink/60",children:"Sent"}),n&&(0,a.jsx)("span",{className:"text-[10px] text-attention-ink/60",children:"Scheduled"})]}),(0,a.jsx)("p",{className:"studio-caption mb-1",children:e.body}),(0,a.jsxs)("div",{className:"flex items-center gap-3 text-[11px] text-t4",children:[(0,a.jsx)("span",{children:0===t?"Immediately":e.delayMinutes>=1440?"".concat(Math.round(e.delayMinutes/1440),"d after previous"):e.delayMinutes>=60?"".concat(Math.round(e.delayMinutes/60),"h after previous"):"".concat(e.delayMinutes,"m after previous")}),e.sentAt&&(0,a.jsxs)("span",{className:"text-positive-ink/40",children:["Sent ",e.sentAt.toLocaleDateString()," at ",e.sentAt.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]}),!e.sentAt&&e.scheduledAt&&(0,a.jsxs)("span",{className:"text-attention-ink/40",children:["Drops ",e.scheduledAt.toLocaleDateString()," at ",e.scheduledAt.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]})]})]},e.id||t)})})]}),("active"===G.status||"completed"===G.status)&&(0,a.jsxs)("div",{className:"bg-card border border-card rounded-xl p-5",children:[(0,a.jsx)("h3",{className:"studio-body-strong mb-3",children:"Progress"}),(0,a.jsx)("div",{className:"flex items-center gap-2",children:G.steps.map((e,t)=>(0,a.jsx)("div",{className:"h-2.5 rounded-full flex-1 ".concat("sent"===e.status||"completed"===e.status?"bg-emerald-500/50":"scheduled"===e.status?"bg-amber-500/40":"bg-white/[0.06]")},e.id||t))}),(0,a.jsxs)("div",{className:"flex justify-between mt-2 text-[11px] text-t4",children:[(0,a.jsxs)("span",{children:[G.steps.filter(e=>"sent"===e.status||"completed"===e.status).length," of ",G.steps.length," sent"]}),(0,a.jsxs)("span",{children:[q(G)," total"]})]})]})]})]})]})}}}]);

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.