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

253 lines
9.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* Extracted from browser-delivered Turbopack chunk: fd0220e4d10052af.701bdafa2d.js
* Module id: 799093
* For reading/searching only; this factory depends on the original Turbopack runtime.
*/
const moduleFactory = (e) => {
"use strict";
var t = e.i(462214),
n = e.i(358379),
i = e.i(41671),
r = e.i(777784),
a = e.i(182004),
o = e.i(41114),
s = e.i(111581),
c = e.i(306677),
l = e.i(439552);
let u = (0, n.memo)(function ({
accept: u,
onUploaded: h,
isReadonly: f,
disabled: d,
onBeforeUpload: p,
nodeId: g,
chromeVariant: b = "default",
visualVariant: m = "default",
buttonClassName: w,
}) {
let v = "canvasLight" === b,
x = "panorama" === m,
{ requestFileUpload: y } = (0, s.useCanvasCallbacks)(),
[_, S] = (0, n.useState)(!1),
E = _ || !!d,
M = (0, n.useCallback)(
(t) => {
S(!0),
g && (0, l.setUploadOverlay)(g, { type: "uploading" }),
(async () => {
let { validateVideoFile: n } = await e.A(645867),
i = await n(t);
if (i) {
g && (0, l.clearUploadOverlay)(g), r.Notify.error(i), S(!1);
return;
}
let { getCookie: o } = await e.A(710867),
{
uploadViaPreSign: s,
resolveUploadUrl: u,
pollMediaAudit: f,
AuditContentType: d,
MediaAuditError: p,
FileReviewError: b,
} = await e.A(33412),
{ USER_TOKEN_COOKIE_KEY: m, USER_UUID_COOKIE_KEY: w } =
await e.A(525723);
try {
let e,
n = o(m),
i = o(w);
if (
!n ||
"string" != typeof n ||
!i ||
"string" != typeof i
) {
g && (0, l.clearUploadOverlay)(g),
r.Notify.error("请先登录");
return;
}
let p = t.type.startsWith("video/"),
b = p || t.type.startsWith("audio/"),
{ nodeType: v } = (0, a.getMediaType)(t.type),
x = await s(t, {
token: n,
uuid: i,
verify: !b,
onCalcHashEnd: (t) => {
e = t;
},
onProgress: g
? (e) =>
(0, l.setUploadOverlay)(g, {
type: "uploading",
progress: e,
})
: void 0,
}),
y = u(x);
if (!y) {
g && (0, l.clearUploadOverlay)(g);
return;
}
b && (await f(y, p ? d.VIDEO : d.AUDIO)),
h({
cdnUrl: y,
resourceMeta: (0, c.buildUploadedResourceMeta)(t, v, {
hashSha1: e,
}),
}),
g && (0, l.setUploadOverlay)(g, { type: "success" });
} catch (e) {
console.warn("资源重新上传失败:", e),
e instanceof p || e instanceof b
? g
? (0, l.setUploadOverlay)(g, {
type: "error",
message: e.message,
})
: r.Notify.error(e.message)
: (g && (0, l.clearUploadOverlay)(g),
r.Notify.error("上传失败,请重试"));
} finally {
S(!1);
}
})();
},
[h, g],
),
T = (0, n.useCallback)(
(e) => {
e.stopPropagation(), E || (p?.(), y({ accept: u, onFile: M }));
},
[E, p, y, u, M],
);
return f
? null
: (0, t.jsx)(t.Fragment, {
children: (0, t.jsx)("button", {
type: "button",
onClick: T,
disabled: E,
className: (0, o.cn)(
"nodrag nopan absolute right-2 top-2 z-20 flex items-center justify-center rounded-lg transition-colors disabled:opacity-50",
x ? "bg-black/65 p-2 text-white" : "size-7",
!x &&
(v
? "text-neutral-700 hover:text-neutral-900"
: "text-white/70 hover:text-white"),
w,
),
style: x
? void 0
: v
? {
background: "rgba(255, 255, 255, 0.88)",
border:
"1px solid var(--canvas-controls-border, #e3e3e3)",
backdropFilter: "blur(4px)",
}
: {
background: "rgba(0, 0, 0, 0.5)",
backdropFilter: "blur(4px)",
},
children: _
? (0, t.jsx)("span", {
className: (0, o.cn)(
"size-3.5 animate-spin rounded-full border-2",
x
? "border-white/30 border-t-white"
: v
? "border-neutral-300 border-t-neutral-700"
: "border-white/30 border-t-white",
),
})
: (0, t.jsx)(i.Icons.Upload, { width: 14, height: 14 }),
}),
});
});
function h({ nodeId: e, hasContent: n = !1 }) {
let i = (0, l.useUploadOverlay)(e);
if (!i) return null;
if ("uploading" === i.type) {
let e = null != i.progress ? Math.round(100 * i.progress) : void 0;
return (0, t.jsxs)("div", {
className:
"z-60 pointer-events-none absolute inset-0 flex items-center justify-center overflow-hidden rounded-xl",
children: [
(0, t.jsx)("div", {
className:
"generating-breathing-dark absolute inset-0 rounded-xl",
style: n
? {
backdropFilter: "blur(8px)",
WebkitBackdropFilter: "blur(8px)",
}
: void 0,
}),
(0, t.jsx)("span", {
className: "relative text-xs font-medium text-white/80",
children: null != e ? `上传中(${e}%)...` : "上传中...",
}),
],
});
}
return "reviewing" === i.type
? (0, t.jsxs)("div", {
className:
"z-60 pointer-events-none absolute inset-0 flex items-center justify-center overflow-hidden rounded-xl",
children: [
(0, t.jsx)("div", {
className:
"generating-breathing-dark absolute inset-0 rounded-xl",
style: n
? {
backdropFilter: "blur(8px)",
WebkitBackdropFilter: "blur(8px)",
}
: void 0,
}),
(0, t.jsx)("span", {
className: "relative text-xs font-medium text-white/80",
children: "审核中...",
}),
],
})
: "success" === i.type
? (0, t.jsxs)("div", {
className:
"z-60 pointer-events-none absolute inset-0 flex items-center justify-center overflow-hidden rounded-xl",
children: [
(0, t.jsx)("div", {
className: "absolute inset-0 rounded-xl bg-black/30",
}),
(0, t.jsx)("span", {
className: "relative text-xs font-medium text-white/80",
children: "上传成功",
}),
],
})
: "error" === i.type
? (0, t.jsxs)("div", {
className:
"z-60 pointer-events-none absolute inset-0 flex items-center justify-center overflow-hidden rounded-xl",
children: [
(0, t.jsx)("div", {
className: "absolute inset-0 rounded-xl bg-black/30",
}),
(0, t.jsx)("span", {
className:
"relative max-w-[80%] truncate text-xs font-medium text-red-400",
children: i.message,
}),
],
})
: null;
}
(u.displayName = "ResourceReuploadButton"),
e.s(["default", 0, u], 124821),
e.s(["default", () => h], 799093);
};
export default moduleFactory;