import{_ as M,a as V,b as D,c as $}from"./BfPjfeWt.js";import{_ as C}from"./CgXve9qO.js";import{_ as A}from"./DxB0DKYp.js";import{u as F}from"./BZ7f31ti.js";import{u as H,q as S,c,b as l,a as e,t as s,e as t,w as v,F as j,r as E,i as P,l as d,o as i,d as f,I as R}from"./BKiFavna.js";import{u as U}from"./BOqT4ZDK.js";import{_ as q}from"./DlAUqK2U.js";import"./DKzHUNYh.js";const G={"data-theme":"light"},K={id:"main-content",role:"main"},z={class:"container"},J={class:"page-header"},O={class:"page-title"},Q={class:"breadcrumb"},W={key:0,class:"loading-box"},X={key:1,class:"empty-box"},Y={key:2},Z={class:"breaking-list"},ee={class:"breaking-badge"},ne={class:"breaking-content"},te={class:"breaking-thumb"},ae=["src","alt"],se={key:1,class:"breaking-emoji"},oe={class:"breaking-body"},ie={class:"breaking-cat"},ce={class:"breaking-title"},le={class:"breaking-excerpt"},re={class:"breaking-meta"},_e={key:0,class:"load-more"},de=["disabled"],w=15,ue={__name:"breaking",setup(me){const{lang:a}=H(),{api:y}=F(),r=d([]),g=d(!0),u=d(!1),m=d(1),p=d(!1),N=_=>_?new Date(_).toLocaleDateString(a.value==="bn"?"bn-BD":"en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"",k=async(_=!1)=>{_&&(m.value=1,r.value=[]);try{const o=await y.get("/posts",{breaking:"1",sort:"newest",page:m.value,limit:w}),b=o.data.posts||[];r.value=_?b:[...r.value,...b],p.value=o.meta&&m.value*w<o.meta.total}catch{r.value=[]}},x=async()=>{u.value=!0,m.value++,await k(),u.value=!1};return S(async()=>{g.value=!0,await k(!0),g.value=!1}),U(()=>({title:a.value==="bn"?"ব্রেকিং নিউজ — নিউজভার্স":"Breaking News — NewsVerse"})),(_,o)=>{const b=M,B=V,I=D,L=C,h=A,T=$;return i(),c("div",G,[l(b),l(B),l(I),l(L),e("main",K,[e("div",z,[e("div",J,[e("h1",O,"⚡ "+s(t(a)==="bn"?"ব্রেকিং নিউজ":"Breaking News"),1),e("div",Q,[l(h,{to:"/"},{default:v(()=>[f(s(t(a)==="bn"?"হোম":"Home"),1)]),_:1}),o[0]||(o[0]=e("span",null," › ",-1)),e("span",null,s(t(a)==="bn"?"ব্রেকিং নিউজ":"Breaking News"),1)])]),t(g)?(i(),c("div",W,[o[1]||(o[1]=e("div",{class:"loader"},null,-1)),e("p",null,s(t(a)==="bn"?"লোড হচ্ছে...":"Loading..."),1)])):t(r).length===0?(i(),c("div",X,[o[2]||(o[2]=e("div",{class:"empty-icon"},"📡",-1)),e("h2",null,s(t(a)==="bn"?"এখন কোনো ব্রেকিং নিউজ নেই":"No breaking news right now"),1),l(h,{to:"/",class:"btn-home"},{default:v(()=>[f(s(t(a)==="bn"?"সব সংবাদ দেখুন":"View All News"),1)]),_:1})])):(i(),c("div",Y,[e("div",Z,[(i(!0),c(j,null,E(t(r),n=>(i(),R(h,{key:n.id,to:`/news/${encodeURIComponent(t(a)==="bn"?n.slug_bn:n.slug_en||n.slug_bn)}`,class:"breaking-card"},{default:v(()=>[e("div",ee,"⚡ "+s(t(a)==="bn"?"ব্রেকিং":"BREAKING"),1),e("div",ne,[e("div",te,[n.featured_image?(i(),c("img",{key:0,src:n.featured_image,alt:n.title_bn},null,8,ae)):(i(),c("span",se,s(n.emoji||"📰"),1))]),e("div",oe,[e("span",ie,s(t(a)==="bn"?n.category_name_bn:n.category_name_en),1),e("h2",ce,s(t(a)==="bn"?n.title_bn:n.title_en||n.title_bn),1),e("p",le,s(t(a)==="bn"?n.excerpt_bn:n.excerpt_en||n.excerpt_bn),1),e("div",re,[e("span",null,s(n.author_name),1),e("span",null,s(N(n.published_at)),1),e("span",null,"👁 "+s(n.views||0),1)])])])]),_:2},1032,["to"]))),128))]),t(p)?(i(),c("div",_e,[e("button",{onClick:x,disabled:t(u),class:"btn-more"},s(t(u)?t(a)==="bn"?"লোড হচ্ছে...":"Loading...":t(a)==="bn"?"আরও দেখুন":"Load More"),9,de)])):P("",!0)]))])]),l(T)])}}},ye=q(ue,[["__scopeId","data-v-53456585"]]);export{ye as default};
