1import{_ as A}from"./BVf6KqfE.js";import{z as K,f as z,c as l,a as t,g as V,v as T,F as y,r as C,d as $,t as d,m as x,b as D,x as i,o as r,j as L}from"./Bv6qjeVY.js";import{a as S}from"./yVNKKCyc.js";const U={class:"flex flex-col gap-[20px]"},N={class:"flex flex-col gap-[12px] rounded-[14px] border border-[#E1E4E8] bg-white p-[16px] lg:flex-row lg:items-center"},I={class:"relative flex-1"},P={class:"flex gap-[8px]"},q=["onClick"],H={key:0,class:"rounded-[12px] border border-[#FEE4E2] bg-[#FEF3F2] px-[16px] py-[10px] text-[13px] font-semibold text-[#B42318]"},O={key:1,class:"rounded-[12px] border border-[#EAECF0] bg-[#F9FAFB] px-[16px] py-[10px] text-[13px] font-semibold text-[#667085]"},R={class:"grid grid-cols-2 gap-[14px] sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"},G={class:"relative flex aspect-square items-center justify-center overflow-hidden bg-[#F2F4F7]"},J=["src","alt"],Q=["src"],W={class:"absolute inset-x-0 bottom-0 flex justify-center gap-[6px] bg-gradient-to-t from-black/60 to-transparent p-[10px] opacity-0 transition-opacity group-hover:opacity-100"},X=["onClick"],Y=["onClick"],Z={class:"px-[12px] py-[10px]"},ee=["title"],te={class:"mt-[2px] text-[11px] uppercase tracking-[0.5px] text-[#9CA3AF]"},oe={key:2,class:"rounded-[14px] border border-[#E1E4E8] bg-white px-[22px] py-[40px] text-center text-[14px] text-[#667085]"},ae={class:"rounded-[14px] border border-[#E1E4E8] bg-white"},w=15,ne={__name:"media",setup(se){S({title:"Media Library | STTN Admin",robots:"noindex, nofollow"});const _=[{name:"card-front.jpg",url:"/images/card-front.jpg",type:"image",size:"412 KB"},{name:"cards-box.webp",url:"/images/cards-box.webp",type:"image",size:"188 KB"},{name:"hero-poster.jpg",url:"/images/hero-poster.jpg",type:"image",size:"96 KB"},{name:"map-usa.webp",url:"/images/map-usa.webp",type:"image",size:"154 KB"},{name:"jesse-connors.jpg",url:"/images/jesse-connors.jpg",type:"image",size:"243 KB"},{name:"stu-epperson.png",url:"/images/stu-epperson.png",type:"image",size:"484 KB"},{name:"aaron-mills.png",url:"/images/aaron-mills.png",type:"image",size:"303 KB"},{name:"cards-sttn.png",url:"/images/cards-sttn.png",type:"image",size:"1.5 MB"},{name:"mission-photo.jpg",url:"/images/mission-photo.jpg",type:"image",size:"511 KB"},{name:"about-1.png",url:"/images/about-1.png",type:"image",size:"2.4 MB"},{name:"plan-photo.jpg",url:"/images/plan-photo.jpg",type:"image",size:"210 KB"},{name:"americas-revival.webp",url:"/images/partners/americas-revival.webp",type:"image",size:"10 KB"},{name:"truelife.png",url:"/images/partners/truelife.png",type:"image",size:"38 KB"},{name:"hero-bg.mp4",url:"/videos/hero-bg.mp4",type:"video",size:"33 MB"},{name:"hero-bg-mobile.mp4",url:"/videos/hero-bg-mobile.mp4",type:"video",size:"6.7 MB"},{name:"revival-video.mp4",url:"/videos/revival-video.mp4",type:"video",size:"31 MB"}],n=i([..._]),v=i(""),c=i("All"),p=i(1),f=i(""),k=i(null),h=i(!1),u=i("");function B(a){return a?a>1e6?(a/1e6).toFixed(1)+" MB":Math.round(a/1e3)+" KB":""}K(async()=>{try{const e=((await $fetch("/api/admin/media"))?.media||[]).map(s=>({...s,size:B(s.size)}));n.value=[...e,..._]}catch{}});const b=z(()=>{const a=v.value.toLowerCase();return n.value.filter(e=>(c.value==="All"||(c.value==="Images"?e.type==="image":e.type==="video"))&&(!a||e.name.toLowerCase().includes(a)))}),E=z(()=>b.value.slice((p.value-1)*w,p.value*w));async function F(a){const e=Array.from(a.target.files||[]);if(a.target.value="",!!e.length){u.value="",h.value=!0;try{const s=new FormData;for(const m of e)s.append("file",m);const g=((await $fetch("/api/admin/uploads",{method:"POST",body:s}))?.items||[]).map(m=>({...m,size:B(m.size)}));n.value=[...g,...n.value],p.value=1}catch(s){u.value=s?.data?.statusMessage||"Upload failed. Please try again."}finally{h.value=!1}}}async function j(a){const e=/^https?:\/\//.test(a.url)?a.url:location.origin+a.url;await navigator.clipboard.writeText(e),f.value=a.url,setTimeout(()=>{f.value=""},1500)}async function M(a){if(a.id&&confirm(`Delete ${a.name} from the library?`))try{await $fetch(`/api/admin/media/${a.id}`,{method:"DELETE"}),n.value=n.value.filter(e=>e!==a)}catch(e){u.value=e?.data?.statusMessage||"Could not delete this file."}}return(a,e)=>{const s=A;return r(),l("div",U,[t("div",N,[t("div",I,[e[3]||(e[3]=t("svg",{class:"absolute left-[14px] top-1/2 -translate-y-1/2",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},[t("circle",{cx:"11",cy:"11",r:"7",stroke:"#9CA3AF","stroke-width":"2"}),t("path",{d:"M20 20l-3.5-3.5",stroke:"#9CA3AF","stroke-width":"2","stroke-linecap":"round"})],-1)),V(t("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>v.value=o),type:"search",placeholder:"Search mediaâ¦",class:"h-[44px] w-full rounded-[10px] border border-[#D1D5DC] pl-[40px] pr-[14px] text-[14px] text-[#101828] placeholder:text-[#9CA3AF] focus:border-[#7CB342] focus:outline-none"},null,512),[[T,v.value,void 0,{trim:!0}]])]),t("div",P,[(r(),l(y,null,C(["All","Images","Videos"],o=>t("button",{key:o,type:"button",class:L(["rounded-[10px] px-[14px] py-[10px] text-[13px] font-semibold transition-colors",c.value===o?"bg-[#101828] text-white":"bg-[#F2F4F7] text-[#475467] hover:bg-[#
1EAECF0]"]),onClick:g=>{c.value=o,p.value=1}},d(o),11,q)),64))]),t("button",{type:"button",class:"btn-lift flex h-[44px] items-center justify-center gap-[8px] rounded-[10px] bg-[#7CB342] px-[18px] text-[13px] font-bold text-white hover:bg-[#6aaa32]",onClick:e[1]||(e[1]=o=>k.value.click())},[...e[4]||(e[4]=[t("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none"},[t("path",{d:"M12 16V4m0 0L7 9m5-5l5 5M4 20h16",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1),$(" Upload Media ",-1)])]),t("input",{ref_key:"uploader",ref:k,type:"file",accept:"image/*,video/*",multiple:"",class:"hidden",onChange:F},null,544)]),u.value?(r(),l("p",H,d(u.value),1)):x("",!0),h.value?(r(),l("p",O," Uploading to S3⦠")):x("",!0),t("div",R,[(r(!0),l(y,null,C(E.value,o=>(r(),l("div",{key:o.url,class:"group overflow-hidden rounded-[14px] border border-[#E1E4E8] bg-white"},[t("div",G,[o.type==="image"?(r(),l("img",{key:0,src:o.url,alt:o.name,class:"h-full w-full object-cover",loading:"lazy"},null,8,J)):(r(),l(y,{key:1},[t("video",{src:o.url,class:"h-full w-full object-cover",preload:"metadata",muted:""},null,8,Q),e[5]||(e[5]=t("span",{class:"absolute flex h-[42px] w-[42px] items-center justify-center rounded-full bg-black/55"},[t("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none"},[t("path",{d:"M8 5v14l11-7L8 5z",fill:"white"})])],-1))],64)),t("div",W,[t("button",{type:"button",class:"h-[30px] rounded-[7px] bg-white px-[10px] text-[11px] font-bold text-[#101828]",onClick:g=>j(o)},d(f.value===o.url?"â Copied":"Copy URL"),9,X),o.id?(r(),l("button",{key:0,type:"button",class:"flex h-[30px] w-[30px] items-center justify-center rounded-[7px] bg-[#B42318] text-white",title:"Delete",onClick:g=>M(o)},[...e[6]||(e[6]=[t("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none"},[t("path",{d:"M4 7h16M9 7V5a1 1 0 011-1h4a1 1 0 011 1v2m3 0v13a1 1 0 01-1 1H7a1 1 0 01-1-1V7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"})],-1)])],8,Y)):x("",!0)])]),t("div",Z,[t("p",{class:"truncate text-[13px] font-bold text-[#101828]",title:o.name},d(o.name),9,ee),t("p",te,d(o.type)+d(o.size?` · ${o.size}`:""),1)])]))),128))]),b.value.length?x("",!0):(r(),l("p",oe," No media found. ")),t("div",ae,[D(s,{modelValue:p.value,"onUpdate:modelValue":e[2]||(e[2]=o=>p.value=o),total:b.value.length,"page-size":w},null,8,["modelValue","total"])])])}}};export{ne 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.