import{_ as F,a as L,b as S,c as I}from"./BfPjfeWt.js";import{_ as R}from"./CgXve9qO.js";import{_ as U}from"./DxB0DKYp.js";import{u as j,G as E,H as G,q as M,c as o,b as _,a as n,d as v,t as c,e as t,i as C,w as $,F as b,r as y,z as W,l as m,m as x,o as i,n as J}from"./BKiFavna.js";import{u as K}from"./BZ7f31ti.js";import{u as O}from"./BOqT4ZDK.js";import{_ as Q}from"./DlAUqK2U.js";import"./DKzHUNYh.js";const X={"data-theme":"light"},Y={id:"main-content",role:"main"},Z={class:"container category-page"},ee={class:"cat-header"},te={class:"page-title"},ne={key:0,style:{"font-size":"18px","font-weight":"400",color:"#666"}},se={class:"breadcrumb"},ae={key:0,class:"news-grid"},oe={key:1,style:{"text-align":"center",padding:"60px",color:"#888"}},ie={key:2,class:"news-grid"},re={style:{height:"160px",overflow:"hidden","border-radius":"6px 6px 0 0"}},ce=["src","alt"],le={key:1,class:"img-placeholder",style:{height:"160px",background:"#f0f0f0"}},_e={style:{padding:"12px"}},de={class:"cat-tag"},ue={style:{"font-size":"14px","font-weight":"600",margin:"8px 0 4px","line-height":"1.4"}},me={style:{"font-size":"12px",color:"#888"}},he={key:3,class:"pagination"},ge=["disabled"],fe=["onClick"],pe=["disabled"],ve={__name:"archive",setup(be){const{lang:r}=j(),{api:z}=K(),B=W().public.apiBase||"http://localhost:5000/api",k=E(),h=m([]),g=m(!0),l=m(1),d=m(1),u=x(()=>k.query.date||"");O({title:x(()=>(r.value==="bn"?"আর্কাইভ":"Archive")+" — নিউজভার্স")});function T(s){return s?s.startsWith("http")?s:B.replace("/api","")+s:""}function D(s){return s?new Date(s).toLocaleDateString(r.value==="bn"?"bn-BD":"en-US",{day:"numeric",month:"long",year:"numeric"}):""}async function f(){g.value=!0;try{const s={page:l.value,limit:12};u.value&&(s.date=u.value);const a=await z.get("/posts/archive",s);h.value=a.data?.posts||[],d.value=a.data?.meta?.totalPages||1}catch{h.value=[]}g.value=!1}const w=x(()=>h.value);function p(s){s<1||s>d.value||(l.value=s,f(),window.scrollTo({top:0,behavior:"smooth"}))}return G(()=>k.query.date,()=>{l.value=1,f()}),M(f),(s,a)=>{const A=F,P=L,H=S,V=R,N=U,q=I;return i(),o("div",X,[_(A),_(P),_(H),_(V),n("main",Y,[n("div",Z,[n("div",ee,[n("h1",te,[v(c(t(r)==="bn"?"আর্কাইভ":"Archive")+" ",1),t(u)?(i(),o("span",ne," — "+c(t(u)),1)):C("",!0)]),n("div",se,[_(N,{to:"/"},{default:$(()=>[v(c(t(r)==="bn"?"হোম":"Home"),1)]),_:1}),a[2]||(a[2]=v()),a[3]||(a[3]=n("span",null," › ",-1)),n("span",null,c(t(r)==="bn"?"আর্কাইভ":"Archive"),1)])]),t(g)?(i(),o("div",ae,[(i(),o(b,null,y(6,e=>n("div",{key:e,style:{height:"200px",background:"#e0e0e0","border-radius":"8px"}})),64))])):t(w).length?(i(),o("div",ie,[(i(!0),o(b,null,y(t(w),e=>(i(),o("article",{key:e.id,class:"news-card"},[_(N,{to:`/news/${t(r)==="bn"?e.slug_bn:e.slug_en||e.slug_bn}`},{default:$(()=>[n("div",re,[e.featured_image?(i(),o("img",{key:0,src:T(e.featured_image),alt:t(r)==="bn"?e.title_bn:e.title_en,style:{width:"100%",height:"100%","object-fit":"cover"},loading:"lazy"},null,8,ce)):(i(),o("div",le,[...a[4]||(a[4]=[n("span",{style:{"font-size":"2rem"}},"📰",-1)])]))]),n("div",_e,[n("span",de,c(t(r)==="bn"?e.category_name_bn:e.category_name_en||e.category_name_bn),1),n("h3",ue,c(t(r)==="bn"?e.title_bn:e.title_en||e.title_bn),1),n("div",me,c(D(e.published_at)),1)])]),_:2},1032,["to"])]))),128))])):(i(),o("div",oe,c(t(r)==="bn"?"এই তারিখে কোনো সংবাদ পাওয়া যায়নি।":"No news found for this date."),1)),t(d)>1?(i(),o("div",he,[n("button",{onClick:a[0]||(a[0]=e=>p(t(l)-1)),disabled:t(l)===1},"‹",8,ge),(i(!0),o(b,null,y(t(d),e=>(i(),o("button",{key:e,class:J({active:t(l)===e}),onClick:xe=>p(e)},c(e),11,fe))),128)),n("button",{onClick:a[1]||(a[1]=e=>p(t(l)+1)),disabled:t(l)===t(d)},"›",8,pe)])):C("",!0)])]),_(q)])}}},De=Q(ve,[["__scopeId","data-v-0236bd29"]]);export{De as default};
