1import{i as U,a as J,b as L,F as P}from"./E1vL9wkz.js";import{a as q}from"./DCi-oGBp.js";import{_ as G}from"./CHRB8wXb.js";import{b as K}from"./BfPKaf7i.js";import{d as C,r as c,Q as p,o as H,c as d,f as o,k as w,v as _,F as I,p as Q,j as M,q as W,_ as X,e as n,y as g,n as Z}from"./edfHDTum.js";import{_ as ee}from"./DlAUqK2U.js";import"./BYecEvQY.js";const te={class:"mx-auto"},oe={class:"p-6"},ae={key:0,class:"flex flex-col lg:flex-row lg:items-start space-y-4 lg:space-y-0 text-woodsmoke-900 dark:text-white bg-tropical-blue-200/15 dark:bg-polo-blue-500b rounded-lg p-5 mb-5"},re={key:0,class:"flex flex-col mb-0 space-y-4"},se={class:"flex flex-wrap items-center gap-4 lg:gap-6"},ne={class:"shrink-0"},le={class:"text-xl font-bold text-woodsmoke-900 dark:text-white"},ie={class:"flex items-center space-x-4 shrink-0"},ce=["disabled"],de={class:"flex flex-wrap gap-1 sm:gap-2 min-w-0"},ue=["onClick"],pe={class:"relative flex items-center justify-center shrink-0"},ve={class:"whitespace-nowrap text-base"},ge={class:"calendar-container rounded-lg bg-tropical-blue-200/15 dark:bg-polo-blue-500b overflow-hidden p-3"},fe={key:0,class:"flex items-center justify-center px-4 py-2"},he=C({__name:"CalendarView",setup(D){const{notify:f}=K(),l=c(!1),h=c([]),u=c([{text:"United States",selected:!0,clicked:!1,variant:"usa",type:1},{text:"United Kingdom",selected:!0,clicked:!1,variant:"uk",type:2},{text:"Germany",selected:!0,clicked:!1,variant:"de",type:3},{text:"Unofficial",selected:!0,clicked:!1,variant:"unofficial",type:4}]),i=c(null),A=c(0);let b=null;const T=()=>{var e;((e=i.value)==null?void 0:e.getApi())&&(A.value++,Z(()=>{var r;const a=(r=i.value)==null?void 0:r.getApi();a&&(a.updateSize(),a.render())}))};let v=null;const y=()=>{v&&clearTimeout(v),v=window.setTimeout(()=>{T()},200)},m=(t,e="bg")=>{var r;return((r={usa:{bg:"bg-eucalyptus-500",border:"border-eucalyptus-500/42"},uk:{bg:"bg-grade-f",border:"border-grade-f/42"},de:{bg:"bg-lightning-yellow-400",border:"border-lightning-yellow-400/42"},unofficial:{bg:"bg-lynch-500",border:"border-lynch-500/42"}}[t])==null?void 0:r[e])||(e==="bg"?"bg-lynch-500":"border-lynch-500/42")},E=t=>{const e=u.value[t];e.selected?e.clicked=!e.clicked:(e.selected=!0,e.clicked=!1)},V=p(()=>{const t={};return u.value.forEach(e=>{t[e.type]=e.selected&&!e.clicked}),h.value.filter(e=>t[e.type])}),s=c(new Date),z=p(()=>{const e=["January","February","March","April","May","Jun","July","August","September","October","November","December"][s.value.getMonth()],a=s.value.getFullYear();return`${e} ${a}`}),S=p(()=>{const t=new Date,e=s.value.getMonth(),a=s.value.getFullYear(),r=t.getMonth(),k=t.getFullYear();return e===r&&a===k}),B=()=>{var e;const t=(e=i.value)==null?void 0:e.getApi();t&&(t.prev(),s.value=t.getDate())},F=()=>{var e;const t=(e=i.value)==null?void 0:e.getApi();t&&(t.next(),s.value=t.getDate())},N=()=>{var e;const t=(e=i.value)==null?void 0:e.getApi();t&&(t.today(),s.value=t.getDate())},$=t=>{s.value=t.view.calendar.getDate()},j=t=>{const e=O(t.event.extendedProps.type);t.el.style.backgroundColor=x(e),t.el.style.borderColor=x(e)},Y=p(()=>({plugins:[U,J,L],initialView:"dayGridMonth",headerToolbar:{left:"",center:"",right:""},events:V.value,weekends:!0,firstDay:0,editable:!1,selectable:!1,selectMirror:!0,dayMaxEvents:!0,fixedWeekCount:!1,height:"auto",aspectRatio:1.35,themeSystem:"standard",datesSet:$,eventDidMount:j})),O=t=>{const e=u.value.find(a=>a.type===t);return e?e.variant:"info"},x=t=>({usa:"var(--color-eucalyptus-500)",uk:"var(--color-grade-f)",de:"var(--color-lightning-yellow-400)",unofficial:"var(--color-lynch-500)"})[t]||"var(--color-lynch-500)",R=async()=>{l.value=!0;try{const t=await q.get("/api/calendar/events");h.value=t.data.events||[]}catch{f("Something went wrong. Please try again later.","error")}finally{l.value=!1}};return H(async()=>{await R();const t=document.querySelector(".calendar-container");t&&"ResizeObserver"in window&&(b=new ResizeObserver(()=>{y()}),b.observe(t)),window.addEventListener("resize",y)}),(t,e)=>(n(),d("div",te,[o("div",oe,[l.value?w("",!0):(n(),d("div",ae,[l.value?w("",!0):(n(),d("div",re,[o("div",se,[o("div",ne,[o("h1",le,_(z.value),1)]),o("div",ie,[o("button",{onClick:B,class:"cursor-pointer p-2 rounded-lg hover:bg-tropical-blue-200/15 dark:hover:bg-dodger-blue-430 hover:text-woodsmoke-900/70 dark:hover:text-white transition-colors duration-200",title:"next month"},[...e[0]||(e[0]=[o("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"})],-1)])]),o("button",{onClick:N,disabled:S.value,class:"relative flex justify-center rounded-lg bg-blue-ribbon-500 dark:bg-dodger-blue-430 hover:opacity-90 cursor-pointer px-5 py-2 text-base font-semibold text-white shadow-sm disabled:opacity-60 disabled:cursor-not-allowed"}," Today ",8,ce),o("button",{onClick:F,class:"cursor-pointer p-2 rounded-lg hover:bg-tropical-blue-200/15 dark:hover:bg-dodger-blue-430 hover:text-woodsmoke-900/70 dark:hover:text-white transition-colors duration-200",title:"prev month"},[...e[1]||(e[1]=[o("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"})],-1)])])]),o("div",de,[(n(!0),d(I,null,Q(u.value,(a,r)=>(n(),d("button",{key:r,onClick:k=>E(r),class:g(["cursor-pointer flex items-center gap-1.5 sm:gap-2 px-2 sm:px-3 py-1.5 sm:py-2 text-base font-medium rounded-md min-w-0 shrink-0",a.selected?"text-gray-900 dark:text-white":"text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white "])},[o("div",pe,[o("div",{class:g(["w-4 h-4 sm:w-5 sm:h-5 rounded-lg border transition-opacity duration-200",m(a.variant,"border"),a.selected?"opacity-100":"opacity-0"])},null,2),o("div",{class:g(["absolute w-3 h-3 sm:w-3.5 sm:h-3.5 rounded-lg transition-opacity duration-200",m(a.variant,"bg"),a.selected&&!a.clicked?"opacity-100":"opacity-0"])},null,2)]),o("span",ve,_(a.text),1)],10,ue))),128))])])]))])),o("div",ge,[l.value?(n(),d("div",fe,[W(G,{classColor:"text-mariner-500 dark:text-dodger-blue-400 mr-2"}),e[2]||(e[2]=o("span",null,"Updating...",-1))])):(n(),M(X(P),{key:1,ref_key:"fullCalendar",ref:i,options:Y.value},null,8,["options"]))])])]))}}),be=ee(he,[["__scopeId","data-v-163f876c"]]),Me=C({__name:"CalendarView",setup(D){return(f,l)=>(n(),M(be))}});
1export{Me as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.