@onside/install-widget 1.0.4 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist-lib/AndroidPlatformModal-Bo8KL9YE.cjs +1 -0
  2. package/dist-lib/AndroidPlatformModal-DGNUxRkK.js +48 -0
  3. package/dist-lib/CheckInstallModal-BAx1q0Eh.js +76 -0
  4. package/dist-lib/CheckInstallModal-CamMs4Ky.cjs +1 -0
  5. package/dist-lib/Dialog-BpvFTl3s.js +95 -0
  6. package/dist-lib/Dialog-H1GsCMbd.cjs +1 -0
  7. package/dist-lib/FaqModal-B6YPov5t.js +103 -0
  8. package/dist-lib/FaqModal-BYENishJ.cjs +1 -0
  9. package/dist-lib/GoToSafariModal-B1EWxzWE.cjs +1 -0
  10. package/dist-lib/{GoToSafariModal-C_KBizh8.js → GoToSafariModal-pXhEb2yy.js} +36 -36
  11. package/dist-lib/UpdateIOSModal-B-jqDkQO.cjs +1 -0
  12. package/dist-lib/UpdateIOSModal-D-cikTQ4.js +81 -0
  13. package/dist-lib/cdn-DQucWvIe.js +99 -0
  14. package/dist-lib/cdn-ToXHpWOt.cjs +1 -0
  15. package/dist-lib/hooks.cjs +1 -1
  16. package/dist-lib/hooks.js +4 -3
  17. package/dist-lib/index-BqoWsHcB.js +195 -0
  18. package/dist-lib/index-DFXiHkdo.cjs +1 -0
  19. package/dist-lib/install-package-5TE9fTFQ.cjs +1 -0
  20. package/dist-lib/install-package-S3saul1C.js +451 -0
  21. package/dist-lib/install-package.cjs +1 -1
  22. package/dist-lib/install-package.d.ts +82 -17
  23. package/dist-lib/install-package.js +14 -12
  24. package/dist-lib/install-widget.css +1 -1
  25. package/dist-lib/useInstallUrl-McaAuMPK.js +65 -0
  26. package/dist-lib/useInstallUrl-iPCPqYWB.cjs +1 -0
  27. package/package.json +12 -4
  28. package/dist-lib/AndroidPlatformModal-2Ykjo2V7.js +0 -48
  29. package/dist-lib/AndroidPlatformModal-DTglyxUG.cjs +0 -1
  30. package/dist-lib/Dialog-yEP-7Deb.js +0 -1399
  31. package/dist-lib/Dialog-yZ9bWtK1.cjs +0 -45
  32. package/dist-lib/GoToSafariModal-Cgx0X0rg.cjs +0 -1
  33. package/dist-lib/UpdateIOSModal-BGWvssyd.js +0 -170
  34. package/dist-lib/UpdateIOSModal-CE-d3YCr.cjs +0 -1
  35. package/dist-lib/install-package-B17QfMPy.cjs +0 -1
  36. package/dist-lib/install-package-DowlG4hO.js +0 -3036
  37. package/dist-lib/useInstallUrl-CjUspi0p.cjs +0 -1
  38. package/dist-lib/useInstallUrl-JIdkWpgj.js +0 -87
