@superwall/studio 1.2.0 → 1.3.0-beta.4

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 (74) hide show
  1. package/README.md +27 -14
  2. package/dist/assets/index-CEz-HnIH.js +11 -0
  3. package/dist/index.html +1 -1
  4. package/dist/lib/StudioApp.d.ts +4 -4
  5. package/dist/lib/components/PaywallToasts.d.ts +3 -0
  6. package/dist/lib/components/SurfaceCard.d.ts +4 -2
  7. package/dist/lib/components/{TopBar.d.ts → chrome/TopBar.d.ts} +1 -2
  8. package/dist/lib/components/icons.d.ts +0 -2
  9. package/dist/lib/components/{ActionMenu.d.ts → menus/ActionMenu.d.ts} +2 -1
  10. package/dist/lib/components/{CompareMenu.d.ts → menus/CompareMenu.d.ts} +1 -1
  11. package/dist/lib/components/{VariablesPanel.d.ts → panels/VariablesPanel.d.ts} +3 -3
  12. package/dist/lib/components/{DeviceChrome.d.ts → preview/DeviceChrome.d.ts} +1 -1
  13. package/dist/lib/components/{DeviceFrame.d.ts → preview/DeviceFrame.d.ts} +5 -2
  14. package/dist/lib/components/preview/HostedIframe.d.ts +7 -0
  15. package/dist/lib/index.d.ts +14 -6
  16. package/dist/lib/index.js +1490 -998
  17. package/dist/lib/lib/actions.d.ts +1 -1
  18. package/dist/lib/lib/contract.d.ts +33 -0
  19. package/dist/lib/lib/devices.d.ts +1 -1
  20. package/dist/lib/lib/host.d.ts +15 -0
  21. package/dist/lib/lib/notices.d.ts +9 -0
  22. package/dist/lib/lib/preview.d.ts +2 -4
  23. package/dist/lib/lib/project.d.ts +2 -1
  24. package/dist/lib/lib/steps.d.ts +5 -0
  25. package/dist/lib/lib/studio-host.d.ts +34 -0
  26. package/dist/lib/lib/surfaces.d.ts +36 -0
  27. package/dist/lib/lib/variables.d.ts +12 -0
  28. package/dist/lib/products.js +26 -12
  29. package/dist/lib/screens/SurfaceEditor.d.ts +2 -3
  30. package/dist/lib/screens/SurfaceList.d.ts +2 -3
  31. package/package.json +5 -1
  32. package/src/StudioApp.tsx +25 -28
  33. package/src/components/PaywallToasts.tsx +162 -86
  34. package/src/components/SurfaceCard.tsx +9 -2
  35. package/src/components/chrome/TopBar.tsx +45 -0
  36. package/src/components/icons.tsx +0 -13
  37. package/src/components/{ActionMenu.tsx → menus/ActionMenu.tsx} +3 -3
  38. package/src/components/{CompareMenu.tsx → menus/CompareMenu.tsx} +2 -2
  39. package/src/components/{SidePanel.tsx → panels/SidePanel.tsx} +1 -1
  40. package/src/components/{VariablesPanel.tsx → panels/VariablesPanel.tsx} +4 -4
  41. package/src/components/{DeviceChrome.tsx → preview/DeviceChrome.tsx} +1 -1
  42. package/src/components/{DeviceFrame.tsx → preview/DeviceFrame.tsx} +14 -55
  43. package/src/components/preview/HostedIframe.tsx +46 -0
  44. package/src/index.ts +32 -12
  45. package/src/lib/actions.ts +1 -1
  46. package/src/lib/contract.ts +30 -0
  47. package/src/lib/devices.ts +5 -4
  48. package/src/lib/host.ts +79 -0
  49. package/src/lib/notices.ts +63 -0
  50. package/src/lib/preview.ts +8 -40
  51. package/src/lib/products.ts +20 -1
  52. package/src/lib/project.ts +2 -1
  53. package/src/lib/steps.ts +20 -0
  54. package/src/lib/studio-host.tsx +61 -0
  55. package/src/lib/surfaces.ts +43 -0
  56. package/src/lib/time.ts +1 -2
  57. package/src/lib/variables.ts +13 -0
  58. package/src/main.tsx +6 -5
  59. package/src/screens/SurfaceEditor.tsx +79 -70
  60. package/src/screens/SurfaceList.tsx +27 -12
  61. package/src/vite-env.d.ts +1 -0
  62. package/dist/assets/index-CVKQ82YR.js +0 -11
  63. package/dist/lib/lib/events.d.ts +0 -27
  64. package/dist/lib/lib/types.d.ts +0 -77
  65. package/src/components/TopBar.tsx +0 -41
  66. package/src/lib/events.ts +0 -86
  67. package/src/lib/types.ts +0 -87
  68. /package/dist/lib/components/{StudioShell.d.ts → chrome/StudioShell.d.ts} +0 -0
  69. /package/dist/lib/components/{Toolbar.d.ts → chrome/Toolbar.d.ts} +0 -0
  70. /package/dist/lib/components/{MissingProducts.d.ts → panels/MissingProducts.d.ts} +0 -0
  71. /package/dist/lib/components/{SidePanel.d.ts → panels/SidePanel.d.ts} +0 -0
  72. /package/src/components/{StudioShell.tsx → chrome/StudioShell.tsx} +0 -0
  73. /package/src/components/{Toolbar.tsx → chrome/Toolbar.tsx} +0 -0
  74. /package/src/components/{MissingProducts.tsx → panels/MissingProducts.tsx} +0 -0
package/dist/lib/index.js CHANGED
@@ -1,221 +1,597 @@
1
- import { jsx as t, jsxs as o, Fragment as U } from "react/jsx-runtime";
1
+ import { jsx as n, jsxs as l, Fragment as Z } from "react/jsx-runtime";
2
2
  import * as d from "react";
