@levo-so/site-runtime 0.3.1 → 0.3.8

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.
Files changed (45) hide show
  1. package/CollectionField-C-6a1ud4.js +270 -0
  2. package/{CollectionInput-B1qV4QEH.js → CollectionInput-BJ__qcbk.js} +40 -40
  3. package/DateTimeWidget-hFjcn3o6.js +255 -0
  4. package/Dialog-dT7y641z.js +130 -0
  5. package/KBChatWidget-ClHFDgJ5.js +1026 -0
  6. package/LevoProvider-Bsjkcwc8.js +20 -0
  7. package/PhoneWidget-BmBO-kvA.js +99 -0
  8. package/{Popover-q5dL7y0W.js → Popover-3N88sRp4.js} +20 -20
  9. package/{PopupRenderer-Bncp54gB-DuCULkBK.js → PopupBody-DZVwDLkg-Cfy3lWGs.js} +201 -910
  10. package/PopupRenderer-BjW1jg70-W2y-PEPH.js +387 -0
  11. package/{RichTextWidget-D-mGlES0.js → RichTextWidget-DkKHEq4j.js} +142 -141
  12. package/ThemeProvider-DutrjSTF.js +116 -0
  13. package/{Tooltip-BIgrpetu.js → Tooltip-CQB0LyxK.js} +20 -20
  14. package/VerifyButton-BUT70lgz.js +192 -0
  15. package/{theme.cssm-2YTdd8Yh.js → createThemeExtension-4AUn51iJ.js} +2 -2
  16. package/dist-CRDgdAkQ.js +3631 -0
  17. package/dist-DPmVG7VB.js +79 -0
  18. package/index.d.ts +575 -3
  19. package/index.js +1217 -722
  20. package/inlineBaseTheme-BB9e6h5f.js +9 -0
  21. package/inlineCollectionTheme-CWcMCUti.js +19 -0
  22. package/{kbChat-AUJxjURc.js → kbChat-C00LVlxP.js} +53 -48
  23. package/{nodeAlignment-Cn6xNtOP.js → nodeAlignment-BnJljFlw.js} +13 -13
  24. package/package.json +9 -9
  25. package/pillChrome-BAu5AfCT.js +30 -0
  26. package/popupState-JmpeKzgM-qhNTV79U.js +229 -0
  27. package/popups.js +1 -1
  28. package/react-CV3jf2mc.js +74 -0
  29. package/rteTheme.cssm-xg0gJ28J.js +4 -0
  30. package/styles.css +1 -1
  31. package/theme.cssm-DUzmx76l.js +4 -0
  32. package/{inlineCollectionTheme-D2w17LHX.js → themeVars.cssm-ByhhC2Jm.js} +18 -33
  33. package/usePopupRedirect-BThP_YPW-COUseDik.js +80 -0
  34. package/CollectionField-CzS-34zx.js +0 -270
  35. package/DateTimeWidget-C1jHOtz7.js +0 -255
  36. package/Dialog-CzVhHLEY.js +0 -145
  37. package/KBChatWidget-D7F9LRwI.js +0 -1078
  38. package/PhoneWidget-_nw97rkI.js +0 -99
  39. package/ThemeProvider-BQmIB5tr.js +0 -116
  40. package/VerifyButton-BkP98H17.js +0 -191
  41. package/dist-CJknSbJK.js +0 -80
  42. package/dist-DBbiX2ST.js +0 -3556
  43. package/inlineBaseTheme-DS-AfUHi.js +0 -9
  44. package/pillChrome-AhXOWXIb.js +0 -20
  45. /package/{es-iCqKQf1c.js → es-CztjLuNy.js} +0 -0
package/index.js CHANGED
@@ -1,126 +1,127 @@
1
1
  "use client";
2
- import { f as e, m as t, p as n } from "./Dialog-CzVhHLEY.js";
3
- import { n as r } from "./dist-DBbiX2ST.js";
4
- import { t as i } from "./inlineCollectionTheme-D2w17LHX.js";
5
- import { t as a } from "./inlineBaseTheme-DS-AfUHi.js";
6
- import * as o from "react";
7
- import { Suspense as s, createContext as c, lazy as l, useCallback as u, useContext as d, useEffect as f, useLayoutEffect as p, useMemo as m, useRef as h, useState as g } from "react";
8
- import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
9
- import { createLevoClient as b, getLevoError as x } from "@levo-so/core";
10
- import { ScriptOnce as S, useRouterState as C } from "@tanstack/react-router";
11
- import { useQuery as w } from "@tanstack/react-query";
12
- import { Dialog as T } from "@base-ui/react/dialog";
13
- import { createLevoInsights as E } from "@levo-so/insights";
14
- import { CheckIcon as D, ChevronLeftIcon as O, ChevronRightIcon as k, LoaderCircle as A, Tag as ee, X as j, XIcon as te } from "lucide-react";
15
- import { useRazorpay as ne } from "react-razorpay";
16
- import { EmbeddedCheckout as re, EmbeddedCheckoutProvider as M } from "@stripe/react-stripe-js";
17
- //#region src/hooks/useMounted.ts
18
- function N() {
19
- let [e, t] = g(!1);
20
- return f(() => t(!0), []), e;
21
- }
22
- //#endregion
23
- //#region src/chat/LevoChat.tsx
24
- var P = l(() => import("./kbChat-AUJxjURc.js")), ie = ({ site: e }) => {
25
- let t = N(), n = e.workspace_id || void 0;
26
- return !t || !n ? null : /* @__PURE__ */ v(s, {
27
- fallback: null,
28
- children: /* @__PURE__ */ v(P, {
29
- workspaceId: n,
30
- siteName: e.name || void 0,
31
- siteLogo: void 0,
32
- siteIcon: e.icon?.location,
33
- siteSlug: e.slug || void 0,
34
- showBranding: !!e.feature_flag?.branding
35
- })
36
- });
37
- }, F = (e) => {
2
+ import { n as e, r as t } from "./dist-CRDgdAkQ.js";
3
+ import { i as n, n as r, r as i } from "./LevoProvider-Bsjkcwc8.js";
4
+ import { t as a } from "./inlineCollectionTheme-CWcMCUti.js";
5
+ import { t as o } from "./inlineBaseTheme-BB9e6h5f.js";
6
+ import { createLevoClient as s, getLevoError as c } from "@levo-so/core";
7
+ import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
8
+ import * as f from "react";
9
+ import { Suspense as p, createContext as m, lazy as h, useCallback as g, useContext as _, useEffect as v, useLayoutEffect as y, useMemo as b, useRef as x, useState as S } from "react";
10
+ import { Dialog as C } from "@base-ui/react/dialog";
11
+ import { useMutation as w, useQuery as T, useQueryClient as E } from "@tanstack/react-query";
12
+ import { ScriptOnce as D, useRouterState as O } from "@tanstack/react-router";
13
+ import { createLevoInsights as ee } from "@levo-so/insights";
14
+ import { CheckIcon as k, ChevronLeftIcon as te, ChevronRightIcon as A, LoaderCircle as ne, Tag as j, X as re, XIcon as M } from "lucide-react";
15
+ import { useRazorpay as N } from "react-razorpay";
16
+ import { EmbeddedCheckout as P, EmbeddedCheckoutProvider as ie } from "@stripe/react-stripe-js";
17
+ //#region src/access/types.ts
18
+ var F = [
19
+ "otp",
20
+ "magiclink",
21
+ "whatsapp"
22
+ ], I = [
23
+ "google",
24
+ "microsoft",
25
+ "linkedin"
26
+ ], L = [...F, ...I], ae = "otp", R = (e) => typeof e == "object" && !!e && !Array.isArray(e), z = (e) => F.includes(e), oe = (e) => I.includes(e), B = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "string") : [], V = (e) => e, se = (e) => {
27
+ if (!R(e)) return null;
28
+ let t = e.enabled === void 0 ? !0 : e.enabled === !0, n = R(e.options) ? e.options : {};
29
+ switch (e.kind) {
30
+ case "authentication": return {
31
+ kind: "authentication",
32
+ enabled: t,
33
+ options: {
34
+ methods: B(n.methods).filter((e) => z(e) || oe(e)),
35
+ ...z(n.primary_method) ? { primary_method: n.primary_method } : {}
36
+ }
37
+ };
38
+ case "gating": return typeof n.collection != "string" || !n.collection.trim() ? null : {
39
+ kind: "gating",
40
+ enabled: t,
41
+ options: {
42
+ collection: n.collection.trim(),
43
+ ...R(n.condition) ? { condition: V(n.condition) } : {},
44
+ hidden: B(n.hidden)
45
+ }
46
+ };
47
+ case "profile": return {
48
+ kind: "profile",
49
+ enabled: t,
50
+ options: {
51
+ ...R(n.condition) ? { condition: V(n.condition) } : {},
52
+ hidden: B(n.hidden)
53
+ }
54
+ };
55
+ default: return null;
56
+ }
57
+ }, H = (e) => {
58
+ if (!Array.isArray(e) || e.length === 0) return {
59
+ rules: [],
60
+ invalid: !1
61
+ };
62
+ let t = e.map(se).filter((e) => e !== null);
63
+ return {
64
+ rules: t.filter((e) => e.enabled !== !1),
65
+ invalid: t.length === 0
66
+ };
67
+ }, U = (e) => {
68
+ let t = e.find((e) => e.kind === "authentication"), n = t?.kind === "authentication" ? t.options?.methods ?? [] : [];
69
+ return {
70
+ primary: (t?.kind === "authentication" ? t.options?.primary_method : void 0) ?? n.find(z) ?? ae,
71
+ oauth: n.filter(oe)
72
+ };
73
+ }, W = (e = null) => ({
74
+ state: "granted",
75
+ code: e,
76
+ message: null,
77
+ rule: null
78
+ }), ce = () => ({
79
+ state: "checking",
80
+ code: null,
81
+ message: null,
82
+ rule: null
83
+ }), G = (e, t, n = null) => ({
84
+ state: "blocked",
85
+ code: e,
86
+ message: t,
87
+ rule: n
88
+ }), le = (e, t) => {
89
+ let n = t?.split(".")[0];
90
+ return e.find((e) => e.kind === n) ?? null;
91
+ }, K = ({ rules: e, invalid: t, pageId: n, hasClient: r, isReady: i, isLoggedIn: a, check: o }) => e.length === 0 && !t ? W() : 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 ? W(o.data.code ?? null) : G(o.data.code ?? "access.CHECK_FAILED", o.data.message ?? null, le(e, o.data.code)) : G("access.CHECK_FAILED", "We could not verify your access.") : ce() : 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.") : ce(), ue = (e) => {
38
92
  let t = (e?.apiUrl || "").replace(/\/$/, "");
