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

202 lines
6.9 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: 961258
* 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(524961);
let r = {
130: "组件类型无效(某个导入的组件为 undefined,可能是导入路径错误或循环依赖)",
152: "组件渲染返回了无效内容(应返回 JSX 元素或 null)",
185: "组件在渲染过程中触发了过多的重新渲染",
321: "在组件卸载后尝试更新状态",
423: "Hooks 调用顺序发生变化(可能在条件语句中使用了 Hook)",
425: "服务端与客户端渲染内容不一致",
};
function a(e) {
let t = e.match(/Minified React error #(\d+)/);
if (!t) return { code: null, hint: null };
let n = parseInt(t[1], 10);
return { code: n, hint: r[n] ?? null };
}
function o(e, t) {
let { code: n, hint: i } = a(e.message),
r = (function (e) {
if (!e) return null;
for (let t of e.split("\n").filter((e) => e.trim())) {
let e = t.match(/at (\w+)/);
if (e && "div" !== e[1] && "span" !== e[1]) return e[1];
}
return null;
})(t?.componentStack);
if (null !== n) {
let e = r ? `组件 ${r} ` : "";
return {
title: i ? `${e}渲染失败` : `${e}渲染出错`,
detail: i || `React Error #${n}`,
};
}
return r
? { title: `组件 ${r} 渲染出错`, detail: e.message }
: { title: "渲染出错", detail: e.message };
}
class s extends n.Component {
constructor(e) {
super(e), (this.state = { hasError: !1, error: null, errorInfo: null });
}
static getDerivedStateFromError(e) {
return { hasError: !0, error: e };
}
componentDidCatch(e, t) {
this.setState({ errorInfo: t }),
console.error("[ErrorBoundary] 捕获到渲染错误:", e, t);
}
resetErrorBoundary = () => {
this.setState({ hasError: !1, error: null, errorInfo: null });
};
render() {
if (this.state.hasError && this.state.error) {
if (this.props.fallback)
return this.props.fallback({
error: this.state.error,
errorInfo: this.state.errorInfo,
resetErrorBoundary: this.resetErrorBoundary,
});
let { title: e, detail: n } = o(
this.state.error,
this.state.errorInfo,
);
return (0, t.jsxs)("div", {
className:
"flex h-full w-full flex-col items-center justify-center gap-4 p-8",
children: [
(0, t.jsx)("div", {
className: "text-lg font-medium text-red-400",
children: e,
}),
(0, t.jsx)("div", {
className: "max-w-md text-center text-sm text-white/60",
children: n,
}),
(0, t.jsx)(i.Button, {
onClick: this.resetErrorBoundary,
variant: "filled",
color: "gray",
size: "sm",
children: "重试",
}),
],
});
}
return this.props.children;
}
}
function c({ error: e, errorInfo: r, resetErrorBoundary: s }) {
let [c, l] = (0, n.useState)(!1),
{ title: u, detail: h } = o(e, r),
{ code: f } = a(e.message);
return (0, t.jsxs)("div", {
className:
"flex h-screen w-screen flex-col items-center justify-center gap-4 bg-[#1a1a2e]",
children: [
(0, t.jsx)("div", {
className: "text-lg font-medium text-red-400",
children: u,
}),
(0, t.jsx)("div", {
className: "max-w-lg text-center text-sm text-white/60",
children: h,
}),
null !== f &&
(0, t.jsxs)("a", {
href: `https://react.dev/errors/${f}`,
target: "_blank",
rel: "noopener noreferrer",
className: "text-xs text-white/30 underline hover:text-white/50",
children: ["React Error #", f, " 文档"],
}),
(0, t.jsxs)("div", {
className: "flex gap-3",
children: [
(0, t.jsx)(i.Button, {
onClick: s,
variant: "light",
color: "gray",
size: "sm",
children: "尝试恢复",
}),
(0, t.jsx)(i.Button, {
onClick: () => window.location.reload(),
variant: "filled",
color: "blue",
size: "sm",
children: "重新加载画布",
}),
],
}),
(0, t.jsx)("button", {
onClick: () => l((e) => !e),
className: "mt-2 text-xs text-white/20 hover:text-white/40",
type: "button",
children: c ? "收起详情" : "查看原始错误",
}),
c &&
(0, t.jsxs)("pre", {
className:
"tiny-scrollbar max-h-40 max-w-2xl overflow-auto rounded bg-black/40 p-3 text-left text-xs text-white/40",
children: [
e.message,
r?.componentStack &&
`
Component Stack:${r.componentStack}`,
],
}),
],
});
}
function l({ children: e }) {
return (0, t.jsx)(s, {
fallback: (e) => (0, t.jsx)(c, { ...e }),
children: e,
});
}
e.s(["CanvasErrorBoundary", () => l, "ErrorBoundary", () => s], 778003),
e.s(
[
"CANVAS_ZOOM",
0,
{ min: 0.1, max: 2, default: 1 },
"canvasTheme",
0,
{
background: "var(--canvas-bg)",
nodeBackground: "var(--canvas-node-bg)",
nodeBorder: "var(--canvas-node-border)",
nodeBorderSelected: "var(--canvas-node-border-selected)",
text: "var(--canvas-controls-text)",
handle: "var(--canvas-handle)",
handleBackground: "var(--canvas-handle-bg)",
handleIcon: "var(--canvas-handle-icon)",
edge: "var(--canvas-edge)",
edgeHover: "var(--canvas-edge-hover)",
edgeSelected: "var(--canvas-edge-selected)",
controlsBackground: "var(--canvas-controls-bg)",
controlsBorder: "var(--canvas-controls-border)",
backgroundDot: "var(--canvas-bg-dot)",
minimapBackground: "var(--canvas-minimap-bg)",
minimapNode: "var(--canvas-minimap-node)",
minimapMask: "var(--canvas-minimap-mask)",
minimapMaskStroke: "var(--canvas-minimap-mask-stroke)",
},
],
961258,
);
};
export default moduleFactory;