3
- import { toast as D, Toaster as Xe } from "sonner";
4
- const et = ({
3
+ import { toast as U, Toaster as kt } from "sonner";
4
+ const It = ({
5
5
  children: e,
6
- position: n = "fixed"
7
- }) => /* @__PURE__ */ t(
6
+ position: t = "fixed"
7
+ }) => /* @__PURE__ */ n(
8
8
  "div",
9
9
  {
10
- className: `sw-studio bg-ink text-cream ${n} inset-0 flex flex-col font-sans text-[0.9375rem] tracking-[-0.01em] antialiased`,
10
+ className: `sw-studio bg-ink text-cream ${t} inset-0 flex flex-col font-sans text-[0.9375rem] tracking-[-0.01em] antialiased`,
11
11
  children: e
12
12
  }
13
- ), y = ({ children: e }) => /* @__PURE__ */ t("svg", { className: "sw-icon", viewBox: "0 0 24 24", "aria-hidden": "true", children: e }), Ie = () => /* @__PURE__ */ o(y, { children: [
14
- /* @__PURE__ */ t("path", { d: "M21 12a9 9 0 1 1-2.64-6.36" }),
15
- /* @__PURE__ */ t("path", { d: "M21 3v6h-6" })
16
- ] }), Z = () => /* @__PURE__ */ o(y, { children: [
17
- /* @__PURE__ */ t("path", { d: "M15 3h6v6" }),
18
- /* @__PURE__ */ t("path", { d: "M10 14 21 3" }),
19
- /* @__PURE__ */ t("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
20
- ] }), tt = () => /* @__PURE__ */ o(y, { children: [
21
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "4" }),
22
- /* @__PURE__ */ t("path", { d: "M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4" })
23
- ] }), nt = () => /* @__PURE__ */ t(y, { children: /* @__PURE__ */ t("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }) }), st = () => /* @__PURE__ */ o(y, { children: [
24
- /* @__PURE__ */ t("path", { d: "M21 4h-7M10 4H3M21 12h-9M8 12H3M21 20h-5M12 20H3" }),
25
- /* @__PURE__ */ t("path", { d: "M14 2v4M8 10v4M16 18v4" })
26
- ] }), Oe = () => /* @__PURE__ */ t(y, { children: /* @__PURE__ */ t("path", { d: "M18 6 6 18M6 6l12 12" }) }), Re = () => /* @__PURE__ */ t(y, { children: /* @__PURE__ */ t("path", { d: "m6 9 6 6 6-6" }) }), at = () => /* @__PURE__ */ o(y, { children: [
27
- /* @__PURE__ */ t("rect", { x: "3", y: "4", width: "18", height: "16" }),
28
- /* @__PURE__ */ t("path", { d: "M12 4v16" })
29
- ] }), we = () => /* @__PURE__ */ o(y, { children: [
30
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "9" }),
31
- /* @__PURE__ */ t("path", { d: "m8.5 12 2.5 2.5 4.5-5" })
32
- ] }), ve = () => /* @__PURE__ */ o(y, { children: [
33
- /* @__PURE__ */ t("path", { d: "M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z" }),
34
- /* @__PURE__ */ t("path", { d: "M12 9v4" }),
35
- /* @__PURE__ */ t("path", { d: "M12 17h.01" })
36
- ] }), rt = () => /* @__PURE__ */ o(y, { children: [
37
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "9" }),
38
- /* @__PURE__ */ t("path", { d: "M12 11v5" }),
39
- /* @__PURE__ */ t("path", { d: "M12 8h.01" })
40
- ] }), K = () => /* @__PURE__ */ t(y, { children: /* @__PURE__ */ t("path", { d: "M13 2 4.5 13H11l-1 9 8.5-11H12l1-9Z" }) }), re = () => /* @__PURE__ */ o(y, { children: [
41
- /* @__PURE__ */ t("circle", { cx: "9", cy: "20", r: "1" }),
42
- /* @__PURE__ */ t("circle", { cx: "18", cy: "20", r: "1" }),
43
- /* @__PURE__ */ t("path", { d: "M2 3h2.5l2.2 11.2a2 2 0 0 0 2 1.6h8.4a2 2 0 0 0 2-1.6L21 7H5.4" })
44
- ] }), it = () => /* @__PURE__ */ o(y, { children: [
45
- /* @__PURE__ */ t("path", { d: "M18 8a6 6 0 1 0-12 0c0 6-2 8-2 8h16s-2-2-2-8" }),
46
- /* @__PURE__ */ t("path", { d: "M13.7 21a2 2 0 0 1-3.4 0" })
47
- ] }), lt = () => /* @__PURE__ */ t(y, { children: /* @__PURE__ */ t("path", { d: "m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1-5.4-2.9-5.4 2.9 1-6.1L3.2 9.5l6.1-.9L12 3Z" }) }), ot = () => /* @__PURE__ */ o(y, { children: [
48
- /* @__PURE__ */ t("path", { d: "M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" }),
49
- /* @__PURE__ */ t("circle", { cx: "12", cy: "7", r: "4" })
50
- ] }), ct = () => /* @__PURE__ */ o(y, { children: [
51
- /* @__PURE__ */ t("rect", { x: "4", y: "2", width: "10", height: "16", rx: "2" }),
52
- /* @__PURE__ */ t("path", { d: "M17 12a5 5 0 0 1-5 9H9" }),
53
- /* @__PURE__ */ t("path", { d: "m11 19-2 2 2 2" })
13
+ ), Et = { experimentId: "0", variantId: "0", campaignId: "0" }, R = (e) => Object.fromEntries(Object.entries(e).filter(([, t]) => t !== void 0)), Ge = (e = {}) => ({
14
+ paywallId: e.paywallId ?? "0",
15
+ paywallIdentifier: e.paywallIdentifier ?? "paywall",
16
+ device: R(e.device ?? {}),
17
+ user: R(e.user ?? {}),
18
+ params: R(e.params ?? {}),
19
+ products: e.products ?? [],
20
+ experiment: e.experiment ?? Et,
21
+ ...e.introductoryOfferEligible === void 0 ? {} : { introductoryOfferEligible: e.introductoryOfferEligible }
22
+ }), $e = (e, t) => {
23
+ const a = {
24
+ ...e,
25
+ paywallId: t.paywallId ?? e.paywallId,
26
+ paywallIdentifier: t.paywallIdentifier ?? e.paywallIdentifier,
27
+ device: t.device ? R({ ...e.device, ...t.device }) : e.device,
28
+ user: t.user ? R({ ...e.user, ...t.user }) : e.user,
29
+ params: t.params ? R({ ...e.params, ...t.params }) : e.params,
30
+ products: t.products ?? e.products,
31
+ experiment: t.experiment ?? e.experiment
32
+ };
33
+ return "introductoryOfferEligible" in t && (t.introductoryOfferEligible === void 0 ? delete a.introductoryOfferEligible : a.introductoryOfferEligible = t.introductoryOfferEligible), a;
34
+ }, ye = (e, t) => JSON.stringify(e) === JSON.stringify(t), ce = (e, t) => {
35
+ const a = {};
36
+ let r = !1;
37
+ for (const s of /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)]))
38
+ s in t ? ye(e[s], t[s]) || (a[s] = t[s], r = !0) : (a[s] = void 0, r = !0);
39
+ return r ? a : void 0;
40
+ }, Pt = (e, t) => {
41
+ const a = {}, r = ce(e.device, t.device);
42
+ r && (a.device = r);
43
+ const s = ce(e.user, t.user);
44
+ s && (a.user = s);
45
+ const i = ce(e.params, t.params);
46
+ return i && (a.params = i), ye(e.products, t.products) || (a.products = t.products), e.introductoryOfferEligible !== t.introductoryOfferEligible && (a.introductoryOfferEligible = t.introductoryOfferEligible), e.paywallId !== t.paywallId && (a.paywallId = t.paywallId), e.paywallIdentifier !== t.paywallIdentifier && (a.paywallIdentifier = t.paywallIdentifier), ye(e.experiment, t.experiment) || (a.experiment = t.experiment), a;
47
+ }, Ye = (e) => {
48
+ const t = e.variables.trialPeriodDays, a = typeof t == "number" ? t : typeof t == "string" ? Number(t) : 0;
49
+ return Number.isFinite(a) ? a : 0;
50
+ }, F = (e) => e.introductoryOfferEligible ?? e.products.some((t) => Ye(t) > 0), Ze = (e) => ({
51
+ event_name: "template_variables",
52
+ variables: {
53
+ device: e.device,
54
+ user: e.user,
55
+ params: e.params,
56
+ ...e.products.length > 0 ? { products: e.products.map((t) => ({ [t.reference]: t.variables })) } : {}
57
+ }
58
+ }), Qe = (e) => ({
59
+ event_name: "experiment",
60
+ experimentId: e.experiment.experimentId,
61
+ variantId: e.experiment.variantId,
62
+ campaignId: e.experiment.campaignId
63
+ }), Xe = (e) => ({
64
+ event_name: "products",
65
+ products: e.products.map((t) => ({
66
+ product: t.reference,
67
+ productId: t.productId
68
+ }))
69
+ }), et = (e) => ({
70
+ event_name: "template_substitutions_prefix",
71
+ prefix: F(e) ? "freeTrial" : "default"
72
+ }), Ct = (e) => ({
73
+ event_name: "paywall_open",
74
+ paywall_id: e.paywallId,
75
+ paywall_identifier: e.paywallIdentifier
76
+ }), Ot = (e) => ({
77
+ event_name: "paywall_close",
78
+ paywall_id: e.paywallId,
79
+ paywall_identifier: e.paywallIdentifier
80
+ }), Mt = (e) => [
81
+ Ze(e),
82
+ Qe(e),
83
+ Xe(e),
84
+ et(e),
85
+ Ct(e)
86
+ ], ee = (e) => ({
87
+ product: e.reference,
88
+ product_identifier: e.productId
89
+ }), $t = (e) => ({
90
+ event_name: "transaction_start",
91
+ ...ee(e)
92
+ }), Tt = (e) => ({
93
+ event_name: "transaction_complete",
94
+ ...ee(e)
95
+ }), Rt = (e) => ({
96
+ event_name: "transaction_abandon",
97
+ ...ee(e)
98
+ }), Te = (e) => ({
99
+ event_name: "transaction_fail",
100
+ ...ee(e)
101
+ }), At = () => ({
102
+ event_name: "transaction_restore"
103
+ }), Dt = (e, t) => ({
104
+ event_name: "freeTrial_start",
105
+ product_identifier: e.productId,
106
+ trial_end_date: t
107
+ }), Lt = () => ({ event_name: "restore_start" }), jt = () => ({
108
+ event_name: "restore_complete"
109
+ }), Re = () => ({ event_name: "restore_fail" }), Ut = (e) => ({
110
+ event_name: "permission_result",
111
+ permission_type: e.permissionType,
112
+ request_id: e.requestId,
113
+ status: e.status
114
+ }), Ft = (e) => ({
115
+ event_name: "callback_result",
116
+ request_id: e.requestId,
117
+ name: e.name,
118
+ status: e.status,
119
+ ...e.data === void 0 ? {} : { data: e.data }
120
+ }), Ht = () => ({
121
+ event: () => {
122
+ },
123
+ purchase: () => "completed",
124
+ restore: () => "restored",
125
+ close: () => {
126
+ },
127
+ openUrl: () => {
128
+ },
129
+ custom: () => {
130
+ },
131
+ customPlacement: () => {
132
+ },
133
+ permission: () => "granted",
134
+ callback: () => ({ status: "success" })
135
+ }), Bt = 1440 * 60 * 1e3, te = (e, t, a) => {
136
+ new Promise((r) => r(e())).then(t, a);
137
+ }, ne = (e, t) => {
138
+ console.error(`[superwall host] ${e}`, t);
139
+ }, Vt = (e, t, a) => e.products.find((r) => r.reference === t) ?? e.products.find((r) => r.productId === a) ?? {
140
+ reference: t,
141
+ productId: a ?? t,
142
+ variables: {}
143
+ }, qt = (e, t) => {
144
+ const { delegate: a, send: r, now: s } = e, i = Vt(e.state(), t.product, t.product_identifier);
145
+ r([$t(i)]), te(
146
+ () => a.purchase(i),
147
+ (o) => {
148
+ if (o === "completed") {
149
+ const p = Ye(i), c = [Tt(i)];
150
+ F(e.state()) && p > 0 && c.push(Dt(i, s() + p * Bt)), r(c);
151
+ } else r(o === "abandoned" ? [Rt(i)] : [Te(i)]);
152
+ },
153
+ (o) => {
154
+ ne("purchase delegate threw", o), r([Te(i)]);
155
+ }
156
+ );
157
+ }, zt = (e) => {
158
+ const { delegate: t, send: a } = e;
159
+ a([Lt()]), te(
160
+ () => t.restore(),
161
+ (r) => {
162
+ a(r === "restored" ? [At(), jt()] : [Re()]);
163
+ },
164
+ (r) => {
165
+ ne("restore delegate threw", r), a([Re()]);
166
+ }
167
+ );
168
+ }, Wt = (e, t) => {
169
+ const { delegate: a, send: r } = e, s = (i) => r([
170
+ Ut({
171
+ permissionType: t.permission_type,
172
+ requestId: t.request_id,
173
+ status: i
174
+ })
175
+ ]);
176
+ te(
177
+ () => a.permission(t.permission_type),
178
+ s,
179
+ (i) => {
180
+ ne("permission delegate threw", i), s("denied");
181
+ }
182
+ );
183
+ }, Kt = (e, t) => {
184
+ const { delegate: a, send: r } = e, s = (i) => r([
185
+ Ft({
186
+ requestId: t.request_id,
187
+ name: t.name,
188
+ status: i.status,
189
+ ...i.data === void 0 ? {} : { data: i.data }
190
+ })
191
+ ]);
192
+ te(
193
+ () => a.callback(t.name, t.variables ?? {}),
194
+ s,
195
+ (i) => {
196
+ ne("callback delegate threw", i), s({ status: "failure" });
197
+ }
198
+ );
199
+ }, Ae = (e) => JSON.stringify([
200
+ e.device,
201
+ e.user,
202
+ e.params,
203
+ e.products.map((t) => [t.reference, t.variables])
204
+ ]), De = (e) => JSON.stringify(e.products.map((t) => [t.reference, t.productId])), Le = (e) => JSON.stringify(e.experiment), Jt = (e) => {
205
+ let t = Ge(e.state);
206
+ const { delegate: a, send: r } = e, s = {
207
+ state: () => t,
208
+ delegate: a,
209
+ send: r,
210
+ now: e.now ?? Date.now
211
+ }, i = (c) => {
212
+ switch (c.event_name) {
213
+ case "ping":
214
+ r(Mt(t));
215
+ return;
216
+ case "purchase":
217
+ qt(s, c);
218
+ return;
219
+ case "restore":
220
+ zt(s);
221
+ return;
222
+ case "close":
223
+ a.close(), r([Ot(t)]);
224
+ return;
225
+ case "open_url":
226
+ a.openUrl(
227
+ c.url,
228
+ c.browser_type === "payment_sheet" ? "payment_sheet" : "in_app"
229
+ );
230
+ return;
231
+ case "open_url_external":
232
+ a.openUrl(c.url, "external");
233
+ return;
234
+ case "open_deep_link":
235
+ a.openUrl(c.link, "deep_link");
236
+ return;
237
+ case "custom":
238
+ a.custom(c.data);
239
+ return;
240
+ case "custom_placement":
241
+ a.customPlacement(c.name, c.params);
242
+ return;
243
+ case "user_attribute_updated":
244
+ t = $e(t, {
245
+ user: Object.fromEntries(c.attributes.map((h) => [h.key, h.value]))
246
+ });
247
+ return;
248
+ case "request_permission":
249
+ Wt(s, c);
250
+ return;
251
+ case "request_callback":
252
+ Kt(s, c);
253
+ return;
254
+ default:
255
+ return;
256
+ }
257
+ };
258
+ return {
259
+ get state() {
260
+ return t;
261
+ },
262
+ receive: (c) => {
263
+ for (const h of c)
264
+ a.event(h), i(h);
265
+ },
266
+ update: (c) => {
267
+ const h = t;
268
+ t = $e(t, c);
269
+ const m = [];
270
+ Ae(h) !== Ae(t) && m.push(Ze(t)), Le(h) !== Le(t) && m.push(Qe(t)), De(h) !== De(t) && m.push(Xe(t)), F(h) !== F(t) && m.push(et(t)), m.length > 0 && r(m);
271
+ },
272
+ send: r
273
+ };
274
+ }, Gt = () => typeof localStorage < "u" && localStorage.getItem("SW_DEBUG_TRANSPORT") === "true", Yt = {
275
+ WebKit: "#9C27B0",
276
+ Android: "#4CAF50",
277
+ Editor: "#2196F3",
278
+ Transport: "#FF9800"
279
+ }, Zt = (e) => {
280
+ const t = Yt[e], a = (r, s, ...i) => {
281
+ if (!Gt() && r === "debug") return;
282
+ const o = `%c[${e}]%c ${s}`, p = [`color: ${t}; font-weight: bold`, "color: inherit"];
283
+ switch (r) {
284
+ case "error":
285
+ console.error(o, ...p, ...i);
286
+ break;
287
+ case "warn":
288
+ console.warn(o, ...p, ...i);
289
+ break;
290
+ case "info":
291
+ console.info(o, ...p, ...i);
292
+ break;
293
+ default:
294
+ console.log(o, ...p, ...i);
295
+ }
296
+ };
297
+ return {
298
+ debug: (r, ...s) => a("debug", r, ...s),
299
+ info: (r, ...s) => a("info", r, ...s),
300
+ warn: (r, ...s) => a("warn", r, ...s),
301
+ error: (r, ...s) => a("error", r, ...s)
302
+ };
303
+ };
304
+ var Se = /* @__PURE__ */ ((e) => (e.ToPaywall = "to_paywall", e.FromPaywall = "from_paywall", e.ToPaywallUi = "to_paywall_ui", e.FromPaywallUi = "from_paywall_ui", e))(Se || {});
305
+ const Qt = (e, t) => {
306
+ const a = {
307
+ direction: t,
308
+ version: 1,
309
+ payload: { events: Array.isArray(e) ? e : [e] }
310
+ };
311
+ return JSON.stringify(a);
312
+ }, Xt = () => ({
313
+ parse: (e) => e
314
+ }), en = Zt("Transport"), tn = (e, t, a = Xt()) => {
315
+ try {
316
+ const r = a.parse(JSON.parse(e));
317
+ if (r.direction !== t)
318
+ throw new Error("Message direction incorrect");
319
+ return r.payload.events;
320
+ } catch (r) {
321
+ return en.error("Failed to parse incoming message", { message: e, error: r }), [];
322
+ }
323
+ }, nn = (e) => (t) => {
324
+ e.postMessage(Qt([...t], Se.ToPaywall), "*");
325
+ }, an = (e, t, a = {}) => {
326
+ const r = a.listen ?? window, s = (i) => {
327
+ if (i.source !== t || typeof i.data != "string") return;
328
+ const o = tn(i.data, Se.FromPaywall);
329
+ o.length > 0 && e.receive(o);
330
+ };
331
+ return r.addEventListener("message", s), () => r.removeEventListener("message", s);
332
+ }, rn = (e) => {
333
+ const { target: t, listen: a, ...r } = e, s = Jt({ ...r, send: nn(t) }), i = an(s, t, a ? { listen: a } : {});
334
+ return { host: s, detach: i };
335
+ }, de = 1440 * 60 * 1e3, pe = 60 * 1e3, tt = -18e3, ge = {
336
+ publicApiKey: "pk_8d21d5122bb23839a2de6c8c76975e74f85b43ab4476c039",
337
+ platform: "iOS",
338
+ appUserId: "44dd573cd1e849a6997a5eaf98298e47",
339
+ aliases: ["$SuperwallAlias:00EB5C40-68A7-4778-B634-F3714D2010B9"],
340
+ vendorId: "86A1F395-D3A3-4A1C-914A-5912EF0363E2",
341
+ appVersion: "8.4",
342
+ osVersion: "15.5.0",
343
+ deviceLocale: "en_US",
344
+ deviceModel: "iPhone10",
345
+ deviceLanguageCode: "en",
346
+ deviceCurrencyCode: "USD",
347
+ deviceCurrencySymbol: "$",
348
+ timezoneOffset: tt,
349
+ radioType: "Wifi",
350
+ interfaceStyle: "Dark",
351
+ isLowPowerModeEnabled: 0,
352
+ bundleId: "com.jakemor.fitnessai",
353
+ isMac: 0,
354
+ totalPaywallViews: 0,
355
+ interfaceType: "iphone"
356
+ }, L = (e) => String(e).padStart(2, "0"), je = (e) => {
357
+ const t = `${e.getUTCFullYear()}-${L(e.getUTCMonth() + 1)}-${L(e.getUTCDate())}`, a = `${L(e.getUTCHours())}:${L(e.getUTCMinutes())}:${L(e.getUTCSeconds())}`;
358
+ return { date: t, time: a, dateTime: `${t}T${a}` };
359
+ }, sn = (e, t = tt) => {
360
+ const a = e - 5 * de, r = e - 360 * pe, s = je(new Date(e)), i = je(new Date(e + t * 1e3));
361
+ return {
362
+ daysSinceInstall: Math.floor((e - a) / de),
363
+ minutesSinceInstall: Math.floor((e - a) / pe),
364
+ appInstallDate: new Date(a).toISOString(),
365
+ daysSinceLastPaywallView: Math.floor((e - r) / de),
366
+ minutesSinceLastPaywallView: Math.floor((e - r) / pe),
367
+ utcDate: s.date,
368
+ localDate: i.date,
369
+ utcTime: s.time,
370
+ localTime: i.time,
371
+ utcDateTime: s.dateTime,
372
+ localDateTime: i.dateTime
373
+ };
374
+ }, on = (e = Date.now()) => ({
375
+ ...ge,
376
+ ...sn(e, ge.timezoneOffset)
377
+ }), ln = {
378
+ appUserId: ge.appUserId,
379
+ email: "preview@example.com",
380
+ firstName: "John",
381
+ lastName: "Doe",
382
+ country: "US",
383
+ language: "en"
384
+ }, cn = {
385
+ $event_name: "campaign_trigger",
386
+ event_name: "campaign_trigger",
387
+ $is_standard_event: !1,
388
+ $is_feature_gatable: !1
389
+ }, y = ({ children: e }) => /* @__PURE__ */ n("svg", { className: "sw-icon", viewBox: "0 0 24 24", "aria-hidden": "true", children: e }), nt = () => /* @__PURE__ */ l(y, { children: [
390
+ /* @__PURE__ */ n("path", { d: "M21 12a9 9 0 1 1-2.64-6.36" }),
391
+ /* @__PURE__ */ n("path", { d: "M21 3v6h-6" })
392
+ ] }), G = () => /* @__PURE__ */ l(y, { children: [
393
+ /* @__PURE__ */ n("path", { d: "M15 3h6v6" }),
394
+ /* @__PURE__ */ n("path", { d: "M10 14 21 3" }),
395
+ /* @__PURE__ */ n("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
396
+ ] }), dn = () => /* @__PURE__ */ l(y, { children: [
397
+ /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "4" }),
398
+ /* @__PURE__ */ n("path", { d: "M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4" })
399
+ ] }), pn = () => /* @__PURE__ */ n(y, { children: /* @__PURE__ */ n("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }) }), un = () => /* @__PURE__ */ l(y, { children: [
400
+ /* @__PURE__ */ n("path", { d: "M21 4h-7M10 4H3M21 12h-9M8 12H3M21 20h-5M12 20H3" }),
401
+ /* @__PURE__ */ n("path", { d: "M14 2v4M8 10v4M16 18v4" })
402
+ ] }), at = () => /* @__PURE__ */ n(y, { children: /* @__PURE__ */ n("path", { d: "M18 6 6 18M6 6l12 12" }) }), rt = () => /* @__PURE__ */ n(y, { children: /* @__PURE__ */ n("path", { d: "m6 9 6 6 6-6" }) }), mn = () => /* @__PURE__ */ l(y, { children: [
403
+ /* @__PURE__ */ n("rect", { x: "3", y: "4", width: "18", height: "16" }),
404
+ /* @__PURE__ */ n("path", { d: "M12 4v16" })
405
+ ] }), ue = () => /* @__PURE__ */ l(y, { children: [
406
+ /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "9" }),
407
+ /* @__PURE__ */ n("path", { d: "m8.5 12 2.5 2.5 4.5-5" })
408
+ ] }), me = () => /* @__PURE__ */ l(y, { children: [
409
+ /* @__PURE__ */ n("path", { d: "M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z" }),
410
+ /* @__PURE__ */ n("path", { d: "M12 9v4" }),
411
+ /* @__PURE__ */ n("path", { d: "M12 17h.01" })
412
+ ] }), hn = () => /* @__PURE__ */ l(y, { children: [
413
+ /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "9" }),
414
+ /* @__PURE__ */ n("path", { d: "M12 11v5" }),
415
+ /* @__PURE__ */ n("path", { d: "M12 8h.01" })
416
+ ] }), W = () => /* @__PURE__ */ n(y, { children: /* @__PURE__ */ n("path", { d: "M13 2 4.5 13H11l-1 9 8.5-11H12l1-9Z" }) }), he = () => /* @__PURE__ */ l(y, { children: [
417
+ /* @__PURE__ */ n("circle", { cx: "9", cy: "20", r: "1" }),
418
+ /* @__PURE__ */ n("circle", { cx: "18", cy: "20", r: "1" }),
419
+ /* @__PURE__ */ n("path", { d: "M2 3h2.5l2.2 11.2a2 2 0 0 0 2 1.6h8.4a2 2 0 0 0 2-1.6L21 7H5.4" })
420
+ ] }), fn = () => /* @__PURE__ */ l(y, { children: [
421
+ /* @__PURE__ */ n("path", { d: "M18 8a6 6 0 1 0-12 0c0 6-2 8-2 8h16s-2-2-2-8" }),
422
+ /* @__PURE__ */ n("path", { d: "M13.7 21a2 2 0 0 1-3.4 0" })
423
+ ] }), bn = () => /* @__PURE__ */ n(y, { children: /* @__PURE__ */ n("path", { d: "m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1-5.4-2.9-5.4 2.9 1-6.1L3.2 9.5l6.1-.9L12 3Z" }) }), vn = () => /* @__PURE__ */ l(y, { children: [
424
+ /* @__PURE__ */ n("path", { d: "M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" }),
425
+ /* @__PURE__ */ n("circle", { cx: "12", cy: "7", r: "4" })
426
+ ] }), wn = () => /* @__PURE__ */ l(y, { children: [
427
+ /* @__PURE__ */ n("rect", { x: "4", y: "2", width: "10", height: "16", rx: "2" }),
428
+ /* @__PURE__ */ n("path", { d: "M17 12a5 5 0 0 1-5 9H9" }),
429
+ /* @__PURE__ */ n("path", { d: "m11 19-2 2 2 2" })
54
430
  ] }), Q = {
55
431
  push: ["link", "build", "assets", "push", "source"],
56
432
  publish: ["link", "build", "assets", "push", "source", "promote"],
57
433
  promote: ["link", "promote"]
58
- }, dt = {
434
+ }, yn = {
59
435
  link: "Find paywall",
60
436
  build: "Build snapshot",
61
437
  assets: "Sync assets",
62
438
  push: "Push version",
63
439
  source: "Push source",
64
440
  promote: "Promote to live"
65
- }, je = [
441
+ }, st = [
66
442
  { name: "push", label: "Push", hint: "New version, nothing live changes" },
67
443
  { name: "publish", label: "Publish", hint: "Push and make it live" },
68
444
  { name: "promote", label: "Promote", hint: "Make the latest push live" }
69
- ], de = (e) => je.find((n) => n.name === e)?.label ?? e, Le = {
445
+ ], xe = (e) => st.find((t) => t.name === e)?.label ?? e, it = {
70
446
  push: "Pushing…",
71
447
  publish: "Publishing…",
72
448
  promote: "Promoting…"
73
- }, pt = ({ state: e }) => e === "active" ? /* @__PURE__ */ t("span", { className: "bg-accent h-2 w-2 animate-pulse" }) : e === "done" ? /* @__PURE__ */ t("span", { className: "bg-accent h-2 w-2" }) : e === "failed" ? /* @__PURE__ */ t("span", { className: "bg-red h-2 w-2" }) : /* @__PURE__ */ t("span", { className: "bg-cream/55 h-2 w-2" }), ht = ({ progress: e }) => {
74
- const n = Q[e.action], s = n.filter((r) => e.steps[r] === "done").length, a = e.error !== void 0;
75
- return /* @__PURE__ */ o("div", { className: "w-64", children: [
76
- /* @__PURE__ */ o("div", { className: "border-b border-cream/10 px-3 py-2.5", children: [
77
- /* @__PURE__ */ t("div", { className: "text-[0.8125rem] font-medium", children: a ? `${de(e.action)} failed` : s === n.length ? `${de(e.action)} complete` : Le[e.action] }),
78
- /* @__PURE__ */ t("div", { className: "mt-2 h-0.5 w-full bg-cream/10", children: /* @__PURE__ */ t(
449
+ }, gn = ({ state: e }) => e === "active" ? /* @__PURE__ */ n("span", { className: "bg-accent h-2 w-2 animate-pulse" }) : e === "done" ? /* @__PURE__ */ n("span", { className: "bg-accent h-2 w-2" }) : e === "failed" ? /* @__PURE__ */ n("span", { className: "bg-red h-2 w-2" }) : /* @__PURE__ */ n("span", { className: "bg-cream/55 h-2 w-2" }), xn = ({ progress: e }) => {
450
+ const t = Q[e.action], a = t.filter((s) => e.steps[s] === "done").length, r = e.error !== void 0;
451
+ return /* @__PURE__ */ l("div", { className: "w-64", children: [
452
+ /* @__PURE__ */ l("div", { className: "border-b border-cream/10 px-3 py-2.5", children: [
453
+ /* @__PURE__ */ n("div", { className: "text-[0.8125rem] font-medium", children: r ? `${xe(e.action)} failed` : a === t.length ? `${xe(e.action)} complete` : it[e.action] }),
454
+ /* @__PURE__ */ n("div", { className: "mt-2 h-0.5 w-full bg-cream/10", children: /* @__PURE__ */ n(
79
455
  "div",
80
456
  {
81
- className: `h-full transition-[width] duration-300 ease-out ${a ? "bg-red" : "bg-accent"}`,
82
- style: { width: `${s / n.length * 100}%` }
457
+ className: `h-full transition-[width] duration-300 ease-out ${r ? "bg-red" : "bg-accent"}`,
458
+ style: { width: `${a / t.length * 100}%` }
83
459
  }
84
460
  ) })
85
461
  ] }),
86
- /* @__PURE__ */ t("ul", { className: "m-0 list-none px-3 py-2", children: n.map((r, i) => {
87
- const c = e.steps[r] ?? "pending";
88
- return /* @__PURE__ */ o("li", { className: "flex items-center gap-2.5 py-1.5", children: [
89
- /* @__PURE__ */ t(
462
+ /* @__PURE__ */ n("ul", { className: "m-0 list-none px-3 py-2", children: t.map((s, i) => {
463
+ const o = e.steps[s] ?? "pending";
464
+ return /* @__PURE__ */ l("li", { className: "flex items-center gap-2.5 py-1.5", children: [
465
+ /* @__PURE__ */ n(
90
466
  "span",
91
467
  {
92
- className: `w-4 font-mono text-[0.625rem] tabular-nums ${c === "pending" ? "text-cream/25" : "text-cream/55"}`,
468
+ className: `w-4 font-mono text-[0.625rem] tabular-nums ${o === "pending" ? "text-cream/25" : "text-cream/55"}`,
93
469
  children: String(i + 1).padStart(2, "0")
94
470
  }
95
471
  ),
96
- /* @__PURE__ */ t(
472
+ /* @__PURE__ */ n(
97
473
  "span",
98
474
  {
99
- className: `flex-1 text-[0.8125rem] ${c === "pending" ? "text-cream/40" : "text-cream"}`,
100
- children: dt[r]
475
+ className: `flex-1 text-[0.8125rem] ${o === "pending" ? "text-cream/40" : "text-cream"}`,
476
+ children: yn[s]
101
477
  }
102
478
  ),
103
- /* @__PURE__ */ t(pt, { state: c })
104
- ] }, r);
479
+ /* @__PURE__ */ n(gn, { state: o })
480
+ ] }, s);
105
481
  }) }),
106
- e.error && /* @__PURE__ */ t("div", { className: "text-red border-t border-cream/10 px-3 py-2.5 text-xs whitespace-pre-wrap", children: e.error })
482
+ e.error && /* @__PURE__ */ n("div", { className: "text-red border-t border-cream/10 px-3 py-2.5 text-xs whitespace-pre-wrap", children: e.error })
107
483
  ] });
108
- }, mt = ({
484
+ }, Nn = ({
109
485
  progress: e,
110
- blocked: n,
111
- onRun: s,
112
- onBlocked: a
486
+ blocked: t,
487
+ onRun: a,
488
+ onBlocked: r
113
489
  }) => {
114
- const [r, i] = d.useState("push"), [c, f] = d.useState(!1), u = d.useRef(null), l = n !== void 0, h = e !== void 0 && e.error === void 0 && Q[e.action].some((b) => e.steps[b] !== "done"), w = e !== void 0;
490
+ const [s, i] = d.useState("push"), [o, p] = d.useState(!1), c = d.useRef(null), h = t !== void 0, m = e !== void 0 && e.error === void 0 && Q[e.action].some((u) => e.steps[u] !== "done"), b = e !== void 0;
115
491
  return d.useEffect(() => {
116
- if (!c) return;
117
- const b = (m) => {
118
- u.current && !m.composedPath().includes(u.current) && f(!1);
492
+ if (!o) return;
493
+ const u = (v) => {
494
+ c.current && !v.composedPath().includes(c.current) && p(!1);
119
495
  };
120
- return window.addEventListener("mousedown", b), () => window.removeEventListener("mousedown", b);
121
- }, [c]), /* @__PURE__ */ o("div", { className: "relative flex", ref: u, children: [
122
- /* @__PURE__ */ t(
496
+ return window.addEventListener("mousedown", u), () => window.removeEventListener("mousedown", u);
497
+ }, [o]), /* @__PURE__ */ l("div", { className: "relative flex", ref: c, children: [
498
+ /* @__PURE__ */ n(
123
499
  "button",
124
500
  {
125
501
  type: "button",
126
502
  className: "sw-btn sw-btn--primary disabled:cursor-not-allowed disabled:opacity-40",
127
- disabled: h,
128
- title: n,
129
- onClick: () => l ? a?.() : s(r),
130
- children: h ? Le[e.action] : de(r)
503
+ disabled: m,
504
+ title: t,
505
+ onClick: () => h ? r?.() : a(s),
506
+ children: m ? it[e.action] : xe(s)
131
507
  }
132
508
  ),
133
- /* @__PURE__ */ t(
509
+ /* @__PURE__ */ n(
134
510
  "button",
135
511
  {
136
512
  type: "button",
137
513
  className: "sw-btn sw-btn--primary -ml-px w-6 !px-0 disabled:cursor-not-allowed disabled:opacity-40",
138
514
  "aria-label": "Choose action",
139
- "aria-expanded": c,
140
- title: n,
141
- disabled: h,
142
- onClick: () => f((b) => !b),
143
- children: /* @__PURE__ */ t(Re, {})
515
+ "aria-expanded": o,
516
+ title: t,
517
+ disabled: m,
518
+ onClick: () => p((u) => !u),
519
+ children: /* @__PURE__ */ n(rt, {})
144
520
  }
145
521
  ),
146
- (w || c) && /* @__PURE__ */ t("div", { className: "bg-bar absolute top-full right-0 z-20 mt-1 border border-cream/20", children: w ? /* @__PURE__ */ t(ht, { progress: e }) : /* @__PURE__ */ t("div", { className: "w-64", children: je.map((b) => /* @__PURE__ */ o(
522
+ (b || o) && /* @__PURE__ */ n("div", { className: "bg-bar absolute top-full right-0 z-20 mt-1 border border-cream/20", children: b ? /* @__PURE__ */ n(xn, { progress: e }) : /* @__PURE__ */ n("div", { className: "w-64", children: st.map((u) => /* @__PURE__ */ l(
147
523
  "button",
148
524
  {
149
525
  type: "button",
150
526
  className: "flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left transition-colors hover:bg-cream/5",
151
527
  onClick: () => {
152
- i(b.name), f(!1);
528
+ i(u.name), p(!1);
153
529
  },
154
530
  children: [
155
- /* @__PURE__ */ t("span", { className: "text-[0.8125rem] font-medium", children: b.label }),
156
- /* @__PURE__ */ t("span", { className: "text-xs text-cream/55", children: b.hint })
531
+ /* @__PURE__ */ n("span", { className: "text-[0.8125rem] font-medium", children: u.label }),
532
+ /* @__PURE__ */ n("span", { className: "text-xs text-cream/55", children: u.hint })
157
533
  ]
158
534
  },
159
- b.name
535
+ u.name
160
536
  )) }) })
161
537
  ] });
162
- }, ie = ({
538
+ }, fe = ({
163
539
  label: e,
164
- hint: n,
165
- selected: s,
166
- onSelect: a
167
- }) => /* @__PURE__ */ o(
540
+ hint: t,
541
+ selected: a,
542
+ onSelect: r
543
+ }) => /* @__PURE__ */ l(
168
544
  "button",
169
545
  {
170
546
  type: "button",
171
547
  className: "flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left transition-colors hover:bg-cream/5",
172
- "aria-current": s || void 0,
173
- onClick: a,
548
+ "aria-current": a || void 0,
549
+ onClick: r,
174
550
  children: [
175
- /* @__PURE__ */ o("span", { className: "flex max-w-full items-center gap-1.5 text-[0.8125rem] font-medium", children: [
176
- /* @__PURE__ */ t("span", { className: "truncate", children: e }),
177
- s && /* @__PURE__ */ t("span", { className: "bg-accent size-[5px] shrink-0 rounded-full", "aria-hidden": "true" })
551
+ /* @__PURE__ */ l("span", { className: "flex max-w-full items-center gap-1.5 text-[0.8125rem] font-medium", children: [
552
+ /* @__PURE__ */ n("span", { className: "truncate", children: e }),
553
+ a && /* @__PURE__ */ n("span", { className: "bg-accent size-[5px] shrink-0 rounded-full", "aria-hidden": "true" })
178
554
  ] }),
179
- /* @__PURE__ */ t("span", { className: "max-w-full truncate text-xs text-cream/55", children: n })
555
+ /* @__PURE__ */ n("span", { className: "max-w-full truncate text-xs text-cream/55", children: t })
180
556
  ]
181
557
  }
182
- ), ut = ({
558
+ ), Sn = ({
183
559
  active: e,
184
- options: n,
185
- onSelect: s
560
+ options: t,
561
+ onSelect: a
186
562
  }) => {
187
- const [a, r] = d.useState(!1), [i, c] = d.useState(""), f = d.useRef(null);
563
+ const [r, s] = d.useState(!1), [i, o] = d.useState(""), p = d.useRef(null);
188
564
  d.useEffect(() => {
189
- if (!a) return;
190
- const m = (E) => {
191
- f.current && !E.composedPath().includes(f.current) && r(!1);
565
+ if (!r) return;
566
+ const v = (N) => {
567
+ p.current && !N.composedPath().includes(p.current) && s(!1);
192
568
  };
193
- return window.addEventListener("mousedown", m), () => window.removeEventListener("mousedown", m);
194
- }, [a]), d.useEffect(() => {
195
- a || c("");
196
- }, [a]);
197
- const u = e && (e.type === "live" ? "live" : `surface:${e.surface.kind}/${e.surface.id}`), l = (m) => {
198
- r(!1), s(m);
199
- }, h = i.trim().toLowerCase(), w = n.filter((m) => m.key === "live"), b = n.filter((m) => m.key !== "live").filter(
200
- (m) => h === "" || `${m.label} ${m.hint}`.toLowerCase().includes(h)
569
+ return window.addEventListener("mousedown", v), () => window.removeEventListener("mousedown", v);
570
+ }, [r]), d.useEffect(() => {
571
+ r || o("");
572
+ }, [r]);
573
+ const c = e && (e.type === "live" ? "live" : `surface:${e.surface.kind}/${e.surface.id}`), h = (v) => {
574
+ s(!1), a(v);
575
+ }, m = i.trim().toLowerCase(), b = t.filter((v) => v.key === "live"), u = t.filter((v) => v.key !== "live").filter(
576
+ (v) => m === "" || `${v.label} ${v.hint}`.toLowerCase().includes(m)
201
577
  );
202
- return /* @__PURE__ */ o("div", { className: "relative flex", ref: f, children: [
203
- /* @__PURE__ */ o(
578
+ return /* @__PURE__ */ l("div", { className: "relative flex", ref: p, children: [
579
+ /* @__PURE__ */ l(
204
580
  "button",
205
581
  {
206
582
  type: "button",
207
583
  className: "sw-btn",
208
584
  "aria-pressed": e !== void 0,
209
- "aria-expanded": a,
210
- onClick: () => r((m) => !m),
585
+ "aria-expanded": r,
586
+ onClick: () => s((v) => !v),
211
587
  children: [
212
- /* @__PURE__ */ t(at, {}),
588
+ /* @__PURE__ */ n(mn, {}),
213
589
  "Compare"
214
590
  ]
215
591
  }
216
592
  ),
217
- a && /* @__PURE__ */ o("div", { className: "bg-bar absolute bottom-full left-0 z-20 mb-1 flex w-72 flex-col border border-cream/20", children: [
218
- /* @__PURE__ */ t("div", { className: "p-2", children: /* @__PURE__ */ t(
593
+ r && /* @__PURE__ */ l("div", { className: "bg-bar absolute bottom-full left-0 z-20 mb-1 flex w-72 flex-col border border-cream/20", children: [
594
+ /* @__PURE__ */ n("div", { className: "p-2", children: /* @__PURE__ */ n(
219
595
  "input",
220
596
  {
221
597
  className: "sw-input",
@@ -223,49 +599,49 @@ const et = ({
223
599
  value: i,
224
600
  placeholder: "Search paywalls",
225
601
  "aria-label": "Search paywalls",
226
- onChange: (m) => c(m.target.value)
602
+ onChange: (v) => o(v.target.value)
227
603
  }
228
604
  ) }),
229
- /* @__PURE__ */ t("div", { className: "max-h-64 overflow-y-auto", children: b.length === 0 ? /* @__PURE__ */ t("span", { className: "block px-3 pt-2 pb-4 text-[0.8125rem] text-cream/45", children: h === "" ? "No other paywalls here." : `Nothing matches “${i.trim()}”.` }) : b.map((m) => /* @__PURE__ */ t(
230
- ie,
605
+ /* @__PURE__ */ n("div", { className: "max-h-64 overflow-y-auto", children: u.length === 0 ? /* @__PURE__ */ n("span", { className: "block px-3 pt-2 pb-4 text-[0.8125rem] text-cream/45", children: m === "" ? "No other paywalls here." : `Nothing matches “${i.trim()}”.` }) : u.map((v) => /* @__PURE__ */ n(
606
+ fe,
231
607
  {
232
- label: m.label,
233
- hint: m.hint,
234
- selected: m.key === u,
235
- onSelect: () => l(m.target)
608
+ label: v.label,
609
+ hint: v.hint,
610
+ selected: v.key === c,
611
+ onSelect: () => h(v.target)
236
612
  },
237
- m.key
613
+ v.key
238
614
  )) }),
239
- /* @__PURE__ */ o("div", { className: "flex flex-col border-t border-cream/10", children: [
240
- w.map((m) => /* @__PURE__ */ t(
241
- ie,
615
+ /* @__PURE__ */ l("div", { className: "flex flex-col border-t border-cream/10", children: [
616
+ b.map((v) => /* @__PURE__ */ n(
617
+ fe,
242
618
  {
243
- label: m.label,
244
- hint: m.hint,
245
- selected: m.key === u,
246
- onSelect: () => l(m.target)
619
+ label: v.label,
620
+ hint: v.hint,
621
+ selected: v.key === c,
622
+ onSelect: () => h(v.target)
247
623
  },
248
- m.key
624
+ v.key
249
625
  )),
250
- /* @__PURE__ */ t(
251
- ie,
626
+ /* @__PURE__ */ n(
627
+ fe,
252
628
  {
253
629
  label: "Off",
254
630
  hint: "A single preview",
255
631
  selected: e === void 0,
256
- onSelect: () => l(void 0)
632
+ onSelect: () => h(void 0)
257
633
  }
258
634
  )
259
635
  ] })
260
636
  ] })
261
637
  ] });
262
- }, ft = () => /* @__PURE__ */ o("svg", { width: "19", height: "12", viewBox: "0 0 19 12", fill: "currentColor", "aria-hidden": "true", children: [
263
- /* @__PURE__ */ t("rect", { x: "0", y: "7.5", width: "3.5", height: "4.5", rx: "1" }),
264
- /* @__PURE__ */ t("rect", { x: "5", y: "5", width: "3.5", height: "7", rx: "1" }),
265
- /* @__PURE__ */ t("rect", { x: "10", y: "2.5", width: "3.5", height: "9.5", rx: "1" }),
266
- /* @__PURE__ */ t("rect", { x: "15", y: "0", width: "3.5", height: "12", rx: "1" })
267
- ] }), bt = () => /* @__PURE__ */ o("svg", { width: "27", height: "13", viewBox: "0 0 27 13", "aria-hidden": "true", children: [
268
- /* @__PURE__ */ t(
638
+ }, _n = () => /* @__PURE__ */ l("svg", { width: "19", height: "12", viewBox: "0 0 19 12", fill: "currentColor", "aria-hidden": "true", children: [
639
+ /* @__PURE__ */ n("rect", { x: "0", y: "7.5", width: "3.5", height: "4.5", rx: "1" }),
640
+ /* @__PURE__ */ n("rect", { x: "5", y: "5", width: "3.5", height: "7", rx: "1" }),
641
+ /* @__PURE__ */ n("rect", { x: "10", y: "2.5", width: "3.5", height: "9.5", rx: "1" }),
642
+ /* @__PURE__ */ n("rect", { x: "15", y: "0", width: "3.5", height: "12", rx: "1" })
643
+ ] }), kn = () => /* @__PURE__ */ l("svg", { width: "27", height: "13", viewBox: "0 0 27 13", "aria-hidden": "true", children: [
644
+ /* @__PURE__ */ n(
269
645
  "rect",
270
646
  {
271
647
  x: "0.5",
@@ -278,78 +654,78 @@ const et = ({
278
654
  strokeOpacity: "0.35"
279
655
  }
280
656
  ),
281
- /* @__PURE__ */ t("path", { d: "M25 4.5v4a2.17 2.17 0 0 0 0-4Z", fill: "currentColor", fillOpacity: "0.4" }),
282
- /* @__PURE__ */ t("rect", { x: "2", y: "2", width: "20", height: "9", rx: "2.5", fill: "currentColor" })
283
- ] }), wt = () => /* @__PURE__ */ o("span", { className: "flex items-center gap-[7px]", children: [
284
- /* @__PURE__ */ t(ft, {}),
285
- /* @__PURE__ */ t("span", { style: { fontSize: 12.5, fontWeight: 700, letterSpacing: "0.02em" }, children: "SW" }),
286
- /* @__PURE__ */ t(bt, {})
287
- ] }), vt = ({
657
+ /* @__PURE__ */ n("path", { d: "M25 4.5v4a2.17 2.17 0 0 0 0-4Z", fill: "currentColor", fillOpacity: "0.4" }),
658
+ /* @__PURE__ */ n("rect", { x: "2", y: "2", width: "20", height: "9", rx: "2.5", fill: "currentColor" })
659
+ ] }), In = () => /* @__PURE__ */ l("span", { className: "flex items-center gap-[7px]", children: [
660
+ /* @__PURE__ */ n(_n, {}),
661
+ /* @__PURE__ */ n("span", { style: { fontSize: 12.5, fontWeight: 700, letterSpacing: "0.02em" }, children: "SW" }),
662
+ /* @__PURE__ */ n(kn, {})
663
+ ] }), En = ({
288
664
  spec: e,
289
- width: n,
290
- height: s,
291
- landscape: a,
292
- theme: r
665
+ width: t,
666
+ height: a,
667
+ landscape: r,
668
+ theme: s
293
669
  }) => {
294
- const i = r === "dark" ? "rgba(255,255,255,0.95)" : "rgba(0,0,0,0.95)", c = Math.max(28, e.radius * 0.6);
295
- return /* @__PURE__ */ o(
670
+ const i = s === "dark" ? "rgba(255,255,255,0.95)" : "rgba(0,0,0,0.95)", o = Math.max(28, e.radius * 0.6);
671
+ return /* @__PURE__ */ l(
296
672
  "div",
297
673
  {
298
674
  className: "pointer-events-none absolute inset-0 select-none",
299
- style: { width: n, height: s, color: i },
675
+ style: { width: t, height: a, color: i },
300
676
  "data-testid": "device-chrome",
301
677
  children: [
302
- !a && /* @__PURE__ */ o(
678
+ !r && /* @__PURE__ */ l(
303
679
  "div",
304
680
  {
305
681
  className: "absolute inset-x-0 top-0 flex items-center justify-between",
306
682
  style: {
307
683
  height: e.statusBarHeight,
308
- paddingLeft: c,
309
- paddingRight: c,
684
+ paddingLeft: o,
685
+ paddingRight: o,
310
686
  fontFamily: '-apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif',
311
687
  fontSize: 15,
312
688
  fontWeight: 600,
313
689
  letterSpacing: "-0.2px"
314
690
  },
315
691
  children: [
316
- /* @__PURE__ */ t("span", { children: "9:41" }),
317
- /* @__PURE__ */ t(wt, {})
692
+ /* @__PURE__ */ n("span", { children: "9:41" }),
693
+ /* @__PURE__ */ n(In, {})
318
694
  ]
319
695
  }
320
696
  ),
321
- e.cutout === "island" && (a ? /* @__PURE__ */ t(
697
+ e.cutout === "island" && (r ? /* @__PURE__ */ n(
322
698
  "div",
323
699
  {
324
700
  className: "absolute rounded-full bg-black",
325
- style: { left: 12, top: (s - 124) / 2, width: 36, height: 124 }
701
+ style: { left: 12, top: (a - 124) / 2, width: 36, height: 124 }
326
702
  }
327
- ) : /* @__PURE__ */ t(
703
+ ) : /* @__PURE__ */ n(
328
704
  "div",
329
705
  {
330
706
  className: "absolute rounded-full bg-black",
331
- style: { left: (n - 124) / 2, top: 12, width: 124, height: 36 }
707
+ style: { left: (t - 124) / 2, top: 12, width: 124, height: 36 }
332
708
  }
333
709
  )),
334
- e.cutout === "punch" && (a ? /* @__PURE__ */ t(
710
+ e.cutout === "punch" && (r ? /* @__PURE__ */ n(
335
711
  "div",
336
712
  {
337
713
  className: "absolute rounded-full bg-black",
338
- style: { left: 16, top: (s - 13) / 2, width: 13, height: 13 }
714
+ style: { left: 16, top: (a - 13) / 2, width: 13, height: 13 }
339
715
  }
340
- ) : /* @__PURE__ */ t(
716
+ ) : /* @__PURE__ */ n(
341
717
  "div",
342
718
  {
343
719
  className: "absolute rounded-full bg-black",
344
- style: { left: (n - 13) / 2, top: 15, width: 13, height: 13 }
720
+ style: { left: (t - 13) / 2, top: 15, width: 13, height: 13 }
345
721
  }
346
722
  )),
347
- e.homeIndicator && /* @__PURE__ */ t(
723
+ e.homeIndicator && /* @__PURE__ */ n(
348
724
  "div",
349
725
  {
350
726
  className: "absolute rounded-full",
351
727
  style: {
352
- width: Math.round(Math.min(n, s) * 0.36),
728
+ width: Math.round(Math.min(t, a) * 0.36),
353
729
  height: 5,
354
730
  left: "50%",
355
731
  transform: "translateX(-50%)",
@@ -362,133 +738,119 @@ const et = ({
362
738
  ]
363
739
  }
364
740
  );
365
- }, ge = 96, gt = 250, Te = (e, n, s) => {
366
- const [a, r] = d.useState(1);
741
+ }, Pn = (e, t) => {
742
+ const a = d.useRef(void 0), r = d.useRef({ hostState: e, delegate: t }), s = d.useCallback((i) => {
743
+ if (a.current?.detach(), a.current = void 0, !i?.contentWindow) return;
744
+ const { host: o, detach: p } = rn({
745
+ target: i.contentWindow,
746
+ state: r.current.hostState,
747
+ delegate: r.current.delegate
748
+ });
749
+ a.current = { host: o, detach: p, sent: r.current.hostState };
750
+ }, []);
751
+ return d.useEffect(() => {
752
+ r.current = { hostState: e, delegate: t };
753
+ const i = a.current;
754
+ i && (i.host.update(Pt(i.sent, e)), i.sent = e);
755
+ }, [e, t]), s;
756
+ }, ot = ({ hostState: e, delegate: t, ...a }) => /* @__PURE__ */ n("iframe", { ...a, ref: Pn(e, t) }), Ue = 96, Cn = 250, lt = (e, t, a) => {
757
+ const [r, s] = d.useState(1);
367
758
  return d.useLayoutEffect(() => {
368
759
  const i = e.current;
369
760
  if (!i) return;
370
- const c = () => {
371
- const u = i.getBoundingClientRect(), l = Math.min(
761
+ const o = () => {
762
+ const c = i.getBoundingClientRect(), h = Math.min(
372
763
  1,
373
- (u.width - ge) / n,
374
- (u.height - ge) / s
764
+ (c.width - Ue) / t,
765
+ (c.height - Ue) / a
375
766
  );
376
- r(Math.max(0.1, l));
767
+ s(Math.max(0.1, h));
377
768
  };
378
- if (c(), typeof ResizeObserver > "u") return;
379
- const f = new ResizeObserver(c);
380
- return f.observe(i), () => f.disconnect();
381
- }, [e, n, s]), a;
382
- }, xt = ({
769
+ if (o(), typeof ResizeObserver > "u") return;
770
+ const p = new ResizeObserver(o);
771
+ return p.observe(i), () => p.disconnect();
772
+ }, [e, t, a]), r;
773
+ }, On = ({
383
774
  width: e,
384
- height: n,
385
- stageRef: s,
386
- children: a
775
+ height: t,
776
+ stageRef: a,
777
+ children: r
387
778
  }) => {
388
- const r = Te(s, e, n);
389
- return /* @__PURE__ */ t(
779
+ const s = lt(a, e, t);
780
+ return /* @__PURE__ */ n(
390
781
  "div",
391
782
  {
392
783
  className: "flex flex-none items-center justify-center overflow-hidden border border-dashed border-cream/20 p-6 text-center text-sm text-cream/55",
393
784
  "data-testid": "device-placeholder",
394
- style: { width: e * r, height: n * r },
395
- children: a
785
+ style: { width: e * s, height: t * s },
786
+ children: r
396
787
  }
397
788
  );
398
- }, yt = (e, n, s) => {
399
- try {
400
- const a = window.location.origin, r = new URL(n, a), i = new URL(s, a);
401
- if (r.origin !== i.origin || r.pathname !== i.pathname) return !1;
402
- const c = e?.contentWindow?.__swPreviewApply;
403
- return typeof c != "function" ? !1 : (c(i.search), !0);
404
- } catch {
405
- return !1;
406
- }
407
- }, Nt = ({
789
+ }, Mn = ({
408
790
  width: e,
409
- height: n,
410
- title: s,
411
- src: a,
412
- stageRef: r,
413
- reloadKey: i = 0,
791
+ height: t,
792
+ title: a,
793
+ src: r,
794
+ hostState: s,
795
+ delegate: i,
796
+ stageRef: o,
797
+ reloadKey: p = 0,
414
798
  chrome: c,
415
- landscape: f = !1,
416
- theme: u = "light"
799
+ landscape: h = !1,
800
+ theme: m = "light"
417
801
  }) => {
418
- const l = Te(r, e, n), h = d.useRef(0), [w, b] = d.useState([
419
- { mountSrc: a, currentSrc: a, generation: 0, ready: !0 }
420
- ]), m = d.useRef(w);
421
- m.current = w;
422
- const E = d.useRef(/* @__PURE__ */ new Map()), j = d.useRef(!1), L = d.useRef(i);
802
+ const b = lt(o, e, t), u = d.useRef(0), [v, N] = d.useState([{ src: r, generation: 0, ready: !0 }]), P = d.useRef(!1);
423
803
  d.useEffect(() => {
424
- if (!j.current) {
425
- j.current = !0;
804
+ if (!P.current) {
805
+ P.current = !0;
426
806
  return;
427
807
  }
428
- const g = i !== L.current;
429
- if (L.current = i, !g) {
430
- const x = m.current.findLast((O) => O.ready), M = x ? E.current.get(x.generation) : void 0;
431
- if (x && yt(M, x.currentSrc, a)) {
432
- b(
433
- (O) => O.map(
434
- (T) => T.generation === x.generation ? { ...T, currentSrc: a } : T
435
- )
436
- );
437
- return;
438
- }
439
- }
440
- h.current += 1;
441
- const S = {
442
- mountSrc: a,
443
- currentSrc: a,
444
- generation: h.current,
445
- ready: !1
446
- };
447
- b((x) => [...x.filter((M) => M.ready).slice(-1), S]);
448
- }, [a, i]);
808
+ u.current += 1;
809
+ const g = { src: r, generation: u.current, ready: !1 };
810
+ N((S) => [...S.filter((k) => k.ready).slice(-1), g]);
811
+ }, [r, p]);
449
812
  const C = (g) => {
450
813
  window.setTimeout(() => {
451
- b((S) => S.some((x) => x.generation === g) ? S.map((x) => x.generation === g ? { ...x, ready: !0 } : x).filter((x) => x.generation >= g) : S);
452
- }, gt);
453
- }, X = w.findLast((g) => g.ready), F = c ? c.radius * l : 0;
454
- return /* @__PURE__ */ o(
814
+ N((S) => S.some((k) => k.generation === g) ? S.map((k) => k.generation === g ? { ...k, ready: !0 } : k).filter((k) => k.generation >= g) : S);
815
+ }, Cn);
816
+ }, ae = v.findLast((g) => g.ready), B = c ? c.radius * b : 0;
817
+ return /* @__PURE__ */ l(
455
818
  "div",
456
819
  {
457
820
  className: `bg-panel relative flex-none overflow-hidden ${c ? "shadow-[0_0_0_1px] shadow-cream/25" : "border border-cream/20"}`,
458
821
  "data-testid": "device-frame",
459
- style: { width: e * l, height: n * l, borderRadius: F },
822
+ style: { width: e * b, height: t * b, borderRadius: B },
460
823
  children: [
461
- w.map((g) => /* @__PURE__ */ t(
462
- "iframe",
824
+ v.map((g) => /* @__PURE__ */ n(
825
+ ot,
463
826
  {
464
- ref: (S) => {
465
- S ? E.current.set(g.generation, S) : E.current.delete(g.generation);
466
- },
467
- className: `absolute inset-0 origin-top-left border-0 bg-white transition-opacity duration-150 ${g === X ? "opacity-100" : "opacity-0"}`,
468
- title: s,
469
- src: g.mountSrc,
827
+ hostState: s,
828
+ delegate: i,
829
+ className: `absolute inset-0 origin-top-left border-0 bg-white transition-opacity duration-150 ${g === ae ? "opacity-100" : "opacity-0"}`,
830
+ title: a,
831
+ src: g.src,
470
832
  width: e,
471
- height: n,
472
- style: { transform: `scale(${l})` },
833
+ height: t,
834
+ style: { transform: `scale(${b})` },
473
835
  onLoad: () => {
474
836
  g.ready || C(g.generation);
475
837
  }
476
838
  },
477
839
  g.generation
478
840
  )),
479
- c && /* @__PURE__ */ t(
841
+ c && /* @__PURE__ */ n(
480
842
  "div",
481
843
  {
482
844
  className: "pointer-events-none absolute inset-0 origin-top-left",
483
- style: { width: e, height: n, transform: `scale(${l})` },
484
- children: /* @__PURE__ */ t(
485
- vt,
845
+ style: { width: e, height: t, transform: `scale(${b})` },
846
+ children: /* @__PURE__ */ n(
847
+ En,
486
848
  {
487
849
  spec: c,
488
850
  width: e,
489
- height: n,
490
- landscape: f,
491
- theme: u
851
+ height: t,
852
+ landscape: h,
853
+ theme: m
492
854
  }
493
855
  )
494
856
  }
@@ -496,494 +858,563 @@ const et = ({
496
858
  ]
497
859
  }
498
860
  );
499
- }, St = ({
861
+ }, $n = ({
500
862
  paywall: e,
501
- missing: n,
502
- onDismiss: s
503
- }) => /* @__PURE__ */ t(
863
+ missing: t,
864
+ onDismiss: a
865
+ }) => /* @__PURE__ */ n(
504
866
  "div",
505
867
  {
506
868
  className: "fixed inset-0 z-50 flex items-center justify-center bg-ink/70 p-6",
507
869
  role: "dialog",
508
870
  "aria-modal": "true",
509
871
  "aria-labelledby": "sw-missing-products",
510
- children: /* @__PURE__ */ o("div", { className: "bg-panel flex w-full max-w-md flex-col gap-4 border border-cream/20 p-5", children: [
511
- /* @__PURE__ */ o("div", { className: "flex flex-col gap-1.5", children: [
512
- /* @__PURE__ */ t("span", { id: "sw-missing-products", className: "text-[0.9375rem] font-medium text-cream", children: n.length === 1 ? "A product is missing" : `${n.length} products are missing` }),
513
- /* @__PURE__ */ t("span", { className: "text-[0.8125rem] leading-relaxed text-cream/60", children: `${e} declares ${n.length === 1 ? "a product" : "products"} Superwall has no record of. Every variable on ${n.length === 1 ? "it" : "them"} will be undefined here and on device.` })
872
+ children: /* @__PURE__ */ l("div", { className: "bg-panel flex w-full max-w-md flex-col gap-4 border border-cream/20 p-5", children: [
873
+ /* @__PURE__ */ l("div", { className: "flex flex-col gap-1.5", children: [
874
+ /* @__PURE__ */ n("span", { id: "sw-missing-products", className: "text-[0.9375rem] font-medium text-cream", children: t.length === 1 ? "A product is missing" : `${t.length} products are missing` }),
875
+ /* @__PURE__ */ n("span", { className: "text-[0.8125rem] leading-relaxed text-cream/60", children: `${e} declares ${t.length === 1 ? "a product" : "products"} Superwall has no record of. Every variable on ${t.length === 1 ? "it" : "them"} will be undefined here and on device.` })
514
876
  ] }),
515
- /* @__PURE__ */ t("ul", { className: "flex flex-col gap-1.5 border-y border-cream/10 py-3", children: n.map((a) => /* @__PURE__ */ o("li", { className: "flex items-baseline justify-between gap-3", children: [
516
- /* @__PURE__ */ t("span", { className: "font-mono text-[11px] text-cream/70", children: a.reference }),
517
- /* @__PURE__ */ t("span", { className: "truncate font-mono text-[11px] text-cream/40", children: a.identifier })
518
- ] }, a.reference)) }),
519
- /* @__PURE__ */ o("span", { className: "text-xs text-cream/45", children: [
877
+ /* @__PURE__ */ n("ul", { className: "flex flex-col gap-1.5 border-y border-cream/10 py-3", children: t.map((r) => /* @__PURE__ */ l("li", { className: "flex items-baseline justify-between gap-3", children: [
878
+ /* @__PURE__ */ n("span", { className: "font-mono text-[11px] text-cream/70", children: r.reference }),
879
+ /* @__PURE__ */ n("span", { className: "truncate font-mono text-[11px] text-cream/40", children: r.identifier })
880
+ ] }, r.reference)) }),
881
+ /* @__PURE__ */ l("span", { className: "text-xs text-cream/45", children: [
520
882
  "Add ",
521
- n.length === 1 ? "it" : "them",
883
+ t.length === 1 ? "it" : "them",
522
884
  " in the Superwall dashboard, or point the config at",
523
- n.length === 1 ? " a product" : " products",
885
+ t.length === 1 ? " a product" : " products",
524
886
  " that exists. Pushing is refused until then."
525
887
  ] }),
526
- /* @__PURE__ */ t("button", { type: "button", className: "sw-btn sw-btn--primary self-end", onClick: s, children: "View anyway" })
888
+ /* @__PURE__ */ n("button", { type: "button", className: "sw-btn sw-btn--primary self-end", onClick: a, children: "View anyway" })
527
889
  ] })
528
890
  }
529
- ), Ae = "superwall-studio", kt = /* @__PURE__ */ new Set([
891
+ ), Tn = /* @__PURE__ */ new Set([
530
892
  "ping",
531
893
  "page_view",
532
894
  "page_styles",
533
895
  "has_set_dom",
534
896
  "haptic_feedback",
535
897
  "var_click",
536
- "template_variables",
537
- "template_substitutions_prefix",
538
- "products",
539
- "paywall_open",
540
- "experiment",
541
- "purchase"
542
- ]), _t = {
898
+ "purchase",
899
+ "restore"
900
+ ]), Rn = {
543
901
  open_url: ["url"],
544
902
  open_url_external: ["url"],
545
- open_deep_link: ["link", "url"],
546
- custom_placement: ["name", "placementName"],
903
+ open_deep_link: ["link"],
904
+ custom_placement: ["name"],
547
905
  custom: ["name", "data"],
548
- request_permission: ["permissionType"],
906
+ request_permission: ["permission_type"],
549
907
  request_callback: ["name"],
550
- schedule_notification: ["title"]
551
- }, Pt = /* @__PURE__ */ new Set(["close", "transaction_abandon", "transaction_fail"]), Et = /* @__PURE__ */ new Set(["transaction_complete", "freeTrial_start"]), Ct = (e) => {
552
- for (const n of _t[e.event_name] ?? []) {
553
- const s = e[n];
554
- if (typeof s == "string" && s.length > 0) return s;
908
+ schedule_notification: ["title"],
909
+ discount_redemption_result: ["code"]
910
+ }, An = /* @__PURE__ */ new Set(["close"]), Dn = /* @__PURE__ */ new Set([
911
+ "stripe_checkout_complete",
912
+ "post_checkout_complete"
913
+ ]), Ln = (e) => {
914
+ for (const t of Rn[e.event_name] ?? []) {
915
+ const a = Reflect.get(e, t);
916
+ if (typeof a == "string" && a.length > 0) return a;
555
917
  }
556
- }, Mt = (e) => {
557
- if (!kt.has(e.event_name))
918
+ }, jn = (e) => {
919
+ if (!Tn.has(e.event_name))
558
920
  return {
559
921
  action: e.event_name,
560
- subject: Ct(e),
561
- tone: Pt.has(e.event_name) ? "warning" : Et.has(e.event_name) ? "success" : "info"
922
+ subject: Ln(e),
923
+ tone: An.has(e.event_name) ? "warning" : Dn.has(e.event_name) ? "success" : "info"
562
924
  };
563
- }, De = (e) => typeof e == "object" && e !== null && Reflect.get(e, "channel") === Ae && ["hello", "event", "ask"].includes(String(Reflect.get(e, "type"))), $t = (e) => Array.isArray(e) && e.every((n) => typeof n == "string"), It = (e) => De(e) && e.type === "hello" && $t(e.locales) ? e.locales : void 0, Ot = {
925
+ }, Un = {
564
926
  info: "text-cream/45",
565
927
  success: "text-accent",
566
928
  warning: "text-red"
567
- }, Rt = {
568
- purchase: re,
569
- transaction_complete: we,
570
- freeTrial_start: we,
571
- transaction_abandon: ve,
572
- transaction_fail: ve,
573
- close: Oe,
574
- restore: Ie,
575
- open_url: Z,
576
- open_url_external: Z,
577
- open_deep_link: Z,
578
- initiate_web_checkout: re,
579
- open_payment_sheet: re,
580
- custom_placement: K,
581
- custom: K,
582
- request_permission: K,
583
- request_callback: K,
584
- schedule_notification: it,
585
- request_store_review: lt,
586
- user_attribute_updated: ot
587
- }, H = ({ children: e }) => /* @__PURE__ */ t("span", { className: "bg-accent/15 text-accent px-1.5 py-px font-mono text-xs whitespace-nowrap", children: e }), he = ({
929
+ }, Fn = {
930
+ purchase: he,
931
+ transaction_complete: ue,
932
+ freeTrial_start: ue,
933
+ transaction_abandon: me,
934
+ transaction_fail: me,
935
+ close: at,
936
+ restore: nt,
937
+ restore_complete: ue,
938
+ restore_fail: me,
939
+ open_url: G,
940
+ open_url_external: G,
941
+ open_deep_link: G,
942
+ initiate_web_checkout: he,
943
+ open_payment_sheet: he,
944
+ custom_placement: W,
945
+ custom: W,
946
+ request_permission: W,
947
+ request_callback: W,
948
+ schedule_notification: fn,
949
+ request_store_review: bn,
950
+ user_attribute_updated: vn
951
+ }, H = ({ children: e }) => /* @__PURE__ */ n("span", { className: "bg-accent/15 text-accent px-1.5 py-px font-mono text-xs whitespace-nowrap", children: e }), _e = ({
588
952
  action: e,
589
- tone: n,
590
- children: s,
591
- actions: a
953
+ tone: t,
954
+ children: a,
955
+ actions: r
592
956
  }) => {
593
- const r = Rt[e] ?? rt;
594
- return /* @__PURE__ */ t("div", { className: "bg-panel font-sans w-[344px] border border-cream/15 p-3 shadow-[0_8px_24px_-8px] shadow-black/60", children: /* @__PURE__ */ o("div", { className: "grid grid-cols-[14px_1fr] items-start gap-x-2.5", children: [
595
- /* @__PURE__ */ t("span", { className: `flex h-5 items-center justify-center ${Ot[n]}`, children: /* @__PURE__ */ t(r, {}) }),
596
- /* @__PURE__ */ t("span", { className: "text-[0.8125rem] leading-5 font-medium text-cream", children: s }),
597
- a && /* @__PURE__ */ t("div", { className: "col-start-2 mt-2.5 flex justify-end gap-2", children: a })
957
+ const s = Fn[e] ?? hn;
958
+ return /* @__PURE__ */ n("div", { className: "bg-panel font-sans w-[344px] border border-cream/15 p-3 shadow-[0_8px_24px_-8px] shadow-black/60", children: /* @__PURE__ */ l("div", { className: "grid grid-cols-[14px_1fr] items-start gap-x-2.5", children: [
959
+ /* @__PURE__ */ n("span", { className: `flex h-5 items-center justify-center ${Un[t]}`, children: /* @__PURE__ */ n(s, {}) }),
960
+ /* @__PURE__ */ n("span", { className: "text-[0.8125rem] leading-5 font-medium text-cream", children: a }),
961
+ r && /* @__PURE__ */ n("div", { className: "col-start-2 mt-2.5 flex justify-end gap-2", children: r })
598
962
  ] }) });
599
- }, jt = ({ notice: e }) => /* @__PURE__ */ o(he, { action: e.action, tone: e.tone, children: [
963
+ }, Hn = ({ notice: e }) => /* @__PURE__ */ l(_e, { action: e.action, tone: e.tone, children: [
600
964
  "Tap triggered a ",
601
- /* @__PURE__ */ t(H, { children: e.action }),
602
- e.subject ? /* @__PURE__ */ o(U, { children: [
965
+ /* @__PURE__ */ n(H, { children: e.action }),
966
+ e.subject ? /* @__PURE__ */ l(Z, { children: [
603
967
  " for ",
604
- /* @__PURE__ */ t(H, { children: e.subject })
968
+ /* @__PURE__ */ n(H, { children: e.subject })
605
969
  ] }) : " action",
606
970
  "."
607
- ] }), xe = {
608
- completed: { action: "transaction_complete", tone: "success", label: "purchase completed." },
609
- abandoned: { action: "transaction_abandon", tone: "warning", label: "purchase abandoned." },
610
- granted: { action: "request_permission", tone: "success", label: "granted." },
611
- denied: { action: "request_permission", tone: "warning", label: "denied." },
612
- success: { action: "request_callback", tone: "success", label: "succeeded." },
613
- failure: { action: "request_callback", tone: "warning", label: "failed." }
614
- }, Lt = ({ outcome: e, subject: n }) => {
615
- const s = xe[e] ?? xe.completed;
616
- return /* @__PURE__ */ o(he, { action: s?.action ?? "purchase", tone: s?.tone ?? "info", children: [
617
- /* @__PURE__ */ t(H, { children: n }),
618
- " ",
619
- s?.label
620
- ] });
621
- }, ye = {
622
- purchase: { action: "purchase", verb: "purchase", no: "Abandon", yes: "Complete" },
623
- permission: { action: "request_permission", verb: "permission", no: "Deny", yes: "Grant" },
624
- callback: { action: "request_callback", verb: "callback", no: "Fail", yes: "Succeed" }
625
- }, Tt = {
626
- purchase: ["abandoned", "completed"],
627
- permission: ["denied", "granted"],
628
- callback: ["failure", "success"]
629
- }, At = ({
630
- kind: e,
631
- subject: n,
971
+ ] }), Bn = ({ choice: e, subject: t }) => /* @__PURE__ */ l(_e, { action: e.action, tone: e.tone, children: [
972
+ /* @__PURE__ */ n(H, { children: t }),
973
+ " ",
974
+ e.done
975
+ ] }), Vn = ({
976
+ action: e,
977
+ verb: t,
978
+ subject: a,
979
+ choices: r,
632
980
  onAnswer: s
633
- }) => {
634
- const a = ye[e] ?? ye.purchase, [r, i] = Tt[e] ?? ["abandoned", "completed"];
635
- return /* @__PURE__ */ o(
636
- he,
637
- {
638
- action: a?.action ?? "purchase",
639
- tone: "info",
640
- actions: /* @__PURE__ */ o(U, { children: [
641
- /* @__PURE__ */ t("button", { type: "button", className: "sw-btn", onClick: () => s(r), children: a?.no }),
642
- /* @__PURE__ */ t("button", { type: "button", className: "sw-btn sw-btn--primary", onClick: () => s(i), children: a?.yes })
643
- ] }),
644
- children: [
645
- "Tap triggered a ",
646
- /* @__PURE__ */ t(H, { children: a?.verb }),
647
- " for ",
648
- /* @__PURE__ */ t(H, { children: n }),
649
- "."
650
- ]
651
- }
981
+ }) => /* @__PURE__ */ l(
982
+ _e,
983
+ {
984
+ action: e,
985
+ tone: "info",
986
+ actions: r.map((i) => /* @__PURE__ */ n(
987
+ "button",
988
+ {
989
+ type: "button",
990
+ className: i.primary ? "sw-btn sw-btn--primary" : "sw-btn",
991
+ onClick: () => s(i),
992
+ children: i.label
993
+ },
994
+ i.label
995
+ )),
996
+ children: [
997
+ "Tap triggered a ",
998
+ /* @__PURE__ */ n(H, { children: t }),
999
+ " for ",
1000
+ /* @__PURE__ */ n(H, { children: a }),
1001
+ "."
1002
+ ]
1003
+ }
1004
+ ), qn = [
1005
+ {
1006
+ label: "Abandon",
1007
+ value: "abandoned",
1008
+ action: "transaction_abandon",
1009
+ tone: "warning",
1010
+ done: "purchase abandoned."
1011
+ },
1012
+ {
1013
+ label: "Fail",
1014
+ value: "failed",
1015
+ action: "transaction_fail",
1016
+ tone: "warning",
1017
+ done: "purchase failed."
1018
+ },
1019
+ {
1020
+ label: "Complete",
1021
+ value: "completed",
1022
+ primary: !0,
1023
+ action: "transaction_complete",
1024
+ tone: "success",
1025
+ done: "purchase completed."
1026
+ }
1027
+ ], zn = [
1028
+ {
1029
+ label: "Nothing",
1030
+ value: "failed",
1031
+ action: "restore_fail",
1032
+ tone: "warning",
1033
+ done: "nothing to restore."
1034
+ },
1035
+ {
1036
+ label: "Restore",
1037
+ value: "restored",
1038
+ primary: !0,
1039
+ action: "restore_complete",
1040
+ tone: "success",
1041
+ done: "restored."
1042
+ }
1043
+ ], Wn = [
1044
+ {
1045
+ label: "Deny",
1046
+ value: "denied",
1047
+ action: "request_permission",
1048
+ tone: "warning",
1049
+ done: "denied."
1050
+ },
1051
+ {
1052
+ label: "Grant",
1053
+ value: "granted",
1054
+ primary: !0,
1055
+ action: "request_permission",
1056
+ tone: "success",
1057
+ done: "granted."
1058
+ }
1059
+ ], Kn = [
1060
+ { label: "Fail", value: "failure", action: "request_callback", tone: "warning", done: "failed." },
1061
+ {
1062
+ label: "Succeed",
1063
+ value: "success",
1064
+ primary: !0,
1065
+ action: "request_callback",
1066
+ tone: "success",
1067
+ done: "succeeded."
1068
+ }
1069
+ ];
1070
+ let Jn = 0;
1071
+ const K = (e, t, a, r) => new Promise((s) => {
1072
+ const i = `${e}-${Jn += 1}`;
1073
+ U.custom(
1074
+ () => /* @__PURE__ */ n(
1075
+ Vn,
1076
+ {
1077
+ action: e,
1078
+ verb: t,
1079
+ subject: a,
1080
+ choices: r,
1081
+ onAnswer: (o) => {
1082
+ U.dismiss(i), U.custom(() => /* @__PURE__ */ n(Bn, { choice: o, subject: a })), s(o.value);
1083
+ }
1084
+ }
1085
+ ),
1086
+ { id: i, duration: Number.POSITIVE_INFINITY }
652
1087
  );
653
- }, Dt = ({
1088
+ }), Gn = () => ({
1089
+ event: (e) => {
1090
+ const t = jn(e);
1091
+ t && U.custom(() => /* @__PURE__ */ n(Hn, { notice: t }));
1092
+ },
1093
+ purchase: (e) => K("purchase", "purchase", e.reference, qn),
1094
+ restore: () => K("restore", "restore", "purchases", zn),
1095
+ close: () => {
1096
+ },
1097
+ openUrl: () => {
1098
+ },
1099
+ custom: () => {
1100
+ },
1101
+ customPlacement: () => {
1102
+ },
1103
+ permission: (e) => K("request_permission", "permission", e, Wn),
1104
+ callback: (e) => K("request_callback", "callback", e, Kn).then((t) => ({ status: t }))
1105
+ }), Yn = () => d.useMemo(Gn, []), Zn = ({
654
1106
  surfaceKey: e,
655
- raised: n = !1
1107
+ raised: t = !1
656
1108
  }) => (d.useEffect(() => {
657
- D.dismiss();
658
- }, [e]), d.useEffect(() => {
659
- const s = (a) => {
660
- if (!De(a.data)) return;
661
- if (a.data.type === "ask") {
662
- const { id: i, kind: c, subject: f } = a.data, u = (l) => {
663
- a.source?.postMessage(
664
- { channel: Ae, type: "answer", id: i, outcome: l },
665
- "*"
666
- ), D.dismiss(i), D.custom(() => /* @__PURE__ */ t(Lt, { outcome: l, subject: f }));
667
- };
668
- D.custom(() => /* @__PURE__ */ t(At, { kind: c, subject: f, onAnswer: u }), {
669
- id: i,
670
- duration: Number.POSITIVE_INFINITY
671
- });
672
- return;
673
- }
674
- if (a.data.type !== "event") return;
675
- const r = Mt(a.data.message);
676
- r && D.custom(() => /* @__PURE__ */ t(jt, { notice: r }));
677
- };
678
- return window.addEventListener("message", s), () => window.removeEventListener("message", s);
679
- }, []), /* @__PURE__ */ t(
680
- Xe,
1109
+ U.dismiss();
1110
+ }, [e]), /* @__PURE__ */ n(
1111
+ kt,
681
1112
  {
682
1113
  position: "top-center",
683
1114
  swipeDirections: ["top"],
684
- offset: n ? 84 : 52,
1115
+ offset: t ? 84 : 52,
685
1116
  gap: 8,
686
1117
  visibleToasts: 3,
687
1118
  style: { zIndex: 5 },
688
1119
  toastOptions: { unstyled: !0, classNames: { toast: "w-full" } }
689
1120
  }
690
- )), Bt = ({
1121
+ )), Qn = ({
691
1122
  value: e,
692
- options: n,
693
- onChange: s,
694
- label: a
695
- }) => /* @__PURE__ */ t("div", { className: "sw-segmented", role: "group", "aria-label": a, children: n.map((r) => /* @__PURE__ */ t(
1123
+ options: t,
1124
+ onChange: a,
1125
+ label: r
1126
+ }) => /* @__PURE__ */ n("div", { className: "sw-segmented", role: "group", "aria-label": r, children: t.map((s) => /* @__PURE__ */ n(
696
1127
  "button",
697
1128
  {
698
1129
  type: "button",
699
- "aria-pressed": r.value === e,
700
- onClick: () => s(r.value),
701
- children: r.label
1130
+ "aria-pressed": s.value === e,
1131
+ onClick: () => a(s.value),
1132
+ children: s.label
702
1133
  },
703
- r.value
704
- )) }), Ne = ({
1134
+ s.value
1135
+ )) }), Fe = ({
705
1136
  value: e,
706
- options: n,
707
- onChange: s,
708
- label: a
709
- }) => /* @__PURE__ */ t(
1137
+ options: t,
1138
+ onChange: a,
1139
+ label: r
1140
+ }) => /* @__PURE__ */ n(
710
1141
  "select",
711
1142
  {
712
1143
  className: "sw-select",
713
- "aria-label": a,
1144
+ "aria-label": r,
714
1145
  value: e,
715
- onChange: (r) => s(r.target.value),
716
- children: n.map((r) => /* @__PURE__ */ t("option", { value: r.value, children: r.label }, r.value))
1146
+ onChange: (s) => a(s.target.value),
1147
+ children: t.map((s) => /* @__PURE__ */ n("option", { value: s.value, children: s.label }, s.value))
717
1148
  }
718
- ), Ut = ({
1149
+ ), Xn = ({
719
1150
  checked: e,
720
- onChange: n,
721
- label: s
722
- }) => /* @__PURE__ */ t(
1151
+ onChange: t,
1152
+ label: a
1153
+ }) => /* @__PURE__ */ n(
723
1154
  "button",
724
1155
  {
725
1156
  type: "button",
726
1157
  role: "switch",
727
1158
  "aria-checked": e,
728
- "aria-label": s,
1159
+ "aria-label": a,
729
1160
  className: "sw-switch",
730
- onClick: () => n(!e)
1161
+ onClick: () => t(!e)
731
1162
  }
732
- ), Ht = ({
1163
+ ), ea = ({
733
1164
  open: e,
734
- title: n,
735
- onClose: s,
736
- children: a
737
- }) => /* @__PURE__ */ t(
1165
+ title: t,
1166
+ onClose: a,
1167
+ children: r
1168
+ }) => /* @__PURE__ */ n(
738
1169
  "aside",
739
1170
  {
740
1171
  className: `flex-none overflow-hidden transition-[width] duration-200 ease-out motion-reduce:transition-none ${e ? "w-72" : "w-0"}`,
741
1172
  "aria-hidden": !e,
742
1173
  inert: !e,
743
- children: /* @__PURE__ */ o("div", { className: "bg-bar flex h-full w-72 flex-col border-l border-cream/10", children: [
744
- /* @__PURE__ */ o("div", { className: "flex h-11 flex-none items-center justify-between border-b border-cream/10 px-3", children: [
745
- /* @__PURE__ */ t("span", { className: "text-[0.8125rem] font-medium text-cream", children: n }),
746
- /* @__PURE__ */ t(
1174
+ children: /* @__PURE__ */ l("div", { className: "bg-bar flex h-full w-72 flex-col border-l border-cream/10", children: [
1175
+ /* @__PURE__ */ l("div", { className: "flex h-11 flex-none items-center justify-between border-b border-cream/10 px-3", children: [
1176
+ /* @__PURE__ */ n("span", { className: "text-[0.8125rem] font-medium text-cream", children: t }),
1177
+ /* @__PURE__ */ n(
747
1178
  "button",
748
1179
  {
749
1180
  type: "button",
750
1181
  className: "sw-btn sw-btn--icon border-transparent",
751
- "aria-label": `Close ${n.toLowerCase()}`,
752
- onClick: s,
753
- children: /* @__PURE__ */ t(Oe, {})
1182
+ "aria-label": `Close ${t.toLowerCase()}`,
1183
+ onClick: a,
1184
+ children: /* @__PURE__ */ n(at, {})
754
1185
  }
755
1186
  )
756
1187
  ] }),
757
- /* @__PURE__ */ t("div", { className: "flex-1 overflow-y-auto px-4 py-2", children: a })
1188
+ /* @__PURE__ */ n("div", { className: "flex-1 overflow-y-auto px-4 py-2", children: r })
758
1189
  ] })
759
1190
  }
760
- ), Ft = ({ children: e }) => /* @__PURE__ */ t("div", { className: "bg-bar z-10 flex min-h-14 flex-none flex-wrap items-center justify-center gap-3 border-t border-cream/10 px-4 py-2.5", children: e }), G = ({ label: e, children: n }) => /* @__PURE__ */ o("div", { className: "flex items-center gap-2.5", children: [
761
- /* @__PURE__ */ t("span", { className: "sw-tool-label", children: e }),
762
- n
763
- ] }), Se = () => /* @__PURE__ */ t("span", { className: "h-6 w-px bg-cream/10" }), Be = ({
1191
+ ), ta = ({ children: e }) => /* @__PURE__ */ n("div", { className: "bg-bar z-10 flex min-h-14 flex-none flex-wrap items-center justify-center gap-3 border-t border-cream/10 px-4 py-2.5", children: e }), J = ({ label: e, children: t }) => /* @__PURE__ */ l("div", { className: "flex items-center gap-2.5", children: [
1192
+ /* @__PURE__ */ n("span", { className: "sw-tool-label", children: e }),
1193
+ t
1194
+ ] }), He = () => /* @__PURE__ */ n("span", { className: "h-6 w-px bg-cream/10" }), ct = d.createContext(void 0), dt = () => {
1195
+ const e = d.useContext(ct);
1196
+ if (!e)
1197
+ throw new Error("Studio components must be rendered inside <StudioHostProvider>.");
1198
+ return e;
1199
+ }, na = ({
1200
+ mode: e,
1201
+ home: t,
1202
+ children: a
1203
+ }) => {
1204
+ const { href: r, navigate: s } = t, i = d.useMemo(
1205
+ () => ({ mode: e, home: { href: r, navigate: s } }),
1206
+ [e, r, s]
1207
+ );
1208
+ return /* @__PURE__ */ n(ct.Provider, { value: i, children: a });
1209
+ }, aa = () => dt().mode, ra = () => dt().home, pt = ({
764
1210
  title: e,
765
- onHome: n,
766
- actions: s,
1211
+ actions: t,
767
1212
  inset: a = !1,
768
1213
  label: r = "Studio"
769
- }) => /* @__PURE__ */ t("header", { className: "relative z-10 flex h-11 flex-none items-center border-b border-cream/10 bg-ink", children: /* @__PURE__ */ o(
770
- "div",
771
- {
772
- className: `flex h-full w-full items-center px-3 ${a ? "mx-auto max-w-[1080px] sm:px-0" : ""}`,
773
- children: [
774
- /* @__PURE__ */ o(
775
- "a",
776
- {
777
- className: "flex items-center gap-3 text-[0.9375rem] font-semibold tracking-[0.01em]",
778
- href: "/",
779
- onClick: (i) => {
780
- i.metaKey || i.ctrlKey || (i.preventDefault(), n());
781
- },
782
- children: [
783
- /* @__PURE__ */ o("span", { className: "whitespace-nowrap", children: [
784
- /* @__PURE__ */ t("em", { className: "text-accent not-italic", children: "$UPER" }),
785
- "WALL"
786
- ] }),
787
- /* @__PURE__ */ t("span", { className: "h-4 w-px bg-cream/20" }),
788
- /* @__PURE__ */ t("span", { className: "font-normal", children: r })
789
- ]
790
- }
791
- ),
792
- /* @__PURE__ */ t("span", { className: "absolute left-1/2 hidden -translate-x-1/2 text-sm font-medium whitespace-nowrap sm:block", children: e }),
793
- /* @__PURE__ */ t("div", { className: "ml-auto flex items-center gap-2", children: s })
794
- ]
795
- }
796
- ) }), zt = [
1214
+ }) => {
1215
+ const s = ra();
1216
+ return /* @__PURE__ */ n("header", { className: "relative z-10 flex h-11 flex-none items-center border-b border-cream/10 bg-ink", children: /* @__PURE__ */ l(
1217
+ "div",
1218
+ {
1219
+ className: `flex h-full w-full items-center px-3 ${a ? "mx-auto max-w-[1080px] sm:px-0" : ""}`,
1220
+ children: [
1221
+ /* @__PURE__ */ l(
1222
+ "a",
1223
+ {
1224
+ className: "flex items-center gap-3 text-[0.9375rem] font-semibold tracking-[0.01em]",
1225
+ href: s.href,
1226
+ onClick: (i) => {
1227
+ i.button === 0 && (i.metaKey || i.ctrlKey || i.shiftKey || i.altKey || (i.preventDefault(), s.navigate()));
1228
+ },
1229
+ children: [
1230
+ /* @__PURE__ */ l("span", { className: "whitespace-nowrap", children: [
1231
+ /* @__PURE__ */ n("em", { className: "text-accent not-italic", children: "$UPER" }),
1232
+ "WALL"
1233
+ ] }),
1234
+ /* @__PURE__ */ n("span", { className: "h-4 w-px bg-cream/20" }),
1235
+ /* @__PURE__ */ n("span", { className: "font-normal", children: r })
1236
+ ]
1237
+ }
1238
+ ),
1239
+ /* @__PURE__ */ n("span", { className: "absolute left-1/2 hidden -translate-x-1/2 text-sm font-medium whitespace-nowrap sm:block", children: e }),
1240
+ /* @__PURE__ */ n("div", { className: "ml-auto flex items-center gap-2", children: t })
1241
+ ]
1242
+ }
1243
+ ) });
1244
+ }, sa = [
797
1245
  { key: "user", label: "User", blurb: "Attributes your app sets" },
798
1246
  { key: "device", label: "Device", blurb: "Platform, locale, OS — the SDK fills these in" },
799
1247
  { key: "params", label: "Params", blurb: "Passed in at the placement" },
800
1248
  { key: "products", label: "Products", blurb: "Store data for this paywall's products" }
801
- ], ke = (e) => e == null ? "" : typeof e == "string" ? e : JSON.stringify(e), Vt = (e) => e === "true" ? !0 : e === "false" ? !1 : e.trim() !== "" && Number.isFinite(Number(e)) ? Number(e) : e, le = (e) => e.slice(e.indexOf(".") + 1), qt = ({
1249
+ ], Be = (e) => e == null ? "" : typeof e == "string" ? e : JSON.stringify(e), ia = (e) => e === "true" ? !0 : e === "false" ? !1 : e.trim() !== "" && Number.isFinite(Number(e)) ? Number(e) : e, be = (e) => e.slice(e.indexOf(".") + 1), oa = ({
802
1250
  row: e,
803
- override: n,
804
- onChange: s
1251
+ override: t,
1252
+ onChange: a
805
1253
  }) => {
806
- const a = n !== void 0, r = a ? n : e.value;
807
- return /* @__PURE__ */ o("div", { className: "flex flex-col gap-1 py-1.5", children: [
808
- /* @__PURE__ */ o("div", { className: "flex items-baseline justify-between gap-2", children: [
809
- /* @__PURE__ */ t("span", { className: "truncate font-mono text-[11px] text-cream/70", children: e.path }),
810
- a && /* @__PURE__ */ t(
1254
+ const r = t !== void 0, s = r ? t : e.value;
1255
+ return /* @__PURE__ */ l("div", { className: "flex flex-col gap-1 py-1.5", children: [
1256
+ /* @__PURE__ */ l("div", { className: "flex items-baseline justify-between gap-2", children: [
1257
+ /* @__PURE__ */ n("span", { className: "truncate font-mono text-[11px] text-cream/70", children: e.path }),
1258
+ r && /* @__PURE__ */ n(
811
1259
  "button",
812
1260
  {
813
1261
  type: "button",
814
1262
  className: "shrink-0 text-[11px] text-cream/40 hover:text-cream",
815
1263
  "aria-label": `Reset ${e.path}`,
816
- onClick: () => s(void 0),
1264
+ onClick: () => a(void 0),
817
1265
  children: "Reset"
818
1266
  }
819
1267
  )
820
1268
  ] }),
821
- typeof r == "boolean" ? /* @__PURE__ */ t("span", { className: "flex h-7 items-center", children: /* @__PURE__ */ t(
1269
+ typeof s == "boolean" ? /* @__PURE__ */ n("span", { className: "flex h-7 items-center", children: /* @__PURE__ */ n(
822
1270
  "button",
823
1271
  {
824
1272
  type: "button",
825
1273
  className: "sw-switch",
826
1274
  role: "switch",
827
- "aria-checked": r,
1275
+ "aria-checked": s,
828
1276
  "aria-label": e.path,
829
- onClick: () => s(!r)
1277
+ onClick: () => a(!s)
830
1278
  }
831
- ) }) : /* @__PURE__ */ t(
1279
+ ) }) : /* @__PURE__ */ n(
832
1280
  "input",
833
1281
  {
834
1282
  className: "sw-input w-full",
835
1283
  "aria-label": e.path,
836
- value: ke(r),
837
- placeholder: ke(e.value),
1284
+ value: Be(s),
1285
+ placeholder: Be(e.value),
838
1286
  onChange: (i) => {
839
- const c = i.target.value;
840
- s(c === "" ? void 0 : Vt(c));
1287
+ const o = i.target.value;
1288
+ a(o === "" ? void 0 : ia(o));
841
1289
  }
842
1290
  }
843
1291
  )
844
1292
  ] });
845
- }, Wt = ({
1293
+ }, la = ({
846
1294
  label: e,
847
- blurb: n,
848
- rows: s,
849
- overrideOf: a,
850
- onChange: r
1295
+ blurb: t,
1296
+ rows: a,
1297
+ overrideOf: r,
1298
+ onChange: s
851
1299
  }) => {
852
- const [i, c] = d.useState(!1), f = s.filter((u) => a(u.path) !== void 0).length;
853
- return /* @__PURE__ */ o("section", { className: "border-b border-cream/10 last:border-b-0", children: [
854
- /* @__PURE__ */ o(
1300
+ const [i, o] = d.useState(!1), p = a.filter((c) => r(c.path) !== void 0).length;
1301
+ return /* @__PURE__ */ l("section", { className: "border-b border-cream/10 last:border-b-0", children: [
1302
+ /* @__PURE__ */ l(
855
1303
  "button",
856
1304
  {
857
1305
  type: "button",
858
1306
  className: "flex w-full items-center gap-2 py-3 text-left",
859
1307
  "aria-expanded": i,
860
- onClick: () => c((u) => !u),
1308
+ onClick: () => o((c) => !c),
861
1309
  children: [
862
- /* @__PURE__ */ o("span", { className: "flex min-w-0 flex-col gap-0.5", children: [
863
- /* @__PURE__ */ o("span", { className: "flex items-baseline gap-2", children: [
864
- /* @__PURE__ */ t("span", { className: "text-[0.8125rem] font-medium text-cream", children: e }),
865
- /* @__PURE__ */ t("span", { className: "text-xs text-cream/40", children: f > 0 ? /* @__PURE__ */ t("span", { className: "text-accent", children: `${f} set` }) : s.length || null })
1310
+ /* @__PURE__ */ l("span", { className: "flex min-w-0 flex-col gap-0.5", children: [
1311
+ /* @__PURE__ */ l("span", { className: "flex items-baseline gap-2", children: [
1312
+ /* @__PURE__ */ n("span", { className: "text-[0.8125rem] font-medium text-cream", children: e }),
1313
+ /* @__PURE__ */ n("span", { className: "text-xs text-cream/40", children: p > 0 ? /* @__PURE__ */ n("span", { className: "text-accent", children: `${p} set` }) : a.length || null })
866
1314
  ] }),
867
- /* @__PURE__ */ t("span", { className: "truncate text-xs text-cream/55", children: n })
1315
+ /* @__PURE__ */ n("span", { className: "truncate text-xs text-cream/55", children: t })
868
1316
  ] }),
869
- /* @__PURE__ */ t(
1317
+ /* @__PURE__ */ n(
870
1318
  "span",
871
1319
  {
872
1320
  className: `ml-auto shrink-0 text-cream/40 transition-transform ${i ? "" : "-rotate-90"}`,
873
1321
  "aria-hidden": "true",
874
- children: /* @__PURE__ */ t(Re, {})
1322
+ children: /* @__PURE__ */ n(rt, {})
875
1323
  }
876
1324
  )
877
1325
  ]
878
1326
  }
879
1327
  ),
880
- i && (s.length === 0 ? /* @__PURE__ */ t("span", { className: "block pb-3 text-xs text-cream/35", children: "Nothing here for this paywall." }) : /* @__PURE__ */ t("div", { className: "flex flex-col pb-2", children: s.map((u) => /* @__PURE__ */ t(
881
- qt,
1328
+ i && (a.length === 0 ? /* @__PURE__ */ n("span", { className: "block pb-3 text-xs text-cream/35", children: "Nothing here for this paywall." }) : /* @__PURE__ */ n("div", { className: "flex flex-col pb-2", children: a.map((c) => /* @__PURE__ */ n(
1329
+ oa,
882
1330
  {
883
- row: u,
884
- override: a(u.path),
885
- onChange: (l) => r(u.path, l)
1331
+ row: c,
1332
+ override: r(c.path),
1333
+ onChange: (h) => s(c.path, h)
886
1334
  },
887
- u.path
1335
+ c.path
888
1336
  )) }))
889
1337
  ] });
890
- }, Kt = ({
1338
+ }, ca = ({
891
1339
  overrides: e,
892
- groups: n,
893
- onChange: s
1340
+ groups: t,
1341
+ onChange: a
894
1342
  }) => {
895
- const a = (r, i, c) => {
896
- if (r !== "products") {
897
- const w = { ...e[r] };
898
- c === void 0 ? delete w[le(i)] : w[le(i)] = c, s({ ...e, [r]: w });
1343
+ const r = (s, i, o) => {
1344
+ if (s !== "products") {
1345
+ const b = { ...e[s] };
1346
+ o === void 0 ? delete b[be(i)] : b[be(i)] = o, a({ ...e, [s]: b });
899
1347
  return;
900
1348
  }
901
- const [, f = "", u = ""] = i.split("."), l = { ...e.products?.[f] };
902
- c === void 0 ? delete l[u] : l[u] = c;
903
- const h = { ...e.products, [f]: l };
904
- Object.keys(l).length === 0 && delete h[f], s({ ...e, products: h });
1349
+ const [, p = "", c = ""] = i.split("."), h = { ...e.products?.[p] };
1350
+ o === void 0 ? delete h[c] : h[c] = o;
1351
+ const m = { ...e.products, [p]: h };
1352
+ Object.keys(h).length === 0 && delete m[p], a({ ...e, products: m });
905
1353
  };
906
- return /* @__PURE__ */ t("div", { className: "flex flex-col", children: zt.map((r) => /* @__PURE__ */ t(
907
- Wt,
1354
+ return /* @__PURE__ */ n("div", { className: "flex flex-col", children: sa.map((s) => /* @__PURE__ */ n(
1355
+ la,
908
1356
  {
909
- label: r.label,
910
- blurb: r.blurb,
911
- rows: n[r.key] ?? [],
912
- overrideOf: (i) => r.key === "products" ? e.products?.[i.split(".")[1] ?? ""]?.[i.split(".")[2] ?? ""] : e[r.key]?.[le(i)],
913
- onChange: (i, c) => a(r.key, i, c)
1357
+ label: s.label,
1358
+ blurb: s.blurb,
1359
+ rows: t[s.key] ?? [],
1360
+ overrideOf: (i) => s.key === "products" ? e.products?.[i.split(".")[1] ?? ""]?.[i.split(".")[2] ?? ""] : e[s.key]?.[be(i)],
1361
+ onChange: (i, o) => r(s.key, i, o)
914
1362
  },
915
- r.key
1363
+ s.key
916
1364
  )) });
917
- }, Ue = (e) => {
918
- const n = new URLSearchParams();
919
- e.theme && n.set("theme", e.theme), e.locale && n.set("locale", e.locale);
920
- for (const [s, a] of [
921
- ["sw_device", e.device],
922
- ["sw_user", e.user],
923
- ["sw_params", e.params],
924
- ["sw_products", e.products]
925
- ])
926
- a && Object.keys(a).length > 0 && n.set(s, JSON.stringify(a));
927
- return e.trialEligible !== void 0 && n.set("sw_trial", e.trialEligible ? "1" : "0"), n;
928
- }, $ = (e) => `${e.project ? `/${e.project}` : ""}/${e.kind}/${e.id}`, He = (e) => `/preview${$(e)}?sw_preview=1`, bn = (e, n) => {
929
- const s = Ue(n).toString();
930
- return `/preview${$(e)}${s ? `?${s}` : ""}`;
931
- }, Fe = (e, n) => {
932
- const s = Ue(n).toString();
933
- return s ? `${e}${e.includes("?") ? "&" : "?"}${s}` : e;
934
- }, Gt = (e) => /[?&]sw_preview=/.test(e) ? e : `${e}${e.includes("?") ? "&" : "?"}sw_preview=1`, wn = (e) => (n, s) => Fe(Gt(e(n)), s), Zt = async (e, n, s) => {
1365
+ }, O = (e) => `${e.project ? `/${e.project}` : ""}/${e.kind}/${e.id}`, ke = (e) => /[?&]transport=editor(?:&|$)/.test(e) ? e : `${e}${e.includes("?") ? "&" : "?"}transport=editor`, Ma = (e) => ke(`/preview${O(e)}`), $a = (e) => (t) => ke(e(t)), da = async (e, t, a) => {
935
1366
  try {
936
- const a = await fetch("/__studio/action", {
1367
+ const r = await fetch("/__studio/action", {
937
1368
  method: "POST",
938
1369
  headers: { "Content-Type": "application/json" },
939
1370
  body: JSON.stringify({
940
- action: n,
1371
+ action: t,
941
1372
  kind: e.kind,
942
1373
  id: e.id,
943
1374
  project: e.project
944
1375
  })
945
1376
  });
946
- if (!a.body)
947
- return await a.json();
948
- const r = a.body.getReader(), i = new TextDecoder();
949
- let c = "", f;
950
- const u = (l) => {
951
- if (!l.trim()) return;
952
- const h = JSON.parse(l);
953
- h.result ? f = h.result : h.step && h.state && s?.(h.step, h.state);
1377
+ if (!r.body)
1378
+ return await r.json();
1379
+ const s = r.body.getReader(), i = new TextDecoder();
1380
+ let o = "", p;
1381
+ const c = (h) => {
1382
+ if (!h.trim()) return;
1383
+ const m = JSON.parse(h);
1384
+ m.result ? p = m.result : m.step && m.state && a?.(m.step, m.state);
954
1385
  };
955
1386
  for (; ; ) {
956
- const { done: l, value: h } = await r.read();
957
- if (l) break;
958
- c += i.decode(h, { stream: !0 });
959
- const w = c.split(`
1387
+ const { done: h, value: m } = await s.read();
1388
+ if (h) break;
1389
+ o += i.decode(m, { stream: !0 });
1390
+ const b = o.split(`
960
1391
  `);
961
- c = w.pop() ?? "";
962
- for (const b of w) u(b);
1392
+ o = b.pop() ?? "";
1393
+ for (const u of b) c(u);
963
1394
  }
964
- return u(c), f ?? { ok: !1, error: "The dev server closed without a result." };
965
- } catch (a) {
966
- return { ok: !1, error: a instanceof Error ? a.message : String(a) };
1395
+ return c(o), p ?? { ok: !1, error: "The dev server closed without a result." };
1396
+ } catch (r) {
1397
+ return { ok: !1, error: r instanceof Error ? r.message : String(r) };
967
1398
  }
968
- }, pe = async (e) => {
1399
+ }, Ne = async (e) => {
969
1400
  try {
970
- return await (await fetch(`/__studio/status${$(e)}`)).json();
971
- } catch (n) {
972
- return { unreachable: n instanceof Error ? n.message : String(n) };
1401
+ return await (await fetch(`/__studio/status${O(e)}`)).json();
1402
+ } catch (t) {
1403
+ return { unreachable: t instanceof Error ? t.message : String(t) };
973
1404
  }
974
- }, Jt = async () => {
1405
+ }, pa = async () => {
975
1406
  try {
976
- const n = await (await fetch("/__studio/samples.json")).json();
977
- return typeof n == "object" && n !== null ? n : {};
1407
+ const t = await (await fetch("/__studio/samples.json")).json();
1408
+ return typeof t == "object" && t !== null ? t : {};
978
1409
  } catch (e) {
979
1410
  return { unreachable: e instanceof Error ? e.message : String(e) };
980
1411
  }
981
- }, oe = {
1412
+ }, ve = {
982
1413
  radius: 54,
983
1414
  cutout: "island",
984
1415
  statusBarHeight: 64,
985
1416
  homeIndicator: !0
986
- }, J = [
1417
+ }, X = [
987
1418
  {
988
1419
  id: "iphone-se",
989
1420
  name: "iPhone SE",
@@ -998,7 +1429,7 @@ const et = ({
998
1429
  width: 402,
999
1430
  height: 874,
1000
1431
  device: { platform: "iOS", deviceModel: "iPhone18,3", osVersion: "26.0" },
1001
- chrome: oe
1432
+ chrome: ve
1002
1433
  },
1003
1434
  {
1004
1435
  id: "iphone-air",
@@ -1006,7 +1437,7 @@ const et = ({
1006
1437
  width: 420,
1007
1438
  height: 912,
1008
1439
  device: { platform: "iOS", deviceModel: "iPhone18,4", osVersion: "26.0" },
1009
- chrome: oe
1440
+ chrome: ve
1010
1441
  },
1011
1442
  {
1012
1443
  id: "iphone-17-pro-max",
@@ -1014,7 +1445,7 @@ const et = ({
1014
1445
  width: 440,
1015
1446
  height: 956,
1016
1447
  device: { platform: "iOS", deviceModel: "iPhone18,2", osVersion: "26.0" },
1017
- chrome: oe
1448
+ chrome: ve
1018
1449
  },
1019
1450
  {
1020
1451
  id: "pixel-10",
@@ -1054,135 +1485,183 @@ const et = ({
1054
1485
  width: 1440,
1055
1486
  height: 900
1056
1487
  }
1057
- ], ze = "iphone-17", _e = "responsive", Yt = { width: 393, height: 852 }, Qt = (e) => J.find((n) => n.id === e) ?? J.find((n) => n.id === ze) ?? J[0], Xt = (e, n) => Number.isFinite(e) ? Math.min(3e3, Math.max(200, Math.round(e))) : n, Pe = ({
1488
+ ], ut = "iphone-17", Ve = "responsive", ua = { width: 393, height: 852 }, ma = X.find((e) => e.id === ut) ?? X[0], ha = (e) => X.find((t) => t.id === e) ?? ma, mt = () => ({
1489
+ device: on(),
1490
+ user: ln,
1491
+ params: cn
1492
+ }), ht = ({
1493
+ surface: e,
1494
+ defaults: t,
1495
+ sourceSamples: a,
1496
+ samples: r,
1497
+ frame: s,
1498
+ theme: i,
1499
+ locale: o,
1500
+ edited: p
1501
+ }) => {
1502
+ const c = {
1503
+ ...t.device,
1504
+ ...a?.device,
1505
+ ...r.device,
1506
+ ...s,
1507
+ interfaceStyle: i === "dark" ? "Dark" : "Light",
1508
+ ...o ? { deviceLocale: o, deviceLanguageCode: o.split(/[-_]/)[0] } : {},
1509
+ ...p.device
1510
+ }, h = {
1511
+ ...t.user,
1512
+ ...a?.user,
1513
+ ...r.user,
1514
+ ...p.user
1515
+ }, m = {
1516
+ ...t.params,
1517
+ ...a?.params,
1518
+ ...p.params
1519
+ }, b = Object.entries(e.products ?? {}).map(
1520
+ ([u, v]) => ({
1521
+ reference: u,
1522
+ productId: v,
1523
+ variables: {
1524
+ ...r.products?.[v],
1525
+ ...p.products?.[u]
1526
+ }
1527
+ })
1528
+ );
1529
+ return Ge({
1530
+ paywallId: e.paywallId ?? "0",
1531
+ paywallIdentifier: e.paywallIdentifier ?? e.id,
1532
+ device: c,
1533
+ user: h,
1534
+ params: m,
1535
+ products: b,
1536
+ introductoryOfferEligible: p.introductoryOfferEligible
1537
+ });
1538
+ }, ft = (e) => e.capabilities?.actions === !0, fa = (e, t) => Number.isFinite(e) ? Math.min(3e3, Math.max(200, Math.round(e))) : t, qe = ({
1058
1539
  label: e,
1059
- value: n,
1060
- onCommit: s
1540
+ value: t,
1541
+ onCommit: a
1061
1542
  }) => {
1062
- const [a, r] = d.useState(String(n));
1543
+ const [r, s] = d.useState(String(t));
1063
1544
  return d.useEffect(() => {
1064
- r(String(n));
1065
- }, [n]), /* @__PURE__ */ t(
1545
+ s(String(t));
1546
+ }, [t]), /* @__PURE__ */ n(
1066
1547
  "input",
1067
1548
  {
1068
1549
  className: "sw-input w-16 text-center",
1069
1550
  type: "number",
1070
1551
  "aria-label": e,
1071
- value: a,
1072
- onChange: (c) => r(c.target.value),
1552
+ value: r,
1553
+ onChange: (o) => s(o.target.value),
1073
1554
  onBlur: () => {
1074
- const c = Xt(Number(a), n);
1075
- r(String(c)), s(c);
1555
+ const o = fa(Number(r), t);
1556
+ s(String(o)), a(o);
1076
1557
  },
1077
- onKeyDown: (c) => {
1078
- c.key === "Enter" && c.target.blur();
1558
+ onKeyDown: (o) => {
1559
+ o.key === "Enter" && o.target.blur();
1079
1560
  }
1080
1561
  }
1081
1562
  );
1082
- }, Ee = ({
1563
+ }, ze = ({
1083
1564
  label: e,
1084
- width: n,
1085
- height: s,
1086
- title: a,
1087
- src: r,
1088
- reloadKey: i,
1565
+ width: t,
1566
+ height: a,
1567
+ title: r,
1568
+ src: s,
1569
+ hostState: i,
1570
+ delegate: o,
1571
+ reloadKey: p,
1089
1572
  empty: c,
1090
- chrome: f,
1091
- landscape: u,
1092
- theme: l
1573
+ chrome: h,
1574
+ landscape: m,
1575
+ theme: b
1093
1576
  }) => {
1094
- const h = d.useRef(null);
1095
- return /* @__PURE__ */ t("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col items-center justify-center", ref: h, children: /* @__PURE__ */ o("div", { className: "flex flex-col gap-2", children: [
1096
- e && /* @__PURE__ */ t("span", { className: "text-xs text-cream/55", children: e }),
1097
- r ? /* @__PURE__ */ t(
1098
- Nt,
1577
+ const u = d.useRef(null);
1578
+ return /* @__PURE__ */ n("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col items-center justify-center", ref: u, children: /* @__PURE__ */ l("div", { className: "flex flex-col gap-2", children: [
1579
+ e && /* @__PURE__ */ n("span", { className: "text-xs text-cream/55", children: e }),
1580
+ s ? /* @__PURE__ */ n(
1581
+ Mn,
1099
1582
  {
1100
- width: n,
1101
- height: s,
1102
- title: a,
1103
- src: r,
1104
- stageRef: h,
1105
- reloadKey: i,
1106
- chrome: f,
1107
- landscape: u,
1108
- theme: l
1583
+ width: t,
1584
+ height: a,
1585
+ title: r,
1586
+ src: s,
1587
+ hostState: i,
1588
+ delegate: o,
1589
+ stageRef: u,
1590
+ reloadKey: p,
1591
+ chrome: h,
1592
+ landscape: m,
1593
+ theme: b
1109
1594
  }
1110
- ) : /* @__PURE__ */ t(xt, { width: n, height: s, stageRef: h, children: c ?? "Nothing live yet — publish to compare against production." })
1595
+ ) : /* @__PURE__ */ n(On, { width: t, height: a, stageRef: u, children: c ?? "Nothing live yet — publish to compare against production." })
1111
1596
  ] }) });
1112
- }, ce = (e) => e.label ?? `${e.kind}/${e.id}`, en = ({
1597
+ }, we = (e) => e.label ?? `${e.kind}/${e.id}`, ba = ({
1113
1598
  source: e,
1114
- surface: n,
1115
- samples: s,
1116
- onBack: a,
1599
+ surface: t,
1600
+ samples: a,
1117
1601
  actions: r
1118
1602
  }) => {
1119
- const [i, c] = d.useState(ze), [f, u] = d.useState(Yt), [l, h] = d.useState("light"), [w, b] = d.useState(void 0), [m, E] = d.useState({}), [j, L] = d.useState(!1), [C, X] = d.useState(void 0), [F, g] = d.useState(0), [S, x] = d.useState(!1), [M, O] = d.useState({}), [T, A] = d.useState(void 0), ee = d.useRef(void 0);
1120
- d.useEffect(() => () => window.clearTimeout(ee.current), []);
1121
- const z = e.capabilities?.actions === !0, [qe, We] = d.useState([]);
1122
- d.useEffect(() => {
1123
- const p = (v) => {
1124
- const N = It(v.data);
1125
- N && We(N);
1126
- };
1127
- return window.addEventListener("message", p), () => window.removeEventListener("message", p);
1128
- }, []);
1129
- const me = n.locales.length > 0 ? n.locales : qe;
1603
+ const [s, i] = d.useState(ut), [o, p] = d.useState(ua), [c, h] = d.useState("light"), [m, b] = d.useState(void 0), [u, v] = d.useState({}), [N, P] = d.useState(!1), [C, ae] = d.useState(void 0), [B, g] = d.useState(0), [S, k] = d.useState(!1), [V, Ie] = d.useState({}), [vt, A] = d.useState(void 0), re = d.useRef(void 0);
1604
+ d.useEffect(() => () => window.clearTimeout(re.current), []);
1605
+ const q = ft(e), Ee = Yn(), T = d.useMemo(mt, [t]), Pe = t.locales;
1130
1606
  d.useEffect(() => {
1131
- if (!z) return;
1132
- let p = !1;
1133
- return pe(n).then((v) => {
1134
- p || O(v);
1607
+ if (!q) return;
1608
+ let f = !1;
1609
+ return Ne(t).then((w) => {
1610
+ f || Ie(w);
1135
1611
  }), () => {
1136
- p = !0;
1612
+ f = !0;
1137
1613
  };
1138
- }, [z, n]);
1139
- const Ke = async (p) => {
1140
- window.clearTimeout(ee.current), A({ action: p, steps: {} });
1141
- const v = await Zt(n, p, (N, _) => {
1614
+ }, [q, t]);
1615
+ const wt = async (f) => {
1616
+ window.clearTimeout(re.current), A({ action: f, steps: {} });
1617
+ const w = await da(t, f, (x, _) => {
1142
1618
  A(
1143
- (P) => P?.action === p ? {
1144
- ...P,
1145
- steps: { ...P.steps, [N]: _ === "start" ? "active" : "done" }
1146
- } : P
1619
+ (E) => E?.action === f ? {
1620
+ ...E,
1621
+ steps: { ...E.steps, [x]: _ === "start" ? "active" : "done" }
1622
+ } : E
1147
1623
  );
1148
1624
  });
1149
- if (v.ok) {
1150
- const N = Object.fromEntries(
1151
- Q[p].map((_) => [_, "done"])
1625
+ if (w.ok) {
1626
+ const x = Object.fromEntries(
1627
+ Q[f].map((_) => [_, "done"])
1152
1628
  );
1153
- A({ action: p, steps: N }), O(await pe(n)), ee.current = window.setTimeout(() => A(void 0), 1600);
1629
+ A({ action: f, steps: x }), Ie(await Ne(t)), re.current = window.setTimeout(() => A(void 0), 1600);
1154
1630
  } else
1155
- A((N) => {
1156
- if (!N) return N;
1157
- const _ = { ...N.steps };
1158
- for (const P of Q[p])
1159
- _[P] === "active" && (_[P] = "failed");
1160
- return { ...N, steps: _, error: v.error };
1631
+ A((x) => {
1632
+ if (!x) return x;
1633
+ const _ = { ...x.steps };
1634
+ for (const E of Q[f])
1635
+ _[E] === "active" && (_[E] = "failed");
1636
+ return { ...x, steps: _, error: w.error };
1161
1637
  });
1162
- }, Ge = () => {
1163
- if (k.width > 768) {
1164
- window.open(q, "_blank");
1638
+ }, D = s === Ve, M = ha(s), se = D ? o : { width: M.width, height: M.height }, I = S ? { width: se.height, height: se.width } : se, yt = () => {
1639
+ const f = e.standaloneUrl?.(t);
1640
+ if (f === void 0) return;
1641
+ if (I.width > 768) {
1642
+ window.open(f, "_blank");
1165
1643
  return;
1166
1644
  }
1167
- const p = Math.max(0, window.screen.width / 2 - k.width / 2), v = Math.max(0, window.screen.height / 2 - k.height / 2);
1645
+ const w = Math.max(0, window.screen.width / 2 - I.width / 2), x = Math.max(0, window.screen.height / 2 - I.height / 2);
1168
1646
  window.open(
1169
- q,
1647
+ f,
1170
1648
  "superwall-preview",
1171
- `toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=${k.width},height=${k.height},top=${v},left=${p}`
1172
- ) || window.open(q, "_blank");
1173
- }, V = i === _e, R = Qt(i), te = V ? f : { width: R.width, height: R.height }, k = S ? { width: te.height, height: te.width } : te, ne = {
1174
- theme: l,
1175
- locale: w,
1176
- user: m.user,
1177
- params: m.params,
1178
- products: m.products,
1179
- trialEligible: m.trialEligible,
1180
- device: {
1181
- ...V ? {} : R.device,
1182
- ...m.device
1183
- }
1184
- }, ue = V ? void 0 : R.chrome, q = e.previewUrl(n, ne), Ze = M.liveUrl ? Fe(M.liveUrl, ne) : void 0, fe = [
1185
- ...z ? [
1649
+ `toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=${I.width},height=${I.height},top=${x},left=${w}`
1650
+ ) || window.open(f, "_blank");
1651
+ }, ie = d.useMemo(
1652
+ () => ht({
1653
+ surface: t,
1654
+ defaults: T,
1655
+ sourceSamples: e.samples,
1656
+ samples: a,
1657
+ frame: D ? void 0 : M.device,
1658
+ theme: c,
1659
+ locale: m,
1660
+ edited: u
1661
+ }),
1662
+ [t, T, e.samples, a, D, M.device, c, m, u]
1663
+ ), Ce = D ? void 0 : M.chrome, gt = e.previewUrl(t), xt = V.liveUrl ? ke(V.liveUrl) : void 0, Oe = [
1664
+ ...q ? [
1186
1665
  {
1187
1666
  key: "live",
1188
1667
  label: "Live version",
@@ -1190,154 +1669,158 @@ const et = ({
1190
1669
  target: { type: "live" }
1191
1670
  }
1192
1671
  ] : [],
1193
- ...e.surfaces.map((p, v) => ({
1194
- key: `surface:${v}`,
1195
- label: ce(p),
1672
+ ...e.surfaces.map((f, w) => ({
1673
+ key: `surface:${w}`,
1674
+ label: we(f),
1196
1675
  hint: e.compareHint ?? "Local preview",
1197
- target: { type: "surface", surface: p }
1198
- })).filter((p) => p.target.surface !== n)
1199
- ], I = C && (C.type === "live" ? {
1676
+ target: { type: "surface", surface: f }
1677
+ })).filter((f) => f.target.surface !== t)
1678
+ ], $ = C && (C.type === "live" ? {
1200
1679
  label: "Live",
1201
- src: Ze,
1202
- title: `${n.id} live`,
1203
- empty: M.unreachable ? `Couldn't read the live version — ${M.unreachable}` : void 0
1680
+ src: xt,
1681
+ title: `${t.id} live`,
1682
+ empty: V.unreachable ? `Couldn't read the live version — ${V.unreachable}` : void 0
1204
1683
  } : {
1205
- label: ce(C.surface),
1206
- src: e.previewUrl(C.surface, ne),
1207
- title: `${ce(C.surface)} preview`
1208
- }), Je = d.useMemo(() => {
1209
- const p = (v, N) => Object.entries(N ?? {}).map(([_, P]) => ({ path: `${v}.${_}`, value: P })).toSorted((_, P) => _.path.localeCompare(P.path));
1684
+ label: we(C.surface),
1685
+ src: e.previewUrl(C.surface),
1686
+ title: `${we(C.surface)} preview`
1687
+ }), Nt = d.useMemo(() => {
1688
+ const f = (w, x) => Object.entries(x ?? {}).map(([_, E]) => ({ path: `${w}.${_}`, value: E })).toSorted((_, E) => _.path.localeCompare(E.path));
1210
1689
  return {
1211
- user: p("user", { ...e.samples?.user, ...s.user }),
1212
- device: p("device", {
1690
+ user: f("user", { ...T.user, ...e.samples?.user, ...a.user }),
1691
+ device: f("device", {
1692
+ ...T.device,
1213
1693
  ...e.samples?.device,
1214
- ...s.device,
1215
- ...R.device
1694
+ ...a.device,
1695
+ ...M.device
1216
1696
  }),
1217
- params: p("params", e.samples?.params),
1218
- products: Object.entries(n.products ?? {}).flatMap(
1219
- ([v, N]) => p(`products.${v}`, s.products?.[N])
1697
+ params: f("params", { ...T.params, ...e.samples?.params }),
1698
+ products: Object.entries(t.products ?? {}).flatMap(
1699
+ ([w, x]) => f(`products.${w}`, a.products?.[x])
1220
1700
  )
1221
1701
  };
1222
- }, [e.samples, s, R.device, n.products]), W = d.useMemo(() => s.products ? Object.entries(n.products ?? {}).filter(([, p]) => s.products?.[p] === void 0).map(([p, v]) => ({ reference: p, identifier: v })) : [], [s.products, n.products]), [Ye, se] = d.useState(!1);
1223
- d.useEffect(() => se(!1), [n]);
1224
- const ae = s.unreachable, Qe = W.length === 0, be = Object.keys(m.user ?? {}).length + Object.keys(m.params ?? {}).length + Object.keys(m.device ?? {}).length;
1225
- return /* @__PURE__ */ o(U, { children: [
1226
- /* @__PURE__ */ t(
1227
- Dt,
1702
+ }, [T, e.samples, a, M.device, t.products]), z = d.useMemo(() => a.products ? Object.entries(t.products ?? {}).filter(([, f]) => a.products?.[f] === void 0).map(([f, w]) => ({ reference: f, identifier: w })) : [], [a.products, t.products]), [St, oe] = d.useState(!1);
1703
+ d.useEffect(() => oe(!1), [t]);
1704
+ const le = a.unreachable, _t = z.length === 0, Me = Object.keys(u.user ?? {}).length + Object.keys(u.params ?? {}).length + Object.keys(u.device ?? {}).length;
1705
+ return /* @__PURE__ */ l(Z, { children: [
1706
+ /* @__PURE__ */ n(
1707
+ Zn,
1228
1708
  {
1229
- surfaceKey: `${n.project ?? ""}/${n.id}`,
1230
- raised: !!ae
1709
+ surfaceKey: `${t.project ?? ""}/${t.id}`,
1710
+ raised: !!le
1231
1711
  }
1232
1712
  ),
1233
- W.length > 0 && !Ye && /* @__PURE__ */ t(
1234
- St,
1713
+ z.length > 0 && !St && /* @__PURE__ */ n(
1714
+ $n,
1235
1715
  {
1236
- paywall: n.id,
1237
- missing: W,
1238
- onDismiss: () => se(!0)
1716
+ paywall: t.id,
1717
+ missing: z,
1718
+ onDismiss: () => oe(!0)
1239
1719
  }
1240
1720
  ),
1241
- ae && /* @__PURE__ */ o("div", { className: "border-b border-cream/10 bg-red/10 px-4 py-1.5 text-[0.8125rem] text-cream/75", children: [
1721
+ le && /* @__PURE__ */ l("div", { className: "border-b border-cream/10 bg-red/10 px-4 py-1.5 text-[0.8125rem] text-cream/75", children: [
1242
1722
  "Couldn't check this paywall's products — ",
1243
- ae
1723
+ le
1244
1724
  ] }),
1245
- /* @__PURE__ */ t(
1246
- Be,
1725
+ /* @__PURE__ */ n(
1726
+ pt,
1247
1727
  {
1248
- title: `${n.project ?? e.title} / ${n.id}${n.label ? ` · ${n.label}` : ""}`,
1249
- onHome: a,
1250
- actions: /* @__PURE__ */ o(U, { children: [
1728
+ title: `${t.project ?? e.title} / ${t.id}${t.label ? ` · ${t.label}` : ""}`,
1729
+ actions: /* @__PURE__ */ l(Z, { children: [
1251
1730
  r,
1252
- /* @__PURE__ */ t(
1731
+ /* @__PURE__ */ n(
1253
1732
  "button",
1254
1733
  {
1255
1734
  type: "button",
1256
1735
  className: "sw-btn sw-btn--icon",
1257
1736
  "aria-label": "Reload preview",
1258
- onClick: () => g((p) => p + 1),
1259
- children: /* @__PURE__ */ t(Ie, {})
1737
+ onClick: () => g((f) => f + 1),
1738
+ children: /* @__PURE__ */ n(nt, {})
1260
1739
  }
1261
1740
  ),
1262
- /* @__PURE__ */ t(
1741
+ e.standaloneUrl && /* @__PURE__ */ n(
1263
1742
  "button",
1264
1743
  {
1265
1744
  type: "button",
1266
1745
  className: "sw-btn sw-btn--icon",
1267
1746
  "aria-label": "Open preview",
1268
- onClick: Ge,
1269
- children: /* @__PURE__ */ t(Z, {})
1747
+ onClick: yt,
1748
+ children: /* @__PURE__ */ n(G, {})
1270
1749
  }
1271
1750
  ),
1272
- z && /* @__PURE__ */ t(
1273
- mt,
1751
+ q && /* @__PURE__ */ n(
1752
+ Nn,
1274
1753
  {
1275
- progress: T,
1276
- blocked: Qe ? void 0 : `Superwall has no product for ${W.map((p) => p.reference).join(", ")}`,
1277
- onRun: Ke,
1278
- onBlocked: () => se(!1)
1754
+ progress: vt,
1755
+ blocked: _t ? void 0 : `Superwall has no product for ${z.map((f) => f.reference).join(", ")}`,
1756
+ onRun: wt,
1757
+ onBlocked: () => oe(!1)
1279
1758
  }
1280
1759
  )
1281
1760
  ] })
1282
1761
  }
1283
1762
  ),
1284
- /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1", children: [
1285
- /* @__PURE__ */ o("div", { className: "flex min-w-0 flex-1", children: [
1286
- I && /* @__PURE__ */ t(
1287
- Ee,
1763
+ /* @__PURE__ */ l("div", { className: "flex min-h-0 flex-1", children: [
1764
+ /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1", children: [
1765
+ $ && /* @__PURE__ */ n(
1766
+ ze,
1288
1767
  {
1289
- label: I.label,
1290
- width: k.width,
1291
- height: k.height,
1292
- title: I.title,
1293
- src: I.src,
1294
- reloadKey: F,
1295
- empty: "empty" in I ? I.empty : void 0,
1296
- chrome: ue,
1768
+ label: $.label,
1769
+ width: I.width,
1770
+ height: I.height,
1771
+ title: $.title,
1772
+ src: $.src,
1773
+ hostState: ie,
1774
+ delegate: Ee,
1775
+ reloadKey: B,
1776
+ empty: "empty" in $ ? $.empty : void 0,
1777
+ chrome: Ce,
1297
1778
  landscape: S,
1298
- theme: l
1779
+ theme: c
1299
1780
  }
1300
1781
  ),
1301
- /* @__PURE__ */ t(
1302
- Ee,
1782
+ /* @__PURE__ */ n(
1783
+ ze,
1303
1784
  {
1304
- label: I ? n.label ?? "Local" : void 0,
1305
- width: k.width,
1306
- height: k.height,
1307
- title: `${n.id} preview`,
1308
- src: q,
1309
- reloadKey: F,
1310
- chrome: ue,
1785
+ label: $ ? t.label ?? "Local" : void 0,
1786
+ width: I.width,
1787
+ height: I.height,
1788
+ title: `${t.id} preview`,
1789
+ src: gt,
1790
+ hostState: ie,
1791
+ delegate: Ee,
1792
+ reloadKey: B,
1793
+ chrome: Ce,
1311
1794
  landscape: S,
1312
- theme: l
1795
+ theme: c
1313
1796
  }
1314
1797
  )
1315
1798
  ] }),
1316
- /* @__PURE__ */ t(Ht, { open: j, title: "Variables", onClose: () => L(!1), children: /* @__PURE__ */ t(Kt, { overrides: m, groups: Je, onChange: E }) })
1799
+ /* @__PURE__ */ n(ea, { open: N, title: "Variables", onClose: () => P(!1), children: /* @__PURE__ */ n(ca, { overrides: u, groups: Nt, onChange: v }) })
1317
1800
  ] }),
1318
- /* @__PURE__ */ o(Ft, { children: [
1319
- /* @__PURE__ */ t(G, { label: "Trial", children: /* @__PURE__ */ t(
1320
- Ut,
1801
+ /* @__PURE__ */ l(ta, { children: [
1802
+ /* @__PURE__ */ n(J, { label: "Intro offer", children: /* @__PURE__ */ n(
1803
+ Xn,
1321
1804
  {
1322
- label: "Trial eligibility",
1323
- checked: m.trialEligible ?? !1,
1324
- onChange: (p) => E((v) => ({ ...v, trialEligible: p }))
1805
+ label: "Introductory offer",
1806
+ checked: F(ie),
1807
+ onChange: (f) => v((w) => ({ ...w, introductoryOfferEligible: f }))
1325
1808
  }
1326
1809
  ) }),
1327
- /* @__PURE__ */ o(G, { label: "Theme", children: [
1328
- /* @__PURE__ */ t(
1329
- Bt,
1810
+ /* @__PURE__ */ l(J, { label: "Theme", children: [
1811
+ /* @__PURE__ */ n(
1812
+ Qn,
1330
1813
  {
1331
1814
  label: "Theme",
1332
- value: l,
1815
+ value: c,
1333
1816
  options: [
1334
- { value: "light", label: /* @__PURE__ */ t(tt, {}) },
1335
- { value: "dark", label: /* @__PURE__ */ t(nt, {}) }
1817
+ { value: "light", label: /* @__PURE__ */ n(dn, {}) },
1818
+ { value: "dark", label: /* @__PURE__ */ n(pn, {}) }
1336
1819
  ],
1337
1820
  onChange: h
1338
1821
  }
1339
1822
  ),
1340
- /* @__PURE__ */ t(
1823
+ /* @__PURE__ */ n(
1341
1824
  "button",
1342
1825
  {
1343
1826
  type: "button",
@@ -1345,402 +1828,411 @@ const et = ({
1345
1828
  "aria-label": "Rotate device",
1346
1829
  "aria-pressed": S,
1347
1830
  title: S ? "Back to portrait" : "Rotate to landscape",
1348
- onClick: () => x((p) => !p),
1349
- children: /* @__PURE__ */ t(
1831
+ onClick: () => k((f) => !f),
1832
+ children: /* @__PURE__ */ n(
1350
1833
  "span",
1351
1834
  {
1352
1835
  className: `flex transition-transform duration-200 ${S ? "-rotate-90" : ""}`,
1353
- children: /* @__PURE__ */ t(ct, {})
1836
+ children: /* @__PURE__ */ n(wn, {})
1354
1837
  }
1355
1838
  )
1356
1839
  }
1357
1840
  )
1358
1841
  ] }),
1359
- /* @__PURE__ */ t(Se, {}),
1360
- /* @__PURE__ */ o(G, { label: "Device", children: [
1361
- /* @__PURE__ */ t(
1362
- Ne,
1842
+ /* @__PURE__ */ n(He, {}),
1843
+ /* @__PURE__ */ l(J, { label: "Device", children: [
1844
+ /* @__PURE__ */ n(
1845
+ Fe,
1363
1846
  {
1364
1847
  label: "Device",
1365
- value: i,
1848
+ value: s,
1366
1849
  options: [
1367
- ...J.map((p) => ({ value: p.id, label: p.name })),
1368
- { value: _e, label: "Responsive" }
1850
+ ...X.map((f) => ({ value: f.id, label: f.name })),
1851
+ { value: Ve, label: "Responsive" }
1369
1852
  ],
1370
- onChange: c
1853
+ onChange: i
1371
1854
  }
1372
1855
  ),
1373
- V && /* @__PURE__ */ o("span", { className: "flex items-center gap-1.5", children: [
1374
- /* @__PURE__ */ t(
1375
- Pe,
1856
+ D && /* @__PURE__ */ l("span", { className: "flex items-center gap-1.5", children: [
1857
+ /* @__PURE__ */ n(
1858
+ qe,
1376
1859
  {
1377
1860
  label: "Preview width",
1378
- value: k.width,
1379
- onCommit: (p) => u((v) => ({ ...v, width: p }))
1861
+ value: I.width,
1862
+ onCommit: (f) => p((w) => ({ ...w, width: f }))
1380
1863
  }
1381
1864
  ),
1382
- /* @__PURE__ */ t("span", { className: "text-cream/55", children: "×" }),
1383
- /* @__PURE__ */ t(
1384
- Pe,
1865
+ /* @__PURE__ */ n("span", { className: "text-cream/55", children: "×" }),
1866
+ /* @__PURE__ */ n(
1867
+ qe,
1385
1868
  {
1386
1869
  label: "Preview height",
1387
- value: k.height,
1388
- onCommit: (p) => u((v) => ({ ...v, height: p }))
1870
+ value: I.height,
1871
+ onCommit: (f) => p((w) => ({ ...w, height: f }))
1389
1872
  }
1390
1873
  )
1391
1874
  ] })
1392
1875
  ] }),
1393
- me.length > 1 && /* @__PURE__ */ t(G, { label: "Locale", children: /* @__PURE__ */ t(
1394
- Ne,
1876
+ Pe.length > 1 && /* @__PURE__ */ n(J, { label: "Locale", children: /* @__PURE__ */ n(
1877
+ Fe,
1395
1878
  {
1396
1879
  label: "Locale",
1397
- value: w ?? "default",
1880
+ value: m ?? "default",
1398
1881
  options: [
1399
1882
  { value: "default", label: "Device" },
1400
- ...me.map((p) => ({ value: p, label: p }))
1883
+ ...Pe.map((f) => ({ value: f, label: f }))
1401
1884
  ],
1402
- onChange: (p) => b(p === "default" ? void 0 : p)
1885
+ onChange: (f) => b(f === "default" ? void 0 : f)
1403
1886
  }
1404
1887
  ) }),
1405
- /* @__PURE__ */ t(Se, {}),
1406
- fe.length > 0 && /* @__PURE__ */ t(ut, { active: C, options: fe, onSelect: X }),
1407
- /* @__PURE__ */ o(
1888
+ /* @__PURE__ */ n(He, {}),
1889
+ Oe.length > 0 && /* @__PURE__ */ n(Sn, { active: C, options: Oe, onSelect: ae }),
1890
+ /* @__PURE__ */ l(
1408
1891
  "button",
1409
1892
  {
1410
1893
  type: "button",
1411
1894
  className: "sw-btn",
1412
- "aria-expanded": j,
1413
- onClick: () => L((p) => !p),
1895
+ "aria-expanded": N,
1896
+ onClick: () => P((f) => !f),
1414
1897
  children: [
1415
- /* @__PURE__ */ t(st, {}),
1898
+ /* @__PURE__ */ n(un, {}),
1416
1899
  "Variables",
1417
- be > 0 && /* @__PURE__ */ t("span", { className: "text-accent", children: be })
1900
+ Me > 0 && /* @__PURE__ */ n("span", { className: "text-accent", children: Me })
1418
1901
  ]
1419
1902
  }
1420
1903
  )
1421
1904
  ] })
1422
1905
  ] });
1423
- }, Ve = "superwall-device-scheme", tn = () => {
1906
+ }, bt = "superwall-device-scheme", va = () => {
1424
1907
  try {
1425
- return window.localStorage.getItem(Ve) ?? void 0;
1908
+ return window.localStorage.getItem(bt) ?? void 0;
1426
1909
  } catch {
1427
1910
  return;
1428
1911
  }
1429
- }, nn = (e) => {
1912
+ }, wa = (e) => {
1430
1913
  try {
1431
- window.localStorage.setItem(Ve, e);
1914
+ window.localStorage.setItem(bt, e);
1432
1915
  } catch {
1433
1916
  }
1434
- }, Ce = (e, n) => `${e}://?superwall_dev=${encodeURIComponent(n)}`, sn = ({ origin: e, scheme: n }) => {
1435
- const [s, a] = d.useState(tn), r = s ?? n, i = (f) => {
1436
- const l = window.prompt("Your app's URL scheme, so this can open it:", f)?.trim();
1437
- if (!(l === void 0 || l === ""))
1438
- return a(l), nn(l), l;
1439
- }, c = (f) => {
1440
- if (r !== void 0) return;
1441
- f.preventDefault();
1442
- const u = i("");
1443
- u !== void 0 && window.location.assign(Ce(u, e));
1917
+ }, We = (e, t) => `${e}://?superwall_dev=${encodeURIComponent(t)}`, ya = ({ origin: e, scheme: t }) => {
1918
+ const [a, r] = d.useState(va), s = a ?? t, i = (p) => {
1919
+ const h = window.prompt("Your app's URL scheme, so this can open it:", p)?.trim();
1920
+ if (!(h === void 0 || h === ""))
1921
+ return r(h), wa(h), h;
1922
+ }, o = (p) => {
1923
+ if (s !== void 0) return;
1924
+ p.preventDefault();
1925
+ const c = i("");
1926
+ c !== void 0 && window.location.assign(We(c, e));
1444
1927
  };
1445
- return /* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
1446
- r !== void 0 && /* @__PURE__ */ t(
1928
+ return /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
1929
+ s !== void 0 && /* @__PURE__ */ n(
1447
1930
  "button",
1448
1931
  {
1449
1932
  className: "sw-btn sw-btn--icon",
1450
1933
  type: "button",
1451
1934
  "aria-label": "Edit app URL scheme",
1452
- onClick: () => i(r),
1453
- children: /* @__PURE__ */ o("svg", { className: "sw-icon", viewBox: "0 0 24 24", "aria-hidden": "true", children: [
1454
- /* @__PURE__ */ t("path", { d: "M12 20h9" }),
1455
- /* @__PURE__ */ t("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4Z" })
1935
+ onClick: () => i(s),
1936
+ children: /* @__PURE__ */ l("svg", { className: "sw-icon", viewBox: "0 0 24 24", "aria-hidden": "true", children: [
1937
+ /* @__PURE__ */ n("path", { d: "M12 20h9" }),
1938
+ /* @__PURE__ */ n("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4Z" })
1456
1939
  ] })
1457
1940
  }
1458
1941
  ),
1459
- /* @__PURE__ */ t(
1942
+ /* @__PURE__ */ n(
1460
1943
  "a",
1461
1944
  {
1462
1945
  className: "sw-btn sw-btn--primary",
1463
- href: r === void 0 ? "#" : Ce(r, e),
1464
- onClick: c,
1946
+ href: s === void 0 ? "#" : We(s, e),
1947
+ onClick: o,
1465
1948
  children: "Open In App"
1466
1949
  }
1467
1950
  )
1468
1951
  ] });
1469
- }, an = [
1952
+ }, ga = [
1470
1953
  [60, "second"],
1471
1954
  [60, "minute"],
1472
1955
  [24, "hour"],
1473
1956
  [7, "day"],
1474
1957
  [4.348, "week"],
1475
- [12, "month"],
1476
- [Number.POSITIVE_INFINITY, "year"]
1477
- ], rn = (e, n = Date.now()) => {
1478
- const s = Date.parse(e);
1479
- if (Number.isNaN(s)) return;
1480
- let a = Math.max(0, (n - s) / 1e3);
1481
- const r = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
1482
- for (const [i, c] of an) {
1483
- if (a < i) return r.format(-Math.round(a), c);
1484
- a /= i;
1958
+ [12, "month"]
1959
+ ], xa = (e, t = Date.now()) => {
1960
+ const a = Date.parse(e);
1961
+ if (Number.isNaN(a)) return;
1962
+ let r = Math.max(0, (t - a) / 1e3);
1963
+ const s = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
1964
+ for (const [i, o] of ga) {
1965
+ if (r < i) return s.format(-Math.round(r), o);
1966
+ r /= i;
1485
1967
  }
1486
- }, Me = 390, ln = 844, on = (e) => {
1487
- const [n, s] = d.useState(0);
1968
+ return s.format(-Math.round(r), "year");
1969
+ }, Ke = 390, Na = 844, Sa = (e) => {
1970
+ const [t, a] = d.useState(0);
1488
1971
  return d.useLayoutEffect(() => {
1489
- const a = e.current;
1490
- if (!a) return;
1491
- const r = () => s(a.getBoundingClientRect().width);
1492
- if (r(), typeof ResizeObserver > "u") return;
1493
- const i = new ResizeObserver(r);
1494
- return i.observe(a), () => i.disconnect();
1495
- }, [e]), n;
1496
- }, cn = ({
1972
+ const r = e.current;
1973
+ if (!r) return;
1974
+ const s = () => a(r.getBoundingClientRect().width);
1975
+ if (s(), typeof ResizeObserver > "u") return;
1976
+ const i = new ResizeObserver(s);
1977
+ return i.observe(r), () => i.disconnect();
1978
+ }, [e]), t;
1979
+ }, _a = ({
1497
1980
  surface: e,
1498
- status: n,
1499
- previewSrc: s,
1500
- onOpen: a,
1501
- href: r
1981
+ status: t,
1982
+ previewSrc: a,
1983
+ hostState: r,
1984
+ onOpen: s,
1985
+ href: i
1502
1986
  }) => {
1503
- const i = d.useRef(null), c = on(i), f = c > 0 ? c / Me : 0;
1504
- return /* @__PURE__ */ o(
1987
+ const o = d.useRef(null), p = Sa(o), c = p > 0 ? p / Ke : 0, h = d.useMemo(Ht, []);
1988
+ return /* @__PURE__ */ l(
1505
1989
  "a",
1506
1990
  {
1507
1991
  className: "group block",
1508
- href: r ?? $(e),
1509
- onClick: (u) => {
1510
- u.metaKey || u.ctrlKey || (u.preventDefault(), a());
1992
+ href: i ?? O(e),
1993
+ onClick: (m) => {
1994
+ m.metaKey || m.ctrlKey || (m.preventDefault(), s());
1511
1995
  },
1512
1996
  children: [
1513
- /* @__PURE__ */ t(
1997
+ /* @__PURE__ */ n(
1514
1998
  "div",
1515
1999
  {
1516
2000
  className: "bg-panel relative aspect-[390/844] overflow-hidden border border-cream/20 transition-colors group-hover:border-cream/35",
1517
- ref: i,
1518
- children: f > 0 && /* @__PURE__ */ t(
1519
- "iframe",
2001
+ ref: o,
2002
+ children: c > 0 && /* @__PURE__ */ n(
2003
+ ot,
1520
2004
  {
2005
+ hostState: r,
2006
+ delegate: h,
1521
2007
  className: "pointer-events-none block origin-top-left border-0 bg-white",
1522
2008
  title: `${e.project ? `${e.project}/` : ""}${e.id} preview`,
1523
- src: s,
2009
+ src: a,
1524
2010
  loading: "lazy",
1525
2011
  tabIndex: -1,
1526
- width: Me,
1527
- height: ln,
1528
- style: { transform: `scale(${f})` }
2012
+ width: Ke,
2013
+ height: Na,
2014
+ style: { transform: `scale(${c})` }
1529
2015
  }
1530
2016
  )
1531
2017
  }
1532
2018
  ),
1533
- /* @__PURE__ */ o("div", { className: "flex items-center justify-between gap-2 pt-2.5", children: [
1534
- /* @__PURE__ */ o("div", { className: "flex flex-col gap-0.5", children: [
1535
- /* @__PURE__ */ o("span", { className: "text-sm font-medium", children: [
1536
- e.project && /* @__PURE__ */ o("span", { className: "text-cream/45", children: [
2019
+ /* @__PURE__ */ l("div", { className: "flex items-center justify-between gap-2 pt-2.5", children: [
2020
+ /* @__PURE__ */ l("div", { className: "flex flex-col gap-0.5", children: [
2021
+ /* @__PURE__ */ l("span", { className: "text-sm font-medium", children: [
2022
+ e.project && /* @__PURE__ */ l("span", { className: "text-cream/45", children: [
1537
2023
  e.project,
1538
2024
  "/"
1539
2025
  ] }),
1540
2026
  e.id,
1541
- e.platforms && e.platforms.length > 0 && /* @__PURE__ */ o("span", { className: "text-cream/45", children: [
2027
+ e.platforms && e.platforms.length > 0 && /* @__PURE__ */ l("span", { className: "text-cream/45", children: [
1542
2028
  " · ",
1543
2029
  e.platforms.join(" · ")
1544
2030
  ] })
1545
2031
  ] }),
1546
- n && /* @__PURE__ */ t("span", { className: "text-xs text-cream/55", children: n.updatedAt ? `Edited ${rn(n.updatedAt)}` : "Not published" })
2032
+ t && /* @__PURE__ */ n("span", { className: "text-xs text-cream/55", children: t.updatedAt ? `Edited ${xa(t.updatedAt)}` : "Not published" })
1547
2033
  ] }),
1548
- n?.paywallId && /* @__PURE__ */ t("span", { className: `text-xs ${n.active ? "text-accent" : "text-cream/55"}`, children: n.active ? "Active" : "Inactive" })
2034
+ t?.paywallId && /* @__PURE__ */ n("span", { className: `text-xs ${t.active ? "text-accent" : "text-cream/55"}`, children: t.active ? "Active" : "Inactive" })
1549
2035
  ] })
1550
2036
  ]
1551
2037
  }
1552
2038
  );
1553
2039
  };
1554
- let $e = 0;
1555
- const dn = ({
2040
+ let Je = 0;
2041
+ const ka = ({
1556
2042
  source: e,
1557
- onOpen: n,
1558
- device: s = !1
2043
+ onOpen: t
1559
2044
  }) => {
1560
- const [a, r] = d.useState({});
2045
+ const a = aa() === "device", r = ft(e), [s, i] = d.useState({}), o = d.useMemo(mt, [e]);
1561
2046
  d.useEffect(() => {
1562
- if (e.capabilities?.actions !== !0) return;
1563
- let l = !1;
1564
- for (const h of e.surfaces)
1565
- pe(h).then((w) => {
1566
- l || r((b) => ({ ...b, [$(h)]: w }));
2047
+ if (!r) return;
2048
+ let b = !1;
2049
+ for (const u of e.surfaces)
2050
+ Ne(u).then((v) => {
2051
+ b || i((N) => ({ ...N, [O(u)]: v }));
1567
2052
  });
1568
2053
  return () => {
1569
- l = !0;
2054
+ b = !0;
1570
2055
  };
1571
- }, [e]);
1572
- const [i, c] = d.useState({}), f = d.useRef(null);
2056
+ }, [e, r]);
2057
+ const [p, c] = d.useState({}), h = d.useRef(null);
1573
2058
  d.useLayoutEffect(() => {
1574
- const l = f.current;
1575
- if (!l) return;
1576
- l.scrollTop = $e;
1577
- const h = () => {
1578
- $e = l.scrollTop;
2059
+ const b = h.current;
2060
+ if (!b) return;
2061
+ b.scrollTop = Je;
2062
+ const u = () => {
2063
+ Je = b.scrollTop;
1579
2064
  };
1580
- return l.addEventListener("scroll", h, { passive: !0 }), () => {
1581
- h(), l.removeEventListener("scroll", h);
2065
+ return b.addEventListener("scroll", u, { passive: !0 }), () => {
2066
+ u(), b.removeEventListener("scroll", u);
1582
2067
  };
1583
2068
  }, []);
1584
- const u = [
2069
+ const m = [
1585
2070
  ["Paywalls", "paywall"],
1586
2071
  ["Funnels", "funnel"]
1587
- ].map(([l, h]) => {
1588
- const w = e.surfaces.filter((m) => m.kind === h), b = (i[h] ?? "").trim().toLowerCase();
2072
+ ].map(([b, u]) => {
2073
+ const v = e.surfaces.filter((P) => P.kind === u), N = (p[u] ?? "").trim().toLowerCase();
1589
2074
  return {
1590
- label: l,
1591
- kind: h,
1592
- all: w,
1593
- needle: b,
1594
- surfaces: w.filter(
1595
- (m) => b === "" || `${m.project ?? ""} ${m.id}`.toLowerCase().includes(b)
2075
+ label: b,
2076
+ kind: u,
2077
+ all: v,
2078
+ needle: N,
2079
+ surfaces: v.filter(
2080
+ (P) => N === "" || `${P.project ?? ""} ${P.id}`.toLowerCase().includes(N)
1596
2081
  )
1597
2082
  };
1598
- }).filter((l) => l.all.length > 0);
1599
- return /* @__PURE__ */ o(U, { children: [
1600
- /* @__PURE__ */ t(
1601
- Be,
2083
+ }).filter((b) => b.all.length > 0);
2084
+ return /* @__PURE__ */ l(Z, { children: [
2085
+ /* @__PURE__ */ n(
2086
+ pt,
1602
2087
  {
1603
2088
  title: e.title,
1604
- onHome: () => {
1605
- },
1606
2089
  inset: !0,
1607
- label: s ? "Preview" : void 0,
1608
- actions: s ? /* @__PURE__ */ t(sn, { origin: window.location.origin, scheme: e.scheme }) : void 0
2090
+ label: a ? "Preview" : void 0,
2091
+ actions: a ? /* @__PURE__ */ n(ya, { origin: window.location.origin, scheme: e.scheme }) : void 0
1609
2092
  }
1610
2093
  ),
1611
- /* @__PURE__ */ t("div", { className: "flex-1 overflow-y-auto px-3 pt-6 pb-16 sm:px-6 sm:pt-10", ref: f, children: /* @__PURE__ */ o("div", { className: "mx-auto max-w-[1080px]", children: [
1612
- e.diagnostics && e.diagnostics.length > 0 && /* @__PURE__ */ t("div", { className: "border-red bg-red/10 mb-6 border-l-2 px-4 py-3 text-[0.8125rem] whitespace-pre-wrap", children: e.diagnostics.join(`
2094
+ /* @__PURE__ */ n("div", { className: "flex-1 overflow-y-auto px-3 pt-6 pb-16 sm:px-6 sm:pt-10", ref: h, children: /* @__PURE__ */ l("div", { className: "mx-auto max-w-[1080px]", children: [
2095
+ e.diagnostics && e.diagnostics.length > 0 && /* @__PURE__ */ n("div", { className: "border-red bg-red/10 mb-6 border-l-2 px-4 py-3 text-[0.8125rem] whitespace-pre-wrap", children: e.diagnostics.join(`
1613
2096
  `) }),
1614
- u.map((l) => /* @__PURE__ */ o("section", { className: "mt-10 first:mt-0", children: [
1615
- /* @__PURE__ */ o("div", { className: "mb-4 flex items-center gap-2", children: [
1616
- /* @__PURE__ */ t("span", { className: "text-[1.0625rem] font-medium", children: l.label }),
1617
- /* @__PURE__ */ t("span", { className: "text-[0.8125rem] text-cream/55 tabular-nums", children: l.surfaces.length }),
1618
- l.all.length > 1 && /* @__PURE__ */ t(
2097
+ m.map((b) => /* @__PURE__ */ l("section", { className: "mt-10 first:mt-0", children: [
2098
+ /* @__PURE__ */ l("div", { className: "mb-4 flex items-center gap-2", children: [
2099
+ /* @__PURE__ */ n("span", { className: "text-[1.0625rem] font-medium", children: b.label }),
2100
+ /* @__PURE__ */ n("span", { className: "text-[0.8125rem] text-cream/55 tabular-nums", children: b.surfaces.length }),
2101
+ b.all.length > 1 && /* @__PURE__ */ n(
1619
2102
  "input",
1620
2103
  {
1621
2104
  className: "sw-input ml-auto w-48",
1622
2105
  type: "search",
1623
- value: i[l.kind] ?? "",
1624
- placeholder: `Search ${l.label.toLowerCase()}`,
1625
- "aria-label": `Search ${l.label.toLowerCase()}`,
1626
- onChange: (h) => c((w) => ({ ...w, [l.kind]: h.target.value }))
2106
+ value: p[b.kind] ?? "",
2107
+ placeholder: `Search ${b.label.toLowerCase()}`,
2108
+ "aria-label": `Search ${b.label.toLowerCase()}`,
2109
+ onChange: (u) => c((v) => ({ ...v, [b.kind]: u.target.value }))
1627
2110
  }
1628
2111
  )
1629
2112
  ] }),
1630
- /* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-3 sm:grid-cols-[repeat(auto-fill,minmax(200px,1fr))] sm:gap-6", children: l.surfaces.map((h) => /* @__PURE__ */ t(
1631
- cn,
2113
+ /* @__PURE__ */ n("div", { className: "grid grid-cols-2 gap-3 sm:grid-cols-[repeat(auto-fill,minmax(200px,1fr))] sm:gap-6", children: b.surfaces.map((u) => /* @__PURE__ */ n(
2114
+ _a,
1632
2115
  {
1633
- surface: h,
1634
- status: a[$(h)],
1635
- previewSrc: e.previewUrl(h, {}),
1636
- onOpen: () => n(h),
1637
- href: s ? He(h) : void 0
2116
+ surface: u,
2117
+ status: s[O(u)],
2118
+ previewSrc: e.previewUrl(u),
2119
+ hostState: ht({
2120
+ surface: u,
2121
+ defaults: o,
2122
+ sourceSamples: e.samples,
2123
+ samples: {},
2124
+ theme: "light",
2125
+ edited: {}
2126
+ }),
2127
+ onOpen: () => t(u),
2128
+ href: a ? O(u) : void 0
1638
2129
  },
1639
- $(h)
2130
+ O(u)
1640
2131
  )) }),
1641
- l.surfaces.length === 0 && /* @__PURE__ */ t("span", { className: "block text-[0.8125rem] text-cream/45", children: `Nothing matches “${(i[l.kind] ?? "").trim()}”.` })
1642
- ] }, l.kind)),
1643
- e.surfaces.length === 0 && /* @__PURE__ */ o("div", { className: "border border-dashed border-cream/20 p-12 text-center text-cream/55", children: [
2132
+ b.surfaces.length === 0 && /* @__PURE__ */ n("span", { className: "block text-[0.8125rem] text-cream/45", children: `Nothing matches “${(p[b.kind] ?? "").trim()}”.` })
2133
+ ] }, b.kind)),
2134
+ e.surfaces.length === 0 && /* @__PURE__ */ l("div", { className: "border border-dashed border-cream/20 p-12 text-center text-cream/55", children: [
1644
2135
  "No paywalls yet — create",
1645
2136
  " ",
1646
- /* @__PURE__ */ t("code", { className: "font-mono text-[0.8125rem] text-cream", children: "superwall/paywalls/<id>/app/page.tsx" }),
2137
+ /* @__PURE__ */ n("code", { className: "font-mono text-[0.8125rem] text-cream", children: "superwall/paywalls/<id>/app/page.tsx" }),
1647
2138
  " ",
1648
2139
  "and it appears here."
1649
2140
  ] })
1650
2141
  ] }) }),
1651
- !s && /* @__PURE__ */ t("footer", { className: "bg-bar flex h-11 flex-none items-center justify-center border-t border-cream/10 text-xs text-cream/55", children: "Previews run against the simulated SDK host. Edit files under superwall/ and they update live." })
2142
+ !a && /* @__PURE__ */ n("footer", { className: "bg-bar flex h-11 flex-none items-center justify-center border-t border-cream/10 text-xs text-cream/55", children: "Previews run against a real SDK host — you choose the outcomes. Edit files under superwall/ and they update live." })
1652
2143
  ] });
1653
- }, pn = (e, n) => {
1654
- const s = n.match(/^\/(?:([a-z0-9-]+)\/)?(paywall|funnel)\/([a-z0-9-]+)\/?$/);
1655
- if (s)
2144
+ }, Ia = (e, t) => {
2145
+ const a = t.match(/^\/(?:([a-z0-9-]+)\/)?(paywall|funnel)\/([a-z0-9-]+)\/?$/);
2146
+ if (a)
1656
2147
  return e.find(
1657
- (a) => a.kind === s[2] && a.id === s[3] && (s[1] === void 0 || a.project === s[1])
2148
+ (r) => r.kind === a[2] && r.id === a[3] && (a[1] === void 0 || r.project === a[1])
1658
2149
  );
1659
- }, vn = ({
2150
+ }, Ta = ({
1660
2151
  source: e,
1661
- device: n = !1,
1662
- openPreview: s = (a) => window.location.assign(a)
2152
+ mode: t = "local"
1663
2153
  }) => {
1664
- const [a, r] = d.useState(() => window.location.pathname), [i, c] = d.useState({});
2154
+ const [a, r] = d.useState(() => window.location.pathname), [s, i] = d.useState({});
1665
2155
  d.useEffect(() => {
1666
- const l = () => r(window.location.pathname);
1667
- return window.addEventListener("popstate", l), () => window.removeEventListener("popstate", l);
2156
+ const m = () => r(window.location.pathname);
2157
+ return window.addEventListener("popstate", m), () => window.removeEventListener("popstate", m);
1668
2158
  }, []), d.useEffect(() => {
1669
2159
  if (e.capabilities?.actions !== !0) return;
1670
- let l = !1;
1671
- return Jt().then((h) => {
1672
- l || c(h);
2160
+ let m = !1;
2161
+ return pa().then((b) => {
2162
+ m || i(b);
1673
2163
  }), () => {
1674
- l = !0;
2164
+ m = !0;
1675
2165
  };
1676
2166
  }, [e.capabilities?.actions]);
1677
- const f = (l) => {
1678
- window.history.pushState(null, "", l), r(l);
1679
- }, u = n ? void 0 : pn(e.surfaces, a);
1680
- return /* @__PURE__ */ t(et, { children: u ? /* @__PURE__ */ t(
1681
- en,
1682
- {
1683
- source: e,
1684
- surface: u,
1685
- samples: i,
1686
- onBack: () => f("/")
1687
- }
1688
- ) : /* @__PURE__ */ t(
1689
- dn,
1690
- {
1691
- source: e,
1692
- device: n,
1693
- onOpen: (l) => n ? s(He(l)) : f($(l))
1694
- }
1695
- ) });
1696
- }, hn = (e) => typeof e == "object" && e !== null && !Array.isArray(e) && Object.values(e).every((n) => typeof n == "string"), B = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Y = (e) => Array.isArray(e) && e.every((n) => typeof n == "string"), mn = (e) => {
1697
- if (!B(e)) return;
1698
- const n = e.kind === "paywall" || e.kind === "funnel" ? e.kind : void 0;
1699
- if (!(!n || typeof e.id != "string"))
2167
+ const o = t === "device" ? "/device" : "/", p = d.useCallback((m) => {
2168
+ window.history.pushState(null, "", m), r(m);
2169
+ }, []), c = d.useMemo(
2170
+ () => ({ href: o, navigate: () => p(o) }),
2171
+ [o, p]
2172
+ ), h = Ia(e.surfaces, a);
2173
+ return /* @__PURE__ */ n(na, { mode: t, home: c, children: /* @__PURE__ */ n(It, { children: h ? /* @__PURE__ */ n(ba, { source: e, surface: h, samples: s }) : /* @__PURE__ */ n(ka, { source: e, onOpen: (m) => p(O(m)) }) }) });
2174
+ }, Ea = (e) => typeof e == "object" && e !== null && !Array.isArray(e) && Object.values(e).every((t) => typeof t == "string"), j = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Y = (e) => Array.isArray(e) && e.every((t) => typeof t == "string"), Pa = (e) => {
2175
+ if (!j(e)) return;
2176
+ const t = e.kind === "paywall" || e.kind === "funnel" ? e.kind : void 0;
2177
+ if (!(!t || typeof e.id != "string"))
1700
2178
  return {
1701
- kind: n,
2179
+ kind: t,
1702
2180
  id: e.id,
1703
2181
  ...typeof e.project == "string" ? { project: e.project } : {},
1704
2182
  routes: Y(e.routes) ? e.routes : [],
1705
- products: hn(e.products) ? e.products : {},
2183
+ products: Ea(e.products) ? e.products : {},
1706
2184
  locales: Y(e.locales) ? e.locales : [],
1707
2185
  ...Y(e.platforms) ? { platforms: e.platforms } : {},
1708
2186
  paywallId: typeof e.paywallId == "string" ? e.paywallId : void 0
1709
2187
  };
1710
- }, gn = (e) => {
1711
- if (!B(e))
2188
+ }, Ra = (e) => {
2189
+ if (!j(e))
1712
2190
  throw new Error("project payload is not an object");
1713
- const n = Array.isArray(e.surfaces) ? e.surfaces.map(mn).filter((i) => i !== void 0) : [], s = B(e.capabilities) ? e.capabilities : {}, a = B(e.samples) ? e.samples : {}, r = (i) => B(a[i]) ? a[i] : {};
2191
+ const t = Array.isArray(e.surfaces) ? e.surfaces.map(Pa).filter((i) => i !== void 0) : [], a = j(e.capabilities) ? e.capabilities : {}, r = j(e.samples) ? e.samples : {}, s = (i) => j(r[i]) ? r[i] : {};
1714
2192
  return {
1715
2193
  title: typeof e.title == "string" ? e.title : "superwall",
1716
2194
  scheme: typeof e.scheme == "string" ? e.scheme : void 0,
1717
- surfaces: n,
2195
+ surfaces: t,
1718
2196
  diagnostics: Y(e.diagnostics) ? e.diagnostics : [],
1719
2197
  samples: {
1720
- device: r("device"),
1721
- user: r("user"),
1722
- params: r("params")
2198
+ device: s("device"),
2199
+ user: s("user"),
2200
+ params: s("params")
1723
2201
  },
1724
- capabilities: { actions: s.actions === !0 }
2202
+ capabilities: { actions: a.actions === !0 }
1725
2203
  };
1726
2204
  };
1727
2205
  export {
1728
- ze as DEFAULT_DEVICE_ID,
1729
- Nt as DeviceFrame,
1730
- J as STUDIO_DEVICES,
1731
- Bt as Segmented,
1732
- Ne as Select,
1733
- vn as StudioApp,
1734
- et as StudioShell,
1735
- en as SurfaceEditor,
1736
- dn as SurfaceList,
1737
- Ut as Switch,
1738
- Be as TopBar,
1739
- Kt as VariablesPanel,
1740
- bn as buildPreviewPath,
1741
- Qt as deviceById,
1742
- gn as parseProjectPayload,
1743
- wn as snapshotPreviewUrl,
1744
- Fe as withOverrides,
1745
- Gt as withPreviewOptIn
2206
+ ut as DEFAULT_DEVICE_ID,
2207
+ Mn as DeviceFrame,
2208
+ ot as HostedIframe,
2209
+ Zn as PaywallToasts,
2210
+ X as STUDIO_DEVICES,
2211
+ Qn as Segmented,
2212
+ Fe as Select,
2213
+ Ta as StudioApp,
2214
+ na as StudioHostProvider,
2215
+ It as StudioShell,
2216
+ ba as SurfaceEditor,
2217
+ ka as SurfaceList,
2218
+ Xn as Switch,
2219
+ pt as TopBar,
2220
+ ca as VariablesPanel,
2221
+ Ma as buildPreviewPath,
2222
+ Ge as createHostState,
2223
+ Gn as createStudioDelegate,
2224
+ ha as deviceById,
2225
+ Pt as diffHostState,
2226
+ ft as hasActions,
2227
+ F as hasIntroductoryOffer,
2228
+ ht as hostStateFor,
2229
+ ke as hostedUrl,
2230
+ Ra as parseProjectPayload,
2231
+ Ht as silentDelegate,
2232
+ $a as snapshotPreviewUrl,
2233
+ mt as studioDefaults,
2234
+ O as surfacePath,
2235
+ Yn as useStudioDelegate,
2236
+ ra as useStudioHome,
2237
+ aa as useStudioMode
1746
2238
  };