1"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[784],{80784(e,t,s){s.r(t),s.d(t,{default:()=>re});var n=s(65043),a=s(67740),l=s(89379),i=s(96967),r=s(84508);const c=new Set(["de","en","fr","es","it","pt","pl","nl"]),d=()=>{const e=(i.Ay.resolvedLanguage||i.Ay.language||"de").split("-")[0].toLowerCase();return c.has(e)?e:"de"},o=e=>{var t,s;return(null===(t=(0,r.qq)("nl")[d()])||void 0===t?void 0:t[e])||(null===(s=(0,r.qq)("nlExtra")[d()])||void 0===s?void 0:s[e])||e},p={no_subject:"Der Betreff fehlt.",long_subject:"Der Betreff ist lang \u2013 auf dem Handy werden etwa 40 Zeichen angezeigt.",spammy_subject:"Gro\xdfbuchstaben oder \u201eGratis!\u201c-Muster im Betreff landen oft im Spam.",no_preheader:"Ohne Vorschautext zeigen Postf\xe4cher den Anfang der Mail an.",no_address:"Die Anschrift f\xfcr die Fu\xdfzeile fehlt (Pflichtangabe).",empty:"Der Newsletter hat noch keinen Inhalt.",placeholder:"Der Newsletter enth\xe4lt noch den Platzhaltertext aus der Vorlage.",img_alt:"Ein Bild hat keinen Alternativtext \u2013 wichtig, wenn Bilder blockiert sind.",only_images:"Nur Bilder, kaum Text \u2013 das werten Spamfilter negativ.",button_no_link:"Ein Knopf hat noch keinen Link und wird nicht angezeigt.",sender:"Versand \xfcber die Nakura-Absenderadresse. Mit eigener Domain (E-Mail-Einstellungen) kommen Mails zuverl\xe4ssiger an."},m=e=>o(p[null===e||void 0===e?void 0:e.code]||"Das hat nicht geklappt. Bitte versuche es noch einmal.");var u=s(81490),h=s(33882);const x='\n.nkn-split{grid-template-columns:minmax(0,1.5fr) minmax(0,1fr)}.nkn-split2{grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr)}\n@media (max-width:860px){.nkn-split,.nkn-split2{grid-template-columns:minmax(0,1fr)}.nkn-split>*,.nkn-split2>*{min-width:0}}\n.nkn-head{display:flex;gap:16px;align-items:flex-end;justify-content:space-between;flex-wrap:wrap}\n.nkn-back{display:inline-flex;align-items:center;gap:4px;font-size:13px;font-weight:600;color:var(--muted);text-decoration:none;margin-bottom:10px}\n.nkn-back:hover{color:var(--ink)}\n.nkn-site{display:inline-flex;align-items:center;gap:8px;font-size:14px;color:var(--muted);margin-top:6px}\n.nkn-site select{min-height:44px;padding:4px 10px;font-size:14px;width:auto;border-radius:10px;font-weight:600;color:var(--ink)}\n.nkn-spark{width:100%;height:120px;display:block}\n.nkn-spark .a{fill:url(#nknGrad)}.nkn-spark .l{fill:none;stroke:var(--gold);stroke-width:2;vector-effect:non-scaling-stroke}\n.nkn-spark .u{fill:none;stroke:var(--bad);stroke-width:1.5;stroke-dasharray:3 3;opacity:.55;vector-effect:non-scaling-stroke}\n.nkn-check{display:flex;gap:12px;align-items:center;padding:11px 0;border-top:1px solid var(--line)}\n.nkn-check:first-child{border-top:0}\n.nkn-dot{width:22px;height:22px;border-radius:50%;display:grid;place-items:center;flex:0 0 auto;border:1.5px solid var(--line2);color:transparent}\n.nkn-dot.done{background:var(--ok);border-color:var(--ok);color:#fff}\n.nkn-check.done .t{color:var(--muted);text-decoration:line-through;text-decoration-color:rgba(127,127,127,.5)}\n.nkn-quota{height:8px;border-radius:99px;background:rgba(127,127,127,.15);overflow:hidden}\n.nkn-quota > i{display:block;height:100%;background:linear-gradient(90deg,#E2B43A,#C99513);border-radius:99px;transition:width .6s var(--e-out)}\n.nkn-filters{display:flex;gap:8px;flex-wrap:wrap;align-items:center}\n.nkn-chip{font:inherit;font-size:13px;font-weight:600;border-radius:999px;border:1px solid var(--line2);background:var(--solid);color:var(--ink2);min-height:44px;padding:0 12px;\n cursor:pointer;display:inline-flex;gap:6px;align-items:center;transition:all var(--d-hover) var(--e-std)}\n.nkn-chip[aria-pressed=true]{background:var(--ink);color:var(--bg);border-color:var(--ink)}\n.nkn-chip .c{font-size:12px;opacity:.7}\n.nkn-row{grid-template-columns:26px 34px minmax(0,1.4fr) 120px minmax(0,1fr) 96px}\n@media (max-width:760px){.nkn-row{grid-template-columns:26px 34px minmax(0,1fr) auto}.nkn-row .c-lists,.nkn-row .c-date{display:none}}\n.nkn-email{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.nkn-sub{font-size:13.5px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.nkn-bulk{position:sticky;bottom:16px;z-index:20;margin-top:14px;display:flex;gap:8px;align-items:center;flex-wrap:wrap;background:var(--ink);color:var(--bg);\n border-radius:16px;padding:10px 12px;box-shadow:0 20px 40px -18px rgba(0,0,0,.5);animation:nkgin var(--sp-soft-d) var(--sp-soft) both}\n.nkn-bulk .b{background:rgba(255,255,255,.1);border-color:transparent;color:inherit}.nkn-bulk .b:hover:not(:disabled){background:rgba(255,255,255,.18)}\n@media (prefers-color-scheme:dark){.nkn-bulk .b{background:rgba(0,0,0,.08)}}\n.nkn-drop{border:1.5px dashed var(--line2);border-radius:16px;padding:30px 18px;text-align:center;display:flex;flex-direction:column;gap:8px;align-items:center;\n transition:border-color var(--d-hover) var(--e-std),background var(--d-hover) var(--e-std);cursor:pointer}\n.nkn-drop.over,.nkn-drop:hover{border-color:var(--gold);background:var(--gold-soft)}\n.nkn-steps{display:flex;gap:6px;margin:4px 0 16px}.nkn-steps i{height:4px;flex:1;border-radius:4px;background:rgba(127,127,127,.2);transition:background var(--d-base) var(--e-std)}\n.nkn-steps i.on{background:var(--gold)}\n.nkn-sample{width:100%;border-collapse:collapse;font-size:13px}.nkn-sample th,.nkn-sample td{text-align:left;padding:6px 8px;border-bottom:1px solid var(--line);white-space:nowrap;\n overflow:hidden;text-overflow:ellipsis;max-width:180px}.nkn-sample th{color:var(--muted);font-weight:600}\n.nkn-scroll{overflow-x:auto;border:1px solid var(--line);border-radius:12px}\n.nkn-report{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.nkn-report div{background:rgba(127,127,127,.07);border-radius:12px;padding:10px 12px}\n.nkn-report b{display:block;font-size:20px;letter-spacing:-.02em}.nkn-report span{font-size:12px;color:var(--muted)}\n.nkn-radio{display:flex;gap:12px;align-items:flex-start;border:1px solid var(--line2);border-radius:14px;padding:14px;cursor:pointer;transition:border-color var(--d-hover) var(--e-std),background var(--d-hover) var(--e-std)}\n.nkn-radio:has(input:checked){border-color:var(--gold);background:var(--gold-soft)}.nkn-radio input{margin-top:3px;accent-color:var(--gold)}\n.nkn-tl{position:relative;padding-left:22px}.nkn-tl::before{content:"";position:absolute;
1left:7px;top:6px;bottom:6px;width:2px;background:var(--line2);border-radius:2px}\n.nkn-tl .ev{position:relative;padding:0 0 14px}.nkn-tl .ev::before{content:"";position:absolute;left:-19px;top:4px;width:10px;height:10px;border-radius:50%;background:var(--solid);border:2px solid var(--gold)}\n.nkn-tl .ev.bad::before{border-color:var(--bad)}\n.nkn-proof{font-size:13.5px;background:rgba(127,127,127,.07);border-radius:10px;padding:10px 12px;margin-top:6px;line-height:1.5}\n.nkn-camp{grid-template-columns:minmax(0,1fr) 130px 110px 100px 28px}\n@media (max-width:760px){.nkn-camp{grid-template-columns:minmax(0,1fr) auto}.nkn-camp .c-x{display:none}}\n.nkn-bar{height:10px;border-radius:99px;background:rgba(127,127,127,.15);overflow:hidden;display:flex}.nkn-bar i{display:block;height:100%}\n/* sign-up block preview */\n.nkn-frame{width:100%;border:0;border-radius:14px;background:#fff;display:block;box-shadow:inset 0 0 0 1px var(--line)}\n.nkn-copy{display:flex;gap:8px;align-items:center;background:rgba(127,127,127,.08);border-radius:12px;padding:6px 6px 6px 12px;font-size:13.5px}\n.nkn-copy code{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12.5px}\n/* editor */\n.nke{position:fixed;inset:0;z-index:900;display:grid;grid-template-rows:auto 1fr;background:var(--bg);animation:nkgfade var(--d-base) var(--e-out) both}\n.nke-top{display:flex;gap:10px;align-items:center;padding:10px 14px;border-bottom:1px solid var(--line);background:var(--card);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px)}\n.nke-name{font:inherit;font-weight:700;font-size:16px;border:1px solid transparent;background:none;color:var(--ink);border-radius:10px;padding:6px 8px;min-width:120px;max-width:340px;width:auto}\n.nke-name:hover{border-color:var(--line2)}\n.nke-saved{font-size:12.5px;color:var(--muted);display:inline-flex;gap:5px;align-items:center;white-space:nowrap}\n.nke-body{display:grid;grid-template-columns:260px minmax(0,1fr) 340px;min-height:0}\n.nke-side{border-right:1px solid var(--line);overflow:auto;padding:16px;display:flex;flex-direction:column;gap:18px;background:rgba(255,255,255,.35)}\n@media (prefers-color-scheme:dark){.nke-side{background:rgba(0,0,0,.18)}}\n.nke-insp{border-right:0;border-left:1px solid var(--line)}\n.nke-lbl{font-size:11.5px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);margin-bottom:8px}\n.nke-pal{display:grid;grid-template-columns:1fr 1fr;gap:6px}\n.nke-pal button{font:inherit;font-size:12.5px;font-weight:600;display:flex;flex-direction:column;align-items:center;gap:6px;padding:12px 6px;border-radius:12px;border:1px solid var(--line);\n background:var(--solid);color:var(--ink2);cursor:pointer;transition:border-color var(--d-hover) var(--e-std),transform var(--d-press) var(--e-std),box-shadow var(--d-hover) var(--e-std)}\n.nke-pal button:hover{border-color:var(--gold);box-shadow:0 6px 16px -10px rgba(212,160,23,.6)}.nke-pal button:active{transform:scale(.96)}\n.nke-out{display:flex;flex-direction:column;gap:4px}\n.nke-oi{display:flex;align-items:center;gap:8px;border-radius:10px;padding:7px 8px;font-size:13px;cursor:pointer;border:1px solid transparent;transition:background var(--d-hover) var(--e-std)}\n.nke-oi:hover{background:rgba(127,127,127,.08)}.nke-oi[aria-current=true]{background:var(--gold-soft);border-color:rgba(212,160,23,.4)}\n.nke-oi .t{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:20px}\n.nke-oi .ops{display:none;gap:0;
1margin:-6px -4px -6px 0}.nke-oi .ops .b{min-height:28px;width:28px}\n.nke-oi[aria-current=true] .ops{display:flex}\n.nke-canvas{overflow:auto;padding:26px 20px 60px;display:flex;flex-direction:column;align-items:center;gap:14px;\n background:radial-gradient(circle at 1px 1px,rgba(127,127,127,.18) 1px,transparent 0) 0 0/18px 18px}\n.nke-inbox{width:100%;max-width:660px;background:var(--solid);border:1px solid var(--line);border-radius:14px;padding:12px 16px;display:flex;gap:12px;align-items:center;box-shadow:var(--shadow)}\n.nke-inbox .s{font-weight:700;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nke-inbox .p{font-size:13px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.nke-dev{border-radius:18px;overflow:hidden;box-shadow:0 30px 60px -30px rgba(0,0,0,.45),0 0 0 1px var(--line);transition:width var(--sp-soft-d) var(--sp-soft);background:#f4f4f5;position:relative}\n.nke-dev.phone{border-radius:34px;box-shadow:0 30px 60px -30px rgba(0,0,0,.5),0 0 0 10px #1d1d1f,0 0 0 11px #3a3a3c}\n.nke-dev iframe{display:block;width:100%;border:0;background:transparent}\n.nke-busy{position:absolute;top:10px;right:12px;font-size:11.5px;font-weight:700;color:var(--muted);background:var(--solid);border-radius:99px;padding:3px 9px;box-shadow:var(--shadow)}\n.nke-warn{width:100%;max-width:660px;display:flex;flex-direction:column;gap:6px}\n.nke-fmt{display:flex;gap:4px;margin-bottom:6px;flex-wrap:wrap}\n.nke-aud{display:flex;flex-direction:column;gap:6px;max-height:220px;overflow:auto}\n.nke-aud label{display:flex;gap:9px;align-items:center;font-size:13.5px;padding:6px 8px;border-radius:10px;cursor:pointer}\n.nke-aud label:hover{background:rgba(127,127,127,.07)}\n.nke-count{display:flex;align-items:baseline;gap:6px;font-size:13px;color:var(--muted)}.nke-count b{font-size:22px;color:var(--ink);letter-spacing:-.02em}\n.nke-mob{display:none}\n@media (max-width:1100px){.nke-body{grid-template-columns:220px minmax(0,1fr) 300px}.nke-top{flex-wrap:wrap;min-width:0}.nke-top>.grow{display:none}}\n@media (max-width:860px){\n .nke-body{grid-template-columns:minmax(0,1fr)}.nke-body > .nke-side{display:none}.nke-body,.nke-canvas{min-width:0;max-width:100vw}.nke-dev{max-width:100%}.nke-canvas>*{max-width:100%}\n .nke-mob{display:flex;gap:8px;position:fixed;left:12px;right:12px;bottom:calc(12px + env(safe-area-inset-bottom));z-index:5;background:var(--ink);border-radius:16px;padding:8px;\n box-shadow:0 20px 40px -16px rgba(0,0,0,.55)}\n .nke-mob .b{flex:1;background:rgba(255,255,255,.1);border-color:transparent;color:var(--bg)}\n .nke-canvas{padding:16px 10px 96px}.nke-hide-m{display:none!important}\n .nke-top{display:grid;grid-template-columns:44px minmax(0,1fr) 44px 48px;padding:8px 10px;gap:6px;min-width:0;width:100%}\n .nke-top>.grow{display:none}\n .nke-top>[data-testid=nle-back]{grid-column:1;grid-row:1}\n .nke-name{grid-column:2;grid-row:1;min-width:0;max-width:none;width:100%;font-size:15px}\n .nke-saved{grid-column:3/5;grid-row:1;min-width:0;justify-content:flex-end;text-align:right;white-space:normal}\n .nke-top>[data-testid=nle-device]{grid-column:1/3;grid-row:2;justify-self:start}\n .nke-top>[data-testid=nle-dark]{grid-column:3;grid-row:2}\n .nke-top>[data-testid=nle-send]{grid-column:4;grid-row:2;min-width:0;padding:0}\n}\n';var b=s(79722),g=s(24227),w=s(66996),v=s(92770);function j(e){const t=async function(t,s,n,a){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const r=e?await e():null;try{return(await(0,b.A)((0,l.A)({method:t,url:"".concat(g.t,"/api/studio/newsletter").concat(s),data:n,params:a,timeout:3e4,headers:r?{Authorization:"Bearer ".concat(r)}:{}},i))).data}catch(p){var c,d;const e=null===p||void 0===p||null===(c=p.response)||void 0===c||null===(d=c.data)||void 0===d?void 0:d.detail;p.code=e&&e.code||(p.response?"http_".concat(p.response.status):"network"),p.detail=e&&"object"===typeof e?e:{};const t=e&&e.message||("string"===typeof e?e:"");throw p.message="send_failed"===p.code?(e=>{var t;const s=(null===e||void 0===e?void 0:e.code)||(null===e||void 0===e||null===(t=e.detail)||void 0===t?void 0:t.code);return o({network:"Keine Verbindung. Bitte pr\xfcfe das Internet.",no_link_page:"Du hast noch keine Nakura-Link-Seite.",newsletter_disabled:"Der Newsletter ist f\xfcr dein Konto nicht freigeschaltet.",not_found:"Der Eintrag wurde nicht gefunden. Lade die Seite neu.",already_sent:"Dieser Newsletter wurde bereits versendet.",sending:"Bitte halte den Versand zuerst an.",invalid_email:"Bitte gib eine g\xfcltige E-Mail-Adresse ein.",test_recipient:"Test-Mails gehen nur an deine eigene Adresse, Mitarbeitende oder angemeldete Kontakte.",rate_limited:"Zu viele Versuche. Bitte warte einen Moment.",send_failed:"Die E-Mail konnte nicht gesendet werden. Bitte versuche es erneut.",missing_subject:"Bitte trage einen Betreff ein.",missing_address:"Bitte hinterlege zuerst deine Anschrift in den Einstellungen.",invalid_block:"Ein Newsletter-Baustein ist unvollst\xe4ndig oder ung\xfcltig.",invalid_audience:"In dieser Zielgruppe sind keine angemeldeten Kontakte.",invalid_time:"Bitte w\xe4hle einen g\xfcltigen Zeitpunkt f\xfcr den Versand.",not_scheduled:"Dieser Newsletter ist nicht geplant.",not_sending:"Der Versand l\xe4uft gerade nicht.",not_paused:"Der Versand ist nicht angehalten.",invalid_source:"Die Anmeldequelle ist unvollst\xe4ndig oder nicht verf\xfcgbar.",invalid_list:"Bitte pr\xfcfe den Listennamen.",limit_lists:"Du hast die H\xf6chstzahl an Listen erreicht.",default_list:"Die Standardliste kann nicht gel\xf6scht werden.",invalid_segment:"Bitte pr\xfcfe die Segmentregeln.",invalid_input:"Bitte pr\xfcfe deine Eingaben.",duplicate:"Diese E-Mail-Adresse ist bereits angemeldet.",suppressed:"Diese E-Mail-Adresse kann nicht erneut angemeldet werden.",not_pending:"Nur unbest\xe4tigte Kontakte k\xf6nnen eine neue Best\xe4tigung erhalten.",invalid_csv:"Die CSV-Datei konnte nicht gelesen werden. Bitte pr\xfcfe das Format.",invalid_mapping:"Bitte w\xe4hle die E-Mail-Spalte aus.",too_many:"Die Datei enth\xe4lt zu viele Kontakte.",too_large:"Die Datei ist zu gro\xdf.",invalid_attestation:"Bitte best\xe4tige die vorhandenen Einwilligungen.",quota:"Dein Versandlimit ist erreicht. Bitte pr\xfcfe deinen Tarif.",forbidden:"Du hast keinen Zugriff auf diese Website."}
1[s]||"Das hat nicht geklappt. Bitte versuche es noch einmal.")})(p):t?(0,v.Pl)(t,{code:e&&e.code,params:e&&e.params}):p.response?(0,w.st)("common.error_generic"):(0,w.st)("newsletter.api_err_network"),p}},s=e=>"/".concat(encodeURIComponent(e));return{status:()=>t("get","/status"),sites:()=>t("get","/sites"),overview:e=>t("get","".concat(s(e),"/overview")),settings:e=>t("get","".concat(s(e),"/settings")),saveSettings:(e,n)=>t("put","".concat(s(e),"/settings"),n),contacts:(e,n)=>t("get","".concat(s(e),"/contacts"),void 0,n),addContact:(e,n)=>t("post","".concat(s(e),"/contacts"),n),contact:(e,n)=>t("get","".concat(s(e),"/contacts/").concat(n)),patchContact:(e,n,a)=>t("patch","".concat(s(e),"/contacts/").concat(n),a),deleteContact:(e,n)=>t("delete","".concat(s(e),"/contacts/").concat(n)),unsubscribeContact:(e,n)=>t("post","".concat(s(e),"/contacts/").concat(n,"/unsubscribe")),resendDoi:(e,n)=>t("post","".concat(s(e),"/contacts/").concat(n,"/resend-doi")),bulk:(e,n)=>t("post","".concat(s(e),"/contacts/bulk"),n),exportUrl:(e,t)=>
1"".concat(g.t,"/api/studio/newsletter").concat(s(e),"/").concat(t),download:async(e,n,a)=>{const l=await t("get","".concat(s(e),"/").concat(n),void 0,void 0,{responseType:"blob"}),i=URL.createObjectURL(l),r=document.createElement("a");r.href=i,r.download=a,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(i),2e3)},importPreview:(e,n,a)=>t("post","".concat(s(e),"/import/preview"),{csv:n,mapping:a}),importCommit:(e,n)=>t("post","".concat(s(e),"/import"),n),lists:e=>t("get","".concat(s(e),"/lists")),createList:(e,n)=>t("post","".concat(s(e),"/lists"),n),updateList:(e,n,a)=>t("put","".concat(s(e),"/lists/").concat(n),a),deleteList:(e,n)=>t("delete","".concat(s(e),"/lists/").concat(n)),segments:e=>t("get","".concat(s(e),"/segments")),segmentPreview:(e,n)=>t("post","".concat(s(e),"/segments/preview"),n),createSegment:(e,n)=>t("post","".concat(s(e),"/segments"),n),deleteSegment:(e,n)=>t("delete","".concat(s(e),"/segments/").concat(n)),campaigns:e=>t("get","".concat(s(e),"/campaigns")),createCampaign:function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t("post","".concat(s(e),"/campaigns"),n)},campaign:(e,n)=>t("get","".concat(s(e),"/campaigns/").concat(n)),saveCampaign:(e,n,a)=>t("put","".concat(s(e),"/campaigns/").concat(n),a),deleteCampaign:(e,n)=>t("delete","".concat(s(e),"/campaigns/").concat(n)),preview:(e,n,a)=>t("post","".concat(s(e),"/campaigns/").concat(n,"/preview"),a),testSend:(e,n,a)=>t("post","".concat(s(e),"/campaigns/").concat(n,"/test"),a),audience:(e,n,a)=>t("post","".concat(s(e),"/campaigns/").concat(n,"/audience"),{audience:a}),send:(e,n)=>t("post","".concat(s(e),"/campaigns/").concat(n,"/send")),schedule:(e,n,a)=>t("post","".concat(s(e),"/campaigns/").concat(n,"/schedule"),{at:a}),action:(e,n,a)=>t("post","".concat(s(e),"/campaigns/").concat(n,"/").concat(a)),stats:(e,n)=>t("get","".concat(s(e),"/campaigns/").concat(n,"/stats")),blockEmbed:e=>t("get","".concat(s(e),"/block/embed")),installBlock:e=>t("post","".concat(s(e),"/block/install")),sources:e=>t("get","".concat(s(e),"/sources")),syncSources:e=>t("post","".concat(s(e),"/sources/sync")),addToLink:async(t,s)=>{var n;const a=e?await e():null,l=a?{Authorization:"Bearer ".concat(a)}:{},i=null===(n=(await b.A.get("".concat(g.t,"/api/link-pages/mine"),{headers:l,timeout:2e4})).data)||void 0===n?void 0:n.link_page;if(!i){const e=new Error((0,w.st)("newsletter.api_no_link_page"));throw e.code="no_link_page",e}const r=i.links||[];return r.some(e=>e.url===s)?{already:!0}:(await b.A.patch("".concat(g.t,"/api/link-pages/mine"),{links:[...r,{label:t,url:s,icon:"mail"}]},{headers:l,timeout:2e4}),{added:!0})}}}const _=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return"\u2013";return new Date(e).toLocaleString((0,w.J6)(),t?{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}:{day:"2-digit",month:"2-digit",year:"numeric"})},k=e=>(e||0).toLocaleString((0,w.J6)()),f=e=>null==e?"\u2013":"".concat(e.toLocaleString((0,w.J6)(),{maximumFractionDigits:1})," %");var y=s(70579);const N={subscribed:["newsletter.cstat_subscribed","ok"],pending:["newsletter.cstat_pending","warn"],unsubscribed:["newsletter.cstat_unsubscribed",""],bounced:["newsletter.cstat_bounced","bad"],complained:["newsletter.cstat_complained","bad"],cleaned:["newsletter.cstat_cleaned","bad"]},C=["block","hosted","link","form","import","l17","manual"],S=["signup","confirm","subscribe_import","unsubscribe","bounce","complaint","tracking_on","erase"],I=(e,t)=>C.includes(t)?e("newsletter.source_".concat(t)):t,A=(e,t)=>N[t]?e(N[t][0]):t;function T(e){let{api:t,wid:s,toast:a,onChange:i}=e;const r=(0,w.Uy)(),[c,d]=(0,n.useState)(""),[o,p]=(0,n.useState)(""),[m,u]=(0,n.useState)(null),[x,b]=(0,n.useState)(null),[g,v]=(0,n.useState)([]),[j,f]=(0,n.useState)(!1),[S,T]=(0,n.use
1State)(null),[B,U]=(0,n.useState)(!1),[q,F]=(0,n.useState)(!1),[M,R]=(0,n.useState)(!1),[W,O]=(0,n.useState)([]),K=(0,n.useRef)(null),P=(0,n.useCallback)(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return b(null),t.contacts(s,(0,l.A)({q:c,status:o},e)).then(t=>{u(s=>e.cursor&&s?(0,l.A)((0,l.A)({},t),{},{contacts:[...s.contacts,...t.contacts]}):t)}).catch(e=>b(e.message))},[t,s,c,o]);(0,n.useEffect)(()=>(clearTimeout(K.current),K.current=setTimeout(()=>{v([]),P()},c?250:0),()=>clearTimeout(K.current)),[P,c]),(0,n.useEffect)(()=>{t.lists(s).then(e=>O(e.lists)).catch(()=>{})},[t,s]);const H=()=>{P(),i&&i()},V=async(e,n)=>{try{const l=await t.bulk(s,{ids:g,action:e,value:n});a(r("newsletter.toast_changed",{count:l.changed})),v([]),H()}catch(l){a(l.message,"bad")}},Z=(null===m||void 0===m?void 0:m.counts)||{},G=[["",r("newsletter.chip_all"),Z.total],["subscribed",r("newsletter.chip_subscribed"),Z.subscribed],["pending",r("newsletter.chip_pending"),Z.pending],["unsubscribed",r("newsletter.chip_unsubscribed"),Z.unsubscribed],["bounced",r("newsletter.chip_bounced"),(Z.bounced||0)+(Z.cleaned||0)+(Z.complained||0)||void 0]],J=(null===m||void 0===m?void 0:m.contacts)||[],Y=J.length>0&&J.every(e=>g.includes(e.contact_id));return(0,y.jsxs)("div",{className:"stack","data-testid":"nl-contacts",children:[(0,y.jsxs)("div",{className:"row between",children:[(0,y.jsx)("div",{className:"nkn-filters",children:G.filter(e=>{let[t,,s]=e;return!t||s}).map(e=>{let[t,s,n]=e;return(0,y.jsxs)("button",{type:"button",className:"nkn-chip","aria-pressed":o===t,onClick:()=>p(t),"data-testid":"nl-chip-".concat(t||"all"),children:[s,null!=n&&(0,y.jsx)("span",{className:"c",children:k(n)})]},t||"all")})}),(0,y.jsxs)("div",{className:"row",children:[(0,y.jsxs)("button",{type:"button",className:"b b-soft",onClick:()=>F(!0),"data-testid":"nl-import",children:[(0,y.jsx)(h.In,{n:"upload",s:16}),r("newsletter.import_btn")]}),(0,y.jsxs)("button",{type:"button",className:"b b-ink",onClick:()=>U(!0),"data-testid":"nl-add",children:[(0,y.jsx)(h.In,{n:"plus",s:16}),r("newsletter.contact_btn")]})]})]}),(0,y.jsxs)("div",{className:"card",style:{padding:0,overflow:"hidden"},children:[(0,y.jsxs)("div",{className:"row",style:{padding:12,borderBottom:"1px solid var(--line)"},children:[(0,y.jsxs)("div",{style:{position:"relative",flex:"1 1 240px"},children:[(0,y.jsx)(h.In,{n:"search",s:16,style:{position:"absolute",left:12,top:13,color:"var(--muted)"}}),(0,y.jsx)("input",{type:"search",placeholder:r("newsletter.search_ph"),value:c,onChange:e=>d(e.target.value),style:{paddingLeft:36},"aria-label":r("newsletter.search_aria"),"data-testid":"nl-search"})]}),(0,y.jsxs)("div",{className:"row",children:[(0,y.jsxs)("button",{type:"button",className:"b b-ghost b-sm",onClick:()=>t.download(s,"contacts.csv","newsletter-kontakte.csv").catch(e=>a(e.message,"bad")),children:[(0,y.jsx)(h.In,{n:"download",s:15}),"CSV"]}),(0,y.jsxs)("button",{type:"button",className:"b b-ghost b-sm",onClick:()=>t.download(s,"consent-log.csv","newsletter-einwilligungen.csv").catch(e=>a(e.message,"bad")),children:[(0,y.jsx)(h.In,{n:"shield",s:15}),r("newsletter.proofs_btn")]})]})]}),x&&(0,y.jsxs)("div",{className:"banner bad",style:{margin:12},children:[(0,y.jsx)(h.In,{n:"alert"}),x,(0,y.jsx)("button",{type:"button",className:"b b-sm",onClick:()=>P(),children:r("common.retry")})]}),!m&&!x&&(0,y.jsx)("div",{style:{padding:16},className:"stack",children:[0,1,2,3,4].map(e=>(0,y.jsx)(h.Sk,{h:34},e))}),m&&!J.length&&(c||o?(0,y.jsx)(h.Sv,{art:"users",title:r("newsletter.none_title"),text:r("newsletter.none_text"),testid:"nl-contacts-none"}):(0,y.jsx)(h.Sv,{art:"users",title:r("newsletter.empty_title"),text:r("newsletter.empty_text"),testid:"nl-contacts-empty",children:(0,y.jsx)("button",{type:"button",className:"b b-soft",onClick:()=>F(!0),children:r("newsletter.import_btn")})})),J.length>0&&(0,y.jsxs)("div",{className:"list",role:"list",children:[(0,y.jsxs)("div",{className:"li nkn-row small muted hide-sm",style:{paddingTop:8,paddingBottom:8},children:[(0,y.jsx)("input",{type:"checkbox","aria-label":r("newsletter.select_all"),checked:Y,onChange:()=>v(Y?[]:J.map(e=>e.contact_id)),"data-testid":"nl-select-all"}),(0,y.jsx)("span",{}),(0,y.jsx)("span",{children:r("newsletter.col_contact")}),(0,y.jsx)("span",{children:r("newsletter.col_status")}),(0,y.jsx)("span",{className:"c-lists",children:r("newsletter.col_lists")}),(0,y.jsx)("span",{className:"c-date",children:r("newsletter.col_since")})]}),J.map(e=>(0,y.jsxs)("div",{role:"listitem",className:"li nkn-row click".concat(g.includes(e.contact_id)?" sel":""),onClick:()=>T(e.contact_id),"data-testid":"nl-contact-row",children:[(0,y.jsx)("input",{type:"checkbox","aria-label":r("newsletter.select_row",{email:e.email}),checked:g.includes(e.contact_id),onClick:e=>e.stopPropagation(),onChange:()=>v(t=>t.includes(e.contact_id)?t.filter(t=>t!==e.contact_id):[...t,e.contact_id])}),(0,y.jsx)(h.eu,{seed:e.email,label:e.name||e.email}),(0,y.jsxs)("div",{style:{minWidth:0},children:[(0,y.jsx)("div",{className:"nkn-email",children:e.email}),(0,y.jsx)("div",{className:"nkn-sub",children:e.name||(C.includes(e.source)?I(r,e.source):"")})]}),(0,y.jsx)("span",{children:(0,y.jsx)("span",{className:"pill ".concat((N[e.status]||[])[1]||""),children:A(r,e.status)})}),(0,y.jsxs)("span",{className:"c-lists row",style:{gap:4,flexWrap:"nowrap",overflow:"hidden"},children:[(e.tags||[]).slice(0,3).map(e=>(0,y.jsx)("span",{className:"tag",children:e},e)),!(e.tags||[]).length&&(0,y.jsx)("span",{className:"nkn-sub",children:r("newsletter.lists_count",{count:(e.list_ids||[]).length})})]}),(0,y.jsx)("span",{className:"c-date small muted num",children:_(e.subscribed_at||e.created_at)})]},e.contact_id)),m.next&&(0,y.jsx)("div",{style:{padding:12,textAlign:"center"},children:(0,y.jsx)("button",{type:"button",className:"b b-soft",disabled:j,onClick:async()=>{f(!0),await P({cursor:m.next}),f(!1)},children:j?r("common.loading"):r("newsletter.load_more",{n:k(m.total-J.length)})})})]})]}),g.length>0&&(0,y.jsxs)("div",{className:"nkn-bulk",role:"toolbar","aria-label":r("newsletter.bulk_aria"),"data-testid":"nl-bulk",children:[(0,y.jsx)("b",{style:{padding:"0 6px"},children:r("newsletter.bulk_selected",{n:k(g.length)})}),(0,y.jsx)("span",{className:"grow"}),(0,y.jsx)(D,{onTag:e=>V("add_tag",e)}),W.length>1&&(0,y.jsxs)("select",{"aria-label":r("newsletter.bulk_add_list_aria"),className:"b b-sm",style:{width:"auto",minHeight:32},value:"",onChange:e=>e.target.value&&V("add_list",e.target.value),children:[(0,y.jsx)("option",{value:"",children:r("newsletter.bulk_add_list")}),W.map(e=>(0,y.jsx)("option",{value:e.list_id,children:e.name},e.list_id))]}),(0,y.jsx)("button",{type:"button",className:"b b-sm",onClick:()=>V("unsubscribe"),children:r("newsletter.unsubscribe")}),(0,y.jsxs)("button",{type:"button",className:"b b-sm",onClick:()=>R(!0),"data-testid":"nl-bulk-delete",children:[(0,y.jsx)(h.In,{n:"trash",s:15}),r("common.delete")]}),(0,y.jsx)("button",{type:"button",className:"b b-sm b-icon","aria-label":r("newsletter.clear_selection"),onClick:()=>v([]),children:(0,y.jsx)(h.In,{n:"x",s:15})})]}),(0,y.jsx)(h.cj,{open:M,onClose:()=>R(!1),title:r("newsletter.del_title",{count:g.length}),testid:"nl-del-confirm",footer:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("button",{type:"button",className:"b b-soft",onClick:()=>R(!1),children:r("common.cancel")}),(0,y.jsx)("button",{type:"button",className:"b b-ink",style:{background:"var(--bad)",borderColor:"var(--bad)"},onClick:()=>{R(!1),V("delete")},children:r("newsletter.del_confirm")})]}),children:(0,y.jsx)("p",{className:"muted",children:r("newsletter.del_text")})}),(0,y.jsx)(z,{api:t,wid:s,cid:S,lists:W,close:()=>T(null),toast:a,changed:H}),(0,y.jsx)(E,{api:t,wid:s,open:B,close:()=>U(!1),lists:W,toast:a,changed:H}),(0,y.jsx)(L,{api:t,wid:s,open:q,close:()=>F(!1),lists:W,toast:a,changed:H})]})}function D(e){let{onTag:t}=e;
1const s=(0,w.Uy)(),[a,l]=(0,n.useState)("");return(0,y.jsxs)("form",{className:"row",style:{gap:4},onSubmit:e=>{e.preventDefault(),a.trim()&&(t(a.trim()),l(""))},children:[(0,y.jsx)("input",{type:"text",value:a,onChange:e=>l(e.target.value),placeholder:s("newsletter.tag_ph"),"aria-label":s("newsletter.tag_add_aria"),style:{minHeight:32,width:110,padding:"4px 10px",fontSize:13}}),(0,y.jsxs)("button",{type:"submit",className:"b b-sm",children:[(0,y.jsx)(h.In,{n:"tag",s:14}),s("newsletter.tag_btn")]})]})}function z(e){let{api:t,wid:s,cid:a,lists:l,close:i,toast:r,changed:c}=e;const d=(0,w.Uy)(),[o,p]=(0,n.useState)(null),[m,u]=(0,n.useState)(""),[x,b]=(0,n.useState)(!1),[g,v]=(0,n.useState)(null);(0,n.useEffect)(()=>{a?t.contact(s,a).then(e=>{p(e),u((e.contact.tags||[]).join(", "))}).catch(e=>{r(e.message,"bad"),i()}):p(null)},[t,s,a]);const j=null===o||void 0===o?void 0:o.contact,k=async(e,n)=>{try{await e(),r(n),c();const l=await t.contact(s,a);p(l)}catch(l){r(l.message,"bad")}};return(0,y.jsx)(h.cj,{open:!!a,onClose:i,title:j?j.email:d("newsletter.sheet_title"),wide:!0,testid:"nl-contact-sheet",children:j?(0,y.jsxs)("div",{className:"stack",style:{gap:18},children:[(0,y.jsxs)("div",{className:"row",children:[(0,y.jsx)("span",{className:"pill ".concat((N[j.status]||[])[1]||""),children:A(d,j.status)}),(0,y.jsxs)("span",{className:"small muted",children:[j.name?"".concat(j.name," \xb7 "):"",d("newsletter.meta_via",{source:I(d,j.source),date:_(j.created_at)})]}),j.tracking&&(0,y.jsx)("span",{className:"pill info plain",children:d("newsletter.tracking_pill")})]}),(0,y.jsxs)("div",{className:"grid2",children:[(0,y.jsxs)("label",{className:"f",children:[d("newsletter.tags_label"),(0,y.jsxs)("span",{className:"row",style:{flexWrap:"nowrap"},children:[(0,y.jsx)("input",{type:"text",value:m,onChange:e=>u(e.target.value),placeholder:d("newsletter.tags_ph")}),(0,y.jsx)("button",{type:"button",className:"b b-sm",onClick:()=>k(()=>t.patchContact(s,a,{tags:m.split(",").map(e=>e.trim()).filter(Boolean)}),d("newsletter.toast_tags_saved")),children:d("common.save")})]})]}),(0,y.jsxs)("div",{className:"f",style:{display:"flex",flexDirection:"column",gap:6,fontSize:13,fontWeight:600},children:[d("newsletter.lists_label"),(0,y.jsx)("div",{className:"row",style:{gap:6},children:l.map(e=>{const n=(j.list_ids||[]).includes(e.list_id);return(0,y.jsx)("button",{type:"button",className:"nkn-chip","aria-pressed":n,onClick:()=>k(()=>t.patchContact(s,a,{list_ids:n?j.list_ids.filter(t=>t!==e.list_id):[...j.list_ids||[],e.list_id]}),d("newsletter.toast_lists_saved")),children:e.name},e.list_id)})})]})]}),(0,y.jsxs)("div",{children:[(0,y.jsxs)("h3",{style:{marginBottom:10},children:[(0,y.jsx)(h.In,{n:"shield",s:16,style:{verticalAlign:"-3px",marginRight:6}}),d("newsletter.proof_title")]}),(0,y.jsx)("div",{className:"nkn-tl","data-testid":"nl-proof",children:o.log.map(e=>{var t;return(0,y.jsxs)("div",{className:"ev".concat(["bounce","complaint","unsubscribe","erase"].includes(e.event)?" bad":""),children:[(0,y.jsxs)("div",{className:"small",children:[(0,y.jsx)("b",{children:S.includes(e.event)?d("newsletter.ev_".concat(e.event)):e.event})," ",(0,y.jsxs)("span",{className:"muted",children:["\xb7 ",d("newsletter.ev_when",{date:_(e.at,!0),utc:null===(t=e.at)||void 0===t?void 0:t.slice(11,16)})]})]}),(0,y.jsx)("div",{className:"tiny muted",children:[e.source&&d("newsletter.ev_source",{source:I(d,e.source)}),e.ip_hash&&d("newsletter.ev_ip",{hash:e.ip_hash.slice(0,12)}),e.text_version&&d("newsletter.ev_text_version",{v:e.text_version})].filter(Boolean).join(" \xb7 ")}),e.text_version&&o.texts[String(e.text_version)]&&(g===e.log_id?(0,y.jsxs)("div",{className:"nkn-proof",children:["\u201e",o.texts[String(e.text_version)].text,"\u201c"]}):(0,y.jsx)("button",{type:"button",className:"b b-ghost b-sm",style:{marginLeft:-8},onClick:()=>v(e.log_id),children:d("newsletter.show_wording")}))]},e.log_id)})})]}),o.campaigns.length>0&&(0,y.jsxs)("div",{children:[(0,y.jsx)("h3",{style:{marginBottom:8},children:d("newsletter.received_title")}),o.campaigns.map(e=>(0,y.jsxs)("div",{className:"row between small",style:{padding:"6px 0",borderTop:"1px solid var(--line)"},children:[(0,y.jsx)("span",{children:e.name||e.campaign_id}),(0,y.jsx)("span",{className:"muted",children:_(e.sent_at)})]},e.campaign_id))]}),(0,y.jsxs)("div",{className:"row",style:{borderTop:"1px solid var(--line)",paddingTop:14},children:["pending"===j.status&&(0,y.jsxs)("button",{type:"button",className:"b b-soft",onClick:()=>k(()=>t.resendDoi(s,a),d("newsletter.toast_doi_sent")),children:[(0,y.jsx)(h.In,{n:"mail",s:16}),d("newsletter.resend_doi")]}),"subscribed"===j.status&&(0,y.jsx)("button",{type:"button",className:"b b-soft",onClick:()=>k(()=>t.unsubscribeContact(s,a),d("newsletter.toast_unsubscribed")),"data-testid":"nl-unsub",children:d("newsletter.unsubscribe")}),(0,y.jsxs)("button",{type:"button",className:"b b-ghost",onClick:()=>t.download(s,"contacts/".concat(a,"/export.json"),"kontakt-".concat(a,".json")).catch(e=>r(e.message,"bad")),children:[(0,y.jsx)(h.In,{n:"download",s:16}),d("newsletter.export_gdpr")]}),(0,y.jsx)("span",{className:"grow"}),x?(0,y.jsx)("button",{type:"button",className:"b b-ink",style:{background:"var(--bad)",borderColor:"var(--bad)"},"data-testid":"nl-erase",onClick:async()=>{try{await t.deleteContact(s,a),r(d("newsletter.toast_contact_deleted")),c(),i()}catch(e){r(e.message,"bad")}},children:d("newsletter.erase_confirm")}):(0,y.jsxs)("button",{type:"button",className:"b b-ghost b-danger",onClick:()=>b(!0),children:[(0,y.jsx)(h.In,{n:"trash",s:16}),d("common.delete")]})]})]}):(0,y.jsxs)("div",{className:"stack",children:[(0,y.jsx)(h.Sk,{h:20}),(0,y.jsx)(h.Sk,{h:80}),(0,y.jsx)(h.Sk,{h:120})]})})}function E(e){let{api:t,wid:s,open:a,close:l,lists:i,toast:r,changed:c}=e;
1const d=(0,w.Uy)(),[o,p]=(0,n.useState)(""),[m,u]=(0,n.useState)(""),[x,b]=(0,n.useState)(""),[g,v]=(0,n.useState)(!1);(0,n.useEffect)(()=>{a&&(p(""),u(""),b(""))},[a]);return(0,y.jsx)(h.cj,{open:a,onClose:l,title:d("newsletter.add_title"),testid:"nl-add-sheet",children:(0,y.jsxs)("form",{onSubmit:async e=>{e.preventDefault(),v(!0),b("");try{await t.addContact(s,{email:o,name:m}),r(d("newsletter.toast_confirm_sent")),c(),l()}catch(n){b(n.message)}v(!1)},className:"stack",children:[(0,y.jsx)("p",{className:"small muted",children:d("newsletter.add_intro")}),(0,y.jsxs)("label",{className:"f",children:[d("newsletter.email_label"),(0,y.jsx)("input",{type:"email",required:!0,value:o,onChange:e=>p(e.target.value),placeholder:d("newsletter.email_ph"),"data-autofocus":!0})]}),(0,y.jsxs)("label",{className:"f",children:[d("newsletter.name_label")," ",(0,y.jsx)("span",{className:"hint",children:d("newsletter.optional")}),(0,y.jsx)("input",{type:"text",value:m,onChange:e=>u(e.target.value)})]}),x&&(0,y.jsx)("div",{className:"err",role:"alert",children:x}),(0,y.jsxs)("div",{className:"foot",style:{marginTop:6},children:[(0,y.jsx)("button",{type:"button",className:"b b-soft",onClick:l,children:d("common.cancel")}),(0,y.jsx)("button",{type:"submit",className:"b b-ink",disabled:g||!o,children:d(g?"newsletter.sending":"newsletter.send_confirm")})]})]})})}function L(e){let{api:t,wid:s,open:a,close:i,lists:r,toast:c,changed:d}=e;
1const o=(0,w.Uy)(),[p,m]=(0,n.useState)(0),[u,x]=(0,n.useState)(""),[b,g]=(0,n.useState)(""),[v,j]=(0,n.useState)(null),[_,f]=(0,n.useState)({}),[N,C]=(0,n.useState)("doi"),[S,I]=(0,n.useState)(!1),[A,T]=(0,n.useState)(""),[D,z]=(0,n.useState)(""),[E,L]=(0,n.useState)(!1),[B,U]=(0,n.useState)(""),[q,F]=(0,n.useState)(null),[M,R]=(0,n.useState)(!1),W=(0,n.useRef)(null);(0,n.useEffect)(()=>{a&&(m(0),x(""),g(""),j(null),C("doi"),I(!1),U(""),F(null),z(""),T(""))},[a]);const O=e=>{if(!e)return;if(e.size>5242880)return void U(o("newsletter.import_too_big"));const t=new FileReader;t.onload=()=>{x(String(t.result||"")),g(e.name),K(String(t.result||""),null)},t.readAsText(e,"utf-8")},K=async(e,n)=>{L(!0),U("");try{const a=await t.importPreview(s,e,n);j(a),f(a.mapping),m(1)}catch(a){U(a.message)}L(!1)},P=(null===v||void 0===v?void 0:v.header)||[];return(0,y.jsxs)(h.cj,{open:a,onClose:i,title:o("newsletter.import_title"),wide:!0,testid:"nl-import-sheet",children:[(0,y.jsx)("div",{className:"nkn-steps","aria-hidden":"true",children:[0,1,2,3].map(e=>(0,y.jsx)("i",{className:e<=p?"on":""},e))}),0===p&&(0,y.jsxs)("div",{className:"stack",children:[(0,y.jsxs)("div",{className:"nkn-drop".concat(M?" over":""),role:"button",tabIndex:0,onClick:()=>W.current&&W.current.click(),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),W.current&&W.current.click())},onDragOver:e=>{e.preventDefault(),R(!0)},onDragLeave:()=>R(!1),onDrop:e=>{e.preventDefault(),R(!1),O(e.dataTransfer.files&&e.dataTransfer.files[0])},children:[(0,y.jsx)(h.In,{n:"upload",s:26,style:{color:"var(--gold)"}}),(0,y.jsx)("b",{children:o("newsletter.drop_title")}),(0,y.jsx)("span",{className:"small muted",children:o("newsletter.drop_hint")}),(0,y.jsx)("input",{ref:W,type:"file",accept:".csv,text/csv,text/plain",hidden:!0,onChange:e=>O(e.target.files&&e.target.files[0]),"data-testid":"nl-import-file"})]}),(0,y.jsxs)("details",{children:[(0,y.jsx)("summary",{className:"small",style:{cursor:"pointer",fontWeight:600},children:o("newsletter.paste_summary")}),(0,y.jsx)("textarea",{value:u,onChange:e=>x(e.target.value),placeholder:o("newsletter.paste_ph"),style:{marginTop:8,fontFamily:"ui-monospace,monospace",fontSize:13},"data-testid":"nl-import-paste"}),(0,y.jsx)("button",{type:"button",className:"b b-soft",style:{marginTop:8},disabled:!u.trim()||E,onClick:()=>K(u,null),"data-testid":"nl-import-analyse",children:o("newsletter.check_btn")})]})]}),p>=1&&p<3&&v&&(0,y.jsxs)("div",{className:"stack",children:[(0,y.jsx)("div",{className:"grid3",children:[["email",o("newsletter.map_email")],["name",o("newsletter.map_name")],["tags",o("newsletter.map_tags")]].map(e=>{var t;let[s,n]=e;return(0,y.jsxs)("label",{className:"f",children:[n,(0,y.jsxs)("select",{value:null!==(t=_[s])&&void 0!==t?t:"",onChange:e=>((e,t)=>{const s=(0,l.A)((0,l.A)({},_),{},{[e]:""===t?null:Number(t)});f(s),K(u,s)})(s,e.target.value),"data-testid":"nl-map-".concat(s),children:["email"!==s&&(0,y.jsx)("option",{value:"",children:o("newsletter.map_none")}),P.map((e,t)=>(0,y.jsx)("option",{value:t,children:e},e+t))]})]},s)})}),(0,y.jsx)("div",{className:"nkn-scroll",children:(0,y.jsxs)("table",{className:"nkn-sample",children:[(0,y.jsx)("thead",{children:(0,y.jsx)("tr",{children:P.map((e,t)=>(0,y.jsx)("th",{children:e},t))})}),(0,y.jsx)("tbody",{children:v.sample.map((e,t)=>(0,y.jsx)("tr",{children:P.map((t,s)=>(0,y.jsx)("td",{children:e[s]},s))},t))})]})}),(0,y.jsxs)("div",{className:"nkn-report","data-testid":"nl-import-report",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("b",{className:"num",children:k(v.importable)}),(0,y.jsx)("span",{children:o("newsletter.rep_importable",{n:k(v.new)})})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("b",{className:"num",children:k(v.invalid)}),(0,y.jsx)("span",{children:o("newsletter.rep_invalid")})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("b",{className:"num",children:k(v.duplicate)}),(0,y.jsx)("span",{children:o("newsletter.rep_duplicate")})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("b",{className:"num",children:k(v.suppressed)}),(0,y.jsx)("span",{children:o("newsletter.rep_suppressed")})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("b",{className:"num",children:k(v.role)}),(0,y.jsx)("span",{children:o("newsletter.rep_role")})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("b",{className:"num",children:k(v.rows)}),(0,y.jsx)("span",{children:o("newsletter.rep_rows")})]})]}),1===p&&(0,y.jsxs)("div",{className:"foot",children:[(0,y.jsx)("button",{type:"button",className:"b b-soft",onClick:()=>m(0),children:o("common.back")}),(0,y.jsx)("button",{type:"button",className:"b b-ink",disabled:!v.importable,onClick:()=>m(2),"data-testid":"nl-import-next",children:o("common.next")})]})]}),2===p&&v&&(0,y.jsxs)("div",{className:"stack",style:{marginTop:14},children:[(0,y.jsxs)("label",{className:"nkn-radio",children:[(0,y.jsx)("input",{type:"radio",name:"mode",checked:"doi"===N,onChange:()=>C("doi"),"data-testid":"nl-mode-doi"}),(0,y.jsxs)("span",{children:[(0,y.jsx)("b",{children:o("newsletter.mode_doi")})," ",(0,y.jsx)("span",{className:"pill ok plain",children:o("newsletter.recommended")}),(0,y.jsx)("br",{}),(0,y.jsx)("span",{className:"small muted",children:o("newsletter.mode_doi_text",{max:k(v.doi_max)})})]})]}),(0,y.jsxs)("label",{className:"nkn-radio",children:[(0,y.jsx)("input",{type:"radio",name:"mode",checked:"attested"===N,onChange:()=>C("attested"),"data-testid":"nl-mode-attested"}),(0,y.jsxs)("span",{children:[(0,y.jsx)("b",{children:o("newsletter.mode_att")}),(0,y.jsx)("br",{}),(0,y.jsx)("span",{className:"small muted",children:o("newsletter.mode_att_text")})]})]}),"attested"===N&&(0,y.jsxs)("label",{className:"row",style:{alignItems:"flex-start",ga
1p:10,fontSize:13.5,lineHeight:1.5},children:[(0,y.jsx)("input",{type:"checkbox",checked:S,onChange:e=>I(e.target.checked),style:{marginTop:2},"data-testid":"nl-attest"}),(0,y.jsx)("span",{children:v.attestation})]}),(0,y.jsxs)("div",{className:"grid2",children:[r.length>1&&(0,y.jsxs)("label",{className:"f",children:[o("newsletter.into_list"),(0,y.jsxs)("select",{value:A,onChange:e=>T(e.target.value),children:[(0,y.jsx)("option",{value:"",children:o("newsletter.default_list")}),r.map(e=>(0,y.jsx)("option",{value:e.list_id,children:e.name},e.list_id))]})]}),(0,y.jsxs)("label",{className:"f",children:[o("newsletter.tag_all")," ",(0,y.jsx)("span",{className:"hint",children:o("newsletter.optional")}),(0,y.jsx)("input",{type:"text",value:D,onChange:e=>z(e.target.value),placeholder:o("newsletter.tag_all_ph")})]})]}),(0,y.jsxs)("div",{className:"foot",children:[(0,y.jsx)("button",{type:"button",className:"b b-soft",onClick:()=>m(1),children:o("common.back")}),(0,y.jsx)("button",{type:"button",className:"b b-gold",disabled:E||"attested"===N&&!S,onClick:async()=>{L(!0),U("");try{const e=await t.importCommit(s,{csv:u,mapping:_,mode:N,attest:S,list_ids:A?[A]:[],tags:D?[D]:[],file_name:b});F(e),m(3),d()}catch(e){U(e.message)}L(!1)},"data-testid":"nl-import-go",children:E?o("newsletter.importing"):o("newsletter.commit",{count:v.importable})})]})]}),3===p&&q&&(0,y.jsxs)("div",{className:"stack","data-testid":"nl-import-done",style:{alignItems:"center",textAlign:"center",padding:"10px 0"},children:[(0,y.jsx)("span",{className:"nkn-dot done",style:{width:52,height:52},children:(0,y.jsx)(h.In,{n:"check",s:26,w:2.6})}),(0,y.jsx)("h3",{style:{fontSize:19},children:o("newsletter.done_title")}),(0,y.jsxs)("p",{className:"muted",children:["doi"===q.mode?o("newsletter.done_doi",{n:k(q.queued_doi)}):o("newsletter.done_att",{added:k(q.added),updated:k(q.updated)})," ","attested"===q.mode?o("newsletter.done_log_attested"):o("newsletter.done_log_time")]}),(0,y.jsx)("button",{type:"button",className:"b b-ink",onClick:i,children:o("common.done")})]}),B&&(0,y.jsxs)("div",{className:"banner bad",role:"alert",style:{marginTop:12},children:[(0,y.jsx)(h.In,{n:"alert"}),B]}),E&&p<2&&(0,y.jsx)("div",{className:"small muted",style:{marginTop:10},children:o("newsletter.checking")})]})}const B={draft:["newsletter.cstatus_draft",""],scheduled:["newsletter.cstatus_scheduled","info"],sending:["newsletter.cstatus_sending","gold"],paused:["newsletter.cstatus_paused","warn"],sent:["newsletter.cstatus_sent","ok"],canceled:["newsletter.cstatus_canceled","bad"],failed:["newsletter.cstatus_failed","bad"],partial:["newsletter.cstatus_partial","warn"],completed:["newsletter.cstatus_completed",""]};function U(e){let{s:t,stats:s}=e;const n=(0,w.Uy)(),a="sent"===t&&s?s.failed>0?s.sent>0?"partial":"failed":s.recipients>0&&!s.sent?"completed":t:t,[l,i]=B[a]||[null,""];return(0,y.jsx)("span",{className:"pill ".concat(i),"data-testid":"nl-status",children:l?n(l):t})}function q(e){let{api:t,wid:s,toast:a,open:l,newCampaign:i}=e;const r=(0,w.Uy)(),[c,d]=(0,n.useState)(null),[o,p]=(0,n.useState)(null),[m,u]=(0,n.useState)(null),x=(0,n.useCallback)(()=>{p(null),t.campaigns(s).then(e=>d(e.campaigns)).catch(e=>p(e.message))},[t,s]);(0,n.useEffect)(()=>{x()},[x]);return(0,y.jsxs)("div",{className:"stack","data-testid":"nl-campaigns",children:[(0,y.jsxs)("div",{className:"card",style:{padding:0,overflow:"hidden"},children:[o&&(0,y.jsxs)("div",{className:"banner bad",style:{margin:12},children:[(0,y.jsx)(h.In,{n:"alert"}),o,(0,y.jsx)("button",{type:"button",className:"b b-sm",onClick:x,children:r("common.retry")})]}),!c&&!o&&(0,y.jsx)("div",{style:{padding:16},className:"stack",children:[0,1,2].map(e=>(0,y.jsx)(h.Sk,{h:44},e))}),c&&!c.length&&(0,y.jsx)(h.Sv,{art:"mail",title:r("newsletter.camp_empty_title"),text:r("newsletter.camp_empty_text"),testid:"nl-campaigns-empty",children:(0,y.jsx)("button",{type:"button",className:"b b-gold",onClick:i,children:r("newsletter.write")})}),c&&c.length>0&&(0,y.jsxs)("div",{className:"list",children:[(0,y.jsxs)("div",{className:"li nkn-camp small muted hide-sm",style:{paddingTop:8,paddingBottom:8},children:[(0,y.jsx)("span",{children:r("newsletter.col_campaign")}),(0,y.jsx)("span",{children:r("newsletter.col_status")}),(0,y.jsx)("span",{className:"c-x",children:r("newsletter.col_recipients")}),(0,y.jsx)("span",{className:"c-x",children:r("newsletter.col_date")}),(0,y.jsx)("span",{})]}),c.map(e=>{var t;return(0,y.jsxs)("div",{className:"li nkn-camp click",onClick:()=>(e=>["draft","scheduled"].includes(e.status)?l(e.campaign_id):u(e.campaign_id))(e),"data-testid":"nl-campaign-row",children:[(0,y.jsxs)("div",{style:{minWidth:0},children:[(0,y.jsx)("div",{className:"nkn-email",children:e.name}),(0,y.jsx)("div",{className:"nkn-sub",children:e.subject||r("newsletter.no_subject")})]}),(0,y.jsx)("span",{children:(0,y.jsx)(U,{s:e.status,stats:e.stats})}),(0,y.jsx)("span",{className:"c-x small num",children:null!==(t=e.stats)&&void 0!==t&&t.recipients?k(e.stats.recipients):"\u2013"}),(0,y.jsx)("span",{className:"c-x small muted num",children:_(e.sent_at||e.scheduled_at||e.updated_at)}),(0,y.jsx)(h.In,{n:"chev",s:16,className:"c-x",style:{color:"var(--muted)"}})]},e.campaign_id)})]})]}),(0,y.jsx)(F,{api:t,wid:s,cid:m,close:()=>{u(null),x()},toast:a,copy:async(e,n)=>{try{const a=await t.createCampaign(s,{from:e,name:r("newsletter.copy_name",{name:n})});u(null),l(a.campaign_id)}catch(i){a(i.message,"bad")}}})]})}function F(e){let{api:t,wid:s,cid:a,close:l,toast:i,copy:r}=e;
1const c=(0,w.Uy)(),[d,o]=(0,n.useState)(null),p=(0,n.useCallback)(()=>a&&t.stats(s,a).then(o).catch(e=>i(e.message,"bad")),[t,s,a,i]);(0,n.useEffect)(()=>{o(null),p()},[p]),(0,n.useEffect)(()=>{if(!a||!d||!["sending"].includes(d.campaign.status))return;const e=setInterval(p,3e3);return()=>clearInterval(e)},[a,d,p]);const m=async e=>{try{await t.action(s,a,e),i(c("pause"===e?"newsletter.toast_paused":"resume"===e?"newsletter.toast_resumed":"newsletter.toast_canceled")),p()}catch(n){i(n.message,"bad")}},u=(null===d||void 0===d?void 0:d.stats)||{},x=(null===d||void 0===d?void 0:d.progress)||{},b=(x.queued||0)+(x.sending||0),g=Math.max(1,u.recipients||0);return(0,y.jsx)(h.cj,{open:!!a,onClose:l,title:d?d.campaign.name:c("newsletter.report_title"),wide:!0,testid:"nl-report",children:d?(0,y.jsxs)("div",{className:"stack",style:{gap:18},children:[(0,y.jsxs)("div",{className:"row",children:[(0,y.jsx)(U,{s:d.campaign.status,stats:u}),(0,y.jsxs)("span",{className:"small muted",children:["\u201e",d.campaign.subject,"\u201c \xb7 ",d.campaign.sent_at?c("newsletter.report_sent_at",{date:_(d.campaign.sent_at,!0)}):c("newsletter.report_started_at",{date:_(d.campaign.started_at,!0)})]})]}),u.failed>0&&(0,y.jsxs)("div",{className:"banner bad",role:"status","data-testid":"nl-report-failed",children:[(0,y.jsx)(h.In,{n:"alert"}),(0,y.jsx)("span",{children:c("newsletter.report_failed",{n:k(u.failed)})})]}),x.skipped>0&&(0,y.jsxs)("div",{className:"banner info","data-testid":"nl-report-skipped",children:[(0,y.jsx)(h.In,{n:"info"}),(0,y.jsx)("span",{children:c("newsletter.report_skipped",{n:k(x.skipped)})})]}),(0,y.jsxs)("div",{children:[(0,y.jsxs)("div",{className:"row between small",children:[(0,y.jsx)("span",{className:"num",children:c("newsletter.report_progress",{sent:k(u.sent),total:k(u.recipients)})}),(0,y.jsx)("span",{className:"muted",children:b?c("newsletter.report_queued",{n:k(b)}):c("newsletter.report_done")})]}),(0,y.jsxs)("div",{className:"nkn-bar",style:{marginTop:8},"aria-hidden":"true",children:[(0,y.jsx)("i",{style:{width:"".concat(100*(u.sent||0)/g,"%"),background:"linear-gradient(90deg,#E2B43A,#C99513)"}}),(0,y.jsx)("i",{style:{width:"".concat(100*((x.failed||0)+(x.skipped||0))/g,"%"),background:"rgba(127,127,127,.35)"}})]})]}),(0,y.jsxs)("div",{className:"grid4",children:[(0,y.jsxs)("div",{className:"card kpi",children:[(0,y.jsx)("span",{className:"l",children:c("newsletter.report_delivered")}),(0,y.jsx)("span",{className:"v",children:(0,y.jsx)(h.T9,{value:u.delivered||0})}),(0,y.jsx)("span",{className:"d muted",style:{fontWeight:500},children:u.delivered?f(d.rates.delivery):c("newsletter.report_delivered_hint")})]}),(0,y.jsxs)("div",{className:"card kpi",children:[(0,y.jsx)("span",{className:"l",children:c("newsletter.report_bounced")}),(0,y.jsx)("span",{className:"v",children:(0,y.jsx)(h.T9,{value:u.bounced||0})}),(0,y.jsx)("span",{className:"d muted",style:{fontWeight:500},children:f(d.rates.bounce)})]}),(0,y.jsxs)("div",{className:"card kpi",children:[(0,y.jsx)("span",{className:"l",children:c("newsletter.report_unsub")}),(0,y.jsx)("span",{className:"v",children:(0,y.jsx)(h.T9,{value:u.unsubscribed||0})}),(0,y.jsx)("span",{className:"d muted",style:{fontWeight:500},children:f(d.rates.unsubscribe)})]}),(0,y.jsxs)("div",{className:"card kpi",children:[(0,y.jsx)("span",{className:"l",children:c("newsletter.report_spam")}),(0,y.jsx)("span",{className:"v",children:(0,y.jsx)(h.T9,{value:u.complained||0})}),(0,y.jsx)("span",{className:"d ".concat(u.complained?"down":"muted"),style:{fontWeight:500},children:f(d.rates.complaint)})]})]}),u.tracked?(0,y.jsxs)("div",{className:"card","data-testid":"nl-report-tracking",children:[(0,y.jsxs)("div",{className:"row between",children:[(0,y.jsx)("h3",{children:c("newsletter.report_track_title")}),(0,y.jsx)("span",{className:"pill info plain",children:c("newsletter.report_tracked",{n:k(u.tracked)})})]}),(0,y.jsxs)("div",{className:"grid2",style:{marginTop:12},children:[(0,y.jsx)("div",{children:(0,y.jsxs)("div",{className:"kpi",children:[(0,y.jsx)("span",{className:"v",children:f(d.rates.open)}),(0,y.jsx)("span",{className:"l",children:c("newsletter.report_opened",{n:k(u.opened)})})]})}),(0,y.jsx)("div",{children:(0,y.jsxs)("div",{className:"kpi",children:[(0,y.jsx)("span",{className:"v",children:f(d.rates.click)}),(0,y.jsx)("span",{className:"l",children:c("newsletter.report_clicked",{n:k(u.clicked)})})]})})]}),(0,y.jsx)("p",{className:"tiny muted",style:{marginTop:10},children:c("newsletter.report_track_note")})]}):(0,y.jsxs)("div",{className:"banner info",children:[(0,y.jsx)(h.In,{n:"shield"}),(0,y.jsxs)("span",{className:"small",children:[c("newsletter.report_privacy_a")," ",(0,y.jsx)("b",{children:c("newsletter.report_privacy_and")}
1)," ",c("newsletter.report_privacy_b")]})]}),(0,y.jsxs)("div",{className:"row",style:{borderTop:"1px solid var(--line)",paddingTop:14},children:["sending"===d.campaign.status&&(0,y.jsxs)("button",{type:"button",className:"b b-soft",onClick:()=>m("pause"),"data-testid":"nl-pause",children:[(0,y.jsx)(h.In,{n:"pause",s:15}),c("newsletter.action_pause")]}),"paused"===d.campaign.status&&(0,y.jsxs)("button",{type:"button",className:"b b-soft",onClick:()=>m("resume"),children:[(0,y.jsx)(h.In,{n:"play",s:15}),c("newsletter.action_resume")]}),["sending","paused","scheduled"].includes(d.campaign.status)&&(0,y.jsx)("button",{type:"button",className:"b b-ghost b-danger",onClick:()=>m("cancel"),children:c("common.cancel")}),(0,y.jsx)("span",{className:"grow"}),(0,y.jsxs)("button",{type:"button",className:"b b-soft",onClick:()=>r(a,d.campaign.name),"data-testid":"nl-copy",children:[(0,y.jsx)(h.In,{n:"copy",s:15}),c("newsletter.action_copy")]})]})]}):(0,y.jsxs)("div",{className:"stack",children:[(0,y.jsx)(h.Sk,{h:20}),(0,y.jsx)(h.Sk,{h:90})]})})}const M=["heading","text","image","button","columns","quote","divider","spacer","social"],R=[["de","Deutsch"],["en","English"],["fr","Fran\xe7ais"],["es","Espa\xf1ol"],["it","Italiano"],["pt","Portugu\xeas"],["pl","Polski"],["nl","Nederlands"]],W=(e,t)=>e("newsletter.pal_".concat(t)),O=["instagram","facebook","linkedin","youtube","tiktok","website"];function K(e,t){if(!e)return;const s=()=>{try{e.style.height="".concat(Math.max(t,e.contentDocument.body.scrollHeight),"px")}catch(s){e.style.height="900px"}};s();try{e.__nkRo&&e.__nkRo.disconnect();const t=e.contentWindow.ResizeObserver||window.ResizeObserver;e.__nkRo=new t(s),e.__nkRo.observe(e.contentDocument.body)}catch(n){}}function P(e,t){return"heading"===t.type||"text"===t.type||"quote"===t.type?(t.text||"").replace(/\{\{\s*vorname[^}]*\}\}/gi,e("newsletter.label_first_name")).replace(/\{\{\s*website\s*\}\}/gi,e("newsletter.label_website")).replace(/\]\([^)]*\)/g,"").replace(/[*[\]]/g,"").slice(0,48)||W(e,t.type):"button"===t.type?t.label||W(e,"button"):"image"===t.type?t.alt||(t.src?W(e,"image"):e("newsletter.label_image_empty")):W(e,t.type)}function H(e){var t;let{api:s,wid:a,cid:i,toast:r,close:c}=e;const d=(0,w.Uy)(),[o,p]=(0,n.useState)(null),[u,x]=(0,n.useState)(null),[b,g]=(0,n.useState)(null),[v,j]=(0,n.useState)("desktop"),[k,f]=(0,n.useState)(!1),[N,C]=(0,n.useState)(null),[S,I]=(0,n.useState)(!1),[A,T]=(0,n.useState)("saved"),[D,z]=(0,n.useState)(null),[E,L]=(0,n.useState)({past:[],future:[]}),[B,U]=(0,n.useState)(null),[q,F]=(0,n.useState)({lists:[],segments:[],tags:[]}),R=(0,n.useRef)(null),O=(0,n.useRef)(null),H=(0,n.useRef)(null),V=(0,n.useRef)(null);V.current=u,(0,n.useEffect)(()=>{let e=!0;return s.campaign(a,i).then(t=>{if(e){if(!["draft","scheduled"].includes(t.status))return r(d("newsletter.ed_toast_already_sent"),"bad"),void c();p(t),x({name:t.name,lang:t.lang||"",subject:t.subject,preheader:t.preheader,blocks:t.blocks||[],audience:t.audience||{all:!0},tracking:!!t.tracking})}}).catch(e=>{r(e.message,"bad"),c()}),Promise.all([s.lists(a),s.segments(a)]).then(t=>{let[s,n]=t;return e&&F({lists:s.lists,segments:n.segments,tags:n.tags})}).catch(()=>{}),()=>{e=!1}},[s,a,i]);const Z=(0,n.useCallback)(async e=>{T("saving");try{return await s.saveCampaign(a,i,e),T("saved"),z(null),!0}catch(n){var t;return T("error"),"invalid_block"===n.code?z({index:null===(t=n.detail)||void 0===t?void 0:t.block,message:n.message}):r(n.message,"bad"),!1}},[s,a,i,r]),$=(0,n.useCallback)((e,t)=>{clearTimeout(H.current),H.current=setTimeout(async()=>{I(!0);try{C(await s.preview(a,i,{blocks:e.blocks,subject:e.subject,preheader:e.preheader,lang:e.lang||"",dark:t}))}catch(l){var n;"invalid_block"===l.code&&z({index:null===(n=l.detail)||void 0===n?void 0:n.block,message:l.message})}I(!1)},280)},[s,a,i]);(0,n.useEffect)(()=>{u&&$(u,k)},[u,k,$]);const Q=(0,n.useRef)({past:[],future:[]}),ee=(0,n.useCallback)(function(e){let{record:t=!0,replace:s=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=V.current,a=s?e:(0,l.A)((0,l.A)({},n),e);t&&(Q.current={past:[...Q.current.past.slice(-49),n],future:[]}
1),V.current=a,x(a),L(Q.current),clearTimeout(O.current),T("dirty"),O.current=setTimeout(()=>Z(a),700)},[Z]),te=(0,n.useCallback)(()=>{const e=Q.current;e.past.length&&(Q.current={past:e.past.slice(0,-1),future:[V.current,...e.future]},ee(e.past[e.past.length-1],{record:!1,replace:!0}))},[ee]),se=(0,n.useCallback)(()=>{const e=Q.current;e.future.length&&(Q.current={past:[...e.past,V.current],future:e.future.slice(1)},ee(e.future[0],{record:!1,replace:!0}))},[ee]);(0,n.useEffect)(()=>{const e=e=>{(e.metaKey||e.ctrlKey)&&"z"===e.key.toLowerCase()&&(e.target&&/INPUT|TEXTAREA/.test(e.target.tagName)||(e.preventDefault(),e.shiftKey?se():te()))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[te,se]),(0,n.useEffect)(()=>()=>{clearTimeout(O.current),clearTimeout(H.current)},[]);const ne=async()=>(clearTimeout(O.current),!V.current||Z(V.current)),ae=(null===u||void 0===u?void 0:u.blocks)||[],le=e=>{const t=function(e){const t={id:"b".concat(Math.random().toString(36).slice(2,9)),type:e};return"heading"===e&&Object.assign(t,{text:(0,w.st)("newsletter.def_heading"),level:2}),"text"===e&&(t.text=(0,w.st)("newsletter.def_text")),"image"===e&&Object.assign(t,{src:"",alt:"",href:"",width:100}),"button"===e&&Object.assign(t,{label:(0,w.st)("newsletter.def_button"),href:"",align:"center"}),"spacer"===e&&(t.size="M"),"columns"===e&&Object.assign(t,{left:{text:(0,w.st)("newsletter.col_left"),image:""},right:{text:(0,w.st)("newsletter.col_right"),image:""}}),"quote"===e&&Object.assign(t,{text:(0,w.st)("newsletter.def_quote"),by:""}),"social"===e&&(t.links=[{kind:"instagram",href:""}]),t}(e),s=b?ae.findIndex(e=>e.id===b):-1,n=[...ae];n.splice(s>=0?s+1:n.length,0,t),ee({blocks:n}),g(t.id),U(e=>"palette"===e?"insp":e)},ie=(e,t)=>{const s=ae.findIndex(t=>t.id===e),n=s+t;if(s<0||n<0||n>=ae.length)return;const a=[...ae];[a[s],a[n]]=[a[n],a[s]],ee({blocks:a})},re=e=>{ee({blocks:ae.filter(t=>t.id!==e)}),g(null)},ce=ae.find(e=>e.id===b);if(!u)return(0,y.jsxs)("div",{className:"nke",children:[(0,y.jsx)("div",{className:"nke-top",children:(0,y.jsx)(h.Sk,{h:28,w:220})}),(0,y.jsx)("div",{style:{padding:40},className:"stack",children:(0,y.jsx)(h.Sk,{h:400})})]});const de=(0,y.jsxs)("div",{className:"stack",style:{gap:18},children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("div",{className:"nke-lbl",children:d("newsletter.ed_blocks")}),(0,y.jsx)("div",{className:"nke-pal",children:M.map(e=>(0,y.jsxs)("button",{type:"button",onClick:()=>le(e),"data-testid":"nle-add-".concat(e),children:[(0,y.jsx)(h.In,{n:e,s:20}),W(d,e)]},e))})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("div",{className:"nke-lbl",children:d("newsletter.ed_structure")}),(0,y.jsxs)("div",{className:"nke-out",role:"listbox","aria-label":d("newsletter.ed_outline_aria"),children:[(0,y.jsxs)("div",{className:"nke-oi",role:"option","aria-selected":!b,"aria-current":!b,tabIndex:0,onClick:()=>{g(null),U(e=>"palette"===e?"insp":e)},onKeyDown:e=>"Enter"===e.key&&g(null),children:[(0,y.jsx)(h.In,{n:"mail",s:15}),(0,y.jsx)("span",{className:"t",children:d("newsletter.ed_subject_recipients")})]}),ae.map((e,t)=>(0,y.jsxs)("div",{className:"nke-oi",role:"option","aria-selected":b===e.id,"aria-current":b===e.id,tabIndex:0,"data-testid":"nle-outline-item",onClick:()=>{g(e.id),U(e=>"palette"===e?"insp":e)},onKeyDown:t=>"Enter"===t.key&&g(e.id),style:D&&D.index===t?{borderColor:"var(--bad)"}:void 0,children:[(0,y.jsx)(h.In,{n:e.type,s:15}),(0,y.jsx)("span",{className:"t",children:P(d,e)}),(0,y.jsxs)("span",{className:"ops",children:[(0,y.jsx)("button",{type:"button",className:"b b-ghost b-sm b-icon","aria-label":d("newsletter.ed_move_up"),onClick:t=>{t.stopPropagation(),ie(e.id,-1)},disabled:0===t,children:(0,y.jsx)(h.In,{n:"up",s:14})}),(0,y.jsx)("button",{type:"button",className:"b b-ghost b-sm b-icon","aria-label":d("newsletter.ed_move_down"),onClick:t=>{t.stopPropagation(),ie(e.id,1)},disabled:t===ae.length-1,children:(0,y.jsx)(h.In,{n:"down",s:14})}),(0,y.jsx)("button",{type:"button",className:"b b-ghost b-sm b-icon","aria-label":d("common.delete"),onClick:t=>{t.stopPropagation(),re(e.id)},children:(0,y.jsx)(h.In,{n:"trash",s:14})})]})]},e.id))]})]})]}),oe=ce?(0,y.jsx)(G,{b:ce,set:e=>{return t=ce.id,s=e,ee({blocks:ae.map(e=>e.id===t?(0,l.A)((0,l.A)({},e),s):e)});var t,s},err:D&&(null===(t=ae[D.index])||void 0===t?void 0:t.id)===ce.id?D.message:null,remove:()=>re(ce.id)}):(0,y.jsx)(J,{api:s,wid:a,cid:i,doc:u,change:ee,meta:q});return(0,y.jsxs)("div",{className:"nkg nke","data-testid":"nl-editor",style:{minHeight:0},children:[(0,y.jsxs)("div",{className:"nke-top",children:[(0,y.jsx)("button",{type:"button",className:"b b-ghost b-icon",onClick:async()=>{"saved"!==A&&await ne(),c()},"aria-label":d("common.back"),"data-testid":"nle-back",children:(0,y.jsx)(h.In,{n:"back"})}),(0,y.jsx)("input",{className:"nke-name",value:u.name,onChange:e=>ee({name:e.target.value},{record:!1}),"aria-label":d("newsletter.ed_name_aria")}),(0,y.jsx)("span",{className:"nke-saved","aria-live":"polite","data-testid":"nle-saved",children:"saving"===A?d("newsletter.saving"):"dirty"===A?d("newsletter.ed_unsaved"):"error"===A?(0,y.jsx)("span",{style:{color:"var(--bad)"},children:d("newsletter.ed_not_saved")}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(h.In,{n:"check",s:13}),d("common.saved_toast")]})}),(0,y.jsx)("span",{className:"grow"}),(0,y.jsxs)("span",{className:"row nke-hide-m",style:{gap:2},children:[(0,y.jsx)("button",{type:"button",className:"b b-ghost b-sm b-icon",onClick:te,disabled:!E.past.length,"aria-label":d("newsletter.ed_undo"),title:d("newsletter.ed_undo_title"),children:(0,y.jsx)(h.In,{n:"undo",s:16})}),(0,y.jsx)("button",{type:"button",className:"b b-ghost b-sm b-icon",onClick:se,disabled:!E.future.length,"aria-label":d("newsletter.ed_redo"),title:d("newsletter.ed_redo_title"),children:(0,y.jsx)(h.In,{n:"redo",s:16})})]}
1),(0,y.jsx)(h.UE,{value:v,onChange:j,label:d("newsletter.view"),testid:"nle-device",options:[{value:"desktop",icon:"desktop",title:d("newsletter.desktop")},{value:"phone",icon:"phone",title:d("newsletter.phone")}]}),(0,y.jsx)("button",{type:"button",className:"b b-soft b-icon","aria-pressed":k,onClick:()=>f(e=>!e),"aria-label":d(k?"newsletter.ed_light_view":"newsletter.ed_dark_view"),title:d("newsletter.ed_dark_title"),"data-testid":"nle-dark",children:(0,y.jsx)(h.In,{n:k?"sun":"moon",s:17})}),(0,y.jsxs)("button",{type:"button",className:"b b-soft nke-hide-m",onClick:()=>U("test"),"data-testid":"nle-test",children:[(0,y.jsx)(h.In,{n:"eye",s:16}),d("newsletter.ed_test_send")]}),(0,y.jsxs)("button",{type:"button",className:"b b-gold","aria-label":d("newsletter.ed_send_dots"),onClick:async()=>{await ne()&&U("send")},"data-testid":"nle-send",children:[(0,y.jsx)(h.In,{n:"send",s:16}),(0,y.jsx)("span",{className:"hide-sm",children:d("newsletter.ed_send_dots")})]})]}),(0,y.jsxs)("div",{className:"nke-body",children:[(0,y.jsx)("aside",{className:"nke-side",children:de}),(0,y.jsxs)("main",{className:"nke-canvas",children:["scheduled"===(null===o||void 0===o?void 0:o.status)&&(0,y.jsxs)("div",{className:"banner info",style:{maxWidth:660,width:"100%"},children:[(0,y.jsx)(h.In,{n:"calendar"}),(0,y.jsx)("span",{className:"grow small",children:d("newsletter.ed_scheduled",{date:_(o.scheduled_at,!0)})}),(0,y.jsx)("button",{type:"button",className:"b b-sm",onClick:async()=>{try{const e=await s.schedule(a,i,null);p(e),r(d("newsletter.ed_toast_unscheduled"))}catch(e){r(e.message,"bad")}},children:d("newsletter.ed_unschedule")})]}),(null===o||void 0===o?void 0:o.last_error)&&"draft"===o.status&&(0,y.jsxs)("div",{className:"banner warn",style:{maxWidth:660,width:"100%"},"data-testid":"nle-last-error",children:[(0,y.jsx)(h.In,{n:"alert"}),(0,y.jsxs)("span",{className:"grow small",children:[(0,y.jsx)("b",{children:d("newsletter.ed_last_error")})," ",o.last_error]})]}),(0,y.jsxs)("div",{className:"nke-inbox","aria-label":d("newsletter.ed_inbox_aria"),children:[(0,y.jsx)("span",{className:"avatar",style:{background:"#D4A017"},"aria-hidden":"true",children:((null===N||void 0===N?void 0:N.from)||"N").replace(/^"/,"").slice(0,1)}),(0,y.jsxs)("div",{style:{minWidth:0},children:[(0,y.jsx)("div",{className:"s",children:u.subject||(0,y.jsx)("span",{className:"muted",children:d("newsletter.ed_subject_missing")})}),(0,y.jsx)("div",{className:"p",children:u.preheader||d("newsletter.ed_no_preheader")})]})]}),(0,y.jsxs)("div",{className:"nke-dev".concat("phone"===v?" phone":""),style:{width:"phone"===v?375:660,maxWidth:"100%"},children:[S&&(0,y.jsx)("span",{className:"nke-busy",children:d("newsletter.ed_updating")}),N?(0,y.jsx)("iframe",{ref:R,title:d("newsletter.ed_preview_title"),srcDoc:N.html,sandbox:"allow-same-origin",onLoad:()=>K(R.current,420),"data-testid":"nle-preview",style:{height:700}}):(0,y.jsx)("div",{style:{padding:30},children:(0,y.jsx)(h.Sk,{h:500})})]}),N&&N.warnings.length>0&&(0,y.jsx)("div",{className:"nke-warn","data-testid":"nle-warnings",children:N.warnings.map(e=>(0,y.jsxs)("div",{className:"banner ".concat("error"===e.level?"bad":"warn"===e.level?"warn":"info"),children:[(0,y.jsx)(h.In,{n:"info"===e.level?"info":"alert",s:16}),(0,y.jsx)("span",{className:"small",children:m(e)})]},e.code))})]}),(0,y.jsx)("aside",{className:"nke-side nke-insp",children:oe})]}),(0,y.jsxs)("div",{className:"nke-mob",children:[(0,y.jsxs)("button",{type:"button",className:"b",onClick:()=>U("palette"),"data-testid":"nle-m-blocks",children:[(0,y.jsx)(h.In,{n:"plus",s:16}),d("newsletter.ed_blocks")]}),(0,y.jsxs)("button",{type:"button",className:"b",onClick:()=>U("insp"),"data-testid":"nle-m-insp",children:[(0,y.jsx)(h.In,{n:"settings",s:16}),ce?W(d,ce.type):d("newsletter.ed_mob_subject")]}),(0,y.jsxs)("button",{type:"button",className:"b",onClick:()=>U("test"),children:[(0,y.jsx)(h.In,{n:"eye",s:16}),d("newsletter.ed_mob_test")]})]}),(0,y.jsx)(h.cj,{open:"palette"===B,onClose:()=>U(null),title:d("newsletter.ed_blocks"),testid:"nle-sheet-blocks",children:de}),(0,y.jsx)(h.cj,{open:"insp"===B,onClose:()=>U(null),title:ce?W(d,ce.type):d("newsletter.ed_subject_recipients"),testid:"nle-sheet-insp",children:oe}),(0,y.jsx)(Y,{open:"test"===B,close:()=>U(null),api:s,wid:a,cid:i,doc:u,toast:r}),(0,y.jsx)(X,{open:"send"===B,close:()=>U(null),api:s,wid:a,cid:i,doc:u,pv:N,toast:r,done:c})]})}function V(e){let{taRef:t,value:s,set:n}=e;const a=(0,w.Uy)(),l=function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a("newsletter.pal_text");const r=t.current;if(!r)return;const c=r.selectionStart,d=r.selectionEnd,o=s.slice(c,d)||i,p=s.slice(0,c)+e+o+l+s.slice(d);n(p),requestAnimationFrame(()=>{r.focus(),r.setSelectionRange(c+e.length,c+e.length+o.length)})};return(0,y.jsxs)("div",{className:"nke-fmt",role:"toolbar","aria-label":a("newsletter.fmt_aria"),children:[(0,y.jsx)("button",{type:"button",className:"b b-soft b-sm",onClick:()=>l("**"),title:a("newsletter.fmt_bold"),children:(0,y.jsx)("b",{children:a("newsletter.fmt_bold_letter")})}),(0,y.jsx)("button",{type:"button",className:"b b-soft b-sm",onClick:()=>l("*"),title:a("newsletter.fmt_italic"),children:(0,y.jsx)("i",{children:a("newsletter.fmt_italic_letter")})}),(0,y.jsx)("button",{type:"button",className:"b b-soft b-sm",onClick:()=>l("[","](https://)",a("newsletter.fmt_link_text")),title:a("newsletter.fmt_link"),
1children:(0,y.jsx)(h.In,{n:"link",s:14})}),(0,y.jsx)("button",{type:"button",className:"b b-soft b-sm",onClick:()=>l("{{vorname|","}}",a("newsletter.fmt_hello")),title:a("newsletter.fmt_first_name_title"),children:a("newsletter.fmt_first_name")})]})}function Z(e){let{value:t,set:s,rows:a=5,label:l,testid:i}=e;const r=(0,n.useRef)(null);return(0,y.jsxs)("label",{className:"f",children:[l,(0,y.jsx)(V,{taRef:r,value:t||"",set:s}),(0,y.jsx)("textarea",{ref:r,rows:a,value:t||"",onChange:e=>s(e.target.value),"data-testid":i})]})}function G(e){let{b:t,set:s,err:n,remove:a}=e;const i=(0,w.Uy)();return(0,y.jsxs)("div",{className:"stack","data-testid":"nle-inspector",children:[(0,y.jsxs)("div",{className:"row between",children:[(0,y.jsx)("div",{className:"nke-lbl",style:{margin:0},children:W(i,t.type)}),(0,y.jsxs)("button",{type:"button",className:"b b-ghost b-sm b-danger",onClick:a,children:[(0,y.jsx)(h.In,{n:"trash",s:14}),i("common.remove")]})]}),n&&(0,y.jsxs)("div",{className:"banner bad",role:"alert",children:[(0,y.jsx)(h.In,{n:"alert",s:16}),(0,y.jsx)("span",{className:"small",children:n})]}),"heading"===t.type&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("label",{className:"f",children:[i("newsletter.pal_text"),(0,y.jsx)("input",{type:"text",value:t.text||"",onChange:e=>s({text:e.target.value}),"data-testid":"nle-f-text"})]}),(0,y.jsx)(h.UE,{value:t.level||1,onChange:e=>s({level:e}),label:i("newsletter.insp_size"),options:[{value:1,label:i("newsletter.insp_large")},{value:2,label:i("newsletter.insp_medium")}]})]}),"text"===t.type&&(0,y.jsx)(Z,{value:t.text,set:e=>s({text:e}),rows:9,label:i("newsletter.pal_text"),testid:"nle-f-text"}),"image"===t.type&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("label",{className:"f",children:[i("newsletter.insp_img_src"),(0,y.jsx)("input",{type:"url",value:t.src||"",onChange:e=>s({src:e.target.value}),placeholder:"https://\u2026","data-testid":"nle-f-src"}),(0,y.jsx)("span",{className:"hint",children:i("newsletter.insp_img_src_hint")})]}),(0,y.jsxs)("label",{className:"f",children:[i("newsletter.insp_alt"),(0,y.jsx)("input",{type:"text",value:t.alt||"",onChange:e=>s({alt:e.target.value}),placeholder:i("newsletter.insp_alt_ph")})]}),(0,y.jsxs)("label",{className:"f",children:[i("newsletter.fmt_link")," ",(0,y.jsx)("span",{className:"hint",children:i("newsletter.optional")}),(0,y.jsx)("input",{type:"url",value:t.href||"",onChange:e=>s({href:e.target.value}),placeholder:"https://\u2026"})]}),(0,y.jsx)(h.UE,{value:t.width||100,onChange:e=>s({width:e}),label:i("newsletter.insp_width"),options:[{value:100,label:i("newsletter.insp_full")},{value:75,label:"75 %"},{value:50,label:i("newsletter.insp_half")}]})]}),"button"===t.type&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("label",{className:"f",children:[i("newsletter.insp_btn_label"),(0,y.jsx)("input",{type:"text",value:t.label||"",onChange:e=>s({label:e.target.value}),maxLength:60,"data-testid":"nle-f-label"})]}),(0,y.jsxs)("label",{className:"f",children:[i("newsletter.fmt_link"),(0,y.jsx)("input",{type:"url",value:t.href||"",onChange:e=>s({href:e.target.value}),placeholder:"https://\u2026","data-testid":"nle-f-href"})]}),(0,y.jsx)(h.UE,{value:t.align||"center",onChange:e=>s({align:e}),label:i("newsletter.insp_align"),options:[{value:"left",label:i("newsletter.insp_left")},{value:"center",label:i("newsletter.insp_center")}]})]}),"spacer"===t.type&&(0,y.jsx)(h.UE,{value:t.size||"M",onChange:e=>s({size:e}),label:i("newsletter.pal_spacer"),options:[{value:"S",label:i("newsletter.insp_small")},{value:"M",label:i("newsletter.insp_medium")},{value:"L",label:i("newsletter.insp_large")}]}),"divider"===t.type&&(0,y.jsx)("p",{className:"small muted",children:i("newsletter.insp_divider")}),"columns"===t.type&&["left","right"].map(e=>{var n,a;return(0,y.jsxs)("div",{className:"stack",style:{gap:8,paddingTop:6},children:[(0,y.jsx)("div",{className:"nke-lbl",style:{margin:0},children:i("left"===e?"newsletter.col_left":"newsletter.col_right")}),(0,y.jsxs)("label",{className:"f",children:[i("newsletter.insp_col_image")," ",(0,y.jsx)("span",{className:"hint",children:i("newsletter.optional")}),(0,y.jsx)("input",{type:"url",value:(null===(n=t[e])||void 0===n?void 0:n.image)||"",onChange:n=>s({[e]:(0,l.A)((0,l.A)({},t[e]),{},{image:n.target.value})}),placeholder:"https://\u2026"})]}),(0,y.jsx)(Z,{value:null===(a=t[e])||void 0===a?void 0:a.text,set:n=>s({[e]:(0,l.A)((0,l.A)({},t[e]),{},{text:n})}),rows:4,label:i("newsletter.pal_text")})]},e)}),"quote"===t.type&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Z,{value:t.text,set:e=>s({text:e}),rows:3,label:i("newsletter.insp_quote")}),(0,y.jsxs)("label",{className:"f",children:[i("newsletter.insp_quote_by")," ",(0,y.jsx)("span",{className:"hint",children:i("newsletter.optional")}),(0,y.jsx)("input",{type:"text",value:t.by||"",onChange:e=>s({by:e.target.value}),placeholder:i("newsletter.insp_quote_by_ph")})]})]}),"social"===t.type&&(0,y.jsx)("div",{className:"stack",style:{gap:8},children:O.map(e=>{const n=((e,t)=>({instagram:"Instagram",facebook:"Facebook",linkedin:"LinkedIn",youtube:"YouTube",tiktok:"TikTok"}[t]||e("newsletter.label_website")))(i,e),a=(t.links||[]).find(t=>t.kind===e);return(0,y.jsxs)("label",{className:"f",children:[n,(0,y.jsx)("input",{type:"url",value:(null===a||void 0===a?void 0:a.href)||"",placeholder:"https://\u2026 (".concat(n,")"),onChange:n=>{const a=(t.links||[]).filter(t=>t.kind!==e);s({links:n.target.value?[...a,{kind:e,href:n.target.value}]:a})}})]},e)})})]})}function J(e){let{api:t,wid:s,cid:a,doc:i,change:r,meta:c}=e;
1const d=(0,w.Uy)(),[o,p]=(0,n.useState)(null),m=i.audience||{all:!0};(0,n.useEffect)(()=>{let e=!0;const n=setTimeout(()=>t.audience(s,a,m).then(t=>e&&p(t)).catch(()=>{}),250);return()=>{e=!1,clearTimeout(n)}},[t,s,a,JSON.stringify(m)]);const u=(e,t)=>{const s=m[e]||[];r({audience:(0,l.A)((0,l.A)({},m),{},{all:!1,[e]:s.includes(t)?s.filter(e=>e!==t):[...s,t]})})};return(0,y.jsxs)("div",{className:"stack","data-testid":"nle-campaign-insp",children:[(0,y.jsxs)("label",{className:"f",children:[d("newsletter.insp_language"),(0,y.jsxs)("select",{value:i.lang||"",onChange:e=>r({lang:e.target.value}),"data-testid":"nle-language",children:[(0,y.jsx)("option",{value:"",children:d("newsletter.insp_language_site")}),R.map(e=>{let[t,s]=e;return(0,y.jsx)("option",{value:t,children:s},t)})]}),(0,y.jsx)("span",{className:"hint",children:d("newsletter.insp_language_hint")})]}),(0,y.jsxs)("label",{className:"f",children:[d("newsletter.insp_subject"),(0,y.jsx)("input",{type:"text",value:i.subject,maxLength:150,onChange:e=>r({subject:e.target.value}),placeholder:d("newsletter.insp_subject_ph"),"data-testid":"nle-subject"}),(0,y.jsx)("span",{className:"hint",style:{color:(i.subject||"").length>60?"var(--warn)":void 0},children:d("newsletter.insp_subject_len",{n:(i.subject||"").length})})]}),(0,y.jsxs)("label",{className:"f",children:[d("newsletter.insp_preheader"),(0,y.jsx)("input",{type:"text",value:i.preheader,maxLength:150,onChange:e=>r({preheader:e.target.value}),placeholder:d("newsletter.insp_preheader_ph"),"data-testid":"nle-preheader"})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("div",{className:"nke-lbl",children:d("newsletter.col_recipients")}),(0,y.jsxs)("div",{className:"nke-count","data-testid":"nle-count",children:[(0,y.jsx)("b",{className:"num",children:o?k(o.recipients):"\u2026"}),d("newsletter.insp_subscribed_contacts")]}),(0,y.jsxs)("div",{className:"nke-aud",style:{marginTop:8},children:[(0,y.jsxs)("label",{children:[(0,y.jsx)("input",{type:"radio",name:"aud",checked:!!m.all,onChange:()=>r({audience:(0,l.A)((0,l.A)({},m),{},{all:!0})})}),d("newsletter.insp_aud_all")]}),c.lists.map(e=>(0,y.jsxs)("label",{children:[(0,y.jsx)("input",{type:"checkbox",checked:!m.all&&(m.list_ids||[]).includes(e.list_id),onChange:()=>u("list_ids",e.list_id)}),d("newsletter.insp_aud_list",{name:e.name})," ",(0,y.jsxs)("span",{className:"muted",children:["(",k(e.count),")"]})]},e.list_id)),c.segments.map(e=>(0,y.jsxs)("label",{children:[(0,y.jsx)("input",{type:"checkbox",checked:!m.all&&(m.segment_ids||[]).includes(e.segment_id),onChange:()=>u("segment_ids",e.segment_id)}),d("newsletter.insp_aud_segment",{name:e.name})," ",(0,y.jsxs)("span",{className:"muted",children:["(",k(e.count),")"]})]},e.segment_id)),c.tags.map(e=>(0,y.jsxs)("label",{children:[(0,y.jsx)("input",{type:"checkbox",checked:!m.all&&(m.tags||[]).includes(e),onChange:()=>u("tags",e)}),d("newsletter.insp_aud_tag",{name:e})]},e))]}),c.tags.length>0&&(0,y.jsxs)("label",{className:"f",style:{marginTop:8},children:[d("newsletter.insp_exclude"),(0,y.jsxs)("select",{value:"",onChange:e=>e.target.value&&r({audience:(0,l.A)((0,l.A)({},m),{},{exclude_tags:[...new Set([...m.exclude_tags||[],e.target.value])]})}),children:[(0,y.jsx)("option",{value:"",children:d("newsletter.insp_pick_tag")}),c.tags.map(e=>(0,y.jsx)("option",{value:e,children:e},e))]}),(m.exclude_tags||[]).length>0&&(0,y.jsx)("span",{className:"row",style:{gap:4},children:m.exclude_tags.map(e=>(0,y.jsxs)("button",{type:"button",className:"tag",style:{border:0,cursor:"pointer"},onClick:()=>r({audience:(0,l.A)((0,l.A)({},m),{},{exclude_tags:m.exclude_tags.filter(t=>t!==e)})}),children:[e," \u2715"]},e))})]})]}),(0,y.jsx)("div",{className:"card",style:{padding:14,boxShadow:"none"},children:(0,y.jsxs)("div",{className:"row between",style:{flexWrap:"nowrap"},children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("h3",{children:d("newsletter.insp_track_title")}),(0,y.jsx)("p",{className:"tiny muted",style:{marginTop:4},children:d("newsletter.insp_track_text",{counts:o?d("newsletter.insp_track_counts",{n:k(o.tracking_consent),total:k(o.recipients)}):""})})]}),(0,y.jsx)(h.dO,{checked:i.tracking,onChange:e=>r({tracking:e}),label:d("newsletter.insp_track_aria"),testid:"nle-tracking"})]})})]})}function Y(e){let{open:t,close:s,api:a,wid:l,cid:i,doc:r,toast:c}=e;
1const d=(0,w.Uy)(),[o,p]=(0,n.useState)(""),[m,u]=(0,n.useState)(""),[x,b]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(t){u("");try{p(localStorage.getItem("nk-nl-test")||"")}catch(e){}}},[t]);return(0,y.jsx)(h.cj,{open:t,onClose:s,title:d("newsletter.test_title"),testid:"nle-test-sheet",children:(0,y.jsxs)("form",{onSubmit:async e=>{e.preventDefault(),b(!0),u("");const t=o.split(/[,;\s]+/).filter(Boolean);try{await a.testSend(l,i,{to:t,blocks:r.blocks,subject:r.subject,preheader:r.preheader,lang:r.lang||""});try{localStorage.setItem("nk-nl-test",o)}catch(n){}c(d("newsletter.test_toast",{to:t.join(", ")})),s()}catch(n){u(n.message)}b(!1)},className:"stack",children:[(0,y.jsx)("p",{className:"small muted",children:d("newsletter.test_intro")}),(0,y.jsxs)("label",{className:"f",children:[d("newsletter.test_to"),(0,y.jsx)("input",{type:"text",value:o,onChange:e=>p(e.target.value),placeholder:d("newsletter.test_to_ph"),"data-autofocus":!0,"data-testid":"nle-test-to"})]}),m&&(0,y.jsx)("div",{className:"err",role:"alert",children:m}),(0,y.jsxs)("div",{className:"foot",style:{marginTop:4},children:[(0,y.jsx)("button",{type:"button",className:"b b-soft",onClick:s,children:d("common.cancel")}),(0,y.jsx)("button",{type:"submit",className:"b b-ink",disabled:x||!o.trim(),"data-testid":"nle-test-go",children:d(x?"newsletter.sending":"newsletter.ed_test_send")})]})]})})}function X(e){var t;let{open:s,close:a,api:l,wid:i,cid:r,doc:c,pv:d,toast:o,done:p}=e;const u=(0,w.Uy)(),[x,b]=(0,n.useState)(null),[g,v]=(0,n.useState)("now"),[j,f]=(0,n.useState)(function(){const e=new Date;e.setDate(e.getDate()+1),e.setHours(9,0,0,0);const t=e=>String(e).padStart(2,"0");return"".concat(e.getFullYear(),"-").concat(t(e.getMonth()+1),"-").concat(t(e.getDate()),"T").concat(t(e.getHours()),":").concat(t(e.getMinutes()))}()),[N,C]=(0,n.useState)(!1),[S,I]=(0,n.useState)("");(0,n.useEffect)(()=>{s&&(I(""),b(null),l.audience(i,r,c.audience).then(b).catch(e=>I(e.message)))},[s]);const A=((null===d||void 0===d?void 0:d.warnings)||[]).filter(e=>"error"===e.level),T=null===x||void 0===x?void 0:x.entitlement,D=!x||!x.recipients||A.length>0||T&&(!T.can_send||x.recipients>T.remaining),z=(0,n.useMemo)(()=>[[u("newsletter.insp_subject"),c.subject||"\u2013"],[u("newsletter.send_sum_from"),(null===d||void 0===d?void 0:d.from)||"\u2026"],[u("newsletter.send_sum_recipients"),x?u("newsletter.send_sum_recipients_val",{n:k(x.recipients)}):"\u2026"],[u("newsletter.send_sum_tracking"),c.tracking?u("newsletter.send_sum_tracking_val",{n:x?k(x.tracking_consent):"\u2026"}):u("newsletter.send_sum_off")]],[c,d,x,u]);return(0,y.jsx)(h.cj,{open:s,onClose:a,title:u("newsletter.send_title"),testid:"nle-send-sheet",footer:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("button",{type:"button",className:"b b-soft",onClick:a,children:u("common.cancel")}),(0,y.jsx)("button",{type:"button",className:"b b-gold",disabled:N||D,onClick:async()=>{C(!0),I("");try{"now"===g?(await l.send(i,r),o(u("newsletter.send_toast",{count:x.recipients}))):(await l.schedule(i,r,new Date(j).toISOString()),o(u("newsletter.send_toast_scheduled",{date:_(new Date(j).toISOString(),!0)}))),a(),p({sent:!0})}catch(e){I(e.message)}C(!1)},"data-testid":"nle-send-go",children:N?u("newsletter.send_wait"):"now"===g?u("newsletter.send_go_now",{n:x?k(x.recipients):"\u2026"}):u("newsletter.send_go_schedule")})]}),children:(0,y.jsxs)("div",{className:"stack",children:[(0,y.jsx)("div",{className:"card",style:{padding:0,boxShadow:"none"},children:z.map((e,t)=>{let[s,n]=e;return(0,y.jsxs)("div",{className:"row between small",style:{padding:"10px 14px",borderTop:0===t?0:"1px solid var(--line)",flexWrap:"nowrap",gap:16},children:[(0,y.jsx)("span",{className:"muted",children:s}),(0,y.jsx)("b",{style:{textAlign:"right",overflow:"hidden",textOverflow:"ellipsis"},children:n})]},s)})}),A.map(e=>(0,y.jsxs)("div",{className:"banner bad",children:[(0,y.jsx)(h.In,{n:"alert",s:16}),(0,y.jsx)("span",{className:"small",children:m(e)})]},e.code)),T&&!T.can_send&&(0,y.jsxs)("div",{className:"banner warn",children:[(0,y.jsx)(h.In,{n:"info",s:16}),(0,y.jsx)("span",{className:"small grow",children:u("newsletter.send_no_plan")}),(0,y.jsx)("a",{className:"b b-sm",href:(null===(t=T.upgrade)||void 0===t?void 0:t.href)||"/abrechnung",children:T.upgrade?u("newsletter.send_view_plan",{name:T.upgrade.name}):u("newsletter.send_plans")})]}),T&&T.can_send&&x&&x.recipients>T.remaining&&(0,y.jsxs)("div",{className:"banner warn","data-testid":"nle-quota",children:[(0,y.jsx)(h.In,{n:"info",s:16}),(0,y.jsxs)("span",{className:"small grow",children:[u("newsletter.send_quota",{n:k(x.recipients),remaining:k(T.remaining),quota:k(T.quota)}),T.upgrade?u("newsletter.send_quota_upgrade",{name:T.upgrade.name,mails:k(T.upgrade.mails)}):u("newsletter.send_quota_shrink")]}),T.upgrade&&(0,y.jsx)("a",{className:"b b-sm",href:T.upgrade.href,children:u("newsletter.send_upgrade")})]}),x&&!x.recipients&&(0,y.jsxs)("div",{className:"banner warn",children:[(0,y.jsx)(h.In,{n:"info",s:16}),(0,y.jsx)("span",{className:"small",children:u("newsletter.send_no_recipients")})]}),(0,y.jsx)(h.UE,{value:g,onChange:v,label:u("newsletter.send_when_aria"),testid:"nle-when",options:[{value:"now",label:u("newsletter.send_now")},{value:"later",label:u("newsletter.send_later")}]}),"later"===g&&(0,y.jsxs)("label",{className:"f",children:[u("newsletter.send_at"),(0,y.jsx)("input",{type:"datetime-local",value:j,onChange:e=>f(e.target.value),"data-testid":"nle-at"})]}),(0,y.jsx)("p",{className:"tiny muted",children:u("newsletter.send_footer")}),S&&(0,y.jsxs)("div",{className:"banner bad",role:"alert",children:[(0,y.jsx)(h.In,{n:"alert",s:16}),(0,y.jsx)("span",{className:"small",children:S})]})]})})}function $(e,t,s,n){var a;const l=s||null!==t&&void 0!==t&&t.dark_site?"#141416":"#ffffff",i=s||null!==t&&void 0!==t&&t.dark_site?"#f2f2f4":(null===t||void 0===t?void 0:t.text)||"#1d1d1f",r=/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})?$/.test(n||"")?n:"de";return'<!doctype html><html lang="'.concat(r,'"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><style>\n:root{--primary-color:').concat((null===t||void 0===t?void 0:t.accent)||"#1d1d1f",";--on-primary-color:").concat((null===t||void 0===t?void 0:t.on_accent)||"#fff",";--radius:").concat(null!==(a=null===t||void 0===t?void 0:t.radius)&&void 0!==a?a:12,"px}\nbody{margin:0;padding:36px 28px;background:").concat(l,";color:").concat(i,";font-family:").concat((null===t||void 0===t?void 0:t.body_font)||"system-ui,sans-serif",";font-size:16px}\nh3{font-family:").concat((null===t||void 0===t?void 0:t.heading_font)||"inherit","}</style></head><body>").concat(String(e||"").replace(/<script[\s\S]*?<\/script>/gi,""),"</body></html>")}function Q(e){let{api:t,wid:s,toast:a,onChange:i}=e;
1const r=(0,w.Uy)(),[c,d]=(0,n.useState)(null),[o,p]=(0,n.useState)(null),[m,u]=(0,n.useState)([]),[x,b]=(0,n.useState)(null),[g,v]=(0,n.useState)(!1),[j,_]=(0,n.useState)(""),[k,f]=(0,n.useState)("desktop"),[N,C]=(0,h.kv)(),S=(0,n.useRef)(null),I=(0,n.useCallback)(()=>{b(null),Promise.all([t.blockEmbed(s),t.lists(s)]).then(e=>{let[t,s]=e;d(t),p(t.block),u(s.lists),v(!1)}).catch(e=>b(e.message))},[t,s]);(0,n.useEffect)(()=>{I()},[I]);const A=e=>{p(t=>(0,l.A)((0,l.A)({},t),e)),v(!0)};if(x)return(0,y.jsx)("div",{className:"card",children:(0,y.jsxs)("div",{className:"banner bad",children:[(0,y.jsx)(h.In,{n:"alert"}),x,(0,y.jsx)("button",{type:"button",className:"b b-sm",onClick:I,children:r("common.retry")})]})});if(!c||!o)return(0,y.jsxs)("div",{className:"grid2",children:[(0,y.jsx)("div",{className:"card",children:(0,y.jsx)(h.Sk,{h:300})}),(0,y.jsx)("div",{className:"card",children:(0,y.jsx)(h.Sk,{h:300})})]});const T=e=>String(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");let D=c.html;return g&&(D=D.replace(/<h3>.*?<\/h3>/,o.title?"<h3>".concat(T(o.title),"</h3>"):"").replace(/<p class="nk-nl2-t">.*?<\/p>/,o.text?'<p class="nk-nl2-t">'.concat(T(o.text),"</p>"):"").replace(/(<button type="submit" class="nk-nl2-b">).*?(<\/button>)/,(e,t,s)=>o.button?"".concat(t).concat(T(o.button)).concat(s):e)),(0,y.jsxs)("div",{className:"grid2 nkn-split2",style:{alignItems:"start"},"data-testid":"nl-block",children:[(0,y.jsxs)("div",{className:"card stack",children:[(0,y.jsx)("h2",{style:{margin:0},children:r("newsletter.tab_block")}),(0,y.jsx)("p",{className:"small muted",children:r("newsletter.block_intro")}),(0,y.jsxs)("label",{className:"f",children:[r("newsletter.block_f_title"),(0,y.jsx)("input",{type:"text",value:o.title,maxLength:80,onChange:e=>A({title:e.target.value}),"data-testid":"nl-block-title"})]}),(0,y.jsxs)("label",{className:"f",children:[r("newsletter.block_f_text"),(0,y.jsx)("textarea",{rows:3,value:o.text,maxLength:300,onChange:e=>A({text:e.target.value})})]}),(0,y.jsxs)("label",{className:"f",children:[r("newsletter.block_f_button"),(0,y.jsx)("input",{type:"text",value:o.button,maxLength:40,onChange:e=>A({button:e.target.value})})]}),(0,y.jsxs)("div",{className:"row between",children:[(0,y.jsxs)("span",{className:"small",children:[(0,y.jsx)("b",{children:r("newsletter.block_ask_name")}),(0,y.jsx)("br",{}),(0,y.jsx)("span",{className:"muted",children:r("newsletter.block_ask_name_hint")})]}),(0,y.jsx)(h.dO,{checked:o.ask_name,onChange:e=>A({ask_name:e}),label:r("newsletter.block_ask_name")})]}),(0,y.jsxs)("div",{className:"row between",style:{flexWrap:"nowrap",gap:14},children:[(0,y.jsxs)("span",{className:"small",children:[(0,y.jsx)("b",{children:r("newsletter.block_tracking_cb")}),(0,y.jsx)("br",{}),(0,y.jsx)("span",{className:"muted",children:r("newsletter.block_tracking_cb_hint")})]}),(0,y.jsx)(h.dO,{checked:o.tracking_checkbox,onChange:e=>A({tracking_checkbox:e}),label:r("newsletter.block_tracking_cb_aria"),testid:"nl-block-tracking"})]}),m.length>1&&(0,y.jsxs)("label",{className:"f",children:[r("newsletter.block_lands_in"),(0,y.jsxs)("select",{value:(o.list_ids||[])[0]||"",onChange:e=>A({list_ids:e.target.value?[e.target.value]:[]}),children:[(0,y.jsx)("option",{value:"",children:r("newsletter.default_list")}),m.map(e=>(0,y.jsx)("option",{value:e.list_id,children:e.name},e.list_id))]})]}),(0,y.jsxs)("label",{className:"f",children:[r("newsletter.block_f_success"),(0,y.jsx)("textarea",{rows:2,value:o.success,maxLength:300,onChange:e=>A({success:e.target.value})})]}),(0,y.jsxs)("details",{className:"small",children:[(0,y.jsx)("summary",{style:{cursor:"pointer",fontWeight:600},children:r("newsletter.block_consent_summary")}),(0,y.jsxs)("p",{className:"muted",style:{marginTop:8},children:["\u201e",c.consent_text,"\u201c ",(0,y.jsx)("span",{className:"pill plain",style:{marginLeft:4},children:r("newsletter.block_version",{v:c.text_version})})]}),(0,y.jsx)("p",{className:"tiny muted",style:{marginTop:6},children:r("newsletter.block_consent_note")})]}),(0,y.jsxs)("div",{className:"row",children:[(0,y.jsx)("button",{type:"button",className:"b b-ink",disabled:!g||!!j,onClick:async()=>{_("save");try{await t.saveSettings(s,{block:o}),a(c.installed?r("newsletter.block_saved_installed"):r("common.saved_toast")),I(),i&&i()}catch(e){a(e.message,"bad")}_("")},"data-testid":"nl-block-save",children:r("save"===j?"newsletter.saving":"common.save")}),g&&(0,y.jsx)("span",{className:"small muted",children:r("newsletter.unsaved_changes")}
1)]})]}),(0,y.jsxs)("div",{className:"stack",children:[(0,y.jsxs)("div",{className:"card",style:{padding:14},children:[(0,y.jsxs)("div",{className:"row between",style:{marginBottom:10},children:[(0,y.jsx)("span",{className:"nke-lbl",style:{margin:0},children:r("newsletter.preview")}),(0,y.jsx)(h.UE,{value:k,onChange:f,label:r("newsletter.view"),options:[{value:"desktop",icon:"desktop",title:r("newsletter.desktop")},{value:"phone",icon:"phone",title:r("newsletter.phone")}]})]}),(0,y.jsx)("div",{style:{display:"flex",justifyContent:"center"},children:(0,y.jsx)("iframe",{ref:S,className:"nkn-frame",title:r("newsletter.block_frame_title"),sandbox:"allow-same-origin",srcDoc:$(D,c.theme,!1,c.lang),onLoad:()=>K(S.current,260),style:{width:"phone"===k?375:"100%",transition:"width var(--sp-soft-d) var(--sp-soft)"},"data-testid":"nl-block-preview"})})]}),(0,y.jsxs)("div",{className:"card stack","data-testid":"nl-block-install",children:[(0,y.jsxs)("div",{className:"row between",children:[(0,y.jsx)("h3",{children:r("newsletter.block_on_site")}),c.installed?(0,y.jsx)("span",{className:"pill ok",children:r("newsletter.block_pill_installed")}):(0,y.jsx)("span",{className:"pill",children:r("newsletter.block_pill_not_installed")})]}),(0,y.jsx)("p",{className:"small muted",children:c.installed?r("newsletter.block_installed_text"):r("newsletter.block_not_installed_text")}),(0,y.jsx)("div",{className:"row",children:(0,y.jsxs)("button",{type:"button",className:"b b-gold",onClick:async()=>{_("install");try{g&&await t.saveSettings(s,{block:o}),await t.installBlock(s),a(r("newsletter.block_installed_toast")),I(),i&&i()}catch(e){a(e.message,"bad")}_("")},disabled:!!j,"data-testid":"nl-block-install-btn",children:[(0,y.jsx)(h.In,{n:"layout",s:16}),"install"===j?r("newsletter.block_installing"):c.installed?r("newsletter.block_rebuild"):r("newsletter.block_install_btn")]})}),(0,y.jsxs)("div",{style:{borderTop:"1px solid var(--line)",paddingTop:14},className:"stack",children:[(0,y.jsx)("h3",{children:r("newsletter.block_hosted_title")}),(0,y.jsx)("p",{className:"small muted",children:r("newsletter.block_hosted_text")}),(0,y.jsxs)("div",{className:"nkn-copy",children:[(0,y.jsx)("code",{"data-testid":"nl-hosted-url",children:c.hosted_url}),(0,y.jsx)("button",{type:"button",className:"b b-sm",onClick:()=>C(c.hosted_url,"url"),children:"url"===N?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(h.In,{n:"check",s:14}),r("newsletter.copied")]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(h.In,{n:"copy",s:14}),r("common.copy")]})})]}),(0,y.jsxs)("div",{className:"row",children:[(0,y.jsxs)("a",{className:"b b-soft b-sm",href:c.hosted_url,target:"_blank",rel:"noreferrer",children:[(0,y.jsx)(h.In,{n:"eye",s:14}),r("newsletter.block_view_btn")]}),(0,y.jsxs)("button",{type:"button",className:"b b-soft b-sm",onClick:async()=>{_("link");try{const e=await t.addToLink(o.title||"Newsletter",c.hosted_url);a(e.already?r("newsletter.block_link_already"):r("newsletter.block_link_added"))}catch(e){a(e.message||r("newsletter.block_link_unreachable"),"bad")}_("")},disabled:!!j,"data-testid":"nl-to-link",children:[(0,y.jsx)(h.In,{n:"link",s:14}),r("newsletter.block_to_link")]}),(0,y.jsx)("button",{type:"button",className:"b b-ghost b-sm",onClick:()=>C(c.html,"code"),children:r("code"===N?"newsletter.block_code_copied":"newsletter.block_copy_html")})]})]})]})]})]})}const ee=["block","hosted","form","import","l17","manual"];function te(e){var t;let{api:s,wid:a,toast:i,onChange:r}=e;const c=(0,w.Uy)(),d=c("newsletter.s_privacy_text"),[o,p]=(0,n.useState)(null),[m,u]=(0,n.useState)(null),[x,b]=(0,n.useState)(null),[g,v]=(0,n.useState)(!1),[j,_]=(0,n.use
1State)(null),[f,N]=(0,n.useState)(!1),[C,S]=(0,n.useState)(""),[I,A]=(0,h.kv)(),T=(0,n.useCallback)(()=>{b(null),s.settings(a).then(e=>{p(e),u({sender_name:e.settings.sender_name,reply_to:e.settings.reply_to,address:e.settings.address,footer_note:e.settings.footer_note,sources:e.settings.sources||{forms:[],l17:!0}})}).catch(e=>b(e.message)),s.segments(a).then(_).catch(()=>_({segments:[],tags:[]}))},[s,a]);if((0,n.useEffect)(()=>{T()},[T]),x)return(0,y.jsx)("div",{className:"card",children:(0,y.jsxs)("div",{className:"banner bad",children:[(0,y.jsx)(h.In,{n:"alert"}),x,(0,y.jsx)("button",{type:"button",className:"b b-sm",onClick:T,children:c("common.retry")})]})});if(!o||!m)return(0,y.jsxs)("div",{className:"stack",children:[(0,y.jsx)("div",{className:"card",children:(0,y.jsx)(h.Sk,{h:180})}),(0,y.jsx)("div",{className:"card",children:(0,y.jsx)(h.Sk,{h:140})})]});const D=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c("common.saved_toast");v(!0);try{await s.saveSettings(a,e),i(t),T(),r&&r()}catch(n){i(n.message,"bad")}v(!1)},z=o.sources.forms||[],E=e=>(m.sources.forms||[]).find(t=>t.form_id===e),L=(e,t)=>{var s,n,a;const i=E(e.form_id),r=(m.sources.forms||[]).filter(t=>t.form_id!==e.form_id),c=null===t?r:[...r,(0,l.A)((0,l.A)({form_id:e.form_id,email_field:null===(s=e.email_fields[0])||void 0===s?void 0:s.name,consent_field:null===(n=e.checkboxes[0])||void 0===n?void 0:n.name,name_field:null===(a=e.name_fields[0])||void 0===a?void 0:a.name},i),t)];u((0,l.A)((0,l.A)({},m),{},{sources:(0,l.A)((0,l.A)({},m.sources),{},{forms:c})}))};return(0,y.jsxs)("div",{className:"stack",style:{gap:16},"data-testid":"nl-settings",children:[(0,y.jsxs)("div",{className:"grid2",style:{alignItems:"start"},children:[(0,y.jsxs)("div",{className:"card stack",children:[(0,y.jsx)("h2",{style:{margin:0},children:c("newsletter.s_sender_title")}),(0,y.jsxs)("label",{className:"f",children:[c("newsletter.s_sender_name"),(0,y.jsx)("input",{type:"text",value:m.sender_name,maxLength:60,placeholder:(null===(t=o.settings)||void 0===t?void 0:t.sender_name)||c("newsletter.s_sender_name_ph"),onChange:e=>u((0,l.A)((0,l.A)({},m),{},{sender_name:e.target.value}))})]}),(0,y.jsxs)("label",{className:"f",children:[c("newsletter.s_reply_to"),(0,y.jsx)("input",{type:"email",value:m.reply_to,placeholder:c("newsletter.s_reply_ph"),onChange:e=>u((0,l.A)((0,l.A)({},m),{},{reply_to:e.target.value}))})]}),(0,y.jsxs)("label",{className:"f",children:[c("newsletter.s_address")," ",(0,y.jsx)("span",{className:"hint",children:c("newsletter.s_address_hint")}),(0,y.jsx)("textarea",{rows:3,value:m.address,maxLength:300,placeholder:c("newsletter.s_address_ph"),onChange:e=>u((0,l.A)((0,l.A)({},m),{},{address:e.target.value})),"data-testid":"nl-address"})]}),(0,y.jsxs)("label",{className:"f",children:[c("newsletter.s_footer_note")," ",(0,y.jsx)("span",{className:"hint",children:c("newsletter.optional")}),(0,y.jsx)("input",{type:"text",value:m.footer_note,maxLength:300,onChange:e=>u((0,l.A)((0,l.A)({},m),{},{footer_note:e.target.value}))})]}),(0,y.jsx)("div",{className:"row",children:(0,y.jsx)("button",{type:"button",className:"b b-ink",disabled:g,onClick:()=>D({sender_name:m.sender_name,reply_to:m.reply_to,address:m.address,footer_note:m.footer_note}),"data-testid":"nl-settings-save",children:c("common.save")})})]}),(0,y.jsxs)("div",{className:"card stack",children:[(0,y.jsx)("h2",{style:{margin:0},children:c("newsletter.s_src_title")}),(0,y.jsx)("p",{className:"small muted",children:c("newsletter.s_src_intro")}),(0,y.jsxs)("div",{className:"row between",style:{flexWrap:"nowrap",gap:14},children:[(0,y.jsxs)("span",{className:"small",children:[(0,y.jsx)("b",{children:c("newsletter.s_l17")}),(0,y.jsx)("br",{}),(0,y.jsx)("span",{className:"muted",children:o.sources.l17.length?c("newsletter.s_l17_confirmed",{n:k(o.sources.l17.reduce((e,t)=>e+t.confirmed,0))}):c("newsletter.s_l17_none")})]}),(0,y.jsx)(h.dO,{checked:m.sources.l17,onChange:e=>u((0,l.A)((0,l.A)({},m),{},{sources:(0,l.A)((0,l.A)({},m.sources),{},{l17:e})})),label:c("newsletter.s_l17_aria")})]}),0===z.length&&(0,y.jsx)("p",{className:"small muted",children:c("newsletter.s_no_forms")}),z.map(e=>{const t=E(e.form_id);return(0,y.jsxs)("div",{style:{borderTop:"1px solid var(--line)",paddingTop:12},className:"stack",children:[(0,y.jsxs)("div",{className:"row between",style:{flexWrap:"nowrap"},children:[(0,y.jsxs)("span",{className:"small",children:[(0,y.jsx)("b",{children:e.name}),!e.usable&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("br",{}),(0,y.jsx)("span",{className:"muted",children:c("newsletter.s_form_needs")})]})]}),(0,y.jsx)(h.dO,{checked:!!t,disabled:!e.usable,onChange:t=>L(e,t?{}:null),label:c("newsletter.s_form_connect_aria",{name:e.name})})]}),t&&(0,y.jsxs)("div",{className:"grid2",children:[(0,y.jsxs)("label",{className:"f",children:[c("newsletter.s_email_field"),(0,y.jsx)("select",{value:t.email_field,onChange:t=>L(e,{email_field:t.target.value}),children:e.email_fields.map(e=>(0,y.jsx)("option",{value:e.name,children:e.label},e.name))})]}),(0,y.jsxs)("label",{className:"f",children:[c("newsletter.s_consent_field"),(0,y.jsx)("select",{value:t.consent_field,onChange:t=>L(e,{consent_field:t.target.value}),children:e.checkboxes.map(e=>(0,y.jsx)("option",{value:e.name,children:e.label},e.name))})]})]})]},e.form_id)}),[["shop",c("newsletter.s_shop"),c("newsletter.s_shop_hint")],["booking",c("newsletter.s_booking"),c("newsletter.s_booking_hint")]].map(e=>{let[t,s,n]=e;return(0,y.jsxs)("div",{className:"row between",style:{flexWrap:"nowrap",gap:14,borderTop:"1px solid var(--line)",paddingTop:12},children:[(0,y.jsxs)("span",{className:"small",children:[(0,y.jsx)("b",{children:s}),(0,y.jsx)("br",{}),(0,y.jsx)("span",{className:"muted",children:c("newsletter.s_src_note",{hint:n})})]}),(0,y.jsx)(h.dO,{checked:!!m.sources[t],onChange:e=>u((0,l.A)((0,l.A)({},m),{},{sources:(0,l.A)((0,l.A)({},m.sources),{},{[t]:e})})),label:c("newsletter.s_src_cb_aria",{name:s}),testid:"nl-src-".concat(t)})]},t)}),(0,y.jsxs)("div",{className:"row",children:[(0,y.jsx)("button",{type:"button",className:"b b-ink",disabled:g,onClick:()=>
1D({sources:m.sources},c("newsletter.s_sources_saved")),children:c("common.save")}),(0,y.jsx)("button",{type:"button",className:"b b-ghost",onClick:async()=>{try{const e=await s.syncSources(a);i(c("newsletter.s_synced",{n:k((e.l17_added||0)+(e.forms_added||0))})),r&&r()}catch(e){i(e.message,"bad")}},children:c("newsletter.s_sync")})]})]})]}),(0,y.jsxs)("div",{className:"grid2",style:{alignItems:"start"},children:[(0,y.jsxs)("div",{className:"card stack",children:[(0,y.jsx)("h2",{style:{margin:0},children:c("newsletter.lists_label")}),o.lists.map(e=>(0,y.jsxs)("div",{className:"row between",style:{borderTop:"1px solid var(--line)",paddingTop:10},children:[(0,y.jsxs)("span",{className:"small",children:[(0,y.jsx)("b",{children:e.name})," ",(0,y.jsxs)("span",{className:"muted",children:["\xb7 ",c("newsletter.s_list_count",{n:k(e.count)}),e.default?" \xb7 ".concat(c("newsletter.s_list_default")):""]})]}),!e.default&&(0,y.jsx)("button",{type:"button",className:"b b-ghost b-sm b-danger",onClick:async()=>{try{await s.deleteList(a,e.list_id),i(c("newsletter.s_list_deleted")),T()}catch(t){i(t.message,"bad")}},children:c("common.delete")})]},e.list_id)),(0,y.jsxs)("form",{className:"row",onSubmit:async e=>{e.preventDefault();try{await s.createList(a,{name:C}),S(""),i(c("newsletter.s_list_created")),T()}catch(t){i(t.message,"bad")}},children:[(0,y.jsx)("input",{type:"text",value:C,onChange:e=>S(e.target.value),placeholder:c("newsletter.s_new_list_ph"),style:{flex:1}}),(0,y.jsxs)("button",{type:"submit",className:"b b-soft",disabled:C.trim().length<2,children:[(0,y.jsx)(h.In,{n:"plus",s:15}),c("newsletter.s_create")]})]})]}),(0,y.jsxs)("div",{className:"card stack",children:[(0,y.jsxs)("div",{className:"row between",children:[(0,y.jsx)("h2",{style:{margin:0},children:c("newsletter.s_segments")}),(0,y.jsxs)("button",{type:"button",className:"b b-soft b-sm",onClick:()=>N(!0),"data-testid":"nl-seg-new",children:[(0,y.jsx)(h.In,{n:"plus",s:14}),c("newsletter.s_segment_btn")]})]}),(0,y.jsx)("p",{className:"small muted",children:c("newsletter.s_seg_intro")}),j?j.segments.map(e=>(0,y.jsxs)("div",{className:"row between",style:{borderTop:"1px solid var(--line)",paddingTop:10},children:[(0,y.jsxs)("span",{className:"small",children:[(0,y.jsx)("b",{children:e.name})," ",(0,y.jsxs)("span",{className:"muted",children:["\xb7 ",c("newsletter.s_seg_contacts",{count:e.count})]})]}),(0,y.jsx)("button",{type:"button",className:"b b-ghost b-sm b-danger",onClick:async()=>{await s.deleteSegment(a,e.segment_id),T()},children:c("common.delete")})]},e.segment_id)):(0,y.jsx)(h.Sk,{h:40})]})]}),(0,y.jsxs)("div",{className:"card stack",children:[(0,y.jsxs)("div",{className:"row between",children:[(0,y.jsx)("h2",{style:{margin:0},children:c("newsletter.s_privacy_title")}),(0,y.jsx)("span",{className:"pill warn plain",children:c("newsletter.s_privacy_draft")})]}),(0,y.jsx)("pre",{style:{whiteSpace:"pre-wrap",font:"inherit",fontSize:13.5,lineHeight:1.6,margin:0,color:"var(--ink2)"},children:d}),(0,y.jsx)("div",{className:"row",children:(0,y.jsxs)("button",{type:"button",className:"b b-soft",onClick:()=>A(d,"p"),children:[(0,y.jsx)(h.In,{n:"copy",s:15}),c("p"===I?"newsletter.copied":"newsletter.s_privacy_copy")]})})]}),(0,y.jsx)(se,{open:f,close:()=>N(!1),api:s,wid:a,lists:o.lists,tags:(null===j||void 0===j?void 0:j.tags)||[],toast:i,done:T})]})}function se(e){let{open:t,close:s,api:a,wid:i,lists:r,tags:c,toast:d,done:o}=e;const p=(0,w.Uy)(),[m,u]=(0,n.useState)(""),[x,b]=(0,n.useState)("all"),[g,v]=(0,n.useState)([{field:"tag",op:"is",value:""}
1]),[j,_]=(0,n.useState)(null);(0,n.useEffect)(()=>{t&&(u(""),b("all"),v([{field:"tag",op:"is",value:c[0]||""}]))},[t]),(0,n.useEffect)(()=>{if(!t)return;if(!g.every(e=>""!==e.value&&null!=e.value))return void _(null);const e=setTimeout(()=>a.segmentPreview(i,{match:x,rules:g}).then(e=>_(e.count)).catch(()=>_(null)),250);return()=>clearTimeout(e)},[t,g,x,a,i]);const f=(e,t)=>v(s=>s.map((s,n)=>n===e?(0,l.A)((0,l.A)({},s),t):s));return(0,y.jsx)(h.cj,{open:t,onClose:s,title:p("newsletter.seg_new_title"),testid:"nl-seg-sheet",footer:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("button",{type:"button",className:"b b-soft",onClick:s,children:p("common.cancel")}),(0,y.jsxs)("button",{type:"button",className:"b b-ink",disabled:m.trim().length<2,onClick:async()=>{try{await a.createSegment(i,{name:m,match:x,rules:g}),d(p("newsletter.s_seg_created")),s(),o()}catch(e){d(e.message,"bad")}},children:[p("newsletter.s_create"),null!=j?" (".concat(k(j),")"):""]})]}),children:(0,y.jsxs)("div",{className:"stack",children:[(0,y.jsxs)("label",{className:"f",children:[p("newsletter.name_label"),(0,y.jsx)("input",{type:"text",value:m,onChange:e=>u(e.target.value),placeholder:p("newsletter.seg_name_ph"),"data-autofocus":!0})]}),(0,y.jsxs)("div",{className:"row small",children:[p("newsletter.seg_match_pre")," ",(0,y.jsxs)("select",{value:x,onChange:e=>b(e.target.value),style:{width:"auto",minHeight:34},children:[(0,y.jsx)("option",{value:"all",children:p("newsletter.seg_all")}),(0,y.jsx)("option",{value:"any",children:p("newsletter.seg_any")})]})," ",p("newsletter.seg_match_post")]}),g.map((e,t)=>(0,y.jsxs)("div",{className:"row",style:{flexWrap:"nowrap"},children:[(0,y.jsxs)("select",{value:e.field,onChange:e=>f(t,{field:e.target.value,op:"signed_up"===e.target.value?"within_days":"is",value:"signed_up"===e.target.value?30:"tracking"===e.target.value||""}),style:{width:150},children:[(0,y.jsx)("option",{value:"tag",children:p("newsletter.seg_field_tag")}),(0,y.jsx)("option",{value:"list",children:p("newsletter.seg_field_list")}),(0,y.jsx)("option",{value:"source",children:p("newsletter.seg_field_source")}),(0,y.jsx)("option",{value:"signed_up",children:p("newsletter.seg_field_signed_up")}),(0,y.jsx)("option",{value:"tracking",children:p("newsletter.tracking_pill")})]}),"signed_up"===e.field?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("span",{className:"small",children:p("newsletter.seg_within_pre")}),(0,y.jsx)("input",{type:"number",min:1,value:e.value,onChange:e=>f(t,{value:Number(e.target.value)}),style:{width:80}}),(0,y.jsx)("span",{className:"small",children:p("newsletter.seg_within_post")})]}):"tracking"===e.field?(0,y.jsxs)("select",{value:String(e.value),onChange:e=>f(t,{value:"true"===e.target.value}),children:[(0,y.jsx)("option",{value:"true",children:p("newsletter.seg_yes")}),(0,y.jsx)("option",{value:"false",children:p("newsletter.seg_no")})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("select",{value:e.op,onChange:e=>f(t,{op:e.target.value}),style:{width:110},children:[(0,y.jsx)("option",{value:"is",children:p("newsletter.seg_is")}),(0,y.jsx)("option",{value:"is_not",children:p("newsletter.seg_is_not")})]}),"tag"===e.field&&(0,y.jsxs)("select",{value:e.value,onChange:e=>f(t,{value:e.target.value}),children:[(0,y.jsx)("option",{value:"",children:p("newsletter.seg_pick_tag")}),c.map(e=>(0,y.jsx)("option",{value:e,children:e},e))]}),"list"===e.field&&(0,y.jsxs)("select",{value:e.value,onChange:e=>f(t,{value:e.target.value}),children:[(0,y.jsx)("option",{value:"",children:p("newsletter.seg_pick_list")}),r.map(e=>(0,y.jsx)("option",{value:e.list_id,children:e.name},e.list_id))]}),"source"===e.field&&(0,y.jsxs)("select",{value:e.value,onChange:e=>f(t,{value:e.target.value}),children:[(0,y.jsx)("option",{value:"",children:p("newsletter.seg_pick_source")}),ee.map(e=>(0,y.jsx)("option",{value:e,children:p("newsletter.source_".concat(e))},e))]})]}),g.length>1&&(0,y.jsx)("button",{type:"button",className:"b b-ghost b-sm b-icon","aria-label":p("newsletter.seg_remove_rule"),onClick:()=>v(e=>e.filter((e,s)=>s!==t)),children:(0,y.jsx)(h.In,{n:"x",s:14})})]},t)),(0,y.jsxs)("button",{type:"button",className:"b b-ghost b-sm",style:{alignSelf:"flex-start"},onClick:()=>v(e=>[...e,{field:"tag",op:"is",value:""}]),children:[(0,y.jsx)(h.In,{n:"plus",s:14}),p("newsletter.seg_add_rule")]}),(0,y.jsxs)("div",{className:"nke-count",children:[(0,y.jsx)("b",{className:"num",children:null==j?"\u2013":k(j)}),p("newsletter.seg_matches")]})]})})}const ne=[{value:"overview",labelKey:"newsletter.tab_overview",icon:"chart"},{value:"contacts",labelKey:"newsletter.tab_contacts",icon:"users"}
1,{value:"campaigns",labelKey:"newsletter.tab_campaigns",icon:"send"},{value:"block",labelKey:"newsletter.tab_block",icon:"layout"},{value:"settings",labelKey:"newsletter.tab_settings",icon:"settings"}];function ae(e){let{api:t}=e;const s=(0,w.Uy)(),[a,i]=function(){const[e,t]=(0,n.useState)(()=>{const e=new URLSearchParams(window.location.search);return{website:e.get("website")||"",tab:e.get("tab")||"overview",campaign:e.get("campaign")||""}});return[e,(0,n.useCallback)(e=>{t(t=>{const s=(0,l.A)((0,l.A)({},t),e),n=new URLSearchParams(window.location.search);return Object.entries(s).forEach(e=>{let[t,s]=e;return s?n.set(t,s):n.delete(t)}),window.history.replaceState(null,"","".concat(window.location.pathname,"?").concat(n.toString())),s})},[])]}(),[r,c]=(0,n.useState)(null),[o,p]=(0,n.useState)(null),[m,b]=(0,n.useState)(null),[g,v]=(0,n.useState)(null),[j,_]=(0,h.dj)(),[k,f]=(0,n.useState)(0),N=a.website||o&&o[0]&&o[0].website_id||"";(0,n.useEffect)(()=>{let e=!0;return t.status().then(s=>{e&&(c(s),s.enabled&&t.sites().then(t=>e&&p(t.sites)).catch(()=>e&&p([])))}).catch(()=>e&&c({enabled:!1,error:!0})),()=>{e=!1}},[t]);const C=(0,n.useCallback)(()=>{N&&(v(null),t.overview(N).then(b).catch(e=>v(e.message)))},[t,N]);(0,n.useEffect)(()=>{b(null),C()},[C]);const S=(0,n.useMemo)(()=>(o||[]).find(e=>e.website_id===N),[o,N]),I=null===m||void 0===m?void 0:m.counts;if(r&&!r.enabled)return(0,y.jsxs)("div",{className:"nkg",role:"main","data-testid":"nl-off",children:[(0,y.jsx)("style",{children:u.s+x}),(0,y.jsxs)("div",{className:"nkg-wrap",children:[(0,y.jsxs)("a",{className:"nkn-back",href:"/dashboard",children:[(0,y.jsx)(h.In,{n:"back",s:15}),"Dashboard"]}),(0,y.jsx)("div",{className:"card",children:(0,y.jsx)(h.Sv,{level:1,art:"mail",title:s("newsletter.off_title"),text:s("newsletter.off_text")})})]})]});const A=async()=>{try{const e=await t.createCampaign(N,{lang:d()});i({tab:"campaigns",campaign:e.campaign_id})}catch(e){_(e.message,"bad")}};return(0,y.jsxs)("div",{className:"nkg",role:"main","data-testid":"nl-page",children:[(0,y.jsx)("style",{children:u.s+x}),(0,y.jsxs)("div",{className:"nkg-wrap",children:[(0,y.jsxs)("a",{className:"nkn-back",href:"/dashboard",children:[(0,y.jsx)(h.In,{n:"back",s:15}),"Dashboard"]}),(0,y.jsxs)("div",{className:"nkn-head",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("h1",{children:"Newsletter"}),o&&o.length>1?(0,y.jsxs)("label",{className:"nkn-site",children:[s("newsletter.for"),(0,y.jsx)("select",{value:N,onChange:e=>i({website:e.target.value,campaign:""}),"data-testid":"nl-site",children:o.map((e,t)=>{const s=o.filter(t=>t.name===e.name).length>1,n=o.slice(0,t+1).filter(t=>t.name===e.name).length;return(0,y.jsxs)("option",{value:e.website_id,children:[e.name,e.domain?" \xb7 ".concat(e.domain):s?" (".concat(n,")"):""]},e.website_id)})})]}):(0,y.jsx)("div",{className:"nkn-site",children:S?(0,y.jsxs)(y.Fragment,{children:[s("newsletter.for")," ",(0,y.jsx)("b",{style:{color:"var(--ink)"},children:S.name})]}):(0,y.jsx)(h.Sk,{h:14,w:140})})]}),N&&(0,y.jsxs)("div",{className:"row",children:[(0,y.jsxs)("button",{type:"button",className:"b b-soft",onClick:()=>i({tab:"contacts"}),children:[(0,y.jsx)(h.In,{n:"users",s:16}),s("newsletter.tab_contacts")]}),(0,y.jsxs)("button",{type:"button",className:"b b-ink",onClick:A,"data-testid":"nl-new",children:[(0,y.jsx)(h.In,{n:"plus",s:16}),s("newsletter.new_campaign")]})]})]}),o&&!o.length?(0,y.jsx)("div",{className:"card",style:{marginTop:24},children:(0,y.jsx)(h.Sv,{art:"mail",title:s("newsletter.no_site_title"),text:s("newsletter.no_site_text")})}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(h.tU,{value:a.tab,onChange:e=>i({tab:e,campaign:""}),testid:"nl-tabs",tabs:ne.map(e=>(0,l.A)((0,l.A)({},e),{},{label:s(e.labelKey)},"contacts"===e.value&&I?{count:I.subscribed}:{}))}),N&&"overview"===a.tab&&(0,y.jsx)(ie,{ov:m,err:g,retry:C,go:e=>i({tab:e}),newCampaign:A,open:e=>i({tab:"campaigns",campaign:e})}),N&&"contacts"===a.tab&&(0,y.jsx)(T,{api:t,wid:N,toast:_,onChange:C}),N&&"campaigns"===a.tab&&(0,y.jsx)(q,{api:t,wid:N,toast:_,open:e=>i({campaign:e}),newCampaign:A}
1,k),N&&"block"===a.tab&&(0,y.jsx)(Q,{api:t,wid:N,toast:_,onChange:C}),N&&"settings"===a.tab&&(0,y.jsx)(te,{api:t,wid:N,toast:_,onChange:C})]})]}),N&&a.campaign&&(0,y.jsx)(H,{api:t,wid:N,cid:a.campaign,toast:_,close:()=>{i({campaign:""}),f(e=>e+1),C()}}),j]})}function le(e){let{data:t}=e;const s=(0,w.Uy)(),n=120,a=Math.max(1,...t.map(e=>Math.max(e.new,e.left))),l=e=>6+588*e/Math.max(1,t.length-1),i=e=>114-e/a*100,r=t.map((e,t)=>"".concat(t?"L":"M").concat(l(t).toFixed(1),",").concat(i(e.new).toFixed(1))).join(" "),c=t.map((e,t)=>"".concat(t?"L":"M").concat(l(t).toFixed(1),",").concat(i(e.left).toFixed(1))).join(" ");return(0,y.jsxs)("svg",{className:"nkn-spark",viewBox:"0 0 ".concat(600," ").concat(n),preserveAspectRatio:"none",role:"img","aria-label":s("newsletter.spark_aria",{joined:t.reduce((e,t)=>e+t.new,0),left:t.reduce((e,t)=>e+t.left,0)}),children:[(0,y.jsx)("defs",{children:(0,y.jsxs)("linearGradient",{id:"nknGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,y.jsx)("stop",{offset:"0",stopColor:"#D4A017",stopOpacity:".28"}),(0,y.jsx)("stop",{offset:"1",stopColor:"#D4A017",stopOpacity:"0"})]})}),(0,y.jsx)("path",{className:"a",d:"".concat(r," L").concat(l(t.length-1),",").concat(n," L").concat(l(0),",").concat(n," Z")}),(0,y.jsx)("path",{className:"l",d:r}),(0,y.jsx)("path",{className:"u",d:c})]})}function ie(e){var t,s;let{ov:n,err:a,retry:l,go:i,newCampaign:r,open:c}=e;const d=(0,w.Uy)();if(a)return(0,y.jsx)("div",{className:"card",children:(0,y.jsxs)("div",{className:"banner bad",children:[(0,y.jsx)(h.In,{n:"alert"}),a,(0,y.jsx)("button",{type:"button",className:"b b-sm",onClick:l,children:d("common.retry")})]})});if(!n)return(0,y.jsxs)("div",{className:"stack","data-testid":"nl-ov-loading",children:[(0,y.jsx)("div",{className:"grid4",children:[0,1,2,3].map(e=>(0,y.jsxs)("div",{className:"card",children:[(0,y.jsx)(h.Sk,{h:14,w:"50%"}),(0,y.jsx)(h.Sk,{h:30,w:"40%",style:{marginTop:12}})]},e))}),(0,y.jsx)("div",{className:"card",children:(0,y.jsx)(h.Sk,{h:120})})]});const o=n.counts,p=n.growth||[],m=p.reduce((e,t)=>e+t.new,0),u=p.reduce((e,t)=>e+t.left,0),x=o.subscribed+u?100*u/(o.subscribed+u):0,b=n.entitlement,g=n.last_campaign,v=n.checklist.filter(e=>e.done).length,j={address:()=>i("settings"),block:()=>i("block"),sender:()=>{window.location.href="/settings?tab=domains"},first:r};return(0,y.jsxs)("div",{className:"stack",style:{gap:16},"data-testid":"nl-overview",children:[!b.can_send&&(0,y.jsxs)("div",{className:"banner warn","data-testid":"nl-upgrade",children:[(0,y.jsx)(h.In,{n:"info"}),(0,y.jsxs)("div",{className:"grow",children:[(0,y.jsx)("b",{children:d("newsletter.upgrade_title")})," ",d("newsletter.upgrade_text")]}),(0,y.jsx)("a",{className:"b b-sm",href:"/abrechnung",children:d("newsletter.upgrade_cta")})]}),(0,y.jsxs)("div",{className:"grid4",children:[(0,y.jsxs)("div",{className:"card kpi",children:[(0,y.jsx)("span",{className:"l",children:d("newsletter.kpi_subscribers")}),(0,y.jsx)("span",{className:"v","data-testid":"nl-kpi-subscribed",children:(0,y.jsx)(h.T9,{value:o.subscribed})}),(0,y.jsx)("span",{className:"d ".concat(m?"up":""),children:m?d("newsletter.kpi_new30",{n:k(m)}):d("newsletter.kpi_new30_none")})]}),(0,y.jsxs)("div",{className:"card kpi",children:[(0,y.jsx)("span",{className:"l",children:d("newsletter.kpi_pending")}),(0,y.jsx)("span",{className:"v",children:(0,y.jsx)(h.T9,{value:o.pending})}),(0,y.jsx)("span",{className:"d muted",style:{fontWeight:500},children:d("newsletter.kpi_doi")})]}),(0,y.jsxs)("div",{className:"card kpi",children:[(0,y.jsx)("span",{className:"l",children:d("newsletter.kpi_churn")}),(0,y.jsxs)("span",{className:"v",children:[x.toLocaleString((0,w.J6)(),{maximumFractionDigits:1})," %"]}),(0,y.jsx)("span",{className:"d ".concat(x>2?"down":""),children:d("newsletter.kpi_left",{n:k(u)})})]}),(0,y.jsxs)("div",{className:"card kpi",children:[(0,y.jsx)("span",{className:"l",children:d("newsletter.kpi_last")}),g?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("span",{className:"v",style:{fontSize:22,lineHeight:1.2,marginTop:4},children:[k(null===(t=g.stats)||void 0===t?void 0:t.sent)," ",(0,y.jsx)("small",{className:"muted",style:{fontSize:13},children:d("newsletter.kpi_sent")}
1)]}),(0,y.jsxs)("button",{type:"button",className:"b b-ghost b-sm",style:{alignSelf:"flex-start",marginLeft:-8},onClick:()=>c(g.campaign_id),children:[g.name,(0,y.jsx)(h.In,{n:"chev",s:14})]})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("span",{className:"v",style:{fontSize:22},children:"\u2013"}),(0,y.jsx)("span",{className:"d muted",style:{fontWeight:500},children:d("newsletter.kpi_none_sent")})]})]})]}),(0,y.jsxs)("div",{className:"grid2 nkn-split",children:[(0,y.jsxs)("div",{className:"card",children:[(0,y.jsxs)("div",{className:"row between",children:[(0,y.jsx)("h2",{style:{margin:0},children:d("newsletter.growth_title")}),(0,y.jsxs)("span",{className:"tiny muted row",style:{gap:12},children:[(0,y.jsxs)("span",{className:"row",style:{gap:5},children:[(0,y.jsx)("i",{style:{width:10,height:2,background:"var(--gold)",display:"inline-block"}}),d("newsletter.growth_new")]}),(0,y.jsxs)("span",{className:"row",style:{gap:5},children:[(0,y.jsx)("i",{style:{width:10,height:0,borderTop:"1.5px dashed var(--bad)",display:"inline-block"}}),d("newsletter.growth_left")]})]})]}),(0,y.jsx)("div",{style:{marginTop:10},children:(0,y.jsx)(le,{data:p})}),(0,y.jsxs)("div",{className:"row between tiny muted",children:[(0,y.jsx)("span",{children:_(null===(s=p[0])||void 0===s?void 0:s.day)}),(0,y.jsx)("span",{children:d("newsletter.growth_today")})]})]}),(0,y.jsxs)("div",{className:"card","data-testid":"nl-checklist",children:[(0,y.jsxs)("div",{className:"row between",children:[(0,y.jsx)("h2",{style:{margin:0},children:d("newsletter.setup_title")}),(0,y.jsx)("span",{className:"pill gold plain",children:d("newsletter.setup_progress",{done:v,total:n.checklist.length})})]}),(0,y.jsx)("div",{style:{marginTop:8},children:n.checklist.map(e=>(0,y.jsxs)("div",{className:"nkn-check".concat(e.done?" done":""),children:[(0,y.jsx)("span",{className:"nkn-dot".concat(e.done?" done":""),children:(0,y.jsx)(h.In,{n:"check",s:13,w:3})}),(0,y.jsx)("span",{className:"t grow small",children:j[e.key]?d("newsletter.setup_".concat(e.key)):e.label}),!e.done&&(0,y.jsx)("button",{type:"button",className:"b b-sm b-soft",onClick:j[e.key],"data-testid":"nl-check-".concat(e.key),children:d("newsletter.setup_go")})]},e.key))})]})]}),(0,y.jsxs)("div",{className:"grid2 nkn-split",children:[(0,y.jsxs)("div",{className:"card",children:[(0,y.jsxs)("div",{className:"row between",children:[(0,y.jsx)("h2",{style:{margin:0},children:d("newsletter.recent_title")}),(0,y.jsxs)("button",{type:"button",className:"b b-ghost b-sm",onClick:()=>i("campaigns"),children:[d("newsletter.recent_all"),(0,y.jsx)(h.In,{n:"chev",s:14})]})]}),n.campaigns.length?(0,y.jsx)("div",{className:"list",style:{marginTop:8},children:n.campaigns.map(e=>(0,y.jsxs)("div",{className:"li click",style:{gridTemplateColumns:"minmax(0,1fr) auto"},onClick:()=>c(e.campaign_id),children:[(0,y.jsxs)("div",{style:{minWidth:0},children:[(0,y.jsx)("div",{className:"nkn-email",children:e.name}),(0,y.jsx)("div",{className:"nkn-sub",children:e.subject||d("newsletter.no_subject")})]}),(0,y.jsx)(U,{s:e.status,stats:e.stats})]},e.campaign_id))}):(0,y.jsx)(h.Sv,{art:"mail",title:d("newsletter.first_title"),text:d("newsletter.first_text"),children:(0,y.jsx)("button",{type:"button",className:"b b-gold",onClick:r,children:d("newsletter.write")})})]}),(0,y.jsxs)("div",{className:"card",children:[(0,y.jsx)("h2",{children:d("newsletter.quota_title")}),(0,y.jsxs)("div",{className:"row between small",children:[(0,y.jsx)("span",{className:"num",children:d("newsletter.quota_used",{used:k(b.used),quota:k(b.quota)})}),(0,y.jsx)("span",{className:"muted",children:"admin"===b.tier?d("newsletter.tier_admin"):b.tier})]}),(0,y.jsx)("div",{className:"nkn-quota",style:{marginTop:8},children:(0,y.jsx)("i",{style:{width:"".concat(b.quota?Math.min(100,100*b.used/b.quota):0,"%")}})}),(0,y.jsxs)("p",{className:"tiny muted",style:{marginTop:12},children:[d("newsletter.sender_label")," ",(0,y.jsx)("b",{children:n.sender.address})," ",n.sender.verified?d("newsletter.sender_own"):d("newsletter.sender_nakura")]})]})]})]})}function re(){const{getToken:e}=(0,a.As)(),t=(0,n.useRef)(e);t.current=e;const s=(0,n.useMemo)(()=>j(()=>t.current()),[]);return(0,y.jsx)(ae,{api:s})}}}]);
2//# sourceMappingURL=784.4ba7f101.chunk.js.map
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.