@ouim/simple-logto
Version:
A simpler way to use @logto/react with prebuilt UI components and hooks for fast authentication setup
1,679 lines (1,675 loc) • 283 kB
JavaScript
import * as p from "react";
import fe, { createContext as Cs, useEffect as xe, useState as Qe, useRef as en, useCallback as Tn, useMemo as $o, useContext as Es, forwardRef as Rs, createElement as Xr, useLayoutEffect as As } from "react";
import { LogtoProvider as Ms, useLogto as Ps, useHandleSignInCallback as ks } from "@logto/react";
import { UserScope as dv } from "@logto/react";
import * as Ho from "react-dom";
import Ts from "react-dom";
var Zn = { exports: {} }, St = {};
/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var Kr;
function Is() {
if (Kr)
return St;
Kr = 1;
var e = fe, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, o = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
function a(s, u, l) {
var d, c = {}, f = null, m = null;
l !== void 0 && (f = "" + l), u.key !== void 0 && (f = "" + u.key), u.ref !== void 0 && (m = u.ref);
for (d in u)
r.call(u, d) && !i.hasOwnProperty(d) && (c[d] = u[d]);
if (s && s.defaultProps)
for (d in u = s.defaultProps, u)
c[d] === void 0 && (c[d] = u[d]);
return { $$typeof: t, type: s, key: f, ref: m, props: c, _owner: o.current };
}
return St.Fragment = n, St.jsx = a, St.jsxs = a, St;
}
var Ct = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var Jr;
function Ls() {
return Jr || (Jr = 1, process.env.NODE_ENV !== "production" && function() {
var e = fe, t = Symbol.for("react.element"), n = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), s = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), c = Symbol.for("react.memo"), f = Symbol.for("react.lazy"), m = Symbol.for("react.offscreen"), y = Symbol.iterator, h = "@@iterator";
function g(v) {
if (v === null || typeof v != "object")
return null;
var E = y && v[y] || v[h];
return typeof E == "function" ? E : null;
}
var w = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
function x(v) {
{
for (var E = arguments.length, P = new Array(E > 1 ? E - 1 : 0), j = 1; j < E; j++)
P[j - 1] = arguments[j];
S("error", v, P);
}
}
function S(v, E, P) {
{
var j = w.ReactDebugCurrentFrame, H = j.getStackAddendum();
H !== "" && (E += "%s", P = P.concat([H]));
var K = P.map(function(U) {
return String(U);
});
K.unshift("Warning: " + E), Function.prototype.apply.call(console[v], console, K);
}
}
var C = !1, M = !1, I = !1, A = !1, R = !1, N;
N = Symbol.for("react.module.reference");
function L(v) {
return !!(typeof v == "string" || typeof v == "function" || v === r || v === i || R || v === o || v === l || v === d || A || v === m || C || M || I || typeof v == "object" && v !== null && (v.$$typeof === f || v.$$typeof === c || v.$$typeof === a || v.$$typeof === s || v.$$typeof === u || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since
// we don't know which Flight build this will end up being used
// with.
v.$$typeof === N || v.getModuleId !== void 0));
}
function D(v, E, P) {
var j = v.displayName;
if (j)
return j;
var H = E.displayName || E.name || "";
return H !== "" ? P + "(" + H + ")" : P;
}
function k(v) {
return v.displayName || "Context";
}
function _(v) {
if (v == null)
return null;
if (typeof v.tag == "number" && x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof v == "function")
return v.displayName || v.name || null;
if (typeof v == "string")
return v;
switch (v) {
case r:
return "Fragment";
case n:
return "Portal";
case i:
return "Profiler";
case o:
return "StrictMode";
case l:
return "Suspense";
case d:
return "SuspenseList";
}
if (typeof v == "object")
switch (v.$$typeof) {
case s:
var E = v;
return k(E) + ".Consumer";
case a:
var P = v;
return k(P._context) + ".Provider";
case u:
return D(v, v.render, "ForwardRef");
case c:
var j = v.displayName || null;
return j !== null ? j : _(v.type) || "Memo";
case f: {
var H = v, K = H._payload, U = H._init;
try {
return _(U(K));
} catch {
return null;
}
}
}
return null;
}
var V = Object.assign, $ = 0, F, X, O, T, G, Y, le;
function Ve() {
}
Ve.__reactDisabledLog = !0;
function Ze() {
{
if ($ === 0) {
F = console.log, X = console.info, O = console.warn, T = console.error, G = console.group, Y = console.groupCollapsed, le = console.groupEnd;
var v = {
configurable: !0,
enumerable: !0,
value: Ve,
writable: !0
};
Object.defineProperties(console, {
info: v,
log: v,
warn: v,
error: v,
group: v,
groupCollapsed: v,
groupEnd: v
});
}
$++;
}
}
function nt() {
{
if ($--, $ === 0) {
var v = {
configurable: !0,
enumerable: !0,
writable: !0
};
Object.defineProperties(console, {
log: V({}, v, {
value: F
}),
info: V({}, v, {
value: X
}),
warn: V({}, v, {
value: O
}),
error: V({}, v, {
value: T
}),
group: V({}, v, {
value: G
}),
groupCollapsed: V({}, v, {
value: Y
}),
groupEnd: V({}, v, {
value: le
})
});
}
$ < 0 && x("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
}
}
var ye = w.ReactCurrentDispatcher, ue;
function Ae(v, E, P) {
{
if (ue === void 0)
try {
throw Error();
} catch (H) {
var j = H.stack.trim().match(/\n( *(at )?)/);
ue = j && j[1] || "";
}
return `
` + ue + v;
}
}
var ne = !1, Me;
{
var Gt = typeof WeakMap == "function" ? WeakMap : Map;
Me = new Gt();
}
function bt(v, E) {
if (!v || ne)
return "";
{
var P = Me.get(v);
if (P !== void 0)
return P;
}
var j;
ne = !0;
var H = Error.prepareStackTrace;
Error.prepareStackTrace = void 0;
var K;
K = ye.current, ye.current = null, Ze();
try {
if (E) {
var U = function() {
throw Error();
};
if (Object.defineProperty(U.prototype, "props", {
set: function() {
throw Error();
}
}), typeof Reflect == "object" && Reflect.construct) {
try {
Reflect.construct(U, []);
} catch (se) {
j = se;
}
Reflect.construct(v, [], U);
} else {
try {
U.call();
} catch (se) {
j = se;
}
v.call(U.prototype);
}
} else {
try {
throw Error();
} catch (se) {
j = se;
}
v();
}
} catch (se) {
if (se && j && typeof se.stack == "string") {
for (var B = se.stack.split(`
`), re = j.stack.split(`
`), q = B.length - 1, ee = re.length - 1; q >= 1 && ee >= 0 && B[q] !== re[ee]; )
ee--;
for (; q >= 1 && ee >= 0; q--, ee--)
if (B[q] !== re[ee]) {
if (q !== 1 || ee !== 1)
do
if (q--, ee--, ee < 0 || B[q] !== re[ee]) {
var ve = `
` + B[q].replace(" at new ", " at ");
return v.displayName && ve.includes("<anonymous>") && (ve = ve.replace("<anonymous>", v.displayName)), typeof v == "function" && Me.set(v, ve), ve;
}
while (q >= 1 && ee >= 0);
break;
}
}
} finally {
ne = !1, ye.current = K, nt(), Error.prepareStackTrace = H;
}
var it = v ? v.displayName || v.name : "", Je = it ? Ae(it) : "";
return typeof v == "function" && Me.set(v, Je), Je;
}
function Xe(v, E, P) {
return bt(v, !1);
}
function Bt(v) {
var E = v.prototype;
return !!(E && E.isReactComponent);
}
function rt(v, E, P) {
if (v == null)
return "";
if (typeof v == "function")
return bt(v, Bt(v));
if (typeof v == "string")
return Ae(v);
switch (v) {
case l:
return Ae("Suspense");
case d:
return Ae("SuspenseList");
}
if (typeof v == "object")
switch (v.$$typeof) {
case u:
return Xe(v.render);
case c:
return rt(v.type, E, P);
case f: {
var j = v, H = j._payload, K = j._init;
try {
return rt(K(H), E, P);
} catch {
}
}
}
return "";
}
var Ke = Object.prototype.hasOwnProperty, Ut = {}, zt = w.ReactDebugCurrentFrame;
function _e(v) {
if (v) {
var E = v._owner, P = rt(v.type, v._source, E ? E.type : null);
zt.setExtraStackFrame(P);
} else
zt.setExtraStackFrame(null);
}
function ts(v, E, P, j, H) {
{
var K = Function.call.bind(Ke);
for (var U in v)
if (K(v, U)) {
var B = void 0;
try {
if (typeof v[U] != "function") {
var re = Error((j || "React class") + ": " + P + " type `" + U + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof v[U] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
throw re.name = "Invariant Violation", re;
}
B = v[U](E, U, j, P, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
} catch (q) {
B = q;
}
B && !(B instanceof Error) && (_e(H), x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", j || "React class", P, U, typeof B), _e(null)), B instanceof Error && !(B.message in Ut) && (Ut[B.message] = !0, _e(H), x("Failed %s type: %s", P, B.message), _e(null));
}
}
}
var ns = Array.isArray;
function En(v) {
return ns(v);
}
function rs(v) {
{
var E = typeof Symbol == "function" && Symbol.toStringTag, P = E && v[Symbol.toStringTag] || v.constructor.name || "Object";
return P;
}
}
function os(v) {
try {
return Fr(v), !1;
} catch {
return !0;
}
}
function Fr(v) {
return "" + v;
}
function Wr(v) {
if (os(v))
return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", rs(v)), Fr(v);
}
var xt = w.ReactCurrentOwner, is = {
key: !0,
ref: !0,
__self: !0,
__source: !0
}, Vr, Gr, Rn;
Rn = {};
function as(v) {
if (Ke.call(v, "ref")) {
var E = Object.getOwnPropertyDescriptor(v, "ref").get;
if (E && E.isReactWarning)
return !1;
}
return v.ref !== void 0;
}
function ss(v) {
if (Ke.call(v, "key")) {
var E = Object.getOwnPropertyDescriptor(v, "key").get;
if (E && E.isReactWarning)
return !1;
}
return v.key !== void 0;
}
function cs(v, E) {
if (typeof v.ref == "string" && xt.current && E && xt.current.stateNode !== E) {
var P = _(xt.current.type);
Rn[P] || (x('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', _(xt.current.type), v.ref), Rn[P] = !0);
}
}
function ls(v, E) {
{
var P = function() {
Vr || (Vr = !0, x("%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://reactjs.org/link/special-props)", E));
};
P.isReactWarning = !0, Object.defineProperty(v, "key", {
get: P,
configurable: !0
});
}
}
function us(v, E) {
{
var P = function() {
Gr || (Gr = !0, x("%s: `ref` 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://reactjs.org/link/special-props)", E));
};
P.isReactWarning = !0, Object.defineProperty(v, "ref", {
get: P,
configurable: !0
});
}
}
var ds = function(v, E, P, j, H, K, U) {
var B = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: t,
// Built-in properties that belong on the element
type: v,
key: E,
ref: P,
props: U,
// Record the component responsible for creating this element.
_owner: K
};
return B._store = {}, Object.defineProperty(B._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: !1
}), Object.defineProperty(B, "_self", {
configurable: !1,
enumerable: !1,
writable: !1,
value: j
}), Object.defineProperty(B, "_source", {
configurable: !1,
enumerable: !1,
writable: !1,
value: H
}), Object.freeze && (Object.freeze(B.props), Object.freeze(B)), B;
};
function fs(v, E, P, j, H) {
{
var K, U = {}, B = null, re = null;
P !== void 0 && (Wr(P), B = "" + P), ss(E) && (Wr(E.key), B = "" + E.key), as(E) && (re = E.ref, cs(E, H));
for (K in E)
Ke.call(E, K) && !is.hasOwnProperty(K) && (U[K] = E[K]);
if (v && v.defaultProps) {
var q = v.defaultProps;
for (K in q)
U[K] === void 0 && (U[K] = q[K]);
}
if (B || re) {
var ee = typeof v == "function" ? v.displayName || v.name || "Unknown" : v;
B && ls(U, ee), re && us(U, ee);
}
return ds(v, B, re, H, j, xt.current, U);
}
}
var An = w.ReactCurrentOwner, Br = w.ReactDebugCurrentFrame;
function ot(v) {
if (v) {
var E = v._owner, P = rt(v.type, v._source, E ? E.type : null);
Br.setExtraStackFrame(P);
} else
Br.setExtraStackFrame(null);
}
var Mn;
Mn = !1;
function Pn(v) {
return typeof v == "object" && v !== null && v.$$typeof === t;
}
function Ur() {
{
if (An.current) {
var v = _(An.current.type);
if (v)
return `
Check the render method of \`` + v + "`.";
}
return "";
}
}
function ps(v) {
{
if (v !== void 0) {
var E = v.fileName.replace(/^.*[\\\/]/, ""), P = v.lineNumber;
return `
Check your code at ` + E + ":" + P + ".";
}
return "";
}
}
var zr = {};
function ms(v) {
{
var E = Ur();
if (!E) {
var P = typeof v == "string" ? v : v.displayName || v.name;
P && (E = `
Check the top-level render call using <` + P + ">.");
}
return E;
}
}
function $r(v, E) {
{
if (!v._store || v._store.validated || v.key != null)
return;
v._store.validated = !0;
var P = ms(E);
if (zr[P])
return;
zr[P] = !0;
var j = "";
v && v._owner && v._owner !== An.current && (j = " It was passed a child from " + _(v._owner.type) + "."), ot(v), x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', P, j), ot(null);
}
}
function Hr(v, E) {
{
if (typeof v != "object")
return;
if (En(v))
for (var P = 0; P < v.length; P++) {
var j = v[P];
Pn(j) && $r(j, E);
}
else if (Pn(v))
v._store && (v._store.validated = !0);
else if (v) {
var H = g(v);
if (typeof H == "function" && H !== v.entries)
for (var K = H.call(v), U; !(U = K.next()).done; )
Pn(U.value) && $r(U.value, E);
}
}
}
function vs(v) {
{
var E = v.type;
if (E == null || typeof E == "string")
return;
var P;
if (typeof E == "function")
P = E.propTypes;
else if (typeof E == "object" && (E.$$typeof === u || // Note: Memo only checks outer props here.
// Inner props are checked in the reconciler.
E.$$typeof === c))
P = E.propTypes;
else
return;
if (P) {
var j = _(E);
ts(P, v.props, "prop", j, v);
} else if (E.PropTypes !== void 0 && !Mn) {
Mn = !0;
var H = _(E);
x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", H || "Unknown");
}
typeof E.getDefaultProps == "function" && !E.getDefaultProps.isReactClassApproved && x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
}
}
function hs(v) {
{
for (var E = Object.keys(v.props), P = 0; P < E.length; P++) {
var j = E[P];
if (j !== "children" && j !== "key") {
ot(v), x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", j), ot(null);
break;
}
}
v.ref !== null && (ot(v), x("Invalid attribute `ref` supplied to `React.Fragment`."), ot(null));
}
}
var Yr = {};
function Zr(v, E, P, j, H, K) {
{
var U = L(v);
if (!U) {
var B = "";
(v === void 0 || typeof v == "object" && v !== null && Object.keys(v).length === 0) && (B += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
var re = ps(H);
re ? B += re : B += Ur();
var q;
v === null ? q = "null" : En(v) ? q = "array" : v !== void 0 && v.$$typeof === t ? (q = "<" + (_(v.type) || "Unknown") + " />", B = " Did you accidentally export a JSX literal instead of a component?") : q = typeof v, x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", q, B);
}
var ee = fs(v, E, P, H, K);
if (ee == null)
return ee;
if (U) {
var ve = E.children;
if (ve !== void 0)
if (j)
if (En(ve)) {
for (var it = 0; it < ve.length; it++)
Hr(ve[it], v);
Object.freeze && Object.freeze(ve);
} else
x("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
Hr(ve, v);
}
if (Ke.call(E, "key")) {
var Je = _(v), se = Object.keys(E).filter(function(Ss) {
return Ss !== "key";
}), kn = se.length > 0 ? "{key: someKey, " + se.join(": ..., ") + ": ...}" : "{key: someKey}";
if (!Yr[Je + kn]) {
var xs = se.length > 0 ? "{" + se.join(": ..., ") + ": ...}" : "{}";
x(`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} />`, kn, Je, xs, Je), Yr[Je + kn] = !0;
}
}
return v === r ? hs(ee) : vs(ee), ee;
}
}
function gs(v, E, P) {
return Zr(v, E, P, !0);
}
function ys(v, E, P) {
return Zr(v, E, P, !1);
}
var ws = ys, bs = gs;
Ct.Fragment = r, Ct.jsx = ws, Ct.jsxs = bs;
}()), Ct;
}
process.env.NODE_ENV === "production" ? Zn.exports = Is() : Zn.exports = Ls();
var b = Zn.exports;
function Yo(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 = Yo(e[t])) && (r && (r += " "), r += n);
} else
for (n in e)
e[n] && (r && (r += " "), r += n);
return r;
}
function pr() {
for (var e, t, n = 0, r = "", o = arguments.length; n < o; n++)
(e = arguments[n]) && (t = Yo(e)) && (r && (r += " "), r += t);
return r;
}
const mr = "-", Os = (e) => {
const t = Ns(e), {
conflictingClassGroups: n,
conflictingClassGroupModifiers: r
} = e;
return {
getClassGroupId: (a) => {
const s = a.split(mr);
return s[0] === "" && s.length !== 1 && s.shift(), Zo(s, t) || _s(a);
},
getConflictingClassGroupIds: (a, s) => {
const u = n[a] || [];
return s && r[a] ? [...u, ...r[a]] : u;
}
};
}, Zo = (e, t) => {
var a;
if (e.length === 0)
return t.classGroupId;
const n = e[0], r = t.nextPart.get(n), o = r ? Zo(e.slice(1), r) : void 0;
if (o)
return o;
if (t.validators.length === 0)
return;
const i = e.join(mr);
return (a = t.validators.find(({
validator: s
}) => s(i))) == null ? void 0 : a.classGroupId;
}, Qr = /^\[(.+)\]$/, _s = (e) => {
if (Qr.test(e)) {
const t = Qr.exec(e)[1], n = t == null ? void 0 : t.substring(0, t.indexOf(":"));
if (n)
return "arbitrary.." + n;
}
}, Ns = (e) => {
const {
theme: t,
prefix: n
} = e, r = {
nextPart: /* @__PURE__ */ new Map(),
validators: []
};
return js(Object.entries(e.classGroups), n).forEach(([i, a]) => {
Xn(a, r, i, t);
}), r;
}, Xn = (e, t, n, r) => {
e.forEach((o) => {
if (typeof o == "string") {
const i = o === "" ? t : qr(t, o);
i.classGroupId = n;
return;
}
if (typeof o == "function") {
if (Ds(o)) {
Xn(o(r), t, n, r);
return;
}
t.validators.push({
validator: o,
classGroupId: n
});
return;
}
Object.entries(o).forEach(([i, a]) => {
Xn(a, qr(t, i), n, r);
});
});
}, qr = (e, t) => {
let n = e;
return t.split(mr).forEach((r) => {
n.nextPart.has(r) || n.nextPart.set(r, {
nextPart: /* @__PURE__ */ new Map(),
validators: []
}), n = n.nextPart.get(r);
}), n;
}, Ds = (e) => e.isThemeGetter, js = (e, t) => t ? e.map(([n, r]) => {
const o = r.map((i) => typeof i == "string" ? t + i : typeof i == "object" ? Object.fromEntries(Object.entries(i).map(([a, s]) => [t + a, s])) : i);
return [n, o];
}) : e, Fs = (e) => {
if (e < 1)
return {
get: () => {
},
set: () => {
}
};
let t = 0, n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
const o = (i, a) => {
n.set(i, a), t++, t > e && (t = 0, r = n, n = /* @__PURE__ */ new Map());
};
return {
get(i) {
let a = n.get(i);
if (a !== void 0)
return a;
if ((a = r.get(i)) !== void 0)
return o(i, a), a;
},
set(i, a) {
n.has(i) ? n.set(i, a) : o(i, a);
}
};
}, Xo = "!", Ws = (e) => {
const {
separator: t,
experimentalParseClassName: n
} = e, r = t.length === 1, o = t[0], i = t.length, a = (s) => {
const u = [];
let l = 0, d = 0, c;
for (let g = 0; g < s.length; g++) {
let w = s[g];
if (l === 0) {
if (w === o && (r || s.slice(g, g + i) === t)) {
u.push(s.slice(d, g)), d = g + i;
continue;
}
if (w === "/") {
c = g;
continue;
}
}
w === "[" ? l++ : w === "]" && l--;
}
const f = u.length === 0 ? s : s.substring(d), m = f.startsWith(Xo), y = m ? f.substring(1) : f, h = c && c > d ? c - d : void 0;
return {
modifiers: u,
hasImportantModifier: m,
baseClassName: y,
maybePostfixModifierPosition: h
};
};
return n ? (s) => n({
className: s,
parseClassName: a
}) : a;
}, Vs = (e) => {
if (e.length <= 1)
return e;
const t = [];
let n = [];
return e.forEach((r) => {
r[0] === "[" ? (t.push(...n.sort(), r), n = []) : n.push(r);
}), t.push(...n.sort()), t;
}, Gs = (e) => ({
cache: Fs(e.cacheSize),
parseClassName: Ws(e),
...Os(e)
}), Bs = /\s+/, Us = (e, t) => {
const {
parseClassName: n,
getClassGroupId: r,
getConflictingClassGroupIds: o
} = t, i = [], a = e.trim().split(Bs);
let s = "";
for (let u = a.length - 1; u >= 0; u -= 1) {
const l = a[u], {
modifiers: d,
hasImportantModifier: c,
baseClassName: f,
maybePostfixModifierPosition: m
} = n(l);
let y = !!m, h = r(y ? f.substring(0, m) : f);
if (!h) {
if (!y) {
s = l + (s.length > 0 ? " " + s : s);
continue;
}
if (h = r(f), !h) {
s = l + (s.length > 0 ? " " + s : s);
continue;
}
y = !1;
}
const g = Vs(d).join(":"), w = c ? g + Xo : g, x = w + h;
if (i.includes(x))
continue;
i.push(x);
const S = o(h, y);
for (let C = 0; C < S.length; ++C) {
const M = S[C];
i.push(w + M);
}
s = l + (s.length > 0 ? " " + s : s);
}
return s;
};
function zs() {
let e = 0, t, n, r = "";
for (; e < arguments.length; )
(t = arguments[e++]) && (n = Ko(t)) && (r && (r += " "), r += n);
return r;
}
const Ko = (e) => {
if (typeof e == "string")
return e;
let t, n = "";
for (let r = 0; r < e.length; r++)
e[r] && (t = Ko(e[r])) && (n && (n += " "), n += t);
return n;
};
function $s(e, ...t) {
let n, r, o, i = a;
function a(u) {
const l = t.reduce((d, c) => c(d), e());
return n = Gs(l), r = n.cache.get, o = n.cache.set, i = s, s(u);
}
function s(u) {
const l = r(u);
if (l)
return l;
const d = Us(u, n);
return o(u, d), d;
}
return function() {
return i(zs.apply(null, arguments));
};
}
const J = (e) => {
const t = (n) => n[e] || [];
return t.isThemeGetter = !0, t;
}, Jo = /^\[(?:([a-z-]+):)?(.+)\]$/i, Hs = /^\d+\/\d+$/, Ys = /* @__PURE__ */ new Set(["px", "full", "screen"]), Zs = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, Xs = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, Ks = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, Js = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, Qs = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, Ne = (e) => ft(e) || Ys.has(e) || Hs.test(e), Ge = (e) => ht(e, "length", ac), ft = (e) => !!e && !Number.isNaN(Number(e)), In = (e) => ht(e, "number", ft), Et = (e) => !!e && Number.isInteger(Number(e)), qs = (e) => e.endsWith("%") && ft(e.slice(0, -1)), W = (e) => Jo.test(e), Be = (e) => Zs.test(e), ec = /* @__PURE__ */ new Set(["length", "size", "percentage"]), tc = (e) => ht(e, ec, Qo), nc = (e) => ht(e, "position", Qo), rc = /* @__PURE__ */ new Set(["image", "url"]), oc = (e) => ht(e, rc, cc), ic = (e) => ht(e, "", sc), Rt = () => !0, ht = (e, t, n) => {
const r = Jo.exec(e);
return r ? r[1] ? typeof t == "string" ? r[1] === t : t.has(r[1]) : n(r[2]) : !1;
}, ac = (e) => (
// `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
// For example, `hsl(0 0% 0%)` would be classified as a length without this check.
// I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
Xs.test(e) && !Ks.test(e)
), Qo = () => !1, sc = (e) => Js.test(e), cc = (e) => Qs.test(e), lc = () => {
const e = J("colors"), t = J("spacing"), n = J("blur"), r = J("brightness"), o = J("borderColor"), i = J("borderRadius"), a = J("borderSpacing"), s = J("borderWidth"), u = J("contrast"), l = J("grayscale"), d = J("hueRotate"), c = J("invert"), f = J("gap"), m = J("gradientColorStops"), y = J("gradientColorStopPositions"), h = J("inset"), g = J("margin"), w = J("opacity"), x = J("padding"), S = J("saturate"), C = J("scale"), M = J("sepia"), I = J("skew"), A = J("space"), R = J("translate"), N = () => ["auto", "contain", "none"], L = () => ["auto", "hidden", "clip", "visible", "scroll"], D = () => ["auto", W, t], k = () => [W, t], _ = () => ["", Ne, Ge], V = () => ["auto", ft, W], $ = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], F = () => ["solid", "dashed", "dotted", "double", "none"], X = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], O = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], T = () => ["", "0", W], G = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], Y = () => [ft, W];
return {
cacheSize: 500,
separator: ":",
theme: {
colors: [Rt],
spacing: [Ne, Ge],
blur: ["none", "", Be, W],
brightness: Y(),
borderColor: [e],
borderRadius: ["none", "", "full", Be, W],
borderSpacing: k(),
borderWidth: _(),
contrast: Y(),
grayscale: T(),
hueRotate: Y(),
invert: T(),
gap: k(),
gradientColorStops: [e],
gradientColorStopPositions: [qs, Ge],
inset: D(),
margin: D(),
opacity: Y(),
padding: k(),
saturate: Y(),
scale: Y(),
sepia: T(),
skew: Y(),
space: k(),
translate: k()
},
classGroups: {
// Layout
/**
* Aspect Ratio
* @see https://tailwindcss.com/docs/aspect-ratio
*/
aspect: [{
aspect: ["auto", "square", "video", W]
}],
/**
* Container
* @see https://tailwindcss.com/docs/container
*/
container: ["container"],
/**
* Columns
* @see https://tailwindcss.com/docs/columns
*/
columns: [{
columns: [Be]
}],
/**
* Break After
* @see https://tailwindcss.com/docs/break-after
*/
"break-after": [{
"break-after": G()
}],
/**
* Break Before
* @see https://tailwindcss.com/docs/break-before
*/
"break-before": [{
"break-before": G()
}],
/**
* Break Inside
* @see https://tailwindcss.com/docs/break-inside
*/
"break-inside": [{
"break-inside": ["auto", "avoid", "avoid-page", "avoid-column"]
}],
/**
* Box Decoration Break
* @see https://tailwindcss.com/docs/box-decoration-break
*/
"box-decoration": [{
"box-decoration": ["slice", "clone"]
}],
/**
* Box Sizing
* @see https://tailwindcss.com/docs/box-sizing
*/
box: [{
box: ["border", "content"]
}],
/**
* Display
* @see https://tailwindcss.com/docs/display
*/
display: ["block", "inline-block", "inline", "flex", "inline-flex", "table", "inline-table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row-group", "table-row", "flow-root", "grid", "inline-grid", "contents", "list-item", "hidden"],
/**
* Floats
* @see https://tailwindcss.com/docs/float
*/
float: [{
float: ["right", "left", "none", "start", "end"]
}],
/**
* Clear
* @see https://tailwindcss.com/docs/clear
*/
clear: [{
clear: ["left", "right", "both", "none", "start", "end"]
}],
/**
* Isolation
* @see https://tailwindcss.com/docs/isolation
*/
isolation: ["isolate", "isolation-auto"],
/**
* Object Fit
* @see https://tailwindcss.com/docs/object-fit
*/
"object-fit": [{
object: ["contain", "cover", "fill", "none", "scale-down"]
}],
/**
* Object Position
* @see https://tailwindcss.com/docs/object-position
*/
"object-position": [{
object: [...$(), W]
}],
/**
* Overflow
* @see https://tailwindcss.com/docs/overflow
*/
overflow: [{
overflow: L()
}],
/**
* Overflow X
* @see https://tailwindcss.com/docs/overflow
*/
"overflow-x": [{
"overflow-x": L()
}],
/**
* Overflow Y
* @see https://tailwindcss.com/docs/overflow
*/
"overflow-y": [{
"overflow-y": L()
}],
/**
* Overscroll Behavior
* @see https://tailwindcss.com/docs/overscroll-behavior
*/
overscroll: [{
overscroll: N()
}],
/**
* Overscroll Behavior X
* @see https://tailwindcss.com/docs/overscroll-behavior
*/
"overscroll-x": [{
"overscroll-x": N()
}],
/**
* Overscroll Behavior Y
* @see https://tailwindcss.com/docs/overscroll-behavior
*/
"overscroll-y": [{
"overscroll-y": N()
}],
/**
* Position
* @see https://tailwindcss.com/docs/position
*/
position: ["static", "fixed", "absolute", "relative", "sticky"],
/**
* Top / Right / Bottom / Left
* @see https://tailwindcss.com/docs/top-right-bottom-left
*/
inset: [{
inset: [h]
}],
/**
* Right / Left
* @see https://tailwindcss.com/docs/top-right-bottom-left
*/
"inset-x": [{
"inset-x": [h]
}],
/**
* Top / Bottom
* @see https://tailwindcss.com/docs/top-right-bottom-left
*/
"inset-y": [{
"inset-y": [h]
}],
/**
* Start
* @see https://tailwindcss.com/docs/top-right-bottom-left
*/
start: [{
start: [h]
}],
/**
* End
* @see https://tailwindcss.com/docs/top-right-bottom-left
*/
end: [{
end: [h]
}],
/**
* Top
* @see https://tailwindcss.com/docs/top-right-bottom-left
*/
top: [{
top: [h]
}],
/**
* Right
* @see https://tailwindcss.com/docs/top-right-bottom-left
*/
right: [{
right: [h]
}],
/**
* Bottom
* @see https://tailwindcss.com/docs/top-right-bottom-left
*/
bottom: [{
bottom: [h]
}],
/**
* Left
* @see https://tailwindcss.com/docs/top-right-bottom-left
*/
left: [{
left: [h]
}],
/**
* Visibility
* @see https://tailwindcss.com/docs/visibility
*/
visibility: ["visible", "invisible", "collapse"],
/**
* Z-Index
* @see https://tailwindcss.com/docs/z-index
*/
z: [{
z: ["auto", Et, W]
}],
// Flexbox and Grid
/**
* Flex Basis
* @see https://tailwindcss.com/docs/flex-basis
*/
basis: [{
basis: D()
}],
/**
* Flex Direction
* @see https://tailwindcss.com/docs/flex-direction
*/
"flex-direction": [{
flex: ["row", "row-reverse", "col", "col-reverse"]
}],
/**
* Flex Wrap
* @see https://tailwindcss.com/docs/flex-wrap
*/
"flex-wrap": [{
flex: ["wrap", "wrap-reverse", "nowrap"]
}],
/**
* Flex
* @see https://tailwindcss.com/docs/flex
*/
flex: [{
flex: ["1", "auto", "initial", "none", W]
}],
/**
* Flex Grow
* @see https://tailwindcss.com/docs/flex-grow
*/
grow: [{
grow: T()
}],
/**
* Flex Shrink
* @see https://tailwindcss.com/docs/flex-shrink
*/
shrink: [{
shrink: T()
}],
/**
* Order
* @see https://tailwindcss.com/docs/order
*/
order: [{
order: ["first", "last", "none", Et, W]
}],
/**
* Grid Template Columns
* @see https://tailwindcss.com/docs/grid-template-columns
*/
"grid-cols": [{
"grid-cols": [Rt]
}],
/**
* Grid Column Start / End
* @see https://tailwindcss.com/docs/grid-column
*/
"col-start-end": [{
col: ["auto", {
span: ["full", Et, W]
}, W]
}],
/**
* Grid Column Start
* @see https://tailwindcss.com/docs/grid-column
*/
"col-start": [{
"col-start": V()
}],
/**
* Grid Column End
* @see https://tailwindcss.com/docs/grid-column
*/
"col-end": [{
"col-end": V()
}],
/**
* Grid Template Rows
* @see https://tailwindcss.com/docs/grid-template-rows
*/
"grid-rows": [{
"grid-rows": [Rt]
}],
/**
* Grid Row Start / End
* @see https://tailwindcss.com/docs/grid-row
*/
"row-start-end": [{
row: ["auto", {
span: [Et, W]
}, W]
}],
/**
* Grid Row Start
* @see https://tailwindcss.com/docs/grid-row
*/
"row-start": [{
"row-start": V()
}],
/**
* Grid Row End
* @see https://tailwindcss.com/docs/grid-row
*/
"row-end": [{
"row-end": V()
}],
/**
* Grid Auto Flow
* @see https://tailwindcss.com/docs/grid-auto-flow
*/
"grid-flow": [{
"grid-flow": ["row", "col", "dense", "row-dense", "col-dense"]
}],
/**
* Grid Auto Columns
* @see https://tailwindcss.com/docs/grid-auto-columns
*/
"auto-cols": [{
"auto-cols": ["auto", "min", "max", "fr", W]
}],
/**
* Grid Auto Rows
* @see https://tailwindcss.com/docs/grid-auto-rows
*/
"auto-rows": [{
"auto-rows": ["auto", "min", "max", "fr", W]
}],
/**
* Gap
* @see https://tailwindcss.com/docs/gap
*/
gap: [{
gap: [f]
}],
/**
* Gap X
* @see https://tailwindcss.com/docs/gap
*/
"gap-x": [{
"gap-x": [f]
}],
/**
* Gap Y
* @see https://tailwindcss.com/docs/gap
*/
"gap-y": [{
"gap-y": [f]
}],
/**
* Justify Content
* @see https://tailwindcss.com/docs/justify-content
*/
"justify-content": [{
justify: ["normal", ...O()]
}],
/**
* Justify Items
* @see https://tailwindcss.com/docs/justify-items
*/
"justify-items": [{
"justify-items": ["start", "end", "center", "stretch"]
}],
/**
* Justify Self
* @see https://tailwindcss.com/docs/justify-self
*/
"justify-self": [{
"justify-self": ["auto", "start", "end", "center", "stretch"]
}],
/**
* Align Content
* @see https://tailwindcss.com/docs/align-content
*/
"align-content": [{
content: ["normal", ...O(), "baseline"]
}],
/**
* Align Items
* @see https://tailwindcss.com/docs/align-items
*/
"align-items": [{
items: ["start", "end", "center", "baseline", "stretch"]
}],
/**
* Align Self
* @see https://tailwindcss.com/docs/align-self
*/
"align-self": [{
self: ["auto", "start", "end", "center", "stretch", "baseline"]
}],
/**
* Place Content
* @see https://tailwindcss.com/docs/place-content
*/
"place-content": [{
"place-content": [...O(), "baseline"]
}],
/**
* Place Items
* @see https://tailwindcss.com/docs/place-items
*/
"place-items": [{
"place-items": ["start", "end", "center", "baseline", "stretch"]
}],
/**
* Place Self
* @see https://tailwindcss.com/docs/place-self
*/
"place-self": [{
"place-self": ["auto", "start", "end", "center", "stretch"]
}],
// Spacing
/**
* Padding
* @see https://tailwindcss.com/docs/padding
*/
p: [{
p: [x]
}],
/**
* Padding X
* @see https://tailwindcss.com/docs/padding
*/
px: [{
px: [x]
}],
/**
* Padding Y
* @see https://tailwindcss.com/docs/padding
*/
py: [{
py: [x]
}],
/**
* Padding Start
* @see https://tailwindcss.com/docs/padding
*/
ps: [{
ps: [x]
}],
/**
* Padding End
* @see https://tailwindcss.com/docs/padding
*/
pe: [{
pe: [x]
}],
/**
* Padding Top
* @see https://tailwindcss.com/docs/padding
*/
pt: [{
pt: [x]
}],
/**
* Padding Right
* @see https://tailwindcss.com/docs/padding
*/
pr: [{
pr: [x]
}],
/**
* Padding Bottom
* @see https://tailwindcss.com/docs/padding
*/
pb: [{
pb: [x]
}],
/**
* Padding Left
* @see https://tailwindcss.com/docs/padding
*/
pl: [{
pl: [x]
}],
/**
* Margin
* @see https://tailwindcss.com/docs/margin
*/
m: [{
m: [g]
}],
/**
* Margin X
* @see https://tailwindcss.com/docs/margin
*/
mx: [{
mx: [g]
}],
/**
* Margin Y
* @see https://tailwindcss.com/docs/margin
*/
my: [{
my: [g]
}],
/**
* Margin Start
* @see https://tailwindcss.com/docs/margin
*/
ms: [{
ms: [g]
}],
/**
* Margin End
* @see https://tailwindcss.com/docs/margin
*/
me: [{
me: [g]
}],
/**
* Margin Top
* @see https://tailwindcss.com/docs/margin
*/
mt: [{
mt: [g]
}],
/**
* Margin Right
* @see https://tailwindcss.com/docs/margin
*/
mr: [{
mr: [g]
}],
/**
* Margin Bottom
* @see https://tailwindcss.com/docs/margin
*/
mb: [{
mb: [g]
}],
/**
* Margin Left
* @see https://tailwindcss.com/docs/margin
*/
ml: [{
ml: [g]
}],
/**
* Space Between X
* @see https://tailwindcss.com/docs/space
*/
"space-x": [{
"space-x": [A]
}],
/**
* Space Between X Reverse
* @see https://tailwindcss.com/docs/space
*/
"space-x-reverse": ["space-x-reverse"],
/**
* Space Between Y
* @see https://tailwindcss.com/docs/space
*/
"space-y": [{
"space-y": [A]
}],
/**
* Space Between Y Reverse
* @see https://tailwindcss.com/docs/space
*/
"space-y-reverse": ["space-y-reverse"],
// Sizing
/**
* Width
* @see https://tailwindcss.com/docs/width
*/
w: [{
w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw", W, t]
}],
/**
* Min-Width
* @see https://tailwindcss.com/docs/min-width
*/
"min-w": [{
"min-w": [W, t, "min", "max", "fit"]
}],
/**
* Max-Width
* @see https://tailwindcss.com/docs/max-width
*/
"max-w": [{
"max-w": [W, t, "none", "full", "min", "max", "fit", "prose", {
screen: [Be]
}, Be]
}],
/**
* Height
* @see https://tailwindcss.com/docs/height
*/
h: [{
h: [W, t, "auto", "min", "max", "fit", "svh", "lvh", "dvh"]
}],
/**
* Min-Height
* @see https://tailwindcss.com/docs/min-height
*/
"min-h": [{
"min-h": [W, t, "min", "max", "fit", "svh", "lvh", "dvh"]
}],
/**
* Max-Height
* @see https://tailwindcss.com/docs/max-height
*/
"max-h": [{
"max-h": [W, t, "min", "max", "fit", "svh", "lvh", "dvh"]
}],
/**
* Size
* @see https://tailwindcss.com/docs/size
*/
size: [{
size: [W, t, "auto", "min", "max", "fit"]
}],
// Typography
/**
* Font Size
* @see https://tailwindcss.com/docs/font-size
*/
"font-size": [{
text: ["base", Be, Ge]
}],
/**
* Font Smoothing
* @see https://tailwindcss.com/docs/font-smoothing
*/
"font-smoothing": ["antialiased", "subpixel-antialiased"],
/**
* Font Style
* @see https://tailwindcss.com/docs/font-style
*/
"font-style": ["italic", "not-italic"],
/**
* Font Weight
* @see https://tailwindcss.com/docs/font-weight
*/
"font-weight": [{
font: ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black", In]
}],
/**
* Font Family
* @see https://tailwindcss.com/docs/font-family
*/
"font-family": [{
font: [Rt]
}],
/**
* Font Variant Numeric
* @see https://tailwindcss.com/docs/font-variant-numeric
*/
"fvn-normal": ["normal-nums"],
/**
* Font Variant Numeric
* @see https://tailwindcss.com/docs/font-variant-numeric
*/
"fvn-ordinal": ["ordinal"],
/**
* Font Variant Numeric
* @see https://tailwindcss.com/docs/font-variant-numeric
*/
"fvn-slashed-zero": ["slashed-zero"],
/**
* Font Variant Numeric
* @see https://tailwindcss.com/docs/font-variant-numeric
*/
"fvn-figure": ["lining-nums", "oldstyle-nums"],
/**
* Font Variant Numeric
* @see https://tailwindcss.com/docs/font-variant-numeric
*/
"fvn-spacing": ["proportional-nums", "tabular-nums"],
/**
* Font Variant Numeric
* @see https://tailwindcss.com/docs/font-variant-numeric
*/
"fvn-fraction": ["diagonal-fractions", "stacked-fractions"],
/**
* Letter Spacing
* @see https://tailwindcss.com/docs/letter-spacing
*/
tracking: [{
tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", W]
}],
/**
* Line Clamp
* @see https://tailwindcss.com/docs/line-clamp
*/
"line-clamp": [{
"line-clamp": ["none", ft, In]
}],
/**
* Line Height
* @see https://tailwindcss.com/docs/line-height
*/
leading: [{
leading: ["none", "tight", "snug", "normal", "relaxed", "loose", Ne, W]
}],
/**
* List Style Image
* @see https://tailwindcss.com/docs/list-style-image
*/
"list-image": [{
"list-image": ["none", W]
}],
/**
* List Style Type
* @see https://tailwindcss.com/docs/list-style-type
*/
"list-style-type": [{
list: ["none", "disc", "decimal", W]
}],
/**
* List Style Position
* @see https://tailwindcss.com/docs/list-style-position
*/
"list-style-position": [{
list: ["inside", "outside"]
}],
/**
* Placeholder Color
* @deprecated since Tailwind CSS v3.0.0
* @see https://tailwindcss.com/docs/placeholder-color
*/
"placeholder-color": [{
placeholder: [e]
}],
/**
* Placeholder Opacity
* @see https://tailwindcss.com/docs/placeholder-opacity
*/
"placeholder-opacity": [{