speechly
Version:
A React component for text-to-speech functionality using the Speechify API
1,555 lines • 489 kB
JavaScript
import * as w from "react";
import ce, { useState as Te, useCallback as un, forwardRef as Li, createElement as Ao, useLayoutEffect as ji, useEffect as Qn } from "react";
import * as En from "react-dom";
import Rd from "react-dom";
function Fi(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
function Bi(e) {
if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e;
var t = e.default;
if (typeof t == "function") {
var n = function r() {
return this instanceof r ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments);
};
n.prototype = t.prototype;
} else n = {};
return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(e).forEach(function(r) {
var o = Object.getOwnPropertyDescriptor(e, r);
Object.defineProperty(n, r, o.get ? o : {
enumerable: !0,
get: function() {
return e[r];
}
});
}), n;
}
var In = { exports: {} }, on = {};
/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ea;
function Td() {
if (ea) return on;
ea = 1;
var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
function n(r, o, s) {
var a = null;
if (s !== void 0 && (a = "" + s), o.key !== void 0 && (a = "" + o.key), "key" in o) {
s = {};
for (var i in o)
i !== "key" && (s[i] = o[i]);
} else s = o;
return o = s.ref, {
$$typeof: e,
type: r,
key: a,
ref: o !== void 0 ? o : null,
props: s
};
}
return on.Fragment = t, on.jsx = n, on.jsxs = n, on;
}
var sn = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ta;
function Nd() {
return ta || (ta = 1, process.env.NODE_ENV !== "production" && function() {
function e(A) {
if (A == null) return null;
if (typeof A == "function")
return A.$$typeof === j ? null : A.displayName || A.name || null;
if (typeof A == "string") return A;
switch (A) {
case f:
return "Fragment";
case v:
return "Profiler";
case p:
return "StrictMode";
case E:
return "Suspense";
case R:
return "SuspenseList";
case P:
return "Activity";
}
if (typeof A == "object")
switch (typeof A.tag == "number" && console.error(
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
), A.$$typeof) {
case h:
return "Portal";
case y:
return (A.displayName || "Context") + ".Provider";
case b:
return (A._context.displayName || "Context") + ".Consumer";
case C:
var M = A.render;
return A = A.displayName, A || (A = M.displayName || M.name || "", A = A !== "" ? "ForwardRef(" + A + ")" : "ForwardRef"), A;
case _:
return M = A.displayName || null, M !== null ? M : e(A.type) || "Memo";
case S:
M = A._payload, A = A._init;
try {
return e(A(M));
} catch {
}
}
return null;
}
function t(A) {
return "" + A;
}
function n(A) {
try {
t(A);
var M = !1;
} catch {
M = !0;
}
if (M) {
M = console;
var H = M.error, Y = typeof Symbol == "function" && Symbol.toStringTag && A[Symbol.toStringTag] || A.constructor.name || "Object";
return H.call(
M,
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
Y
), t(A);
}
}
function r(A) {
if (A === f) return "<>";
if (typeof A == "object" && A !== null && A.$$typeof === S)
return "<...>";
try {
var M = e(A);
return M ? "<" + M + ">" : "<...>";
} catch {
return "<...>";
}
}
function o() {
var A = I.A;
return A === null ? null : A.getOwner();
}
function s() {
return Error("react-stack-top-frame");
}
function a(A) {
if (W.call(A, "key")) {
var M = Object.getOwnPropertyDescriptor(A, "key").get;
if (M && M.isReactWarning) return !1;
}
return A.key !== void 0;
}
function i(A, M) {
function H() {
L || (L = !0, console.error(
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
M
));
}
H.isReactWarning = !0, Object.defineProperty(A, "key", {
get: H,
configurable: !0
});
}
function c() {
var A = e(this.type);
return k[A] || (k[A] = !0, console.error(
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
)), A = this.props.ref, A !== void 0 ? A : null;
}
function l(A, M, H, Y, X, oe, Z, F) {
return H = oe.ref, A = {
$$typeof: g,
type: A,
key: M,
props: oe,
_owner: X
}, (H !== void 0 ? H : null) !== null ? Object.defineProperty(A, "ref", {
enumerable: !1,
get: c
}) : Object.defineProperty(A, "ref", { enumerable: !1, value: null }), A._store = {}, Object.defineProperty(A._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: 0
}), Object.defineProperty(A, "_debugInfo", {
configurable: !1,
enumerable: !1,
writable: !0,
value: null
}), Object.defineProperty(A, "_debugStack", {
configurable: !1,
enumerable: !1,
writable: !0,
value: Z
}), Object.defineProperty(A, "_debugTask", {
configurable: !1,
enumerable: !1,
writable: !0,
value: F
}), Object.freeze && (Object.freeze(A.props), Object.freeze(A)), A;
}
function u(A, M, H, Y, X, oe, Z, F) {
var G = M.children;
if (G !== void 0)
if (Y)
if (B(G)) {
for (Y = 0; Y < G.length; Y++)
d(G[Y]);
Object.freeze && Object.freeze(G);
} else
console.error(
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
);
else d(G);
if (W.call(M, "key")) {
G = e(A);
var re = Object.keys(M).filter(function(Q) {
return Q !== "key";
});
Y = 0 < re.length ? "{key: someKey, " + re.join(": ..., ") + ": ...}" : "{key: someKey}", D[G + Y] || (re = 0 < re.length ? "{" + re.join(": ..., ") + ": ...}" : "{}", console.error(
`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,
Y,
G,
re,
G
), D[G + Y] = !0);
}
if (G = null, H !== void 0 && (n(H), G = "" + H), a(M) && (n(M.key), G = "" + M.key), "key" in M) {
H = {};
for (var K in M)
K !== "key" && (H[K] = M[K]);
} else H = M;
return G && i(
H,
typeof A == "function" ? A.displayName || A.name || "Unknown" : A
), l(
A,
G,
oe,
X,
o(),
H,
Z,
F
);
}
function d(A) {
typeof A == "object" && A !== null && A.$$typeof === g && A._store && (A._store.validated = 1);
}
var m = ce, g = Symbol.for("react.transitional.element"), h = Symbol.for("react.portal"), f = Symbol.for("react.fragment"), p = Symbol.for("react.strict_mode"), v = Symbol.for("react.profiler"), b = Symbol.for("react.consumer"), y = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), E = Symbol.for("react.suspense"), R = Symbol.for("react.suspense_list"), _ = Symbol.for("react.memo"), S = Symbol.for("react.lazy"), P = Symbol.for("react.activity"), j = Symbol.for("react.client.reference"), I = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, W = Object.prototype.hasOwnProperty, B = Array.isArray, U = console.createTask ? console.createTask : function() {
return null;
};
m = {
"react-stack-bottom-frame": function(A) {
return A();
}
};
var L, k = {}, O = m["react-stack-bottom-frame"].bind(
m,
s
)(), T = U(r(s)), D = {};
sn.Fragment = f, sn.jsx = function(A, M, H, Y, X) {
var oe = 1e4 > I.recentlyCreatedOwnerStacks++;
return u(
A,
M,
H,
!1,
Y,
X,
oe ? Error("react-stack-top-frame") : O,
oe ? U(r(A)) : T
);
}, sn.jsxs = function(A, M, H, Y, X) {
var oe = 1e4 > I.recentlyCreatedOwnerStacks++;
return u(
A,
M,
H,
!0,
Y,
X,
oe ? Error("react-stack-top-frame") : O,
oe ? U(r(A)) : T
);
};
}()), sn;
}
var na;
function kd() {
return na || (na = 1, process.env.NODE_ENV === "production" ? In.exports = Td() : In.exports = Nd()), In.exports;
}
var x = kd(), Ui = Symbol.for("immer-nothing"), ra = Symbol.for("immer-draftable"), Oe = Symbol.for("immer-state"), Od = process.env.NODE_ENV !== "production" ? [
// All error codes, starting by 0:
function(e) {
return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
},
function(e) {
return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`;
},
"This object has been frozen and should not be mutated",
function(e) {
return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + e;
},
"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
"Immer forbids circular references",
"The first or second argument to `produce` must be a function",
"The third argument to `produce` must be a function or undefined",
"First argument to `createDraft` must be a plain object, an array, or an immerable object",
"First argument to `finishDraft` must be a draft returned by `createDraft`",
function(e) {
return `'current' expects a draft, got: ${e}`;
},
"Object.defineProperty() cannot be used on an Immer draft",
"Object.setPrototypeOf() cannot be used on an Immer draft",
"Immer only supports deleting array indices",
"Immer only supports setting array indices and the 'length' property",
function(e) {
return `'original' expects a draft, got: ${e}`;
}
// Note: if more errors are added, the errorOffset in Patches.ts should be increased
// See Patches.ts for additional errors
] : [];
function _e(e, ...t) {
if (process.env.NODE_ENV !== "production") {
const n = Od[e], r = typeof n == "function" ? n.apply(null, t) : n;
throw new Error(`[Immer] ${r}`);
}
throw new Error(
`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`
);
}
var zt = Object.getPrototypeOf;
function $t(e) {
return !!e && !!e[Oe];
}
function Et(e) {
var t;
return e ? Wi(e) || Array.isArray(e) || !!e[ra] || !!((t = e.constructor) != null && t[ra]) || Sr(e) || _r(e) : !1;
}
var Pd = Object.prototype.constructor.toString();
function Wi(e) {
if (!e || typeof e != "object")
return !1;
const t = zt(e);
if (t === null)
return !0;
const n = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
return n === Object ? !0 : typeof n == "function" && Function.toString.call(n) === Pd;
}
function er(e, t) {
Er(e) === 0 ? Reflect.ownKeys(e).forEach((n) => {
t(n, e[n], e);
}) : e.forEach((n, r) => t(r, n, e));
}
function Er(e) {
const t = e[Oe];
return t ? t.type_ : Array.isArray(e) ? 1 : Sr(e) ? 2 : _r(e) ? 3 : 0;
}
function Ro(e, t) {
return Er(e) === 2 ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
}
function Vi(e, t, n) {
const r = Er(e);
r === 2 ? e.set(t, n) : r === 3 ? e.add(n) : e[t] = n;
}
function Md(e, t) {
return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
}
function Sr(e) {
return e instanceof Map;
}
function _r(e) {
return e instanceof Set;
}
function vt(e) {
return e.copy_ || e.base_;
}
function To(e, t) {
if (Sr(e))
return new Map(e);
if (_r(e))
return new Set(e);
if (Array.isArray(e))
return Array.prototype.slice.call(e);
const n = Wi(e);
if (t === !0 || t === "class_only" && !n) {
const r = Object.getOwnPropertyDescriptors(e);
delete r[Oe];
let o = Reflect.ownKeys(r);
for (let s = 0; s < o.length; s++) {
const a = o[s], i = r[a];
i.writable === !1 && (i.writable = !0, i.configurable = !0), (i.get || i.set) && (r[a] = {
configurable: !0,
writable: !0,
// could live with !!desc.set as well here...
enumerable: i.enumerable,
value: e[a]
});
}
return Object.create(zt(e), r);
} else {
const r = zt(e);
if (r !== null && n)
return { ...e };
const o = Object.create(r);
return Object.assign(o, e);
}
}
function fn(e, t = !1) {
return Cr(e) || $t(e) || !Et(e) || (Er(e) > 1 && (e.set = e.add = e.clear = e.delete = Id), Object.freeze(e), t && Object.entries(e).forEach(([n, r]) => fn(r, !0))), e;
}
function Id() {
_e(2);
}
function Cr(e) {
return Object.isFrozen(e);
}
var Dd = {};
function St(e) {
const t = Dd[e];
return t || _e(0, e), t;
}
var pn;
function zi() {
return pn;
}
function Ld(e, t) {
return {
drafts_: [],
parent_: e,
immer_: t,
// Whenever the modified draft contains a draft from another scope, we
// need to prevent auto-freezing so the unowned draft can be finalized.
canAutoFreeze_: !0,
unfinalizedDrafts_: 0
};
}
function oa(e, t) {
t && (St("Patches"), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
}
function No(e) {
ko(e), e.drafts_.forEach(jd), e.drafts_ = null;
}
function ko(e) {
e === pn && (pn = e.parent_);
}
function sa(e) {
return pn = Ld(pn, e);
}
function jd(e) {
const t = e[Oe];
t.type_ === 0 || t.type_ === 1 ? t.revoke_() : t.revoked_ = !0;
}
function aa(e, t) {
t.unfinalizedDrafts_ = t.drafts_.length;
const n = t.drafts_[0];
return e !== void 0 && e !== n ? (n[Oe].modified_ && (No(t), _e(4)), Et(e) && (e = tr(t, e), t.parent_ || nr(t, e)), t.patches_ && St("Patches").generateReplacementPatches_(
n[Oe].base_,
e,
t.patches_,
t.inversePatches_
)) : e = tr(t, n, []), No(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e !== Ui ? e : void 0;
}
function tr(e, t, n) {
if (Cr(t))
return t;
const r = t[Oe];
if (!r)
return er(
t,
(o, s) => ia(e, r, t, o, s, n)
), t;
if (r.scope_ !== e)
return t;
if (!r.modified_)
return nr(e, r.base_, !0), r.base_;
if (!r.finalized_) {
r.finalized_ = !0, r.scope_.unfinalizedDrafts_--;
const o = r.copy_;
let s = o, a = !1;
r.type_ === 3 && (s = new Set(o), o.clear(), a = !0), er(
s,
(i, c) => ia(e, r, o, i, c, n, a)
), nr(e, o, !1), n && e.patches_ && St("Patches").generatePatches_(
r,
n,
e.patches_,
e.inversePatches_
);
}
return r.copy_;
}
function ia(e, t, n, r, o, s, a) {
if (process.env.NODE_ENV !== "production" && o === n && _e(5), $t(o)) {
const i = s && t && t.type_ !== 3 && // Set objects are atomic since they have no keys.
!Ro(t.assigned_, r) ? s.concat(r) : void 0, c = tr(e, o, i);
if (Vi(n, r, c), $t(c))
e.canAutoFreeze_ = !1;
else
return;
} else a && n.add(o);
if (Et(o) && !Cr(o)) {
if (!e.immer_.autoFreeze_ && e.unfinalizedDrafts_ < 1)
return;
tr(e, o), (!t || !t.scope_.parent_) && typeof r != "symbol" && Object.prototype.propertyIsEnumerable.call(n, r) && nr(e, o);
}
}
function nr(e, t, n = !1) {
!e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && fn(t, n);
}
function Fd(e, t) {
const n = Array.isArray(e), r = {
type_: n ? 1 : 0,
// Track which produce call this is associated with.
scope_: t ? t.scope_ : zi(),
// True for both shallow and deep changes.
modified_: !1,
// Used during finalization.
finalized_: !1,
// Track which properties have been assigned (true) or deleted (false).
assigned_: {},
// The parent draft state.
parent_: t,
// The base state.
base_: e,
// The base proxy.
draft_: null,
// set below
// The base copy with any updated values.
copy_: null,
// Called by the `produce` function.
revoke_: null,
isManual_: !1
};
let o = r, s = fs;
n && (o = [r], s = hn);
const { revoke: a, proxy: i } = Proxy.revocable(o, s);
return r.draft_ = i, r.revoke_ = a, i;
}
var fs = {
get(e, t) {
if (t === Oe)
return e;
const n = vt(e);
if (!Ro(n, t))
return Bd(e, n, t);
const r = n[t];
return e.finalized_ || !Et(r) ? r : r === no(e.base_, t) ? (ro(e), e.copy_[t] = Po(r, e)) : r;
},
has(e, t) {
return t in vt(e);
},
ownKeys(e) {
return Reflect.ownKeys(vt(e));
},
set(e, t, n) {
const r = $i(vt(e), t);
if (r != null && r.set)
return r.set.call(e.draft_, n), !0;
if (!e.modified_) {
const o = no(vt(e), t), s = o == null ? void 0 : o[Oe];
if (s && s.base_ === n)
return e.copy_[t] = n, e.assigned_[t] = !1, !0;
if (Md(n, o) && (n !== void 0 || Ro(e.base_, t)))
return !0;
ro(e), Oo(e);
}
return e.copy_[t] === n && // special case: handle new props with value 'undefined'
(n !== void 0 || t in e.copy_) || // special case: NaN
Number.isNaN(n) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = n, e.assigned_[t] = !0), !0;
},
deleteProperty(e, t) {
return no(e.base_, t) !== void 0 || t in e.base_ ? (e.assigned_[t] = !1, ro(e), Oo(e)) : delete e.assigned_[t], e.copy_ && delete e.copy_[t], !0;
},
// Note: We never coerce `desc.value` into an Immer draft, because we can't make
// the same guarantee in ES5 mode.
getOwnPropertyDescriptor(e, t) {
const n = vt(e), r = Reflect.getOwnPropertyDescriptor(n, t);
return r && {
writable: !0,
configurable: e.type_ !== 1 || t !== "length",
enumerable: r.enumerable,
value: n[t]
};
},
defineProperty() {
_e(11);
},
getPrototypeOf(e) {
return zt(e.base_);
},
setPrototypeOf() {
_e(12);
}
}, hn = {};
er(fs, (e, t) => {
hn[e] = function() {
return arguments[0] = arguments[0][0], t.apply(this, arguments);
};
});
hn.deleteProperty = function(e, t) {
return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && _e(13), hn.set.call(this, e, t, void 0);
};
hn.set = function(e, t, n) {
return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && _e(14), fs.set.call(this, e[0], t, n, e[0]);
};
function no(e, t) {
const n = e[Oe];
return (n ? vt(n) : e)[t];
}
function Bd(e, t, n) {
var o;
const r = $i(t, n);
return r ? "value" in r ? r.value : (
// This is a very special case, if the prop is a getter defined by the
// prototype, we should invoke it with the draft as context!
(o = r.get) == null ? void 0 : o.call(e.draft_)
) : void 0;
}
function $i(e, t) {
if (!(t in e))
return;
let n = zt(e);
for (; n; ) {
const r = Object.getOwnPropertyDescriptor(n, t);
if (r)
return r;
n = zt(n);
}
}
function Oo(e) {
e.modified_ || (e.modified_ = !0, e.parent_ && Oo(e.parent_));
}
function ro(e) {
e.copy_ || (e.copy_ = To(
e.base_,
e.scope_.immer_.useStrictShallowCopy_
));
}
var Ud = class {
constructor(e) {
this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.produce = (t, n, r) => {
if (typeof t == "function" && typeof n != "function") {
const s = n;
n = t;
const a = this;
return function(c = s, ...l) {
return a.produce(c, (u) => n.call(this, u, ...l));
};
}
typeof n != "function" && _e(6), r !== void 0 && typeof r != "function" && _e(7);
let o;
if (Et(t)) {
const s = sa(this), a = Po(t, void 0);
let i = !0;
try {
o = n(a), i = !1;
} finally {
i ? No(s) : ko(s);
}
return oa(s, r), aa(o, s);
} else if (!t || typeof t != "object") {
if (o = n(t), o === void 0 && (o = t), o === Ui && (o = void 0), this.autoFreeze_ && fn(o, !0), r) {
const s = [], a = [];
St("Patches").generateReplacementPatches_(t, o, s, a), r(s, a);
}
return o;
} else
_e(1, t);
}, this.produceWithPatches = (t, n) => {
if (typeof t == "function")
return (a, ...i) => this.produceWithPatches(a, (c) => t(c, ...i));
let r, o;
return [this.produce(t, n, (a, i) => {
r = a, o = i;
}), r, o];
}, typeof (e == null ? void 0 : e.autoFreeze) == "boolean" && this.setAutoFreeze(e.autoFreeze), typeof (e == null ? void 0 : e.useStrictShallowCopy) == "boolean" && this.setUseStrictShallowCopy(e.useStrictShallowCopy);
}
createDraft(e) {
Et(e) || _e(8), $t(e) && (e = Wd(e));
const t = sa(this), n = Po(e, void 0);
return n[Oe].isManual_ = !0, ko(t), n;
}
finishDraft(e, t) {
const n = e && e[Oe];
(!n || !n.isManual_) && _e(9);
const { scope_: r } = n;
return oa(r, t), aa(void 0, r);
}
/**
* Pass true to automatically freeze all copies created by Immer.
*
* By default, auto-freezing is enabled.
*/
setAutoFreeze(e) {
this.autoFreeze_ = e;
}
/**
* Pass true to enable strict shallow copy.
*
* By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
*/
setUseStrictShallowCopy(e) {
this.useStrictShallowCopy_ = e;
}
applyPatches(e, t) {
let n;
for (n = t.length - 1; n >= 0; n--) {
const o = t[n];
if (o.path.length === 0 && o.op === "replace") {
e = o.value;
break;
}
}
n > -1 && (t = t.slice(n + 1));
const r = St("Patches").applyPatches_;
return $t(e) ? r(e, t) : this.produce(
e,
(o) => r(o, t)
);
}
};
function Po(e, t) {
const n = Sr(e) ? St("MapSet").proxyMap_(e, t) : _r(e) ? St("MapSet").proxySet_(e, t) : Fd(e, t);
return (t ? t.scope_ : zi()).drafts_.push(n), n;
}
function Wd(e) {
return $t(e) || _e(10, e), Hi(e);
}
function Hi(e) {
if (!Et(e) || Cr(e))
return e;
const t = e[Oe];
let n;
if (t) {
if (!t.modified_)
return t.base_;
t.finalized_ = !0, n = To(e, t.scope_.immer_.useStrictShallowCopy_);
} else
n = To(e, !0);
return er(n, (r, o) => {
Vi(n, r, Hi(o));
}), t && (t.finalized_ = !1), n;
}
var Pe = new Ud(), Vd = Pe.produce;
Pe.produceWithPatches.bind(
Pe
);
Pe.setAutoFreeze.bind(Pe);
Pe.setUseStrictShallowCopy.bind(Pe);
Pe.applyPatches.bind(Pe);
Pe.createDraft.bind(Pe);
Pe.finishDraft.bind(Pe);
function zd(e) {
var t = Te(function() {
return fn(typeof e == "function" ? e() : e, !0);
}), n = t[1];
return [t[0], un(function(r) {
n(typeof r == "function" ? Vd(r) : fn(r));
}, [])];
}
function qi(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 = qi(e[t])) && (r && (r += " "), r += n);
} else for (n in e) e[n] && (r && (r += " "), r += n);
return r;
}
function ps() {
for (var e, t, n = 0, r = "", o = arguments.length; n < o; n++) (e = arguments[n]) && (t = qi(e)) && (r && (r += " "), r += t);
return r;
}
/**
* @license lucide-react v0.501.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const $d = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Hd = (e) => e.replace(
/^([A-Z])|[\s-_]+(\w)/g,
(t, n, r) => r ? r.toUpperCase() : n.toLowerCase()
), ca = (e) => {
const t = Hd(e);
return t.charAt(0).toUpperCase() + t.slice(1);
}, Gi = (...e) => e.filter((t, n, r) => !!t && t.trim() !== "" && r.indexOf(t) === n).join(" ").trim(), qd = (e) => {
for (const t in e)
if (t.startsWith("aria-") || t === "role" || t === "title")
return !0;
};
/**
* @license lucide-react v0.501.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var Gd = {
xmlns: "http://www.w3.org/2000/svg",
width: 24,
height: 24,
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
strokeWidth: 2,
strokeLinecap: "round",
strokeLinejoin: "round"
};
/**
* @license lucide-react v0.501.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const Yd = Li(
({
color: e = "currentColor",
size: t = 24,
strokeWidth: n = 2,
absoluteStrokeWidth: r,
className: o = "",
children: s,
iconNode: a,
...i
}, c) => Ao(
"svg",
{
ref: c,
...Gd,
width: t,
height: t,
stroke: e,
strokeWidth: r ? Number(n) * 24 / Number(t) : n,
className: Gi("lucide", o),
...!s && !qd(i) && { "aria-hidden": "true" },
...i
},
[
...a.map(([l, u]) => Ao(l, u)),
...Array.isArray(s) ? s : [s]
]
)
);
/**
* @license lucide-react v0.501.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const Re = (e, t) => {
const n = Li(
({ className: r, ...o }, s) => Ao(Yd, {
ref: s,
iconNode: t,
className: Gi(
`lucide-${$d(ca(e))}`,
`lucide-${e}`,
r
),
...o
})
);
return n.displayName = ca(e), n;
};
/**
* @license lucide-react v0.501.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const Xd = [
["path", { d: "M2 10v3", key: "1fnikh" }],
["path", { d: "M6 6v11", key: "11sgs0" }],
["path", { d: "M10 3v18", key: "yhl04a" }],
["path", { d: "M14 8v7", key: "3a1oy3" }],
["path", { d: "M18 5v13", key: "123xd1" }],
["path", { d: "M22 10v3", key: "154ddg" }]
], Kd = Re("audio-lines", Xd);
/**
* @license lucide-react v0.501.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const Jd = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], Yi = Re("check", Jd);
/**
* @license lucide-react v0.501.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const Zd = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], Xi = Re("chevron-down", Zd);
/**
* @license lucide-react v0.501.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const Qd = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]], ef = Re("chevron-up", Qd);
/**
* @license lucide-react v0.501.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const tf = [
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
["polygon", { points: "10 8 16 12 10 16 10 8", key: "1cimsy" }]
], nf = Re("circle-play", tf);
/**
* @license lucide-react v0.501.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const rf = [
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
["rect", { x: "9", y: "9", width: "6", height: "6", rx: "1", key: "1ssd4o" }]
], la = Re("circle-stop", rf);
/**
* @license lucide-react v0.501.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const of = [
["path", { d: "M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3", key: "rslqgf" }],
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
[
"path",
{
d: "M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",
key: "9f7x3i"
}
]
], sf = Re("file-audio", of);
/**
* @license lucide-react v0.501.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const af = [
["path", { d: "M12 2v4", key: "3427ic" }],
["path", { d: "m16.2 7.8 2.9-2.9", key: "r700ao" }],
["path", { d: "M18 12h4", key: "wj9ykh" }],
["path", { d: "m16.2 16.2 2.9 2.9", key: "1bxg5t" }],
["path", { d: "M12 18v4", key: "jadmvz" }],
["path", { d: "m4.9 19.1 2.9-2.9", key: "bwix9q" }],
["path", { d: "M2 12h4", key: "j09sii" }],
["path", { d: "m4.9 4.9 2.9 2.9", key: "giyufr" }]
], cf = Re("loader", af);
/**
* @license lucide-react v0.501.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const lf = [
["path", { d: "M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z", key: "131961" }],
["path", { d: "M19 10v2a7 7 0 0 1-14 0v-2", key: "1vc78b" }],
["line", { x1: "12", x2: "12", y1: "19", y2: "22", key: "x3vr5v" }]
], uf = Re("mic", lf);
/**
* @license lucide-react v0.501.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const df = [
["rect", { x: "14", y: "4", width: "4", height: "16", rx: "1", key: "zuxfzm" }],
["rect", { x: "6", y: "4", width: "4", height: "16", rx: "1", key: "1okwgv" }]
], ff = Re("pause", df);
/**
* @license lucide-react v0.501.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const pf = [["polygon", { points: "6 3 20 12 6 21 6 3", key: "1oa8hb" }]], hf = Re("play", pf);
/**
* @license lucide-react v0.501.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const mf = [
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }]
], gf = Re("square", mf);
/**
* @license lucide-react v0.501.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const vf = [
[
"path",
{
d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
key: "uqj9uw"
}
],
["path", { d: "M16 9a5 5 0 0 1 0 6", key: "1q6k2b" }],
["path", { d: "M19.364 18.364a9 9 0 0 0 0-12.728", key: "ijwkga" }]
], Ki = Re("volume-2", vf);
/**
* @license lucide-react v0.501.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const bf = [
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
], yf = Re("x", bf);
function de(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
return function(o) {
if (e == null || e(o), n === !1 || !o.defaultPrevented)
return t == null ? void 0 : t(o);
};
}
function ua(e, t) {
if (typeof e == "function")
return e(t);
e != null && (e.current = t);
}
function Ji(...e) {
return (t) => {
let n = !1;
const r = e.map((o) => {
const s = ua(o, t);
return !n && typeof s == "function" && (n = !0), s;
});
if (n)
return () => {
for (let o = 0; o < r.length; o++) {
const s = r[o];
typeof s == "function" ? s() : ua(e[o], null);
}
};
};
}
function pe(...e) {
return w.useCallback(Ji(...e), e);
}
function wf(e, t) {
const n = w.createContext(t), r = (s) => {
const { children: a, ...i } = s, c = w.useMemo(() => i, Object.values(i));
return /* @__PURE__ */ x.jsx(n.Provider, { value: c, children: a });
};
r.displayName = e + "Provider";
function o(s) {
const a = w.useContext(n);
if (a) return a;
if (t !== void 0) return t;
throw new Error(`\`${s}\` must be used within \`${e}\``);
}
return [r, o];
}
function Ar(e, t = []) {
let n = [];
function r(s, a) {
const i = w.createContext(a), c = n.length;
n = [...n, a];
const l = (d) => {
var v;
const { scope: m, children: g, ...h } = d, f = ((v = m == null ? void 0 : m[e]) == null ? void 0 : v[c]) || i, p = w.useMemo(() => h, Object.values(h));
return /* @__PURE__ */ x.jsx(f.Provider, { value: p, children: g });
};
l.displayName = s + "Provider";
function u(d, m) {
var f;
const g = ((f = m == null ? void 0 : m[e]) == null ? void 0 : f[c]) || i, h = w.useContext(g);
if (h) return h;
if (a !== void 0) return a;
throw new Error(`\`${d}\` must be used within \`${s}\``);
}
return [l, u];
}
const o = () => {
const s = n.map((a) => w.createContext(a));
return function(i) {
const c = (i == null ? void 0 : i[e]) || s;
return w.useMemo(
() => ({ [`__scope${e}`]: { ...i, [e]: c } }),
[i, c]
);
};
};
return o.scopeName = e, [r, xf(o, ...t)];
}
function xf(...e) {
const t = e[0];
if (e.length === 1) return t;
const n = () => {
const r = e.map((o) => ({
useScope: o(),
scopeName: o.scopeName
}));
return function(s) {
const a = r.reduce((i, { useScope: c, scopeName: l }) => {
const d = c(s)[`__scope${l}`];
return { ...i, ...d };
}, {});
return w.useMemo(() => ({ [`__scope${t.scopeName}`]: a }), [a]);
};
};
return n.scopeName = t.scopeName, n;
}
var xe = globalThis != null && globalThis.document ? w.useLayoutEffect : () => {
}, Ef = w[" useId ".trim().toString()] || (() => {
}), Sf = 0;
function Ut(e) {
const [t, n] = w.useState(Ef());
return xe(() => {
n((r) => r ?? String(Sf++));
}, [e]), e || (t ? `radix-${t}` : "");
}
var _f = w[" useInsertionEffect ".trim().toString()] || xe;
function Mo({
prop: e,
defaultProp: t,
onChange: n = () => {
},
caller: r
}) {
const [o, s, a] = Cf({
defaultProp: t,
onChange: n
}), i = e !== void 0, c = i ? e : o;
{
const u = w.useRef(e !== void 0);
w.useEffect(() => {
const d = u.current;
d !== i && console.warn(
`${r} is changing from ${d ? "controlled" : "uncontrolled"} to ${i ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
), u.current = i;
}, [i, r]);
}
const l = w.useCallback(
(u) => {
var d;
if (i) {
const m = Af(u) ? u(e) : u;
m !== e && ((d = a.current) == null || d.call(a, m));
} else
s(u);
},
[i, e, s, a]
);
return [c, l];
}
function Cf({
defaultProp: e,
onChange: t
}) {
const [n, r] = w.useState(e), o = w.useRef(n), s = w.useRef(t);
return _f(() => {
s.current = t;
}, [t]), w.useEffect(() => {
var a;
o.current !== n && ((a = s.current) == null || a.call(s, n), o.current = n);
}, [n, o]), [n, r, s];
}
function Af(e) {
return typeof e == "function";
}
// @__NO_SIDE_EFFECTS__
function Ht(e) {
const t = /* @__PURE__ */ Tf(e), n = w.forwardRef((r, o) => {
const { children: s, ...a } = r, i = w.Children.toArray(s), c = i.find(kf);
if (c) {
const l = c.props.children, u = i.map((d) => d === c ? w.Children.count(l) > 1 ? w.Children.only(null) : w.isValidElement(l) ? l.props.children : null : d);
return /* @__PURE__ */ x.jsx(t, { ...a, ref: o, children: w.isValidElement(l) ? w.cloneElement(l, void 0, u) : null });
}
return /* @__PURE__ */ x.jsx(t, { ...a, ref: o, children: s });
});
return n.displayName = `${e}.Slot`, n;
}
var Rf = /* @__PURE__ */ Ht("Slot");
// @__NO_SIDE_EFFECTS__
function Tf(e) {
const t = w.forwardRef((n, r) => {
const { children: o, ...s } = n;
if (w.isValidElement(o)) {
const a = Pf(o), i = Of(s, o.props);
return o.type !== w.Fragment && (i.ref = r ? Ji(r, a) : a), w.cloneElement(o, i);
}
return w.Children.count(o) > 1 ? w.Children.only(null) : null;
});
return t.displayName = `${e}.SlotClone`, t;
}
var Nf = Symbol("radix.slottable");
function kf(e) {
return w.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === Nf;
}
function Of(e, t) {
const n = { ...t };
for (const r in t) {
const o = e[r], s = t[r];
/^on[A-Z]/.test(r) ? o && s ? n[r] = (...i) => {
s(...i), o(...i);
} : o && (n[r] = o) : r === "style" ? n[r] = { ...o, ...s } : r === "className" && (n[r] = [o, s].filter(Boolean).join(" "));
}
return { ...e, ...n };
}
function Pf(e) {
var r, o;
let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning;
return n ? e.ref : (t = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
}
var Mf = [
"a",
"button",
"div",
"form",
"h2",
"h3",
"img",
"input",
"label",
"li",
"nav",
"ol",
"p",
"select",
"span",
"svg",
"ul"
], le = Mf.reduce((e, t) => {
const n = /* @__PURE__ */ Ht(`Primitive.${t}`), r = w.forwardRef((o, s) => {
const { asChild: a, ...i } = o, c = a ? n : t;
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ x.jsx(c, { ...i, ref: s });
});
return r.displayName = `Primitive.${t}`, { ...e, [t]: r };
}, {});
function If(e, t) {
e && En.flushSync(() => e.dispatchEvent(t));
}
function _t(e) {
const t = w.useRef(e);
return w.useEffect(() => {
t.current = e;
}), w.useMemo(() => (...n) => {
var r;
return (r = t.current) == null ? void 0 : r.call(t, ...n);
}, []);
}
function Df(e, t = globalThis == null ? void 0 : globalThis.document) {
const n = _t(e);
w.useEffect(() => {
const r = (o) => {
o.key === "Escape" && n(o);
};
return t.addEventListener("keydown", r, { capture: !0 }), () => t.removeEventListener("keydown", r, { capture: !0 });
}, [n, t]);
}
var Lf = "DismissableLayer", Io = "dismissableLayer.update", jf = "dismissableLayer.pointerDownOutside", Ff = "dismissableLayer.focusOutside", da, Zi = w.createContext({
layers: /* @__PURE__ */ new Set(),
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
branches: /* @__PURE__ */ new Set()
}), hs = w.forwardRef(
(e, t) => {
const {
disableOutsidePointerEvents: n = !1,
onEscapeKeyDown: r,
onPointerDownOutside: o,
onFocusOutside: s,
onInteractOutside: a,
onDismiss: i,
...c
} = e, l = w.useContext(Zi), [u, d] = w.useState(null), m = (u == null ? void 0 : u.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, g] = w.useState({}), h = pe(t, (_) => d(_)), f = Array.from(l.layers), [p] = [...l.layersWithOutsidePointerEventsDisabled].slice(-1), v = f.indexOf(p), b = u ? f.indexOf(u) : -1, y = l.layersWithOutsidePointerEventsDisabled.size > 0, C = b >= v, E = Wf((_) => {
const S = _.target, P = [...l.branches].some((j) => j.contains(S));
!C || P || (o == null || o(_), a == null || a(_), _.defaultPrevented || i == null || i());
}, m), R = Vf((_) => {
const S = _.target;
[...l.branches].some((j) => j.contains(S)) || (s == null || s(_), a == null || a(_), _.defaultPrevented || i == null || i());
}, m);
return Df((_) => {
b === l.layers.size - 1 && (r == null || r(_), !_.defaultPrevented && i && (_.preventDefault(), i()));
}, m), w.useEffect(() => {
if (u)
return n && (l.layersWithOutsidePointerEventsDisabled.size === 0 && (da = m.body.style.pointerEvents, m.body.style.pointerEvents = "none"), l.layersWithOutsidePointerEventsDisabled.add(u)), l.layers.add(u), fa(), () => {
n && l.layersWithOutsidePointerEventsDisabled.size === 1 && (m.body.style.pointerEvents = da);
};
}, [u, m, n, l]), w.useEffect(() => () => {
u && (l.layers.delete(u), l.layersWithOutsidePointerEventsDisabled.delete(u), fa());
}, [u, l]), w.useEffect(() => {
const _ = () => g({});
return document.addEventListener(Io, _), () => document.removeEventListener(Io, _);
}, []), /* @__PURE__ */ x.jsx(
le.div,
{
...c,
ref: h,
style: {
pointerEvents: y ? C ? "auto" : "none" : void 0,
...e.style
},
onFocusCapture: de(e.onFocusCapture, R.onFocusCapture),
onBlurCapture: de(e.onBlurCapture, R.onBlurCapture),
onPointerDownCapture: de(
e.onPointerDownCapture,
E.onPointerDownCapture
)
}
);
}
);
hs.displayName = Lf;
var Bf = "DismissableLayerBranch", Uf = w.forwardRef((e, t) => {
const n = w.useContext(Zi), r = w.useRef(null), o = pe(t, r);
return w.useEffect(() => {
const s = r.current;
if (s)
return n.branches.add(s), () => {
n.branches.delete(s);
};
}, [n.branches]), /* @__PURE__ */ x.jsx(le.div, { ...e, ref: o });
});
Uf.displayName = Bf;
function Wf(e, t = globalThis == null ? void 0 : globalThis.document) {
const n = _t(e), r = w.useRef(!1), o = w.useRef(() => {
});
return w.useEffect(() => {
const s = (i) => {
if (i.target && !r.current) {
let c = function() {
Qi(
jf,
n,
l,
{ discrete: !0 }
);
};
const l = { originalEvent: i };
i.pointerType === "touch" ? (t.removeEventListener("click", o.current), o.current = c, t.addEventListener("click", o.current, { once: !0 })) : c();
} else
t.removeEventListener("click", o.current);
r.current = !1;
}, a = window.setTimeout(() => {
t.addEventListener("pointerdown", s);
}, 0);
return () => {
window.clearTimeout(a), t.removeEventListener("pointerdown", s), t.removeEventListener("click", o.current);
};
}, [t, n]), {
// ensures we check React component tree (not just DOM tree)
onPointerDownCapture: () => r.current = !0
};
}
function Vf(e, t = globalThis == null ? void 0 : globalThis.document) {
const n = _t(e), r = w.useRef(!1);
return w.useEffect(() => {
const o = (s) => {
s.target && !r.current && Qi(Ff, n, { originalEvent: s }, {
discrete: !1
});
};
return t.addEventListener("focusin", o), () => t.removeEventListener("focusin", o);
}, [t, n]), {
onFocusCapture: () => r.current = !0,
onBlurCapture: () => r.current = !1
};
}
function fa() {
const e = new CustomEvent(Io);
document.dispatchEvent(e);
}
function Qi(e, t, n, { discrete: r }) {
const o = n.originalEvent.target, s = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
t && o.addEventListener(e, t, { once: !0 }), r ? If(o, s) : o.dispatchEvent(s);
}
var oo = "focusScope.autoFocusOnMount", so = "focusScope.autoFocusOnUnmount", pa = { bubbles: !1, cancelable: !0 }, zf = "FocusScope", ms = w.forwardRef((e, t) => {
const {
loop: n = !1,
trapped: r = !1,
onMountAutoFocus: o,
onUnmountAutoFocus: s,
...a
} = e, [i, c] = w.useState(null), l = _t(o), u = _t(s), d = w.useRef(null), m = pe(t, (f) => c(f)), g = w.useRef({
paused: !1,
pause() {
this.paused = !0;
},
resume() {
this.paused = !1;
}
}).current;
w.useEffect(() => {
if (r) {
let f = function(y) {
if (g.paused || !i) return;
const C = y.target;
i.contains(C) ? d.current = C : at(d.current, { select: !0 });
}, p = function(y) {
if (g.paused || !i) return;
const C = y.relatedTarget;
C !== null && (i.contains(C) || at(d.current, { select: !0 }));
}, v = function(y) {
if (document.activeElement === document.body)
for (const E of y)
E.removedNodes.length > 0 && at(i);
};
document.addEventListener("focusin", f), document.addEventListener("focusout", p);
const b = new MutationObserver(v);
return i && b.observe(i, { childList: !0, subtree: !0 }), () => {
document.removeEventListener("focusin", f), document.removeEventListener("focusout", p), b.disconnect();
};
}
}, [r, i, g.paused]), w.useEffect(() => {
if (i) {
ma.add(g);
const f = document.activeElement;
if (!i.contains(f)) {
const v = new CustomEvent(oo, pa);
i.addEventListener(oo, l), i.dispatchEvent(v), v.defaultPrevented || ($f(Xf(ec(i)), { select: !0 }), document.activeElement === f && at(i));
}
return () => {
i.removeEventListener(oo, l), setTimeout(() => {
const v = new CustomEvent(so, pa);
i.addEventListener(so, u), i.dispatchEvent(v), v.defaultPrevented || at(f ?? document.body, { select: !0 }), i.removeEventListener(so, u), ma.remove(g);
}, 0);
};
}
}, [i, l, u, g]);
const h = w.useCallback(
(f) => {
if (!n && !r || g.paused) return;
const p = f.key === "Tab" && !f.altKey && !f.ctrlKey && !f.metaKey, v = document.activeElement;
if (p && v) {
const b = f.currentTarget, [y, C] = Hf(b);
y && C ? !f.shiftKey && v === C ? (f.preventDefault(), n && at(y, { select: !0 })) : f.shiftKey && v === y && (f.preventDefault(), n && at(C, { select: !0 })) : v === b && f.preventDefault();
}
},
[n, r, g.paused]
);
return /* @__PURE__ */ x.jsx(le.div, { tabIndex: -1, ...a, ref: m, onKeyDown: h });
});
ms.displayName = zf;
function $f(e, { select: t = !1 } = {}) {
const n = document.activeElement;
for (const r of e)
if (at(r, { select: t }), document.activeElement !== n) return;
}
function Hf(e) {
const t = ec(e), n = ha(t, e), r = ha(t.reverse(), e);
return [n, r];
}
function ec(e) {
const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
acceptNode: (r) => {
const o = r.tagName === "INPUT" && r.type === "hidden";
return r.disabled || r.hidden || o ? NodeFilter.FILTER_SKIP : r.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
}
});
for (; n.nextNode(); ) t.push(n.currentNode);
return t;
}
function ha(e, t) {
for (const n of e)
if (!qf(n, { upTo: t })) return n;
}
function qf(e, { upTo: t }) {
if (getComputedStyle(e).visibility === "hidden") return !0;
for (; e; ) {
if (t !== void 0 && e === t) return !1;
if (getComputedStyle(e).display === "none") return !0;
e = e.parentElement;
}
return !1;
}
function Gf(e) {
return e instanceof HTMLInputElement && "select" in e;
}
function at(e, { select: t = !1 } = {}) {
if (e && e.focus) {
const n = document.activeElement;
e.focus({ preventScroll: !0 }), e !== n && Gf(e) && t && e.select();
}
}
var ma = Yf();
function Yf() {
let e = [];
return {
add(t) {
const n = e[0];
t !== n && (n == null || n.pause()), e = ga(e, t), e.unshift(t);
},
remove(t) {
var n;
e = ga(e, t), (n = e[0]) == null || n.resume();
}
};
}
function ga(e, t) {
const n = [...e], r = n.indexOf(t);
return r !== -1 && n.splice(r, 1), n;
}
function Xf(e) {
return e.filter((t) => t.tagName !== "A");
}
var Kf = "Portal", gs = w.forwardRef((e, t) => {
var i;
const { container: n, ...r } = e, [o, s] = w.useState(!1);
xe(() => s(!0), []);
const a = n || o && ((i = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : i.body);
return a ? Rd.createPortal(/* @__PURE__ */ x.jsx(le.div, { ...r, ref: t }), a) : null;
});
gs.displayName = Kf;
function Jf(e, t) {
return w.useReducer((n, r) => t[n][r] ?? n, e);
}
var Rr = (e) => {
const { present: t, children: n } = e, r = Zf(t), o = typeof n == "function" ? n({ present: r.isPresent }) : w.Children.only(n), s = pe(r.ref, Qf(o));
return typeof n == "function" || r.isPresent ? w.cloneElement(o, { ref: s }) : null;
};
Rr.displayName = "Presence";
function Zf(e) {
const [t, n] = w.useState(), r = w.useRef(null), o = w.useRef(e), s = w.useRef("none"), a = e ? "mounted" : "unmounted", [i, c] = Jf(a, {
mounted: {
UNMOUNT: "unmounted",
ANIMATION_OUT: "unmountSuspended"
},
unmountSuspended: {
MOUNT: "mounted",
ANIMATION_END: "unmounted"
},
unmounted: {
MOUNT: "mounted"
}
});
return w.useEffect(() => {
const l = Dn(r.current);
s.current = i === "mounted" ? l : "none";
}, [i]), xe(() => {
const l = r.current, u = o.current;
if (u !== e) {
const m = s.current, g = Dn(l);
e ? c("MOUNT") : g === "none" || (l == null ? void 0 : l.display) === "none" ? c("UNMOUNT") : c(