1import{c as te,r,D as P,f as se,a as re,t as W,E as w,A as F,j as e,L as D,b as ae,d as oe,C as S,S as ne,B as ie,e as le,M as de,g as ce,h as me,i as ue,k as U}from"./main-BZn_dPrE.js";import{g as xe,F as he,u as fe}from"./billing.functions-gOKdGa6_.js";import{Z as pe,S as ge}from"./zap-Dg-ft17L.js";const be=[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]],we=te("shield-off",be);function je(){if(typeof navigator>"u")return P;const c=(navigator.language||"en").toLowerCase().split("-")[0];return ue.includes(c)?c:P}function ke(){const[c,_]=r.useState(null),[C,Y]=r.useState(!1),[l,Z]=r.useState(!1),[x,$]=r.useState(!0),[L,J]=r.useState(null),[m,q]=r.useState(null),[n,j]=r.useState([]),[h,E]=r.useState(!0),[T,I]=r.useState(!1),[H,A]=r.useState(!1),[g,M]=r.useState(null),[V,v]=r.useState(!1),[y,z]=r.useState(!1),N=r.useRef(null),[G,K]=r.useState(P);r.useEffect(()=>{K(je())},[]);const s=se(G).welcome;r.useEffect(()=>{if(typeof window>"u")return;const t=window.navigator.userAgent;z(/iphone|ipad|ipod/i.test(t)),(window.matchMedia?.("(display-mode: standalone)").matches||window.navigator.standalone===!0)&&v(!0);const i=d=>{d.preventDefault(),M(d)};return window.addEventListener("beforeinstallprompt",i),window.addEventListener("appinstalled",()=>v(!0)),()=>window.removeEventListener("beforeinstallprompt",i)},[]);const Q=async()=>{if(!g)return;await g.prompt(),(await g.userChoice).outcome==="accepted"&&v(!0),M(null)};r.useEffect(()=>{const t=new URL(window.location.href);let a=t.searchParams.get("token"),i=t.searchParams.get("mollie_id")||t.searchParams.get("id");if(!i)try{i=localStorage.getItem("hm_mollie_pid")}catch{}t.searchParams.get("just_confirmed")==="1"&&Y(!0);const d=t.searchParams.get("just_paid")==="1"||!!i;Z(d);let b=!1;return(async()=>{try{const p=d?25:1;for(let k=0;k<p;k++){if(b)return;if(!a&&d&&i)try{const o=await re({data:{paymentId:i}});if(o.ok){a=o.token,_(a);const u=new URL(window.location.href);u.searchParams.set("token",o.token),u.searchParams.delete("mollie_id"),u.searchParams.delete("id"),window.history.replaceState({},"",u.toString());try{localStorage.removeItem("hm_mollie_pid")}catch{}}}catch{}if(a){_(a);const o=await xe({data:{token:a}});if(!o.ok)throw new Error("Subscription not found");const u=o.subscriber?.tier;if(!d||u==="paid"||k===p-1){q(o.subscriber),j(o.watchlist),N.current={watchlist:o.watchlist,digest:o.subscriber.digest_opt_in},t.searchParams.get("just_confirmed")==="1"&&o.subscriber.confirmed&&W("email_confirmed",w.emailConfirmed,{surface:"welcome",watch_count:o.watchlist.length,mode:o.watchlist.length===0?"global":"countries"}),u==="paid"&&W("subscription_activated",w.subscriptionActivated,{plan:"pulse_pro",surface:"welcome"}),E(o.subscriber.digest_opt_in);try{localStorage.setItem("hm_token",a)}catch{}return}}if(!d)throw new Error("Missing token. Open the link from your confirmation email.");await new Promise(o=>setTimeout(o,1500))}if(!a&&!d)throw new Error("Missing token. Open the link from your confirmation email.")}catch(p){b||J(p instanceof Error?p.message:"Something went wrong")}finally{b||$(!1)}})(),()=>{b=!0}},[]),r.useEffect(()=>{if(x||m||!l)return;const t=setTimeout(()=>window.location.reload(),6e3);return()=>clearTimeout(t)},[x,m,l]);const[f,B]=r.useState(""),O=r.useMemo(()=>{const t=f.trim().toLowerCase(),a=F.filter(i=>!n.includes(i.iso2));return(t?a.filter(i=>i.name.toLowerCase().includes(t)||i.iso2.toLowerCase().includes(t)):a).slice(0,30)},[f,n]),X=t=>{/^[A-Z]{2}$/.test(t)&&(n.includes(t)||(j([...n,t]),B("")))},R=t=>F.find(a=>a.iso2===t)?.name??t,ee=async()=>{if(c){I(!0),A(!1);try{await fe({data:{token:c,digestOptIn:h,watchlist:n}});const t=N.current;t&&(t.watchlist.join(",")!==n.join(",")&&U(w.watchlistChanged,{surface:"welcome",action:n.length>t.watchlist.length?"add":n.length<t.watchlist.length?"remove":"reorder",count:n.length,mode:n.length===0?"global":"countries"}),t.digest!==h&&U(w.alertPrefsChanged,{surface:"welcome",field:"digest_opt_in",value:h})),N.current={watchlist:[...n],digest:h},A(!0)}finally{I(!1)}}};return e.jsx("div",{className:"min-h-screen bg-background text-foreground",children:e.jsxs("div",{className:"mx-auto max-w-xl px-5 py-8",children:[e.jsxs(D,{to:"/",className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:[e.jsx(ae,{className:"h-3.5 w-3.5"})," ",s.backToMap]}),e.jsx("h1",{className:"mt-4 text-3xl font-semibold tracking-tight",children:s.title}),x&&e.jsxs("p",{className:"mt-6 flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(oe,{className:"h-4 w-4 animate-spin"})," ",l?"Payment received â activating your Pulse Proâ¦":s.activating]}),!x&&!m&&l&&e.jsxs("div",{className:"mt-6 rounded-lg border border-emerald-500/40 bg-emerald-500/10 p-4 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 font-semibold text-emerald-400",children:[e.jsx(S,{className:"h-4 w-4"})," Payment received"]}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"We're activating your Pulse Pro now â usually a few seconds. This page will refresh itself."})]}),L&&!x&&!l&&e.jsx("div",{className:"mt-6 rounded-lg border border-destructive/40 bg-destructive/10 p-4 text-sm",children:L}),m&&!x&&e.jsxs(e.Fragment,{children:[(C||l)&&e.jsxs("div",{className:"mt-6 rounded-lg border border-emerald-500/40 bg-emerald-500/10 p-4 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 font-semibold text-emerald-400",children:[e.jsx(S,{className:"h-4 w-4"})," ",l?"Pulse Pro activated":s.youreIn]}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:l?"Your subscription is active. The site is now ad-free for you everywhere â and your support is what keeps the live map free for the rest of the world. Thank y
1ou.":s.youreInBody})]}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[C||l?s.subscribedAs:s.welcomeBack," ",e.jsx("strong",{children:m.email}),"."]}),m.tier==="paid"&&e.jsxs("section",{className:"mt-6 rounded-xl border border-[var(--watch)]/40 bg-[color-mix(in_oklab,var(--watch)_8%,transparent)] p-5",children:[e.jsxs("p",{className:"inline-flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wider text-[var(--watch)]",children:[e.jsx(ne,{className:"h-3 w-3"})," Your Pulse Pro"]}),e.jsx("h2",{className:"mt-1 text-lg font-semibold",children:"Ad-free for you. Free map for the world."}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Your Pulse Pro is active. Two things just happened: the site is ad-free for you across every page, and your â¬7.99/month is now funding the editorial work that keeps the live map free for travellers, researchers and public-health teams worldwide. Thank you."}),e.jsxs("ul",{className:"mt-4 space-y-3 text-sm",children:[e.jsxs("li",{className:"flex items-start gap-2.5",children:[e.jsx(we,{className:"mt-0.5 h-4 w-4 shrink-0 text-[var(--watch)]"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:"Ad-free, everywhere"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"No banners, no in-page push, no sticky bars â across the entire site."})]})]}),e.jsxs("li",{className:"flex items-start gap-2.5",children:[e.jsx(he,{className:"mt-0.5 h-4 w-4 shrink-0 text-[var(--watch)]"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:"Weekly curated digest"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Same hand-curated read every confirmed subscriber gets â across every country you watch."})]})]}),e.jsxs("li",{className:"flex items-start gap-2.5",children:[e.jsx(ie,{className:"mt-0.5 h-4 w-4 shrink-0 text-[var(--watch)]"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:"Worldwide or per country"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Follow the countries you care about, or leave your list empty to follow Worldwide."})]})]}),e.jsxs("li",{className:"flex items-start gap-2.5",children:[e.jsx(pe,{className:"mt-0.5 h-4 w-4 shrink-0 text-[var(--watch)]"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:"You fund the editorial work"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Pulse Pro readers are the reason this project can stay independent of ad networks and data brokers. Thank you."})]})]})]}),e.jsx("p",{className:"mt-4 text-[11px] text-muted-foreground",children:"Add the countries you care about below â or leave it empty to follow Worldwide."})]}),e.jsxs("section",{className:"mt-6 rounded-lg border border-border bg-muted/20 p-4",children:[e.jsx("h2",{className:"text-sm font-semibold",children:s.digestTitle}),e.jsxs("label",{className:"mt-2 flex items-center gap-2 text-sm",children:[e.jsx("input",{type:"checkbox",checked:h,onChange:t=>E(t.target.checked),className:"h-4 w-4"}),s.digestLabel]})]}),e.jsxs("section",{className:"mt-4 rounded-lg border border-border bg-muted/20 p-4",children:[e.jsx("h2",{className:"text-sm font-semibold",children:s.watchlistTitle}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:s.watchlistDesc}),n.length===0?e.jsx("div",{className:"mt-3 rounded-md border border-dashed border-border bg-background/50 p-3",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(le,{className:"mt-0.5 h-4 w-4 shrink-0 text-primary"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-semibold text-foreground",children:"You're following Worldwide"}),e.jsx("p",{className:"mt-0.5 text-[11px] leading-relaxed text-muted-foreground",children:"No countries selected yet â so your weekly digest covers the whole world. Add specific countries below to narrow your focus."})]})]})}):e.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:n.map(t=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-md border border-border bg-background px-2 py-1 text-xs",children:[e.jsx(de,{className:"h-3 w-3 text-primary"}),R(t),e.jsx("button",{onClick:()=>j(n.filter(a=>a!==t)),className:"ml-0.5 text-muted-foreground hover:text-foreground","aria-label":`Remove ${R(t)}`,children:"Ã"})]},t))}),e.jsxs("div",{className:"relative mt-3",children:[e.jsx(ce,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),e.jsx("input",{type:"text",value:f,onChange:t=>B(t.target.value),placeholder:s.searchPlaceholder,className:"w-full rounded-md border border-border bg-background py-2 pl-8 pr-2 text-xs outline-none focus:border-primary"})]}),f.trim()&&e.jsx("div",{className:"mt-2 max-h-56 overflow-y-auto rounded-md border border-border",children:O.length===0?e.jsxs("p",{className:"p-3 text-[11px] text-muted-foreground",children:['â "',f,'".']}):O.map(t=>e.jsxs("button",{onClick:()=>X(t.iso2),className:"flex w-full items-center justify-between border-b border-border px-3 py-2 text-left text-xs last:border-0 hover:bg-muted/50",children:[e.jsx("span",{children:t.name}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:t.iso2})]},t.iso2))})]}),e.jsxs("div",{className:"mt-6 flex items-center gap-3",children:[e.jsx("button",{onClick:ee,disabled:T,className:"rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-60",children:T?s.saving:s.save}),H&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-emerald-400",children:[e.jsx(S,{className:"h-3.5 w-3.5"})," ",s.saved]})]}),e.jsx("p",{className:"mt-6 text-xs text-muted-foreground",children:s.bookmark}),m.tier!=="paid"&&e.jsxs("section",{className:"mt-8 rounded-xl border border-[var(--watch)]/40 bg-[
1color-mix(in_oklab,var(--watch)_8%,transparent)] p-5",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-[var(--watch)]",children:s.proLabel}),e.jsx("h2",{className:"mt-1 text-lg font-semibold",children:s.proTitle}),e.jsx("p",{className:"mt-1.5 text-xs leading-relaxed text-muted-foreground",children:s.proBody}),e.jsx("a",{href:c?`/plans?token=${encodeURIComponent(c)}`:"/plans",className:"mt-4 inline-flex items-center gap-1.5 rounded-lg bg-[var(--watch)] px-4 py-2 text-xs font-semibold text-[var(--watch-foreground)] hover:brightness-110",children:s.proCta})]}),!V&&e.jsxs("section",{className:"mt-4 rounded-xl border border-border bg-muted/20 p-5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ge,{className:"h-4 w-4 text-primary"}),e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-primary",children:s.installLabel})]}),e.jsx("h2",{className:"mt-1 text-lg font-semibold",children:s.installTitle}),e.jsx("p",{className:"mt-1.5 text-xs leading-relaxed text-muted-foreground",children:y?s.installBodyIos:s.installBodyAndroid}),g&&!y?e.jsx("button",{onClick:Q,className:"mt-4 inline-flex items-center gap-1.5 rounded-lg bg-primary px-4 py-2 text-xs font-semibold text-primary-foreground hover:brightness-110",children:s.installCta}):y?e.jsxs("p",{className:"mt-3 inline-flex items-center gap-1.5 rounded-md border border-border bg-background px-2.5 py-1.5 text-[11px] text-muted-foreground",children:[e.jsx(me,{className:"h-3 w-3"})," Share â Add to Home Screen"]}):e.jsx(D,{to:"/install",className:"mt-4 inline-flex items-center gap-1.5 rounded-lg border border-border bg-background px-4 py-2 text-xs font-semibold hover:bg-accent",children:s.installInstructions})]})]})]})})}export{ke as component};
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.