import{a as e,n as t}from"./preload-helper-DxX6f4wy.js";import{$ as n,A as r,E as i,F as a,I as ee,O as o,P as s,d as te,et as c,f as l,g as u,h as d,k as f,n as p,r as m,t as h,tt as g,y as ne}from"./Fade-Bj1YUcWe.js";import{n as re}from"./notistack.esm-Bl-G2Rx2.js";import{n as ie,t as _}from"./Box-BoFhqo9n.js";import{r as v,t as ae}from"./ButtonBase-dVPwHUcG.js";import{t as oe}from"./useMediaQuery-D3QrrE_7.js";import{i as se}from"./Menu-DT9JOTRT.js";import{f as ce}from"./InputBase-Twl1xf9g.js";import{t as y}from"./Button-uK26k-ET.js";import{t as le}from"./Slider-DvHcYIbx.js";import{t as b}from"./Stack-sZ5R3ZLo.js";import{t as x}from"./CircularProgress-zVZJTwOj.js";import{t as S}from"./IconButton-R7hSIaQ0.js";import{t as C}from"./Chip-GlqHKmzW.js";import{t as ue}from"./Card-CiLxEr6B.js";import{t as de}from"./CardActionArea-D8nn7L9K.js";import{t as fe}from"./CardContent-BxWf9zgS.js";import{r as pe,t as me}from"./DialogContent-1cFv81I0.js";import{n as w,t as he}from"./DialogTitle-C0Sfw4o6.js";import{t as T}from"./Grid-DQAAwiyo.js";import{t as ge}from"./TablePagination-BuO92KZ6.js";import{t as E}from"./TableCell-XF5Kj4Pi.js";import{a as _e,i as ve,n as ye,r as be,t as D}from"./TableRow-DtlSlVfq.js";import{t as O}from"./Delete-DYGwmL1v.js";import{r as xe}from"./siteStore-BLhBstND.js";import{t as Se}from"./Loading-BIwVunRy.js";import{y as Ce}from"./index-BTWPkaRa.js";import{n as k,r as A,t as we}from"./media-C5azgant.js";import{t as Te}from"./LazyImage-CunJC6i3.js";import{n as Ee,r as De}from"./image-DdejlIxb.js";import{_ as Oe,c as ke,o as Ae,s as je}from"./admin-D5DUHyY6.js";function Me(e){return a(`MuiLinearProgress`,e)}s(`MuiLinearProgress`,[`root`,`colorPrimary`,`colorSecondary`,`determinate`,`indeterminate`,`buffer`,`query`,`dashed`,`dashedColorPrimary`,`dashedColorSecondary`,`bar`,`bar1`,`bar2`,`barColorPrimary`,`barColorSecondary`,`bar1Indeterminate`,`bar1Determinate`,`bar1Buffer`,`bar2Indeterminate`,`bar2Buffer`]);var j=e(t()),M=n(),N=4,P=g`
  0% {
    left: -35%;
    right: 100%;
  }

  60% {
    left: 100%;
    right: -90%;
  }

  100% {
    left: 100%;
    right: -90%;
  }
`,Ne=typeof P==`string`?null:c`
        animation: ${P} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
      `,F=g`
  0% {
    left: -200%;
    right: 100%;
  }

  60% {
    left: 107%;
    right: -8%;
  }

  100% {
    left: 107%;
    right: -8%;
  }
`,I=typeof F==`string`?null:c`
        animation: ${F} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite;
      `,L=g`
  0% {
    opacity: 1;
    background-position: 0 -23px;
  }

  60% {
    opacity: 0;
    background-position: 0 -23px;
  }

  100% {
    opacity: 1;
    background-position: -200px -23px;
  }
`,R=typeof L==`string`?null:c`
        animation: ${L} 3s infinite linear;
      `,z=e=>{let{classes:t,variant:n,color:r}=e;return i({root:[`root`,`color${d(r)}`,n],dashed:[`dashed`,`dashedColor${d(r)}`],bar1:[`bar`,`bar1`,`barColor${d(r)}`,(n===`indeterminate`||n===`query`)&&`bar1Indeterminate`,n===`determinate`&&`bar1Determinate`,n===`buffer`&&`bar1Buffer`],bar2:[`bar`,`bar2`,n!==`buffer`&&`barColor${d(r)}`,n===`buffer`&&`color${d(r)}`,(n===`indeterminate`||n===`query`)&&`bar2Indeterminate`,n===`buffer`&&`bar2Buffer`]},Me,t)},B=(e,t)=>e.vars?e.vars.palette.LinearProgress[`${t}Bg`]:e.palette.mode===`light`?r(e.palette[t].main,.62):f(e.palette[t].main,.5),V=u(`span`,{name:`MuiLinearProgress`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`color${d(n.color)}`],t[n.variant]]}})(l(({theme:e})=>({position:`relative`,overflow:`hidden`,display:`block`,height:4,zIndex:0,"@media print":{colorAdjust:`exact`},variants:[...Object.entries(e.palette).filter(m()).map(([t])=>({props:{color:t},style:{backgroundColor:B(e,t)}})),{props:({ownerState:e})=>e.color===`inherit`&&e.variant!==`buffer`,style:{"&::before":{content:`""`,position:`absolute`,left:0,top:0,right:0,bottom:0,backgroundColor:`currentColor`,opacity:.3}}},{props:{variant:`buffer`},style:{backgroundColor:`transparent`}},{props:{variant:`query`},style:{transform:`rotate(180deg)`}}]}))),Pe=u(`span`,{name:`MuiLinearProgress`,slot:`Dashed`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.dashed,t[`dashedColor${d(n.color)}`]]}})(l(({theme:e})=>({position:`absolute`,marginTop:0,height:`100%`,width:`100%`,backgroundSize:`10px 10px`,backgroundPosition:`0 -23px`,variants:[{props:{color:`inherit`},style:{opacity:.3,backgroundImage:`radial-gradient(currentColor 0%, currentColor 16%, transparent 42%)`}},...Object.entries(e.palette).filter(m()).map(([t])=>{let n=B(e,t);return{props:{color:t},style:{backgroundImage:`radial-gradient(${n} 0%, ${n} 16%, transparent 42%)`}}})]})),R||{animation:`${L} 3s infinite linear`}),H=u(`span`,{name:`MuiLinearProgress`,slot:`Bar1`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.bar,t.bar1,t[`barColor${d(n.color)}`],(n.variant===`indeterminate`||n.variant===`query`)&&t.bar1Indeterminate,n.variant===`determinate`&&t.bar1Determinate,n.variant===`buffer`&&t.bar1Buffer]}})(l(({theme:e})=>({width:`100%`,position:`absolute`,left:0,bottom:0,top:0,transition:`transform 0.2s linear`,transformOrigin:`left`,variants:[{props:{color:`inherit`},style:{backgroundColor:`currentColor`}},...Object.entries(e.palette).filter(m()).map(([t])=>({props:{color:t},style:{backgroundColor:(e.vars||e).palette[t].main}})),{props:{variant:`determinate`},style:{transition:`transform .${N}s linear`}},{props:{variant:`buffer`},style:{zIndex:1,transition:`transform .${N}s linear`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:{width:`auto`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:Ne||{animation:`${P} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite`}}]}))),U=u(`span`,{name:`MuiLinearProgress`,slot:`Bar2`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.bar,t.bar2,t[`barColor${d(n.color)}`],(n.variant===`indeterminate`||n.variant===`query`)&&t.bar2Indeterminate,n.variant===`buffer`&&t.bar2Buffer]}})(l(({theme:e})=>({width:`100%`,position:`absolute`,left:0,bottom:0,top:0,transition:`transform 0.2s linear`,transformOrigin:`left`,variants:[...Object.entries(e.palette).filter(m()).map(([t])=>({props:{color:t},style:{"--LinearProgressBar2-barColor":(e.vars||e).palette[t].main}})),{props:({ownerState:e})=>e.variant!==`buffer`&&e.color!==`inherit`,style:{backgroundColor:`var(--LinearProgressBar2-barColor, currentColor)`}},{props:({ownerState:e})=>e.variant!==`buffer`&&e.color===`inherit`,style:{backgroundColor:`currentColor`}},{props:{color:`inherit`},style:{opacity:.3}},...Object.entries(e.palette).filter(m()).map(([t])=>({props:{color:t,variant:`buffer`},style:{backgroundColor:B(e,t),transition:`transform .${N}s linear`}})),{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:{width:`auto`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:I||{animation:`${F} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite`}}]}))),Fe=j.forwardRef(function(e,t){let n=te({props:e,name:`MuiLinearProgress`}),{className:r,color:i=`primary`,value:a,valueBuffer:o,variant:s=`indeterminate`,...c}=n,l={...n,color:i,variant:s},u=z(l),d=ce(),f={},p={bar1:{},bar2:{}};if((s===`determinate`||s===`buffer`)&&a!==void 0){f[`aria-valuenow`]=Math.round(a),f[`aria-valuemin`]=0,f[`aria-valuemax`]=100;let e=a-100;d&&(e=-e),p.bar1.transform=`translateX(${e}%)`}if(s===`buffer`&&o!==void 0){let e=(o||0)-100;d&&(e=-e),p.bar2.transform=`translateX(${e}%)`}return(0,M.jsxs)(V,{className:ee(u.root,r),ownerState:l,role:`progressbar`,...f,ref:t,...c,children:[s===`buffer`?(0,M.jsx)(Pe,{className:u.dashed,ownerState:l}):null,(0,M.jsx)(H,{className:u.bar1,ownerState:l,style:p.bar1}),s===`determinate`?null:(0,M.jsx)(U,{className:u.bar2,ownerState:l,style:p.bar2})]})}),Ie=v((0,M.jsx)(`path`,{d:`M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M19 18H6c-2.21 0-4-1.79-4-4s1.79-4 4-4h.71C7.37 7.69 9.48 6 12 6c3.04 0 5.5 2.46 5.5 5.5v.5H19c1.66 0 3 1.34 3 3s-1.34 3-3 3`}),`CloudQueue`),W=v((0,M.jsx)(`path`,{d:`M8 19h3v3h2v-3h3l-4-4zm8-15h-3V1h-2v3H8l4 4zM4 9v2h16V9zm0 3h16v2H4z`}),`Compress`);function G(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`}function Le(e,t){if(t)return t.split(`.`).reduce((e,t)=>{if(e&&typeof e==`object`)return e[t]},e)}function Re(e,t,n){return e.filter(e=>{if(e.type===`site`){let r=Le(t,e.key||``);return typeof r==`string`&&k(r)===n}return e.type===`post`?!!e.id&&!!e.title:e.type===`friend`||e.type===`user`?!!e.id||!!e.name:!0})}function ze({bindings:e}){let t=(0,j.useMemo)(()=>{let t={};for(let n of e)t[n.type]||(t[n.type]=[]),t[n.type].push(n);return t},[e]);if(e.length===0)return(0,M.jsx)(p,{variant:`body2`,color:`text.secondary`,children:`无绑定对象`});let n={post:`文章`,user:`用户`,friend:`友链`,site:`站点设置`};return(0,M.jsx)(b,{spacing:1.5,children:Object.entries(t).map(([e,t])=>(0,M.jsxs)(_,{children:[(0,M.jsx)(p,{variant:`body2`,fontWeight:600,sx:{mb:.5},children:n[e]||e}),(0,M.jsx)(_,{sx:{display:`flex`,flexWrap:`wrap`,gap:.75},children:t.map((t,n)=>(0,M.jsx)(C,{label:t.title||t.name||t.key||`ID ${t.id}`,size:`small`,sx:{borderRadius:1}},`${e}-${t.id??t.key??n}`))})]},e))})}function K(){let e=oe(ne().breakpoints.down(`lg`)),{enqueueSnackbar:t}=re(),n=xe(),[r,i]=(0,j.useState)([]),[a,ee]=(0,j.useState)(!0),[s,te]=(0,j.useState)(0),[c,l]=(0,j.useState)(10),[u,d]=(0,j.useState)(0),[f,m]=(0,j.useState)(!1),[g,v]=(0,j.useState)(null),[ce,C]=(0,j.useState)(!1),[k,Me]=(0,j.useState)(null),[N,P]=(0,j.useState)([]),[Ne,F]=(0,j.useState)(!1),[I,L]=(0,j.useState)(!1),[R,z]=(0,j.useState)(null),[B,V]=(0,j.useState)(new Map),[Pe,H]=(0,j.useState)(!1),[U,Le]=(0,j.useState)(null),[K,Be]=(0,j.useState)(1920),[q,Ve]=(0,j.useState)(500),[He,Ue]=(0,j.useState)(.4),[J,We]=(0,j.useState)(!1),[Y,Ge]=(0,j.useState)(null),[X,Ke]=(0,j.useState)(!1),qe=(0,j.useMemo)(()=>g?Re(g.bindings,n.config,g.id):[],[g,n.config]),Z=async(e=s+1,n=c)=>{ee(!0);let r=await Ae(e,n);r?(i(r.list),d(r.total)):t(`加载媒体列表失败`,{variant:`error`}),ee(!1)},Q=async()=>{Ke(!0);let e=await ke();e&&Ge(e),Ke(!1)};(0,j.useEffect)(()=>{Z(),Q()},[]),(0,j.useEffect)(()=>{Z(s+1,c)},[s,c]);let Je=(e,t)=>{te(t)},Ye=e=>{l(parseInt(e.target.value,10)),te(0)},Xe=async(e,n=!1)=>{if(m(!0),!n){let t=B.get(e.id);if(t){v(t),C(!1);return}}C(!0);let r=await je(e.id);C(!1),r?(v(r),V(t=>new Map(t).set(e.id,r))):(t(`加载媒体详情失败`,{variant:`error`}),m(!1))},$=()=>{m(!1),v(null)},Ze=async e=>{if(Me(e),P([]),g&&g.id===e.id){P(g.bindings);return}F(!0);let t=await je(e.id);F(!1),t&&P(t.bindings)},Qe=()=>{Me(null),P([])},$e=e=>{Le(e),Be(1920),Ve(500),Ue(.4),H(!0)},et=()=>{H(!1),Le(null)},tt=async()=>{if(!U)return;let e=U;We(!0),z(e.id),et();try{let n=await Ee(A(e.id),{maxSize:q*1024,maxDim:K,minQuality:He});if(De(n)>q*1024){t(`按当前参数压缩后仍超过目标大小，请提高压缩强度后再试`,{variant:`warning`});return}let r=await Oe(e.id,{base64:n,mimeType:`image/jpeg`,name:e.name.replace(/\.[^.]+$/,`.jpg`)});r.msg?t(r.msg,{variant:`error`}):(t(`压缩成功：${G(e.size)} → ${G(r.data?.size||0)}`,{variant:`success`}),V(t=>{let n=new Map(t);return n.delete(e.id),n}),Z(s+1,c),Q(),g&&g.id===e.id&&Xe(e,!0))}catch(e){let n=e instanceof Error?e.message:`压缩失败`;t(n,{variant:`error`})}finally{z(null),We(!1)}},nt=async()=>{if(!k)return;L(!0);let e=await we(k.id);L(!1),Qe(),e?(t(`媒体已删除`,{variant:`success`}),Z(s+1,c),Q(),g&&g.id===k.id&&$()):t(`删除失败`,{variant:`error`})},rt={boxShadow:e=>e.palette.mode===`light`?`0 4px 20px ${o(e.palette.primary.main,.08)}`:`0 4px 20px ${o(e.palette.common.black,.25)}`},it=(e,t)=>(0,M.jsx)(_,{sx:{width:t,height:t,borderRadius:1,overflow:`hidden`,bgcolor:e=>o(e.palette.primary.main,.06),flexShrink:0},children:(0,M.jsx)(Te,{src:A(e.id),alt:e.name,objectFit:`cover`,placeholder:`skeleton`,style:{borderRadius:0}})});return(0,M.jsx)(h,{in:!0,timeout:400,children:(0,M.jsxs)(_,{children:[(0,M.jsxs)(_,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:3,gap:2,minWidth:0},children:[(0,M.jsxs)(_,{sx:{minWidth:0},children:[(0,M.jsx)(p,{variant:`h5`,sx:{fontWeight:700,overflowWrap:`break-word`},children:`媒体管理`}),(0,M.jsx)(p,{variant:`body2`,color:`text.secondary`,sx:{overflowWrap:`break-word`},children:`查看、压缩和删除媒体文件`})]}),(()=>{let e=500*1024*1024,t=Y?.totalSize||0,n=Math.min(100,t/e*100),r=n>=90?`error`:n>=70?`warning`:`success`;return(0,M.jsx)(Ce,{title:Y?`共 ${Y.count} 个文件 · 已用 ${Math.round(n)}%`:`刷新以获取存储统计`,children:(0,M.jsxs)(ie,{elevation:0,onClick:()=>!X&&Q(),sx:{display:`flex`,alignItems:`center`,gap:{xs:1,sm:1.5},px:{xs:1.25,sm:1.5},py:.75,borderRadius:5,flexShrink:0,cursor:X?`default`:`pointer`,bgcolor:e=>o(e.palette[r].main,.06),border:`1px solid`,borderColor:e=>o(e.palette[r].main,.15),transition:`all 0.2s ease`,"&:hover":X?{}:{bgcolor:e=>o(e.palette[r].main,.1),borderColor:e=>o(e.palette[r].main,.25)}},children:[X?(0,M.jsx)(x,{size:16,color:r}):(0,M.jsx)(Ie,{sx:{fontSize:18,color:`${r}.main`}}),(0,M.jsx)(_,{sx:{width:{xs:48,sm:96}},children:(0,M.jsx)(Fe,{variant:`determinate`,value:n,sx:{height:5,borderRadius:2.5,bgcolor:`action.hover`,"& .MuiLinearProgress-bar":{borderRadius:2.5,bgcolor:`${r}.main`}}})}),(0,M.jsx)(p,{variant:`caption`,fontWeight:600,sx:{whiteSpace:`nowrap`,color:`${r}.dark`,fontSize:{xs:`0.7rem`,sm:`0.75rem`}},children:Y?`${G(t)} / ${G(e)}`:X?`统计中`:`点击检测`})]})})})()]}),a?(0,M.jsx)(Se,{text:`加载媒体中...`}):(0,M.jsx)(h,{in:!0,timeout:400,children:(0,M.jsx)(_,{children:e?(0,M.jsxs)(T,{container:!0,spacing:2,children:[r.map(e=>(0,M.jsx)(T,{item:!0,xs:12,sm:6,children:(0,M.jsx)(ue,{elevation:0,sx:{borderRadius:1,...rt},children:(0,M.jsx)(de,{onClick:()=>Xe(e),sx:{borderRadius:1},children:(0,M.jsxs)(fe,{sx:{p:2},children:[(0,M.jsxs)(_,{sx:{display:`flex`,gap:2,mb:1.5},children:[it(e,72),(0,M.jsxs)(_,{sx:{flex:1,minWidth:0},children:[(0,M.jsx)(p,{variant:`subtitle2`,fontWeight:700,noWrap:!0,children:e.name}),(0,M.jsx)(p,{variant:`caption`,color:`text.secondary`,sx:{display:`block`},children:G(e.size)}),(0,M.jsx)(p,{variant:`caption`,color:`text.secondary`,sx:{display:`block`},children:e.width&&e.height?`${e.width} × ${e.height}`:`未知尺寸`})]})]}),(0,M.jsxs)(_,{sx:{display:`flex`,justifyContent:`flex-end`,gap:.5},children:[(0,M.jsx)(S,{onClick:t=>{t.stopPropagation(),$e(e)},disabled:R===e.id,sx:{width:40,height:40},children:R===e.id?(0,M.jsx)(x,{size:18}):(0,M.jsx)(W,{fontSize:`small`})}),(0,M.jsx)(S,{color:`error`,onClick:t=>{t.stopPropagation(),Ze(e)},sx:{width:40,height:40},children:(0,M.jsx)(O,{fontSize:`small`})})]})]})})})},e.id)),r.length===0&&(0,M.jsx)(T,{item:!0,xs:12,children:(0,M.jsx)(_,{sx:{textAlign:`center`,py:4,color:`text.secondary`},children:`暂无媒体文件`})})]}):(0,M.jsxs)(ie,{elevation:0,sx:{borderRadius:1,overflow:`hidden`,...rt},children:[(0,M.jsx)(be,{children:(0,M.jsxs)(_e,{size:`small`,children:[(0,M.jsx)(ye,{children:(0,M.jsxs)(D,{children:[(0,M.jsx)(E,{children:`预览`}),(0,M.jsx)(E,{children:`文件名`}),(0,M.jsx)(E,{children:`大小`}),(0,M.jsx)(E,{children:`尺寸`}),(0,M.jsx)(E,{children:`类型`}),(0,M.jsx)(E,{children:`上传时间`}),(0,M.jsx)(E,{align:`right`,children:`操作`})]})}),(0,M.jsxs)(ve,{children:[r.map(e=>(0,M.jsxs)(D,{hover:!0,sx:{position:`relative`},children:[(0,M.jsx)(E,{sx:{width:80},children:it(e,56)}),(0,M.jsx)(E,{children:(0,M.jsx)(p,{variant:`body2`,fontWeight:600,noWrap:!0,sx:{maxWidth:220},children:e.name})}),(0,M.jsx)(E,{children:G(e.size)}),(0,M.jsx)(E,{children:e.width&&e.height?`${e.width} × ${e.height}`:`-`}),(0,M.jsx)(E,{children:e.mime_type}),(0,M.jsx)(E,{children:new Date(e.created_at).toLocaleDateString(`zh-CN`)}),(0,M.jsxs)(E,{align:`right`,children:[(0,M.jsx)(S,{onClick:t=>{t.stopPropagation(),$e(e)},disabled:R===e.id,sx:{width:40,height:40,position:`relative`,zIndex:1},children:R===e.id?(0,M.jsx)(x,{size:18}):(0,M.jsx)(W,{fontSize:`small`})}),(0,M.jsx)(S,{color:`error`,onClick:t=>{t.stopPropagation(),Ze(e)},sx:{width:40,height:40,position:`relative`,zIndex:1},children:(0,M.jsx)(O,{fontSize:`small`})})]}),(0,M.jsx)(ae,{onClick:()=>Xe(e),sx:{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,zIndex:0,borderRadius:0,"&:hover":{bgcolor:`transparent`}}})]},e.id)),r.length===0&&(0,M.jsx)(D,{children:(0,M.jsx)(E,{colSpan:7,align:`center`,sx:{py:4,color:`text.secondary`},children:`暂无媒体文件`})})]})]})}),!a&&u>0&&(0,M.jsx)(ge,{component:`div`,count:u,page:s,onPageChange:Je,rowsPerPage:c,onRowsPerPageChange:Ye,rowsPerPageOptions:[5,10,20,50],labelRowsPerPage:`每页`,labelDisplayedRows:({from:e,to:t,count:n})=>`${e}-${t} / ${n}`,sx:{"& .MuiTablePagination-toolbar":{flexWrap:`wrap`,gap:1,py:1}}})]})})}),(0,M.jsxs)(pe,{open:f,onClose:$,fullWidth:!0,maxWidth:`sm`,TransitionComponent:se,PaperProps:{sx:{borderRadius:{xs:2,sm:`12px`}}},BackdropProps:{"aria-hidden":!1},children:[(0,M.jsx)(he,{sx:{fontWeight:700},children:`媒体详情`}),(0,M.jsx)(me,{sx:{minHeight:{xs:360,sm:480}},children:ce||!g?(0,M.jsx)(_,{sx:{display:`flex`,justifyContent:`center`,alignItems:`center`,minHeight:{xs:320,sm:420}},children:(0,M.jsx)(x,{})}):(0,M.jsx)(h,{in:!0,timeout:400,children:(0,M.jsxs)(b,{spacing:2,children:[(0,M.jsx)(_,{sx:{width:`100%`,maxHeight:{xs:`55vh`,sm:`65vh`},borderRadius:1,overflow:`auto`,bgcolor:e=>o(e.palette.primary.main,.06)},children:(0,M.jsx)(Te,{src:A(g.id),alt:g.name,objectFit:`contain`,placeholder:`skeleton`,style:{height:`auto`,minHeight:200}})}),(0,M.jsxs)(_,{sx:{display:`grid`,gridTemplateColumns:`80px 1fr`,gap:1},children:[(0,M.jsx)(p,{variant:`body2`,color:`text.secondary`,children:`文件名`}),(0,M.jsx)(p,{variant:`body2`,sx:{overflowWrap:`break-word`},children:g.name}),(0,M.jsx)(p,{variant:`body2`,color:`text.secondary`,children:`大小`}),(0,M.jsx)(p,{variant:`body2`,children:G(g.size)}),(0,M.jsx)(p,{variant:`body2`,color:`text.secondary`,children:`尺寸`}),(0,M.jsx)(p,{variant:`body2`,children:g.width&&g.height?`${g.width} × ${g.height}`:`未知`}),(0,M.jsx)(p,{variant:`body2`,color:`text.secondary`,children:`类型`}),(0,M.jsx)(p,{variant:`body2`,children:g.mime_type}),(0,M.jsx)(p,{variant:`body2`,color:`text.secondary`,children:`分片`}),(0,M.jsx)(p,{variant:`body2`,children:g.chunk_count>0?`${g.chunk_count} 片`:`无`}),(0,M.jsx)(p,{variant:`body2`,color:`text.secondary`,children:`上传时间`}),(0,M.jsx)(p,{variant:`body2`,children:new Date(g.created_at).toLocaleString(`zh-CN`)}),(0,M.jsx)(p,{variant:`body2`,color:`text.secondary`,children:`URL`}),(0,M.jsx)(p,{variant:`body2`,sx:{overflowWrap:`break-word`},children:A(g.id)})]}),(0,M.jsxs)(_,{children:[(0,M.jsx)(p,{variant:`body2`,fontWeight:600,sx:{mb:1},children:`绑定对象`}),(0,M.jsx)(ze,{bindings:qe})]})]})})}),(0,M.jsx)(w,{sx:{px:3,pb:2},children:(0,M.jsxs)(_,{sx:{display:`flex`,gap:1.5,width:`100%`,flexDirection:{xs:`column-reverse`,sm:`row`},justifyContent:{sm:`flex-end`},minWidth:0},children:[(0,M.jsx)(y,{onClick:$,fullWidth:e,sx:{borderRadius:2},children:`关闭`}),g&&(0,M.jsx)(y,{variant:`outlined`,startIcon:R===g.id?(0,M.jsx)(x,{size:16}):(0,M.jsx)(W,{}),onClick:()=>$e(g),disabled:R===g.id,fullWidth:e,sx:{borderRadius:2},children:R===g.id?`压缩中...`:`压缩`}),g&&(0,M.jsx)(y,{color:`error`,variant:`contained`,startIcon:(0,M.jsx)(O,{}),onClick:()=>{$(),Ze(g)},fullWidth:e,sx:{borderRadius:2},children:`删除`})]})})]}),(0,M.jsxs)(pe,{open:!!k,onClose:Qe,fullWidth:!0,maxWidth:`xs`,TransitionComponent:se,PaperProps:{sx:{borderRadius:{xs:2,sm:`12px`}}},BackdropProps:{"aria-hidden":!1},children:[(0,M.jsx)(he,{sx:{fontWeight:700},children:`确认删除媒体？`}),(0,M.jsxs)(me,{children:[(0,M.jsx)(p,{variant:`body2`,color:`text.secondary`,sx:{mb:1},children:k?.name}),Ne?(0,M.jsx)(p,{variant:`body2`,color:`text.secondary`,children:`正在检查绑定对象...`}):N.length>0?(0,M.jsxs)(p,{variant:`body2`,color:`warning.main`,children:[`该媒体已被 `,N.length,` 个对象引用，删除后可能影响已绑定的内容，是否继续？`]}):(0,M.jsx)(p,{variant:`body2`,color:`text.secondary`,children:`删除后无法恢复，是否继续？`})]}),(0,M.jsx)(w,{sx:{px:3,pb:2},children:(0,M.jsxs)(_,{sx:{display:`flex`,gap:1.5,width:`100%`,flexDirection:{xs:`column-reverse`,sm:`row`},justifyContent:{sm:`flex-end`},minWidth:0},children:[(0,M.jsx)(y,{onClick:Qe,disabled:I,fullWidth:e,sx:{borderRadius:2},children:`取消`}),(0,M.jsx)(y,{color:`error`,variant:`contained`,onClick:nt,disabled:I,fullWidth:e,sx:{borderRadius:2},children:I?`删除中...`:`删除`})]})})]}),(0,M.jsxs)(pe,{open:Pe,onClose:et,fullWidth:!0,maxWidth:`xs`,TransitionComponent:se,PaperProps:{sx:{borderRadius:{xs:2,sm:`12px`}}},BackdropProps:{"aria-hidden":!1},children:[(0,M.jsx)(he,{sx:{fontWeight:700},children:`压缩图片`}),(0,M.jsxs)(me,{children:[(0,M.jsx)(p,{variant:`body2`,color:`text.secondary`,sx:{mb:2},children:U?.name}),(0,M.jsxs)(b,{spacing:3,children:[(0,M.jsxs)(_,{children:[(0,M.jsxs)(_,{sx:{display:`flex`,justifyContent:`space-between`,mb:1},children:[(0,M.jsx)(p,{variant:`body2`,color:`text.secondary`,children:`最大边长`}),(0,M.jsxs)(p,{variant:`body2`,fontWeight:600,children:[K,`px`]})]}),(0,M.jsx)(le,{value:K,onChange:(e,t)=>Be(t),min:320,max:1920,step:80,marks:[{value:320,label:`320`},{value:1920,label:`1920`}],valueLabelDisplay:`auto`})]}),(0,M.jsxs)(_,{children:[(0,M.jsxs)(_,{sx:{display:`flex`,justifyContent:`space-between`,mb:1},children:[(0,M.jsx)(p,{variant:`body2`,color:`text.secondary`,children:`目标大小`}),(0,M.jsxs)(p,{variant:`body2`,fontWeight:600,children:[q,`KB`]})]}),(0,M.jsx)(le,{value:q,onChange:(e,t)=>Ve(t),min:50,max:1e3,step:50,marks:[{value:50,label:`50`},{value:1e3,label:`1M`}],valueLabelDisplay:`auto`})]}),(0,M.jsxs)(_,{children:[(0,M.jsxs)(_,{sx:{display:`flex`,justifyContent:`space-between`,mb:1},children:[(0,M.jsx)(p,{variant:`body2`,color:`text.secondary`,children:`最低质量`}),(0,M.jsxs)(p,{variant:`body2`,fontWeight:600,children:[Math.round(He*100),`%`]})]}),(0,M.jsx)(le,{value:He,onChange:(e,t)=>Ue(t),min:.1,max:.9,step:.1,marks:[{value:.1,label:`10%`},{value:.9,label:`90%`}],valueLabelDisplay:`auto`,valueLabelFormat:e=>`${Math.round(e*100)}%`})]})]})]}),(0,M.jsx)(w,{sx:{px:3,pb:2},children:(0,M.jsxs)(_,{sx:{display:`flex`,gap:1.5,width:`100%`,flexDirection:{xs:`column-reverse`,sm:`row`},justifyContent:{sm:`flex-end`},minWidth:0},children:[(0,M.jsx)(y,{onClick:et,disabled:J,fullWidth:e,sx:{borderRadius:2},children:`取消`}),(0,M.jsx)(y,{variant:`contained`,onClick:tt,disabled:J,fullWidth:e,sx:{borderRadius:2},children:J?`压缩中...`:`开始压缩`})]})})]})]})})}export{K as AdminMedia};