1import{C as e,D as t,E as n,F as r,H as i,J as a,K as o,M as s,N as c,O as l,T as u,W as d,c as f,ct as p,it as m,k as h,n as g,st as _,ut as v}from"./vendor-vue-Bu-KQjoC.js";import{o as y,s as b,st as x}from"./index-BE2-dWra.js";import{t as S}from"./UserProfilePagination-BpuVTj7y.js";import{n as C}from"./mediaApi-kMdfBZ7p.js";import{t as w}from"./MediaPlazaCard-DIitaf8o.js";function T(){let{t:e}=g(),t=x(),n=m([]),r=m(1),i=m(0),a=m(!1),o=m(null),s=u(()=>i.value>0?Math.max(1,Math.ceil(i.value/20)):n.value.length>=20?Math.max(r.value+1,r.value):Math.max(r.value,1));async function c(s=r.value){let c=t.activeAccount?.token;a.value=!0,o.value=null;try{let e=await C(s,c);n.value=e.list,i.value=e.totalCount,r.value=s}catch(t){o.value=t instanceof Error?t.message:e(`mediaPlaza.fetchFailed`),n.value=[]}finally{a.value=!1}}function l(e){let t=Math.max(1,Math.min(e,s.value));t===r.value&&n.value.length>0||(c(t),window.scrollTo({top:0,behavior:`smooth`}))}function d(){r.value=1,c(1)}function f(){c(r.value)}return{items:n,page:r,totalPages:s,totalCount:i,loading:a,error:o,setPage:l,init:d,retry:f}}var E={class:`space-y-4`},D={class:`flex flex-wrap items-end justify-between gap-3 border-b border-border pb-3`},O={class:`min-w-0`},k={class:`flex items-center gap-2 text-base font-bold text-primary`},A={class:`mt-1 text-[13px] text-muted`},j={class:`flex shrink-0 items-center gap-2`},M={key:0,class:`border border-danger/30 bg-danger/10 px-3 py-2 text-[13px] text-danger`},N={key:1,class:`grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5`},P={key:2,class:`py-16 text-center`},F={class:`mt-3 text-[13px] text-muted`},I=`/creator/media/new`,L=r({__name:`MediaPlazaView`,setup(r){let{t:u}=g(),m=f(),{items:x,page:C,totalPages:L,loading:R,error:z,setPage:B,init:V,retry:H}=T();i(()=>{V()});function U(){m.push(`/media/search`)}function W(e){b(e,m,I)}function G(){y(I)}return(r,i)=>{let f=a(`MaterialIcon`);return d(),h(`div`,E,[n(`div`,D,[n(`div`,O,[n(`h1`,k,[c(f,{name:`perm_media`,size:20,class:`text-accent`}),s(` `+v(_(u)(`mediaPlaza.title`)),1)]),n(`p`,A,v(_(u)(`mediaPlaza.desc`)),1)]),n(`div`,j,[n(`a`,{href:I,class:`nico-btn nico-btn-sm nico-btn-primary inline-flex h-8 !min-h-8 items-center gap-1 px-3 text-[12px] no-underline`,onClick:W,onPointerenter:G},[c(f,{name:`upload`,size:16}),s(` `+v(_(u)(`creator.mediaPublishCta`)),1)],32),n(`button`,{type:`button`,class:`nico-btn nico-btn-sm inline-flex h-8 !min-h-8 items-center border border-border bg-base px-3 text-[12px] text-primary`,onClick:U},v(_(u)(`mediaPlaza.search`)),1)])]),_(z)?(d(),h(`p`,M,v(_(z)),1)):l(``,!0),_(R)&&_(x).length===0?(d(),h(`div`,N,[(d(),h(e,null,o(10,e=>n(`div`,{key:e,class:`overflow-hidden rounded-[var(--radius-default)] border border-border bg-elevated`},[...i[1]||(i[1]=[n(`div`,{class:`aspect-square animate-pulse bg-reader`},null,-1),n(`div`,{class:`space-y-2 p-2.5`},[n(`div`,{class:`h-3 w-full animate-pulse rounded bg-reader`}),n(`div`,{class:`h-2.5 w-2/3 animate-pulse rounded bg-reader`})],-1)])])),64))])):!_(R)&&_(x).length===0?(d(),h(`div`,P,[c(f,{name:`perm_media`,size:40,class:`text-muted opacity-40`}),n(`p`,F,v(_(u)(`mediaPlaza.empty`)),1),n(`button`,{type:`button`,class:`nico-btn nico-btn-primary mt-4 px-4 text-[13px]`,onClick:i[0]||(i[0]=e=>_(H)())},v(_(u)(`mediaPlaza.retry`)),1)])):(d(),h(e,{key:3},[n(`div`,{class:p([`grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5`,{"pointer-events-none opacity-60":_(R)}])},[(d(!0),h(e,null,o(_(x),e=>(d(),t(w,{key:e.media_id,media:e},null,8,[`media`]))),128))],2),_(x).length>0?(d(),t(S,{key:0,page:_(C),"total-pages":_(L),onChange:_(B)},null,8,[`page`,`total-pages`,`onChange`])):l(``,!0)],64))])}}});export{L 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.