@@ -1,1399 +0,0 @@
1
- import { jsx as h, jsxs as F, Fragment as ve } from "react/jsx-runtime";
2
- import * as i from "react";
3
- import { useState as Ae, forwardRef as st, useEffect as ct } from "react";
4
- import * as ut from "react-dom";
5
- import lt from "react-dom";
6
- import { a as me, B as dt } from "./install-package-DowlG4hO.js";
7
- function T(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
8
- return function(o) {
9
- if (e?.(o), n === !1 || !o.defaultPrevented)
10
- return t?.(o);
11
- };
12
- }
13
- function pe(e, t) {
14
- if (typeof e == "function")
15
- return e(t);
16
- e != null && (e.current = t);
17
- }
18
- function xe(...e) {
19
- return (t) => {
20
- let n = !1;
21
- const r = e.map((o) => {
22
- const a = pe(o, t);
23
- return !n && typeof a == "function" && (n = !0), a;
24
- });
25
- if (n)
26
- return () => {
27
- for (let o = 0; o < r.length; o++) {
28
- const a = r[o];
29
- typeof a == "function" ? a() : pe(e[o], null);
30
- }
31
- };
32
- };
33
- }
34
- function M(...e) {
35
- return i.useCallback(xe(...e), e);
36
- }
37
- function ft(e, t) {
38
- const n = i.createContext(t), r = (a) => {
39
- const { children: c, ...s } = a, d = i.useMemo(() => s, Object.values(s));
40
- return /* @__PURE__ */ h(n.Provider, { value: d, children: c });
41
- };
42
- r.displayName = e + "Provider";
43
- function o(a) {
44
- const c = i.useContext(n);
45
- if (c) return c;
46
- if (t !== void 0) return t;
47
- throw new Error(`\`${a}\` must be used within \`${e}\``);
48
- }
49
- return [r, o];
50
- }
51
- function vt(e, t = []) {
52
- let n = [];
53
- function r(a, c) {
54
- const s = i.createContext(c), d = n.length;
55
- n = [...n, c];
56
- const l = (v) => {
57
- const { scope: m, children: p, ...b } = v, u = m?.[e]?.[d] || s, g = i.useMemo(() => b, Object.values(b));
58
- return /* @__PURE__ */ h(u.Provider, { value: g, children: p });
59
- };
60
- l.displayName = a + "Provider";
61
- function f(v, m) {
62
- const p = m?.[e]?.[d] || s, b = i.useContext(p);
63
- if (b) return b;
64
- if (c !== void 0) return c;
65
- throw new Error(`\`${v}\` must be used within \`${a}\``);
66
- }
67
- return [l, f];
68
- }
69
- const o = () => {
70
- const a = n.map((c) => i.createContext(c));
71
- return function(s) {
72
- const d = s?.[e] || a;
73
- return i.useMemo(
74
- () => ({ [`__scope${e}`]: { ...s, [e]: d } }),
75
- [s, d]
76
- );
77
- };
78
- };
79
- return o.scopeName = e, [r, mt(o, ...t)];
80
- }
81
- function mt(...e) {
82
- const t = e[0];
83
- if (e.length === 1) return t;
84
- const n = () => {
85
- const r = e.map((o) => ({
86
- useScope: o(),
87
- scopeName: o.scopeName
88
- }));
89
- return function(a) {
90
- const c = r.reduce((s, { useScope: d, scopeName: l }) => {
91
- const v = d(a)[`__scope${l}`];
92
- return { ...s, ...v };
93
- }, {});
94
- return i.useMemo(() => ({ [`__scope${t.scopeName}`]: c }), [c]);
95
- };
96
- };
97
- return n.scopeName = t.scopeName, n;
98
- }
99
- var U = globalThis?.document ? i.useLayoutEffect : () => {
100
- }, pt = i[" useId ".trim().toString()] || (() => {
101
- }), ht = 0;
102
- function ee(e) {
103
- const [t, n] = i.useState(pt());
104
- return U(() => {
105
- n((r) => r ?? String(ht++));
106
- }, [e]), e || (t ? `radix-${t}` : "");
107
- }
108
- var gt = i[" useInsertionEffect ".trim().toString()] || U;
109
- function yt({
110
- prop: e,
111
- defaultProp: t,
112
- onChange: n = () => {
113
- },
114
- caller: r
115
- }) {
116
- const [o, a, c] = Et({
117
- defaultProp: t,
118
- onChange: n
119
- }), s = e !== void 0, d = s ? e : o;
120
- {
121
- const f = i.useRef(e !== void 0);
122
- i.useEffect(() => {
123
- const v = f.current;
124
- v !== s && console.warn(
125
- `${r} is changing from ${v ? "controlled" : "uncontrolled"} to ${s ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
126
- ), f.current = s;
127
- }, [s, r]);
128
- }
129
- const l = i.useCallback(
130
- (f) => {
131
- if (s) {
132
- const v = bt(f) ? f(e) : f;
133
- v !== e && c.current?.(v);
134
- } else
135
- a(f);
136
- },
137
- [s, e, a, c]
138
- );
139
- return [d, l];
140
- }
141
- function Et({
142
- defaultProp: e,
143
- onChange: t
144
- }) {
145
- const [n, r] = i.useState(e), o = i.useRef(n), a = i.useRef(t);
146
- return gt(() => {
147
- a.current = t;
148
- }, [t]), i.useEffect(() => {
149
- o.current !== n && (a.current?.(n), o.current = n);
150
- }, [n, o]), [n, r, a];
151
- }
152
- function bt(e) {
153
- return typeof e == "function";
154
- }
155
- // @__NO_SIDE_EFFECTS__
156
- function Te(e) {
157
- const t = /* @__PURE__ */ Ct(e), n = i.forwardRef((r, o) => {
158
- const { children: a, ...c } = r, s = i.Children.toArray(a), d = s.find(St);
159
- if (d) {
160
- const l = d.props.children, f = s.map((v) => v === d ? i.Children.count(l) > 1 ? i.Children.only(null) : i.isValidElement(l) ? l.props.children : null : v);
161
- return /* @__PURE__ */ h(t, { ...c, ref: o, children: i.isValidElement(l) ? i.cloneElement(l, void 0, f) : null });
162
- }
163
- return /* @__PURE__ */ h(t, { ...c, ref: o, children: a });
164
- });
165
- return n.displayName = `${e}.Slot`, n;
166
- }
167
- // @__NO_SIDE_EFFECTS__
168
- function Ct(e) {
169
- const t = i.forwardRef((n, r) => {
170
- const { children: o, ...a } = n;
171
- if (i.isValidElement(o)) {
172
- const c = Nt(o), s = Rt(a, o.props);
173
- return o.type !== i.Fragment && (s.ref = r ? xe(r, c) : c), i.cloneElement(o, s);
174
- }
175
- return i.Children.count(o) > 1 ? i.Children.only(null) : null;
176
- });
177
- return t.displayName = `${e}.SlotClone`, t;
178
- }
179
- var wt = /* @__PURE__ */ Symbol("radix.slottable");
180
- function St(e) {
181
- return i.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === wt;
182
- }
183
- function Rt(e, t) {
184
- const n = { ...t };
185
- for (const r in t) {
186
- const o = e[r], a = t[r];
187
- /^on[A-Z]/.test(r) ? o && a ? n[r] = (...s) => {
188
- const d = a(...s);
189
- return o(...s), d;
190
- } : o && (n[r] = o) : r === "style" ? n[r] = { ...o, ...a } : r === "className" && (n[r] = [o, a].filter(Boolean).join(" "));
191
- }
192
- return { ...e, ...n };
193
- }
194
- function Nt(e) {
195
- let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning;
196
- return n ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
197
- }
198
- var Pt = [
199
- "a",
200
- "button",
201
- "div",
202
- "form",
203
- "h2",
204
- "h3",
205
- "img",
206
- "input",
207
- "label",
208
- "li",
209
- "nav",
210
- "ol",
211
- "p",
212
- "select",
213
- "span",
214
- "svg",
215
- "ul"
216
- ], A = Pt.reduce((e, t) => {
217
- const n = /* @__PURE__ */ Te(`Primitive.${t}`), r = i.forwardRef((o, a) => {
218
- const { asChild: c, ...s } = o, d = c ? n : t;
219
- return typeof window < "u" && (window[/* @__PURE__ */ Symbol.for("radix-ui")] = !0), /* @__PURE__ */ h(d, { ...s, ref: a });
220
- });
221
- return r.displayName = `Primitive.${t}`, { ...e, [t]: r };
222
- }, {});
223
- function Dt(e, t) {
224
- e && ut.flushSync(() => e.dispatchEvent(t));
225
- }
226
- function $(e) {
227
- const t = i.useRef(e);
228
- return i.useEffect(() => {
229
- t.current = e;
230
- }), i.useMemo(() => (...n) => t.current?.(...n), []);
231
- }
232
- function Ot(e, t = globalThis?.document) {
233
- const n = $(e);
234
- i.useEffect(() => {
235
- const r = (o) => {
236
- o.key === "Escape" && n(o);
237
- };
238
- return t.addEventListener("keydown", r, { capture: !0 }), () => t.removeEventListener("keydown", r, { capture: !0 });
239
- }, [n, t]);
240
- }
241
- var At = "DismissableLayer", ce = "dismissableLayer.update", xt = "dismissableLayer.pointerDownOutside", Tt = "dismissableLayer.focusOutside", he, Ie = i.createContext({
242
- layers: /* @__PURE__ */ new Set(),
243
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
244
- branches: /* @__PURE__ */ new Set()
245
- }), Me = i.forwardRef(
246
- (e, t) => {
247
- const {
248
- disableOutsidePointerEvents: n = !1,
249
- onEscapeKeyDown: r,
250
- onPointerDownOutside: o,
251
- onFocusOutside: a,
252
- onInteractOutside: c,
253
- onDismiss: s,
254
- ...d
255
- } = e, l = i.useContext(Ie), [f, v] = i.useState(null), m = f?.ownerDocument ?? globalThis?.document, [, p] = i.useState({}), b = M(t, (E) => v(E)), u = Array.from(l.layers), [g] = [...l.layersWithOutsidePointerEventsDisabled].slice(-1), y = u.indexOf(g), C = f ? u.indexOf(f) : -1, w = l.layersWithOutsidePointerEventsDisabled.size > 0, S = C >= y, R = Lt((E) => {
256
- const O = E.target, B = [...l.branches].some((J) => J.contains(O));
257
- !S || B || (o?.(E), c?.(E), E.defaultPrevented || s?.());
258
- }, m), D = kt((E) => {
259
- const O = E.target;
260
- [...l.branches].some((J) => J.contains(O)) || (a?.(E), c?.(E), E.defaultPrevented || s?.());
261
- }, m);
262
- return Ot((E) => {
263
- C === l.layers.size - 1 && (r?.(E), !E.defaultPrevented && s && (E.preventDefault(), s()));
264
- }, m), i.useEffect(() => {
265
- if (f)
266
- return n && (l.layersWithOutsidePointerEventsDisabled.size === 0 && (he = m.body.style.pointerEvents, m.body.style.pointerEvents = "none"), l.layersWithOutsidePointerEventsDisabled.add(f)), l.layers.add(f), ge(), () => {
267
- n && l.layersWithOutsidePointerEventsDisabled.size === 1 && (m.body.style.pointerEvents = he);
268
- };
269
- }, [f, m, n, l]), i.useEffect(() => () => {
270
- f && (l.layers.delete(f), l.layersWithOutsidePointerEventsDisabled.delete(f), ge());
271
- }, [f, l]), i.useEffect(() => {
272
- const E = () => p({});
273
- return document.addEventListener(ce, E), () => document.removeEventListener(ce, E);
274
- }, []), /* @__PURE__ */ h(
275
- A.div,
276
- {
277
- ...d,
278
- ref: b,
279
- style: {
280
- pointerEvents: w ? S ? "auto" : "none" : void 0,
281
- ...e.style
282
- },
283
- onFocusCapture: T(e.onFocusCapture, D.onFocusCapture),
284
- onBlurCapture: T(e.onBlurCapture, D.onBlurCapture),
285
- onPointerDownCapture: T(
286
- e.onPointerDownCapture,
287
- R.onPointerDownCapture
288
- )
289
- }
290
- );
291
- }
292
- );
293
- Me.displayName = At;
294
- var It = "DismissableLayerBranch", Mt = i.forwardRef((e, t) => {
295
- const n = i.useContext(Ie), r = i.useRef(null), o = M(t, r);
296
- return i.useEffect(() => {
297
- const a = r.current;
298
- if (a)
299
- return n.branches.add(a), () => {
300
- n.branches.delete(a);
301
- };
302
- }, [n.branches]), /* @__PURE__ */ h(A.div, { ...e, ref: o });
303
- });
304
- Mt.displayName = It;
305
- function Lt(e, t = globalThis?.document) {
306
- const n = $(e), r = i.useRef(!1), o = i.useRef(() => {
307
- });
308
- return i.useEffect(() => {
309
- const a = (s) => {
310
- if (s.target && !r.current) {
311
- let d = function() {
312
- Le(
313
- xt,
314
- n,
315
- l,
316
- { discrete: !0 }
317
- );
318
- };
319
- const l = { originalEvent: s };
320
- s.pointerType === "touch" ? (t.removeEventListener("click", o.current), o.current = d, t.addEventListener("click", o.current, { once: !0 })) : d();
321
- } else
322
- t.removeEventListener("click", o.current);
323
- r.current = !1;
324
- }, c = window.setTimeout(() => {
325
- t.addEventListener("pointerdown", a);
326
- }, 0);
327
- return () => {
328
- window.clearTimeout(c), t.removeEventListener("pointerdown", a), t.removeEventListener("click", o.current);
329
- };
330
- }, [t, n]), {
331
- // ensures we check React component tree (not just DOM tree)
332
- onPointerDownCapture: () => r.current = !0
333
- };
334
- }
335
- function kt(e, t = globalThis?.document) {
336
- const n = $(e), r = i.useRef(!1);
337
- return i.useEffect(() => {
338
- const o = (a) => {
339
- a.target && !r.current && Le(Tt, n, { originalEvent: a }, {
340
- discrete: !1
341
- });
342
- };
343
- return t.addEventListener("focusin", o), () => t.removeEventListener("focusin", o);
344
- }, [t, n]), {
345
- onFocusCapture: () => r.current = !0,
346
- onBlurCapture: () => r.current = !1
347
- };
348
- }
349
- function ge() {
350
- const e = new CustomEvent(ce);
351
- document.dispatchEvent(e);
352
- }
353
- function Le(e, t, n, { discrete: r }) {
354
- const o = n.originalEvent.target, a = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
355
- t && o.addEventListener(e, t, { once: !0 }), r ? Dt(o, a) : o.dispatchEvent(a);
356
- }
357
- var te = "focusScope.autoFocusOnMount", ne = "focusScope.autoFocusOnUnmount", ye = { bubbles: !1, cancelable: !0 }, _t = "FocusScope", ke = i.forwardRef((e, t) => {
358
- const {
359
- loop: n = !1,
360
- trapped: r = !1,
361
- onMountAutoFocus: o,
362
- onUnmountAutoFocus: a,
363
- ...c
364
- } = e, [s, d] = i.useState(null), l = $(o), f = $(a), v = i.useRef(null), m = M(t, (u) => d(u)), p = i.useRef({
365
- paused: !1,
366
- pause() {
367
- this.paused = !0;
368
- },
369
- resume() {
370
- this.paused = !1;
371
- }
372
- }).current;
373
- i.useEffect(() => {
374
- if (r) {
375
- let u = function(w) {
376
- if (p.paused || !s) return;
377
- const S = w.target;
378
- s.contains(S) ? v.current = S : x(v.current, { select: !0 });
379
- }, g = function(w) {
380
- if (p.paused || !s) return;
381
- const S = w.relatedTarget;
382
- S !== null && (s.contains(S) || x(v.current, { select: !0 }));
383
- }, y = function(w) {
384
- if (document.activeElement === document.body)
385
- for (const R of w)
386
- R.removedNodes.length > 0 && x(s);
387
- };
388
- document.addEventListener("focusin", u), document.addEventListener("focusout", g);
389
- const C = new MutationObserver(y);
390
- return s && C.observe(s, { childList: !0, subtree: !0 }), () => {
391
- document.removeEventListener("focusin", u), document.removeEventListener("focusout", g), C.disconnect();
392
- };
393
- }
394
- }, [r, s, p.paused]), i.useEffect(() => {
395
- if (s) {
396
- be.add(p);
397
- const u = document.activeElement;
398
- if (!s.contains(u)) {
399
- const y = new CustomEvent(te, ye);
400
- s.addEventListener(te, l), s.dispatchEvent(y), y.defaultPrevented || (Ft(jt(_e(s)), { select: !0 }), document.activeElement === u && x(s));
401
- }
402
- return () => {
403
- s.removeEventListener(te, l), setTimeout(() => {
404
- const y = new CustomEvent(ne, ye);
405
- s.addEventListener(ne, f), s.dispatchEvent(y), y.defaultPrevented || x(u ?? document.body, { select: !0 }), s.removeEventListener(ne, f), be.remove(p);
406
- }, 0);
407
- };
408
- }
409
- }, [s, l, f, p]);
410
- const b = i.useCallback(
411
- (u) => {
412
- if (!n && !r || p.paused) return;
413
- const g = u.key === "Tab" && !u.altKey && !u.ctrlKey && !u.metaKey, y = document.activeElement;
414
- if (g && y) {
415
- const C = u.currentTarget, [w, S] = Wt(C);
416
- w && S ? !u.shiftKey && y === S ? (u.preventDefault(), n && x(w, { select: !0 })) : u.shiftKey && y === w && (u.preventDefault(), n && x(S, { select: !0 })) : y === C && u.preventDefault();
417
- }
418
- },
419
- [n, r, p.paused]
420
- );
421
- return /* @__PURE__ */ h(A.div, { tabIndex: -1, ...c, ref: m, onKeyDown: b });
422
- });
423
- ke.displayName = _t;
424
- function Ft(e, { select: t = !1 } = {}) {
425
- const n = document.activeElement;
426
- for (const r of e)
427
- if (x(r, { select: t }), document.activeElement !== n) return;
428
- }
429
- function Wt(e) {
430
- const t = _e(e), n = Ee(t, e), r = Ee(t.reverse(), e);
431
- return [n, r];
432
- }
433
- function _e(e) {
434
- const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
435
- acceptNode: (r) => {
436
- const o = r.tagName === "INPUT" && r.type === "hidden";
437
- return r.disabled || r.hidden || o ? NodeFilter.FILTER_SKIP : r.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
438
- }
439
- });
440
- for (; n.nextNode(); ) t.push(n.currentNode);
441
- return t;
442
- }
443
- function Ee(e, t) {
444
- for (const n of e)
445
- if (!Bt(n, { upTo: t })) return n;
446
- }
447
- function Bt(e, { upTo: t }) {
448
- if (getComputedStyle(e).visibility === "hidden") return !0;
449
- for (; e; ) {
450
- if (t !== void 0 && e === t) return !1;
451
- if (getComputedStyle(e).display === "none") return !0;
452
- e = e.parentElement;
453
- }
454
- return !1;
455
- }
456
- function Ut(e) {
457
- return e instanceof HTMLInputElement && "select" in e;
458
- }
459
- function x(e, { select: t = !1 } = {}) {
460
- if (e && e.focus) {
461
- const n = document.activeElement;
462
- e.focus({ preventScroll: !0 }), e !== n && Ut(e) && t && e.select();
463
- }
464
- }
465
- var be = $t();
466
- function $t() {
467
- let e = [];
468
- return {
469
- add(t) {
470
- const n = e[0];
471
- t !== n && n?.pause(), e = Ce(e, t), e.unshift(t);
472
- },
473
- remove(t) {
474
- e = Ce(e, t), e[0]?.resume();
475
- }
476
- };
477
- }
478
- function Ce(e, t) {
479
- const n = [...e], r = n.indexOf(t);
480
- return r !== -1 && n.splice(r, 1), n;
481
- }
482
- function jt(e) {
483
- return e.filter((t) => t.tagName !== "A");
484
- }
485
- var Vt = "Portal", Fe = i.forwardRef((e, t) => {
486
- const { container: n, ...r } = e, [o, a] = i.useState(!1);
487
- U(() => a(!0), []);
488
- const c = n || o && globalThis?.document?.body;
489
- return c ? lt.createPortal(/* @__PURE__ */ h(A.div, { ...r, ref: t }), c) : null;
490
- });
491
- Fe.displayName = Vt;
492
- function Ht(e, t) {
493
- return i.useReducer((n, r) => t[n][r] ?? n, e);
494
- }
495
- var Z = (e) => {
496
- const { present: t, children: n } = e, r = Kt(t), o = typeof n == "function" ? n({ present: r.isPresent }) : i.Children.only(n), a = M(r.ref, zt(o));
497
- return typeof n == "function" || r.isPresent ? i.cloneElement(o, { ref: a }) : null;
498
- };
499
- Z.displayName = "Presence";
500
- function Kt(e) {
501
- const [t, n] = i.useState(), r = i.useRef(null), o = i.useRef(e), a = i.useRef("none"), c = e ? "mounted" : "unmounted", [s, d] = Ht(c, {
502
- mounted: {
503
- UNMOUNT: "unmounted",
504
- ANIMATION_OUT: "unmountSuspended"
505
- },
506
- unmountSuspended: {
507
- MOUNT: "mounted",
508
- ANIMATION_END: "unmounted"
509
- },
510
- unmounted: {
511
- MOUNT: "mounted"
512
- }
513
- });
514
- return i.useEffect(() => {
515
- const l = j(r.current);
516
- a.current = s === "mounted" ? l : "none";
517
- }, [s]), U(() => {
518
- const l = r.current, f = o.current;
519
- if (f !== e) {
520
- const m = a.current, p = j(l);
521
- e ? d("MOUNT") : p === "none" || l?.display === "none" ? d("UNMOUNT") : d(f && m !== p ? "ANIMATION_OUT" : "UNMOUNT"), o.current = e;
522
- }
523
- }, [e, d]), U(() => {
524
- if (t) {
525
- let l;
526
- const f = t.ownerDocument.defaultView ?? window, v = (p) => {
527
- const u = j(r.current).includes(CSS.escape(p.animationName));
528
- if (p.target === t && u && (d("ANIMATION_END"), !o.current)) {
529
- const g = t.style.animationFillMode;
530
- t.style.animationFillMode = "forwards", l = f.setTimeout(() => {
531
- t.style.animationFillMode === "forwards" && (t.style.animationFillMode = g);
532
- });
533
- }
534
- }, m = (p) => {
535
- p.target === t && (a.current = j(r.current));
536
- };
537
- return t.addEventListener("animationstart", m), t.addEventListener("animationcancel", v), t.addEventListener("animationend", v), () => {
538
- f.clearTimeout(l), t.removeEventListener("animationstart", m), t.removeEventListener("animationcancel", v), t.removeEventListener("animationend", v);
539
- };
540
- } else
541
- d("ANIMATION_END");
542
- }, [t, d]), {
543
- isPresent: ["mounted", "unmountSuspended"].includes(s),
544
- ref: i.useCallback((l) => {
545
- r.current = l ? getComputedStyle(l) : null, n(l);
546
- }, [])
547
- };
548
- }
549
- function j(e) {
550
- return e?.animationName || "none";
551
- }
552
- function zt(e) {
553
- let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning;
554
- return n ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
555
- }
556
- var re = 0;
557
- function Gt() {
558
- i.useEffect(() => {
559
- const e = document.querySelectorAll("[data-radix-focus-guard]");
560
- return document.body.insertAdjacentElement("afterbegin", e[0] ?? we()), document.body.insertAdjacentElement("beforeend", e[1] ?? we()), re++, () => {
561
- re === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((t) => t.remove()), re--;
562
- };
563
- }, []);
564
- }
565
- function we() {
566
- const e = document.createElement("span");
567
- return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e;
568
- }
569
- var P = function() {
570
- return P = Object.assign || function(t) {
571
- for (var n, r = 1, o = arguments.length; r < o; r++) {
572
- n = arguments[r];
573
- for (var a in n) Object.prototype.hasOwnProperty.call(n, a) && (t[a] = n[a]);
574
- }
575
- return t;
576
- }, P.apply(this, arguments);
577
- };
578
- function We(e, t) {
579
- var n = {};
580
- for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
581
- if (e != null && typeof Object.getOwnPropertySymbols == "function")
582
- for (var o = 0, r = Object.getOwnPropertySymbols(e); o < r.length; o++)
583
- t.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[o]) && (n[r[o]] = e[r[o]]);
584
- return n;
585
- }
586
- function Yt(e, t, n) {
587
- if (n || arguments.length === 2) for (var r = 0, o = t.length, a; r < o; r++)
588
- (a || !(r in t)) && (a || (a = Array.prototype.slice.call(t, 0, r)), a[r] = t[r]);
589
- return e.concat(a || Array.prototype.slice.call(t));
590
- }
591
- var G = "right-scroll-bar-position", Y = "width-before-scroll-bar", Xt = "with-scroll-bars-hidden", Zt = "--removed-body-scroll-bar-size";
592
- function oe(e, t) {
593
- return typeof e == "function" ? e(t) : e && (e.current = t), e;
594
- }
595
- function qt(e, t) {
596
- var n = Ae(function() {
597
- return {
598
- // value
599
- value: e,
600
- // last callback
601
- callback: t,
602
- // "memoized" public interface
603
- facade: {
604
- get current() {
605
- return n.value;
606
- },
607
- set current(r) {
608
- var o = n.value;
609
- o !== r && (n.value = r, n.callback(r, o));
610
- }
611
- }
612
- };
613
- })[0];
614
- return n.callback = t, n.facade;
615
- }
616
- var Qt = typeof window < "u" ? i.useLayoutEffect : i.useEffect, Se = /* @__PURE__ */ new WeakMap();
617
- function Jt(e, t) {
618
- var n = qt(null, function(r) {
619
- return e.forEach(function(o) {
620
- return oe(o, r);
621
- });
622
- });
623
- return Qt(function() {
624
- var r = Se.get(n);
625
- if (r) {
626
- var o = new Set(r), a = new Set(e), c = n.current;
627
- o.forEach(function(s) {
628
- a.has(s) || oe(s, null);
629
- }), a.forEach(function(s) {
630
- o.has(s) || oe(s, c);
631
- });
632
- }
633
- Se.set(n, e);
634
- }, [e]), n;
635
- }
636
- function en(e) {
637
- return e;
638
- }
639
- function tn(e, t) {
640
- t === void 0 && (t = en);
641
- var n = [], r = !1, o = {
642
- read: function() {
643
- if (r)
644
- throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
645
- return n.length ? n[n.length - 1] : e;
646
- },
647
- useMedium: function(a) {
648
- var c = t(a, r);
649
- return n.push(c), function() {
650
- n = n.filter(function(s) {
651
- return s !== c;
652
- });
653
- };
654
- },
655
- assignSyncMedium: function(a) {
656
- for (r = !0; n.length; ) {
657
- var c = n;
658
- n = [], c.forEach(a);
659
- }
660
- n = {
661
- push: function(s) {
662
- return a(s);
663
- },
664
- filter: function() {
665
- return n;
666
- }
667
- };
668
- },
669
- assignMedium: function(a) {
670
- r = !0;
671
- var c = [];
672
- if (n.length) {
673
- var s = n;
674
- n = [], s.forEach(a), c = n;
675
- }
676
- var d = function() {
677
- var f = c;
678
- c = [], f.forEach(a);
679
- }, l = function() {
680
- return Promise.resolve().then(d);
681
- };
682
- l(), n = {
683
- push: function(f) {
684
- c.push(f), l();
685
- },
686
- filter: function(f) {
687
- return c = c.filter(f), n;
688
- }
689
- };
690
- }
691
- };
692
- return o;
693
- }
694
- function nn(e) {
695
- e === void 0 && (e = {});
696
- var t = tn(null);
697
- return t.options = P({ async: !0, ssr: !1 }, e), t;
698
- }
699
- var Be = function(e) {
700
- var t = e.sideCar, n = We(e, ["sideCar"]);
701
- if (!t)
702
- throw new Error("Sidecar: please provide `sideCar` property to import the right car");
703
- var r = t.read();
704
- if (!r)
705
- throw new Error("Sidecar medium not found");
706
- return i.createElement(r, P({}, n));
707
- };
708
- Be.isSideCarExport = !0;
709
- function rn(e, t) {
710
- return e.useMedium(t), Be;
711
- }
712
- var Ue = nn(), ae = function() {
713
- }, q = i.forwardRef(function(e, t) {
714
- var n = i.useRef(null), r = i.useState({
715
- onScrollCapture: ae,
716
- onWheelCapture: ae,
717
- onTouchMoveCapture: ae
718
- }), o = r[0], a = r[1], c = e.forwardProps, s = e.children, d = e.className, l = e.removeScrollBar, f = e.enabled, v = e.shards, m = e.sideCar, p = e.noRelative, b = e.noIsolation, u = e.inert, g = e.allowPinchZoom, y = e.as, C = y === void 0 ? "div" : y, w = e.gapMode, S = We(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), R = m, D = Jt([n, t]), E = P(P({}, S), o);
719
- return i.createElement(
720
- i.Fragment,
721
- null,
722
- f && i.createElement(R, { sideCar: Ue, removeScrollBar: l, shards: v, noRelative: p, noIsolation: b, inert: u, setCallbacks: a, allowPinchZoom: !!g, lockRef: n, gapMode: w }),
723
- c ? i.cloneElement(i.Children.only(s), P(P({}, E), { ref: D })) : i.createElement(C, P({}, E, { className: d, ref: D }), s)
724
- );
725
- });
726
- q.defaultProps = {
727
- enabled: !0,
728
- removeScrollBar: !0,
729
- inert: !1
730
- };
731
- q.classNames = {
732
- fullWidth: Y,
733
- zeroRight: G
734
- };
735
- var on = function() {
736
- if (typeof __webpack_nonce__ < "u")
737
- return __webpack_nonce__;
738
- };
739
- function an() {
740
- if (!document)
741
- return null;
742
- var e = document.createElement("style");
743
- e.type = "text/css";
744
- var t = on();
745
- return t && e.setAttribute("nonce", t), e;
746
- }
747
- function sn(e, t) {
748
- e.styleSheet ? e.styleSheet.cssText = t : e.appendChild(document.createTextNode(t));
749
- }
750
- function cn(e) {
751
- var t = document.head || document.getElementsByTagName("head")[0];
752
- t.appendChild(e);
753
- }
754
- var un = function() {
755
- var e = 0, t = null;
756
- return {
757
- add: function(n) {
758
- e == 0 && (t = an()) && (sn(t, n), cn(t)), e++;
759
- },
760
- remove: function() {
761
- e--, !e && t && (t.parentNode && t.parentNode.removeChild(t), t = null);
762
- }
763
- };
764
- }, ln = function() {
765
- var e = un();
766
- return function(t, n) {
767
- i.useEffect(function() {
768
- return e.add(t), function() {
769
- e.remove();
770
- };
771
- }, [t && n]);
772
- };
773
- }, $e = function() {
774
- var e = ln(), t = function(n) {
775
- var r = n.styles, o = n.dynamic;
776
- return e(r, o), null;
777
- };
778
- return t;
779
- }, dn = {
780
- left: 0,
781
- top: 0,
782
- right: 0,
783
- gap: 0
784
- }, ie = function(e) {
785
- return parseInt(e || "", 10) || 0;
786
- }, fn = function(e) {
787
- var t = window.getComputedStyle(document.body), n = t[e === "padding" ? "paddingLeft" : "marginLeft"], r = t[e === "padding" ? "paddingTop" : "marginTop"], o = t[e === "padding" ? "paddingRight" : "marginRight"];
788
- return [ie(n), ie(r), ie(o)];
789
- }, vn = function(e) {
790
- if (e === void 0 && (e = "margin"), typeof window > "u")
791
- return dn;
792
- var t = fn(e), n = document.documentElement.clientWidth, r = window.innerWidth;
793
- return {
794
- left: t[0],
795
- top: t[1],
796
- right: t[2],
797
- gap: Math.max(0, r - n + t[2] - t[0])
798
- };
799
- }, mn = $e(), W = "data-scroll-locked", pn = function(e, t, n, r) {
800
- var o = e.left, a = e.top, c = e.right, s = e.gap;
801
- return n === void 0 && (n = "margin"), `
802
- .`.concat(Xt, ` {
803
- overflow: hidden `).concat(r, `;
804
- padding-right: `).concat(s, "px ").concat(r, `;
805
- }
806
- body[`).concat(W, `] {
807
- overflow: hidden `).concat(r, `;
808
- overscroll-behavior: contain;
809
- `).concat([
810
- t && "position: relative ".concat(r, ";"),
811
- n === "margin" && `
812
- padding-left: `.concat(o, `px;
813
- padding-top: `).concat(a, `px;
814
- padding-right: `).concat(c, `px;
815
- margin-left:0;
816
- margin-top:0;
817
- margin-right: `).concat(s, "px ").concat(r, `;
818
- `),
819
- n === "padding" && "padding-right: ".concat(s, "px ").concat(r, ";")
820
- ].filter(Boolean).join(""), `
821
- }
822
-
823
- .`).concat(G, ` {
824
- right: `).concat(s, "px ").concat(r, `;
825
- }
826
-
827
- .`).concat(Y, ` {
828
- margin-right: `).concat(s, "px ").concat(r, `;
829
- }
830
-
831
- .`).concat(G, " .").concat(G, ` {
832
- right: 0 `).concat(r, `;
833
- }
834
-
835
- .`).concat(Y, " .").concat(Y, ` {
836
- margin-right: 0 `).concat(r, `;
837
- }
838
-
839
- body[`).concat(W, `] {
840
- `).concat(Zt, ": ").concat(s, `px;
841
- }
842
- `);
843
- }, Re = function() {
844
- var e = parseInt(document.body.getAttribute(W) || "0", 10);
845
- return isFinite(e) ? e : 0;
846
- }, hn = function() {
847
- i.useEffect(function() {
848
- return document.body.setAttribute(W, (Re() + 1).toString()), function() {
849
- var e = Re() - 1;
850
- e <= 0 ? document.body.removeAttribute(W) : document.body.setAttribute(W, e.toString());
851
- };
852
- }, []);
853
- }, gn = function(e) {
854
- var t = e.noRelative, n = e.noImportant, r = e.gapMode, o = r === void 0 ? "margin" : r;
855
- hn();
856
- var a = i.useMemo(function() {
857
- return vn(o);
858
- }, [o]);
859
- return i.createElement(mn, { styles: pn(a, !t, o, n ? "" : "!important") });
860
- }, ue = !1;
861
- if (typeof window < "u")
862
- try {
863
- var V = Object.defineProperty({}, "passive", {
864
- get: function() {
865
- return ue = !0, !0;
866
- }
867
- });
868
- window.addEventListener("test", V, V), window.removeEventListener("test", V, V);
869
- } catch {
870
- ue = !1;
871
- }
872
- var L = ue ? { passive: !1 } : !1, yn = function(e) {
873
- return e.tagName === "TEXTAREA";
874
- }, je = function(e, t) {
875
- if (!(e instanceof Element))
876
- return !1;
877
- var n = window.getComputedStyle(e);
878
- return (
879
- // not-not-scrollable
880
- n[t] !== "hidden" && // contains scroll inside self
881
- !(n.overflowY === n.overflowX && !yn(e) && n[t] === "visible")
882
- );
883
- }, En = function(e) {
884
- return je(e, "overflowY");
885
- }, bn = function(e) {
886
- return je(e, "overflowX");
887
- }, Ne = function(e, t) {
888
- var n = t.ownerDocument, r = t;
889
- do {
890
- typeof ShadowRoot < "u" && r instanceof ShadowRoot && (r = r.host);
891
- var o = Ve(e, r);
892
- if (o) {
893
- var a = He(e, r), c = a[1], s = a[2];
894
- if (c > s)
895
- return !0;
896
- }
897
- r = r.parentNode;
898
- } while (r && r !== n.body);
899
- return !1;
900
- }, Cn = function(e) {
901
- var t = e.scrollTop, n = e.scrollHeight, r = e.clientHeight;
902
- return [
903
- t,
904
- n,
905
- r
906
- ];
907
- }, wn = function(e) {
908
- var t = e.scrollLeft, n = e.scrollWidth, r = e.clientWidth;
909
- return [
910
- t,
911
- n,
912
- r
913
- ];
914
- }, Ve = function(e, t) {
915
- return e === "v" ? En(t) : bn(t);
916
- }, He = function(e, t) {
917
- return e === "v" ? Cn(t) : wn(t);
918
- }, Sn = function(e, t) {
919
- return e === "h" && t === "rtl" ? -1 : 1;
920
- }, Rn = function(e, t, n, r, o) {
921
- var a = Sn(e, window.getComputedStyle(t).direction), c = a * r, s = n.target, d = t.contains(s), l = !1, f = c > 0, v = 0, m = 0;
922
- do {
923
- if (!s)
924
- break;
925
- var p = He(e, s), b = p[0], u = p[1], g = p[2], y = u - g - a * b;
926
- (b || y) && Ve(e, s) && (v += y, m += b);
927
- var C = s.parentNode;
928
- s = C && C.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? C.host : C;
929
- } while (
930
- // portaled content
931
- !d && s !== document.body || // self content
932
- d && (t.contains(s) || t === s)
933
- );
934
- return (f && Math.abs(v) < 1 || !f && Math.abs(m) < 1) && (l = !0), l;
935
- }, H = function(e) {
936
- return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0];
937
- }, Pe = function(e) {
938
- return [e.deltaX, e.deltaY];
939
- }, De = function(e) {
940
- return e && "current" in e ? e.current : e;
941
- }, Nn = function(e, t) {
942
- return e[0] === t[0] && e[1] === t[1];
943
- }, Pn = function(e) {
944
- return `
945
- .block-interactivity-`.concat(e, ` {pointer-events: none;}
946
- .allow-interactivity-`).concat(e, ` {pointer-events: all;}
947
- `);
948
- }, Dn = 0, k = [];
949
- function On(e) {
950
- var t = i.useRef([]), n = i.useRef([0, 0]), r = i.useRef(), o = i.useState(Dn++)[0], a = i.useState($e)[0], c = i.useRef(e);
951
- i.useEffect(function() {
952
- c.current = e;
953
- }, [e]), i.useEffect(function() {
954
- if (e.inert) {
955
- document.body.classList.add("block-interactivity-".concat(o));
956
- var u = Yt([e.lockRef.current], (e.shards || []).map(De), !0).filter(Boolean);
957
- return u.forEach(function(g) {
958
- return g.classList.add("allow-interactivity-".concat(o));
959
- }), function() {
960
- document.body.classList.remove("block-interactivity-".concat(o)), u.forEach(function(g) {
961
- return g.classList.remove("allow-interactivity-".concat(o));
962
- });
963
- };
964
- }
965
- }, [e.inert, e.lockRef.current, e.shards]);
966
- var s = i.useCallback(function(u, g) {
967
- if ("touches" in u && u.touches.length === 2 || u.type === "wheel" && u.ctrlKey)
968
- return !c.current.allowPinchZoom;
969
- var y = H(u), C = n.current, w = "deltaX" in u ? u.deltaX : C[0] - y[0], S = "deltaY" in u ? u.deltaY : C[1] - y[1], R, D = u.target, E = Math.abs(w) > Math.abs(S) ? "h" : "v";
970
- if ("touches" in u && E === "h" && D.type === "range")
971
- return !1;
972
- var O = Ne(E, D);
973
- if (!O)
974
- return !0;
975
- if (O ? R = E : (R = E === "v" ? "h" : "v", O = Ne(E, D)), !O)
976
- return !1;
977
- if (!r.current && "changedTouches" in u && (w || S) && (r.current = R), !R)
978
- return !0;
979
- var B = r.current || R;
980
- return Rn(B, g, u, B === "h" ? w : S);
981
- }, []), d = i.useCallback(function(u) {
982
- var g = u;
983
- if (!(!k.length || k[k.length - 1] !== a)) {
984
- var y = "deltaY" in g ? Pe(g) : H(g), C = t.current.filter(function(R) {
985
- return R.name === g.type && (R.target === g.target || g.target === R.shadowParent) && Nn(R.delta, y);
986
- })[0];
987
- if (C && C.should) {
988
- g.cancelable && g.preventDefault();
989
- return;
990
- }
991
- if (!C) {
992
- var w = (c.current.shards || []).map(De).filter(Boolean).filter(function(R) {
993
- return R.contains(g.target);
994
- }), S = w.length > 0 ? s(g, w[0]) : !c.current.noIsolation;
995
- S && g.cancelable && g.preventDefault();
996
- }
997
- }
998
- }, []), l = i.useCallback(function(u, g, y, C) {
999
- var w = { name: u, delta: g, target: y, should: C, shadowParent: An(y) };
1000
- t.current.push(w), setTimeout(function() {
1001
- t.current = t.current.filter(function(S) {
1002
- return S !== w;
1003
- });
1004
- }, 1);
1005
- }, []), f = i.useCallback(function(u) {
1006
- n.current = H(u), r.current = void 0;
1007
- }, []), v = i.useCallback(function(u) {
1008
- l(u.type, Pe(u), u.target, s(u, e.lockRef.current));
1009
- }, []), m = i.useCallback(function(u) {
1010
- l(u.type, H(u), u.target, s(u, e.lockRef.current));
1011
- }, []);
1012
- i.useEffect(function() {
1013
- return k.push(a), e.setCallbacks({
1014
- onScrollCapture: v,
1015
- onWheelCapture: v,
1016
- onTouchMoveCapture: m
1017
- }), document.addEventListener("wheel", d, L), document.addEventListener("touchmove", d, L), document.addEventListener("touchstart", f, L), function() {
1018
- k = k.filter(function(u) {
1019
- return u !== a;
1020
- }), document.removeEventListener("wheel", d, L), document.removeEventListener("touchmove", d, L), document.removeEventListener("touchstart", f, L);
1021
- };
1022
- }, []);
1023
- var p = e.removeScrollBar, b = e.inert;
1024
- return i.createElement(
1025
- i.Fragment,
1026
- null,
1027
- b ? i.createElement(a, { styles: Pn(o) }) : null,
1028
- p ? i.createElement(gn, { noRelative: e.noRelative, gapMode: e.gapMode }) : null
1029
- );
1030
- }
1031
- function An(e) {
1032
- for (var t = null; e !== null; )
1033
- e instanceof ShadowRoot && (t = e.host, e = e.host), e = e.parentNode;
1034
- return t;
1035
- }
1036
- const xn = rn(Ue, On);
1037
- var Ke = i.forwardRef(function(e, t) {
1038
- return i.createElement(q, P({}, e, { ref: t, sideCar: xn }));
1039
- });
1040
- Ke.classNames = q.classNames;
1041
- var Tn = function(e) {
1042
- if (typeof document > "u")
1043
- return null;
1044
- var t = Array.isArray(e) ? e[0] : e;
1045
- return t.ownerDocument.body;
1046
- }, _ = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakMap(), z = {}, se = 0, ze = function(e) {
1047
- return e && (e.host || ze(e.parentNode));
1048
- }, In = function(e, t) {
1049
- return t.map(function(n) {
1050
- if (e.contains(n))
1051
- return n;
1052
- var r = ze(n);
1053
- return r && e.contains(r) ? r : (console.error("aria-hidden", n, "in not contained inside", e, ". Doing nothing"), null);
1054
- }).filter(function(n) {
1055
- return !!n;
1056
- });
1057
- }, Mn = function(e, t, n, r) {
1058
- var o = In(t, Array.isArray(e) ? e : [e]);
1059
- z[n] || (z[n] = /* @__PURE__ */ new WeakMap());
1060
- var a = z[n], c = [], s = /* @__PURE__ */ new Set(), d = new Set(o), l = function(v) {
1061
- !v || s.has(v) || (s.add(v), l(v.parentNode));
1062
- };
1063
- o.forEach(l);
1064
- var f = function(v) {
1065
- !v || d.has(v) || Array.prototype.forEach.call(v.children, function(m) {
1066
- if (s.has(m))
1067
- f(m);
1068
- else
1069
- try {
1070
- var p = m.getAttribute(r), b = p !== null && p !== "false", u = (_.get(m) || 0) + 1, g = (a.get(m) || 0) + 1;
1071
- _.set(m, u), a.set(m, g), c.push(m), u === 1 && b && K.set(m, !0), g === 1 && m.setAttribute(n, "true"), b || m.setAttribute(r, "true");
1072
- } catch (y) {
1073
- console.error("aria-hidden: cannot operate on ", m, y);
1074
- }
1075
- });
1076
- };
1077
- return f(t), s.clear(), se++, function() {
1078
- c.forEach(function(v) {
1079
- var m = _.get(v) - 1, p = a.get(v) - 1;
1080
- _.set(v, m), a.set(v, p), m || (K.has(v) || v.removeAttribute(r), K.delete(v)), p || v.removeAttribute(n);
1081
- }), se--, se || (_ = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakMap(), z = {});
1082
- };
1083
- }, Ln = function(e, t, n) {
1084
- n === void 0 && (n = "data-aria-hidden");
1085
- var r = Array.from(Array.isArray(e) ? e : [e]), o = Tn(e);
1086
- return o ? (r.push.apply(r, Array.from(o.querySelectorAll("[aria-live], script"))), Mn(r, o, n, "aria-hidden")) : function() {
1087
- return null;
1088
- };
1089
- }, Q = "Dialog", [Ge, ir] = vt(Q), [kn, N] = Ge(Q), Ye = (e) => {
1090
- const {
1091
- __scopeDialog: t,
1092
- children: n,
1093
- open: r,
1094
- defaultOpen: o,
1095
- onOpenChange: a,
1096
- modal: c = !0
1097
- } = e, s = i.useRef(null), d = i.useRef(null), [l, f] = yt({
1098
- prop: r,
1099
- defaultProp: o ?? !1,
1100
- onChange: a,
1101
- caller: Q
1102
- });
1103
- return /* @__PURE__ */ h(
1104
- kn,
1105
- {
1106
- scope: t,
1107
- triggerRef: s,
1108
- contentRef: d,
1109
- contentId: ee(),
1110
- titleId: ee(),
1111
- descriptionId: ee(),
1112
- open: l,
1113
- onOpenChange: f,
1114
- onOpenToggle: i.useCallback(() => f((v) => !v), [f]),
1115
- modal: c,
1116
- children: n
1117
- }
1118
- );
1119
- };
1120
- Ye.displayName = Q;
1121
- var Xe = "DialogTrigger", _n = i.forwardRef(
1122
- (e, t) => {
1123
- const { __scopeDialog: n, ...r } = e, o = N(Xe, n), a = M(t, o.triggerRef);
1124
- return /* @__PURE__ */ h(
1125
- A.button,
1126
- {
1127
- type: "button",
1128
- "aria-haspopup": "dialog",
1129
- "aria-expanded": o.open,
1130
- "aria-controls": o.contentId,
1131
- "data-state": fe(o.open),
1132
- ...r,
1133
- ref: a,
1134
- onClick: T(e.onClick, o.onOpenToggle)
1135
- }
1136
- );
1137
- }
1138
- );
1139
- _n.displayName = Xe;
1140
- var le = "DialogPortal", [Fn, Ze] = Ge(le, {
1141
- forceMount: void 0
1142
- }), qe = (e) => {
1143
- const { __scopeDialog: t, forceMount: n, children: r, container: o } = e, a = N(le, t);
1144
- return /* @__PURE__ */ h(Fn, { scope: t, forceMount: n, children: i.Children.map(r, (c) => /* @__PURE__ */ h(Z, { present: n || a.open, children: /* @__PURE__ */ h(Fe, { asChild: !0, container: o, children: c }) })) });
1145
- };
1146
- qe.displayName = le;
1147
- var X = "DialogOverlay", Qe = i.forwardRef(
1148
- (e, t) => {
1149
- const n = Ze(X, e.__scopeDialog), { forceMount: r = n.forceMount, ...o } = e, a = N(X, e.__scopeDialog);
1150
- return a.modal ? /* @__PURE__ */ h(Z, { present: r || a.open, children: /* @__PURE__ */ h(Bn, { ...o, ref: t }) }) : null;
1151
- }
1152
- );
1153
- Qe.displayName = X;
1154
- var Wn = /* @__PURE__ */ Te("DialogOverlay.RemoveScroll"), Bn = i.forwardRef(
1155
- (e, t) => {
1156
- const { __scopeDialog: n, ...r } = e, o = N(X, n);
1157
- return (
1158
- // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
1159
- // ie. when `Overlay` and `Content` are siblings
1160
- /* @__PURE__ */ h(Ke, { as: Wn, allowPinchZoom: !0, shards: [o.contentRef], children: /* @__PURE__ */ h(
1161
- A.div,
1162
- {
1163
- "data-state": fe(o.open),
1164
- ...r,
1165
- ref: t,
1166
- style: { pointerEvents: "auto", ...r.style }
1167
- }
1168
- ) })
1169
- );
1170
- }
1171
- ), I = "DialogContent", Je = i.forwardRef(
1172
- (e, t) => {
1173
- const n = Ze(I, e.__scopeDialog), { forceMount: r = n.forceMount, ...o } = e, a = N(I, e.__scopeDialog);
1174
- return /* @__PURE__ */ h(Z, { present: r || a.open, children: a.modal ? /* @__PURE__ */ h(Un, { ...o, ref: t }) : /* @__PURE__ */ h($n, { ...o, ref: t }) });
1175
- }
1176
- );
1177
- Je.displayName = I;
1178
- var Un = i.forwardRef(
1179
- (e, t) => {
1180
- const n = N(I, e.__scopeDialog), r = i.useRef(null), o = M(t, n.contentRef, r);
1181
- return i.useEffect(() => {
1182
- const a = r.current;
1183
- if (a) return Ln(a);
1184
- }, []), /* @__PURE__ */ h(
1185
- et,
1186
- {
1187
- ...e,
1188
- ref: o,
1189
- trapFocus: n.open,
1190
- disableOutsidePointerEvents: !0,
1191
- onCloseAutoFocus: T(e.onCloseAutoFocus, (a) => {
1192
- a.preventDefault(), n.triggerRef.current?.focus();
1193
- }),
1194
- onPointerDownOutside: T(e.onPointerDownOutside, (a) => {
1195
- const c = a.detail.originalEvent, s = c.button === 0 && c.ctrlKey === !0;
1196
- (c.button === 2 || s) && a.preventDefault();
1197
- }),
1198
- onFocusOutside: T(
1199
- e.onFocusOutside,
1200
- (a) => a.preventDefault()
1201
- )
1202
- }
1203
- );
1204
- }
1205
- ), $n = i.forwardRef(
1206
- (e, t) => {
1207
- const n = N(I, e.__scopeDialog), r = i.useRef(!1), o = i.useRef(!1);
1208
- return /* @__PURE__ */ h(
1209
- et,
1210
- {
1211
- ...e,
1212
- ref: t,
1213
- trapFocus: !1,
1214
- disableOutsidePointerEvents: !1,
1215
- onCloseAutoFocus: (a) => {
1216
- e.onCloseAutoFocus?.(a), a.defaultPrevented || (r.current || n.triggerRef.current?.focus(), a.preventDefault()), r.current = !1, o.current = !1;
1217
- },
1218
- onInteractOutside: (a) => {
1219
- e.onInteractOutside?.(a), a.defaultPrevented || (r.current = !0, a.detail.originalEvent.type === "pointerdown" && (o.current = !0));
1220
- const c = a.target;
1221
- n.triggerRef.current?.contains(c) && a.preventDefault(), a.detail.originalEvent.type === "focusin" && o.current && a.preventDefault();
1222
- }
1223
- }
1224
- );
1225
- }
1226
- ), et = i.forwardRef(
1227
- (e, t) => {
1228
- const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: o, onCloseAutoFocus: a, ...c } = e, s = N(I, n), d = i.useRef(null), l = M(t, d);
1229
- return Gt(), /* @__PURE__ */ F(ve, { children: [
1230
- /* @__PURE__ */ h(
1231
- ke,
1232
- {
1233
- asChild: !0,
1234
- loop: !0,
1235
- trapped: r,
1236
- onMountAutoFocus: o,
1237
- onUnmountAutoFocus: a,
1238
- children: /* @__PURE__ */ h(
1239
- Me,
1240
- {
1241
- role: "dialog",
1242
- id: s.contentId,
1243
- "aria-describedby": s.descriptionId,
1244
- "aria-labelledby": s.titleId,
1245
- "data-state": fe(s.open),
1246
- ...c,
1247
- ref: l,
1248
- onDismiss: () => s.onOpenChange(!1)
1249
- }
1250
- )
1251
- }
1252
- ),
1253
- /* @__PURE__ */ F(ve, { children: [
1254
- /* @__PURE__ */ h(Vn, { titleId: s.titleId }),
1255
- /* @__PURE__ */ h(Kn, { contentRef: d, descriptionId: s.descriptionId })
1256
- ] })
1257
- ] });
1258
- }
1259
- ), de = "DialogTitle", tt = i.forwardRef(
1260
- (e, t) => {
1261
- const { __scopeDialog: n, ...r } = e, o = N(de, n);
1262
- return /* @__PURE__ */ h(A.h2, { id: o.titleId, ...r, ref: t });
1263
- }
1264
- );
1265
- tt.displayName = de;
1266
- var nt = "DialogDescription", jn = i.forwardRef(
1267
- (e, t) => {
1268
- const { __scopeDialog: n, ...r } = e, o = N(nt, n);
1269
- return /* @__PURE__ */ h(A.p, { id: o.descriptionId, ...r, ref: t });
1270
- }
1271
- );
1272
- jn.displayName = nt;
1273
- var rt = "DialogClose", ot = i.forwardRef(
1274
- (e, t) => {
1275
- const { __scopeDialog: n, ...r } = e, o = N(rt, n);
1276
- return /* @__PURE__ */ h(
1277
- A.button,
1278
- {
1279
- type: "button",
1280
- ...r,
1281
- ref: t,
1282
- onClick: T(e.onClick, () => o.onOpenChange(!1))
1283
- }
1284
- );
1285
- }
1286
- );
1287
- ot.displayName = rt;
1288
- function fe(e) {
1289
- return e ? "open" : "closed";
1290
- }
1291
- var at = "DialogTitleWarning", [sr, it] = ft(at, {
1292
- contentName: I,
1293
- titleName: de,
1294
- docsSlug: "dialog"
1295
- }), Vn = ({ titleId: e }) => {
1296
- const t = it(at), n = `\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
1297
-
1298
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
1299
-
1300
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;
1301
- return i.useEffect(() => {
1302
- e && (document.getElementById(e) || console.error(n));
1303
- }, [n, e]), null;
1304
- }, Hn = "DialogDescriptionWarning", Kn = ({ contentRef: e, descriptionId: t }) => {
1305
- const r = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${it(Hn).contentName}}.`;
1306
- return i.useEffect(() => {
1307
- const o = e.current?.getAttribute("aria-describedby");
1308
- t && o && (document.getElementById(t) || console.warn(r));
1309
- }, [r, e, t]), null;
1310
- }, zn = Ye, Gn = qe, Yn = Qe, Xn = Je, Zn = tt, qn = ot;
1311
- const Qn = (e) => /* @__PURE__ */ i.createElement("svg", { fill: "none", viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ i.createElement("path", { d: "m4 12 8-8m-8 0 8 8", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5 })), Jn = (e) => /* @__PURE__ */ i.createElement("svg", { fill: "none", height: 16, viewBox: "0 0 16 16", width: 16, xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ i.createElement("path", { d: "m9.7002 13-4.2929-4.29289c-.39052-.39053-.39052-1.02369 0-1.41422l4.2929-4.29289", stroke: "#1e1c1f", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: 0.84, strokeWidth: 1.5 })), Oe = "provider-widget-portal-root";
1312
- function er() {
1313
- let e = document.getElementById(Oe);
1314
- return e || (e = document.createElement("div"), e.id = Oe, e.setAttribute("data-provider-widget-host", ""), e.style.zIndex = "2147483647", e.style.position = "relative", document.body.appendChild(e)), e;
1315
- }
1316
- const tr = st((e, t) => {
1317
- const {
1318
- "aria-labelledby": n,
1319
- "aria-describedby": r,
1320
- children: o,
1321
- className: a,
1322
- footerContent: c,
1323
- headerContent: s,
1324
- isDisplayingMargins: d = !0,
1325
- open: l,
1326
- onOpenChange: f,
1327
- showCloseButton: v = !0,
1328
- onBackClick: m
1329
- } = e, [p, b] = Ae(
1330
- null
1331
- );
1332
- return ct(() => {
1333
- b(er());
1334
- }, []), /* @__PURE__ */ h(zn, { open: l, onOpenChange: f, children: p && /* @__PURE__ */ F(Gn, { container: p, children: [
1335
- /* @__PURE__ */ h(
1336
- Yn,
1337
- {
1338
- "aria-hidden": !0,
1339
- className: me(
1340
- "fixed inset-0 bg-black/50 backdrop-blur-sm",
1341
- "!z-[2147483647] pointer-events-auto",
1342
- "data-[state=open]:animate-in data-[state=closed]:animate-out",
1343
- "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
1344
- "duration-300"
1345
- )
1346
- }
1347
- ),
1348
- /* @__PURE__ */ h(
1349
- Xn,
1350
- {
1351
- ref: t,
1352
- "aria-labelledby": n,
1353
- "aria-describedby": r,
1354
- "aria-modal": "true",
1355
- className: me(
1356
- "fixed left-1/2 top-1/2 w-full max-w-lg -translate-x-1/2 -translate-y-1/2 outline-none",
1357
- "!z-[2147483647]",
1358
- "data-[state=open]:animate-in data-[state=closed]:animate-out",
1359
- "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
1360
- "data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]",
1361
- "data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",
1362
- "duration-300",
1363
- d && "h-dvh max-h-[calc(100dvh-8px)] max-w-[calc(100dvw-8px)] rounded-2xl bg-white p-4",
1364
- a
1365
- ),
1366
- children: /* @__PURE__ */ F("div", { className: "flex h-full flex-col", children: [
1367
- /* @__PURE__ */ F(Zn, { className: "flex flex-shrink-0 flex-row items-center justify-between", children: [
1368
- /* @__PURE__ */ F("div", { className: "flex items-center", children: [
1369
- m && /* @__PURE__ */ h(
1370
- dt,
1371
- {
1372
- className: "mr-auto rounded-full !bg-lightGray !p-[10px]",
1373
- onClick: m,
1374
- children: /* @__PURE__ */ h(Jn, { className: "size-4" })
1375
- }
1376
- ),
1377
- s
1378
- ] }),
1379
- v && /* @__PURE__ */ h(qn, { asChild: !0, children: /* @__PURE__ */ h(
1380
- "button",
1381
- {
1382
- "aria-label": "Close modal",
1383
- className: "hover:bg-gray-200 ml-auto rounded-full bg-lightGray p-[10px] outline-none",
1384
- type: "button",
1385
- children: /* @__PURE__ */ h(Qn, { className: "size-4" })
1386
- }
1387
- ) })
1388
- ] }),
1389
- /* @__PURE__ */ h("div", { className: "min-h-0 flex-1 overflow-y-auto", children: o }),
1390
- c && /* @__PURE__ */ h("footer", { className: "flex flex-shrink-0 flex-col gap-2.5", children: c })
1391
- ] })
1392
- }
1393
- )
1394
- ] }) });
1395
- });
1396
- tr.displayName = "Dialog";
1397
- export {
1398
- tr as D
1399
- };