@superwall/studio 1.6.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index-0QL9585B.js +11 -0
- package/dist/assets/index-DVQfR2L6.css +1 -0
- package/dist/index.html +2 -2
- package/dist/lib/components/preview/DeviceChrome.d.ts +13 -0
- package/dist/lib/index.js +1161 -994
- package/dist/lib/lib/devices.d.ts +13 -1
- package/dist/lib/studio.css +1 -1
- package/package.json +2 -2
- package/src/components/PreviewOnDevice.tsx +1 -4
- package/src/components/controls.tsx +3 -3
- package/src/components/panels/VariablesPanel.tsx +32 -4
- package/src/components/preview/DeviceChrome.tsx +116 -1
- package/src/components/preview/DeviceFrame.tsx +7 -2
- package/src/lib/devices.ts +46 -2
- package/src/screens/SurfaceEditor.tsx +103 -81
- package/dist/assets/index-BMe9fPdZ.css +0 -1
- package/dist/assets/index-Czsb6jZs.js +0 -11
package/dist/lib/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as r, jsxs as g, Fragment as
|
|
1
|
+
import { jsx as r, jsxs as g, Fragment as Z } from "react/jsx-runtime";
|
|
2
2
|
import * as f from "react";
|
|
3
|
-
import
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { toast as me, Toaster as
|
|
6
|
-
const
|
|
3
|
+
import U from "react";
|
|
4
|
+
import { createPortal as Jn } from "react-dom";
|
|
5
|
+
import { toast as me, Toaster as er } from "sonner";
|
|
6
|
+
const tr = ({
|
|
7
7
|
children: e,
|
|
8
8
|
position: t = "fixed"
|
|
9
9
|
}) => /* @__PURE__ */ r(
|
|
@@ -12,16 +12,16 @@ const qn = ({
|
|
|
12
12
|
className: `sw-studio bg-background text-foreground ${t} inset-0 flex flex-col font-sans text-base antialiased`,
|
|
13
13
|
children: e
|
|
14
14
|
}
|
|
15
|
-
),
|
|
15
|
+
), nr = { experimentId: "0", variantId: "0", campaignId: "0" }, ge = (e) => Object.fromEntries(Object.entries(e).filter(([, t]) => t !== void 0)), tn = (e = {}) => ({
|
|
16
16
|
paywallId: e.paywallId ?? "0",
|
|
17
17
|
paywallIdentifier: e.paywallIdentifier ?? "paywall",
|
|
18
18
|
device: ge(e.device ?? {}),
|
|
19
19
|
user: ge(e.user ?? {}),
|
|
20
20
|
params: ge(e.params ?? {}),
|
|
21
21
|
products: e.products ?? [],
|
|
22
|
-
experiment: e.experiment ??
|
|
22
|
+
experiment: e.experiment ?? nr,
|
|
23
23
|
...e.introductoryOfferEligible === void 0 ? {} : { introductoryOfferEligible: e.introductoryOfferEligible }
|
|
24
|
-
}),
|
|
24
|
+
}), xt = (e, t) => {
|
|
25
25
|
const n = {
|
|
26
26
|
...e,
|
|
27
27
|
paywallId: t.paywallId ?? e.paywallId,
|
|
@@ -33,23 +33,23 @@ const qn = ({
|
|
|
33
33
|
experiment: t.experiment ?? e.experiment
|
|
34
34
|
};
|
|
35
35
|
return "introductoryOfferEligible" in t && (t.introductoryOfferEligible === void 0 ? delete n.introductoryOfferEligible : n.introductoryOfferEligible = t.introductoryOfferEligible), n;
|
|
36
|
-
},
|
|
36
|
+
}, rt = (e, t) => JSON.stringify(e) === JSON.stringify(t), Ye = (e, t) => {
|
|
37
37
|
const n = {};
|
|
38
38
|
let o = !1;
|
|
39
39
|
for (const l of /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)]))
|
|
40
|
-
l in t ?
|
|
40
|
+
l in t ? rt(e[l], t[l]) || (n[l] = t[l], o = !0) : (n[l] = void 0, o = !0);
|
|
41
41
|
return o ? n : void 0;
|
|
42
|
-
},
|
|
43
|
-
const n = {}, o =
|
|
42
|
+
}, rr = (e, t) => {
|
|
43
|
+
const n = {}, o = Ye(e.device, t.device);
|
|
44
44
|
o && (n.device = o);
|
|
45
|
-
const l =
|
|
45
|
+
const l = Ye(e.user, t.user);
|
|
46
46
|
l && (n.user = l);
|
|
47
|
-
const c =
|
|
48
|
-
return c && (n.params = c),
|
|
49
|
-
},
|
|
47
|
+
const c = Ye(e.params, t.params);
|
|
48
|
+
return c && (n.params = c), rt(e.products, t.products) || (n.products = t.products), e.introductoryOfferEligible !== t.introductoryOfferEligible && (n.introductoryOfferEligible = t.introductoryOfferEligible), e.paywallId !== t.paywallId && (n.paywallId = t.paywallId), e.paywallIdentifier !== t.paywallIdentifier && (n.paywallIdentifier = t.paywallIdentifier), rt(e.experiment, t.experiment) || (n.experiment = t.experiment), n;
|
|
49
|
+
}, nn = (e) => {
|
|
50
50
|
const t = e.variables.trialPeriodDays, n = typeof t == "number" ? t : typeof t == "string" ? Number(t) : 0;
|
|
51
51
|
return Number.isFinite(n) ? n : 0;
|
|
52
|
-
}, Ne = (e) => e.introductoryOfferEligible ?? e.products.some((t) =>
|
|
52
|
+
}, Ne = (e) => e.introductoryOfferEligible ?? e.products.some((t) => nn(t) > 0), rn = (e) => ({
|
|
53
53
|
event_name: "template_variables",
|
|
54
54
|
variables: {
|
|
55
55
|
device: e.device,
|
|
@@ -57,69 +57,69 @@ const qn = ({
|
|
|
57
57
|
params: e.params,
|
|
58
58
|
...e.products.length > 0 ? { products: e.products.map((t) => ({ [t.reference]: t.variables })) } : {}
|
|
59
59
|
}
|
|
60
|
-
}),
|
|
60
|
+
}), on = (e) => ({
|
|
61
61
|
event_name: "experiment",
|
|
62
62
|
experimentId: e.experiment.experimentId,
|
|
63
63
|
variantId: e.experiment.variantId,
|
|
64
64
|
campaignId: e.experiment.campaignId
|
|
65
|
-
}),
|
|
65
|
+
}), sn = (e) => ({
|
|
66
66
|
event_name: "products",
|
|
67
67
|
products: e.products.map((t) => ({
|
|
68
68
|
product: t.reference,
|
|
69
69
|
productId: t.productId
|
|
70
70
|
}))
|
|
71
|
-
}),
|
|
71
|
+
}), an = (e) => ({
|
|
72
72
|
event_name: "template_substitutions_prefix",
|
|
73
73
|
prefix: Ne(e) ? "freeTrial" : "default"
|
|
74
|
-
}),
|
|
74
|
+
}), or = (e) => ({
|
|
75
75
|
event_name: "paywall_open",
|
|
76
76
|
paywall_id: e.paywallId,
|
|
77
77
|
paywall_identifier: e.paywallIdentifier
|
|
78
|
-
}),
|
|
78
|
+
}), sr = (e) => ({
|
|
79
79
|
event_name: "paywall_close",
|
|
80
80
|
paywall_id: e.paywallId,
|
|
81
81
|
paywall_identifier: e.paywallIdentifier
|
|
82
|
-
}),
|
|
83
|
-
nn(e),
|
|
82
|
+
}), ir = (e) => [
|
|
84
83
|
rn(e),
|
|
85
84
|
on(e),
|
|
86
85
|
sn(e),
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
an(e),
|
|
87
|
+
or(e)
|
|
88
|
+
], ze = (e) => ({
|
|
89
89
|
product: e.reference,
|
|
90
90
|
product_identifier: e.productId
|
|
91
|
-
}),
|
|
91
|
+
}), ar = (e) => ({
|
|
92
92
|
event_name: "transaction_start",
|
|
93
|
-
...
|
|
94
|
-
}),
|
|
93
|
+
...ze(e)
|
|
94
|
+
}), lr = (e) => ({
|
|
95
95
|
event_name: "transaction_complete",
|
|
96
|
-
...
|
|
97
|
-
}),
|
|
96
|
+
...ze(e)
|
|
97
|
+
}), cr = (e) => ({
|
|
98
98
|
event_name: "transaction_abandon",
|
|
99
|
-
...
|
|
100
|
-
}),
|
|
99
|
+
...ze(e)
|
|
100
|
+
}), Ct = (e) => ({
|
|
101
101
|
event_name: "transaction_fail",
|
|
102
|
-
...
|
|
103
|
-
}),
|
|
102
|
+
...ze(e)
|
|
103
|
+
}), dr = () => ({
|
|
104
104
|
event_name: "transaction_restore"
|
|
105
|
-
}),
|
|
105
|
+
}), ur = (e, t) => ({
|
|
106
106
|
event_name: "freeTrial_start",
|
|
107
107
|
product_identifier: e.productId,
|
|
108
108
|
trial_end_date: t
|
|
109
|
-
}),
|
|
109
|
+
}), hr = () => ({ event_name: "restore_start" }), pr = () => ({
|
|
110
110
|
event_name: "restore_complete"
|
|
111
|
-
}),
|
|
111
|
+
}), Nt = () => ({ event_name: "restore_fail" }), fr = (e) => ({
|
|
112
112
|
event_name: "permission_result",
|
|
113
113
|
permission_type: e.permissionType,
|
|
114
114
|
request_id: e.requestId,
|
|
115
115
|
status: e.status
|
|
116
|
-
}),
|
|
116
|
+
}), mr = (e) => ({
|
|
117
117
|
event_name: "callback_result",
|
|
118
118
|
request_id: e.requestId,
|
|
119
119
|
name: e.name,
|
|
120
120
|
status: e.status,
|
|
121
121
|
...e.data === void 0 ? {} : { data: e.data }
|
|
122
|
-
}),
|
|
122
|
+
}), gr = () => ({
|
|
123
123
|
event: () => {
|
|
124
124
|
},
|
|
125
125
|
purchase: () => "completed",
|
|
@@ -134,68 +134,68 @@ const qn = ({
|
|
|
134
134
|
},
|
|
135
135
|
permission: () => "granted",
|
|
136
136
|
callback: () => ({ status: "success" })
|
|
137
|
-
}),
|
|
137
|
+
}), br = 1440 * 60 * 1e3, Fe = (e, t, n) => {
|
|
138
138
|
new Promise((o) => o(e())).then(t, n);
|
|
139
|
-
},
|
|
139
|
+
}, Ue = (e, t) => {
|
|
140
140
|
console.error(`[superwall host] ${e}`, t);
|
|
141
|
-
},
|
|
141
|
+
}, wr = (e, t, n) => e.products.find((o) => o.reference === t) ?? e.products.find((o) => o.productId === n) ?? {
|
|
142
142
|
reference: t,
|
|
143
143
|
productId: n ?? t,
|
|
144
144
|
variables: {}
|
|
145
|
-
},
|
|
146
|
-
const { delegate: n, send: o, now: l } = e, c =
|
|
147
|
-
o([
|
|
145
|
+
}, vr = (e, t) => {
|
|
146
|
+
const { delegate: n, send: o, now: l } = e, c = wr(e.state(), t.product, t.product_identifier);
|
|
147
|
+
o([ar(c)]), Fe(
|
|
148
148
|
() => n.purchase(c),
|
|
149
149
|
(h) => {
|
|
150
150
|
if (h === "completed") {
|
|
151
|
-
const p =
|
|
152
|
-
Ne(e.state()) && p > 0 && s.push(
|
|
153
|
-
} else o(h === "abandoned" ? [
|
|
151
|
+
const p = nn(c), s = [lr(c)];
|
|
152
|
+
Ne(e.state()) && p > 0 && s.push(ur(c, l() + p * br)), o(s);
|
|
153
|
+
} else o(h === "abandoned" ? [cr(c)] : [Ct(c)]);
|
|
154
154
|
},
|
|
155
155
|
(h) => {
|
|
156
|
-
|
|
156
|
+
Ue("purchase delegate threw", h), o([Ct(c)]);
|
|
157
157
|
}
|
|
158
158
|
);
|
|
159
|
-
},
|
|
159
|
+
}, yr = (e) => {
|
|
160
160
|
const { delegate: t, send: n } = e;
|
|
161
|
-
n([
|
|
161
|
+
n([hr()]), Fe(
|
|
162
162
|
() => t.restore(),
|
|
163
163
|
(o) => {
|
|
164
|
-
n(o === "restored" ? [
|
|
164
|
+
n(o === "restored" ? [dr(), pr()] : [Nt()]);
|
|
165
165
|
},
|
|
166
166
|
(o) => {
|
|
167
|
-
|
|
167
|
+
Ue("restore delegate threw", o), n([Nt()]);
|
|
168
168
|
}
|
|
169
169
|
);
|
|
170
|
-
},
|
|
170
|
+
}, xr = (e, t) => {
|
|
171
171
|
const { delegate: n, send: o } = e, l = (c) => o([
|
|
172
|
-
|
|
172
|
+
fr({
|
|
173
173
|
permissionType: t.permission_type,
|
|
174
174
|
requestId: t.request_id,
|
|
175
175
|
status: c
|
|
176
176
|
})
|
|
177
177
|
]);
|
|
178
|
-
|
|
178
|
+
Fe(
|
|
179
179
|
() => n.permission(t.permission_type),
|
|
180
180
|
l,
|
|
181
181
|
(c) => {
|
|
182
|
-
|
|
182
|
+
Ue("permission delegate threw", c), l("denied");
|
|
183
183
|
}
|
|
184
184
|
);
|
|
185
|
-
},
|
|
185
|
+
}, Cr = (e, t) => {
|
|
186
186
|
const { delegate: n, send: o } = e, l = (c) => o([
|
|
187
|
-
|
|
187
|
+
mr({
|
|
188
188
|
requestId: t.request_id,
|
|
189
189
|
name: t.name,
|
|
190
190
|
status: c.status,
|
|
191
191
|
...c.data === void 0 ? {} : { data: c.data }
|
|
192
192
|
})
|
|
193
193
|
]);
|
|
194
|
-
|
|
194
|
+
Fe(
|
|
195
195
|
() => n.callback(t.name, t.variables ?? {}),
|
|
196
196
|
l,
|
|
197
197
|
(c) => {
|
|
198
|
-
|
|
198
|
+
Ue("callback delegate threw", c), l({ status: "failure" });
|
|
199
199
|
}
|
|
200
200
|
);
|
|
201
201
|
}, Et = (e) => JSON.stringify([
|
|
@@ -203,8 +203,8 @@ const qn = ({
|
|
|
203
203
|
e.user,
|
|
204
204
|
e.params,
|
|
205
205
|
e.products.map((t) => [t.reference, t.variables])
|
|
206
|
-
]),
|
|
207
|
-
let t =
|
|
206
|
+
]), St = (e) => JSON.stringify(e.products.map((t) => [t.reference, t.productId])), Mt = (e) => JSON.stringify(e.experiment), Nr = (e) => {
|
|
207
|
+
let t = tn(e.state);
|
|
208
208
|
const { delegate: n, send: o } = e, l = {
|
|
209
209
|
state: () => t,
|
|
210
210
|
delegate: n,
|
|
@@ -213,16 +213,16 @@ const qn = ({
|
|
|
213
213
|
}, c = (s) => {
|
|
214
214
|
switch (s.event_name) {
|
|
215
215
|
case "ping":
|
|
216
|
-
o(
|
|
216
|
+
o(ir(t));
|
|
217
217
|
return;
|
|
218
218
|
case "purchase":
|
|
219
|
-
|
|
219
|
+
vr(l, s);
|
|
220
220
|
return;
|
|
221
221
|
case "restore":
|
|
222
|
-
|
|
222
|
+
yr(l);
|
|
223
223
|
return;
|
|
224
224
|
case "close":
|
|
225
|
-
n.close(), o([
|
|
225
|
+
n.close(), o([sr(t)]);
|
|
226
226
|
return;
|
|
227
227
|
case "open_url":
|
|
228
228
|
n.openUrl(
|
|
@@ -243,15 +243,15 @@ const qn = ({
|
|
|
243
243
|
n.customPlacement(s.name, s.params);
|
|
244
244
|
return;
|
|
245
245
|
case "user_attribute_updated":
|
|
246
|
-
t =
|
|
246
|
+
t = xt(t, {
|
|
247
247
|
user: Object.fromEntries(s.attributes.map((i) => [i.key, i.value]))
|
|
248
248
|
});
|
|
249
249
|
return;
|
|
250
250
|
case "request_permission":
|
|
251
|
-
|
|
251
|
+
xr(l, s);
|
|
252
252
|
return;
|
|
253
253
|
case "request_callback":
|
|
254
|
-
|
|
254
|
+
Cr(l, s);
|
|
255
255
|
return;
|
|
256
256
|
default:
|
|
257
257
|
return;
|
|
@@ -267,21 +267,27 @@ const qn = ({
|
|
|
267
267
|
},
|
|
268
268
|
update: (s) => {
|
|
269
269
|
const i = t;
|
|
270
|
-
t =
|
|
270
|
+
t = xt(t, s);
|
|
271
271
|
const a = [];
|
|
272
|
-
Et(i) !== Et(t) && a.push(
|
|
272
|
+
Et(i) !== Et(t) && a.push(rn(t)), Mt(i) !== Mt(t) && a.push(on(t)), St(i) !== St(t) && a.push(sn(t)), Ne(i) !== Ne(t) && a.push(an(t)), a.length > 0 && o(a);
|
|
273
273
|
},
|
|
274
274
|
send: o
|
|
275
275
|
};
|
|
276
|
-
},
|
|
276
|
+
}, Er = () => {
|
|
277
|
+
try {
|
|
278
|
+
return typeof localStorage < "u" && localStorage.getItem("SW_DEBUG_TRANSPORT") === "true";
|
|
279
|
+
} catch {
|
|
280
|
+
return !1;
|
|
281
|
+
}
|
|
282
|
+
}, Sr = {
|
|
277
283
|
WebKit: "#9C27B0",
|
|
278
284
|
Android: "#4CAF50",
|
|
279
285
|
Editor: "#2196F3",
|
|
280
286
|
Web: "#00BCD4",
|
|
281
287
|
Transport: "#FF9800"
|
|
282
|
-
},
|
|
283
|
-
const t =
|
|
284
|
-
if (!
|
|
288
|
+
}, Mr = (e) => {
|
|
289
|
+
const t = Sr[e], n = (o, l, ...c) => {
|
|
290
|
+
if (!Er() && o === "debug") return;
|
|
285
291
|
const h = `%c[${e}]%c ${l}`, p = [`color: ${t}; font-weight: bold`, "color: inherit"];
|
|
286
292
|
switch (o) {
|
|
287
293
|
case "error":
|
|
@@ -304,38 +310,38 @@ const qn = ({
|
|
|
304
310
|
error: (o, ...l) => n("error", o, ...l)
|
|
305
311
|
};
|
|
306
312
|
};
|
|
307
|
-
var
|
|
308
|
-
const
|
|
313
|
+
var lt = /* @__PURE__ */ ((e) => (e.ToPaywall = "to_paywall", e.FromPaywall = "from_paywall", e.ToPaywallUi = "to_paywall_ui", e.FromPaywallUi = "from_paywall_ui", e))(lt || {});
|
|
314
|
+
const kr = (e, t) => {
|
|
309
315
|
const n = {
|
|
310
316
|
direction: t,
|
|
311
317
|
version: 1,
|
|
312
318
|
payload: { events: Array.isArray(e) ? e : [e] }
|
|
313
319
|
};
|
|
314
320
|
return JSON.stringify(n);
|
|
315
|
-
},
|
|
321
|
+
}, Ir = () => ({
|
|
316
322
|
parse: (e) => e
|
|
317
|
-
}),
|
|
323
|
+
}), _r = Mr("Transport"), Rr = (e, t, n = Ir()) => {
|
|
318
324
|
try {
|
|
319
325
|
const o = n.parse(JSON.parse(e));
|
|
320
326
|
if (o.direction !== t)
|
|
321
327
|
throw new Error("Message direction incorrect");
|
|
322
328
|
return o.payload.events;
|
|
323
329
|
} catch (o) {
|
|
324
|
-
return
|
|
330
|
+
return _r.error("Failed to parse incoming message", { message: e, error: o }), [];
|
|
325
331
|
}
|
|
326
|
-
},
|
|
327
|
-
e.postMessage(
|
|
328
|
-
},
|
|
332
|
+
}, Pr = (e) => (t) => {
|
|
333
|
+
e.postMessage(kr([...t], lt.ToPaywall), "*");
|
|
334
|
+
}, Lr = (e, t, n = {}) => {
|
|
329
335
|
const o = n.listen ?? window, l = (c) => {
|
|
330
336
|
if (c.source !== t || typeof c.data != "string") return;
|
|
331
|
-
const h =
|
|
337
|
+
const h = Rr(c.data, lt.FromPaywall);
|
|
332
338
|
h.length > 0 && e.receive(h);
|
|
333
339
|
};
|
|
334
340
|
return o.addEventListener("message", l), () => o.removeEventListener("message", l);
|
|
335
|
-
},
|
|
336
|
-
const { target: t, listen: n, ...o } = e, l =
|
|
341
|
+
}, Ar = (e) => {
|
|
342
|
+
const { target: t, listen: n, ...o } = e, l = Nr({ ...o, send: Pr(t) }), c = Lr(l, t, n ? { listen: n } : {});
|
|
337
343
|
return { host: l, detach: c };
|
|
338
|
-
},
|
|
344
|
+
}, Ke = 1440 * 60 * 1e3, Qe = 60 * 1e3, ln = -18e3, ot = {
|
|
339
345
|
publicApiKey: "pk_3f9c2a71e4b8d05c6a1f7e9b2d4c8a6e0f5b3d7c9a1e4f68",
|
|
340
346
|
platform: "iOS",
|
|
341
347
|
appUserId: "44dd573cd1e849a6997a5eaf98298e47",
|
|
@@ -348,7 +354,7 @@ const Nr = (e, t) => {
|
|
|
348
354
|
deviceLanguageCode: "en",
|
|
349
355
|
deviceCurrencyCode: "USD",
|
|
350
356
|
deviceCurrencySymbol: "$",
|
|
351
|
-
timezoneOffset:
|
|
357
|
+
timezoneOffset: ln,
|
|
352
358
|
radioType: "Wifi",
|
|
353
359
|
interfaceStyle: "Dark",
|
|
354
360
|
isLowPowerModeEnabled: 0,
|
|
@@ -356,17 +362,17 @@ const Nr = (e, t) => {
|
|
|
356
362
|
isMac: 0,
|
|
357
363
|
totalPaywallViews: 0,
|
|
358
364
|
interfaceType: "iphone"
|
|
359
|
-
}, xe = (e) => String(e).padStart(2, "0"),
|
|
365
|
+
}, xe = (e) => String(e).padStart(2, "0"), kt = (e) => {
|
|
360
366
|
const t = `${e.getUTCFullYear()}-${xe(e.getUTCMonth() + 1)}-${xe(e.getUTCDate())}`, n = `${xe(e.getUTCHours())}:${xe(e.getUTCMinutes())}:${xe(e.getUTCSeconds())}`;
|
|
361
367
|
return { date: t, time: n, dateTime: `${t}T${n}` };
|
|
362
|
-
},
|
|
363
|
-
const n = e - 5 *
|
|
368
|
+
}, Or = (e, t = ln) => {
|
|
369
|
+
const n = e - 5 * Ke, o = e - 360 * Qe, l = kt(new Date(e)), c = kt(new Date(e + t * 1e3));
|
|
364
370
|
return {
|
|
365
|
-
daysSinceInstall: Math.floor((e - n) /
|
|
366
|
-
minutesSinceInstall: Math.floor((e - n) /
|
|
371
|
+
daysSinceInstall: Math.floor((e - n) / Ke),
|
|
372
|
+
minutesSinceInstall: Math.floor((e - n) / Qe),
|
|
367
373
|
appInstallDate: new Date(n).toISOString(),
|
|
368
|
-
daysSinceLastPaywallView: Math.floor((e - o) /
|
|
369
|
-
minutesSinceLastPaywallView: Math.floor((e - o) /
|
|
374
|
+
daysSinceLastPaywallView: Math.floor((e - o) / Ke),
|
|
375
|
+
minutesSinceLastPaywallView: Math.floor((e - o) / Qe),
|
|
370
376
|
utcDate: l.date,
|
|
371
377
|
localDate: c.date,
|
|
372
378
|
utcTime: l.time,
|
|
@@ -374,22 +380,22 @@ const Nr = (e, t) => {
|
|
|
374
380
|
utcDateTime: l.dateTime,
|
|
375
381
|
localDateTime: c.dateTime
|
|
376
382
|
};
|
|
377
|
-
},
|
|
378
|
-
...
|
|
379
|
-
...
|
|
380
|
-
}),
|
|
381
|
-
appUserId:
|
|
383
|
+
}, Tr = (e = Date.now()) => ({
|
|
384
|
+
...ot,
|
|
385
|
+
...Or(e, ot.timezoneOffset)
|
|
386
|
+
}), $r = {
|
|
387
|
+
appUserId: ot.appUserId,
|
|
382
388
|
email: "preview@example.com",
|
|
383
389
|
firstName: "John",
|
|
384
390
|
lastName: "Doe",
|
|
385
391
|
country: "US",
|
|
386
392
|
language: "en"
|
|
387
|
-
},
|
|
393
|
+
}, Dr = {
|
|
388
394
|
$event_name: "campaign_trigger",
|
|
389
395
|
event_name: "campaign_trigger",
|
|
390
396
|
$is_standard_event: !1,
|
|
391
397
|
$is_feature_gatable: !1
|
|
392
|
-
},
|
|
398
|
+
}, P = ({ className: e, children: t }) => /* @__PURE__ */ r(
|
|
393
399
|
"svg",
|
|
394
400
|
{
|
|
395
401
|
className: e ? `sw-icon ${e}` : "sw-icon",
|
|
@@ -397,18 +403,18 @@ const Nr = (e, t) => {
|
|
|
397
403
|
"aria-hidden": "true",
|
|
398
404
|
children: t
|
|
399
405
|
}
|
|
400
|
-
),
|
|
406
|
+
), cn = (e) => /* @__PURE__ */ g(P, { ...e, children: [
|
|
401
407
|
/* @__PURE__ */ r("path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" }),
|
|
402
408
|
/* @__PURE__ */ r("path", { d: "M21 3v5h-5" })
|
|
403
|
-
] }),
|
|
409
|
+
] }), Ce = (e) => /* @__PURE__ */ g(P, { ...e, children: [
|
|
404
410
|
/* @__PURE__ */ r("path", { d: "M15 3h6v6" }),
|
|
405
411
|
/* @__PURE__ */ r("path", { d: "M10 14 21 3" }),
|
|
406
412
|
/* @__PURE__ */ r("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
|
|
407
|
-
] }),
|
|
413
|
+
] }), Hr = (e) => /* @__PURE__ */ g(P, { ...e, children: [
|
|
408
414
|
/* @__PURE__ */ r("path", { d: "M12 15V3" }),
|
|
409
415
|
/* @__PURE__ */ r("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
410
416
|
/* @__PURE__ */ r("path", { d: "m7 10 5 5 5-5" })
|
|
411
|
-
] }),
|
|
417
|
+
] }), Be = () => /* @__PURE__ */ r("svg", { className: "sw-spinner", viewBox: "0 0 37 37", "aria-hidden": "true", children: [0, 1, 2, 3, 4, 5, 6, 7].map((e) => /* @__PURE__ */ r(
|
|
412
418
|
"rect",
|
|
413
419
|
{
|
|
414
420
|
x: "15.975",
|
|
@@ -420,72 +426,72 @@ const Nr = (e, t) => {
|
|
|
420
426
|
style: { animationDelay: `${(e * 0.1 - 0.8).toFixed(1)}s` }
|
|
421
427
|
},
|
|
422
428
|
e
|
|
423
|
-
)) }),
|
|
429
|
+
)) }), zr = (e) => /* @__PURE__ */ g(P, { ...e, children: [
|
|
424
430
|
/* @__PURE__ */ r("circle", { cx: "12", cy: "12", r: "4" }),
|
|
425
431
|
/* @__PURE__ */ r("path", { d: "M12 2v2M12 20v2m-7.07-17.07 1.41 1.41m11.32 11.32 1.41 1.41M2 12h2m16 0h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41" })
|
|
426
|
-
] }),
|
|
432
|
+
] }), Fr = (e) => /* @__PURE__ */ r(P, { ...e, children: /* @__PURE__ */ r("path", { d: "M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401" }) }), Ur = (e) => /* @__PURE__ */ r(P, { ...e, children: /* @__PURE__ */ r("path", { d: "M10 5H3M12 19H3M14 3v4M16 17v4M21 12h-9M21 19h-5M21 5h-7M8 10v4M8 12H3" }) }), ct = (e) => /* @__PURE__ */ r(P, { ...e, children: /* @__PURE__ */ r("path", { d: "M18 6 6 18M6 6l12 12" }) }), dn = (e) => /* @__PURE__ */ r(P, { ...e, children: /* @__PURE__ */ r("path", { d: "m6 9 6 6 6-6" }) }), un = (e) => /* @__PURE__ */ g(P, { ...e, children: [
|
|
427
433
|
/* @__PURE__ */ r("path", { d: "m7 15 5 5 5-5" }),
|
|
428
434
|
/* @__PURE__ */ r("path", { d: "m7 9 5-5 5 5" })
|
|
429
|
-
] }),
|
|
435
|
+
] }), Br = (e) => /* @__PURE__ */ r(P, { ...e, children: /* @__PURE__ */ r("path", { d: "M20 6 9 17l-5-5" }) }), Vr = (e) => /* @__PURE__ */ g(P, { ...e, children: [
|
|
430
436
|
/* @__PURE__ */ r("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
431
437
|
/* @__PURE__ */ r("path", { d: "M12 3v18" })
|
|
432
|
-
] }), Re = (e) => /* @__PURE__ */ g(
|
|
438
|
+
] }), Re = (e) => /* @__PURE__ */ g(P, { ...e, children: [
|
|
433
439
|
/* @__PURE__ */ r("circle", { cx: "12", cy: "12", r: "10" }),
|
|
434
440
|
/* @__PURE__ */ r("path", { d: "m9 12 2 2 4-4" })
|
|
435
|
-
] }), be = (e) => /* @__PURE__ */ g(
|
|
441
|
+
] }), be = (e) => /* @__PURE__ */ g(P, { ...e, children: [
|
|
436
442
|
/* @__PURE__ */ r("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }),
|
|
437
443
|
/* @__PURE__ */ r("path", { d: "M12 9v4" }),
|
|
438
444
|
/* @__PURE__ */ r("path", { d: "M12 17h.01" })
|
|
439
|
-
] }),
|
|
445
|
+
] }), hn = (e) => /* @__PURE__ */ g(P, { ...e, children: [
|
|
440
446
|
/* @__PURE__ */ r("circle", { cx: "12", cy: "12", r: "10" }),
|
|
441
447
|
/* @__PURE__ */ r("path", { d: "M12 16v-4" }),
|
|
442
448
|
/* @__PURE__ */ r("path", { d: "M12 8h.01" })
|
|
443
|
-
] }),
|
|
449
|
+
] }), ke = (e) => /* @__PURE__ */ r(P, { ...e, children: /* @__PURE__ */ r("path", { d: "M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z" }) }), Ge = (e) => /* @__PURE__ */ g(P, { ...e, children: [
|
|
444
450
|
/* @__PURE__ */ r("circle", { cx: "8", cy: "21", r: "1" }),
|
|
445
451
|
/* @__PURE__ */ r("circle", { cx: "19", cy: "21", r: "1" }),
|
|
446
452
|
/* @__PURE__ */ r("path", { d: "M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12" })
|
|
447
|
-
] }),
|
|
453
|
+
] }), jr = (e) => /* @__PURE__ */ g(P, { ...e, children: [
|
|
448
454
|
/* @__PURE__ */ r("path", { d: "M10.268 21a2 2 0 0 0 3.464 0" }),
|
|
449
455
|
/* @__PURE__ */ r("path", { d: "M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326" })
|
|
450
|
-
] }),
|
|
456
|
+
] }), Wr = (e) => /* @__PURE__ */ r(P, { ...e, children: /* @__PURE__ */ r("path", { d: "M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z" }) }), Yr = (e) => /* @__PURE__ */ g(P, { ...e, children: [
|
|
451
457
|
/* @__PURE__ */ r("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
|
|
452
458
|
/* @__PURE__ */ r("circle", { cx: "12", cy: "7", r: "4" })
|
|
453
|
-
] }),
|
|
459
|
+
] }), Kr = (e) => /* @__PURE__ */ g(P, { ...e, children: [
|
|
454
460
|
/* @__PURE__ */ r("rect", { x: "4", y: "2", width: "10", height: "16", rx: "2" }),
|
|
455
461
|
/* @__PURE__ */ r("path", { d: "M17 12a5 5 0 0 1-5 9H9" }),
|
|
456
462
|
/* @__PURE__ */ r("path", { d: "m11 19-2 2 2 2" })
|
|
457
|
-
] }),
|
|
463
|
+
] }), Qr = (e) => /* @__PURE__ */ g(P, { ...e, children: [
|
|
458
464
|
/* @__PURE__ */ r("path", { d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" }),
|
|
459
465
|
/* @__PURE__ */ r("path", { d: "m15 5 4 4" })
|
|
460
|
-
] }),
|
|
466
|
+
] }), Gr = (e) => /* @__PURE__ */ r(P, { ...e, children: /* @__PURE__ */ r("path", { d: "M5 12h14" }) }), Xr = (e) => /* @__PURE__ */ r(P, { ...e, children: /* @__PURE__ */ r("path", { d: "M5 12h14M12 5v14" }) }), Ae = (e) => /* @__PURE__ */ g(P, { ...e, children: [
|
|
461
467
|
/* @__PURE__ */ r("path", { d: "m21 21-4.34-4.34" }),
|
|
462
468
|
/* @__PURE__ */ r("circle", { cx: "11", cy: "11", r: "8" })
|
|
463
|
-
] }),
|
|
469
|
+
] }), Zr = (e) => /* @__PURE__ */ g(P, { ...e, children: [
|
|
464
470
|
/* @__PURE__ */ r("rect", { x: "3", y: "3", width: "5", height: "5", rx: "1" }),
|
|
465
471
|
/* @__PURE__ */ r("rect", { x: "16", y: "3", width: "5", height: "5", rx: "1" }),
|
|
466
472
|
/* @__PURE__ */ r("rect", { x: "3", y: "16", width: "5", height: "5", rx: "1" }),
|
|
467
473
|
/* @__PURE__ */ r("path", { d: "M21 16h-3a2 2 0 0 0-2 2v3M21 21v.01M12 7v3a2 2 0 0 1-2 2H7M3 12h.01M12 3h.01M12 16v.01M16 12h1M21 12v.01M12 21v-1" })
|
|
468
|
-
] }),
|
|
474
|
+
] }), qr = (e) => /* @__PURE__ */ g(P, { ...e, children: [
|
|
469
475
|
/* @__PURE__ */ r("rect", { x: "2", y: "4", width: "20", height: "16", rx: "2" }),
|
|
470
476
|
/* @__PURE__ */ r("path", { d: "M10 4v4M2 8h20M6 4v4" })
|
|
471
|
-
] }),
|
|
477
|
+
] }), Jr = [
|
|
472
478
|
[60, "second"],
|
|
473
479
|
[60, "minute"],
|
|
474
480
|
[24, "hour"],
|
|
475
481
|
[7, "day"],
|
|
476
482
|
[4.348, "week"],
|
|
477
483
|
[12, "month"]
|
|
478
|
-
],
|
|
484
|
+
], dt = (e, t = Date.now()) => {
|
|
479
485
|
const n = Date.parse(e);
|
|
480
486
|
if (Number.isNaN(n)) return;
|
|
481
487
|
let o = Math.max(0, (t - n) / 1e3);
|
|
482
488
|
const l = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
|
|
483
|
-
for (const [c, h] of
|
|
489
|
+
for (const [c, h] of Jr) {
|
|
484
490
|
if (o < c) return l.format(-Math.round(o), h);
|
|
485
491
|
o /= c;
|
|
486
492
|
}
|
|
487
493
|
return l.format(-Math.round(o), "year");
|
|
488
|
-
},
|
|
494
|
+
}, eo = {
|
|
489
495
|
bottom: {
|
|
490
496
|
start: "top-full left-0 mt-1 origin-top-left",
|
|
491
497
|
center: "top-full left-1/2 mt-1 -translate-x-1/2 origin-top",
|
|
@@ -503,7 +509,7 @@ const Nr = (e, t) => {
|
|
|
503
509
|
children: o
|
|
504
510
|
}) => {
|
|
505
511
|
const [l, c] = f.useState(!1);
|
|
506
|
-
return e === void 0 ? /* @__PURE__ */ r(
|
|
512
|
+
return e === void 0 ? /* @__PURE__ */ r(Z, { children: o }) : /* @__PURE__ */ g(
|
|
507
513
|
"span",
|
|
508
514
|
{
|
|
509
515
|
className: "relative inline-flex",
|
|
@@ -517,14 +523,14 @@ const Nr = (e, t) => {
|
|
|
517
523
|
"span",
|
|
518
524
|
{
|
|
519
525
|
role: "tooltip",
|
|
520
|
-
className: `pointer-events-none absolute z-50 w-max max-w-64 rounded-sm border border-border bg-popover px-2 py-1 text-left text-xs font-normal text-balance whitespace-normal text-foreground transition-[opacity,scale] duration-popup ease-out starting:scale-98 starting:opacity-0 ${
|
|
526
|
+
className: `pointer-events-none absolute z-50 w-max max-w-64 rounded-sm border border-border bg-popover px-2 py-1 text-left text-xs font-normal text-balance whitespace-normal text-foreground transition-[opacity,scale] duration-popup ease-out starting:scale-98 starting:opacity-0 ${eo[t][n]}`,
|
|
521
527
|
children: e
|
|
522
528
|
}
|
|
523
529
|
)
|
|
524
530
|
]
|
|
525
531
|
}
|
|
526
532
|
);
|
|
527
|
-
},
|
|
533
|
+
}, ut = (e, t, n) => {
|
|
528
534
|
const o = f.useRef(n);
|
|
529
535
|
o.current = n, f.useEffect(() => {
|
|
530
536
|
if (!t) return;
|
|
@@ -538,7 +544,7 @@ const Nr = (e, t) => {
|
|
|
538
544
|
window.removeEventListener("mousedown", l), window.removeEventListener("keydown", c);
|
|
539
545
|
};
|
|
540
546
|
}, [e, t]);
|
|
541
|
-
},
|
|
547
|
+
}, to = (e, t) => {
|
|
542
548
|
const [n, o] = f.useState("start");
|
|
543
549
|
return f.useLayoutEffect(() => {
|
|
544
550
|
const l = e.current;
|
|
@@ -546,12 +552,12 @@ const Nr = (e, t) => {
|
|
|
546
552
|
const c = l.getBoundingClientRect();
|
|
547
553
|
o(c.left + c.width / 2 > window.innerWidth / 2 ? "end" : "start");
|
|
548
554
|
}, [e, t]), n;
|
|
549
|
-
},
|
|
555
|
+
}, It = 12, no = (e) => {
|
|
550
556
|
const t = e?.closest(".sw-studio");
|
|
551
557
|
if (t) return t;
|
|
552
558
|
const n = e?.getRootNode();
|
|
553
559
|
return n instanceof ShadowRoot ? n : document.body;
|
|
554
|
-
},
|
|
560
|
+
}, ht = ({
|
|
555
561
|
popupRef: e,
|
|
556
562
|
anchor: t,
|
|
557
563
|
side: n,
|
|
@@ -567,13 +573,13 @@ const Nr = (e, t) => {
|
|
|
567
573
|
const a = e.current?.offsetWidth ?? 0, d = o === "end" ? i.right - a : i.left;
|
|
568
574
|
p({
|
|
569
575
|
...n === "top" ? { bottom: window.innerHeight - i.top + 4 } : { top: i.bottom + 4 },
|
|
570
|
-
left: Math.max(
|
|
576
|
+
left: Math.max(It, Math.min(d, window.innerWidth - It - a))
|
|
571
577
|
});
|
|
572
578
|
};
|
|
573
579
|
return s(), window.addEventListener("resize", s), window.addEventListener("scroll", s, !0), () => {
|
|
574
580
|
window.removeEventListener("resize", s), window.removeEventListener("scroll", s, !0);
|
|
575
581
|
};
|
|
576
|
-
}, [t, e, n, o]),
|
|
582
|
+
}, [t, e, n, o]), Jn(
|
|
577
583
|
/* @__PURE__ */ r(
|
|
578
584
|
"div",
|
|
579
585
|
{
|
|
@@ -584,9 +590,9 @@ const Nr = (e, t) => {
|
|
|
584
590
|
children: c
|
|
585
591
|
}
|
|
586
592
|
),
|
|
587
|
-
|
|
593
|
+
no(t.current)
|
|
588
594
|
);
|
|
589
|
-
},
|
|
595
|
+
}, Oe = ({
|
|
590
596
|
label: e,
|
|
591
597
|
hint: t,
|
|
592
598
|
selected: n,
|
|
@@ -603,46 +609,46 @@ const Nr = (e, t) => {
|
|
|
603
609
|
/* @__PURE__ */ r("span", { className: "truncate", children: e }),
|
|
604
610
|
t && /* @__PURE__ */ r("span", { className: "truncate text-xs/4 text-fg-tertiary", children: t })
|
|
605
611
|
] }),
|
|
606
|
-
n ? /* @__PURE__ */ r(
|
|
612
|
+
n ? /* @__PURE__ */ r(Br, { className: "text-primary" }) : /* @__PURE__ */ r("span", {})
|
|
607
613
|
]
|
|
608
614
|
}
|
|
609
|
-
),
|
|
615
|
+
), ro = ({ children: e }) => /* @__PURE__ */ r("span", { className: "block px-2.5 py-1.5 text-xs font-medium text-fg-tertiary", children: e }), oo = () => /* @__PURE__ */ r("span", { className: "mx-2.5 my-1 block h-px bg-border" }), Te = {
|
|
610
616
|
push: ["link", "build", "assets", "push", "source"],
|
|
611
617
|
publish: ["link", "build", "assets", "push", "source", "promote"],
|
|
612
618
|
promote: ["link", "promote"]
|
|
613
|
-
},
|
|
619
|
+
}, so = {
|
|
614
620
|
link: "Find paywall",
|
|
615
621
|
build: "Build snapshot",
|
|
616
622
|
assets: "Sync assets",
|
|
617
623
|
push: "Push version",
|
|
618
624
|
source: "Push source",
|
|
619
625
|
promote: "Promote to live"
|
|
620
|
-
},
|
|
626
|
+
}, io = (e, t, n) => e === "promote" && t === "rollback" ? `Roll back to v${n}` : so[e], ao = (e) => e.find((t) => t.live)?.version, lo = (e) => e.length === 0 ? void 0 : Math.max(...e.map((t) => t.version)), co = (e, t) => e !== void 0 && t !== void 0 && e < t ? "rollback" : "promote", pn = {
|
|
621
627
|
promote: { label: "Promote", running: "Promoting…" },
|
|
622
628
|
rollback: { label: "Roll back", running: "Rolling back…" }
|
|
623
|
-
},
|
|
629
|
+
}, uo = (e) => {
|
|
624
630
|
const { target: t, live: n } = e;
|
|
625
631
|
return t === void 0 ? "Make the latest push live" : n === void 0 ? `Make v${t} live` : t === n ? `v${n} is live today` : t < n ? `Make v${t} live again, replacing v${n}` : `Make v${t} live, replacing v${n}`;
|
|
626
|
-
},
|
|
632
|
+
}, ho = (e) => {
|
|
627
633
|
if (e.versions.length === 0) return "Nothing has been pushed yet";
|
|
628
634
|
if (e.target !== void 0 && e.target === e.live)
|
|
629
635
|
return `v${e.live} is already live`;
|
|
630
|
-
},
|
|
636
|
+
}, po = {
|
|
631
637
|
push: "New version, nothing live changes",
|
|
632
638
|
publish: "Push and make it live"
|
|
633
|
-
},
|
|
639
|
+
}, $e = (e, t) => e === "push" ? "Push" : e === "publish" ? "Publish" : pn[t].label, fn = (e, t) => e === "push" ? "Pushing…" : e === "publish" ? "Publishing…" : pn[t].running, fo = {
|
|
634
640
|
done: "bg-primary",
|
|
635
641
|
failed: "bg-destructive",
|
|
636
642
|
pending: "bg-fg-muted"
|
|
637
|
-
},
|
|
643
|
+
}, mo = ({
|
|
638
644
|
progress: e,
|
|
639
645
|
direction: t,
|
|
640
646
|
target: n
|
|
641
647
|
}) => {
|
|
642
|
-
const o =
|
|
648
|
+
const o = Te[e.action], l = o.filter((h) => e.steps[h] === "done").length, c = e.error !== void 0;
|
|
643
649
|
return /* @__PURE__ */ g("div", { className: "flex w-72 max-w-full flex-col", children: [
|
|
644
650
|
/* @__PURE__ */ g("div", { className: "flex flex-col gap-2 p-3", children: [
|
|
645
|
-
/* @__PURE__ */ r("span", { className: "-mt-1 text-sm font-medium", children: c ? `${
|
|
651
|
+
/* @__PURE__ */ r("span", { className: "-mt-1 text-sm font-medium", children: c ? `${$e(e.action, t)} failed` : l === o.length ? `${$e(e.action, t)} complete` : fn(e.action, t) }),
|
|
646
652
|
/* @__PURE__ */ r("span", { className: "block h-1 w-full overflow-hidden rounded-sm bg-muted", children: /* @__PURE__ */ r(
|
|
647
653
|
"span",
|
|
648
654
|
{
|
|
@@ -659,10 +665,10 @@ const Nr = (e, t) => {
|
|
|
659
665
|
"span",
|
|
660
666
|
{
|
|
661
667
|
className: `flex-1 text-sm ${s === "pending" ? "text-fg-tertiary" : "text-foreground"}`,
|
|
662
|
-
children:
|
|
668
|
+
children: io(h, e.action === "promote" ? t : "promote", n)
|
|
663
669
|
}
|
|
664
670
|
),
|
|
665
|
-
s === "active" ? /* @__PURE__ */ r("span", { className: "flex size-4 flex-none items-center justify-center text-primary", children: /* @__PURE__ */ r(
|
|
671
|
+
s === "active" ? /* @__PURE__ */ r("span", { className: "flex size-4 flex-none items-center justify-center text-primary", children: /* @__PURE__ */ r(Be, {}) }) : /* @__PURE__ */ r("span", { className: `size-2 flex-none rounded-full ${fo[s]}` })
|
|
666
672
|
] }, h);
|
|
667
673
|
}) }),
|
|
668
674
|
e.error && /* @__PURE__ */ r(
|
|
@@ -674,18 +680,18 @@ const Nr = (e, t) => {
|
|
|
674
680
|
}
|
|
675
681
|
)
|
|
676
682
|
] });
|
|
677
|
-
},
|
|
683
|
+
}, _t = (e) => `v${e.version}${e.live ? " · Live" : ""}`, go = (e) => {
|
|
678
684
|
if (e.live) return "What SDKs receive today";
|
|
679
|
-
const t = e.pushedAt ?
|
|
685
|
+
const t = e.pushedAt ? dt(e.pushedAt) : void 0;
|
|
680
686
|
return t ? `Pushed ${t}` : "Pushed snapshot";
|
|
681
|
-
},
|
|
687
|
+
}, Rt = "sw-btn sw-btn--sm sw-btn--primary", bo = ({
|
|
682
688
|
versions: e,
|
|
683
689
|
target: t,
|
|
684
690
|
disabled: n,
|
|
685
691
|
onPick: o
|
|
686
692
|
}) => {
|
|
687
693
|
const [l, c] = f.useState(!1), h = f.useRef(null), p = f.useRef(null), s = f.useMemo(() => [h, p], []);
|
|
688
|
-
|
|
694
|
+
ut(s, l, () => c(!1));
|
|
689
695
|
const i = e.find((a) => a.version === t);
|
|
690
696
|
return /* @__PURE__ */ g("div", { className: "relative flex", ref: h, children: [
|
|
691
697
|
/* @__PURE__ */ g(
|
|
@@ -698,16 +704,16 @@ const Nr = (e, t) => {
|
|
|
698
704
|
disabled: n,
|
|
699
705
|
onClick: () => c((a) => !a),
|
|
700
706
|
children: [
|
|
701
|
-
i ?
|
|
702
|
-
/* @__PURE__ */ r(
|
|
707
|
+
i ? _t(i) : `v${t}`,
|
|
708
|
+
/* @__PURE__ */ r(un, { className: "icon-tertiary" })
|
|
703
709
|
]
|
|
704
710
|
}
|
|
705
711
|
),
|
|
706
|
-
l && /* @__PURE__ */ r(
|
|
707
|
-
|
|
712
|
+
l && /* @__PURE__ */ r(ht, { popupRef: p, anchor: h, side: "bottom", align: "end", className: "w-56", children: /* @__PURE__ */ r("div", { className: "flex max-h-64 scroll-fade flex-col overflow-y-auto p-1", "data-menu-list": "", children: e.map((a) => /* @__PURE__ */ r(
|
|
713
|
+
Oe,
|
|
708
714
|
{
|
|
709
|
-
label:
|
|
710
|
-
hint:
|
|
715
|
+
label: _t(a),
|
|
716
|
+
hint: go(a),
|
|
711
717
|
selected: a.version === t,
|
|
712
718
|
onSelect: () => {
|
|
713
719
|
c(!1), o(a.version);
|
|
@@ -716,7 +722,7 @@ const Nr = (e, t) => {
|
|
|
716
722
|
a.version
|
|
717
723
|
)) }) })
|
|
718
724
|
] });
|
|
719
|
-
},
|
|
725
|
+
}, wo = ({
|
|
720
726
|
offered: e,
|
|
721
727
|
promotion: t,
|
|
722
728
|
progress: n,
|
|
@@ -724,26 +730,26 @@ const Nr = (e, t) => {
|
|
|
724
730
|
onRun: l,
|
|
725
731
|
onBlocked: c
|
|
726
732
|
}) => {
|
|
727
|
-
const [h, p] = f.useState(e[0] ?? "push"), [s, i] = f.useState(!1), a = f.useRef(null), d =
|
|
728
|
-
|
|
729
|
-
const
|
|
730
|
-
if (
|
|
733
|
+
const [h, p] = f.useState(e[0] ?? "push"), [s, i] = f.useState(!1), a = f.useRef(null), d = co(t.target, t.live), [u, b] = f.useState({ direction: d, target: t.target }), m = [...t.versions].sort((R, z) => z.version - R.version), v = t.pick, w = v !== void 0 && m.length > 0, S = e.length > 1, M = h === "promote" ? ho(t) : o, C = M !== void 0, x = n !== void 0 && n.error === void 0 && Te[n.action].some((R) => n.steps[R] !== "done"), _ = n !== void 0, N = f.useRef(null), A = f.useMemo(() => [a, N], []);
|
|
734
|
+
ut(A, s, () => i(!1));
|
|
735
|
+
const L = () => {
|
|
736
|
+
if (C) {
|
|
731
737
|
h !== "promote" && c?.();
|
|
732
738
|
return;
|
|
733
739
|
}
|
|
734
740
|
b({ direction: d, target: t.target }), l(h);
|
|
735
|
-
}, K = (
|
|
736
|
-
p(
|
|
741
|
+
}, K = (R) => {
|
|
742
|
+
p(R), i(!1);
|
|
737
743
|
};
|
|
738
744
|
return /* @__PURE__ */ g("div", { className: "flex items-center gap-2", children: [
|
|
739
745
|
w && /* @__PURE__ */ r(
|
|
740
|
-
|
|
746
|
+
bo,
|
|
741
747
|
{
|
|
742
748
|
versions: m,
|
|
743
749
|
target: t.target,
|
|
744
|
-
disabled:
|
|
745
|
-
onPick: (
|
|
746
|
-
v(
|
|
750
|
+
disabled: x,
|
|
751
|
+
onPick: (R) => {
|
|
752
|
+
v(R), e.includes("promote") && p("promote");
|
|
747
753
|
}
|
|
748
754
|
}
|
|
749
755
|
),
|
|
@@ -753,73 +759,73 @@ const Nr = (e, t) => {
|
|
|
753
759
|
"button",
|
|
754
760
|
{
|
|
755
761
|
type: "button",
|
|
756
|
-
className: `${
|
|
757
|
-
disabled:
|
|
758
|
-
"aria-busy":
|
|
759
|
-
onClick:
|
|
762
|
+
className: `${Rt} ${S ? "rounded-e-none border-e-0" : ""}`,
|
|
763
|
+
disabled: x || C && h === "promote",
|
|
764
|
+
"aria-busy": x || void 0,
|
|
765
|
+
onClick: L,
|
|
760
766
|
children: [
|
|
761
|
-
|
|
762
|
-
|
|
767
|
+
x && /* @__PURE__ */ r(Be, {}),
|
|
768
|
+
x ? fn(n.action, u.direction) : $e(h, d)
|
|
763
769
|
]
|
|
764
770
|
}
|
|
765
771
|
),
|
|
766
|
-
S && /* @__PURE__ */ g(
|
|
772
|
+
S && /* @__PURE__ */ g(Z, { children: [
|
|
767
773
|
/* @__PURE__ */ r("span", { "aria-hidden": "true", className: "w-px bg-primary-foreground/24" }),
|
|
768
774
|
/* @__PURE__ */ r(
|
|
769
775
|
"button",
|
|
770
776
|
{
|
|
771
777
|
type: "button",
|
|
772
|
-
className: `${
|
|
778
|
+
className: `${Rt} sw-btn--icon rounded-s-none border-s-0`,
|
|
773
779
|
"aria-label": "Choose action",
|
|
774
780
|
"aria-expanded": s,
|
|
775
|
-
"aria-busy":
|
|
776
|
-
disabled:
|
|
777
|
-
onClick: () => i((
|
|
778
|
-
children: /* @__PURE__ */ r(
|
|
781
|
+
"aria-busy": x || void 0,
|
|
782
|
+
disabled: x,
|
|
783
|
+
onClick: () => i((R) => !R),
|
|
784
|
+
children: /* @__PURE__ */ r(dn, {})
|
|
779
785
|
}
|
|
780
786
|
)
|
|
781
787
|
] })
|
|
782
788
|
] }) }),
|
|
783
|
-
(
|
|
784
|
-
|
|
789
|
+
(_ || s) && /* @__PURE__ */ r(ht, { popupRef: N, anchor: a, side: "bottom", align: "end", children: _ ? /* @__PURE__ */ r(mo, { progress: n, direction: u.direction, target: u.target }) : /* @__PURE__ */ r("div", { className: "flex w-max min-w-56 flex-col p-1", children: e.map((R) => /* @__PURE__ */ r(
|
|
790
|
+
Oe,
|
|
785
791
|
{
|
|
786
|
-
label:
|
|
787
|
-
hint:
|
|
788
|
-
selected:
|
|
789
|
-
onSelect: () => K(
|
|
792
|
+
label: $e(R, d),
|
|
793
|
+
hint: R === "promote" ? uo(t) : po[R],
|
|
794
|
+
selected: R === h,
|
|
795
|
+
onSelect: () => K(R)
|
|
790
796
|
},
|
|
791
|
-
|
|
797
|
+
R
|
|
792
798
|
)) }) })
|
|
793
799
|
] })
|
|
794
800
|
] });
|
|
795
|
-
},
|
|
801
|
+
}, vo = ({
|
|
796
802
|
active: e,
|
|
797
803
|
options: t,
|
|
798
804
|
notice: n,
|
|
799
805
|
onSelect: o
|
|
800
806
|
}) => {
|
|
801
807
|
const [l, c] = f.useState(!1), [h, p] = f.useState(""), s = f.useRef(null), i = f.useRef(null), a = f.useMemo(() => [s, i], []);
|
|
802
|
-
|
|
803
|
-
const d =
|
|
808
|
+
ut(a, l, () => c(!1));
|
|
809
|
+
const d = to(s, l);
|
|
804
810
|
f.useEffect(() => {
|
|
805
811
|
l || p("");
|
|
806
812
|
}, [l]);
|
|
807
813
|
const u = e && (e.type === "version" ? `version:${e.version}` : e.type === "origin" ? "origin" : `surface:${e.surface.kind}/${e.surface.id}`), b = (N) => {
|
|
808
814
|
c(!1), o(N);
|
|
809
|
-
}, m = h.trim().toLowerCase(), v = (N) => m === "" || `${N.label} ${N.hint}`.toLowerCase().includes(m), w = t.filter((N) => N.target.type === "origin").filter(v), S = t.filter((N) => N.target.type === "version").filter(v), M = t.filter((N) => N.target.type === "surface").filter(v),
|
|
810
|
-
|
|
815
|
+
}, m = h.trim().toLowerCase(), v = (N) => m === "" || `${N.label} ${N.hint}`.toLowerCase().includes(m), w = t.filter((N) => N.target.type === "origin").filter(v), S = t.filter((N) => N.target.type === "version").filter(v), M = t.filter((N) => N.target.type === "surface").filter(v), C = (N) => N.map((A) => /* @__PURE__ */ r(
|
|
816
|
+
Oe,
|
|
811
817
|
{
|
|
812
|
-
label:
|
|
813
|
-
hint:
|
|
814
|
-
selected:
|
|
815
|
-
onSelect: () => b(
|
|
818
|
+
label: A.label,
|
|
819
|
+
hint: A.hint,
|
|
820
|
+
selected: A.key === u,
|
|
821
|
+
onSelect: () => b(A.target)
|
|
816
822
|
},
|
|
817
|
-
|
|
818
|
-
)),
|
|
823
|
+
A.key
|
|
824
|
+
)), x = [
|
|
819
825
|
{ label: "Rebuilt from", options: w },
|
|
820
826
|
{ label: "Versions", options: S },
|
|
821
827
|
{ label: "Paywalls", options: M }
|
|
822
|
-
].filter((N) => N.options.length > 0),
|
|
828
|
+
].filter((N) => N.options.length > 0), _ = x.length > 1;
|
|
823
829
|
return /* @__PURE__ */ g("div", { className: "relative flex", ref: s, children: [
|
|
824
830
|
/* @__PURE__ */ g(
|
|
825
831
|
"button",
|
|
@@ -830,14 +836,14 @@ const Nr = (e, t) => {
|
|
|
830
836
|
"aria-expanded": l,
|
|
831
837
|
onClick: () => c((N) => !N),
|
|
832
838
|
children: [
|
|
833
|
-
/* @__PURE__ */ r(
|
|
839
|
+
/* @__PURE__ */ r(Vr, {}),
|
|
834
840
|
"Compare"
|
|
835
841
|
]
|
|
836
842
|
}
|
|
837
843
|
),
|
|
838
|
-
l && /* @__PURE__ */ g(
|
|
844
|
+
l && /* @__PURE__ */ g(ht, { popupRef: i, anchor: s, side: "top", align: d, className: "w-72", children: [
|
|
839
845
|
/* @__PURE__ */ g("label", { className: "flex items-center gap-2.5 border-b border-border ps-3 pe-2.5", children: [
|
|
840
|
-
/* @__PURE__ */ r(
|
|
846
|
+
/* @__PURE__ */ r(Ae, { className: "icon-tertiary" }),
|
|
841
847
|
/* @__PURE__ */ r(
|
|
842
848
|
"input",
|
|
843
849
|
{
|
|
@@ -855,19 +861,19 @@ const Nr = (e, t) => {
|
|
|
855
861
|
{
|
|
856
862
|
className: "flex max-h-64 scroll-fade flex-col gap-1.5 overflow-y-auto p-1",
|
|
857
863
|
"data-menu-list": "",
|
|
858
|
-
children:
|
|
859
|
-
|
|
860
|
-
|
|
864
|
+
children: x.length === 0 ? /* @__PURE__ */ r("span", { className: "block px-2.5 py-1 text-sm text-fg-tertiary", children: m === "" ? "No pushed versions or other paywalls" : `No versions or paywalls match “${h.trim()}”` }) : x.map((N) => /* @__PURE__ */ g("div", { className: "flex flex-col", children: [
|
|
865
|
+
_ && /* @__PURE__ */ r(ro, { children: N.label }),
|
|
866
|
+
C(N.options)
|
|
861
867
|
] }, N.label))
|
|
862
868
|
}
|
|
863
869
|
),
|
|
864
870
|
/* @__PURE__ */ g("div", { className: "flex flex-col border-t border-border p-1", children: [
|
|
865
|
-
n && /* @__PURE__ */ g(
|
|
871
|
+
n && /* @__PURE__ */ g(Z, { children: [
|
|
866
872
|
/* @__PURE__ */ r("span", { className: "block px-2.5 py-1.5 text-xs text-fg-secondary", role: "status", children: n }),
|
|
867
|
-
/* @__PURE__ */ r(
|
|
873
|
+
/* @__PURE__ */ r(oo, {})
|
|
868
874
|
] }),
|
|
869
875
|
/* @__PURE__ */ r(
|
|
870
|
-
|
|
876
|
+
Oe,
|
|
871
877
|
{
|
|
872
878
|
label: "Off",
|
|
873
879
|
hint: "A single preview",
|
|
@@ -878,23 +884,23 @@ const Nr = (e, t) => {
|
|
|
878
884
|
] })
|
|
879
885
|
] })
|
|
880
886
|
] });
|
|
881
|
-
},
|
|
887
|
+
}, yo = 0.1, xo = 4, pe = { top: 48, right: 48, bottom: 48, left: 48 }, Pt = 1.25, pt = (e) => Math.min(xo, Math.max(yo, e)), Co = (e, t) => {
|
|
882
888
|
if (e.width <= 0 || e.height <= 0 || t.width <= 0 || t.height <= 0)
|
|
883
889
|
return { scale: 1, x: 0, y: 0 };
|
|
884
|
-
const n =
|
|
885
|
-
return
|
|
886
|
-
},
|
|
890
|
+
const n = mn(t), o = pt(Math.min(1, n.width / e.width, n.height / e.height));
|
|
891
|
+
return gn(o, e, t);
|
|
892
|
+
}, mn = (e) => ({
|
|
887
893
|
width: e.width - pe.left - pe.right,
|
|
888
894
|
height: e.height - pe.top - pe.bottom
|
|
889
|
-
}),
|
|
890
|
-
const o =
|
|
895
|
+
}), gn = (e, t, n) => {
|
|
896
|
+
const o = mn(n);
|
|
891
897
|
return {
|
|
892
898
|
scale: e,
|
|
893
899
|
x: pe.left + (o.width - t.width * e) / 2,
|
|
894
900
|
y: pe.top + (o.height - t.height * e) / 2
|
|
895
901
|
};
|
|
896
|
-
},
|
|
897
|
-
const o =
|
|
902
|
+
}, Xe = (e, t, n) => {
|
|
903
|
+
const o = pt(e.scale * t), l = o / e.scale;
|
|
898
904
|
return {
|
|
899
905
|
scale: o,
|
|
900
906
|
x: n.x - (n.x - e.x) * l,
|
|
@@ -904,27 +910,27 @@ const Nr = (e, t) => {
|
|
|
904
910
|
...e,
|
|
905
911
|
x: e.x + t,
|
|
906
912
|
y: e.y + n
|
|
907
|
-
}),
|
|
908
|
-
|
|
909
|
-
Math.max(
|
|
910
|
-
),
|
|
913
|
+
}), No = (e, t) => pt(Math.round((t === 1 ? e * Pt : e / Pt) * 100) / 100), Eo = (e) => `${Math.round(e * 100)}%`, So = 0.01, Lt = { min: 0.6, max: 1.6 }, Mo = 4, ko = "data-studio-grab", bn = f.createContext(1), wn = () => f.useContext(bn), Ze = (e, t) => Math.hypot(e.x - t.x, e.y - t.y), At = (e, t) => ({ x: (e.x + t.x) / 2, y: (e.y + t.y) / 2 }), Io = (e) => Math.min(
|
|
914
|
+
Lt.max,
|
|
915
|
+
Math.max(Lt.min, Math.exp(-e * So))
|
|
916
|
+
), Ot = (e) => e.ctrlKey || e.metaKey, _o = (e) => {
|
|
911
917
|
e.preventDefault(), e.stopPropagation();
|
|
912
|
-
},
|
|
918
|
+
}, vn = (e) => e instanceof HTMLElement && (e.isContentEditable || /^(input|textarea|select)$/i.test(e.tagName)), Ro = (e) => {
|
|
913
919
|
try {
|
|
914
920
|
return e.contentDocument ? e.contentWindow : null;
|
|
915
921
|
} catch {
|
|
916
922
|
return null;
|
|
917
923
|
}
|
|
918
|
-
},
|
|
919
|
-
const n =
|
|
924
|
+
}, Po = (e) => typeof e == "object" && e !== null && e.nodeType === 1, Tt = (e, t) => e.ownerDocument.defaultView?.getComputedStyle(e)[t] || ("style" in e ? e.style[t] : ""), Lo = (e, t) => {
|
|
925
|
+
const n = Tt(e, t === "y" ? "overflowY" : "overflowX"), o = Tt(e, t === "y" ? "overscrollBehaviorY" : "overscrollBehaviorX");
|
|
920
926
|
return /(contain|none)/.test(o) ? !0 : (t === "y" ? e.scrollHeight - e.clientHeight : e.scrollWidth - e.clientWidth) > 0 ? /(auto|scroll|hidden|clip)/.test(n) || e === e.ownerDocument.scrollingElement : !1;
|
|
921
|
-
},
|
|
927
|
+
}, Ao = (e) => {
|
|
922
928
|
if (e.defaultPrevented) return !0;
|
|
923
929
|
const t = Math.abs(e.deltaX) > Math.abs(e.deltaY) ? "x" : "y";
|
|
924
|
-
for (let n =
|
|
925
|
-
if (
|
|
930
|
+
for (let n = Po(e.target) ? e.target : null; n; n = n.parentElement)
|
|
931
|
+
if (Lo(n, t)) return !0;
|
|
926
932
|
return !1;
|
|
927
|
-
},
|
|
933
|
+
}, $t = (e) => {
|
|
928
934
|
const [t, n] = f.useState({ width: 0, height: 0 });
|
|
929
935
|
return f.useLayoutEffect(() => {
|
|
930
936
|
if (!e) return;
|
|
@@ -933,14 +939,14 @@ const Nr = (e, t) => {
|
|
|
933
939
|
const l = new ResizeObserver(o);
|
|
934
940
|
return l.observe(e), () => l.disconnect();
|
|
935
941
|
}, [e]), t;
|
|
936
|
-
},
|
|
942
|
+
}, Oo = (e) => {
|
|
937
943
|
const t = f.useRef(e);
|
|
938
944
|
return t.current = e, t;
|
|
939
|
-
},
|
|
945
|
+
}, To = () => {
|
|
940
946
|
const [e, t] = f.useState(!1);
|
|
941
947
|
return f.useEffect(() => {
|
|
942
948
|
const n = (c) => {
|
|
943
|
-
c.code !== "Space" || c.repeat ||
|
|
949
|
+
c.code !== "Space" || c.repeat || vn(c.target) || (c.preventDefault(), t(!0));
|
|
944
950
|
}, o = (c) => {
|
|
945
951
|
c.code === "Space" && t(!1);
|
|
946
952
|
}, l = () => t(!1);
|
|
@@ -948,111 +954,111 @@ const Nr = (e, t) => {
|
|
|
948
954
|
window.removeEventListener("keydown", n), window.removeEventListener("keyup", o), window.removeEventListener("blur", l);
|
|
949
955
|
};
|
|
950
956
|
}, []), e;
|
|
951
|
-
},
|
|
957
|
+
}, $o = ({
|
|
952
958
|
fitKey: e,
|
|
953
959
|
ref: t,
|
|
954
960
|
onZoom: n,
|
|
955
961
|
children: o
|
|
956
962
|
}) => {
|
|
957
|
-
const [l, c] = f.useState(null), [h, p] = f.useState(null), [s, i] = f.useState({ kind: "fit" }), [a, d] = f.useState(!1), u =
|
|
963
|
+
const [l, c] = f.useState(null), [h, p] = f.useState(null), [s, i] = f.useState({ kind: "fit" }), [a, d] = f.useState(!1), u = $t(l), b = $t(h), m = To(), v = s.kind === "fit" ? Co(b, u) : s.transform, w = Oo(v), S = f.useRef(/* @__PURE__ */ new Map()), M = f.useRef(null), C = f.useRef(e), x = f.useCallback((E) => {
|
|
958
964
|
i({ kind: "manual", transform: E });
|
|
959
|
-
}, []),
|
|
965
|
+
}, []), _ = f.useCallback(() => i({ kind: "fit" }), []), N = f.useCallback(
|
|
960
966
|
(E, k) => {
|
|
961
|
-
const
|
|
962
|
-
return { x: E - (
|
|
967
|
+
const $ = l?.getBoundingClientRect();
|
|
968
|
+
return { x: E - ($?.left ?? 0), y: k - ($?.top ?? 0) };
|
|
963
969
|
},
|
|
964
970
|
[l]
|
|
965
|
-
),
|
|
971
|
+
), A = f.useCallback(
|
|
966
972
|
(E, k) => {
|
|
967
|
-
E.preventDefault(),
|
|
973
|
+
E.preventDefault(), x(Xe(w.current, Io(E.deltaY), k));
|
|
968
974
|
},
|
|
969
|
-
[
|
|
970
|
-
),
|
|
975
|
+
[x, w]
|
|
976
|
+
), L = f.useCallback(
|
|
971
977
|
(E) => {
|
|
972
|
-
const k = { x: u.width / 2, y: u.height / 2 },
|
|
973
|
-
|
|
978
|
+
const k = { x: u.width / 2, y: u.height / 2 }, $ = No(w.current.scale, E);
|
|
979
|
+
x(Xe(w.current, $ / w.current.scale, k));
|
|
974
980
|
},
|
|
975
|
-
[
|
|
981
|
+
[x, w, u]
|
|
976
982
|
), K = f.useCallback(() => {
|
|
977
|
-
|
|
978
|
-
}, [
|
|
979
|
-
(E, k) =>
|
|
980
|
-
[
|
|
983
|
+
x(gn(1, b, u));
|
|
984
|
+
}, [x, b, u]), R = f.useCallback(() => x(w.current), [x, w]), z = f.useCallback(
|
|
985
|
+
(E, k) => x(ue(w.current, E, k)),
|
|
986
|
+
[x, w]
|
|
981
987
|
);
|
|
982
|
-
f.useImperativeHandle(t, () => ({ zoomStep:
|
|
983
|
-
|
|
988
|
+
f.useImperativeHandle(t, () => ({ zoomStep: L, actualSize: K, fit: _, hold: R, pan: z }), [
|
|
989
|
+
L,
|
|
984
990
|
K,
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
991
|
+
_,
|
|
992
|
+
R,
|
|
993
|
+
z
|
|
988
994
|
]), f.useEffect(() => {
|
|
989
995
|
n?.({ scale: v.scale, fitted: s.kind === "fit" });
|
|
990
996
|
}, [n, v.scale, s.kind]), f.useEffect(() => {
|
|
991
|
-
|
|
992
|
-
}, [e,
|
|
997
|
+
C.current !== e && (C.current = e, _());
|
|
998
|
+
}, [e, _]), f.useEffect(() => {
|
|
993
999
|
if (!l) return;
|
|
994
1000
|
const E = (k) => {
|
|
995
|
-
if (
|
|
996
|
-
|
|
1001
|
+
if (Ot(k)) {
|
|
1002
|
+
A(k, N(k.clientX, k.clientY));
|
|
997
1003
|
return;
|
|
998
1004
|
}
|
|
999
|
-
k.preventDefault(),
|
|
1005
|
+
k.preventDefault(), x(ue(w.current, -k.deltaX, -k.deltaY));
|
|
1000
1006
|
};
|
|
1001
1007
|
return l.addEventListener("wheel", E, { passive: !1 }), () => l.removeEventListener("wheel", E);
|
|
1002
|
-
}, [l,
|
|
1008
|
+
}, [l, x, w, N, A]), f.useEffect(() => {
|
|
1003
1009
|
if (!h) return;
|
|
1004
|
-
const E = /* @__PURE__ */ new Map(), k = (
|
|
1005
|
-
E.get(
|
|
1006
|
-
const
|
|
1007
|
-
if (
|
|
1008
|
-
const
|
|
1009
|
-
if (
|
|
1010
|
-
const
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
N(
|
|
1010
|
+
const E = /* @__PURE__ */ new Map(), k = (F) => {
|
|
1011
|
+
E.get(F)?.(), E.delete(F);
|
|
1012
|
+
const D = Ro(F);
|
|
1013
|
+
if (!D) return;
|
|
1014
|
+
const W = new AbortController(), { signal: V } = W, re = (O) => {
|
|
1015
|
+
if (Ot(O)) {
|
|
1016
|
+
const B = F.getBoundingClientRect(), Ee = w.current.scale;
|
|
1017
|
+
A(
|
|
1018
|
+
O,
|
|
1019
|
+
N(B.left + O.clientX * Ee, B.top + O.clientY * Ee)
|
|
1014
1020
|
);
|
|
1015
1021
|
return;
|
|
1016
1022
|
}
|
|
1017
|
-
|
|
1023
|
+
Ao(O) || (O.preventDefault(), x(ue(w.current, -O.deltaX, -O.deltaY)));
|
|
1018
1024
|
};
|
|
1019
1025
|
let X = null, ne = null;
|
|
1020
|
-
const
|
|
1021
|
-
const
|
|
1022
|
-
|
|
1023
|
-
},
|
|
1024
|
-
|
|
1025
|
-
}, ve = (
|
|
1026
|
+
const Y = (O) => {
|
|
1027
|
+
const B = F.contentDocument;
|
|
1028
|
+
B && (ne?.remove(), ne = null, O && (ne = B.createElement("style"), ne.setAttribute(ko, ""), ne.textContent = "*, *::before, *::after { cursor: grabbing !important; }", (B.head ?? B.documentElement).appendChild(ne)));
|
|
1029
|
+
}, Ve = (O) => {
|
|
1030
|
+
O.pointerType !== "mouse" || O.button !== 1 || (O.preventDefault(), X = { at: { x: O.screenX, y: O.screenY }, panning: !1 });
|
|
1031
|
+
}, ve = (O) => {
|
|
1026
1032
|
if (!X) return;
|
|
1027
|
-
const
|
|
1033
|
+
const B = { x: O.screenX, y: O.screenY };
|
|
1028
1034
|
if (!X.panning) {
|
|
1029
|
-
if (
|
|
1030
|
-
X.panning = !0, d(!0),
|
|
1035
|
+
if (Ze(X.at, B) < Mo) return;
|
|
1036
|
+
X.panning = !0, d(!0), Y(!0);
|
|
1031
1037
|
}
|
|
1032
|
-
|
|
1038
|
+
O.preventDefault(), x(ue(w.current, B.x - X.at.x, B.y - X.at.y)), X.at = B;
|
|
1033
1039
|
}, ye = () => {
|
|
1034
|
-
X?.panning && (d(!1),
|
|
1040
|
+
X?.panning && (d(!1), Y(!1), D.addEventListener("click", _o, { capture: !0, once: !0, signal: V })), X = null;
|
|
1035
1041
|
};
|
|
1036
|
-
|
|
1037
|
-
},
|
|
1038
|
-
|
|
1042
|
+
D.addEventListener("wheel", re, { passive: !1, signal: V }), D.addEventListener("pointerdown", Ve, { signal: V }), D.addEventListener("pointermove", ve, { signal: V }), D.addEventListener("pointerup", ye, { signal: V }), D.addEventListener("pointercancel", ye, { signal: V }), E.set(F, () => W.abort());
|
|
1043
|
+
}, $ = (F) => {
|
|
1044
|
+
F.target instanceof HTMLIFrameElement && k(F.target);
|
|
1039
1045
|
};
|
|
1040
|
-
return h.querySelectorAll("iframe").forEach(k), h.addEventListener("load",
|
|
1041
|
-
h.removeEventListener("load",
|
|
1046
|
+
return h.querySelectorAll("iframe").forEach(k), h.addEventListener("load", $, !0), () => {
|
|
1047
|
+
h.removeEventListener("load", $, !0), E.forEach((F) => F());
|
|
1042
1048
|
};
|
|
1043
|
-
}, [h,
|
|
1049
|
+
}, [h, x, w, N, A]), f.useEffect(() => {
|
|
1044
1050
|
const E = (k) => {
|
|
1045
|
-
if (!(!(k.metaKey || k.ctrlKey) ||
|
|
1046
|
-
if (k.key === "=" || k.key === "+")
|
|
1047
|
-
else if (k.key === "-")
|
|
1048
|
-
else if (k.key === "0")
|
|
1051
|
+
if (!(!(k.metaKey || k.ctrlKey) || vn(k.target))) {
|
|
1052
|
+
if (k.key === "=" || k.key === "+") L(1);
|
|
1053
|
+
else if (k.key === "-") L(-1);
|
|
1054
|
+
else if (k.key === "0") _();
|
|
1049
1055
|
else if (k.key === "1") K();
|
|
1050
1056
|
else return;
|
|
1051
1057
|
k.preventDefault();
|
|
1052
1058
|
}
|
|
1053
1059
|
};
|
|
1054
1060
|
return window.addEventListener("keydown", E), () => window.removeEventListener("keydown", E);
|
|
1055
|
-
}, [
|
|
1061
|
+
}, [L, _, K]);
|
|
1056
1062
|
const se = (E) => {
|
|
1057
1063
|
if (!(E.pointerType === "mouse" && E.button !== 0 && E.button !== 1)) {
|
|
1058
1064
|
E.button === 1 && E.preventDefault();
|
|
@@ -1062,31 +1068,31 @@ const Nr = (e, t) => {
|
|
|
1062
1068
|
return;
|
|
1063
1069
|
}
|
|
1064
1070
|
if (S.current.set(E.pointerId, { x: E.clientX, y: E.clientY }), d(!0), S.current.size === 2) {
|
|
1065
|
-
const [k,
|
|
1066
|
-
M.current = { span:
|
|
1071
|
+
const [k, $] = [...S.current.values()];
|
|
1072
|
+
M.current = { span: Ze(k, $), midpoint: At(k, $) };
|
|
1067
1073
|
}
|
|
1068
1074
|
}
|
|
1069
1075
|
}, de = (E) => {
|
|
1070
1076
|
const k = S.current.get(E.pointerId);
|
|
1071
1077
|
if (!k) return;
|
|
1072
|
-
const
|
|
1073
|
-
if (S.current.set(E.pointerId,
|
|
1074
|
-
const [
|
|
1078
|
+
const $ = { x: E.clientX, y: E.clientY };
|
|
1079
|
+
if (S.current.set(E.pointerId, $), S.current.size >= 2 && M.current) {
|
|
1080
|
+
const [F, D] = [...S.current.values()], W = { span: Ze(F, D), midpoint: At(F, D) }, V = Xe(
|
|
1075
1081
|
w.current,
|
|
1076
|
-
|
|
1082
|
+
W.span / M.current.span,
|
|
1077
1083
|
N(M.current.midpoint.x, M.current.midpoint.y)
|
|
1078
1084
|
);
|
|
1079
|
-
|
|
1085
|
+
x(
|
|
1080
1086
|
ue(
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1087
|
+
V,
|
|
1088
|
+
W.midpoint.x - M.current.midpoint.x,
|
|
1089
|
+
W.midpoint.y - M.current.midpoint.y
|
|
1084
1090
|
)
|
|
1085
|
-
), M.current =
|
|
1091
|
+
), M.current = W;
|
|
1086
1092
|
return;
|
|
1087
1093
|
}
|
|
1088
|
-
|
|
1089
|
-
},
|
|
1094
|
+
x(ue(w.current, $.x - k.x, $.y - k.y));
|
|
1095
|
+
}, j = (E) => {
|
|
1090
1096
|
S.current.delete(E.pointerId), S.current.size < 2 && (M.current = null), S.current.size === 0 && d(!1);
|
|
1091
1097
|
};
|
|
1092
1098
|
return /* @__PURE__ */ r(
|
|
@@ -1099,8 +1105,8 @@ const Nr = (e, t) => {
|
|
|
1099
1105
|
ref: c,
|
|
1100
1106
|
onPointerDown: se,
|
|
1101
1107
|
onPointerMove: de,
|
|
1102
|
-
onPointerUp:
|
|
1103
|
-
onPointerCancel:
|
|
1108
|
+
onPointerUp: j,
|
|
1109
|
+
onPointerCancel: j,
|
|
1104
1110
|
onContextMenu: (E) => {
|
|
1105
1111
|
a && E.preventDefault();
|
|
1106
1112
|
},
|
|
@@ -1113,17 +1119,17 @@ const Nr = (e, t) => {
|
|
|
1113
1119
|
style: {
|
|
1114
1120
|
transform: `translate(${v.x}px, ${v.y}px) scale(${v.scale})`
|
|
1115
1121
|
},
|
|
1116
|
-
children: /* @__PURE__ */ r(
|
|
1122
|
+
children: /* @__PURE__ */ r(bn.Provider, { value: v.scale, children: o })
|
|
1117
1123
|
}
|
|
1118
1124
|
)
|
|
1119
1125
|
}
|
|
1120
1126
|
);
|
|
1121
|
-
},
|
|
1127
|
+
}, Do = () => /* @__PURE__ */ g("svg", { width: "19", height: "12", viewBox: "0 0 19 12", fill: "currentColor", "aria-hidden": "true", children: [
|
|
1122
1128
|
/* @__PURE__ */ r("rect", { x: "0", y: "7.5", width: "3.5", height: "4.5", rx: "1" }),
|
|
1123
1129
|
/* @__PURE__ */ r("rect", { x: "5", y: "5", width: "3.5", height: "7", rx: "1" }),
|
|
1124
1130
|
/* @__PURE__ */ r("rect", { x: "10", y: "2.5", width: "3.5", height: "9.5", rx: "1" }),
|
|
1125
1131
|
/* @__PURE__ */ r("rect", { x: "15", y: "0", width: "3.5", height: "12", rx: "1" })
|
|
1126
|
-
] }),
|
|
1132
|
+
] }), Ho = () => /* @__PURE__ */ g("svg", { width: "27", height: "13", viewBox: "0 0 27 13", "aria-hidden": "true", children: [
|
|
1127
1133
|
/* @__PURE__ */ r(
|
|
1128
1134
|
"rect",
|
|
1129
1135
|
{
|
|
@@ -1139,11 +1145,98 @@ const Nr = (e, t) => {
|
|
|
1139
1145
|
),
|
|
1140
1146
|
/* @__PURE__ */ r("path", { d: "M25 4.5v4a2.17 2.17 0 0 0 0-4Z", fill: "currentColor", fillOpacity: "0.4" }),
|
|
1141
1147
|
/* @__PURE__ */ r("rect", { x: "2", y: "2", width: "20", height: "9", rx: "2.5", fill: "currentColor" })
|
|
1142
|
-
] }),
|
|
1143
|
-
/* @__PURE__ */ r(
|
|
1148
|
+
] }), zo = () => /* @__PURE__ */ g("span", { className: "flex items-center gap-[7px]", children: [
|
|
1149
|
+
/* @__PURE__ */ r(Do, {}),
|
|
1144
1150
|
/* @__PURE__ */ r("span", { style: { fontSize: 12.5, fontWeight: 700, letterSpacing: "0.02em" }, children: "SW" }),
|
|
1145
|
-
/* @__PURE__ */ r(
|
|
1146
|
-
] }),
|
|
1151
|
+
/* @__PURE__ */ r(Ho, {})
|
|
1152
|
+
] }), yn = (e, t) => e === "closed" ? t ? { corners: [8, 8, 59, 59], camera: { x: 630.5, y: 418.5 } } : {
|
|
1153
|
+
corners: [8, 59, 59, 8],
|
|
1154
|
+
camera: { x: 418.2, y: 47.8 },
|
|
1155
|
+
clock: { x: 417.7, y: 92.7 },
|
|
1156
|
+
ring: { x: 418, y: 130 }
|
|
1157
|
+
} : t ? { corners: [55, 55, 55, 55], clock: { x: 903, y: 39.7 }, ring: { x: 903, y: 77 } } : { corners: [55, 55, 55, 55], clock: { x: 574.6, y: 47.6 }, ring: { x: 621, y: 48 } }, qe = (e) => ({
|
|
1158
|
+
position: "absolute",
|
|
1159
|
+
left: e.x,
|
|
1160
|
+
top: e.y,
|
|
1161
|
+
transform: "translate(-50%, -50%)"
|
|
1162
|
+
}), Fo = () => {
|
|
1163
|
+
const e = [64, 77, 90, 103, 116].map((t) => {
|
|
1164
|
+
const n = t * Math.PI / 180;
|
|
1165
|
+
return { cx: 20 + 17 * Math.cos(n), cy: 20 + 17 * Math.sin(n) };
|
|
1166
|
+
});
|
|
1167
|
+
return /* @__PURE__ */ g("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", "aria-hidden": "true", children: [
|
|
1168
|
+
/* @__PURE__ */ r(
|
|
1169
|
+
"path",
|
|
1170
|
+
{
|
|
1171
|
+
d: "M8.1 32.2 A17 17 0 1 1 31.9 32.2",
|
|
1172
|
+
stroke: "#fff",
|
|
1173
|
+
strokeWidth: 3,
|
|
1174
|
+
strokeLinecap: "round"
|
|
1175
|
+
}
|
|
1176
|
+
),
|
|
1177
|
+
e.map((t) => /* @__PURE__ */ r("circle", { cx: t.cx, cy: t.cy, r: 1.2, fill: "#fff", opacity: 0.6 }, t.cx)),
|
|
1178
|
+
/* @__PURE__ */ r(
|
|
1179
|
+
"path",
|
|
1180
|
+
{
|
|
1181
|
+
d: "M13.5 18.2a9.2 9.2 0 0 1 13 0",
|
|
1182
|
+
stroke: "#fff",
|
|
1183
|
+
strokeWidth: 2.4,
|
|
1184
|
+
strokeLinecap: "round"
|
|
1185
|
+
}
|
|
1186
|
+
),
|
|
1187
|
+
/* @__PURE__ */ r(
|
|
1188
|
+
"path",
|
|
1189
|
+
{
|
|
1190
|
+
d: "M16.3 21a5.2 5.2 0 0 1 7.4 0",
|
|
1191
|
+
stroke: "#fff",
|
|
1192
|
+
strokeWidth: 2.4,
|
|
1193
|
+
strokeLinecap: "round"
|
|
1194
|
+
}
|
|
1195
|
+
),
|
|
1196
|
+
/* @__PURE__ */ r("circle", { cx: 20, cy: 24.2, r: 1.8, fill: "#fff" })
|
|
1197
|
+
] });
|
|
1198
|
+
}, Uo = ({ layout: e }) => /* @__PURE__ */ g(Z, { children: [
|
|
1199
|
+
(e.clock || e.ring) && /* @__PURE__ */ g(
|
|
1200
|
+
"div",
|
|
1201
|
+
{
|
|
1202
|
+
className: "absolute inset-0",
|
|
1203
|
+
style: { mixBlendMode: "difference" },
|
|
1204
|
+
"data-testid": "duo-status",
|
|
1205
|
+
children: [
|
|
1206
|
+
e.clock && /* @__PURE__ */ r(
|
|
1207
|
+
"span",
|
|
1208
|
+
{
|
|
1209
|
+
className: "leading-none",
|
|
1210
|
+
style: {
|
|
1211
|
+
...qe(e.clock),
|
|
1212
|
+
fontFamily: '-apple-system, "SF Pro Text", system-ui, sans-serif',
|
|
1213
|
+
fontSize: 15,
|
|
1214
|
+
fontWeight: 600,
|
|
1215
|
+
letterSpacing: -0.2,
|
|
1216
|
+
color: "#fff"
|
|
1217
|
+
},
|
|
1218
|
+
children: "9:41"
|
|
1219
|
+
}
|
|
1220
|
+
),
|
|
1221
|
+
e.ring && /* @__PURE__ */ r("div", { style: qe(e.ring), children: /* @__PURE__ */ r(Fo, {}) })
|
|
1222
|
+
]
|
|
1223
|
+
}
|
|
1224
|
+
),
|
|
1225
|
+
e.camera && /* @__PURE__ */ r(
|
|
1226
|
+
"div",
|
|
1227
|
+
{
|
|
1228
|
+
className: "absolute rounded-full",
|
|
1229
|
+
"data-testid": "duo-camera",
|
|
1230
|
+
style: {
|
|
1231
|
+
...qe(e.camera),
|
|
1232
|
+
width: 37,
|
|
1233
|
+
height: 37,
|
|
1234
|
+
background: "radial-gradient(circle at 50% 50%, #1b2733 0 18%, #05070a 30% 100%)",
|
|
1235
|
+
boxShadow: "inset 0 0 0 1px rgba(255,255,255,0.06)"
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
)
|
|
1239
|
+
] }), Bo = ({
|
|
1147
1240
|
spec: e,
|
|
1148
1241
|
width: t,
|
|
1149
1242
|
height: n,
|
|
@@ -1158,7 +1251,8 @@ const Nr = (e, t) => {
|
|
|
1158
1251
|
style: { width: t, height: n, color: c },
|
|
1159
1252
|
"data-testid": "device-chrome",
|
|
1160
1253
|
children: [
|
|
1161
|
-
|
|
1254
|
+
e.duo && /* @__PURE__ */ r(Uo, { layout: yn(e.duo, o) }),
|
|
1255
|
+
!o && !e.duo && /* @__PURE__ */ g(
|
|
1162
1256
|
"div",
|
|
1163
1257
|
{
|
|
1164
1258
|
className: "absolute inset-x-0 top-0 flex items-center justify-between",
|
|
@@ -1173,7 +1267,7 @@ const Nr = (e, t) => {
|
|
|
1173
1267
|
},
|
|
1174
1268
|
children: [
|
|
1175
1269
|
/* @__PURE__ */ r("span", { children: "9:41" }),
|
|
1176
|
-
/* @__PURE__ */ r(
|
|
1270
|
+
/* @__PURE__ */ r(zo, {})
|
|
1177
1271
|
]
|
|
1178
1272
|
}
|
|
1179
1273
|
),
|
|
@@ -1221,10 +1315,10 @@ const Nr = (e, t) => {
|
|
|
1221
1315
|
]
|
|
1222
1316
|
}
|
|
1223
1317
|
);
|
|
1224
|
-
},
|
|
1318
|
+
}, Vo = (e, t) => {
|
|
1225
1319
|
const n = f.useRef(void 0), o = f.useRef({ hostState: e, delegate: t }), l = f.useCallback((c) => {
|
|
1226
1320
|
if (n.current?.detach(), n.current = void 0, !c?.contentWindow) return;
|
|
1227
|
-
const { host: h, detach: p } =
|
|
1321
|
+
const { host: h, detach: p } = Ar({
|
|
1228
1322
|
target: c.contentWindow,
|
|
1229
1323
|
state: o.current.hostState,
|
|
1230
1324
|
delegate: o.current.delegate
|
|
@@ -1234,14 +1328,14 @@ const Nr = (e, t) => {
|
|
|
1234
1328
|
return f.useEffect(() => {
|
|
1235
1329
|
o.current = { hostState: e, delegate: t };
|
|
1236
1330
|
const c = n.current;
|
|
1237
|
-
c && (c.host.update(
|
|
1331
|
+
c && (c.host.update(rr(c.sent, e)), c.sent = e);
|
|
1238
1332
|
}, [e, t]), l;
|
|
1239
|
-
},
|
|
1333
|
+
}, xn = ({ hostState: e, delegate: t, ...n }) => /* @__PURE__ */ r("iframe", { ...n, ref: Vo(e, t) }), jo = 15, Wo = 70, Dt = { width: 80, height: 60 }, Yo = 600, Ko = (e, t) => {
|
|
1240
1334
|
const n = 0.1 * (e / t) + 0.035;
|
|
1241
1335
|
return Math.round((100 - n * 100) * 10) / 10;
|
|
1242
|
-
},
|
|
1336
|
+
}, Qo = (e, t) => {
|
|
1243
1337
|
if (!e) return;
|
|
1244
|
-
const n = e.cornerRadius ??
|
|
1338
|
+
const n = e.cornerRadius ?? jo, o = Math.min(t.width, t.height) >= Yo, l = (h, p) => {
|
|
1245
1339
|
const s = Math.round(t.width * h / 100), i = Math.round(t.height * p / 100);
|
|
1246
1340
|
return {
|
|
1247
1341
|
x: Math.round((t.width - s) / 2),
|
|
@@ -1264,27 +1358,27 @@ const Nr = (e, t) => {
|
|
|
1264
1358
|
};
|
|
1265
1359
|
switch (e.style) {
|
|
1266
1360
|
case "modal":
|
|
1267
|
-
return o ? l(70, 80) : c(
|
|
1361
|
+
return o ? l(70, 80) : c(Ko(t.width, t.height), !0);
|
|
1268
1362
|
case "drawer":
|
|
1269
|
-
return c(e.height ??
|
|
1363
|
+
return c(e.height ?? Wo, !1);
|
|
1270
1364
|
case "popup":
|
|
1271
1365
|
return l(
|
|
1272
|
-
e.width ??
|
|
1273
|
-
e.height ??
|
|
1366
|
+
e.width ?? Dt.width,
|
|
1367
|
+
e.height ?? Dt.height
|
|
1274
1368
|
);
|
|
1275
1369
|
default:
|
|
1276
1370
|
return;
|
|
1277
1371
|
}
|
|
1278
|
-
},
|
|
1372
|
+
}, Go = (e) => typeof e == "object" && e !== null && !Array.isArray(e), he = (e) => typeof e == "number" && Number.isFinite(e) && e > 0 ? e : void 0, Xo = {
|
|
1279
1373
|
FULLSCREEN: "fullscreen",
|
|
1280
1374
|
MODAL: "modal",
|
|
1281
1375
|
PUSH: "push",
|
|
1282
1376
|
NO_ANIMATION: "noAnimation",
|
|
1283
1377
|
DRAWER: "drawer",
|
|
1284
1378
|
POPUP: "popup"
|
|
1285
|
-
},
|
|
1286
|
-
if (!
|
|
1287
|
-
const t =
|
|
1379
|
+
}, Zo = (e) => {
|
|
1380
|
+
if (!Go(e) || typeof e.type != "string") return;
|
|
1381
|
+
const t = Xo[e.type];
|
|
1288
1382
|
if (t)
|
|
1289
1383
|
return {
|
|
1290
1384
|
style: t,
|
|
@@ -1292,7 +1386,7 @@ const Nr = (e, t) => {
|
|
|
1292
1386
|
...he(e.height) === void 0 ? {} : { height: he(e.height) },
|
|
1293
1387
|
...he(e.corner_radius) === void 0 ? {} : { cornerRadius: he(e.corner_radius) }
|
|
1294
1388
|
};
|
|
1295
|
-
},
|
|
1389
|
+
}, qo = 250, Jo = ({
|
|
1296
1390
|
width: e,
|
|
1297
1391
|
height: t,
|
|
1298
1392
|
children: n
|
|
@@ -1304,7 +1398,7 @@ const Nr = (e, t) => {
|
|
|
1304
1398
|
style: { width: e, height: t },
|
|
1305
1399
|
children: n
|
|
1306
1400
|
}
|
|
1307
|
-
),
|
|
1401
|
+
), es = ({
|
|
1308
1402
|
width: e,
|
|
1309
1403
|
height: t,
|
|
1310
1404
|
title: n,
|
|
@@ -1324,26 +1418,26 @@ const Nr = (e, t) => {
|
|
|
1324
1418
|
return;
|
|
1325
1419
|
}
|
|
1326
1420
|
d.current += 1;
|
|
1327
|
-
const
|
|
1328
|
-
b((
|
|
1421
|
+
const N = { src: o, generation: d.current, ready: !1 };
|
|
1422
|
+
b((A) => [...A.filter((L) => L.ready).slice(-1), N]);
|
|
1329
1423
|
}, [o, h]);
|
|
1330
|
-
const v = (
|
|
1424
|
+
const v = (N) => {
|
|
1331
1425
|
window.setTimeout(() => {
|
|
1332
|
-
b((
|
|
1333
|
-
},
|
|
1334
|
-
}, w = u.findLast((
|
|
1426
|
+
b((A) => A.some((L) => L.generation === N) ? A.map((L) => L.generation === N ? { ...L, ready: !0 } : L).filter((L) => L.generation >= N) : A);
|
|
1427
|
+
}, qo);
|
|
1428
|
+
}, w = u.findLast((N) => N.ready), S = Qo(s, { width: e, height: t }), M = i ? 0 : p?.navigationBarHeight ?? 0, C = S ?? {
|
|
1335
1429
|
x: 0,
|
|
1336
1430
|
y: 0,
|
|
1337
1431
|
width: e,
|
|
1338
1432
|
height: t - M,
|
|
1339
1433
|
radius: { top: 0, bottom: 0 }
|
|
1340
|
-
},
|
|
1434
|
+
}, x = a === "dark", _ = p?.duo ? yn(p.duo, i).corners.map((N) => `${N}px`).join(" ") : p?.radius ?? 3;
|
|
1341
1435
|
return /* @__PURE__ */ g(
|
|
1342
1436
|
"div",
|
|
1343
1437
|
{
|
|
1344
1438
|
className: "relative flex-none overflow-hidden bg-background outline outline-foreground/20",
|
|
1345
1439
|
"data-testid": "device-frame",
|
|
1346
|
-
style: { width: e, height: t, borderRadius:
|
|
1440
|
+
style: { width: e, height: t, borderRadius: _ },
|
|
1347
1441
|
children: [
|
|
1348
1442
|
S && /* @__PURE__ */ r(
|
|
1349
1443
|
"div",
|
|
@@ -1351,7 +1445,7 @@ const Nr = (e, t) => {
|
|
|
1351
1445
|
className: "absolute inset-0",
|
|
1352
1446
|
"data-testid": "presentation-backdrop",
|
|
1353
1447
|
style: {
|
|
1354
|
-
background:
|
|
1448
|
+
background: x ? "repeating-linear-gradient(-45deg, #1c1f26 0 7px, #171a20 7px 20px)" : "repeating-linear-gradient(-45deg, #e3e3e3 0 7px, #ededed 7px 20px)"
|
|
1355
1449
|
},
|
|
1356
1450
|
children: S.underlay && /* @__PURE__ */ r(
|
|
1357
1451
|
"div",
|
|
@@ -1362,7 +1456,7 @@ const Nr = (e, t) => {
|
|
|
1362
1456
|
width: Math.round(e * 0.92),
|
|
1363
1457
|
height: 30,
|
|
1364
1458
|
borderRadius: "20px 20px 0 0",
|
|
1365
|
-
background:
|
|
1459
|
+
background: x ? "rgba(255,255,255,0.2)" : "rgba(0,0,0,0.3)"
|
|
1366
1460
|
}
|
|
1367
1461
|
}
|
|
1368
1462
|
)
|
|
@@ -1374,28 +1468,28 @@ const Nr = (e, t) => {
|
|
|
1374
1468
|
className: "absolute overflow-hidden",
|
|
1375
1469
|
"data-testid": "presentation-page",
|
|
1376
1470
|
style: {
|
|
1377
|
-
left:
|
|
1378
|
-
top:
|
|
1379
|
-
width:
|
|
1380
|
-
height:
|
|
1381
|
-
borderRadius: `${
|
|
1471
|
+
left: C.x,
|
|
1472
|
+
top: C.y,
|
|
1473
|
+
width: C.width,
|
|
1474
|
+
height: C.height,
|
|
1475
|
+
borderRadius: `${C.radius.top}px ${C.radius.top}px ${C.radius.bottom}px ${C.radius.bottom}px`,
|
|
1382
1476
|
boxShadow: S ? "0 0 40px rgba(0,0,0,0.25)" : void 0
|
|
1383
1477
|
},
|
|
1384
|
-
children: u.map((
|
|
1385
|
-
|
|
1478
|
+
children: u.map((N) => /* @__PURE__ */ r(
|
|
1479
|
+
xn,
|
|
1386
1480
|
{
|
|
1387
1481
|
hostState: l,
|
|
1388
1482
|
delegate: c,
|
|
1389
|
-
className: `absolute inset-0 border-0 bg-white transition-opacity duration-hover ${
|
|
1483
|
+
className: `absolute inset-0 border-0 bg-white transition-opacity duration-hover ${N === w ? "opacity-100" : "opacity-0"}`,
|
|
1390
1484
|
title: n,
|
|
1391
|
-
src:
|
|
1392
|
-
width:
|
|
1393
|
-
height:
|
|
1485
|
+
src: N.src,
|
|
1486
|
+
width: C.width,
|
|
1487
|
+
height: C.height,
|
|
1394
1488
|
onLoad: () => {
|
|
1395
|
-
|
|
1489
|
+
N.ready || v(N.generation);
|
|
1396
1490
|
}
|
|
1397
1491
|
},
|
|
1398
|
-
|
|
1492
|
+
N.generation
|
|
1399
1493
|
))
|
|
1400
1494
|
}
|
|
1401
1495
|
),
|
|
@@ -1404,11 +1498,11 @@ const Nr = (e, t) => {
|
|
|
1404
1498
|
{
|
|
1405
1499
|
className: "absolute inset-x-0 bottom-0",
|
|
1406
1500
|
"data-testid": "navigation-bar",
|
|
1407
|
-
style: { height: M, background:
|
|
1501
|
+
style: { height: M, background: x ? "#000000" : "#ffffff" }
|
|
1408
1502
|
}
|
|
1409
1503
|
),
|
|
1410
1504
|
p && /* @__PURE__ */ r("div", { className: "pointer-events-none absolute inset-0", style: { width: e, height: t }, children: /* @__PURE__ */ r(
|
|
1411
|
-
|
|
1505
|
+
Bo,
|
|
1412
1506
|
{
|
|
1413
1507
|
spec: p,
|
|
1414
1508
|
width: e,
|
|
@@ -1420,7 +1514,7 @@ const Nr = (e, t) => {
|
|
|
1420
1514
|
]
|
|
1421
1515
|
}
|
|
1422
1516
|
);
|
|
1423
|
-
},
|
|
1517
|
+
}, ts = [
|
|
1424
1518
|
{
|
|
1425
1519
|
id: "top",
|
|
1426
1520
|
label: "Resize height from the top",
|
|
@@ -1481,7 +1575,7 @@ const Nr = (e, t) => {
|
|
|
1481
1575
|
className: "-right-2 -bottom-2 h-5 w-5",
|
|
1482
1576
|
cursor: "nwse-resize"
|
|
1483
1577
|
}
|
|
1484
|
-
],
|
|
1578
|
+
], ns = ({
|
|
1485
1579
|
size: e,
|
|
1486
1580
|
scale: t,
|
|
1487
1581
|
clamp: n,
|
|
@@ -1526,12 +1620,12 @@ const Nr = (e, t) => {
|
|
|
1526
1620
|
const { handle: b, start: m } = u, v = (d.clientX - u.from.x) / t, w = (d.clientY - u.from.y) / t, S = {
|
|
1527
1621
|
width: b.x === "right" ? n(Math.round(m.width + v), m.width) : b.x === "left" ? n(Math.round(m.width - v), m.width) : m.width,
|
|
1528
1622
|
height: b.y === "bottom" ? n(Math.round(m.height + w), m.height) : b.y === "top" ? n(Math.round(m.height - w), m.height) : m.height
|
|
1529
|
-
}, M = b.x === "left" ? -(S.width - u.last.width) * t : 0,
|
|
1530
|
-
u.last = S, o(S), (M !== 0 ||
|
|
1623
|
+
}, M = b.x === "left" ? -(S.width - u.last.width) * t : 0, C = b.y === "top" ? -(S.height - u.last.height) * t : 0;
|
|
1624
|
+
u.last = S, o(S), (M !== 0 || C !== 0) && c?.(M, C);
|
|
1531
1625
|
}, a = (d) => {
|
|
1532
1626
|
h.current?.pointerId === d.pointerId && (d.stopPropagation(), p());
|
|
1533
1627
|
};
|
|
1534
|
-
return /* @__PURE__ */ r(
|
|
1628
|
+
return /* @__PURE__ */ r(Z, { children: ts.map((d) => /* @__PURE__ */ r(
|
|
1535
1629
|
"div",
|
|
1536
1630
|
{
|
|
1537
1631
|
role: "separator",
|
|
@@ -1547,7 +1641,7 @@ const Nr = (e, t) => {
|
|
|
1547
1641
|
},
|
|
1548
1642
|
d.id
|
|
1549
1643
|
)) });
|
|
1550
|
-
},
|
|
1644
|
+
}, Cn = ({
|
|
1551
1645
|
title: e,
|
|
1552
1646
|
description: t,
|
|
1553
1647
|
footer: n,
|
|
@@ -1590,7 +1684,7 @@ const Nr = (e, t) => {
|
|
|
1590
1684
|
className: "sw-btn sw-btn--icon sw-btn--ghost absolute top-[calc(--spacing(3.5)-1px)] right-[calc(--spacing(3.5)-1px)]",
|
|
1591
1685
|
"aria-label": "Close",
|
|
1592
1686
|
onClick: o,
|
|
1593
|
-
children: /* @__PURE__ */ r(
|
|
1687
|
+
children: /* @__PURE__ */ r(ct, {})
|
|
1594
1688
|
}
|
|
1595
1689
|
),
|
|
1596
1690
|
/* @__PURE__ */ r("div", { className: "flex flex-col gap-4 px-5 pt-1 pb-5", children: l }),
|
|
@@ -1600,12 +1694,12 @@ const Nr = (e, t) => {
|
|
|
1600
1694
|
)
|
|
1601
1695
|
}
|
|
1602
1696
|
);
|
|
1603
|
-
},
|
|
1697
|
+
}, rs = ({
|
|
1604
1698
|
paywall: e,
|
|
1605
1699
|
missing: t,
|
|
1606
1700
|
onDismiss: n
|
|
1607
1701
|
}) => /* @__PURE__ */ g(
|
|
1608
|
-
|
|
1702
|
+
Cn,
|
|
1609
1703
|
{
|
|
1610
1704
|
title: t.length === 1 ? "A product is missing" : `${t.length} products are missing`,
|
|
1611
1705
|
description: `${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.`,
|
|
@@ -1632,7 +1726,7 @@ const Nr = (e, t) => {
|
|
|
1632
1726
|
] })
|
|
1633
1727
|
]
|
|
1634
1728
|
}
|
|
1635
|
-
), le = ({ children: e }) => /* @__PURE__ */ r("code", { className: "rounded-xs border border-border bg-muted px-1 py-px font-mono text-xs font-normal wrap-anywhere text-foreground", children: e }),
|
|
1729
|
+
), le = ({ children: e }) => /* @__PURE__ */ r("code", { className: "rounded-xs border border-border bg-muted px-1 py-px font-mono text-xs font-normal wrap-anywhere text-foreground", children: e }), os = /* @__PURE__ */ new Set([
|
|
1636
1730
|
"ping",
|
|
1637
1731
|
"page_view",
|
|
1638
1732
|
"page_styles",
|
|
@@ -1641,7 +1735,7 @@ const Nr = (e, t) => {
|
|
|
1641
1735
|
"var_click",
|
|
1642
1736
|
"purchase",
|
|
1643
1737
|
"restore"
|
|
1644
|
-
]),
|
|
1738
|
+
]), ss = {
|
|
1645
1739
|
open_url: ["url"],
|
|
1646
1740
|
open_url_external: ["url"],
|
|
1647
1741
|
open_deep_link: ["link"],
|
|
@@ -1651,85 +1745,85 @@ const Nr = (e, t) => {
|
|
|
1651
1745
|
request_callback: ["name"],
|
|
1652
1746
|
schedule_notification: ["title"],
|
|
1653
1747
|
discount_redemption_result: ["code"]
|
|
1654
|
-
},
|
|
1748
|
+
}, is = /* @__PURE__ */ new Set(["close"]), as = /* @__PURE__ */ new Set([
|
|
1655
1749
|
"stripe_checkout_complete",
|
|
1656
1750
|
"post_checkout_complete"
|
|
1657
|
-
]),
|
|
1658
|
-
for (const t of
|
|
1751
|
+
]), ls = (e) => {
|
|
1752
|
+
for (const t of ss[e.event_name] ?? []) {
|
|
1659
1753
|
const n = Reflect.get(e, t);
|
|
1660
1754
|
if (typeof n == "string" && n.length > 0) return n;
|
|
1661
1755
|
}
|
|
1662
|
-
},
|
|
1663
|
-
if (!
|
|
1756
|
+
}, cs = (e) => {
|
|
1757
|
+
if (!os.has(e.event_name))
|
|
1664
1758
|
return {
|
|
1665
1759
|
action: e.event_name,
|
|
1666
|
-
subject:
|
|
1667
|
-
tone:
|
|
1760
|
+
subject: ls(e),
|
|
1761
|
+
tone: is.has(e.event_name) ? "warning" : as.has(e.event_name) ? "success" : "info"
|
|
1668
1762
|
};
|
|
1669
|
-
},
|
|
1763
|
+
}, ds = {
|
|
1670
1764
|
info: "text-info",
|
|
1671
1765
|
success: "text-success",
|
|
1672
1766
|
warning: "text-warning"
|
|
1673
|
-
},
|
|
1767
|
+
}, us = {
|
|
1674
1768
|
purchase: Ge,
|
|
1675
1769
|
transaction_complete: Re,
|
|
1676
1770
|
freeTrial_start: Re,
|
|
1677
1771
|
transaction_abandon: be,
|
|
1678
1772
|
transaction_fail: be,
|
|
1679
|
-
close:
|
|
1680
|
-
restore:
|
|
1773
|
+
close: ct,
|
|
1774
|
+
restore: cn,
|
|
1681
1775
|
restore_complete: Re,
|
|
1682
1776
|
restore_fail: be,
|
|
1683
|
-
open_url:
|
|
1684
|
-
open_url_external:
|
|
1685
|
-
open_deep_link:
|
|
1777
|
+
open_url: Ce,
|
|
1778
|
+
open_url_external: Ce,
|
|
1779
|
+
open_deep_link: Ce,
|
|
1686
1780
|
initiate_web_checkout: Ge,
|
|
1687
1781
|
open_payment_sheet: Ge,
|
|
1688
|
-
custom_placement:
|
|
1689
|
-
custom:
|
|
1690
|
-
request_permission:
|
|
1691
|
-
request_callback:
|
|
1692
|
-
schedule_notification:
|
|
1693
|
-
request_store_review:
|
|
1694
|
-
user_attribute_updated:
|
|
1695
|
-
},
|
|
1782
|
+
custom_placement: ke,
|
|
1783
|
+
custom: ke,
|
|
1784
|
+
request_permission: ke,
|
|
1785
|
+
request_callback: ke,
|
|
1786
|
+
schedule_notification: jr,
|
|
1787
|
+
request_store_review: Wr,
|
|
1788
|
+
user_attribute_updated: Yr
|
|
1789
|
+
}, Nn = ({
|
|
1696
1790
|
icon: e,
|
|
1697
1791
|
tone: t,
|
|
1698
1792
|
children: n,
|
|
1699
1793
|
description: o,
|
|
1700
1794
|
actions: l
|
|
1701
1795
|
}) => /* @__PURE__ */ r("div", { className: "w-90 max-w-[calc(100vw-2rem)] rounded-sm border border-border bg-popover py-3 ps-[calc(--spacing(3)-1px)] pe-3 font-sans text-sm text-foreground", children: /* @__PURE__ */ g("div", { className: "grid grid-cols-[0.875rem_1fr] items-start gap-x-2", children: [
|
|
1702
|
-
/* @__PURE__ */ r("span", { className: `flex h-5 items-center justify-center ${
|
|
1796
|
+
/* @__PURE__ */ r("span", { className: `flex h-5 items-center justify-center ${ds[t]}`, children: /* @__PURE__ */ r(e, {}) }),
|
|
1703
1797
|
/* @__PURE__ */ g("span", { className: "flex min-w-0 flex-col gap-0.5", children: [
|
|
1704
1798
|
/* @__PURE__ */ r("span", { className: "font-medium break-words", children: n }),
|
|
1705
1799
|
o && /* @__PURE__ */ r("span", { className: "break-words text-fg-secondary", children: o })
|
|
1706
1800
|
] }),
|
|
1707
1801
|
l && /* @__PURE__ */ r("div", { className: "col-start-2 mt-2 flex justify-end gap-2", children: l })
|
|
1708
|
-
] }) }),
|
|
1802
|
+
] }) }), ft = ({
|
|
1709
1803
|
action: e,
|
|
1710
1804
|
tone: t,
|
|
1711
1805
|
children: n,
|
|
1712
1806
|
actions: o
|
|
1713
|
-
}) => /* @__PURE__ */ r(
|
|
1807
|
+
}) => /* @__PURE__ */ r(Nn, { icon: us[e] ?? hn, tone: t, actions: o, children: n }), hs = ({ notice: e }) => /* @__PURE__ */ g(ft, { action: e.action, tone: e.tone, children: [
|
|
1714
1808
|
"Tap triggered a ",
|
|
1715
1809
|
/* @__PURE__ */ r(le, { children: e.action }),
|
|
1716
|
-
e.subject ? /* @__PURE__ */ g(
|
|
1810
|
+
e.subject ? /* @__PURE__ */ g(Z, { children: [
|
|
1717
1811
|
" for ",
|
|
1718
1812
|
/* @__PURE__ */ r(le, { children: e.subject })
|
|
1719
1813
|
] }) : " action",
|
|
1720
1814
|
"."
|
|
1721
|
-
] }),
|
|
1815
|
+
] }), ps = ({ choice: e, subject: t }) => /* @__PURE__ */ g(ft, { action: e.action, tone: e.tone, children: [
|
|
1722
1816
|
/* @__PURE__ */ r(le, { children: t }),
|
|
1723
1817
|
" ",
|
|
1724
1818
|
e.done
|
|
1725
|
-
] }),
|
|
1819
|
+
] }), fs = ({
|
|
1726
1820
|
action: e,
|
|
1727
1821
|
verb: t,
|
|
1728
1822
|
subject: n,
|
|
1729
1823
|
choices: o,
|
|
1730
1824
|
onAnswer: l
|
|
1731
1825
|
}) => /* @__PURE__ */ g(
|
|
1732
|
-
|
|
1826
|
+
ft,
|
|
1733
1827
|
{
|
|
1734
1828
|
action: e,
|
|
1735
1829
|
tone: "info",
|
|
@@ -1751,7 +1845,7 @@ const Nr = (e, t) => {
|
|
|
1751
1845
|
"."
|
|
1752
1846
|
]
|
|
1753
1847
|
}
|
|
1754
|
-
),
|
|
1848
|
+
), ms = [
|
|
1755
1849
|
{
|
|
1756
1850
|
label: "Abandon",
|
|
1757
1851
|
value: "abandoned",
|
|
@@ -1774,7 +1868,7 @@ const Nr = (e, t) => {
|
|
|
1774
1868
|
tone: "success",
|
|
1775
1869
|
done: "purchase completed."
|
|
1776
1870
|
}
|
|
1777
|
-
],
|
|
1871
|
+
], gs = [
|
|
1778
1872
|
{
|
|
1779
1873
|
label: "Nothing",
|
|
1780
1874
|
value: "failed",
|
|
@@ -1790,7 +1884,7 @@ const Nr = (e, t) => {
|
|
|
1790
1884
|
tone: "success",
|
|
1791
1885
|
done: "restored."
|
|
1792
1886
|
}
|
|
1793
|
-
],
|
|
1887
|
+
], bs = [
|
|
1794
1888
|
{
|
|
1795
1889
|
label: "Deny",
|
|
1796
1890
|
value: "denied",
|
|
@@ -1806,7 +1900,7 @@ const Nr = (e, t) => {
|
|
|
1806
1900
|
tone: "success",
|
|
1807
1901
|
done: "granted."
|
|
1808
1902
|
}
|
|
1809
|
-
],
|
|
1903
|
+
], ws = [
|
|
1810
1904
|
{ label: "Fail", value: "failure", action: "request_callback", tone: "warning", done: "failed." },
|
|
1811
1905
|
{
|
|
1812
1906
|
label: "Succeed",
|
|
@@ -1817,31 +1911,31 @@ const Nr = (e, t) => {
|
|
|
1817
1911
|
done: "succeeded."
|
|
1818
1912
|
}
|
|
1819
1913
|
];
|
|
1820
|
-
let
|
|
1821
|
-
const
|
|
1822
|
-
const c = `${e}-${
|
|
1914
|
+
let vs = 0;
|
|
1915
|
+
const Ie = (e, t, n, o) => new Promise((l) => {
|
|
1916
|
+
const c = `${e}-${vs += 1}`;
|
|
1823
1917
|
me.custom(
|
|
1824
1918
|
() => /* @__PURE__ */ r(
|
|
1825
|
-
|
|
1919
|
+
fs,
|
|
1826
1920
|
{
|
|
1827
1921
|
action: e,
|
|
1828
1922
|
verb: t,
|
|
1829
1923
|
subject: n,
|
|
1830
1924
|
choices: o,
|
|
1831
1925
|
onAnswer: (h) => {
|
|
1832
|
-
me.dismiss(c), me.custom(() => /* @__PURE__ */ r(
|
|
1926
|
+
me.dismiss(c), me.custom(() => /* @__PURE__ */ r(ps, { choice: h, subject: n })), l(h.value);
|
|
1833
1927
|
}
|
|
1834
1928
|
}
|
|
1835
1929
|
),
|
|
1836
1930
|
{ id: c, duration: Number.POSITIVE_INFINITY }
|
|
1837
1931
|
);
|
|
1838
|
-
}),
|
|
1932
|
+
}), ys = () => ({
|
|
1839
1933
|
event: (e) => {
|
|
1840
|
-
const t =
|
|
1841
|
-
t && me.custom(() => /* @__PURE__ */ r(
|
|
1934
|
+
const t = cs(e);
|
|
1935
|
+
t && me.custom(() => /* @__PURE__ */ r(hs, { notice: t }));
|
|
1842
1936
|
},
|
|
1843
|
-
purchase: (e) =>
|
|
1844
|
-
restore: () =>
|
|
1937
|
+
purchase: (e) => Ie("purchase", "purchase", e.reference, ms),
|
|
1938
|
+
restore: () => Ie("restore", "restore", "purchases", gs),
|
|
1845
1939
|
close: () => {
|
|
1846
1940
|
},
|
|
1847
1941
|
openUrl: () => {
|
|
@@ -1850,15 +1944,15 @@ const _e = (e, t, n, o) => new Promise((l) => {
|
|
|
1850
1944
|
},
|
|
1851
1945
|
customPlacement: () => {
|
|
1852
1946
|
},
|
|
1853
|
-
permission: (e) =>
|
|
1854
|
-
callback: (e) =>
|
|
1855
|
-
}),
|
|
1947
|
+
permission: (e) => Ie("request_permission", "permission", e, bs),
|
|
1948
|
+
callback: (e) => Ie("request_callback", "callback", e, ws).then((t) => ({ status: t }))
|
|
1949
|
+
}), xs = () => f.useMemo(ys, []), Cs = ({
|
|
1856
1950
|
surfaceKey: e,
|
|
1857
1951
|
raised: t = !1
|
|
1858
1952
|
}) => (f.useEffect(() => {
|
|
1859
1953
|
me.dismiss();
|
|
1860
1954
|
}, [e]), /* @__PURE__ */ r(
|
|
1861
|
-
|
|
1955
|
+
er,
|
|
1862
1956
|
{
|
|
1863
1957
|
position: "top-center",
|
|
1864
1958
|
swipeDirections: ["top"],
|
|
@@ -1868,7 +1962,7 @@ const _e = (e, t, n, o) => new Promise((l) => {
|
|
|
1868
1962
|
style: { zIndex: 5 },
|
|
1869
1963
|
toastOptions: { unstyled: !0, classNames: { toast: "w-full" } }
|
|
1870
1964
|
}
|
|
1871
|
-
)), te = (e) => `${e.project ? `/${e.project}` : ""}/${e.kind}/${e.id}`,
|
|
1965
|
+
)), te = (e) => `${e.project ? `/${e.project}` : ""}/${e.kind}/${e.id}`, mt = (e) => /[?&]transport=editor(?:&|$)/.test(e) ? e : `${e}${e.includes("?") ? "&" : "?"}transport=editor`, Ns = (e) => `/__studio/original${te(e)}`, Ai = (e) => mt(`/preview${te(e)}`), Oi = (e) => (t) => mt(e(t)), Es = async (e, t, n) => {
|
|
1872
1966
|
try {
|
|
1873
1967
|
const o = await fetch("/__studio/action", {
|
|
1874
1968
|
method: "POST",
|
|
@@ -1903,39 +1997,39 @@ const _e = (e, t, n, o) => new Promise((l) => {
|
|
|
1903
1997
|
} catch (o) {
|
|
1904
1998
|
return { ok: !1, error: o instanceof Error ? o.message : String(o) };
|
|
1905
1999
|
}
|
|
1906
|
-
},
|
|
2000
|
+
}, Ss = async (e) => {
|
|
1907
2001
|
try {
|
|
1908
2002
|
return await (await fetch(`/__studio/status${te(e)}`)).json();
|
|
1909
2003
|
} catch (t) {
|
|
1910
2004
|
return { unreachable: t instanceof Error ? t.message : String(t) };
|
|
1911
2005
|
}
|
|
1912
|
-
},
|
|
2006
|
+
}, Ti = {
|
|
1913
2007
|
offered: ["push", "promote", "publish"],
|
|
1914
|
-
run:
|
|
1915
|
-
status:
|
|
1916
|
-
},
|
|
2008
|
+
run: Es,
|
|
2009
|
+
status: Ss
|
|
2010
|
+
}, Ms = async (e) => {
|
|
1917
2011
|
const n = await (await fetch(`/__studio/screenshot${te(e)}`)).json();
|
|
1918
2012
|
if (n.unreachable !== void 0) throw new Error(n.unreachable);
|
|
1919
2013
|
return n.url;
|
|
1920
|
-
},
|
|
2014
|
+
}, ks = async () => {
|
|
1921
2015
|
try {
|
|
1922
2016
|
const t = await (await fetch("/__studio/samples.json")).json();
|
|
1923
2017
|
return typeof t == "object" && t !== null ? t : {};
|
|
1924
2018
|
} catch (e) {
|
|
1925
2019
|
return { unreachable: e instanceof Error ? e.message : String(e) };
|
|
1926
2020
|
}
|
|
1927
|
-
},
|
|
1928
|
-
info:
|
|
2021
|
+
}, Is = {
|
|
2022
|
+
info: hn,
|
|
1929
2023
|
success: Re,
|
|
1930
2024
|
warning: be
|
|
1931
|
-
},
|
|
1932
|
-
me.custom(() => /* @__PURE__ */ r(
|
|
1933
|
-
},
|
|
1934
|
-
const e = f.useContext(
|
|
2025
|
+
}, Ht = (e, { tone: t = "info", description: n } = {}) => {
|
|
2026
|
+
me.custom(() => /* @__PURE__ */ r(Nn, { icon: Is[t], tone: t, description: n, children: e }));
|
|
2027
|
+
}, En = f.createContext(void 0), Sn = () => {
|
|
2028
|
+
const e = f.useContext(En);
|
|
1935
2029
|
if (!e)
|
|
1936
2030
|
throw new Error("Studio components must be rendered inside <StudioHostProvider>.");
|
|
1937
2031
|
return e;
|
|
1938
|
-
},
|
|
2032
|
+
}, _s = ({
|
|
1939
2033
|
mode: e,
|
|
1940
2034
|
home: t,
|
|
1941
2035
|
children: n
|
|
@@ -1944,19 +2038,19 @@ const _e = (e, t, n, o) => new Promise((l) => {
|
|
|
1944
2038
|
() => ({ mode: e, home: { href: o, navigate: l } }),
|
|
1945
2039
|
[e, o, l]
|
|
1946
2040
|
);
|
|
1947
|
-
return /* @__PURE__ */ r(
|
|
1948
|
-
},
|
|
2041
|
+
return /* @__PURE__ */ r(En.Provider, { value: c, children: n });
|
|
2042
|
+
}, gt = () => Sn().mode, Rs = () => Sn().home, Ps = {
|
|
1949
2043
|
checking: "Looking for a screenshot…",
|
|
1950
2044
|
none: "This paywall has no live version yet. Screenshots are captured from the published document, so promote a pushed version before downloading one.",
|
|
1951
2045
|
unreachable: "Couldn’t reach the screenshot service."
|
|
1952
|
-
},
|
|
2046
|
+
}, zt = (e, t) => {
|
|
1953
2047
|
const n = document.createElement("a");
|
|
1954
2048
|
n.href = e, t === void 0 ? (n.target = "_blank", n.rel = "noreferrer") : n.download = t, n.click();
|
|
1955
|
-
},
|
|
2049
|
+
}, Ls = ({
|
|
1956
2050
|
source: e,
|
|
1957
2051
|
surface: t
|
|
1958
2052
|
}) => {
|
|
1959
|
-
const n =
|
|
2053
|
+
const n = gt() === "hosted", [o, l] = f.useState({ status: "checking" }), [c, h] = f.useState(!1), p = n ? e.screenshotUrl : Ms;
|
|
1960
2054
|
f.useEffect(() => {
|
|
1961
2055
|
if (p === void 0) {
|
|
1962
2056
|
l({ status: "none" });
|
|
@@ -1989,9 +2083,9 @@ const _e = (e, t, n, o) => new Promise((l) => {
|
|
|
1989
2083
|
`${n ? "the image host" : "the dev server"} answered ${d.status}`
|
|
1990
2084
|
);
|
|
1991
2085
|
const u = URL.createObjectURL(await d.blob());
|
|
1992
|
-
|
|
2086
|
+
zt(u, `${t.id}.png`), URL.revokeObjectURL(u);
|
|
1993
2087
|
} catch (d) {
|
|
1994
|
-
n ? (
|
|
2088
|
+
n ? (zt(o.url), Ht("Opened the screenshot in a new tab", { description: "Save it from there." })) : Ht("Couldn’t download screenshot", {
|
|
1995
2089
|
tone: "warning",
|
|
1996
2090
|
description: d instanceof Error ? d.message : String(d)
|
|
1997
2091
|
});
|
|
@@ -1999,7 +2093,7 @@ const _e = (e, t, n, o) => new Promise((l) => {
|
|
|
1999
2093
|
h(!1);
|
|
2000
2094
|
}
|
|
2001
2095
|
}
|
|
2002
|
-
}, i = o.status !== "ready" || c, a = c ? void 0 : o.status === "ready" ? "Download screenshot" : o.status === "unreachable" ? o.reason :
|
|
2096
|
+
}, i = o.status !== "ready" || c, a = c ? void 0 : o.status === "ready" ? "Download screenshot" : o.status === "unreachable" ? o.reason : Ps[o.status];
|
|
2003
2097
|
return /* @__PURE__ */ r(we, { hint: a, children: /* @__PURE__ */ r(
|
|
2004
2098
|
"button",
|
|
2005
2099
|
{
|
|
@@ -2011,36 +2105,36 @@ const _e = (e, t, n, o) => new Promise((l) => {
|
|
|
2011
2105
|
onClick: () => {
|
|
2012
2106
|
s();
|
|
2013
2107
|
},
|
|
2014
|
-
children: c ? /* @__PURE__ */ r(
|
|
2108
|
+
children: c ? /* @__PURE__ */ r(Be, {}) : /* @__PURE__ */ r(Hr, {})
|
|
2015
2109
|
}
|
|
2016
2110
|
) });
|
|
2017
2111
|
};
|
|
2018
|
-
var
|
|
2112
|
+
var As = Object.defineProperty, De = Object.getOwnPropertySymbols, Mn = Object.prototype.hasOwnProperty, kn = Object.prototype.propertyIsEnumerable, Ft = (e, t, n) => t in e ? As(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, st = (e, t) => {
|
|
2019
2113
|
for (var n in t || (t = {}))
|
|
2020
|
-
|
|
2021
|
-
if (
|
|
2022
|
-
for (var n of
|
|
2023
|
-
|
|
2114
|
+
Mn.call(t, n) && Ft(e, n, t[n]);
|
|
2115
|
+
if (De)
|
|
2116
|
+
for (var n of De(t))
|
|
2117
|
+
kn.call(t, n) && Ft(e, n, t[n]);
|
|
2024
2118
|
return e;
|
|
2025
|
-
},
|
|
2119
|
+
}, it = (e, t) => {
|
|
2026
2120
|
var n = {};
|
|
2027
2121
|
for (var o in e)
|
|
2028
|
-
|
|
2029
|
-
if (e != null &&
|
|
2030
|
-
for (var o of
|
|
2031
|
-
t.indexOf(o) < 0 &&
|
|
2122
|
+
Mn.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
|
|
2123
|
+
if (e != null && De)
|
|
2124
|
+
for (var o of De(e))
|
|
2125
|
+
t.indexOf(o) < 0 && kn.call(e, o) && (n[o] = e[o]);
|
|
2032
2126
|
return n;
|
|
2033
2127
|
};
|
|
2034
2128
|
var ce;
|
|
2035
2129
|
((e) => {
|
|
2036
|
-
const t = class
|
|
2130
|
+
const t = class I {
|
|
2037
2131
|
/*-- Constructor (low level) and fields --*/
|
|
2038
2132
|
// Creates a new QR Code with the given version number,
|
|
2039
2133
|
// error correction level, data codeword bytes, and mask number.
|
|
2040
2134
|
// This is a low-level API that most users should not use directly.
|
|
2041
2135
|
// A mid-level API is the encodeSegments() function.
|
|
2042
2136
|
constructor(s, i, a, d) {
|
|
2043
|
-
if (this.version = s, this.errorCorrectionLevel = i, this.modules = [], this.isFunction = [], s <
|
|
2137
|
+
if (this.version = s, this.errorCorrectionLevel = i, this.modules = [], this.isFunction = [], s < I.MIN_VERSION || s > I.MAX_VERSION)
|
|
2044
2138
|
throw new RangeError("Version value out of range");
|
|
2045
2139
|
if (d < -1 || d > 7)
|
|
2046
2140
|
throw new RangeError("Mask value out of range");
|
|
@@ -2070,7 +2164,7 @@ var ce;
|
|
|
2070
2164
|
// ecl argument if it can be done without increasing the version.
|
|
2071
2165
|
static encodeText(s, i) {
|
|
2072
2166
|
const a = e.QrSegment.makeSegments(s);
|
|
2073
|
-
return
|
|
2167
|
+
return I.encodeSegments(a, i);
|
|
2074
2168
|
}
|
|
2075
2169
|
// Returns a QR Code representing the given binary data at the given error correction level.
|
|
2076
2170
|
// This function always encodes using the binary segment mode, not any text mode. The maximum number of
|
|
@@ -2078,7 +2172,7 @@ var ce;
|
|
|
2078
2172
|
// The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
|
|
2079
2173
|
static encodeBinary(s, i) {
|
|
2080
2174
|
const a = e.QrSegment.makeBytes(s);
|
|
2081
|
-
return
|
|
2175
|
+
return I.encodeSegments([a], i);
|
|
2082
2176
|
}
|
|
2083
2177
|
/*-- Static factory functions (mid level) --*/
|
|
2084
2178
|
// Returns a QR Code representing the given segments with the given encoding parameters.
|
|
@@ -2091,35 +2185,35 @@ var ce;
|
|
|
2091
2185
|
// between modes (such as alphanumeric and byte) to encode text in less space.
|
|
2092
2186
|
// This is a mid-level API; the high-level API is encodeText() and encodeBinary().
|
|
2093
2187
|
static encodeSegments(s, i, a = 1, d = 40, u = -1, b = !0) {
|
|
2094
|
-
if (!(
|
|
2188
|
+
if (!(I.MIN_VERSION <= a && a <= d && d <= I.MAX_VERSION) || u < -1 || u > 7)
|
|
2095
2189
|
throw new RangeError("Invalid value");
|
|
2096
2190
|
let m, v;
|
|
2097
2191
|
for (m = a; ; m++) {
|
|
2098
|
-
const
|
|
2099
|
-
if (
|
|
2100
|
-
v =
|
|
2192
|
+
const C = I.getNumDataCodewords(m, i) * 8, x = h.getTotalBits(s, m);
|
|
2193
|
+
if (x <= C) {
|
|
2194
|
+
v = x;
|
|
2101
2195
|
break;
|
|
2102
2196
|
}
|
|
2103
2197
|
if (m >= d)
|
|
2104
2198
|
throw new RangeError("Data too long");
|
|
2105
2199
|
}
|
|
2106
|
-
for (const
|
|
2107
|
-
b && v <=
|
|
2200
|
+
for (const C of [I.Ecc.MEDIUM, I.Ecc.QUARTILE, I.Ecc.HIGH])
|
|
2201
|
+
b && v <= I.getNumDataCodewords(m, C) * 8 && (i = C);
|
|
2108
2202
|
let w = [];
|
|
2109
|
-
for (const
|
|
2110
|
-
n(
|
|
2111
|
-
for (const
|
|
2112
|
-
w.push(
|
|
2203
|
+
for (const C of s) {
|
|
2204
|
+
n(C.mode.modeBits, 4, w), n(C.numChars, C.mode.numCharCountBits(m), w);
|
|
2205
|
+
for (const x of C.getData())
|
|
2206
|
+
w.push(x);
|
|
2113
2207
|
}
|
|
2114
2208
|
l(w.length == v);
|
|
2115
|
-
const S =
|
|
2209
|
+
const S = I.getNumDataCodewords(m, i) * 8;
|
|
2116
2210
|
l(w.length <= S), n(0, Math.min(4, S - w.length), w), n(0, (8 - w.length % 8) % 8, w), l(w.length % 8 == 0);
|
|
2117
|
-
for (let
|
|
2118
|
-
n(
|
|
2211
|
+
for (let C = 236; w.length < S; C ^= 253)
|
|
2212
|
+
n(C, 8, w);
|
|
2119
2213
|
let M = [];
|
|
2120
2214
|
for (; M.length * 8 < w.length; )
|
|
2121
2215
|
M.push(0);
|
|
2122
|
-
return w.forEach((
|
|
2216
|
+
return w.forEach((C, x) => M[x >>> 3] |= C << 7 - (x & 7)), new I(m, i, M, u);
|
|
2123
2217
|
}
|
|
2124
2218
|
/*-- Accessor methods --*/
|
|
2125
2219
|
// Returns the color of the module (pixel) at the given coordinates, which is false
|
|
@@ -2205,28 +2299,28 @@ var ce;
|
|
|
2205
2299
|
// codewords appended to it, based on this object's version and error correction level.
|
|
2206
2300
|
addEccAndInterleave(s) {
|
|
2207
2301
|
const i = this.version, a = this.errorCorrectionLevel;
|
|
2208
|
-
if (s.length !=
|
|
2302
|
+
if (s.length != I.getNumDataCodewords(i, a))
|
|
2209
2303
|
throw new RangeError("Invalid argument");
|
|
2210
|
-
const d =
|
|
2304
|
+
const d = I.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][i], u = I.ECC_CODEWORDS_PER_BLOCK[a.ordinal][i], b = Math.floor(I.getNumRawDataModules(i) / 8), m = d - b % d, v = Math.floor(b / d);
|
|
2211
2305
|
let w = [];
|
|
2212
|
-
const S =
|
|
2213
|
-
for (let
|
|
2214
|
-
let
|
|
2215
|
-
|
|
2216
|
-
const N =
|
|
2217
|
-
|
|
2306
|
+
const S = I.reedSolomonComputeDivisor(u);
|
|
2307
|
+
for (let C = 0, x = 0; C < d; C++) {
|
|
2308
|
+
let _ = s.slice(x, x + v - u + (C < m ? 0 : 1));
|
|
2309
|
+
x += _.length;
|
|
2310
|
+
const N = I.reedSolomonComputeRemainder(_, S);
|
|
2311
|
+
C < m && _.push(0), w.push(_.concat(N));
|
|
2218
2312
|
}
|
|
2219
2313
|
let M = [];
|
|
2220
|
-
for (let
|
|
2221
|
-
w.forEach((
|
|
2222
|
-
(
|
|
2314
|
+
for (let C = 0; C < w[0].length; C++)
|
|
2315
|
+
w.forEach((x, _) => {
|
|
2316
|
+
(C != v - u || _ >= m) && M.push(x[C]);
|
|
2223
2317
|
});
|
|
2224
2318
|
return l(M.length == b), M;
|
|
2225
2319
|
}
|
|
2226
2320
|
// Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
|
|
2227
2321
|
// data area of this QR Code. Function modules need to be marked off before this is called.
|
|
2228
2322
|
drawCodewords(s) {
|
|
2229
|
-
if (s.length != Math.floor(
|
|
2323
|
+
if (s.length != Math.floor(I.getNumRawDataModules(this.version) / 8))
|
|
2230
2324
|
throw new RangeError("Invalid argument");
|
|
2231
2325
|
let i = 0;
|
|
2232
2326
|
for (let a = this.size - 1; a >= 1; a -= 2) {
|
|
@@ -2288,25 +2382,25 @@ var ce;
|
|
|
2288
2382
|
for (let u = 0; u < this.size; u++) {
|
|
2289
2383
|
let b = !1, m = 0, v = [0, 0, 0, 0, 0, 0, 0];
|
|
2290
2384
|
for (let w = 0; w < this.size; w++)
|
|
2291
|
-
this.modules[u][w] == b ? (m++, m == 5 ? s +=
|
|
2292
|
-
s += this.finderPenaltyTerminateAndCount(b, m, v) *
|
|
2385
|
+
this.modules[u][w] == b ? (m++, m == 5 ? s += I.PENALTY_N1 : m > 5 && s++) : (this.finderPenaltyAddHistory(m, v), b || (s += this.finderPenaltyCountPatterns(v) * I.PENALTY_N3), b = this.modules[u][w], m = 1);
|
|
2386
|
+
s += this.finderPenaltyTerminateAndCount(b, m, v) * I.PENALTY_N3;
|
|
2293
2387
|
}
|
|
2294
2388
|
for (let u = 0; u < this.size; u++) {
|
|
2295
2389
|
let b = !1, m = 0, v = [0, 0, 0, 0, 0, 0, 0];
|
|
2296
2390
|
for (let w = 0; w < this.size; w++)
|
|
2297
|
-
this.modules[w][u] == b ? (m++, m == 5 ? s +=
|
|
2298
|
-
s += this.finderPenaltyTerminateAndCount(b, m, v) *
|
|
2391
|
+
this.modules[w][u] == b ? (m++, m == 5 ? s += I.PENALTY_N1 : m > 5 && s++) : (this.finderPenaltyAddHistory(m, v), b || (s += this.finderPenaltyCountPatterns(v) * I.PENALTY_N3), b = this.modules[w][u], m = 1);
|
|
2392
|
+
s += this.finderPenaltyTerminateAndCount(b, m, v) * I.PENALTY_N3;
|
|
2299
2393
|
}
|
|
2300
2394
|
for (let u = 0; u < this.size - 1; u++)
|
|
2301
2395
|
for (let b = 0; b < this.size - 1; b++) {
|
|
2302
2396
|
const m = this.modules[u][b];
|
|
2303
|
-
m == this.modules[u][b + 1] && m == this.modules[u + 1][b] && m == this.modules[u + 1][b + 1] && (s +=
|
|
2397
|
+
m == this.modules[u][b + 1] && m == this.modules[u + 1][b] && m == this.modules[u + 1][b + 1] && (s += I.PENALTY_N2);
|
|
2304
2398
|
}
|
|
2305
2399
|
let i = 0;
|
|
2306
2400
|
for (const u of this.modules)
|
|
2307
2401
|
i = u.reduce((b, m) => b + (m ? 1 : 0), i);
|
|
2308
2402
|
const a = this.size * this.size, d = Math.ceil(Math.abs(i * 20 - a * 10) / a) - 1;
|
|
2309
|
-
return l(0 <= d && d <= 9), s += d *
|
|
2403
|
+
return l(0 <= d && d <= 9), s += d * I.PENALTY_N4, l(0 <= s && s <= 2568888), s;
|
|
2310
2404
|
}
|
|
2311
2405
|
/*-- Private helper functions --*/
|
|
2312
2406
|
// Returns an ascending list of positions of alignment patterns for this version number.
|
|
@@ -2327,7 +2421,7 @@ var ce;
|
|
|
2327
2421
|
// all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
|
|
2328
2422
|
// The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
|
|
2329
2423
|
static getNumRawDataModules(s) {
|
|
2330
|
-
if (s <
|
|
2424
|
+
if (s < I.MIN_VERSION || s > I.MAX_VERSION)
|
|
2331
2425
|
throw new RangeError("Version number out of range");
|
|
2332
2426
|
let i = (16 * s + 128) * s + 64;
|
|
2333
2427
|
if (s >= 2) {
|
|
@@ -2340,7 +2434,7 @@ var ce;
|
|
|
2340
2434
|
// QR Code of the given version number and error correction level, with remainder bits discarded.
|
|
2341
2435
|
// This stateless pure function could be implemented as a (40*4)-cell lookup table.
|
|
2342
2436
|
static getNumDataCodewords(s, i) {
|
|
2343
|
-
return Math.floor(
|
|
2437
|
+
return Math.floor(I.getNumRawDataModules(s) / 8) - I.ECC_CODEWORDS_PER_BLOCK[i.ordinal][s] * I.NUM_ERROR_CORRECTION_BLOCKS[i.ordinal][s];
|
|
2344
2438
|
}
|
|
2345
2439
|
// Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
|
|
2346
2440
|
// implemented as a lookup table over all possible parameter values, instead of as an algorithm.
|
|
@@ -2354,8 +2448,8 @@ var ce;
|
|
|
2354
2448
|
let a = 1;
|
|
2355
2449
|
for (let d = 0; d < s; d++) {
|
|
2356
2450
|
for (let u = 0; u < i.length; u++)
|
|
2357
|
-
i[u] =
|
|
2358
|
-
a =
|
|
2451
|
+
i[u] = I.reedSolomonMultiply(i[u], a), u + 1 < i.length && (i[u] ^= i[u + 1]);
|
|
2452
|
+
a = I.reedSolomonMultiply(a, 2);
|
|
2359
2453
|
}
|
|
2360
2454
|
return i;
|
|
2361
2455
|
}
|
|
@@ -2364,7 +2458,7 @@ var ce;
|
|
|
2364
2458
|
let a = i.map((d) => 0);
|
|
2365
2459
|
for (const d of s) {
|
|
2366
2460
|
const u = d ^ a.shift();
|
|
2367
|
-
a.push(0), i.forEach((b, m) => a[m] ^=
|
|
2461
|
+
a.push(0), i.forEach((b, m) => a[m] ^= I.reedSolomonMultiply(b, u));
|
|
2368
2462
|
}
|
|
2369
2463
|
return a;
|
|
2370
2464
|
}
|
|
@@ -2431,7 +2525,7 @@ var ce;
|
|
|
2431
2525
|
if (!p)
|
|
2432
2526
|
throw new Error("Assertion error");
|
|
2433
2527
|
}
|
|
2434
|
-
const c = class
|
|
2528
|
+
const c = class T {
|
|
2435
2529
|
/*-- Constructor (low level) and fields --*/
|
|
2436
2530
|
// Creates a new QR Code segment with the given attributes and data.
|
|
2437
2531
|
// The character count (numChars) must agree with the mode and the bit buffer length,
|
|
@@ -2449,36 +2543,36 @@ var ce;
|
|
|
2449
2543
|
let i = [];
|
|
2450
2544
|
for (const a of s)
|
|
2451
2545
|
n(a, 8, i);
|
|
2452
|
-
return new
|
|
2546
|
+
return new T(T.Mode.BYTE, s.length, i);
|
|
2453
2547
|
}
|
|
2454
2548
|
// Returns a segment representing the given string of decimal digits encoded in numeric mode.
|
|
2455
2549
|
static makeNumeric(s) {
|
|
2456
|
-
if (!
|
|
2550
|
+
if (!T.isNumeric(s))
|
|
2457
2551
|
throw new RangeError("String contains non-numeric characters");
|
|
2458
2552
|
let i = [];
|
|
2459
2553
|
for (let a = 0; a < s.length; ) {
|
|
2460
2554
|
const d = Math.min(s.length - a, 3);
|
|
2461
2555
|
n(parseInt(s.substring(a, a + d), 10), d * 3 + 1, i), a += d;
|
|
2462
2556
|
}
|
|
2463
|
-
return new
|
|
2557
|
+
return new T(T.Mode.NUMERIC, s.length, i);
|
|
2464
2558
|
}
|
|
2465
2559
|
// Returns a segment representing the given text string encoded in alphanumeric mode.
|
|
2466
2560
|
// The characters allowed are: 0 to 9, A to Z (uppercase only), space,
|
|
2467
2561
|
// dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
|
2468
2562
|
static makeAlphanumeric(s) {
|
|
2469
|
-
if (!
|
|
2563
|
+
if (!T.isAlphanumeric(s))
|
|
2470
2564
|
throw new RangeError("String contains unencodable characters in alphanumeric mode");
|
|
2471
2565
|
let i = [], a;
|
|
2472
2566
|
for (a = 0; a + 2 <= s.length; a += 2) {
|
|
2473
|
-
let d =
|
|
2474
|
-
d +=
|
|
2567
|
+
let d = T.ALPHANUMERIC_CHARSET.indexOf(s.charAt(a)) * 45;
|
|
2568
|
+
d += T.ALPHANUMERIC_CHARSET.indexOf(s.charAt(a + 1)), n(d, 11, i);
|
|
2475
2569
|
}
|
|
2476
|
-
return a < s.length && n(
|
|
2570
|
+
return a < s.length && n(T.ALPHANUMERIC_CHARSET.indexOf(s.charAt(a)), 6, i), new T(T.Mode.ALPHANUMERIC, s.length, i);
|
|
2477
2571
|
}
|
|
2478
2572
|
// Returns a new mutable list of zero or more segments to represent the given Unicode text string.
|
|
2479
2573
|
// The result may use various segment modes and switch modes to optimize the length of the bit stream.
|
|
2480
2574
|
static makeSegments(s) {
|
|
2481
|
-
return s == "" ? [] :
|
|
2575
|
+
return s == "" ? [] : T.isNumeric(s) ? [T.makeNumeric(s)] : T.isAlphanumeric(s) ? [T.makeAlphanumeric(s)] : [T.makeBytes(T.toUtf8ByteArray(s))];
|
|
2482
2576
|
}
|
|
2483
2577
|
// Returns a segment representing an Extended Channel Interpretation
|
|
2484
2578
|
// (ECI) designator with the given assignment value.
|
|
@@ -2494,18 +2588,18 @@ var ce;
|
|
|
2494
2588
|
n(6, 3, i), n(s, 21, i);
|
|
2495
2589
|
else
|
|
2496
2590
|
throw new RangeError("ECI assignment value out of range");
|
|
2497
|
-
return new
|
|
2591
|
+
return new T(T.Mode.ECI, 0, i);
|
|
2498
2592
|
}
|
|
2499
2593
|
// Tests whether the given string can be encoded as a segment in numeric mode.
|
|
2500
2594
|
// A string is encodable iff each character is in the range 0 to 9.
|
|
2501
2595
|
static isNumeric(s) {
|
|
2502
|
-
return
|
|
2596
|
+
return T.NUMERIC_REGEX.test(s);
|
|
2503
2597
|
}
|
|
2504
2598
|
// Tests whether the given string can be encoded as a segment in alphanumeric mode.
|
|
2505
2599
|
// A string is encodable iff each character is in the following set: 0 to 9, A to Z
|
|
2506
2600
|
// (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
|
2507
2601
|
static isAlphanumeric(s) {
|
|
2508
|
-
return
|
|
2602
|
+
return T.ALPHANUMERIC_REGEX.test(s);
|
|
2509
2603
|
}
|
|
2510
2604
|
/*-- Methods --*/
|
|
2511
2605
|
// Returns a new copy of the data bits of this segment.
|
|
@@ -2567,13 +2661,13 @@ var ce;
|
|
|
2567
2661
|
})(e.QrSegment || (e.QrSegment = {}));
|
|
2568
2662
|
})(ce || (ce = {}));
|
|
2569
2663
|
var fe = ce;
|
|
2570
|
-
var
|
|
2664
|
+
var Os = {
|
|
2571
2665
|
L: fe.QrCode.Ecc.LOW,
|
|
2572
2666
|
M: fe.QrCode.Ecc.MEDIUM,
|
|
2573
2667
|
Q: fe.QrCode.Ecc.QUARTILE,
|
|
2574
2668
|
H: fe.QrCode.Ecc.HIGH
|
|
2575
|
-
},
|
|
2576
|
-
function
|
|
2669
|
+
}, In = 128, _n = "L", Rn = "#FFFFFF", Pn = "#000000", Ln = !1, An = 1, Ts = 4, $s = 0, Ds = 0.1;
|
|
2670
|
+
function On(e, t = 0) {
|
|
2577
2671
|
const n = [];
|
|
2578
2672
|
return e.forEach(function(o, l) {
|
|
2579
2673
|
let c = null;
|
|
@@ -2596,13 +2690,13 @@ function Pn(e, t = 0) {
|
|
|
2596
2690
|
});
|
|
2597
2691
|
}), n.join("");
|
|
2598
2692
|
}
|
|
2599
|
-
function
|
|
2693
|
+
function Tn(e, t) {
|
|
2600
2694
|
return e.slice().map((n, o) => o < t.y || o >= t.y + t.h ? n : n.map((l, c) => c < t.x || c >= t.x + t.w ? l : !1));
|
|
2601
2695
|
}
|
|
2602
|
-
function
|
|
2696
|
+
function Hs(e, t, n, o) {
|
|
2603
2697
|
if (o == null)
|
|
2604
2698
|
return null;
|
|
2605
|
-
const l = e.length + n * 2, c = Math.floor(t *
|
|
2699
|
+
const l = e.length + n * 2, c = Math.floor(t * Ds), h = l / t, p = (o.width || c) * h, s = (o.height || c) * h, i = o.x == null ? e.length / 2 - p / 2 : o.x * h, a = o.y == null ? e.length / 2 - s / 2 : o.y * h, d = o.opacity == null ? 1 : o.opacity;
|
|
2606
2700
|
let u = null;
|
|
2607
2701
|
if (o.excavate) {
|
|
2608
2702
|
let m = Math.floor(i), v = Math.floor(a), w = Math.ceil(p + i - m), S = Math.ceil(s + a - v);
|
|
@@ -2611,10 +2705,10 @@ function Os(e, t, n, o) {
|
|
|
2611
2705
|
const b = o.crossOrigin;
|
|
2612
2706
|
return { x: i, y: a, h: s, w: p, excavation: u, opacity: d, crossOrigin: b };
|
|
2613
2707
|
}
|
|
2614
|
-
function
|
|
2615
|
-
return t != null ? Math.max(Math.floor(t), 0) : e ?
|
|
2708
|
+
function zs(e, t) {
|
|
2709
|
+
return t != null ? Math.max(Math.floor(t), 0) : e ? Ts : $s;
|
|
2616
2710
|
}
|
|
2617
|
-
function
|
|
2711
|
+
function $n({
|
|
2618
2712
|
value: e,
|
|
2619
2713
|
level: t,
|
|
2620
2714
|
minVersion: n,
|
|
@@ -2624,20 +2718,20 @@ function An({
|
|
|
2624
2718
|
size: h,
|
|
2625
2719
|
boostLevel: p
|
|
2626
2720
|
}) {
|
|
2627
|
-
let s =
|
|
2721
|
+
let s = U.useMemo(() => {
|
|
2628
2722
|
const m = (Array.isArray(e) ? e : [e]).reduce((v, w) => (v.push(...fe.QrSegment.makeSegments(w)), v), []);
|
|
2629
2723
|
return fe.QrCode.encodeSegments(
|
|
2630
2724
|
m,
|
|
2631
|
-
|
|
2725
|
+
Os[t],
|
|
2632
2726
|
n,
|
|
2633
2727
|
void 0,
|
|
2634
2728
|
void 0,
|
|
2635
2729
|
p
|
|
2636
2730
|
);
|
|
2637
2731
|
}, [e, t, n, p]);
|
|
2638
|
-
const { cells: i, margin: a, numCells: d, calculatedImageSettings: u } =
|
|
2732
|
+
const { cells: i, margin: a, numCells: d, calculatedImageSettings: u } = U.useMemo(() => {
|
|
2639
2733
|
let b = s.getModules();
|
|
2640
|
-
const m =
|
|
2734
|
+
const m = zs(o, l), v = b.length + m * 2, w = Hs(
|
|
2641
2735
|
b,
|
|
2642
2736
|
h,
|
|
2643
2737
|
m,
|
|
@@ -2658,27 +2752,27 @@ function An({
|
|
|
2658
2752
|
calculatedImageSettings: u
|
|
2659
2753
|
};
|
|
2660
2754
|
}
|
|
2661
|
-
var
|
|
2755
|
+
var Fs = (function() {
|
|
2662
2756
|
try {
|
|
2663
2757
|
new Path2D().addPath(new Path2D());
|
|
2664
2758
|
} catch {
|
|
2665
2759
|
return !1;
|
|
2666
2760
|
}
|
|
2667
2761
|
return !0;
|
|
2668
|
-
})(),
|
|
2762
|
+
})(), Us = U.forwardRef(
|
|
2669
2763
|
function(t, n) {
|
|
2670
2764
|
const o = t, {
|
|
2671
2765
|
value: l,
|
|
2672
|
-
size: c =
|
|
2673
|
-
level: h =
|
|
2674
|
-
bgColor: p =
|
|
2675
|
-
fgColor: s =
|
|
2676
|
-
includeMargin: i =
|
|
2677
|
-
minVersion: a =
|
|
2766
|
+
size: c = In,
|
|
2767
|
+
level: h = _n,
|
|
2768
|
+
bgColor: p = Rn,
|
|
2769
|
+
fgColor: s = Pn,
|
|
2770
|
+
includeMargin: i = Ln,
|
|
2771
|
+
minVersion: a = An,
|
|
2678
2772
|
boostLevel: d,
|
|
2679
2773
|
marginSize: u,
|
|
2680
2774
|
imageSettings: b
|
|
2681
|
-
} = o, v =
|
|
2775
|
+
} = o, v = it(o, [
|
|
2682
2776
|
"value",
|
|
2683
2777
|
"size",
|
|
2684
2778
|
"level",
|
|
@@ -2689,12 +2783,12 @@ var $s = (function() {
|
|
|
2689
2783
|
"boostLevel",
|
|
2690
2784
|
"marginSize",
|
|
2691
2785
|
"imageSettings"
|
|
2692
|
-
]), { style: w } = v, S =
|
|
2693
|
-
(
|
|
2694
|
-
|
|
2786
|
+
]), { style: w } = v, S = it(v, ["style"]), M = b?.src, C = U.useRef(null), x = U.useRef(null), _ = U.useCallback(
|
|
2787
|
+
(j) => {
|
|
2788
|
+
C.current = j, typeof n == "function" ? n(j) : n && (n.current = j);
|
|
2695
2789
|
},
|
|
2696
2790
|
[n]
|
|
2697
|
-
), [N,
|
|
2791
|
+
), [N, A] = U.useState(!1), { margin: L, cells: K, numCells: R, calculatedImageSettings: z } = $n({
|
|
2698
2792
|
value: l,
|
|
2699
2793
|
level: h,
|
|
2700
2794
|
minVersion: a,
|
|
@@ -2704,77 +2798,77 @@ var $s = (function() {
|
|
|
2704
2798
|
imageSettings: b,
|
|
2705
2799
|
size: c
|
|
2706
2800
|
});
|
|
2707
|
-
|
|
2708
|
-
if (
|
|
2709
|
-
const
|
|
2710
|
-
if (!
|
|
2801
|
+
U.useEffect(() => {
|
|
2802
|
+
if (C.current != null) {
|
|
2803
|
+
const j = C.current, Q = j.getContext("2d");
|
|
2804
|
+
if (!Q)
|
|
2711
2805
|
return;
|
|
2712
|
-
let
|
|
2713
|
-
const E =
|
|
2714
|
-
k &&
|
|
2806
|
+
let G = K;
|
|
2807
|
+
const E = x.current, k = z != null && E !== null && E.complete && E.naturalHeight !== 0 && E.naturalWidth !== 0;
|
|
2808
|
+
k && z.excavation != null && (G = Tn(
|
|
2715
2809
|
K,
|
|
2716
|
-
|
|
2810
|
+
z.excavation
|
|
2717
2811
|
));
|
|
2718
|
-
const
|
|
2719
|
-
|
|
2720
|
-
const
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2812
|
+
const $ = window.devicePixelRatio || 1;
|
|
2813
|
+
j.height = j.width = c * $;
|
|
2814
|
+
const F = c / R * $;
|
|
2815
|
+
Q.scale(F, F), Q.fillStyle = p, Q.fillRect(0, 0, R, R), Q.fillStyle = s, Fs ? Q.fill(new Path2D(On(G, L))) : K.forEach(function(D, W) {
|
|
2816
|
+
D.forEach(function(V, re) {
|
|
2817
|
+
V && Q.fillRect(re + L, W + L, 1, 1);
|
|
2724
2818
|
});
|
|
2725
|
-
}),
|
|
2819
|
+
}), z && (Q.globalAlpha = z.opacity), k && Q.drawImage(
|
|
2726
2820
|
E,
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2821
|
+
z.x + L,
|
|
2822
|
+
z.y + L,
|
|
2823
|
+
z.w,
|
|
2824
|
+
z.h
|
|
2731
2825
|
);
|
|
2732
2826
|
}
|
|
2733
|
-
}),
|
|
2734
|
-
|
|
2827
|
+
}), U.useEffect(() => {
|
|
2828
|
+
A(!1);
|
|
2735
2829
|
}, [M]);
|
|
2736
|
-
const se =
|
|
2830
|
+
const se = st({ height: c, width: c }, w);
|
|
2737
2831
|
let de = null;
|
|
2738
|
-
return M != null && (de = /* @__PURE__ */
|
|
2832
|
+
return M != null && (de = /* @__PURE__ */ U.createElement(
|
|
2739
2833
|
"img",
|
|
2740
2834
|
{
|
|
2741
2835
|
src: M,
|
|
2742
2836
|
key: M,
|
|
2743
2837
|
style: { display: "none" },
|
|
2744
2838
|
onLoad: () => {
|
|
2745
|
-
|
|
2839
|
+
A(!0);
|
|
2746
2840
|
},
|
|
2747
|
-
ref:
|
|
2748
|
-
crossOrigin:
|
|
2841
|
+
ref: x,
|
|
2842
|
+
crossOrigin: z?.crossOrigin
|
|
2749
2843
|
}
|
|
2750
|
-
)), /* @__PURE__ */
|
|
2844
|
+
)), /* @__PURE__ */ U.createElement(U.Fragment, null, /* @__PURE__ */ U.createElement(
|
|
2751
2845
|
"canvas",
|
|
2752
|
-
|
|
2846
|
+
st({
|
|
2753
2847
|
style: se,
|
|
2754
2848
|
height: c,
|
|
2755
2849
|
width: c,
|
|
2756
|
-
ref:
|
|
2850
|
+
ref: _,
|
|
2757
2851
|
role: "img"
|
|
2758
2852
|
}, S)
|
|
2759
2853
|
), de);
|
|
2760
2854
|
}
|
|
2761
2855
|
);
|
|
2762
|
-
|
|
2763
|
-
var
|
|
2856
|
+
Us.displayName = "QRCodeCanvas";
|
|
2857
|
+
var Dn = U.forwardRef(
|
|
2764
2858
|
function(t, n) {
|
|
2765
2859
|
const o = t, {
|
|
2766
2860
|
value: l,
|
|
2767
|
-
size: c =
|
|
2768
|
-
level: h =
|
|
2769
|
-
bgColor: p =
|
|
2770
|
-
fgColor: s =
|
|
2771
|
-
includeMargin: i =
|
|
2772
|
-
minVersion: a =
|
|
2861
|
+
size: c = In,
|
|
2862
|
+
level: h = _n,
|
|
2863
|
+
bgColor: p = Rn,
|
|
2864
|
+
fgColor: s = Pn,
|
|
2865
|
+
includeMargin: i = Ln,
|
|
2866
|
+
minVersion: a = An,
|
|
2773
2867
|
boostLevel: d,
|
|
2774
2868
|
title: u,
|
|
2775
2869
|
marginSize: b,
|
|
2776
2870
|
imageSettings: m
|
|
2777
|
-
} = o, v =
|
|
2871
|
+
} = o, v = it(o, [
|
|
2778
2872
|
"value",
|
|
2779
2873
|
"size",
|
|
2780
2874
|
"level",
|
|
@@ -2786,7 +2880,7 @@ var On = F.forwardRef(
|
|
|
2786
2880
|
"title",
|
|
2787
2881
|
"marginSize",
|
|
2788
2882
|
"imageSettings"
|
|
2789
|
-
]), { margin: w, cells: S, numCells: M, calculatedImageSettings:
|
|
2883
|
+
]), { margin: w, cells: S, numCells: M, calculatedImageSettings: C } = $n({
|
|
2790
2884
|
value: l,
|
|
2791
2885
|
level: h,
|
|
2792
2886
|
minVersion: a,
|
|
@@ -2796,35 +2890,35 @@ var On = F.forwardRef(
|
|
|
2796
2890
|
imageSettings: m,
|
|
2797
2891
|
size: c
|
|
2798
2892
|
});
|
|
2799
|
-
let
|
|
2800
|
-
m != null &&
|
|
2893
|
+
let x = S, _ = null;
|
|
2894
|
+
m != null && C != null && (C.excavation != null && (x = Tn(
|
|
2801
2895
|
S,
|
|
2802
|
-
|
|
2803
|
-
)),
|
|
2896
|
+
C.excavation
|
|
2897
|
+
)), _ = /* @__PURE__ */ U.createElement(
|
|
2804
2898
|
"image",
|
|
2805
2899
|
{
|
|
2806
2900
|
href: m.src,
|
|
2807
|
-
height:
|
|
2808
|
-
width:
|
|
2809
|
-
x:
|
|
2810
|
-
y:
|
|
2901
|
+
height: C.h,
|
|
2902
|
+
width: C.w,
|
|
2903
|
+
x: C.x + w,
|
|
2904
|
+
y: C.y + w,
|
|
2811
2905
|
preserveAspectRatio: "none",
|
|
2812
|
-
opacity:
|
|
2813
|
-
crossOrigin:
|
|
2906
|
+
opacity: C.opacity,
|
|
2907
|
+
crossOrigin: C.crossOrigin
|
|
2814
2908
|
}
|
|
2815
2909
|
));
|
|
2816
|
-
const N =
|
|
2817
|
-
return /* @__PURE__ */
|
|
2910
|
+
const N = On(x, w);
|
|
2911
|
+
return /* @__PURE__ */ U.createElement(
|
|
2818
2912
|
"svg",
|
|
2819
|
-
|
|
2913
|
+
st({
|
|
2820
2914
|
height: c,
|
|
2821
2915
|
width: c,
|
|
2822
2916
|
viewBox: `0 0 ${M} ${M}`,
|
|
2823
2917
|
ref: n,
|
|
2824
2918
|
role: "img"
|
|
2825
2919
|
}, v),
|
|
2826
|
-
!!u && /* @__PURE__ */
|
|
2827
|
-
/* @__PURE__ */
|
|
2920
|
+
!!u && /* @__PURE__ */ U.createElement("title", null, u),
|
|
2921
|
+
/* @__PURE__ */ U.createElement(
|
|
2828
2922
|
"path",
|
|
2829
2923
|
{
|
|
2830
2924
|
fill: p,
|
|
@@ -2832,35 +2926,35 @@ var On = F.forwardRef(
|
|
|
2832
2926
|
shapeRendering: "crispEdges"
|
|
2833
2927
|
}
|
|
2834
2928
|
),
|
|
2835
|
-
/* @__PURE__ */
|
|
2836
|
-
|
|
2929
|
+
/* @__PURE__ */ U.createElement("path", { fill: s, d: N, shapeRendering: "crispEdges" }),
|
|
2930
|
+
_
|
|
2837
2931
|
);
|
|
2838
2932
|
}
|
|
2839
2933
|
);
|
|
2840
|
-
|
|
2841
|
-
const
|
|
2934
|
+
Dn.displayName = "QRCodeSVG";
|
|
2935
|
+
const Hn = "superwall-device-scheme", zn = () => {
|
|
2842
2936
|
try {
|
|
2843
|
-
return window.localStorage.getItem(
|
|
2937
|
+
return window.localStorage.getItem(Hn) ?? void 0;
|
|
2844
2938
|
} catch {
|
|
2845
2939
|
return;
|
|
2846
2940
|
}
|
|
2847
|
-
},
|
|
2941
|
+
}, Fn = (e) => {
|
|
2848
2942
|
try {
|
|
2849
|
-
window.localStorage.setItem(
|
|
2943
|
+
window.localStorage.setItem(Hn, e);
|
|
2850
2944
|
} catch {
|
|
2851
2945
|
}
|
|
2852
|
-
},
|
|
2946
|
+
}, at = (e, t, n) => {
|
|
2853
2947
|
const o = n === void 0 ? "" : `&superwall_dev_surface=${encodeURIComponent(n)}`;
|
|
2854
2948
|
return `${e}://?superwall_dev=${encodeURIComponent(t)}${o}`;
|
|
2855
|
-
},
|
|
2949
|
+
}, Bs = (e) => {
|
|
2856
2950
|
const n = window.prompt("Your app’s URL scheme, so this can open it:", e)?.trim();
|
|
2857
2951
|
if (!(n === void 0 || n === ""))
|
|
2858
|
-
return
|
|
2859
|
-
},
|
|
2952
|
+
return Fn(n), n;
|
|
2953
|
+
}, Vs = ({
|
|
2860
2954
|
source: e,
|
|
2861
2955
|
surface: t
|
|
2862
2956
|
}) => {
|
|
2863
|
-
const n =
|
|
2957
|
+
const n = gt() === "hosted", [o, l] = f.useState(!1), [c, h] = f.useState(() => zn() ?? e.scheme), [p, s] = f.useState({ status: "loading" });
|
|
2864
2958
|
return f.useEffect(() => {
|
|
2865
2959
|
if (o) {
|
|
2866
2960
|
if (n) {
|
|
@@ -2887,10 +2981,10 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
2887
2981
|
}
|
|
2888
2982
|
s({
|
|
2889
2983
|
status: "ready",
|
|
2890
|
-
url:
|
|
2984
|
+
url: at(c, e.networkOrigin ?? window.location.origin, t.id)
|
|
2891
2985
|
});
|
|
2892
2986
|
}
|
|
2893
|
-
}, [o, n, c, e, t]), /* @__PURE__ */ g(
|
|
2987
|
+
}, [o, n, c, e, t]), /* @__PURE__ */ g(Z, { children: [
|
|
2894
2988
|
/* @__PURE__ */ g(
|
|
2895
2989
|
"button",
|
|
2896
2990
|
{
|
|
@@ -2899,55 +2993,54 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
2899
2993
|
"aria-label": "Preview",
|
|
2900
2994
|
onClick: () => l(!0),
|
|
2901
2995
|
children: [
|
|
2902
|
-
/* @__PURE__ */ r(
|
|
2996
|
+
/* @__PURE__ */ r(Zr, {}),
|
|
2903
2997
|
/* @__PURE__ */ r("span", { className: "max-sm:hidden", children: "Preview" })
|
|
2904
2998
|
]
|
|
2905
2999
|
}
|
|
2906
3000
|
),
|
|
2907
3001
|
o && /* @__PURE__ */ r(
|
|
2908
|
-
|
|
3002
|
+
Cn,
|
|
2909
3003
|
{
|
|
2910
3004
|
title: "Preview on a device",
|
|
2911
3005
|
description: n ? "Scan with the device that has your app installed. It opens the live paywall in the SDK’s debugger." : "Scan with the device that has your app installed. It opens this paywall against this machine’s dev server.",
|
|
2912
3006
|
onClose: () => l(!1),
|
|
2913
|
-
footer: /* @__PURE__ */ g(
|
|
3007
|
+
footer: /* @__PURE__ */ g(Z, { children: [
|
|
2914
3008
|
!n && /* @__PURE__ */ r(
|
|
2915
3009
|
"button",
|
|
2916
3010
|
{
|
|
2917
3011
|
className: "sw-btn",
|
|
2918
3012
|
type: "button",
|
|
2919
3013
|
onClick: () => {
|
|
2920
|
-
const i =
|
|
3014
|
+
const i = Bs(c ?? "");
|
|
2921
3015
|
i !== void 0 && h(i);
|
|
2922
3016
|
},
|
|
2923
3017
|
children: c === void 0 ? "Set URL scheme" : "Edit URL scheme"
|
|
2924
3018
|
}
|
|
2925
3019
|
),
|
|
2926
|
-
/* @__PURE__ */ r("button", { className: "sw-btn", type: "button", onClick: () => l(!1), children: "Done" }),
|
|
2927
3020
|
p.status === "ready" && /* @__PURE__ */ g(
|
|
2928
3021
|
"a",
|
|
2929
3022
|
{
|
|
2930
|
-
className: "sw-btn sw-btn--primary",
|
|
3023
|
+
className: "sw-btn sw-btn--primary sm:ml-auto",
|
|
2931
3024
|
href: p.url,
|
|
2932
3025
|
...n ? { target: "_blank", rel: "noreferrer" } : {},
|
|
2933
3026
|
children: [
|
|
2934
|
-
/* @__PURE__ */ r(
|
|
3027
|
+
/* @__PURE__ */ r(Ce, {}),
|
|
2935
3028
|
n ? "Open preview" : "Open in app"
|
|
2936
3029
|
]
|
|
2937
3030
|
}
|
|
2938
3031
|
)
|
|
2939
3032
|
] }),
|
|
2940
|
-
children: /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-3 py-2", children: p.status === "ready" ? /* @__PURE__ */ g(
|
|
2941
|
-
/* @__PURE__ */ r("div", { className: "rounded-sm bg-foreground p-3", children: /* @__PURE__ */ r(
|
|
3033
|
+
children: /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-3 py-2", children: p.status === "ready" ? /* @__PURE__ */ g(Z, { children: [
|
|
3034
|
+
/* @__PURE__ */ r("div", { className: "rounded-sm bg-foreground p-3", children: /* @__PURE__ */ r(Dn, { value: p.url, size: 192 }) }),
|
|
2942
3035
|
!n && /* @__PURE__ */ r("span", { className: "max-w-full text-center text-xs break-all text-fg-tertiary", children: p.url })
|
|
2943
|
-
] }) : /* @__PURE__ */ r("div", { className: "flex size-54 flex-none flex-col items-center justify-center gap-2 rounded-sm border border-border bg-card px-6 text-center text-xs text-fg-tertiary", children: p.status === "loading" ? /* @__PURE__ */ g(
|
|
2944
|
-
/* @__PURE__ */ r(
|
|
3036
|
+
] }) : /* @__PURE__ */ r("div", { className: "flex size-54 flex-none flex-col items-center justify-center gap-2 rounded-sm border border-border bg-card px-6 text-center text-xs text-fg-tertiary", children: p.status === "loading" ? /* @__PURE__ */ g(Z, { children: [
|
|
3037
|
+
/* @__PURE__ */ r(Be, {}),
|
|
2945
3038
|
"Building a link…"
|
|
2946
3039
|
] }) : p.reason }) })
|
|
2947
3040
|
}
|
|
2948
3041
|
)
|
|
2949
3042
|
] });
|
|
2950
|
-
},
|
|
3043
|
+
}, Un = f.createContext("default"), js = ({
|
|
2951
3044
|
value: e,
|
|
2952
3045
|
options: t,
|
|
2953
3046
|
onChange: n,
|
|
@@ -2960,7 +3053,7 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
2960
3053
|
}, [e, t]), /* @__PURE__ */ r(
|
|
2961
3054
|
"div",
|
|
2962
3055
|
{
|
|
2963
|
-
className: "flex h-8 flex-none rounded-
|
|
3056
|
+
className: "flex h-8 flex-none rounded-sm border border-border p-0.5",
|
|
2964
3057
|
role: "group",
|
|
2965
3058
|
"aria-label": o,
|
|
2966
3059
|
children: /* @__PURE__ */ g("div", { className: "relative flex gap-0.5", children: [
|
|
@@ -2968,7 +3061,7 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
2968
3061
|
"span",
|
|
2969
3062
|
{
|
|
2970
3063
|
"aria-hidden": "true",
|
|
2971
|
-
className: "pointer-events-none absolute inset-y-0 rounded-
|
|
3064
|
+
className: "pointer-events-none absolute inset-y-0 rounded-[1px] bg-primary/10 transition-[left,width] duration-move ease-out motion-reduce:transition-none",
|
|
2972
3065
|
style: c
|
|
2973
3066
|
}
|
|
2974
3067
|
),
|
|
@@ -2983,7 +3076,7 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
2983
3076
|
type: "button",
|
|
2984
3077
|
"aria-pressed": s,
|
|
2985
3078
|
"aria-label": p.name,
|
|
2986
|
-
className: `relative z-10 flex h-6.5 min-w-6.5 items-center justify-center gap-2 rounded-
|
|
3079
|
+
className: `relative z-10 flex h-6.5 min-w-6.5 items-center justify-center gap-2 rounded-[1px] border border-transparent px-[calc(--spacing(2.5)-1px)] text-sm whitespace-nowrap transition-colors duration-hover focus-visible:border-primary ${s ? "text-primary" : "text-fg-tertiary hover:text-foreground [&:not(:hover)>svg]:icon-tertiary"}`,
|
|
2987
3080
|
onClick: () => n(p.value),
|
|
2988
3081
|
children: p.label
|
|
2989
3082
|
},
|
|
@@ -2993,14 +3086,14 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
2993
3086
|
] })
|
|
2994
3087
|
}
|
|
2995
3088
|
);
|
|
2996
|
-
},
|
|
3089
|
+
}, Ut = ({
|
|
2997
3090
|
value: e,
|
|
2998
3091
|
options: t,
|
|
2999
3092
|
onChange: n,
|
|
3000
3093
|
label: o,
|
|
3001
3094
|
size: l
|
|
3002
3095
|
}) => {
|
|
3003
|
-
const c = f.useContext(
|
|
3096
|
+
const c = f.useContext(Un), h = (l ?? c) === "sm";
|
|
3004
3097
|
return /* @__PURE__ */ g("span", { className: "relative inline-flex flex-none", children: [
|
|
3005
3098
|
/* @__PURE__ */ r(
|
|
3006
3099
|
"select",
|
|
@@ -3013,13 +3106,13 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3013
3106
|
}
|
|
3014
3107
|
),
|
|
3015
3108
|
/* @__PURE__ */ r(
|
|
3016
|
-
|
|
3109
|
+
un,
|
|
3017
3110
|
{
|
|
3018
3111
|
className: `icon-tertiary pointer-events-none absolute top-1/2 -translate-y-1/2 ${h ? "right-[calc(--spacing(2.5)-1px)]" : "right-[calc(--spacing(3)-1px)]"}`
|
|
3019
3112
|
}
|
|
3020
3113
|
)
|
|
3021
3114
|
] });
|
|
3022
|
-
},
|
|
3115
|
+
}, Bn = ({
|
|
3023
3116
|
checked: e,
|
|
3024
3117
|
onChange: t,
|
|
3025
3118
|
label: n
|
|
@@ -3040,19 +3133,19 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3040
3133
|
}
|
|
3041
3134
|
)
|
|
3042
3135
|
}
|
|
3043
|
-
),
|
|
3136
|
+
), Ws = {
|
|
3044
3137
|
outline: "border-border text-fg-tertiary",
|
|
3045
3138
|
success: "border-transparent bg-success/16 text-success-foreground"
|
|
3046
|
-
},
|
|
3139
|
+
}, Ys = ({
|
|
3047
3140
|
variant: e,
|
|
3048
3141
|
children: t
|
|
3049
3142
|
}) => /* @__PURE__ */ r(
|
|
3050
3143
|
"span",
|
|
3051
3144
|
{
|
|
3052
|
-
className: `inline-flex h-5 min-w-5 flex-none items-center justify-center rounded-sm border px-[calc(--spacing(1.5)-1px)] text-[0.75rem]/4 font-medium tabular-nums whitespace-nowrap ${
|
|
3145
|
+
className: `inline-flex h-5 min-w-5 flex-none items-center justify-center rounded-sm border px-[calc(--spacing(1.5)-1px)] text-[0.75rem]/4 font-medium tabular-nums whitespace-nowrap ${Ws[e]}`,
|
|
3053
3146
|
children: t
|
|
3054
3147
|
}
|
|
3055
|
-
),
|
|
3148
|
+
), Ks = ({
|
|
3056
3149
|
open: e,
|
|
3057
3150
|
title: t,
|
|
3058
3151
|
onClose: n,
|
|
@@ -3073,27 +3166,27 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3073
3166
|
className: "sw-btn sw-btn--sm sw-btn--icon sw-btn--ghost",
|
|
3074
3167
|
"aria-label": `Close ${t.toLowerCase()}`,
|
|
3075
3168
|
onClick: n,
|
|
3076
|
-
children: /* @__PURE__ */ r(
|
|
3169
|
+
children: /* @__PURE__ */ r(ct, {})
|
|
3077
3170
|
}
|
|
3078
3171
|
)
|
|
3079
3172
|
] }),
|
|
3080
3173
|
/* @__PURE__ */ r("div", { className: "min-h-0 flex-1 scroll-fade overflow-y-auto", children: o })
|
|
3081
3174
|
] })
|
|
3082
3175
|
}
|
|
3083
|
-
),
|
|
3176
|
+
), Qs = "data-toolbar-divider", Gs = "data-orphan", Bt = (e) => e.offsetTop + e.offsetHeight / 2, Vt = (e, t) => Math.abs(Bt(e) - Bt(t)) <= Math.min(e.offsetHeight, t.offsetHeight) / 2 + 1, Xs = (e) => {
|
|
3084
3177
|
const t = [...e.children].filter(
|
|
3085
3178
|
(n) => n instanceof HTMLElement
|
|
3086
3179
|
);
|
|
3087
3180
|
t.forEach((n, o) => {
|
|
3088
|
-
if (!n.hasAttribute(
|
|
3089
|
-
const l = t[o - 1], c = t[o + 1], h = l === void 0 || !
|
|
3090
|
-
n.toggleAttribute(
|
|
3181
|
+
if (!n.hasAttribute(Qs)) return;
|
|
3182
|
+
const l = t[o - 1], c = t[o + 1], h = l === void 0 || !Vt(l, n), p = c === void 0 || !Vt(n, c);
|
|
3183
|
+
n.toggleAttribute(Gs, h || p);
|
|
3091
3184
|
});
|
|
3092
|
-
},
|
|
3185
|
+
}, Zs = ({ children: e }) => {
|
|
3093
3186
|
const [t, n] = f.useState(null);
|
|
3094
3187
|
return f.useLayoutEffect(() => {
|
|
3095
3188
|
if (!t) return;
|
|
3096
|
-
const o = () =>
|
|
3189
|
+
const o = () => Xs(t);
|
|
3097
3190
|
if (o(), typeof ResizeObserver > "u") return;
|
|
3098
3191
|
const l = new ResizeObserver(o);
|
|
3099
3192
|
return l.observe(t), () => l.disconnect();
|
|
@@ -3105,10 +3198,10 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3105
3198
|
children: e
|
|
3106
3199
|
}
|
|
3107
3200
|
) });
|
|
3108
|
-
},
|
|
3201
|
+
}, Je = ({ label: e, children: t }) => /* @__PURE__ */ g("div", { className: "flex items-center gap-2", children: [
|
|
3109
3202
|
/* @__PURE__ */ r("span", { className: "text-xs font-medium whitespace-nowrap text-fg-tertiary", children: e }),
|
|
3110
3203
|
t
|
|
3111
|
-
] }),
|
|
3204
|
+
] }), jt = () => /* @__PURE__ */ r("span", { className: "h-4 w-px bg-border data-[orphan]:invisible", "data-toolbar-divider": "" }), qs = ({
|
|
3112
3205
|
className: e,
|
|
3113
3206
|
height: t = 16
|
|
3114
3207
|
}) => /* @__PURE__ */ r(
|
|
@@ -3199,23 +3292,23 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3199
3292
|
}
|
|
3200
3293
|
)
|
|
3201
3294
|
}
|
|
3202
|
-
),
|
|
3295
|
+
), Wt = 16, Js = (e, t) => {
|
|
3203
3296
|
const n = [...e.children].filter(
|
|
3204
3297
|
(c) => c instanceof HTMLElement && c !== t
|
|
3205
3298
|
), o = e.clientWidth / 2, l = t.scrollWidth / 2;
|
|
3206
3299
|
return n.every((c) => {
|
|
3207
3300
|
const h = c.offsetLeft;
|
|
3208
|
-
return h + c.offsetWidth +
|
|
3301
|
+
return h + c.offsetWidth + Wt <= o - l || h - Wt >= o + l;
|
|
3209
3302
|
});
|
|
3210
|
-
},
|
|
3303
|
+
}, Vn = ({
|
|
3211
3304
|
title: e,
|
|
3212
3305
|
actions: t,
|
|
3213
3306
|
label: n = "Studio"
|
|
3214
3307
|
}) => {
|
|
3215
|
-
const o =
|
|
3308
|
+
const o = Rs(), [l, c] = f.useState(null), [h, p] = f.useState(null), [s, i] = f.useState(!0);
|
|
3216
3309
|
return f.useLayoutEffect(() => {
|
|
3217
3310
|
if (!l || !h) return;
|
|
3218
|
-
const a = () => i(
|
|
3311
|
+
const a = () => i(Js(l, h));
|
|
3219
3312
|
if (a(), typeof ResizeObserver > "u") return;
|
|
3220
3313
|
const d = new ResizeObserver(a);
|
|
3221
3314
|
d.observe(l);
|
|
@@ -3231,7 +3324,7 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3231
3324
|
a.button === 0 && (a.metaKey || a.ctrlKey || a.shiftKey || a.altKey || (a.preventDefault(), o.navigate()));
|
|
3232
3325
|
},
|
|
3233
3326
|
children: [
|
|
3234
|
-
/* @__PURE__ */ r(
|
|
3327
|
+
/* @__PURE__ */ r(qs, { className: "flex whitespace-nowrap" }),
|
|
3235
3328
|
/* @__PURE__ */ r("span", { className: "h-4 w-px bg-border max-sm:hidden" }),
|
|
3236
3329
|
/* @__PURE__ */ r("span", { className: "text-fg-secondary max-sm:hidden", children: n })
|
|
3237
3330
|
]
|
|
@@ -3246,14 +3339,14 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3246
3339
|
children: e
|
|
3247
3340
|
}
|
|
3248
3341
|
),
|
|
3249
|
-
/* @__PURE__ */ r("div", { className: "ml-auto flex items-center gap-2", children: /* @__PURE__ */ r(
|
|
3342
|
+
/* @__PURE__ */ r("div", { className: "ml-auto flex items-center gap-2", children: /* @__PURE__ */ r(Un.Provider, { value: "sm", children: t }) })
|
|
3250
3343
|
] }) });
|
|
3251
|
-
},
|
|
3344
|
+
}, ei = [
|
|
3252
3345
|
{ key: "user", label: "User", blurb: "Attributes your app sets" },
|
|
3253
3346
|
{ key: "device", label: "Device", blurb: "Platform, locale, OS — the SDK fills these in" },
|
|
3254
3347
|
{ key: "params", label: "Params", blurb: "Passed in at the placement" },
|
|
3255
3348
|
{ key: "products", label: "Products", blurb: "Store data for this paywall’s products" }
|
|
3256
|
-
],
|
|
3349
|
+
], Yt = (e) => e == null ? "" : typeof e == "string" ? e : JSON.stringify(e), ti = (e) => e === "true" ? !0 : e === "false" ? !1 : e.trim() !== "" && Number.isFinite(Number(e)) ? Number(e) : e, et = (e) => e.slice(e.indexOf(".") + 1), ni = ({
|
|
3257
3350
|
row: e,
|
|
3258
3351
|
override: t,
|
|
3259
3352
|
onChange: n
|
|
@@ -3273,107 +3366,128 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3273
3366
|
}
|
|
3274
3367
|
)
|
|
3275
3368
|
] }),
|
|
3276
|
-
typeof l == "boolean" ? /* @__PURE__ */ r("span", { className: "flex h-7 items-center", children: /* @__PURE__ */ r(
|
|
3369
|
+
typeof l == "boolean" ? /* @__PURE__ */ r("span", { className: "flex h-7 items-center", children: /* @__PURE__ */ r(Bn, { label: e.path, checked: l, onChange: (c) => n(c) }) }) : /* @__PURE__ */ r(
|
|
3277
3370
|
"input",
|
|
3278
3371
|
{
|
|
3279
3372
|
className: "sw-input sw-input--sm",
|
|
3280
3373
|
"aria-label": e.path,
|
|
3281
|
-
value:
|
|
3282
|
-
placeholder:
|
|
3374
|
+
value: Yt(l),
|
|
3375
|
+
placeholder: Yt(e.value),
|
|
3283
3376
|
onChange: (c) => {
|
|
3284
3377
|
const h = c.target.value;
|
|
3285
|
-
n(h === "" ? void 0 :
|
|
3378
|
+
n(h === "" ? void 0 : ti(h));
|
|
3286
3379
|
}
|
|
3287
3380
|
}
|
|
3288
3381
|
)
|
|
3289
3382
|
] });
|
|
3290
|
-
},
|
|
3383
|
+
}, ri = ({
|
|
3291
3384
|
label: e,
|
|
3292
3385
|
blurb: t,
|
|
3293
3386
|
rows: n,
|
|
3294
3387
|
overrideOf: o,
|
|
3295
|
-
onChange: l
|
|
3388
|
+
onChange: l,
|
|
3389
|
+
searching: c
|
|
3296
3390
|
}) => {
|
|
3297
|
-
const [
|
|
3391
|
+
const [h, p] = f.useState("closed"), s = c ? "open" : h, i = s === "open", a = n.filter((d) => o(d.path) !== void 0).length;
|
|
3298
3392
|
return /* @__PURE__ */ g("section", { className: "border-b border-border", children: [
|
|
3299
3393
|
/* @__PURE__ */ g(
|
|
3300
3394
|
"button",
|
|
3301
3395
|
{
|
|
3302
3396
|
type: "button",
|
|
3303
3397
|
className: "group relative flex w-full items-center gap-4 px-4 py-2.5 text-left transition-colors duration-hover before:pointer-events-none before:absolute before:inset-0 before:border before:border-transparent before:transition-colors before:duration-hover hover:bg-foreground/3 focus-visible:before:border-primary",
|
|
3304
|
-
"aria-expanded":
|
|
3305
|
-
onClick: () =>
|
|
3398
|
+
"aria-expanded": i,
|
|
3399
|
+
onClick: () => p((d) => d === "open" ? "closing" : "open"),
|
|
3306
3400
|
children: [
|
|
3307
3401
|
/* @__PURE__ */ g("span", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
3308
3402
|
/* @__PURE__ */ g("span", { className: "flex items-center gap-1.5 text-sm font-medium", children: [
|
|
3309
3403
|
e,
|
|
3310
|
-
|
|
3404
|
+
a > 0 ? /* @__PURE__ */ r("span", { className: "font-normal text-primary tabular-nums", children: `${a} set` }) : n.length > 0 && /* @__PURE__ */ r("span", { className: "font-normal text-fg-tertiary tabular-nums", children: n.length })
|
|
3311
3405
|
] }),
|
|
3312
3406
|
/* @__PURE__ */ r("span", { className: "truncate text-xs/4 text-fg-tertiary", children: t })
|
|
3313
3407
|
] }),
|
|
3314
3408
|
/* @__PURE__ */ r(
|
|
3315
|
-
|
|
3409
|
+
dn,
|
|
3316
3410
|
{
|
|
3317
|
-
className: `icon-tertiary transition-disclosure group-hover:filter-none ${
|
|
3411
|
+
className: `icon-tertiary transition-disclosure group-hover:filter-none ${i ? "rotate-180" : ""}`
|
|
3318
3412
|
}
|
|
3319
3413
|
)
|
|
3320
3414
|
]
|
|
3321
3415
|
}
|
|
3322
3416
|
),
|
|
3323
|
-
|
|
3417
|
+
s !== "closed" && /* @__PURE__ */ r(
|
|
3324
3418
|
"div",
|
|
3325
3419
|
{
|
|
3326
|
-
className: `grid transition-[grid-template-rows,opacity] duration-move ease-out starting:grid-rows-[0fr] starting:opacity-0 ${
|
|
3327
|
-
"aria-hidden":
|
|
3328
|
-
inert: !
|
|
3329
|
-
onTransitionEnd: (
|
|
3330
|
-
|
|
3420
|
+
className: `grid transition-[grid-template-rows,opacity] duration-move ease-out starting:grid-rows-[0fr] starting:opacity-0 ${i ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"}`,
|
|
3421
|
+
"aria-hidden": i ? void 0 : !0,
|
|
3422
|
+
inert: !i,
|
|
3423
|
+
onTransitionEnd: (d) => {
|
|
3424
|
+
d.target === d.currentTarget && s === "closing" && p("closed");
|
|
3331
3425
|
},
|
|
3332
|
-
children: /* @__PURE__ */ r("div", { className: "min-h-0 overflow-hidden", children: n.length === 0 ? /* @__PURE__ */ r("span", { className: "block px-4 pb-4 text-xs text-fg-tertiary", children: "Nothing here for this paywall." }) : /* @__PURE__ */ r("div", { className: "flex flex-col gap-3 px-4 pt-1 pb-4", children: n.map((
|
|
3333
|
-
|
|
3426
|
+
children: /* @__PURE__ */ r("div", { className: "min-h-0 overflow-hidden", children: n.length === 0 ? /* @__PURE__ */ r("span", { className: "block px-4 pb-4 text-xs text-fg-tertiary", children: "Nothing here for this paywall." }) : /* @__PURE__ */ r("div", { className: "flex flex-col gap-3 px-4 pt-1 pb-4", children: n.map((d) => /* @__PURE__ */ r(
|
|
3427
|
+
ni,
|
|
3334
3428
|
{
|
|
3335
|
-
row:
|
|
3336
|
-
override: o(
|
|
3337
|
-
onChange: (
|
|
3429
|
+
row: d,
|
|
3430
|
+
override: o(d.path),
|
|
3431
|
+
onChange: (u) => l(d.path, u)
|
|
3338
3432
|
},
|
|
3339
|
-
|
|
3433
|
+
d.path
|
|
3340
3434
|
)) }) })
|
|
3341
3435
|
}
|
|
3342
3436
|
)
|
|
3343
3437
|
] });
|
|
3344
|
-
},
|
|
3438
|
+
}, oi = ({
|
|
3345
3439
|
overrides: e,
|
|
3346
3440
|
groups: t,
|
|
3347
3441
|
onChange: n
|
|
3348
3442
|
}) => {
|
|
3349
|
-
const o = (
|
|
3350
|
-
if (
|
|
3351
|
-
const
|
|
3352
|
-
|
|
3443
|
+
const o = (i, a, d) => {
|
|
3444
|
+
if (i !== "products") {
|
|
3445
|
+
const w = { ...e[i] };
|
|
3446
|
+
d === void 0 ? delete w[et(a)] : w[et(a)] = d, n({ ...e, [i]: w });
|
|
3353
3447
|
return;
|
|
3354
3448
|
}
|
|
3355
|
-
const [,
|
|
3356
|
-
|
|
3357
|
-
const
|
|
3358
|
-
Object.keys(
|
|
3359
|
-
}
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3449
|
+
const [, u = "", b = ""] = a.split("."), m = { ...e.products?.[u] };
|
|
3450
|
+
d === void 0 ? delete m[b] : m[b] = d;
|
|
3451
|
+
const v = { ...e.products, [u]: m };
|
|
3452
|
+
Object.keys(m).length === 0 && delete v[u], n({ ...e, products: v });
|
|
3453
|
+
}, [l, c] = f.useState(""), h = l.trim().toLowerCase(), p = (i) => h === "" ? i : i.filter((a) => a.path.toLowerCase().includes(h)), s = ei.filter(
|
|
3454
|
+
(i) => h === "" || p(t[i.key] ?? []).length > 0
|
|
3455
|
+
);
|
|
3456
|
+
return /* @__PURE__ */ g("div", { className: "flex flex-col", children: [
|
|
3457
|
+
/* @__PURE__ */ r("div", { className: "border-b border-border p-3", children: /* @__PURE__ */ g("label", { className: "relative flex items-center", children: [
|
|
3458
|
+
/* @__PURE__ */ r(Ae, { className: "icon-tertiary pointer-events-none absolute left-2.5" }),
|
|
3459
|
+
/* @__PURE__ */ r(
|
|
3460
|
+
"input",
|
|
3461
|
+
{
|
|
3462
|
+
className: "sw-input sw-input--sm w-full pl-8",
|
|
3463
|
+
type: "search",
|
|
3464
|
+
"aria-label": "Search variables",
|
|
3465
|
+
placeholder: "Search variables",
|
|
3466
|
+
value: l,
|
|
3467
|
+
onChange: (i) => c(i.target.value)
|
|
3468
|
+
}
|
|
3469
|
+
)
|
|
3470
|
+
] }) }),
|
|
3471
|
+
s.length === 0 && /* @__PURE__ */ r("span", { className: "block px-4 py-4 text-xs text-fg-tertiary", children: "No variables match." }),
|
|
3472
|
+
s.map((i) => /* @__PURE__ */ r(
|
|
3473
|
+
ri,
|
|
3474
|
+
{
|
|
3475
|
+
label: i.label,
|
|
3476
|
+
blurb: i.blurb,
|
|
3477
|
+
searching: h !== "",
|
|
3478
|
+
rows: p(t[i.key] ?? []),
|
|
3479
|
+
overrideOf: (a) => i.key === "products" ? e.products?.[a.split(".")[1] ?? ""]?.[a.split(".")[2] ?? ""] : e[i.key]?.[et(a)],
|
|
3480
|
+
onChange: (a, d) => o(i.key, a, d)
|
|
3481
|
+
},
|
|
3482
|
+
i.key
|
|
3483
|
+
))
|
|
3484
|
+
] });
|
|
3485
|
+
}, _e = {
|
|
3372
3486
|
radius: 54,
|
|
3373
3487
|
cutout: "island",
|
|
3374
3488
|
statusBarHeight: 64,
|
|
3375
3489
|
homeIndicator: !0
|
|
3376
|
-
},
|
|
3490
|
+
}, He = [
|
|
3377
3491
|
{
|
|
3378
3492
|
id: "iphone-se",
|
|
3379
3493
|
name: "iPhone SE",
|
|
@@ -3388,7 +3502,15 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3388
3502
|
width: 402,
|
|
3389
3503
|
height: 874,
|
|
3390
3504
|
device: { platform: "iOS", deviceModel: "iPhone18,3", osVersion: "26.0" },
|
|
3391
|
-
chrome:
|
|
3505
|
+
chrome: _e
|
|
3506
|
+
},
|
|
3507
|
+
{
|
|
3508
|
+
id: "iphone-17-pro",
|
|
3509
|
+
name: "iPhone 17 Pro",
|
|
3510
|
+
width: 402,
|
|
3511
|
+
height: 874,
|
|
3512
|
+
device: { platform: "iOS", deviceModel: "iPhone18,1", osVersion: "26.0" },
|
|
3513
|
+
chrome: _e
|
|
3392
3514
|
},
|
|
3393
3515
|
{
|
|
3394
3516
|
id: "iphone-air",
|
|
@@ -3396,7 +3518,7 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3396
3518
|
width: 420,
|
|
3397
3519
|
height: 912,
|
|
3398
3520
|
device: { platform: "iOS", deviceModel: "iPhone18,4", osVersion: "26.0" },
|
|
3399
|
-
chrome:
|
|
3521
|
+
chrome: _e
|
|
3400
3522
|
},
|
|
3401
3523
|
{
|
|
3402
3524
|
id: "iphone-17-pro-max",
|
|
@@ -3404,7 +3526,31 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3404
3526
|
width: 440,
|
|
3405
3527
|
height: 956,
|
|
3406
3528
|
device: { platform: "iOS", deviceModel: "iPhone18,2", osVersion: "26.0" },
|
|
3407
|
-
chrome:
|
|
3529
|
+
chrome: _e
|
|
3530
|
+
},
|
|
3531
|
+
{
|
|
3532
|
+
id: "iphone-duo-closed",
|
|
3533
|
+
name: "iPhone Duo (Closed)",
|
|
3534
|
+
width: 466,
|
|
3535
|
+
height: 678,
|
|
3536
|
+
device: { platform: "iOS", deviceModel: "iPhone19,4", osVersion: "27.1" },
|
|
3537
|
+
chrome: { radius: 40, duo: "closed", statusBarHeight: 0, homeIndicator: !0 },
|
|
3538
|
+
safeArea: {
|
|
3539
|
+
portrait: { top: 0, right: 84, bottom: 34, left: 0 },
|
|
3540
|
+
landscape: { top: 0, right: 84, bottom: 34, left: 0 }
|
|
3541
|
+
}
|
|
3542
|
+
},
|
|
3543
|
+
{
|
|
3544
|
+
id: "iphone-duo-open",
|
|
3545
|
+
name: "iPhone Duo (Open)",
|
|
3546
|
+
width: 669,
|
|
3547
|
+
height: 951,
|
|
3548
|
+
device: { platform: "iOS", deviceModel: "iPhone19,4", osVersion: "27.1" },
|
|
3549
|
+
chrome: { radius: 32, duo: "open", statusBarHeight: 0, homeIndicator: !0 },
|
|
3550
|
+
safeArea: {
|
|
3551
|
+
portrait: { top: 82, right: 0, bottom: 34, left: 0 },
|
|
3552
|
+
landscape: { top: 0, right: 84, bottom: 34, left: 0 }
|
|
3553
|
+
}
|
|
3408
3554
|
},
|
|
3409
3555
|
{
|
|
3410
3556
|
id: "pixel-10",
|
|
@@ -3456,22 +3602,26 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3456
3602
|
width: 1440,
|
|
3457
3603
|
height: 900
|
|
3458
3604
|
}
|
|
3459
|
-
],
|
|
3460
|
-
const t = e.chrome?.statusBarHeight ?? 0, n = e.device === void 0 ?
|
|
3605
|
+
], jn = "iphone-17", si = (e) => e !== void 0 && e.length > 0 && e.every((t) => t.toLowerCase() === "web"), ii = (e, t) => t ? void 0 : e.chrome, tt = { iOS: 84, Android: 104, tablet: 66, desktop: 52 }, ai = (e) => {
|
|
3606
|
+
const t = e.chrome?.statusBarHeight ?? 0, n = e.device === void 0 ? tt.desktop : e.width >= 600 ? tt.tablet : tt[e.device.platform];
|
|
3461
3607
|
return { width: e.width, height: e.height - t - n };
|
|
3462
|
-
},
|
|
3608
|
+
}, li = {
|
|
3463
3609
|
platform: "iOS",
|
|
3464
3610
|
deviceModel: "Mac",
|
|
3465
3611
|
osVersion: "26.0",
|
|
3466
3612
|
interfaceType: "mac"
|
|
3467
|
-
},
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
}),
|
|
3613
|
+
}, ci = (e, t) => e.safeArea?.[t ? "landscape" : "portrait"], di = (e, t, n = !1) => {
|
|
3614
|
+
if (t) return { ...e.device, platform: "web" };
|
|
3615
|
+
const o = ci(e, n), l = e.device ?? li;
|
|
3616
|
+
return o === void 0 ? l : { ...l, safeAreaInsets: o };
|
|
3617
|
+
}, Kt = "responsive", ui = { width: 393, height: 852 }, hi = He.find((e) => e.id === jn) ?? He[0], pi = (e) => He.find((t) => t.id === e) ?? hi, Wn = () => ({
|
|
3618
|
+
device: Tr(),
|
|
3619
|
+
user: $r,
|
|
3620
|
+
params: Dr
|
|
3621
|
+
}), Yn = (e) => {
|
|
3472
3622
|
const { publicApiKey: t, ...n } = e;
|
|
3473
3623
|
return n;
|
|
3474
|
-
},
|
|
3624
|
+
}, Kn = ({
|
|
3475
3625
|
surface: e,
|
|
3476
3626
|
defaults: t,
|
|
3477
3627
|
sourceSamples: n,
|
|
@@ -3481,7 +3631,7 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3481
3631
|
locale: h,
|
|
3482
3632
|
edited: p
|
|
3483
3633
|
}) => {
|
|
3484
|
-
const s =
|
|
3634
|
+
const s = Yn({
|
|
3485
3635
|
...t.device,
|
|
3486
3636
|
...n?.device,
|
|
3487
3637
|
...o.device,
|
|
@@ -3508,7 +3658,7 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3508
3658
|
}
|
|
3509
3659
|
})
|
|
3510
3660
|
);
|
|
3511
|
-
return
|
|
3661
|
+
return tn({
|
|
3512
3662
|
paywallId: e.paywallId ?? "0",
|
|
3513
3663
|
paywallIdentifier: e.paywallIdentifier ?? e.id,
|
|
3514
3664
|
device: s,
|
|
@@ -3517,14 +3667,14 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3517
3667
|
products: d,
|
|
3518
3668
|
introductoryOfferEligible: p.introductoryOfferEligible
|
|
3519
3669
|
});
|
|
3520
|
-
},
|
|
3670
|
+
}, fi = {
|
|
3521
3671
|
swiftui: "SwiftUI",
|
|
3522
3672
|
uikit: "UIKit",
|
|
3523
3673
|
compose: "Jetpack Compose",
|
|
3524
3674
|
"android-views": "Android Views",
|
|
3525
3675
|
"react-native": "React Native",
|
|
3526
3676
|
flutter: "Flutter"
|
|
3527
|
-
}, Pe = (e) => "path" in e,
|
|
3677
|
+
}, Pe = (e) => "path" in e, Qt = (e) => e.origin !== void 0 && (!Pe(e.origin) || e.origin.screenshot !== void 0), Hi = (e) => e.actions !== void 0, Gt = "flex w-8 items-center justify-center outline-none transition-colors duration-hover hover:bg-accent focus-visible:bg-accent hover:[&>svg]:filter-none focus-visible:[&>svg]:filter-none", Qn = (e, t) => Number.isFinite(e) ? Math.min(3e3, Math.max(200, Math.round(e))) : t, Xt = ({
|
|
3528
3678
|
label: e,
|
|
3529
3679
|
value: t,
|
|
3530
3680
|
onCommit: n
|
|
@@ -3541,7 +3691,7 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3541
3691
|
value: o,
|
|
3542
3692
|
onChange: (h) => l(h.target.value),
|
|
3543
3693
|
onBlur: () => {
|
|
3544
|
-
const h =
|
|
3694
|
+
const h = Qn(Number(o), t);
|
|
3545
3695
|
l(String(h)), n(h);
|
|
3546
3696
|
},
|
|
3547
3697
|
onKeyDown: (h) => {
|
|
@@ -3549,7 +3699,7 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3549
3699
|
}
|
|
3550
3700
|
}
|
|
3551
3701
|
);
|
|
3552
|
-
},
|
|
3702
|
+
}, Zt = ({
|
|
3553
3703
|
label: e,
|
|
3554
3704
|
width: t,
|
|
3555
3705
|
height: n,
|
|
@@ -3567,7 +3717,7 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3567
3717
|
onResize: m,
|
|
3568
3718
|
canvas: v
|
|
3569
3719
|
}) => {
|
|
3570
|
-
const w =
|
|
3720
|
+
const w = wn(), [S, M] = f.useState(!1);
|
|
3571
3721
|
return f.useEffect(() => M(!1), [c]), /* @__PURE__ */ g("div", { className: "flex flex-none flex-col gap-2", children: [
|
|
3572
3722
|
e && /* @__PURE__ */ r(
|
|
3573
3723
|
"span",
|
|
@@ -3596,7 +3746,7 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3596
3746
|
)
|
|
3597
3747
|
}
|
|
3598
3748
|
) : l ? /* @__PURE__ */ r(
|
|
3599
|
-
|
|
3749
|
+
es,
|
|
3600
3750
|
{
|
|
3601
3751
|
width: t,
|
|
3602
3752
|
height: n,
|
|
@@ -3610,140 +3760,154 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3610
3760
|
landscape: u,
|
|
3611
3761
|
theme: b
|
|
3612
3762
|
}
|
|
3613
|
-
) : /* @__PURE__ */ r(
|
|
3763
|
+
) : /* @__PURE__ */ r(Jo, { width: t, height: n, children: i ?? "Nothing live yet — publish to compare against production." }),
|
|
3614
3764
|
m && /* @__PURE__ */ r(
|
|
3615
|
-
|
|
3765
|
+
ns,
|
|
3616
3766
|
{
|
|
3617
3767
|
size: { width: t, height: n },
|
|
3618
3768
|
scale: w,
|
|
3619
|
-
clamp:
|
|
3769
|
+
clamp: Qn,
|
|
3620
3770
|
onResize: m,
|
|
3621
3771
|
onDragStart: () => v?.current?.hold(),
|
|
3622
|
-
onShift: (
|
|
3772
|
+
onShift: (C, x) => v?.current?.pan(C, x)
|
|
3623
3773
|
}
|
|
3624
3774
|
)
|
|
3625
3775
|
] })
|
|
3626
3776
|
] });
|
|
3627
|
-
},
|
|
3777
|
+
}, mi = ({ children: e }) => {
|
|
3778
|
+
const t = wn();
|
|
3779
|
+
return /* @__PURE__ */ r(
|
|
3780
|
+
"div",
|
|
3781
|
+
{
|
|
3782
|
+
className: "w-fit origin-top self-center",
|
|
3783
|
+
style: { transform: `scale(${1 / t})` },
|
|
3784
|
+
onPointerDown: (n) => n.stopPropagation(),
|
|
3785
|
+
children: e
|
|
3786
|
+
}
|
|
3787
|
+
);
|
|
3788
|
+
}, nt = (e) => e.label ?? `${e.kind}/${e.id}`, gi = ({
|
|
3628
3789
|
source: e,
|
|
3629
3790
|
surface: t,
|
|
3630
3791
|
samples: n,
|
|
3631
3792
|
actions: o
|
|
3632
3793
|
}) => {
|
|
3633
|
-
const [l, c] = f.useState(
|
|
3634
|
-
() =>
|
|
3635
|
-
), [M,
|
|
3636
|
-
f.useEffect(() => () => window.clearTimeout(
|
|
3637
|
-
const
|
|
3794
|
+
const [l, c] = f.useState(jn), [h, p] = f.useState(ui), [s, i] = f.useState("light"), [a, d] = f.useState(void 0), [u, b] = f.useState({}), [m, v] = f.useState(!1), [w, S] = f.useState(
|
|
3795
|
+
() => Qt(t) && new URLSearchParams(window.location.search).get("compare") === "origin" ? { type: "origin" } : void 0
|
|
3796
|
+
), [M, C] = f.useState(0), [x, _] = f.useState(!1), N = f.useRef(null), [A, L] = f.useState({ scale: 1, fitted: !0 }), [K, R] = f.useState({}), [z, se] = f.useState(void 0), [de, j] = f.useState(void 0), Q = f.useRef(void 0);
|
|
3797
|
+
f.useEffect(() => () => window.clearTimeout(Q.current), []);
|
|
3798
|
+
const G = e.actions, E = xs(), k = f.useMemo(Wn, [t]), $ = t.locales;
|
|
3638
3799
|
f.useEffect(() => {
|
|
3639
|
-
if (!
|
|
3800
|
+
if (!G) return;
|
|
3640
3801
|
let y = !1;
|
|
3641
|
-
return se(void 0),
|
|
3642
|
-
y ||
|
|
3802
|
+
return se(void 0), G.status(t).then((H) => {
|
|
3803
|
+
y || R(H);
|
|
3643
3804
|
}), () => {
|
|
3644
3805
|
y = !0;
|
|
3645
3806
|
};
|
|
3646
|
-
}, [
|
|
3647
|
-
const
|
|
3648
|
-
if (!
|
|
3649
|
-
window.clearTimeout(
|
|
3650
|
-
const
|
|
3651
|
-
|
|
3807
|
+
}, [G, t]);
|
|
3808
|
+
const F = async (y) => {
|
|
3809
|
+
if (!G) return;
|
|
3810
|
+
window.clearTimeout(Q.current), j({ action: y, steps: {} });
|
|
3811
|
+
const H = y === "promote" ? t.version ?? z : void 0, oe = await G.run(t, { action: y, version: H }, (q, ee) => {
|
|
3812
|
+
j(
|
|
3652
3813
|
(ie) => ie?.action === y ? {
|
|
3653
3814
|
...ie,
|
|
3654
|
-
steps: { ...ie.steps, [
|
|
3815
|
+
steps: { ...ie.steps, [q]: ee === "start" ? "active" : "done" }
|
|
3655
3816
|
} : ie
|
|
3656
3817
|
);
|
|
3657
3818
|
});
|
|
3658
3819
|
if (oe.ok) {
|
|
3659
|
-
const
|
|
3660
|
-
|
|
3820
|
+
const q = Object.fromEntries(
|
|
3821
|
+
Te[y].map((ee) => [ee, "done"])
|
|
3661
3822
|
);
|
|
3662
|
-
|
|
3823
|
+
j({ action: y, steps: q }), se(void 0), R(await G.status(t)), Q.current = window.setTimeout(() => j(void 0), 1600);
|
|
3663
3824
|
} else
|
|
3664
|
-
|
|
3665
|
-
if (!
|
|
3666
|
-
const ee = { ...
|
|
3667
|
-
for (const ie of
|
|
3825
|
+
j((q) => {
|
|
3826
|
+
if (!q) return q;
|
|
3827
|
+
const ee = { ...q.steps };
|
|
3828
|
+
for (const ie of Te[y])
|
|
3668
3829
|
ee[ie] === "active" && (ee[ie] = "failed");
|
|
3669
|
-
return { ...
|
|
3830
|
+
return { ...q, steps: ee, error: oe.error };
|
|
3670
3831
|
});
|
|
3671
|
-
},
|
|
3832
|
+
}, D = l === Kt, W = pi(l), V = si(t.platforms), re = f.useMemo(
|
|
3833
|
+
() => di(W, V, x),
|
|
3834
|
+
[W, V, x]
|
|
3835
|
+
), X = D ? h : V ? ai(W) : { width: W.width, height: W.height }, ne = V ? void 0 : t.presentation, Y = x ? { width: X.height, height: X.width } : X, Ve = () => {
|
|
3672
3836
|
const y = e.standaloneUrl?.(t);
|
|
3673
3837
|
if (y === void 0) return;
|
|
3674
|
-
if (
|
|
3838
|
+
if (Y.width > 768) {
|
|
3675
3839
|
window.open(y, "_blank");
|
|
3676
3840
|
return;
|
|
3677
3841
|
}
|
|
3678
|
-
const
|
|
3842
|
+
const H = Math.max(0, window.screen.width / 2 - Y.width / 2), oe = Math.max(0, window.screen.height / 2 - Y.height / 2);
|
|
3679
3843
|
window.open(
|
|
3680
3844
|
y,
|
|
3681
3845
|
"superwall-preview",
|
|
3682
|
-
`toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=${
|
|
3846
|
+
`toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=${Y.width},height=${Y.height},top=${oe},left=${H}`
|
|
3683
3847
|
) || window.open(y, "_blank");
|
|
3684
3848
|
}, ve = f.useMemo(
|
|
3685
|
-
() =>
|
|
3849
|
+
() => Kn({
|
|
3686
3850
|
surface: t,
|
|
3687
3851
|
defaults: k,
|
|
3688
3852
|
sourceSamples: e.samples,
|
|
3689
3853
|
samples: n,
|
|
3690
|
-
frame:
|
|
3854
|
+
frame: D ? void 0 : re,
|
|
3691
3855
|
theme: s,
|
|
3692
3856
|
locale: a,
|
|
3693
3857
|
edited: u
|
|
3694
3858
|
}),
|
|
3695
|
-
[t, k, e.samples, n,
|
|
3696
|
-
), ye =
|
|
3697
|
-
target: t.version ??
|
|
3698
|
-
live:
|
|
3699
|
-
versions:
|
|
3700
|
-
pick: t.version === void 0 ? se :
|
|
3701
|
-
},
|
|
3859
|
+
[t, k, e.samples, n, D, re, s, a, u]
|
|
3860
|
+
), ye = D ? void 0 : ii(W, V), O = e.previewUrl(t), B = K.versions ?? [], Ee = {
|
|
3861
|
+
target: t.version ?? z ?? lo(B),
|
|
3862
|
+
live: ao(B),
|
|
3863
|
+
versions: B,
|
|
3864
|
+
pick: t.version === void 0 ? se : G?.pick
|
|
3865
|
+
}, bt = (y) => `v${y.version}${y.live ? " · Live" : ""}`, Gn = (y) => {
|
|
3702
3866
|
if (y.live) return "What SDKs receive today";
|
|
3703
|
-
const
|
|
3704
|
-
return
|
|
3705
|
-
},
|
|
3706
|
-
...t.origin &&
|
|
3867
|
+
const H = y.pushedAt ? dt(y.pushedAt) : void 0;
|
|
3868
|
+
return H ? `Pushed ${H}` : "Pushed snapshot";
|
|
3869
|
+
}, wt = [
|
|
3870
|
+
...t.origin && Qt(t) ? [
|
|
3707
3871
|
{
|
|
3708
3872
|
key: "origin",
|
|
3709
3873
|
label: "Original",
|
|
3710
|
-
hint: Pe(t.origin) ? `${
|
|
3874
|
+
hint: Pe(t.origin) ? `${fi[t.origin.framework]} screen ${t.origin.path}, as captured in the simulator` : `Dashboard paywall ${t.origin.paywallId}, as it serves today`,
|
|
3711
3875
|
target: { type: "origin" }
|
|
3712
3876
|
}
|
|
3713
3877
|
] : [],
|
|
3714
|
-
...
|
|
3878
|
+
...B.map((y) => ({
|
|
3715
3879
|
key: `version:${y.version}`,
|
|
3716
|
-
label:
|
|
3717
|
-
hint:
|
|
3880
|
+
label: bt(y),
|
|
3881
|
+
hint: Gn(y),
|
|
3718
3882
|
target: { type: "version", version: y.version }
|
|
3719
3883
|
})),
|
|
3720
3884
|
...e.surfaces.map((y) => ({
|
|
3721
3885
|
key: `surface:${y.kind}/${y.id}`,
|
|
3722
|
-
label:
|
|
3886
|
+
label: nt(y),
|
|
3723
3887
|
hint: e.compareHint ?? "Local preview",
|
|
3724
3888
|
target: { type: "surface", surface: y }
|
|
3725
3889
|
})).filter((y) => y.target.surface !== t)
|
|
3726
|
-
],
|
|
3727
|
-
label:
|
|
3728
|
-
src:
|
|
3890
|
+
], vt = K.unreachable ? `Couldn’t read the pushed versions — ${K.unreachable}` : void 0, Se = w?.type === "version" ? B.find((y) => y.version === w.version) : void 0, J = w && (w.type === "version" ? {
|
|
3891
|
+
label: Se ? bt(Se) : `v${w.version}`,
|
|
3892
|
+
src: Se ? mt(Se.url) : void 0,
|
|
3729
3893
|
title: `${t.id} v${w.version}`,
|
|
3730
|
-
empty:
|
|
3894
|
+
empty: vt ?? "This version is no longer on the dashboard."
|
|
3731
3895
|
} : w.type === "origin" ? {
|
|
3732
3896
|
label: "Original",
|
|
3733
|
-
...t.origin && Pe(t.origin) ? { image: t.origin.screenshot ?
|
|
3897
|
+
...t.origin && Pe(t.origin) ? { image: t.origin.screenshot ? Ns(t) : void 0 } : { src: t.origin?.url },
|
|
3734
3898
|
title: `${t.id} original`,
|
|
3735
3899
|
empty: t.origin && Pe(t.origin) ? "The original’s screenshot is missing — capture it again with `superwall migrate --screen <path> --screenshot <file>`." : "This paywall was not rebuilt from a dashboard paywall or a native screen."
|
|
3736
3900
|
} : {
|
|
3737
|
-
label:
|
|
3901
|
+
label: nt(w.surface),
|
|
3738
3902
|
src: e.previewUrl(w.surface),
|
|
3739
|
-
title: `${
|
|
3740
|
-
}),
|
|
3741
|
-
const y = (
|
|
3903
|
+
title: `${nt(w.surface)} preview`
|
|
3904
|
+
}), Xn = f.useMemo(() => {
|
|
3905
|
+
const y = (H, oe) => Object.entries(oe ?? {}).map(([q, ee]) => ({ path: `${H}.${q}`, value: ee })).toSorted((q, ee) => q.path.localeCompare(ee.path));
|
|
3742
3906
|
return {
|
|
3743
3907
|
user: y("user", { ...k.user, ...e.samples?.user, ...n.user }),
|
|
3744
3908
|
device: y(
|
|
3745
3909
|
"device",
|
|
3746
|
-
|
|
3910
|
+
Yn({
|
|
3747
3911
|
...k.device,
|
|
3748
3912
|
...e.samples?.device,
|
|
3749
3913
|
...n.device,
|
|
@@ -3752,33 +3916,33 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3752
3916
|
),
|
|
3753
3917
|
params: y("params", { ...k.params, ...e.samples?.params }),
|
|
3754
3918
|
products: Object.entries(t.products ?? {}).flatMap(
|
|
3755
|
-
([
|
|
3919
|
+
([H, oe]) => y(`products.${H}`, n.products?.[oe])
|
|
3756
3920
|
)
|
|
3757
3921
|
};
|
|
3758
|
-
}, [k, e.samples, n, re, t.products]),
|
|
3759
|
-
f.useEffect(() =>
|
|
3760
|
-
const
|
|
3761
|
-
return /* @__PURE__ */ g(
|
|
3922
|
+
}, [k, e.samples, n, re, t.products]), Me = f.useMemo(() => n.products ? Object.entries(t.products ?? {}).filter(([, y]) => n.products?.[y] === void 0).map(([y, H]) => ({ reference: y, identifier: H })) : [], [n.products, t.products]), [Zn, je] = f.useState(!1);
|
|
3923
|
+
f.useEffect(() => je(!1), [t]);
|
|
3924
|
+
const We = n.unreachable, qn = Me.length === 0, yt = Object.keys(u.user ?? {}).length + Object.keys(u.params ?? {}).length + Object.keys(u.device ?? {}).length;
|
|
3925
|
+
return /* @__PURE__ */ g(Z, { children: [
|
|
3762
3926
|
/* @__PURE__ */ r(
|
|
3763
|
-
|
|
3927
|
+
Cs,
|
|
3764
3928
|
{
|
|
3765
3929
|
surfaceKey: `${t.project ?? ""}/${t.id}`,
|
|
3766
|
-
raised: !!
|
|
3930
|
+
raised: !!We
|
|
3767
3931
|
}
|
|
3768
3932
|
),
|
|
3769
|
-
|
|
3770
|
-
|
|
3933
|
+
Me.length > 0 && !Zn && /* @__PURE__ */ r(
|
|
3934
|
+
rs,
|
|
3771
3935
|
{
|
|
3772
3936
|
paywall: t.id,
|
|
3773
|
-
missing:
|
|
3774
|
-
onDismiss: () =>
|
|
3937
|
+
missing: Me,
|
|
3938
|
+
onDismiss: () => je(!0)
|
|
3775
3939
|
}
|
|
3776
3940
|
),
|
|
3777
3941
|
/* @__PURE__ */ r(
|
|
3778
|
-
|
|
3942
|
+
Vn,
|
|
3779
3943
|
{
|
|
3780
3944
|
title: `${t.project ?? e.title} / ${t.label ?? t.id}${t.label ? ` · ${t.id}` : ""}`,
|
|
3781
|
-
actions: /* @__PURE__ */ g(
|
|
3945
|
+
actions: /* @__PURE__ */ g(Z, { children: [
|
|
3782
3946
|
o,
|
|
3783
3947
|
/* @__PURE__ */ g("span", { className: "flex items-center gap-0.5", children: [
|
|
3784
3948
|
/* @__PURE__ */ r(we, { hint: "Reload preview", children: /* @__PURE__ */ r(
|
|
@@ -3787,8 +3951,8 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3787
3951
|
type: "button",
|
|
3788
3952
|
className: "sw-btn sw-btn--sm sw-btn--icon sw-btn--ghost",
|
|
3789
3953
|
"aria-label": "Reload preview",
|
|
3790
|
-
onClick: () =>
|
|
3791
|
-
children: /* @__PURE__ */ r(
|
|
3954
|
+
onClick: () => C((y) => y + 1),
|
|
3955
|
+
children: /* @__PURE__ */ r(cn, {})
|
|
3792
3956
|
}
|
|
3793
3957
|
) }),
|
|
3794
3958
|
e.standaloneUrl && /* @__PURE__ */ r(we, { hint: "Open preview", children: /* @__PURE__ */ r(
|
|
@@ -3797,28 +3961,28 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3797
3961
|
type: "button",
|
|
3798
3962
|
className: "sw-btn sw-btn--sm sw-btn--icon sw-btn--ghost",
|
|
3799
3963
|
"aria-label": "Open preview",
|
|
3800
|
-
onClick:
|
|
3801
|
-
children: /* @__PURE__ */ r(
|
|
3964
|
+
onClick: Ve,
|
|
3965
|
+
children: /* @__PURE__ */ r(Ce, {})
|
|
3802
3966
|
}
|
|
3803
3967
|
) }),
|
|
3804
|
-
/* @__PURE__ */ r(
|
|
3968
|
+
/* @__PURE__ */ r(Ls, { source: e, surface: t })
|
|
3805
3969
|
] }),
|
|
3806
|
-
/* @__PURE__ */ r(
|
|
3807
|
-
|
|
3808
|
-
|
|
3970
|
+
/* @__PURE__ */ r(Vs, { source: e, surface: t }),
|
|
3971
|
+
G && /* @__PURE__ */ r(
|
|
3972
|
+
wo,
|
|
3809
3973
|
{
|
|
3810
|
-
offered:
|
|
3811
|
-
promotion:
|
|
3974
|
+
offered: G.offered,
|
|
3975
|
+
promotion: Ee,
|
|
3812
3976
|
progress: de,
|
|
3813
|
-
blocked:
|
|
3814
|
-
onRun:
|
|
3815
|
-
onBlocked: () =>
|
|
3977
|
+
blocked: qn ? void 0 : `Superwall has no product for ${Me.map((y) => y.reference).join(", ")}`,
|
|
3978
|
+
onRun: F,
|
|
3979
|
+
onBlocked: () => je(!1)
|
|
3816
3980
|
}
|
|
3817
3981
|
)
|
|
3818
3982
|
] })
|
|
3819
3983
|
}
|
|
3820
3984
|
),
|
|
3821
|
-
|
|
3985
|
+
We && /* @__PURE__ */ g(
|
|
3822
3986
|
"div",
|
|
3823
3987
|
{
|
|
3824
3988
|
role: "status",
|
|
@@ -3830,117 +3994,83 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3830
3994
|
" ",
|
|
3831
3995
|
/* @__PURE__ */ g("span", { className: "text-warning-foreground/80", children: [
|
|
3832
3996
|
"· ",
|
|
3833
|
-
|
|
3997
|
+
We
|
|
3834
3998
|
] })
|
|
3835
3999
|
] })
|
|
3836
4000
|
]
|
|
3837
4001
|
}
|
|
3838
4002
|
),
|
|
3839
4003
|
/* @__PURE__ */ g("div", { className: "relative flex min-h-0 flex-1", children: [
|
|
3840
|
-
/* @__PURE__ */
|
|
3841
|
-
|
|
4004
|
+
/* @__PURE__ */ r(
|
|
4005
|
+
$o,
|
|
3842
4006
|
{
|
|
3843
4007
|
ref: N,
|
|
3844
|
-
onZoom:
|
|
4008
|
+
onZoom: L,
|
|
3845
4009
|
fitKey: [
|
|
3846
4010
|
l,
|
|
3847
|
-
|
|
4011
|
+
D ? "" : `${Y.width}x${Y.height}`,
|
|
3848
4012
|
J ? "compare" : "single",
|
|
3849
4013
|
ne?.style ?? ""
|
|
3850
4014
|
].join(":"),
|
|
3851
|
-
children: [
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
4015
|
+
children: /* @__PURE__ */ g("div", { className: "flex flex-col gap-2", children: [
|
|
4016
|
+
/* @__PURE__ */ g("div", { className: "flex items-start gap-16", children: [
|
|
4017
|
+
J && /* @__PURE__ */ r(
|
|
4018
|
+
Zt,
|
|
4019
|
+
{
|
|
4020
|
+
label: J.label,
|
|
4021
|
+
width: Y.width,
|
|
4022
|
+
height: Y.height,
|
|
4023
|
+
title: J.title,
|
|
4024
|
+
src: "src" in J ? J.src : void 0,
|
|
4025
|
+
image: "image" in J ? J.image : void 0,
|
|
4026
|
+
presentation: w?.type === "surface" && !V ? w.surface.presentation : ne,
|
|
4027
|
+
hostState: ve,
|
|
4028
|
+
delegate: E,
|
|
4029
|
+
reloadKey: M,
|
|
4030
|
+
empty: "empty" in J ? J.empty : void 0,
|
|
4031
|
+
chrome: ye,
|
|
4032
|
+
landscape: x,
|
|
4033
|
+
theme: s
|
|
4034
|
+
}
|
|
4035
|
+
),
|
|
4036
|
+
/* @__PURE__ */ r(
|
|
4037
|
+
Zt,
|
|
4038
|
+
{
|
|
4039
|
+
label: J ? t.label ?? "Local" : void 0,
|
|
4040
|
+
width: Y.width,
|
|
4041
|
+
height: Y.height,
|
|
4042
|
+
title: `${t.id} preview`,
|
|
4043
|
+
src: O,
|
|
4044
|
+
presentation: ne,
|
|
4045
|
+
hostState: ve,
|
|
4046
|
+
delegate: E,
|
|
4047
|
+
reloadKey: M,
|
|
4048
|
+
chrome: ye,
|
|
4049
|
+
landscape: x,
|
|
4050
|
+
theme: s,
|
|
4051
|
+
onResize: D ? (y) => p(x ? { width: y.height, height: y.width } : y) : void 0,
|
|
4052
|
+
canvas: N
|
|
4053
|
+
}
|
|
4054
|
+
)
|
|
4055
|
+
] }),
|
|
4056
|
+
/* @__PURE__ */ r(mi, { children: /* @__PURE__ */ g("label", { className: "flex cursor-pointer items-center gap-2 py-1 text-sm text-fg-secondary select-none", children: [
|
|
4057
|
+
/* @__PURE__ */ r(
|
|
4058
|
+
Bn,
|
|
4059
|
+
{
|
|
4060
|
+
label: "Introductory offer",
|
|
4061
|
+
checked: Ne(ve),
|
|
4062
|
+
onChange: (y) => b((H) => ({ ...H, introductoryOfferEligible: y }))
|
|
4063
|
+
}
|
|
4064
|
+
),
|
|
4065
|
+
"Introductory offer"
|
|
4066
|
+
] }) })
|
|
4067
|
+
] })
|
|
3891
4068
|
}
|
|
3892
4069
|
),
|
|
3893
|
-
/* @__PURE__ */ r(
|
|
4070
|
+
/* @__PURE__ */ r(Ks, { open: m, title: "Variables", onClose: () => v(!1), children: /* @__PURE__ */ r(oi, { overrides: u, groups: Xn, onChange: b }) })
|
|
3894
4071
|
] }),
|
|
3895
|
-
/* @__PURE__ */ g(
|
|
3896
|
-
/* @__PURE__ */ r(
|
|
3897
|
-
zn,
|
|
3898
|
-
{
|
|
3899
|
-
label: "Introductory offer",
|
|
3900
|
-
checked: Ne(ve),
|
|
3901
|
-
onChange: (y) => b((D) => ({ ...D, introductoryOfferEligible: y }))
|
|
3902
|
-
}
|
|
3903
|
-
) }),
|
|
3904
|
-
/* @__PURE__ */ g(Ce, { label: "Theme", children: [
|
|
3905
|
-
/* @__PURE__ */ r(
|
|
3906
|
-
Fs,
|
|
3907
|
-
{
|
|
3908
|
-
label: "Theme",
|
|
3909
|
-
value: s,
|
|
3910
|
-
options: [
|
|
3911
|
-
{ value: "light", label: /* @__PURE__ */ r($r, {}), name: "Light" },
|
|
3912
|
-
{ value: "dark", label: /* @__PURE__ */ r(Dr, {}), name: "Dark" }
|
|
3913
|
-
],
|
|
3914
|
-
onChange: i
|
|
3915
|
-
}
|
|
3916
|
-
),
|
|
3917
|
-
/* @__PURE__ */ r(
|
|
3918
|
-
we,
|
|
3919
|
-
{
|
|
3920
|
-
side: "top",
|
|
3921
|
-
align: "center",
|
|
3922
|
-
hint: C ? "Back to portrait" : "Rotate to landscape",
|
|
3923
|
-
children: /* @__PURE__ */ r(
|
|
3924
|
-
"button",
|
|
3925
|
-
{
|
|
3926
|
-
type: "button",
|
|
3927
|
-
className: "sw-btn sw-btn--icon",
|
|
3928
|
-
"aria-label": "Rotate device",
|
|
3929
|
-
"aria-pressed": C,
|
|
3930
|
-
onClick: () => I((y) => !y),
|
|
3931
|
-
children: /* @__PURE__ */ r(
|
|
3932
|
-
jr,
|
|
3933
|
-
{
|
|
3934
|
-
className: `transition-disclosure ${C ? "-rotate-90" : ""}`
|
|
3935
|
-
}
|
|
3936
|
-
)
|
|
3937
|
-
}
|
|
3938
|
-
)
|
|
3939
|
-
}
|
|
3940
|
-
)
|
|
3941
|
-
] }),
|
|
3942
|
-
/* @__PURE__ */ r(Vt, {}),
|
|
3943
|
-
/* @__PURE__ */ r(Ce, { label: "Zoom", children: /* @__PURE__ */ g(
|
|
4072
|
+
/* @__PURE__ */ g(Zs, { children: [
|
|
4073
|
+
/* @__PURE__ */ r(Je, { label: "Zoom", children: /* @__PURE__ */ g(
|
|
3944
4074
|
"div",
|
|
3945
4075
|
{
|
|
3946
4076
|
className: "flex h-8 flex-none overflow-hidden rounded-sm border border-border transition-colors duration-hover has-[:focus-visible]:border-primary",
|
|
@@ -3954,7 +4084,7 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3954
4084
|
className: Gt,
|
|
3955
4085
|
"aria-label": "Zoom out",
|
|
3956
4086
|
onClick: () => N.current?.zoomStep(-1),
|
|
3957
|
-
children: /* @__PURE__ */ r(
|
|
4087
|
+
children: /* @__PURE__ */ r(Gr, { className: "icon-tertiary" })
|
|
3958
4088
|
}
|
|
3959
4089
|
),
|
|
3960
4090
|
/* @__PURE__ */ r(
|
|
@@ -3963,9 +4093,9 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3963
4093
|
type: "button",
|
|
3964
4094
|
className: "min-w-14 border-x border-border px-2 text-sm tabular-nums outline-none transition-colors duration-hover hover:bg-accent focus-visible:bg-accent",
|
|
3965
4095
|
"aria-label": "Fit to view",
|
|
3966
|
-
"aria-pressed":
|
|
4096
|
+
"aria-pressed": A.fitted,
|
|
3967
4097
|
onClick: () => N.current?.fit(),
|
|
3968
|
-
children:
|
|
4098
|
+
children: Eo(A.scale)
|
|
3969
4099
|
}
|
|
3970
4100
|
),
|
|
3971
4101
|
/* @__PURE__ */ r(
|
|
@@ -3975,64 +4105,101 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
3975
4105
|
className: Gt,
|
|
3976
4106
|
"aria-label": "Zoom in",
|
|
3977
4107
|
onClick: () => N.current?.zoomStep(1),
|
|
3978
|
-
children: /* @__PURE__ */ r(
|
|
4108
|
+
children: /* @__PURE__ */ r(Xr, { className: "icon-tertiary" })
|
|
3979
4109
|
}
|
|
3980
4110
|
)
|
|
3981
4111
|
]
|
|
3982
4112
|
}
|
|
3983
4113
|
) }),
|
|
3984
|
-
/* @__PURE__ */
|
|
4114
|
+
/* @__PURE__ */ r(jt, {}),
|
|
4115
|
+
/* @__PURE__ */ g(Je, { label: "Device", children: [
|
|
3985
4116
|
/* @__PURE__ */ r(
|
|
3986
|
-
|
|
4117
|
+
Ut,
|
|
3987
4118
|
{
|
|
3988
4119
|
label: "Device",
|
|
3989
4120
|
value: l,
|
|
3990
4121
|
options: [
|
|
3991
|
-
...
|
|
3992
|
-
{ value:
|
|
4122
|
+
...He.map((y) => ({ value: y.id, label: y.name })),
|
|
4123
|
+
{ value: Kt, label: "Responsive" }
|
|
3993
4124
|
],
|
|
3994
4125
|
onChange: c
|
|
3995
4126
|
}
|
|
3996
4127
|
),
|
|
3997
|
-
|
|
4128
|
+
/* @__PURE__ */ r(
|
|
4129
|
+
we,
|
|
4130
|
+
{
|
|
4131
|
+
side: "top",
|
|
4132
|
+
align: "center",
|
|
4133
|
+
hint: x ? "Back to portrait" : "Rotate to landscape",
|
|
4134
|
+
children: /* @__PURE__ */ r(
|
|
4135
|
+
"button",
|
|
4136
|
+
{
|
|
4137
|
+
type: "button",
|
|
4138
|
+
className: "sw-btn sw-btn--icon",
|
|
4139
|
+
"aria-label": "Rotate device",
|
|
4140
|
+
"aria-pressed": x,
|
|
4141
|
+
onClick: () => _((y) => !y),
|
|
4142
|
+
children: /* @__PURE__ */ r(
|
|
4143
|
+
Kr,
|
|
4144
|
+
{
|
|
4145
|
+
className: `transition-disclosure ${x ? "-rotate-90" : ""}`
|
|
4146
|
+
}
|
|
4147
|
+
)
|
|
4148
|
+
}
|
|
4149
|
+
)
|
|
4150
|
+
}
|
|
4151
|
+
),
|
|
4152
|
+
/* @__PURE__ */ r(
|
|
4153
|
+
js,
|
|
4154
|
+
{
|
|
4155
|
+
label: "Theme",
|
|
4156
|
+
value: s,
|
|
4157
|
+
options: [
|
|
4158
|
+
{ value: "light", label: /* @__PURE__ */ r(zr, {}), name: "Light" },
|
|
4159
|
+
{ value: "dark", label: /* @__PURE__ */ r(Fr, {}), name: "Dark" }
|
|
4160
|
+
],
|
|
4161
|
+
onChange: i
|
|
4162
|
+
}
|
|
4163
|
+
),
|
|
4164
|
+
D && /* @__PURE__ */ g("span", { className: "flex items-center gap-1.5", children: [
|
|
3998
4165
|
/* @__PURE__ */ r(
|
|
3999
|
-
|
|
4166
|
+
Xt,
|
|
4000
4167
|
{
|
|
4001
4168
|
label: "Preview width",
|
|
4002
|
-
value:
|
|
4003
|
-
onCommit: (y) => p((
|
|
4169
|
+
value: Y.width,
|
|
4170
|
+
onCommit: (y) => p((H) => ({ ...H, width: y }))
|
|
4004
4171
|
}
|
|
4005
4172
|
),
|
|
4006
4173
|
/* @__PURE__ */ r("span", { className: "text-fg-tertiary", children: "×" }),
|
|
4007
4174
|
/* @__PURE__ */ r(
|
|
4008
|
-
|
|
4175
|
+
Xt,
|
|
4009
4176
|
{
|
|
4010
4177
|
label: "Preview height",
|
|
4011
|
-
value:
|
|
4012
|
-
onCommit: (y) => p((
|
|
4178
|
+
value: Y.height,
|
|
4179
|
+
onCommit: (y) => p((H) => ({ ...H, height: y }))
|
|
4013
4180
|
}
|
|
4014
4181
|
)
|
|
4015
4182
|
] })
|
|
4016
4183
|
] }),
|
|
4017
|
-
|
|
4018
|
-
|
|
4184
|
+
$.length > 1 && /* @__PURE__ */ r(Je, { label: "Locale", children: /* @__PURE__ */ r(
|
|
4185
|
+
Ut,
|
|
4019
4186
|
{
|
|
4020
4187
|
label: "Locale",
|
|
4021
4188
|
value: a ?? "default",
|
|
4022
4189
|
options: [
|
|
4023
4190
|
{ value: "default", label: "Device" },
|
|
4024
|
-
|
|
4191
|
+
...$.map((y) => ({ value: y, label: y }))
|
|
4025
4192
|
],
|
|
4026
4193
|
onChange: (y) => d(y === "default" ? void 0 : y)
|
|
4027
4194
|
}
|
|
4028
4195
|
) }),
|
|
4029
|
-
/* @__PURE__ */ r(
|
|
4030
|
-
(
|
|
4031
|
-
|
|
4196
|
+
/* @__PURE__ */ r(jt, {}),
|
|
4197
|
+
(G || wt.length > 0) && /* @__PURE__ */ r(
|
|
4198
|
+
vo,
|
|
4032
4199
|
{
|
|
4033
4200
|
active: w,
|
|
4034
|
-
options:
|
|
4035
|
-
notice:
|
|
4201
|
+
options: wt,
|
|
4202
|
+
notice: vt,
|
|
4036
4203
|
onSelect: S
|
|
4037
4204
|
}
|
|
4038
4205
|
),
|
|
@@ -4044,15 +4211,15 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
4044
4211
|
"aria-expanded": m,
|
|
4045
4212
|
onClick: () => v((y) => !y),
|
|
4046
4213
|
children: [
|
|
4047
|
-
/* @__PURE__ */ r(
|
|
4214
|
+
/* @__PURE__ */ r(Ur, {}),
|
|
4048
4215
|
"Variables",
|
|
4049
|
-
|
|
4216
|
+
yt > 0 && /* @__PURE__ */ r("span", { className: "text-primary tabular-nums", children: yt })
|
|
4050
4217
|
]
|
|
4051
4218
|
}
|
|
4052
4219
|
)
|
|
4053
4220
|
] })
|
|
4054
4221
|
] });
|
|
4055
|
-
},
|
|
4222
|
+
}, qt = ({
|
|
4056
4223
|
icon: e,
|
|
4057
4224
|
title: t,
|
|
4058
4225
|
description: n,
|
|
@@ -4072,16 +4239,16 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
4072
4239
|
n !== void 0 && /* @__PURE__ */ r("p", { className: "m-0 text-sm text-fg-secondary", children: n })
|
|
4073
4240
|
] }),
|
|
4074
4241
|
o !== void 0 && /* @__PURE__ */ r("div", { className: "flex flex-wrap justify-center gap-2", children: o })
|
|
4075
|
-
] }),
|
|
4076
|
-
const [n, o] = f.useState(
|
|
4242
|
+
] }), bi = ({ origin: e, scheme: t }) => {
|
|
4243
|
+
const [n, o] = f.useState(zn), l = n ?? t, c = (p) => {
|
|
4077
4244
|
const i = window.prompt("Your app’s URL scheme, so this can open it:", p)?.trim();
|
|
4078
4245
|
if (!(i === void 0 || i === ""))
|
|
4079
|
-
return o(i),
|
|
4246
|
+
return o(i), Fn(i), i;
|
|
4080
4247
|
}, h = (p) => {
|
|
4081
4248
|
if (l !== void 0) return;
|
|
4082
4249
|
p.preventDefault();
|
|
4083
4250
|
const s = c("");
|
|
4084
|
-
s !== void 0 && window.location.assign(
|
|
4251
|
+
s !== void 0 && window.location.assign(at(s, e));
|
|
4085
4252
|
};
|
|
4086
4253
|
return /* @__PURE__ */ g("div", { className: "flex items-center gap-2", children: [
|
|
4087
4254
|
l !== void 0 && /* @__PURE__ */ r(we, { hint: "Edit app URL scheme", children: /* @__PURE__ */ r(
|
|
@@ -4091,20 +4258,20 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
4091
4258
|
type: "button",
|
|
4092
4259
|
"aria-label": "Edit app URL scheme",
|
|
4093
4260
|
onClick: () => c(l),
|
|
4094
|
-
children: /* @__PURE__ */ r(
|
|
4261
|
+
children: /* @__PURE__ */ r(Qr, {})
|
|
4095
4262
|
}
|
|
4096
4263
|
) }),
|
|
4097
4264
|
/* @__PURE__ */ r(
|
|
4098
4265
|
"a",
|
|
4099
4266
|
{
|
|
4100
4267
|
className: "sw-btn sw-btn--sm sw-btn--primary",
|
|
4101
|
-
href: l === void 0 ? "#" :
|
|
4268
|
+
href: l === void 0 ? "#" : at(l, e),
|
|
4102
4269
|
onClick: h,
|
|
4103
4270
|
children: "Open in app"
|
|
4104
4271
|
}
|
|
4105
4272
|
)
|
|
4106
4273
|
] });
|
|
4107
|
-
},
|
|
4274
|
+
}, wi = { ios: "iOS", android: "Android", web: "Web" }, Jt = 390, vi = 844, yi = (e) => {
|
|
4108
4275
|
const [t, n] = f.useState(0);
|
|
4109
4276
|
return f.useLayoutEffect(() => {
|
|
4110
4277
|
const o = e.current;
|
|
@@ -4114,7 +4281,7 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
4114
4281
|
const c = new ResizeObserver(l);
|
|
4115
4282
|
return c.observe(o), () => c.disconnect();
|
|
4116
4283
|
}, [e]), t;
|
|
4117
|
-
},
|
|
4284
|
+
}, xi = ({
|
|
4118
4285
|
surface: e,
|
|
4119
4286
|
status: t,
|
|
4120
4287
|
previewSrc: n,
|
|
@@ -4122,10 +4289,10 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
4122
4289
|
onOpen: l,
|
|
4123
4290
|
href: c
|
|
4124
4291
|
}) => {
|
|
4125
|
-
const h = f.useRef(null), p =
|
|
4292
|
+
const h = f.useRef(null), p = yi(h), s = p > 0 ? p / Jt : 0, i = f.useMemo(gr, []), a = [
|
|
4126
4293
|
e.label === void 0 ? e.project : `${e.project ? `${e.project}/` : ""}${e.id}`,
|
|
4127
|
-
...(e.platforms ?? []).map((d) =>
|
|
4128
|
-
t && (t.updatedAt ? `Edited ${
|
|
4294
|
+
...(e.platforms ?? []).map((d) => wi[d] ?? d),
|
|
4295
|
+
t && (t.updatedAt ? `Edited ${dt(t.updatedAt)}` : "Not published")
|
|
4129
4296
|
].filter((d) => !!d);
|
|
4130
4297
|
return /* @__PURE__ */ g(
|
|
4131
4298
|
"a",
|
|
@@ -4142,7 +4309,7 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
4142
4309
|
className: "relative aspect-[390/844] overflow-hidden rounded-sm border border-border bg-card",
|
|
4143
4310
|
ref: h,
|
|
4144
4311
|
children: s > 0 && /* @__PURE__ */ r(
|
|
4145
|
-
|
|
4312
|
+
xn,
|
|
4146
4313
|
{
|
|
4147
4314
|
hostState: o,
|
|
4148
4315
|
delegate: i,
|
|
@@ -4151,8 +4318,8 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
4151
4318
|
src: n,
|
|
4152
4319
|
loading: "lazy",
|
|
4153
4320
|
tabIndex: -1,
|
|
4154
|
-
width:
|
|
4155
|
-
height:
|
|
4321
|
+
width: Jt,
|
|
4322
|
+
height: vi,
|
|
4156
4323
|
style: { transform: `scale(${s})` }
|
|
4157
4324
|
}
|
|
4158
4325
|
)
|
|
@@ -4161,7 +4328,7 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
4161
4328
|
/* @__PURE__ */ g("div", { className: "flex min-w-0 flex-col", children: [
|
|
4162
4329
|
/* @__PURE__ */ g("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
4163
4330
|
/* @__PURE__ */ r("span", { className: "min-w-0 flex-1 truncate text-sm font-medium", children: e.label ?? e.id }),
|
|
4164
|
-
t?.paywallId && /* @__PURE__ */ r(
|
|
4331
|
+
t?.paywallId && /* @__PURE__ */ r(Ys, { variant: t.active ? "success" : "outline", children: t.active ? "Active" : "Inactive" })
|
|
4165
4332
|
] }),
|
|
4166
4333
|
a.length > 0 && /* @__PURE__ */ r("span", { className: "truncate text-xs/4 text-fg-tertiary", children: a.map((d, u) => /* @__PURE__ */ g(f.Fragment, { children: [
|
|
4167
4334
|
u > 0 && /* @__PURE__ */ r("span", { className: "text-fg-muted", "aria-hidden": "true", children: " · " }),
|
|
@@ -4172,12 +4339,12 @@ const Tn = "superwall-device-scheme", $n = () => {
|
|
|
4172
4339
|
}
|
|
4173
4340
|
);
|
|
4174
4341
|
};
|
|
4175
|
-
let
|
|
4176
|
-
const
|
|
4342
|
+
let en = 0;
|
|
4343
|
+
const Ci = ({
|
|
4177
4344
|
source: e,
|
|
4178
4345
|
onOpen: t
|
|
4179
4346
|
}) => {
|
|
4180
|
-
const n =
|
|
4347
|
+
const n = gt() === "device", o = e.actions, [l, c] = f.useState({}), h = f.useMemo(Wn, [e]);
|
|
4181
4348
|
f.useEffect(() => {
|
|
4182
4349
|
if (!o) return;
|
|
4183
4350
|
let u = !1;
|
|
@@ -4193,9 +4360,9 @@ const gi = ({
|
|
|
4193
4360
|
f.useLayoutEffect(() => {
|
|
4194
4361
|
const u = i.current;
|
|
4195
4362
|
if (!u) return;
|
|
4196
|
-
u.scrollTop =
|
|
4363
|
+
u.scrollTop = en;
|
|
4197
4364
|
const b = () => {
|
|
4198
|
-
|
|
4365
|
+
en = u.scrollTop;
|
|
4199
4366
|
};
|
|
4200
4367
|
return u.addEventListener("scroll", b, { passive: !0 }), () => {
|
|
4201
4368
|
b(), u.removeEventListener("scroll", b);
|
|
@@ -4216,12 +4383,12 @@ const gi = ({
|
|
|
4216
4383
|
)
|
|
4217
4384
|
};
|
|
4218
4385
|
}).filter((u) => u.all.length > 0), d = (u) => s((b) => ({ ...b, [u]: "" }));
|
|
4219
|
-
return /* @__PURE__ */ g(
|
|
4386
|
+
return /* @__PURE__ */ g(Z, { children: [
|
|
4220
4387
|
/* @__PURE__ */ r(
|
|
4221
|
-
|
|
4388
|
+
Vn,
|
|
4222
4389
|
{
|
|
4223
4390
|
label: n ? "Preview" : void 0,
|
|
4224
|
-
actions: n ? /* @__PURE__ */ r(
|
|
4391
|
+
actions: n ? /* @__PURE__ */ r(bi, { origin: window.location.origin, scheme: e.scheme }) : void 0
|
|
4225
4392
|
}
|
|
4226
4393
|
),
|
|
4227
4394
|
/* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto", ref: i, children: /* @__PURE__ */ g("div", { className: "mx-auto flex w-full max-w-[1440px] flex-col gap-6 p-3 sm:p-6 lg:p-10", children: [
|
|
@@ -4258,7 +4425,7 @@ const gi = ({
|
|
|
4258
4425
|
/* @__PURE__ */ r("span", { className: "font-normal text-fg-tertiary tabular-nums", children: u.surfaces.length })
|
|
4259
4426
|
] }),
|
|
4260
4427
|
u.all.length > 1 && /* @__PURE__ */ g("label", { className: "relative flex w-full items-center sm:w-56", children: [
|
|
4261
|
-
/* @__PURE__ */ r(
|
|
4428
|
+
/* @__PURE__ */ r(Ae, { className: "icon-tertiary pointer-events-none absolute left-[calc(--spacing(2.5)-1px)]" }),
|
|
4262
4429
|
/* @__PURE__ */ r(
|
|
4263
4430
|
"input",
|
|
4264
4431
|
{
|
|
@@ -4278,12 +4445,12 @@ const gi = ({
|
|
|
4278
4445
|
u.surfaces.length > 0 ? /* @__PURE__ */ r("div", { className: "-me-px -mb-px grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 2xl:grid-cols-5", children: u.surfaces.map((b) => {
|
|
4279
4446
|
const m = n ? e.standaloneUrl?.(b) : void 0;
|
|
4280
4447
|
return /* @__PURE__ */ r(
|
|
4281
|
-
|
|
4448
|
+
xi,
|
|
4282
4449
|
{
|
|
4283
4450
|
surface: b,
|
|
4284
4451
|
status: l[te(b)],
|
|
4285
4452
|
previewSrc: e.previewUrl(b),
|
|
4286
|
-
hostState:
|
|
4453
|
+
hostState: Kn({
|
|
4287
4454
|
surface: b,
|
|
4288
4455
|
defaults: h,
|
|
4289
4456
|
sourceSamples: e.samples,
|
|
@@ -4297,9 +4464,9 @@ const gi = ({
|
|
|
4297
4464
|
te(b)
|
|
4298
4465
|
);
|
|
4299
4466
|
}) }) : /* @__PURE__ */ r(
|
|
4300
|
-
|
|
4467
|
+
qt,
|
|
4301
4468
|
{
|
|
4302
|
-
icon: /* @__PURE__ */ r(
|
|
4469
|
+
icon: /* @__PURE__ */ r(Ae, {}),
|
|
4303
4470
|
title: `No ${u.label.toLowerCase()} match “${(p[u.kind] ?? "").trim()}”`,
|
|
4304
4471
|
actions: /* @__PURE__ */ r(
|
|
4305
4472
|
"button",
|
|
@@ -4317,11 +4484,11 @@ const gi = ({
|
|
|
4317
4484
|
u.kind
|
|
4318
4485
|
)),
|
|
4319
4486
|
e.surfaces.length === 0 && /* @__PURE__ */ r("div", { className: "rounded-sm border border-border bg-card", children: /* @__PURE__ */ r(
|
|
4320
|
-
|
|
4487
|
+
qt,
|
|
4321
4488
|
{
|
|
4322
|
-
icon: /* @__PURE__ */ r(
|
|
4489
|
+
icon: /* @__PURE__ */ r(qr, {}),
|
|
4323
4490
|
title: "No paywalls yet",
|
|
4324
|
-
description: /* @__PURE__ */ g(
|
|
4491
|
+
description: /* @__PURE__ */ g(Z, { children: [
|
|
4325
4492
|
"Create ",
|
|
4326
4493
|
/* @__PURE__ */ r(le, { children: "superwall/paywalls/<id>/app/page.tsx" }),
|
|
4327
4494
|
" and it appears here."
|
|
@@ -4330,13 +4497,13 @@ const gi = ({
|
|
|
4330
4497
|
) })
|
|
4331
4498
|
] }) })
|
|
4332
4499
|
] });
|
|
4333
|
-
},
|
|
4500
|
+
}, Ni = (e, t) => {
|
|
4334
4501
|
const n = t.match(/^\/(?:([a-z0-9-]+)\/)?(paywall|funnel)\/([a-z0-9-]+)\/?$/);
|
|
4335
4502
|
if (n)
|
|
4336
4503
|
return e.find(
|
|
4337
4504
|
(o) => o.kind === n[2] && o.id === n[3] && (n[1] === void 0 || o.project === n[1])
|
|
4338
4505
|
);
|
|
4339
|
-
},
|
|
4506
|
+
}, zi = ({
|
|
4340
4507
|
source: e,
|
|
4341
4508
|
mode: t = "local"
|
|
4342
4509
|
}) => {
|
|
@@ -4349,7 +4516,7 @@ const gi = ({
|
|
|
4349
4516
|
f.useEffect(() => {
|
|
4350
4517
|
if (!h) return;
|
|
4351
4518
|
let d = !1;
|
|
4352
|
-
return
|
|
4519
|
+
return ks().then((u) => {
|
|
4353
4520
|
d || c(u);
|
|
4354
4521
|
}), () => {
|
|
4355
4522
|
d = !0;
|
|
@@ -4360,48 +4527,48 @@ const gi = ({
|
|
|
4360
4527
|
}, []), i = f.useMemo(
|
|
4361
4528
|
() => ({ href: p, navigate: () => s(p) }),
|
|
4362
4529
|
[p, s]
|
|
4363
|
-
), a =
|
|
4364
|
-
return /* @__PURE__ */ r(
|
|
4365
|
-
},
|
|
4530
|
+
), a = Ni(e.surfaces, n);
|
|
4531
|
+
return /* @__PURE__ */ r(_s, { mode: t, home: i, children: /* @__PURE__ */ r(tr, { children: a ? /* @__PURE__ */ r(gi, { source: e, surface: a, samples: l }) : /* @__PURE__ */ r(Ci, { source: e, onOpen: (d) => s(te(d)) }) }) });
|
|
4532
|
+
}, Ei = (e) => typeof e == "object" && e !== null && !Array.isArray(e) && Object.values(e).every((t) => typeof t == "string"), ae = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Le = (e) => Array.isArray(e) && e.every((t) => typeof t == "string"), Si = (e) => {
|
|
4366
4533
|
if (!ae(e)) return;
|
|
4367
4534
|
const t = e.kind === "paywall" || e.kind === "funnel" ? e.kind : void 0;
|
|
4368
4535
|
if (!t || typeof e.id != "string") return;
|
|
4369
|
-
const n =
|
|
4536
|
+
const n = Zo(
|
|
4370
4537
|
ae(e.settings) ? e.settings.presentation_style : void 0
|
|
4371
|
-
), o =
|
|
4538
|
+
), o = Ii(e.origin);
|
|
4372
4539
|
return {
|
|
4373
4540
|
kind: t,
|
|
4374
4541
|
id: e.id,
|
|
4375
4542
|
...typeof e.project == "string" ? { project: e.project } : {},
|
|
4376
4543
|
...typeof e.label == "string" && e.label !== "" ? { label: e.label } : {},
|
|
4377
4544
|
routes: Le(e.routes) ? e.routes : [],
|
|
4378
|
-
products:
|
|
4545
|
+
products: Ei(e.products) ? e.products : {},
|
|
4379
4546
|
locales: Le(e.locales) ? e.locales : [],
|
|
4380
4547
|
...Le(e.platforms) ? { platforms: e.platforms } : {},
|
|
4381
4548
|
...n === void 0 ? {} : { presentation: n },
|
|
4382
4549
|
paywallId: typeof e.paywallId == "string" ? e.paywallId : void 0,
|
|
4383
4550
|
...o === void 0 ? {} : { origin: o }
|
|
4384
4551
|
};
|
|
4385
|
-
},
|
|
4552
|
+
}, Mi = (e) => typeof e == "string" && e !== "" && !/[\\/]/.test(e) && !e.startsWith("."), ki = /* @__PURE__ */ new Set([
|
|
4386
4553
|
"swiftui",
|
|
4387
4554
|
"uikit",
|
|
4388
4555
|
"compose",
|
|
4389
4556
|
"android-views",
|
|
4390
4557
|
"react-native",
|
|
4391
4558
|
"flutter"
|
|
4392
|
-
]),
|
|
4559
|
+
]), Ii = (e) => {
|
|
4393
4560
|
if (ae(e)) {
|
|
4394
4561
|
if (typeof e.paywallId == "string" && typeof e.url == "string")
|
|
4395
4562
|
return { paywallId: e.paywallId, url: e.url };
|
|
4396
|
-
if (typeof e.path == "string" && typeof e.framework == "string" &&
|
|
4563
|
+
if (typeof e.path == "string" && typeof e.framework == "string" && ki.has(e.framework)) {
|
|
4397
4564
|
const t = e.framework;
|
|
4398
|
-
return
|
|
4565
|
+
return Mi(e.screenshot) ? { path: e.path, framework: t, screenshot: e.screenshot } : { path: e.path, framework: t };
|
|
4399
4566
|
}
|
|
4400
4567
|
}
|
|
4401
|
-
},
|
|
4568
|
+
}, Fi = (e) => {
|
|
4402
4569
|
if (!ae(e))
|
|
4403
4570
|
throw new Error("project payload is not an object");
|
|
4404
|
-
const t = Array.isArray(e.surfaces) ? e.surfaces.map(
|
|
4571
|
+
const t = Array.isArray(e.surfaces) ? e.surfaces.map(Si).filter((c) => c !== void 0) : [], n = ae(e.capabilities) ? e.capabilities : {}, o = ae(e.samples) ? e.samples : {}, l = (c) => ae(o[c]) ? o[c] : {};
|
|
4405
4572
|
return {
|
|
4406
4573
|
title: typeof e.title == "string" ? e.title : "superwall",
|
|
4407
4574
|
scheme: typeof e.scheme == "string" ? e.scheme : void 0,
|
|
@@ -4417,44 +4584,44 @@ const gi = ({
|
|
|
4417
4584
|
};
|
|
4418
4585
|
};
|
|
4419
4586
|
export {
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4587
|
+
jn as DEFAULT_DEVICE_ID,
|
|
4588
|
+
es as DeviceFrame,
|
|
4589
|
+
Ls as DownloadScreenshot,
|
|
4590
|
+
xn as HostedIframe,
|
|
4591
|
+
Cs as PaywallToasts,
|
|
4592
|
+
Vs as PreviewOnDevice,
|
|
4593
|
+
He as STUDIO_DEVICES,
|
|
4594
|
+
js as Segmented,
|
|
4595
|
+
Ut as Select,
|
|
4596
|
+
zi as StudioApp,
|
|
4597
|
+
_s as StudioHostProvider,
|
|
4598
|
+
tr as StudioShell,
|
|
4599
|
+
gi as SurfaceEditor,
|
|
4600
|
+
Ci as SurfaceList,
|
|
4601
|
+
Bn as Switch,
|
|
4435
4602
|
we as Tooltip,
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4603
|
+
Vn as TopBar,
|
|
4604
|
+
oi as VariablesPanel,
|
|
4605
|
+
Ai as buildPreviewPath,
|
|
4606
|
+
tn as createHostState,
|
|
4607
|
+
ys as createStudioDelegate,
|
|
4608
|
+
Ti as devServerActions,
|
|
4609
|
+
at as devServerLink,
|
|
4610
|
+
pi as deviceById,
|
|
4611
|
+
rr as diffHostState,
|
|
4612
|
+
Hi as hasActions,
|
|
4446
4613
|
Ne as hasIntroductoryOffer,
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4614
|
+
Kn as hostStateFor,
|
|
4615
|
+
mt as hostedUrl,
|
|
4616
|
+
lo as latestVersion,
|
|
4617
|
+
ao as liveVersion,
|
|
4618
|
+
Fi as parseProjectPayload,
|
|
4619
|
+
co as promotionDirection,
|
|
4620
|
+
gr as silentDelegate,
|
|
4621
|
+
Oi as snapshotPreviewUrl,
|
|
4622
|
+
Wn as studioDefaults,
|
|
4456
4623
|
te as surfacePath,
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4624
|
+
xs as useStudioDelegate,
|
|
4625
|
+
Rs as useStudioHome,
|
|
4626
|
+
gt as useStudioMode
|
|
4460
4627
|
};
|