1import N from"./BDmP0RPm.js";import{a1 as O,a5 as $,r as C,n as d,w as g,as as u,a_ as T,q as w,a as R,Y as A,aa as D}from"./D9keoevw.js";import{p as l}from"./9W_TOU_O.js";const h={key:0,class:"calendar-options"},L={__name:"CalendarButton",props:{event:Object},setup(E){const e=E,s=D(!1),m=D();O(m,()=>{s.value=!1});const c=n=>n.toISOString().replace(/[-:]/g,"").replace(/\.\d{3}/,""),p=()=>{if(!e.event?.description)return"";const n=e.event.description;return Array.isArray(n)?n.map(t=>t.text||"").join(` 2`).trim():""},_=n=>{if(!e.event?.start_time)return null;const t=l(e.event.start_time),r=e.event.end_time?l(e.event.end_time):new Date(t.getTime()+7200*1e3),o=encodeURIComponent(e.event.title||"Event"),a=encodeURIComponent(p()),i=encodeURIComponent(e.event.location||""),f=c(t),S=c(r);switch(n){case"google":return`https://calendar.google.com/calendar/render?action=TEMPLATE&text=${o}&dates=${f}/${S}&details=${a}&location=${i}`;case"outlook":return`https://outlook.live.com/calendar/0/deeplink/compose?subject=${o}&startdt=${t.toISOString()}&enddt=${r.toISOString()}&body=${a}&location=${i}`;case"office365":return`https://outlook.office.com/calendar/0/deeplink/compose?subject=${o}&startdt=${t.toISOString()}&enddt=${r.toISOString()}&body=${a}&location=${i}`;case"yahoo":const k=f,I=Math.floor((r-t)/(60*1e3));return`https://calendar.yahoo.com/?v=60&title=${o}&st=${k}&dur=${I}&desc=${a}&in_loc=${i}`;default:return null}},b=()=>{if(!e.event?.start_time)return null;const n=l(e.event.start_time),t=e.event.end_time?l(e.event.end_time):new Date(n.getTime()+7200*1e3),r=e.event.title||"Event",o=p(),a=e.event.location||"";return["BEGIN:VCALENDAR","VERSION:2.0","PRODID:-//Swang Golf//Event//EN","BEGIN:VEVENT",`UID:${Date.now()}@swang.golf`,`DTSTAMP:${c(new Date)}`,`DTSTART:${c(n)}`,`DTEND:${c(t)}`,`SUMMARY:${r}`,`DESCRIPTION:${o.replace(/\n/g,"\\n")}`,`LOCATION:${a}`,"END:VEVENT","END:VCALENDAR"].join(`\r 3`)},v=n=>{if(s.value=!1,n==="ics"){const t=b();if(!t)return;const r=new Blob([t],{type:"text/calendar;charset=utf-8"}),o=URL.createObjectURL(r),a=document.createElement("a");a.href=o,a.download=`${e.event.title||"event"}.ics`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(o)}else{const t=_(n);t&&window.open(t,"_blank")}};return(n,t)=>{const r=N;return $(),C("div",{class:A(["event-calendar-button",{open:u(s)}]),ref_key:"container",ref:m},[d("button",{class:"calendar-btn",onClick:t[0]||(t[0]=o=>s.value=!u(s))},[g(r)]),g(R,{name:"fade"},{default:T(()=>[u(s)?($(),C("div",h,[d("button",{onClick:t[1]||(t[1]=o=>v("google"))}," Google Calendar "),d("button",{onClick:t[2]||(t[2]=o=>v("ics"))}," Apple Calendar / Other ")])):w("",!0)]),_:1})],2)}}};export{L 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.