From 51673453d80eea170eb6572399d21f47af7239d1 Mon Sep 17 00:00:00 2001 From: GinHa <15201596918@163.com> Date: Wed, 15 Jul 2026 13:30:59 +0800 Subject: [PATCH] =?UTF-8?q?AI=E5=88=9B=E4=BD=9C=E6=89=B9=E9=87=8F=E7=94=9F?= =?UTF-8?q?=E6=88=90=E4=BB=BB=E5=8A=A1=20V4=20=E4=BF=AE=E5=A4=8D=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E7=AB=AFAI=E5=88=9B=E4=BD=9C=E6=8E=92=E5=BA=8FBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- video-gen-api/app/api/v1/generation_ai.py | 2 +- .../dist/assets/{index-Buf7L1qs.js => index-DN27BTjS.js} | 2 +- video-gen-app/dist/index.html | 2 +- video-gen-app/src/pages/GenerateConver.tsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename video-gen-app/dist/assets/{index-Buf7L1qs.js => index-DN27BTjS.js} (98%) diff --git a/video-gen-api/app/api/v1/generation_ai.py b/video-gen-api/app/api/v1/generation_ai.py index 200f8e92..03345970 100644 --- a/video-gen-api/app/api/v1/generation_ai.py +++ b/video-gen-api/app/api/v1/generation_ai.py @@ -347,7 +347,7 @@ async def list_tasks( # 同一个 API 同时服务管理后台和客户端: # - 管理员保持数据库倒序,最新记录在列表上方; # - 普通用户先查询最新一页,再仅反转当前页,聊天消息从旧到新排列。 - items_for_output = items if is_admin else sorted(items, key=lambda x: x.created_at if x.created_at is not None else x.id,reverse=False) + items_for_output = items if is_admin else list(reversed(items)) out_items = await build_task_out_list( db, items_for_output, diff --git a/video-gen-app/dist/assets/index-Buf7L1qs.js b/video-gen-app/dist/assets/index-DN27BTjS.js similarity index 98% rename from video-gen-app/dist/assets/index-Buf7L1qs.js rename to video-gen-app/dist/assets/index-DN27BTjS.js index d6f2b122..e238839a 100644 --- a/video-gen-app/dist/assets/index-Buf7L1qs.js +++ b/video-gen-app/dist/assets/index-DN27BTjS.js @@ -404,7 +404,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho 100% { opacity: 1; transform: translateY(0) scale(1); } } `})]})},x7=({data:e})=>{if(!e)return null;let t=(e.limitUnit||`GB`).toUpperCase(),n=t===`GB`?1024**3:t===`MB`?1024**2:1024,r=Number(e.usagePercent)||0,i=Math.min(100,Math.max(0,r)),a=e.limitValue?parseFloat(e.limitValue):e.totalBytes/n,o=a*r/100;a-o;let s=e.exceeded||r>=100,c=1024**2,l=1024**3,u=1024**4,d=(e=>{let t=Number(e)||0;return t>=u?{val:(t/u).toFixed(2),unit:`TB`}:t>=l?{val:(t/l).toFixed(2),unit:`GB`}:t>=c?{val:(t/c).toFixed(2),unit:`MB`}:{val:(t/1024).toFixed(2),unit:`KB`}})(e.usedBytes);return(0,$.jsxs)(`div`,{style:{padding:`0 12px`,paddingTop:6,borderRadius:10,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)`},children:[(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:6,fontSize:12,color:`#475569`},children:e.enabled?(0,$.jsx)($.Fragment,{}):(0,$.jsxs)(`span`,{style:{fontWeight:500,color:`#1e293b`},children:[(0,$.jsx)(Y4,{style:{fontSize:12,color:s?`#ef4444`:`#6366f1`,marginRight:4}}),`当前使用 `,d.val,` `,d.unit]})}),e.enabled&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{marginTop:4,display:`flex`,justifyContent:`space-between`,fontSize:11,color:s?`#ef4444`:`#94a3b8`},children:(0,$.jsxs)(`div`,{style:{height:`100%`,width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:6,fontSize:12,color:`#000000ff`,padding:`0 8px`},children:[(0,$.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,$.jsx)(Y4,{style:{fontSize:12,color:`#000000ff`}}),r.toFixed(1),`%`]}),e.enabled?(0,$.jsxs)(`span`,{style:{fontWeight:500,color:`#000000ff`},children:[o.toFixed(2),` / `,a.toFixed(2),` `,t]}):(0,$.jsxs)(`span`,{style:{fontWeight:500,color:`#1e293b`},children:[`当前使用 `,d.val,` `,d.unit]})]})}),(0,$.jsx)(`div`,{style:{width:`100%`,height:6,background:`#e2e8f0`,borderRadius:50,overflow:`hidden`,position:`relative`},children:(0,$.jsx)(`div`,{style:{width:`${i}%`,height:`100%`,background:r<50?`linear-gradient(90deg, #279951, #b7fad0)`:r<85?`linear-gradient(90deg, #ffd759, #fff6d4)`:`linear-gradient(90deg, #ef4444, #dc2626)`,borderRadius:2,transition:`width 0.4s ease`}})})]})]})},S7={HomeOutlined:(0,$.jsx)(j3,{}),DashboardOutlined:(0,$.jsx)(K4,{}),CodeOutlined:(0,$.jsx)(O4,{}),PlayCircleOutlined:(0,$.jsx)(Y6,{}),WalletOutlined:(0,$.jsx)(a5,{}),SettingOutlined:(0,$.jsx)(T8,{}),BellOutlined:(0,$.jsx)(U2,{}),UserOutlined:(0,$.jsx)(t5,{}),AppstoreOutlined:(0,$.jsx)(g2,{}),FileTextOutlined:(0,$.jsx)(pH,{}),StarOutlined:(0,$.jsx)(B8,{}),HeartOutlined:(0,$.jsx)(S3,{}),CameraOutlined:(0,$.jsx)(i4,{}),RobotOutlined:(0,$.jsx)(u8,{}),CalculatorOutlined:(0,$.jsx)(t4,{}),DollarOutlined:(0,$.jsx)(Q4,{}),GiftOutlined:(0,$.jsx)(g3,{}),ThunderboltOutlined:(0,$.jsx)(K8,{}),FireOutlined:(0,$.jsx)(u3,{}),CloudOutlined:(0,$.jsx)(y4,{}),SmileOutlined:(0,$.jsx)(F8,{}),TrophyOutlined:(0,$.jsx)(Y8,{}),RocketOutlined:(0,$.jsx)(p8,{}),BulbOutlined:(0,$.jsx)(Q2,{}),PictureOutlined:(0,$.jsx)(B6,{}),VideoCameraOutlined:(0,$.jsx)(r5,{}),AudioOutlined:(0,$.jsx)(j2,{}),MailOutlined:(0,$.jsx)(s6,{}),PhoneOutlined:(0,$.jsx)(L6,{}),GlobalOutlined:(0,$.jsx)(y3,{}),ShoppingCartOutlined:(0,$.jsx)(O8,{}),TeamOutlined:(0,$.jsx)(W8,{}),BarChartOutlined:(0,$.jsx)(B2,{}),PieChartOutlined:(0,$.jsx)(U6,{}),LineChartOutlined:(0,$.jsx)(Y3,{}),SecurityScanOutlined:(0,$.jsx)(S8,{}),ApiOutlined:(0,$.jsx)(p2,{}),DatabaseOutlined:(0,$.jsx)(Y4,{}),CloudServerOutlined:(0,$.jsx)(S4,{})},$ae=240,C7=[{gradient:`linear-gradient(135deg, #c9a96e, #a67c52)`,shadow:`rgba(201,169,110,0.25)`,icon:(0,$.jsx)(Nq,{})},{gradient:`linear-gradient(135deg, #4a5568, #2d3748)`,shadow:`rgba(74,85,104,0.25)`,icon:(0,$.jsx)(s3,{})},{gradient:`linear-gradient(135deg, #718096, #4a5568)`,shadow:`rgba(113,128,150,0.25)`,icon:(0,$.jsx)(B4,{})},{gradient:`linear-gradient(135deg, #5a67d8, #434190)`,shadow:`rgba(90,103,216,0.25)`,icon:(0,$.jsx)(P2,{})}],eoe=()=>{let e=Ye(),t=Ke(),{user:n,logout:r,refreshUser:i}=y7(),[a,o]=(0,S.useState)(!1),[s,c]=(0,S.useState)(!1),[l,u]=(0,S.useState)(!1),[d]=nU.useForm(),[f]=nU.useForm(),[p,m]=(0,S.useState)(null),[h,g]=(0,S.useState)([]),[_,v]=(0,S.useState)([]),[y,b]=(0,S.useState)(0),[x,C]=(0,S.useState)(!1),[w,T]=(0,S.useState)(!1),[E]=nU.useForm(),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)(()=>({x:24,y:window.innerHeight*.75})),[j,M]=(0,S.useState)(!1),N=(0,S.useRef)(!1),P=(0,S.useRef)({x:0,y:0}),[F,I]=(0,S.useState)({}),[L,R]=(0,S.useState)(()=>{let e=localStorage.getItem(`siteInfo`),t=e&&JSON.parse(e).siteName||``;return t&&(document.title=t),t}),[z,B]=(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}),[V,H]=(0,S.useState)(!localStorage.getItem(`siteInfo`)),[U,W]=(0,S.useState)(!1),[ee,te]=(0,S.useState)(null),[ne,re]=(0,S.useState)(`alipay`),[G,ie]=(0,S.useState)(!1),[K,ae]=(0,S.useState)(180),q=(0,S.useRef)(null),oe=(0,S.useRef)(null),se=(0,S.useRef)(null),[ce,le]=(0,S.useState)({alipay:!1,wechat:!1}),[ue,de]=(0,S.useState)(null),[fe,pe]=(0,S.useState)(!1),[me,he]=(0,S.useState)(``),ge=`pending_payment_order`;(0,S.useEffect)(()=>{N5().then(e=>{let t=e.siteName||`民众智创`,n=e.siteLogo||``;if(t!==L&&(R(t),document.title=t),n&&n!==z){B(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`}e.operationManual&&he(e.operationManual),localStorage.setItem(`siteInfo`,JSON.stringify({siteName:t,siteLogo:n}))}).catch(()=>{}),w5().then(e=>{let t=e?.resourceCapacity;t&&de({enabled:!!t.enabled,usedBytes:Number(t.usedBytes)||0,totalBytes:Number(t.totalBytes)||0,availableBytes:Number(t.availableBytes)||0,usagePercent:Number(t.usagePercent)||0,exceeded:!!t.exceeded,limitValue:t.limitValue??``,limitUnit:t.limitUnit||`GB`})}).catch(e=>{})},[]),(0,S.useEffect)(()=>{let e=()=>pe(window.innerWidth<=767);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let _e=e=>{e.button===0&&(M(!0),N.current=!1,P.current={x:e.clientX,y:e.clientY})},ve=e=>{if(!j)return;let t=Math.abs(e.clientX-P.current.x),n=Math.abs(e.clientY-P.current.y);(t>5||n>5)&&(N.current=!0);let r=Math.max(60,Math.min(window.innerHeight-60,e.clientY-(P.current.y-k.y)));A(e=>({x:e.x,y:r}))},ye=()=>{let e=N.current;M(!1),N.current=!1,e||u(!0)};(0,S.useEffect)(()=>{if(j)return document.addEventListener(`mousemove`,ve),document.addEventListener(`mouseup`,ye),()=>{document.removeEventListener(`mousemove`,ve),document.removeEventListener(`mouseup`,ye)}},[j]);let be=()=>{I5().then(e=>{b(e)}).catch(()=>{})};(0,S.useEffect)(()=>{(async()=>{let e=localStorage.getItem(ge);if(e)try{let t=JSON.parse(e),n=await z5(t.orderNo);if(n.status===`pending`){te({price:t.price,credits:t.credits,qrCode:t.qrCode,method:t.method}),se.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?(W(!0),Ne(t.orderNo,a)):localStorage.removeItem(ge)}else n.status===`paid`?(Z.success(`支付成功!积分已到账`),y7.getState().refreshUser(),localStorage.removeItem(ge)):localStorage.removeItem(ge)}catch{localStorage.removeItem(ge)}})()},[]),(0,S.useEffect)(()=>{Fie().then(e=>{g(e.filter(e=>e.is_active!==!1&&e.isActive!==!1))}).catch(()=>{}),Iie().then(e=>{v(e.filter(e=>e.is_active!==!1&&e.isActive!==!1))}).catch(()=>{}),Lie().then(e=>{le(e),e.alipay?re(`alipay`):e.wechat&&re(`wechat`)}).catch(()=>{}),be()},[n]);let xe=t.pathname.startsWith(`/records`)?`/records`:t.pathname,Se=$ae,Ce={};h.forEach(e=>{let t=e.parent_id??e.parentId;t&&(Ce[t]||(Ce[t]=[]),Ce[t].push(e))});let we=h.filter(e=>!(e.parent_id??e.parentId));we.sort((e,t)=>(typeof e.sortOrder==`number`?e.sortOrder:1/0)-(typeof t.sortOrder==`number`?t.sortOrder:1/0)),Object.keys(Ce).forEach(e=>{Ce[e].sort((e,t)=>(typeof e.sortOrder==`number`?e.sortOrder:1/0)-(typeof t.sortOrder==`number`?t.sortOrder:1/0))});let Te=t=>{let n=t.menu_type??t.menuType,r=Ce[t.id]&&Ce[t.id].length>0;n===`group`||r?I(e=>({...e,[t.id]:!e[t.id]})):t.path&&(e(t.path),C(!1))},Ee=[{key:`profile`,icon:(0,$.jsx)(t5,{}),label:`账号: ${n?.username}`,disabled:!0},{key:`credits`,icon:(0,$.jsx)(a5,{style:{color:`#c9a96e`}}),label:`积分: ${n?.credits??0}`,disabled:!0},{type:`divider`},...n?.isTeamManager?[{key:`teamManagement`,icon:(0,$.jsx)(W8,{style:{color:`#6366f1`}}),label:`团队管理`}]:[],{key:`myCredits`,icon:(0,$.jsx)(a5,{}),label:`积分明细`},{key:`orderRecords`,icon:(0,$.jsx)(pH,{}),label:`订单记录`},{key:`messages`,icon:(0,$.jsx)(U2,{}),label:`消息中心${y>0?`(${y})`:``}`},...me?[{key:`manual`,icon:(0,$.jsx)(pH,{}),label:`操作手册`}]:[],{type:`divider`},{key:`changePwd`,icon:(0,$.jsx)(Q3,{}),label:`个人信息`},{type:`divider`},{key:`logout`,icon:(0,$.jsx)(i6,{}),label:`退出登录`,danger:!0}],De=({key:t})=>{t===`logout`?(r(),e(`/login`)):t===`changePwd`?o(!0):t===`messages`?e(`/messages`):t===`recharge`?c(!0):t===`teamManagement`?e(`/team-management`):t===`myCredits`?e(`/user-center?tab=credits`):t===`orderRecords`?e(`/user-center?tab=orders`):t===`manual`&&window.open(me,`_blank`)},Oe=async()=>{try{let e=await d.validateFields();await T5(e.oldPwd,e.newPwd),Z.success(`密码修改成功`),o(!1),d.resetFields()}catch(e){e?.response?.data?.detail?Z.error(e.response.data.detail):e?.message&&Z.error(e.message)}},ke=async()=>{try{let e=await _ie((await f.validateFields()).username);Z.success(e.message||`操作成功`),await i(),w5().then(e=>{let t=e?.resourceCapacity;t&&de({enabled:!!t.enabled,usedBytes:Number(t.usedBytes)||0,totalBytes:Number(t.totalBytes)||0,availableBytes:Number(t.availableBytes)||0,usagePercent:Number(t.usagePercent)||0,exceeded:!!t.exceeded,limitValue:t.limitValue??``,limitUnit:t.limitUnit||`GB`})}).catch(()=>{}),o(!1),f.resetFields()}catch(e){e?.response?.data?.message?Z.error(e.response.data.message):e?.response?.data?.detail?Z.error(e.response.data.detail):e?.message&&Z.error(e.message)}},Ae=()=>{r(),e(`/login`)},je=async()=>{if(!n){Z.warning(`请先登录`);return}try{let e=await E.validateFields();O(!0),await vae({phone:e.phone,company_name:e.companyName,industry:e.industry,name:e.name,message:e.message}),Z.success(`提交成功,我们会尽快与您联系`),u(!1),E.resetFields()}catch(e){Z.error(e?.message||`提交失败`)}finally{O(!1)}},Me=(0,S.useCallback)(()=>{q.current&&=(clearInterval(q.current),null),oe.current&&=(clearInterval(oe.current),null)},[]),Ne=(0,S.useCallback)((e,t=180)=>{Me(),ae(t),q.current=setInterval(async()=>{try{let t=await z5(e);t.status===`paid`?(Me(),se.current=null,localStorage.removeItem(ge),Z.success(`支付成功!积分已到账`),y7.getState().refreshUser(),W(!1),te(null),m(null)):t.status===`cancelled`&&(Me(),se.current=null,localStorage.removeItem(ge))}catch{}},2e3),oe.current=setInterval(()=>{ae(e=>e<=1?(Me(),se.current&&=(B5(se.current).catch(()=>{}),null),localStorage.removeItem(ge),Z.warning(`订单已超时,请重新充值`),W(!1),te(null),m(null),0):e-1)},1e3)},[Me]),Pe=(t,n=0)=>{let r=t.path===xe,i=S7[t.icon]||(0,$.jsx)(j3,{}),a=Ce[t.id]&&Ce[t.id].length>0,o=(t.menu_type??t.menuType)===`group`;return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{onClick:()=>{!(o||a)&&t.path&&e(t.path)},style:{display:`flex`,alignItems:`center`,justifyContent:`flex-start`,gap:10,padding:n>0?`6px 12px 6px 32px`:`6px 14px`,borderRadius:12,margin:`1px 4px`,cursor:o||a?`default`:`pointer`,fontSize:n>0?13:14,fontWeight:r?600:400,color:r?`#4f46e5`:o?`#94a3b8`:`#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`},onMouseEnter:e=>{!o&&!r&&!(o||a)&&(e.currentTarget.style.background=`rgba(99, 102, 241, 0.05)`)},onMouseLeave:e=>{r||(e.currentTarget.style.background=`transparent`)},children:[!o&&(0,$.jsx)(`span`,{style:{fontSize:n>0?14:16,flexShrink:0,color:r?`#6366f1`:`#64748b`},children:i}),(0,$.jsx)(`span`,{style:{whiteSpace:`nowrap`,flex:1,textAlign:`left`,fontWeight:o||r?600:400,fontSize:o?12:n>0?13:14,textTransform:o?`uppercase`:`none`,letterSpacing:o?.5:0},children:t.label})]}),(o||a)&&(0,$.jsx)(`div`,{style:{overflow:`hidden`},children:(Ce[t.id]||[]).map(e=>Pe(e,n+1))})]},t.id)};return(0,$.jsxs)(KW,{style:{minHeight:`100vh`},children:[(0,$.jsxs)(`div`,{className:`desktop-sidebar`,style:{width:Se,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,cursor:`pointer`},onClick:()=>{e(`/home`)},children:[(0,$.jsx)(`div`,{style:{width:42,height:42,borderRadius:14,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 4px 16px rgba(99, 102, 241, 0.35)`,overflow:`hidden`},children:z?(0,$.jsx)(`img`,{src:z,alt:`logo`,style:{width:28,height:28,objectFit:`contain`}}):(0,$.jsx)(K8,{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:L})]})}),(0,$.jsx)(`div`,{style:{flex:1,padding:`8px 8px`,overflow:`auto`},children:we.map(e=>Pe(e))}),(0,$.jsxs)(`div`,{onClick:()=>c(!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)(rL,{style:{fontSize:16}}),(0,$.jsx)(`span`,{children:`充值积分`})]}),(0,$.jsx)(x7,{data:ue}),(0,$.jsx)(`div`,{style:{padding:`16px 16px`,flexShrink:0,paddingTop:0},children:(0,$.jsx)(uH,{menu:{items:Ee,onClick:De},placement:`topRight`,arrow:!0,children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`flex-start`,gap:12,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)(Dw,{size:36,icon:(0,$.jsx)(t5,{}),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:16,fontWeight:600,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,letterSpacing:-.01},children:n?.username}),(0,$.jsxs)(`div`,{style:{color:`#6366f1`,fontSize:16,fontWeight:500,letterSpacing:0,borderRadius:6,display:`inline-block`},children:[`积分: `,n?.credits||0]})]})]})})})]}),(0,$.jsx)(`div`,{className:`desktop-content`,style:{marginLeft:Se+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:!fe&&(0,$.jsx)(wt,{})})}),(0,$.jsx)(`div`,{className:`mobile-header`,children:(0,$.jsxs)(`div`,{className:`mobile-header-content`,children:[(0,$.jsx)(`div`,{className:`mobile-menu-btn`,onClick:()=>C(!0),children:(0,$.jsx)(p6,{style:{fontSize:20}})}),(0,$.jsx)(`div`,{className:`mobile-header-title`,children:L}),(0,$.jsx)(`div`,{className:`mobile-header-right`,children:(0,$.jsxs)(`div`,{className:`mobile-credits-badge`,onClick:()=>c(!0),children:[(0,$.jsx)(a5,{}),(0,$.jsx)(`span`,{children:n?.credits||0})]})})]})}),(0,$.jsx)(`div`,{className:`mobile-content`,children:fe&&(0,$.jsx)(wt,{})}),(0,$.jsxs)($V,{title:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsx)(`div`,{style:{width:36,height:36,borderRadius:10,flexShrink:0,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.35)`},children:z?(0,$.jsx)(`img`,{src:z,alt:`logo`,style:{width:24,height:24,objectFit:`contain`}}):(0,$.jsx)(K8,{style:{fontSize:18,color:`#ffffff`}})}),(0,$.jsx)(`span`,{style:{fontWeight:700,fontSize:16,color:`#1e293b`},children:L})]}),placement:`left`,onClose:()=>C(!1),open:x,size:280,closable:!0,className:`mobile-menu-drawer`,styles:{header:{borderBottom:`1px solid #f1f5f9`,padding:`16px 20px`},body:{padding:`12px 8px`,display:`flex`,flexDirection:`column`}},children:[(0,$.jsxs)(`div`,{style:{flex:1,overflow:`auto`,paddingBottom:12},children:[(0,$.jsx)(`div`,{style:{padding:`12px 8px 16px`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:16},children:[(0,$.jsx)(Dw,{size:44,style:{background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,flexShrink:0},children:(0,$.jsx)(t5,{})}),(0,$.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,$.jsx)(`div`,{style:{fontSize:15,fontWeight:600,color:`#1e293b`,marginBottom:2},children:n?.username||`用户`}),(0,$.jsxs)(`div`,{style:{fontSize:13,color:`#64748b`},children:[(0,$.jsx)(a5,{style:{color:`#f59e0b`,marginRight:4}}),`积分: `,(0,$.jsx)(`span`,{style:{color:`#f59e0b`,fontWeight:600},children:n?.credits??0})]})]})]})}),(0,$.jsx)(x7,{data:ue}),we.map(e=>{let t=e.menu_type??e.menuType,n=Ce[e.id]&&Ce[e.id].length>0,r=e.path===xe,i=F[e.id],a=S7[e.icon]||(0,$.jsx)(j3,{});return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mobile-menu-item ${r&&!n?`mobile-menu-item-active`:``} ${t===`group`?`mobile-menu-group`:``}`,onClick:()=>Te(e),children:[t!==`group`&&(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:r?`#6366f1`:`#64748b`},children:a}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{paddingLeft:0,color:t===`group`?`#94a3b8`:r?`#4f46e5`:`#475569`,fontWeight:t===`group`||r?600:400,fontSize:t===`group`?12:15,textTransform:t===`group`?`uppercase`:`none`,letterSpacing:t===`group`?.5:0},children:e.label}),(t===`group`||n)&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#cbd5e1`,transition:`transform 0.2s ease`,transform:i?`rotate(90deg)`:`rotate(0deg)`},children:(0,$.jsx)(zg,{})})]}),(t===`group`||n)&&i&&(0,$.jsx)(`div`,{className:`mobile-submenu`,children:(Ce[e.id]||[]).map(e=>{let t=e.path===xe,n=S7[e.icon]||(0,$.jsx)(j3,{});return(0,$.jsxs)(`div`,{className:`mobile-menu-item mobile-submenu-item ${t?`mobile-menu-item-active`:``}`,onClick:()=>Te(e),children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:t?`#6366f1`:`#94a3b8`},children:n}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:t?`#4f46e5`:`#64748b`,fontWeight:t?600:400,fontSize:14},children:e.label})]},e.id)})})]},e.id)})]}),(0,$.jsxs)(`div`,{style:{padding:`8px 0`,borderTop:`1px solid #f1f5f9`},children:[(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{e(`/user-center?tab=credits`),C(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#f59e0b`},children:(0,$.jsx)(a5,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:`积分明细`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{e(`/user-center?tab=orders`),C(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#6366f1`},children:(0,$.jsx)(pH,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:`订单记录`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{e(`/messages`),C(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#8b5cf6`},children:(0,$.jsx)(U2,{})}),(0,$.jsxs)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:[`消息中心`,y>0&&(0,$.jsx)(ZQ,{color:`red`,style:{marginLeft:8,fontSize:11},children:y})]})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{o(!0),C(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#0ea5e9`},children:(0,$.jsx)(Q3,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:`个人信息`})]}),(0,$.jsx)(`div`,{style:{height:8}}),(0,$.jsxs)(`div`,{className:`mobile-menu-item mobile-recharge-item`,onClick:()=>{c(!0),C(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#fff`},children:(0,$.jsx)(rL,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#fff`,fontWeight:600},children:`充值积分`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{Ae(),C(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#ef4444`},children:(0,$.jsx)(i6,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#ef4444`},children:`退出登录`})]})]})]}),(0,$.jsx)(hK,{title:(0,$.jsxs)(cH,{children:[(0,$.jsx)(T8,{}),`账号设置`]}),open:a,onCancel:()=>{o(!1),d.resetFields(),f.resetFields()},width:440,footer:null,children:(0,$.jsxs)(TL,{defaultActiveKey:`profile`,children:[(0,$.jsx)(TL.TabPane,{tab:`个人信息`,children:(0,$.jsxs)(nU,{form:f,layout:`vertical`,style:{marginTop:20},onValuesChange:()=>{},children:[(0,$.jsx)(nU.Item,{name:`username`,label:`用户名`,rules:[{required:!0,message:`请输入用户名`},{min:3,message:`用户名至少3位`}],children:(0,$.jsx)(LW,{placeholder:`请输入用户名`,size:`large`,prefix:(0,$.jsx)(t5,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(nU.Item,{children:(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:ke,style:{width:`100%`},children:`确认修改`})})]})},`profile`),(0,$.jsx)(TL.TabPane,{tab:`修改密码`,children:(0,$.jsxs)(nU,{form:d,layout:`vertical`,style:{marginTop:20},onValuesChange:()=>{},children:[(0,$.jsx)(nU.Item,{name:`oldPwd`,label:`原密码`,rules:[{required:!0,message:`请输入原密码`}],children:(0,$.jsx)(LW.Password,{placeholder:`请输入原密码`,size:`large`,prefix:(0,$.jsx)(Q3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(nU.Item,{name:`newPwd`,label:`新密码`,rules:[{required:!0,message:`请输入新密码`},{min:6,message:`密码至少6位`}],children:(0,$.jsx)(LW.Password,{placeholder:`请输入新密码(至少6位)`,size:`large`,prefix:(0,$.jsx)(Q3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(nU.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)(LW.Password,{placeholder:`请再次输入新密码`,size:`large`,prefix:(0,$.jsx)(Q3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(nU.Item,{children:(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:Oe,style:{width:`100%`},children:`确认修改`})})]})},`password`)]})}),(0,$.jsx)(hK,{title:(0,$.jsxs)(cH,{children:[(0,$.jsx)(g3,{}),`积分充值`]}),open:s,onCancel:()=>{c(!1),m(null)},width:680,className:`recharge-modal`,footer:(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,padding:`12px 0 0`,borderTop:`1px solid #f0f0f0`},children:[(0,$.jsx)(X,{size:`large`,onClick:()=>{c(!1),m(null)},style:{borderRadius:10,marginRight:12},children:`取消`}),(0,$.jsx)(X,{type:`primary`,size:`large`,disabled:!p||!ce.alipay&&!ce.wechat,loading:G,onClick:async()=>{let e=_.find(e=>e.id===p);if(!e)return;let t=(e.credits||0)+(e.bonus_credits||e.bonusCredits||0);try{ie(!0);let n=await Rie(e.id,ne),r=n.qrUrl||n.codeUrl||n.qr_code||n.code_url;(n.paymentMethod===`alipay`||n.paymentMethod===`wechat`)&&r?(te({price:e.price,credits:t,qrCode:r,method:n.paymentMethod}),c(!1),W(!0),se.current=n.orderNo,localStorage.setItem(ge,JSON.stringify({orderNo:n.orderNo,price:e.price,credits:t,qrCode:r,method:n.paymentMethod,createdAt:n.createdAt||new Date().toISOString(),timeoutSeconds:180})),Ne(n.orderNo)):(Z.success(`充值成功!积分已到账`),y7.getState().refreshUser(),c(!1),m(null))}catch(e){Z.error(e?.message||`创建订单失败,请重试`)}finally{ie(!1)}},style:{borderRadius:10,fontWeight:600,background:p?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#d1d5db`,border:`none`,boxShadow:p?`0 8px 24px rgba(99,102,241,0.3)`:`none`},children:`确认充值`})]}),children:(0,$.jsxs)(`div`,{style:{marginTop:16},children:[(0,$.jsxs)(cH,{style:{marginBottom:16},children:[(0,$.jsx)(a5,{style:{color:`#6366f1`}}),(0,$.jsx)(Q.Text,{style:{color:`#64748b`,letterSpacing:0},children:`当前积分余额`}),(0,$.jsx)(Q.Text,{strong:!0,style:{color:`#6366f1`,fontSize:20,fontWeight:600},children:n?.credits??0})]}),!ce.alipay&&!ce.wechat?(0,$.jsx)(`div`,{style:{marginBottom:16,padding:16,background:`#fef2f2`,borderRadius:12,border:`1px solid #fecaca`},children:(0,$.jsx)(Q.Text,{style:{color:`#dc2626`,fontSize:13},children:`⚠️ 暂无可用的支付方式,请联系管理员开启支付功能`})}):(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(Q.Text,{style:{color:`#64748b`,fontSize:13,marginBottom:8,display:`block`},children:`选择支付方式`}),(0,$.jsxs)(jI.Group,{value:ne,onChange:e=>re(e.target.value),style:{display:`flex`,gap:12},children:[ce.alipay&&(0,$.jsxs)(jI.Button,{value:`alipay`,style:{flex:1,textAlign:`center`,borderRadius:10,height:44,lineHeight:`42px`,borderColor:ne===`alipay`?`#1677ff`:void 0,color:ne===`alipay`?`#1677ff`:void 0},children:[(0,$.jsx)(u2,{style:{fontSize:16,marginRight:6}}),`支付宝`]}),ce.wechat&&(0,$.jsxs)(jI.Button,{value:`wechat`,style:{flex:1,textAlign:`center`,borderRadius:10,height:44,lineHeight:`42px`,borderColor:ne===`wechat`?`#07c160`:void 0,color:ne===`wechat`?`#07c160`:void 0},children:[(0,$.jsx)(c5,{style:{fontSize:16,marginRight:6}}),`微信支付`]})]})]}),(0,$.jsxs)(`div`,{style:{padding:`12px 16px`,background:`rgba(99, 102, 241, 0.06)`,borderRadius:10,marginBottom:16,display:`flex`,alignItems:`center`,gap:8},children:[(0,$.jsx)(L3,{style:{color:`#6366f1`,fontSize:14}}),(0,$.jsxs)(Q.Text,{style:{color:`#64748b`,fontSize:13},children:[`当前平台仅支持支付宝/微信扫码充值,如需转账支付请`,(0,$.jsx)(Q.Text,{style:{color:`#ff0000ff`,cursor:`pointer`,textDecoration:`underline`},onClick:()=>{c(!1),u(!0)},children:`联系我们`})]})]}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:12,flexWrap:`wrap`},children:_.map((e,t)=>{let n=C7[t%C7.length],r=(e.credits||0)+(e.bonus_credits||e.bonusCredits||0);return(0,$.jsxs)(`div`,{onClick:()=>m(e.id),style:{flex:`1 1 45%`,minWidth:200,borderRadius:16,padding:`20px 16px`,background:p===e.id?`rgba(99,102,241,0.04)`:`#fafbff`,border:p===e.id?`2px solid #6366f1`:`1px solid #f0f0f5`,cursor:`pointer`,position:`relative`,transition:`all 0.2s`},children:[e.description&&(0,$.jsx)(ZQ,{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)(Q.Text,{strong:!0,style:{fontSize:15},children:e.name}),(0,$.jsxs)(Q.Text,{style:{fontSize:14,fontWeight:600,color:`#6366f1`},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)})})]})}),(0,$.jsx)(hK,{open:U,onCancel:async()=>{if(Me(),se.current){try{await B5(se.current)}catch{}se.current=null}localStorage.removeItem(ge),W(!1),te(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:ee?.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:ee?.method===`alipay`?(0,$.jsx)(u2,{style:{fontSize:24,color:`#fff`}}):(0,$.jsx)(c5,{style:{fontSize:24,color:`#fff`}})}),(0,$.jsx)(Q.Title,{level:4,style:{margin:0},children:ee?.method===`alipay`?`支付宝支付`:`微信支付`}),(0,$.jsx)(Q.Text,{style:{color:`#94a3b8`,fontSize:13},children:ee?.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:ee&&(0,$.jsx)(s2,{value:ee.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:[`¥`,ee?.price||0]}),(0,$.jsxs)(`div`,{style:{fontSize:13,color:`#64748b`,marginTop:4},children:[`购买 `,ee?.credits||0,` 积分`]}),(0,$.jsx)(`div`,{style:{marginTop:12,padding:`8px 16px`,background:K<=30?`#fef2f2`:`#f0f9ff`,borderRadius:8,border:K<=30?`1px solid #fecaca`:`1px solid #bae6fd`,display:`inline-block`},children:(0,$.jsxs)(`span`,{style:{fontSize:14,fontWeight:600,color:K<=30?`#dc2626`:`#0284c7`},children:[`订单将在 `,(0,$.jsx)(`span`,{style:{fontSize:16,fontWeight:800},children:K}),` 秒后关闭`]})})]})]}),(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)(X,{size:`large`,block:!0,onClick:async()=>{if(Me(),se.current){try{await B5(se.current)}catch{}se.current=null}localStorage.removeItem(ge),W(!1),te(null),m(null)},style:{borderRadius:10},children:`取消支付`})})]})}),(0,$.jsx)(Qae,{}),(0,$.jsx)(`div`,{className:`contact-button-wrapper`,style:{right:`${k.x}px`,bottom:`${window.innerHeight-k.y}px`},children:(0,$.jsxs)(`div`,{style:{position:`relative`},children:[(0,$.jsx)(`div`,{className:`contact-tooltip`,style:{opacity:+!!w},children:`联系我们`}),(0,$.jsx)(`button`,{className:`contact-button ${j?`dragging`:``}`,onMouseEnter:()=>T(!0),onMouseLeave:()=>T(!1),onMouseDown:_e,onMouseUp:ye,children:(0,$.jsx)(g6,{style:{fontSize:20}})})]})}),(0,$.jsx)(hK,{title:(0,$.jsxs)(cH,{children:[(0,$.jsx)(g6,{}),`联系我们`]}),open:l,onCancel:()=>{u(!1),E.resetFields()},footer:null,width:480,className:`contact-modal`,children:(0,$.jsxs)(`div`,{style:{marginTop:8},children:[(0,$.jsxs)(nU,{form:E,layout:`vertical`,children:[(0,$.jsx)(nU.Item,{name:`name`,label:`姓名`,rules:[{required:!0,message:`请输入姓名`}],children:(0,$.jsx)(LW,{placeholder:`请输入您的姓名`,size:`large`})}),(0,$.jsx)(nU.Item,{name:`phone`,label:`手机号`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1[3-9]\d{9}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(LW,{placeholder:`请输入您的手机号`,size:`large`})}),(0,$.jsx)(nU.Item,{name:`companyName`,label:`公司名称`,rules:[{required:!0,message:`请输入公司名称`}],children:(0,$.jsx)(LW,{placeholder:`请输入公司名称`,size:`large`})}),(0,$.jsx)(nU.Item,{name:`industry`,label:`您的行业`,rules:[{required:!0,message:`请输入您的行业`}],children:(0,$.jsx)(LW,{placeholder:`请输入您的行业`,size:`large`})}),(0,$.jsx)(nU.Item,{name:`message`,label:`留言(选填)`,children:(0,$.jsx)(LW.TextArea,{placeholder:`请输入您的需求或问题`,rows:3,style:{borderRadius:10}})})]}),(0,$.jsxs)(`div`,{style:{marginTop:16,display:`flex`,gap:12},children:[(0,$.jsx)(X,{size:`large`,onClick:()=>{u(!1),E.resetFields()},style:{borderRadius:10,flex:1},children:`取消`}),(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:je,loading:D,style:{borderRadius:10,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,flex:1},children:`提交`})]})]})})]})},toe=`http://localhost:8000/api`,noe=()=>{let{checkAuth:e}=y7(),[t,n]=(0,S.useState)(!1),[r,i]=(0,S.useState)(`password`),[a,o]=(0,S.useState)(`password`),[s]=On(),c=s.get(`redirect`),l=s.get(`tab`),[u,d]=(0,S.useState)(0),[f,p]=(0,S.useState)(0),[m,h]=(0,S.useState)(!1),[g,_]=(0,S.useState)(!1),[v,y]=(0,S.useState)(!1),[b,x]=(0,S.useState)(!1),[C,w]=(0,S.useState)(0),[T,E]=(0,S.useState)(!1),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)(!1),j=(()=>{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:``}})(),[M,N]=(0,S.useState)(j.siteName),[P,F]=(0,S.useState)(j.siteLogo),[I,L]=(0,S.useState)(``),[R,z]=(0,S.useState)(``),B=Ye(),{login:V}=y7(),[H]=nU.useForm(),[U]=nU.useForm(),[W]=nU.useForm();(0,S.useEffect)(()=>{N5().then(e=>{N(e.siteName),F(e.siteLogo),L(e.userAgreementPrivacyUrl),z(e.siteCopyright)}).catch(()=>{})},[]),(0,S.useEffect)(()=>{l===`register`&&i(`register`)},[l]);let ee=()=>{if(c)try{B(decodeURIComponent(c));return}catch{}B(`/home`)},te=()=>m?!0:(Z.warning(`请先阅读并同意用户协议及隐私政策`),!1),ne=async()=>{if(te())try{let t=await H.validateFields();await V(t.phone,t.password,void 0,t.rememberMe),Z.success(`登录成功,欢迎回来`),await e(),ee()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t)}},re=async()=>{if(te())try{let t=U.getFieldsValue();if(!t.phone||!t.code){Z.error(`请填写手机号和验证码`);return}n(!0),await mie(t.phone,t.code),Z.success(`登录成功,欢迎回来`),await e(),ee()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t)}finally{n(!1)}},G=async()=>{if(te())try{let t=await W.validateFields();n(!0),await hie(t.phone,t.regCode,t.password),Z.success(`注册成功`),await e(),ee()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`注册失败`;Z.error(t)}finally{n(!1)}},ie=(e,t)=>{e(60);let n=setInterval(()=>{e(e=>e<=1?(clearInterval(n),_(!1),t?O(!0):A(!0),0):e-1)},1e3)};(0,S.useEffect)(()=>{u===0&&r===`phone`&&x(!1)},[u,r]);let K=async(e,t)=>{try{if(!e||!/^1\d{10}$/.test(e)){Z.error(`请输入正确的手机号`);return}if(t){_(!0),y(!1);return}if(!b){_(!0),x(!1);return}let n=``;n=r===`register`?`register`:`login`,await P5(e,n),ie(t?p:d),Z.success(`验证码已发送`)}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t),r===`register`?(y(!1),p(0)):(x(!1),d(0)),w(e=>e+1)}},ae=async(e=!1)=>{let t=r===`register`?W.getFieldValue(`phone`):U.getFieldValue(`phone`);try{let e=``;e=r===`register`?`register`:`login`,await P5(t,e),r===`register`?(y(!0),ie(p,!0)):(x(!0),ie(d,!1)),Z.success(`验证码已发送`)}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t),r===`register`?(y(!1),p(0),O(!0)):(x(!1),d(0),A(!0)),w(e=>e+1)}},q=e=>{o(e),i(e),d(0),p(0),x(!1),y(!1),_(!1),O(!1),A(!1),w(e=>e+1),e===`password`?H.resetFields():U.resetFields()},oe=[{icon:(0,$.jsx)(Q2,{}),title:`AI 智能优化`,desc:`输入原始提示词,AI 自动为您生成专业级视频、图片描述`},{icon:(0,$.jsx)(Y6,{}),title:`一键生成视频、图片`,desc:`支持多种规格生成视频、图片`},{icon:(0,$.jsx)(O3,{}),title:`项目维度管理`,desc:`按项目行业分类视频、图片,支持多种行业`}],se={background:`#fff`,border:`1.5px solid #e2e8f0`,color:`#1e293b`,borderRadius:10,fontSize:14},ce=e=>{if(!e){Z.warning(`暂未上传协议文件`);return}e.startsWith(`http://`)||e.startsWith(`https://`)?window.open(e,`_blank`):window.open(`${toe.replace(/\/api$/,``)}${e}`,`_blank`)};return(0,$.jsxs)(`div`,{className:`login-page`,children:[(0,$.jsx)(`div`,{className:`login-bg-overlay`}),(0,$.jsx)(`div`,{className:`login-decoration login-decoration-1`}),(0,$.jsx)(`div`,{className:`login-decoration login-decoration-2`}),(0,$.jsx)(`div`,{className:`login-left-section`,children:(0,$.jsxs)(cH,{direction:`vertical`,size:36,className:`login-left-content`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`login-logo-row`,children:[P?(0,$.jsx)(`img`,{src:P,alt:`logo`,className:`login-logo-img`}):(0,$.jsx)(`div`,{className:`login-logo-placeholder`,children:(0,$.jsx)(K8,{style:{fontSize:26,color:`#fff`}})}),(0,$.jsx)(`span`,{className:`login-site-name`,children:M})]}),(0,$.jsx)(`div`,{className:`shiny-text-container`,children:(0,$.jsx)(`span`,{className:`shiny-text`,children:`AI赋能创意,素材触手可及`})}),(0,$.jsxs)(Q.Paragraph,{className:`login-desc`,children:[`专业的 AI 素材生成平台,通过智能提示词优化,`,(0,$.jsx)(`br`,{}),`让您的创意快速转化为精美视频、图片`]})]}),(0,$.jsx)(`div`,{className:`login-features-list`,children:oe.map((e,t)=>(0,$.jsxs)(`div`,{className:`electric-border-card login-feature-card`,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`,{className:`login-feature-icon`,children:e.icon})}),(0,$.jsxs)(`div`,{style:{position:`relative`,zIndex:1},children:[(0,$.jsx)(Q.Text,{className:`login-feature-title`,children:e.title}),(0,$.jsx)(Q.Text,{className:`login-feature-desc`,children:e.desc})]})]},t))})]})}),(0,$.jsxs)(`div`,{className:`login-right-section`,children:[(0,$.jsx)(`div`,{className:`login-right-section-inner`,children:(0,$.jsxs)(DL,{className:`login-card`,styles:{body:{padding:`36px 28px`}},children:[(0,$.jsx)(Q.Title,{level:3,className:`login-card-title`,children:r===`register`?`创建账号`:`欢迎回来`}),(0,$.jsx)(Q.Text,{className:`login-card-subtitle`,children:r===`register`?`注册新账号,开始创作视频`:`登录您的账号,开始创作视频`}),r!==`register`&&(0,$.jsx)(`div`,{className:`login-tabs`,children:[`password`,`phone`].map(e=>(0,$.jsx)(`div`,{onClick:()=>q(e),className:`login-tab ${a===e?`login-tab-active`:``}`,children:e===`password`?`密码登录`:`验证码登录`},e))}),r===`password`&&(0,$.jsxs)(nU,{form:H,size:`large`,layout:`vertical`,onFinish:ne,children:[(0,$.jsx)(nU.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(LW,{prefix:(0,$.jsx)(y6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,style:se})}),(0,$.jsx)(nU.Item,{name:`password`,rules:[{required:!0,message:`请输入密码`}],children:(0,$.jsx)(LW.Password,{prefix:(0,$.jsx)(Q3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入密码`,style:se})}),(0,$.jsx)(nU.Item,{name:`rememberMe`,valuePropName:`checked`,style:{marginBottom:12},children:(0,$.jsx)(HR,{children:`记住我的登录状态`})}),(0,$.jsx)(nU.Item,{style:{marginBottom:12},children:(0,$.jsx)(X,{type:`primary`,htmlType:`submit`,loading:t,block:!0,className:`login-submit-btn`,children:`登 录`})})]}),r===`phone`&&(0,$.jsxs)(nU,{form:U,size:`large`,layout:`vertical`,children:[(0,$.jsx)(nU.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(LW,{prefix:(0,$.jsx)(y6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,maxLength:11,style:se})}),(0,$.jsx)(nU.Item,{name:`code`,rules:[{required:!0,message:`请输入验证码`}],children:(0,$.jsxs)(cH.Compact,{style:{width:`100%`},children:[(0,$.jsx)(LW,{prefix:(0,$.jsx)(g8,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入验证码`,maxLength:6,disabled:!b,style:{...se,borderRadius:`10px 0 0 10px`,flex:1}}),(0,$.jsx)(X,{disabled:u>0,onClick:()=>{k?(x(!1),_(!0),w(e=>e+1)):g&&!b?(E(!0),setTimeout(()=>E(!1),500)):K(U.getFieldValue(`phone`))},className:`login-code-btn`,children:u>0?`${u}s`:k?`重新发送`:`获取验证码`})]})}),g&&(0,$.jsx)(nU.Item,{style:{marginBottom:12},children:(0,$.jsx)(w7,{onSuccess:ae,isVerified:b,shake:T})},C),(0,$.jsx)(nU.Item,{style:{marginBottom:12},children:(0,$.jsx)(X,{type:`primary`,onClick:re,loading:t,block:!0,className:`login-submit-btn`,children:`登 录`})})]}),r===`register`&&(0,$.jsxs)(nU,{form:W,size:`large`,layout:`vertical`,children:[(0,$.jsx)(nU.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(LW,{prefix:(0,$.jsx)(y6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,maxLength:11,style:se})}),(0,$.jsx)(nU.Item,{name:`regCode`,rules:[{required:!0,message:`请输入验证码`}],children:(0,$.jsxs)(cH.Compact,{style:{width:`100%`},children:[(0,$.jsx)(LW,{prefix:(0,$.jsx)(g8,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入验证码`,maxLength:6,disabled:!v,style:{...se,borderRadius:`10px 0 0 10px`,flex:1}}),(0,$.jsx)(X,{disabled:f>0,onClick:()=>{D?(y(!1),_(!0),w(e=>e+1)):g&&!v?(E(!0),setTimeout(()=>E(!1),500)):K(W.getFieldValue(`phone`),!0)},className:`login-code-btn`,children:f>0?`${f}s`:D?`重新发送`:`获取验证码`})]})}),g&&(0,$.jsx)(nU.Item,{style:{marginBottom:12},children:(0,$.jsx)(w7,{onSuccess:ae,isVerified:v,shake:T})},C),(0,$.jsx)(nU.Item,{name:`password`,rules:[{required:!0,message:`请设置密码`},{min:6,message:`密码至少6位`}],children:(0,$.jsx)(LW.Password,{prefix:(0,$.jsx)(Q3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请设置密码(至少6位)`,style:se})}),(0,$.jsx)(nU.Item,{style:{marginBottom:12},children:(0,$.jsx)(X,{type:`primary`,onClick:G,loading:t,block:!0,className:`login-submit-btn`,children:`注 册`})})]}),(0,$.jsx)(`div`,{className:`login-agreement`,children:(0,$.jsx)(HR,{checked:m,onChange:e=>h(e.target.checked),children:(0,$.jsxs)(`span`,{className:`login-agreement-text`,children:[`我已阅读并同意`,(0,$.jsx)(`span`,{onClick:e=>{e.stopPropagation(),ce(I)},className:`login-link`,children:`《用户协议及隐私政策》`})]})})}),(0,$.jsx)(`div`,{className:`login-footer`,children:r===`register`?(0,$.jsx)(Q.Text,{className:`login-switch-btn`,onClick:()=>{i(`password`),o(`password`),O(!1),A(!1),y(!1),_(!1),w(e=>e+1),W.resetFields()},children:`已有账号?去登录`}):(0,$.jsx)(Q.Text,{className:`login-switch-btn`,onClick:()=>{i(`register`),O(!1),A(!1),y(!1),_(!1),w(e=>e+1)},children:`没有账号?立即注册`})})]})}),R&&(0,$.jsx)(`div`,{className:`login-copyright-wrapper`,children:(0,$.jsx)(`div`,{className:`login-copyright`,children:R})})]})]})},w7=({onSuccess:e,isVerified:t,shake:n})=>{let r=S.useRef(null),i=S.useRef(null),a=S.useRef(null),o=S.useRef(0),s=S.useRef(!1),[c,l]=S.useState(360),u=c-50;S.useEffect(()=>{let e=()=>{if(r.current){let e=r.current.offsetWidth;e>0&&l(e)}};e();let t=new ResizeObserver(e);return r.current&&t.observe(r.current),window.addEventListener(`resize`,e),()=>{t.disconnect(),window.removeEventListener(`resize`,e)}},[]);let d=n=>{if(s.current||t)return;let r=Math.max(0,Math.min(n,u));o.current=r,i.current&&(i.current.style.left=`${r}px`),a.current&&(a.current.style.width=`${r+50}px`),r>=u-5&&(s.current=!0,i.current&&(i.current.style.background=`#22c55e`,i.current.innerHTML=``),a.current&&(a.current.style.width=`${c}px`,a.current.style.background=`#dcfce7`),e())};return(0,$.jsxs)(`div`,{ref:r,onMouseDown:e=>{if(e.preventDefault(),s.current||t)return;let n=r.current;if(!n)return;let c=n.getBoundingClientRect(),l=e=>{d(e.clientX-c.left-50/2)},f=()=>{document.removeEventListener(`mousemove`,l),document.removeEventListener(`mouseup`,f),!s.current&&o.current{if(s.current||t)return;e.preventDefault();let n=r.current;if(!n)return;let c=n.getBoundingClientRect();d(e.touches[0].clientX-c.left-50/2);let l=e=>{d(e.touches[0].clientX-c.left-50/2)},f=()=>{document.removeEventListener(`touchmove`,l),document.removeEventListener(`touchend`,f),!s.current&&o.current({page:1,pageSize:10,total:0,items:[]}),T7=p5((e,t)=>({projects:[],records:roe(),loading:!1,mediaType:`video`,countType:`请选择`,generationCount:1,selectedRatio:`1:1`,selectedResolution:`2K`,width:2048,height:2048,videoDuration:5,videoAspectRatio:`9:16`,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:[],inputValue:``,currentMedia:[],fetchProjects:async()=>{e({loading:!0});try{e({projects:await vie(),loading:!1})}catch{e({loading:!1})}},createProject:async(n,r)=>{let i=await yie(n,r);return e({projects:[i,...t().projects]}),i},deleteProject:async n=>{await bie(n),e({projects:t().projects.filter(e=>e.id!==n)})},fetchRecords:async(t={})=>{e({loading:!0});try{e({records:await E5(t),loading:!1})}catch{e({loading:!1})}},optimizePrompt:async(n,r)=>{let i=await xie(n,r);try{await y7.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 Mie(n,r);try{await y7.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}),setGenerationCount:t=>e({generationCount: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}),setInputValue:t=>e({inputValue:t}),setCurrentMedia:t=>e({currentMedia:t}),resetGenerationConfig:()=>e({mediaType:`image`,countType:`请选择`,generationCount:1,selectedRatio:`1:1`,selectedResolution:`2K`,width:2048,height:2048,videoDuration:5,videoAspectRatio:`9:16`,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:[],inputValue:``,currentMedia:[]})})),E7=480;function D7(e){if(!e)return`-`;let t=e.trim();if(!t)return`-`;let n=t.match(/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(Z|[+-]\d{2}:?\d{2})?$/);if(!n)return t.slice(0,16).replace(`T`,` `);let[,r,i,a,o,s,c,l]=n,u=Date.UTC(+r,i-1,+a,+o,+s,+c);if(l&&l!==`Z`){let e=l[0]===`+`?1:-1,[t,n]=l.slice(1).split(`:`),r=u-e*(t*60+ +n)*6e4+E7*6e4,i=new Date(r);return`${i.getUTCFullYear()}-${O7(i.getUTCMonth()+1)}-${O7(i.getUTCDate())} ${O7(i.getUTCHours())}:${O7(i.getUTCMinutes())}`}let d=l===`Z`?u+E7*6e4:u,f=new Date(d);return`${f.getUTCFullYear()}-${O7(f.getUTCMonth()+1)}-${O7(f.getUTCDate())} ${O7(f.getUTCHours())}:${O7(f.getUTCMinutes())}`}function O7(e){return e<10?`0${e}`:String(e)}var k7=[`#f97316`,`#3b82f6`,`#8b5cf6`,`#10b981`,`#eab308`,`#6366f1`,`#ef4444`,`#06b6d4`,`#64748b`,`#78716c`],A7={ShoppingCartOutlined:(0,$.jsx)(O8,{}),BookOutlined:(0,$.jsx)(K2,{}),HomeOutlined:(0,$.jsx)(j3,{}),FireOutlined:(0,$.jsx)(u3,{}),RocketOutlined:(0,$.jsx)(p8,{}),SkinOutlined:(0,$.jsx)(Are,{}),CompassOutlined:(0,$.jsx)(L4,{}),HeartOutlined:(0,$.jsx)(S3,{}),CarOutlined:(0,$.jsx)(s4,{}),CameraOutlined:(0,$.jsx)(i4,{}),CloudOutlined:(0,$.jsx)(y4,{}),StarOutlined:(0,$.jsx)(B8,{}),TrophyOutlined:(0,$.jsx)(Y8,{}),ThunderboltOutlined:(0,$.jsx)(K8,{}),BulbOutlined:(0,$.jsx)(Q2,{}),CoffeeOutlined:(0,$.jsx)(j4,{}),CrownOutlined:(0,$.jsx)(U4,{}),DashboardOutlined:(0,$.jsx)(K4,{}),FlagOutlined:(0,$.jsx)(p3,{}),GlobalOutlined:(0,$.jsx)(y3,{}),GiftOutlined:(0,$.jsx)(g3,{}),LaptopOutlined:(0,$.jsx)(B3,{}),MobileOutlined:(0,$.jsx)(y6,{}),MonitorOutlined:(0,$.jsx)(S6,{}),PayCircleOutlined:(0,$.jsx)(P6,{}),PictureOutlined:(0,$.jsx)(B6,{}),PlayCircleOutlined:(0,$.jsx)(Y6,{}),SafetyOutlined:(0,$.jsx)(g8,{}),ShoppingOutlined:(0,$.jsx)(j8,{}),SmileOutlined:(0,$.jsx)(F8,{}),SoundOutlined:(0,$.jsx)(R8,{}),TagOutlined:(0,$.jsx)(zre,{}),TeamOutlined:(0,$.jsx)(W8,{}),ToolOutlined:(0,$.jsx)(Ure,{}),TruckOutlined:(0,$.jsx)(Kre,{}),VideoCameraOutlined:(0,$.jsx)(r5,{}),WalletOutlined:(0,$.jsx)(a5,{}),BankOutlined:(0,$.jsx)(L2,{}),BuildOutlined:(0,$.jsx)(Y2,{}),ExperimentOutlined:(0,$.jsx)(t3,{}),HighlightOutlined:(0,$.jsx)(T3,{}),IdcardOutlined:(0,$.jsx)(P3,{}),MedicineBoxOutlined:(0,$.jsx)(u6,{}),ReadOutlined:(0,$.jsx)(t8,{}),RestOutlined:(0,$.jsx)(i8,{}),SketchOutlined:(0,$.jsx)(Ore,{}),SolutionOutlined:(0,$.jsx)(Nre,{})},ioe=()=>{let[e,t]=(0,S.useState)(!1),[n]=nU.useForm(),r=Ye(),{projects:i,fetchProjects:a,createProject:o,deleteProject:s}=T7(),[c,l]=(0,S.useState)([]);(0,S.useEffect)(()=>{a(),R5().then(l).catch(()=>{})},[]);let u=Object.fromEntries(c.map((e,t)=>[e.key,{label:e.label,color:k7[t%k7.length],icon:e.icon||`AppstoreOutlined`}]));return(0,$.jsxs)(`div`,{style:{margin:`-24px -32px -32px`,borderRadius:20,height:`calc(100vh - 34px)`,padding:`24px`},children:[(0,$.jsxs)(`div`,{className:`animate-fadeInUp`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:24,padding:`16px 24px`,borderRadius:16,background:`linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, rgba(139, 92, 246, 0.04) 100%)`,backdropFilter:`blur(10px)`,border:`1px solid rgba(99, 102, 241, 0.08)`,position:`relative`,overflow:`hidden`,flexWrap:`wrap`,gap:12},children:[(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16},children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{style:{margin:0,fontSize:18,fontWeight:700,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:`行业制造`}),(0,$.jsxs)(`p`,{style:{fontSize:13,color:`#64748b`,margin:`4px 0 0 0`},children:[`共 `,i.length,` 个项目 · 按行业分类管理`]})]})}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:12},children:[(0,$.jsx)(X,{icon:(0,$.jsx)(pH,{}),onClick:()=>r(`/records`),size:`large`,style:{background:`rgba(99, 102, 241, 0.1)`,border:`1px solid rgba(99, 102, 241, 0.2)`,color:`#6366f1`,fontWeight:600,borderRadius:10,height:42},children:`项目记录`}),(0,$.jsx)(X,{icon:(0,$.jsx)(rL,{}),onClick:()=>t(!0),size:`large`,style:{background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,color:`#fff`,fontWeight:600,borderRadius:10,height:42,boxShadow:`0 4px 16px rgba(99, 102, 241, 0.35)`},children:`新建项目`})]})]}),i.length===0?(0,$.jsx)(XS,{image:XS.PRESENTED_IMAGE_SIMPLE,description:`还没有项目,创建您的第一个视频项目`,style:{padding:`60px 0`},children:(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(rL,{}),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:A7[u[e.industry]?.icon]||(0,$.jsx)(g2,{})}),(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)(Q.Text,{strong:!0,style:{fontSize:15,color:`#1a1a2e`},children:e.name}),(0,$.jsx)(ZQ,{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)(oV,{style:{fontSize:12,color:`#94a3b8`}}),(0,$.jsxs)(`span`,{className:`date-display`,translate:`no`,style:{fontSize:12,color:`#94a3b8`},children:[`创建于 `,D7(e.createdAt)]})]})]}),(0,$.jsxs)(`div`,{className:`project-actions`,style:{display:`flex`,alignItems:`center`,gap:8,marginLeft:16},children:[(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(Y6,{}),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)(yK,{title:`确定删除该项目?`,description:`项目下的生成记录将一并删除`,onConfirm:async t=>{t?.stopPropagation(),await s(e.id),Z.success(`项目已删除`)},onCancel:e=>e?.stopPropagation(),children:(0,$.jsx)(X,{danger:!0,icon:(0,$.jsx)(d$,{}),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)(zg,{className:`mobile-hide`,style:{color:`#cbd5e1`,fontSize:12}})]})]},e.id))}),(0,$.jsx)(hK,{title:(0,$.jsxs)(cH,{children:[(0,$.jsx)(g2,{}),`新建项目`]}),open:e,onOk:async()=>{try{let e=await n.validateFields(),i=await o(e.name,e.industry);Z.success(`项目创建成功`),t(!1),n.resetFields(),r(`/projects/${i.id}/generate`)}catch{}},onCancel:()=>{t(!1),n.resetFields()},okText:`创建`,cancelText:`取消`,width:480,children:(0,$.jsxs)(nU,{form:n,layout:`vertical`,style:{marginTop:20},children:[(0,$.jsx)(nU.Item,{name:`name`,label:`项目名称`,rules:[{required:!0,message:`请输入项目名称`}],children:(0,$.jsx)(LW,{placeholder:`例如:618电商大促宣传片`,prefix:(0,$.jsx)(qX,{}),size:`large`})}),(0,$.jsx)(nU.Item,{name:`industry`,label:`所属行业`,rules:[{required:!0,message:`请选择行业`}],children:(0,$.jsx)(EC,{placeholder:`选择项目所属行业`,size:`large`,children:c.map((e,t)=>(0,$.jsx)(EC.Option,{value:e.key,children:(0,$.jsxs)(cH,{children:[A7[e.icon]||(0,$.jsx)(g2,{}),` `,e.label]})},e.key))})})]})})]})};async function j7(e){try{if(navigator.clipboard&&typeof navigator.clipboard.writeText==`function`)return await navigator.clipboard.writeText(e),!0;let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,t.style.top=`0`,document.body.appendChild(t),t.focus(),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}var{Text:M7}=Q,aoe={real_person:{title:`选择真人素材库`,empty:`暂无可选 Active 真人素材`,projectError:`加载真人素材项目失败`,assetError:`加载真人素材失败`,fallbackName:`真人素材`},aigc_virtual:{title:`选择虚拟素材库`,empty:`暂无可选 Active 虚拟素材`,projectError:`加载虚拟素材项目失败`,assetError:`加载虚拟素材失败`,fallbackName:`虚拟素材`}},N7=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,ooe=e=>e.assetType===`Video`?N7(e.videoCoverUrl||e.previewUrl||e.displayUrl||e.providerUrl):N7(e.previewUrl||e.displayUrl||e.videoCoverUrl||e.providerUrl),soe=e=>{let t=Number(e||0);return!Number.isFinite(t)||t<=0?`-`:`${t.toFixed(t>=10?0:1)}s`},P7=({open:e,libraryType:t=`real_person`,selectedIds:n=[],maxCount:r=20,onClose:i,onSelect:a,maxImageCount:o,maxVideoCount:s,usedImageCount:c,usedVideoCount:l,usedVideoDuration:u,maxVideoDuration:d,accept:f})=>{let p=aoe[t],[m,h]=(0,S.useState)([]),[g,_]=(0,S.useState)(),[v,y]=(0,S.useState)(``),[b,x]=(0,S.useState)(f===`image/*`?`Image`:void 0),[C,w]=(0,S.useState)([]),[T,E]=(0,S.useState)(new Map),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)(!1),j=(0,S.useMemo)(()=>new Set(T.keys()),[T]),M=async()=>{O(!0);try{let e=(await(t===`aigc_virtual`?_7:h7)({page:1,pageSize:100,status:`active`})).items||[];h(e),_(t=>t&&e.some(e=>e.id===t)?t:e[0]?.id)}catch(e){Z.error(e?.message||p.projectError)}finally{O(!1)}},N=async()=>{A(!0);try{w((await(t===`aigc_virtual`?Rae:Nae)({projectId:g,keyword:v.trim()||void 0,assetType:b,page:1,pageSize:100})).items||[])}catch(e){Z.error(e?.message||p.assetError)}finally{A(!1)}};(0,S.useEffect)(()=>{e&&setTimeout(()=>{E(new Map),y(``),x(void 0),_(void 0),w([]),M()},0)},[e,t]),(0,S.useEffect)(()=>{g&&setTimeout(()=>{N()},0)},[g,b]);let P=e=>{if(n.includes(e.id)){Z.info(`该素材已添加`);return}if(f===`image/*`&&e.assetType===`Video`){Z.warning(`当前仅支持选择图片素材`);return}E(t=>{let n=new Map(t);return n.has(e.id)?(n.delete(e.id),n):n.size>=r?(Z.warning(`最多选择 ${r} 个参考素材`),t):(n.set(e.id,e),n)})},F=(0,S.useMemo)(()=>{let e=Array.from(T.values()).filter(e=>e.assetType===`Image`).length,t=Array.from(T.values()).filter(e=>e.assetType===`Video`).length,n=Array.from(T.values()).filter(e=>e.assetType===`Video`).reduce((e,t)=>e+(t.videoDuration||0),0),r=o!==void 0&&c!==void 0?o-c:1/0,i=s!==void 0&&l!==void 0?s-l:1/0,a=d!==void 0&&u!==void 0?d-u:1/0;return e>r||t>i||n>a},[T,o,c,s,l,d,u]);return(0,$.jsxs)(hK,{title:`${p.title}`,open:e,onCancel:i,width:920,destroyOnHidden:!0,footer:[(0,$.jsx)(X,{onClick:i,children:`取消`},`cancel`),(0,$.jsxs)(X,{type:`primary`,onClick:()=>{let e=Array.from(T.values()).filter(e=>!n.includes(e.id));if(!e.length){Z.warning(`请选择至少一个${t===`aigc_virtual`?`虚拟`:`真人`}素材`);return}a(e),i()},disabled:F,style:{background:F?`#94a3b8`:`#8b5cf6`,opacity:F?.6:1,cursor:F?`not-allowed`:`pointer`},children:[`添加选中素材(`,T.size,`)`]},`ok`)],children:[f!==`image/*`&&(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:20,marginBottom:16,padding:`12px 16px`,background:`#fafafa`,borderRadius:8},children:(()=>{let e=Array.from(T.values()).filter(e=>e.assetType===`Image`).length,t=Array.from(T.values()).filter(e=>e.assetType===`Video`).length,n=Array.from(T.values()).filter(e=>e.assetType===`Video`).reduce((e,t)=>e+(t.videoDuration||0),0),r=o!==void 0&&c!==void 0?o-c:1/0,i=s!==void 0&&l!==void 0?s-l:1/0,a=d!==void 0&&u!==void 0?d-u:1/0,f=e>r,p=t>i,m=n>a;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{style:{fontSize:13,color:f?`#ef4444`:`#64748b`,fontWeight:f?600:400},children:[`还可选取图片 `,e,`/`,o!==void 0&&c!==void 0?o-c:`-`,` 张`]}),(0,$.jsxs)(`span`,{style:{fontSize:13,color:p||m?`#ef4444`:`#64748b`,fontWeight:p||m?600:400},children:[`视频还可选取 `,t,`/`,s!==void 0&&l!==void 0?s-l:`-`,` 个(`,n.toFixed(1),`/`,d!==void 0&&u!==void 0?(d-u).toFixed(1):`-`,`秒)`]})]})})()}),(0,$.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`240px 1fr`,gap:16,height:500},children:[(0,$.jsxs)(`div`,{style:{border:`1px solid #eef0f4`,borderRadius:12,padding:12,background:`#fafafa`,overflowY:`auto`,height:`100%`},children:[(0,$.jsxs)(cH,{style:{width:`100%`,justifyContent:`space-between`,marginBottom:12},children:[(0,$.jsx)(M7,{strong:!0,children:`项目组`}),(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(Tq,{}),onClick:M,loading:D})]}),(0,$.jsx)(WG,{spinning:D,children:m.length===0?(0,$.jsx)(XS,{image:XS.PRESENTED_IMAGE_SIMPLE,description:`暂无项目组`}):(0,$.jsx)(`div`,{children:m.map(e=>(0,$.jsx)(`div`,{onClick:()=>_(e.id),style:{cursor:`pointer`,padding:`10px 12px`,borderRadius:10,marginBottom:6,border:g===e.id?`1px solid #8b5cf6`:`1px solid transparent`,background:g===e.id?`#f5f3ff`:`#fff`},children:(0,$.jsxs)(`div`,{style:{width:`100%`},children:[(0,$.jsx)(M7,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name}),(0,$.jsx)(M7,{type:`secondary`,style:{fontSize:12},children:typeof e.activeImageAssetCount==`number`||typeof e.activeVideoAssetCount==`number`?` 图 ${e.activeImageAssetCount||0} / 视 ${e.activeVideoAssetCount||0}`:``})]})},e.id))})})]}),(0,$.jsxs)(`div`,{style:{overflowY:`auto`,height:`100%`},children:[(0,$.jsxs)(cH,{style:{width:`100%`,marginBottom:12},children:[(0,$.jsx)(LW,{allowClear:!0,prefix:(0,$.jsx)(xC,{}),placeholder:`搜索素材名称`,value:v,onChange:e=>y(e.target.value),onPressEnter:N}),(0,$.jsx)(EC,{allowClear:f!==`image/*`,placeholder:`素材类型`,value:b,onChange:x,style:{width:116},options:f===`image/*`?[{value:`Image`,label:`图片`}]:[{value:`Image`,label:`图片`},{value:`Video`,label:`视频`}]}),(0,$.jsx)(X,{icon:(0,$.jsx)(Tq,{}),onClick:N,loading:k,children:`刷新`})]}),(0,$.jsx)(WG,{spinning:k,children:C.length===0?(0,$.jsx)(XS,{image:XS.PRESENTED_IMAGE_SIMPLE,description:p.empty,style:{marginTop:120}}):(0,$.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(140px, 1fr))`,gap:12,maxHeight:420,overflowY:`auto`,paddingRight:4},children:C.filter(e=>f!==`image/*`||e.assetType===`Image`).map(e=>{let t=j.has(e.id)||n.includes(e.id),r=n.includes(e.id),i=ooe(e),a=e.assetType===`Video`;return(0,$.jsxs)(`div`,{onClick:()=>P(e),style:{cursor:r?`not-allowed`:`pointer`,border:t?`2px solid #8b5cf6`:`1px solid #edf0f5`,borderRadius:12,overflow:`hidden`,background:`#fff`,boxShadow:t?`0 8px 20px rgba(139,92,246,0.18)`:`0 4px 12px rgba(15,23,42,0.04)`,opacity:r?.62:1,position:`relative`},children:[(0,$.jsxs)(`div`,{style:{aspectRatio:`1 / 1`,background:`#f8fafc`,display:`flex`,alignItems:`center`,justifyContent:`center`,position:`relative`},children:[i?a?(0,$.jsx)(`video`,{src:i,muted:!0,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(`img`,{src:i,alt:e.name||p.fallbackName,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):a?(0,$.jsx)(r5,{style:{fontSize:32,color:`#94a3b8`}}):(0,$.jsx)(B6,{style:{fontSize:32,color:`#94a3b8`}}),a&&(0,$.jsx)(`div`,{style:{position:`absolute`,left:8,bottom:8,padding:`2px 6px`,borderRadius:8,background:`rgba(15,23,42,0.72)`,color:`#fff`,fontSize:12},children:soe(e.videoDuration)})]}),t&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8,width:24,height:24,borderRadius:12,background:`#8b5cf6`,color:`#fff`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(hC,{})}),(0,$.jsxs)(`div`,{style:{padding:10},children:[(0,$.jsx)(M7,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name||`未命名素材`}),(0,$.jsxs)(cH,{wrap:!0,size:4,style:{marginTop:6},children:[(0,$.jsx)(ZQ,{color:a?`blue`:`default`,children:a?`视频`:`图片`}),(0,$.jsx)(ZQ,{children:e.projectName})]})]})]},e.id)})})})]})]})]})},F7=({src:e,size:t=`normal`})=>{let n=(0,S.useRef)(null),[r,i]=(0,S.useState)(!1),[a,o]=(0,S.useState)(0),[s,c]=(0,S.useState)(0),[l,u]=(0,S.useState)(1),[d,f]=(0,S.useState)(!1),p=e=>`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,`0`)}`,m=(0,S.useCallback)(()=>{n.current&&(r?n.current.pause():n.current.play(),i(!r))},[r]),h=(0,S.useCallback)(()=>{n.current&&o(n.current.currentTime)},[]),g=(0,S.useCallback)(()=>{n.current&&c(n.current.duration)},[]),_=(0,S.useCallback)(()=>{i(!1),o(0)},[]),v=(0,S.useCallback)(e=>{if(!n.current||s===0)return;let t=e.currentTarget.getBoundingClientRect(),r=(e.clientX-t.left)/t.width*s;n.current.currentTime=r,o(r)},[s]),y=(0,S.useCallback)(e=>{if(!n.current)return;let t=parseFloat(e.target.value);n.current.volume=t,u(t),f(t===0)},[]),b=(0,S.useCallback)(()=>{n.current&&(d?(n.current.volume=l||.5,f(!1)):(n.current.volume=0,f(!0)))},[d,l]);(0,S.useEffect)(()=>{let e=n.current;if(e)return e.addEventListener(`timeupdate`,h),e.addEventListener(`loadedmetadata`,g),e.addEventListener(`ended`,_),()=>{e.removeEventListener(`timeupdate`,h),e.removeEventListener(`loadedmetadata`,g),e.removeEventListener(`ended`,_)}},[h,g,_]);let x=s>0?a/s*100:0;return(0,$.jsxs)(`div`,{style:{width:`100%`,height:t===`small`?130:112,background:`#f1f5f9`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,padding:t===`small`?`16px 16px`:`12px 16px`},children:[(0,$.jsx)(`audio`,{ref:n,src:e}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16,width:`100%`},children:[(0,$.jsx)(`button`,{onClick:m,style:{width:48,height:48,borderRadius:`50%`,background:`linear-gradient(135deg, #8b5cf6, #a78bfa)`,border:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,flexShrink:0},children:r?(0,$.jsx)(O6,{style:{fontSize:24,color:`#fff`}}):(0,$.jsx)(Y6,{style:{fontSize:24,color:`#fff`,marginLeft:2}})}),(0,$.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,gap:8},children:[(0,$.jsxs)(`div`,{onClick:v,style:{height:5,background:`#e2e8f0`,borderRadius:10,cursor:`pointer`,overflow:`visible`,position:`relative`},children:[(0,$.jsx)(`div`,{style:{height:`100%`,width:`${x}%`,background:`linear-gradient(90deg, #8b5cf6, #a78bfa)`,borderRadius:10,transition:`width 0.1s linear`}}),(0,$.jsx)(`div`,{style:{position:`absolute`,left:`${x}%`,top:`50%`,transform:`translate(-50%, -50%)`,width:t===`small`?12:14,height:t===`small`?12:14,background:`#fff`,borderRadius:`50%`,boxShadow:`0 2px 6px rgba(0,0,0,0.15)`,opacity:+(x>0),transition:`opacity 0.2s`}})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{fontSize:t===`small`?11:12,color:`#64748b`},children:p(a)}),(0,$.jsx)(`span`,{style:{fontSize:t===`small`?11:12,color:`#64748b`},children:p(s)})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,flexShrink:0},children:[(0,$.jsx)(`button`,{onClick:b,style:{border:`none`,background:`transparent`,cursor:`pointer`,padding:0},children:d?(0,$.jsx)(g4,{style:{fontSize:t===`small`?14:16,color:`#94a3b8`}}):(0,$.jsx)(R8,{style:{fontSize:t===`small`?14:16,color:`#94a3b8`}})}),(0,$.jsx)(`input`,{type:`range`,min:`0`,max:`1`,step:`0.1`,value:d?0:l,onChange:y,style:{width:t===`small`?40:50,height:4,borderRadius:2,appearance:`none`,background:`#e2e8f0`,cursor:`pointer`}})]})]})]})},{Text:I7}=Q,L7=e=>{if(!e)return``;if(/^data:|blob:/i.test(e))return e;if(/^https?:\/\//i.test(e)){let t=new URL(e);return t.pathname.startsWith(`/uploads`)?t.pathname+t.search:e}return`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`},R7=(e,t)=>{if(e<300||e>6e3)return`图片宽度需在 300~6000px 之间,当前为 ${e}px`;if(t<300||t>6e3)return`图片高度需在 300~6000px 之间,当前为 ${t}px`;let n=e/t;return n<.4||n>2.5?`图片宽高比需在 0.4~2.5 之间,当前为 ${n.toFixed(2)}`:null},z7=(e,t)=>{if(e<300||e>6e3)return`视频宽度需在 300~6000px 之间,当前为 ${e}px`;if(t<300||t>6e3)return`视频高度需在 300~6000px 之间,当前为 ${t}px`;let n=e/t;if(n<.4||n>2.5)return`视频宽高比需在 0.4~2.5 之间,当前为 ${n.toFixed(2)}`;let r=e*t;return r<409600?`视频总像素数过小(${e}×${t}=${r}),需 ≥ 640×640=409600`:r>8295044?`视频总像素数过大(${e}×${t}=${r}),需 ≤ 3326×2494=8295044`:null},coe=e=>{let t=e,n=t.width||t.videoWidth||t.imageWidth||0,r=t.height||t.videoHeight||t.imageHeight||0;if(e.resourceType===`image`){if(n>0&&r>0)return R7(n,r)}else if(e.resourceType===`video`&&n>0&&r>0)return z7(n,r);return null},loe=e=>new Promise(t=>{let n=new Image;n.onload=()=>{t({width:n.width,height:n.height})},n.onerror=()=>{t({width:0,height:0})},n.src=e}),uoe=e=>e===`video`?(0,$.jsx)(r5,{}):e===`audio`?(0,$.jsx)(j2,{}):(0,$.jsx)(B6,{}),doe=e=>e===`video`?`视频`:e===`audio`?`音频`:`图片`,foe=({open:e,onClose:t,onSelect:n,allowedTypes:r,selectedIds:i=[],title:a=`选择历史上传素材`,maxImageCount:o,maxVideoCount:s,usedImageCount:c,usedVideoCount:l,maxVideoDuration:u,usedVideoDuration:d,maxAudioCount:f,usedAudioCount:p,maxAudioDuration:m,usedAudioDuration:h,hideLimitHint:g})=>{let[_,v]=(0,S.useState)(``),[y,b]=(0,S.useState)(``),[x,C]=(0,S.useState)(1),[w,T]=(0,S.useState)(10),[E,D]=(0,S.useState)(1),[O,k]=(0,S.useState)(10),[A,j]=(0,S.useState)(!1),[M,N]=(0,S.useState)(!1),[P,F]=(0,S.useState)([]),[I,L]=(0,S.useState)(0),[R,z]=(0,S.useState)(``),[B,V]=(0,S.useState)([]),[H,U]=(0,S.useState)(0),[W,ee]=(0,S.useState)(new Map),te=(0,S.useMemo)(()=>new Set(i),[i]),ne=(0,S.useMemo)(()=>new Set(r||[`image`,`video`,`audio`]),[JSON.stringify(r)]),re=(0,S.useMemo)(()=>Array.from(W.values()).filter(e=>e.resourceType===`image`).length,[W]),G=(0,S.useMemo)(()=>Array.from(W.values()).filter(e=>e.resourceType===`video`).length,[W]),ie=(0,S.useMemo)(()=>Array.from(W.values()).filter(e=>e.resourceType===`video`).reduce((e,t)=>e+(t.durationSeconds||0),0),[W]),K=(0,S.useMemo)(()=>Array.from(W.values()).filter(e=>e.resourceType===`audio`).length,[W]),ae=(0,S.useMemo)(()=>Array.from(W.values()).filter(e=>e.resourceType===`audio`).reduce((e,t)=>e+(t.durationSeconds||0),0),[W]),q=(0,S.useMemo)(()=>o!==void 0&&c!==void 0?o-c:1/0,[o,c]),oe=(0,S.useMemo)(()=>s!==void 0&&l!==void 0?s-l:1/0,[s,l]),se=(0,S.useMemo)(()=>u!==void 0&&d!==void 0?u-d:1/0,[u,d]),ce=(0,S.useMemo)(()=>f!==void 0&&p!==void 0?f-p:1/0,[f,p]),le=(0,S.useMemo)(()=>m!==void 0&&h!==void 0?m-h:1/0,[m,h]),ue=(0,S.useMemo)(()=>re>q,[re,q]),de=(0,S.useMemo)(()=>G>oe,[G,oe]),fe=(0,S.useMemo)(()=>ie>se,[ie,se]),pe=(0,S.useMemo)(()=>K>ce,[K,ce]),me=(0,S.useMemo)(()=>ae>le,[ae,le]),he=(0,S.useCallback)(async()=>{if(e){N(!0);try{let e=await f7({resourceType:_||void 0,keyword:y||void 0,page:x,pageSize:w,scene:`picker`});F(x===1?e.groups||[]:t=>[...t,...e.groups||[]]),L(e.totalDays||0)}catch(e){Z.error(e?.message||`加载历史上传素材失败`),x===1&&F([]),L(0)}finally{N(!1)}}},[ne,y,e,x,w,_]),ge=(0,S.useCallback)(async e=>{j(!0);try{let t=await p7(e,{resourceType:_||void 0,keyword:y||void 0,page:E,pageSize:8,scene:`picker`});V((t.items||[]).filter(e=>ne.has(e.resourceType))),U(t.total||0)}catch(e){Z.error(e?.message||`加载历史上传素材失败`),V([]),U(0)}finally{j(!1)}},[ne,y,E,O,_]);(0,S.useEffect)(()=>{e&&he()},[e,x,he]),(0,S.useEffect)(()=>{R&&D(1)},[R]),(0,S.useEffect)(()=>{R&&ge(R)},[R,E,ge]),(0,S.useEffect)(()=>{e&&ee(new Map)},[e]);let _e=async e=>{if(te.has(e.id)){Z.warning(`该素材已经在参考内容中`);return}let t=e,n=t.width||t.videoWidth||t.imageWidth||0,r=t.height||t.videoHeight||t.imageHeight||0;if(e.resourceType===`image`){if(n<=0||r<=0){let t=L7(e.previewUrl||e.displayUrl||e.resourceUrl);if(t){let e=await loe(t);n=e.width,r=e.height}}if(n>0&&r>0){let t=R7(n,r);if(t){Z.error(`${e.fileName||`图片`}:${t}`);return}}}else if(e.resourceType===`video`&&n>0&&r>0){let t=z7(n,r);if(t){Z.error(`${e.fileName||`视频`}:${t}`);return}}ee(t=>{let n=new Map(t);return n.has(e.id)?n.delete(e.id):n.set(e.id,e),n})},ve=()=>{let e=Array.from(W.values());if(e.length===0){Z.warning(`请先选择历史素材`);return}n(e),ee(new Map),t()},ye=(0,S.useMemo)(()=>[{label:`全部`,value:``},{label:`图片`,value:`image`},{label:`视频`,value:`video`},{label:`音频`,value:`audio`}].filter(e=>!e.value||ne.has(e.value)),[ne]);return(0,$.jsxs)(hK,{title:a,open:e,onCancel:t,width:1e3,centered:!0,destroyOnHidden:!0,footer:[(0,$.jsx)(X,{onClick:t,children:`取消`},`cancel`),(0,$.jsxs)(X,{type:`primary`,onClick:ve,style:{background:`#8b5cf6`},disabled:ue||de||fe||pe||me,children:[`应用选择 (`,W.size,`)`]},`ok`)],children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsxs)(cH,{wrap:!0,children:[(0,$.jsx)(EC,{value:_,options:ye,style:{width:120},onChange:e=>{v(e),C(1)}}),(0,$.jsx)(LW,{allowClear:!0,value:y,prefix:(0,$.jsx)(xC,{}),placeholder:`搜索文件名`,style:{width:220},onChange:e=>b(e.target.value),onPressEnter:()=>{C(1),he()}}),(0,$.jsx)(X,{icon:(0,$.jsx)(Tq,{}),onClick:he,children:`刷新`})]}),!g&&(0,$.jsxs)(`div`,{style:{display:`flex`,gap:16,marginTop:12,flexWrap:`wrap`},children:[(0,$.jsxs)(`span`,{style:{fontSize:13,color:ue?`#ef4444`:`#64748b`,fontWeight:ue?600:400},children:[`还可选取图片 `,re,`/`,o!==void 0&&c!==void 0?o-c:`-`,` 张`]}),(0,$.jsxs)(`span`,{style:{fontSize:13,color:de||fe?`#ef4444`:`#64748b`,fontWeight:de||fe?600:400},children:[`视频还可选取 `,G,`/`,s!==void 0&&l!==void 0?s-l:`-`,` 个(`,ie.toFixed(1),`/`,u!==void 0&&d!==void 0?(u-d).toFixed(1):`-`,`秒)`]}),f!==void 0&&(0,$.jsxs)(`span`,{style:{fontSize:13,color:pe||me?`#ef4444`:`#64748b`,fontWeight:pe||me?600:400},children:[`音频还可选取 `,K,`/`,f!==void 0&&p!==void 0?f-p:`-`,` 个(`,ae.toFixed(1),`/`,m!==void 0&&h!==void 0?(m-h).toFixed(1):`-`,`秒)`]})]})]}),(0,$.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`240px 1fr`,gap:16,height:500},children:[(0,$.jsxs)(`div`,{style:{border:`1px solid #eef0f4`,borderRadius:12,padding:12,background:`#fafafa`,overflowY:`auto`},children:[(0,$.jsx)(I7,{strong:!0,style:{fontSize:14},children:`日期列表`}),(0,$.jsx)(WG,{spinning:M,children:P.length===0?(0,$.jsx)(XS,{image:XS.PRESENTED_IMAGE_SIMPLE,description:`暂无日期`,style:{padding:`40px 0`}}):(0,$.jsxs)(`div`,{style:{marginTop:12},children:[P.map(e=>(0,$.jsxs)(`div`,{onClick:()=>z(e.generatedDate),style:{padding:`10px 12px`,borderRadius:10,marginBottom:6,cursor:`pointer`,border:R===e.generatedDate?`1px solid #8b5cf6`:`1px solid transparent`,background:R===e.generatedDate?`#f5f3ff`:`#fff`},children:[(0,$.jsx)(`div`,{style:{fontSize:13,fontWeight:500,color:`#334155`},children:e.generatedDate}),(0,$.jsxs)(`div`,{style:{fontSize:12,color:`#94a3b8`,marginTop:4},children:[`共 `,e.total,` 个素材`]})]},e.generatedDate)),I>P.length&&(0,$.jsx)(`div`,{style:{marginTop:12,textAlign:`center`},children:(0,$.jsx)(X,{size:`small`,onClick:()=>C(x+1),children:`加载更多`})})]})})]}),(0,$.jsx)(`div`,{style:{border:`1px solid #eef0f4`,borderRadius:12,padding:12,overflowY:`auto`},children:(0,$.jsx)(WG,{spinning:A,children:R?B.length===0?(0,$.jsx)(XS,{description:`该日期暂无可复用的历史上传素材`,style:{padding:`48px 0`}}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(150px, 1fr))`,gap:14},children:B.map(e=>{let t=W.has(e.id),n=te.has(e.id),r=coe(e),i=n||!!r,a=L7(e.previewUrl||e.displayUrl||e.resourceUrl);return(0,$.jsxs)(`div`,{onClick:()=>!i&&_e(e),style:{position:`relative`,borderRadius:14,border:t?`2px solid #8b5cf6`:`1px solid #e2e8f0`,background:i?`#f8fafc`:`#fff`,opacity:i?.55:1,cursor:i?`not-allowed`:`pointer`,overflow:`hidden`,boxShadow:t?`0 10px 24px rgba(139, 92, 246, 0.18)`:`0 6px 18px rgba(15,23,42,0.06)`},title:r||void 0,children:[(0,$.jsx)(`div`,{style:{background:`#f1f5f9`},children:e.resourceType===`image`?(0,$.jsx)(`img`,{src:a,alt:e.fileName||e.id,style:{width:`100%`,height:130,objectFit:`cover`}}):e.resourceType===`video`?(0,$.jsx)(`video`,{src:a,muted:!0,style:{width:`100%`,height:130,objectFit:`cover`}}):(0,$.jsx)(F7,{src:a,size:`small`})}),(0,$.jsxs)(`div`,{style:{padding:10},children:[(0,$.jsxs)(cH,{size:6,style:{marginBottom:6},children:[(0,$.jsx)(ZQ,{color:`purple`,icon:uoe(e.resourceType),style:{margin:0},children:doe(e.resourceType)}),e.durationSeconds?(0,$.jsxs)(ZQ,{style:{margin:0},children:[Number(e.durationSeconds).toFixed(1),`s`]}):null,r&&(0,$.jsx)(ZQ,{color:`red`,style:{margin:0},children:`尺寸不符`})]}),(0,$.jsx)(I7,{ellipsis:!0,style:{display:`block`,fontSize:13,color:`#334155`},title:e.fileName||e.id,children:e.fileName||e.id}),(0,$.jsx)(I7,{type:`secondary`,style:{fontSize:12},children:e.moduleLabel||`普通上传`})]}),t&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8,width:24,height:24,borderRadius:12,background:`#8b5cf6`,color:`#fff`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,$.jsx)(hC,{})}),n&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8},children:(0,$.jsx)(ZQ,{children:`已选`})}),r&&(0,$.jsx)(`div`,{style:{position:`absolute`,bottom:0,left:0,right:0,background:`rgba(239, 68, 68, 0.9)`,color:`#fff`,padding:`4px 8px`,fontSize:11,textAlign:`center`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:r})]},e.id)})}),(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:16,paddingBottom:8},children:(0,$.jsx)(CG,{current:E,pageSize:O,total:H,showSizeChanger:!0,pageSizeOptions:[10,20,50,100],onChange:(e,t)=>{D(e),k(t)}})})]}):(0,$.jsx)(XS,{image:XS.PRESENTED_IMAGE_SIMPLE,description:`请选择日期`,style:{padding:`80px 0`}})})})]})]})},B7=({children:e,accept:t=`image/*,video/*`,multiple:n=!0,onLocalSelect:r,onHistorySelect:i,onPortraitSelect:a,onPortraitLibrarySelect:o,uploading:s,tooltipTitle:c,maxImageCount:l,maxVideoCount:u,usedImageCount:d,usedVideoCount:f,usedVideoDuration:p,maxVideoDuration:m,maxAudioCount:h,usedAudioCount:g,maxAudioDuration:_,usedAudioDuration:v,hideLimitHint:y})=>{let b=(0,S.useRef)(null),[x,C]=(0,S.useState)(!1),[w,T]=(0,S.useState)(`real_person`),[E,D]=(0,S.useState)(!1),[O,k]=(0,S.useState)(!1),[A,j]=(0,S.useState)(!1),M=()=>{k(!1),b.current?.click()},N=e=>{let t=e.target.files;t&&r&&r(Array.from(t)),b.current&&(b.current.value=``)},P=e=>{if(k(!1),a){T(e),C(!0);return}if(o){o(e);return}T(e),C(!0)},F=(0,$.jsxs)(`div`,{style:{padding:`4px 0`,minWidth:180},children:[(0,$.jsxs)(`div`,{onClick:()=>{M()},style:{display:`flex`,alignItems:`center`,gap:12,padding:`8px 16px`,cursor:`pointer`,transition:`background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#f1f5f9`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},children:[(0,$.jsx)(qX,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`本地上传`})]}),(0,$.jsxs)(`div`,{onClick:()=>{k(!1),D(!0)},style:{display:`flex`,alignItems:`center`,gap:12,padding:`8px 16px`,cursor:`pointer`,transition:`background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#f1f5f9`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},children:[(0,$.jsx)(Y4,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`从资产中选择`})]}),(0,$.jsxs)(`div`,{onClick:()=>P(`real_person`),style:{display:`flex`,alignItems:`center`,gap:12,padding:`8px 16px`,cursor:`pointer`,transition:`background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#f1f5f9`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},children:[(0,$.jsx)(t5,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`真人素材库`})]}),(0,$.jsxs)(`div`,{onClick:()=>P(`aigc_virtual`),style:{display:`flex`,alignItems:`center`,gap:12,padding:`8px 16px`,cursor:`pointer`,transition:`background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#f1f5f9`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},children:[(0,$.jsx)(W8,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`虚拟素材库`})]})]});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`input`,{ref:b,type:`file`,accept:t,multiple:n,onChange:N,style:{display:`none`}}),c?(0,$.jsx)(gw,{title:c,children:(0,$.jsx)(ww,{content:F,open:O,onOpenChange:k,trigger:`click`,placement:`bottomLeft`,children:(0,$.jsx)(`div`,{style:{cursor:s?`not-allowed`:`pointer`},children:e})})}):(0,$.jsx)(ww,{content:F,open:O,onOpenChange:k,trigger:`click`,placement:`bottomLeft`,children:(0,$.jsx)(`div`,{style:{cursor:s?`not-allowed`:`pointer`},children:e})}),(0,$.jsx)(foe,{open:E,onClose:()=>D(!1),onSelect:e=>{i?.(e),D(!1)},allowedTypes:t.includes(`audio`)?[`image`,`video`,`audio`]:t.includes(`video`)?[`image`,`video`]:[`image`],maxImageCount:l,maxVideoCount:u,usedImageCount:d,usedVideoCount:f,maxVideoDuration:m,usedVideoDuration:p,maxAudioCount:h,usedAudioCount:g,maxAudioDuration:_,usedAudioDuration:v,hideLimitHint:y}),(0,$.jsx)(P7,{open:x,libraryType:w,onClose:()=>C(!1),onSelect:e=>{a?.(e),C(!1)},accept:t,maxCount:t===`image/*`&&!n?1:void 0,maxImageCount:l,maxVideoCount:u,usedImageCount:d,usedVideoCount:f,usedVideoDuration:p,maxVideoDuration:m})]})};function poe(){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 V7=({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)(Y6,{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)})]})},moe=()=>{let{projectId:e}=$e(),t=Ye(),[n]=nU.useForm(),{projects:r,records:i,fetchProjects:a,fetchRecords:o,optimizePrompt:s,generateVideo:c}=T7(),l=i.items,{user:u}=y7(),[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)({}),[ne,re]=(0,S.useState)({}),[G,ie]=(0,S.useState)(null),[K,ae]=(0,S.useState)({}),[q,oe]=(0,S.useState)(null),[se,ce]=(0,S.useState)(5),[le,ue]=(0,S.useState)(`16:9`),[de,fe]=(0,S.useState)(`720p`),[pe,me]=(0,S.useState)(null),[he,ge]=(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]}),[_e,ve]=(0,S.useState)(0),[ye,be]=(0,S.useState)(0),[xe,Se]=(0,S.useState)(`video`),[Ce,we]=(0,S.useState)(`1:1`),[Te,Ee]=(0,S.useState)(`2K`),[De,Oe]=(0,S.useState)(2048),[ke,Ae]=(0,S.useState)(2048),[je,Me]=(0,S.useState)(!1),[Ne,Pe]=(0,S.useState)([]),[Fe,Ie]=(0,S.useState)([]),Le=(e,t)=>{if(e<300||e>6e3)return`图片宽度需在 300~6000px 之间,当前为 ${e}px`;if(t<300||t>6e3)return`图片高度需在 300~6000px 之间,当前为 ${t}px`;let n=e/t;return n<.4||n>2.5?`图片宽高比需在 0.4~2.5 之间,当前为 ${n.toFixed(2)}`:null},Re=(e,t)=>{if(e<300||e>6e3)return`视频宽度需在 300~6000px 之间,当前为 ${e}px`;if(t<300||t>6e3)return`视频高度需在 300~6000px 之间,当前为 ${t}px`;let n=e/t;if(n<.4||n>2.5)return`视频宽高比需在 0.4~2.5 之间,当前为 ${n.toFixed(2)}`;let r=e*t;return r<409600?`视频总像素数过小(${e}×${t}=${r}),需 ≥ 640×640=409600`:r>8295044?`视频总像素数过大(${e}×${t}=${r}),需 ≤ 3326×2494=8295044`:null},ze=async e=>{let t=e.type.startsWith(`image/`),n=e.type.startsWith(`video/`);if(!t&&!n)return Z.error(`仅支持图片或视频文件`),!1;let r=n?100:10;if(e.size/1024/1024>r)return Z.error(`${n?`视频`:`图片`}大小不能超过${r}MB`),!1;let i=M.filter(e=>e.type===`image`).length,a=M.filter(e=>e.type===`video`).length,o=M.filter(e=>e.type===`video`).reduce((e,t)=>e+(t.duration||0),0);if(t&&i>=5)return Z.error(`最多上传5张图片`),!1;if(n&&a>=2)return Z.error(`最多上传2个视频`),!1;let s=0;if(n){let t=await new Promise(t=>{let n=document.createElement(`video`);n.preload=`metadata`,n.onloadedmetadata=()=>{t({duration:n.duration||0,width:n.videoWidth||0,height:n.videoHeight||0}),n.remove()},n.onerror=()=>{t({duration:0,width:0,height:0}),n.remove()},n.src=URL.createObjectURL(e)});if(s=t.duration,t.width>0&&t.height>0){let e=Re(t.width,t.height);if(e)return Z.error(`${e}`),!1}if(o+s>15)return Z.error(`视频总时长不能超过15秒`),!1}else{let t=await new Promise(t=>{let n=document.createElement(`img`);n.onload=()=>{t({width:n.width,height:n.height}),URL.revokeObjectURL(n.src)},n.onerror=()=>{t({width:0,height:0}),URL.revokeObjectURL(n.src)},n.src=URL.createObjectURL(e)});if(t.width>0&&t.height>0){let e=Le(t.width,t.height);if(e)return Z.error(`${e}`),!1}}F(!0);try{let r;r=t?await O5(e):await k5(e,s);let o=t?`图片`:`视频`,c=t?i+1:a+1;N(e=>[...e,{url:r.url,type:t?`image`:`video`,name:`${o}${c}`,duration:n?s:void 0}]),Z.success(`${o}上传成功`)}catch{Z.error(`上传失败`)}finally{F(!1)}return!1};(0,S.useEffect)(()=>{if(Bie().then(e=>{Pe(e.video),Ie(e.image)}),!je)return;let e=e=>{let t=e.target;!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&Me(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[je]);let Be=(e,t)=>{for(let n=0;n{let t=e===`2k`?`2048`:e===`4k`?`4096`:e;for(let e=0;e{Qe(e)},Ue=e=>{tt(parseInt(e))},[We,Ge]=(0,S.useState)([]),[Ke,qe]=(0,S.useState)([]),[Je,Xe]=(0,S.useState)([]),[Ze,Qe]=(0,S.useState)(0),[et,tt]=(0,S.useState)(0);(0,S.useEffect)(()=>{Je[et]&&Je[et][Ze]!==void 0&&(Oe(Je[et][Ze].substring(0,4)),Ae(Je[et][Ze].substring(5)))},[Ze]),(0,S.useEffect)(()=>{Je[et]&&Je[et][Ze]!==void 0&&(Oe(Je[et][Ze].substring(0,4)),Ae(Je[et][Ze].substring(5)))},[et]);let nt=()=>{Oe(ke),Ae(De)},rt=e=>{Se(e.target.value===`image`?`image`:`video`)};(0,S.useEffect)(()=>{R5().then(e=>{W(Object.fromEntries(e.map(e=>[e.key,e.label]))),te(Object.fromEntries(e.map(e=>[e.key,e.optionGroups||[]])))}).catch(()=>{}),Pie().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)=>{Ge(n=>[...n,{value:e,label:String(t)}])});for(let e in t[`4K`])i.push(t[`4K`][e]);Xe([r,i]);let a=[];for(let e in t)a.push(e);a.forEach((e,t)=>{qe(n=>[...n,{value:e,label:String(t)}])})}).catch(()=>{}),Nie().then(e=>{if(e.items?.length){let t=e.items[0];ge({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 it=(0,S.useRef)(!1);(0,S.useEffect)(()=>{it.current||l.length===0||(it.current=!0,l.forEach(t=>{t.projectId===e&&t.status===`generating`&&(T(e=>({...e,[t.id]:`generating`})),jt(t.id)),t.projectId===e&&t.status===`optimizing`&&ft(t.id)}))},[l,e]);let at=(0,S.useRef)(new Set),ot=(0,S.useRef)(null),st=(0,S.useRef)(null),ct=e=>{at.current.add(e),dt()},lt=e=>{at.current.delete(e),at.current.size===0&&ut()},ut=()=>{ot.current&&=(clearInterval(ot.current),null),st.current&&=(st.current.abort(),null)},dt=()=>{ot.current||=setInterval(async()=>{try{st.current&&st.current.abort();let t=new AbortController;st.current=t;let n=await E5({projectId:e,page:1,pageSize:100,signal:t.signal});st.current=null;let r=Array.from(at.current),i=[];if(r.length>0){let e=T7.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});T7.setState({records:{...e,items:t}}),i.forEach(e=>{lt(e)})}}catch(e){e.name}},3e3)},ft=e=>{ct(e)},pt=(0,S.useRef)(!1),mt=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(pt.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(mt.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?(pt.current=!0,localStorage.removeItem(`pending_optimize`),g(s),v(s.optimizedPrompt||``),ve(s.textCreditsCost),be(s.textTokensUsed),m(!0),Z.success({content:`优化请求已恢复,消耗 ${s.textCreditsCost} 积分`,key:`recovery`})):Date.now()-o>3e4&&localStorage.removeItem(`pending_optimize`)}catch{localStorage.removeItem(`pending_optimize`)}},[l,e]);let ht=r.find(t=>t.id===e),gt=l.filter(t=>t.projectId===e),_t=ht?.name??`项目`,vt=ht&&ee[ht.industry]||[],yt=u?.credits??0,bt=e=>{let t=e===`2k`?`2048`:e===`4k`?`4096`:e;for(let e=0;e=xt,Ct=async()=>{try{if(!e){Z.error(`项目ID为空,请先选择项目`);return}let t=await n.validateFields();if(!t.prompt||!t.prompt.trim()){Z.error(`请输入视频/图片描述`);return}f(!0);let r=Object.entries(ne).map(([e,t])=>`@${e}:${t}`),i=r.length>0?`${t.prompt}\n\n${r.join(`;`)}`:t.prompt,a=poe();localStorage.setItem(`pending_optimize`,JSON.stringify({key:a,projectId:e,prompt:i,duration:se,ts:Date.now()})),mt.current=a;let o=await s(e,{prompt:i,duration:se,genType:xe,resolution:Te,references:M.length>0?M:void 0,idempotencyKey:a,image_size:Te,image_proportion:Ce,image_px:De+`x`+ke});localStorage.removeItem(`pending_optimize`),mt.current=null,g(o.record),v(o.record.optimizedPrompt||``),ve(o.textCreditsCost),be(o.textTokensUsed),m(!0),Z.success({content:`「${_t}」提示词优化完成,消耗 ${o.textCreditsCost} 积分`,key:`optimize`})}catch(e){let t=e?.response?.data?.message||e?.message||`操作失败,请稍后重试`;Z.error(t)}finally{f(!1),localStorage.removeItem(`pending_optimize`),mt.current=null}},wt=(0,S.useRef)(new Set),Tt=(0,S.useRef)(null),Et=(0,S.useRef)(null),Dt=e=>{wt.current.add(e),At()},Ot=e=>{wt.current.delete(e),wt.current.size===0&&kt()},kt=()=>{Tt.current&&=(clearInterval(Tt.current),null),Et.current&&=(Et.current.abort(),null)},At=()=>{Tt.current||=setInterval(async()=>{try{Et.current&&Et.current.abort();let t=new AbortController;Et.current=t;let n=await E5({projectId:e,page:1,pageSize:100,signal:t.signal});Et.current=null;let r=Array.from(wt.current),i=[];if(r.length>0){let e=T7.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});T7.setState({records:{...e,items:t}}),i.forEach(e=>{let t=n.items.find(t=>t.id===e);Ot(e),t?.status===`completed`?(T(t=>({...t,[e]:`done`})),g(n=>n?.id===e?t:n),Z.success({content:`「${_t}」视频生成完成!`,key:e,duration:5})):t?.status===`failed`&&(T(t=>({...t,[e]:`failed`})),g(n=>n?.id===e?t:n),Z.error({content:`「${_t}」视频生成失败: ${t.errorMessage||`未知错误`}`,key:e,duration:5}))})}}catch(e){e.name}},5e3)},jt=e=>{Dt(e)};(0,S.useEffect)(()=>()=>{kt(),ut()},[]);let Mt=async e=>{if(!St){Z.error(`积分不足,请先充值`);return}C(t=>({...t,[e]:!0})),T(t=>({...t,[e]:`generating`})),Z.loading({content:`「${_t}」正在提交视频生成...`,duration:0,key:e});try{(await c(e,{aspectRatio:le,resolution:de})).status===`failed`?(T(t=>({...t,[e]:`failed`})),Z.error({content:`「${_t}」提交失败`,key:e,duration:3})):(Z.success({content:`「${_t}」已提交,正在生成中...`,key:e,duration:3}),jt(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),Z.error({content:`${n}`,key:e,duration:3})}finally{C(t=>({...t,[e]:!1}))}},Nt=async e=>{let t=gt.find(t=>t.id===e);if(t){C(t=>({...t,[e]:!0})),T(t=>({...t,[e]:`generating`})),Z.loading({content:`「${_t}」正在重新提交...`,duration:0,key:e});try{let n=E[e];n&&n!==t.optimizedPrompt&&await jie(e,n),(await c(e,{aspectRatio:t.aspectRatio||`16:9`,resolution:t.resolution||`720p`})).status===`failed`?(T(t=>({...t,[e]:`failed`})),Z.error({content:`「${_t}」提交失败`,key:e,duration:3})):(Z.success({content:`「${_t}」已提交,正在生成中...`,key:e,duration:3}),jt(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),Z.error({content:`${n}`,key:e,duration:3})}finally{C(t=>({...t,[e]:!1}))}}},Pt=e=>{let t=w[e.id];return t===`generating`?`generating`:t===`done`?`completed`:t===`failed`?`failed`:e.status},Ft={optimizing:{color:`processing`,text:`优化中`,icon:(0,$.jsx)(Xm,{style:{animation:`spinSlow 1s linear infinite`}})},prompt_optimized:{color:`processing`,text:`待生成`,icon:(0,$.jsx)(lV,{})},generating:{color:`warning`,text:`生成中`,icon:(0,$.jsx)(Xm,{style:{animation:`spinSlow 1s linear infinite`}})},completed:{color:`success`,text:`已完成`,icon:(0,$.jsx)(p4,{})},failed:{color:`error`,text:`失败`,icon:(0,$.jsx)(g4,{})}},It=({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)(XZ,{style:{fontSize:9,color:`#94a3b8`,transition:`transform 0.2s`,transform:i?`rotate(180deg)`:`rotate(0deg)`}})]}),d&&(0,Vi.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)(Q.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)]})},Lt=({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)(Q.Text,{style:{fontSize:12,color:t?`#6366f1`:`#64748b`,fontWeight:t?600:400},children:t||e.name}),(0,$.jsx)(XZ,{style:{fontSize:9,color:t?`#6366f1`:`#94a3b8`,transition:`transform 0.2s`,transform:n?`rotate(180deg)`:`rotate(0deg)`}})]}),l&&(0,Vi.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)(Q.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`,{style:{margin:`-24px -32px -32px`,borderRadius:20,height:`calc(100vh - 34px)`,padding:`24px`,background:`#fff`,overflowY:`auto`},children:[(0,$.jsxs)(`div`,{className:`gen-header animate-fadeInUp`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:24,padding:`16px 24px`,borderRadius:16,background:`rgba(255,255,255,0.6)`,backdropFilter:`blur(10px)`,border:`1px solid rgba(99, 102, 241, 0.08)`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16},children:[(0,$.jsx)(X,{icon:(0,$.jsx)(S2,{}),onClick:()=>t(`/projects`),style:{borderRadius:10,fontSize:13,height:32,background:`rgba(99, 102, 241, 0.1)`,border:`1px solid rgba(99, 102, 241, 0.2)`,color:`#6366f1`},children:`返回`}),(0,$.jsx)(`div`,{style:{width:32,height:2,background:`linear-gradient(90deg, transparent, #6366f1, #8b5cf6, transparent)`,borderRadius:1}}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,$.jsx)(Q.Title,{level:4,style:{margin:0,fontSize:16,fontWeight:700,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:_t}),ht&&(0,$.jsx)(ZQ,{style:{background:`rgba(99, 102, 241, 0.08)`,border:`1px solid rgba(99, 102, 241, 0.15)`,color:`#6366f1`,borderRadius:6},children:U[ht.industry]||ht.industry})]}),(0,$.jsx)(Q.Text,{style:{color:`#64748b`,fontSize:13},children:`描述视频 → AI优化 → 生成视频`})]}),(0,$.jsx)(`div`,{style:{width:32,height:2,background:`linear-gradient(90deg, transparent, #8b5cf6, #6366f1, transparent)`,borderRadius:1}})]}),(0,$.jsxs)(ZQ,{style:{background:`rgba(99, 102, 241, 0.08)`,border:`1px solid rgba(99, 102, 241, 0.15)`,color:`#6366f1`,borderRadius:20,fontSize:13,padding:`4px 14px`},children:[`剩余 `,yt,` 积分`]})]}),!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)(Q.Text,{style:{fontSize:14,fontWeight:500,color:`#475569`,marginRight:16},children:`生成类型:`}),(0,$.jsxs)(jI.Group,{defaultValue:`video`,buttonStyle:`solid`,onChange:rt,children:[(0,$.jsxs)(jI.Button,{value:`video`,children:[(0,$.jsx)(r5,{style:{marginRight:6,fontSize:14}}),` `,`视频`]}),(0,$.jsxs)(jI.Button,{value:`image`,style:{zIndex:0},children:[(0,$.jsx)(B6,{style:{marginRight:6,fontSize:14}}),` `,`图片`]})]})]}),xe===`video`&&[{icon:(0,$.jsx)(N$,{}),label:`描述视频+时长`,color:`#6366f1`},{icon:(0,$.jsx)(K8,{}),label:`AI智能优化`,color:`#8b5cf6`},{icon:(0,$.jsx)(p8,{}),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)(Q.Text,{style:{fontSize:13,fontWeight:500,color:`#1a1a2e`},children:e.label})]})]},t)),xe===`image`&&[{icon:(0,$.jsx)(N$,{}),label:`描述图片+尺寸`,color:`#6366f1`},{icon:(0,$.jsx)(K8,{}),label:`AI智能优化`,color:`#8b5cf6`},{icon:(0,$.jsx)(p8,{}),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)(Q.Text,{style:{fontSize:13,fontWeight:500,color:`#1a1a2e`},children:e.label})]})]},t))]})}),(0,$.jsxs)(nU,{form:n,initialValues:{},children:[(0,$.jsx)(nU.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`&&oe(`http://ceshi.apiforeign.minzhong.cn${e.url}`)},children:e.type===`image`?(0,$.jsx)(nW,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(V7,{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)(g4,{style:{color:`#fff`,fontSize:10}})})]},t)),(0,$.jsx)(B7,{accept:`image/*,video/*`,onLocalSelect:e=>{e.forEach(async e=>{await ze(e)})},onHistorySelect:e=>{e.forEach(e=>{N(t=>[...t,{url:e.resourceUrl||e.previewUrl||e.displayUrl||``,type:e.resourceType,name:e.fileName||``}])}),Z.success(`成功添加${e.length}个历史记录`)},onPortraitSelect:e=>{e.forEach(e=>{N(t=>[...t,{url:e.previewUrl||``,type:e.assetType===`Video`?`video`:`image`,name:e.name||`真人素材`,source:`private_portrait_asset`,private_asset_id:e.id,label:``,duration:e.assetType===`Video`?e.videoDuration||0:void 0}])}),Z.success(`已添加 ${e.length} 个真人素材参考`)},uploading:P,tooltipTitle:`图片${M.filter(e=>e.type===`image`).length}/5,视频${M.filter(e=>e.type===`video`).length}/2`,maxImageCount:5,maxVideoCount:2,usedImageCount:M.filter(e=>e.type===`image`).length,usedVideoCount:M.filter(e=>e.type===`video`).length,usedVideoDuration:M.filter(e=>e.type===`video`).reduce((e,t)=>e+(t.duration||0),0),maxVideoDuration:15,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)(Xm,{style:{fontSize:18,color:`#6366f1`}}):(0,$.jsx)(rL,{style:{fontSize:18,color:`#94a3b8`}})})})]}),(0,$.jsx)(`div`,{style:{padding:`8px 16px 4px`},children:(0,$.jsx)(LW.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)},onPaste:e=>{let t=e.clipboardData?.items;if(!t)return;let n=[];for(let e=0;e0&&(e.preventDefault(),n.forEach(async e=>{await ze(e)}))},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)(Y6,{style:{color:`#fff`,fontSize:14}})}),(0,$.jsx)(Q.Text,{style:{fontSize:13},children:e.name}),(0,$.jsx)(ZQ,{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:[xe!==`image`&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,flex:1,flexWrap:`wrap`},children:[(0,$.jsx)(It,{label:`时长`,value:`${se}`,options:he.durations.map(e=>`${e}`),suffix:`秒`,expanded:pe===`duration`,onToggle:()=>me(pe===`duration`?null:`duration`),onSelect:e=>ce(parseInt(e)),onClose:()=>me(null)}),vt.map((e,t)=>{let n=G===e.name,r=ne[e.name];return(0,$.jsx)(Lt,{group:e,selected:r,expanded:n,onToggle:()=>ie(n?null:e.name),onSelect:t=>{re(n=>{let r={...n};return r[e.name]===t?delete r[e.name]:r[e.name]=t,r})},onClose:()=>ie(null)},`og-${t}`)})]}),xe==`image`&&(0,$.jsxs)(`div`,{style:{position:`relative`,display:`inline-block`},children:[(0,$.jsxs)(`button`,{onClick:()=>Me(!je),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)(Q.Text,{style:{fontSize:13,fontWeight:600,color:`#374151`,marginRight:10},children:Ce===`auto`?`智能`:Ce}),(0,$.jsxs)(Q.Text,{style:{fontSize:12,color:`#9ca3af`},children:[Te==`2K`?`高清 2K`:`超清 4K`,`| `,De,`×`,ke]})]})}),(0,$.jsx)(XZ,{style:{fontSize:14,color:`#9ca3af`}})]}),je&&(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)(Q.Text,{style:{display:`block`,marginBottom:10,fontSize:13,fontWeight:500,color:`#666666`},children:`选择比例`}),(0,$.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6},children:We.map(e=>(0,$.jsxs)(`button`,{onClick:()=>{we(e.value),He(e.label)},style:{flex:`0 0 calc(11.11% - 5px)`,minWidth:48,height:56,borderRadius:8,border:Ce===e.value?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:Ce===e.value?`#fff`:`#f9fafb`,cursor:`pointer`,display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,transition:`all 0.2s`},children:[(0,$.jsx)(`div`,{style:{width:(()=>{let[t,n]=e.value===`auto`?[1,1]:e.value.split(`:`).map(Number);return t>=n?20:Math.round(t/n*20)})(),height:(()=>{let[t,n]=e.value===`auto`?[1,1]:e.value.split(`:`).map(Number);return n>=t?20:Math.round(n/t*20)})(),border:`2px solid ${Ce===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:Ce===e.value?`#6366f1`:`#9ca3af`},children:`智`})}),(0,$.jsx)(`span`,{style:{fontSize:10,color:Ce===e.value?`#6366f1`:`#6b7280`,fontWeight:Ce===e.value?600:400},children:e.value})]},e.value))})]}),(0,$.jsxs)(`div`,{style:{marginBottom:20},children:[(0,$.jsx)(Q.Text,{style:{display:`block`,marginBottom:10,fontSize:13,fontWeight:500,color:`#666666`},children:`选择分辨率`}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:8},children:Ke.map(e=>(0,$.jsx)(`button`,{onClick:()=>{Ee(e.value),Ue(e.label)},style:{flex:1,height:48,borderRadius:8,border:Te===e.value?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:Te===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:Te===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)(Q.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)(LW,{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)(`button`,{onClick:nt,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)(VU,{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)(LW,{value:ke,onChange:e=>Ae(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:[xe===`image`&&(0,$.jsx)(`span`,{style:{color:`#7c7c7c`,fontSize:14},children:`(请在左侧选择图片比例和尺寸)`}),(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:Ct,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)(DL,{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)(p4,{style:{color:`#10b981`,fontSize:22}}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:15,display:`block`},children:`提示词优化完成`}),(0,$.jsxs)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:[`文本优化消耗 `,_e,` 积分· 您可以编辑提示词后选择参数生成视频`]})]})]}):(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)(Xm,{style:{color:`#6366f1`,fontSize:18},spin:!0}),w[h.id]===`done`&&(0,$.jsx)(p4,{style:{color:`#10b981`,fontSize:18}}),w[h.id]===`failed`&&(0,$.jsx)(g4,{style:{color:`#ef4444`,fontSize:18}}),(0,$.jsxs)(Q.Text,{strong:!0,style:{fontSize:14,color:w[h.id]===`failed`?`#ef4444`:w[h.id]===`done`?`#10b981`:`#6366f1`},children:[w[h.id]===`generating`&&`${xe===`image`?`图片`:`视频`}生成中,请稍候...`,w[h.id]===`done`&&`${xe===`image`?`图片`:`视频`}生成成功`,w[h.id]===`failed`&&`${xe===`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)(Q.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)(Q.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)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:[`优化后的提示词`,` `,!y&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),!y&&(0,$.jsxs)(cH,{size:4,children:[(0,$.jsx)(gw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(n1,{}),onClick:async()=>{let e=await j7(_);Z.success(e?`已复制`:`复制失败`)},style:{color:`#94a3b8`}})}),(0,$.jsx)(gw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(N$,{}),onClick:()=>b(!0),style:{color:`#6366f1`}})})]})]}),y?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(LW.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)(X,{size:`small`,onClick:()=>{v(h.optimizedPrompt||``),b(!1)},children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{b(!1),Z.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)(Q.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)(Q.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)(Q.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)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:[`优化后的提示词`,` `,!y&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),!y&&(0,$.jsxs)(cH,{size:4,children:[(0,$.jsx)(gw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(n1,{}),onClick:async()=>{let e=await j7(_);Z.success(e?`已复制`:`复制失败`)},style:{color:`#94a3b8`}})}),(0,$.jsx)(gw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(N$,{}),onClick:()=>b(!0),style:{color:`#6366f1`}})})]})]}),y?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(LW.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)(X,{size:`small`,onClick:()=>{v(h.optimizedPrompt||``),b(!1)},children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{b(!1),Z.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)(Q.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)(Q.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)(Q.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:`生成图片`}),(0,$.jsx)(nW,{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:[xe!==`image`&&(0,$.jsxs)(`div`,{style:{marginTop:24,borderRadius:12,background:`#f8f9fc`,width:`25%`},children:[(0,$.jsx)(Q.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)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:`时长`}),(0,$.jsxs)(Q.Text,{strong:!0,style:{fontSize:13,color:`#6366f1`},children:[se,`s`]})]}),(0,$.jsx)(It,{label:`比例`,value:le,options:he.ratios,expanded:pe===`ratio`,onToggle:()=>me(pe===`ratio`?null:`ratio`),onSelect:e=>ue(e),onClose:()=>me(null)}),(0,$.jsx)(It,{label:`分辨率`,value:de,options:he.resolutions,expanded:pe===`resolution`,onToggle:()=>me(pe===`resolution`?null:`resolution`),onSelect:e=>fe(e),onClose:()=>me(null)})]})]}),xe==`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)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`,marginBottom:4},children:`分辨率`}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:`#1a1a2e`},children:h.imageSize||`-`})]}),(0,$.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`,marginBottom:4},children:`画面比例`}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:`#1a1a2e`},children:h.imageProportion||`-`})]}),(0,$.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`,marginBottom:4},children:`画面尺寸`}),(0,$.jsx)(Q.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)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`文字积分`}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:`#6366f1`},children:_e})]}),(0,$.jsx)(Q.Text,{style:{color:`#cbd5e1`,fontSize:18},children:`+`}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:[`预估`,xe===`image`?`图片`:`视频`,`积分`]}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:`#10b981`},children:xe===`image`&&h.imageSize?bt(h.imageSize)||xt:Be(se,de)})]}),(0,$.jsx)(Q.Text,{style:{color:`#cbd5e1`,fontSize:18},children:`=`}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`总计`}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:16,color:`#1a1a2e`},children:(_e+(xe===`image`?bt(h.imageSize):Be(se,de))).toFixed(2)})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:12},children:[(0,$.jsxs)(X,{size:`large`,onClick:()=>{m(!1),g(null),v(``),L(``),N([]),re({}),ie(null),me(null),n.resetFields()},style:{borderRadius:12,minWidth:120,height:44,fontWeight:500},children:[`配置新`,xe===`image`?`图片`:`视频`]}),(0,$.jsx)(gw,{title:St?``:`积分不足`,children:(0,$.jsx)(X,{type:`primary`,size:`large`,icon:(0,$.jsx)(p8,{}),onClick:()=>Mt(h.id),loading:w[h.id]===`generating`,disabled:!St||w[h.id]===`generating`||w[h.id]===`done`,style:{borderRadius:12,minWidth:180,height:44,fontWeight:600,background:w[h.id]===`done`?`#10b981`:St?`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`:`#d1d5db`,border:`none`,boxShadow:St?`0 8px 24px rgba(99,102,241,0.3)`:`none`},children:w[h.id]===`done`?`生成完成`:w[h.id]===`generating`?`生成中...`:`生成${xe===`image`?`图片`:`视频`} (${xe===`image`?bt(h.imageSize):Be(se,de)}积分)`})})]})]}),h.references&&h.references.length>0&&(0,$.jsxs)(`div`,{style:{marginTop:16},children:[(0,$.jsx)(Q.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`&&oe(`http://ceshi.apiforeign.minzhong.cn${e.url}`)},children:[e.type===`image`?(0,$.jsx)(nW,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`},preview:!0}):(0,$.jsx)(V7,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,width:64,height:64}),(0,$.jsx)(ZQ,{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))})]})]}),gt.length>0&&(0,$.jsxs)(`div`,{style:{marginTop:24},children:[(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:15,display:`block`,marginBottom:12},children:`本项目生成记录`}),(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8,background:`#fff`,borderRadius:12,padding:8,border:`1px solid #f0f0f5`},className:`stagger-children`,children:gt.map((e,t)=>{let n=Pt(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?`8px 8px 0 0`:8,background:`#fafafa`,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)(B6,{style:{color:`#d97706`,fontSize:12}}):(0,$.jsx)(r5,{style:{color:`#2563eb`,fontSize:12}})}),i?(0,$.jsx)(XZ,{style:{color:`#6366f1`,fontSize:11,flexShrink:0}}):(0,$.jsx)(u4,{style:{color:`#cbd5e1`,fontSize:11,flexShrink:0}}),(0,$.jsx)(ZQ,{color:Ft[n]?.color,icon:Ft[n]?.icon,style:{margin:0},children:Ft[n]?.text}),(0,$.jsx)(Q.Text,{style:{flex:1,fontSize:13,color:`#475569`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r}),n===`prompt_optimized`&&(0,$.jsx)(ZQ,{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:D7(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:D7(e.createdAt)})]}),(0,$.jsx)(`div`,{className:`record-actions`,onClick:e=>e.stopPropagation(),children:(0,$.jsx)(cH,{children:n===`failed`&&(0,$.jsx)(X,{type:`primary`,danger:!0,size:`small`,icon:(0,$.jsx)(Y6,{}),loading:x[e.id],onClick:()=>Nt(e.id),style:{borderRadius:8},children:`重试`})})})]}),i&&(0,$.jsx)(`div`,{style:{background:`#fff`,borderRadius:`0 0 8px 8px`,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)(Q.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)(Q.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)(Q.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)(cH,{size:4,children:[(0,$.jsx)(gw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(n1,{}),onClick:async()=>{let e=await j7(r);Z.success(e?`已复制`:`复制失败`)},style:{color:`#94a3b8`}})}),(n===`prompt_optimized`||n===`failed`)&&(0,$.jsx)(gw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(N$,{}),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)(LW.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)(X,{size:`small`,onClick:()=>k(null),children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{D(t=>({...t,[e.id]:r})),k(null),Z.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)(Q.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)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:e.label}),(0,$.jsx)(Q.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)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:e.label}),(0,$.jsx)(Q.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)(Q.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`&&oe(`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)(nW,{src:`http://ceshi.apiforeign.minzhong.cn${t.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`},preview:!0}):(0,$.jsx)(V7,{src:`http://ceshi.apiforeign.minzhong.cn${t.url}`,width:64,height:64})}),(0,$.jsx)(ZQ,{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);T7.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)(g4,{style:{color:`#fff`,fontSize:10}})})]},r)),n===`failed`&&(0,$.jsx)(x0,{accept:`image/*,video/*`,showUploadList:!1,multiple:!0,beforeUpload:t=>{let n=t.type.startsWith(`image/`),r=t.type.startsWith(`video/`);return!n&&!r?(Z.error(`仅支持图片或视频文件`),!1):(n?O5(t).then(n=>{let r={url:n.url,type:`image`,name:t.name||`图片`},i=e.references||[];T7.getState().updateRecordReferences(e.id,[...i,r]),Z.success(`上传成功`)}).catch(()=>Z.error(`上传失败`)):new Promise(e=>{let n=document.createElement(`video`);n.preload=`metadata`,n.onloadedmetadata=()=>{e(n.duration||0),n.remove()},n.onerror=()=>{e(0),n.remove()},n.src=URL.createObjectURL(t)}).then(n=>{k5(t,n).then(r=>{let i={url:r.url,type:`video`,name:t.name||`视频`,duration:n||void 0},a=e.references||[];T7.getState().updateRecordReferences(e.id,[...a,i]),Z.success(`上传成功`)}).catch(()=>Z.error(`上传失败`))}),!1)},children:(0,$.jsx)(gw,{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)(rL,{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)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:`时长`}),(0,$.jsxs)(Q.Text,{strong:!0,style:{fontSize:13,color:`#6366f1`},children:[e.duration,`秒`]})]}),(0,$.jsx)(It,{label:`比例`,value:K[e.id]?.aspectRatio||`选择比例`,options:he.ratios,expanded:pe===`ratio-${e.id}`,onToggle:()=>me(pe===`ratio-${e.id}`?null:`ratio-${e.id}`),onSelect:t=>ae(n=>({...n,[e.id]:{...n[e.id],aspectRatio:t,resolution:n[e.id]?.resolution||``}})),onClose:()=>me(null)}),(0,$.jsx)(It,{label:`分辨率`,value:K[e.id]?.resolution||`选择分辨率`,options:he.resolutions,expanded:pe===`res-${e.id}`,onToggle:()=>me(pe===`res-${e.id}`?null:`res-${e.id}`),onSelect:t=>ae(n=>({...n,[e.id]:{...n[e.id],aspectRatio:n[e.id]?.aspectRatio||``,resolution:t}})),onClose:()=>me(null)})]}),(0,$.jsxs)(X,{type:`primary`,size:`large`,icon:(0,$.jsx)(p8,{}),block:!0,loading:x[e.id],disabled:a===`video`&&(!K[e.id]?.aspectRatio||!K[e.id]?.resolution),onClick:async()=>{let t=K[e.id];if(a===`video`){if(!t?.aspectRatio||!t?.resolution){Z.error(`请选择比例和分辨率`);return}if(yt({...t,[e.id]:!0})),T(t=>({...t,[e.id]:`generating`}));let n=a===`video`?`视频`:`图片`;Z.loading({content:`「${_t}」正在生成${n}...`,duration:0,key:e.id});try{await c(e.id,{aspectRatio:t?.aspectRatio,resolution:t?.resolution}),T(t=>({...t,[e.id]:`done`})),Z.success({content:`「${_t}」${n}生成成功!`,key:e.id,duration:3})}catch{T(t=>({...t,[e.id]:`failed`})),Z.error({content:`「${_t}」${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`&&K[e.id]?.resolution?`(${Be(e.duration||5,K[e.id].resolution)}积分)`:``,a===`image`&&e.imageSize?`(${Ve(e.imageSize)}积分)`:a===`image`?`(积分)`:``]})]}),n===`failed`&&(0,$.jsx)(`div`,{style:{position:`absolute`,bottom:18,right:20},children:(0,$.jsxs)(X,{type:`primary`,danger:!0,size:`large`,icon:(0,$.jsx)(Y6,{}),block:!0,loading:x[e.id],onClick:()=>Nt(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)(Xm,{style:{color:`#6366f1`,fontSize:28},spin:!0}),(0,$.jsxs)(Q.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)(gw,{title:`下载${a===`video`?`视频`:`图片`}`,children:(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(h0,{}),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)(cH,{children:[a===`video`?(0,$.jsx)(r5,{style:{color:`#6366f1`,fontSize:13}}):(0,$.jsx)(B6,{style:{color:`#6366f1`,fontSize:13}}),(0,$.jsx)(Q.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:D7(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)(g4,{style:{color:`#ef4444`,fontSize:28}}),(0,$.jsxs)(Q.Text,{style:{color:`#ef4444`,fontSize:14,fontWeight:600},children:[a===`video`?`视频`:`图片`,`生成失败`]}),e.errorMessage&&(0,$.jsx)(Q.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)(lV,{style:{color:`#94a3b8`,fontSize:28}}),(0,$.jsx)(Q.Text,{style:{color:`#94a3b8`,fontSize:13},children:a===`image`?`待生成图片`:n===`prompt_optimized`?`待配置视频参数`:`待生成视频`})]})]})]})})]},e.id)})})]}),(0,$.jsx)(hK,{open:!!q,onCancel:()=>oe(null),footer:null,width:480,centered:!0,destroyOnHidden:!0,closable:!1,title:null,styles:{body:{padding:0,background:`#000`,position:`relative`}},children:q&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`video`,{src:q,controls:!0,autoPlay:!0,style:{width:`100%`,display:`block`,maxHeight:`70vh`}}),(0,$.jsx)(`div`,{onClick:()=>oe(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)(u5,{style:{color:`#fff`,fontSize:16}})})]})})]})},H7={optimizing:{color:`processing`,text:`优化中`,icon:(0,$.jsx)(Xm,{spin:!0})},prompt_optimized:{color:`processing`,text:`待生成`,icon:(0,$.jsx)(lV,{})},generating:{color:`warning`,text:`生成中`,icon:(0,$.jsx)(Xm,{spin:!0})},completed:{color:`success`,text:`已完成`,icon:(0,$.jsx)(p4,{})},failed:{color:`error`,text:`失败`,icon:(0,$.jsx)(g4,{})}},hoe=()=>{let e=Ye(),{records:t,projects:n,fetchRecords:r,fetchProjects:i,generateVideo:a}=T7(),o=t.items,[s,c]=(0,S.useState)(1),[l,u]=(0,S.useState)(10),[d,f]=(0,S.useState)({}),[p,m]=(0,S.useState)(void 0),[h,g]=(0,S.useState)(void 0),[_,v]=(0,S.useState)({}),[y,b]=(0,S.useState)(null),[x,C]=(0,S.useState)(null),[w,T]=(0,S.useState)(null);(0,S.useEffect)(()=>{i()},[i]),(0,S.useEffect)(()=>{r({projectId:p,status:h,page:s,pageSize:l})},[r,p,h,s,l]);let E=async()=>{if(!w)return;let{recordId:e,projectName:t,ratio:n,resolution:r}=w;f(t=>({...t,[e]:!0})),T(null),Z.loading({content:`「${t}」正在生成视频...`,duration:0,key:e});try{await a(e,{aspectRatio:n,resolution:r}),Z.success({content:`「${t}」视频生成成功!`,key:e,duration:3})}catch{Z.error({content:`「${t}」视频生成失败`,key:e,duration:3})}finally{f(t=>({...t,[e]:!1}))}},D=e=>{if((e.genType||`image`)===`image`){f(t=>({...t,[e.id]:!0})),Z.loading({content:`「${e.projectName}」正在生成图片...`,duration:0,key:e.id}),a(e.id,{}).then(()=>{Z.success({content:`「${e.projectName}」图片生成成功!`,key:e.id,duration:3})}).catch(()=>{Z.error({content:`「${e.projectName}」图片生成失败`,key:e.id,duration:3})}).finally(()=>{f(t=>({...t,[e.id]:!1}))});return}T({recordId:e.id,projectName:e.projectName,ratio:e.aspectRatio||`16:9`,resolution:e.resolution||`720p`})},O=o;return(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:20,padding:`16px 24px`,borderRadius:16,background:`rgba(255,255,255,0.6)`,backdropFilter:`blur(10px)`,border:`1px solid rgba(99, 102, 241, 0.08)`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16},children:[(0,$.jsx)(X,{icon:(0,$.jsx)(S2,{}),onClick:()=>e(`/projects`),style:{borderRadius:10,fontSize:13,height:32,background:`rgba(99, 102, 241, 0.1)`,border:`1px solid rgba(99, 102, 241, 0.2)`,color:`#6366f1`},children:`返回`}),(0,$.jsx)(`div`,{style:{width:32,height:2,background:`linear-gradient(90deg, transparent, #6366f1, #8b5cf6, transparent)`,borderRadius:1}}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Title,{level:2,style:{margin:0,fontSize:16,fontWeight:700,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:`项目记录`}),(0,$.jsx)(Q.Text,{style:{fontSize:13,color:`#64748b`},children:`查看所有视频生成记录,点击记录查看完整内容和视频`})]}),(0,$.jsx)(`div`,{style:{width:32,height:2,background:`linear-gradient(90deg, transparent, #8b5cf6, #6366f1, transparent)`,borderRadius:1}})]})}),(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)(cH,{children:[(0,$.jsx)(i3,{style:{color:`#94a3b8`}}),(0,$.jsx)(EC,{placeholder:`全部项目`,allowClear:!0,style:{width:200},onChange:e=>{m(e),c(1)},children:n.map(e=>(0,$.jsx)(EC.Option,{value:e.id,children:e.name},e.id))}),(0,$.jsxs)(EC,{placeholder:`全部状态`,allowClear:!0,style:{width:140},onChange:e=>{g(e),c(1)},children:[(0,$.jsx)(EC.Option,{value:`prompt_optimized`,children:`待生成`}),(0,$.jsx)(EC.Option,{value:`generating`,children:`生成中`}),(0,$.jsx)(EC.Option,{value:`completed`,children:`已完成`}),(0,$.jsx)(EC.Option,{value:`failed`,children:`失败`})]})]}),(0,$.jsxs)(Q.Text,{style:{marginLeft:`auto`,lineHeight:`32px`,color:`#94a3b8`,fontSize:13},children:[`共 `,t.total,` 条记录`]})]}),O.length===0?(0,$.jsx)(XS,{image:XS.PRESENTED_IMAGE_SIMPLE,description:`暂无生成记录`,style:{padding:60}}):(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},className:`stagger-children`,children:O.map((e,t)=>{let n=y===e.id,r=_[e.id]??e.optimizedPrompt,i=d[e.id],a=x===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:()=>C(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)(B6,{style:{color:`#d97706`,fontSize:12}}):(0,$.jsx)(r5,{style:{color:`#2563eb`,fontSize:12}})}),a?(0,$.jsx)(XZ,{style:{color:`#6366f1`,fontSize:12,flexShrink:0}}):(0,$.jsx)(u4,{style:{color:`#cbd5e1`,fontSize:12,flexShrink:0}}),(0,$.jsx)(ZQ,{color:H7[e.status].color,icon:H7[e.status].icon,style:{margin:0},children:H7[e.status].text}),(0,$.jsx)(ZQ,{style:{background:`#f0f0ff`,border:`none`,color:`#6366f1`,margin:0},children:e.projectName}),(0,$.jsx)(Q.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:D7(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:D7(e.createdAt)})]}),(0,$.jsx)(`div`,{className:`record-actions`,onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(cH,{children:[e.status===`prompt_optimized`&&(0,$.jsx)(X,{type:`primary`,size:`small`,icon:(0,$.jsx)(Y6,{}),loading:i,onClick:()=>D(e),style:{borderRadius:8,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`},children:`生成`}),e.status===`generating`&&(0,$.jsx)(ZQ,{color:`processing`,icon:(0,$.jsx)(Xm,{spin:!0}),style:{padding:`4px 12px`,fontSize:12},children:`生成中...`}),e.status===`failed`&&(0,$.jsx)(X,{type:`primary`,danger:!0,size:`small`,icon:(0,$.jsx)(Y6,{}),loading:i,onClick:()=>D(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)(Q.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)(Q.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)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:[`优化后的提示词 `,e.status===`prompt_optimized`&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),!n&&(0,$.jsxs)(cH,{size:4,children:[(0,$.jsx)(gw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(n1,{}),onClick:async()=>{let e=await j7(r);Z.success(e?`已复制`:`复制失败`)},style:{color:`#94a3b8`}})}),e.status===`prompt_optimized`&&(0,$.jsx)(gw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(N$,{}),onClick:()=>{b(e.id),v(t=>({...t,[e.id]:t[e.id]??e.optimizedPrompt}))},style:{color:`#6366f1`}})})]})]}),n?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(LW.TextArea,{value:r,onChange:t=>v(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)(X,{size:`small`,onClick:()=>b(null),children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{v(t=>({...t,[e.id]:r})),b(null),Z.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)(Q.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)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:e.label}),(0,$.jsx)(Q.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)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:e.label}),(0,$.jsx)(Q.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)(X,{type:`primary`,size:`large`,icon:(0,$.jsx)(p8,{}),loading:i,onClick:()=>D(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)(X,{type:`primary`,danger:!0,size:`large`,icon:(0,$.jsx)(Y6,{}),loading:i,onClick:()=>D(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)(Xm,{style:{color:`#6366f1`,fontSize:32},spin:!0}),(0,$.jsxs)(Q.Text,{style:{color:`#94a3b8`,fontSize:14},children:[o===`video`?`视频`:`图片`,`生成中...`]}),(0,$.jsx)(Q.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)(gw,{title:`下载${o===`video`?`视频`:`图片`}`,children:(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(h0,{}),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)(cH,{children:[o===`video`?(0,$.jsx)(r5,{style:{color:`#6366f1`}}):(0,$.jsx)(B6,{style:{color:`#6366f1`}}),(0,$.jsx)(Q.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:[`生成于 `,D7(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)(g4,{style:{color:`#ef4444`,fontSize:32}}),(0,$.jsxs)(Q.Text,{style:{color:`#ef4444`,fontSize:14},children:[o===`video`?`视频`:`图片`,`生成失败`]}),(0,$.jsx)(Q.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)(lV,{style:{color:`#94a3b8`,fontSize:32}}),(0,$.jsxs)(Q.Text,{style:{color:`#94a3b8`,fontSize:14},children:[`待生成`,o===`video`?`视频`:`图片`]}),(0,$.jsx)(Q.Text,{style:{color:`#cbd5e1`,fontSize:12},children:`点击左侧生成按钮开始生成`})]})})]})})]},e.id)})}),t.total>0&&(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:18},children:(0,$.jsx)(CG,{current:t.page||s,pageSize:t.pageSize||l,total:t.total,showSizeChanger:!0,showTotal:e=>`共 ${e} 条记录`,onChange:(e,t)=>{c(e),u(t)}})}),(0,$.jsx)(hK,{title:(0,$.jsxs)(cH,{children:[(0,$.jsx)(p8,{}),`生成视频`]}),open:!!w,onCancel:()=>T(null),onOk:E,okText:`提交生成`,cancelText:`取消`,width:420,children:w&&(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16,marginTop:16},children:(()=>{let e=o.find(e=>e.id===w.recordId);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`时长`}),(0,$.jsxs)(Q.Text,{strong:!0,children:[e?.duration||5,`秒`]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#64748b`,display:`block`,marginBottom:6},children:`画面比例`}),(0,$.jsx)(EC,{value:w.ratio,onChange:e=>T(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)(Q.Text,{style:{fontSize:12,color:`#64748b`,display:`block`,marginBottom:6},children:`分辨率`}),(0,$.jsx)(EC,{value:w.resolution,onChange:e=>T(t=>t?{...t,resolution:e}:null),style:{width:`100%`},options:[`480p`,`720p`,`1080p`].map(e=>({value:e,label:e}))})]})]})})()})})]})},U7=({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()})},goe=()=>{let{user:e}=y7(),[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 M5(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)(Xq,{gutter:[16,16],style:{marginBottom:24},children:[(0,$.jsx)(YR,{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)(cH,{style:{marginBottom:10},children:[(0,$.jsx)(a5,{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)(U7,{value:e?.credits??0})})]})]})}),(0,$.jsx)(YR,{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)(cH,{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)(O2,{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)(U7,{value:f})})]})}),(0,$.jsx)(YR,{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)(cH,{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)(y2,{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)(U7,{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)(K8,{style:{color:`#6366f1`,fontSize:16}}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:16},children:`积分明细`})]}),(0,$.jsx)(`div`,{style:{borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,overflow:`hidden`},children:(0,$.jsx)(RQ,{columns:[{title:`类型`,dataIndex:`type`,key:`type`,width:100,render:e=>(0,$.jsx)(ZQ,{color:e===`recharge`?`green`:`orange`,icon:e===`recharge`?(0,$.jsx)(O2,{}):(0,$.jsx)(y2,{}),children:e===`recharge`?`充值`:`消费`})},{title:`积分变动`,dataIndex:`amount`,key:`amount`,width:120,render:e=>(0,$.jsxs)(Q.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:D7(e)})}],dataSource:t,rowKey:`id`,loading:r,pagination:{current:a,pageSize:s,total:l,onChange:d,showSizeChanger:!0,showTotal:e=>`共 ${e} 条`},scroll:{x:500}})})]})]})},_oe=()=>{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 M5(c,u);r(e.records||[]),a(e.credits||0),s(e.total||0)}catch{r([])}t(!1)};return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(Xq,{gutter:[16,16],style:{marginBottom:24},children:[(0,$.jsx)(YR,{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)(a5,{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)(YR,{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)(Q6,{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)(YR,{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)(K8,{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)(K8,{style:{color:`#f59e0b`,fontSize:16}}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:16},children:`积分明细`})]}),(0,$.jsx)(`div`,{style:{borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,overflow:`hidden`},children:(0,$.jsx)(WG,{spinning:e,children:n.length===0?(0,$.jsx)(XS,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无积分变动记录`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(RQ,{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)`},team_internal:{color:`#0958d9`,label:`团队内部`,bg:`rgba(139,92,246,0.1)`}}[e]||{color:`#64748b`,label:e,bg:`rgba(100,116,139,0.1)`};return(0,$.jsx)(ZQ,{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)(Q.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)(CG,{current:c,pageSize:u,total:o,onChange:e=>{l(e)},size:`small`})})]})})})]})]})},voe=()=>{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 zie(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)(pH,{style:{color:`#0ea5e9`,fontSize:16}}),(0,$.jsx)(Q.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)(WG,{spinning:e,children:n.length===0?(0,$.jsx)(XS,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无订单记录`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(RQ,{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)(u2,{style:{fontSize:16}}),label:`支付宝`,color:`#1677ff`},wechat:{icon:(0,$.jsx)(c5,{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)(Q.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)(Q.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)(ZQ,{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)(CG,{current:o,pageSize:c,total:i,onChange:e=>{s(e)},size:`small`})})]})})})]})})},yoe=()=>{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 F5(c,u);r(e.items||[]),s(e.total||0)}catch{r([])}t(!1)},f=async()=>{try{a(await I5())}catch{a(0)}},p=async e=>{try{await L5(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)(U2,{style:{color:`#6366f1`,fontSize:16}}),(0,$.jsx)(Q.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)(WG,{spinning:e,children:n.length===0?(0,$.jsx)(XS,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无消息`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(RQ,{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)(T8,{style:{fontSize:14}})},credit:{color:`#f59e0b`,label:`积分`,bg:`rgba(245,158,11,0.1)`,icon:(0,$.jsx)(a5,{style:{fontSize:14}})},promo:{color:`#8b5cf6`,label:`活动`,bg:`rgba(139,92,246,0.1)`,icon:(0,$.jsx)(g3,{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)(ZQ,{color:`gray`,style:{background:`rgba(148,163,184,0.1)`},children:`已读`}):(0,$.jsx)(ZQ,{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)(X,{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)(CG,{current:c,pageSize:u,total:o,onChange:e=>{l(e)},size:`small`})})]})})})]})})},W7=()=>{let[e]=On(),[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)(TL,{activeKey:t,onChange:n,items:[{key:`credits`,label:`积分明细`},{key:`orders`,label:`订单记录`}],style:{marginBottom:24},size:`large`}),t===`credits`&&(0,$.jsx)(_oe,{}),t===`orders`&&(0,$.jsx)(voe,{})]})},boe=`/assets/bg1-CQh9PRPW.png`,xoe=(e,t)=>e<=1?6:e===2||e===4?3:e===3?t<2?3:6:t<3?2:3,Soe=e=>{let t=e.displayStatus||e.pipelineStage||e.status||`generating`;return{pending:`待处理`,queued:`排队中`,preparing:`准备中`,generating:`生成中`,creating_provider_task:`创建任务中`,waiting_remote:`等待生成`,polling:`轮询中`,result_ready:`结果就绪`,download_queued:`等待下载`,downloading:`下载中`,retry_waiting:`等待重试`,completed:`已完成`,failed:`生成失败`,download_failed:`下载失败`,deleted:`已删除`}[t]||t},G7=e=>{let t=e.displayStatus||e.pipelineStage||e.status;return!t||[`pending`,`queued`,`preparing`,`generating`,`creating_provider_task`,`waiting_remote`,`polling`,`result_ready`,`download_queued`,`downloading`,`retry_waiting`].includes(t)},Coe=({task:e,onPreview:t,resolveUrl:n=e=>e||``})=>{let r=Math.max(1,Math.min(5,Number(e.generationCount||e.childItems?.length||1))),i=[...e.childItems||[]].sort((e,t)=>Number(e.generationIndex||0)-Number(t.generationIndex||0)),a=i.length>0?i:r>1?Array.from({length:r},(t,n)=>({id:`${e.id||`task`}-placeholder-${n+1}`,genType:e.genType,status:e.status,displayStatus:e.displayStatus,pipelineStage:e.pipelineStage,generationIndex:n+1,errorMessage:e.errorMessage})):[e];return(0,$.jsx)(`div`,{style:{width:`100%`,height:`100%`,display:`grid`,gridTemplateColumns:`repeat(6, minmax(0, 1fr))`,gridAutoRows:`minmax(0, 1fr)`,gap:r>1?4:0},children:a.slice(0,5).map((r,i)=>{let o=r.displayStatus||r.pipelineStage||r.status||`generating`,s=n(r.imageUrl),c=n(r.videoUrl),l=n(r.videoCoverUrl),u=(r.genType||e.genType)===`video`,d=u?!!c:!!s;return(0,$.jsxs)(`div`,{style:{gridColumn:`span ${xoe(a.length,i)}`,minWidth:0,minHeight:0,position:`relative`,overflow:`hidden`,borderRadius:a.length===1?12:8,background:`linear-gradient(135deg, #ffffff 0%, #FAFBFC 100%)`,border:a.length===1?`none`:`1px solid #E7EAF0`},children:[d&&o!==`deleted`?(0,$.jsxs)(`button`,{type:`button`,onClick:()=>t(u?c:s,u?`video`:`image`),style:{width:`100%`,height:`100%`,border:0,padding:0,background:`transparent`,cursor:`pointer`,position:`relative`},children:[u?l?(0,$.jsx)(`img`,{src:l,alt:`生成结果${r.generationIndex||i+1}`,style:{width:`100%`,height:`100%`,objectFit:`contain`}}):(0,$.jsx)(`video`,{src:c,muted:!0,preload:`metadata`,style:{width:`100%`,height:`100%`,objectFit:`contain`}}):(0,$.jsx)(`img`,{src:s,alt:`生成结果${r.generationIndex||i+1}`,style:{width:`100%`,height:`100%`,objectFit:`contain`}}),u?(0,$.jsx)(K6,{style:{position:`absolute`,left:`50%`,top:`50%`,transform:`translate(-50%, -50%)`,fontSize:a.length>2?28:46,color:`rgba(255,255,255,.92)`,filter:`drop-shadow(0 4px 10px rgba(0,0,0,.28))`}}):null]}):(0,$.jsxs)(`div`,{style:{width:`100%`,height:`100%`,minHeight:0,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:7,padding:8,textAlign:`center`},children:[G7(r)?(0,$.jsx)(Xm,{spin:!0,style:{color:`#8b5cf6`,fontSize:a.length>2?20:34}}):(0,$.jsx)(eie,{style:{color:o===`deleted`?`#98A2B3`:`#A45B5B`,fontSize:a.length>2?20:34}}),(0,$.jsx)(`span`,{style:{fontSize:a.length>2?10:12,color:G7(r)?`#8b5cf6`:o===`deleted`?`#98A2B3`:`#A45B5B`,fontWeight:500},children:Soe(r)}),!G7(r)&&r.errorMessage&&a.length<=2?(0,$.jsx)(`span`,{style:{fontSize:10,color:`#A45B5B`,lineHeight:1.3,maxHeight:28,overflow:`hidden`},children:r.errorMessage}):null]}),a.length>1?(0,$.jsxs)(`span`,{style:{position:`absolute`,top:5,left:5,zIndex:2,padding:`1px 6px`,borderRadius:10,background:`rgba(17,24,39,.58)`,color:`#fff`,fontSize:10},children:[`#`,r.generationIndex||i+1]}):null]},r.id||`${i}`)})})},{Text:K7}=Q,woe=({items:e,selectedId:t,onSelect:n})=>e.length?(0,$.jsx)(cH,{orientation:`vertical`,style:{width:`100%`},size:10,children:e.map(e=>{let r=t===e.id;return(0,$.jsxs)(`div`,{onClick:()=>n(e),style:{padding:14,borderRadius:14,cursor:`pointer`,border:r?`1px solid #8b5cf6`:`1px solid #e2e8f0`,background:r?`#f5f3ff`:`#fff`},children:[(0,$.jsx)(cH,{style:{width:`100%`,justifyContent:`space-between`},align:`start`,children:(0,$.jsxs)(`div`,{style:{minWidth:0},children:[(0,$.jsx)(K7,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name}),e.description&&(0,$.jsx)(K7,{type:`secondary`,ellipsis:!0,style:{display:`block`,fontSize:12},children:e.description})]})}),(0,$.jsxs)(cH,{wrap:!0,size:4,style:{marginTop:10},children:[(0,$.jsxs)(ZQ,{children:[`总 `,e.assetCount||0]}),(0,$.jsxs)(ZQ,{color:`green`,children:[`图 `,e.imageAssetCount||0]}),(0,$.jsxs)(ZQ,{color:`blue`,children:[`视频 `,e.videoAssetCount||0]})]})]},e.id)})}):(0,$.jsx)(XS,{description:`暂无项目组`}),Toe={Active:`green`,Processing:`processing`,Failed:`red`,local_deleted:`default`,remote_deleted:`default`,delete_failed:`red`},Eoe={Active:`入库成功`,Processing:`入库处理中`,Failed:`入库失败`,local_deleted:`本地已删除`,remote_deleted:`远程已删除`,delete_failed:`删除失败`},q7=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,J7=e=>e.assetType===`Video`?q7(e.videoCoverUrl||e.previewUrl||e.displayUrl||e.remoteUrl||e.sourceUrl):q7(e.previewUrl||e.displayUrl||e.videoCoverUrl||e.remoteUrl||e.sourceUrl),Doe=e=>{let t=Number(e||0);return!Number.isFinite(t)||t<=0?`-`:`${t.toFixed(t>=10?0:1)}s`},Ooe=({items:e,onDelete:t,onRefresh:n})=>{let r=(0,S.useRef)(null),[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)(``),[c,l]=(0,S.useState)(`Image`);(0,S.useEffect)(()=>(e.some(e=>e.status!==`Failed`&&e.status!==`Active`)&&n?r.current||=window.setInterval(()=>{n()},3e3):r.current&&=(clearInterval(r.current),null),()=>{r.current&&=(clearInterval(r.current),null)}),[e,n]);let u=e=>{let t=J7(e);t&&(s(t),l(e.assetType===`Video`?`Video`:`Image`),a(!0))};return e.length?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(220px, 1fr))`,gap:14},children:e.map(e=>{let n=e.assetType===`Video`,r=J7(e);return(0,$.jsx)(DL,{hoverable:!0,bodyStyle:{padding:12},style:{borderRadius:16,overflow:`hidden`,borderColor:`#eef2f7`},cover:(0,$.jsxs)(`div`,{style:{height:170,background:`#f8fafc`,display:`flex`,alignItems:`center`,justifyContent:`center`,position:`relative`},children:[r?n&&e.videoCoverUrl?(0,$.jsx)(`img`,{src:r,alt:e.name||`视频封面`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):n?(0,$.jsx)(`video`,{src:r,muted:!0,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(`img`,{src:r,alt:e.name||``,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):n?(0,$.jsx)(r5,{style:{fontSize:42,color:`#64748b`}}):(0,$.jsx)(B6,{style:{fontSize:42,color:`#64748b`}}),n&&(0,$.jsx)(ZQ,{color:`blue`,style:{position:`absolute`,left:10,top:10},children:`视频`}),r&&(0,$.jsx)(X,{size:`small`,shape:`circle`,icon:(0,$.jsx)(hW,{}),style:{position:`absolute`,right:10,top:10},onClick:()=>u(e)}),n&&(0,$.jsx)(`div`,{style:{position:`absolute`,left:10,bottom:10,padding:`2px 6px`,borderRadius:8,background:`rgba(15,23,42,0.72)`,color:`#fff`,fontSize:12},children:Doe(e.videoDuration)})]}),children:(0,$.jsxs)(cH,{direction:`vertical`,size:8,style:{width:`100%`},children:[(0,$.jsx)(gw,{title:e.name||e.remoteAssetId||e.id,children:(0,$.jsx)(`div`,{style:{fontWeight:600,color:`#1e293b`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.name||e.remoteAssetId||`未命名素材`})}),(0,$.jsxs)(cH,{wrap:!0,size:4,children:[(0,$.jsx)(ZQ,{color:Toe[e.status]||`default`,children:Eoe[e.status]||e.status}),(0,$.jsx)(ZQ,{color:n?`blue`:`default`,children:n?`视频`:`图片`})]}),(0,$.jsx)(cH,{size:6,wrap:!0,children:(0,$.jsx)(yK,{title:`确认删除这个素材吗?`,onConfirm:()=>t(e.id),children:(0,$.jsx)(X,{size:`small`,danger:!0,icon:(0,$.jsx)(d$,{}),children:`删除`})})})]})},e.id)})}),(0,$.jsx)(hK,{title:`素材预览`,open:i,onCancel:()=>a(!1),footer:null,width:760,destroyOnClose:!0,children:(0,$.jsx)(`div`,{style:{minHeight:420,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#0f172a`,borderRadius:12,overflow:`hidden`},children:c===`Video`?(0,$.jsx)(`video`,{src:o,controls:!0,autoPlay:!0,style:{maxWidth:`100%`,maxHeight:520}}):(0,$.jsx)(`img`,{src:o,alt:`素材预览`,style:{maxWidth:`100%`,maxHeight:520,objectFit:`contain`}})})})]}):(0,$.jsx)(XS,{description:`暂无素材`})},Y7=(0,S.createContext)(void 0),koe=({children:e,refreshConfig:t})=>(0,$.jsx)(Y7.Provider,{value:{refreshConfig:t},children:e}),X7=()=>{let e=(0,S.useContext)(Y7);if(!e)throw Error(`useLibrary must be used within a LibraryProvider`);return e},Z7=2,Q7=15,Aoe=e=>new Promise(t=>{if(!e.type.startsWith(`video/`)){t(null);return}let n=URL.createObjectURL(e),r=document.createElement(`video`);r.preload=`metadata`,r.onloadedmetadata=()=>{let e=Number.isFinite(r.duration)?r.duration:null;URL.revokeObjectURL(n),t(e)},r.onerror=()=>{URL.revokeObjectURL(n),t(null)},r.src=n}),joe=e=>e==null||!Number.isFinite(e)||e<=0?(Z.error(`无法读取视频秒数,请检查视频文件是否损坏`),!1):eQ7?(Z.error(`视频素材最长不能超过 ${Q7} 秒`),!1):!0,Moe=({projectId:e,open:t,onClose:n,onSuccess:r})=>{let{refreshConfig:i}=X7(),[a,o]=(0,S.useState)([]),[s,c]=(0,S.useState)({}),[l,u]=(0,S.useState)({}),[d,f]=(0,S.useState)({}),[p,m]=(0,S.useState)({}),[h,g]=(0,S.useState)(!1),_=()=>{o([]),c({}),u({}),f({}),m({})};return(0,$.jsx)(hK,{title:`上传真人素材`,open:t,onCancel:()=>{_(),n()},onOk:async()=>{let t=a.filter(e=>l[e.uid]===`uploaded`);if(t.length===0){Z.warning(`请等待文件上传完成后再提交入库`);return}g(!0);try{for(let n of t){let t=n.originFileObj;if(!t)continue;let r=d[n.uid];if(!r)continue;m(e=>({...e,[n.uid]:`importing`}));let i=t.type.startsWith(`image/`)?`Image`:`Video`;await Aae(e,{url:r.url,assetType:i,name:s[n.uid]?.trim()||t.name,videoDuration:r.duration_seconds,fileSize:r.file_size_bytes??t.size,mimeType:t.type||null,uploadResourceId:r.resource_id||null}),m(e=>({...e,[n.uid]:`imported`}))}Z.success(`已成功提交 ${t.length} 个素材入库,处理中`),i(),setTimeout(()=>{_(),r(),n()},1500)}catch(e){Z.error(e?.message||`提交入库失败`)}finally{g(!1)}},confirmLoading:h,okText:`提交入库`,destroyOnHidden:!0,width:650,okButtonProps:{disabled:a.length===0||a.some(e=>l[e.uid]!==`uploaded`)},children:(0,$.jsx)(`div`,{style:{maxHeight:600,overflow:`auto`,marginTop:30},children:(0,$.jsxs)(cH,{direction:`vertical`,style:{width:`100%`},size:14,children:[(0,$.jsx)(x0,{accept:`image/*,video/*`,fileList:a,multiple:!0,beforeUpload:async e=>{let t=`${Date.now()}-${Math.random().toString(36).substr(2,9)}`,n=e.type.startsWith(`image/`),r=URL.createObjectURL(e),i={uid:t,name:e.name,status:`uploading`,originFileObj:e,thumbUrl:r,type:e.type};o(e=>[...e,i]),c(e=>({...e,[t]:``})),u(e=>({...e,[t]:`uploading`}));try{let r=n?`Image`:`Video`,i=r===`Video`?await Aoe(e):null;if(r===`Video`&&!joe(i))return u(e=>({...e,[t]:`error`})),!1;let a=r===`Video`?await wie(e,i||void 0):await Cie(e);f(e=>({...e,[t]:{url:a.url,duration_seconds:a.duration_seconds,file_size_bytes:a.file_size_bytes,resource_id:a.resource_id}})),u(e=>({...e,[t]:`uploaded`}))}catch{u(e=>({...e,[t]:`error`})),Z.error(`文件 ${e.name} 上传失败`)}return!1},listType:`picture`,itemRender:(e,t,n)=>{let r=t.type?.startsWith(`video/`)||t.name.match(/\.(mp4|mov|avi|webm)$/i),i=l[t.uid],a=p[t.uid];return(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,padding:12,border:`1px solid #e5e7eb`,borderRadius:8,marginBottom:8},children:[(0,$.jsx)(`div`,{style:{width:64,height:64,borderRadius:8,overflow:`hidden`,flexShrink:0},children:t.thumbUrl||t.url?r?(0,$.jsx)(`video`,{src:t.thumbUrl||t.url,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(`img`,{src:t.thumbUrl||t.url,alt:t.name,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:`#f1f5f9`},children:r?(0,$.jsx)(r5,{style:{color:`#94a3b8`,fontSize:20}}):(0,$.jsx)(B6,{style:{color:`#94a3b8`,fontSize:20}})})}),(0,$.jsx)(`span`,{style:{width:`20%`,overflow:`hidden`,whiteSpace:`nowrap`,textOverflow:`ellipsis`,fontSize:13,color:`#64748b`,flexShrink:0},children:t.name}),(0,$.jsx)(LW,{style:{width:200,flexShrink:0},value:s[t.uid]||``,onChange:e=>c({...s,[t.uid]:e.target.value}),placeholder:`素材名称,默认使用文件名`,maxLength:256}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[i===`uploading`&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,$.jsx)(WG,{size:`small`,style:{color:`#6366f1`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#6366f1`},children:`上传中`})]}),i===`uploaded`&&!a&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#10b981`},children:`✓ 上传完成`}),i===`error`&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#ef4444`},children:`✗ 上传失败`}),a===`importing`&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,$.jsx)(WG,{size:`small`,style:{color:`#6366f1`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#6366f1`},children:`入库中`})]}),a===`imported`&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#10b981`},children:`✓ 已入库校验`}),a===`error`&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#ef4444`},children:`✗ 入库失败`})]}),(0,$.jsx)(`button`,{onClick:e=>{e.stopPropagation(),o(e=>e.filter(e=>e.uid!==t.uid)),c(e=>{let n={...e};return delete n[t.uid],n}),u(e=>{let n={...e};return delete n[t.uid],n}),f(e=>{let n={...e};return delete n[t.uid],n}),m(e=>{let n={...e};return delete n[t.uid],n})},style:{width:28,height:28,borderRadius:`50%`,backgroundColor:`#f1f5f9`,border:`none`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,$.jsx)(d$,{style:{color:`#64748b`,fontSize:14}})})]})},children:(0,$.jsx)(X,{icon:(0,$.jsx)(Q8,{}),children:`选择图片或视频`})}),(0,$.jsxs)(`div`,{style:{padding:12,background:`#f8fafc`,borderRadius:12,color:`#64748b`,fontSize:13},children:[`当前开放图片和视频,音频暂不接入。视频素材必须在 `,Z7,`~`,Q7,` 秒内;入库后会经过火山真人一致性校验,入库校验成功 后才可用于 AI 创作。`]})]})})})},Noe=({project:e,onDeleted:t,onChanged:n})=>{let{refreshConfig:r}=X7(),[i,a]=(0,S.useState)([]),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(``),[f,p]=(0,S.useState)(),[m,h]=(0,S.useState)(),[g,_]=(0,S.useState)(1),[v,y]=(0,S.useState)(20),[b,x]=(0,S.useState)(0),C=async(t=g,n=v)=>{s(!0);try{let r=await jae(e.id,{page:t,pageSize:n,keyword:u,status:f,assetType:m});a(r.items),x(r.total||0),_(t),y(n)}catch(e){Z.error(e?.message||`加载素材失败`)}finally{s(!1)}};(0,S.useEffect)(()=>{C(1,v)},[e.id,u,f,m]);let w=async e=>{try{await Mae(e),await C(g,v),n(),r(),Z.success(`素材已删除`)}catch(e){Z.error(e?.message||`删除素材失败`)}},T=async()=>{try{await Oae(e.id),Z.success(`项目组已删除`),t()}catch(e){Z.error(e?.message||`删除项目组失败`)}},E=e.status===`active`;return(0,$.jsxs)(DL,{title:(0,$.jsx)(cH,{children:(0,$.jsx)(`span`,{children:e.name})}),extra:(0,$.jsxs)(cH,{children:[(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(Q8,{}),disabled:!E,onClick:()=>l(!0),children:`上传素材`}),(0,$.jsx)(yK,{title:`确认删除这个真人素材项目组吗?`,onConfirm:T,children:(0,$.jsx)(X,{danger:!0,icon:(0,$.jsx)(d$,{}),children:`删除项目组`})})]}),style:{borderRadius:16},children:[!E&&(0,$.jsx)(Q.Paragraph,{style:{color:`#f97316`},children:`项目组未完成真人认证,暂不能上传素材。请重新创建项目组并完成手机扫码认证。`}),(0,$.jsxs)(cH,{style:{width:`100%`,marginBottom:16},wrap:!0,children:[(0,$.jsx)(LW.Search,{allowClear:!0,placeholder:`搜索素材名称`,value:u,onChange:e=>d(e.target.value),onSearch:()=>C(1,v),style:{width:240}}),(0,$.jsx)(EC,{allowClear:!0,placeholder:`素材状态`,value:f,onChange:e=>p(e),style:{width:150},options:[{value:`Processing`,label:`处理中`},{value:`Active`,label:`可用`},{value:`Failed`,label:`失败`}]}),(0,$.jsx)(EC,{allowClear:!0,placeholder:`素材类型`,value:m,onChange:e=>h(e),style:{width:130},options:[{value:`Image`,label:`图片`},{value:`Video`,label:`视频`}]}),(0,$.jsx)(X,{onClick:()=>C(1,v),children:`筛选`})]}),(0,$.jsx)(WG,{spinning:o,children:i.length===0?(0,$.jsx)(XS,{description:`暂无素材,上传图片/视频后会异步入库`,style:{marginTop:80}}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ooe,{items:i,loading:o,onDelete:w,onRefresh:()=>C(g,v)}),(0,$.jsx)(`div`,{style:{textAlign:`right`,marginTop:16},children:(0,$.jsx)(CG,{current:g,pageSize:v,total:b,showSizeChanger:!0,showTotal:e=>`共 ${e} 个素材`,onChange:(e,t)=>C(e,t)})})]})}),(0,$.jsx)(Moe,{projectId:e.id,open:c,onClose:()=>l(!1),onSuccess:()=>{C(1,v),n()}})]})},$7=`group_active`,e9=2e3,Poe=()=>{let[e,t]=(0,S.useState)([]),[n,r]=(0,S.useState)(null),[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(null),[f,p]=(0,S.useState)(null),[m,h]=(0,S.useState)(!1),[g]=nU.useForm(),_=(0,S.useRef)(null),v=()=>{_.current&&=(window.clearInterval(_.current),null)},y=()=>{v(),s(!1),l(!1),h(!1),d(null),p(null),g.resetFields()},b=async()=>{a(!0);try{let e=await h7({pageSize:100,status:`active`});t(e.items),r(t=>t?e.items.find(e=>e.id===t.id)||e.items[0]||null:e.items[0]||null)}catch(e){Z.error(e?.message||`加载真人素材项目组失败`)}finally{a(!1)}};(0,S.useEffect)(()=>{b()},[]),(0,S.useEffect)(()=>()=>v(),[]);let x=async e=>{v(),h(!1),Z.success(`真人认证完成,项目组已创建成功`),s(!1),p(null),d(null),g.resetFields();let n=await h7({pageSize:100,status:`active`});t(n.items),r(n.items.find(t=>t.id===e)||n.items[0]||null)},C=(e,t,n)=>{v(),h(!0);let r=async()=>{try{let n=await kae(e);if(p(n),n.status===$7){await x(t);return}[`callback_failed`,`failed`,`expired`].includes(n.status)&&(v(),h(!1),Z.error(n.errorMessage||`真人认证未完成,请重新创建项目组`))}catch(e){v(),h(!1),Z.error(e?.message||`轮询真人认证状态失败`)}};_.current=window.setInterval(r,Math.max(1e3,n||e9)),r()},w=async()=>{let e=await g.validateFields();l(!0);try{let t=`${window.location.origin}/private-portrait-authorized`,n=await Dae({...e,callbackRedirectUrl:t});d(n.project),p(n.validateSession),Z.success(`请使用手机扫码完成人脸认证`),n.validateSession?.id&&C(n.validateSession.id,n.project.id,n.pollIntervalMs||e9)}catch(e){Z.error(e?.message||`创建项目组认证二维码失败`)}finally{l(!1)}},T=f?.h5Link||``,E=f?.status===$7;return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Title,{level:4,style:{margin:0},children:`真人素材库`}),(0,$.jsx)(Q.Text,{type:`secondary`,children:`创建项目组时先完成真人认证,认证成功后项目组才会正式创建并可上传素材。`})]}),(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(rL,{}),onClick:()=>s(!0),style:{borderRadius:8,fontWeight:600,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`},children:`创建项目组`})]}),(0,$.jsxs)(Xq,{gutter:16,children:[(0,$.jsx)(YR,{xs:24,lg:5,children:(0,$.jsx)(DL,{style:{borderRadius:16,minHeight:520},children:(0,$.jsx)(WG,{spinning:i,children:e.length===0?(0,$.jsx)(XS,{description:`暂无真人项目组`}):(0,$.jsx)(woe,{items:e,selectedId:n?.id,onSelect:r})})})}),(0,$.jsx)(YR,{xs:24,lg:19,children:n?(0,$.jsx)(Noe,{project:n,onDeleted:()=>{r(null),b()},onChanged:b}):(0,$.jsx)(DL,{style:{borderRadius:16,minHeight:520,textAlign:`center`,color:`#94a3b8`},children:`请先创建或选择一个真人素材项目组`})})]}),(0,$.jsx)(hK,{title:`新建真人素材项目组`,open:o,onCancel:y,footer:f?[(0,$.jsx)(X,{onClick:y,children:`关闭`},`close`)]:void 0,onOk:f?void 0:w,okText:`开始认证并创建`,confirmLoading:c,mask:{closable:!m},children:f?(0,$.jsxs)(cH,{direction:`vertical`,align:`center`,size:16,style:{width:`100%`},children:[E?(0,$.jsx)(p4,{style:{fontSize:54,color:`#22c55e`}}):T?(0,$.jsx)(Aq,{value:T,size:220}):(0,$.jsx)(WG,{}),(0,$.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,$.jsx)(Q.Title,{level:5,style:{marginBottom:8},children:u?.name||`真人素材项目组`}),(0,$.jsx)(Q.Text,{type:E?`success`:`secondary`,children:E?`认证成功,项目组正在刷新`:`请使用手机扫码完成人脸认证,成功后回到电脑端查看项目组。`})]})]}):(0,$.jsxs)(nU,{form:g,layout:`vertical`,children:[(0,$.jsx)(nU.Item,{label:`项目组名称`,name:`name`,rules:[{required:!0,message:`请输入项目组名称`}],children:(0,$.jsx)(LW,{placeholder:`例如:达人A、客户B、张三人像`})}),(0,$.jsx)(nU.Item,{label:`描述`,name:`description`,children:(0,$.jsx)(LW.TextArea,{rows:3,placeholder:`可选`})}),(0,$.jsx)(Q.Paragraph,{type:`secondary`,style:{marginBottom:0},children:`点击后会生成真人认证二维码。手机扫码认证成功后,项目组才会出现在项目列表中。`})]})})]})},{Text:t9}=Q,n9=2,r9=15,Foe={creating:{label:`本地创建中`,color:`processing`},Processing:{label:`入库处理中`,color:`processing`},Active:{label:`入库成功`,color:`success`},Failed:{label:`入库失败`,color:`error`},local_deleted:{label:`本地已删`,color:`default`},remote_deleted:{label:`远端已删`,color:`default`},delete_failed:{label:`远端删除失败`,color:`error`}},Ioe=e=>{let t=Number(e||0);return!Number.isFinite(t)||t<=0?`-`:`${t.toFixed(t>=10?0:1)}s`},i9=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,a9=e=>e.assetType===`Video`?i9(e.videoCoverUrl||e.previewUrl||e.displayUrl||e.remoteUrl||e.sourceUrl):i9(e.previewUrl||e.displayUrl||e.videoCoverUrl||e.remoteUrl||e.sourceUrl),Loe=e=>new Promise(t=>{if(!e.type.startsWith(`video/`)){t(null);return}let n=URL.createObjectURL(e),r=document.createElement(`video`);r.preload=`metadata`,r.onloadedmetadata=()=>{let e=Number.isFinite(r.duration)?r.duration:null;URL.revokeObjectURL(n),t(e)},r.onerror=()=>{URL.revokeObjectURL(n),t(null)},r.src=n}),Roe=(e,t)=>e==null||!Number.isFinite(e)||e<=0?(t(`无法读取视频秒数,请检查视频文件是否损坏`),!1):er9?(t(`视频素材最长不能超过 ${r9} 秒`),!1):!0,zoe=({status:e})=>{let t=e||`-`,n=Foe[t];return(0,$.jsx)(ZQ,{color:n?.color||`default`,children:n?.label||t})},Boe=()=>{let{message:e}=Vb.useApp(),{refreshConfig:t}=X7(),[n,r]=(0,S.useState)([]),[i,a]=(0,S.useState)(),[o,s]=(0,S.useState)([]),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(!1),[f,p]=(0,S.useState)(1),[m,h]=(0,S.useState)(20),[g,_]=(0,S.useState)(0),[v,y]=(0,S.useState)(``),[b,x]=(0,S.useState)(),[C,w]=(0,S.useState)(),[T,E]=(0,S.useState)(!1),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)(!1),[j,M]=(0,S.useState)(!1),[N,P]=(0,S.useState)([]),[F,I]=(0,S.useState)({}),[L,R]=(0,S.useState)({}),[z,B]=(0,S.useState)({}),[V,H]=(0,S.useState)({}),[U,W]=(0,S.useState)(!1),[ee,te]=(0,S.useState)(``),[ne,re]=(0,S.useState)(`Image`),[G]=nU.useForm(),ie=(0,S.useRef)(null),K=(0,S.useMemo)(()=>n.find(e=>e.id===i)||null,[n,i]),ae=async()=>{l(!0);try{let e=(await _7({page:1,pageSize:100,status:`active`})).items||[];r(e),a(t=>t&&e.some(e=>e.id===t)?t:e[0]?.id)}catch(t){e.error(t?.message||`加载虚拟人像项目组失败`)}finally{l(!1)}},q=async(t=f,n=m)=>{if(!i){s([]),_(0);return}d(!0);try{let e=await Iae(i,{page:t,pageSize:n,keyword:v.trim()||void 0,status:b,assetType:C});s(e.items||[]),_(e.total||0),p(t),h(n)}catch(t){e.error(t?.message||`加载虚拟人像素材失败`)}finally{d(!1)}},oe=async()=>{await ae()};(0,S.useEffect)(()=>{oe()},[]),(0,S.useEffect)(()=>{i&&q(1,m)},[i]),(0,S.useEffect)(()=>(o.some(e=>e.status!==`Failed`&&e.status!==`Active`)&&i?ie.current||=window.setInterval(()=>{q(f,m)},3e3):ie.current&&=(clearInterval(ie.current),null),()=>{ie.current&&=(clearInterval(ie.current),null)}),[o,i,f,m]);let se=async()=>{let t=await G.validateFields();O(!0);try{let n=await Pae(t);e.success(`虚拟人像项目组已创建`),E(!1),G.resetFields(),await ae(),a(n.id)}catch(t){e.error(t?.message||`创建项目组失败`)}finally{O(!1)}},ce=async()=>{if(!i){e.warning(`请先创建或选择项目组`);return}if(N.length===0){e.warning(`请先选择图片或视频素材`);return}let n=N.filter(e=>L[e.uid]===`uploaded`);if(n.length===0){e.warning(`请等待文件上传完成后再提交入库`);return}M(!0);try{for(let e of n){let t=e.originFileObj;if(!t)continue;let n=z[e.uid];if(!n)continue;H(t=>({...t,[e.uid]:`importing`}));let r=t.type.startsWith(`image/`)?`Image`:`Video`;await v7(i,{url:n.url,assetType:r,name:F[e.uid]?.trim()||t.name,videoDuration:n.duration_seconds,fileSize:n.file_size_bytes??t.size,mimeType:t.type||null,uploadResourceId:n.resource_id||null}),H(t=>({...t,[e.uid]:`imported`}))}e.success(`已成功提交 ${n.length} 个素材入库,处理中`),setTimeout(()=>{A(!1),P([]),I({}),R({}),B({}),H({})},1500),await Promise.all([ae(),q(1,m),t()])}catch(t){e.error(t?.message||`提交入库失败`)}finally{M(!1)}},le=async n=>{try{await Lae(n),e.success(`素材已删除,远端删除将异步执行`),await Promise.all([ae(),q(f,m),t()])}catch(t){e.error(t?.message||`删除素材失败`)}},ue=async()=>{if(i)try{await Fae(i),e.success(`项目组已删除,远端资产组将异步删除`),a(void 0),await oe()}catch(t){e.error(t?.message||`删除项目组失败`)}},de=t=>{let n=a9(t);if(!n){e.warning(`暂无可预览地址`);return}te(n),re(t.assetType===`Video`?`Video`:`Image`),W(!0)};return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Title,{level:4,style:{margin:0},children:`虚拟素材库`}),(0,$.jsx)(Q.Text,{type:`secondary`,children:`可提前上传虚拟人像素材,后续生成视频时可直接使用。`})]}),(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(rL,{}),onClick:()=>E(!0),style:{borderRadius:8,fontWeight:600,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`},children:`创建项目组`})]}),(0,$.jsxs)(Xq,{gutter:[10,10],children:[(0,$.jsx)(YR,{xs:24,lg:5,children:(0,$.jsx)(DL,{style:{borderRadius:16,minHeight:520,margin:`0 auto`,maxWidth:1200},children:(0,$.jsx)(WG,{spinning:c,children:n.length===0?(0,$.jsx)(XS,{description:`暂无虚拟人像项目组`}):(0,$.jsx)(cH,{orientation:`vertical`,style:{width:`100%`},size:10,children:n.map(e=>{let t=i===e.id;return(0,$.jsxs)(`div`,{onClick:()=>a(e.id),style:{padding:14,borderRadius:14,cursor:`pointer`,border:t?`1px solid #8b5cf6`:`1px solid #e2e8f0`,background:t?`#f5f3ff`:`#fff`},children:[(0,$.jsx)(cH,{style:{width:`100%`,justifyContent:`space-between`},align:`start`,children:(0,$.jsxs)(`div`,{style:{minWidth:0},children:[(0,$.jsx)(t9,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name}),e.description&&(0,$.jsx)(t9,{type:`secondary`,ellipsis:!0,style:{display:`block`,fontSize:12},children:e.description})]})}),(0,$.jsxs)(cH,{wrap:!0,size:4,style:{marginTop:10},children:[(0,$.jsxs)(ZQ,{children:[`总 `,e.assetCount||0]}),(0,$.jsxs)(ZQ,{color:`green`,children:[`图 `,e.imageAssetCount||0]}),(0,$.jsxs)(ZQ,{color:`blue`,children:[`视频 `,e.videoAssetCount||0]})]})]},e.id)})})})})}),(0,$.jsx)(YR,{xs:24,lg:19,children:(0,$.jsxs)(DL,{title:K?K.name:`素材资产`,extra:(0,$.jsxs)(cH,{wrap:!0,children:[(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(Q8,{}),disabled:!i,onClick:()=>A(!0),style:{borderRadius:8,fontWeight:600,borderColor:`transparent`},children:`上传图片/视频`}),i&&(0,$.jsx)(yK,{title:`确认删除当前虚拟人像项目组吗?`,onConfirm:ue,children:(0,$.jsx)(X,{danger:!0,icon:(0,$.jsx)(d$,{}),style:{borderRadius:8,fontWeight:600},children:`删除项目组`})})]}),style:{borderRadius:16,minHeight:520},children:[(0,$.jsxs)(cH,{style:{width:`100%`,marginBottom:16},wrap:!0,children:[(0,$.jsx)(LW.Search,{allowClear:!0,placeholder:`搜索素材名称`,value:v,onChange:e=>y(e.target.value),onSearch:()=>q(1,m),style:{width:240,borderRadius:8},enterButton:!0}),(0,$.jsx)(EC,{allowClear:!0,placeholder:`素材状态`,value:b,onChange:e=>x(e),style:{width:140,borderRadius:8},options:[{value:`Processing`,label:`处理中`},{value:`Active`,label:`可用`},{value:`Failed`,label:`失败`}]}),(0,$.jsx)(EC,{allowClear:!0,placeholder:`素材类型`,value:C,onChange:e=>w(e),style:{width:120,borderRadius:8},options:[{value:`Image`,label:`图片`},{value:`Video`,label:`视频`}]}),(0,$.jsx)(X,{type:`primary`,onClick:()=>q(1,m),style:{borderRadius:8,fontWeight:600,borderColor:`transparent`},children:`筛选`})]}),(0,$.jsx)(WG,{spinning:u,children:i?o.length===0?(0,$.jsx)(XS,{description:`暂无素材,上传图片/视频后会异步入库`,style:{marginTop:80}}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(220px, 1fr))`,gap:14},children:o.map(e=>{let t=a9(e),n=e.assetType===`Video`;return(0,$.jsx)(DL,{hoverable:!0,styles:{body:{padding:12}},style:{borderRadius:16,overflow:`hidden`,borderColor:`#eef2f7`},cover:(0,$.jsxs)(`div`,{style:{height:170,background:`#f8fafc`,display:`flex`,alignItems:`center`,justifyContent:`center`,position:`relative`},children:[t?n&&e.videoCoverUrl?(0,$.jsx)(`img`,{src:t,alt:e.name||`视频封面`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):n?(0,$.jsx)(`video`,{src:t,muted:!0,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(`img`,{src:t,alt:e.name||`虚拟人像素材`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):n?(0,$.jsx)(r5,{style:{fontSize:42,color:`#64748b`}}):(0,$.jsx)(B6,{style:{fontSize:42,color:`#64748b`}}),n&&(0,$.jsx)(ZQ,{color:`blue`,style:{position:`absolute`,left:10,top:10},children:`视频`}),t&&(0,$.jsx)(X,{size:`small`,shape:`circle`,icon:(0,$.jsx)(hW,{}),style:{position:`absolute`,right:10,top:10},onClick:()=>de(e)}),n&&(0,$.jsx)(`div`,{style:{position:`absolute`,left:10,bottom:10,padding:`2px 6px`,borderRadius:8,background:`rgba(15,23,42,0.72)`,color:`#fff`,fontSize:12},children:Ioe(e.videoDuration)})]}),children:(0,$.jsxs)(cH,{direction:`vertical`,size:8,style:{width:`100%`},children:[(0,$.jsx)(gw,{title:e.name||e.remoteAssetId||e.id,children:(0,$.jsx)(`div`,{style:{fontWeight:600,color:`#1e293b`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.name||e.remoteAssetId||`未命名素材`})}),(0,$.jsxs)(cH,{wrap:!0,size:4,children:[(0,$.jsx)(zoe,{status:e.status}),(0,$.jsx)(ZQ,{color:n?`blue`:`default`,children:n?`视频`:`图片`})]}),(0,$.jsx)(cH,{size:6,wrap:!0,children:(0,$.jsx)(yK,{title:`确认删除这个虚拟人像素材吗?`,onConfirm:()=>le(e.id),children:(0,$.jsx)(X,{size:`small`,danger:!0,icon:(0,$.jsx)(d$,{}),children:`删除`})})})]})},e.id)})}),(0,$.jsx)(`div`,{style:{textAlign:`right`,marginTop:16},children:(0,$.jsx)(CG,{current:f,pageSize:m,total:g,showSizeChanger:!0,showTotal:e=>`共 ${e} 个素材`,onChange:(e,t)=>q(e,t)})})]}):(0,$.jsx)(XS,{description:`请先创建或选择项目组`,style:{marginTop:80}})})]})})]}),(0,$.jsx)(hK,{title:`创建虚拟人像项目组`,open:T,onCancel:()=>E(!1),onOk:se,confirmLoading:D,okText:`创建项目组`,children:(0,$.jsxs)(nU,{form:G,layout:`vertical`,children:[(0,$.jsx)(nU.Item,{name:`name`,label:`项目组名称`,rules:[{required:!0,message:`请输入项目组名称`}],children:(0,$.jsx)(LW,{placeholder:`例如:虚拟主播A / 品牌代言人B`,maxLength:128})}),(0,$.jsx)(nU.Item,{name:`description`,label:`描述`,children:(0,$.jsx)(LW.TextArea,{placeholder:`可填写人物设定、服装风格、素材要求等`,maxLength:2e3,rows:4})})]})}),(0,$.jsx)(hK,{title:`上传虚拟人像素材`,open:k,onCancel:()=>A(!1),onOk:ce,confirmLoading:j,okText:`提交入库`,width:650,okButtonProps:{disabled:N.length===0||N.some(e=>L[e.uid]!==`uploaded`)},children:(0,$.jsx)(`div`,{style:{maxHeight:600,overflow:`auto`,marginTop:30},children:(0,$.jsxs)(cH,{direction:`vertical`,style:{width:`100%`},size:14,children:[(0,$.jsx)(x0,{accept:`image/*,video/*`,fileList:N,multiple:!0,beforeUpload:async t=>{let n=`${Date.now()}-${Math.random().toString(36).substr(2,9)}`,r=t.type.startsWith(`image/`),i=URL.createObjectURL(t),a={uid:n,name:t.name,status:`uploading`,originFileObj:t,thumbUrl:i,type:t.type};P(e=>[...e,a]),I(e=>({...e,[n]:``})),R(e=>({...e,[n]:`uploading`}));try{let i=r?`Image`:`Video`,a=i===`Video`?await Loe(t):null;if(i===`Video`&&!Roe(a,e.error))return R(e=>({...e,[n]:`error`})),!1;let o=i===`Video`?await Eie(t,a||void 0):await Tie(t);B(e=>({...e,[n]:{url:o.url,duration_seconds:o.duration_seconds,file_size_bytes:o.file_size_bytes,resource_id:o.resource_id}})),R(e=>({...e,[n]:`uploaded`}))}catch{R(e=>({...e,[n]:`error`})),e.error(`文件 ${t.name} 上传失败`)}return!1},listType:`picture`,itemRender:(e,t,n)=>{let r=t.type?.startsWith(`video/`)||t.name.match(/\.(mp4|mov|avi|webm)$/i),i=L[t.uid],a=V[t.uid];return(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,padding:12,border:`1px solid #e5e7eb`,borderRadius:8,marginBottom:8},children:[(0,$.jsx)(`div`,{style:{width:64,height:64,borderRadius:8,overflow:`hidden`,flexShrink:0},children:t.thumbUrl||t.url?r?(0,$.jsx)(`video`,{src:t.thumbUrl||t.url,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(`img`,{src:t.thumbUrl||t.url,alt:t.name,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:`#f1f5f9`},children:r?(0,$.jsx)(r5,{style:{color:`#94a3b8`,fontSize:20}}):(0,$.jsx)(B6,{style:{color:`#94a3b8`,fontSize:20}})})}),(0,$.jsx)(`span`,{style:{width:`20%`,overflow:`hidden`,whiteSpace:`nowrap`,textOverflow:`ellipsis`,fontSize:13,color:`#64748b`,flexShrink:0},children:t.name}),(0,$.jsx)(LW,{style:{width:200,flexShrink:0},value:F[t.uid]||``,onChange:e=>I({...F,[t.uid]:e.target.value}),placeholder:`素材名称,默认使用文件名`,maxLength:256}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[i===`uploading`&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,$.jsx)(WG,{size:`small`,style:{color:`#6366f1`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#6366f1`},children:`上传中`})]}),i===`uploaded`&&!a&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#10b981`},children:`✓ 上传完成`}),i===`error`&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#ef4444`},children:`✗ 上传失败`}),a===`importing`&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,$.jsx)(WG,{size:`small`,style:{color:`#6366f1`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#6366f1`},children:`入库中`})]}),a===`imported`&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#10b981`},children:`✓ 已入库校验`}),a===`error`&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#ef4444`},children:`✗ 入库失败`})]}),(0,$.jsx)(`button`,{onClick:e=>{e.stopPropagation(),P(e=>e.filter(e=>e.uid!==t.uid)),I(e=>{let n={...e};return delete n[t.uid],n}),R(e=>{let n={...e};return delete n[t.uid],n}),B(e=>{let n={...e};return delete n[t.uid],n}),H(e=>{let n={...e};return delete n[t.uid],n})},style:{width:28,height:28,borderRadius:`50%`,backgroundColor:`#f1f5f9`,border:`none`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,$.jsx)(d$,{style:{color:`#64748b`,fontSize:14}})})]})},children:(0,$.jsx)(X,{icon:(0,$.jsx)(Q8,{}),children:`选择图片或视频`})}),(0,$.jsxs)(`div`,{style:{padding:12,background:`#f8fafc`,borderRadius:12,color:`#64748b`,fontSize:13},children:[`当前开放图片和视频,视频素材必须在 `,n9,`~`,r9,` 秒内;提交后会调用火山 CreateAsset 异步处理,状态变为 入库校验成功 后才可用于 AI 创作。`]})]})})}),(0,$.jsx)(hK,{title:`素材预览`,open:U,onCancel:()=>W(!1),footer:null,width:760,destroyOnHidden:!0,children:(0,$.jsx)(`div`,{style:{minHeight:420,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#0f172a`,borderRadius:12,overflow:`hidden`},children:ne===`Video`?(0,$.jsx)(`video`,{src:ee,controls:!0,autoPlay:!0,style:{maxWidth:`100%`,maxHeight:520}}):(0,$.jsx)(`img`,{src:ee,alt:`素材预览`,style:{maxWidth:`100%`,maxHeight:520,objectFit:`contain`}})})})]})},{Title:Voe,Text:Hoe,Paragraph:Uoe}=Q,o9=e=>e===`aigc_virtual`?`aigc_virtual`:`real_person`,Woe=()=>{let[e,t]=On(),[n,r]=(0,S.useState)(()=>o9(e.get(`portraitTab`))),[i,a]=(0,S.useState)(null),[o,s]=(0,S.useState)([]),[c,l]=(0,S.useState)(),u=async()=>{try{a(n===`aigc_virtual`?await g7():await m7())}catch(e){Z.error(e?.message||`加载配置失败`)}};(0,S.useEffect)(()=>{(async()=>{try{if(n===`aigc_virtual`){let[e,t]=await Promise.all([g7(),_7({page:1,pageSize:100,status:`active`})]);a(e);let n=t.items||[];s(n),l(e=>e&&n.some(t=>t.id===e)?e:n[0]?.id)}else{let[e,t]=await Promise.all([m7(),h7({pageSize:100,status:`active`})]);a(e);let n=t.items||[];s(n),l(e=>e&&n.some(t=>t.id===e)?e:n[0]?.id)}}catch(e){Z.error(e?.message||`加载数据失败`)}})()},[n]),(0,S.useMemo)(()=>o.find(e=>e.id===c)||null,[o,c]);let d=(0,S.useMemo)(()=>i?`已用 ${i.usedAssetCount||0} / ${i.assetLimit||0} 个素材,剩余 ${i.remainingAssetCount||0}`:`额度加载中`,[i]),f=(0,S.useMemo)(()=>[{key:`real_person`,label:`真人素材库`,children:(0,$.jsx)(Poe,{})},{key:`aigc_virtual`,label:`虚拟素材库`,children:(0,$.jsx)(Boe,{})}],[]);return(0,$.jsx)(koe,{refreshConfig:u,children:(0,$.jsx)(`div`,{children:(0,$.jsx)(TL,{activeKey:n,onChange:n=>{let i=o9(n);r(i);let a=new URLSearchParams(e);a.set(`filterType`,`private_portrait`),a.set(`portraitTab`,i),t(a,{replace:!0})},items:f,destroyOnHidden:!1,tabBarExtraContent:(0,$.jsxs)(`div`,{style:{fontSize:14,fontWeight:700,color:`#4f46e5`,marginTop:8},children:[d,`。真人/虚拟共用,图片/视频共用。`]})})})})},{Header:Goe,Sider:Koe,Content:qoe}=KW,{TextArea:Joe}=LW,{Option:Yoe}=EC,{Text:s9}=Q,Xoe=`http://ceshi.apiforeign.minzhong.cn`.replace(/\/api\/?$/i,``).replace(/\/$/,``),Zoe=e=>{if(!e)return``;let t=String(e).trim();return t?/^(https?:)?\/\//i.test(t)||/^(blob|data):/i.test(t)?t:`${Xoe}${t.startsWith(`/`)?t:`/${t}`}`:``},Qoe=()=>{let{message:e}=Vb.useApp(),t=Ke(),[n,r]=(0,S.useState)(!1),[i,a]=(0,S.useState)(`1`),[o,s]=(0,S.useState)([]),{mediaType:c,countType:l,generationCount:u,selectedRatio:d,selectedResolution:f,width:p,height:m,videoDuration:h,videoAspectRatio:g,videoResolution:_,engineOptions:v,enginesele:y,inputValue:b,setMediaType:x,setCountType:C,setGenerationCount:w,setSelectedRatio:T,setSelectedResolution:E,setWidth:D,setHeight:O,setVideoDuration:k,setVideoAspectRatio:A,setVideoResolution:j,setEngineOptions:M,setEnginesele:N,setInputValue:P,currentMedia:F,setCurrentMedia:I}=T7(),L=Array.isArray(y)?{}:y,R=(c===`image`?L.image:L.video)?.find(e=>e.id===l),z=R?.maxImageCount??4,B=R?.maxVideoCount??1,V=R?.multiGenerationEnabled?Math.max(1,Math.min(5,Number(R?.maxGenerationCount||1))):1,H=c===`image`?F.filter(e=>e.type===`image`).length:0,U=c===`image`?Math.max(1,Number(R?.multiImageMaxImages||15)-H):5,W=Math.max(1,Math.min(5,V,c===`image`?U:5)),[ee,te]=(0,S.useState)(!1),[ne,re]=(0,S.useState)(!1),[G,ie]=(0,S.useState)(!1),[K,ae]=(0,S.useState)(`universal`),[q,oe]=(0,S.useState)(null),[se,ce]=(0,S.useState)(null),[le,ue]=(0,S.useState)(null),[de,fe]=(0,S.useState)(!1),[pe,me]=(0,S.useState)(!1),[he,ge]=(0,S.useState)(`real_person`),[_e,ve]=(0,S.useState)(!1),ye=(0,S.useRef)(null),be=(0,S.useCallback)(()=>{ye.current&&=(window.clearTimeout(ye.current),null),ve(!0)},[]),xe=(0,S.useCallback)(()=>{ye.current&&window.clearTimeout(ye.current),ye.current=window.setTimeout(()=>{ve(!1),ye.current=null},260)},[]),[Se,Ce]=(0,S.useState)(!1),we=(0,S.useRef)(null),Te=(0,S.useRef)(!1),[Ee,De]=(0,S.useState)({top:0,left:0}),Oe=e=>{let t=0,n=0,r=0;return e.map(e=>e.type===`image`?(t++,`图片${t}`):e.type===`video`?(n++,`视频${n}`):(r++,`音频${r}`))},[ke,Ae]=(0,S.useState)(!1),[je,Me]=(0,S.useState)(``),[Ne,Pe]=(0,S.useState)(`image`),Fe=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(ke&&Ne===`video`){let e=()=>{Fe.current&&Fe.current.play().catch(()=>{})};Fe.current&&(Fe.current.readyState>=2?e():Fe.current.addEventListener(`loadedmetadata`,e));let t=setTimeout(e,300);return()=>{clearTimeout(t),Fe.current&&(Fe.current.removeEventListener(`loadedmetadata`,e),Fe.current.pause())}}else Fe.current&&Fe.current.pause()},[ke,Ne]);let[Ie,Le]=(0,S.useState)(new Set),Re=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}}},ze=e=>{let t=Re(e);return t?Math.floor(Date.now()/1e3)>t:!1},[Be,Ve]=(0,S.useState)(!1),[He,Ue]=(0,S.useState)(``),[We,Ge]=(0,S.useState)(`image`),[qe,Je]=(0,S.useState)(``),Ye=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(Be&&We===`video`&&Ye.current){let e=Ye.current;e.currentTime=0,e.muted=!1;let t=e.play();t&&typeof t.catch==`function`&&t.catch(()=>{e.muted=!0,e.play().catch(()=>{})})}else if(!Be&&Ye.current){let e=Ye.current;e.pause(),e.muted=!0,e.currentTime=0}},[Be,We,He]);let[Xe,Ze]=(0,S.useState)(null),[Qe,$e]=(0,S.useState)(0),[et,tt]=(0,S.useState)(!1),[nt,rt]=(0,S.useState)(null),[it,at]=(0,S.useState)({x:0,y:0}),[ot,st]=(0,S.useState)(!1),[ct,lt]=(0,S.useState)(!1),[ut,dt]=(0,S.useState)([]),[ft,pt]=(0,S.useState)([]),[mt,ht]=(0,S.useState)({}),[gt,_t]=(0,S.useState)(!1),[vt,yt]=(0,S.useState)(!1),[bt,xt]=(0,S.useState)([]),[St,Ct]=(0,S.useState)([]),[wt,Tt]=(0,S.useState)([]),Et=()=>{let e={};if(e=wt.find(e=>e.modelConfigId===l&&e.genType===c&&e.resolution===(c===`video`?_:f)),e||(c===`video`?(e={perSecondCredits:2,baseCredits:60,ratio:1.3,inputVideoRatio:1.3,inputVideoBaseCredits:0,inputVideoPerSecondCredits:15,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0},(_===`1080p`||_===`720p`||_===`480p`)&&(e.ratio=1.3)):(e={perSecondCredits:.1,baseCredits:2,ratio:3,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0},(f===`2K`||f===`4K`||f===`1K`)&&(e.ratio=3))),c===`video`){let t=(h*e.perSecondCredits+e.baseCredits)*e.ratio,n=F.filter(e=>e.type===`video`).reduce((e,t)=>e+(t.duration||0),0);if(n>0){let r=((e.inputVideoBaseCredits||0)+(e.inputVideoPerSecondCredits||0)*n)*(e.inputVideoRatio||1);t+=r}let r=F.filter(e=>e.type===`image`).length;if(r>0){let n=((e.inputImageBaseCredits||0)+(e.inputImagePerImageCredits||0)*r)*(e.inputImageRatio||1);t+=n}return Number((t*u).toFixed(2))}else{let t=e.baseCredits*e.ratio,n=F.filter(e=>e.type===`image`).length;if(n>0){let r=((e.inputImageBaseCredits||0)+(e.inputImagePerImageCredits||0)*n)*(e.inputImageRatio||1);t+=r}return Number((t*u).toFixed(2))}},Dt=(0,S.useRef)(null),Ot=(0,S.useRef)(null),kt=(0,S.useRef)(null);(0,S.useRef)(!0);let At=(0,S.useRef)(!1),jt=(0,S.useRef)(0);o.find(e=>e.id===i);let[Mt,Nt]=(0,S.useState)([]),[Pt,Ft]=(0,S.useState)({page:1,pageSize:20}),[It,Lt]=(0,S.useState)(0),[Rt,zt]=(0,S.useState)(!1);(0,S.useEffect)(()=>{let e=t.state;e&&(e.generationPrompt&&P(e.generationPrompt),e.mediaReferences&&Array.isArray(e.mediaReferences)&&e.mediaReferences.length>0&&I(e.mediaReferences.map(e=>{let t=e.url||e.resourceUrl||e.previewUrl||``,n=t.startsWith(`http`)?t:`http://ceshi.apiforeign.minzhong.cn${t}`;return{...e,name:e.name||`参考${e.type}`,type:e.type===`video`?`video`:e.type===`audio`?`audio`:`image`,url:n,duration:e.duration||0,label:e.label||``}})),e.aspectRatio&&A(e.aspectRatio),window.history.replaceState({},``,window.location.pathname))},[t.state]),(0,S.useEffect)(()=>()=>{ye.current&&window.clearTimeout(ye.current)},[]);let Bt=(0,S.useCallback)((e=`instant`)=>{let t=Ot.current;t&&(jt.current=Date.now(),requestAnimationFrame(()=>{t.scrollTo({top:t.scrollHeight,behavior:e})}))},[]);(0,S.useEffect)(()=>{if(Mt.length>0&&!At.current){let e=setTimeout(()=>{Bt(`smooth`),At.current=!0},300);return()=>clearTimeout(e)}},[Mt.length,Bt]),(0,S.useEffect)(()=>{if(Te.current){Te.current=!1;return}if(!G)return;let e=Array.isArray(y)?{}:y,t=c===`image`?e.image:e.video;t&&t.length>0&&(t.some(e=>e.id===l)||C(t[0].id))},[c,y,G]),(0,S.useEffect)(()=>{G&&w(1)},[c,l,G,w]),(0,S.useEffect)(()=>{u>W&&(w(W),c===`image`&&e.info(`受当前引擎或参考图数量限制,本次最多生成 ${W} 份`))},[u,W,c,w,e]),(0,S.useEffect)(()=>{let e=e=>{let t=e.target;vt&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&yt(!1),gt&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&_t(!1),ot&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&st(!1),ct&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&<(!1),de&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&fe(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[vt,gt,ot,ct,de]),(0,S.useEffect)(()=>{if(Te.current){Te.current=!1;return}if(c!==`video`)return;let e=L.video?.find(e=>e.id===l);if(!e)return;let t=e.supportsFirstLastFrame??!1,n=e.supportsUniversalReference??!0;ae(e=>n?`universal`:e===`universal`&&!n&&t?`first_last_frame`:e)},[l,c,y]),(0,S.useEffect)(()=>{V5().then(e=>{if(N(e.engine),ie(!0),e.engine.video&&e.engine.video.length>0){let t=e.engine.video[0],n=e.engine.video.find(e=>e.id===l)||t;M({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(g)||A(n.supportedRatios?.[0]||`16:9`),n.supportedResolutions?.includes(_)||j(n.supportedResolutions?.[0]||`720p`),n.supportedDurations?.includes(h)||k(n.supportedDurations?.[0]||5),l===`请选择`&&C(n.id)}if(e.engine.image&&e.engine.image.length>0){let t=e.engine.image.find(e=>e.id===l)||e.engine.image[0],n=t.supportedSizes||{},r=Object.keys(n).sort((e,t)=>{let n={"1K":0,"2K":1,"4K":2};return(n[e]||0)-(n[t]||0)}),i=r[0]||`2K`,a=Object.keys(n[i]||{});if(dt(a.map(e=>({value:e,label:e}))),ht(n),pt(r.map(e=>{let t=e.match(/(\d+)K/);return{value:e,label:`${{1:`标清`,2:`高清`,4:`超清`}[t?parseInt(t[1]):1]||`高清`} ${e}`}})),n[i]&&n[i][a[0]]){let[e,t]=n[i][a[0]].split(/[×x]/);D(Number(e)),O(Number(t)),T(a[0]),E(i)}l===`请选择`&&C(t.id)}}).catch(()=>{}),Wie().then(e=>{Tt(e)}),H5(Pt).then(e=>{let t=[...e.items||[]].reverse(),n=e.total;Nt(t),Lt(n)})},[]),(0,S.useEffect)(()=>{if(kt.current&&=(clearInterval(kt.current),null),Mt.some(e=>e.status===`generating`))return kt.current=window.setInterval(()=>{H5(Pt).then(e=>{Nt(t=>t.map(t=>t.status===`generating`&&e.items.find(e=>e.id===t.id)||t)),Lt(e.total)}).catch(e=>{})},1e4),()=>{kt.current&&=(clearInterval(kt.current),null)}},[Mt,Pt]),(0,S.useEffect)(()=>{if(!ot)return;let e=e=>{let t=e.target;!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&st(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[ot]),(0,S.useEffect)(()=>{if(!ct)return;let e=e=>{let t=e.target;!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&<(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[ct]);let Vt=e=>{let t=Object.keys(mt).sort((e,t)=>{let n={"1K":0,"2K":1,"4K":2};return(n[e]||0)-(n[t]||0)}),n=mt[f]&&mt[f][e]?f:t.find(t=>mt[t]&&mt[t][e])||t[0];if(n&&mt[n]&&mt[n][e]){let[t,r]=mt[n][e].split(/[×x]/);D(Number(t)),O(Number(r)),T(e),E(n)}},Ht=e=>{mt[e]||(e=Object.keys(mt).sort((e,t)=>{let n={"1K":0,"2K":1,"4K":2};return(n[e]||0)-(n[t]||0)})[0]||e);let t=mt[e]?Object.keys(mt[e]):[];dt(t.map(e=>({value:e,label:e})));let n=t.includes(d)?d:t[0]||``;if(n&&mt[e]&&mt[e][n]){let[t,r]=mt[e][n].split(/[×x]/);D(Number(t)),O(Number(r)),T(n),E(e)}},Ut=()=>{D(m),O(p)},Wt=y?.video?.find(e=>e.id===l),Gt=Wt?.supportsFirstLastFrame??!1,Kt=Wt?.supportsUniversalReference??!0,qt=e=>{e===`first_last_frame`&&!Gt||e===`universal`&&!Kt||(ae(e),fe(!1),I([]),P(``))},Jt=()=>{let e=q;oe(se),ce(e)},Yt=()=>{oe(null),ce(null)},Xt=()=>{ce(null)},Zt=async()=>{let t=c===`video`&&K===`first_last_frame`;if(t){if(!b.trim()){e.warning(`请输入内容`);return}}else if(!b.trim()&&F.length===0){e.warning(`请输入内容或上传图片/视频`);return}let n;t?(n=[],q&&n.push({...q,role:`first_frame`}),se&&n.push({...se,role:`last_frame`}),n.length===0&&(n=void 0)):n=F.length>0?F.map(e=>{if(e.type===`image`){let{duration:t,...n}=e;return n}return e}):void 0;let r={id:``,gen_type:c,original_prompt:b.trim(),engine_id:l,idempotency_key:new Date().toLocaleString(`zh-CN`),generation_count:u,media_references:n,...c===`image`&&{image_size:f,image_proportion:d,image_px:p+`x`+m},...c===`video`&&{duration:h,aspect_ratio:g,resolution:_}};re(!0),Vie(r).then(()=>{P(``),I([]),oe(null),ce(null),w(1);let e={...Pt,page:1};Ft(e),H5(e).then(e=>{let t=Array.isArray(e.items)&&e.items.length>0?e.items[e.items.length-1]:null;t&&Nt(e=>[...e,t]),Lt(e.total),setTimeout(()=>{Dt.current?.scrollIntoView({behavior:`smooth`})},100)}).catch(e=>{})}).catch(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),e.error({content:n,duration:3})}).finally(()=>{re(!1)}),setTimeout(()=>{re(!1)},3e3)},Qt=async()=>{if(Mt.length>=It)return;let e=Ot.current;if(!e)return;let t=e.scrollTop,n=e.scrollHeight;zt(!0);try{let r=Pt.page+1,i=await H5({...Pt,page:r}),a=Array.isArray(i)?{items:i,total:i.length}:i;a.total&&Lt(a.total),Ft(e=>({...e,page:r})),Nt(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)).reverse(),...e]}),setTimeout(()=>{e.scrollTop=t+(e.scrollHeight-n)},200)}catch{}finally{zt(!1)}},$t=e=>new Promise((t,n)=>{let r=document.createElement(`video`);r.preload=`metadata`,r.onloadedmetadata=()=>{window.URL.revokeObjectURL(r.src),t(r.duration)},r.onerror=()=>{window.URL.revokeObjectURL(r.src),n(Error(`无法获取视频时长`))},r.src=URL.createObjectURL(e)}),en=e=>new Promise((t,n)=>{let r=document.createElement(`audio`);r.preload=`metadata`,r.onloadedmetadata=()=>{URL.revokeObjectURL(r.src),t(r.duration)},r.onerror=()=>{URL.revokeObjectURL(r.src),n(Error(`无法获取音频时长`))},r.src=URL.createObjectURL(e)}),tn=e=>{let t=e.startsWith(`http`)?e:`http://ceshi.apiforeign.minzhong.cn${e}`;if(Xe===t){let e=document.getElementById(`audio-player`);e&&e.pause(),Ze(null)}else Ze(t)},nn=e=>new Promise((t,n)=>{let r=new Image;r.onload=()=>{window.URL.revokeObjectURL(r.src),t({width:r.naturalWidth,height:r.naturalHeight})},r.onerror=()=>{window.URL.revokeObjectURL(r.src),n(Error(`无法读取图片尺寸`))},r.src=URL.createObjectURL(e)}),rn=e=>new Promise((t,n)=>{let r=document.createElement(`video`);r.preload=`metadata`,r.onloadedmetadata=()=>{window.URL.revokeObjectURL(r.src),t({width:r.videoWidth,height:r.videoHeight,duration:r.duration})},r.onerror=()=>{window.URL.revokeObjectURL(r.src),n(Error(`无法读取视频尺寸`))},r.src=URL.createObjectURL(e)}),an=(e,t)=>{if(e<300||e>6e3)return`图片宽度需在 300~6000px 之间,当前为 ${e}px`;if(t<300||t>6e3)return`图片高度需在 300~6000px 之间,当前为 ${t}px`;let n=e/t;return n<.4||n>2.5?`图片宽高比需在 0.4~2.5 之间,当前为 ${n.toFixed(2)}`:null},on=(e,t)=>{if(e<300||e>6e3)return`视频宽度需在 300~6000px 之间,当前为 ${e}px`;if(t<300||t>6e3)return`视频高度需在 300~6000px 之间,当前为 ${t}px`;let n=e/t;if(n<.4||n>2.5)return`视频宽高比需在 0.4~2.5 之间,当前为 ${n.toFixed(2)}`;let r=e*t;return r<409600?`视频总像素数过小(${e}×${t}=${r}),需 ≥ 640×640=409600`:r>8295044?`视频总像素数过大(${e}×${t}=${r}),需 ≤ 3326×2494=8295044`:null},sn=async(t,n)=>{let r=t.type.startsWith(`image/`),i=t.type.startsWith(`video/`);if(c===`video`&&K===`first_last_frame`){if(!r)return e.error(`首尾帧模式仅支持上传图片`),!1;if(t.size/1024/1024>10)return e.error(`图片大小不能超过10MB`),!1;try{let{width:n,height:r}=await nn(t),i=an(n,r);if(i)return e.error(i),!1}catch{return e.error(`无法读取图片尺寸,请检查文件是否损坏`),!1}let i=n||le;if(!i)return e.error(`请选择首帧或尾帧上传位置`),!1;te(!0);try{let n=await O5(t),r={name:t.name,type:`image`,url:n.url,role:i===`first`?`first_frame`:`last_frame`};i===`first`?oe(r):ce(r),e.success(`图片上传成功`)}catch{e.error(`上传失败`)}finally{te(!1),ue(null)}return!1}let a=t.type.startsWith(`audio/`);if(!r&&!i&&!a)return e.error(`仅支持图片、视频或音频文件`),!1;if(a){let n=t.name.split(`.`).pop()?.toLowerCase();if(![`wav`,`mp3`].includes(n||``))return e.error(`音频仅支持wav和mp3格式`),!1}if(c===`image`&&(i||a))return e.error(`图片模式仅支持上传图片`),!1;if(a&&c!==`video`)return e.error(`仅视频模式支持上传音频`),!1;let o=i?100:a?50:10,s=i?`视频`:a?`音频`:`图片`;if(t.size/1024/1024>o)return e.error(`${s}大小不能超过${o}MB`),!1;if(r)try{let{width:n,height:r}=await nn(t),i=an(n,r);if(i)return e.error(i),!1}catch{return e.error(`无法读取图片尺寸,请检查文件是否损坏`),!1}let l=F.filter(e=>e.type===`image`).length;if(r&&l>=jn)return e.error(`该引擎最多上传${jn}张图片`),!1;let u=F.filter(e=>e.type===`video`).length;if(i&&u>=Mn)return e.error(`该引擎最多上传${Mn}个视频`),!1;let d=F.filter(e=>e.type===`audio`).length;if(a&&d>=Nn)return e.error(`该引擎最多上传${Nn}个音频`),!1;let f=0,p=0;if(i)try{if(f=await $t(t),f<2)return e.error(`视频素材最短不能少于 2 秒`),!1;let n=F.filter(e=>e.type===`video`).reduce((e,t)=>e+(t.duration||0),0);if(n+f>15)return e.error(`所有视频素材总时长不能超过 15 秒,当前 ${(n+f).toFixed(1)} 秒`),!1;let{width:r,height:i}=await rn(t),a=on(r,i);if(a)return e.error(a),!1}catch{return e.error(`无法获取视频信息,请检查文件是否损坏`),!1}if(a)try{if(p=await en(t),p<2)return e.error(`音频素材最短不能少于 2 秒`),!1;let n=F.filter(e=>e.type===`audio`).reduce((e,t)=>e+(t.duration||0),0);if(n+p>15)return e.error(`所有音频素材总时长不能超过 15 秒,当前 ${(n+p).toFixed(1)} 秒`),!1}catch{return e.error(`无法获取音频信息,请检查文件是否损坏`),!1}te(!0);try{let e;e=r?await O5(t):a?await D5(t,p):await k5(t,f);let n=r?`image`:a?`audio`:`video`,o=[...F,{name:t.name,type:n,url:e.url,label:``,...i&&{duration:f},...a&&{duration:p}}],s=Oe(o);I(o.map((e,t)=>({...e,label:s[t]})))}catch{e.error(`上传失败`)}finally{te(!1)}return!1},cn=async t=>{let n=t.type.startsWith(`image/`),r=t.type.startsWith(`video/`),i=t.type.startsWith(`audio/`);if(!n&&!r&&!i)return e.error(`仅支持图片、视频或音频文件`),!1;let a=r?100:i?50:10;if(t.size/1024/1024>a)return e.error(`${r?`视频`:i?`音频`:`图片`}大小不能超过${a}MB`),!1;if(i){let n=t.name.split(`.`).pop()?.toLowerCase();if(![`wav`,`mp3`].includes(n||``))return e.error(`音频仅支持wav和mp3格式`),!1}if(n)try{let{width:n,height:r}=await nn(t),i=an(n,r);if(i)return e.error(i),!1}catch{return e.error(`无法读取图片尺寸,请检查文件是否损坏`),!1}let o=0,s=0;if(r)try{if(o=await $t(t),o<2)return e.error(`视频素材最短不能少于 2 秒`),!1;let n=T7.getState().currentMedia.filter(e=>e.type===`video`).reduce((e,t)=>e+(t.duration||0),0);if(n+o>15)return e.error(`所有视频素材总时长不能超过 15 秒,当前 ${(n+o).toFixed(1)} 秒`),!1}catch{return e.error(`无法获取视频信息,请检查文件是否损坏`),!1}if(i)try{if(s=await en(t),s<2)return e.error(`音频素材最短不能少于 2 秒`),!1;let n=T7.getState().currentMedia.filter(e=>e.type===`audio`).reduce((e,t)=>e+(t.duration||0),0);if(n+s>15)return e.error(`所有音频素材总时长不能超过 15 秒,当前 ${(n+s).toFixed(1)} 秒`),!1}catch{return e.error(`无法获取音频信息,请检查文件是否损坏`),!1}let c=n?`image`:i?`audio`:`video`,l={name:t.name,type:c,url:``,label:``,...r&&{duration:o},...i&&{duration:s}},u=T7.getState().currentMedia;if(!dn(u,[l]))return!1;try{let e;return e=n?await O5(t):i?await D5(t,s):await k5(t,o),{name:l.name,type:l.type,url:e.url,label:l.label||``,...l.duration!==void 0&&{duration:l.duration}}}catch{return e.error(`上传失败`),!1}},ln=async t=>{let n=0,r=0;te(!0);for(let e of t){let t=await cn(e);if(t){let e=[...T7.getState().currentMedia,t],r=Oe(e);I(e.map((e,t)=>({...e,label:r[t]}))),n++}else r++}te(!1),n>0&&e.success(`成功上传${n}个文件${r>0?`,${r}个文件上传失败`:``}`)},un=(e,t)=>e.filter(e=>e.type===t).reduce((e,t)=>e+(Number(t.duration)||0),0),dn=(t,n)=>{if(!n.length)return!1;if(c===`image`&&n.some(e=>e.type!==`image`))return e.error(`图片模式仅支持添加图片素材`),!1;if(n.some(e=>e.type===`audio`)&&c!==`video`)return e.error(`仅视频模式支持添加音频素材`),!1;let r=t.filter(e=>e.type===`image`).length,i=t.filter(e=>e.type===`video`).length,a=t.filter(e=>e.type===`audio`).length,o=n.filter(e=>e.type===`image`).length,s=n.filter(e=>e.type===`video`).length,l=n.filter(e=>e.type===`audio`).length;if(r+o>jn)return e.error(`该引擎最多上传${jn}张图片,当前还能添加 ${Math.max(0,jn-r)} 张`),!1;if(i+s>Mn)return e.error(`该引擎最多上传${Mn}个视频,当前还能添加 ${Math.max(0,Mn-i)} 个`),!1;if(a+l>Nn)return e.error(`该引擎最多上传${Nn}个音频,当前还能添加 ${Math.max(0,Nn-a)} 个`),!1;for(let t of n){if(t.type!==`video`)continue;let n=Number(t.duration);if(!Number.isFinite(n)||n<=0)return e.error(`${t.name||`视频素材`}缺少视频秒数,不能用于 AI 创作`),!1;if(n<2)return e.error(`${t.name||`视频素材`}最短不能少于 2 秒`),!1;if(n>15)return e.error(`${t.name||`视频素材`}最长不能超过 15 秒`),!1}let u=un(t,`video`)+un(n,`video`);if(u>15)return e.error(`所有视频素材总时长不能超过 15 秒,当前 ${u.toFixed(1)} 秒`),!1;let d=un(t,`audio`)+un(n,`audio`);return d>15?(e.error(`所有音频素材总时长不能超过 15 秒,当前 ${d.toFixed(1)} 秒`),!1):!0},fn=t=>{let n=t.mediaReference,r=n?.type||t.resourceType,i=n?.url||t.resourceUrl||t.displayUrl||t.previewUrl||``;if(!i)return e.error(`${t.fileName||t.id} 缺少素材地址,不能用于 AI 创作`),null;if(r===`audio`&&c!==`video`)return e.error(`仅视频模式支持添加音频素材`),null;let a=Number(n?.duration??t.durationSeconds);return{name:n?.name||t.fileName||t.id,type:r,url:i,source:`upload_resource`,upload_resource_id:t.id,label:``,...(r===`video`||r===`audio`)&&Number.isFinite(a)&&a>0?{duration:a}:{}}},pn=t=>{let n=t.map(fn).filter(Boolean);if(!n.length)return;let r=T7.getState().currentMedia;if(!dn(r,n))return;let i=[...r,...n],a=Oe(i);I(i.map((e,t)=>({...e,label:a[t]}))),e.success(`已添加 ${n.length} 个历史上传素材参考`)},mn=t=>{if(t.assetType===`Audio`)return e.error(`音频私域素材暂不支持用于 AI 创作`),null;let n=t.assetType===`Video`?`video`:`image`,r=he===`aigc_virtual`?`虚拟素材`:`真人素材`,i=n===`video`?t.videoCoverUrl||t.previewUrl||t.displayUrl||t.providerUrl||``:t.previewUrl||t.displayUrl||t.videoCoverUrl||t.providerUrl||``;return{name:t.name||r,type:n,url:i,source:`private_portrait_asset`,private_asset_id:t.id,label:``,...n===`video`&&{duration:Number(t.videoDuration)||void 0}}},hn=e=>{ge(e),me(!0)},gn=t=>{let n=t.map(mn).filter(Boolean),r=T7.getState().currentMedia;if(!dn(r,n))return;let i=[...r,...n],a=Oe(i);I(i.map((e,t)=>({...e,label:a[t]}))),e.success(`已添加 ${n.length} 个${he===`aigc_virtual`?`虚拟`:`真人`}素材参考`)},_n=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,vn=e=>{let t=F.filter((t,n)=>n!==e),n=Oe(t);I(t.map((e,t)=>({...e,label:n[t]})))},yn=(e,t)=>{let n=e.selectionStart;return t.slice(0,n).match(/@([^@\s]*)$/)&&F.length>0?(Ce(!0),!0):(Ce(!1),!1)},bn=e=>{let t=e.target.value;P(t);let n=e.target;yn(n,t)},xn=e=>{Se&&e.key===`Escape`&&Ce(!1)},Sn=e=>{let t=we.current?.resizableTextArea?.textArea;if(!t)return;let n=t.selectionStart,r=b.slice(0,n),i=b.slice(n),a=r.lastIndexOf(`@`);if(a===-1){Ce(!1);return}P(r.slice(0,a)+`@${e} `+i),Ce(!1),setTimeout(()=>{let n=a+e.length+2;t.focus(),t.setSelectionRange(n,n)},0)},Cn=()=>{Ae(!1),Me(``),Fe.current&&Fe.current.pause()},wn=e=>{if(e.preventDefault(),e.stopPropagation(),!je)return;let t=document.createElement(`a`);t.href=`http://ceshi.apiforeign.minzhong.cn${je}&download=1`,t.download=Ne===`image`?`image.png`:`video.mp4`,document.body.appendChild(t),t.click(),document.body.removeChild(t)},Tn=e=>{let t=String(e?.type||``).toLowerCase(),n=String(e?.url||e?.name||``).toLowerCase();return t.includes(`video`)||/\.(mp4|mov|avi|webm|m4v)(\?|$)/.test(n)?`video`:t.includes(`audio`)||/\.(mp3|wav|ogg|aac|m4a)(\?|$)/.test(n)?`audio`:`image`},En=e=>e?/^https?:\/\//i.test(e)?e:`http://ceshi.apiforeign.minzhong.cn${e}`:``,Dn=e=>{e?.url&&(Ue(e.url),Ge(Tn(e)),Je(e.name||`附件`),Ve(!0))},On=c===`video`&&K===`first_last_frame`,kn=!ee&&(On?!!(b.trim()||q):!!(b.trim()||F.length>0)),An=c===`image`?`输入画面描述,或上传图片参考风格、构图、主体与光影。例:@图片1 参考色调,生成一张简洁高级的产品海报。`:On?`首帧尾帧可以不传,如需传入建议描述首帧到尾帧的主体动作、镜头运动、节奏与转场。例:从首帧自然推进到尾帧,产品居中突出,动作平滑连贯。`:`上传最多12个参考素材,输入文字或 @ 引用参考内容,自由组合图、文、视频。例:@图片1 模仿 @视频1 的动作。`,jn=z,Mn=B,Nn=R?.maxAudioCount??1;return(0,$.jsxs)(KW,{className:`ai-create-page`,style:{margin:`-24px -32px -32px`,borderRadius:22,height:`calc(100vh - 34px)`,background:`#fff`,overflow:`hidden`},children:[(0,$.jsx)(`audio`,{id:`audio-player`,src:Xe||null,autoPlay:!0,onEnded:()=>Ze(null),style:{display:`none`}}),!1,(0,$.jsxs)(KW,{style:{display:`flex`,flex:1,background:`#fff`},children:[(0,$.jsx)(`div`,{className:`animate-fadeInUp`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`16px 24px`,background:`linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, rgba(139, 92, 246, 0.04) 100%)`,backdropFilter:`blur(22px)`,border:`1px solid rgba(231, 234, 240, 0.82)`,position:`relative`,overflow:`hidden`,flexWrap:`wrap`,gap:12},children:(0,$.jsxs)(`div`,{style:{width:`100%`,display:`flex`,alignItems:`center`,gap:16},children:[(0,$.jsx)(`div`,{style:{width:`15%`,height:1,background:`linear-gradient(90deg, transparent, rgba(117,106,136,0.18), rgba(232,227,236,0.48), transparent)`,borderRadius:1}}),(0,$.jsxs)(`div`,{style:{flex:1,minWidth:0,textAlign:`center`},children:[(0,$.jsx)(`h2`,{style:{margin:0,fontSize:18,fontWeight:700,color:`#8b5cf6`,letterSpacing:.4},children:`AI创作`}),(0,$.jsx)(`p`,{style:{fontSize:13,color:`#667085`,margin:`4px 0 0 0`},children:`输入想法、剧本或上传参考,智能生成视频/图片`})]}),(0,$.jsx)(`div`,{style:{width:`15%`,height:1,background:`linear-gradient(90deg, transparent, rgba(232,227,236,0.48), rgba(117,106,136,0.18), transparent)`,borderRadius:1}})]})}),(0,$.jsxs)(qoe,{style:{flex:1,margin:0,padding:`20px 24px 22px`,boxSizing:`border-box`,display:`flex`,flexDirection:`column`,overflow:`hidden`,minHeight:0},children:[Mt.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, #8b5cf6 0%, #ddd6fe 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,marginBottom:16},children:(0,$.jsx)(u8,{style:{fontSize:40,color:`#fff`}})}),(0,$.jsx)(`h2`,{style:{margin:0,fontSize:18,fontWeight:500,color:`#2f3440`},children:`你好,想创作什么?`}),(0,$.jsx)(`p`,{style:{margin:8,fontSize:13,color:`#98a2b3`},children:`输入想法、剧本或上传参考,开始你的创作之旅`})]}),Mt.length>0&&(0,$.jsxs)(`div`,{ref:Ot,className:`ai-create-scroll`,style:{flex:1,overflowY:`auto`,paddingRight:10,paddingBottom:18,background:`#fff`},onScroll:e=>{let t=e.currentTarget;!(Date.now()-jt.current<500)&&At.current&&t.scrollTop<=50&&!Rt&&Mt.length{let t=e;return Mt.map(e=>(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, #8b5cf6 0%, #ddd6fe 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,$.jsx)(u8,{style:{color:`#fff`,fontSize:16}})}),(0,$.jsx)(`div`,{style:{flex:1},children:(0,$.jsxs)(`div`,{style:{background:`rgba(255, 255, 255, 0.92)`,backdropFilter:`blur(18px)`,borderRadius:`22px`,padding:`14px 16px`,width:`70%`,minWidth:500,boxSizing:`border-box`,boxShadow:`0 18px 50px rgba(47, 52, 64, 0.075)`,position:`relative`,border:`1px solid rgba(231, 234, 240, 0.9)`},children:[(0,$.jsxs)(`div`,{style:{margin:4,fontSize:11,color:`#98a2b3`,textAlign:`left`,display:`flex`,flexWrap:`wrap`,gap:8,alignItems:`center`},children:[(0,$.jsx)(`span`,{children:e.createdAt?.replace(`T`,` `).split(`.`)[0]}),(0,$.jsx)(`span`,{style:{background:(e.genType,`rgba(139, 92, 246, 0.10)`),color:(e.genType,`#8b5cf6`),padding:`2px 8px`,borderRadius:12,fontWeight:500,fontSize:11,marginLeft:8},children:e.genType===`image`?`图片生成`:`视频生成`})]}),e.mediaReferences&&e.mediaReferences.length>0&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8,zIndex:100},children:(0,$.jsx)(`span`,{style:{padding:`4px 12px`,borderRadius:16,color:`#8b5cf6`,cursor:`pointer`,fontWeight:500,border:`1px solid rgba(139, 92, 246, 0.2)`,background:`rgba(139, 92, 246, 0.04)`},onClick:t=>{t.stopPropagation();let n=t.currentTarget.getBoundingClientRect();at({x:n.left,y:n.top-10}),rt(e.id),tt(!0)},children:`附件详情`})}),(0,$.jsxs)(`div`,{style:{position:`absolute`,bottom:8,right:8,zIndex:100,display:`flex`,gap:6},children:[(0,$.jsxs)(`button`,{onClick:n=>{n.stopPropagation(),P(e.originalPrompt||``);let r=!0,i=e.engineId||e.engineSnapshot?.id||e.engine_id;if(i&&e.genType){let n=Array.isArray(y)?{}:y,a=(e.genType===`image`?n.image:n.video)?.find(e=>e.id===i);if(a){if(C(a.id),e.genType===`video`&&M({ratios:a.supportedRatios||[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:a.supportedResolutions||[`480p`,`720p`,`1080p`],durations:a.supportedDurations||[5,8,10,12,15]}),e.genType===`image`){let e=a.supportedSizes||{},t=Object.keys(e).sort((e,t)=>{let n={"1K":0,"2K":1,"4K":2};return(n[e]||0)-(n[t]||0)}),n=t[0]||`2K`,r=Object.keys(e[n]||{});if(dt(r.map(e=>({value:e,label:e}))),ht(e),pt(t.map(e=>{let t=e.match(/(\d+)K/);return{value:e,label:`${{1:`标清`,2:`高清`,4:`超清`}[t?parseInt(t[1]):1]||`高清`} ${e}`}})),e[n]&&e[n][r[0]]){let[t,i]=e[n][r[0]].split(/[×x]/);D(Number(t)),O(Number(i)),T(r[0]),E(n)}}}else t.error(`该引擎已删除,无法重新编辑`),r=!1}if(r){if(e.genType&&(Te.current=!0,x(e.genType)),e.mediaReferences&&e.mediaReferences.length>0)if(e.mediaReferences.some(e=>e.role===`first_frame`||e.role===`last_frame`)&&e.genType===`video`){let t=e.mediaReferences.find(e=>e.role===`first_frame`),n=e.mediaReferences.find(e=>e.role===`last_frame`);oe(t?{...t,label:t.label||``,duration:t.duration}:null),ce(n?{...n,label:n.label||``,duration:n.duration}:null),I([]),ae(`first_last_frame`)}else if(I(e.mediaReferences.map(e=>({name:e.name,type:e.type,url:e.url,label:e.label||``,role:e.role,duration:e.duration}))),oe(null),ce(null),e.genType===`video`){let e=L.video?.find(e=>e.id===i);if(e){let t=e.supportsUniversalReference??!0,n=e.supportsFirstLastFrame??!1;ae(t?`universal`:n?`first_last_frame`:`universal`)}else ae(`universal`)}else ae(`universal`);else if(I([]),oe(null),ce(null),e.genType===`video`){let e=y?.video?.find(e=>e.id===i);if(e){let t=e.supportsUniversalReference??!0,n=e.supportsFirstLastFrame??!1;ae(t?`universal`:n?`first_last_frame`:`universal`)}}t.success(`已加载到编辑区`)}},style:{height:28,padding:`0 10px`,borderRadius:10,border:`none`,background:`rgba(139, 92, 246, 0.08)`,color:`#8b5cf6`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.2s ease`,gap:4,fontSize:12},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(139, 92, 246, 0.15)`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(139, 92, 246, 0.08)`},children:[(0,$.jsx)(Tq,{style:{fontSize:12}}),`重新编辑`]}),(0,$.jsx)(yK,{title:`确定要删除吗?`,onConfirm:async()=>{try{await Uie(e.id),t.success(`删除成功`),Nt(t=>t.filter(t=>t.id!==e.id)),Lt(e=>e-1)}catch(e){let n=e?.response?.data?.message||e?.message||`删除失败`;t.error(n)}},okText:`确定`,cancelText:`取消`,children:(0,$.jsxs)(`button`,{onClick:e=>e.stopPropagation(),style:{height:28,padding:`0 10px`,borderRadius:10,border:`none`,background:`rgba(139, 92, 246, 0.08)`,color:`#8b5cf6`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.2s ease`,gap:4,fontSize:12},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(164, 91, 91, 0.1)`,e.currentTarget.style.color=`#A45B5B`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(139, 92, 246, 0.08)`,e.currentTarget.style.color=`#8b5cf6`},children:[(0,$.jsx)(d$,{style:{fontSize:12}}),`删除`]})})]}),(e.status===`generating`||e.status===`failed`||e.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 #E7EAF0`,boxShadow:`0 4px 12px rgba(139, 92, 246, 0.08)`,background:`linear-gradient(135deg, #ffffff 0%, #FAFBFC 100%)`},children:(0,$.jsx)(Coe,{task:e,resolveUrl:Zoe,onPreview:(e,t)=>{Me(e),Pe(t),Ae(!0)}})}),(0,$.jsxs)(`div`,{style:{width:`50%`,display:`flex`,flexDirection:`column`,gap:12},children:[(0,$.jsx)(`div`,{style:{background:`#FFFFFF`,borderRadius:12,padding:12,border:`1px solid #E7EAF0`,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:`#475467`,fontSize:13},children:e.originalPrompt})}),(0,$.jsxs)(`div`,{style:{fontSize:12,color:`#667085`,textAlign:`left`,display:`flex`,flexWrap:`wrap`,gap:12,alignItems:`center`,justifyContent:`space-between`,marginBottom:12},children:[(0,$.jsx)(`span`,{style:{borderRadius:16,color:`#8b5cf6`,fontWeight:500},children:e.engineSnapshot?.name||`未知引擎`}),(0,$.jsx)(`span`,{style:{borderRadius:16,color:`#667085`},children:e.genType===`image`?`${e.imageProportion||``} · ${e.imagePx||``} · ${e.imageSize||``}`:`${e.duration||``}秒 · ${e.aspectRatio||``} · ${e.resolution||``}`}),(0,$.jsxs)(`span`,{style:{fontSize:14,borderRadius:16,color:`#8b5cf6`},children:[`消耗积分:`,e.creditsCost]})]})]})]})]})})]})},e.id))})(),(0,$.jsx)(`div`,{ref:Dt})]}),et&&nt&&(()=>{let e=Mt.find(e=>e.id===nt)?.mediaReferences||[];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{position:`fixed`,top:0,left:0,right:0,bottom:0,background:`transparent`,zIndex:9998},onClick:()=>{tt(!1),rt(null)}}),(0,$.jsxs)(`div`,{className:`ai-reference-expanded-tray ai-attachment-popover`,style:{position:`fixed`,top:`max(84px, ${it.y-96}px)`,left:`max(24px, min(${it.x-250}px, calc(100vw - 456px)))`,width:424,padding:`12px 12px 10px`,borderRadius:18,background:`rgba(255,255,255,0.98)`,border:`1px solid #E7EAF0`,boxShadow:`0 24px 60px rgba(31, 41, 55, 0.12)`,backdropFilter:`blur(18px)`,zIndex:9999,pointerEvents:`auto`},onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:10},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2},children:[(0,$.jsx)(`span`,{style:{fontSize:13,color:`#344054`,fontWeight:800},children:`参考附件`}),(0,$.jsx)(`span`,{style:{fontSize:11,color:`#98A2B3`,fontWeight:600},children:`点击素材查看,或直接下载原文件`})]}),(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:(0,$.jsx)(`button`,{onClick:()=>{tt(!1),rt(null)},style:{width:26,height:26,borderRadius:`50%`,border:`1px solid transparent`,background:`#F6F7FA`,cursor:`pointer`,color:`#98a2b3`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#EEF1F6`,e.currentTarget.style.color=`#2f3440`},onMouseLeave:e=>{e.currentTarget.style.background=`#F6F7FA`,e.currentTarget.style.color=`#98a2b3`},children:(0,$.jsx)(ju,{style:{fontSize:12}})})})]}),(0,$.jsx)(`div`,{className:`ai-reference-tray-scroll`,style:{display:`flex`,gap:10,overflowX:`auto`,padding:`2px 2px 4px`},children:e.map((e,t)=>{let n=Tn(e),r=e.label||(e.role===`first_frame`?`首帧`:e.role===`last_frame`?`尾帧`:`${n===`image`?`图片`:n===`video`?`视频`:`音频`}${t+1}`);return(0,$.jsxs)(`div`,{style:{flex:`0 0 92px`,width:92,borderRadius:16,background:`#FFFFFF`,border:`1px solid #E7EAF0`,boxShadow:`0 8px 18px rgba(31, 41, 55, 0.06)`,padding:7,boxSizing:`border-box`},children:[(0,$.jsx)(`div`,{onClick:t=>{n===`audio`?(t.stopPropagation(),tn(e.url)):(Dn(e),tt(!1),rt(null))},style:{position:`relative`,width:`100%`,height:70,borderRadius:12,overflow:`hidden`,cursor:`pointer`,background:`#F7F8FA`,border:`1px solid rgba(231, 234, 240, 0.9)`},children:n===`image`?(0,$.jsx)(`img`,{src:En(e.url),alt:e.name||r,style:{width:`100%`,height:`100%`,objectFit:`cover`,display:`block`}}):n===`video`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`video`,{src:En(e.url),muted:!0,playsInline:!0,style:{width:`100%`,height:`100%`,objectFit:`cover`,display:`block`}}),(0,$.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`rgba(31, 41, 55, 0.08)`},children:(0,$.jsx)(`div`,{style:{width:28,height:28,borderRadius:`50%`,background:`rgba(47, 52, 64, 0.72)`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 8px 18px rgba(31, 41, 55, 0.22)`},children:(0,$.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`#fff`,children:(0,$.jsx)(`path`,{d:`M8 5v14l11-7z`})})})})]}):(0,$.jsx)(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%)`},children:Xe===(e.url.startsWith(`http`)?e.url:`http://ceshi.apiforeign.minzhong.cn${e.url}`)?(0,$.jsx)(j6,{style:{fontSize:24,color:`#fff`}}):(0,$.jsx)(j2,{style:{fontSize:24,color:`#fff`}})})}),(0,$.jsx)(`div`,{title:e.name||r,style:{marginTop:6,color:`#667085`,fontSize:10,fontWeight:700,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,textAlign:`center`},children:e.name||r}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:5,marginTop:7},children:(0,$.jsx)(`button`,{onClick:()=>{Dn(e),tt(!1),rt(null)},style:{flex:1,height:24,borderRadius:9,border:`1px solid #E7EAF0`,background:`#F8FAFC`,color:`#8b5cf6`,fontSize:11,fontWeight:700,cursor:`pointer`,transition:`all 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#EEF1F6`},onMouseLeave:e=>{e.currentTarget.style.background=`#F8FAFC`},children:`查看`})})]},`${e.url||e.name||t}-${t}`)})})]})]})})(),(0,$.jsxs)(`div`,{style:{position:`relative`,background:`#ffffff`,borderRadius:24,padding:`18px 72px 16px 20px`,boxShadow:`0 22px 64px rgba(31, 41, 55, 0.08), 0 1px 0 rgba(255,255,255,0.98) inset`,transition:`all 0.25s ease`,border:`1px solid rgba(231, 234, 240, 0.78)`,backdropFilter:`blur(24px)`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,gap:18,alignItems:`flex-end`,marginBottom:14},children:[(0,$.jsx)(`div`,{style:{width:On?220:70,minWidth:On?220:70,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`flex-start`,paddingTop:2,gap:8},children:c===`video`&&K===`first_last_frame`?(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`stretch`,gap:12,width:`100%`,height:100},children:[(0,$.jsxs)(`div`,{style:{position:`relative`,flex:1,minWidth:0,height:100,borderRadius:12,border:`1px solid #E7EAF0`,background:`#ffffff`,boxShadow:`0 6px 16px rgba(47, 52, 64, 0.04)`,overflow:`hidden`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,left:10,right:10,display:`flex`,alignItems:`center`,justifyContent:`space-between`,zIndex:2},children:(0,$.jsx)(`span`,{style:{fontSize:11,fontWeight:600,color:`#8b5cf6`,lineHeight:1},children:`首帧(可选)`})}),q?(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64},children:[(0,$.jsx)(`img`,{src:_n(q.url),alt:q.name,onClick:()=>{Ue(q.url),Ge(`image`),Je(q.name),Ve(!0)},style:{width:`100%`,height:`100%`,objectFit:`cover`,borderRadius:8,cursor:`pointer`,border:`1px solid rgba(139, 92, 246, 0.2)`,boxShadow:`0 3px 10px rgba(47, 52, 64, 0.06)`}}),(0,$.jsx)(`button`,{onClick:Yt,style:{position:`absolute`,top:-6,right:-6,width:18,height:18,border:`none`,background:`#A45B5B`,borderRadius:50,cursor:`pointer`,color:`#fff`,fontSize:9,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 2px 4px rgba(164, 91, 91, 0.3)`,zIndex:10},children:(0,$.jsx)(d$,{style:{fontSize:9}})})]}):(0,$.jsx)(B7,{accept:`image/*`,multiple:!1,onLocalSelect:e=>{e.length>0&&sn(e[0],`first`)},onHistorySelect:t=>{if(t.length>0){let n=t[0];oe({name:n.fileName||``,type:`image`,url:n.resourceUrl||n.previewUrl||n.displayUrl||``,role:`first_frame`,label:``}),e.success(`成功添加首帧`)}},onPortraitSelect:t=>{if(t.length>0){let n=t[0],r=n.previewUrl||n.displayUrl||n.videoCoverUrl||n.providerUrl||``;oe({name:n.name||`首帧图片`,type:`image`,url:r,role:`first_frame`,label:``,source:`private_portrait_asset`,private_asset_id:n.id}),e.success(`成功添加首帧`)}},uploading:ee,children:(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64,borderRadius:8,border:`1px dashed rgba(139, 92, 246, 0.28)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,transition:`all 0.25s ease`,backgroundColor:`rgba(139, 92, 246, 0.04)`,flexDirection:`column`,gap:4},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#a78bfa`,e.currentTarget.style.backgroundColor=`rgba(139, 92, 246, 0.08)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`rgba(139, 92, 246, 0.28)`,e.currentTarget.style.backgroundColor=`rgba(139, 92, 246, 0.04)`},children:[(0,$.jsx)(rL,{style:{fontSize:18,color:`#8b5cf6`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#8b5cf6`,fontWeight:500},children:`上传首帧`})]})})]}),(0,$.jsx)(`button`,{onClick:Jt,disabled:!q||!se,title:`调换首尾帧`,style:{width:32,height:32,alignSelf:`center`,borderRadius:50,border:`1px solid rgba(231, 234, 240, 0.95)`,background:q&&se?`linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%)`:`#F3F5F8`,cursor:q&&se?`pointer`:`not-allowed`,color:q&&se?`#fff`:`#98A2B3`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:q&&se?`0 6px 14px rgba(139, 92, 246, 0.24)`:`none`,transition:`all 0.2s ease`,flexShrink:0},onMouseEnter:e=>{q&&se&&(e.currentTarget.style.transform=`scale(1.06)`)},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`},children:(0,$.jsx)(VU,{style:{fontSize:14}})}),(0,$.jsxs)(`div`,{style:{position:`relative`,flex:1,minWidth:0,height:100,borderRadius:12,border:`1px solid #E7EAF0`,background:`#ffffff`,boxShadow:`0 6px 16px rgba(47, 52, 64, 0.04)`,overflow:`hidden`,opacity:q?1:.5},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,left:10,right:10,display:`flex`,alignItems:`center`,justifyContent:`space-between`,zIndex:2},children:(0,$.jsx)(`span`,{style:{fontSize:11,fontWeight:600,color:`#8b5cf6`,lineHeight:1},children:`尾帧`})}),se?(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64},children:[(0,$.jsx)(`img`,{src:_n(se.url),alt:se.name,onClick:()=>{Ue(se.url),Ge(`image`),Je(se.name),Ve(!0)},style:{width:`100%`,height:`100%`,objectFit:`cover`,borderRadius:8,cursor:`pointer`,border:`1px solid rgba(139, 92, 246, 0.2)`,boxShadow:`0 3px 10px rgba(47, 52, 64, 0.06)`}}),(0,$.jsx)(`button`,{onClick:Xt,style:{position:`absolute`,top:-6,right:-6,width:18,height:18,border:`none`,background:`#A45B5B`,borderRadius:50,cursor:`pointer`,color:`#fff`,fontSize:9,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 2px 4px rgba(164, 91, 91, 0.3)`,zIndex:10},children:(0,$.jsx)(d$,{style:{fontSize:9}})})]}):q?(0,$.jsx)(B7,{accept:`image/*`,multiple:!1,onLocalSelect:e=>{e.length>0&&sn(e[0],`last`)},onHistorySelect:t=>{if(t.length>0){let n=t[0];ce({name:n.fileName||``,type:`image`,url:n.resourceUrl||n.previewUrl||n.displayUrl||``,role:`last_frame`,label:``}),e.success(`成功添加尾帧`)}},onPortraitSelect:t=>{if(t.length>0){let n=t[0],r=n.previewUrl||n.displayUrl||n.videoCoverUrl||n.providerUrl||``;ce({name:n.name||`尾帧图片`,type:`image`,url:r,role:`last_frame`,label:``,source:`private_portrait_asset`,private_asset_id:n.id}),e.success(`成功添加尾帧`)}},uploading:ee,children:(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64,borderRadius:8,border:`1px dashed rgba(139, 92, 246, 0.24)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,transition:`all 0.25s ease`,backgroundColor:`rgba(139, 92, 246, 0.04)`,flexDirection:`column`,gap:4},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#a78bfa`,e.currentTarget.style.backgroundColor=`rgba(139, 92, 246, 0.08)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`rgba(139, 92, 246, 0.24)`,e.currentTarget.style.backgroundColor=`rgba(139, 92, 246, 0.04)`},children:[(0,$.jsx)(rL,{style:{fontSize:18,color:`#8b5cf6`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#8b5cf6`,fontWeight:500},children:`上传尾帧`})]})}):(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64,borderRadius:8,border:`1px dashed rgba(226, 232, 240, 0.4)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`not-allowed`,backgroundColor:`rgba(241, 245, 249, 0.5)`,flexDirection:`column`,gap:4},children:[(0,$.jsx)(rL,{style:{fontSize:18,color:`#cbd5e1`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#94a3b8`,fontWeight:500},children:`请先上传首帧`})]})]})]}):(0,$.jsx)($.Fragment,{children:!(c===`video`&&K===`first_last_frame`)&&(0,$.jsxs)(`div`,{style:{position:`relative`,width:64,height:72,marginTop:`-10`},onMouseEnter:be,onMouseLeave:xe,children:[F.length===0&&(0,$.jsx)(B7,{accept:c===`image`?`image/*`:`image/*,video/*,audio/*`,onLocalSelect:ln,onHistorySelect:pn,onPortraitLibrarySelect:e=>{hn(e)},uploading:ee,tooltipTitle:c===`image`?`图片${F.filter(e=>e.type===`image`).length}/${z}`:`图片${F.filter(e=>e.type===`image`).length}/${z}, +`)){z(!0),V(e);return}}z(!1)},onPaste:e=>{let t=e.clipboardData?.items;if(!t)return;let n=[];for(let e=0;e0&&(e.preventDefault(),n.forEach(async e=>{await ze(e)}))},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)(Y6,{style:{color:`#fff`,fontSize:14}})}),(0,$.jsx)(Q.Text,{style:{fontSize:13},children:e.name}),(0,$.jsx)(ZQ,{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:[xe!==`image`&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,flex:1,flexWrap:`wrap`},children:[(0,$.jsx)(It,{label:`时长`,value:`${se}`,options:he.durations.map(e=>`${e}`),suffix:`秒`,expanded:pe===`duration`,onToggle:()=>me(pe===`duration`?null:`duration`),onSelect:e=>ce(parseInt(e)),onClose:()=>me(null)}),vt.map((e,t)=>{let n=G===e.name,r=ne[e.name];return(0,$.jsx)(Lt,{group:e,selected:r,expanded:n,onToggle:()=>ie(n?null:e.name),onSelect:t=>{re(n=>{let r={...n};return r[e.name]===t?delete r[e.name]:r[e.name]=t,r})},onClose:()=>ie(null)},`og-${t}`)})]}),xe==`image`&&(0,$.jsxs)(`div`,{style:{position:`relative`,display:`inline-block`},children:[(0,$.jsxs)(`button`,{onClick:()=>Me(!je),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)(Q.Text,{style:{fontSize:13,fontWeight:600,color:`#374151`,marginRight:10},children:Ce===`auto`?`智能`:Ce}),(0,$.jsxs)(Q.Text,{style:{fontSize:12,color:`#9ca3af`},children:[Te==`2K`?`高清 2K`:`超清 4K`,`| `,De,`×`,ke]})]})}),(0,$.jsx)(XZ,{style:{fontSize:14,color:`#9ca3af`}})]}),je&&(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)(Q.Text,{style:{display:`block`,marginBottom:10,fontSize:13,fontWeight:500,color:`#666666`},children:`选择比例`}),(0,$.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6},children:We.map(e=>(0,$.jsxs)(`button`,{onClick:()=>{we(e.value),He(e.label)},style:{flex:`0 0 calc(11.11% - 5px)`,minWidth:48,height:56,borderRadius:8,border:Ce===e.value?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:Ce===e.value?`#fff`:`#f9fafb`,cursor:`pointer`,display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,transition:`all 0.2s`},children:[(0,$.jsx)(`div`,{style:{width:(()=>{let[t,n]=e.value===`auto`?[1,1]:e.value.split(`:`).map(Number);return t>=n?20:Math.round(t/n*20)})(),height:(()=>{let[t,n]=e.value===`auto`?[1,1]:e.value.split(`:`).map(Number);return n>=t?20:Math.round(n/t*20)})(),border:`2px solid ${Ce===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:Ce===e.value?`#6366f1`:`#9ca3af`},children:`智`})}),(0,$.jsx)(`span`,{style:{fontSize:10,color:Ce===e.value?`#6366f1`:`#6b7280`,fontWeight:Ce===e.value?600:400},children:e.value})]},e.value))})]}),(0,$.jsxs)(`div`,{style:{marginBottom:20},children:[(0,$.jsx)(Q.Text,{style:{display:`block`,marginBottom:10,fontSize:13,fontWeight:500,color:`#666666`},children:`选择分辨率`}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:8},children:Ke.map(e=>(0,$.jsx)(`button`,{onClick:()=>{Ee(e.value),Ue(e.label)},style:{flex:1,height:48,borderRadius:8,border:Te===e.value?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:Te===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:Te===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)(Q.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)(LW,{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)(`button`,{onClick:nt,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)(VU,{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)(LW,{value:ke,onChange:e=>Ae(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:[xe===`image`&&(0,$.jsx)(`span`,{style:{color:`#7c7c7c`,fontSize:14},children:`(请在左侧选择图片比例和尺寸)`}),(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:Ct,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)(DL,{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)(p4,{style:{color:`#10b981`,fontSize:22}}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:15,display:`block`},children:`提示词优化完成`}),(0,$.jsxs)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:[`文本优化消耗 `,_e,` 积分· 您可以编辑提示词后选择参数生成视频`]})]})]}):(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)(Xm,{style:{color:`#6366f1`,fontSize:18},spin:!0}),w[h.id]===`done`&&(0,$.jsx)(p4,{style:{color:`#10b981`,fontSize:18}}),w[h.id]===`failed`&&(0,$.jsx)(g4,{style:{color:`#ef4444`,fontSize:18}}),(0,$.jsxs)(Q.Text,{strong:!0,style:{fontSize:14,color:w[h.id]===`failed`?`#ef4444`:w[h.id]===`done`?`#10b981`:`#6366f1`},children:[w[h.id]===`generating`&&`${xe===`image`?`图片`:`视频`}生成中,请稍候...`,w[h.id]===`done`&&`${xe===`image`?`图片`:`视频`}生成成功`,w[h.id]===`failed`&&`${xe===`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)(Q.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)(Q.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)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:[`优化后的提示词`,` `,!y&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),!y&&(0,$.jsxs)(cH,{size:4,children:[(0,$.jsx)(gw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(n1,{}),onClick:async()=>{let e=await j7(_);Z.success(e?`已复制`:`复制失败`)},style:{color:`#94a3b8`}})}),(0,$.jsx)(gw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(N$,{}),onClick:()=>b(!0),style:{color:`#6366f1`}})})]})]}),y?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(LW.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)(X,{size:`small`,onClick:()=>{v(h.optimizedPrompt||``),b(!1)},children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{b(!1),Z.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)(Q.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)(Q.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)(Q.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)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:[`优化后的提示词`,` `,!y&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),!y&&(0,$.jsxs)(cH,{size:4,children:[(0,$.jsx)(gw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(n1,{}),onClick:async()=>{let e=await j7(_);Z.success(e?`已复制`:`复制失败`)},style:{color:`#94a3b8`}})}),(0,$.jsx)(gw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(N$,{}),onClick:()=>b(!0),style:{color:`#6366f1`}})})]})]}),y?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(LW.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)(X,{size:`small`,onClick:()=>{v(h.optimizedPrompt||``),b(!1)},children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{b(!1),Z.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)(Q.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)(Q.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)(Q.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:`生成图片`}),(0,$.jsx)(nW,{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:[xe!==`image`&&(0,$.jsxs)(`div`,{style:{marginTop:24,borderRadius:12,background:`#f8f9fc`,width:`25%`},children:[(0,$.jsx)(Q.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)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:`时长`}),(0,$.jsxs)(Q.Text,{strong:!0,style:{fontSize:13,color:`#6366f1`},children:[se,`s`]})]}),(0,$.jsx)(It,{label:`比例`,value:le,options:he.ratios,expanded:pe===`ratio`,onToggle:()=>me(pe===`ratio`?null:`ratio`),onSelect:e=>ue(e),onClose:()=>me(null)}),(0,$.jsx)(It,{label:`分辨率`,value:de,options:he.resolutions,expanded:pe===`resolution`,onToggle:()=>me(pe===`resolution`?null:`resolution`),onSelect:e=>fe(e),onClose:()=>me(null)})]})]}),xe==`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)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`,marginBottom:4},children:`分辨率`}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:`#1a1a2e`},children:h.imageSize||`-`})]}),(0,$.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`,marginBottom:4},children:`画面比例`}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:`#1a1a2e`},children:h.imageProportion||`-`})]}),(0,$.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`,marginBottom:4},children:`画面尺寸`}),(0,$.jsx)(Q.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)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`文字积分`}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:`#6366f1`},children:_e})]}),(0,$.jsx)(Q.Text,{style:{color:`#cbd5e1`,fontSize:18},children:`+`}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:[`预估`,xe===`image`?`图片`:`视频`,`积分`]}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:`#10b981`},children:xe===`image`&&h.imageSize?bt(h.imageSize)||xt:Be(se,de)})]}),(0,$.jsx)(Q.Text,{style:{color:`#cbd5e1`,fontSize:18},children:`=`}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`总计`}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:16,color:`#1a1a2e`},children:(_e+(xe===`image`?bt(h.imageSize):Be(se,de))).toFixed(2)})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:12},children:[(0,$.jsxs)(X,{size:`large`,onClick:()=>{m(!1),g(null),v(``),L(``),N([]),re({}),ie(null),me(null),n.resetFields()},style:{borderRadius:12,minWidth:120,height:44,fontWeight:500},children:[`配置新`,xe===`image`?`图片`:`视频`]}),(0,$.jsx)(gw,{title:St?``:`积分不足`,children:(0,$.jsx)(X,{type:`primary`,size:`large`,icon:(0,$.jsx)(p8,{}),onClick:()=>Mt(h.id),loading:w[h.id]===`generating`,disabled:!St||w[h.id]===`generating`||w[h.id]===`done`,style:{borderRadius:12,minWidth:180,height:44,fontWeight:600,background:w[h.id]===`done`?`#10b981`:St?`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`:`#d1d5db`,border:`none`,boxShadow:St?`0 8px 24px rgba(99,102,241,0.3)`:`none`},children:w[h.id]===`done`?`生成完成`:w[h.id]===`generating`?`生成中...`:`生成${xe===`image`?`图片`:`视频`} (${xe===`image`?bt(h.imageSize):Be(se,de)}积分)`})})]})]}),h.references&&h.references.length>0&&(0,$.jsxs)(`div`,{style:{marginTop:16},children:[(0,$.jsx)(Q.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`&&oe(`http://ceshi.apiforeign.minzhong.cn${e.url}`)},children:[e.type===`image`?(0,$.jsx)(nW,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`},preview:!0}):(0,$.jsx)(V7,{src:`http://ceshi.apiforeign.minzhong.cn${e.url}`,width:64,height:64}),(0,$.jsx)(ZQ,{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))})]})]}),gt.length>0&&(0,$.jsxs)(`div`,{style:{marginTop:24},children:[(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:15,display:`block`,marginBottom:12},children:`本项目生成记录`}),(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8,background:`#fff`,borderRadius:12,padding:8,border:`1px solid #f0f0f5`},className:`stagger-children`,children:gt.map((e,t)=>{let n=Pt(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?`8px 8px 0 0`:8,background:`#fafafa`,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)(B6,{style:{color:`#d97706`,fontSize:12}}):(0,$.jsx)(r5,{style:{color:`#2563eb`,fontSize:12}})}),i?(0,$.jsx)(XZ,{style:{color:`#6366f1`,fontSize:11,flexShrink:0}}):(0,$.jsx)(u4,{style:{color:`#cbd5e1`,fontSize:11,flexShrink:0}}),(0,$.jsx)(ZQ,{color:Ft[n]?.color,icon:Ft[n]?.icon,style:{margin:0},children:Ft[n]?.text}),(0,$.jsx)(Q.Text,{style:{flex:1,fontSize:13,color:`#475569`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r}),n===`prompt_optimized`&&(0,$.jsx)(ZQ,{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:D7(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:D7(e.createdAt)})]}),(0,$.jsx)(`div`,{className:`record-actions`,onClick:e=>e.stopPropagation(),children:(0,$.jsx)(cH,{children:n===`failed`&&(0,$.jsx)(X,{type:`primary`,danger:!0,size:`small`,icon:(0,$.jsx)(Y6,{}),loading:x[e.id],onClick:()=>Nt(e.id),style:{borderRadius:8},children:`重试`})})})]}),i&&(0,$.jsx)(`div`,{style:{background:`#fff`,borderRadius:`0 0 8px 8px`,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)(Q.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)(Q.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)(Q.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)(cH,{size:4,children:[(0,$.jsx)(gw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(n1,{}),onClick:async()=>{let e=await j7(r);Z.success(e?`已复制`:`复制失败`)},style:{color:`#94a3b8`}})}),(n===`prompt_optimized`||n===`failed`)&&(0,$.jsx)(gw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(N$,{}),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)(LW.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)(X,{size:`small`,onClick:()=>k(null),children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{D(t=>({...t,[e.id]:r})),k(null),Z.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)(Q.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)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:e.label}),(0,$.jsx)(Q.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)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:e.label}),(0,$.jsx)(Q.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)(Q.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`&&oe(`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)(nW,{src:`http://ceshi.apiforeign.minzhong.cn${t.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`},preview:!0}):(0,$.jsx)(V7,{src:`http://ceshi.apiforeign.minzhong.cn${t.url}`,width:64,height:64})}),(0,$.jsx)(ZQ,{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);T7.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)(g4,{style:{color:`#fff`,fontSize:10}})})]},r)),n===`failed`&&(0,$.jsx)(x0,{accept:`image/*,video/*`,showUploadList:!1,multiple:!0,beforeUpload:t=>{let n=t.type.startsWith(`image/`),r=t.type.startsWith(`video/`);return!n&&!r?(Z.error(`仅支持图片或视频文件`),!1):(n?O5(t).then(n=>{let r={url:n.url,type:`image`,name:t.name||`图片`},i=e.references||[];T7.getState().updateRecordReferences(e.id,[...i,r]),Z.success(`上传成功`)}).catch(()=>Z.error(`上传失败`)):new Promise(e=>{let n=document.createElement(`video`);n.preload=`metadata`,n.onloadedmetadata=()=>{e(n.duration||0),n.remove()},n.onerror=()=>{e(0),n.remove()},n.src=URL.createObjectURL(t)}).then(n=>{k5(t,n).then(r=>{let i={url:r.url,type:`video`,name:t.name||`视频`,duration:n||void 0},a=e.references||[];T7.getState().updateRecordReferences(e.id,[...a,i]),Z.success(`上传成功`)}).catch(()=>Z.error(`上传失败`))}),!1)},children:(0,$.jsx)(gw,{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)(rL,{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)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:`时长`}),(0,$.jsxs)(Q.Text,{strong:!0,style:{fontSize:13,color:`#6366f1`},children:[e.duration,`秒`]})]}),(0,$.jsx)(It,{label:`比例`,value:K[e.id]?.aspectRatio||`选择比例`,options:he.ratios,expanded:pe===`ratio-${e.id}`,onToggle:()=>me(pe===`ratio-${e.id}`?null:`ratio-${e.id}`),onSelect:t=>ae(n=>({...n,[e.id]:{...n[e.id],aspectRatio:t,resolution:n[e.id]?.resolution||``}})),onClose:()=>me(null)}),(0,$.jsx)(It,{label:`分辨率`,value:K[e.id]?.resolution||`选择分辨率`,options:he.resolutions,expanded:pe===`res-${e.id}`,onToggle:()=>me(pe===`res-${e.id}`?null:`res-${e.id}`),onSelect:t=>ae(n=>({...n,[e.id]:{...n[e.id],aspectRatio:n[e.id]?.aspectRatio||``,resolution:t}})),onClose:()=>me(null)})]}),(0,$.jsxs)(X,{type:`primary`,size:`large`,icon:(0,$.jsx)(p8,{}),block:!0,loading:x[e.id],disabled:a===`video`&&(!K[e.id]?.aspectRatio||!K[e.id]?.resolution),onClick:async()=>{let t=K[e.id];if(a===`video`){if(!t?.aspectRatio||!t?.resolution){Z.error(`请选择比例和分辨率`);return}if(yt({...t,[e.id]:!0})),T(t=>({...t,[e.id]:`generating`}));let n=a===`video`?`视频`:`图片`;Z.loading({content:`「${_t}」正在生成${n}...`,duration:0,key:e.id});try{await c(e.id,{aspectRatio:t?.aspectRatio,resolution:t?.resolution}),T(t=>({...t,[e.id]:`done`})),Z.success({content:`「${_t}」${n}生成成功!`,key:e.id,duration:3})}catch{T(t=>({...t,[e.id]:`failed`})),Z.error({content:`「${_t}」${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`&&K[e.id]?.resolution?`(${Be(e.duration||5,K[e.id].resolution)}积分)`:``,a===`image`&&e.imageSize?`(${Ve(e.imageSize)}积分)`:a===`image`?`(积分)`:``]})]}),n===`failed`&&(0,$.jsx)(`div`,{style:{position:`absolute`,bottom:18,right:20},children:(0,$.jsxs)(X,{type:`primary`,danger:!0,size:`large`,icon:(0,$.jsx)(Y6,{}),block:!0,loading:x[e.id],onClick:()=>Nt(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)(Xm,{style:{color:`#6366f1`,fontSize:28},spin:!0}),(0,$.jsxs)(Q.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)(gw,{title:`下载${a===`video`?`视频`:`图片`}`,children:(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(h0,{}),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)(cH,{children:[a===`video`?(0,$.jsx)(r5,{style:{color:`#6366f1`,fontSize:13}}):(0,$.jsx)(B6,{style:{color:`#6366f1`,fontSize:13}}),(0,$.jsx)(Q.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:D7(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)(g4,{style:{color:`#ef4444`,fontSize:28}}),(0,$.jsxs)(Q.Text,{style:{color:`#ef4444`,fontSize:14,fontWeight:600},children:[a===`video`?`视频`:`图片`,`生成失败`]}),e.errorMessage&&(0,$.jsx)(Q.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)(lV,{style:{color:`#94a3b8`,fontSize:28}}),(0,$.jsx)(Q.Text,{style:{color:`#94a3b8`,fontSize:13},children:a===`image`?`待生成图片`:n===`prompt_optimized`?`待配置视频参数`:`待生成视频`})]})]})]})})]},e.id)})})]}),(0,$.jsx)(hK,{open:!!q,onCancel:()=>oe(null),footer:null,width:480,centered:!0,destroyOnHidden:!0,closable:!1,title:null,styles:{body:{padding:0,background:`#000`,position:`relative`}},children:q&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`video`,{src:q,controls:!0,autoPlay:!0,style:{width:`100%`,display:`block`,maxHeight:`70vh`}}),(0,$.jsx)(`div`,{onClick:()=>oe(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)(u5,{style:{color:`#fff`,fontSize:16}})})]})})]})},H7={optimizing:{color:`processing`,text:`优化中`,icon:(0,$.jsx)(Xm,{spin:!0})},prompt_optimized:{color:`processing`,text:`待生成`,icon:(0,$.jsx)(lV,{})},generating:{color:`warning`,text:`生成中`,icon:(0,$.jsx)(Xm,{spin:!0})},completed:{color:`success`,text:`已完成`,icon:(0,$.jsx)(p4,{})},failed:{color:`error`,text:`失败`,icon:(0,$.jsx)(g4,{})}},hoe=()=>{let e=Ye(),{records:t,projects:n,fetchRecords:r,fetchProjects:i,generateVideo:a}=T7(),o=t.items,[s,c]=(0,S.useState)(1),[l,u]=(0,S.useState)(10),[d,f]=(0,S.useState)({}),[p,m]=(0,S.useState)(void 0),[h,g]=(0,S.useState)(void 0),[_,v]=(0,S.useState)({}),[y,b]=(0,S.useState)(null),[x,C]=(0,S.useState)(null),[w,T]=(0,S.useState)(null);(0,S.useEffect)(()=>{i()},[i]),(0,S.useEffect)(()=>{r({projectId:p,status:h,page:s,pageSize:l})},[r,p,h,s,l]);let E=async()=>{if(!w)return;let{recordId:e,projectName:t,ratio:n,resolution:r}=w;f(t=>({...t,[e]:!0})),T(null),Z.loading({content:`「${t}」正在生成视频...`,duration:0,key:e});try{await a(e,{aspectRatio:n,resolution:r}),Z.success({content:`「${t}」视频生成成功!`,key:e,duration:3})}catch{Z.error({content:`「${t}」视频生成失败`,key:e,duration:3})}finally{f(t=>({...t,[e]:!1}))}},D=e=>{if((e.genType||`image`)===`image`){f(t=>({...t,[e.id]:!0})),Z.loading({content:`「${e.projectName}」正在生成图片...`,duration:0,key:e.id}),a(e.id,{}).then(()=>{Z.success({content:`「${e.projectName}」图片生成成功!`,key:e.id,duration:3})}).catch(()=>{Z.error({content:`「${e.projectName}」图片生成失败`,key:e.id,duration:3})}).finally(()=>{f(t=>({...t,[e.id]:!1}))});return}T({recordId:e.id,projectName:e.projectName,ratio:e.aspectRatio||`16:9`,resolution:e.resolution||`720p`})},O=o;return(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:20,padding:`16px 24px`,borderRadius:16,background:`rgba(255,255,255,0.6)`,backdropFilter:`blur(10px)`,border:`1px solid rgba(99, 102, 241, 0.08)`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16},children:[(0,$.jsx)(X,{icon:(0,$.jsx)(S2,{}),onClick:()=>e(`/projects`),style:{borderRadius:10,fontSize:13,height:32,background:`rgba(99, 102, 241, 0.1)`,border:`1px solid rgba(99, 102, 241, 0.2)`,color:`#6366f1`},children:`返回`}),(0,$.jsx)(`div`,{style:{width:32,height:2,background:`linear-gradient(90deg, transparent, #6366f1, #8b5cf6, transparent)`,borderRadius:1}}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Title,{level:2,style:{margin:0,fontSize:16,fontWeight:700,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:`项目记录`}),(0,$.jsx)(Q.Text,{style:{fontSize:13,color:`#64748b`},children:`查看所有视频生成记录,点击记录查看完整内容和视频`})]}),(0,$.jsx)(`div`,{style:{width:32,height:2,background:`linear-gradient(90deg, transparent, #8b5cf6, #6366f1, transparent)`,borderRadius:1}})]})}),(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)(cH,{children:[(0,$.jsx)(i3,{style:{color:`#94a3b8`}}),(0,$.jsx)(EC,{placeholder:`全部项目`,allowClear:!0,style:{width:200},onChange:e=>{m(e),c(1)},children:n.map(e=>(0,$.jsx)(EC.Option,{value:e.id,children:e.name},e.id))}),(0,$.jsxs)(EC,{placeholder:`全部状态`,allowClear:!0,style:{width:140},onChange:e=>{g(e),c(1)},children:[(0,$.jsx)(EC.Option,{value:`prompt_optimized`,children:`待生成`}),(0,$.jsx)(EC.Option,{value:`generating`,children:`生成中`}),(0,$.jsx)(EC.Option,{value:`completed`,children:`已完成`}),(0,$.jsx)(EC.Option,{value:`failed`,children:`失败`})]})]}),(0,$.jsxs)(Q.Text,{style:{marginLeft:`auto`,lineHeight:`32px`,color:`#94a3b8`,fontSize:13},children:[`共 `,t.total,` 条记录`]})]}),O.length===0?(0,$.jsx)(XS,{image:XS.PRESENTED_IMAGE_SIMPLE,description:`暂无生成记录`,style:{padding:60}}):(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},className:`stagger-children`,children:O.map((e,t)=>{let n=y===e.id,r=_[e.id]??e.optimizedPrompt,i=d[e.id],a=x===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:()=>C(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)(B6,{style:{color:`#d97706`,fontSize:12}}):(0,$.jsx)(r5,{style:{color:`#2563eb`,fontSize:12}})}),a?(0,$.jsx)(XZ,{style:{color:`#6366f1`,fontSize:12,flexShrink:0}}):(0,$.jsx)(u4,{style:{color:`#cbd5e1`,fontSize:12,flexShrink:0}}),(0,$.jsx)(ZQ,{color:H7[e.status].color,icon:H7[e.status].icon,style:{margin:0},children:H7[e.status].text}),(0,$.jsx)(ZQ,{style:{background:`#f0f0ff`,border:`none`,color:`#6366f1`,margin:0},children:e.projectName}),(0,$.jsx)(Q.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:D7(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:D7(e.createdAt)})]}),(0,$.jsx)(`div`,{className:`record-actions`,onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(cH,{children:[e.status===`prompt_optimized`&&(0,$.jsx)(X,{type:`primary`,size:`small`,icon:(0,$.jsx)(Y6,{}),loading:i,onClick:()=>D(e),style:{borderRadius:8,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`},children:`生成`}),e.status===`generating`&&(0,$.jsx)(ZQ,{color:`processing`,icon:(0,$.jsx)(Xm,{spin:!0}),style:{padding:`4px 12px`,fontSize:12},children:`生成中...`}),e.status===`failed`&&(0,$.jsx)(X,{type:`primary`,danger:!0,size:`small`,icon:(0,$.jsx)(Y6,{}),loading:i,onClick:()=>D(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)(Q.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)(Q.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)(Q.Text,{style:{fontSize:12,color:`#94a3b8`},children:[`优化后的提示词 `,e.status===`prompt_optimized`&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),!n&&(0,$.jsxs)(cH,{size:4,children:[(0,$.jsx)(gw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(n1,{}),onClick:async()=>{let e=await j7(r);Z.success(e?`已复制`:`复制失败`)},style:{color:`#94a3b8`}})}),e.status===`prompt_optimized`&&(0,$.jsx)(gw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(N$,{}),onClick:()=>{b(e.id),v(t=>({...t,[e.id]:t[e.id]??e.optimizedPrompt}))},style:{color:`#6366f1`}})})]})]}),n?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(LW.TextArea,{value:r,onChange:t=>v(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)(X,{size:`small`,onClick:()=>b(null),children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{v(t=>({...t,[e.id]:r})),b(null),Z.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)(Q.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)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:e.label}),(0,$.jsx)(Q.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)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:e.label}),(0,$.jsx)(Q.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)(X,{type:`primary`,size:`large`,icon:(0,$.jsx)(p8,{}),loading:i,onClick:()=>D(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)(X,{type:`primary`,danger:!0,size:`large`,icon:(0,$.jsx)(Y6,{}),loading:i,onClick:()=>D(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)(Xm,{style:{color:`#6366f1`,fontSize:32},spin:!0}),(0,$.jsxs)(Q.Text,{style:{color:`#94a3b8`,fontSize:14},children:[o===`video`?`视频`:`图片`,`生成中...`]}),(0,$.jsx)(Q.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)(gw,{title:`下载${o===`video`?`视频`:`图片`}`,children:(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(h0,{}),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)(cH,{children:[o===`video`?(0,$.jsx)(r5,{style:{color:`#6366f1`}}):(0,$.jsx)(B6,{style:{color:`#6366f1`}}),(0,$.jsx)(Q.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:[`生成于 `,D7(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)(g4,{style:{color:`#ef4444`,fontSize:32}}),(0,$.jsxs)(Q.Text,{style:{color:`#ef4444`,fontSize:14},children:[o===`video`?`视频`:`图片`,`生成失败`]}),(0,$.jsx)(Q.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)(lV,{style:{color:`#94a3b8`,fontSize:32}}),(0,$.jsxs)(Q.Text,{style:{color:`#94a3b8`,fontSize:14},children:[`待生成`,o===`video`?`视频`:`图片`]}),(0,$.jsx)(Q.Text,{style:{color:`#cbd5e1`,fontSize:12},children:`点击左侧生成按钮开始生成`})]})})]})})]},e.id)})}),t.total>0&&(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:18},children:(0,$.jsx)(CG,{current:t.page||s,pageSize:t.pageSize||l,total:t.total,showSizeChanger:!0,showTotal:e=>`共 ${e} 条记录`,onChange:(e,t)=>{c(e),u(t)}})}),(0,$.jsx)(hK,{title:(0,$.jsxs)(cH,{children:[(0,$.jsx)(p8,{}),`生成视频`]}),open:!!w,onCancel:()=>T(null),onOk:E,okText:`提交生成`,cancelText:`取消`,width:420,children:w&&(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16,marginTop:16},children:(()=>{let e=o.find(e=>e.id===w.recordId);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{style:{padding:12,borderRadius:10,background:`#f8f9fc`},children:[(0,$.jsx)(Q.Text,{style:{fontSize:11,color:`#94a3b8`,display:`block`},children:`时长`}),(0,$.jsxs)(Q.Text,{strong:!0,children:[e?.duration||5,`秒`]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#64748b`,display:`block`,marginBottom:6},children:`画面比例`}),(0,$.jsx)(EC,{value:w.ratio,onChange:e=>T(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)(Q.Text,{style:{fontSize:12,color:`#64748b`,display:`block`,marginBottom:6},children:`分辨率`}),(0,$.jsx)(EC,{value:w.resolution,onChange:e=>T(t=>t?{...t,resolution:e}:null),style:{width:`100%`},options:[`480p`,`720p`,`1080p`].map(e=>({value:e,label:e}))})]})]})})()})})]})},U7=({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()})},goe=()=>{let{user:e}=y7(),[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 M5(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)(Xq,{gutter:[16,16],style:{marginBottom:24},children:[(0,$.jsx)(YR,{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)(cH,{style:{marginBottom:10},children:[(0,$.jsx)(a5,{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)(U7,{value:e?.credits??0})})]})]})}),(0,$.jsx)(YR,{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)(cH,{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)(O2,{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)(U7,{value:f})})]})}),(0,$.jsx)(YR,{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)(cH,{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)(y2,{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)(U7,{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)(K8,{style:{color:`#6366f1`,fontSize:16}}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:16},children:`积分明细`})]}),(0,$.jsx)(`div`,{style:{borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,overflow:`hidden`},children:(0,$.jsx)(RQ,{columns:[{title:`类型`,dataIndex:`type`,key:`type`,width:100,render:e=>(0,$.jsx)(ZQ,{color:e===`recharge`?`green`:`orange`,icon:e===`recharge`?(0,$.jsx)(O2,{}):(0,$.jsx)(y2,{}),children:e===`recharge`?`充值`:`消费`})},{title:`积分变动`,dataIndex:`amount`,key:`amount`,width:120,render:e=>(0,$.jsxs)(Q.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:D7(e)})}],dataSource:t,rowKey:`id`,loading:r,pagination:{current:a,pageSize:s,total:l,onChange:d,showSizeChanger:!0,showTotal:e=>`共 ${e} 条`},scroll:{x:500}})})]})]})},_oe=()=>{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 M5(c,u);r(e.records||[]),a(e.credits||0),s(e.total||0)}catch{r([])}t(!1)};return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(Xq,{gutter:[16,16],style:{marginBottom:24},children:[(0,$.jsx)(YR,{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)(a5,{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)(YR,{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)(Q6,{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)(YR,{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)(K8,{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)(K8,{style:{color:`#f59e0b`,fontSize:16}}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:16},children:`积分明细`})]}),(0,$.jsx)(`div`,{style:{borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,overflow:`hidden`},children:(0,$.jsx)(WG,{spinning:e,children:n.length===0?(0,$.jsx)(XS,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无积分变动记录`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(RQ,{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)`},team_internal:{color:`#0958d9`,label:`团队内部`,bg:`rgba(139,92,246,0.1)`}}[e]||{color:`#64748b`,label:e,bg:`rgba(100,116,139,0.1)`};return(0,$.jsx)(ZQ,{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)(Q.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)(CG,{current:c,pageSize:u,total:o,onChange:e=>{l(e)},size:`small`})})]})})})]})]})},voe=()=>{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 zie(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)(pH,{style:{color:`#0ea5e9`,fontSize:16}}),(0,$.jsx)(Q.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)(WG,{spinning:e,children:n.length===0?(0,$.jsx)(XS,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无订单记录`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(RQ,{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)(u2,{style:{fontSize:16}}),label:`支付宝`,color:`#1677ff`},wechat:{icon:(0,$.jsx)(c5,{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)(Q.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)(Q.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)(ZQ,{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)(CG,{current:o,pageSize:c,total:i,onChange:e=>{s(e)},size:`small`})})]})})})]})})},yoe=()=>{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 F5(c,u);r(e.items||[]),s(e.total||0)}catch{r([])}t(!1)},f=async()=>{try{a(await I5())}catch{a(0)}},p=async e=>{try{await L5(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)(U2,{style:{color:`#6366f1`,fontSize:16}}),(0,$.jsx)(Q.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)(WG,{spinning:e,children:n.length===0?(0,$.jsx)(XS,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无消息`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(RQ,{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)(T8,{style:{fontSize:14}})},credit:{color:`#f59e0b`,label:`积分`,bg:`rgba(245,158,11,0.1)`,icon:(0,$.jsx)(a5,{style:{fontSize:14}})},promo:{color:`#8b5cf6`,label:`活动`,bg:`rgba(139,92,246,0.1)`,icon:(0,$.jsx)(g3,{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)(ZQ,{color:`gray`,style:{background:`rgba(148,163,184,0.1)`},children:`已读`}):(0,$.jsx)(ZQ,{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)(X,{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)(CG,{current:c,pageSize:u,total:o,onChange:e=>{l(e)},size:`small`})})]})})})]})})},W7=()=>{let[e]=On(),[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)(TL,{activeKey:t,onChange:n,items:[{key:`credits`,label:`积分明细`},{key:`orders`,label:`订单记录`}],style:{marginBottom:24},size:`large`}),t===`credits`&&(0,$.jsx)(_oe,{}),t===`orders`&&(0,$.jsx)(voe,{})]})},boe=`/assets/bg1-CQh9PRPW.png`,xoe=(e,t)=>e<=1?6:e===2||e===4?3:e===3?t<2?3:6:t<3?2:3,Soe=e=>{let t=e.displayStatus||e.pipelineStage||e.status||`generating`;return{pending:`待处理`,queued:`排队中`,preparing:`准备中`,generating:`生成中`,creating_provider_task:`创建任务中`,waiting_remote:`等待生成`,polling:`轮询中`,result_ready:`结果就绪`,download_queued:`等待下载`,downloading:`下载中`,retry_waiting:`等待重试`,completed:`已完成`,failed:`生成失败`,download_failed:`下载失败`,deleted:`已删除`}[t]||t},G7=e=>{let t=e.displayStatus||e.pipelineStage||e.status;return!t||[`pending`,`queued`,`preparing`,`generating`,`creating_provider_task`,`waiting_remote`,`polling`,`result_ready`,`download_queued`,`downloading`,`retry_waiting`].includes(t)},Coe=({task:e,onPreview:t,resolveUrl:n=e=>e||``})=>{let r=Math.max(1,Math.min(5,Number(e.generationCount||e.childItems?.length||1))),i=[...e.childItems||[]].sort((e,t)=>Number(e.generationIndex||0)-Number(t.generationIndex||0)),a=i.length>0?i:r>1?Array.from({length:r},(t,n)=>({id:`${e.id||`task`}-placeholder-${n+1}`,genType:e.genType,status:e.status,displayStatus:e.displayStatus,pipelineStage:e.pipelineStage,generationIndex:n+1,errorMessage:e.errorMessage})):[e];return(0,$.jsx)(`div`,{style:{width:`100%`,height:`100%`,display:`grid`,gridTemplateColumns:`repeat(6, minmax(0, 1fr))`,gridAutoRows:`minmax(0, 1fr)`,gap:r>1?4:0},children:a.slice(0,5).map((r,i)=>{let o=r.displayStatus||r.pipelineStage||r.status||`generating`,s=n(r.imageUrl),c=n(r.videoUrl),l=n(r.videoCoverUrl),u=(r.genType||e.genType)===`video`,d=u?!!c:!!s;return(0,$.jsxs)(`div`,{style:{gridColumn:`span ${xoe(a.length,i)}`,minWidth:0,minHeight:0,position:`relative`,overflow:`hidden`,borderRadius:a.length===1?12:8,background:`linear-gradient(135deg, #ffffff 0%, #FAFBFC 100%)`,border:a.length===1?`none`:`1px solid #E7EAF0`},children:[d&&o!==`deleted`?(0,$.jsxs)(`button`,{type:`button`,onClick:()=>t(u?c:s,u?`video`:`image`),style:{width:`100%`,height:`100%`,border:0,padding:0,background:`transparent`,cursor:`pointer`,position:`relative`},children:[u?l?(0,$.jsx)(`img`,{src:l,alt:`生成结果${r.generationIndex||i+1}`,style:{width:`100%`,height:`100%`,objectFit:`contain`}}):(0,$.jsx)(`video`,{src:c,muted:!0,preload:`metadata`,style:{width:`100%`,height:`100%`,objectFit:`contain`}}):(0,$.jsx)(`img`,{src:s,alt:`生成结果${r.generationIndex||i+1}`,style:{width:`100%`,height:`100%`,objectFit:`contain`}}),u?(0,$.jsx)(K6,{style:{position:`absolute`,left:`50%`,top:`50%`,transform:`translate(-50%, -50%)`,fontSize:a.length>2?28:46,color:`rgba(255,255,255,.92)`,filter:`drop-shadow(0 4px 10px rgba(0,0,0,.28))`}}):null]}):(0,$.jsxs)(`div`,{style:{width:`100%`,height:`100%`,minHeight:0,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:7,padding:8,textAlign:`center`},children:[G7(r)?(0,$.jsx)(Xm,{spin:!0,style:{color:`#8b5cf6`,fontSize:a.length>2?20:34}}):(0,$.jsx)(eie,{style:{color:o===`deleted`?`#98A2B3`:`#A45B5B`,fontSize:a.length>2?20:34}}),(0,$.jsx)(`span`,{style:{fontSize:a.length>2?10:12,color:G7(r)?`#8b5cf6`:o===`deleted`?`#98A2B3`:`#A45B5B`,fontWeight:500},children:Soe(r)}),!G7(r)&&r.errorMessage&&a.length<=2?(0,$.jsx)(`span`,{style:{fontSize:10,color:`#A45B5B`,lineHeight:1.3,maxHeight:28,overflow:`hidden`},children:r.errorMessage}):null]}),a.length>1?(0,$.jsxs)(`span`,{style:{position:`absolute`,top:5,left:5,zIndex:2,padding:`1px 6px`,borderRadius:10,background:`rgba(17,24,39,.58)`,color:`#fff`,fontSize:10},children:[`#`,r.generationIndex||i+1]}):null]},r.id||`${i}`)})})},{Text:K7}=Q,woe=({items:e,selectedId:t,onSelect:n})=>e.length?(0,$.jsx)(cH,{orientation:`vertical`,style:{width:`100%`},size:10,children:e.map(e=>{let r=t===e.id;return(0,$.jsxs)(`div`,{onClick:()=>n(e),style:{padding:14,borderRadius:14,cursor:`pointer`,border:r?`1px solid #8b5cf6`:`1px solid #e2e8f0`,background:r?`#f5f3ff`:`#fff`},children:[(0,$.jsx)(cH,{style:{width:`100%`,justifyContent:`space-between`},align:`start`,children:(0,$.jsxs)(`div`,{style:{minWidth:0},children:[(0,$.jsx)(K7,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name}),e.description&&(0,$.jsx)(K7,{type:`secondary`,ellipsis:!0,style:{display:`block`,fontSize:12},children:e.description})]})}),(0,$.jsxs)(cH,{wrap:!0,size:4,style:{marginTop:10},children:[(0,$.jsxs)(ZQ,{children:[`总 `,e.assetCount||0]}),(0,$.jsxs)(ZQ,{color:`green`,children:[`图 `,e.imageAssetCount||0]}),(0,$.jsxs)(ZQ,{color:`blue`,children:[`视频 `,e.videoAssetCount||0]})]})]},e.id)})}):(0,$.jsx)(XS,{description:`暂无项目组`}),Toe={Active:`green`,Processing:`processing`,Failed:`red`,local_deleted:`default`,remote_deleted:`default`,delete_failed:`red`},Eoe={Active:`入库成功`,Processing:`入库处理中`,Failed:`入库失败`,local_deleted:`本地已删除`,remote_deleted:`远程已删除`,delete_failed:`删除失败`},q7=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,J7=e=>e.assetType===`Video`?q7(e.videoCoverUrl||e.previewUrl||e.displayUrl||e.remoteUrl||e.sourceUrl):q7(e.previewUrl||e.displayUrl||e.videoCoverUrl||e.remoteUrl||e.sourceUrl),Doe=e=>{let t=Number(e||0);return!Number.isFinite(t)||t<=0?`-`:`${t.toFixed(t>=10?0:1)}s`},Ooe=({items:e,onDelete:t,onRefresh:n})=>{let r=(0,S.useRef)(null),[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)(``),[c,l]=(0,S.useState)(`Image`);(0,S.useEffect)(()=>(e.some(e=>e.status!==`Failed`&&e.status!==`Active`)&&n?r.current||=window.setInterval(()=>{n()},3e3):r.current&&=(clearInterval(r.current),null),()=>{r.current&&=(clearInterval(r.current),null)}),[e,n]);let u=e=>{let t=J7(e);t&&(s(t),l(e.assetType===`Video`?`Video`:`Image`),a(!0))};return e.length?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(220px, 1fr))`,gap:14},children:e.map(e=>{let n=e.assetType===`Video`,r=J7(e);return(0,$.jsx)(DL,{hoverable:!0,bodyStyle:{padding:12},style:{borderRadius:16,overflow:`hidden`,borderColor:`#eef2f7`},cover:(0,$.jsxs)(`div`,{style:{height:170,background:`#f8fafc`,display:`flex`,alignItems:`center`,justifyContent:`center`,position:`relative`},children:[r?n&&e.videoCoverUrl?(0,$.jsx)(`img`,{src:r,alt:e.name||`视频封面`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):n?(0,$.jsx)(`video`,{src:r,muted:!0,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(`img`,{src:r,alt:e.name||``,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):n?(0,$.jsx)(r5,{style:{fontSize:42,color:`#64748b`}}):(0,$.jsx)(B6,{style:{fontSize:42,color:`#64748b`}}),n&&(0,$.jsx)(ZQ,{color:`blue`,style:{position:`absolute`,left:10,top:10},children:`视频`}),r&&(0,$.jsx)(X,{size:`small`,shape:`circle`,icon:(0,$.jsx)(hW,{}),style:{position:`absolute`,right:10,top:10},onClick:()=>u(e)}),n&&(0,$.jsx)(`div`,{style:{position:`absolute`,left:10,bottom:10,padding:`2px 6px`,borderRadius:8,background:`rgba(15,23,42,0.72)`,color:`#fff`,fontSize:12},children:Doe(e.videoDuration)})]}),children:(0,$.jsxs)(cH,{direction:`vertical`,size:8,style:{width:`100%`},children:[(0,$.jsx)(gw,{title:e.name||e.remoteAssetId||e.id,children:(0,$.jsx)(`div`,{style:{fontWeight:600,color:`#1e293b`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.name||e.remoteAssetId||`未命名素材`})}),(0,$.jsxs)(cH,{wrap:!0,size:4,children:[(0,$.jsx)(ZQ,{color:Toe[e.status]||`default`,children:Eoe[e.status]||e.status}),(0,$.jsx)(ZQ,{color:n?`blue`:`default`,children:n?`视频`:`图片`})]}),(0,$.jsx)(cH,{size:6,wrap:!0,children:(0,$.jsx)(yK,{title:`确认删除这个素材吗?`,onConfirm:()=>t(e.id),children:(0,$.jsx)(X,{size:`small`,danger:!0,icon:(0,$.jsx)(d$,{}),children:`删除`})})})]})},e.id)})}),(0,$.jsx)(hK,{title:`素材预览`,open:i,onCancel:()=>a(!1),footer:null,width:760,destroyOnClose:!0,children:(0,$.jsx)(`div`,{style:{minHeight:420,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#0f172a`,borderRadius:12,overflow:`hidden`},children:c===`Video`?(0,$.jsx)(`video`,{src:o,controls:!0,autoPlay:!0,style:{maxWidth:`100%`,maxHeight:520}}):(0,$.jsx)(`img`,{src:o,alt:`素材预览`,style:{maxWidth:`100%`,maxHeight:520,objectFit:`contain`}})})})]}):(0,$.jsx)(XS,{description:`暂无素材`})},Y7=(0,S.createContext)(void 0),koe=({children:e,refreshConfig:t})=>(0,$.jsx)(Y7.Provider,{value:{refreshConfig:t},children:e}),X7=()=>{let e=(0,S.useContext)(Y7);if(!e)throw Error(`useLibrary must be used within a LibraryProvider`);return e},Z7=2,Q7=15,Aoe=e=>new Promise(t=>{if(!e.type.startsWith(`video/`)){t(null);return}let n=URL.createObjectURL(e),r=document.createElement(`video`);r.preload=`metadata`,r.onloadedmetadata=()=>{let e=Number.isFinite(r.duration)?r.duration:null;URL.revokeObjectURL(n),t(e)},r.onerror=()=>{URL.revokeObjectURL(n),t(null)},r.src=n}),joe=e=>e==null||!Number.isFinite(e)||e<=0?(Z.error(`无法读取视频秒数,请检查视频文件是否损坏`),!1):eQ7?(Z.error(`视频素材最长不能超过 ${Q7} 秒`),!1):!0,Moe=({projectId:e,open:t,onClose:n,onSuccess:r})=>{let{refreshConfig:i}=X7(),[a,o]=(0,S.useState)([]),[s,c]=(0,S.useState)({}),[l,u]=(0,S.useState)({}),[d,f]=(0,S.useState)({}),[p,m]=(0,S.useState)({}),[h,g]=(0,S.useState)(!1),_=()=>{o([]),c({}),u({}),f({}),m({})};return(0,$.jsx)(hK,{title:`上传真人素材`,open:t,onCancel:()=>{_(),n()},onOk:async()=>{let t=a.filter(e=>l[e.uid]===`uploaded`);if(t.length===0){Z.warning(`请等待文件上传完成后再提交入库`);return}g(!0);try{for(let n of t){let t=n.originFileObj;if(!t)continue;let r=d[n.uid];if(!r)continue;m(e=>({...e,[n.uid]:`importing`}));let i=t.type.startsWith(`image/`)?`Image`:`Video`;await Aae(e,{url:r.url,assetType:i,name:s[n.uid]?.trim()||t.name,videoDuration:r.duration_seconds,fileSize:r.file_size_bytes??t.size,mimeType:t.type||null,uploadResourceId:r.resource_id||null}),m(e=>({...e,[n.uid]:`imported`}))}Z.success(`已成功提交 ${t.length} 个素材入库,处理中`),i(),setTimeout(()=>{_(),r(),n()},1500)}catch(e){Z.error(e?.message||`提交入库失败`)}finally{g(!1)}},confirmLoading:h,okText:`提交入库`,destroyOnHidden:!0,width:650,okButtonProps:{disabled:a.length===0||a.some(e=>l[e.uid]!==`uploaded`)},children:(0,$.jsx)(`div`,{style:{maxHeight:600,overflow:`auto`,marginTop:30},children:(0,$.jsxs)(cH,{direction:`vertical`,style:{width:`100%`},size:14,children:[(0,$.jsx)(x0,{accept:`image/*,video/*`,fileList:a,multiple:!0,beforeUpload:async e=>{let t=`${Date.now()}-${Math.random().toString(36).substr(2,9)}`,n=e.type.startsWith(`image/`),r=URL.createObjectURL(e),i={uid:t,name:e.name,status:`uploading`,originFileObj:e,thumbUrl:r,type:e.type};o(e=>[...e,i]),c(e=>({...e,[t]:``})),u(e=>({...e,[t]:`uploading`}));try{let r=n?`Image`:`Video`,i=r===`Video`?await Aoe(e):null;if(r===`Video`&&!joe(i))return u(e=>({...e,[t]:`error`})),!1;let a=r===`Video`?await wie(e,i||void 0):await Cie(e);f(e=>({...e,[t]:{url:a.url,duration_seconds:a.duration_seconds,file_size_bytes:a.file_size_bytes,resource_id:a.resource_id}})),u(e=>({...e,[t]:`uploaded`}))}catch{u(e=>({...e,[t]:`error`})),Z.error(`文件 ${e.name} 上传失败`)}return!1},listType:`picture`,itemRender:(e,t,n)=>{let r=t.type?.startsWith(`video/`)||t.name.match(/\.(mp4|mov|avi|webm)$/i),i=l[t.uid],a=p[t.uid];return(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,padding:12,border:`1px solid #e5e7eb`,borderRadius:8,marginBottom:8},children:[(0,$.jsx)(`div`,{style:{width:64,height:64,borderRadius:8,overflow:`hidden`,flexShrink:0},children:t.thumbUrl||t.url?r?(0,$.jsx)(`video`,{src:t.thumbUrl||t.url,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(`img`,{src:t.thumbUrl||t.url,alt:t.name,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:`#f1f5f9`},children:r?(0,$.jsx)(r5,{style:{color:`#94a3b8`,fontSize:20}}):(0,$.jsx)(B6,{style:{color:`#94a3b8`,fontSize:20}})})}),(0,$.jsx)(`span`,{style:{width:`20%`,overflow:`hidden`,whiteSpace:`nowrap`,textOverflow:`ellipsis`,fontSize:13,color:`#64748b`,flexShrink:0},children:t.name}),(0,$.jsx)(LW,{style:{width:200,flexShrink:0},value:s[t.uid]||``,onChange:e=>c({...s,[t.uid]:e.target.value}),placeholder:`素材名称,默认使用文件名`,maxLength:256}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[i===`uploading`&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,$.jsx)(WG,{size:`small`,style:{color:`#6366f1`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#6366f1`},children:`上传中`})]}),i===`uploaded`&&!a&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#10b981`},children:`✓ 上传完成`}),i===`error`&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#ef4444`},children:`✗ 上传失败`}),a===`importing`&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,$.jsx)(WG,{size:`small`,style:{color:`#6366f1`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#6366f1`},children:`入库中`})]}),a===`imported`&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#10b981`},children:`✓ 已入库校验`}),a===`error`&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#ef4444`},children:`✗ 入库失败`})]}),(0,$.jsx)(`button`,{onClick:e=>{e.stopPropagation(),o(e=>e.filter(e=>e.uid!==t.uid)),c(e=>{let n={...e};return delete n[t.uid],n}),u(e=>{let n={...e};return delete n[t.uid],n}),f(e=>{let n={...e};return delete n[t.uid],n}),m(e=>{let n={...e};return delete n[t.uid],n})},style:{width:28,height:28,borderRadius:`50%`,backgroundColor:`#f1f5f9`,border:`none`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,$.jsx)(d$,{style:{color:`#64748b`,fontSize:14}})})]})},children:(0,$.jsx)(X,{icon:(0,$.jsx)(Q8,{}),children:`选择图片或视频`})}),(0,$.jsxs)(`div`,{style:{padding:12,background:`#f8fafc`,borderRadius:12,color:`#64748b`,fontSize:13},children:[`当前开放图片和视频,音频暂不接入。视频素材必须在 `,Z7,`~`,Q7,` 秒内;入库后会经过火山真人一致性校验,入库校验成功 后才可用于 AI 创作。`]})]})})})},Noe=({project:e,onDeleted:t,onChanged:n})=>{let{refreshConfig:r}=X7(),[i,a]=(0,S.useState)([]),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(``),[f,p]=(0,S.useState)(),[m,h]=(0,S.useState)(),[g,_]=(0,S.useState)(1),[v,y]=(0,S.useState)(20),[b,x]=(0,S.useState)(0),C=async(t=g,n=v)=>{s(!0);try{let r=await jae(e.id,{page:t,pageSize:n,keyword:u,status:f,assetType:m});a(r.items),x(r.total||0),_(t),y(n)}catch(e){Z.error(e?.message||`加载素材失败`)}finally{s(!1)}};(0,S.useEffect)(()=>{C(1,v)},[e.id,u,f,m]);let w=async e=>{try{await Mae(e),await C(g,v),n(),r(),Z.success(`素材已删除`)}catch(e){Z.error(e?.message||`删除素材失败`)}},T=async()=>{try{await Oae(e.id),Z.success(`项目组已删除`),t()}catch(e){Z.error(e?.message||`删除项目组失败`)}},E=e.status===`active`;return(0,$.jsxs)(DL,{title:(0,$.jsx)(cH,{children:(0,$.jsx)(`span`,{children:e.name})}),extra:(0,$.jsxs)(cH,{children:[(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(Q8,{}),disabled:!E,onClick:()=>l(!0),children:`上传素材`}),(0,$.jsx)(yK,{title:`确认删除这个真人素材项目组吗?`,onConfirm:T,children:(0,$.jsx)(X,{danger:!0,icon:(0,$.jsx)(d$,{}),children:`删除项目组`})})]}),style:{borderRadius:16},children:[!E&&(0,$.jsx)(Q.Paragraph,{style:{color:`#f97316`},children:`项目组未完成真人认证,暂不能上传素材。请重新创建项目组并完成手机扫码认证。`}),(0,$.jsxs)(cH,{style:{width:`100%`,marginBottom:16},wrap:!0,children:[(0,$.jsx)(LW.Search,{allowClear:!0,placeholder:`搜索素材名称`,value:u,onChange:e=>d(e.target.value),onSearch:()=>C(1,v),style:{width:240}}),(0,$.jsx)(EC,{allowClear:!0,placeholder:`素材状态`,value:f,onChange:e=>p(e),style:{width:150},options:[{value:`Processing`,label:`处理中`},{value:`Active`,label:`可用`},{value:`Failed`,label:`失败`}]}),(0,$.jsx)(EC,{allowClear:!0,placeholder:`素材类型`,value:m,onChange:e=>h(e),style:{width:130},options:[{value:`Image`,label:`图片`},{value:`Video`,label:`视频`}]}),(0,$.jsx)(X,{onClick:()=>C(1,v),children:`筛选`})]}),(0,$.jsx)(WG,{spinning:o,children:i.length===0?(0,$.jsx)(XS,{description:`暂无素材,上传图片/视频后会异步入库`,style:{marginTop:80}}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ooe,{items:i,loading:o,onDelete:w,onRefresh:()=>C(g,v)}),(0,$.jsx)(`div`,{style:{textAlign:`right`,marginTop:16},children:(0,$.jsx)(CG,{current:g,pageSize:v,total:b,showSizeChanger:!0,showTotal:e=>`共 ${e} 个素材`,onChange:(e,t)=>C(e,t)})})]})}),(0,$.jsx)(Moe,{projectId:e.id,open:c,onClose:()=>l(!1),onSuccess:()=>{C(1,v),n()}})]})},$7=`group_active`,e9=2e3,Poe=()=>{let[e,t]=(0,S.useState)([]),[n,r]=(0,S.useState)(null),[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(null),[f,p]=(0,S.useState)(null),[m,h]=(0,S.useState)(!1),[g]=nU.useForm(),_=(0,S.useRef)(null),v=()=>{_.current&&=(window.clearInterval(_.current),null)},y=()=>{v(),s(!1),l(!1),h(!1),d(null),p(null),g.resetFields()},b=async()=>{a(!0);try{let e=await h7({pageSize:100,status:`active`});t(e.items),r(t=>t?e.items.find(e=>e.id===t.id)||e.items[0]||null:e.items[0]||null)}catch(e){Z.error(e?.message||`加载真人素材项目组失败`)}finally{a(!1)}};(0,S.useEffect)(()=>{b()},[]),(0,S.useEffect)(()=>()=>v(),[]);let x=async e=>{v(),h(!1),Z.success(`真人认证完成,项目组已创建成功`),s(!1),p(null),d(null),g.resetFields();let n=await h7({pageSize:100,status:`active`});t(n.items),r(n.items.find(t=>t.id===e)||n.items[0]||null)},C=(e,t,n)=>{v(),h(!0);let r=async()=>{try{let n=await kae(e);if(p(n),n.status===$7){await x(t);return}[`callback_failed`,`failed`,`expired`].includes(n.status)&&(v(),h(!1),Z.error(n.errorMessage||`真人认证未完成,请重新创建项目组`))}catch(e){v(),h(!1),Z.error(e?.message||`轮询真人认证状态失败`)}};_.current=window.setInterval(r,Math.max(1e3,n||e9)),r()},w=async()=>{let e=await g.validateFields();l(!0);try{let t=`${window.location.origin}/private-portrait-authorized`,n=await Dae({...e,callbackRedirectUrl:t});d(n.project),p(n.validateSession),Z.success(`请使用手机扫码完成人脸认证`),n.validateSession?.id&&C(n.validateSession.id,n.project.id,n.pollIntervalMs||e9)}catch(e){Z.error(e?.message||`创建项目组认证二维码失败`)}finally{l(!1)}},T=f?.h5Link||``,E=f?.status===$7;return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Title,{level:4,style:{margin:0},children:`真人素材库`}),(0,$.jsx)(Q.Text,{type:`secondary`,children:`创建项目组时先完成真人认证,认证成功后项目组才会正式创建并可上传素材。`})]}),(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(rL,{}),onClick:()=>s(!0),style:{borderRadius:8,fontWeight:600,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`},children:`创建项目组`})]}),(0,$.jsxs)(Xq,{gutter:16,children:[(0,$.jsx)(YR,{xs:24,lg:5,children:(0,$.jsx)(DL,{style:{borderRadius:16,minHeight:520},children:(0,$.jsx)(WG,{spinning:i,children:e.length===0?(0,$.jsx)(XS,{description:`暂无真人项目组`}):(0,$.jsx)(woe,{items:e,selectedId:n?.id,onSelect:r})})})}),(0,$.jsx)(YR,{xs:24,lg:19,children:n?(0,$.jsx)(Noe,{project:n,onDeleted:()=>{r(null),b()},onChanged:b}):(0,$.jsx)(DL,{style:{borderRadius:16,minHeight:520,textAlign:`center`,color:`#94a3b8`},children:`请先创建或选择一个真人素材项目组`})})]}),(0,$.jsx)(hK,{title:`新建真人素材项目组`,open:o,onCancel:y,footer:f?[(0,$.jsx)(X,{onClick:y,children:`关闭`},`close`)]:void 0,onOk:f?void 0:w,okText:`开始认证并创建`,confirmLoading:c,mask:{closable:!m},children:f?(0,$.jsxs)(cH,{direction:`vertical`,align:`center`,size:16,style:{width:`100%`},children:[E?(0,$.jsx)(p4,{style:{fontSize:54,color:`#22c55e`}}):T?(0,$.jsx)(Aq,{value:T,size:220}):(0,$.jsx)(WG,{}),(0,$.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,$.jsx)(Q.Title,{level:5,style:{marginBottom:8},children:u?.name||`真人素材项目组`}),(0,$.jsx)(Q.Text,{type:E?`success`:`secondary`,children:E?`认证成功,项目组正在刷新`:`请使用手机扫码完成人脸认证,成功后回到电脑端查看项目组。`})]})]}):(0,$.jsxs)(nU,{form:g,layout:`vertical`,children:[(0,$.jsx)(nU.Item,{label:`项目组名称`,name:`name`,rules:[{required:!0,message:`请输入项目组名称`}],children:(0,$.jsx)(LW,{placeholder:`例如:达人A、客户B、张三人像`})}),(0,$.jsx)(nU.Item,{label:`描述`,name:`description`,children:(0,$.jsx)(LW.TextArea,{rows:3,placeholder:`可选`})}),(0,$.jsx)(Q.Paragraph,{type:`secondary`,style:{marginBottom:0},children:`点击后会生成真人认证二维码。手机扫码认证成功后,项目组才会出现在项目列表中。`})]})})]})},{Text:t9}=Q,n9=2,r9=15,Foe={creating:{label:`本地创建中`,color:`processing`},Processing:{label:`入库处理中`,color:`processing`},Active:{label:`入库成功`,color:`success`},Failed:{label:`入库失败`,color:`error`},local_deleted:{label:`本地已删`,color:`default`},remote_deleted:{label:`远端已删`,color:`default`},delete_failed:{label:`远端删除失败`,color:`error`}},Ioe=e=>{let t=Number(e||0);return!Number.isFinite(t)||t<=0?`-`:`${t.toFixed(t>=10?0:1)}s`},i9=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,a9=e=>e.assetType===`Video`?i9(e.videoCoverUrl||e.previewUrl||e.displayUrl||e.remoteUrl||e.sourceUrl):i9(e.previewUrl||e.displayUrl||e.videoCoverUrl||e.remoteUrl||e.sourceUrl),Loe=e=>new Promise(t=>{if(!e.type.startsWith(`video/`)){t(null);return}let n=URL.createObjectURL(e),r=document.createElement(`video`);r.preload=`metadata`,r.onloadedmetadata=()=>{let e=Number.isFinite(r.duration)?r.duration:null;URL.revokeObjectURL(n),t(e)},r.onerror=()=>{URL.revokeObjectURL(n),t(null)},r.src=n}),Roe=(e,t)=>e==null||!Number.isFinite(e)||e<=0?(t(`无法读取视频秒数,请检查视频文件是否损坏`),!1):er9?(t(`视频素材最长不能超过 ${r9} 秒`),!1):!0,zoe=({status:e})=>{let t=e||`-`,n=Foe[t];return(0,$.jsx)(ZQ,{color:n?.color||`default`,children:n?.label||t})},Boe=()=>{let{message:e}=Vb.useApp(),{refreshConfig:t}=X7(),[n,r]=(0,S.useState)([]),[i,a]=(0,S.useState)(),[o,s]=(0,S.useState)([]),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(!1),[f,p]=(0,S.useState)(1),[m,h]=(0,S.useState)(20),[g,_]=(0,S.useState)(0),[v,y]=(0,S.useState)(``),[b,x]=(0,S.useState)(),[C,w]=(0,S.useState)(),[T,E]=(0,S.useState)(!1),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)(!1),[j,M]=(0,S.useState)(!1),[N,P]=(0,S.useState)([]),[F,I]=(0,S.useState)({}),[L,R]=(0,S.useState)({}),[z,B]=(0,S.useState)({}),[V,H]=(0,S.useState)({}),[U,W]=(0,S.useState)(!1),[ee,te]=(0,S.useState)(``),[ne,re]=(0,S.useState)(`Image`),[G]=nU.useForm(),ie=(0,S.useRef)(null),K=(0,S.useMemo)(()=>n.find(e=>e.id===i)||null,[n,i]),ae=async()=>{l(!0);try{let e=(await _7({page:1,pageSize:100,status:`active`})).items||[];r(e),a(t=>t&&e.some(e=>e.id===t)?t:e[0]?.id)}catch(t){e.error(t?.message||`加载虚拟人像项目组失败`)}finally{l(!1)}},q=async(t=f,n=m)=>{if(!i){s([]),_(0);return}d(!0);try{let e=await Iae(i,{page:t,pageSize:n,keyword:v.trim()||void 0,status:b,assetType:C});s(e.items||[]),_(e.total||0),p(t),h(n)}catch(t){e.error(t?.message||`加载虚拟人像素材失败`)}finally{d(!1)}},oe=async()=>{await ae()};(0,S.useEffect)(()=>{oe()},[]),(0,S.useEffect)(()=>{i&&q(1,m)},[i]),(0,S.useEffect)(()=>(o.some(e=>e.status!==`Failed`&&e.status!==`Active`)&&i?ie.current||=window.setInterval(()=>{q(f,m)},3e3):ie.current&&=(clearInterval(ie.current),null),()=>{ie.current&&=(clearInterval(ie.current),null)}),[o,i,f,m]);let se=async()=>{let t=await G.validateFields();O(!0);try{let n=await Pae(t);e.success(`虚拟人像项目组已创建`),E(!1),G.resetFields(),await ae(),a(n.id)}catch(t){e.error(t?.message||`创建项目组失败`)}finally{O(!1)}},ce=async()=>{if(!i){e.warning(`请先创建或选择项目组`);return}if(N.length===0){e.warning(`请先选择图片或视频素材`);return}let n=N.filter(e=>L[e.uid]===`uploaded`);if(n.length===0){e.warning(`请等待文件上传完成后再提交入库`);return}M(!0);try{for(let e of n){let t=e.originFileObj;if(!t)continue;let n=z[e.uid];if(!n)continue;H(t=>({...t,[e.uid]:`importing`}));let r=t.type.startsWith(`image/`)?`Image`:`Video`;await v7(i,{url:n.url,assetType:r,name:F[e.uid]?.trim()||t.name,videoDuration:n.duration_seconds,fileSize:n.file_size_bytes??t.size,mimeType:t.type||null,uploadResourceId:n.resource_id||null}),H(t=>({...t,[e.uid]:`imported`}))}e.success(`已成功提交 ${n.length} 个素材入库,处理中`),setTimeout(()=>{A(!1),P([]),I({}),R({}),B({}),H({})},1500),await Promise.all([ae(),q(1,m),t()])}catch(t){e.error(t?.message||`提交入库失败`)}finally{M(!1)}},le=async n=>{try{await Lae(n),e.success(`素材已删除,远端删除将异步执行`),await Promise.all([ae(),q(f,m),t()])}catch(t){e.error(t?.message||`删除素材失败`)}},ue=async()=>{if(i)try{await Fae(i),e.success(`项目组已删除,远端资产组将异步删除`),a(void 0),await oe()}catch(t){e.error(t?.message||`删除项目组失败`)}},de=t=>{let n=a9(t);if(!n){e.warning(`暂无可预览地址`);return}te(n),re(t.assetType===`Video`?`Video`:`Image`),W(!0)};return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Title,{level:4,style:{margin:0},children:`虚拟素材库`}),(0,$.jsx)(Q.Text,{type:`secondary`,children:`可提前上传虚拟人像素材,后续生成视频时可直接使用。`})]}),(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(rL,{}),onClick:()=>E(!0),style:{borderRadius:8,fontWeight:600,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`},children:`创建项目组`})]}),(0,$.jsxs)(Xq,{gutter:[10,10],children:[(0,$.jsx)(YR,{xs:24,lg:5,children:(0,$.jsx)(DL,{style:{borderRadius:16,minHeight:520,margin:`0 auto`,maxWidth:1200},children:(0,$.jsx)(WG,{spinning:c,children:n.length===0?(0,$.jsx)(XS,{description:`暂无虚拟人像项目组`}):(0,$.jsx)(cH,{orientation:`vertical`,style:{width:`100%`},size:10,children:n.map(e=>{let t=i===e.id;return(0,$.jsxs)(`div`,{onClick:()=>a(e.id),style:{padding:14,borderRadius:14,cursor:`pointer`,border:t?`1px solid #8b5cf6`:`1px solid #e2e8f0`,background:t?`#f5f3ff`:`#fff`},children:[(0,$.jsx)(cH,{style:{width:`100%`,justifyContent:`space-between`},align:`start`,children:(0,$.jsxs)(`div`,{style:{minWidth:0},children:[(0,$.jsx)(t9,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name}),e.description&&(0,$.jsx)(t9,{type:`secondary`,ellipsis:!0,style:{display:`block`,fontSize:12},children:e.description})]})}),(0,$.jsxs)(cH,{wrap:!0,size:4,style:{marginTop:10},children:[(0,$.jsxs)(ZQ,{children:[`总 `,e.assetCount||0]}),(0,$.jsxs)(ZQ,{color:`green`,children:[`图 `,e.imageAssetCount||0]}),(0,$.jsxs)(ZQ,{color:`blue`,children:[`视频 `,e.videoAssetCount||0]})]})]},e.id)})})})})}),(0,$.jsx)(YR,{xs:24,lg:19,children:(0,$.jsxs)(DL,{title:K?K.name:`素材资产`,extra:(0,$.jsxs)(cH,{wrap:!0,children:[(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(Q8,{}),disabled:!i,onClick:()=>A(!0),style:{borderRadius:8,fontWeight:600,borderColor:`transparent`},children:`上传图片/视频`}),i&&(0,$.jsx)(yK,{title:`确认删除当前虚拟人像项目组吗?`,onConfirm:ue,children:(0,$.jsx)(X,{danger:!0,icon:(0,$.jsx)(d$,{}),style:{borderRadius:8,fontWeight:600},children:`删除项目组`})})]}),style:{borderRadius:16,minHeight:520},children:[(0,$.jsxs)(cH,{style:{width:`100%`,marginBottom:16},wrap:!0,children:[(0,$.jsx)(LW.Search,{allowClear:!0,placeholder:`搜索素材名称`,value:v,onChange:e=>y(e.target.value),onSearch:()=>q(1,m),style:{width:240,borderRadius:8},enterButton:!0}),(0,$.jsx)(EC,{allowClear:!0,placeholder:`素材状态`,value:b,onChange:e=>x(e),style:{width:140,borderRadius:8},options:[{value:`Processing`,label:`处理中`},{value:`Active`,label:`可用`},{value:`Failed`,label:`失败`}]}),(0,$.jsx)(EC,{allowClear:!0,placeholder:`素材类型`,value:C,onChange:e=>w(e),style:{width:120,borderRadius:8},options:[{value:`Image`,label:`图片`},{value:`Video`,label:`视频`}]}),(0,$.jsx)(X,{type:`primary`,onClick:()=>q(1,m),style:{borderRadius:8,fontWeight:600,borderColor:`transparent`},children:`筛选`})]}),(0,$.jsx)(WG,{spinning:u,children:i?o.length===0?(0,$.jsx)(XS,{description:`暂无素材,上传图片/视频后会异步入库`,style:{marginTop:80}}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(220px, 1fr))`,gap:14},children:o.map(e=>{let t=a9(e),n=e.assetType===`Video`;return(0,$.jsx)(DL,{hoverable:!0,styles:{body:{padding:12}},style:{borderRadius:16,overflow:`hidden`,borderColor:`#eef2f7`},cover:(0,$.jsxs)(`div`,{style:{height:170,background:`#f8fafc`,display:`flex`,alignItems:`center`,justifyContent:`center`,position:`relative`},children:[t?n&&e.videoCoverUrl?(0,$.jsx)(`img`,{src:t,alt:e.name||`视频封面`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):n?(0,$.jsx)(`video`,{src:t,muted:!0,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(`img`,{src:t,alt:e.name||`虚拟人像素材`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):n?(0,$.jsx)(r5,{style:{fontSize:42,color:`#64748b`}}):(0,$.jsx)(B6,{style:{fontSize:42,color:`#64748b`}}),n&&(0,$.jsx)(ZQ,{color:`blue`,style:{position:`absolute`,left:10,top:10},children:`视频`}),t&&(0,$.jsx)(X,{size:`small`,shape:`circle`,icon:(0,$.jsx)(hW,{}),style:{position:`absolute`,right:10,top:10},onClick:()=>de(e)}),n&&(0,$.jsx)(`div`,{style:{position:`absolute`,left:10,bottom:10,padding:`2px 6px`,borderRadius:8,background:`rgba(15,23,42,0.72)`,color:`#fff`,fontSize:12},children:Ioe(e.videoDuration)})]}),children:(0,$.jsxs)(cH,{direction:`vertical`,size:8,style:{width:`100%`},children:[(0,$.jsx)(gw,{title:e.name||e.remoteAssetId||e.id,children:(0,$.jsx)(`div`,{style:{fontWeight:600,color:`#1e293b`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.name||e.remoteAssetId||`未命名素材`})}),(0,$.jsxs)(cH,{wrap:!0,size:4,children:[(0,$.jsx)(zoe,{status:e.status}),(0,$.jsx)(ZQ,{color:n?`blue`:`default`,children:n?`视频`:`图片`})]}),(0,$.jsx)(cH,{size:6,wrap:!0,children:(0,$.jsx)(yK,{title:`确认删除这个虚拟人像素材吗?`,onConfirm:()=>le(e.id),children:(0,$.jsx)(X,{size:`small`,danger:!0,icon:(0,$.jsx)(d$,{}),children:`删除`})})})]})},e.id)})}),(0,$.jsx)(`div`,{style:{textAlign:`right`,marginTop:16},children:(0,$.jsx)(CG,{current:f,pageSize:m,total:g,showSizeChanger:!0,showTotal:e=>`共 ${e} 个素材`,onChange:(e,t)=>q(e,t)})})]}):(0,$.jsx)(XS,{description:`请先创建或选择项目组`,style:{marginTop:80}})})]})})]}),(0,$.jsx)(hK,{title:`创建虚拟人像项目组`,open:T,onCancel:()=>E(!1),onOk:se,confirmLoading:D,okText:`创建项目组`,children:(0,$.jsxs)(nU,{form:G,layout:`vertical`,children:[(0,$.jsx)(nU.Item,{name:`name`,label:`项目组名称`,rules:[{required:!0,message:`请输入项目组名称`}],children:(0,$.jsx)(LW,{placeholder:`例如:虚拟主播A / 品牌代言人B`,maxLength:128})}),(0,$.jsx)(nU.Item,{name:`description`,label:`描述`,children:(0,$.jsx)(LW.TextArea,{placeholder:`可填写人物设定、服装风格、素材要求等`,maxLength:2e3,rows:4})})]})}),(0,$.jsx)(hK,{title:`上传虚拟人像素材`,open:k,onCancel:()=>A(!1),onOk:ce,confirmLoading:j,okText:`提交入库`,width:650,okButtonProps:{disabled:N.length===0||N.some(e=>L[e.uid]!==`uploaded`)},children:(0,$.jsx)(`div`,{style:{maxHeight:600,overflow:`auto`,marginTop:30},children:(0,$.jsxs)(cH,{direction:`vertical`,style:{width:`100%`},size:14,children:[(0,$.jsx)(x0,{accept:`image/*,video/*`,fileList:N,multiple:!0,beforeUpload:async t=>{let n=`${Date.now()}-${Math.random().toString(36).substr(2,9)}`,r=t.type.startsWith(`image/`),i=URL.createObjectURL(t),a={uid:n,name:t.name,status:`uploading`,originFileObj:t,thumbUrl:i,type:t.type};P(e=>[...e,a]),I(e=>({...e,[n]:``})),R(e=>({...e,[n]:`uploading`}));try{let i=r?`Image`:`Video`,a=i===`Video`?await Loe(t):null;if(i===`Video`&&!Roe(a,e.error))return R(e=>({...e,[n]:`error`})),!1;let o=i===`Video`?await Eie(t,a||void 0):await Tie(t);B(e=>({...e,[n]:{url:o.url,duration_seconds:o.duration_seconds,file_size_bytes:o.file_size_bytes,resource_id:o.resource_id}})),R(e=>({...e,[n]:`uploaded`}))}catch{R(e=>({...e,[n]:`error`})),e.error(`文件 ${t.name} 上传失败`)}return!1},listType:`picture`,itemRender:(e,t,n)=>{let r=t.type?.startsWith(`video/`)||t.name.match(/\.(mp4|mov|avi|webm)$/i),i=L[t.uid],a=V[t.uid];return(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,padding:12,border:`1px solid #e5e7eb`,borderRadius:8,marginBottom:8},children:[(0,$.jsx)(`div`,{style:{width:64,height:64,borderRadius:8,overflow:`hidden`,flexShrink:0},children:t.thumbUrl||t.url?r?(0,$.jsx)(`video`,{src:t.thumbUrl||t.url,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(`img`,{src:t.thumbUrl||t.url,alt:t.name,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:`#f1f5f9`},children:r?(0,$.jsx)(r5,{style:{color:`#94a3b8`,fontSize:20}}):(0,$.jsx)(B6,{style:{color:`#94a3b8`,fontSize:20}})})}),(0,$.jsx)(`span`,{style:{width:`20%`,overflow:`hidden`,whiteSpace:`nowrap`,textOverflow:`ellipsis`,fontSize:13,color:`#64748b`,flexShrink:0},children:t.name}),(0,$.jsx)(LW,{style:{width:200,flexShrink:0},value:F[t.uid]||``,onChange:e=>I({...F,[t.uid]:e.target.value}),placeholder:`素材名称,默认使用文件名`,maxLength:256}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[i===`uploading`&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,$.jsx)(WG,{size:`small`,style:{color:`#6366f1`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#6366f1`},children:`上传中`})]}),i===`uploaded`&&!a&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#10b981`},children:`✓ 上传完成`}),i===`error`&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#ef4444`},children:`✗ 上传失败`}),a===`importing`&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,$.jsx)(WG,{size:`small`,style:{color:`#6366f1`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#6366f1`},children:`入库中`})]}),a===`imported`&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#10b981`},children:`✓ 已入库校验`}),a===`error`&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#ef4444`},children:`✗ 入库失败`})]}),(0,$.jsx)(`button`,{onClick:e=>{e.stopPropagation(),P(e=>e.filter(e=>e.uid!==t.uid)),I(e=>{let n={...e};return delete n[t.uid],n}),R(e=>{let n={...e};return delete n[t.uid],n}),B(e=>{let n={...e};return delete n[t.uid],n}),H(e=>{let n={...e};return delete n[t.uid],n})},style:{width:28,height:28,borderRadius:`50%`,backgroundColor:`#f1f5f9`,border:`none`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,$.jsx)(d$,{style:{color:`#64748b`,fontSize:14}})})]})},children:(0,$.jsx)(X,{icon:(0,$.jsx)(Q8,{}),children:`选择图片或视频`})}),(0,$.jsxs)(`div`,{style:{padding:12,background:`#f8fafc`,borderRadius:12,color:`#64748b`,fontSize:13},children:[`当前开放图片和视频,视频素材必须在 `,n9,`~`,r9,` 秒内;提交后会调用火山 CreateAsset 异步处理,状态变为 入库校验成功 后才可用于 AI 创作。`]})]})})}),(0,$.jsx)(hK,{title:`素材预览`,open:U,onCancel:()=>W(!1),footer:null,width:760,destroyOnHidden:!0,children:(0,$.jsx)(`div`,{style:{minHeight:420,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#0f172a`,borderRadius:12,overflow:`hidden`},children:ne===`Video`?(0,$.jsx)(`video`,{src:ee,controls:!0,autoPlay:!0,style:{maxWidth:`100%`,maxHeight:520}}):(0,$.jsx)(`img`,{src:ee,alt:`素材预览`,style:{maxWidth:`100%`,maxHeight:520,objectFit:`contain`}})})})]})},{Title:Voe,Text:Hoe,Paragraph:Uoe}=Q,o9=e=>e===`aigc_virtual`?`aigc_virtual`:`real_person`,Woe=()=>{let[e,t]=On(),[n,r]=(0,S.useState)(()=>o9(e.get(`portraitTab`))),[i,a]=(0,S.useState)(null),[o,s]=(0,S.useState)([]),[c,l]=(0,S.useState)(),u=async()=>{try{a(n===`aigc_virtual`?await g7():await m7())}catch(e){Z.error(e?.message||`加载配置失败`)}};(0,S.useEffect)(()=>{(async()=>{try{if(n===`aigc_virtual`){let[e,t]=await Promise.all([g7(),_7({page:1,pageSize:100,status:`active`})]);a(e);let n=t.items||[];s(n),l(e=>e&&n.some(t=>t.id===e)?e:n[0]?.id)}else{let[e,t]=await Promise.all([m7(),h7({pageSize:100,status:`active`})]);a(e);let n=t.items||[];s(n),l(e=>e&&n.some(t=>t.id===e)?e:n[0]?.id)}}catch(e){Z.error(e?.message||`加载数据失败`)}})()},[n]),(0,S.useMemo)(()=>o.find(e=>e.id===c)||null,[o,c]);let d=(0,S.useMemo)(()=>i?`已用 ${i.usedAssetCount||0} / ${i.assetLimit||0} 个素材,剩余 ${i.remainingAssetCount||0}`:`额度加载中`,[i]),f=(0,S.useMemo)(()=>[{key:`real_person`,label:`真人素材库`,children:(0,$.jsx)(Poe,{})},{key:`aigc_virtual`,label:`虚拟素材库`,children:(0,$.jsx)(Boe,{})}],[]);return(0,$.jsx)(koe,{refreshConfig:u,children:(0,$.jsx)(`div`,{children:(0,$.jsx)(TL,{activeKey:n,onChange:n=>{let i=o9(n);r(i);let a=new URLSearchParams(e);a.set(`filterType`,`private_portrait`),a.set(`portraitTab`,i),t(a,{replace:!0})},items:f,destroyOnHidden:!1,tabBarExtraContent:(0,$.jsxs)(`div`,{style:{fontSize:14,fontWeight:700,color:`#4f46e5`,marginTop:8},children:[d,`。真人/虚拟共用,图片/视频共用。`]})})})})},{Header:Goe,Sider:Koe,Content:qoe}=KW,{TextArea:Joe}=LW,{Option:Yoe}=EC,{Text:s9}=Q,Xoe=`http://ceshi.apiforeign.minzhong.cn`.replace(/\/api\/?$/i,``).replace(/\/$/,``),Zoe=e=>{if(!e)return``;let t=String(e).trim();return t?/^(https?:)?\/\//i.test(t)||/^(blob|data):/i.test(t)?t:`${Xoe}${t.startsWith(`/`)?t:`/${t}`}`:``},Qoe=()=>{let{message:e}=Vb.useApp(),t=Ke(),[n,r]=(0,S.useState)(!1),[i,a]=(0,S.useState)(`1`),[o,s]=(0,S.useState)([]),{mediaType:c,countType:l,generationCount:u,selectedRatio:d,selectedResolution:f,width:p,height:m,videoDuration:h,videoAspectRatio:g,videoResolution:_,engineOptions:v,enginesele:y,inputValue:b,setMediaType:x,setCountType:C,setGenerationCount:w,setSelectedRatio:T,setSelectedResolution:E,setWidth:D,setHeight:O,setVideoDuration:k,setVideoAspectRatio:A,setVideoResolution:j,setEngineOptions:M,setEnginesele:N,setInputValue:P,currentMedia:F,setCurrentMedia:I}=T7(),L=Array.isArray(y)?{}:y,R=(c===`image`?L.image:L.video)?.find(e=>e.id===l),z=R?.maxImageCount??4,B=R?.maxVideoCount??1,V=R?.multiGenerationEnabled?Math.max(1,Math.min(5,Number(R?.maxGenerationCount||1))):1,H=c===`image`?F.filter(e=>e.type===`image`).length:0,U=c===`image`?Math.max(1,Number(R?.multiImageMaxImages||15)-H):5,W=Math.max(1,Math.min(5,V,c===`image`?U:5)),[ee,te]=(0,S.useState)(!1),[ne,re]=(0,S.useState)(!1),[G,ie]=(0,S.useState)(!1),[K,ae]=(0,S.useState)(`universal`),[q,oe]=(0,S.useState)(null),[se,ce]=(0,S.useState)(null),[le,ue]=(0,S.useState)(null),[de,fe]=(0,S.useState)(!1),[pe,me]=(0,S.useState)(!1),[he,ge]=(0,S.useState)(`real_person`),[_e,ve]=(0,S.useState)(!1),ye=(0,S.useRef)(null),be=(0,S.useCallback)(()=>{ye.current&&=(window.clearTimeout(ye.current),null),ve(!0)},[]),xe=(0,S.useCallback)(()=>{ye.current&&window.clearTimeout(ye.current),ye.current=window.setTimeout(()=>{ve(!1),ye.current=null},260)},[]),[Se,Ce]=(0,S.useState)(!1),we=(0,S.useRef)(null),Te=(0,S.useRef)(!1),[Ee,De]=(0,S.useState)({top:0,left:0}),Oe=e=>{let t=0,n=0,r=0;return e.map(e=>e.type===`image`?(t++,`图片${t}`):e.type===`video`?(n++,`视频${n}`):(r++,`音频${r}`))},[ke,Ae]=(0,S.useState)(!1),[je,Me]=(0,S.useState)(``),[Ne,Pe]=(0,S.useState)(`image`),Fe=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(ke&&Ne===`video`){let e=()=>{Fe.current&&Fe.current.play().catch(()=>{})};Fe.current&&(Fe.current.readyState>=2?e():Fe.current.addEventListener(`loadedmetadata`,e));let t=setTimeout(e,300);return()=>{clearTimeout(t),Fe.current&&(Fe.current.removeEventListener(`loadedmetadata`,e),Fe.current.pause())}}else Fe.current&&Fe.current.pause()},[ke,Ne]);let[Ie,Le]=(0,S.useState)(new Set),Re=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}}},ze=e=>{let t=Re(e);return t?Math.floor(Date.now()/1e3)>t:!1},[Be,Ve]=(0,S.useState)(!1),[He,Ue]=(0,S.useState)(``),[We,Ge]=(0,S.useState)(`image`),[qe,Je]=(0,S.useState)(``),Ye=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(Be&&We===`video`&&Ye.current){let e=Ye.current;e.currentTime=0,e.muted=!1;let t=e.play();t&&typeof t.catch==`function`&&t.catch(()=>{e.muted=!0,e.play().catch(()=>{})})}else if(!Be&&Ye.current){let e=Ye.current;e.pause(),e.muted=!0,e.currentTime=0}},[Be,We,He]);let[Xe,Ze]=(0,S.useState)(null),[Qe,$e]=(0,S.useState)(0),[et,tt]=(0,S.useState)(!1),[nt,rt]=(0,S.useState)(null),[it,at]=(0,S.useState)({x:0,y:0}),[ot,st]=(0,S.useState)(!1),[ct,lt]=(0,S.useState)(!1),[ut,dt]=(0,S.useState)([]),[ft,pt]=(0,S.useState)([]),[mt,ht]=(0,S.useState)({}),[gt,_t]=(0,S.useState)(!1),[vt,yt]=(0,S.useState)(!1),[bt,xt]=(0,S.useState)([]),[St,Ct]=(0,S.useState)([]),[wt,Tt]=(0,S.useState)([]),Et=()=>{let e={};if(e=wt.find(e=>e.modelConfigId===l&&e.genType===c&&e.resolution===(c===`video`?_:f)),e||(c===`video`?(e={perSecondCredits:2,baseCredits:60,ratio:1.3,inputVideoRatio:1.3,inputVideoBaseCredits:0,inputVideoPerSecondCredits:15,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0},(_===`1080p`||_===`720p`||_===`480p`)&&(e.ratio=1.3)):(e={perSecondCredits:.1,baseCredits:2,ratio:3,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0},(f===`2K`||f===`4K`||f===`1K`)&&(e.ratio=3))),c===`video`){let t=(h*e.perSecondCredits+e.baseCredits)*e.ratio,n=F.filter(e=>e.type===`video`).reduce((e,t)=>e+(t.duration||0),0);if(n>0){let r=((e.inputVideoBaseCredits||0)+(e.inputVideoPerSecondCredits||0)*n)*(e.inputVideoRatio||1);t+=r}let r=F.filter(e=>e.type===`image`).length;if(r>0){let n=((e.inputImageBaseCredits||0)+(e.inputImagePerImageCredits||0)*r)*(e.inputImageRatio||1);t+=n}return Number((t*u).toFixed(2))}else{let t=e.baseCredits*e.ratio,n=F.filter(e=>e.type===`image`).length;if(n>0){let r=((e.inputImageBaseCredits||0)+(e.inputImagePerImageCredits||0)*n)*(e.inputImageRatio||1);t+=r}return Number((t*u).toFixed(2))}},Dt=(0,S.useRef)(null),Ot=(0,S.useRef)(null),kt=(0,S.useRef)(null);(0,S.useRef)(!0);let At=(0,S.useRef)(!1),jt=(0,S.useRef)(0);o.find(e=>e.id===i);let[Mt,Nt]=(0,S.useState)([]),[Pt,Ft]=(0,S.useState)({page:1,pageSize:20}),[It,Lt]=(0,S.useState)(0),[Rt,zt]=(0,S.useState)(!1);(0,S.useEffect)(()=>{let e=t.state;e&&(e.generationPrompt&&P(e.generationPrompt),e.mediaReferences&&Array.isArray(e.mediaReferences)&&e.mediaReferences.length>0&&I(e.mediaReferences.map(e=>{let t=e.url||e.resourceUrl||e.previewUrl||``,n=t.startsWith(`http`)?t:`http://ceshi.apiforeign.minzhong.cn${t}`;return{...e,name:e.name||`参考${e.type}`,type:e.type===`video`?`video`:e.type===`audio`?`audio`:`image`,url:n,duration:e.duration||0,label:e.label||``}})),e.aspectRatio&&A(e.aspectRatio),window.history.replaceState({},``,window.location.pathname))},[t.state]),(0,S.useEffect)(()=>()=>{ye.current&&window.clearTimeout(ye.current)},[]);let Bt=(0,S.useCallback)((e=`instant`)=>{let t=Ot.current;t&&(jt.current=Date.now(),requestAnimationFrame(()=>{t.scrollTo({top:t.scrollHeight,behavior:e})}))},[]);(0,S.useEffect)(()=>{if(Mt.length>0&&!At.current){let e=setTimeout(()=>{Bt(`smooth`),At.current=!0},300);return()=>clearTimeout(e)}},[Mt.length,Bt]),(0,S.useEffect)(()=>{if(Te.current){Te.current=!1;return}if(!G)return;let e=Array.isArray(y)?{}:y,t=c===`image`?e.image:e.video;t&&t.length>0&&(t.some(e=>e.id===l)||C(t[0].id))},[c,y,G]),(0,S.useEffect)(()=>{G&&w(1)},[c,l,G,w]),(0,S.useEffect)(()=>{u>W&&(w(W),c===`image`&&e.info(`受当前引擎或参考图数量限制,本次最多生成 ${W} 份`))},[u,W,c,w,e]),(0,S.useEffect)(()=>{let e=e=>{let t=e.target;vt&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&yt(!1),gt&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&_t(!1),ot&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&st(!1),ct&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&<(!1),de&&!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&fe(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[vt,gt,ot,ct,de]),(0,S.useEffect)(()=>{if(Te.current){Te.current=!1;return}if(c!==`video`)return;let e=L.video?.find(e=>e.id===l);if(!e)return;let t=e.supportsFirstLastFrame??!1,n=e.supportsUniversalReference??!0;ae(e=>n?`universal`:e===`universal`&&!n&&t?`first_last_frame`:e)},[l,c,y]),(0,S.useEffect)(()=>{V5().then(e=>{if(N(e.engine),ie(!0),e.engine.video&&e.engine.video.length>0){let t=e.engine.video[0],n=e.engine.video.find(e=>e.id===l)||t;M({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(g)||A(n.supportedRatios?.[0]||`16:9`),n.supportedResolutions?.includes(_)||j(n.supportedResolutions?.[0]||`720p`),n.supportedDurations?.includes(h)||k(n.supportedDurations?.[0]||5),l===`请选择`&&C(n.id)}if(e.engine.image&&e.engine.image.length>0){let t=e.engine.image.find(e=>e.id===l)||e.engine.image[0],n=t.supportedSizes||{},r=Object.keys(n).sort((e,t)=>{let n={"1K":0,"2K":1,"4K":2};return(n[e]||0)-(n[t]||0)}),i=r[0]||`2K`,a=Object.keys(n[i]||{});if(dt(a.map(e=>({value:e,label:e}))),ht(n),pt(r.map(e=>{let t=e.match(/(\d+)K/);return{value:e,label:`${{1:`标清`,2:`高清`,4:`超清`}[t?parseInt(t[1]):1]||`高清`} ${e}`}})),n[i]&&n[i][a[0]]){let[e,t]=n[i][a[0]].split(/[×x]/);D(Number(e)),O(Number(t)),T(a[0]),E(i)}l===`请选择`&&C(t.id)}}).catch(()=>{}),Wie().then(e=>{Tt(e)}),H5(Pt).then(e=>{let t=e.items,n=e.total;Nt(t),Lt(n)})},[]),(0,S.useEffect)(()=>{if(kt.current&&=(clearInterval(kt.current),null),Mt.some(e=>e.status===`generating`))return kt.current=window.setInterval(()=>{H5(Pt).then(e=>{Nt(t=>t.map(t=>t.status===`generating`&&e.items.find(e=>e.id===t.id)||t)),Lt(e.total)}).catch(e=>{})},1e4),()=>{kt.current&&=(clearInterval(kt.current),null)}},[Mt,Pt]),(0,S.useEffect)(()=>{if(!ot)return;let e=e=>{let t=e.target;!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&st(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[ot]),(0,S.useEffect)(()=>{if(!ct)return;let e=e=>{let t=e.target;!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&<(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[ct]);let Vt=e=>{let t=Object.keys(mt).sort((e,t)=>{let n={"1K":0,"2K":1,"4K":2};return(n[e]||0)-(n[t]||0)}),n=mt[f]&&mt[f][e]?f:t.find(t=>mt[t]&&mt[t][e])||t[0];if(n&&mt[n]&&mt[n][e]){let[t,r]=mt[n][e].split(/[×x]/);D(Number(t)),O(Number(r)),T(e),E(n)}},Ht=e=>{mt[e]||(e=Object.keys(mt).sort((e,t)=>{let n={"1K":0,"2K":1,"4K":2};return(n[e]||0)-(n[t]||0)})[0]||e);let t=mt[e]?Object.keys(mt[e]):[];dt(t.map(e=>({value:e,label:e})));let n=t.includes(d)?d:t[0]||``;if(n&&mt[e]&&mt[e][n]){let[t,r]=mt[e][n].split(/[×x]/);D(Number(t)),O(Number(r)),T(n),E(e)}},Ut=()=>{D(m),O(p)},Wt=y?.video?.find(e=>e.id===l),Gt=Wt?.supportsFirstLastFrame??!1,Kt=Wt?.supportsUniversalReference??!0,qt=e=>{e===`first_last_frame`&&!Gt||e===`universal`&&!Kt||(ae(e),fe(!1),I([]),P(``))},Jt=()=>{let e=q;oe(se),ce(e)},Yt=()=>{oe(null),ce(null)},Xt=()=>{ce(null)},Zt=async()=>{let t=c===`video`&&K===`first_last_frame`;if(t){if(!b.trim()){e.warning(`请输入内容`);return}}else if(!b.trim()&&F.length===0){e.warning(`请输入内容或上传图片/视频`);return}let n;t?(n=[],q&&n.push({...q,role:`first_frame`}),se&&n.push({...se,role:`last_frame`}),n.length===0&&(n=void 0)):n=F.length>0?F.map(e=>{if(e.type===`image`){let{duration:t,...n}=e;return n}return e}):void 0;let r={id:``,gen_type:c,original_prompt:b.trim(),engine_id:l,idempotency_key:new Date().toLocaleString(`zh-CN`),generation_count:u,media_references:n,...c===`image`&&{image_size:f,image_proportion:d,image_px:p+`x`+m},...c===`video`&&{duration:h,aspect_ratio:g,resolution:_}};re(!0),Vie(r).then(()=>{P(``),I([]),oe(null),ce(null),w(1);let e={...Pt,page:1};Ft(e),H5(e).then(e=>{let t=Array.isArray(e.items)&&e.items.length>0?e.items[e.items.length-1]:null;t&&Nt(e=>[...e,t]),Lt(e.total),setTimeout(()=>{Dt.current?.scrollIntoView({behavior:`smooth`})},100)}).catch(e=>{})}).catch(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),e.error({content:n,duration:3})}).finally(()=>{re(!1)}),setTimeout(()=>{re(!1)},3e3)},Qt=async()=>{if(Mt.length>=It)return;let e=Ot.current;if(!e)return;let t=e.scrollTop,n=e.scrollHeight;zt(!0);try{let r=Pt.page+1,i=await H5({...Pt,page:r}),a=Array.isArray(i)?{items:i,total:i.length}:i;a.total&&Lt(a.total),Ft(e=>({...e,page:r})),Nt(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)).reverse(),...e]}),setTimeout(()=>{e.scrollTop=t+(e.scrollHeight-n)},200)}catch{}finally{zt(!1)}},$t=e=>new Promise((t,n)=>{let r=document.createElement(`video`);r.preload=`metadata`,r.onloadedmetadata=()=>{window.URL.revokeObjectURL(r.src),t(r.duration)},r.onerror=()=>{window.URL.revokeObjectURL(r.src),n(Error(`无法获取视频时长`))},r.src=URL.createObjectURL(e)}),en=e=>new Promise((t,n)=>{let r=document.createElement(`audio`);r.preload=`metadata`,r.onloadedmetadata=()=>{URL.revokeObjectURL(r.src),t(r.duration)},r.onerror=()=>{URL.revokeObjectURL(r.src),n(Error(`无法获取音频时长`))},r.src=URL.createObjectURL(e)}),tn=e=>{let t=e.startsWith(`http`)?e:`http://ceshi.apiforeign.minzhong.cn${e}`;if(Xe===t){let e=document.getElementById(`audio-player`);e&&e.pause(),Ze(null)}else Ze(t)},nn=e=>new Promise((t,n)=>{let r=new Image;r.onload=()=>{window.URL.revokeObjectURL(r.src),t({width:r.naturalWidth,height:r.naturalHeight})},r.onerror=()=>{window.URL.revokeObjectURL(r.src),n(Error(`无法读取图片尺寸`))},r.src=URL.createObjectURL(e)}),rn=e=>new Promise((t,n)=>{let r=document.createElement(`video`);r.preload=`metadata`,r.onloadedmetadata=()=>{window.URL.revokeObjectURL(r.src),t({width:r.videoWidth,height:r.videoHeight,duration:r.duration})},r.onerror=()=>{window.URL.revokeObjectURL(r.src),n(Error(`无法读取视频尺寸`))},r.src=URL.createObjectURL(e)}),an=(e,t)=>{if(e<300||e>6e3)return`图片宽度需在 300~6000px 之间,当前为 ${e}px`;if(t<300||t>6e3)return`图片高度需在 300~6000px 之间,当前为 ${t}px`;let n=e/t;return n<.4||n>2.5?`图片宽高比需在 0.4~2.5 之间,当前为 ${n.toFixed(2)}`:null},on=(e,t)=>{if(e<300||e>6e3)return`视频宽度需在 300~6000px 之间,当前为 ${e}px`;if(t<300||t>6e3)return`视频高度需在 300~6000px 之间,当前为 ${t}px`;let n=e/t;if(n<.4||n>2.5)return`视频宽高比需在 0.4~2.5 之间,当前为 ${n.toFixed(2)}`;let r=e*t;return r<409600?`视频总像素数过小(${e}×${t}=${r}),需 ≥ 640×640=409600`:r>8295044?`视频总像素数过大(${e}×${t}=${r}),需 ≤ 3326×2494=8295044`:null},sn=async(t,n)=>{let r=t.type.startsWith(`image/`),i=t.type.startsWith(`video/`);if(c===`video`&&K===`first_last_frame`){if(!r)return e.error(`首尾帧模式仅支持上传图片`),!1;if(t.size/1024/1024>10)return e.error(`图片大小不能超过10MB`),!1;try{let{width:n,height:r}=await nn(t),i=an(n,r);if(i)return e.error(i),!1}catch{return e.error(`无法读取图片尺寸,请检查文件是否损坏`),!1}let i=n||le;if(!i)return e.error(`请选择首帧或尾帧上传位置`),!1;te(!0);try{let n=await O5(t),r={name:t.name,type:`image`,url:n.url,role:i===`first`?`first_frame`:`last_frame`};i===`first`?oe(r):ce(r),e.success(`图片上传成功`)}catch{e.error(`上传失败`)}finally{te(!1),ue(null)}return!1}let a=t.type.startsWith(`audio/`);if(!r&&!i&&!a)return e.error(`仅支持图片、视频或音频文件`),!1;if(a){let n=t.name.split(`.`).pop()?.toLowerCase();if(![`wav`,`mp3`].includes(n||``))return e.error(`音频仅支持wav和mp3格式`),!1}if(c===`image`&&(i||a))return e.error(`图片模式仅支持上传图片`),!1;if(a&&c!==`video`)return e.error(`仅视频模式支持上传音频`),!1;let o=i?100:a?50:10,s=i?`视频`:a?`音频`:`图片`;if(t.size/1024/1024>o)return e.error(`${s}大小不能超过${o}MB`),!1;if(r)try{let{width:n,height:r}=await nn(t),i=an(n,r);if(i)return e.error(i),!1}catch{return e.error(`无法读取图片尺寸,请检查文件是否损坏`),!1}let l=F.filter(e=>e.type===`image`).length;if(r&&l>=jn)return e.error(`该引擎最多上传${jn}张图片`),!1;let u=F.filter(e=>e.type===`video`).length;if(i&&u>=Mn)return e.error(`该引擎最多上传${Mn}个视频`),!1;let d=F.filter(e=>e.type===`audio`).length;if(a&&d>=Nn)return e.error(`该引擎最多上传${Nn}个音频`),!1;let f=0,p=0;if(i)try{if(f=await $t(t),f<2)return e.error(`视频素材最短不能少于 2 秒`),!1;let n=F.filter(e=>e.type===`video`).reduce((e,t)=>e+(t.duration||0),0);if(n+f>15)return e.error(`所有视频素材总时长不能超过 15 秒,当前 ${(n+f).toFixed(1)} 秒`),!1;let{width:r,height:i}=await rn(t),a=on(r,i);if(a)return e.error(a),!1}catch{return e.error(`无法获取视频信息,请检查文件是否损坏`),!1}if(a)try{if(p=await en(t),p<2)return e.error(`音频素材最短不能少于 2 秒`),!1;let n=F.filter(e=>e.type===`audio`).reduce((e,t)=>e+(t.duration||0),0);if(n+p>15)return e.error(`所有音频素材总时长不能超过 15 秒,当前 ${(n+p).toFixed(1)} 秒`),!1}catch{return e.error(`无法获取音频信息,请检查文件是否损坏`),!1}te(!0);try{let e;e=r?await O5(t):a?await D5(t,p):await k5(t,f);let n=r?`image`:a?`audio`:`video`,o=[...F,{name:t.name,type:n,url:e.url,label:``,...i&&{duration:f},...a&&{duration:p}}],s=Oe(o);I(o.map((e,t)=>({...e,label:s[t]})))}catch{e.error(`上传失败`)}finally{te(!1)}return!1},cn=async t=>{let n=t.type.startsWith(`image/`),r=t.type.startsWith(`video/`),i=t.type.startsWith(`audio/`);if(!n&&!r&&!i)return e.error(`仅支持图片、视频或音频文件`),!1;let a=r?100:i?50:10;if(t.size/1024/1024>a)return e.error(`${r?`视频`:i?`音频`:`图片`}大小不能超过${a}MB`),!1;if(i){let n=t.name.split(`.`).pop()?.toLowerCase();if(![`wav`,`mp3`].includes(n||``))return e.error(`音频仅支持wav和mp3格式`),!1}if(n)try{let{width:n,height:r}=await nn(t),i=an(n,r);if(i)return e.error(i),!1}catch{return e.error(`无法读取图片尺寸,请检查文件是否损坏`),!1}let o=0,s=0;if(r)try{if(o=await $t(t),o<2)return e.error(`视频素材最短不能少于 2 秒`),!1;let n=T7.getState().currentMedia.filter(e=>e.type===`video`).reduce((e,t)=>e+(t.duration||0),0);if(n+o>15)return e.error(`所有视频素材总时长不能超过 15 秒,当前 ${(n+o).toFixed(1)} 秒`),!1}catch{return e.error(`无法获取视频信息,请检查文件是否损坏`),!1}if(i)try{if(s=await en(t),s<2)return e.error(`音频素材最短不能少于 2 秒`),!1;let n=T7.getState().currentMedia.filter(e=>e.type===`audio`).reduce((e,t)=>e+(t.duration||0),0);if(n+s>15)return e.error(`所有音频素材总时长不能超过 15 秒,当前 ${(n+s).toFixed(1)} 秒`),!1}catch{return e.error(`无法获取音频信息,请检查文件是否损坏`),!1}let c=n?`image`:i?`audio`:`video`,l={name:t.name,type:c,url:``,label:``,...r&&{duration:o},...i&&{duration:s}},u=T7.getState().currentMedia;if(!dn(u,[l]))return!1;try{let e;return e=n?await O5(t):i?await D5(t,s):await k5(t,o),{name:l.name,type:l.type,url:e.url,label:l.label||``,...l.duration!==void 0&&{duration:l.duration}}}catch{return e.error(`上传失败`),!1}},ln=async t=>{let n=0,r=0;te(!0);for(let e of t){let t=await cn(e);if(t){let e=[...T7.getState().currentMedia,t],r=Oe(e);I(e.map((e,t)=>({...e,label:r[t]}))),n++}else r++}te(!1),n>0&&e.success(`成功上传${n}个文件${r>0?`,${r}个文件上传失败`:``}`)},un=(e,t)=>e.filter(e=>e.type===t).reduce((e,t)=>e+(Number(t.duration)||0),0),dn=(t,n)=>{if(!n.length)return!1;if(c===`image`&&n.some(e=>e.type!==`image`))return e.error(`图片模式仅支持添加图片素材`),!1;if(n.some(e=>e.type===`audio`)&&c!==`video`)return e.error(`仅视频模式支持添加音频素材`),!1;let r=t.filter(e=>e.type===`image`).length,i=t.filter(e=>e.type===`video`).length,a=t.filter(e=>e.type===`audio`).length,o=n.filter(e=>e.type===`image`).length,s=n.filter(e=>e.type===`video`).length,l=n.filter(e=>e.type===`audio`).length;if(r+o>jn)return e.error(`该引擎最多上传${jn}张图片,当前还能添加 ${Math.max(0,jn-r)} 张`),!1;if(i+s>Mn)return e.error(`该引擎最多上传${Mn}个视频,当前还能添加 ${Math.max(0,Mn-i)} 个`),!1;if(a+l>Nn)return e.error(`该引擎最多上传${Nn}个音频,当前还能添加 ${Math.max(0,Nn-a)} 个`),!1;for(let t of n){if(t.type!==`video`)continue;let n=Number(t.duration);if(!Number.isFinite(n)||n<=0)return e.error(`${t.name||`视频素材`}缺少视频秒数,不能用于 AI 创作`),!1;if(n<2)return e.error(`${t.name||`视频素材`}最短不能少于 2 秒`),!1;if(n>15)return e.error(`${t.name||`视频素材`}最长不能超过 15 秒`),!1}let u=un(t,`video`)+un(n,`video`);if(u>15)return e.error(`所有视频素材总时长不能超过 15 秒,当前 ${u.toFixed(1)} 秒`),!1;let d=un(t,`audio`)+un(n,`audio`);return d>15?(e.error(`所有音频素材总时长不能超过 15 秒,当前 ${d.toFixed(1)} 秒`),!1):!0},fn=t=>{let n=t.mediaReference,r=n?.type||t.resourceType,i=n?.url||t.resourceUrl||t.displayUrl||t.previewUrl||``;if(!i)return e.error(`${t.fileName||t.id} 缺少素材地址,不能用于 AI 创作`),null;if(r===`audio`&&c!==`video`)return e.error(`仅视频模式支持添加音频素材`),null;let a=Number(n?.duration??t.durationSeconds);return{name:n?.name||t.fileName||t.id,type:r,url:i,source:`upload_resource`,upload_resource_id:t.id,label:``,...(r===`video`||r===`audio`)&&Number.isFinite(a)&&a>0?{duration:a}:{}}},pn=t=>{let n=t.map(fn).filter(Boolean);if(!n.length)return;let r=T7.getState().currentMedia;if(!dn(r,n))return;let i=[...r,...n],a=Oe(i);I(i.map((e,t)=>({...e,label:a[t]}))),e.success(`已添加 ${n.length} 个历史上传素材参考`)},mn=t=>{if(t.assetType===`Audio`)return e.error(`音频私域素材暂不支持用于 AI 创作`),null;let n=t.assetType===`Video`?`video`:`image`,r=he===`aigc_virtual`?`虚拟素材`:`真人素材`,i=n===`video`?t.videoCoverUrl||t.previewUrl||t.displayUrl||t.providerUrl||``:t.previewUrl||t.displayUrl||t.videoCoverUrl||t.providerUrl||``;return{name:t.name||r,type:n,url:i,source:`private_portrait_asset`,private_asset_id:t.id,label:``,...n===`video`&&{duration:Number(t.videoDuration)||void 0}}},hn=e=>{ge(e),me(!0)},gn=t=>{let n=t.map(mn).filter(Boolean),r=T7.getState().currentMedia;if(!dn(r,n))return;let i=[...r,...n],a=Oe(i);I(i.map((e,t)=>({...e,label:a[t]}))),e.success(`已添加 ${n.length} 个${he===`aigc_virtual`?`虚拟`:`真人`}素材参考`)},_n=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`http://ceshi.apiforeign.minzhong.cn`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,vn=e=>{let t=F.filter((t,n)=>n!==e),n=Oe(t);I(t.map((e,t)=>({...e,label:n[t]})))},yn=(e,t)=>{let n=e.selectionStart;return t.slice(0,n).match(/@([^@\s]*)$/)&&F.length>0?(Ce(!0),!0):(Ce(!1),!1)},bn=e=>{let t=e.target.value;P(t);let n=e.target;yn(n,t)},xn=e=>{Se&&e.key===`Escape`&&Ce(!1)},Sn=e=>{let t=we.current?.resizableTextArea?.textArea;if(!t)return;let n=t.selectionStart,r=b.slice(0,n),i=b.slice(n),a=r.lastIndexOf(`@`);if(a===-1){Ce(!1);return}P(r.slice(0,a)+`@${e} `+i),Ce(!1),setTimeout(()=>{let n=a+e.length+2;t.focus(),t.setSelectionRange(n,n)},0)},Cn=()=>{Ae(!1),Me(``),Fe.current&&Fe.current.pause()},wn=e=>{if(e.preventDefault(),e.stopPropagation(),!je)return;let t=document.createElement(`a`);t.href=`http://ceshi.apiforeign.minzhong.cn${je}&download=1`,t.download=Ne===`image`?`image.png`:`video.mp4`,document.body.appendChild(t),t.click(),document.body.removeChild(t)},Tn=e=>{let t=String(e?.type||``).toLowerCase(),n=String(e?.url||e?.name||``).toLowerCase();return t.includes(`video`)||/\.(mp4|mov|avi|webm|m4v)(\?|$)/.test(n)?`video`:t.includes(`audio`)||/\.(mp3|wav|ogg|aac|m4a)(\?|$)/.test(n)?`audio`:`image`},En=e=>e?/^https?:\/\//i.test(e)?e:`http://ceshi.apiforeign.minzhong.cn${e}`:``,Dn=e=>{e?.url&&(Ue(e.url),Ge(Tn(e)),Je(e.name||`附件`),Ve(!0))},On=c===`video`&&K===`first_last_frame`,kn=!ee&&(On?!!(b.trim()||q):!!(b.trim()||F.length>0)),An=c===`image`?`输入画面描述,或上传图片参考风格、构图、主体与光影。例:@图片1 参考色调,生成一张简洁高级的产品海报。`:On?`首帧尾帧可以不传,如需传入建议描述首帧到尾帧的主体动作、镜头运动、节奏与转场。例:从首帧自然推进到尾帧,产品居中突出,动作平滑连贯。`:`上传最多12个参考素材,输入文字或 @ 引用参考内容,自由组合图、文、视频。例:@图片1 模仿 @视频1 的动作。`,jn=z,Mn=B,Nn=R?.maxAudioCount??1;return(0,$.jsxs)(KW,{className:`ai-create-page`,style:{margin:`-24px -32px -32px`,borderRadius:22,height:`calc(100vh - 34px)`,background:`#fff`,overflow:`hidden`},children:[(0,$.jsx)(`audio`,{id:`audio-player`,src:Xe||null,autoPlay:!0,onEnded:()=>Ze(null),style:{display:`none`}}),!1,(0,$.jsxs)(KW,{style:{display:`flex`,flex:1,background:`#fff`},children:[(0,$.jsx)(`div`,{className:`animate-fadeInUp`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`16px 24px`,background:`linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, rgba(139, 92, 246, 0.04) 100%)`,backdropFilter:`blur(22px)`,border:`1px solid rgba(231, 234, 240, 0.82)`,position:`relative`,overflow:`hidden`,flexWrap:`wrap`,gap:12},children:(0,$.jsxs)(`div`,{style:{width:`100%`,display:`flex`,alignItems:`center`,gap:16},children:[(0,$.jsx)(`div`,{style:{width:`15%`,height:1,background:`linear-gradient(90deg, transparent, rgba(117,106,136,0.18), rgba(232,227,236,0.48), transparent)`,borderRadius:1}}),(0,$.jsxs)(`div`,{style:{flex:1,minWidth:0,textAlign:`center`},children:[(0,$.jsx)(`h2`,{style:{margin:0,fontSize:18,fontWeight:700,color:`#8b5cf6`,letterSpacing:.4},children:`AI创作`}),(0,$.jsx)(`p`,{style:{fontSize:13,color:`#667085`,margin:`4px 0 0 0`},children:`输入想法、剧本或上传参考,智能生成视频/图片`})]}),(0,$.jsx)(`div`,{style:{width:`15%`,height:1,background:`linear-gradient(90deg, transparent, rgba(232,227,236,0.48), rgba(117,106,136,0.18), transparent)`,borderRadius:1}})]})}),(0,$.jsxs)(qoe,{style:{flex:1,margin:0,padding:`20px 24px 22px`,boxSizing:`border-box`,display:`flex`,flexDirection:`column`,overflow:`hidden`,minHeight:0},children:[Mt.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, #8b5cf6 0%, #ddd6fe 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,marginBottom:16},children:(0,$.jsx)(u8,{style:{fontSize:40,color:`#fff`}})}),(0,$.jsx)(`h2`,{style:{margin:0,fontSize:18,fontWeight:500,color:`#2f3440`},children:`你好,想创作什么?`}),(0,$.jsx)(`p`,{style:{margin:8,fontSize:13,color:`#98a2b3`},children:`输入想法、剧本或上传参考,开始你的创作之旅`})]}),Mt.length>0&&(0,$.jsxs)(`div`,{ref:Ot,className:`ai-create-scroll`,style:{flex:1,overflowY:`auto`,paddingRight:10,paddingBottom:18,background:`#fff`},onScroll:e=>{let t=e.currentTarget;!(Date.now()-jt.current<500)&&At.current&&t.scrollTop<=50&&!Rt&&Mt.length{let t=e;return Mt.map(e=>(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, #8b5cf6 0%, #ddd6fe 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,$.jsx)(u8,{style:{color:`#fff`,fontSize:16}})}),(0,$.jsx)(`div`,{style:{flex:1},children:(0,$.jsxs)(`div`,{style:{background:`rgba(255, 255, 255, 0.92)`,backdropFilter:`blur(18px)`,borderRadius:`22px`,padding:`14px 16px`,width:`70%`,minWidth:500,boxSizing:`border-box`,boxShadow:`0 18px 50px rgba(47, 52, 64, 0.075)`,position:`relative`,border:`1px solid rgba(231, 234, 240, 0.9)`},children:[(0,$.jsxs)(`div`,{style:{margin:4,fontSize:11,color:`#98a2b3`,textAlign:`left`,display:`flex`,flexWrap:`wrap`,gap:8,alignItems:`center`},children:[(0,$.jsx)(`span`,{children:e.createdAt?.replace(`T`,` `).split(`.`)[0]}),(0,$.jsx)(`span`,{style:{background:(e.genType,`rgba(139, 92, 246, 0.10)`),color:(e.genType,`#8b5cf6`),padding:`2px 8px`,borderRadius:12,fontWeight:500,fontSize:11,marginLeft:8},children:e.genType===`image`?`图片生成`:`视频生成`})]}),e.mediaReferences&&e.mediaReferences.length>0&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8,zIndex:100},children:(0,$.jsx)(`span`,{style:{padding:`4px 12px`,borderRadius:16,color:`#8b5cf6`,cursor:`pointer`,fontWeight:500,border:`1px solid rgba(139, 92, 246, 0.2)`,background:`rgba(139, 92, 246, 0.04)`},onClick:t=>{t.stopPropagation();let n=t.currentTarget.getBoundingClientRect();at({x:n.left,y:n.top-10}),rt(e.id),tt(!0)},children:`附件详情`})}),(0,$.jsxs)(`div`,{style:{position:`absolute`,bottom:8,right:8,zIndex:100,display:`flex`,gap:6},children:[(0,$.jsxs)(`button`,{onClick:n=>{n.stopPropagation(),P(e.originalPrompt||``);let r=!0,i=e.engineId||e.engineSnapshot?.id||e.engine_id;if(i&&e.genType){let n=Array.isArray(y)?{}:y,a=(e.genType===`image`?n.image:n.video)?.find(e=>e.id===i);if(a){if(C(a.id),e.genType===`video`&&M({ratios:a.supportedRatios||[`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`],resolutions:a.supportedResolutions||[`480p`,`720p`,`1080p`],durations:a.supportedDurations||[5,8,10,12,15]}),e.genType===`image`){let e=a.supportedSizes||{},t=Object.keys(e).sort((e,t)=>{let n={"1K":0,"2K":1,"4K":2};return(n[e]||0)-(n[t]||0)}),n=t[0]||`2K`,r=Object.keys(e[n]||{});if(dt(r.map(e=>({value:e,label:e}))),ht(e),pt(t.map(e=>{let t=e.match(/(\d+)K/);return{value:e,label:`${{1:`标清`,2:`高清`,4:`超清`}[t?parseInt(t[1]):1]||`高清`} ${e}`}})),e[n]&&e[n][r[0]]){let[t,i]=e[n][r[0]].split(/[×x]/);D(Number(t)),O(Number(i)),T(r[0]),E(n)}}}else t.error(`该引擎已删除,无法重新编辑`),r=!1}if(r){if(e.genType&&(Te.current=!0,x(e.genType)),e.mediaReferences&&e.mediaReferences.length>0)if(e.mediaReferences.some(e=>e.role===`first_frame`||e.role===`last_frame`)&&e.genType===`video`){let t=e.mediaReferences.find(e=>e.role===`first_frame`),n=e.mediaReferences.find(e=>e.role===`last_frame`);oe(t?{...t,label:t.label||``,duration:t.duration}:null),ce(n?{...n,label:n.label||``,duration:n.duration}:null),I([]),ae(`first_last_frame`)}else if(I(e.mediaReferences.map(e=>({name:e.name,type:e.type,url:e.url,label:e.label||``,role:e.role,duration:e.duration}))),oe(null),ce(null),e.genType===`video`){let e=L.video?.find(e=>e.id===i);if(e){let t=e.supportsUniversalReference??!0,n=e.supportsFirstLastFrame??!1;ae(t?`universal`:n?`first_last_frame`:`universal`)}else ae(`universal`)}else ae(`universal`);else if(I([]),oe(null),ce(null),e.genType===`video`){let e=y?.video?.find(e=>e.id===i);if(e){let t=e.supportsUniversalReference??!0,n=e.supportsFirstLastFrame??!1;ae(t?`universal`:n?`first_last_frame`:`universal`)}}t.success(`已加载到编辑区`)}},style:{height:28,padding:`0 10px`,borderRadius:10,border:`none`,background:`rgba(139, 92, 246, 0.08)`,color:`#8b5cf6`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.2s ease`,gap:4,fontSize:12},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(139, 92, 246, 0.15)`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(139, 92, 246, 0.08)`},children:[(0,$.jsx)(Tq,{style:{fontSize:12}}),`重新编辑`]}),(0,$.jsx)(yK,{title:`确定要删除吗?`,onConfirm:async()=>{try{await Uie(e.id),t.success(`删除成功`),Nt(t=>t.filter(t=>t.id!==e.id)),Lt(e=>e-1)}catch(e){let n=e?.response?.data?.message||e?.message||`删除失败`;t.error(n)}},okText:`确定`,cancelText:`取消`,children:(0,$.jsxs)(`button`,{onClick:e=>e.stopPropagation(),style:{height:28,padding:`0 10px`,borderRadius:10,border:`none`,background:`rgba(139, 92, 246, 0.08)`,color:`#8b5cf6`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.2s ease`,gap:4,fontSize:12},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(164, 91, 91, 0.1)`,e.currentTarget.style.color=`#A45B5B`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(139, 92, 246, 0.08)`,e.currentTarget.style.color=`#8b5cf6`},children:[(0,$.jsx)(d$,{style:{fontSize:12}}),`删除`]})})]}),(e.status===`generating`||e.status===`failed`||e.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 #E7EAF0`,boxShadow:`0 4px 12px rgba(139, 92, 246, 0.08)`,background:`linear-gradient(135deg, #ffffff 0%, #FAFBFC 100%)`},children:(0,$.jsx)(Coe,{task:e,resolveUrl:Zoe,onPreview:(e,t)=>{Me(e),Pe(t),Ae(!0)}})}),(0,$.jsxs)(`div`,{style:{width:`50%`,display:`flex`,flexDirection:`column`,gap:12},children:[(0,$.jsx)(`div`,{style:{background:`#FFFFFF`,borderRadius:12,padding:12,border:`1px solid #E7EAF0`,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:`#475467`,fontSize:13},children:e.originalPrompt})}),(0,$.jsxs)(`div`,{style:{fontSize:12,color:`#667085`,textAlign:`left`,display:`flex`,flexWrap:`wrap`,gap:12,alignItems:`center`,justifyContent:`space-between`,marginBottom:12},children:[(0,$.jsx)(`span`,{style:{borderRadius:16,color:`#8b5cf6`,fontWeight:500},children:e.engineSnapshot?.name||`未知引擎`}),(0,$.jsx)(`span`,{style:{borderRadius:16,color:`#667085`},children:e.genType===`image`?`${e.imageProportion||``} · ${e.imagePx||``} · ${e.imageSize||``}`:`${e.duration||``}秒 · ${e.aspectRatio||``} · ${e.resolution||``}`}),(0,$.jsxs)(`span`,{style:{fontSize:14,borderRadius:16,color:`#8b5cf6`},children:[`消耗积分:`,e.creditsCost]})]})]})]})]})})]})},e.id))})(),(0,$.jsx)(`div`,{ref:Dt})]}),et&&nt&&(()=>{let e=Mt.find(e=>e.id===nt)?.mediaReferences||[];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{style:{position:`fixed`,top:0,left:0,right:0,bottom:0,background:`transparent`,zIndex:9998},onClick:()=>{tt(!1),rt(null)}}),(0,$.jsxs)(`div`,{className:`ai-reference-expanded-tray ai-attachment-popover`,style:{position:`fixed`,top:`max(84px, ${it.y-96}px)`,left:`max(24px, min(${it.x-250}px, calc(100vw - 456px)))`,width:424,padding:`12px 12px 10px`,borderRadius:18,background:`rgba(255,255,255,0.98)`,border:`1px solid #E7EAF0`,boxShadow:`0 24px 60px rgba(31, 41, 55, 0.12)`,backdropFilter:`blur(18px)`,zIndex:9999,pointerEvents:`auto`},onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:10},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2},children:[(0,$.jsx)(`span`,{style:{fontSize:13,color:`#344054`,fontWeight:800},children:`参考附件`}),(0,$.jsx)(`span`,{style:{fontSize:11,color:`#98A2B3`,fontWeight:600},children:`点击素材查看,或直接下载原文件`})]}),(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:(0,$.jsx)(`button`,{onClick:()=>{tt(!1),rt(null)},style:{width:26,height:26,borderRadius:`50%`,border:`1px solid transparent`,background:`#F6F7FA`,cursor:`pointer`,color:`#98a2b3`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#EEF1F6`,e.currentTarget.style.color=`#2f3440`},onMouseLeave:e=>{e.currentTarget.style.background=`#F6F7FA`,e.currentTarget.style.color=`#98a2b3`},children:(0,$.jsx)(ju,{style:{fontSize:12}})})})]}),(0,$.jsx)(`div`,{className:`ai-reference-tray-scroll`,style:{display:`flex`,gap:10,overflowX:`auto`,padding:`2px 2px 4px`},children:e.map((e,t)=>{let n=Tn(e),r=e.label||(e.role===`first_frame`?`首帧`:e.role===`last_frame`?`尾帧`:`${n===`image`?`图片`:n===`video`?`视频`:`音频`}${t+1}`);return(0,$.jsxs)(`div`,{style:{flex:`0 0 92px`,width:92,borderRadius:16,background:`#FFFFFF`,border:`1px solid #E7EAF0`,boxShadow:`0 8px 18px rgba(31, 41, 55, 0.06)`,padding:7,boxSizing:`border-box`},children:[(0,$.jsx)(`div`,{onClick:t=>{n===`audio`?(t.stopPropagation(),tn(e.url)):(Dn(e),tt(!1),rt(null))},style:{position:`relative`,width:`100%`,height:70,borderRadius:12,overflow:`hidden`,cursor:`pointer`,background:`#F7F8FA`,border:`1px solid rgba(231, 234, 240, 0.9)`},children:n===`image`?(0,$.jsx)(`img`,{src:En(e.url),alt:e.name||r,style:{width:`100%`,height:`100%`,objectFit:`cover`,display:`block`}}):n===`video`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`video`,{src:En(e.url),muted:!0,playsInline:!0,style:{width:`100%`,height:`100%`,objectFit:`cover`,display:`block`}}),(0,$.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`rgba(31, 41, 55, 0.08)`},children:(0,$.jsx)(`div`,{style:{width:28,height:28,borderRadius:`50%`,background:`rgba(47, 52, 64, 0.72)`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 8px 18px rgba(31, 41, 55, 0.22)`},children:(0,$.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`#fff`,children:(0,$.jsx)(`path`,{d:`M8 5v14l11-7z`})})})})]}):(0,$.jsx)(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%)`},children:Xe===(e.url.startsWith(`http`)?e.url:`http://ceshi.apiforeign.minzhong.cn${e.url}`)?(0,$.jsx)(j6,{style:{fontSize:24,color:`#fff`}}):(0,$.jsx)(j2,{style:{fontSize:24,color:`#fff`}})})}),(0,$.jsx)(`div`,{title:e.name||r,style:{marginTop:6,color:`#667085`,fontSize:10,fontWeight:700,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,textAlign:`center`},children:e.name||r}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:5,marginTop:7},children:(0,$.jsx)(`button`,{onClick:()=>{Dn(e),tt(!1),rt(null)},style:{flex:1,height:24,borderRadius:9,border:`1px solid #E7EAF0`,background:`#F8FAFC`,color:`#8b5cf6`,fontSize:11,fontWeight:700,cursor:`pointer`,transition:`all 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#EEF1F6`},onMouseLeave:e=>{e.currentTarget.style.background=`#F8FAFC`},children:`查看`})})]},`${e.url||e.name||t}-${t}`)})})]})]})})(),(0,$.jsxs)(`div`,{style:{position:`relative`,background:`#ffffff`,borderRadius:24,padding:`18px 72px 16px 20px`,boxShadow:`0 22px 64px rgba(31, 41, 55, 0.08), 0 1px 0 rgba(255,255,255,0.98) inset`,transition:`all 0.25s ease`,border:`1px solid rgba(231, 234, 240, 0.78)`,backdropFilter:`blur(24px)`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,gap:18,alignItems:`flex-end`,marginBottom:14},children:[(0,$.jsx)(`div`,{style:{width:On?220:70,minWidth:On?220:70,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`flex-start`,paddingTop:2,gap:8},children:c===`video`&&K===`first_last_frame`?(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`stretch`,gap:12,width:`100%`,height:100},children:[(0,$.jsxs)(`div`,{style:{position:`relative`,flex:1,minWidth:0,height:100,borderRadius:12,border:`1px solid #E7EAF0`,background:`#ffffff`,boxShadow:`0 6px 16px rgba(47, 52, 64, 0.04)`,overflow:`hidden`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,left:10,right:10,display:`flex`,alignItems:`center`,justifyContent:`space-between`,zIndex:2},children:(0,$.jsx)(`span`,{style:{fontSize:11,fontWeight:600,color:`#8b5cf6`,lineHeight:1},children:`首帧(可选)`})}),q?(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64},children:[(0,$.jsx)(`img`,{src:_n(q.url),alt:q.name,onClick:()=>{Ue(q.url),Ge(`image`),Je(q.name),Ve(!0)},style:{width:`100%`,height:`100%`,objectFit:`cover`,borderRadius:8,cursor:`pointer`,border:`1px solid rgba(139, 92, 246, 0.2)`,boxShadow:`0 3px 10px rgba(47, 52, 64, 0.06)`}}),(0,$.jsx)(`button`,{onClick:Yt,style:{position:`absolute`,top:-6,right:-6,width:18,height:18,border:`none`,background:`#A45B5B`,borderRadius:50,cursor:`pointer`,color:`#fff`,fontSize:9,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 2px 4px rgba(164, 91, 91, 0.3)`,zIndex:10},children:(0,$.jsx)(d$,{style:{fontSize:9}})})]}):(0,$.jsx)(B7,{accept:`image/*`,multiple:!1,onLocalSelect:e=>{e.length>0&&sn(e[0],`first`)},onHistorySelect:t=>{if(t.length>0){let n=t[0];oe({name:n.fileName||``,type:`image`,url:n.resourceUrl||n.previewUrl||n.displayUrl||``,role:`first_frame`,label:``}),e.success(`成功添加首帧`)}},onPortraitSelect:t=>{if(t.length>0){let n=t[0],r=n.previewUrl||n.displayUrl||n.videoCoverUrl||n.providerUrl||``;oe({name:n.name||`首帧图片`,type:`image`,url:r,role:`first_frame`,label:``,source:`private_portrait_asset`,private_asset_id:n.id}),e.success(`成功添加首帧`)}},uploading:ee,children:(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64,borderRadius:8,border:`1px dashed rgba(139, 92, 246, 0.28)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,transition:`all 0.25s ease`,backgroundColor:`rgba(139, 92, 246, 0.04)`,flexDirection:`column`,gap:4},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#a78bfa`,e.currentTarget.style.backgroundColor=`rgba(139, 92, 246, 0.08)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`rgba(139, 92, 246, 0.28)`,e.currentTarget.style.backgroundColor=`rgba(139, 92, 246, 0.04)`},children:[(0,$.jsx)(rL,{style:{fontSize:18,color:`#8b5cf6`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#8b5cf6`,fontWeight:500},children:`上传首帧`})]})})]}),(0,$.jsx)(`button`,{onClick:Jt,disabled:!q||!se,title:`调换首尾帧`,style:{width:32,height:32,alignSelf:`center`,borderRadius:50,border:`1px solid rgba(231, 234, 240, 0.95)`,background:q&&se?`linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%)`:`#F3F5F8`,cursor:q&&se?`pointer`:`not-allowed`,color:q&&se?`#fff`:`#98A2B3`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:q&&se?`0 6px 14px rgba(139, 92, 246, 0.24)`:`none`,transition:`all 0.2s ease`,flexShrink:0},onMouseEnter:e=>{q&&se&&(e.currentTarget.style.transform=`scale(1.06)`)},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`},children:(0,$.jsx)(VU,{style:{fontSize:14}})}),(0,$.jsxs)(`div`,{style:{position:`relative`,flex:1,minWidth:0,height:100,borderRadius:12,border:`1px solid #E7EAF0`,background:`#ffffff`,boxShadow:`0 6px 16px rgba(47, 52, 64, 0.04)`,overflow:`hidden`,opacity:q?1:.5},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,left:10,right:10,display:`flex`,alignItems:`center`,justifyContent:`space-between`,zIndex:2},children:(0,$.jsx)(`span`,{style:{fontSize:11,fontWeight:600,color:`#8b5cf6`,lineHeight:1},children:`尾帧`})}),se?(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64},children:[(0,$.jsx)(`img`,{src:_n(se.url),alt:se.name,onClick:()=>{Ue(se.url),Ge(`image`),Je(se.name),Ve(!0)},style:{width:`100%`,height:`100%`,objectFit:`cover`,borderRadius:8,cursor:`pointer`,border:`1px solid rgba(139, 92, 246, 0.2)`,boxShadow:`0 3px 10px rgba(47, 52, 64, 0.06)`}}),(0,$.jsx)(`button`,{onClick:Xt,style:{position:`absolute`,top:-6,right:-6,width:18,height:18,border:`none`,background:`#A45B5B`,borderRadius:50,cursor:`pointer`,color:`#fff`,fontSize:9,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 2px 4px rgba(164, 91, 91, 0.3)`,zIndex:10},children:(0,$.jsx)(d$,{style:{fontSize:9}})})]}):q?(0,$.jsx)(B7,{accept:`image/*`,multiple:!1,onLocalSelect:e=>{e.length>0&&sn(e[0],`last`)},onHistorySelect:t=>{if(t.length>0){let n=t[0];ce({name:n.fileName||``,type:`image`,url:n.resourceUrl||n.previewUrl||n.displayUrl||``,role:`last_frame`,label:``}),e.success(`成功添加尾帧`)}},onPortraitSelect:t=>{if(t.length>0){let n=t[0],r=n.previewUrl||n.displayUrl||n.videoCoverUrl||n.providerUrl||``;ce({name:n.name||`尾帧图片`,type:`image`,url:r,role:`last_frame`,label:``,source:`private_portrait_asset`,private_asset_id:n.id}),e.success(`成功添加尾帧`)}},uploading:ee,children:(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64,borderRadius:8,border:`1px dashed rgba(139, 92, 246, 0.24)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,transition:`all 0.25s ease`,backgroundColor:`rgba(139, 92, 246, 0.04)`,flexDirection:`column`,gap:4},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#a78bfa`,e.currentTarget.style.backgroundColor=`rgba(139, 92, 246, 0.08)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`rgba(139, 92, 246, 0.24)`,e.currentTarget.style.backgroundColor=`rgba(139, 92, 246, 0.04)`},children:[(0,$.jsx)(rL,{style:{fontSize:18,color:`#8b5cf6`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#8b5cf6`,fontWeight:500},children:`上传尾帧`})]})}):(0,$.jsxs)(`div`,{style:{position:`absolute`,left:10,right:10,bottom:10,height:64,borderRadius:8,border:`1px dashed rgba(226, 232, 240, 0.4)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`not-allowed`,backgroundColor:`rgba(241, 245, 249, 0.5)`,flexDirection:`column`,gap:4},children:[(0,$.jsx)(rL,{style:{fontSize:18,color:`#cbd5e1`}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#94a3b8`,fontWeight:500},children:`请先上传首帧`})]})]})]}):(0,$.jsx)($.Fragment,{children:!(c===`video`&&K===`first_last_frame`)&&(0,$.jsxs)(`div`,{style:{position:`relative`,width:64,height:72,marginTop:`-10`},onMouseEnter:be,onMouseLeave:xe,children:[F.length===0&&(0,$.jsx)(B7,{accept:c===`image`?`image/*`:`image/*,video/*,audio/*`,onLocalSelect:ln,onHistorySelect:pn,onPortraitLibrarySelect:e=>{hn(e)},uploading:ee,tooltipTitle:c===`image`?`图片${F.filter(e=>e.type===`image`).length}/${z}`:`图片${F.filter(e=>e.type===`image`).length}/${z}, 视频${F.filter(e=>e.type===`video`).length}/${B}${Nn>0?`, 音频${F.filter(e=>e.type===`audio`).length}/${Nn}`:``}`,maxImageCount:z,maxVideoCount:B,usedImageCount:F.filter(e=>e.type===`image`).length,usedVideoCount:F.filter(e=>e.type===`video`).length,usedVideoDuration:F.filter(e=>e.type===`video`).reduce((e,t)=>e+(t.duration||0),0),maxVideoDuration:15,maxAudioCount:Nn>0?Nn:void 0,usedAudioCount:F.filter(e=>e.type===`audio`).length,maxAudioDuration:15,usedAudioDuration:F.filter(e=>e.type===`audio`).reduce((e,t)=>e+(t.duration||0),0),hideLimitHint:c===`image`,children:(0,$.jsx)(`div`,{style:{width:54,height:74,borderRadius:7,border:`1px solid rgba(231, 234, 240, 0.95)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,transition:`all 0.25s ease`,background:`#f4f4f4`,flexDirection:`column`,gap:5,transform:`rotate(-7deg)`},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#D7DDE7`,e.currentTarget.style.background=`#f4f4f4`,e.currentTarget.style.transform=`rotate(0deg) translateY(-2px)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`rgba(231, 234, 240, 0.95)`,e.currentTarget.style.background=`#f4f4f4`,e.currentTarget.style.transform=`rotate(-7deg)`},children:ee?(0,$.jsx)(Xm,{style:{fontSize:17,color:`#667085`}}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(rL,{style:{fontSize:18,color:`#667085`,lineHeight:1}}),(0,$.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(2, 14px)`,columnGap:2,justifyContent:`center`,color:`#344054`,fontSize:12,fontWeight:700,lineHeight:1.05,letterSpacing:0},children:[(0,$.jsxs)(`span`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:1},children:[(0,$.jsx)(`span`,{children:`参`}),(0,$.jsx)(`span`,{children:`考`})]}),(0,$.jsxs)(`span`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:1},children:[(0,$.jsx)(`span`,{children:`内`}),(0,$.jsx)(`span`,{children:`容`})]})]})]})})}),F.length>0&&(0,$.jsx)($.Fragment,{children:F.map((e,t)=>{let n=Math.min(F.length,3)-1-t,r=_e?t*58:t<3?t*6:18,i=_e?!0:t<3;return(0,$.jsx)(`div`,{style:{position:`absolute`,left:r,bottom:0,zIndex:t+1,transition:`all 0.28s cubic-bezier(0.4, 0, 0.2, 1)`,transform:_e?`scale(1) rotate(0deg)`:`scale(${t<3?1-n*.08:0}) rotate(${t<3?-3+t*1.5:0}deg)`,opacity:i?_e?1:1-n*.15:0,pointerEvents:i?`auto`:`none`},children:(0,$.jsxs)(`div`,{style:{position:`relative`,width:52,height:60},children:[e.type===`image`?(0,$.jsx)(`img`,{src:_n(e.url),alt:e.name,onClick:()=>{Ue(e.url),Ge(`image`),Je(e.name),Ve(!0)},style:{width:52,height:60,objectFit:`cover`,borderRadius:10,cursor:`pointer`,border:`1px solid rgba(255,255,255,0.98)`,boxShadow:`0 4px 12px rgba(31,41,55,0.15)`}}):e.type===`video`?(0,$.jsx)(`video`,{src:_n(e.url),muted:!0,onClick:()=>{Ue(e.url),Ge(`video`),Je(e.name),Ve(!0)},style:{width:52,height:60,objectFit:`cover`,borderRadius:10,cursor:`pointer`,border:`1px solid rgba(255,255,255,0.98)`,boxShadow:`0 4px 12px rgba(31,41,55,0.15)`}}):(0,$.jsx)(`div`,{onClick:t=>{t.stopPropagation(),tn(e.url)},style:{width:52,height:60,objectFit:`cover`,borderRadius:10,cursor:`pointer`,border:`1px solid rgba(255,255,255,0.98)`,boxShadow:`0 4px 12px rgba(31,41,55,0.15)`,background:`linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:Xe===_n(e.url)?(0,$.jsx)(j6,{style:{fontSize:20,color:`#fff`}}):(0,$.jsx)(j2,{style:{fontSize:20,color:`#fff`}})}),(0,$.jsx)(`button`,{onClick:()=>vn(t),style:{position:`absolute`,top:-6,right:-6,width:20,height:20,borderRadius:50,background:`#1f2937`,border:`none`,color:`#fff`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 2px 6px rgba(0,0,0,0.2)`,zIndex:10,transition:`all 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#dc2626`,e.currentTarget.style.transform=`scale(1.1)`},onMouseLeave:e=>{e.currentTarget.style.background=`#1f2937`,e.currentTarget.style.transform=`scale(1)`},children:(0,$.jsx)(d$,{style:{fontSize:10}})})]})},`stack-${t}`)})}),F.length>0&&(0,$.jsx)(B7,{accept:c===`image`?`image/*`:`image/*,video/*,audio/*`,onLocalSelect:ln,onHistorySelect:pn,onPortraitLibrarySelect:e=>{hn(e)},uploading:ee,tooltipTitle:c===`image`?`图片${F.filter(e=>e.type===`image`).length}/${z}`:`图片${F.filter(e=>e.type===`image`).length}/${z}, 视频${F.filter(e=>e.type===`video`).length}/${B}${Nn>0?`, diff --git a/video-gen-app/dist/index.html b/video-gen-app/dist/index.html index e27100ff..554e3bcd 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/pages/GenerateConver.tsx b/video-gen-app/src/pages/GenerateConver.tsx index 6eba0592..8b5b034f 100644 --- a/video-gen-app/src/pages/GenerateConver.tsx +++ b/video-gen-app/src/pages/GenerateConver.tsx @@ -753,7 +753,7 @@ const AIChatPage: React.FC = () => { }) getgen_list(Pagebreak).then((data: any) => { // API 按创建时间倒序返回;对话区按时间正序展示,最新消息保持在底部。 - const mess_list = [...(data.items || [])].reverse() + const mess_list = data.items const total = data.total setGen_list(mess_list) setTotalnumber(total)