import{i as S,D as $,l as C,m as o,b as B,E as T,c as I,s as m,a as t,e as r,t as p,n as g,v as l,F as h,d,z as j,y as z}from"./index-DF5uCdwt.js";import{_ as A}from"./AdminLayout.vue_vue_type_script_setup_true_lang-DtHb-1yq.js";const D={class:"p-6 max-w-7xl mx-auto"},E={class:"flex gap-1 mb-6 border-b border-gray-200"},F=["onClick"],N={key:0,class:"text-sm text-gray-500"},O={key:1,class:"text-sm text-red-600"},P={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5"},L={class:"aspect-[16/9] bg-gray-100 relative"},R=["src"],V={key:1,class:"absolute top-2 left-2 px-2 py-1 rounded-md bg-[var(--wdot-color-primary-600)] text-white text-[11px] font-extrabold"},H={class:"p-4"},J={class:"flex items-baseline justify-between mb-1"},M={class:"font-bold text-base"},q={class:"text-[11px] text-gray-400 font-mono"},G={class:"text-xs text-gray-500 line-clamp-2 min-h-[2.5rem]"},K={class:"flex gap-2 mt-3"},Q=["onClick"],U={key:1,disabled:"",class:"flex-1 py-1.5 text-xs rounded-md bg-gray-200 text-gray-500 font-semibold"},Z=S({__name:"SkinList",setup(W){const _=z(),b=j(),x=[{key:"board",label:"게시판"},{key:"member",label:"회원"},{key:"shop",label:"쇼핑"},{key:"comment",label:"댓글"},{key:"page",label:"페이지"}],n=I(()=>_.params.type||"board"),y=m([]),u=m(!1),i=m(null);async function c(){u.value=!0,i.value=null;try{const a=localStorage.getItem("auth_token")??localStorage.getItem("token")??"",s=await fetch(`/api/v1/admin/skins?type=${n.value}`,{headers:a?{Authorization:`Bearer ${a}`}:{}});if(!s.ok)throw new Error(`HTTP ${s.status}`);const e=await s.json();y.value=e.data??[]}catch(a){i.value=(a==null?void 0:a.message)??"Failed to load skins"}finally{u.value=!1}}async function f(a){const s=localStorage.getItem("auth_token")??localStorage.getItem("token")??"";await fetch(`/api/v1/admin/skins/${n.value}/${a}/activate-default`,{method:"POST",headers:s?{Authorization:`Bearer ${s}`}:{}}),await c()}async function k(){const a=localStorage.getItem("auth_token")??localStorage.getItem("token")??"";await fetch("/api/v1/admin/skins/scan",{method:"POST",headers:{...a?{Authorization:`Bearer ${a}`}:{},"Content-Type":"application/json"},body:JSON.stringify({type:n.value})}),await c()}function v(a){b.push(`/admin/skins/${a}`)}return $(n,c),C(c),(a,s)=>(o(),B(A,null,{default:T(()=>[t("div",D,[t("header",{class:"flex items-center justify-between mb-4"},[s[0]||(s[0]=t("div",null,[t("h1",{class:"text-2xl font-extrabold"},"스킨 관리"),t("p",{class:"text-sm text-gray-500 mt-1"},"skins/{type}/{slug}/ 디렉토리 패키지로 자동 인식됩니다. (gnuboard g5_skin 패리티)")],-1)),t("button",{class:"px-4 py-2 text-sm rounded-lg border border-gray-300 hover:bg-gray-50",onClick:k},"디렉토리 재스캔")]),t("nav",E,[(o(),r(h,null,p(x,e=>t("button",{key:e.key,onClick:w=>v(e.key),class:g(["px-4 py-2.5 text-sm font-semibold border-b-2 transition-colors",n.value===e.key?"border-[var(--wdot-color-primary-600)] text-[var(--wdot-color-primary-700)]":"border-transparent text-gray-500 hover:text-gray-800"])},l(e.label),11,F)),64))]),u.value?(o(),r("p",N,"불러오는 중…")):d("",!0),i.value?(o(),r("p",O,l(i.value),1)):d("",!0),t("div",P,[(o(!0),r(h,null,p(y.value,e=>(o(),r("article",{key:e.id,class:g(["bg-white rounded-xl border border-gray-200 overflow-hidden shadow-sm hover:shadow-md transition-shadow",{"ring-2 ring-[var(--wdot-color-primary-500)]":e.is_default}])},[t("div",L,[e.screenshot_url?(o(),r("img",{key:0,src:e.screenshot_url,alt:"",class:"w-full h-full object-cover"},null,8,R)):d("",!0),e.is_default?(o(),r("span",V,"✓ 기본")):d("",!0)]),t("div",H,[t("div",J,[t("h3",M,l(e.name),1),t("span",q,"v"+l(e.version),1)]),t("p",G,l(e.description),1),t("div",K,[e.is_default?(o(),r("button",U,"기본 스킨")):(o(),r("button",{key:0,onClick:w=>f(e.slug),class:"flex-1 py-1.5 text-xs rounded-md bg-[var(--wdot-color-primary-600)] text-white font-semibold"},"기본으로 설정",8,Q))])])],2))),128))])])]),_:1}))}});export{Z as default};
