From 33a5cc4f940678087b79caea0637ac0211668049 Mon Sep 17 00:00:00 2001
From: wwwwwwwww <526125649@qq.com>
Date: Thu, 13 Aug 2026 11:54:26 +0800
Subject: [PATCH] 1
---
.../assets/{index-BfoYu7mK.js => index-8FIfOCqA.js} | 4 ++--
video-gen-app/dist/index.html | 2 +-
video-gen-app/src/components/Layout/AppLayout.tsx | 5 ++---
video-gen-app/src/pages/LoginPage.tsx | 11 +++++++++++
4 files changed, 16 insertions(+), 6 deletions(-)
rename video-gen-app/dist/assets/{index-BfoYu7mK.js => index-8FIfOCqA.js} (96%)
diff --git a/video-gen-app/dist/assets/index-BfoYu7mK.js b/video-gen-app/dist/assets/index-8FIfOCqA.js
similarity index 96%
rename from video-gen-app/dist/assets/index-BfoYu7mK.js
rename to video-gen-app/dist/assets/index-8FIfOCqA.js
index 74e635ca..10a70144 100644
--- a/video-gen-app/dist/assets/index-BfoYu7mK.js
+++ b/video-gen-app/dist/assets/index-8FIfOCqA.js
@@ -403,7 +403,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
0% { opacity: 0; transform: translateY(20px) scale(0.96); }
100% { opacity: 1; transform: translateY(0) scale(1); }
}
- `})]})},i7=`dismissed_activity_banner_version`,fse=({onVisibilityChange:e})=>{let[t,n]=(0,S.useState)(``),[r,i]=(0,S.useState)(0),[a,o]=(0,S.useState)(!0);return(0,S.useEffect)(()=>{_5().then(t=>{let r=t.siteBanner||``,a=t.siteBannerVersion||0;if(i(a),r){let t=Number(localStorage.getItem(i7)||0){o(!0),e?.(!1)})},[]),a||!t?null:(0,$.jsx)(`div`,{style:{width:`100%`,position:`relative`,background:`linear-gradient(135deg, #f3e8ff 0%, #ede9fe 50%, #e0e7ff 100%)`,borderBottom:`1px solid rgba(139, 92, 246, 0.15)`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`8px 40px 8px 16px`,maxWidth:1400,margin:`0 auto`,width:`100%`,boxSizing:`border-box`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,$.jsx)(`div`,{style:{width:28,height:28,borderRadius:8,background:`rgba(139, 92, 246, 0.12)`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,$.jsx)(m6,{style:{color:`#7c3aed`,fontSize:14}})}),(0,$.jsx)(`div`,{style:{color:`#5b21b6`,fontSize:14,fontWeight:500,lineHeight:1.5,textAlign:`center`},dangerouslySetInnerHTML:{__html:t}})]}),(0,$.jsx)(`button`,{onClick:()=>{localStorage.setItem(i7,String(r)),o(!0),e?.(!1)},style:{position:`absolute`,right:8,top:`50%`,transform:`translateY(-50%)`,width:26,height:26,borderRadius:`50%`,background:`rgba(139, 92, 246, 0.1)`,border:`none`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,transition:`all 0.2s ease`,outline:`none`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(139, 92, 246, 0.2)`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(139, 92, 246, 0.1)`},children:(0,$.jsx)(ju,{style:{color:`#7c3aed`,fontSize:11}})})]})})},a7=({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,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:{marginBottom:12,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)(C4,{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)(C4,{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`}})})]})]})},o7={HomeOutlined:(0,$.jsx)(b3,{}),DashboardOutlined:(0,$.jsx)(b4,{}),CodeOutlined:(0,$.jsx)(n4,{}),PlayCircleOutlined:(0,$.jsx)(W6,{}),WalletOutlined:(0,$.jsx)(U8,{}),SettingOutlined:(0,$.jsx)(d8,{}),BellOutlined:(0,$.jsx)(b2,{}),UserOutlined:(0,$.jsx)(z8,{}),AppstoreOutlined:(0,$.jsx)(W0,{}),FileTextOutlined:(0,$.jsx)(MV,{}),StarOutlined:(0,$.jsx)(C8,{}),HeartOutlined:(0,$.jsx)(d3,{}),CameraOutlined:(0,$.jsx)(M2,{}),RobotOutlined:(0,$.jsx)(t8,{}),GiftOutlined:(0,$.jsx)(a3,{}),ThunderboltOutlined:(0,$.jsx)(k8,{}),CloudOutlined:(0,$.jsx)(q2,{}),SmileOutlined:(0,$.jsx)(v8,{}),TrophyOutlined:(0,$.jsx)(N8,{}),RocketOutlined:(0,$.jsx)(r8,{}),BulbOutlined:(0,$.jsx)(k2,{}),PictureOutlined:(0,$.jsx)(F6,{}),VideoCameraOutlined:(0,$.jsx)(V8,{}),AudioOutlined:(0,$.jsx)(a2,{}),MailOutlined:(0,$.jsx)(X3,{}),PhoneOutlined:(0,$.jsx)(k6,{}),GlobalOutlined:(0,$.jsx)(c3,{}),TeamOutlined:(0,$.jsx)(D8,{}),BarChartOutlined:(0,$.jsx)(_2,{}),PieChartOutlined:(0,$.jsx)(R6,{}),LineChartOutlined:(0,$.jsx)(R3,{}),SecurityScanOutlined:(0,$.jsx)(xie,{}),ApiOutlined:(0,$.jsx)(V0,{}),DatabaseOutlined:(0,$.jsx)(C4,{}),CloudServerOutlined:(0,$.jsx)(X2,{})},pse=240,s7=[{gradient:`linear-gradient(135deg, #c9a96e, #a67c52)`,shadow:`rgba(201,169,110,0.25)`,icon:(0,$.jsx)(QK,{})},{gradient:`linear-gradient(135deg, #4a5568, #2d3748)`,shadow:`rgba(74,85,104,0.25)`,icon:(0,$.jsx)(R4,{})},{gradient:`linear-gradient(135deg, #718096, #4a5568)`,shadow:`rgba(113,128,150,0.25)`,icon:(0,$.jsx)(m4,{})},{gradient:`linear-gradient(135deg, #5a67d8, #434190)`,shadow:`rgba(90,103,216,0.25)`,icon:(0,$.jsx)(d2,{})}],c7=[{gradient:`linear-gradient(135deg, #f6ad55, #dd6b20)`,shadow:`rgba(246,173,85,0.25)`,icon:(0,$.jsx)(_4,{})},{gradient:`linear-gradient(135deg, #667eea, #5a67d8)`,shadow:`rgba(102,126,234,0.25)`,icon:(0,$.jsx)(_4,{})},{gradient:`linear-gradient(135deg, #94a3b8, #64748b)`,shadow:`rgba(148,163,184,0.25)`,icon:(0,$.jsx)(QK,{})},{gradient:`linear-gradient(135deg, #c9a96e, #a67c52)`,shadow:`rgba(201,169,110,0.25)`,icon:(0,$.jsx)(QK,{})},{gradient:`linear-gradient(135deg, #718096, #4a5568)`,shadow:`rgba(113,128,150,0.25)`,icon:(0,$.jsx)(_4,{})},{gradient:`linear-gradient(135deg, #5a67d8, #434190)`,shadow:`rgba(90,103,216,0.25)`,icon:(0,$.jsx)(d2,{})}],mse=[{key:`points-validity`,label:`积分有效期规则`,children:(0,$.jsxs)(`div`,{style:{color:`#64748b`,lineHeight:1.8,fontSize:13},children:[(0,$.jsx)(`p`,{style:{margin:`0 0 8px`},children:`1、会员积分:月卡与年卡的积分配额均按月发放,自到账起 31 天内有效,到期自动重置(上周期未使用积分清零 + 下发下周期度积分);`}),(0,$.jsx)(`p`,{style:{margin:`0 0 8px`},children:`2、充值通用积分:自到账起 2 年内有效,到期清零,不退不换;`}),(0,$.jsx)(`p`,{style:{margin:`0 0 8px`},children:`3、模型专属积分有效期升级:2026年8月7日(含)起购买,有效期为2年;此前购买,有效期为6个月。有效期自积分到账之日起计算,到期清零,不退不换;`}),(0,$.jsx)(`p`,{style:{margin:0},children:`4、每日登录积分:赠送 20 积分,仅限当日使用,次日自动清零。`})]})},{key:`refund-rules`,label:`会员&积分 退款规则`,children:(0,$.jsx)(`div`,{style:{color:`#64748b`,lineHeight:1.8,fontSize:13},children:(0,$.jsx)(`p`,{style:{margin:0},children:`会员与积分属于虚拟数字商品,开通后权益即时生效,因此一经购买不支持任何理由的退款或转让。建议您在支付前确认所选内容,如遇重复扣款或系统异常,请联系客服,我们会尽快为您处理。感谢理解 💛`})})},{key:`points-return`,label:`积分返还规则`,children:(0,$.jsx)(`div`,{style:{color:`#64748b`,lineHeight:1.8,fontSize:13},children:(0,$.jsx)(`p`,{style:{margin:0},children:`若生成分成失败,被扣的对应积分将在 2 小时内返还至原账户,在「积分明细页」原消耗记录条目中会展示"任务生成失败,积分已返还"提示。因个别原因导致延迟或未返还的情况,可联系平台客服进行处理。`})})},{key:`points-consumption`,label:`积分消耗顺序`,children:(0,$.jsxs)(`div`,{style:{color:`#64748b`,lineHeight:1.8,fontSize:13},children:[(0,$.jsx)(`p`,{style:{margin:`0 0 8px`,color:`#475569`,fontWeight:500},children:`积分消耗顺序规则:分为平台默认顺序、用户自定义顺序。`}),(0,$.jsx)(`p`,{style:{margin:`0 0 8px`},children:`1、平台默认消耗顺序:免费积分 > 模型专享积分 > 订阅会员积分 > 通用充值类积分;`}),(0,$.jsx)(`p`,{style:{margin:`0 0 8px`,paddingLeft:12},children:`其中,免费积分包含 赠送的TV专属积分、赠送的指定模型专享积分、每日登录奖励积分等。若同一类型中的积分包含多个细分子类型,子类型之间的消耗顺序按到期时间,优先消耗早到期的;`}),(0,$.jsx)(`p`,{style:{margin:`0 0 8px`},children:`2、自定义积分消耗顺序:用户可在「个人中心-充值入口」、「模型购买页面」、「积分明细页」自主设置积分的消耗顺序。`}),(0,$.jsx)(`p`,{style:{margin:0,color:`#ef4444`},children:`特别注意:模型赠送的限时免费生成次数,会优先于积分被最先使用。`})]})},{key:`get-more-points`,label:`如何获取更多积分`,children:(0,$.jsxs)(`div`,{style:{color:`#64748b`,lineHeight:1.8,fontSize:13},children:[(0,$.jsx)(`p`,{style:{margin:`0 0 8px`},children:`若当前积分不足,可通过以下方式补充:`}),(0,$.jsx)(`p`,{style:{margin:`0 0 4px`},children:`- 升级会员:购买后立即生效,积分即时到账;`}),(0,$.jsx)(`p`,{style:{margin:`0 0 4px`},children:`- 单独充值通用积分:按需购买,灵活补充;`}),(0,$.jsx)(`p`,{style:{margin:0},children:`- 单独充值模型专享积分:随用随充,性价比高,适用于对特定模型重度使用的用户。`})]})},{key:`installment`,label:`关于分期支付`,children:(0,$.jsx)(`div`,{style:{color:`#64748b`,lineHeight:1.8,fontSize:13},children:(0,$.jsx)(`p`,{style:{margin:0},children:`部分商品支持花呗分期,目前分期产生的利息由平台承担,用户限时享受0利息。使用分期支付的商品不支持退款,如有逾期还款或产生退费,平台将收取相应费用。`})})},{key:`invoice`,label:`发票申请与联系方式`,children:(0,$.jsx)(`div`,{style:{color:`#64748b`,lineHeight:1.8,fontSize:13},children:(0,$.jsx)(`p`,{style:{margin:0},children:`发票可在「订阅与开票」→「购买记录」中自助申请。如需企业合作,请联系 bd@liblib.ai;其他问题欢迎前往"帮助中心"查询。`})})},{key:`price-protection`,label:`会员权益7天保护计划`,children:(0,$.jsxs)(`div`,{style:{color:`#64748b`,lineHeight:1.8,fontSize:13},children:[(0,$.jsx)(`p`,{style:{margin:`0 0 8px`},children:`7天内购买的会员,若遇同档位会员有新活动,且赠品力度更高,可申请按差额补发赠品。`}),(0,$.jsx)(`p`,{style:{margin:`0 0 4px`},children:`1、保护范围:指定模型的免费生成次数、专享积分赠送(会员)。`}),(0,$.jsx)(`p`,{style:{margin:`0 0 4px`},children:`2、保护条件:支付成功 ≤7 天,且会员仍在有效期内,仅限同档位、同周期、同类型赠品。每笔订单针对同一模型赠品,仅限申请 1 次;`}),(0,$.jsx)(`p`,{style:{margin:`0 0 4px`},children:`3、权益有效期:补发的权益与原会员同效期,到期未自动清零,不可退款、转让。`}),(0,$.jsx)(`p`,{style:{margin:`0 0 4px`},children:`4、不参与保护范围:会员订单价格本身(即不退会员差价);已下线/已结束的活动;通过平台赠送、邀请奖励等非现金方式开通的会员;`}),(0,$.jsx)(`p`,{style:{margin:0},children:`5、特别注意:如未在保护有效期内主动领取保护权益,过期将不会补发;Happy Horse 1.0模型不参与保护。`})]})},{key:`free-points`,label:`免积分畅享卡 优惠活动如何执行的?`,children:(0,$.jsxs)(`div`,{style:{color:`#64748b`,lineHeight:1.8,fontSize:13},children:[(0,$.jsx)(`p`,{style:{margin:`0 0 8px`},children:`免积分权益可让您在权益有效期内,使用对应模型生成不消耗积分,同一模型同时最多运行 1 个免积分任务,高峰期生成可能排队,排队时间受到使用人数、高峰时段、模型后台资源情况、用户当日已生成数量等多种因素有关。`}),(0,$.jsx)(`p`,{style:{margin:`0 0 4px`,color:`#475569`,fontWeight:500},children:`具体规则如下:`}),(0,$.jsx)(`p`,{style:{margin:`0 0 4px`},children:`- 独立于订阅周期:免限权益按固定期限计算,与订阅周期无关。无论订阅自动续费、取消还是重新开通,都不会重置或延长该权益的有效期。`}),(0,$.jsx)(`p`,{style:{margin:`0 0 4px`},children:`- 有效期内升级套餐:如果您在免积分权益仍然有效期内升级套餐,将立即解锁更高等级套餐对应的模型能力,并刷新您的有效期。`}),(0,$.jsx)(`p`,{style:{margin:0},children:`- 合理使用与系统保护:免积分权益仅支持真人手动操作,暂不支持 CLI 和其他自动化脚本等生成。为了保障 GPU 集群稳定运行,如检测到自动化脚本、机器人操作或非真人高频使用行为,系统可能会暂时暂停您的权限进行审核。确认是真人创作者后,将恢复访问权限。`})]})}],hse=()=>{let e=Ye(),t=Ke(),{user:n,logout:r,refreshUser:i}=n7(),[a,o]=(0,S.useState)(!1),[s,c]=(0,S.useState)(!1),[l,u]=(0,S.useState)(!1),[d]=xH.useForm(),[f]=xH.useForm(),[p,m]=(0,S.useState)(null),[h,g]=(0,S.useState)([]),[_,v]=(0,S.useState)([]),[y,b]=(0,S.useState)([]),[x,C]=(0,S.useState)(null),w=(0,S.useCallback)(async()=>{try{let e=await use();b((e.subscriptionProducts||[]).filter(e=>e.isActive)),v((e.creditAddons||[]).filter(e=>e.isActive)),C(e.currentSubscription||null)}catch{b([]),v([]),C(null)}},[]),[T,E]=(0,S.useState)(!1),[D,O]=(0,S.useState)(`monthly`),[k,A]=(0,S.useState)(!1),[j,M]=(0,S.useState)(`alipay`),[N,P]=(0,S.useState)(!1),[F,I]=(0,S.useState)(180),L=(0,S.useRef)(null),R=(0,S.useRef)(null),z=(0,S.useRef)(null),[B,V]=(0,S.useState)({alipay:!1,wechat:!1}),[H,U]=(0,S.useState)(null),ee=`pending_payment_order`,[W,te]=(0,S.useState)(0),[G,ne]=(0,S.useState)(!1),[K,re]=(0,S.useState)(!1),[ie]=xH.useForm(),[ae,q]=(0,S.useState)(!1),[oe,se]=(0,S.useState)(()=>({x:24,y:window.innerHeight*.75})),[ce,le]=(0,S.useState)(!1),ue=(0,S.useRef)(!1),de=(0,S.useRef)({x:0,y:0}),[fe,pe]=(0,S.useState)({}),[me,he]=(0,S.useState)(()=>{let e=localStorage.getItem(`siteInfo`),t=e&&JSON.parse(e).siteName||``;return t&&(document.title=t),t}),[ge,_e]=(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}),[ve,ye]=(0,S.useState)(!localStorage.getItem(`siteInfo`)),[be,xe]=(0,S.useState)(!1),[Se,Ce]=(0,S.useState)(null),[we,Te]=(0,S.useState)(!1),[Ee,De]=(0,S.useState)(``);(0,S.useEffect)(()=>{let t=()=>{Z.warning(`您的账号已在其他设备登录,请重新登录`),localStorage.removeItem(`token`),e(`/login`)};return window.addEventListener(`kicked-out`,t),()=>window.removeEventListener(`kicked-out`,t)},[e]),(0,S.useEffect)(()=>{_5().then(e=>{let t=e.siteName||`智创`,n=e.siteLogo||``;if(t!==me&&(he(t),document.title=t),n&&n!==ge){_e(n);let e=document.querySelector(`link[rel="icon"]`);e||(e=document.createElement(`link`),e.rel=`icon`,document.head.appendChild(e));let t=n.startsWith(`http`)||n.startsWith(`data:`)?n:`https://ceshi.apiforeign.minzhongzc.com${n.startsWith(`/`)?``:`/`}${n}`;e.href=t,e.type=`image/png`}e.operationManual&&De(e.operationManual),localStorage.setItem(`siteInfo`,JSON.stringify({siteName:t,siteLogo:n}))}).catch(()=>{}),s5().then(e=>{let t=e?.resourceCapacity;t&&Ce({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(()=>{})},[]),(0,S.useEffect)(()=>{let e=()=>Te(window.innerWidth<=767);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let Oe=e=>{e.button===0&&(le(!0),ue.current=!1,de.current={x:e.clientX,y:e.clientY})},ke=e=>{if(!ce)return;let t=Math.abs(e.clientX-de.current.x),n=Math.abs(e.clientY-de.current.y);(t>5||n>5)&&(ue.current=!0);let r=Math.max(60,Math.min(window.innerHeight-60,e.clientY-(de.current.y-oe.y)));se(e=>({x:e.x,y:r}))},Ae=()=>{let e=ue.current;le(!1),ue.current=!1,e||c(!0)};(0,S.useEffect)(()=>{if(ce)return document.addEventListener(`mousemove`,ke),document.addEventListener(`mouseup`,Ae),()=>{document.removeEventListener(`mousemove`,ke),document.removeEventListener(`mouseup`,Ae)}},[ce]);let je=()=>{b5().then(e=>{te(e)}).catch(()=>{})};(0,S.useEffect)(()=>{Lae().then(e=>{g(e.filter(e=>e.is_active!==!1&&e.isActive!==!1))}).catch(()=>{}),w(),Rae().then(e=>{V(e),e.alipay?M(`alipay`):e.wechat&&M(`wechat`)}).catch(()=>{})},[]),(0,S.useEffect)(()=>{n&&je()},[n?.id,n?.credits]),(0,S.useEffect)(()=>{(async()=>{let e=localStorage.getItem(ee);if(e)try{let t=JSON.parse(e),n=await w5(t.orderNo);if(n.status===`pending`){U({price:t.price,credits:t.credits,qrCode:t.qrCode,method:t.method,title:t.title||`会员服务`}),z.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?(A(!0),We(t.orderNo,a)):localStorage.removeItem(ee)}else n.status===`paid`?(Z.success(`支付成功!积分已到账`),n7.getState().refreshUser(),localStorage.removeItem(ee)):localStorage.removeItem(ee)}catch{localStorage.removeItem(ee)}})()},[]);let Me=t.pathname.startsWith(`/records`)?`/records`:t.pathname,Ne=pse,Pe={};h.forEach(e=>{let t=e.parent_id??e.parentId;t&&(Pe[t]||(Pe[t]=[]),Pe[t].push(e))});let Fe=h.filter(e=>!(e.parent_id??e.parentId));Fe.sort((e,t)=>(typeof e.sortOrder==`number`?e.sortOrder:1/0)-(typeof t.sortOrder==`number`?t.sortOrder:1/0)),Object.keys(Pe).forEach(e=>{Pe[e].sort((e,t)=>(typeof e.sortOrder==`number`?e.sortOrder:1/0)-(typeof t.sortOrder==`number`?t.sortOrder:1/0))});let Ie=t=>{let n=t.menu_type??t.menuType,r=Pe[t.id]&&Pe[t.id].length>0;n===`group`||r?pe(e=>({...e,[t.id]:!e[t.id]})):t.path&&(e(t.path),ne(!1))},Le=[{key:`profile`,icon:(0,$.jsx)(z8,{}),label:`账号: ${n?.username}`,disabled:!0},{key:`credits`,icon:(0,$.jsx)(U8,{style:{color:`#c9a96e`}}),label:`积分: ${n?.credits??0}`,disabled:!0},{type:`divider`},...n?.isTeamManager?[{key:`teamManagement`,icon:(0,$.jsx)(D8,{style:{color:`#6366f1`}}),label:`团队管理`}]:[],{key:`myCredits`,icon:(0,$.jsx)(U8,{}),label:`积分明细`},{key:`orderRecords`,icon:(0,$.jsx)(MV,{}),label:`订单记录`},{key:`invoice`,icon:(0,$.jsx)(X6,{}),label:`申请开票`},{key:`messages`,icon:(0,$.jsx)(b2,{}),label:`消息中心${W>0?`(${W})`:``}`},...Ee?[{key:`manual`,icon:(0,$.jsx)(MV,{}),label:`操作手册`}]:[],{type:`divider`},{key:`changePwd`,icon:(0,$.jsx)(V3,{}),label:`个人信息`},{type:`divider`},{key:`logout`,icon:(0,$.jsx)(q3,{}),label:`退出登录`,danger:!0}],Re=({key:t})=>{t===`logout`?(r(),e(`/login`)):t===`changePwd`?o(!0):t===`messages`?e(`/messages`):t===`recharge`?u(!0):t===`teamManagement`?e(`/team-management`):t===`myCredits`?e(`/user-center?tab=credits`):t===`orderRecords`?e(`/user-center?tab=orders`):t===`invoice`?e(`/invoice`):t===`manual`&&window.open(Ee,`_blank`)},ze=async()=>{try{let e=await d.validateFields();await c5(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)}},Be=async()=>{try{let e=await yae((await f.validateFields()).username);Z.success(e.message||`操作成功`),await i(),s5().then(e=>{let t=e?.resourceCapacity;t&&Ce({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)}},Ve=()=>{r(),e(`/login`)},He=(0,S.useCallback)(()=>{L.current&&=(clearInterval(L.current),null),R.current&&=(clearInterval(R.current),null)},[]),Ue=(0,S.useCallback)(async(e,t)=>{if(!B.alipay&&!B.wechat){Z.error(`暂无可用支付方式`);return}P(!0);try{let n=await zae(e,j),r=n.qrUrl||n.codeUrl||n.qr_code||n.code_url,i=Number(n.amount??t.currentPrice??t.price??0),a=Number(t.grantCredits||t.monthlyGrantCredits||0),o=t.regularPrice??t.originalPrice,s={monthly:`月套餐`,quarterly:`季套餐`,yearly:`年套餐`},c=!!t.billingCycle,l=t.billingCycle?s[t.billingCycle]:``,u=t.name||`积分充值`,d=c?`${u} ${l}`:u,f={price:i,credits:a,qrCode:r,method:n.paymentMethod,title:d,originalPrice:o?Number(o):void 0,discountAmount:o?Number(o)-i:void 0,tierName:u,periodLabel:l,isSubscription:c};(n.paymentMethod===`alipay`||n.paymentMethod===`wechat`)&&r?(U(f),E(!1),A(!0),z.current=n.orderNo,localStorage.setItem(ee,JSON.stringify({orderNo:n.orderNo,...f,createdAt:n.createdAt||new Date().toISOString(),timeoutSeconds:180})),We(n.orderNo)):(Z.success(`购买成功,积分已到账`),await n7.getState().refreshUser(),await w(),m(null))}catch(e){Z.error(e?.message||`创建订单失败`)}finally{P(!1)}},[j,B]),We=(0,S.useCallback)((e,t=180)=>{He(),I(t),L.current=setInterval(async()=>{try{let t=await w5(e);t.status===`paid`?(He(),z.current=null,localStorage.removeItem(ee),Z.success(`支付成功!积分已到账`),n7.getState().refreshUser(),w(),A(!1),U(null),m(null)):t.status===`cancelled`&&(He(),z.current=null,localStorage.removeItem(ee))}catch{}},2e3),R.current=setInterval(()=>{I(e=>e<=1?(He(),z.current&&=(T5(z.current).catch(()=>{}),null),localStorage.removeItem(ee),Z.warning(`订单已超时,请重新充值`),A(!1),U(null),m(null),0):e-1)},1e3)},[w,He]),Ge=async()=>{if(!n){Z.warning(`请先登录`);return}try{let e=await ie.validateFields();q(!0),await Aoe({phone:e.phone,company_name:e.companyName,industry:e.industry,name:e.name,message:e.message}),Z.success(`提交成功,我们会尽快与您联系`),c(!1),ie.resetFields()}catch(e){Z.error(e?.message||`提交失败`)}finally{q(!1)}},qe=(t,n=0)=>{let r=t.path===Me,i=o7[t.icon]||(0,$.jsx)(b3,{}),a=Pe[t.id]&&Pe[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:(Pe[t.id]||[]).map(e=>qe(e,n+1))})]},t.id)};return(0,$.jsxs)(dW,{style:{height:`100vh`,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,$.jsx)(fse,{onVisibilityChange:e=>xe(e)}),(0,$.jsxs)(`div`,{style:{display:`flex`,position:`relative`,padding:4,gap:12,flex:1,minHeight:0,overflow:`hidden`},children:[(0,$.jsxs)(`div`,{className:`desktop-sidebar`,style:{width:Ne,position:`sticky`,top:4,alignSelf:`flex-start`,zIndex:100,height:`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`,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:ge?(0,$.jsx)(`img`,{src:ge,alt:`logo`,style:{width:36,height:36,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:me})]})}),(0,$.jsx)(`div`,{style:{flex:1,padding:`8px 8px`,overflow:`auto`},children:Fe.map(e=>qe(e))}),(0,$.jsxs)(`div`,{onClick:()=>u(!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)(PI,{style:{fontSize:16}}),(0,$.jsx)(`span`,{children:`充值积分`})]}),(0,$.jsx)(a7,{data:Se}),(0,$.jsx)(`div`,{style:{padding:`16px 16px`,flexShrink:0,paddingTop:0},children:(0,$.jsx)(kV,{menu:{items:Le,onClick:Re},placement:`topRight`,arrow:!0,children:(0,$.jsxs)(`div`,{className:`user-card-container`,style:{padding:`10px 14px`,display:`flex`,alignItems:`center`,justifyContent:`flex-start`,gap:12,borderRadius:14,cursor:`pointer`,transition:`all 0.35s cubic-bezier(0.4,0,0.2,1)`,background:`linear-gradient(135deg, rgba(248, 250, 252, 0.95) 0%, rgba(241, 245, 249, 0.95) 100%)`,boxShadow:`0 2px 12px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255,255,255,0.8)`,position:`relative`,border:`1px solid rgba(99, 102, 241, 0.15)`,animation:`cardBreath 3s ease-in-out infinite`},onMouseEnter:e=>{e.currentTarget.style.background=`linear-gradient(135deg, #ffffff 0%, #f8fafc 100%)`,e.currentTarget.style.boxShadow=`0 8px 24px rgba(99, 102, 241, 0.25), inset 0 1px 0 rgba(255,255,255,0.9)`,e.currentTarget.style.transform=`translateY(-3px) scale(1.01)`,e.currentTarget.style.borderColor=`rgba(99, 102, 241, 0.4)`,e.currentTarget.style.animation=`none`,e.currentTarget.querySelector(`.user-card-arrow`)?.classList.add(`arrow-hover`)},onMouseLeave:e=>{e.currentTarget.style.background=`linear-gradient(135deg, rgba(248, 250, 252, 0.95) 0%, rgba(241, 245, 249, 0.95) 100%)`,e.currentTarget.style.boxShadow=`0 2px 12px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255,255,255,0.8)`,e.currentTarget.style.transform=`translateY(0) scale(1)`,e.currentTarget.style.borderColor=`rgba(99, 102, 241, 0.15)`,e.currentTarget.style.animation=`cardBreath 3s ease-in-out infinite`,e.currentTarget.querySelector(`.user-card-arrow`)?.classList.remove(`arrow-hover`)},children:[(0,$.jsx)(`div`,{className:`user-card-glow`,style:{position:`absolute`,inset:-4,borderRadius:18,background:`linear-gradient(90deg, transparent 0%, rgba(99,102,241,0.15) 25%, rgba(139,92,246,0.15) 50%, rgba(99,102,241,0.15) 75%, transparent 100%)`,backgroundSize:`200% 100%`,opacity:.8,animation:`borderShimmer 2.5s linear infinite`,pointerEvents:`none`}}),(0,$.jsx)(Bw,{size:36,icon:(0,$.jsx)(z8,{}),style:{background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,flexShrink:0,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.3)`,transition:`all 0.35s cubic-bezier(0.4,0,0.2,1)`,position:`relative`,zIndex:1,animation:`avatarPulse 2s ease-in-out infinite`}}),(0,$.jsxs)(`div`,{style:{flex:1,minWidth:0,position:`relative`,zIndex:1},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:14,fontWeight:500,letterSpacing:0,borderRadius:6,display:`inline-block`,animation:`creditGlow 1.5s ease-in-out infinite`},children:[`积分: `,n?.credits||0]})]}),(0,$.jsx)(`div`,{className:`user-card-arrow`,style:{fontSize:12,color:`#6366f1`,flexShrink:0,position:`relative`,zIndex:1},children:(0,$.jsx)(n6,{})}),(0,$.jsx)(`style`,{children:`
+ `})]})},i7=`dismissed_activity_banner_version`,fse=({onVisibilityChange:e})=>{let[t,n]=(0,S.useState)(``),[r,i]=(0,S.useState)(0),[a,o]=(0,S.useState)(!0);return(0,S.useEffect)(()=>{_5().then(t=>{let r=t.siteBanner||``,a=t.siteBannerVersion||0;if(i(a),r){let t=Number(localStorage.getItem(i7)||0){o(!0),e?.(!1)})},[]),a||!t?null:(0,$.jsx)(`div`,{style:{width:`100%`,position:`relative`,background:`linear-gradient(135deg, #f3e8ff 0%, #ede9fe 50%, #e0e7ff 100%)`,borderBottom:`1px solid rgba(139, 92, 246, 0.15)`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`8px 40px 8px 16px`,maxWidth:1400,margin:`0 auto`,width:`100%`,boxSizing:`border-box`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,$.jsx)(`div`,{style:{width:28,height:28,borderRadius:8,background:`rgba(139, 92, 246, 0.12)`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,$.jsx)(m6,{style:{color:`#7c3aed`,fontSize:14}})}),(0,$.jsx)(`div`,{style:{color:`#5b21b6`,fontSize:14,fontWeight:500,lineHeight:1.5,textAlign:`center`},dangerouslySetInnerHTML:{__html:t}})]}),(0,$.jsx)(`button`,{onClick:()=>{localStorage.setItem(i7,String(r)),o(!0),e?.(!1)},style:{position:`absolute`,right:8,top:`50%`,transform:`translateY(-50%)`,width:26,height:26,borderRadius:`50%`,background:`rgba(139, 92, 246, 0.1)`,border:`none`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,transition:`all 0.2s ease`,outline:`none`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(139, 92, 246, 0.2)`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(139, 92, 246, 0.1)`},children:(0,$.jsx)(ju,{style:{color:`#7c3aed`,fontSize:11}})})]})})},a7=({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,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:{marginBottom:12,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)(C4,{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)(C4,{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`}})})]})]})},o7={HomeOutlined:(0,$.jsx)(b3,{}),DashboardOutlined:(0,$.jsx)(b4,{}),CodeOutlined:(0,$.jsx)(n4,{}),PlayCircleOutlined:(0,$.jsx)(W6,{}),WalletOutlined:(0,$.jsx)(U8,{}),SettingOutlined:(0,$.jsx)(d8,{}),BellOutlined:(0,$.jsx)(b2,{}),UserOutlined:(0,$.jsx)(z8,{}),AppstoreOutlined:(0,$.jsx)(W0,{}),FileTextOutlined:(0,$.jsx)(MV,{}),StarOutlined:(0,$.jsx)(C8,{}),HeartOutlined:(0,$.jsx)(d3,{}),CameraOutlined:(0,$.jsx)(M2,{}),RobotOutlined:(0,$.jsx)(t8,{}),GiftOutlined:(0,$.jsx)(a3,{}),ThunderboltOutlined:(0,$.jsx)(k8,{}),CloudOutlined:(0,$.jsx)(q2,{}),SmileOutlined:(0,$.jsx)(v8,{}),TrophyOutlined:(0,$.jsx)(N8,{}),RocketOutlined:(0,$.jsx)(r8,{}),BulbOutlined:(0,$.jsx)(k2,{}),PictureOutlined:(0,$.jsx)(F6,{}),VideoCameraOutlined:(0,$.jsx)(V8,{}),AudioOutlined:(0,$.jsx)(a2,{}),MailOutlined:(0,$.jsx)(X3,{}),PhoneOutlined:(0,$.jsx)(k6,{}),GlobalOutlined:(0,$.jsx)(c3,{}),TeamOutlined:(0,$.jsx)(D8,{}),BarChartOutlined:(0,$.jsx)(_2,{}),PieChartOutlined:(0,$.jsx)(R6,{}),LineChartOutlined:(0,$.jsx)(R3,{}),SecurityScanOutlined:(0,$.jsx)(xie,{}),ApiOutlined:(0,$.jsx)(V0,{}),DatabaseOutlined:(0,$.jsx)(C4,{}),CloudServerOutlined:(0,$.jsx)(X2,{})},pse=240,s7=[{gradient:`linear-gradient(135deg, #c9a96e, #a67c52)`,shadow:`rgba(201,169,110,0.25)`,icon:(0,$.jsx)(QK,{})},{gradient:`linear-gradient(135deg, #4a5568, #2d3748)`,shadow:`rgba(74,85,104,0.25)`,icon:(0,$.jsx)(R4,{})},{gradient:`linear-gradient(135deg, #718096, #4a5568)`,shadow:`rgba(113,128,150,0.25)`,icon:(0,$.jsx)(m4,{})},{gradient:`linear-gradient(135deg, #5a67d8, #434190)`,shadow:`rgba(90,103,216,0.25)`,icon:(0,$.jsx)(d2,{})}],c7=[{gradient:`linear-gradient(135deg, #f6ad55, #dd6b20)`,shadow:`rgba(246,173,85,0.25)`,icon:(0,$.jsx)(_4,{})},{gradient:`linear-gradient(135deg, #667eea, #5a67d8)`,shadow:`rgba(102,126,234,0.25)`,icon:(0,$.jsx)(_4,{})},{gradient:`linear-gradient(135deg, #94a3b8, #64748b)`,shadow:`rgba(148,163,184,0.25)`,icon:(0,$.jsx)(QK,{})},{gradient:`linear-gradient(135deg, #c9a96e, #a67c52)`,shadow:`rgba(201,169,110,0.25)`,icon:(0,$.jsx)(QK,{})},{gradient:`linear-gradient(135deg, #718096, #4a5568)`,shadow:`rgba(113,128,150,0.25)`,icon:(0,$.jsx)(_4,{})},{gradient:`linear-gradient(135deg, #5a67d8, #434190)`,shadow:`rgba(90,103,216,0.25)`,icon:(0,$.jsx)(d2,{})}],mse=[{key:`points-validity`,label:`积分有效期规则`,children:(0,$.jsxs)(`div`,{style:{color:`#64748b`,lineHeight:1.8,fontSize:13},children:[(0,$.jsx)(`p`,{style:{margin:`0 0 8px`},children:`1、会员积分:月卡与年卡的积分配额均按月发放,自到账起 31 天内有效,到期自动重置(上周期未使用积分清零 + 下发下周期度积分);`}),(0,$.jsx)(`p`,{style:{margin:`0 0 8px`},children:`2、充值通用积分:自到账起 2 年内有效,到期清零,不退不换;`}),(0,$.jsx)(`p`,{style:{margin:`0 0 8px`},children:`3、模型专属积分有效期升级:2026年8月7日(含)起购买,有效期为2年;此前购买,有效期为6个月。有效期自积分到账之日起计算,到期清零,不退不换;`}),(0,$.jsx)(`p`,{style:{margin:0},children:`4、每日登录积分:赠送 20 积分,仅限当日使用,次日自动清零。`})]})},{key:`refund-rules`,label:`会员&积分 退款规则`,children:(0,$.jsx)(`div`,{style:{color:`#64748b`,lineHeight:1.8,fontSize:13},children:(0,$.jsx)(`p`,{style:{margin:0},children:`会员与积分属于虚拟数字商品,开通后权益即时生效,因此一经购买不支持任何理由的退款或转让。建议您在支付前确认所选内容,如遇重复扣款或系统异常,请联系客服,我们会尽快为您处理。感谢理解 💛`})})},{key:`points-return`,label:`积分返还规则`,children:(0,$.jsx)(`div`,{style:{color:`#64748b`,lineHeight:1.8,fontSize:13},children:(0,$.jsx)(`p`,{style:{margin:0},children:`若生成分成失败,被扣的对应积分将在 2 小时内返还至原账户,在「积分明细页」原消耗记录条目中会展示"任务生成失败,积分已返还"提示。因个别原因导致延迟或未返还的情况,可联系平台客服进行处理。`})})},{key:`points-consumption`,label:`积分消耗顺序`,children:(0,$.jsxs)(`div`,{style:{color:`#64748b`,lineHeight:1.8,fontSize:13},children:[(0,$.jsx)(`p`,{style:{margin:`0 0 8px`,color:`#475569`,fontWeight:500},children:`积分消耗顺序规则:分为平台默认顺序、用户自定义顺序。`}),(0,$.jsx)(`p`,{style:{margin:`0 0 8px`},children:`1、平台默认消耗顺序:免费积分 > 模型专享积分 > 订阅会员积分 > 通用充值类积分;`}),(0,$.jsx)(`p`,{style:{margin:`0 0 8px`,paddingLeft:12},children:`其中,免费积分包含 赠送的TV专属积分、赠送的指定模型专享积分、每日登录奖励积分等。若同一类型中的积分包含多个细分子类型,子类型之间的消耗顺序按到期时间,优先消耗早到期的;`}),(0,$.jsx)(`p`,{style:{margin:`0 0 8px`},children:`2、自定义积分消耗顺序:用户可在「个人中心-充值入口」、「模型购买页面」、「积分明细页」自主设置积分的消耗顺序。`}),(0,$.jsx)(`p`,{style:{margin:0,color:`#ef4444`},children:`特别注意:模型赠送的限时免费生成次数,会优先于积分被最先使用。`})]})},{key:`get-more-points`,label:`如何获取更多积分`,children:(0,$.jsxs)(`div`,{style:{color:`#64748b`,lineHeight:1.8,fontSize:13},children:[(0,$.jsx)(`p`,{style:{margin:`0 0 8px`},children:`若当前积分不足,可通过以下方式补充:`}),(0,$.jsx)(`p`,{style:{margin:`0 0 4px`},children:`- 升级会员:购买后立即生效,积分即时到账;`}),(0,$.jsx)(`p`,{style:{margin:`0 0 4px`},children:`- 单独充值通用积分:按需购买,灵活补充;`}),(0,$.jsx)(`p`,{style:{margin:0},children:`- 单独充值模型专享积分:随用随充,性价比高,适用于对特定模型重度使用的用户。`})]})},{key:`installment`,label:`关于分期支付`,children:(0,$.jsx)(`div`,{style:{color:`#64748b`,lineHeight:1.8,fontSize:13},children:(0,$.jsx)(`p`,{style:{margin:0},children:`部分商品支持花呗分期,目前分期产生的利息由平台承担,用户限时享受0利息。使用分期支付的商品不支持退款,如有逾期还款或产生退费,平台将收取相应费用。`})})},{key:`invoice`,label:`发票申请与联系方式`,children:(0,$.jsx)(`div`,{style:{color:`#64748b`,lineHeight:1.8,fontSize:13},children:(0,$.jsx)(`p`,{style:{margin:0},children:`发票可在「订阅与开票」→「购买记录」中自助申请。如需企业合作,请联系 bd@liblib.ai;其他问题欢迎前往"帮助中心"查询。`})})},{key:`price-protection`,label:`会员权益7天保护计划`,children:(0,$.jsxs)(`div`,{style:{color:`#64748b`,lineHeight:1.8,fontSize:13},children:[(0,$.jsx)(`p`,{style:{margin:`0 0 8px`},children:`7天内购买的会员,若遇同档位会员有新活动,且赠品力度更高,可申请按差额补发赠品。`}),(0,$.jsx)(`p`,{style:{margin:`0 0 4px`},children:`1、保护范围:指定模型的免费生成次数、专享积分赠送(会员)。`}),(0,$.jsx)(`p`,{style:{margin:`0 0 4px`},children:`2、保护条件:支付成功 ≤7 天,且会员仍在有效期内,仅限同档位、同周期、同类型赠品。每笔订单针对同一模型赠品,仅限申请 1 次;`}),(0,$.jsx)(`p`,{style:{margin:`0 0 4px`},children:`3、权益有效期:补发的权益与原会员同效期,到期未自动清零,不可退款、转让。`}),(0,$.jsx)(`p`,{style:{margin:`0 0 4px`},children:`4、不参与保护范围:会员订单价格本身(即不退会员差价);已下线/已结束的活动;通过平台赠送、邀请奖励等非现金方式开通的会员;`}),(0,$.jsx)(`p`,{style:{margin:0},children:`5、特别注意:如未在保护有效期内主动领取保护权益,过期将不会补发;Happy Horse 1.0模型不参与保护。`})]})},{key:`free-points`,label:`免积分畅享卡 优惠活动如何执行的?`,children:(0,$.jsxs)(`div`,{style:{color:`#64748b`,lineHeight:1.8,fontSize:13},children:[(0,$.jsx)(`p`,{style:{margin:`0 0 8px`},children:`免积分权益可让您在权益有效期内,使用对应模型生成不消耗积分,同一模型同时最多运行 1 个免积分任务,高峰期生成可能排队,排队时间受到使用人数、高峰时段、模型后台资源情况、用户当日已生成数量等多种因素有关。`}),(0,$.jsx)(`p`,{style:{margin:`0 0 4px`,color:`#475569`,fontWeight:500},children:`具体规则如下:`}),(0,$.jsx)(`p`,{style:{margin:`0 0 4px`},children:`- 独立于订阅周期:免限权益按固定期限计算,与订阅周期无关。无论订阅自动续费、取消还是重新开通,都不会重置或延长该权益的有效期。`}),(0,$.jsx)(`p`,{style:{margin:`0 0 4px`},children:`- 有效期内升级套餐:如果您在免积分权益仍然有效期内升级套餐,将立即解锁更高等级套餐对应的模型能力,并刷新您的有效期。`}),(0,$.jsx)(`p`,{style:{margin:0},children:`- 合理使用与系统保护:免积分权益仅支持真人手动操作,暂不支持 CLI 和其他自动化脚本等生成。为了保障 GPU 集群稳定运行,如检测到自动化脚本、机器人操作或非真人高频使用行为,系统可能会暂时暂停您的权限进行审核。确认是真人创作者后,将恢复访问权限。`})]})}],hse=()=>{let e=Ye(),t=Ke(),{user:n,logout:r,refreshUser:i}=n7(),[a,o]=(0,S.useState)(!1),[s,c]=(0,S.useState)(!1),[l,u]=(0,S.useState)(!1),[d]=xH.useForm(),[f]=xH.useForm(),[p,m]=(0,S.useState)(null),[h,g]=(0,S.useState)([]),[_,v]=(0,S.useState)([]),[y,b]=(0,S.useState)([]),[x,C]=(0,S.useState)(null),w=(0,S.useCallback)(async()=>{try{let e=await use();b((e.subscriptionProducts||[]).filter(e=>e.isActive)),v((e.creditAddons||[]).filter(e=>e.isActive)),C(e.currentSubscription||null)}catch{b([]),v([]),C(null)}},[]),[T,E]=(0,S.useState)(!1),[D,O]=(0,S.useState)(`monthly`),[k,A]=(0,S.useState)(!1),[j,M]=(0,S.useState)(`alipay`),[N,P]=(0,S.useState)(!1),[F,I]=(0,S.useState)(180),L=(0,S.useRef)(null),R=(0,S.useRef)(null),z=(0,S.useRef)(null),[B,V]=(0,S.useState)({alipay:!1,wechat:!1}),[H,U]=(0,S.useState)(null),ee=`pending_payment_order`,[W,te]=(0,S.useState)(0),[G,ne]=(0,S.useState)(!1),[K,re]=(0,S.useState)(!1),[ie]=xH.useForm(),[ae,q]=(0,S.useState)(!1),[oe,se]=(0,S.useState)(()=>({x:24,y:window.innerHeight*.75})),[ce,le]=(0,S.useState)(!1),ue=(0,S.useRef)(!1),de=(0,S.useRef)({x:0,y:0}),[fe,pe]=(0,S.useState)({}),[me,he]=(0,S.useState)(()=>{let e=localStorage.getItem(`siteInfo`),t=e&&JSON.parse(e).siteName||``;return t&&(document.title=t),t}),[ge,_e]=(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}),[ve,ye]=(0,S.useState)(!localStorage.getItem(`siteInfo`)),[be,xe]=(0,S.useState)(!1),[Se,Ce]=(0,S.useState)(null),[we,Te]=(0,S.useState)(!1),[Ee,De]=(0,S.useState)(``);(0,S.useEffect)(()=>{let t=()=>{localStorage.removeItem(`token`),e(`/login?kicked_out=1`)};return window.addEventListener(`kicked-out`,t),()=>window.removeEventListener(`kicked-out`,t)},[e]),(0,S.useEffect)(()=>{_5().then(e=>{let t=e.siteName||`智创`,n=e.siteLogo||``;if(t!==me&&(he(t),document.title=t),n&&n!==ge){_e(n);let e=document.querySelector(`link[rel="icon"]`);e||(e=document.createElement(`link`),e.rel=`icon`,document.head.appendChild(e));let t=n.startsWith(`http`)||n.startsWith(`data:`)?n:`https://ceshi.apiforeign.minzhongzc.com${n.startsWith(`/`)?``:`/`}${n}`;e.href=t,e.type=`image/png`}e.operationManual&&De(e.operationManual),localStorage.setItem(`siteInfo`,JSON.stringify({siteName:t,siteLogo:n}))}).catch(()=>{}),s5().then(e=>{let t=e?.resourceCapacity;t&&Ce({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(()=>{})},[]),(0,S.useEffect)(()=>{let e=()=>Te(window.innerWidth<=767);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let Oe=e=>{e.button===0&&(le(!0),ue.current=!1,de.current={x:e.clientX,y:e.clientY})},ke=e=>{if(!ce)return;let t=Math.abs(e.clientX-de.current.x),n=Math.abs(e.clientY-de.current.y);(t>5||n>5)&&(ue.current=!0);let r=Math.max(60,Math.min(window.innerHeight-60,e.clientY-(de.current.y-oe.y)));se(e=>({x:e.x,y:r}))},Ae=()=>{let e=ue.current;le(!1),ue.current=!1,e||c(!0)};(0,S.useEffect)(()=>{if(ce)return document.addEventListener(`mousemove`,ke),document.addEventListener(`mouseup`,Ae),()=>{document.removeEventListener(`mousemove`,ke),document.removeEventListener(`mouseup`,Ae)}},[ce]);let je=()=>{b5().then(e=>{te(e)}).catch(()=>{})};(0,S.useEffect)(()=>{Lae().then(e=>{g(e.filter(e=>e.is_active!==!1&&e.isActive!==!1))}).catch(()=>{}),w(),Rae().then(e=>{V(e),e.alipay?M(`alipay`):e.wechat&&M(`wechat`)}).catch(()=>{})},[]),(0,S.useEffect)(()=>{n&&je()},[n?.id,n?.credits]),(0,S.useEffect)(()=>{(async()=>{let e=localStorage.getItem(ee);if(e)try{let t=JSON.parse(e),n=await w5(t.orderNo);if(n.status===`pending`){U({price:t.price,credits:t.credits,qrCode:t.qrCode,method:t.method,title:t.title||`会员服务`}),z.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?(A(!0),We(t.orderNo,a)):localStorage.removeItem(ee)}else n.status===`paid`?(Z.success(`支付成功!积分已到账`),n7.getState().refreshUser(),localStorage.removeItem(ee)):localStorage.removeItem(ee)}catch{localStorage.removeItem(ee)}})()},[]);let Me=t.pathname.startsWith(`/records`)?`/records`:t.pathname,Ne=pse,Pe={};h.forEach(e=>{let t=e.parent_id??e.parentId;t&&(Pe[t]||(Pe[t]=[]),Pe[t].push(e))});let Fe=h.filter(e=>!(e.parent_id??e.parentId));Fe.sort((e,t)=>(typeof e.sortOrder==`number`?e.sortOrder:1/0)-(typeof t.sortOrder==`number`?t.sortOrder:1/0)),Object.keys(Pe).forEach(e=>{Pe[e].sort((e,t)=>(typeof e.sortOrder==`number`?e.sortOrder:1/0)-(typeof t.sortOrder==`number`?t.sortOrder:1/0))});let Ie=t=>{let n=t.menu_type??t.menuType,r=Pe[t.id]&&Pe[t.id].length>0;n===`group`||r?pe(e=>({...e,[t.id]:!e[t.id]})):t.path&&(e(t.path),ne(!1))},Le=[{key:`profile`,icon:(0,$.jsx)(z8,{}),label:`账号: ${n?.username}`,disabled:!0},{key:`credits`,icon:(0,$.jsx)(U8,{style:{color:`#c9a96e`}}),label:`积分: ${n?.credits??0}`,disabled:!0},{type:`divider`},...n?.isTeamManager?[{key:`teamManagement`,icon:(0,$.jsx)(D8,{style:{color:`#6366f1`}}),label:`团队管理`}]:[],{key:`myCredits`,icon:(0,$.jsx)(U8,{}),label:`积分明细`},{key:`orderRecords`,icon:(0,$.jsx)(MV,{}),label:`订单记录`},{key:`invoice`,icon:(0,$.jsx)(X6,{}),label:`申请开票`},{key:`messages`,icon:(0,$.jsx)(b2,{}),label:`消息中心${W>0?`(${W})`:``}`},...Ee?[{key:`manual`,icon:(0,$.jsx)(MV,{}),label:`操作手册`}]:[],{type:`divider`},{key:`changePwd`,icon:(0,$.jsx)(V3,{}),label:`个人信息`},{type:`divider`},{key:`logout`,icon:(0,$.jsx)(q3,{}),label:`退出登录`,danger:!0}],Re=({key:t})=>{t===`logout`?(r(),e(`/login`)):t===`changePwd`?o(!0):t===`messages`?e(`/messages`):t===`recharge`?u(!0):t===`teamManagement`?e(`/team-management`):t===`myCredits`?e(`/user-center?tab=credits`):t===`orderRecords`?e(`/user-center?tab=orders`):t===`invoice`?e(`/invoice`):t===`manual`&&window.open(Ee,`_blank`)},ze=async()=>{try{let e=await d.validateFields();await c5(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)}},Be=async()=>{try{let e=await yae((await f.validateFields()).username);Z.success(e.message||`操作成功`),await i(),s5().then(e=>{let t=e?.resourceCapacity;t&&Ce({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)}},Ve=()=>{r(),e(`/login`)},He=(0,S.useCallback)(()=>{L.current&&=(clearInterval(L.current),null),R.current&&=(clearInterval(R.current),null)},[]),Ue=(0,S.useCallback)(async(e,t)=>{if(!B.alipay&&!B.wechat){Z.error(`暂无可用支付方式`);return}P(!0);try{let n=await zae(e,j),r=n.qrUrl||n.codeUrl||n.qr_code||n.code_url,i=Number(n.amount??t.currentPrice??t.price??0),a=Number(t.grantCredits||t.monthlyGrantCredits||0),o=t.regularPrice??t.originalPrice,s={monthly:`月套餐`,quarterly:`季套餐`,yearly:`年套餐`},c=!!t.billingCycle,l=t.billingCycle?s[t.billingCycle]:``,u=t.name||`积分充值`,d=c?`${u} ${l}`:u,f={price:i,credits:a,qrCode:r,method:n.paymentMethod,title:d,originalPrice:o?Number(o):void 0,discountAmount:o?Number(o)-i:void 0,tierName:u,periodLabel:l,isSubscription:c};(n.paymentMethod===`alipay`||n.paymentMethod===`wechat`)&&r?(U(f),E(!1),A(!0),z.current=n.orderNo,localStorage.setItem(ee,JSON.stringify({orderNo:n.orderNo,...f,createdAt:n.createdAt||new Date().toISOString(),timeoutSeconds:180})),We(n.orderNo)):(Z.success(`购买成功,积分已到账`),await n7.getState().refreshUser(),await w(),m(null))}catch(e){Z.error(e?.message||`创建订单失败`)}finally{P(!1)}},[j,B]),We=(0,S.useCallback)((e,t=180)=>{He(),I(t),L.current=setInterval(async()=>{try{let t=await w5(e);t.status===`paid`?(He(),z.current=null,localStorage.removeItem(ee),Z.success(`支付成功!积分已到账`),n7.getState().refreshUser(),w(),A(!1),U(null),m(null)):t.status===`cancelled`&&(He(),z.current=null,localStorage.removeItem(ee))}catch{}},2e3),R.current=setInterval(()=>{I(e=>e<=1?(He(),z.current&&=(T5(z.current).catch(()=>{}),null),localStorage.removeItem(ee),Z.warning(`订单已超时,请重新充值`),A(!1),U(null),m(null),0):e-1)},1e3)},[w,He]),Ge=async()=>{if(!n){Z.warning(`请先登录`);return}try{let e=await ie.validateFields();q(!0),await Aoe({phone:e.phone,company_name:e.companyName,industry:e.industry,name:e.name,message:e.message}),Z.success(`提交成功,我们会尽快与您联系`),c(!1),ie.resetFields()}catch(e){Z.error(e?.message||`提交失败`)}finally{q(!1)}},qe=(t,n=0)=>{let r=t.path===Me,i=o7[t.icon]||(0,$.jsx)(b3,{}),a=Pe[t.id]&&Pe[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:(Pe[t.id]||[]).map(e=>qe(e,n+1))})]},t.id)};return(0,$.jsxs)(dW,{style:{height:`100vh`,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,$.jsx)(fse,{onVisibilityChange:e=>xe(e)}),(0,$.jsxs)(`div`,{style:{display:`flex`,position:`relative`,padding:4,gap:12,flex:1,minHeight:0,overflow:`hidden`},children:[(0,$.jsxs)(`div`,{className:`desktop-sidebar`,style:{width:Ne,position:`sticky`,top:4,alignSelf:`flex-start`,zIndex:100,height:`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`,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:ge?(0,$.jsx)(`img`,{src:ge,alt:`logo`,style:{width:36,height:36,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:me})]})}),(0,$.jsx)(`div`,{style:{flex:1,padding:`8px 8px`,overflow:`auto`},children:Fe.map(e=>qe(e))}),(0,$.jsxs)(`div`,{onClick:()=>u(!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)(PI,{style:{fontSize:16}}),(0,$.jsx)(`span`,{children:`充值积分`})]}),(0,$.jsx)(a7,{data:Se}),(0,$.jsx)(`div`,{style:{padding:`16px 16px`,flexShrink:0,paddingTop:0},children:(0,$.jsx)(kV,{menu:{items:Le,onClick:Re},placement:`topRight`,arrow:!0,children:(0,$.jsxs)(`div`,{className:`user-card-container`,style:{padding:`10px 14px`,display:`flex`,alignItems:`center`,justifyContent:`flex-start`,gap:12,borderRadius:14,cursor:`pointer`,transition:`all 0.35s cubic-bezier(0.4,0,0.2,1)`,background:`linear-gradient(135deg, rgba(248, 250, 252, 0.95) 0%, rgba(241, 245, 249, 0.95) 100%)`,boxShadow:`0 2px 12px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255,255,255,0.8)`,position:`relative`,border:`1px solid rgba(99, 102, 241, 0.15)`,animation:`cardBreath 3s ease-in-out infinite`},onMouseEnter:e=>{e.currentTarget.style.background=`linear-gradient(135deg, #ffffff 0%, #f8fafc 100%)`,e.currentTarget.style.boxShadow=`0 8px 24px rgba(99, 102, 241, 0.25), inset 0 1px 0 rgba(255,255,255,0.9)`,e.currentTarget.style.transform=`translateY(-3px) scale(1.01)`,e.currentTarget.style.borderColor=`rgba(99, 102, 241, 0.4)`,e.currentTarget.style.animation=`none`,e.currentTarget.querySelector(`.user-card-arrow`)?.classList.add(`arrow-hover`)},onMouseLeave:e=>{e.currentTarget.style.background=`linear-gradient(135deg, rgba(248, 250, 252, 0.95) 0%, rgba(241, 245, 249, 0.95) 100%)`,e.currentTarget.style.boxShadow=`0 2px 12px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255,255,255,0.8)`,e.currentTarget.style.transform=`translateY(0) scale(1)`,e.currentTarget.style.borderColor=`rgba(99, 102, 241, 0.15)`,e.currentTarget.style.animation=`cardBreath 3s ease-in-out infinite`,e.currentTarget.querySelector(`.user-card-arrow`)?.classList.remove(`arrow-hover`)},children:[(0,$.jsx)(`div`,{className:`user-card-glow`,style:{position:`absolute`,inset:-4,borderRadius:18,background:`linear-gradient(90deg, transparent 0%, rgba(99,102,241,0.15) 25%, rgba(139,92,246,0.15) 50%, rgba(99,102,241,0.15) 75%, transparent 100%)`,backgroundSize:`200% 100%`,opacity:.8,animation:`borderShimmer 2.5s linear infinite`,pointerEvents:`none`}}),(0,$.jsx)(Bw,{size:36,icon:(0,$.jsx)(z8,{}),style:{background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,flexShrink:0,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.3)`,transition:`all 0.35s cubic-bezier(0.4,0,0.2,1)`,position:`relative`,zIndex:1,animation:`avatarPulse 2s ease-in-out infinite`}}),(0,$.jsxs)(`div`,{style:{flex:1,minWidth:0,position:`relative`,zIndex:1},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:14,fontWeight:500,letterSpacing:0,borderRadius:6,display:`inline-block`,animation:`creditGlow 1.5s ease-in-out infinite`},children:[`积分: `,n?.credits||0]})]}),(0,$.jsx)(`div`,{className:`user-card-arrow`,style:{fontSize:12,color:`#6366f1`,flexShrink:0,position:`relative`,zIndex:1},children:(0,$.jsx)(n6,{})}),(0,$.jsx)(`style`,{children:`
@keyframes arrowFlash {
0%, 100% {
transform: translateY(0) scale(1);
@@ -454,7 +454,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
animation: none !important;
filter: drop-shadow(0 0 15px rgba(139, 92, 246, 0.8)) !important;
}
- `})]})})})]}),(0,$.jsx)(`div`,{className:`desktop-content`,style:{flex:1,background:`#f1f2f3`,borderRadius:`20px`,boxShadow:`0 4px 32px rgba(0, 0, 0, 0.06), 0 1px 8px rgba(0, 0, 0, 0.04)`,padding:`24px 32px 32px`,border:`1px solid rgba(0, 0, 0, 0.06)`,overflow:`auto`,minHeight:0},children:!we&&(0,$.jsx)(wt,{context:{openContactModal:()=>c(!0)}})})]}),(0,$.jsx)(`div`,{className:`mobile-header`,children:(0,$.jsxs)(`div`,{className:`mobile-header-content`,children:[(0,$.jsx)(`div`,{className:`mobile-menu-btn`,onClick:()=>ne(!0),children:(0,$.jsx)(n6,{style:{fontSize:20}})}),(0,$.jsx)(`div`,{className:`mobile-header-title`,children:me}),(0,$.jsx)(`div`,{className:`mobile-header-right`,children:(0,$.jsxs)(`div`,{className:`mobile-credits-badge`,onClick:()=>u(!0),children:[(0,$.jsx)(U8,{}),(0,$.jsx)(`span`,{children:n?.credits||0})]})})]})}),(0,$.jsx)(`div`,{className:`mobile-content`,children:we&&(0,$.jsx)(wt,{context:{openContactModal:()=>c(!0)}})}),(0,$.jsxs)(vV,{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:ge?(0,$.jsx)(`img`,{src:ge,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:me})]}),placement:`left`,onClose:()=>ne(!1),open:G,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)(Bw,{size:44,style:{background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,flexShrink:0},children:(0,$.jsx)(z8,{})}),(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)(U8,{style:{color:`#f59e0b`,marginRight:4}}),`积分: `,(0,$.jsx)(`span`,{style:{color:`#f59e0b`,fontWeight:600},children:n?.credits??0})]})]})]})}),(0,$.jsx)(a7,{data:Se}),Fe.map(e=>{let t=e.menu_type??e.menuType,n=Pe[e.id]&&Pe[e.id].length>0,r=e.path===Me,i=fe[e.id],a=o7[e.icon]||(0,$.jsx)(b3,{});return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mobile-menu-item ${r&&!n?`mobile-menu-item-active`:``} ${t===`group`?`mobile-menu-group`:``}`,onClick:()=>Ie(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:(Pe[e.id]||[]).map(e=>{let t=e.path===Me,n=o7[e.icon]||(0,$.jsx)(b3,{});return(0,$.jsxs)(`div`,{className:`mobile-menu-item mobile-submenu-item ${t?`mobile-menu-item-active`:``}`,onClick:()=>Ie(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`),ne(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#f59e0b`},children:(0,$.jsx)(U8,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:`积分明细`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{e(`/user-center?tab=orders`),ne(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#6366f1`},children:(0,$.jsx)(MV,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:`订单记录`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{e(`/messages`),ne(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#8b5cf6`},children:(0,$.jsx)(b2,{})}),(0,$.jsxs)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:[`消息中心`,W>0&&(0,$.jsx)(TQ,{color:`red`,style:{marginLeft:8,fontSize:11},children:W})]})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{o(!0),ne(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#0ea5e9`},children:(0,$.jsx)(V3,{})}),(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:()=>{u(!0),ne(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#fff`},children:(0,$.jsx)(PI,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#fff`,fontWeight:600},children:`充值积分`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{Ve(),ne(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#ef4444`},children:(0,$.jsx)(q3,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#ef4444`},children:`退出登录`})]})]})]}),(0,$.jsx)(PG,{title:(0,$.jsxs)(DV,{children:[(0,$.jsx)(d8,{}),`账号设置`]}),open:a,onCancel:()=>{o(!1),d.resetFields(),f.resetFields()},width:440,footer:null,children:(0,$.jsxs)(uL,{defaultActiveKey:`profile`,children:[(0,$.jsx)(uL.TabPane,{tab:`个人信息`,children:(0,$.jsxs)(xH,{form:f,layout:`vertical`,style:{marginTop:20},onValuesChange:()=>{},children:[(0,$.jsx)(xH.Item,{name:`username`,label:`用户名`,rules:[{required:!0,message:`请输入用户名`},{min:3,message:`用户名至少3位`}],children:(0,$.jsx)(nW,{placeholder:`请输入用户名`,size:`large`,prefix:(0,$.jsx)(z8,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(xH.Item,{children:(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:Be,style:{width:`100%`},children:`确认修改`})})]})},`profile`),(0,$.jsx)(uL.TabPane,{tab:`修改密码`,children:(0,$.jsxs)(xH,{form:d,layout:`vertical`,style:{marginTop:20},onValuesChange:()=>{},children:[(0,$.jsx)(xH.Item,{name:`oldPwd`,label:`原密码`,rules:[{required:!0,message:`请输入原密码`}],children:(0,$.jsx)(nW.Password,{placeholder:`请输入原密码`,size:`large`,prefix:(0,$.jsx)(V3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(xH.Item,{name:`newPwd`,label:`新密码`,rules:[{required:!0,message:`请输入新密码`},{min:6,message:`密码至少6位`}],children:(0,$.jsx)(nW.Password,{placeholder:`请输入新密码(至少6位)`,size:`large`,prefix:(0,$.jsx)(V3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(xH.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)(nW.Password,{placeholder:`请再次输入新密码`,size:`large`,prefix:(0,$.jsx)(V3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(xH.Item,{children:(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:ze,style:{width:`100%`},children:`确认修改`})})]})},`password`)]})}),(0,$.jsx)(Am,{theme:{token:{colorPrimary:`#6366f1`,borderRadius:8}},children:(0,$.jsx)(PG,{open:l,onCancel:()=>u(!1),footer:null,width:`100%`,centered:!1,style:{top:0,maxWidth:`100vw`,margin:0,paddingBottom:0},styles:{body:{padding:0,height:`100vh`,overflow:`auto`,scrollbarWidth:`none`,msOverflowStyle:`none`},mask:{background:`rgba(0,0,0,0.45)`},header:{display:`none`}},closable:!0,className:`recharge-fullscreen-modal`,title:null,closeIcon:(0,$.jsx)(ju,{style:{fontSize:18}}),children:(0,$.jsx)(`div`,{style:{width:`100%`,minHeight:`100vh`,background:`#f8fafc`,position:`relative`},children:(0,$.jsxs)(`div`,{style:{maxWidth:1200,margin:`0 auto`,padding:`24px`},children:[(0,$.jsxs)(`div`,{style:{marginBottom:24},children:[(0,$.jsxs)(`div`,{style:{textAlign:`center`,marginBottom:20},children:[(0,$.jsx)(Q.Title,{level:3,style:{marginBottom:8},children:`订阅套餐`}),(0,$.jsx)(Q.Text,{type:`secondary`,children:`订阅积分按自然月逐月发放;有效订阅只能升级同周期更高等级套餐,不能提前续费。`})]}),x&&(0,$.jsxs)(`div`,{style:{marginBottom:16,padding:`14px 16px`,borderRadius:12,background:`#fff`,border:`1px solid #e8eaed`,display:`flex`,alignItems:`center`,gap:16},children:[(0,$.jsx)(`div`,{style:{width:40,height:40,borderRadius:10,flexShrink:0,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#fff`,fontSize:18},children:(0,$.jsx)(_4,{})}),(0,$.jsxs)(`div`,{style:{flex:1},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:4},children:[(0,$.jsxs)(Q.Text,{strong:!0,style:{fontSize:14},children:[`当前订阅:`,x.tierCode||`订阅套餐`]}),(0,$.jsx)(TQ,{color:`purple`,style:{fontSize:11,margin:0,borderRadius:6},children:x.billingCycle===`monthly`?`月`:x.billingCycle===`quarterly`?`季`:`年`})]}),(0,$.jsxs)(`div`,{style:{fontSize:12,color:`#64748b`,marginBottom:2},children:[`已发放 `,(0,$.jsx)(`span`,{style:{color:`#6366f1`,fontWeight:600},children:x.grantedCount}),`/`,x.grantCount,` 期 · 每月 `,(0,$.jsx)(`span`,{style:{color:`#6366f1`,fontWeight:600},children:Number(x.monthlyGrantCredits||0).toLocaleString()}),` 积分`]}),(0,$.jsxs)(`div`,{style:{fontSize:11,color:`#94a3b8`},children:[`订阅到期:`,new Date(x.expiresAt).toLocaleString(`zh-CN`,{timeZone:`Asia/Shanghai`,hour12:!1})]})]}),(0,$.jsx)(_K,{percent:Math.round((x.grantedCount||0)/(x.grantCount||1)*100),size:`small`,strokeColor:{from:`#6366f1`,to:`#8b5cf6`},style:{width:80}})]}),(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,gap:16,marginBottom:20},children:(0,$.jsxs)(BF.Group,{value:D,onChange:e=>{O(e.target.value),m(null)},buttonStyle:`solid`,children:[(0,$.jsx)(BF.Button,{value:`monthly`,children:`月套餐`}),(0,$.jsx)(BF.Button,{value:`quarterly`,children:`季套餐`}),(0,$.jsx)(BF.Button,{value:`yearly`,children:`年套餐`})]})}),y.filter(e=>e.billingCycle===D).length===0?(0,$.jsx)(`div`,{style:{padding:48,textAlign:`center`,color:`#94a3b8`},children:`暂无可订阅套餐,请联系管理员配置并上架套餐。`}):(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`,gap:16,flexWrap:`wrap`},children:y.filter(e=>e.billingCycle===D).map((e,t)=>{let n=c7[t%c7.length],r=e.regularPrice||e.price,i=e.currentPrice??e.price,a=r&&Number(r)>Number(i),o=e.monthlyGrantCredits?`${Number(e.monthlyGrantCredits).toLocaleString()} 积分/月`:`${Number(e.grantCredits||0).toLocaleString()} 积分`;return(0,$.jsx)(`div`,{style:{width:250,display:`flex`,flexDirection:`column`,borderRadius:14,overflow:`hidden`,background:`#fff`,border:`1px solid #e8eaed`,position:`relative`,transition:`all 0.2s`},children:(0,$.jsxs)(`div`,{style:{padding:`16px 14px 12px`,background:`#fafbfc`,flex:1},children:[e.priceType===`first_purchase`&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8,background:`#fff2e8`,color:`#fa541c`,fontSize:11,padding:`2px 8px`,borderRadius:10,fontWeight:500},children:`首充价`}),e.priceType===`activity`&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8,background:`#fff1f0`,color:`#cf1322`,fontSize:11,padding:`2px 8px`,borderRadius:10,fontWeight:500},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:n.gradient,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#fff`,fontSize:14},children:n.icon}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14},children:e.name}),(0,$.jsx)(`div`,{style:{fontSize:11,color:`#94a3b8`},children:e.description||e.tierCode})]})]}),(0,$.jsxs)(`div`,{style:{marginBottom:8},children:[(0,$.jsxs)(`span`,{style:{fontSize:24,fontWeight:700,color:`#1a1a2e`},children:[`¥`,i]}),a&&(0,$.jsxs)(`span`,{style:{fontSize:13,color:`#94a3b8`,textDecoration:`line-through`,marginLeft:6},children:[`¥`,r]}),e.canUpgrade&&(0,$.jsx)(TQ,{color:`orange`,style:{marginLeft:6,fontSize:10,padding:`0 6px`,lineHeight:`16px`},children:`升级价`})]}),e.canUpgrade&&Number(e.deductionAmount||0)>0&&(0,$.jsxs)(`div`,{style:{fontSize:11,color:`#94a3b8`,marginBottom:4},children:[`目标套餐¥`,e.targetPrice,`,抵扣未生效¥`,e.deductionAmount]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,fontSize:12,color:`#64748b`},children:[(0,$.jsx)(`span`,{children:o}),(0,$.jsxs)(`span`,{children:[`共 `,e.grantCount,` 次`]})]}),e.unavailableReason&&(0,$.jsx)(`div`,{style:{padding:`6px 14px`,fontSize:13,color:`#dc2626`,background:`#fef2f2`,marginTop:`20px`},children:e.unavailableReason}),(0,$.jsx)(`div`,{style:{padding:`10px 14px`,borderTop:`1px solid #f0f0f0`},children:(0,$.jsx)(X,{block:!0,size:`small`,disabled:e.canPurchase===!1||!B.alipay&&!B.wechat,loading:N&&p===e.id,onClick:()=>{m(e.id),Ue(e.id,e)},style:{borderRadius:8,background:e.canPurchase===!1?`#f5f5f5`:`linear-gradient(135deg, #6366f1, #8b5cf6)`,color:e.canPurchase===!1?`#94a3b8`:`#fff`,border:`none`,fontWeight:600,height:34,fontSize:13},children:e.canPurchase===!1?`不可购买`:`立即订阅`})}),e.features&&e.features.length>0&&(0,$.jsx)(`div`,{style:{marginTop:10,paddingTop:10,borderTop:`1px dashed #e2e8f0`},children:e.features.map((e,t)=>(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,fontSize:12,color:`#64748b`,lineHeight:`20px`,marginBottom:2},children:[(0,$.jsx)(Tu,{style:{color:`#4c49cc`,fontSize:14,flexShrink:0,marginTop:2}}),(0,$.jsx)(`span`,{style:{fontSize:14,margin:`4px`},children:e})]},t))}),(e.priceType===`first_purchase`||e.priceType===`activity`)&&(0,$.jsxs)(`div`,{style:{padding:`10px 14px`,background:`#fffbe6`,borderTop:`1px solid #fff1b8`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:6},children:[(0,$.jsx)(V4,{style:{color:`#fa8c16`,fontSize:12}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#d46b08`,fontWeight:600},children:`限时活动`})]}),e.features?.slice(0,3).map((e,t)=>(0,$.jsxs)(`div`,{style:{fontSize:11,color:`#8c6d1f`,lineHeight:`18px`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[`· `,e]},t))]})]})},e.id)})})]}),(0,$.jsx)(`div`,{style:{marginBottom:24,background:`#fff`,borderRadius:12,padding:24,border:`1px solid #e8eaed`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsx)(U8,{style:{color:`#6366f1`,fontSize:24}}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Title,{level:4,style:{margin:0},children:`积分充值`}),(0,$.jsxs)(Q.Text,{type:`secondary`,style:{fontSize:12},children:[`当前积分:`,(0,$.jsx)(`span`,{style:{color:`#6366f1`,fontWeight:600},children:n?.credits??0})]})]})]}),(0,$.jsx)(X,{type:`primary`,size:`large`,icon:(0,$.jsx)(p8,{}),onClick:()=>E(!0),style:{borderRadius:10,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`,height:42,paddingLeft:20,paddingRight:20},children:`积分商城`})]})}),(0,$.jsxs)(`div`,{style:{marginBottom:24,borderRadius:16,overflow:`hidden`,background:`#fff`,border:`1px solid #e8eaed`},children:[(0,$.jsx)(`div`,{style:{padding:`24px 24px 0`,textAlign:`center`},children:(0,$.jsx)(Q.Title,{level:3,style:{color:`#1a1a2e`,marginBottom:16},children:`常见问题`})}),(0,$.jsx)(i_,{accordion:!0,expandIcon:({isActive:e})=>e?(0,$.jsx)(PR,{style:{color:`#64748b`}}):(0,$.jsx)(jC,{style:{color:`#64748b`}}),style:{background:`#fff`,border:`none`},items:mse.map(e=>({key:e.key,label:(0,$.jsx)(`span`,{style:{color:`#1a1a2e`,fontSize:14,fontWeight:500},children:e.label}),children:e.children,style:{background:`#fff`,borderBottom:`1px solid #e8eaed`}}))}),(0,$.jsxs)(`div`,{style:{padding:`24px`,borderTop:`1px solid #e8eaed`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,cursor:`pointer`,transition:`background 0.2s`},onClick:()=>{c(!0)},onMouseEnter:e=>{e.currentTarget.style.background=`#f8fafc`},onMouseLeave:e=>{e.currentTarget.style.background=`#fff`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,$.jsx)(a6,{style:{color:`#64748b`,fontSize:18}}),(0,$.jsx)(`span`,{style:{color:`#1a1a2e`,fontSize:14,fontWeight:500},children:`联系客服`})]}),(0,$.jsx)(zg,{style:{color:`#64748b`,fontSize:14}})]})]})]})})})}),(0,$.jsxs)(PG,{title:(0,$.jsxs)(DV,{children:[(0,$.jsx)(U8,{}),`积分商城`]}),open:T,onCancel:()=>E(!1),footer:null,width:720,closable:!0,styles:{body:{padding:20}},children:[(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:16},children:(0,$.jsxs)(DV,{children:[(0,$.jsx)(Q.Text,{children:`当前积分:`}),(0,$.jsx)(Q.Text,{strong:!0,style:{color:`#6366f1`,fontSize:18},children:n?.credits??0})]})}),(0,$.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(160px, 1fr))`,gap:12,maxHeight:400,overflowY:`auto`,paddingRight:4},children:[_.length===0&&(0,$.jsx)(`div`,{style:{width:`100%`,padding:32,textAlign:`center`,color:`#94a3b8`},children:`暂无可购买的积分增值包`}),_.map((e,t)=>{let n=s7[t%s7.length],r=Number(e.grantCredits||0),i=e.currentPrice||e.price;return(0,$.jsxs)(`div`,{style:{borderRadius:12,overflow:`hidden`,background:`#fff`,border:p===e.id?`2px solid #e8eaed`:`1px solid #e8eaed`,position:`relative`,transition:`all 0.2s`},children:[e.description&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:-1,right:8,background:`#fff2e8`,color:`#fa541c`,fontSize:11,padding:`2px 8px`,borderRadius:10,fontWeight:500},children:e.description}),(0,$.jsxs)(`div`,{style:{padding:`12px 10px 8px`,background:`#fafbfc`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:4},children:[(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:8,flexShrink:0,background:n.gradient,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:14,color:`#fff`},children:n.icon}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:12},children:e.name}),(0,$.jsxs)(`div`,{style:{fontSize:11,fontWeight:600,color:`#6366f1`},children:[r.toLocaleString(),` 积分`]})]})]}),(0,$.jsxs)(`div`,{style:{marginTop:4,fontSize:18,fontWeight:700,color:`#1a1a2e`},children:[`¥`,i]}),(0,$.jsxs)(Q.Text,{type:`secondary`,style:{fontSize:10},children:[`有效期 `,Number(e.validityMonths||1),` 个月`]})]}),(0,$.jsx)(`div`,{style:{padding:`6px 10px`,borderTop:`1px solid #f0f0f0`},children:(0,$.jsx)(X,{block:!0,size:`small`,disabled:!B.alipay&&!B.wechat,loading:N&&p===e.id,onClick:()=>{m(e.id),Ue(e.id,e)},style:{borderRadius:6,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,color:`#fff`,border:`none`,fontWeight:600,height:28,fontSize:12},children:`购买`})})]},e.id)})]})]}),(0,$.jsx)(PG,{open:k,onCancel:async()=>{if(He(),z.current){try{await T5(z.current)}catch{}z.current=null}localStorage.removeItem(ee),A(!1),U(null)},footer:(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`,padding:`8px 0`},children:(0,$.jsx)(X,{danger:!0,size:`large`,onClick:async()=>{if(He(),z.current){try{await T5(z.current)}catch{}z.current=null}localStorage.removeItem(ee),A(!1),U(null),Z.info(`已取消支付`)},style:{borderRadius:10,minWidth:140,fontSize:14},children:`取消支付`})}),width:700,closable:!0,title:(0,$.jsxs)(Q.Title,{level:5,style:{margin:0},children:[`开通`,H?.title||`会员服务`,H?.credits?` ${Number(H.credits).toLocaleString()} 积分`:``]}),styles:{body:{padding:0,borderRadius:16,overflow:`hidden`},footer:{borderRadius:16,borderTop:`1px solid #f0f0f0`,padding:`16px 24px`}},children:(0,$.jsxs)(`div`,{style:{display:`flex`,minHeight:380},children:[(0,$.jsxs)(`div`,{style:{flex:1,padding:24,background:`#fff`,borderRight:`1px solid #f0f0f0`},children:[(0,$.jsxs)(`div`,{style:{marginBottom:20},children:[(0,$.jsx)(Q.Text,{style:{fontSize:13,color:`#64748b`,marginBottom:8,display:`block`},children:`商品信息`}),(0,$.jsxs)(`div`,{style:{padding:14,background:`#f8fafc`,borderRadius:10,border:`1px solid #e2e8f0`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:6},children:[(0,$.jsx)(`div`,{style:{fontSize:14,fontWeight:600,color:`#1a1a2e`},children:H?.tierName||H?.title||`积分充值`}),H?.periodLabel&&(0,$.jsx)(TQ,{color:`purple`,style:{fontSize:11,margin:0,borderRadius:6,padding:`0 6px`},children:H.periodLabel})]}),(0,$.jsxs)(`div`,{style:{fontSize:22,fontWeight:700,color:`#6366f1`,lineHeight:1.4},children:[`¥`,H?.price||0,H?.originalPrice&&Number(H.originalPrice)>Number(H?.price||0)&&(0,$.jsxs)(`span`,{style:{fontSize:13,color:`#94a3b8`,textDecoration:`line-through`,marginLeft:8,fontWeight:400},children:[`¥`,H.originalPrice]})]})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{style:{fontSize:13,color:`#64748b`,marginBottom:8,display:`block`},children:`订单明细`}),(0,$.jsxs)(`div`,{style:{padding:12,background:`#f8fafc`,borderRadius:8,border:`1px solid #e2e8f0`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,padding:`4px 0`,fontSize:12},children:[(0,$.jsx)(`span`,{style:{color:`#64748b`},children:`积分数量`}),(0,$.jsx)(`span`,{style:{color:`#1a1a2e`},children:H?.credits==null?`-`:`${Number(H.credits).toLocaleString()} 积分`})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,padding:`4px 0`,fontSize:12},children:[(0,$.jsx)(`span`,{style:{color:`#64748b`},children:`续费信息`}),(0,$.jsx)(`span`,{style:{color:`#1a1a2e`},children:H?.isSubscription?`次年按原价 可随时取消`:`一次性购买`})]}),(0,$.jsx)(`div`,{style:{height:1,background:`#e2e8f0`,margin:`8px 0`}}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,padding:`4px 0`,fontSize:12},children:[(0,$.jsx)(`span`,{style:{color:`#64748b`},children:`商品原价`}),(0,$.jsxs)(`span`,{style:{color:`#1a1a2e`},children:[`¥`,H?.originalPrice||H?.price||0,`.00`]})]}),(0,$.jsx)(`div`,{style:{height:1,background:`#e2e8f0`,margin:`8px 0`}}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`4px 0`},children:[(0,$.jsx)(`span`,{style:{fontSize:14,fontWeight:500,color:`#1a1a2e`},children:`应付金额`}),(0,$.jsxs)(`span`,{style:{fontSize:18,fontWeight:700,color:`#6366f1`},children:[`¥`,H?.price||0,`.00`]})]})]})]})]}),(0,$.jsxs)(`div`,{style:{width:280,padding:24,background:`#fff`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:12},children:[H?.method===`alipay`?(0,$.jsx)(R0,{style:{fontSize:18,color:`#1677ff`}}):(0,$.jsx)(K8,{style:{fontSize:18,color:`#07c160`}}),(0,$.jsxs)(`span`,{style:{fontSize:14,color:`#64748b`},children:[`请用`,H?.method===`alipay`?`支付宝`:`微信`,`扫码支付`]})]}),(0,$.jsx)(`div`,{style:{width:180,height:180,borderRadius:12,border:`1px solid #f0f0f0`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#fff`},children:H?.qrCode&&(0,$.jsx)(F0,{value:H.qrCode,size:150,level:`M`})}),(0,$.jsxs)(`div`,{style:{marginTop:12,fontSize:12,color:`#94a3b8`},children:[F,`秒后二维码失效`]}),(0,$.jsxs)(`div`,{style:{marginTop:8,fontSize:11,color:`#94a3b8`,textAlign:`center`},children:[`开通即代表同意`,(0,$.jsx)(`br`,{}),`《用户服务协议》`]})]})]})}),(0,$.jsx)(dse,{}),(0,$.jsx)(`div`,{className:`contact-button-wrapper`,style:{right:`${oe.x}px`,bottom:`${window.innerHeight-oe.y}px`},children:(0,$.jsxs)(`div`,{style:{position:`relative`},children:[(0,$.jsx)(`div`,{className:`contact-tooltip`,style:{opacity:+!!K},children:`联系我们`}),(0,$.jsx)(`button`,{className:`contact-button ${ce?`dragging`:``}`,onMouseEnter:()=>re(!0),onMouseLeave:()=>re(!1),onMouseDown:Oe,onMouseUp:Ae,children:(0,$.jsx)(a6,{style:{fontSize:20}})})]})}),(0,$.jsx)(PG,{title:(0,$.jsxs)(DV,{children:[(0,$.jsx)(a6,{}),`联系我们`]}),open:s,onCancel:()=>{c(!1),ie.resetFields()},footer:null,width:480,className:`contact-modal`,children:(0,$.jsxs)(`div`,{style:{marginTop:8},children:[(0,$.jsxs)(xH,{form:ie,layout:`vertical`,children:[(0,$.jsx)(xH.Item,{name:`name`,label:`姓名`,rules:[{required:!0,message:`请输入姓名`}],children:(0,$.jsx)(nW,{placeholder:`请输入您的姓名`,size:`large`})}),(0,$.jsx)(xH.Item,{name:`phone`,label:`手机号`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1[3-9]\d{9}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(nW,{placeholder:`请输入您的手机号`,size:`large`})}),(0,$.jsx)(xH.Item,{name:`companyName`,label:`公司名称`,rules:[{required:!0,message:`请输入公司名称`}],children:(0,$.jsx)(nW,{placeholder:`请输入公司名称`,size:`large`})}),(0,$.jsx)(xH.Item,{name:`industry`,label:`您的行业`,rules:[{required:!0,message:`请输入您的行业`}],children:(0,$.jsx)(nW,{placeholder:`请输入您的行业`,size:`large`})}),(0,$.jsx)(xH.Item,{name:`message`,label:`留言(选填)`,children:(0,$.jsx)(nW.TextArea,{placeholder:`请输入您的需求或问题`,rows:3,style:{borderRadius:10}})})]}),(0,$.jsxs)(`div`,{style:{marginTop:16,display:`flex`,gap:12},children:[(0,$.jsx)(X,{size:`large`,onClick:()=>{c(!1),ie.resetFields()},style:{borderRadius:10,flex:1},children:`取消`}),(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:Ge,loading:ae,style:{borderRadius:10,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,flex:1},children:`提交`})]})]})})]})},gse=`http://localhost:8000/api`,_se=()=>{let{checkAuth:e}=n7(),[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||`智创`,siteLogo:t.siteLogo||``}}}catch{}return{siteName:`智创`,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)(!1),[B,V]=(0,S.useState)(``),[H,U]=(0,S.useState)(``),ee=Ye(),{login:W}=n7(),[te]=xH.useForm(),[G]=xH.useForm(),[ne]=xH.useForm();(0,S.useEffect)(()=>{_5().then(e=>{N(e.siteName),F(e.siteLogo),L(e.loginBgVideo||``),V(e.userAgreementPrivacyUrl),U(e.siteCopyright)}).catch(()=>{})},[]),(0,S.useEffect)(()=>{l===`register`&&i(`register`)},[l]);let K=()=>{if(c)try{ee(decodeURIComponent(c));return}catch{}ee(`/home`)},re=()=>m?!0:(Z.warning(`请先阅读并同意用户协议及隐私政策`),!1),ie=async()=>{if(re())try{let t=await te.validateFields();await W(t.phone,t.password,void 0,t.rememberMe),Z.success(`登录成功,欢迎回来`),await e(),K()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t)}},ae=async()=>{if(re())try{let t=G.getFieldsValue();if(!t.phone||!t.code){Z.error(`请填写手机号和验证码`);return}n(!0),await gae(t.phone,t.code),Z.success(`登录成功,欢迎回来`),await e(),K()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t)}finally{n(!1)}},q=async()=>{if(re())try{let t=await ne.validateFields();n(!0),await _ae(t.phone,t.regCode,t.password),Z.success(`注册成功`),await e(),K()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`注册失败`;Z.error(t)}finally{n(!1)}},oe=(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 se=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 v5(e,n),oe(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)}},ce=async(e=!1)=>{let t=r===`register`?ne.getFieldValue(`phone`):G.getFieldValue(`phone`);try{let e=``;e=r===`register`?`register`:`login`,await v5(t,e),r===`register`?(y(!0),oe(p,!0)):(x(!0),oe(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)}},le=e=>{o(e),i(e),d(0),p(0),x(!1),y(!1),_(!1),O(!1),A(!1),w(e=>e+1),e===`password`?te.resetFields():G.resetFields()},ue={background:`#fff`,border:`1.5px solid #e2e8f0`,color:`#1e293b`,borderRadius:10,fontSize:14},de=e=>{if(!e){Z.warning(`暂未上传协议文件`);return}e.startsWith(`http://`)||e.startsWith(`https://`)?window.open(e,`_blank`):window.open(`${gse.replace(/\/api$/,``)}${e}`,`_blank`)};return(0,$.jsxs)(`div`,{className:`login-page`,children:[(0,$.jsx)(vse,{src:I,onReady:()=>z(!0)}),(0,$.jsx)(`div`,{className:`login-bg-overlay`,style:{opacity:+!!R}}),(0,$.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,opacity:+!!R,transition:`opacity 0.5s ease`,pointerEvents:R?`auto`:`none`},children:[(0,$.jsx)(`div`,{className:`login-slogan`,children:(0,$.jsx)(`span`,{className:`login-slogan-text`,children:`AI赋能创意,素材触手可及`})}),(0,$.jsx)(`div`,{className:`login-center`,children:(0,$.jsxs)(fL,{className:`login-card`,styles:{body:{padding:`32px 32px`}},children:[(0,$.jsx)(`div`,{className:`login-card-header`,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:20,color:`#fff`}})}),(0,$.jsx)(`span`,{className:`login-site-name`,children:M})]})}),(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:()=>le(e),className:`login-tab ${a===e?`login-tab-active`:``}`,children:e===`password`?`密码登录`:`验证码登录`},e))}),r===`password`&&(0,$.jsxs)(xH,{form:te,size:`large`,layout:`vertical`,onFinish:ie,children:[(0,$.jsx)(xH.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(nW,{prefix:(0,$.jsx)(c6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,style:ue})}),(0,$.jsx)(xH.Item,{name:`password`,rules:[{required:!0,message:`请输入密码`}],children:(0,$.jsx)(nW.Password,{prefix:(0,$.jsx)(V3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入密码`,style:ue})}),(0,$.jsx)(xH.Item,{name:`rememberMe`,valuePropName:`checked`,style:{marginBottom:12},children:(0,$.jsx)(cR,{children:`记住我的登录状态`})}),(0,$.jsx)(xH.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)(xH,{form:G,size:`large`,layout:`vertical`,children:[(0,$.jsx)(xH.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(nW,{prefix:(0,$.jsx)(c6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,maxLength:11,style:ue})}),(0,$.jsx)(xH.Item,{name:`code`,rules:[{required:!0,message:`请输入验证码`}],children:(0,$.jsxs)(DV.Compact,{style:{width:`100%`},children:[(0,$.jsx)(nW,{prefix:(0,$.jsx)(a8,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入验证码`,maxLength:6,disabled:!b,style:{...ue,borderRadius:`10px 0 0 10px`,flex:1}}),(0,$.jsx)(X,{disabled:u>0,style:{fontSize:14,fontWeight:400},onClick:()=>{k?(x(!1),_(!0),w(e=>e+1)):g&&!b?(E(!0),setTimeout(()=>E(!1),500)):se(G.getFieldValue(`phone`))},className:`login-code-btn`,children:u>0?`${u}s`:k?`重新发送`:`获取验证码`})]})}),g&&(0,$.jsx)(xH.Item,{style:{marginBottom:12},children:(0,$.jsx)(l7,{onSuccess:ce,isVerified:b,shake:T})},C),(0,$.jsx)(xH.Item,{style:{marginBottom:12},children:(0,$.jsx)(X,{type:`primary`,onClick:ae,loading:t,block:!0,className:`login-submit-btn`,children:`登 录`})})]}),r===`register`&&(0,$.jsxs)(xH,{form:ne,size:`large`,layout:`vertical`,children:[(0,$.jsx)(xH.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(nW,{prefix:(0,$.jsx)(c6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,maxLength:11,style:ue})}),(0,$.jsx)(xH.Item,{name:`regCode`,rules:[{required:!0,message:`请输入验证码`}],children:(0,$.jsxs)(DV.Compact,{style:{width:`100%`},children:[(0,$.jsx)(nW,{prefix:(0,$.jsx)(a8,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入验证码`,maxLength:6,disabled:!v,style:{...ue,borderRadius:`10px 0 0 10px`,flex:1}}),(0,$.jsx)(X,{disabled:f>0,style:{fontSize:14,fontWeight:400},onClick:()=>{D?(y(!1),_(!0),w(e=>e+1)):g&&!v?(E(!0),setTimeout(()=>E(!1),500)):se(ne.getFieldValue(`phone`),!0)},className:`login-code-btn`,children:f>0?`${f}s`:D?`重新发送`:`获取验证码`})]})}),g&&(0,$.jsx)(xH.Item,{style:{marginBottom:12},children:(0,$.jsx)(l7,{onSuccess:ce,isVerified:v,shake:T})},C),(0,$.jsx)(xH.Item,{name:`password`,rules:[{required:!0,message:`请设置密码`},{min:6,message:`密码至少6位`}],children:(0,$.jsx)(nW.Password,{prefix:(0,$.jsx)(V3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请设置密码(至少6位)`,style:ue})}),(0,$.jsx)(xH.Item,{style:{marginBottom:12},children:(0,$.jsx)(X,{type:`primary`,onClick:q,loading:t,block:!0,className:`login-submit-btn`,children:`注 册`})})]}),(0,$.jsx)(`div`,{className:`login-agreement`,children:(0,$.jsx)(cR,{checked:m,onChange:e=>h(e.target.checked),children:(0,$.jsxs)(`span`,{className:`login-agreement-text`,children:[`我已阅读并同意`,(0,$.jsx)(`span`,{onClick:e=>{e.stopPropagation(),de(B)},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),ne.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:`没有账号?立即注册`})})]})}),H&&(0,$.jsx)(`div`,{className:`login-copyright-wrapper`,children:(0,$.jsx)(`div`,{className:`login-copyright`,children:H})})]})]})},vse=({src:e,onReady:t})=>{let[n,r]=(0,S.useState)(!1),i=S.useRef(null),a=()=>{n||(r(!0),i.current?.play().catch(()=>{}),t())};if(!e)return t(),null;let o=e.toLowerCase().endsWith(`.gif`),s=e.toLowerCase().endsWith(`.webp`);return o||s?(0,$.jsx)(`img`,{className:`login-bg-video`,src:e,alt:``,onLoad:a,onError:a}):(0,$.jsxs)($.Fragment,{children:[!n&&(0,$.jsx)(`div`,{className:`login-bg-video login-bg-placeholder`}),(0,$.jsx)(`video`,{ref:i,className:`login-bg-video`,style:{opacity:+!!n},autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:`auto`,onCanPlayThrough:a,onCanPlay:a,onError:a,children:(0,$.jsx)(`source`,{src:e,type:e.endsWith(`.webm`)?`video/webm`:e.endsWith(`.mov`)?`video/quicktime`:`video/mp4`})})]})},l7=({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:[]}),u7=X8((e,t)=>({projects:[],records:yse(),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 bae(),loading:!1})}catch{e({loading:!1})}},createProject:async(n,r)=>{let i=await xae(n,r);return e({projects:[i,...t().projects]}),i},deleteProject:async n=>{await Sae(n),e({projects:t().projects.filter(e=>e.id!==n)})},fetchRecords:async(t={})=>{e({loading:!0});try{e({records:await l5(t),loading:!1})}catch{e({loading:!1})}},optimizePrompt:async(n,r)=>{let i=await Cae(n,r);try{await n7.getState().checkAuth()}catch{}let a=t().records,o=a.items.findIndex(e=>e.id===i.record.id),s=o>=0?a.items.map(e=>e.id===i.record.id?i.record:e):[i.record,...a.items];return e({records:{...a,total:o>=0?a.total:a.total+1,items:s}}),i},generateVideo:async n=>{let r=await Nae(n);try{await n7.getState().checkAuth()}catch{}let i=t().records;return e({records:{...i,items:i.items.map(e=>e.id===n?r:e)}}),r},retryGeneration:async n=>{let r=await Pae(n);try{await n7.getState().checkAuth()}catch{}let i=t().records;return e({records:{...i,items:i.items.map(e=>e.id===n?r:e)}}),r},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:[]})})),d7=480;function f7(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+d7*6e4,i=new Date(r);return`${i.getUTCFullYear()}-${p7(i.getUTCMonth()+1)}-${p7(i.getUTCDate())} ${p7(i.getUTCHours())}:${p7(i.getUTCMinutes())}`}let d=l===`Z`?u+d7*6e4:u,f=new Date(d);return`${f.getUTCFullYear()}-${p7(f.getUTCMonth()+1)}-${p7(f.getUTCDate())} ${p7(f.getUTCHours())}:${p7(f.getUTCMinutes())}`}function p7(e){return e<10?`0${e}`:String(e)}function bse(e){if(!e)return`-`;let t=e.match(/\.(\d{1,6})/)?.[1]?.padEnd(6,`0`)||`000000`,n=xse(e);return n===`-`?n:`${n}.${t}`}function xse(e){let t=e.trim(),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.replace(`T`,` `);let[,r,i,a,o,s,c,l]=n,u=Date.UTC(+r,i-1,+a,+o,+s,+c),d=u;if(l===`Z`)d+=d7*6e4;else if(l){let e=l[0]===`+`?1:-1,t=l.slice(1).replace(`:`,``);d=u-e*(t.slice(0,2)*60+ +t.slice(2,4))*6e4+d7*6e4}let f=new Date(d);return`${f.getUTCFullYear()}-${p7(f.getUTCMonth()+1)}-${p7(f.getUTCDate())} ${p7(f.getUTCHours())}:${p7(f.getUTCMinutes())}:${p7(f.getUTCSeconds())}`}var m7=[`#f97316`,`#3b82f6`,`#8b5cf6`,`#10b981`,`#eab308`,`#6366f1`,`#ef4444`,`#06b6d4`,`#64748b`,`#78716c`],h7={ShoppingCartOutlined:(0,$.jsx)(p8,{}),BookOutlined:(0,$.jsx)(C2,{}),HomeOutlined:(0,$.jsx)(b3,{}),FireOutlined:(0,$.jsx)(V4,{}),RocketOutlined:(0,$.jsx)(r8,{}),SkinOutlined:(0,$.jsx)(kie,{}),CompassOutlined:(0,$.jsx)(d4,{}),HeartOutlined:(0,$.jsx)(d3,{}),CarOutlined:(0,$.jsx)(F2,{}),CameraOutlined:(0,$.jsx)(M2,{}),CloudOutlined:(0,$.jsx)(q2,{}),StarOutlined:(0,$.jsx)(C8,{}),TrophyOutlined:(0,$.jsx)(N8,{}),ThunderboltOutlined:(0,$.jsx)(k8,{}),BulbOutlined:(0,$.jsx)(k2,{}),CoffeeOutlined:(0,$.jsx)(a4,{}),CrownOutlined:(0,$.jsx)(_4,{}),DashboardOutlined:(0,$.jsx)(b4,{}),FlagOutlined:(0,$.jsx)(W4,{}),GlobalOutlined:(0,$.jsx)(c3,{}),GiftOutlined:(0,$.jsx)(a3,{}),LaptopOutlined:(0,$.jsx)(k3,{}),MobileOutlined:(0,$.jsx)(c6,{}),MonitorOutlined:(0,$.jsx)(d6,{}),PayCircleOutlined:(0,$.jsx)(E6,{}),PictureOutlined:(0,$.jsx)(F6,{}),PlayCircleOutlined:(0,$.jsx)(W6,{}),SafetyOutlined:(0,$.jsx)(a8,{}),ShoppingOutlined:(0,$.jsx)(Tie,{}),SmileOutlined:(0,$.jsx)(v8,{}),SoundOutlined:(0,$.jsx)(x8,{}),TagOutlined:(0,$.jsx)(Rie,{}),TeamOutlined:(0,$.jsx)(D8,{}),ToolOutlined:(0,$.jsx)(Hie,{}),TruckOutlined:(0,$.jsx)(qie,{}),VideoCameraOutlined:(0,$.jsx)(V8,{}),WalletOutlined:(0,$.jsx)(U8,{}),BankOutlined:(0,$.jsx)(m2,{}),BuildOutlined:(0,$.jsx)(E2,{}),ExperimentOutlined:(0,$.jsx)(k4,{}),HighlightOutlined:(0,$.jsx)(m3,{}),IdcardOutlined:(0,$.jsx)(C3,{}),MedicineBoxOutlined:(0,$.jsx)($3,{}),ReadOutlined:(0,$.jsx)(lie,{}),RestOutlined:(0,$.jsx)(die,{}),SketchOutlined:(0,$.jsx)(Die,{}),SolutionOutlined:(0,$.jsx)(Mie,{})},Sse=()=>{let[e,t]=(0,S.useState)(!1),[n]=xH.useForm(),r=Ye(),{projects:i,fetchProjects:a,createProject:o,deleteProject:s}=u7(),[c,l]=(0,S.useState)([]);(0,S.useEffect)(()=>{a(),S5().then(l).catch(()=>{})},[]);let u=Object.fromEntries(c.map((e,t)=>[e.key,{label:e.label,color:m7[t%m7.length],icon:e.icon||`AppstoreOutlined`}]));return(0,$.jsxs)(`div`,{className:`content_box`,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)(MV,{}),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)(PI,{}),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)(lC,{image:lC.PRESENTED_IMAGE_SIMPLE,description:`还没有项目,创建您的第一个视频项目`,style:{padding:`60px 0`},children:(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(PI,{}),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:h7[u[e.industry]?.icon]||(0,$.jsx)(W0,{})}),(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)(TQ,{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)(TB,{style:{fontSize:12,color:`#94a3b8`}}),(0,$.jsxs)(`span`,{className:`date-display`,translate:`no`,style:{fontSize:12,color:`#94a3b8`},children:[`创建于 `,f7(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)(W6,{}),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)(RG,{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)(zQ,{}),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)(PG,{title:(0,$.jsxs)(DV,{children:[(0,$.jsx)(W0,{}),`新建项目`]}),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)(xH,{form:n,layout:`vertical`,style:{marginTop:20},children:[(0,$.jsx)(xH.Item,{name:`name`,label:`项目名称`,rules:[{required:!0,message:`请输入项目名称`}],children:(0,$.jsx)(nW,{placeholder:`例如:618电商大促宣传片`,prefix:(0,$.jsx)(xX,{}),size:`large`})}),(0,$.jsx)(xH.Item,{name:`industry`,label:`所属行业`,rules:[{required:!0,message:`请选择行业`}],children:(0,$.jsx)(zC,{placeholder:`选择项目所属行业`,size:`large`,children:c.map((e,t)=>(0,$.jsx)(zC.Option,{value:e.key,children:(0,$.jsxs)(DV,{children:[h7[e.icon]||(0,$.jsx)(W0,{}),` `,e.label]})},e.key))})})]})})]})};async function g7(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:_7}=Q,Cse={real_person:{title:`选择真人素材库`,empty:`暂无可选 Active 真人素材`,projectError:`加载真人素材项目失败`,assetError:`加载真人素材失败`,fallbackName:`真人素材`},aigc_virtual:{title:`选择虚拟素材库`,empty:`暂无可选 Active 虚拟素材`,projectError:`加载虚拟素材项目失败`,assetError:`加载虚拟素材失败`,fallbackName:`虚拟素材`}},v7=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`https://ceshi.apiforeign.minzhongzc.com`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,wse=e=>e.assetType===`Video`?v7(e.videoCoverUrl||e.previewUrl||e.displayUrl||e.providerUrl):v7(`static`+(e.previewUrl||e.displayUrl||e.videoCoverUrl||e.providerUrl)+`?w=300&q=50`),Tse=e=>{let t=Number(e||0);return!Number.isFinite(t)||t<=0?`-`:`${t.toFixed(t>=10?0:1)}s`},y7=({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=Cse[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`?t7:$5)({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`?Zoe:Goe)({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)(PG,{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)(DV,{style:{width:`100%`,justifyContent:`space-between`,marginBottom:12},children:[(0,$.jsx)(_7,{strong:!0,children:`项目组`}),(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(WK,{}),onClick:M,loading:D})]}),(0,$.jsx)(lG,{spinning:D,children:m.length===0?(0,$.jsx)(lC,{image:lC.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)(_7,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name}),(0,$.jsx)(_7,{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)(DV,{style:{width:`100%`,marginBottom:12},children:[(0,$.jsx)(nW,{allowClear:!0,prefix:(0,$.jsx)(PC,{}),placeholder:`搜索素材名称`,value:v,onChange:e=>y(e.target.value),onPressEnter:N}),(0,$.jsx)(zC,{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)(WK,{}),onClick:N,loading:k,children:`刷新`})]}),(0,$.jsx)(lG,{spinning:k,children:C.length===0?(0,$.jsx)(lC,{image:lC.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=wse(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)(V8,{style:{fontSize:32,color:`#94a3b8`}}):(0,$.jsx)(F6,{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:Tse(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)(OC,{})}),(0,$.jsxs)(`div`,{style:{padding:10},children:[(0,$.jsx)(_7,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name||`未命名素材`}),(0,$.jsxs)(DV,{wrap:!0,size:4,style:{marginTop:6},children:[(0,$.jsx)(TQ,{color:a?`blue`:`default`,children:a?`视频`:`图片`}),(0,$.jsx)(TQ,{children:e.projectName})]})]})]},e.id)})})})]})]})]})},b7=({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)(b6,{style:{fontSize:24,color:`#fff`}}):(0,$.jsx)(W6,{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)(W2,{style:{fontSize:t===`small`?14:16,color:`#94a3b8`}}):(0,$.jsx)(x8,{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:x7}=Q,S7=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`${`https://ceshi.apiforeign.minzhongzc.com`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`},C7=(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},w7=(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},Ese=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 C7(n,r)}else if(e.resourceType===`video`&&n>0&&r>0)return w7(n,r);return null},Dse=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}),Ose=e=>e===`video`?(0,$.jsx)(V8,{}):e===`audio`?(0,$.jsx)(a2,{}):(0,$.jsx)(F6,{}),kse=e=>e===`video`?`视频`:e===`audio`?`音频`:`图片`,Ase=({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,defaultResourceType:_})=>{let[v,y]=(0,S.useState)(_||``),[b,x]=(0,S.useState)(``),[C,w]=(0,S.useState)(1),[T,E]=(0,S.useState)(10),[D,O]=(0,S.useState)(1),[k,A]=(0,S.useState)(8),[j,M]=(0,S.useState)(!1),[N,P]=(0,S.useState)(!1),[F,I]=(0,S.useState)([]),[L,R]=(0,S.useState)(0),[z,B]=(0,S.useState)(``),[V,H]=(0,S.useState)([]),[U,ee]=(0,S.useState)(0),[W,te]=(0,S.useState)(new Map),G=(0,S.useMemo)(()=>new Set(i),[i]),ne=(0,S.useMemo)(()=>new Set(r||[`image`,`video`,`audio`]),[JSON.stringify(r)]),K=(0,S.useMemo)(()=>Array.from(W.values()).filter(e=>e.resourceType===`image`).length,[W]),re=(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]),ae=(0,S.useMemo)(()=>Array.from(W.values()).filter(e=>e.resourceType===`audio`).length,[W]),q=(0,S.useMemo)(()=>Array.from(W.values()).filter(e=>e.resourceType===`audio`).reduce((e,t)=>e+(t.durationSeconds||0),0),[W]),oe=(0,S.useMemo)(()=>o!==void 0&&c!==void 0?o-c:1/0,[o,c]),se=(0,S.useMemo)(()=>s!==void 0&&l!==void 0?s-l:1/0,[s,l]),ce=(0,S.useMemo)(()=>u!==void 0&&d!==void 0?u-d:1/0,[u,d]),le=(0,S.useMemo)(()=>f!==void 0&&p!==void 0?f-p:1/0,[f,p]),ue=(0,S.useMemo)(()=>m!==void 0&&h!==void 0?m-h:1/0,[m,h]),de=(0,S.useMemo)(()=>K>oe,[K,oe]),fe=(0,S.useMemo)(()=>re>se,[re,se]),pe=(0,S.useMemo)(()=>ie>ce,[ie,ce]),me=(0,S.useMemo)(()=>ae>le,[ae,le]),he=(0,S.useMemo)(()=>q>ue,[q,ue]),ge=(0,S.useCallback)(async()=>{if(e){P(!0);try{let e=await X5({resourceType:v||void 0,keyword:b||void 0,page:C,pageSize:T,scene:`picker`});I(C===1?e.groups||[]:t=>[...t,...e.groups||[]]),R(e.totalDays||0)}catch(e){Z.error(e?.message||`加载历史上传素材失败`),C===1&&I([]),R(0)}finally{P(!1)}}},[ne,b,e,C,T,v]),_e=(0,S.useCallback)(async e=>{M(!0);try{let t=await Z5(e,{resourceType:v||void 0,keyword:b||void 0,page:D,pageSize:8,scene:`picker`});H((t.items||[]).filter(e=>ne.has(e.resourceType))),ee(t.total||0)}catch(e){Z.error(e?.message||`加载历史上传素材失败`),H([]),ee(0)}finally{M(!1)}},[ne,b,D,k,v]);(0,S.useEffect)(()=>{e&&ge()},[e,C,ge]),(0,S.useEffect)(()=>{z&&O(1)},[z]),(0,S.useEffect)(()=>{z&&_e(z)},[z,D,_e]),(0,S.useEffect)(()=>{e&&te(new Map)},[e]),(0,S.useEffect)(()=>{e&&(y(_||``),w(1))},[e,_]);let ve=async e=>{if(G.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=S7(e.previewUrl||e.displayUrl||e.resourceUrl);if(t){let e=await Dse(t);n=e.width,r=e.height}}if(n>0&&r>0){let t=C7(n,r);if(t){Z.error(`${e.fileName||`图片`}:${t}`);return}}}else if(e.resourceType===`video`&&n>0&&r>0){let t=w7(n,r);if(t){Z.error(`${e.fileName||`视频`}:${t}`);return}}te(t=>{let n=new Map(t);return n.has(e.id)?n.delete(e.id):n.set(e.id,e),n})},ye=()=>{let e=Array.from(W.values());if(e.length===0){Z.warning(`请先选择历史素材`);return}n(e),te(new Map),t()},be=(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)(PG,{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:ye,style:{background:`#8b5cf6`},disabled:de||fe||pe||me||he,children:[`应用选择 (`,W.size,`)`]},`ok`)],children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsxs)(DV,{wrap:!0,children:[(0,$.jsx)(zC,{value:v,options:be,style:{width:120},onChange:e=>{y(e),w(1)}}),(0,$.jsx)(nW,{allowClear:!0,value:b,prefix:(0,$.jsx)(PC,{}),placeholder:`搜索文件名`,style:{width:220},onChange:e=>x(e.target.value),onPressEnter:()=>{w(1),ge()}}),(0,$.jsx)(X,{icon:(0,$.jsx)(WK,{}),onClick:ge,children:`刷新`})]}),!g&&(0,$.jsxs)(`div`,{style:{display:`flex`,gap:16,marginTop:12,flexWrap:`wrap`},children:[(0,$.jsxs)(`span`,{style:{fontSize:13,color:de?`#ef4444`:`#64748b`,fontWeight:de?600:400},children:[`还可选取图片 `,K,`/`,o!==void 0&&c!==void 0?o-c:`-`,` 张`]}),(0,$.jsxs)(`span`,{style:{fontSize:13,color:fe||pe?`#ef4444`:`#64748b`,fontWeight:fe||pe?600:400},children:[`视频还可选取 `,re,`/`,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:me||he?`#ef4444`:`#64748b`,fontWeight:me||he?600:400},children:[`音频还可选取 `,ae,`/`,f!==void 0&&p!==void 0?f-p:`-`,` 个(`,q.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)(x7,{strong:!0,style:{fontSize:14},children:`日期列表`}),(0,$.jsx)(lG,{spinning:N,children:F.length===0?(0,$.jsx)(lC,{image:lC.PRESENTED_IMAGE_SIMPLE,description:`暂无日期`,style:{padding:`40px 0`}}):(0,$.jsxs)(`div`,{style:{marginTop:12},children:[F.map(e=>(0,$.jsxs)(`div`,{onClick:()=>B(e.generatedDate),style:{padding:`10px 12px`,borderRadius:10,marginBottom:6,cursor:`pointer`,border:z===e.generatedDate?`1px solid #8b5cf6`:`1px solid transparent`,background:z===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)),L>F.length&&(0,$.jsx)(`div`,{style:{marginTop:12,textAlign:`center`},children:(0,$.jsx)(X,{size:`small`,onClick:()=>w(C+1),children:`加载更多`})})]})})]}),(0,$.jsx)(`div`,{style:{border:`1px solid #eef0f4`,borderRadius:12,padding:12,overflowY:`auto`},children:(0,$.jsx)(lG,{spinning:j,children:z?V.length===0?(0,$.jsx)(lC,{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:V.map(e=>{let t=W.has(e.id),n=G.has(e.id),r=Ese(e),i=n||!!r,a=e.previewUrl||e.displayUrl||e.resourceUrl,o=S7(e.resourceType===`image`?`static`+a+`?w=300&q=50`:a);return(0,$.jsxs)(`div`,{onClick:()=>!i&&ve(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:o,alt:e.fileName||e.id,style:{width:`100%`,height:130,objectFit:`cover`}}):e.resourceType===`video`?(0,$.jsx)(`video`,{src:o,muted:!0,style:{width:`100%`,height:130,objectFit:`cover`}}):(0,$.jsx)(b7,{src:o,size:`small`})}),(0,$.jsxs)(`div`,{style:{padding:10},children:[(0,$.jsxs)(DV,{size:6,style:{marginBottom:6},children:[(0,$.jsx)(TQ,{color:`purple`,icon:Ose(e.resourceType),style:{margin:0},children:kse(e.resourceType)}),e.durationSeconds?(0,$.jsxs)(TQ,{style:{margin:0},children:[Number(e.durationSeconds).toFixed(1),`s`]}):null,r&&(0,$.jsx)(TQ,{color:`red`,style:{margin:0},children:`尺寸不符`})]}),(0,$.jsx)(x7,{ellipsis:!0,style:{display:`block`,fontSize:13,color:`#334155`},title:e.fileName||e.id,children:e.fileName||e.id}),(0,$.jsx)(x7,{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)(OC,{})}),n&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8},children:(0,$.jsx)(TQ,{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)(HW,{current:D,pageSize:k,total:U,showSizeChanger:!0,pageSizeOptions:[8],onChange:(e,t)=>{O(e),A(t)}})})]}):(0,$.jsx)(lC,{image:lC.PRESENTED_IMAGE_SIMPLE,description:`请选择日期`,style:{padding:`80px 0`}})})})]})]})},T7=({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,mediaType:b})=>{let x=(0,S.useRef)(null),[C,w]=(0,S.useState)(!1),[T,E]=(0,S.useState)(`real_person`),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)(!1),[j,M]=(0,S.useState)(!1),N=()=>{A(!1),x.current?.click()},P=e=>{let t=e.target.files;t&&r&&r(Array.from(t)),x.current&&(x.current.value=``)},F=e=>{if(A(!1),a){E(e),w(!0);return}if(o){o(e);return}E(e),w(!0)},I=(0,$.jsxs)(`div`,{style:{padding:`4px 0`,minWidth:180},children:[(0,$.jsxs)(`div`,{onClick:()=>{N()},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)(xX,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`本地上传`})]}),(0,$.jsxs)(`div`,{onClick:()=>{A(!1),O(!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)(C4,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`从资产中选择`})]}),b!==`image`&&(0,$.jsxs)(`div`,{onClick:()=>F(`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)(z8,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`真人素材库`})]}),b!==`image`&&(0,$.jsxs)(`div`,{onClick:()=>F(`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)(D8,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`虚拟素材库`})]})]});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`input`,{ref:x,type:`file`,accept:t,multiple:n,onChange:P,style:{display:`none`}}),c?(0,$.jsx)(kw,{title:c,children:(0,$.jsx)(Lw,{content:I,open:k,onOpenChange:A,trigger:`click`,placement:`bottomLeft`,children:(0,$.jsx)(`div`,{style:{cursor:s?`not-allowed`:`pointer`},children:e})})}):(0,$.jsx)(Lw,{content:I,open:k,onOpenChange:A,trigger:`click`,placement:`bottomLeft`,children:(0,$.jsx)(`div`,{style:{cursor:s?`not-allowed`:`pointer`},children:e})}),(0,$.jsx)(Ase,{open:D,onClose:()=>O(!1),onSelect:e=>{i?.(e),O(!1)},allowedTypes:t.includes(`audio`)?[`image`,`video`,`audio`]:[`image`,`video`],maxImageCount:l,maxVideoCount:u,usedImageCount:d,usedVideoCount:f,maxVideoDuration:m,usedVideoDuration:p,maxAudioCount:h,usedAudioCount:g,maxAudioDuration:_,usedAudioDuration:v,hideLimitHint:y,defaultResourceType:b===`image`?`image`:``}),(0,$.jsx)(y7,{open:C,libraryType:T,onClose:()=>w(!1),onSelect:e=>{a?.(e),w(!1)},accept:t,maxCount:t===`image/*`&&!n?1:void 0,maxImageCount:l,maxVideoCount:u,usedImageCount:d,usedVideoCount:f,usedVideoDuration:p,maxVideoDuration:m})]})};function jse(){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 Mse={prompt_processing:`optimizing`,ready:`prompt_optimized`,generating:`generating`,success:`completed`,failure:`failed`},Nse=new Set([`pending`,`optimizing`,`generating`]),E7=new Set([`queued`,`preparing`,`creating_provider_task`,`provider_result_staged`,`waiting_remote`,`polling`,`result_ready`,`download_queued`,`downloading`,`retry_waiting`,`recovery_inconsistent`,`upscale_queued`,`upscale_processing`,`upscale_polling`,`upscale_downloading`,`upscale_finalizing`,`upscale_retry_waiting`]),D7=new Set([`completed`,`done`]),O7=new Set([`failed`,`timeout`,`download_failed`,`upscale_failed`]),Pse=new Set([...D7,...O7,`deleted`]),Fse={pending:`待处理`,optimizing:`提词处理中`,prompt_optimized:`待生成`,generating:`生成中`,queued:`生成中`,preparing:`生成中`,creating_provider_task:`生成中`,provider_result_staged:`生成中`,waiting_remote:`生成中`,polling:`生成中`,result_ready:`生成中`,download_queued:`生成中`,downloading:`生成中`,retry_waiting:`生成中`,recovery_inconsistent:`生成中`,upscale_queued:`生成中`,upscale_processing:`生成中`,upscale_polling:`生成中`,upscale_downloading:`生成中`,upscale_finalizing:`生成中`,upscale_retry_waiting:`生成中`,completed:`成功`,done:`成功`,timeout:`失败`,download_failed:`失败`,upscale_failed:`失败`,failed:`失败`,deleted:`已删除`},Ise={pending:`default`,optimizing:`processing`,prompt_optimized:`blue`,generating:`processing`,queued:`processing`,preparing:`processing`,creating_provider_task:`processing`,provider_result_staged:`processing`,waiting_remote:`processing`,polling:`processing`,result_ready:`processing`,download_queued:`processing`,downloading:`processing`,retry_waiting:`orange`,recovery_inconsistent:`orange`,upscale_queued:`purple`,upscale_processing:`purple`,upscale_polling:`purple`,upscale_downloading:`purple`,upscale_finalizing:`purple`,upscale_retry_waiting:`orange`,completed:`success`,done:`success`,failed:`error`,timeout:`error`,download_failed:`error`,upscale_failed:`error`,deleted:`default`},k7=e=>String(e||``).trim().toLowerCase(),Lse=e=>{let t=k7(e);return Fse[t]||t||`未知状态`},Rse=e=>Ise[k7(e)]||`default`,A7=e=>{let t=k7(e.status),n=k7(e.displayStatus),r=k7(e.pipelineStage),i=Mse[k7(e.clientStatus)]||``,a=i||n||t||r||`pending`;O7.has(r)||O7.has(t)||O7.has(n)?a=O7.has(r)?r:O7.has(t)?t:n:D7.has(t)||D7.has(n)?a=D7.has(t)?t:n:!i&&r&&E7.has(r)&&(a=r);let o=O7.has(a),s=D7.has(a),c=typeof e.shouldPoll==`boolean`?e.shouldPoll:!o&&!s&&(Nse.has(t)||E7.has(r)),l=c;return{status:t,displayStatus:n,pipelineStage:r,effectiveKey:a,label:Lse(a),color:Rse(a),isActive:l,isSuccess:s,isFailure:o,isTerminal:Pse.has(a),canGenerate:typeof e.canGenerate==`boolean`?e.canGenerate:t===`prompt_optimized`,canRetry:typeof e.canRetry==`boolean`?e.canRetry:o,shouldPoll:c}},j7=({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:`#fff`,border:`1px solid #e2e8f0`,minWidth:70,whiteSpace:`nowrap`,flexShrink:0},children:[(0,$.jsxs)(`span`,{style:{fontSize:13,color:`#374151`,fontWeight:500,lineHeight:`18px`},children:[t,r]}),(0,$.jsx)(wZ,{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,maxHeight:200,overflowY:`auto`,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)]})},zse=({group:e,groupName:t,selected:n,expanded:r,onToggle:i,onSelect:a,onClose:o})=>{let s=(0,S.useRef)(null),c=(0,S.useRef)(null),l=(0,S.useRef)(r),[u,d]=(0,S.useState)(null);return l.current=r,(0,S.useEffect)(()=>{if(r&&s.current){let e=s.current.getBoundingClientRect();d({bottom:window.innerHeight-e.top+4,left:e.left})}else d(null)},[r]),(0,S.useEffect)(()=>{if(!r)return;let e=e=>{s.current?.contains(e.target)||c.current?.contains(e.target)||l.current&&o()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[r,o]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{ref:s,onClick:()=>i(t),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:`#ffffffff`,border:`1px solid #e2e8f0`,minWidth:70,whiteSpace:`nowrap`,flexShrink:0},children:[(0,$.jsx)(Q.Text,{style:{fontSize:13,color:`#374151`,fontWeight:500,lineHeight:`18px`},children:n||e.name}),(0,$.jsx)(wZ,{style:{fontSize:9,color:`#94a3b8`,transition:`transform 0.2s`,transform:r?`rotate(180deg)`:`rotate(0deg)`}})]}),u&&(0,Vi.createPortal)((0,$.jsxs)(`div`,{ref:c,style:{position:`fixed`,bottom:u.bottom,left:u.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,r)=>{let i=n===e;return(0,$.jsx)(`div`,{onClick:()=>{a(e,t),o()},style:{padding:`6px 10px`,borderRadius:8,fontSize:13,cursor:`pointer`,transition:`all 0.15s`,background:i?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`transparent`,color:i?`#fff`:`#1a1a2e`,fontWeight:i?600:400},onMouseEnter:e=>{i||(e.currentTarget.style.background=`#f1f5f9`)},onMouseLeave:e=>{i||(e.currentTarget.style.background=`transparent`)},children:e},r)})})]}),document.body)]})},M7=({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)(W6,{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)})]})},Bse=()=>{let{projectId:e}=$e(),t=Ye(),[n]=xH.useForm(),{projects:r,records:i,fetchProjects:a,fetchRecords:o,optimizePrompt:s,generateVideo:c,retryGeneration:l}=u7(),u=i.items,{user:d}=n7(),[f,p]=(0,S.useState)(!1),[m,h]=(0,S.useState)(!1),[g,_]=(0,S.useState)(null),[v,y]=(0,S.useState)(``),[b,x]=(0,S.useState)(!1),[C,w]=(0,S.useState)({}),[T,E]=(0,S.useState)({}),[D,O]=(0,S.useState)({}),[k,A]=(0,S.useState)({}),[j,M]=(0,S.useState)({}),N=(0,S.useRef)(null),P=(0,S.useCallback)(e=>{if(!e)return 0;let t=new Date(e).getTime(),n=(Date.now()-t)/1e3;return n>=180?99:Math.min(99,n*.6)},[]);(0,S.useEffect)(()=>{let e=Object.entries(T).filter(([,e])=>e===`generating`).map(([e])=>e);if(e.length===0){N.current&&=(clearInterval(N.current),null);return}let t=()=>{e.forEach(e=>{let t=u7.getState().records.items.find(t=>t.id===e);if(t?.createdAt){let n=P(t.createdAt);O(t=>({...t,[e]:n})),A(t=>({...t,[e]:n}))}})};return t(),N.current=window.setInterval(t,1e3),()=>{N.current&&=(clearInterval(N.current),null)}},[T,P]),(0,S.useEffect)(()=>{Object.entries(T).forEach(([e,t])=>{if(t===`done`&&!j[e]){M(t=>({...t,[e]:!0}));let t=k[e]||0,n=Date.now(),r=()=>{let i=Date.now()-n,a=Math.min(i/800,1),o=1-(1-a)**3,s=t+(100-t)*o;A(t=>({...t,[e]:s})),a<1&&requestAnimationFrame(r)};requestAnimationFrame(r)}})},[T]),(0,S.useEffect)(()=>{Object.entries(T).forEach(([e,t])=>{if(t===`generating`){let t=u7.getState().records.items.find(t=>t.id===e);if(t?.createdAt){let n=P(t.createdAt);O(t=>({...t,[e]:n})),A(t=>({...t,[e]:n}))}}})},[g]);let[F,I]=(0,S.useState)({}),[L,R]=(0,S.useState)(null),[z,B]=(0,S.useState)(null),[V,H]=(0,S.useState)([]),[U,ee]=(0,S.useState)(!1),[W,te]=(0,S.useState)(``),[G,ne]=(0,S.useState)(!1),[K,re]=(0,S.useState)(``),ie=(0,S.useRef)(null),[ae,q]=(0,S.useState)({}),[oe,se]=(0,S.useState)({}),[ce,le]=(0,S.useState)({}),[ue,de]=(0,S.useState)(null),[fe,pe]=(0,S.useState)(null),[me,he]=(0,S.useState)(5),[ge,_e]=(0,S.useState)(`9:16`),[ve,ye]=(0,S.useState)(`720p`),[be,xe]=(0,S.useState)([]),[Se,Ce]=(0,S.useState)([]),[we,Te]=(0,S.useState)(``),[Ee,De]=(0,S.useState)(!1),[Oe,ke]=(0,S.useState)(null),[Ae,je]=(0,S.useState)(!1),[Me,Ne]=(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]});(0,S.useMemo)(()=>Me.durations.map(e=>`${e}`),[Me.durations]),(0,S.useCallback)(()=>{ke(e=>e===`duration`?null:`duration`)},[]),(0,S.useCallback)(()=>{ke(null)},[]);let Pe=(0,S.useCallback)(e=>{de(t=>t===e?null:e)},[]),Fe=(0,S.useCallback)(()=>{de(null)},[]);(0,S.useCallback)(e=>{he(parseInt(e))},[]);let Ie=(0,S.useCallback)((e,t)=>{le(n=>{let r={...n};return r[t]===e?delete r[t]:r[t]=e,r})},[]),[Le,Re]=(0,S.useState)(0),[ze,Be]=(0,S.useState)(0),[Ve,He]=(0,S.useState)(`video`),[Ue,We]=(0,S.useState)(`1:1`),[Ge,Ke]=(0,S.useState)(`2K`),[qe,Je]=(0,S.useState)(2048),[Xe,Ze]=(0,S.useState)(2048),[Qe,et]=(0,S.useState)(!1),[tt,nt]=(0,S.useState)([]),[rt,it]=(0,S.useState)([]),[at,ot]=(0,S.useState)([]),st=(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},ct=(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},lt=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=V.filter(e=>e.type===`image`).length,a=V.filter(e=>e.type===`video`).length,o=V.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=ct(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=st(t.width,t.height);if(e)return Z.error(`${e}`),!1}}ee(!0);try{let r;r=t?await d5(e):await f5(e,s);let o=t?`图片`:`视频`,c=t?i+1:a+1;H(e=>[...e,{url:r.url,type:t?`image`:`video`,name:`${o}${c}`,duration:n?s:void 0}]),Z.success(`${o}上传成功`)}catch{Z.error(`上传失败`)}finally{ee(!1)}return!1};(0,S.useEffect)(()=>{if(Kae().then(e=>{nt(e.video),ot(e.image)}),A5().then(e=>{it(e)}),!Qe&&!Ae)return;let e=e=>{let t=e.target;!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&(et(!1),je(!1))};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[Qe,Ae]);let ut=e=>{let t=Array.isArray(e)?e:[];return{inputImageCount:t.filter(e=>e.type===`image`).length,inputVideoDuration:t.filter(e=>e.type===`video`).reduce((e,t)=>e+Number(t.duration||0),0)}},dt=()=>{let e={};if(e=rt.find(e=>e.modelConfigId===(g?.engineId||we)&&e.genType===Ve&&e.resolution===(Ve===`video`?g?.resolution||ve:g?.imageSize||Ge)),e||=Ve===`video`?{perSecondCredits:2,baseCredits:60,ratio:1.3,inputVideoRatio:1.3,inputVideoBaseCredits:0,inputVideoPerSecondCredits:15,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0}:{perSecondCredits:.1,baseCredits:2,ratio:3,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0},Ve===`video`){let t=((g?.duration||me)*e.perSecondCredits+e.baseCredits)*e.ratio;if(g?.includeMediaReferences??Ee){let n=ut(g?.references||V);if(n.inputVideoDuration>0){let r=((e.inputVideoBaseCredits||0)+(e.inputVideoPerSecondCredits||0)*n.inputVideoDuration)*(e.inputVideoRatio||1);t+=r}if(n.inputImageCount>0){let r=((e.inputImageBaseCredits||0)+(e.inputImagePerImageCredits||0)*n.inputImageCount)*(e.inputImageRatio||1);t+=r}}return Number(t.toFixed(2))}else{let t=e.baseCredits*e.ratio;if(g?.includeMediaReferences??Ee){let n=ut(g?.references||V);if(n.inputImageCount>0){let r=((e.inputImageBaseCredits||0)+(e.inputImagePerImageCredits||0)*n.inputImageCount)*(e.inputImageRatio||1);t+=r}}return Number(t.toFixed(2))}},ft=e=>{let t=e.genType||e.gen_type||`video`,n=e.engineId||e.engine_id,r=e.resolution,i=Number(e.duration||0),a=e.imageSize||e.image_size,o=e.includeMediaReferences??e.include_media_references??!1,s=e.references||[],c=rt.find(e=>e.modelConfigId===n&&e.genType===t&&e.resolution===(t===`video`?r:a));c||=t===`video`?{perSecondCredits:2,baseCredits:60,ratio:1.3,inputVideoRatio:1.3,inputVideoBaseCredits:0,inputVideoPerSecondCredits:15,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0}:{perSecondCredits:.1,baseCredits:2,ratio:3,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0};let l=0;if(t===`video`){if(l=(i*c.perSecondCredits+c.baseCredits)*c.ratio,o){let e=ut(s);if(e.inputVideoDuration>0){let t=((c.inputVideoBaseCredits||0)+(c.inputVideoPerSecondCredits||0)*e.inputVideoDuration)*(c.inputVideoRatio||1);l+=t}if(e.inputImageCount>0){let t=((c.inputImageBaseCredits||0)+(c.inputImagePerImageCredits||0)*e.inputImageCount)*(c.inputImageRatio||1);l+=t}}}else if(l=c.baseCredits*c.ratio,o){let e=ut(s);if(e.inputImageCount>0){let t=((c.inputImageBaseCredits||0)+(c.inputImagePerImageCredits||0)*e.inputImageCount)*(c.inputImageRatio||1);l+=t}}return Number(l.toFixed(2))},pt=e=>{St(e);let t=Tt[Ge]?.[e];if(t){let[e,n]=t.split(/x/i).map(Number);Je(e),Ze(n)}},mt=e=>{wt(e);let t=Object.keys(Tt[e]||{});gt(t.map(e=>({value:e,label:e})));let n=t.includes(Ue)?Ue:t[0]||`1:1`;n!==Ue&&We(n);let r=Tt[e]?.[n];if(r){let[e,t]=r.split(/x/i).map(Number);Je(e),Ze(t)}},[ht,gt]=(0,S.useState)([]),[_t,vt]=(0,S.useState)([]),[yt,bt]=(0,S.useState)([]),[xt,St]=(0,S.useState)(0),[Ct,wt]=(0,S.useState)(0),[Tt,Et]=(0,S.useState)({});(0,S.useEffect)(()=>{yt[Ct]&&yt[Ct][xt]!==void 0&&(Je(yt[Ct][xt].substring(0,4)),Ze(yt[Ct][xt].substring(5)))},[xt]),(0,S.useEffect)(()=>{yt[Ct]&&yt[Ct][xt]!==void 0&&(Je(yt[Ct][xt].substring(0,4)),Ze(yt[Ct][xt].substring(5)))},[Ct]);let Dt=()=>{Je(Xe),Ze(qe)},Ot=e=>{let t=e.target.value===`image`?`image`:`video`;He(t);let n=(t===`image`?Se:be).filter(e=>e.supportsUniversalReference!==!1);n.length>0&&At(n[0].id)};(0,S.useEffect)(()=>{S5().then(e=>{q(Object.fromEntries(e.map(e=>[e.key,e.label]))),se(Object.fromEntries(e.map(e=>[e.key,e.optionGroups||[]])))}).catch(()=>{}),Iae().then(e=>{let t=e.items||[];Ce(t);let n=t?.[0]?.supportedSizes||{};Et(n);let r=Object.keys(n);vt(r.map(e=>({value:e,label:e})));let i=r.includes(Ge)?Ge:r[0]||`2K`,a=Object.keys(n[i]||{});gt(a.map(e=>({value:e,label:e})));let o=a.includes(Ue)?Ue:a[0]||`1:1`;o!==Ue&&We(o);let s=n[i]?.[o];if(s){let[e,t]=s.split(/x/i).map(Number);Je(e),Ze(t)}}).catch(()=>{}),Fae().then(e=>{if(xe(e.items||[]),e.items?.length){let t=e.items[0];Te(e=>e||t.id),Ne({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)(()=>{if(!g)return;let e=g.genType||Ve,t=e===`image`?Se:be,n=g.engineId||``,r=t.find(e=>e.id===n)||t[0];if(r)if(Te(r.id),e===`image`){let e=r.supportedSizes||{};Et(e);let t=Object.keys(e),n=t.includes(g.imageSize||``)?g.imageSize:t[0]||g.imageSize||`2K`;Ke(n);let i=Object.keys(e[n]||{}),a=i.includes(g.imageProportion||``)?g.imageProportion:i[0]||g.imageProportion||`1:1`;We(a);let o=e[n]?.[a]||g.imagePx||``;if(o){let[e,t]=String(o).split(/x/i).map(Number);e>0&&t>0&&(Je(e),Ze(t))}}else Ne({ratios:r.supportedRatios?.length?r.supportedRatios:[`16:9`],resolutions:r.supportedResolutions?.length?r.supportedResolutions:[`720p`],durations:r.supportedDurations?.length?r.supportedDurations:[5]}),r.supportedRatios?.includes(ge)||_e(r.supportedRatios?.[0]||`16:9`),r.supportedResolutions?.includes(ve)||ye(r.supportedResolutions?.[0]||`720p`),r.supportedDurations?.includes(me)||he(r.supportedDurations?.[0]||g.duration||5);De(!!g.includeMediaReferences)},[g?.id,g?.engineId,be,Se]);let kt=e=>{let t=be.find(t=>t.id===e)||be[0];return{ratios:t?.supportedRatios?.length?t.supportedRatios:[`16:9`],resolutions:t?.supportedResolutions?.length?t.supportedResolutions:[`720p`],durations:t?.supportedDurations?.length?t.supportedDurations:[5]}},At=e=>{Te(e);let t=(Ve===`image`?Se:be).find(t=>t.id===e);if(!t)return;if(Ve===`image`){let e=t.supportedSizes||{};Et(e);let n=Object.keys(e);vt(n.map(e=>({value:e,label:e})));let r=n.includes(Ge)?Ge:n[0]||`2K`,i=Object.keys(e[r]||{});gt(i.map(e=>({value:e,label:e})));let a=i.includes(Ue)?Ue:i[0]||`1:1`;Ke(r),We(a);let o=e[r]?.[a]||``;if(o){let[e,t]=String(o).split(/x/i).map(Number);e>0&&t>0&&(Je(e),Ze(t))}return}let n=kt(e);Ne(n),_e(n.ratios[0]),ye(n.resolutions[0]),he(n.durations[0])};(0,S.useEffect)(()=>{a(),o({projectId:e,page:1,pageSize:100})},[e,a,o]);let jt=(0,S.useRef)(!1);(0,S.useEffect)(()=>{jt.current||u.length===0||(jt.current=!0,u.forEach(t=>{t.projectId===e&&t.status===`generating`&&(E(e=>({...e,[t.id]:`generating`})),nn(t.id)),t.projectId===e&&t.status===`optimizing`&&zt(t.id)}))},[u,e]);let Mt=(0,S.useRef)(new Set),Nt=(0,S.useRef)(null),Pt=(0,S.useRef)(null),Ft=e=>{Mt.current.add(e),Rt()},It=e=>{Mt.current.delete(e),Mt.current.size===0&&Lt()},Lt=()=>{Nt.current&&=(clearInterval(Nt.current),null),Pt.current&&=(Pt.current.abort(),null)},Rt=()=>{Nt.current||=setInterval(async()=>{try{Pt.current&&Pt.current.abort();let t=new AbortController;Pt.current=t;let n=await l5({projectId:e,page:1,pageSize:100,signal:t.signal});Pt.current=null;let r=Array.from(Mt.current),i=[];if(r.length>0){let e=u7.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});u7.setState({records:{...e,items:t}}),i.forEach(e=>{It(e)})}}catch(e){e.name}},3e3)},zt=e=>{Ft(e)},Bt=(0,S.useRef)(!1),Vt=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(Bt.current||u.length===0)return;let t=localStorage.getItem(`pending_optimize`);if(t)try{let{key:n,projectId:r,prompt:i,duration:a,engineId:o,genType:s,aspectRatio:c,resolution:l,imageSize:d,imageProportion:f,imagePx:p,includeMediaReferences:m,referenceIds:g,ts:v}=JSON.parse(t);if(Date.now()-v>300*1e3||r!==e){localStorage.removeItem(`pending_optimize`);return}if(Vt.current===n)return;let b=u.find(e=>e.projectId===r&&e.originalPrompt===i&&e.duration===a&&e.engineId===o&&String(e.genType||`video`)===String(s||`video`)&&String(e.aspectRatio||``)===String(c||``)&&String(e.resolution||``)===String(l||``)&&String(e.imageSize||``)===String(d||``)&&String(e.imageProportion||``)===String(f||``)&&String(e.imagePx||``)===String(p||``)&&!!e.includeMediaReferences==!!m&&JSON.stringify((e.references||[]).map(e=>e.upload_resource_id||e.url).filter(Boolean).sort())===JSON.stringify((g||[]).slice().sort())&&e.status===`prompt_optimized`&&new Date(e.createdAt).getTime()>v-1e4);b?(Bt.current=!0,localStorage.removeItem(`pending_optimize`),_(b),y(b.optimizedPrompt||``),Re(b.textCreditsCost),Be(b.textTokensUsed),h(!0),Z.success({content:`优化请求已恢复,消耗 ${b.textCreditsCost} 积分`,key:`recovery`})):Date.now()-v>3e4&&localStorage.removeItem(`pending_optimize`)}catch{localStorage.removeItem(`pending_optimize`)}},[u,e]);let Ht=r.find(t=>t.id===e),Ut=u.filter(t=>t.projectId===e),Wt=Ht?.name??`项目`,Gt=(0,S.useMemo)(()=>Ht&&oe[Ht.industry]||[],[Ht,oe]),Kt=d?.credits??0,qt=Kt>=dt(),Jt=async()=>{try{if(!e){Z.error(`项目ID为空,请先选择项目`);return}let t=await n.validateFields();if(!t.prompt||!t.prompt.trim()){Z.error(`请输入视频/图片描述`);return}if(!we){Z.error(`请选择生成引擎`);return}if(Ve===`video`&&(!ge||!ve)){Z.error(`请选择视频比例和分辨率`);return}p(!0);let r=Object.entries(ce).map(([e,t])=>`@${e}:${t}`),i=r.length>0?`${t.prompt}\n\n${r.join(`;`)}`:t.prompt,a=jse();localStorage.setItem(`pending_optimize`,JSON.stringify({key:a,projectId:e,prompt:i,duration:me,engineId:we,genType:Ve,aspectRatio:Ve===`video`?ge:``,resolution:Ve===`video`?ve:``,imageSize:Ve===`image`?Ge:``,imageProportion:Ve===`image`?Ue:``,imagePx:Ve===`image`?`${qe}x${Xe}`:``,includeMediaReferences:Ee,referenceIds:V.map(e=>e.upload_resource_id||e.url).filter(Boolean).sort(),ts:Date.now()})),Vt.current=a;let o=await s(e,{prompt:i,duration:Ve===`video`?me:void 0,genType:Ve,engineId:we,includeMediaReferences:Ee,aspectRatio:Ve===`video`?ge:void 0,resolution:Ve===`video`?ve:void 0,references:V.length>0?V:void 0,idempotencyKey:a,image_size:Ve===`image`?Ge:void 0,image_proportion:Ve===`image`?Ue:void 0,image_px:Ve===`image`?qe+`x`+Xe:void 0});localStorage.removeItem(`pending_optimize`),Vt.current=null,_(o.record),y(o.record.optimizedPrompt||``),Re(o.textCreditsCost),Be(o.textTokensUsed),h(!0),Z.success({content:`「${Wt}」提示词优化完成,消耗 ${o.textCreditsCost} 积分`,key:`optimize`})}catch(e){let t=e?.response?.data?.message||e?.message||`操作失败,请稍后重试`;Z.error(t)}finally{p(!1),localStorage.removeItem(`pending_optimize`),Vt.current=null}},Yt=(0,S.useRef)(new Set),Xt=(0,S.useRef)(null),Zt=(0,S.useRef)(null),Qt=e=>{Yt.current.add(e),tn()},$t=e=>{Yt.current.delete(e),Yt.current.size===0&&en()},en=()=>{Xt.current&&=(clearInterval(Xt.current),null),Zt.current&&=(Zt.current.abort(),null)},tn=()=>{Xt.current||=setInterval(async()=>{try{Zt.current&&Zt.current.abort();let t=new AbortController;Zt.current=t;let n=await l5({projectId:e,page:1,pageSize:100,signal:t.signal});Zt.current=null;let r=Array.from(Yt.current),i=[];if(r.length>0){let e=u7.getState().records,t=e.items.map(e=>{if(r.includes(e.id)){let t=n.items.find(t=>t.id===e.id);if(t){let n=T[e.id];return t.shouldPoll??t.status===`generating`?n!==`generating`&&E(t=>({...t,[e.id]:`generating`})):i.push(e.id),t}}return e});u7.setState({records:{...e,items:t}}),i.forEach(e=>{let t=n.items.find(t=>t.id===e);$t(e),t?.status===`completed`?(E(t=>({...t,[e]:`done`})),_(n=>n?.id===e?t:n),Z.success({content:`「${Wt}」视频生成完成!`,key:e,duration:5})):t?.status===`failed`&&(E(t=>({...t,[e]:`failed`})),_(n=>n?.id===e?t:n),Z.error({content:`「${Wt}」视频生成失败: ${t.errorMessage||`未知错误`}`,key:e,duration:5}))})}}catch(e){e.name}},5e3)},nn=e=>{Qt(e)};(0,S.useEffect)(()=>()=>{en(),Lt()},[]),(0,S.useEffect)(()=>{u.filter(e=>e.shouldPoll??e.status===`generating`).forEach(e=>{E(t=>({...t,[e.id]:`generating`})),nn(e.id)})},[u]);let rn=async e=>{w(t=>({...t,[e]:!0})),E(t=>({...t,[e]:`generating`})),Z.loading({content:`「${Wt}」正在提交视频生成...`,duration:0,key:e});try{let t=Ut.find(t=>t.id===e)||g;if(!t||t.canGenerate===!1)throw Error(t?.configFallbackHint||`该记录当前不可生成,请重新生成提词`);let n=t.id===g?.id?v:F[e];n&&n!==t.optimizedPrompt&&await h5(e,n),(await c(e)).status===`failed`?(E(t=>({...t,[e]:`failed`})),Z.error({content:`「${Wt}」提交失败`,key:e,duration:3})):(Z.success({content:`「${Wt}」已提交,正在生成中...`,key:e,duration:3}),nn(e))}catch(t){E(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{w(t=>({...t,[e]:!1}))}},an=e=>{let t=T[e.id];return A7({status:(t===`done`?`completed`:t)||e.status,pipelineStage:t?null:e.pipelineStage,clientStatus:t?null:e.clientStatus,shouldPoll:t?t===`generating`:e.shouldPoll,canGenerate:e.canGenerate,canRetry:e.canRetry})},on=e=>e.isActive?(0,$.jsx)(Jm,{style:{animation:`spinSlow 1s linear infinite`}}):e.isSuccess?(0,$.jsx)(V2,{}):e.isFailure?(0,$.jsx)(W2,{}):(0,$.jsx)(OB,{});return(0,$.jsxs)(`div`,{style:{margin:`-24px -32px -32px`,borderRadius:20,height:`calc(100vh - 8px)`,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)(X0,{}),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:Wt}),Ht&&(0,$.jsx)(TQ,{style:{background:`rgba(99, 102, 241, 0.08)`,border:`1px solid rgba(99, 102, 241, 0.15)`,color:`#6366f1`,borderRadius:6},children:ae[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)(TQ,{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:[`剩余 `,Kt,` 积分`]})]}),!m&&(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)(BF.Group,{defaultValue:`video`,buttonStyle:`solid`,onChange:Ot,children:[(0,$.jsxs)(BF.Button,{value:`video`,children:[(0,$.jsx)(V8,{style:{marginRight:6,fontSize:14}}),` `,`视频`]}),(0,$.jsxs)(BF.Button,{value:`image`,style:{zIndex:0},children:[(0,$.jsx)(F6,{style:{marginRight:6,fontSize:14}}),` `,`图片`]})]})]}),Ve===`video`&&[{icon:(0,$.jsx)(s$,{}),label:`描述视频+时长`,color:`#6366f1`},{icon:(0,$.jsx)(k8,{}),label:`AI智能优化`,color:`#8b5cf6`},{icon:(0,$.jsx)(r8,{}),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)),Ve===`image`&&[{icon:(0,$.jsx)(s$,{}),label:`描述图片+尺寸`,color:`#6366f1`},{icon:(0,$.jsx)(k8,{}),label:`AI智能优化`,color:`#8b5cf6`},{icon:(0,$.jsx)(r8,{}),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)(xH,{form:n,initialValues:{},children:[(0,$.jsx)(xH.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:[V.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`&&pe(`https://ceshi.apiforeign.minzhongzc.com${e.url}`)},children:e.type===`image`?(0,$.jsx)(xU,{src:`https://ceshi.apiforeign.minzhongzc.com${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`,display:`block`}}):(0,$.jsx)(M7,{src:`https://ceshi.apiforeign.minzhongzc.com${e.url}`})}),(0,$.jsx)(`div`,{className:`ref-delete`,onClick:n=>{n.stopPropagation(),m5(e.url).catch(()=>{}),H(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)(W2,{style:{color:`#fff`,fontSize:10}})})]},t)),(0,$.jsx)(T7,{accept:`image/*,video/*`,mediaType:Ve,onLocalSelect:e=>{e.forEach(async e=>{await lt(e)})},onHistorySelect:e=>{e.forEach(e=>{H(t=>[...t,{url:e.resourceUrl||e.previewUrl||e.displayUrl||``,type:e.resourceType,name:e.fileName||``}])}),Z.success(`成功添加${e.length}个历史记录`)},onPortraitSelect:e=>{e.forEach(e=>{H(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:U,tooltipTitle:`图片${V.filter(e=>e.type===`image`).length}/5,视频${V.filter(e=>e.type===`video`).length}/2`,maxImageCount:5,maxVideoCount:2,usedImageCount:V.filter(e=>e.type===`image`).length,usedVideoCount:V.filter(e=>e.type===`video`).length,usedVideoDuration:V.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:U?(0,$.jsx)(Jm,{style:{fontSize:18,color:`#6366f1`}}):(0,$.jsx)(PI,{style:{fontSize:18,color:`#94a3b8`}})})})]}),(0,$.jsx)(`div`,{style:{padding:`8px 16px 4px`},children:(0,$.jsx)(nW.TextArea,{ref:ie,value:W,onChange:e=>{let t=e.target.value;te(t),n.setFieldsValue({prompt:t});let r=t.lastIndexOf(`@`);if(r>=0){let e=t.slice(r+1);if(!e.includes(` `)&&!e.includes(`
+ `})]})})})]}),(0,$.jsx)(`div`,{className:`desktop-content`,style:{flex:1,background:`#f1f2f3`,borderRadius:`20px`,boxShadow:`0 4px 32px rgba(0, 0, 0, 0.06), 0 1px 8px rgba(0, 0, 0, 0.04)`,padding:`24px 32px 32px`,border:`1px solid rgba(0, 0, 0, 0.06)`,overflow:`auto`,minHeight:0},children:!we&&(0,$.jsx)(wt,{context:{openContactModal:()=>c(!0)}})})]}),(0,$.jsx)(`div`,{className:`mobile-header`,children:(0,$.jsxs)(`div`,{className:`mobile-header-content`,children:[(0,$.jsx)(`div`,{className:`mobile-menu-btn`,onClick:()=>ne(!0),children:(0,$.jsx)(n6,{style:{fontSize:20}})}),(0,$.jsx)(`div`,{className:`mobile-header-title`,children:me}),(0,$.jsx)(`div`,{className:`mobile-header-right`,children:(0,$.jsxs)(`div`,{className:`mobile-credits-badge`,onClick:()=>u(!0),children:[(0,$.jsx)(U8,{}),(0,$.jsx)(`span`,{children:n?.credits||0})]})})]})}),(0,$.jsx)(`div`,{className:`mobile-content`,children:we&&(0,$.jsx)(wt,{context:{openContactModal:()=>c(!0)}})}),(0,$.jsxs)(vV,{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:ge?(0,$.jsx)(`img`,{src:ge,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:me})]}),placement:`left`,onClose:()=>ne(!1),open:G,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)(Bw,{size:44,style:{background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,flexShrink:0},children:(0,$.jsx)(z8,{})}),(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)(U8,{style:{color:`#f59e0b`,marginRight:4}}),`积分: `,(0,$.jsx)(`span`,{style:{color:`#f59e0b`,fontWeight:600},children:n?.credits??0})]})]})]})}),(0,$.jsx)(a7,{data:Se}),Fe.map(e=>{let t=e.menu_type??e.menuType,n=Pe[e.id]&&Pe[e.id].length>0,r=e.path===Me,i=fe[e.id],a=o7[e.icon]||(0,$.jsx)(b3,{});return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mobile-menu-item ${r&&!n?`mobile-menu-item-active`:``} ${t===`group`?`mobile-menu-group`:``}`,onClick:()=>Ie(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:(Pe[e.id]||[]).map(e=>{let t=e.path===Me,n=o7[e.icon]||(0,$.jsx)(b3,{});return(0,$.jsxs)(`div`,{className:`mobile-menu-item mobile-submenu-item ${t?`mobile-menu-item-active`:``}`,onClick:()=>Ie(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`),ne(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#f59e0b`},children:(0,$.jsx)(U8,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:`积分明细`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{e(`/user-center?tab=orders`),ne(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#6366f1`},children:(0,$.jsx)(MV,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:`订单记录`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{e(`/messages`),ne(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#8b5cf6`},children:(0,$.jsx)(b2,{})}),(0,$.jsxs)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:[`消息中心`,W>0&&(0,$.jsx)(TQ,{color:`red`,style:{marginLeft:8,fontSize:11},children:W})]})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{o(!0),ne(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#0ea5e9`},children:(0,$.jsx)(V3,{})}),(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:()=>{u(!0),ne(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#fff`},children:(0,$.jsx)(PI,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#fff`,fontWeight:600},children:`充值积分`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{Ve(),ne(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#ef4444`},children:(0,$.jsx)(q3,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#ef4444`},children:`退出登录`})]})]})]}),(0,$.jsx)(PG,{title:(0,$.jsxs)(DV,{children:[(0,$.jsx)(d8,{}),`账号设置`]}),open:a,onCancel:()=>{o(!1),d.resetFields(),f.resetFields()},width:440,footer:null,children:(0,$.jsxs)(uL,{defaultActiveKey:`profile`,children:[(0,$.jsx)(uL.TabPane,{tab:`个人信息`,children:(0,$.jsxs)(xH,{form:f,layout:`vertical`,style:{marginTop:20},onValuesChange:()=>{},children:[(0,$.jsx)(xH.Item,{name:`username`,label:`用户名`,rules:[{required:!0,message:`请输入用户名`},{min:3,message:`用户名至少3位`}],children:(0,$.jsx)(nW,{placeholder:`请输入用户名`,size:`large`,prefix:(0,$.jsx)(z8,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(xH.Item,{children:(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:Be,style:{width:`100%`},children:`确认修改`})})]})},`profile`),(0,$.jsx)(uL.TabPane,{tab:`修改密码`,children:(0,$.jsxs)(xH,{form:d,layout:`vertical`,style:{marginTop:20},onValuesChange:()=>{},children:[(0,$.jsx)(xH.Item,{name:`oldPwd`,label:`原密码`,rules:[{required:!0,message:`请输入原密码`}],children:(0,$.jsx)(nW.Password,{placeholder:`请输入原密码`,size:`large`,prefix:(0,$.jsx)(V3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(xH.Item,{name:`newPwd`,label:`新密码`,rules:[{required:!0,message:`请输入新密码`},{min:6,message:`密码至少6位`}],children:(0,$.jsx)(nW.Password,{placeholder:`请输入新密码(至少6位)`,size:`large`,prefix:(0,$.jsx)(V3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(xH.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)(nW.Password,{placeholder:`请再次输入新密码`,size:`large`,prefix:(0,$.jsx)(V3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(xH.Item,{children:(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:ze,style:{width:`100%`},children:`确认修改`})})]})},`password`)]})}),(0,$.jsx)(Am,{theme:{token:{colorPrimary:`#6366f1`,borderRadius:8}},children:(0,$.jsx)(PG,{open:l,onCancel:()=>u(!1),footer:null,width:`100%`,centered:!1,style:{top:0,maxWidth:`100vw`,margin:0,paddingBottom:0},styles:{body:{padding:0,height:`100vh`,overflow:`auto`,scrollbarWidth:`none`,msOverflowStyle:`none`},mask:{background:`rgba(0,0,0,0.45)`},header:{display:`none`}},closable:!0,className:`recharge-fullscreen-modal`,title:null,closeIcon:(0,$.jsx)(ju,{style:{fontSize:18}}),children:(0,$.jsx)(`div`,{style:{width:`100%`,minHeight:`100vh`,background:`#f8fafc`,position:`relative`},children:(0,$.jsxs)(`div`,{style:{maxWidth:1200,margin:`0 auto`,padding:`24px`},children:[(0,$.jsxs)(`div`,{style:{marginBottom:24},children:[(0,$.jsxs)(`div`,{style:{textAlign:`center`,marginBottom:20},children:[(0,$.jsx)(Q.Title,{level:3,style:{marginBottom:8},children:`订阅套餐`}),(0,$.jsx)(Q.Text,{type:`secondary`,children:`订阅积分按自然月逐月发放;有效订阅只能升级同周期更高等级套餐,不能提前续费。`})]}),x&&(0,$.jsxs)(`div`,{style:{marginBottom:16,padding:`14px 16px`,borderRadius:12,background:`#fff`,border:`1px solid #e8eaed`,display:`flex`,alignItems:`center`,gap:16},children:[(0,$.jsx)(`div`,{style:{width:40,height:40,borderRadius:10,flexShrink:0,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#fff`,fontSize:18},children:(0,$.jsx)(_4,{})}),(0,$.jsxs)(`div`,{style:{flex:1},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:4},children:[(0,$.jsxs)(Q.Text,{strong:!0,style:{fontSize:14},children:[`当前订阅:`,x.tierCode||`订阅套餐`]}),(0,$.jsx)(TQ,{color:`purple`,style:{fontSize:11,margin:0,borderRadius:6},children:x.billingCycle===`monthly`?`月`:x.billingCycle===`quarterly`?`季`:`年`})]}),(0,$.jsxs)(`div`,{style:{fontSize:12,color:`#64748b`,marginBottom:2},children:[`已发放 `,(0,$.jsx)(`span`,{style:{color:`#6366f1`,fontWeight:600},children:x.grantedCount}),`/`,x.grantCount,` 期 · 每月 `,(0,$.jsx)(`span`,{style:{color:`#6366f1`,fontWeight:600},children:Number(x.monthlyGrantCredits||0).toLocaleString()}),` 积分`]}),(0,$.jsxs)(`div`,{style:{fontSize:11,color:`#94a3b8`},children:[`订阅到期:`,new Date(x.expiresAt).toLocaleString(`zh-CN`,{timeZone:`Asia/Shanghai`,hour12:!1})]})]}),(0,$.jsx)(_K,{percent:Math.round((x.grantedCount||0)/(x.grantCount||1)*100),size:`small`,strokeColor:{from:`#6366f1`,to:`#8b5cf6`},style:{width:80}})]}),(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,gap:16,marginBottom:20},children:(0,$.jsxs)(BF.Group,{value:D,onChange:e=>{O(e.target.value),m(null)},buttonStyle:`solid`,children:[(0,$.jsx)(BF.Button,{value:`monthly`,children:`月套餐`}),(0,$.jsx)(BF.Button,{value:`quarterly`,children:`季套餐`}),(0,$.jsx)(BF.Button,{value:`yearly`,children:`年套餐`})]})}),y.filter(e=>e.billingCycle===D).length===0?(0,$.jsx)(`div`,{style:{padding:48,textAlign:`center`,color:`#94a3b8`},children:`暂无可订阅套餐,请联系管理员配置并上架套餐。`}):(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`,gap:16,flexWrap:`wrap`},children:y.filter(e=>e.billingCycle===D).map((e,t)=>{let n=c7[t%c7.length],r=e.regularPrice||e.price,i=e.currentPrice??e.price,a=r&&Number(r)>Number(i),o=e.monthlyGrantCredits?`${Number(e.monthlyGrantCredits).toLocaleString()} 积分/月`:`${Number(e.grantCredits||0).toLocaleString()} 积分`;return(0,$.jsx)(`div`,{style:{width:250,display:`flex`,flexDirection:`column`,borderRadius:14,overflow:`hidden`,background:`#fff`,border:`1px solid #e8eaed`,position:`relative`,transition:`all 0.2s`},children:(0,$.jsxs)(`div`,{style:{padding:`16px 14px 12px`,background:`#fafbfc`,flex:1},children:[e.priceType===`first_purchase`&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8,background:`#fff2e8`,color:`#fa541c`,fontSize:11,padding:`2px 8px`,borderRadius:10,fontWeight:500},children:`首充价`}),e.priceType===`activity`&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8,background:`#fff1f0`,color:`#cf1322`,fontSize:11,padding:`2px 8px`,borderRadius:10,fontWeight:500},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:n.gradient,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#fff`,fontSize:14},children:n.icon}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14},children:e.name}),(0,$.jsx)(`div`,{style:{fontSize:11,color:`#94a3b8`},children:e.description||e.tierCode})]})]}),(0,$.jsxs)(`div`,{style:{marginBottom:8},children:[(0,$.jsxs)(`span`,{style:{fontSize:24,fontWeight:700,color:`#1a1a2e`},children:[`¥`,i]}),a&&(0,$.jsxs)(`span`,{style:{fontSize:13,color:`#94a3b8`,textDecoration:`line-through`,marginLeft:6},children:[`¥`,r]}),e.canUpgrade&&(0,$.jsx)(TQ,{color:`orange`,style:{marginLeft:6,fontSize:10,padding:`0 6px`,lineHeight:`16px`},children:`升级价`})]}),e.canUpgrade&&Number(e.deductionAmount||0)>0&&(0,$.jsxs)(`div`,{style:{fontSize:11,color:`#94a3b8`,marginBottom:4},children:[`目标套餐¥`,e.targetPrice,`,抵扣未生效¥`,e.deductionAmount]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,fontSize:12,color:`#64748b`},children:[(0,$.jsx)(`span`,{children:o}),(0,$.jsxs)(`span`,{children:[`共 `,e.grantCount,` 次`]})]}),e.unavailableReason&&(0,$.jsx)(`div`,{style:{padding:`6px 14px`,fontSize:13,color:`#dc2626`,background:`#fef2f2`,marginTop:`20px`},children:e.unavailableReason}),(0,$.jsx)(`div`,{style:{padding:`10px 14px`,borderTop:`1px solid #f0f0f0`},children:(0,$.jsx)(X,{block:!0,size:`small`,disabled:e.canPurchase===!1||!B.alipay&&!B.wechat,loading:N&&p===e.id,onClick:()=>{m(e.id),Ue(e.id,e)},style:{borderRadius:8,background:e.canPurchase===!1?`#f5f5f5`:`linear-gradient(135deg, #6366f1, #8b5cf6)`,color:e.canPurchase===!1?`#94a3b8`:`#fff`,border:`none`,fontWeight:600,height:34,fontSize:13},children:e.canPurchase===!1?`不可购买`:`立即订阅`})}),e.features&&e.features.length>0&&(0,$.jsx)(`div`,{style:{marginTop:10,paddingTop:10,borderTop:`1px dashed #e2e8f0`},children:e.features.map((e,t)=>(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,fontSize:12,color:`#64748b`,lineHeight:`20px`,marginBottom:2},children:[(0,$.jsx)(Tu,{style:{color:`#4c49cc`,fontSize:14,flexShrink:0,marginTop:2}}),(0,$.jsx)(`span`,{style:{fontSize:14,margin:`4px`},children:e})]},t))}),(e.priceType===`first_purchase`||e.priceType===`activity`)&&(0,$.jsxs)(`div`,{style:{padding:`10px 14px`,background:`#fffbe6`,borderTop:`1px solid #fff1b8`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:6},children:[(0,$.jsx)(V4,{style:{color:`#fa8c16`,fontSize:12}}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#d46b08`,fontWeight:600},children:`限时活动`})]}),e.features?.slice(0,3).map((e,t)=>(0,$.jsxs)(`div`,{style:{fontSize:11,color:`#8c6d1f`,lineHeight:`18px`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[`· `,e]},t))]})]})},e.id)})})]}),(0,$.jsx)(`div`,{style:{marginBottom:24,background:`#fff`,borderRadius:12,padding:24,border:`1px solid #e8eaed`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsx)(U8,{style:{color:`#6366f1`,fontSize:24}}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Title,{level:4,style:{margin:0},children:`积分充值`}),(0,$.jsxs)(Q.Text,{type:`secondary`,style:{fontSize:12},children:[`当前积分:`,(0,$.jsx)(`span`,{style:{color:`#6366f1`,fontWeight:600},children:n?.credits??0})]})]})]}),(0,$.jsx)(X,{type:`primary`,size:`large`,icon:(0,$.jsx)(p8,{}),onClick:()=>E(!0),style:{borderRadius:10,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`,height:42,paddingLeft:20,paddingRight:20},children:`积分商城`})]})}),(0,$.jsxs)(`div`,{style:{marginBottom:24,borderRadius:16,overflow:`hidden`,background:`#fff`,border:`1px solid #e8eaed`},children:[(0,$.jsx)(`div`,{style:{padding:`24px 24px 0`,textAlign:`center`},children:(0,$.jsx)(Q.Title,{level:3,style:{color:`#1a1a2e`,marginBottom:16},children:`常见问题`})}),(0,$.jsx)(i_,{accordion:!0,expandIcon:({isActive:e})=>e?(0,$.jsx)(PR,{style:{color:`#64748b`}}):(0,$.jsx)(jC,{style:{color:`#64748b`}}),style:{background:`#fff`,border:`none`},items:mse.map(e=>({key:e.key,label:(0,$.jsx)(`span`,{style:{color:`#1a1a2e`,fontSize:14,fontWeight:500},children:e.label}),children:e.children,style:{background:`#fff`,borderBottom:`1px solid #e8eaed`}}))}),(0,$.jsxs)(`div`,{style:{padding:`24px`,borderTop:`1px solid #e8eaed`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,cursor:`pointer`,transition:`background 0.2s`},onClick:()=>{c(!0)},onMouseEnter:e=>{e.currentTarget.style.background=`#f8fafc`},onMouseLeave:e=>{e.currentTarget.style.background=`#fff`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,$.jsx)(a6,{style:{color:`#64748b`,fontSize:18}}),(0,$.jsx)(`span`,{style:{color:`#1a1a2e`,fontSize:14,fontWeight:500},children:`联系客服`})]}),(0,$.jsx)(zg,{style:{color:`#64748b`,fontSize:14}})]})]})]})})})}),(0,$.jsxs)(PG,{title:(0,$.jsxs)(DV,{children:[(0,$.jsx)(U8,{}),`积分商城`]}),open:T,onCancel:()=>E(!1),footer:null,width:720,closable:!0,styles:{body:{padding:20}},children:[(0,$.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:16},children:(0,$.jsxs)(DV,{children:[(0,$.jsx)(Q.Text,{children:`当前积分:`}),(0,$.jsx)(Q.Text,{strong:!0,style:{color:`#6366f1`,fontSize:18},children:n?.credits??0})]})}),(0,$.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(160px, 1fr))`,gap:12,maxHeight:400,overflowY:`auto`,paddingRight:4},children:[_.length===0&&(0,$.jsx)(`div`,{style:{width:`100%`,padding:32,textAlign:`center`,color:`#94a3b8`},children:`暂无可购买的积分增值包`}),_.map((e,t)=>{let n=s7[t%s7.length],r=Number(e.grantCredits||0),i=e.currentPrice||e.price;return(0,$.jsxs)(`div`,{style:{borderRadius:12,overflow:`hidden`,background:`#fff`,border:p===e.id?`2px solid #e8eaed`:`1px solid #e8eaed`,position:`relative`,transition:`all 0.2s`},children:[e.description&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:-1,right:8,background:`#fff2e8`,color:`#fa541c`,fontSize:11,padding:`2px 8px`,borderRadius:10,fontWeight:500},children:e.description}),(0,$.jsxs)(`div`,{style:{padding:`12px 10px 8px`,background:`#fafbfc`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:4},children:[(0,$.jsx)(`div`,{style:{width:32,height:32,borderRadius:8,flexShrink:0,background:n.gradient,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:14,color:`#fff`},children:n.icon}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:12},children:e.name}),(0,$.jsxs)(`div`,{style:{fontSize:11,fontWeight:600,color:`#6366f1`},children:[r.toLocaleString(),` 积分`]})]})]}),(0,$.jsxs)(`div`,{style:{marginTop:4,fontSize:18,fontWeight:700,color:`#1a1a2e`},children:[`¥`,i]}),(0,$.jsxs)(Q.Text,{type:`secondary`,style:{fontSize:10},children:[`有效期 `,Number(e.validityMonths||1),` 个月`]})]}),(0,$.jsx)(`div`,{style:{padding:`6px 10px`,borderTop:`1px solid #f0f0f0`},children:(0,$.jsx)(X,{block:!0,size:`small`,disabled:!B.alipay&&!B.wechat,loading:N&&p===e.id,onClick:()=>{m(e.id),Ue(e.id,e)},style:{borderRadius:6,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,color:`#fff`,border:`none`,fontWeight:600,height:28,fontSize:12},children:`购买`})})]},e.id)})]})]}),(0,$.jsx)(PG,{open:k,onCancel:async()=>{if(He(),z.current){try{await T5(z.current)}catch{}z.current=null}localStorage.removeItem(ee),A(!1),U(null)},footer:(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`,padding:`8px 0`},children:(0,$.jsx)(X,{danger:!0,size:`large`,onClick:async()=>{if(He(),z.current){try{await T5(z.current)}catch{}z.current=null}localStorage.removeItem(ee),A(!1),U(null),Z.info(`已取消支付`)},style:{borderRadius:10,minWidth:140,fontSize:14},children:`取消支付`})}),width:700,closable:!0,title:(0,$.jsxs)(Q.Title,{level:5,style:{margin:0},children:[`开通`,H?.title||`会员服务`,H?.credits?` ${Number(H.credits).toLocaleString()} 积分`:``]}),styles:{body:{padding:0,borderRadius:16,overflow:`hidden`},footer:{borderRadius:16,borderTop:`1px solid #f0f0f0`,padding:`16px 24px`}},children:(0,$.jsxs)(`div`,{style:{display:`flex`,minHeight:380},children:[(0,$.jsxs)(`div`,{style:{flex:1,padding:24,background:`#fff`,borderRight:`1px solid #f0f0f0`},children:[(0,$.jsxs)(`div`,{style:{marginBottom:20},children:[(0,$.jsx)(Q.Text,{style:{fontSize:13,color:`#64748b`,marginBottom:8,display:`block`},children:`商品信息`}),(0,$.jsxs)(`div`,{style:{padding:14,background:`#f8fafc`,borderRadius:10,border:`1px solid #e2e8f0`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:6},children:[(0,$.jsx)(`div`,{style:{fontSize:14,fontWeight:600,color:`#1a1a2e`},children:H?.tierName||H?.title||`积分充值`}),H?.periodLabel&&(0,$.jsx)(TQ,{color:`purple`,style:{fontSize:11,margin:0,borderRadius:6,padding:`0 6px`},children:H.periodLabel})]}),(0,$.jsxs)(`div`,{style:{fontSize:22,fontWeight:700,color:`#6366f1`,lineHeight:1.4},children:[`¥`,H?.price||0,H?.originalPrice&&Number(H.originalPrice)>Number(H?.price||0)&&(0,$.jsxs)(`span`,{style:{fontSize:13,color:`#94a3b8`,textDecoration:`line-through`,marginLeft:8,fontWeight:400},children:[`¥`,H.originalPrice]})]})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{style:{fontSize:13,color:`#64748b`,marginBottom:8,display:`block`},children:`订单明细`}),(0,$.jsxs)(`div`,{style:{padding:12,background:`#f8fafc`,borderRadius:8,border:`1px solid #e2e8f0`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,padding:`4px 0`,fontSize:12},children:[(0,$.jsx)(`span`,{style:{color:`#64748b`},children:`积分数量`}),(0,$.jsx)(`span`,{style:{color:`#1a1a2e`},children:H?.credits==null?`-`:`${Number(H.credits).toLocaleString()} 积分`})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,padding:`4px 0`,fontSize:12},children:[(0,$.jsx)(`span`,{style:{color:`#64748b`},children:`续费信息`}),(0,$.jsx)(`span`,{style:{color:`#1a1a2e`},children:H?.isSubscription?`次年按原价 可随时取消`:`一次性购买`})]}),(0,$.jsx)(`div`,{style:{height:1,background:`#e2e8f0`,margin:`8px 0`}}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,padding:`4px 0`,fontSize:12},children:[(0,$.jsx)(`span`,{style:{color:`#64748b`},children:`商品原价`}),(0,$.jsxs)(`span`,{style:{color:`#1a1a2e`},children:[`¥`,H?.originalPrice||H?.price||0,`.00`]})]}),(0,$.jsx)(`div`,{style:{height:1,background:`#e2e8f0`,margin:`8px 0`}}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`4px 0`},children:[(0,$.jsx)(`span`,{style:{fontSize:14,fontWeight:500,color:`#1a1a2e`},children:`应付金额`}),(0,$.jsxs)(`span`,{style:{fontSize:18,fontWeight:700,color:`#6366f1`},children:[`¥`,H?.price||0,`.00`]})]})]})]})]}),(0,$.jsxs)(`div`,{style:{width:280,padding:24,background:`#fff`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:12},children:[H?.method===`alipay`?(0,$.jsx)(R0,{style:{fontSize:18,color:`#1677ff`}}):(0,$.jsx)(K8,{style:{fontSize:18,color:`#07c160`}}),(0,$.jsxs)(`span`,{style:{fontSize:14,color:`#64748b`},children:[`请用`,H?.method===`alipay`?`支付宝`:`微信`,`扫码支付`]})]}),(0,$.jsx)(`div`,{style:{width:180,height:180,borderRadius:12,border:`1px solid #f0f0f0`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#fff`},children:H?.qrCode&&(0,$.jsx)(F0,{value:H.qrCode,size:150,level:`M`})}),(0,$.jsxs)(`div`,{style:{marginTop:12,fontSize:12,color:`#94a3b8`},children:[F,`秒后二维码失效`]}),(0,$.jsxs)(`div`,{style:{marginTop:8,fontSize:11,color:`#94a3b8`,textAlign:`center`},children:[`开通即代表同意`,(0,$.jsx)(`br`,{}),`《用户服务协议》`]})]})]})}),(0,$.jsx)(dse,{}),(0,$.jsx)(`div`,{className:`contact-button-wrapper`,style:{right:`${oe.x}px`,bottom:`${window.innerHeight-oe.y}px`},children:(0,$.jsxs)(`div`,{style:{position:`relative`},children:[(0,$.jsx)(`div`,{className:`contact-tooltip`,style:{opacity:+!!K},children:`联系我们`}),(0,$.jsx)(`button`,{className:`contact-button ${ce?`dragging`:``}`,onMouseEnter:()=>re(!0),onMouseLeave:()=>re(!1),onMouseDown:Oe,onMouseUp:Ae,children:(0,$.jsx)(a6,{style:{fontSize:20}})})]})}),(0,$.jsx)(PG,{title:(0,$.jsxs)(DV,{children:[(0,$.jsx)(a6,{}),`联系我们`]}),open:s,onCancel:()=>{c(!1),ie.resetFields()},footer:null,width:480,className:`contact-modal`,children:(0,$.jsxs)(`div`,{style:{marginTop:8},children:[(0,$.jsxs)(xH,{form:ie,layout:`vertical`,children:[(0,$.jsx)(xH.Item,{name:`name`,label:`姓名`,rules:[{required:!0,message:`请输入姓名`}],children:(0,$.jsx)(nW,{placeholder:`请输入您的姓名`,size:`large`})}),(0,$.jsx)(xH.Item,{name:`phone`,label:`手机号`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1[3-9]\d{9}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(nW,{placeholder:`请输入您的手机号`,size:`large`})}),(0,$.jsx)(xH.Item,{name:`companyName`,label:`公司名称`,rules:[{required:!0,message:`请输入公司名称`}],children:(0,$.jsx)(nW,{placeholder:`请输入公司名称`,size:`large`})}),(0,$.jsx)(xH.Item,{name:`industry`,label:`您的行业`,rules:[{required:!0,message:`请输入您的行业`}],children:(0,$.jsx)(nW,{placeholder:`请输入您的行业`,size:`large`})}),(0,$.jsx)(xH.Item,{name:`message`,label:`留言(选填)`,children:(0,$.jsx)(nW.TextArea,{placeholder:`请输入您的需求或问题`,rows:3,style:{borderRadius:10}})})]}),(0,$.jsxs)(`div`,{style:{marginTop:16,display:`flex`,gap:12},children:[(0,$.jsx)(X,{size:`large`,onClick:()=>{c(!1),ie.resetFields()},style:{borderRadius:10,flex:1},children:`取消`}),(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:Ge,loading:ae,style:{borderRadius:10,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,flex:1},children:`提交`})]})]})})]})},gse=`http://localhost:8000/api`,_se=()=>{let{checkAuth:e}=n7(),[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||`智创`,siteLogo:t.siteLogo||``}}}catch{}return{siteName:`智创`,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)(!1),[B,V]=(0,S.useState)(``),[H,U]=(0,S.useState)(``),ee=Ye(),{login:W}=n7(),[te]=xH.useForm(),[G]=xH.useForm(),[ne]=xH.useForm();(0,S.useEffect)(()=>{_5().then(e=>{N(e.siteName),F(e.siteLogo),L(e.loginBgVideo||``),V(e.userAgreementPrivacyUrl),U(e.siteCopyright)}).catch(()=>{})},[]),(0,S.useEffect)(()=>{l===`register`&&i(`register`)},[l]),(0,S.useEffect)(()=>{if(s.get(`kicked_out`)===`1`){Z.warning(`您的账号已在其他设备登录,请重新登录`);let e=new URL(window.location.href);e.searchParams.delete(`kicked_out`),window.history.replaceState({},``,e.toString())}},[s]);let K=()=>{if(c)try{ee(decodeURIComponent(c));return}catch{}ee(`/home`)},re=()=>m?!0:(Z.warning(`请先阅读并同意用户协议及隐私政策`),!1),ie=async()=>{if(re())try{let t=await te.validateFields();await W(t.phone,t.password,void 0,t.rememberMe),Z.success(`登录成功,欢迎回来`),await e(),K()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t)}},ae=async()=>{if(re())try{let t=G.getFieldsValue();if(!t.phone||!t.code){Z.error(`请填写手机号和验证码`);return}n(!0),await gae(t.phone,t.code),Z.success(`登录成功,欢迎回来`),await e(),K()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t)}finally{n(!1)}},q=async()=>{if(re())try{let t=await ne.validateFields();n(!0),await _ae(t.phone,t.regCode,t.password),Z.success(`注册成功`),await e(),K()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`注册失败`;Z.error(t)}finally{n(!1)}},oe=(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 se=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 v5(e,n),oe(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)}},ce=async(e=!1)=>{let t=r===`register`?ne.getFieldValue(`phone`):G.getFieldValue(`phone`);try{let e=``;e=r===`register`?`register`:`login`,await v5(t,e),r===`register`?(y(!0),oe(p,!0)):(x(!0),oe(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)}},le=e=>{o(e),i(e),d(0),p(0),x(!1),y(!1),_(!1),O(!1),A(!1),w(e=>e+1),e===`password`?te.resetFields():G.resetFields()},ue={background:`#fff`,border:`1.5px solid #e2e8f0`,color:`#1e293b`,borderRadius:10,fontSize:14},de=e=>{if(!e){Z.warning(`暂未上传协议文件`);return}e.startsWith(`http://`)||e.startsWith(`https://`)?window.open(e,`_blank`):window.open(`${gse.replace(/\/api$/,``)}${e}`,`_blank`)};return(0,$.jsxs)(`div`,{className:`login-page`,children:[(0,$.jsx)(vse,{src:I,onReady:()=>z(!0)}),(0,$.jsx)(`div`,{className:`login-bg-overlay`,style:{opacity:+!!R}}),(0,$.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,opacity:+!!R,transition:`opacity 0.5s ease`,pointerEvents:R?`auto`:`none`},children:[(0,$.jsx)(`div`,{className:`login-slogan`,children:(0,$.jsx)(`span`,{className:`login-slogan-text`,children:`AI赋能创意,素材触手可及`})}),(0,$.jsx)(`div`,{className:`login-center`,children:(0,$.jsxs)(fL,{className:`login-card`,styles:{body:{padding:`32px 32px`}},children:[(0,$.jsx)(`div`,{className:`login-card-header`,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:20,color:`#fff`}})}),(0,$.jsx)(`span`,{className:`login-site-name`,children:M})]})}),(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:()=>le(e),className:`login-tab ${a===e?`login-tab-active`:``}`,children:e===`password`?`密码登录`:`验证码登录`},e))}),r===`password`&&(0,$.jsxs)(xH,{form:te,size:`large`,layout:`vertical`,onFinish:ie,children:[(0,$.jsx)(xH.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(nW,{prefix:(0,$.jsx)(c6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,style:ue})}),(0,$.jsx)(xH.Item,{name:`password`,rules:[{required:!0,message:`请输入密码`}],children:(0,$.jsx)(nW.Password,{prefix:(0,$.jsx)(V3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入密码`,style:ue})}),(0,$.jsx)(xH.Item,{name:`rememberMe`,valuePropName:`checked`,style:{marginBottom:12},children:(0,$.jsx)(cR,{children:`记住我的登录状态`})}),(0,$.jsx)(xH.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)(xH,{form:G,size:`large`,layout:`vertical`,children:[(0,$.jsx)(xH.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(nW,{prefix:(0,$.jsx)(c6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,maxLength:11,style:ue})}),(0,$.jsx)(xH.Item,{name:`code`,rules:[{required:!0,message:`请输入验证码`}],children:(0,$.jsxs)(DV.Compact,{style:{width:`100%`},children:[(0,$.jsx)(nW,{prefix:(0,$.jsx)(a8,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入验证码`,maxLength:6,disabled:!b,style:{...ue,borderRadius:`10px 0 0 10px`,flex:1}}),(0,$.jsx)(X,{disabled:u>0,style:{fontSize:14,fontWeight:400},onClick:()=>{k?(x(!1),_(!0),w(e=>e+1)):g&&!b?(E(!0),setTimeout(()=>E(!1),500)):se(G.getFieldValue(`phone`))},className:`login-code-btn`,children:u>0?`${u}s`:k?`重新发送`:`获取验证码`})]})}),g&&(0,$.jsx)(xH.Item,{style:{marginBottom:12},children:(0,$.jsx)(l7,{onSuccess:ce,isVerified:b,shake:T})},C),(0,$.jsx)(xH.Item,{style:{marginBottom:12},children:(0,$.jsx)(X,{type:`primary`,onClick:ae,loading:t,block:!0,className:`login-submit-btn`,children:`登 录`})})]}),r===`register`&&(0,$.jsxs)(xH,{form:ne,size:`large`,layout:`vertical`,children:[(0,$.jsx)(xH.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(nW,{prefix:(0,$.jsx)(c6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,maxLength:11,style:ue})}),(0,$.jsx)(xH.Item,{name:`regCode`,rules:[{required:!0,message:`请输入验证码`}],children:(0,$.jsxs)(DV.Compact,{style:{width:`100%`},children:[(0,$.jsx)(nW,{prefix:(0,$.jsx)(a8,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入验证码`,maxLength:6,disabled:!v,style:{...ue,borderRadius:`10px 0 0 10px`,flex:1}}),(0,$.jsx)(X,{disabled:f>0,style:{fontSize:14,fontWeight:400},onClick:()=>{D?(y(!1),_(!0),w(e=>e+1)):g&&!v?(E(!0),setTimeout(()=>E(!1),500)):se(ne.getFieldValue(`phone`),!0)},className:`login-code-btn`,children:f>0?`${f}s`:D?`重新发送`:`获取验证码`})]})}),g&&(0,$.jsx)(xH.Item,{style:{marginBottom:12},children:(0,$.jsx)(l7,{onSuccess:ce,isVerified:v,shake:T})},C),(0,$.jsx)(xH.Item,{name:`password`,rules:[{required:!0,message:`请设置密码`},{min:6,message:`密码至少6位`}],children:(0,$.jsx)(nW.Password,{prefix:(0,$.jsx)(V3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请设置密码(至少6位)`,style:ue})}),(0,$.jsx)(xH.Item,{style:{marginBottom:12},children:(0,$.jsx)(X,{type:`primary`,onClick:q,loading:t,block:!0,className:`login-submit-btn`,children:`注 册`})})]}),(0,$.jsx)(`div`,{className:`login-agreement`,children:(0,$.jsx)(cR,{checked:m,onChange:e=>h(e.target.checked),children:(0,$.jsxs)(`span`,{className:`login-agreement-text`,children:[`我已阅读并同意`,(0,$.jsx)(`span`,{onClick:e=>{e.stopPropagation(),de(B)},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),ne.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:`没有账号?立即注册`})})]})}),H&&(0,$.jsx)(`div`,{className:`login-copyright-wrapper`,children:(0,$.jsx)(`div`,{className:`login-copyright`,children:H})})]})]})},vse=({src:e,onReady:t})=>{let[n,r]=(0,S.useState)(!1),i=S.useRef(null),a=()=>{n||(r(!0),i.current?.play().catch(()=>{}),t())};if(!e)return t(),null;let o=e.toLowerCase().endsWith(`.gif`),s=e.toLowerCase().endsWith(`.webp`);return o||s?(0,$.jsx)(`img`,{className:`login-bg-video`,src:e,alt:``,onLoad:a,onError:a}):(0,$.jsxs)($.Fragment,{children:[!n&&(0,$.jsx)(`div`,{className:`login-bg-video login-bg-placeholder`}),(0,$.jsx)(`video`,{ref:i,className:`login-bg-video`,style:{opacity:+!!n},autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:`auto`,onCanPlayThrough:a,onCanPlay:a,onError:a,children:(0,$.jsx)(`source`,{src:e,type:e.endsWith(`.webm`)?`video/webm`:e.endsWith(`.mov`)?`video/quicktime`:`video/mp4`})})]})},l7=({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:[]}),u7=X8((e,t)=>({projects:[],records:yse(),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 bae(),loading:!1})}catch{e({loading:!1})}},createProject:async(n,r)=>{let i=await xae(n,r);return e({projects:[i,...t().projects]}),i},deleteProject:async n=>{await Sae(n),e({projects:t().projects.filter(e=>e.id!==n)})},fetchRecords:async(t={})=>{e({loading:!0});try{e({records:await l5(t),loading:!1})}catch{e({loading:!1})}},optimizePrompt:async(n,r)=>{let i=await Cae(n,r);try{await n7.getState().checkAuth()}catch{}let a=t().records,o=a.items.findIndex(e=>e.id===i.record.id),s=o>=0?a.items.map(e=>e.id===i.record.id?i.record:e):[i.record,...a.items];return e({records:{...a,total:o>=0?a.total:a.total+1,items:s}}),i},generateVideo:async n=>{let r=await Nae(n);try{await n7.getState().checkAuth()}catch{}let i=t().records;return e({records:{...i,items:i.items.map(e=>e.id===n?r:e)}}),r},retryGeneration:async n=>{let r=await Pae(n);try{await n7.getState().checkAuth()}catch{}let i=t().records;return e({records:{...i,items:i.items.map(e=>e.id===n?r:e)}}),r},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:[]})})),d7=480;function f7(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+d7*6e4,i=new Date(r);return`${i.getUTCFullYear()}-${p7(i.getUTCMonth()+1)}-${p7(i.getUTCDate())} ${p7(i.getUTCHours())}:${p7(i.getUTCMinutes())}`}let d=l===`Z`?u+d7*6e4:u,f=new Date(d);return`${f.getUTCFullYear()}-${p7(f.getUTCMonth()+1)}-${p7(f.getUTCDate())} ${p7(f.getUTCHours())}:${p7(f.getUTCMinutes())}`}function p7(e){return e<10?`0${e}`:String(e)}function bse(e){if(!e)return`-`;let t=e.match(/\.(\d{1,6})/)?.[1]?.padEnd(6,`0`)||`000000`,n=xse(e);return n===`-`?n:`${n}.${t}`}function xse(e){let t=e.trim(),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.replace(`T`,` `);let[,r,i,a,o,s,c,l]=n,u=Date.UTC(+r,i-1,+a,+o,+s,+c),d=u;if(l===`Z`)d+=d7*6e4;else if(l){let e=l[0]===`+`?1:-1,t=l.slice(1).replace(`:`,``);d=u-e*(t.slice(0,2)*60+ +t.slice(2,4))*6e4+d7*6e4}let f=new Date(d);return`${f.getUTCFullYear()}-${p7(f.getUTCMonth()+1)}-${p7(f.getUTCDate())} ${p7(f.getUTCHours())}:${p7(f.getUTCMinutes())}:${p7(f.getUTCSeconds())}`}var m7=[`#f97316`,`#3b82f6`,`#8b5cf6`,`#10b981`,`#eab308`,`#6366f1`,`#ef4444`,`#06b6d4`,`#64748b`,`#78716c`],h7={ShoppingCartOutlined:(0,$.jsx)(p8,{}),BookOutlined:(0,$.jsx)(C2,{}),HomeOutlined:(0,$.jsx)(b3,{}),FireOutlined:(0,$.jsx)(V4,{}),RocketOutlined:(0,$.jsx)(r8,{}),SkinOutlined:(0,$.jsx)(kie,{}),CompassOutlined:(0,$.jsx)(d4,{}),HeartOutlined:(0,$.jsx)(d3,{}),CarOutlined:(0,$.jsx)(F2,{}),CameraOutlined:(0,$.jsx)(M2,{}),CloudOutlined:(0,$.jsx)(q2,{}),StarOutlined:(0,$.jsx)(C8,{}),TrophyOutlined:(0,$.jsx)(N8,{}),ThunderboltOutlined:(0,$.jsx)(k8,{}),BulbOutlined:(0,$.jsx)(k2,{}),CoffeeOutlined:(0,$.jsx)(a4,{}),CrownOutlined:(0,$.jsx)(_4,{}),DashboardOutlined:(0,$.jsx)(b4,{}),FlagOutlined:(0,$.jsx)(W4,{}),GlobalOutlined:(0,$.jsx)(c3,{}),GiftOutlined:(0,$.jsx)(a3,{}),LaptopOutlined:(0,$.jsx)(k3,{}),MobileOutlined:(0,$.jsx)(c6,{}),MonitorOutlined:(0,$.jsx)(d6,{}),PayCircleOutlined:(0,$.jsx)(E6,{}),PictureOutlined:(0,$.jsx)(F6,{}),PlayCircleOutlined:(0,$.jsx)(W6,{}),SafetyOutlined:(0,$.jsx)(a8,{}),ShoppingOutlined:(0,$.jsx)(Tie,{}),SmileOutlined:(0,$.jsx)(v8,{}),SoundOutlined:(0,$.jsx)(x8,{}),TagOutlined:(0,$.jsx)(Rie,{}),TeamOutlined:(0,$.jsx)(D8,{}),ToolOutlined:(0,$.jsx)(Hie,{}),TruckOutlined:(0,$.jsx)(qie,{}),VideoCameraOutlined:(0,$.jsx)(V8,{}),WalletOutlined:(0,$.jsx)(U8,{}),BankOutlined:(0,$.jsx)(m2,{}),BuildOutlined:(0,$.jsx)(E2,{}),ExperimentOutlined:(0,$.jsx)(k4,{}),HighlightOutlined:(0,$.jsx)(m3,{}),IdcardOutlined:(0,$.jsx)(C3,{}),MedicineBoxOutlined:(0,$.jsx)($3,{}),ReadOutlined:(0,$.jsx)(lie,{}),RestOutlined:(0,$.jsx)(die,{}),SketchOutlined:(0,$.jsx)(Die,{}),SolutionOutlined:(0,$.jsx)(Mie,{})},Sse=()=>{let[e,t]=(0,S.useState)(!1),[n]=xH.useForm(),r=Ye(),{projects:i,fetchProjects:a,createProject:o,deleteProject:s}=u7(),[c,l]=(0,S.useState)([]);(0,S.useEffect)(()=>{a(),S5().then(l).catch(()=>{})},[]);let u=Object.fromEntries(c.map((e,t)=>[e.key,{label:e.label,color:m7[t%m7.length],icon:e.icon||`AppstoreOutlined`}]));return(0,$.jsxs)(`div`,{className:`content_box`,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)(MV,{}),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)(PI,{}),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)(lC,{image:lC.PRESENTED_IMAGE_SIMPLE,description:`还没有项目,创建您的第一个视频项目`,style:{padding:`60px 0`},children:(0,$.jsx)(X,{type:`primary`,icon:(0,$.jsx)(PI,{}),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:h7[u[e.industry]?.icon]||(0,$.jsx)(W0,{})}),(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)(TQ,{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)(TB,{style:{fontSize:12,color:`#94a3b8`}}),(0,$.jsxs)(`span`,{className:`date-display`,translate:`no`,style:{fontSize:12,color:`#94a3b8`},children:[`创建于 `,f7(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)(W6,{}),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)(RG,{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)(zQ,{}),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)(PG,{title:(0,$.jsxs)(DV,{children:[(0,$.jsx)(W0,{}),`新建项目`]}),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)(xH,{form:n,layout:`vertical`,style:{marginTop:20},children:[(0,$.jsx)(xH.Item,{name:`name`,label:`项目名称`,rules:[{required:!0,message:`请输入项目名称`}],children:(0,$.jsx)(nW,{placeholder:`例如:618电商大促宣传片`,prefix:(0,$.jsx)(xX,{}),size:`large`})}),(0,$.jsx)(xH.Item,{name:`industry`,label:`所属行业`,rules:[{required:!0,message:`请选择行业`}],children:(0,$.jsx)(zC,{placeholder:`选择项目所属行业`,size:`large`,children:c.map((e,t)=>(0,$.jsx)(zC.Option,{value:e.key,children:(0,$.jsxs)(DV,{children:[h7[e.icon]||(0,$.jsx)(W0,{}),` `,e.label]})},e.key))})})]})})]})};async function g7(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:_7}=Q,Cse={real_person:{title:`选择真人素材库`,empty:`暂无可选 Active 真人素材`,projectError:`加载真人素材项目失败`,assetError:`加载真人素材失败`,fallbackName:`真人素材`},aigc_virtual:{title:`选择虚拟素材库`,empty:`暂无可选 Active 虚拟素材`,projectError:`加载虚拟素材项目失败`,assetError:`加载虚拟素材失败`,fallbackName:`虚拟素材`}},v7=e=>e?e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)||e.startsWith(`blob:`)?e:`${`https://ceshi.apiforeign.minzhongzc.com`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`:``,wse=e=>e.assetType===`Video`?v7(e.videoCoverUrl||e.previewUrl||e.displayUrl||e.providerUrl):v7(`static`+(e.previewUrl||e.displayUrl||e.videoCoverUrl||e.providerUrl)+`?w=300&q=50`),Tse=e=>{let t=Number(e||0);return!Number.isFinite(t)||t<=0?`-`:`${t.toFixed(t>=10?0:1)}s`},y7=({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=Cse[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`?t7:$5)({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`?Zoe:Goe)({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)(PG,{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)(DV,{style:{width:`100%`,justifyContent:`space-between`,marginBottom:12},children:[(0,$.jsx)(_7,{strong:!0,children:`项目组`}),(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(WK,{}),onClick:M,loading:D})]}),(0,$.jsx)(lG,{spinning:D,children:m.length===0?(0,$.jsx)(lC,{image:lC.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)(_7,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name}),(0,$.jsx)(_7,{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)(DV,{style:{width:`100%`,marginBottom:12},children:[(0,$.jsx)(nW,{allowClear:!0,prefix:(0,$.jsx)(PC,{}),placeholder:`搜索素材名称`,value:v,onChange:e=>y(e.target.value),onPressEnter:N}),(0,$.jsx)(zC,{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)(WK,{}),onClick:N,loading:k,children:`刷新`})]}),(0,$.jsx)(lG,{spinning:k,children:C.length===0?(0,$.jsx)(lC,{image:lC.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=wse(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)(V8,{style:{fontSize:32,color:`#94a3b8`}}):(0,$.jsx)(F6,{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:Tse(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)(OC,{})}),(0,$.jsxs)(`div`,{style:{padding:10},children:[(0,$.jsx)(_7,{strong:!0,ellipsis:!0,style:{display:`block`},children:e.name||`未命名素材`}),(0,$.jsxs)(DV,{wrap:!0,size:4,style:{marginTop:6},children:[(0,$.jsx)(TQ,{color:a?`blue`:`default`,children:a?`视频`:`图片`}),(0,$.jsx)(TQ,{children:e.projectName})]})]})]},e.id)})})})]})]})]})},b7=({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)(b6,{style:{fontSize:24,color:`#fff`}}):(0,$.jsx)(W6,{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)(W2,{style:{fontSize:t===`small`?14:16,color:`#94a3b8`}}):(0,$.jsx)(x8,{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:x7}=Q,S7=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`${`https://ceshi.apiforeign.minzhongzc.com`.replace(/\/$/,``)}${e.startsWith(`/`)?``:`/`}${e}`},C7=(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},w7=(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},Ese=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 C7(n,r)}else if(e.resourceType===`video`&&n>0&&r>0)return w7(n,r);return null},Dse=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}),Ose=e=>e===`video`?(0,$.jsx)(V8,{}):e===`audio`?(0,$.jsx)(a2,{}):(0,$.jsx)(F6,{}),kse=e=>e===`video`?`视频`:e===`audio`?`音频`:`图片`,Ase=({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,defaultResourceType:_})=>{let[v,y]=(0,S.useState)(_||``),[b,x]=(0,S.useState)(``),[C,w]=(0,S.useState)(1),[T,E]=(0,S.useState)(10),[D,O]=(0,S.useState)(1),[k,A]=(0,S.useState)(8),[j,M]=(0,S.useState)(!1),[N,P]=(0,S.useState)(!1),[F,I]=(0,S.useState)([]),[L,R]=(0,S.useState)(0),[z,B]=(0,S.useState)(``),[V,H]=(0,S.useState)([]),[U,ee]=(0,S.useState)(0),[W,te]=(0,S.useState)(new Map),G=(0,S.useMemo)(()=>new Set(i),[i]),ne=(0,S.useMemo)(()=>new Set(r||[`image`,`video`,`audio`]),[JSON.stringify(r)]),K=(0,S.useMemo)(()=>Array.from(W.values()).filter(e=>e.resourceType===`image`).length,[W]),re=(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]),ae=(0,S.useMemo)(()=>Array.from(W.values()).filter(e=>e.resourceType===`audio`).length,[W]),q=(0,S.useMemo)(()=>Array.from(W.values()).filter(e=>e.resourceType===`audio`).reduce((e,t)=>e+(t.durationSeconds||0),0),[W]),oe=(0,S.useMemo)(()=>o!==void 0&&c!==void 0?o-c:1/0,[o,c]),se=(0,S.useMemo)(()=>s!==void 0&&l!==void 0?s-l:1/0,[s,l]),ce=(0,S.useMemo)(()=>u!==void 0&&d!==void 0?u-d:1/0,[u,d]),le=(0,S.useMemo)(()=>f!==void 0&&p!==void 0?f-p:1/0,[f,p]),ue=(0,S.useMemo)(()=>m!==void 0&&h!==void 0?m-h:1/0,[m,h]),de=(0,S.useMemo)(()=>K>oe,[K,oe]),fe=(0,S.useMemo)(()=>re>se,[re,se]),pe=(0,S.useMemo)(()=>ie>ce,[ie,ce]),me=(0,S.useMemo)(()=>ae>le,[ae,le]),he=(0,S.useMemo)(()=>q>ue,[q,ue]),ge=(0,S.useCallback)(async()=>{if(e){P(!0);try{let e=await X5({resourceType:v||void 0,keyword:b||void 0,page:C,pageSize:T,scene:`picker`});I(C===1?e.groups||[]:t=>[...t,...e.groups||[]]),R(e.totalDays||0)}catch(e){Z.error(e?.message||`加载历史上传素材失败`),C===1&&I([]),R(0)}finally{P(!1)}}},[ne,b,e,C,T,v]),_e=(0,S.useCallback)(async e=>{M(!0);try{let t=await Z5(e,{resourceType:v||void 0,keyword:b||void 0,page:D,pageSize:8,scene:`picker`});H((t.items||[]).filter(e=>ne.has(e.resourceType))),ee(t.total||0)}catch(e){Z.error(e?.message||`加载历史上传素材失败`),H([]),ee(0)}finally{M(!1)}},[ne,b,D,k,v]);(0,S.useEffect)(()=>{e&&ge()},[e,C,ge]),(0,S.useEffect)(()=>{z&&O(1)},[z]),(0,S.useEffect)(()=>{z&&_e(z)},[z,D,_e]),(0,S.useEffect)(()=>{e&&te(new Map)},[e]),(0,S.useEffect)(()=>{e&&(y(_||``),w(1))},[e,_]);let ve=async e=>{if(G.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=S7(e.previewUrl||e.displayUrl||e.resourceUrl);if(t){let e=await Dse(t);n=e.width,r=e.height}}if(n>0&&r>0){let t=C7(n,r);if(t){Z.error(`${e.fileName||`图片`}:${t}`);return}}}else if(e.resourceType===`video`&&n>0&&r>0){let t=w7(n,r);if(t){Z.error(`${e.fileName||`视频`}:${t}`);return}}te(t=>{let n=new Map(t);return n.has(e.id)?n.delete(e.id):n.set(e.id,e),n})},ye=()=>{let e=Array.from(W.values());if(e.length===0){Z.warning(`请先选择历史素材`);return}n(e),te(new Map),t()},be=(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)(PG,{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:ye,style:{background:`#8b5cf6`},disabled:de||fe||pe||me||he,children:[`应用选择 (`,W.size,`)`]},`ok`)],children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsxs)(DV,{wrap:!0,children:[(0,$.jsx)(zC,{value:v,options:be,style:{width:120},onChange:e=>{y(e),w(1)}}),(0,$.jsx)(nW,{allowClear:!0,value:b,prefix:(0,$.jsx)(PC,{}),placeholder:`搜索文件名`,style:{width:220},onChange:e=>x(e.target.value),onPressEnter:()=>{w(1),ge()}}),(0,$.jsx)(X,{icon:(0,$.jsx)(WK,{}),onClick:ge,children:`刷新`})]}),!g&&(0,$.jsxs)(`div`,{style:{display:`flex`,gap:16,marginTop:12,flexWrap:`wrap`},children:[(0,$.jsxs)(`span`,{style:{fontSize:13,color:de?`#ef4444`:`#64748b`,fontWeight:de?600:400},children:[`还可选取图片 `,K,`/`,o!==void 0&&c!==void 0?o-c:`-`,` 张`]}),(0,$.jsxs)(`span`,{style:{fontSize:13,color:fe||pe?`#ef4444`:`#64748b`,fontWeight:fe||pe?600:400},children:[`视频还可选取 `,re,`/`,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:me||he?`#ef4444`:`#64748b`,fontWeight:me||he?600:400},children:[`音频还可选取 `,ae,`/`,f!==void 0&&p!==void 0?f-p:`-`,` 个(`,q.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)(x7,{strong:!0,style:{fontSize:14},children:`日期列表`}),(0,$.jsx)(lG,{spinning:N,children:F.length===0?(0,$.jsx)(lC,{image:lC.PRESENTED_IMAGE_SIMPLE,description:`暂无日期`,style:{padding:`40px 0`}}):(0,$.jsxs)(`div`,{style:{marginTop:12},children:[F.map(e=>(0,$.jsxs)(`div`,{onClick:()=>B(e.generatedDate),style:{padding:`10px 12px`,borderRadius:10,marginBottom:6,cursor:`pointer`,border:z===e.generatedDate?`1px solid #8b5cf6`:`1px solid transparent`,background:z===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)),L>F.length&&(0,$.jsx)(`div`,{style:{marginTop:12,textAlign:`center`},children:(0,$.jsx)(X,{size:`small`,onClick:()=>w(C+1),children:`加载更多`})})]})})]}),(0,$.jsx)(`div`,{style:{border:`1px solid #eef0f4`,borderRadius:12,padding:12,overflowY:`auto`},children:(0,$.jsx)(lG,{spinning:j,children:z?V.length===0?(0,$.jsx)(lC,{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:V.map(e=>{let t=W.has(e.id),n=G.has(e.id),r=Ese(e),i=n||!!r,a=e.previewUrl||e.displayUrl||e.resourceUrl,o=S7(e.resourceType===`image`?`static`+a+`?w=300&q=50`:a);return(0,$.jsxs)(`div`,{onClick:()=>!i&&ve(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:o,alt:e.fileName||e.id,style:{width:`100%`,height:130,objectFit:`cover`}}):e.resourceType===`video`?(0,$.jsx)(`video`,{src:o,muted:!0,style:{width:`100%`,height:130,objectFit:`cover`}}):(0,$.jsx)(b7,{src:o,size:`small`})}),(0,$.jsxs)(`div`,{style:{padding:10},children:[(0,$.jsxs)(DV,{size:6,style:{marginBottom:6},children:[(0,$.jsx)(TQ,{color:`purple`,icon:Ose(e.resourceType),style:{margin:0},children:kse(e.resourceType)}),e.durationSeconds?(0,$.jsxs)(TQ,{style:{margin:0},children:[Number(e.durationSeconds).toFixed(1),`s`]}):null,r&&(0,$.jsx)(TQ,{color:`red`,style:{margin:0},children:`尺寸不符`})]}),(0,$.jsx)(x7,{ellipsis:!0,style:{display:`block`,fontSize:13,color:`#334155`},title:e.fileName||e.id,children:e.fileName||e.id}),(0,$.jsx)(x7,{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)(OC,{})}),n&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:8,right:8},children:(0,$.jsx)(TQ,{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)(HW,{current:D,pageSize:k,total:U,showSizeChanger:!0,pageSizeOptions:[8],onChange:(e,t)=>{O(e),A(t)}})})]}):(0,$.jsx)(lC,{image:lC.PRESENTED_IMAGE_SIMPLE,description:`请选择日期`,style:{padding:`80px 0`}})})})]})]})},T7=({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,mediaType:b})=>{let x=(0,S.useRef)(null),[C,w]=(0,S.useState)(!1),[T,E]=(0,S.useState)(`real_person`),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)(!1),[j,M]=(0,S.useState)(!1),N=()=>{A(!1),x.current?.click()},P=e=>{let t=e.target.files;t&&r&&r(Array.from(t)),x.current&&(x.current.value=``)},F=e=>{if(A(!1),a){E(e),w(!0);return}if(o){o(e);return}E(e),w(!0)},I=(0,$.jsxs)(`div`,{style:{padding:`4px 0`,minWidth:180},children:[(0,$.jsxs)(`div`,{onClick:()=>{N()},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)(xX,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`本地上传`})]}),(0,$.jsxs)(`div`,{onClick:()=>{A(!1),O(!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)(C4,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`从资产中选择`})]}),b!==`image`&&(0,$.jsxs)(`div`,{onClick:()=>F(`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)(z8,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`真人素材库`})]}),b!==`image`&&(0,$.jsxs)(`div`,{onClick:()=>F(`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)(D8,{style:{fontSize:14,color:`#64748b`}}),(0,$.jsx)(`span`,{style:{fontSize:14,color:`#334155`},children:`虚拟素材库`})]})]});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`input`,{ref:x,type:`file`,accept:t,multiple:n,onChange:P,style:{display:`none`}}),c?(0,$.jsx)(kw,{title:c,children:(0,$.jsx)(Lw,{content:I,open:k,onOpenChange:A,trigger:`click`,placement:`bottomLeft`,children:(0,$.jsx)(`div`,{style:{cursor:s?`not-allowed`:`pointer`},children:e})})}):(0,$.jsx)(Lw,{content:I,open:k,onOpenChange:A,trigger:`click`,placement:`bottomLeft`,children:(0,$.jsx)(`div`,{style:{cursor:s?`not-allowed`:`pointer`},children:e})}),(0,$.jsx)(Ase,{open:D,onClose:()=>O(!1),onSelect:e=>{i?.(e),O(!1)},allowedTypes:t.includes(`audio`)?[`image`,`video`,`audio`]:[`image`,`video`],maxImageCount:l,maxVideoCount:u,usedImageCount:d,usedVideoCount:f,maxVideoDuration:m,usedVideoDuration:p,maxAudioCount:h,usedAudioCount:g,maxAudioDuration:_,usedAudioDuration:v,hideLimitHint:y,defaultResourceType:b===`image`?`image`:``}),(0,$.jsx)(y7,{open:C,libraryType:T,onClose:()=>w(!1),onSelect:e=>{a?.(e),w(!1)},accept:t,maxCount:t===`image/*`&&!n?1:void 0,maxImageCount:l,maxVideoCount:u,usedImageCount:d,usedVideoCount:f,usedVideoDuration:p,maxVideoDuration:m})]})};function jse(){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 Mse={prompt_processing:`optimizing`,ready:`prompt_optimized`,generating:`generating`,success:`completed`,failure:`failed`},Nse=new Set([`pending`,`optimizing`,`generating`]),E7=new Set([`queued`,`preparing`,`creating_provider_task`,`provider_result_staged`,`waiting_remote`,`polling`,`result_ready`,`download_queued`,`downloading`,`retry_waiting`,`recovery_inconsistent`,`upscale_queued`,`upscale_processing`,`upscale_polling`,`upscale_downloading`,`upscale_finalizing`,`upscale_retry_waiting`]),D7=new Set([`completed`,`done`]),O7=new Set([`failed`,`timeout`,`download_failed`,`upscale_failed`]),Pse=new Set([...D7,...O7,`deleted`]),Fse={pending:`待处理`,optimizing:`提词处理中`,prompt_optimized:`待生成`,generating:`生成中`,queued:`生成中`,preparing:`生成中`,creating_provider_task:`生成中`,provider_result_staged:`生成中`,waiting_remote:`生成中`,polling:`生成中`,result_ready:`生成中`,download_queued:`生成中`,downloading:`生成中`,retry_waiting:`生成中`,recovery_inconsistent:`生成中`,upscale_queued:`生成中`,upscale_processing:`生成中`,upscale_polling:`生成中`,upscale_downloading:`生成中`,upscale_finalizing:`生成中`,upscale_retry_waiting:`生成中`,completed:`成功`,done:`成功`,timeout:`失败`,download_failed:`失败`,upscale_failed:`失败`,failed:`失败`,deleted:`已删除`},Ise={pending:`default`,optimizing:`processing`,prompt_optimized:`blue`,generating:`processing`,queued:`processing`,preparing:`processing`,creating_provider_task:`processing`,provider_result_staged:`processing`,waiting_remote:`processing`,polling:`processing`,result_ready:`processing`,download_queued:`processing`,downloading:`processing`,retry_waiting:`orange`,recovery_inconsistent:`orange`,upscale_queued:`purple`,upscale_processing:`purple`,upscale_polling:`purple`,upscale_downloading:`purple`,upscale_finalizing:`purple`,upscale_retry_waiting:`orange`,completed:`success`,done:`success`,failed:`error`,timeout:`error`,download_failed:`error`,upscale_failed:`error`,deleted:`default`},k7=e=>String(e||``).trim().toLowerCase(),Lse=e=>{let t=k7(e);return Fse[t]||t||`未知状态`},Rse=e=>Ise[k7(e)]||`default`,A7=e=>{let t=k7(e.status),n=k7(e.displayStatus),r=k7(e.pipelineStage),i=Mse[k7(e.clientStatus)]||``,a=i||n||t||r||`pending`;O7.has(r)||O7.has(t)||O7.has(n)?a=O7.has(r)?r:O7.has(t)?t:n:D7.has(t)||D7.has(n)?a=D7.has(t)?t:n:!i&&r&&E7.has(r)&&(a=r);let o=O7.has(a),s=D7.has(a),c=typeof e.shouldPoll==`boolean`?e.shouldPoll:!o&&!s&&(Nse.has(t)||E7.has(r)),l=c;return{status:t,displayStatus:n,pipelineStage:r,effectiveKey:a,label:Lse(a),color:Rse(a),isActive:l,isSuccess:s,isFailure:o,isTerminal:Pse.has(a),canGenerate:typeof e.canGenerate==`boolean`?e.canGenerate:t===`prompt_optimized`,canRetry:typeof e.canRetry==`boolean`?e.canRetry:o,shouldPoll:c}},j7=({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:`#fff`,border:`1px solid #e2e8f0`,minWidth:70,whiteSpace:`nowrap`,flexShrink:0},children:[(0,$.jsxs)(`span`,{style:{fontSize:13,color:`#374151`,fontWeight:500,lineHeight:`18px`},children:[t,r]}),(0,$.jsx)(wZ,{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,maxHeight:200,overflowY:`auto`,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)]})},zse=({group:e,groupName:t,selected:n,expanded:r,onToggle:i,onSelect:a,onClose:o})=>{let s=(0,S.useRef)(null),c=(0,S.useRef)(null),l=(0,S.useRef)(r),[u,d]=(0,S.useState)(null);return l.current=r,(0,S.useEffect)(()=>{if(r&&s.current){let e=s.current.getBoundingClientRect();d({bottom:window.innerHeight-e.top+4,left:e.left})}else d(null)},[r]),(0,S.useEffect)(()=>{if(!r)return;let e=e=>{s.current?.contains(e.target)||c.current?.contains(e.target)||l.current&&o()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[r,o]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{ref:s,onClick:()=>i(t),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:`#ffffffff`,border:`1px solid #e2e8f0`,minWidth:70,whiteSpace:`nowrap`,flexShrink:0},children:[(0,$.jsx)(Q.Text,{style:{fontSize:13,color:`#374151`,fontWeight:500,lineHeight:`18px`},children:n||e.name}),(0,$.jsx)(wZ,{style:{fontSize:9,color:`#94a3b8`,transition:`transform 0.2s`,transform:r?`rotate(180deg)`:`rotate(0deg)`}})]}),u&&(0,Vi.createPortal)((0,$.jsxs)(`div`,{ref:c,style:{position:`fixed`,bottom:u.bottom,left:u.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,r)=>{let i=n===e;return(0,$.jsx)(`div`,{onClick:()=>{a(e,t),o()},style:{padding:`6px 10px`,borderRadius:8,fontSize:13,cursor:`pointer`,transition:`all 0.15s`,background:i?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`transparent`,color:i?`#fff`:`#1a1a2e`,fontWeight:i?600:400},onMouseEnter:e=>{i||(e.currentTarget.style.background=`#f1f5f9`)},onMouseLeave:e=>{i||(e.currentTarget.style.background=`transparent`)},children:e},r)})})]}),document.body)]})},M7=({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)(W6,{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)})]})},Bse=()=>{let{projectId:e}=$e(),t=Ye(),[n]=xH.useForm(),{projects:r,records:i,fetchProjects:a,fetchRecords:o,optimizePrompt:s,generateVideo:c,retryGeneration:l}=u7(),u=i.items,{user:d}=n7(),[f,p]=(0,S.useState)(!1),[m,h]=(0,S.useState)(!1),[g,_]=(0,S.useState)(null),[v,y]=(0,S.useState)(``),[b,x]=(0,S.useState)(!1),[C,w]=(0,S.useState)({}),[T,E]=(0,S.useState)({}),[D,O]=(0,S.useState)({}),[k,A]=(0,S.useState)({}),[j,M]=(0,S.useState)({}),N=(0,S.useRef)(null),P=(0,S.useCallback)(e=>{if(!e)return 0;let t=new Date(e).getTime(),n=(Date.now()-t)/1e3;return n>=180?99:Math.min(99,n*.6)},[]);(0,S.useEffect)(()=>{let e=Object.entries(T).filter(([,e])=>e===`generating`).map(([e])=>e);if(e.length===0){N.current&&=(clearInterval(N.current),null);return}let t=()=>{e.forEach(e=>{let t=u7.getState().records.items.find(t=>t.id===e);if(t?.createdAt){let n=P(t.createdAt);O(t=>({...t,[e]:n})),A(t=>({...t,[e]:n}))}})};return t(),N.current=window.setInterval(t,1e3),()=>{N.current&&=(clearInterval(N.current),null)}},[T,P]),(0,S.useEffect)(()=>{Object.entries(T).forEach(([e,t])=>{if(t===`done`&&!j[e]){M(t=>({...t,[e]:!0}));let t=k[e]||0,n=Date.now(),r=()=>{let i=Date.now()-n,a=Math.min(i/800,1),o=1-(1-a)**3,s=t+(100-t)*o;A(t=>({...t,[e]:s})),a<1&&requestAnimationFrame(r)};requestAnimationFrame(r)}})},[T]),(0,S.useEffect)(()=>{Object.entries(T).forEach(([e,t])=>{if(t===`generating`){let t=u7.getState().records.items.find(t=>t.id===e);if(t?.createdAt){let n=P(t.createdAt);O(t=>({...t,[e]:n})),A(t=>({...t,[e]:n}))}}})},[g]);let[F,I]=(0,S.useState)({}),[L,R]=(0,S.useState)(null),[z,B]=(0,S.useState)(null),[V,H]=(0,S.useState)([]),[U,ee]=(0,S.useState)(!1),[W,te]=(0,S.useState)(``),[G,ne]=(0,S.useState)(!1),[K,re]=(0,S.useState)(``),ie=(0,S.useRef)(null),[ae,q]=(0,S.useState)({}),[oe,se]=(0,S.useState)({}),[ce,le]=(0,S.useState)({}),[ue,de]=(0,S.useState)(null),[fe,pe]=(0,S.useState)(null),[me,he]=(0,S.useState)(5),[ge,_e]=(0,S.useState)(`9:16`),[ve,ye]=(0,S.useState)(`720p`),[be,xe]=(0,S.useState)([]),[Se,Ce]=(0,S.useState)([]),[we,Te]=(0,S.useState)(``),[Ee,De]=(0,S.useState)(!1),[Oe,ke]=(0,S.useState)(null),[Ae,je]=(0,S.useState)(!1),[Me,Ne]=(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]});(0,S.useMemo)(()=>Me.durations.map(e=>`${e}`),[Me.durations]),(0,S.useCallback)(()=>{ke(e=>e===`duration`?null:`duration`)},[]),(0,S.useCallback)(()=>{ke(null)},[]);let Pe=(0,S.useCallback)(e=>{de(t=>t===e?null:e)},[]),Fe=(0,S.useCallback)(()=>{de(null)},[]);(0,S.useCallback)(e=>{he(parseInt(e))},[]);let Ie=(0,S.useCallback)((e,t)=>{le(n=>{let r={...n};return r[t]===e?delete r[t]:r[t]=e,r})},[]),[Le,Re]=(0,S.useState)(0),[ze,Be]=(0,S.useState)(0),[Ve,He]=(0,S.useState)(`video`),[Ue,We]=(0,S.useState)(`1:1`),[Ge,Ke]=(0,S.useState)(`2K`),[qe,Je]=(0,S.useState)(2048),[Xe,Ze]=(0,S.useState)(2048),[Qe,et]=(0,S.useState)(!1),[tt,nt]=(0,S.useState)([]),[rt,it]=(0,S.useState)([]),[at,ot]=(0,S.useState)([]),st=(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},ct=(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},lt=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=V.filter(e=>e.type===`image`).length,a=V.filter(e=>e.type===`video`).length,o=V.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=ct(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=st(t.width,t.height);if(e)return Z.error(`${e}`),!1}}ee(!0);try{let r;r=t?await d5(e):await f5(e,s);let o=t?`图片`:`视频`,c=t?i+1:a+1;H(e=>[...e,{url:r.url,type:t?`image`:`video`,name:`${o}${c}`,duration:n?s:void 0}]),Z.success(`${o}上传成功`)}catch{Z.error(`上传失败`)}finally{ee(!1)}return!1};(0,S.useEffect)(()=>{if(Kae().then(e=>{nt(e.video),ot(e.image)}),A5().then(e=>{it(e)}),!Qe&&!Ae)return;let e=e=>{let t=e.target;!t.closest(`.image-settings-popover`)&&!t.closest(`.image-settings-trigger`)&&(et(!1),je(!1))};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[Qe,Ae]);let ut=e=>{let t=Array.isArray(e)?e:[];return{inputImageCount:t.filter(e=>e.type===`image`).length,inputVideoDuration:t.filter(e=>e.type===`video`).reduce((e,t)=>e+Number(t.duration||0),0)}},dt=()=>{let e={};if(e=rt.find(e=>e.modelConfigId===(g?.engineId||we)&&e.genType===Ve&&e.resolution===(Ve===`video`?g?.resolution||ve:g?.imageSize||Ge)),e||=Ve===`video`?{perSecondCredits:2,baseCredits:60,ratio:1.3,inputVideoRatio:1.3,inputVideoBaseCredits:0,inputVideoPerSecondCredits:15,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0}:{perSecondCredits:.1,baseCredits:2,ratio:3,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0},Ve===`video`){let t=((g?.duration||me)*e.perSecondCredits+e.baseCredits)*e.ratio;if(g?.includeMediaReferences??Ee){let n=ut(g?.references||V);if(n.inputVideoDuration>0){let r=((e.inputVideoBaseCredits||0)+(e.inputVideoPerSecondCredits||0)*n.inputVideoDuration)*(e.inputVideoRatio||1);t+=r}if(n.inputImageCount>0){let r=((e.inputImageBaseCredits||0)+(e.inputImagePerImageCredits||0)*n.inputImageCount)*(e.inputImageRatio||1);t+=r}}return Number(t.toFixed(2))}else{let t=e.baseCredits*e.ratio;if(g?.includeMediaReferences??Ee){let n=ut(g?.references||V);if(n.inputImageCount>0){let r=((e.inputImageBaseCredits||0)+(e.inputImagePerImageCredits||0)*n.inputImageCount)*(e.inputImageRatio||1);t+=r}}return Number(t.toFixed(2))}},ft=e=>{let t=e.genType||e.gen_type||`video`,n=e.engineId||e.engine_id,r=e.resolution,i=Number(e.duration||0),a=e.imageSize||e.image_size,o=e.includeMediaReferences??e.include_media_references??!1,s=e.references||[],c=rt.find(e=>e.modelConfigId===n&&e.genType===t&&e.resolution===(t===`video`?r:a));c||=t===`video`?{perSecondCredits:2,baseCredits:60,ratio:1.3,inputVideoRatio:1.3,inputVideoBaseCredits:0,inputVideoPerSecondCredits:15,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0}:{perSecondCredits:.1,baseCredits:2,ratio:3,inputImageRatio:1,inputImageBaseCredits:0,inputImagePerImageCredits:0};let l=0;if(t===`video`){if(l=(i*c.perSecondCredits+c.baseCredits)*c.ratio,o){let e=ut(s);if(e.inputVideoDuration>0){let t=((c.inputVideoBaseCredits||0)+(c.inputVideoPerSecondCredits||0)*e.inputVideoDuration)*(c.inputVideoRatio||1);l+=t}if(e.inputImageCount>0){let t=((c.inputImageBaseCredits||0)+(c.inputImagePerImageCredits||0)*e.inputImageCount)*(c.inputImageRatio||1);l+=t}}}else if(l=c.baseCredits*c.ratio,o){let e=ut(s);if(e.inputImageCount>0){let t=((c.inputImageBaseCredits||0)+(c.inputImagePerImageCredits||0)*e.inputImageCount)*(c.inputImageRatio||1);l+=t}}return Number(l.toFixed(2))},pt=e=>{St(e);let t=Tt[Ge]?.[e];if(t){let[e,n]=t.split(/x/i).map(Number);Je(e),Ze(n)}},mt=e=>{wt(e);let t=Object.keys(Tt[e]||{});gt(t.map(e=>({value:e,label:e})));let n=t.includes(Ue)?Ue:t[0]||`1:1`;n!==Ue&&We(n);let r=Tt[e]?.[n];if(r){let[e,t]=r.split(/x/i).map(Number);Je(e),Ze(t)}},[ht,gt]=(0,S.useState)([]),[_t,vt]=(0,S.useState)([]),[yt,bt]=(0,S.useState)([]),[xt,St]=(0,S.useState)(0),[Ct,wt]=(0,S.useState)(0),[Tt,Et]=(0,S.useState)({});(0,S.useEffect)(()=>{yt[Ct]&&yt[Ct][xt]!==void 0&&(Je(yt[Ct][xt].substring(0,4)),Ze(yt[Ct][xt].substring(5)))},[xt]),(0,S.useEffect)(()=>{yt[Ct]&&yt[Ct][xt]!==void 0&&(Je(yt[Ct][xt].substring(0,4)),Ze(yt[Ct][xt].substring(5)))},[Ct]);let Dt=()=>{Je(Xe),Ze(qe)},Ot=e=>{let t=e.target.value===`image`?`image`:`video`;He(t);let n=(t===`image`?Se:be).filter(e=>e.supportsUniversalReference!==!1);n.length>0&&At(n[0].id)};(0,S.useEffect)(()=>{S5().then(e=>{q(Object.fromEntries(e.map(e=>[e.key,e.label]))),se(Object.fromEntries(e.map(e=>[e.key,e.optionGroups||[]])))}).catch(()=>{}),Iae().then(e=>{let t=e.items||[];Ce(t);let n=t?.[0]?.supportedSizes||{};Et(n);let r=Object.keys(n);vt(r.map(e=>({value:e,label:e})));let i=r.includes(Ge)?Ge:r[0]||`2K`,a=Object.keys(n[i]||{});gt(a.map(e=>({value:e,label:e})));let o=a.includes(Ue)?Ue:a[0]||`1:1`;o!==Ue&&We(o);let s=n[i]?.[o];if(s){let[e,t]=s.split(/x/i).map(Number);Je(e),Ze(t)}}).catch(()=>{}),Fae().then(e=>{if(xe(e.items||[]),e.items?.length){let t=e.items[0];Te(e=>e||t.id),Ne({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)(()=>{if(!g)return;let e=g.genType||Ve,t=e===`image`?Se:be,n=g.engineId||``,r=t.find(e=>e.id===n)||t[0];if(r)if(Te(r.id),e===`image`){let e=r.supportedSizes||{};Et(e);let t=Object.keys(e),n=t.includes(g.imageSize||``)?g.imageSize:t[0]||g.imageSize||`2K`;Ke(n);let i=Object.keys(e[n]||{}),a=i.includes(g.imageProportion||``)?g.imageProportion:i[0]||g.imageProportion||`1:1`;We(a);let o=e[n]?.[a]||g.imagePx||``;if(o){let[e,t]=String(o).split(/x/i).map(Number);e>0&&t>0&&(Je(e),Ze(t))}}else Ne({ratios:r.supportedRatios?.length?r.supportedRatios:[`16:9`],resolutions:r.supportedResolutions?.length?r.supportedResolutions:[`720p`],durations:r.supportedDurations?.length?r.supportedDurations:[5]}),r.supportedRatios?.includes(ge)||_e(r.supportedRatios?.[0]||`16:9`),r.supportedResolutions?.includes(ve)||ye(r.supportedResolutions?.[0]||`720p`),r.supportedDurations?.includes(me)||he(r.supportedDurations?.[0]||g.duration||5);De(!!g.includeMediaReferences)},[g?.id,g?.engineId,be,Se]);let kt=e=>{let t=be.find(t=>t.id===e)||be[0];return{ratios:t?.supportedRatios?.length?t.supportedRatios:[`16:9`],resolutions:t?.supportedResolutions?.length?t.supportedResolutions:[`720p`],durations:t?.supportedDurations?.length?t.supportedDurations:[5]}},At=e=>{Te(e);let t=(Ve===`image`?Se:be).find(t=>t.id===e);if(!t)return;if(Ve===`image`){let e=t.supportedSizes||{};Et(e);let n=Object.keys(e);vt(n.map(e=>({value:e,label:e})));let r=n.includes(Ge)?Ge:n[0]||`2K`,i=Object.keys(e[r]||{});gt(i.map(e=>({value:e,label:e})));let a=i.includes(Ue)?Ue:i[0]||`1:1`;Ke(r),We(a);let o=e[r]?.[a]||``;if(o){let[e,t]=String(o).split(/x/i).map(Number);e>0&&t>0&&(Je(e),Ze(t))}return}let n=kt(e);Ne(n),_e(n.ratios[0]),ye(n.resolutions[0]),he(n.durations[0])};(0,S.useEffect)(()=>{a(),o({projectId:e,page:1,pageSize:100})},[e,a,o]);let jt=(0,S.useRef)(!1);(0,S.useEffect)(()=>{jt.current||u.length===0||(jt.current=!0,u.forEach(t=>{t.projectId===e&&t.status===`generating`&&(E(e=>({...e,[t.id]:`generating`})),nn(t.id)),t.projectId===e&&t.status===`optimizing`&&zt(t.id)}))},[u,e]);let Mt=(0,S.useRef)(new Set),Nt=(0,S.useRef)(null),Pt=(0,S.useRef)(null),Ft=e=>{Mt.current.add(e),Rt()},It=e=>{Mt.current.delete(e),Mt.current.size===0&&Lt()},Lt=()=>{Nt.current&&=(clearInterval(Nt.current),null),Pt.current&&=(Pt.current.abort(),null)},Rt=()=>{Nt.current||=setInterval(async()=>{try{Pt.current&&Pt.current.abort();let t=new AbortController;Pt.current=t;let n=await l5({projectId:e,page:1,pageSize:100,signal:t.signal});Pt.current=null;let r=Array.from(Mt.current),i=[];if(r.length>0){let e=u7.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});u7.setState({records:{...e,items:t}}),i.forEach(e=>{It(e)})}}catch(e){e.name}},3e3)},zt=e=>{Ft(e)},Bt=(0,S.useRef)(!1),Vt=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(Bt.current||u.length===0)return;let t=localStorage.getItem(`pending_optimize`);if(t)try{let{key:n,projectId:r,prompt:i,duration:a,engineId:o,genType:s,aspectRatio:c,resolution:l,imageSize:d,imageProportion:f,imagePx:p,includeMediaReferences:m,referenceIds:g,ts:v}=JSON.parse(t);if(Date.now()-v>300*1e3||r!==e){localStorage.removeItem(`pending_optimize`);return}if(Vt.current===n)return;let b=u.find(e=>e.projectId===r&&e.originalPrompt===i&&e.duration===a&&e.engineId===o&&String(e.genType||`video`)===String(s||`video`)&&String(e.aspectRatio||``)===String(c||``)&&String(e.resolution||``)===String(l||``)&&String(e.imageSize||``)===String(d||``)&&String(e.imageProportion||``)===String(f||``)&&String(e.imagePx||``)===String(p||``)&&!!e.includeMediaReferences==!!m&&JSON.stringify((e.references||[]).map(e=>e.upload_resource_id||e.url).filter(Boolean).sort())===JSON.stringify((g||[]).slice().sort())&&e.status===`prompt_optimized`&&new Date(e.createdAt).getTime()>v-1e4);b?(Bt.current=!0,localStorage.removeItem(`pending_optimize`),_(b),y(b.optimizedPrompt||``),Re(b.textCreditsCost),Be(b.textTokensUsed),h(!0),Z.success({content:`优化请求已恢复,消耗 ${b.textCreditsCost} 积分`,key:`recovery`})):Date.now()-v>3e4&&localStorage.removeItem(`pending_optimize`)}catch{localStorage.removeItem(`pending_optimize`)}},[u,e]);let Ht=r.find(t=>t.id===e),Ut=u.filter(t=>t.projectId===e),Wt=Ht?.name??`项目`,Gt=(0,S.useMemo)(()=>Ht&&oe[Ht.industry]||[],[Ht,oe]),Kt=d?.credits??0,qt=Kt>=dt(),Jt=async()=>{try{if(!e){Z.error(`项目ID为空,请先选择项目`);return}let t=await n.validateFields();if(!t.prompt||!t.prompt.trim()){Z.error(`请输入视频/图片描述`);return}if(!we){Z.error(`请选择生成引擎`);return}if(Ve===`video`&&(!ge||!ve)){Z.error(`请选择视频比例和分辨率`);return}p(!0);let r=Object.entries(ce).map(([e,t])=>`@${e}:${t}`),i=r.length>0?`${t.prompt}\n\n${r.join(`;`)}`:t.prompt,a=jse();localStorage.setItem(`pending_optimize`,JSON.stringify({key:a,projectId:e,prompt:i,duration:me,engineId:we,genType:Ve,aspectRatio:Ve===`video`?ge:``,resolution:Ve===`video`?ve:``,imageSize:Ve===`image`?Ge:``,imageProportion:Ve===`image`?Ue:``,imagePx:Ve===`image`?`${qe}x${Xe}`:``,includeMediaReferences:Ee,referenceIds:V.map(e=>e.upload_resource_id||e.url).filter(Boolean).sort(),ts:Date.now()})),Vt.current=a;let o=await s(e,{prompt:i,duration:Ve===`video`?me:void 0,genType:Ve,engineId:we,includeMediaReferences:Ee,aspectRatio:Ve===`video`?ge:void 0,resolution:Ve===`video`?ve:void 0,references:V.length>0?V:void 0,idempotencyKey:a,image_size:Ve===`image`?Ge:void 0,image_proportion:Ve===`image`?Ue:void 0,image_px:Ve===`image`?qe+`x`+Xe:void 0});localStorage.removeItem(`pending_optimize`),Vt.current=null,_(o.record),y(o.record.optimizedPrompt||``),Re(o.textCreditsCost),Be(o.textTokensUsed),h(!0),Z.success({content:`「${Wt}」提示词优化完成,消耗 ${o.textCreditsCost} 积分`,key:`optimize`})}catch(e){let t=e?.response?.data?.message||e?.message||`操作失败,请稍后重试`;Z.error(t)}finally{p(!1),localStorage.removeItem(`pending_optimize`),Vt.current=null}},Yt=(0,S.useRef)(new Set),Xt=(0,S.useRef)(null),Zt=(0,S.useRef)(null),Qt=e=>{Yt.current.add(e),tn()},$t=e=>{Yt.current.delete(e),Yt.current.size===0&&en()},en=()=>{Xt.current&&=(clearInterval(Xt.current),null),Zt.current&&=(Zt.current.abort(),null)},tn=()=>{Xt.current||=setInterval(async()=>{try{Zt.current&&Zt.current.abort();let t=new AbortController;Zt.current=t;let n=await l5({projectId:e,page:1,pageSize:100,signal:t.signal});Zt.current=null;let r=Array.from(Yt.current),i=[];if(r.length>0){let e=u7.getState().records,t=e.items.map(e=>{if(r.includes(e.id)){let t=n.items.find(t=>t.id===e.id);if(t){let n=T[e.id];return t.shouldPoll??t.status===`generating`?n!==`generating`&&E(t=>({...t,[e.id]:`generating`})):i.push(e.id),t}}return e});u7.setState({records:{...e,items:t}}),i.forEach(e=>{let t=n.items.find(t=>t.id===e);$t(e),t?.status===`completed`?(E(t=>({...t,[e]:`done`})),_(n=>n?.id===e?t:n),Z.success({content:`「${Wt}」视频生成完成!`,key:e,duration:5})):t?.status===`failed`&&(E(t=>({...t,[e]:`failed`})),_(n=>n?.id===e?t:n),Z.error({content:`「${Wt}」视频生成失败: ${t.errorMessage||`未知错误`}`,key:e,duration:5}))})}}catch(e){e.name}},5e3)},nn=e=>{Qt(e)};(0,S.useEffect)(()=>()=>{en(),Lt()},[]),(0,S.useEffect)(()=>{u.filter(e=>e.shouldPoll??e.status===`generating`).forEach(e=>{E(t=>({...t,[e.id]:`generating`})),nn(e.id)})},[u]);let rn=async e=>{w(t=>({...t,[e]:!0})),E(t=>({...t,[e]:`generating`})),Z.loading({content:`「${Wt}」正在提交视频生成...`,duration:0,key:e});try{let t=Ut.find(t=>t.id===e)||g;if(!t||t.canGenerate===!1)throw Error(t?.configFallbackHint||`该记录当前不可生成,请重新生成提词`);let n=t.id===g?.id?v:F[e];n&&n!==t.optimizedPrompt&&await h5(e,n),(await c(e)).status===`failed`?(E(t=>({...t,[e]:`failed`})),Z.error({content:`「${Wt}」提交失败`,key:e,duration:3})):(Z.success({content:`「${Wt}」已提交,正在生成中...`,key:e,duration:3}),nn(e))}catch(t){E(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{w(t=>({...t,[e]:!1}))}},an=e=>{let t=T[e.id];return A7({status:(t===`done`?`completed`:t)||e.status,pipelineStage:t?null:e.pipelineStage,clientStatus:t?null:e.clientStatus,shouldPoll:t?t===`generating`:e.shouldPoll,canGenerate:e.canGenerate,canRetry:e.canRetry})},on=e=>e.isActive?(0,$.jsx)(Jm,{style:{animation:`spinSlow 1s linear infinite`}}):e.isSuccess?(0,$.jsx)(V2,{}):e.isFailure?(0,$.jsx)(W2,{}):(0,$.jsx)(OB,{});return(0,$.jsxs)(`div`,{style:{margin:`-24px -32px -32px`,borderRadius:20,height:`calc(100vh - 8px)`,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)(X0,{}),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:Wt}),Ht&&(0,$.jsx)(TQ,{style:{background:`rgba(99, 102, 241, 0.08)`,border:`1px solid rgba(99, 102, 241, 0.15)`,color:`#6366f1`,borderRadius:6},children:ae[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)(TQ,{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:[`剩余 `,Kt,` 积分`]})]}),!m&&(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)(BF.Group,{defaultValue:`video`,buttonStyle:`solid`,onChange:Ot,children:[(0,$.jsxs)(BF.Button,{value:`video`,children:[(0,$.jsx)(V8,{style:{marginRight:6,fontSize:14}}),` `,`视频`]}),(0,$.jsxs)(BF.Button,{value:`image`,style:{zIndex:0},children:[(0,$.jsx)(F6,{style:{marginRight:6,fontSize:14}}),` `,`图片`]})]})]}),Ve===`video`&&[{icon:(0,$.jsx)(s$,{}),label:`描述视频+时长`,color:`#6366f1`},{icon:(0,$.jsx)(k8,{}),label:`AI智能优化`,color:`#8b5cf6`},{icon:(0,$.jsx)(r8,{}),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)),Ve===`image`&&[{icon:(0,$.jsx)(s$,{}),label:`描述图片+尺寸`,color:`#6366f1`},{icon:(0,$.jsx)(k8,{}),label:`AI智能优化`,color:`#8b5cf6`},{icon:(0,$.jsx)(r8,{}),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)(xH,{form:n,initialValues:{},children:[(0,$.jsx)(xH.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:[V.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`&&pe(`https://ceshi.apiforeign.minzhongzc.com${e.url}`)},children:e.type===`image`?(0,$.jsx)(xU,{src:`https://ceshi.apiforeign.minzhongzc.com${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`,display:`block`}}):(0,$.jsx)(M7,{src:`https://ceshi.apiforeign.minzhongzc.com${e.url}`})}),(0,$.jsx)(`div`,{className:`ref-delete`,onClick:n=>{n.stopPropagation(),m5(e.url).catch(()=>{}),H(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)(W2,{style:{color:`#fff`,fontSize:10}})})]},t)),(0,$.jsx)(T7,{accept:`image/*,video/*`,mediaType:Ve,onLocalSelect:e=>{e.forEach(async e=>{await lt(e)})},onHistorySelect:e=>{e.forEach(e=>{H(t=>[...t,{url:e.resourceUrl||e.previewUrl||e.displayUrl||``,type:e.resourceType,name:e.fileName||``}])}),Z.success(`成功添加${e.length}个历史记录`)},onPortraitSelect:e=>{e.forEach(e=>{H(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:U,tooltipTitle:`图片${V.filter(e=>e.type===`image`).length}/5,视频${V.filter(e=>e.type===`video`).length}/2`,maxImageCount:5,maxVideoCount:2,usedImageCount:V.filter(e=>e.type===`image`).length,usedVideoCount:V.filter(e=>e.type===`video`).length,usedVideoDuration:V.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:U?(0,$.jsx)(Jm,{style:{fontSize:18,color:`#6366f1`}}):(0,$.jsx)(PI,{style:{fontSize:18,color:`#94a3b8`}})})})]}),(0,$.jsx)(`div`,{style:{padding:`8px 16px 4px`},children:(0,$.jsx)(nW.TextArea,{ref:ie,value:W,onChange:e=>{let t=e.target.value;te(t),n.setFieldsValue({prompt:t});let r=t.lastIndexOf(`@`);if(r>=0){let e=t.slice(r+1);if(!e.includes(` `)&&!e.includes(`
`)){ne(!0),re(e);return}}ne(!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 lt(e)}))},rows:3,placeholder:`上传参考素材后(手动开启是否参与最终生成,如不开启则只用做模型理解)、输入文字,自由组合图、文多元素。输入 @ 可引用参考内容...`,maxLength:500,variant:`borderless`,autoSize:{minRows:2,maxRows:6},style:{padding:`6px 2px`,fontSize:15,lineHeight:1.7,resize:`none`,caretColor:`#6366f1`}})}),G&&V.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:(()=>{let e=V.filter(e=>!K||e.name.includes(K));return(e.length>0?e:V).map((e,t)=>{let r=V.indexOf(e);return(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 i=ie.current?.resizableTextArea?.textArea||ie.current?.nativeElement?.querySelector(`textarea`)||ie.current;if(!i||!i.value)return;let a=i.value,o=a.lastIndexOf(`@`),s=e.name||(e.type===`image`?`图片${r+1}`:`视频${r+1}`),c=a.slice(0,o)+`@${s} `;te(c),n.setFieldValue(`prompt`,c),ne(!1),setTimeout(()=>{i.focus(),i.selectionStart=c.length,i.selectionEnd=c.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:`https://ceshi.apiforeign.minzhongzc.com${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,$.jsx)(W6,{style:{color:`#fff`,fontSize:14}})}),(0,$.jsx)(Q.Text,{style:{fontSize:13},children:e.name||(e.type===`image`?`图片${r+1}`:`视频${r+1}`)}),(0,$.jsx)(TQ,{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:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexWrap:`wrap`},children:[(0,$.jsx)(j7,{label:`引擎`,value:(Ve===`image`?Se:be).filter(e=>e.supportsUniversalReference!==!1).find(e=>e.id===we)?.name||`选择引擎`,options:(Ve===`image`?Se:be).filter(e=>e.supportsUniversalReference!==!1).map(e=>e.name),expanded:Oe===`engine`,onToggle:()=>ke(Oe===`engine`?null:`engine`),onSelect:e=>{let t=(Ve===`image`?Se:be).filter(e=>e.supportsUniversalReference!==!1).find(t=>t.name===e);t&&At(t.id),ke(null)},onClose:()=>ke(null)}),Ve!==`image`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{style:{flex:1,position:`relative`,display:`inline-block`},children:[(0,$.jsxs)(`button`,{onClick:()=>{je(!Ae),ke(null)},className:`image-settings-trigger`,style:{width:`100%`,padding:`4px 12px`,height:34,borderRadius:10,border:`1px solid rgba(99, 102, 241, 0.15)`,backgroundColor:`rgba(255,255,255,0.7)`,cursor:`pointer`,display:`inline-flex`,alignItems:`center`,gap:6,transition:`all 0.2s`},children:[(0,$.jsx)(M3,{style:{fontSize:14,color:`#6366f1`}}),(0,$.jsxs)(`span`,{style:{fontSize:14,fontWeight:500,color:`#64748b`},children:[ge,` · `,me,`s · `,ve]})]}),Ae&&(0,$.jsxs)(`div`,{className:`image-settings-popover`,style:{position:`absolute`,bottom:`calc(100% + 8px)`,left:-160,width:350,backgroundColor:`#fff`,borderRadius:16,boxShadow:`0 10px 40px rgba(0,0,0,0.15)`,padding:16,border:`none`,zIndex:9999},onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(`span`,{style:{display:`block`,marginBottom:8,fontSize:12,fontWeight:500,color:`#666666`},children:`选择比例`}),(0,$.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:4},children:Me.ratios.map(e=>{let[t,n]=e.split(`:`).map(Number),r=t>=n?18:Math.round(t/n*18),i=n>=t?18:Math.round(n/t*18);return(0,$.jsxs)(`button`,{onClick:()=>_e(e),style:{flex:`0 0 calc(12.5% - 4px)`,minWidth:44,height:52,borderRadius:6,border:ge===e?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:ge===e?`#fff`:`#f9fafb`,cursor:`pointer`,display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,transition:`all 0.2s`},children:[(0,$.jsx)(`div`,{style:{width:r,height:i,border:`2px solid ${ge===e?`#6366f1`:`#9ca3af`}`,borderRadius:3,marginBottom:2}}),(0,$.jsx)(`span`,{style:{fontSize:9,color:ge===e?`#6366f1`:`#6b7280`,fontWeight:ge===e?600:400},children:e})]},e)})})]}),(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(`span`,{style:{display:`block`,marginBottom:8,fontSize:12,fontWeight:500,color:`#666666`},children:`选择时长`}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsxs)(`div`,{style:{flex:1,position:`relative`,height:24,display:`flex`,alignItems:`center`},children:[(0,$.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:0,right:0,height:6,borderRadius:3,background:`#e5e7eb`,transform:`translateY(-50%)`}}),(0,$.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:0,height:6,borderRadius:3,background:`#6366f1`,width:`${(me-Math.min(...Me.durations))/(Math.max(...Me.durations)-Math.min(...Me.durations))*100}%`,transform:`translateY(-50%)`}}),(0,$.jsx)(`input`,{type:`range`,min:Math.min(...Me.durations),max:Math.max(...Me.durations),value:me,onChange:e=>he(Number(e.target.value)),style:{position:`relative`,width:`100%`,height:24,borderRadius:3,background:`transparent`,outline:`none`,appearance:`none`,cursor:`pointer`,zIndex:1}})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,padding:`4px 12px`,backgroundColor:`#f1f5f9`,borderRadius:6},children:[(0,$.jsx)(`span`,{style:{fontSize:14,fontWeight:600,color:`#64748b`},children:me}),(0,$.jsx)(`span`,{style:{fontSize:12,color:`#9ca3af`},children:`秒`})]})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{style:{display:`block`,marginBottom:8,fontSize:12,fontWeight:500,color:`#666666`},children:`选择分辨率`}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:6},children:Me.resolutions.map(e=>(0,$.jsx)(`button`,{onClick:()=>ye(e),style:{flex:1,height:42,borderRadius:8,border:ve===e?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:ve===e?`#6366f1`:`#f9fafb`,cursor:`pointer`,display:`flex`,justifyContent:`center`,alignItems:`center`,transition:`all 0.2s`},children:(0,$.jsx)(`span`,{style:{fontSize:12,fontWeight:600,color:ve===e?`#fff`:`#4b5563`},children:e})},e))})]})]})]}),Gt.map((e,t)=>{let n=ue===e.name,r=ce[e.name];return(0,$.jsx)(zse,{group:e,groupName:e.name,selected:r,expanded:n,onToggle:Pe,onSelect:Ie,onClose:Fe},`og-${t}`)})]}),Ve==`image`&&(0,$.jsxs)(`div`,{style:{flex:1,position:`relative`,display:`inline-block`},children:[(0,$.jsxs)(`button`,{onClick:()=>{et(!Qe),ke(null)},className:`image-settings-trigger`,style:{width:`100%`,padding:`4px 12px`,height:34,borderRadius:10,border:`1px solid rgba(99, 102, 241, 0.15)`,backgroundColor:`rgba(255,255,255,0.7)`,cursor:`pointer`,display:`inline-flex`,alignItems:`center`,gap:6,transition:`all 0.2s`},children:[(0,$.jsx)(M3,{style:{fontSize:14,color:`#6366f1`}}),(0,$.jsxs)(`span`,{style:{fontSize:14,fontWeight:500,color:`#64748b`},children:[Ue===`auto`?`智能`:Ue,` · `,Ge,` · `,qe,`×`,Xe]})]}),Qe&&(0,$.jsxs)(`div`,{className:`image-settings-popover`,style:{position:`absolute`,bottom:`calc(100% + 8px)`,left:-160,width:350,backgroundColor:`#fff`,borderRadius:16,boxShadow:`0 10px 40px rgba(0,0,0,0.15)`,padding:16,border:`none`,zIndex:9999},onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(Q.Text,{style:{display:`block`,marginBottom:8,fontSize:13,fontWeight:500,color:`#666666`},children:`选择比例`}),(0,$.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6},children:ht.map(e=>(0,$.jsxs)(`button`,{onClick:()=>{We(e.value),pt(e.label)},style:{flex:`0 0 calc(11.11% - 5px)`,minWidth:48,height:52,borderRadius:6,border:Ue===e.value?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:Ue===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 ${Ue===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:Ue===e.value?`#6366f1`:`#9ca3af`},children:`智`})}),(0,$.jsx)(`span`,{style:{fontSize:10,color:Ue===e.value?`#6366f1`:`#6b7280`,fontWeight:Ue===e.value?600:400},children:e.value})]},e.value))})]}),(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(Q.Text,{style:{display:`block`,marginBottom:8,fontSize:13,fontWeight:500,color:`#666666`},children:`选择分辨率`}),(0,$.jsx)(`div`,{style:{display:`flex`,gap:6},children:_t.map(e=>(0,$.jsx)(`button`,{onClick:()=>{Ke(e.value),mt(e.label)},style:{flex:1,height:44,borderRadius:6,border:Ge===e.value?`2px solid #6366f1`:`1px solid #e5e7eb`,backgroundColor:Ge===e.value?`#6366f1`:`#f9fafb`,cursor:`pointer`,display:`flex`,justifyContent:`center`,alignItems:`center`,transition:`all 0.2s`},children:(0,$.jsxs)(`span`,{style:{fontSize:12,fontWeight:600,color:Ge===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:8,fontSize:13,fontWeight:500,color:`#666666`},children:`尺寸`}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,flex:1,maxWidth:140},children:[(0,$.jsx)(`span`,{style:{color:`#9ca3af`,fontSize:12,marginRight:6},children:`W`}),(0,$.jsx)(nW,{value:qe,onChange:e=>Je(Number(e.target.value)||0),style:{flex:1,textAlign:`center`,borderRadius:6,height:36,border:`1px solid #e5e7eb`,backgroundColor:`#f9fafb`,fontSize:13,fontWeight:600,color:`#1f2937`}})]}),(0,$.jsx)(`button`,{onClick:Dt,style:{width:26,height:26,borderRadius:6,border:`1px solid #e5e7eb`,backgroundColor:`#fff`,cursor:`pointer`,display:`flex`,justifyContent:`center`,alignItems:`center`,color:`#6366f1`},children:(0,$.jsx)(oU,{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)(nW,{value:Xe,onChange:e=>Ze(Number(e.target.value)||0),style:{flex:1,textAlign:`center`,borderRadius:6,height:36,border:`1px solid #e5e7eb`,backgroundColor:`#f9fafb`,fontSize:13,fontWeight:600,color:`#1f2937`}})]}),(0,$.jsx)(`span`,{style:{color:`#9ca3af`,fontSize:12},children:`PX`})]})]})]})]}),V.length>0&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,$.jsx)(wq,{size:`small`,checked:Ee,onChange:De}),(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#64748b`},children:`生成时携带附件`})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexShrink:0},children:[Ve===`image`&&(0,$.jsx)(`span`,{style:{color:`#7c7c7c`,fontSize:14},children:`(请在左侧选择图片比例和尺寸)`}),(0,$.jsx)(kw,{title:`LLM积分由服务端按当前功能场景直接消费`,placement:`top`,children:(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:()=>{Jt()},loading:f,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优化提示词`})})]})]})]})]})]}),m&&g&&(0,$.jsxs)(fL,{className:`animate-fadeInUp`,style:{borderRadius:16},styles:{body:{padding:`24px 28px`}},children:[!T[g.id]||T[g.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)(V2,{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:[`文本优化消耗 `,Le,` 积分· 您可以编辑提示词后选择参数生成视频`]})]})]}):(0,$.jsxs)(`div`,{style:{marginBottom:24,padding:`16px 18px`,borderRadius:12,display:`flex`,alignItems:`center`,gap:12,background:T[g.id]===`failed`?`rgba(239,68,68,0.04)`:T[g.id]===`done`?`rgba(16,185,129,0.04)`:`rgba(99,102,241,0.04)`,border:`1px solid ${T[g.id]===`failed`?`rgba(239,68,68,0.12)`:T[g.id]===`done`?`rgba(16,185,129,0.12)`:`rgba(99,102,241,0.12)`}`},children:[T[g.id]===`generating`&&(0,$.jsx)(Jm,{style:{color:`#6366f1`,fontSize:18},spin:!0}),T[g.id]===`done`&&(0,$.jsx)(V2,{style:{color:`#10b981`,fontSize:18}}),T[g.id]===`failed`&&(0,$.jsx)(W2,{style:{color:`#ef4444`,fontSize:18}}),(0,$.jsxs)(Q.Text,{strong:!0,style:{fontSize:14,color:T[g.id]===`failed`?`#ef4444`:T[g.id]===`done`?`#10b981`:`#6366f1`},children:[T[g.id]===`generating`&&(0,$.jsxs)(`span`,{children:[Ve===`image`?`图片`:`视频`,`生成中,请稍候...`]}),T[g.id]===`done`&&`${Ve===`image`?`图片`:`视频`}生成成功`,T[g.id]===`failed`&&`${Ve===`image`?`图片`:`视频`}生成失败,请重试`]})]}),!T[g.id]||T[g.id]===`idle`||T[g.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:g.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:[`优化后的提示词`,` `,!b&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),!b&&(0,$.jsxs)(DV,{size:4,children:[(0,$.jsx)(kw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(A$,{}),onClick:async()=>{let e=await g7(v);Z.success(e?`已复制`:`复制失败`)},style:{color:`#94a3b8`}})}),(0,$.jsx)(kw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(s$,{}),onClick:()=>x(!0),style:{color:`#6366f1`}})})]})]}),b?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(nW.TextArea,{value:v,onChange:e=>y(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:()=>{y(g.optimizedPrompt||``),x(!1)},children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{x(!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:v})})]})]}):(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:g.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:[`优化后的提示词`,` `,!b&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),!b&&(0,$.jsxs)(DV,{size:4,children:[(0,$.jsx)(kw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(A$,{}),onClick:async()=>{let e=await g7(v);Z.success(e?`已复制`:`复制失败`)},style:{color:`#94a3b8`}})}),(0,$.jsx)(kw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(s$,{}),onClick:()=>x(!0),style:{color:`#6366f1`}})})]})]}),b?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(nW.TextArea,{value:v,onChange:e=>y(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:()=>{y(g.optimizedPrompt||``),x(!1)},children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{x(!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:v})})]})]}),(0,$.jsxs)(`div`,{style:{flex:`1 1 40%`,minWidth:280},children:[g.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:`https://ceshi.apiforeign.minzhongzc.com${g.videoUrl}`,controls:!0,style:{width:`100%`,maxHeight:350,display:`block`}})})]}),g.imageUrl&&(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:`生成图片`}),(0,$.jsx)(xU,{src:`https://ceshi.apiforeign.minzhongzc.com${g.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`,flexWrap:`wrap`,gap:12,marginTop:20,padding:`14px 18px`,borderRadius:12,background:`#f8f9fc`,border:`1px solid #f0f0f5`},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,$.jsx)(Q.Text,{strong:!0,style:{fontSize:13,color:`#6366f1`},children:(Ve===`image`?Se:be).find(e=>e.id===g.engineId)?.name||`-`})]}),Ve!==`image`&&(0,$.jsx)(`div`,{style:{borderRadius:12,background:`#f8f9fc`,padding:`8px 12px`},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:[g.duration||me,`s`]})]}),(0,$.jsx)(j7,{label:`比例`,value:g.aspectRatio||ge,options:[String(g.aspectRatio||ge)],expanded:!1,onToggle:()=>void 0,onSelect:()=>void 0,onClose:()=>ke(null)}),(0,$.jsx)(j7,{label:`分辨率`,value:g.resolution||ve,options:[String(g.resolution||ve)],expanded:!1,onToggle:()=>void 0,onSelect:()=>void 0,onClose:()=>ke(null)})]})}),Ve==`image`&&g&&(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:g.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:g.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:g.imagePx||`-`})]})]})}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 12px`,borderRadius:10,background:`rgba(255, 255, 255, 0.95)`,border:`1px solid rgba(231, 234, 240, 0.95)`,boxShadow:`0 2px 8px rgba(47, 52, 64, 0.03)`,flexShrink:1,minWidth:0},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,padding:`3px 8px`,borderRadius:6,background:`rgba(99, 102, 241, 0.08)`,flexShrink:0},children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#6366f1`,fontWeight:500},children:`文字积分`}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:13,color:`#6366f1`,fontWeight:700},children:Le})]}),(0,$.jsx)(Q.Text,{style:{color:`#94a3b8`,fontSize:12,fontWeight:500,flexShrink:0},children:`+`}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,padding:`3px 8px`,borderRadius:6,background:`rgba(16, 185, 129, 0.08)`,flexShrink:0},children:[(0,$.jsxs)(Q.Text,{style:{fontSize:12,color:`#10b981`,fontWeight:500},children:[`预估`,Ve===`image`?`图`:`视`,`积分`]}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:13,color:`#10b981`,fontWeight:700},children:dt()})]}),(0,$.jsx)(Q.Text,{style:{color:`#94a3b8`,fontSize:12,fontWeight:500,flexShrink:0},children:`=`}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,padding:`4px 10px`,borderRadius:6,background:`linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(139, 92, 246, 0.12) 100%)`,border:`1px solid rgba(99, 102, 241, 0.2)`,flexShrink:0},children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#6366f1`,fontWeight:600},children:`总计`}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14,color:`#6366f1`,fontWeight:800},children:(Le+dt()).toFixed(2)})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:12,marginLeft:`auto`},children:[(0,$.jsxs)(X,{size:`large`,onClick:()=>{h(!1),_(null),y(``),te(``),H([]),le({}),de(null),ke(null),n.resetFields()},style:{borderRadius:12,minWidth:120,height:44,fontWeight:500},children:[`配置新`,Ve===`image`?`图片`:`视频`]}),(0,$.jsx)(kw,{title:qt?``:`积分不足`,children:(0,$.jsx)(X,{type:`primary`,size:`large`,icon:(0,$.jsx)(r8,{}),onClick:()=>rn(g.id),loading:T[g.id]===`generating`,disabled:!qt||g.canGenerate===!1||T[g.id]===`generating`||T[g.id]===`done`,style:{borderRadius:12,minWidth:180,height:44,fontWeight:600,background:T[g.id]===`done`?`#10b981`:qt?`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`:`#d1d5db`,border:`none`,boxShadow:qt?`0 8px 24px rgba(99,102,241,0.3)`:`none`},children:T[g.id]===`done`?`生成完成`:T[g.id]===`generating`?`生成中...`:`生成${Ve===`image`?`图片`:`视频`} (${dt()}积分)`})})]})]}),g.references&&g.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:g.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`&&pe(`https://ceshi.apiforeign.minzhongzc.com${e.url}`)},children:[e.type===`image`?(0,$.jsx)(xU,{src:`https://ceshi.apiforeign.minzhongzc.com${e.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`},preview:!0}):(0,$.jsx)(M7,{src:`https://ceshi.apiforeign.minzhongzc.com${e.url}`,width:64,height:64}),(0,$.jsx)(TQ,{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))})]})]}),Ut.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:Ut.map((e,t)=>{let n=an(e),r=n.effectiveKey,i=F[e.id]??(e.optimizedPrompt||e.originalPrompt),a=z===e.id,o=e.genType||`image`;return(0,$.jsxs)(`div`,{className:`animate-slideInCard`,style:{animationDelay:`${t*.05}s`},children:[(0,$.jsxs)(`div`,{className:`record-item`,onClick:()=>B(a?null:e.id),style:{padding:`12px 16px`,borderRadius:a?`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:o===`image`?`#fef3c7`:`#dbeafe`},children:o===`image`?(0,$.jsx)(F6,{style:{color:`#d97706`,fontSize:12}}):(0,$.jsx)(V8,{style:{color:`#2563eb`,fontSize:12}})}),a?(0,$.jsx)(wZ,{style:{color:`#6366f1`,fontSize:11,flexShrink:0}}):(0,$.jsx)(R2,{style:{color:`#cbd5e1`,fontSize:11,flexShrink:0}}),(0,$.jsx)(TQ,{color:n.color,icon:on(n),style:{margin:0},children:n.label}),(0,$.jsx)(Q.Text,{style:{flex:1,fontSize:13,color:`#475569`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:i}),r===`prompt_optimized`&&(0,$.jsx)(TQ,{color:`processing`,style:{padding:`3px 10px`,fontSize:12,margin:0,flexShrink:0},children:`待生成`}),o===`image`?(0,$.jsxs)(`span`,{className:`mobile-meta`,translate:`no`,style:{fontSize:12,color:`#94a3b8`,flexShrink:0},children:[e.imageSize||`-`,` ·`,` `,e.imageProportion||`-`,` ·`,` `,e.imagePx||`-`,` ·`,` `,(0,$.jsx)(`span`,{className:`date-display`,translate:`no`,children:f7(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:f7(e.createdAt)})]}),(0,$.jsx)(`div`,{className:`record-actions`,onClick:e=>e.stopPropagation()})]}),a&&(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:[`优化后的提示词`,` `,(r===`prompt_optimized`||n.isFailure)&&L!==e.id&&(0,$.jsx)(`span`,{style:{color:`#6366f1`},children:`(可编辑)`})]}),L!==e.id&&(0,$.jsxs)(DV,{size:4,children:[(0,$.jsx)(kw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(A$,{}),onClick:async()=>{let e=await g7(i);Z.success(e?`已复制`:`复制失败`)},style:{color:`#94a3b8`}})}),(r===`prompt_optimized`||n.isFailure)&&(0,$.jsx)(kw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(s$,{}),onClick:()=>{R(e.id),I(t=>({...t,[e.id]:t[e.id]??e.optimizedPrompt??``}))},style:{color:`#6366f1`}})})]})]}),L===e.id?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(nW.TextArea,{value:i,onChange:t=>I(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:()=>R(null),children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{I(t=>({...t,[e.id]:i})),R(null),Z.success(`提示词已更新`)},style:{borderRadius:6,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`},children:`保存`})]})]}):(0,$.jsx)(`div`,{style:{padding:12,borderRadius:10,background:r===`prompt_optimized`?`rgba(99,102,241,0.02)`:`#f8f9fc`,border:r===`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:i})})]}),o===`image`?(0,$.jsx)(`div`,{style:{padding:`10px 14px`,borderRadius:10,background:`#f8f9fc`},children:(0,$.jsx)(`div`,{children:(0,$.jsx)(`div`,{style:{width:`100%`,display:`flex`,justifyContent:`flex-start`,flexWrap:`wrap`},children:[{label:`引擎`,value:`${e.engineName}`},{label:`文字积分`,value:`${e.textCreditsCost||0}`},{label:`图片积分`,value:`${e.creditsCost||0}`},{label:`分辨率`,value:e.imageSize||`-`},{label:`比例`,value:e.imageProportion||`-`},{label:`尺寸`,value:e.imagePx||`-`},{label:`附件`,value:e.includeMediaReferences?`生成时携带`:`仅用于提词或不携带`}].map((e,t)=>(0,$.jsxs)(`div`,{style:{width:`21%`,textAlign:`left`,marginBottom:10},children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`},children:e.label}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:12,color:`#1a1a2e`},children:e.value})]},t))})})}):(0,$.jsx)(`div`,{style:{padding:`10px 14px`,borderRadius:10,background:`#f8f9fc`},children:(0,$.jsx)(`div`,{children:(0,$.jsx)(`div`,{style:{width:`100%`,display:`flex`,justifyContent:`flex-start`,flexWrap:`wrap`},children:[{label:`引擎`,value:`${e.engineName}`},{label:`文字积分`,value:`${e.textCreditsCost||0}`},{label:`视频积分`,value:`${e.creditsCost||0}`},{label:`时长`,value:e.duration?`${e.duration}秒`:`-`},{label:`比例`,value:e.aspectRatio||`-`},{label:`分辨率`,value:e.resolution||`-`},{label:`附件`,value:e.includeMediaReferences?`生成时携带`:`仅用于提词或不携带`}].map((e,t)=>(0,$.jsxs)(`div`,{style:{width:`21%`,textAlign:`left`,marginBottom:10,marginRight:10},children:[(0,$.jsx)(Q.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`},children:e.label}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:12,color:`#1a1a2e`},children:e.value})]},t))})})}),(e.references&&e.references.length>0||n.isFailure)&&(0,$.jsxs)(`div`,{style:{marginTop:14},children:[(0,$.jsxs)(Q.Text,{style:{fontSize:12,color:`#94a3b8`,display:`block`,marginBottom:8},children:[`参考素材`,` `,n.isFailure&&(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`&&pe(`https://ceshi.apiforeign.minzhongzc.com${t.url}`)},children:[(0,$.jsx)(`div`,{style:{width:64,height:64,borderRadius:10,overflow:`hidden`},children:t.type===`image`?(0,$.jsx)(xU,{src:`https://ceshi.apiforeign.minzhongzc.com${t.url}`,style:{width:`100%`,height:`100%`,objectFit:`cover`},preview:!0}):(0,$.jsx)(M7,{src:`https://ceshi.apiforeign.minzhongzc.com${t.url}`,width:64,height:64})}),(0,$.jsx)(TQ,{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.isFailure&&(0,$.jsx)(`div`,{className:`ref-delete`,onClick:n=>{n.stopPropagation(),m5(t.url).catch(()=>{});let i=e.references.filter((e,t)=>t!==r);u7.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)(W2,{style:{color:`#fff`,fontSize:10}})})]},r)),n.isFailure&&(0,$.jsx)(Y1,{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?d5(t).then(n=>{let r={url:n.url,type:`image`,name:t.name||`图片`},i=e.references||[];u7.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=>{f5(t,n).then(r=>{let i={url:r.url,type:`video`,name:t.name||`视频`,duration:n||void 0},a=e.references||[];u7.getState().updateRecordReferences(e.id,[...a,i]),Z.success(`上传成功`)}).catch(()=>Z.error(`上传失败`))}),!1)},children:(0,$.jsx)(kw,{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)(PI,{style:{fontSize:18,color:`#94a3b8`}})})})})]})]})]}),(0,$.jsxs)(`div`,{style:{flex:`1 1 40%`,minWidth:220,position:`relative`},children:[r===`prompt_optimized`&&(0,$.jsxs)(`div`,{style:{position:`absolute`,inset:0,padding:16,borderRadius:12,background:`#f8f9fc`,border:`1px solid #e2e8f0`,display:`flex`,flexDirection:`column`,justifyContent:`space-between`},children:[(0,$.jsx)(`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,$.jsxs)(Q.Text,{style:{color:`#94a3b8`,fontSize:13},children:[o===`video`?`视频`:`图片`,`等待生成`]})}),(0,$.jsx)(kw,{title:(d?.credits||0){if((d?.credits||0){let t=document.createElement(`a`);t.href=`https://ceshi.apiforeign.minzhongzc.com${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:180,overflow:`hidden`},children:o===`video`?(0,$.jsx)(`video`,{src:`https://ceshi.apiforeign.minzhongzc.com${e.videoUrl}`,controls:!0,preload:`metadata`,style:{width:`100%`,height:`400px`,borderRadius:0}}):(0,$.jsx)(`img`,{src:`https://ceshi.apiforeign.minzhongzc.com${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)(DV,{children:[o===`video`?(0,$.jsx)(V8,{style:{color:`#6366f1`,fontSize:13}}):(0,$.jsx)(F6,{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:f7(e.generatedAt)})]})]}):n.isFailure?(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)(W2,{style:{color:`#ef4444`,fontSize:28}}),(0,$.jsxs)(Q.Text,{style:{color:`#ef4444`,fontSize:14,fontWeight:600},children:[o===`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)(OB,{style:{color:`#94a3b8`,fontSize:28}}),(0,$.jsx)(Q.Text,{style:{color:`#94a3b8`,fontSize:13},children:o===`image`?`待生成图片`:`待生成视频`})]})]})]})})]},e.id)})})]}),(0,$.jsx)(PG,{open:!!fe,onCancel:()=>pe(null),footer:null,width:480,centered:!0,destroyOnHidden:!0,closable:!1,title:null,styles:{body:{padding:0,background:`#000`,position:`relative`}},children:fe&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`video`,{src:fe,controls:!0,autoPlay:!0,style:{width:`100%`,display:`block`,maxHeight:`70vh`}}),(0,$.jsx)(`div`,{onClick:()=>pe(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)(iae,{style:{color:`#fff`,fontSize:16}})})]})})]})},Vse=()=>{let e=Ye(),{records:t,projects:n,fetchRecords:r,fetchProjects:i,generateVideo:a,retryGeneration:o}=u7(),s=t.items,[c,l]=(0,S.useState)(1),[u,d]=(0,S.useState)(10),[f,p]=(0,S.useState)({}),[m,h]=(0,S.useState)(void 0),[g,_]=(0,S.useState)(void 0),[v,y]=(0,S.useState)({}),[b,x]=(0,S.useState)(null),[C,w]=(0,S.useState)(null),T=async e=>{let t=e.genType||`image`,n=e.canRetry===!0;if(!n&&(e.canGenerate===!1||!e.configComplete)||n&&!e.configComplete){Z.error(`该记录生成配置不完整,请重新生成提词`);return}p(t=>({...t,[e.id]:!0})),Z.loading({content:`「${e.projectName}」正在提交${t===`video`?`视频`:`图片`}生成...`,duration:0,key:e.id});try{if(n)await o(e.id);else{let t=v[e.id];t&&t!==e.optimizedPrompt&&await h5(e.id,t),await a(e.id)}Z.success({content:`「${e.projectName}」已提交,正在生成中...`,key:e.id,duration:3})}catch(t){Z.error({content:t?.response?.data?.detail||t?.message||`提交生成失败`,key:e.id,duration:3})}finally{p(t=>({...t,[e.id]:!1}))}};(0,S.useEffect)(()=>{i()},[i]),(0,S.useEffect)(()=>{r({projectId:m,status:g,page:c,pageSize:u})},[r,m,g,c,u]);let E=s;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)(X0,{}),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)(DV,{children:[(0,$.jsx)(F4,{style:{color:`#94a3b8`}}),(0,$.jsx)(zC,{placeholder:`全部项目`,allowClear:!0,style:{width:200},onChange:e=>{h(e),l(1)},children:n.map(e=>(0,$.jsx)(zC.Option,{value:e.id,children:e.name},e.id))}),(0,$.jsxs)(zC,{placeholder:`全部状态`,allowClear:!0,style:{width:140},onChange:e=>{_(e),l(1)},children:[(0,$.jsx)(zC.Option,{value:`prompt_optimized`,children:`待生成`}),(0,$.jsx)(zC.Option,{value:`generating`,children:`生成中`}),(0,$.jsx)(zC.Option,{value:`completed`,children:`已完成`}),(0,$.jsx)(zC.Option,{value:`failed`,children:`失败`})]})]}),(0,$.jsxs)(Q.Text,{style:{marginLeft:`auto`,lineHeight:`32px`,color:`#94a3b8`,fontSize:13},children:[`共 `,t.total,` 条记录`]})]}),E.length===0?(0,$.jsx)(lC,{image:lC.PRESENTED_IMAGE_SIMPLE,description:`暂无生成记录`,style:{padding:60}}):(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},className:`stagger-children`,children:E.map((e,t)=>{let n=b===e.id,r=v[e.id]??e.optimizedPrompt,i=f[e.id],a=C===e.id,o=e.genType||`image`,s=A7(e);return(0,$.jsxs)(`div`,{className:`animate-slideInCard`,style:{animationDelay:`${t*.04}s`},children:[(0,$.jsxs)(`div`,{className:`record-item`,onClick:()=>w(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)(F6,{style:{color:`#d97706`,fontSize:12}}):(0,$.jsx)(V8,{style:{color:`#2563eb`,fontSize:12}})}),a?(0,$.jsx)(wZ,{style:{color:`#6366f1`,fontSize:12,flexShrink:0}}):(0,$.jsx)(R2,{style:{color:`#cbd5e1`,fontSize:12,flexShrink:0}}),(0,$.jsx)(TQ,{color:s.color,icon:s.isActive?(0,$.jsx)(Jm,{spin:!0}):s.isSuccess?(0,$.jsx)(V2,{}):s.isFailure?(0,$.jsx)(W2,{}):(0,$.jsx)(OB,{}),style:{margin:0},children:s.label}),(0,$.jsx)(TQ,{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.imageSize||`-`,` · `,e.imageProportion||`-`,` · `,e.imagePx||`-`,` · `,(0,$.jsx)(`span`,{className:`date-display`,translate:`no`,children:f7(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:f7(e.createdAt)})]}),(0,$.jsx)(`div`,{className:`record-actions`,onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(DV,{children:[e.status===`prompt_optimized`&&(0,$.jsx)(X,{type:`primary`,size:`small`,icon:(0,$.jsx)(W6,{}),loading:i,disabled:!e.configComplete||e.canGenerate===!1,onClick:()=>T(e),style:{borderRadius:8,background:`linear-gradient(135deg, #6366f1, #8b5cf6)`,border:`none`},children:`生成`}),s.isActive&&(0,$.jsx)(TQ,{color:`processing`,icon:(0,$.jsx)(Jm,{spin:!0}),style:{padding:`4px 12px`,fontSize:12},children:`生成中...`}),s.isFailure&&(0,$.jsx)(X,{type:`primary`,danger:!0,size:`small`,icon:(0,$.jsx)(W6,{}),loading:i,disabled:!e.configComplete||e.canRetry===!1,onClick:()=>T(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)(DV,{size:4,children:[(0,$.jsx)(kw,{title:`复制`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(A$,{}),onClick:async()=>{let e=await g7(r);Z.success(e?`已复制`:`复制失败`)},style:{color:`#94a3b8`}})}),e.status===`prompt_optimized`&&(0,$.jsx)(kw,{title:`编辑`,children:(0,$.jsx)(X,{type:`text`,size:`small`,icon:(0,$.jsx)(s$,{}),onClick:()=>{x(e.id),y(t=>({...t,[e.id]:t[e.id]??e.optimizedPrompt}))},style:{color:`#6366f1`}})})]})]}),n?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(nW.TextArea,{value:r,onChange:t=>y(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:()=>x(null),children:`取消`}),(0,$.jsx)(X,{size:`small`,type:`primary`,onClick:()=>{y(t=>({...t,[e.id]:r})),x(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.imagePx?`${e.imagePx} `:`-`},{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)(r8,{}),loading:i,disabled:!e.configComplete||e.canGenerate===!1,onClick:()=>T(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`?`生成视频`:`生成图片`})}),s.isFailure&&(0,$.jsx)(`div`,{style:{marginTop:16,display:`flex`,justifyContent:`flex-end`},children:(0,$.jsxs)(X,{type:`primary`,danger:!0,size:`large`,icon:(0,$.jsx)(W6,{}),loading:i,disabled:!e.configComplete||e.canRetry===!1,onClick:()=>T(e),style:{borderRadius:12,fontWeight:600,height:44},children:[`重新生成`,o===`video`?`视频`:`图片`]})})]}),(0,$.jsx)(`div`,{style:{flex:`1 1 40%`,minWidth:240},children:s.isActive?(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)(Jm,{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:`请耐心等待,生成完成后将自动展示`})]}):s.isSuccess&&(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)(kw,{title:`下载${o===`video`?`视频`:`图片`}`,children:(0,$.jsx)(X,{size:`small`,icon:(0,$.jsx)(U1,{}),onClick:()=>{let t=document.createElement(`a`);t.href=`https://ceshi.apiforeign.minzhongzc.com${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:`https://ceshi.apiforeign.minzhongzc.com${e.videoUrl}`,controls:!0,preload:`metadata`,style:{width:`100%`,height:`400px`,display:`block`}}):(0,$.jsx)(`img`,{src:`https://ceshi.apiforeign.minzhongzc.com${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)(DV,{children:[o===`video`?(0,$.jsx)(V8,{style:{color:`#6366f1`}}):(0,$.jsx)(F6,{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:[`生成于 `,f7(e.generatedAt)]})]})]}):s.isFailure?(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)(W2,{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)(OB,{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)(HW,{current:t.page||c,pageSize:t.pageSize||u,total:t.total,showSizeChanger:!0,showTotal:e=>`共 ${e} 条记录`,onChange:(e,t)=>{l(e),d(t)}})})]})},N7=({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()})},Hse=()=>{let{user:e}=n7(),[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),[d,f]=(0,S.useState)(0),[p,m]=(0,S.useState)(0),[h,g]=(0,S.useState)(null),[_,v]=(0,S.useState)(0);return(0,S.useEffect)(()=>{(async()=>{i(!0);let e=await g5(a,s);n(e.records),u(e.total),f(e.availableCredits??e.credits??0),m(e.nextExpiringCredits??0),g(e.nextLastUsableAt??null),v(e.totalConsumed??0),i(!1)})()},[a,s]),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(hq,{gutter:[16,16],style:{marginBottom:24},children:[(0,$.jsx)(mR,{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)(DV,{style:{marginBottom:10},children:[(0,$.jsx)(U8,{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)(N7,{value:d})})]})]})}),(0,$.jsx)(mR,{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)(DV,{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)(n2,{style:{color:`#10b981`,fontSize:14}})}),(0,$.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:14},children:`最近即将过期`})]}),(0,$.jsx)(`div`,{style:{color:`#f59e0b`,fontSize:28,fontWeight:800},children:(0,$.jsx)(N7,{value:p})}),(0,$.jsx)(`div`,{style:{color:`#94a3b8`,fontSize:12,marginTop:6},children:h?`最后可用:${bse(h)}`:`暂无即将过期积分`})]})}),(0,$.jsx)(mR,{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)(DV,{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)(q0,{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)(N7,{value:_})})]})})]}),(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)(fQ,{columns:[{title:`类型`,dataIndex:`type`,key:`type`,width:100,render:e=>{let t={recharge:{label:`发放/充值`,color:`green`,positive:!0},consume:{label:`消费`,color:`orange`,positive:!1},refund:{label:`业务退款`,color:`purple`,positive:!0},expire:{label:`积分过期`,color:`default`,positive:!1},revoke:{label:`积分撤销`,color:`red`,positive:!1},team_internal:{label:`历史团队流转`,color:`blue`,positive:!1}}[e]||{label:e,color:`default`,positive:!1};return(0,$.jsx)(TQ,{color:t.color,icon:t.positive?(0,$.jsx)(n2,{}):(0,$.jsx)(q0,{}),children:t.label})}},{title:`有效积分变动`,key:`balanceDelta`,width:150,render:(e,t)=>{let n=t.balanceDelta??t.amount??0,r=t.expiredAmount??0;return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(Q.Text,{strong:!0,style:{color:n>0?`#10b981`:n<0?`#ef4444`:`#64748b`,fontSize:15},children:[n>0?`+`:``,n]}),r>0&&(0,$.jsxs)(`div`,{style:{color:`#94a3b8`,fontSize:12},children:[`已过期 `,r]})]})}},{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:f7(e)})}],dataSource:t,rowKey:`id`,loading:r,pagination:{current:a,pageSize:s,total:l,onChange:(e,t)=>{o(e),c(t)},showSizeChanger:!0,showTotal:e=>`共 ${e} 条`},scroll:{x:500}})})]})]})},Use=()=>{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)(0),[u,d]=(0,S.useState)(0),[f,p]=(0,S.useState)(1),[m]=(0,S.useState)(10);(0,S.useEffect)(()=>{h()},[f]);let h=async()=>{t(!0);try{let e=await g5(f,m);r(e.records||[]),a(e.availableCredits??e.credits??0),s(e.total||0),l(e.totalGranted??0),d(e.totalConsumed??0)}catch{r([])}t(!1)};return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(hq,{gutter:[16,16],style:{marginBottom:24},children:[(0,$.jsx)(mR,{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)(U8,{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)(mR,{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:c.toLocaleString()})]})}),(0,$.jsx)(mR,{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:u.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)(lG,{spinning:e,children:n.length===0?(0,$.jsx)(lC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无积分变动记录`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(fQ,{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(9,88,217,0.1)`},expire:{color:`#64748b`,label:`积分过期`,bg:`rgba(100,116,139,0.1)`},revoke:{color:`#dc2626`,label:`积分撤销`,bg:`rgba(220,38,38,0.1)`}}[e]||{color:`#64748b`,label:e,bg:`rgba(100,116,139,0.1)`};return(0,$.jsx)(TQ,{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:140,align:`right`,render:e=>{let t=Number(e??0);return(0,$.jsxs)(Q.Text,{strong:!0,style:{fontWeight:700,color:t>0?`#10b981`:t<0?`#ef4444`:`#64748b`,fontSize:15},children:[t>0?`+`:``,t]})}},{title:`创建时间`,key:`createdAt`,width:180,render:(e,t)=>{let n=t.createdAt||t.created_at||t.createTime||t.create_time;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)(HW,{current:f,pageSize:m,total:o,onChange:e=>{p(e)},size:`small`})})]})})})]})]})},Wse=()=>{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),[l,u]=(0,S.useState)(``),[d,f]=(0,S.useState)([null,null]),p=(0,S.useCallback)(async()=>{t(!0);try{let e=await C5(o,c,{statusFilter:l||void 0,startDate:d[0]?.format?.(`YYYY-MM-DD`),endDate:d[1]?.format?.(`YYYY-MM-DD`)});r(e.items||[]),a(e.total||0)}catch{r([])}t(!1)},[o,l,d]);return(0,S.useEffect)(()=>{p()},[p]),(0,$.jsx)(`div`,{children:(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,$.jsx)(MV,{style:{color:`#0ea5e9`,fontSize:16}}),(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:16},children:`订单记录`}),(0,$.jsxs)(`span`,{style:{color:`#94a3b8`,fontSize:13},children:[`共 `,i,` 条记录`]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:16,flexWrap:`wrap`},children:[(0,$.jsx)(zC,{placeholder:`支付状态`,allowClear:!0,style:{width:130},value:l||void 0,onChange:e=>{u(e||``),s(1)},options:[{value:`pending`,label:`待支付`},{value:`paid`,label:`已支付`},{value:`refunded`,label:`已退款`},{value:`failed`,label:`支付失败`},{value:`cancelled`,label:`已取消`}]}),(0,$.jsx)(FB.RangePicker,{value:d,onChange:e=>{f(e),s(1)},allowClear:!0,placeholder:[`开始日期`,`结束日期`]}),(l||d[0]||d[1])&&(0,$.jsx)(Q.Link,{onClick:()=>{u(``),f([null,null]),s(1)},children:`重置`})]}),(0,$.jsx)(`div`,{style:{borderRadius:16,background:`#fff`,border:`1px solid #f0f0f5`,overflow:`hidden`},children:(0,$.jsx)(lG,{spinning:e,children:n.length===0?(0,$.jsx)(lC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无订单记录`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(fQ,{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)(R0,{style:{fontSize:16}}),label:`支付宝`,color:`#1677ff`},wechat:{icon:(0,$.jsx)(K8,{style:{fontSize:16}}),label:`微信支付`,color:`#07c160`}},i=r[n]||r.wechat;return(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,$.jsx)(`span`,{style:{color:i.color},children:i.icon}),(0,$.jsx)(`span`,{style:{fontSize:13,color:`#374151`},children:i.label})]})}},{title:`金额`,key:`amount`,width:100,align:`right`,render:(e,t)=>{let n=t.amount||t.total_amount||0;return(0,$.jsxs)(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)(TQ,{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)(HW,{current:o,pageSize:c,total:i,onChange:e=>{s(e)},size:`small`})})]})})})]})})},Gse=()=>{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 y5(c,u);r(e.items||[]),s(e.total||0)}catch{r([])}t(!1)},f=async()=>{try{a(await b5())}catch{a(0)}},p=async e=>{try{await x5(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)(b2,{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)(lG,{spinning:e,children:n.length===0?(0,$.jsx)(lC,{description:(0,$.jsx)(`span`,{style:{color:`#94a3b8`},children:`暂无消息`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(fQ,{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)(d8,{style:{fontSize:14}})},credit:{color:`#f59e0b`,label:`积分`,bg:`rgba(245,158,11,0.1)`,icon:(0,$.jsx)(U8,{style:{fontSize:14}})},promo:{color:`#8b5cf6`,label:`活动`,bg:`rgba(139,92,246,0.1)`,icon:(0,$.jsx)(a3,{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,render:e=>(0,$.jsx)(`div`,{style:{maxWidth:300},dangerouslySetInnerHTML:{__html:e}})},{title:`状态`,dataIndex:`isRead`,key:`isRead`,width:80,render:(e,t)=>e??t.is_read?(0,$.jsx)(TQ,{color:`gray`,style:{background:`rgba(148,163,184,0.1)`},children:`已读`}):(0,$.jsx)(TQ,{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)(HW,{current:c,pageSize:u,total:o,onChange:e=>{l(e)},size:`small`})})]})})})]})})},P7=()=>{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)(uL,{activeKey:t,onChange:n,items:[{key:`credits`,label:`积分明细`},{key:`orders`,label:`订单记录`}],style:{marginBottom:24},size:`large`}),t===`credits`&&(0,$.jsx)(Use,{}),t===`orders`&&(0,$.jsx)(Wse,{})]})};function F7(e){return`/static/${e.startsWith(`/`)?e.slice(1):e}&w=300&q=50`}var Kse=(e,t)=>e<=1?6:e===2||e===4||e===3?3:2,qse=e=>A7(e).label,Jse=300,Yse=.6,Xse=e=>{let t=Math.sin(e*9999)*1e4;return t-Math.floor(t)},I7=(e,t=0)=>{if(!e)return 0;let n=new Date(e).getTime();if(isNaN(n))return 0;let r=Math.max(0,(Date.now()-n)/1e3);if(r>=Jse)return 99;let i=Math.min(99,r*Yse),a=t*3+Xse(t+1)*8;return i=Math.max(0,i-a),i},Zse=({item:e,isPending:t,isCompleted:n,onAnimationComplete:r,index:i=0})=>{let[a,o]=(0,S.useState)(0),[s,c]=(0,S.useState)(!1),l=(0,S.useRef)(null);return(0,S.useEffect)(()=>{s||o(I7(e.createdAt,i))},[e,i,s]),(0,S.useEffect)(()=>{if(n&&!s){c(!0);return}if(!t&&!s){l.current&&=(clearInterval(l.current),null);return}return l.current=window.setInterval(()=>{s||o(I7(e.createdAt,i))},1e3),()=>{l.current&&=(clearInterval(l.current),null)}},[e.createdAt,t,n,s,e.id,i]),(0,S.useEffect)(()=>{if(s){let e=a,t=Date.now(),n=()=>{let i=Date.now()-t,a=Math.min(i/800,1),s=1-(1-a)**3;o(e+(100-e)*s),a<1?requestAnimationFrame(n):setTimeout(()=>{r?.()},100)};requestAnimationFrame(n)}},[s,a,r]),!t&&!s?null:(0,$.jsx)(`div`,{style:{marginTop:4},children:(0,$.jsxs)(`div`,{style:{textAlign:`center`,fontSize:13,color:`#8b5cf6`,fontWeight:700,textShadow:`0 0 8px rgba(139, 92, 246, 0.3)`,transition:`all 0.3s ease-out`},children:[Math.round(a),`%`]})})},Qse=({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,createdAt:e.createdAt})):[e],[o,s]=(0,S.useState)(new Set),c=(0,S.useRef)(new Set);(0,S.useEffect)(()=>{let e=`gen-task-resource-grid-animations`;if(document.getElementById(e))return;let t=document.createElement(`style`);t.id=e,t.textContent=`
.gen-task-loading-bg {
position: relative;
diff --git a/video-gen-app/dist/index.html b/video-gen-app/dist/index.html
index 52b222db..3709a053 100644
--- a/video-gen-app/dist/index.html
+++ b/video-gen-app/dist/index.html
@@ -27,7 +27,7 @@
民众智创
-
+
diff --git a/video-gen-app/src/components/Layout/AppLayout.tsx b/video-gen-app/src/components/Layout/AppLayout.tsx
index 22f24513..a6883d4b 100644
--- a/video-gen-app/src/components/Layout/AppLayout.tsx
+++ b/video-gen-app/src/components/Layout/AppLayout.tsx
@@ -515,12 +515,11 @@ const AppLayout: React.FC = () => {
const [isMobile, setIsMobile] = useState(false);
const [operationManualUrl, setOperationManualUrl] = useState('');
- // 监听"被踢出"事件 — 单设备登录互斥,显示顶部消息并跳转登录
+ // 监听"被踢出"事件 — 单设备登录互斥,跳转登录页并带上标识
useEffect(() => {
const handleKickedOut = () => {
- message.warning('您的账号已在其他设备登录,请重新登录');
localStorage.removeItem('token');
- navigate('/login');
+ navigate('/login?kicked_out=1');
};
window.addEventListener('kicked-out', handleKickedOut);
return () => window.removeEventListener('kicked-out', handleKickedOut);
diff --git a/video-gen-app/src/pages/LoginPage.tsx b/video-gen-app/src/pages/LoginPage.tsx
index 60784104..9b65011c 100644
--- a/video-gen-app/src/pages/LoginPage.tsx
+++ b/video-gen-app/src/pages/LoginPage.tsx
@@ -74,6 +74,17 @@ const LoginPage: React.FC = () => {
}
}, [tabParam]);
+ // 单设备登录互斥 — 被踢出后显示提示
+ useEffect(() => {
+ if (searchParams.get('kicked_out') === '1') {
+ message.warning('您的账号已在其他设备登录,请重新登录');
+ // 清除参数,避免刷新重复提示
+ const url = new URL(window.location.href);
+ url.searchParams.delete('kicked_out');
+ window.history.replaceState({}, '', url.toString());
+ }
+ }, [searchParams]);
+
const goToRedirect = () => {
if (redirect) {
try {