@frigate-nvr/image-annotator 1.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/LICENSE +21 -0
- package/README.md +35 -0
- package/dist/_commonjsHelpers-DjF3Plf2.js +27 -0
- package/dist/_commonjsHelpers-DjF3Plf2.js.map +1 -0
- package/dist/assets/Button.css +1 -0
- package/dist/assets/FormElement.css +1 -0
- package/dist/assets/FormElementBox.css +1 -0
- package/dist/components/BoundingBox.js +2553 -0
- package/dist/components/BoundingBox.js.map +1 -0
- package/dist/components/Button.js +45 -0
- package/dist/components/Button.js.map +1 -0
- package/dist/components/Crosshairs.js +58 -0
- package/dist/components/Crosshairs.js.map +1 -0
- package/dist/components/FormElement.js +13 -0
- package/dist/components/FormElement.js.map +1 -0
- package/dist/components/FormElementBox.js +18 -0
- package/dist/components/FormElementBox.js.map +1 -0
- package/dist/components/ImageAnnotator.js +642 -0
- package/dist/components/ImageAnnotator.js.map +1 -0
- package/dist/components/InfoDialog.js +25 -0
- package/dist/components/InfoDialog.js.map +1 -0
- package/dist/components/LabelDialog.js +27 -0
- package/dist/components/LabelDialog.js.map +1 -0
- package/dist/components/VerifyDialog.js +34 -0
- package/dist/components/VerifyDialog.js.map +1 -0
- package/dist/components/index.js +22 -0
- package/dist/components/index.js.map +1 -0
- package/dist/dialog-DrJOKYL3.js +1128 -0
- package/dist/dialog-DrJOKYL3.js.map +1 -0
- package/dist/index-sN46tOW-.js +43 -0
- package/dist/index-sN46tOW-.js.map +1 -0
- package/dist/index.d.ts +176 -0
- package/dist/index.esm-FeyXGhGs.js +916 -0
- package/dist/index.esm-FeyXGhGs.js.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,1128 @@
|
|
|
1
|
+
import * as de from "react";
|
|
2
|
+
import h, { useState as N, useEffect as L, useLayoutEffect as Lt, useRef as w, createContext as R, useContext as C, forwardRef as Ot, Fragment as k, isValidElement as At, cloneElement as Nt, createElement as Ct, useMemo as O, useId as me, useSyncExternalStore as Dt, useCallback as re, useReducer as Mt, createRef as xt } from "react";
|
|
3
|
+
import { createPortal as kt } from "react-dom";
|
|
4
|
+
var Rt = Object.defineProperty, It = (e, t, n) => t in e ? Rt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, ke = (e, t, n) => (It(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
5
|
+
let Ht = class {
|
|
6
|
+
constructor() {
|
|
7
|
+
ke(this, "current", this.detect()), ke(this, "handoffState", "pending"), ke(this, "currentId", 0);
|
|
8
|
+
}
|
|
9
|
+
set(t) {
|
|
10
|
+
this.current !== t && (this.handoffState = "pending", this.currentId = 0, this.current = t);
|
|
11
|
+
}
|
|
12
|
+
reset() {
|
|
13
|
+
this.set(this.detect());
|
|
14
|
+
}
|
|
15
|
+
nextId() {
|
|
16
|
+
return ++this.currentId;
|
|
17
|
+
}
|
|
18
|
+
get isServer() {
|
|
19
|
+
return this.current === "server";
|
|
20
|
+
}
|
|
21
|
+
get isClient() {
|
|
22
|
+
return this.current === "client";
|
|
23
|
+
}
|
|
24
|
+
detect() {
|
|
25
|
+
return typeof window > "u" || typeof document > "u" ? "server" : "client";
|
|
26
|
+
}
|
|
27
|
+
handoff() {
|
|
28
|
+
this.handoffState === "pending" && (this.handoffState = "complete");
|
|
29
|
+
}
|
|
30
|
+
get isHandoffComplete() {
|
|
31
|
+
return this.handoffState === "complete";
|
|
32
|
+
}
|
|
33
|
+
}, J = new Ht();
|
|
34
|
+
function Pe(e) {
|
|
35
|
+
return J.isServer ? null : e instanceof Node ? e.ownerDocument : e != null && e.hasOwnProperty("current") && e.current instanceof Node ? e.current.ownerDocument : document;
|
|
36
|
+
}
|
|
37
|
+
function Se(e) {
|
|
38
|
+
typeof queueMicrotask == "function" ? queueMicrotask(e) : Promise.resolve().then(e).catch((t) => setTimeout(() => {
|
|
39
|
+
throw t;
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
function G() {
|
|
43
|
+
let e = [], t = { addEventListener(n, r, l, i) {
|
|
44
|
+
return n.addEventListener(r, l, i), t.add(() => n.removeEventListener(r, l, i));
|
|
45
|
+
}, requestAnimationFrame(...n) {
|
|
46
|
+
let r = requestAnimationFrame(...n);
|
|
47
|
+
return t.add(() => cancelAnimationFrame(r));
|
|
48
|
+
}, nextFrame(...n) {
|
|
49
|
+
return t.requestAnimationFrame(() => t.requestAnimationFrame(...n));
|
|
50
|
+
}, setTimeout(...n) {
|
|
51
|
+
let r = setTimeout(...n);
|
|
52
|
+
return t.add(() => clearTimeout(r));
|
|
53
|
+
}, microTask(...n) {
|
|
54
|
+
let r = { current: !0 };
|
|
55
|
+
return Se(() => {
|
|
56
|
+
r.current && n[0]();
|
|
57
|
+
}), t.add(() => {
|
|
58
|
+
r.current = !1;
|
|
59
|
+
});
|
|
60
|
+
}, style(n, r, l) {
|
|
61
|
+
let i = n.style.getPropertyValue(r);
|
|
62
|
+
return Object.assign(n.style, { [r]: l }), this.add(() => {
|
|
63
|
+
Object.assign(n.style, { [r]: i });
|
|
64
|
+
});
|
|
65
|
+
}, group(n) {
|
|
66
|
+
let r = G();
|
|
67
|
+
return n(r), this.add(() => r.dispose());
|
|
68
|
+
}, add(n) {
|
|
69
|
+
return e.includes(n) || e.push(n), () => {
|
|
70
|
+
let r = e.indexOf(n);
|
|
71
|
+
if (r >= 0) for (let l of e.splice(r, 1)) l();
|
|
72
|
+
};
|
|
73
|
+
}, dispose() {
|
|
74
|
+
for (let n of e.splice(0)) n();
|
|
75
|
+
} };
|
|
76
|
+
return t;
|
|
77
|
+
}
|
|
78
|
+
function Be() {
|
|
79
|
+
let [e] = N(G);
|
|
80
|
+
return L(() => () => e.dispose(), [e]), e;
|
|
81
|
+
}
|
|
82
|
+
let P = (e, t) => {
|
|
83
|
+
J.isServer ? L(e, t) : Lt(e, t);
|
|
84
|
+
};
|
|
85
|
+
function Q(e) {
|
|
86
|
+
let t = w(e);
|
|
87
|
+
return P(() => {
|
|
88
|
+
t.current = e;
|
|
89
|
+
}, [e]), t;
|
|
90
|
+
}
|
|
91
|
+
let b = function(e) {
|
|
92
|
+
let t = Q(e);
|
|
93
|
+
return h.useCallback((...n) => t.current(...n), [t]);
|
|
94
|
+
}, jt = R(void 0);
|
|
95
|
+
function Ut() {
|
|
96
|
+
return C(jt);
|
|
97
|
+
}
|
|
98
|
+
function Ie(...e) {
|
|
99
|
+
return Array.from(new Set(e.flatMap((t) => typeof t == "string" ? t.split(" ") : []))).filter(Boolean).join(" ");
|
|
100
|
+
}
|
|
101
|
+
function q(e, t, ...n) {
|
|
102
|
+
if (e in t) {
|
|
103
|
+
let l = t[e];
|
|
104
|
+
return typeof l == "function" ? l(...n) : l;
|
|
105
|
+
}
|
|
106
|
+
let r = new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map((l) => `"${l}"`).join(", ")}.`);
|
|
107
|
+
throw Error.captureStackTrace && Error.captureStackTrace(r, q), r;
|
|
108
|
+
}
|
|
109
|
+
var $e = ((e) => (e[e.None = 0] = "None", e[e.RenderStrategy = 1] = "RenderStrategy", e[e.Static = 2] = "Static", e))($e || {}), Y = ((e) => (e[e.Unmount = 0] = "Unmount", e[e.Hidden = 1] = "Hidden", e))(Y || {});
|
|
110
|
+
function D({ ourProps: e, theirProps: t, slot: n, defaultTag: r, features: l, visible: i = !0, name: u, mergeRefs: a }) {
|
|
111
|
+
a = a ?? _t;
|
|
112
|
+
let o = tt(t, e);
|
|
113
|
+
if (i) return ye(o, n, r, u, a);
|
|
114
|
+
let c = l ?? 0;
|
|
115
|
+
if (c & 2) {
|
|
116
|
+
let { static: s = !1, ...f } = o;
|
|
117
|
+
if (s) return ye(f, n, r, u, a);
|
|
118
|
+
}
|
|
119
|
+
if (c & 1) {
|
|
120
|
+
let { unmount: s = !0, ...f } = o;
|
|
121
|
+
return q(s ? 0 : 1, { 0() {
|
|
122
|
+
return null;
|
|
123
|
+
}, 1() {
|
|
124
|
+
return ye({ ...f, hidden: !0, style: { display: "none" } }, n, r, u, a);
|
|
125
|
+
} });
|
|
126
|
+
}
|
|
127
|
+
return ye(o, n, r, u, a);
|
|
128
|
+
}
|
|
129
|
+
function ye(e, t = {}, n, r, l) {
|
|
130
|
+
let { as: i = n, children: u, refName: a = "ref", ...o } = Re(e, ["unmount", "static"]), c = e.ref !== void 0 ? { [a]: e.ref } : {}, s = typeof u == "function" ? u(t) : u;
|
|
131
|
+
"className" in o && o.className && typeof o.className == "function" && (o.className = o.className(t)), o["aria-labelledby"] && o["aria-labelledby"] === o.id && (o["aria-labelledby"] = void 0);
|
|
132
|
+
let f = {};
|
|
133
|
+
if (t) {
|
|
134
|
+
let m = !1, d = [];
|
|
135
|
+
for (let [p, g] of Object.entries(t)) typeof g == "boolean" && (m = !0), g === !0 && d.push(p.replace(/([A-Z])/g, (E) => `-${E.toLowerCase()}`));
|
|
136
|
+
if (m) {
|
|
137
|
+
f["data-headlessui-state"] = d.join(" ");
|
|
138
|
+
for (let p of d) f[`data-${p}`] = "";
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (i === k && (Object.keys(X(o)).length > 0 || Object.keys(X(f)).length > 0)) if (!At(s) || Array.isArray(s) && s.length > 1) {
|
|
142
|
+
if (Object.keys(X(o)).length > 0) throw new Error(['Passing props on "Fragment"!', "", `The current component <${r} /> is rendering a "Fragment".`, "However we need to passthrough the following props:", Object.keys(X(o)).concat(Object.keys(X(f))).map((m) => ` - ${m}`).join(`
|
|
143
|
+
`), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".', "Render a single element as the child so that we can forward the props onto that element."].map((m) => ` - ${m}`).join(`
|
|
144
|
+
`)].join(`
|
|
145
|
+
`));
|
|
146
|
+
} else {
|
|
147
|
+
let m = s.props, d = m == null ? void 0 : m.className, p = typeof d == "function" ? (...v) => Ie(d(...v), o.className) : Ie(d, o.className), g = p ? { className: p } : {}, E = tt(s.props, X(Re(o, ["ref"])));
|
|
148
|
+
for (let v in f) v in E && delete f[v];
|
|
149
|
+
return Nt(s, Object.assign({}, E, f, c, { ref: l(s.ref, c.ref) }, g));
|
|
150
|
+
}
|
|
151
|
+
return Ct(i, Object.assign({}, Re(o, ["ref"]), i !== k && c, i !== k && f), s);
|
|
152
|
+
}
|
|
153
|
+
function _t(...e) {
|
|
154
|
+
return e.every((t) => t == null) ? void 0 : (t) => {
|
|
155
|
+
for (let n of e) n != null && (typeof n == "function" ? n(t) : n.current = t);
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function tt(...e) {
|
|
159
|
+
if (e.length === 0) return {};
|
|
160
|
+
if (e.length === 1) return e[0];
|
|
161
|
+
let t = {}, n = {};
|
|
162
|
+
for (let r of e) for (let l in r) l.startsWith("on") && typeof r[l] == "function" ? (n[l] != null || (n[l] = []), n[l].push(r[l])) : t[l] = r[l];
|
|
163
|
+
if (t.disabled || t["aria-disabled"]) for (let r in n) /^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r) && (n[r] = [(l) => {
|
|
164
|
+
var i;
|
|
165
|
+
return (i = l == null ? void 0 : l.preventDefault) == null ? void 0 : i.call(l);
|
|
166
|
+
}]);
|
|
167
|
+
for (let r in n) Object.assign(t, { [r](l, ...i) {
|
|
168
|
+
let u = n[r];
|
|
169
|
+
for (let a of u) {
|
|
170
|
+
if ((l instanceof Event || (l == null ? void 0 : l.nativeEvent) instanceof Event) && l.defaultPrevented) return;
|
|
171
|
+
a(l, ...i);
|
|
172
|
+
}
|
|
173
|
+
} });
|
|
174
|
+
return t;
|
|
175
|
+
}
|
|
176
|
+
function S(e) {
|
|
177
|
+
var t;
|
|
178
|
+
return Object.assign(Ot(e), { displayName: (t = e.displayName) != null ? t : e.name });
|
|
179
|
+
}
|
|
180
|
+
function X(e) {
|
|
181
|
+
let t = Object.assign({}, e);
|
|
182
|
+
for (let n in t) t[n] === void 0 && delete t[n];
|
|
183
|
+
return t;
|
|
184
|
+
}
|
|
185
|
+
function Re(e, t = []) {
|
|
186
|
+
let n = Object.assign({}, e);
|
|
187
|
+
for (let r of t) r in n && delete n[r];
|
|
188
|
+
return n;
|
|
189
|
+
}
|
|
190
|
+
let Wt = "span";
|
|
191
|
+
var Te = ((e) => (e[e.None = 1] = "None", e[e.Focusable = 2] = "Focusable", e[e.Hidden = 4] = "Hidden", e))(Te || {});
|
|
192
|
+
function Bt(e, t) {
|
|
193
|
+
var n;
|
|
194
|
+
let { features: r = 1, ...l } = e, i = { ref: t, "aria-hidden": (r & 2) === 2 ? !0 : (n = l["aria-hidden"]) != null ? n : void 0, hidden: (r & 4) === 4 ? !0 : void 0, style: { position: "fixed", top: 1, left: 1, width: 1, height: 0, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0", ...(r & 4) === 4 && (r & 2) !== 2 && { display: "none" } } };
|
|
195
|
+
return D({ ourProps: i, theirProps: l, slot: {}, defaultTag: Wt, name: "Hidden" });
|
|
196
|
+
}
|
|
197
|
+
let He = S(Bt), nt = Symbol();
|
|
198
|
+
function Vt(e, t = !0) {
|
|
199
|
+
return Object.assign(e, { [nt]: t });
|
|
200
|
+
}
|
|
201
|
+
function H(...e) {
|
|
202
|
+
let t = w(e);
|
|
203
|
+
L(() => {
|
|
204
|
+
t.current = e;
|
|
205
|
+
}, [e]);
|
|
206
|
+
let n = b((r) => {
|
|
207
|
+
for (let l of t.current) l != null && (typeof l == "function" ? l(r) : l.current = r);
|
|
208
|
+
});
|
|
209
|
+
return e.every((r) => r == null || (r == null ? void 0 : r[nt])) ? void 0 : n;
|
|
210
|
+
}
|
|
211
|
+
let Ve = R(null);
|
|
212
|
+
Ve.displayName = "DescriptionContext";
|
|
213
|
+
function rt() {
|
|
214
|
+
let e = C(Ve);
|
|
215
|
+
if (e === null) {
|
|
216
|
+
let t = new Error("You used a <Description /> component, but it is not inside a relevant parent.");
|
|
217
|
+
throw Error.captureStackTrace && Error.captureStackTrace(t, rt), t;
|
|
218
|
+
}
|
|
219
|
+
return e;
|
|
220
|
+
}
|
|
221
|
+
function Yt() {
|
|
222
|
+
let [e, t] = N([]);
|
|
223
|
+
return [e.length > 0 ? e.join(" ") : void 0, O(() => function(n) {
|
|
224
|
+
let r = b((i) => (t((u) => [...u, i]), () => t((u) => {
|
|
225
|
+
let a = u.slice(), o = a.indexOf(i);
|
|
226
|
+
return o !== -1 && a.splice(o, 1), a;
|
|
227
|
+
}))), l = O(() => ({ register: r, slot: n.slot, name: n.name, props: n.props, value: n.value }), [r, n.slot, n.name, n.props, n.value]);
|
|
228
|
+
return h.createElement(Ve.Provider, { value: l }, n.children);
|
|
229
|
+
}, [t])];
|
|
230
|
+
}
|
|
231
|
+
let qt = "p";
|
|
232
|
+
function Gt(e, t) {
|
|
233
|
+
let n = me(), r = Ut(), { id: l = `headlessui-description-${n}`, ...i } = e, u = rt(), a = H(t);
|
|
234
|
+
P(() => u.register(l), [l, u.register]);
|
|
235
|
+
let o = r || !1, c = O(() => ({ ...u.slot, disabled: o }), [u.slot, o]), s = { ref: a, ...u.props, id: l };
|
|
236
|
+
return D({ ourProps: s, theirProps: i, slot: c, defaultTag: qt, name: u.name || "Description" });
|
|
237
|
+
}
|
|
238
|
+
let Kt = S(Gt), Xt = Object.assign(Kt, {});
|
|
239
|
+
var lt = ((e) => (e.Space = " ", e.Enter = "Enter", e.Escape = "Escape", e.Backspace = "Backspace", e.Delete = "Delete", e.ArrowLeft = "ArrowLeft", e.ArrowUp = "ArrowUp", e.ArrowRight = "ArrowRight", e.ArrowDown = "ArrowDown", e.Home = "Home", e.End = "End", e.PageUp = "PageUp", e.PageDown = "PageDown", e.Tab = "Tab", e))(lt || {});
|
|
240
|
+
let zt = R(() => {
|
|
241
|
+
});
|
|
242
|
+
function Zt({ value: e, children: t }) {
|
|
243
|
+
return h.createElement(zt.Provider, { value: e }, t);
|
|
244
|
+
}
|
|
245
|
+
let Jt = class extends Map {
|
|
246
|
+
constructor(t) {
|
|
247
|
+
super(), this.factory = t;
|
|
248
|
+
}
|
|
249
|
+
get(t) {
|
|
250
|
+
let n = super.get(t);
|
|
251
|
+
return n === void 0 && (n = this.factory(t), this.set(t, n)), n;
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
function ot(e, t) {
|
|
255
|
+
let n = e(), r = /* @__PURE__ */ new Set();
|
|
256
|
+
return { getSnapshot() {
|
|
257
|
+
return n;
|
|
258
|
+
}, subscribe(l) {
|
|
259
|
+
return r.add(l), () => r.delete(l);
|
|
260
|
+
}, dispatch(l, ...i) {
|
|
261
|
+
let u = t[l].call(n, ...i);
|
|
262
|
+
u && (n = u, r.forEach((a) => a()));
|
|
263
|
+
} };
|
|
264
|
+
}
|
|
265
|
+
function it(e) {
|
|
266
|
+
return Dt(e.subscribe, e.getSnapshot, e.getSnapshot);
|
|
267
|
+
}
|
|
268
|
+
let Qt = new Jt(() => ot(() => [], { ADD(e) {
|
|
269
|
+
return this.includes(e) ? this : [...this, e];
|
|
270
|
+
}, REMOVE(e) {
|
|
271
|
+
let t = this.indexOf(e);
|
|
272
|
+
if (t === -1) return this;
|
|
273
|
+
let n = this.slice();
|
|
274
|
+
return n.splice(t, 1), n;
|
|
275
|
+
} }));
|
|
276
|
+
function le(e, t) {
|
|
277
|
+
let n = Qt.get(t), r = me(), l = it(n);
|
|
278
|
+
if (P(() => {
|
|
279
|
+
if (e) return n.dispatch("ADD", r), () => n.dispatch("REMOVE", r);
|
|
280
|
+
}, [n, e]), !e) return !1;
|
|
281
|
+
let i = l.indexOf(r), u = l.length;
|
|
282
|
+
return i === -1 && (i = u, u += 1), i === u - 1;
|
|
283
|
+
}
|
|
284
|
+
let je = /* @__PURE__ */ new Map(), fe = /* @__PURE__ */ new Map();
|
|
285
|
+
function Xe(e) {
|
|
286
|
+
var t;
|
|
287
|
+
let n = (t = fe.get(e)) != null ? t : 0;
|
|
288
|
+
return fe.set(e, n + 1), n !== 0 ? () => ze(e) : (je.set(e, { "aria-hidden": e.getAttribute("aria-hidden"), inert: e.inert }), e.setAttribute("aria-hidden", "true"), e.inert = !0, () => ze(e));
|
|
289
|
+
}
|
|
290
|
+
function ze(e) {
|
|
291
|
+
var t;
|
|
292
|
+
let n = (t = fe.get(e)) != null ? t : 1;
|
|
293
|
+
if (n === 1 ? fe.delete(e) : fe.set(e, n - 1), n !== 1) return;
|
|
294
|
+
let r = je.get(e);
|
|
295
|
+
r && (r["aria-hidden"] === null ? e.removeAttribute("aria-hidden") : e.setAttribute("aria-hidden", r["aria-hidden"]), e.inert = r.inert, je.delete(e));
|
|
296
|
+
}
|
|
297
|
+
function en(e, { allowed: t, disallowed: n } = {}) {
|
|
298
|
+
let r = le(e, "inert-others");
|
|
299
|
+
P(() => {
|
|
300
|
+
var l, i;
|
|
301
|
+
if (!r) return;
|
|
302
|
+
let u = G();
|
|
303
|
+
for (let o of (l = n == null ? void 0 : n()) != null ? l : []) o && u.add(Xe(o));
|
|
304
|
+
let a = (i = t == null ? void 0 : t()) != null ? i : [];
|
|
305
|
+
for (let o of a) {
|
|
306
|
+
if (!o) continue;
|
|
307
|
+
let c = Pe(o);
|
|
308
|
+
if (!c) continue;
|
|
309
|
+
let s = o.parentElement;
|
|
310
|
+
for (; s && s !== c.body; ) {
|
|
311
|
+
for (let f of s.children) a.some((m) => f.contains(m)) || u.add(Xe(f));
|
|
312
|
+
s = s.parentElement;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return u.dispose;
|
|
316
|
+
}, [r, t, n]);
|
|
317
|
+
}
|
|
318
|
+
function ut(e, t, n) {
|
|
319
|
+
let r = Q((l) => {
|
|
320
|
+
let i = l.getBoundingClientRect();
|
|
321
|
+
i.x === 0 && i.y === 0 && i.width === 0 && i.height === 0 && n();
|
|
322
|
+
});
|
|
323
|
+
L(() => {
|
|
324
|
+
if (!e) return;
|
|
325
|
+
let l = t === null ? null : t instanceof HTMLElement ? t : t.current;
|
|
326
|
+
if (!l) return;
|
|
327
|
+
let i = G();
|
|
328
|
+
if (typeof ResizeObserver < "u") {
|
|
329
|
+
let u = new ResizeObserver(() => r.current(l));
|
|
330
|
+
u.observe(l), i.add(() => u.disconnect());
|
|
331
|
+
}
|
|
332
|
+
if (typeof IntersectionObserver < "u") {
|
|
333
|
+
let u = new IntersectionObserver(() => r.current(l));
|
|
334
|
+
u.observe(l), i.add(() => u.disconnect());
|
|
335
|
+
}
|
|
336
|
+
return () => i.dispose();
|
|
337
|
+
}, [t, r, e]);
|
|
338
|
+
}
|
|
339
|
+
let Fe = ["[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].map((e) => `${e}:not([tabindex='-1'])`).join(","), tn = ["[data-autofocus]"].map((e) => `${e}:not([tabindex='-1'])`).join(",");
|
|
340
|
+
var U = ((e) => (e[e.First = 1] = "First", e[e.Previous = 2] = "Previous", e[e.Next = 4] = "Next", e[e.Last = 8] = "Last", e[e.WrapAround = 16] = "WrapAround", e[e.NoScroll = 32] = "NoScroll", e[e.AutoFocus = 64] = "AutoFocus", e))(U || {}), Ue = ((e) => (e[e.Error = 0] = "Error", e[e.Overflow = 1] = "Overflow", e[e.Success = 2] = "Success", e[e.Underflow = 3] = "Underflow", e))(Ue || {}), nn = ((e) => (e[e.Previous = -1] = "Previous", e[e.Next = 1] = "Next", e))(nn || {});
|
|
341
|
+
function rn(e = document.body) {
|
|
342
|
+
return e == null ? [] : Array.from(e.querySelectorAll(Fe)).sort((t, n) => Math.sign((t.tabIndex || Number.MAX_SAFE_INTEGER) - (n.tabIndex || Number.MAX_SAFE_INTEGER)));
|
|
343
|
+
}
|
|
344
|
+
function ln(e = document.body) {
|
|
345
|
+
return e == null ? [] : Array.from(e.querySelectorAll(tn)).sort((t, n) => Math.sign((t.tabIndex || Number.MAX_SAFE_INTEGER) - (n.tabIndex || Number.MAX_SAFE_INTEGER)));
|
|
346
|
+
}
|
|
347
|
+
var at = ((e) => (e[e.Strict = 0] = "Strict", e[e.Loose = 1] = "Loose", e))(at || {});
|
|
348
|
+
function on(e, t = 0) {
|
|
349
|
+
var n;
|
|
350
|
+
return e === ((n = Pe(e)) == null ? void 0 : n.body) ? !1 : q(t, { 0() {
|
|
351
|
+
return e.matches(Fe);
|
|
352
|
+
}, 1() {
|
|
353
|
+
let r = e;
|
|
354
|
+
for (; r !== null; ) {
|
|
355
|
+
if (r.matches(Fe)) return !0;
|
|
356
|
+
r = r.parentElement;
|
|
357
|
+
}
|
|
358
|
+
return !1;
|
|
359
|
+
} });
|
|
360
|
+
}
|
|
361
|
+
var un = ((e) => (e[e.Keyboard = 0] = "Keyboard", e[e.Mouse = 1] = "Mouse", e))(un || {});
|
|
362
|
+
typeof window < "u" && typeof document < "u" && (document.addEventListener("keydown", (e) => {
|
|
363
|
+
e.metaKey || e.altKey || e.ctrlKey || (document.documentElement.dataset.headlessuiFocusVisible = "");
|
|
364
|
+
}, !0), document.addEventListener("click", (e) => {
|
|
365
|
+
e.detail === 1 ? delete document.documentElement.dataset.headlessuiFocusVisible : e.detail === 0 && (document.documentElement.dataset.headlessuiFocusVisible = "");
|
|
366
|
+
}, !0));
|
|
367
|
+
function _(e) {
|
|
368
|
+
e == null || e.focus({ preventScroll: !0 });
|
|
369
|
+
}
|
|
370
|
+
let an = ["textarea", "input"].join(",");
|
|
371
|
+
function sn(e) {
|
|
372
|
+
var t, n;
|
|
373
|
+
return (n = (t = e == null ? void 0 : e.matches) == null ? void 0 : t.call(e, an)) != null ? n : !1;
|
|
374
|
+
}
|
|
375
|
+
function cn(e, t = (n) => n) {
|
|
376
|
+
return e.slice().sort((n, r) => {
|
|
377
|
+
let l = t(n), i = t(r);
|
|
378
|
+
if (l === null || i === null) return 0;
|
|
379
|
+
let u = l.compareDocumentPosition(i);
|
|
380
|
+
return u & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : u & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
function pe(e, t, { sorted: n = !0, relativeTo: r = null, skipElements: l = [] } = {}) {
|
|
384
|
+
let i = Array.isArray(e) ? e.length > 0 ? e[0].ownerDocument : document : e.ownerDocument, u = Array.isArray(e) ? n ? cn(e) : e : t & 64 ? ln(e) : rn(e);
|
|
385
|
+
l.length > 0 && u.length > 1 && (u = u.filter((d) => !l.some((p) => p != null && "current" in p ? (p == null ? void 0 : p.current) === d : p === d))), r = r ?? i.activeElement;
|
|
386
|
+
let a = (() => {
|
|
387
|
+
if (t & 5) return 1;
|
|
388
|
+
if (t & 10) return -1;
|
|
389
|
+
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
|
|
390
|
+
})(), o = (() => {
|
|
391
|
+
if (t & 1) return 0;
|
|
392
|
+
if (t & 2) return Math.max(0, u.indexOf(r)) - 1;
|
|
393
|
+
if (t & 4) return Math.max(0, u.indexOf(r)) + 1;
|
|
394
|
+
if (t & 8) return u.length - 1;
|
|
395
|
+
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
|
|
396
|
+
})(), c = t & 32 ? { preventScroll: !0 } : {}, s = 0, f = u.length, m;
|
|
397
|
+
do {
|
|
398
|
+
if (s >= f || s + f <= 0) return 0;
|
|
399
|
+
let d = o + s;
|
|
400
|
+
if (t & 16) d = (d + f) % f;
|
|
401
|
+
else {
|
|
402
|
+
if (d < 0) return 3;
|
|
403
|
+
if (d >= f) return 1;
|
|
404
|
+
}
|
|
405
|
+
m = u[d], m == null || m.focus(c), s += a;
|
|
406
|
+
} while (m !== i.activeElement);
|
|
407
|
+
return t & 6 && sn(m) && m.select(), 2;
|
|
408
|
+
}
|
|
409
|
+
function st() {
|
|
410
|
+
return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
|
|
411
|
+
}
|
|
412
|
+
function dn() {
|
|
413
|
+
return /Android/gi.test(window.navigator.userAgent);
|
|
414
|
+
}
|
|
415
|
+
function fn() {
|
|
416
|
+
return st() || dn();
|
|
417
|
+
}
|
|
418
|
+
function se(e, t, n, r) {
|
|
419
|
+
let l = Q(n);
|
|
420
|
+
L(() => {
|
|
421
|
+
if (!e) return;
|
|
422
|
+
function i(u) {
|
|
423
|
+
l.current(u);
|
|
424
|
+
}
|
|
425
|
+
return document.addEventListener(t, i, r), () => document.removeEventListener(t, i, r);
|
|
426
|
+
}, [e, t, r]);
|
|
427
|
+
}
|
|
428
|
+
function ct(e, t, n, r) {
|
|
429
|
+
let l = Q(n);
|
|
430
|
+
L(() => {
|
|
431
|
+
if (!e) return;
|
|
432
|
+
function i(u) {
|
|
433
|
+
l.current(u);
|
|
434
|
+
}
|
|
435
|
+
return window.addEventListener(t, i, r), () => window.removeEventListener(t, i, r);
|
|
436
|
+
}, [e, t, r]);
|
|
437
|
+
}
|
|
438
|
+
const Ze = 30;
|
|
439
|
+
function pn(e, t, n) {
|
|
440
|
+
let r = le(e, "outside-click"), l = Q(n), i = re(function(o, c) {
|
|
441
|
+
if (o.defaultPrevented) return;
|
|
442
|
+
let s = c(o);
|
|
443
|
+
if (s === null || !s.getRootNode().contains(s) || !s.isConnected) return;
|
|
444
|
+
let f = function m(d) {
|
|
445
|
+
return typeof d == "function" ? m(d()) : Array.isArray(d) || d instanceof Set ? d : [d];
|
|
446
|
+
}(t);
|
|
447
|
+
for (let m of f) {
|
|
448
|
+
if (m === null) continue;
|
|
449
|
+
let d = m instanceof HTMLElement ? m : m.current;
|
|
450
|
+
if (d != null && d.contains(s) || o.composed && o.composedPath().includes(d)) return;
|
|
451
|
+
}
|
|
452
|
+
return !on(s, at.Loose) && s.tabIndex !== -1 && o.preventDefault(), l.current(o, s);
|
|
453
|
+
}, [l]), u = w(null);
|
|
454
|
+
se(r, "pointerdown", (o) => {
|
|
455
|
+
var c, s;
|
|
456
|
+
u.current = ((s = (c = o.composedPath) == null ? void 0 : c.call(o)) == null ? void 0 : s[0]) || o.target;
|
|
457
|
+
}, !0), se(r, "mousedown", (o) => {
|
|
458
|
+
var c, s;
|
|
459
|
+
u.current = ((s = (c = o.composedPath) == null ? void 0 : c.call(o)) == null ? void 0 : s[0]) || o.target;
|
|
460
|
+
}, !0), se(r, "click", (o) => {
|
|
461
|
+
fn() || u.current && (i(o, () => u.current), u.current = null);
|
|
462
|
+
}, !0);
|
|
463
|
+
let a = w({ x: 0, y: 0 });
|
|
464
|
+
se(r, "touchstart", (o) => {
|
|
465
|
+
a.current.x = o.touches[0].clientX, a.current.y = o.touches[0].clientY;
|
|
466
|
+
}, !0), se(r, "touchend", (o) => {
|
|
467
|
+
let c = { x: o.changedTouches[0].clientX, y: o.changedTouches[0].clientY };
|
|
468
|
+
if (!(Math.abs(c.x - a.current.x) >= Ze || Math.abs(c.y - a.current.y) >= Ze)) return i(o, () => o.target instanceof HTMLElement ? o.target : null);
|
|
469
|
+
}, !0), ct(r, "blur", (o) => i(o, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), !0);
|
|
470
|
+
}
|
|
471
|
+
function ve(...e) {
|
|
472
|
+
return O(() => Pe(...e), [...e]);
|
|
473
|
+
}
|
|
474
|
+
function dt(e, t, n, r) {
|
|
475
|
+
let l = Q(n);
|
|
476
|
+
L(() => {
|
|
477
|
+
e = e ?? window;
|
|
478
|
+
function i(u) {
|
|
479
|
+
l.current(u);
|
|
480
|
+
}
|
|
481
|
+
return e.addEventListener(t, i, r), () => e.removeEventListener(t, i, r);
|
|
482
|
+
}, [e, t, r]);
|
|
483
|
+
}
|
|
484
|
+
function mn() {
|
|
485
|
+
let e;
|
|
486
|
+
return { before({ doc: t }) {
|
|
487
|
+
var n;
|
|
488
|
+
let r = t.documentElement, l = (n = t.defaultView) != null ? n : window;
|
|
489
|
+
e = Math.max(0, l.innerWidth - r.clientWidth);
|
|
490
|
+
}, after({ doc: t, d: n }) {
|
|
491
|
+
let r = t.documentElement, l = Math.max(0, r.clientWidth - r.offsetWidth), i = Math.max(0, e - l);
|
|
492
|
+
n.style(r, "paddingRight", `${i}px`);
|
|
493
|
+
} };
|
|
494
|
+
}
|
|
495
|
+
function vn() {
|
|
496
|
+
return st() ? { before({ doc: e, d: t, meta: n }) {
|
|
497
|
+
function r(l) {
|
|
498
|
+
return n.containers.flatMap((i) => i()).some((i) => i.contains(l));
|
|
499
|
+
}
|
|
500
|
+
t.microTask(() => {
|
|
501
|
+
var l;
|
|
502
|
+
if (window.getComputedStyle(e.documentElement).scrollBehavior !== "auto") {
|
|
503
|
+
let a = G();
|
|
504
|
+
a.style(e.documentElement, "scrollBehavior", "auto"), t.add(() => t.microTask(() => a.dispose()));
|
|
505
|
+
}
|
|
506
|
+
let i = (l = window.scrollY) != null ? l : window.pageYOffset, u = null;
|
|
507
|
+
t.addEventListener(e, "click", (a) => {
|
|
508
|
+
if (a.target instanceof HTMLElement) try {
|
|
509
|
+
let o = a.target.closest("a");
|
|
510
|
+
if (!o) return;
|
|
511
|
+
let { hash: c } = new URL(o.href), s = e.querySelector(c);
|
|
512
|
+
s && !r(s) && (u = s);
|
|
513
|
+
} catch {
|
|
514
|
+
}
|
|
515
|
+
}, !0), t.addEventListener(e, "touchstart", (a) => {
|
|
516
|
+
if (a.target instanceof HTMLElement) if (r(a.target)) {
|
|
517
|
+
let o = a.target;
|
|
518
|
+
for (; o.parentElement && r(o.parentElement); ) o = o.parentElement;
|
|
519
|
+
t.style(o, "overscrollBehavior", "contain");
|
|
520
|
+
} else t.style(a.target, "touchAction", "none");
|
|
521
|
+
}), t.addEventListener(e, "touchmove", (a) => {
|
|
522
|
+
if (a.target instanceof HTMLElement) {
|
|
523
|
+
if (a.target.tagName === "INPUT") return;
|
|
524
|
+
if (r(a.target)) {
|
|
525
|
+
let o = a.target;
|
|
526
|
+
for (; o.parentElement && o.dataset.headlessuiPortal !== "" && !(o.scrollHeight > o.clientHeight || o.scrollWidth > o.clientWidth); ) o = o.parentElement;
|
|
527
|
+
o.dataset.headlessuiPortal === "" && a.preventDefault();
|
|
528
|
+
} else a.preventDefault();
|
|
529
|
+
}
|
|
530
|
+
}, { passive: !1 }), t.add(() => {
|
|
531
|
+
var a;
|
|
532
|
+
let o = (a = window.scrollY) != null ? a : window.pageYOffset;
|
|
533
|
+
i !== o && window.scrollTo(0, i), u && u.isConnected && (u.scrollIntoView({ block: "nearest" }), u = null);
|
|
534
|
+
});
|
|
535
|
+
});
|
|
536
|
+
} } : {};
|
|
537
|
+
}
|
|
538
|
+
function hn() {
|
|
539
|
+
return { before({ doc: e, d: t }) {
|
|
540
|
+
t.style(e.documentElement, "overflow", "hidden");
|
|
541
|
+
} };
|
|
542
|
+
}
|
|
543
|
+
function gn(e) {
|
|
544
|
+
let t = {};
|
|
545
|
+
for (let n of e) Object.assign(t, n(t));
|
|
546
|
+
return t;
|
|
547
|
+
}
|
|
548
|
+
let Z = ot(() => /* @__PURE__ */ new Map(), { PUSH(e, t) {
|
|
549
|
+
var n;
|
|
550
|
+
let r = (n = this.get(e)) != null ? n : { doc: e, count: 0, d: G(), meta: /* @__PURE__ */ new Set() };
|
|
551
|
+
return r.count++, r.meta.add(t), this.set(e, r), this;
|
|
552
|
+
}, POP(e, t) {
|
|
553
|
+
let n = this.get(e);
|
|
554
|
+
return n && (n.count--, n.meta.delete(t)), this;
|
|
555
|
+
}, SCROLL_PREVENT({ doc: e, d: t, meta: n }) {
|
|
556
|
+
let r = { doc: e, d: t, meta: gn(n) }, l = [vn(), mn(), hn()];
|
|
557
|
+
l.forEach(({ before: i }) => i == null ? void 0 : i(r)), l.forEach(({ after: i }) => i == null ? void 0 : i(r));
|
|
558
|
+
}, SCROLL_ALLOW({ d: e }) {
|
|
559
|
+
e.dispose();
|
|
560
|
+
}, TEARDOWN({ doc: e }) {
|
|
561
|
+
this.delete(e);
|
|
562
|
+
} });
|
|
563
|
+
Z.subscribe(() => {
|
|
564
|
+
let e = Z.getSnapshot(), t = /* @__PURE__ */ new Map();
|
|
565
|
+
for (let [n] of e) t.set(n, n.documentElement.style.overflow);
|
|
566
|
+
for (let n of e.values()) {
|
|
567
|
+
let r = t.get(n.doc) === "hidden", l = n.count !== 0;
|
|
568
|
+
(l && !r || !l && r) && Z.dispatch(n.count > 0 ? "SCROLL_PREVENT" : "SCROLL_ALLOW", n), n.count === 0 && Z.dispatch("TEARDOWN", n);
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
function En(e, t, n = () => ({ containers: [] })) {
|
|
572
|
+
let r = it(Z), l = t ? r.get(t) : void 0, i = l ? l.count > 0 : !1;
|
|
573
|
+
return P(() => {
|
|
574
|
+
if (!(!t || !e)) return Z.dispatch("PUSH", t, n), () => Z.dispatch("POP", t, n);
|
|
575
|
+
}, [e, t]), i;
|
|
576
|
+
}
|
|
577
|
+
function wn(e, t, n = () => [document.body]) {
|
|
578
|
+
let r = le(e, "scroll-lock");
|
|
579
|
+
En(r, t, (l) => {
|
|
580
|
+
var i;
|
|
581
|
+
return { containers: [...(i = l.containers) != null ? i : [], n] };
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
function bn(e) {
|
|
585
|
+
let t = { called: !1 };
|
|
586
|
+
return (...n) => {
|
|
587
|
+
if (!t.called) return t.called = !0, e(...n);
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
function yn(e = 0) {
|
|
591
|
+
let [t, n] = N(e), r = re((o) => n(o), [t]), l = re((o) => n((c) => c | o), [t]), i = re((o) => (t & o) === o, [t]), u = re((o) => n((c) => c & ~o), [n]), a = re((o) => n((c) => c ^ o), [n]);
|
|
592
|
+
return { flags: t, setFlag: r, addFlag: l, hasFlag: i, removeFlag: u, toggleFlag: a };
|
|
593
|
+
}
|
|
594
|
+
var $n = ((e) => (e[e.None = 0] = "None", e[e.Closed = 1] = "Closed", e[e.Enter = 2] = "Enter", e[e.Leave = 4] = "Leave", e))($n || {});
|
|
595
|
+
function Tn(e) {
|
|
596
|
+
let t = {};
|
|
597
|
+
for (let n in e) e[n] === !0 && (t[`data-${n}`] = "");
|
|
598
|
+
return t;
|
|
599
|
+
}
|
|
600
|
+
function Fn(e, t, n, r) {
|
|
601
|
+
let [l, i] = N(n), { hasFlag: u, addFlag: a, removeFlag: o } = yn(e && l ? 3 : 0), c = w(!1), s = w(!1), f = Be();
|
|
602
|
+
return P(function m() {
|
|
603
|
+
var d;
|
|
604
|
+
if (!e) return;
|
|
605
|
+
n && i(!0);
|
|
606
|
+
let p = t.current;
|
|
607
|
+
return p ? ((d = r == null ? void 0 : r.start) == null || d.call(r, n), Pn(p, { inFlight: c, prepare() {
|
|
608
|
+
s.current ? s.current = !1 : s.current = c.current, c.current = !0, !s.current && (n ? (a(3), o(4)) : (a(4), o(2)));
|
|
609
|
+
}, run() {
|
|
610
|
+
s.current ? n ? (o(3), a(4)) : (o(4), a(3)) : n ? o(1) : a(1);
|
|
611
|
+
}, done() {
|
|
612
|
+
var g;
|
|
613
|
+
s.current && typeof p.getAnimations == "function" && p.getAnimations().length > 0 || (c.current = !1, o(7), n || i(!1), (g = r == null ? void 0 : r.end) == null || g.call(r, n));
|
|
614
|
+
} })) : n ? (a(3), f.nextFrame(() => m())) : void 0;
|
|
615
|
+
}, [e, n, t, f]), e ? [l, { closed: u(1), enter: u(2), leave: u(4), transition: u(2) || u(4) }] : [n, { closed: void 0, enter: void 0, leave: void 0, transition: void 0 }];
|
|
616
|
+
}
|
|
617
|
+
function Pn(e, { prepare: t, run: n, done: r, inFlight: l }) {
|
|
618
|
+
let i = G();
|
|
619
|
+
return Ln(e, { prepare: t, inFlight: l }), i.nextFrame(() => {
|
|
620
|
+
i.add(Sn(e, r)), n();
|
|
621
|
+
}), i.dispose;
|
|
622
|
+
}
|
|
623
|
+
function Sn(e, t) {
|
|
624
|
+
let n = bn(t), r = G();
|
|
625
|
+
if (!e) return r.dispose;
|
|
626
|
+
let { transitionDuration: l, transitionDelay: i } = getComputedStyle(e), [u, a] = [l, i].map((c) => {
|
|
627
|
+
let [s = 0] = c.split(",").filter(Boolean).map((f) => f.includes("ms") ? parseFloat(f) : parseFloat(f) * 1e3).sort((f, m) => m - f);
|
|
628
|
+
return s;
|
|
629
|
+
}), o = u + a;
|
|
630
|
+
if (o !== 0) {
|
|
631
|
+
let c = r.group((s) => {
|
|
632
|
+
let f = s.setTimeout(() => {
|
|
633
|
+
n(), s.dispose();
|
|
634
|
+
}, o);
|
|
635
|
+
s.addEventListener(e, "transitionrun", (m) => {
|
|
636
|
+
m.target === m.currentTarget && (f(), s.addEventListener(e, "transitioncancel", (d) => {
|
|
637
|
+
d.target === d.currentTarget && (n(), c());
|
|
638
|
+
}));
|
|
639
|
+
});
|
|
640
|
+
});
|
|
641
|
+
r.addEventListener(e, "transitionend", (s) => {
|
|
642
|
+
s.target === s.currentTarget && (n(), r.dispose());
|
|
643
|
+
});
|
|
644
|
+
} else n();
|
|
645
|
+
return r.dispose;
|
|
646
|
+
}
|
|
647
|
+
function Ln(e, { inFlight: t, prepare: n }) {
|
|
648
|
+
if (t != null && t.current) {
|
|
649
|
+
n();
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
let r = e.style.transition;
|
|
653
|
+
e.style.transition = "none", n(), e.offsetHeight, e.style.transition = r;
|
|
654
|
+
}
|
|
655
|
+
function Ye(e, t) {
|
|
656
|
+
let n = w([]), r = b(e);
|
|
657
|
+
L(() => {
|
|
658
|
+
let l = [...n.current];
|
|
659
|
+
for (let [i, u] of t.entries()) if (n.current[i] !== u) {
|
|
660
|
+
let a = r(t, l);
|
|
661
|
+
return n.current = t, a;
|
|
662
|
+
}
|
|
663
|
+
}, [r, ...t]);
|
|
664
|
+
}
|
|
665
|
+
let Le = R(null);
|
|
666
|
+
Le.displayName = "OpenClosedContext";
|
|
667
|
+
var x = ((e) => (e[e.Open = 1] = "Open", e[e.Closed = 2] = "Closed", e[e.Closing = 4] = "Closing", e[e.Opening = 8] = "Opening", e))(x || {});
|
|
668
|
+
function Oe() {
|
|
669
|
+
return C(Le);
|
|
670
|
+
}
|
|
671
|
+
function On({ value: e, children: t }) {
|
|
672
|
+
return h.createElement(Le.Provider, { value: e }, t);
|
|
673
|
+
}
|
|
674
|
+
function An({ children: e }) {
|
|
675
|
+
return h.createElement(Le.Provider, { value: null }, e);
|
|
676
|
+
}
|
|
677
|
+
function Nn(e) {
|
|
678
|
+
function t() {
|
|
679
|
+
document.readyState !== "loading" && (e(), document.removeEventListener("DOMContentLoaded", t));
|
|
680
|
+
}
|
|
681
|
+
typeof window < "u" && typeof document < "u" && (document.addEventListener("DOMContentLoaded", t), t());
|
|
682
|
+
}
|
|
683
|
+
let V = [];
|
|
684
|
+
Nn(() => {
|
|
685
|
+
function e(t) {
|
|
686
|
+
if (!(t.target instanceof HTMLElement) || t.target === document.body || V[0] === t.target) return;
|
|
687
|
+
let n = t.target;
|
|
688
|
+
n = n.closest(Fe), V.unshift(n ?? t.target), V = V.filter((r) => r != null && r.isConnected), V.splice(10);
|
|
689
|
+
}
|
|
690
|
+
window.addEventListener("click", e, { capture: !0 }), window.addEventListener("mousedown", e, { capture: !0 }), window.addEventListener("focus", e, { capture: !0 }), document.body.addEventListener("click", e, { capture: !0 }), document.body.addEventListener("mousedown", e, { capture: !0 }), document.body.addEventListener("focus", e, { capture: !0 });
|
|
691
|
+
});
|
|
692
|
+
function ft(e) {
|
|
693
|
+
let t = b(e), n = w(!1);
|
|
694
|
+
L(() => (n.current = !1, () => {
|
|
695
|
+
n.current = !0, Se(() => {
|
|
696
|
+
n.current && t();
|
|
697
|
+
});
|
|
698
|
+
}), [t]);
|
|
699
|
+
}
|
|
700
|
+
function Cn() {
|
|
701
|
+
let e = typeof document > "u";
|
|
702
|
+
return "useSyncExternalStore" in de ? ((t) => t.useSyncExternalStore)(de)(() => () => {
|
|
703
|
+
}, () => !1, () => !e) : !1;
|
|
704
|
+
}
|
|
705
|
+
function he() {
|
|
706
|
+
let e = Cn(), [t, n] = de.useState(J.isHandoffComplete);
|
|
707
|
+
return t && J.isHandoffComplete === !1 && n(!1), de.useEffect(() => {
|
|
708
|
+
t !== !0 && n(!0);
|
|
709
|
+
}, [t]), de.useEffect(() => J.handoff(), []), e ? !1 : t;
|
|
710
|
+
}
|
|
711
|
+
let pt = R(!1);
|
|
712
|
+
function Dn() {
|
|
713
|
+
return C(pt);
|
|
714
|
+
}
|
|
715
|
+
function Je(e) {
|
|
716
|
+
return h.createElement(pt.Provider, { value: e.force }, e.children);
|
|
717
|
+
}
|
|
718
|
+
function Mn(e) {
|
|
719
|
+
let t = Dn(), n = C(vt), r = ve(e), [l, i] = N(() => {
|
|
720
|
+
var u;
|
|
721
|
+
if (!t && n !== null) return (u = n.current) != null ? u : null;
|
|
722
|
+
if (J.isServer) return null;
|
|
723
|
+
let a = r == null ? void 0 : r.getElementById("headlessui-portal-root");
|
|
724
|
+
if (a) return a;
|
|
725
|
+
if (r === null) return null;
|
|
726
|
+
let o = r.createElement("div");
|
|
727
|
+
return o.setAttribute("id", "headlessui-portal-root"), r.body.appendChild(o);
|
|
728
|
+
});
|
|
729
|
+
return L(() => {
|
|
730
|
+
l !== null && (r != null && r.body.contains(l) || r == null || r.body.appendChild(l));
|
|
731
|
+
}, [l, r]), L(() => {
|
|
732
|
+
t || n !== null && i(n.current);
|
|
733
|
+
}, [n, i, t]), l;
|
|
734
|
+
}
|
|
735
|
+
let mt = k, xn = S(function(e, t) {
|
|
736
|
+
let n = e, r = w(null), l = H(Vt((s) => {
|
|
737
|
+
r.current = s;
|
|
738
|
+
}), t), i = ve(r), u = Mn(r), [a] = N(() => {
|
|
739
|
+
var s;
|
|
740
|
+
return J.isServer ? null : (s = i == null ? void 0 : i.createElement("div")) != null ? s : null;
|
|
741
|
+
}), o = C(_e), c = he();
|
|
742
|
+
return P(() => {
|
|
743
|
+
!u || !a || u.contains(a) || (a.setAttribute("data-headlessui-portal", ""), u.appendChild(a));
|
|
744
|
+
}, [u, a]), P(() => {
|
|
745
|
+
if (a && o) return o.register(a);
|
|
746
|
+
}, [o, a]), ft(() => {
|
|
747
|
+
var s;
|
|
748
|
+
!u || !a || (a instanceof Node && u.contains(a) && u.removeChild(a), u.childNodes.length <= 0 && ((s = u.parentElement) == null || s.removeChild(u)));
|
|
749
|
+
}), c ? !u || !a ? null : kt(D({ ourProps: { ref: l }, theirProps: n, slot: {}, defaultTag: mt, name: "Portal" }), a) : null;
|
|
750
|
+
});
|
|
751
|
+
function kn(e, t) {
|
|
752
|
+
let n = H(t), { enabled: r = !0, ...l } = e;
|
|
753
|
+
return r ? h.createElement(xn, { ...l, ref: n }) : D({ ourProps: { ref: n }, theirProps: l, slot: {}, defaultTag: mt, name: "Portal" });
|
|
754
|
+
}
|
|
755
|
+
let Rn = k, vt = R(null);
|
|
756
|
+
function In(e, t) {
|
|
757
|
+
let { target: n, ...r } = e, l = { ref: H(t) };
|
|
758
|
+
return h.createElement(vt.Provider, { value: n }, D({ ourProps: l, theirProps: r, defaultTag: Rn, name: "Popover.Group" }));
|
|
759
|
+
}
|
|
760
|
+
let _e = R(null);
|
|
761
|
+
function Hn() {
|
|
762
|
+
let e = C(_e), t = w([]), n = b((i) => (t.current.push(i), e && e.register(i), () => r(i))), r = b((i) => {
|
|
763
|
+
let u = t.current.indexOf(i);
|
|
764
|
+
u !== -1 && t.current.splice(u, 1), e && e.unregister(i);
|
|
765
|
+
}), l = O(() => ({ register: n, unregister: r, portals: t }), [n, r, t]);
|
|
766
|
+
return [t, O(() => function({ children: i }) {
|
|
767
|
+
return h.createElement(_e.Provider, { value: l }, i);
|
|
768
|
+
}, [l])];
|
|
769
|
+
}
|
|
770
|
+
let jn = S(kn), ht = S(In), Un = Object.assign(jn, { Group: ht });
|
|
771
|
+
function _n(e, t = typeof document < "u" ? document.defaultView : null, n) {
|
|
772
|
+
let r = le(e, "escape");
|
|
773
|
+
dt(t, "keydown", (l) => {
|
|
774
|
+
r && (l.defaultPrevented || l.key === lt.Escape && n(l));
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
function Wn() {
|
|
778
|
+
var e;
|
|
779
|
+
let [t] = N(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(pointer: coarse)") : null), [n, r] = N((e = t == null ? void 0 : t.matches) != null ? e : !1);
|
|
780
|
+
return P(() => {
|
|
781
|
+
if (!t) return;
|
|
782
|
+
function l(i) {
|
|
783
|
+
r(i.matches);
|
|
784
|
+
}
|
|
785
|
+
return t.addEventListener("change", l), () => t.removeEventListener("change", l);
|
|
786
|
+
}, [t]), n;
|
|
787
|
+
}
|
|
788
|
+
function Bn({ defaultContainers: e = [], portals: t, mainTreeNode: n } = {}) {
|
|
789
|
+
let r = ve(n), l = b(() => {
|
|
790
|
+
var i, u;
|
|
791
|
+
let a = [];
|
|
792
|
+
for (let o of e) o !== null && (o instanceof HTMLElement ? a.push(o) : "current" in o && o.current instanceof HTMLElement && a.push(o.current));
|
|
793
|
+
if (t != null && t.current) for (let o of t.current) a.push(o);
|
|
794
|
+
for (let o of (i = r == null ? void 0 : r.querySelectorAll("html > *, body > *")) != null ? i : []) o !== document.body && o !== document.head && o instanceof HTMLElement && o.id !== "headlessui-portal-root" && (n && (o.contains(n) || o.contains((u = n == null ? void 0 : n.getRootNode()) == null ? void 0 : u.host)) || a.some((c) => o.contains(c)) || a.push(o));
|
|
795
|
+
return a;
|
|
796
|
+
});
|
|
797
|
+
return { resolveContainers: l, contains: b((i) => l().some((u) => u.contains(i))) };
|
|
798
|
+
}
|
|
799
|
+
let gt = R(null);
|
|
800
|
+
function Qe({ children: e, node: t }) {
|
|
801
|
+
let [n, r] = N(null), l = Et(t ?? n);
|
|
802
|
+
return h.createElement(gt.Provider, { value: l }, e, l === null && h.createElement(He, { features: Te.Hidden, ref: (i) => {
|
|
803
|
+
var u, a;
|
|
804
|
+
if (i) {
|
|
805
|
+
for (let o of (a = (u = Pe(i)) == null ? void 0 : u.querySelectorAll("html > *, body > *")) != null ? a : []) if (o !== document.body && o !== document.head && o instanceof HTMLElement && o != null && o.contains(i)) {
|
|
806
|
+
r(o);
|
|
807
|
+
break;
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
} }));
|
|
811
|
+
}
|
|
812
|
+
function Et(e = null) {
|
|
813
|
+
var t;
|
|
814
|
+
return (t = C(gt)) != null ? t : e;
|
|
815
|
+
}
|
|
816
|
+
function qe() {
|
|
817
|
+
let e = w(!1);
|
|
818
|
+
return P(() => (e.current = !0, () => {
|
|
819
|
+
e.current = !1;
|
|
820
|
+
}), []), e;
|
|
821
|
+
}
|
|
822
|
+
var ce = ((e) => (e[e.Forwards = 0] = "Forwards", e[e.Backwards = 1] = "Backwards", e))(ce || {});
|
|
823
|
+
function Vn() {
|
|
824
|
+
let e = w(0);
|
|
825
|
+
return ct(!0, "keydown", (t) => {
|
|
826
|
+
t.key === "Tab" && (e.current = t.shiftKey ? 1 : 0);
|
|
827
|
+
}, !0), e;
|
|
828
|
+
}
|
|
829
|
+
function wt(e) {
|
|
830
|
+
if (!e) return /* @__PURE__ */ new Set();
|
|
831
|
+
if (typeof e == "function") return new Set(e());
|
|
832
|
+
let t = /* @__PURE__ */ new Set();
|
|
833
|
+
for (let n of e.current) n.current instanceof HTMLElement && t.add(n.current);
|
|
834
|
+
return t;
|
|
835
|
+
}
|
|
836
|
+
let Yn = "div";
|
|
837
|
+
var z = ((e) => (e[e.None = 0] = "None", e[e.InitialFocus = 1] = "InitialFocus", e[e.TabLock = 2] = "TabLock", e[e.FocusLock = 4] = "FocusLock", e[e.RestoreFocus = 8] = "RestoreFocus", e[e.AutoFocus = 16] = "AutoFocus", e))(z || {});
|
|
838
|
+
function qn(e, t) {
|
|
839
|
+
let n = w(null), r = H(n, t), { initialFocus: l, initialFocusFallback: i, containers: u, features: a = 15, ...o } = e;
|
|
840
|
+
he() || (a = 0);
|
|
841
|
+
let c = ve(n);
|
|
842
|
+
zn(a, { ownerDocument: c });
|
|
843
|
+
let s = Zn(a, { ownerDocument: c, container: n, initialFocus: l, initialFocusFallback: i });
|
|
844
|
+
Jn(a, { ownerDocument: c, container: n, containers: u, previousActiveElement: s });
|
|
845
|
+
let f = Vn(), m = b((v) => {
|
|
846
|
+
let y = n.current;
|
|
847
|
+
y && ((M) => M())(() => {
|
|
848
|
+
q(f.current, { [ce.Forwards]: () => {
|
|
849
|
+
pe(y, U.First, { skipElements: [v.relatedTarget, i] });
|
|
850
|
+
}, [ce.Backwards]: () => {
|
|
851
|
+
pe(y, U.Last, { skipElements: [v.relatedTarget, i] });
|
|
852
|
+
} });
|
|
853
|
+
});
|
|
854
|
+
}), d = le(!!(a & 2), "focus-trap#tab-lock"), p = Be(), g = w(!1), E = { ref: r, onKeyDown(v) {
|
|
855
|
+
v.key == "Tab" && (g.current = !0, p.requestAnimationFrame(() => {
|
|
856
|
+
g.current = !1;
|
|
857
|
+
}));
|
|
858
|
+
}, onBlur(v) {
|
|
859
|
+
if (!(a & 4)) return;
|
|
860
|
+
let y = wt(u);
|
|
861
|
+
n.current instanceof HTMLElement && y.add(n.current);
|
|
862
|
+
let M = v.relatedTarget;
|
|
863
|
+
M instanceof HTMLElement && M.dataset.headlessuiFocusGuard !== "true" && (bt(y, M) || (g.current ? pe(n.current, q(f.current, { [ce.Forwards]: () => U.Next, [ce.Backwards]: () => U.Previous }) | U.WrapAround, { relativeTo: v.target }) : v.target instanceof HTMLElement && _(v.target)));
|
|
864
|
+
} };
|
|
865
|
+
return h.createElement(h.Fragment, null, d && h.createElement(He, { as: "button", type: "button", "data-headlessui-focus-guard": !0, onFocus: m, features: Te.Focusable }), D({ ourProps: E, theirProps: o, defaultTag: Yn, name: "FocusTrap" }), d && h.createElement(He, { as: "button", type: "button", "data-headlessui-focus-guard": !0, onFocus: m, features: Te.Focusable }));
|
|
866
|
+
}
|
|
867
|
+
let Gn = S(qn), Kn = Object.assign(Gn, { features: z });
|
|
868
|
+
function Xn(e = !0) {
|
|
869
|
+
let t = w(V.slice());
|
|
870
|
+
return Ye(([n], [r]) => {
|
|
871
|
+
r === !0 && n === !1 && Se(() => {
|
|
872
|
+
t.current.splice(0);
|
|
873
|
+
}), r === !1 && n === !0 && (t.current = V.slice());
|
|
874
|
+
}, [e, V, t]), b(() => {
|
|
875
|
+
var n;
|
|
876
|
+
return (n = t.current.find((r) => r != null && r.isConnected)) != null ? n : null;
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
function zn(e, { ownerDocument: t }) {
|
|
880
|
+
let n = !!(e & 8), r = Xn(n);
|
|
881
|
+
Ye(() => {
|
|
882
|
+
n || (t == null ? void 0 : t.activeElement) === (t == null ? void 0 : t.body) && _(r());
|
|
883
|
+
}, [n]), ft(() => {
|
|
884
|
+
n && _(r());
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
function Zn(e, { ownerDocument: t, container: n, initialFocus: r, initialFocusFallback: l }) {
|
|
888
|
+
let i = w(null), u = le(!!(e & 1), "focus-trap#initial-focus"), a = qe();
|
|
889
|
+
return Ye(() => {
|
|
890
|
+
if (e === 0) return;
|
|
891
|
+
if (!u) {
|
|
892
|
+
l != null && l.current && _(l.current);
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
895
|
+
let o = n.current;
|
|
896
|
+
o && Se(() => {
|
|
897
|
+
if (!a.current) return;
|
|
898
|
+
let c = t == null ? void 0 : t.activeElement;
|
|
899
|
+
if (r != null && r.current) {
|
|
900
|
+
if ((r == null ? void 0 : r.current) === c) {
|
|
901
|
+
i.current = c;
|
|
902
|
+
return;
|
|
903
|
+
}
|
|
904
|
+
} else if (o.contains(c)) {
|
|
905
|
+
i.current = c;
|
|
906
|
+
return;
|
|
907
|
+
}
|
|
908
|
+
if (r != null && r.current) _(r.current);
|
|
909
|
+
else {
|
|
910
|
+
if (e & 16) {
|
|
911
|
+
if (pe(o, U.First | U.AutoFocus) !== Ue.Error) return;
|
|
912
|
+
} else if (pe(o, U.First) !== Ue.Error) return;
|
|
913
|
+
if (l != null && l.current && (_(l.current), (t == null ? void 0 : t.activeElement) === l.current)) return;
|
|
914
|
+
console.warn("There are no focusable elements inside the <FocusTrap />");
|
|
915
|
+
}
|
|
916
|
+
i.current = t == null ? void 0 : t.activeElement;
|
|
917
|
+
});
|
|
918
|
+
}, [l, u, e]), i;
|
|
919
|
+
}
|
|
920
|
+
function Jn(e, { ownerDocument: t, container: n, containers: r, previousActiveElement: l }) {
|
|
921
|
+
let i = qe(), u = !!(e & 4);
|
|
922
|
+
dt(t == null ? void 0 : t.defaultView, "focus", (a) => {
|
|
923
|
+
if (!u || !i.current) return;
|
|
924
|
+
let o = wt(r);
|
|
925
|
+
n.current instanceof HTMLElement && o.add(n.current);
|
|
926
|
+
let c = l.current;
|
|
927
|
+
if (!c) return;
|
|
928
|
+
let s = a.target;
|
|
929
|
+
s && s instanceof HTMLElement ? bt(o, s) ? (l.current = s, _(s)) : (a.preventDefault(), a.stopPropagation(), _(c)) : _(l.current);
|
|
930
|
+
}, !0);
|
|
931
|
+
}
|
|
932
|
+
function bt(e, t) {
|
|
933
|
+
for (let n of e) if (n.contains(t)) return !0;
|
|
934
|
+
return !1;
|
|
935
|
+
}
|
|
936
|
+
function yt(e) {
|
|
937
|
+
var t;
|
|
938
|
+
return !!(e.enter || e.enterFrom || e.enterTo || e.leave || e.leaveFrom || e.leaveTo) || ((t = e.as) != null ? t : Tt) !== k || h.Children.count(e.children) === 1;
|
|
939
|
+
}
|
|
940
|
+
let Ae = R(null);
|
|
941
|
+
Ae.displayName = "TransitionContext";
|
|
942
|
+
var Qn = ((e) => (e.Visible = "visible", e.Hidden = "hidden", e))(Qn || {});
|
|
943
|
+
function er() {
|
|
944
|
+
let e = C(Ae);
|
|
945
|
+
if (e === null) throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
|
|
946
|
+
return e;
|
|
947
|
+
}
|
|
948
|
+
function tr() {
|
|
949
|
+
let e = C(Ne);
|
|
950
|
+
if (e === null) throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
|
|
951
|
+
return e;
|
|
952
|
+
}
|
|
953
|
+
let Ne = R(null);
|
|
954
|
+
Ne.displayName = "NestingContext";
|
|
955
|
+
function Ce(e) {
|
|
956
|
+
return "children" in e ? Ce(e.children) : e.current.filter(({ el: t }) => t.current !== null).filter(({ state: t }) => t === "visible").length > 0;
|
|
957
|
+
}
|
|
958
|
+
function $t(e, t) {
|
|
959
|
+
let n = Q(e), r = w([]), l = qe(), i = Be(), u = b((d, p = Y.Hidden) => {
|
|
960
|
+
let g = r.current.findIndex(({ el: E }) => E === d);
|
|
961
|
+
g !== -1 && (q(p, { [Y.Unmount]() {
|
|
962
|
+
r.current.splice(g, 1);
|
|
963
|
+
}, [Y.Hidden]() {
|
|
964
|
+
r.current[g].state = "hidden";
|
|
965
|
+
} }), i.microTask(() => {
|
|
966
|
+
var E;
|
|
967
|
+
!Ce(r) && l.current && ((E = n.current) == null || E.call(n));
|
|
968
|
+
}));
|
|
969
|
+
}), a = b((d) => {
|
|
970
|
+
let p = r.current.find(({ el: g }) => g === d);
|
|
971
|
+
return p ? p.state !== "visible" && (p.state = "visible") : r.current.push({ el: d, state: "visible" }), () => u(d, Y.Unmount);
|
|
972
|
+
}), o = w([]), c = w(Promise.resolve()), s = w({ enter: [], leave: [] }), f = b((d, p, g) => {
|
|
973
|
+
o.current.splice(0), t && (t.chains.current[p] = t.chains.current[p].filter(([E]) => E !== d)), t == null || t.chains.current[p].push([d, new Promise((E) => {
|
|
974
|
+
o.current.push(E);
|
|
975
|
+
})]), t == null || t.chains.current[p].push([d, new Promise((E) => {
|
|
976
|
+
Promise.all(s.current[p].map(([v, y]) => y)).then(() => E());
|
|
977
|
+
})]), p === "enter" ? c.current = c.current.then(() => t == null ? void 0 : t.wait.current).then(() => g(p)) : g(p);
|
|
978
|
+
}), m = b((d, p, g) => {
|
|
979
|
+
Promise.all(s.current[p].splice(0).map(([E, v]) => v)).then(() => {
|
|
980
|
+
var E;
|
|
981
|
+
(E = o.current.shift()) == null || E();
|
|
982
|
+
}).then(() => g(p));
|
|
983
|
+
});
|
|
984
|
+
return O(() => ({ children: r, register: a, unregister: u, onStart: f, onStop: m, wait: c, chains: s }), [a, u, r, f, m, s, c]);
|
|
985
|
+
}
|
|
986
|
+
let Tt = k, Ft = $e.RenderStrategy;
|
|
987
|
+
function nr(e, t) {
|
|
988
|
+
var n, r;
|
|
989
|
+
let { transition: l = !0, beforeEnter: i, afterEnter: u, beforeLeave: a, afterLeave: o, enter: c, enterFrom: s, enterTo: f, entered: m, leave: d, leaveFrom: p, leaveTo: g, ...E } = e, v = w(null), y = yt(e), M = H(...y ? [v, t] : t === null ? [] : [t]), F = (n = E.unmount) == null || n ? Y.Unmount : Y.Hidden, { show: A, appear: j, initial: ge } = er(), [I, oe] = N(A ? "visible" : "hidden"), ee = tr(), { register: W, unregister: K } = ee;
|
|
990
|
+
P(() => W(v), [W, v]), P(() => {
|
|
991
|
+
if (F === Y.Hidden && v.current) {
|
|
992
|
+
if (A && I !== "visible") {
|
|
993
|
+
oe("visible");
|
|
994
|
+
return;
|
|
995
|
+
}
|
|
996
|
+
return q(I, { hidden: () => K(v), visible: () => W(v) });
|
|
997
|
+
}
|
|
998
|
+
}, [I, v, W, K, A, F]);
|
|
999
|
+
let ie = he();
|
|
1000
|
+
P(() => {
|
|
1001
|
+
if (y && ie && I === "visible" && v.current === null) throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
|
|
1002
|
+
}, [v, I, ie, y]);
|
|
1003
|
+
let Me = ge && !j, Ee = j && A && ge, te = w(!1), ne = $t(() => {
|
|
1004
|
+
te.current || (oe("hidden"), K(v));
|
|
1005
|
+
}, ee), we = b((xe) => {
|
|
1006
|
+
te.current = !0;
|
|
1007
|
+
let be = xe ? "enter" : "leave";
|
|
1008
|
+
ne.onStart(v, be, (ae) => {
|
|
1009
|
+
ae === "enter" ? i == null || i() : ae === "leave" && (a == null || a());
|
|
1010
|
+
});
|
|
1011
|
+
}), B = b((xe) => {
|
|
1012
|
+
let be = xe ? "enter" : "leave";
|
|
1013
|
+
te.current = !1, ne.onStop(v, be, (ae) => {
|
|
1014
|
+
ae === "enter" ? u == null || u() : ae === "leave" && (o == null || o());
|
|
1015
|
+
}), be === "leave" && !Ce(ne) && (oe("hidden"), K(v));
|
|
1016
|
+
});
|
|
1017
|
+
L(() => {
|
|
1018
|
+
y && l || (we(A), B(A));
|
|
1019
|
+
}, [A, y, l]);
|
|
1020
|
+
let $ = !(!l || !y || !ie || Me), [, T] = Fn($, v, A, { start: we, end: B }), St = X({ ref: M, className: ((r = Ie(E.className, Ee && c, Ee && s, T.enter && c, T.enter && T.closed && s, T.enter && !T.closed && f, T.leave && d, T.leave && !T.closed && p, T.leave && T.closed && g, !T.transition && A && m)) == null ? void 0 : r.trim()) || void 0, ...Tn(T) }), ue = 0;
|
|
1021
|
+
return I === "visible" && (ue |= x.Open), I === "hidden" && (ue |= x.Closed), T.enter && (ue |= x.Opening), T.leave && (ue |= x.Closing), h.createElement(Ne.Provider, { value: ne }, h.createElement(On, { value: ue }, D({ ourProps: St, theirProps: E, defaultTag: Tt, features: Ft, visible: I === "visible", name: "Transition.Child" })));
|
|
1022
|
+
}
|
|
1023
|
+
function rr(e, t) {
|
|
1024
|
+
let { show: n, appear: r = !1, unmount: l = !0, ...i } = e, u = w(null), a = yt(e), o = H(...a ? [u, t] : t === null ? [] : [t]);
|
|
1025
|
+
he();
|
|
1026
|
+
let c = Oe();
|
|
1027
|
+
if (n === void 0 && c !== null && (n = (c & x.Open) === x.Open), n === void 0) throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
|
|
1028
|
+
let [s, f] = N(n ? "visible" : "hidden"), m = $t(() => {
|
|
1029
|
+
n || f("hidden");
|
|
1030
|
+
}), [d, p] = N(!0), g = w([n]);
|
|
1031
|
+
P(() => {
|
|
1032
|
+
d !== !1 && g.current[g.current.length - 1] !== n && (g.current.push(n), p(!1));
|
|
1033
|
+
}, [g, n]);
|
|
1034
|
+
let E = O(() => ({ show: n, appear: r, initial: d }), [n, r, d]);
|
|
1035
|
+
ut(n, u, () => f("hidden")), P(() => {
|
|
1036
|
+
n ? f("visible") : !Ce(m) && u.current !== null && f("hidden");
|
|
1037
|
+
}, [n, m]);
|
|
1038
|
+
let v = { unmount: l }, y = b(() => {
|
|
1039
|
+
var F;
|
|
1040
|
+
d && p(!1), (F = e.beforeEnter) == null || F.call(e);
|
|
1041
|
+
}), M = b(() => {
|
|
1042
|
+
var F;
|
|
1043
|
+
d && p(!1), (F = e.beforeLeave) == null || F.call(e);
|
|
1044
|
+
});
|
|
1045
|
+
return h.createElement(Ne.Provider, { value: m }, h.createElement(Ae.Provider, { value: E }, D({ ourProps: { ...v, as: k, children: h.createElement(Pt, { ref: o, ...v, ...i, beforeEnter: y, beforeLeave: M }) }, theirProps: {}, defaultTag: k, features: Ft, visible: s === "visible", name: "Transition" })));
|
|
1046
|
+
}
|
|
1047
|
+
function lr(e, t) {
|
|
1048
|
+
let n = C(Ae) !== null, r = Oe() !== null;
|
|
1049
|
+
return h.createElement(h.Fragment, null, !n && r ? h.createElement(We, { ref: t, ...e }) : h.createElement(Pt, { ref: t, ...e }));
|
|
1050
|
+
}
|
|
1051
|
+
let We = S(rr), Pt = S(nr), Ge = S(lr), or = Object.assign(We, { Child: Ge, Root: We });
|
|
1052
|
+
var ir = ((e) => (e[e.Open = 0] = "Open", e[e.Closed = 1] = "Closed", e))(ir || {}), ur = ((e) => (e[e.SetTitleId = 0] = "SetTitleId", e))(ur || {});
|
|
1053
|
+
let ar = { 0(e, t) {
|
|
1054
|
+
return e.titleId === t.id ? e : { ...e, titleId: t.id };
|
|
1055
|
+
} }, Ke = R(null);
|
|
1056
|
+
Ke.displayName = "DialogContext";
|
|
1057
|
+
function De(e) {
|
|
1058
|
+
let t = C(Ke);
|
|
1059
|
+
if (t === null) {
|
|
1060
|
+
let n = new Error(`<${e} /> is missing a parent <Dialog /> component.`);
|
|
1061
|
+
throw Error.captureStackTrace && Error.captureStackTrace(n, De), n;
|
|
1062
|
+
}
|
|
1063
|
+
return t;
|
|
1064
|
+
}
|
|
1065
|
+
function sr(e, t) {
|
|
1066
|
+
return q(t.type, ar, e, t);
|
|
1067
|
+
}
|
|
1068
|
+
let et = S(function(e, t) {
|
|
1069
|
+
let n = me(), { id: r = `headlessui-dialog-${n}`, open: l, onClose: i, initialFocus: u, role: a = "dialog", autoFocus: o = !0, __demoMode: c = !1, unmount: s = !1, ...f } = e, m = w(!1);
|
|
1070
|
+
a = function() {
|
|
1071
|
+
return a === "dialog" || a === "alertdialog" ? a : (m.current || (m.current = !0, console.warn(`Invalid role [${a}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)), "dialog");
|
|
1072
|
+
}();
|
|
1073
|
+
let d = Oe();
|
|
1074
|
+
l === void 0 && d !== null && (l = (d & x.Open) === x.Open);
|
|
1075
|
+
let p = w(null), g = H(p, t), E = ve(p), v = l ? 0 : 1, [y, M] = Mt(sr, { titleId: null, descriptionId: null, panelRef: xt() }), F = b(() => i(!1)), A = b(($) => M({ type: 0, id: $ })), j = he() ? v === 0 : !1, [ge, I] = Hn(), oe = { get current() {
|
|
1076
|
+
var $;
|
|
1077
|
+
return ($ = y.panelRef.current) != null ? $ : p.current;
|
|
1078
|
+
} }, ee = Et(), { resolveContainers: W } = Bn({ mainTreeNode: ee, portals: ge, defaultContainers: [oe] }), K = d !== null ? (d & x.Closing) === x.Closing : !1;
|
|
1079
|
+
en(c || K ? !1 : j, { allowed: b(() => {
|
|
1080
|
+
var $, T;
|
|
1081
|
+
return [(T = ($ = p.current) == null ? void 0 : $.closest("[data-headlessui-portal]")) != null ? T : null];
|
|
1082
|
+
}), disallowed: b(() => {
|
|
1083
|
+
var $;
|
|
1084
|
+
return [($ = ee == null ? void 0 : ee.closest("body > *:not(#headlessui-portal-root)")) != null ? $ : null];
|
|
1085
|
+
}) }), pn(j, W, ($) => {
|
|
1086
|
+
$.preventDefault(), F();
|
|
1087
|
+
}), _n(j, E == null ? void 0 : E.defaultView, ($) => {
|
|
1088
|
+
$.preventDefault(), $.stopPropagation(), document.activeElement && "blur" in document.activeElement && typeof document.activeElement.blur == "function" && document.activeElement.blur(), F();
|
|
1089
|
+
}), wn(c || K ? !1 : j, E, W), ut(j, p, F);
|
|
1090
|
+
let [ie, Me] = Yt(), Ee = O(() => [{ dialogState: v, close: F, setTitleId: A, unmount: s }, y], [v, y, F, A, s]), te = O(() => ({ open: v === 0 }), [v]), ne = { ref: g, id: r, role: a, tabIndex: -1, "aria-modal": c ? void 0 : v === 0 ? !0 : void 0, "aria-labelledby": y.titleId, "aria-describedby": ie, unmount: s }, we = !Wn(), B = z.None;
|
|
1091
|
+
return j && !c && (B |= z.RestoreFocus, B |= z.TabLock, o && (B |= z.AutoFocus), we && (B |= z.InitialFocus)), h.createElement(An, null, h.createElement(Je, { force: !0 }, h.createElement(Un, null, h.createElement(Ke.Provider, { value: Ee }, h.createElement(ht, { target: p }, h.createElement(Je, { force: !1 }, h.createElement(Me, { slot: te }, h.createElement(I, null, h.createElement(Kn, { initialFocus: u, initialFocusFallback: p, containers: W, features: B }, h.createElement(Zt, { value: F }, D({ ourProps: ne, theirProps: f, slot: te, defaultTag: cr, features: dr, visible: v === 0, name: "Dialog" })))))))))));
|
|
1092
|
+
}), cr = "div", dr = $e.RenderStrategy | $e.Static;
|
|
1093
|
+
function fr(e, t) {
|
|
1094
|
+
let { transition: n = !1, open: r, ...l } = e, i = Oe(), u = e.hasOwnProperty("open") || i !== null, a = e.hasOwnProperty("onClose");
|
|
1095
|
+
if (!u && !a) throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");
|
|
1096
|
+
if (!u) throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");
|
|
1097
|
+
if (!a) throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");
|
|
1098
|
+
if (!i && typeof e.open != "boolean") throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);
|
|
1099
|
+
if (typeof e.onClose != "function") throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);
|
|
1100
|
+
return (r !== void 0 || n) && !l.static ? h.createElement(Qe, null, h.createElement(or, { show: r, transition: n, unmount: l.unmount }, h.createElement(et, { ref: t, ...l }))) : h.createElement(Qe, null, h.createElement(et, { ref: t, open: r, ...l }));
|
|
1101
|
+
}
|
|
1102
|
+
let pr = "div";
|
|
1103
|
+
function mr(e, t) {
|
|
1104
|
+
let n = me(), { id: r = `headlessui-dialog-panel-${n}`, transition: l = !1, ...i } = e, [{ dialogState: u, unmount: a }, o] = De("Dialog.Panel"), c = H(t, o.panelRef), s = O(() => ({ open: u === 0 }), [u]), f = b((d) => {
|
|
1105
|
+
d.stopPropagation();
|
|
1106
|
+
}), m = { ref: c, id: r, onClick: f };
|
|
1107
|
+
return h.createElement(l ? Ge : k, { ...l ? { unmount: a } : {} }, D({ ourProps: m, theirProps: i, slot: s, defaultTag: pr, name: "Dialog.Panel" }));
|
|
1108
|
+
}
|
|
1109
|
+
let vr = "div";
|
|
1110
|
+
function hr(e, t) {
|
|
1111
|
+
let { transition: n = !1, ...r } = e, [{ dialogState: l, unmount: i }] = De("Dialog.Backdrop"), u = O(() => ({ open: l === 0 }), [l]), a = { ref: t, "aria-hidden": !0 };
|
|
1112
|
+
return h.createElement(n ? Ge : k, { ...n ? { unmount: i } : {} }, D({ ourProps: a, theirProps: r, slot: u, defaultTag: vr, name: "Dialog.Backdrop" }));
|
|
1113
|
+
}
|
|
1114
|
+
let gr = "h2";
|
|
1115
|
+
function Er(e, t) {
|
|
1116
|
+
let n = me(), { id: r = `headlessui-dialog-title-${n}`, ...l } = e, [{ dialogState: i, setTitleId: u }] = De("Dialog.Title"), a = H(t);
|
|
1117
|
+
L(() => (u(r), () => u(null)), [r, u]);
|
|
1118
|
+
let o = O(() => ({ open: i === 0 }), [i]);
|
|
1119
|
+
return D({ ourProps: { ref: a, id: r }, theirProps: l, slot: o, defaultTag: gr, name: "Dialog.Title" });
|
|
1120
|
+
}
|
|
1121
|
+
let wr = S(fr), br = S(mr);
|
|
1122
|
+
S(hr);
|
|
1123
|
+
let yr = S(Er), Sr = Object.assign(wr, { Panel: br, Title: yr, Description: Xt });
|
|
1124
|
+
export {
|
|
1125
|
+
Sr as P,
|
|
1126
|
+
yr as j
|
|
1127
|
+
};
|
|
1128
|
+
//# sourceMappingURL=dialog-DrJOKYL3.js.map
|