var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
const { useState: useStateB, useReducer, useEffect: useEffectB, useRef: useRefB } = React;
const STRINGS = {
  hu: {
    dow: ["V", "H", "K", "Sze", "Cs", "P", "Szo"],
    mon: ["jan", "feb", "m\xE1r", "\xE1pr", "m\xE1j", "j\xFAn", "j\xFAl", "aug", "szept", "okt", "nov", "dec"],
    today: "Ma",
    tomorrow: "Holnap",
    dayTitle: (d) => `${d.dow} ${d.day}. ${d.month}`,
    eyebrow: "Id\u0151pontfoglal\xE1s",
    titleA: "Foglalj id\u0151pontot ",
    titleEm: "most.",
    whichCentre: "Melyik centrumban adn\xE1l plazm\xE1t?",
    step1: "V\xE1lassz napot \xE9s id\u0151pontot",
    step3: "Add meg az adataidat.",
    pickDay: "V\xE1lassz napot",
    loadingTimes: "Szabad id\u0151pontok bet\xF6lt\xE9se\u2026",
    loadingSlots: "Id\u0151pontok bet\xF6lt\xE9se\u2026",
    calendarError: "Nem siker\xFClt bet\xF6lteni a napt\xE1rat. Pr\xF3b\xE1ld \xFAjra.",
    slotsError: "Nem siker\xFClt bet\xF6lteni az id\u0151pontokat.",
    retry: "\xDAjra",
    noFreeTimes: "Erre a napra m\xE1r nincs szabad id\u0151pont \u2014 v\xE1lassz m\xE1sikat.",
    slotNote: "15 perces \xE9rkez\xE9si id\u0151s\xE1vot foglalsz. K\xE9r\xFCnk, \xE9rkezz 5 perccel kor\xE1bban.",
    legend: { many: "sok hely", some: "van", few: "p\xE1r", full: "tele" },
    fieldName: "Teljes neved",
    fieldEmail: "E-mail",
    fieldPhone: "Telefonsz\xE1m",
    checking: "ellen\u0151rz\xE9s",
    consentPre: "Elfogadom, hogy a foglal\xE1sommal kapcsolatban felvegy\xE9tek velem a kapcsolatot. Az ",
    consentTerms: "\xC1SZF-et",
    consentMid: " \xE9s az ",
    consentPrivacy: "adatkezel\xE9si t\xE1j\xE9koztat\xF3t",
    consentPost: " megismertem.",
    pNeedConsent: "M\xE9g egy pipa \u2014 mindj\xE1rt k\xE9sz.",
    p0: "3 mez\u0151 van \u2014 kb. 30 m\xE1sodperc.",
    p1: "M\xE1r csak 2 mez\u0151 \u2014 mindj\xE1rt k\xE9sz vagy.",
    p2: "M\xE9g 1 l\xE9p\xE9s \u2014 m\xE1r majdnem megvan.",
    pValid: "Mehet \u2014 tal\xE1lkozunk a centrumban.",
    pConsentLeft: "M\xE9g egy l\xE9p\xE9s \u2014 pip\xE1ld be a hozz\xE1j\xE1rul\xE1st.",
    bookingInProgress: "Foglal\xE1s folyamatban\u2026",
    booking: "Foglal\xE1s\u2026",
    submitCta: "Id\u0151pontot foglalok",
    submitFill: "T\xF6lts ki minden mez\u0151t",
    noSpam: "Nem k\xFCld\xFCnk lev\xE9lszemetet. Az e-mail csak a foglal\xE1sr\xF3l sz\xF3l.",
    errSlotFull: "Sajnos ez az id\u0151pont \xE9pp betelt \u2014 v\xE1lassz m\xE1sikat.",
    errDuplicate: "M\xE1r van egy friss foglal\xE1sod ezzel az e-mail c\xEDmmel. N\xE9zd meg a postal\xE1d\xE1dat vagy h\xEDvj minket.",
    errExclusion: "Most nem tudunk id\u0151pontot foglalni neked. K\xE9rj\xFCk, n\xE9zd meg a fenti \xFCzenetet.",
    errPhone: "A telefonsz\xE1m form\xE1tuma nem megfelel\u0151.",
    errEmail: "Az e-mail c\xEDm form\xE1tuma nem megfelel\u0151.",
    errGeneric: "Hiba t\xF6rt\xE9nt. Pr\xF3b\xE1ld \xFAjra.",
    errStale: "Most nem siker\xFClt ellen\u0151rizni az id\u0151pontot. Pr\xF3b\xE1ld \xFAjra egy perc m\xFAlva.",
    errNetwork: "H\xE1l\xF3zati hiba a v\xE9gs\u0151 ellen\u0151rz\xE9skor. Pr\xF3b\xE1ld \xFAjra.",
    exclSuggestOutside: (d) => `A foglal\xF3t ${d} ut\xE1n tudod nyitni \u2014 most m\xE9g a kiz\xE1r\xE1s van \xE9rv\xE9nyben.`,
    exclCurrentlyTitle: "Ideiglenes kiz\xE1r\xE1s",
    exclCurrentlyUntil: (d) => `Az aktu\xE1lis kiz\xE1r\xE1sod ${d}-ig tart. Addig nem tudunk id\u0151pontot adni neked.`,
    exclCurrentlyNoDate: "Egy aktu\xE1lis kiz\xE1r\xE1s miatt jelenleg nem tudsz foglalni.",
    exclPermTitle: "Nem tudunk most foglalni",
    exclPermBody: "A nyilv\xE1ntart\xE1s alapj\xE1n jelenleg nem tudsz plazm\xE1t adni n\xE1lunk. R\xE9szletek\xE9rt keresd a recepci\xF3nkat \u2014 elmondj\xE1k, mit lehet tenni.",
    exclCancelTitle: "Visszavon\xE1sig kiz\xE1rva",
    exclCancelBody: "Egy kor\xE1bbi probl\xE9ma miatt jelenleg nem tudsz online id\u0151pontot foglalni. H\xEDvd a centrumot, \xE9s koll\xE9g\xE1ink elmondj\xE1k, mi a teend\u0151.",
    exclDefaultTitle: "Most nem tudunk foglalni",
    exclDefaultBody: "Valami k\xF6zbej\xF6tt. H\xEDvd a centrumot vagy pr\xF3b\xE1ld \xFAjra k\xE9s\u0151bb.",
    exclSuggestLabel: (d) => `Foglalok ${d}-t\xF3l`,
    exclCallLabel: (s) => `H\xEDvom: ${s}`,
    exclAnotherCentre: "M\xE1sik centrum",
    noBloodTitle: "Helysz\xEDni v\xE9rad\xE1s kell az els\u0151 alkalomn\xE1l",
    noBloodBody: "A nyilv\xE1ntart\xE1s szerint nincs \xE9rv\xE9nyes v\xE9rad\xE1si igazol\xE1sod. N\xE1lunk a helysz\xEDnen elk\xE9sz\xEDtj\xFCk \u2014 az els\u0151 alkalom kicsit hosszabb lesz, de ut\xE1na m\xE1r gyorsan megy minden.",
    successTitleA: "Megvan! ",
    successTitleEm: "Foglalva.",
    successSub: "Tal\xE1lkozunk a centrumban. K\xFCldt\xFCnk egy e-mailt a r\xE9szletekkel.",
    rowCentre: "Centrum",
    rowTime: "Id\u0151pont",
    rowBring: "Hozz magaddal",
    rowPay: "Fizet\xE9s",
    bringVal: "Szem\xE9lyi igazolv\xE1ny + lakc\xEDmk\xE1rtya",
    bringSub: "TB-k\xE1rty\xE1ra nincs sz\xFCks\xE9g",
    payVal: "K\xE9szp\xE9nzben, helyben",
    paySub: "\xDAj donornak 10.000 Ft, visszat\xE9r\u0151nek a saj\xE1t szintje szerint",
    timeSub: "15 perces ablak \u2014 \xE9rkezz 5 perccel el\u0151tte",
    addCal: "Napt\xE1rba",
    share: "Megosztom",
    bookAnother: "M\xE1sik id\u0151pontot foglalok"
  },
  en: {
    dow: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
    mon: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
    today: "Today",
    tomorrow: "Tomorrow",
    dayTitle: (d) => `${d.dow} ${d.day} ${d.month}`,
    eyebrow: "Booking",
    titleA: "Book your slot ",
    titleEm: "now.",
    whichCentre: "Which centre?",
    step1: "When suits you?",
    step3: "Your details",
    pickDay: "Pick a day",
    loadingTimes: "Loading available times\u2026",
    loadingSlots: "Loading times\u2026",
    calendarError: "Couldn't load the calendar. Please try again.",
    slotsError: "Couldn't load times.",
    retry: "Retry",
    noFreeTimes: "No free times left for this day \u2014 pick another.",
    slotNote: "You're booking a 15-minute window. Arrive 5 minutes early.",
    legend: { many: "lots", some: "some", few: "few", full: "full" },
    fieldName: "Full name",
    fieldEmail: "Email",
    fieldPhone: "Phone number",
    checking: "checking",
    consentPre: "I agree to be contacted about my booking. I've read the ",
    consentTerms: "Terms",
    consentMid: " and the ",
    consentPrivacy: "Privacy Policy",
    consentPost: ".",
    pNeedConsent: "One more tick \u2014 almost done.",
    p0: "3 fields \u2014 about 30 seconds.",
    p1: "2 more fields \u2014 going great.",
    p2: "1 more step \u2014 almost there.",
    pValid: "Ready \u2014 see you at the centre.",
    pConsentLeft: "One more step \u2014 tick the consent box.",
    bookingInProgress: "Booking in progress\u2026",
    booking: "Booking\u2026",
    submitCta: "Book now \u2014 50,000 HUF waiting",
    submitFill: "Fill in every field",
    noSpam: "No spam. The email is only about your booking.",
    errSlotFull: "Sorry, that time just filled up \u2014 pick another.",
    errDuplicate: "You already have a recent booking with this email. Check your inbox or call us.",
    errExclusion: "We can't book you right now. Please see the message above.",
    errPhone: "The phone number format is invalid.",
    errEmail: "The email format is invalid.",
    errGeneric: "Something went wrong. Please try again.",
    errStale: "We couldn't verify the time just now. Try again in a minute.",
    errNetwork: "Network error during the final check. Please try again.",
    exclSuggestOutside: (d) => `You can book after ${d} \u2014 the exclusion is still active until then.`,
    exclCurrentlyTitle: "Temporary exclusion",
    exclCurrentlyUntil: (d) => `Your current exclusion lasts until ${d}. We can't offer a time before then.`,
    exclCurrentlyNoDate: "Due to a current exclusion you can't book right now.",
    exclPermTitle: "We can't book you now",
    exclPermBody: "According to our records you can't donate with us right now. Please contact our reception \u2014 they can tell you what to do.",
    exclCancelTitle: "Excluded until further notice",
    exclCancelBody: "Booking is paused due to an earlier issue. Our reception can lift it \u2014 please call us.",
    exclDefaultTitle: "We can't book you now",
    exclDefaultBody: "Something came up. Call the centre or try again later.",
    exclSuggestLabel: (d) => `Book from ${d}`,
    exclCallLabel: (s) => `Call ${s}`,
    exclAnotherCentre: "Another centre",
    noBloodTitle: "On-site blood test at your first visit",
    noBloodBody: "Our records show no valid blood-test certificate. We'll do it on site \u2014 your first visit takes a little longer, then everything is quick.",
    successTitleA: "Done! ",
    successTitleEm: "Booked.",
    successSub: "See you at the centre. We've emailed you the details.",
    rowCentre: "Centre",
    rowTime: "Time",
    rowBring: "Bring with you",
    rowPay: "Payment",
    bringVal: "ID card + address card",
    bringSub: "No health-insurance card needed",
    payVal: "Cash, on site",
    paySub: "10,000 HUF for new donors; returning donors at their own level",
    timeSub: "15-minute window \u2014 arrive 5 min early",
    addCal: "Add to calendar",
    share: "Share",
    bookAnother: "Book another time"
  }
};
const initial = {
  step: 1,
  selectedDate: null,
  selectedSlot: null,
  form: { name: "", phone: "", email: "", consent: false },
  isSubmitted: false
};
function reducer(state, action) {
  switch (action.type) {
    case "PICK_DATE":
      return __spreadProps(__spreadValues({}, state), { selectedDate: action.iso, selectedSlot: null });
    case "PICK_SLOT":
      return __spreadProps(__spreadValues({}, state), { selectedSlot: action.id });
    case "SET_FIELD":
      return __spreadProps(__spreadValues({}, state), { form: __spreadProps(__spreadValues({}, state.form), { [action.key]: action.value }) });
    case "SUBMIT":
      return __spreadProps(__spreadValues({}, state), { isSubmitted: true });
    case "RESET":
      return __spreadValues({}, initial);
    default:
      return state;
  }
}
function CapDot({ code }) {
  const map = {
    0: { c: "#D6D6CE" },
    1: { c: "#E0A23A" },
    2: { c: "#9CB66D" },
    3: { c: "#00C896" }
  };
  const v = map[code] || map[2];
  return /* @__PURE__ */ React.createElement("span", { className: "inline-block w-1.5 h-1.5 rounded-full", style: { background: v.c } });
}
function DayPill({ d, active, onClick }) {
  const closed = d.capCode === 0;
  return /* @__PURE__ */ React.createElement(
    "button",
    {
      disabled: closed,
      onClick,
      className: "shrink-0 w-[64px] rounded-2xl border px-2 py-3 flex flex-col items-center gap-1 transition active:scale-[0.97] " + (active ? "bg-ink text-white border-ink" : closed ? "bg-surface/60 text-ink/30 border-border" : "bg-white text-ink border-border hover:border-ink/40")
    },
    /* @__PURE__ */ React.createElement("span", { className: "text-[10.5px] mono uppercase tracking-wider " + (active ? "text-white/70" : "text-ink/50") }, d.label || d.dow),
    /* @__PURE__ */ React.createElement("span", { className: "serif text-[24px] leading-none" }, d.day),
    /* @__PURE__ */ React.createElement("span", { className: "text-[10.5px] mono " + (active ? "text-white/70" : "text-ink/50") }, d.month),
    /* @__PURE__ */ React.createElement(CapDot, { code: d.capCode })
  );
}
function SlotButton({ s, active, onClick, heat = 0 }) {
  if (s.taken) {
    return /* @__PURE__ */ React.createElement("div", { className: "h-11 rounded-xl border border-border bg-surface/60 text-ink/30 text-[13.5px] flex items-center justify-center mono line-through" }, s.id);
  }
  const heatCls = active ? "bg-accent text-white border-accent shadow-[0_6px_18px_-6px_rgba(230,57,70,0.6)]" : heat === 2 ? "bg-accent/[0.06] text-ink border-accent/55 hover:border-accent" : heat === 1 ? "bg-[#E0A23A]/[0.07] text-ink border-[#E0A23A]/55 hover:border-[#E0A23A]" : "bg-white text-ink border-border hover:border-ink/40";
  return /* @__PURE__ */ React.createElement(
    "button",
    {
      onClick,
      title: !active && heat === 2 ? "Az utols\xF3 p\xE1r hely" : !active && heat === 1 ? "T\xF6lt\u0151dik" : void 0,
      className: "relative h-11 rounded-xl border text-[13.5px] mono flex items-center justify-center transition active:scale-[0.97] " + heatCls
    },
    s.id,
    !active && heat > 0 && /* @__PURE__ */ React.createElement("span", { className: "absolute top-1 right-1 w-1.5 h-1.5 rounded-full", style: { background: heat === 2 ? "#E63946" : "#E0A23A" } })
  );
}
function buildDayLabel(iso, idx, T) {
  const date = /* @__PURE__ */ new Date(iso + "T12:00:00");
  return {
    iso,
    day: date.getDate(),
    month: T.mon[date.getMonth()],
    dow: T.dow[date.getDay()],
    isWeekend: date.getDay() === 0 || date.getDay() === 6,
    label: idx === 0 ? T.today : idx === 1 ? T.tomorrow : null
  };
}
function capCodeFromCount(n) {
  if (!n || n === 0) return 0;
  if (n < 5) return 1;
  if (n < 20) return 2;
  return 3;
}
function hashStr(str) {
  let h = 2166136261;
  for (let i = 0; i < str.length; i++) {
    h ^= str.charCodeAt(i);
    h = Math.imul(h, 16777619);
  }
  return (h >>> 0) % 1e4 / 1e4;
}
function slotHeat(dateISO, time, dayIndex, intensity) {
  if (!intensity || intensity <= 0) return 0;
  const hour = parseInt(time, 10);
  let w = 0.12;
  if (hour >= 11 && hour < 14) w += 0.3;
  if (hour >= 16 && hour < 19) w += 0.36;
  if (hour >= 7 && hour < 9) w += 0.08;
  if (dayIndex === 0) w += 0.26;
  else if (dayIndex === 1) w += 0.16;
  else if (dayIndex <= 3) w += 0.08;
  else if (dayIndex >= 10) w -= 0.12;
  const jitter = (hashStr(dateISO + time) - 0.5) * 0.4;
  const score = (w + jitter) * intensity;
  if (score > 0.58) return 2;
  if (score > 0.38) return 1;
  return 0;
}
function manufacturedDayCap(realCap, dateISO, dayIndex, intensity) {
  if (realCap === 0) return 0;
  if (!intensity || intensity <= 0) return realCap;
  const j = hashStr(dateISO + "|day");
  let level;
  if (dayIndex <= 1) level = j < 0.55 ? 1 : 2;
  else if (dayIndex <= 4) level = j < 0.4 ? 1 : j < 0.8 ? 2 : 3;
  else if (dayIndex <= 9) level = j < 0.3 ? 2 : 3;
  else level = 3;
  if (intensity < 0.5 && level < 3) level = level + 1;
  return level;
}
function isEmailLikelyValid(email) {
  return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(email || "").trim());
}
function pt(type, props) {
  try {
    if (window.plazmaTrack) window.plazmaTrack(type, props || {});
  } catch (e) {
  }
}
function pid(email, name, phone) {
  try {
    if (window.plazmaIdentify) window.plazmaIdentify(email, name, phone);
  } catch (e) {
  }
}
function pcScrollToEl(el, offset) {
  if (!el) return;
  var start = window.scrollY, dest = Math.round(start + el.getBoundingClientRect().top - (offset || 0)), dist = dest - start, t0 = performance.now(), dur = 480;
  var step = function(t) {
    var p = Math.min(1, (t - t0) / dur);
    window.scrollTo(0, start + dist * (0.5 - 0.5 * Math.cos(Math.PI * p)));
    if (p < 1) requestAnimationFrame(step);
  };
  requestAnimationFrame(step);
  setTimeout(function() {
    if (Math.abs(window.scrollY - dest) > 4) window.scrollTo(0, dest);
  }, 600);
}
if (typeof window !== "undefined") window.pcScrollToEl = pcScrollToEl;
var PLAZMA_PERSONA = window.PLAZMA_ANALYTICS && window.PLAZMA_ANALYTICS.persona || "landing";
var META_SOURCE = "landing_" + PLAZMA_PERSONA;
function pm(eventName, customData, eventId) {
  try {
    if (window.plazmaMeta) window.plazmaMeta.track(eventName, customData || {}, eventId);
  } catch (e) {
  }
}
function metaCD(centrumName, extra) {
  return Object.assign({ source: META_SOURCE, centrum: centrumName }, extra || {});
}
function Booking({ centrum, centrumKey, onCentrumChange, onSubmittedScroll, lang = "hu", source = "landing", urgency = 0.85 }) {
  const T = STRINGS[lang] || STRINGS.hu;
  const [state, dispatch] = useReducer(reducer, initial);
  const [days, setDays] = useState([]);
  const [loadingDays, setLoadingDays] = useState(true);
  const [daysError, setDaysError] = useState(null);
  const [slotsForSelected, setSlotsForSelected] = useState(null);
  const [loadingSlots, setLoadingSlots] = useState(false);
  const [slotsReloadKey, setSlotsReloadKey] = useState(0);
  const [exclusion, setExclusion] = useState(null);
  const [exclusionInfo, setExclusionInfo] = useState(null);
  const [emailStatus, setEmailStatus] = useState("idle");
  const lastExclusionEmailRef = useRefB({ value: "", site: "", date: "", ts: 0, fingerprint: "" });
  const [submitting, setSubmitting] = useState(false);
  const [submitError, setSubmitError] = useState(null);
  useEffectB(() => {
    let cancelled = false;
    setLoadingDays(true);
    setDaysError(null);
    setSlotsForSelected(null);
    setExclusion(null);
    setExclusionInfo(null);
    setEmailStatus("idle");
    window.bookingClient.fetchDayOverview(centrum.key).then((overview) => {
      if (cancelled) return;
      const now = /* @__PURE__ */ new Date();
      const built = overview.days.map((d, i) => {
        const base = buildDayLabel(d.date, i, T);
        let cnt = d.total_available;
        if (i === 0) {
          const nowHH = String(now.getHours()).padStart(2, "0") + ":" + String(now.getMinutes()).padStart(2, "0");
          cnt = (d.slots || []).filter((s) => s.start > nowHH).reduce((sum, s) => sum + (s.available || 0), 0);
        }
        const realCap = capCodeFromCount(cnt);
        return __spreadProps(__spreadValues({}, base), { capCode: manufacturedDayCap(realCap, d.date, i, urgency) });
      });
      setDays(built);
      const firstAvail = built.find((d) => d.capCode > 0);
      if (firstAvail) dispatch({ type: "PICK_DATE", iso: firstAvail.iso });
      setLoadingDays(false);
    }).catch((e) => {
      if (cancelled) return;
      console.error("fetchDayOverview failed:", e);
      setDaysError(T.calendarError);
      setLoadingDays(false);
    });
    return () => {
      cancelled = true;
    };
  }, [centrum.key, lang, urgency]);
  useEffectB(() => {
    pm("PageView - " + centrum.name, metaCD(centrum.name));
  }, [centrum.key]);
  useEffectB(() => {
    if (!state.selectedDate) {
      setSlotsForSelected(null);
      return;
    }
    let cancelled = false;
    setLoadingSlots(true);
    const attempt = (n) => {
      window.bookingClient.fetchSlotsForDay(centrum.key, state.selectedDate).then((res) => {
        if (cancelled) return;
        setSlotsForSelected(res);
        setLoadingSlots(false);
      }).catch((e) => {
        if (cancelled) return;
        if (n < 2) {
          setTimeout(() => {
            if (!cancelled) attempt(n + 1);
          }, 600 * (n + 1));
          return;
        }
        console.error("fetchSlotsForDay failed:", e);
        setSlotsForSelected({ ok: false, message: T.slotsError });
        setLoadingSlots(false);
      });
    };
    attempt(0);
    return () => {
      cancelled = true;
    };
  }, [centrum.key, state.selectedDate, slotsReloadKey]);
  useEffectB(() => {
    const email = state.form.email.trim();
    if (!email || !isEmailLikelyValid(email)) {
      setExclusion(null);
      setExclusionInfo(null);
      setEmailStatus("idle");
      return;
    }
    if (!state.selectedDate) return;
    setEmailStatus("checking");
    const timer = setTimeout(() => {
      const fingerprint = email + "|" + centrum.key + "|" + state.selectedDate;
      lastExclusionEmailRef.current = { value: email, site: centrum.key, date: state.selectedDate, ts: Date.now(), fingerprint };
      pid(email, state.form.name.trim() || null, state.form.phone.trim() || null);
      window.bookingClient.checkExclusion(centrum.key, state.selectedDate, email).then((res) => {
        const curFP = state.form.email.trim() + "|" + centrum.key + "|" + state.selectedDate;
        if (curFP !== fingerprint) return;
        if (!res.ok) {
          setExclusion(null);
          setExclusionInfo(null);
          setEmailStatus("error");
          return;
        }
        setExclusionInfo(res.info || null);
        if (res.excluded) {
          setExclusion(res);
          setEmailStatus("exclusion");
        } else {
          setExclusion(null);
          setEmailStatus("ok");
          if (state.selectedSlot && Array.isArray(res.data) && !res.data.includes(state.selectedSlot)) {
            dispatch({ type: "PICK_SLOT", id: null });
            setSubmitError(T.errSlotFull);
            setSlotsForSelected({ ok: true, data: res.data });
          }
        }
      }).catch((e) => {
        console.error("checkExclusion failed:", e);
        setEmailStatus("error");
      });
    }, 500);
    return () => clearTimeout(timer);
  }, [state.form.email, state.selectedDate, centrum.key]);
  const selectedDay = days.find((d) => d.iso === state.selectedDate);
  const selectedDayIndex = days.findIndex((d) => d.iso === state.selectedDate);
  const slots = slotsForSelected && slotsForSelected.ok && slotsForSelected.data ? slotsForSelected.data.map((t) => ({ id: t, taken: false })) : [];
  const slotDayMessage = slotsForSelected && !slotsForSelected.ok ? slotsForSelected.message : null;
  const valid = state.form.name.trim().length > 2 && isEmailLikelyValid(state.form.email) && /^[\d +()\-]{8,}$/.test(state.form.phone) && state.form.consent && state.selectedSlot && !exclusion && !submitting;
  const submit = async (e) => {
    e.preventDefault();
    if (!valid || submitting) return;
    setSubmitError(null);
    pt("submit", { centrum: centrum.key, date: state.selectedDate, slot: state.selectedSlot });
    pm("Id\u0151pontfoglal\xE1s - " + centrum.name, metaCD(centrum.name));
    const lastTs = lastExclusionEmailRef.current && lastExclusionEmailRef.current.ts;
    const isStale = !lastTs || Date.now() - lastTs > 60 * 1e3;
    if (isStale) {
      setSubmitting(true);
      try {
        const fresh = await window.bookingClient.checkExclusion(centrum.key, state.selectedDate, state.form.email.trim());
        if (!fresh.ok) {
          setSubmitError(T.errStale);
          setSubmitting(false);
          return;
        }
        if (fresh.excluded) {
          setExclusion(fresh);
          setEmailStatus("exclusion");
          setSubmitting(false);
          return;
        }
        if (!fresh.data.includes(state.selectedSlot)) {
          setSubmitError(T.errSlotFull);
          setSlotsForSelected({ ok: true, data: fresh.data });
          dispatch({ type: "PICK_SLOT", id: null });
          setSubmitting(false);
          return;
        }
        lastExclusionEmailRef.current.ts = Date.now();
      } catch (err) {
        setSubmitError(T.errNetwork);
        setSubmitting(false);
        return;
      }
    }
    setSubmitting(true);
    try {
      const metaEventId = window.plazmaMeta && window.plazmaMeta.newEventId() || null;
      const res = await window.bookingClient.createBooking({
        site: centrum.key,
        date: `${state.selectedDate}T${state.selectedSlot}`,
        name: state.form.name.trim(),
        email: state.form.email.trim(),
        phone: state.form.phone,
        consent: state.form.consent === true,
        source,
        lang,
        // Meta CAPI dedup + match-quality inputs
        eventId: metaEventId,
        fbp: window.plazmaMeta && window.plazmaMeta.fbp() || null,
        fbc: window.plazmaMeta && window.plazmaMeta.fbc() || null,
        persona: PLAZMA_PERSONA,
        pageUrl: typeof location !== "undefined" && location.href || "",
        userAgent: typeof navigator !== "undefined" && navigator.userAgent || ""
      });
      pid(state.form.email.trim(), state.form.name.trim() || null, state.form.phone.trim() || null);
      pt("booked", { centrum: centrum.key, date: state.selectedDate, slot: state.selectedSlot, source });
      try {
        const cd = metaCD(centrum.name, { appointment_id: res && res.appointmentId });
        const evs = res && res.metaEvents || [];
        if (evs.length) evs.forEach((ev) => pm(ev.name, cd, ev.eventId));
        else if (metaEventId) pm("Id\u0151pontfoglal\xE1s sikeres - " + centrum.name, cd, metaEventId);
      } catch (e2) {
      }
      dispatch({ type: "SUBMIT" });
      setTimeout(onSubmittedScroll, 60);
    } catch (err) {
      console.error("createBooking failed:", err);
      let msg;
      if (err.code === "SLOT_FULL") {
        msg = T.errSlotFull;
        window.bookingClient.invalidateCache(centrum.key, state.selectedDate);
        window.bookingClient.fetchSlotsForDay(centrum.key, state.selectedDate, { forceFresh: true }).then((r) => setSlotsForSelected(r));
        dispatch({ type: "PICK_SLOT", id: null });
      } else if (err.code === "DUPLICATE") {
        msg = T.errDuplicate;
      } else if (err.code === "EXCLUSION") {
        msg = T.errExclusion;
        if (err.detail) setExclusion(err.detail);
      } else if (err.field === "phone") {
        msg = T.errPhone;
      } else if (err.field === "email") {
        msg = T.errEmail;
      } else {
        msg = err.message || T.errGeneric;
      }
      setSubmitError(msg);
    } finally {
      setSubmitting(false);
    }
  };
  const loading = loadingDays;
  const loadError = daysError;
  if (state.isSubmitted) {
    return /* @__PURE__ */ React.createElement(Success, { centrum, date: selectedDay, slot: state.selectedSlot, T, onReset: () => dispatch({ type: "RESET" }) });
  }
  return /* @__PURE__ */ React.createElement("section", { id: "booking", className: "px-5 lg:px-12 pt-16 lg:pt-28 pb-8 lg:pb-12 overflow-x-hidden" }, /* @__PURE__ */ React.createElement("div", { className: "max-w-5xl mx-auto" }, /* @__PURE__ */ React.createElement("div", { className: "flex flex-col lg:flex-row lg:items-end lg:justify-between gap-4 lg:gap-6 mb-8 lg:mb-12" }, /* @__PURE__ */ React.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ React.createElement("div", { className: "mb-2 mono text-[11px] uppercase tracking-[0.2em] text-accent" }, T.eyebrow), /* @__PURE__ */ React.createElement("h2", { className: "serif text-[36px] sm:text-[44px] lg:text-[64px] leading-[0.98] text-ink", style: { letterSpacing: "-0.04em" } }, T.titleA, /* @__PURE__ */ React.createElement("em", null, T.titleEm))), /* @__PURE__ */ React.createElement("div", { className: "w-full lg:w-auto lg:text-right lg:max-w-sm min-w-0" }, /* @__PURE__ */ React.createElement("p", { className: "text-[12px] mono uppercase tracking-wider text-ink/55 mb-2" }, T.whichCentre), /* @__PURE__ */ React.createElement("div", { className: "grid grid-cols-3 gap-1 p-1 rounded-2xl border-2 border-ink bg-white w-full lg:inline-grid lg:w-auto" }, ["nyugati", "blaha", "baja"].map((k) => {
    const c = CENTRUMS[k];
    const active = centrumKey === k;
    return /* @__PURE__ */ React.createElement(
      "button",
      {
        key: k,
        onClick: () => onCentrumChange(k),
        className: "h-10 px-2 sm:px-3 rounded-xl text-[13px] font-medium flex items-center justify-center gap-1.5 transition min-w-0 " + (active ? "bg-ink text-white" : "text-ink/65 hover:text-ink hover:bg-cream")
      },
      /* @__PURE__ */ React.createElement(IPin, { size: 12 }),
      /* @__PURE__ */ React.createElement("span", { className: "truncate" }, c.name)
    );
  })), /* @__PURE__ */ React.createElement("p", { className: "text-[13px] lg:text-[14px] text-ink/60 mt-2 truncate" }, centrum.fullName, " \xB7 ", centrum.short))), /* @__PURE__ */ React.createElement("div", { className: "rounded-[28px] lg:rounded-[40px] border-2 border-ink bg-bg overflow-hidden" }, /* @__PURE__ */ React.createElement("div", { className: "grid grid-cols-1 lg:grid-cols-2" }, /* @__PURE__ */ React.createElement("div", { className: "p-5 lg:p-10 border-b-2 border-ink/10 lg:border-b-0 lg:border-r-2 bg-cream/40 min-w-0" }, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(StepHeader, { n: "01", label: T.step1 }), loading ? /* @__PURE__ */ React.createElement("div", { className: "mt-4 flex items-center gap-2 text-[13px] mono text-ink/55" }, /* @__PURE__ */ React.createElement(Spinner, null), " ", T.loadingTimes) : loadError ? /* @__PURE__ */ React.createElement("div", { className: "mt-4 rounded-xl bg-accent/10 border border-accent/30 text-accent text-[13px] p-3" }, loadError) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "mt-4 -mx-5 lg:-mx-10 px-5 lg:px-10 overflow-x-auto no-scrollbar" }, /* @__PURE__ */ React.createElement("div", { className: "flex gap-2 pb-1" }, days.map((d) => /* @__PURE__ */ React.createElement(DayPill, { key: d.iso, d, active: state.selectedDate === d.iso, onClick: () => dispatch({ type: "PICK_DATE", iso: d.iso }) })))), /* @__PURE__ */ React.createElement(Legend, { T }))), /* @__PURE__ */ React.createElement("div", { className: "mt-8" }, /* @__PURE__ */ React.createElement(StepHeader, { n: "02", label: selectedDay ? T.dayTitle(selectedDay) : T.pickDay }), loadingSlots ? /* @__PURE__ */ React.createElement("div", { className: "mt-4 flex items-center gap-2 text-[13px] mono text-ink/55" }, /* @__PURE__ */ React.createElement(Spinner, null), " ", T.loadingSlots) : slotDayMessage ? /* @__PURE__ */ React.createElement("div", { className: "mt-4 rounded-xl bg-surface border border-border text-ink/65 text-[13px] p-3" }, slotDayMessage, " ", /* @__PURE__ */ React.createElement("button", { onClick: () => setSlotsReloadKey((k) => k + 1), className: "font-medium text-accent underline underline-offset-2" }, T.retry)) : slots.length === 0 ? /* @__PURE__ */ React.createElement("div", { className: "mt-4 rounded-xl bg-surface border border-border text-ink/65 text-[13px] p-3" }, T.noFreeTimes) : /* @__PURE__ */ React.createElement("div", { className: "mt-4 grid grid-cols-3 lg:grid-cols-4 gap-2" }, slots.map((s) => /* @__PURE__ */ React.createElement(
    SlotButton,
    {
      key: s.id,
      s,
      active: state.selectedSlot === s.id,
      heat: slotHeat(state.selectedDate, s.id, selectedDayIndex, urgency),
      onClick: () => {
        dispatch({ type: "PICK_SLOT", id: s.id });
        pt("slot_select", { centrum: centrum.key, date: state.selectedDate, slot: s.id });
      }
    }
  ))), !state.selectedSlot && slots.length > 0 && /* @__PURE__ */ React.createElement("p", { className: "mt-3 text-[12.5px] text-ink/55 mono" }, T.slotNote), state.selectedSlot && selectedDay && /* @__PURE__ */ React.createElement("div", { className: "mt-3 inline-flex items-center gap-2 rounded-full bg-ink text-white px-3 py-1.5 mono text-[12px]" }, /* @__PURE__ */ React.createElement(ICheck, { size: 14 }), " ", T.dayTitle(selectedDay), " \xB7 ", state.selectedSlot))), /* @__PURE__ */ React.createElement("form", { onSubmit: submit, className: "p-5 lg:p-10 min-w-0" }, /* @__PURE__ */ React.createElement(StepHeader, { n: "03", label: T.step3 }), /* @__PURE__ */ React.createElement(
    ExclusionPanel,
    {
      exclusion,
      centrum,
      T,
      onTryAnotherCentrum: () => {
        window.pcScrollToEl(document.querySelector("#booking"), 64);
      },
      onSuggestedDate: (iso) => {
        const exists = days.some((d) => d.iso === iso);
        if (exists) {
          dispatch({ type: "PICK_DATE", iso });
          setExclusion(null);
          setEmailStatus("ok");
          window.pcScrollToEl(document.querySelector("#booking"), 64);
        } else {
          setSubmitError(T.exclSuggestOutside(formatDate(iso, lang)));
        }
      }
    }
  ), exclusionInfo && /* @__PURE__ */ React.createElement(ExclusionInfoNote, { info: exclusionInfo, T }), /* @__PURE__ */ React.createElement("div", { className: "mt-3 space-y-1" }, /* @__PURE__ */ React.createElement(Field, { id: "name", label: T.fieldName, value: state.form.name, onChange: (v) => dispatch({ type: "SET_FIELD", key: "name", value: v }) }), /* @__PURE__ */ React.createElement(
    Field,
    {
      id: "email",
      label: T.fieldEmail,
      value: state.form.email,
      onChange: (v) => dispatch({ type: "SET_FIELD", key: "email", value: v }),
      rightAdornment: emailStatus === "checking" ? /* @__PURE__ */ React.createElement("span", { className: "flex items-center gap-1 text-[11px] mono text-ink/55" }, /* @__PURE__ */ React.createElement(Spinner, null), " ", T.checking) : emailStatus === "ok" ? /* @__PURE__ */ React.createElement("span", { className: "text-[12px] text-success", "aria-label": "ok" }, "\u2713") : emailStatus === "exclusion" ? /* @__PURE__ */ React.createElement("span", { className: "text-[12px] text-accent" }, "\u26A0") : null
    }
  ), /* @__PURE__ */ React.createElement(Field, { id: "phone", label: T.fieldPhone, prefix: "+36", value: state.form.phone, onChange: (v) => dispatch({ type: "SET_FIELD", key: "phone", value: v }) })), /* @__PURE__ */ React.createElement("label", { className: "mt-6 flex items-start gap-3 cursor-pointer select-none" }, /* @__PURE__ */ React.createElement(
    "span",
    {
      onClick: (e) => {
        e.preventDefault();
        dispatch({ type: "SET_FIELD", key: "consent", value: !state.form.consent });
      },
      className: "mt-0.5 w-5 h-5 rounded-md border-2 flex items-center justify-center transition shrink-0 " + (state.form.consent ? "bg-ink border-ink text-white" : "bg-white border-ink/30 text-transparent")
    },
    /* @__PURE__ */ React.createElement(ICheck, { size: 14 })
  ), /* @__PURE__ */ React.createElement("span", { className: "text-[13px] text-ink/70 leading-[1.5]" }, T.consentPre, /* @__PURE__ */ React.createElement("a", { href: "https://plazmacentrum.hu/felhasznalasi-feltetelek", target: "_blank", rel: "noopener noreferrer", className: "underline underline-offset-2" }, T.consentTerms), T.consentMid, /* @__PURE__ */ React.createElement("a", { href: "https://plazmacentrum.hu/adatvedelmi-nyilatkozat", target: "_blank", rel: "noopener noreferrer", className: "underline underline-offset-2" }, T.consentPrivacy), T.consentPost)), (() => {
    const filledRequired = (state.form.name.trim().length > 2 ? 1 : 0) + (/^[\d +()\-]{8,}$/.test(state.form.phone) ? 1 : 0) + (state.selectedSlot ? 1 : 0);
    const consentOk = state.form.consent;
    const progressMsg = !consentOk && filledRequired === 3 ? T.pNeedConsent : filledRequired === 0 ? T.p0 : filledRequired === 1 ? T.p1 : filledRequired === 2 ? T.p2 : valid ? T.pValid : T.pConsentLeft;
    return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", { className: "mt-6 text-[12px] mono text-ink/55 text-center transition-all" }, submitting ? T.bookingInProgress : progressMsg), /* @__PURE__ */ React.createElement(
      "button",
      {
        type: "submit",
        disabled: !valid || submitting,
        className: "mt-2 w-full h-14 rounded-2xl text-[16px] font-medium flex items-center justify-center gap-2 transition " + (submitting ? "bg-ink text-white cursor-wait" : valid ? "bg-accent text-white active:scale-[0.97] hover:scale-[1.02] shadow-[0_14px_30px_-12px_rgba(230,57,70,0.7)]" : "bg-surface text-ink/40 border border-border cursor-not-allowed")
      },
      submitting ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Spinner, null), " ", T.booking) : valid ? /* @__PURE__ */ React.createElement(React.Fragment, null, T.submitCta, " ", /* @__PURE__ */ React.createElement(IArrow, { size: 18 })) : T.submitFill
    ), submitError && /* @__PURE__ */ React.createElement("div", { className: "mt-3 rounded-xl bg-accent/10 border border-accent/30 text-accent text-[13px] p-3 text-center" }, submitError));
  })(), /* @__PURE__ */ React.createElement("p", { className: "mt-3 text-[12px] text-ink/45 text-center mono" }, T.noSpam))))));
}
function Spinner() {
  return /* @__PURE__ */ React.createElement("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", "aria-hidden": true, style: { animation: "spin 0.8s linear infinite" } }, /* @__PURE__ */ React.createElement("circle", { cx: "12", cy: "12", r: "9", stroke: "currentColor", strokeOpacity: "0.25", strokeWidth: "3" }), /* @__PURE__ */ React.createElement("path", { d: "M12 3a9 9 0 0 1 9 9", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round" }));
}
function addDaysIso(dateStr, daysAfter = 1) {
  const d = /* @__PURE__ */ new Date(String(dateStr).slice(0, 10) + "T00:00:00");
  if (isNaN(d.getTime())) return null;
  d.setDate(d.getDate() + daysAfter);
  return d.getFullYear() + "-" + String(d.getMonth() + 1).padStart(2, "0") + "-" + String(d.getDate()).padStart(2, "0");
}
function ExclusionPanel({ exclusion, centrum, T, onTryAnotherCentrum, onSuggestedDate }) {
  if (!exclusion || !exclusion.excluded) return null;
  const { reason, detail } = exclusion;
  const lang = T === STRINGS.en ? "en" : "hu";
  let title, body, primary, secondary;
  switch (reason) {
    case "currently": {
      const until = detail && (detail.excluded_until || detail.ending_date || detail.until || detail.end_date);
      const nextIso = until ? addDaysIso(until, 1) : null;
      title = T.exclCurrentlyTitle;
      body = until ? T.exclCurrentlyUntil(formatDate(until, lang)) : T.exclCurrentlyNoDate;
      primary = nextIso && onSuggestedDate ? { kind: "suggest", label: T.exclSuggestLabel(formatDate(nextIso, lang)), target: nextIso } : { kind: "call", label: T.exclCallLabel(centrum.short), href: "tel:" + centrum.phone.replace(/\s/g, "") };
      secondary = onTryAnotherCentrum ? { kind: "centrum" } : null;
      break;
    }
    case "permanently": {
      title = T.exclPermTitle;
      body = T.exclPermBody;
      primary = { kind: "call", label: T.exclCallLabel(centrum.short), href: "tel:" + centrum.phone.replace(/\s/g, "") };
      secondary = onTryAnotherCentrum ? { kind: "centrum" } : null;
      break;
    }
    case "cancellation": {
      title = T.exclCancelTitle;
      body = T.exclCancelBody;
      primary = { kind: "call", label: T.exclCallLabel(centrum.short), href: "tel:" + centrum.phone.replace(/\s/g, "") };
      secondary = onTryAnotherCentrum ? { kind: "centrum" } : null;
      break;
    }
    default: {
      title = T.exclDefaultTitle;
      body = T.exclDefaultBody;
      primary = { kind: "call", label: T.exclCallLabel(centrum.short), href: "tel:" + centrum.phone.replace(/\s/g, "") };
      secondary = onTryAnotherCentrum ? { kind: "centrum" } : null;
    }
  }
  return /* @__PURE__ */ React.createElement("div", { className: "mt-4 rounded-2xl border-2 border-accent/40 bg-accent/[0.04] p-4 lg:p-5", role: "alert" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-start gap-3" }, /* @__PURE__ */ React.createElement("div", { className: "shrink-0 w-8 h-8 rounded-full bg-accent text-white flex items-center justify-center text-[16px]", "aria-hidden": true }, "!"), /* @__PURE__ */ React.createElement("div", { className: "flex-1 min-w-0" }, /* @__PURE__ */ React.createElement("div", { className: "serif text-[18px] lg:text-[20px] text-ink leading-tight" }, title), /* @__PURE__ */ React.createElement("p", { className: "mt-1 text-[13.5px] text-ink/75 leading-relaxed" }, body), /* @__PURE__ */ React.createElement("div", { className: "mt-3 flex flex-wrap gap-2" }, primary.kind === "suggest" ? /* @__PURE__ */ React.createElement("button", { type: "button", onClick: () => onSuggestedDate(primary.target), className: "inline-flex items-center gap-1.5 h-9 px-3 rounded-lg bg-accent text-white text-[13px] font-medium hover:bg-accent/90 transition" }, primary.label) : /* @__PURE__ */ React.createElement("a", { href: primary.href, className: "inline-flex items-center gap-1.5 h-9 px-3 rounded-lg bg-accent text-white text-[13px] font-medium hover:bg-accent/90 transition" }, primary.label), secondary && secondary.kind === "centrum" && /* @__PURE__ */ React.createElement("button", { type: "button", onClick: onTryAnotherCentrum, className: "inline-flex items-center gap-1.5 h-9 px-3 rounded-lg bg-white border border-border text-ink text-[13px] font-medium hover:border-ink/40 transition" }, T.exclAnotherCentre)))));
}
function ExclusionInfoNote({ info, T }) {
  if (!info) return null;
  if (info.kind !== "no_bloodtest") return null;
  return /* @__PURE__ */ React.createElement("div", { className: "mt-4 rounded-2xl border border-butter bg-butter/40 p-4 lg:p-5", role: "status" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-start gap-3" }, /* @__PURE__ */ React.createElement("div", { className: "shrink-0 w-7 h-7 rounded-full bg-ink/10 text-ink flex items-center justify-center text-[14px]", "aria-hidden": true }, "\u2139"), /* @__PURE__ */ React.createElement("div", { className: "flex-1 min-w-0" }, /* @__PURE__ */ React.createElement("div", { className: "text-[14px] font-semibold text-ink" }, T.noBloodTitle), /* @__PURE__ */ React.createElement("p", { className: "mt-1 text-[12.5px] text-ink/70 leading-relaxed" }, T.noBloodBody))));
}
function formatDate(d, lang = "hu") {
  if (!d) return "";
  const parts = String(d).slice(0, 10).split("-");
  if (parts.length !== 3) return String(d);
  const m = parseInt(parts[1], 10);
  const day = parseInt(parts[2], 10);
  if (lang === "en") {
    const months2 = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
    return `${day} ${months2[m - 1]} ${parts[0]}`;
  }
  const months = ["jan", "feb", "m\xE1rc", "\xE1pr", "m\xE1j", "j\xFAn", "j\xFAl", "aug", "szept", "okt", "nov", "dec"];
  return `${parts[0]}. ${months[m - 1]}. ${day}.`;
}
function StepHeader({ n, label }) {
  return /* @__PURE__ */ React.createElement("div", { className: "flex items-baseline justify-between" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-baseline gap-3" }, /* @__PURE__ */ React.createElement("span", { className: "serif text-[22px] text-ink/30" }, n), /* @__PURE__ */ React.createElement("span", { className: "text-[15px] font-medium text-ink" }, label)));
}
function Field({ id, label, value, onChange, prefix, rightAdornment }) {
  return /* @__PURE__ */ React.createElement("div", { className: "field", style: { minWidth: 0 } }, /* @__PURE__ */ React.createElement("div", { className: "flex items-baseline gap-2 pt-1", style: { minWidth: 0 } }, prefix && /* @__PURE__ */ React.createElement("span", { className: "mono text-[15px] text-ink/55 pt-[22px] shrink-0" }, prefix), /* @__PURE__ */ React.createElement("input", { id, placeholder: " ", value, onChange: (e) => onChange(e.target.value), autoComplete: "off", style: { flex: "1 1 0", minWidth: 0, width: 0 } }), rightAdornment && /* @__PURE__ */ React.createElement("span", { className: "pt-[22px] pr-1 shrink-0" }, rightAdornment)), /* @__PURE__ */ React.createElement("label", { htmlFor: id, style: prefix ? { left: 38 } : null }, label));
}
function Legend({ T }) {
  return /* @__PURE__ */ React.createElement("div", { className: "mt-3 flex items-center gap-3 text-[11.5px] text-ink/50 mono" }, /* @__PURE__ */ React.createElement("span", { className: "flex items-center gap-1.5" }, /* @__PURE__ */ React.createElement(CapDot, { code: 3 }), T.legend.many), /* @__PURE__ */ React.createElement("span", { className: "flex items-center gap-1.5" }, /* @__PURE__ */ React.createElement(CapDot, { code: 2 }), T.legend.some), /* @__PURE__ */ React.createElement("span", { className: "flex items-center gap-1.5" }, /* @__PURE__ */ React.createElement(CapDot, { code: 1 }), T.legend.few), /* @__PURE__ */ React.createElement("span", { className: "flex items-center gap-1.5" }, /* @__PURE__ */ React.createElement(CapDot, { code: 0 }), T.legend.full));
}
function Success({ centrum, date, slot, onReset, T }) {
  return /* @__PURE__ */ React.createElement("section", { id: "booking", className: "px-5 pt-10 pb-8" }, /* @__PURE__ */ React.createElement("div", { className: "rounded-3xl border border-border bg-white p-6 overflow-hidden relative" }, /* @__PURE__ */ React.createElement("div", { className: "mx-auto w-20 h-20 rounded-full bg-success/10 flex items-center justify-center ring-in" }, /* @__PURE__ */ React.createElement("svg", { width: "44", height: "44", viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ React.createElement("path", { className: "check-path", d: "m5 12 4 4 10-10", stroke: "#00C896", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round" }))), /* @__PURE__ */ React.createElement("h2", { className: "mt-5 serif text-[40px] leading-[1] text-ink text-center", style: { letterSpacing: "-0.03em" } }, T.successTitleA, /* @__PURE__ */ React.createElement("em", null, T.successTitleEm)), /* @__PURE__ */ React.createElement("p", { className: "mt-2 text-center text-[14px] text-ink/60" }, T.successSub), /* @__PURE__ */ React.createElement("div", { className: "mt-6 rounded-2xl bg-surface border border-border divide-y divide-border" }, /* @__PURE__ */ React.createElement(Row, { k: T.rowCentre, v: centrum.fullName, sub: centrum.address }), /* @__PURE__ */ React.createElement(Row, { k: T.rowTime, v: `${date ? T.dayTitle(date) : ""} \xB7 ${slot}`, sub: T.timeSub }), /* @__PURE__ */ React.createElement(Row, { k: T.rowBring, v: T.bringVal, sub: T.bringSub }), /* @__PURE__ */ React.createElement(Row, { k: T.rowPay, v: T.payVal, sub: T.paySub })), /* @__PURE__ */ React.createElement("div", { className: "mt-5 grid grid-cols-2 gap-2" }, /* @__PURE__ */ React.createElement("button", { onClick: () => {
    try {
      var iso = date && date.iso || "";
      var p = iso.split("-"), tp = String(slot).split(":");
      var dts = p[0] + p[1] + p[2] + "T" + tp[0] + tp[1] + "00";
      var eh = ("0" + (parseInt(tp[0], 10) + 1) % 24).slice(-2);
      var dte = p[0] + p[1] + p[2] + "T" + eh + tp[1] + "00";
      var ics = ["BEGIN:VCALENDAR", "VERSION:2.0", "PRODID:-//plazmacentrum//hu", "BEGIN:VEVENT", "UID:" + iso + slot + "@plazmacentrum.hu", "DTSTART:" + dts, "DTEND:" + dte, "SUMMARY:Plazmacentrum id\u0151pont \u2014 " + centrum.name, "LOCATION:" + (centrum.address || ""), "END:VEVENT", "END:VCALENDAR"].join("\r\n");
      var b = new Blob([ics], { type: "text/calendar" });
      var u = URL.createObjectURL(b);
      var a = document.createElement("a");
      a.href = u;
      a.download = "plazmacentrum.ics";
      document.body.appendChild(a);
      a.click();
      a.remove();
      URL.revokeObjectURL(u);
    } catch (e) {
    }
  }, className: "h-12 rounded-xl border border-border bg-white text-[13.5px] font-medium text-ink flex items-center justify-center gap-2" }, /* @__PURE__ */ React.createElement(ICalendar, { size: 16 }), T.addCal), /* @__PURE__ */ React.createElement("button", { onClick: () => {
    try {
      var url = location.origin + "/";
      var txt = "Lefoglaltam egy plazmaad\xE1s id\u0151pontot a Plazmacentrumban.";
      if (navigator.share) {
        navigator.share({ title: "Plazmacentrum", text: txt, url }).catch(function() {
        });
      } else if (navigator.clipboard) {
        navigator.clipboard.writeText(url);
      }
    } catch (e) {
    }
  }, className: "h-12 rounded-xl border border-border bg-white text-[13.5px] font-medium text-ink flex items-center justify-center gap-2" }, /* @__PURE__ */ React.createElement(IShare, { size: 16 }), T.share)), /* @__PURE__ */ React.createElement("div", { className: "mt-5 text-center" }, /* @__PURE__ */ React.createElement("button", { onClick: onReset, className: "text-[13px] text-ink/55 underline underline-offset-4" }, T.bookAnother))));
}
function Row({ k, v, sub }) {
  return /* @__PURE__ */ React.createElement("div", { className: "px-4 py-3 flex items-start justify-between gap-3" }, /* @__PURE__ */ React.createElement("div", { className: "mono text-[11px] uppercase tracking-wider text-ink/50 pt-1 w-24 shrink-0" }, k), /* @__PURE__ */ React.createElement("div", { className: "text-right flex-1 min-w-0" }, /* @__PURE__ */ React.createElement("div", { className: "text-[14.5px] text-ink" }, v), sub && /* @__PURE__ */ React.createElement("div", { className: "text-[12px] text-ink/50 mt-0.5" }, sub)));
}
window.Booking = Booking;
