UNPKG

hello-csv

Version:

A modern CSV importer written in Preact

1,307 lines 415 kB
var Ba = Object.defineProperty; var ja = (e, t, n) => t in e ? Ba(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var Ae = (e, t, n) => ja(e, typeof t != "symbol" ? t + "" : t, n); var _n, re, ll, yt, Zo, sl, Nr, al, mo, kr, Ar, ul, dn = {}, cl = [], Ua = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Kn = Array.isArray; function rt(e, t) { for (var n in t) e[n] = t[n]; return e; } function go(e) { e && e.parentNode && e.parentNode.removeChild(e); } function P(e, t, n) { var r, o, i, l = {}; for (i in t) i == "key" ? r = t[i] : i == "ref" ? o = t[i] : l[i] = t[i]; if (arguments.length > 2 && (l.children = arguments.length > 3 ? _n.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null) for (i in e.defaultProps) l[i] === void 0 && (l[i] = e.defaultProps[i]); return on(e, l, r, o, null); } function on(e, t, n, r, o) { var i = { type: e, props: t, key: n, ref: r, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: o ?? ++ll, __i: -1, __u: 0 }; return o == null && re.vnode != null && re.vnode(i), i; } function Yn() { return { current: null }; } function me(e) { return e.children; } function ze(e, t) { this.props = e, this.context = t; } function Ht(e, t) { if (t == null) return e.__ ? Ht(e.__, e.__i + 1) : null; for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) return n.__e; return typeof e.type == "function" ? Ht(e) : null; } function dl(e) { var t, n; if ((e = e.__) != null && e.__c != null) { for (e.__e = e.__c.base = null, t = 0; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) { e.__e = e.__c.base = n.__e; break; } return dl(e); } } function Dr(e) { (!e.__d && (e.__d = !0) && yt.push(e) && !Vn.__r++ || Zo !== re.debounceRendering) && ((Zo = re.debounceRendering) || sl)(Vn); } function Vn() { var e, t, n, r, o, i, l, s; for (yt.sort(Nr); e = yt.shift(); ) e.__d && (t = yt.length, r = void 0, i = (o = (n = e).__v).__e, l = [], s = [], n.__P && ((r = rt({}, o)).__v = o.__v + 1, re.vnode && re.vnode(r), ho(n.__P, r, o, n.__n, n.__P.namespaceURI, 32 & o.__u ? [i] : null, l, i ?? Ht(o), !!(32 & o.__u), s), r.__v = o.__v, r.__.__k[r.__i] = r, ml(l, r, s), r.__e != i && dl(r)), yt.length > t && yt.sort(Nr)); Vn.__r = 0; } function fl(e, t, n, r, o, i, l, s, a, u, c) { var d, p, f, m, h, v, w = r && r.__k || cl, b = t.length; for (a = Wa(n, t, w, a, b), d = 0; d < b; d++) (f = n.__k[d]) != null && (p = f.__i === -1 ? dn : w[f.__i] || dn, f.__i = d, v = ho(e, f, p, o, i, l, s, a, u, c), m = f.__e, f.ref && p.ref != f.ref && (p.ref && vo(p.ref, null, f), c.push(f.ref, f.__c || m, f)), h == null && m != null && (h = m), 4 & f.__u || p.__k === f.__k ? a = pl(f, a, e) : typeof f.type == "function" && v !== void 0 ? a = v : m && (a = m.nextSibling), f.__u &= -7); return n.__e = h, a; } function Wa(e, t, n, r, o) { var i, l, s, a, u, c = n.length, d = c, p = 0; for (e.__k = new Array(o), i = 0; i < o; i++) (l = t[i]) != null && typeof l != "boolean" && typeof l != "function" ? (a = i + p, (l = e.__k[i] = typeof l == "string" || typeof l == "number" || typeof l == "bigint" || l.constructor == String ? on(null, l, null, null, null) : Kn(l) ? on(me, { children: l }, null, null, null) : l.constructor === void 0 && l.__b > 0 ? on(l.type, l.props, l.key, l.ref ? l.ref : null, l.__v) : l).__ = e, l.__b = e.__b + 1, s = null, (u = l.__i = Ga(l, n, a, d)) !== -1 && (d--, (s = n[u]) && (s.__u |= 2)), s == null || s.__v === null ? (u == -1 && p--, typeof l.type != "function" && (l.__u |= 4)) : u != a && (u == a - 1 ? p-- : u == a + 1 ? p++ : (u > a ? p-- : p++, l.__u |= 4))) : e.__k[i] = null; if (d) for (i = 0; i < c; i++) (s = n[i]) != null && (2 & s.__u) == 0 && (s.__e == r && (r = Ht(s)), gl(s, s)); return r; } function pl(e, t, n) { var r, o; if (typeof e.type == "function") { for (r = e.__k, o = 0; r && o < r.length; o++) r[o] && (r[o].__ = e, t = pl(r[o], t, n)); return t; } e.__e != t && (t && e.type && !n.contains(t) && (t = Ht(e)), n.insertBefore(e.__e, t || null), t = e.__e); do t = t && t.nextSibling; while (t != null && t.nodeType == 8); return t; } function ot(e, t) { return t = t || [], e == null || typeof e == "boolean" || (Kn(e) ? e.some(function(n) { ot(n, t); }) : t.push(e)), t; } function Ga(e, t, n, r) { var o, i, l = e.key, s = e.type, a = t[n]; if (a === null || a && l == a.key && s === a.type && (2 & a.__u) == 0) return n; if (r > (a != null && (2 & a.__u) == 0 ? 1 : 0)) for (o = n - 1, i = n + 1; o >= 0 || i < t.length; ) { if (o >= 0) { if ((a = t[o]) && (2 & a.__u) == 0 && l == a.key && s === a.type) return o; o--; } if (i < t.length) { if ((a = t[i]) && (2 & a.__u) == 0 && l == a.key && s === a.type) return i; i++; } } return -1; } function Jo(e, t, n) { t[0] == "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || Ua.test(t) ? n : n + "px"; } function In(e, t, n, r, o) { var i; e: if (t == "style") if (typeof n == "string") e.style.cssText = n; else { if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || Jo(e.style, t, ""); if (n) for (t in n) r && n[t] === r[t] || Jo(e.style, t, n[t]); } else if (t[0] == "o" && t[1] == "n") i = t != (t = t.replace(al, "$1")), t = t.toLowerCase() in e || t == "onFocusOut" || t == "onFocusIn" ? t.toLowerCase().slice(2) : t.slice(2), e.l || (e.l = {}), e.l[t + i] = n, n ? r ? n.u = r.u : (n.u = mo, e.addEventListener(t, i ? Ar : kr, i)) : e.removeEventListener(t, i ? Ar : kr, i); else { if (o == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); else if (t != "width" && t != "height" && t != "href" && t != "list" && t != "form" && t != "tabIndex" && t != "download" && t != "rowSpan" && t != "colSpan" && t != "role" && t != "popover" && t in e) try { e[t] = n ?? ""; break e; } catch { } typeof n == "function" || (n == null || n === !1 && t[4] != "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && n == 1 ? "" : n)); } } function Qo(e) { return function(t) { if (this.l) { var n = this.l[t.type + e]; if (t.t == null) t.t = mo++; else if (t.t < n.u) return; return n(re.event ? re.event(t) : t); } }; } function ho(e, t, n, r, o, i, l, s, a, u) { var c, d, p, f, m, h, v, w, b, C, E, I, M, R, _, y, x, S = t.type; if (t.constructor !== void 0) return null; 128 & n.__u && (a = !!(32 & n.__u), i = [s = t.__e = n.__e]), (c = re.__b) && c(t); e: if (typeof S == "function") try { if (w = t.props, b = "prototype" in S && S.prototype.render, C = (c = S.contextType) && r[c.__c], E = c ? C ? C.props.value : c.__ : r, n.__c ? v = (d = t.__c = n.__c).__ = d.__E : (b ? t.__c = d = new S(w, E) : (t.__c = d = new ze(w, E), d.constructor = S, d.render = Ka), C && C.sub(d), d.props = w, d.state || (d.state = {}), d.context = E, d.__n = r, p = d.__d = !0, d.__h = [], d._sb = []), b && d.__s == null && (d.__s = d.state), b && S.getDerivedStateFromProps != null && (d.__s == d.state && (d.__s = rt({}, d.__s)), rt(d.__s, S.getDerivedStateFromProps(w, d.__s))), f = d.props, m = d.state, d.__v = t, p) b && S.getDerivedStateFromProps == null && d.componentWillMount != null && d.componentWillMount(), b && d.componentDidMount != null && d.__h.push(d.componentDidMount); else { if (b && S.getDerivedStateFromProps == null && w !== f && d.componentWillReceiveProps != null && d.componentWillReceiveProps(w, E), !d.__e && (d.shouldComponentUpdate != null && d.shouldComponentUpdate(w, d.__s, E) === !1 || t.__v == n.__v)) { for (t.__v != n.__v && (d.props = w, d.state = d.__s, d.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(T) { T && (T.__ = t); }), I = 0; I < d._sb.length; I++) d.__h.push(d._sb[I]); d._sb = [], d.__h.length && l.push(d); break e; } d.componentWillUpdate != null && d.componentWillUpdate(w, d.__s, E), b && d.componentDidUpdate != null && d.__h.push(function() { d.componentDidUpdate(f, m, h); }); } if (d.context = E, d.props = w, d.__P = e, d.__e = !1, M = re.__r, R = 0, b) { for (d.state = d.__s, d.__d = !1, M && M(t), c = d.render(d.props, d.state, d.context), _ = 0; _ < d._sb.length; _++) d.__h.push(d._sb[_]); d._sb = []; } else do d.__d = !1, M && M(t), c = d.render(d.props, d.state, d.context), d.state = d.__s; while (d.__d && ++R < 25); d.state = d.__s, d.getChildContext != null && (r = rt(rt({}, r), d.getChildContext())), b && !p && d.getSnapshotBeforeUpdate != null && (h = d.getSnapshotBeforeUpdate(f, m)), s = fl(e, Kn(y = c != null && c.type === me && c.key == null ? c.props.children : c) ? y : [y], t, n, r, o, i, l, s, a, u), d.base = t.__e, t.__u &= -161, d.__h.length && l.push(d), v && (d.__E = d.__ = null); } catch (T) { if (t.__v = null, a || i != null) if (T.then) { for (t.__u |= a ? 160 : 128; s && s.nodeType == 8 && s.nextSibling; ) s = s.nextSibling; i[i.indexOf(s)] = null, t.__e = s; } else for (x = i.length; x--; ) go(i[x]); else t.__e = n.__e, t.__k = n.__k; re.__e(T, t, n); } else i == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : s = t.__e = qa(n.__e, t, n, r, o, i, l, a, u); return (c = re.diffed) && c(t), 128 & t.__u ? void 0 : s; } function ml(e, t, n) { for (var r = 0; r < n.length; r++) vo(n[r], n[++r], n[++r]); re.__c && re.__c(t, e), e.some(function(o) { try { e = o.__h, o.__h = [], e.some(function(i) { i.call(o); }); } catch (i) { re.__e(i, o.__v); } }); } function qa(e, t, n, r, o, i, l, s, a) { var u, c, d, p, f, m, h, v = n.props, w = t.props, b = t.type; if (b == "svg" ? o = "http://www.w3.org/2000/svg" : b == "math" ? o = "http://www.w3.org/1998/Math/MathML" : o || (o = "http://www.w3.org/1999/xhtml"), i != null) { for (u = 0; u < i.length; u++) if ((f = i[u]) && "setAttribute" in f == !!b && (b ? f.localName == b : f.nodeType == 3)) { e = f, i[u] = null; break; } } if (e == null) { if (b == null) return document.createTextNode(w); e = document.createElementNS(o, b, w.is && w), s && (re.__m && re.__m(t, i), s = !1), i = null; } if (b === null) v === w || s && e.data === w || (e.data = w); else { if (i = i && _n.call(e.childNodes), v = n.props || dn, !s && i != null) for (v = {}, u = 0; u < e.attributes.length; u++) v[(f = e.attributes[u]).name] = f.value; for (u in v) if (f = v[u], u != "children") { if (u == "dangerouslySetInnerHTML") d = f; else if (!(u in w)) { if (u == "value" && "defaultValue" in w || u == "checked" && "defaultChecked" in w) continue; In(e, u, null, f, o); } } for (u in w) f = w[u], u == "children" ? p = f : u == "dangerouslySetInnerHTML" ? c = f : u == "value" ? m = f : u == "checked" ? h = f : s && typeof f != "function" || v[u] === f || In(e, u, f, v[u], o); if (c) s || d && (c.__html === d.__html || c.__html === e.innerHTML) || (e.innerHTML = c.__html), t.__k = []; else if (d && (e.innerHTML = ""), fl(e, Kn(p) ? p : [p], t, n, r, b == "foreignObject" ? "http://www.w3.org/1999/xhtml" : o, i, l, i ? i[0] : n.__k && Ht(n, 0), s, a), i != null) for (u = i.length; u--; ) go(i[u]); s || (u = "value", b == "progress" && m == null ? e.removeAttribute("value") : m !== void 0 && (m !== e[u] || b == "progress" && !m || b == "option" && m !== v[u]) && In(e, u, m, v[u], o), u = "checked", h !== void 0 && h !== e[u] && In(e, u, h, v[u], o)); } return e; } function vo(e, t, n) { try { if (typeof e == "function") { var r = typeof e.__u == "function"; r && e.__u(), r && t == null || (e.__u = e(t)); } else e.current = t; } catch (o) { re.__e(o, n); } } function gl(e, t, n) { var r, o; if (re.unmount && re.unmount(e), (r = e.ref) && (r.current && r.current !== e.__e || vo(r, null, t)), (r = e.__c) != null) { if (r.componentWillUnmount) try { r.componentWillUnmount(); } catch (i) { re.__e(i, t); } r.base = r.__P = null; } if (r = e.__k) for (o = 0; o < r.length; o++) r[o] && gl(r[o], t, n || typeof e.type != "function"); n || go(e.__e), e.__c = e.__ = e.__e = void 0; } function Ka(e, t, n) { return this.constructor(e, n); } function zt(e, t, n) { var r, o, i, l; t == document && (t = document.documentElement), re.__ && re.__(e, t), o = (r = typeof n == "function") ? null : n && n.__k || t.__k, i = [], l = [], ho(t, e = (!r && n || t).__k = P(me, null, [e]), o || dn, dn, t.namespaceURI, !r && n ? [n] : o ? null : t.firstChild ? _n.call(t.childNodes) : null, i, !r && n ? n : o ? o.__e : t.firstChild, r, l), ml(i, e, l); } function hl(e, t) { zt(e, t, hl); } function Ya(e, t, n) { var r, o, i, l, s = rt({}, e.props); for (i in e.type && e.type.defaultProps && (l = e.type.defaultProps), t) i == "key" ? r = t[i] : i == "ref" ? o = t[i] : s[i] = t[i] === void 0 && l !== void 0 ? l[i] : t[i]; return arguments.length > 2 && (s.children = arguments.length > 3 ? _n.call(arguments, 2) : n), on(e.type, s, r || e.key, o || e.ref, null); } function pe(e, t) { var n = { __c: t = "__cC" + ul++, __: e, Consumer: function(r, o) { return r.children(o); }, Provider: function(r) { var o, i; return this.getChildContext || (o = /* @__PURE__ */ new Set(), (i = {})[t] = this, this.getChildContext = function() { return i; }, this.componentWillUnmount = function() { o = null; }, this.shouldComponentUpdate = function(l) { this.props.value !== l.value && o.forEach(function(s) { s.__e = !0, Dr(s); }); }, this.sub = function(l) { o.add(l); var s = l.componentWillUnmount; l.componentWillUnmount = function() { o && o.delete(l), s && s.call(l); }; }), r.children; } }; return n.Provider.__ = n.Consumer.contextType = n; } _n = cl.slice, re = { __e: function(e, t, n, r) { for (var o, i, l; t = t.__; ) if ((o = t.__c) && !o.__) try { if ((i = o.constructor) && i.getDerivedStateFromError != null && (o.setState(i.getDerivedStateFromError(e)), l = o.__d), o.componentDidCatch != null && (o.componentDidCatch(e, r || {}), l = o.__d), l) return o.__E = o; } catch (s) { e = s; } throw e; } }, ll = 0, ze.prototype.setState = function(e, t) { var n; n = this.__s != null && this.__s !== this.state ? this.__s : this.__s = rt({}, this.state), typeof e == "function" && (e = e(rt({}, n), this.props)), e && rt(n, e), e != null && this.__v && (t && this._sb.push(t), Dr(this)); }, ze.prototype.forceUpdate = function(e) { this.__v && (this.__e = !0, e && this.__h.push(e), Dr(this)); }, ze.prototype.render = me, yt = [], sl = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Nr = function(e, t) { return e.__v.__b - t.__v.__b; }, Vn.__r = 0, al = /(PointerCapture)$|Capture$/i, mo = 0, kr = Qo(!1), Ar = Qo(!0), ul = 0; var Xa = 0; function g(e, t, n, r, o, i) { t || (t = {}); var l, s, a = t; if ("ref" in a) for (s in a = {}, t) s == "ref" ? l = t[s] : a[s] = t[s]; var u = { type: e, props: a, key: n, ref: l, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --Xa, __i: -1, __u: 0, __source: o, __self: i }; if (typeof e == "function" && (l = e.defaultProps)) for (s in l) a[s] === void 0 && (a[s] = l[s]); return re.vnode && re.vnode(u), u; } var lt, fe, gr, ei, Bt = 0, vl = [], _e = re, ti = _e.__b, ni = _e.__r, ri = _e.diffed, oi = _e.__c, ii = _e.unmount, li = _e.__; function Tt(e, t) { _e.__h && _e.__h(fe, e, Bt || t), Bt = 0; var n = fe.__H || (fe.__H = { __: [], __h: [] }); return e >= n.__.length && n.__.push({}), n.__[e]; } function U(e) { return Bt = 1, st(_l, e); } function st(e, t, n) { var r = Tt(lt++, 2); if (r.t = e, !r.__c && (r.__ = [n ? n(t) : _l(void 0, t), function(s) { var a = r.__N ? r.__N[0] : r.__[0], u = r.t(a, s); a !== u && (r.__N = [u, r.__[1]], r.__c.setState({})); }], r.__c = fe, !fe.u)) { var o = function(s, a, u) { if (!r.__c.__H) return !0; var c = r.__c.__H.__.filter(function(p) { return !!p.__c; }); if (c.every(function(p) { return !p.__N; })) return !i || i.call(this, s, a, u); var d = r.__c.props !== s; return c.forEach(function(p) { if (p.__N) { var f = p.__[0]; p.__ = p.__N, p.__N = void 0, f !== p.__[0] && (d = !0); } }), i && i.call(this, s, a, u) || d; }; fe.u = !0; var i = fe.shouldComponentUpdate, l = fe.componentWillUpdate; fe.componentWillUpdate = function(s, a, u) { if (this.__e) { var c = i; i = void 0, o(s, a, u), i = c; } l && l.call(this, s, a, u); }, fe.shouldComponentUpdate = o; } return r.__N || r.__; } function oe(e, t) { var n = Tt(lt++, 3); !_e.__s && yo(n.__H, t) && (n.__ = e, n.i = t, fe.__H.__h.push(n)); } function Ze(e, t) { var n = Tt(lt++, 4); !_e.__s && yo(n.__H, t) && (n.__ = e, n.i = t, fe.__h.push(n)); } function D(e) { return Bt = 5, W(function() { return { current: e }; }, []); } function _o(e, t, n) { Bt = 6, Ze(function() { return typeof e == "function" ? (e(t()), function() { return e(null); }) : e ? (e.current = t(), function() { return e.current = null; }) : void 0; }, n == null ? n : n.concat(e)); } function W(e, t) { var n = Tt(lt++, 7); return yo(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__; } function ie(e, t) { return Bt = 8, W(function() { return e; }, t); } function ae(e) { var t = fe.context[e.__c], n = Tt(lt++, 9); return n.c = e, t ? (n.__ == null && (n.__ = !0, t.sub(fe)), t.props.value) : e.__; } function wo(e, t) { _e.useDebugValue && _e.useDebugValue(t ? t(e) : e); } function Za(e) { var t = Tt(lt++, 10), n = U(); return t.__ = e, fe.componentDidCatch || (fe.componentDidCatch = function(r, o) { t.__ && t.__(r, o), n[1](r); }), [n[0], function() { n[1](void 0); }]; } function Me() { var e = Tt(lt++, 11); if (!e.__) { for (var t = fe.__v; t !== null && !t.__m && t.__ !== null; ) t = t.__; var n = t.__m || (t.__m = [0, 0]); e.__ = "P" + n[0] + "-" + n[1]++; } return e.__; } function Ja() { for (var e; e = vl.shift(); ) if (e.__P && e.__H) try { e.__H.__h.forEach(kn), e.__H.__h.forEach(Lr), e.__H.__h = []; } catch (t) { e.__H.__h = [], _e.__e(t, e.__v); } } _e.__b = function(e) { fe = null, ti && ti(e); }, _e.__ = function(e, t) { e && t.__k && t.__k.__m && (e.__m = t.__k.__m), li && li(e, t); }, _e.__r = function(e) { ni && ni(e), lt = 0; var t = (fe = e.__c).__H; t && (gr === fe ? (t.__h = [], fe.__h = [], t.__.forEach(function(n) { n.__N && (n.__ = n.__N), n.i = n.__N = void 0; })) : (t.__h.forEach(kn), t.__h.forEach(Lr), t.__h = [], lt = 0)), gr = fe; }, _e.diffed = function(e) { ri && ri(e); var t = e.__c; t && t.__H && (t.__H.__h.length && (vl.push(t) !== 1 && ei === _e.requestAnimationFrame || ((ei = _e.requestAnimationFrame) || Qa)(Ja)), t.__H.__.forEach(function(n) { n.i && (n.__H = n.i), n.i = void 0; })), gr = fe = null; }, _e.__c = function(e, t) { t.some(function(n) { try { n.__h.forEach(kn), n.__h = n.__h.filter(function(r) { return !r.__ || Lr(r); }); } catch (r) { t.some(function(o) { o.__h && (o.__h = []); }), t = [], _e.__e(r, n.__v); } }), oi && oi(e, t); }, _e.unmount = function(e) { ii && ii(e); var t, n = e.__c; n && n.__H && (n.__H.__.forEach(function(r) { try { kn(r); } catch (o) { t = o; } }), n.__H = void 0, t && _e.__e(t, n.__v)); }; var si = typeof requestAnimationFrame == "function"; function Qa(e) { var t, n = function() { clearTimeout(r), si && cancelAnimationFrame(t), setTimeout(e); }, r = setTimeout(n, 100); si && (t = requestAnimationFrame(n)); } function kn(e) { var t = fe, n = e.__c; typeof n == "function" && (e.__c = void 0, n()), fe = t; } function Lr(e) { var t = fe; e.__c = e.__(), fe = t; } function yo(e, t) { return !e || e.length !== t.length || t.some(function(n, r) { return n !== e[r]; }); } function _l(e, t) { return typeof t == "function" ? t(e) : t; } function wl(e) { var t, n, r = ""; if (typeof e == "string" || typeof e == "number") r += e; else if (typeof e == "object") if (Array.isArray(e)) { var o = e.length; for (t = 0; t < o; t++) e[t] && (n = wl(e[t])) && (r && (r += " "), r += n); } else for (n in e) e[n] && (r && (r += " "), r += n); return r; } function eu() { for (var e, t, n = 0, r = "", o = arguments.length; n < o; n++) (e = arguments[n]) && (t = wl(e)) && (r && (r += " "), r += t); return r; } const ai = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, ui = eu, It = (e, t) => (n) => { var r; if ((t == null ? void 0 : t.variants) == null) return ui(e, n == null ? void 0 : n.class, n == null ? void 0 : n.className); const { variants: o, defaultVariants: i } = t, l = Object.keys(o).map((u) => { const c = n == null ? void 0 : n[u], d = i == null ? void 0 : i[u]; if (c === null) return null; const p = ai(c) || ai(d); return o[u][p]; }), s = n && Object.entries(n).reduce((u, c) => { let [d, p] = c; return p === void 0 || (u[d] = p), u; }, {}), a = t == null || (r = t.compoundVariants) === null || r === void 0 ? void 0 : r.reduce((u, c) => { let { class: d, className: p, ...f } = c; return Object.entries(f).every((m) => { let [h, v] = m; return Array.isArray(v) ? v.includes({ ...i, ...s }[h]) : { ...i, ...s }[h] === v; }) ? [ ...u, d, p ] : u; }, []); return ui(e, l, a, n == null ? void 0 : n.class, n == null ? void 0 : n.className); }, tu = It( "text-center inline-block font-semibold px-3 py-2 rounded-md text-sm", { variants: { variant: { primary: "shadow-xs bg-hello-csv-primary text-white", secondary: "bg-white text-hello-csv-primary ring-1 shadow-xs ring-bg-hello-csv-primary ring-inset", tertiary: "bg-white text-gray-900 ring-1 shadow-xs ring-hello-csv-tertiary ring-inset", success: "shadow-xs bg-hello-csv-success text-white", danger: "shadow-xs bg-hello-csv-danger text-white" }, withFullWidth: { true: "w-full", false: "" }, disabled: { true: "opacity-50 cursor-not-allowed pointer-events-none", false: "cursor-pointer" } }, compoundVariants: [ { variant: "primary", disabled: !1, className: "hover:bg-hello-csv-primary-light focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-hello-csv-primary" }, { variant: "secondary", disabled: !1, className: "hover:opacity-80 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-hello-csv-secondary" }, { variant: "tertiary", disabled: !1, className: "hover:bg-hello-csv-tertiary-light" }, { variant: "success", disabled: !1, className: "hover:opacity-80 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-hello-csv-success" }, { variant: "danger", disabled: !1, className: "hover:bg-hello-csv-danger-light focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-hello-csv-danger" } ], defaultVariants: { withFullWidth: !1, variant: "primary", disabled: !1 } } ); function He({ children: e, variant: t, disabled: n, onClick: r, withFullWidth: o }) { const i = tu({ variant: t, disabled: n, withFullWidth: o }); return /* @__PURE__ */ g( "div", { role: "button", tabIndex: 0, className: i, onClick: r, "aria-disabled": n, children: e } ); } function yl(e, t) { for (var n in t) e[n] = t[n]; return e; } function Vr(e, t) { for (var n in e) if (n !== "__source" && !(n in t)) return !0; for (var r in t) if (r !== "__source" && e[r] !== t[r]) return !0; return !1; } function Xn(e, t) { var n = t(), r = U({ t: { __: n, u: t } }), o = r[0].t, i = r[1]; return Ze(function() { o.__ = n, o.u = t, hr(o) && i({ t: o }); }, [e, n, t]), oe(function() { return hr(o) && i({ t: o }), e(function() { hr(o) && i({ t: o }); }); }, [e]), n; } function hr(e) { var t, n, r = e.u, o = e.__; try { var i = r(); return !((t = o) === (n = i) && (t !== 0 || 1 / t == 1 / n) || t != t && n != n); } catch { return !0; } } function bo(e) { e(); } function xo(e) { return e; } function Co() { return [!1, bo]; } var So = Ze; function Hn(e, t) { this.props = e, this.context = t; } function bl(e, t) { function n(o) { var i = this.props.ref, l = i == o.ref; return !l && i && (i.call ? i(null) : i.current = null), t ? !t(this.props, o) || !l : Vr(this.props, o); } function r(o) { return this.shouldComponentUpdate = n, P(e, o); } return r.displayName = "Memo(" + (e.displayName || e.name) + ")", r.prototype.isReactComponent = !0, r.__f = !0, r; } (Hn.prototype = new ze()).isPureReactComponent = !0, Hn.prototype.shouldComponentUpdate = function(e, t) { return Vr(this.props, e) || Vr(this.state, t); }; var ci = re.__b; re.__b = function(e) { e.type && e.type.__f && e.ref && (e.props.ref = e.ref, e.ref = null), ci && ci(e); }; var nu = typeof Symbol < "u" && Symbol.for && Symbol.for("react.forward_ref") || 3911; function de(e) { function t(n) { var r = yl({}, n); return delete r.ref, e(r, n.ref || null); } return t.$$typeof = nu, t.render = t, t.prototype.isReactComponent = t.__f = !0, t.displayName = "ForwardRef(" + (e.displayName || e.name) + ")", t; } var di = function(e, t) { return e == null ? null : ot(ot(e).map(t)); }, xl = { map: di, forEach: di, count: function(e) { return e ? ot(e).length : 0; }, only: function(e) { var t = ot(e); if (t.length !== 1) throw "Children.only"; return t[0]; }, toArray: ot }, ru = re.__e; re.__e = function(e, t, n, r) { if (e.then) { for (var o, i = t; i = i.__; ) if ((o = i.__c) && o.__c) return t.__e == null && (t.__e = n.__e, t.__k = n.__k), o.__c(e, t); } ru(e, t, n, r); }; var fi = re.unmount; function Cl(e, t, n) { return e && (e.__c && e.__c.__H && (e.__c.__H.__.forEach(function(r) { typeof r.__c == "function" && r.__c(); }), e.__c.__H = null), (e = yl({}, e)).__c != null && (e.__c.__P === n && (e.__c.__P = t), e.__c = null), e.__k = e.__k && e.__k.map(function(r) { return Cl(r, t, n); })), e; } function Sl(e, t, n) { return e && n && (e.__v = null, e.__k = e.__k && e.__k.map(function(r) { return Sl(r, t, n); }), e.__c && e.__c.__P === t && (e.__e && n.appendChild(e.__e), e.__c.__e = !0, e.__c.__P = n)), e; } function ln() { this.__u = 0, this.o = null, this.__b = null; } function El(e) { var t = e.__.__c; return t && t.__a && t.__a(e); } function Rl(e) { var t, n, r; function o(i) { if (t || (t = e()).then(function(l) { n = l.default || l; }, function(l) { r = l; }), r) throw r; if (!n) throw t; return P(n, i); } return o.displayName = "Lazy", o.__f = !0, o; } function At() { this.i = null, this.l = null; } re.unmount = function(e) { var t = e.__c; t && t.__R && t.__R(), t && 32 & e.__u && (e.type = null), fi && fi(e); }, (ln.prototype = new ze()).__c = function(e, t) { var n = t.__c, r = this; r.o == null && (r.o = []), r.o.push(n); var o = El(r.__v), i = !1, l = function() { i || (i = !0, n.__R = null, o ? o(s) : s()); }; n.__R = l; var s = function() { if (!--r.__u) { if (r.state.__a) { var a = r.state.__a; r.__v.__k[0] = Sl(a, a.__c.__P, a.__c.__O); } var u; for (r.setState({ __a: r.__b = null }); u = r.o.pop(); ) u.forceUpdate(); } }; r.__u++ || 32 & t.__u || r.setState({ __a: r.__b = r.__v.__k[0] }), e.then(l, l); }, ln.prototype.componentWillUnmount = function() { this.o = []; }, ln.prototype.render = function(e, t) { if (this.__b) { if (this.__v.__k) { var n = document.createElement("div"), r = this.__v.__k[0].__c; this.__v.__k[0] = Cl(this.__b, n, r.__O = r.__P); } this.__b = null; } var o = t.__a && P(me, null, e.fallback); return o && (o.__u &= -33), [P(me, null, t.__a ? null : e.children), o]; }; var pi = function(e, t, n) { if (++n[1] === n[0] && e.l.delete(t), e.props.revealOrder && (e.props.revealOrder[0] !== "t" || !e.l.size)) for (n = e.i; n; ) { for (; n.length > 3; ) n.pop()(); if (n[1] < n[0]) break; e.i = n = n[2]; } }; function ou(e) { return this.getChildContext = function() { return e.context; }, e.children; } function iu(e) { var t = this, n = e.h; t.componentWillUnmount = function() { zt(null, t.v), t.v = null, t.h = null; }, t.h && t.h !== n && t.componentWillUnmount(), t.v || (t.h = n, t.v = { nodeType: 1, parentNode: n, childNodes: [], contains: function() { return !0; }, appendChild: function(r) { this.childNodes.push(r), t.h.appendChild(r); }, insertBefore: function(r, o) { this.childNodes.push(r), t.h.insertBefore(r, o); }, removeChild: function(r) { this.childNodes.splice(this.childNodes.indexOf(r) >>> 1, 1), t.h.removeChild(r); } }), zt(P(ou, { context: t.context }, e.__v), t.v); } function wn(e, t) { var n = P(iu, { __v: e, h: t }); return n.containerInfo = t, n; } (At.prototype = new ze()).__a = function(e) { var t = this, n = El(t.__v), r = t.l.get(e); return r[0]++, function(o) { var i = function() { t.props.revealOrder ? (r.push(o), pi(t, e, r)) : o(); }; n ? n(i) : i(); }; }, At.prototype.render = function(e) { this.i = null, this.l = /* @__PURE__ */ new Map(); var t = ot(e.children); e.revealOrder && e.revealOrder[0] === "b" && t.reverse(); for (var n = t.length; n--; ) this.l.set(t[n], this.i = [1, 0, this.i]); return e.children; }, At.prototype.componentDidUpdate = At.prototype.componentDidMount = function() { var e = this; this.l.forEach(function(t, n) { pi(e, n, t); }); }; var $l = typeof Symbol < "u" && Symbol.for && Symbol.for("react.element") || 60103, lu = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, su = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, au = /[A-Z0-9]/g, uu = typeof document < "u", cu = function(e) { return (typeof Symbol < "u" && typeof Symbol() == "symbol" ? /fil|che|rad/ : /fil|che|ra/).test(e); }; function Tl(e, t, n) { return t.__k == null && (t.textContent = ""), zt(e, t), typeof n == "function" && n(), e ? e.__c : null; } function Il(e, t, n) { return hl(e, t), typeof n == "function" && n(), e ? e.__c : null; } ze.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(e) { Object.defineProperty(ze.prototype, e, { configurable: !0, get: function() { return this["UNSAFE_" + e]; }, set: function(t) { Object.defineProperty(this, e, { configurable: !0, writable: !0, value: t }); } }); }); var mi = re.event; function du() { } function fu() { return this.cancelBubble; } function pu() { return this.defaultPrevented; } re.event = function(e) { return mi && (e = mi(e)), e.persist = du, e.isPropagationStopped = fu, e.isDefaultPrevented = pu, e.nativeEvent = e; }; var Eo, mu = { enumerable: !1, configurable: !0, get: function() { return this.class; } }, gi = re.vnode; re.vnode = function(e) { typeof e.type == "string" && function(t) { var n = t.props, r = t.type, o = {}, i = r.indexOf("-") === -1; for (var l in n) { var s = n[l]; if (!(l === "value" && "defaultValue" in n && s == null || uu && l === "children" && r === "noscript" || l === "class" || l === "className")) { var a = l.toLowerCase(); l === "defaultValue" && "value" in n && n.value == null ? l = "value" : l === "download" && s === !0 ? s = "" : a === "translate" && s === "no" ? s = !1 : a[0] === "o" && a[1] === "n" ? a === "ondoubleclick" ? l = "ondblclick" : a !== "onchange" || r !== "input" && r !== "textarea" || cu(n.type) ? a === "onfocus" ? l = "onfocusin" : a === "onblur" ? l = "onfocusout" : su.test(l) && (l = a) : a = l = "oninput" : i && lu.test(l) ? l = l.replace(au, "-$&").toLowerCase() : s === null && (s = void 0), a === "oninput" && o[l = a] && (l = "oninputCapture"), o[l] = s; } } r == "select" && o.multiple && Array.isArray(o.value) && (o.value = ot(n.children).forEach(function(u) { u.props.selected = o.value.indexOf(u.props.value) != -1; })), r == "select" && o.defaultValue != null && (o.value = ot(n.children).forEach(function(u) { u.props.selected = o.multiple ? o.defaultValue.indexOf(u.props.value) != -1 : o.defaultValue == u.props.value; })), n.class && !n.className ? (o.class = n.class, Object.defineProperty(o, "className", mu)) : (n.className && !n.class || n.class && n.className) && (o.class = o.className = n.className), t.props = o; }(e), e.$$typeof = $l, gi && gi(e); }; var hi = re.__r; re.__r = function(e) { hi && hi(e), Eo = e.__c; }; var vi = re.diffed; re.diffed = function(e) { vi && vi(e); var t = e.props, n = e.__e; n != null && e.type === "textarea" && "value" in t && t.value !== n.value && (n.value = t.value == null ? "" : t.value), Eo = null; }; var Ml = { ReactCurrentDispatcher: { current: { readContext: function(e) { return Eo.__n[e.__c].props.value; }, useCallback: ie, useContext: ae, useDebugValue: wo, useDeferredValue: xo, useEffect: oe, useId: Me, useImperativeHandle: _o, useInsertionEffect: So, useLayoutEffect: Ze, useMemo: W, useReducer: st, useRef: D, useState: U, useSyncExternalStore: Xn, useTransition: Co } } }, gu = "18.3.1"; function Ol(e) { return P.bind(null, e); } function Gt(e) { return !!e && e.$$typeof === $l; } function Fl(e) { return Gt(e) && e.type === me; } function Pl(e) { return !!e && !!e.displayName && (typeof e.displayName == "string" || e.displayName instanceof String) && e.displayName.startsWith("Memo("); } function Ro(e) { return Gt(e) ? Ya.apply(null, arguments) : e; } function Nl(e) { return !!e.__k && (zt(null, e), !0); } function kl(e) { return e && (e.base || e.nodeType === 1 && e) || null; } var Al = function(e, t) { return e(t); }, De = function(e, t) { return e(t); }, Dl = me, Ll = Gt, L = { useState: U, useId: Me, useReducer: st, useEffect: oe, useLayoutEffect: Ze, useInsertionEffect: So, useTransition: Co, useDeferredValue: xo, useSyncExternalStore: Xn, startTransition: bo, useRef: D, useImperativeHandle: _o, useMemo: W, useCallback: ie, useContext: ae, useDebugValue: wo, version: "18.3.1", Children: xl, render: Tl, hydrate: Il, unmountComponentAtNode: Nl, createPortal: wn, createElement: P, createContext: pe, createFactory: Ol, cloneElement: Ro, createRef: Yn, Fragment: me, isValidElement: Gt, isElement: Ll, isFragment: Fl, isMemo: Pl, findDOMNode: kl, Component: ze, PureComponent: Hn, memo: bl, forwardRef: de, flushSync: De, unstable_batchedUpdates: Al, StrictMode: Dl, Suspense: ln, SuspenseList: At, lazy: Rl, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: Ml }; const Hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, Children: xl, Component: ze, Fragment: me, PureComponent: Hn, StrictMode: Dl, Suspense: ln, SuspenseList: At, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: Ml, cloneElement: Ro, createContext: pe, createElement: P, createFactory: Ol, createPortal: wn, createRef: Yn, default: L, findDOMNode: kl, flushSync: De, forwardRef: de, hydrate: Il, isElement: Ll, isFragment: Fl, isMemo: Pl, isValidElement: Gt, lazy: Rl, memo: bl, render: Tl, startTransition: bo, unmountComponentAtNode: Nl, unstable_batchedUpdates: Al, useCallback: ie, useContext: ae, useDebugValue: wo, useDeferredValue: xo, useEffect: oe, useErrorBoundary: Za, useId: Me, useImperativeHandle: _o, useInsertionEffect: So, useLayoutEffect: Ze, useMemo: W, useReducer: st, useRef: D, useState: U, useSyncExternalStore: Xn, useTransition: Co, version: gu }, Symbol.toStringTag, { value: "Module" })), hu = It("overflow-hidden rounded-md border border-gray-200", { variants: { variant: { default: "bg-white", muted: "bg-hello-csv-muted" }, withPadding: { true: "px-4 py-5 sm:p-6", false: "" } }, defaultVariants: { variant: "default", withPadding: !0 } }), Vl = de( ({ children: e, className: t, variant: n, withPadding: r = !0 }, o) => { const i = hu({ variant: n, withPadding: r }); return /* @__PURE__ */ g("div", { ref: o, className: `${i} ${t}`, children: e }); } ); function Hl({ checked: e, setChecked: t, label: n }) { const r = Me(); return /* @__PURE__ */ g("div", { className: "flex gap-3", children: [ /* @__PURE__ */ g("div", { className: "flex h-6 shrink-0 items-center", children: /* @__PURE__ */ g("div", { className: "group grid size-4 grid-cols-1", children: [ /* @__PURE__ */ g( "input", { checked: e, onChange: (o) => t(o.target.checked), id: r, type: "checkbox", className: "checked:border-hello-csv-primary checked:bg-hello-csv-primary indeterminate:border-hello-csv-primary indeterminate:bg-hello-csv-primary focus-visible:outline-hello-csv-hello-csv-primary col-start-1 row-start-1 appearance-none rounded-sm border border-gray-300 bg-white focus-visible:outline-2 focus-visible:outline-offset-2 disabled:border-gray-300 disabled:bg-gray-100 disabled:checked:bg-gray-100 forced-colors:appearance-auto" } ), /* @__PURE__ */ g( "svg", { fill: "none", viewBox: "0 0 14 14", className: "pointer-events-none col-start-1 row-start-1 size-3.5 self-center justify-self-center stroke-white group-has-disabled:stroke-gray-950/25", children: [ /* @__PURE__ */ g( "path", { d: "M3 8L6 11L11 3.5", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", className: "opacity-0 group-has-checked:opacity-100" } ), /* @__PURE__ */ g( "path", { d: "M3 7H11", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", className: "opacity-0 group-has-indeterminate:opacity-100" } ) ] } ) ] }) }), n && /* @__PURE__ */ g("div", { className: "text-sm/6", children: /* @__PURE__ */ g("label", { htmlFor: r, className: "font-medium text-gray-900", children: n }) }) ] }); } let vu = !1; function $o() { return vu; } const zl = typeof document < "u" ? L.useLayoutEffect : () => { }; function _u(e) { const t = D(null); return zl(() => { t.current = e; }, [ e ]), ie((...n) => { const r = t.current; return r == null ? void 0 : r(...n); }, []); } const vt = (e) => { var t; return (t = e == null ? void 0 : e.ownerDocument) !== null && t !== void 0 ? t : document; }, xt = (e) => e && "window" in e && e.window === e ? e : vt(e).defaultView || window; function wu(e) { return e !== null && typeof e == "object" && "nodeType" in e && typeof e.nodeType == "number"; } function yu(e) { return wu(e) && e.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in e; } function Bl(e, t) { if (!$o()) return t && e ? e.contains(t) : !1; if (!e || !t) return !1; let n = t; for (; n !== null; ) { if (n === e) return !0; n.tagName === "SLOT" && n.assignedSlot ? n = n.assignedSlot.parentNode : yu(n) ? n = n.host : n = n.parentNode; } return !1; } const zr = (e = document) => { var t; if (!$o()) return e.activeElement; let n = e.activeElement; for (; n && "shadowRoot" in n && (!((t = n.shadowRoot) === null || t === void 0) && t.activeElement); ) n = n.shadowRoot.activeElement; return n; }; function jl(e) { return $o() && e.target.shadowRoot && e.composedPath ? e.composedPath()[0] : e.target; } function bu(e) { var t; return typeof window > "u" || window.navigator == null ? !1 : ((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.brands.some((n) => e.test(n.brand))) || e.test(window.navigator.userAgent); } function xu(e) { var t; return typeof window < "u" && window.navigator != null ? e.test(((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.platform) || window.navigator.platform) : !1; } function Ul(e) { let t = null; return () => (t == null && (t = e()), t); } const Cu = Ul(function() { return xu(/^Mac/i); }), Su = Ul(function() { return bu(/Android/i); }); function Wl() { let e = D(/* @__PURE__ */ new Map()), t = ie((o, i, l, s) => { let a = s != null && s.once ? (...u) => { e.current.delete(l), l(...u); } : l; e.current.set(l, { type: i, eventTarget: o, fn: a, options: s }), o.addEventListener(i, a, s); }, []), n = ie((o, i, l, s) => { var a; let u = ((a = e.current.get(l)) === null || a === void 0 ? void 0 : a.fn) || l; o.removeEventListener(i, u, s), e.current.delete(l); }, []), r = ie(() => { e.current.forEach((o, i) => { n(o.eventTarget, o.type, i, o.options); }); }, [ n ]); return oe(() => r, [ r ]), { addGlobalListener: t, removeGlobalListener: n, removeAllGlobalListeners: r }; } function Eu(e) { return e.mozInputSource === 0 && e.isTrusted ? !0 : Su() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType; } function Gl(e) { let t = e; return t.nativeEvent = e, t.isDefaultPrevented = () => t.defaultPrevented, t.isPropagationStopped = () => t.cancelBubble, t.persist = () => { }, t; } function Ru(e, t) { Object.defineProperty(e, "target", { value: t }), Object.defineProperty(e, "currentTarget", { value: t }); } function ql(e) { let t = D({ isFocused: !1, observer: null }); zl(() => { const r = t.current; return () => { r.observer && (r.observer.disconnect(), r.observer = null); }; }, []); let n = _u((r) => { e == null || e(r); }); return ie((r) => { if (r.target instanceof HTMLButtonElement || r.target instanceof HTMLInputElement || r.target instanceof HTMLTextAreaElement || r.target instanceof HTMLSelectElement) { t.current.isFocused = !0; let o = r.target, i = (l) => { if (t.current.isFocused = !1, o.disabled) { let s = Gl(l); n(s); } t.current.observer && (t.current.observer.disconnect(), t.current.observer = null); }; o.addEventListener("focusout", i, { once: !0 }), t.current.observer = new MutationObserver(() => { if (t.current.isFocused && o.disabled) { var l; (l = t.current.observer) === null || l === void 0 || l.disconnect(); let s = o === document.activeElement ? null : document.activeElement; o.dispatchEvent(new FocusEvent("blur", { relatedTarget: s })), o.dispatchEvent(new FocusEvent("focusout", { bubbles: !0, relatedTarget: s })); } }), t.current.observer.observe(o, { attributes: !0, attributeFilter: [ "disabled" ] }); } }, [ n ]); } let $u = !1, yn = null, Br = /* @__PURE__ */ new Set(), sn = /* @__PURE__ */ new Map(), Et = !1, jr = !1; const Tu = { Tab: !0, Escape: !0 }; function To(e, t) { for (let n of Br) n(e, t); } function Iu(e) { return !(e.metaKey || !Cu() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta"); } function zn(e) { Et = !0, Iu(e) && (yn = "keyboard", To("keyboard", e)); } function Lt(e) { yn = "pointer", (e.type === "mousedown" || e.type === "pointerdown") && (Et = !0, To("pointer", e)); } function Kl(e) { Eu(e) && (Et = !0, yn = "virtual"); } function Yl(e) { e.target === window || e.target === document || $u || !e.isTrusted || (!Et && !jr && (yn = "virtual", To("virtual", e)), Et = !1, jr = !1); } function Xl() { Et = !1, jr = !0; } function Ur(e) { if (typeof window > "u" || sn.get(xt(e))) return; const t = xt(e), n = vt(e); let r = t.HTMLElement.prototype.focus; t.HTMLElement.prototype.focus = function() { Et = !0, r.apply(this, arguments); }, n.addEventListener("keydown", zn, !0), n.addEventListener("keyup", zn, !0), n.addEventListener("click", Kl, !0), t.addEventListener("focus", Yl, !0), t.addEventListener("blur", Xl, !1), typeof PointerEvent < "u" && (n.addEventListener("pointerdown", Lt, !0), n.addEventListener("pointermove", Lt, !0), n.addEventListener("pointerup", Lt, !0)), t.addEventListener("beforeunload", () => { Zl(e); }, { once: !0 }), sn.set(t, { focus: r }); } const Zl = (e, t) => { const n = xt(e), r = vt(e); t && r.removeEventListener("DOMContentLoaded", t), sn.has(n) && (n.HTMLElement.prototype.focus = sn.get(n).focus, r.removeEventListener("keydown", zn, !0), r.removeEventListener("keyup", zn, !0), r.removeEventListener("click", Kl, !0), n.removeEventListener("focus", Yl, !0), n.removeEventListener("blur", Xl, !1), typeof PointerEvent < "u" && (r.removeEventListener("pointerdown", Lt, !0), r.removeEventListener("pointermove", Lt, !0), r.removeEventListener("pointerup", Lt, !0)), sn.delete(n)); }; function Mu(e) { const t = vt(e); let n; return t.readyState !== "loading" ? Ur(e) : (n = () => { Ur(e); }, t.addEventListener("DOMContentLoaded", n)), () => Zl(e, n); } typeof document < "u" && Mu(); function Jl() { return yn !== "pointer"; } const Ou = /* @__PURE__ */ new Set([ "checkbox", "radio", "range", "color", "file", "image", "button", "submit", "reset" ]); function Fu(e, t, n) { let r = vt(n == null ? void 0 : n.target); const o = typeof window < "u" ? xt(n == null ? void 0 : n.target).HTMLInputElement : HTMLInputElement, i = typeof window < "u" ? xt(n == null ? void 0 : n.target).HTMLTextAreaElement : HTMLTextAreaElement, l = typeof window < "u" ? xt(n == null ? void 0 : n.target).HTMLElement : HTMLElement, s = typeof window < "u" ? xt(n == null ? void 0 : n.target).KeyboardEvent : KeyboardEvent; return e = e || r.activeElement instanceof o && !Ou.has(r.activeElement.type) || r.activeElement instanceof i || r.activeElement instanceof l && r.activeElement.isContentEditable, !(e && t === "keyboard" && n instanceof s && !Tu[n.key]); } function Pu(e, t, n) { Ur(), oe(() => { let r = (o, i) => { Fu(!!(n != null && n.isTextInput), o, i) && e(Jl()); }; return Br.add(r), () => { Br.delete(r); }; }, t); } function Nu(e) { let { isDisabled: t, onFocus: n, onBlur: r, onFocusChange: o } = e; const i = ie((a) => { if (a.target === a.currentTarget) return r && r(a), o && o(!1), !0; }, [ r, o ]), l = ql(i), s = ie((a) => { const u = vt(a.target), c = u ? zr(u) : zr(); a.target === a.currentTarget && c === jl(a.nativeEvent) && (n && n(a), o && o(!0), l(a)); }, [ o, n, l ]); return { focusProps: { onFocus: !t && (n || o || r) ? s : void 0, onBlur: !t && (r || o) ? i : void 0 } }; } function ku(e) { let { isDisabled: t, onBlurWithin: n, onFocusWithin: r, onFocusWithinChange: o } = e, i = D({ isFocusWithin: !1 }), { addGlobalListener: l, removeAllGlobalListeners: s } = Wl(), a = ie((d) => { d.currentTarget.contains(d.target) && i.current.isFocusWithin && !d.currentTarget.contains(d.relatedTarget) && (i.current.isFocusWithin = !1, s(), n && n(d), o && o(!1)); }, [ n, o, i, s ]), u = ql(a), c = ie((d) => { if (!d.currentTarget.contains(d.target)) return; const p = vt(d.target), f = zr(p); if (!i.current.isFocusWithin && f === jl(d.nativeEvent)) { r && r(d), o && o(!0), i.current.isFocusWithin = !0, u(d); let m = d.currentTarget; l(p, "focus", (h) => { if (i.current.isFocusWithin && !Bl(m, h.target)) { let v = new p.defaultView.FocusEvent("blur", { relatedTarget: h.target }); Ru(v, m); let w = Gl(v); a(w); } }, { capture: !0 }); } }, [ r, o, u, l, a ]); return t ? { focusWithinProps: { // These cannot be null, that would conflict in mergeProps onFocus: void 0, onBlur: void 0 } } : { focusWithinProps: { onFocus: c, onBlur: a } }; } let Wr = !1, vr = 0; function Au() { Wr = !0, setTimeout(() => { Wr = !1; }, 50); } function _i(e) { e.pointerType === "touch" && Au(); } function Du() { if (!(typeof document > "u")) return typeof PointerEvent < "u" && document.addEventListener("pointerup", _i), vr++, () => { vr--, !(vr > 0) && typeof PointerEvent < "u" && document.removeEventListener("pointerup", _i); }; } function Ql(e) { let { onHoverStart: t, onHoverChange: n, onHoverEnd: r, isDisabled: o } = e, [i, l] = U(!1), s = D({ isHovered: !1, ignoreEmu