39
- return t ? b({
93
+ return t ? s({
40
94
  apiUrl: t,
41
95
  workspace: e?.workspace ? e.workspace : null,
42
96
  appName: "studio-site",
43
97
  NODE_ENV: "",
44
98
  APP_MODE: e?.appMode || "production"
45
99
  }) : null;
46
- }, I = (e) => ({
100
+ }, q = (e) => ({
47
101
  apiUrl: e.levo?.api_url || "",
48
102
  workspace: e.workspace_id || "",
49
103
  siteId: e.id || "",
50
104
  insightsUrl: e.levo?.insights_url || null,
51
105
  appMode: e.levo?.app_mode || "production"
52
- }), L = "(prefers-color-scheme: dark)", ae = (e) => {
53
- try {
54
- let t = localStorage.getItem(e);
55
- return t === "light" || t === "dark" || t === "system" ? t : null;
56
- } catch {
57
- return null;
58
- }
59
- }, oe = (e, t) => {
60
- try {
61
- localStorage.setItem(e, t);
62
- } catch {}
63
- };
64
- function se(e, t) {
65
- return `(function(){try{var t=localStorage.getItem(${JSON.stringify(e)});if(t!=='light'&&t!=='dark'&&t!=='system'){t=${JSON.stringify(t)}}var d=matchMedia('${L}').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){}})();`;
66
- }
67
- var R = c(void 0), z = (e) => e === "system" ? window.matchMedia(L).matches ? "dark" : "light" : e;
68
- function ce(e) {
69
- let t = document.documentElement;
70
- t.classList.remove("light", "dark"), t.classList.add(e), t.style.colorScheme = e;
71
- }
72
- var le = ({ children: e, defaultMode: t = "system", storageKey: n = "color-mode" }) => {
73
- let [r, i] = g(t), [a, o] = g(t === "dark" ? "dark" : "light"), s = N();
74
- return f(() => {
75
- i(ae(n) ?? t);
76
- }, [t, n]), f(() => {
77
- if (!s) return;
78
- let e = z(r);
79
- ce(e), o(e);
80
- }, [r, s]), f(() => {
81
- if (!s || r !== "system") return;
82
- let e = window.matchMedia(L), t = () => {
83
- let t = e.matches ? "dark" : "light";
84
- ce(t), o(t);
85
- };
86
- return e.addEventListener("change", t), () => e.removeEventListener("change", t);
87
- }, [r, s]), /* @__PURE__ */ y(R.Provider, {
88
- value: {
89
- mode: r,
90
- resolvedMode: a,
91
- setMode: (e) => {
92
- oe(n, e), i(e);
93
- }
94
- },
95
- children: [/* @__PURE__ */ v(S, { children: se(n, t) }), e]
96
- });
97
- };
98
- function ue() {
99
- let e = d(R);
100
- if (e === void 0) throw Error("useColorMode must be used within a ColorModeProvider");
101
- return e;
102
- }
103
- //#endregion
104
- //#region src/data/index.ts
105
- var B = (e) => [
106
+ }), de = (e) => [
106
107
  "levo-source",
107
108
  "list",
108
109
  e.module,
109
110
  e.identifier,
110
111
  e.query ?? null,
111
112
  e.options ?? null
112
- ], V = (e, t) => [
113
+ ], fe = (e, t) => [
113
114
  "levo-source",
114
115
  "record",
115
116
  e.module,
116
117
  e.identifier,
117
118
  t ?? null
118
- ], H = (e) => [
119
+ ], pe = (e) => [
119
120
  "levo-source",
120
121
  "form",
121
122
  e.module,
122
123
  e.identifier
123
- ], U = async (e, t) => {
124
+ ], me = async (e, t) => {
124
125
  let n = t.module === "collection" ? await e.collection.getCollectionContentList({
125
126
  collection_key: t.identifier,
126
127
  ...t.query ?? {}
@@ -129,76 +130,76 @@ var B = (e) => [
129
130
  data: n.content.data ?? [],
130
131
  meta: n.content.meta ?? null
131
132
  };
132
- }, W = async (e, t, n) => (t.module === "collection" ? await e.collection.getCollectionContent({
133
+ }, he = async (e, t, n) => (t.module === "collection" ? await e.collection.getCollectionContent({
133
134
  collection_key: t.identifier,
134
135
  slug: n
135
- }) : t.module === "blog" ? await e.blog.getSingleBlog(t.identifier, n) : await e.event.getSingleEvent(n)).content.data ?? null, de = async (e, t) => (await e.collection.getCollectionByIDExpanded(t.identifier)).content.data ?? null, fe = (e) => {
136
- let t = n(), r = w({
137
- queryKey: B(e),
138
- queryFn: () => U(t, e),
136
+ }) : t.module === "blog" ? await e.blog.getSingleBlog(t.identifier, n) : await e.event.getSingleEvent(n)).content.data ?? null, ge = async (e, t) => (await e.collection.getCollectionByIDExpanded(t.identifier)).content.data ?? null, _e = (e) => {
137
+ let t = i(), n = T({
138
+ queryKey: de(e),
139
+ queryFn: () => me(t, e),
139
140
  enabled: !!t
140
141
  });
141
142
  return {
142
- data: r.data?.data ?? null,
143
- meta: r.data?.meta ?? null,
144
- isLoading: r.isLoading,
145
- error: r.error ? x(r.error).message : null,
143
+ data: n.data?.data ?? null,
144
+ meta: n.data?.meta ?? null,
145
+ isLoading: n.isLoading,
146
+ error: n.error ? c(n.error).message : null,
146
147
  bind: { "data-levo-source": JSON.stringify({
147
148
  mode: "list",
148
149
  ...e
149
150
  }) }
150
151
  };
151
- }, pe = (e, t) => {
152
- let r = n(), i = w({
153
- queryKey: V(e, t),
154
- queryFn: () => W(r, e, t),
155
- enabled: !!r && !!t
152
+ }, ve = (e, t) => {
153
+ let n = i(), r = T({
154
+ queryKey: fe(e, t),
155
+ queryFn: () => he(n, e, t),
156
+ enabled: !!n && !!t
156
157
  });
157
158
  return {
158
- data: i.data ?? null,
159
- isLoading: i.isLoading,
160
- error: i.error ? x(i.error).message : null,
159
+ data: r.data ?? null,
160
+ isLoading: r.isLoading,
161
+ error: r.error ? c(r.error).message : null,
161
162
  bind: { "data-levo-source": JSON.stringify({
162
163
  mode: "record",
163
164
  ...e
164
165
  }) }
165
166
  };
166
- }, me = (e) => {
167
- let t = n(), r = w({
168
- queryKey: H(e),
169
- queryFn: () => de(t, e),
167
+ }, ye = (e) => {
168
+ let t = i(), n = T({
169
+ queryKey: pe(e),
170
+ queryFn: () => ge(t, e),
170
171
  enabled: !!t
171
172
  });
172
173
  return {
173
- schema: r.data ?? null,
174
- isLoading: r.isLoading,
175
- error: r.error ? x(r.error).message : null,
174
+ schema: n.data ?? null,
175
+ isLoading: n.isLoading,
176
+ error: n.error ? c(n.error).message : null,
176
177
  bind: { "data-levo-source": JSON.stringify({
177
178
  mode: "form",
178
179
  ...e
179
180
  }) }
180
181
  };
181
- }, G = async ({ queryClient: e, config: t, sources: n, params: r }) => {
182
- let i = F(t);
182
+ }, be = async ({ queryClient: e, config: t, sources: n, params: r }) => {
183
+ let i = ue(t);
183
184
  if (!i || !n) return {};
184
185
  let a = await Promise.all(Object.entries(n).map(async ([t, n]) => {
185
186
  if (n.mode === "record") {
186
187
  let a = r?.slug;
187
188
  return a ? [t, await e.ensureQueryData({
188
- queryKey: V(n, a),
189
- queryFn: () => W(i, n, a)
189
+ queryKey: fe(n, a),
190
+ queryFn: () => he(i, n, a)
190
191
  }).catch(() => null)] : [t, null];
191
192
  }
192
193
  return n.mode === "form" ? [t, await e.ensureQueryData({
193
- queryKey: H(n),
194
- queryFn: () => de(i, n)
194
+ queryKey: pe(n),
195
+ queryFn: () => ge(i, n)
195
196
  }).catch(() => null)] : [t, await e.ensureQueryData({
196
- queryKey: B(n),
197
- queryFn: () => U(i, n)
197
+ queryKey: de(n),
198
+ queryFn: () => me(i, n)
198
199
  }).catch(() => null)];
199
200
  }));
200
201
  return Object.fromEntries(a);
201
- }, he = {
202
+ }, xe = {
202
203
  background: "var(--color-page)",
203
204
  foreground: "var(--color-ink)",
204
205
  text: "var(--color-ink)",
@@ -220,63 +221,550 @@ var B = (e) => [
220
221
  input: "var(--color-background1)",
221
222
  inputForeground: "var(--color-ink)",
222
223
  ring: "var(--color-brand)"
223
- }, ge = ({ source: e, submitLabel: t = "Submit", hiddenFields: o, formVariant: s = "default", successConfig: c, theme: l, className: u }) => {
224
- let d = n(), { schema: f, isLoading: p, bind: h } = me(e), g = m(() => ({
225
- ...a({
226
- colors: {
227
- ...he,
228
- ...l?.colors
224
+ }, Se = (e) => b(() => ({
225
+ ...o({
226
+ colors: {
227
+ ...xe,
228
+ ...e?.colors
229
+ },
230
+ radius: e?.radius ?? "var(--radius-token)",
231
+ fonts: {
232
+ body: "var(--font-body)",
233
+ heading: "var(--font-heading)"
234
+ }
235
+ }),
236
+ ...e?.gap ? a({ form: { gap: e.gap } }) : {}
237
+ }), [e]);
238
+ //#endregion
239
+ //#region src/hooks/useMounted.ts
240
+ function J() {
241
+ let [e, t] = S(!1);
242
+ return v(() => t(!0), []), e;
243
+ }
244
+ //#endregion
245
+ //#region src/access/useLevoAuth.ts
246
+ var Y = ["levo-auth", "session"], Ce = () => {
247
+ let e = i(), t = E(), n = J(), r = T({
248
+ queryKey: Y,
249
+ queryFn: async () => {
250
+ try {
251
+ return await e?.membership?.getMe() ?? null;
252
+ } catch (t) {
253
+ return e?.logger?.debug?.("Session check returned no account", { exception: c(t) }), null;
254
+ }
255
+ },
256
+ enabled: n && !!e,
257
+ staleTime: 3e4,
258
+ retry: !1
259
+ }), a = w({
260
+ mutationFn: async () => {
261
+ await e?.membership?.signOut();
262
+ },
263
+ onSettled: () => t.invalidateQueries({ queryKey: Y }),
264
+ onError: (t) => {
265
+ e?.logger?.error("Sign out failed", { exception: c(t) });
266
+ }
267
+ }), o = g(async () => {
268
+ await t.invalidateQueries({ queryKey: Y });
269
+ }, [t]), s = g(async () => {
270
+ await a.mutateAsync().catch(() => void 0);
271
+ }, [a]), l = r.data ?? null;
272
+ return {
273
+ account: l,
274
+ isLoggedIn: !!l,
275
+ isLoaded: n && (!e || r.isSuccess),
276
+ isLoading: r.isFetching,
277
+ refresh: o,
278
+ signOut: s,
279
+ isSigningOut: a.isPending
280
+ };
281
+ }, we = ({ collection: t, hidden: n, submitLabel: r = "Submit", onSuccess: a, theme: o, className: s }) => {
282
+ let c = i(), { account: l } = Ce(), { schema: d, isLoading: f } = ye({
283
+ module: "collection",
284
+ identifier: t
285
+ }), p = Se(o);
286
+ return c ? /* @__PURE__ */ u("div", {
287
+ className: s,
288
+ children: /* @__PURE__ */ u(e, {
289
+ fetchedSchema: d,
290
+ isLoading: f,
291
+ submitButtonConfig: {
292
+ show: !0,
293
+ text: r
294
+ },
295
+ uiConfig: {
296
+ hideFormHeading: !0,
297
+ hideSectionHeadings: !0
298
+ },
299
+ theme: { style: p },
300
+ hiddenFields: n,
301
+ isLoggedIn: !!l,
302
+ account: {
303
+ email: l?.email,
304
+ mobile: l?.mobile
305
+ },
306
+ onSuccess: () => a?.()
307
+ })
308
+ }) : null;
309
+ }, Te = "so_levo_membership_account", Ee = [
310
+ "profile_picture",
311
+ "first_name",
312
+ "last_name",
313
+ "email",
314
+ "username",
315
+ "socials"
316
+ ], De = ["email", "username"], Oe = (e) => Ee.includes(e.key) || e.editable === !0, ke = ({ hidden: e, submitLabel: n = "Save and continue", onSuccess: r, errorClassName: a = "text-sm text-[var(--color-danger)]", theme: o, className: s }) => {
317
+ let l = i(), f = J(), { account: p } = Ce(), m = Se(o), [h, g] = S(""), _ = T({
318
+ queryKey: ["levo-access", "profile-schema"],
319
+ queryFn: async () => (await l?.collection?.getCollectionByIDExpanded(Te))?.content?.data ?? null,
320
+ enabled: f && !!l,
321
+ staleTime: 5 * 6e4,
322
+ retry: 1
323
+ }), v = e?.join("|") ?? "", y = b(() => {
324
+ let t = _.data;
325
+ return t ? {
326
+ ...t,
327
+ sections: t.sections?.map((t) => ({
328
+ ...t,
329
+ fields: t.fields?.map((t) => ({
330
+ ...t,
331
+ hidden: !Oe(t) || !!e?.includes(t.key),
332
+ readonly: t.readonly || De.includes(t.key)
333
+ }))
334
+ }))
335
+ } : null;
336
+ }, [_.data, v]), x = w({
337
+ mutationFn: async (t) => {
338
+ let n = y?.sections?.flatMap((e) => e?.fields ?? [])?.filter((t) => Oe(t) && !De.includes(t.key) && !e?.includes(t.key))?.map((e) => e?.key) ?? [];
339
+ await l?.membership?.updateMe(Object.fromEntries(Object.entries(t).filter(([e]) => n.includes(e))));
340
+ },
341
+ onMutate: () => g(""),
342
+ onSuccess: () => r?.(),
343
+ onError: (e) => {
344
+ let t = c(e);
345
+ l?.logger?.error("Failed to update profile", { exception: t }), g(t?.message || "Something went wrong. Please try again.");
346
+ }
347
+ });
348
+ return l ? /* @__PURE__ */ d("div", {
349
+ className: s,
350
+ children: [h ? /* @__PURE__ */ u("p", {
351
+ className: a,
352
+ children: h
353
+ }) : null, y ? /* @__PURE__ */ u(t, {
354
+ schema: y,
355
+ initialValues: p ?? {},
356
+ uiConfig: {
357
+ hideFormHeading: !0,
358
+ hideSectionHeadings: !0
359
+ },
360
+ submitButtonConfig: {
361
+ show: !0,
362
+ text: n
229
363
  },
230
- radius: l?.radius ?? "var(--radius-token)",
231
- fonts: {
232
- body: "var(--font-body)",
233
- heading: "var(--font-heading)"
364
+ theme: { style: m },
365
+ isLoading: x.isPending,
366
+ onSubmit: (e) => x.mutate(e)
367
+ }) : null]
368
+ }) : null;
369
+ }, Ae = (e) => {
370
+ let t = i(), n = E(), r = J(), { isLoggedIn: a, isLoaded: o } = Ce(), s = e.id?.trim() || "", { rules: l, invalid: u } = b(() => H(e.access), [e.access]), d = b(() => U(l), [l]), f = r && !!t && l.length > 0 && !u && !!s && a, p = T({
371
+ queryKey: ["levo-access", s],
372
+ queryFn: async () => (await t?.fetch.url(`/v1/builder/page/${s}/check-access`).post().json())?.content?.data ?? null,
373
+ enabled: f,
374
+ staleTime: 0,
375
+ retry: 1
376
+ });
377
+ v(() => {
378
+ p.isError && t?.logger?.error("Page access check failed", { exception: c(p.error) });
379
+ }, [
380
+ p.isError,
381
+ p.error,
382
+ t
383
+ ]);
384
+ let m = g(() => {
385
+ n.invalidateQueries({ queryKey: Y }), n.invalidateQueries({ queryKey: ["levo-access", s] });
386
+ }, [n, s]);
387
+ return {
388
+ ...K({
389
+ rules: l,
390
+ invalid: u,
391
+ pageId: s,
392
+ hasClient: !!t,
393
+ isReady: r && o,
394
+ isLoggedIn: a,
395
+ check: {
396
+ isError: p.isError,
397
+ isSuccess: p.isSuccess,
398
+ data: p.data ?? null
234
399
  }
235
400
  }),
236
- ...l?.gap ? i({ form: { gap: l.gap } }) : {}
237
- }), [l]);
238
- return d ? /* @__PURE__ */ v("div", {
239
- ...h,
240
- className: u,
241
- children: /* @__PURE__ */ v(r, {
242
- fetchedSchema: f,
243
- isLoading: p,
401
+ authMethods: d,
402
+ recheck: m,
403
+ isChecking: p.isFetching
404
+ };
405
+ }, je = "membership.account.ACCOUNT_PENDING_APPROVAL", Me = (e) => e ? e === "membership.account.ACCOUNT_PENDING_APPROVAL" || e.includes("ACCOUNT_PENDING_APPROVAL") : !1, Ne = (e) => {
406
+ let t = c(e);
407
+ return {
408
+ code: t?.code || "SOMETHING_WENT_WRONG",
409
+ title: t?.title || "Something went wrong",
410
+ message: t?.message || "Something went wrong. Please try again.",
411
+ fieldErrors: Object.fromEntries((t?.fieldErrors ?? []).map((e) => [e.param, e.message])),
412
+ isPendingApproval: Me(t?.code)
413
+ };
414
+ }, Pe = {
415
+ code: "site.NOT_CONNECTED",
416
+ title: "Sign-in unavailable",
417
+ message: "This site is not connected to an account system yet.",
418
+ fieldErrors: {},
419
+ isPendingApproval: !1
420
+ }, Fe = () => {
421
+ let e = i(), t = E(), n = g(async (t, n) => {
422
+ if (!e?.membership) return {
423
+ ok: !1,
424
+ error: Pe
425
+ };
426
+ try {
427
+ return {
428
+ ok: !0,
429
+ data: await n()
430
+ };
431
+ } catch (n) {
432
+ let r = c(n);
433
+ return e.logger?.error(t, { exception: r }), {
434
+ ok: !1,
435
+ error: Ne(r)
436
+ };
437
+ }
438
+ }, [e]), r = g(async ({ identifier: t, medium: n }) => {
439
+ await e?.membership?.requestOtp({
440
+ content: t,
441
+ ...n === "whatsapp" ? { medium: "whatsapp" } : {}
442
+ });
443
+ }, [e]), a = w({ mutationFn: (e) => n("Failed to send verification code", () => r(e)) }), o = w({ mutationFn: (e) => n("Failed to resend verification code", () => r(e)) }), s = w({ mutationFn: ({ identifier: r, code: i }) => n("Verification failed", async () => {
444
+ let n = await e?.membership?.signInWithOtp({
445
+ content: r,
446
+ code: i
447
+ }) ?? null;
448
+ return t.setQueryData(Y, n), t.invalidateQueries({ queryKey: Y }), n;
449
+ }) }), l = w({ mutationFn: (t) => n("Failed to send magic link", async () => {
450
+ await e?.membership?.requestMagicLink({ content: t });
451
+ }) });
452
+ return {
453
+ sendCode: (e) => a.mutateAsync(e),
454
+ resendCode: (e) => o.mutateAsync(e),
455
+ verifyCode: (e) => s.mutateAsync(e),
456
+ sendMagicLink: (e) => l.mutateAsync(e),
457
+ isSendingCode: a.isPending,
458
+ isResendingCode: o.isPending,
459
+ isVerifying: s.isPending,
460
+ isSendingMagicLink: l.isPending
461
+ };
462
+ }, Ie = 700, Le = 500, Re = 700, ze = (e, t) => {
463
+ let n = window.screenX + (window.outerWidth - Le) / 2, r = window.screenY + (window.outerHeight - Re) / 2.5;
464
+ return window.open(e, t, `width=${Le},height=${Re},left=${n},top=${r}`);
465
+ }, Be = ({ methods: e, title: t = "Sign in", onSuccess: n, onError: r }) => {
466
+ let a = i(), o = E(), s = J(), [l, u] = S(null), [d, f] = S(null), p = x(null), m = x(void 0), h = x({
467
+ onSuccess: n,
468
+ onError: r
469
+ });
470
+ h.current = {
471
+ onSuccess: n,
472
+ onError: r
473
+ };
474
+ let _ = T({
475
+ queryKey: ["levo-auth", "oauth-urls"],
476
+ queryFn: async () => await a?.membership?.getOAuthURL() ?? null,
477
+ enabled: s && !!a && e.length > 0,
478
+ staleTime: 5 * 6e4,
479
+ retry: !1
480
+ });
481
+ v(() => {
482
+ if (!_.error) return;
483
+ let e = c(_.error);
484
+ a?.logger?.error("Failed to load OAuth URLs", { exception: e }), f({
485
+ code: e?.code || "SOMETHING_WENT_WRONG",
486
+ title: e?.title || "Sign-in unavailable",
487
+ message: e?.message || "We could not connect to the sign-in service.",
488
+ fieldErrors: {},
489
+ isPendingApproval: !1
490
+ });
491
+ }, [_.error, a]);
492
+ let y = g(() => {
493
+ window.clearInterval(m.current), m.current = void 0, p.current?.close(), p.current = null, u(null);
494
+ }, []);
495
+ v(() => () => {
496
+ window.clearInterval(m.current), p.current?.close();
497
+ }, []);
498
+ let C = g(() => {
499
+ window.clearInterval(m.current), m.current = window.setInterval(() => {
500
+ let e = p.current;
501
+ if (!e || e.closed) {
502
+ y();
503
+ return;
504
+ }
505
+ let t;
506
+ try {
507
+ t = new URL(e.location.href).searchParams;
508
+ } catch {
509
+ return;
510
+ }
511
+ let n = t.get("code");
512
+ if (!n) return;
513
+ if (y(), n.toLowerCase() === "success") {
514
+ f(null), o.invalidateQueries({ queryKey: Y }), h.current.onSuccess?.();
515
+ return;
516
+ }
517
+ let r = {
518
+ code: t.get("code") || "SOMETHING_WENT_WRONG",
519
+ title: t.get("title") || "Sign-in failed",
520
+ message: t.get("message") || "We could not sign you in. Please try again.",
521
+ fieldErrors: {},
522
+ isPendingApproval: Me(t.get("code"))
523
+ };
524
+ r.isPendingApproval || f(r), h.current.onError?.(r);
525
+ }, Ie);
526
+ }, [o, y]), w = b(() => {
527
+ let e = _.data;
528
+ if (!e || typeof window > "u") return {};
529
+ let t = window.location.href, n = a?.pageContext;
530
+ return Object.fromEntries(Object.entries(e).flatMap(([e, r]) => {
531
+ if (typeof r != "string" || !r) return [];
532
+ try {
533
+ let i = new URL(r);
534
+ return i.searchParams.set("redirect_uri", t), n && i.searchParams.set("page_context", JSON.stringify(n)), [[e, i.toString()]];
535
+ } catch {
536
+ return [];
537
+ }
538
+ }));
539
+ }, [_.data, a]);
540
+ return {
541
+ providers: b(() => e.filter((e) => !!w[e]).map((e) => ({
542
+ provider: e,
543
+ signIn: () => {
544
+ let n = w[e];
545
+ if (n) {
546
+ if (f(null), p.current?.close(), p.current = ze(n, t), !p.current) {
547
+ f({
548
+ code: "POPUP_BLOCKED",
549
+ title: "Popup blocked",
550
+ message: "Allow popups for this site, then try again.",
551
+ fieldErrors: {},
552
+ isPendingApproval: !1
553
+ });
554
+ return;
555
+ }
556
+ u(e), C();
557
+ }
558
+ }
559
+ })), [
560
+ e,
561
+ w,
562
+ t,
563
+ C
564
+ ]),
565
+ isLoading: _.isFetching,
566
+ pendingProvider: l,
567
+ error: d,
568
+ clearError: g(() => f(null), [])
569
+ };
570
+ }, Ve = 4, He = (e) => /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(e.trim()), Ue = (e) => RegExp("^\\d{4}$").test(e.trim()), We = (e) => {
571
+ let t = e.replace(/\D/g, "").replace(/^0+/, "");
572
+ return t ? `+${t}` : "";
573
+ }, Ge = (e) => /^\+[1-9]\d{7,14}$/.test(We(e)), Ke = ({ value: e, onChange: t, length: n = 4, onComplete: r, autoFocus: i, disabled: a }) => {
574
+ let o = x([]), [s, c] = S(null), l = x(r);
575
+ l.current = r;
576
+ let u = Array.from({ length: n }, (t, n) => e[n] ?? ""), d = g((e) => {
577
+ let t = Math.max(0, Math.min(n - 1, e)), r = o.current[t];
578
+ r?.focus(), r?.select();
579
+ }, [n]);
580
+ v(() => {
581
+ i && !a && d(0);
582
+ }, [
583
+ i,
584
+ a,
585
+ d
586
+ ]);
587
+ let f = g((e, r) => {
588
+ let i = e.slice(0, n);
589
+ t(i), d(r), i.length === n && l.current?.(i);
590
+ }, [
591
+ n,
592
+ t,
593
+ d
594
+ ]), p = (t, r) => {
595
+ let i = r.replace(/\D/g, "");
596
+ if (!i) return;
597
+ if (i.length > 1) {
598
+ let r = (e.slice(0, t) + i).slice(0, n);
599
+ f(r, r.length);
600
+ return;
601
+ }
602
+ let a = [...u];
603
+ a[t] = i, f(a.join("").slice(0, Math.max(t + 1, e.length)), t + 1);
604
+ }, m = (t, n) => {
605
+ if (n.key === "Backspace") {
606
+ n.preventDefault();
607
+ let r = u[t] ? t : t - 1;
608
+ if (r < 0) return;
609
+ f(e.slice(0, r), r);
610
+ return;
611
+ }
612
+ if (n.key === "ArrowLeft") {
613
+ n.preventDefault(), d(t - 1);
614
+ return;
615
+ }
616
+ n.key === "ArrowRight" && (n.preventDefault(), d(Math.min(t + 1, e.length)));
617
+ }, h = (e) => {
618
+ e.preventDefault();
619
+ let t = e.clipboardData.getData("text").replace(/\D/g, "");
620
+ if (!t) return;
621
+ let r = t.slice(0, n);
622
+ f(r, r.length);
623
+ };
624
+ return {
625
+ slots: u.map((t, r) => ({
626
+ char: t,
627
+ isActive: s === r,
628
+ inputProps: {
629
+ ref: (e) => {
630
+ o.current[r] = e;
631
+ },
632
+ value: t,
633
+ inputMode: "numeric",
634
+ autoComplete: r === 0 ? "one-time-code" : "off",
635
+ type: "text",
636
+ "aria-label": `Digit ${r + 1} of ${n}`,
637
+ onChange: (e) => p(r, e.target.value),
638
+ onKeyDown: (e) => m(r, e),
639
+ onPaste: h,
640
+ onFocus: () => {
641
+ if (r > e.length) {
642
+ d(e.length);
643
+ return;
644
+ }
645
+ c(r);
646
+ },
647
+ onBlur: () => c((e) => e === r ? null : e),
648
+ disabled: a
649
+ }
650
+ })),
651
+ containerProps: {
652
+ role: "group",
653
+ "aria-label": `${n}-digit verification code`
654
+ },
655
+ clear: g(() => f("", 0), [f])
656
+ };
657
+ }, qe = h(() => import("./kbChat-C00LVlxP.js")), Je = ({ site: e, path: t }) => {
658
+ let n = J(), r = e.workspace_id || void 0;
659
+ return !n || !r ? null : /* @__PURE__ */ u(p, {
660
+ fallback: null,
661
+ children: /* @__PURE__ */ u(qe, {
662
+ workspaceId: r,
663
+ siteName: e.name || void 0,
664
+ siteLogo: void 0,
665
+ siteIcon: e.icon?.location,
666
+ siteSlug: e.slug || void 0,
667
+ showBranding: !!e.feature_flag?.branding,
668
+ path: t
669
+ })
670
+ });
671
+ }, Ye = "(prefers-color-scheme: dark)", Xe = (e) => {
672
+ try {
673
+ let t = localStorage.getItem(e);
674
+ return t === "light" || t === "dark" || t === "system" ? t : null;
675
+ } catch {
676
+ return null;
677
+ }
678
+ }, Ze = (e, t) => {
679
+ try {
680
+ localStorage.setItem(e, t);
681
+ } catch {}
682
+ };
683
+ function Qe(e, t) {
684
+ return `(function(){try{var t=localStorage.getItem(${JSON.stringify(e)});if(t!=='light'&&t!=='dark'&&t!=='system'){t=${JSON.stringify(t)}}var d=matchMedia('${Ye}').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){}})();`;
685
+ }
686
+ var $e = m(void 0), et = (e) => e === "system" ? window.matchMedia(Ye).matches ? "dark" : "light" : e;
687
+ function tt(e) {
688
+ let t = document.documentElement;
689
+ t.classList.remove("light", "dark"), t.classList.add(e), t.style.colorScheme = e;
690
+ }
691
+ var nt = ({ children: e, defaultMode: t = "system", storageKey: n = "color-mode" }) => {
692
+ let [r, i] = S(t), [a, o] = S(t === "dark" ? "dark" : "light"), s = J();
693
+ return v(() => {
694
+ i(Xe(n) ?? t);
695
+ }, [t, n]), v(() => {
696
+ if (!s) return;
697
+ let e = et(r);
698
+ tt(e), o(e);
699
+ }, [r, s]), v(() => {
700
+ if (!s || r !== "system") return;
701
+ let e = window.matchMedia(Ye), t = () => {
702
+ let t = e.matches ? "dark" : "light";
703
+ tt(t), o(t);
704
+ };
705
+ return e.addEventListener("change", t), () => e.removeEventListener("change", t);
706
+ }, [r, s]), /* @__PURE__ */ d($e.Provider, {
707
+ value: {
708
+ mode: r,
709
+ resolvedMode: a,
710
+ setMode: (e) => {
711
+ Ze(n, e), i(e);
712
+ }
713
+ },
714
+ children: [/* @__PURE__ */ u(D, { children: Qe(n, t) }), e]
715
+ });
716
+ };
717
+ function rt() {
718
+ let e = _($e);
719
+ if (e === void 0) throw Error("useColorMode must be used within a ColorModeProvider");
720
+ return e;
721
+ }
722
+ //#endregion
723
+ //#region src/form/LevoForm.tsx
724
+ var it = ({ source: t, submitLabel: n = "Submit", hiddenFields: r, formVariant: a = "default", successConfig: o, theme: s, className: c }) => {
725
+ let l = i(), { schema: d, isLoading: f, bind: p } = ye(t), m = Se(s);
726
+ return l ? /* @__PURE__ */ u("div", {
727
+ ...p,
728
+ className: c,
729
+ children: /* @__PURE__ */ u(e, {
730
+ fetchedSchema: d,
731
+ isLoading: f,
244
732
  submitButtonConfig: {
245
733
  show: !0,
246
- text: t
734
+ text: n
247
735
  },
248
736
  uiConfig: {
249
737
  hideFormHeading: !0,
250
738
  hideSectionHeadings: !0
251
739
  },
252
- theme: { style: g },
253
- hiddenFields: o,
254
- formVariant: s,
255
- successConfig: c
740
+ theme: { style: m },
741
+ hiddenFields: r,
742
+ formVariant: a,
743
+ successConfig: o
256
744
  })
257
745
  }) : null;
258
- }, _e = 1400, ve = 12 * 1024 * 1024, ye = new Set(["transparent", "rgba(0, 0, 0, 0)"]), be = {
746
+ }, at = 1400, ot = 12 * 1024 * 1024, st = new Set(["transparent", "rgba(0, 0, 0, 0)"]), ct = {
259
747
  imagePlaceholder: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=",
260
748
  onImageErrorHandler: () => void 0
261
- }, xe = (e) => {
749
+ }, lt = (e) => {
262
750
  let t = getComputedStyle(e);
263
- return !ye.has(t.backgroundColor) || t.backgroundImage !== "none";
264
- }, Se = (e) => {
751
+ return !st.has(t.backgroundColor) || t.backgroundImage !== "none";
752
+ }, ut = (e) => {
265
753
  for (let t = e; t; t = t.parentElement) {
266
754
  let e = getComputedStyle(t).backgroundColor;
267
- if (!ye.has(e)) return e;
755
+ if (!st.has(e)) return e;
268
756
  }
269
757
  return "#ffffff";
270
- }, Ce = async (e, t) => {
271
- let { toPng: n } = await import("./es-iCqKQf1c.js"), r = e.getBoundingClientRect(), i = Math.max(r.width, r.height, 1), a = Math.min(2, Math.max(.4, _e / i)), o = await n(e, {
272
- ...be,
758
+ }, dt = async (e, t) => {
759
+ let { toPng: n } = await import("./es-CztjLuNy.js"), r = e.getBoundingClientRect(), i = Math.max(r.width, r.height, 1), a = Math.min(2, Math.max(.4, at / i)), o = await n(e, {
760
+ ...ct,
273
761
  pixelRatio: a,
274
- backgroundColor: Se(e),
762
+ backgroundColor: ut(e),
275
763
  filter: (e) => !t.includes(e)
276
764
  });
277
- if (o.length > ve) throw Error("capture too large");
765
+ if (o.length > ot) throw Error("capture too large");
278
766
  return o;
279
- }, we = 4, Te = 4e3, Ee = (e, t) => {
767
+ }, ft = 4, pt = 4e3, mt = (e, t) => {
280
768
  let n = document.elementFromPoint(e.x + e.width / 2, e.y + e.height / 2);
281
769
  for (; n && t.includes(n);) n = n.parentElement;
282
770
  let r = document.body;
@@ -287,8 +775,8 @@ var B = (e) => [
287
775
  break;
288
776
  }
289
777
  }
290
- let i = window.innerWidth * window.innerHeight * we || 2 ** 53 - 1, a = r;
291
- for (; !xe(a);) {
778
+ let i = window.innerWidth * window.innerHeight * ft || 2 ** 53 - 1, a = r;
779
+ for (; !lt(a);) {
292
780
  let e = a.parentElement;
293
781
  if (!e || e === document.documentElement) break;
294
782
  let t = e.getBoundingClientRect();
@@ -296,13 +784,13 @@ var B = (e) => [
296
784
  a = e;
297
785
  }
298
786
  return a;
299
- }, De = async (e, t) => {
300
- let { toCanvas: n } = await import("./es-iCqKQf1c.js"), r = Ee(e, t), i = r.getBoundingClientRect(), a = Math.max(e.width, e.height, 1), o = Math.min(2, Math.max(.4, _e / a)), s = Math.max(i.width, i.height, 1);
301
- o = Math.min(o, Te / s);
787
+ }, ht = async (e, t) => {
788
+ let { toCanvas: n } = await import("./es-CztjLuNy.js"), r = mt(e, t), i = r.getBoundingClientRect(), a = Math.max(e.width, e.height, 1), o = Math.min(2, Math.max(.4, at / a)), s = Math.max(i.width, i.height, 1);
789
+ o = Math.min(o, pt / s);
302
790
  let c = await n(r, {
303
- ...be,
791
+ ...ct,
304
792
  pixelRatio: o,
305
- backgroundColor: Se(r),
793
+ backgroundColor: ut(r),
306
794
  filter: (e) => !t.includes(e)
307
795
  }), l = document.createElement("canvas");
308
796
  l.width = Math.max(1, Math.round(e.width * o)), l.height = Math.max(1, Math.round(e.height * o));
@@ -310,39 +798,39 @@ var B = (e) => [
310
798
  if (!u) throw Error("no 2d context");
311
799
  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);
312
800
  let d = l.toDataURL("image/png");
313
- if (d.length > ve) throw Error("capture too large");
801
+ if (d.length > ot) throw Error("capture too large");
314
802
  return d;
315
- }, K = {
803
+ }, gt = {
316
804
  ring: 99997,
317
805
  overlay: 99998,
318
806
  label: 99999
319
- }, q = {
807
+ }, X = {
320
808
  hover: "#3b82f6",
321
809
  hoverBg: "rgba(59,130,246,0.12)",
322
810
  hoverLabelBg: "#1d4ed8",
323
811
  select: "#16a34a",
324
812
  selectGlow: "rgba(22,163,74,0.18)"
325
- }, J = (e) => {
813
+ }, Z = (e) => {
326
814
  let t = e?.getAttribute("data-tsd-source");
327
815
  return t ? t.replace(/^\//, "") : null;
328
- }, Oe = (e) => Array.from(document.querySelectorAll("[data-tsd-source]")).filter((t) => J(t) === e), ke = (e, t) => {
329
- let n = Oe(t).indexOf(e);
816
+ }, _t = (e) => Array.from(document.querySelectorAll("[data-tsd-source]")).filter((t) => Z(t) === e), vt = (e, t) => {
817
+ let n = _t(t).indexOf(e);
330
818
  return n < 0 ? 0 : n;
331
- }, Y = (e, t = 0) => {
332
- let n = Oe(e);
819
+ }, yt = (e, t = 0) => {
820
+ let n = _t(e);
333
821
  return n[t] ?? n[0] ?? null;
334
- }, Ae = (e, t) => {
822
+ }, bt = (e, t) => {
335
823
  let n = (e.getAttribute("data-staged-key") || "").split(/\s+/).filter(Boolean);
336
824
  n.includes(t) || e.setAttribute("data-staged-key", [...n, t].join(" "));
337
- }, je = (e, t) => {
825
+ }, xt = (e, t) => {
338
826
  let n = (e.getAttribute("data-staged-key") || "").split(/\s+/).filter((e) => e && e !== t);
339
827
  n.length ? e.setAttribute("data-staged-key", n.join(" ")) : e.removeAttribute("data-staged-key");
340
- }, Me = (e, t) => {
828
+ }, St = (e, t) => {
341
829
  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("");
342
830
  if (!n) return "";
343
831
  let r = `[data-staged-key~="${CSS.escape(e)}"]{${n}}`, i = t.media?.replace(/[;{}]/g, "").trim();
344
832
  return i ? `@media ${i}{${r}}` : r;
345
- }, Ne = (e) => {
833
+ }, Ct = (e) => {
346
834
  let t = e.tagName.toLowerCase();
347
835
  return t === "input" ? {
348
836
  checkbox: "Checkbox",
@@ -384,31 +872,31 @@ var B = (e) => [
384
872
  aside: "Sidebar",
385
873
  div: "Container"
386
874
  }[t] || `${t.charAt(0).toUpperCase()}${t.slice(1)}`;
387
- }, Pe = 36, Fe = (e) => {
388
- let t = Ne(e), n = ((e) => e.replace(/\s+/g, " ").trim())(e.getAttribute("aria-label") || e.getAttribute("alt") || e.getAttribute("title") || e.getAttribute("name") || "");
389
- return n ? `${t} · ${n.length > Pe ? `${n.slice(0, Pe - 1).trimEnd()}…` : n}` : t;
390
- }, Ie = (e) => {
875
+ }, wt = 36, Tt = (e) => {
876
+ let t = Ct(e), n = ((e) => e.replace(/\s+/g, " ").trim())(e.getAttribute("aria-label") || e.getAttribute("alt") || e.getAttribute("title") || e.getAttribute("name") || "");
877
+ return n ? `${t} · ${n.length > wt ? `${n.slice(0, wt - 1).trimEnd()}…` : n}` : t;
878
+ }, Et = (e) => {
391
879
  let t = [], n = e;
392
880
  for (; n && n.nodeType === 1 && n !== document.body && t.length < 8;) t.unshift(n.tagName.toLowerCase()), n = n.parentElement;
393
881
  return t.join(" > ");
394
- }, Le = () => {
882
+ }, Dt = () => {
395
883
  let e = document.createElement("div");
396
- e.style.cssText = `position:fixed;pointer-events:none;z-index:${K.overlay};background:${q.hoverBg};outline:2px solid ${q.hover};border-radius:2px;display:none`;
884
+ e.style.cssText = `position:fixed;pointer-events:none;z-index:${gt.overlay};background:${X.hoverBg};outline:2px solid ${X.hover};border-radius:2px;display:none`;
397
885
  let t = document.createElement("div");
398
- t.style.cssText = `position:fixed;pointer-events:none;z-index:${K.label};background:${q.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`;
886
+ t.style.cssText = `position:fixed;pointer-events:none;z-index:${gt.label};background:${X.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`;
399
887
  let n = document.createElement("div");
400
- n.style.cssText = `position:fixed;pointer-events:none;z-index:${K.ring};outline:2px solid ${q.select};outline-offset:1px;border-radius:3px;box-shadow:0 0 0 4px ${q.selectGlow};display:none`;
888
+ n.style.cssText = `position:fixed;pointer-events:none;z-index:${gt.ring};outline:2px solid ${X.select};outline-offset:1px;border-radius:3px;box-shadow:0 0 0 4px ${X.selectGlow};display:none`;
401
889
  let r = document.createElement("div");
402
- return r.style.cssText = `position:fixed;pointer-events:none;z-index:${K.label};background:${q.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`, {
890
+ return r.style.cssText = `position:fixed;pointer-events:none;z-index:${gt.label};background:${X.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`, {
403
891
  overlay: e,
404
892
  label: t,
405
893
  ring: n,
406
894
  ringLabel: r
407
895
  };
408
- }, Re = (e, t, n) => {
896
+ }, Ot = (e, t, n) => {
409
897
  let r = n.getBoundingClientRect();
410
- 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 = Fe(n), t.style.left = `${Math.max(4, r.left)}px`, t.style.top = `${r.top > 26 ? r.top - 22 : r.bottom + 4}px`;
411
- }, ze = (e) => {
898
+ 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 = Tt(n), t.style.left = `${Math.max(4, r.left)}px`, t.style.top = `${r.top > 26 ? r.top - 22 : r.bottom + 4}px`;
899
+ }, kt = (e) => {
412
900
  let t = (e instanceof Element ? e : null)?.closest("a[href]");
413
901
  if (!t || t.target === "_blank") return null;
414
902
  let n;
@@ -418,11 +906,11 @@ var B = (e) => [
418
906
  return null;
419
907
  }
420
908
  return n.protocol !== "http:" && n.protocol !== "https:" || n.origin === location.origin ? null : n.href;
421
- }, Be = (e) => {
909
+ }, At = (e) => {
422
910
  if (!e) return !1;
423
911
  let t = e.tagName;
424
912
  return t === "INPUT" || t === "TEXTAREA" || t === "SELECT" || e.isContentEditable === !0;
425
- }, Ve = (e) => {
913
+ }, jt = (e) => {
426
914
  if (!e.childNodes.length) return !1;
427
915
  let t = !1;
428
916
  for (let n of e.childNodes) {
@@ -430,10 +918,10 @@ var B = (e) => [
430
918
  (n.textContent ?? "").trim() && (t = !0);
431
919
  }
432
920
  return t;
433
- }, He = 2e3, Ue = (e) => {
921
+ }, Mt = 2e3, Nt = (e) => {
434
922
  let t = [], n = e;
435
923
  for (; n && n.nodeType === 1 && n !== document.body && t.length < 8;) {
436
- let e = J(n);
924
+ let e = Z(n);
437
925
  e && t.unshift({
438
926
  tag: n.tagName.toLowerCase(),
439
927
  text: (n.textContent || "").trim().slice(0, 60),
@@ -441,25 +929,25 @@ var B = (e) => [
441
929
  }), n = n.parentElement;
442
930
  }
443
931
  return t;
444
- }, We = (e) => {
445
- let t = J(e), n = t ? Oe(t).length : 1, r = t ? ke(e, t) : 0, i = t && Ve(e) ? (e.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, He) : void 0, a = Ge(e);
932
+ }, Pt = (e) => {
933
+ let t = Z(e), n = t ? _t(t).length : 1, r = t ? vt(e, t) : 0, i = t && jt(e) ? (e.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, Mt) : void 0, a = Ft(e);
446
934
  return {
447
935
  tag: e.tagName.toLowerCase(),
448
936
  classes: typeof e.className == "string" ? e.className.trim() : "",
449
937
  text: (e.innerText || "").trim().slice(0, 120),
450
- label: Fe(e),
451
- path: Ie(e),
938
+ label: Tt(e),
939
+ path: Et(e),
452
940
  source: t,
453
941
  index: r,
454
942
  occurrences: n,
455
- ancestors: Ue(e),
943
+ ancestors: Nt(e),
456
944
  ...i === void 0 ? {} : { fullText: i },
457
945
  ...a ? { sourceBinding: a } : {}
458
946
  };
459
- }, Ge = (e) => {
947
+ }, Ft = (e) => {
460
948
  let t = e.closest("[data-levo-source]");
461
949
  if (!t) return;
462
- let n = t.getAttribute("data-levo-source") ?? "", r = J(t), i;
950
+ let n = t.getAttribute("data-levo-source") ?? "", r = Z(t), i;
463
951
  try {
464
952
  i = JSON.parse(n);
465
953
  } catch {
@@ -469,12 +957,12 @@ var B = (e) => [
469
957
  raw: n,
470
958
  element: {
471
959
  source: r ?? "",
472
- index: r ? ke(t, r) : 0
960
+ index: r ? vt(t, r) : 0
473
961
  },
474
962
  ...i === void 0 ? {} : { config: i }
475
963
  };
476
- }, Ke = () => Array.from(document.querySelectorAll("[data-levo-source]")).map((e) => {
477
- let t = e.getAttribute("data-levo-source") ?? "", n = J(e), r;
964
+ }, It = () => Array.from(document.querySelectorAll("[data-levo-source]")).map((e) => {
965
+ let t = e.getAttribute("data-levo-source") ?? "", n = Z(e), r;
478
966
  try {
479
967
  r = JSON.parse(t);
480
968
  } catch {
@@ -484,21 +972,21 @@ var B = (e) => [
484
972
  raw: t,
485
973
  element: {
486
974
  source: n ?? "",
487
- index: n ? ke(e, n) : 0
975
+ index: n ? vt(e, n) : 0
488
976
  },
489
977
  tag: e.tagName.toLowerCase(),
490
- label: Fe(e),
978
+ label: Tt(e),
491
979
  ...r === void 0 ? {} : { config: r }
492
980
  };
493
- }), qe = 14, Je = 2e3, Ye = 100, Xe = 48, Ze = new Set([
981
+ }), Lt = 14, Rt = 2e3, zt = 100, Bt = 48, Vt = new Set([
494
982
  "script",
495
983
  "style",
496
984
  "template",
497
985
  "noscript"
498
- ]), Qe = (e, t) => t.includes(e) || e.id === "studio-staged" || Ze.has(e.tagName.toLowerCase()), $e = (e) => {
986
+ ]), Ht = (e, t) => t.includes(e) || e.id === "studio-staged" || Vt.has(e.tagName.toLowerCase()), Ut = (e) => {
499
987
  let t = !1, n = 0, r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
500
988
  for (let e of Array.from(document.querySelectorAll("[data-tsd-source]"))) {
501
- let t = J(e);
989
+ let t = Z(e);
502
990
  if (!t) continue;
503
991
  let n = i.get(t) ?? 0;
504
992
  r.set(e, n), i.set(t, n + 1);
@@ -507,11 +995,11 @@ var B = (e) => [
507
995
  for (let t of e.childNodes) {
508
996
  if (t.nodeType !== 3) continue;
509
997
  let e = (t.textContent ?? "").replace(/\s+/g, " ").trim();
510
- if (e) return e.length > Xe ? `${e.slice(0, Xe).trimEnd()}…` : e;
998
+ if (e) return e.length > Bt ? `${e.slice(0, Bt).trimEnd()}…` : e;
511
999
  }
512
1000
  }, o = (i, s) => {
513
1001
  n++;
514
- let c = J(i), l = a(i), u = Array.from(i.children).filter((t) => !Qe(t, e)), d = {
1002
+ let c = Z(i), l = a(i), u = Array.from(i.children).filter((t) => !Ht(t, e)), d = {
515
1003
  tag: i.tagName.toLowerCase(),
516
1004
  ...c ? {
517
1005
  source: c,
@@ -522,9 +1010,9 @@ var B = (e) => [
522
1010
  childCount: u.length,
523
1011
  children: []
524
1012
  };
525
- if (s >= qe) return u.length && (t = !0), d;
1013
+ if (s >= Lt) return u.length && (t = !0), d;
526
1014
  for (let e of u) {
527
- if (d.children.length >= Ye || n >= Je) {
1015
+ if (d.children.length >= zt || n >= Rt) {
528
1016
  t = !0;
529
1017
  break;
530
1018
  }
@@ -536,7 +1024,7 @@ var B = (e) => [
536
1024
  tree: o(document.body, 0),
537
1025
  truncated: t
538
1026
  };
539
- }, et = () => {
1027
+ }, Wt = () => {
540
1028
  let e = null;
541
1029
  return {
542
1030
  send: (t) => {
@@ -551,7 +1039,7 @@ var B = (e) => [
551
1039
  return !0;
552
1040
  }
553
1041
  };
554
- }, tt = (e) => {
1042
+ }, Gt = (e) => {
555
1043
  let t = location.pathname, n = () => {
556
1044
  location.pathname !== t && (t = location.pathname, e.onPathChange());
557
1045
  }, r = !1;
@@ -571,7 +1059,7 @@ var B = (e) => [
571
1059
  e.__inspectorPatched && e.__orig && (history.pushState = e.__orig), t.__inspectorPatched && t.__orig && (history.replaceState = t.__orig);
572
1060
  }
573
1061
  } };
574
- }, nt = (e) => {
1062
+ }, Kt = (e) => {
575
1063
  let { channel: t, originals: n, staged: r } = e, i = t.send, a = null;
576
1064
  return { onMessage: (o) => {
577
1065
  let s = o.data;
@@ -579,7 +1067,7 @@ var B = (e) => [
579
1067
  if (s.type === "set-inspect") e.setInspect(s.enabled);
580
1068
  else if (s.type === "set-text-edit") e.setTextEdit(s.enabled);
581
1069
  else if (s.type === "revert-text") {
582
- 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 : Y(e, t);
1070
+ 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 : yt(e, t);
583
1071
  i && r != null && (i.textContent = r);
584
1072
  } else if (s.type === "stage-style") {
585
1073
  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;
@@ -638,7 +1126,7 @@ var B = (e) => [
638
1126
  }
639
1127
  e.syncDomObserver();
640
1128
  } else if (s.type === "select-element") {
641
- let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? Y(t, n) : null;
1129
+ let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? yt(t, n) : null;
642
1130
  if (!r) {
643
1131
  i({
644
1132
  type: "select-miss",
@@ -654,10 +1142,10 @@ var B = (e) => [
654
1142
  behavior: "smooth"
655
1143
  }), i({
656
1144
  type: "element-selected",
657
- element: We(r)
1145
+ element: Pt(r)
658
1146
  });
659
1147
  } else if (s.type === "edit-element") {
660
- let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? Y(t, n) : null;
1148
+ let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? yt(t, n) : null;
661
1149
  if (!r) {
662
1150
  i({
663
1151
  type: "select-miss",
@@ -673,12 +1161,12 @@ var B = (e) => [
673
1161
  behavior: "smooth"
674
1162
  }), i({
675
1163
  type: "element-selected",
676
- element: We(r)
1164
+ element: Pt(r)
677
1165
  }), e.isTextEditing() || e.setTextEdit(!0);
678
1166
  let o = e.editableTarget(r);
679
1167
  o && e.startEditAtEnd(o);
680
1168
  } else if (s.type === "highlight-element") {
681
- let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? Y(t, n) : null;
1169
+ let t = String(s.element?.source || ""), n = Number.isInteger(s.element?.index) ? s.element.index : 0, r = t ? yt(t, n) : null;
682
1170
  if (!r) a = null, e.hideTextHover(), i({
683
1171
  type: "highlight-miss",
684
1172
  element: {
@@ -696,7 +1184,7 @@ var B = (e) => [
696
1184
  }
697
1185
  } else if (s.type === "clear-highlight") a && (a = null, !e.isInspecting() && !e.editingNode() && e.hideTextHover());
698
1186
  else if (s.type === "request-layers") {
699
- let { tree: t, truncated: n } = $e(e.ownNodes);
1187
+ let { tree: t, truncated: n } = Ut(e.ownNodes);
700
1188
  i({
701
1189
  type: "layers-tree",
702
1190
  tree: t,
@@ -704,7 +1192,7 @@ var B = (e) => [
704
1192
  });
705
1193
  } else if (s.type === "request-sources") i({
706
1194
  type: "sources-list",
707
- sources: Ke()
1195
+ sources: It()
708
1196
  });
709
1197
  else if (s.type === "capture-selected") {
710
1198
  let t = String(s.requestId || "");
@@ -719,7 +1207,7 @@ var B = (e) => [
719
1207
  });
720
1208
  return;
721
1209
  }
722
- Ce(n, e.ownNodes).then((e) => {
1210
+ dt(n, e.ownNodes).then((e) => {
723
1211
  console.info(`[levo-inspector] element capture ok <${n.tagName.toLowerCase()}> (${Math.round(e.length / 1024)}kB)`), i({
724
1212
  type: "capture-result",
725
1213
  requestId: t,
@@ -740,7 +1228,7 @@ var B = (e) => [
740
1228
  }
741
1229
  }
742
1230
  } };
743
- }, rt = () => {
1231
+ }, qt = () => {
744
1232
  let e = /* @__PURE__ */ new Map(), t = () => {
745
1233
  if (e.size > 50) {
746
1234
  let t = e.keys().next().value;
@@ -760,31 +1248,31 @@ var B = (e) => [
760
1248
  return e.delete(t), n;
761
1249
  }
762
1250
  };
763
- }, it = 6, at = 12, ot = 12, st = .6, ct = (e, t, n, r) => ({
1251
+ }, Jt = 6, Yt = 12, Xt = 12, Zt = .6, Qt = (e, t, n, r) => ({
764
1252
  x: Math.min(e, n),
765
1253
  y: Math.min(t, r),
766
1254
  width: Math.abs(n - e),
767
1255
  height: Math.abs(r - t)
768
- }), lt = (e, t) => {
1256
+ }), $t = (e, t) => {
769
1257
  let n = e.x + e.width, r = e.y + e.height, i = [];
770
1258
  for (let a of Array.from(document.querySelectorAll("[data-tsd-source]"))) {
771
1259
  if (t.includes(a)) continue;
772
1260
  let o = a.getBoundingClientRect(), s = o.width * o.height;
773
- 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 >= st && i.push(a);
1261
+ 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 >= Zt && i.push(a);
774
1262
  }
775
1263
  let a = new Set(i), o = i.filter((e) => {
776
1264
  for (let t = e.parentElement; t; t = t.parentElement) if (a.has(t)) return !1;
777
1265
  return !0;
778
- }), s = o.length > ot, c = [], l = [];
779
- for (let e of o.slice(0, ot)) {
780
- let t = J(e);
1266
+ }), s = o.length > Xt, c = [], l = [];
1267
+ for (let e of o.slice(0, Xt)) {
1268
+ let t = Z(e);
781
1269
  if (!t) continue;
782
1270
  let n = (e.innerText || "").replace(/\s+/g, " ").trim().slice(0, 80);
783
1271
  c.push({
784
1272
  source: t,
785
- index: ke(e, t),
1273
+ index: vt(e, t),
786
1274
  tag: e.tagName.toLowerCase(),
787
- label: Fe(e),
1275
+ label: Tt(e),
788
1276
  ...n ? { text: n } : {}
789
1277
  }), l.push(e);
790
1278
  }
@@ -793,12 +1281,12 @@ var B = (e) => [
793
1281
  nodes: l,
794
1282
  truncated: s
795
1283
  };
796
- }, ut = () => Array.from({ length: ot }, () => {
1284
+ }, en = () => Array.from({ length: Xt }, () => {
797
1285
  let e = document.createElement("div");
798
- return e.style.cssText = `position:fixed;pointer-events:none;z-index:${K.ring};outline:1.5px solid ${q.select};outline-offset:1px;border-radius:3px;box-shadow:0 0 0 3px ${q.selectGlow};display:none`, e;
799
- }), dt = () => {
1286
+ return e.style.cssText = `position:fixed;pointer-events:none;z-index:${gt.ring};outline:1.5px solid ${X.select};outline-offset:1px;border-radius:3px;box-shadow:0 0 0 3px ${X.selectGlow};display:none`, e;
1287
+ }), tn = () => {
800
1288
  let e = document.createElement("div");
801
- e.style.cssText = `position:fixed;pointer-events:none;z-index:${K.overlay};border:1.5px dashed ${q.select};background:${q.selectGlow};border-radius:2px;display:none`;
1289
+ e.style.cssText = `position:fixed;pointer-events:none;z-index:${gt.overlay};border:1.5px dashed ${X.select};background:${X.selectGlow};border-radius:2px;display:none`;
802
1290
  let t = null, n = !1, r = 0, i = 0, a = () => {
803
1291
  e.style.display = "none";
804
1292
  };
@@ -813,31 +1301,31 @@ var B = (e) => [
813
1301
  pointerMove: (a, o) => {
814
1302
  if (!t) return;
815
1303
  if (a = Math.min(Math.max(0, a), window.innerWidth), o = Math.min(Math.max(0, o), window.innerHeight), r = a, i = o, !n) {
816
- if (Math.abs(a - t.x) < it && Math.abs(o - t.y) < it) return;
1304
+ if (Math.abs(a - t.x) < Jt && Math.abs(o - t.y) < Jt) return;
817
1305
  n = !0;
818
1306
  }
819
- let s = ct(t.x, t.y, a, o);
1307
+ let s = Qt(t.x, t.y, a, o);
820
1308
  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`;
821
1309
  },
822
1310
  pointerUp: () => {
823
1311
  let e = n, o = t;
824
1312
  if (t = null, n = !1, a(), !e || !o) return null;
825
- let s = ct(o.x, o.y, r, i);
826
- return s.width < at || s.height < at ? null : s;
1313
+ let s = Qt(o.x, o.y, r, i);
1314
+ return s.width < Yt || s.height < Yt ? null : s;
827
1315
  },
828
1316
  cancel: () => {
829
1317
  t = null, n = !1, a();
830
1318
  },
831
1319
  isDragging: () => n
832
1320
  };
833
- }, ft = (e) => {
1321
+ }, nn = (e) => {
834
1322
  let { originals: t, editingNode: n } = e, r = /* @__PURE__ */ new Map(), i = () => {
835
1323
  let e = document.getElementById("studio-staged");
836
1324
  return e || (e = document.createElement("style"), e.id = "studio-staged", document.head.appendChild(e)), e;
837
1325
  }, a = () => {
838
1326
  let e = [];
839
1327
  for (let [t, n] of r) if (n.kind === "style") {
840
- let r = Me(t, n);
1328
+ let r = St(t, n);
841
1329
  r && e.push(r);
842
1330
  }
843
1331
  let t = e.join("\n");
@@ -845,8 +1333,8 @@ var B = (e) => [
845
1333
  let n = i();
846
1334
  n.textContent !== t && (n.textContent = t);
847
1335
  }, o = (e, r) => {
848
- let i = Y(r.source, r.index);
849
- if (i) if (r.kind === "style") Ae(i, e);
1336
+ let i = yt(r.source, r.index);
1337
+ if (i) if (r.kind === "style") bt(i, e);
850
1338
  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");
851
1339
  else {
852
1340
  if (i === n()) return;
@@ -859,8 +1347,8 @@ var B = (e) => [
859
1347
  let n = r.get(e);
860
1348
  if (!n) return;
861
1349
  r.delete(e);
862
- let i = Y(n.source, n.index);
863
- if (n.kind === "style") i && je(i, e), a();
1350
+ let i = yt(n.source, n.index);
1351
+ if (n.kind === "style") i && xt(i, e), a();
864
1352
  else if (n.kind === "image") {
865
1353
  let e = t.restore(`${n.source}#${n.index}:src`), r = t.restore(`${n.source}#${n.index}:srcset`);
866
1354
  i && (e != null && (e ? i.setAttribute("src", e) : i.removeAttribute("src")), r != null && (r ? i.setAttribute("srcset", r) : i.removeAttribute("srcset")));
@@ -889,7 +1377,7 @@ var B = (e) => [
889
1377
  for (let e of Array.from(document.querySelectorAll("[data-staged-key]"))) e.removeAttribute("data-staged-key");
890
1378
  }
891
1379
  };
892
- }, pt = (e) => {
1380
+ }, rn = (e) => {
893
1381
  let { channel: t, originals: n, clearTextHover: r } = e, i = null, a = "", o = 0, s = (() => {
894
1382
  try {
895
1383
  let e = document.createElement("div");
@@ -908,15 +1396,15 @@ var B = (e) => [
908
1396
  n.selectNodeContents(e), n.collapse(!1), t.removeAllRanges(), t.addRange(n);
909
1397
  }, d = (e, t = !1) => {
910
1398
  if (i === e) return;
911
- i && p(i), i = e, a = J(e) || "", o = ke(e, a), r(), n.capture(`${a}#${o}`, e.textContent ?? ""), e.setAttribute("contenteditable", s ? "plaintext-only" : "true");
1399
+ i && p(i), i = e, a = Z(e) || "", o = vt(e, a), r(), n.capture(`${a}#${o}`, e.textContent ?? ""), e.setAttribute("contenteditable", s ? "plaintext-only" : "true");
912
1400
  let d = e;
913
- d.style.outline = `2px solid ${q.hover}`, d.style.outlineOffset = "3px", d.style.borderRadius = "3px", d.focus(), t && u(e), d.addEventListener("blur", c, !0), d.addEventListener("keydown", l, !0);
1401
+ d.style.outline = `2px solid ${X.hover}`, d.style.outlineOffset = "3px", d.style.borderRadius = "3px", d.focus(), t && u(e), d.addEventListener("blur", c, !0), d.addEventListener("keydown", l, !0);
914
1402
  }, f = (e) => {
915
1403
  e.removeAttribute("contenteditable");
916
1404
  let t = e;
917
1405
  t.style.outline = "", t.style.outlineOffset = "", t.style.borderRadius = "", t.removeEventListener("blur", c, !0), t.removeEventListener("keydown", l, !0), i = null;
918
1406
  }, p = (e) => {
919
- let r = J(e), i = o, s = n.get(`${a}#${o}`);
1407
+ let r = Z(e), i = o, s = n.get(`${a}#${o}`);
920
1408
  f(e);
921
1409
  let c = (e.textContent ?? "").replace(/\s+/g, " ").trim();
922
1410
  t.send({
@@ -927,7 +1415,7 @@ var B = (e) => [
927
1415
  tag: e.tagName.toLowerCase(),
928
1416
  value: c,
929
1417
  previous: s,
930
- occurrences: r ? Oe(r).length : 1
1418
+ occurrences: r ? _t(r).length : 1
931
1419
  }
932
1420
  });
933
1421
  }, m = (e) => {
@@ -946,16 +1434,16 @@ var B = (e) => [
946
1434
  i && f(i);
947
1435
  }
948
1436
  };
949
- }, mt = "2026-07-24g · element-capture + region-drag + region-highlights (stale-region guard)";
950
- function ht() {
951
- return f(() => gt(), []), null;
1437
+ }, an = "2026-07-24g · element-capture + region-drag + region-highlights (stale-region guard)";
1438
+ function on() {
1439
+ return v(() => sn(), []), null;
952
1440
  }
953
- function gt() {
954
- let e = !1, t = null, n = null, r = !1, i = null, a = rt(), o = et(), { overlay: s, label: c, ring: l, ringLabel: u } = Le();
1441
+ function sn() {
1442
+ let e = !1, t = null, n = null, r = !1, i = null, a = qt(), o = Wt(), { overlay: s, label: c, ring: l, ringLabel: u } = Dt();
955
1443
  document.body.append(s, c, l, u);
956
- let d = dt();
1444
+ let d = tn();
957
1445
  document.body.append(d.node);
958
- let f = ut();
1446
+ let f = en();
959
1447
  document.body.append(...f);
960
1448
  let p = [
961
1449
  s,
@@ -984,21 +1472,21 @@ function gt() {
984
1472
  e && !b ? (b = document.createElement("style"), b.id = "studio-pick-cursor", b.textContent = "*,*::before,*::after{cursor:crosshair !important}", document.head.appendChild(b)) : !e && b && (b.remove(), b = null);
985
1473
  }, S = (e) => !e || p.includes(e) || e === document.body || e === document.documentElement, C = (e) => {
986
1474
  if (!e || S(e)) return null;
987
- let t = J(e) ? e : e.closest("[data-tsd-source]");
988
- return !t || S(t) || !Ve(t) ? null : t;
989
- }, w = (e) => Re(s, c, e), T = () => {
1475
+ let t = Z(e) ? e : e.closest("[data-tsd-source]");
1476
+ return !t || S(t) || !jt(t) ? null : t;
1477
+ }, w = (e) => Ot(s, c, e), T = () => {
990
1478
  if (n) {
991
1479
  if (!n.isConnected) {
992
- ne();
1480
+ j();
993
1481
  return;
994
1482
  }
995
- Re(l, u, n);
1483
+ Ot(l, u, n);
996
1484
  }
997
1485
  }, E = 0, D = () => {
998
1486
  E || !n || r || (E = requestAnimationFrame(() => {
999
1487
  E = 0, T();
1000
1488
  }));
1001
- }, O = new ResizeObserver(D), k = new MutationObserver((e) => {
1489
+ }, O = new ResizeObserver(D), ee = new MutationObserver((e) => {
1002
1490
  for (let t of e) {
1003
1491
  let e = t.target;
1004
1492
  if (!p.some((t) => t === e) && !(t.type === "attributes" && t.attributeName === "data-staged-key")) {
@@ -1006,34 +1494,34 @@ function gt() {
1006
1494
  return;
1007
1495
  }
1008
1496
  }
1009
- }), A = !1, ee = () => {
1010
- A ||= (k.observe(document.documentElement, {
1497
+ }), k = !1, te = () => {
1498
+ k ||= (ee.observe(document.documentElement, {
1011
1499
  attributes: !0,
1012
1500
  childList: !0,
1013
1501
  characterData: !0,
1014
1502
  subtree: !0
1015
1503
  }), !0);
1016
- }, j = () => {
1017
- A &&= (k.disconnect(), !1);
1018
- }, te = () => {
1019
- O.disconnect(), n?.isConnected && (O.observe(n), ee());
1504
+ }, A = () => {
1505
+ k &&= (ee.disconnect(), !1);
1020
1506
  }, ne = () => {
1507
+ O.disconnect(), n?.isConnected && (O.observe(n), te());
1508
+ }, j = () => {
1021
1509
  n = null, O.disconnect(), ie(), E &&= (cancelAnimationFrame(E), 0), l.style.display = "none", u.style.display = "none", y(), g();
1022
1510
  }, re = (e) => w(e), M = () => {
1023
1511
  s.style.display = "none", c.style.display = "none";
1024
- }, N = pt({
1512
+ }, N = rn({
1025
1513
  channel: o,
1026
1514
  originals: a,
1027
1515
  clearTextHover: () => {
1028
1516
  i = null, M();
1029
1517
  }
1030
- }), P = ft({
1518
+ }), P = nn({
1031
1519
  originals: a,
1032
1520
  editingNode: N.editingNode
1033
1521
  }), ie = () => {
1034
- n?.isConnected || P.count() ? ee() : j();
1522
+ n?.isConnected || P.count() ? te() : A();
1035
1523
  }, F = (n) => {
1036
- n && r && I(!1), e = !!n, x(e), e || (t = null, s.style.display = "none", c.style.display = "none", U()), o.send({
1524
+ n && r && I(!1), e = !!n, x(e), e || (t = null, s.style.display = "none", c.style.display = "none", G()), o.send({
1037
1525
  type: "inspect-state",
1038
1526
  enabled: e
1039
1527
  });
@@ -1046,9 +1534,9 @@ function gt() {
1046
1534
  type: "text-edit-state",
1047
1535
  enabled: r
1048
1536
  });
1049
- }, L = 0, ae = 0, oe = 0, se = () => {
1537
+ }, L = 0, ae = 0, R = 0, z = () => {
1050
1538
  L = 0;
1051
- let n = document.elementFromPoint(ae, oe);
1539
+ let n = document.elementFromPoint(ae, R);
1052
1540
  if (!S(n)) {
1053
1541
  if (r) {
1054
1542
  let e = C(n);
@@ -1061,47 +1549,47 @@ function gt() {
1061
1549
  }
1062
1550
  e && (d.isDragging() || (t = n, n && w(n)));
1063
1551
  }
1064
- }, R = (t) => {
1065
- !e && !r || (ae = t.clientX, oe = t.clientY, L ||= requestAnimationFrame(se));
1066
- }, z = 0, ce = () => {
1067
- z = 0, e && t && w(t), r && !N.editingNode() && i?.isConnected && re(i), n && !r && T(), m.length > 0 && !r && _();
1068
- }, le = () => {
1069
- z ||= requestAnimationFrame(ce);
1070
- }, ue = (n) => {
1552
+ }, oe = (t) => {
1553
+ !e && !r || (ae = t.clientX, R = t.clientY, L ||= requestAnimationFrame(z));
1554
+ }, B = 0, V = () => {
1555
+ B = 0, e && t && w(t), r && !N.editingNode() && i?.isConnected && re(i), n && !r && T(), m.length > 0 && !r && _();
1556
+ }, se = () => {
1557
+ B ||= requestAnimationFrame(V);
1558
+ }, H = (n) => {
1071
1559
  n.relatedTarget || (e ? (t = null, s.style.display = "none", c.style.display = "none") : r && !N.editingNode() && (i = null, M(), document.documentElement.style.cursor = ""));
1072
- }, B = !1, V = null, H = () => {
1073
- if (V != null) {
1560
+ }, U = !1, W = null, ce = () => {
1561
+ if (W != null) {
1074
1562
  try {
1075
- document.documentElement.releasePointerCapture(V);
1563
+ document.documentElement.releasePointerCapture(W);
1076
1564
  } catch {}
1077
- V = null;
1565
+ W = null;
1078
1566
  }
1079
- }, U = () => {
1080
- H(), d.cancel();
1081
- }, W = (t) => {
1082
- !e || t.button !== 0 || !t.isPrimary || (B = !1, d.pointerDown(t.clientX, t.clientY));
1083
- }, de = (n) => {
1567
+ }, G = () => {
1568
+ ce(), d.cancel();
1569
+ }, le = (t) => {
1570
+ !e || t.button !== 0 || !t.isPrimary || (U = !1, d.pointerDown(t.clientX, t.clientY));
1571
+ }, K = (n) => {
1084
1572
  if (!e || !n.isPrimary) return;
1085
1573
  let r = d.isDragging();
1086
1574
  if (d.pointerMove(n.clientX, n.clientY), d.isDragging()) {
1087
1575
  if (!r) {
1088
- V = n.pointerId;
1576
+ W = n.pointerId;
1089
1577
  try {
1090
1578
  document.documentElement.setPointerCapture(n.pointerId);
1091
1579
  } catch {}
1092
1580
  }
1093
1581
  t = null, s.style.display = "none", c.style.display = "none";
1094
1582
  }
1095
- }, fe = (t) => {
1583
+ }, ue = (t) => {
1096
1584
  if (!e || !t.isPrimary) return;
1097
- H();
1585
+ ce();
1098
1586
  let n = d.pointerUp();
1099
1587
  if (!n) return;
1100
- B = !0, ne();
1101
- let { elements: r, nodes: i, truncated: a } = lt(n, p);
1588
+ U = !0, j();
1589
+ let { elements: r, nodes: i, truncated: a } = $t(n, p);
1102
1590
  console.info(`[levo-inspector] region drag: ${Math.round(n.width)}×${Math.round(n.height)} — ${r.length} element(s)${a ? " (truncated)" : ""}`), v(i);
1103
1591
  let s = ++h;
1104
- De(n, p).then((e) => {
1592
+ ht(n, p).then((e) => {
1105
1593
  s === h && (console.info(`[levo-inspector] region capture ok (${Math.round(e.length / 1024)}kB)`), o.send({
1106
1594
  type: "region-selected",
1107
1595
  rect: n,
@@ -1118,36 +1606,36 @@ function gt() {
1118
1606
  dataUrl: null
1119
1607
  }));
1120
1608
  });
1121
- }, pe = () => U(), me = (e) => {
1122
- let t = ze(e.target);
1609
+ }, q = () => G(), de = (e) => {
1610
+ let t = kt(e.target);
1123
1611
  return t ? (e.preventDefault(), e.stopPropagation(), window.open(t, "_blank", "noopener,noreferrer"), !0) : !1;
1124
- }, G = (i) => {
1125
- if (B) {
1126
- B = !1, i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation();
1612
+ }, fe = (i) => {
1613
+ if (U) {
1614
+ U = !1, i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation();
1127
1615
  return;
1128
1616
  }
1129
1617
  if (r) {
1130
1618
  let e = C(document.elementFromPoint(i.clientX, i.clientY) || i.target);
1131
1619
  if (!e || e === N.editingNode()) {
1132
- me(i);
1620
+ de(i);
1133
1621
  return;
1134
1622
  }
1135
1623
  i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation(), N.startEdit(e);
1136
1624
  return;
1137
1625
  }
1138
1626
  if (!e) {
1139
- me(i);
1627
+ de(i);
1140
1628
  return;
1141
1629
  }
1142
1630
  i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation();
1143
1631
  let a = t || i.target;
1144
1632
  if (S(a)) return;
1145
1633
  let s = a.closest("[data-tsd-source]") || a;
1146
- y(), g(), n = s, T(), te(), o.send({
1634
+ y(), g(), n = s, T(), ne(), o.send({
1147
1635
  type: "element-selected",
1148
- element: We(s)
1636
+ element: Pt(s)
1149
1637
  });
1150
- }, he = nt({
1638
+ }, pe = Kt({
1151
1639
  channel: o,
1152
1640
  originals: a,
1153
1641
  staged: P,
@@ -1157,18 +1645,18 @@ function gt() {
1157
1645
  isTextEditing: () => r,
1158
1646
  editingNode: N.editingNode,
1159
1647
  setSelected: (e) => {
1160
- y(), g(), n = e, te();
1648
+ y(), g(), n = e, ne();
1161
1649
  },
1162
1650
  selectedNode: () => n,
1163
1651
  positionSelected: T,
1164
- clearSelection: ne,
1652
+ clearSelection: j,
1165
1653
  syncDomObserver: ie,
1166
1654
  positionHover: w,
1167
1655
  hideTextHover: M,
1168
1656
  startEditAtEnd: (e) => N.startEdit(e, !0),
1169
1657
  editableTarget: C,
1170
1658
  ownNodes: p
1171
- }), ge = [
1659
+ }), me = [
1172
1660
  "mousedown",
1173
1661
  "mouseup",
1174
1662
  "dblclick",
@@ -1186,95 +1674,98 @@ function gt() {
1186
1674
  "touchstart",
1187
1675
  "touchend",
1188
1676
  "submit"
1189
- ], _e = (t) => {
1677
+ ], he = (t) => {
1190
1678
  e && (t.cancelable && t.preventDefault(), t.stopPropagation(), t.stopImmediatePropagation());
1191
- }, ve = () => {
1679
+ }, ge = () => {
1192
1680
  n && !r && T(), m.length > 0 && !r && _();
1193
- }, ye = () => {
1681
+ }, _e = () => {
1194
1682
  let e = location.pathname.replace(/\/$/, "") || "/";
1195
1683
  o.send({
1196
1684
  type: "route",
1197
1685
  route: e
1198
1686
  });
1199
- }, be = tt({ onPathChange: () => {
1200
- ne(), ye();
1201
- } }), xe = (t) => {
1687
+ }, ve = Gt({ onPathChange: () => {
1688
+ j(), _e();
1689
+ } }), ye = (t) => {
1202
1690
  if (N.editingNode()) return;
1203
1691
  if (t.key === "Escape") {
1204
1692
  if (e && d.isDragging()) {
1205
- t.stopPropagation(), U();
1693
+ t.stopPropagation(), G();
1206
1694
  return;
1207
1695
  }
1208
1696
  r ? (t.stopPropagation(), I(!1)) : e && (t.stopPropagation(), F(!1));
1209
1697
  return;
1210
1698
  }
1211
- if (t.metaKey || t.ctrlKey || t.altKey || t.shiftKey || t.repeat || Be(document.activeElement)) return;
1699
+ if (t.metaKey || t.ctrlKey || t.altKey || t.shiftKey || t.repeat || At(document.activeElement)) return;
1212
1700
  let n = t.key.toLowerCase();
1213
1701
  n === "s" ? (t.preventDefault(), t.stopPropagation(), F(!e)) : n === "t" && (t.preventDefault(), t.stopPropagation(), I(!r));
1214
1702
  };
1215
- window.addEventListener("mousemove", R, !0), window.addEventListener("scroll", le, !0), window.addEventListener("resize", ve), window.addEventListener("click", G, !0), window.addEventListener("keydown", xe, !0), window.addEventListener("message", he.onMessage), window.addEventListener("mouseout", ue, !0), window.addEventListener("pointerdown", W, !0), window.addEventListener("pointermove", de, !0), window.addEventListener("pointerup", fe, !0), window.addEventListener("pointercancel", pe, !0);
1216
- for (let e of ge) window.addEventListener(e, _e, !0);
1217
- return console.info(`[levo-inspector] build ${mt} — runtime mounted`), ye(), o.send({ type: "ready" }), () => {
1218
- window.removeEventListener("mousemove", R, !0), window.removeEventListener("keydown", xe, !0), window.removeEventListener("scroll", le, !0), window.removeEventListener("resize", ve), window.removeEventListener("mouseout", ue, !0), window.removeEventListener("pointerdown", W, !0), window.removeEventListener("pointermove", de, !0), window.removeEventListener("pointerup", fe, !0), window.removeEventListener("pointercancel", pe, !0), window.removeEventListener("click", G, !0), window.removeEventListener("message", he.onMessage);
1219
- for (let e of ge) window.removeEventListener(e, _e, !0);
1220
- O.disconnect(), k.disconnect(), E && cancelAnimationFrame(E), L && cancelAnimationFrame(L), z && cancelAnimationFrame(z), P.teardown(), be.teardown(), N.teardown(), document.documentElement.style.cursor = "", b?.remove(), s.remove(), c.remove(), l.remove(), u.remove(), U(), d.node.remove();
1703
+ window.addEventListener("mousemove", oe, !0), window.addEventListener("scroll", se, !0), window.addEventListener("resize", ge), window.addEventListener("click", fe, !0), window.addEventListener("keydown", ye, !0), window.addEventListener("message", pe.onMessage), window.addEventListener("mouseout", H, !0), window.addEventListener("pointerdown", le, !0), window.addEventListener("pointermove", K, !0), window.addEventListener("pointerup", ue, !0), window.addEventListener("pointercancel", q, !0);
1704
+ for (let e of me) window.addEventListener(e, he, !0);
1705
+ return console.info(`[levo-inspector] build ${an} — runtime mounted`), _e(), o.send({ type: "ready" }), () => {
1706
+ window.removeEventListener("mousemove", oe, !0), window.removeEventListener("keydown", ye, !0), window.removeEventListener("scroll", se, !0), window.removeEventListener("resize", ge), window.removeEventListener("mouseout", H, !0), window.removeEventListener("pointerdown", le, !0), window.removeEventListener("pointermove", K, !0), window.removeEventListener("pointerup", ue, !0), window.removeEventListener("pointercancel", q, !0), window.removeEventListener("click", fe, !0), window.removeEventListener("message", pe.onMessage);
1707
+ for (let e of me) window.removeEventListener(e, he, !0);
1708
+ O.disconnect(), ee.disconnect(), E && cancelAnimationFrame(E), L && cancelAnimationFrame(L), B && cancelAnimationFrame(B), P.teardown(), ve.teardown(), N.teardown(), document.documentElement.style.cursor = "", b?.remove(), s.remove(), c.remove(), l.remove(), u.remove(), G(), d.node.remove();
1221
1709
  for (let e of f) e.remove();
1222
1710
  };
1223
1711
  }
1224
1712
  //#endregion
1225
1713
  //#region src/pageId.ts
1226
- var _t = "levo:page-id", vt = () => {
1714
+ var cn = "levo:page-id", ln = () => {
1227
1715
  if (typeof document > "u") return null;
1228
- let e = document.querySelectorAll(`meta[name="${_t}"]`);
1716
+ let e = document.querySelectorAll(`meta[name="${cn}"]`);
1229
1717
  return e[e.length - 1]?.getAttribute("content")?.trim() || null;
1230
- }, yt = l(() => import("./dist-CJknSbJK.js").then((e) => e.n).then((e) => ({ default: e.PopupLoader }))), bt = ({ siteId: e, pageId: t }) => {
1231
- let r = N(), i = n();
1232
- return !r || !i ? null : /* @__PURE__ */ v(s, {
1718
+ }, un = h(() => import("./dist-DPmVG7VB.js").then((e) => e.n).then((e) => ({ default: e.PopupLoader }))), dn = ({ siteId: e, pageId: t }) => {
1719
+ let n = J(), r = i();
1720
+ return !n || !r ? null : /* @__PURE__ */ u(p, {
1233
1721
  fallback: null,
1234
- children: /* @__PURE__ */ v(yt, {
1722
+ children: /* @__PURE__ */ u(un, {
1235
1723
  pageId: t,
1236
1724
  siteId: e
1237
1725
  })
1238
1726
  });
1239
- }, xt = () => n(), St = () => t(), Ct = ({ site: t, children: n }) => {
1240
- let [r] = g(() => {
1241
- if (!t) return null;
1242
- let e = I(t), n = F(e);
1727
+ }, fn = () => i(), pn = () => n(), mn = ({ site: e, children: t }) => {
1728
+ let [n] = S(() => {
1729
+ if (!e) return null;
1730
+ let t = q(e), n = ue(t);
1243
1731
  return n ? {
1244
1732
  client: n,
1245
- insights: E(n, {
1246
- insightsUrl: e.insightsUrl || null,
1247
- site: e.siteId || null
1733
+ insights: ee(n, {
1734
+ insightsUrl: t.insightsUrl || null,
1735
+ site: t.siteId || null
1248
1736
  }),
1249
- site: t
1737
+ site: e
1250
1738
  } : null;
1251
- }), [i, a] = g(null), o = C({ select: (e) => e.location.pathname });
1252
- return f(() => {
1253
- r && (window.levo_client = r.client, window.levo_insights = r.insights);
1254
- }, [r]), p(() => {
1255
- if (!r) return;
1256
- let e = vt();
1257
- a(e), r.insights.init({ pageId: e });
1258
- }, [r, o]), r ? /* @__PURE__ */ y(e, {
1259
- client: r.client,
1260
- insights: r.insights,
1739
+ }), [i, a] = S(null), o = O({ select: (e) => e.location.pathname });
1740
+ return v(() => {
1741
+ n && (window.levo_client = n.client, window.levo_insights = n.insights);
1742
+ }, [n]), y(() => {
1743
+ if (!n) return;
1744
+ let e = ln();
1745
+ a(e), n.insights.init({ pageId: e });
1746
+ }, [n, o]), n ? /* @__PURE__ */ d(r, {
1747
+ client: n.client,
1748
+ insights: n.insights,
1261
1749
  children: [
1262
- n,
1263
- /* @__PURE__ */ v(ie, { site: r.site }),
1264
- /* @__PURE__ */ v(bt, {
1750
+ t,
1751
+ /* @__PURE__ */ u(Je, {
1752
+ site: n.site,
1753
+ path: o
1754
+ }),
1755
+ /* @__PURE__ */ u(dn, {
1265
1756
  pageId: i ?? void 0,
1266
- siteId: r.site.id
1757
+ siteId: n.site.id
1267
1758
  })
1268
1759
  ]
1269
- }) : /* @__PURE__ */ v(_, { children: n });
1270
- }, wt = (e) => JSON.stringify(e).replace(/<\//g, "<\\/"), Tt = (e) => {
1760
+ }) : /* @__PURE__ */ u(l, { children: t });
1761
+ }, hn = (e) => JSON.stringify(e).replace(/<\//g, "<\\/"), gn = (e) => {
1271
1762
  let t = {}, n = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*("([^"]*)"|'([^']*)'|[^\s"'>]+))?/g;
1272
1763
  for (let r = n.exec(e); r; r = n.exec(e)) {
1273
1764
  let e = r[1];
1274
1765
  !e || /^on/i.test(e) || (t[e] = r[3] ?? r[4] ?? (r[2] ? r[2] : ""));
1275
1766
  }
1276
1767
  return t;
1277
- }, Et = (e) => {
1768
+ }, _n = (e) => {
1278
1769
  let t = {
1279
1770
  meta: [],
1280
1771
  links: [],
@@ -1282,11 +1773,11 @@ var _t = "levo:page-id", vt = () => {
1282
1773
  };
1283
1774
  if (!e?.trim()) return t;
1284
1775
  let n = e.replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi, (e, n, r) => {
1285
- let i = Tt(n), a = r.trim();
1776
+ let i = gn(n), a = r.trim();
1286
1777
  return a && (i.children = a), t.scripts.push(i), "";
1287
1778
  });
1288
- return n = n.replace(/<(meta|link)\b([^>]*?)\/?>/gi, (e, n, r) => ((n.toLowerCase() === "meta" ? t.meta : t.links).push(Tt(r)), "")), t;
1289
- }, Dt = (e = {}, t = {}) => {
1779
+ return n = n.replace(/<(meta|link)\b([^>]*?)\/?>/gi, (e, n, r) => ((n.toLowerCase() === "meta" ? t.meta : t.links).push(gn(r)), "")), t;
1780
+ }, vn = (e = {}, t = {}) => {
1290
1781
  let n = {
1291
1782
  meta: [],
1292
1783
  links: [],
@@ -1351,21 +1842,21 @@ var _t = "levo:page-id", vt = () => {
1351
1842
  let y = e.ldJson ? Array.isArray(e.ldJson) ? e.ldJson : [e.ldJson] : [];
1352
1843
  for (let e of y) n.scripts.push({
1353
1844
  type: "application/ld+json",
1354
- children: wt(e)
1845
+ children: hn(e)
1355
1846
  });
1356
1847
  for (let r of [t.customHead, e.customHead]) {
1357
1848
  if (!r) continue;
1358
- let e = Et(r);
1849
+ let e = _n(r);
1359
1850
  n.meta.push(...e.meta), n.links.push(...e.links), n.scripts.push(...e.scripts);
1360
1851
  }
1361
1852
  return n;
1362
1853
  };
1363
- function Ot({ meta: e, site: t }) {
1364
- let n = Dt(e, t);
1365
- return /* @__PURE__ */ y(_, { children: [
1366
- n.meta.map((e, t) => e.title === void 0 ? /* @__PURE__ */ v("meta", { ...e }, `m${t}`) : /* @__PURE__ */ v("title", { children: e.title }, `t${t}`)),
1367
- n.links.map((e, t) => /* @__PURE__ */ v("link", { ...e }, `l${t}`)),
1368
- n.scripts.map(({ children: e, ...t }, n) => e === void 0 ? /* @__PURE__ */ v("script", { ...t }, `s${n}`) : /* @__PURE__ */ v("script", {
1854
+ function yn({ meta: e, site: t }) {
1855
+ let n = vn(e, t);
1856
+ return /* @__PURE__ */ d(l, { children: [
1857
+ n.meta.map((e, t) => e.title === void 0 ? /* @__PURE__ */ u("meta", { ...e }, `m${t}`) : /* @__PURE__ */ u("title", { children: e.title }, `t${t}`)),
1858
+ n.links.map((e, t) => /* @__PURE__ */ u("link", { ...e }, `l${t}`)),
1859
+ n.scripts.map(({ children: e, ...t }, n) => e === void 0 ? /* @__PURE__ */ u("script", { ...t }, `s${n}`) : /* @__PURE__ */ u("script", {
1369
1860
  ...t,
1370
1861
  dangerouslySetInnerHTML: { __html: e }
1371
1862
  }, `s${n}`))
@@ -1373,25 +1864,25 @@ function Ot({ meta: e, site: t }) {
1373
1864
  }
1374
1865
  //#endregion
1375
1866
  //#region src/registration/ui.tsx
1376
- var X = (...e) => e.filter(Boolean).join(" "), Z = o.forwardRef(({ className: e, isLoading: t, loadingText: n, children: r, type: i = "button", ...a }, o) => /* @__PURE__ */ v("button", {
1867
+ var bn = (...e) => e.filter(Boolean).join(" "), Q = f.forwardRef(({ className: e, isLoading: t, loadingText: n, children: r, type: i = "button", ...a }, o) => /* @__PURE__ */ u("button", {
1377
1868
  ref: o,
1378
1869
  type: i,
1379
- className: X("inline-flex items-center justify-center", e),
1870
+ className: bn("inline-flex items-center justify-center", e),
1380
1871
  ...a,
1381
- children: t ? /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(A, { className: X("h-4 w-4 animate-spin", n ? "mr-2" : "") }), n] }) : r
1872
+ children: t ? /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(ne, { className: bn("h-4 w-4 animate-spin", n ? "mr-2" : "") }), n] }) : r
1382
1873
  }));
1383
- Z.displayName = "Btn";
1874
+ Q.displayName = "Btn";
1384
1875
  //#endregion
1385
1876
  //#region src/registration/AttendeeForm.tsx
1386
- var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, registerLoading: i, onBack: a, submitLabel: o }) => /* @__PURE__ */ y("form", {
1877
+ var xn = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, registerLoading: i, onBack: a, submitLabel: o, showBusinessBilling: s = !0 }) => /* @__PURE__ */ d("form", {
1387
1878
  onSubmit: r,
1388
1879
  className: "flex flex-col gap-4",
1389
1880
  children: [
1390
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
1881
+ /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
1391
1882
  htmlFor: "name",
1392
1883
  className: "font-medium text-sm",
1393
1884
  children: "Name"
1394
- }), /* @__PURE__ */ v("input", {
1885
+ }), /* @__PURE__ */ u("input", {
1395
1886
  className: "w-full rounded-lg border border-gray-300 px-3 py-2 focus:outline-none",
1396
1887
  placeholder: "Name",
1397
1888
  name: "name",
@@ -1400,11 +1891,11 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
1400
1891
  onBlur: n,
1401
1892
  required: !0
1402
1893
  })] }),
1403
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
1894
+ /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
1404
1895
  htmlFor: "email",
1405
1896
  className: "font-medium text-sm",
1406
1897
  children: "Email"
1407
- }), /* @__PURE__ */ v("input", {
1898
+ }), /* @__PURE__ */ u("input", {
1408
1899
  className: "w-full rounded-lg border border-gray-300 px-3 py-2 focus:outline-none",
1409
1900
  placeholder: "Email",
1410
1901
  name: "email",
@@ -1414,32 +1905,32 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
1414
1905
  type: "email",
1415
1906
  required: !0
1416
1907
  })] }),
1417
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ y("label", {
1908
+ s && /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ d("label", {
1418
1909
  htmlFor: "is_business_purchase",
1419
1910
  className: "flex items-center gap-2 text-sm",
1420
- children: [/* @__PURE__ */ v("input", {
1911
+ children: [/* @__PURE__ */ u("input", {
1421
1912
  type: "checkbox",
1422
1913
  name: "is_business_purchase",
1423
1914
  checked: e.is_business_purchase || !1,
1424
1915
  onChange: t,
1425
1916
  className: "rounded border-gray-300"
1426
- }), /* @__PURE__ */ v("span", {
1917
+ }), /* @__PURE__ */ u("span", {
1427
1918
  className: "font-medium",
1428
1919
  children: "Tax for Business"
1429
1920
  })]
1430
- }), /* @__PURE__ */ v("p", {
1921
+ }), /* @__PURE__ */ u("p", {
1431
1922
  className: "mt-1 text-gray-500 text-xs",
1432
1923
  children: "Check this if you're purchasing for a business and need a tax-compliant invoice"
1433
1924
  })] }),
1434
- e.is_business_purchase && /* @__PURE__ */ y(_, { children: [
1435
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ y("label", {
1925
+ s && e.is_business_purchase && /* @__PURE__ */ d(l, { children: [
1926
+ /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ d("label", {
1436
1927
  htmlFor: "business_name",
1437
1928
  className: "font-medium text-sm",
1438
- children: ["Company Name ", /* @__PURE__ */ v("span", {
1929
+ children: ["Company Name ", /* @__PURE__ */ u("span", {
1439
1930
  className: "text-red-500",
1440
1931
  children: "*"
1441
1932
  })]
1442
- }), /* @__PURE__ */ v("input", {
1933
+ }), /* @__PURE__ */ u("input", {
1443
1934
  className: "w-full rounded-lg border border-gray-300 px-3 py-2 focus:outline-none",
1444
1935
  placeholder: "Acme Corporation",
1445
1936
  name: "billing_details.name",
@@ -1448,14 +1939,14 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
1448
1939
  onBlur: n,
1449
1940
  required: e.is_business_purchase
1450
1941
  })] }),
1451
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ y("label", {
1942
+ /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ d("label", {
1452
1943
  htmlFor: "business_tax_id",
1453
1944
  className: "font-medium text-sm",
1454
- children: ["Tax ID / GST Number ", /* @__PURE__ */ v("span", {
1945
+ children: ["Tax ID / GST Number ", /* @__PURE__ */ u("span", {
1455
1946
  className: "text-red-500",
1456
1947
  children: "*"
1457
1948
  })]
1458
- }), /* @__PURE__ */ v("input", {
1949
+ }), /* @__PURE__ */ u("input", {
1459
1950
  className: "w-full rounded-lg border border-gray-300 px-3 py-2 focus:outline-none",
1460
1951
  placeholder: "GST123456789",
1461
1952
  name: "billing_details.tax_id",
@@ -1464,15 +1955,15 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
1464
1955
  onBlur: n,
1465
1956
  required: e.is_business_purchase
1466
1957
  })] }),
1467
- /* @__PURE__ */ y("div", { children: [
1468
- /* @__PURE__ */ y("p", {
1958
+ /* @__PURE__ */ d("div", { children: [
1959
+ /* @__PURE__ */ d("p", {
1469
1960
  className: "mb-1 font-medium text-sm",
1470
- children: ["Business Address ", /* @__PURE__ */ v("span", {
1961
+ children: ["Business Address ", /* @__PURE__ */ u("span", {
1471
1962
  className: "text-red-500",
1472
1963
  children: "*"
1473
1964
  })]
1474
1965
  }),
1475
- /* @__PURE__ */ v("input", {
1966
+ /* @__PURE__ */ u("input", {
1476
1967
  className: "mb-2 w-full rounded-lg border border-gray-300 px-3 py-2 focus:outline-none",
1477
1968
  placeholder: "Street Address Line 1",
1478
1969
  name: "billing_details.address.line1",
@@ -1481,7 +1972,7 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
1481
1972
  onBlur: n,
1482
1973
  required: e.is_business_purchase
1483
1974
  }),
1484
- /* @__PURE__ */ v("input", {
1975
+ /* @__PURE__ */ u("input", {
1485
1976
  className: "mb-2 w-full rounded-lg border border-gray-300 px-3 py-2 focus:outline-none",
1486
1977
  placeholder: "Street Address Line 2 (Optional)",
1487
1978
  name: "billing_details.address.line2",
@@ -1489,9 +1980,9 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
1489
1980
  onChange: t,
1490
1981
  onBlur: n
1491
1982
  }),
1492
- /* @__PURE__ */ y("div", {
1983
+ /* @__PURE__ */ d("div", {
1493
1984
  className: "grid grid-cols-2 gap-2",
1494
- children: [/* @__PURE__ */ v("input", {
1985
+ children: [/* @__PURE__ */ u("input", {
1495
1986
  className: "w-full rounded-lg border border-gray-300 px-3 py-2 focus:outline-none",
1496
1987
  placeholder: "City",
1497
1988
  name: "billing_details.address.city",
@@ -1499,7 +1990,7 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
1499
1990
  onChange: t,
1500
1991
  onBlur: n,
1501
1992
  required: e.is_business_purchase
1502
- }), /* @__PURE__ */ v("input", {
1993
+ }), /* @__PURE__ */ u("input", {
1503
1994
  className: "w-full rounded-lg border border-gray-300 px-3 py-2 focus:outline-none",
1504
1995
  placeholder: "State/Province",
1505
1996
  name: "billing_details.address.state",
@@ -1509,9 +2000,9 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
1509
2000
  required: e.is_business_purchase
1510
2001
  })]
1511
2002
  }),
1512
- /* @__PURE__ */ y("div", {
2003
+ /* @__PURE__ */ d("div", {
1513
2004
  className: "mt-2 grid grid-cols-2 gap-2",
1514
- children: [/* @__PURE__ */ v("input", {
2005
+ children: [/* @__PURE__ */ u("input", {
1515
2006
  className: "w-full rounded-lg border border-gray-300 px-3 py-2 focus:outline-none",
1516
2007
  placeholder: "Postal Code",
1517
2008
  name: "billing_details.address.postal_code",
@@ -1519,7 +2010,7 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
1519
2010
  onChange: t,
1520
2011
  onBlur: n,
1521
2012
  required: e.is_business_purchase
1522
- }), /* @__PURE__ */ v("input", {
2013
+ }), /* @__PURE__ */ u("input", {
1523
2014
  className: "w-full rounded-lg border border-gray-300 px-3 py-2 focus:outline-none",
1524
2015
  placeholder: "Country",
1525
2016
  name: "billing_details.address.country",
@@ -1531,15 +2022,15 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
1531
2022
  })
1532
2023
  ] })
1533
2024
  ] }),
1534
- /* @__PURE__ */ y("div", {
2025
+ /* @__PURE__ */ d("div", {
1535
2026
  className: "flex flex-col-reverse justify-end gap-4 md:flex-row",
1536
- children: [/* @__PURE__ */ v(Z, {
2027
+ children: [/* @__PURE__ */ u(Q, {
1537
2028
  className: "rounded-lg bg-gray-100 px-6 py-2 font-semibold text-black hover:bg-gray-200",
1538
2029
  type: "button",
1539
2030
  onClick: a,
1540
2031
  disabled: i,
1541
2032
  children: "Back"
1542
- }), /* @__PURE__ */ v(Z, {
2033
+ }), /* @__PURE__ */ u(Q, {
1543
2034
  className: "rounded-lg bg-brand px-6 py-2 font-semibold text-brand-foreground hover:opacity-90",
1544
2035
  type: "submit",
1545
2036
  isLoading: i,
@@ -1548,57 +2039,57 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
1548
2039
  })]
1549
2040
  })
1550
2041
  ]
1551
- }), At = {
2042
+ }), Sn = {
1552
2043
  USD: "$",
1553
2044
  EUR: "€",
1554
2045
  GBP: "£",
1555
2046
  INR: "₹"
1556
- }, Q = (e) => e?.unit_amount ? `${At[e.currency ?? "INR"]} ${(e.unit_amount ?? 0) / 100}` : "Free", jt = (e) => {
2047
+ }, $ = (e) => e?.unit_amount ? `${Sn[e.currency ?? "INR"]} ${(e.unit_amount ?? 0) / 100}` : "Free", Cn = (e) => {
1557
2048
  if (!e) return null;
1558
2049
  let t = e.tax_enabled ?? !1, n = e.tax_inclusive ?? !1, r = e.taxes ?? [];
1559
2050
  return !t || r.length === 0 ? null : n ? "(inclusive of taxes)" : "+ taxes";
1560
- }, Mt = (e) => !!(e?.taxes && e.taxes.length > 0 && e.tax_amount !== void 0), Nt = (e) => {
2051
+ }, wn = (e) => !!(e?.taxes && e.taxes.length > 0 && e.tax_amount !== void 0), Tn = (e) => {
1561
2052
  if (!e) return !1;
1562
2053
  let t = e;
1563
2054
  return t.tax_enabled === !0 && t.taxes !== void 0 && t.taxes.length > 0 && t.subtotal !== void 0;
1564
- }, $ = (e, t) => !t || e.tickets.length === 0 ? !0 : e.tickets.some((e) => typeof e == "string" ? e === t : e._id === t), Pt = ({ couponCode: e, onCouponCodeChange: t, couponError: n, couponLoading: r, onValidateCoupon: i, publicCoupons: a, onBack: o, selectedTicket: s }) => {
2055
+ }, En = (e, t) => t ? t.total_amount ?? t.sale_amount ?? 0 : Tn(e) ? e.total ?? e.unit_amount ?? 0 : e?.unit_amount ?? 0, Dn = (e, t) => !t || e.tickets.length === 0 ? !0 : e.tickets.some((e) => typeof e == "string" ? e === t : e._id === t), On = ({ couponCode: e, onCouponCodeChange: t, couponError: n, couponLoading: r, onValidateCoupon: i, publicCoupons: a, onBack: o, selectedTicket: s }) => {
1565
2056
  let c = [...a].sort((e, t) => {
1566
- let n = $(e, s?._id), r = $(t, s?._id);
2057
+ let n = Dn(e, s?._id), r = Dn(t, s?._id);
1567
2058
  return n && !r ? -1 : !n && r ? 1 : 0;
1568
2059
  });
1569
- return /* @__PURE__ */ y("div", { children: [
1570
- /* @__PURE__ */ y("div", {
2060
+ return /* @__PURE__ */ d("div", { children: [
2061
+ /* @__PURE__ */ d("div", {
1571
2062
  className: "flex items-center justify-between text-center",
1572
2063
  children: [
1573
- /* @__PURE__ */ v("button", {
2064
+ /* @__PURE__ */ u("button", {
1574
2065
  type: "button",
1575
2066
  className: "rounded-md p-2 hover:bg-gray-50 focus:outline-none",
1576
2067
  "aria-label": "Back",
1577
2068
  onClick: o,
1578
- children: /* @__PURE__ */ v(O, { className: "size-4" })
2069
+ children: /* @__PURE__ */ u(te, { className: "size-4" })
1579
2070
  }),
1580
- /* @__PURE__ */ y("p", {
2071
+ /* @__PURE__ */ d("p", {
1581
2072
  className: "font-semibold text-md",
1582
2073
  children: ["Apply Coupon for ", s?.title]
1583
2074
  }),
1584
- /* @__PURE__ */ v("div", { className: "w-4" })
2075
+ /* @__PURE__ */ u("div", { className: "w-4" })
1585
2076
  ]
1586
2077
  }),
1587
- /* @__PURE__ */ y("div", {
2078
+ /* @__PURE__ */ d("div", {
1588
2079
  className: "mt-2 flex gap-4",
1589
- children: [/* @__PURE__ */ y("div", {
2080
+ children: [/* @__PURE__ */ d("div", {
1590
2081
  className: "w-full",
1591
- children: [/* @__PURE__ */ v("input", {
2082
+ children: [/* @__PURE__ */ u("input", {
1592
2083
  className: "w-full rounded border border-gray-300 px-3 py-2 focus:border-brand focus:outline-none",
1593
2084
  type: "text",
1594
2085
  placeholder: "Enter Coupon Code",
1595
2086
  value: e,
1596
2087
  onChange: (e) => t(e.target.value)
1597
- }), n && /* @__PURE__ */ v("p", {
2088
+ }), n && /* @__PURE__ */ u("p", {
1598
2089
  className: "mt-1 text-red-400 text-xs",
1599
2090
  children: n
1600
2091
  })]
1601
- }), /* @__PURE__ */ v(Z, {
2092
+ }), /* @__PURE__ */ u(Q, {
1602
2093
  "aria-label": "Apply Coupon",
1603
2094
  onClick: () => i(),
1604
2095
  className: "rounded-lg bg-brand px-3 text-brand-foreground hover:opacity-90",
@@ -1607,55 +2098,55 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
1607
2098
  zIndex: e ? 1 : -1
1608
2099
  },
1609
2100
  isLoading: r,
1610
- children: /* @__PURE__ */ v(D, { className: "h-fit" })
2101
+ children: /* @__PURE__ */ u(k, { className: "h-fit" })
1611
2102
  })]
1612
2103
  }),
1613
- c.length > 0 && /* @__PURE__ */ y("div", {
2104
+ c.length > 0 && /* @__PURE__ */ d("div", {
1614
2105
  className: "mt-4 flex flex-col gap-4",
1615
- children: [c.filter((e) => $(e, s?._id)).length > 0 && /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("p", {
2106
+ children: [c.filter((e) => Dn(e, s?._id)).length > 0 && /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
1616
2107
  className: "mb-2 text-gray-600 text-sm",
1617
2108
  children: "Available Coupons"
1618
- }), /* @__PURE__ */ v("div", {
2109
+ }), /* @__PURE__ */ u("div", {
1619
2110
  className: "flex flex-col gap-2",
1620
- children: c.filter((e) => $(e, s?._id)).map((e) => /* @__PURE__ */ y("button", {
2111
+ children: c.filter((e) => Dn(e, s?._id)).map((e) => /* @__PURE__ */ d("button", {
1621
2112
  type: "button",
1622
2113
  className: "flex flex-col gap-1 rounded-md border border-gray-300 border-dashed px-3 py-2 text-left transition hover:border-gray-400 hover:bg-gray-50",
1623
2114
  onClick: () => {
1624
2115
  i(e.code), t(e.code);
1625
2116
  },
1626
- children: [/* @__PURE__ */ y("div", {
2117
+ children: [/* @__PURE__ */ d("div", {
1627
2118
  className: "flex w-full items-center justify-between",
1628
- children: [/* @__PURE__ */ v("span", {
2119
+ children: [/* @__PURE__ */ u("span", {
1629
2120
  className: "font-medium",
1630
2121
  children: e.code
1631
- }), /* @__PURE__ */ v("span", {
2122
+ }), /* @__PURE__ */ u("span", {
1632
2123
  className: "text-gray-500 text-sm",
1633
- children: e.kind === "percent" ? `${e.percent_off}% off` : `${At[e.currency ?? "INR"]} ${(e.amount_off ?? 0) / 100} off`
2124
+ children: e.kind === "percent" ? `${e.percent_off}% off` : `${Sn[e.currency ?? "INR"]} ${(e.amount_off ?? 0) / 100} off`
1634
2125
  })]
1635
- }), e.description && /* @__PURE__ */ v("span", {
2126
+ }), e.description && /* @__PURE__ */ u("span", {
1636
2127
  className: "text-gray-500 text-xs",
1637
2128
  children: e.description
1638
2129
  })]
1639
2130
  }, e._id))
1640
- })] }), c.filter((e) => !$(e, s?._id)).length > 0 && /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("p", {
2131
+ })] }), c.filter((e) => !Dn(e, s?._id)).length > 0 && /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
1641
2132
  className: "mb-2 text-gray-400 text-sm",
1642
2133
  children: "Not Applicable"
1643
- }), /* @__PURE__ */ v("div", {
2134
+ }), /* @__PURE__ */ u("div", {
1644
2135
  className: "flex flex-col gap-2",
1645
- children: c.filter((e) => !$(e, s?._id)).map((e) => /* @__PURE__ */ y("button", {
2136
+ children: c.filter((e) => !Dn(e, s?._id)).map((e) => /* @__PURE__ */ d("button", {
1646
2137
  type: "button",
1647
2138
  disabled: !0,
1648
2139
  className: "flex cursor-not-allowed flex-col gap-1 rounded-md border border-gray-200 border-dashed px-3 py-2 text-left opacity-50",
1649
- children: [/* @__PURE__ */ y("div", {
2140
+ children: [/* @__PURE__ */ d("div", {
1650
2141
  className: "flex w-full items-center justify-between",
1651
- children: [/* @__PURE__ */ v("span", {
2142
+ children: [/* @__PURE__ */ u("span", {
1652
2143
  className: "font-medium",
1653
2144
  children: e.code
1654
- }), /* @__PURE__ */ v("span", {
2145
+ }), /* @__PURE__ */ u("span", {
1655
2146
  className: "text-gray-500 text-sm",
1656
- children: e.kind === "percent" ? `${e.percent_off}% off` : `${At[e.currency ?? "INR"]} ${(e.amount_off ?? 0) / 100} off`
2147
+ children: e.kind === "percent" ? `${e.percent_off}% off` : `${Sn[e.currency ?? "INR"]} ${(e.amount_off ?? 0) / 100} off`
1657
2148
  })]
1658
- }), e.description && /* @__PURE__ */ v("span", {
2149
+ }), e.description && /* @__PURE__ */ u("span", {
1659
2150
  className: "text-gray-500 text-xs",
1660
2151
  children: e.description
1661
2152
  })]
@@ -1663,7 +2154,7 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
1663
2154
  })] })]
1664
2155
  })
1665
2156
  ] });
1666
- }, Ft = (e) => {
2157
+ }, kn = (e) => {
1667
2158
  let t = new Date(e);
1668
2159
  return `${new Intl.DateTimeFormat("en-GB", {
1669
2160
  day: "numeric",
@@ -1674,24 +2165,24 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
1674
2165
  minute: "2-digit",
1675
2166
  hour12: !0
1676
2167
  }).format(t)}`;
1677
- }, It = ({ ticketData: e, paymentData: t, type: n }) => {
1678
- let [r, i] = g(!0), a = (t.total_amount || t.unit_amount) / 100, o = t.unit_amount === 0, s = (e) => new Intl.NumberFormat("en-IN", {
2168
+ }, An = ({ ticketData: e, paymentData: t, type: n }) => {
2169
+ let [r, i] = S(!0), a = (t.total_amount || t.unit_amount) / 100, o = t.unit_amount === 0, s = (e) => new Intl.NumberFormat("en-IN", {
1679
2170
  style: "currency",
1680
2171
  currency: t.currency || "INR",
1681
2172
  minimumFractionDigits: 0
1682
2173
  }).format(e);
1683
- return /* @__PURE__ */ v(T.Root, {
2174
+ return /* @__PURE__ */ u(C.Root, {
1684
2175
  open: r,
1685
2176
  onOpenChange: (e) => i(e),
1686
- children: /* @__PURE__ */ y(T.Portal, { children: [/* @__PURE__ */ v(T.Backdrop, { className: "fixed inset-0 z-50 bg-black/50" }), /* @__PURE__ */ y(T.Popup, {
2177
+ children: /* @__PURE__ */ d(C.Portal, { children: [/* @__PURE__ */ u(C.Backdrop, { className: "fixed inset-0 z-50 bg-black/50" }), /* @__PURE__ */ d(C.Popup, {
1687
2178
  className: "fixed top-1/2 left-1/2 z-50 flex max-h-[calc(100vh-2rem)] w-full max-w-md -translate-x-1/2 -translate-y-1/2 flex-col overflow-y-auto rounded-2xl bg-white shadow-2xl",
1688
2179
  children: [
1689
- /* @__PURE__ */ y("div", {
2180
+ /* @__PURE__ */ d("div", {
1690
2181
  className: "bg-gradient-to-br from-green-50 to-emerald-50 px-6 py-6 text-center",
1691
2182
  children: [
1692
- /* @__PURE__ */ v("div", {
2183
+ /* @__PURE__ */ u("div", {
1693
2184
  className: "mx-auto mb-3 flex size-14 items-center justify-center rounded-full bg-green-100 ring-4 ring-green-50",
1694
- children: /* @__PURE__ */ y("svg", {
2185
+ children: /* @__PURE__ */ d("svg", {
1695
2186
  xmlns: "http://www.w3.org/2000/svg",
1696
2187
  width: "28",
1697
2188
  height: "28",
@@ -1703,72 +2194,72 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
1703
2194
  strokeLinejoin: "round",
1704
2195
  className: "text-green-600",
1705
2196
  "aria-hidden": "true",
1706
- children: [/* @__PURE__ */ v("path", { d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }), /* @__PURE__ */ v("polyline", { points: "22 4 12 14.01 9 11.01" })]
2197
+ children: [/* @__PURE__ */ u("path", { d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }), /* @__PURE__ */ u("polyline", { points: "22 4 12 14.01 9 11.01" })]
1707
2198
  })
1708
2199
  }),
1709
- /* @__PURE__ */ v(T.Title, {
2200
+ /* @__PURE__ */ u(C.Title, {
1710
2201
  className: "font-bold text-gray-900 text-lg",
1711
2202
  children: n === "view" ? "Booking Details" : "Tickets Confirmed!"
1712
2203
  }),
1713
- /* @__PURE__ */ v(T.Description, {
2204
+ /* @__PURE__ */ u(C.Description, {
1714
2205
  className: "mt-1 text-gray-600 text-sm",
1715
2206
  children: n === "confirm" ? "Your tickets have been confirmed. A confirmation email is on its way." : "Here are the details about your booking."
1716
2207
  })
1717
2208
  ]
1718
2209
  }),
1719
- /* @__PURE__ */ y("div", {
2210
+ /* @__PURE__ */ d("div", {
1720
2211
  className: "px-6 py-5",
1721
- children: [/* @__PURE__ */ y("div", {
2212
+ children: [/* @__PURE__ */ d("div", {
1722
2213
  className: "relative overflow-hidden rounded-xl border border-gray-200 bg-white",
1723
2214
  children: [
1724
- /* @__PURE__ */ v("div", { className: "absolute top-1/2 -left-3 size-6 -translate-y-1/2 rounded-full bg-gray-100" }),
1725
- /* @__PURE__ */ v("div", { className: "absolute top-1/2 -right-3 size-6 -translate-y-1/2 rounded-full bg-gray-100" }),
1726
- /* @__PURE__ */ y("div", {
2215
+ /* @__PURE__ */ u("div", { className: "absolute top-1/2 -left-3 size-6 -translate-y-1/2 rounded-full bg-gray-100" }),
2216
+ /* @__PURE__ */ u("div", { className: "absolute top-1/2 -right-3 size-6 -translate-y-1/2 rounded-full bg-gray-100" }),
2217
+ /* @__PURE__ */ d("div", {
1727
2218
  className: "px-5 py-4",
1728
2219
  children: [
1729
- t.qr_image && /* @__PURE__ */ v("div", {
2220
+ t.qr_image && /* @__PURE__ */ u("div", {
1730
2221
  className: "mb-4 flex flex-col items-center",
1731
- children: /* @__PURE__ */ v("div", {
2222
+ children: /* @__PURE__ */ u("div", {
1732
2223
  className: "rounded-lg border border-gray-200 bg-white p-2",
1733
- children: /* @__PURE__ */ v("img", {
2224
+ children: /* @__PURE__ */ u("img", {
1734
2225
  src: t.qr_image.location,
1735
2226
  alt: "Booking QR Code",
1736
2227
  className: "size-24"
1737
2228
  })
1738
2229
  })
1739
2230
  }),
1740
- /* @__PURE__ */ y("div", {
2231
+ /* @__PURE__ */ d("div", {
1741
2232
  className: "mb-4 flex items-center justify-between rounded-lg bg-gray-50 px-3 py-2.5",
1742
- children: [/* @__PURE__ */ v("span", {
2233
+ children: [/* @__PURE__ */ u("span", {
1743
2234
  className: "font-medium text-gray-500 text-xs uppercase tracking-wide",
1744
2235
  children: "Booking ID"
1745
- }), /* @__PURE__ */ v("span", {
2236
+ }), /* @__PURE__ */ u("span", {
1746
2237
  className: "font-mono font-semibold text-gray-900 text-sm",
1747
2238
  children: t._id
1748
2239
  })]
1749
2240
  }),
1750
- /* @__PURE__ */ v("div", { className: "my-4 border-gray-200 border-t border-dashed" }),
1751
- /* @__PURE__ */ v("div", {
2241
+ /* @__PURE__ */ u("div", { className: "my-4 border-gray-200 border-t border-dashed" }),
2242
+ /* @__PURE__ */ u("div", {
1752
2243
  className: "space-y-3",
1753
2244
  children: t.attendees.map((t) => {
1754
2245
  let n = e.find((e) => e._id === t.ticket._id);
1755
- return n ? /* @__PURE__ */ y("div", {
2246
+ return n ? /* @__PURE__ */ d("div", {
1756
2247
  className: "flex items-center justify-between",
1757
- children: [/* @__PURE__ */ y("div", {
2248
+ children: [/* @__PURE__ */ d("div", {
1758
2249
  className: "min-w-0 flex-1",
1759
- children: [/* @__PURE__ */ v("p", {
2250
+ children: [/* @__PURE__ */ u("p", {
1760
2251
  className: "truncate font-medium text-gray-900 text-sm",
1761
2252
  children: t.name
1762
- }), /* @__PURE__ */ v("p", {
2253
+ }), /* @__PURE__ */ u("p", {
1763
2254
  className: "truncate text-gray-500 text-xs",
1764
2255
  children: t.email
1765
2256
  })]
1766
- }), /* @__PURE__ */ y("div", {
2257
+ }), /* @__PURE__ */ d("div", {
1767
2258
  className: "ml-3 shrink-0 text-right",
1768
- children: [/* @__PURE__ */ v("p", {
2259
+ children: [/* @__PURE__ */ u("p", {
1769
2260
  className: "font-medium text-gray-900 text-sm",
1770
2261
  children: n.title
1771
- }), /* @__PURE__ */ v("p", {
2262
+ }), /* @__PURE__ */ u("p", {
1772
2263
  className: "text-gray-500 text-xs",
1773
2264
  children: s(t.ticket.unit_amount / 100)
1774
2265
  })]
@@ -1776,63 +2267,63 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
1776
2267
  }, t._id) : null;
1777
2268
  })
1778
2269
  }),
1779
- /* @__PURE__ */ v("div", { className: "my-4 border-gray-200 border-t border-dashed" }),
1780
- !o && /* @__PURE__ */ y("div", {
2270
+ /* @__PURE__ */ u("div", { className: "my-4 border-gray-200 border-t border-dashed" }),
2271
+ !o && /* @__PURE__ */ d("div", {
1781
2272
  className: "space-y-1.5 text-sm",
1782
2273
  children: [
1783
- /* @__PURE__ */ y("div", {
2274
+ /* @__PURE__ */ d("div", {
1784
2275
  className: "flex justify-between",
1785
- children: [/* @__PURE__ */ v("span", {
2276
+ children: [/* @__PURE__ */ u("span", {
1786
2277
  className: "text-gray-500",
1787
2278
  children: "Base Amount"
1788
- }), /* @__PURE__ */ v("span", {
2279
+ }), /* @__PURE__ */ u("span", {
1789
2280
  className: "font-medium text-gray-700",
1790
2281
  children: s(t.unit_amount / 100)
1791
2282
  })]
1792
2283
  }),
1793
- t.discount > 0 && /* @__PURE__ */ y("div", {
2284
+ t.discount > 0 && /* @__PURE__ */ d("div", {
1794
2285
  className: "flex justify-between text-green-600",
1795
- children: [/* @__PURE__ */ v("span", { children: "Discount" }), /* @__PURE__ */ y("span", {
2286
+ children: [/* @__PURE__ */ u("span", { children: "Discount" }), /* @__PURE__ */ d("span", {
1796
2287
  className: "font-medium",
1797
2288
  children: ["- ", s(t.discount / 100)]
1798
2289
  })]
1799
2290
  }),
1800
- t.taxes && Array.isArray(t.taxes) && t.taxes.length > 0 && t.taxes.map((e, t) => /* @__PURE__ */ y("div", {
2291
+ t.taxes && Array.isArray(t.taxes) && t.taxes.length > 0 && t.taxes.map((e, t) => /* @__PURE__ */ d("div", {
1801
2292
  className: "flex justify-between",
1802
- children: [/* @__PURE__ */ v("span", {
2293
+ children: [/* @__PURE__ */ u("span", {
1803
2294
  className: "text-gray-500",
1804
2295
  children: e.label
1805
- }), /* @__PURE__ */ v("span", {
2296
+ }), /* @__PURE__ */ u("span", {
1806
2297
  className: "font-medium text-gray-700",
1807
2298
  children: s(e.amount / 100)
1808
2299
  })]
1809
2300
  }, t)),
1810
- /* @__PURE__ */ y("div", {
2301
+ /* @__PURE__ */ d("div", {
1811
2302
  className: "flex justify-between border-gray-200 border-t pt-2 font-semibold text-gray-900",
1812
- children: [/* @__PURE__ */ v("span", { children: "Total Paid" }), /* @__PURE__ */ v("span", { children: s(a) })]
2303
+ children: [/* @__PURE__ */ u("span", { children: "Total Paid" }), /* @__PURE__ */ u("span", { children: s(a) })]
1813
2304
  })
1814
2305
  ]
1815
2306
  }),
1816
- o && /* @__PURE__ */ y("div", {
2307
+ o && /* @__PURE__ */ d("div", {
1817
2308
  className: "flex items-center justify-between font-semibold text-gray-900",
1818
- children: [/* @__PURE__ */ v("span", { children: "Total" }), /* @__PURE__ */ v("span", { children: "Free" })]
2309
+ children: [/* @__PURE__ */ u("span", { children: "Total" }), /* @__PURE__ */ u("span", { children: "Free" })]
1819
2310
  })
1820
2311
  ]
1821
2312
  })
1822
2313
  ]
1823
- }), /* @__PURE__ */ v("p", {
2314
+ }), /* @__PURE__ */ u("p", {
1824
2315
  className: "mt-3 text-center text-gray-400 text-xs",
1825
- children: Ft(t.created_at)
2316
+ children: kn(t.created_at)
1826
2317
  })]
1827
2318
  }),
1828
- /* @__PURE__ */ y("div", {
2319
+ /* @__PURE__ */ d("div", {
1829
2320
  className: "flex flex-col gap-2 px-6 pb-5",
1830
- children: [t.invoice?.location && /* @__PURE__ */ y("a", {
2321
+ children: [t.invoice?.location && /* @__PURE__ */ d("a", {
1831
2322
  href: t.invoice.location,
1832
2323
  target: "_blank",
1833
2324
  rel: "noopener noreferrer",
1834
2325
  className: "flex w-full items-center justify-center gap-2 rounded-lg border border-gray-200 px-4 py-2.5 font-medium text-gray-700 text-sm transition-colors hover:bg-gray-50",
1835
- children: [/* @__PURE__ */ y("svg", {
2326
+ children: [/* @__PURE__ */ d("svg", {
1836
2327
  xmlns: "http://www.w3.org/2000/svg",
1837
2328
  width: "16",
1838
2329
  height: "16",
@@ -1844,9 +2335,9 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
1844
2335
  strokeLinejoin: "round",
1845
2336
  "aria-hidden": "true",
1846
2337
  children: [
1847
- /* @__PURE__ */ v("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
1848
- /* @__PURE__ */ v("polyline", { points: "7 10 12 15 17 10" }),
1849
- /* @__PURE__ */ v("line", {
2338
+ /* @__PURE__ */ u("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
2339
+ /* @__PURE__ */ u("polyline", { points: "7 10 12 15 17 10" }),
2340
+ /* @__PURE__ */ u("line", {
1850
2341
  x1: "12",
1851
2342
  x2: "12",
1852
2343
  y1: "15",
@@ -1854,7 +2345,7 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
1854
2345
  })
1855
2346
  ]
1856
2347
  }), "Download Invoice"]
1857
- }), /* @__PURE__ */ v(T.Close, {
2348
+ }), /* @__PURE__ */ u(C.Close, {
1858
2349
  className: "w-full rounded-lg bg-gray-900 px-4 py-2.5 font-medium text-sm text-white transition-colors hover:bg-gray-800",
1859
2350
  children: "Done"
1860
2351
  })]
@@ -1862,123 +2353,123 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
1862
2353
  ]
1863
2354
  })] })
1864
2355
  });
1865
- }, Lt = ({ isOpen: e, onClose: t, stripePromise: n, clientSecret: r, onComplete: i }) => !n || !r ? null : /* @__PURE__ */ v(T.Root, {
2356
+ }, jn = ({ isOpen: e, onClose: t, stripePromise: n, clientSecret: r, onComplete: i }) => !n || !r ? null : /* @__PURE__ */ u(C.Root, {
1866
2357
  open: e,
1867
2358
  onOpenChange: (e) => {
1868
2359
  e || t();
1869
2360
  },
1870
- children: /* @__PURE__ */ y(T.Portal, { children: [/* @__PURE__ */ v(T.Backdrop, { className: "fixed inset-0 z-[100] bg-black/50" }), /* @__PURE__ */ y(T.Popup, {
2361
+ children: /* @__PURE__ */ d(C.Portal, { children: [/* @__PURE__ */ u(C.Backdrop, { className: "fixed inset-0 z-[100] bg-black/50" }), /* @__PURE__ */ d(C.Popup, {
1871
2362
  className: "fixed top-8 left-1/2 z-[100] flex max-h-[calc(100vh-4rem)] min-h-[500px] w-[98vw] -translate-x-1/2 flex-col overflow-hidden rounded-2xl bg-white shadow-2xl md:top-10 md:w-auto md:max-w-[1000px] lg:max-w-[1100px]",
1872
- children: [/* @__PURE__ */ v(T.Close, {
2363
+ children: [/* @__PURE__ */ u(C.Close, {
1873
2364
  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",
1874
- children: /* @__PURE__ */ v(te, { className: "size-5" })
1875
- }), /* @__PURE__ */ v("div", {
2365
+ children: /* @__PURE__ */ u(M, { className: "size-5" })
2366
+ }), /* @__PURE__ */ u("div", {
1876
2367
  className: "flex-1 overflow-y-auto rounded-2xl py-6",
1877
- children: /* @__PURE__ */ v(M, {
2368
+ children: /* @__PURE__ */ u(ie, {
1878
2369
  stripe: n,
1879
2370
  options: {
1880
2371
  clientSecret: r,
1881
2372
  onComplete: i
1882
2373
  },
1883
- children: /* @__PURE__ */ v(re, { className: "stripe-embedded-checkout h-full" })
2374
+ children: /* @__PURE__ */ u(P, { className: "stripe-embedded-checkout h-full" })
1884
2375
  })
1885
2376
  })]
1886
2377
  })] })
1887
- }), Rt = ({ tickets: e, selectedTicket: t, onSelectTicket: n, discount: r, couponCode: i, publicCouponsCount: a, onApplyCouponClick: o, onRemoveCoupon: s, onNext: c }) => {
1888
- let l = Nt(t), u = Mt(r);
1889
- return /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ y("div", {
2378
+ }), Mn = ({ tickets: e, selectedTicket: t, onSelectTicket: n, discount: r, couponCode: i, publicCouponsCount: a, onApplyCouponClick: o, onRemoveCoupon: s, onNext: c }) => {
2379
+ let l = Tn(t), f = wn(r);
2380
+ return /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ d("div", {
1890
2381
  className: "flex max-h-[64dvh] w-full flex-col justify-between gap-6 overflow-y-auto md:max-h-[unset] md:flex-row",
1891
- children: [/* @__PURE__ */ v("div", {
2382
+ children: [/* @__PURE__ */ u("div", {
1892
2383
  className: "flex w-full flex-col gap-3 md:w-[55%]",
1893
- children: e.map((e) => /* @__PURE__ */ v("div", {
1894
- className: X("flex cursor-pointer items-center justify-between rounded-md border border-gray-300 px-3 py-2 transition duration-300 hover:bg-gray-50", e._id === t?._id ? "border-brand bg-brand/10 hover:bg-brand/20" : ""),
2384
+ children: e.map((e) => /* @__PURE__ */ u("div", {
2385
+ className: bn("flex cursor-pointer items-center justify-between rounded-md border border-gray-300 px-3 py-2 transition duration-300 hover:bg-gray-50", e._id === t?._id ? "border-brand bg-brand/10 hover:bg-brand/20" : ""),
1895
2386
  onClick: () => n(e),
1896
- children: /* @__PURE__ */ y("div", { children: [
1897
- /* @__PURE__ */ v("p", {
2387
+ children: /* @__PURE__ */ d("div", { children: [
2388
+ /* @__PURE__ */ u("p", {
1898
2389
  className: "text-md",
1899
2390
  children: e.title
1900
2391
  }),
1901
- /* @__PURE__ */ v("p", {
2392
+ /* @__PURE__ */ u("p", {
1902
2393
  className: "-mt-[2px] mb-1 text-gray-600 text-xs",
1903
2394
  children: e.description
1904
2395
  }),
1905
- /* @__PURE__ */ y("p", {
2396
+ /* @__PURE__ */ d("p", {
1906
2397
  className: "text-md",
1907
- children: [Q(e), jt(e) && /* @__PURE__ */ y("span", {
2398
+ children: [$(e), Cn(e) && /* @__PURE__ */ d("span", {
1908
2399
  className: "text-gray-500 text-sm",
1909
- children: [" ", jt(e)]
2400
+ children: [" ", Cn(e)]
1910
2401
  })]
1911
2402
  })
1912
2403
  ] })
1913
2404
  }, e._id))
1914
- }), /* @__PURE__ */ y("div", {
2405
+ }), /* @__PURE__ */ d("div", {
1915
2406
  className: "w-full md:w-[45%]",
1916
- children: [/* @__PURE__ */ y("div", {
2407
+ children: [/* @__PURE__ */ d("div", {
1917
2408
  className: "mt-4 flex min-h-[250px] flex-col justify-between rounded-md border border-gray-300 p-4 md:mt-0",
1918
- children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("p", {
2409
+ children: [/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
1919
2410
  className: "border-b border-b-gray-200 pb-1 text-md",
1920
2411
  children: "Confirm Details"
1921
- }), /* @__PURE__ */ v("div", {
2412
+ }), /* @__PURE__ */ u("div", {
1922
2413
  className: "mt-2 flex flex-col gap-2",
1923
- children: t && /* @__PURE__ */ y("div", {
2414
+ children: t && /* @__PURE__ */ d("div", {
1924
2415
  className: "flex justify-between",
1925
- children: [/* @__PURE__ */ v("span", {
2416
+ children: [/* @__PURE__ */ u("span", {
1926
2417
  className: "text-md",
1927
2418
  children: t.title
1928
- }), /* @__PURE__ */ v("span", { children: Q({
2419
+ }), /* @__PURE__ */ u("span", { children: $({
1929
2420
  unit_amount: l ? t.subtotal : t.unit_amount,
1930
2421
  currency: t.currency
1931
2422
  }) })]
1932
2423
  })
1933
- })] }), r && u ? /* @__PURE__ */ y("div", {
2424
+ })] }), r && f ? /* @__PURE__ */ d("div", {
1934
2425
  className: "mt-2",
1935
2426
  children: [
1936
- /* @__PURE__ */ y("div", {
2427
+ /* @__PURE__ */ d("div", {
1937
2428
  className: "flex items-center justify-between",
1938
- children: [/* @__PURE__ */ v("span", {
2429
+ children: [/* @__PURE__ */ u("span", {
1939
2430
  className: "text-md",
1940
2431
  children: "Subtotal"
1941
- }), /* @__PURE__ */ v("span", {
2432
+ }), /* @__PURE__ */ u("span", {
1942
2433
  className: "text-md",
1943
- children: Q({
2434
+ children: $({
1944
2435
  unit_amount: r.base_amount,
1945
2436
  currency: t?.currency
1946
2437
  })
1947
2438
  })]
1948
2439
  }),
1949
- /* @__PURE__ */ y("div", {
2440
+ /* @__PURE__ */ d("div", {
1950
2441
  className: "flex items-center justify-between text-green-600",
1951
- children: [/* @__PURE__ */ v("span", {
2442
+ children: [/* @__PURE__ */ u("span", {
1952
2443
  className: "text-md",
1953
2444
  children: "Discount"
1954
- }), /* @__PURE__ */ y("span", {
2445
+ }), /* @__PURE__ */ d("span", {
1955
2446
  className: "text-md",
1956
2447
  children: [
1957
2448
  "-",
1958
2449
  " ",
1959
- Q({
2450
+ $({
1960
2451
  unit_amount: r.discount,
1961
2452
  currency: t?.currency
1962
2453
  })
1963
2454
  ]
1964
2455
  })]
1965
2456
  }),
1966
- /* @__PURE__ */ y("div", {
2457
+ /* @__PURE__ */ d("div", {
1967
2458
  className: "flex items-center justify-between border-t border-t-gray-200 pt-1",
1968
- children: [/* @__PURE__ */ v("span", {
2459
+ children: [/* @__PURE__ */ u("span", {
1969
2460
  className: "text-md",
1970
2461
  children: "Taxable Amount"
1971
- }), /* @__PURE__ */ v("span", {
2462
+ }), /* @__PURE__ */ u("span", {
1972
2463
  className: "text-md",
1973
- children: Q({
2464
+ children: $({
1974
2465
  unit_amount: r.taxable_amount,
1975
2466
  currency: t?.currency
1976
2467
  })
1977
2468
  })]
1978
2469
  }),
1979
- r.taxes?.map((e, n) => /* @__PURE__ */ y("div", {
2470
+ r.taxes?.map((e, n) => /* @__PURE__ */ d("div", {
1980
2471
  className: "flex items-center justify-between text-gray-600",
1981
- children: [/* @__PURE__ */ y("span", {
2472
+ children: [/* @__PURE__ */ d("span", {
1982
2473
  className: "text-sm",
1983
2474
  children: [
1984
2475
  e.label,
@@ -1986,94 +2477,94 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
1986
2477
  e.percentage,
1987
2478
  "%)"
1988
2479
  ]
1989
- }), /* @__PURE__ */ v("span", {
2480
+ }), /* @__PURE__ */ u("span", {
1990
2481
  className: "text-sm",
1991
- children: Q({
2482
+ children: $({
1992
2483
  unit_amount: e.amount,
1993
2484
  currency: t?.currency
1994
2485
  })
1995
2486
  })]
1996
2487
  }, e.id || e._id || n)),
1997
- /* @__PURE__ */ y("div", {
2488
+ /* @__PURE__ */ d("div", {
1998
2489
  className: "mt-1 flex items-center justify-between border-t border-t-gray-200 pt-1 font-medium",
1999
- children: [/* @__PURE__ */ v("span", {
2490
+ children: [/* @__PURE__ */ u("span", {
2000
2491
  className: "text-md",
2001
2492
  children: "Payable"
2002
- }), /* @__PURE__ */ v("span", {
2493
+ }), /* @__PURE__ */ u("span", {
2003
2494
  className: "text-md",
2004
- children: Q({
2495
+ children: $({
2005
2496
  unit_amount: r.total_amount,
2006
2497
  currency: t?.currency
2007
2498
  })
2008
2499
  })]
2009
2500
  })
2010
2501
  ]
2011
- }) : r ? /* @__PURE__ */ y("div", {
2502
+ }) : r ? /* @__PURE__ */ d("div", {
2012
2503
  className: "mt-2",
2013
2504
  children: [
2014
- /* @__PURE__ */ y("div", {
2505
+ /* @__PURE__ */ d("div", {
2015
2506
  className: "flex items-center justify-between",
2016
- children: [/* @__PURE__ */ v("span", {
2507
+ children: [/* @__PURE__ */ u("span", {
2017
2508
  className: "text-md",
2018
2509
  children: "Subtotal"
2019
- }), /* @__PURE__ */ v("span", {
2510
+ }), /* @__PURE__ */ u("span", {
2020
2511
  className: "text-md",
2021
- children: Q({
2512
+ children: $({
2022
2513
  unit_amount: r.base_amount,
2023
2514
  currency: t?.currency
2024
2515
  })
2025
2516
  })]
2026
2517
  }),
2027
- /* @__PURE__ */ y("div", {
2518
+ /* @__PURE__ */ d("div", {
2028
2519
  className: "flex items-center justify-between text-green-600",
2029
- children: [/* @__PURE__ */ v("span", {
2520
+ children: [/* @__PURE__ */ u("span", {
2030
2521
  className: "text-md",
2031
2522
  children: "Discount"
2032
- }), /* @__PURE__ */ y("span", {
2523
+ }), /* @__PURE__ */ d("span", {
2033
2524
  className: "text-md",
2034
2525
  children: [
2035
2526
  "-",
2036
2527
  " ",
2037
- Q({
2528
+ $({
2038
2529
  unit_amount: r.discount,
2039
2530
  currency: t?.currency
2040
2531
  })
2041
2532
  ]
2042
2533
  })]
2043
2534
  }),
2044
- /* @__PURE__ */ y("div", {
2535
+ /* @__PURE__ */ d("div", {
2045
2536
  className: "mt-1 flex items-center justify-between border-t border-t-gray-200 pt-1 font-medium",
2046
- children: [/* @__PURE__ */ v("span", {
2537
+ children: [/* @__PURE__ */ u("span", {
2047
2538
  className: "text-md",
2048
2539
  children: "Payable"
2049
- }), /* @__PURE__ */ v("span", {
2540
+ }), /* @__PURE__ */ u("span", {
2050
2541
  className: "text-md",
2051
- children: Q({
2542
+ children: $({
2052
2543
  unit_amount: r.sale_amount,
2053
2544
  currency: t?.currency
2054
2545
  })
2055
2546
  })]
2056
2547
  })
2057
2548
  ]
2058
- }) : l ? /* @__PURE__ */ y("div", {
2549
+ }) : l ? /* @__PURE__ */ d("div", {
2059
2550
  className: "mt-2",
2060
2551
  children: [
2061
- /* @__PURE__ */ y("div", {
2552
+ /* @__PURE__ */ d("div", {
2062
2553
  className: "flex items-center justify-between",
2063
- children: [/* @__PURE__ */ v("span", {
2554
+ children: [/* @__PURE__ */ u("span", {
2064
2555
  className: "text-md",
2065
2556
  children: "Subtotal"
2066
- }), /* @__PURE__ */ v("span", {
2557
+ }), /* @__PURE__ */ u("span", {
2067
2558
  className: "text-md",
2068
- children: Q({
2559
+ children: $({
2069
2560
  unit_amount: t.subtotal,
2070
2561
  currency: t?.currency
2071
2562
  })
2072
2563
  })]
2073
2564
  }),
2074
- t.taxes.map((e, n) => /* @__PURE__ */ y("div", {
2565
+ t.taxes.map((e, n) => /* @__PURE__ */ d("div", {
2075
2566
  className: "flex items-center justify-between text-gray-600",
2076
- children: [/* @__PURE__ */ y("span", {
2567
+ children: [/* @__PURE__ */ d("span", {
2077
2568
  className: "text-sm",
2078
2569
  children: [
2079
2570
  e.label,
@@ -2081,81 +2572,81 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
2081
2572
  e.percentage,
2082
2573
  "%)"
2083
2574
  ]
2084
- }), /* @__PURE__ */ v("span", {
2575
+ }), /* @__PURE__ */ u("span", {
2085
2576
  className: "text-sm",
2086
- children: Q({
2577
+ children: $({
2087
2578
  unit_amount: e.amount,
2088
2579
  currency: t?.currency
2089
2580
  })
2090
2581
  })]
2091
2582
  }, e.id || e._id || n)),
2092
- /* @__PURE__ */ y("div", {
2583
+ /* @__PURE__ */ d("div", {
2093
2584
  className: "mt-1 flex items-center justify-between border-t border-t-gray-200 pt-1 font-medium",
2094
- children: [/* @__PURE__ */ v("span", {
2585
+ children: [/* @__PURE__ */ u("span", {
2095
2586
  className: "text-md",
2096
2587
  children: "Payable"
2097
- }), /* @__PURE__ */ v("span", {
2588
+ }), /* @__PURE__ */ u("span", {
2098
2589
  className: "text-md",
2099
- children: Q({
2590
+ children: $({
2100
2591
  unit_amount: t.total,
2101
2592
  currency: t?.currency
2102
2593
  })
2103
2594
  })]
2104
2595
  }),
2105
- t.tax_inclusive && /* @__PURE__ */ v("p", {
2596
+ t.tax_inclusive && /* @__PURE__ */ u("p", {
2106
2597
  className: "mt-1 text-gray-500 text-xs",
2107
2598
  children: "* Price is inclusive of taxes"
2108
2599
  })
2109
2600
  ]
2110
- }) : /* @__PURE__ */ v("div", {
2601
+ }) : /* @__PURE__ */ u("div", {
2111
2602
  className: "mt-2",
2112
- children: /* @__PURE__ */ y("div", {
2603
+ children: /* @__PURE__ */ d("div", {
2113
2604
  className: "flex items-center justify-between font-medium",
2114
- children: [/* @__PURE__ */ v("span", {
2605
+ children: [/* @__PURE__ */ u("span", {
2115
2606
  className: "text-md",
2116
2607
  children: "Payable"
2117
- }), /* @__PURE__ */ v("span", {
2608
+ }), /* @__PURE__ */ u("span", {
2118
2609
  className: "text-md",
2119
- children: Q(t)
2610
+ children: $(t)
2120
2611
  })]
2121
2612
  })
2122
2613
  })]
2123
- }), r ? /* @__PURE__ */ v("div", {
2614
+ }), r ? /* @__PURE__ */ u("div", {
2124
2615
  className: "flex flex-col justify-between gap-1 py-2",
2125
- children: /* @__PURE__ */ y("div", {
2616
+ children: /* @__PURE__ */ d("div", {
2126
2617
  className: "mt-2 mb-1 space-y-1 rounded-lg border border-green-200 bg-green-50 px-3 py-3",
2127
- children: [/* @__PURE__ */ y("div", {
2618
+ children: [/* @__PURE__ */ d("div", {
2128
2619
  className: "flex items-start justify-between gap-2",
2129
- children: [/* @__PURE__ */ y("div", {
2620
+ children: [/* @__PURE__ */ d("div", {
2130
2621
  className: "flex max-w-16 items-center gap-2",
2131
- children: [/* @__PURE__ */ v("div", {
2622
+ children: [/* @__PURE__ */ u("div", {
2132
2623
  className: "rounded bg-green-500 p-2",
2133
- children: /* @__PURE__ */ v(ee, {
2624
+ children: /* @__PURE__ */ u(j, {
2134
2625
  size: 16,
2135
2626
  className: "text-white"
2136
2627
  })
2137
- }), /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("div", {
2628
+ }), /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("div", {
2138
2629
  className: "font-medium text-green-700 text-xs uppercase opacity-60",
2139
2630
  children: "Coupon Applied"
2140
- }), /* @__PURE__ */ v("div", {
2631
+ }), /* @__PURE__ */ u("div", {
2141
2632
  className: "-mt-0.5 max-w-32 truncate font-bold text-green-900 text-sm tracking-wide",
2142
2633
  children: i
2143
2634
  })] })]
2144
- }), /* @__PURE__ */ v("button", {
2635
+ }), /* @__PURE__ */ u("button", {
2145
2636
  type: "button",
2146
2637
  onClick: s,
2147
2638
  className: "rounded-md p-1 text-green-600 transition-colors hover:bg-green-100 hover:text-green-800",
2148
2639
  "aria-label": "Remove coupon",
2149
- children: /* @__PURE__ */ v(j, { size: 18 })
2640
+ children: /* @__PURE__ */ u(re, { size: 18 })
2150
2641
  })]
2151
- }), /* @__PURE__ */ y("div", {
2642
+ }), /* @__PURE__ */ d("div", {
2152
2643
  className: "text-green-700 text-xs",
2153
2644
  children: [
2154
2645
  "You are saving",
2155
2646
  " ",
2156
- /* @__PURE__ */ v("span", {
2647
+ /* @__PURE__ */ u("span", {
2157
2648
  className: "font-semibold",
2158
- children: Q({
2649
+ children: $({
2159
2650
  unit_amount: r.discount,
2160
2651
  currency: t?.currency
2161
2652
  })
@@ -2163,33 +2654,33 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
2163
2654
  ]
2164
2655
  })]
2165
2656
  })
2166
- }) : /* @__PURE__ */ y("div", {
2167
- className: X("flex cursor-pointer items-center justify-between border-b border-b-gray-300 pr-1 pl-4 transition-all duration-200 hover:bg-gray-50", t ? "h-[50px] py-3" : "py-3"),
2657
+ }) : /* @__PURE__ */ d("div", {
2658
+ className: bn("flex cursor-pointer items-center justify-between border-b border-b-gray-300 pr-1 pl-4 transition-all duration-200 hover:bg-gray-50", t ? "h-[50px] py-3" : "py-3"),
2168
2659
  onClick: () => t ? o() : null,
2169
- children: [/* @__PURE__ */ y("span", {
2660
+ children: [/* @__PURE__ */ d("span", {
2170
2661
  className: "flex items-center gap-2",
2171
- children: ["Apply Coupon", a > 0 && /* @__PURE__ */ v("span", {
2662
+ children: ["Apply Coupon", a > 0 && /* @__PURE__ */ u("span", {
2172
2663
  className: "rounded-full bg-gray-200 px-2 py-0.5 text-gray-600 text-xs",
2173
2664
  children: a
2174
2665
  })]
2175
- }), /* @__PURE__ */ v("span", { children: /* @__PURE__ */ v(k, {}) })]
2666
+ }), /* @__PURE__ */ u("span", { children: /* @__PURE__ */ u(A, {}) })]
2176
2667
  })]
2177
2668
  })]
2178
- }), /* @__PURE__ */ v("div", {
2669
+ }), /* @__PURE__ */ u("div", {
2179
2670
  className: "mt-3 flex justify-start",
2180
- children: /* @__PURE__ */ v(Z, {
2671
+ children: /* @__PURE__ */ u(Q, {
2181
2672
  onClick: c,
2182
2673
  className: "rounded-lg bg-brand px-6 py-2 font-semibold text-brand-foreground hover:opacity-90",
2183
2674
  children: "Continue for Payment"
2184
2675
  })
2185
2676
  })] });
2186
- }, zt = () => {
2187
- let [e, t] = g(null), [n, r] = g(null), [i, a] = g(!1), [o, s] = g(null);
2677
+ }, Nn = () => {
2678
+ let [e, t] = S(null), [n, r] = S(null), [i, a] = S(!1), [o, s] = S(null);
2188
2679
  return {
2189
2680
  stripePromise: e,
2190
2681
  config: n,
2191
2682
  isOpen: i,
2192
- openStripeCheckout: u(async (e) => {
2683
+ openStripeCheckout: g(async (e) => {
2193
2684
  try {
2194
2685
  let { loadStripe: n } = await import("@stripe/stripe-js");
2195
2686
  t(n(e.key)), r({ clientSecret: e.client_secret }), a(!0);
@@ -2197,17 +2688,17 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
2197
2688
  console.error("Failed to initialize Stripe checkout:", e);
2198
2689
  }
2199
2690
  }, []),
2200
- closeStripeCheckout: u(() => {
2691
+ closeStripeCheckout: g(() => {
2201
2692
  a(!1), setTimeout(() => {
2202
2693
  r(null), t(null);
2203
2694
  }, 300);
2204
2695
  }, []),
2205
2696
  onComplete: o,
2206
- setOnComplete: u((e) => {
2697
+ setOnComplete: g((e) => {
2207
2698
  s(() => e);
2208
2699
  }, [])
2209
2700
  };
2210
- }, Bt = {
2701
+ }, Pn = {
2211
2702
  name: "",
2212
2703
  email: "",
2213
2704
  is_business_purchase: !1,
@@ -2223,32 +2714,32 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
2223
2714
  country: ""
2224
2715
  }
2225
2716
  }
2226
- }, Vt = (e, t, n) => {
2717
+ }, Fn = (e, t, n) => {
2227
2718
  let r = t.split("."), i = structuredClone(e), a = i, o = r.length - 1;
2228
2719
  return r.forEach((e, t) => {
2229
2720
  t === o ? a[e] = n : a = a[e];
2230
2721
  }), i;
2231
- }, Ht = async (e, t) => {
2722
+ }, In = async (e, t) => {
2232
2723
  try {
2233
2724
  let n = new URLSearchParams();
2234
2725
  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;
2235
2726
  } catch (t) {
2236
- e.logger?.error("Failed to fetch event tickets", { exception: x(t) });
2727
+ e.logger?.error("Failed to fetch event tickets", { exception: c(t) });
2237
2728
  }
2238
- }, Ut = ({ eventID: e, title: t, external: r, buttonText: i = "Register Now" }) => {
2239
- let a = n(), [o, s] = g([]), [c, l] = g(!0), [d, p] = g(!1), [m, b] = g(!1), [S, C] = g(null), [w, E] = g(void 0), [D, O] = g(""), [k, A] = g(null), [ee, j] = g(!1), [re, M] = g(null), [N, P] = g(!1), [ie, F] = g(1), [I, L] = g(null), [ae, oe] = g([]), [se, R] = g(Bt), z = h(null), ce = () => R(Bt), le = () => {
2240
- A(null), E(void 0), M(null), j(!1), O(""), L(null), p(!1), F(1), ce();
2241
- }, { Razorpay: ue } = ne(), { stripePromise: B, config: V, isOpen: H, openStripeCheckout: U, closeStripeCheckout: W, setOnComplete: de } = zt(), fe = () => {
2242
- let e = z.current;
2729
+ }, Ln = ({ eventID: e, title: t, external: n, buttonText: r = "Register Now" }) => {
2730
+ let a = i(), [o, s] = S([]), [f, p] = S(!0), [m, h] = S(!1), [_, y] = S(!1), [b, w] = S(null), [T, E] = S(void 0), [D, O] = S(""), [ee, k] = S(null), [te, A] = S(!1), [ne, j] = S(null), [re, P] = S(!1), [ie, F] = S(1), [I, L] = S(null), [ae, R] = S([]), [z, oe] = S(Pn), B = En(b, ee) === 0, V = x(null), se = () => oe(Pn), H = () => {
2731
+ k(null), E(void 0), j(null), A(!1), O(""), L(null), h(!1), F(1), se();
2732
+ }, { Razorpay: U } = N(), { stripePromise: W, config: ce, isOpen: G, openStripeCheckout: le, closeStripeCheckout: K, setOnComplete: ue } = Nn(), q = () => {
2733
+ let e = V.current;
2243
2734
  !e || !a || a.fetch?.url(`/v1/event/booking/${e.bookingId}/confirm-booking`)?.post({ session_id: e.sessionId })?.json().then((e) => {
2244
- e?.content?.data && E(e?.content?.data), W(), z.current = null;
2735
+ e?.content?.data && E(e?.content?.data), K(), V.current = null;
2245
2736
  }).catch((e) => {
2246
- a.logger?.error("Failed to confirm booking after Stripe payment", { exception: x(e) }), W(), z.current = null;
2737
+ a.logger?.error("Failed to confirm booking after Stripe payment", { exception: c(e) }), K(), V.current = null;
2247
2738
  });
2248
- }, pe = async () => {
2739
+ }, de = async () => {
2249
2740
  if (!a) return;
2250
- b(!0), L(null);
2251
- let { name: t, email: n, is_business_purchase: r, billing_details: i } = se;
2741
+ y(!0), L(null);
2742
+ let { name: t, email: n, is_business_purchase: r, billing_details: i } = z;
2252
2743
  try {
2253
2744
  let o = {
2254
2745
  event: e,
@@ -2256,29 +2747,29 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
2256
2747
  attendees: [{
2257
2748
  name: t,
2258
2749
  email: n,
2259
- ticket: S?._id,
2750
+ ticket: b?._id,
2260
2751
  details: {}
2261
2752
  }]
2262
2753
  };
2263
- r && (o.is_business_purchase = !0, o.billing_details = i);
2754
+ r && !B && (o.is_business_purchase = !0, o.billing_details = i);
2264
2755
  let s = await a.fetch?.url(`/v1/event/event/${e}/booking/create-new-booking`)?.post(o).json();
2265
2756
  if (!s?.status) L("Booking failed. Please try again.");
2266
2757
  else {
2267
- le();
2758
+ H();
2268
2759
  let e = s?.content?.meta;
2269
2760
  if (e?.key) {
2270
2761
  let t = s?.content.data?._id;
2271
- e.provider === "stripe" && e.client_secret ? (z.current = t && e.session_id ? {
2762
+ e.provider === "stripe" && e.client_secret ? (V.current = t && e.session_id ? {
2272
2763
  bookingId: t,
2273
2764
  sessionId: e.session_id
2274
- } : null, de(fe), await U({
2765
+ } : null, ue(q), await le({
2275
2766
  key: e.key,
2276
2767
  client_secret: e.client_secret,
2277
2768
  amount: s?.content.data?.unit_amount || 0,
2278
2769
  currency: e.currency || "USD",
2279
2770
  provider: "stripe",
2280
2771
  reference_id: e.reference_id || ""
2281
- })) : me({
2772
+ })) : fe({
2282
2773
  key: e.key,
2283
2774
  amount: s?.content.data?.unit_amount,
2284
2775
  currency: e.currency || "INR",
@@ -2288,12 +2779,12 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
2288
2779
  } else E(s?.content.data);
2289
2780
  }
2290
2781
  } catch (e) {
2291
- L(x(e).message || "Something went wrong. Please try again.");
2782
+ L(c(e).message || "Something went wrong. Please try again.");
2292
2783
  }
2293
- b(!1);
2294
- }, me = async (e) => {
2784
+ y(!1);
2785
+ }, fe = async (e) => {
2295
2786
  if (!a) return;
2296
- let n = new ue({
2787
+ let n = new U({
2297
2788
  key: e.key,
2298
2789
  amount: e.amount ?? 0,
2299
2790
  currency: e.currency,
@@ -2308,7 +2799,7 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
2308
2799
  })?.json().then((e) => {
2309
2800
  e?.content?.data?.status && E(e?.content?.data);
2310
2801
  }).catch((e) => {
2311
- a.logger?.error("Failed to confirm Razorpay booking", { exception: x(e) });
2802
+ a.logger?.error("Failed to confirm Razorpay booking", { exception: c(e) });
2312
2803
  });
2313
2804
  },
2314
2805
  prefill: {
@@ -2319,19 +2810,19 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
2319
2810
  theme: { color: "#FC751A" }
2320
2811
  });
2321
2812
  n.on("payment.failed", (e) => {
2322
- a.logger?.error("Razorpay payment failed", { exception: x(e.error) });
2813
+ a.logger?.error("Razorpay payment failed", { exception: c(e.error) });
2323
2814
  }), n.open();
2324
- }, G = u(async () => {
2815
+ }, pe = g(async () => {
2325
2816
  if (a) try {
2326
2817
  let t = await a.fetch?.url(`/v1/event/event/${e}/coupon/list-public-coupons`)?.get().json();
2327
- t?.status && t?.content?.data && oe(t.content.data);
2818
+ t?.status && t?.content?.data && R(t.content.data);
2328
2819
  } catch (e) {
2329
- a.logger?.error("Failed to fetch public coupons", { exception: x(e) });
2820
+ a.logger?.error("Failed to fetch public coupons", { exception: c(e) });
2330
2821
  }
2331
- }, [a, e]), he = async (t) => {
2822
+ }, [a, e]), me = async (t) => {
2332
2823
  if (!a) return;
2333
2824
  let n = t ?? D;
2334
- j(!0), M(null);
2825
+ A(!0), j(null);
2335
2826
  try {
2336
2827
  let t = await a.fetch?.url(`/v1/event/event/${e}/coupon/validate-coupon-code`)?.post({
2337
2828
  coupon: n,
@@ -2339,140 +2830,141 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
2339
2830
  attendees: [{
2340
2831
  name: "",
2341
2832
  email: "",
2342
- ticket: S?._id
2833
+ ticket: b?._id
2343
2834
  }]
2344
2835
  }).json();
2345
- t?.status && (A(t.content.data), O(n)), P(!1), j(!1);
2836
+ t?.status && (k(t.content.data), O(n)), P(!1), A(!1);
2346
2837
  } catch (e) {
2347
- M(x(e).message), j(!1);
2838
+ j(c(e).message), A(!1);
2348
2839
  }
2349
- }, ge = (e) => {
2350
- O(""), A(null), M(null), j(!1), L(null), C(e);
2840
+ }, he = (e) => {
2841
+ O(""), k(null), j(null), A(!1), L(null), w(e);
2842
+ }, ge = () => {
2843
+ k(null), j(null), O("");
2351
2844
  }, _e = () => {
2352
- A(null), M(null), O("");
2353
- }, ve = () => {
2354
- M(null), j(!1), O(""), P(!1);
2355
- }, ye = (e) => {
2845
+ j(null), A(!1), O(""), P(!1);
2846
+ }, ve = (e) => {
2356
2847
  let { name: t, value: n, type: r, checked: i } = e.target;
2357
- R((e) => Vt(e, t, r === "checkbox" ? i : n));
2358
- }, be = () => {}, xe = (e) => {
2359
- e?.preventDefault(), pe();
2848
+ oe((e) => Fn(e, t, r === "checkbox" ? i : n));
2849
+ }, ye = () => {}, be = (e) => {
2850
+ e?.preventDefault(), de();
2360
2851
  };
2361
- if (f(() => {
2362
- if (r) {
2363
- l(!1);
2852
+ if (v(() => {
2853
+ if (n) {
2854
+ p(!1);
2364
2855
  return;
2365
2856
  }
2366
- e && a && (l(!0), Ht(a, e).then((e) => {
2367
- s(e ?? []), e && e.length > 0 && C(e[0] || null), l(!1);
2857
+ e && a && (p(!0), In(a, e).then((e) => {
2858
+ s(e ?? []), e && e.length > 0 && w(e[0] || null), p(!1);
2368
2859
  }));
2369
2860
  }, [
2370
2861
  e,
2371
- r,
2862
+ n,
2372
2863
  a
2373
- ]), f(() => {
2374
- S?.unit_amount === 0 && o?.length === 1 && F(2);
2375
- }, [S, o]), f(() => {
2376
- d && e && G();
2864
+ ]), v(() => {
2865
+ b?.unit_amount === 0 && o?.length === 1 && F(2);
2866
+ }, [b, o]), v(() => {
2867
+ m && e && pe();
2377
2868
  }, [
2378
- d,
2869
+ m,
2379
2870
  e,
2380
- G
2381
- ]), r) return /* @__PURE__ */ v("div", {
2871
+ pe
2872
+ ]), n) return /* @__PURE__ */ u("div", {
2382
2873
  className: "my-2",
2383
- children: /* @__PURE__ */ v(Z, {
2874
+ children: /* @__PURE__ */ u(Q, {
2384
2875
  className: "rounded-lg bg-brand px-4 py-3 font-semibold text-brand-foreground hover:opacity-90",
2385
- onClick: () => window.open(r, "_blank", "noopener,noreferrer"),
2386
- children: i
2876
+ onClick: () => window.open(n, "_blank", "noopener,noreferrer"),
2877
+ children: r
2387
2878
  })
2388
2879
  });
2389
- if (c) return /* @__PURE__ */ v("div", {
2880
+ if (f) return /* @__PURE__ */ u("div", {
2390
2881
  className: "my-2",
2391
- children: /* @__PURE__ */ v(Z, {
2882
+ children: /* @__PURE__ */ u(Q, {
2392
2883
  className: "rounded-lg bg-brand px-4 py-2 font-bold text-brand-foreground",
2393
2884
  children: "Loading..."
2394
2885
  })
2395
2886
  });
2396
- let Se = k?.sale_amount === 0 || S?.unit_amount === 0 ? "Complete Registration" : "Pay";
2397
- return /* @__PURE__ */ y(_, { children: [
2398
- /* @__PURE__ */ v("div", {
2887
+ let xe = B ? "Complete Registration" : "Pay";
2888
+ return /* @__PURE__ */ d(l, { children: [
2889
+ /* @__PURE__ */ u("div", {
2399
2890
  className: "my-2",
2400
- children: o?.length ? /* @__PURE__ */ v(Z, {
2401
- onClick: () => p(!0),
2891
+ children: o?.length ? /* @__PURE__ */ u(Q, {
2892
+ onClick: () => h(!0),
2402
2893
  className: "rounded-lg bg-brand px-4 py-3 font-semibold text-brand-foreground hover:opacity-90",
2403
- children: i
2404
- }) : /* @__PURE__ */ v("p", {
2894
+ children: r
2895
+ }) : /* @__PURE__ */ u("p", {
2405
2896
  className: "text-red-500",
2406
2897
  children: "No tickets available for this event."
2407
2898
  })
2408
2899
  }),
2409
- /* @__PURE__ */ v(T.Root, {
2410
- open: d,
2900
+ /* @__PURE__ */ u(C.Root, {
2901
+ open: m,
2411
2902
  onOpenChange: (e) => {
2412
- e || le();
2903
+ e || H();
2413
2904
  },
2414
- children: /* @__PURE__ */ y(T.Portal, { children: [/* @__PURE__ */ v(T.Backdrop, { className: "fixed inset-0 z-[100] bg-black/50" }), /* @__PURE__ */ y(T.Popup, {
2415
- className: X("fixed top-24 left-1/2 z-[100] flex max-h-[calc(100vh-7rem)] w-[90%] -translate-x-1/2 flex-col overflow-y-auto rounded-lg bg-white p-4", N ? "md:w-[30%]" : "md:w-[40%]"),
2416
- children: [/* @__PURE__ */ y("div", {
2417
- className: `mb-4 flex w-full items-start justify-between ${N ? "" : "pb-[6px]"} `,
2418
- children: [/* @__PURE__ */ y(T.Title, {
2905
+ children: /* @__PURE__ */ d(C.Portal, { children: [/* @__PURE__ */ u(C.Backdrop, { className: "fixed inset-0 z-[100] bg-black/50" }), /* @__PURE__ */ d(C.Popup, {
2906
+ className: bn("fixed top-24 left-1/2 z-[100] flex max-h-[calc(100dvh-12rem)] w-[90%] -translate-x-1/2 flex-col overflow-y-auto rounded-lg bg-white p-4", re ? "md:w-[30%]" : "md:w-[40%]"),
2907
+ children: [/* @__PURE__ */ d("div", {
2908
+ className: `mb-4 flex w-full items-start justify-between ${re ? "" : "pb-[6px]"} `,
2909
+ children: [/* @__PURE__ */ d(C.Title, {
2419
2910
  className: "font-semibold text-lg",
2420
2911
  children: [
2421
2912
  "Register for ",
2422
2913
  t,
2423
2914
  "!"
2424
2915
  ]
2425
- }), /* @__PURE__ */ v(T.Close, {
2916
+ }), /* @__PURE__ */ u(C.Close, {
2426
2917
  className: "rounded-md p-2 hover:bg-gray-100 focus:outline-none",
2427
- children: /* @__PURE__ */ v(te, { className: "size-4" })
2918
+ children: /* @__PURE__ */ u(M, { className: "size-4" })
2428
2919
  })]
2429
- }), /* @__PURE__ */ y("div", { children: [I && /* @__PURE__ */ v("div", {
2920
+ }), /* @__PURE__ */ d("div", { children: [I && /* @__PURE__ */ u("div", {
2430
2921
  className: "mb-4 rounded-md bg-red-50 p-3 text-red-600 text-sm",
2431
2922
  children: I
2432
- }), ie === 1 ? /* @__PURE__ */ v("div", { children: N ? /* @__PURE__ */ v(Pt, {
2923
+ }), ie === 1 ? /* @__PURE__ */ u("div", { children: re ? /* @__PURE__ */ u(On, {
2433
2924
  couponCode: D,
2434
2925
  onCouponCodeChange: O,
2435
- couponError: re,
2436
- couponLoading: ee,
2437
- onValidateCoupon: he,
2926
+ couponError: ne,
2927
+ couponLoading: te,
2928
+ onValidateCoupon: me,
2438
2929
  publicCoupons: ae,
2439
- onBack: ve,
2440
- selectedTicket: S
2441
- }) : /* @__PURE__ */ v(Rt, {
2930
+ onBack: _e,
2931
+ selectedTicket: b
2932
+ }) : /* @__PURE__ */ u(Mn, {
2442
2933
  tickets: o,
2443
- selectedTicket: S,
2444
- onSelectTicket: ge,
2445
- discount: k,
2934
+ selectedTicket: b,
2935
+ onSelectTicket: he,
2936
+ discount: ee,
2446
2937
  couponCode: D,
2447
2938
  publicCouponsCount: ae.length,
2448
2939
  onApplyCouponClick: () => P(!0),
2449
- onRemoveCoupon: _e,
2940
+ onRemoveCoupon: ge,
2450
2941
  onNext: () => F(2)
2451
- }) }) : /* @__PURE__ */ v(kt, {
2452
- values: se,
2453
- handleChange: ye,
2454
- handleBlur: be,
2455
- handleSubmit: xe,
2456
- registerLoading: m,
2942
+ }) }) : /* @__PURE__ */ u(xn, {
2943
+ values: z,
2944
+ handleChange: ve,
2945
+ handleBlur: ye,
2946
+ handleSubmit: be,
2947
+ registerLoading: _,
2457
2948
  onBack: () => F(1),
2458
- submitLabel: Se
2949
+ submitLabel: xe,
2950
+ showBusinessBilling: !B
2459
2951
  })] })]
2460
2952
  })] })
2461
2953
  }),
2462
- w && /* @__PURE__ */ v(It, {
2463
- paymentData: w,
2954
+ T && /* @__PURE__ */ u(An, {
2955
+ paymentData: T,
2464
2956
  ticketData: o,
2465
2957
  type: "confirm"
2466
2958
  }),
2467
- H && V && /* @__PURE__ */ v(Lt, {
2468
- isOpen: H,
2469
- onClose: W,
2470
- stripePromise: B,
2471
- clientSecret: V.clientSecret,
2472
- onComplete: fe
2959
+ G && ce && /* @__PURE__ */ u(jn, {
2960
+ isOpen: G,
2961
+ onClose: K,
2962
+ stripePromise: W,
2963
+ clientSecret: ce.clientSecret,
2964
+ onComplete: q
2473
2965
  })
2474
2966
  ] });
2475
- }, Wt = (e) => typeof e == "string" && e.trim() ? e : void 0, Gt = (e) => typeof e == "string" ? e : e?.location ?? void 0, Kt = (e, t) => {
2967
+ }, Rn = (e) => typeof e == "string" && e.trim() ? e : void 0, zn = (e) => typeof e == "string" ? e : e?.location ?? void 0, Bn = (e, t) => {
2476
2968
  let n = e.meta ?? {}, r = e.title && t ? `${e.title} | ${t}` : e.title || t || void 0;
2477
2969
  return {
2478
2970
  title: n.meta_title || r,
@@ -2482,33 +2974,33 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
2482
2974
  og: {
2483
2975
  title: n.og_title || void 0,
2484
2976
  description: n.og_description || void 0,
2485
- image: Gt(n.og_image),
2977
+ image: zn(n.og_image),
2486
2978
  url: n.og_url || void 0
2487
2979
  },
2488
2980
  twitter: { card: n.twitter_card || void 0 },
2489
2981
  ldJson: n.ld_json || void 0,
2490
2982
  customHead: n.head_code || void 0
2491
2983
  };
2492
- }, qt = (e) => ({
2984
+ }, Vn = (e) => ({
2493
2985
  description: e.description || void 0,
2494
2986
  icon: e.icon?.location || void 0,
2495
2987
  customHead: e.settings?.head_code || void 0
2496
- }), Jt = (e) => (t = {}, n) => (r) => {
2497
- let i = Kt(t, e.name);
2988
+ }), Hn = (e) => (t = {}, n) => (r) => {
2989
+ let i = Bn(t, e.name);
2498
2990
  if (n) {
2499
2991
  let t = r?.loaderData?.[n.source];
2500
2992
  if (t) {
2501
- let r = n.title ? Wt(t[n.title]) : void 0;
2993
+ let r = n.title ? Rn(t[n.title]) : void 0;
2502
2994
  r && (i.title = e.name ? `${r} | ${e.name}` : r, i.og = {
2503
2995
  ...i.og,
2504
2996
  title: r
2505
2997
  });
2506
- let a = n.description ? Wt(t[n.description]) : void 0;
2998
+ let a = n.description ? Rn(t[n.description]) : void 0;
2507
2999
  a && (i.description = a, i.og = {
2508
3000
  ...i.og,
2509
3001
  description: a
2510
3002
  });
2511
- let o = n.image ? Gt(t[n.image]) : void 0;
3003
+ let o = n.image ? zn(t[n.image]) : void 0;
2512
3004
  o && (i.og = {
2513
3005
  ...i.og,
2514
3006
  image: o
@@ -2519,19 +3011,22 @@ var kt = ({ values: e, handleChange: t, handleBlur: n, handleSubmit: r, register
2519
3011
  let t = r?.match?.pathname, n = (e.domain || "").trim();
2520
3012
  n && t?.startsWith("/") && (i.canonical = (/^https?:\/\//.test(n) ? n : `https://${n}`).replace(/\/+$/, "") + t);
2521
3013
  }
2522
- let a = Dt(i, qt(e)), o = t.id?.trim();
3014
+ let a = vn(i, Vn(e)), o = t.id?.trim();
2523
3015
  return o && a.meta.push({
2524
- name: _t,
3016
+ name: cn,
2525
3017
  content: o
2526
3018
  }), a;
2527
- }, Yt = (e) => {
2528
- let t = I(e);
2529
- return (e) => ({ context: n, params: r }) => G({
2530
- queryClient: n.queryClient,
2531
- config: t,
2532
- sources: e,
2533
- params: r
2534
- });
3019
+ }, Un = (e) => {
3020
+ let t = q(e);
3021
+ return (e, n) => {
3022
+ let { rules: r, invalid: i } = H(n?.access), a = r.length > 0 || i;
3023
+ return ({ context: n, params: r }) => a ? Promise.resolve({}) : be({
3024
+ queryClient: n.queryClient,
3025
+ config: t,
3026
+ sources: e,
3027
+ params: r
3028
+ });
3029
+ };
2535
3030
  };
2536
3031
  //#endregion
2537
- export { le as ColorModeProvider, ht as Inspector, ie as LevoChat, Ut as LevoEventRegister, ge as LevoForm, bt as LevoPopups, Ct as LevoSiteProvider, _t as PAGE_ID_META, Ot as PageHead, Jt as createLevoHead, Yt as createLevoLoader, F as createSiteClient, Dt as pageHead, Et as parseRawHead, G as prefetchLevoSources, vt as readPageId, I as siteConfigFromJson, ue as useColorMode, me as useLevoForm, St as useLevoInsights, pe as useLevoRecord, xt as useLevoSite, fe as useLevoSource };
3032
+ export { nt as ColorModeProvider, on as Inspector, L as LEVO_AUTH_METHODS, Y as LEVO_AUTH_QUERY_KEY, I as LEVO_OAUTH_METHODS, Ve as LEVO_OTP_LENGTH, je as LEVO_PENDING_APPROVAL_CODE, F as LEVO_PRIMARY_AUTH_METHODS, Je as LevoChat, we as LevoEntryForm, Ln as LevoEventRegister, it as LevoForm, dn as LevoPopups, ke as LevoProfileForm, mn as LevoSiteProvider, cn as PAGE_ID_META, yn as PageHead, Hn as createLevoHead, Un as createLevoLoader, ue as createSiteClient, K as decideAccess, Me as isPendingApprovalError, He as isValidEmail, Ue as isValidOtp, Ge as isValidPhone, We as normalizePhone, vn as pageHead, H as parseAccess, _n as parseRawHead, be as prefetchLevoSources, ln as readPageId, U as resolveAuthMethods, q as siteConfigFromJson, rt as useColorMode, Ae as useLevoAccess, Ce as useLevoAuth, ye as useLevoForm, pn as useLevoInsights, Fe as useLevoLogin, Be as useLevoOAuth, Ke as useLevoOtpInput, ve as useLevoRecord, fn as useLevoSite, _e as useLevoSource };