import{_ as z}from"./Cr_2yWa2.js";import{V as I}from"./C63UuyGC.js";import{E as n,A as u,B as v,b as h,J,K as V,P as N,a3 as U,M as F,C as O,N as T,S as r,T as c,F as C,W as D,U as $,c as f,Q as B,h as L,i as M}from"#entry";import{V as P,_ as j}from"./BYMeu8AK.js";import{u as q,D as w}from"./D96dsyvB.js";import{u as H}from"./BGgOGsw7.js";import"./BML-0xFj.js";import"./DlTeSpWH.js";import"./CIr4U5gS.js";import"./5A-VMRTY.js";import"./LWaCnj-p.js";import"./DArAxlee.js";import"./CzzGYI2c.js";const K={__name:"Announcement",props:{announcement:{type:Object,default:()=>({})}},setup(p){return(a,d)=>{const l=z;return n(),u(l,{class:"text-decoration-none",to:`/announcement/${p.announcement?.id}`},{default:v(()=>[h(I,{class:"mt-2 mt-sm-4",type:"info",title:p.announcement.title},null,8,["title"])]),_:1},8,["to"])}}},Q={key:0,id:"announcements",class:"mt-2 mt-sm-4"},W={class:"events mt-sm-4 mt-2"},X={key:0,class:"d-flex flex-column align-center ga-2 my-8 my-sm-12"},G={class:"text-h4 text-medium-emphasis"},ce=J({__name:"index",async setup(p){let a,d;const l=q(),e=V("settings");N({title:e.value?.title,meta:[{name:"description",content:e?.value.description},{name:"og:description",content:e?.value.description},{property:"og:title",content:e.value.title},{property:"og:url",content:e.value.baseurl},{property:"og:image",content:e.value.baseurl+"/logo.png"}],link:[{rel:"apple-touch-icon",href:e.value.baseurl+"/logo.png"},{rel:"alternate",type:"application/rss+xml",title:e.value.title,href:e.value.baseurl+"/feed/rss"},{rel:"alternate",type:"text/calendar",title:e.value.title,href:e.value.baseurl+"/feed/ics"},{rel:"search",type:"application/opensearchdescription+xml",title:e.value.title,href:e.value.baseurl+"/opensearch.xml"},{rel:"me",href:`${e.value.baseurl}/federation/u/${e.value.instance_name}`}]});const y=l.nowUnix(),_=V("selectedDate",()=>{}),{events:i,params:x,refresh:A}=H();U(()=>A());const E=M(()=>x.value.start===l.startMonth()),g=M(()=>{if(x.value.query)return i.value;if(_.value){const t=w.fromJSDate(_?.value)?.startOf("day")?.toUnixInteger(),m=w.fromJSDate(_?.value)?.endOf("day")?.toUnixInteger();return i.value?.filter(s=>s.start_datetime<=m&&(s.end_datetime||s.start_datetime)>=t)}else return E.value?i.value?.filter(t=>{const m=Math.max(t.start_datetime,t?.end_datetime??0);return t.end_datetime?m>=y:t.start_datetime+10800>=y}):i.value}),{data:b}=([a,d]=F(()=>T("/api/announcements","$xIynyJyXPB")),a=await a,d(),a);return(t,m)=>{const s=K,S=j;return n(),u(O,{id:"home",class:"px-2 px-sm-6 pt-0"},{default:v(()=>[r(b)?.length?(n(),c("section",Q,[(n(!0),c(C,null,D(r(b),o=>(n(),u(s,{key:o.id,announcement:o},null,8,["announcement"]))),128))])):$("",!0),f("section",W,[(n(!0),c(C,null,D(r(g),(o,k)=>(n(),u(P,{key:o.id,class:"event","model-value":k<9,options:{threshold:.5,rootMargin:"500px"}},{default:v(()=>[h(S,{event:o,lazy:k>9,"hide-thumbs":r(e).hide_thumbs},null,8,["event","lazy","hide-thumbs"])]),_:2},1032,["model-value"]))),128)),r(g)?.length?$("",!0):(n(),c("div",X,[f("span",G,B(t.$t("common.no_events_found")),1),f("span",null,B(t.$t("common.no_events_found_hint")),1),h(L,{icon:"mdi-cactus",size:200,class:"opacity-20 mt-2"})]))])]),_:1})}}});export{ce as default};
