@devkitvue/form
Version:
Devkit Base Components is a Vue plugin offering a collection of reusable, headless components designed to streamline your Vue.js development workflow. Built for flexibility and maintainability, this library gives you complete control over styling and beha
1,435 lines • 944 kB
JavaScript
var cf = Object.defineProperty;
var df = (t, e, n) => e in t ? cf(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
var Bn = (t, e, n) => df(t, typeof e != "symbol" ? e + "" : e, n);
import { ref as te, onBeforeUnmount as ar, computed as Gr, defineComponent as be, inject as je, resolveComponent as Se, withAsyncContext as Ls, createBlock as ee, openBlock as D, resolveDynamicComponent as Pe, h as ue, Suspense as Sd, withCtx as de, createVNode as pe, mergeProps as E, createElementVNode as X, createElementBlock as R, unref as vt, createTextVNode as Ye, toDisplayString as re, Fragment as De, renderList as kt, onBeforeMount as pf, createCommentVNode as Q, readonly as hf, getCurrentInstance as Pl, onMounted as Kt, nextTick as ff, watch as He, useId as mf, renderSlot as H, resolveDirective as Fo, withDirectives as Nt, normalizeClass as st, Teleport as gf, normalizeStyle as vf, Transition as Rs, vShow as Va, withKeys as ge, onErrorCaptured as yf, reactive as bf, provide as wf, normalizeProps as Sf, createSlots as kf, withModifiers as _f } from "vue";
import { defineStore as Cf, getActivePinia as Pf } from "pinia";
import { useFormKitContextById as Of, useFormKitNodeById as Tf, useFormKitContext as xf, createInput as zi, defaultConfig as Ef } from "@formkit/vue";
import { ObjectEntries as Ha, resolveApiEndpoint as qt, ObjectKeys as Vr } from "@devkitvue/apiclient";
import { AppBtn as tn, makeGridWrapperClassName as Ff, AppIcon as If } from "@devkitvue/base-components";
import { useRoute as Df, useRouter as kd } from "vue-router";
import { useToast as Mf, Skeleton as Af, SelectButton as $f, MultiSelect as Lf } from "primevue";
import { useQueryClient as Rf, useMutation as Bf, useQuery as Uf } from "@tanstack/vue-query";
import Nf from "dexie";
import { useI18n as zf } from "vue-i18n";
function _d(t, e = 200) {
const n = te(null), r = (...i) => {
n.value && clearTimeout(n.value), n.value = setTimeout(() => {
t(...i);
}, e);
};
return ar(() => {
n.value && clearTimeout(n.value);
}), r;
}
const Bs = () => {
const [t, e] = history.state.current.split("?"), n = new URLSearchParams(e || "");
return { currentPath: t, currentQueryParams: n };
}, Cd = (t, e) => {
const n = e.toString(), r = `${t}?${n}`, i = { ...history.state };
i.current = r, history.pushState(i, "", r);
}, Ol = (t, e) => {
const { currentPath: n, currentQueryParams: r } = Bs();
r.set(t, String(e)), Cd(n, r);
}, jf = (t) => {
const { currentPath: e, currentQueryParams: n } = Bs();
return n.delete(t), Cd(e, n), n;
}, Vf = (t) => {
const { currentQueryParams: e } = Bs();
return console.log("cuirreeen params", e), e.get(t);
}, Hf = ({
context: t
}) => Cf(`app-form-${t.formKey}`, () => {
const e = {}, n = {}, r = te({}), i = 1e3, o = Of(t.formKey), a = Tf(t.formKey), s = _d((g) => {
if (typeof g == "object") {
Ol(t.formKey, JSON.stringify(g));
return;
}
Ol(t.formKey, g);
}, i), l = () => {
a.value && a.value.reset();
}, u = () => {
a.value && a.value.reset({});
}, c = Gr(() => {
if (!a.value || !a.value._value || !a.value.value) return "";
try {
const g = JSON.stringify(a.value._value);
return g == "{}" ? "" : g;
} catch (g) {
return console.error("error happened while converting value: ", g), "";
}
}), d = async (g) => {
a.value && a.value.reset(g);
}, p = async (g, b) => {
if (!a.value) return;
const v = {};
v[g] = b, console.log("new obj is", v), a.value.input(v);
}, f = async (g) => {
if (!a.value) return;
const b = a.value.find(g, "name");
b && "forceReload" in b.props && b.props.forceReload();
}, m = async (g) => {
p(g, null);
}, k = () => {
a.value && localStorage.setItem(t.formKey, c.value);
}, y = Gr(() => {
const g = {};
return !a || !a.value || !a.value._value ? g : a.value._value;
}), O = Gr(() => {
const g = {};
console.log("formvalue", y.value);
for (const [b, v] of Ha(y.value))
console.log("formvalue", y.value), v && (g[b] = v);
return g;
});
return {
//state
initialFormValue: e,
setFormValue: d,
formValue: y,
presistForm: k,
formValueString: c,
clearInput: m,
activeInputs: O,
refetchDropdownInput: f,
setInputValue: p,
resetForm: l,
formElementNode: a,
formElementContext: o,
formData: r,
debouncedRouteQueryAppend: s,
clearForm: u,
formOptions: n
//methos
};
}), Us = (t) => Hf(t)(), S3 = (t) => {
const e = Pf();
if (!e) throw new Error("Pinia not installed");
if (!(`app-form-${t}` in e.state.value)) throw new Error("store is not defined");
return Us({
context: {
sections: {},
formKey: t,
title: "formKey",
submitHandler: { endpoint: "" }
}
});
}, qf = /* @__PURE__ */ be({
__name: "FormBase",
props: {
context: {}
},
emits: ["input"],
async setup(t, { emit: e }) {
let n, r;
const i = je("dialogRef"), o = Se("FormKitSchema"), a = Rf(), s = Se("FormKit"), l = je("apiClient"), u = Mf(), c = t, {
submitHandler: d,
findHandler: p,
syncWithUrl: f,
usePresist: m,
options: k,
formKey: y,
invalidateCaches: O
} = c.context, g = Us(c), b = e, { t: v } = zf(), P = Df();
function _(L) {
return typeof L != "string" || !L.trim() ? !1 : !Number.isNaN(Number(L));
}
const T = async () => {
if (p && p.endpoint)
try {
const L = {};
console.log("findis data", p.requestPropertyName, P.params);
const z = p.requestValue ? p.requestValue : P.params[p.routerParamName || "id"];
console.log("findis data", z), L[p.requestPropertyName || "recordId"] = _(z) ? parseInt(z) : z, console.log("findis data", L);
const Z = await qt(p.endpoint, l, L);
if (!Z) return;
if (p.responsePropertyName && p.responsePropertyName in Z) {
const G = Z[p.responsePropertyName || "request"];
if (typeof G == "object" && G)
return G;
}
return Z;
} catch (L) {
console.error("find handler faild to fetch", L);
}
}, x = (L) => {
if (console.log("initial", L), !(!y || !L))
try {
return JSON.parse(L);
} catch (z) {
jf(y), localStorage.removeItem(y), console.log("error parsing url", z);
}
}, I = () => {
if (!m || !y) return;
const L = localStorage.getItem(y);
return L ? x(L) : {};
}, U = () => {
if (!f || !y) return;
const L = Vf(y);
return L ? x(L) : {};
}, N = () => {
if (console.log("default fetcher"), !f && !m)
return;
const L = U();
if (L && Vr(L).length > 0)
return L;
if (m) {
const z = I();
if (z && Vr(z).length > 0)
return z;
}
}, j = (L) => new Promise((z, Z) => {
qt(d.endpoint, l, L).then((G) => {
z(G);
}).catch((G) => {
Z(G);
});
});
let M;
const q = async () => {
if (console.log("form init"), p) {
const z = await T();
M = z, console.log("intial data is", z);
return;
}
const L = N();
console.log("default data is", L), M = L;
};
[n, r] = Ls(() => q()), await n, r();
const K = async (L) => {
const z = [];
L.walk((Z) => {
var $e;
console.log(Z.context);
const G = ($e = Z.context) == null ? void 0 : $e._uppyPrepareUpload;
typeof G == "function" && z.push(G());
}), await Promise.all(z);
}, S = Bf({
mutationFn: j,
onSuccess: () => {
F.value || d.redirectRoute && $(d.redirectRoute), O && (Eo.dropdownHelper.bulkDelete(O), a.invalidateQueries({
queryKey: c.context.invalidateCaches
}));
}
}), w = (L) => typeof L < "u" && L != null && typeof L == "object" && "inputs" in L && Array.isArray(L.inputs) && !Array.isArray(L), C = () => {
const L = [], { sections: z } = c.context;
for (let Z in z) {
const G = z[Z], $e = w(G), Ee = Ff(G == null ? void 0 : G.gridConfig);
if (!$e) {
const Gt = {
$el: "div",
attrs: {
class: `form-section ${Ee}`
},
children: G
};
L.push(Gt);
continue;
}
const Et = [
{
$el: "div",
attrs: {
class: Ee
},
children: G.inputs
}
];
G.title && Et.unshift({
$el: "div",
attrs: {
class: "section-title mb-4 font-bold"
},
children: G.title
});
const Yt = {
$el: "div",
children: Et
};
L.push(Yt);
}
return L;
}, F = te(!1), { push: $ } = kd(), A = (L, z) => {
try {
if (z && typeof z == "object") {
console.log("ety", z, Vr(z)), Vr(z).forEach(($e) => console.log($e, z[$e]));
let Z = [], G = {};
"globalErrors" in z && Array.isArray(z.globalErrors) && (Z = z.globalErrors), "fieldErrors" in z && (console.log("ety", z.fieldErrors), typeof z.fieldErrors == "object" && (G = z.fieldErrors)), L.setErrors(Z, G);
}
} catch {
L.setErrors([z]);
}
}, V = async (L, z) => {
c.context.syncWithUrl && g.debouncedRouteQueryAppend(L), await K(z);
const Z = c.context.submitHandler, G = Z.mapFunction ? Z.mapFunction(L) : L;
return new Promise(($e) => {
S.mutateAsync(G).then((Ee) => {
const Et = "api_success_summary", Yt = "api_success_detail";
if (c.context.resetOnSuccess && z.reset(), k && !k.isSuccessNotificationHidden) {
const Gt = k.successMessageSummary ?? Et, Bi = k.successMessageDetail ?? Yt;
u.add({
severity: "success",
summary: v(Gt),
detail: v(Bi),
life: 3e3
});
}
d.callback && d.callback(Ee), i && i.value.close(), $e(null);
}).catch((Ee) => {
console.log("error from the sbmithandler", Ee), A(z, Ee), $e(null);
});
});
}, W = () => ue(
s,
{
type: "form",
id: c.context.formKey,
name: y,
onInput: (L) => {
c.context.syncWithUrl && g.debouncedRouteQueryAppend(L), c.context.invalidateCachesOnChage && a.invalidateQueries({
queryKey: c.context.invalidateCachesOnChage
}), b("input", L), console.log("form updated");
},
value: M,
actions: !1,
findHandler: c.context.findHandler,
syncWithUrl: c.context.syncWithUrl,
usePresist: c.context.usePresist,
onSubmit: V
},
{
default: () => [
ue(o, {
id: c.context.formKey,
data: g.formData,
schema: {
$el: "div",
attrs: {
class: "schema-wrapper"
},
children: C()
}
}),
ue(
"div",
{ class: "custom-form-actions flex gap-2" },
c.context.submitHandler.hideActions ? void 0 : [
ue(tn, {
type: "submit",
class: "grow",
outlined: !0,
label: v("submit"),
severity: "success",
icon: "check-line"
}),
c.context.useClear ? ue(tn, {
action: g.clearForm,
icon: "delete-back-2-line",
severity: "danger",
variant: "outlined",
label: v("clear")
}) : void 0,
c.context.useReset ? ue(tn, {
action: g.resetForm,
variant: "outlined",
severity: "help",
label: v("reset"),
icon: "arrow-go-back-line"
}) : void 0,
c.context.usePresist ? ue(tn, {
action: g.presistForm,
label: "presist"
}) : void 0
]
)
]
}
);
return (L, z) => (D(), ee(Pe(W())));
}
}), Ns = /* @__PURE__ */ be({
__name: "AppForm",
props: {
context: {}
},
emits: ["input"],
setup(t, { emit: e }) {
const n = t, r = e, i = Us(n);
return ar(() => {
i.$dispose();
}), (o, a) => (D(), ee(Sd, null, {
fallback: de(() => a[1] || (a[1] = [
X("div", { class: "loading-indicator" }, [
X("p", null, "Loading form..."),
X("div", { class: "spinner" })
], -1)
])),
default: de(() => [
pe(qf, E({
onInput: a[0] || (a[0] = (s) => r("input", s))
}, n), null, 16)
]),
_: 1
}));
}
}), Kf = {
$formkit: "text",
validation: "required",
name: "email",
placeholder: "email",
label: "email"
}, Wf = {
$formkit: "text",
placeholder: "email",
name: "loginCode",
validation: "email_or_phone",
label: "email"
}, zs = {
$formkit: "password",
name: "userPassword",
validation: "required",
placeholder: "password",
label: "password"
}, Yf = {
...zs,
name: "newPassword",
placeholder: "new_password",
label: "new_password"
}, Gf = {
...zs,
name: "newPasswordConfirmation",
validation: "required|confirm:newPassword",
placeholder: "password_confirm",
label: "password_confirm"
}, Xf = [Wf, zs], Zf = [Kf], Qf = [
Yf,
Gf
], js = (t) => {
t.navigationBar && localStorage.setItem("sidebar", JSON.stringify(t.navigationBar)), t.loginInfo && localStorage.setItem("token", t.loginInfo.accessToken), t.user && localStorage.setItem("user_info", JSON.stringify(t.user));
}, Jf = "/auth/login", k3 = "/auth/reset-password-email", _3 = "logged in", C3 = "email sent", P3 = "password has been reset", em = {
key: 1,
class: "form"
}, tm = "login", nm = "login", O3 = /* @__PURE__ */ be({
__name: "LoginForm",
setup(t) {
const e = je("authHandler"), n = je("apiClient"), r = {
context: {
title: tm,
formKey: nm,
options: {
successMessageSummary: "logged in"
},
submitHandler: {
endpoint: e ? e.login : "",
redirectRoute: (e == null ? void 0 : e.redirectRoute) || "/",
callback: js
},
sections: {
login: {
gridConfig: {
columns: 1
},
inputs: Xf
}
}
}
}, i = async (o) => {
if (!(e != null && e.providerLogin)) return;
const a = {
provider: o,
redirectUrl: e.providerLogin.callbackRoute
}, { url: s } = await qt(
e.providerLogin.endpoint,
n,
a
);
window.open(s, "_blank");
};
return (o, a) => {
const s = Se("Message");
return vt(e) ? (D(), R("div", em, [
pe(Ns, {
context: r.context
}, null, 8, ["context"]),
(D(!0), R(De, null, kt(vt(e).allowedProviders, (l) => (D(), ee(vt(tn), {
class: "glass",
icon: l,
key: l,
action: () => i(l)
}, null, 8, ["icon", "action"]))), 128))
])) : (D(), ee(s, {
key: 0,
severity: "error"
}, {
default: de(() => a[0] || (a[0] = [
Ye(re("provide auth handler"))
])),
_: 1,
__: [0]
}));
};
}
}), rm = {
key: 1,
class: "form"
}, im = "login", om = "login", T3 = /* @__PURE__ */ be({
__name: "ResetPasswordForm",
setup(t) {
var r;
const e = je("authHandler"), n = {
context: {
title: im,
formKey: om,
options: {
successMessageSummary: "logged in"
},
submitHandler: {
mapFunction: (i) => {
const o = window.location.hash;
if (console.log("Extracted Access Token:", o), o) {
const a = o.substring(1), l = new URLSearchParams(a).get("access_token");
return l && console.log("Extracted Access Token:", l), {
...i,
resetToken: l
};
}
return {
...i
};
},
endpoint: e && ((r = e.resetPassword) == null ? void 0 : r.endpoint) || "",
redirectRoute: {
path: (e == null ? void 0 : e.redirectRoute) || "/"
},
callback: js
},
sections: {
login: {
inputs: Qf
}
}
}
};
return (i, o) => {
const a = Se("Message");
return vt(e) ? (D(), R("div", rm, [
pe(Ns, {
context: n.context
}, null, 8, ["context"])
])) : (D(), ee(a, {
key: 0,
severity: "error"
}, {
default: de(() => o[0] || (o[0] = [
Ye(re("provide auth handler"))
])),
_: 1,
__: [0]
}));
};
}
}), am = {
key: 2,
class: "form"
}, sm = "login", lm = "login", x3 = /* @__PURE__ */ be({
__name: "ResetPasswordEmailForm",
setup(t) {
var r;
const e = je("authHandler"), n = {
context: {
title: sm,
formKey: lm,
options: {
successMessageSummary: "logged in"
},
submitHandler: {
endpoint: e && ((r = e.resetPassword) == null ? void 0 : r.emailEndpoint) || "",
redirectRoute: {
path: Jf
}
},
sections: {
login: {
inputs: Zf
}
}
}
};
return (i, o) => {
const a = Se("Message");
return vt(e) ? vt(e).resetPassword ? (D(), R("div", am, [
pe(Ns, {
context: n.context
}, null, 8, ["context"])
])) : (D(), ee(a, {
key: 1,
severity: "error"
}, {
default: de(() => o[1] || (o[1] = [
Ye(re("provide auth handler"))
])),
_: 1,
__: [1]
})) : (D(), ee(a, {
key: 0,
severity: "error"
}, {
default: de(() => o[0] || (o[0] = [
Ye(re("provide auth handler"))
])),
_: 1,
__: [0]
}));
};
}
}), um = { key: 0 }, cm = { key: 1 }, dm = { class: "text-red-600" }, E3 = /* @__PURE__ */ be({
__name: "ProviderLoginCallback",
setup(t) {
const e = je("apiClient"), n = je("authHandler"), { push: r } = kd(), i = te(!0), o = te(null);
return pf(() => {
if (!e || !n || !n.providerLogin) return;
const a = window.location.hash;
if (!a) return;
const s = a.substring(1), l = new URLSearchParams(s), u = l.get("access_token"), c = l.get("refresh_token"), d = l.get("provider_token");
u && (console.log("Extracted Access Token:", u), qt(n.providerLogin.callbackEndpoint, e, {
accessToken: u,
refreshToken: c,
providerToken: d
}).then((p) => {
console.log("Asd", p), js(p), r(n.redirectRoute || "/");
}).catch((p) => {
if (console.log(typeof p), console.log("error", p), !!p) {
if (typeof p == "object" && console.log("error obje is", Vr(p)), typeof p == "string") {
console.log("error is", p);
try {
const f = JSON.parse(p);
f && console.log("erro ibj is", f);
} catch (f) {
console.log("error parsing", f);
}
}
console.error("provider-login callback failed:", p), o.value = "We couldn’t find an account with that email.";
}
}).finally(() => {
i.value = !1;
}));
}), (a, s) => i.value ? (D(), R("h2", um, "logging you in")) : o.value ? (D(), R("div", cm, [
X("h2", dm, re(o.value), 1),
pe(vt(tn), {
action: "/auth/login",
class: "text-blue-600 underline",
label: "Back to login"
})
])) : Q("", !0);
}
});
function Le(...t) {
if (t) {
let e = [];
for (let n = 0; n < t.length; n++) {
const r = t[n];
if (!r)
continue;
const i = typeof r;
if (i === "string" || i === "number")
e.push(r);
else if (i === "object") {
const o = Array.isArray(r) ? [Le(...r)] : Object.entries(r).map(([a, s]) => s ? a : void 0);
e = o.length ? e.concat(o.filter((a) => !!a)) : e;
}
}
return e.join(" ").trim();
}
}
function pm(t, e) {
return t ? t.classList ? t.classList.contains(e) : new RegExp("(^| )" + e + "( |$)", "gi").test(t.className) : !1;
}
function hm(t, e) {
if (t && e) {
const n = (r) => {
pm(t, r) || (t.classList ? t.classList.add(r) : t.className += " " + r);
};
[e].flat().filter(Boolean).forEach((r) => r.split(" ").forEach(n));
}
}
function Lo(t, e) {
if (t && e) {
const n = (r) => {
t.classList ? t.classList.remove(r) : t.className = t.className.replace(new RegExp("(^|\\b)" + r.split(" ").join("|") + "(\\b|$)", "gi"), " ");
};
[e].flat().filter(Boolean).forEach((r) => r.split(" ").forEach(n));
}
}
function vo(t) {
for (const e of document == null ? void 0 : document.styleSheets)
try {
for (const n of e == null ? void 0 : e.cssRules)
for (const r of n == null ? void 0 : n.style)
if (t.test(r))
return { name: r, value: n.style.getPropertyValue(r).trim() };
} catch {
}
return null;
}
function Pd(t) {
const e = { width: 0, height: 0 };
return t && (t.style.visibility = "hidden", t.style.display = "block", e.width = t.offsetWidth, e.height = t.offsetHeight, t.style.display = "none", t.style.visibility = "visible"), e;
}
function Od() {
const t = window, e = document, n = e.documentElement, r = e.getElementsByTagName("body")[0], i = t.innerWidth || n.clientWidth || r.clientWidth, o = t.innerHeight || n.clientHeight || r.clientHeight;
return { width: i, height: o };
}
function qa(t) {
return t ? Math.abs(t.scrollLeft) : 0;
}
function fm() {
const t = document.documentElement;
return (window.pageXOffset || qa(t)) - (t.clientLeft || 0);
}
function mm() {
const t = document.documentElement;
return (window.pageYOffset || t.scrollTop) - (t.clientTop || 0);
}
function gm(t) {
return t ? getComputedStyle(t).direction === "rtl" : !1;
}
function Td(t, e, n = !0) {
var r, i, o, a;
if (t) {
const s = t.offsetParent ? { width: t.offsetWidth, height: t.offsetHeight } : Pd(t), l = s.height, u = s.width, c = e.offsetHeight, d = e.offsetWidth, p = e.getBoundingClientRect(), f = mm(), m = fm(), k = Od();
let y, O, g = "top";
p.top + c + l > k.height ? (y = p.top + f - l, g = "bottom", y < 0 && (y = f)) : y = c + p.top + f, p.left + u > k.width ? O = Math.max(0, p.left + m + d - u) : O = p.left + m, gm(t) ? t.style.insetInlineEnd = O + "px" : t.style.insetInlineStart = O + "px", t.style.top = y + "px", t.style.transformOrigin = g, n && (t.style.marginTop = g === "bottom" ? `calc(${(i = (r = vo(/-anchor-gutter$/)) == null ? void 0 : r.value) != null ? i : "2px"} * -1)` : (a = (o = vo(/-anchor-gutter$/)) == null ? void 0 : o.value) != null ? a : "");
}
}
function xd(t, e) {
t && (typeof e == "string" ? t.style.cssText = e : Object.entries(e || {}).forEach(([n, r]) => t.style[n] = r));
}
function Xr(t, e) {
return t instanceof HTMLElement ? t.offsetWidth : 0;
}
function Ed(t, e, n = !0) {
var r, i, o, a;
if (t) {
const s = t.offsetParent ? { width: t.offsetWidth, height: t.offsetHeight } : Pd(t), l = e.offsetHeight, u = e.getBoundingClientRect(), c = Od();
let d, p, f = "top";
u.top + l + s.height > c.height ? (d = -1 * s.height, f = "bottom", u.top + d < 0 && (d = -1 * u.top)) : d = l, s.width > c.width ? p = u.left * -1 : u.left + s.width > c.width ? p = (u.left + s.width - c.width) * -1 : p = 0, t.style.top = d + "px", t.style.insetInlineStart = p + "px", t.style.transformOrigin = f, n && (t.style.marginTop = f === "bottom" ? `calc(${(i = (r = vo(/-anchor-gutter$/)) == null ? void 0 : r.value) != null ? i : "2px"} * -1)` : (a = (o = vo(/-anchor-gutter$/)) == null ? void 0 : o.value) != null ? a : "");
}
}
function Vs(t) {
if (t) {
let e = t.parentNode;
return e && e instanceof ShadowRoot && e.host && (e = e.host), e;
}
return null;
}
function vm(t) {
return !!(t !== null && typeof t < "u" && t.nodeName && Vs(t));
}
function sr(t) {
return typeof Element < "u" ? t instanceof Element : t !== null && typeof t == "object" && t.nodeType === 1 && typeof t.nodeName == "string";
}
function yo(t, e = {}) {
if (sr(t)) {
const n = (r, i) => {
var o, a;
const s = (o = t == null ? void 0 : t.$attrs) != null && o[r] ? [(a = t == null ? void 0 : t.$attrs) == null ? void 0 : a[r]] : [];
return [i].flat().reduce((l, u) => {
if (u != null) {
const c = typeof u;
if (c === "string" || c === "number")
l.push(u);
else if (c === "object") {
const d = Array.isArray(u) ? n(r, u) : Object.entries(u).map(([p, f]) => r === "style" && (f || f === 0) ? `${p.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()}:${f}` : f ? p : void 0);
l = d.length ? l.concat(d.filter((p) => !!p)) : l;
}
}
return l;
}, s);
};
Object.entries(e).forEach(([r, i]) => {
if (i != null) {
const o = r.match(/^on(.+)/);
o ? t.addEventListener(o[1].toLowerCase(), i) : r === "p-bind" || r === "pBind" ? yo(t, i) : (i = r === "class" ? [...new Set(n("class", i))].join(" ").trim() : r === "style" ? n("style", i).join(";").trim() : i, (t.$attrs = t.$attrs || {}) && (t.$attrs[r] = i), t.setAttribute(r, i));
}
});
}
}
function ym(t, e = {}, ...n) {
{
const r = document.createElement(t);
return yo(r, e), r.append(...n), r;
}
}
function Jt(t, e) {
return sr(t) ? Array.from(t.querySelectorAll(e)) : [];
}
function Qe(t, e) {
return sr(t) ? t.matches(e) ? t : t.querySelector(e) : null;
}
function Zt(t, e) {
t && document.activeElement !== t && t.focus(e);
}
function Sn(t, e) {
if (sr(t)) {
const n = t.getAttribute(e);
return isNaN(n) ? n === "true" || n === "false" ? n === "true" : n : +n;
}
}
function oi(t, e = "") {
const n = Jt(
t,
`button:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${e},
[href][clientHeight][clientWidth]:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${e},
input:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${e},
select:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${e},
textarea:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${e},
[tabIndex]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${e},
[contenteditable]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${e}`
), r = [];
for (const i of n)
getComputedStyle(i).display != "none" && getComputedStyle(i).visibility != "hidden" && r.push(i);
return r;
}
function bm(t, e) {
const n = oi(t, e);
return n.length > 0 ? n[0] : null;
}
function _n(t) {
if (t) {
let e = t.offsetHeight;
const n = getComputedStyle(t);
return e -= parseFloat(n.paddingTop) + parseFloat(n.paddingBottom) + parseFloat(n.borderTopWidth) + parseFloat(n.borderBottomWidth), e;
}
return 0;
}
function fr(t) {
var e;
if (t) {
const n = (e = Vs(t)) == null ? void 0 : e.childNodes;
let r = 0;
if (n)
for (let i = 0; i < n.length; i++) {
if (n[i] === t) return r;
n[i].nodeType === 1 && r++;
}
}
return -1;
}
function wm(t, e) {
const n = oi(t, e);
return n.length > 0 ? n[n.length - 1] : null;
}
function Sm(t) {
if (t) {
const e = t.getBoundingClientRect();
return {
top: e.top + (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0),
left: e.left + (window.pageXOffset || qa(document.documentElement) || qa(document.body) || 0)
};
}
return {
top: "auto",
left: "auto"
};
}
function km(t, e) {
return t ? t.offsetHeight : 0;
}
function Fd(t, e = []) {
const n = Vs(t);
return n === null ? e : Fd(n, e.concat([n]));
}
function _m(t) {
const e = [];
if (t) {
const n = Fd(t), r = /(auto|scroll)/, i = (o) => {
try {
const a = window.getComputedStyle(o, null);
return r.test(a.getPropertyValue("overflow")) || r.test(a.getPropertyValue("overflowX")) || r.test(a.getPropertyValue("overflowY"));
} catch {
return !1;
}
};
for (const o of n) {
const a = o.nodeType === 1 && o.dataset.scrollselectors;
if (a) {
const s = a.split(",");
for (const l of s) {
const u = Qe(o, l);
u && i(u) && e.push(u);
}
}
o.nodeType !== 9 && i(o) && e.push(o);
}
}
return e;
}
function Cn(t) {
if (t) {
let e = t.offsetWidth;
const n = getComputedStyle(t);
return e -= parseFloat(n.paddingLeft) + parseFloat(n.paddingRight) + parseFloat(n.borderLeftWidth) + parseFloat(n.borderRightWidth), e;
}
return 0;
}
function Cm() {
return /(android)/i.test(navigator.userAgent);
}
function Id() {
return !!(typeof window < "u" && window.document && window.document.createElement);
}
function bo(t) {
return !!(t && t.offsetParent != null);
}
function Dd() {
return "ontouchstart" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
}
function Md(t, e = "", n) {
sr(t) && n !== null && n !== void 0 && t.setAttribute(e, n);
}
function Hs() {
const t = /* @__PURE__ */ new Map();
return {
on(e, n) {
let r = t.get(e);
return r ? r.push(n) : r = [n], t.set(e, r), this;
},
off(e, n) {
const r = t.get(e);
return r && r.splice(r.indexOf(n) >>> 0, 1), this;
},
emit(e, n) {
const r = t.get(e);
r && r.forEach((i) => {
i(n);
});
},
clear() {
t.clear();
}
};
}
function lr(t) {
return t == null || t === "" || Array.isArray(t) && t.length === 0 || !(t instanceof Date) && typeof t == "object" && Object.keys(t).length === 0;
}
function Ka(t, e, n = /* @__PURE__ */ new WeakSet()) {
if (t === e) return !0;
if (!t || !e || typeof t != "object" || typeof e != "object" || n.has(t) || n.has(e)) return !1;
n.add(t).add(e);
const r = Array.isArray(t), i = Array.isArray(e);
let o, a, s;
if (r && i) {
if (a = t.length, a != e.length) return !1;
for (o = a; o-- !== 0; ) if (!Ka(t[o], e[o], n)) return !1;
return !0;
}
if (r != i) return !1;
const l = t instanceof Date, u = e instanceof Date;
if (l != u) return !1;
if (l && u) return t.getTime() == e.getTime();
const c = t instanceof RegExp, d = e instanceof RegExp;
if (c != d) return !1;
if (c && d) return t.toString() == e.toString();
const p = Object.keys(t);
if (a = p.length, a !== Object.keys(e).length) return !1;
for (o = a; o-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(e, p[o])) return !1;
for (o = a; o-- !== 0; )
if (s = p[o], !Ka(t[s], e[s], n)) return !1;
return !0;
}
function Pm(t, e) {
return Ka(t, e);
}
function Io(t) {
return typeof t == "function" && "call" in t && "apply" in t;
}
function ae(t) {
return !lr(t);
}
function Bt(t, e) {
if (!t || !e)
return null;
try {
const n = t[e];
if (ae(n)) return n;
} catch {
}
if (Object.keys(t).length) {
if (Io(e))
return e(t);
if (e.indexOf(".") === -1)
return t[e];
{
const n = e.split(".");
let r = t;
for (let i = 0, o = n.length; i < o; ++i) {
if (r == null)
return null;
r = r[n[i]];
}
return r;
}
}
return null;
}
function Ad(t, e, n) {
return n ? Bt(t, n) === Bt(e, n) : Pm(t, e);
}
function Dn(t, e = !0) {
return t instanceof Object && t.constructor === Object && (e || Object.keys(t).length !== 0);
}
function Tl(t, e) {
let n = -1;
if (ae(t))
try {
n = t.findLastIndex(e);
} catch {
n = t.lastIndexOf([...t].reverse().find(e));
}
return n;
}
function tt(t, ...e) {
return Io(t) ? t(...e) : t;
}
function rt(t, e = !0) {
return typeof t == "string" && (e || t !== "");
}
function _t(t) {
return rt(t) ? t.replace(/(-|_)/g, "").toLowerCase() : t;
}
function qs(t, e = "", n = {}) {
const r = _t(e).split("."), i = r.shift();
if (i) {
if (Dn(t)) {
const o = Object.keys(t).find((a) => _t(a) === i) || "";
return qs(tt(t[o], n), r.join("."), n);
}
return;
}
return tt(t, n);
}
function $d(t, e = !0) {
return Array.isArray(t) && (e || t.length !== 0);
}
function Om(t) {
return ae(t) && !isNaN(t);
}
function Tm(t = "") {
return ae(t) && t.length === 1 && !!t.match(/\S| /);
}
function xm() {
return new Intl.Collator(void 0, { numeric: !0 }).compare;
}
function Xn(t, e) {
if (e) {
const n = e.test(t);
return e.lastIndex = 0, n;
}
return !1;
}
function Zr(t) {
return t && t.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g, "").replace(/ {2,}/g, " ").replace(/ ([{:}]) /g, "$1").replace(/([;,]) /g, "$1").replace(/ !/g, "!").replace(/: /g, ":").trim();
}
function it(t) {
if (t && /[\xC0-\xFF\u0100-\u017E]/.test(t)) {
const n = {
A: /[\xC0-\xC5\u0100\u0102\u0104]/g,
AE: /[\xC6]/g,
C: /[\xC7\u0106\u0108\u010A\u010C]/g,
D: /[\xD0\u010E\u0110]/g,
E: /[\xC8-\xCB\u0112\u0114\u0116\u0118\u011A]/g,
G: /[\u011C\u011E\u0120\u0122]/g,
H: /[\u0124\u0126]/g,
I: /[\xCC-\xCF\u0128\u012A\u012C\u012E\u0130]/g,
IJ: /[\u0132]/g,
J: /[\u0134]/g,
K: /[\u0136]/g,
L: /[\u0139\u013B\u013D\u013F\u0141]/g,
N: /[\xD1\u0143\u0145\u0147\u014A]/g,
O: /[\xD2-\xD6\xD8\u014C\u014E\u0150]/g,
OE: /[\u0152]/g,
R: /[\u0154\u0156\u0158]/g,
S: /[\u015A\u015C\u015E\u0160]/g,
T: /[\u0162\u0164\u0166]/g,
U: /[\xD9-\xDC\u0168\u016A\u016C\u016E\u0170\u0172]/g,
W: /[\u0174]/g,
Y: /[\xDD\u0176\u0178]/g,
Z: /[\u0179\u017B\u017D]/g,
a: /[\xE0-\xE5\u0101\u0103\u0105]/g,
ae: /[\xE6]/g,
c: /[\xE7\u0107\u0109\u010B\u010D]/g,
d: /[\u010F\u0111]/g,
e: /[\xE8-\xEB\u0113\u0115\u0117\u0119\u011B]/g,
g: /[\u011D\u011F\u0121\u0123]/g,
i: /[\xEC-\xEF\u0129\u012B\u012D\u012F\u0131]/g,
ij: /[\u0133]/g,
j: /[\u0135]/g,
k: /[\u0137,\u0138]/g,
l: /[\u013A\u013C\u013E\u0140\u0142]/g,
n: /[\xF1\u0144\u0146\u0148\u014B]/g,
p: /[\xFE]/g,
o: /[\xF2-\xF6\xF8\u014D\u014F\u0151]/g,
oe: /[\u0153]/g,
r: /[\u0155\u0157\u0159]/g,
s: /[\u015B\u015D\u015F\u0161]/g,
t: /[\u0163\u0165\u0167]/g,
u: /[\xF9-\xFC\u0169\u016B\u016D\u016F\u0171\u0173]/g,
w: /[\u0175]/g,
y: /[\xFD\xFF\u0177]/g,
z: /[\u017A\u017C\u017E]/g
};
for (const r in n)
t = t.replace(n[r], r);
}
return t;
}
function Em(t) {
return rt(t, !1) ? t[0].toUpperCase() + t.slice(1) : t;
}
function Ld(t) {
return rt(t) ? t.replace(/(_)/g, "-").replace(/[A-Z]/g, (e, n) => n === 0 ? e : "-" + e.toLowerCase()).toLowerCase() : t;
}
var ji = {};
function Fm(t = "pui_id_") {
return Object.hasOwn(ji, t) || (ji[t] = 0), ji[t]++, `${t}${ji[t]}`;
}
function Im() {
let t = [];
const e = (a, s, l = 999) => {
const u = i(a, s, l), c = u.value + (u.key === a ? 0 : l) + 1;
return t.push({ key: a, value: c }), c;
}, n = (a) => {
t = t.filter((s) => s.value !== a);
}, r = (a, s) => i(a).value, i = (a, s, l = 0) => [...t].reverse().find((u) => !0) || { key: a, value: l }, o = (a) => a && parseInt(a.style.zIndex, 10) || 0;
return {
get: o,
set: (a, s, l) => {
s && (s.style.zIndex = String(e(a, !0, l)));
},
clear: (a) => {
a && (n(o(a)), a.style.zIndex = "");
},
getCurrent: (a) => r(a)
};
}
var Zn = Im();
function ai(t) {
"@babel/helpers - typeof";
return ai = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
return typeof e;
} : function(e) {
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
}, ai(t);
}
function Dm(t, e) {
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
}
function Mm(t, e) {
for (var n = 0; n < e.length; n++) {
var r = e[n];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, $m(r.key), r);
}
}
function Am(t, e, n) {
return e && Mm(t.prototype, e), Object.defineProperty(t, "prototype", { writable: !1 }), t;
}
function $m(t) {
var e = Lm(t, "string");
return ai(e) == "symbol" ? e : e + "";
}
function Lm(t, e) {
if (ai(t) != "object" || !t) return t;
var n = t[Symbol.toPrimitive];
if (n !== void 0) {
var r = n.call(t, e);
if (ai(r) != "object") return r;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(t);
}
var Rd = /* @__PURE__ */ function() {
function t(e) {
var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : function() {
};
Dm(this, t), this.element = e, this.listener = n;
}
return Am(t, [{
key: "bindScrollListener",
value: function() {
this.scrollableParents = _m(this.element);
for (var n = 0; n < this.scrollableParents.length; n++)
this.scrollableParents[n].addEventListener("scroll", this.listener);
}
}, {
key: "unbindScrollListener",
value: function() {
if (this.scrollableParents)
for (var n = 0; n < this.scrollableParents.length; n++)
this.scrollableParents[n].removeEventListener("scroll", this.listener);
}
}, {
key: "destroy",
value: function() {
this.unbindScrollListener(), this.element = null, this.listener = null, this.scrollableParents = null;
}
}]);
}(), Rm = Object.defineProperty, Bm = Object.defineProperties, Um = Object.getOwnPropertyDescriptors, wo = Object.getOwnPropertySymbols, Bd = Object.prototype.hasOwnProperty, Ud = Object.prototype.propertyIsEnumerable, xl = (t, e, n) => e in t ? Rm(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, ht = (t, e) => {
for (var n in e || (e = {}))
Bd.call(e, n) && xl(t, n, e[n]);
if (wo)
for (var n of wo(e))
Ud.call(e, n) && xl(t, n, e[n]);
return t;
}, Ro = (t, e) => Bm(t, Um(e)), Ft = (t, e) => {
var n = {};
for (var r in t)
Bd.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
if (t != null && wo)
for (var r of wo(t))
e.indexOf(r) < 0 && Ud.call(t, r) && (n[r] = t[r]);
return n;
}, Nm = Hs(), Ne = Nm, Wa = /{([^}]*)}/g, zm = /(\d+\s+[\+\-\*\/]\s+\d+)/g, jm = /var\([^)]+\)/g;
function Vm(t) {
return Dn(t) && t.hasOwnProperty("$value") && t.hasOwnProperty("$type") ? t.$value : t;
}
function Hm(t) {
return t.replaceAll(/ /g, "").replace(/[^\w]/g, "-");
}
function Ya(t = "", e = "") {
return Hm(`${rt(t, !1) && rt(e, !1) ? `${t}-` : t}${e}`);
}
function Nd(t = "", e = "") {
return `--${Ya(t, e)}`;
}
function qm(t = "") {
const e = (t.match(/{/g) || []).length, n = (t.match(/}/g) || []).length;
return (e + n) % 2 !== 0;
}
function zd(t, e = "", n = "", r = [], i) {
if (rt(t)) {
const o = t.trim();
if (qm(o))
return;
if (Xn(o, Wa)) {
const a = o.replaceAll(Wa, (s) => {
const u = s.replace(/{|}/g, "").split(".").filter((c) => !r.some((d) => Xn(c, d)));
return `var(${Nd(n, Ld(u.join("-")))}${ae(i) ? `, ${i}` : ""})`;
});
return Xn(a.replace(jm, "0"), zm) ? `calc(${a})` : a;
}
return o;
} else if (Om(t))
return t;
}
function Km(t, e, n) {
rt(e, !1) && t.push(`${e}:${n};`);
}
function jn(t, e) {
return t ? `${t}{${e}}` : "";
}
function jd(t, e) {
if (t.indexOf("dt(") === -1) return t;
function n(a, s) {
const l = [];
let u = 0, c = "", d = null, p = 0;
for (; u <= a.length; ) {
const f = a[u];
if ((f === '"' || f === "'" || f === "`") && a[u - 1] !== "\\" && (d = d === f ? null : f), !d && (f === "(" && p++, f === ")" && p--, (f === "," || u === a.length) && p === 0)) {
const m = c.trim();
m.startsWith("dt(") ? l.push(jd(m, s)) : l.push(r(m)), c = "", u++;
continue;
}
f !== void 0 && (c += f), u++;
}
return l;
}
function r(a) {
const s = a[0];
if ((s === '"' || s === "'" || s === "`") && a[a.length - 1] === s)
return a.slice(1, -1);
const l = Number(a);
return isNaN(l) ? a : l;
}
const i = [], o = [];
for (let a = 0; a < t.length; a++)
if (t[a] === "d" && t.slice(a, a + 3) === "dt(")
o.push(a), a += 2;
else if (t[a] === ")" && o.length > 0) {
const s = o.pop();
o.length === 0 && i.push([s, a]);
}
if (!i.length) return t;
for (let a = i.length - 1; a >= 0; a--) {
const [s, l] = i[a], u = t.slice(s + 3, l), c = n(u, e), d = e(...c);
t = t.slice(0, s) + d + t.slice(l + 1);
}
return t;
}
var In = (...t) => Wm(fe.getTheme(), ...t), Wm = (t = {}, e, n, r) => {
if (e) {
const { variable: i, options: o } = fe.defaults || {}, { prefix: a, transform: s } = (t == null ? void 0 : t.options) || o || {}, l = Xn(e, Wa) ? e : `{${e}}`;
return r === "value" || lr(r) && s === "strict" ? fe.getTokenValue(e) : zd(l, void 0, a, [i.excludedKeyRegex], n);
}
return "";
};
function Vi(t, ...e) {
if (t instanceof Array) {
const n = t.reduce((r, i, o) => {
var a;
return r + i + ((a = tt(e[o], { dt: In })) != null ? a : "");
}, "");
return jd(n, In);
}
return tt(t, { dt: In });
}
function Ym(t, e = {}) {
const n = fe.defaults.variable, { prefix: r = n.prefix, selector: i = n.selector, excludedKeyRegex: o = n.excludedKeyRegex } = e, a = [], s = [], l = [{ node: t, path: r }];
for (; l.length; ) {
const { node: c, path: d } = l.pop();
for (const p in c) {
const f = c[p], m = Vm(f), y = Xn(p, o) ? Ya(d) : Ya(d, Ld(p));
if (Dn(m))
l.push({ node: m, path: y });
else {
const O = Nd(y), g = zd(m, y, r, [o]);
Km(s, O, g);
let b = y;
r && b.startsWith(r + "-") && (b = b.slice(r.length + 1)), a.push(b.replace(/-/g, "."));
}
}
}
const u = s.join("");
return {
value: s,
tokens: a,
declarations: u,
css: jn(i, u)
};
}
var lt = {
regex: {
rules: {
class: {
pattern: /^\.([a-zA-Z][\w-]*)$/,
resolve(t) {
return { type: "class", selector: t, matched: this.pattern.test(t.trim()) };
}
},
attr: {
pattern: /^\[(.*)\]$/,
resolve(t) {
return { type: "attr", selector: `:root${t}`, matched: this.pattern.test(t.trim()) };
}
},
media: {
pattern: /^@media (.*)$/,
resolve(t) {
return { type: "media", selector: `${t}{:root{[CSS]}}`, matched: this.pattern.test(t.trim()) };
}
},
system: {
pattern: /^system$/,
resolve(t) {
return { type: "system", selector: "@media (prefers-color-scheme: dark){:root{[CSS]}}", matched: this.pattern.test(t.trim()) };
}
},
custom: {
resolve(t) {
return { type: "custom", selector: t, matched: !0 };
}
}
},
resolve(t) {
const e = Object.keys(this.rules).filter((n) => n !== "custom").map((n) => this.rules[n]);
return [t].flat().map((n) => {
var r;
return (r = e.map((i) => i.resolve(n)).find((i) => i.matched)) != null ? r : this.rules.custom.resolve(n);
});
}
},
_toVariables(t, e) {
return Ym(t, { prefix: e == null ? void 0 : e.prefix });
},
getCommon({ name: t = "", theme: e = {}, params: n, set: r, defaults: i }) {
var o, a, s, l, u, c, d;
const { preset: p, options: f } = e;
let m, k, y, O, g, b, v;
if (ae(p) && f.transform !== "strict") {
const { primitive: P, semantic: _, extend: T } = p, x = _ || {}, { colorScheme: I } = x, U = Ft(x, ["colorScheme"]), N = T || {}, { colorScheme: j } = N, M = Ft(N, ["colorScheme"]), q = I || {}, { dark: K } = q, S = Ft(q, ["dark"]), w = j || {}, { dark: C } = w, F = Ft(w, ["dark"]), $ = ae(P) ? this._toVariables({ primitive: P }, f) : {}, A = ae(U) ? this._toVariables({ semantic: U }, f) : {}, V = ae(S) ? this._toVariables({ light: S }, f) : {}, W = ae(K) ? this._toVariables({ dark: K }, f) : {}, L = ae(M) ? this._toVariables({ semantic: M }, f) : {}, z = ae(F) ? this._toVariables({ light: F }, f) : {}, Z = ae(C) ? this._toVariables({ dark: C }, f) : {}, [G, $e] = [(o = $.declarations) != null ? o : "", $.tokens], [Ee, Et] = [(a = A.declarations) != null ? a : "", A.tokens || []], [Yt, Gt] = [(s = V.declarations) != null ? s : "", V.tokens || []], [Bi, cn] = [(l = W.declarations) != null ? l : "", W.tokens || []], [Ui, Ni] = [(u = L.declarations) != null ? u : "", L.tokens || []], [Xt, hr] = [(c = z.declarations) != null ? c : "", z.tokens || []], [dn, of] = [(d = Z.declarations) != null ? d : "", Z.tokens || []];
m = this.transformCSS(t, G, "light", "variable", f, r, i), k = $e;
const af = this.transformCSS(t, `${Ee}${Yt}`, "light", "variable", f, r, i), sf = this.transformCSS(t, `${Bi}`, "dark", "variable", f, r, i);
y = `${af}${sf}`, O = [.../* @__PURE__ */ new Set([...Et, ...Gt, ...cn])];
const lf = this.transformCSS(t, `${Ui}${Xt}color-scheme:light`, "light", "variable", f, r, i), uf = this.transformCSS(t, `${dn}color-scheme:dark`, "dark", "variable", f, r, i);
g = `${lf}${uf}`, b = [.../* @__PURE__ */ new Set([...Ni, ...hr, ...of])], v = tt(p.css, { dt: In });
}
return {
primitive: {
css: m,
tokens: k
},
semantic: {
css: y,
tokens: O
},
global: {
css: g,
tokens: b
},
style: v
};
},
getPreset({ name: t = "", preset: e = {}, options: n, params: r, set: i, defaults: o, selector: a }) {
var s, l, u;
let c, d, p;
if (ae(e) && n.transform !== "strict") {
const f = t.replace("-directive", ""), m = e, { colorScheme: k, extend: y, css: O } = m, g = Ft(m, ["colorScheme", "extend", "css"]), b = y || {}, { colorScheme: v } = b, P = Ft(b, ["colorScheme"]), _ = k || {}, { dark: T } = _, x = Ft(_, ["dark"]), I = v || {}, { dark: U } = I, N = Ft(I, ["dark"]), j = ae(g) ? this._toVariables({ [f]: ht(ht({}, g), P) }, n) : {}, M = ae(x) ? this._toVariables({ [f]: ht(ht({}, x), N) }, n) : {}, q = ae(T) ? this._toVariables({ [f]: ht(ht({}, T), U) }, n) : {}, [K, S] = [(s = j.declarations) != null ? s : "", j.tokens || []], [w, C] = [(l = M.declarations) != null ? l : "", M.tokens || []], [F, $] = [(u = q.declarations) != null ? u : "", q.tokens || []], A = this.transformCSS(f, `${K}${w}`, "light", "variable", n, i, o, a), V = this.transformCSS(f, F, "dark", "variable", n, i, o, a);
c = `${A}${V}`, d = [.../* @__PURE__ */ new Set([...S, ...C, ...$])], p = tt(O, { dt: In });
}
return {
css: c,
tokens: d,
style: p
};
},
getPresetC({ name: t = "", theme: e = {}, params: n, set: r, defaults: i }) {
var o;
const { preset: a, options: s } = e, l = (o = a == null ? void 0 : a.components) == null ? void 0 : o[t];
return this.getPreset({ name: t, preset: l, options: s, params: n, set: r, defaults: i });
},
// @deprecated - use getPresetC instead
getPresetD({ name: t = "", theme: e = {}, params: n, set: r, defaults: i }) {
var o, a;
const s = t.replace("-directive", ""), { preset: l, options: u } = e, c = ((o = l == null ? void 0 : l.components) == null ? void 0 : o[s]) || ((a = l == null ? void 0 : l.directives) == null ? void 0 : a[s]);
return this.getPreset({ name: s, preset: c, options: u, params: n, set: r, defaults: i });
},
applyDarkColorScheme(t) {
return !(t.darkModeSelector === "none" || t.darkModeSelector === !1);
},
getColorSchemeOption(t, e) {
var n;
return this.applyDarkColorScheme(t) ? this.regex.resolve(t.darkModeSelector === !0 ? e.options.darkModeSelector : (n = t.darkModeSelector) != null ? n : e.options.darkModeSelector) : [];
},
getLayerOrder(t, e = {}, n, r) {
const { cssLayer: i } = e;
return i ? `@layer ${tt(i.order || "primeui", n)}` : "";
},
getCommonStyleSheet({ name: t = "", theme: e = {}, params: n, props: r = {}, set: i, defaults: o }) {
const a = this.getCommon({ name: t, theme: e, params: n, set: i, defaults: o }), s = Object.entries(r).reduce((l, [u, c]) => l.push(`${u}="${c}"`) && l, []).join(" ");
return Object.entries(a || {}).reduce((l, [u, c]) => {
if (Dn(c) && Object.hasOwn(c, "css")) {
const d = Zr(c.css), p = `${u}-variables`;
l.push(`<style type="text/css" data-primevue-style-id="${p}" ${s}>${d}</style>`);
}
return l;
}, []).join("");
},
getStyleSheet({ name: t = "", theme: e = {}, params: n, props: r = {}, set: i, defaults: o }) {
var a;
const s = { name: t, theme: e, params: n, set: i, defaults: o }, l = (a = t.includes("-directive") ? this.getPresetD(s) : this.getPresetC(s)) == null ? void 0 : a.css, u = Object.entries(r).reduce((c, [d, p]) => c.push(`${d}="${p}"`) && c, []).join(" ");
return l ? `<style type="text/css" data-primevue-style-id="${t}-variables" ${u}>${Zr(l)}</style>` : "";
},
createTokens(t = {}, e, n = "", r = "", i = {}) {
return {};
},
getTokenValue(t, e, n) {
var r;
const o = ((l) => l.split(".").filter((c) => !Xn(c.toLowerCase(), n.variable.excludedKeyRegex)).join("."))(e), a = e.includes("colorScheme.light") ? "light" : e.includes("colorScheme.dark") ? "dark" : void 0, s = [(r = t[o]) == null ? void 0 : r.comp