import{D as r}from"./DsNA9-h5.js";import{cG as d,O as c}from"#entry";function h(e,t,s=".jpg"){const n=d("settings"),i=t==="download"?"/download/":"/media/";return e.media&&e.media.length?t==="alt"?e?.media?.[0]?.name:n?.value?.baseurl+i+(t==="thumb"?"thumb/":"")+e?.media?.[0]?.url?.replace(/.jpg$/,s):t!=="alt"?n?.value?.baseurl+i+(t==="thumb"?"thumb/":"")+"logo.svg":""}function b(e,t){const s=d("settings");return c({get:()=>s.value[e],set:n=>{$fetch("/api/settings",{method:"PUT",body:{key:e,value:n}}),s.value[e]=n}})}const p={actor(e,t="label"){const s=d("settings");if(t==="title")return e?.ap_id?e?.object?.name:"Local Instance";if(t==="label"||t==="filter")return e?.ap_id?`@${e?.object?.preferredUsername??e?.name}@${e?.instanceDomain??e?.domain}`:`@${s.value?.instance_name}@${s.value?.hostname}`;if(t==="icon")return e?.ap_id?e?.object?.icon?.url??`${e?.instanceDomain??e?.domain??""}/favicon.ico`:s.value.baseurl+"/logo.png"}};function _(e){if(!e)return[];const t=[],s=r.local().toUnixInteger();for(const n of e){const i=r.fromSeconds(n.start_datetime);if(!i||!i.year)continue;const l=r.local().set({year:i.year,month:i.month,day:i.day}),u=`${l.month}${l.day}`,o=(n.end_datetime||n.start_datetime)<s?"vc-past":"";if(n?.multidate===!0&&n.end_datetime){t.push({dates:{start:l.toJSDate(),end:r.fromSeconds(n.end_datetime).toJSDate()},highlight:{start:{fillMode:"outline"},base:{fillMode:"light"},end:{fillMode:"outline"}}});continue}const a=t.find(m=>m.day===u);if(!a){t.push({day:u,key:n.id,n:1,dates:l.toJSDate(),dot:{color:"teal",class:o}});continue}a.n++,a.n>=20?a.dot={color:"purple",class:o}:a.n>=10?a.dot={color:"red",class:o}:a.n>=5?a.dot={color:"orange",class:o}:a.n>=3?a.dot={color:"yellow",class:o}:a.dot={color:"teal",class:o}}return t.push({key:"today",dates:new Date,highlight:{fillMode:"outline"}}),t}export{h as a,p as f,b as m,_ as u};
