1import { r as e } from "./rolldown-runtime-Dqa2HsxW.js"; 2import { Cn as t, Dn as n, En as r, Gt as i, Ht as a, It as o, J as s, Jt as c, T as l, W as u, Xt as d, at as f, b as p, c as m, cn as h, dn as g, gn as _, hn as v, ln as y, m as b, mt as x, q as S, ut as C, vn as ee, xn as te } from "./production-B5T1gI_V.js"; 3import { p as ne, u as re } from "./react-vendor-Bdfp_iIw.js"; 4import { J as w, Jn as ie, R as T, _t as ae, ft as E, ht as oe } from "./vendor-2uMsIiC0.js"; 5import { i as se, n as D, r as O, t as ce } from "./shared-spAGKbqP.js"; 6//#region src/components/booking/skipass/types.ts 7var k = /* @__PURE__ */ e(ne()), A = re(), j = /* @__PURE__ */ function(e) { 8 return e[e.New = 1] = "New", e[e.QR = 2] = "QR", e[e.Existing = 3] = "Existing", e; 9}({}), M = (e) => e.replace(/[^0-9]/g, ""), le = (e) => { 10 let t = M(e).slice(0, 23); 11 return { 12 chipId: t.slice(0, 2), 13 serialNumber: t.slice(2, 22), 14 luhnNumber: t.slice(22) 15 }; 16}, N = (e) => (e.match(/.{1,4}/g) ?? []).join(" "), P = (e) => { 17 let { chipId: t, serialNumber: n, luhnNumber: r } = le(M(e).slice(0, 23)), i = []; 18 return t && i.push(t), n && i.push(N(n)), r && i.push(r), i.join(" "); 19}, ue = ({ searchFlow: e, dates: r, selection: i, onDateClick: a, onMonthNavigation: o, productOptions: s, selectedProductKey: c, selectedProductName: l, onProductSelect: u }) => { 20 let { t: p } = _("booking"), { formatDate: m } = v(), h = t(), [g, y] = (0, k.useState)(!1), [b, x] = (0, k.useState)(!1), S = r.length !== 0 && /* @__PURE__ */ (0, A.jsx)(d, { 21 displayMonths: 1, 22 showWeekNumbers: e.showWeekNo, 23 startDayOfWeek: e.startDayOfWeek, 24 uiMode: "bookable", 25 bookingMode: "activity", 26 dates: r, 27 selection: i, 28 onDateClick: (e, t) => { 29 t.hasCapacity && !t.fullyBooked && y(!1), a(e, t); 30 }, 31 embedded: !0, 32 loading: !1, 33 onNavigate: o, 34 className: "tc:p-content" 35 }); 36 return /* @__PURE__ */ (0, A.jsxs)(A.Fragment, { children: [/* @__PURE__ */ (0, A.jsxs)("div", { 37 className: "tc:grid tc:grid-cols-1 tc:lg:grid-cols-2 tc:gap-2", 38 children: [h ? /* @__PURE__ */ (0, A.jsx)(f, { 39 mode: "content", 40 defaultLabel: p("skipass.selectDate"), 41 label: p("skipass.firstDay"), 42 icon: "Calendar", 43 selectedValue: i.from ? m(i.from) : null, 44 onSelect: () => {}, 45 disabled: r.length === 0, 46 onClick: () => {}, 47 onToggle: () => y((e) => !e), 48 dark: !0, 49 toggleLabel: i.from ? p("common.changeDate.title") : void 0, 50 children: g ? S : void 0 51 }) : /* @__PURE__ */ (0, A.jsxs)("div", { 52 className: "tc:relative", 53 children: [/* @__PURE__ */ (0, A.jsx)(f, { 54 mode: "action", 55 defaultLabel: p("skipass.selectDate"), 56 label: p("skipass.firstDay"), 57 icon: "Calendar", 58 selectedValue: i.from ? m(i.from) : null, 59 onSelect: () => {}, 60 disabled: r.length === 0, 61 onClick: () => y((e) => !e), 62 toggleLabel: i.from ? p("common.changeDate.title") : void 0 63 }), g && /* @__PURE__ */ (0, A.jsx)("div", { 64 className: "tc:absolute tc:z-100 tc:left-0 tc:right-0 tc:mt-1 tc:bg-background tc:border tc:border-content-border tc:rounded-lg tc:shadow-md tc:overflow-hidden", 65 children: S 66 })] 67 }), s.length > 0 && (h ? /* @__PURE__ */ (0, A.jsx)(f, { 68 mode: "action", 69 defaultLabel: p("skipass.selectTicketType"), 70 label: p("skipass.ticketType"), 71 icon: "Clock", 72 selectedValue: l, 73 onSelect: () => {}, 74 disabled: s.length === 0, 75 onClick: () => x(!0), 76 dark: !0 77 }) : /* @__PURE__ */ (0, A.jsx)(f, { 78 mode: "select", 79 options: s, 80 defaultLabel: p("skipass.selectTicketType"), 81 label: p("skipass.ticketType"), 82 icon: "Clock", 83 selectedValue: c, 84 onSelect: u, 85 disabled: s.length === 0, 86 onClick: () => {} 87 }))] 88 }
88), /* @__PURE__ */ (0, A.jsx)(n, { 89 isOpen: b, 90 onClose: () => x(!1), 91 title: p("skipass.selectTicketType"), 92 size: "sm", 93 position: "middle-top", 94 content: /* @__PURE__ */ (0, A.jsx)("div", { 95 className: "tc:divide-y tc:divide-content-border", 96 children: s.map((e) => { 97 let t = c === e.value; 98 return /* @__PURE__ */ (0, A.jsxs)("button", { 99 type: "button", 100 className: `tc:w-full tc:flex tc:items-center tc:justify-between tc:gap-3 tc:px-3 tc:py-3 tc:text-left tc:hover:bg-white-hover tc:cursor-pointer ${t ? "tc:bg-primary-50" : ""}`, 101 onClick: () => { 102 x(!1), u(e.value); 103 }, 104 children: [/* @__PURE__ */ (0, A.jsx)("span", { 105 className: `${t ? "tc:font-medium" : ""}`, 106 children: e.label 107 }), t && /* @__PURE__ */ (0, A.jsx)(ie, { 108 size: 18, 109 className: "tc:text-primary-800" 110 })] 111 }, e.value); 112 }) 113 }) 114 })] }); 115}, F = "tc:h-fit tc:self-start", de = ({ bookedPaxList: e, claimedBookedPaxIds: t, paxStates: n, productPartPriceByKey: r, keyCardPrice: i, selectedProductName: a, canAddPax: o, bookedItemsByPaxId: s, fromDateLabel: c, portraitRequired: l, invalidPaxIndices: u, onAddPax: d, onAttachExistingPax: f, onDetachExistingPax: p, onEditPax: m, onRemovePax: h }) => { 116 let { t: g } = _("booking"), v = (0, k.useMemo)(() => n.map((e, t) => ({ 117 pax: e, 118 originalIndex: t 119 })).filter(({ pax: e }) => e.selectedBookPaxId <= 0), [n]), y = (0, k.useMemo)(() => { 120 let e = {}; 121 for (let t of n) t.selectedBookPaxId > 0 && (e[t.selectedBookPaxId] = t); 122 return e; 123 }, [n]); 124 return /* @__PURE__ */ (0, A.jsxs)("div", { 125 className: "tc:grid tc:grid-cols-1 tc:lg:grid-cols-3 tc:gap-3", 126 children: [ 127 e.map((e, n) => { 128 let r = `${e.firstName ?? ""} ${e.lastName ?? ""}`.trim(), i = t.has(e.paxId), o = y[e.paxId], d = o !== void 0 && u.has(o.index); 129 return /* @__PURE__ */ (0, A.jsx)(B, { 130 slotIndex: n + 1, 131 fullName: r, 132 isSelected: i, 133 isInvalid: d, 134 bookedItems: s[e.paxId] ?? [], 135 currentItemName: i ? a : null, 136 currentItemDateLabel: c, 137 portraitRequired: l, 138 hasPortrait: o ? o.portraitFile !== null : !1, 139 onToggle: () => { 140 i ? p(e.paxId) : f(e.paxId); 141 }, 142 onEdit: o ? () => m(o.index) : null 143 }, `booked-${e.paxId}`); 144 }), 145 v.map(({ pax: e, originalIndex: t }) => { 146 let n = r[e.pppKey]; 147 return /* @__PURE__ */ (0, A.jsx)(V, { 148 pax: e, 149 ticketName: n?.description ?? "", 150 ticketPrice: n?.price ?? 0, 151 keyCardPrice: i, 152 portraitRequired: l, 153 isInvalid: u.has(t), 154 currentItemName: a, 155 currentItemDateLabel: c, 156 onEdit: () => m(t), 157 onRemove: () => h(t) 158 }, `session-${e.index}`); 159 }),
160 o && /* @__PURE__ */ (0, A.jsxs)("button", { 161 type: "button", 162 onClick: d, 163 className: `tc:group tc:flex tc:flex-col tc:gap-1 tc:border tc:border-content-border tc:rounded-lg tc:px-container tc:py-3 tc:text-left tc:transition-colors tc:cursor-pointer tc:bg-content-50 tc:hover:border-primary-800 tc:hover:bg-content-100 ${F}`, 164 children: [/* @__PURE__ */ (0, A.jsxs)("div", { 165 className: "tc:flex tc:items-center tc:justify-between tc:gap-3", 166 children: [/* @__PURE__ */ (0, A.jsx)("span", { 167 className: "tc:font-medium tc:text-text-900 tc:truncate tc:group-hover:text-primary-800", 168 children: g("skipass.newPax.addButton") 169 }), /* @__PURE__ */ (0, A.jsx)("div", { 170 className: "tc:flex tc:items-center tc:justify-center tc:shrink-0 tc:text-text-500 tc:transition-colors tc:group-hover:text-primary-800", 171 "aria-hidden": !0, 172 children: /* @__PURE__ */ (0, A.jsx)(oe, { size: 24 }) 173 })] 174 }), /* @__PURE__ */ (0, A.jsx)("span", { 175 className: "tc:text-xs tc:text-text-500", 176 children: g("skipass.newPax.requiredHint") 177 })] 178 }) 179 ] 180 }); 181}, I = "tc:w-full tc:h-full tc:text-left tc:border tc:rounded-lg tc:p-container tc:space-y-2 tc:transition-colors tc:flex tc:flex-col", L = "tc:border-primary-800 tc:bg-content-50", R = "tc:border-content-border tc:bg-content-50 tc:hover:border-primary-200 tc:hover:bg-content-100", fe = "tc:border-error tc:bg-error-background", z = "tc:text-error", B = ({ slotIndex: e, fullName: n, isSelected: r, isInvalid: i, bookedItems: a, currentItemName: o, currentItemDateLabel: s, portraitRequired: c, hasPortrait: l, onToggle: u, onEdit: d }) => { 182 let { t: f } = _("booking"), p = t(), m = n === "" ? f("skipass.guest") : n, g = r ? ae : E, v = r ? "tc:text-primary-800" : "tc:text-text-500", y = r ? L : R; 183 i && (y = fe, v = "tc:text-error"); 184 let b = O(a, o !== null && o !== "" ? { 185 name: o, 186 dateLabel: s 187 } : null), x = (e) => { 188 e.stopPropagation(); 189 }; 190 return /* @__PURE__ */ (0, A.jsxs)("div", { 191 role: "button", 192 tabIndex: 0, 193 onClick: u, 194 onKeyDown: (e) => { 195 e.key !== "Enter" && e.key !== " " || (e.preventDefault(), u()); 196 }, 197 "aria-pressed": r, 198 className: `${I} ${y} tc:cursor-pointer tc:hover:bg-content-100`, 199 children: [ 200 /* @__PURE__ */ (0, A.jsxs)("div", { 201 className: "tc:flex tc:items-center tc:justify-between tc:gap-3", 202 children: [/* @__PURE__ */ (0, A.jsxs)("div", { 203 className: "tc:flex tc:items-center tc:gap-3 tc:min-w-0 tc:flex-1", 204 children: [/* @__PURE__ */ (0, A.jsx)("div", { 205 className: "tc:flex tc:items-center tc:justify-center tc:h-10 tc:w-10 tc:rounded-md tc:bg-content-200 tc:text-primary-800 tc:text-lg tc:font-semibold tc:shrink-0", 206 children: e 207 }), /* @__PURE__ */ (0, A.jsx)("div", { 208 className: "tc:min-w-0", 209 children: /* @__PURE__ */ (0, A.jsxs)("div", { 210 className: "tc:flex tc:items-center tc:gap-2 tc:min-w-0", 211 children: [/* @__PURE__ */ (0, A.jsx)("div", { 212 className: `tc:font-semibold tc:truncate ${i ? z : "tc:text-text-900"}`, 213 children: m 214 }), /* @__PURE__ */ (0, A.jsx)("span", { 215 className: "tc:inline-flex tc:items-center tc:px-2 tc:py-0.5 tc:text-xs tc:font-medium tc:rounded-full tc:bg-primary-50 tc:text-primary-800 tc:shrink-0", 216 children: f("skipass.existingGuests.fromBooking") 217 })] 218 }) 219 })] 220 }), /* @__PURE__ */ (0, A.jsxs)("div", { 221 className: "tc:flex tc:items-center tc:gap-1 tc:shrink-0", 222 children: [r && d !== null && /* @__PURE__ */ (0, A.jsx)("span", { 223 onClick: x, 224 onKeyDown: x, 225 className: "tc:inline-flex", 226 children: /* @__PURE__ */ (0, A.jsx)(h, { 227 icon: "SquarePen", 228 text: p ? void 0 : f("skipass.editGuest.short"), 229 title: f("skipass.editGuest"), 230 onClick: d, 231 size: "sm" 232 }) 233 }), /* @__PURE__ */ (0, A.jsx)("div", { 234 className: `tc:flex tc:items-center tc:justify-center tc:shrink-0 tc:p-1 ${v}`, 235 "aria-hidden": !0, 236 children: /* @__PURE__ */ (0, A.jsx)(g, { size: 24 }) 237 })] 238 })] 239 }), 240 /* @__PURE__ */ (0, A.jsx)(D, { items: b }),
241 r && c && !l && /* @__PURE__ */ (0, A.jsx)("div", { 242 className: `tc:text-xs ${i ? z : "tc:text-text-500"}`, 243 children: f("skipass.portrait.missingHint") 244 }), 245 i && /* @__PURE__ */ (0, A.jsx)("div", { 246 className: "tc:text-xs tc:text-error", 247 children: f("skipass.invalid.summary") 248 }) 249 ] 250 }); 251}, V = ({ pax: e, ticketName: t, ticketPrice: n, keyCardPrice: r, portraitRequired: i, isInvalid: a, currentItemName: o, currentItemDateLabel: s, onEdit: c, onRemove: l }) => { 252 let { t: u } = _("booking"), { formatPrice: d } = v(), f = `${e.firstName} ${e.lastName}`.trim(), p = f === "" ? t === "" ? u("skipass.guest") : t : f, m = f !== "", g = n + (e.keyCardOption === j.New ? r : 0), y = f === "", b = i && e.portraitFile === null, x = a ? fe : L, S = O([], o !== null && o !== "" ? { 253 name: o, 254 dateLabel: s 255 } : null); 256 return /* @__PURE__ */ (0, A.jsxs)("div", { 257 className: `${I} ${x}`, 258 children: [ 259 /* @__PURE__ */ (0, A.jsxs)("div", { 260 className: "tc:flex tc:items-center tc:justify-between tc:gap-3", 261 children: [/* @__PURE__ */ (0, A.jsx)("div", { 262 className: "tc:flex tc:items-center tc:gap-3 tc:min-w-0", 263 children: /* @__PURE__ */ (0, A.jsx)("div", { 264 className: "tc:min-w-0", 265 children: /* @__PURE__ */ (0, A.jsx)("div", { 266 className: `tc:font-semibold tc:truncate ${a ? z : "tc:text-text-900"}`, 267 children: p 268 }) 269 }) 270 }), /* @__PURE__ */ (0, A.jsxs)("div", { 271 className: "tc:flex tc:items-center tc:gap-1 tc:shrink-0", 272 children: [/* @__PURE__ */ (0, A.jsx)(h, { 273 icon: "SquarePen", 274 text: u(m ? "skipass.editGuest.short" : "skipass.fillInDetails"), 275 title: u(m ? "skipass.editGuest" : "skipass.fillInDetails"), 276 onClick: c, 277 size: "sm" 278 }), /* @__PURE__ */ (0, A.jsx)(h, { 279 icon: "Trash2", 280 title: u("skipass.removeGuest"), 281 onClick: l, 282 size: "sm" 283 })] 284 })] 285 }), 286 /* @__PURE__ */ (0, A.jsx)(D, { items: S }), 287 /* @__PURE__ */ (0, A.jsxs)("div", { 288 className: "tc:flex tc:items-center tc:justify-between tc:gap-2", 289 children: [/* @__PURE__ */ (0, A.jsx)("span", { 290 className: `tc:text-sm ${a ? z : "tc:text-text-500"}`, 291 children: u("skipass.price") 292 }), /* @__PURE__ */ (0, A.jsx)("span", { 293 className: "tc:font-semibold", 294 children: d(g) 295 })] 296 }), 297 a && y && /* @__PURE__ */ (0, A.jsx)("div", { 298 className: "tc:text-xs tc:text-error", 299 children: u("skipass.invalid.missingName") 300 }), 301 b && /* @__PURE__ */ (0, A.jsx)("div", { 302 className: `tc:text-xs ${a ? z : "tc:text-warning-800"}`, 303 children: u("skipass.portrait.missingHint") 304 }), 305 e.portraitError !== null && /* @__PURE__ */ (0, A.jsx)("div", { 306 className: "tc:text-xs tc:text-error", 307 children: e.portraitError 308 }) 309 ] 310 }); 311}, pe = ({ productPartPrices: e, onSelect: t, onClose: r }) => { 312 let { t: i } = _("booking"), { formatPrice: a } = v(); 313 return /* @__PURE__ */ (0, A.jsx)(n, { 314 isOpen: !0, 315 onClose: r, 316 size: "sm", 317 position: "middle-top", 318 title: i("skipass.newPax.modalTitle"), 319 content: /* @__PURE__ */ (0, A.jsx)("ul", { 320 className: "tc:list-none tc:p-0 tc:m-0 tc:divide-y tc:divide-content-divide", 321 children: e.map((e) => /* @__PURE__ */ (0, A.jsxs)("li", { 322 className: "tc:flex tc:items-center tc:justify-between tc:gap-3 tc:py-3", 323 children: [/* @__PURE__ */ (0, A.jsxs)("div", { 324 className: "tc:min-w-0", 325 children: [/* @__PURE__ */ (0, A.jsx)("div", { 326 className: "tc:font-medium tc:text-text-900", 327 children: e.ageRule ? `${e.description} (${e.ageRule})` : e.description 328 }), /* @__PURE__ */ (0, A.jsx)("div", { 329 className: "tc:text-sm tc:text-text-500", 330 children: i("skipass.pricePerUnit", { price: a(e.price) }) 331 })] 332 }), /* @__PURE__ */ (0, A.jsx)("div", { 333 className: "tc:shrink-0", 334 children: /* @__PURE__ */ (0, A.jsx)(y, { 335 variant: "primary", 336 onClick: () => t(e.key), 337 buttonText: i("addition.select"), 338 loading: !1 339 }) 340 })] 341 }, e.key)) 342 }) 343 }); 344}, H = ({ id: e, label: t, value: n, onChange: r, required: i }) => /* @__PURE__ */ (0, A.jsxs)("div", { 345 className: "tc:flex tc:flex-col tc:w-full tc:lg:w-fit tc:max-w-full", 346 children: [/* @__PURE__ */ (0, A.jsxs)("label", { 347 htmlFor: e, 348 className: "tc:text-xs tc:font-medium tc:mb-1 tc:text-text-500", 349 children: [t, i ? "*" : ""] 350 }
350), /* @__PURE__ */ (0, A.jsx)("input", { 351 id: e, 352 type: "text", 353 inputMode: "numeric", 354 autoComplete: "off", 355 autoCorrect: "off", 356 spellCheck: !1, 357 size: 35, 358 value: P(n), 359 onChange: (e) => { 360 r(M(e.target.value).slice(0, 23)); 361 }, 362 placeholder: "XX XXXX XXXX XXXX XXXX XXXX X", 363 className: "tc:w-full tc:lg:w-auto tc:max-w-full tc:py-2 tc:px-3 tc:text-sm tc:font-mono tc:tracking-wider tc:text-text-900 tc:bg-white tc:border tc:border-text-500 tc:rounded-lg tc:outline-none tc:focus:border-primary-800 tc:transition-colors tc:placeholder:text-text-300" 364 })] 365}), me = ({ id: e, file: t, previewUrl: n, error: r, onSelect: i, onRemove: a }) => { 366 let { t: o } = _("booking"), s = (0, k.useRef)(null); 367 return /* @__PURE__ */ (0, A.jsxs)("div", { 368 id: e, 369 className: "tc:flex tc:flex-col tc:w-full tc:lg:w-64 tc:lg:shrink-0 tc:scroll-mt-24", 370 children: [ 371 /* @__PURE__ */ (0, A.jsx)("input", { 372 ref: s, 373 type: "file", 374 accept: "image/jpeg,image/png", 375 className: "tc:hidden", 376 onChange: (e) => i(e.target.files?.[0]) 377 }), 378 n ? /* @__PURE__ */ (0, A.jsxs)("div", { 379 className: "tc:flex tc:items-center tc:gap-2 tc:py-1.5 tc:px-2 tc:border tc:border-text-500 tc:rounded-lg tc:bg-white", 380 children: [ 381 /* @__PURE__ */ (0, A.jsx)("img", { 382 src: n, 383 alt: o("skipass.portrait.alt"), 384 className: "tc:h-9 tc:w-9 tc:rounded tc:object-cover tc:shrink-0" 385 }), 386 t && /* @__PURE__ */ (0, A.jsx)("span", { 387 className: "tc:text-sm tc:text-text-700 tc:truncate tc:flex-1 tc:min-w-0", 388 children: t.name 389 }), 390 /* @__PURE__ */ (0, A.jsx)("button", { 391 type: "button", 392 onClick: () => { 393 s.current && (s.current.value = ""), a(); 394 }, 395 "aria-label": o("skipass.portrait.remove"), 396 className: "tc:p-1 tc:rounded-md tc:text-text-500 tc:hover:bg-gray-100 tc:cursor-pointer tc:shrink-0", 397 children: /* @__PURE__ */ (0, A.jsx)(T, { size: 14 }) 398 }) 399 ] 400 }) : /* @__PURE__ */ (0, A.jsxs)("button", { 401 type: "button", 402 onClick: () => s.current?.click(), 403 className: "tc:flex tc:items-center tc:gap-3 tc:px-3 tc:py-2 tc:border tc:border-dashed tc:border-content-border tc:rounded-lg tc:hover:bg-gray-50 tc:hover:border-primary-800 tc:cursor-pointer tc:w-full tc:text-left tc:transition-colors", 404 children: [/* @__PURE__ */ (0, A.jsx)(w, { 405 size: 20, 406 className: "tc:text-primary-800 tc:shrink-0" 407 }), /* @__PURE__ */ (0, A.jsxs)("span", { 408 className: "tc:flex tc:flex-col tc:min-w-0", 409 children: [/* @__PURE__ */ (0, A.jsxs)("span", { 410 className: "tc:text-sm tc:font-medium tc:text-text-900", 411 children: [o("skipass.portrait.upload"), "*"] 412 }), /* @__PURE__ */ (0, A.jsx)("span", { 413 className: "tc:text-xs tc:text-text-500", 414 children: o("skipass.portrait.uploadHint") 415 })] 416 })] 417 }), 418 r !== null && /* @__PURE__ */ (0, A.jsx)("div", { 419 className: "tc:text-sm tc:text-red-600 tc:mt-1", 420 children: r 421 }) 422 ] 423 }); 424}, he = ({ pax: e, productPartPrices: t, keyCardPrice: r, portraitRequired: i, useQRCode: a, onSave: s, onClose: c, onPortraitSelect: l, onPortraitRemove: u }) => { 425 let { t: d } = _("booking"), { formatPrice: f } = v(), [p, m] = (0, k.useState)(e), h = (e) => { 426 m((t) => ({ 427 ...t, 428 ...e 429 })); 430 }, g = t.find((e) => e.key === p.pppKey), b = g?.description ?? d("skipass.guest"), x = /* @__PURE__ */ (0, A.jsx)("div", { 431 className: "tc:flex tc:items-center tc:gap-2 tc:text-sm tc:text-text-500", 432 children: g && /* @__PURE__ */ (0, A.jsx)("span", { children: d("skipass.pricePerUnit", { price: f(g.price) }) }) 433 }); 434 return /* @__PURE__ */ (0, A.jsx)(n, { 435 isOpen: !0, 436 onClose: c, 437 size: "md", 438 position: "middle-top", 439 title: b, 440 titleDescription: x, 441 content: /* @__PURE__ */ (0, A.jsxs)("div", { 442 className: "tc:space-y-3", 443 children: [
444 /* @__PURE__ */ (0, A.jsxs)("div", { 445 className: "tc:flex tc:flex-col tc:lg:flex-row tc:gap-3 tc:lg:items-start", 446 children: [/* @__PURE__ */ (0, A.jsxs)("div", { 447 className: "tc:grid tc:grid-cols-1 tc:md:grid-cols-2 tc:gap-3 tc:flex-1 tc:min-w-0", 448 children: [/* @__PURE__ */ (0, A.jsx)(o, { 449 id: `skipass-firstname-${e.index}`, 450 name: `firstName-${e.index}`, 451 label: d("skipass.firstName"), 452 value: p.firstName, 453 onChange: (e) => h({ firstName: e.target.value }), 454 required: !0 455 }), /* @__PURE__ */ (0, A.jsx)(o, { 456 id: `skipass-lastname-${e.index}`, 457 name: `lastName-${e.index}`, 458 label: d("skipass.lastName"), 459 value: p.lastName, 460 onChange: (e) => h({ lastName: e.target.value }), 461 required: !0 462 })] 463 }), i && /* @__PURE__ */ (0, A.jsx)(me, { 464 id: `skipass-portrait-${e.index}`, 465 file: e.portraitFile, 466 previewUrl: e.portraitPreviewUrl, 467 error: e.portraitError, 468 onSelect: l, 469 onRemove: u 470 })] 471 }),
472 /* @__PURE__ */ (0, A.jsxs)("div", { 473 className: "tc:flex tc:flex-col tc:lg:flex-row tc:gap-3 tc:flex-wrap", 474 children: [ 475 /* @__PURE__ */ (0, A.jsx)(C, { 476 name: `keycard-${e.index}`, 477 value: String(j.New), 478 label: r > 0 ? d("skipass.buyNewCard.price", { price: f(r) }) : d("skipass.buyNewCard"), 479 checked: p.keyCardOption === j.New, 480 onChange: () => h({ keyCardOption: j.New }), 481 size: "sm" 482 }), 483 a && /* @__PURE__ */ (0, A.jsx)(C, { 484 name: `keycard-${e.index}`, 485 value: String(j.QR), 486 label: d("skipass.useQRCode"), 487 checked: p.keyCardOption === j.QR, 488 onChange: () => h({ keyCardOption: j.QR }), 489 size: "sm" 490 }), 491 /* @__PURE__ */ (0, A.jsx)(C, { 492 name: `keycard-${e.index}`, 493 value: String(j.Existing), 494 label: d("skipass.loadExistingCard"), 495 checked: p.keyCardOption === j.Existing, 496 onChange: () => h({ keyCardOption: j.Existing }), 497 size: "sm" 498 }) 499 ] 500 }), 501 p.keyCardOption === j.Existing && /* @__PURE__ */ (0, A.jsx)(H, { 502 id: `skipass-cardnumber-${e.index}`, 503 label: d("skipass.cardNumber"), 504 value: p.cardNumber, 505 onChange: (e) => h({ cardNumber: e }), 506 required: !0 507 }) 508 ] 509 }), 510 footer: /* @__PURE__ */ (0, A.jsx)("div", { 511 className: "tc:flex tc:justify-end", 512 children: /* @__PURE__ */ (0, A.jsx)(y, { 513 variant: "primary", 514 onClick: () => { 515 s({ 516 pppKey: p.pppKey, 517 firstName: p.firstName, 518 lastName: p.lastName, 519 keyCardOption: p.keyCardOption, 520 cardNumber: p.cardNumber 521 }); 522 }, 523 buttonText: d("skipass.saveGuest"), 524 loading: !1, 525 className: "tc:uppercase" 526 }) 527 }) 528 }); 529}, ge = (e, t, n = 0, r = "", i = "") => ({ 530 index: t, 531 pppKey: e, 532 firstName: r, 533 lastName: i, 534 keyCardOption: j.New, 535 cardNumber: "", 536 selectedBookPaxId: n, 537 portraitFile: null, 538 portraitPreviewUrl: null, 539 portraitError: null 540}), U = ({ preload: e }) => { 541 let { t } = _("booking"), { formatPrice: n, formatDate: o, parseDate: c, formatISODate: d } = v(), { execute: f } = l(), { skipassSearch: m, skipassBook: h } = r(), b = te((e) => e.open), { toCart: C } = i(), ne = ee((e) => !!e.sessionCart.booking), re = se(), { dates: w, onMonthNavigation: ie } = p(e.searchFlow, void 0, e.dates), [T, ae] = (0, k.useState)(e.skipassResult), [E, oe] = (0, k.useState)(() => ({ 542 from: T.fromDate ? c(T.fromDate) : null, 543 to: null, 544 sequence: 0 545 })), [D, O] = (0, k.useState)(T.paxList.length > 0 ? T.paxList[0].selectedProductKey : null), [M, N] = (0, k.useState)(!1), [P, F] = (0, k.useState)(null), [I, L] = (0, k.useState)(null), [R, fe] = (0, k.useState)(e.warnings ?? []), [z, B] = (0, k.useState)(!1), [V, H] = (0, k.useState)([]), [me, U] = (0, k.useState)(!1), [W, G] = (0, k.useState)(null), [_e, ve] = (0, k.useState)(!1), [ye, be] = (0, k.useState)(!1), [xe, Se] = (0, k.useState)(!1), K = (0, k.useMemo)(() => T.paxList.length > 0 ? T.paxList[0].products : [], [T]), Ce = (0, k.useMemo)(() => K.map((e) => ({ 546 value: e.id, 547 label: e.productName 548 })), [K]), q = (0, k.useMemo)(() => T.paxList.length > 0 ? T.paxList[0].productPartPrices : [], [T]), we = (0, k.useMemo)(() => { 549 let e = {}; 550 for (let t of q) e[t.key] = t; 551 return e; 552 }, [q]), J = (0, k.useMemo)(() => K.find((e) => e.id === D), [K, D]), Y = (0, k.useMemo)(() => !!T.paxList[0]?.seasonalCardSelected, [T]), X = (0, k.useMemo)(() => { 553 let e = /* @__PURE__ */ new Set(), t = []; 554 for (let n of T.bookedPaxList) e.has(n.paxId) || (e.add(n.paxId), t.push(n)); 555 return t; 556 }, [T.bookedPaxList]), Te = (0, k.useMemo)(() => { 557 let e = /* @__PURE__ */ new Set(); 558 for (let t of V) t.selectedBookPaxId > 0 && e.add(t.selectedBookPaxId); 559 return e; 560 }, [V]), Ee = (0, k.useMemo)(() => { 561 let e = /* @__PURE__ */ new Set(); 562 return V.forEach((t, n) => { 563 if (t.portraitError !== null) { 564 e.add(n); 565 return; 566 } 567 if (z) { 568 if (t.firstName.trim() === "" || t.lastName.trim() === "") { 569 e.add(n); 570 return; 571 } 572 Y && t.portraitFile === null && e.add(n); 573 } 574 }), e; 575 }, [ 576 V, 577 z, 578 Y 579 ]), De = (0, k.useMemo)(() => E.from ? o(E.from, "descriptive") : null, [E.from, o]), Oe = (0, k.useMemo)(() => { 580 if (!J) return []; 581 let e = []; 582 return J.destinationName && e.push({ 583 label: J.destinationName, 584 icon: "MapPin" 585 }), e; 586 }, [J]), Z = V.length, ke = (0, k.useMemo)(() => { 587 let e = 0; 588 for (let t of V) { 589 let n = we[t.pppKey]; 590 n && (e += n.price), t.keyCardOption === j.New && (e += T.keyCardPrice); 591 } 592 return e; 593 }, [ 594 V, 595 we, 596 T.keyCardPrice 597 ]), Q = (0, k.useCallback)(async (t, n, r = {}) => { 598 let { silent: i = !1 } = r; 599 i || N(!0), F(null); 600 let a = new FormData(); 601 a.set("fromDate", t), n && a.set("skipassPaxResultList[0]/currentProductKey", n), f({ 602 delay: 300, 603 apiCall: () => m(e.searchFlow.searchFlowCd, a), 604 onSuccess: (e, t, n) => { 605 if (ae(e), fe(n ?? []), e.paxList.length > 0) { 606 O(e.paxList[0].selectedProductKey); 607 let t = e.paxList[0].productPartPrices, n = new Set(t.map((e) => e.key)), r = t[0]?.key ?? ""; 608 H((e) => e.map((e) => n.has(e.pppKey) ? e : { 609 ...e, 610 pppKey: r 611 })); 612 } 613 }, 614 onError: (e) => F(e), 615 onFinally: () => { 616 i || N(!1); 617 } 618 }); 619 }, [ 620 f, 621 m, 622 e.searchFlow.searchFlowCd 623 ]), Ae = (0, k.useCallback)(async (e, t) => { 624 !t.hasCapacity || t.fullyBooked || (oe(e), await Q(d(t.date), D)); 625 }, [ 626 D, 627 Q, 628 d 629 ]), je = (0, k.useCallback)(async (e) => { 630 e && (O(e), E.from && await Q(d(E.from), e)); 631 }, [ 632 E.from, 633 Q, 634 d 635 ]), Me = (0, k.useCallback)((e) => { 636 H((t) => { 637 let n = [...t, ge(e, t.length)]; 638 return G(n.length - 1), n; 639 }); 640 }, []), Ne = (0, k.useCallback)((e) => { 641 let t = X.find((t) => t.paxId === e); 642 if (!t) return; 643 let n = q.find((e) => e.allowedPaxTypes.includes(t.paxTypeCd))?.key ?? q[0]?.key; 644 if (!n) return; 645 let r = t.firstName ?? "", i = t.lastName ?? "", a = r.trim() === "" || i.trim() === "" || Y; 646 H((t) => { 647 if (t.some((t) => t.selectedBookPaxId === e)) return t; 648 let o = [...t, ge(n, t.length, e, r, i)]; 649 return a && G(o.length - 1), o; 650 }); 651 }, [ 652 X, 653 q, 654 Y 655 ]), Pe = (0, k.useCallback)((e) => { 656 e <= 0 || H((t) => { 657 let n = t.find((t) => t.selectedBookPaxId === e); 658 return n ? (n.portraitPreviewUrl && URL.revokeObjectURL(n.portraitPreviewUrl), t.filter((t) => t.selectedBookPaxId !== e).map((e, t) => ({ 659 ...e, 660 index: t 661 }))) : t; 662 }); 663 }, []), $ = (0, k.useCallback)((e, t) => { 664 H((n) =>
664 n.map((n, r) => r === e ? { 665 ...n, 666 ...t 667 } : n)); 668 }, []), Fe = (0, k.useCallback)((e) => { 669 H((t) => { 670 let n = t[e]; 671 return n ? (n.portraitPreviewUrl && URL.revokeObjectURL(n.portraitPreviewUrl), t.filter((t, n) => n !== e).map((e, t) => ({ 672 ...e, 673 index: t 674 }))) : t; 675 }); 676 }, []), Ie = (0, k.useCallback)((e, n) => { 677 if (!n) return; 678 if (!["image/jpeg", "image/png"].includes(n.type)) { 679 $(e, { portraitError: t("skipass.portrait.error.format") }); 680 return; 681 } 682 if (n.size > 4194304) { 683 $(e, { portraitError: t("skipass.portrait.error.size") }); 684 return; 685 } 686 let r = V[e]; 687 r?.portraitPreviewUrl && URL.revokeObjectURL(r.portraitPreviewUrl), $(e, { 688 portraitFile: n, 689 portraitPreviewUrl: URL.createObjectURL(n), 690 portraitError: null 691 }); 692 }, [ 693 V, 694 $, 695 t 696 ]), Le = (0, k.useCallback)((e) => { 697 let t = V[e]; 698 t && (t.portraitPreviewUrl && URL.revokeObjectURL(t.portraitPreviewUrl), $(e, { 699 portraitFile: null, 700 portraitPreviewUrl: null, 701 portraitError: null 702 })); 703 }, [V, $]), Re = (0, k.useRef)(V); 704 Re.current = V, (0, k.useEffect)(() => () => { 705 for (let e of Re.current) e.portraitPreviewUrl && URL.revokeObjectURL(e.portraitPreviewUrl); 706 }, []); 707 let ze = (0, k.useCallback)(async () => { 708 if (I) return; 709 if (B(!0), !E.from || Z === 0) { 710 F(t("skipass.error.noPaxSelected")); 711 return; 712 } 713 if (V.some((e) => e.firstName.trim() === "" || e.lastName.trim() === "")) { 714 F(t("skipass.error.missingName")); 715 return; 716 } 717 if (Y) { 718 let e = []; 719 if (V.forEach((t, n) => { 720 t.portraitFile || e.push(n); 721 }), e.length > 0) { 722 let n = t("skipass.portrait.error.required"); 723 H((t) => t.map((t, r) => e.includes(r) ? { 724 ...t, 725 portraitError: n 726 } : t)), F(n), G(e[0]); 727 return; 728 } 729 } 730 L("booking"), F(null); 731 let n = V.map((e) => { 732 let t = { 733 productPartKey: e.pppKey, 734 firstName: e.firstName.trim(), 735 lastName: e.lastName.trim(), 736 keyCardOption: e.keyCardOption, 737 selectedBookPaxId: e.selectedBookPaxId 738 }; 739 if (e.keyCardOption === j.Existing) { 740 let n = le(e.cardNumber); 741 t.chipId = n.chipId, t.serialNumber = n.serialNumber, t.luhnNumber = n.luhnNumber; 742 } 743 return t; 744 }), r = {}; 745 V.forEach((e, t) => { 746 e.portraitFile && (r[t] = e.portraitFile); 747 }); 748 let i = { 749 fromDate: d(E.from), 750 productKey: D || "", 751 paxList: n 752 }; 753 f({ 754 delay: 300, 755 apiCall: () => h(e.searchFlow.searchFlowCd, i, r), 756 onSuccess: () => { 757 F(null), be(!0); 758 }, 759 onError: (e) => F(e), 760 onFinally: () => L(null) 761 }); 762 }, [ 763 I, 764 E.from, 765 Z, 766 V, 767 D, 768 f, 769 h, 770 Y, 771 e.searchFlow.searchFlowCd, 772 d, 773 t 774 ]), Be = (0, k.useCallback)(() => { 775 be(!1); 776 for (let e of V) e.portraitPreviewUrl && URL.revokeObjectURL(e.portraitPreviewUrl); 777 H([]), B(!1), E.from && Q(d(E.from), D, { silent: !0 }), Se(!0); 778 }, [ 779 V, 780 E.from, 781 D, 782 Q, 783 d 784 ]), Ve = (0, k.useCallback)(() => { 785 be(!1); 786 for (let e of V) e.portraitPreviewUrl && URL.revokeObjectURL(e.portraitPreviewUrl); 787 H([]), B(!1), C(!0, () => {}); 788 }, [V, C]); 789 (0, k.useEffect)(() => { 790 if (!xe || !ne) return; 791 let e = setTimeout(() => b(), 0); 792 return Se(!1), () => clearTimeout(e); 793 }, [ 794 xe, 795 ne, 796 b 797 ]); 798 let He = (0, k.useCallback)((e) => { 799 e && window.location.reload(); 800 }, []), Ue = W === null ? null : V[W] ?? null, We = (0, k.useCallback)((e) => { 801 W !== null && ($(W, e), G(null)); 802 }, [W, $]); 803 return /* @__PURE__ */ (0, A.jsxs)(x, { 804 id: "skipass-booking", 805 container: !1, 806 contentSize: "xl", 807 onCartUpdate: He, 808 children: [ 809 /* @__PURE__ */ (0, A.jsxs)("div", { 810 className: "tc-container", 811 children: [ 812 P !== null && /* @__PURE__ */ (0, A.jsx)(u, { 813 message: P, 814 variant: "error" 815 }), 816 w.length === 0 && /* @__PURE__ */ (0, A.jsx)(u, { 817 message: t("booking.notOpen"), 818 variant: "error" 819 }),
820 M && /* @__PURE__ */ (0, A.jsx)(g, {}), 821 /* @__PURE__ */ (0, A.jsxs)("div", { 822 className: "tc:space-y-container", 823 children: [ 824 /* @__PURE__ */ (0, A.jsxs)("div", { 825 className: "tc:flex tc:flex-col tc:lg:flex-row tc:lg:items-start tc:gap-3", 826 children: [/* @__PURE__ */ (0, A.jsxs)("div", { 827 className: "tc:space-y-2", 828 children: [/* @__PURE__ */ (0, A.jsx)("h1", { 829 className: "tc:text-2xl tc:lg:text-3xl tc:font-bold tc:text-text-900", 830 children: t("skipass.header") 831 }), /* @__PURE__ */ (0, A.jsx)("p", { 832 className: "tc:text-base tc:text-text-700", 833 children: t("skipass.header.description") 834 })] 835 }), e.searchFlow.useCoupon && /* @__PURE__ */ (0, A.jsx)(a, { 836 hideOnInit: !0, 837 onChange: () => {}, 838 embedded: !0, 839 linkSize: "md", 840 className: "tc:lg:max-w-sm tc:lg:ml-auto" 841 })] 842 }), 843 /* @__PURE__ */ (0, A.jsx)(ue, { 844 searchFlow: e.searchFlow, 845 dates: w, 846 selection: E, 847 onDateClick: Ae, 848 onMonthNavigation: ie, 849 productOptions: Ce, 850 selectedProductKey: D, 851 selectedProductName: J?.productName ?? null, 852 onProductSelect: je 853 }), 854 R.length > 0 && /* @__PURE__ */ (0, A.jsx)(u, { 855 message: R.join(" "), 856 variant: "warning" 857 }), 858 E.from !== null && J && q.length > 0 && /* @__PURE__ */ (0, A.jsxs)("div", { 859 className: "tc:border tc:border-content-border tc:rounded-lg tc:overflow-hidden tc:px-container", 860 children: [/* @__PURE__ */ (0, A.jsx)("div", { 861 className: "tc:py-container", 862 children: /* @__PURE__ */ (0, A.jsx)(s, { 863 product: J, 864 infoItems: [], 865 embedded: !0, 866 showBottomBorder: !1, 867 imageSize: "sm", 868 onShowMoreInfo: J.productInfoList || J.description ? () => ve(!0) : void 0 869 }) 870 }), /* @__PURE__ */ (0, A.jsx)("div", { 871 className: "tc:divide-y tc:divide-content-divide tc:border-t tc:border-content-divide", 872 children: q.map((e) => /* @__PURE__ */ (0, A.jsxs)("div", { 873 className: "tc:flex tc:items-center tc:justify-between tc:gap-3 tc:py-content", 874 children: [/* @__PURE__ */ (0, A.jsx)("div", { 875 className: "tc:min-w-0 tc:font-medium", 876 children: e.ageRule ? `${e.description} (${e.ageRule})` : e.description 877 }), /* @__PURE__ */ (0, A.jsx)("div", { 878 className: "tc:shrink-0 tc:text-right", 879 children: /* @__PURE__ */ (0, A.jsx)("div", { 880 className: "tc:font-semibold tc:text-text-900", 881 children: t("skipass.pricePerUnit", { price: n(e.price) }) 882 }) 883 })] 884 }, e.key)) 885 })] 886 }), 887 E.from !== null && (q.length > 0 || V.length > 0 || X.length > 0) && /* @__PURE__ */ (0, A.jsx)(de, { 888 bookedPaxList: X, 889 claimedBookedPaxIds: Te, 890 paxStates: V, 891 productPartPriceByKey: we, 892 keyCardPrice: T.keyCardPrice, 893 selectedProductName: J?.productName ?? null, 894 canAddPax: !!J && q.length > 0, 895 bookedItemsByPaxId: re, 896 fromDateLabel: De, 897 portraitRequired: Y, 898 invalidPaxIndices: Ee, 899 onAddPax: () => U(!0), 900 onAttachExistingPax: Ne, 901 onDetachExistingPax: Pe, 902 onEditPax: (e) => G(e), 903 onRemovePax: Fe 904 }), 905 Z > 0 && E.from !== null && /* @__PURE__ */ (0, A.jsx)("div", { 906 className: "tc:space-y-3", 907 children: /* @__PURE__ */ (0, A.jsx)("div", { 908 className: "tc:flex tc:flex-col tc:lg:flex-row tc:lg:items-end tc:gap-container tc:justify-end", 909 children: /* @__PURE__ */ (0, A.jsxs)("div", { 910 className: "tc:flex tc:items-center tc:gap-container tc:justify-end", 911 children: [/* @__PURE__ */ (0, A.jsxs)("div", { 912 className: "tc:text-right", 913 children: [/* @__PURE__ */ (0, A.jsx)("div", { 914 className: "tc:text-sm tc:text-text-500", 915 children: t("skipass.totalPriceForGuests", { count: Z }) 916 }
916), /* @__PURE__ */ (0, A.jsx)("div", { 917 className: "tc:font-semibold tc:text-base", 918 children: n(ke) 919 })] 920 }), /* @__PURE__ */ (0, A.jsx)(y, { 921 variant: "primary", 922 onClick: ze, 923 buttonText: t("skipass.addToCart"), 924 loading: I === "booking", 925 className: "tc:min-w-36" 926 })] 927 }) 928 }) 929 }) 930 ] 931 }) 932 ] 933 }), 934 me && q.length > 0 && /* @__PURE__ */ (0, A.jsx)(pe, { 935 productPartPrices: q, 936 onSelect: (e) => { 937 Me(e), U(!1); 938 }, 939 onClose: () => U(!1) 940 }), 941 Ue !== null && /* @__PURE__ */ (0, A.jsx)(he, { 942 pax: Ue, 943 productPartPrices: q, 944 keyCardPrice: T.keyCardPrice, 945 portraitRequired: Y, 946 useQRCode: T.useQRCode, 947 onSave: We, 948 onClose: () => G(null), 949 onPortraitSelect: (e) => W !== null && Ie(W, e), 950 onPortraitRemove: () => W !== null && Le(W) 951 }), 952 _e && J && /* @__PURE__ */ (0, A.jsx)(S, { 953 product: J, 954 tags: Oe, 955 onClose: () => ve(!1) 956 }), 957 /* @__PURE__ */ (0, A.jsx)(ce, { 958 isOpen: ye, 959 onClose: Be, 960 onToCheckout: Ve, 961 title: t("skipass.success.modalTitle"), 962 message: t("skipass.success.booked"), 963 toCheckoutText: t("to.cart"), 964 addMoreText: t("skipass.success.addMore") 965 }) 966 ] 967 }); 968}, W = () => { 969 let { data: e, loading: t, error: n, setData: a, setError: o, startLoading: s, stopLoading: u } = b(), { execute: d } = l(), { dateFormat: f } = v(), { skipassInit: p } = r(), { getPageParam: h } = i(); 970 return (0, k.useEffect)(() => { 971 s(); 972 let e = h(); 973 e.flowCd === "" && e.pageCode === "" || d({ 974 apiCall: () => p(e.pageCode, null), 975 onSuccess: (e, t, n) => { 976 let r = e.searchFlowContext; 977 a({ 978 searchFlow: r, 979 dates: c(r, f, !0), 980 skipassResult: e, 981 warnings: n 982 }); 983 }, 984 onError: (e) => o(e), 985 onFinally: () => u() 986 }); 987 }, []), t || !e ? /* @__PURE__ */ (0, A.jsx)(m, {}) : n ? /* @__PURE__ */ (0, A.jsxs)("div", { children: ["Error: ", n] }) : /* @__PURE__ */ (0, A.jsx)(U, { preload: e }); 988}; 989//#endregion 990export { W as default };
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.