import{u as V}from"./Grz13CMP.js";import{r as y,o as T,A as N,d as B,u as H,v as j,l as b,s as P,c as e,e as s,t as n,j as _,h as l,g as v,F as f,p as S,b as a,_ as R}from"./tpFEFzWU.js";const L={CHANGELOG_LAST_SEEN:"autocode-changelog-lastSeen"};function U(){const u=y(null),c=y(!1);T(()=>{const o=localStorage.getItem(L.CHANGELOG_LAST_SEEN);o&&(u.value=o)});const i=o=>{u.value=o,localStorage.setItem(L.CHANGELOG_LAST_SEEN,o),c.value=!1},d=o=>u.value?u.value!==o?(c.value=!0,!0):!1:(i(o),!1);return{lastSeenVersion:N(u),hasNewChanges:N(c),markAsSeen:i,checkForUpdates:d}}const q={class:"changelog-page"},K={class:"page-header"},M={class:"summary-section"},Y={key:1,class:"summary-loading"},x={key:2,class:"summary-banner"},z={class:"summary-text"},J={key:0,class:"loading"},Q={key:1,class:"error-message"},W={key:2,class:"empty"},X={key:3,class:"changelog-list"},Z={class:"entry-header"},ee={class:"entry-version"},ae={key:0,class:"badge badge-success"},se={class:"entry-date"},te={class:"entry-content"},ne=B({__name:"changelog",async setup(u){let c,i;const{locale:d}=H(),{data:o,status:w,error:k}=([c,i]=j(()=>V("/api/changelog",{query:{lang:d.value}},"$j1EO-12DBP")),c=await c,i(),c),C=b(()=>o.value?.data?.entries||[]),E=b(()=>o.value?.data?.topTag||""),{lastSeenVersion:A,markAsSeen:$}=U(),h=y(null),g=y(!1);async function G(){g.value=!0;const t=localStorage.getItem("autocode-changelog-seen");try{const r=await $fetch("/api/changelog/summary",{method:"POST",body:{lang:d.value,lastSeenTag:t}});r?.data?.summary&&(h.value=r.data.summary)}catch{}finally{g.value=!1}}const O=t=>A.value?t>A.value:!1;T(()=>{E.value&&$(E.value)});const D=t=>new Date(t).toLocaleDateString(d.value==="fr"?"fr-FR":"en-US",{year:"numeric",month:"long",day:"numeric"});return P({title:"Changelog - AutoCode"}),(t,r)=>(a(),e("div",q,[s("header",K,[s("h1",null,n(t.$t("changelog.title")),1)]),s("div",M,[!l(h)&&!l(g)?(a(),e("button",{key:0,class:"btn btn-secondary summary-btn",onClick:G},[r[0]||(r[0]=s("span",{class:"btn-icon"},"✨",-1)),v(" "+n(t.$t("changelog.generateSummary")),1)])):_("",!0),l(g)?(a(),e("div",Y,[r[1]||(r[1]=s("span",{class:"spinner"},null,-1)),v(" "+n(t.$t("changelog.generatingSummary")),1)])):_("",!0),l(h)&&!l(g)?(a(),e("div",x,[r[2]||(r[2]=s("div",{class:"summary-icon"},[s("span",{class:"icon"},"✨")],-1)),s("p",z,n(l(h)),1)])):_("",!0)]),l(w)==="pending"?(a(),e("div",J,n(t.$t("app.loading")),1)):l(k)?(a(),e("div",Q,n(l(k).message),1)):l(C)?.length?(a(),e("div",X,[(a(!0),e(f,null,S(l(C),m=>(a(),e("article",{key:m.tag,class:"changelog-entry card"},[s("header",Z,[s("h2",ee,[v(n(m.tag)+" ",1),O(m.tag)?(a(),e("span",ae,n(t.$t("changelog.new")),1)):_("",!0)]),s("time",se,n(D(m.date)),1)]),s("div",te,[(a(!0),e(f,null,S(m.sections,p=>(a(),e("div",{key:p.title,class:"entry-section"},[s("h3",null,n(p.title),1),s("ul",null,[(a(!0),e(f,null,S(p.items,(F,I)=>(a(),e("li",{key:I},n(F),1))),128))])]))),128))])]))),128))])):(a(),e("div",W,n(t.$t("changelog.noChanges")),1))]))}}),re=R(ne,[["__scopeId","data-v-03a0ef3e"]]);export{re as default};
