@levo-so/site-runtime 0.3.25 → 0.3.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { a as e, n as t } from "./dist-BVFCdirT.js";
2
+ import { a as e, n as t } from "./dist-B_29IiED.js";
3
3
  import { c as n, o as r, s as i, t as a } from "./inlineBaseTheme-DcNdMEYp.js";
4
4
  import { t as o } from "./inlineCollectionTheme-DjXuH3bK.js";
5
5
  import { a as s, c, d as l, f as u, i as d, l as f, n as p, o as m, r as h, s as g, t as _, u as v } from "./routes-DO1BLfh9.js";
@@ -8,31 +8,32 @@ import { Suspense as x, createContext as S, lazy as C, useCallback as w, useCont
8
8
  import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
9
9
  import { Dialog as F } from "@base-ui/react/dialog";
10
10
  import { keepPreviousData as I, useMutation as L, useQuery as R, useQueryClient as z } from "@tanstack/react-query";
11
- import { Link as ee, ScriptOnce as te, redirect as ne, useRouterState as B } from "@tanstack/react-router";
12
- import { createLevoInsights as re } from "@levo-so/insights";
13
- import { CalendarPlusIcon as ie, CheckIcon as ae, ChevronDownIcon as V, DownloadIcon as oe, LoaderCircleIcon as se, XIcon as ce } from "lucide-react";
14
- import { Popover as H } from "@base-ui/react/popover";
15
- import { useRazorpay as le } from "react-razorpay";
16
- import { EmbeddedCheckout as ue, EmbeddedCheckoutProvider as de } from "@stripe/react-stripe-js";
11
+ import { Link as ee, ScriptOnce as B, redirect as te, useRouterState as V } from "@tanstack/react-router";
12
+ import { createLevoInsights as ne } from "@levo-so/insights";
13
+ import { ArrowLeftIcon as re, CalendarPlusIcon as ie, CheckIcon as H, ChevronDownIcon as ae, DownloadIcon as oe, LoaderCircleIcon as se, MinusIcon as ce, PlusIcon as le, XIcon as ue } from "lucide-react";
14
+ import { Accordion as U } from "@base-ui/react/accordion";
15
+ import { Popover as W } from "@base-ui/react/popover";
16
+ import { useRazorpay as de } from "react-razorpay";
17
+ import { EmbeddedCheckout as fe, EmbeddedCheckoutProvider as pe } from "@stripe/react-stripe-js";
17
18
  //#region src/access/types.ts
18
- var fe = [
19
+ var me = [
19
20
  "otp",
20
21
  "magiclink",
21
22
  "whatsapp"
22
- ], pe = [
23
+ ], he = [
23
24
  "google",
24
25
  "microsoft",
25
26
  "linkedin"
26
- ], me = [...fe, ...pe], he = "otp", U = (e) => typeof e == "object" && !!e && !Array.isArray(e), ge = (e) => fe.includes(e), _e = (e) => pe.includes(e), ve = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "string") : [], ye = (e) => e, be = (e) => {
27
- if (!U(e)) return null;
28
- let t = e.enabled === void 0 ? !0 : e.enabled === !0, n = U(e.options) ? e.options : {};
27
+ ], ge = [...me, ...he], _e = "otp", ve = (e) => typeof e == "object" && !!e && !Array.isArray(e), ye = (e) => me.includes(e), be = (e) => he.includes(e), xe = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "string") : [], Se = (e) => e, Ce = (e) => {
28
+ if (!ve(e)) return null;
29
+ let t = e.enabled === void 0 ? !0 : e.enabled === !0, n = ve(e.options) ? e.options : {};
29
30
  switch (e.kind) {
30
31
  case "authentication": return {
31
32
  kind: "authentication",
32
33
  enabled: t,
33
34
  options: {
34
- methods: ve(n.methods).filter((e) => ge(e) || _e(e)),
35
- ...ge(n.primary_method) ? { primary_method: n.primary_method } : {}
35
+ methods: xe(n.methods).filter((e) => ye(e) || be(e)),
36
+ ...ye(n.primary_method) ? { primary_method: n.primary_method } : {}
36
37
  }
37
38
  };
38
39
  case "gating": return typeof n.collection != "string" || !n.collection.trim() ? null : {
@@ -40,71 +41,71 @@ var fe = [
40
41
  enabled: t,
41
42
  options: {
42
43
  collection: n.collection.trim(),
43
- ...U(n.condition) ? { condition: ye(n.condition) } : {},
44
- hidden: ve(n.hidden)
44
+ ...ve(n.condition) ? { condition: Se(n.condition) } : {},
45
+ hidden: xe(n.hidden)
45
46
  }
46
47
  };
47
48
  case "profile": return {
48
49
  kind: "profile",
49
50
  enabled: t,
50
51
  options: {
51
- ...U(n.condition) ? { condition: ye(n.condition) } : {},
52
- hidden: ve(n.hidden)
52
+ ...ve(n.condition) ? { condition: Se(n.condition) } : {},
53
+ hidden: xe(n.hidden)
53
54
  }
54
55
  };
55
56
  default: return null;
56
57
  }
57
- }, xe = (e) => {
58
+ }, we = (e) => {
58
59
  if (!Array.isArray(e) || e.length === 0) return {
59
60
  rules: [],
60
61
  invalid: !1
61
62
  };
62
- let t = e.map(be).filter((e) => e !== null);
63
+ let t = e.map(Ce).filter((e) => e !== null);
63
64
  return {
64
65
  rules: t.filter((e) => e.enabled !== !1),
65
66
  invalid: t.length === 0
66
67
  };
67
- }, Se = (e) => {
68
+ }, Te = (e) => {
68
69
  let t = e.find((e) => e.kind === "authentication"), n = t?.kind === "authentication" ? t.options?.methods ?? [] : [];
69
70
  return {
70
- primary: (t?.kind === "authentication" ? t.options?.primary_method : void 0) ?? n.find(ge) ?? he,
71
- oauth: n.filter(_e)
71
+ primary: (t?.kind === "authentication" ? t.options?.primary_method : void 0) ?? n.find(ye) ?? _e,
72
+ oauth: n.filter(be)
72
73
  };
73
- }, Ce = (e = null) => ({
74
+ }, Ee = (e = null) => ({
74
75
  state: "granted",
75
76
  code: e,
76
77
  message: null,
77
78
  rule: null
78
- }), we = () => ({
79
+ }), De = () => ({
79
80
  state: "checking",
80
81
  code: null,
81
82
  message: null,
82
83
  rule: null
83
- }), W = (e, t, n = null) => ({
84
+ }), G = (e, t, n = null) => ({
84
85
  state: "blocked",
85
86
  code: e,
86
87
  message: t,
87
88
  rule: n
88
- }), Te = (e, t) => {
89
+ }), Oe = (e, t) => {
89
90
  let n = t?.split(".")[0];
90
91
  return e.find((e) => e.kind === n) ?? null;
91
- }, Ee = (e, t) => {
92
+ }, ke = (e, t) => {
92
93
  let n = (e) => t.find((t) => t.kind === e);
93
- if (e === "granted") return Ce();
94
- if (e === "signed_out") return W("authentication.NOT_LOGGED_IN", "You need to be signed in to view this page.", n("authentication") ?? t[0] ?? null);
94
+ if (e === "granted") return Ee();
95
+ if (e === "signed_out") return G("authentication.NOT_LOGGED_IN", "You need to be signed in to view this page.", n("authentication") ?? t[0] ?? null);
95
96
  let r = n("gating");
96
- if (e === "entry_missing" && r) return W("gating.ENTRY_NOT_FOUND", null, r);
97
- if (e === "entry_under_review" && r) return W("gating.ENTRY_CONDITION_NOT_FULFILLED", "Your submission is being reviewed.", r);
97
+ if (e === "entry_missing" && r) return G("gating.ENTRY_NOT_FOUND", null, r);
98
+ if (e === "entry_under_review" && r) return G("gating.ENTRY_CONDITION_NOT_FULFILLED", "Your submission is being reviewed.", r);
98
99
  let i = n("profile");
99
- return e === "profile_incomplete" && i ? W("profile.CONDITION_NOT_FULFILLED", null, i) : null;
100
- }, De = ({ rules: e, invalid: t, pageId: n, hasClient: r, isReady: i, isLoggedIn: a, check: o, preview: s }) => {
101
- if (e.length === 0 && !t) return Ce();
100
+ return e === "profile_incomplete" && i ? G("profile.CONDITION_NOT_FULFILLED", null, i) : null;
101
+ }, Ae = ({ rules: e, invalid: t, pageId: n, hasClient: r, isReady: i, isLoggedIn: a, check: o, preview: s }) => {
102
+ if (e.length === 0 && !t) return Ee();
102
103
  if (s) {
103
- let t = Ee(s, e);
104
+ let t = ke(s, e);
104
105
  if (t) return t;
105
106
  }
106
- return t ? W("access.CONFIG_INVALID", "This page's access rules could not be read.") : i ? r ? a ? n ? o.isError ? W("access.CHECK_FAILED", "We could not verify your access.") : o.isSuccess ? o.data ? o.data.has_access ? Ce(o.data.code ?? null) : W(o.data.code ?? "access.CHECK_FAILED", o.data.message ?? null, Te(e, o.data.code)) : W("access.CHECK_FAILED", "We could not verify your access.") : we() : W("access.PAGE_NOT_IDENTIFIED", "This page is not linked to its access rules yet.") : W("authentication.NOT_LOGGED_IN", "You need to be signed in to view this page.", e.find((e) => e.kind === "authentication") ?? e[0] ?? null) : W("access.UNWIRED", "This site is not connected to an account system.") : we();
107
- }, Oe = (e) => {
107
+ return t ? G("access.CONFIG_INVALID", "This page's access rules could not be read.") : i ? r ? a ? n ? o.isError ? G("access.CHECK_FAILED", "We could not verify your access.") : o.isSuccess ? o.data ? o.data.has_access ? Ee(o.data.code ?? null) : G(o.data.code ?? "access.CHECK_FAILED", o.data.message ?? null, Oe(e, o.data.code)) : G("access.CHECK_FAILED", "We could not verify your access.") : De() : G("access.PAGE_NOT_IDENTIFIED", "This page is not linked to its access rules yet.") : G("authentication.NOT_LOGGED_IN", "You need to be signed in to view this page.", e.find((e) => e.kind === "authentication") ?? e[0] ?? null) : G("access.UNWIRED", "This site is not connected to an account system.") : De();
108
+ }, je = (e) => {
108
109
  let t = (e?.apiUrl || "").replace(/\/$/, "");
109
110
  return t ? y({
110
111
  apiUrl: t,
@@ -113,15 +114,15 @@ var fe = [
113
114
  NODE_ENV: "",
114
115
  APP_MODE: e?.appMode || "production"
115
116
  }) : null;
116
- }, ke = (e) => ({
117
+ }, Me = (e) => ({
117
118
  apiUrl: e.levo?.api_url || "",
118
119
  workspace: e.workspace_id || "",
119
120
  siteId: e.id || "",
120
121
  insightsUrl: e.levo?.insights_url || null,
121
122
  appMode: e.levo?.app_mode || "production"
122
- }), Ae = /\{\$([A-Za-z0-9_]+)\}/g, je = (e) => {
123
+ }), Ne = /\{\$([A-Za-z0-9_]+)\}/g, Pe = (e) => {
123
124
  let t = [], n = [], r = 0;
124
- for (let i of e.matchAll(Ae)) n.push(e.slice(r, i.index)), t.push(i[1]), r = i.index + i[0].length;
125
+ for (let i of e.matchAll(Ne)) n.push(e.slice(r, i.index)), t.push(i[1]), r = i.index + i[0].length;
125
126
  n.push(e.slice(r));
126
127
  let i = (t) => /* @__PURE__ */ Error(`Levo pattern "${e}" ${t}`);
127
128
  if (t.length === 0) throw i("names no variable: write each record as {$name}");
@@ -132,10 +133,10 @@ var fe = [
132
133
  names: t,
133
134
  literals: n
134
135
  };
135
- }, Me = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), Ne = ({ literals: e }) => RegExp(`^${e.map(Me).join("([^/]+)")}$`), Pe = /* @__PURE__ */ new Set(), Fe = (e, t, n) => {
136
- let r = je(t), i = Ne(r), a = (e) => {
136
+ }, Fe = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), Ie = ({ literals: e }) => RegExp(`^${e.map(Fe).join("([^/]+)")}$`), Le = /* @__PURE__ */ new Set(), Re = (e, t, n) => {
137
+ let r = Pe(t), i = Ie(r), a = (e) => {
137
138
  let n = e;
138
- return t.replace(Ae, (e, r) => {
139
+ return t.replace(Ne, (e, r) => {
139
140
  let i = n[r];
140
141
  if (!i) throw Error(`Levo pattern "${t}" has no value for {$${r}}`);
141
142
  return i;
@@ -145,7 +146,7 @@ var fe = [
145
146
  parse: (t) => {
146
147
  if (!Object.hasOwn(t, e)) {
147
148
  let n = Object.keys(t).join(", ") || "none";
148
- return Pe.has(e) || (Pe.add(e), console.error(`levoParams("${e}", …) names a param this route does not have. Its params are: ${n}. The first argument must be the file's $param name.`)), !1;
149
+ return Le.has(e) || (Le.add(e), console.error(`levoParams("${e}", …) names a param this route does not have. Its params are: ${n}. The first argument must be the file's $param name.`)), !1;
149
150
  }
150
151
  let n = t[e], a = n ? i.exec(n) : null;
151
152
  if (!a) return !1;
@@ -161,33 +162,33 @@ var fe = [
161
162
  [e]: a(t)
162
163
  })
163
164
  };
164
- }, Ie = (e, t, n) => Object.prototype.hasOwnProperty.call(n, t) ? null : `Record binding "${e}" reads param "${t}", but this route has no such param. Its params are: ${Object.keys(n).join(", ") || "none"}. On a levoParams page, param names a pattern variable (packages, cities), never the segment.`, Le = (e) => [
165
+ }, ze = (e, t, n) => Object.prototype.hasOwnProperty.call(n, t) ? null : `Record binding "${e}" reads param "${t}", but this route has no such param. Its params are: ${Object.keys(n).join(", ") || "none"}. On a levoParams page, param names a pattern variable (packages, cities), never the segment.`, Be = (e) => [
165
166
  "levo-source",
166
167
  "list",
167
168
  e.module,
168
169
  e.identifier,
169
170
  e.query ?? null,
170
171
  e.options ?? null
171
- ], Re = (e, t) => [
172
+ ], Ve = (e, t) => [
172
173
  "levo-source",
173
174
  "record",
174
175
  e.module,
175
176
  e.identifier,
176
177
  t ?? null
177
- ], ze = (e) => [
178
+ ], He = (e) => [
178
179
  "levo-source",
179
180
  "form",
180
181
  e.module,
181
182
  e.identifier
182
- ], Be = {
183
+ ], Ue = {
183
184
  blog_author: "author",
184
185
  blog_category: "category",
185
186
  blog_tag: "tag"
186
- }, Ve = (e, t) => {
187
- let n = encodeURIComponent(e.identifier), r = t ? `${encodeURIComponent(t)}/get-single` : "list", i = Be[e.module];
187
+ }, We = (e, t) => {
188
+ let n = encodeURIComponent(e.identifier), r = t ? `${encodeURIComponent(t)}/get-single` : "list", i = Ue[e.module];
188
189
  return i ? `/v1/blog/${n}/${i}/${r}` : e.module === "community" ? `/v1/community/${n}/post/${r}` : null;
189
- }, He = async (e, t) => {
190
- let n = Ve(t);
190
+ }, Ge = async (e, t) => {
191
+ let n = We(t);
191
192
  if (n) {
192
193
  let r = await e.fetch.url(n).post(t.query ?? {}).json();
193
194
  return {
@@ -203,16 +204,16 @@ var fe = [
203
204
  data: r.content.data ?? [],
204
205
  meta: r.content.meta ?? null
205
206
  };
206
- }, Ue = async (e, t, n) => {
207
- let r = Ve(t, n);
207
+ }, Ke = async (e, t, n) => {
208
+ let r = We(t, n);
208
209
  return r ? (await e.fetch.url(r).get().json()).content.data ?? null : (t.module === "collection" ? await e.collection.getCollectionContent({
209
210
  collection_key: t.identifier,
210
211
  slug: n
211
212
  }) : t.module === "blog" ? await e.blog.getSingleBlog(t.identifier, n, { workspace_id: e.workspace ?? "" }) : await e.event.getSingleEvent(n, { workspace_id: e.workspace ?? "" })).content.data ?? null;
212
- }, We = async (e, t) => (await e.collection.getCollectionByIDExpanded(t.identifier)).content.data ?? null, Ge = (e) => {
213
+ }, qe = async (e, t) => (await e.collection.getCollectionByIDExpanded(t.identifier)).content.data ?? null, Je = (e) => {
213
214
  let t = i(), n = R({
214
- queryKey: Le(e),
215
- queryFn: () => He(t, e),
215
+ queryKey: Be(e),
216
+ queryFn: () => Ge(t, e),
216
217
  enabled: !!t
217
218
  });
218
219
  return {
@@ -225,10 +226,10 @@ var fe = [
225
226
  ...e
226
227
  }) }
227
228
  };
228
- }, Ke = (e, t) => {
229
+ }, Ye = (e, t) => {
229
230
  let n = i(), r = R({
230
- queryKey: Re(e, t),
231
- queryFn: () => Ue(n, e, t),
231
+ queryKey: Ve(e, t),
232
+ queryFn: () => Ke(n, e, t),
232
233
  enabled: !!n && !!t
233
234
  });
234
235
  return {
@@ -240,10 +241,10 @@ var fe = [
240
241
  ...e
241
242
  }) }
242
243
  };
243
- }, qe = (e) => {
244
+ }, Xe = (e) => {
244
245
  let t = i(), n = R({
245
- queryKey: ze(e),
246
- queryFn: () => We(t, e),
246
+ queryKey: He(e),
247
+ queryFn: () => qe(t, e),
247
248
  enabled: !!t
248
249
  });
249
250
  return {
@@ -255,35 +256,35 @@ var fe = [
255
256
  ...e
256
257
  }) }
257
258
  };
258
- }, Je = (e) => {
259
+ }, Ze = (e) => {
259
260
  let t = Object.values(e ?? {});
260
261
  return t.length === 1 ? t[0] : e?.slug;
261
- }, Ye = async ({ queryClient: e, config: t, sources: n, params: r }) => {
262
- let i = Oe(t);
262
+ }, Qe = async ({ queryClient: e, config: t, sources: n, params: r }) => {
263
+ let i = je(t);
263
264
  if (!i || !n) return {};
264
265
  let a = await Promise.all(Object.entries(n).map(async ([t, n]) => {
265
266
  if (n.mode === "record") {
266
- let a = n.param ? Ie(t, n.param, r ?? {}) : null;
267
+ let a = n.param ? ze(t, n.param, r ?? {}) : null;
267
268
  if (a) {
268
269
  if (i.APP_MODE !== "production") throw Error(a);
269
270
  return i.logger.error(a), [t, null];
270
271
  }
271
- let o = n.param ? r?.[n.param] : Je(r);
272
+ let o = n.param ? r?.[n.param] : Ze(r);
272
273
  return o ? [t, await e.ensureQueryData({
273
- queryKey: Re(n, o),
274
- queryFn: () => Ue(i, n, o)
274
+ queryKey: Ve(n, o),
275
+ queryFn: () => Ke(i, n, o)
275
276
  }).catch(() => null)] : [t, null];
276
277
  }
277
278
  return n.mode === "form" ? [t, await e.ensureQueryData({
278
- queryKey: ze(n),
279
- queryFn: () => We(i, n)
279
+ queryKey: He(n),
280
+ queryFn: () => qe(i, n)
280
281
  }).catch(() => null)] : [t, await e.ensureQueryData({
281
- queryKey: Le(n),
282
- queryFn: () => He(i, n)
282
+ queryKey: Be(n),
283
+ queryFn: () => Ge(i, n)
283
284
  }).catch(() => null)];
284
285
  }));
285
286
  return Object.fromEntries(a);
286
- }, Xe = {
287
+ }, $e = {
287
288
  background: "var(--color-page)",
288
289
  foreground: "var(--color-ink)",
289
290
  text: "var(--color-ink)",
@@ -305,10 +306,10 @@ var fe = [
305
306
  input: "var(--color-background1)",
306
307
  inputForeground: "var(--color-ink)",
307
308
  ring: "var(--color-brand)"
308
- }, Ze = (e) => O(() => ({
309
+ }, et = (e) => O(() => ({
309
310
  ...a({
310
311
  colors: {
311
- ...Xe,
312
+ ...$e,
312
313
  ...e?.colors
313
314
  },
314
315
  radius: e?.radius ?? "var(--radius-token)",
@@ -321,15 +322,15 @@ var fe = [
321
322
  }), [e]);
322
323
  //#endregion
323
324
  //#region src/hooks/useMounted.ts
324
- function G() {
325
+ function K() {
325
326
  let [e, t] = A(!1);
326
327
  return E(() => t(!0), []), e;
327
328
  }
328
329
  //#endregion
329
330
  //#region src/access/useLevoAuth.ts
330
- var K = ["levo-auth", "session"], Qe = () => {
331
- let e = i(), t = z(), n = G(), r = R({
332
- queryKey: K,
331
+ var q = ["levo-auth", "session"], tt = () => {
332
+ let e = i(), t = z(), n = K(), r = R({
333
+ queryKey: q,
333
334
  queryFn: async () => {
334
335
  try {
335
336
  return await e?.membership?.getMe() ?? null;
@@ -344,12 +345,12 @@ var K = ["levo-auth", "session"], Qe = () => {
344
345
  mutationFn: async () => {
345
346
  await e?.membership?.signOut();
346
347
  },
347
- onSettled: () => t.invalidateQueries({ queryKey: K }),
348
+ onSettled: () => t.invalidateQueries({ queryKey: q }),
348
349
  onError: (t) => {
349
350
  e?.logger?.error("Sign out failed", { exception: b(t) });
350
351
  }
351
352
  }), o = w(async () => {
352
- await t.invalidateQueries({ queryKey: K });
353
+ await t.invalidateQueries({ queryKey: q });
353
354
  }, [t]), s = w(async () => {
354
355
  await a.mutateAsync().catch(() => void 0);
355
356
  }, [a]), c = r.data ?? null;
@@ -362,11 +363,11 @@ var K = ["levo-auth", "session"], Qe = () => {
362
363
  signOut: s,
363
364
  isSigningOut: a.isPending
364
365
  };
365
- }, $e = ({ collection: e, hidden: n, submitLabel: r = "Submit", onSuccess: a, theme: o, className: s }) => {
366
- let c = i(), { account: l } = Qe(), { schema: u, isLoading: d } = qe({
366
+ }, nt = ({ collection: e, hidden: n, submitLabel: r = "Submit", onSuccess: a, theme: o, className: s }) => {
367
+ let c = i(), { account: l } = tt(), { schema: u, isLoading: d } = Xe({
367
368
  module: "collection",
368
369
  identifier: e
369
- }), f = Ze(o);
370
+ }), f = et(o);
370
371
  return c ? /* @__PURE__ */ N("div", {
371
372
  className: s,
372
373
  children: /* @__PURE__ */ N(t, {
@@ -390,17 +391,17 @@ var K = ["levo-auth", "session"], Qe = () => {
390
391
  onSuccess: () => a?.()
391
392
  })
392
393
  }) : null;
393
- }, et = "so_levo_membership_account", tt = [
394
+ }, rt = "so_levo_membership_account", it = [
394
395
  "profile_picture",
395
396
  "first_name",
396
397
  "last_name",
397
398
  "email",
398
399
  "username",
399
400
  "socials"
400
- ], nt = ["email", "username"], rt = (e) => tt.includes(e.key) || e.editable === !0, it = ({ hidden: t, submitLabel: n = "Save and continue", onSuccess: r, errorClassName: a = "text-sm text-[var(--color-danger)]", theme: o, className: s }) => {
401
- let c = i(), l = G(), { account: u } = Qe(), d = Ze(o), [f, p] = A(""), m = R({
401
+ ], at = ["email", "username"], ot = (e) => it.includes(e.key) || e.editable === !0, st = ({ hidden: t, submitLabel: n = "Save and continue", onSuccess: r, errorClassName: a = "text-sm text-[var(--color-danger)]", theme: o, className: s }) => {
402
+ let c = i(), l = K(), { account: u } = tt(), d = et(o), [f, p] = A(""), m = R({
402
403
  queryKey: ["levo-access", "profile-schema"],
403
- queryFn: async () => (await c?.collection?.getCollectionByIDExpanded(et))?.content?.data ?? null,
404
+ queryFn: async () => (await c?.collection?.getCollectionByIDExpanded(rt))?.content?.data ?? null,
404
405
  enabled: l && !!c,
405
406
  staleTime: 5 * 6e4,
406
407
  retry: 1
@@ -412,14 +413,14 @@ var K = ["levo-auth", "session"], Qe = () => {
412
413
  ...e,
413
414
  fields: e.fields?.map((e) => ({
414
415
  ...e,
415
- hidden: !rt(e) || !!t?.includes(e.key),
416
- readonly: e.readonly || nt.includes(e.key)
416
+ hidden: !ot(e) || !!t?.includes(e.key),
417
+ readonly: e.readonly || at.includes(e.key)
417
418
  }))
418
419
  }))
419
420
  } : null;
420
421
  }, [m.data, h]), _ = L({
421
422
  mutationFn: async (e) => {
422
- let n = g?.sections?.flatMap((e) => e?.fields ?? [])?.filter((e) => rt(e) && !nt.includes(e.key) && !t?.includes(e.key))?.map((e) => e?.key) ?? [];
423
+ let n = g?.sections?.flatMap((e) => e?.fields ?? [])?.filter((e) => ot(e) && !at.includes(e.key) && !t?.includes(e.key))?.map((e) => e?.key) ?? [];
423
424
  await c?.membership?.updateMe(Object.fromEntries(Object.entries(e).filter(([e]) => n.includes(e))));
424
425
  },
425
426
  onMutate: () => p(""),
@@ -450,15 +451,15 @@ var K = ["levo-auth", "session"], Qe = () => {
450
451
  onSubmit: (e) => _.mutate(e)
451
452
  }) : null]
452
453
  }) : null;
453
- }, at = null, ot = /* @__PURE__ */ new Set(), st = (e) => {
454
- if (at !== e) {
455
- at = e;
456
- for (let e of ot) e();
454
+ }, ct = null, lt = /* @__PURE__ */ new Set(), ut = (e) => {
455
+ if (ct !== e) {
456
+ ct = e;
457
+ for (let e of lt) e();
457
458
  }
458
- }, ct = (e) => (ot.add(e), () => {
459
- ot.delete(e);
460
- }), lt = () => j(ct, () => at, () => null), ut = (e) => {
461
- let t = i(), n = z(), r = G(), { isLoggedIn: a, isLoaded: o } = Qe(), s = lt(), c = e.id?.trim() || "", { rules: l, invalid: u } = O(() => xe(e.access), [e.access]), d = O(() => Se(l), [l]), f = r && !!t && l.length > 0 && !u && !!c && a && !s, p = R({
459
+ }, dt = (e) => (lt.add(e), () => {
460
+ lt.delete(e);
461
+ }), ft = () => j(dt, () => ct, () => null), pt = (e) => {
462
+ let t = i(), n = z(), r = K(), { isLoggedIn: a, isLoaded: o } = tt(), s = ft(), c = e.id?.trim() || "", { rules: l, invalid: u } = O(() => we(e.access), [e.access]), d = O(() => Te(l), [l]), f = r && !!t && l.length > 0 && !u && !!c && a && !s, p = R({
462
463
  queryKey: ["levo-access", c],
463
464
  queryFn: async () => (await t?.fetch.url(`/v1/builder/page/${c}/check-access`).post().json())?.content?.data ?? null,
464
465
  enabled: f,
@@ -473,10 +474,10 @@ var K = ["levo-auth", "session"], Qe = () => {
473
474
  t
474
475
  ]);
475
476
  let m = w(() => {
476
- n.invalidateQueries({ queryKey: K }), n.invalidateQueries({ queryKey: ["levo-access", c] });
477
+ n.invalidateQueries({ queryKey: q }), n.invalidateQueries({ queryKey: ["levo-access", c] });
477
478
  }, [n, c]);
478
479
  return {
479
- ...De({
480
+ ...Ae({
480
481
  rules: l,
481
482
  invalid: u,
482
483
  pageId: c,
@@ -494,26 +495,26 @@ var K = ["levo-auth", "session"], Qe = () => {
494
495
  recheck: m,
495
496
  isChecking: p.isFetching
496
497
  };
497
- }, dt = "membership.account.ACCOUNT_PENDING_APPROVAL", ft = (e) => e ? e === "membership.account.ACCOUNT_PENDING_APPROVAL" || e.includes("ACCOUNT_PENDING_APPROVAL") : !1, pt = (e) => {
498
+ }, mt = "membership.account.ACCOUNT_PENDING_APPROVAL", ht = (e) => e ? e === "membership.account.ACCOUNT_PENDING_APPROVAL" || e.includes("ACCOUNT_PENDING_APPROVAL") : !1, gt = (e) => {
498
499
  let t = b(e);
499
500
  return {
500
501
  code: t?.code || "SOMETHING_WENT_WRONG",
501
502
  title: t?.title || "Something went wrong",
502
503
  message: t?.message || "Something went wrong. Please try again.",
503
504
  fieldErrors: Object.fromEntries((t?.fieldErrors ?? []).map((e) => [e.param, e.message])),
504
- isPendingApproval: ft(t?.code)
505
+ isPendingApproval: ht(t?.code)
505
506
  };
506
- }, mt = {
507
+ }, _t = {
507
508
  code: "site.NOT_CONNECTED",
508
509
  title: "Sign-in unavailable",
509
510
  message: "This site is not connected to an account system yet.",
510
511
  fieldErrors: {},
511
512
  isPendingApproval: !1
512
- }, ht = () => {
513
+ }, vt = () => {
513
514
  let e = i(), t = z(), n = w(async (t, n) => {
514
515
  if (!e?.membership) return {
515
516
  ok: !1,
516
- error: mt
517
+ error: _t
517
518
  };
518
519
  try {
519
520
  return {
@@ -524,7 +525,7 @@ var K = ["levo-auth", "session"], Qe = () => {
524
525
  let r = b(n);
525
526
  return e.logger?.error(t, { exception: r }), {
526
527
  ok: !1,
527
- error: pt(r)
528
+ error: gt(r)
528
529
  };
529
530
  }
530
531
  }, [e]), r = w(async ({ identifier: t, medium: n }) => {
@@ -537,7 +538,7 @@ var K = ["levo-auth", "session"], Qe = () => {
537
538
  content: r,
538
539
  code: i
539
540
  }) ?? null;
540
- return t.setQueryData(K, n), t.invalidateQueries({ queryKey: K }), n;
541
+ return t.setQueryData(q, n), t.invalidateQueries({ queryKey: q }), n;
541
542
  }) }), c = L({ mutationFn: (t) => n("Failed to send magic link", async () => {
542
543
  await e?.membership?.requestMagicLink({ content: t });
543
544
  }) });
@@ -551,11 +552,11 @@ var K = ["levo-auth", "session"], Qe = () => {
551
552
  isVerifying: s.isPending,
552
553
  isSendingMagicLink: c.isPending
553
554
  };
554
- }, gt = 700, _t = 500, vt = 700, yt = (e, t) => {
555
- let n = window.screenX + (window.outerWidth - _t) / 2, r = window.screenY + (window.outerHeight - vt) / 2.5;
556
- return window.open(e, t, `width=${_t},height=${vt},left=${n},top=${r}`);
557
- }, bt = ({ methods: e, title: t = "Sign in", onSuccess: n, onError: r }) => {
558
- let a = i(), o = z(), s = G(), [c, l] = A(null), [u, d] = A(null), f = k(null), p = k(void 0), m = k({
555
+ }, yt = 700, bt = 500, xt = 700, St = (e, t) => {
556
+ let n = window.screenX + (window.outerWidth - bt) / 2, r = window.screenY + (window.outerHeight - xt) / 2.5;
557
+ return window.open(e, t, `width=${bt},height=${xt},left=${n},top=${r}`);
558
+ }, Ct = ({ methods: e, title: t = "Sign in", onSuccess: n, onError: r }) => {
559
+ let a = i(), o = z(), s = K(), [c, l] = A(null), [u, d] = A(null), f = k(null), p = k(void 0), m = k({
559
560
  onSuccess: n,
560
561
  onError: r
561
562
  });
@@ -603,7 +604,7 @@ var K = ["levo-auth", "session"], Qe = () => {
603
604
  let n = t.get("code");
604
605
  if (!n) return;
605
606
  if (g(), n.toLowerCase() === "success") {
606
- d(null), o.invalidateQueries({ queryKey: K }), m.current.onSuccess?.();
607
+ d(null), o.invalidateQueries({ queryKey: q }), m.current.onSuccess?.();
607
608
  return;
608
609
  }
609
610
  let r = {
@@ -611,10 +612,10 @@ var K = ["levo-auth", "session"], Qe = () => {
611
612
  title: t.get("title") || "Sign-in failed",
612
613
  message: t.get("message") || "We could not sign you in. Please try again.",
613
614
  fieldErrors: {},
614
- isPendingApproval: ft(t.get("code"))
615
+ isPendingApproval: ht(t.get("code"))
615
616
  };
616
617
  r.isPendingApproval || d(r), m.current.onError?.(r);
617
- }, gt);
618
+ }, yt);
618
619
  }, [o, g]), v = O(() => {
619
620
  let e = h.data;
620
621
  if (!e || typeof window > "u") return {};
@@ -635,7 +636,7 @@ var K = ["levo-auth", "session"], Qe = () => {
635
636
  signIn: () => {
636
637
  let n = v[e];
637
638
  if (n) {
638
- if (d(null), f.current?.close(), f.current = yt(n, t), !f.current) {
639
+ if (d(null), f.current?.close(), f.current = St(n, t), !f.current) {
639
640
  d({
640
641
  code: "POPUP_BLOCKED",
641
642
  title: "Popup blocked",
@@ -659,10 +660,10 @@ var K = ["levo-auth", "session"], Qe = () => {
659
660
  error: u,
660
661
  clearError: w(() => d(null), [])
661
662
  };
662
- }, xt = 4, St = (e) => /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(e.trim()), Ct = (e) => (/* @__PURE__ */ RegExp("^\\d{4}$")).test(e.trim()), wt = (e) => {
663
+ }, wt = 4, Tt = (e) => /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(e.trim()), Et = (e) => (/* @__PURE__ */ RegExp("^\\d{4}$")).test(e.trim()), Dt = (e) => {
663
664
  let t = e.replace(/\D/g, "").replace(/^0+/, "");
664
665
  return t ? `+${t}` : "";
665
- }, Tt = (e) => /^\+[1-9]\d{7,14}$/.test(wt(e)), Et = ({ value: e, onChange: t, length: n = 4, onComplete: r, autoFocus: i, disabled: a }) => {
666
+ }, Ot = (e) => /^\+[1-9]\d{7,14}$/.test(Dt(e)), kt = ({ value: e, onChange: t, length: n = 4, onComplete: r, autoFocus: i, disabled: a }) => {
666
667
  let o = k([]), [s, c] = A(null), l = k(r);
667
668
  l.current = r;
668
669
  let u = Array.from({ length: n }, (t, n) => e[n] ?? ""), d = w((e) => {
@@ -746,11 +747,11 @@ var K = ["levo-auth", "session"], Qe = () => {
746
747
  },
747
748
  clear: w(() => f("", 0), [f])
748
749
  };
749
- }, Dt = C(() => import("./kbChat-eFsau7hG.js")), Ot = ({ site: e, path: t }) => {
750
- let n = G(), r = e.workspace_id || void 0;
750
+ }, At = C(() => import("./kbChat-eFsau7hG.js")), jt = ({ site: e, path: t }) => {
751
+ let n = K(), r = e.workspace_id || void 0;
751
752
  return !n || !r ? null : /* @__PURE__ */ N(x, {
752
753
  fallback: null,
753
- children: /* @__PURE__ */ N(Dt, {
754
+ children: /* @__PURE__ */ N(At, {
754
755
  workspaceId: r,
755
756
  siteName: e.name || void 0,
756
757
  siteLogo: void 0,
@@ -760,61 +761,94 @@ var K = ["levo-auth", "session"], Qe = () => {
760
761
  path: t
761
762
  })
762
763
  });
763
- }, kt = "(prefers-color-scheme: dark)", At = (e) => {
764
+ }, Mt = "(prefers-color-scheme: dark)", Nt = (e) => {
764
765
  try {
765
766
  let t = localStorage.getItem(e);
766
767
  return t === "light" || t === "dark" || t === "system" ? t : null;
767
768
  } catch {
768
769
  return null;
769
770
  }
770
- }, jt = (e, t) => {
771
+ }, Pt = (e, t) => {
771
772
  try {
772
773
  localStorage.setItem(e, t);
773
774
  } catch {}
774
775
  };
775
- function Mt(e, t) {
776
- return `(function(){try{var t=localStorage.getItem(${JSON.stringify(e)});if(t!=='light'&&t!=='dark'&&t!=='system'){t=${JSON.stringify(t)}}var d=matchMedia('${kt}').matches;var r=t==='system'?(d?'dark':'light'):t;var e=document.documentElement;e.classList.remove('light','dark');e.classList.add(r);e.style.colorScheme=r}catch(e){}})();`;
776
+ function Ft(e, t) {
777
+ return `(function(){try{var t=localStorage.getItem(${JSON.stringify(e)});if(t!=='light'&&t!=='dark'&&t!=='system'){t=${JSON.stringify(t)}}var d=matchMedia('${Mt}').matches;var r=t==='system'?(d?'dark':'light'):t;var e=document.documentElement;e.classList.remove('light','dark');e.classList.add(r);e.style.colorScheme=r}catch(e){}})();`;
777
778
  }
778
- var Nt = S(void 0), Pt = (e) => e === "system" ? window.matchMedia(kt).matches ? "dark" : "light" : e;
779
- function Ft(e) {
779
+ var It = S(void 0), Lt = (e) => e === "system" ? window.matchMedia(Mt).matches ? "dark" : "light" : e;
780
+ function Rt(e) {
780
781
  let t = document.documentElement;
781
782
  t.classList.remove("light", "dark"), t.classList.add(e), t.style.colorScheme = e;
782
783
  }
783
- var It = ({ children: e, defaultMode: t = "system", storageKey: n = "color-mode" }) => {
784
- let [r, i] = A(t), [a, o] = A(t === "dark" ? "dark" : "light"), s = G();
784
+ var zt = ({ children: e, defaultMode: t = "system", storageKey: n = "color-mode" }) => {
785
+ let [r, i] = A(t), [a, o] = A(t === "dark" ? "dark" : "light"), s = K();
785
786
  return E(() => {
786
- i(At(n) ?? t);
787
+ i(Nt(n) ?? t);
787
788
  }, [t, n]), E(() => {
788
789
  if (!s) return;
789
- let e = Pt(r);
790
- Ft(e), o(e);
790
+ let e = Lt(r);
791
+ Rt(e), o(e);
791
792
  }, [r, s]), E(() => {
792
793
  if (!s || r !== "system") return;
793
- let e = window.matchMedia(kt), t = () => {
794
+ let e = window.matchMedia(Mt), t = () => {
794
795
  let t = e.matches ? "dark" : "light";
795
- Ft(t), o(t);
796
+ Rt(t), o(t);
796
797
  };
797
798
  return e.addEventListener("change", t), () => e.removeEventListener("change", t);
798
- }, [r, s]), /* @__PURE__ */ P(Nt.Provider, {
799
+ }, [r, s]), /* @__PURE__ */ P(It.Provider, {
799
800
  value: {
800
801
  mode: r,
801
802
  resolvedMode: a,
802
803
  setMode: (e) => {
803
- jt(n, e), i(e);
804
+ Pt(n, e), i(e);
804
805
  }
805
806
  },
806
- children: [/* @__PURE__ */ N(te, { children: Mt(n, t) }), e]
807
+ children: [/* @__PURE__ */ N(B, { children: Ft(n, t) }), e]
807
808
  });
808
809
  };
809
- function Lt() {
810
- let e = T(Nt);
810
+ function Bt() {
811
+ let e = T(It);
811
812
  if (e === void 0) throw Error("useColorMode must be used within a ColorModeProvider");
812
813
  return e;
813
814
  }
814
815
  //#endregion
815
- //#region src/form/LevoForm.tsx
816
- var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant: a = "default", successConfig: o, theme: s, className: c, defaultValues: l, disabled: u, showSuccessScreen: d = !0, onSuccess: f, onError: p }) => {
817
- let m = i(), { schema: h, isLoading: g, bind: _ } = qe(e), v = Ze(s);
816
+ //#region src/form/LevoEditForm.tsx
817
+ var Vt = (e, t) => !e.hidden && !t?.includes(e.key) && !t?.includes(e.id) && e.allow_public_view !== !1 && e.allow_public_submit !== !1, Ht = ({ source: t, initialValues: n, onSubmit: r, isLoading: i, hiddenFields: a, submitLabel: o = "Save changes", theme: s, className: c }) => {
818
+ let { schema: l, bind: u } = Xe(t), d = et(s), f = O(() => l ? {
819
+ ...l,
820
+ sections: l.sections?.map((e) => ({
821
+ ...e,
822
+ fields: e.fields?.map((e) => ({
823
+ ...e,
824
+ hidden: !Vt(e, a)
825
+ }))
826
+ }))
827
+ } : null, [l, a?.join("|") ?? ""]), p = (e) => {
828
+ let t = l?.sections?.flatMap((e) => e?.fields ?? []).filter((e) => Vt(e, a)).map((e) => e.key) ?? [];
829
+ r(Object.fromEntries(Object.entries(e).filter(([e]) => t.includes(e))));
830
+ };
831
+ return /* @__PURE__ */ N("div", {
832
+ ...u,
833
+ className: c,
834
+ children: f ? /* @__PURE__ */ N(e, {
835
+ schema: f,
836
+ initialValues: n ?? {},
837
+ uiConfig: {
838
+ hideFormHeading: !0,
839
+ hideSectionHeadings: !0
840
+ },
841
+ submitButtonConfig: {
842
+ show: !0,
843
+ text: o
844
+ },
845
+ theme: { style: d },
846
+ isLoading: i,
847
+ onSubmit: (e) => p(e)
848
+ }) : null
849
+ });
850
+ }, Ut = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant: a = "default", successConfig: o, theme: s, className: c, defaultValues: l, disabled: u, showSuccessScreen: d = !0, onSuccess: f, onError: p }) => {
851
+ let m = i(), { schema: h, isLoading: g, bind: _ } = Xe(e), v = et(s);
818
852
  return m ? /* @__PURE__ */ N("div", {
819
853
  ..._,
820
854
  className: c,
@@ -844,28 +878,28 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
844
878
  onError: p
845
879
  })
846
880
  }) : null;
847
- }, zt = 1400, Bt = 12 * 1024 * 1024, Vt = new Set(["transparent", "rgba(0, 0, 0, 0)"]), Ht = {
881
+ }, Wt = 1400, Gt = 12 * 1024 * 1024, Kt = new Set(["transparent", "rgba(0, 0, 0, 0)"]), qt = {
848
882
  imagePlaceholder: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=",
849
883
  onImageErrorHandler: () => void 0
850
- }, Ut = (e) => {
884
+ }, Jt = (e) => {
851
885
  let t = getComputedStyle(e);
852
- return !Vt.has(t.backgroundColor) || t.backgroundImage !== "none";
853
- }, Wt = (e) => {
886
+ return !Kt.has(t.backgroundColor) || t.backgroundImage !== "none";
887
+ }, Yt = (e) => {
854
888
  for (let t = e; t; t = t.parentElement) {
855
889
  let e = getComputedStyle(t).backgroundColor;
856
- if (!Vt.has(e)) return e;
890
+ if (!Kt.has(e)) return e;
857
891
  }
858
892
  return "#ffffff";
859
- }, Gt = async (e, t) => {
860
- let { toPng: n } = await import("./es-CK20DkgT.js"), r = e.getBoundingClientRect(), i = Math.max(r.width, r.height, 1), a = Math.min(2, Math.max(.4, zt / i)), o = await n(e, {
861
- ...Ht,
893
+ }, Xt = async (e, t) => {
894
+ let { toPng: n } = await import("./es-CK20DkgT.js"), r = e.getBoundingClientRect(), i = Math.max(r.width, r.height, 1), a = Math.min(2, Math.max(.4, Wt / i)), o = await n(e, {
895
+ ...qt,
862
896
  pixelRatio: a,
863
- backgroundColor: Wt(e),
897
+ backgroundColor: Yt(e),
864
898
  filter: (e) => !t.includes(e)
865
899
  });
866
- if (o.length > Bt) throw Error("capture too large");
900
+ if (o.length > Gt) throw Error("capture too large");
867
901
  return o;
868
- }, Kt = 4, qt = 4e3, Jt = (e, t) => {
902
+ }, Zt = 4, Qt = 4e3, $t = (e, t) => {
869
903
  let n = document.elementFromPoint(e.x + e.width / 2, e.y + e.height / 2);
870
904
  for (; n && t.includes(n);) n = n.parentElement;
871
905
  let r = document.body;
@@ -876,8 +910,8 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
876
910
  break;
877
911
  }
878
912
  }
879
- let i = window.innerWidth * window.innerHeight * Kt || 2 ** 53 - 1, a = r;
880
- for (; !Ut(a);) {
913
+ let i = window.innerWidth * window.innerHeight * Zt || 2 ** 53 - 1, a = r;
914
+ for (; !Jt(a);) {
881
915
  let e = a.parentElement;
882
916
  if (!e || e === document.documentElement) break;
883
917
  let t = e.getBoundingClientRect();
@@ -885,13 +919,13 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
885
919
  a = e;
886
920
  }
887
921
  return a;
888
- }, Yt = async (e, t) => {
889
- let { toCanvas: n } = await import("./es-CK20DkgT.js"), r = Jt(e, t), i = r.getBoundingClientRect(), a = Math.max(e.width, e.height, 1), o = Math.min(2, Math.max(.4, zt / a)), s = Math.max(i.width, i.height, 1);
890
- o = Math.min(o, qt / s);
922
+ }, en = async (e, t) => {
923
+ let { toCanvas: n } = await import("./es-CK20DkgT.js"), r = $t(e, t), i = r.getBoundingClientRect(), a = Math.max(e.width, e.height, 1), o = Math.min(2, Math.max(.4, Wt / a)), s = Math.max(i.width, i.height, 1);
924
+ o = Math.min(o, Qt / s);
891
925
  let c = await n(r, {
892
- ...Ht,
926
+ ...qt,
893
927
  pixelRatio: o,
894
- backgroundColor: Wt(r),
928
+ backgroundColor: Yt(r),
895
929
  filter: (e) => !t.includes(e)
896
930
  }), l = document.createElement("canvas");
897
931
  l.width = Math.max(1, Math.round(e.width * o)), l.height = Math.max(1, Math.round(e.height * o));
@@ -899,9 +933,9 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
899
933
  if (!u) throw Error("no 2d context");
900
934
  u.drawImage(c, (e.x - i.left) * o, (e.y - i.top) * o, e.width * o, e.height * o, 0, 0, l.width, l.height);
901
935
  let d = l.toDataURL("image/png");
902
- if (d.length > Bt) throw Error("capture too large");
936
+ if (d.length > Gt) throw Error("capture too large");
903
937
  return d;
904
- }, q = {
938
+ }, tn = {
905
939
  ring: 99997,
906
940
  overlay: 99998,
907
941
  label: 99999
@@ -914,24 +948,24 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
914
948
  }, Y = (e) => {
915
949
  let t = e?.getAttribute("data-tsd-source");
916
950
  return t ? t.replace(/^\//, "") : null;
917
- }, Xt = (e) => Array.from(document.querySelectorAll("[data-tsd-source]")).filter((t) => Y(t) === e), Zt = (e, t) => {
918
- let n = Xt(t).indexOf(e);
951
+ }, nn = (e) => Array.from(document.querySelectorAll("[data-tsd-source]")).filter((t) => Y(t) === e), rn = (e, t) => {
952
+ let n = nn(t).indexOf(e);
919
953
  return n < 0 ? 0 : n;
920
- }, X = (e, t = 0) => {
921
- let n = Xt(e);
954
+ }, an = (e, t = 0) => {
955
+ let n = nn(e);
922
956
  return n[t] ?? n[0] ?? null;
923
- }, Qt = (e, t) => {
957
+ }, on = (e, t) => {
924
958
  let n = (e.getAttribute("data-staged-key") || "").split(/\s+/).filter(Boolean);
925
959
  n.includes(t) || e.setAttribute("data-staged-key", [...n, t].join(" "));
926
- }, $t = (e, t) => {
960
+ }, sn = (e, t) => {
927
961
  let n = (e.getAttribute("data-staged-key") || "").split(/\s+/).filter((e) => e && e !== t);
928
962
  n.length ? e.setAttribute("data-staged-key", n.join(" ")) : e.removeAttribute("data-staged-key");
929
- }, en = (e, t) => {
963
+ }, cn = (e, t) => {
930
964
  let n = Object.entries(t.styles).filter(([e]) => /^-?[a-zA-Z][a-zA-Z0-9-]*$/.test(e)).map(([e, t]) => `${e}:${String(t).replace(/[;{}]/g, "")} !important;`).join("");
931
965
  if (!n) return "";
932
966
  let r = `[data-staged-key~="${CSS.escape(e)}"]{${n}}`, i = t.media?.replace(/[;{}]/g, "").trim();
933
967
  return i ? `@media ${i}{${r}}` : r;
934
- }, tn = (e) => {
968
+ }, ln = (e) => {
935
969
  let t = e.tagName.toLowerCase();
936
970
  return t === "input" ? {
937
971
  checkbox: "Checkbox",
@@ -973,31 +1007,31 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
973
1007
  aside: "Sidebar",
974
1008
  div: "Container"
975
1009
  }[t] || `${t.charAt(0).toUpperCase()}${t.slice(1)}`;
976
- }, nn = 36, rn = (e) => {
977
- let t = tn(e), n = ((e) => e.replace(/\s+/g, " ").trim())(e.getAttribute("aria-label") || e.getAttribute("alt") || e.getAttribute("title") || e.getAttribute("name") || "");
978
- return n ? `${t} · ${n.length > nn ? `${n.slice(0, nn - 1).trimEnd()}…` : n}` : t;
979
- }, an = (e) => {
1010
+ }, un = 36, dn = (e) => {
1011
+ let t = ln(e), n = ((e) => e.replace(/\s+/g, " ").trim())(e.getAttribute("aria-label") || e.getAttribute("alt") || e.getAttribute("title") || e.getAttribute("name") || "");
1012
+ return n ? `${t} · ${n.length > un ? `${n.slice(0, un - 1).trimEnd()}…` : n}` : t;
1013
+ }, fn = (e) => {
980
1014
  let t = [], n = e;
981
1015
  for (; n && n.nodeType === 1 && n !== document.body && t.length < 8;) t.unshift(n.tagName.toLowerCase()), n = n.parentElement;
982
1016
  return t.join(" > ");
983
- }, on = () => {
1017
+ }, pn = () => {
984
1018
  let e = document.createElement("div");
985
- e.style.cssText = `position:fixed;pointer-events:none;z-index:${q.overlay};background:${J.hoverBg};outline:2px solid ${J.hover};border-radius:2px;display:none`;
1019
+ e.style.cssText = `position:fixed;pointer-events:none;z-index:${tn.overlay};background:${J.hoverBg};outline:2px solid ${J.hover};border-radius:2px;display:none`;
986
1020
  let t = document.createElement("div");
987
- t.style.cssText = `position:fixed;pointer-events:none;z-index:${q.label};background:${J.hoverLabelBg};color:#fff;font:11px/1.6 ui-monospace,monospace;padding:1px 6px;border-radius:4px;display:none;max-width:70vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis`;
1021
+ t.style.cssText = `position:fixed;pointer-events:none;z-index:${tn.label};background:${J.hoverLabelBg};color:#fff;font:11px/1.6 ui-monospace,monospace;padding:1px 6px;border-radius:4px;display:none;max-width:70vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis`;
988
1022
  let n = document.createElement("div");
989
- n.style.cssText = `position:fixed;pointer-events:none;z-index:${q.ring};outline:2px solid ${J.select};outline-offset:1px;border-radius:3px;box-shadow:0 0 0 4px ${J.selectGlow};display:none`;
1023
+ n.style.cssText = `position:fixed;pointer-events:none;z-index:${tn.ring};outline:2px solid ${J.select};outline-offset:1px;border-radius:3px;box-shadow:0 0 0 4px ${J.selectGlow};display:none`;
990
1024
  let r = document.createElement("div");
991
- return r.style.cssText = `position:fixed;pointer-events:none;z-index:${q.label};background:${J.select};color:#fff;font:11px/1.6 ui-monospace,monospace;padding:1px 6px;border-radius:4px;display:none;max-width:70vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis`, {
1025
+ return r.style.cssText = `position:fixed;pointer-events:none;z-index:${tn.label};background:${J.select};color:#fff;font:11px/1.6 ui-monospace,monospace;padding:1px 6px;border-radius:4px;display:none;max-width:70vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis`, {
992
1026
  overlay: e,
993
1027
  label: t,
994
1028
  ring: n,
995
1029
  ringLabel: r
996
1030
  };
997
- }, sn = (e, t, n) => {
1031
+ }, mn = (e, t, n) => {
998
1032
  let r = n.getBoundingClientRect();
999
- e.style.display = "block", e.style.left = `${r.left}px`, e.style.top = `${r.top}px`, e.style.width = `${r.width}px`, e.style.height = `${r.height}px`, t.style.display = "block", t.textContent = rn(n), t.style.left = `${Math.max(4, r.left)}px`, t.style.top = `${r.top > 26 ? r.top - 22 : r.bottom + 4}px`;
1000
- }, cn = (e) => {
1033
+ e.style.display = "block", e.style.left = `${r.left}px`, e.style.top = `${r.top}px`, e.style.width = `${r.width}px`, e.style.height = `${r.height}px`, t.style.display = "block", t.textContent = dn(n), t.style.left = `${Math.max(4, r.left)}px`, t.style.top = `${r.top > 26 ? r.top - 22 : r.bottom + 4}px`;
1034
+ }, hn = (e) => {
1001
1035
  let t = (e instanceof Element ? e : null)?.closest("a[href]");
1002
1036
  if (!t || t.target === "_blank") return null;
1003
1037
  let n;
@@ -1007,11 +1041,11 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1007
1041
  return null;
1008
1042
  }
1009
1043
  return n.protocol !== "http:" && n.protocol !== "https:" || n.origin === location.origin ? null : n.href;
1010
- }, ln = (e) => {
1044
+ }, gn = (e) => {
1011
1045
  if (!e) return !1;
1012
1046
  let t = e.tagName;
1013
1047
  return t === "INPUT" || t === "TEXTAREA" || t === "SELECT" || e.isContentEditable === !0;
1014
- }, un = (e) => {
1048
+ }, _n = (e) => {
1015
1049
  if (!e.childNodes.length) return !1;
1016
1050
  let t = !1;
1017
1051
  for (let n of e.childNodes) {
@@ -1019,7 +1053,7 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1019
1053
  (n.textContent ?? "").trim() && (t = !0);
1020
1054
  }
1021
1055
  return t;
1022
- }, dn = 2e3, fn = (e) => {
1056
+ }, vn = 2e3, yn = (e) => {
1023
1057
  let t = [], n = e;
1024
1058
  for (; n && n.nodeType === 1 && n !== document.body && t.length < 8;) {
1025
1059
  let e = Y(n);
@@ -1030,22 +1064,22 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1030
1064
  }), n = n.parentElement;
1031
1065
  }
1032
1066
  return t;
1033
- }, pn = (e) => {
1034
- let t = Y(e), n = t ? Xt(t).length : 1, r = t ? Zt(e, t) : 0, i = t && un(e) ? (e.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, dn) : void 0, a = mn(e);
1067
+ }, bn = (e) => {
1068
+ let t = Y(e), n = t ? nn(t).length : 1, r = t ? rn(e, t) : 0, i = t && _n(e) ? (e.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, vn) : void 0, a = xn(e);
1035
1069
  return {
1036
1070
  tag: e.tagName.toLowerCase(),
1037
1071
  classes: typeof e.className == "string" ? e.className.trim() : "",
1038
1072
  text: (e.innerText || "").trim().slice(0, 120),
1039
- label: rn(e),
1040
- path: an(e),
1073
+ label: dn(e),
1074
+ path: fn(e),
1041
1075
  source: t,
1042
1076
  index: r,
1043
1077
  occurrences: n,
1044
- ancestors: fn(e),
1078
+ ancestors: yn(e),
1045
1079
  ...i === void 0 ? {} : { fullText: i },
1046
1080
  ...a ? { sourceBinding: a } : {}
1047
1081
  };
1048
- }, mn = (e) => {
1082
+ }, xn = (e) => {
1049
1083
  let t = e.closest("[data-levo-source]");
1050
1084
  if (!t) return;
1051
1085
  let n = t.getAttribute("data-levo-source") ?? "", r = Y(t), i;
@@ -1058,11 +1092,11 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1058
1092
  raw: n,
1059
1093
  element: {
1060
1094
  source: r ?? "",
1061
- index: r ? Zt(t, r) : 0
1095
+ index: r ? rn(t, r) : 0
1062
1096
  },
1063
1097
  ...i === void 0 ? {} : { config: i }
1064
1098
  };
1065
- }, hn = () => Array.from(document.querySelectorAll("[data-levo-source]")).map((e) => {
1099
+ }, Sn = () => Array.from(document.querySelectorAll("[data-levo-source]")).map((e) => {
1066
1100
  let t = e.getAttribute("data-levo-source") ?? "", n = Y(e), r;
1067
1101
  try {
1068
1102
  r = JSON.parse(t);
@@ -1073,18 +1107,18 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1073
1107
  raw: t,
1074
1108
  element: {
1075
1109
  source: n ?? "",
1076
- index: n ? Zt(e, n) : 0
1110
+ index: n ? rn(e, n) : 0
1077
1111
  },
1078
1112
  tag: e.tagName.toLowerCase(),
1079
- label: rn(e),
1113
+ label: dn(e),
1080
1114
  ...r === void 0 ? {} : { config: r }
1081
1115
  };
1082
- }), gn = 14, _n = 2e3, vn = 100, yn = 48, bn = new Set([
1116
+ }), Cn = 14, wn = 2e3, Tn = 100, En = 48, Dn = new Set([
1083
1117
  "script",
1084
1118
  "style",
1085
1119
  "template",
1086
1120
  "noscript"
1087
- ]), xn = (e, t) => t.includes(e) || e.id === "studio-staged" || bn.has(e.tagName.toLowerCase()), Sn = (e) => {
1121
+ ]), On = (e, t) => t.includes(e) || e.id === "studio-staged" || Dn.has(e.tagName.toLowerCase()), kn = (e) => {
1088
1122
  let t = !1, n = 0, r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
1089
1123
  for (let e of Array.from(document.querySelectorAll("[data-tsd-source]"))) {
1090
1124
  let t = Y(e);
@@ -1096,11 +1130,11 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1096
1130
  for (let t of e.childNodes) {
1097
1131
  if (t.nodeType !== 3) continue;
1098
1132
  let e = (t.textContent ?? "").replace(/\s+/g, " ").trim();
1099
- if (e) return e.length > yn ? `${e.slice(0, yn).trimEnd()}…` : e;
1133
+ if (e) return e.length > En ? `${e.slice(0, En).trimEnd()}…` : e;
1100
1134
  }
1101
1135
  }, o = (i, s) => {
1102
1136
  n++;
1103
- let c = Y(i), l = a(i), u = Array.from(i.children).filter((t) => !xn(t, e)), d = {
1137
+ let c = Y(i), l = a(i), u = Array.from(i.children).filter((t) => !On(t, e)), d = {
1104
1138
  tag: i.tagName.toLowerCase(),
1105
1139
  ...c ? {
1106
1140
  source: c,
@@ -1111,9 +1145,9 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1111
1145
  childCount: u.length,
1112
1146
  children: []
1113
1147
  };
1114
- if (s >= gn) return u.length && (t = !0), d;
1148
+ if (s >= Cn) return u.length && (t = !0), d;
1115
1149
  for (let e of u) {
1116
- if (d.children.length >= vn || n >= _n) {
1150
+ if (d.children.length >= Tn || n >= wn) {
1117
1151
  t = !0;
1118
1152
  break;
1119
1153
  }
@@ -1125,7 +1159,7 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1125
1159
  tree: o(document.body, 0),
1126
1160
  truncated: t
1127
1161
  };
1128
- }, Cn = () => {
1162
+ }, An = () => {
1129
1163
  let e = null;
1130
1164
  return {
1131
1165
  send: (t) => {
@@ -1140,7 +1174,7 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1140
1174
  return !0;
1141
1175
  }
1142
1176
  };
1143
- }, wn = (e) => {
1177
+ }, jn = (e) => {
1144
1178
  let t = location.pathname, n = () => {
1145
1179
  location.pathname !== t && (t = location.pathname, e.onPathChange());
1146
1180
  }, r = !1;
@@ -1160,23 +1194,23 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1160
1194
  e.__inspectorPatched && e.__orig && (history.pushState = e.__orig), t.__inspectorPatched && t.__orig && (history.replaceState = t.__orig);
1161
1195
  }
1162
1196
  } };
1163
- }, Tn = !1, En = /* @__PURE__ */ new Set(), Dn = () => {
1164
- if (!Tn) {
1165
- Tn = !0;
1166
- for (let e of En) e();
1197
+ }, Mn = !1, Nn = /* @__PURE__ */ new Set(), Pn = () => {
1198
+ if (!Mn) {
1199
+ Mn = !0;
1200
+ for (let e of Nn) e();
1167
1201
  }
1168
- }, On = (e) => (En.add(e), () => {
1169
- En.delete(e);
1170
- }), kn = () => j(On, () => Tn, () => !1), An = (e) => {
1202
+ }, Fn = (e) => (Nn.add(e), () => {
1203
+ Nn.delete(e);
1204
+ }), In = () => j(Fn, () => Mn, () => !1), Ln = (e) => {
1171
1205
  let { channel: t, originals: n, staged: r } = e, i = t.send, a = null;
1172
1206
  return { onMessage: (o) => {
1173
1207
  let s = o.data;
1174
1208
  if (!(!s || s.source !== "web-chat") && t.acceptOrigin(o)) {
1175
- if (Dn(), s.type === "set-access-preview") st(s.stage ?? null);
1209
+ if (Pn(), s.type === "set-access-preview") ut(s.stage ?? null);
1176
1210
  else if (s.type === "set-inspect") e.setInspect(s.enabled);
1177
1211
  else if (s.type === "set-text-edit") e.setTextEdit(s.enabled);
1178
1212
  else if (s.type === "revert-text") {
1179
- let e = String(s.element?.source || ""), t = Number.isInteger(s.element?.index) ? s.element.index : 0, r = n.restore(`${e}#${t}`), i = r == null ? null : X(e, t);
1213
+ let e = String(s.element?.source || ""), t = Number.isInteger(s.element?.index) ? s.element.index : 0, r = n.restore(`${e}#${t}`), i = r == null ? null : an(e, t);
1180
1214
  i && r != null && (i.textContent = r);
1181
1215
  } else if (s.type === "stage-style") {
1182
1216
  let t = String(s.stageId || ""), n = String(s.element?.source || ""), a = Number.isInteger(s.element?.index) ? s.element.index : 0, o = s.styles && typeof s.styles == "object" ? s.styles : null;
@@ -1235,7 +1269,7 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1235
1269
  }
1236
1270
  e.syncDomObserver();
1237
1271
  } else if (s.type === "select-element") {
1238
- let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? X(t, n) : null;
1272
+ let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? an(t, n) : null;
1239
1273
  if (!r) {
1240
1274
  i({
1241
1275
  type: "select-miss",
@@ -1251,10 +1285,10 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1251
1285
  behavior: "smooth"
1252
1286
  }), i({
1253
1287
  type: "element-selected",
1254
- element: pn(r)
1288
+ element: bn(r)
1255
1289
  });
1256
1290
  } else if (s.type === "edit-element") {
1257
- let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? X(t, n) : null;
1291
+ let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? an(t, n) : null;
1258
1292
  if (!r) {
1259
1293
  i({
1260
1294
  type: "select-miss",
@@ -1270,12 +1304,12 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1270
1304
  behavior: "smooth"
1271
1305
  }), i({
1272
1306
  type: "element-selected",
1273
- element: pn(r)
1307
+ element: bn(r)
1274
1308
  }), e.isTextEditing() || e.setTextEdit(!0);
1275
1309
  let o = e.editableTarget(r);
1276
1310
  o && e.startEditAtEnd(o);
1277
1311
  } else if (s.type === "highlight-element") {
1278
- let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? X(t, n) : null;
1312
+ let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? an(t, n) : null;
1279
1313
  if (!r) a = null, e.hideTextHover(), i({
1280
1314
  type: "highlight-miss",
1281
1315
  element: {
@@ -1293,7 +1327,7 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1293
1327
  }
1294
1328
  } else if (s.type === "clear-highlight") a && (a = null, !e.isInspecting() && !e.editingNode() && e.hideTextHover());
1295
1329
  else if (s.type === "request-layers") {
1296
- let { tree: t, truncated: n } = Sn(e.ownNodes);
1330
+ let { tree: t, truncated: n } = kn(e.ownNodes);
1297
1331
  i({
1298
1332
  type: "layers-tree",
1299
1333
  tree: t,
@@ -1301,7 +1335,7 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1301
1335
  });
1302
1336
  } else if (s.type === "request-sources") i({
1303
1337
  type: "sources-list",
1304
- sources: hn()
1338
+ sources: Sn()
1305
1339
  });
1306
1340
  else if (s.type === "capture-selected") {
1307
1341
  let t = String(s.requestId || "");
@@ -1316,7 +1350,7 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1316
1350
  });
1317
1351
  return;
1318
1352
  }
1319
- Gt(n, e.ownNodes).then((e) => {
1353
+ Xt(n, e.ownNodes).then((e) => {
1320
1354
  console.info(`[levo-inspector] element capture ok <${n.tagName.toLowerCase()}> (${Math.round(e.length / 1024)}kB)`), i({
1321
1355
  type: "capture-result",
1322
1356
  requestId: t,
@@ -1337,7 +1371,7 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1337
1371
  }
1338
1372
  }
1339
1373
  } };
1340
- }, jn = () => {
1374
+ }, Rn = () => {
1341
1375
  let e = /* @__PURE__ */ new Map(), t = () => {
1342
1376
  if (e.size > 50) {
1343
1377
  let t = e.keys().next().value;
@@ -1357,31 +1391,31 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1357
1391
  return e.delete(t), n;
1358
1392
  }
1359
1393
  };
1360
- }, Mn = 6, Nn = 12, Pn = 12, Fn = .6, In = (e, t, n, r) => ({
1394
+ }, zn = 6, Bn = 12, Vn = 12, Hn = .6, Un = (e, t, n, r) => ({
1361
1395
  x: Math.min(e, n),
1362
1396
  y: Math.min(t, r),
1363
1397
  width: Math.abs(n - e),
1364
1398
  height: Math.abs(r - t)
1365
- }), Ln = (e, t) => {
1399
+ }), Wn = (e, t) => {
1366
1400
  let n = e.x + e.width, r = e.y + e.height, i = [];
1367
1401
  for (let a of Array.from(document.querySelectorAll("[data-tsd-source]"))) {
1368
1402
  if (t.includes(a)) continue;
1369
1403
  let o = a.getBoundingClientRect(), s = o.width * o.height;
1370
- s <= 0 || Math.max(0, Math.min(n, o.right) - Math.max(e.x, o.left)) * Math.max(0, Math.min(r, o.bottom) - Math.max(e.y, o.top)) / s >= Fn && i.push(a);
1404
+ s <= 0 || Math.max(0, Math.min(n, o.right) - Math.max(e.x, o.left)) * Math.max(0, Math.min(r, o.bottom) - Math.max(e.y, o.top)) / s >= Hn && i.push(a);
1371
1405
  }
1372
1406
  let a = new Set(i), o = i.filter((e) => {
1373
1407
  for (let t = e.parentElement; t; t = t.parentElement) if (a.has(t)) return !1;
1374
1408
  return !0;
1375
- }), s = o.length > Pn, c = [], l = [];
1376
- for (let e of o.slice(0, Pn)) {
1409
+ }), s = o.length > Vn, c = [], l = [];
1410
+ for (let e of o.slice(0, Vn)) {
1377
1411
  let t = Y(e);
1378
1412
  if (!t) continue;
1379
1413
  let n = (e.innerText || "").replace(/\s+/g, " ").trim().slice(0, 80);
1380
1414
  c.push({
1381
1415
  source: t,
1382
- index: Zt(e, t),
1416
+ index: rn(e, t),
1383
1417
  tag: e.tagName.toLowerCase(),
1384
- label: rn(e),
1418
+ label: dn(e),
1385
1419
  ...n ? { text: n } : {}
1386
1420
  }), l.push(e);
1387
1421
  }
@@ -1390,12 +1424,12 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1390
1424
  nodes: l,
1391
1425
  truncated: s
1392
1426
  };
1393
- }, Rn = () => Array.from({ length: Pn }, () => {
1427
+ }, Gn = () => Array.from({ length: Vn }, () => {
1394
1428
  let e = document.createElement("div");
1395
- return e.style.cssText = `position:fixed;pointer-events:none;z-index:${q.ring};outline:1.5px solid ${J.select};outline-offset:1px;border-radius:3px;box-shadow:0 0 0 3px ${J.selectGlow};display:none`, e;
1396
- }), zn = () => {
1429
+ return e.style.cssText = `position:fixed;pointer-events:none;z-index:${tn.ring};outline:1.5px solid ${J.select};outline-offset:1px;border-radius:3px;box-shadow:0 0 0 3px ${J.selectGlow};display:none`, e;
1430
+ }), Kn = () => {
1397
1431
  let e = document.createElement("div");
1398
- e.style.cssText = `position:fixed;pointer-events:none;z-index:${q.overlay};border:1.5px dashed ${J.select};background:${J.selectGlow};border-radius:2px;display:none`;
1432
+ e.style.cssText = `position:fixed;pointer-events:none;z-index:${tn.overlay};border:1.5px dashed ${J.select};background:${J.selectGlow};border-radius:2px;display:none`;
1399
1433
  let t = null, n = !1, r = 0, i = 0, a = () => {
1400
1434
  e.style.display = "none";
1401
1435
  };
@@ -1410,31 +1444,31 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1410
1444
  pointerMove: (a, o) => {
1411
1445
  if (!t) return;
1412
1446
  if (a = Math.min(Math.max(0, a), window.innerWidth), o = Math.min(Math.max(0, o), window.innerHeight), r = a, i = o, !n) {
1413
- if (Math.abs(a - t.x) < Mn && Math.abs(o - t.y) < Mn) return;
1447
+ if (Math.abs(a - t.x) < zn && Math.abs(o - t.y) < zn) return;
1414
1448
  n = !0;
1415
1449
  }
1416
- let s = In(t.x, t.y, a, o);
1450
+ let s = Un(t.x, t.y, a, o);
1417
1451
  e.style.display = "block", e.style.left = `${s.x}px`, e.style.top = `${s.y}px`, e.style.width = `${s.width}px`, e.style.height = `${s.height}px`;
1418
1452
  },
1419
1453
  pointerUp: () => {
1420
1454
  let e = n, o = t;
1421
1455
  if (t = null, n = !1, a(), !e || !o) return null;
1422
- let s = In(o.x, o.y, r, i);
1423
- return s.width < Nn || s.height < Nn ? null : s;
1456
+ let s = Un(o.x, o.y, r, i);
1457
+ return s.width < Bn || s.height < Bn ? null : s;
1424
1458
  },
1425
1459
  cancel: () => {
1426
1460
  t = null, n = !1, a();
1427
1461
  },
1428
1462
  isDragging: () => n
1429
1463
  };
1430
- }, Bn = (e) => {
1464
+ }, qn = (e) => {
1431
1465
  let { originals: t, editingNode: n } = e, r = /* @__PURE__ */ new Map(), i = () => {
1432
1466
  let e = document.getElementById("studio-staged");
1433
1467
  return e || (e = document.createElement("style"), e.id = "studio-staged", document.head.appendChild(e)), e;
1434
1468
  }, a = () => {
1435
1469
  let e = [];
1436
1470
  for (let [t, n] of r) if (n.kind === "style") {
1437
- let r = en(t, n);
1471
+ let r = cn(t, n);
1438
1472
  r && e.push(r);
1439
1473
  }
1440
1474
  let t = e.join("\n");
@@ -1442,8 +1476,8 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1442
1476
  let n = i();
1443
1477
  n.textContent !== t && (n.textContent = t);
1444
1478
  }, o = (e, r) => {
1445
- let i = X(r.source, r.index);
1446
- if (i) if (r.kind === "style") Qt(i, e);
1479
+ let i = an(r.source, r.index);
1480
+ if (i) if (r.kind === "style") on(i, e);
1447
1481
  else if (r.kind === "image") t.captureOnce(`${r.source}#${r.index}:src`, i.getAttribute("src") ?? ""), t.captureOnce(`${r.source}#${r.index}:srcset`, i.getAttribute("srcset") ?? ""), i.getAttribute("src") !== r.value && i.setAttribute("src", r.value), i.hasAttribute("srcset") && i.removeAttribute("srcset");
1448
1482
  else {
1449
1483
  if (i === n()) return;
@@ -1456,8 +1490,8 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1456
1490
  let n = r.get(e);
1457
1491
  if (!n) return;
1458
1492
  r.delete(e);
1459
- let i = X(n.source, n.index);
1460
- if (n.kind === "style") i && $t(i, e), a();
1493
+ let i = an(n.source, n.index);
1494
+ if (n.kind === "style") i && sn(i, e), a();
1461
1495
  else if (n.kind === "image") {
1462
1496
  let e = t.restore(`${n.source}#${n.index}:src`), r = t.restore(`${n.source}#${n.index}:srcset`);
1463
1497
  i && (e != null && (e ? i.setAttribute("src", e) : i.removeAttribute("src")), r != null && (r ? i.setAttribute("srcset", r) : i.removeAttribute("srcset")));
@@ -1486,7 +1520,7 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1486
1520
  for (let e of Array.from(document.querySelectorAll("[data-staged-key]"))) e.removeAttribute("data-staged-key");
1487
1521
  }
1488
1522
  };
1489
- }, Vn = (e) => {
1523
+ }, Jn = (e) => {
1490
1524
  let { channel: t, originals: n, clearTextHover: r } = e, i = null, a = "", o = 0, s = (() => {
1491
1525
  try {
1492
1526
  let e = document.createElement("div");
@@ -1505,7 +1539,7 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1505
1539
  n.selectNodeContents(e), n.collapse(!1), t.removeAllRanges(), t.addRange(n);
1506
1540
  }, d = (e, t = !1) => {
1507
1541
  if (i === e) return;
1508
- i && p(i), i = e, a = Y(e) || "", o = Zt(e, a), r(), n.capture(`${a}#${o}`, e.textContent ?? ""), e.setAttribute("contenteditable", s ? "plaintext-only" : "true");
1542
+ i && p(i), i = e, a = Y(e) || "", o = rn(e, a), r(), n.capture(`${a}#${o}`, e.textContent ?? ""), e.setAttribute("contenteditable", s ? "plaintext-only" : "true");
1509
1543
  let d = e;
1510
1544
  d.style.outline = `2px solid ${J.hover}`, d.style.outlineOffset = "3px", d.style.borderRadius = "3px", d.focus(), t && u(e), d.addEventListener("blur", c, !0), d.addEventListener("keydown", l, !0);
1511
1545
  }, f = (e) => {
@@ -1524,7 +1558,7 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1524
1558
  tag: e.tagName.toLowerCase(),
1525
1559
  value: c,
1526
1560
  previous: s,
1527
- occurrences: r ? Xt(r).length : 1
1561
+ occurrences: r ? nn(r).length : 1
1528
1562
  }
1529
1563
  });
1530
1564
  }, m = (e) => {
@@ -1543,16 +1577,16 @@ var Rt = ({ source: e, submitLabel: n = "Submit", hiddenFields: r, formVariant:
1543
1577
  i && f(i);
1544
1578
  }
1545
1579
  };
1546
- }, Hn = "2026-07-24g · element-capture + region-drag + region-highlights (stale-region guard)";
1547
- function Un() {
1548
- return E(() => Wn(), []), null;
1580
+ }, Yn = "2026-07-24g · element-capture + region-drag + region-highlights (stale-region guard)";
1581
+ function Xn() {
1582
+ return E(() => Zn(), []), null;
1549
1583
  }
1550
- function Wn() {
1551
- let e = !1, t = null, n = null, r = !1, i = null, a = jn(), o = Cn(), { overlay: s, label: c, ring: l, ringLabel: u } = on();
1584
+ function Zn() {
1585
+ let e = !1, t = null, n = null, r = !1, i = null, a = Rn(), o = An(), { overlay: s, label: c, ring: l, ringLabel: u } = pn();
1552
1586
  document.body.append(s, c, l, u);
1553
- let d = zn();
1587
+ let d = Kn();
1554
1588
  document.body.append(d.node);
1555
- let f = Rn();
1589
+ let f = Gn();
1556
1590
  document.body.append(...f);
1557
1591
  let p = [
1558
1592
  s,
@@ -1582,14 +1616,14 @@ function Wn() {
1582
1616
  }, S = (e) => !e || p.includes(e) || e === document.body || e === document.documentElement, C = (e) => {
1583
1617
  if (!e || S(e)) return null;
1584
1618
  let t = Y(e) ? e : e.closest("[data-tsd-source]");
1585
- return !t || S(t) || !un(t) ? null : t;
1586
- }, w = (e) => sn(s, c, e), T = () => {
1619
+ return !t || S(t) || !_n(t) ? null : t;
1620
+ }, w = (e) => mn(s, c, e), T = () => {
1587
1621
  if (n) {
1588
1622
  if (!n.isConnected) {
1589
1623
  P();
1590
1624
  return;
1591
1625
  }
1592
- sn(l, u, n);
1626
+ mn(l, u, n);
1593
1627
  }
1594
1628
  }, E = 0, D = () => {
1595
1629
  E || !n || r || (E = requestAnimationFrame(() => {
@@ -1618,23 +1652,23 @@ function Wn() {
1618
1652
  n = null, O.disconnect(), z(), E &&= (cancelAnimationFrame(E), 0), l.style.display = "none", u.style.display = "none", y(), g();
1619
1653
  }, F = (e) => w(e), I = () => {
1620
1654
  s.style.display = "none", c.style.display = "none";
1621
- }, L = Vn({
1655
+ }, L = Jn({
1622
1656
  channel: o,
1623
1657
  originals: a,
1624
1658
  clearTextHover: () => {
1625
1659
  i = null, I();
1626
1660
  }
1627
- }), R = Bn({
1661
+ }), R = qn({
1628
1662
  originals: a,
1629
1663
  editingNode: L.editingNode
1630
1664
  }), z = () => {
1631
1665
  n?.isConnected || R.count() ? j() : M();
1632
1666
  }, ee = (n) => {
1633
- n && r && te(!1), e = !!n, x(e), e || (t = null, s.style.display = "none", c.style.display = "none", de()), o.send({
1667
+ n && r && B(!1), e = !!n, x(e), e || (t = null, s.style.display = "none", c.style.display = "none", U()), o.send({
1634
1668
  type: "inspect-state",
1635
1669
  enabled: e
1636
1670
  });
1637
- }, te = (t) => {
1671
+ }, B = (t) => {
1638
1672
  if (r = !!t, r) {
1639
1673
  e && ee(!1), l.style.display = "none", u.style.display = "none";
1640
1674
  for (let e of f) e.style.display = "none";
@@ -1643,9 +1677,9 @@ function Wn() {
1643
1677
  type: "text-edit-state",
1644
1678
  enabled: r
1645
1679
  });
1646
- }, ne = 0, B = 0, re = 0, ie = () => {
1647
- ne = 0;
1648
- let n = document.elementFromPoint(B, re);
1680
+ }, te = 0, V = 0, ne = 0, re = () => {
1681
+ te = 0;
1682
+ let n = document.elementFromPoint(V, ne);
1649
1683
  if (!S(n)) {
1650
1684
  if (r) {
1651
1685
  let e = C(n);
@@ -1658,26 +1692,26 @@ function Wn() {
1658
1692
  }
1659
1693
  e && (d.isDragging() || (t = n, n && w(n)));
1660
1694
  }
1661
- }, ae = (t) => {
1662
- !e && !r || (B = t.clientX, re = t.clientY, ne ||= requestAnimationFrame(ie));
1663
- }, V = 0, oe = () => {
1664
- V = 0, e && t && w(t), r && !L.editingNode() && i?.isConnected && F(i), n && !r && T(), m.length > 0 && !r && _();
1665
- }, se = () => {
1666
- V ||= requestAnimationFrame(oe);
1667
- }, ce = (n) => {
1695
+ }, ie = (t) => {
1696
+ !e && !r || (V = t.clientX, ne = t.clientY, te ||= requestAnimationFrame(re));
1697
+ }, H = 0, ae = () => {
1698
+ H = 0, e && t && w(t), r && !L.editingNode() && i?.isConnected && F(i), n && !r && T(), m.length > 0 && !r && _();
1699
+ }, oe = () => {
1700
+ H ||= requestAnimationFrame(ae);
1701
+ }, se = (n) => {
1668
1702
  n.relatedTarget || (e ? (t = null, s.style.display = "none", c.style.display = "none") : r && !L.editingNode() && (i = null, I(), document.documentElement.style.cursor = ""));
1669
- }, H = !1, le = null, ue = () => {
1703
+ }, ce = !1, le = null, ue = () => {
1670
1704
  if (le != null) {
1671
1705
  try {
1672
1706
  document.documentElement.releasePointerCapture(le);
1673
1707
  } catch {}
1674
1708
  le = null;
1675
1709
  }
1676
- }, de = () => {
1710
+ }, U = () => {
1677
1711
  ue(), d.cancel();
1678
- }, fe = (t) => {
1679
- !e || t.button !== 0 || !t.isPrimary || (H = !1, d.pointerDown(t.clientX, t.clientY));
1680
- }, pe = (n) => {
1712
+ }, W = (t) => {
1713
+ !e || t.button !== 0 || !t.isPrimary || (ce = !1, d.pointerDown(t.clientX, t.clientY));
1714
+ }, de = (n) => {
1681
1715
  if (!e || !n.isPrimary) return;
1682
1716
  let r = d.isDragging();
1683
1717
  if (d.pointerMove(n.clientX, n.clientY), d.isDragging()) {
@@ -1689,16 +1723,16 @@ function Wn() {
1689
1723
  }
1690
1724
  t = null, s.style.display = "none", c.style.display = "none";
1691
1725
  }
1692
- }, me = (t) => {
1726
+ }, fe = (t) => {
1693
1727
  if (!e || !t.isPrimary) return;
1694
1728
  ue();
1695
1729
  let n = d.pointerUp();
1696
1730
  if (!n) return;
1697
- H = !0, P();
1698
- let { elements: r, nodes: i, truncated: a } = Ln(n, p);
1731
+ ce = !0, P();
1732
+ let { elements: r, nodes: i, truncated: a } = Wn(n, p);
1699
1733
  console.info(`[levo-inspector] region drag: ${Math.round(n.width)}×${Math.round(n.height)} — ${r.length} element(s)${a ? " (truncated)" : ""}`), v(i);
1700
1734
  let s = ++h;
1701
- Yt(n, p).then((e) => {
1735
+ en(n, p).then((e) => {
1702
1736
  s === h && (console.info(`[levo-inspector] region capture ok (${Math.round(e.length / 1024)}kB)`), o.send({
1703
1737
  type: "region-selected",
1704
1738
  rect: n,
@@ -1715,25 +1749,25 @@ function Wn() {
1715
1749
  dataUrl: null
1716
1750
  }));
1717
1751
  });
1718
- }, he = () => de(), U = (e) => {
1719
- let t = cn(e.target);
1752
+ }, pe = () => U(), me = (e) => {
1753
+ let t = hn(e.target);
1720
1754
  return t ? (e.preventDefault(), e.stopPropagation(), window.open(t, "_blank", "noopener,noreferrer"), !0) : !1;
1721
- }, ge = (i) => {
1722
- if (H) {
1723
- H = !1, i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation();
1755
+ }, he = (i) => {
1756
+ if (ce) {
1757
+ ce = !1, i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation();
1724
1758
  return;
1725
1759
  }
1726
1760
  if (r) {
1727
1761
  let e = C(document.elementFromPoint(i.clientX, i.clientY) || i.target);
1728
1762
  if (!e || e === L.editingNode()) {
1729
- U(i);
1763
+ me(i);
1730
1764
  return;
1731
1765
  }
1732
1766
  i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation(), L.startEdit(e);
1733
1767
  return;
1734
1768
  }
1735
1769
  if (!e) {
1736
- U(i);
1770
+ me(i);
1737
1771
  return;
1738
1772
  }
1739
1773
  i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation();
@@ -1742,14 +1776,14 @@ function Wn() {
1742
1776
  let s = a.closest("[data-tsd-source]") || a;
1743
1777
  y(), g(), n = s, T(), N(), o.send({
1744
1778
  type: "element-selected",
1745
- element: pn(s)
1779
+ element: bn(s)
1746
1780
  });
1747
- }, _e = An({
1781
+ }, ge = Ln({
1748
1782
  channel: o,
1749
1783
  originals: a,
1750
1784
  staged: R,
1751
1785
  setInspect: ee,
1752
- setTextEdit: te,
1786
+ setTextEdit: B,
1753
1787
  isInspecting: () => e,
1754
1788
  isTextEditing: () => r,
1755
1789
  editingNode: L.editingNode,
@@ -1765,7 +1799,7 @@ function Wn() {
1765
1799
  startEditAtEnd: (e) => L.startEdit(e, !0),
1766
1800
  editableTarget: C,
1767
1801
  ownNodes: p
1768
- }), ve = [
1802
+ }), _e = [
1769
1803
  "mousedown",
1770
1804
  "mouseup",
1771
1805
  "dblclick",
@@ -1783,52 +1817,52 @@ function Wn() {
1783
1817
  "touchstart",
1784
1818
  "touchend",
1785
1819
  "submit"
1786
- ], ye = (t) => {
1820
+ ], ve = (t) => {
1787
1821
  e && (t.cancelable && t.preventDefault(), t.stopPropagation(), t.stopImmediatePropagation());
1788
- }, be = () => {
1822
+ }, ye = () => {
1789
1823
  n && !r && T(), m.length > 0 && !r && _();
1790
- }, xe = () => {
1824
+ }, be = () => {
1791
1825
  let e = location.pathname.replace(/\/$/, "") || "/";
1792
1826
  o.send({
1793
1827
  type: "route",
1794
1828
  route: e
1795
1829
  });
1796
- }, Se = wn({ onPathChange: () => {
1797
- P(), xe();
1798
- } }), Ce = (t) => {
1830
+ }, xe = jn({ onPathChange: () => {
1831
+ P(), be();
1832
+ } }), Se = (t) => {
1799
1833
  if (L.editingNode()) return;
1800
1834
  if (t.key === "Escape") {
1801
1835
  if (e && d.isDragging()) {
1802
- t.stopPropagation(), de();
1836
+ t.stopPropagation(), U();
1803
1837
  return;
1804
1838
  }
1805
- r ? (t.stopPropagation(), te(!1)) : e && (t.stopPropagation(), ee(!1));
1839
+ r ? (t.stopPropagation(), B(!1)) : e && (t.stopPropagation(), ee(!1));
1806
1840
  return;
1807
1841
  }
1808
- if (t.metaKey || t.ctrlKey || t.altKey || t.shiftKey || t.repeat || ln(document.activeElement)) return;
1842
+ if (t.metaKey || t.ctrlKey || t.altKey || t.shiftKey || t.repeat || gn(document.activeElement)) return;
1809
1843
  let n = t.key.toLowerCase();
1810
- n === "s" ? (t.preventDefault(), t.stopPropagation(), ee(!e)) : n === "t" && (t.preventDefault(), t.stopPropagation(), te(!r));
1844
+ n === "s" ? (t.preventDefault(), t.stopPropagation(), ee(!e)) : n === "t" && (t.preventDefault(), t.stopPropagation(), B(!r));
1811
1845
  };
1812
- window.addEventListener("mousemove", ae, !0), window.addEventListener("scroll", se, !0), window.addEventListener("resize", be), window.addEventListener("click", ge, !0), window.addEventListener("keydown", Ce, !0), window.addEventListener("message", _e.onMessage), window.addEventListener("mouseout", ce, !0), window.addEventListener("pointerdown", fe, !0), window.addEventListener("pointermove", pe, !0), window.addEventListener("pointerup", me, !0), window.addEventListener("pointercancel", he, !0);
1813
- for (let e of ve) window.addEventListener(e, ye, !0);
1814
- return console.info(`[levo-inspector] build ${Hn} — runtime mounted`), xe(), o.send({ type: "ready" }), () => {
1815
- window.removeEventListener("mousemove", ae, !0), window.removeEventListener("keydown", Ce, !0), window.removeEventListener("scroll", se, !0), window.removeEventListener("resize", be), window.removeEventListener("mouseout", ce, !0), window.removeEventListener("pointerdown", fe, !0), window.removeEventListener("pointermove", pe, !0), window.removeEventListener("pointerup", me, !0), window.removeEventListener("pointercancel", he, !0), window.removeEventListener("click", ge, !0), window.removeEventListener("message", _e.onMessage);
1816
- for (let e of ve) window.removeEventListener(e, ye, !0);
1817
- O.disconnect(), k.disconnect(), E && cancelAnimationFrame(E), ne && cancelAnimationFrame(ne), V && cancelAnimationFrame(V), R.teardown(), Se.teardown(), L.teardown(), document.documentElement.style.cursor = "", b?.remove(), s.remove(), c.remove(), l.remove(), u.remove(), de(), d.node.remove();
1846
+ window.addEventListener("mousemove", ie, !0), window.addEventListener("scroll", oe, !0), window.addEventListener("resize", ye), window.addEventListener("click", he, !0), window.addEventListener("keydown", Se, !0), window.addEventListener("message", ge.onMessage), window.addEventListener("mouseout", se, !0), window.addEventListener("pointerdown", W, !0), window.addEventListener("pointermove", de, !0), window.addEventListener("pointerup", fe, !0), window.addEventListener("pointercancel", pe, !0);
1847
+ for (let e of _e) window.addEventListener(e, ve, !0);
1848
+ return console.info(`[levo-inspector] build ${Yn} — runtime mounted`), be(), o.send({ type: "ready" }), () => {
1849
+ window.removeEventListener("mousemove", ie, !0), window.removeEventListener("keydown", Se, !0), window.removeEventListener("scroll", oe, !0), window.removeEventListener("resize", ye), window.removeEventListener("mouseout", se, !0), window.removeEventListener("pointerdown", W, !0), window.removeEventListener("pointermove", de, !0), window.removeEventListener("pointerup", fe, !0), window.removeEventListener("pointercancel", pe, !0), window.removeEventListener("click", he, !0), window.removeEventListener("message", ge.onMessage);
1850
+ for (let e of _e) window.removeEventListener(e, ve, !0);
1851
+ O.disconnect(), k.disconnect(), E && cancelAnimationFrame(E), te && cancelAnimationFrame(te), H && cancelAnimationFrame(H), R.teardown(), xe.teardown(), L.teardown(), document.documentElement.style.cursor = "", b?.remove(), s.remove(), c.remove(), l.remove(), u.remove(), U(), d.node.remove();
1818
1852
  for (let e of f) e.remove();
1819
1853
  };
1820
1854
  }
1821
1855
  //#endregion
1822
1856
  //#region src/branding/MadeWithLevo.tsx
1823
- var Gn = "levo-made-with", Kn = `.${Gn}{opacity:.2;transition:opacity 150ms,transform 150ms}
1824
- .${Gn}:hover,.${Gn}:focus-visible{opacity:1;transform:translateY(-2px)}`, qn = ({ slug: e }) => {
1857
+ var Qn = "levo-made-with", $n = `.${Qn}{opacity:.2;transition:opacity 150ms,transform 150ms}
1858
+ .${Qn}:hover,.${Qn}:focus-visible{opacity:1;transform:translateY(-2px)}`, er = ({ slug: e }) => {
1825
1859
  let t = `utm_source=${encodeURIComponent(e || "website")}&utm_term=Made%20With%20Levo&utm_campaign=footer_branding&utm_medium=organic_footer_branding`;
1826
1860
  return /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("style", {
1827
1861
  href: "levo-made-with",
1828
1862
  precedence: "default",
1829
- children: Kn
1863
+ children: $n
1830
1864
  }), /* @__PURE__ */ P("a", {
1831
- className: Gn,
1865
+ className: Qn,
1832
1866
  href: `https://levo.so/?${t}`,
1833
1867
  target: "_blank",
1834
1868
  rel: "noopener noreferrer",
@@ -1859,58 +1893,58 @@ var Gn = "levo-made-with", Kn = `.${Gn}{opacity:.2;transition:opacity 150ms,tran
1859
1893
  }
1860
1894
  }), "Made with Levo"]
1861
1895
  })] });
1862
- }, Jn = "levo:page-id", Yn = () => {
1896
+ }, tr = "levo:page-id", nr = () => {
1863
1897
  if (typeof document > "u") return null;
1864
- let e = document.querySelectorAll(`meta[name="${Jn}"]`);
1898
+ let e = document.querySelectorAll(`meta[name="${tr}"]`);
1865
1899
  return e[e.length - 1]?.getAttribute("content")?.trim() || null;
1866
- }, Xn = C(() => import("./dist-DEXGyFeH.js").then((e) => e.n).then((e) => ({ default: e.PopupLoader }))), Zn = ({ siteId: e, pageId: t }) => {
1867
- let n = G(), r = i();
1900
+ }, rr = C(() => import("./dist-DTszGV-P.js").then((e) => e.n).then((e) => ({ default: e.PopupLoader }))), ir = ({ siteId: e, pageId: t }) => {
1901
+ let n = K(), r = i();
1868
1902
  return !n || !r ? null : /* @__PURE__ */ N(x, {
1869
1903
  fallback: null,
1870
- children: /* @__PURE__ */ N(Xn, {
1904
+ children: /* @__PURE__ */ N(rr, {
1871
1905
  pageId: t,
1872
1906
  siteId: e
1873
1907
  })
1874
1908
  });
1875
- }, Qn = S(null), $n = Qn.Provider, er = () => T(Qn), tr = () => i(), nr = () => n(), rr = ({ site: e, analytics: t = !0, children: n }) => {
1909
+ }, ar = S(null), or = ar.Provider, sr = () => T(ar), cr = () => i(), lr = () => n(), ur = ({ site: e, analytics: t = !0, children: n }) => {
1876
1910
  let [i] = A(() => {
1877
1911
  if (!e) return null;
1878
- let n = ke(e), r = Oe(n);
1912
+ let n = Me(e), r = je(n);
1879
1913
  return r ? {
1880
1914
  client: r,
1881
- insights: re(r, {
1915
+ insights: ne(r, {
1882
1916
  insightsUrl: t && n.insightsUrl || null,
1883
1917
  site: n.siteId || null
1884
1918
  }),
1885
1919
  site: e
1886
1920
  } : null;
1887
- }), [a, o] = A(null), s = B({ select: (e) => e.location.pathname }), c = kn();
1921
+ }), [a, o] = A(null), s = V({ select: (e) => e.location.pathname }), c = In();
1888
1922
  return E(() => {
1889
1923
  i && (window.levo_client = i.client, window.levo_insights = i.insights);
1890
1924
  }, [i]), D(() => {
1891
1925
  if (!i) return;
1892
- let e = Yn();
1926
+ let e = nr();
1893
1927
  o(e), i.insights.init({ pageId: e });
1894
1928
  }, [i, s]), i ? /* @__PURE__ */ P(r, {
1895
1929
  client: i.client,
1896
1930
  insights: i.insights,
1897
1931
  children: [
1898
- /* @__PURE__ */ N($n, {
1932
+ /* @__PURE__ */ N(or, {
1899
1933
  value: i.site,
1900
1934
  children: n
1901
1935
  }),
1902
- !c && /* @__PURE__ */ N(Ot, {
1936
+ !c && /* @__PURE__ */ N(jt, {
1903
1937
  site: i.site,
1904
1938
  path: s
1905
1939
  }),
1906
- /* @__PURE__ */ N(Zn, {
1940
+ /* @__PURE__ */ N(ir, {
1907
1941
  pageId: a ?? void 0,
1908
1942
  siteId: i.site.id
1909
1943
  }),
1910
- !c && !!i.site.feature_flag?.branding && /* @__PURE__ */ N(qn, { slug: i.site.slug })
1944
+ !c && !!i.site.feature_flag?.branding && /* @__PURE__ */ N(er, { slug: i.site.slug })
1911
1945
  ]
1912
1946
  }) : /* @__PURE__ */ N(M, { children: n });
1913
- }, ir = (e, t) => {
1947
+ }, dr = (e, t) => {
1914
1948
  let n = h(t);
1915
1949
  return ({ location: t }) => {
1916
1950
  if (!e.isLocalized) return;
@@ -1921,12 +1955,12 @@ var Gn = "levo-made-with", Kn = `.${Gn}{opacity:.2;transition:opacity 150ms,tran
1921
1955
  cookie: typeof document > "u" ? null : document.cookie,
1922
1956
  hasRoute: n
1923
1957
  });
1924
- if (r.kind === "redirect" && r.path !== t.pathname) throw ne({
1958
+ if (r.kind === "redirect" && r.path !== t.pathname) throw te({
1925
1959
  search: !0,
1926
1960
  to: r.path
1927
1961
  });
1928
1962
  };
1929
- }, ar = (e) => {
1963
+ }, fr = (e) => {
1930
1964
  let t = e.locales ?? [], n = e.domain?.trim().replace(/^https?:\/\//, "").replace(/\/+$/, "");
1931
1965
  return {
1932
1966
  locales: t,
@@ -1934,8 +1968,8 @@ var Gn = "levo-made-with", Kn = `.${Gn}{opacity:.2;transition:opacity 150ms,tran
1934
1968
  isLocalized: t.length > 1,
1935
1969
  origin: n ? `https://${n}` : null
1936
1970
  };
1937
- }, or = (e) => e.replace(/\/$/, ""), sr = (e) => {
1938
- let { neutralPath: t, locales: n, activePrefix: r, hasRoute: i } = e, a = or(e.origin), o = `${a}${t}`;
1971
+ }, pr = (e) => e.replace(/\/$/, ""), mr = (e) => {
1972
+ let { neutralPath: t, locales: n, activePrefix: r, hasRoute: i } = e, a = pr(e.origin), o = `${a}${t}`;
1939
1973
  if (n.length <= 1) return [{
1940
1974
  rel: "canonical",
1941
1975
  href: o
@@ -1957,14 +1991,14 @@ var Gn = "levo-made-with", Kn = `.${Gn}{opacity:.2;transition:opacity 150ms,tran
1957
1991
  hrefLang: "x-default",
1958
1992
  href: o
1959
1993
  }), s;
1960
- }, cr = ({ to: e, ...t }) => /* @__PURE__ */ N(ee, {
1994
+ }, hr = ({ to: e, ...t }) => /* @__PURE__ */ N(ee, {
1961
1995
  ...t,
1962
1996
  to: e
1963
- }), lr = ({ config: e, routeTree: t }) => {
1964
- let n = B({ select: (e) => e.location.pathname });
1997
+ }), gr = ({ config: e, routeTree: t }) => {
1998
+ let n = V({ select: (e) => e.location.pathname });
1965
1999
  if (!e.isLocalized || !e.origin) return null;
1966
2000
  let { neutralPath: r } = f(n, e.locales);
1967
- return /* @__PURE__ */ N(M, { children: sr({
2001
+ return /* @__PURE__ */ N(M, { children: mr({
1968
2002
  neutralPath: r,
1969
2003
  origin: e.origin,
1970
2004
  locales: e.locales,
@@ -1974,7 +2008,7 @@ var Gn = "levo-made-with", Kn = `.${Gn}{opacity:.2;transition:opacity 150ms,tran
1974
2008
  hrefLang: e.hrefLang,
1975
2009
  rel: e.rel
1976
2010
  }, e.hrefLang ?? e.href)) });
1977
- }, ur = S(void 0), dr = ({ children: e, locale: t, locales: n, defaultLocale: r, source: i = "default", hasRoute: a }) => {
2011
+ }, _r = S(void 0), vr = ({ children: e, locale: t, locales: n, defaultLocale: r, source: i = "default", hasRoute: a }) => {
1978
2012
  let o = O(() => {
1979
2013
  let e = n?.length ? n : [t];
1980
2014
  return {
@@ -1998,13 +2032,13 @@ var Gn = "levo-made-with", Kn = `.${Gn}{opacity:.2;transition:opacity 150ms,tran
1998
2032
  i,
1999
2033
  a
2000
2034
  ]);
2001
- return /* @__PURE__ */ N(ur.Provider, {
2035
+ return /* @__PURE__ */ N(_r.Provider, {
2002
2036
  value: o,
2003
2037
  children: e
2004
2038
  });
2005
2039
  };
2006
- function fr() {
2007
- return T(ur) || {
2040
+ function yr() {
2041
+ return T(_r) || {
2008
2042
  locale: "en",
2009
2043
  locales: ["en"],
2010
2044
  defaultLocale: "en",
@@ -2014,13 +2048,13 @@ function fr() {
2014
2048
  pathFor: (e) => e
2015
2049
  };
2016
2050
  }
2017
- function pr(e) {
2018
- let { prefix: t } = f(B({ select: (e) => e.location.pathname }), e.locales);
2051
+ function br(e) {
2052
+ let { prefix: t } = f(V({ select: (e) => e.location.pathname }), e.locales);
2019
2053
  return t ?? e.defaultLocale;
2020
2054
  }
2021
- var mr = ({ config: e, children: t, routeTree: n }) => {
2022
- let { prefix: r } = f(B({ select: (e) => e.location.pathname }), e.locales);
2023
- return /* @__PURE__ */ N(dr, {
2055
+ var xr = ({ config: e, children: t, routeTree: n }) => {
2056
+ let { prefix: r } = f(V({ select: (e) => e.location.pathname }), e.locales);
2057
+ return /* @__PURE__ */ N(vr, {
2024
2058
  defaultLocale: e.defaultLocale,
2025
2059
  hasRoute: n ? h(n) : void 0,
2026
2060
  locale: r ?? e.defaultLocale,
@@ -2029,8 +2063,8 @@ var mr = ({ config: e, children: t, routeTree: n }) => {
2029
2063
  children: t
2030
2064
  });
2031
2065
  };
2032
- function hr() {
2033
- let { locale: e, locales: t, isMultiLocale: n, setLocale: r, pathFor: i, hasRoute: a } = fr(), o = B({ select: (e) => e.location.pathname });
2066
+ function Sr() {
2067
+ let { locale: e, locales: t, isMultiLocale: n, setLocale: r, pathFor: i, hasRoute: a } = yr(), o = V({ select: (e) => e.location.pathname });
2034
2068
  return O(() => {
2035
2069
  if (!n) return [];
2036
2070
  let { neutralPath: s } = f(o, t), c = t.filter((e) => !a || a(i(s, e)));
@@ -2057,14 +2091,14 @@ function hr() {
2057
2091
  }
2058
2092
  //#endregion
2059
2093
  //#region src/pageHead.tsx
2060
- var gr = (e) => JSON.stringify(e).replace(/<\//g, "<\\/"), _r = (e) => {
2094
+ var Cr = (e) => JSON.stringify(e).replace(/<\//g, "<\\/"), wr = (e) => {
2061
2095
  let t = {}, n = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*("([^"]*)"|'([^']*)'|[^\s"'>]+))?/g;
2062
2096
  for (let r = n.exec(e); r; r = n.exec(e)) {
2063
2097
  let e = r[1];
2064
2098
  !e || /^on/i.test(e) || (t[e] = r[3] ?? r[4] ?? (r[2] ? r[2] : ""));
2065
2099
  }
2066
2100
  return t;
2067
- }, vr = (e) => {
2101
+ }, Tr = (e) => {
2068
2102
  let t = {
2069
2103
  meta: [],
2070
2104
  links: [],
@@ -2072,11 +2106,11 @@ var gr = (e) => JSON.stringify(e).replace(/<\//g, "<\\/"), _r = (e) => {
2072
2106
  };
2073
2107
  if (!e?.trim()) return t;
2074
2108
  let n = e.replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi, (e, n, r) => {
2075
- let i = _r(n), a = r.trim();
2109
+ let i = wr(n), a = r.trim();
2076
2110
  return a && (i.children = a), t.scripts.push(i), "";
2077
2111
  });
2078
- return n = n.replace(/<(meta|link)\b([^>]*?)\/?>/gi, (e, n, r) => ((n.toLowerCase() === "meta" ? t.meta : t.links).push(_r(r)), "")), t;
2079
- }, yr = (e = {}, t = {}) => {
2112
+ return n = n.replace(/<(meta|link)\b([^>]*?)\/?>/gi, (e, n, r) => ((n.toLowerCase() === "meta" ? t.meta : t.links).push(wr(r)), "")), t;
2113
+ }, Er = (e = {}, t = {}) => {
2080
2114
  let n = {
2081
2115
  meta: [],
2082
2116
  links: [],
@@ -2138,17 +2172,17 @@ var gr = (e) => JSON.stringify(e).replace(/<\//g, "<\\/"), _r = (e) => {
2138
2172
  let y = e.ldJson ? Array.isArray(e.ldJson) ? e.ldJson : [e.ldJson] : [];
2139
2173
  for (let e of y) n.scripts.push({
2140
2174
  type: "application/ld+json",
2141
- children: gr(e)
2175
+ children: Cr(e)
2142
2176
  });
2143
2177
  for (let r of [t.customHead, e.customHead]) {
2144
2178
  if (!r) continue;
2145
- let e = vr(r);
2179
+ let e = Tr(r);
2146
2180
  n.meta.push(...e.meta), n.links.push(...e.links), n.scripts.push(...e.scripts);
2147
2181
  }
2148
2182
  return n;
2149
2183
  };
2150
- function br({ meta: e, site: t }) {
2151
- let n = yr(e, t);
2184
+ function Dr({ meta: e, site: t }) {
2185
+ let n = Er(e, t);
2152
2186
  return /* @__PURE__ */ P(M, { children: [
2153
2187
  n.meta.map((e, t) => e.title === void 0 ? /* @__PURE__ */ N("meta", { ...e }, `m${t}`) : /* @__PURE__ */ N("title", { children: e.title }, `t${t}`)),
2154
2188
  n.links.map((e, t) => /* @__PURE__ */ N("link", { ...e }, `l${t}`)),
@@ -2160,9 +2194,9 @@ function br({ meta: e, site: t }) {
2160
2194
  }
2161
2195
  //#endregion
2162
2196
  //#region src/registration/ui.tsx
2163
- var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, children: n }) => /* @__PURE__ */ N("div", {
2197
+ var X = (...e) => e.filter(Boolean).join(" "), Or = ({ open: e, className: t, children: n }) => /* @__PURE__ */ N("div", {
2164
2198
  inert: !e,
2165
- className: Z("grid transition-[grid-template-rows,opacity] duration-250 ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:transition-none", e ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"),
2199
+ className: X("grid transition-[grid-template-rows,opacity] duration-250 ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:transition-none", e ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"),
2166
2200
  children: /* @__PURE__ */ N("div", {
2167
2201
  className: "overflow-hidden",
2168
2202
  children: /* @__PURE__ */ N("div", {
@@ -2170,7 +2204,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2170
2204
  children: n
2171
2205
  })
2172
2206
  })
2173
- }), Sr = [
2207
+ }), kr = [
2174
2208
  {
2175
2209
  key: "email",
2176
2210
  label: "Email",
@@ -2203,7 +2237,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2203
2237
  inputMode: void 0,
2204
2238
  autoComplete: "organization-title"
2205
2239
  }
2206
- ], Cr = [{
2240
+ ], Ar = [{
2207
2241
  key: "name",
2208
2242
  label: "Registered company name",
2209
2243
  placeholder: "Acme Corporation",
@@ -2213,7 +2247,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2213
2247
  label: "Tax ID / GST number",
2214
2248
  placeholder: "22AAAAA0000A1Z5",
2215
2249
  autoComplete: "off"
2216
- }], wr = [
2250
+ }], jr = [
2217
2251
  {
2218
2252
  key: "line1",
2219
2253
  label: "Billing address",
@@ -2262,167 +2296,251 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2262
2296
  wide: !1,
2263
2297
  optional: !1
2264
2298
  }
2265
- ], Tr = (e) => Z("w-full rounded-xl border bg-page px-3.5 py-2.5 text-base text-ink outline-none transition placeholder:text-ink-muted/60", e ? "border-danger focus:ring-[3px] focus:ring-danger/15" : "border-border focus:border-brand focus:ring-[3px] focus:ring-brand/20"), Er = "flex items-baseline gap-1.5 font-medium text-ink text-sm", Dr = () => /* @__PURE__ */ N("span", {
2299
+ ], Mr = (e) => X("w-full rounded-xl border bg-page px-3.5 py-2.5 text-base text-ink outline-none transition placeholder:text-ink-muted/60", e ? "border-danger focus:ring-[3px] focus:ring-danger/15" : "border-border focus:border-brand focus:ring-[3px] focus:ring-brand/20"), Nr = "flex items-baseline gap-1.5 font-medium text-ink text-sm", Pr = () => /* @__PURE__ */ N("span", {
2266
2300
  "aria-hidden": !0,
2267
2301
  className: "text-danger",
2268
2302
  children: "*"
2269
- }), Or = ({ values: e, errors: t, touched: n, onChange: r, onBlur: i, showBusinessBilling: a = !1, registrationFields: o, nameInputRef: s }) => {
2270
- let c = (t, n) => r("billing_details", {
2271
- ...e.billing_details,
2272
- [t]: n
2273
- }), l = (t, n) => r("billing_details", {
2274
- ...e.billing_details,
2275
- address: {
2276
- ...e.billing_details.address,
2277
- [t]: n
2278
- }
2279
- }), u = !!e.billing_details.name.trim() || !!e.billing_details.tax_id.trim() || Object.values(e.billing_details.address).some((e) => !!e.trim());
2280
- return /* @__PURE__ */ P("div", {
2281
- className: "flex flex-col gap-4",
2282
- children: [
2283
- /* @__PURE__ */ P("div", {
2303
+ }), Fr = ({ values: e, errors: t, touched: n, onChange: r, onBlur: i, showBusinessBilling: a = !1, registrationFields: o, nameInputRef: s, idPrefix: c = "attendee", nameLabel: l = "Your name" }) => /* @__PURE__ */ P("div", {
2304
+ className: "flex flex-col gap-4",
2305
+ children: [
2306
+ /* @__PURE__ */ P("div", {
2307
+ className: "flex flex-col gap-1.5",
2308
+ children: [
2309
+ /* @__PURE__ */ P("label", {
2310
+ htmlFor: `${c}-name`,
2311
+ className: Nr,
2312
+ children: [l, /* @__PURE__ */ N(Pr, {})]
2313
+ }),
2314
+ /* @__PURE__ */ N("input", {
2315
+ ref: s,
2316
+ id: `${c}-name`,
2317
+ name: "name",
2318
+ type: "text",
2319
+ autoComplete: "name",
2320
+ placeholder: "John Doe",
2321
+ value: e.name,
2322
+ onChange: (e) => r("name", e.target.value),
2323
+ onBlur: () => i("name"),
2324
+ className: Mr(n.name && !!t.name),
2325
+ required: !0
2326
+ }),
2327
+ n.name && t.name && /* @__PURE__ */ N("p", {
2328
+ className: "m-0 text-danger text-xs",
2329
+ children: t.name
2330
+ })
2331
+ ]
2332
+ }),
2333
+ kr.map((a) => {
2334
+ let s = o[a.key];
2335
+ if (s === "off") return null;
2336
+ let l = n[a.key] ? t[a.key] : void 0, u = a.key === "email" || a.key === "mobile";
2337
+ return /* @__PURE__ */ P("div", {
2284
2338
  className: "flex flex-col gap-1.5",
2285
2339
  children: [
2286
2340
  /* @__PURE__ */ P("label", {
2287
- htmlFor: "attendee-name",
2288
- className: Er,
2289
- children: ["Your name", /* @__PURE__ */ N(Dr, {})]
2341
+ htmlFor: `${c}-${a.key}`,
2342
+ className: Nr,
2343
+ children: [a.label, s === "required" ? /* @__PURE__ */ N(Pr, {}) : /* @__PURE__ */ N("span", {
2344
+ className: "font-normal text-ink-muted text-xs",
2345
+ children: "Optional"
2346
+ })]
2290
2347
  }),
2291
2348
  /* @__PURE__ */ N("input", {
2292
- ref: s,
2293
- id: "attendee-name",
2294
- name: "name",
2295
- type: "text",
2296
- autoComplete: "name",
2297
- placeholder: "John Doe",
2298
- value: e.name,
2299
- onChange: (e) => r("name", e.target.value),
2300
- onBlur: () => i("name"),
2301
- className: Tr(n.name && !!t.name),
2302
- required: !0
2349
+ id: `${c}-${a.key}`,
2350
+ name: a.key,
2351
+ type: a.type,
2352
+ inputMode: a.inputMode,
2353
+ autoComplete: a.autoComplete,
2354
+ autoCapitalize: u ? "none" : void 0,
2355
+ autoCorrect: u ? "off" : void 0,
2356
+ spellCheck: u ? !1 : void 0,
2357
+ placeholder: a.placeholder,
2358
+ value: e[a.key],
2359
+ onChange: (e) => r(a.key, e.target.value),
2360
+ onBlur: () => i(a.key),
2361
+ className: Mr(!!l),
2362
+ required: s === "required"
2303
2363
  }),
2304
- n.name && t.name && /* @__PURE__ */ N("p", {
2364
+ l && /* @__PURE__ */ N("p", {
2305
2365
  className: "m-0 text-danger text-xs",
2306
- children: t.name
2366
+ children: l
2307
2367
  })
2308
2368
  ]
2369
+ }, a.key);
2370
+ }),
2371
+ a && /* @__PURE__ */ N(Ir, {
2372
+ values: e,
2373
+ onChange: r
2374
+ })
2375
+ ]
2376
+ }), Ir = ({ values: e, onChange: t }) => {
2377
+ let n = (n, r) => t("billing_details", {
2378
+ ...e.billing_details,
2379
+ [n]: r
2380
+ }), r = (n, r) => t("billing_details", {
2381
+ ...e.billing_details,
2382
+ address: {
2383
+ ...e.billing_details.address,
2384
+ [n]: r
2385
+ }
2386
+ }), i = !!e.billing_details.name.trim() || !!e.billing_details.tax_id.trim() || Object.values(e.billing_details.address).some((e) => !!e.trim());
2387
+ return /* @__PURE__ */ P("div", {
2388
+ className: "rounded-xl border border-border bg-ink/3",
2389
+ children: [
2390
+ /* @__PURE__ */ P("label", {
2391
+ htmlFor: "is_business_purchase",
2392
+ className: "flex w-full cursor-pointer items-center gap-2.5 px-3.5 py-3 text-ink text-sm",
2393
+ children: [/* @__PURE__ */ N("input", {
2394
+ id: "is_business_purchase",
2395
+ type: "checkbox",
2396
+ checked: e.is_business_purchase,
2397
+ onChange: (e) => t("is_business_purchase", e.target.checked),
2398
+ "aria-expanded": e.is_business_purchase,
2399
+ className: "size-4 shrink-0 cursor-pointer rounded accent-brand"
2400
+ }), "Bill this to a business — I need a GST invoice"]
2309
2401
  }),
2310
- Sr.map((a) => {
2311
- let s = o[a.key];
2312
- if (s === "off") return null;
2313
- let c = n[a.key] ? t[a.key] : void 0, l = a.key === "email" || a.key === "mobile";
2314
- return /* @__PURE__ */ P("div", {
2315
- className: "flex flex-col gap-1.5",
2402
+ !e.is_business_purchase && i && /* @__PURE__ */ N("p", {
2403
+ className: "m-0 px-3.5 pb-3 text-amber-700 text-xs leading-relaxed starting:opacity-0 transition-opacity duration-200 dark:text-amber-400",
2404
+ children: "Your billing details are still saved — tick the box to apply them."
2405
+ }),
2406
+ /* @__PURE__ */ N(Or, {
2407
+ open: e.is_business_purchase,
2408
+ className: "px-3.5 pb-3.5",
2409
+ children: /* @__PURE__ */ P("div", {
2410
+ className: "flex flex-col gap-3",
2316
2411
  children: [
2317
- /* @__PURE__ */ P("label", {
2318
- htmlFor: `attendee-${a.key}`,
2319
- className: Er,
2320
- children: [a.label, s === "required" ? /* @__PURE__ */ N(Dr, {}) : /* @__PURE__ */ N("span", {
2321
- className: "font-normal text-ink-muted text-xs",
2322
- children: "Optional"
2323
- })]
2412
+ /* @__PURE__ */ N("p", {
2413
+ className: "m-0 text-ink-muted text-xs leading-relaxed",
2414
+ children: "This booking will be billed to your business. The invoice is raised against the details below."
2324
2415
  }),
2325
- /* @__PURE__ */ N("input", {
2326
- id: `attendee-${a.key}`,
2327
- name: a.key,
2328
- type: a.type,
2329
- inputMode: a.inputMode,
2330
- autoComplete: a.autoComplete,
2331
- autoCapitalize: l ? "none" : void 0,
2332
- autoCorrect: l ? "off" : void 0,
2333
- spellCheck: l ? !1 : void 0,
2334
- placeholder: a.placeholder,
2335
- value: e[a.key],
2336
- onChange: (e) => r(a.key, e.target.value),
2337
- onBlur: () => i(a.key),
2338
- className: Tr(!!c),
2339
- required: s === "required"
2340
- }),
2341
- c && /* @__PURE__ */ N("p", {
2342
- className: "m-0 text-danger text-xs",
2343
- children: c
2416
+ Ar.map((t) => /* @__PURE__ */ P("div", {
2417
+ className: "flex flex-col gap-1.5",
2418
+ children: [/* @__PURE__ */ P("label", {
2419
+ htmlFor: `billing-${t.key}`,
2420
+ className: Nr,
2421
+ children: [t.label, /* @__PURE__ */ N(Pr, {})]
2422
+ }), /* @__PURE__ */ N("input", {
2423
+ id: `billing-${t.key}`,
2424
+ className: Mr(),
2425
+ placeholder: t.placeholder,
2426
+ autoComplete: t.autoComplete,
2427
+ value: e.billing_details[t.key],
2428
+ onChange: (e) => n(t.key, e.target.value),
2429
+ required: e.is_business_purchase
2430
+ })]
2431
+ }, t.key)),
2432
+ /* @__PURE__ */ N("div", {
2433
+ className: "grid grid-cols-2 gap-3",
2434
+ children: jr.map((t) => /* @__PURE__ */ P("div", {
2435
+ className: X("flex flex-col gap-1.5", t.wide && "col-span-2"),
2436
+ children: [/* @__PURE__ */ P("label", {
2437
+ htmlFor: `billing-${t.key}`,
2438
+ className: Nr,
2439
+ children: [t.label, !t.optional && /* @__PURE__ */ N(Pr, {})]
2440
+ }), /* @__PURE__ */ N("input", {
2441
+ id: `billing-${t.key}`,
2442
+ className: Mr(),
2443
+ placeholder: t.placeholder,
2444
+ autoComplete: t.autoComplete,
2445
+ inputMode: t.key === "postal_code" ? "numeric" : void 0,
2446
+ value: e.billing_details.address[t.key],
2447
+ onChange: (e) => r(t.key, e.target.value),
2448
+ required: e.is_business_purchase && !t.optional
2449
+ })]
2450
+ }, t.key))
2344
2451
  })
2345
2452
  ]
2346
- }, a.key);
2347
- }),
2348
- a && /* @__PURE__ */ P("div", {
2349
- className: "rounded-xl border border-border bg-ink/3",
2350
- children: [
2351
- /* @__PURE__ */ P("label", {
2352
- htmlFor: "is_business_purchase",
2353
- className: "flex w-full cursor-pointer items-center gap-2.5 px-3.5 py-3 text-ink text-sm",
2354
- children: [/* @__PURE__ */ N("input", {
2355
- id: "is_business_purchase",
2356
- type: "checkbox",
2357
- checked: e.is_business_purchase,
2358
- onChange: (e) => r("is_business_purchase", e.target.checked),
2359
- "aria-expanded": e.is_business_purchase,
2360
- className: "size-4 shrink-0 cursor-pointer rounded accent-brand"
2361
- }), "Bill this to a business — I need a GST invoice"]
2362
- }),
2363
- !e.is_business_purchase && u && /* @__PURE__ */ N("p", {
2364
- className: "m-0 px-3.5 pb-3 text-amber-700 text-xs leading-relaxed starting:opacity-0 transition-opacity duration-200 dark:text-amber-400",
2365
- children: "Your billing details are still saved — tick the box to apply them."
2366
- }),
2367
- /* @__PURE__ */ N(xr, {
2368
- open: e.is_business_purchase,
2369
- className: "px-3.5 pb-3.5",
2370
- children: /* @__PURE__ */ P("div", {
2371
- className: "flex flex-col gap-3",
2453
+ })
2454
+ })
2455
+ ]
2456
+ });
2457
+ }, Lr = ({ attendees: e, openKey: t, onOpenChange: n }) => {
2458
+ let { slots: r } = e, i = [];
2459
+ for (let e of r) {
2460
+ let t = i.at(-1);
2461
+ t?.ticketId === e.ticket._id ? t.slots.push(e) : i.push({
2462
+ ticketId: e.ticket._id,
2463
+ title: e.ticket.title,
2464
+ slots: [e]
2465
+ });
2466
+ }
2467
+ let a = (t) => {
2468
+ e.touchSlot(t), e.isSlotValid(t) && n(r[r.findIndex((e) => e.key === t) + 1]?.key ?? null);
2469
+ };
2470
+ return /* @__PURE__ */ N(U.Root, {
2471
+ value: t ? [t] : [],
2472
+ onValueChange: (e) => n(e[0] ?? null),
2473
+ className: "flex flex-col gap-5",
2474
+ children: i.map((n) => /* @__PURE__ */ P("section", {
2475
+ className: "flex flex-col gap-2",
2476
+ children: [/* @__PURE__ */ P("h4", {
2477
+ className: "m-0 font-semibold text-[15px] text-ink leading-snug [overflow-wrap:anywhere]",
2478
+ children: [n.title, n.slots.length > 1 && /* @__PURE__ */ P("span", {
2479
+ className: "ml-1.5 font-normal text-ink-muted tabular-nums",
2480
+ children: ["× ", n.slots.length]
2481
+ })]
2482
+ }), n.slots.map((n, i) => {
2483
+ let o = n.key === t, s = n.key === r.at(-1)?.key, c = e.getValues(n.key), l = e.isSlotValid(n.key), u = !l && e.isSlotVisited(n.key), d = n.key === r[0]?.key;
2484
+ return /* @__PURE__ */ P(U.Item, {
2485
+ value: n.key,
2486
+ className: X("rounded-xl border transition-colors", o ? "border-brand/60" : u ? "border-danger/50" : "border-border"),
2487
+ children: [/* @__PURE__ */ N(U.Header, {
2488
+ className: "m-0",
2489
+ children: /* @__PURE__ */ P(U.Trigger, {
2490
+ className: "group flex w-full items-center gap-3 px-3.5 py-3 text-left",
2372
2491
  children: [
2373
- /* @__PURE__ */ N("p", {
2374
- className: "m-0 text-ink-muted text-xs leading-relaxed",
2375
- children: "This booking will be billed to your business. The invoice is raised against the details below."
2492
+ /* @__PURE__ */ N("span", {
2493
+ "aria-hidden": !0,
2494
+ className: X("inline-flex size-7 shrink-0 items-center justify-center rounded-full font-semibold text-[12.5px] tabular-nums transition-colors", l ? "bg-emerald-500/10 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-400" : u ? "bg-danger/10 text-danger" : "bg-ink/5 text-ink-soft"),
2495
+ children: l ? /* @__PURE__ */ N(H, { className: "size-3.5" }) : i + 1
2376
2496
  }),
2377
- Cr.map((t) => /* @__PURE__ */ P("div", {
2378
- className: "flex flex-col gap-1.5",
2379
- children: [/* @__PURE__ */ P("label", {
2380
- htmlFor: `billing-${t.key}`,
2381
- className: Er,
2382
- children: [t.label, /* @__PURE__ */ N(Dr, {})]
2383
- }), /* @__PURE__ */ N("input", {
2384
- id: `billing-${t.key}`,
2385
- className: Tr(),
2386
- placeholder: t.placeholder,
2387
- autoComplete: t.autoComplete,
2388
- value: e.billing_details[t.key],
2389
- onChange: (e) => c(t.key, e.target.value),
2390
- required: e.is_business_purchase
2497
+ /* @__PURE__ */ P("span", {
2498
+ className: "min-w-0 flex-1",
2499
+ children: [/* @__PURE__ */ P("span", {
2500
+ className: "block font-medium text-[14.5px] text-ink",
2501
+ children: ["Attendee ", i + 1]
2502
+ }), !o && /* @__PURE__ */ N("span", {
2503
+ className: X("mt-0.5 block truncate text-[12.5px]", u ? "text-danger" : "text-ink-muted"),
2504
+ children: u ? "Details missing" : c.name.trim() || (d ? "Your details" : "Add details")
2391
2505
  })]
2392
- }, t.key)),
2393
- /* @__PURE__ */ N("div", {
2394
- className: "grid grid-cols-2 gap-3",
2395
- children: wr.map((t) => /* @__PURE__ */ P("div", {
2396
- className: Z("flex flex-col gap-1.5", t.wide && "col-span-2"),
2397
- children: [/* @__PURE__ */ P("label", {
2398
- htmlFor: `billing-${t.key}`,
2399
- className: Er,
2400
- children: [t.label, !t.optional && /* @__PURE__ */ N(Dr, {})]
2401
- }), /* @__PURE__ */ N("input", {
2402
- id: `billing-${t.key}`,
2403
- className: Tr(),
2404
- placeholder: t.placeholder,
2405
- autoComplete: t.autoComplete,
2406
- inputMode: t.key === "postal_code" ? "numeric" : void 0,
2407
- value: e.billing_details.address[t.key],
2408
- onChange: (e) => l(t.key, e.target.value),
2409
- required: e.is_business_purchase && !t.optional
2410
- })]
2411
- }, t.key))
2506
+ }),
2507
+ /* @__PURE__ */ N(ae, {
2508
+ "aria-hidden": !0,
2509
+ className: "size-4 shrink-0 text-ink-muted transition-transform group-data-[panel-open]:rotate-180"
2412
2510
  })
2413
2511
  ]
2414
2512
  })
2415
- })
2416
- ]
2417
- })
2418
- ]
2513
+ }), /* @__PURE__ */ N(U.Panel, {
2514
+ className: "h-[var(--accordion-panel-height)] overflow-hidden transition-[height] duration-250 ease-[cubic-bezier(0.32,0.72,0,1)] data-[ending-style]:h-0 data-[starting-style]:h-0 motion-reduce:transition-none",
2515
+ children: /* @__PURE__ */ P("div", {
2516
+ className: "flex flex-col gap-4 px-3.5 pb-3.5",
2517
+ children: [/* @__PURE__ */ N(Fr, {
2518
+ idPrefix: `attendee-${n.key.replace(":", "-")}`,
2519
+ nameLabel: "Full name",
2520
+ values: c,
2521
+ errors: e.errors[n.key] ?? {},
2522
+ touched: e.getTouched(n.key),
2523
+ onChange: (t, r) => e.setField(n.key, t, r),
2524
+ onBlur: (t) => e.touchField(n.key, t),
2525
+ registrationFields: n.rules
2526
+ }), !s && /* @__PURE__ */ N("button", {
2527
+ type: "button",
2528
+ onClick: () => a(n.key),
2529
+ className: "inline-flex min-h-[42px] items-center justify-center rounded-xl border border-border font-medium text-[14px] text-ink transition hover:border-brand active:scale-[0.985]",
2530
+ children: "Next attendee"
2531
+ })]
2532
+ })
2533
+ })]
2534
+ }, n.key);
2535
+ })]
2536
+ }, n.ticketId))
2419
2537
  });
2420
- }, kr = {
2538
+ }, Rr = {
2421
2539
  USD: "$",
2422
2540
  EUR: "€",
2423
2541
  GBP: "£",
2424
2542
  INR: "₹"
2425
- }, Q = (e) => {
2543
+ }, Z = (e) => {
2426
2544
  let t = e?.unit_amount;
2427
2545
  if (t == null) return "";
2428
2546
  if (t === 0) return "Free";
@@ -2435,17 +2553,102 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2435
2553
  maximumFractionDigits: 2
2436
2554
  }).format(r);
2437
2555
  } catch {
2438
- return `${kr[n] ?? n} ${r.toLocaleString()}`;
2556
+ return `${Rr[n] ?? n} ${r.toLocaleString()}`;
2439
2557
  }
2440
- }, Ar = (e) => !e.tax_enabled || !e.taxes?.length ? null : e.tax_inclusive ? "incl. taxes" : "+ taxes", jr = (e) => !!e?.taxes?.length && e.tax_amount !== void 0, Mr = (e) => !!e && "subtotal" in e && e.tax_enabled === !0 && !!e.taxes?.length, Nr = (e, t) => t ? t.total_amount ?? t.sale_amount ?? 0 : Mr(e) ? e.total ?? e.unit_amount ?? 0 : e?.unit_amount ?? 0, Pr = (e, t) => {
2558
+ }, zr = (e) => !e.tax_enabled || !e.taxes?.length ? null : e.tax_inclusive ? "incl. taxes" : "+ taxes", Br = (e) => !!e?.taxes?.length && e.tax_amount !== void 0, Vr = (e) => !!e && "subtotal" in e && e.tax_enabled === !0 && !!e.taxes?.length, Hr = (e, t) => t ? t.total_amount ?? t.sale_amount ?? 0 : Vr(e) ? e.total ?? e.unit_amount ?? 0 : e?.unit_amount ?? 0, Ur = (e, t) => {
2441
2559
  if (!e) return null;
2442
- let n = Nr(e, t);
2560
+ let n = Hr(e, t);
2443
2561
  return {
2444
2562
  amount: n,
2445
2563
  currency: e.currency,
2446
2564
  isFree: n === 0
2447
2565
  };
2448
- }, Fr = (e, t) => t ? t.base_amount ?? 0 : Mr(e) ? e.subtotal ?? e.unit_amount ?? 0 : e?.unit_amount ?? 0, Ir = (e, t) => jr(t) ? t.taxes : !t && Mr(e) ? e.taxes : [], Lr = (e, t) => !t || e.tickets.length === 0 ? !0 : e.tickets.some((e) => typeof e == "string" ? e === t : e._id === t), Rr = (e) => e.kind === "percent" ? `${e.percent_off}% off` : `${kr[e.currency ?? "INR"] ?? ""}${(e.amount_off ?? 0) / 100} off`, zr = ({ couponCode: e, onCouponCodeChange: t, couponError: n, couponLoading: r, onValidateCoupon: i, onRemoveCoupon: a, publicCoupons: o, discount: s, selectedTicket: c }) => {
2566
+ }, Wr = (e, t) => t ? t.base_amount ?? 0 : Vr(e) ? e.subtotal ?? e.unit_amount ?? 0 : e?.unit_amount ?? 0, Gr = (e, t) => Br(t) ? t.taxes : !t && Vr(e) ? e.taxes : [], Kr = ({ ticket: e, count: t }) => Hr(e, null) * t, qr = (e, t) => {
2567
+ if (e.length === 0) return null;
2568
+ let n = t ? Hr(null, t) : e.reduce((e, t) => e + Kr(t), 0);
2569
+ return {
2570
+ amount: n,
2571
+ currency: e[0]?.ticket.currency,
2572
+ isFree: n === 0
2573
+ };
2574
+ }, Jr = ({ lines: e, discount: t, pricing: n }) => {
2575
+ let r = n?.currency, i = e.some((e) => zr(e.ticket));
2576
+ return /* @__PURE__ */ P("div", {
2577
+ className: "rounded-xl border border-border bg-ink/3 px-3.5 py-3",
2578
+ children: [/* @__PURE__ */ P("div", {
2579
+ className: "flex flex-col gap-1.5 text-[13.5px] text-ink-soft",
2580
+ children: [
2581
+ e.map((e) => /* @__PURE__ */ P("div", {
2582
+ className: "flex items-baseline justify-between gap-3",
2583
+ children: [/* @__PURE__ */ P("span", {
2584
+ className: "min-w-0 [overflow-wrap:anywhere]",
2585
+ children: [
2586
+ /* @__PURE__ */ P("span", {
2587
+ className: "text-ink tabular-nums",
2588
+ children: [e.count, " ×"]
2589
+ }),
2590
+ " ",
2591
+ e.ticket.title
2592
+ ]
2593
+ }), /* @__PURE__ */ N("span", {
2594
+ className: "shrink-0 tabular-nums",
2595
+ children: Z({
2596
+ unit_amount: Kr(e),
2597
+ currency: r
2598
+ })
2599
+ })]
2600
+ }, e.ticket._id)),
2601
+ t && t.discount > 0 && /* @__PURE__ */ P("div", {
2602
+ className: "flex items-center justify-between gap-3 text-emerald-700 dark:text-emerald-400",
2603
+ children: [/* @__PURE__ */ N("span", { children: "Discount" }), /* @__PURE__ */ P("span", {
2604
+ className: "tabular-nums",
2605
+ children: ["-", Z({
2606
+ unit_amount: t.discount,
2607
+ currency: r
2608
+ })]
2609
+ })]
2610
+ }),
2611
+ i && /* @__PURE__ */ N("p", {
2612
+ className: "m-0 text-ink-muted text-xs",
2613
+ children: "Prices include applicable taxes"
2614
+ })
2615
+ ]
2616
+ }), /* @__PURE__ */ P("div", {
2617
+ className: "mt-2.5 flex items-center justify-between gap-3 border-border border-t pt-2.5 font-semibold text-[15px] text-ink",
2618
+ children: [/* @__PURE__ */ N("span", { children: "Total" }), /* @__PURE__ */ N("span", {
2619
+ className: "tabular-nums",
2620
+ children: Z({
2621
+ unit_amount: n?.amount,
2622
+ currency: r
2623
+ })
2624
+ })]
2625
+ })]
2626
+ });
2627
+ }, Yr = ({ payment: e, label: t, isPaid: n, blockedReason: r }) => {
2628
+ let { state: i } = e, a = i.kind === "busy";
2629
+ return /* @__PURE__ */ P(M, { children: [
2630
+ (i.kind === "unpaid" || i.kind === "failed") && /* @__PURE__ */ P("p", {
2631
+ role: "alert",
2632
+ className: "m-0 mb-2.5 rounded-xl bg-danger/10 px-3 py-2.5 text-danger text-sm starting:opacity-0 transition-opacity duration-200 motion-reduce:transition-none",
2633
+ children: [i.message, i.kind === "unpaid" && /* @__PURE__ */ N("button", {
2634
+ type: "button",
2635
+ onClick: e.retry,
2636
+ className: "ml-1.5 inline-flex items-center gap-1 font-semibold underline underline-offset-[3px]",
2637
+ children: "Pay again"
2638
+ })]
2639
+ }),
2640
+ /* @__PURE__ */ P("button", {
2641
+ type: "submit",
2642
+ disabled: a || !!r,
2643
+ className: "inline-flex min-h-[50px] w-full items-center justify-center gap-2 rounded-xl bg-brand font-semibold text-[15.5px] text-brand-foreground transition active:scale-[0.985] disabled:opacity-55",
2644
+ children: [a && /* @__PURE__ */ N(se, { className: "size-4 animate-spin" }), a && i.stage === "paying" ? "Opening secure checkout" : t]
2645
+ }),
2646
+ /* @__PURE__ */ N("p", {
2647
+ className: "m-0 mt-2 text-center text-ink-muted text-xs",
2648
+ children: r ?? (n ? "Secure payment · confirmation sent to your email" : "No card needed · joining link sent to your email")
2649
+ })
2650
+ ] });
2651
+ }, Xr = (e, t) => t.length === 0 || e.tickets.length === 0 ? !0 : e.tickets.some((e) => t.includes(typeof e == "string" ? e : e._id)), Zr = (e) => e.kind === "percent" ? `${e.percent_off}% off` : `${Rr[e.currency ?? "INR"] ?? ""}${(e.amount_off ?? 0) / 100} off`, Qr = ({ couponCode: e, onCouponCodeChange: t, couponError: n, couponLoading: r, onValidateCoupon: i, onRemoveCoupon: a, publicCoupons: o, discount: s, tickets: c }) => {
2449
2652
  let [l, u] = A(!1);
2450
2653
  if (s) return /* @__PURE__ */ P("div", {
2451
2654
  className: "flex starting:scale-95 items-center justify-between gap-2.5 rounded-xl border border-emerald-600/40 bg-emerald-500/10 px-3.5 py-2.5 text-[13px] text-emerald-800 starting:opacity-0 transition-[opacity,scale] duration-200 ease-out dark:bg-emerald-500/15 dark:text-emerald-300",
@@ -2459,9 +2662,9 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2459
2662
  children: [
2460
2663
  "saves",
2461
2664
  " ",
2462
- Q({
2665
+ Z({
2463
2666
  unit_amount: s.discount,
2464
- currency: c?.currency
2667
+ currency: c[0]?.currency
2465
2668
  })
2466
2669
  ]
2467
2670
  })]
@@ -2472,10 +2675,10 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2472
2675
  },
2473
2676
  "aria-label": "Remove coupon",
2474
2677
  className: "inline-flex shrink-0 rounded-md p-1 hover:bg-emerald-600/15",
2475
- children: /* @__PURE__ */ N(ce, { className: "size-4" })
2678
+ children: /* @__PURE__ */ N(ue, { className: "size-4" })
2476
2679
  })]
2477
2680
  });
2478
- let d = o.filter((e) => Lr(e, c?._id));
2681
+ let d = o.filter((e) => Xr(e, c.map((e) => e._id)));
2479
2682
  return /* @__PURE__ */ P("div", {
2480
2683
  className: "flex flex-col",
2481
2684
  children: [/* @__PURE__ */ N("button", {
@@ -2484,7 +2687,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2484
2687
  onClick: () => u((e) => !e),
2485
2688
  className: "self-start text-[13px] text-ink-soft underline underline-offset-[3px] hover:text-ink",
2486
2689
  children: "Have a code?"
2487
- }), /* @__PURE__ */ N(xr, {
2690
+ }), /* @__PURE__ */ N(Or, {
2488
2691
  open: l,
2489
2692
  children: /* @__PURE__ */ P("div", {
2490
2693
  className: "flex flex-col gap-2 pt-2",
@@ -2503,7 +2706,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2503
2706
  onKeyDown: (t) => {
2504
2707
  t.key === "Enter" && (t.preventDefault(), e.trim() && i());
2505
2708
  },
2506
- className: Z("w-full min-w-0 rounded-xl border bg-page px-3.5 py-2.5 text-base text-ink uppercase outline-none transition placeholder:text-ink-muted/60 placeholder:normal-case", n ? "border-danger focus:ring-[3px] focus:ring-danger/15" : "border-border focus:border-brand focus:ring-[3px] focus:ring-brand/20")
2709
+ className: X("w-full min-w-0 rounded-xl border bg-page px-3.5 py-2.5 text-base text-ink uppercase outline-none transition placeholder:text-ink-muted/60 placeholder:normal-case", n ? "border-danger focus:ring-[3px] focus:ring-danger/15" : "border-border focus:border-brand focus:ring-[3px] focus:ring-brand/20")
2507
2710
  }), /* @__PURE__ */ P("button", {
2508
2711
  type: "button",
2509
2712
  disabled: !e.trim() || r,
@@ -2528,7 +2731,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2528
2731
  children: [
2529
2732
  e.code,
2530
2733
  " · ",
2531
- Rr(e)
2734
+ Zr(e)
2532
2735
  ]
2533
2736
  }, e._id))
2534
2737
  })
@@ -2536,11 +2739,11 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2536
2739
  })
2537
2740
  })]
2538
2741
  });
2539
- }, Br = (e) => {
2742
+ }, $r = (e) => {
2540
2743
  if (e < 60) return `${e} min`;
2541
2744
  let t = Math.floor(e / 60), n = e % 60, r = `${t} hr`;
2542
2745
  return n ? `${r} ${n} min` : r;
2543
- }, Vr = (e, t) => {
2746
+ }, ei = (e, t) => {
2544
2747
  if (!e) return null;
2545
2748
  let n = new Date(e);
2546
2749
  if (Number.isNaN(n.getTime())) return null;
@@ -2555,26 +2758,26 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2555
2758
  }).format(n), a = null;
2556
2759
  if (t) {
2557
2760
  let e = new Date(t), r = Math.round((e.getTime() - n.getTime()) / 6e4);
2558
- !Number.isNaN(r) && r > 0 && (a = Br(r));
2761
+ !Number.isNaN(r) && r > 0 && (a = $r(r));
2559
2762
  }
2560
2763
  return {
2561
2764
  day: r,
2562
2765
  time: i,
2563
2766
  duration: a
2564
2767
  };
2565
- }, Hr = 60, Ur = (e) => e.toISOString().replace(/[-:]/g, "").replace(/\.\d+/, ""), Wr = (e) => {
2768
+ }, ti = 60, ni = (e) => e.toISOString().replace(/[-:]/g, "").replace(/\.\d+/, ""), ri = (e) => {
2566
2769
  if (!e.startsAt) return null;
2567
2770
  let t = new Date(e.startsAt);
2568
2771
  if (Number.isNaN(t.getTime())) return null;
2569
2772
  let n = e.endsAt ? new Date(e.endsAt) : null;
2570
2773
  return {
2571
2774
  start: t,
2572
- end: n && !Number.isNaN(n.getTime()) && n > t ? n : new Date(t.getTime() + Hr * 6e4)
2775
+ end: n && !Number.isNaN(n.getTime()) && n > t ? n : new Date(t.getTime() + ti * 6e4)
2573
2776
  };
2574
- }, Gr = (e) => {
2575
- let t = Wr(e);
2777
+ }, ii = (e) => {
2778
+ let t = ri(e);
2576
2779
  if (!t) return null;
2577
- let n = Ur(t.start), r = Ur(t.end), i = [e.description, e.url].filter(Boolean).join("\n\n"), a = `https://calendar.google.com/calendar/render?${new URLSearchParams({
2780
+ let n = ni(t.start), r = ni(t.end), i = [e.description, e.url].filter(Boolean).join("\n\n"), a = `https://calendar.google.com/calendar/render?${new URLSearchParams({
2578
2781
  action: "TEMPLATE",
2579
2782
  text: e.title,
2580
2783
  dates: `${n}/${r}`,
@@ -2608,65 +2811,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2608
2811
  "END:VCALENDAR"
2609
2812
  ].filter(Boolean).join("\r\n")
2610
2813
  };
2611
- }, Kr = ({ selectedTicket: e, discount: t }) => {
2612
- let [n, r] = A(!1), i = e?.currency, a = Nr(e, t), o = Fr(e, t), s = Ir(e, t), c = t?.discount ?? 0, l = s.length > 0 || c > 0 || o !== a, u = /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ P("span", {
2613
- className: "inline-flex items-center gap-1.5",
2614
- children: ["Total", l && /* @__PURE__ */ N(V, { className: Z("size-4 text-ink-muted transition-transform", n && "rotate-180") })]
2615
- }), /* @__PURE__ */ N("span", { children: Q({
2616
- unit_amount: a,
2617
- currency: i
2618
- }) })] }), d = "flex w-full items-center justify-between gap-3 px-3.5 py-3 font-semibold text-[15px] text-ink";
2619
- return /* @__PURE__ */ P("div", {
2620
- className: "rounded-xl border border-border bg-ink/3",
2621
- children: [l ? /* @__PURE__ */ N("button", {
2622
- type: "button",
2623
- onClick: () => r((e) => !e),
2624
- "aria-expanded": n,
2625
- className: d,
2626
- children: u
2627
- }) : /* @__PURE__ */ N("div", {
2628
- className: d,
2629
- children: u
2630
- }), l && /* @__PURE__ */ N(xr, {
2631
- open: n,
2632
- children: /* @__PURE__ */ P("div", {
2633
- className: "flex flex-col gap-1.5 px-3.5 pb-3 text-[13px] text-ink-soft",
2634
- children: [
2635
- /* @__PURE__ */ P("div", {
2636
- className: "flex items-center justify-between gap-3",
2637
- children: [/* @__PURE__ */ N("span", { children: "Subtotal" }), /* @__PURE__ */ N("span", { children: Q({
2638
- unit_amount: o,
2639
- currency: i
2640
- }) })]
2641
- }),
2642
- c > 0 && /* @__PURE__ */ P("div", {
2643
- className: "flex items-center justify-between gap-3 text-emerald-700 dark:text-emerald-400",
2644
- children: [/* @__PURE__ */ N("span", { children: "Discount" }), /* @__PURE__ */ P("span", { children: ["-", Q({
2645
- unit_amount: c,
2646
- currency: i
2647
- })] })]
2648
- }),
2649
- s.map((e, t) => /* @__PURE__ */ P("div", {
2650
- className: "flex items-center justify-between gap-3",
2651
- children: [/* @__PURE__ */ P("span", { children: [
2652
- e.label,
2653
- " (",
2654
- e.percentage,
2655
- "%)"
2656
- ] }), /* @__PURE__ */ N("span", { children: Q({
2657
- unit_amount: e.amount,
2658
- currency: i
2659
- }) })]
2660
- }, e.id || e._id || t)),
2661
- e?.tax_inclusive && /* @__PURE__ */ N("p", {
2662
- className: "m-0 text-ink-muted text-xs",
2663
- children: "Price is inclusive of taxes"
2664
- })
2665
- ]
2666
- })
2667
- })]
2668
- });
2669
- }, qr = (e) => {
2814
+ }, ai = (e) => {
2670
2815
  let [t, n] = A(null);
2671
2816
  return E(() => {
2672
2817
  let t = e ? window.visualViewport : null;
@@ -2679,8 +2824,8 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2679
2824
  t.removeEventListener("resize", r), t.removeEventListener("scroll", r);
2680
2825
  };
2681
2826
  }, [e]), t;
2682
- }, Jr = ({ open: e, title: t, when: n, onClose: r, onClosed: i, onSubmit: a, footer: o, wide: s, initialFocusRef: c, layers: l, children: u }) => {
2683
- let d = k(null), f = qr(e), [p, m] = A(!1), h = /* @__PURE__ */ N("div", {
2827
+ }, oi = ({ open: e, title: t, when: n, onClose: r, onClosed: i, onSubmit: a, footer: o, wide: s, initialFocusRef: c, layers: l, children: u }) => {
2828
+ let d = k(null), f = ai(e), [p, m] = A(!1), h = /* @__PURE__ */ N("div", {
2684
2829
  onScroll: (e) => m(e.currentTarget.scrollTop > 2),
2685
2830
  className: "min-h-0 flex-1 overflow-y-auto overflow-x-hidden overscroll-contain",
2686
2831
  children: /* @__PURE__ */ P("div", {
@@ -2712,10 +2857,10 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2712
2857
  "--viewport-height": f ? `${f.height}px` : "100dvh",
2713
2858
  "--viewport-top": f ? `${f.offsetTop}px` : "0px"
2714
2859
  },
2715
- className: Z("fixed inset-x-0 top-[var(--viewport-top)] z-[2147483000] flex h-[var(--viewport-height)] flex-col overflow-hidden bg-page font-body text-ink antialiased outline-none", "sm:inset-x-auto sm:top-[6vh] sm:left-1/2 sm:h-auto sm:max-h-[min(88dvh,var(--viewport-height))] sm:w-[calc(100%-2rem)] sm:-translate-x-1/2 sm:rounded-2xl sm:border sm:border-border sm:shadow-2xl", s ? "sm:max-w-[540px]" : "sm:max-w-[460px]", "transition-[opacity,translate] duration-200 ease-out data-[ending-style]:duration-150 motion-reduce:transition-none", "data-[ending-style]:translate-y-4 data-[starting-style]:translate-y-4 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0", "sm:data-[ending-style]:translate-y-2 sm:data-[starting-style]:translate-y-2"),
2860
+ className: X("fixed inset-x-0 top-[var(--viewport-top)] z-[2147483000] flex h-[var(--viewport-height)] flex-col overflow-hidden bg-page font-body text-ink antialiased outline-none", "sm:inset-x-auto sm:top-[6vh] sm:left-1/2 sm:h-auto sm:max-h-[min(88dvh,var(--viewport-height))] sm:w-[calc(100%-2rem)] sm:-translate-x-1/2 sm:rounded-2xl sm:border sm:border-border sm:shadow-2xl", s ? "sm:max-w-[540px]" : "sm:max-w-[460px]", "transition-[opacity,translate] duration-200 ease-out data-[ending-style]:duration-150 motion-reduce:transition-none", "data-[ending-style]:translate-y-4 data-[starting-style]:translate-y-4 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0", "sm:data-[ending-style]:translate-y-2 sm:data-[starting-style]:translate-y-2"),
2716
2861
  children: [
2717
2862
  /* @__PURE__ */ P("div", {
2718
- className: Z("sticky top-0 z-10 shrink-0 border-b bg-page px-5 pt-[max(env(safe-area-inset-top),16px)] pb-2 transition-colors", p ? "border-border" : "border-transparent"),
2863
+ className: X("sticky top-0 z-10 shrink-0 border-b bg-page px-5 pt-[max(env(safe-area-inset-top),16px)] pb-2 transition-colors", p ? "border-border" : "border-transparent"),
2719
2864
  children: [/* @__PURE__ */ P("div", {
2720
2865
  className: "flex items-center justify-between gap-3",
2721
2866
  children: [/* @__PURE__ */ N(F.Title, {
@@ -2724,7 +2869,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2724
2869
  }), /* @__PURE__ */ N(F.Close, {
2725
2870
  "aria-label": "Close",
2726
2871
  className: "-mr-1.5 inline-flex size-8 shrink-0 items-center justify-center rounded-full text-ink-soft transition hover:bg-ink/5 hover:text-ink",
2727
- children: /* @__PURE__ */ N(ce, { className: "size-4" })
2872
+ children: /* @__PURE__ */ N(ue, { className: "size-4" })
2728
2873
  })]
2729
2874
  }), n && /* @__PURE__ */ P("p", {
2730
2875
  className: "m-0 mt-3.5 text-[13.5px] text-ink-soft",
@@ -2745,8 +2890,36 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2745
2890
  ]
2746
2891
  })] })
2747
2892
  });
2748
- }, Yr = "block w-full rounded-lg px-2.5 py-2 text-left text-ink text-sm no-underline hover:bg-ink/5", Xr = "transition-[opacity,translate] duration-300 ease-out starting:translate-y-2 starting:opacity-0 motion-reduce:transition-none", Zr = "inline-flex min-h-[46px] w-full items-center justify-center gap-2 rounded-xl border border-border font-medium text-[14.5px] text-ink no-underline transition hover:border-brand active:scale-[0.985]", Qr = ({ email: e, eventTitle: t, startsAt: n, endsAt: r, eventUrl: i, when: a, bookingRef: o, qrImageUrl: s, invoiceUrl: c, onClose: l, onRegisterAnother: u }) => {
2749
- let d = Gr({
2893
+ }, si = "inline-flex items-center justify-center rounded-lg bg-brand px-4 py-3 font-semibold text-brand-foreground transition hover:opacity-90", ci = ({ buttonText: e, registeredEmail: t, isSheetOpen: n, isLoading: r, onOpen: i, onRegisterAnother: a }) => /* @__PURE__ */ N("div", {
2894
+ className: "my-2",
2895
+ children: t && !n ? /* @__PURE__ */ P("span", {
2896
+ className: "inline-flex flex-wrap items-center gap-2 rounded-xl border border-border bg-ink/3 px-3.5 py-2.5 text-ink text-sm",
2897
+ children: [
2898
+ /* @__PURE__ */ N(H, { className: "size-4 text-emerald-600 dark:text-emerald-400" }),
2899
+ "You're registered as ",
2900
+ t,
2901
+ /* @__PURE__ */ N("button", {
2902
+ type: "button",
2903
+ onClick: a,
2904
+ className: "text-ink-soft underline underline-offset-[3px] hover:text-ink",
2905
+ children: "Register someone else"
2906
+ })
2907
+ ]
2908
+ }) : /* @__PURE__ */ N("button", {
2909
+ type: "button",
2910
+ onClick: i,
2911
+ disabled: r,
2912
+ className: X(si, "disabled:opacity-60"),
2913
+ children: e
2914
+ })
2915
+ }), li = ({ hasFailed: e }) => /* @__PURE__ */ N("div", {
2916
+ className: "my-2",
2917
+ children: /* @__PURE__ */ N("p", {
2918
+ className: "m-0 text-ink-soft text-sm",
2919
+ children: e ? "We couldn't load tickets for this event. Please refresh the page." : "Registration isn't open for this event yet."
2920
+ })
2921
+ }), ui = "block w-full rounded-lg px-2.5 py-2 text-left text-ink text-sm no-underline hover:bg-ink/5", di = "transition-[opacity,translate] duration-300 ease-out starting:translate-y-2 starting:opacity-0 motion-reduce:transition-none", fi = "inline-flex min-h-[46px] w-full items-center justify-center gap-2 rounded-xl border border-border font-medium text-[14.5px] text-ink no-underline transition hover:border-brand active:scale-[0.985]", pi = ({ email: e, eventTitle: t, startsAt: n, endsAt: r, eventUrl: i, when: a, bookingRef: o, qrImageUrl: s, invoiceUrl: c, attendeeCount: l = 1, onClose: u, onRegisterAnother: d }) => {
2922
+ let f = ii({
2750
2923
  title: t,
2751
2924
  startsAt: n,
2752
2925
  endsAt: r,
@@ -2776,11 +2949,11 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2776
2949
  })
2777
2950
  }),
2778
2951
  /* @__PURE__ */ N("h3", {
2779
- className: Z(Xr, "m-0 mt-[18px] font-heading font-semibold text-[22px] text-ink tracking-[-0.016em] delay-[260ms]"),
2952
+ className: X(di, "m-0 mt-[18px] font-heading font-semibold text-[22px] text-ink tracking-[-0.016em] delay-[260ms]"),
2780
2953
  children: "You're in"
2781
2954
  }),
2782
2955
  a && /* @__PURE__ */ P("p", {
2783
- className: Z(Xr, "m-0 mt-1.5 text-[14.5px] text-ink delay-[320ms]"),
2956
+ className: X(di, "m-0 mt-1.5 text-[14.5px] text-ink delay-[320ms]"),
2784
2957
  children: [
2785
2958
  a.day,
2786
2959
  " · ",
@@ -2788,14 +2961,14 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2788
2961
  ]
2789
2962
  }),
2790
2963
  /* @__PURE__ */ P("p", {
2791
- className: Z(Xr, "m-0 mt-1 max-w-[300px] text-[13.5px] text-ink-soft leading-relaxed delay-[360ms]"),
2792
- children: ["Joining link sent to ", /* @__PURE__ */ N("span", {
2964
+ className: X(di, "m-0 mt-1 max-w-[300px] text-[13.5px] text-ink-soft leading-relaxed delay-[360ms]"),
2965
+ children: [l > 1 ? `${l} spots booked · confirmation sent to ` : "Joining link sent to ", /* @__PURE__ */ N("span", {
2793
2966
  className: "text-ink [overflow-wrap:anywhere]",
2794
2967
  children: e
2795
2968
  })]
2796
2969
  }),
2797
2970
  /* @__PURE__ */ P("div", {
2798
- className: Z(Xr, "relative mt-5 w-full max-w-[340px] overflow-hidden rounded-2xl border border-border bg-ink/3 px-4 py-3.5 delay-[420ms]"),
2971
+ className: X(di, "relative mt-5 w-full max-w-[340px] overflow-hidden rounded-2xl border border-border bg-ink/3 px-4 py-3.5 delay-[420ms]"),
2799
2972
  children: [
2800
2973
  /* @__PURE__ */ N("span", {
2801
2974
  "aria-hidden": !0,
@@ -2829,39 +3002,39 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2829
3002
  ]
2830
3003
  }),
2831
3004
  /* @__PURE__ */ P("div", {
2832
- className: Z(Xr, "mt-4 flex w-full max-w-[340px] flex-col gap-2 delay-[520ms]"),
3005
+ className: X(di, "mt-4 flex w-full max-w-[340px] flex-col gap-2 delay-[520ms]"),
2833
3006
  children: [
2834
- d && /* @__PURE__ */ P(H.Root, { children: [/* @__PURE__ */ P(H.Trigger, {
2835
- className: Zr,
3007
+ f && /* @__PURE__ */ P(W.Root, { children: [/* @__PURE__ */ P(W.Trigger, {
3008
+ className: fi,
2836
3009
  children: [/* @__PURE__ */ N(ie, { className: "size-4" }), "Add to calendar"]
2837
- }), /* @__PURE__ */ N(H.Portal, { children: /* @__PURE__ */ N(H.Positioner, {
3010
+ }), /* @__PURE__ */ N(W.Portal, { children: /* @__PURE__ */ N(W.Positioner, {
2838
3011
  sideOffset: 6,
2839
3012
  className: "z-[2147483001]",
2840
- children: /* @__PURE__ */ P(H.Popup, {
3013
+ children: /* @__PURE__ */ P(W.Popup, {
2841
3014
  className: "flex w-[220px] origin-[var(--transform-origin)] flex-col gap-0.5 rounded-2xl border border-border bg-page p-1.5 font-body text-ink shadow-xl outline-none transition-[opacity,scale] duration-150 ease-out data-[ending-style]:scale-95 data-[starting-style]:scale-95 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 motion-reduce:transition-none",
2842
3015
  children: [
2843
3016
  /* @__PURE__ */ N("a", {
2844
- href: d.google,
3017
+ href: f.google,
2845
3018
  target: "_blank",
2846
3019
  rel: "noopener noreferrer",
2847
- className: Yr,
3020
+ className: ui,
2848
3021
  children: "Google Calendar"
2849
3022
  }),
2850
3023
  /* @__PURE__ */ N("a", {
2851
- href: d.outlook,
3024
+ href: f.outlook,
2852
3025
  target: "_blank",
2853
3026
  rel: "noopener noreferrer",
2854
- className: Yr,
3027
+ className: ui,
2855
3028
  children: "Outlook"
2856
3029
  }),
2857
3030
  /* @__PURE__ */ N("button", {
2858
3031
  type: "button",
2859
3032
  onClick: () => {
2860
- if (!d) return;
2861
- let e = new Blob([d.ics], { type: "text/calendar;charset=utf-8" }), n = URL.createObjectURL(e), r = document.createElement("a");
3033
+ if (!f) return;
3034
+ let e = new Blob([f.ics], { type: "text/calendar;charset=utf-8" }), n = URL.createObjectURL(e), r = document.createElement("a");
2862
3035
  r.href = n, r.download = `${t.replace(/[^\w\s-]/g, "").trim() || "event"}.ics`, r.click(), URL.revokeObjectURL(n);
2863
3036
  },
2864
- className: Yr,
3037
+ className: ui,
2865
3038
  children: "Apple Calendar / .ics"
2866
3039
  })
2867
3040
  ]
@@ -2871,12 +3044,12 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2871
3044
  href: c,
2872
3045
  target: "_blank",
2873
3046
  rel: "noopener noreferrer",
2874
- className: Zr,
3047
+ className: fi,
2875
3048
  children: [/* @__PURE__ */ N(oe, { className: "size-4" }), "Download invoice"]
2876
3049
  }),
2877
3050
  /* @__PURE__ */ N("button", {
2878
3051
  type: "button",
2879
- onClick: l,
3052
+ onClick: u,
2880
3053
  className: "inline-flex min-h-[46px] w-full items-center justify-center rounded-xl bg-brand font-semibold text-[15px] text-brand-foreground transition active:scale-[0.985]",
2881
3054
  children: "Done"
2882
3055
  })
@@ -2884,124 +3057,111 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
2884
3057
  }),
2885
3058
  /* @__PURE__ */ N("button", {
2886
3059
  type: "button",
2887
- onClick: u,
3060
+ onClick: d,
2888
3061
  className: "mt-4 text-[13px] text-ink-muted underline underline-offset-[3px] starting:opacity-0 transition-opacity delay-[600ms] duration-300 hover:text-ink motion-reduce:transition-none",
2889
3062
  children: "Register someone else"
2890
3063
  })
2891
3064
  ]
2892
3065
  });
2893
- }, $r = {
3066
+ }, mi = {
2894
3067
  email: "required",
2895
3068
  mobile: "off",
2896
3069
  organization: "off",
2897
3070
  designation: "off"
2898
- }, ei = (e) => e.replace(/[\s()-]/g, ""), ti = (e) => /^\+?\d{7,15}$/.test(ei(e)), ni = (e, t) => {
3071
+ }, hi = (e) => e.replace(/[\s()-]/g, ""), gi = (e) => /^\+?\d{7,15}$/.test(hi(e)), _i = (e, t) => {
2899
3072
  let n = {}, r = [
2900
- ["mobile", ei(e.mobile)],
3073
+ ["mobile", hi(e.mobile)],
2901
3074
  ["organization", e.organization.trim()],
2902
3075
  ["designation", e.designation.trim()]
2903
3076
  ];
2904
3077
  for (let [e, i] of r) t[e] !== "off" && i && (n[e] = i);
2905
3078
  return n;
2906
- }, ri = (e, t) => {
3079
+ }, vi = (e, t) => {
2907
3080
  let n = {};
2908
- e.name.trim() || (n.name = "Please enter your name"), t.email !== "off" && (e.email.trim() ? /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(e.email.trim()) || (n.email = "That email address doesn't look right") : t.email === "required" && (n.email = "Please enter your email")), t.mobile !== "off" && (e.mobile.trim() ? ti(e.mobile) || (n.mobile = "That doesn't look like a valid phone number") : t.mobile === "required" && (n.mobile = "Please enter your phone number"));
3081
+ e.name.trim() || (n.name = "Please enter your name"), t.email !== "off" && (e.email.trim() ? /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(e.email.trim()) || (n.email = "That email address doesn't look right") : t.email === "required" && (n.email = "Please enter your email")), t.mobile !== "off" && (e.mobile.trim() ? gi(e.mobile) || (n.mobile = "That doesn't look like a valid phone number") : t.mobile === "required" && (n.mobile = "Please enter your phone number"));
2909
3082
  for (let r of ["organization", "designation"]) t[r] === "required" && !e[r].trim() && (n[r] = `Please enter your ${r}`);
2910
3083
  return n;
2911
- }, ii = (e) => `levo:event-registration:${e}`, ai = (e) => {
2912
- if (typeof window > "u") return null;
2913
- try {
2914
- let t = window.localStorage.getItem(ii(e));
2915
- return t ? JSON.parse(t) : null;
2916
- } catch {
2917
- return null;
2918
- }
2919
- }, oi = (e, t) => {
2920
- if (!(typeof window > "u")) try {
2921
- window.localStorage.setItem(ii(e), JSON.stringify(t));
2922
- } catch {}
2923
- }, si = (e) => {
2924
- if (!(typeof window > "u")) try {
2925
- window.localStorage.removeItem(ii(e));
2926
- } catch {}
2927
- }, ci = ({ tickets: e, selectedTicket: t, onSelect: n, error: r }) => {
2928
- let [i, a] = A(!t);
2929
- return /* @__PURE__ */ P("fieldset", {
2930
- className: "m-0 flex min-w-0 flex-col gap-2 border-0 p-0",
2931
- children: [
2932
- /* @__PURE__ */ N("legend", {
2933
- className: "mb-2 p-0 font-medium text-ink text-sm",
2934
- children: "Choose your ticket"
2935
- }),
2936
- /* @__PURE__ */ N("div", {
2937
- className: "-mb-2 flex flex-col",
2938
- children: e.map((r) => {
2939
- let o = r._id === t?._id, s = i || o, c = Ar(r);
2940
- return /* @__PURE__ */ N(xr, {
2941
- open: s,
2942
- children: /* @__PURE__ */ P("label", {
2943
- className: Z("mb-2 flex w-full cursor-pointer items-start gap-2.5 rounded-xl border px-3.5 py-3 transition", o ? "border-brand bg-brand/5" : "border-border hover:border-brand/50"),
2944
- children: [
2945
- /* @__PURE__ */ N("input", {
2946
- type: "radio",
2947
- name: "ticket",
2948
- value: r._id,
2949
- checked: o,
2950
- onChange: () => {
2951
- n(r), a(!1);
2952
- },
2953
- onClick: () => {
2954
- i || a(!0);
2955
- },
2956
- className: "sr-only"
2957
- }),
2958
- /* @__PURE__ */ N("span", {
2959
- "aria-hidden": !0,
2960
- className: Z("mt-0.5 size-[17px] shrink-0 rounded-full border transition-all", o ? "border-[5px] border-brand" : "border-border")
2961
- }),
2962
- /* @__PURE__ */ P("span", {
2963
- className: "min-w-0 flex-1 [overflow-wrap:anywhere]",
2964
- children: [/* @__PURE__ */ N("span", {
2965
- className: "block font-medium text-[14.5px] text-ink leading-snug",
2966
- children: r.title
2967
- }), r.description && /* @__PURE__ */ N("span", {
2968
- title: r.description,
2969
- className: Z("mt-0.5 block text-[12.5px] text-ink-soft leading-snug", !i && "line-clamp-2"),
2970
- children: r.description
2971
- })]
2972
- }),
2973
- /* @__PURE__ */ P("span", {
2974
- className: "flex shrink-0 flex-col items-end gap-1.5",
2975
- children: [/* @__PURE__ */ P("span", {
2976
- className: "text-right font-medium text-[14.5px] text-ink",
2977
- children: [Q(r), c && /* @__PURE__ */ N("span", {
2978
- className: "block font-normal text-[11.5px] text-ink-muted",
2979
- children: c
2980
- })]
2981
- }), o && !i && e.length > 1 && /* @__PURE__ */ P("span", {
2982
- className: "inline-flex items-center gap-1 whitespace-nowrap rounded-full border border-brand/40 px-2.5 py-1 font-medium text-[12px] text-brand",
2983
- children: [
2984
- e.length - 1,
2985
- " more",
2986
- /* @__PURE__ */ N(V, {
2987
- "aria-hidden": !0,
2988
- className: "size-3.5"
2989
- })
2990
- ]
2991
- })]
2992
- })
2993
- ]
3084
+ }, yi = (e) => e.quantity === null || e.quantity === void 0 ? 10 : Math.max(0, Math.min(10, e.quantity - (e.sale_count ?? 0))), bi = "inline-flex size-8 items-center justify-center rounded-full border border-border text-ink transition hover:border-brand hover:text-brand active:scale-95 disabled:pointer-events-none disabled:opacity-35", xi = ({ tickets: e, counts: t, onChange: n, error: r }) => /* @__PURE__ */ P("fieldset", {
3085
+ className: "m-0 flex min-w-0 flex-col gap-2 border-0 p-0",
3086
+ children: [
3087
+ /* @__PURE__ */ N("legend", {
3088
+ className: "mb-2 p-0 font-medium text-ink text-sm",
3089
+ children: "Choose your tickets"
3090
+ }),
3091
+ e.map((e) => {
3092
+ let r = t[e._id] ?? 0, i = yi(e), a = i === 0, o = zr(e);
3093
+ return /* @__PURE__ */ P("div", {
3094
+ className: X("flex w-full items-start gap-3 rounded-xl border px-3.5 py-3 transition", r > 0 ? "border-brand bg-brand/5" : "border-border", a && "opacity-60"),
3095
+ children: [/* @__PURE__ */ P("div", {
3096
+ className: "min-w-0 flex-1 [overflow-wrap:anywhere]",
3097
+ children: [
3098
+ /* @__PURE__ */ N("span", {
3099
+ className: "block font-medium text-[14.5px] text-ink leading-snug",
3100
+ children: e.title
3101
+ }),
3102
+ /* @__PURE__ */ P("span", {
3103
+ className: "mt-0.5 block font-medium text-[13.5px] text-ink",
3104
+ children: [Z(e), o && /* @__PURE__ */ N("span", {
3105
+ className: "ml-1 font-normal text-[11.5px] text-ink-muted",
3106
+ children: o
3107
+ })]
3108
+ }),
3109
+ e.description && /* @__PURE__ */ N("span", {
3110
+ title: e.description,
3111
+ className: "mt-1 line-clamp-2 block text-[12.5px] text-ink-soft leading-snug",
3112
+ children: e.description
2994
3113
  })
2995
- }, r._id);
2996
- })
2997
- }),
2998
- r && /* @__PURE__ */ N("p", {
2999
- className: "m-0 text-danger text-xs",
3000
- children: r
3001
- })
3002
- ]
3003
- });
3004
- }, li = {
3114
+ ]
3115
+ }), a ? /* @__PURE__ */ N("span", {
3116
+ className: "shrink-0 rounded-full bg-ink/5 px-2.5 py-1 font-medium text-[12px] text-ink-soft",
3117
+ children: "Sold out"
3118
+ }) : /* @__PURE__ */ P("div", {
3119
+ className: "flex shrink-0 flex-col items-end gap-1",
3120
+ children: [/* @__PURE__ */ P("div", {
3121
+ className: "flex items-center gap-2",
3122
+ children: [
3123
+ /* @__PURE__ */ N("button", {
3124
+ type: "button",
3125
+ "aria-label": `Remove one ${e.title} ticket`,
3126
+ disabled: r === 0,
3127
+ onClick: () => n(e._id, r - 1),
3128
+ className: bi,
3129
+ children: /* @__PURE__ */ N(ce, { className: "size-3.5" })
3130
+ }),
3131
+ /* @__PURE__ */ P("span", {
3132
+ "aria-live": "polite",
3133
+ className: "w-5 text-center font-semibold text-[15px] text-ink tabular-nums",
3134
+ children: [r, /* @__PURE__ */ P("span", {
3135
+ className: "sr-only",
3136
+ children: [" ", e.title]
3137
+ })]
3138
+ }),
3139
+ /* @__PURE__ */ N("button", {
3140
+ type: "button",
3141
+ "aria-label": `Add one ${e.title} ticket`,
3142
+ disabled: r >= i,
3143
+ onClick: () => n(e._id, r + 1),
3144
+ className: bi,
3145
+ children: /* @__PURE__ */ N(le, { className: "size-3.5" })
3146
+ })
3147
+ ]
3148
+ }), r > 0 && r >= i && /* @__PURE__ */ P("span", {
3149
+ className: "text-[11.5px] text-ink-muted",
3150
+ children: [
3151
+ "Max ",
3152
+ i,
3153
+ " per order"
3154
+ ]
3155
+ })]
3156
+ })]
3157
+ }, e._id);
3158
+ }),
3159
+ r && /* @__PURE__ */ N("p", {
3160
+ className: "m-0 text-danger text-xs",
3161
+ children: r
3162
+ })
3163
+ ]
3164
+ }), Q = {
3005
3165
  name: "",
3006
3166
  email: "",
3007
3167
  mobile: "",
@@ -3020,14 +3180,14 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3020
3180
  country: ""
3021
3181
  }
3022
3182
  }
3023
- }, ui = {
3183
+ }, Si = {
3024
3184
  name: !0,
3025
3185
  email: !0,
3026
3186
  mobile: !0,
3027
3187
  organization: !0,
3028
3188
  designation: !0
3029
- }, di = (e, t) => {
3030
- let [n, r] = A(li), [i, a] = A({}), [o, s] = A(!1), c = k(!1);
3189
+ }, Ci = (e, t) => {
3190
+ let [n, r] = A(Q), [i, a] = A({}), [o, s] = A(!1), c = k(!1);
3031
3191
  E(() => {
3032
3192
  c.current || !e || (c.current = !0, r((t) => ({
3033
3193
  ...t,
@@ -3035,14 +3195,14 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3035
3195
  email: t.email || e.email || ""
3036
3196
  })));
3037
3197
  }, [e]);
3038
- let l = ri(n, t), u = w((e, t) => r((n) => ({
3198
+ let l = vi(n, t), u = w((e, t) => r((n) => ({
3039
3199
  ...n,
3040
3200
  [e]: t
3041
3201
  })), []), d = w((e) => a((t) => ({
3042
3202
  ...t,
3043
3203
  [e]: !0
3044
3204
  })), []), f = w(() => {
3045
- r(li), a({}), s(!1), c.current = !0;
3205
+ r(Q), a({}), s(!1), c.current = !0;
3046
3206
  }, []), p = w(() => {
3047
3207
  a({}), s(!1);
3048
3208
  }, []);
@@ -3056,13 +3216,83 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3056
3216
  touchField: d,
3057
3217
  reset: f,
3058
3218
  resetValidationDisplay: p,
3059
- touched: o ? ui : i
3219
+ touched: o ? Si : i
3060
3220
  };
3061
- }, fi = ({ eventID: e, selectedTicket: t, enabled: n }) => {
3062
- let r = i(), [a, o] = A(""), [s, c] = A(null), [l, u] = A(!1), [d, f] = A(null), [p, m] = A([]);
3221
+ }, wi = (e, t, n) => {
3222
+ let [r, i] = A({}), [a, o] = A({}), [s, c] = A({
3223
+ is_business_purchase: Q.is_business_purchase,
3224
+ billing_details: Q.billing_details
3225
+ }), [l, u] = A(!1), d = k(!1), f = O(() => t.flatMap((e) => Array.from({ length: n[e._id] ?? 0 }, (t, n) => ({
3226
+ key: `${e._id}:${n}`,
3227
+ ticket: e,
3228
+ rules: e.registration_fields ?? mi
3229
+ }))), [t, n]), p = f[0]?.key;
3230
+ E(() => {
3231
+ d.current || !e || !p || (d.current = !0, i((t) => {
3232
+ let n = t[p] ?? Q;
3233
+ return {
3234
+ ...t,
3235
+ [p]: {
3236
+ ...n,
3237
+ name: n.name || [e.first_name, e.last_name].filter(Boolean).join(" ").trim(),
3238
+ email: n.email || e.email || ""
3239
+ }
3240
+ };
3241
+ }));
3242
+ }, [e, p]);
3243
+ let m = (e) => r[e] ?? Q, h = O(() => {
3244
+ let e = {};
3245
+ for (let t of f) e[t.key] = vi(r[t.key] ?? Q, t.rules);
3246
+ return e;
3247
+ }, [f, r]), g = (e) => Object.keys(h[e] ?? {}).length === 0, _ = w((e, t, n) => i((r) => ({
3248
+ ...r,
3249
+ [e]: {
3250
+ ...r[e] ?? Q,
3251
+ [t]: n
3252
+ }
3253
+ })), []), v = w((e, t) => o((n) => ({
3254
+ ...n,
3255
+ [e]: {
3256
+ ...n[e],
3257
+ [t]: !0
3258
+ }
3259
+ })), []), y = w((e) => o((t) => ({
3260
+ ...t,
3261
+ [e]: Si
3262
+ })), []), b = w((e, t) => c((n) => ({
3263
+ ...n,
3264
+ [e]: t
3265
+ })), []), x = w(() => {
3266
+ i({}), o({}), c({
3267
+ is_business_purchase: Q.is_business_purchase,
3268
+ billing_details: Q.billing_details
3269
+ }), u(!1), d.current = !0;
3270
+ }, []), S = w(() => {
3271
+ o({}), u(!1);
3272
+ }, []);
3273
+ return {
3274
+ slots: f,
3275
+ getValues: m,
3276
+ errors: h,
3277
+ isSlotValid: g,
3278
+ isValid: f.every((e) => g(e.key)),
3279
+ getTouched: (e) => l ? Si : a[e] ?? {},
3280
+ isSlotVisited: (e) => l || !!a[e],
3281
+ submitAttempted: l,
3282
+ markSubmitted: () => u(!0),
3283
+ setField: _,
3284
+ touchField: v,
3285
+ touchSlot: y,
3286
+ billing: s,
3287
+ setBillingField: b,
3288
+ reset: x,
3289
+ resetValidationDisplay: S
3290
+ };
3291
+ }, Ti = ({ eventID: e, ticketIds: t, enabled: n }) => {
3292
+ let r = i(), a = t.join(","), [o, s] = A(""), [c, l] = A(null), [u, d] = A(!1), [f, p] = A(null), [m, h] = A([]), g = k(0);
3063
3293
  return E(() => {
3064
3294
  !n || !e || !r || r.fetch?.url(`/v1/event/event/${e}/coupon/list-public-coupons`)?.get().json().then((e) => {
3065
- e?.status && e?.content?.data && m(e.content.data);
3295
+ e?.status && e?.content?.data && h(e.content.data);
3066
3296
  }).catch((e) => {
3067
3297
  r.logger?.error("Failed to fetch public coupons", { exception: b(e) });
3068
3298
  });
@@ -3071,51 +3301,51 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3071
3301
  e,
3072
3302
  r
3073
3303
  ]), {
3074
- code: a,
3075
- setCode: o,
3076
- discount: s,
3077
- isLoading: l,
3078
- error: d,
3079
- publicCoupons: p,
3080
- apply: w(async (n) => {
3081
- let i = (n ?? a).trim();
3082
- if (!(!i || !r)) {
3083
- u(!0), f(null);
3084
- try {
3085
- let n = await r.fetch?.url(`/v1/event/event/${e}/coupon/validate-coupon-code`)?.post({
3086
- coupon: i,
3087
- event: e,
3088
- attendees: [{
3089
- name: "",
3090
- email: "",
3091
- ticket: t?._id
3092
- }]
3093
- }).json();
3094
- n?.status && (c(n.content.data), o(i));
3095
- } catch (e) {
3096
- let t = b(e);
3097
- f(t.message), r.logger?.error("Coupon validation failed", { exception: t });
3098
- } finally {
3099
- u(!1);
3100
- }
3304
+ code: o,
3305
+ setCode: s,
3306
+ discount: c,
3307
+ isLoading: u,
3308
+ error: f,
3309
+ publicCoupons: m,
3310
+ apply: w(async (t) => {
3311
+ let n = (t ?? o).trim();
3312
+ if (!n || !r) return;
3313
+ let i = ++g.current, c = () => i === g.current;
3314
+ d(!0), p(null);
3315
+ try {
3316
+ let t = await r.fetch?.url(`/v1/event/event/${e}/coupon/validate-coupon-code`)?.post({
3317
+ coupon: n,
3318
+ event: e,
3319
+ attendees: a.split(",").filter(Boolean).map((e) => ({
3320
+ name: "",
3321
+ email: "",
3322
+ ticket: e
3323
+ }))
3324
+ }).json();
3325
+ c() && t?.status && (l(t.content.data), s(n));
3326
+ } catch (e) {
3327
+ let t = b(e);
3328
+ c() && p(t.message), r.logger?.error("Coupon validation failed", { exception: t });
3329
+ } finally {
3330
+ c() && d(!1);
3101
3331
  }
3102
3332
  }, [
3103
3333
  r,
3104
- a,
3334
+ o,
3105
3335
  e,
3106
- t?._id
3336
+ a
3107
3337
  ]),
3108
3338
  reset: w(() => {
3109
- o(""), c(null), f(null);
3339
+ g.current += 1, d(!1), s(""), l(null), p(null);
3110
3340
  }, [])
3111
3341
  };
3112
- }, pi = async (e, t) => {
3342
+ }, Ei = async (e, t) => {
3113
3343
  let n = new URLSearchParams();
3114
3344
  return n.append("query", JSON.stringify({ where: { status: "active" } })), (await e.fetch?.url(`/v1/event/event/${t}/ticket/query?${n.toString()}`).get().json())?.content?.data ?? [];
3115
- }, mi = ({ eventID: e, external: t }) => {
3345
+ }, Di = ({ eventID: e, external: t }) => {
3116
3346
  let n = i(), [r, a] = A([]), [o, s] = A(!t), [c, l] = A(!1), [u, d] = A(null);
3117
3347
  return E(() => {
3118
- t || !e || !n || (s(!0), l(!1), pi(n, e).then((e) => {
3348
+ t || !e || !n || (s(!0), l(!1), Ei(n, e).then((e) => {
3119
3349
  a(e), e.length === 1 && d(e[0] ?? null);
3120
3350
  }).catch((e) => {
3121
3351
  l(!0), n.logger?.error("Failed to load event tickets", { exception: b(e) });
@@ -3131,7 +3361,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3131
3361
  selectedTicket: u,
3132
3362
  selectTicket: d
3133
3363
  };
3134
- }, hi = async (e) => {
3364
+ }, Oi = async (e) => {
3135
3365
  let { payment_session_id: t, order_id: n } = e;
3136
3366
  if (!t || !n) throw Error("Cashfree payment session missing");
3137
3367
  let { load: r } = await import("./script.esm-D4nvz3-k.js"), i = await r({ mode: e.environment || "production" });
@@ -3147,8 +3377,8 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3147
3377
  status: "closed",
3148
3378
  message: a.error?.message
3149
3379
  };
3150
- }, gi = () => typeof window < "u" && "Razorpay" in window, _i = ({ order: e, onSettled: t, onError: n }) => {
3151
- let { Razorpay: r, isLoading: i, error: a } = le(), o = k({
3380
+ }, ki = () => typeof window < "u" && "Razorpay" in window, Ai = ({ order: e, onSettled: t, onError: n }) => {
3381
+ let { Razorpay: r, isLoading: i, error: a } = de(), o = k({
3152
3382
  onSettled: t,
3153
3383
  onError: n
3154
3384
  });
@@ -3163,7 +3393,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3163
3393
  s.current = !0, o.current.onError(Error(a));
3164
3394
  return;
3165
3395
  }
3166
- if (!r || !gi()) return;
3396
+ if (!r || !ki()) return;
3167
3397
  s.current = !0;
3168
3398
  let t;
3169
3399
  try {
@@ -3201,7 +3431,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3201
3431
  a,
3202
3432
  e
3203
3433
  ]), null;
3204
- }, vi = ({ stripePromise: e, clientSecret: t, onClose: n, onComplete: r }) => {
3434
+ }, ji = ({ stripePromise: e, clientSecret: t, onClose: n, onComplete: r }) => {
3205
3435
  let i = k(r);
3206
3436
  i.current = r;
3207
3437
  let a = O(() => ({
@@ -3218,20 +3448,20 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3218
3448
  children: [/* @__PURE__ */ N(F.Close, {
3219
3449
  "aria-label": "Close payment",
3220
3450
  className: "absolute top-4 right-4 z-10 rounded-full bg-white/90 p-2.5 text-gray-500 shadow-md backdrop-blur-sm transition-all hover:bg-white hover:text-gray-700",
3221
- children: /* @__PURE__ */ N(ce, { className: "size-5" })
3451
+ children: /* @__PURE__ */ N(ue, { className: "size-5" })
3222
3452
  }), /* @__PURE__ */ N("div", {
3223
3453
  className: "flex-1 overflow-y-auto rounded-2xl py-6",
3224
- children: /* @__PURE__ */ N(de, {
3454
+ children: /* @__PURE__ */ N(pe, {
3225
3455
  stripe: e,
3226
3456
  options: a,
3227
- children: /* @__PURE__ */ N(ue, { className: "stripe-embedded-checkout h-full" })
3457
+ children: /* @__PURE__ */ N(fe, { className: "stripe-embedded-checkout h-full" })
3228
3458
  })
3229
3459
  })]
3230
3460
  })] })
3231
3461
  });
3232
- }, yi = () => {
3462
+ }, Mi = () => {
3233
3463
  let [e, t] = A(null), n = w(async (e, n) => {
3234
- if (e.provider === "cashfree") return hi(e);
3464
+ if (e.provider === "cashfree") return Oi(e);
3235
3465
  if (e.provider === "stripe") {
3236
3466
  let { client_secret: n, session_id: r } = e;
3237
3467
  if (!n || !r) throw Error("Stripe checkout session missing");
@@ -3265,7 +3495,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3265
3495
  }, []), r = (e, n) => {
3266
3496
  t(null), n instanceof Error ? e.settle.reject(n) : e.settle.resolve(n);
3267
3497
  }, i = null;
3268
- return e?.provider === "stripe" ? i = /* @__PURE__ */ N(vi, {
3498
+ return e?.provider === "stripe" ? i = /* @__PURE__ */ N(ji, {
3269
3499
  stripePromise: e.stripePromise,
3270
3500
  clientSecret: e.clientSecret,
3271
3501
  onComplete: () => r(e, {
@@ -3273,7 +3503,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3273
3503
  confirmation: { session_id: e.sessionId }
3274
3504
  }),
3275
3505
  onClose: () => r(e, { status: "closed" })
3276
- }) : e?.provider === "razorpay" && (i = /* @__PURE__ */ N(_i, {
3506
+ }) : e?.provider === "razorpay" && (i = /* @__PURE__ */ N(Ai, {
3277
3507
  order: e.order,
3278
3508
  onSettled: (t) => r(e, t),
3279
3509
  onError: (t) => r(e, t)
@@ -3287,8 +3517,8 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3287
3517
  providerUnreachable: "We couldn't reach the payment provider. Check your connection and try again.",
3288
3518
  confirmationFailed: "We couldn't confirm your payment. Your details are saved — try again.",
3289
3519
  generic: "Something went wrong. Please try again."
3290
- }, bi = (e) => !!e && e.status !== "requires_payment", xi = ({ eventID: e, details: t, onConfirmed: n }) => {
3291
- let r = i(), a = yi(), [o, s] = A({ kind: "idle" }), c = k({
3520
+ }, Ni = (e) => !!e && e.status !== "requires_payment", Pi = ({ eventID: e, details: t, onConfirmed: n }) => {
3521
+ let r = i(), a = Mi(), [o, s] = A({ kind: "idle" }), c = k({
3292
3522
  details: t,
3293
3523
  onConfirmed: n
3294
3524
  });
@@ -3304,7 +3534,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3304
3534
  message: t
3305
3535
  }), d = async (e, t) => {
3306
3536
  if (!t?.key) {
3307
- bi(e) ? l(e) : s({
3537
+ Ni(e) ? l(e) : s({
3308
3538
  kind: "failed",
3309
3539
  message: $.registrationFailed
3310
3540
  });
@@ -3338,7 +3568,7 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3338
3568
  }
3339
3569
  try {
3340
3570
  let t = (await r?.fetch?.url(`/v1/event/booking/${e._id}/confirm-booking`)?.post(n.confirmation)?.json())?.content?.data;
3341
- bi(t) ? l(t) : u(e._id, $.paymentAbandoned);
3571
+ Ni(t) ? l(t) : u(e._id, $.paymentAbandoned);
3342
3572
  } catch (t) {
3343
3573
  r?.logger?.error("Failed to confirm booking after payment", { exception: b(t) }), u(e._id, $.confirmationFailed);
3344
3574
  }
@@ -3377,33 +3607,387 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3377
3607
  },
3378
3608
  reset: () => s({ kind: "idle" })
3379
3609
  };
3380
- }, Si = "register", Ci = () => {
3610
+ }, Fi = (e) => `levo:event-registration:${e}`, Ii = (e) => {
3611
+ if (typeof window > "u") return null;
3612
+ try {
3613
+ let t = window.localStorage.getItem(Fi(e));
3614
+ return t ? JSON.parse(t) : null;
3615
+ } catch {
3616
+ return null;
3617
+ }
3618
+ }, Li = (e, t) => {
3619
+ if (!(typeof window > "u")) try {
3620
+ window.localStorage.setItem(Fi(e), JSON.stringify(t));
3621
+ } catch {}
3622
+ }, Ri = (e) => {
3623
+ if (!(typeof window > "u")) try {
3624
+ window.localStorage.removeItem(Fi(e));
3625
+ } catch {}
3626
+ }, zi = (e) => {
3627
+ let [t, n] = A(null), [r, i] = A(null);
3628
+ return E(() => {
3629
+ let t = Ii(e);
3630
+ t && i(t.email);
3631
+ }, [e]), {
3632
+ booking: t,
3633
+ registeredEmail: r,
3634
+ complete: (t, r) => {
3635
+ n(t), i(r), Li(e, {
3636
+ bookingId: t._id,
3637
+ email: r,
3638
+ at: (/* @__PURE__ */ new Date()).toISOString()
3639
+ });
3640
+ },
3641
+ clear: () => {
3642
+ Ri(e), i(null), n(null);
3643
+ }
3644
+ };
3645
+ }, Bi = "register", Vi = () => {
3381
3646
  if (typeof window > "u") return !1;
3382
- let e = new URLSearchParams(window.location.search).get(Si);
3647
+ let e = new URLSearchParams(window.location.search).get(Bi);
3383
3648
  return e !== null && e !== "0" && e !== "false";
3384
- }, wi = ({ canAutoOpen: e }) => {
3649
+ }, Hi = ({ canAutoOpen: e }) => {
3385
3650
  let [t, n] = A(!1), r = k(!1), i = w(() => n(!0), []), a = w(() => n(!1), []);
3386
3651
  return E(() => {
3387
- r.current || !e || !Ci() || (r.current = !0, n(!0));
3652
+ r.current || !e || !Vi() || (r.current = !0, n(!0));
3388
3653
  }, [e]), {
3389
3654
  isOpen: t,
3390
3655
  open: i,
3391
3656
  close: a
3392
3657
  };
3393
- }, Ti = "inline-flex items-center justify-center rounded-lg bg-brand px-4 py-3 font-semibold text-brand-foreground transition hover:opacity-90", Ei = ({ eventID: e, title: t, external: n, buttonText: r = "Register Now", startsAt: i, endsAt: a, eventUrl: o }) => {
3394
- let { account: s } = Qe(), c = er(), l = mi({
3658
+ }, Ui = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Wi = ({ eventID: e, title: t, buttonText: n = "Register Now", startsAt: r, endsAt: i, eventUrl: a }) => {
3659
+ let { account: o } = tt(), s = sr(), c = Di({ eventID: e }), [l, u] = A({}), [d, f] = A("tickets"), [p, m] = A(!1), [h, g] = A(null), _ = c.tickets.length === 1 ? c.tickets[0]?._id : void 0;
3660
+ E(() => {
3661
+ _ && u((e) => ({ [_]: e[_] || 1 }));
3662
+ }, [_]);
3663
+ let v = O(() => c.tickets.map((e) => ({
3664
+ ticket: e,
3665
+ count: l[e._id] ?? 0
3666
+ })).filter((e) => e.count > 0), [c.tickets, l]), y = v.reduce((e, t) => e + t.count, 0), b = wi(o, c.tickets, l), x = b.slots[0] ? b.getValues(b.slots[0].key) : null, S = zi(e), { booking: C } = S, w = Hi({ canAutoOpen: !c.isLoading && c.tickets.length > 0 && !S.registeredEmail }), T = v.some((e) => Hr(e.ticket, null) > 0), D = Ti({
3667
+ eventID: e,
3668
+ ticketIds: b.slots.map((e) => e.ticket._id),
3669
+ enabled: w.isOpen && T
3670
+ }), k = qr(v, D.discount), j = !!k && !k.isFree, F = O(() => ei(r, i), [r, i]), I = t || "this event", L = Pi({
3671
+ eventID: e,
3672
+ details: {
3673
+ merchantName: s?.name || t || "",
3674
+ description: "Event Registration",
3675
+ prefill: {
3676
+ name: x?.name.trim() ?? "",
3677
+ email: x?.email.trim() ?? "",
3678
+ contact: hi(x?.mobile ?? "")
3679
+ }
3680
+ },
3681
+ onConfirmed: (e) => S.complete(e, x?.email.trim() ?? "")
3682
+ }), R = (e, t) => {
3683
+ D.reset(), L.reset(), m(!1), u((n) => ({
3684
+ ...n,
3685
+ [e]: t
3686
+ }));
3687
+ }, z = () => {
3688
+ S.clear(), L.reset(), D.reset(), b.reset(), u(_ ? { [_]: 1 } : {}), f("tickets"), g(null);
3689
+ }, ee = (t) => {
3690
+ if (t.preventDefault(), d === "tickets") {
3691
+ if (y === 0) {
3692
+ m(!0);
3693
+ return;
3694
+ }
3695
+ f("details"), g(b.slots.find((e) => !b.isSlotValid(e.key))?.key ?? null);
3696
+ return;
3697
+ }
3698
+ if (d === "details") {
3699
+ if (b.markSubmitted(), !b.isValid) {
3700
+ g(b.slots.find((e) => !b.isSlotValid(e.key))?.key ?? null);
3701
+ return;
3702
+ }
3703
+ if (T) {
3704
+ f("review");
3705
+ return;
3706
+ }
3707
+ }
3708
+ L.register({
3709
+ event: e,
3710
+ coupon: D.code,
3711
+ attendees: b.slots.map((e) => {
3712
+ let t = b.getValues(e.key);
3713
+ return {
3714
+ name: t.name.trim(),
3715
+ email: t.email.trim(),
3716
+ ..._i(t, e.rules),
3717
+ ticket: e.ticket._id,
3718
+ details: {}
3719
+ };
3720
+ }),
3721
+ ...b.billing.is_business_purchase && j ? {
3722
+ is_business_purchase: !0,
3723
+ billing_details: b.billing.billing_details
3724
+ } : {}
3725
+ });
3726
+ };
3727
+ if (!c.isLoading && c.tickets.length === 0) return /* @__PURE__ */ N(li, { hasFailed: c.hasFailed });
3728
+ let B = k && !k.isFree ? Z({
3729
+ unit_amount: k.amount,
3730
+ currency: k.currency
3731
+ }) : null, te = B ? `Pay ${B}` : y === 1 ? "Save my spot" : `Save ${y} spots`, V = (e, t) => /* @__PURE__ */ P("button", {
3732
+ type: "button",
3733
+ disabled: L.state.kind === "busy",
3734
+ onClick: () => {
3735
+ L.reset(), f(t);
3736
+ },
3737
+ className: "-ml-1 inline-flex items-center gap-1.5 self-start rounded-lg px-1 py-0.5 text-[13px] text-ink-soft transition hover:text-ink disabled:pointer-events-none disabled:opacity-50",
3738
+ children: [/* @__PURE__ */ N(re, { className: "size-3.5" }), e]
3739
+ }), ne = "inline-flex min-h-[50px] items-center justify-center rounded-xl bg-brand px-6 font-semibold text-[15.5px] text-brand-foreground transition active:scale-[0.985] disabled:opacity-55", ie = /* @__PURE__ */ P("div", {
3740
+ className: "flex items-center gap-3",
3741
+ children: [/* @__PURE__ */ P("div", {
3742
+ className: "min-w-0 flex-1",
3743
+ children: [/* @__PURE__ */ N("span", {
3744
+ className: "block font-semibold text-[15px] text-ink tabular-nums",
3745
+ children: y === 0 ? "No tickets yet" : Ui(y, "ticket")
3746
+ }), y > 0 && /* @__PURE__ */ N("span", {
3747
+ className: "block text-[12.5px] text-ink-soft tabular-nums",
3748
+ children: B ?? "Free"
3749
+ })]
3750
+ }), /* @__PURE__ */ N("button", {
3751
+ type: "submit",
3752
+ className: ne,
3753
+ children: "Continue"
3754
+ })]
3755
+ }), H = b.isValid ? void 0 : "Fill in every attendee's details to continue", ae = d === "tickets" ? ie : d === "details" && T ? /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("button", {
3756
+ type: "submit",
3757
+ disabled: !b.isValid,
3758
+ className: X(ne, "w-full"),
3759
+ children: "Review order"
3760
+ }), H && /* @__PURE__ */ N("p", {
3761
+ className: "m-0 mt-2 text-center text-ink-muted text-xs",
3762
+ children: H
3763
+ })] }) : /* @__PURE__ */ N(Yr, {
3764
+ payment: L,
3765
+ label: te,
3766
+ isPaid: j,
3767
+ blockedReason: d === "details" ? H : void 0
3768
+ });
3769
+ return /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(ci, {
3770
+ buttonText: n,
3771
+ registeredEmail: S.registeredEmail,
3772
+ isSheetOpen: w.isOpen,
3773
+ isLoading: c.isLoading,
3774
+ onOpen: w.open,
3775
+ onRegisterAnother: z
3776
+ }), /* @__PURE__ */ N(oi, {
3777
+ open: w.isOpen,
3778
+ title: C ? I : `Register for ${I}`,
3779
+ when: F,
3780
+ wide: !0,
3781
+ onClose: w.close,
3782
+ onClosed: () => {
3783
+ L.reset(), b.resetValidationDisplay(), m(!1);
3784
+ },
3785
+ layers: L.checkoutElement,
3786
+ onSubmit: C ? void 0 : ee,
3787
+ footer: C ? void 0 : ae,
3788
+ children: C ? /* @__PURE__ */ N(pi, {
3789
+ email: x?.email.trim() ?? "",
3790
+ eventTitle: I,
3791
+ startsAt: r,
3792
+ endsAt: i,
3793
+ eventUrl: a,
3794
+ when: F,
3795
+ bookingRef: C._id,
3796
+ qrImageUrl: C.qr_image?.location,
3797
+ invoiceUrl: C.invoice?.location,
3798
+ attendeeCount: b.slots.length,
3799
+ onClose: w.close,
3800
+ onRegisterAnother: z
3801
+ }) : d === "tickets" ? /* @__PURE__ */ N(xi, {
3802
+ tickets: c.tickets,
3803
+ counts: l,
3804
+ onChange: R,
3805
+ error: p ? "Add at least one ticket to continue" : void 0
3806
+ }) : d === "details" ? /* @__PURE__ */ P("div", {
3807
+ className: "flex flex-col gap-4",
3808
+ children: [
3809
+ V("Change tickets", "tickets"),
3810
+ /* @__PURE__ */ N("span", {
3811
+ className: "font-semibold text-[16px] text-ink",
3812
+ children: y === 1 ? "Your details" : "Attendee details"
3813
+ }),
3814
+ /* @__PURE__ */ N(Lr, {
3815
+ attendees: b,
3816
+ openKey: h,
3817
+ onOpenChange: g
3818
+ })
3819
+ ]
3820
+ }) : /* @__PURE__ */ P("div", {
3821
+ className: "flex flex-col gap-4",
3822
+ children: [
3823
+ V("Edit attendee details", "details"),
3824
+ /* @__PURE__ */ N(Jr, {
3825
+ lines: v,
3826
+ discount: D.discount,
3827
+ pricing: k
3828
+ }),
3829
+ /* @__PURE__ */ N(Qr, {
3830
+ couponCode: D.code,
3831
+ onCouponCodeChange: D.setCode,
3832
+ couponError: D.error,
3833
+ couponLoading: D.isLoading,
3834
+ onValidateCoupon: D.apply,
3835
+ onRemoveCoupon: D.reset,
3836
+ publicCoupons: D.publicCoupons,
3837
+ discount: D.discount,
3838
+ tickets: v.map((e) => e.ticket)
3839
+ }),
3840
+ j && /* @__PURE__ */ N(Ir, {
3841
+ values: b.billing,
3842
+ onChange: b.setBillingField
3843
+ })
3844
+ ]
3845
+ })
3846
+ })] });
3847
+ }, Gi = ({ selectedTicket: e, discount: t }) => {
3848
+ let [n, r] = A(!1), i = e?.currency, a = Hr(e, t), o = Wr(e, t), s = Gr(e, t), c = t?.discount ?? 0, l = s.length > 0 || c > 0 || o !== a, u = /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ P("span", {
3849
+ className: "inline-flex items-center gap-1.5",
3850
+ children: ["Total", l && /* @__PURE__ */ N(ae, { className: X("size-4 text-ink-muted transition-transform", n && "rotate-180") })]
3851
+ }), /* @__PURE__ */ N("span", { children: Z({
3852
+ unit_amount: a,
3853
+ currency: i
3854
+ }) })] }), d = "flex w-full items-center justify-between gap-3 px-3.5 py-3 font-semibold text-[15px] text-ink";
3855
+ return /* @__PURE__ */ P("div", {
3856
+ className: "rounded-xl border border-border bg-ink/3",
3857
+ children: [l ? /* @__PURE__ */ N("button", {
3858
+ type: "button",
3859
+ onClick: () => r((e) => !e),
3860
+ "aria-expanded": n,
3861
+ className: d,
3862
+ children: u
3863
+ }) : /* @__PURE__ */ N("div", {
3864
+ className: d,
3865
+ children: u
3866
+ }), l && /* @__PURE__ */ N(Or, {
3867
+ open: n,
3868
+ children: /* @__PURE__ */ P("div", {
3869
+ className: "flex flex-col gap-1.5 px-3.5 pb-3 text-[13px] text-ink-soft",
3870
+ children: [
3871
+ /* @__PURE__ */ P("div", {
3872
+ className: "flex items-center justify-between gap-3",
3873
+ children: [/* @__PURE__ */ N("span", { children: "Subtotal" }), /* @__PURE__ */ N("span", { children: Z({
3874
+ unit_amount: o,
3875
+ currency: i
3876
+ }) })]
3877
+ }),
3878
+ c > 0 && /* @__PURE__ */ P("div", {
3879
+ className: "flex items-center justify-between gap-3 text-emerald-700 dark:text-emerald-400",
3880
+ children: [/* @__PURE__ */ N("span", { children: "Discount" }), /* @__PURE__ */ P("span", { children: ["-", Z({
3881
+ unit_amount: c,
3882
+ currency: i
3883
+ })] })]
3884
+ }),
3885
+ s.map((e, t) => /* @__PURE__ */ P("div", {
3886
+ className: "flex items-center justify-between gap-3",
3887
+ children: [/* @__PURE__ */ P("span", { children: [
3888
+ e.label,
3889
+ " (",
3890
+ e.percentage,
3891
+ "%)"
3892
+ ] }), /* @__PURE__ */ N("span", { children: Z({
3893
+ unit_amount: e.amount,
3894
+ currency: i
3895
+ }) })]
3896
+ }, e.id || e._id || t)),
3897
+ e?.tax_inclusive && /* @__PURE__ */ N("p", {
3898
+ className: "m-0 text-ink-muted text-xs",
3899
+ children: "Price is inclusive of taxes"
3900
+ })
3901
+ ]
3902
+ })
3903
+ })]
3904
+ });
3905
+ }, Ki = ({ tickets: e, selectedTicket: t, onSelect: n, error: r }) => {
3906
+ let [i, a] = A(!t);
3907
+ return /* @__PURE__ */ P("fieldset", {
3908
+ className: "m-0 flex min-w-0 flex-col gap-2 border-0 p-0",
3909
+ children: [
3910
+ /* @__PURE__ */ N("legend", {
3911
+ className: "mb-2 p-0 font-medium text-ink text-sm",
3912
+ children: "Choose your ticket"
3913
+ }),
3914
+ /* @__PURE__ */ N("div", {
3915
+ className: "-mb-2 flex flex-col",
3916
+ children: e.map((r) => {
3917
+ let o = r._id === t?._id, s = i || o, c = zr(r);
3918
+ return /* @__PURE__ */ N(Or, {
3919
+ open: s,
3920
+ children: /* @__PURE__ */ P("label", {
3921
+ className: X("mb-2 flex w-full cursor-pointer items-start gap-2.5 rounded-xl border px-3.5 py-3 transition", o ? "border-brand bg-brand/5" : "border-border hover:border-brand/50"),
3922
+ children: [
3923
+ /* @__PURE__ */ N("input", {
3924
+ type: "radio",
3925
+ name: "ticket",
3926
+ value: r._id,
3927
+ checked: o,
3928
+ onChange: () => {
3929
+ n(r), a(!1);
3930
+ },
3931
+ onClick: () => {
3932
+ i || a(!0);
3933
+ },
3934
+ className: "sr-only"
3935
+ }),
3936
+ /* @__PURE__ */ N("span", {
3937
+ "aria-hidden": !0,
3938
+ className: X("mt-0.5 size-[17px] shrink-0 rounded-full border transition-all", o ? "border-[5px] border-brand" : "border-border")
3939
+ }),
3940
+ /* @__PURE__ */ P("span", {
3941
+ className: "min-w-0 flex-1 [overflow-wrap:anywhere]",
3942
+ children: [/* @__PURE__ */ N("span", {
3943
+ className: "block font-medium text-[14.5px] text-ink leading-snug",
3944
+ children: r.title
3945
+ }), r.description && /* @__PURE__ */ N("span", {
3946
+ title: r.description,
3947
+ className: X("mt-0.5 block text-[12.5px] text-ink-soft leading-snug", !i && "line-clamp-2"),
3948
+ children: r.description
3949
+ })]
3950
+ }),
3951
+ /* @__PURE__ */ P("span", {
3952
+ className: "flex shrink-0 flex-col items-end gap-1.5",
3953
+ children: [/* @__PURE__ */ P("span", {
3954
+ className: "text-right font-medium text-[14.5px] text-ink",
3955
+ children: [Z(r), c && /* @__PURE__ */ N("span", {
3956
+ className: "block font-normal text-[11.5px] text-ink-muted",
3957
+ children: c
3958
+ })]
3959
+ }), o && !i && e.length > 1 && /* @__PURE__ */ P("span", {
3960
+ className: "inline-flex items-center gap-1 whitespace-nowrap rounded-full border border-brand/40 px-2.5 py-1 font-medium text-[12px] text-brand",
3961
+ children: [
3962
+ e.length - 1,
3963
+ " more",
3964
+ /* @__PURE__ */ N(ae, {
3965
+ "aria-hidden": !0,
3966
+ className: "size-3.5"
3967
+ })
3968
+ ]
3969
+ })]
3970
+ })
3971
+ ]
3972
+ })
3973
+ }, r._id);
3974
+ })
3975
+ }),
3976
+ r && /* @__PURE__ */ N("p", {
3977
+ className: "m-0 text-danger text-xs",
3978
+ children: r
3979
+ })
3980
+ ]
3981
+ });
3982
+ }, qi = (e) => e.enableMultipleTicketBooking && !e.external ? /* @__PURE__ */ N(Wi, { ...e }, e.eventID) : /* @__PURE__ */ N(Ji, { ...e }, e.eventID), Ji = ({ eventID: e, title: t, external: n, buttonText: r = "Register Now", startsAt: i, endsAt: a, eventUrl: o }) => {
3983
+ let { account: s } = tt(), c = sr(), l = Di({
3395
3984
  eventID: e,
3396
3985
  external: n
3397
- }), u = l.selectedTicket?.registration_fields ?? $r, d = di(s, u), f = Pr(l.selectedTicket, null)?.isFree === !1, [p, m] = A(null), [h, g] = A(null);
3398
- E(() => {
3399
- let t = ai(e);
3400
- t && g({ email: t.email });
3401
- }, [e]);
3402
- let _ = wi({ canAutoOpen: !n && !l.isLoading && l.tickets.length > 0 && !h }), v = k(null), y = fi({
3986
+ }), u = l.selectedTicket?.registration_fields ?? mi, d = Ci(s, u), f = Ur(l.selectedTicket, null)?.isFree === !1, p = zi(e), { booking: m } = p, h = Hi({ canAutoOpen: !n && !l.isLoading && l.tickets.length > 0 && !p.registeredEmail }), g = k(null), _ = Ti({
3403
3987
  eventID: e,
3404
- selectedTicket: l.selectedTicket,
3405
- enabled: _.isOpen && f
3406
- }), b = Pr(l.selectedTicket, y.discount), x = !!b && !b.isFree, S = l.tickets.length > 1, C = O(() => Vr(i, a), [i, a]), w = t || "this event", T = S || x, D = xi({
3988
+ ticketIds: l.selectedTicket ? [l.selectedTicket._id] : [],
3989
+ enabled: h.isOpen && f
3990
+ }), v = Ur(l.selectedTicket, _.discount), y = !!v && !v.isFree, b = l.tickets.length > 1, x = O(() => ei(i, a), [i, a]), S = t || "this event", C = b || y, w = Pi({
3407
3991
  eventID: e,
3408
3992
  details: {
3409
3993
  merchantName: c?.name || t || "",
@@ -3411,33 +3995,26 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3411
3995
  prefill: {
3412
3996
  name: d.values.name.trim(),
3413
3997
  email: d.values.email.trim(),
3414
- contact: ei(d.values.mobile)
3998
+ contact: hi(d.values.mobile)
3415
3999
  }
3416
4000
  },
3417
- onConfirmed: (t) => {
3418
- let n = d.values.email.trim();
3419
- m(t), g({ email: n }), oi(e, {
3420
- bookingId: t._id,
3421
- email: n,
3422
- at: (/* @__PURE__ */ new Date()).toISOString()
3423
- });
3424
- }
3425
- }), { state: j } = D, F = j.kind === "busy", I = (e) => {
3426
- y.reset(), D.reset(), l.selectTicket(e);
3427
- }, L = () => {
3428
- si(e), g(null), m(null), D.reset(), d.reset();
3429
- }, R = (t) => {
3430
- t.preventDefault(), d.markSubmitted(), !(!l.selectedTicket || !d.isValid) && D.register({
4001
+ onConfirmed: (e) => p.complete(e, d.values.email.trim())
4002
+ }), T = (e) => {
4003
+ _.reset(), w.reset(), l.selectTicket(e);
4004
+ }, E = () => {
4005
+ p.clear(), w.reset(), d.reset();
4006
+ }, D = (t) => {
4007
+ t.preventDefault(), d.markSubmitted(), !(!l.selectedTicket || !d.isValid) && w.register({
3431
4008
  event: e,
3432
- coupon: y.code,
4009
+ coupon: _.code,
3433
4010
  attendees: [{
3434
4011
  name: d.values.name.trim(),
3435
4012
  email: d.values.email.trim(),
3436
- ...ni(d.values, u),
4013
+ ..._i(d.values, u),
3437
4014
  ticket: l.selectedTicket._id,
3438
4015
  details: {}
3439
4016
  }],
3440
- ...d.values.is_business_purchase && x ? {
4017
+ ...d.values.is_business_purchase && y ? {
3441
4018
  is_business_purchase: !0,
3442
4019
  billing_details: d.values.billing_details
3443
4020
  } : {}
@@ -3447,133 +4024,95 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3447
4024
  className: "my-2",
3448
4025
  children: /* @__PURE__ */ N("button", {
3449
4026
  type: "button",
3450
- className: Ti,
4027
+ className: si,
3451
4028
  onClick: () => window.open(n, "_blank", "noopener,noreferrer"),
3452
4029
  children: r
3453
4030
  })
3454
4031
  });
3455
- if (!l.isLoading && l.tickets.length === 0) return /* @__PURE__ */ N("div", {
3456
- className: "my-2",
3457
- children: /* @__PURE__ */ N("p", {
3458
- className: "m-0 text-ink-soft text-sm",
3459
- children: l.hasFailed ? "We couldn't load tickets for this event. Please refresh the page." : "Registration isn't open for this event yet."
3460
- })
3461
- });
3462
- let z = b ? b.isFree ? "Save my spot" : `Pay ${Q({
3463
- unit_amount: b.amount,
3464
- currency: b.currency
4032
+ if (!l.isLoading && l.tickets.length === 0) return /* @__PURE__ */ N(li, { hasFailed: l.hasFailed });
4033
+ let A = v ? v.isFree ? "Save my spot" : `Pay ${Z({
4034
+ unit_amount: v.amount,
4035
+ currency: v.currency
3465
4036
  })}` : "Choose a ticket";
3466
- return /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("div", {
3467
- className: "my-2",
3468
- children: h && !_.isOpen ? /* @__PURE__ */ P("span", {
3469
- className: "inline-flex flex-wrap items-center gap-2 rounded-xl border border-border bg-ink/3 px-3.5 py-2.5 text-ink text-sm",
3470
- children: [
3471
- /* @__PURE__ */ N(ae, { className: "size-4 text-emerald-600 dark:text-emerald-400" }),
3472
- "You're registered as ",
3473
- h.email,
3474
- /* @__PURE__ */ N("button", {
3475
- type: "button",
3476
- onClick: L,
3477
- className: "text-ink-soft underline underline-offset-[3px] hover:text-ink",
3478
- children: "Register someone else"
3479
- })
3480
- ]
3481
- }) : /* @__PURE__ */ N("button", {
3482
- type: "button",
3483
- onClick: _.open,
3484
- disabled: l.isLoading,
3485
- className: Z(Ti, "disabled:opacity-60"),
3486
- children: r
3487
- })
3488
- }), /* @__PURE__ */ N(Jr, {
3489
- open: _.isOpen,
3490
- title: p ? w : `Register for ${w}`,
3491
- when: C,
3492
- wide: S,
3493
- onClose: _.close,
4037
+ return /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(ci, {
4038
+ buttonText: r,
4039
+ registeredEmail: p.registeredEmail,
4040
+ isSheetOpen: h.isOpen,
4041
+ isLoading: l.isLoading,
4042
+ onOpen: h.open,
4043
+ onRegisterAnother: E
4044
+ }), /* @__PURE__ */ N(oi, {
4045
+ open: h.isOpen,
4046
+ title: m ? S : `Register for ${S}`,
4047
+ when: x,
4048
+ wide: b,
4049
+ onClose: h.close,
3494
4050
  onClosed: () => {
3495
- D.reset(), d.resetValidationDisplay();
4051
+ w.reset(), d.resetValidationDisplay();
3496
4052
  },
3497
- initialFocusRef: S ? void 0 : v,
3498
- layers: D.checkoutElement,
3499
- onSubmit: p ? void 0 : R,
3500
- footer: p ? void 0 : /* @__PURE__ */ P(M, { children: [
3501
- (j.kind === "unpaid" || j.kind === "failed") && /* @__PURE__ */ P("p", {
3502
- role: "alert",
3503
- className: "m-0 mb-2.5 rounded-xl bg-danger/10 px-3 py-2.5 text-danger text-sm starting:opacity-0 transition-opacity duration-200 motion-reduce:transition-none",
3504
- children: [j.message, j.kind === "unpaid" && /* @__PURE__ */ N("button", {
3505
- type: "button",
3506
- onClick: D.retry,
3507
- className: "ml-1.5 inline-flex items-center gap-1 font-semibold underline underline-offset-[3px]",
3508
- children: "Pay again"
3509
- })]
3510
- }),
3511
- /* @__PURE__ */ P("button", {
3512
- type: "submit",
3513
- disabled: F,
3514
- className: "inline-flex min-h-[50px] w-full items-center justify-center gap-2 rounded-xl bg-brand font-semibold text-[15.5px] text-brand-foreground transition active:scale-[0.985] disabled:opacity-55",
3515
- children: [F && /* @__PURE__ */ N(se, { className: "size-4 animate-spin" }), F && j.stage === "paying" ? "Opening secure checkout" : z]
3516
- }),
3517
- /* @__PURE__ */ N("p", {
3518
- className: "m-0 mt-2 text-center text-ink-muted text-xs",
3519
- children: x ? "Secure payment · confirmation sent to your email" : "No card needed · joining link sent to your email"
3520
- })
3521
- ] }),
3522
- children: p ? /* @__PURE__ */ N(Qr, {
4053
+ initialFocusRef: b ? void 0 : g,
4054
+ layers: w.checkoutElement,
4055
+ onSubmit: m ? void 0 : D,
4056
+ footer: m ? void 0 : /* @__PURE__ */ N(Yr, {
4057
+ payment: w,
4058
+ label: A,
4059
+ isPaid: y
4060
+ }),
4061
+ children: m ? /* @__PURE__ */ N(pi, {
3523
4062
  email: d.values.email.trim(),
3524
- eventTitle: w,
4063
+ eventTitle: S,
3525
4064
  startsAt: i,
3526
4065
  endsAt: a,
3527
4066
  eventUrl: o,
3528
- when: C,
3529
- bookingRef: p._id,
3530
- qrImageUrl: p.qr_image?.location,
3531
- invoiceUrl: p.invoice?.location,
3532
- onClose: _.close,
3533
- onRegisterAnother: L
4067
+ when: x,
4068
+ bookingRef: m._id,
4069
+ qrImageUrl: m.qr_image?.location,
4070
+ invoiceUrl: m.invoice?.location,
4071
+ onClose: h.close,
4072
+ onRegisterAnother: E
3534
4073
  }) : /* @__PURE__ */ P("div", {
3535
4074
  className: "flex flex-col gap-4",
3536
4075
  children: [
3537
- S && /* @__PURE__ */ N(ci, {
4076
+ b && /* @__PURE__ */ N(Ki, {
3538
4077
  tickets: l.tickets,
3539
4078
  selectedTicket: l.selectedTicket,
3540
- onSelect: I,
4079
+ onSelect: T,
3541
4080
  error: d.submitAttempted && !l.selectedTicket ? "Choose a ticket to continue" : void 0
3542
4081
  }),
3543
- x && /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(Kr, {
4082
+ y && /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(Gi, {
3544
4083
  selectedTicket: l.selectedTicket,
3545
- discount: y.discount
3546
- }), /* @__PURE__ */ N(zr, {
3547
- couponCode: y.code,
3548
- onCouponCodeChange: y.setCode,
3549
- couponError: y.error,
3550
- couponLoading: y.isLoading,
3551
- onValidateCoupon: y.apply,
3552
- onRemoveCoupon: y.reset,
3553
- publicCoupons: y.publicCoupons,
3554
- discount: y.discount,
3555
- selectedTicket: l.selectedTicket
4084
+ discount: _.discount
4085
+ }), /* @__PURE__ */ N(Qr, {
4086
+ couponCode: _.code,
4087
+ onCouponCodeChange: _.setCode,
4088
+ couponError: _.error,
4089
+ couponLoading: _.isLoading,
4090
+ onValidateCoupon: _.apply,
4091
+ onRemoveCoupon: _.reset,
4092
+ publicCoupons: _.publicCoupons,
4093
+ discount: _.discount,
4094
+ tickets: l.selectedTicket ? [l.selectedTicket] : []
3556
4095
  })] }),
3557
4096
  /* @__PURE__ */ P("div", {
3558
- className: Z("flex flex-col gap-4", T && "border-border border-t pt-4"),
3559
- children: [T && /* @__PURE__ */ N("span", {
4097
+ className: X("flex flex-col gap-4", C && "border-border border-t pt-4"),
4098
+ children: [C && /* @__PURE__ */ N("span", {
3560
4099
  className: "font-medium text-ink text-sm",
3561
4100
  children: "Your details"
3562
- }), /* @__PURE__ */ N(Or, {
4101
+ }), /* @__PURE__ */ N(Fr, {
3563
4102
  values: d.values,
3564
4103
  errors: d.errors,
3565
4104
  touched: d.touched,
3566
4105
  onChange: d.setField,
3567
4106
  onBlur: d.touchField,
3568
- showBusinessBilling: x,
4107
+ showBusinessBilling: y,
3569
4108
  registrationFields: u,
3570
- nameInputRef: v
4109
+ nameInputRef: g
3571
4110
  })]
3572
4111
  })
3573
4112
  ]
3574
4113
  })
3575
4114
  })] });
3576
- }, Di = (e) => e.length > 1 ? e.replace(/\/+$/, "") : e, Oi = (e) => typeof e == "string" && e.trim() ? e : void 0, ki = (e) => typeof e == "string" ? e : e?.location ?? void 0, Ai = (e, t) => {
4115
+ }, Yi = (e) => e.length > 1 ? e.replace(/\/+$/, "") : e, Xi = (e) => typeof e == "string" && e.trim() ? e : void 0, Zi = (e) => typeof e == "string" ? e : e?.location ?? void 0, Qi = (e, t) => {
3577
4116
  let n = e.meta ?? {}, r = e.title && t ? `${e.title} | ${t}` : e.title || t || void 0;
3578
4117
  return {
3579
4118
  title: n.meta_title || r,
@@ -3583,32 +4122,32 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3583
4122
  og: {
3584
4123
  title: n.og_title || void 0,
3585
4124
  description: n.og_description || void 0,
3586
- image: ki(n.og_image),
4125
+ image: Zi(n.og_image),
3587
4126
  url: n.og_url || void 0
3588
4127
  },
3589
4128
  twitter: { card: n.twitter_card || void 0 },
3590
4129
  ldJson: n.ld_json || void 0,
3591
4130
  customHead: n.head_code || void 0
3592
4131
  };
3593
- }, ji = (e) => ({
4132
+ }, $i = (e) => ({
3594
4133
  description: e.description || void 0,
3595
4134
  customHead: e.settings?.head_code || void 0
3596
- }), Mi = (e) => (t = {}, n) => (r) => {
3597
- let i = Ai(t, e.name);
4135
+ }), ea = (e) => (t = {}, n) => (r) => {
4136
+ let i = Qi(t, e.name);
3598
4137
  if (n) {
3599
4138
  let t = r?.loaderData?.[n.source];
3600
4139
  if (t) {
3601
- let r = n.title ? Oi(t[n.title]) : void 0;
4140
+ let r = n.title ? Xi(t[n.title]) : void 0;
3602
4141
  r && (i.title = e.name ? `${r} | ${e.name}` : r, i.og = {
3603
4142
  ...i.og,
3604
4143
  title: r
3605
4144
  });
3606
- let a = n.description ? Oi(t[n.description]) : void 0;
4145
+ let a = n.description ? Xi(t[n.description]) : void 0;
3607
4146
  a && (i.description = a, i.og = {
3608
4147
  ...i.og,
3609
4148
  description: a
3610
4149
  });
3611
- let o = n.image ? ki(t[n.image]) : void 0;
4150
+ let o = n.image ? Zi(t[n.image]) : void 0;
3612
4151
  o && (i.og = {
3613
4152
  ...i.og,
3614
4153
  image: o
@@ -3617,31 +4156,31 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3617
4156
  }
3618
4157
  if (!i.canonical) {
3619
4158
  let t = r?.match?.pathname, n = (e.domain || "").trim();
3620
- n && t?.startsWith("/") && (i.canonical = (/^https?:\/\//.test(n) ? n : `https://${n}`).replace(/\/+$/, "") + Di(t));
4159
+ n && t?.startsWith("/") && (i.canonical = (/^https?:\/\//.test(n) ? n : `https://${n}`).replace(/\/+$/, "") + Yi(t));
3621
4160
  }
3622
- let a = yr(i, ji(e)), o = t.id?.trim();
4161
+ let a = Er(i, $i(e)), o = t.id?.trim();
3623
4162
  return o && a.meta.push({
3624
- name: Jn,
4163
+ name: tr,
3625
4164
  content: o
3626
4165
  }), a;
3627
- }, Ni = (e) => e.params, Pi = (e) => {
3628
- let t = ke(e);
4166
+ }, ta = (e) => e.params, na = (e) => {
4167
+ let t = Me(e);
3629
4168
  return (e, n) => {
3630
- let { rules: r, invalid: i } = xe(n?.access), a = r.length > 0 || i;
3631
- return (n) => a ? Promise.resolve({}) : Ye({
4169
+ let { rules: r, invalid: i } = we(n?.access), a = r.length > 0 || i;
4170
+ return (n) => a ? Promise.resolve({}) : Qe({
3632
4171
  queryClient: n.context.queryClient,
3633
4172
  config: t,
3634
4173
  sources: e,
3635
- params: Ni(n)
4174
+ params: ta(n)
3636
4175
  });
3637
4176
  };
3638
- }, Fi = 2, Ii = (e) => {
3639
- let { limit: t = 20, debounceMs: n = 300, hotkey: r = !0 } = e ?? {}, a = i(), o = er(), s = G(), [c, l] = A(""), [u, d] = A(!1), [f, p] = A("");
4177
+ }, ra = 2, ia = (e) => {
4178
+ let { limit: t = 20, debounceMs: n = 300, hotkey: r = !0 } = e ?? {}, a = i(), o = sr(), s = K(), [c, l] = A(""), [u, d] = A(!1), [f, p] = A("");
3640
4179
  E(() => {
3641
4180
  let e = setTimeout(() => p(c.trim()), n);
3642
4181
  return () => clearTimeout(e);
3643
4182
  }, [c, n]);
3644
- let m = f.length >= Fi, h = R({
4183
+ let m = f.length >= ra, h = R({
3645
4184
  queryKey: [
3646
4185
  "levo-search",
3647
4186
  o?.id ?? null,
@@ -3690,4 +4229,4 @@ var Z = (...e) => e.filter(Boolean).join(" "), xr = ({ open: e, className: t, ch
3690
4229
  };
3691
4230
  };
3692
4231
  //#endregion
3693
- export { It as ColorModeProvider, Un as Inspector, me as LEVO_AUTH_METHODS, K as LEVO_AUTH_QUERY_KEY, pe as LEVO_OAUTH_METHODS, xt as LEVO_OTP_LENGTH, dt as LEVO_PENDING_APPROVAL_CODE, fe as LEVO_PRIMARY_AUTH_METHODS, m as LOCALE_COOKIE, l as LOCALE_REDIRECT_CACHE_CONTROL, Ot as LevoChat, $e as LevoEntryForm, Ei as LevoEventRegister, Rt as LevoForm, cr as LevoLink, Zn as LevoPopups, it as LevoProfileForm, rr as LevoSiteProvider, lr as LocaleHreflang, dr as LocaleProvider, Jn as PAGE_ID_META, br as PageHead, mr as SiteLocaleProvider, sr as buildHreflangLinks, Mi as createLevoHead, Pi as createLevoLoader, _ as createRouteTreeMatcher, Oe as createSiteClient, De as decideAccess, v as extractGeoAndLanguageData, ft as isPendingApprovalError, St as isValidEmail, Ct as isValidOtp, Tt as isValidPhone, Fe as levoParams, ir as localeBeforeLoad, p as localePath, d as localeRedirectResponse, wt as normalizePhone, yr as pageHead, xe as parseAccess, vr as parseRawHead, Ye as prefetchLevoSources, ar as readLocaleConfig, Yn as readPageId, Se as resolveAuthMethods, g as resolveLocale, u as resolveLocaleRedirect, s as resolveLocaleRequest, ke as siteConfigFromJson, f as splitLocalePrefix, Lt as useColorMode, hr as useLanguageOptions, ut as useLevoAccess, Qe as useLevoAuth, qe as useLevoForm, nr as useLevoInsights, ht as useLevoLogin, bt as useLevoOAuth, Et as useLevoOtpInput, Ke as useLevoRecord, Ii as useLevoSearch, tr as useLevoSite, Ge as useLevoSource, fr as useLocale, pr as useUrlLocale };
4232
+ export { zt as ColorModeProvider, Xn as Inspector, ge as LEVO_AUTH_METHODS, q as LEVO_AUTH_QUERY_KEY, he as LEVO_OAUTH_METHODS, wt as LEVO_OTP_LENGTH, mt as LEVO_PENDING_APPROVAL_CODE, me as LEVO_PRIMARY_AUTH_METHODS, m as LOCALE_COOKIE, l as LOCALE_REDIRECT_CACHE_CONTROL, jt as LevoChat, Ht as LevoEditForm, nt as LevoEntryForm, qi as LevoEventRegister, Ut as LevoForm, hr as LevoLink, ir as LevoPopups, st as LevoProfileForm, ur as LevoSiteProvider, gr as LocaleHreflang, vr as LocaleProvider, tr as PAGE_ID_META, Dr as PageHead, xr as SiteLocaleProvider, mr as buildHreflangLinks, ea as createLevoHead, na as createLevoLoader, _ as createRouteTreeMatcher, je as createSiteClient, Ae as decideAccess, v as extractGeoAndLanguageData, ht as isPendingApprovalError, Tt as isValidEmail, Et as isValidOtp, Ot as isValidPhone, Re as levoParams, dr as localeBeforeLoad, p as localePath, d as localeRedirectResponse, Dt as normalizePhone, Er as pageHead, we as parseAccess, Tr as parseRawHead, Qe as prefetchLevoSources, fr as readLocaleConfig, nr as readPageId, Te as resolveAuthMethods, g as resolveLocale, u as resolveLocaleRedirect, s as resolveLocaleRequest, Me as siteConfigFromJson, f as splitLocalePrefix, Bt as useColorMode, Sr as useLanguageOptions, pt as useLevoAccess, tt as useLevoAuth, Xe as useLevoForm, lr as useLevoInsights, vt as useLevoLogin, Ct as useLevoOAuth, kt as useLevoOtpInput, Ye as useLevoRecord, ia as useLevoSearch, cr as useLevoSite, Je as useLevoSource, yr as useLocale, br as useUrlLocale };