diff --git a/video-gen-app/dist/assets/index-COnmuf9j.js b/video-gen-app/dist/assets/index-BjAuFGyZ.js similarity index 96% rename from video-gen-app/dist/assets/index-COnmuf9j.js rename to video-gen-app/dist/assets/index-BjAuFGyZ.js index ba4d0a58..cd8c36d0 100644 --- a/video-gen-app/dist/assets/index-COnmuf9j.js +++ b/video-gen-app/dist/assets/index-BjAuFGyZ.js @@ -402,7 +402,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho from { opacity: 0; transform: translateY(24px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } } - `})]})},W7={HomeOutlined:(0,$.jsx)(p3,{}),DashboardOutlined:(0,$.jsx)(O4,{}),CodeOutlined:(0,$.jsx)(p4,{}),PlayCircleOutlined:(0,$.jsx)(u6,{}),WalletOutlined:(0,$.jsx)(B8,{}),SettingOutlined:(0,$.jsx)(L6,{}),BellOutlined:(0,$.jsx)(O2,{}),UserOutlined:(0,$.jsx)(P8,{}),AppstoreOutlined:(0,$.jsx)(i2,{}),FileTextOutlined:(0,$.jsx)(PU,{}),StarOutlined:(0,$.jsx)(s8,{}),HeartOutlined:(0,$.jsx)(i3,{}),CameraOutlined:(0,$.jsx)(U2,{}),RobotOutlined:(0,$.jsx)(u6,{}),CalculatorOutlined:(0,$.jsx)(B2,{}),DollarOutlined:(0,$.jsx)(P4,{}),GiftOutlined:(0,$.jsx)(Q4,{}),ThunderboltOutlined:(0,$.jsx)(y8,{}),FireOutlined:(0,$.jsx)(K4,{}),CloudOutlined:(0,$.jsx)(i4,{}),SmileOutlined:(0,$.jsx)(Q6,{}),TrophyOutlined:(0,$.jsx)(T8,{}),RocketOutlined:(0,$.jsx)(T6,{}),BulbOutlined:(0,$.jsx)(L2,{}),PictureOutlined:(0,$.jsx)(t6,{}),VideoCameraOutlined:(0,$.jsx)(L8,{}),AudioOutlined:(0,$.jsx)(g2,{}),MailOutlined:(0,$.jsx)(P3,{}),PhoneOutlined:(0,$.jsx)(Q3,{}),GlobalOutlined:(0,$.jsx)(t3,{}),ShoppingCartOutlined:(0,$.jsx)(B6,{}),TeamOutlined:(0,$.jsx)(g8,{}),BarChartOutlined:(0,$.jsx)(T2,{}),PieChartOutlined:(0,$.jsx)(i6,{}),LineChartOutlined:(0,$.jsx)(T3,{}),SecurityScanOutlined:(0,$.jsx)(j6,{}),ApiOutlined:(0,$.jsx)(t2,{}),DatabaseOutlined:(0,$.jsx)(j4,{}),CloudServerOutlined:(0,$.jsx)(s4,{})},G7=240,K7=[{gradient:`linear-gradient(135deg, #c9a96e, #a67c52)`,shadow:`rgba(201,169,110,0.25)`,icon:(0,$.jsx)(_J,{})},{gradient:`linear-gradient(135deg, #4a5568, #2d3748)`,shadow:`rgba(74,85,104,0.25)`,icon:(0,$.jsx)(U4,{})},{gradient:`linear-gradient(135deg, #718096, #4a5568)`,shadow:`rgba(113,128,150,0.25)`,icon:(0,$.jsx)(S4,{})},{gradient:`linear-gradient(135deg, #5a67d8, #434190)`,shadow:`rgba(90,103,216,0.25)`,icon:(0,$.jsx)(y2,{})}],q7=()=>{let e=qe(),t=We(),{user:n,logout:r}=B7(),[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)(!1),[c]=CW.useForm(),[l,u]=(0,S.useState)(null),[d,f]=(0,S.useState)([]),[p,m]=(0,S.useState)([]),[h,g]=(0,S.useState)({}),[_,v]=(0,S.useState)(0),[y,b]=(0,S.useState)(()=>{let e=localStorage.getItem(`siteInfo`),t=e&&JSON.parse(e).siteName||``;return t&&(document.title=t),t}),[x,C]=(0,S.useState)(()=>{let e=localStorage.getItem(`siteInfo`),t=e&&JSON.parse(e).siteLogo||``;if(t){let e=document.querySelector(`link[rel="icon"]`);e||(e=document.createElement(`link`),e.rel=`icon`,document.head.appendChild(e)),e.href=t,e.type=`image/png`}return t}),[w,T]=(0,S.useState)(!localStorage.getItem(`siteInfo`)),[E,D]=(0,S.useState)(!1),[O,k]=(0,S.useState)(null),[A,j]=(0,S.useState)(`alipay`),[M,N]=(0,S.useState)(!1),[P,F]=(0,S.useState)(180),I=(0,S.useRef)(null),L=(0,S.useRef)(null),R=(0,S.useRef)(null),[z,B]=(0,S.useState)({alipay:!1,wechat:!1}),V=`pending_payment_order`;(0,S.useEffect)(()=>{F5().then(e=>{let t=e.siteName||`民众智创`,n=e.siteLogo||``;if(t!==y&&(b(t),document.title=t),n&&n!==x){C(n);let e=document.querySelector(`link[rel="icon"]`);e||(e=document.createElement(`link`),e.rel=`icon`,document.head.appendChild(e)),e.href=n,e.type=`image/png`}localStorage.setItem(`siteInfo`,JSON.stringify({siteName:t,siteLogo:n}))}).catch(()=>{})},[]);let H=()=>{B5().then(e=>{v(e)}).catch(()=>{})};(0,S.useEffect)(()=>{(async()=>{let e=localStorage.getItem(V);if(e)try{let t=JSON.parse(e),n=await J5(t.orderNo);if(n.status===`pending`){k({price:t.price,credits:t.credits,qrCode:t.qrCode,method:t.method}),R.current=t.orderNo;let e=Date.now(),n=new Date(t.createdAt).getTime(),r=t.timeoutSeconds||180,i=Math.floor((e-n)/1e3),a=Math.max(0,r-i);a>0?(D(!0),J(t.orderNo,a)):localStorage.removeItem(V)}else n.status===`paid`?(Q.success(`支付成功!积分已到账`),B7.getState().refreshUser(),localStorage.removeItem(V)):localStorage.removeItem(V)}catch{localStorage.removeItem(V)}})()},[]),(0,S.useEffect)(()=>{U5().then(e=>{f(e.filter(e=>e.is_active!==!1&&e.isActive!==!1))}).catch(()=>{}),W5().then(e=>{m(e.filter(e=>e.is_active!==!1&&e.isActive!==!1))}).catch(()=>{}),G5().then(e=>{B(e),e.alipay?j(`alipay`):e.wechat&&j(`wechat`)}).catch(()=>{}),H()},[n]);let U=t.pathname.startsWith(`/records`)?`/records`:t.pathname,W=G7,ee=[{key:`profile`,icon:(0,$.jsx)(P8,{}),label:`账号: ${n?.username}`,disabled:!0},{key:`credits`,icon:(0,$.jsx)(B8,{style:{color:`#c9a96e`}}),label:`积分: ${n?.credits??0}`,disabled:!0},{type:`divider`},{key:`myCredits`,icon:(0,$.jsx)(B8,{}),label:`积分明细`},{key:`orderRecords`,icon:(0,$.jsx)(PU,{}),label:`订单记录`},{key:`messages`,icon:(0,$.jsx)(O2,{}),label:`消息中心${_>0?`(${_})`:``}`},{type:`divider`},{key:`changePwd`,icon:(0,$.jsx)(O3,{}),label:`修改密码`},{type:`divider`},{key:`logout`,icon:(0,$.jsx)(j3,{}),label:`退出登录`,danger:!0}],te=({key:t})=>{t===`logout`?(r(),e(`/login`)):t===`changePwd`?a(!0):t===`messages`?e(`/messages`):t===`recharge`?s(!0):t===`myCredits`?e(`/user-center?tab=credits`):t===`orderRecords`&&e(`/user-center?tab=orders`)},G=async()=>{try{await c.validateFields(),Q.success(`密码修改成功(演示)`),a(!1),c.resetFields()}catch{}},ne=()=>{r(),e(`/login`)},K=()=>{s(!0)},q=(0,S.useCallback)(()=>{I.current&&=(clearInterval(I.current),null),L.current&&=(clearInterval(L.current),null)},[]),J=(0,S.useCallback)((e,t=180)=>{q(),F(t),I.current=setInterval(async()=>{try{let t=await J5(e);t.status===`paid`?(q(),R.current=null,localStorage.removeItem(V),Q.success(`支付成功!积分已到账`),B7.getState().refreshUser(),D(!1),k(null),u(null)):t.status===`cancelled`&&(q(),R.current=null,localStorage.removeItem(V))}catch{}},2e3),L.current=setInterval(()=>{F(e=>e<=1?(q(),R.current&&=(Y5(R.current).catch(()=>{}),null),localStorage.removeItem(V),Q.warning(`订单已超时,请重新充值`),D(!1),k(null),u(null),0):e-1)},1e3)},[q]);return(0,$.jsxs)(pK,{style:{minHeight:`100vh`},children:[(0,$.jsxs)(`div`,{className:`desktop-sidebar`,style:{width:W,position:`fixed`,left:16,top:16,bottom:16,zIndex:100,background:`linear-gradient(180deg, #ffffff 0%, #f8fafc 100%)`,borderRadius:`20px`,boxShadow:`0 4px 32px rgba(0, 0, 0, 0.06), 0 1px 8px rgba(0, 0, 0, 0.04)`,display:`flex`,flexDirection:`column`,transition:`width 0.25s ease, left 0.25s ease`,overflow:`hidden`,border:`1px solid rgba(0, 0, 0, 0.06)`},children:[(0,$.jsx)(`div`,{style:{height:80,display:`flex`,alignItems:`center`,justifyContent:`flex-start`,padding:`0 20px`,flexShrink:0,background:`linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, rgba(139, 92, 246, 0.04) 100%)`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:14},children:[(0,$.jsx)(`div`,{style:{width:42,height:42,borderRadius:14,flexShrink:0,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 4px 16px rgba(99, 102, 241, 0.35)`,overflow:`hidden`},children:x?(0,$.jsx)(`img`,{src:x,alt:`logo`,style:{width:28,height:28,objectFit:`contain`}}):(0,$.jsx)(y8,{style:{fontSize:20,color:`#ffffff`}})}),(0,$.jsx)(`span`,{style:{color:`#1e293b`,fontSize:17,fontWeight:700,letterSpacing:-.02,whiteSpace:`nowrap`,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:y})]})}),(0,$.jsx)(`div`,{style:{flex:1,padding:`8px 8px`,overflow:`auto`},children:(()=>{let t=d.filter(e=>(e.menu_type??e.menuType)===`group`),n=d.filter(e=>(e.menu_type??e.menuType)!==`group`),r={};n.filter(e=>e.parent_id??e.parentId).forEach(e=>{let t=e.parent_id??e.parentId;r[t]||(r[t]=[]),r[t].push(e)});let i=n.filter(e=>!(e.parent_id??e.parentId)),a=[],o=(t,n=0)=>{let r=t.path===U,i=W7[t.icon]||(0,$.jsx)(p3,{});return(0,$.jsxs)(`div`,{onClick:()=>t.path&&e(t.path),style:{display:`flex`,alignItems:`center`,justifyContent:`flex-start`,gap:12,padding:n>0?`8px 14px 8px 36px`:`10px 16px`,borderRadius:12,margin:`2px 6px`,cursor:`pointer`,fontSize:n>0?13:14,fontWeight:r?600:400,color:r?`#4f46e5`:`#475569`,background:r?`linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.08) 100%)`:`transparent`,transition:`all 0.2s ease`},children:[(0,$.jsx)(`span`,{style:{fontSize:n>0?14:16,flexShrink:0,color:r?`#6366f1`:`#64748b`},children:i}),(0,$.jsx)(`span`,{style:{whiteSpace:`nowrap`},children:t.label})]},t.id)};return t.sort((e,t)=>(typeof e.sortOrder==`number`?e.sortOrder:1/0)-(typeof t.sortOrder==`number`?t.sortOrder:1/0)).forEach(e=>{let t=(r[e.id]||[]).sort((e,t)=>(typeof e.sortOrder==`number`?e.sortOrder:1/0)-(typeof t.sortOrder==`number`?t.sortOrder:1/0));a.push((0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{style:{color:`#94a3b8`,fontSize:12,fontWeight:600,padding:`12px 16px 6px`,letterSpacing:.5,textTransform:`uppercase`},children:e.label}),t.map(e=>o(e,1))]},e.id))}),i.sort((e,t)=>(typeof e.sortOrder==`number`?e.sortOrder:1/0)-(typeof t.sortOrder==`number`?t.sortOrder:1/0)).forEach(e=>{a.push(o(e))}),a})()}),(0,$.jsxs)(`div`,{onClick:()=>s(!0),style:{margin:`8px 12px`,padding:`12px 20px`,borderRadius:14,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:8,color:`#ffffff`,fontSize:14,fontWeight:600,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,boxShadow:`0 4px 16px rgba(99, 102, 241, 0.4)`,transition:`all 0.3s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%)`,e.currentTarget.style.transform=`translateY(-1px)`,e.currentTarget.style.boxShadow=`0 6px 20px rgba(99, 102, 241, 0.5)`},onMouseLeave:e=>{e.currentTarget.style.background=`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,e.currentTarget.style.transform=`translateY(0)`,e.currentTarget.style.boxShadow=`0 4px 16px rgba(99, 102, 241, 0.4)`},children:[(0,$.jsx)(MR,{style:{fontSize:16}}),(0,$.jsx)(`span`,{children:`充值积分`})]}),(0,$.jsx)(`div`,{style:{padding:`16px 16px`,flexShrink:0},children:(0,$.jsx)(jU,{menu:{items:ee,onClick:te},placement:`topRight`,arrow:!0,children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`flex-start`,gap:12,padding:`10px 14px`,borderRadius:14,cursor:`pointer`,transition:`all 0.25s ease`,background:`linear-gradient(135deg, rgba(248, 250, 252, 0.9) 0%, rgba(241, 245, 249, 0.9) 100%)`,boxShadow:`0 2px 12px rgba(0, 0, 0, 0.04)`},onMouseEnter:e=>{e.currentTarget.style.background=`linear-gradient(135deg, #ffffff 0%, #f8fafc 100%)`,e.currentTarget.style.boxShadow=`0 4px 16px rgba(0, 0, 0, 0.08)`},onMouseLeave:e=>{e.currentTarget.style.background=`linear-gradient(135deg, rgba(248, 250, 252, 0.9) 0%, rgba(241, 245, 249, 0.9) 100%)`,e.currentTarget.style.boxShadow=`0 2px 12px rgba(0, 0, 0, 0.04)`},children:[(0,$.jsx)(xT,{size:36,icon:(0,$.jsx)(P8,{}),style:{background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,flexShrink:0,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.3)`}}),(0,$.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,$.jsx)(`div`,{style:{color:`#1e293b`,fontSize:14,fontWeight:600,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,letterSpacing:-.01},children:n?.username}),(0,$.jsxs)(`div`,{style:{color:`#6366f1`,fontSize:12,fontWeight:500,letterSpacing:0,background:`rgba(99, 102, 241, 0.08)`,padding:`2px 8px`,borderRadius:6,display:`inline-block`},children:[`积分: `,n?.credits||0]})]})]})})})]}),(0,$.jsx)(`div`,{className:`desktop-content`,style:{marginLeft:W+28,marginRight:12,marginTop:16,marginBottom:16,flex:1,minHeight:`calc(100vh - 32px)`,background:`transparent`,padding:0,transition:`margin-left 0.25s ease`},children:(0,$.jsx)(`div`,{style:{boxSizing:`border-box`,height:`100%`,background:`#ffffffff`,borderRadius:`20px`,boxShadow:`0 4px 32px rgba(0, 0, 0, 0.06), 0 1px 8px rgba(0, 0, 0, 0.04)`,minHeight:`100%`,padding:`24px 32px 32px`,border:`1px solid rgba(0, 0, 0, 0.06)`},children:(0,$.jsx)(St,{})})}),(0,$.jsxs)(`div`,{className:`mobile-bottom-nav`,children:[d.filter(e=>(e.menu_type??e.menuType)!==`group`).map(t=>t.path?(0,$.jsxs)(`div`,{className:`nav-item ${t.path===U?`active`:``}`,onClick:()=>e(t.path),children:[(0,$.jsx)(`span`,{className:`nav-icon`,children:W7[t.icon]||(0,$.jsx)(p3,{})}),(0,$.jsx)(`span`,{children:t.label})]},t.id):null),(0,$.jsxs)(`div`,{className:`nav-item`,onClick:K,children:[(0,$.jsx)(`span`,{className:`nav-icon`,children:(0,$.jsx)(p6,{})}),(0,$.jsx)(`span`,{children:`充值`})]}),(0,$.jsxs)(`div`,{className:`nav-item`,onClick:ne,children:[(0,$.jsx)(`span`,{className:`nav-icon`,children:(0,$.jsx)(j3,{})}),(0,$.jsx)(`span`,{children:`退出`})]})]}),(0,$.jsx)(Oq,{title:(0,$.jsxs)(kU,{children:[(0,$.jsx)(O3,{}),`修改密码`]}),open:i,onOk:G,onCancel:()=>{a(!1),c.resetFields()},okText:`确认修改`,cancelText:`取消`,width:440,children:(0,$.jsxs)(CW,{form:c,layout:`vertical`,style:{marginTop:20},children:[(0,$.jsx)(CW.Item,{name:`oldPwd`,label:`原密码`,rules:[{required:!0,message:`请输入原密码`}],children:(0,$.jsx)(iK.Password,{placeholder:`请输入原密码`,size:`large`,prefix:(0,$.jsx)(O3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(CW.Item,{name:`newPwd`,label:`新密码`,rules:[{required:!0,message:`请输入新密码`},{min:6,message:`密码至少6位`}],children:(0,$.jsx)(iK.Password,{placeholder:`请输入新密码(至少6位)`,size:`large`,prefix:(0,$.jsx)(O3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(CW.Item,{name:`confirmPwd`,label:`确认新密码`,rules:[{required:!0,message:`请再次输入新密码`},({getFieldValue:e})=>({validator(t,n){return!n||e(`newPwd`)===n?Promise.resolve():Promise.reject(Error(`两次密码不一致`))}})],children:(0,$.jsx)(iK.Password,{placeholder:`请再次输入新密码`,size:`large`,prefix:(0,$.jsx)(O3,{style:{color:`#94a3b8`,marginRight:8}})})})]})}),(0,$.jsx)(Oq,{title:(0,$.jsxs)(kU,{children:[(0,$.jsx)(Q4,{}),`积分充值`]}),open:o,onCancel:()=>{s(!1),u(null)},footer:null,width:680,children:(0,$.jsxs)(`div`,{style:{marginTop:16},children:[(0,$.jsxs)(kU,{style:{marginBottom:16},children:[(0,$.jsx)(B8,{style:{color:`#6366f1`}}),(0,$.jsx)(y1.Text,{style:{color:`#64748b`,letterSpacing:0},children:`当前积分余额`}),(0,$.jsx)(y1.Text,{strong:!0,style:{color:`#6366f1`,fontSize:20,fontWeight:600},children:n?.credits??0})]}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:12,flexWrap:`wrap`},children:p.map((e,t)=>{let n=K7[t%K7.length],r=(e.credits||0)+(e.bonus_credits||e.bonusCredits||0);return(0,$.jsxs)(`div`,{onClick:()=>u(e.id),style:{flex:`1 1 45%`,minWidth:200,borderRadius:16,padding:`20px 16px`,background:l===e.id?`rgba(99,102,241,0.04)`:`#fafbff`,border:l===e.id?`2px solid #6366f1`:`1px solid #f0f0f5`,cursor:`pointer`,position:`relative`,transition:`all 0.2s`},children:[e.description&&(0,$.jsx)(v$,{color:`purple`,style:{position:`absolute`,top:-10,left:`50%`,transform:`translateX(-50%)`,borderRadius:8,fontSize:11},children:e.description}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsx)(`div`,{style:{width:44,height:44,borderRadius:12,flexShrink:0,background:n.gradient,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:18,color:`#fff`,boxShadow:`0 6px 16px ${n.shadow}`},children:n.icon}),(0,$.jsxs)(`div`,{style:{flex:1},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:6},children:[(0,$.jsx)(y1.Text,{strong:!0,style:{fontSize:15},children:e.name}),(0,$.jsxs)(y1.Text,{style:{fontSize:12,color:`#94a3b8`},children:[r.toLocaleString(),` 积分`]})]}),(0,$.jsxs)(`div`,{style:{fontSize:22,fontWeight:800,marginTop:4,background:n.gradient,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`},children:[`¥`,e.price]})]})]})]},e.id)})}),!z.alipay&&!z.wechat?(0,$.jsx)(`div`,{style:{marginTop:20,marginBottom:8,padding:16,background:`#fef2f2`,borderRadius:12,border:`1px solid #fecaca`},children:(0,$.jsx)(y1.Text,{style:{color:`#dc2626`,fontSize:13},children:`⚠️ 暂无可用的支付方式,请联系管理员开启支付功能`})}):(0,$.jsxs)(`div`,{style:{marginTop:20,marginBottom:8},children:[(0,$.jsx)(y1.Text,{style:{color:`#64748b`,fontSize:13,marginBottom:8,display:`block`},children:`选择支付方式`}),(0,$.jsxs)(GL.Group,{value:A,onChange:e=>j(e.target.value),style:{display:`flex`,gap:12},children:[z.alipay&&(0,$.jsxs)(GL.Button,{value:`alipay`,style:{flex:1,textAlign:`center`,borderRadius:10,height:44,lineHeight:`42px`,borderColor:A===`alipay`?`#1677ff`:void 0,color:A===`alipay`?`#1677ff`:void 0},children:[(0,$.jsx)(Q0,{style:{fontSize:16,marginRight:6}}),`支付宝`]}),z.wechat&&(0,$.jsxs)(GL.Button,{value:`wechat`,style:{flex:1,textAlign:`center`,borderRadius:10,height:44,lineHeight:`42px`,borderColor:A===`wechat`?`#07c160`:void 0,color:A===`wechat`?`#07c160`:void 0},children:[(0,$.jsx)(K8,{style:{fontSize:16,marginRight:6}}),`微信支付`]})]})]}),(0,$.jsxs)(`div`,{style:{marginTop:16,display:`flex`,justifyContent:`flex-end`},children:[(0,$.jsx)(jD,{size:`large`,onClick:()=>{s(!1),u(null)},style:{borderRadius:10,marginRight:12},children:`取消`}),(0,$.jsx)(jD,{type:`primary`,size:`large`,disabled:!l||!z.alipay&&!z.wechat,loading:M,onClick:async()=>{let e=p.find(e=>e.id===l);if(!e)return;let t=(e.credits||0)+(e.bonus_credits||e.bonusCredits||0);try{N(!0);let n=await K5(e.id,A),r=n.qrUrl||n.codeUrl||n.qr_code||n.code_url;(n.paymentMethod===`alipay`||n.paymentMethod===`wechat`)&&r?(k({price:e.price,credits:t,qrCode:r,method:n.paymentMethod}),s(!1),D(!0),R.current=n.orderNo,localStorage.setItem(V,JSON.stringify({orderNo:n.orderNo,price:e.price,credits:t,qrCode:r,method:n.paymentMethod,createdAt:n.createdAt||new Date().toISOString(),timeoutSeconds:180})),J(n.orderNo)):(Q.success(`充值成功!积分已到账`),B7.getState().refreshUser(),s(!1),u(null))}catch(e){Q.error(e?.message||`创建订单失败,请重试`)}finally{N(!1)}},style:{borderRadius:10,fontWeight:600,background:l?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#d1d5db`,border:`none`,boxShadow:l?`0 8px 24px rgba(99,102,241,0.3)`:`none`},children:`确认充值`})]})]})}),(0,$.jsx)(Oq,{open:E,onCancel:async()=>{if(q(),R.current){try{await Y5(R.current)}catch{}R.current=null}localStorage.removeItem(V),D(!1),k(null)},footer:null,width:400,closable:!1,styles:{body:{padding:0,borderRadius:16,overflow:`hidden`}},children:(0,$.jsxs)(`div`,{style:{padding:`24px`},children:[(0,$.jsxs)(`div`,{style:{textAlign:`center`,marginBottom:24},children:[(0,$.jsx)(`div`,{style:{width:48,height:48,background:O?.method===`alipay`?`linear-gradient(135deg, #1677ff, #0958d9)`:`linear-gradient(135deg, #07c160, #06ae56)`,borderRadius:16,display:`flex`,alignItems:`center`,justifyContent:`center`,margin:`0 auto 12px`},children:O?.method===`alipay`?(0,$.jsx)(Q0,{style:{fontSize:24,color:`#fff`}}):(0,$.jsx)(K8,{style:{fontSize:24,color:`#fff`}})}),(0,$.jsx)(y1.Title,{level:4,style:{margin:0},children:O?.method===`alipay`?`支付宝支付`:`微信支付`}),(0,$.jsx)(y1.Text,{style:{color:`#94a3b8`,fontSize:13},children:O?.method===`alipay`?`请使用支付宝扫描二维码完成支付`:`请使用微信扫描二维码完成支付`})]}),(0,$.jsxs)(`div`,{style:{background:`#fff`,borderRadius:16,padding:20,display:`flex`,flexDirection:`column`,alignItems:`center`,boxShadow:`0 4px 20px rgba(0,0,0,0.08)`},children:[(0,$.jsx)(`div`,{style:{width:180,height:180,borderRadius:12,overflow:`hidden`,background:`#fff`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:O&&(0,$.jsx)(Y0,{value:O.qrCode,size:160,level:`M`,includeMargin:!1})}),(0,$.jsxs)(`div`,{style:{marginTop:16,textAlign:`center`},children:[(0,$.jsxs)(`div`,{style:{fontSize:28,fontWeight:700,color:`#1a1a2e`},children:[`¥`,O?.price||0]}),(0,$.jsxs)(`div`,{style:{fontSize:13,color:`#64748b`,marginTop:4},children:[`购买 `,O?.credits||0,` 积分`]}),(0,$.jsx)(`div`,{style:{marginTop:12,padding:`8px 16px`,background:P<=30?`#fef2f2`:`#f0f9ff`,borderRadius:8,border:P<=30?`1px solid #fecaca`:`1px solid #bae6fd`,display:`inline-block`},children:(0,$.jsxs)(`span`,{style:{fontSize:14,fontWeight:600,color:P<=30?`#dc2626`:`#0284c7`},children:[`订单将在 `,(0,$.jsx)(`span`,{style:{fontSize:16,fontWeight:800},children:P}),` 秒后关闭`]})})]})]}),(0,$.jsx)(`div`,{style:{marginTop:20,padding:16,background:`#fef3c7`,borderRadius:12},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8},children:[(0,$.jsx)(`div`,{style:{fontSize:16,marginTop:-2},children:`💡`}),(0,$.jsxs)(`div`,{style:{fontSize:13,color:`#92400e`},children:[(0,$.jsx)(`div`,{style:{fontWeight:500,marginBottom:4},children:`支付提示`}),(0,$.jsxs)(`ul`,{style:{margin:0,paddingLeft:16},children:[(0,$.jsx)(`li`,{style:{marginBottom:2},children:`请在支付后等待页面自动跳转`}),(0,$.jsx)(`li`,{children:`如支付成功但未到账,请联系客服`})]})]})]})}),(0,$.jsx)(`div`,{style:{marginTop:20},children:(0,$.jsx)(jD,{size:`large`,block:!0,onClick:async()=>{if(q(),R.current){try{await Y5(R.current)}catch{}R.current=null}localStorage.removeItem(V),D(!1),k(null),u(null)},style:{borderRadius:10},children:`取消支付`})})]})}),(0,$.jsx)(U7,{})]})},J7=`http://localhost:8000/api`,Y7=()=>{let{checkAuth:e}=B7(),[t,n]=(0,S.useState)(!1),[r,i]=(0,S.useState)(`password`),[a,o]=(0,S.useState)(`password`),[s,c]=(0,S.useState)(0),[l,u]=(0,S.useState)(0),[d,f]=(0,S.useState)(!1),[p,m]=(0,S.useState)(!1),[h,g]=(0,S.useState)(!1),[_,v]=(0,S.useState)(!1),[y,b]=(0,S.useState)(0),[x,C]=(0,S.useState)(!1),[w,T]=(0,S.useState)(!1),E=(()=>{try{let e=localStorage.getItem(`siteInfo`);if(e){let t=JSON.parse(e);return{siteName:t.siteName||`VideoGen.AI`,siteLogo:t.siteLogo||``}}}catch{}return{siteName:`VideoGen.AI`,siteLogo:``}})(),[D,O]=(0,S.useState)(E.siteName),[k,A]=(0,S.useState)(E.siteLogo),[j,M]=(0,S.useState)(``),[N,P]=(0,S.useState)(``),F=qe(),{login:I}=B7(),[L]=CW.useForm(),[R]=CW.useForm(),[z]=CW.useForm();(0,S.useEffect)(()=>{F5().then(e=>{O(e.siteName),A(e.siteLogo),M(e.userAgreementUrl),P(e.privacyPolicyUrl)}).catch(()=>{})},[]);let B=()=>d?!0:(Q.warning(`请先阅读并同意用户协议和隐私政策`),!1),V=async()=>{if(B())try{let t=await L.validateFields();await I(t.phone,t.password,void 0,t.rememberMe),Q.success(`登录成功,欢迎回来`),await e(),F(`/projects`)}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Q.error(t)}},H=async()=>{if(B())try{let t=R.getFieldsValue();if(!t.phone||!t.code){Q.error(`请填写手机号和验证码`);return}n(!0),await y5(t.phone,t.code),Q.success(`登录成功,欢迎回来`),await e(),F(`/projects`)}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Q.error(t)}finally{n(!1)}},U=async()=>{if(B())try{let t=await z.validateFields();n(!0),await b5(t.phone,t.regCode,t.password),Q.success(`注册成功`),await e(),F(`/projects`)}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`注册失败`;Q.error(t)}finally{n(!1)}},W=(e,t)=>{e(60);let n=setInterval(()=>{e(e=>e<=1?(clearInterval(n),m(!1),t?C(!0):T(!0),0):e-1)},1e3)};(0,S.useEffect)(()=>{s===0&&r===`phone`&&v(!1)},[s,r]);let ee=async(e,t)=>{try{if(!e||!/^1\d{10}$/.test(e)){Q.error(`请输入正确的手机号`);return}if(t){m(!0),g(!1);return}if(!_){m(!0),v(!1);return}let n=``;n=r===`register`?`register`:`login`,await R5(e,n),W(t?u:c),Q.success(`验证码已发送`)}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Q.error(t),r===`register`?(g(!1),u(0)):(v(!1),c(0)),b(e=>e+1)}},te=async(e=!1)=>{let t=r===`register`?z.getFieldValue(`phone`):R.getFieldValue(`phone`);try{let e=``;e=r===`register`?`register`:`login`,await R5(t,e),r===`register`?(g(!0),W(u,!0)):(v(!0),W(c,!1)),Q.success(`验证码已发送`)}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Q.error(t),r===`register`?(g(!1),u(0),C(!0)):(v(!1),c(0),T(!0)),b(e=>e+1)}},G=e=>{o(e),i(e),c(0),u(0),v(!1),g(!1),m(!1),C(!1),T(!1),b(e=>e+1),e===`password`?L.resetFields():R.resetFields()},ne=[{icon:(0,$.jsx)(L2,{}),title:`AI 智能优化`,desc:`输入原始提示词,AI 自动为您生成专业级视频、图片描述`},{icon:(0,$.jsx)(u6,{}),title:`一键生成视频、图片`,desc:`支持多种规格生成视频、图片`},{icon:(0,$.jsx)(u3,{}),title:`项目维度管理`,desc:`按项目行业分类视频、图片,支持多种行业`}],K={background:`#fff`,border:`1.5px solid #e2e8f0`,color:`#1e293b`,height:48,borderRadius:10,fontSize:14},q=e=>{e&&window.open(`${J7.replace(/\/api$/,``)}${e}`,`_blank`)};return(0,$.jsxs)(`div`,{style:{minHeight:`100vh`,display:`flex`,backgroundImage:`url(/backimage.png)`,backgroundSize:`cover`,backgroundPosition:`center`,backgroundRepeat:`no-repeat`,backgroundAttachment:`fixed`,position:`relative`,overflow:`hidden`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,inset:0,background:`linear-gradient(135deg, rgba(240,244,255,0.9) 0%, rgba(232,236,248,0.85) 40%, rgba(240,240,255,0.9) 70%, rgba(248,249,255,0.95) 100%)`}}),(0,$.jsx)(`div`,{style:{position:`absolute`,width:500,height:500,borderRadius:`50%`,background:`radial-gradient(circle, rgba(99,102,241,0.08) 0%, transparent 70%)`,top:-150,right:-100,filter:`blur(40px)`}}),(0,$.jsx)(`div`,{style:{position:`absolute`,width:400,height:400,borderRadius:`50%`,background:`radial-gradient(circle, rgba(139,92,246,0.06) 0%, transparent 70%)`,bottom:-100,left:-80,filter:`blur(50px)`}}),(0,$.jsx)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,justifyContent:`center`,padding:`0 80px`,zIndex:1},children:(0,$.jsxs)(kU,{direction:`vertical`,size:36,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:14,marginBottom:20},children:[k?(0,$.jsx)(`img`,{src:k,alt:`logo`,style:{width:52,height:52,borderRadius:14,objectFit:`contain`}}):(0,$.jsx)(`div`,{style:{width:52,height:52,borderRadius:14,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 8px 24px rgba(99,102,241,0.25)`},children:(0,$.jsx)(y8,{style:{fontSize:26,color:`#fff`}})}),(0,$.jsx)(`span`,{style:{color:`#1e293b`,fontSize:28,fontWeight:800,letterSpacing:-.5},children:D})]}),(0,$.jsx)(`div`,{className:`shiny-text-container`,children:(0,$.jsx)(`span`,{className:`shiny-text`,children:`AI赋能创意,素材触手可及`})}),(0,$.jsxs)(y1.Paragraph,{style:{color:`#64748b`,fontSize:17,maxWidth:480,lineHeight:1.8},children:[`专业的 AI 素材生成平台,通过智能提示词优化,`,(0,$.jsx)(`br`,{}),`让您的创意快速转化为精美视频、图片`]})]}),(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:20},children:ne.map((e,t)=>(0,$.jsxs)(`div`,{className:`electric-border-card`,style:{position:`relative`,display:`flex`,gap:16,alignItems:`flex-start`,padding:`18px 22px`,borderRadius:14,background:`rgba(255,255,255,0.85)`,backdropFilter:`blur(12px)`,overflow:`hidden`},children:[(0,$.jsx)(`div`,{className:`electric-border`}),(0,$.jsx)(`div`,{className:`electric-border-inner`}),(0,$.jsx)(`div`,{style:{position:`relative`,zIndex:1},children:(0,$.jsx)(`div`,{style:{width:44,height:44,borderRadius:12,flexShrink:0,background:`linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.15))`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#6366f1`,fontSize:20},children:e.icon})}),(0,$.jsxs)(`div`,{style:{position:`relative`,zIndex:1},children:[(0,$.jsx)(y1.Text,{style:{color:`#1e293b`,fontSize:15,fontWeight:600,display:`block`,marginBottom:4},children:e.title}),(0,$.jsx)(y1.Text,{style:{color:`#64748b`,fontSize:13,lineHeight:1.6},children:e.desc})]})]},t))})]})}),(0,$.jsx)(`div`,{style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:1,padding:`40px 24px`},children:(0,$.jsxs)(Wz,{style:{width:440,maxWidth:`100%`,borderRadius:20,boxShadow:`0 20px 60px rgba(0,0,0,0.08)`,border:`1px solid #e2e8f0`,background:`#fff`},styles:{body:{padding:`36px 28px`}},children:[(0,$.jsx)(y1.Title,{level:3,style:{textAlign:`center`,marginBottom:6,color:`#1e293b`,fontWeight:700},children:r===`register`?`创建账号`:`欢迎回来`}),(0,$.jsx)(y1.Text,{style:{display:`block`,textAlign:`center`,marginBottom:28,color:`#94a3b8`,fontSize:14},children:r===`register`?`注册新账号,开始创作视频`:`登录您的账号,开始创作视频`}),r!==`register`&&(0,$.jsx)(`div`,{style:{display:`flex`,gap:0,marginBottom:24,background:`#f1f5f9`,borderRadius:10,padding:4,border:`1px solid #e2e8f0`},children:[`password`,`phone`].map(e=>(0,$.jsx)(`div`,{onClick:()=>G(e),style:{flex:1,textAlign:`center`,padding:`10px 0`,borderRadius:8,cursor:`pointer`,fontSize:14,fontWeight:a===e?600:400,color:a===e?`#6366f1`:`#64748b`,background:a===e?`#fff`:`transparent`,border:a===e?`1px solid rgba(99,102,241,0.2)`:`1px solid transparent`,boxShadow:a===e?`0 2px 8px rgba(99,102,241,0.1)`:`none`,transition:`all 0.3s ease`},children:e===`password`?`密码登录`:`验证码登录`},e))}),r===`password`&&(0,$.jsxs)(CW,{form:L,size:`large`,layout:`vertical`,onFinish:V,children:[(0,$.jsx)(CW.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(iK,{prefix:(0,$.jsx)(B3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,style:K})}),(0,$.jsx)(CW.Item,{name:`password`,rules:[{required:!0,message:`请输入密码`}],children:(0,$.jsx)(iK.Password,{prefix:(0,$.jsx)(O3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入密码`,style:K})}),(0,$.jsx)(CW.Item,{name:`rememberMe`,valuePropName:`checked`,style:{marginBottom:12},children:(0,$.jsx)(xV,{children:`记住我的登录状态`})}),(0,$.jsx)(CW.Item,{style:{marginBottom:12},children:(0,$.jsx)(jD,{type:`primary`,htmlType:`submit`,loading:t,block:!0,style:{height:48,borderRadius:10,fontSize:16,fontWeight:600,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,boxShadow:`0 8px 24px rgba(99,102,241,0.25)`},children:`登 录`})})]}),r===`phone`&&(0,$.jsxs)(CW,{form:R,size:`large`,layout:`vertical`,children:[(0,$.jsx)(CW.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(iK,{prefix:(0,$.jsx)(B3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,maxLength:11,style:K})}),(0,$.jsx)(CW.Item,{name:`code`,rules:[{required:!0,message:`请输入验证码`}],children:(0,$.jsxs)(kU.Compact,{style:{width:`100%`},children:[(0,$.jsx)(iK,{prefix:(0,$.jsx)(O6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入验证码`,maxLength:6,disabled:!_,style:{...K,borderRadius:`10px 0 0 10px`,flex:1}}),(0,$.jsx)(jD,{disabled:s>0,onClick:()=>{w?(v(!1),m(!0),b(e=>e+1)):ee(R.getFieldValue(`phone`))},style:{height:48,borderRadius:`0 10px 10px 0`,background:s>0||_?`#f1f5f9`:`rgba(99,102,241,0.1)`,border:`1.5px solid #e2e8f0`,borderLeft:`none`,color:s>0?`#94a3b8`:`#6366f1`,fontWeight:600,minWidth:100},children:s>0?`${s}s`:w?`重新发送`:`获取验证码`})]})}),p&&(0,$.jsx)(CW.Item,{style:{marginBottom:12},children:(0,$.jsx)(X7,{onSuccess:te,isVerified:_})},y),(0,$.jsx)(CW.Item,{style:{marginBottom:12},children:(0,$.jsx)(jD,{type:`primary`,onClick:H,loading:t,block:!0,style:{height:48,borderRadius:10,fontSize:16,fontWeight:600,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,boxShadow:`0 8px 24px rgba(99,102,241,0.25)`},children:`登 录`})})]}),r===`register`&&(0,$.jsxs)(CW,{form:z,size:`large`,layout:`vertical`,children:[(0,$.jsx)(CW.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(iK,{prefix:(0,$.jsx)(B3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,maxLength:11,style:K})}),(0,$.jsx)(CW.Item,{name:`regCode`,rules:[{required:!0,message:`请输入验证码`}],children:(0,$.jsxs)(kU.Compact,{style:{width:`100%`},children:[(0,$.jsx)(iK,{prefix:(0,$.jsx)(O6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入验证码`,maxLength:6,disabled:!h,style:{...K,borderRadius:`10px 0 0 10px`,flex:1}}),(0,$.jsx)(jD,{disabled:l>0,onClick:()=>{x?(g(!1),m(!0),b(e=>e+1)):ee(z.getFieldValue(`phone`),!0)},style:{height:48,borderRadius:`0 10px 10px 0`,background:l>0||h?`#f1f5f9`:`rgba(99,102,241,0.1)`,border:`1.5px solid #e2e8f0`,borderLeft:`none`,color:l>0?`#94a3b8`:`#6366f1`,fontWeight:600,minWidth:100},children:l>0?`${l}s`:x?`重新发送`:`获取验证码`})]})}),p&&(0,$.jsx)(CW.Item,{style:{marginBottom:12},children:(0,$.jsx)(X7,{onSuccess:te,isVerified:h})},y),(0,$.jsx)(CW.Item,{name:`password`,rules:[{required:!0,message:`请设置密码`},{min:6,message:`密码至少6位`}],children:(0,$.jsx)(iK.Password,{prefix:(0,$.jsx)(O3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请设置密码(至少6位)`,style:K})}),(0,$.jsx)(CW.Item,{style:{marginBottom:12},children:(0,$.jsx)(jD,{type:`primary`,onClick:U,loading:t,block:!0,style:{height:48,borderRadius:10,fontSize:16,fontWeight:600,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,boxShadow:`0 8px 24px rgba(99,102,241,0.25)`},children:`注 册`})})]}),(0,$.jsx)(`div`,{style:{marginBottom:16},children:(0,$.jsx)(xV,{checked:d,onChange:e=>f(e.target.checked),children:(0,$.jsxs)(`span`,{style:{fontSize:13,color:`#64748b`},children:[`我已阅读并同意`,(0,$.jsx)(`span`,{onClick:e=>{e.stopPropagation(),q(j)},style:{color:`#6366f1`,cursor:`pointer`},children:`《用户协议》`}),`和`,(0,$.jsx)(`span`,{onClick:e=>{e.stopPropagation(),q(N)},style:{color:`#6366f1`,cursor:`pointer`},children:`《隐私政策》`})]})})}),(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`space-between`},children:r===`register`?(0,$.jsx)(y1.Text,{style:{fontSize:13,color:`#6366f1`,cursor:`pointer`},onClick:()=>{i(`password`),o(`password`),C(!1),T(!1),g(!1),m(!1),b(e=>e+1),z.resetFields()},children:`已有账号?去登录`}):(0,$.jsx)(y1.Text,{style:{fontSize:13,color:`#6366f1`,cursor:`pointer`},onClick:()=>{i(`register`),C(!1),T(!1),g(!1),m(!1),b(e=>e+1)},children:`没有账号?立即注册`})})]})})]})},X7=({onSuccess:e,isVerified:t})=>{let n=S.useRef(null),r=S.useRef(null),i=S.useRef(null),a=S.useRef(0),o=S.useRef(!1),[s,c]=S.useState(360),l=s-50;S.useEffect(()=>{let e=()=>{if(n.current){let e=n.current.offsetWidth;e>0&&c(e)}};e();let t=new ResizeObserver(e);return n.current&&t.observe(n.current),window.addEventListener(`resize`,e),()=>{t.disconnect(),window.removeEventListener(`resize`,e)}},[]);let u=n=>{if(o.current||t)return;let c=Math.max(0,Math.min(n,l));a.current=c,r.current&&(r.current.style.left=`${c}px`),i.current&&(i.current.style.width=`${c+50}px`),c>=l-5&&(o.current=!0,r.current&&(r.current.style.background=`#22c55e`,r.current.innerHTML=``),i.current&&(i.current.style.width=`${s}px`,i.current.style.background=`#dcfce7`),e())};return(0,$.jsxs)(`div`,{ref:n,onMouseDown:e=>{if(e.preventDefault(),o.current||t)return;let s=n.current;if(!s)return;let c=s.getBoundingClientRect(),d=e=>{u(e.clientX-c.left-50/2)},f=()=>{document.removeEventListener(`mousemove`,d),document.removeEventListener(`mouseup`,f),!o.current&&a.current({page:1,pageSize:10,total:0,items:[]}),Q7=t5((e,t)=>({projects:[],records:Z7(),loading:!1,mediaType:`image`,countType:`请选择`,selectedRatio:`1:1`,selectedResolution:`2K`,width:2048,height:2048,videoDuration:5,videoAspectRatio:`16:9`,videoResolution:`720p`,engineOptions:{ratios:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:[`480p`,`720p`,`1080p`],durations:[5,8,10,12,15]},enginesele:[],fetchProjects:async()=>{e({loading:!0});try{e({projects:await w5(),loading:!1})}catch{e({loading:!1})}},createProject:async(n,r)=>{let i=await T5(n,r);return e({projects:[i,...t().projects]}),i},deleteProject:async n=>{await E5(n),e({projects:t().projects.filter(e=>e.id!==n)})},fetchRecords:async(t={})=>{e({loading:!0});try{e({records:await D5(t),loading:!1})}catch{e({loading:!1})}},optimizePrompt:async(n,r)=>{let i=await O5(n,r);try{await B7.getState().checkAuth()}catch{}let a=t().records;return e({records:{...a,total:a.total+1,items:[i.record,...a.items]}}),i},generateVideo:async(n,r)=>{let i=await N5(n,r);try{await B7.getState().checkAuth()}catch{}let a=t().records;return e({records:{...a,items:a.items.map(e=>e.id===n?i:e)}}),i},updateRecordReferences:(n,r)=>{let i=t().records;e({records:{...i,items:i.items.map(e=>e.id===n?{...e,references:r}:e)}})},setMediaType:t=>e({mediaType:t}),setCountType:t=>e({countType:t}),setImageSettings:(t,n,r,i)=>e({selectedRatio:t,selectedResolution:n,width:r,height:i}),setVideoSettings:(t,n,r)=>e({videoDuration:t,videoAspectRatio:n,videoResolution:r}),setEngineOptions:t=>e({engineOptions:t}),setSelectedRatio:t=>e({selectedRatio:t}),setSelectedResolution:t=>e({selectedResolution:t}),setWidth:t=>e({width:t}),setHeight:t=>e({height:t}),setVideoDuration:t=>e({videoDuration:t}),setVideoAspectRatio:t=>e({videoAspectRatio:t}),setVideoResolution:t=>e({videoResolution:t}),setEnginesele:t=>e({enginesele:t}),resetGenerationConfig:()=>e({mediaType:`image`,countType:`请选择`,selectedRatio:`1:1`,selectedResolution:`2K`,width:2048,height:2048,videoDuration:5,videoAspectRatio:`16:9`,videoResolution:`720p`,engineOptions:{ratios:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:[`480p`,`720p`,`1080p`],durations:[5,8,10,12,15]},enginesele:[]})}));function $7(e){if(!e)return`-`;let t=e.trim();t.includes(`T`)||(t=t.replace(` `,`T`));let n=t.indexOf(`.`);return n>0&&(t=t.slice(0,n)),t=t.replace(/[+-]\d{2}:?\d{0,2}$/,``).replace(/Z$/,``),t.replace(`T`,` `).slice(0,16)}var e9=[`#f97316`,`#3b82f6`,`#8b5cf6`,`#10b981`,`#eab308`,`#6366f1`,`#ef4444`,`#06b6d4`,`#64748b`,`#78716c`],t9={ShoppingCartOutlined:(0,$.jsx)(B6,{}),BookOutlined:(0,$.jsx)(j2,{}),HomeOutlined:(0,$.jsx)(p3,{}),FireOutlined:(0,$.jsx)(K4,{}),RocketOutlined:(0,$.jsx)(T6,{}),SkinOutlined:(0,$.jsx)(Y6,{}),CompassOutlined:(0,$.jsx)(y4,{}),HeartOutlined:(0,$.jsx)(i3,{}),CarOutlined:(0,$.jsx)(K2,{}),CameraOutlined:(0,$.jsx)(U2,{}),CloudOutlined:(0,$.jsx)(i4,{}),StarOutlined:(0,$.jsx)(s8,{}),TrophyOutlined:(0,$.jsx)(T8,{}),ThunderboltOutlined:(0,$.jsx)(y8,{}),BulbOutlined:(0,$.jsx)(L2,{}),CoffeeOutlined:(0,$.jsx)(g4,{}),CrownOutlined:(0,$.jsx)(T4,{}),DashboardOutlined:(0,$.jsx)(O4,{}),FlagOutlined:(0,$.jsx)(Y4,{}),GlobalOutlined:(0,$.jsx)(t3,{}),GiftOutlined:(0,$.jsx)(Q4,{}),LaptopOutlined:(0,$.jsx)(y3,{}),MobileOutlined:(0,$.jsx)(B3,{}),MonitorOutlined:(0,$.jsx)(U3,{}),PayCircleOutlined:(0,$.jsx)(Y3,{}),PictureOutlined:(0,$.jsx)(t6,{}),PlayCircleOutlined:(0,$.jsx)(u6,{}),SafetyOutlined:(0,$.jsx)(O6,{}),ShoppingOutlined:(0,$.jsx)(U6,{}),SmileOutlined:(0,$.jsx)(Q6,{}),SoundOutlined:(0,$.jsx)(i8,{}),TagOutlined:(0,$.jsx)(p8,{}),TeamOutlined:(0,$.jsx)(g8,{}),ToolOutlined:(0,$.jsx)(S8,{}),TruckOutlined:(0,$.jsx)(O8,{}),VideoCameraOutlined:(0,$.jsx)(L8,{}),WalletOutlined:(0,$.jsx)(B8,{}),BankOutlined:(0,$.jsx)(S2,{}),BuildOutlined:(0,$.jsx)(P2,{}),ExperimentOutlined:(0,$.jsx)(L4,{}),HighlightOutlined:(0,$.jsx)(s3,{}),IdcardOutlined:(0,$.jsx)(g3,{}),MedicineBoxOutlined:(0,$.jsx)(L3,{}),ReadOutlined:(0,$.jsx)(g6,{}),RestOutlined:(0,$.jsx)(y6,{}),SketchOutlined:(0,$.jsx)(K6,{}),SolutionOutlined:(0,$.jsx)(t8,{})},n9=()=>{let[e,t]=(0,S.useState)(!1),[n]=CW.useForm(),r=qe(),{projects:i,fetchProjects:a,createProject:o,deleteProject:s}=Q7(),[c,l]=(0,S.useState)([]);(0,S.useEffect)(()=>{a(),H5().then(l).catch(()=>{})},[]);let u=Object.fromEntries(c.map((e,t)=>[e.key,{label:e.label,color:e9[t%e9.length],icon:e.icon||`AppstoreOutlined`}]));return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`animate-fadeInUp`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:24,padding:`22px 24px`,borderRadius:16,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,position:`relative`,overflow:`hidden`,flexWrap:`wrap`,gap:12},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,right:-20,top:-20,width:200,height:200,borderRadius:`50%`,background:`rgba(255,255,255,0.08)`}}),(0,$.jsxs)(`div`,{style:{position:`relative`,zIndex:1},children:[(0,$.jsx)(y1.Title,{level:3,style:{margin:`0 0 4px`,color:`#fff`,fontWeight:700},children:`我的项目`}),(0,$.jsxs)(y1.Text,{style:{color:`rgba(255,255,255,0.7)`,fontSize:14},children:[`共 `,i.length,` 个项目 · 按行业分类管理`]})]}),(0,$.jsx)(jD,{icon:(0,$.jsx)(MR,{}),onClick:()=>t(!0),size:`large`,style:{background:`rgba(255,255,255,0.15)`,border:`1px solid rgba(255,255,255,0.3)`,color:`#fff`,fontWeight:600,backdropFilter:`blur(10px)`,borderRadius:10,height:42},children:`新建项目`})]}),i.length===0?(0,$.jsx)(GC,{image:GC.PRESENTED_IMAGE_SIMPLE,description:`还没有项目,创建您的第一个视频项目`,style:{padding:`60px 0`},children:(0,$.jsx)(jD,{type:`primary`,icon:(0,$.jsx)(MR,{}),onClick:()=>t(!0),size:`large`,children:`创建第一个项目`})}):(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},className:`stagger-children`,children:i.map((e,t)=>(0,$.jsxs)(`div`,{className:`project-card project-item animate-slideInCard`,onClick:()=>r(`/projects/${e.id}/generate`),style:{display:`flex`,alignItems:`center`,padding:`18px 22px`,borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,cursor:`pointer`,animationDelay:`${t*.06}s`},children:[(0,$.jsx)(`div`,{style:{width:50,height:50,borderRadius:14,flexShrink:0,background:`${u[e.industry]?.color||`#64748b`}12`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:24,marginRight:16,color:u[e.industry]?.color||`#64748b`},children:t9[u[e.industry]?.icon]||(0,$.jsx)(i2,{})}),(0,$.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:4,flexWrap:`wrap`},children:[(0,$.jsx)(y1.Text,{strong:!0,style:{fontSize:15,color:`#1a1a2e`},children:e.name}),(0,$.jsx)(v$,{color:u[e.industry]?.color||`#64748b`,style:{borderRadius:6,margin:0},children:u[e.industry]?.label||e.industry})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,$.jsx)(VH,{style:{fontSize:12,color:`#94a3b8`}}),(0,$.jsxs)(`span`,{className:`date-display`,translate:`no`,style:{fontSize:12,color:`#94a3b8`},children:[`创建于 `,$7(e.createdAt)]})]})]}),(0,$.jsxs)(`div`,{className:`project-actions`,style:{display:`flex`,alignItems:`center`,gap:8,marginLeft:16},children:[(0,$.jsx)(jD,{type:`primary`,icon:(0,$.jsx)(u6,{}),onClick:t=>{t.stopPropagation(),r(`/projects/${e.id}/generate`)},style:{background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`,borderRadius:10,fontWeight:600,height:36,boxShadow:`0 4px 12px rgba(99,102,241,0.25)`},children:`生成`}),(0,$.jsx)(Mq,{title:`确定删除该项目?`,description:`项目下的生成记录将一并删除`,onConfirm:async t=>{t?.stopPropagation(),await s(e.id),Q.success(`项目已删除`)},onCancel:e=>e?.stopPropagation(),children:(0,$.jsx)(jD,{danger:!0,icon:(0,$.jsx)(x$,{}),onClick:e=>e.stopPropagation(),style:{borderRadius:10,height:36,background:`rgba(239,68,68,0.06)`,border:`1px solid rgba(239,68,68,0.15)`,color:`#ef4444`}})}),(0,$.jsx)(Bg,{className:`mobile-hide`,style:{color:`#cbd5e1`,fontSize:12}})]})]},e.id))}),(0,$.jsx)(Oq,{title:(0,$.jsxs)(kU,{children:[(0,$.jsx)(i2,{}),`新建项目`]}),open:e,onOk:async()=>{try{let e=await n.validateFields(),i=await o(e.name,e.industry);Q.success(`项目创建成功`),t(!1),n.resetFields(),r(`/projects/${i.id}/generate`)}catch{}},onCancel:()=>{t(!1),n.resetFields()},okText:`创建`,cancelText:`取消`,width:480,children:(0,$.jsxs)(CW,{form:n,layout:`vertical`,style:{marginTop:20},children:[(0,$.jsx)(CW.Item,{name:`name`,label:`项目名称`,rules:[{required:!0,message:`请输入项目名称`}],children:(0,$.jsx)(iK,{placeholder:`例如:618电商大促宣传片`,prefix:(0,$.jsx)(hZ,{}),size:`large`})}),(0,$.jsx)(CW.Item,{name:`industry`,label:`所属行业`,rules:[{required:!0,message:`请选择行业`}],children:(0,$.jsx)(xw,{placeholder:`选择项目所属行业`,size:`large`,children:c.map((e,t)=>(0,$.jsx)(xw.Option,{value:e.key,children:(0,$.jsxs)(kU,{children:[t9[e.icon]||(0,$.jsx)(i2,{}),` `,e.label]})},e.key))})})]})})]})};function r9(){if(typeof crypto<`u`&&typeof crypto.randomUUID==`function`)return crypto.randomUUID();if(typeof crypto<`u`&&typeof crypto.getRandomValues==`function`){let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}return`${Date.now().toString(16).padStart(12,`0`)}-${Math.random().toString(16).slice(2,10).padStart(8,`0`)}-4xxx-yxxx-${Math.random().toString(16).slice(2,12)}`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}var i9=({src:e,width:t=48,height:n=48})=>{let[r,i]=(0,S.useState)(null),[a,o]=(0,S.useState)(null);return(0,S.useEffect)(()=>{let r=document.createElement(`video`);r.muted=!0,r.preload=`metadata`,r.crossOrigin=`anonymous`;let a=()=>{o(r.duration),r.currentTime=Math.min(1,r.duration*.1)},s=()=>{try{let e=document.createElement(`canvas`);e.width=t*2,e.height=n*2;let a=e.getContext(`2d`);a&&(a.drawImage(r,0,0,e.width,e.height),i(e.toDataURL(`image/jpeg`,.7)))}catch{}};return r.addEventListener(`loadedmetadata`,a),r.addEventListener(`seeked`,s),r.src=e,()=>{r.removeEventListener(`loadedmetadata`,a),r.removeEventListener(`seeked`,s)}},[e,t,n]),(0,$.jsxs)(`div`,{style:{width:`100%`,height:`100%`,position:`relative`,background:`#1a1a2e`},children:[r?(0,$.jsx)(`img`,{src:r,style:{width:`100%`,height:`100%`,objectFit:`cover`,display:`block`}}):(0,$.jsx)(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(u6,{style:{color:`#fff`,fontSize:18}})}),a!=null&&(0,$.jsx)(`span`,{style:{position:`absolute`,bottom:2,right:2,fontSize:9,color:`#fff`,background:`rgba(0,0,0,0.6)`,borderRadius:4,padding:`1px 4px`,lineHeight:1.3},children:(e=>`${Math.round(e)}s`)(a)})]})},a9=()=>{let{projectId:e}=Ze(),t=qe(),[n]=CW.useForm(),{projects:r,records:i,fetchProjects:a,fetchRecords:o,optimizePrompt:s,generateVideo:c}=Q7(),l=i.items,{user:u}=B7(),[d,f]=(0,S.useState)(!1),[p,m]=(0,S.useState)(!1),[h,g]=(0,S.useState)(null),[_,v]=(0,S.useState)(``),[y,b]=(0,S.useState)(!1),[x,C]=(0,S.useState)({}),[w,T]=(0,S.useState)({}),[E,D]=(0,S.useState)({}),[O,k]=(0,S.useState)(null),[A,j]=(0,S.useState)(null),[M,N]=(0,S.useState)([]),[P,F]=(0,S.useState)(!1),[I,L]=(0,S.useState)(``),[R,z]=(0,S.useState)(!1),[B,V]=(0,S.useState)(``),H=(0,S.useRef)(null),[U,W]=(0,S.useState)({}),[ee,te]=(0,S.useState)({}),[G,ne]=(0,S.useState)({}),[K,q]=(0,S.useState)(null),[J,re]=(0,S.useState)({}),[Y,ie]=(0,S.useState)(null),[ae,oe]=(0,S.useState)(5),[se,ce]=(0,S.useState)(`16:9`),[le,ue]=(0,S.useState)(`720p`),[de,fe]=(0,S.useState)(null),[pe,me]=(0,S.useState)({ratios:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:[`720p`,`1080p`],durations:[5,8,10,12,15]}),[he,ge]=(0,S.useState)(0),[_e,ve]=(0,S.useState)(0),[ye,be]=(0,S.useState)(`image`),[xe,Se]=(0,S.useState)(`1:1`),[Ce,we]=(0,S.useState)(`2K`),[Te,Ee]=(0,S.useState)(2048),[De,Oe]=(0,S.useState)(2048),[ke,Ae]=(0,S.useState)(!1),[je,Me]=(0,S.useState)([]),[Ne,Pe]=(0,S.useState)([]);(0,S.useEffect)(()=>{if(X5().then(e=>{Me(e.video),Pe(e.image)}),!ke)return;let e=e=>{let t=e.target;!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&Ae(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[ke]);let Fe=(e,t)=>{for(let n=0;n{let t=e===`2k`?`2048`:e===`4k`?`4096`:e;for(let e=0;e{Ke(e)},Re=e=>{Ye(parseInt(e))},[ze,Be]=(0,S.useState)([]),[Ve,He]=(0,S.useState)([]),[Ue,We]=(0,S.useState)([]),[Ge,Ke]=(0,S.useState)(0),[Je,Ye]=(0,S.useState)(0);(0,S.useEffect)(()=>{Ue[Je]&&Ue[Je][Ge]!==void 0&&(Ee(Ue[Je][Ge].substring(0,4)),Oe(Ue[Je][Ge].substring(5)))},[Ge]),(0,S.useEffect)(()=>{Ue[Je]&&Ue[Je][Ge]!==void 0&&(Ee(Ue[Je][Ge].substring(0,4)),Oe(Ue[Je][Ge].substring(5)))},[Je]);let Xe=()=>{Ee(De),Oe(Te)},Qe=e=>{be(e.target.value===`image`?`image`:`video`)};(0,S.useEffect)(()=>{H5().then(e=>{W(Object.fromEntries(e.map(e=>[e.key,e.label]))),te(Object.fromEntries(e.map(e=>[e.key,e.optionGroups||[]])))}).catch(()=>{}),L5().then(e=>{let t=e.items?.[0]?.supportedSizes||{},n=[],r=[],i=[];for(let e in t[`2K`])n.push(e),r.push(t[`2K`][e]);n.forEach((e,t)=>{Be(n=>[...n,{value:e,label:String(t)}])});for(let e in t[`4K`])i.push(t[`4K`][e]);We([r,i]);let a=[];for(let e in t)a.push(e);a.forEach((e,t)=>{He(n=>[...n,{value:e,label:String(t)}])})}).catch(()=>{}),I5().then(e=>{if(e.items?.length){let t=e.items[0];me({ratios:t.supportedRatios?.length?t.supportedRatios:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:t.supportedResolutions?.length?t.supportedResolutions:[`720p`,`1080p`],durations:t.supportedDurations?.length?t.supportedDurations:[5,8,10,12,15]})}}).catch(()=>{})},[]),(0,S.useEffect)(()=>{a(),o({projectId:e,page:1,pageSize:100})},[e,a,o]);let $e=(0,S.useRef)(!1);(0,S.useEffect)(()=>{$e.current||l.length===0||($e.current=!0,console.log(`aaaa`,l),l.forEach(t=>{t.projectId===e&&t.status===`generating`&&(T(e=>({...e,[t.id]:`generating`})),Et(t.id)),t.projectId===e&&t.status===`optimizing`&&st(t.id)}))},[l,e]);let et=(0,S.useRef)(new Set),tt=(0,S.useRef)(null),nt=(0,S.useRef)(null),rt=e=>{et.current.add(e),ot()},it=e=>{et.current.delete(e),et.current.size===0&&at()},at=()=>{tt.current&&=(clearInterval(tt.current),null),nt.current&&=(nt.current.abort(),null)},ot=()=>{tt.current||=setInterval(async()=>{try{nt.current&&nt.current.abort();let t=new AbortController;nt.current=t;let n=await D5({projectId:e,page:1,pageSize:100,signal:t.signal});nt.current=null;let r=Array.from(et.current),i=[];if(r.length>0){let e=Q7.getState().records,t=e.items.map(e=>{if(r.includes(e.id)){let t=n.items.find(t=>t.id===e.id);if(t)return t.status!==`optimizing`&&i.push(e.id),t}return e});Q7.setState({records:{...e,items:t}}),i.forEach(e=>{it(e)})}}catch(e){e.name!==`AbortError`&&console.error(`Optimizing polling error:`,e)}},3e3)},st=e=>{rt(e)},ct=(0,S.useRef)(!1),lt=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(ct.current||l.length===0)return;let t=localStorage.getItem(`pending_optimize`);if(t)try{let{key:n,projectId:r,prompt:i,duration:a,ts:o}=JSON.parse(t);if(Date.now()-o>300*1e3||r!==e){localStorage.removeItem(`pending_optimize`);return}if(lt.current===n)return;let s=l.find(e=>e.projectId===r&&e.originalPrompt===i&&e.duration===a&&e.status===`prompt_optimized`&&new Date(e.createdAt).getTime()>o-1e4);s?(ct.current=!0,localStorage.removeItem(`pending_optimize`),g(s),v(s.optimizedPrompt||``),ge(s.textCreditsCost),ve(s.textTokensUsed),m(!0),Q.success({content:`优化请求已恢复,消耗 ${s.textCreditsCost} 积分`,key:`recovery`})):Date.now()-o>3e4&&localStorage.removeItem(`pending_optimize`)}catch{localStorage.removeItem(`pending_optimize`)}},[l,e]);let ut=r.find(t=>t.id===e),dt=l.filter(t=>t.projectId===e),ft=ut?.name??`项目`,pt=ut&&ee[ut.industry]||[],mt=u?.credits??0,ht=e=>{let t=e===`2k`?`2048`:e===`4k`?`4096`:e;for(let e=0;e=gt,vt=async()=>{try{if(!e){Q.error(`项目ID为空,请先选择项目`);return}let t=await n.validateFields();if(!t.prompt||!t.prompt.trim()){Q.error(`请输入视频/图片描述`);return}f(!0);let r=Object.entries(G).map(([e,t])=>`@${e}:${t}`),i=r.length>0?`${t.prompt}\n\n${r.join(`;`)}`:t.prompt,a=r9();localStorage.setItem(`pending_optimize`,JSON.stringify({key:a,projectId:e,prompt:i,duration:ae,ts:Date.now()})),lt.current=a;let o=await s(e,{prompt:i,duration:ae,genType:ye,resolution:Ce,references:M.length>0?M:void 0,idempotencyKey:a,image_size:Ce,image_proportion:xe,image_px:Te+`x`+De});localStorage.removeItem(`pending_optimize`),lt.current=null,g(o.record),v(o.record.optimizedPrompt||``),ge(o.textCreditsCost),ve(o.textTokensUsed),m(!0),Q.success({content:`「${ft}」提示词优化完成,消耗 ${o.textCreditsCost} 积分`,key:`optimize`})}catch(e){console.error(`优化提示词失败:`,e);let t=e?.response?.data?.message||e?.message||`操作失败,请稍后重试`;Q.error(t)}finally{f(!1),localStorage.removeItem(`pending_optimize`),lt.current=null}},yt=(0,S.useRef)(new Set),bt=(0,S.useRef)(null),xt=(0,S.useRef)(null),St=e=>{yt.current.add(e),Tt()},Ct=e=>{yt.current.delete(e),yt.current.size===0&&wt()},wt=()=>{bt.current&&=(clearInterval(bt.current),null),xt.current&&=(xt.current.abort(),null)},Tt=()=>{bt.current||=setInterval(async()=>{try{xt.current&&xt.current.abort();let t=new AbortController;xt.current=t;let n=await D5({projectId:e,page:1,pageSize:100,signal:t.signal});xt.current=null;let r=Array.from(yt.current),i=[];if(r.length>0){let e=Q7.getState().records,t=e.items.map(e=>{if(r.includes(e.id)){let t=n.items.find(t=>t.id===e.id);if(t)return t.status!==`generating`&&i.push(e.id),t}return e});Q7.setState({records:{...e,items:t}}),i.forEach(e=>{let t=n.items.find(t=>t.id===e);Ct(e),t?.status===`completed`?(T(t=>({...t,[e]:`done`})),g(n=>n?.id===e?t:n),Q.success({content:`「${ft}」视频生成完成!`,key:e,duration:5})):t?.status===`failed`&&(T(t=>({...t,[e]:`failed`})),g(n=>n?.id===e?t:n),Q.error({content:`「${ft}」视频生成失败: ${t.errorMessage||`未知错误`}`,key:e,duration:5}))})}}catch(e){e.name!==`AbortError`&&console.error(`Global polling error:`,e)}},5e3)},Et=e=>{St(e)};(0,S.useEffect)(()=>()=>{wt(),at()},[]);let Dt=async e=>{if(!_t){Q.error(`积分不足,请先充值`);return}C(t=>({...t,[e]:!0})),T(t=>({...t,[e]:`generating`})),Q.loading({content:`「${ft}」正在提交视频生成...`,duration:0,key:e});try{(await c(e,{aspectRatio:se,resolution:le})).status===`failed`?(T(t=>({...t,[e]:`failed`})),Q.error({content:`「${ft}」提交失败`,key:e,duration:3})):(Q.success({content:`「${ft}」已提交,正在生成中...`,key:e,duration:3}),Et(e))}catch(t){T(t=>({...t,[e]:`failed`}));let n=`提交失败`;t?.response?.data?.detail?n=t.response.data.detail:t?.data?.detail?n=t.data.detail:t?.detail?n=t.detail:t?.message&&(n=t.message),Q.error({content:`${n}`,key:e,duration:3})}finally{C(t=>({...t,[e]:!1}))}},Ot=async e=>{let t=dt.find(t=>t.id===e);if(t){C(t=>({...t,[e]:!0})),T(t=>({...t,[e]:`generating`})),Q.loading({content:`「${ft}」正在重新提交...`,duration:0,key:e});try{let n=E[e];n&&n!==t.optimizedPrompt&&await M5(e,n);let r=await c(e,{aspectRatio:t.aspectRatio||`16:9`,resolution:t.resolution||`720p`});console.log(`重新提交视频生成结果:`,r),r.status===`failed`?(T(t=>({...t,[e]:`failed`})),console.log(`12312`),Q.error({content:`「${ft}」提交失败`,key:e,duration:3})):(Q.success({content:`「${ft}」已提交,正在生成中...`,key:e,duration:3}),Et(e))}catch(t){T(t=>({...t,[e]:`failed`})),console.log(`1231`,t);let n=`提交失败`;t?.response?.data?.detail?n=t.response.data.detail:t?.data?.detail?n=t.data.detail:t?.detail?n=t.detail:t?.message&&(n=t.message),Q.error({content:`${n}`,key:e,duration:3})}finally{C(t=>({...t,[e]:!1}))}}},kt=e=>{let t=w[e.id];return t===`generating`?`generating`:t===`done`?`completed`:t===`failed`?`failed`:e.status},At={optimizing:{color:`processing`,text:`优化中`,icon:(0,$.jsx)(qm,{style:{animation:`spinSlow 1s linear infinite`}})},prompt_optimized:{color:`processing`,text:`待生成`,icon:(0,$.jsx)(WH,{})},generating:{color:`warning`,text:`生成中`,icon:(0,$.jsx)(qm,{style:{animation:`spinSlow 1s linear infinite`}})},completed:{color:`success`,text:`已完成`,icon:(0,$.jsx)(Q2,{})},failed:{color:`error`,text:`失败`,icon:(0,$.jsx)(t4,{})}},jt=({label:e,value:t,options:n,suffix:r,expanded:i,onToggle:a,onSelect:o,onClose:s})=>{let c=(0,S.useRef)(null),l=(0,S.useRef)(null),u=(0,S.useRef)(i),[d,f]=(0,S.useState)(null);return u.current=i,(0,S.useEffect)(()=>{if(i&&c.current){let e=c.current.getBoundingClientRect();f({bottom:window.innerHeight-e.top+4,left:e.left,width:Math.max(e.width,100)})}else f(null)},[i]),(0,S.useEffect)(()=>{if(!i)return;let e=e=>{c.current?.contains(e.target)||l.current?.contains(e.target)||u.current&&s()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i,s]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{ref:c,onClick:a,translate:`no`,style:{display:`flex`,alignItems:`center`,gap:6,padding:`5px 12px`,borderRadius:8,cursor:`pointer`,userSelect:`none`,transition:`background 0.2s, border-color 0.2s`,background:i?`rgba(99,102,241,0.08)`:`#f8f9fc`,border:i?`1px solid #6366f1`:`1px solid #e2e8f0`,minWidth:70,whiteSpace:`nowrap`,flexShrink:0},children:[(0,$.jsxs)(`span`,{style:{fontSize:12,color:`#6366f1`,fontWeight:500,lineHeight:`18px`},children:[t,r]}),(0,$.jsx)(vQ,{style:{fontSize:9,color:`#94a3b8`,transition:`transform 0.2s`,transform:i?`rotate(180deg)`:`rotate(0deg)`}})]}),d&&(0,Ri.createPortal)((0,$.jsxs)(`div`,{ref:l,style:{position:`fixed`,bottom:d.bottom,left:d.left,minWidth:d.width,background:`#fff`,borderRadius:12,padding:6,zIndex:99999,boxShadow:`0 8px 30px rgba(0,0,0,0.12)`,border:`1px solid #e2e8f0`},children:[(0,$.jsx)(y1.Text,{style:{fontSize:10,color:`#94a3b8`,display:`block`,padding:`2px 6px 4px`},children:e}),(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2},children:n.map((e,n)=>{let r=t===e;return(0,$.jsx)(`div`,{onClick:()=>{o(e),s()},style:{padding:`6px 10px`,borderRadius:8,fontSize:13,cursor:`pointer`,transition:`all 0.15s`,background:r?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`transparent`,color:r?`#fff`:`#1a1a2e`,fontWeight:r?600:400},onMouseEnter:e=>{r||(e.currentTarget.style.background=`#f1f5f9`)},onMouseLeave:e=>{r||(e.currentTarget.style.background=`transparent`)},children:e},n)})})]}),document.body)]})},Mt=({group:e,selected:t,expanded:n,onToggle:r,onSelect:i,onClose:a})=>{let o=(0,S.useRef)(null),s=(0,S.useRef)(null),c=(0,S.useRef)(n),[l,u]=(0,S.useState)(null);return c.current=n,(0,S.useEffect)(()=>{if(n&&o.current){let e=o.current.getBoundingClientRect();u({bottom:window.innerHeight-e.top+4,left:e.left})}else u(null)},[n]),(0,S.useEffect)(()=>{if(!n)return;let e=e=>{o.current?.contains(e.target)||s.current?.contains(e.target)||c.current&&a()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[n,a]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{ref:o,onClick:r,style:{display:`flex`,alignItems:`center`,gap:6,padding:`5px 12px`,borderRadius:8,cursor:`pointer`,userSelect:`none`,transition:`all 0.2s`,background:t?`rgba(99,102,241,0.08)`:`#f8f9fc`,border:n?`1px solid #6366f1`:`1px solid #e2e8f0`},children:[(0,$.jsx)(y1.Text,{style:{fontSize:12,color:t?`#6366f1`:`#64748b`,fontWeight:t?600:400},children:t||e.name}),(0,$.jsx)(vQ,{style:{fontSize:9,color:t?`#6366f1`:`#94a3b8`,transition:`transform 0.2s`,transform:n?`rotate(180deg)`:`rotate(0deg)`}})]}),l&&(0,Ri.createPortal)((0,$.jsxs)(`div`,{ref:s,style:{position:`fixed`,bottom:l.bottom,left:l.left,background:`#fff`,borderRadius:12,padding:8,minWidth:160,zIndex:99999,boxShadow:`0 8px 30px rgba(0,0,0,0.12)`,border:`1px solid #e2e8f0`},children:[(0,$.jsx)(y1.Text,{style:{fontSize:10,color:`#94a3b8`,display:`block`,padding:`2px 6px 4px`},children:e.name}),(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2},children:e.options.map((e,n)=>{let r=t===e;return(0,$.jsx)(`div`,{onClick:()=>{i(e),a()},style:{padding:`6px 10px`,borderRadius:8,fontSize:13,cursor:`pointer`,transition:`all 0.15s`,background:r?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`transparent`,color:r?`#fff`:`#1a1a2e`,fontWeight:r?600:400},onMouseEnter:e=>{r||(e.currentTarget.style.background=`#f1f5f9`)},onMouseLeave:e=>{r||(e.currentTarget.style.background=`transparent`)},children:e},n)})})]}),document.body)]})};return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`gen-header animate-fadeInUp`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:24,padding:`20px 28px`,borderRadius:16,background:`linear-gradient(135deg, #1e1b4b 0%, #312e81 100%)`,position:`relative`,overflow:`hidden`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,right:-30,bottom:-30,width:160,height:160,borderRadius:`50%`,background:`rgba(255,255,255,0.05)`}}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:14,position:`relative`},children:[(0,$.jsx)(jD,{icon:(0,$.jsx)(u2,{}),onClick:()=>t(`/projects`),style:{background:`rgba(255,255,255,0.1)`,border:`1px solid rgba(255,255,255,0.2)`,color:`#fff`,borderRadius:10}}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,$.jsx)(y1.Title,{level:4,style:{margin:0,color:`#fff`,fontWeight:700},children:ft}),ut&&(0,$.jsx)(v$,{style:{background:`rgba(255,255,255,0.12)`,border:`1px solid rgba(255,255,255,0.2)`,color:`rgba(255,255,255,0.8)`,borderRadius:6},children:U[ut.industry]||ut.industry})]}),(0,$.jsx)(y1.Text,{style:{color:`rgba(255,255,255,0.5)`,fontSize:13},children:`描述视频 → AI优化 → 生成视频`})]})]}),(0,$.jsxs)(v$,{style:{background:`rgba(255,255,255,0.1)`,border:`1px solid rgba(255,255,255,0.2)`,color:`#fff`,borderRadius:20,fontSize:13,padding:`4px 14px`},children:[`剩余 `,mt,` 积分`]})]}),!p&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`animate-fadeInUp`,style:{marginBottom:24,padding:`16px 20px`,borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,boxShadow:`0 2px 12px rgba(0,0,0,0.03)`},children:(0,$.jsxs)(`div`,{style:{width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`flex-start`},children:[(0,$.jsxs)(`div`,{style:{marginRight:70,position:`relative`},children:[(0,$.jsx)(y1.Text,{style:{fontSize:14,fontWeight:500,color:`#475569`,marginRight:16},children:`生成类型:`}),(0,$.jsxs)(GL.Group,{defaultValue:`image`,buttonStyle:`solid`,onChange:Qe,children:[(0,$.jsxs)(GL.Button,{value:`image`,style:{zIndex:0},children:[(0,$.jsx)(t6,{style:{marginRight:6,fontSize:14}}),` `,`图片`]}),(0,$.jsxs)(GL.Button,{value:`video`,children:[(0,$.jsx)(L8,{style:{marginRight:6,fontSize:14}}),` `,`视频`]})]})]}),ye===`video`&&[{icon:(0,$.jsx)(w$,{}),label:`描述视频+时长`,color:`#6366f1`},{icon:(0,$.jsx)(y8,{}),label:`AI智能优化`,color:`#8b5cf6`},{icon:(0,$.jsx)(T6,{}),label:`选择参数生成`,color:`#10b981`}].map((e,t)=>(0,$.jsxs)(S.Fragment,{children:[t>0&&(0,$.jsx)(`div`,{style:{width:40,height:1,background:`linear-gradient(90deg, #e2e8f0, #cbd5e1, #e2e8f0)`,margin:`0 12px`,flexShrink:0}}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:10,background:`${e.color}12`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(`span`,{style:{color:e.color,fontSize:15},children:e.icon})}),(0,$.jsx)(y1.Text,{style:{fontSize:13,fontWeight:500,color:`#1a1a2e`},children:e.label})]})]},t)),ye===`image`&&[{icon:(0,$.jsx)(w$,{}),label:`描述图片+尺寸`,color:`#6366f1`},{icon:(0,$.jsx)(y8,{}),label:`AI智能优化`,color:`#8b5cf6`},{icon:(0,$.jsx)(T6,{}),label:`图片生成`,color:`#10b981`}].map((e,t)=>(0,$.jsxs)(S.Fragment,{children:[t>0&&(0,$.jsx)(`div`,{style:{width:40,height:1,background:`linear-gradient(90deg, #e2e8f0, #cbd5e1, #e2e8f0)`,margin:`0 12px`,flexShrink:0}}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:10,background:`${e.color}12`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(`span`,{style:{color:e.color,fontSize:15},children:e.icon})}),(0,$.jsx)(y1.Text,{style:{fontSize:13,fontWeight:500,color:`#1a1a2e`},children:e.label})]})]},t))]})}),(0,$.jsxs)(CW,{form:n,initialValues:{},children:[(0,$.jsx)(CW.Item,{name:`prompt`,noStyle:!0,rules:[{required:!0,message:`请输入视频描述`}],style:{display:`none`}}),(0,$.jsxs)(`div`,{className:`animate-fadeInUp`,style:{borderRadius:20,background:`#fff`,border:`1px solid #f0f0f5`,boxShadow:`0 4px 24px rgba(0,0,0,0.04)`,overflow:`visible`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`12px 16px 0`,minHeight:60},children:[M.map((e,t)=>(0,$.jsxs)(`div`,{className:`ref-thumb`,style:{position:`relative`,width:48,height:48,borderRadius:12,overflow:`visible`,flexShrink:0},children:[(0,$.jsx)(`div`,{style:{width:48,height:48,borderRadius:12,overflow:`hidden`,border:`1px solid #e2e8f0`,cursor:`pointer`},onClick:()=>{e.type===`video`&&ie(`http://ceshi.apiforeign.minzhong.cn${e.url}`)},children:e.type===`image`?(0,$.jsx)(CG,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(i9,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`})}),(0,$.jsx)(`div`,{className:`ref-delete`,onClick:n=>{n.stopPropagation(),j5(e.url).catch(()=>{}),N(e=>e.filter((e,n)=>n!==t))},style:{position:`absolute`,top:-4,right:-4,width:16,height:16,borderRadius:`50%`,background:`rgba(0,0,0,0.55)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,zIndex:10,opacity:0,transition:`opacity 0.15s`,backdropFilter:`blur(4px)`},children:(0,$.jsx)(t4,{style:{color:`#fff`,fontSize:10}})})]},t)),(0,$.jsx)(p0,{accept:`image/*,video/*`,showUploadList:!1,multiple:!0,beforeUpload:e=>{let t=e.type.startsWith(`image/`),n=e.type.startsWith(`video/`);if(!t&&!n)return Q.error(`仅支持图片或视频文件`),!1;let r=n?100:10;if(e.size/1024/1024>r)return Q.error(`${n?`视频`:`图片`}大小不能超过${r}MB`),!1;let i=M.filter(e=>e.type===`image`).length,a=M.filter(e=>e.type===`video`).length;return t&&i>=10?(Q.error(`最多上传10张图片`),!1):n&&a>=3?(Q.error(`最多上传3个视频`),!1):(F(!0),(t?k5:A5)(e).then(e=>{let n=t?`图片`:`视频`,r=t?i+1:a+1;N(i=>[...i,{url:e.url,type:t?`image`:`video`,name:`${n}${r}`}]),Q.success(`${n}上传成功`)}).catch(()=>Q.error(`上传失败`)).finally(()=>F(!1)),!1)},children:(0,$.jsx)(uT,{title:`参考内容(${M.length}/10)`,children:(0,$.jsx)(`div`,{style:{width:48,height:48,borderRadius:12,border:`1.5px dashed #d9d9d9`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,transition:`all 0.2s`,flexShrink:0},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#6366f1`,e.currentTarget.style.background=`rgba(99,102,241,0.04)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`#d9d9d9`,e.currentTarget.style.background=`transparent`},children:P?(0,$.jsx)(qm,{style:{fontSize:18,color:`#6366f1`}}):(0,$.jsx)(MR,{style:{fontSize:18,color:`#94a3b8`}})})})})]}),(0,$.jsx)(`div`,{style:{padding:`8px 16px 4px`},children:(0,$.jsx)(iK.TextArea,{ref:H,value:I,onChange:e=>{let t=e.target.value;L(t),n.setFieldsValue({prompt:t});let r=t.lastIndexOf(`@`);if(r>=0){let e=t.slice(r+1);if(!e.includes(` `)&&!e.includes(` + `})]})},W7={HomeOutlined:(0,$.jsx)(p3,{}),DashboardOutlined:(0,$.jsx)(O4,{}),CodeOutlined:(0,$.jsx)(p4,{}),PlayCircleOutlined:(0,$.jsx)(u6,{}),WalletOutlined:(0,$.jsx)(B8,{}),SettingOutlined:(0,$.jsx)(L6,{}),BellOutlined:(0,$.jsx)(O2,{}),UserOutlined:(0,$.jsx)(P8,{}),AppstoreOutlined:(0,$.jsx)(i2,{}),FileTextOutlined:(0,$.jsx)(PU,{}),StarOutlined:(0,$.jsx)(s8,{}),HeartOutlined:(0,$.jsx)(i3,{}),CameraOutlined:(0,$.jsx)(U2,{}),RobotOutlined:(0,$.jsx)(u6,{}),CalculatorOutlined:(0,$.jsx)(B2,{}),DollarOutlined:(0,$.jsx)(P4,{}),GiftOutlined:(0,$.jsx)(Q4,{}),ThunderboltOutlined:(0,$.jsx)(y8,{}),FireOutlined:(0,$.jsx)(K4,{}),CloudOutlined:(0,$.jsx)(i4,{}),SmileOutlined:(0,$.jsx)(Q6,{}),TrophyOutlined:(0,$.jsx)(T8,{}),RocketOutlined:(0,$.jsx)(T6,{}),BulbOutlined:(0,$.jsx)(L2,{}),PictureOutlined:(0,$.jsx)(t6,{}),VideoCameraOutlined:(0,$.jsx)(L8,{}),AudioOutlined:(0,$.jsx)(g2,{}),MailOutlined:(0,$.jsx)(P3,{}),PhoneOutlined:(0,$.jsx)(Q3,{}),GlobalOutlined:(0,$.jsx)(t3,{}),ShoppingCartOutlined:(0,$.jsx)(B6,{}),TeamOutlined:(0,$.jsx)(g8,{}),BarChartOutlined:(0,$.jsx)(T2,{}),PieChartOutlined:(0,$.jsx)(i6,{}),LineChartOutlined:(0,$.jsx)(T3,{}),SecurityScanOutlined:(0,$.jsx)(j6,{}),ApiOutlined:(0,$.jsx)(t2,{}),DatabaseOutlined:(0,$.jsx)(j4,{}),CloudServerOutlined:(0,$.jsx)(s4,{})},G7=240,K7=[{gradient:`linear-gradient(135deg, #c9a96e, #a67c52)`,shadow:`rgba(201,169,110,0.25)`,icon:(0,$.jsx)(_J,{})},{gradient:`linear-gradient(135deg, #4a5568, #2d3748)`,shadow:`rgba(74,85,104,0.25)`,icon:(0,$.jsx)(U4,{})},{gradient:`linear-gradient(135deg, #718096, #4a5568)`,shadow:`rgba(113,128,150,0.25)`,icon:(0,$.jsx)(S4,{})},{gradient:`linear-gradient(135deg, #5a67d8, #434190)`,shadow:`rgba(90,103,216,0.25)`,icon:(0,$.jsx)(y2,{})}],q7=()=>{let e=qe(),t=We(),{user:n,logout:r}=B7(),[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)(!1),[c]=CW.useForm(),[l,u]=(0,S.useState)(null),[d,f]=(0,S.useState)([]),[p,m]=(0,S.useState)([]),[h,g]=(0,S.useState)({}),[_,v]=(0,S.useState)(0),[y,b]=(0,S.useState)(()=>{let e=localStorage.getItem(`siteInfo`),t=e&&JSON.parse(e).siteName||``;return t&&(document.title=t),t}),[x,C]=(0,S.useState)(()=>{let e=localStorage.getItem(`siteInfo`),t=e&&JSON.parse(e).siteLogo||``;if(t){let e=document.querySelector(`link[rel="icon"]`);e||(e=document.createElement(`link`),e.rel=`icon`,document.head.appendChild(e)),e.href=t,e.type=`image/png`}return t}),[w,T]=(0,S.useState)(!localStorage.getItem(`siteInfo`)),[E,D]=(0,S.useState)(!1),[O,k]=(0,S.useState)(null),[A,j]=(0,S.useState)(`alipay`),[M,N]=(0,S.useState)(!1),[P,F]=(0,S.useState)(180),I=(0,S.useRef)(null),L=(0,S.useRef)(null),R=(0,S.useRef)(null),[z,B]=(0,S.useState)({alipay:!1,wechat:!1}),V=`pending_payment_order`;(0,S.useEffect)(()=>{F5().then(e=>{let t=e.siteName||`民众智创`,n=e.siteLogo||``;if(t!==y&&(b(t),document.title=t),n&&n!==x){C(n);let e=document.querySelector(`link[rel="icon"]`);e||(e=document.createElement(`link`),e.rel=`icon`,document.head.appendChild(e)),e.href=n,e.type=`image/png`}localStorage.setItem(`siteInfo`,JSON.stringify({siteName:t,siteLogo:n}))}).catch(()=>{})},[]);let H=()=>{B5().then(e=>{v(e)}).catch(()=>{})};(0,S.useEffect)(()=>{(async()=>{let e=localStorage.getItem(V);if(e)try{let t=JSON.parse(e),n=await J5(t.orderNo);if(n.status===`pending`){k({price:t.price,credits:t.credits,qrCode:t.qrCode,method:t.method}),R.current=t.orderNo;let e=Date.now(),n=new Date(t.createdAt).getTime(),r=t.timeoutSeconds||180,i=Math.floor((e-n)/1e3),a=Math.max(0,r-i);a>0?(D(!0),J(t.orderNo,a)):localStorage.removeItem(V)}else n.status===`paid`?(Q.success(`支付成功!积分已到账`),B7.getState().refreshUser(),localStorage.removeItem(V)):localStorage.removeItem(V)}catch{localStorage.removeItem(V)}})()},[]),(0,S.useEffect)(()=>{U5().then(e=>{f(e.filter(e=>e.is_active!==!1&&e.isActive!==!1))}).catch(()=>{}),W5().then(e=>{m(e.filter(e=>e.is_active!==!1&&e.isActive!==!1))}).catch(()=>{}),G5().then(e=>{B(e),e.alipay?j(`alipay`):e.wechat&&j(`wechat`)}).catch(()=>{}),H()},[n]);let U=t.pathname.startsWith(`/records`)?`/records`:t.pathname,W=G7,ee=[{key:`profile`,icon:(0,$.jsx)(P8,{}),label:`账号: ${n?.username}`,disabled:!0},{key:`credits`,icon:(0,$.jsx)(B8,{style:{color:`#c9a96e`}}),label:`积分: ${n?.credits??0}`,disabled:!0},{type:`divider`},{key:`myCredits`,icon:(0,$.jsx)(B8,{}),label:`积分明细`},{key:`orderRecords`,icon:(0,$.jsx)(PU,{}),label:`订单记录`},{key:`messages`,icon:(0,$.jsx)(O2,{}),label:`消息中心${_>0?`(${_})`:``}`},{type:`divider`},{key:`changePwd`,icon:(0,$.jsx)(O3,{}),label:`修改密码`},{type:`divider`},{key:`logout`,icon:(0,$.jsx)(j3,{}),label:`退出登录`,danger:!0}],te=({key:t})=>{t===`logout`?(r(),e(`/login`)):t===`changePwd`?a(!0):t===`messages`?e(`/messages`):t===`recharge`?s(!0):t===`myCredits`?e(`/user-center?tab=credits`):t===`orderRecords`&&e(`/user-center?tab=orders`)},G=async()=>{try{await c.validateFields(),Q.success(`密码修改成功(演示)`),a(!1),c.resetFields()}catch{}},ne=()=>{r(),e(`/login`)},K=()=>{s(!0)},q=(0,S.useCallback)(()=>{I.current&&=(clearInterval(I.current),null),L.current&&=(clearInterval(L.current),null)},[]),J=(0,S.useCallback)((e,t=180)=>{q(),F(t),I.current=setInterval(async()=>{try{let t=await J5(e);t.status===`paid`?(q(),R.current=null,localStorage.removeItem(V),Q.success(`支付成功!积分已到账`),B7.getState().refreshUser(),D(!1),k(null),u(null)):t.status===`cancelled`&&(q(),R.current=null,localStorage.removeItem(V))}catch{}},2e3),L.current=setInterval(()=>{F(e=>e<=1?(q(),R.current&&=(Y5(R.current).catch(()=>{}),null),localStorage.removeItem(V),Q.warning(`订单已超时,请重新充值`),D(!1),k(null),u(null),0):e-1)},1e3)},[q]);return(0,$.jsxs)(pK,{style:{minHeight:`100vh`},children:[(0,$.jsxs)(`div`,{className:`desktop-sidebar`,style:{width:W,position:`fixed`,left:16,top:16,bottom:16,zIndex:100,background:`linear-gradient(180deg, #ffffff 0%, #f8fafc 100%)`,borderRadius:`20px`,boxShadow:`0 4px 32px rgba(0, 0, 0, 0.06), 0 1px 8px rgba(0, 0, 0, 0.04)`,display:`flex`,flexDirection:`column`,transition:`width 0.25s ease, left 0.25s ease`,overflow:`hidden`,border:`1px solid rgba(0, 0, 0, 0.06)`},children:[(0,$.jsx)(`div`,{style:{height:80,display:`flex`,alignItems:`center`,justifyContent:`flex-start`,padding:`0 20px`,flexShrink:0,background:`linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, rgba(139, 92, 246, 0.04) 100%)`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:14},children:[(0,$.jsx)(`div`,{style:{width:42,height:42,borderRadius:14,flexShrink:0,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 4px 16px rgba(99, 102, 241, 0.35)`,overflow:`hidden`},children:x?(0,$.jsx)(`img`,{src:x,alt:`logo`,style:{width:28,height:28,objectFit:`contain`}}):(0,$.jsx)(y8,{style:{fontSize:20,color:`#ffffff`}})}),(0,$.jsx)(`span`,{style:{color:`#1e293b`,fontSize:17,fontWeight:700,letterSpacing:-.02,whiteSpace:`nowrap`,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:y})]})}),(0,$.jsx)(`div`,{style:{flex:1,padding:`8px 8px`,overflow:`auto`},children:(()=>{let t={};d.forEach(e=>{let n=e.parent_id??e.parentId;n&&(t[n]||(t[n]=[]),t[n].push(e))});let n=d.filter(e=>!(e.parent_id??e.parentId));n.sort((e,t)=>(typeof e.sortOrder==`number`?e.sortOrder:1/0)-(typeof t.sortOrder==`number`?t.sortOrder:1/0));let r=[],i=(t,n=0)=>{let r=t.path===U,i=W7[t.icon]||(0,$.jsx)(p3,{});return(0,$.jsxs)(`div`,{onClick:()=>t.path&&e(t.path),style:{display:`flex`,alignItems:`center`,justifyContent:`flex-start`,gap:12,padding:n>0?`8px 14px 8px 36px`:`10px 16px`,borderRadius:12,margin:`2px 6px`,cursor:`pointer`,fontSize:n>0?13:14,fontWeight:r?600:400,color:r?`#4f46e5`:`#475569`,background:r?`linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.08) 100%)`:`transparent`,transition:`all 0.2s ease`},children:[(0,$.jsx)(`span`,{style:{fontSize:n>0?14:16,flexShrink:0,color:r?`#6366f1`:`#64748b`},children:i}),(0,$.jsx)(`span`,{style:{whiteSpace:`nowrap`},children:t.label})]},t.id)};return n.forEach(e=>{if((e.menu_type??e.menuType)===`group`){let n=(t[e.id]||[]).sort((e,t)=>(typeof e.sortOrder==`number`?e.sortOrder:1/0)-(typeof t.sortOrder==`number`?t.sortOrder:1/0));r.push((0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{style:{color:`#94a3b8`,fontSize:12,fontWeight:600,padding:`12px 16px 6px`,letterSpacing:.5,textTransform:`uppercase`},children:e.label}),n.map(e=>i(e,1))]},e.id))}else r.push(i(e))}),r})()}),(0,$.jsxs)(`div`,{onClick:()=>s(!0),style:{margin:`8px 12px`,padding:`12px 20px`,borderRadius:14,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:8,color:`#ffffff`,fontSize:14,fontWeight:600,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,boxShadow:`0 4px 16px rgba(99, 102, 241, 0.4)`,transition:`all 0.3s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%)`,e.currentTarget.style.transform=`translateY(-1px)`,e.currentTarget.style.boxShadow=`0 6px 20px rgba(99, 102, 241, 0.5)`},onMouseLeave:e=>{e.currentTarget.style.background=`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,e.currentTarget.style.transform=`translateY(0)`,e.currentTarget.style.boxShadow=`0 4px 16px rgba(99, 102, 241, 0.4)`},children:[(0,$.jsx)(MR,{style:{fontSize:16}}),(0,$.jsx)(`span`,{children:`充值积分`})]}),(0,$.jsx)(`div`,{style:{padding:`16px 16px`,flexShrink:0},children:(0,$.jsx)(jU,{menu:{items:ee,onClick:te},placement:`topRight`,arrow:!0,children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`flex-start`,gap:12,padding:`10px 14px`,borderRadius:14,cursor:`pointer`,transition:`all 0.25s ease`,background:`linear-gradient(135deg, rgba(248, 250, 252, 0.9) 0%, rgba(241, 245, 249, 0.9) 100%)`,boxShadow:`0 2px 12px rgba(0, 0, 0, 0.04)`},onMouseEnter:e=>{e.currentTarget.style.background=`linear-gradient(135deg, #ffffff 0%, #f8fafc 100%)`,e.currentTarget.style.boxShadow=`0 4px 16px rgba(0, 0, 0, 0.08)`},onMouseLeave:e=>{e.currentTarget.style.background=`linear-gradient(135deg, rgba(248, 250, 252, 0.9) 0%, rgba(241, 245, 249, 0.9) 100%)`,e.currentTarget.style.boxShadow=`0 2px 12px rgba(0, 0, 0, 0.04)`},children:[(0,$.jsx)(xT,{size:36,icon:(0,$.jsx)(P8,{}),style:{background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,flexShrink:0,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.3)`}}),(0,$.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,$.jsx)(`div`,{style:{color:`#1e293b`,fontSize:14,fontWeight:600,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,letterSpacing:-.01},children:n?.username}),(0,$.jsxs)(`div`,{style:{color:`#6366f1`,fontSize:12,fontWeight:500,letterSpacing:0,background:`rgba(99, 102, 241, 0.08)`,padding:`2px 8px`,borderRadius:6,display:`inline-block`},children:[`积分: `,n?.credits||0]})]})]})})})]}),(0,$.jsx)(`div`,{className:`desktop-content`,style:{marginLeft:W+28,marginRight:12,marginTop:16,marginBottom:16,flex:1,minHeight:`calc(100vh - 32px)`,background:`transparent`,padding:0,transition:`margin-left 0.25s ease`},children:(0,$.jsx)(`div`,{style:{boxSizing:`border-box`,height:`100%`,background:`#ffffffff`,borderRadius:`20px`,boxShadow:`0 4px 32px rgba(0, 0, 0, 0.06), 0 1px 8px rgba(0, 0, 0, 0.04)`,minHeight:`100%`,padding:`24px 32px 32px`,border:`1px solid rgba(0, 0, 0, 0.06)`},children:(0,$.jsx)(St,{})})}),(0,$.jsxs)(`div`,{className:`mobile-bottom-nav`,children:[d.filter(e=>(e.menu_type??e.menuType)!==`group`).map(t=>t.path?(0,$.jsxs)(`div`,{className:`nav-item ${t.path===U?`active`:``}`,onClick:()=>e(t.path),children:[(0,$.jsx)(`span`,{className:`nav-icon`,children:W7[t.icon]||(0,$.jsx)(p3,{})}),(0,$.jsx)(`span`,{children:t.label})]},t.id):null),(0,$.jsxs)(`div`,{className:`nav-item`,onClick:K,children:[(0,$.jsx)(`span`,{className:`nav-icon`,children:(0,$.jsx)(p6,{})}),(0,$.jsx)(`span`,{children:`充值`})]}),(0,$.jsxs)(`div`,{className:`nav-item`,onClick:ne,children:[(0,$.jsx)(`span`,{className:`nav-icon`,children:(0,$.jsx)(j3,{})}),(0,$.jsx)(`span`,{children:`退出`})]})]}),(0,$.jsx)(Oq,{title:(0,$.jsxs)(kU,{children:[(0,$.jsx)(O3,{}),`修改密码`]}),open:i,onOk:G,onCancel:()=>{a(!1),c.resetFields()},okText:`确认修改`,cancelText:`取消`,width:440,children:(0,$.jsxs)(CW,{form:c,layout:`vertical`,style:{marginTop:20},children:[(0,$.jsx)(CW.Item,{name:`oldPwd`,label:`原密码`,rules:[{required:!0,message:`请输入原密码`}],children:(0,$.jsx)(iK.Password,{placeholder:`请输入原密码`,size:`large`,prefix:(0,$.jsx)(O3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(CW.Item,{name:`newPwd`,label:`新密码`,rules:[{required:!0,message:`请输入新密码`},{min:6,message:`密码至少6位`}],children:(0,$.jsx)(iK.Password,{placeholder:`请输入新密码(至少6位)`,size:`large`,prefix:(0,$.jsx)(O3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(CW.Item,{name:`confirmPwd`,label:`确认新密码`,rules:[{required:!0,message:`请再次输入新密码`},({getFieldValue:e})=>({validator(t,n){return!n||e(`newPwd`)===n?Promise.resolve():Promise.reject(Error(`两次密码不一致`))}})],children:(0,$.jsx)(iK.Password,{placeholder:`请再次输入新密码`,size:`large`,prefix:(0,$.jsx)(O3,{style:{color:`#94a3b8`,marginRight:8}})})})]})}),(0,$.jsx)(Oq,{title:(0,$.jsxs)(kU,{children:[(0,$.jsx)(Q4,{}),`积分充值`]}),open:o,onCancel:()=>{s(!1),u(null)},footer:null,width:680,children:(0,$.jsxs)(`div`,{style:{marginTop:16},children:[(0,$.jsxs)(kU,{style:{marginBottom:16},children:[(0,$.jsx)(B8,{style:{color:`#6366f1`}}),(0,$.jsx)(y1.Text,{style:{color:`#64748b`,letterSpacing:0},children:`当前积分余额`}),(0,$.jsx)(y1.Text,{strong:!0,style:{color:`#6366f1`,fontSize:20,fontWeight:600},children:n?.credits??0})]}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:12,flexWrap:`wrap`},children:p.map((e,t)=>{let n=K7[t%K7.length],r=(e.credits||0)+(e.bonus_credits||e.bonusCredits||0);return(0,$.jsxs)(`div`,{onClick:()=>u(e.id),style:{flex:`1 1 45%`,minWidth:200,borderRadius:16,padding:`20px 16px`,background:l===e.id?`rgba(99,102,241,0.04)`:`#fafbff`,border:l===e.id?`2px solid #6366f1`:`1px solid #f0f0f5`,cursor:`pointer`,position:`relative`,transition:`all 0.2s`},children:[e.description&&(0,$.jsx)(v$,{color:`purple`,style:{position:`absolute`,top:-10,left:`50%`,transform:`translateX(-50%)`,borderRadius:8,fontSize:11},children:e.description}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsx)(`div`,{style:{width:44,height:44,borderRadius:12,flexShrink:0,background:n.gradient,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:18,color:`#fff`,boxShadow:`0 6px 16px ${n.shadow}`},children:n.icon}),(0,$.jsxs)(`div`,{style:{flex:1},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:6},children:[(0,$.jsx)(y1.Text,{strong:!0,style:{fontSize:15},children:e.name}),(0,$.jsxs)(y1.Text,{style:{fontSize:12,color:`#94a3b8`},children:[r.toLocaleString(),` 积分`]})]}),(0,$.jsxs)(`div`,{style:{fontSize:22,fontWeight:800,marginTop:4,background:n.gradient,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`},children:[`¥`,e.price]})]})]})]},e.id)})}),!z.alipay&&!z.wechat?(0,$.jsx)(`div`,{style:{marginTop:20,marginBottom:8,padding:16,background:`#fef2f2`,borderRadius:12,border:`1px solid #fecaca`},children:(0,$.jsx)(y1.Text,{style:{color:`#dc2626`,fontSize:13},children:`⚠️ 暂无可用的支付方式,请联系管理员开启支付功能`})}):(0,$.jsxs)(`div`,{style:{marginTop:20,marginBottom:8},children:[(0,$.jsx)(y1.Text,{style:{color:`#64748b`,fontSize:13,marginBottom:8,display:`block`},children:`选择支付方式`}),(0,$.jsxs)(GL.Group,{value:A,onChange:e=>j(e.target.value),style:{display:`flex`,gap:12},children:[z.alipay&&(0,$.jsxs)(GL.Button,{value:`alipay`,style:{flex:1,textAlign:`center`,borderRadius:10,height:44,lineHeight:`42px`,borderColor:A===`alipay`?`#1677ff`:void 0,color:A===`alipay`?`#1677ff`:void 0},children:[(0,$.jsx)(Q0,{style:{fontSize:16,marginRight:6}}),`支付宝`]}),z.wechat&&(0,$.jsxs)(GL.Button,{value:`wechat`,style:{flex:1,textAlign:`center`,borderRadius:10,height:44,lineHeight:`42px`,borderColor:A===`wechat`?`#07c160`:void 0,color:A===`wechat`?`#07c160`:void 0},children:[(0,$.jsx)(K8,{style:{fontSize:16,marginRight:6}}),`微信支付`]})]})]}),(0,$.jsxs)(`div`,{style:{marginTop:16,display:`flex`,justifyContent:`flex-end`},children:[(0,$.jsx)(jD,{size:`large`,onClick:()=>{s(!1),u(null)},style:{borderRadius:10,marginRight:12},children:`取消`}),(0,$.jsx)(jD,{type:`primary`,size:`large`,disabled:!l||!z.alipay&&!z.wechat,loading:M,onClick:async()=>{let e=p.find(e=>e.id===l);if(!e)return;let t=(e.credits||0)+(e.bonus_credits||e.bonusCredits||0);try{N(!0);let n=await K5(e.id,A),r=n.qrUrl||n.codeUrl||n.qr_code||n.code_url;(n.paymentMethod===`alipay`||n.paymentMethod===`wechat`)&&r?(k({price:e.price,credits:t,qrCode:r,method:n.paymentMethod}),s(!1),D(!0),R.current=n.orderNo,localStorage.setItem(V,JSON.stringify({orderNo:n.orderNo,price:e.price,credits:t,qrCode:r,method:n.paymentMethod,createdAt:n.createdAt||new Date().toISOString(),timeoutSeconds:180})),J(n.orderNo)):(Q.success(`充值成功!积分已到账`),B7.getState().refreshUser(),s(!1),u(null))}catch(e){Q.error(e?.message||`创建订单失败,请重试`)}finally{N(!1)}},style:{borderRadius:10,fontWeight:600,background:l?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#d1d5db`,border:`none`,boxShadow:l?`0 8px 24px rgba(99,102,241,0.3)`:`none`},children:`确认充值`})]})]})}),(0,$.jsx)(Oq,{open:E,onCancel:async()=>{if(q(),R.current){try{await Y5(R.current)}catch{}R.current=null}localStorage.removeItem(V),D(!1),k(null)},footer:null,width:400,closable:!1,styles:{body:{padding:0,borderRadius:16,overflow:`hidden`}},children:(0,$.jsxs)(`div`,{style:{padding:`24px`},children:[(0,$.jsxs)(`div`,{style:{textAlign:`center`,marginBottom:24},children:[(0,$.jsx)(`div`,{style:{width:48,height:48,background:O?.method===`alipay`?`linear-gradient(135deg, #1677ff, #0958d9)`:`linear-gradient(135deg, #07c160, #06ae56)`,borderRadius:16,display:`flex`,alignItems:`center`,justifyContent:`center`,margin:`0 auto 12px`},children:O?.method===`alipay`?(0,$.jsx)(Q0,{style:{fontSize:24,color:`#fff`}}):(0,$.jsx)(K8,{style:{fontSize:24,color:`#fff`}})}),(0,$.jsx)(y1.Title,{level:4,style:{margin:0},children:O?.method===`alipay`?`支付宝支付`:`微信支付`}),(0,$.jsx)(y1.Text,{style:{color:`#94a3b8`,fontSize:13},children:O?.method===`alipay`?`请使用支付宝扫描二维码完成支付`:`请使用微信扫描二维码完成支付`})]}),(0,$.jsxs)(`div`,{style:{background:`#fff`,borderRadius:16,padding:20,display:`flex`,flexDirection:`column`,alignItems:`center`,boxShadow:`0 4px 20px rgba(0,0,0,0.08)`},children:[(0,$.jsx)(`div`,{style:{width:180,height:180,borderRadius:12,overflow:`hidden`,background:`#fff`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:O&&(0,$.jsx)(Y0,{value:O.qrCode,size:160,level:`M`,includeMargin:!1})}),(0,$.jsxs)(`div`,{style:{marginTop:16,textAlign:`center`},children:[(0,$.jsxs)(`div`,{style:{fontSize:28,fontWeight:700,color:`#1a1a2e`},children:[`¥`,O?.price||0]}),(0,$.jsxs)(`div`,{style:{fontSize:13,color:`#64748b`,marginTop:4},children:[`购买 `,O?.credits||0,` 积分`]}),(0,$.jsx)(`div`,{style:{marginTop:12,padding:`8px 16px`,background:P<=30?`#fef2f2`:`#f0f9ff`,borderRadius:8,border:P<=30?`1px solid #fecaca`:`1px solid #bae6fd`,display:`inline-block`},children:(0,$.jsxs)(`span`,{style:{fontSize:14,fontWeight:600,color:P<=30?`#dc2626`:`#0284c7`},children:[`订单将在 `,(0,$.jsx)(`span`,{style:{fontSize:16,fontWeight:800},children:P}),` 秒后关闭`]})})]})]}),(0,$.jsx)(`div`,{style:{marginTop:20,padding:16,background:`#fef3c7`,borderRadius:12},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8},children:[(0,$.jsx)(`div`,{style:{fontSize:16,marginTop:-2},children:`💡`}),(0,$.jsxs)(`div`,{style:{fontSize:13,color:`#92400e`},children:[(0,$.jsx)(`div`,{style:{fontWeight:500,marginBottom:4},children:`支付提示`}),(0,$.jsxs)(`ul`,{style:{margin:0,paddingLeft:16},children:[(0,$.jsx)(`li`,{style:{marginBottom:2},children:`请在支付后等待页面自动跳转`}),(0,$.jsx)(`li`,{children:`如支付成功但未到账,请联系客服`})]})]})]})}),(0,$.jsx)(`div`,{style:{marginTop:20},children:(0,$.jsx)(jD,{size:`large`,block:!0,onClick:async()=>{if(q(),R.current){try{await Y5(R.current)}catch{}R.current=null}localStorage.removeItem(V),D(!1),k(null),u(null)},style:{borderRadius:10},children:`取消支付`})})]})}),(0,$.jsx)(U7,{})]})},J7=`http://localhost:8000/api`,Y7=()=>{let{checkAuth:e}=B7(),[t,n]=(0,S.useState)(!1),[r,i]=(0,S.useState)(`password`),[a,o]=(0,S.useState)(`password`),[s,c]=(0,S.useState)(0),[l,u]=(0,S.useState)(0),[d,f]=(0,S.useState)(!1),[p,m]=(0,S.useState)(!1),[h,g]=(0,S.useState)(!1),[_,v]=(0,S.useState)(!1),[y,b]=(0,S.useState)(0),[x,C]=(0,S.useState)(!1),[w,T]=(0,S.useState)(!1),E=(()=>{try{let e=localStorage.getItem(`siteInfo`);if(e){let t=JSON.parse(e);return{siteName:t.siteName||`VideoGen.AI`,siteLogo:t.siteLogo||``}}}catch{}return{siteName:`VideoGen.AI`,siteLogo:``}})(),[D,O]=(0,S.useState)(E.siteName),[k,A]=(0,S.useState)(E.siteLogo),[j,M]=(0,S.useState)(``),[N,P]=(0,S.useState)(``),F=qe(),{login:I}=B7(),[L]=CW.useForm(),[R]=CW.useForm(),[z]=CW.useForm();(0,S.useEffect)(()=>{F5().then(e=>{O(e.siteName),A(e.siteLogo),M(e.userAgreementUrl),P(e.privacyPolicyUrl)}).catch(()=>{})},[]);let B=()=>d?!0:(Q.warning(`请先阅读并同意用户协议和隐私政策`),!1),V=async()=>{if(B())try{let t=await L.validateFields();await I(t.phone,t.password,void 0,t.rememberMe),Q.success(`登录成功,欢迎回来`),await e(),F(`/projects`)}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Q.error(t)}},H=async()=>{if(B())try{let t=R.getFieldsValue();if(!t.phone||!t.code){Q.error(`请填写手机号和验证码`);return}n(!0),await y5(t.phone,t.code),Q.success(`登录成功,欢迎回来`),await e(),F(`/projects`)}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Q.error(t)}finally{n(!1)}},U=async()=>{if(B())try{let t=await z.validateFields();n(!0),await b5(t.phone,t.regCode,t.password),Q.success(`注册成功`),await e(),F(`/projects`)}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`注册失败`;Q.error(t)}finally{n(!1)}},W=(e,t)=>{e(60);let n=setInterval(()=>{e(e=>e<=1?(clearInterval(n),m(!1),t?C(!0):T(!0),0):e-1)},1e3)};(0,S.useEffect)(()=>{s===0&&r===`phone`&&v(!1)},[s,r]);let ee=async(e,t)=>{try{if(!e||!/^1\d{10}$/.test(e)){Q.error(`请输入正确的手机号`);return}if(t){m(!0),g(!1);return}if(!_){m(!0),v(!1);return}let n=``;n=r===`register`?`register`:`login`,await R5(e,n),W(t?u:c),Q.success(`验证码已发送`)}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Q.error(t),r===`register`?(g(!1),u(0)):(v(!1),c(0)),b(e=>e+1)}},te=async(e=!1)=>{let t=r===`register`?z.getFieldValue(`phone`):R.getFieldValue(`phone`);try{let e=``;e=r===`register`?`register`:`login`,await R5(t,e),r===`register`?(g(!0),W(u,!0)):(v(!0),W(c,!1)),Q.success(`验证码已发送`)}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Q.error(t),r===`register`?(g(!1),u(0),C(!0)):(v(!1),c(0),T(!0)),b(e=>e+1)}},G=e=>{o(e),i(e),c(0),u(0),v(!1),g(!1),m(!1),C(!1),T(!1),b(e=>e+1),e===`password`?L.resetFields():R.resetFields()},ne=[{icon:(0,$.jsx)(L2,{}),title:`AI 智能优化`,desc:`输入原始提示词,AI 自动为您生成专业级视频、图片描述`},{icon:(0,$.jsx)(u6,{}),title:`一键生成视频、图片`,desc:`支持多种规格生成视频、图片`},{icon:(0,$.jsx)(u3,{}),title:`项目维度管理`,desc:`按项目行业分类视频、图片,支持多种行业`}],K={background:`#fff`,border:`1.5px solid #e2e8f0`,color:`#1e293b`,height:48,borderRadius:10,fontSize:14},q=e=>{e&&window.open(`${J7.replace(/\/api$/,``)}${e}`,`_blank`)};return(0,$.jsxs)(`div`,{style:{minHeight:`100vh`,display:`flex`,backgroundImage:`url(/backimage.png)`,backgroundSize:`cover`,backgroundPosition:`center`,backgroundRepeat:`no-repeat`,backgroundAttachment:`fixed`,position:`relative`,overflow:`hidden`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,inset:0,background:`linear-gradient(135deg, rgba(240,244,255,0.9) 0%, rgba(232,236,248,0.85) 40%, rgba(240,240,255,0.9) 70%, rgba(248,249,255,0.95) 100%)`}}),(0,$.jsx)(`div`,{style:{position:`absolute`,width:500,height:500,borderRadius:`50%`,background:`radial-gradient(circle, rgba(99,102,241,0.08) 0%, transparent 70%)`,top:-150,right:-100,filter:`blur(40px)`}}),(0,$.jsx)(`div`,{style:{position:`absolute`,width:400,height:400,borderRadius:`50%`,background:`radial-gradient(circle, rgba(139,92,246,0.06) 0%, transparent 70%)`,bottom:-100,left:-80,filter:`blur(50px)`}}),(0,$.jsx)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,justifyContent:`center`,padding:`0 80px`,zIndex:1},children:(0,$.jsxs)(kU,{direction:`vertical`,size:36,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:14,marginBottom:20},children:[k?(0,$.jsx)(`img`,{src:k,alt:`logo`,style:{width:52,height:52,borderRadius:14,objectFit:`contain`}}):(0,$.jsx)(`div`,{style:{width:52,height:52,borderRadius:14,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 8px 24px rgba(99,102,241,0.25)`},children:(0,$.jsx)(y8,{style:{fontSize:26,color:`#fff`}})}),(0,$.jsx)(`span`,{style:{color:`#1e293b`,fontSize:28,fontWeight:800,letterSpacing:-.5},children:D})]}),(0,$.jsx)(`div`,{className:`shiny-text-container`,children:(0,$.jsx)(`span`,{className:`shiny-text`,children:`AI赋能创意,素材触手可及`})}),(0,$.jsxs)(y1.Paragraph,{style:{color:`#64748b`,fontSize:17,maxWidth:480,lineHeight:1.8},children:[`专业的 AI 素材生成平台,通过智能提示词优化,`,(0,$.jsx)(`br`,{}),`让您的创意快速转化为精美视频、图片`]})]}),(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:20},children:ne.map((e,t)=>(0,$.jsxs)(`div`,{className:`electric-border-card`,style:{position:`relative`,display:`flex`,gap:16,alignItems:`flex-start`,padding:`18px 22px`,borderRadius:14,background:`rgba(255,255,255,0.85)`,backdropFilter:`blur(12px)`,overflow:`hidden`},children:[(0,$.jsx)(`div`,{className:`electric-border`}),(0,$.jsx)(`div`,{className:`electric-border-inner`}),(0,$.jsx)(`div`,{style:{position:`relative`,zIndex:1},children:(0,$.jsx)(`div`,{style:{width:44,height:44,borderRadius:12,flexShrink:0,background:`linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.15))`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#6366f1`,fontSize:20},children:e.icon})}),(0,$.jsxs)(`div`,{style:{position:`relative`,zIndex:1},children:[(0,$.jsx)(y1.Text,{style:{color:`#1e293b`,fontSize:15,fontWeight:600,display:`block`,marginBottom:4},children:e.title}),(0,$.jsx)(y1.Text,{style:{color:`#64748b`,fontSize:13,lineHeight:1.6},children:e.desc})]})]},t))})]})}),(0,$.jsx)(`div`,{style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:1,padding:`40px 24px`},children:(0,$.jsxs)(Wz,{style:{width:440,maxWidth:`100%`,borderRadius:20,boxShadow:`0 20px 60px rgba(0,0,0,0.08)`,border:`1px solid #e2e8f0`,background:`#fff`},styles:{body:{padding:`36px 28px`}},children:[(0,$.jsx)(y1.Title,{level:3,style:{textAlign:`center`,marginBottom:6,color:`#1e293b`,fontWeight:700},children:r===`register`?`创建账号`:`欢迎回来`}),(0,$.jsx)(y1.Text,{style:{display:`block`,textAlign:`center`,marginBottom:28,color:`#94a3b8`,fontSize:14},children:r===`register`?`注册新账号,开始创作视频`:`登录您的账号,开始创作视频`}),r!==`register`&&(0,$.jsx)(`div`,{style:{display:`flex`,gap:0,marginBottom:24,background:`#f1f5f9`,borderRadius:10,padding:4,border:`1px solid #e2e8f0`},children:[`password`,`phone`].map(e=>(0,$.jsx)(`div`,{onClick:()=>G(e),style:{flex:1,textAlign:`center`,padding:`10px 0`,borderRadius:8,cursor:`pointer`,fontSize:14,fontWeight:a===e?600:400,color:a===e?`#6366f1`:`#64748b`,background:a===e?`#fff`:`transparent`,border:a===e?`1px solid rgba(99,102,241,0.2)`:`1px solid transparent`,boxShadow:a===e?`0 2px 8px rgba(99,102,241,0.1)`:`none`,transition:`all 0.3s ease`},children:e===`password`?`密码登录`:`验证码登录`},e))}),r===`password`&&(0,$.jsxs)(CW,{form:L,size:`large`,layout:`vertical`,onFinish:V,children:[(0,$.jsx)(CW.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(iK,{prefix:(0,$.jsx)(B3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,style:K})}),(0,$.jsx)(CW.Item,{name:`password`,rules:[{required:!0,message:`请输入密码`}],children:(0,$.jsx)(iK.Password,{prefix:(0,$.jsx)(O3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入密码`,style:K})}),(0,$.jsx)(CW.Item,{name:`rememberMe`,valuePropName:`checked`,style:{marginBottom:12},children:(0,$.jsx)(xV,{children:`记住我的登录状态`})}),(0,$.jsx)(CW.Item,{style:{marginBottom:12},children:(0,$.jsx)(jD,{type:`primary`,htmlType:`submit`,loading:t,block:!0,style:{height:48,borderRadius:10,fontSize:16,fontWeight:600,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,boxShadow:`0 8px 24px rgba(99,102,241,0.25)`},children:`登 录`})})]}),r===`phone`&&(0,$.jsxs)(CW,{form:R,size:`large`,layout:`vertical`,children:[(0,$.jsx)(CW.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(iK,{prefix:(0,$.jsx)(B3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,maxLength:11,style:K})}),(0,$.jsx)(CW.Item,{name:`code`,rules:[{required:!0,message:`请输入验证码`}],children:(0,$.jsxs)(kU.Compact,{style:{width:`100%`},children:[(0,$.jsx)(iK,{prefix:(0,$.jsx)(O6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入验证码`,maxLength:6,disabled:!_,style:{...K,borderRadius:`10px 0 0 10px`,flex:1}}),(0,$.jsx)(jD,{disabled:s>0,onClick:()=>{w?(v(!1),m(!0),b(e=>e+1)):ee(R.getFieldValue(`phone`))},style:{height:48,borderRadius:`0 10px 10px 0`,background:s>0||_?`#f1f5f9`:`rgba(99,102,241,0.1)`,border:`1.5px solid #e2e8f0`,borderLeft:`none`,color:s>0?`#94a3b8`:`#6366f1`,fontWeight:600,minWidth:100},children:s>0?`${s}s`:w?`重新发送`:`获取验证码`})]})}),p&&(0,$.jsx)(CW.Item,{style:{marginBottom:12},children:(0,$.jsx)(X7,{onSuccess:te,isVerified:_})},y),(0,$.jsx)(CW.Item,{style:{marginBottom:12},children:(0,$.jsx)(jD,{type:`primary`,onClick:H,loading:t,block:!0,style:{height:48,borderRadius:10,fontSize:16,fontWeight:600,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,boxShadow:`0 8px 24px rgba(99,102,241,0.25)`},children:`登 录`})})]}),r===`register`&&(0,$.jsxs)(CW,{form:z,size:`large`,layout:`vertical`,children:[(0,$.jsx)(CW.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(iK,{prefix:(0,$.jsx)(B3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,maxLength:11,style:K})}),(0,$.jsx)(CW.Item,{name:`regCode`,rules:[{required:!0,message:`请输入验证码`}],children:(0,$.jsxs)(kU.Compact,{style:{width:`100%`},children:[(0,$.jsx)(iK,{prefix:(0,$.jsx)(O6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入验证码`,maxLength:6,disabled:!h,style:{...K,borderRadius:`10px 0 0 10px`,flex:1}}),(0,$.jsx)(jD,{disabled:l>0,onClick:()=>{x?(g(!1),m(!0),b(e=>e+1)):ee(z.getFieldValue(`phone`),!0)},style:{height:48,borderRadius:`0 10px 10px 0`,background:l>0||h?`#f1f5f9`:`rgba(99,102,241,0.1)`,border:`1.5px solid #e2e8f0`,borderLeft:`none`,color:l>0?`#94a3b8`:`#6366f1`,fontWeight:600,minWidth:100},children:l>0?`${l}s`:x?`重新发送`:`获取验证码`})]})}),p&&(0,$.jsx)(CW.Item,{style:{marginBottom:12},children:(0,$.jsx)(X7,{onSuccess:te,isVerified:h})},y),(0,$.jsx)(CW.Item,{name:`password`,rules:[{required:!0,message:`请设置密码`},{min:6,message:`密码至少6位`}],children:(0,$.jsx)(iK.Password,{prefix:(0,$.jsx)(O3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请设置密码(至少6位)`,style:K})}),(0,$.jsx)(CW.Item,{style:{marginBottom:12},children:(0,$.jsx)(jD,{type:`primary`,onClick:U,loading:t,block:!0,style:{height:48,borderRadius:10,fontSize:16,fontWeight:600,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,boxShadow:`0 8px 24px rgba(99,102,241,0.25)`},children:`注 册`})})]}),(0,$.jsx)(`div`,{style:{marginBottom:16},children:(0,$.jsx)(xV,{checked:d,onChange:e=>f(e.target.checked),children:(0,$.jsxs)(`span`,{style:{fontSize:13,color:`#64748b`},children:[`我已阅读并同意`,(0,$.jsx)(`span`,{onClick:e=>{e.stopPropagation(),q(j)},style:{color:`#6366f1`,cursor:`pointer`},children:`《用户协议》`}),`和`,(0,$.jsx)(`span`,{onClick:e=>{e.stopPropagation(),q(N)},style:{color:`#6366f1`,cursor:`pointer`},children:`《隐私政策》`})]})})}),(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`space-between`},children:r===`register`?(0,$.jsx)(y1.Text,{style:{fontSize:13,color:`#6366f1`,cursor:`pointer`},onClick:()=>{i(`password`),o(`password`),C(!1),T(!1),g(!1),m(!1),b(e=>e+1),z.resetFields()},children:`已有账号?去登录`}):(0,$.jsx)(y1.Text,{style:{fontSize:13,color:`#6366f1`,cursor:`pointer`},onClick:()=>{i(`register`),C(!1),T(!1),g(!1),m(!1),b(e=>e+1)},children:`没有账号?立即注册`})})]})})]})},X7=({onSuccess:e,isVerified:t})=>{let n=S.useRef(null),r=S.useRef(null),i=S.useRef(null),a=S.useRef(0),o=S.useRef(!1),[s,c]=S.useState(360),l=s-50;S.useEffect(()=>{let e=()=>{if(n.current){let e=n.current.offsetWidth;e>0&&c(e)}};e();let t=new ResizeObserver(e);return n.current&&t.observe(n.current),window.addEventListener(`resize`,e),()=>{t.disconnect(),window.removeEventListener(`resize`,e)}},[]);let u=n=>{if(o.current||t)return;let c=Math.max(0,Math.min(n,l));a.current=c,r.current&&(r.current.style.left=`${c}px`),i.current&&(i.current.style.width=`${c+50}px`),c>=l-5&&(o.current=!0,r.current&&(r.current.style.background=`#22c55e`,r.current.innerHTML=``),i.current&&(i.current.style.width=`${s}px`,i.current.style.background=`#dcfce7`),e())};return(0,$.jsxs)(`div`,{ref:n,onMouseDown:e=>{if(e.preventDefault(),o.current||t)return;let s=n.current;if(!s)return;let c=s.getBoundingClientRect(),d=e=>{u(e.clientX-c.left-50/2)},f=()=>{document.removeEventListener(`mousemove`,d),document.removeEventListener(`mouseup`,f),!o.current&&a.current({page:1,pageSize:10,total:0,items:[]}),Q7=t5((e,t)=>({projects:[],records:Z7(),loading:!1,mediaType:`image`,countType:`请选择`,selectedRatio:`1:1`,selectedResolution:`2K`,width:2048,height:2048,videoDuration:5,videoAspectRatio:`16:9`,videoResolution:`720p`,engineOptions:{ratios:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:[`480p`,`720p`,`1080p`],durations:[5,8,10,12,15]},enginesele:[],fetchProjects:async()=>{e({loading:!0});try{e({projects:await w5(),loading:!1})}catch{e({loading:!1})}},createProject:async(n,r)=>{let i=await T5(n,r);return e({projects:[i,...t().projects]}),i},deleteProject:async n=>{await E5(n),e({projects:t().projects.filter(e=>e.id!==n)})},fetchRecords:async(t={})=>{e({loading:!0});try{e({records:await D5(t),loading:!1})}catch{e({loading:!1})}},optimizePrompt:async(n,r)=>{let i=await O5(n,r);try{await B7.getState().checkAuth()}catch{}let a=t().records;return e({records:{...a,total:a.total+1,items:[i.record,...a.items]}}),i},generateVideo:async(n,r)=>{let i=await N5(n,r);try{await B7.getState().checkAuth()}catch{}let a=t().records;return e({records:{...a,items:a.items.map(e=>e.id===n?i:e)}}),i},updateRecordReferences:(n,r)=>{let i=t().records;e({records:{...i,items:i.items.map(e=>e.id===n?{...e,references:r}:e)}})},setMediaType:t=>e({mediaType:t}),setCountType:t=>e({countType:t}),setImageSettings:(t,n,r,i)=>e({selectedRatio:t,selectedResolution:n,width:r,height:i}),setVideoSettings:(t,n,r)=>e({videoDuration:t,videoAspectRatio:n,videoResolution:r}),setEngineOptions:t=>e({engineOptions:t}),setSelectedRatio:t=>e({selectedRatio:t}),setSelectedResolution:t=>e({selectedResolution:t}),setWidth:t=>e({width:t}),setHeight:t=>e({height:t}),setVideoDuration:t=>e({videoDuration:t}),setVideoAspectRatio:t=>e({videoAspectRatio:t}),setVideoResolution:t=>e({videoResolution:t}),setEnginesele:t=>e({enginesele:t}),resetGenerationConfig:()=>e({mediaType:`image`,countType:`请选择`,selectedRatio:`1:1`,selectedResolution:`2K`,width:2048,height:2048,videoDuration:5,videoAspectRatio:`16:9`,videoResolution:`720p`,engineOptions:{ratios:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:[`480p`,`720p`,`1080p`],durations:[5,8,10,12,15]},enginesele:[]})}));function $7(e){if(!e)return`-`;let t=e.trim();t.includes(`T`)||(t=t.replace(` `,`T`));let n=t.indexOf(`.`);return n>0&&(t=t.slice(0,n)),t=t.replace(/[+-]\d{2}:?\d{0,2}$/,``).replace(/Z$/,``),t.replace(`T`,` `).slice(0,16)}var e9=[`#f97316`,`#3b82f6`,`#8b5cf6`,`#10b981`,`#eab308`,`#6366f1`,`#ef4444`,`#06b6d4`,`#64748b`,`#78716c`],t9={ShoppingCartOutlined:(0,$.jsx)(B6,{}),BookOutlined:(0,$.jsx)(j2,{}),HomeOutlined:(0,$.jsx)(p3,{}),FireOutlined:(0,$.jsx)(K4,{}),RocketOutlined:(0,$.jsx)(T6,{}),SkinOutlined:(0,$.jsx)(Y6,{}),CompassOutlined:(0,$.jsx)(y4,{}),HeartOutlined:(0,$.jsx)(i3,{}),CarOutlined:(0,$.jsx)(K2,{}),CameraOutlined:(0,$.jsx)(U2,{}),CloudOutlined:(0,$.jsx)(i4,{}),StarOutlined:(0,$.jsx)(s8,{}),TrophyOutlined:(0,$.jsx)(T8,{}),ThunderboltOutlined:(0,$.jsx)(y8,{}),BulbOutlined:(0,$.jsx)(L2,{}),CoffeeOutlined:(0,$.jsx)(g4,{}),CrownOutlined:(0,$.jsx)(T4,{}),DashboardOutlined:(0,$.jsx)(O4,{}),FlagOutlined:(0,$.jsx)(Y4,{}),GlobalOutlined:(0,$.jsx)(t3,{}),GiftOutlined:(0,$.jsx)(Q4,{}),LaptopOutlined:(0,$.jsx)(y3,{}),MobileOutlined:(0,$.jsx)(B3,{}),MonitorOutlined:(0,$.jsx)(U3,{}),PayCircleOutlined:(0,$.jsx)(Y3,{}),PictureOutlined:(0,$.jsx)(t6,{}),PlayCircleOutlined:(0,$.jsx)(u6,{}),SafetyOutlined:(0,$.jsx)(O6,{}),ShoppingOutlined:(0,$.jsx)(U6,{}),SmileOutlined:(0,$.jsx)(Q6,{}),SoundOutlined:(0,$.jsx)(i8,{}),TagOutlined:(0,$.jsx)(p8,{}),TeamOutlined:(0,$.jsx)(g8,{}),ToolOutlined:(0,$.jsx)(S8,{}),TruckOutlined:(0,$.jsx)(O8,{}),VideoCameraOutlined:(0,$.jsx)(L8,{}),WalletOutlined:(0,$.jsx)(B8,{}),BankOutlined:(0,$.jsx)(S2,{}),BuildOutlined:(0,$.jsx)(P2,{}),ExperimentOutlined:(0,$.jsx)(L4,{}),HighlightOutlined:(0,$.jsx)(s3,{}),IdcardOutlined:(0,$.jsx)(g3,{}),MedicineBoxOutlined:(0,$.jsx)(L3,{}),ReadOutlined:(0,$.jsx)(g6,{}),RestOutlined:(0,$.jsx)(y6,{}),SketchOutlined:(0,$.jsx)(K6,{}),SolutionOutlined:(0,$.jsx)(t8,{})},n9=()=>{let[e,t]=(0,S.useState)(!1),[n]=CW.useForm(),r=qe(),{projects:i,fetchProjects:a,createProject:o,deleteProject:s}=Q7(),[c,l]=(0,S.useState)([]);(0,S.useEffect)(()=>{a(),H5().then(l).catch(()=>{})},[]);let u=Object.fromEntries(c.map((e,t)=>[e.key,{label:e.label,color:e9[t%e9.length],icon:e.icon||`AppstoreOutlined`}]));return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`animate-fadeInUp`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:24,padding:`22px 24px`,borderRadius:16,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,position:`relative`,overflow:`hidden`,flexWrap:`wrap`,gap:12},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,right:-20,top:-20,width:200,height:200,borderRadius:`50%`,background:`rgba(255,255,255,0.08)`}}),(0,$.jsxs)(`div`,{style:{position:`relative`,zIndex:1},children:[(0,$.jsx)(y1.Title,{level:3,style:{margin:`0 0 4px`,color:`#fff`,fontWeight:700},children:`我的项目`}),(0,$.jsxs)(y1.Text,{style:{color:`rgba(255,255,255,0.7)`,fontSize:14},children:[`共 `,i.length,` 个项目 · 按行业分类管理`]})]}),(0,$.jsx)(jD,{icon:(0,$.jsx)(MR,{}),onClick:()=>t(!0),size:`large`,style:{background:`rgba(255,255,255,0.15)`,border:`1px solid rgba(255,255,255,0.3)`,color:`#fff`,fontWeight:600,backdropFilter:`blur(10px)`,borderRadius:10,height:42},children:`新建项目`})]}),i.length===0?(0,$.jsx)(GC,{image:GC.PRESENTED_IMAGE_SIMPLE,description:`还没有项目,创建您的第一个视频项目`,style:{padding:`60px 0`},children:(0,$.jsx)(jD,{type:`primary`,icon:(0,$.jsx)(MR,{}),onClick:()=>t(!0),size:`large`,children:`创建第一个项目`})}):(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},className:`stagger-children`,children:i.map((e,t)=>(0,$.jsxs)(`div`,{className:`project-card project-item animate-slideInCard`,onClick:()=>r(`/projects/${e.id}/generate`),style:{display:`flex`,alignItems:`center`,padding:`18px 22px`,borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,cursor:`pointer`,animationDelay:`${t*.06}s`},children:[(0,$.jsx)(`div`,{style:{width:50,height:50,borderRadius:14,flexShrink:0,background:`${u[e.industry]?.color||`#64748b`}12`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:24,marginRight:16,color:u[e.industry]?.color||`#64748b`},children:t9[u[e.industry]?.icon]||(0,$.jsx)(i2,{})}),(0,$.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:4,flexWrap:`wrap`},children:[(0,$.jsx)(y1.Text,{strong:!0,style:{fontSize:15,color:`#1a1a2e`},children:e.name}),(0,$.jsx)(v$,{color:u[e.industry]?.color||`#64748b`,style:{borderRadius:6,margin:0},children:u[e.industry]?.label||e.industry})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,$.jsx)(VH,{style:{fontSize:12,color:`#94a3b8`}}),(0,$.jsxs)(`span`,{className:`date-display`,translate:`no`,style:{fontSize:12,color:`#94a3b8`},children:[`创建于 `,$7(e.createdAt)]})]})]}),(0,$.jsxs)(`div`,{className:`project-actions`,style:{display:`flex`,alignItems:`center`,gap:8,marginLeft:16},children:[(0,$.jsx)(jD,{type:`primary`,icon:(0,$.jsx)(u6,{}),onClick:t=>{t.stopPropagation(),r(`/projects/${e.id}/generate`)},style:{background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`,borderRadius:10,fontWeight:600,height:36,boxShadow:`0 4px 12px rgba(99,102,241,0.25)`},children:`生成`}),(0,$.jsx)(Mq,{title:`确定删除该项目?`,description:`项目下的生成记录将一并删除`,onConfirm:async t=>{t?.stopPropagation(),await s(e.id),Q.success(`项目已删除`)},onCancel:e=>e?.stopPropagation(),children:(0,$.jsx)(jD,{danger:!0,icon:(0,$.jsx)(x$,{}),onClick:e=>e.stopPropagation(),style:{borderRadius:10,height:36,background:`rgba(239,68,68,0.06)`,border:`1px solid rgba(239,68,68,0.15)`,color:`#ef4444`}})}),(0,$.jsx)(Bg,{className:`mobile-hide`,style:{color:`#cbd5e1`,fontSize:12}})]})]},e.id))}),(0,$.jsx)(Oq,{title:(0,$.jsxs)(kU,{children:[(0,$.jsx)(i2,{}),`新建项目`]}),open:e,onOk:async()=>{try{let e=await n.validateFields(),i=await o(e.name,e.industry);Q.success(`项目创建成功`),t(!1),n.resetFields(),r(`/projects/${i.id}/generate`)}catch{}},onCancel:()=>{t(!1),n.resetFields()},okText:`创建`,cancelText:`取消`,width:480,children:(0,$.jsxs)(CW,{form:n,layout:`vertical`,style:{marginTop:20},children:[(0,$.jsx)(CW.Item,{name:`name`,label:`项目名称`,rules:[{required:!0,message:`请输入项目名称`}],children:(0,$.jsx)(iK,{placeholder:`例如:618电商大促宣传片`,prefix:(0,$.jsx)(hZ,{}),size:`large`})}),(0,$.jsx)(CW.Item,{name:`industry`,label:`所属行业`,rules:[{required:!0,message:`请选择行业`}],children:(0,$.jsx)(xw,{placeholder:`选择项目所属行业`,size:`large`,children:c.map((e,t)=>(0,$.jsx)(xw.Option,{value:e.key,children:(0,$.jsxs)(kU,{children:[t9[e.icon]||(0,$.jsx)(i2,{}),` `,e.label]})},e.key))})})]})})]})};function r9(){if(typeof crypto<`u`&&typeof crypto.randomUUID==`function`)return crypto.randomUUID();if(typeof crypto<`u`&&typeof crypto.getRandomValues==`function`){let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}return`${Date.now().toString(16).padStart(12,`0`)}-${Math.random().toString(16).slice(2,10).padStart(8,`0`)}-4xxx-yxxx-${Math.random().toString(16).slice(2,12)}`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}var i9=({src:e,width:t=48,height:n=48})=>{let[r,i]=(0,S.useState)(null),[a,o]=(0,S.useState)(null);return(0,S.useEffect)(()=>{let r=document.createElement(`video`);r.muted=!0,r.preload=`metadata`,r.crossOrigin=`anonymous`;let a=()=>{o(r.duration),r.currentTime=Math.min(1,r.duration*.1)},s=()=>{try{let e=document.createElement(`canvas`);e.width=t*2,e.height=n*2;let a=e.getContext(`2d`);a&&(a.drawImage(r,0,0,e.width,e.height),i(e.toDataURL(`image/jpeg`,.7)))}catch{}};return r.addEventListener(`loadedmetadata`,a),r.addEventListener(`seeked`,s),r.src=e,()=>{r.removeEventListener(`loadedmetadata`,a),r.removeEventListener(`seeked`,s)}},[e,t,n]),(0,$.jsxs)(`div`,{style:{width:`100%`,height:`100%`,position:`relative`,background:`#1a1a2e`},children:[r?(0,$.jsx)(`img`,{src:r,style:{width:`100%`,height:`100%`,objectFit:`cover`,display:`block`}}):(0,$.jsx)(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(u6,{style:{color:`#fff`,fontSize:18}})}),a!=null&&(0,$.jsx)(`span`,{style:{position:`absolute`,bottom:2,right:2,fontSize:9,color:`#fff`,background:`rgba(0,0,0,0.6)`,borderRadius:4,padding:`1px 4px`,lineHeight:1.3},children:(e=>`${Math.round(e)}s`)(a)})]})},a9=()=>{let{projectId:e}=Ze(),t=qe(),[n]=CW.useForm(),{projects:r,records:i,fetchProjects:a,fetchRecords:o,optimizePrompt:s,generateVideo:c}=Q7(),l=i.items,{user:u}=B7(),[d,f]=(0,S.useState)(!1),[p,m]=(0,S.useState)(!1),[h,g]=(0,S.useState)(null),[_,v]=(0,S.useState)(``),[y,b]=(0,S.useState)(!1),[x,C]=(0,S.useState)({}),[w,T]=(0,S.useState)({}),[E,D]=(0,S.useState)({}),[O,k]=(0,S.useState)(null),[A,j]=(0,S.useState)(null),[M,N]=(0,S.useState)([]),[P,F]=(0,S.useState)(!1),[I,L]=(0,S.useState)(``),[R,z]=(0,S.useState)(!1),[B,V]=(0,S.useState)(``),H=(0,S.useRef)(null),[U,W]=(0,S.useState)({}),[ee,te]=(0,S.useState)({}),[G,ne]=(0,S.useState)({}),[K,q]=(0,S.useState)(null),[J,re]=(0,S.useState)({}),[Y,ie]=(0,S.useState)(null),[ae,oe]=(0,S.useState)(5),[se,ce]=(0,S.useState)(`16:9`),[le,ue]=(0,S.useState)(`720p`),[de,fe]=(0,S.useState)(null),[pe,me]=(0,S.useState)({ratios:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:[`720p`,`1080p`],durations:[5,8,10,12,15]}),[he,ge]=(0,S.useState)(0),[_e,ve]=(0,S.useState)(0),[ye,be]=(0,S.useState)(`image`),[xe,Se]=(0,S.useState)(`1:1`),[Ce,we]=(0,S.useState)(`2K`),[Te,Ee]=(0,S.useState)(2048),[De,Oe]=(0,S.useState)(2048),[ke,Ae]=(0,S.useState)(!1),[je,Me]=(0,S.useState)([]),[Ne,Pe]=(0,S.useState)([]);(0,S.useEffect)(()=>{if(X5().then(e=>{Me(e.video),Pe(e.image)}),!ke)return;let e=e=>{let t=e.target;!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&Ae(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[ke]);let Fe=(e,t)=>{for(let n=0;n{let t=e===`2k`?`2048`:e===`4k`?`4096`:e;for(let e=0;e{Ke(e)},Re=e=>{Ye(parseInt(e))},[ze,Be]=(0,S.useState)([]),[Ve,He]=(0,S.useState)([]),[Ue,We]=(0,S.useState)([]),[Ge,Ke]=(0,S.useState)(0),[Je,Ye]=(0,S.useState)(0);(0,S.useEffect)(()=>{Ue[Je]&&Ue[Je][Ge]!==void 0&&(Ee(Ue[Je][Ge].substring(0,4)),Oe(Ue[Je][Ge].substring(5)))},[Ge]),(0,S.useEffect)(()=>{Ue[Je]&&Ue[Je][Ge]!==void 0&&(Ee(Ue[Je][Ge].substring(0,4)),Oe(Ue[Je][Ge].substring(5)))},[Je]);let Xe=()=>{Ee(De),Oe(Te)},Qe=e=>{be(e.target.value===`image`?`image`:`video`)};(0,S.useEffect)(()=>{H5().then(e=>{W(Object.fromEntries(e.map(e=>[e.key,e.label]))),te(Object.fromEntries(e.map(e=>[e.key,e.optionGroups||[]])))}).catch(()=>{}),L5().then(e=>{let t=e.items?.[0]?.supportedSizes||{},n=[],r=[],i=[];for(let e in t[`2K`])n.push(e),r.push(t[`2K`][e]);n.forEach((e,t)=>{Be(n=>[...n,{value:e,label:String(t)}])});for(let e in t[`4K`])i.push(t[`4K`][e]);We([r,i]);let a=[];for(let e in t)a.push(e);a.forEach((e,t)=>{He(n=>[...n,{value:e,label:String(t)}])})}).catch(()=>{}),I5().then(e=>{if(e.items?.length){let t=e.items[0];me({ratios:t.supportedRatios?.length?t.supportedRatios:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:t.supportedResolutions?.length?t.supportedResolutions:[`720p`,`1080p`],durations:t.supportedDurations?.length?t.supportedDurations:[5,8,10,12,15]})}}).catch(()=>{})},[]),(0,S.useEffect)(()=>{a(),o({projectId:e,page:1,pageSize:100})},[e,a,o]);let $e=(0,S.useRef)(!1);(0,S.useEffect)(()=>{$e.current||l.length===0||($e.current=!0,console.log(`aaaa`,l),l.forEach(t=>{t.projectId===e&&t.status===`generating`&&(T(e=>({...e,[t.id]:`generating`})),Et(t.id)),t.projectId===e&&t.status===`optimizing`&&st(t.id)}))},[l,e]);let et=(0,S.useRef)(new Set),tt=(0,S.useRef)(null),nt=(0,S.useRef)(null),rt=e=>{et.current.add(e),ot()},it=e=>{et.current.delete(e),et.current.size===0&&at()},at=()=>{tt.current&&=(clearInterval(tt.current),null),nt.current&&=(nt.current.abort(),null)},ot=()=>{tt.current||=setInterval(async()=>{try{nt.current&&nt.current.abort();let t=new AbortController;nt.current=t;let n=await D5({projectId:e,page:1,pageSize:100,signal:t.signal});nt.current=null;let r=Array.from(et.current),i=[];if(r.length>0){let e=Q7.getState().records,t=e.items.map(e=>{if(r.includes(e.id)){let t=n.items.find(t=>t.id===e.id);if(t)return t.status!==`optimizing`&&i.push(e.id),t}return e});Q7.setState({records:{...e,items:t}}),i.forEach(e=>{it(e)})}}catch(e){e.name!==`AbortError`&&console.error(`Optimizing polling error:`,e)}},3e3)},st=e=>{rt(e)},ct=(0,S.useRef)(!1),lt=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(ct.current||l.length===0)return;let t=localStorage.getItem(`pending_optimize`);if(t)try{let{key:n,projectId:r,prompt:i,duration:a,ts:o}=JSON.parse(t);if(Date.now()-o>300*1e3||r!==e){localStorage.removeItem(`pending_optimize`);return}if(lt.current===n)return;let s=l.find(e=>e.projectId===r&&e.originalPrompt===i&&e.duration===a&&e.status===`prompt_optimized`&&new Date(e.createdAt).getTime()>o-1e4);s?(ct.current=!0,localStorage.removeItem(`pending_optimize`),g(s),v(s.optimizedPrompt||``),ge(s.textCreditsCost),ve(s.textTokensUsed),m(!0),Q.success({content:`优化请求已恢复,消耗 ${s.textCreditsCost} 积分`,key:`recovery`})):Date.now()-o>3e4&&localStorage.removeItem(`pending_optimize`)}catch{localStorage.removeItem(`pending_optimize`)}},[l,e]);let ut=r.find(t=>t.id===e),dt=l.filter(t=>t.projectId===e),ft=ut?.name??`项目`,pt=ut&&ee[ut.industry]||[],mt=u?.credits??0,ht=e=>{let t=e===`2k`?`2048`:e===`4k`?`4096`:e;for(let e=0;e=gt,vt=async()=>{try{if(!e){Q.error(`项目ID为空,请先选择项目`);return}let t=await n.validateFields();if(!t.prompt||!t.prompt.trim()){Q.error(`请输入视频/图片描述`);return}f(!0);let r=Object.entries(G).map(([e,t])=>`@${e}:${t}`),i=r.length>0?`${t.prompt}\n\n${r.join(`;`)}`:t.prompt,a=r9();localStorage.setItem(`pending_optimize`,JSON.stringify({key:a,projectId:e,prompt:i,duration:ae,ts:Date.now()})),lt.current=a;let o=await s(e,{prompt:i,duration:ae,genType:ye,resolution:Ce,references:M.length>0?M:void 0,idempotencyKey:a,image_size:Ce,image_proportion:xe,image_px:Te+`x`+De});localStorage.removeItem(`pending_optimize`),lt.current=null,g(o.record),v(o.record.optimizedPrompt||``),ge(o.textCreditsCost),ve(o.textTokensUsed),m(!0),Q.success({content:`「${ft}」提示词优化完成,消耗 ${o.textCreditsCost} 积分`,key:`optimize`})}catch(e){console.error(`优化提示词失败:`,e);let t=e?.response?.data?.message||e?.message||`操作失败,请稍后重试`;Q.error(t)}finally{f(!1),localStorage.removeItem(`pending_optimize`),lt.current=null}},yt=(0,S.useRef)(new Set),bt=(0,S.useRef)(null),xt=(0,S.useRef)(null),St=e=>{yt.current.add(e),Tt()},Ct=e=>{yt.current.delete(e),yt.current.size===0&&wt()},wt=()=>{bt.current&&=(clearInterval(bt.current),null),xt.current&&=(xt.current.abort(),null)},Tt=()=>{bt.current||=setInterval(async()=>{try{xt.current&&xt.current.abort();let t=new AbortController;xt.current=t;let n=await D5({projectId:e,page:1,pageSize:100,signal:t.signal});xt.current=null;let r=Array.from(yt.current),i=[];if(r.length>0){let e=Q7.getState().records,t=e.items.map(e=>{if(r.includes(e.id)){let t=n.items.find(t=>t.id===e.id);if(t)return t.status!==`generating`&&i.push(e.id),t}return e});Q7.setState({records:{...e,items:t}}),i.forEach(e=>{let t=n.items.find(t=>t.id===e);Ct(e),t?.status===`completed`?(T(t=>({...t,[e]:`done`})),g(n=>n?.id===e?t:n),Q.success({content:`「${ft}」视频生成完成!`,key:e,duration:5})):t?.status===`failed`&&(T(t=>({...t,[e]:`failed`})),g(n=>n?.id===e?t:n),Q.error({content:`「${ft}」视频生成失败: ${t.errorMessage||`未知错误`}`,key:e,duration:5}))})}}catch(e){e.name!==`AbortError`&&console.error(`Global polling error:`,e)}},5e3)},Et=e=>{St(e)};(0,S.useEffect)(()=>()=>{wt(),at()},[]);let Dt=async e=>{if(!_t){Q.error(`积分不足,请先充值`);return}C(t=>({...t,[e]:!0})),T(t=>({...t,[e]:`generating`})),Q.loading({content:`「${ft}」正在提交视频生成...`,duration:0,key:e});try{(await c(e,{aspectRatio:se,resolution:le})).status===`failed`?(T(t=>({...t,[e]:`failed`})),Q.error({content:`「${ft}」提交失败`,key:e,duration:3})):(Q.success({content:`「${ft}」已提交,正在生成中...`,key:e,duration:3}),Et(e))}catch(t){T(t=>({...t,[e]:`failed`}));let n=`提交失败`;t?.response?.data?.detail?n=t.response.data.detail:t?.data?.detail?n=t.data.detail:t?.detail?n=t.detail:t?.message&&(n=t.message),Q.error({content:`${n}`,key:e,duration:3})}finally{C(t=>({...t,[e]:!1}))}},Ot=async e=>{let t=dt.find(t=>t.id===e);if(t){C(t=>({...t,[e]:!0})),T(t=>({...t,[e]:`generating`})),Q.loading({content:`「${ft}」正在重新提交...`,duration:0,key:e});try{let n=E[e];n&&n!==t.optimizedPrompt&&await M5(e,n);let r=await c(e,{aspectRatio:t.aspectRatio||`16:9`,resolution:t.resolution||`720p`});console.log(`重新提交视频生成结果:`,r),r.status===`failed`?(T(t=>({...t,[e]:`failed`})),console.log(`12312`),Q.error({content:`「${ft}」提交失败`,key:e,duration:3})):(Q.success({content:`「${ft}」已提交,正在生成中...`,key:e,duration:3}),Et(e))}catch(t){T(t=>({...t,[e]:`failed`})),console.log(`1231`,t);let n=`提交失败`;t?.response?.data?.detail?n=t.response.data.detail:t?.data?.detail?n=t.data.detail:t?.detail?n=t.detail:t?.message&&(n=t.message),Q.error({content:`${n}`,key:e,duration:3})}finally{C(t=>({...t,[e]:!1}))}}},kt=e=>{let t=w[e.id];return t===`generating`?`generating`:t===`done`?`completed`:t===`failed`?`failed`:e.status},At={optimizing:{color:`processing`,text:`优化中`,icon:(0,$.jsx)(qm,{style:{animation:`spinSlow 1s linear infinite`}})},prompt_optimized:{color:`processing`,text:`待生成`,icon:(0,$.jsx)(WH,{})},generating:{color:`warning`,text:`生成中`,icon:(0,$.jsx)(qm,{style:{animation:`spinSlow 1s linear infinite`}})},completed:{color:`success`,text:`已完成`,icon:(0,$.jsx)(Q2,{})},failed:{color:`error`,text:`失败`,icon:(0,$.jsx)(t4,{})}},jt=({label:e,value:t,options:n,suffix:r,expanded:i,onToggle:a,onSelect:o,onClose:s})=>{let c=(0,S.useRef)(null),l=(0,S.useRef)(null),u=(0,S.useRef)(i),[d,f]=(0,S.useState)(null);return u.current=i,(0,S.useEffect)(()=>{if(i&&c.current){let e=c.current.getBoundingClientRect();f({bottom:window.innerHeight-e.top+4,left:e.left,width:Math.max(e.width,100)})}else f(null)},[i]),(0,S.useEffect)(()=>{if(!i)return;let e=e=>{c.current?.contains(e.target)||l.current?.contains(e.target)||u.current&&s()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i,s]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{ref:c,onClick:a,translate:`no`,style:{display:`flex`,alignItems:`center`,gap:6,padding:`5px 12px`,borderRadius:8,cursor:`pointer`,userSelect:`none`,transition:`background 0.2s, border-color 0.2s`,background:i?`rgba(99,102,241,0.08)`:`#f8f9fc`,border:i?`1px solid #6366f1`:`1px solid #e2e8f0`,minWidth:70,whiteSpace:`nowrap`,flexShrink:0},children:[(0,$.jsxs)(`span`,{style:{fontSize:12,color:`#6366f1`,fontWeight:500,lineHeight:`18px`},children:[t,r]}),(0,$.jsx)(vQ,{style:{fontSize:9,color:`#94a3b8`,transition:`transform 0.2s`,transform:i?`rotate(180deg)`:`rotate(0deg)`}})]}),d&&(0,Ri.createPortal)((0,$.jsxs)(`div`,{ref:l,style:{position:`fixed`,bottom:d.bottom,left:d.left,minWidth:d.width,background:`#fff`,borderRadius:12,padding:6,zIndex:99999,boxShadow:`0 8px 30px rgba(0,0,0,0.12)`,border:`1px solid #e2e8f0`},children:[(0,$.jsx)(y1.Text,{style:{fontSize:10,color:`#94a3b8`,display:`block`,padding:`2px 6px 4px`},children:e}),(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2},children:n.map((e,n)=>{let r=t===e;return(0,$.jsx)(`div`,{onClick:()=>{o(e),s()},style:{padding:`6px 10px`,borderRadius:8,fontSize:13,cursor:`pointer`,transition:`all 0.15s`,background:r?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`transparent`,color:r?`#fff`:`#1a1a2e`,fontWeight:r?600:400},onMouseEnter:e=>{r||(e.currentTarget.style.background=`#f1f5f9`)},onMouseLeave:e=>{r||(e.currentTarget.style.background=`transparent`)},children:e},n)})})]}),document.body)]})},Mt=({group:e,selected:t,expanded:n,onToggle:r,onSelect:i,onClose:a})=>{let o=(0,S.useRef)(null),s=(0,S.useRef)(null),c=(0,S.useRef)(n),[l,u]=(0,S.useState)(null);return c.current=n,(0,S.useEffect)(()=>{if(n&&o.current){let e=o.current.getBoundingClientRect();u({bottom:window.innerHeight-e.top+4,left:e.left})}else u(null)},[n]),(0,S.useEffect)(()=>{if(!n)return;let e=e=>{o.current?.contains(e.target)||s.current?.contains(e.target)||c.current&&a()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[n,a]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{ref:o,onClick:r,style:{display:`flex`,alignItems:`center`,gap:6,padding:`5px 12px`,borderRadius:8,cursor:`pointer`,userSelect:`none`,transition:`all 0.2s`,background:t?`rgba(99,102,241,0.08)`:`#f8f9fc`,border:n?`1px solid #6366f1`:`1px solid #e2e8f0`},children:[(0,$.jsx)(y1.Text,{style:{fontSize:12,color:t?`#6366f1`:`#64748b`,fontWeight:t?600:400},children:t||e.name}),(0,$.jsx)(vQ,{style:{fontSize:9,color:t?`#6366f1`:`#94a3b8`,transition:`transform 0.2s`,transform:n?`rotate(180deg)`:`rotate(0deg)`}})]}),l&&(0,Ri.createPortal)((0,$.jsxs)(`div`,{ref:s,style:{position:`fixed`,bottom:l.bottom,left:l.left,background:`#fff`,borderRadius:12,padding:8,minWidth:160,zIndex:99999,boxShadow:`0 8px 30px rgba(0,0,0,0.12)`,border:`1px solid #e2e8f0`},children:[(0,$.jsx)(y1.Text,{style:{fontSize:10,color:`#94a3b8`,display:`block`,padding:`2px 6px 4px`},children:e.name}),(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2},children:e.options.map((e,n)=>{let r=t===e;return(0,$.jsx)(`div`,{onClick:()=>{i(e),a()},style:{padding:`6px 10px`,borderRadius:8,fontSize:13,cursor:`pointer`,transition:`all 0.15s`,background:r?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`transparent`,color:r?`#fff`:`#1a1a2e`,fontWeight:r?600:400},onMouseEnter:e=>{r||(e.currentTarget.style.background=`#f1f5f9`)},onMouseLeave:e=>{r||(e.currentTarget.style.background=`transparent`)},children:e},n)})})]}),document.body)]})};return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`gen-header animate-fadeInUp`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:24,padding:`20px 28px`,borderRadius:16,background:`linear-gradient(135deg, #1e1b4b 0%, #312e81 100%)`,position:`relative`,overflow:`hidden`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,right:-30,bottom:-30,width:160,height:160,borderRadius:`50%`,background:`rgba(255,255,255,0.05)`}}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:14,position:`relative`},children:[(0,$.jsx)(jD,{icon:(0,$.jsx)(u2,{}),onClick:()=>t(`/projects`),style:{background:`rgba(255,255,255,0.1)`,border:`1px solid rgba(255,255,255,0.2)`,color:`#fff`,borderRadius:10}}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,$.jsx)(y1.Title,{level:4,style:{margin:0,color:`#fff`,fontWeight:700},children:ft}),ut&&(0,$.jsx)(v$,{style:{background:`rgba(255,255,255,0.12)`,border:`1px solid rgba(255,255,255,0.2)`,color:`rgba(255,255,255,0.8)`,borderRadius:6},children:U[ut.industry]||ut.industry})]}),(0,$.jsx)(y1.Text,{style:{color:`rgba(255,255,255,0.5)`,fontSize:13},children:`描述视频 → AI优化 → 生成视频`})]})]}),(0,$.jsxs)(v$,{style:{background:`rgba(255,255,255,0.1)`,border:`1px solid rgba(255,255,255,0.2)`,color:`#fff`,borderRadius:20,fontSize:13,padding:`4px 14px`},children:[`剩余 `,mt,` 积分`]})]}),!p&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`animate-fadeInUp`,style:{marginBottom:24,padding:`16px 20px`,borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,boxShadow:`0 2px 12px rgba(0,0,0,0.03)`},children:(0,$.jsxs)(`div`,{style:{width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`flex-start`},children:[(0,$.jsxs)(`div`,{style:{marginRight:70,position:`relative`},children:[(0,$.jsx)(y1.Text,{style:{fontSize:14,fontWeight:500,color:`#475569`,marginRight:16},children:`生成类型:`}),(0,$.jsxs)(GL.Group,{defaultValue:`image`,buttonStyle:`solid`,onChange:Qe,children:[(0,$.jsxs)(GL.Button,{value:`image`,style:{zIndex:0},children:[(0,$.jsx)(t6,{style:{marginRight:6,fontSize:14}}),` `,`图片`]}),(0,$.jsxs)(GL.Button,{value:`video`,children:[(0,$.jsx)(L8,{style:{marginRight:6,fontSize:14}}),` `,`视频`]})]})]}),ye===`video`&&[{icon:(0,$.jsx)(w$,{}),label:`描述视频+时长`,color:`#6366f1`},{icon:(0,$.jsx)(y8,{}),label:`AI智能优化`,color:`#8b5cf6`},{icon:(0,$.jsx)(T6,{}),label:`选择参数生成`,color:`#10b981`}].map((e,t)=>(0,$.jsxs)(S.Fragment,{children:[t>0&&(0,$.jsx)(`div`,{style:{width:40,height:1,background:`linear-gradient(90deg, #e2e8f0, #cbd5e1, #e2e8f0)`,margin:`0 12px`,flexShrink:0}}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:10,background:`${e.color}12`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(`span`,{style:{color:e.color,fontSize:15},children:e.icon})}),(0,$.jsx)(y1.Text,{style:{fontSize:13,fontWeight:500,color:`#1a1a2e`},children:e.label})]})]},t)),ye===`image`&&[{icon:(0,$.jsx)(w$,{}),label:`描述图片+尺寸`,color:`#6366f1`},{icon:(0,$.jsx)(y8,{}),label:`AI智能优化`,color:`#8b5cf6`},{icon:(0,$.jsx)(T6,{}),label:`图片生成`,color:`#10b981`}].map((e,t)=>(0,$.jsxs)(S.Fragment,{children:[t>0&&(0,$.jsx)(`div`,{style:{width:40,height:1,background:`linear-gradient(90deg, #e2e8f0, #cbd5e1, #e2e8f0)`,margin:`0 12px`,flexShrink:0}}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:10,background:`${e.color}12`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(`span`,{style:{color:e.color,fontSize:15},children:e.icon})}),(0,$.jsx)(y1.Text,{style:{fontSize:13,fontWeight:500,color:`#1a1a2e`},children:e.label})]})]},t))]})}),(0,$.jsxs)(CW,{form:n,initialValues:{},children:[(0,$.jsx)(CW.Item,{name:`prompt`,noStyle:!0,rules:[{required:!0,message:`请输入视频描述`}],style:{display:`none`}}),(0,$.jsxs)(`div`,{className:`animate-fadeInUp`,style:{borderRadius:20,background:`#fff`,border:`1px solid #f0f0f5`,boxShadow:`0 4px 24px rgba(0,0,0,0.04)`,overflow:`visible`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`12px 16px 0`,minHeight:60},children:[M.map((e,t)=>(0,$.jsxs)(`div`,{className:`ref-thumb`,style:{position:`relative`,width:48,height:48,borderRadius:12,overflow:`visible`,flexShrink:0},children:[(0,$.jsx)(`div`,{style:{width:48,height:48,borderRadius:12,overflow:`hidden`,border:`1px solid #e2e8f0`,cursor:`pointer`},onClick:()=>{e.type===`video`&&ie(`http://ceshi.apiforeign.minzhong.cn${e.url}`)},children:e.type===`image`?(0,$.jsx)(CG,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(i9,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`})}),(0,$.jsx)(`div`,{className:`ref-delete`,onClick:n=>{n.stopPropagation(),j5(e.url).catch(()=>{}),N(e=>e.filter((e,n)=>n!==t))},style:{position:`absolute`,top:-4,right:-4,width:16,height:16,borderRadius:`50%`,background:`rgba(0,0,0,0.55)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,zIndex:10,opacity:0,transition:`opacity 0.15s`,backdropFilter:`blur(4px)`},children:(0,$.jsx)(t4,{style:{color:`#fff`,fontSize:10}})})]},t)),(0,$.jsx)(p0,{accept:`image/*,video/*`,showUploadList:!1,multiple:!0,beforeUpload:e=>{let t=e.type.startsWith(`image/`),n=e.type.startsWith(`video/`);if(!t&&!n)return Q.error(`仅支持图片或视频文件`),!1;let r=n?100:10;if(e.size/1024/1024>r)return Q.error(`${n?`视频`:`图片`}大小不能超过${r}MB`),!1;let i=M.filter(e=>e.type===`image`).length,a=M.filter(e=>e.type===`video`).length;return t&&i>=10?(Q.error(`最多上传10张图片`),!1):n&&a>=3?(Q.error(`最多上传3个视频`),!1):(F(!0),(t?k5:A5)(e).then(e=>{let n=t?`图片`:`视频`,r=t?i+1:a+1;N(i=>[...i,{url:e.url,type:t?`image`:`video`,name:`${n}${r}`}]),Q.success(`${n}上传成功`)}).catch(()=>Q.error(`上传失败`)).finally(()=>F(!1)),!1)},children:(0,$.jsx)(uT,{title:`参考内容(${M.length}/10)`,children:(0,$.jsx)(`div`,{style:{width:48,height:48,borderRadius:12,border:`1.5px dashed #d9d9d9`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,transition:`all 0.2s`,flexShrink:0},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#6366f1`,e.currentTarget.style.background=`rgba(99,102,241,0.04)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`#d9d9d9`,e.currentTarget.style.background=`transparent`},children:P?(0,$.jsx)(qm,{style:{fontSize:18,color:`#6366f1`}}):(0,$.jsx)(MR,{style:{fontSize:18,color:`#94a3b8`}})})})})]}),(0,$.jsx)(`div`,{style:{padding:`8px 16px 4px`},children:(0,$.jsx)(iK.TextArea,{ref:H,value:I,onChange:e=>{let t=e.target.value;L(t),n.setFieldsValue({prompt:t});let r=t.lastIndexOf(`@`);if(r>=0){let e=t.slice(r+1);if(!e.includes(` `)&&!e.includes(` `)){z(!0),V(e);return}}z(!1)},rows:3,placeholder:`上传参考素材、输入文字,自由组合图、文多元素。输入 @ 可引用参考内容...`,maxLength:500,bordered:!1,autoSize:{minRows:2,maxRows:6},style:{padding:`6px 2px`,fontSize:15,lineHeight:1.7,resize:`none`,caretColor:`#6366f1`}})}),R&&M.length>0&&(0,$.jsx)(`div`,{style:{margin:`0 16px 8px`,background:`#fff`,borderRadius:10,boxShadow:`0 6px 24px rgba(0,0,0,0.12)`,border:`1px solid #e2e8f0`,padding:6,maxHeight:180,overflowY:`auto`},children:M.filter(e=>!B||e.name.includes(B)).map((e,t)=>(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`8px 10px`,borderRadius:8,cursor:`pointer`,transition:`background 0.15s`},onMouseEnter:e=>e.currentTarget.style.background=`#f1f5f9`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,onMouseDown:t=>{t.preventDefault();let r=H.current?.resizableTextArea?.textArea||H.current?.nativeElement?.querySelector(`textarea`)||H.current;if(!r||!r.value)return;let i=r.value,a=i.lastIndexOf(`@`),o=i.slice(0,a)+`@${e.name} `;L(o),n.setFieldValue(`prompt`,o),z(!1),setTimeout(()=>{r.focus(),r.selectionStart=o.length,r.selectionEnd=o.length},50)},children:[(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:8,overflow:`hidden`,background:e.type===`image`?`#f1f5f9`:`#1a1a2e`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:e.type===`image`?(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(u6,{style:{color:`#fff`,fontSize:14}})}),(0,$.jsx)(y1.Text,{style:{fontSize:13},children:e.name}),(0,$.jsx)(v$,{style:{marginLeft:`auto`,fontSize:11},children:e.type===`image`?`图片`:`视频`})]},t))}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`8px 12px 12px`,gap:8,flexWrap:`wrap`,position:`relative`,zIndex:50,minHeight:48},children:[ye!==`image`&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,flex:1,flexWrap:`wrap`},children:[(0,$.jsx)(jt,{label:`时长`,value:`${ae}`,options:pe.durations.map(e=>`${e}`),suffix:`秒`,expanded:de===`duration`,onToggle:()=>fe(de===`duration`?null:`duration`),onSelect:e=>oe(parseInt(e)),onClose:()=>fe(null)}),pt.map((e,t)=>{let n=K===e.name,r=G[e.name];return(0,$.jsx)(Mt,{group:e,selected:r,expanded:n,onToggle:()=>q(n?null:e.name),onSelect:t=>{ne(n=>{let r={...n};return r[e.name]===t?delete r[e.name]:r[e.name]=t,r})},onClose:()=>q(null)},`og-${t}`)})]}),ye==`image`&&(0,$.jsxs)(`div`,{style:{position:`relative`,display:`inline-block`},children:[(0,$.jsxs)(`button`,{onClick:()=>Ae(!ke),className:`image-settings-trigger`,style:{minWidth:220,padding:`0px 16px`,height:30,borderRadius:10,border:`1px solid #e2e8f0`,backgroundColor:`#f8f9fc`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,transition:`all 0.2s`},children:[(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:(0,$.jsxs)(`div`,{style:{textAlign:`left`},children:[(0,$.jsx)(y1.Text,{style:{fontSize:13,fontWeight:600,color:`#374151`,marginRight:10},children:xe===`auto`?`智能`:xe}),(0,$.jsxs)(y1.Text,{style:{fontSize:12,color:`#9ca3af`},children:[Ce==`2K`?`高清 2K`:`超清 4K`,`| `,Te,`×`,De]})]})}),(0,$.jsx)(vQ,{style:{fontSize:14,color:`#9ca3af`}})]}),ke&&(0,$.jsxs)(`div`,{className:`image-settings-popover`,style:{position:`absolute`,bottom:`calc(100% + 8px)`,left:0,width:520,backgroundColor:`#fff`,borderRadius:16,boxShadow:`0 10px 40px rgba(0,0,0,0.15)`,padding:20,border:`none`,zIndex:9999},onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{style:{marginBottom:20},children:[(0,$.jsx)(y1.Text,{style:{display:`block`,marginBottom:10,fontSize:13,fontWeight:500,color:`#666666`},children:`选择比例`}),(0,$.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6},children:ze.map(e=>(0,$.jsxs)(`button`,{onClick:()=>{Se(e.value),Le(e.label)},style:{flex:`0 0 calc(11.11% - 5px)`,minWidth:48,height:56,borderRadius:8,border:xe===e.value?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:xe===e.value?`#fff`:`#f9fafb`,cursor:`pointer`,display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,transition:`all 0.2s`},children:[(0,$.jsx)(`div`,{style:{width:e.value===`auto`?16:20,height:e.value===`auto`?16:20,border:`2px solid ${xe===e.value?`#6366f1`:`#9ca3af`}`,borderRadius:(e.value,3),marginBottom:3,display:`flex`,alignItems:`center`,justifyContent:`center`},children:e.value===`auto`&&(0,$.jsx)(`span`,{style:{fontSize:8,color:xe===e.value?`#6366f1`:`#9ca3af`},children:`智`})}),(0,$.jsx)(`span`,{style:{fontSize:10,color:xe===e.value?`#6366f1`:`#6b7280`,fontWeight:xe===e.value?600:400},children:e.value})]},e.value))})]}),(0,$.jsxs)(`div`,{style:{marginBottom:20},children:[(0,$.jsx)(y1.Text,{style:{display:`block`,marginBottom:10,fontSize:13,fontWeight:500,color:`#666666`},children:`选择分辨率`}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:8},children:Ve.map(e=>(0,$.jsx)(`button`,{onClick:()=>{we(e.value),Re(e.label)},style:{flex:1,height:48,borderRadius:8,border:Ce===e.value?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:Ce===e.value?`#6366f1`:`#f9fafb`,cursor:`pointer`,display:`flex`,justifyContent:`center`,alignItems:`center`,transition:`all 0.2s`},children:(0,$.jsxs)(`span`,{style:{fontSize:13,fontWeight:600,color:Ce===e.value?`#fff`:`#4b5563`},children:[e.value,e.value===`4k`&&(0,$.jsx)(`span`,{style:{marginLeft:3},children:`✨`})]})},e.value))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(y1.Text,{style:{display:`block`,marginBottom:10,fontSize:13,fontWeight:500,color:`#666666`},children:`尺寸`}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,flex:1,maxWidth:140},children:[(0,$.jsx)(`span`,{style:{color:`#9ca3af`,fontSize:12,marginRight:6},children:`W`}),(0,$.jsx)(iK,{value:Te,onChange:e=>Ee(Number(e.target.value)||0),style:{flex:1,textAlign:`center`,borderRadius:6,height:40,border:`1px solid #e5e7eb`,backgroundColor:`#f9fafb`,fontSize:14,fontWeight:600,color:`#1f2937`}})]}),(0,$.jsx)(`button`,{onClick:Xe,style:{width:28,height:28,borderRadius:6,border:`1px solid #e5e7eb`,backgroundColor:`#fff`,cursor:`pointer`,display:`flex`,justifyContent:`center`,alignItems:`center`,color:`#6366f1`},children:(0,$.jsx)(cG,{style:{fontSize:12}})}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,flex:1,maxWidth:140},children:[(0,$.jsx)(`span`,{style:{color:`#9ca3af`,fontSize:12,marginRight:6},children:`H`}),(0,$.jsx)(iK,{value:De,onChange:e=>Oe(Number(e.target.value)||0),style:{flex:1,textAlign:`center`,borderRadius:6,height:40,border:`1px solid #e5e7eb`,backgroundColor:`#f9fafb`,fontSize:14,fontWeight:600,color:`#1f2937`}})]}),(0,$.jsx)(`span`,{style:{color:`#9ca3af`,fontSize:12},children:`PX`})]})]})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexShrink:0},children:[ye===`image`&&(0,$.jsx)(`span`,{style:{color:`#7c7c7c`,fontSize:14},children:`(请在左侧选择图片比例和尺寸)`}),(0,$.jsx)(jD,{type:`primary`,size:`large`,onClick:vt,loading:d,style:{borderRadius:10,fontWeight:600,minWidth:140,height:40,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,boxShadow:`0 4px 16px rgba(99,102,241,0.35)`},children:`AI优化提示词`})]})]})]})]})]}),p&&h&&(0,$.jsxs)(Wz,{className:`animate-fadeInUp`,style:{borderRadius:16},styles:{body:{padding:`24px 28px`}},children:[!w[h.id]||w[h.id]===`idle`?(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:14,marginBottom:24,padding:`14px 18px`,borderRadius:12,background:`linear-gradient(135deg, rgba(16,185,129,0.06), rgba(5,150,105,0.06))`,border:`1px solid rgba(16,185,129,0.15)`},children:[(0,$.jsx)(Q2,{style:{color:`#10b981`,fontSize:22}}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(y1.Text,{strong:!0,style:{fontSize:15,display:`block`},children:`提示词优化完成`}),(0,$.jsxs)(y1.Text,{style:{fontSize:12,color:`#94a3b8`},children:[`文本优化消耗 `,he,` 积分· 您可以编辑提示词后选择参数生成视频`]})]})]}):(0,$.jsxs)(`div`,{style:{marginBottom:24,padding:`16px 18px`,borderRadius:12,display:`flex`,alignItems:`center`,gap:12,background:w[h.id]===`failed`?`rgba(239,68,68,0.04)`:w[h.id]===`done`?`rgba(16,185,129,0.04)`:`rgba(99,102,241,0.04)`,border:`1px solid ${w[h.id]===`failed`?`rgba(239,68,68,0.12)`:w[h.id]===`done`?`rgba(16,185,129,0.12)`:`rgba(99,102,241,0.12)`}`},children:[w[h.id]===`generating`&&(0,$.jsx)(qm,{style:{color:`#6366f1`,fontSize:18},spin:!0}),w[h.id]===`done`&&(0,$.jsx)(Q2,{style:{color:`#10b981`,fontSize:18}}),w[h.id]===`failed`&&(0,$.jsx)(t4,{style:{color:`#ef4444`,fontSize:18}}),(0,$.jsxs)(y1.Text,{strong:!0,style:{fontSize:14,color:w[h.id]===`failed`?`#ef4444`:w[h.id]===`done`?`#10b981`:`#6366f1`},children:[w[h.id]===`generating`&&`${ye===`image`?`图片`:`视频`}生成中,请稍候...`,w[h.id]===`done`&&`${ye===`image`?`图片`:`视频`}生成成功`,w[h.id]===`failed`&&`${ye===`image`?`图片`:`视频`}生成失败,请重试`]})]}),!w[h.id]||w[h.id]===`idle`||w[h.id]===`failed`?(0,$.jsxs)(`div`,{className:`gen-prompt-row`,style:{display:`flex`,gap:20,flexWrap:`wrap`},children:[(0,$.jsxs)(`div`,{style:{flex:`1 1 45%`,minWidth:240},children:[(0,$.jsx)(y1.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:`原始提示词`}),(0,$.jsx)(`div`,{style:{padding:14,borderRadius:12,background:`#f8f9fc`,border:`1px solid #f0f0f5`,minHeight:100},children:(0,$.jsx)(y1.Text,{style:{fontSize:14,color:`#64748b`,lineHeight:1.7},children:h.originalPrompt})})]}),(0,$.jsxs)(`div`,{style:{flex:`1 1 45%`,minWidth:240},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:8},children:[(0,$.jsxs)(y1.Text,{style:{fontSize:12,color:`#94a3b8`},children:[`优化后的提示词`,` `,!y&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),!y&&(0,$.jsxs)(kU,{size:4,children:[(0,$.jsx)(uT,{title:`复制`,children:(0,$.jsx)(jD,{type:`text`,size:`small`,icon:(0,$.jsx)(q$,{}),onClick:()=>{navigator.clipboard.writeText(_),Q.success(`已复制`)},style:{color:`#94a3b8`}})}),(0,$.jsx)(uT,{title:`编辑`,children:(0,$.jsx)(jD,{type:`text`,size:`small`,icon:(0,$.jsx)(w$,{}),onClick:()=>b(!0),style:{color:`#6366f1`}})})]})]}),y?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(iK.TextArea,{value:_,onChange:e=>v(e.target.value),rows:5,style:{borderRadius:12,fontSize:14,lineHeight:1.7,border:`1px solid rgba(99,102,241,0.25)`,background:`rgba(99,102,241,0.02)`}}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:8},children:[(0,$.jsx)(jD,{size:`small`,onClick:()=>{v(h.optimizedPrompt||``),b(!1)},children:`取消`}),(0,$.jsx)(jD,{size:`small`,type:`primary`,onClick:()=>{b(!1),Q.success(`提示词已更新`)},style:{borderRadius:6,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`},children:`保存`})]})]}):(0,$.jsx)(`div`,{style:{padding:14,borderRadius:12,background:`rgba(99,102,241,0.02)`,border:`1px solid rgba(99,102,241,0.1)`,minHeight:100},children:(0,$.jsx)(y1.Text,{style:{fontSize:14,color:`#1a1a2e`,lineHeight:1.7},children:_})})]})]}):(0,$.jsxs)(`div`,{className:`gen-prompt-row`,style:{display:`flex`,gap:24,flexWrap:`wrap`},children:[(0,$.jsxs)(`div`,{style:{flex:`1 1 55%`,minWidth:280},children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(y1.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:`原始提示词`}),(0,$.jsx)(`div`,{style:{padding:14,borderRadius:12,background:`#f8f9fc`,border:`1px solid #f0f0f5`,minHeight:80},children:(0,$.jsx)(y1.Text,{style:{fontSize:13,color:`#64748b`,lineHeight:1.6},children:h.originalPrompt})})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:8},children:[(0,$.jsxs)(y1.Text,{style:{fontSize:12,color:`#94a3b8`},children:[`优化后的提示词`,` `,!y&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),!y&&(0,$.jsxs)(kU,{size:4,children:[(0,$.jsx)(uT,{title:`复制`,children:(0,$.jsx)(jD,{type:`text`,size:`small`,icon:(0,$.jsx)(q$,{}),onClick:()=>{navigator.clipboard.writeText(_),Q.success(`已复制`)},style:{color:`#94a3b8`}})}),(0,$.jsx)(uT,{title:`编辑`,children:(0,$.jsx)(jD,{type:`text`,size:`small`,icon:(0,$.jsx)(w$,{}),onClick:()=>b(!0),style:{color:`#6366f1`}})})]})]}),y?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(iK.TextArea,{value:_,onChange:e=>v(e.target.value),rows:5,style:{borderRadius:12,fontSize:13,lineHeight:1.6,border:`1px solid rgba(99,102,241,0.25)`,background:`rgba(99,102,241,0.02)`}}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:8},children:[(0,$.jsx)(jD,{size:`small`,onClick:()=>{v(h.optimizedPrompt||``),b(!1)},children:`取消`}),(0,$.jsx)(jD,{size:`small`,type:`primary`,onClick:()=>{b(!1),Q.success(`提示词已更新`)},style:{borderRadius:6,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`},children:`保存`})]})]}):(0,$.jsx)(`div`,{style:{padding:14,borderRadius:12,background:`rgba(99,102,241,0.02)`,border:`1px solid rgba(99,102,241,0.1)`,minHeight:120},children:(0,$.jsx)(y1.Text,{style:{fontSize:13,color:`#1a1a2e`,lineHeight:1.6},children:_})})]})]}),(0,$.jsxs)(`div`,{style:{flex:`1 1 40%`,minWidth:280},children:[h.videoUrl&&(0,$.jsxs)(`div`,{children:[(0,$.jsx)(y1.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:`生成视频`}),(0,$.jsx)(`div`,{style:{borderRadius:12,overflow:`hidden`,border:`1px solid #f0f0f5`,background:`#000`},children:(0,$.jsx)(`video`,{src:`http://ceshi.apiforeign.minzhong.cn${h.videoUrl}`,controls:!0,style:{width:`100%`,maxHeight:350,display:`block`}})})]}),h.imageUrl&&(0,$.jsxs)(`div`,{children:[(0,$.jsx)(y1.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:`生成图片`}),(0,$.jsx)(CG,{src:`http://ceshi.apiforeign.minzhong.cn${h.imageUrl}`,style:{width:`100%`,maxHeight:350,objectFit:`contain`,borderRadius:12,border:`1px solid #f0f0f5`},preview:!0})]})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginTop:20,padding:`14px 18px`,borderRadius:12,background:`#f8f9fc`,border:`1px solid #f0f0f5`},children:[ye!==`image`&&(0,$.jsxs)(`div`,{style:{marginTop:24,borderRadius:12,background:`#f8f9fc`,width:`25%`},children:[(0,$.jsx)(y1.Text,{style:{fontSize:13,color:`#1a1a2e`,fontWeight:600,display:`block`,marginBottom:12},children:`选择视频参数`}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`5px 12px`,borderRadius:8,background:`#f8f9fc`,border:`1px solid #e2e8f0`},children:[(0,$.jsx)(y1.Text,{style:{fontSize:12,color:`#94a3b8`},children:`时长`}),(0,$.jsxs)(y1.Text,{strong:!0,style:{fontSize:13,color:`#6366f1`},children:[ae,`s`]})]}),(0,$.jsx)(jt,{label:`比例`,value:se,options:pe.ratios,expanded:de===`ratio`,onToggle:()=>fe(de===`ratio`?null:`ratio`),onSelect:e=>ce(e),onClose:()=>fe(null)}),(0,$.jsx)(jt,{label:`分辨率`,value:le,options:pe.resolutions,expanded:de===`resolution`,onToggle:()=>fe(de===`resolution`?null:`resolution`),onSelect:e=>ue(e),onClose:()=>fe(null)})]})]}),ye==`image`&&h&&(0,$.jsx)(`div`,{style:{marginTop:24,borderRadius:12,background:`#f8f9fc`,width:`25%`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-around`},children:[(0,$.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,$.jsx)(y1.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`,marginBottom:4},children:`分辨率`}),(0,$.jsx)(y1.Text,{strong:!0,style:{fontSize:14,color:`#1a1a2e`},children:h.imageSize||`-`})]}),(0,$.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,$.jsx)(y1.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`,marginBottom:4},children:`画面比例`}),(0,$.jsx)(y1.Text,{strong:!0,style:{fontSize:14,color:`#1a1a2e`},children:h.imageProportion||`-`})]}),(0,$.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,$.jsx)(y1.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`,marginBottom:4},children:`画面尺寸`}),(0,$.jsx)(y1.Text,{strong:!0,style:{fontSize:14,color:`#1a1a2e`},children:h.imagePx||`-`})]})]})}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16},children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(y1.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`文字积分`}),(0,$.jsx)(y1.Text,{strong:!0,style:{fontSize:14,color:`#6366f1`},children:he})]}),(0,$.jsx)(y1.Text,{style:{color:`#cbd5e1`,fontSize:18},children:`+`}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(y1.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:[`预估`,ye===`image`?`图片`:`视频`,`积分`]}),(0,$.jsx)(y1.Text,{strong:!0,style:{fontSize:14,color:`#10b981`},children:ye===`image`&&h.imageSize?ht(h.imageSize)||gt:Fe(ae,le)})]}),(0,$.jsx)(y1.Text,{style:{color:`#cbd5e1`,fontSize:18},children:`=`}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(y1.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`总计`}),(0,$.jsx)(y1.Text,{strong:!0,style:{fontSize:16,color:`#1a1a2e`},children:(he+(ye===`image`?ht(h.imageSize):Fe(ae,le))).toFixed(2)})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:12},children:[(0,$.jsxs)(jD,{size:`large`,onClick:()=>{m(!1),g(null),v(``),L(``),N([]),ne({}),q(null),fe(null),n.resetFields()},style:{borderRadius:12,minWidth:120,height:44,fontWeight:500},children:[`配置新`,ye===`image`?`图片`:`视频`]}),(0,$.jsx)(uT,{title:_t?``:`积分不足`,children:(0,$.jsx)(jD,{type:`primary`,size:`large`,icon:(0,$.jsx)(T6,{}),onClick:()=>Dt(h.id),loading:w[h.id]===`generating`,disabled:!_t||w[h.id]===`generating`||w[h.id]===`done`,style:{borderRadius:12,minWidth:180,height:44,fontWeight:600,background:w[h.id]===`done`?`#10b981`:_t?`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`:`#d1d5db`,border:`none`,boxShadow:_t?`0 8px 24px rgba(99,102,241,0.3)`:`none`},children:w[h.id]===`done`?`生成完成`:w[h.id]===`generating`?`生成中...`:`生成${ye===`image`?`图片`:`视频`} (${ye===`image`?ht(h.imageSize):Fe(ae,le)}积分)`})})]})]}),h.references&&h.references.length>0&&(0,$.jsxs)(`div`,{style:{marginTop:16},children:[(0,$.jsx)(y1.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:`参考内容`}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`},children:h.references.map((e,t)=>(0,$.jsxs)(`div`,{style:{width:64,height:64,borderRadius:10,overflow:`hidden`,border:`1px solid #e2e8f0`,position:`relative`,cursor:`pointer`},onClick:()=>{e.type===`video`&&ie(`http://ceshi.apiforeign.minzhong.cn${e.url}`)},children:[e.type===`image`?(0,$.jsx)(CG,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`},preview:!0}):(0,$.jsx)(i9,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,width:64,height:64}),(0,$.jsx)(v$,{style:{position:`absolute`,bottom:0,left:0,right:0,margin:0,fontSize:9,textAlign:`center`,borderRadius:`0 0 8px 8px`,background:`rgba(0,0,0,0.5)`,border:`none`,color:`#fff`,padding:`0 2px`},children:e.name})]},t))})]})]}),dt.length>0&&(0,$.jsxs)(`div`,{style:{marginTop:24},children:[(0,$.jsx)(y1.Text,{strong:!0,style:{fontSize:15,display:`block`,marginBottom:12},children:`本项目生成记录`}),(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},className:`stagger-children`,children:dt.map((e,t)=>{let n=kt(e),r=E[e.id]??(e.optimizedPrompt||e.originalPrompt),i=A===e.id,a=e.genType||`image`;return(0,$.jsxs)(`div`,{className:`animate-slideInCard`,style:{animationDelay:`${t*.05}s`},children:[(0,$.jsxs)(`div`,{className:`record-item`,onClick:()=>j(i?null:e.id),style:{padding:`12px 16px`,borderRadius:i?`12px 12px 0 0`:12,background:`#fff`,border:`1px solid #f0f0f5`,cursor:`pointer`,transition:`all 0.2s`,display:`flex`,alignItems:`center`,gap:10},children:[(0,$.jsx)(`div`,{style:{width:28,height:28,borderRadius:8,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,background:a===`image`?`#fef3c7`:`#dbeafe`},children:a===`image`?(0,$.jsx)(t6,{style:{color:`#d97706`,fontSize:12}}):(0,$.jsx)(L8,{style:{color:`#2563eb`,fontSize:12}})}),i?(0,$.jsx)(vQ,{style:{color:`#6366f1`,fontSize:11,flexShrink:0}}):(0,$.jsx)(Y2,{style:{color:`#cbd5e1`,fontSize:11,flexShrink:0}}),(0,$.jsx)(v$,{color:At[n]?.color,icon:At[n]?.icon,style:{margin:0},children:At[n]?.text}),(0,$.jsx)(y1.Text,{style:{flex:1,fontSize:13,color:`#475569`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r}),n===`prompt_optimized`&&(0,$.jsx)(v$,{color:`processing`,style:{padding:`3px 10px`,fontSize:12,margin:0,flexShrink:0},children:`待配置`}),a===`image`?(0,$.jsxs)(`span`,{className:`mobile-meta`,translate:`no`,style:{fontSize:12,color:`#94a3b8`,flexShrink:0},children:[e.duration?`${e.imageSize}`:`-`,` ·`,` `,e.imageProportion||`-`,` ·`,` `,e.imagePx||`-`,` ·`,` `,(0,$.jsx)(`span`,{className:`date-display`,translate:`no`,children:$7(e.createdAt)})]}):(0,$.jsxs)(`span`,{className:`mobile-meta`,translate:`no`,style:{fontSize:12,color:`#94a3b8`,flexShrink:0},children:[e.duration?`${e.duration}秒`:`-`,` ·`,` `,e.aspectRatio||`-`,` · `,e.resolution||`-`,` `,`·`,` `,(0,$.jsx)(`span`,{className:`date-display`,translate:`no`,children:$7(e.createdAt)})]}),(0,$.jsx)(`div`,{className:`record-actions`,onClick:e=>e.stopPropagation(),children:(0,$.jsx)(kU,{children:n===`failed`&&(0,$.jsx)(jD,{type:`primary`,danger:!0,size:`small`,icon:(0,$.jsx)(u6,{}),loading:x[e.id],onClick:()=>Ot(e.id),style:{borderRadius:8},children:`重试`})})})]}),i&&(0,$.jsx)(`div`,{style:{background:`#fff`,border:`1px solid #f0f0f5`,borderTop:`none`,borderRadius:`0 0 12px 12px`,padding:`18px 20px`,animation:`fadeInUp 0.25s ease both`},children:(0,$.jsxs)(`div`,{className:`gen-detail-row`,style:{display:`flex`,gap:20,flexWrap:`wrap`},children:[(0,$.jsxs)(`div`,{style:{flex:`1 1 50%`,minWidth:260},children:[(0,$.jsxs)(`div`,{style:{marginBottom:14},children:[(0,$.jsx)(y1.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:6},children:`原始提示词`}),(0,$.jsx)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`,border:`1px solid #f0f0f5`},children:(0,$.jsx)(y1.Text,{style:{fontSize:13,color:`#64748b`,lineHeight:1.7},children:e.originalPrompt})})]}),(0,$.jsxs)(`div`,{style:{marginBottom:14},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:6},children:[(0,$.jsxs)(y1.Text,{style:{fontSize:12,color:`#94a3b8`},children:[`优化后的提示词`,` `,(n===`prompt_optimized`||n===`failed`)&&O!==e.id&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),O!==e.id&&(0,$.jsxs)(kU,{size:4,children:[(0,$.jsx)(uT,{title:`复制`,children:(0,$.jsx)(jD,{type:`text`,size:`small`,icon:(0,$.jsx)(q$,{}),onClick:()=>{navigator.clipboard.writeText(r),Q.success(`已复制`)},style:{color:`#94a3b8`}})}),(n===`prompt_optimized`||n===`failed`)&&(0,$.jsx)(uT,{title:`编辑`,children:(0,$.jsx)(jD,{type:`text`,size:`small`,icon:(0,$.jsx)(w$,{}),onClick:()=>{k(e.id),D(t=>({...t,[e.id]:t[e.id]??e.optimizedPrompt??``}))},style:{color:`#6366f1`}})})]})]}),O===e.id?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(iK.TextArea,{value:r,onChange:t=>D(n=>({...n,[e.id]:t.target.value})),rows:4,style:{borderRadius:10,fontSize:13,lineHeight:1.7,border:`1px solid rgba(99,102,241,0.25)`,background:`rgba(99,102,241,0.02)`}}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:8},children:[(0,$.jsx)(jD,{size:`small`,onClick:()=>k(null),children:`取消`}),(0,$.jsx)(jD,{size:`small`,type:`primary`,onClick:()=>{D(t=>({...t,[e.id]:r})),k(null),Q.success(`提示词已更新`)},style:{borderRadius:6,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`},children:`保存`})]})]}):(0,$.jsx)(`div`,{style:{padding:12,borderRadius:10,background:n===`prompt_optimized`?`rgba(99,102,241,0.02)`:`#f8f9fc`,border:n===`prompt_optimized`?`1px solid rgba(99,102,241,0.1)`:`1px solid #f0f0f5`},children:(0,$.jsx)(y1.Text,{style:{fontSize:13,color:`#1a1a2e`,lineHeight:1.7},children:r})})]}),a===`image`?(0,$.jsx)(`div`,{style:{display:`flex`,gap:14,padding:`10px 14px`,borderRadius:10,background:`#f8f9fc`},children:[{label:`文字积分`,value:`${e.textCreditsCost||0}`},{label:`图片积分`,value:`${e.creditsCost||0}`},{label:`分辨率`,value:e.imageSize?`${e.imageSize}`:`-`},{label:`比例`,value:e.imageProportion||`-`},{label:`尺寸`,value:e.imagePx||`-`}].map((e,t)=>(0,$.jsxs)(`div`,{style:{flex:1},children:[(0,$.jsx)(y1.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:e.label}),(0,$.jsx)(y1.Text,{strong:!0,style:{fontSize:13,color:`#1a1a2e`},children:e.value})]},t))}):(0,$.jsx)(`div`,{style:{display:`flex`,gap:14,padding:`10px 14px`,borderRadius:10,background:`#f8f9fc`},children:[{label:`文字积分`,value:`${e.textCreditsCost||0}`},{label:`视频积分`,value:`${e.creditsCost||0}`},{label:`时长`,value:e.duration?`${e.duration}秒`:`-`},{label:`比例`,value:e.aspectRatio||`-`},{label:`分辨率`,value:e.resolution||`-`}].map((e,t)=>(0,$.jsxs)(`div`,{style:{flex:1},children:[(0,$.jsx)(y1.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:e.label}),(0,$.jsx)(y1.Text,{strong:!0,style:{fontSize:13,color:`#1a1a2e`},children:e.value})]},t))}),(e.references&&e.references.length>0||n===`failed`)&&(0,$.jsxs)(`div`,{style:{marginTop:14},children:[(0,$.jsxs)(y1.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:[`参考素材`,` `,n===`failed`&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可删除/添加后重试)`})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`},children:[e.references?.map((t,r)=>(0,$.jsxs)(`div`,{style:{width:64,height:64,borderRadius:10,overflow:`visible`,border:`1px solid #e2e8f0`,position:`relative`,cursor:`pointer`},onClick:()=>{t.type===`video`&&ie(`http://ceshi.apiforeign.minzhong.cn${t.url}`)},children:[(0,$.jsx)(`div`,{style:{width:64,height:64,borderRadius:10,overflow:`hidden`},children:t.type===`image`?(0,$.jsx)(CG,{src:`http://ceshi.apiforeign.minzhong.cn${t.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`},preview:!0}):(0,$.jsx)(i9,{src:`http://ceshi.apiforeign.minzhong.cn${t.url}`,width:64,height:64})}),(0,$.jsx)(v$,{style:{position:`absolute`,bottom:0,left:0,right:0,margin:0,fontSize:9,textAlign:`center`,borderRadius:`0 0 8px 8px`,background:`rgba(0,0,0,0.5)`,border:`none`,color:`#fff`,padding:`0 2px`},children:t.name}),n===`failed`&&(0,$.jsx)(`div`,{className:`ref-delete`,onClick:n=>{n.stopPropagation(),j5(t.url).catch(()=>{});let i=e.references.filter((e,t)=>t!==r);Q7.getState().updateRecordReferences(e.id,i)},style:{position:`absolute`,top:-4,right:-4,width:16,height:16,borderRadius:`50%`,background:`rgba(239,68,68,0.8)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,zIndex:10,opacity:0,transition:`opacity 0.15s`},children:(0,$.jsx)(t4,{style:{color:`#fff`,fontSize:10}})})]},r)),n===`failed`&&(0,$.jsx)(p0,{accept:`image/*,video/*`,showUploadList:!1,multiple:!0,beforeUpload:t=>{let n=t.type.startsWith(`image/`),r=t.type.startsWith(`video/`);return!n&&!r?(Q.error(`仅支持图片或视频文件`),!1):((n?k5:A5)(t).then(r=>{let i={url:r.url,type:n?`image`:`video`,name:t.name||(n?`图片`:`视频`)},a=e.references||[];Q7.getState().updateRecordReferences(e.id,[...a,i]),Q.success(`上传成功`)}).catch(()=>Q.error(`上传失败`)),!1)},children:(0,$.jsx)(uT,{title:`添加参考素材`,children:(0,$.jsx)(`div`,{style:{width:64,height:64,borderRadius:10,border:`1.5px dashed #d9d9d9`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,transition:`all 0.2s`},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#6366f1`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`#d9d9d9`},children:(0,$.jsx)(MR,{style:{fontSize:18,color:`#94a3b8`}})})})})]})]})]}),(0,$.jsxs)(`div`,{style:{flex:`1 1 40%`,minWidth:220,position:`relative`},children:[n===`prompt_optimized`&&(0,$.jsxs)(`div`,{style:{marginTop:16,position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,backgroundColor:`transparent`},children:[a===`video`&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,flexWrap:`wrap`,marginBottom:12},children:[(0,$.jsxs)(`div`,{translate:`no`,style:{display:`flex`,alignItems:`center`,gap:6,padding:`5px 12px`,borderRadius:8,background:`#f8f9fc`,border:`1px solid #e2e8f0`,marginLeft:12},children:[(0,$.jsx)(y1.Text,{style:{fontSize:12,color:`#94a3b8`},children:`时长`}),(0,$.jsxs)(y1.Text,{strong:!0,style:{fontSize:13,color:`#6366f1`},children:[e.duration,`秒`]})]}),(0,$.jsx)(jt,{label:`比例`,value:J[e.id]?.aspectRatio||`选择比例`,options:pe.ratios,expanded:de===`ratio-${e.id}`,onToggle:()=>fe(de===`ratio-${e.id}`?null:`ratio-${e.id}`),onSelect:t=>re(n=>({...n,[e.id]:{...n[e.id],aspectRatio:t,resolution:n[e.id]?.resolution||``}})),onClose:()=>fe(null)}),(0,$.jsx)(jt,{label:`分辨率`,value:J[e.id]?.resolution||`选择分辨率`,options:pe.resolutions,expanded:de===`res-${e.id}`,onToggle:()=>fe(de===`res-${e.id}`?null:`res-${e.id}`),onSelect:t=>re(n=>({...n,[e.id]:{...n[e.id],aspectRatio:n[e.id]?.aspectRatio||``,resolution:t}})),onClose:()=>fe(null)})]}),(0,$.jsxs)(jD,{type:`primary`,size:`large`,icon:(0,$.jsx)(T6,{}),block:!0,loading:x[e.id],disabled:a===`video`&&(!J[e.id]?.aspectRatio||!J[e.id]?.resolution),onClick:async()=>{let t=J[e.id];if(a===`video`){if(!t?.aspectRatio||!t?.resolution){Q.error(`请选择比例和分辨率`);return}if(mt({...t,[e.id]:!0})),T(t=>({...t,[e.id]:`generating`}));let n=a===`video`?`视频`:`图片`;Q.loading({content:`「${ft}」正在生成${n}...`,duration:0,key:e.id});try{await c(e.id,{aspectRatio:t?.aspectRatio,resolution:t?.resolution}),T(t=>({...t,[e.id]:`done`})),Q.success({content:`「${ft}」${n}生成成功!`,key:e.id,duration:3})}catch{T(t=>({...t,[e.id]:`failed`})),Q.error({content:`「${ft}」${n}生成失败`,key:e.id,duration:3})}finally{C(t=>({...t,[e.id]:!1}))}},style:{borderRadius:12,fontWeight:600,color:`#fff`,height:48,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,position:`absolute`,bottom:18,left:0},children:[`生成`,a===`video`?`视频`:`图片`,a===`video`?(0,$.jsx)(`span`,{style:{color:`#d2d2d2`,fontSize:`14px`,marginLeft:`6px`},children:`(请选择上方的比例分辨率)`}):``,` `,a===`video`&&J[e.id]?.resolution?`(${Fe(e.duration||5,J[e.id].resolution)}积分)`:``,a===`image`&&e.imageSize?`(${Ie(e.imageSize)}积分)`:a===`image`?`(积分)`:``]})]}),n===`failed`&&(0,$.jsx)(`div`,{style:{position:`absolute`,bottom:18,right:20},children:(0,$.jsxs)(jD,{type:`primary`,danger:!0,size:`large`,icon:(0,$.jsx)(u6,{}),block:!0,loading:x[e.id],onClick:()=>Ot(e.id),style:{borderRadius:12,fontWeight:600,height:48},children:[`重新生成`,a===`video`?`视频`:`图片`]})}),n===`generating`?(0,$.jsxs)(`div`,{style:{height:`100%`,minHeight:180,borderRadius:12,background:`linear-gradient(135deg, rgba(99,102,241,0.04), rgba(139,92,246,0.04))`,border:`1px dashed rgba(99,102,241,0.2)`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:10},children:[(0,$.jsx)(qm,{style:{color:`#6366f1`,fontSize:28},spin:!0}),(0,$.jsxs)(y1.Text,{style:{color:`#94a3b8`,fontSize:13},children:[a===`video`?`视频`:`图片`,`生成中...`]})]}):n===`completed`&&e.videoUrl||e.imageUrl?(0,$.jsxs)(`div`,{style:{borderRadius:12,overflow:`hidden`,border:`1px solid #f0f0f5`,position:`relative`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:10,right:10,zIndex:10},children:(0,$.jsx)(uT,{title:`下载${a===`video`?`视频`:`图片`}`,children:(0,$.jsx)(jD,{size:`small`,icon:(0,$.jsx)(s0,{}),onClick:()=>{let t=document.createElement(`a`);t.href=`http://ceshi.apiforeign.minzhong.cn${a===`video`?e.videoUrl:e.imageUrl}&download=1`,t.download=`${e.projectName}${a===`video`?`.mp4`:`.png`}`,t.click()},style:{background:`rgba(0,0,0,0.5)`,border:`none`,color:`#fff`,backdropFilter:`blur(4px)`,borderRadius:8},children:`下载`})})}),(0,$.jsx)(`div`,{style:{minHeight:180,overflow:`hidden`},children:a===`video`?(0,$.jsx)(`video`,{src:`http://ceshi.apiforeign.minzhong.cn${e.videoUrl}`,controls:!0,preload:`metadata`,style:{width:`100%`,height:`400px`,borderRadius:0}}):(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn${e.imageUrl}`,alt:e.projectName,style:{width:`100%`,maxHeight:`400px`,objectFit:`contain`,borderRadius:0}})}),(0,$.jsxs)(`div`,{style:{padding:`8px 12px`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,background:`#fafbff`},children:[(0,$.jsxs)(kU,{children:[a===`video`?(0,$.jsx)(L8,{style:{color:`#6366f1`,fontSize:13}}):(0,$.jsx)(t6,{style:{color:`#6366f1`,fontSize:13}}),(0,$.jsx)(y1.Text,{style:{fontSize:12,color:`#475569`},children:e.projectName})]}),e.generatedAt&&(0,$.jsx)(`span`,{className:`date-display`,translate:`no`,style:{fontSize:11,color:`#94a3b8`},children:$7(e.generatedAt)})]})]}):n===`failed`?(0,$.jsxs)(`div`,{style:{height:`100%`,minHeight:180,borderRadius:12,background:`rgba(239,68,68,0.03)`,border:`1px dashed rgba(239,68,68,0.2)`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:10,padding:16},children:[(0,$.jsx)(t4,{style:{color:`#ef4444`,fontSize:28}}),(0,$.jsxs)(y1.Text,{style:{color:`#ef4444`,fontSize:14,fontWeight:600},children:[a===`video`?`视频`:`图片`,`生成失败`]}),e.errorMessage&&(0,$.jsx)(y1.Text,{style:{color:`#ef4444`,fontSize:12,textAlign:`center`,lineHeight:1.6},children:e.errorMessage})]}):(0,$.jsxs)(`div`,{style:{height:`100%`,minHeight:180,borderRadius:12,background:`#f8f9fc`,border:`1px dashed #e2e8f0`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:10},children:[(0,$.jsx)(WH,{style:{color:`#94a3b8`,fontSize:28}}),(0,$.jsx)(y1.Text,{style:{color:`#94a3b8`,fontSize:13},children:a===`image`?`待生成图片`:n===`prompt_optimized`?`待配置视频参数`:`待生成视频`})]})]})]})})]},e.id)})})]}),(0,$.jsx)(Oq,{open:!!Y,onCancel:()=>ie(null),footer:null,width:480,centered:!0,destroyOnClose:!0,closable:!1,title:null,styles:{body:{padding:0,background:`#000`,position:`relative`}},children:Y&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`video`,{src:Y,controls:!0,autoPlay:!0,style:{width:`100%`,display:`block`,maxHeight:`70vh`}}),(0,$.jsx)(`div`,{onClick:()=>ie(null),style:{position:`absolute`,top:8,right:8,width:28,height:28,borderRadius:`50%`,background:`rgba(0,0,0,0.6)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,zIndex:10,transition:`background 0.15s`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(0,0,0,0.85)`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(0,0,0,0.6)`},children:(0,$.jsx)(t4,{style:{color:`#fff`,fontSize:16}})})]})})]})},o9={optimizing:{color:`processing`,text:`优化中`,icon:(0,$.jsx)(qm,{spin:!0})},prompt_optimized:{color:`processing`,text:`待生成`,icon:(0,$.jsx)(WH,{})},generating:{color:`warning`,text:`生成中`,icon:(0,$.jsx)(qm,{spin:!0})},completed:{color:`success`,text:`已完成`,icon:(0,$.jsx)(Q2,{})},failed:{color:`error`,text:`失败`,icon:(0,$.jsx)(t4,{})}},s9=()=>{let{records:e,projects:t,fetchRecords:n,fetchProjects:r,generateVideo:i}=Q7(),a=e.items,[o,s]=(0,S.useState)(1),[c,l]=(0,S.useState)(10),[u,d]=(0,S.useState)({}),[f,p]=(0,S.useState)(void 0),[m,h]=(0,S.useState)(void 0),[g,_]=(0,S.useState)({}),[v,y]=(0,S.useState)(null),[b,x]=(0,S.useState)(null),[C,w]=(0,S.useState)(null);(0,S.useEffect)(()=>{r()},[r]),(0,S.useEffect)(()=>{n({projectId:f,status:m,page:o,pageSize:c})},[n,f,m,o,c]);let T=async()=>{if(!C)return;let{recordId:e,projectName:t,ratio:n,resolution:r}=C;d(t=>({...t,[e]:!0})),w(null),Q.loading({content:`「${t}」正在生成视频...`,duration:0,key:e});try{await i(e,{aspectRatio:n,resolution:r}),Q.success({content:`「${t}」视频生成成功!`,key:e,duration:3})}catch{Q.error({content:`「${t}」视频生成失败`,key:e,duration:3})}finally{d(t=>({...t,[e]:!1}))}},E=e=>{if((e.genType||`image`)===`image`){d(t=>({...t,[e.id]:!0})),Q.loading({content:`「${e.projectName}」正在生成图片...`,duration:0,key:e.id}),i(e.id,{}).then(()=>{Q.success({content:`「${e.projectName}」图片生成成功!`,key:e.id,duration:3})}).catch(()=>{Q.error({content:`「${e.projectName}」图片生成失败`,key:e.id,duration:3})}).finally(()=>{d(t=>({...t,[e.id]:!1}))});return}w({recordId:e.id,projectName:e.projectName,ratio:e.aspectRatio||`16:9`,resolution:e.resolution||`720p`})},D=a;return(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{style:{marginBottom:20},children:(0,$.jsx)(y1.Text,{style:{fontSize:14,color:`#94a3b8`},children:`查看所有视频生成记录,点击记录查看完整内容和视频`})}),(0,$.jsxs)(`div`,{className:`record-filter-bar animate-fadeInUp`,style:{display:`flex`,gap:12,marginBottom:20,padding:`14px 20px`,borderRadius:14,background:`#fff`,border:`1px solid #f0f0f5`},children:[(0,$.jsxs)(kU,{children:[(0,$.jsx)(B4,{style:{color:`#94a3b8`}}),(0,$.jsx)(xw,{placeholder:`全部项目`,allowClear:!0,style:{width:200},onChange:e=>{p(e),s(1)},children:t.map(e=>(0,$.jsx)(xw.Option,{value:e.id,children:e.name},e.id))}),(0,$.jsxs)(xw,{placeholder:`全部状态`,allowClear:!0,style:{width:140},onChange:e=>{h(e),s(1)},children:[(0,$.jsx)(xw.Option,{value:`prompt_optimized`,children:`待生成`}),(0,$.jsx)(xw.Option,{value:`generating`,children:`生成中`}),(0,$.jsx)(xw.Option,{value:`completed`,children:`已完成`}),(0,$.jsx)(xw.Option,{value:`failed`,children:`失败`})]})]}),(0,$.jsxs)(y1.Text,{style:{marginLeft:`auto`,lineHeight:`32px`,color:`#94a3b8`,fontSize:13},children:[`共 `,e.total,` 条记录`]})]}),D.length===0?(0,$.jsx)(GC,{image:GC.PRESENTED_IMAGE_SIMPLE,description:`暂无生成记录`,style:{padding:60}}):(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},className:`stagger-children`,children:D.map((e,t)=>{let n=v===e.id,r=g[e.id]??e.optimizedPrompt,i=u[e.id],a=b===e.id,o=e.genType||`image`;return(0,$.jsxs)(`div`,{className:`animate-slideInCard`,style:{animationDelay:`${t*.04}s`},children:[(0,$.jsxs)(`div`,{className:`record-item`,onClick:()=>x(a?null:e.id),style:{padding:`14px 20px`,borderRadius:a?`14px 14px 0 0`:14,background:`#fff`,border:`1px solid #f0f0f5`,cursor:`pointer`,transition:`all 0.2s`,display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsx)(`div`,{style:{width:28,height:28,borderRadius:8,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,background:o===`image`?`#fef3c7`:`#dbeafe`},children:o===`image`?(0,$.jsx)(t6,{style:{color:`#d97706`,fontSize:12}}):(0,$.jsx)(L8,{style:{color:`#2563eb`,fontSize:12}})}),a?(0,$.jsx)(vQ,{style:{color:`#6366f1`,fontSize:12,flexShrink:0}}):(0,$.jsx)(Y2,{style:{color:`#cbd5e1`,fontSize:12,flexShrink:0}}),(0,$.jsx)(v$,{color:o9[e.status].color,icon:o9[e.status].icon,style:{margin:0},children:o9[e.status].text}),(0,$.jsx)(v$,{style:{background:`#f0f0ff`,border:`none`,color:`#6366f1`,margin:0},children:e.projectName}),(0,$.jsx)(y1.Text,{style:{flex:1,fontSize:13,color:`#475569`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r}),o===`image`?(0,$.jsxs)(`span`,{className:`mobile-meta`,translate:`no`,style:{fontSize:12,color:`#94a3b8`,flexShrink:0},children:[e.duration?`${e.imageSize}`:`-`,` · `,e.imageProportion||`-`,` · `,e.imagePx||`-`,` · `,(0,$.jsx)(`span`,{className:`date-display`,translate:`no`,children:$7(e.createdAt)})]}):(0,$.jsxs)(`span`,{className:`mobile-meta`,translate:`no`,style:{fontSize:12,color:`#94a3b8`,flexShrink:0},children:[e.duration?`${e.duration}秒`:`-`,` · `,e.aspectRatio||`-`,` · `,e.resolution||`-`,` · `,(0,$.jsx)(`span`,{className:`date-display`,translate:`no`,children:$7(e.createdAt)})]}),(0,$.jsx)(`div`,{className:`record-actions`,onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(kU,{children:[e.status===`prompt_optimized`&&(0,$.jsx)(jD,{type:`primary`,size:`small`,icon:(0,$.jsx)(u6,{}),loading:i,onClick:()=>E(e),style:{borderRadius:8,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`},children:`生成`}),e.status===`generating`&&(0,$.jsx)(v$,{color:`processing`,icon:(0,$.jsx)(qm,{spin:!0}),style:{padding:`4px 12px`,fontSize:12},children:`生成中...`}),e.status===`failed`&&(0,$.jsx)(jD,{type:`primary`,danger:!0,size:`small`,icon:(0,$.jsx)(u6,{}),loading:i,onClick:()=>E(e),style:{borderRadius:8},children:`重试`})]})})]}),a&&(0,$.jsx)(`div`,{style:{background:`#fff`,border:`1px solid #f0f0f5`,borderTop:`none`,borderRadius:`0 0 14px 14px`,padding:`20px 24px`,animation:`fadeInUp 0.25s ease both`},children:(0,$.jsxs)(`div`,{className:`gen-detail-row`,style:{display:`flex`,gap:24,flexWrap:`wrap`},children:[(0,$.jsxs)(`div`,{style:{flex:`1 1 50%`,minWidth:280},children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(y1.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:6},children:`原始提示词`}),(0,$.jsx)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`,border:`1px solid #f0f0f5`},children:(0,$.jsx)(y1.Text,{style:{fontSize:13,color:`#64748b`,lineHeight:1.7},children:e.originalPrompt})})]}),(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:6},children:[(0,$.jsxs)(y1.Text,{style:{fontSize:12,color:`#94a3b8`},children:[`优化后的提示词 `,e.status===`prompt_optimized`&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),!n&&(0,$.jsxs)(kU,{size:4,children:[(0,$.jsx)(uT,{title:`复制`,children:(0,$.jsx)(jD,{type:`text`,size:`small`,icon:(0,$.jsx)(q$,{}),onClick:()=>{navigator.clipboard.writeText(r),Q.success(`已复制`)},style:{color:`#94a3b8`}})}),e.status===`prompt_optimized`&&(0,$.jsx)(uT,{title:`编辑`,children:(0,$.jsx)(jD,{type:`text`,size:`small`,icon:(0,$.jsx)(w$,{}),onClick:()=>{y(e.id),_(t=>({...t,[e.id]:t[e.id]??e.optimizedPrompt}))},style:{color:`#6366f1`}})})]})]}),n?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(iK.TextArea,{value:r,onChange:t=>_(n=>({...n,[e.id]:t.target.value})),rows:4,style:{borderRadius:10,fontSize:13,lineHeight:1.7,border:`1px solid rgba(99,102,241,0.25)`,background:`rgba(99,102,241,0.02)`}}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:8},children:[(0,$.jsx)(jD,{size:`small`,onClick:()=>y(null),children:`取消`}),(0,$.jsx)(jD,{size:`small`,type:`primary`,onClick:()=>{_(t=>({...t,[e.id]:r})),y(null),Q.success(`提示词已更新`)},style:{borderRadius:6,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`},children:`保存`})]})]}):(0,$.jsx)(`div`,{style:{padding:12,borderRadius:10,background:`rgba(99,102,241,0.02)`,border:`1px solid rgba(99,102,241,0.1)`},children:(0,$.jsx)(y1.Text,{style:{fontSize:13,color:`#1a1a2e`,lineHeight:1.7},children:r})})]}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:16,padding:`12px 16px`,borderRadius:10,background:`#f8f9fc`},children:o===`image`?[{label:`分辨率`,value:e.imageSize?`${e.imageSize} `:`-`},{label:`画面比例`,value:e.imageProportion?`${e.imageProportion} `:`-`},{label:`画面尺寸`,value:e.imageProportion?`${e.imageProportion} `:`-`},{label:`消耗积分`,value:e.creditsCost?`${e.creditsCost} `:`-`,highlight:!!e.creditsCost}].map((e,t)=>(0,$.jsxs)(`div`,{style:{flex:1},children:[(0,$.jsx)(y1.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:e.label}),(0,$.jsx)(y1.Text,{strong:!0,style:{fontSize:14,color:e.highlight?`#6366f1`:`#1a1a2e`},children:e.value})]},t)):[{label:`时长`,value:e.duration?`${e.duration} 秒`:`-`},{label:`画面比例`,value:e.aspectRatio||(e.status===`prompt_optimized`?`待选择`:`-`)},{label:`分辨率`,value:e.resolution||(e.status===`prompt_optimized`?`待选择`:`-`)},{label:`消耗积分`,value:e.creditsCost?`${e.creditsCost}`:`-`,highlight:!!e.creditsCost}].map((e,t)=>(0,$.jsxs)(`div`,{style:{flex:1},children:[(0,$.jsx)(y1.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:e.label}),(0,$.jsx)(y1.Text,{strong:!0,style:{fontSize:14,color:e.highlight?`#6366f1`:`#1a1a2e`},children:e.value})]},t))}),e.status===`prompt_optimized`&&(0,$.jsx)(`div`,{style:{marginTop:16,display:`flex`,justifyContent:`flex-end`},children:(0,$.jsx)(jD,{type:`primary`,size:`large`,icon:(0,$.jsx)(T6,{}),loading:i,onClick:()=>E(e),style:{borderRadius:12,fontWeight:600,height:44,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,boxShadow:`0 8px 24px rgba(99,102,241,0.3)`},children:o===`video`?`选择参数生成视频`:`生成图片`})}),e.status===`failed`&&(0,$.jsx)(`div`,{style:{marginTop:16,display:`flex`,justifyContent:`flex-end`},children:(0,$.jsxs)(jD,{type:`primary`,danger:!0,size:`large`,icon:(0,$.jsx)(u6,{}),loading:i,onClick:()=>E(e),style:{borderRadius:12,fontWeight:600,height:44},children:[`重新生成`,o===`video`?`视频`:`图片`]})})]}),(0,$.jsx)(`div`,{style:{flex:`1 1 40%`,minWidth:240},children:e.status===`generating`?(0,$.jsxs)(`div`,{style:{height:`100%`,minHeight:200,borderRadius:14,background:`linear-gradient(135deg, rgba(99,102,241,0.04), rgba(139,92,246,0.04))`,border:`1px dashed rgba(99,102,241,0.2)`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12},children:[(0,$.jsx)(qm,{style:{color:`#6366f1`,fontSize:32},spin:!0}),(0,$.jsxs)(y1.Text,{style:{color:`#94a3b8`,fontSize:14},children:[o===`video`?`视频`:`图片`,`生成中...`]}),(0,$.jsx)(y1.Text,{style:{color:`#cbd5e1`,fontSize:12},children:`请耐心等待,生成完成后将自动展示`})]}):e.status===`completed`&&(e.videoUrl||e.imageUrl)?(0,$.jsxs)(`div`,{style:{borderRadius:14,overflow:`hidden`,border:`1px solid #f0f0f5`,position:`relative`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:10,right:10,zIndex:10},children:(0,$.jsx)(uT,{title:`下载${o===`video`?`视频`:`图片`}`,children:(0,$.jsx)(jD,{size:`small`,icon:(0,$.jsx)(s0,{}),onClick:()=>{let t=document.createElement(`a`);t.href=`http://ceshi.apiforeign.minzhong.cn${o===`video`?e.videoUrl:e.imageUrl}&download=1`,t.download=`${e.projectName}${o===`video`?`.mp4`:`.png`}`,t.click()},style:{background:`rgba(0,0,0,0.5)`,border:`none`,color:`#fff`,backdropFilter:`blur(4px)`,borderRadius:8},children:`下载`})})}),(0,$.jsx)(`div`,{style:{minHeight:280,overflow:`hidden`},children:o===`video`?(0,$.jsx)(`video`,{src:`http://ceshi.apiforeign.minzhong.cn${e.videoUrl}`,controls:!0,preload:`metadata`,style:{width:`100%`,height:`400px`,display:`block`}}):(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn${e.imageUrl}`,alt:e.projectName,style:{width:`100%`,maxHeight:`400px`,objectFit:`contain`,display:`block`}})}),(0,$.jsxs)(`div`,{style:{padding:`10px 14px`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,background:`#fafbff`},children:[(0,$.jsxs)(kU,{children:[o===`video`?(0,$.jsx)(L8,{style:{color:`#6366f1`}}):(0,$.jsx)(t6,{style:{color:`#6366f1`}}),(0,$.jsx)(y1.Text,{style:{fontSize:13,color:`#475569`},children:e.projectName})]}),e.generatedAt&&(0,$.jsxs)(`span`,{className:`date-display`,translate:`no`,style:{fontSize:12,color:`#94a3b8`},children:[`生成于 `,$7(e.generatedAt)]})]})]}):e.status===`failed`?(0,$.jsxs)(`div`,{style:{height:`100%`,minHeight:200,borderRadius:14,background:`rgba(239,68,68,0.03)`,border:`1px dashed rgba(239,68,68,0.2)`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12},children:[(0,$.jsx)(t4,{style:{color:`#ef4444`,fontSize:32}}),(0,$.jsxs)(y1.Text,{style:{color:`#ef4444`,fontSize:14},children:[o===`video`?`视频`:`图片`,`生成失败`]}),(0,$.jsx)(y1.Text,{style:{color:`#94a3b8`,fontSize:12},children:`请在左侧点击重新生成`})]}):(0,$.jsxs)(`div`,{style:{height:`100%`,minHeight:200,borderRadius:14,background:`#f8f9fc`,border:`1px dashed #e2e8f0`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12},children:[(0,$.jsx)(WH,{style:{color:`#94a3b8`,fontSize:32}}),(0,$.jsxs)(y1.Text,{style:{color:`#94a3b8`,fontSize:14},children:[`待生成`,o===`video`?`视频`:`图片`]}),(0,$.jsx)(y1.Text,{style:{color:`#cbd5e1`,fontSize:12},children:`点击左侧生成按钮开始生成`})]})})]})})]},e.id)})}),e.total>0&&(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:18},children:(0,$.jsx)(WK,{current:e.page||o,pageSize:e.pageSize||c,total:e.total,showSizeChanger:!0,showTotal:e=>`共 ${e} 条记录`,onChange:(e,t)=>{s(e),l(t)}})}),(0,$.jsx)(Oq,{title:(0,$.jsxs)(kU,{children:[(0,$.jsx)(T6,{}),`生成视频`]}),open:!!C,onCancel:()=>w(null),onOk:T,okText:`提交生成`,cancelText:`取消`,width:420,children:C&&(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16,marginTop:16},children:(()=>{let e=a.find(e=>e.id===C.recordId);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,$.jsx)(y1.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`时长`}),(0,$.jsxs)(y1.Text,{strong:!0,children:[e?.duration||5,`秒`]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(y1.Text,{style:{fontSize:12,color:`#64748b`,display:`block`,marginBottom:6},children:`画面比例`}),(0,$.jsx)(xw,{value:C.ratio,onChange:e=>w(t=>t?{...t,ratio:e}:null),style:{width:`100%`},options:[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`].map(e=>({value:e,label:e}))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(y1.Text,{style:{fontSize:12,color:`#64748b`,display:`block`,marginBottom:6},children:`分辨率`}),(0,$.jsx)(xw,{value:C.resolution,onChange:e=>w(t=>t?{...t,resolution:e}:null),style:{width:`100%`},options:[`480p`,`720p`,`1080p`].map(e=>({value:e,label:e}))})]})]})})()})})]})},c9=({value:e,duration:t=1200})=>{let[n,r]=(0,S.useState)(0),i=(0,S.useRef)(0);return(0,S.useEffect)(()=>{let a=n,o=e-a;if(o===0)return;let s=performance.now(),c=e=>{let n=e-s,l=Math.min(n/t,1);r(a+o*(1-(1-l)**3)),l<1&&(i.current=requestAnimationFrame(c))};return i.current=requestAnimationFrame(c),()=>cancelAnimationFrame(i.current)},[e]),(0,$.jsx)($.Fragment,{children:n.toLocaleString()})},l9=()=>{let{user:e}=B7(),[t,n]=(0,S.useState)([]),[r,i]=(0,S.useState)(!1),[a,o]=(0,S.useState)(1),[s,c]=(0,S.useState)(10),[l,u]=(0,S.useState)(0);(0,S.useEffect)(()=>{(async()=>{i(!0);let e=await P5(a,s);n(e.records),u(e.total),i(!1)})()},[a,s]);let d=(e,t)=>{o(e),c(t)},f=t.filter(e=>e.type===`recharge`).reduce((e,t)=>e+t.amount,0),p=t.filter(e=>e.type===`consume`).reduce((e,t)=>e+Math.abs(t.amount),0);return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(vJ,{gutter:[16,16],style:{marginBottom:24},children:[(0,$.jsx)(OV,{xs:24,sm:8,children:(0,$.jsxs)(`div`,{className:`animate-fadeInUp`,style:{borderRadius:16,padding:24,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,position:`relative`,overflow:`hidden`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,right:-20,top:-20,width:120,height:120,borderRadius:`50%`,background:`rgba(255,255,255,0.1)`}}),(0,$.jsxs)(`div`,{style:{position:`relative`},children:[(0,$.jsxs)(kU,{style:{marginBottom:10},children:[(0,$.jsx)(B8,{style:{color:`rgba(255,255,255,0.8)`,fontSize:16}}),(0,$.jsx)(`span`,{style:{color:`rgba(255,255,255,0.8)`,fontSize:14},children:`当前可用积分`})]}),(0,$.jsx)(`div`,{style:{color:`#fff`,fontSize:38,fontWeight:800,lineHeight:1},children:(0,$.jsx)(c9,{value:e?.credits??0})})]})]})}),(0,$.jsx)(OV,{xs:12,sm:8,children:(0,$.jsxs)(`div`,{className:`animate-fadeInUp`,style:{borderRadius:16,padding:24,background:`#fff`,border:`1px solid #f0f0f5`,animationDelay:`0.06s`},children:[(0,$.jsxs)(kU,{style:{marginBottom:10},children:[(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:8,background:`rgba(16,185,129,0.1)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(p2,{style:{color:`#10b981`,fontSize:14}})}),(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:14},children:`累计获得`})]}),(0,$.jsx)(`div`,{style:{color:`#10b981`,fontSize:28,fontWeight:800},children:(0,$.jsx)(c9,{value:f})})]})}),(0,$.jsx)(OV,{xs:12,sm:8,children:(0,$.jsxs)(`div`,{className:`animate-fadeInUp`,style:{borderRadius:16,padding:24,background:`#fff`,border:`1px solid #f0f0f5`,animationDelay:`0.12s`},children:[(0,$.jsxs)(kU,{style:{marginBottom:10},children:[(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:8,background:`rgba(239,68,68,0.1)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(s2,{style:{color:`#ef4444`,fontSize:14}})}),(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:14},children:`累计消耗`})]}),(0,$.jsx)(`div`,{style:{color:`#ef4444`,fontSize:28,fontWeight:800},children:(0,$.jsx)(c9,{value:p})})]})})]}),(0,$.jsxs)(`div`,{className:`animate-fadeInUp`,style:{animationDelay:`0.15s`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,$.jsx)(y8,{style:{color:`#6366f1`,fontSize:16}}),(0,$.jsx)(y1.Text,{strong:!0,style:{fontSize:16},children:`积分明细`})]}),(0,$.jsx)(`div`,{style:{borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,overflow:`hidden`},children:(0,$.jsx)(o$,{columns:[{title:`类型`,dataIndex:`type`,key:`type`,width:100,render:e=>(0,$.jsx)(v$,{color:e===`recharge`?`green`:`orange`,icon:e===`recharge`?(0,$.jsx)(p2,{}):(0,$.jsx)(s2,{}),children:e===`recharge`?`充值`:`消费`})},{title:`积分变动`,dataIndex:`amount`,key:`amount`,width:120,render:e=>(0,$.jsxs)(y1.Text,{strong:!0,style:{color:e>0?`#10b981`:`#ef4444`,fontSize:15},children:[e>0?`+`:``,e]})},{title:`说明`,dataIndex:`description`,key:`description`},{title:`时间`,dataIndex:`createdAt`,key:`createdAt`,width:160,render:e=>(0,$.jsx)(`span`,{className:`date-display`,translate:`no`,style:{color:`#94a3b8`},children:$7(e)})}],dataSource:t,rowKey:`id`,loading:r,pagination:{current:a,pageSize:s,total:l,onChange:d,showSizeChanger:!0,showTotal:e=>`共 ${e} 条`},scroll:{x:500}})})]})]})},u9=()=>{let[e,t]=(0,S.useState)(!0),[n,r]=(0,S.useState)([]),[i,a]=(0,S.useState)(0),[o,s]=(0,S.useState)(0),[c,l]=(0,S.useState)(1),[u]=(0,S.useState)(10);(0,S.useEffect)(()=>{d()},[c]);let d=async()=>{t(!0);try{let e=await P5(c,u);r(e.records||[]),a(e.credits||0),s(e.total||0)}catch{r([])}t(!1)};return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(vJ,{gutter:[16,16],style:{marginBottom:24},children:[(0,$.jsx)(OV,{xs:24,sm:8,children:(0,$.jsxs)(`div`,{style:{borderRadius:16,padding:24,background:`linear-gradient(135deg, #f59e0b 0%, #ea580c 100%)`,position:`relative`,overflow:`hidden`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,right:-20,top:-20,width:120,height:120,borderRadius:`50%`,background:`rgba(255,255,255,0.1)`}}),(0,$.jsxs)(`div`,{style:{position:`relative`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,$.jsx)(B8,{style:{color:`rgba(255,255,255,0.8)`,fontSize:16}}),(0,$.jsx)(`span`,{style:{color:`rgba(255,255,255,0.8)`,fontSize:14},children:`可用积分`})]}),(0,$.jsx)(`div`,{style:{color:`#fff`,fontSize:38,fontWeight:800,lineHeight:1},children:i.toLocaleString()})]})]})}),(0,$.jsx)(OV,{xs:12,sm:8,children:(0,$.jsxs)(`div`,{style:{borderRadius:16,padding:24,background:`#fff`,border:`1px solid #f0f0f5`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:8,background:`rgba(16,185,129,0.1)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(p6,{style:{color:`#10b981`,fontSize:14}})}),(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:14},children:`累计获得`})]}),(0,$.jsx)(`div`,{style:{color:`#10b981`,fontSize:28,fontWeight:800},children:n.filter(e=>e.amount>0).reduce((e,t)=>e+t.amount,0).toLocaleString()})]})}),(0,$.jsx)(OV,{xs:12,sm:8,children:(0,$.jsxs)(`div`,{style:{borderRadius:16,padding:24,background:`#fff`,border:`1px solid #f0f0f5`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:8,background:`rgba(239,68,68,0.1)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(y8,{style:{color:`#ef4444`,fontSize:14}})}),(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:14},children:`累计消耗`})]}),(0,$.jsx)(`div`,{style:{color:`#ef4444`,fontSize:28,fontWeight:800},children:n.filter(e=>e.amount<0).reduce((e,t)=>e+Math.abs(t.amount),0).toLocaleString()})]})})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,$.jsx)(y8,{style:{color:`#f59e0b`,fontSize:16}}),(0,$.jsx)(y1.Text,{strong:!0,style:{fontSize:16},children:`积分明细`})]}),(0,$.jsx)(`div`,{style:{borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,overflow:`hidden`},children:(0,$.jsx)(dq,{spinning:e,children:n.length===0?(0,$.jsx)(GC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无积分变动记录`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(o$,{dataSource:n,columns:[{title:`变动类型`,dataIndex:`type`,key:`type`,width:120,render:e=>{let t={recharge:{color:`#10b981`,label:`充值`,bg:`rgba(16,185,129,0.1)`},consume:{color:`#ef4444`,label:`消费`,bg:`rgba(239,68,68,0.1)`},admin:{color:`#f59e0b`,label:`管理员调整`,bg:`rgba(245,158,11,0.1)`},refund:{color:`#8b5cf6`,label:`退款`,bg:`rgba(139,92,246,0.1)`}}[e]||{color:`#64748b`,label:e,bg:`rgba(100,116,139,0.1)`};return(0,$.jsx)(v$,{color:t.color,style:{background:t.bg,fontWeight:500,padding:`4px 12px`},children:t.label})}},{title:`描述`,dataIndex:`description`,key:`description`,ellipsis:!0},{title:`变动积分`,dataIndex:`amount`,key:`amount`,width:120,align:`right`,render:e=>(0,$.jsxs)(y1.Text,{strong:!0,style:{fontWeight:700,color:e>0?`#10b981`:`#ef4444`,fontSize:15},children:[e>0?`+`:``,e]})},{title:`创建时间`,key:`createdAt`,width:180,render:(e,t)=>{let n=t.created_at||t.createdAt||t.create_time||t.createTime;return n?new Date(n).toLocaleString(`zh-CN`):`-`}}],rowKey:`id`,pagination:!1,bordered:!1}),(0,$.jsx)(`div`,{style:{padding:`16px`,textAlign:`right`},children:(0,$.jsx)(WK,{current:c,pageSize:u,total:o,onChange:e=>{l(e)},size:`small`})})]})})})]})]})},d9=()=>{let[e,t]=(0,S.useState)(!0),[n,r]=(0,S.useState)([]),[i,a]=(0,S.useState)(0),[o,s]=(0,S.useState)(1),[c]=(0,S.useState)(10);(0,S.useEffect)(()=>{l()},[o]);let l=async()=>{t(!0);try{let e=await q5(o,c);r(e.items||[]),a(e.total||0)}catch{r([])}t(!1)};return(0,$.jsx)(`div`,{children:(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,$.jsx)(PU,{style:{color:`#0ea5e9`,fontSize:16}}),(0,$.jsx)(y1.Text,{strong:!0,style:{fontSize:16},children:`订单记录`}),(0,$.jsxs)(`span`,{style:{color:`#94a3b8`,fontSize:13},children:[`共 `,n.length,` 条记录`]})]}),(0,$.jsx)(`div`,{style:{borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,overflow:`hidden`},children:(0,$.jsx)(dq,{spinning:e,children:n.length===0?(0,$.jsx)(GC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无订单记录`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(o$,{dataSource:n,columns:[{title:`订单号`,key:`orderNo`,width:200,render:(e,t)=>(0,$.jsx)(`span`,{style:{fontFamily:`monospace`,fontSize:13,color:`#64748b`},children:t.order_no||t.orderNo||t.id})},{title:`支付方式`,key:`paymentMethod`,width:100,render:(e,t)=>{let n=t.payment_method||t.paymentMethod||`wechat`,r={alipay:{icon:(0,$.jsx)(Q0,{style:{fontSize:16}}),label:`支付宝`,color:`#1677ff`},wechat:{icon:(0,$.jsx)(K8,{style:{fontSize:16}}),label:`微信支付`,color:`#07c160`}},i=r[n]||r.wechat;return(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,$.jsx)(`span`,{style:{color:i.color},children:i.icon}),(0,$.jsx)(`span`,{style:{fontSize:13,color:`#374151`},children:i.label})]})}},{title:`金额`,key:`amount`,width:100,align:`right`,render:(e,t)=>{let n=t.amount||t.total_amount||0;return(0,$.jsxs)(y1.Text,{strong:!0,style:{fontWeight:700,fontSize:14,color:`#1e293b`},children:[`¥`,n]})}},{title:`获得积分`,key:`credits`,width:100,align:`center`,render:(e,t)=>{let n=t.credits||t.credit_amount||0;return(0,$.jsx)(y1.Text,{strong:!0,style:{fontWeight:600,fontSize:14,color:`#f59e0b`},children:n})}},{title:`状态`,key:`status`,width:100,render:(e,t)=>{let n=t.status||`pending`,r={pending:{color:`#f59e0b`,label:`待支付`,bg:`rgba(245,158,11,0.1)`},paid:{color:`#10b981`,label:`已支付`,bg:`rgba(16,185,129,0.1)`},refunded:{color:`#94a3b8`,label:`已退款`,bg:`rgba(148,163,184,0.1)`},failed:{color:`#ef4444`,label:`支付失败`,bg:`rgba(239,68,68,0.1)`},cancelled:{color:`#64748b`,label:`已取消`,bg:`rgba(100,116,139,0.1)`},processing:{color:`#0ea5e9`,label:`处理中`,bg:`rgba(14,165,233,0.1)`}}[n]||{color:`#64748b`,label:n,bg:`rgba(100,116,139,0.1)`};return(0,$.jsx)(v$,{color:r.color,style:{background:r.bg,fontWeight:500,padding:`4px 12px`},children:r.label})}},{title:`创建时间`,key:`createdAt`,width:180,render:(e,t)=>{let n=t.created_at||t.createdAt;return n?new Date(n).toLocaleString(`zh-CN`):`-`}},{title:`支付时间`,key:`paidAt`,width:180,render:(e,t)=>{let n=t.paid_at||t.paidAt;return n?new Date(n).toLocaleString(`zh-CN`):`-`}}],rowKey:`order_no`,pagination:!1,bordered:!1}),(0,$.jsx)(`div`,{style:{padding:`16px`,textAlign:`right`},children:(0,$.jsx)(WK,{current:o,pageSize:c,total:i,onChange:e=>{s(e)},size:`small`})})]})})})]})})},f9=()=>{let[e,t]=(0,S.useState)(!0),[n,r]=(0,S.useState)([]),[i,a]=(0,S.useState)(0),[o,s]=(0,S.useState)(0),[c,l]=(0,S.useState)(1),[u]=(0,S.useState)(10);(0,S.useEffect)(()=>{d(),f()},[c]);let d=async()=>{t(!0);try{let e=await z5(c,u);r(e.items||[]),s(e.total||0)}catch{r([])}t(!1)},f=async()=>{try{a(await B5())}catch{a(0)}},p=async e=>{try{await V5(e),d(),f()}catch{}};return(0,$.jsx)(`div`,{children:(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,$.jsx)(O2,{style:{color:`#6366f1`,fontSize:16}}),(0,$.jsx)(y1.Text,{strong:!0,style:{fontSize:16},children:`消息中心`}),(0,$.jsxs)(`span`,{style:{color:`#94a3b8`,fontSize:13},children:[`未读 `,i,` 条`]})]}),(0,$.jsx)(`div`,{style:{borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,overflow:`hidden`},children:(0,$.jsx)(dq,{spinning:e,children:n.length===0?(0,$.jsx)(GC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无消息`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(o$,{dataSource:n,columns:[{title:`类型`,dataIndex:`type`,key:`type`,width:100,render:e=>{let t={system:{color:`#6366f1`,label:`系统`,bg:`rgba(99,102,241,0.1)`,icon:(0,$.jsx)(L6,{style:{fontSize:14}})},credit:{color:`#f59e0b`,label:`积分`,bg:`rgba(245,158,11,0.1)`,icon:(0,$.jsx)(B8,{style:{fontSize:14}})},promo:{color:`#8b5cf6`,label:`活动`,bg:`rgba(139,92,246,0.1)`,icon:(0,$.jsx)(Q4,{style:{fontSize:14}})}},n=t[e]||t.system;return(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,$.jsx)(`span`,{style:{color:n.color},children:n.icon}),(0,$.jsx)(`span`,{style:{fontSize:13,color:n.color,fontWeight:500},children:n.label})]})}},{title:`标题`,dataIndex:`title`,key:`title`,ellipsis:!0},{title:`内容`,dataIndex:`content`,key:`content`,ellipsis:!0},{title:`状态`,dataIndex:`isRead`,key:`isRead`,width:80,render:(e,t)=>e??t.is_read?(0,$.jsx)(v$,{color:`gray`,style:{background:`rgba(148,163,184,0.1)`},children:`已读`}):(0,$.jsx)(v$,{color:`purple`,style:{background:`rgba(139,92,246,0.1)`},children:`未读`})},{title:`创建时间`,dataIndex:`createdAt`,key:`createdAt`,width:160,render:e=>{if(!e)return`-`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/(1e3*60*60));if(r<1)return`刚刚`;if(r<24)return`${r}小时前`;let i=Math.floor(r/24);return i<7?`${i}天前`:t.toLocaleDateString(`zh-CN`)}},{title:`操作`,key:`action`,width:100,render:(e,t)=>t.isRead??t.is_read?null:(0,$.jsx)(jD,{type:`text`,size:`small`,onClick:()=>p(t.id),style:{color:`#6366f1`},children:`标记已读`})}],rowKey:`id`,pagination:!1,bordered:!1}),(0,$.jsx)(`div`,{style:{padding:`16px`,textAlign:`right`},children:(0,$.jsx)(WK,{current:c,pageSize:u,total:o,onChange:e=>{l(e)},size:`small`})})]})})})]})})},p9=()=>{let[e]=En(),[t,n]=(0,S.useState)(`credits`);return(0,S.useEffect)(()=>{(e.get(`tab`)||`credits`)===`orders`?n(`orders`):n(`credits`)},[e]),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Az,{activeKey:t,onChange:n,items:[{key:`credits`,label:`积分明细`},{key:`orders`,label:`订单记录`}],style:{marginBottom:24},size:`large`}),t===`credits`&&(0,$.jsx)(u9,{}),t===`orders`&&(0,$.jsx)(d9,{})]})},Wee=`/assets/bg1-CQh9PRPW.png`,Gee=`/assets/bg2-CNoKndHs.png`,{Header:Kee,Sider:qee,Content:Jee}=pK,{TextArea:Yee}=iK,{Option:m9}=xw,{Text:h9}=y1,Xee=()=>{let[e,t]=(0,S.useState)(!1),[n,r]=(0,S.useState)(`1`),[i,a]=(0,S.useState)([]),[o,s]=(0,S.useState)(``),{mediaType:c,countType:l,selectedRatio:u,selectedResolution:d,width:f,height:p,videoDuration:m,videoAspectRatio:h,videoResolution:g,engineOptions:_,enginesele:v,setMediaType:y,setCountType:b,setSelectedRatio:x,setSelectedResolution:C,setWidth:w,setHeight:T,setVideoDuration:E,setVideoAspectRatio:D,setVideoResolution:O,setEngineOptions:k,setEnginesele:A}=Q7(),[j,M]=(0,S.useState)(!1),[N,P]=(0,S.useState)(!1),[F,I]=(0,S.useState)([]),[L,R]=(0,S.useState)(!1),[z,B]=(0,S.useState)(``),[V,H]=(0,S.useState)(`image`),U=(0,S.useRef)(null),[W,ee]=(0,S.useState)(new Set),te=e=>{if(!e)return null;try{let t=new URL(e).searchParams.get(`exp`);return t?parseInt(t,10):null}catch{try{let t=e.indexOf(`?`);if(t!==-1){let n=e.substring(t+1),r=new URLSearchParams(n).get(`exp`);if(r)return parseInt(r,10)}return null}catch{return null}}},G=e=>{let t=te(e);return t?Math.floor(Date.now()/1e3)>t:!1},[ne,K]=(0,S.useState)(!1),[q,J]=(0,S.useState)(``),[re,Y]=(0,S.useState)(`image`),[ie,ae]=(0,S.useState)(``),[oe,se]=(0,S.useState)(!1),[ce,le]=(0,S.useState)(null),[ue,de]=(0,S.useState)({x:0,y:0}),[fe,pe]=(0,S.useState)(!1),[me,he]=(0,S.useState)(!1),[ge,_e]=(0,S.useState)([]),[ve,ye]=(0,S.useState)([]),[be,xe]=(0,S.useState)([]),[Se,Ce]=(0,S.useState)(0),[we,Te]=(0,S.useState)(0),[Ee,De]=(0,S.useState)(!1),[Oe,ke]=(0,S.useState)([]),[Ae,je]=(0,S.useState)([]),[Me,Ne]=(0,S.useState)([]),Pe=()=>{let e={};return e=Me.find(e=>e.modelConfigId===l&&e.genType===c&&e.resolution===(c===`video`?g:d)),e||(c===`video`?(e={perSecondCredits:2,baseCredits:60,ratio:1},g===`1080p`?e.ratio=2:g===`720p`?e.ratio=1.5:g===`480p`&&(e.ratio=1)):(e={perSecondCredits:.1,baseCredits:4,ratio:1},d===`2K`?e.ratio=1:d===`4K`&&(e.ratio=2))),c===`video`?Math.round((m*e.perSecondCredits+e.baseCredits)*e.ratio):e.baseCredits*e.ratio},Fe=(0,S.useRef)(null),Ie=(0,S.useRef)(null),Le=(0,S.useRef)(null);(0,S.useRef)(!0),i.find(e=>e.id===n);let[Re,ze]=(0,S.useState)([]),[Be,Ve]=(0,S.useState)({page:1,pageSize:20}),[He,Ue]=(0,S.useState)(0),[We,Ge]=(0,S.useState)(!1),Ke=(0,S.useRef)(!1),qe=(0,S.useCallback)((e=`instant`)=>{let t=Ie.current;t&&requestAnimationFrame(()=>{t.scrollTo({top:t.scrollHeight,behavior:e})})},[]);(0,S.useEffect)(()=>{if(Re.length>0&&!Ke.current){let e=setTimeout(()=>{qe(`smooth`),Ke.current=!0},300);return()=>clearTimeout(e)}},[Re.length,qe]),(0,S.useEffect)(()=>{let e=c===`image`?v.image:v.video;e&&e.length>0&&(e.some(e=>e.id===l)||b(e[0].id))},[c,v]),(0,S.useEffect)(()=>{let e=e=>{let t=e.target;Ee&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&De(!1),fe&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&pe(!1),me&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&he(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[Ee,fe,me]),(0,S.useEffect)(()=>{Z5().then(e=>{if(A(e.engine),e.engine.video&&e.engine.video.length>0){let t=e.engine.video[0],n=e.engine.video.find(e=>e.id===l)||t;k({ratios:n.supportedRatios||[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:n.supportedResolutions||[`480p`,`720p`,`1080p`],durations:n.supportedDurations||[5,8,10,12,15]}),n.supportedRatios?.includes(h)||D(n.supportedRatios?.[0]||`16:9`),n.supportedResolutions?.includes(g)||O(n.supportedResolutions?.[0]||`720p`),n.supportedDurations?.includes(m)||E(n.supportedDurations?.[0]||5),l===`请选择`&&b(n.id)}}).catch(()=>{}),X5().then(e=>{ke(e.video||[]),je(e.image||[])}).catch(e=>{}),r7().then(e=>{Ne(e)}),$5(Be).then(e=>{let t=e.items,n=e.total;ze(t),Ue(n)}),L5().then(e=>{let t=e.items?.[0]?.supportedSizes||{},n=[],r=[],i=[];for(let e in t[`2K`])n.push(e),r.push(t[`2K`][e]);_e(n.map((e,t)=>({value:e,label:String(t)})));for(let e in t[`4K`])i.push(t[`4K`][e]);xe([r,i]),ye([{value:`2K`,label:`高清 2K`},{value:`4K`,label:`超清 4K`}])}).catch(()=>{})},[]),(0,S.useEffect)(()=>{if(Le.current&&=(clearInterval(Le.current),null),Re.some(e=>e.status===`generating`))return Le.current=window.setInterval(()=>{$5(Be).then(e=>{ze(t=>t.map(t=>t.status===`generating`&&e.items.find(e=>e.id===t.id)||t)),Ue(e.total)}).catch(e=>{})},1e4),()=>{Le.current&&=(clearInterval(Le.current),null)}},[Re,Be]),(0,S.useEffect)(()=>{if(!fe)return;let e=e=>{let t=e.target;!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&pe(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[fe]),(0,S.useEffect)(()=>{if(!me)return;let e=e=>{let t=e.target;!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&he(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[me]),(0,S.useEffect)(()=>{be[we]&&be[we][Se]!==void 0&&(w(Number(be[we][Se].substring(0,4))),T(Number(be[we][Se].substring(5))))},[Se]),(0,S.useEffect)(()=>{be[we]&&be[we][Se]!==void 0&&(w(Number(be[we][Se].substring(0,4))),T(Number(be[we][Se].substring(5))))},[we]);let Je=e=>{Ce(e)},Ye=e=>{Te(parseInt(e===`2K`?`0`:`1`))},Xe=()=>{w(p),T(f)},Ze=async()=>{if(!o.trim()&&F.length===0){Q.warning(`请输入内容或上传图片/视频`);return}let e={id:``,gen_type:c,original_prompt:o.trim(),engine_id:l,idempotency_key:new Date().toLocaleString(`zh-CN`),media_references:F.length>0?[...F]:void 0,...c===`image`&&{image_size:d,image_proportion:u,image_px:f+`x`+p},...c===`video`&&{duration:m,aspect_ratio:h,resolution:g}};P(!0),Q5(e).then(()=>{s(``),I([]);let e={...Be,page:1};Ve(e),$5(e).then(e=>{ze(t=>[...t,e.items[e.items.length-1]]),Ue(e.total),setTimeout(()=>{Fe.current?.scrollIntoView({behavior:`smooth`})},100)}).catch(e=>{})}).catch(e=>{let t=`创建任务失败`;e?.response?.data?.detail?t=e.response.data.detail:e?.data?.detail?t=e.data.detail:e?.detail?t=e.detail:e?.message&&(t=e.message),Q.error({content:t,duration:3})}).finally(()=>{P(!1)}),setTimeout(()=>{P(!1)},3e3)},Qe=async()=>{if(Re.length>=He)return;let e=Ie.current;if(!e)return;let t=e.scrollTop,n=e.scrollHeight;Ge(!0);try{let r=Be.page+1,i=await $5({...Be,page:r}),a=Array.isArray(i)?{items:i,total:i.length}:i;a.total&&Ue(a.total),Ve(e=>({...e,page:r})),ze(e=>{let t=new Set(e.map(e=>e.id));return[...a.items.filter(e=>!e.id||t.has(e.id)?!1:(t.add(e.id),!0)),...e]}),setTimeout(()=>{e.scrollTop=t+(e.scrollHeight-n)},200)}catch{}finally{Ge(!1)}},$e=async e=>{let t=e.type.startsWith(`image/`),n=e.type.startsWith(`video/`);if(!t&&!n)return Q.error(`仅支持图片或视频文件`),!1;let r=n?100:10;if(e.size/1024/1024>r)return Q.error(`${n?`视频`:`图片`}大小不能超过${r}MB`),!1;let i=F.filter(e=>e.type===`image`).length;if(t&&i>=4)return Q.error(`最多上传4张图片`),!1;let a=F.filter(e=>e.type===`video`).length;if(n&&a>=1)return Q.error(`最多上传1个视频`),!1;M(!0);try{let n=await(t?k5:A5)(e);I(r=>[...r,{name:e.name,type:t?`image`:`video`,url:n.url}]),Q.success(`${t?`图片`:`视频`}上传成功`)}catch{Q.error(`上传失败`)}finally{M(!1)}return!1},et=e=>{I(t=>t.filter((t,n)=>n!==e))},tt=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),Ze())},nt=()=>{R(!1),B(``),U.current&&U.current.pause()},rt=e=>{if(e.preventDefault(),e.stopPropagation(),!z)return;let t=document.createElement(`a`);t.href=`http://ceshi.apiforeign.minzhong.cn${z}&download=1`,t.download=V===`image`?`image.png`:`video.mp4`,document.body.appendChild(t),t.click(),document.body.removeChild(t)};return(0,$.jsxs)(pK,{style:{margin:`-24px -32px -32px`,borderRadius:20,height:`calc(100vh - 34px)`,background:`linear-gradient(135deg, #f8fafc 0%, #f0f4ff 50%, #faf5ff 100%)`,backgroundImage:`url(${Gee})`,backgroundRepeat:`no-repeat`,backgroundSize:`100% 100%`,backgroundPosition:`center`},children:[!1,(0,$.jsxs)(pK,{style:{display:`flex`,flex:1,background:`transparent`},children:[(0,$.jsx)(Kee,{style:{borderRadius:`20px 20px 0 0`,background:`rgba(255,255,255,0.1)`,backdropFilter:`blur(20px)`,borderBottom:`1px solid rgba(99, 102, 241, 0.08)`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`0 24px`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsx)(`div`,{style:{width:36,height:36,borderRadius:12,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(S6,{style:{fontSize:18,color:`#fff`}})}),(0,$.jsx)(`div`,{children:(0,$.jsx)(h9,{strong:!0,style:{fontSize:16,background:`linear-gradient(90deg, #6366f1, #8b5cf6)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`},children:`开启创作`})})]})}),(0,$.jsxs)(Jee,{style:{flex:1,margin:0,padding:24,boxSizing:`border-box`,display:`flex`,flexDirection:`column`,overflow:`hidden`,minHeight:0},children:[Re.length===0&&(0,$.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`},children:[(0,$.jsx)(`div`,{style:{width:80,height:80,borderRadius:50,background:`linear-gradient(135deg, #6366f1 0%, #a78bfa 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,marginBottom:16},children:(0,$.jsx)(S6,{style:{fontSize:40,color:`#fff`}})}),(0,$.jsx)(`h2`,{style:{margin:0,fontSize:18,fontWeight:500,color:`#333`},children:`你好,想创作什么?`}),(0,$.jsx)(`p`,{style:{margin:8,fontSize:13,color:`#999`},children:`输入想法、剧本或上传参考,开始你的创作之旅`})]}),Re.length>0&&(0,$.jsxs)(`div`,{ref:Ie,style:{flex:1,overflowY:`auto`,paddingRight:8},children:[(0,$.jsx)(`div`,{style:{padding:`8px 0`,textAlign:`center`,marginBottom:16},children:Re.length>=He?(0,$.jsx)(`span`,{style:{fontSize:12,color:`#999`},children:`消息全部加载`}):(0,$.jsx)(`button`,{onClick:Qe,disabled:We,style:{fontSize:12,color:`#6366f1`,background:`none`,border:`none`,cursor:We?`not-allowed`:`pointer`},children:We?`加载中...`:`加载更多`})}),(()=>{let e=Q;return Re.map(t=>(0,$.jsx)(`div`,{style:{width:`100%`,display:`flex`,justifyContent:`flex-start`,marginBottom:16},children:(0,$.jsxs)(`div`,{style:{width:`100%`,display:`flex`,gap:10},children:[(0,$.jsx)(`div`,{style:{width:36,height:36,borderRadius:12,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.3)`},children:(0,$.jsx)(S6,{style:{color:`#fff`,fontSize:16}})}),(0,$.jsx)(`div`,{style:{flex:1},children:(0,$.jsxs)(`div`,{style:{background:`rgba(255,255,255,0.85)`,backdropFilter:`blur(20px)`,borderRadius:`16px 16px 16px 4px`,padding:`12px 16px`,width:`70%`,minWidth:500,boxSizing:`border-box`,boxShadow:`0 4px 20px rgba(99, 102, 241, 0.08), 0 1px 3px rgba(0,0,0,0.04)`,position:`relative`,border:`1px solid rgba(99, 102, 241, 0.06)`},children:[(0,$.jsxs)(`div`,{style:{margin:4,fontSize:11,color:`#999`,textAlign:`left`,display:`flex`,flexWrap:`wrap`,gap:8,alignItems:`center`},children:[(0,$.jsx)(`span`,{children:t.createdAt?.replace(`T`,` `).split(`.`)[0]}),(0,$.jsx)(`span`,{style:{background:t.genType===`image`?`rgba(34, 197, 94, 0.12)`:`rgba(249, 115, 22, 0.12)`,color:t.genType===`image`?`#22c55e`:`#f97316`,padding:`2px 8px`,borderRadius:12,fontWeight:500,fontSize:11,marginLeft:8},children:t.genType===`image`?`图片生成`:`视频生成`})]}),(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8,zIndex:100},children:(0,$.jsx)(Mq,{title:`确定要删除吗?`,onConfirm:async()=>{try{await n7(t.id),e.success(`删除成功`),ze(e=>e.filter(e=>e.id!==t.id)),Ue(e=>e-1)}catch(t){let n=t?.response?.data?.message||t?.message||`删除失败`;e.error(n)}},okText:`确定`,cancelText:`取消`,children:(0,$.jsx)(`button`,{onClick:e=>e.stopPropagation(),style:{width:28,height:28,borderRadius:8,border:`none`,background:`rgba(99, 102, 241, 0.08)`,color:`#6366f1`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.2s ease`,padding:0},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(239, 68, 68, 0.1)`,e.currentTarget.style.color=`#ef4444`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(99, 102, 241, 0.08)`,e.currentTarget.style.color=`#6366f1`},children:(0,$.jsx)(x$,{style:{fontSize:12}})})})}),(t.status===`generating`||t.status===`failed`||t.status===`completed`)&&(0,$.jsxs)(`div`,{style:{display:`flex`,gap:16,marginBottom:16,marginTop:16,width:`100%`,alignItems:`flex-start`},children:[(0,$.jsx)(`div`,{style:{width:`50%`,overflow:`hidden`,borderRadius:12,position:`relative`,height:220,border:`1px solid rgba(99, 102, 241, 0.1)`,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.08)`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%)`},children:t.status===`generating`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:12,left:12,display:`flex`,alignItems:`center`,gap:8,zIndex:2}}),(0,$.jsx)(`div`,{style:{position:`absolute`,inset:0,background:`linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.6) 50%, transparent 100%)`,animation:`shimmer 2s infinite`}}),(0,$.jsxs)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:16},children:[(0,$.jsx)(`div`,{style:{width:64,height:64,borderRadius:`50%`,background:`rgba(99, 102, 241, 0.1)`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 0 30px rgba(99, 102, 241, 0.2)`},children:(0,$.jsx)(`div`,{style:{width:48,height:48,border:`3px solid #c7d2fe`,borderTopColor:`#6366f1`,borderRadius:`50%`,animation:`spin 1s linear infinite`}})}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#6366f1`,fontWeight:500},children:`生成中...`})]})]}):t.status===`failed`?(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12},children:[(0,$.jsx)(`div`,{style:{width:48,height:48,borderRadius:`50%`,background:`rgba(254, 226, 226, 0.8)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(U8,{style:{color:`#ef4444`,fontSize:22}})}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#94a3b8`},children:`生成失败`})]}):(0,$.jsx)($.Fragment,{children:t.genType===`image`?(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn/static${t.imageUrl}&w=300&p=50`,alt:t.name,style:{width:`100%`,height:`100%`,borderRadius:12,objectFit:`contain`,cursor:`pointer`,transition:`transform 0.3s ease`},onClick:()=>{B(t.imageUrl),H(`image`),R(!0)},onMouseEnter:e=>{e.currentTarget.style.transform=`scale(1.05)`},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`}}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn/static${t.videoCoverUrl}&w=300&p=50`,alt:t.name,style:{width:`100%`,height:`100%`,borderRadius:12,objectFit:`contain`,cursor:`pointer`,transition:`transform 0.3s ease`},onClick:()=>{B(t.videoUrl),H(`video`),R(!0)},onMouseEnter:e=>{e.currentTarget.style.transform=`scale(1.05)`},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`}}),(0,$.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,width:56,height:56,background:`rgba(99, 102, 241, 0.85)`,borderRadius:`50%`,display:`flex`,alignItems:`center`,justifyContent:`center`,pointerEvents:`none`,boxShadow:`0 4px 20px rgba(99, 102, 241, 0.4)`},children:(0,$.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`#fff`,children:(0,$.jsx)(`path`,{d:`M8 5v14l11-7z`})})})]})})}),(0,$.jsxs)(`div`,{style:{width:`50%`,display:`flex`,flexDirection:`column`,gap:12},children:[(0,$.jsx)(`div`,{style:{background:`linear-gradient(135deg, rgba(248,250,252,0.8) 0%, rgba(238,242,255,0.6) 100%)`,borderRadius:12,padding:12,border:`1px solid rgba(99, 102, 241, 0.08)`,flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(`p`,{style:{width:`100%`,height:150,overflow:`auto`,padding:0,marginTop:0,marginBottom:0,lineHeight:2,color:`#475569`,fontSize:13},children:t.originalPrompt})}),(0,$.jsxs)(`div`,{style:{fontSize:12,color:`#64748b`,textAlign:`left`,display:`flex`,flexWrap:`wrap`,gap:12,alignItems:`center`,justifyContent:`space-between`,marginBottom:12},children:[(0,$.jsx)(`span`,{style:{borderRadius:16,color:`#6366f1`,fontWeight:500},children:t.engineSnapshot.name}),(0,$.jsx)(`span`,{style:{borderRadius:16,color:`#64748b`},children:t.genType===`image`?`${t.imageProportion||``} · ${t.imagePx||``} · ${t.imageSize||``}`:`${t.duration||``}s · ${t.aspectRatio||``} · ${t.resolution||``}`}),(0,$.jsxs)(`span`,{style:{borderRadius:16,color:`#ef4444`,fontWeight:500},children:[`消耗积分:`,t.creditsCost]})]})]})]}),(0,$.jsx)(`div`,{style:{textAlign:`right`},children:t.mediaReferences&&t.mediaReferences.length>0&&(0,$.jsx)(`span`,{style:{padding:`4px 12px`,borderRadius:16,color:`#6366f1`,cursor:`pointer`,fontWeight:500,border:`1px solid rgba(99, 102, 241, 0.2)`,background:`rgba(99, 102, 241, 0.04)`},onClick:e=>{e.stopPropagation();let n=e.currentTarget.getBoundingClientRect();de({x:n.left,y:n.top-10}),le(t.id),se(!0)},children:`附件详情`})})]})})]})},t.id))})(),(0,$.jsx)(`div`,{ref:Fe})]}),oe&&ce&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{position:`fixed`,top:0,left:0,right:0,bottom:0,background:`transparent`,zIndex:9998},onClick:()=>{se(!1),le(null)}}),(0,$.jsxs)(`div`,{style:{position:`fixed`,top:ue.y-100,left:ue.x,background:`#fff`,borderRadius:12,boxShadow:`0 4px 20px rgba(0,0,0,0.15)`,padding:16,minWidth:200,zIndex:9999},onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:12},children:[(0,$.jsx)(`span`,{style:{fontSize:14,fontWeight:500},children:`附件列表`}),(0,$.jsx)(`button`,{onClick:()=>{se(!1),le(null)},style:{width:24,height:24,borderRadius:`50%`,border:`none`,background:`#ff4d4f`,cursor:`pointer`,fontSize:14,color:`#fff`,fontWeight:`bold`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.2s`},onMouseEnter:e=>{e.currentTarget.style.background=`#ff7875`,e.currentTarget.style.transform=`scale(1.1)`},onMouseLeave:e=>{e.currentTarget.style.background=`#ff4d4f`,e.currentTarget.style.transform=`scale(1)`},children:`×`})]}),Re.find(e=>e.id===ce)?.mediaReferences?.map((e,t)=>(0,$.jsxs)(`div`,{onClick:()=>{J(e.url),Y(e.url.includes(`.mp4`)||e.url.includes(`.mov`)||e.url.includes(`.avi`)||e.url.includes(`.video`)?`video`:`image`),ae(e.name),K(!0),se(!1),le(null)},style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 12px`,borderRadius:6,cursor:`pointer`,fontSize:13,color:`#333`,transition:`background 0.2s`},onMouseEnter:e=>e.currentTarget.style.background=`#f5f5f5`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,children:[e.type===`image`?(0,$.jsx)(t6,{style:{color:`#3b82f6`,fontSize:14}}):(0,$.jsx)(L8,{style:{color:`#f59e0b`,fontSize:14}}),e.name]},t))]})]}),(0,$.jsxs)(`div`,{style:{background:`rgba(255,255,255,0.1)`,backdropFilter:`blur(20px)`,borderRadius:24,padding:16,boxShadow:`0 8px 32px rgba(99, 102, 241, 0.1), 0 2px 8px rgba(0,0,0,0.04)`,transition:`all 0.3s ease`,border:`1px solid rgba(99, 102, 241, 0.08)`},children:[F.length>0&&(0,$.jsx)(`div`,{style:{display:`flex`,gap:8,marginBottom:12,overflowX:`auto`},children:F.map((e,t)=>(0,$.jsxs)(`div`,{style:{position:`relative`,width:e.type===`video`?120:80,flexShrink:0},children:[e.type===`image`?(0,$.jsx)(`img`,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,alt:e.name,style:{width:`100%`,height:80,objectFit:`cover`,borderRadius:8}}):(0,$.jsx)(`video`,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,style:{width:`100%`,height:80,objectFit:`cover`,borderRadius:8}}),(0,$.jsx)(`button`,{onClick:()=>et(t),style:{position:`absolute`,top:0,right:0,width:20,height:20,border:`none`,background:`#ff4d4f`,borderRadius:50,cursor:`pointer`,color:`#fff`,fontSize:12,display:`flex`,alignItems:`center`,justifyContent:`center`},children:`×`})]},`media-${t}`))}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,padding:`12px 16px`,backgroundColor:`rgba(248,250,252,0.6)`,borderRadius:16,border:`1px solid rgba(99, 102, 241, 0.08)`,boxShadow:`0 2px 8px rgba(99, 102, 241, 0.04)`,transition:`all 0.2s ease`},children:[(0,$.jsx)(p0,{accept:`image/*,video/*`,showUploadList:!1,beforeUpload:$e,children:(0,$.jsx)(uT,{title:`图片${F.filter(e=>e.type===`image`).length}/4,视频${F.filter(e=>e.type===`video`).length}/1`,children:(0,$.jsx)(`div`,{style:{width:48,height:48,borderRadius:14,border:`2px dashed rgba(99, 102, 241, 0.2)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,transition:`all 0.25s ease`,flexShrink:0,backgroundColor:`rgba(255,255,255,0.7)`},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#6366f1`,e.currentTarget.style.backgroundColor=`rgba(99, 102, 241, 0.06)`,e.currentTarget.style.transform=`scale(1.05)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`rgba(99, 102, 241, 0.2)`,e.currentTarget.style.backgroundColor=`rgba(255,255,255,0.7)`,e.currentTarget.style.transform=`scale(1)`},children:j?(0,$.jsx)(qm,{style:{fontSize:18,color:`#6366f1`}}):(0,$.jsx)(MR,{style:{fontSize:18,color:`#64748b`}})})})}),(0,$.jsx)(Yee,{value:o,onChange:e=>s(e.target.value),onKeyPress:tt,placeholder:`上传最多4张参考图,输入提示词描述您想生成的画面...`,autoSize:{minRows:1,maxRows:4},style:{flex:1,height:`100%`,borderRadius:12,border:`none`,outline:`none`,boxShadow:`none`,fontSize:14,lineHeight:1.5,color:`#1e293b`},disabled:N}),(0,$.jsx)(jD,{type:`primary`,shape:`circle`,icon:(0,$.jsx)(P6,{}),onClick:Ze,disabled:!o.trim()&&F.length===0,loading:N,style:{flexShrink:0,width:48,height:48,borderRadius:14,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,boxShadow:`0 4px 16px rgba(99, 102, 241, 0.4)`,transition:`all 0.2s ease`,border:`none`}})]}),(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginTop:12,paddingTop:12,borderTop:`1px solid rgba(99, 102, 241, 0.08)`},children:(0,$.jsxs)(kU,{size:`middle`,children:[(0,$.jsxs)(xw,{value:c,onChange:e=>y(e),style:{width:100,height:34,outline:`none`,border:`none`,backgroundColor:`#f1f5f9`,borderRadius:10},size:`middle`,children:[(0,$.jsxs)(m9,{value:`image`,children:[(0,$.jsx)(t6,{style:{marginRight:6,fontSize:14}}),(0,$.jsx)(`span`,{style:{fontSize:14,fontWeight:500,color:`#64748b`},children:`图片`})]}),(0,$.jsxs)(m9,{value:`video`,children:[(0,$.jsx)(L8,{style:{marginRight:6,fontSize:14}}),(0,$.jsx)(`span`,{style:{fontSize:14,fontWeight:500,color:`#64748b`},children:`视频`})]})]}),(0,$.jsxs)(`div`,{style:{position:`relative`,display:`inline-block`},children:[(0,$.jsxs)(`button`,{onClick:()=>De(!0),className:`image-settings-trigger`,style:{minWidth:200,padding:`6px 14px`,height:34,borderRadius:10,border:`none`,backgroundColor:`#f1f5f9`,cursor:`pointer`,display:`inline-flex`,alignItems:`center`,gap:6,transition:`all 0.2s`,boxShadow:`0 2px 8px rgba(99, 102, 241, 0.04)`},onMouseEnter:e=>{e.currentTarget.style.borderColor=`rgba(99, 102, 241, 0.3)`,e.currentTarget.style.boxShadow=`0 4px 12px rgba(99, 102, 241, 0.08)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`rgba(99, 102, 241, 0.15)`,e.currentTarget.style.boxShadow=`0 2px 8px rgba(99, 102, 241, 0.04)`},children:[(0,$.jsx)(L6,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(h9,{style:{fontSize:14,fontWeight:500,color:`#64748b`},children:c===`image`?v.image?.find(e=>e.id===l)?.name:v.video?.find(e=>e.id===l)?.name||`选择引擎`})]}),Ee&&(0,$.jsx)(`div`,{className:`image-settings-popover`,style:{position:`absolute`,bottom:`calc(100% + 8px)`,left:0,width:360,backgroundColor:`rgba(255,255,255,0.95)`,backdropFilter:`blur(20px)`,borderRadius:14,boxShadow:`0 12px 48px rgba(99, 102, 241, 0.15)`,padding:16,border:`1px solid rgba(99, 102, 241, 0.1)`,zIndex:9999},onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(`div`,{style:{marginBottom:8},children:[(0,$.jsx)(h9,{style:{display:`block`,marginBottom:8,fontSize:12,fontWeight:600,color:`#475569`},children:`选择引擎`}),(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:(c===`image`?v.image:v.video)?.map(e=>(0,$.jsxs)(`button`,{onClick:()=>{b(e.id),c===`video`&&(k({ratios:e.supportedRatios||[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:e.supportedResolutions||[`480p`,`720p`,`1080p`],durations:e.supportedDurations||[5,8,10,12,15]}),e.supportedRatios?.includes(h)||D(e.supportedRatios?.[0]||`16:9`),e.supportedResolutions?.includes(g)||O(e.supportedResolutions?.[0]||`720p`),e.supportedDurations?.includes(m)||E(e.supportedDurations?.[0]||5)),De(!1)},style:{flex:1,minHeight:48,borderRadius:8,border:l===e.id?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:l===e.id?`#fff`:`#f9fafb`,cursor:`pointer`,display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`flex-start`,padding:`8px 12px`,transition:`all 0.2s`,textAlign:`left`},children:[(0,$.jsx)(`span`,{style:{fontSize:13,fontWeight:l===e.id?600:500,color:l===e.id?`#6366f1`:`#4b5563`,marginBottom:2},children:e.name}),(0,$.jsx)(`span`,{style:{fontSize:11,color:`#9ca3af`}})]},e.id))})]})})]}),c===`image`&&(0,$.jsxs)(`div`,{style:{position:`relative`,display:`inline-block`},children:[(0,$.jsxs)(`button`,{onClick:()=>pe(!fe),className:`image-settings-trigger`,style:{minWidth:220,padding:`4px 12px`,height:34,borderRadius:8,border:`none`,backgroundColor:`#f1f5f9`,cursor:`pointer`,display:`inline-flex`,alignItems:`center`,gap:6,transition:`all 0.2s`},children:[(0,$.jsx)(S3,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsxs)(h9,{style:{fontSize:14,fontWeight:500,color:`#64748b`},children:[u===`auto`?`智能`:u,` · `,d==`2K`?`2K高清`:`4K超清`,` · `,f,`×`,p]})]}),fe&&(0,$.jsxs)(`div`,{className:`image-settings-popover`,style:{position:`absolute`,bottom:`calc(100% + 8px)`,left:0,width:480,backgroundColor:`rgba(255,255,255,0.95)`,backdropFilter:`blur(20px)`,borderRadius:14,boxShadow:`0 12px 48px rgba(99, 102, 241, 0.15)`,padding:16,border:`1px solid rgba(99, 102, 241, 0.1)`,zIndex:9999},onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(h9,{style:{display:`block`,marginBottom:8,fontSize:12,fontWeight:500,color:`#666666`},children:`选择比例`}),(0,$.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:4},children:ge.map(e=>(0,$.jsxs)(`button`,{onClick:()=>{x(e.value),Je(e.label)},style:{flex:`0 0 calc(11.11% - 4px)`,minWidth:44,height:52,borderRadius:6,border:u===e.value?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:u===e.value?`#fff`:`#f9fafb`,cursor:`pointer`,display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,transition:`all 0.2s`},children:[(0,$.jsx)(`div`,{style:{width:e.value===`auto`?14:18,height:e.value===`auto`?14:18,border:`2px solid ${u===e.value?`#6366f1`:`#9ca3af`}`,borderRadius:2,marginBottom:2,display:`flex`,alignItems:`center`,justifyContent:`center`},children:e.value===`auto`&&(0,$.jsx)(`span`,{style:{fontSize:7,color:u===e.value?`#6366f1`:`#9ca3af`},children:`智`})}),(0,$.jsx)(`span`,{style:{fontSize:9,color:u===e.value?`#6366f1`:`#6b7280`,fontWeight:u===e.value?600:400},children:e.value})]},e.value))})]}),(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(h9,{style:{display:`block`,marginBottom:8,fontSize:12,fontWeight:500,color:`#666666`},children:`选择分辨率`}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:6},children:ve.map(e=>(0,$.jsx)(`button`,{onClick:()=>{C(e.value),Ye(e.value)},style:{flex:1,height:42,borderRadius:6,border:d===e.value?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:d===e.value?`#6366f1`:`#f9fafb`,cursor:`pointer`,display:`flex`,justifyContent:`center`,alignItems:`center`,transition:`all 0.2s`},children:(0,$.jsxs)(`span`,{style:{fontSize:12,fontWeight:600,color:d===e.value?`#fff`:`#4b5563`},children:[e.value,e.value===`4K`&&(0,$.jsx)(`span`,{style:{marginLeft:2},children:`✨`})]})},e.value))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(h9,{style:{display:`block`,marginBottom:8,fontSize:12,fontWeight:500,color:`#666666`},children:`尺寸`}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,flex:1,maxWidth:120},children:[(0,$.jsx)(`span`,{style:{color:`#9ca3af`,fontSize:11,marginRight:4},children:`W`}),(0,$.jsx)(iK,{value:f,onChange:e=>w(Number(e.target.value)||0),style:{flex:1,textAlign:`center`,borderRadius:4,height:34,border:`1px solid #e5e7eb`,backgroundColor:`#f9fafb`,fontSize:12,fontWeight:600,color:`#1f2937`}})]}),(0,$.jsx)(`button`,{onClick:Xe,style:{width:24,height:24,borderRadius:4,border:`1px solid #e5e7eb`,backgroundColor:`#fff`,cursor:`pointer`,display:`flex`,justifyContent:`center`,alignItems:`center`,color:`#6366f1`},children:(0,$.jsx)(cG,{style:{fontSize:10}})}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,flex:1,maxWidth:120},children:[(0,$.jsx)(`span`,{style:{color:`#9ca3af`,fontSize:11,marginRight:4},children:`H`}),(0,$.jsx)(iK,{value:p,onChange:e=>T(Number(e.target.value)||0),style:{flex:1,textAlign:`center`,borderRadius:4,height:34,border:`1px solid #e5e7eb`,backgroundColor:`#f9fafb`,fontSize:12,fontWeight:600,color:`#1f2937`}})]}),(0,$.jsx)(`span`,{style:{color:`#9ca3af`,fontSize:11},children:`PX`})]})]})]})]}),c===`video`&&(0,$.jsxs)(`div`,{style:{position:`relative`,display:`inline-block`},children:[(0,$.jsxs)(`button`,{onClick:()=>he(!me),className:`image-settings-trigger`,style:{minWidth:220,padding:`4px 12px`,height:34,borderRadius:8,border:`none`,backgroundColor:`#f1f5f9`,cursor:`pointer`,display:`inline-flex`,alignItems:`center`,gap:6,transition:`all 0.2s`},children:[(0,$.jsx)(S3,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsxs)(h9,{style:{fontSize:14,fontWeight:500,color:`#64748b`},children:[h,` · `,m,`s · `,g]})]}),me&&(0,$.jsxs)(`div`,{className:`image-settings-popover`,style:{position:`absolute`,bottom:`calc(100% + 8px)`,left:0,width:400,backgroundColor:`rgba(255,255,255,0.95)`,backdropFilter:`blur(20px)`,borderRadius:14,boxShadow:`0 12px 48px rgba(99, 102, 241, 0.15)`,padding:16,border:`1px solid rgba(99, 102, 241, 0.1)`,zIndex:9999},onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(h9,{style:{display:`block`,marginBottom:8,fontSize:12,fontWeight:500,color:`#666666`},children:`选择比例`}),(0,$.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:4},children:_.ratios.map(e=>(0,$.jsxs)(`button`,{onClick:()=>D(e),style:{flex:`0 0 calc(14.28% - 4px)`,minWidth:44,height:52,borderRadius:6,border:h===e?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:h===e?`#fff`:`#f9fafb`,cursor:`pointer`,display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,transition:`all 0.2s`},children:[(0,$.jsx)(`div`,{style:{width:18,height:18,border:`2px solid ${h===e?`#6366f1`:`#9ca3af`}`,borderRadius:2,marginBottom:2}}),(0,$.jsx)(`span`,{style:{fontSize:9,color:h===e?`#6366f1`:`#6b7280`,fontWeight:h===e?600:400},children:e})]},e))})]}),(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(h9,{style:{display:`block`,marginBottom:8,fontSize:12,fontWeight:500,color:`#666666`},children:`选择时长`}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsxs)(`div`,{style:{flex:1,position:`relative`,height:24,display:`flex`,alignItems:`center`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:0,right:0,height:6,borderRadius:3,background:`#e5e7eb`,transform:`translateY(-50%)`}}),(0,$.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:0,height:6,borderRadius:3,background:`#6366f1`,width:`${(m-Math.min(..._.durations))/(Math.max(..._.durations)-Math.min(..._.durations))*100}%`,transform:`translateY(-50%)`}}),(0,$.jsx)(`input`,{type:`range`,min:Math.min(..._.durations),max:Math.max(..._.durations),value:m,onChange:e=>E(Number(e.target.value)),style:{position:`relative`,width:`100%`,height:24,borderRadius:3,background:`transparent`,outline:`none`,appearance:`none`,cursor:`pointer`,zIndex:1}})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,padding:`4px 12px`,backgroundColor:`#f1f5f9`,borderRadius:6},children:[(0,$.jsx)(`span`,{style:{fontSize:14,fontWeight:600,color:`#64748b`},children:m}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#9ca3af`},children:`秒`})]})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(h9,{style:{display:`block`,marginBottom:8,fontSize:12,fontWeight:500,color:`#666666`},children:`选择分辨率`}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:6},children:_.resolutions.map(e=>(0,$.jsx)(`button`,{onClick:()=>O(e),style:{flex:1,height:42,borderRadius:6,border:g===e?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:g===e?`#6366f1`:`#f9fafb`,cursor:`pointer`,display:`flex`,justifyContent:`center`,alignItems:`center`,transition:`all 0.2s`},children:(0,$.jsx)(`span`,{style:{fontSize:12,fontWeight:600,color:g===e?`#fff`:`#4b5563`},children:e})},e))})]})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`6px 14px`,backgroundColor:`rgba(99, 102, 241, 0.06)`,borderRadius:10,border:`1px solid rgba(99, 102, 241, 0.1)`},children:[(0,$.jsx)(h9,{style:{fontSize:13,color:`#6366f1`,fontWeight:500},children:`预估积分`}),(0,$.jsx)(h9,{style:{fontSize:14,color:`#6366f1`,fontWeight:600},children:Pe()})]})]})})]})]})]}),(0,$.jsx)(`style`,{children:` @keyframes blink { 0%, 50% { opacity: 1; } diff --git a/video-gen-app/dist/index.html b/video-gen-app/dist/index.html index eb381a2c..337e7013 100644 --- a/video-gen-app/dist/index.html +++ b/video-gen-app/dist/index.html @@ -28,7 +28,7 @@ } })(); - + diff --git a/video-gen-app/src/components/Layout/AppLayout.tsx b/video-gen-app/src/components/Layout/AppLayout.tsx index 7ca9e4a8..5f29ad09 100644 --- a/video-gen-app/src/components/Layout/AppLayout.tsx +++ b/video-gen-app/src/components/Layout/AppLayout.tsx @@ -434,15 +434,26 @@ const AppLayout: React.FC = () => { )} */} {(() => { - const groups = menuItems.filter(m => (m.menu_type ?? m.menuType) === 'group'); - const pages = menuItems.filter(m => (m.menu_type ?? m.menuType) !== 'group'); + // Build child map for all menu items const childMap: Record = {}; - pages.filter(m => m.parent_id ?? m.parentId).forEach(m => { - const pid = (m.parent_id ?? m.parentId) as string; - if (!childMap[pid]) childMap[pid] = []; - childMap[pid].push(m); + menuItems.forEach(m => { + const pid = m.parent_id ?? m.parentId; + if (pid) { + if (!childMap[pid]) childMap[pid] = []; + childMap[pid].push(m); + } }); - const topLevel = pages.filter(m => !(m.parent_id ?? m.parentId)); + + // Get top-level items (parent_id is null/undefined) + const topLevelItems = menuItems.filter(m => !(m.parent_id ?? m.parentId)); + + // Sort top-level items by sort_order + topLevelItems.sort((a, b) => { + const orderA = typeof a.sortOrder === 'number' ? a.sortOrder : Infinity; + const orderB = typeof b.sortOrder === 'number' ? b.sortOrder : Infinity; + return orderA - orderB; + }); + const items: React.ReactNode[] = []; const renderMenuItem = (item: MenuConfig, depth: number = 0) => { @@ -470,37 +481,32 @@ const AppLayout: React.FC = () => { ); }; - // Render groups with children - groups.sort((a, b) => { - const orderA = typeof a.sortOrder === 'number' ? a.sortOrder : Infinity; - const orderB = typeof b.sortOrder === 'number' ? b.sortOrder : Infinity; - return orderA - orderB; - }).forEach(g => { - const children = (childMap[g.id] || []).sort((a, b) => { - const orderA = typeof a.sortOrder === 'number' ? a.sortOrder : Infinity; - const orderB = typeof b.sortOrder === 'number' ? b.sortOrder : Infinity; - return orderA - orderB; - }); - items.push( -
-
- {g.label} + // Render top-level items and their children in order + topLevelItems.forEach(item => { + const menuType = item.menu_type ?? item.menuType; + + if (menuType === 'group') { + // Render group with its children + const children = (childMap[item.id] || []).sort((a, b) => { + const orderA = typeof a.sortOrder === 'number' ? a.sortOrder : Infinity; + const orderB = typeof b.sortOrder === 'number' ? b.sortOrder : Infinity; + return orderA - orderB; + }); + items.push( +
+
+ {item.label} +
+ {children.map(c => renderMenuItem(c, 1))}
- {children.map(c => renderMenuItem(c, 1))} -
- ); - }); - - // Render top-level pages - topLevel.sort((a, b) => { - const orderA = typeof a.sortOrder === 'number' ? a.sortOrder : Infinity; - const orderB = typeof b.sortOrder === 'number' ? b.sortOrder : Infinity; - return orderA - orderB; - }).forEach(m => { - items.push(renderMenuItem(m)); + ); + } else { + // Render standalone page + items.push(renderMenuItem(item)); + } }); return items;