import{d as w,Q as _,R as k,h as o,i as s,u as n,j as a,k as u,t as c,O as N,m as p,K as C,I as O,D as g,J as A,o as r}from"./index-BaUdY5Ul.js";import{f as v}from"./marked.esm-BU78peuq.js";import{A as f}from"./arrow-left-BS3Hl2cE.js";import{T as E}from"./tag-Clbyh5YD.js";import{N as h}from"./newspaper-CtClFduN.js";const T={class:"min-h-screen"},V={class:"relative overflow-hidden border-b border-border/10"},j={class:"relative max-w-4xl mx-auto px-6 py-16 md:py-20"},B={key:0},D={class:"flex items-center gap-3 mb-4"},$={class:"inline-flex items-center gap-1.5 px-3 py-1 rounded-md text-xs font-medium bg-primary/10 text-primary"},I={class:"inline-flex items-center gap-1.5 text-sm text-muted-foreground"},L={class:"text-2xl md:text-3xl font-bold text-foreground tracking-tight"},M={key:0,class:"max-w-4xl mx-auto px-6 pt-8"},P=["src","alt"],R={class:"max-w-4xl mx-auto px-6 py-12"},S={key:0,class:"text-center py-10 text-muted-foreground"},z={key:1,class:"bg-card rounded-xl shadow-card p-8 md:p-10 border border-border/10"},H={key:0,class:"text-lg text-muted-foreground leading-relaxed mb-6 pb-6 border-b border-border/10"},J=["innerHTML"],q={key:2,class:"text-center py-10"},K={key:2,class:"text-center py-20"},Y=w({__name:"NewsDetailView",setup(Q){const b=C(),x=O(),e=g(null),m=g(!0);v.setOptions({breaks:!0,gfm:!0}),_(async()=>{const i=Number(b.params.id);if(!i){m.value=!1;return}try{const t=await k.getById(i);if(e.value=t.data,e.value){document.title=`${e.value.title} | 缁寸儻缃戠粶`;const l=document.querySelector('meta[name="description"]');l&&l.setAttribute("content",e.value.description||e.value.title);const d=document.createElement("script");d.type="application/ld+json",d.text=JSON.stringify({"@context":"https://schema.org","@type":"Article",headline:e.value.title,description:e.value.description,datePublished:e.value.date,author:{"@type":"Organization",name:"骞胯タ缁寸儻缃戠粶鏈夐檺鍏徃"},publisher:{"@type":"Organization",name:"骞胯タ缁寸儻缃戠粶鏈夐檺鍏徃",logo:{"@type":"ImageObject",url:"https://witchc.cn/og-image.png"}},mainEntityOfPage:{"@type":"WebPage","@id":`https://witchc.cn/news/${i}`}}),document.head.appendChild(d)}}catch{e.value=null}m.value=!1,window.dispatchEvent(new Event("render-event"))});const y=A(()=>{var t;return(t=e.value)!=null&&t.content?v.parse(e.value.content).replace(/<h1/g,"<h2").replace(/<\/h1>/g,"</h2>"):""});return(i,t)=>{var l;return r(),o("main",T,[s("section",V,[t[3]||(t[3]=s("div",{class:"absolute inset-0 bg-gradient-to-br from-primary/5 via-transparent to-primary/3 pointer-events-none"},null,-1)),s("div",j,[s("button",{onClick:t[0]||(t[0]=d=>n(x).push("/news")),class:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-primary transition-colors mb-6"},[a(n(f),{class:"w-4 h-4"}),t[2]||(t[2]=u("杩斿洖鏂伴椈鍒楄〃 ",-1))]),e.value?(r(),o("div",B,[s("div",D,[s("span",$,[a(n(E),{class:"w-3 h-3"}),u(c(e.value.category),1)]),s("span",I,[a(n(N),{class:"w-3.5 h-3.5"}),u(c(e.value.date),1)])]),s("h1",L,c(e.value.title),1)])):p("",!0)])]),(l=e.value)!=null&&l.cover_url?(r(),o("section",M,[s("img",{src:e.value.cover_url,alt:e.value.title,class:"w-full h-auto max-h-[400px] object-cover rounded-xl shadow-card"},null,8,P)])):p("",!0),s("section",R,[m.value?(r(),o("div",S,"鍔犺浇涓�...")):e.value?(r(),o("div",z,[e.value.description?(r(),o("p",H,c(e.value.description),1)):p("",!0),e.value.content?(r(),o("div",{key:1,class:"prose prose-lg max-w-none text-foreground/80 leading-relaxed",innerHTML:y.value},null,8,J)):(r(),o("div",q,[a(n(h),{class:"w-12 h-12 text-muted-foreground/30 mx-auto mb-3"}),t[4]||(t[4]=s("p",{class:"text-muted-foreground"},"鏆傛棤璇︾粏鍐呭",-1))]))])):(r(),o("div",K,[a(n(h),{class:"w-16 h-16 text-muted-foreground/30 mx-auto mb-4"}),t[6]||(t[6]=s("h2",{class:"text-xl font-semibold text-foreground mb-2"},"鏂伴椈涓嶅瓨鍦�",-1)),t[7]||(t[7]=s("p",{class:"text-muted-foreground mb-6"},"璇ユ柊闂诲彲鑳藉凡琚垹闄ゆ垨閾炬帴鏃犳晥",-1)),s("button",{onClick:t[1]||(t[1]=d=>n(x).push("/news")),class:"inline-flex items-center gap-2 bg-primary text-primary-foreground px-6 py-2.5 rounded-lg text-sm font-medium hover:bg-primary/90 transition-colors"},[a(n(f),{class:"w-4 h-4"}),t[5]||(t[5]=u("杩斿洖鏂伴椈鍒楄〃 ",-1))])]))])])}}});export{Y as default};