/* * Extracted from browser-delivered Turbopack chunk: fd0220e4d10052af.701bdafa2d.js * Module id: 316925 * For reading/searching only; this factory depends on the original Turbopack runtime. */ const moduleFactory = (e) => { "use strict"; var t = e.i(358379), n = e.i(768924), i = e.i(216257); function r(e, r) { let { getNodes: a } = (0, n.useReactFlow)(), o = (0, i.useCanvasStore)((e) => e.isBoxSelecting), [s, c] = (0, t.useState)(!1); return ( (0, t.useEffect)(() => { if (!e) return void c(!1); let t = a().filter((e) => !0 === e.selected); c(1 === t.length && t[0]?.id === r); }, [e, r, a]), (0, n.useOnSelectionChange)({ onChange: (0, t.useCallback)( ({ nodes: e }) => { c(1 === e.length && e.some((e) => e.id === r)); }, [r], ), }), e && s && !o ); } e.s(["useShouldShowGenerator", () => r], 464025); var a = e.i(182004), o = e.i(802182), s = e.i(386598); function c(e, t) { return ( e === t || (!!e && !!t && e.uuid === t.uuid && e.status === t.status && e.assetId === t.assetId) ); } function l({ id: e, nodeType: n, pendingUuid: i, updateNodeData: r }) { let l = (0, s.useThirdAssetStore)( (0, t.useCallback)( (e) => (i ? e.list.find((e) => e.uuid === i) : void 0), [i], ), c, ); return ( (0, t.useEffect)(() => { !i || s.useThirdAssetStore.getState().list.some((e) => e.uuid === i) || (async () => { let t; try { t = await (0, o.checkThirdAssets)([i]); } catch { return; } let c = t.find((e) => e.uuid === i && e.found); c && (1 === c.status && c.assetId ? r(e, { [u(n)]: c.assetId, _pendingThirdAssetUuid: void 0 }) : 2 === c.status ? r(e, { _pendingThirdAssetUuid: void 0 }) : (s.useThirdAssetStore.setState((e) => { var t; return e.list.some((e) => e.uuid === i) ? e : { list: [ ...e.list, { uuid: i, assetUrl: c.assetUrl ?? "", assetId: c.assetId ?? "", assetType: (t = n) === a.NodeType.IMAGE ? "image" : t === a.NodeType.VIDEO ? "video" : "audio", status: 0, createdAtMs: 0, updatedAtMs: 0, }, ], }; }), s.useThirdAssetStore.getState().pollPendingAssets())); })(); }, [i, n, e, r]), (0, t.useEffect)(() => { if (l && i) { if (1 === l.status && l.assetId) r(e, { [u(n)]: l.assetId, _pendingThirdAssetUuid: void 0 }); else if (2 === l.status) { r(e, { _pendingThirdAssetUuid: void 0, _starVideoCheckStatus: "failed", }); let t = setTimeout(() => { r(e, { _starVideoCheckStatus: void 0 }); }, 5e3); return () => clearTimeout(t); } } }, [l, i, e, n, r]), { isReviewing: !!i } ); } function u(e) { return e === a.NodeType.IMAGE ? "portraitAssetId" : e === a.NodeType.VIDEO ? "assetVideoAssetId" : "assetAudioAssetId"; } e.s(["useThirdAssetNodeSync", () => l], 329931); var h = e.i(462214); function f({ icon: e, isReadonly: t, actions: n }) { return (0, h.jsxs)("div", { className: "flex h-full flex-col items-center justify-center px-6", children: [ (0, h.jsx)("div", { className: t ? "" : "mb-4", children: e }), !t && n && n.length > 0 && (0, h.jsxs)("div", { className: "w-full", children: [ (0, h.jsx)("div", { className: "text-fg-muted mb-2 text-sm", children: "尝试:", }), (0, h.jsx)("div", { className: "flex flex-col items-start gap-1", children: n.map((e) => (0, h.jsxs)( "button", { type: "button", onClick: e.onClick, className: "group/btn text-fg-default hover:bg-canvas-controls-hover flex w-fit items-center gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors", children: [ e.icon, (0, h.jsx)("span", { children: e.label }), e.hint && (0, h.jsx)("span", { className: "text-fg-muted ml-auto text-xs opacity-0 transition-opacity group-hover/btn:opacity-100", children: e.hint, }), ], }, e.label, ), ), }), ], }), ], }); } e.s(["default", () => f], 316925); }; export default moduleFactory;