1import{j as e,aC as D,aD as S,B as c,a3 as I,a1 as j}from"./vendor-mui-DFXKyM2E.js";import{a as s,k as L,L as T}from"./vendor-react-CrXZvyk_.js";import{A as k}from"./Add-DzLEVIpK.js";import{C as B}from"./ConfirmDelete-D1yUspaH.js";import{F as w}from"./FilterTable-CSAQgpZl.js";import{M as E}from"./MediaCard-BdFRPkoq.js";import{g as N,a as z,h as G,c as V,i as q,d as H,e as O}from"./index-UEKncLtL.js";import{N as R}from"./NavHeader-BROh2czj.js";import{N as U}from"./NotFound-BzQfEcD3.js";import{a as W,f as y,P as M}from"./index-DGSpuRBj.js";import{P as J}from"./Pagination-75_tvtre.js";import{f as K,d as Q}from"./Media-B8vOuwcS.js";import"./useDebouncedValue-CkrckZR6.js";import"./Search-By0g-prq.js";import"./DeleteOutline-BnPseAnv.js";import"./Home-CqZgsyW_.js";import"./vendor-redux-Bi3kFs4E.js";import"./vendor-utils-BFUpClQh.js";import"./vendor-form-Df9-JY-v.js";const X=[{value:"all",label:"All",icon:e.jsx(N,{})},{value:"image",label:"Image",icon:e.jsx(z,{})},{value:"video",label:"Video",icon:e.jsx(G,{})},{value:"pdf",label:"PDF",icon:e.jsx(V,{})},{value:"audio",label:"Audio",icon:e.jsx(q,{})},{value:"zip",label:"Archive",icon:e.jsx(H,{})},{value:"doc",label:"Document",icon:e.jsx(O,{})}],Y=({value:l="all",onChange:u})=>e.jsx(D,{value:l,exclusive:!0,fullWidth:!0,sx:{backgroundColor:t=>t.palette.background.paper},onChange:(t,i)=>i&&u(i),size:"small",color:"primary",children:X.map(t=>e.jsxs(S,{value:t.value,children:[t.icon,e.jsx("span",{style:{marginLeft:4},children:t.label})]},t.value))}),he=()=>{const[l,u]=s.useState([]),[t,i]=s.useState(null),[g,d]=s.useState(!1),{showMessage:m}=W(),[x,v]=s.useState(!1),[o,b]=L(),[A,P]=s.useState({total:0,current_page:0,from:0,last_page:0,per_page:0}),[n,p]=s.useState({search:o.get("search"),order:o.get("order"),start_date:o.get("start_date"),end_date:o.get("end_date"),paged:o.get("paged"),per_page:o.get("per_page")}),f=async a=>{try{d(!0);const r=y(a);b(r);const h=await K(r);if(!h.error){const{data:F,meta:C}=h;u(F),P(C)}}catch{}finally{v(!0),d(!1)}};async function _(a){try{d(!0),(await Q(a,{})).error?m("error","An error occurred. Please try again later!"):m("success","File deleted successfully")}catch{m("error","An error occurred. Please try again later!")}finally{i(null),d(!1),f(n)}}return s.useEffect(()=>{f(n)},[]),s.useEffect(()=>{if(x){const a=y(n);f(a)}},[n]),x?e.jsxs(c,{sx:{width:"100%"},children:[e.jsx(R,{title:"Media",breadcrumb:[{title:"Media"}],endAction:e.jsx(T,{to:"/admin/media/upload",children:e.jsx(I,{startIcon:e.jsx(k,{}),variant:"contained",color:"primary",children:"Upload media"})})}),e.jsxs(c,{children:[e.jsx(w,{filter:n,setFilter:p}),e.jsx(c,{sx:{mb:3},children:e.jsx(Y,{value:n?.media_type||"all",onChange:a=>p(r=>({...r,media_type:a}))})}),g?e.jsx(M,{height:500}):e.jsxs(s.Fragment,{children:[Array.isArray(l)&&l.length?e.jsx(j,{container:!0,spacing:3,children:l.map(a=>e.jsx(j,{item:!0,xs:6,lg:3,children:e.jsx(E,{data:a,setDeleteMedia:i})},a.id))}):e.jsx(c,{sx:{py:4,display:"flex",justifyContent:"center"},children:e.jsx(U,{})}),e.jsx(J,{meta:A,onChange:a=>p(r=>({...r,...a}))})]})]}),e.jsx(B,{open:!!t,setOpen:()=>i(null),isLoading:g,onSubmit:()=>t&&_(t)})]}):e.jsx(M,{height:500})};export{he as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.