Your Name 1912bcd25b
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
chore: sync all remaining local workspace changes
2026-05-08 11:26:57 +08:00

288 lines
9.3 KiB
JavaScript

/*
* Extracted from browser-delivered Turbopack chunk: ab2e1927315c9199.b865cfe6f4.js
* Module id: 269655
* For reading/searching only; this factory depends on the original Turbopack runtime.
*/
const moduleFactory = (e) => {
"use strict";
let t, r, n;
var i,
o = e.i(462214),
a = e.i(883787),
l = e.i(646283);
let [u, c] =
((i = "mantine-modals"),
[
function (e) {
let t = Object.keys(e).reduce(
(t, r) => ((t[`${i}:${r}`] = (t) => e[r](t.detail)), t),
{},
);
(0, a.useIsomorphicEffect)(
() => (
Object.keys(t).forEach((e) => {
window.removeEventListener(e, t[e]),
window.addEventListener(e, t[e]);
}),
() =>
Object.keys(t).forEach((e) => {
window.removeEventListener(e, t[e]);
})
),
[t],
);
},
function (e) {
return (...t) => {
var r, n;
return (
(r = `${i}:${String(e)}`),
(n = t[0]),
void window.dispatchEvent(new CustomEvent(r, { detail: n }))
);
};
},
]),
s = {
open: (e) => {
let t = e.modalId || (0, l.randomId)();
return c("openModal")({ ...e, modalId: t }), t;
},
close: c("closeModal"),
closeAll: c("closeAllModals"),
openConfirmModal: (e) => {
let t = e.modalId || (0, l.randomId)();
return c("openConfirmModal")({ ...e, modalId: t }), t;
},
openContextModal: (e) => {
let t = e.modalId || (0, l.randomId)();
return c("openContextModal")({ ...e, modalId: t }), t;
},
updateModal: (e) => c("updateModal")(e),
updateContextModal: (e) => c("updateContextModal")(e),
};
e.s(["modals", () => s, "useModalsEvents", () => u], 19803);
let f = "mantine-default";
function d(e) {
f = e;
}
e.s(
[
"confirmModal",
0,
(e, t) => {
var r, n, i, a;
return "liblibtv" === f
? ((r = e),
(n = t),
new Promise((e, t) => {
let i = !1,
a = (e) => {
i || ((i = !0), e());
},
l = s.open({
centered: !0,
size: "auto",
withCloseButton: !1,
closeOnClickOutside: !1,
padding: 0,
onClose: () => a(() => t()),
styles: {
content: {
backgroundColor: "transparent",
boxShadow: "none",
},
body: { padding: 0 },
overlay: { zIndex: "var(--z-toast, 700)" },
inner: { zIndex: "calc(var(--z-toast, 700) + 1)" },
},
children: (0, o.jsxs)("div", {
className:
"border-border-default text-fg-default w-[344px] rounded-xl border p-4 backdrop-blur-lg",
style: {
backgroundColor: "var(--bg-surface, #fff)",
boxShadow:
"0px 4px 10px rgba(0,0,0,0.12), 0px 2px 4px rgba(0,0,0,0.2)",
},
children: [
(0, o.jsxs)("div", {
className: "flex flex-col gap-3",
children: [
r
? (0, o.jsx)("p", {
className:
"text-fg-default text-sm font-bold",
children: r,
})
: null,
null != n && "" !== n
? (0, o.jsx)("div", {
className: "text-fg-muted text-[13px]",
children: n,
})
: null,
],
}),
(0, o.jsxs)("div", {
className: "mt-4 flex items-center justify-end gap-3",
children: [
(0, o.jsx)("button", {
type: "button",
className:
"text-fg-default h-8 cursor-pointer rounded-lg px-3 text-[13px] transition-colors",
style: {
backgroundColor:
"color-mix(in srgb, var(--fg-default) 8%, transparent)",
},
onMouseEnter: (e) => {
e.currentTarget.style.backgroundColor =
"color-mix(in srgb, var(--fg-default) 14%, transparent)";
},
onMouseLeave: (e) => {
e.currentTarget.style.backgroundColor =
"color-mix(in srgb, var(--fg-default) 8%, transparent)";
},
onClick: () => {
s.close(l), a(() => t());
},
children: "取消",
}),
(0, o.jsx)("button", {
type: "button",
className:
"bg-btn-primary hover:bg-btn-primary-hover active:bg-btn-primary-active text-btn-primary-text flex h-8 cursor-pointer items-center rounded-lg px-3 text-[13px] transition-colors",
onClick: () => {
s.close(l), a(() => e());
},
children: "确定",
}),
],
}),
],
}),
});
}))
: ((i = e),
(a = t),
new Promise((e, t) => {
s.openConfirmModal({
title: i,
centered: !0,
children: a,
labels: { confirm: "确定", cancel: "取消" },
onConfirm: () => e(),
onCancel: () => t(),
});
}));
},
"setConfirmModalVariant",
() => d,
],
27755,
);
var h = e.i(358379);
let v =
((t = {
notifications: [],
queue: [],
defaultPosition: "bottom-right",
limit: 5,
}),
(r = !1),
(n = new Set()),
{
getState: () => t,
updateState(e) {
t = "function" == typeof e ? e(t) : e;
},
setState(e) {
this.updateState(e), n.forEach((e) => e(t));
},
initialize(e) {
r || ((t = e), (r = !0));
},
subscribe: (e) => (n.add(e), () => n.delete(e)),
}),
p = (e = v) =>
(0, h.useSyncExternalStore)(
e.subscribe,
() => e.getState(),
() => e.getState(),
);
function g(e, t) {
let r = e.getState(),
n = (function (e, t, r) {
let n = [],
i = [],
o = {};
for (let a of e) {
let e = a.position || t;
(o[e] = o[e] || 0), (o[e] += 1), o[e] <= r ? i.push(a) : n.push(a);
}
return { notifications: i, queue: n };
})(t([...r.notifications, ...r.queue]), r.defaultPosition, r.limit);
e.setState({
notifications: n.notifications,
queue: n.queue,
limit: r.limit,
defaultPosition: r.defaultPosition,
});
}
function m(e, t = v) {
return (
g(t, (t) => t.filter((t) => t.id !== e || (t.onClose?.(t), !1))), e
);
}
let b = {
show: function (e, t = v) {
let r = e.id || (0, l.randomId)();
return (
g(t, (t) =>
e.id && t.some((t) => t.id === e.id) ? t : [...t, { ...e, id: r }],
),
r
);
},
hide: m,
update: function (e, t = v) {
return (
g(t, (t) => t.map((t) => (t.id === e.id ? { ...t, ...e } : t))), e.id
);
},
clean: function (e = v) {
g(e, () => []);
},
cleanQueue: function (e = v) {
g(e, (t) => t.slice(0, e.getState().limit));
},
updateState: g,
};
e.s(
[
"hideNotification",
() => m,
"notifications",
() => b,
"notificationsStore",
() => v,
"useNotifications",
() => p,
],
70730,
);
e.s(
[
"notifySuccess",
0,
(e, t = "") => {
b.show({ title: e, message: t });
},
],
269655,
),
e.s([], 272253);
};
export default moduleFactory;