import{F as B,_ as W,p as E,s as $,a as ee,b as He,x as Je,u as De,c as e,k as L,d as ye,g as dt,y as kt,e as Ni,f as Et,h as Nt,i as ft,q as ge,j as et,l as As,L as $e,m as rn,A as ut,n as Ui,o as zc,r as Oi,t as Fi,v as Rs,C as Es,w as Xe,z as _s,B as ot,T as Ls,D as Ms,P as Ds,E as _n,G as St,H as qe,I as zi,J as Ps,K as qt,M as Ns,N as Us,O as Zn,Q as Jn,R as Os,S as Qn,U as Ln,V as Ue,W as Fs,X as zs}from"./useTitle-TOnOofzE.js";import{u as Mn,s as ie,a as Le,o as ei,b as Bs,I as v,M as Ee,A as st,N as _t,c as Ze,d as pe,e as ze,f as tt,L as oe,g as Bi,l as Hs,t as ti,R as It,h as Ge,p as Ut,i as Qe,j as _e,k as Hi,m as Sn,E as qi,n as je,q as rt,r as qs,S as cn,v as ni,T as Vi,w as it,x as Dn,y as Be,z as ht,B as ii,C as Vs,D as Gs,F as Pn,G as Gi,H as js,J as Ys,K as Ws,O as ji,P as Vt,Q as Ks,U as Xs,V as Yi,W as Zs,X as wt,Y as Nn,Z as Js,_ as Wi,$ as Qs,a0 as Ki,a1 as eo,a2 as to,a3 as no,a4 as si,a5 as io,a6 as Kt}from"./fuse-sLNor9NY.js";import"./tinyld-light-PxOyhYWY.js";import"./index-gNUvm9kb.js";var Xi=so;function so(t,n,s){var i=null,o=null,r=function(){i&&(clearTimeout(i),o=null,i=null)},f=function(){var a=o;r(),a&&a()},u=function(){if(!n)return t.apply(this,arguments);var a=this,d=arguments,p=s&&!i;if(r(),o=function(){t.apply(a,d)},i=setTimeout(function(){if(i=null,!p){var c=o;return o=null,c()}},n),p)return o()};return u.cancel=r,u.flush=f,u}/*! * swiped-events.js - v@version@ * Pure JavaScript swipe events * https://github.com/john-doherty/swiped-events * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element * @author John Doherty * @license MIT */(function(t,n){"use strict";typeof t.CustomEvent!="function"&&(t.CustomEvent=function(l,b){b=b||{bubbles:!1,cancelable:!1,detail:void 0};var m=n.createEvent("CustomEvent");return m.initCustomEvent(l,b.bubbles,b.cancelable,b.detail),m},t.CustomEvent.prototype=t.Event.prototype),n.addEventListener("touchstart",p,!1),n.addEventListener("touchmove",c,!1),n.addEventListener("touchend",d,!1);var s=null,i=null,o=null,r=null,f=null,u=null,a=0;function d(l){if(u===l.target){var b=parseInt(h(u,"data-swipe-threshold","20"),10),m=h(u,"data-swipe-unit","px"),S=parseInt(h(u,"data-swipe-timeout","500"),10),g=Date.now()-f,y="",I=l.changedTouches||l.touches||[];if(m==="vh"&&(b=Math.round(b/100*n.documentElement.clientHeight)),m==="vw"&&(b=Math.round(b/100*n.documentElement.clientWidth)),Math.abs(o)>Math.abs(r)?Math.abs(o)>b&&g0?y="swiped-left":y="swiped-right"):Math.abs(r)>b&&g0?y="swiped-up":y="swiped-down"),y!==""){var w={dir:y.replace(/swiped-/,""),touchType:(I[0]||{}).touchType||"direct",fingers:a,xStart:parseInt(s,10),xEnd:parseInt((I[0]||{}).clientX||-1,10),yStart:parseInt(i,10),yEnd:parseInt((I[0]||{}).clientY||-1,10)};u.dispatchEvent(new CustomEvent("swiped",{bubbles:!0,cancelable:!0,detail:w})),u.dispatchEvent(new CustomEvent(y,{bubbles:!0,cancelable:!0,detail:w}))}s=null,i=null,f=null}}function p(l){l.target.getAttribute("data-swipe-ignore")!=="true"&&(u=l.target,f=Date.now(),s=l.touches[0].clientX,i=l.touches[0].clientY,o=0,r=0,a=l.touches.length)}function c(l){if(!(!s||!i)){var b=l.touches[0].clientX,m=l.touches[0].clientY;o=s-b,r=i-m}}function h(l,b,m){for(;l&&l!==n.documentElement;){var S=l.getAttribute(b);if(S)return S;l=l.parentNode}return m}})(window,document);function Lt(t=()=>{},n=[]){const s=B(t);W(()=>{s.current=t},[n]),W(()=>{const i=()=>{const o=document.hidden||document.visibilityState==="hidden";s.current(!o)};return document.addEventListener("visibilitychange",i),()=>document.removeEventListener("visibilitychange",i)},[])}const oo=1e3*3,ao=15e3,ro=Je(function({isLoggedIn:n}){const[s,i]=E(!0);Lt(i);const o=async(u,a,d)=>{var p;if($.notificationsLast){const c=u.v1.notifications.list({limit:1,sinceId:$.notificationsLast.id}),{value:h}=await c.next();if(h!=null&&h.length)if(d)$.notificationsShowNew=!0;else{let l;try{const b=await u.v1.markers.fetch({timeline:"notifications"});l=(p=b==null?void 0:b.notifications)==null?void 0:p.lastReadId}catch{}l?$.notificationsShowNew=h[0].id!==l:$.notificationsShowNew=!0}}};W(()=>{let u,a;if(n&&s){const{masto:d,streaming:p,instance:c}=ee();(async()=>{await o(d,c);let h=!1;p&&(a=setTimeout(()=>{(async()=>{try{h=!0,u=p.user.notification.subscribe();for await(const l of u){if(!u||!s)break;l.event==="notification"&&He(l.payload,c,{skipThreading:!0}),$.notificationsShowNew=!0}}catch{h=!1}h||(a=setInterval(()=>{o(d,c,!0)},ao))})()},oo))})()}return()=>{var d;(d=u==null?void 0:u.unsubscribe)==null||d.call(u),u=null,clearTimeout(a),clearInterval(a)}},[s,n]);const r=B(),f=()=>{r.current=Date.now(),fetch("./version.json").then(u=>u.json()).then(u=>{u&&($.appVersion=u)}).catch(u=>{})};return Mn(f,s&&1e3*60*30),Lt(u=>{u&&(r.current?Date.now()-r.current>1e3*60*60&&f():f())}),Le("shift+alt+k",()=>{const u=$.settings.cloakMode;$.settings.cloakMode=!u,ie({text:`Cloak mode ${u?"disabled":"enabled"}`})}),null});function co(){const t=De($);function n(s){if(t.composerState.minimized){$.composerState.minimized=!1,ei();return}s.shiftKey?Bs()||($.showCompose=!0):(ei(),$.showCompose=!0)}return Le("c, shift+c",n,{ignoreEventWhen:s=>!!document.querySelector("#modal-container > *")}),e("button",{type:"button",id:"compose-button",onClick:n,class:`${t.composerState.minimized?"min":""} ${t.composerState.publishing?"loading":""} ${t.composerState.publishingError?"error":""}`,children:e(v,{icon:"quill",size:"xl",alt:"Compose"})})}const lo=Je(function(){const n=De($);function s(){$.showKeyboardShortcutsHelp=!1}return Le("?, shift+?, shift+slash",i=>{$.showKeyboardShortcutsHelp=!0},{ignoreEventWhen:i=>!!document.querySelector("#modal-container > *")}),!!n.showKeyboardShortcutsHelp&&e(Ee,{onClose:s,children:e("div",{id:"keyboard-shortcuts-help-container",class:"sheet",tabindex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:s,children:e(v,{icon:"x"})}),e("header",{children:e("h2",{children:"Keyboard shortcuts"})}),e("main",{children:e("table",{children:[{action:"Keyboard shortcuts help",keys:e("kbd",{children:"?"})},{action:"Next post",keys:e("kbd",{children:"j"})},{action:"Previous post",keys:e("kbd",{children:"k"})},{action:"Skip carousel to next post",keys:e(L,{children:[e("kbd",{children:"Shift"})," + ",e("kbd",{children:"j"})]})},{action:"Skip carousel to previous post",keys:e(L,{children:[e("kbd",{children:"Shift"})," + ",e("kbd",{children:"k"})]})},{action:"Load new posts",keys:e("kbd",{children:"."})},{action:"Open post details",keys:e(L,{children:[e("kbd",{children:"Enter"})," or ",e("kbd",{children:"o"})]})},{action:e(L,{children:["Expand content warning or",e("br",{}),"toggle expanded/collapsed thread"]}),keys:e("kbd",{children:"x"})},{action:"Close post or dialogs",keys:e(L,{children:[e("kbd",{children:"Esc"})," or ",e("kbd",{children:"Backspace"})]})},{action:"Focus column in multi-column mode",keys:e(L,{children:[e("kbd",{children:"1"})," to ",e("kbd",{children:"9"})]})},{action:"Compose new post",keys:e("kbd",{children:"c"})},{action:"Compose new post (new window)",className:"insignificant",keys:e(L,{children:[e("kbd",{children:"Shift"})," + ",e("kbd",{children:"c"})]})},{action:"Send post",keys:e(L,{children:[e("kbd",{children:"Ctrl"})," + ",e("kbd",{children:"Enter"})," or ",e("kbd",{children:"⌘"})," +"," ",e("kbd",{children:"Enter"})]})},{action:"Search",keys:e("kbd",{children:"/"})},{action:"Reply",keys:e("kbd",{children:"r"})},{action:"Reply (new window)",className:"insignificant",keys:e(L,{children:[e("kbd",{children:"Shift"})," + ",e("kbd",{children:"r"})]})},{action:"Like (favourite)",keys:e(L,{children:[e("kbd",{children:"l"})," or ",e("kbd",{children:"f"})]})},{action:"Boost",keys:e(L,{children:[e("kbd",{children:"Shift"})," + ",e("kbd",{children:"b"})]})},{action:"Bookmark",keys:e("kbd",{children:"d"})},{action:"Toggle Cloak mode",keys:e(L,{children:[e("kbd",{children:"Shift"})," + ",e("kbd",{children:"Alt"})," + ",e("kbd",{children:"k"})]})}].map(({action:i,className:o,keys:r})=>e("tr",{children:[e("th",{class:o,children:i}),e("td",{children:r})]},i))})})]})})}),Zi=new Set,We=new WeakMap,Mt=new WeakMap,vt=new WeakMap,In=new WeakMap,uo=new WeakMap,Dt=new WeakMap,ln=new WeakMap,Bt=new WeakSet;let gt,Un=0,On=0;const ct="__aa_tgt",Gt="__aa_del",dn="__aa_new",ho=t=>{const n=yo(t);n&&n.forEach(s=>wo(s))},fo=t=>{t.forEach(n=>{n.target===gt&&mo(),We.has(n.target)&&Ct(n.target)})};function po(t){const n=In.get(t);n==null||n.disconnect();let s=We.get(t),i=0;const o=5;s||(s=Pt(t),We.set(t,s));const{offsetWidth:r,offsetHeight:f}=gt,a=[s.top-o,r-(s.left+o+s.width),f-(s.top+o+s.height),s.left-o].map(p=>`${-1*Math.floor(p)}px`).join(" "),d=new IntersectionObserver(()=>{++i>1&&Ct(t)},{root:gt,threshold:1,rootMargin:a});d.observe(t),In.set(t,d)}function Ct(t){clearTimeout(ln.get(t));const n=fn(t),s=jt(n)?500:n.duration;ln.set(t,setTimeout(async()=>{const i=vt.get(t);try{await(i==null?void 0:i.finished),We.set(t,Pt(t)),po(t)}catch{}},s))}function mo(){clearTimeout(ln.get(gt)),ln.set(gt,setTimeout(()=>{Zi.forEach(t=>ts(t,n=>Ji(()=>Ct(n))))},100))}function go(t){setTimeout(()=>{uo.set(t,setInterval(()=>Ji(Ct.bind(null,t)),2e3))},Math.round(2e3*Math.random()))}function Ji(t){typeof requestIdleCallback=="function"?requestIdleCallback(()=>t()):requestAnimationFrame(()=>t())}let Cn,Rt;const bo=typeof window<"u"&&"ResizeObserver"in window;bo&&(gt=document.documentElement,Cn=new MutationObserver(ho),Rt=new ResizeObserver(fo),window.addEventListener("scroll",()=>{On=window.scrollY,Un=window.scrollX}),Rt.observe(gt));function yo(t){return t.reduce((i,o)=>[...i,...Array.from(o.addedNodes),...Array.from(o.removedNodes)],[]).every(i=>i.nodeName==="#comment")?!1:t.reduce((i,o)=>{if(i===!1)return!1;if(o.target instanceof Element){if(gn(o.target),!i.has(o.target)){i.add(o.target);for(let r=0;rs(t,Dt.has(t)));for(let s=0;so(i,Dt.has(i)))}}function zn(t){return Array.isArray(t)?t:[t]}function jt(t){return typeof t=="function"}function ko(t){const n=We.get(t),s=Pt(t);if(!Fn(t))return We.set(t,s);let i;if(!n)return;const o=fn(t);if(typeof o!="function"){const r=n.left-s.left,f=n.top-s.top,[u,a,d,p]=Qi(t,n,s),c={transform:`translate(${r}px, ${f}px)`},h={transform:"translate(0, 0)"};u!==a&&(c.width=`${u}px`,h.width=`${a}px`),d!==p&&(c.height=`${d}px`,h.height=`${p}px`),i=t.animate([c,h],{duration:o.duration,easing:o.easing})}else{const[r]=zn(o(t,"remain",n,s));i=new Animation(r),i.play()}vt.set(t,i),We.set(t,s),i.addEventListener("finish",Ct.bind(null,t))}function oi(t){dn in t&&delete t[dn];const n=Pt(t);We.set(t,n);const s=fn(t);if(!Fn(t))return;let i;if(typeof s!="function")i=t.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:s.duration*1.5,easing:"ease-in"});else{const[o]=zn(s(t,"add",n));i=new Animation(o),i.play()}vt.set(t,i),i.addEventListener("finish",Ct.bind(null,t))}function ai(t,n){var s;t.remove(),We.delete(t),Mt.delete(t),vt.delete(t),(s=In.get(t))===null||s===void 0||s.disconnect(),setTimeout(()=>{if(Gt in t&&delete t[Gt],Object.defineProperty(t,dn,{value:!0,configurable:!0}),n&&t instanceof HTMLElement)for(const i in n)t.style[i]=""},0)}function So(t){var n;if(!Mt.has(t)||!We.has(t))return;const[s,i]=Mt.get(t);Object.defineProperty(t,Gt,{value:!0,configurable:!0});const o=window.scrollX,r=window.scrollY;if(i&&i.parentNode&&i.parentNode instanceof Element?i.parentNode.insertBefore(t,i):s&&s.parentNode?s.parentNode.appendChild(t):(n=es(t))===null||n===void 0||n.appendChild(t),!Fn(t))return ai(t);const[f,u,a,d]=Co(t),p=fn(t),c=We.get(t);(o!==Un||r!==On)&&Io(t,o,r,p);let h,l={position:"absolute",top:`${f}px`,left:`${u}px`,width:`${a}px`,height:`${d}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!jt(p))Object.assign(t.style,l),h=t.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:p.duration,easing:"ease-out"});else{const[b,m]=zn(p(t,"remove",c));(m==null?void 0:m.styleReset)!==!1&&(l=(m==null?void 0:m.styleReset)||l,Object.assign(t.style,l)),h=new Animation(b),h.play()}vt.set(t,h),h.addEventListener("finish",ai.bind(null,t,l))}function Io(t,n,s,i){const o=Un-n,r=On-s,f=document.documentElement.style.scrollBehavior;if(getComputedStyle(gt).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+o,window.scrollY+r),!t.parentElement)return;const a=t.parentElement;let d=a.clientHeight,p=a.clientWidth;const c=performance.now();function h(){requestAnimationFrame(()=>{if(!jt(i)){const l=d-a.clientHeight,b=p-a.clientWidth;c+i.duration>performance.now()?(window.scrollTo({left:window.scrollX-b,top:window.scrollY-l}),d=a.clientHeight,p=a.clientWidth,h()):document.documentElement.style.scrollBehavior=f}})}h()}function Co(t){const n=We.get(t),[s,,i]=Qi(t,n,Pt(t));let o=t.parentElement;for(;o&&(getComputedStyle(o).position==="static"||o instanceof HTMLBodyElement);)o=o.parentElement;o||(o=document.body);const r=getComputedStyle(o),f=We.get(o)||Pt(o),u=Math.round(n.top-f.top)-at(r.borderTopWidth),a=Math.round(n.left-f.left)-at(r.borderLeftWidth);return[u,a,s,i]}function ns(t,n={}){return Cn&&Rt&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!jt(n)&&!n.disrespectUserMotionPreference||(Bt.add(t),getComputedStyle(t).position==="static"&&Object.assign(t.style,{position:"relative"}),ts(t,Ct,go,o=>Rt==null?void 0:Rt.observe(o)),jt(n)?Dt.set(t,n):Dt.set(t,{duration:250,easing:"ease-in-out",...n}),Cn.observe(t,{childList:!0}),Zi.add(t))),Object.freeze({parent:t,enable:()=>{Bt.add(t)},disable:()=>{Bt.delete(t)},isEnabled:()=>Bt.has(t)})}function Bn(t){const n=B(null),[s,i]=E(),o=r=>{s&&(r?s.enable():s.disable())};return W(()=>{n.current instanceof HTMLElement&&i(ns(n.current,t||{}))},[]),[n,o]}function To({onClose:t}){const{masto:n}=ee(),s=ye.local.getJSON("accounts"),i=dt(),o=s.length>1,[r,f]=kt(a=>a+1,0),[u]=Bn();return e("div",{id:"accounts-container",class:"sheet",tabIndex:"-1",children:[!!t&&e("button",{type:"button",class:"sheet-close",onClick:t,children:e(v,{icon:"x"})}),e("header",{class:"header-grid",children:e("h2",{children:"Accounts"})}),e("main",{children:e("section",{children:[e("ul",{class:"accounts-list",ref:u,children:s.map((a,d)=>{const p=a.info.id===i,c=d===0;return e("li",{children:[e("div",{children:[o&&e("span",{class:`current ${p?"is-current":""}`,children:e(v,{icon:"check-circle",alt:"Current"})}),e(st,{url:a.info.avatarStatic,size:"xxl",onDblClick:async()=>{if(p)try{const h=await n.v1.accounts.$select(a.info.id).fetch();a.info=h,ye.local.setJSON("accounts",s),f()}catch{}}}),e(_t,{account:o?{...a.info,acct:/@/.test(a.info.acct)?a.info.acct:`${a.info.acct}@${a.instanceURL}`}:a.info,showAcct:!0,onClick:()=>{p?$.showAccount=`${a.info.username}@${a.instanceURL}`:(Ni(a.info.id),location.reload())}})]}),e("div",{class:"actions",children:[c&&o&&e(L,{children:[e("span",{class:"tag",children:"Default"})," "]}),e(Ze,{align:"end",menuButton:e("button",{type:"button",title:"More",class:"plain more-button",children:e(v,{icon:"more",size:"l",alt:"More"})}),children:[e(pe,{onClick:()=>{$.showAccount=`${a.info.username}@${a.instanceURL}`},children:[e(v,{icon:"user"}),e("span",{children:"View profile…"})]}),e(ze,{}),o&&e(pe,{disabled:c,onClick:()=>{s.splice(d,1),s.unshift(a),ye.local.setJSON("accounts",s),f()},children:[e(v,{icon:"check-circle"}),e("span",{children:"Set as default"})]}),e(tt,{subMenu:!0,confirmLabel:e(L,{children:[e(v,{icon:"exit"}),e("span",{children:["Log out @",a.info.acct,"?"]})]}),disabled:!p,menuItemClassName:"danger",onClick:()=>{s.splice(d,1),ye.local.setJSON("accounts",s),location.href=location.pathname||"/"},children:[e(v,{icon:"exit"}),e("span",{children:"Log out…"})]})]})]})]},a.info.id)})}),e("p",{children:e(oe,{to:"/login",class:"button plain2",onClick:t,children:[e(v,{icon:"plus"})," ",e("span",{children:"Add an existing account"})]})}),o&&e("p",{children:e("small",{children:["Note: ",e("i",{children:"Default"})," account will always be used for first load. Switched accounts will persist during the session."]})})]})})]})}const Hn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xml:space='preserve'%20fill-rule='evenodd'%20stroke-linejoin='round'%20stroke-miterlimit='2'%20clip-rule='evenodd'%20viewBox='0%200%2064%2064'%3e%3cpath%20fill='none'%20d='M0%200h63.994v63.994H0z'/%3e%3cpath%20fill='%23a4bff7'%20d='M37.774%2011.471c14.639%203.752%2019.034%2016.557%2015.889%2031.304-.696%203.261-2.563%206.661-6.356%208.693-3.204%201.717-8.07%202.537-15.338.55l-9.634-2.404C11.651%2046.992%208.378%2038.733%2010.027%2031.823c3.627-15.201%2015.543-23.48%2027.747-20.352Z'/%3e%3cpath%20fill='%23d8e7fe'%20d='M36.76%2015.429c12.289%203.15%2015.547%2014.114%2012.907%2026.493-.947%204.44-4.937%209.365-16.664%206.143l-9.684-2.417c-7.854-1.923-10.53-7.8-9.318-12.877%203.016-12.639%2012.611-19.943%2022.759-17.342Z'/%3e%3cpath%20fill='%236081e6'%20d='M27.471%2024.991c-1.457-.698-7.229%203.213-7.663%208.926-.182%202.39%204.55%203.237%205.071-.169.725-4.743%203.715-8.218%202.592-8.757Zm10.746%202.005c-2.083.327-.382%205.901-.595%2010.727-.123%202.8%204.388%203.464%204.703%202.011%201.098-5.073-2.066-13.058-4.108-12.738Z'/%3e%3c/svg%3e";function ri(t){const{masto:n}=ee();return n.v1.push.subscription.create(t)}function xo(){const{masto:t}=ee();return t.v1.push.subscription.fetch()}function $o(t){const{masto:n}=ee();return n.v1.push.subscription.update(t)}function Ao(){const{masto:t}=ee();return t.v1.push.subscription.remove()}function pn(){return"serviceWorker"in navigator&&"PushManager"in window}function Ro(){return navigator.serviceWorker.getRegistration()}async function qn(){const t=await Ro(),n=t?await t.pushManager.getSubscription():void 0;return{registration:t,subscription:n}}function is(t){const n="=".repeat((4-t.length%4)%4),s=`${t}${n}`.replace(/-/g,"+").replace(/_/g,"/"),i=window.atob(s),o=new Uint8Array(i.length);for(let r=0;r{l.preventDefault();const m=new FormData(i.current).get("theme"),S=document.documentElement;if(m==="auto"){S.classList.remove("is-light","is-dark");const g=document.querySelector('meta[data-theme-setting="manual"]');g&&(g.name=""),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(I=>{I.name="theme-color"})}else{S.classList.toggle("is-light",m==="light"),S.classList.toggle("is-dark",m==="dark");const g=document.querySelector('meta[data-theme-setting="manual"]');g&&(g.name="theme-color",g.content=m==="light"?g.dataset.themeLightColor:g.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(I=>{I.name=""})}document.querySelector('meta[name="color-scheme"]').setAttribute("content",m==="auto"?"dark light":m),m==="auto"?ye.local.del("theme"):ye.local.set("theme",m)},children:e("div",{class:"radio-group",children:[e("label",{children:[e("input",{type:"radio",name:"theme",value:"light",defaultChecked:s==="light"}),e("span",{children:"Light"})]}),e("label",{children:[e("input",{type:"radio",name:"theme",value:"dark",defaultChecked:s==="dark"}),e("span",{children:"Dark"})]}),e("label",{children:[e("input",{type:"radio",name:"theme",value:"auto",defaultChecked:s!=="light"&&s!=="dark"}),e("span",{children:"Auto"})]})]})})})]}),e("li",{children:[e("div",{children:e("label",{children:"Text size"})}),e("div",{class:"range-group",children:[e("span",{style:{fontSize:yt[0]},children:"A"})," ",e("input",{type:"range",min:yt[0],max:yt[yt.length-1],step:"1",value:u,list:"sizes",onChange:l=>{const b=parseInt(l.target.value,10);document.documentElement.style.setProperty("--text-size",`${b}px`),b===di?ye.local.del("textSize"):ye.local.set("textSize",l.target.value)}})," ",e("span",{style:{fontSize:yt[yt.length-1]},children:"A"}),e("datalist",{id:"sizes",children:yt.map(l=>e("option",{value:l}))})]})]})]})}),c&&e(L,{children:[e("h3",{children:"Posting"}),e("section",{children:e("ul",{children:e("li",{children:[e("div",{children:e("label",{for:"posting-privacy-field",children:["Default visibility"," ",e(v,{icon:"cloud",alt:"Synced",class:"synced-icon"})]})}),e("div",{children:e("select",{id:"posting-privacy-field",value:a["posting:default:visibility"]||"public",onChange:l=>{const{value:b}=l.target;(async()=>{try{await p.v1.accounts.updateCredentials({source:{privacy:b}}),d({...a,"posting:default:visibility":b}),ye.account.set("preferences",{...a,"posting:default:visibility":b})}catch{alert("Failed to update posting privacy")}})()},children:[e("option",{value:"public",children:"Public"}),e("option",{value:"unlisted",children:"Unlisted"}),e("option",{value:"private",children:"Followers only"})]})})]})})}),e("p",{class:"section-postnote",children:[e(v,{icon:"cloud",alt:"Synced",class:"synced-icon"})," ",e("small",{children:["Synced to your instance server's settings."," ",e("a",{href:`https://${h}/`,target:"_blank",rel:"noopener noreferrer",children:["Go to your instance (",h,") for more settings."]})]})]})]}),e("h3",{children:"Experiments"}),e("section",{children:e("ul",{children:[e("li",{children:e("label",{children:[e("input",{type:"checkbox",checked:n.settings.autoRefresh,onChange:l=>{$.settings.autoRefresh=l.target.checked}})," ","Auto refresh timeline posts"]})}),e("li",{children:e("label",{children:[e("input",{type:"checkbox",checked:n.settings.boostsCarousel,onChange:l=>{$.settings.boostsCarousel=l.target.checked}})," ","Boosts carousel"]})}),e("li",{children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.contentTranslation,onChange:l=>{const{checked:b}=l.target;$.settings.contentTranslation=b,b||($.settings.contentTranslationTargetLanguage=null)}})," ","Post translation"]}),e("div",{class:`sub-section ${n.settings.contentTranslation?"":"more-insignificant"}`,children:[e("div",{children:e("label",{children:["Translate to"," ",e("select",{value:o||"",disabled:!n.settings.contentTranslation,onChange:l=>{$.settings.contentTranslationTargetLanguage=l.target.value||null},children:[e("option",{value:"",children:["System language (",f,")"]}),e("option",{disabled:!0,children:"──────────"}),ti.map(l=>e("option",{value:l.code,children:l.name}))]})]})}),e("hr",{}),e("p",{class:"checkbox-fieldset",children:['Hide "Translate" button for',n.settings.contentTranslationHideLanguages.length>0&&e(L,{children:[" ","(",n.settings.contentTranslationHideLanguages.length,")"]}),":",e("div",{class:"checkbox-fields",children:ti.map(l=>e("label",{children:[e("input",{type:"checkbox",checked:n.settings.contentTranslationHideLanguages.includes(l.code),onChange:b=>{const{checked:m}=b.target;m?$.settings.contentTranslationHideLanguages.push(l.code):$.settings.contentTranslationHideLanguages=n.settings.contentTranslationHideLanguages.filter(S=>S!==l.code)}})," ",l.name]}))})]}),e("p",{class:"insignificant",children:e("small",{children:["Note: This feature uses external translation services, powered by"," ",e("a",{href:"https://github.com/cheeaun/lingva-api",target:"_blank",rel:"noopener noreferrer",children:"Lingva API"})," ","&"," ",e("a",{href:"https://github.com/thedaviddelta/lingva-translate",target:"_blank",rel:"noopener noreferrer",children:"Lingva Translate"}),"."]})}),e("hr",{}),e("div",{children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.contentTranslationAutoInline,disabled:!n.settings.contentTranslation,onChange:l=>{$.settings.contentTranslationAutoInline=l.target.checked}})," ","Auto inline translation"]}),e("p",{class:"insignificant",children:e("small",{children:["Automatically show translation for posts in timeline. Only works for ",e("b",{children:"short"})," posts without content warning, media and poll."]})})]})]})]}),!!Do&&c&&e("li",{children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.composerGIFPicker,onChange:l=>{$.settings.composerGIFPicker=l.target.checked}})," ","GIF Picker for composer"]}),e("div",{class:"sub-section insignificant",children:e("small",{children:["Note: This feature uses external GIF search service, powered by"," ",e("a",{href:"https://developers.giphy.com/",target:"_blank",rel:"noopener noreferrer",children:"GIPHY"}),". G-rated (suitable for viewing by all ages), tracking parameters are stripped, referrer information is omitted from requests, but search queries and IP address information will still reach their servers."]})})]}),!!Mo&&c&&e("li",{children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.mediaAltGenerator,onChange:l=>{$.settings.mediaAltGenerator=l.target.checked}})," ","Image description generator"," ",e(v,{icon:"sparkles2",class:"more-insignificant"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:"Only for new images while composing new posts."})}),e("div",{class:"sub-section insignificant",children:e("small",{children:["Note: This feature uses external AI service, powered by"," ",e("a",{href:"https://github.com/cheeaun/img-alt-api",target:"_blank",rel:"noopener noreferrer",children:"img-alt-api"}),". May not work well. Only for images and in English."]})})]}),c&&e("li",{children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.shortcutSettingsCloudImportExport,onChange:l=>{$.settings.shortcutSettingsCloudImportExport=l.target.checked}})," ",'"Cloud" import/export for shortcuts settings'," ",e(v,{icon:"cloud",class:"more-insignificant"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:["⚠️⚠️⚠️ Very experimental.",e("br",{}),"Stored in your own profile’s notes. Profile (private) notes are mainly used for other profiles, and hidden for own profile."]})}),e("div",{class:"sub-section insignificant",children:e("small",{children:"Note: This feature uses currently-logged-in instance server API."})})]}),e("li",{children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.cloakMode,onChange:l=>{$.settings.cloakMode=l.target.checked}})," ","Cloak mode"," ",e("span",{class:"insignificant",children:["(",e("samp",{children:"Text"})," → ",e("samp",{children:"████"}),")"]})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:"Replace text as blocks, useful when taking screenshots, for privacy reasons."})})]}),c&&e("li",{children:e("button",{type:"button",class:"light",onClick:()=>{$.showDrafts=!0,$.showSettings=!1},children:"Unsent drafts"})})]})}),c&&e(No,{onClose:t}),e("h3",{children:"About"}),e("section",{children:[e("div",{style:{display:"flex",flexWrap:"wrap",gap:8,lineHeight:1.25,alignItems:"center",marginTop:8},children:[e("img",{src:Hn,alt:"",width:"64",height:"64",style:{aspectRatio:"1/1",verticalAlign:"middle",background:"#b7cdf9",borderRadius:12}}),e("div",{children:[e("b",{children:"Phanpy"})," ",e("a",{href:"https://hachyderm.io/@phanpy",rel:"noopener noreferrer",onClick:l=>{l.preventDefault(),$.showAccount="phanpy@hachyderm.io"},children:"@phanpy"}),e("br",{}),e("a",{href:"https://github.com/cheeaun/phanpy",target:"_blank",rel:"noopener noreferrer",children:"Built"})," ","by"," ",e("a",{href:"https://mastodon.social/@cheeaun",rel:"noopener noreferrer",onClick:l=>{l.preventDefault(),$.showAccount="cheeaun@mastodon.social"},children:"@cheeaun"})]})]}),e("p",{children:[e("a",{href:"https://github.com/sponsors/cheeaun",target:"_blank",rel:"noopener noreferrer",children:"Sponsor"})," ","·"," ",e("a",{href:"https://www.buymeacoffee.com/cheeaun",target:"_blank",rel:"noopener noreferrer",children:"Donate"})," ","·"," ",e("a",{href:Lo,target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"})]}),e("p",{children:[ui&&e(L,{children:[e("span",{class:"insignificant",children:"Site:"})," ",ui.replace(/https?:\/\//g,"").replace(/\/$/,""),e("br",{})]}),e("span",{class:"insignificant",children:"Version:"})," ",e("input",{type:"text",class:"version-string",readOnly:!0,size:"18",value:`${"2024-06-23T09:40:47.957Z".slice(0,10).replace(/-/g,".")}.20d0b1c`,onClick:l=>{l.target.select();try{navigator.clipboard.writeText(l.target.value),ie("Version string copied")}catch{ie("Unable to copy version string")}}})," ",e("span",{class:"ib insignificant",children:["(",e("a",{href:"https://github.com/cheeaun/phanpy/commit/20d0b1c",target:"_blank",rel:"noopener noreferrer",children:e(It,{datetime:new Date("2024-06-23T09:40:47.957Z")})}),")"]})]})]})]})]})}function No({onClose:t}){if(!pn())return null;const{instance:n}=ee(),[s,i]=E("default"),o=B(),[r,f]=E(!1),[u,a]=E(!1),d=B();W(()=>{(async()=>{i("loading");try{const{subscription:c,backendSubscription:h}=await Eo();if(h!=null&&h.policy&&h.policy!=="none"){f(!0);const{alerts:l,policy:b}=h;d.current=b;const{elements:m}=o.current,S=m.namedItem("policy");S&&(S.value=b),Object.keys(l).forEach(g=>{const y=m.namedItem(g);(y==null?void 0:y.type)==="checkbox"&&(y.checked=!0)})}i("default")}catch(c){/outside.*authorized/i.test(c.message)?a(!0):alert((c==null?void 0:c.message)||c),i("error")}})()},[]);const p=s==="loading";return e("form",{ref:o,onChange:()=>{setTimeout(()=>{const c=Object.fromEntries(new FormData(o.current)),h=!!c["policy-allow"],l={data:{policy:c.policy,alerts:{mention:!!c.mention,favourite:!!c.favourite,reblog:!!c.reblog,follow:!!c.follow,follow_request:!!c.followRequest,poll:!!c.poll,update:!!c.update,status:!!c.status}}};let b=0;Object.keys(l.data.alerts).forEach(S=>{l.data.alerts[S]?b++:delete l.data.alerts[S]});const m=d.current!==l.data.policy;h&&b>0?m?li().then(()=>{ci(l)}).catch(S=>{alert("Failed to update subscription. Please try again.")}):ci(l).catch(S=>{alert("Failed to update subscription. Please try again.")}):li().catch(S=>{alert("Failed to remove subscription. Please try again.")})},100)},children:[e("h3",{children:"Push Notifications (beta)"}),e("section",{children:e("ul",{children:e("li",{children:[e("label",{children:[e("input",{type:"checkbox",disabled:p||u,name:"policy-allow",checked:r,onChange:async c=>{const{checked:h}=c.target;if(h){const l=await Notification.requestPermission();l==="granted"?f(!0):(f(!1),l==="denied"&&alert("Push notifications are blocked. Please enable them in your browser settings."))}else f(!1)}})," ","Allow from"," ",e("select",{name:"policy",disabled:p||u||!r,children:[{value:"all",label:"anyone"},{value:"followed",label:"people I follow"},{value:"follower",label:"followers"}].map(c=>e("option",{value:c.value,children:c.label}))})]}),e("div",{class:"shazam-container no-animation",style:{width:"100%"},hidden:!r,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"sub-section",children:e("ul",{children:[{value:"mention",label:"Mentions"},{value:"favourite",label:"Likes"},{value:"reblog",label:"Boosts"},{value:"follow",label:"Follows"},{value:"followRequest",label:"Follow requests"},{value:"poll",label:"Polls"},{value:"update",label:"Post edits"},{value:"status",label:"New posts"}].map(c=>e("li",{children:e("label",{children:[e("input",{type:"checkbox",name:c.value})," ",c.label]})}))})})})}),u&&e("div",{class:"sub-section",children:e("p",{children:["Push permission was not granted since your last login. You'll need to"," ",e(oe,{to:`/login?instance=${n}`,onClick:t,children:[e("b",{children:"log in"})," again to grant push permission"]}),"."]})})]})})}),e("p",{class:"section-postnote",children:e("small",{children:["NOTE: Push notifications only work for ",e("b",{children:"one account"}),"."]})})]})}const Tn=()=>{let t=setTimeout(()=>{if(!document.getElementById("columns")){const s=document.querySelectorAll("#modal-container > *");if(s!=null&&s.length){const f=s[s.length-1],u=f.querySelector('[tabindex="-1"]')||f;if(u){u.focus();return}}if(document.querySelector(".deck-backdrop"))return;const o=document.querySelectorAll(".deck-container"),r=o[o.length-1];r&&r.tabIndex===-1&&r.focus()}},100);return()=>clearTimeout(t)};function ss(t){if(!t)return;const n=Nt(),s=B(n.pathname);W(()=>{s.current&&n.pathname!==s.current&&(t==null||t())},[n.pathname,t])}const os=1e3*60,Uo=24*60*60*1e3,xn=ft(async()=>{const{masto:t}=ee(),n=await t.v1.lists.list();return n.sort((s,i)=>s.title.localeCompare(i.title)),n.length&&setTimeout(()=>{ye.account.set("lists",{lists:n,updatedAt:Date.now()})},1),n},{maxAge:os});async function Yt(){try{const{lists:t,updatedAt:n}=ye.account.get("lists")||{};return t!=null&&t.length?(Date.now()-n>Uo&&xn(),t):await xn()}catch{return[]}}const Oo=ft(t=>{const{masto:n}=ee();return n.v1.lists.$select(t).fetch()},{maxAge:os});async function as(t){const{lists:n}=ye.account.get("lists")||{};if(n!=null&&n.length){const s=n.find(i=>i.id===t);if(s)return s}try{return Oo(t)}catch{return null}}async function Fo(t){const n=await as(t);return(n==null?void 0:n.title)||""}function zo(t){const{lists:n}=ye.account.get("lists")||{};n!=null&&n.length&&(n.push(t),n.sort((s,i)=>s.title.localeCompare(i.title)),ye.account.set("lists",{lists:n,updatedAt:Date.now()}))}function Bo(t){const{lists:n}=ye.account.get("lists")||{};if(n!=null&&n.length){const s=n.findIndex(i=>i.id===t.id);s!==-1&&(n[s]=t,n.sort((i,o)=>i.title.localeCompare(o.title)),ye.account.set("lists",{lists:n,updatedAt:Date.now()}))}}function Ho(t){const{lists:n}=ye.account.get("lists")||{};if(n!=null&&n.length){const s=n.findIndex(i=>i.id===t);s!==-1&&(n.splice(s,1),ye.account.set("lists",{lists:n,updatedAt:Date.now()}))}}function Vn({list:t,onClose:n}){const{masto:s}=ee(),[i,o]=E("default"),r=!!t,f=B(),u=B(),a=B();W(()=>{r&&(f.current.value=t.title,u.current.value=t.repliesPolicy,a.current&&(a.current.checked=t.exclusive))},[r]);const d=Ge("@mastodon/list-exclusive");return e("div",{class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(v,{icon:"x"})})," ",e("header",{children:e("h2",{children:r?"Edit list":"New list"})}),e("main",{children:e("form",{class:"list-form",onSubmit:p=>{p.preventDefault();const c=new FormData(p.target),h=c.get("title"),l=c.get("replies_policy"),b=c.get("exclusive")==="on";o("loading"),(async()=>{try{let m;r?m=await s.v1.lists.$select(t.id).update({title:h,replies_policy:l,exclusive:b}):m=await s.v1.lists.create({title:h,replies_policy:l,exclusive:b}),o("default"),n==null||n({state:"success",list:m}),setTimeout(()=>{r?Bo(m):zo(m)},1)}catch{o("error"),alert(r?"Unable to edit list.":"Unable to create list.")}})()},children:[e("div",{class:"list-form-row",children:e("label",{for:"list-title",children:["Name"," ",e("input",{ref:f,type:"text",id:"list-title",name:"title",required:!0,disabled:i==="loading",dir:"auto"})]})}),e("div",{class:"list-form-row",children:e("select",{ref:u,name:"replies_policy",required:!0,disabled:i==="loading",children:[e("option",{value:"list",children:"Show replies to list members"}),e("option",{value:"followed",children:"Show replies to people I follow"}),e("option",{value:"none",children:"Don't show replies"})]})}),d&&e("div",{class:"list-form-row",children:e("label",{class:"label-block",children:[e("input",{ref:a,type:"checkbox",name:"exclusive",disabled:i==="loading"})," ","Hide posts on this list from Home/Following"]})}),e("div",{class:"list-form-footer",children:[e("button",{type:"submit",disabled:i==="loading",children:r?"Save":"Create"}),r&&e(tt,{disabled:i==="loading",align:"end",menuItemClassName:"danger",confirmLabel:"Delete this list?",onClick:()=>{o("loading"),(async()=>{try{await s.v1.lists.$select(t.id).remove(),o("default"),n==null||n({state:"deleted"}),setTimeout(()=>{Ho(t.id)},1)}catch{o("error"),alert("Unable to delete list.")}})()},children:e("button",{type:"button",class:"light danger",disabled:i==="loading",children:"Delete…"})})]})]})})]})}const qo=[60*5,60*30,60*60,60*60*6,60*60*24,60*60*24*3,60*60*24*7,0],hi={0:"Forever",300:"5 minutes",1800:"30 minutes",3600:"1 hour",21600:"6 hours",86400:"1 day",259200:"3 days",604800:"1 week"},fi=80,rs=1e3*60*10;function Vo(t,n){return n.v1.accounts.familiarFollowers.fetch({id:[t]})}const Go=ft(Vo,{maxAge:rs});async function jo(t,n){const s=n.v1.accounts.$select(t).statuses.list({limit:20}).next(),{value:i}=await s,o={total:i.length,originals:0,replies:0,boosts:0};return i.forEach(r=>{r.reblog?o.boosts++:r.inReplyToId&&r.inReplyToAccountId!==r.account.id?o.replies++:o.originals++}),i.length&&(o.daysSinceLastPost=Math.ceil((Date.now()-new Date(i[i.length-1].createdAt))/864e5)),o}const Yo=ft(jo,{maxAge:rs});function cs({account:t,fetchAccount:n=()=>{},standalone:s,instance:i,authenticated:o}){const{masto:r}=ee({instance:i}),{masto:f,instance:u}=ee(),[a,d]=E("default"),p=typeof t=="string",[c,h]=E(p?null:t),l=ge(()=>i===u,[i,u]);W(()=>{if(!p){h(t);return}d("loading"),(async()=>{try{const C=await n();$.accounts[`${C.id}@${i}`]=C,h(C),d("default")}catch{h(null),d("error")}})()},[p,t,n]);const{acct:b,avatar:m,avatarStatic:S,bot:g,createdAt:y,displayName:I,emojis:w,fields:k,followersCount:T,followingCount:x,group:q,id:N,lastStatusAt:P,locked:J,note:V,statusesCount:A,url:D,username:_,memorial:M,moved:K,roles:ue,hideCollections:ne}=c||{};let le=!1,{header:te,headerStatic:we}=c||{};(!te||/missing\.png$/.test(te))&&m&&!/missing\.png$/.test(m)&&(te=m,le=!0,S&&!/missing\.png$/.test(S)&&(we=S));const de=ge(()=>N===dt(),[N]);W(()=>{const C=!!(c!=null&&c.id&&(c!=null&&c.username)&&(c!=null&&c.acct)&&(c!=null&&c.avatar)&&(c!=null&&c.avatarStatic)&&(c!=null&&c.displayName)&&(c!=null&&c.url));if(de&&i&&C){const O=ye.local.getJSON("accounts");let j=!1;O.forEach(z=>{z.info.id===c.id&&z.instanceURL===i&&(z.info=c,j=!0)}),j&&ye.local.setJSON("accounts",O)}},[de,c,i]);const ae=ge(()=>D?Ut.toUnicode(URL.parse(D).hostname):null,[D]),[fe,Re]=E([]),Se=B(),Ae=B([]);async function Oe(C){var Z;(C||!Se.current)&&(Se.current=r.v1.accounts.$select(N).followers.list({limit:fi}));const O=await Se.current.next();if(de||!l)return O;const{value:j}=O;let z=[];if(C){let be=[];try{be=await r.v1.accounts.familiarFollowers.fetch({id:[N]})}catch{}Ae.current=((Z=be==null?void 0:be[0])==null?void 0:Z.accounts)||[],z=[...Ae.current,...j.filter(he=>!Ae.current.some(se=>se.id===he.id))]}else j!=null&&j.length&&(z=j.filter(be=>!Ae.current.some(he=>he.id===be.id)));return{...O,value:z}}const xe=B();async function Ie(C){return(C||!xe.current)&&(xe.current=r.v1.accounts.$select(N).following.list({limit:fi})),await xe.current.next()}const Ce=s?"div":oe,ve=i?`/${i}/a/${N}`:`/a/${N}`,[Q,me]=E([]),[F,re]=E(),[U,G]=E("default"),R=!!(F!=null&&F.total),H=async C=>{try{const O=await Go(C,f);me(O[0].accounts.slice(0,Wo))}catch{}},X=async()=>{if(N){G("loading");try{const C=await Yo(N,r);re(C),G("default")}catch{G("error")}}},ce=et(({relationship:C,currentID:O})=>{C.following||(H(O),!s&&A>0&&X())},[s,N,A]),Pe=et(C=>{C.id===N&&(h(C),$.accounts[`${C.id}@${i}`]=C)},[N,i]);return e("div",{tabIndex:"-1",class:`account-container ${a==="loading"?"skeleton":""}`,style:{"--header-color-1":fe[0],"--header-color-2":fe[1],"--header-color-3":fe[2],"--header-color-4":fe[3]},children:[a==="error"&&e("div",{class:"ui-state",children:[e("p",{children:"Unable to load account."}),e("p",{children:e("a",{href:p?t:D,target:"_blank",rel:"noopener noreferrer",children:["Go to account page ",e(v,{icon:"external"})]})})]}),a==="loading"?e(L,{children:[e("header",{children:e(Qe,{avatarSize:"xxxl",skeleton:!0})}),e("main",{children:[e("div",{class:"note",children:[e("p",{children:"███████ ████ ████"}),e("p",{children:"████ ████████ ██████ █████████ ████ ██"})]}),e("div",{class:"account-metadata-box",children:[e("div",{class:"profile-metadata",children:[e("div",{class:"profile-field",children:[e("b",{class:"more-insignificant",children:"███"}),e("p",{children:"██████"})]}),e("div",{class:"profile-field",children:[e("b",{class:"more-insignificant",children:"████"}),e("p",{children:"███████████"})]})]}),e("div",{class:"stats",children:[e("div",{children:[e("span",{children:"██"})," Followers"]}),e("div",{children:[e("span",{children:"██"})," Following"]}),e("div",{children:[e("span",{children:"██"})," Posts"]})]})]}),e("div",{class:"actions",children:[e("span",{}),e("span",{class:"buttons",children:e("button",{type:"button",title:"More",class:"plain",disabled:!0,children:e(v,{icon:"more",size:"l",alt:"More"})})})]})]})]}):c&&e(L,{children:[!!K&&e("div",{class:"account-moved",children:[e("p",{children:[e("b",{children:I})," has indicated that their new account is now:"]}),e(Qe,{account:K,instance:i,onClick:C=>{C.stopPropagation(),$.showAccount=K}})]}),!!te&&!/missing\.png$/.test(te)&&e("img",{src:te,alt:"",class:`header-banner ${le?"header-is-avatar":""}`,onError:C=>{C.target.crossOrigin?C.target.src!==we?C.target.src=we:(C.target.removeAttribute("crossorigin"),C.target.src=te):C.target.src!==we?C.target.src=we:C.target.remove()},crossOrigin:"anonymous",onLoad:C=>{C.target.classList.add("loaded");try{const O=window.OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"),j=O.getContext("2d",{willReadFrequently:!0});O.width=C.target.width,O.height=C.target.height,j.imageSmoothingEnabled=!1,j.drawImage(C.target,0,0);const z=10,be=[j.getImageData(0,0,z,z).data,j.getImageData(C.target.width-z,0,z,z).data,j.getImageData(0,C.target.height-z,z,z).data,j.getImageData(C.target.width-z,C.target.height-z,z,z).data].map(he=>{let se=0,Te=0,Ne=0,Fe=0;for(let Ve=0;Ve{const[se,Te,Ne,Fe]=Xo(he);return`rgba(${se}, ${Te}, ${Ne}, ${Fe})`});Re(be)}catch{}}}),e("header",{children:s?e(Ze,{shift:window.matchMedia("(min-width: calc(40em))").matches?114:64,menuButton:e("div",{children:e(Qe,{account:c,instance:i,avatarSize:"xxxl",onClick:()=>{}})}),children:[e("div",{class:"szh-menu__header",children:e(ia,{acct:b,instance:i})}),e(pe,{onClick:()=>{const C=`@${b}`;try{navigator.clipboard.writeText(C),ie("Handle copied")}catch{ie("Unable to copy handle")}},children:[e(v,{icon:"link"}),e("span",{children:"Copy handle"})]}),e(pe,{href:D,target:"_blank",children:[e(v,{icon:"external"}),e("span",{children:"Go to original profile page"})]}),e(ze,{}),e(_e,{href:c.avatar,target:"_blank",children:[e(v,{icon:"user"}),e("span",{children:"View profile image"})]}),e(_e,{href:c.header,target:"_blank",children:[e(v,{icon:"media"}),e("span",{children:"View profile header"})]})]}):e(Qe,{account:c,instance:i,avatarSize:"xxxl",internal:!0})}),e("div",{class:"faux-header-bg","aria-hidden":"true"}),e("main",{children:[!!M&&e("span",{class:"tag",children:"In Memoriam"}),!!g&&e("span",{class:"tag",children:[e(v,{icon:"bot"})," Automated"]}),!!q&&e("span",{class:"tag",children:[e(v,{icon:"group"})," Group"]}),ue==null?void 0:ue.map(C=>e("span",{class:"tag",children:[C.name,!!ae&&e(L,{children:[" ",e("span",{class:"more-insignificant",children:ae})]})]})),e("div",{class:"note",dir:"auto",onClick:Hi({instance:u}),dangerouslySetInnerHTML:{__html:Sn(V,{emojis:w})}}),e("div",{class:"account-metadata-box",children:[(k==null?void 0:k.length)>0&&e("div",{class:"profile-metadata",children:k.map(({name:C,value:O,verifiedAt:j},z)=>e("div",{class:`profile-field ${j?"profile-verified":""}`,dir:"auto",children:[e("b",{children:[e(qi,{text:C,emojis:w})," ",!!j&&e(v,{icon:"check-circle",size:"s"})]}),e("p",{dangerouslySetInnerHTML:{__html:Sn(O,{emojis:w})}})]},C+z))}),e("div",{class:"stats",children:[e(Ce,{tabIndex:0,to:ve,onClick:()=>{setTimeout(()=>{$.showGenericAccounts={id:"followers",heading:"Followers",fetchAccounts:Oe,instance:i,excludeRelationshipAttrs:de?["followedBy"]:[],blankCopy:ne?"This user has chosen to not make this information available.":void 0}},0)},children:[!!Q.length&&e("span",{class:"shazam-container-horizontal",children:e("span",{class:"shazam-container-inner stats-avatars-bunch",children:Q.map(C=>e(st,{url:C.avatarStatic,size:"s",alt:`${C.displayName} @${C.acct}`,squircle:C==null?void 0:C.bot}))})}),e("span",{title:T,children:je(T)})," ","Followers"]}),e(Ce,{class:"insignificant",tabIndex:0,to:ve,onClick:()=>{setTimeout(()=>{$.showGenericAccounts={heading:"Following",fetchAccounts:Ie,instance:i,excludeRelationshipAttrs:de?["following"]:[],blankCopy:ne?"This user has chosen to not make this information available.":void 0}},0)},children:[e("span",{title:x,children:je(x)})," ","Following",e("br",{})]}),e(Ce,{class:"insignificant",to:ve,children:[e("span",{title:A,children:je(A)})," ","Posts"]}),!!y&&e("div",{class:"insignificant",children:["Joined"," ",e("time",{datetime:y,children:rt(y,{hideTime:!0})})]})]})]}),!!F&&e(Ce,{to:ve,class:"account-metadata-box",children:e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:R?e("div",{class:"posting-stats",title:`${Math.round(F.originals/F.total*100)}% original posts, ${Math.round(F.replies/F.total*100)}% replies, ${Math.round(F.boosts/F.total*100)}% boosts`,children:[e("div",{children:F.daysSinceLastPost<365?`Last ${F.total} post${F.total>1?"s":""} in the past ${F.daysSinceLastPost} day${F.daysSinceLastPost>1?"s":""}`:` Last ${F.total} posts in the past year(s) `}),e("div",{class:"posting-stats-bar",style:{"--originals-percentage":`${F.originals/F.total*100}%`,"--replies-percentage":`${(F.originals+F.replies)/F.total*100}%`}}),e("div",{class:"posting-stats-legends",children:[e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-legend-item-originals"})," ","Original"]})," ",e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-legend-item-replies"})," ","Replies"]})," ",e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-legend-item-boosts"})," ","Boosts"]})]})]}):e("div",{class:"posting-stats",children:"Post stats unavailable."})})})}),!K&&e("div",{class:"account-metadata-box",children:e("div",{class:"shazam-container no-animation",hidden:!!F,children:e("div",{class:"shazam-container-inner",children:e("button",{type:"button",class:"posting-stats-button",disabled:U==="loading",onClick:()=>{X()},children:[e("div",{class:`posting-stats-bar posting-stats-icon ${U==="loading"?"loading":""}`,style:{"--originals-percentage":"33%","--replies-percentage":"66%"}}),"View post stats"," "]})})})})]}),e("footer",{children:e(Ko,{info:c,instance:i,standalone:s,authenticated:o,onRelationshipChange:ce,onProfileUpdate:Pe})})]})]})}const Wo=3;function Ko({info:t,instance:n,standalone:s,authenticated:i,onRelationshipChange:o=()=>{},onProfileUpdate:r=()=>{}}){var me;if(!t)return null;const{masto:f,instance:u,authenticated:a}=ee(),d=n===u,[p,c]=E("default"),[h,l]=E(null),{id:b,acct:m,url:S,username:g,locked:y,lastStatusAt:I,note:w,fields:k,moved:T}=t,x=B(b),{following:q,showingReblogs:N,notifying:P,followedBy:J,blocking:V,blockedBy:A,muting:D,mutingNotifications:_,requested:M,domainBlocking:K,endorsed:ue,note:ne}=h||{},[le,te]=E(null),[we,de]=E(!1);W(()=>{if(t){const F=dt();let re;(async()=>{if(d&&i)re=b;else if(!d&&a){const G=t.acct.includes("@");try{const R=await f.v2.search.fetch({q:G?t.acct:`${t.username}@${n}`,type:"accounts",limit:1,resolve:!0});R.accounts.length&&(re=R.accounts[0].id,te(R.accounts[0]))}catch{}}if(!re)return;if(F===re){de(!0);return}x.current=re,c("loading");const U=f.v1.accounts.relationships.fetch({id:[re]});try{const G=await U;if(c("default"),G.length){const R=G[0];l(R),o({relationship:R,currentID:re})}}catch{c("error")}})()}},[t,i]),W(()=>{t&&we&&As(t)},[t,we]);const ae=p==="loading",[fe,Re]=E(!1),[Se,Ae]=E(!1),[Oe,xe]=E(!1),[Ie,Ce]=E(!1),[ve,Q]=E([]);return e(L,{children:[e("div",{class:"actions",children:[e("span",{children:[J?e("span",{class:"tag",children:"Follows you"}):I?e("small",{class:"insignificant",children:["Last post:"," ",e("span",{class:"ib",children:rt(I,{hideTime:!0})})]}):e("span",{}),D&&e("span",{class:"tag danger",children:"Muted"}),V&&e("span",{class:"tag danger",children:"Blocked"})]})," ",e("span",{class:"buttons",children:[!!ne&&e("button",{type:"button",class:"private-note-tag",title:"Private note",onClick:()=>{xe(!0)},dir:"auto",children:e("span",{children:ne})}),e(Ze,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:e("button",{type:"button",title:"More",class:"plain",disabled:ae,children:e(v,{icon:"more",size:"l",alt:"More"})}),onMenuChange:F=>{q&&F.open&&(async()=>{try{const re=await f.v1.accounts.$select(x.current).lists.list();Q(re)}catch{}})()},children:[a&&!we&&e(L,{children:[e(pe,{onClick:()=>{qs({draftStatus:{status:`@${(le==null?void 0:le.acct)||m} `}})},children:[e(v,{icon:"at"}),e("span",{children:["Mention @",g]})]}),e(pe,{onClick:()=>{Re(!0)},children:[e(v,{icon:"translate"}),e("span",{children:"Translate bio"})]}),Ge("@mastodon/profile-private-note")&&e(pe,{onClick:()=>{xe(!0)},children:[e(v,{icon:"pencil"}),e("span",{children:ne?"Edit private note":"Add private note"})]}),q&&!!h&&e(L,{children:[e(pe,{onClick:()=>{c("loading"),(async()=>{try{const F=await f.v1.accounts.$select(x.current).follow({notify:!P});F&&l(F),c("default"),ie(F.notifying?`Notifications enabled for @${g}'s posts.`:` Notifications disabled for @${g}'s posts.`)}catch(F){alert(F),c("error")}})()},children:[e(v,{icon:"notification"}),e("span",{children:P?"Disable notifications":"Enable notifications"})]}),e(pe,{onClick:()=>{c("loading"),(async()=>{try{const F=await f.v1.accounts.$select(x.current).follow({reblogs:!N});F&&l(F),c("default"),ie(F.showingReblogs?`Boosts from @${g} disabled.`:`Boosts from @${g} enabled.`)}catch(F){alert(F),c("error")}})()},children:[e(v,{icon:"rocket"}),e("span",{children:N?"Disable boosts":"Enable boosts"})]})]}),q&&e(pe,{onClick:()=>{Ae(!0)},children:[e(v,{icon:"list"}),ve.length?e(L,{children:[e("small",{class:"menu-grow",children:["Add/Remove from Lists",e("br",{}),e("span",{class:"more-insignificant",children:ve.map(F=>F.title).join(", ")})]}),e("small",{class:"more-insignificant",children:ve.length})]}):e("span",{children:"Add/Remove from Lists"})]}),e(ze,{})]}),e(pe,{onClick:()=>{const F=`@${(le==null?void 0:le.acct)||m}`;try{navigator.clipboard.writeText(F),ie("Handle copied")}catch{ie("Unable to copy handle")}},children:[e(v,{icon:"copy"}),e("small",{children:["Copy handle",e("br",{}),e("span",{class:"more-insignificant",children:["@",(le==null?void 0:le.acct)||m]})]})]}),e(pe,{href:S,target:"_blank",children:[e(v,{icon:"external"}),e("small",{class:"menu-double-lines",children:Zo(S)})]}),e("div",{class:"menu-horizontal",children:[e(pe,{onClick:()=>{try{navigator.clipboard.writeText(S),ie("Link copied")}catch{ie("Unable to copy link")}},children:[e(v,{icon:"link"}),e("span",{children:"Copy"})]}),(navigator==null?void 0:navigator.share)&&((me=navigator==null?void 0:navigator.canShare)==null?void 0:me.call(navigator,{url:S}))&&e(pe,{onClick:()=>{try{navigator.share({url:S})}catch{alert("Sharing doesn't seem to work.")}},children:[e(v,{icon:"share"}),e("span",{children:"Share…"})]})]}),!!h&&e(L,{children:[e(ze,{}),D?e(pe,{onClick:()=>{c("loading"),(async()=>{try{const F=await f.v1.accounts.$select((le==null?void 0:le.id)||b).unmute();l(F),c("default"),ie(`Unmuted @${g}`),$.reloadGenericAccounts.id="mute",$.reloadGenericAccounts.counter++}catch{c("error")}})()},children:[e(v,{icon:"unmute"}),e("span",{children:["Unmute @",g]})]}):e(cn,{menuClassName:"menu-blur",openTrigger:"clickOnly",direction:"bottom",overflow:"auto",shift:16,label:e(L,{children:[e(v,{icon:"mute"}),e("span",{class:"menu-grow",children:["Mute @",g,"…"]}),e("span",{style:{textOverflow:"clip"},children:[e(v,{icon:"time"}),e(v,{icon:"chevron-right"})]})]}),children:e("div",{class:"menu-wrap",children:qo.map(F=>e(pe,{onClick:()=>{c("loading"),(async()=>{try{const re=await f.v1.accounts.$select((le==null?void 0:le.id)||b).mute({duration:F});l(re),c("default"),ie(`Muted @${g} for ${hi[F]}`),$.reloadGenericAccounts.id="mute",$.reloadGenericAccounts.counter++}catch{c("error"),ie(`Unable to mute @${g}`)}})()},children:hi[F]}))})}),J&&e(tt,{subMenu:!0,menuItemClassName:"danger",confirmLabel:e(L,{children:[e(v,{icon:"user-x"}),e("span",{children:["Remove @",g," from followers?"]})]}),onClick:()=>{c("loading"),(async()=>{try{const F=await f.v1.accounts.$select((le==null?void 0:le.id)||b).removeFromFollowers();l(F),c("default"),ie(`@${g} removed from followers`),$.reloadGenericAccounts.id="followers",$.reloadGenericAccounts.counter++}catch{c("error")}})()},children:[e(v,{icon:"user-x"}),e("span",{children:"Remove follower…"})]}),e(tt,{subMenu:!0,confirm:!V,confirmLabel:e(L,{children:[e(v,{icon:"block"}),e("span",{children:["Block @",g,"?"]})]}),menuItemClassName:"danger",onClick:()=>{c("loading"),(async()=>{try{if(V){const F=await f.v1.accounts.$select((le==null?void 0:le.id)||b).unblock();l(F),c("default"),ie(`Unblocked @${g}`)}else{const F=await f.v1.accounts.$select((le==null?void 0:le.id)||b).block();l(F),c("default"),ie(`Blocked @${g}`)}$.reloadGenericAccounts.id="block",$.reloadGenericAccounts.counter++}catch{c("error"),V?ie(`Unable to unblock @${g}`):ie(`Unable to block @${g}`)}})()},children:V?e(L,{children:[e(v,{icon:"unblock"}),e("span",{children:["Unblock @",g]})]}):e(L,{children:[e(v,{icon:"block"}),e("span",{children:["Block @",g,"…"]})]})}),e(pe,{className:"danger",onClick:()=>{$.showReportModal={account:le||t}},children:[e(v,{icon:"flag"}),e("span",{children:["Report @",g,"…"]})]})]}),a&&we&&s&&Ge("@mastodon/profile-edit")&&e(L,{children:[e(ze,{}),e(pe,{onClick:()=>{Ce(!0)},children:[e(v,{icon:"pencil"}),e("span",{children:"Edit profile"})]})]}),!1]}),!h&&p==="loading"&&e($e,{abrupt:!0}),!!h&&!T&&e(tt,{confirm:q||M,confirmLabel:e("span",{children:M?"Withdraw follow request?":`Unfollow @${t.acct||t.username}?`}),menuItemClassName:"danger",align:"end",disabled:ae,onClick:()=>{c("loading"),(async()=>{try{let F;q||M?F=await f.v1.accounts.$select(x.current).unfollow():F=await f.v1.accounts.$select(x.current).follow(),F&&l(F),c("default")}catch(F){alert(F),c("error")}})()},children:e("button",{type:"button",class:`${q||M?"light swap":""}`,"data-swap-state":q||M?"danger":"",disabled:ae,children:q?e(L,{children:[e("span",{children:"Following"}),e("span",{children:"Unfollow…"})]}):M?e(L,{children:[e("span",{children:"Requested"}),e("span",{children:"Withdraw…"})]}):y?e(L,{children:[e(v,{icon:"lock"})," ",e("span",{children:"Follow"})]}):"Follow"})})]})]}),!!fe&&e(Ee,{onClose:()=>{Re(!1)},children:e(Jo,{note:w,fields:k,onClose:()=>Re(!1)})}),!!Se&&e(Ee,{onClose:()=>{Ae(!1)},children:e(Qo,{accountID:x.current,onClose:()=>Ae(!1)})}),!!Oe&&e(Ee,{onClose:()=>{xe(!1)},children:e(ea,{account:t,note:ne,onRelationshipChange:F=>{l(F)},onClose:()=>xe(!1)})}),!!Ie&&e(Ee,{onClose:()=>{Ce(!1)},children:e(ta,{onClose:({state:F,account:re}={})=>{Ce(!1),F==="success"&&re&&r(re)}})})]})}function Xo([t,n,s]){const i=.2126*t+.7152*n+.0722*s;let o;return i>=220?o=1:i<=50?o=.1:o=i/255,o=Math.min(1,o),[t,n,s,o]}function Zo(t){if(!t)return;const n=URL.parse(t),{host:s,pathname:i}=n,o=i.replace(/\/$/,"").replace(/^\//,"");return e(L,{children:[e("span",{class:"more-insignificant",children:[Ut.toUnicode(s),"/"]}),e("wbr",{}),e("span",{children:o})]})}function Jo({note:t,fields:n,onClose:s}){const i=(n==null?void 0:n.map(({name:r,value:f})=>`${r} ${ni(f)}`).join(` `))||"",o=ni(t)+(i?` ${i}`:"");return e("div",{class:"sheet",children:[!!s&&e("button",{type:"button",class:"sheet-close",onClick:s,children:e(v,{icon:"x"})}),e("header",{children:e("h2",{children:"Translated Bio"})}),e("main",{children:[e("p",{style:{whiteSpace:"pre-wrap"},children:o}),e(Vi,{forceTranslate:!0,text:o})]})]})}function Qo({accountID:t,onClose:n}){const{masto:s}=ee(),[i,o]=E("default"),[r,f]=E([]),[u,a]=E([]),[d,p]=kt(l=>l+1,0);W(()=>{o("loading"),(async()=>{try{const l=await Yt();f(l);const b=await s.v1.accounts.$select(t).lists.list();a(b),o("default")}catch{o("error")}})()},[d]);const[c,h]=E(!1);return e("div",{class:"sheet",id:"list-add-remove-container",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(v,{icon:"x"})}),e("header",{children:e("h2",{children:"Add/Remove from Lists"})}),e("main",{children:[r.length>0?e("ul",{class:"list-add-remove",children:r.map(l=>{const b=u.some(m=>m.id===l.id);return e("li",{children:e("button",{type:"button",class:`light ${b?"checked":""}`,disabled:i==="loading",onClick:()=>{o("loading"),(async()=>{try{b?await s.v1.lists.$select(l.id).accounts.remove({accountIds:[t]}):await s.v1.lists.$select(l.id).accounts.create({accountIds:[t]}),p()}catch{o("error"),alert(b?"Unable to remove from list.":"Unable to add to list.")}})()},children:[e(v,{icon:"check-circle"}),e("span",{children:l.title})]})})})}):i==="loading"?e("p",{class:"ui-state",children:e($e,{abrupt:!0})}):i==="error"?e("p",{class:"ui-state",children:"Unable to load lists."}):e("p",{class:"ui-state",children:"No lists."}),e("button",{type:"button",class:"plain2",onClick:()=>h(!0),disabled:i!=="default",children:[e(v,{icon:"plus",size:"l"})," ",e("span",{children:"New list"})]})]}),c&&e(Ee,{onClick:l=>{l.target===l.currentTarget&&h(!1)},children:e(Vn,{list:c==null?void 0:c.list,onClose:l=>{l.state==="success"&&p(),h(!1)}})})]})}function ea({account:t,note:n,onRelationshipChange:s=()=>{},onClose:i=()=>{}}){const{masto:o}=ee(),[r,f]=E("default"),u=B(null);return W(()=>{let a;return u.current&&!n&&(a=setTimeout(()=>{var d,p;(p=(d=u.current).focus)==null||p.call(d)},100)),()=>{clearTimeout(a)}},[]),e("div",{class:"sheet",id:"private-note-container",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(v,{icon:"x"})}),e("header",{children:e("b",{children:["Private note about @",(t==null?void 0:t.username)||(t==null?void 0:t.acct)]})}),e("main",{children:e("form",{onSubmit:a=>{a.preventDefault();const p=new FormData(a.target).get("note");(p==null?void 0:p.trim())!==(n==null?void 0:n.trim())&&(f("loading"),(async()=>{try{const c=await o.v1.accounts.$select(t==null?void 0:t.id).note.create({comment:p});f("default"),s(c),i()}catch(c){f("error"),alert((c==null?void 0:c.message)||"Unable to update private note.")}})())},children:[e("textarea",{ref:u,name:"note",disabled:r==="loading",children:n}),e("footer",{children:[e("button",{type:"button",class:"light",disabled:r==="loading",onClick:()=>{i==null||i()},children:"Cancel"}),e("span",{children:[e($e,{abrupt:!0,hidden:r!=="loading"}),e("button",{disabled:r==="loading",type:"submit",children:"Save & close"})]})]})]})})]})}function ta({onClose:t=()=>{}}){const{masto:n}=ee(),[s,i]=E("loading"),[o,r]=E(null);W(()=>{(async()=>{try{const c=await n.v1.accounts.verifyCredentials();r(c),i("default")}catch{i("error")}})()},[]);const{displayName:f,source:u}=o||{},{note:a,fields:d}=u||{},p=B(null);return e("div",{class:"sheet",id:"edit-profile-container",children:[!!t&&e("button",{type:"button",class:"sheet-close",onClick:t,children:e(v,{icon:"x"})}),e("header",{children:e("b",{children:"Edit profile"})}),e("main",{children:s==="loading"?e("p",{class:"ui-state",children:e($e,{abrupt:!0})}):e("form",{onSubmit:c=>{c.preventDefault();const h=new FormData(c.target),l=h.get("display_name"),b=h.get("note"),m=p.current.querySelectorAll('input[name^="fields_attributes"]'),S=[];m.forEach(g=>{const y=g.name,[I,w,k]=y.match(/fields_attributes\[(\d+)\]\[(.+)\]/)||[],T=g.value?g.value.trim():"";w&&k&&T&&(S[w]||(S[w]={}),S[w][k]=T)}),S.forEach(g=>{g.name&&!g.value&&(g.value="")}),(async()=>{try{const g=await n.v1.accounts.updateCredentials({displayName:l,note:b,fieldsAttributes:S});t==null||t({state:"success",account:g})}catch(g){alert((g==null?void 0:g.message)||"Unable to update profile.")}})()},children:[e("p",{children:e("label",{children:["Name"," ",e("input",{type:"text",name:"display_name",defaultValue:f,maxLength:30,disabled:s==="loading"})]})}),e("p",{children:e("label",{children:["Bio",e("textarea",{defaultValue:a,name:"note",maxLength:500,rows:"5",disabled:s==="loading"})]})}),e("p",{children:"Extra fields"}),e("table",{ref:p,children:[e("thead",{children:e("tr",{children:[e("th",{children:"Label"}),e("th",{children:"Content"})]})}),e("tbody",{children:Array.from({length:Math.max(4,d.length)}).map((c,h)=>{const{name:l="",value:b=""}=d[h]||{};return e(na,{name:l,value:b,index:h,disabled:s==="loading"},h)})})]}),e("footer",{children:[e("button",{type:"button",class:"light",disabled:s==="loading",onClick:()=>{t==null||t()},children:"Cancel"}),e("button",{type:"submit",disabled:s==="loading",children:"Save"})]})]})})]})}function na({name:t,value:n,disabled:s,index:i}){const[o,r]=E(!!n);return e("tr",{children:[e("td",{children:e("input",{type:"text",name:`fields_attributes[${i}][name]`,defaultValue:t,disabled:s,maxLength:255,required:o})}),e("td",{children:e("input",{type:"text",name:`fields_attributes[${i}][value]`,defaultValue:n,disabled:s,maxLength:255,onChange:f=>r(!!f.currentTarget.value)})})]})}function ia({acct:t,instance:n}){let[s,i]=t.split("@");return i||(i=n),e("div",{class:"handle-info",children:[e("span",{class:"handle-handle",children:[e("b",{class:"handle-username",children:s}),e("span",{class:"handle-at",children:"@"}),e("b",{class:"handle-server",children:i})]}),e("div",{class:"handle-legend",children:[e("span",{class:"ib",children:[e("span",{class:"handle-legend-icon username"})," username"]})," ",e("span",{class:"ib",children:[e("span",{class:"handle-legend-icon server"})," server domain name"]})]})]})}function sa({account:t,instance:n,onClose:s}){const{masto:i,instance:o,authenticated:r}=ee({instance:n}),f=typeof t=="string";return W(()=>{f||($.accounts[`${t.id}@${o}`]=t)},[t]),ss(s),e("div",{class:"sheet",children:[!!s&&e("button",{type:"button",class:"sheet-close outer",onClick:s,children:e(v,{icon:"x"})}),e(cs,{instance:o,authenticated:r,account:t,fetchAccount:async()=>{if(f)try{return await i.v1.accounts.lookup({acct:t,skip_webfinger:!1})}catch{const a=await i.v2.search.fetch({q:t,type:"accounts",limit:1,resolve:r});if(a.accounts.length)return a.accounts[0];if(/https?:\/\/[^/]+\/@/.test(t)){const d=URL.parse(t),{hostname:p,pathname:c}=d,h=c.replace(/^\//,"").replace(/\/$/,"")+"@"+p,l=await i.v2.search.fetch({q:h,type:"accounts",limit:1,resolve:r});if(l.accounts.length)return l.accounts[0]}}else return t}})]})}function oa({onClose:t}){const{masto:n}=ee(),[s,i]=E("default"),[o,r]=E([]),[f,u]=kt(d=>d+1,0);W(()=>{i("loading"),(async()=>{try{const d=await it.drafts.keys();if(d.length){const p=rn(),c=d.filter(h=>h.startsWith(p));if(c.length){const h=await it.drafts.getMany(c);h.sort((l,b)=>new Date(b.updatedAt).getTime()-new Date(l.updatedAt).getTime()),r(h)}else r([])}else r([]);i("default")}catch{i("error")}})()},[f]);const a=(o==null?void 0:o.length)>0;return e("div",{class:"sheet",children:[!!t&&e("button",{type:"button",class:"sheet-close",onClick:t,children:e(v,{icon:"x"})}),e("header",{children:[e("h2",{children:["Unsent drafts ",e($e,{abrupt:!0,hidden:s!=="loading"})]}),a&&e("div",{class:"insignificant",children:"Looks like you have unsent drafts. Let's continue where you left off."})]}),e("main",{children:a?e(L,{children:[e("ul",{class:"drafts-list",children:o.map(d=>{const{updatedAt:p,key:c,draftStatus:h,replyTo:l}=d,b=new Date(p);return e("li",{children:[e("div",{class:"mini-draft-meta",children:[e("b",{children:[e(v,{icon:l?"reply":"quill",size:"s"})," ",e("time",{children:[!!l&&e(L,{children:["@",l.account.acct,e("br",{})]}),rt(b)]})]}),e(tt,{confirmLabel:e("span",{children:"Delete this draft?"}),menuItemClassName:"danger",align:"end",disabled:s==="loading",onClick:()=>{(async()=>{try{await it.drafts.del(c),u()}catch{alert("Error deleting draft! Please try again.")}})()},children:e("button",{type:"button",class:"small light",disabled:s==="loading",children:"Delete…"})})]}),e("button",{type:"button",disabled:s==="loading",class:"draft-item",onClick:async()=>{let m;if(l){i("loading");try{m=await n.v1.statuses.$select(l.id).fetch()}catch{alert("Error fetching reply-to status!"),i("default");return}i("default")}window.__COMPOSE__={draftStatus:h,replyToStatus:m},$.showCompose=!0,$.showDrafts=!1},children:e(aa,{draft:d})})]},p)})}),o.length>1&&e("p",{children:e(tt,{confirmLabel:e("span",{children:"Delete all drafts?"}),menuItemClassName:"danger",disabled:s==="loading",onClick:()=>{(async()=>{i("loading");try{await it.drafts.delMany(o.map(d=>d.key)),i("default"),u()}catch{alert("Error deleting drafts! Please try again."),i("error")}})()},children:e("button",{type:"button",class:"light danger",disabled:s==="loading",children:"Delete all…"})})})]}):e("p",{children:"No drafts found."})})]})}function aa({draft:t}){var c;const{draftStatus:n,replyTo:s}=t,{status:i,spoilerText:o,poll:r,mediaAttachments:f}=n,u=((c=r==null?void 0:r.options)==null?void 0:c.length)>0,a=(f==null?void 0:f.length)>0,d=u||a,p=ge(()=>{if(!a)return;const h=f.find(m=>/image/.test(m.type));if(!h)return;const{file:l}=h;return URL.createObjectURL(l)},[a,f]);return e(L,{children:e("div",{class:"mini-draft",children:[d&&e("div",{class:`mini-draft-aside ${p?"has-image":""}`,style:p?{"--bg-image":`url(${p})`}:{},children:[u&&e(v,{icon:"poll"}),a&&e("span",{children:[e(v,{icon:"attachment"})," ",e("small",{children:f==null?void 0:f.length})]})]}),e("div",{class:"mini-draft-main",children:[!!o&&e("div",{class:"mini-draft-spoiler",children:o}),!!i&&e("div",{class:"mini-draft-status",children:i})]})]})})}function ra({html:t,url:n,width:s,height:i,onClose:o=()=>{}}){return e("div",{class:"embed-modal-container",children:[e("div",{class:"top-controls",children:[e("button",{type:"button",class:"light",onClick:()=>o(),children:e(v,{icon:"x"})}),n&&e("a",{href:n,target:"_blank",rel:"noopener noreferrer",class:"button plain",children:[e("span",{children:"Open link"})," ",e(v,{icon:"external"})]})]}),e("div",{class:"embed-content",dangerouslySetInnerHTML:{__html:t},style:{"--width":s+"px","--height":i+"px","--aspect-ratio":`${s}/${i}`}})]})}function ca({instance:t,excludeRelationshipAttrs:n=[],postID:s,onClose:i=()=>{},blankCopy:o="Nothing to show"}){const{masto:r,instance:f}=ee(),u=t?t===f:!0,a=De($),[d,p]=E("default"),[c,h]=E([]),[l,b]=E(!1);if(ss(i),!a.showGenericAccounts)return null;const{id:m,heading:S,fetchAccounts:g,accounts:y,showReactions:I}=a.showGenericAccounts,[w,k]=E({}),T=async P=>{if(!(P!=null&&P.length)||!u)return;const J=await Dn(P,w);J&&k({...w,...J})},x=P=>{g&&(P&&h([]),p("loading"),(async()=>{try{const{done:J,value:V}=await g(P);if(Array.isArray(V)){if(P){const A=[];for(let D=0;DK.id===_.id&&D!==ue);M?M._types.push(..._._types):A.push({_types:[],..._})}h(A)}else h(A=>{const D=A;for(const _ of V){const M=D.find(K=>K.id===_.id);M?M._types.push(..._._types):D.push(_)}return D});b(!J),T(V)}else b(!1);p("default")}catch{p("error")}})())},q=B(!0);W(()=>{(y==null?void 0:y.length)>0?(h(y),T(y)):(x(!0),q.current=!1)},[y,g]),W(()=>{var P;q.current||((P=a.reloadGenericAccounts)==null?void 0:P.id)===m&&x(!0)},[a.reloadGenericAccounts.counter]);const N=$.statuses[s];return e("div",{id:"generic-accounts-container",class:"sheet",tabindex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:i,children:e(v,{icon:"x"})}),e("header",{children:e("h2",{children:S||"Accounts"})}),e("main",{children:[N&&e(oe,{to:`/${t||f}/s/${N.id}`,class:"post-preview",children:e(Be,{status:N,size:"s",readOnly:!0})}),c.length>0?e(L,{children:[e("ul",{class:"accounts-list",children:c.map(P=>{var A,D;const J=w[P.id],V=`${P.id}-${((A=P._types)==null?void 0:A.length)||""}`;return e("li",{children:[I&&((D=P._types)==null?void 0:D.length)>0&&e("div",{class:"reactions-block",children:P._types.map(_=>e(v,{icon:{reblog:"rocket",favourite:"heart"}[_],class:`${_}-icon`}))}),e("div",{class:"account-relationships",children:e(Qe,{account:P,showStats:!0,relationship:J,excludeRelationshipAttrs:n})})]},V)})}),d==="default"?l?e(ht,{onChange:P=>{P&&x()},children:e("button",{type:"button",class:"plain block",onClick:()=>x(),children:"Show more…"})}):e("p",{class:"ui-state insignificant",children:"The end."}):d==="loading"&&e("p",{class:"ui-state",children:e($e,{abrupt:!0})})]}):d==="loading"?e("p",{class:"ui-state",children:e($e,{abrupt:!0})}):d==="error"?e("p",{class:"ui-state",children:"Error loading accounts"}):e("p",{class:"ui-state insignificant",children:o})]})]})}function la({alt:t,lang:n,onClose:s}){const i=De($),[o,r]=E(!1),f=Bi(!0),u=i.settings.contentTranslationHideLanguages||[],a=!!n&&n!==f&&!ii([n],[f])&&!u.find(d=>n===d||ii([n],[d]));return e("div",{class:"sheet",tabindex:"-1",children:[!!s&&e("button",{type:"button",class:"sheet-close outer",onClick:s,children:e(v,{icon:"x"})}),e("header",{class:"header-grid",children:[e("h2",{children:"Media description"}),e("div",{class:"header-side",children:e(Ze,{align:"end",menuButton:e("button",{type:"button",class:"plain4",children:e(v,{icon:"more",alt:"More",size:"xl"})}),children:[e(pe,{disabled:o,onClick:()=>{r(!0)},children:[e(v,{icon:"translate"}),e("span",{children:"Translate"})]}),Vs&&e(pe,{onClick:()=>{Gs(t,n)},children:[e(v,{icon:"speak"}),e("span",{children:"Speak"})]})]})})]}),e("main",{lang:n,dir:"auto",children:[e("p",{style:{whiteSpace:"pre-wrap",textWrap:"pretty"},children:t}),(a||o)&&e(Vi,{forceTranslate:o,sourceLanguage:n,text:t})]})]})}function bn(t,n,s){return Math.max(Math.min(t,s),n)}const yn=t=>t>=.04045?Math.pow((t+.055)/1.055,2.4):t/12.92,wn=t=>t>=.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t;function Gn([t,n,s]){t=yn(t/255),n=yn(n/255),s=yn(s/255);var i=.4122214708*t+.5363325363*n+.0514459929*s,o=.2119034982*t+.6806995451*n+.1073969566*s,r=.0883024619*t+.2817188376*n+.6299787005*s;return i=Math.cbrt(i),o=Math.cbrt(o),r=Math.cbrt(r),[i*.2104542553+o*.793617785+r*-.0040720468,i*1.9779984951+o*-2.428592205+r*.4505937099,i*.0259040371+o*.7827717662+r*-.808675766]}function jn([t,n,a]){var i=t+n*.3963377774+a*.2158037573,o=t+n*-.1055613458+a*-.0638541728,r=t+n*-.0894841775+a*-1.291485548;i=i**3,o=o**3,r=r**3;var f=i*4.0767416621+o*-3.3077115913+r*.2309699292,u=i*-1.2684380046+o*2.6097574011+r*-.3413193965,a=i*-.0041960863+o*-.7034186147+r*1.707614701;return f=255*wn(f),u=255*wn(u),a=255*wn(a),f=bn(f,0,255),u=bn(u,0,255),a=bn(a,0,255),f=Math.round(f),u=Math.round(u),a=Math.round(a),[f,u,a]}var da={PHANPY_CLIENT_NAME:"Phanpy",PHANPY_WEBSITE:"https://phanpy.social",PHANPY_LINGVA_INSTANCES:"lingva.phanpy.social lingva.lunar.icu lingva.garudalinux.org translate.plausibility.cloud",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",VITE_APP_ENV:"production",BASE_URL:"./",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{PHANPY_IMG_ALT_API_URL:Vc}=da;function ls({mediaAttachments:t,statusID:n,instance:s,lang:i,index:o=0,onClose:r=()=>{}}){var y,I;const[f,u]=E("default"),a=B(null),[d,p]=E(o),c=B(null);ut(()=>{var w;(w=c.current)==null||w.scrollIntoView()},[]);const h=B(n);W(()=>{const w=o*a.current.clientWidth,k=h.current!==n;k&&(h.current=n),a.current.scrollTo({left:w,behavior:k?"auto":"smooth"}),a.current.focus()},[o,n]);const[l,b]=E(!0);W(()=>{let w=()=>{r()};return a.current&&a.current.addEventListener("swiped-down",w),()=>{a.current&&a.current.removeEventListener("swiped-down",w)}},[]),Le("esc",r,{ignoreEventWhen:w=>!!document.querySelector("#modal-container > *")},[r]),W(()=>{let w=()=>{const{clientWidth:k,scrollLeft:T}=a.current,x=Math.round(T/k);p(x)};return a.current&&a.current.addEventListener("scroll",w,{passive:!0}),()=>{a.current&&a.current.removeEventListener("scroll",w)}},[]),W(()=>{let w=setTimeout(()=>{var k,T;(T=(k=a.current)==null?void 0:k.focus)==null||T.call(k)},100);return()=>clearTimeout(w)},[]);const m=ge(()=>t==null?void 0:t.map(w=>{const{blurhash:k}=w;if(k){const T=Pn(k),x=Gn(T);return jn([.6,x[1],x[2]])}return null}),[t]),S=ge(()=>{var T;const k=100/m.length;return((T=m==null?void 0:m.map((x,q)=>{const N=q*k+5,P=(q+1)*k-5;return x?` rgba(${x==null?void 0:x.join(",")}, 0.4) ${N}%, rgba(${x==null?void 0:x.join(",")}, 0.4) ${P}% `:` transparent ${N}%, transparent ${P}% `}))==null?void 0:T.join(", "))||"transparent"},[m]);let g=B(null);return W(()=>()=>{var w,k;(k=(w=g.current)==null?void 0:w.hideToast)==null||k.call(w)},[]),e("div",{class:`media-modal-container media-modal-count-${t==null?void 0:t.length}`,children:[e("div",{ref:a,tabIndex:"0","data-swipe-threshold":"44",class:"carousel",onClick:w=>{(w.target.classList.contains("carousel-item")||w.target.classList.contains("media")||w.target.classList.contains("media-zoom"))&&r()},style:t.length>1?{backgroundAttachment:"local",backgroundImage:`linear-gradient( to right, ${S})`}:{},children:t==null?void 0:t.map((w,k)=>{const T=t.length===1?m[k]:null;return e("div",{class:"carousel-item",style:T?{"--accent-color":`rgb(${T==null?void 0:T.join(",")})`,"--accent-alpha-color":`rgba(${T==null?void 0:T.join(",")}, 0.4)`}:{},tabindex:"0",ref:k===d?c:null,onClick:x=>{x.target.classList.contains("media")||b(!l)},children:[!!w.description&&e("button",{type:"button",class:"media-alt",hidden:!l,onClick:()=>{$.showMediaAlt={alt:w.description,lang:i}},children:[e("span",{class:"alt-badge",children:"ALT"}),e("span",{class:"media-alt-desc",lang:i,dir:"auto",children:w.description})]}),e(Gi,{media:w,showOriginal:!0,lang:i})]},w.id)})}),e("div",{class:"carousel-top-controls",hidden:!l,children:[e("span",{children:e("button",{type:"button",class:"carousel-button",onClick:()=>r(),children:e(v,{icon:"x"})})}),(t==null?void 0:t.length)>1?e("span",{class:"carousel-dots",children:t==null?void 0:t.map((w,k)=>e("button",{type:"button",disabled:k===d,class:`carousel-dot ${k===d?"active":""}`,onClick:T=>{T.preventDefault(),T.stopPropagation(),a.current.scrollTo({left:a.current.clientWidth*k,behavior:"smooth"}),a.current.focus()},children:e(v,{icon:"round",size:"s"})},w.id))}):e("span",{}),e("span",{children:[e(Ze,{overflow:"auto",align:"end",position:"anchor",gap:4,menuClassName:"glass-menu",menuButton:e("button",{type:"button",class:"carousel-button",children:e(v,{icon:"more",alt:"More"})}),children:[e(_e,{href:((y=t[d])==null?void 0:y.remoteUrl)||((I=t[d])==null?void 0:I.url),class:"carousel-button",target:"_blank",title:"Open original media in new window",children:[e(v,{icon:"popout"}),e("span",{children:"Open original media"})]}),!1]})," ",e(oe,{to:`${s?`/${s}`:""}/s/${n}${window.matchMedia("(min-width: calc(40em + 350px))").matches?`?media=${d+1}`:""}`,class:"button carousel-button media-post-link",children:[e("span",{class:"button-label",children:"View post "}),"»"]})]})]}),(t==null?void 0:t.length)>1&&e("div",{class:"carousel-controls",hidden:!l,children:[e("button",{type:"button",class:"carousel-button",hidden:d===0,onClick:w=>{w.preventDefault(),w.stopPropagation(),a.current.focus(),a.current.scrollTo({left:a.current.clientWidth*(d-1),behavior:"smooth"})},children:e(v,{icon:"arrow-left"})}),e("button",{type:"button",class:"carousel-button",hidden:d===t.length-1,onClick:w=>{w.preventDefault(),w.stopPropagation(),a.current.focus(),a.current.scrollTo({left:a.current.clientWidth*(d+1),behavior:"smooth"})},children:e(v,{icon:"arrow-right"})})]})]})}const ua=[,"spam","legal","violation","other"],Ot={spam:{label:"Spam",description:"Malicious links, fake engagement, or repetitive replies"},legal:{label:"Illegal",description:"Violates the law of your or the server's country"},violation:{label:"Server rule violation",description:"Breaks specific server rules",stampLabel:"Violation"},other:{label:"Other",description:"Issue doesn't fit other categories",excludeStamp:!0}};function ha({account:t,post:n,onClose:s}){const{masto:i}=ee(),[o,r]=E("default"),[f,u]=t.acct.split("@"),[a,d]=ge(()=>{const{rules:g,domain:y}=Ui();return[g||[],y]}),[p,c]=E(null),[h,l]=E(!1),b=B(null),[m,S]=E(!1);return e("div",{class:"report-modal-container",children:[e("div",{class:"top-controls",children:[e("h1",{children:n?"Report Post":`Report @${f}`}),e("button",{type:"button",class:"plain4 small",disabled:o==="loading",onClick:()=>s(),children:e(v,{icon:"x",size:"xl"})})]}),e("main",{children:[e("div",{class:"report-preview",children:n?e(Be,{status:n,size:"s",previewMode:!0}):e(Qe,{account:t,avatarSize:"xxl",useAvatarStatic:!0,showStats:!0,showActivity:!0})}),!!p&&!Ot[p].excludeStamp&&e("span",{class:"rubber-stamp","aria-hidden":"true",children:[Ot[p].stampLabel||Ot[p].label,e("small",{children:"Pending review"})]},p),e("form",{onSubmit:g=>{g.preventDefault();const y=new FormData(g.target),I=Object.fromEntries(y.entries());let{category:w,comment:k,forward:T}=I;k||(k=void 0),T==="on"&&(T=!0);const x=w==="violation"?Object.entries(I).filter(([N])=>N.startsWith("rule_ids")).map(([N,P])=>P):void 0,q={category:w,comment:k,forward:T,ruleIds:x};r("loading"),(async()=>{try{await i.v1.reports.create({accountId:t.id,statusIds:n!=null&&n.id?[n.id]:void 0,category:w,comment:k,ruleIds:x,forward:T}),r("success"),ie(n?"Post reported":"Profile reported"),s()}catch(N){r("error"),ie((N==null?void 0:N.message)||(n?"Unable to report post":"Unable to report profile"))}})()},children:[e("p",{children:n?"What's the issue with this post?":"What's the issue with this profile?"}),e("section",{class:"report-categories",children:ua.map(g=>g==="violation"&&!(a!=null&&a.length)?null:e(L,{children:[e("label",{class:"report-category",children:[e("input",{type:"radio",name:"category",value:g,required:!0,disabled:o==="loading",onChange:y=>{c(y.target.value),l(y.target.value==="violation")}}),e("span",{children:[Ot[g].label,"  ",e("small",{class:"ib insignificant",children:Ot[g].description})]})]}),g==="violation"&&!!(a!=null&&a.length)&&e("div",{class:"shazam-container no-animation",hidden:!h,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"report-rules",ref:b,children:a.map((y,I)=>e("label",{class:"report-rule",children:[e("input",{type:"checkbox",name:`rule_ids[${I}]`,value:y.id,required:h&&!m,disabled:o==="loading",onChange:w=>{const{checked:k}=w.target;k?S(!0):b.current.querySelectorAll("input:checked").length||S(!1)}}),e("span",{children:y.text})]},y.id))})})})]},g))}),e("section",{class:"report-comment",children:[e("p",{children:e("label",{for:"report-comment",children:"Additional info"})}),e("textarea",{maxlength:"1000",rows:"1",name:"comment",id:"report-comment",disabled:o==="loading"})]}),!!u&&u!==d&&e("section",{children:e("p",{children:e("label",{children:[e("input",{type:"checkbox",switch:!0,name:"forward",disabled:o==="loading"})," ",e("span",{children:["Forward to ",e("i",{children:u})]})]})})}),e("footer",{children:[e("button",{type:"submit",disabled:o==="loading",children:"Send Report"})," ",e("button",{type:"submit",class:"plain2",disabled:o==="loading",onClick:async()=>{try{await i.v1.accounts.$select(t.id).mute(),ie(`Muted ${f}`)}catch{ie(`Unable to mute ${f}`)}},children:["Send Report ",e("small",{class:"ib",children:"+ Mute profile"})]})," ",e("button",{type:"submit",class:"plain2",disabled:o==="loading",onClick:async()=>{try{await i.v1.accounts.$select(t.id).block(),ie(`Blocked ${f}`)}catch{ie(`Unable to block ${f}`)}},children:["Send Report ",e("small",{class:"ib",children:"+ Block profile"})]}),e($e,{hidden:o!=="loading"})]})]})]})]})}var Yn={exports:{}},Gc=Yn.exports;(function(t){var n=function(){var s=String.fromCharCode,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",r={};function f(a,d){if(!r[a]){r[a]={};for(var p=0;p>>8,p[c*2+1]=l%256}return p},decompressFromUint8Array:function(a){if(a==null)return u.decompress(a);for(var d=new Array(a.length/2),p=0,c=d.length;p>1}else{for(h=1,c=0;c>1}y--,y==0&&(y=Math.pow(2,w),w++),delete b[g]}else for(h=l[g],c=0;c>1;y--,y==0&&(y=Math.pow(2,w),w++),l[S]=I++,g=String(m)}if(g!==""){if(Object.prototype.hasOwnProperty.call(b,g)){if(g.charCodeAt(0)<256){for(c=0;c>1}else{for(h=1,c=0;c>1}y--,y==0&&(y=Math.pow(2,w),w++),delete b[g]}else for(h=l[g],c=0;c>1;y--,y==0&&(y=Math.pow(2,w),w++)}for(h=2,c=0;c>1;for(;;)if(T=T<<1,x==d-1){k.push(p(T));break}else x++;return k.join("")},decompress:function(a){return a==null?"":a==""?null:u._decompress(a.length,32768,function(d){return a.charCodeAt(d)})},_decompress:function(a,d,p){var c=[],h,l=4,b=4,m=3,S="",g=[],y,I,w,k,T,x,q,N={val:p(0),position:d,index:1};for(y=0;y<3;y+=1)c[y]=y;for(w=0,T=Math.pow(2,2),x=1;x!=T;)k=N.val&N.position,N.position>>=1,N.position==0&&(N.position=d,N.val=p(N.index++)),w|=(k>0?1:0)*x,x<<=1;switch(h=w){case 0:for(w=0,T=Math.pow(2,8),x=1;x!=T;)k=N.val&N.position,N.position>>=1,N.position==0&&(N.position=d,N.val=p(N.index++)),w|=(k>0?1:0)*x,x<<=1;q=s(w);break;case 1:for(w=0,T=Math.pow(2,16),x=1;x!=T;)k=N.val&N.position,N.position>>=1,N.position==0&&(N.position=d,N.val=p(N.index++)),w|=(k>0?1:0)*x,x<<=1;q=s(w);break;case 2:return""}for(c[3]=q,I=q,g.push(q);;){if(N.index>a)return"";for(w=0,T=Math.pow(2,m),x=1;x!=T;)k=N.val&N.position,N.position>>=1,N.position==0&&(N.position=d,N.val=p(N.index++)),w|=(k>0?1:0)*x,x<<=1;switch(q=w){case 0:for(w=0,T=Math.pow(2,8),x=1;x!=T;)k=N.val&N.position,N.position>>=1,N.position==0&&(N.position=d,N.val=p(N.index++)),w|=(k>0?1:0)*x,x<<=1;c[b++]=s(w),q=b-1,l--;break;case 1:for(w=0,T=Math.pow(2,16),x=1;x!=T;)k=N.val&N.position,N.position>>=1,N.position==0&&(N.position=d,N.val=p(N.index++)),w|=(k>0?1:0)*x,x<<=1;c[b++]=s(w),q=b-1,l--;break;case 2:return g.join("")}if(l==0&&(l=Math.pow(2,m),m++),c[q])S=c[q];else if(q===b)S=I+I.charAt(0);else return null;g.push(S),c[b++]=I+S.charAt(0),l--,I=S,l==0&&(l=Math.pow(2,m),m++)}}};return u}();t!=null?t.exports=n:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return n})})(Yn);var pi=Yn.exports;const fa="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2084%2062'%3e%3crect%20width='64'%20height='48'%20x='18'%20y='2'%20fill='%23fff'%20stroke='%23999'%20stroke-width='3'%20rx='4'/%3e%3crect%20width='32'%20height='48'%20x='2'%20y='12'%20fill='%23fff'%20stroke='%23999'%20stroke-width='3'%20rx='4'/%3e%3cpath%20fill='%234169E1'%20d='M14%2052a4%204%200%201%201-8%200%204%204%200%200%201%208%200Zm64-42a4%204%200%201%201-8%200%204%204%200%200%201%208%200Z'/%3e%3c/svg%3e",pa="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2082%2062'%3e%3crect%20width='78'%20height='58'%20x='2'%20y='2'%20fill='%23999'%20fill-opacity='.3'%20stroke='%23999'%20stroke-width='3'%20rx='4'/%3e%3crect%20width='18'%20height='46'%20x='8'%20y='8'%20fill='%23fff'%20stroke='%23999'%20stroke-width='2'%20rx='1'/%3e%3crect%20width='18'%20height='46'%20x='32'%20y='8'%20fill='%23fff'%20stroke='%23999'%20stroke-width='2'%20rx='1'/%3e%3crect%20width='18'%20height='46'%20x='56'%20y='8'%20fill='%23fff'%20stroke='%23999'%20stroke-width='2'%20rx='1'/%3e%3c/svg%3e",ma="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2084%2062'%3e%3crect%20width='64'%20height='48'%20x='18'%20y='2'%20fill='%23fff'%20stroke='%23999'%20stroke-width='3'%20rx='4'/%3e%3cpath%20fill='%23999'%20fill-opacity='.3'%20d='M19%203h62v10H19z'/%3e%3cpath%20stroke='%234169E1'%20stroke-width='2'%20d='M43%208a2%202%200%201%201-4%200%202%202%200%200%201%204%200Z'/%3e%3cpath%20stroke='%23999'%20stroke-width='2'%20d='M52%208a2%202%200%201%201-4%200%202%202%200%200%201%204%200Zm9%200a2%202%200%201%201-4%200%202%202%200%200%201%204%200Z'/%3e%3crect%20width='32'%20height='48'%20x='2'%20y='12'%20fill='%23fff'%20stroke='%23999'%20stroke-width='3'%20rx='4'/%3e%3cpath%20fill='%23999'%20fill-opacity='.3'%20d='M3%2049h30v10H3z'/%3e%3cpath%20stroke='%234169E1'%20stroke-width='2'%20d='M11%2054a2%202%200%201%201-4%200%202%202%200%200%201%204%200Z'/%3e%3cpath%20stroke='%23999'%20stroke-width='2'%20d='M20%2054a2%202%200%201%201-4%200%202%202%200%200%201%204%200Zm9%200a2%202%200%201%201-4%200%202%202%200%200%201%204%200Z'/%3e%3c/svg%3e",ga=200,ba=10;async function un(){const{masto:t}=ee(),n=t.v1.followedTags.list({limit:ga}),s=[];let i=0;do{const{value:o,done:r}=await n.next();if(r||(o==null?void 0:o.length)===0)break;s.push(...o),i++}while(io.name.localeCompare(r.name)),s.length&&setTimeout(()=>{ye.account.set("followedTags",{tags:s,updatedAt:Date.now()})},1),s}const ya=24*60*60*1e3;async function wa(){try{const{tags:t,updatedAt:n}=ye.account.get("followedTags")||{};return t!=null&&t.length?(Date.now()-n>ya&&un(),t):await un()}catch{return[]}}const mi=document.createElement("div"),va=t=>{if(!t)return[];if(t.indexOf("#")===-1)return[];mi.innerHTML=t;const n=mi.querySelectorAll("a.hashtag");return n.length?Array.from(n).map(s=>s.innerText.trim().replace(/^[^#]*#+/,"")):[]};function tn({children:t}){if(typeof t=="string")return t;const[n,s]=E("");return W(()=>{Promise.resolve(t).then(s)},[t]),n}const lt=9,ka=["following","mentions","notifications","list","public","trending","search","hashtag","bookmarks","favourites"],ds={following:"Home / Following",notifications:"Notifications",list:"Lists",public:"Public (Local / Federated)",search:"Search","account-statuses":"Account",bookmarks:"Bookmarks",favourites:"Likes",hashtag:"Hashtag",trending:"Trending",mentions:"Mentions"},nn={list:[{text:"List ID",name:"id",notRequired:!0}],public:[{text:"Local only",name:"local",type:"checkbox"},{text:"Instance",name:"instance",type:"text",placeholder:"Optional, e.g. mastodon.social",notRequired:!0}],trending:[{text:"Instance",name:"instance",type:"text",placeholder:"Optional, e.g. mastodon.social",notRequired:!0}],search:[{text:"Search term",name:"query",type:"text",placeholder:"Optional, unless for multi-column mode",notRequired:!0}],"account-statuses":[{text:"@",name:"id",type:"text",placeholder:"cheeaun@mastodon.social"}],hashtag:[{text:"#",name:"hashtag",type:"text",placeholder:"e.g. PixelArt (Max 5, space-separated)",pattern:"[^#]+"},{text:"Media only",name:"media",type:"checkbox"},{text:"Instance",name:"instance",type:"text",placeholder:"Optional, e.g. mastodon.social",notRequired:!0}]},Sa=ft(async({id:t})=>{const n=await ee().masto.v1.accounts.$select(t).fetch();return n.username||n.acct||n.displayName}),hn={following:{id:"home",title:(t,n)=>n===0?"Home":"Following",path:"/",icon:"home"},mentions:{id:"mentions",title:"Mentions",path:"/mentions",icon:"at"},notifications:{id:"notifications",title:"Notifications",path:"/notifications",icon:"notification"},list:{id:({id:t})=>t?"list":"lists",title:({id:t})=>t?Fo(t):"Lists",path:({id:t})=>t?`/l/${t}`:"/l",icon:"list",excludeViewMode:({id:t})=>t?[]:["multi-column"]},public:{id:"public",title:({local:t})=>t?"Local":"Federated",subtitle:({instance:t})=>t||ee().instance,path:({local:t,instance:n})=>`/${n}/p${t?"/l":""}`,icon:({local:t})=>t?"building":"earth"},trending:{id:"trending",title:"Trending",subtitle:({instance:t})=>t||ee().instance,path:({instance:t})=>`/${t}/trending`,icon:"chart"},search:{id:"search",title:({query:t})=>t?`“${t}”`:"Search",path:({query:t})=>t?`/search?q=${encodeURIComponent(t)}&type=statuses`:"/search",icon:"search",excludeViewMode:({query:t})=>t?[]:["multi-column"]},"account-statuses":{id:"account-statuses",title:Sa,path:({id:t})=>`/a/${t}`,icon:"user"},bookmarks:{id:"bookmarks",title:"Bookmarks",path:"/b",icon:"bookmark"},favourites:{id:"favourites",title:"Likes",path:"/f",icon:"heart"},hashtag:{id:"hashtag",title:({hashtag:t})=>t,subtitle:({instance:t})=>t||ee().instance,path:({hashtag:t,instance:n,media:s})=>`${n?`/${n}`:""}/t/${t.split(/\s+/).join("+")}${s?"?media=1":""}`,icon:"hashtag"}};function Ia({onClose:t}){const n=De($),{shortcuts:s}=n,[i,o]=E(!1),[r,f]=E(!1),[u]=Bn();return e("div",{id:"shortcuts-settings-container",class:"sheet",tabindex:"-1",children:[!!t&&e("button",{type:"button",class:"sheet-close",onClick:t,children:e(v,{icon:"x"})}),e("header",{children:e("h2",{children:[e(v,{icon:"shortcut"})," Shortcuts"," ",e("sup",{style:{fontSize:12,opacity:.5,textTransform:"uppercase"},children:"beta"})]})}),e("main",{children:[e("p",{children:"Specify a list of shortcuts that'll appear as:"}),e("div",{class:"shortcuts-view-mode",children:[{value:"float-button",label:"Floating button",imgURL:fa},{value:"tab-menu-bar",label:"Tab/Menu bar",imgURL:ma},{value:"multi-column",label:"Multi-column",imgURL:pa}].map(({value:a,label:d,imgURL:p})=>{const c=n.settings.shortcutsViewMode===a||a==="float-button"&&!n.settings.shortcutsViewMode;return e("label",{class:c?"checked":"",children:[e("input",{type:"radio",name:"shortcuts-view-mode",value:a,checked:c,onChange:h=>{$.settings.shortcutsViewMode=h.target.value}})," ",e("img",{src:p,alt:"",width:"80",height:"58"})," ",e("span",{children:d})]},a)})}),s.length>0?e(L,{children:[e("ol",{class:"shortcuts-list",ref:u,children:s.filter(Boolean).map((a,d)=>{const p=Object.values(a).join("-"),{type:c}=a;if(!hn[c])return null;let{icon:h,title:l,subtitle:b,excludeViewMode:m}=hn[c];typeof l=="function"&&(l=l(a,d)),typeof b=="function"&&(b=b(a,d)),typeof h=="function"&&(h=h(a,d)),typeof m=="function"&&(m=m(a,d));const S=m==null?void 0:m.includes(n.settings.shortcutsViewMode);return e("li",{children:[e(v,{icon:h}),e("span",{class:"shortcut-text",children:[e(tn,{children:l}),b&&e(L,{children:[" ",e("small",{class:"ib insignificant",children:b})]}),S&&e("span",{class:"tag",children:"Not available in current view mode"})]}),e("span",{class:"shortcut-actions",children:[e("button",{type:"button",class:"plain small",disabled:d===0,onClick:()=>{const g=Array.from($.shortcuts);if(d>0){const y=$.shortcuts[d-1];g[d-1]=a,g[d]=y,$.shortcuts=g}},children:e(v,{icon:"arrow-up",alt:"Move up"})}),e("button",{type:"button",class:"plain small",disabled:d===s.length-1,onClick:()=>{const g=Array.from($.shortcuts);if(d<$.shortcuts.length-1){const y=$.shortcuts[d+1];g[d+1]=a,g[d]=y,$.shortcuts=g}},children:e(v,{icon:"arrow-down",alt:"Move down"})}),e("button",{type:"button",class:"plain small",onClick:()=>{o({shortcut:a,shortcutIndex:d})},children:e(v,{icon:"pencil",alt:"Edit"})})]})]},p)})}),s.length===1&&n.settings.shortcutsViewMode!=="float-button"&&e("div",{class:"ui-state insignificant",children:[e(v,{icon:"info"})," ",e("small",{children:"Add more than one shortcut/column to make this work."})]})]}):e("div",{class:"ui-state insignificant",children:[e("p",{children:n.settings.shortcutsViewMode==="multi-column"?"No columns yet. Tap on the Add column button.":"No shortcuts yet. Tap on the Add shortcut button."}),e("p",{children:["Not sure what to add?",e("br",{}),"Try adding"," ",e("a",{href:"#",onClick:a=>{a.preventDefault(),$.shortcuts=[{type:"following"},{type:"notifications"}]},children:"Home / Following and Notifications"})," ","first."]})]}),e("p",{class:"insignificant",children:s.length>=lt&&(n.settings.shortcutsViewMode==="multi-column"?`Max ${lt} columns`:`Max ${lt} shortcuts`)}),e("p",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e("button",{type:"button",class:"light",onClick:()=>f(!0),children:"Import/export"}),e("button",{type:"button",disabled:s.length>=lt,onClick:()=>o(!0),children:[e(v,{icon:"plus"})," ",e("span",{children:n.settings.shortcutsViewMode==="multi-column"?"Add column…":"Add shortcut…"})]})]})]}),i&&e(Ee,{onClick:a=>{a.target===a.currentTarget&&o(!1)},children:e(Ca,{shortcut:i.shortcut,shortcutIndex:i.shortcutIndex,onSubmit:({result:a,mode:d})=>{d==="edit"?$.shortcuts[i.shortcutIndex]=a:$.shortcuts.push(a)},onClose:()=>o(!1)})}),r&&e(Ee,{onClick:a=>{a.target===a.currentTarget&&f(!1)},children:e(Ta,{shortcuts:s,onClose:()=>f(!1)})})]})}const gi={list:"Specific list is optional. For multi-column mode, list is required, else the column will not be shown.",search:"For multi-column mode, search term is required, else the column will not be shown.",hashtag:"Multiple hashtags are supported. Space-separated."};function Ca({onSubmit:t,disabled:n,shortcut:s,shortcutIndex:i,onClose:o}){var S,g;const r=!!s,[f,u]=E((s==null?void 0:s.type)||null),{masto:a}=ee(),[d,p]=E("default"),[c,h]=E([]),[l,b]=E([]);W(()=>{(async()=>{if(f==="list")try{p("loading");const y=await Yt();h(y),p("default")}catch{p("error")}})(),(async()=>{if(f==="hashtag")try{const y=await un();b(y)}catch{}})()},[f]);const m=B();return W(()=>{if(r&&f&&nn[f]){const y=m.current;nn[f].forEach(({name:I,type:w})=>{const k=y.querySelector(`[name="${I}"]`);k&&s[I]&&(w==="checkbox"?k.checked=s[I]==="on":k.value=s[I])})}},[r,f]),e("div",{id:"shortcut-settings-form",class:"sheet",children:[!!o&&e("button",{type:"button",class:"sheet-close",onClick:o,children:e(v,{icon:"x"})}),e("header",{children:e("h2",{children:[r?"Edit":"Add"," shortcut"]})}),e("main",{tabindex:"-1",children:e("form",{ref:m,onSubmit:y=>{y.preventDefault();const I=new FormData(y.target),w={};I.forEach((k,T)=>{w[T]=k==null?void 0:k.trim(),T==="instance"&&(w[T]=w[T].replace(/^https?:\/\//,"").replace(/\/+$/,""),w[T]=w[T].replace(/^@?[^@]+@/,""))}),w.type&&(t({result:w,mode:r?"edit":"add"}),y.target.reset(),u(null),o==null||o())},children:[e("p",{children:e("label",{children:[e("span",{children:"Timeline"}),e("select",{required:!0,disabled:n,onChange:y=>{u(y.target.value)},defaultValue:r?s.type:void 0,name:"type",children:[e("option",{}),ka.map(y=>e("option",{value:y,children:ds[y]}))]})]})}),(g=(S=nn[f])==null?void 0:S.map)==null?void 0:g.call(S,({text:y,name:I,type:w,placeholder:k,pattern:T,notRequired:x})=>f==="list"?e("p",{children:e("label",{children:[e("span",{children:"List"}),e("select",{name:"id",required:!x,disabled:n||d==="loading",defaultValue:r?s.id:void 0,children:[e("option",{value:""}),c.map(q=>e("option",{value:q.id,children:q.title}))]})]})}):e("p",{children:e("label",{children:[e("span",{children:y})," ",e("input",{type:w,switch:w==="checkbox"||void 0,name:I,placeholder:k,required:w==="text"&&!x,disabled:n,list:f==="hashtag"?"followed-hashtags-datalist":null,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:T}),f==="hashtag"&&l.length>0&&e("datalist",{id:"followed-hashtags-datalist",children:l.map(q=>e("option",{value:q.name}))})]})})),!!gi[f]&&e("p",{class:"form-note insignificant",children:[e(v,{icon:"info"}),gi[f]]}),e("footer",{children:[e("button",{type:"submit",class:"block",disabled:n||d==="loading",children:r?"Save":"Add"}),r&&e("button",{type:"button",class:"light danger",onClick:()=>{$.shortcuts.splice(i,1),o==null||o()},children:"Remove"})]})]})})]})}function Ta({shortcuts:t,onClose:n}){var c;const{masto:s}=ee(),i=ge(()=>!t||!t.filter(Boolean).length?"":pi.compressToEncodedURIComponent(JSON.stringify(t.filter(Boolean))),[t]),[o,r]=E(""),[f,u]=E("default"),a=ge(()=>{if(!o)return u("default"),null;try{const h=JSON.parse(pi.decompressFromEncodedURIComponent(o));if(!Array.isArray(h))throw new Error("Not an array");return u("default"),h}catch{try{const l=JSON.parse(o);if(!Array.isArray(l))throw new Error("Not an array");return u("default"),l}catch{return u("error"),null}}},[o]),d=$.shortcuts.length>0,p=B();return e("div",{id:"import-export-container",class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(v,{icon:"x"})}),e("header",{children:e("h2",{children:["Import/Export ",e("small",{class:"ib insignificant",children:"Shortcuts"})]})}),e("main",{tabindex:"-1",children:[e("section",{children:[e("h3",{children:[e(v,{icon:"arrow-down-circle",size:"l",class:"insignificant"})," ",e("span",{children:"Import"})]}),e("p",{class:"field-button",children:[e("input",{ref:p,type:"text",name:"import",placeholder:"Paste shortcuts here",class:"block",onInput:h=>{r(h.target.value)}}),$.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2 small",disabled:f==="cloud-downloading",onClick:async()=>{u("cloud-downloading");const h=dt();ie("Downloading saved shortcuts from instance server…");try{const b=(await s.v1.accounts.relationships.fetch({id:[h]}))[0];if(b){const{note:m=""}=b;if(/(.*)<\/phanpy-shortcuts-settings>/.test(m)){const S=m.match(/(.*)<\/phanpy-shortcuts-settings>/)[1],{v:g,dt:y,data:I}=JSON.parse(S);p.current.value=I,p.current.dispatchEvent(new Event("input"))}}u("default")}catch{u("error"),ie("Unable to download shortcuts")}},title:"Download shortcuts from instance server",children:[e(v,{icon:"cloud"}),e(v,{icon:"arrow-down"})]})]}),!!a&&Array.isArray(a)&&e(L,{children:[e("p",{children:[e("b",{children:a.length})," shortcut",a.length>1?"s":""," ",e("small",{class:"insignificant",children:["(",o.length," characters)"]})]}),e("ol",{class:"import-settings-list",children:a.map(h=>{var l,b;return e("li",{children:[e("span",{style:{opacity:t.some(m=>Object.keys(m).every(S=>m[S]===h[S]))?1:0},children:"*"}),e("span",{children:[ds[h.type],h.type==="list"&&" ⚠️"," ",(b=(l=nn[h.type])==null?void 0:l.map)==null?void 0:b.call(l,({text:m,name:S,type:g})=>h[S]?e(L,{children:[e("span",{class:"tag collapsed insignificant",children:[m,":"," ",g==="checkbox"?h[S]==="on"?"✅":"❌":h[S]]})," "]}):null)]})]})})}),e("p",{children:[e("small",{children:"* Exists in current shortcuts"}),e("br",{}),e("small",{children:"⚠️ List may not work if it's from a different account."})]})]}),f==="error"&&e("p",{class:"error",children:e("small",{children:"⚠️ Invalid settings format"})}),e("p",{children:[d&&e(L,{children:[e(tt,{confirmLabel:"Append to current shortcuts?",menuFooter:e("div",{class:"footer",children:"Only shortcuts that don’t exist in current shortcuts will be appended."}),onClick:()=>{const h=a.filter(m=>!$.shortcuts.some(S=>Object.keys(S).every(g=>S[g]===m[g])));if(!h.length){ie("No new shortcuts to import");return}let l=[...$.shortcuts,...h];const b=l.length>lt;b&&(l=l.slice(0,lt)),$.shortcuts=l,ie(b?`Shortcuts imported. Exceeded max ${lt}, so the rest are not imported.`:"Shortcuts imported"),n==null||n()},children:e("button",{type:"button",class:"plain2",disabled:!a,children:"Import & append…"})})," "]}),e(tt,{confirmLabel:d?"Override current shortcuts?":"Import shortcuts?",menuItemClassName:d?"danger":void 0,onClick:()=>{$.shortcuts=a,ie("Shortcuts imported"),n==null||n()},children:e("button",{type:"button",class:"plain2",disabled:!a,children:d?"or override…":"Import…"})})]})]}),e("section",{children:[e("h3",{children:[e(v,{icon:"arrow-up-circle",size:"l",class:"insignificant"})," ",e("span",{children:"Export"})]}),e("p",{children:e("input",{style:{width:"100%"},type:"text",value:i,readOnly:!0,onClick:h=>{if(h.target.value){h.target.select();try{navigator.clipboard.writeText(h.target.value),ie("Shortcuts copied")}catch{ie("Unable to copy shortcuts")}}}})}),e("p",{children:[e("button",{type:"button",class:"plain2",disabled:!i,onClick:()=>{try{navigator.clipboard.writeText(i),ie("Shortcut settings copied")}catch{ie("Unable to copy shortcut settings")}},children:[e(v,{icon:"clipboard"})," ",e("span",{children:"Copy"})]})," ",(navigator==null?void 0:navigator.share)&&((c=navigator==null?void 0:navigator.canShare)==null?void 0:c.call(navigator,{text:i}))&&e("button",{type:"button",class:"plain2",disabled:!i,onClick:()=>{try{navigator.share({text:i})}catch{alert("Sharing doesn't seem to work.")}},children:[e(v,{icon:"share"})," ",e("span",{children:"Share"})]})," ",$.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2",disabled:f==="cloud-uploading",onClick:async()=>{u("cloud-uploading");const h=dt();try{const b=(await s.v1.accounts.relationships.fetch({id:[h]}))[0];if(b){const{note:m=""}=b;let S="";if(/(.*)<\/phanpy-shortcuts-settings>/.test(m)){const g=JSON.stringify({v:"1",dt:Date.now(),data:i});S=m.replace(/(.*)<\/phanpy-shortcuts-settings>/,`${g}`)}else S=`${m} ${settingsJSON}`;ie("Saving shortcuts to instance server…"),await s.v1.accounts.$select(h).note.create({comment:S}),u("default"),ie("Shortcuts saved")}}catch{u("error"),ie("Unable to save shortcuts")}},title:"Sync to instance server",children:[e(v,{icon:"cloud"}),e(v,{icon:"arrow-up"})]})," ",i.length>0&&e("small",{class:"insignificant ib",children:[i.length," characters"]})]}),!!i&&e("details",{children:[e("summary",{class:"insignificant",children:e("small",{children:"Raw Shortcuts JSON"})}),e("textarea",{style:{width:"100%"},rows:10,readOnly:!0,children:JSON.stringify(t.filter(Boolean),null,2)})]})]}),$.settings.shortcutSettingsCloudImportExport&&e("footer",{children:e("p",{children:[e(v,{icon:"cloud"})," Import/export settings from/to instance server (Very experimental)"]})})]})]})}Oi($,t=>{for(const[n,s,i,o]of t)/^show/i.test(s)&&!i&&Tn()});function xa(){var i,o,r,f,u,a,d,p;const t=De($),n=Fi(),s=Nt();return W(()=>{setTimeout(Rs,1e3)},[]),e(L,{children:[!!t.showCompose&&e(Ee,{class:`solid ${t.composerState.minimized?"min":""}`,minimized:!!t.composerState.minimized,children:e(Es,{replyToStatus:typeof t.showCompose!="boolean"?t.showCompose.replyToStatus:((i=window.__COMPOSE__)==null?void 0:i.replyToStatus)||null,editStatus:((o=$.showCompose)==null?void 0:o.editStatus)||((r=window.__COMPOSE__)==null?void 0:r.editStatus)||null,draftStatus:((f=$.showCompose)==null?void 0:f.draftStatus)||((u=window.__COMPOSE__)==null?void 0:u.draftStatus)||null,onClose:c=>{const{newStatus:h,instance:l,type:b}=c||{};$.showCompose=!1,window.__COMPOSE__=null,h&&($.reloadStatusPage++,ie({text:{post:"Post published. Check it out.",reply:"Reply posted. Check it out.",edit:"Post updated. Check it out."}[b||"post"],delay:1e3,duration:1e4,onClick:m=>{m.hideToast(),$.prevLocation=s,n(l?`/${l}/s/${h.id}`:`/s/${h.id}`)}}))}})}),!!t.showSettings&&e(Ee,{onClose:()=>{$.showSettings=!1},children:e(Po,{onClose:()=>{$.showSettings=!1}})}),!!t.showAccounts&&e(Ee,{onClose:()=>{$.showAccounts=!1},children:e(To,{onClose:()=>{$.showAccounts=!1}})}),!!t.showAccount&&e(Ee,{onClose:()=>{$.showAccount=!1},children:e(sa,{account:((a=t.showAccount)==null?void 0:a.account)||t.showAccount,instance:(d=t.showAccount)==null?void 0:d.instance,onClose:({destination:c}={})=>{$.showAccount=!1}})}),!!t.showDrafts&&e(Ee,{onClose:()=>{$.showDrafts=!1},children:e(oa,{onClose:()=>$.showDrafts=!1})}),!!t.showMediaModal&&e(Ee,{onClick:c=>{(c.target===c.currentTarget||c.target.classList.contains("media"))&&($.showMediaModal=!1)},children:e(ls,{mediaAttachments:t.showMediaModal.mediaAttachments,instance:t.showMediaModal.instance,index:t.showMediaModal.index,statusID:t.showMediaModal.statusID,onClose:()=>{$.showMediaModal=!1}})}),!!t.showShortcutsSettings&&e(Ee,{onClose:()=>{$.showShortcutsSettings=!1},children:e(Ia,{onClose:()=>$.showShortcutsSettings=!1})}),!!t.showGenericAccounts&&e(Ee,{onClose:()=>{$.showGenericAccounts=!1},children:e(ca,{instance:t.showGenericAccounts.instance,excludeRelationshipAttrs:t.showGenericAccounts.excludeRelationshipAttrs,postID:t.showGenericAccounts.postID,onClose:()=>$.showGenericAccounts=!1,blankCopy:t.showGenericAccounts.blankCopy})}),!!t.showMediaAlt&&e(Ee,{onClose:c=>{$.showMediaAlt=!1},children:e(la,{alt:t.showMediaAlt.alt||t.showMediaAlt,lang:(p=t.showMediaAlt)==null?void 0:p.lang,onClose:()=>{$.showMediaAlt=!1}})}),!!t.showEmbedModal&&e(Ee,{class:"solid",onClose:()=>{$.showEmbedModal=!1},children:e(ra,{html:t.showEmbedModal.html,url:t.showEmbedModal.url,width:t.showEmbedModal.width,height:t.showEmbedModal.height,onClose:()=>{$.showEmbedModal=!1}})}),!!t.showReportModal&&e(Ee,{onClose:()=>{$.showReportModal=!1},children:e(ha,{account:t.showReportModal.account,post:t.showReportModal.post,onClose:()=>{$.showReportModal=!1}})})]})}function $n({accountID:t,onChange:n}){const{masto:s}=ee(),[i,o]=E("default"),[r,f]=E(null),[u,a]=E(null),d=u!==null;return e("p",{class:"follow-request-buttons",children:[e("button",{type:"button",disabled:i==="loading"||d,onClick:()=>{o("loading"),f("accept"),(async()=>{try{const p=await s.v1.followRequests.$select(t).authorize();if(!(p!=null&&p.followedBy))throw new Error("Follow request not accepted");a(p),n()}catch{}o("default")})()},children:"Accept"})," ",e("button",{type:"button",disabled:i==="loading"||d,class:"light danger",onClick:()=>{o("loading"),f("reject"),(async()=>{try{const p=await s.v1.followRequests.$select(t).reject();if(p!=null&&p.followedBy)throw new Error("Follow request not rejected");a(p),n()}catch{o("default")}})()},children:"Reject"}),e("span",{class:"follow-request-states",children:d&&r?r==="accept"?e(v,{icon:"check-circle",alt:"Accepted",class:"follow-accepted"}):e(v,{icon:"x-circle",alt:"Rejected",class:"follow-rejected"}):e($e,{hidden:i!=="loading"})})]})}const bi={mention:"comment",status:"notification",reblog:"rocket",follow:"follow",follow_request:"follow-add",favourite:"heart",poll:"poll",update:"pencil","admin.signup":"account-edit","admin.report":"account-warning",severed_relationships:"heart-break",moderation_warning:"alert",emoji_reaction:"emoji2","pleroma:emoji_reaction":"emoji2"};function yi(t,n){let s,i;return typeof n=="string"?s=n:(s=n==null?void 0:n.url,i=n==null?void 0:n.staticUrl),s?e(L,{children:["reacted to your post with"," ",e(js,{url:s,staticUrl:i,alt:t})]}):`reacted to your post with ${t}.`}const $t={mention:"mentioned you in their post.",status:"published a post.",reblog:"boosted your post.","reblog+account":t=>`boosted ${t} of your posts.`,reblog_reply:"boosted your reply.",follow:"followed you.",follow_request:"requested to follow you.",favourite:"liked your post.","favourite+account":t=>`liked ${t} of your posts.`,favourite_reply:"liked your reply.",poll:"A poll you have voted in or created has ended.","poll-self":"A poll you have created has ended.","poll-voted":"A poll you have voted in has ended.",update:"A post you interacted with has been edited.","favourite+reblog":"boosted & liked your post.","favourite+reblog+account":t=>`boosted & liked ${t} of your posts.`,"favourite+reblog_reply":"boosted & liked your reply.","admin.sign_up":"signed up.","admin.report":t=>e(L,{children:["reported ",t]}),severed_relationships:t=>e(L,{children:["Lost connections with ",e("i",{children:t}),"."]}),moderation_warning:e("b",{children:"Moderation warning"}),emoji_reaction:yi,"pleroma:emoji_reaction":yi},$a={account_suspension:({from:t,targetName:n})=>e(L,{children:["An admin from ",e("i",{children:t})," has suspended ",e("i",{children:n}),", which means you can no longer receive updates from them or interact with them."]}),domain_block:({from:t,targetName:n,followersCount:s,followingCount:i})=>e(L,{children:["An admin from ",e("i",{children:t})," has blocked ",e("i",{children:n}),". Affected followers: ",s,", followings: ",i,"."]}),user_domain_block:({targetName:t,followersCount:n,followingCount:s})=>e(L,{children:["You have blocked ",e("i",{children:t}),". Removed followers: ",n,", followings: ",s,"."]})},Aa={none:"Your account has received a moderation warning.",disable:"Your account has been disabled.",mark_statuses_as_sensitive:"Some of your posts have been marked as sensitive.",delete_statuses:"Some of your posts have been deleted.",sensitive:"Your posts will be marked as sensitive from now on.",silence:"Your account has been limited.",suspend:"Your account has been suspended."},vn=30;function Ra({notification:t,instance:n,isStatic:s,disableContextMenu:i}){var N,P,J,V,A,D;const{id:o,status:r,account:f,report:u,event:a,moderation_warning:d,_accounts:p,_statuses:c}=t;let{type:h}=t;const l=(r==null?void 0:r.reblog)||r,b=l==null?void 0:l.id,m=dt(),S=m===(f==null?void 0:f.id),g=(N=r==null?void 0:r.poll)==null?void 0:N.voted,y=!!(r!=null&&r.inReplyToAccountId)&&(r==null?void 0:r.inReplyToAccountId)!==m&&((P=r==null?void 0:r.account)==null?void 0:P.id)===m;let I=0,w=0;if(h==="favourite+reblog"){for(const _ of p)(J=_._types)!=null&&J.includes("favourite")&&I++,(V=_._types)!=null&&V.includes("reblog")&&w++;!w&&I&&(h="favourite"),!I&&w&&(h="reblog")}let k;if(h==="poll"?k=$t[S?"poll-self":g?"poll-voted":"poll"]:h==="reblog"||h==="favourite"||h==="favourite+reblog"?(c==null?void 0:c.length)>1?k=$t[`${h}+account`]:y?k=$t[`${h}_reply`]:k=$t[h]:$t[h]?k=$t[h]:k=`[Unknown notification type: ${h}]`,typeof k=="function"){const _=(c==null?void 0:c.length)||(p==null?void 0:p.length);if(h==="admin.report"){const M=u==null?void 0:u.targetAccount;M&&(k=k(e(_t,{account:M,showAvatar:!0})))}else if(h==="severed_relationships"){const M=a==null?void 0:a.targetName;M&&(k=k(M))}else if((h==="emoji_reaction"||h==="pleroma:emoji_reaction")&&t.emoji){const M=t.emoji_url||((D=(A=r==null?void 0:r.emojis)==null?void 0:A.find)==null?void 0:D.call(A,K=>(K==null?void 0:K.shortcode)===t.emoji.replace(/^:/,"").replace(/:$/,"")));k=k(t.emoji,M)}else _&&(k=k(_))}if(h==="mention"&&!r)return null;const T=t.createdAt&&new Date(t.createdAt).toLocaleString(),x={"favourite+reblog":"Boosted/Liked by…",favourite:"Liked by…",reblog:"Boosted by…",follow:"Followed by…"}[h]||"Accounts",q=()=>{$.showGenericAccounts={heading:x,accounts:p,showReactions:h==="favourite+reblog",excludeRelationshipAttrs:h==="follow"?["followedBy"]:[],postID:Xe(b,n)}};return e("div",{class:`notification notification-${h}`,"data-notification-id":o,tabIndex:"0",children:[e("div",{class:`notification-type notification-${h}`,title:T,children:h==="favourite+reblog"?e(L,{children:[e(v,{icon:"rocket",size:"xl",alt:h,class:"reblog-icon"}),e(v,{icon:"heart",size:"xl",alt:h,class:"favourite-icon"})]}):e(v,{icon:bi[h]||"notification",size:"xl",alt:h})}),e("div",{class:"notification-content",children:[h!=="mention"&&e(L,{children:[e("p",{children:[!/poll|update/i.test(h)&&e(L,{children:(p==null?void 0:p.length)>1?e(L,{children:[e("b",{tabIndex:"0",onClick:q,children:[e("span",{title:p.length,children:je(p.length)})," ","people"]})," "]}):f&&e(L,{children:[e(_t,{account:f,showAvatar:!0})," "]})}),k,h==="mention"&&e("span",{class:"insignificant",children:[" ","•"," ",e(It,{datetime:t.createdAt,format:"micro"})]})]}),h==="follow_request"&&e($n,{accountID:f.id}),h==="severed_relationships"&&e("div",{children:[$a[a.type]({from:n,...a}),e("br",{}),e("a",{href:`https://${n}/severed_relationships`,target:"_blank",rel:"noopener noreferrer",children:["Learn more ",e(v,{icon:"external",size:"s"})]}),"."]}),h==="moderation_warning"&&!!d&&e("div",{children:[Aa[d.action],e("br",{}),e("a",{href:`/disputes/strikes/${d.id}`,target:"_blank",rel:"noopener noreferrer",children:["Learn more ",e(v,{icon:"external",size:"s"})]}),"."]})]}),(p==null?void 0:p.length)>1&&e("p",{class:"avatars-stack",children:[p.slice(0,vn).map(_=>e(L,{children:[e("a",{href:_.url,rel:"noopener noreferrer",class:"account-avatar-stack",onClick:M=>{M.preventDefault(),$.showAccount=_},children:[e(st,{url:_.avatarStatic,size:p.length<=10?"xxl":p.length<20?"xl":"l",alt:`${_.displayName} @${_.acct}`,squircle:_==null?void 0:_.bot},_.id),h==="favourite+reblog"&&e("div",{class:"account-sub-icons",children:_._types.map(M=>e(v,{icon:bi[M],size:"s",class:`${M}-icon`}))})]},_.id)," "]},_.id)),e("button",{type:"button",class:"small plain",onClick:q,children:[p.length>vn&&`+${p.length-vn}`,e(v,{icon:"chevron-down"})]})]}),(c==null?void 0:c.length)>1&&e("ul",{class:"notification-group-statuses",children:c.map(_=>e("li",{children:e(wi,{class:`status-link status-type-${h}`,to:n?`/${n}/s/${_.id}`:`/s/${_.id}`,children:e(Be,{status:_,size:"s",previewMode:!0,allowContextMenu:!0})})},_.id))}),r&&(!(c!=null&&c.length)||(c==null?void 0:c.length)<=1)&&e(wi,{class:`status-link status-type-${h}`,to:n?`/${n}/s/${b}`:`/s/${b}`,onContextMenu:i?void 0:_=>{const M=_.target.querySelector(".status");if(M){if(_.metaKey)return;_.preventDefault(),M.dispatchEvent(new MouseEvent("contextmenu",{clientX:_.clientX,clientY:_.clientY}))}},children:s?e(Be,{status:l,size:"s",readOnly:!0,allowContextMenu:!0}):e(Be,{statusID:b,size:"s",readOnly:!0,allowContextMenu:!0})})]})]})}function wi(t){const n=Ys();return e(oe,{...t,"data-read-more":"Read more →",ref:n})}const mn=Je(Ra,(t,n)=>{var s,i;return((s=t.notification)==null?void 0:s.id)===((i=n.notification)==null?void 0:i.id)});"serviceWorker"in navigator&&navigator.serviceWorker.addEventListener("message",t=>{const{type:n,id:s,accessToken:i}=(t==null?void 0:t.data)||{};n==="notification"&&($.routeNotification={id:s,accessToken:i})});const Ea=Je(function(){if(!("serviceWorker"in navigator))return null;const n=De($),{routeNotification:s}=n,{id:i,accessToken:o}=s||{},[r,f]=E(!1);ut(()=>{if(!i||!o)return;const{instance:a}=ee(),{masto:d,instance:p}=ee({accessToken:o}),c=a===p,h=o?_s(o):Et();(async()=>{const l=await d.v1.notifications.$select(i).fetch();if(l&&h){const b=h.instanceURL,{type:m,status:S,account:g}=l,y=!!document.querySelector("#modal-container > *"),I=m==="follow"&&!!(g!=null&&g.id),w=!!(g!=null&&g.id),k=!!(S!=null&&S.id);I&&c?$.showAccount={account:g,instance:b}:y||!c||w&&k?f({id:i,account:h,notification:l,sameInstance:c}):k?location.hash=`/${a}/s/${S.id}`:I?location.hash=`/${a}/a/${g.id}`:location.hash="/notifications"}})()},[i,o]),ut(()=>{navigator!=null&&navigator.clearAppBadge&&navigator.clearAppBadge()},[]),Lt(a=>{a&&(navigator!=null&&navigator.clearAppBadge)&&navigator.clearAppBadge()});const u=()=>{f(!1),$.routeNotification=null,/\/notifications\?id=/i.test(location.hash)&&(location.hash="/notifications")};if(r){const{id:a,account:d,notification:p,sameInstance:c}=r;return e(Ee,{onClick:h=>{h.target===h.currentTarget&&u()},children:e("div",{class:"sheet",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:u,children:e(v,{icon:"x"})}),e("header",{children:e("b",{children:"Notification"})}),e("main",{children:[!c&&e("p",{children:"This notification is from your other account."}),e("div",{class:"notification-peek",onClick:h=>{const{target:l}=h;(h.target.tagName==="BUTTON"||h.target.tagName==="A")&&u()},children:e(mn,{instance:d.instanceURL,notification:p,isStatic:!0})}),e("div",{style:{textAlign:"end"},children:e(oe,{to:"/notifications",class:"button light",onClick:u,children:[e("span",{children:"View all notifications"})," ",e(v,{icon:"arrow-right"})]})})]})]})})}return null}),us=Ms((t,n)=>{const{instance:s}=ee(),[i,o]=ot(),[r,f]=E(!1),[u,a]=E(i.get("q")||""),d=i.get("type"),p=B(null),c=B(null);return Ls(n,()=>({setValue:h=>{a(h)},focus:()=>{c.current.focus()},select:()=>{c.current.select()},blur:()=>{c.current.blur()}})),e("form",{ref:p,class:"search-popover-container",onSubmit:h=>{var b;if(h.preventDefault(),/\/search/.test(location.hash))if(u){const m={q:u};d&&(m.type=d),o(m)}else o({});else u?location.hash=`/search?q=${encodeURIComponent(u)}${d?`&type=${d}`:""}`:location.hash="/search";(b=t==null?void 0:t.onSubmit)==null||b.call(t,h)},children:[e("input",{ref:c,value:u,name:"q",type:"search",placeholder:"Search",dir:"auto",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",onSearch:h=>{h.target.value||o({})},onInput:h=>{a(h.target.value),f(!0)},onFocus:()=>{var h,l;f(!0),(l=(h=p.current)==null?void 0:h.querySelector(".search-popover-item"))==null||l.classList.add("focus")},onBlur:()=>{var h,l;setTimeout(()=>{f(!1)},100),(l=(h=p.current)==null?void 0:h.querySelector(".search-popover-item.focus"))==null||l.classList.remove("focus")},onKeyDown:h=>{var b;const{key:l}=h;switch(l){case"Escape":f(!1);break;case"Down":case"ArrowDown":if(h.preventDefault(),r){const m=p.current.querySelector(".search-popover-item.focus");if(m){let S=m.nextElementSibling;for(;S&&S.hidden;)S=S.nextElementSibling;S&&(S.classList.add("focus"),Array.from(S.parentElement.children).filter(y=>y!==S).forEach(y=>{y.classList.remove("focus")}))}else{const S=p.current.querySelector(".search-popover-item");S&&S.classList.add("focus")}}break;case"Up":case"ArrowUp":if(h.preventDefault(),r){const m=document.querySelector(".search-popover-item.focus");if(m){let S=m.previousElementSibling;for(;S&&S.hidden;)S=S.previousElementSibling;S&&(S.classList.add("focus"),Array.from(S.parentElement.children).filter(y=>y!==S).forEach(y=>{y.classList.remove("focus")}))}else{const S=document.querySelector(".search-popover-item:last-child");S&&S.classList.add("focus")}}break;case"Enter":if(r){const m=document.querySelector(".search-popover-item.focus");m&&(h.preventDefault(),m.click()),f(!1),(b=t==null?void 0:t.onSubmit)==null||b.call(t,h)}break}}}),e("div",{class:"search-popover",hidden:!r||!u,children:!!u&&[{label:e(L,{children:[u," ",e("small",{class:"insignificant",children:"‒ accounts, hashtags & posts"})]}),to:`/search?q=${encodeURIComponent(u)}`,top:!d&&!/\s/.test(u),hidden:!!d},{label:e(L,{children:["Posts with ",e("q",{children:u})]}),to:`/search?q=${encodeURIComponent(u)}&type=statuses`,hidden:/^https?:/.test(u),top:/\s/.test(u),icon:"document",queryType:"statuses"},{label:e(L,{children:["Posts tagged with ",e("mark",{children:["#",u.replace(/^#/,"")]})]}),to:`/${s}/t/${u.replace(/^#/,"")}`,hidden:/^@/.test(u)||/^https?:/.test(u)||/\s/.test(u),top:/^#/.test(u),type:"link",icon:"hashtag",queryType:"hashtags"},{label:e(L,{children:["Look up ",e("mark",{children:u})]}),to:`/${u}`,hidden:!/^https?:/.test(u),top:/^https?:/.test(u),type:"link"},{label:e(L,{children:["Accounts with ",e("q",{children:u})]}),to:`/search?q=${encodeURIComponent(u)}&type=accounts`,icon:"group",queryType:"accounts"}].sort((h,l)=>{if(d){if(h.queryType===d)return-1;if(l.queryType===d)return 1}return h.top&&!l.top?-1:!h.top&&l.top?1:0}).filter(({hidden:h})=>!h).map(({label:h,to:l,icon:b,type:m},S)=>e(oe,{to:l,class:`search-popover-item ${S===0?"focus":""}`,onClick:g=>{var y;(y=t==null?void 0:t.onSubmit)==null||y.call(t,g)},children:[e(v,{icon:b||(m==="link"?"arrow-right":"search"),class:"more-insignificant"}),e("span",{children:h})," "]}))})]})}),_a=Je(function({onClose:n=()=>{}}){const[s,i]=E(!1),o=B(null);Le(["Slash","/"],f=>{i(!0),setTimeout(()=>{var u,a,d,p;(a=(u=o.current)==null?void 0:u.focus)==null||a.call(u),(p=(d=o.current)==null?void 0:d.select)==null||p.call(d)},0)},{preventDefault:!0,ignoreEventWhen:f=>{const u=/\/search/.test(location.hash),a=!!document.querySelector("#modal-container > *");return u||a}});const r=()=>{i(!1),n()};return Le("esc",f=>{var u,a;(a=(u=o.current)==null?void 0:u.blur)==null||a.call(u),r()},{enabled:s,enableOnFormTags:!0,preventDefault:!0}),e("div",{id:"search-command-container",hidden:!s,onClick:f=>{f.target===f.currentTarget&&r()},children:e(us,{ref:o,onSubmit:()=>{r()}})})});function La(){const{instance:t}=ee(),n=De($),{shortcuts:s,settings:i}=n;if(!s.length||i.shortcutsViewMode==="multi-column"||!i.shortcutsViewMode&&i.shortcutsColumnsMode)return null;const o=B(),r=B(!1),f=s.map((p,c)=>{const{type:h,...l}=p;if(!hn[h])return null;let{id:b,path:m,title:S,subtitle:g,icon:y}=hn[h];return typeof b=="function"&&(b=b(l,c)),typeof m=="function"&&(m=m({...l,instance:l.instance||t},c)),typeof S=="function"&&(S=S(l,c)),typeof g=="function"&&(g=g(l,c)),typeof y=="function"&&(y=y(l,c)),b==="lists"&&(r.current=!0),{id:b,path:m,title:S,subtitle:g,icon:y}}).filter(Boolean),u=Fi();Le(["1","2","3","4","5","6","7","8","9"],(p,c)=>{var l,b;const h=parseInt(c.keys[0],10)-1;if(h{p.preventDefault(),$.showShortcutsSettings=!0},children:e("ul",{children:f.map(({id:p,path:c,title:h,subtitle:l,icon:b},m)=>e("li",{children:e(oe,{class:l?"has-subtitle":"",to:c,onClick:S=>{if(S.target.classList.contains("is-active")){S.preventDefault();const g=document.getElementById(`${p}-page`);if(g){g.scrollTop=0;const y=g.querySelector(".updates-button");y&&y.click()}}},children:[e(v,{icon:b,size:"xl",alt:h}),e("span",{children:[e(tn,{children:h}),l&&e(L,{children:[e("br",{}),e("small",{children:l})]})]})]})},`${m}-${p}-${h}-${l}-${c}`))})}):e(Ze,{instanceRef:o,overflow:"auto",viewScroll:"close",menuClassName:"glass-menu shortcuts-menu",gap:8,position:"anchor",onMenuChange:p=>{p.open&&r.current&&Yt().then(d)},menuButton:e("button",{type:"button",id:"shortcuts-button",class:"plain",onContextMenu:p=>{p.preventDefault(),$.showShortcutsSettings=!0},onTransitionStart:p=>{var c,h;try{const{target:l}=p;getComputedStyle(l).pointerEvents==="none"&&((h=(c=o.current)==null?void 0:c.closeMenu)==null||h.call(c))}catch{}},children:e(v,{icon:"shortcut",size:"xl",alt:"Shortcuts"})}),children:f.map(({id:p,path:c,title:h,subtitle:l,icon:b},m)=>p==="lists"?e(cn,{menuClassName:"glass-menu",overflow:"auto",gap:-8,label:e(L,{children:[e(v,{icon:b,size:"l"}),e("span",{class:"menu-grow",children:e(tn,{children:h})}),e(v,{icon:"chevron-right"})]}),children:[e(_e,{to:"/l",children:e("span",{children:"All Lists"})}),e(ze,{}),a==null?void 0:a.map(S=>e(_e,{to:`/l/${S.id}`,children:e("span",{children:S.title})},S.id))]}):e(_e,{to:c,class:"glass-menu-item",children:[e(v,{icon:b,size:"l"})," ",e("span",{class:"menu-grow",children:[e("span",{children:e(tn,{children:h})}),l&&e(L,{children:[" ",e("small",{class:"more-insignificant",children:l})]})]}),e("span",{class:"menu-shortcut hide-until-focus-visible",children:m+1})]},`${m}-${p}-${h}-${l}-${c}`))})})}const Ma=Je(La);function Da(t){var o;let n=[],s=[],i=0;for(let r=0;r10&&(s.length>t.length/4||i>=3)){const r=s.map(f=>f.id);if(s.length>t.length*3/4)n=[...n,{id:r,items:s,type:"boosts"}];else{const f=Math.floor(n.length/2);n=[...n.slice(0,f),{id:r,items:s,type:"boosts"},...n.slice(f)]}return n}else return t}function vi(t,n){const s=ye.account.get("boostedStatusIDs")||{},i=t.filter(r=>{if(!r.reblog)return!0;const f=`${n}-${r.reblog.id}`,u=s[f];return u&&u!==r.id?!1:(s[f]=r.id,!0)}),o=Object.keys(s);return o.length>50&&o.slice(0,o.length-50).forEach(r=>{delete s[r]}),ye.account.set("boostedStatusIDs",s),i}function Pa(t,n){const s=[];let i=0;t.forEach(u=>{for(let d=0;dp.id===u.id))return;if(s[d].find(p=>p.id===u.inReplyToId)||s[d].find(p=>p.inReplyToId===u.id)){s[d].push(u);return}}const a=t.find(d=>d.id===u.inReplyToId);a&&(s[i++]=[u,a])});for(let u=0;us[a].includes(p))&&(s[u]=[...s[u],...s[a]],s[u]=s[u].filter((p,c,h)=>h.findIndex(l=>l.id===p.id)===c),s.splice(a,1),a--);s.forEach(u=>{u.sort((a,d)=>!a.inReplyToId&&!d.inReplyToId?new Date(a.createdAt)-new Date(d.createdAt):a.inReplyToId===d.id?1:d.inReplyToId===a.id||!a.inReplyToId?-1:d.inReplyToId?new Date(a.createdAt)-new Date(d.createdAt):1)}),s.forEach(u=>{const a=u[0].account.id;u.forEach(d=>{d.account.id!==a&&(d._differentAuthor=!0)})}),s.length;const o=[],r=[],f=[];return t.forEach(u=>{if(u.reblog){o.push(u);return}for(let a=0;ad.id===u.id)){if(r.includes(a))return;const d=s[a];d.sort((c,h)=>{const l=new Date(c.createdAt),b=new Date(h.createdAt);return l-b});const p=d[0].account.id;o.push({id:d.map(c=>c.id),items:d,type:d.every(c=>c.account.id===p)?"thread":"conversation"}),r.push(a);return}if(u.inReplyToId&&u.inReplyToAccountId!==u.account.id){const a=Xe(u.id,n);$.statusReply[a]||f.push({sKey:a,inReplyToId:u.inReplyToId})}o.push(u)}),f!=null&&f.length&&queueMicrotask(()=>{const{masto:u}=ee({instance:n});async function a(){for(let d=0;dsetTimeout(l,1e3))}catch{}}}if(Ge("@mastodon/fetch-multiple-statuses")){const d=f.map(({inReplyToId:p})=>p);(async()=>{var p;try{const c=await u.v1.statuses.list({id:d});if(c!=null&&c.length)for(const h of c){He(h,n,{skipThreading:!0,skipUnfurling:!0});const l=(p=f.find(({inReplyToId:b})=>b===h.id))==null?void 0:p.sKey;l&&($.statusReply[l]={id:h.id,instance:n})}else a()}catch{a()}})()}else a()}),o}const Na=ft((t,n)=>n.v1.statuses.$select(t).fetch());async function hs(t,n){const s=await wa();if(!s.length)return;const{statusFollowedTags:i}=$,o=[];if(t.forEach(r=>{var h;if(r.reblog)return;const{id:f,content:u,tags:a=[]}=r,d=Xe(f,n);if((h=i[d])!=null&&h.length)return;const p=va(u);if(!p.length&&!a.length)return;const c=s.reduce((l,b)=>((p.some(m=>m.toLowerCase()===b.name.toLowerCase())||a.some(m=>m.name.toLowerCase()===b.name.toLowerCase()))&&l.push(b.name),l),[]);c.length&&o.push({item:r,sKey:d,followedTags:c})}),o.length){const r=o.map(u=>u.item.account),f=await Dn(r);if(!f)return;o.forEach(u=>{const{item:a,sKey:d,followedTags:p}=u,c=f[a.account.id];c&&!c.following&&(i[d]=p)})}}function Ua(){$.statusFollowedTags={}}function Oa({scrollableRef:t,distanceFromStart:n=1,distanceFromEnd:s=1,scrollThresholdStart:i=10,scrollThresholdEnd:o=10,direction:r="vertical",distanceFromStartPx:f,distanceFromEndPx:u}={}){const[a,d]=E(null),[p,c]=E(!1),[h,l]=E(!1),[b,m]=E(!1),[S,g]=E(!1),y=r==="vertical";return ut(()=>{const I=t.current;if(!I)return{};let w=y?I.scrollTop:I.scrollLeft;function k(){const{scrollTop:T,scrollLeft:x,scrollHeight:q,scrollWidth:N,clientHeight:P,clientWidth:J}=I,V=y?T:x,A=y?q:N,D=y?P:J,_=Math.abs(V-w),M=f||Math.min(D*n,A,V),K=u||Math.min(D*s,A,A-V-D);_>=(w=A),m(V<=M),g(V+D>=A-K)}return I.addEventListener("scroll",k,{passive:!0}),()=>I.removeEventListener("scroll",k)},[n,s,i,o]),{scrollDirection:a,reachStart:p,reachEnd:h,nearReachStart:b,nearReachEnd:S,init:()=>{t.current&&t.current.dispatchEvent(new Event("scroll"))}}}function Fa({scrollableRef:t,distanceFromStart:n=1,distanceFromEnd:s=1,scrollThresholdStart:i=10,scrollThresholdEnd:o=10,direction:r="vertical",distanceFromStartPx:f,distanceFromEndPx:u,init:a}={},d,p){if(!d)return;const c=r==="vertical",h=B(null),l=B(null),b=Ws(()=>{let m=!1,S=!1,g=!1,y=!1;const I=t.current,{scrollTop:w,scrollLeft:k,scrollHeight:T,scrollWidth:x,clientHeight:q,clientWidth:N}=I,P=c?w:k,J=c?T:x,V=c?q:N,A=Math.abs(P-h.current),D=f||Math.min(V*n,J,P),_=u||Math.min(V*s,J,J-P-V);A>=(h.current=J,g=P<=D,y=P+V>=J-_,d({scrollDirection:l.current,reachStart:m,reachEnd:S,nearReachStart:g,nearReachEnd:y})},500);ut(()=>{const m=t.current;return m?(h.current=m[c?"scrollTop":"scrollLeft"],m.addEventListener("scroll",b,{passive:!0}),()=>m.removeEventListener("scroll",b)):{}},[n,s,i,o,...p]),W(()=>{a&&t.current&&queueMicrotask(()=>{t.current.dispatchEvent(new Event("scroll"))})},[a])}function za({class:t,statusID:n,status:s,instance:i,parent:o,onMediaClick:r}){let f=Xe(n,i);const u=De($);if(s||(s=u.statuses[f]||u.statuses[n],f=Xe(s==null?void 0:s.id,i)),!s)return null;const{account:{acct:a,avatar:d,avatarStatic:p,id:c,url:h,displayName:l,username:b,emojis:m,bot:S,group:g},id:y,repliesCount:I,reblogged:w,reblogsCount:k,favourited:T,favouritesCount:x,bookmarked:q,poll:N,muted:P,sensitive:J,spoilerText:V,visibility:A,language:D,editedAt:_,filtered:M,card:K,createdAt:ue,inReplyToId:ne,inReplyToAccountId:le,content:te,mentions:we,mediaAttachments:de,reblog:ae,uri:fe,url:Re,emojis:Se,_deleted:Ae,_pinned:Oe}=s;if(!(de!=null&&de.length))return null;const xe=G=>{G.shiftKey},Ie=ge(()=>dt(),[]),Ce=ge(()=>Ie&&Ie===c,[c,Ie]),ve=Ds(ji),Q=!Ce&&Vt(M,ve);if((Q==null?void 0:Q.action)==="hide")return null;const me=J,re=ge(()=>(ye.account.get("preferences")||{})["reading:expand:media"]||"default",[])==="show_all",U=o||"div";return de.map((G,R)=>{const H=`${f}-${G.id}`,X=Q==null?void 0:Q.titlesStr;return e(U,{"data-state-post-id":f,onMouseEnter:xe,"data-spoiler-text":V||(J?"Sensitive media":void 0),"data-filtered-text":Q?`Filtered${X?`: ${X}`:""}`:void 0,class:` media-post ${Q?"filtered":""} ${me?"has-spoiler":""} ${re?"show-media":""} `,children:e(Gi,{class:t,media:G,lang:D,to:`/${i}/s/${y}?media-only=${R+1}`,onClick:r?ce=>r(ce,R,G,s):void 0})},H)})}const ki=Je(za);function Ba(t){var k,T,x,q,N;const n=De($),{masto:s,instance:i,authenticated:o}=ee(),[r,f]=ge(()=>{const P=ye.local.getJSON("accounts")||[];return[P.find(V=>V.info.id===dt())||P[0],P.length>1]},[]),u=(n.settings.shortcutsViewMode==="multi-column"||!n.settings.shortcutsViewMode&&n.settings.shortcutsColumnsMode)&&!n.shortcuts.find(P=>P.type==="following"),a=Ks(()=>{$.showAccounts=!0},{threshold:600,detect:"touch",cancelOnMovement:!0}),d=B(),[p,c]=E(void 0),h=Xs([0,0,n.settings.shortcutsViewMode==="tab-menu-bar"?50:0,0]),l=B();async function b(P){return(P||!l.current)&&(l.current=s.v1.mutes.list({limit:80})),await l.current.next()}const m=B();async function S(P){return(P||!m.current)&&(m.current=s.v1.blocks.list({limit:80})),await m.current.next()}const g=Ge("@mastodon/lists"),[y,I]=E([]);W(()=>{g&&p==="open"&&Yt().then(I)},[p==="open"]);const w=B();return e(L,{children:[e("button",{ref:d,type:"button",class:`button plain nav-menu-button ${f?"with-avatar":""} ${p==="open"?"active":""}`,style:{position:"relative"},onClick:()=>{w.current=Date.now(),c(P=>P?void 0:"open")},onContextMenu:P=>{P.preventDefault(),$.showAccounts=!0},...a(),children:[f&&e(st,{url:((k=r==null?void 0:r.info)==null?void 0:k.avatar)||((T=r==null?void 0:r.info)==null?void 0:T.avatarStatic),size:"l",squircle:(x=r==null?void 0:r.info)==null?void 0:x.bot}),e(v,{icon:"menu",size:f?"s":"l"})]}),e(Yi,{menuClassName:"nav-menu",state:p,anchorRef:d,onClose:()=>{c(void 0)},containerProps:{style:{zIndex:10},onClick:()=>{Date.now()-w.current<300}},portal:{target:document.body},...t,overflow:"auto",viewScroll:"close",position:"anchor",align:"center",boundingBoxPadding:h,unmountOnClose:!0,children:[!!((q=n.appVersion)!=null&&q.commitHash)&&n.appVersion.commitHash!=="20d0b1c"&&e("div",{class:"top-menu",children:[e(pe,{onClick:()=>{confirm("Reload page now to update?")&&(async()=>{try{location.reload()}catch{}})()},children:[e(v,{icon:"sparkles",class:"sparkle-icon",size:"l"})," ",e("span",{children:"New update available…"})]}),e(ze,{})]}),e("section",{children:[e(_e,{to:"/",children:[e(v,{icon:"home",size:"l"})," ",e("span",{children:"Home"})]}),o?e(L,{children:[u&&e(_e,{to:"/following",children:[e(v,{icon:"following",size:"l"})," ",e("span",{children:"Following"})]}),e(_e,{to:"/catchup",children:[e(v,{icon:"history2",size:"l"}),e("span",{children:"Catch-up"})]}),Ge("@mastodon/mentions")&&e(_e,{to:"/mentions",children:[e(v,{icon:"at",size:"l"})," ",e("span",{children:"Mentions"})]}),e(_e,{to:"/notifications",children:[e(v,{icon:"notification",size:"l"})," ",e("span",{children:"Notifications"}),n.notificationsShowNew&&e("sup",{title:"New",style:{opacity:.5},children:[" ","•"]})]}),e(ze,{}),((N=r==null?void 0:r.info)==null?void 0:N.id)&&e(_e,{to:`/${i}/a/${r.info.id}`,children:[e(v,{icon:"user",size:"l"})," ",e("span",{children:"Profile"})]}),(y==null?void 0:y.length)>0?e(cn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(L,{children:[e(v,{icon:"list",size:"l"}),e("span",{class:"menu-grow",children:"Lists"}),e(v,{icon:"chevron-right"})]}),children:[e(_e,{to:"/l",children:e("span",{children:"All Lists"})}),(y==null?void 0:y.length)>0&&e(L,{children:[e(ze,{}),y.map(P=>e(_e,{to:`/l/${P.id}`,children:e("span",{children:P.title})},P.id))]})]}):g&&e(_e,{to:"/l",children:[e(v,{icon:"list",size:"l"}),e("span",{children:"Lists"})]}),e(_e,{to:"/b",children:[e(v,{icon:"bookmark",size:"l"})," ",e("span",{children:"Bookmarks"})]}),e(cn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(L,{children:[e(v,{icon:"more",size:"l"}),e("span",{class:"menu-grow",children:"More…"}),e(v,{icon:"chevron-right"})]}),children:[e(_e,{to:"/f",children:[e(v,{icon:"heart",size:"l"})," ",e("span",{children:"Likes"})]}),e(_e,{to:"/fh",children:[e(v,{icon:"hashtag",size:"l"})," ",e("span",{children:"Followed Hashtags"})]}),e(ze,{}),Ge("@mastodon/filters")&&e(_e,{to:"/ft",children:[e(v,{icon:"filters",size:"l"}),"Filters"]}),e(pe,{onClick:()=>{$.showGenericAccounts={id:"mute",heading:"Muted users",fetchAccounts:b,excludeRelationshipAttrs:["muting"]}},children:[e(v,{icon:"mute",size:"l"})," Muted users…"]}),e(pe,{onClick:()=>{$.showGenericAccounts={id:"block",heading:"Blocked users",fetchAccounts:S,excludeRelationshipAttrs:["blocking"]}},children:[e(v,{icon:"block",size:"l"}),"Blocked users…"]})," "]}),e(ze,{}),e(pe,{onClick:()=>{$.showAccounts=!0},children:[e(v,{icon:"group",size:"l"})," ",e("span",{children:"Accounts…"})]})]}):e(L,{children:[e(ze,{}),e(_e,{to:"/login",children:[e(v,{icon:"user",size:"l"})," ",e("span",{children:"Log in"})]})]})]}),e("section",{children:[e(ze,{}),e(_e,{to:"/search",children:[e(v,{icon:"search",size:"l"})," ",e("span",{children:"Search"})]}),e(_e,{to:`/${i}/trending`,children:[e(v,{icon:"chart",size:"l"})," ",e("span",{children:"Trending"})]}),e(_e,{to:`/${i}/p/l`,children:[e(v,{icon:"building",size:"l"})," ",e("span",{children:"Local"})]}),e(_e,{to:`/${i}/p`,children:[e(v,{icon:"earth",size:"l"})," ",e("span",{children:"Federated"})]}),o?e(L,{children:[e(ze,{className:"divider-grow"}),e(pe,{onClick:()=>{$.showKeyboardShortcutsHelp=!0},children:[e(v,{icon:"keyboard",size:"l"})," ",e("span",{children:"Keyboard shortcuts"})]}),e(pe,{onClick:()=>{$.showShortcutsSettings=!0},children:[e(v,{icon:"shortcut",size:"l"})," ",e("span",{children:"Shortcuts / Columns…"})]}),e(pe,{onClick:()=>{$.showSettings=!0},children:[e(v,{icon:"gear",size:"l"})," ",e("span",{children:"Settings…"})]})]}):e(L,{children:[e(ze,{}),e(pe,{onClick:()=>{$.showSettings=!0},children:[e(v,{icon:"gear",size:"l"})," ",e("span",{children:"Settings…"})]})]})]})]})]})}const Tt=Je(Ba),Xt={block:"nearest",inline:"center",behavior:"smooth"};function pt({title:t,titleComponent:n,id:s,instance:i,emptyText:o,errorText:r,useItemID:f,boostsCarousel:u,fetchItems:a=()=>{},checkForUpdates:d=()=>{},checkForUpdatesInterval:p=15e3,headerStart:c,headerEnd:h,timelineStart:l,refresh:b,view:m,filterContext:S,showFollowedTags:g,showReplyParent:y,clearWhenRefresh:I}){const w=De($),[k,T]=E([]),[x,q]=E("start"),[N,P]=E(!1),[J,V]=E(!1),[A,D]=E(!0),_=B(),M=ge(()=>_n(),[]),K=m!=="media",ue=B(0),ne=Zs(Q=>{V(!1),q("loading"),(async()=>{try{const me=ue.current=Date.now();let{done:F,value:re}=await a(Q);if(me!==ue.current)return;if(Array.isArray(re)){const[U,G]=re.reduce((R,H)=>(H._pinned?R[0].push(H):R[1].push(H),R),[[],[]]);re=G,K&&(u&&(re=Da(re)),re=Pa(re,i)),U.length&&(re=U.concat(re)),T(Q?re:R=>[...R,...re]),re.length||(F=!0),P(!F)}else P(!1);q("default")}catch{q("error")}finally{ne.cancel()}})()},1e3,{leading:!0}),le=".timeline-item, .timeline-item-alt",te=Le("j, shift+j",(Q,me)=>{const F=document.activeElement.closest(le),re=F==null?void 0:F.getBoundingClientRect(),U=Array.from(_.current.querySelectorAll(le));if(F&&re.top<_.current.clientHeight&&re.bottom>0){const G=U.indexOf(F);let R=U[G+1];me.shift&&(R=U.find((H,X)=>X>G&&!H.classList.contains("timeline-item-alt"))),R&&(R.focus(),R.scrollIntoView(Xt))}else{const G=U.find(R=>{const H=R.getBoundingClientRect();return H.top>=44&&H.left>=0});G&&(G.focus(),G.scrollIntoView(Xt))}}),we=Le("k, shift+k",(Q,me)=>{const F=document.activeElement.closest(le),re=F==null?void 0:F.getBoundingClientRect(),U=Array.from(_.current.querySelectorAll(le));if(F&&re.top<_.current.clientHeight&&re.bottom>0){const G=U.indexOf(F);let R=U[G-1];me.shift&&(R=U.findLast((H,X)=>X{const H=R.getBoundingClientRect();return H.top>=44&&H.left>=0});G&&(G.focus(),G.scrollIntoView(Xt))}}),de=Le(["enter","o"],()=>{const Q=document.activeElement;Q!=null&&Q.matches(le)&&Q.click()}),ae=k.length>0&&x!=="loading"&&J,fe=et(()=>{var Q;ae&&ne(!0),(Q=_.current)==null||Q.scrollTo({top:0,behavior:"smooth"})},[ne,ae]),Re=Le(".",fe),Se=B(),[Ae,Oe]=E(!1);Fa({scrollableRef:_,distanceFromEnd:2,scrollThresholdStart:44},({scrollDirection:Q,nearReachStart:me,reachStart:F})=>{if(Se.current){const re=Q==="end"&&!me;Se.current.hidden=re}Oe(me),F&&ne(!0)},[]),W(()=>{var Q;(Q=_.current)==null||Q.scrollTo({top:0}),ne(!0)},[]);const xe=B(!0);W(()=>{var Q;if(xe.current){xe.current=!1;return}I&&(k!=null&&k.length)&&((Q=ne.cancel)==null||Q.call(ne),T([])),ne(!0)},[I,b]);const Ie=B(m);W(()=>{Ie.current!==m&&(Ie.current=m,T([]))},[m]);const Ce=et(async({disableIdleCheck:Q=!1}={})=>{const me=_.current?getComputedStyle(_.current).pointerEvents==="none":!1;w.settings.autoRefresh&&_.current.scrollTop<16&&(Q||window.__IDLE__)&&!Ga()&&!me?ne(!0):await d()&&V(!0)},[s,ne,d,w.settings.autoRefresh]),ve=B();return Lt(Q=>{if(Q){const me=Date.now()-ve.current;(!ve.current||me>1e3*3)&&Ce({disableIdleCheck:!0})}else ve.current=Date.now();D(Q)},[d,Ce,w.settings.autoRefresh]),Mn(Ce,A&&!J?p*(Ae?1:2):null),e(ji.Provider,{value:S,children:e("div",{id:`${s}-page`,class:`deck-container ${M?"deck-container-media-first":""}`,ref:Q=>{_.current=Q,te.current=Q,we.current=Q,de.current=Q,Re.current=Q},tabIndex:"-1",children:e("div",{class:"timeline-deck deck",children:[e("header",{ref:Se,onClick:Q=>{var me;Q.target.closest("a, button")||(me=_.current)==null||me.scrollTo({top:0,behavior:"smooth"})},onDblClick:Q=>{Q.target.closest("a, button")||ne(!0)},class:x==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Tt,{}),c??e(oe,{to:"/",class:"button plain home-button",children:e(v,{icon:"home",size:"l"})})]}),t&&(n||e("h1",{children:t})),e("div",{class:"header-side",children:!!h&&h})]}),ae&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:fe,children:[e(v,{icon:"arrow-up"})," New posts"]})]}),!!l&&e("div",{class:`timeline-start ${x==="loading"?"loading":""}`,children:l}),k.length?e(L,{children:[e("ul",{class:`timeline ${m?`timeline-${m}`:""}`,children:[k.map(Q=>e(Ha,{status:Q,instance:i,useItemID:f,filterContext:S,view:m,showFollowedTags:g,showReplyParent:y,mediaFirst:M},Q.id+(Q==null?void 0:Q._pinned)+m)),N&&x==="loading"&&(m==="media"?null:e(L,{children:[e("li",{style:{height:"20vh"},children:e(Be,{skeleton:!0,mediaFirst:M})}),e("li",{style:{height:"25vh"},children:e(Be,{skeleton:!0,mediaFirst:M})})]}))]}),x==="default"&&(N?e(ht,{root:_.current,rootMargin:`0px 0px ${screen.height*1.5}px 0px`,onChange:Q=>{Q&&ne()},children:e("button",{type:"button",class:"plain block",onClick:()=>ne(),style:{marginBlockEnd:"6em"},children:"Show more…"})}):e("p",{class:"ui-state insignificant",children:"The end."}))]}):x==="loading"?e("ul",{class:"timeline",children:Array.from({length:5}).map((Q,me)=>m==="media"?e("div",{style:{height:"50vh"}}):e("li",{children:e(Be,{skeleton:!0,mediaFirst:M})},me))}):x!=="error"&&x!=="start"&&e("p",{class:"ui-state",children:o}),x==="error"&&e("p",{class:"ui-state",children:[r,e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>ne(!k.length),children:"Try again"})]})]})})})}const Ha=Je(({status:t,instance:n,useItemID:s,filterContext:i,view:o,showFollowedTags:r,showReplyParent:f,mediaFirst:u})=>{const{id:a,reblog:d,items:p,type:c,_pinned:h}=t;h&&(s=!1);const l=(d==null?void 0:d.id)||a,b=n?`/${n}/s/${l}`:`/s/${l}`;if(p){const S=wt(p,i);let g="";if(c==="boosts"?g=`${S.length} Boosts`:c==="pinned"&&(g="Pinned posts"),c==="boosts"||c==="pinned")return S.sort((w,k)=>{const T=Vt(w.filtered,i),x=Vt(k.filtered,i);return T&&!x?1:!T&&x?-1:0}),e("li",{class:"timeline-item-carousel",children:e(qa,{title:g,class:`${c}-carousel`,children:S.map(w=>{const{id:k,reblog:T,_pinned:x}=w,q=(T==null?void 0:T.id)||k,N=n?`/${n}/s/${q}`:`/s/${q}`;return x&&(s=!1),e("li",{children:e(oe,{class:"status-carousel-link timeline-item-alt",to:N,children:s?e(Be,{statusID:k,instance:n,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:u}):e(Be,{status:w,instance:n,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:u})})},k)})})},`timeline-${a}`);const I=S.length>3;return S.map((w,k)=>{const{id:T,_differentAuthor:x}=w,q=n?`/${n}/s/${T}`:`/s/${T}`,N=k>0&&k0||I&&N&&(c==="thread"||c==="conversation"&&!x&&!S[k-1]._differentAuthor&&!S[k+1]._differentAuthor),V=k===0,A=k===S.length-1;return e("li",{class:`timeline-item-container timeline-item-container-type-${c} timeline-item-container-${V?"start":A?"end":"middle"} ${x?"timeline-item-diff-author":""}`,children:e(oe,{class:"status-link timeline-item",to:q,children:J?e(Va,{status:w,instance:n,filterContext:i}):s?e(Be,{statusID:T,instance:n,enableCommentHint:A,showFollowedTags:r}):e(Be,{status:w,instance:n,enableCommentHint:A,showFollowedTags:r})})},`timeline-${T}`)})}const m=`timeline-${a+h}`;return o==="media"?s?e(ki,{class:"timeline-item",parent:"li",statusID:a,instance:n},m):e(ki,{class:"timeline-item",parent:"li",status:t,instance:n},m):e("li",{children:e(oe,{class:"status-link timeline-item",to:b,children:s?e(Be,{statusID:a,instance:n,enableCommentHint:!0,showFollowedTags:r,showReplyParent:f,mediaFirst:u}):e(Be,{status:t,instance:n,enableCommentHint:!0,showFollowedTags:r,showReplyParent:f,mediaFirst:u})})},m)},(t,n)=>{var o,r;const s=(((o=t.status)==null?void 0:o.id)||"").toString(),i=(((r=n.status)==null?void 0:r.id)||"").toString();return s===i&&t.instance===n.instance&&t.view===n.view});function qa({title:t,class:n,children:s}){const i=B(),o=B(),r=B(),[f,u]=E(!1);return W(()=>{setTimeout(()=>{u(!0)},1)},[]),e("div",{class:`status-carousel ${n}`,children:[e("header",{children:[e("h3",{children:t}),e("span",{children:[e("button",{ref:o,type:"button",class:"small plain2",onClick:()=>{var a,d;(d=i.current)==null||d.scrollBy({left:-Math.min(320,(a=i.current)==null?void 0:a.offsetWidth),behavior:"smooth"})},children:e(v,{icon:"chevron-left"})})," ",e("button",{ref:r,type:"button",class:"small plain2",onClick:()=>{var a,d;(d=i.current)==null||d.scrollBy({left:Math.min(320,(a=i.current)==null?void 0:a.offsetWidth),behavior:"smooth"})},children:e(v,{icon:"chevron-right"})})]})]}),e("ul",{ref:i,children:[e(ht,{class:"status-carousel-beacon",onChange:a=>{o.current&&(o.current.disabled=a)}}),s[0],f&&s.slice(1),e(ht,{class:"status-carousel-beacon",onChange:a=>{r.current&&(r.current.disabled=a)}})]})]})}function Va({status:t,instance:n,filterContext:s}){const i=De($),{id:o,visibility:r,language:f}=t,u=Nn(t),a=Xe(o,n),d=Vt(t.filtered,s);return e("article",{class:`status compact-thread ${r==="direct"?"visibility-direct":""}`,tabindex:"-1",children:[i.statusThreadNumber[a]?e("div",{class:"status-thread-badge",children:[e(v,{icon:"thread",size:"s"}),i.statusThreadNumber[a]?` ${i.statusThreadNumber[a]}/X`:""]}):e("div",{class:"status-thread-badge",children:e(v,{icon:"thread",size:"s"})}),e("div",{class:"content-compact",title:u,lang:f,dir:"auto",children:d?e("b",{class:"status-filtered-badge badge-meta horizontal",title:(d==null?void 0:d.titlesStr)||"",children:[e("span",{children:"Filtered"}),": ",e("span",{children:(d==null?void 0:d.titlesStr)||""})]}):e(L,{children:[u,t.sensitive&&t.spoilerText&&e(L,{children:[" ",e("span",{class:"spoiler-badge",children:e(v,{icon:"eye-close",size:"s"})})]})]})})]})}function Ga(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}const At=20,Wn=1983,Si=`${Wn}-01`,ja=(()=>{try{const t=document.createElement("input");return t.setAttribute("type","month"),t.type==="month"}catch{return!1}})();async function Ya(t){var i;const{masto:n}=ee({instance:t}),s=await n.v2.search.fetch({q:"from:me",type:"statuses",limit:1});return!!((i=s==null?void 0:s.statuses)!=null&&i.length)}const Wa=ft(Ya);function Ka(){const t=De($),{id:n,...s}=St(),[i,o]=ot(),r=i.get("month"),f=!i.get("replies"),u=!!i.get("boosts"),a=i.get("tagged"),d=!!i.get("media"),{masto:p,instance:c,authenticated:h}=ee({instance:s.instance}),{masto:l,instance:b}=ee(),m=B(),S=[r,f,u,a,d],[g,y]=E(),I=B(0);W(()=>{I.current=0},S);const w=ge(()=>_n(),[]),k=ge(()=>c===b,[c,b]),[T,x]=E(!1);W(()=>{k&&g!=null&&g.acct&&(async()=>{const te=await Wa(c);x(te)})()},[c,k,g==null?void 0:g.acct]);async function q(te){var Se,Ae,Oe,xe;const we=/^\d{4}-[01]\d$/.test(r),de=((Ae=(Se=r==null?void 0:r.split)==null?void 0:Se.call(r,"-"))==null?void 0:Ae[0])>=Wn;if(we&&de){if(!g)return{value:[],done:!0};const[Ie,Ce]=r.split("-"),ve=parseInt(Ce,10)-1,Q=new Date(Ie,ve,0),me=`${Q.getFullYear()}-${(Q.getMonth()+1).toString().padStart(2,"0")}-${Q.getDate().toString().padStart(2,"0")}`,F=new Date(Ie,ve+1,1),re=`${F.getFullYear()}-${(F.getMonth()+1).toString().padStart(2,"0")}-${F.getDate().toString().padStart(2,"0")}`;let U;te?(U=At+1,I.current=0):(U=At+I.current+1,I.current+=At);const G=await p.v2.search.fetch({q:`from:${g.acct} after:${me} before:${re}`,type:"statuses",limit:U,offset:I.current});if((Oe=G==null?void 0:G.statuses)!=null&&Oe.length){const R=G.statuses.slice(0,At);R.forEach(X=>{He(X,c)});const H=G.statuses.length<=At;return{value:R,done:H}}else return{value:[],done:!0}}let ae=[];if(te){const{value:Ie}=await p.v1.accounts.$select(n).statuses.list({pinned:!0}).next();if(Ie!=null&&Ie.length&&!a&&!d){const Ce=Ie.map(ve=>(He(ve,c),{...ve,_pinned:!0}));if(Ce.length>=3){const ve=Ce.map(Q=>Q.id);ae.push({id:ve,items:Ce,type:"pinned"})}else ae.push(...Ce)}}(te||!m.current)&&(m.current=p.v1.accounts.$select(n).statuses.list({limit:At,exclude_replies:f,exclude_reblogs:u,only_media:d||void 0,tagged:a}));const{value:fe,done:Re}=await m.current.next();if(fe!=null&&fe.length){if(ae.length){let Ie=[];((xe=ae[0])==null?void 0:xe.type)==="pinned"?Ie=ae[0].id:Ie=ae.filter(ve=>ve._pinned).map(ve=>ve.id),Ie.every(ve=>fe.some(Q=>Q.id===ve))&&(ae=[])}ae.push(...fe),fe.forEach(Ie=>{He(Ie,c)})}return{value:ae,done:Re}}const[N,P]=E([]);qe(g!=null&&g.acct?`${g!=null&&g.displayName?`${g.displayName} (${/@/.test(g.acct)?"":"@"}${g.acct})`:`${/@/.test(g.acct)?"":"@"}${g.acct}`}${f?u?" (- Boosts)":a?` (#${a})`:d?" (Media)":r?` (${new Date(r).toLocaleString("default",{month:"long",year:"numeric"})})`:"":" (+ Replies)"}`:"Account posts","/:instance?/a/:id");const J=B(),V=et(()=>{const te=J.current||p.v1.accounts.$select(n).fetch();return J.current=te,te},[n,p]);W(()=>{(async()=>{try{const te=await V();y(te)}catch{}if(!w)try{const te=await p.v1.accounts.$select(n).featuredTags.list();P(te)}catch{}})()},[n,w]);const{displayName:A,acct:D,emojis:_}=g||{},M=B(),K=ge(()=>{const te=!f||u||a||d||!!r,we=t.accounts[`${n}@${c}`];return e(L,{children:[e(cs,{instance:c,account:we||n,fetchAccount:V,authenticated:h,standalone:!0}),!w&&e("div",{class:"filter-bar",ref:M,style:{position:"relative"},children:[te?e(oe,{to:`/${c}/a/${n}`,class:"insignificant filter-clear",title:"Clear filters",children:e(v,{icon:"x",size:"l"})},"clear-filters"):e(v,{icon:"filter",class:"insignificant",size:"l"}),e(oe,{to:`/${c}/a/${n}${f?"?replies=1":""}`,onClick:()=>{f&&ie("Showing post with replies")},class:f?"":"is-active",children:"+ Replies"}),e(oe,{to:`/${c}/a/${n}${u?"":"?boosts=0"}`,onClick:()=>{u||ie("Showing posts without boosts")},class:u?"is-active":"",children:"- Boosts"}),e(oe,{to:`/${c}/a/${n}${d?"":"?media=1"}`,onClick:()=>{d||ie("Showing posts with media")},class:d?"is-active":"",children:"Media"}),N.map(de=>e(oe,{to:`/${c}/a/${n}${a===de.name?"":`?tagged=${encodeURIComponent(de.name)}`}`,onClick:()=>{a!==de.name&&ie(`Showing posts tagged with #${de.name}`)},class:a===de.name?"is-active":"",children:e("span",{children:[e("span",{class:"more-insignificant",children:"#"}),de.name]})},de.id)),T&&(ja?e("label",{class:`filter-field ${r?"is-active":""}`,children:[e(v,{icon:"month",size:"l"}),e("input",{type:"month",disabled:!(g!=null&&g.acct),value:r||"",min:Si,max:new Date().toISOString().slice(0,7),onInput:de=>{const{value:ae,validity:fe}=de.currentTarget;if(!fe.valid)return;o(ae?{month:ae}:{});const[Re,Se]=ae.split("-"),Ae=parseInt(Se,10)-1,Oe=new Date(Re,Ae);ie(`Showing posts in ${Oe.toLocaleString("default",{month:"long",year:"numeric"})}`)}})]}):e(Xa,{class:`filter-field ${r?"is-active":""}`,disabled:!(g!=null&&g.acct),value:r||"",min:Si,max:new Date().toISOString().slice(0,7),onInput:de=>{const{value:ae,validity:fe}=de;fe.valid&&o(ae?{month:ae}:{})}}))]})]})},[n,c,h,N,V,T,...S]);W(()=>{var we;const te=(we=M.current)==null?void 0:we.querySelector(".is-active");te&&M.current.scrollTo({behavior:"smooth",left:te.offsetLeft-(M.current.offsetWidth-te.offsetWidth)/2})},[N,T,...S]);const ue=ge(()=>g!=null&&g.url?URL.parse(g.url).hostname:null,[g]),le=!!g&&!(c===ue);return e(pt,{title:`${g!=null&&g.acct?"@"+g.acct:"Posts"}`,titleComponent:e("h1",{class:"header-double-lines header-account",children:[e("b",{children:e(qi,{text:A,emojis:_})}),e("div",{children:e("span",{children:["@",D]})})]}),id:"account-statuses",instance:c,emptyText:"Nothing to see here yet.",errorText:"Unable to load posts",fetchItems:q,useItemID:!0,view:d||w?"media":void 0,boostsCarousel:t.settings.boostsCarousel,timelineStart:K,refresh:[f,u,a,d,r+(g==null?void 0:g.acct)].toString(),headerEnd:e(Ze,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(v,{icon:"more",size:"l"})}),children:[e(pe,{disabled:!le,onClick:()=>{(async()=>{try{const{masto:te}=ee({instance:ue}),we=await te.v1.accounts.lookup({acct:g.acct}),{id:de}=we;location.hash=`/${ue}/a/${de}`}catch{alert("Unable to fetch account info")}})()},children:[e(v,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:["Switch to account's instance"," ",ue?e(L,{children:[" ","(",e("b",{children:Ut.toUnicode(ue)}),")"]}):null]})]}),!k&&e(pe,{onClick:()=>{(async()=>{try{const te=await l.v1.accounts.lookup({acct:g.acct+"@"+c}),{id:we}=te;location.hash=`/${b}/a/${we}`}catch{alert("Unable to fetch account info")}})()},children:[e(v,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:["Switch to my instance (",e("b",{children:b}),")"]})]})]})},n)}function Xa(t){const{class:n,disabled:s,value:i,min:o,max:r,onInput:f=()=>{}}=t,[u,a]=(i==null?void 0:i.split("-"))||[],d=B(),p=B(),c=(h,l)=>{const[b,m]=(o==null?void 0:o.split("-"))||[],[S,g]=(r==null?void 0:r.split("-"))||[];return!(lS||l===b&&hg)};return e("div",{class:n,children:[e(v,{icon:"month",size:"l"}),e("select",{ref:d,disabled:s,value:a||"",onInput:h=>{const{value:l}=h.currentTarget,b=p.current.value;if(!c(l,b))return{value:"",validity:{valid:!1}};f({value:l?`${b}-${l}`:"",validity:{valid:!0}})},children:[e("option",{value:"",children:"Month"}),e("option",{disabled:!0,children:"-----"}),Array.from({length:12},(h,l)=>e("option",{value:(l+1).toString().padStart(2,"0"),children:new Date(0,l).toLocaleString("default",{month:"long"})},l))]})," ",e("input",{ref:p,type:"number",disabled:s,value:u||new Date().getFullYear(),min:(o==null?void 0:o.slice(0,4))||Wn,max:(r==null?void 0:r.slice(0,4))||new Date().getFullYear(),onInput:h=>{const{value:l,validity:b}=h.currentTarget,m=d.current.value;if(!b.valid||!c(m,l))return{value:"",validity:{valid:!1}};f({value:l?`${l}-${m}`:"",validity:{valid:!0}})},style:{width:"4.5em"}})]})}const Za=20;function fs(){qe("Bookmarks","/b");const{masto:t,instance:n}=ee(),s=B();async function i(o){return(o||!s.current)&&(s.current=t.v1.bookmarks.list({limit:Za})),await s.current.next()}return e(pt,{title:"Bookmarks",id:"bookmarks",emptyText:"No bookmarks yet. Go bookmark something!",errorText:"Unable to load bookmarks",instance:n,fetchItems:i})}const Ja=""+new URL("catch-up-DuauQu-W.png",import.meta.url).href,Qa="home",Ke=[{label:"last 1 hour",value:1},{label:"last 2 hours",value:2},{label:"last 3 hours",value:3},{label:"last 4 hours",value:4},{label:"last 5 hours",value:5},{label:"last 6 hours",value:6},{label:"last 7 hours",value:7},{label:"last 8 hours",value:8},{label:"last 9 hours",value:9},{label:"last 10 hours",value:10},{label:"last 11 hours",value:11},{label:"last 12 hours",value:12},{label:"beyond 12 hours",value:13}],er=["Original","Replies","Boosts","Followed tags","Groups","Filtered"],tr=["createdAt","repliesCount","favouritesCount","reblogsCount","density"],nr=[null,"account"],Ii={Filtered:"filtered",Groups:"group",Boosts:"boost",Replies:"reply","Followed tags":"followedTags",Original:"original"},ir={Filtered:"filtered posts",Groups:"group posts",Boosts:"boosts",Replies:"replies","Followed tags":"followed-tag posts",Original:"original posts"},sr={createdAt:["oldest","latest"],repliesCount:["fewest replies","most replies"],favouritesCount:["fewest likes","most likes"],reblogsCount:["fewest boosts","most boosts"],density:["least dense","most dense"]};function or(){qe("Catch-up","/catchup");const{masto:t,instance:n}=ee(),[s,i]=ot(),o=s.get("id"),[r,f]=E("start"),[u,a]=E(!1),d=ge(()=>dt(),[]),p=C=>C===d,c=Ge("@pixelfed/home-include-reblogs");async function h({maxCreatedAt:C}){var Z,be,he;const O=C?new Date(C):null,j=[],z=t.v1.timelines.home.list({limit:40});e:for(;;)try{c&&z.nextParams&&(typeof z.nextParams=="string"?z.nextParams+="&include_reblogs=true":z.nextParams.include_reblogs=!0);const se=await z.next(),{value:Te}=se;if(Te!=null&&Te.length){await hs(Te,n);let Ne=!1;for(let Fe=0;Fe=O){const ke=!p(((be=(Z=Me.reblog)==null?void 0:Z.account)==null?void 0:be.id)||Me.account.id)&&Vt(((he=Me.reblog)==null?void 0:he.filtered)||Me.filtered,Qa);if((ke==null?void 0:ke.action)==="hide")continue;Me._filtered=ke;const nt=Xe(Me.id,n);Me._followedTags=$.statusFollowedTags[nt]?[...$.statusFollowedTags[nt]]:[],j.push(Me),Ne=!0}if(!Ne)break e}}else break e;await new Promise(Ne=>setTimeout(Ne,1e3))}catch{break e}return j.forEach(se=>{if(se!=null&&se.inReplyToId){const Te=j.find(Ne=>Ne.id===se.inReplyToId);Te&&!Te.inReplyToId&&(Te._thread=!0)}}),j}const[l,b]=E([]),m=B(),S=B(),g=ge(()=>rn(),[]),y=et(async({duration:C}={})=>{const O=Date.now(),j=C?O-C:null;f("loading");const z=await h({maxCreatedAt:j}),Z=`${g}-${Js()}`;try{await it.catchup.set(Z,{id:Z,posts:z,count:z.length,startAt:j,endAt:O}),i({id:Z})}catch{}},[]);W(()=>{o?(async()=>{const C=await it.catchup.get(o);C&&(C.posts.sort((O,j)=>O.createdAt>j.createdAt?1:-1),b(C.posts),f("results"))})():r==="results"&&(b([]),f("start"))},[o]);const[I,w]=kt(C=>C+1,0),[k,T]=E(null),[x,q]=E([]);W(()=>{(async()=>{try{const C=await it.catchup.keys();if(C.length){const O=rn(),j=C.filter(z=>z.startsWith(`${O}-`));if(j.length){let z=await it.catchup.getMany(j);z.sort((se,Te)=>Te.endAt-se.endAt);let Z=z.slice(0,3),be=z.slice(3);const he=Z.map(se=>{const{id:Te,count:Ne,startAt:Fe,endAt:Me}=se;return{id:Te,count:Ne,startAt:Fe,endAt:Me}});q(he),T(Z[0].endAt),z=null,Z=null,queueMicrotask(()=>{be.length&&it.catchup.delMany(be.map(se=>se.id)).then(()=>{be=null}).catch(se=>{})});return}}}catch{}q([])})()},[I]),W(()=>{r==="start"&&w()},[r==="start"]);const[N,P]=ge(()=>{var Te,Ne,Fe,Me,Ve;let C=0,O=0,j=0,z=0,Z=0,be=0;const he={};for(const Y of l){Y._filtered?(C++,Y.__FILTER="filtered"):Y.group?(O++,Y.__FILTER="group"):Y.reblog?(j++,Y.__FILTER="boost"):(Te=Y._followedTags)!=null&&Te.length?(Z++,Y.__FILTER="followedTags"):Y.inReplyToId&&Y.inReplyToAccountId!==((Ne=Y.account)==null?void 0:Ne.id)?(z++,Y.__FILTER="reply"):(be++,Y.__FILTER="original");const ke=Y.reblog||Y;if(Y.__FILTER!=="filtered"&&((Fe=ke.card)!=null&&Fe.url)&&((Me=ke.card)!=null&&Me.image)&&((Ve=ke.card)==null?void 0:Ve.type)==="link"){const{card:nt,favouritesCount:Wt,reblogsCount:bt}=ke;let{url:Ye}=nt;if(Ye=Ye.replace(/\/$/,""),!he[Ye])he[Ye]={postID:ke.id,card:nt,shared:1,sharers:[Y.account],likes:Wt,boosts:bt};else{if(he[Ye].sharers.find(xt=>xt.id===Y.account.id))continue;he[Ye].shared++,he[Ye].sharers.push(Y.account),he[Ye].postID!==ke.id&&(he[Ye].likes+=Wt,he[Ye].boosts+=bt)}}}let se=[];for(const Y in he)se.push({url:Y,...he[Y]});if(se.sort((Y,ke)=>Y.shared>ke.shared?-1:Y.sharedke.boosts?-1:Y.boostske.likes?-1:Y.likes10)e:for(let Y=10;Y{const C={},O=new Map;let j=l.filter(Z=>{const be=J==="All"||Z.__FILTER===Ii[J];return be&&(C[Z.account.id]=Z.account,O.set(Z.account.id,(O.get(Z.account.id)||0)+1)),be});const z={};return j.forEach(Z=>{Z.reblog&&(z[Z.reblog.id]?(z[Z.reblog.id].__BOOSTERS?z[Z.reblog.id].__BOOSTERS.add(Z.account):z[Z.reblog.id].__BOOSTERS=new Set([Z.account]),Z.__HIDDEN=!0):z[Z.reblog.id]=Z)}),A&&O.has(A)&&(j=j.filter(Z=>Z.account.id===A||[...Z.__BOOSTERS||[]].find(be=>be.id===A))),[j,C,Object.fromEntries(O)]},[J,A,l]),Re=ge(()=>{const C={};return de.forEach(O=>{C[O.id]=O}),C},[de]),Se=ge(()=>Object.keys(fe).sort((C,O)=>fe[O]-fe[C]),[fe]),Ae=ge(()=>{const C={};return Se.forEach((O,j)=>{C[O]=j}),de.filter(O=>!O.__HIDDEN).sort((O,j)=>{if(te==="account"){const z=O.account.id,Z=j.account.id,be=C[z],he=C[Z],se=be-he;if(se!==0)return se}if(K!=="createdAt"&&(O=O.reblog||O,j=j.reblog||j,K!=="density"&&O[K]===j[K]))return O.createdAt>j.createdAt?1:-1;if(K==="density"){const z=Ci(O),Z=Ci(j);return ne==="asc"?z>Z?1:-1:Z>z?1:-1}return ne==="asc"?O[K]>j[K]?1:-1:j[K]>O[K]?1:-1})},[de,K,ne,te,Se]),Oe=B(null),xe=B(null),Ie=B(!1);W(()=>{l.length>100||Ie.current||xe.current&&(ns(xe.current,{duration:200}),Ie.current=!0)},[l,xe]);const Ce=l.length>160?"3d":"2d",ve=ge(()=>Ce!=="2d"?null:l.map(C=>{const O=Re[C.id];return e("span",{class:`post-dot ${O?"post-dot-highlight":""}`},C.id)}),[Re]),Q=ge(()=>Ce!=="3d"||!(l!=null&&l.length)?null:fr(l,"createdAt",320).map((O,j)=>e("div",{class:"posts-bin",children:O.map(z=>{const Z=Re[z.id];return e("span",{class:`post-dot ${Z?"post-dot-highlight":""}`},z.id)})},j)),[Re]),me=B(null),F=ge(()=>k?(Date.now()-k)/1e3/60/60:null,[k,_]);W(()=>{if(r!=="results")return;const C=A&&ae[A]?ae[A].username:"",O=ne==="asc"?0:1,j={account:"authors"};let z=ie({duration:5e3,text:`Showing ${ir[J]||"all posts"}${C?` by @${C}`:""}, ${sr[K][O]} first${te?`, grouped by ${te==="account"?j[te]:""}`:""}`});return()=>{var Z;(Z=z==null?void 0:z.hideToast)==null||Z.call(z)}},[r,J,A,K,ne,te,ae]),W(()=>{var C;if(A&&ae[A]){const O=xe.current.querySelector(`[data-author="${A}"]`),j=(C=xe.current)==null?void 0:C.getBoundingClientRect(),z=O==null?void 0:O.getBoundingClientRect();z.leftj.right?O.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}):z.top<0&&O.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})}},[A,ae]);const[re,U]=E(!1),G=".catchup-list > li > a",R=Le("j",()=>{const C=document.activeElement.closest(G),O=C==null?void 0:C.getBoundingClientRect(),j=Array.from(me.current.querySelectorAll(G));if(C&&O.top0){const z=j.indexOf(C),Z=j[z+1];Z&&(Z.focus(),Z.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const z=j.find(Z=>Z.getBoundingClientRect().top>=0);z&&(z.focus(),z.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{preventDefault:!0,ignoreModifiers:!0}),H=Le("k",()=>{const C=document.activeElement.closest(G),O=C==null?void 0:C.getBoundingClientRect(),j=Array.from(me.current.querySelectorAll(G));if(C&&O.top0){const z=j.indexOf(C);let Z=j[z-1];Z&&(Z.focus(),Z.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const z=j.find(Z=>{const be=Z.getBoundingClientRect();return be.top>=44&&be.left>=0});z&&(z.focus(),z.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{preventDefault:!0,ignoreModifiers:!0}),X=Le("h, l",(C,O)=>{var z,Z,be;const j=O.keys[0];if(A){const he=Se.indexOf(A);j==="h"?he>0&&he=0&&(D(Se[he+1]),(Z=me.current)==null||Z.focus())}else j==="l"&&(D(Se[0]),(be=me.current)==null||be.focus())},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]}),ce=Le("esc",()=>{var C;D(null),(C=me.current)==null||C.focus()},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]}),Pe=Le(".",()=>{var C;(C=me.current)==null||C.scrollTo({top:0,behavior:"smooth"})},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]});return e("div",{ref:C=>{me.current=C,R.current=C,H.current=C,X.current=C,ce.current=C},id:"catchup-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck wide",children:[e("header",{class:`${r==="loading"?"loading":""}`,onClick:C=>{var O;C.target.closest("a, button")||(O=me.current)==null||O.scrollTo({top:0,behavior:"smooth"})},children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Tt,{}),r==="results"&&e(oe,{to:"/catchup",class:"button plain",children:e(v,{icon:"history2",size:"l"})}),r==="start"&&e(oe,{to:"/",class:"button plain",children:e(v,{icon:"home",size:"l"})})]}),e("h1",{children:r!=="start"&&e(L,{children:["Catch-up ",e("sup",{children:"beta"})]})}),e("div",{class:"header-side",children:r!=="start"&&r!=="loading"&&e("button",{type:"button",class:"plain",onClick:()=>{U(!0)},children:"Help"})})]})}),e("main",{children:[r==="start"&&e("div",{class:"catchup-start",children:[e("h1",{children:["Catch-up ",e("sup",{children:"beta"})]}),e("details",{children:[e("summary",{children:"What is this?"}),e("p",{children:"Catch-up is a separate timeline for your followings, offering a high-level view at a glance, with a simple, email-inspired interface to effortlessly sort and filter through posts."}),e("img",{src:Ja,width:"1200",height:"900",alt:"Preview of Catch-up UI"}),e("p",{children:e("button",{type:"button",onClick:C=>{C.target.closest("details").open=!1},children:"Let's catch up"})})]}),e("p",{children:"Let's catch up on the posts from your followings."}),e("p",{children:e("b",{children:"Show me all posts from…"})}),e("div",{class:"catchup-form",children:[e("input",{ref:m,type:"range",value:_,min:Ke[0].value,max:Ke[Ke.length-1].value,step:"1",list:"catchup-ranges",onChange:C=>M(+C.target.value)})," ",e("span",{style:{width:"8em"},children:[Ke[_-1].label,e("br",{}),e("small",{class:"insignificant",children:_==Ke[Ke.length-1].value?"until the max":rt(new Date(Date.now()-_*60*60*1e3))})]}),e("datalist",{id:"catchup-ranges",children:Ke.map(({label:C,value:O})=>e("option",{value:O,label:C}))})," ",e("button",{type:"button",onClick:()=>{var C;if(_F?e("p",{class:"catchup-info",children:[e(v,{icon:"info"})," Overlaps with your last catch-up"]}):_===Ke[Ke.length-1].value&&k?e("p",{class:"catchup-info",children:e("label",{children:[e("input",{type:"checkbox",switch:!0,checked:!0,ref:S})," ","Until the last catch-up (",Zt.format(new Date(k)),")"]})}):null,e("p",{class:"insignificant",children:e("small",{children:"Note: your instance might only show a maximum of 800 posts in the Home timeline regardless of the time range. Could be less or more."})}),!!(x!=null&&x.length)&&e("div",{class:"catchup-prev",children:[e("p",{children:"Previously…"}),e("ul",{children:x.map(C=>e("li",{children:[e(oe,{to:`/catchup?id=${C.id}`,children:[e(v,{icon:"history2"})," ",e("span",{children:C.startAt?Zt.formatRange(new Date(C.startAt),new Date(C.endAt)):`… – ${Zt.format(new Date(C.endAt))}`})]})," ",e("span",{children:[e("small",{class:"ib insignificant",children:[C.count," posts"]})," ",e("button",{type:"button",class:"light danger small",onClick:async()=>{var j;if(confirm("Remove this catch-up?")){let z=ie(`Removing Catch-up ${C.id}`);await it.catchup.del(C.id),(j=z==null?void 0:z.hideToast)==null||j.call(z),ie(`Catch-up ${C.id} removed`),w()}},children:e(v,{icon:"x"})})]})]},C.id))}),x.length>=3&&e("p",{children:e("small",{children:"Note: Only max 3 will be stored. The rest will be automatically removed."})})]})]}),r==="loading"&&e("div",{class:"ui-state catchup-start",children:[e($e,{abrupt:!0}),e("p",{class:"insignificant",children:"Fetching posts…"}),e("p",{class:"insignificant",children:"This might take a while."})]}),r==="results"&&e(L,{children:[e("div",{class:"catchup-header",children:[l.length>0&&e("p",{children:e("b",{class:"ib",children:Zt.formatRange(new Date(l[0].createdAt),new Date(l[l.length-1].createdAt))})}),e("aside",{children:[e("button",{hidden:J==="All"&&!A&&K==="createdAt"&&ne==="asc",type:"button",class:"plain4 small",onClick:()=>{V("All"),D(null),ue("createdAt"),we(null),le("asc")},children:"Reset filters"}),(P==null?void 0:P.length)>0&&e("button",{type:"button",class:"plain small",onClick:()=>a(!u),children:["Top links"," ",e(v,{icon:"chevron-down",style:{transform:u?"rotate(180deg)":"rotate(0deg)"}})]})]})]}),e("div",{class:"shazam-container no-animation",hidden:!u,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"catchup-top-links links-bar",children:P.map(C=>{const{card:O,shared:j,sharers:z,likes:Z,boosts:be}=C,{blurhash:he,title:se,description:Te,url:Ne,image:Fe,imageDescription:Me,language:Ve,width:Y,height:ke,publishedAt:nt}=O,Wt=Ut.toUnicode(URL.parse(Ne).hostname.replace(/^www\./,"").replace(/\/$/,""));let bt;if(he){const Ye=Pn(he),xt=Gn(Ye);bt=jn([.6,xt[1],xt[2]])}return e("a",{href:Ne,target:"_blank",rel:"noopener noreferrer",style:bt?{"--accent-color":`rgb(${bt.join(",")})`,"--accent-alpha-color":`rgba(${bt.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:Fe,alt:Me,width:Y,height:ke,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:Wt})," ",!!nt&&e(L,{children:"· "}),!!nt&&e(L,{children:e(It,{datetime:nt,format:"micro"})})]}),!!se&&e("h1",{class:"title",lang:Ve,dir:"auto",title:se,children:se})]}),!!Te&&e("p",{class:"description",lang:Ve,dir:"auto",title:Te,children:Te}),e("hr",{}),e("p",{style:{whiteSpace:"nowrap"},children:["Shared by"," ",z.map(Ye=>{const{avatarStatic:xt,displayName:$s}=Ye;return e(st,{url:xt,size:"s",alt:$s})})]})]})]})},Ne)})})})}),l.length>=5&&(Ce==="3d"?e("div",{class:"catchup-posts-viz-time-bar",children:Q}):e("div",{class:"catchup-posts-viz-bar",children:ve})),l.length>=2&&e("div",{class:"catchup-filters",children:[e("label",{class:"filter-cat",children:[e("input",{type:"radio",name:"filter-cat",checked:J.toLowerCase()==="all",onChange:()=>{V("All")}}),"All ",e("span",{class:"count",children:l.length})]}),er.map(C=>!!N[C]&&e("label",{class:"filter-cat",title:(N[C]/l.length*100).toFixed(2)+"%",children:[e("input",{type:"radio",name:"filter-cat",checked:J.toLowerCase()===C.toLowerCase(),onChange:()=>{V(C)}}),C," ",e("span",{class:"count",children:N[C]})]},C))]}),l.length>=2&&!!fe&&e("div",{class:"catchup-filters authors-filters",ref:xe,children:[Se.map(C=>e("label",{class:"filter-author","data-author":C,children:[e("input",{type:"radio",name:"filter-author",checked:A===C,onChange:()=>{D(C)},onClick:()=>{A===C&&D(null)}}),e(st,{url:ae[C].avatarStatic||ae[C].avatar,size:"xxl",alt:`${ae[C].displayName} (@${ae[C].acct})`})," ",e("span",{class:"count",children:fe[C]}),e("span",{class:"username",children:ae[C].username})]},`${C}-${fe[C]}`)),Se.length>5&&e("small",{style:{whiteSpace:"nowrap",paddingInline:"1em",opacity:.33},children:[Se.length," authors"]},"authors-count")]}),l.length>=2&&e("div",{class:"catchup-filters",children:[e("span",{class:"filter-label",children:"Sort"})," ",e("fieldset",{class:"radio-field-group",children:tr.map(C=>e("label",{class:"filter-sort",onClick:O=>{K===C&&(O.preventDefault(),O.stopPropagation(),le(ne==="asc"?"desc":"asc"))},children:[e("input",{type:"radio",name:"filter-sort-cat",checked:K===C,onChange:()=>{ue(C);const O=/(replies|favourites|reblogs)/.test(C)?"desc":"asc";le(O)}}),{createdAt:"Date",repliesCount:"Replies",favouritesCount:"Likes",reblogsCount:"Boosts",density:"Density"}[C],K===C&&(ne==="asc"?" ↑":" ↓")]},C))}),e("span",{class:"filter-label",children:"Group"})," ",e("fieldset",{class:"radio-field-group",children:nr.map(C=>e("label",{class:"filter-group",children:[e("input",{type:"radio",name:"filter-group",checked:te===C,onChange:()=>{we(C)},disabled:C==="account"&&A}),{account:"Authors"}[C]||"None"]},C||"none"))}),A&&Se.length>1?e("button",{type:"button",class:"plain6 small",onClick:()=>{D(null)},style:{whiteSpace:"nowrap"},children:"Show all authors"}):null]}),e("ul",{class:`catchup-list catchup-filter-${Ii[J]||""} ${K?`catchup-sort-${K}`:""} ${A&&ae[A]?"catchup-selected-author":""} ${te?`catchup-group-${te}`:""}`,children:Ae.map((C,O)=>{var Z;const j=((Z=C.reblog)==null?void 0:Z.id)||C.id;let z=!1;return te==="account"&&(Oe.current&&C.account.id!==Oe.current&&O>0&&(z=!0),Oe.current=C.account.id),e(L,{children:[z&&e("li",{class:"separator"}),e(rr,{to:`/${n}/s/${j}`,post:C,root:me.current})]},`${C.id}-${z}`)})}),e("footer",{children:de.length>5&&e("p",{children:[J==="Boosts"?"You don't have to read everything.":"That's all."," ",e("button",{type:"button",class:"textual",onClick:()=>{me.current.scrollTop=0},children:"Back to top"}),"."]})})]})]})]}),re&&e(Ee,{onClose:()=>U(!1),children:e("div",{class:"sheet",id:"catchup-help-sheet",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>U(!1),children:e(v,{icon:"x"})}),e("header",{children:e("h2",{children:"Help"})}),e("main",{children:e("dl",{children:[e("dt",{children:"Top links"}),e("dd",{children:"Links shared by followings, sorted by shared counts, boosts and likes."}),e("dt",{children:"Sort: Density"}),e("dd",{children:'Posts are sorted by information density or depth. Shorter posts are "lighter" while longer posts are "heavier". Posts with photos are "heavier" than posts without photos.'}),e("dt",{children:"Group: Authors"}),e("dd",{children:"Posts are grouped by authors, sorted by posts count per author."}),e("dt",{children:"Keyboard shortcuts"}),e("dd",{children:[e("kbd",{children:"j"}),": Next post"]}),e("dd",{children:[e("kbd",{children:"k"}),": Previous post"]}),e("dd",{children:[e("kbd",{children:"l"}),": Next author"]}),e("dd",{children:[e("kbd",{children:"h"}),": Previous author"]}),e("dd",{children:[e("kbd",{children:"Enter"}),": Open post details"]}),e("dd",{children:[e("kbd",{children:"."}),": Scroll to top"]})]})})]})})]})}const ar=Je(function({post:t}){const{id:n,account:s,group:i,reblog:o,inReplyToId:r,inReplyToAccountId:f,_followedTags:u,_filtered:a,visibility:d,__BOOSTERS:p}=t,c=r&&f!==s.id,h=!!a,l=b=>{b.shiftKey};return e("article",{class:`post-line ${i?"group":o?"reblog":u!=null&&u.length?"followed-tags":""} ${c?"reply-to":""} ${h?"filtered":""} visibility-${d}`,onMouseEnter:l,children:[e("span",{class:"post-author",children:o?e("span",{class:"post-reblog-avatar",children:[e(st,{url:s.avatarStatic||s.avatar,squircle:s.bot}),(p==null?void 0:p.size)>0?[...p].map(b=>e(st,{url:b.avatarStatic||b.avatar,squircle:b.bot})):""," ",e(v,{icon:"rocket"})," ",e(_t,{account:o.account,showAvatar:!0})]}):e(_t,{account:s,showAvatar:!0})}),e(dr,{post:o||t,filterInfo:a}),e("span",{class:"post-meta",children:[e(ur,{post:o||t})," ",e(It,{datetime:new Date((o==null?void 0:o.createdAt)||t.createdAt),format:"micro"})]})]})},(t,n)=>{var s,i;return((s=t==null?void 0:t.post)==null?void 0:s.id)===((i=n==null?void 0:n.post)==null?void 0:i.id)}),rr=({root:t,to:n,...s})=>{const i=B(),[o,r]=E(!1);return W(()=>{const f=new IntersectionObserver(u=>{u[0].isIntersecting&&(queueMicrotask(()=>r(!0)),f.unobserve(i.current))},{root:t,rootMargin:`${Math.max(320,screen.height*.75)}px`});return i.current&&f.observe(i.current),()=>{i.current&&f.unobserve(i.current)}},[]),o?e("li",{children:e(oe,{to:n,children:e(ar,{...s})})}):e("li",{ref:i,style:{height:"4em"}})},cr=8,lr=8;function Ci(t){var a;const{spoilerText:n,content:s,poll:i,mediaAttachments:o,card:r}=t,f=(a=i==null?void 0:i.options)!=null&&a.length?i.options.reduce((d,p)=>d+p.title,""):"";return(n.length+Wi(s)+f.length)/140+(o!=null&&o.length?cr*o.length:r!=null&&r.image?lr:0)}const mt=48;function dr({post:t,filterInfo:n}){var y;const{spoilerText:s,sensitive:i,content:o,emojis:r,poll:f,mediaAttachments:u,card:a,inReplyToId:d,inReplyToAccountId:p,account:c,_thread:h}=t,l=d&&p===c.id||!!h,b=ge(()=>!!(ye.account.get("preferences")||{})["reading:expand:spoilers"],[]),m=b||!s&&!i,S=o?Nn(t):"",g=!s||b;return e("div",{class:"post-peek",title:s?"":S,children:[e("span",{class:"post-peek-content",children:[l&&!g&&e(L,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:"Thread"})," "]}),n?e("span",{class:"post-peek-filtered",children:["Filtered",n!=null&&n.titlesStr?`: ${n.titlesStr}`:""]}):e(L,{children:[!!s&&e("span",{class:"post-peek-spoiler",children:[e(v,{icon:`${b?"eye-open":"eye-close"}`})," ",s]}),g&&e("div",{class:"post-peek-html",children:[l&&e(L,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:"Thread"})," "]}),!!o&&e("div",{dangerouslySetInnerHTML:{__html:Qs(o,r)}}),!!((y=f==null?void 0:f.options)!=null&&y.length)&&f.options.map(I=>e("div",{children:[f.multiple?"▪️":"•"," ",I.title]})),!o&&(u==null?void 0:u.length)===1&&u[0].description&&e(L,{children:[e("span",{class:"post-peek-tag post-peek-alt",children:"ALT"})," ",e("div",{children:u[0].description})]})]})]})]}),!n&&e("span",{class:"post-peek-post-content",children:[!!f&&e("span",{class:"post-peek-tag post-peek-poll",children:[e(v,{icon:"poll",size:"s"}),"Poll"]}),u!=null&&u.length?u.map(I=>{var q,N,P,J,V,A,D,_,M,K;const w=I.previewUrl||I.url,k=I.previewRemoteUrl||I.remoteUrl,T=(q=I.meta)!=null&&q.original?I.meta.original.width:((P=(N=I.meta)==null?void 0:N.small)==null?void 0:P.width)||((V=(J=I.meta)==null?void 0:J.original)==null?void 0:V.width),x=(A=I.meta)!=null&&A.original?I.meta.original.height:((_=(D=I.meta)==null?void 0:D.small)==null?void 0:_.height)||((K=(M=I.meta)==null?void 0:M.original)==null?void 0:K.height);return e("span",{class:"post-peek-media",children:{image:(w||k)&&m?e("img",{src:w,width:mt,height:mt,alt:I.description,loading:"lazy",onError:ue=>{const{src:ne}=ue.target;ne===w&&(ue.target.src=k)},style:{"--anim-duration":`${Math.min(Math.max(Math.max(T,x)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"🖼"}),gifv:(w||k)&&m?e("img",{src:w,width:mt,height:mt,alt:I.description,loading:"lazy",onError:ue=>{const{src:ne}=ue.target;ne===w&&(ue.target.src=k)}}):e("span",{class:"post-peek-faux-media",children:"🎞️"}),video:(w||k)&&m?e("img",{src:w,width:mt,height:mt,alt:I.description,loading:"lazy",onError:ue=>{const{src:ne}=ue.target;ne===w&&(ue.target.src=k)}}):e("span",{class:"post-peek-faux-media",children:"📹"}),audio:e("span",{class:"post-peek-faux-media",children:"🎵"})}[I.type]||null},I.id)}):!!a&&a.image&&m&&e("span",{class:`post-peek-media post-peek-card card-${a.type||""}`,children:a.image?e("img",{src:a.image,width:mt,height:mt,alt:a.title||a.description||a.imageDescription,loading:"lazy",style:{"--anim-duration":a.width&&a.height&&`${Math.min(Math.max(Math.max(a.width,a.height)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"🔗"})})]})]})}function ur({post:t}){const{reblogsCount:n,repliesCount:s,favouritesCount:i}=t;return e("span",{class:"post-stats",children:[s>0&&e("span",{class:"post-stat-replies",children:[e(v,{icon:"comment2",size:"s"})," ",je(s)]}),i>0&&e("span",{class:"post-stat-likes",children:[e(v,{icon:"heart",size:"s"})," ",je(i)]}),n>0&&e("span",{class:"post-stat-boosts",children:[e(v,{icon:"rocket",size:"s"})," ",je(n)]})]})}const{locale:hr}=new Intl.DateTimeFormat().resolvedOptions(),Zt=new Intl.DateTimeFormat(hr,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"});function fr(t,n,s){const i=t.map(a=>new Date(a[n])),o=i.reduce((a,d)=>dd>a?d:a,i[0]).getTime()-o.getTime(),u=Array.from({length:s},()=>[]);return t.forEach(a=>{const p=(new Date(a[n]).getTime()-o.getTime())/f,c=Math.floor(p*(s-1));u[c].push(a)}),u}const pr=20;function ps(){qe("Likes","/f");const{masto:t,instance:n}=ee(),s=B();async function i(o){return(o||!s.current)&&(s.current=t.v1.favourites.list({limit:pr})),await s.current.next()}return e(pt,{title:"Likes",id:"favourites",emptyText:"No likes yet. Go like something!",errorText:"Unable to load likes",instance:n,fetchItems:i})}const mr=["home","public","notifications","thread","account"],Ti=["notifications","thread","account"],gr={home:"Home and lists",notifications:"Notifications",public:"Public timelines",thread:"Conversations",account:"Profiles"},br=[0,30*60,60*60,6*60*60,12*60*60,60*60*24,60*60*24*7,60*60*24*30],yr={0:"Never",1800:"30 minutes",3600:"1 hour",21600:"6 hours",43200:"12 hours",86400:"24 hours",604800:"7 days",2592e3:"30 days"};function wr(){const{masto:t}=ee();qe("Filters","/ft");const[n,s]=E("default"),[i,o]=E(!1),[r,f]=kt(d=>d+1,0),[u,a]=E([]);return W(()=>{s("loading"),(async()=>{try{const d=await t.v2.filters.list();d.sort((p,c)=>p.title.localeCompare(c.title)),d.forEach(p=>{var c;(c=p.keywords)!=null&&c.length&&p.keywords.sort((h,l)=>h.id-l.id)}),a(d),s("default")}catch{s("error")}})()},[r]),e("div",{id:"filters-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck",children:[e("header",{children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Tt,{}),e(oe,{to:"/",class:"button plain",children:e(v,{icon:"home",size:"l"})})]}),e("h1",{children:"Filters"}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{o(!0)},children:e(v,{icon:"plus",size:"l",alt:"New filter"})})})]})}),e("main",{children:u.length>0?e(L,{children:[e("ul",{class:"filters-list",children:u.map(d=>{const{id:p,title:c,expiresAt:h,keywords:l}=d;return e("li",{children:[e("div",{children:[e("h2",{children:c}),(l==null?void 0:l.length)>0&&e("div",{children:l.map(b=>e(L,{children:[e("span",{class:"tag collapsed insignificant",children:b.wholeWord?`“${b.keyword}”`:b.keyword})," "]}))}),e("small",{class:"insignificant",children:e(ms,{expiresAt:h})})]}),e("button",{type:"button",class:"plain",onClick:()=>{o({filter:d})},children:e(v,{icon:"pencil",size:"l",alt:"Edit filter"})})]},p)})}),u.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:[u.length," filter",u.length===1?"":"s"]})})]}):n==="loading"?e("p",{class:"ui-state",children:e($e,{})}):n==="error"?e("p",{class:"ui-state",children:"Unable to load filters."}):e("p",{class:"ui-state",children:"No filters yet."})})]}),!!i&&e(Ee,{title:"Add filter",onClose:()=>{o(!1)},children:e(Sr,{filter:i==null?void 0:i.filter,onClose:d=>{d.state==="success"&&f(),o(!1)}})})]})}let vr=1;const kr=()=>vr++;function Sr({filter:t,onClose:n}){const{masto:s}=ee(),[i,o]=E("default"),r=!!t,{context:f,expiresAt:u,id:a,keywords:d,title:p,filterAction:c}=t||{},h=!!u,l=h&&new Date(u),[b,m]=E(d||[]),S=B(),[g,y]=E([]),[I,w]=E([]),k=b.filter(T=>!g.includes(T.id)&&!I.includes(T._id));return e("div",{class:"sheet",id:"filters-add-edit-modal",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(v,{icon:"x"})}),e("header",{children:e("h2",{children:r?"Edit filter":"New filter"})}),e("main",{children:e("form",{onSubmit:T=>{T.preventDefault();const x=new FormData(T.target),q=x.get("title"),N=x.getAll("keyword_attributes[][id]"),P=x.getAll("keyword_attributes[][keyword]"),J=[...S.current.querySelectorAll('input[name="keyword_attributes[][whole_word]"]')].map(M=>M.checked),V=P.map((M,K)=>({id:N[K]||void 0,keyword:M,wholeWord:J[K]}));r&&(g!=null&&g.length)&&g.forEach(M=>{V.push({id:M,_destroy:!0})});const A=x.getAll("context");let D=x.get("expires_in");const _=x.get("filter_action");!q||!(A!=null&&A.length)||(o("loading"),(async()=>{try{let M;r?(D===""||D===null?h?D=Math.floor((l-new Date)/1e3):D=null:D==="0"||D===0?D=null:D=+D,M=await s.v2.filters.$select(a).update({title:q,context:A,expiresIn:D,keywordsAttributes:V,filterAction:_})):(D=+D||null,M=await s.v2.filters.create({title:q,context:A,expiresIn:D,keywordsAttributes:V,filterAction:_})),o("default"),n==null||n({state:"success",filter:M})}catch{o("error"),alert(r?"Unable to edit filter":"Unable to create filter")}})())},children:[e("div",{class:"filter-form-row",children:e("label",{children:[e("b",{children:"Title"}),e("input",{type:"text",name:"title",defaultValue:p,disabled:i==="loading",dir:"auto",required:!0})]})}),e("div",{class:"filter-form-keywords",ref:S,children:[k.length?e("ul",{class:"filter-keywords",children:k.map(T=>{const{id:x,keyword:q,wholeWord:N,_id:P}=T;return e("li",{children:[e("input",{type:"hidden",name:"keyword_attributes[][id]",value:x}),e("input",{name:"keyword_attributes[][keyword]",type:"text",defaultValue:q,disabled:i==="loading",required:!0}),e("div",{class:"filter-keyword-actions",children:[e("label",{children:[e("input",{name:"keyword_attributes[][whole_word]",type:"checkbox",value:x,defaultChecked:N,disabled:i==="loading"})," ","Whole word"]}),e("button",{type:"button",class:"light danger small",disabled:i==="loading",onClick:()=>{x?(g.push(x),y([...g])):P&&(I.push(P),w([...I]))},children:e(v,{icon:"x"})})]})]},`${x}-${P}`)})}):e("div",{class:"filter-keywords",children:e("div",{class:"insignificant",children:"No keywords. Add one."})}),e("footer",{class:"filter-keywords-footer",children:[e("button",{type:"button",class:"light",onClick:()=>{m([...b,{_id:kr(),keyword:"",wholeWord:!0}]),setTimeout(()=>{var x,q;const T=S.current.querySelectorAll('input[type="text"]');(q=(x=T[T.length-1])==null?void 0:x.focus)==null||q.call(x)},10)},children:"Add keyword"})," ",(k==null?void 0:k.length)>1&&e("small",{class:"insignificant",children:[k.length," keyword",k.length===1?"":"s"]})]})]}),e("div",{class:"filter-form-cols",children:[e("div",{class:"filter-form-col",children:[e("div",{children:e("b",{children:"Filter from…"})}),mr.map(T=>e("div",{children:[e("label",{class:Ti.includes(T)?"insignificant":"",children:[e("input",{type:"checkbox",name:"context",value:T,defaultChecked:f?f.includes(T):!0,disabled:i==="loading"})," ",gr[T],Ti.includes(T)?"*":""]})," "]})),e("p",{children:e("small",{class:"insignificant",children:"* Not implemented yet"})})]}),e("div",{class:"filter-form-col",children:[r&&e(L,{children:["Status:"," ",e("b",{children:e(ms,{expiresAt:u,showNeverExpires:!0})})]}),e("div",{children:[e("label",{for:"filters-expires_in",children:r?"Change expiry":"Expiry"}),e("select",{id:"filters-expires_in",name:"expires_in",disabled:i==="loading",defaultValue:r?void 0:0,children:[r&&e("option",{}),br.map(T=>e("option",{value:T,children:yr[T]}))]})]}),e("p",{children:["Filtered post will be…",e("br",{}),e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"warn",defaultChecked:c==="warn"||!r,disabled:i==="loading"})," ","minimized"]})," ",e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"hide",defaultChecked:c==="hide",disabled:i==="loading"})," ","hidden"]})]})]})]}),e("footer",{class:"filter-form-footer",children:[e("span",{children:[e("button",{type:"submit",disabled:i==="loading",children:r?"Save":"Create"})," ",e($e,{abrupt:!0,hidden:i!=="loading"})]}),r&&e(tt,{disabled:i==="loading",align:"end",menuItemClassName:"danger",confirmLabel:"Delete this filter?",onClick:()=>{o("loading"),(async()=>{try{await s.v2.filters.$select(a).remove(),o("default"),n==null||n({state:"success"})}catch{o("error"),alert("Unable to delete filter.")}})()},children:e("button",{type:"button",class:"light danger",onClick:()=>{},disabled:i==="loading",children:"Delete…"})})]})]})})]})}function ms({expiresAt:t,showNeverExpires:n}){const s=!!t,i=s&&new Date(t),o=s&&i<=new Date,[r,f]=kt(u=>u+1,0);return Mn(f,o||3e4),o?"Expired":s?e(L,{children:["Expiring ",e(It,{datetime:i})]}):n&&"Never expires"}function Ir(){const{masto:t,instance:n}=ee();qe("Followed Hashtags","/fh");const[s,i]=E("default"),[o,r]=E([]);return W(()=>{i("loading"),(async()=>{try{const f=await un();r(f),i("default")}catch{i("error")}})()},[]),e("div",{id:"followed-hashtags-page",class:"deck-container",tabIndex:"-1",children:e("div",{class:"timeline-deck deck",children:[e("header",{children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Tt,{}),e(oe,{to:"/",class:"button plain",children:e(v,{icon:"home",size:"l"})})]}),e("h1",{children:"Followed Hashtags"}),e("div",{class:"header-side"})]})}),e("main",{children:o.length>0?e(L,{children:[e("ul",{class:"link-list",children:o.map(f=>e("li",{children:e(oe,{to:n?`/${n}/t/${f.name}`:`/t/${f.name}`,children:[e(v,{icon:"hashtag"})," ",e("span",{children:f.name})]})}))}),o.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:[o.length," hashtag",o.length===1?"":"s"]})})]}):s==="loading"?e("p",{class:"ui-state",children:e($e,{abrupt:!0})}):s==="error"?e("p",{class:"ui-state",children:"Unable to load followed hashtags."}):e("p",{class:"ui-state",children:"No hashtags followed yet."})})]})})}const Cr=20;function Kn({title:t,path:n,id:s,...i}){qe(t||"Following",n||"/following");const{masto:o,streaming:r,instance:f}=ee(),u=De($),a=B(),d=B(),p=Ge("@pixelfed/home-include-reblogs");async function c(l){var S;(l||!a.current)&&(a.current=o.v1.timelines.home.list({limit:Cr})),p&&((S=a.current)!=null&&S.nextParams)&&(typeof a.current.nextParams=="string"?a.current.nextParams+="&include_reblogs=true":a.current.nextParams.include_reblogs=!0);const b=await a.current.next();let{value:m}=b;if(m!=null&&m.length){let g=!1;l&&(m[0].id!==d.current&&(g=!0),d.current=m[0].id),m.forEach(y=>{He(y,f)}),m=vi(m,f),l&&g&&Ua(),hs(m,f),m.sort((y,I)=>{const w=new Date(y.createdAt);return new Date(I.createdAt)-w})}return{...b,value:m}}async function h(){var l;try{const b={limit:5,since_id:d.current};Ge("@pixelfed/home-include-reblogs")&&(b.include_reblogs=!0);const m=await o.v1.timelines.home.list(b).next();let{value:S}=m;const g=((l=S[0])==null?void 0:l.id)===d.current;return!!(S!=null&&S.length&&!g&&(d.current=S[0].id,S=vi(S,f),S=wt(S,"home"),S.some(y=>!y.reblog)))}catch{return!1}}return W(()=>{let l;return(async()=>{if(r){l=r.user.subscribe();for await(const b of l){if(!l)break;if(b.event==="status.update"){const m=b.payload;He(m,f)}else if(b.event==="delete"){const m=b.payload,S=zi(m,f);S&&(S._deleted=!0)}}}})(),()=>{var b;(b=l==null?void 0:l.unsubscribe)==null||b.call(l),l=null}},[r]),e(pt,{title:t||"Following",id:s||"following",emptyText:"Nothing to see here.",errorText:"Unable to load posts.",instance:f,fetchItems:c,checkForUpdates:h,useItemID:!0,boostsCarousel:u.settings.boostsCarousel,...i,filterContext:"home",showFollowedTags:!0,showReplyParent:!0})}const Tr=20,xr=4,xi=xr+1;function gs({media:t,columnMode:n,...s}){let{hashtag:i,...o}=n?{}:St();s.hashtag&&(i=s.hashtag);let r=i.trim().split(/[\s+]+/);r.sort(),i=r[0];const[f,u]=ot(),a=t||!!f.get("media"),d=a?"?media=1":"",{masto:p,instance:c,authenticated:h}=ee({instance:(s==null?void 0:s.instance)||o.instance}),{masto:l,instance:b,authenticated:m}=ee(),S=r.map(A=>`#${A}`).join(" "),g=a?" (Media only)":"",y=c?`${S}${g} on ${c}`:`${S}${g}`;qe(y,"/:instance?/t/:hashtag");const I=B(),w=ge(()=>_n(),[]),k=B(void 0);async function T(A){const D=await p.v1.timelines.tag.$select(i).list({limit:Tr,any:r.slice(1),maxId:A?void 0:k.current,onlyMedia:a?!0:void 0}).next();let{value:_}=D;return _!=null&&_.length&&(A&&(I.current=_[0].id),_.forEach(M=>{He(M,c,{skipThreading:a||w})}),k.current=_[_.length-1].id),{...D,value:_}}async function x(){var A;try{const D=await p.v1.timelines.tag.$select(i).list({limit:1,any:r.slice(1),since_id:I.current,onlyMedia:a}).next();let{value:_}=D;const M=((A=_[0])==null?void 0:A.id)===I.current;return _!=null&&_.length&&!M?(_=wt(_,"public"),!0):!1}catch{return!1}}const[q,N]=E("default"),[P,J]=E();W(()=>{(async()=>{try{const A=await p.v1.tags.$select(i).fetch();J(A)}catch{}})()},[i]);const V=r.length>=xi;return e(pt,{title:y,titleComponent:!!c&&e("h1",{class:"header-double-lines",children:[e("b",{children:S}),e("div",{children:c})]}),id:"hashtag",instance:c,emptyText:"No one has posted anything with this tag yet.",errorText:"Unable to load posts with this tag",fetchItems:T,checkForUpdates:x,useItemID:!0,view:a||w?"media":void 0,refresh:a,filterContext:"public",headerEnd:e(Ze,{portal:!0,setDownOverflow:!0,overflow:"auto",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(v,{icon:"more",size:"l"})}),children:[!!P&&r.length===1&&e(L,{children:[e(tt,{subMenu:!0,confirm:P.following,confirmLabel:`Unfollow #${i}?`,disabled:q==="loading"||!h,onClick:()=>{N("loading"),P.following?p.v1.tags.$select(i).unfollow().then(()=>{J({...P,following:!1}),ie(`Unfollowed #${i}`)}).catch(A=>{alert(A)}).finally(()=>{N("default")}):p.v1.tags.$select(i).follow().then(()=>{J({...P,following:!0}),ie(`Followed #${i}`)}).catch(A=>{alert(A)}).finally(()=>{N("default")})},children:P.following?e(L,{children:[e(v,{icon:"check-circle"})," ",e("span",{children:"Following…"})]}):e(L,{children:[e(v,{icon:"plus"})," ",e("span",{children:"Follow"})]})}),e(ze,{})]}),!w&&e(L,{children:[e(Ki,{className:"plain",children:"Filters"}),e(pe,{type:"checkbox",checked:!!a,onClick:()=>{a?f.delete("media"):f.set("media","1"),u(f)},children:[e(v,{icon:"check-circle"})," ",e("span",{class:"menu-grow",children:"Media only"})]}),e(ze,{})]}),e(eo,{className:"menu-field",disabled:V,children:({ref:A})=>e("form",{onSubmit:D=>{var M,K;D.preventDefault();const _=(K=(M=D.target[0].value)==null?void 0:M.trim)==null?void 0:K.call(M);_&&!r.some(ue=>ue.toLowerCase()===_.toLowerCase())&&(r.push(_),r.sort(),location.hash=c?`/${c}/t/${r.join("+")}`:`/t/${r.join("+")}${d}`)},children:[e(v,{icon:"hashtag"}),e("input",{ref:A,type:"text",placeholder:V?`Max ${xi} tags`:"Add hashtag",required:!0,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:"[^#][^\\s#]+[^#]",disabled:V})]})}),e(to,{takeOverflow:!0,children:r.map((A,D)=>e(pe,{disabled:r.length===1,onClick:_=>{r.splice(D,1),r.sort(),location.hash=c?`/${c}/t/${r.join("+")}${d}`:`/t/${r.join("+")}${d}`},children:[e(v,{icon:"x",alt:"Remove hashtag",class:"danger-icon"}),e("span",{children:[e("span",{class:"more-insignificant",children:"#"}),A]})]},A))}),e(ze,{}),e(pe,{disabled:!m,onClick:()=>{if($.shortcuts.length>=lt){alert(`Max ${lt} shortcuts reached. Unable to add shortcut.`);return}const A={type:"hashtag",hashtag:r.join(" "),instance:c,media:a?"on":void 0};$.shortcuts.some(_=>_.type===A.type&&_.hashtag.split(/[\s+]+/).sort().join(" ")===A.hashtag.split(/[\s+]+/).sort().join(" ")&&(_.instance?_.instance===A.instance:!0)&&(_.media?!!_.media==!!A.media:!0))?alert("This shortcut already exists"):($.shortcuts.push(A),ie("Hashtag shortcut added"))},children:[e(v,{icon:"shortcut"})," ",e("span",{children:"Add to Shorcuts"})]}),e(pe,{onClick:()=>{let A=prompt('Enter a new instance e.g. "mastodon.social"');if(!/\./.test(A)){A&&alert("Invalid instance");return}A&&(A=A.toLowerCase().trim(),location.hash=`/${A}/t/${r.join("+")}${d}`)},children:[e(v,{icon:"bus"})," ",e("span",{children:"Go to another instance…"})]}),b!==c&&e(pe,{onClick:()=>{location.hash=`/${b}/t/${r.join("+")}${d}`},children:[e(v,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:["Go to my instance (",e("b",{children:b}),")"]})]})]})},c+S)}const $r=20;function bs(t){var g;const n=De($),{masto:s,instance:i}=ee(),o=(t==null?void 0:t.id)||((g=St())==null?void 0:g.id),r=B(),f=B();async function u(y){(y||!f.current)&&(f.current=s.v1.timelines.list.$select(o).list({limit:$r}));const I=await f.current.next();let{value:w}=I;return w!=null&&w.length&&(y&&(r.current=w[0].id),w.forEach(k=>{He(k,i)})),{...I,value:w}}async function a(){var y;try{const I=await s.v1.timelines.list.$select(o).list({limit:1,since_id:r.current});let{value:w}=I;const k=((y=w[0])==null?void 0:y.id)===r.current;return w!=null&&w.length&&!k?(w=wt(w,"home"),!0):!1}catch{return!1}}const[d,p]=E([]);W(()=>{Yt().then(p)},[]);const[c,h]=E({title:"List"});qe(c.title,"/l/:id"),W(()=>{(async()=>{try{const y=await as(o);h(y)}catch{}})()},[o]);const[l,b]=E(!1),[m,S]=E(!1);return e(L,{children:[e(pt,{title:c.title,id:"list",emptyText:"Nothing yet.",errorText:"Unable to load posts.",instance:i,fetchItems:u,checkForUpdates:a,useItemID:!0,boostsCarousel:n.settings.boostsCarousel,filterContext:"home",showReplyParent:!0,headerStart:e(Ze,{overflow:"auto",menuButton:e("button",{type:"button",class:"plain",children:[e(v,{icon:"list",size:"l",alt:"Lists"}),e(v,{icon:"chevron-down",size:"s"})]}),children:[e(_e,{to:"/l",children:e("span",{children:"All Lists"})}),(d==null?void 0:d.length)>0&&e(L,{children:[e(ze,{}),d.map(y=>e(_e,{to:`/l/${y.id}`,children:e("span",{children:y.title})},y.id))]})]}),headerEnd:e(Ze,{portal:!0,setDownOverflow:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(v,{icon:"more",size:"l"})}),children:[e(pe,{onClick:()=>b({list:c}),children:[e(v,{icon:"pencil",size:"l"}),e("span",{children:"Edit"})]}),e(pe,{onClick:()=>S(!0),children:[e(v,{icon:"group",size:"l"}),e("span",{children:"Manage members"})]})]})},o),l&&e(Ee,{onClick:y=>{y.target===y.currentTarget&&b(!1)},children:e(Vn,{list:l==null?void 0:l.list,onClose:y=>{y.state==="success"&&y.list?h(y.list):y.state==="deleted"&&(location.hash="/l"),b(!1)}})}),m&&e(Ee,{onClick:y=>{y.target===y.currentTarget&&S(!1)},children:e(Rr,{listID:o,onClose:()=>S(!1)})})]})}const Ar=40;function Rr({listID:t,onClose:n}){const{masto:s,instance:i}=ee(),[o,r]=E([]),[f,u]=E("default"),[a,d]=E(!1),p=B();async function c(h){d(!1),u("loading"),(async()=>{try{(h||!p.current)&&(p.current=s.v1.lists.$select(t).accounts.list({limit:Ar}));const l=await p.current.next();let{done:b,value:m}=l;m!=null&&m.length?(r(h?m:o.concat(m)),d(!b)):d(!1),u("default")}catch{u("error")}})()}return W(()=>{c(!0)},[]),e("div",{class:"sheet",id:"list-manage-members-container",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(v,{icon:"x"})}),e("header",{children:e("h2",{children:"Manage members"})}),e("main",{children:e("ul",{children:[o.map(h=>e("li",{children:[e(Qe,{account:h,instance:i}),e(Er,{account:h,listID:t})]},h.id)),a&&f==="default"&&e(ht,{as:"li",onChange:h=>h&&c(),children:e("button",{type:"button",class:"light block",onClick:c,children:"Show more…"})})]})})]})}function Er({account:t,listID:n}){const{masto:s}=ee(),[i,o]=E("default"),[r,f]=E(!1);return e(tt,{confirm:!r,confirmLabel:e("span",{children:["Remove @",t.username," from list?"]}),align:"end",menuItemClassName:"danger",onClick:()=>{r?(o("loading"),(async()=>{try{await s.v1.lists.$select(n).accounts.create({accountIds:[t.id]}),o("default"),f(!1)}catch{o("error")}})()):(o("loading"),(async()=>{try{await s.v1.lists.$select(n).accounts.remove({accountIds:[t.id]}),o("default"),f(!0)}catch{o("error")}})())},children:e("button",{type:"button",class:`light ${r?"":"danger"}`,disabled:i==="loading",children:r?"Add":"Remove…"})})}const _r={mention:["account","status"],status:["account","status"],reblog:["account","status"],follow:["account"],follow_request:["account"],favourite:["account","status"],poll:["status"],update:["status"]};function ys(t){return t.filter(n=>{const{type:s,id:i,createdAt:o}=n;if(!s)return!1;const r=_r[s];return r!=null&&r.length?r.every(f=>!!n[f]):!0})}function ws(t){t=ys(t);const n={},s=[];for(let r=0,f=0;ry.id===p.id);g?(g._types.push(c),g._types.sort().reverse(),S.id+=`-${a}`):(p._types=[c],S._accounts.push(p),S.id+=`-${a}`)}else{p&&(p._types=[c]);let g=n[m]={...u,type:b,_accounts:p?[p]:[]};s[f++]=g}}const i={},o=[];for(let r=0,f=0;r{He(w,i)})),{...y,value:I==null?void 0:I.map(w=>w.status)}}const c=B(),h=B();async function l(g){(g||!c.current)&&(c.current=s.v1.conversations.list({limit:$i}));const y=await c.current.next();let{value:I}=y;return I=I==null?void 0:I.filter(w=>w.lastStatus),I!=null&&I.length&&(g&&(h.current=I[0].lastStatus.id),I.forEach(({lastStatus:w})=>{He(w,i)})),{...y,value:I==null?void 0:I.map(w=>w.lastStatus)}}function b(...g){return u==="private"?l(...g):p(...g)}async function m(){var g;if(u==="private")try{const y=await s.v1.conversations.list({limit:1,since_id:h.current}).next();let{value:I}=y;const w=((g=I[0])==null?void 0:g.id)===h.current;return I!=null&&I.length&&!w?(h.current=I[0].lastStatus.id,!0):!1}catch{return!1}else try{const y=await s.v1.notifications.list({limit:1,types:["mention"],since_id:d.current}).next();let{value:I}=y;return I!=null&&I.length?(d.current=I[0].id,!0):!1}catch{return!1}}const S=ge(()=>e("div",{class:"filter-bar centered",children:[e(oe,{to:"/mentions",class:u?"":"is-active",onClick:g=>{t&&(g.preventDefault(),f(null))},children:"All"}),e(oe,{to:"/mentions?type=private",class:u==="private"?"is-active":"",onClick:g=>{t&&(g.preventDefault(),f("private"))},children:"Private"})]}),[u]);return e(pt,{title:"Mentions",id:"mentions",emptyText:"No one mentioned you :(",errorText:"Unable to load mentions.",instance:i,fetchItems:b,checkForUpdates:m,useItemID:!0,timelineStart:S,refresh:u})}const Mr=80,Dr=new URLSearchParams,Jt={block:"center",inline:"center",behavior:"smooth"};function Pr({columnMode:t}){var re;qe("Notifications","/notifications");const{masto:n,instance:s}=ee(),i=De($),[o,r]=E("default"),[f]=t?[Dr]:ot(),u=f.get("id"),a=f.get("access_token"),[d,p]=E(!1),[c,h]=E(!1),l=B(),{nearReachEnd:b,scrollDirection:m,reachStart:S,nearReachStart:g}=Oa({scrollableRef:l}),y=m==="end"&&!g,[I,w]=E([]),[k,T]=E([]),x=B();async function q(U){var H;if((U||!x.current)&&(x.current=n.v1.notifications.list({limit:Mr,excludeTypes:["follow_request"]})),/max_id=($|&)/i.test((H=x.current)==null?void 0:H.nextParams))return{done:!0};const G=await x.current.next(),R=G.value;if(R!=null&&R.length){R.forEach(ce=>{He(ce.status,s,{skipThreading:!0})});const X=ws(R);U?($.notificationsLast=R[0],$.notifications=X,n.v1.markers.create({notifications:{lastReadId:R[0].id}}).catch(()=>{})):$.notifications.push(...X)}return $.notificationsShowNew=!1,$.notificationsLastFetchTime=Date.now(),G}async function N(){try{return await n.v1.followRequests.list({limit:80})}catch{return[]}}const P=()=>{r("loading"),(async()=>{try{const U=await N();w(U),r("default")}catch{r("error")}})()};async function J(){try{return await n.v1.announcements.list()}catch{return[]}}const V=Ge("@mastodon/filtered-notifications"),[A,D]=E(!1),[_,M]=E({});function K(){return n.v1.notifications.policy.fetch().catch(()=>{})}function ue(){K().then(U=>{M(U)}).catch(()=>{})}const[ne,le]=E(null);function te(){return n.v1.notifications.requests.list()}const we=U=>{ae(!1),r("loading"),(async()=>{try{const G=q(U);U&&(J().then(H=>{H.sort((X,ce)=>{const Pe=new Date(X.updatedAt||X.createdAt);return new Date(ce.updatedAt||ce.createdAt)-Pe}),T(H)}).catch(()=>{}),N().then(H=>{w(H)}).catch(()=>{}),V&&ue());const{done:R}=await G;p(!R),r("default")}catch{r("error")}})()};W(()=>{we(!0)},[]),W(()=>{S&&we(!0)},[S]);const[de,ae]=E(!1),fe=et(({disableIdleCheck:U=!1}={})=>{var G;o!=="loading"&&i.settings.autoRefresh&&((G=l.current)==null?void 0:G.scrollTop)<16&&(U||window.__IDLE__)&&!Nr()&&we(!0)},[i.notificationsShowNew,i.settings.autoRefresh,o]),Re=B();Lt(U=>{if(U){const G=Date.now()-Re.current;!Re.current||G>1e3*3?fe({disableIdleCheck:!0}):Re.current=Date.now()}});const Se=B(!0);W(()=>{let U=Ps($,"notificationsShowNew",G=>{if(Se.current){Se.current=!1;return}o!=="loading"&&(G&&fe(),ae(G))});return()=>U==null?void 0:U()},[]);const Ae=new Date,Oe=new Date(Ae-24*60*60*1e3);let xe=new Date;const Ie=!i.notifications.some(U=>new Date(U.createdAt).toDateString()===Ae.toDateString()),Ce=B();W(()=>{u&&($.routeNotification={id:u,accessToken:atob(a)})},[u,a]);const ve=".notification",Q=Le("j",()=>{const U=document.activeElement.closest(ve),G=U==null?void 0:U.getBoundingClientRect(),R=Array.from(l.current.querySelectorAll(ve));if(U&&G.top0){const H=R.indexOf(U);let X=R[H+1];X&&(X.focus(),X.scrollIntoView(Jt))}else{const H=R.find(X=>{const ce=X.getBoundingClientRect();return ce.top>=44&&ce.left>=0});H&&(H.focus(),H.scrollIntoView(Jt))}}),me=Le("k",()=>{const U=document.activeElement.closest(ve),G=U==null?void 0:U.getBoundingClientRect(),R=Array.from(l.current.querySelectorAll(ve));if(U&&G.top0){const H=R.indexOf(U);let X=R[H-1];X&&(X.focus(),X.scrollIntoView(Jt))}else{const H=R.find(X=>{const ce=X.getBoundingClientRect();return ce.top>=44&&ce.left>=0});H&&(H.focus(),H.scrollIntoView(Jt))}}),F=Le(["enter","o"],()=>{const U=document.activeElement.closest(ve),G=U==null?void 0:U.querySelector(".status-link");G&&G.click()});return e("div",{id:"notifications-page",class:"deck-container",ref:U=>{l.current=U,Q.current=U,me.current=U,F.current=U},tabIndex:"-1",children:[e("div",{class:`timeline-deck deck ${c?"only-mentions":""}`,children:[e("header",{hidden:y,onClick:U=>{var G;U.target.closest("a, button")||(G=l.current)==null||G.scrollTo({top:0,behavior:"smooth"})},onDblClick:U=>{U.target.closest("a, button")||we(!0)},class:o==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Tt,{}),e(oe,{to:"/",class:"button plain",children:e(v,{icon:"home",size:"l",alt:"Home"})})]}),e("h1",{children:"Notifications"}),e("div",{class:"header-side",children:V&&e("button",{type:"button",class:"button plain4",onClick:()=>{D(!0)},children:e(v,{icon:"settings",size:"l",alt:"Notifications settings"})})})]}),de&&o!=="loading"&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:()=>{var U;we(!0),(U=l.current)==null||U.scrollTo({top:0,behavior:"smooth"})},children:[e(v,{icon:"arrow-up"})," New notifications"]})]}),k.length>0&&e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e("details",{class:"announcements",children:[e("summary",{children:[e("span",{children:[e(v,{icon:"announce",class:"announcement-icon",size:"l"})," ",e("b",{children:["Announcement",k.length>1?"s":""]})," ",e("small",{class:"insignificant",children:s})]}),k.length>1&&e("span",{class:"announcements-nav-buttons",children:k.map((U,G)=>e("button",{type:"button",class:"plain2 small",onClick:()=>{var R;(R=Ce.current)==null||R.children[G].scrollIntoView({behavior:"smooth",block:"nearest"})},children:G+1}))})]}),e("ul",{class:`announcements-list-${k.length>1?"multiple":"single"}`,ref:Ce,children:k.map(U=>e("li",{children:e(Ur,{announcement:U})}))})]})})}),I.length>0&&e("div",{class:"follow-requests",children:[e("h2",{class:"timeline-header",children:"Follow requests"}),I.length>5?e("details",{children:[e("summary",{children:[I.length," follow requests"]}),e("ul",{children:I.map(U=>e("li",{children:[e(Qe,{account:U}),e($n,{accountID:U.id,onChange:()=>{}})]},U.id))})]}):e("ul",{children:I.map(U=>e("li",{children:[e(Qe,{account:U}),e($n,{accountID:U.id,onChange:()=>{}})]},U.id))})]}),V&&((re=_==null?void 0:_.summary)==null?void 0:re.pendingRequestsCount)>0&&e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e("div",{class:"filtered-notifications",children:e("details",{onToggle:async U=>{const{open:G}=U.target;if(G){const R=await te();le(R)}},children:[e("summary",{children:["Filtered notifications from"," ",_.summary.pendingRequestsCount," people"]}),ne?(ne==null?void 0:ne.length)>0&&e("ul",{children:ne.map(U=>{var G,R;return e("li",{children:[e("div",{class:"request-notifcations",children:[!((G=U.lastStatus)!=null&&G.id)&&e(Qe,{useAvatarStatic:!0,showStats:!0,account:U.account}),((R=U.lastStatus)==null?void 0:R.id)&&e("div",{class:"last-post",children:e(oe,{class:"status-link",to:`/${s}/s/${U.lastStatus.id}`,children:e(Be,{status:U.lastStatus,size:"s",readOnly:!0})})}),e(Fr,{request:U})]}),e(zr,{request:U,onChange:()=>{we(!0)}})]},U.id)})}):e("p",{class:"ui-state",children:e($e,{abrupt:!0})})]})})})}),e("div",{id:"mentions-option",children:e("label",{children:[e("input",{type:"checkbox",checked:c,onChange:U=>{h(U.target.checked)}})," ","Only mentions"]})}),e("h2",{class:"timeline-header",children:"Today"}),Ie&&e("p",{class:"ui-state insignificant",children:o==="default"?"You're all caught up.":e(L,{children:"…"})}),i.notifications.length?e(L,{children:i.notifications.filter(U=>U.type!=="follow_request").map(U=>{if(c&&U.type!=="mention")return null;const G=new Date(U.createdAt),R=G.toDateString()!==xe.toDateString();R&&(xe=G);const H=G.toDateString()===Oe.toDateString()?"Yesterday":rt(xe,{hideTime:!0});return e(L,{children:[R&&e("h2",{class:"timeline-header",children:H}),e(mn,{instance:s,notification:U},U.id)]},U.id)})}):e(L,{children:[o==="loading"&&e(L,{children:e("ul",{class:"timeline flat",children:Array.from({length:5}).map((U,G)=>e("li",{class:"notification skeleton",children:[e("div",{class:"notification-type",children:e(v,{icon:"notification",size:"xl"})}),e("div",{class:"notification-content",children:e("p",{children:"███████████ ████"})})]}))})}),o==="error"&&e("p",{class:"ui-state",children:["Unable to load notifications",e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>we(!0),children:"Try again"})]})]}),d&&e(ht,{onChange:U=>{U&&we()},children:e("button",{type:"button",class:"plain block",disabled:o==="loading",onClick:()=>we(),style:{marginBlockEnd:"6em"},children:o==="loading"?e($e,{abrupt:!0}):e(L,{children:"Show more…"})})})]}),V&&A&&e(Ee,{onClick:U=>{U.target===U.currentTarget&&D(!1)},children:e("div",{class:"sheet",id:"notifications-settings",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>D(!1),children:e(v,{icon:"x"})}),e("header",{children:e("h2",{children:"Notifications settings"})}),e("main",{children:e("form",{onSubmit:U=>{U.preventDefault();const{filterNotFollowing:G,filterNotFollowers:R,filterNewAccounts:H,filterPrivateMentions:X}=U.target,ce={filterNotFollowing:G.checked,filterNotFollowers:R.checked,filterNewAccounts:H.checked,filterPrivateMentions:X.checked};M({..._,...ce}),D(!1),(async()=>{try{await n.v1.notifications.policy.update(ce),ie("Notifications settings updated")}catch{}})()},children:[e("p",{children:"Filter out notifications from people:"}),e("p",{children:e("label",{children:[e("input",{type:"checkbox",switch:!0,defaultChecked:_.filterNotFollowing,name:"filterNotFollowing"})," ","You don't follow"]})}),e("p",{children:e("label",{children:[e("input",{type:"checkbox",switch:!0,defaultChecked:_.filterNotFollowers,name:"filterNotFollowers"})," ","Who don't follow you"]})}),e("p",{children:e("label",{children:[e("input",{type:"checkbox",switch:!0,defaultChecked:_.filterNewAccounts,name:"filterNewAccounts"})," ","With a new account"]})}),e("p",{children:e("label",{children:[e("input",{type:"checkbox",switch:!0,defaultChecked:_.filterPrivateMentions,name:"filterPrivateMentions"})," ","Who unsolicitedly private mention you"]})}),e("p",{children:e("button",{type:"submit",children:"Save"})})]})})]})})]})}function Nr(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}function Ur({announcement:t}){const{instance:n}=ee(),{contact:s}=Ui(),i=s==null?void 0:s.account,{id:o,content:r,startsAt:f,endsAt:u,published:a,allDay:d,publishedAt:p,updatedAt:c,read:h,mentions:l,statuses:b,tags:m,emojis:S,reactions:g}=t,y=new Date(p),I=rt(y),w=new Date(c),k=rt(w);return e("div",{class:"announcement-block",children:[e(Qe,{account:i}),e("div",{class:"announcement-content",onClick:Hi({mentions:l,instance:n}),dangerouslySetInnerHTML:{__html:Sn(r,{emojis:S})}}),e("p",{class:"insignificant",children:[e("time",{datetime:y.toISOString(),children:rt(y)}),c&&k!==I&&e(L,{children:[" ","•"," ",e("span",{class:"ib",children:["Updated"," ",e("time",{datetime:w.toISOString(),children:rt(w)})]})]})]}),e("div",{class:"announcement-reactions",hidden:!0,children:g.map(T=>{const{name:x,count:q,me:N,staticUrl:P,url:J}=T;return e("button",{type:"button",class:`plain4 small ${N?"reacted":""}`,children:[J||P?e("img",{src:J||P,alt:x,width:"16",height:"16"}):e("span",{children:x})," ",e("span",{class:"count",children:je(q)})]})})})]})}function Or(t){const{masto:n}=ee();return n.v1.notifications.list({accountID:t})}function Fr({request:t}){var c;const{instance:n}=ee(),[s,i]=E("loading"),{account:o,lastStatus:r}=t,[f,u]=E(!1),[a,d]=E([]);function p(){u(!1)}return W(()=>{var h;(h=t==null?void 0:t.account)!=null&&h.id&&f&&(i("loading"),(async()=>{const l=await Or(t.account.id);d(l||[]),i("default")})())},[f,(c=t==null?void 0:t.account)==null?void 0:c.id]),e(L,{children:[e("button",{type:"button",class:"plain4 request-notifications-account",onClick:()=>{u(!0)},children:[e(v,{icon:"notification",class:"more-insignificant"})," ",e("small",{children:["View notifications from @",o.username]})," ",e(v,{icon:"chevron-down"})]}),f&&e(Ee,{onClick:h=>{h.target===h.currentTarget&&p()},children:e("div",{class:"sheet",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:p,children:e(v,{icon:"x"})}),e("header",{children:e("b",{children:["Notifications from @",o.username]})}),e("main",{children:s==="loading"?e("p",{class:"ui-state",children:e($e,{abrupt:!0})}):a.map(h=>e("div",{class:"notification-peek",onClick:l=>{const{target:b}=l;(l.target.tagName==="BUTTON"||l.target.tagName==="A")&&p()},children:e(mn,{instance:n,notification:h,isStatic:!0})}))})]})})]})}function zr({request:t,onChange:n}){const{masto:s}=ee(),[i,o]=E("default"),[r,f]=E(null),u=r!==null;return e("p",{class:"notification-request-buttons",children:[e("button",{type:"button",disabled:i==="loading"||u,onClick:()=>{o("loading"),(async()=>{try{await s.v1.notifications.requests.$select(t.id).accept(),f("accept"),o("default"),n({request:t,state:"accept"}),ie(`Notifications from @${t.account.username} will not be filtered from now on.`)}catch{o("error"),ie("Unable to accept notification request")}})()},children:"Allow"})," ",e("button",{type:"button",disabled:i==="loading"||u,class:"light danger",onClick:()=>{o("loading"),(async()=>{try{await s.v1.notifications.requests.$select(t.id).dismiss(),f("dismiss"),o("default"),n({request:t,state:"dismiss"}),ie(`Notifications from @${t.account.username} will not show up in Filtered notifications from now on.`)}catch{o("error"),ie("Unable to dismiss notification request")}})()},children:"Dismiss"}),e("span",{class:"notification-request-states",children:i==="loading"?e($e,{abrupt:!0}):r==="accept"?e(v,{icon:"check-circle",alt:"Accepted",class:"notification-accepted"}):r==="dismiss"&&e(v,{icon:"x-circle",alt:"Dismissed",class:"notification-dismissed"})})]})}const ks=Je(Pr),Br=20;function An({local:t,columnMode:n,...s}){const i=De($),o=!!t,r=n?{}:St(),{masto:f,instance:u}=ee({instance:(s==null?void 0:s.instance)||r.instance}),{masto:a,instance:d}=ee(),p=`${o?"Local":"Federated"} timeline (${u})`;qe(p,o?"/:instance?/p/l":"/:instance?/p");const c=B(),h=B();async function l(m){if(m||!h.current){const y={limit:Br,local:o||void 0};!o&&Ge("@pixelfed/global-feed")&&(y.remote=!0),h.current=f.v1.timelines.public.list(y)}const S=await h.current.next();let{value:g}=S;return g!=null&&g.length&&(m&&(c.current=g[0].id),g.forEach(y=>{He(y,u)})),{...S,value:g}}async function b(){var m;try{const S=await f.v1.timelines.public.list({limit:1,local:o,since_id:c.current}).next();let{value:g}=S;const y=((m=g[0])==null?void 0:m.id)===c.current;return g!=null&&g.length&&!y?(g=wt(g,"public"),!0):!1}catch{return!1}}return e(pt,{title:p,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:o?"Local timeline":"Federated timeline"}),e("div",{children:u})]}),id:"public",instance:u,emptyText:"No one has posted anything yet.",errorText:"Unable to load posts",fetchItems:l,checkForUpdates:b,useItemID:!0,headerStart:e(L,{}),boostsCarousel:i.settings.boostsCarousel,filterContext:"public",headerEnd:e(Ze,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(v,{icon:"more",size:"l"})}),children:[e(pe,{href:o?`/#/${u}/p`:`/#/${u}/p/l`,children:o?e(L,{children:[e(v,{icon:"transfer"})," ",e("span",{children:"Switch to Federated"})]}):e(L,{children:[e(v,{icon:"transfer"})," ",e("span",{children:"Switch to Local"})]})}),e(ze,{}),e(pe,{onClick:()=>{let m=prompt('Enter a new instance e.g. "mastodon.social"');if(!/\./.test(m)){m&&alert("Invalid instance");return}m&&(m=m.toLowerCase().trim(),location.hash=o?`/${m}/p/l`:`/${m}/p`)},children:[e(v,{icon:"bus"})," ",e("span",{children:"Go to another instance…"})]}),d!==u&&e(pe,{onClick:()=>{location.hash=o?`/${d}/p/l`:`/${d}/p`},children:[e(v,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:["Go to my instance (",e("b",{children:d}),")"]})]})]})},u+o)}const Qt=5,kn=40,Hr=new URLSearchParams;function Ss({columnMode:t,...n}){const s=t?{}:St(),{masto:i,instance:o,authenticated:r}=ee({instance:s.instance}),[f,u]=E("default"),[a]=t?[Hr]:ot(),d=B(),p=(n==null?void 0:n.query)||a.get("q"),c=t?"statuses":(n==null?void 0:n.type)||a.get("type");qe(p?`Search: ${p}${c?` (${{statuses:"Posts",accounts:"Accounts",hashtags:"Hashtags"}[c]})`:""}`:"Search","/search");const[h,l]=E(!1),b=B(0);W(()=>{b.current=0},[p,c]);const m=B();ut(()=>{var A,D;(D=(A=m.current)==null?void 0:A.scrollTo)==null||D.call(A,0,0)},[p,c]);const[S,g]=E([]),[y,I]=E([]),[w,k]=E([]);W(()=>{g([]),I([]),k([])},[p]);const T={statuses:g,accounts:I,hashtags:k},[x,q]=E({}),N=async A=>{if(!(A!=null&&A.length))return;const D=await Dn(A,x);D&&q({...x,...D})};function P(A){A&&(b.current=0),!(!A&&!r)&&(u("loading"),A&&!c&&(g(S.slice(0,Qt)),I(y.slice(0,Qt)),k(w.slice(0,Qt))),(async()=>{var _,M;const D={q:p,resolve:r,limit:Qt};c&&(D.limit=kn,D.type=c,r&&(D.offset=b.current));try{const K=await i.v2.search.fetch(D);if(c)if(A){T[c](K[c]);const ue=(_=K[c])==null?void 0:_.length;b.current=kn,l(!!ue)}else{T[c](ne=>[...ne,...K[c]]);const ue=(M=K[c])==null?void 0:M.length;b.current=b.current+kn,l(!!ue)}else g(K.statuses||[]),I(K.accounts||[]),k(K.hashtags||[]),b.current=0,l(!1);N(K.accounts),u("default")}catch{u("error")}})())}const J=B();Lt(A=>{var _;const D=((_=m.current)==null?void 0:_.scrollTop)===0;if(A&&D){const M=Date.now()-J.current;!J.current||M>1e3*3?P(!0):J.current=Date.now()}}),W(()=>{var A,D,_,M;(D=(A=d.current)==null?void 0:A.setValue)==null||D.call(A,p||""),p?P(!0):(M=(_=d.current)==null?void 0:_.focus)==null||M.call(_)},[p,c,o]),Le(["/","Slash"],A=>{var D,_,M,K;(_=(D=d.current)==null?void 0:D.focus)==null||_.call(D),(K=(M=d.current)==null?void 0:M.select)==null||K.call(M)},{preventDefault:!0});const[V]=Bn();return e("div",{id:"search-page",class:"deck-container",ref:m,children:e("div",{class:"timeline-deck deck",children:[e("header",{class:f==="loading"?"loading":"",children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:e(Tt,{})}),e(us,{ref:d}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{P(!0)},disabled:f==="loading",children:e(v,{icon:"search",size:"l"})})})]})}),e("main",{children:[!!p&&!t&&e("div",{ref:V,class:`filter-bar ${f==="loading"?"loading":""}`,children:[!!c&&e(oe,{to:`/search${p?`?q=${encodeURIComponent(p)}`:""}`,children:"‹ All"}),[{label:"Accounts",type:"accounts",to:`/search?q=${encodeURIComponent(p)}&type=accounts`},{label:"Hashtags",type:"hashtags",to:`/search?q=${encodeURIComponent(p)}&type=hashtags`},{label:"Posts",type:"statuses",to:`/search?q=${encodeURIComponent(p)}&type=statuses`}].sort((A,D)=>A.type===c?-1:D.type===c?1:0).map(A=>e(oe,{to:A.to,children:A.label},A.type))]}),p?e(L,{children:[(!c||c==="accounts")&&e(L,{children:[c!=="accounts"&&e("h2",{class:"timeline-header",children:["Accounts"," ",e(oe,{to:`/search?q=${encodeURIComponent(p)}&type=accounts`,children:e(v,{icon:"arrow-right",size:"l"})})]}),y.length>0?e(L,{children:[e("ul",{class:"timeline flat accounts-list",children:y.map(A=>e("li",{children:e(Qe,{account:A,instance:o,showStats:!0,relationship:x[A.id]})},A.id))}),c!=="accounts"&&e("div",{class:"ui-state",children:e(oe,{class:"plain button",to:`/search?q=${encodeURIComponent(p)}&type=accounts`,children:["See more accounts ",e(v,{icon:"arrow-right"})]})})]}):!c&&(f==="loading"?e("p",{class:"ui-state",children:e($e,{abrupt:!0})}):e("p",{class:"ui-state",children:"No accounts found."}))]}),(!c||c==="hashtags")&&e(L,{children:[c!=="hashtags"&&e("h2",{class:"timeline-header",children:["Hashtags"," ",e(oe,{to:`/search?q=${encodeURIComponent(p)}&type=hashtags`,children:e(v,{icon:"arrow-right",size:"l"})})]}),w.length>0?e(L,{children:[e("ul",{class:"link-list hashtag-list",children:w.map(A=>{var K;const{name:D,history:_}=A,M=(K=_==null?void 0:_.reduce)==null?void 0:K.call(_,(ue,ne)=>ue+ +ne.uses,0);return e("li",{children:e(oe,{to:o?`/${o}/t/${D}`:`/t/${D}`,children:[e(v,{icon:"hashtag"}),e("span",{children:D}),!!M&&e("span",{class:"count",children:je(M)})]})},`${D}-${M}`)})}),c!=="hashtags"&&e("div",{class:"ui-state",children:e(oe,{class:"plain button",to:`/search?q=${encodeURIComponent(p)}&type=hashtags`,children:["See more hashtags ",e(v,{icon:"arrow-right"})]})})]}):!c&&(f==="loading"?e("p",{class:"ui-state",children:e($e,{abrupt:!0})}):e("p",{class:"ui-state",children:"No hashtags found."}))]}),(!c||c==="statuses")&&e(L,{children:[c!=="statuses"&&e("h2",{class:"timeline-header",children:["Posts"," ",e(oe,{to:`/search?q=${encodeURIComponent(p)}&type=statuses`,children:e(v,{icon:"arrow-right",size:"l"})})]}),S.length>0?e(L,{children:[e("ul",{class:"timeline",children:S.map(A=>e("li",{children:e(oe,{class:"status-link",to:o?`/${o}/s/${A.id}`:`/s/${A.id}`,children:e(Be,{status:A})})},A.id))}),c!=="statuses"&&e("div",{class:"ui-state",children:e(oe,{class:"plain button",to:`/search?q=${encodeURIComponent(p)}&type=statuses`,children:["See more posts ",e(v,{icon:"arrow-right"})]})})]}):!c&&(f==="loading"?e("p",{class:"ui-state",children:e($e,{abrupt:!0})}):e("p",{class:"ui-state",children:"No posts found."}))]}),!!c&&(f==="default"?h?e(ht,{onChange:A=>{A&&P()},children:e("button",{type:"button",class:"plain block",onClick:()=>P(),style:{marginBlockEnd:"6em"},children:"Show more…"})}):e("p",{class:"ui-state insignificant",children:"The end."}):f==="loading"&&e("p",{class:"ui-state",children:e($e,{abrupt:!0})}))]}):f==="loading"?e("p",{class:"ui-state",children:e($e,{abrupt:!0})}):e("p",{class:"ui-state",children:"Enter your search term or paste a URL above to get started."})]})]})})}const qr=20,Is=10*60*1e3,Vr=ft(t=>t.v1.trends.links.list().next(),{maxAge:Is}),Gr=ft(t=>t.v1.trends.tags.list().next(),{maxAge:Is});function jr(t){return Ge("@pixelfed/trending")?t.pixelfed.v2.discover.posts.trending.list({range:"daily"}):t.v1.trends.statuses.list({limit:qr})}function Yr(t,n){return t.v1.timelines.link.list(n)}function Cs({columnMode:t,...n}){const s=De($),i=t?{}:St(),{masto:o,instance:r}=ee({instance:(n==null?void 0:n.instance)||i.instance}),{masto:f,instance:u}=ee(),a=`Trending (${r})`;qe(a,"/:instance?/trending");const d=B(),[p,c]=E([]),[h,l]=E([]),b=B();async function m(V){var _;if(V||!b.current){if(b.current=jr(o),Ge("@mastodon/trending-hashtags"))try{const{value:M}=await Gr(o);M!=null&&M.length&&c(M)}catch{}if(Ge("@mastodon/trending-links"))try{const{value:M}=await Vr(o,r),K=(_=M==null?void 0:M.filter)==null?void 0:_.call(M,ue=>ue.type==="link");K!=null&&K.length&&l(K)}catch{}}const A=await b.current.next();let{value:D}=A;return D!=null&&D.length&&(V&&(d.current=D[0].id),D.forEach(M=>{He(M,r)})),{...A,value:D}}const[S,g]=E(!1),y=B(),[I,w]=E(null),k=!!I,T=B(),x=Ge("@mastodon/trending-hashtags");W(()=>{I&&T.current&&T.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[I]);const q=B();async function N(V){(V||!y.current)&&(g(!0),y.current=Yr(o,{url:I})),q.current=I;const A=await y.current.next();let{value:D}=A;return D!=null&&D.length&&(D=wt(D,"public"),D.forEach(_=>{He(_,r)})),q.current===I&&g(!1),{...A,value:D}}async function P(){try{const V=await o.v1.trends.statuses.list({limit:1}).next();let{value:A}=V;return A=wt(A,"public"),A!=null&&A.length&&A[0].id!==d.current?(d.current=A[0].id,!0):!1}catch{return!1}}const J=ge(()=>e(L,{children:[!!p.length&&e("div",{class:"filter-bar expandable",children:[e(v,{icon:"chart",class:"insignificant",size:"l"}),p.map((V,A)=>{const{name:D,history:_}=V,M=_.reduce((K,ue)=>K+ +ue.uses,0);return e(oe,{to:`/${r}/t/${D}`,children:[e("span",{children:[e("span",{class:"more-insignificant",children:"#"}),D]}),e("span",{class:"filter-count",children:je(M)})]},D)})]}),!!h.length&&e("div",{class:"links-bar",children:[e("header",{children:e("h3",{children:"Trending News"})}),h.map(V=>{const{authorName:A,authorUrl:D,blurhash:_,description:M,height:K,image:ue,imageDescription:ne,language:le,providerName:te,providerUrl:we,publishedAt:de,title:ae,url:fe,width:Re}=V,Se=Ut.toUnicode(URL.parse(fe).hostname.replace(/^www\./,"").replace(/\/$/,""));let Ae;if(_){const Oe=Pn(_),xe=Gn(Oe);Ae=jn([.6,xe[1],xe[2]])}return e("div",{children:[e("a",{ref:I===fe?T:null,href:fe,target:"_blank",rel:"noopener noreferrer",class:k?I===fe?"active":"inactive":"",style:Ae?{"--accent-color":`rgb(${Ae.join(",")})`,"--accent-alpha-color":`rgba(${Ae.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:ue,alt:ne,width:Re,height:K,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:Se})," ",!!de&&e(L,{children:"· "}),!!de&&e(L,{children:e(It,{datetime:de,format:"micro"})})]}),!!ae&&e("h1",{class:"title",lang:le,dir:"auto",title:ae,children:ae})]}),!!M&&e("p",{class:"description",lang:le,dir:"auto",title:M,children:M})]})]})}),x&&e("button",{type:"button",class:"small plain4 block",onClick:()=>{w(fe)},disabled:fe===I,children:[e(v,{icon:"comment2"})," ",e("span",{children:"Mentions"})," ",e(v,{icon:"chevron-down"})]})]},fe)})]}),x&&!!h.length&&e("div",{class:`timeline-header-block ${k?"blended":""}`,children:k?e(L,{children:[e("div",{style:{width:50,flexShrink:0,textAlign:"center"},children:S?e($e,{abrupt:!0}):e("button",{type:"button",class:"light",onClick:()=>{w(null)},children:e(v,{icon:"x"})})}),e("p",{children:["Showing posts mentioning"," ",e("span",{class:"link-text",children:I.replace(/^https?:\/\/(www\.)?/i,"").replace(/\/$/,"")})]})]}):e("p",{class:"insignificant",children:"Trending posts"})})]}),[p,h,I,S]);return e(pt,{title:a,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:"Trending"}),e("div",{children:r})]}),id:"trending",instance:r,emptyText:"No trending posts.",errorText:"Unable to load posts",fetchItems:k?N:m,checkForUpdates:k?void 0:P,checkForUpdatesInterval:5*60*1e3,useItemID:!0,headerStart:e(L,{}),boostsCarousel:s.settings.boostsCarousel,filterContext:"public",timelineStart:J,refresh:I,clearWhenRefresh:!0,view:k?"link-mentions":void 0,headerEnd:e(Ze,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(v,{icon:"more",size:"l"})}),children:[e(pe,{onClick:()=>{let V=prompt('Enter a new instance e.g. "mastodon.social"');if(!/\./.test(V)){V&&alert("Invalid instance");return}V&&(V=V.toLowerCase().trim(),location.hash=`/${V}/trending`)},children:[e(v,{icon:"bus"})," ",e("span",{children:"Go to another instance…"})]}),u!==r&&e(pe,{onClick:()=>{location.hash=`/${u}/trending`},children:[e(v,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:["Go to my instance (",e("b",{children:u}),")"]})]})]})},r)}function Wr(){qe("Home","/");const t=De($),{shortcuts:n}=t,s=n.map(i=>{if(!i)return null;const{type:o,...r}=i,f={following:Kn,notifications:ks,list:bs,public:An,bookmarks:fs,favourites:ps,hashtag:gs,mentions:vs,trending:Cs,search:Ss}[o];return!f||o==="search"&&!r.query||o==="list"&&!r.id?null:e(f,{...r,columnMode:!0},o+JSON.stringify(r))});return Le(["1","2","3","4","5","6","7","8","9"],(i,o)=>{try{const r=parseInt(o.keys[0],10)-1;document.querySelectorAll("#columns > *")[r].focus()}catch{}}),e("div",{id:"columns",onContextMenu:i=>{i.target.closest(".deck > header")&&!i.target.closest("a")&&!i.target.closest("button")&&(i.preventDefault(),$.showShortcutsSettings=!0)},children:s})}function Kr(){var n;const t=De($);return W(()=>{(async()=>{const s=await it.drafts.keys();if(s.length){const i=rn();s.filter(r=>r.startsWith(i)).length&&($.showDrafts=!0)}})()},[]),e(L,{children:(t.settings.shortcutsViewMode==="multi-column"||!t.settings.shortcutsViewMode&&t.settings.shortcutsColumnsMode)&&((n=t.shortcuts)!=null&&n.length)?e(Wr,{}):e(Kn,{title:"Home",path:"/",id:"home",headerStart:!1,headerEnd:e(Xr,{})})})}function Xr(){const t=De($),n=B(),[s,i]=E(void 0);return e(L,{children:[e(oe,{ref:n,to:"/notifications",class:`button plain notifications-button ${t.notificationsShowNew?"has-badge":""} ${s||""}`,onClick:o=>{o.stopPropagation(),window.matchMedia("(min-width: calc(40em))").matches&&(o.preventDefault(),i(r=>r?void 0:"open"))},children:e(v,{icon:"notification",size:"l",alt:"Notifications"})}),e(Qr,{state:s,anchorRef:n,onClose:()=>i(void 0)})]})}const Zr=80,Jr=5;function Qr({anchorRef:t,state:n,onClose:s}){const{masto:i,instance:o}=ee(),r=De($),[f,u]=E("default"),a=i.v1.notifications.list({limit:Zr});async function d(){const b=await a.next(),m=b.value;if(m!=null&&m.length){m.forEach(g=>{He(g.status,o,{skipThreading:!0})});const S=ws(m);$.notificationsLast=m[0],$.notifications=S,i.v1.markers.create({notifications:{lastReadId:m[0].id}}).catch(()=>{})}return $.notificationsShowNew=!1,$.notificationsLastFetchTime=Date.now(),b}const[p,c]=E(!1);function h(){return i.v1.followRequests.list({limit:1})}function l(){u("loading"),(async()=>{try{await d();const b=await h();c(!!(b!=null&&b.length)),u("default")}catch{u("error")}})()}return W(()=>{n==="open"&&l()},[n]),e(Yi,{menuClassName:"notifications-menu",state:n,anchorRef:t,onClose:s,portal:{target:document.body},overflow:"auto",viewScroll:"close",position:"anchor",align:"center",boundingBoxPadding:"8 8 8 8",children:[e("header",{children:e("h2",{children:"Notifications"})}),e("main",{children:r.notifications.length?e(L,{children:r.notifications.slice(0,Jr).map(b=>e(mn,{instance:o,notification:b,disableContextMenu:!0},b.id))}):f==="loading"?e("div",{class:"ui-state",children:e($e,{abrupt:!0})}):f==="error"&&e("div",{class:"ui-state",children:[e("p",{children:"Unable to fetch notifications."}),e("p",{children:e("button",{type:"button",onClick:l,children:"Try again"})})]})}),e("footer",{children:[e(oe,{to:"/mentions",class:"button plain",children:[e(v,{icon:"at"})," ",e("span",{children:"Mentions"})]}),e(oe,{to:"/notifications",class:"button plain2",children:[p?e(L,{children:[e("span",{class:"tag collapsed",children:"New"})," ",e("span",{children:"Follow Requests"})]}):e("b",{children:"See all"})," ",e(v,{icon:"arrow-right"})]})]})]})}const ec=Je(Kr),tc=[/^\/@[^@\/]+\/(?:statuses|posts)\/([^\/]+)/i,/\/notes\/([^\/]+)/i,/^\/(?:notice|objects)\/([a-z0-9-]+)/i,/\/@[^@\/]+@?[^\/]+?\/([^\/]+)/i,/^\/p\/[^\/]+\/([^\/]+)/i];function Ts(t){const{hostname:n,pathname:s}=URL.parse(t);for(const i of tc){const[,o]=s.match(i)||[];if(o)return{instance:n,id:o}}return{}}function nc(t){const{instance:n,id:s}=Ts(t);return n&&s?`/${n}/s/${s}`:null}function ic(){const n=Nt().pathname.replace(/^\//,""),s=Ts(n),i=s!=null&&s.instance?`/${s.instance}/s/${s.id}`:null,[o,r]=E("loading");return ut(()=>{r("loading"),(async()=>{try{const{instance:f,id:u}=s,{masto:a}=ee({instance:f});if(await a.v1.statuses.$select(u).fetch()){window.location.hash=i+"?view=full";return}}catch{}{const{masto:f,instance:u}=ee(),a=await f.v2.search.fetch({q:n,limit:1,resolve:!0});if(a.statuses.length){const d=a.statuses[0];window.location.hash=`/${u}/s/${d.id}?view=full`}else if(a.accounts.length){const d=a.accounts[0];window.location.hash=`/${u}/a/${d.id}`}else i?window.location.hash=i+"?view=full":r("error")}})()},[i]),e("div",{class:"ui-state",tabIndex:"-1",children:[o==="loading"?e(L,{children:[e($e,{abrupt:!0}),e("h2",{children:"Resolving…"}),e("p",{children:e("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:n})})]}):e(L,{children:[e("h2",{children:"Unable to resolve URL"}),e("p",{children:e("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:n})})]}),e("hr",{}),e("p",{children:e(oe,{to:"/",children:"Go home"})})]})}function sc(){qe("Lists","/l");const[t,n]=E("default"),[s,i]=kt(a=>a+1,0),[o,r]=E([]);W(()=>{n("loading"),(async()=>{try{const a=await xn();r(a),n("default")}catch{n("error")}})()},[s]);const[f,u]=E(!1);return e("div",{id:"lists-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck",children:[e("header",{children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Tt,{}),e(oe,{to:"/",class:"button plain",children:e(v,{icon:"home",size:"l"})})]}),e("h1",{children:"Lists"}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>u(!0),children:e(v,{icon:"plus",size:"l",alt:"New list"})})})]})}),e("main",{children:o.length>0?e(L,{children:[e("ul",{class:"link-list",children:o.map(a=>e("li",{children:e(oe,{to:`/l/${a.id}`,children:e("span",{children:[e(v,{icon:"list"})," ",e("span",{children:a.title})]})})}))}),o.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:[o.length," list",o.length===1?"":"s"]})})]}):t==="loading"?e("p",{class:"ui-state",children:e($e,{})}):t==="error"?e("p",{class:"ui-state",children:"Unable to load lists."}):e("p",{class:"ui-state",children:"No lists yet."})})]}),f&&e(Ee,{onClick:a=>{a.target===a.currentTarget&&u(!1)},children:e(Vn,{list:f==null?void 0:f.list,onClose:a=>{a.state==="success"&&i(),u(!1)}})})]})}const oc=""+new URL("instances-MzK7fGXv.json",import.meta.url).href;var ac={PHANPY_CLIENT_NAME:"Phanpy",PHANPY_WEBSITE:"https://phanpy.social",PHANPY_LINGVA_INSTANCES:"lingva.phanpy.social lingva.lunar.icu lingva.garudalinux.org translate.plausibility.cloud",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",VITE_APP_ENV:"production",BASE_URL:"./",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{PHANPY_CLIENT_NAME:rc,PHANPY_WEBSITE:cc}=ac,Xn="read write follow push";async function lc({instanceURL:t}){const n=new URLSearchParams({client_name:rc,redirect_uris:location.origin+location.pathname,scopes:Xn,website:cc});return await(await fetch(`https://${t}/api/v1/apps`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:n.toString()})).json()}async function dc({instanceURL:t,client_id:n}){const s=new URLSearchParams({client_id:n,scope:Xn,redirect_uri:location.origin+location.pathname,response_type:"code"});return`https://${t}/oauth/authorize?${s.toString()}`}async function uc({instanceURL:t,client_id:n,client_secret:s,code:i}){const o=new URLSearchParams({client_id:n,client_secret:s,redirect_uri:location.origin+location.pathname,grant_type:"authorization_code",code:i,scope:Xn});return await(await fetch(`https://${t}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:o.toString()})).json()}var hc={PHANPY_CLIENT_NAME:"Phanpy",PHANPY_WEBSITE:"https://phanpy.social",PHANPY_LINGVA_INSTANCES:"lingva.phanpy.social lingva.lunar.icu lingva.garudalinux.org translate.plausibility.cloud",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",VITE_APP_ENV:"production",BASE_URL:"./",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{PHANPY_DEFAULT_INSTANCE:fc}=hc;function pc(){var y,I;qe("Log in");const t=B(),n=ye.local.get("instanceURL"),[s,i]=E("default"),[o]=ot(),r=o.get("instance"),f=o.get("submit"),[u,a]=E(r||(n==null?void 0:n.toLowerCase())||""),[d,p]=E([]),c=B();W(()=>{(async()=>{try{const k=await(await fetch(oc)).json();p(k),c.current=new no(k)}catch{}})()},[]);const h=w=>{w&&(ye.local.set("instanceURL",w),(async()=>{i("loading");try{const{client_id:k,client_secret:T,vapid_key:x}=await lc({instanceURL:w});k&&T?(ye.session.set("clientID",k),ye.session.set("clientSecret",T),ye.session.set("vapidKey",x),location.href=await dc({instanceURL:w,client_id:k})):alert("Failed to register application"),i("default")}catch{i("error")}})())},l=u?u.replace(/^https?:\/\//,"").replace(/\/+$/,"").replace(/^@?[^@]+@/,"").trim():null,b=/[^\s\r\n\t\/\\]+\.[^\s\r\n\t\/\\]+/.test(l)&&!/[\s\/\\@]/.test(l),m=l?(I=(y=c.current)==null?void 0:y.search(l,{limit:10}))==null?void 0:I.map(w=>w.item):[],S=b?l:m!=null&&m.length?m[0]:u?d.find(w=>w.includes(u)):null,g=w=>{w.preventDefault(),h(S)};return f&&W(()=>{h(r||S)},[]),e("main",{id:"login",style:{textAlign:"center"},children:e("form",{onSubmit:g,children:[e("h1",{children:[e("img",{src:Hn,alt:"",width:"80",height:"80"}),e("br",{}),"Log in"]}),e("label",{children:[e("p",{children:"Instance"}),e("input",{value:u,required:!0,type:"text",class:"large",id:"instanceURL",ref:t,disabled:s==="loading",autocorrect:"off",autocapitalize:"off",autocomplete:"off",spellCheck:!1,placeholder:"instance domain",onInput:w=>{a(w.target.value)}}),(m==null?void 0:m.length)>0?e("ul",{id:"instances-suggestions",children:m.map((w,k)=>e("li",{children:e("button",{type:"button",class:"plain5",onClick:()=>{h(w)},children:w})}))}):e("div",{id:"instances-eg",children:"e.g. “mastodon.social”"})]}),s==="error"&&e("p",{class:"error",children:"Failed to log in. Please try again or another instance."}),e("div",{children:[e("button",{disabled:s==="loading"||!u||!S,children:S?`Continue with ${S}`:"Continue"})," "]}),e($e,{hidden:s!=="loading"}),e("hr",{}),!fc&&e("p",{children:e("a",{href:"https://joinmastodon.org/servers",target:"_blank",children:"Don't have an account? Create one!"})}),e("p",{children:e(oe,{to:"/",children:"Go home"})})]})})}const en=40,mc=10,gc=5;let Rn={},sn={},on={};function an(t){delete sn[t],delete on[t]}const Ft={block:"nearest",inline:"center",behavior:"smooth"},Ai=".status-link:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *), .status-focus:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *)",Ri=/\/s\//i;function bc(t){var w;const{id:n}=t,{masto:s,instance:i}=ee({instance:t.instance}),o=De($),[r,f]=ot(),u=r.get("media"),a=r.get("media-only"),d=parseInt(u||a,10);let p=d>0;const c=r.get("mediaStatusID"),h=zi(c,i);c&&!h&&(p=!1);const l=p&&!!a,b=Xe(n,i),[m,S]=E($.statuses[b]);W(()=>{$.statuses[b]&&S($.statuses[b])},[b]);const g=ge(()=>{const{prevLocation:k}=$,T=((k==null?void 0:k.pathname)||"")+((k==null?void 0:k.search)||""),x=qt("/:instance/s/:id",T)||qt("/s/:id",T);return!T||x?"/":T},[]);W(()=>{!m&&p&&(async()=>{try{const k=await s.v1.statuses.$select(n).fetch();He(k,i),S(k)}catch{alert("Unable to load post."),location.hash=g}})()},[p]);const y=c?(w=o.statuses[Xe(c,i)])==null?void 0:w.mediaAttachments:m==null?void 0:m.mediaAttachments,I=et(()=>{!window.matchMedia("(min-width: calc(40em + 350px))").matches&&o.prevLocation?history.back():l?location.hash=g:(r.delete("media"),r.delete("mediaStatusID"),f(r))},[l,g,o.prevLocation]);return W(()=>{let k=setTimeout(()=>{const T=document.querySelector(".carousel");T&&T.focus()},100);return()=>clearTimeout(k)},[l]),W(()=>{const k=document.querySelectorAll(".deck-container");return k.forEach(T=>{T.setAttribute("inert","")}),()=>{k.forEach(T=>{T.removeAttribute("inert")})}},[]),e("div",{class:"deck-backdrop",children:[p?y!=null&&y.length?e(ls,{mediaAttachments:y,statusID:c||n,instance:i,lang:m==null?void 0:m.language,index:d-1,onClose:I}):e("div",{class:"media-modal-container loading",children:e($e,{abrupt:!0})}):e(oe,{to:g}),!l&&e(wc,{id:n,instance:t.instance,closeLink:g})]})}function yc(t){const{linkable:n,to:s,onClick:i,...o}=t;return n?e(oe,{class:"status-link",to:s,onClick:i,...o}):e("div",{class:"status-focus",tabIndex:0,...o})}function wc({id:t,closeLink:n="/",instance:s}){var U,G;const[i,o]=ot(),r=i.get("media"),f=i.get("mediaStatusID"),u=parseInt(r,10)>0,a=B(!$.prevLocation&&(history.length===1||"navigation"in window&&((G=(U=navigation==null?void 0:navigation.entries)==null?void 0:U.call(navigation))==null?void 0:G.length)===1)),[d,p]=E(i.get("view")||a.current?"full":null),c=!!parseInt(i.get("translate")),{masto:h,instance:l}=ee({instance:s}),{masto:b,instance:m,authenticated:S}=ee(),g=l===m,y=De($),[I,w]=E([]),[k,T]=E("default"),x=B(),q=Xe(t,l),N=B(0),P=B();W(()=>{var R;(R=P.current)==null||R.focus()},[]),W(()=>{var H;const R=Xi(()=>{if(!P.current)return;const{scrollTop:X}=P.current;k!=="loading"&&(on[t]=X)},50);return(H=P.current)==null||H.addEventListener("scroll",R,{passive:!0}),R(),()=>{var X;R.cancel(),(X=P.current)==null||X.removeEventListener("scroll",R)}},[t,k!=="loading"]);const J=B(),V=B(),A=({reloadHero:R}={})=>{T("loading");let H;const X=sn[t];if(X){const ce=X.filter(Pe=>$.statuses[q]);w(ce)}else w([{id:t}]);return(async()=>{var j,z;const ce=()=>si(()=>h.v1.statuses.$select(t).fetch(),{retries:4}),Pe=si(()=>h.v1.statuses.$select(t).context.fetch(),{retries:8}),C=!!y.statuses[q];let O=y.statuses[q];if(!(C&&!R))try{O=await ce(),He(O,l),await new Promise(Z=>{setTimeout(Z,100)})}catch{T("error");return}try{let Z=function(Y){return Y==null?void 0:Y.map(ke=>({id:ke.id,account:ke.account,repliesCount:ke.repliesCount,content:ke.content,weight:Ht(ke),replies:Z(ke.__replies)}))};const be=await Pe,{ancestors:he,descendants:se}=be;N.current=(se==null?void 0:se.length)||0;const Te=new Set;he.forEach(Y=>{He(Y,l,{skipThreading:!0}),Y.inReplyToId&&!he.find(ke=>ke.id===Y.inReplyToId)&&Te.add(Y.inReplyToId)});const Ne=he.every(Y=>Y.account.id===O.account.id),Fe=[];se.forEach(Y=>{if(He(Y,l,{skipThreading:!0}),Y.inReplyToId&&!se.find(ke=>ke.id===Y.inReplyToId)&&Y.inReplyToId!==O.id&&Te.add(Y.inReplyToId),Y.inReplyToAccountId===Y.account.id)Fe.push(Y);else if(Y.inReplyToId===O.id)Fe.push(Y);else if(!Y.inReplyToAccountId&&Fe.find(ke=>ke.id===Y.inReplyToId)&&Y.account.id===O.account.id)Fe.push(Y);else{const ke=se.find(nt=>nt.id===Y.inReplyToId);ke&&(ke.__replies||(ke.__replies=[]),ke.__replies.push(Y))}}),Te.size;const Me=[...he.map(Y=>({id:Y.id,ancestor:!0,isThread:Ne,accountID:Y.account.id,account:Y.account,repliesCount:Y.repliesCount,weight:Ht(Y)})),{id:t,accountID:O.account.id,weight:Ht(O)},...Fe.map(Y=>({id:Y.id,account:Y.account,accountID:Y.account.id,descendant:!0,thread:Y.account.id===O.account.id,weight:Ht(Y),replies:Z(Y.__replies)}))];T("default"),J.current={offsetTop:(j=x.current)==null?void 0:j.offsetTop,scrollTop:(z=P.current)==null?void 0:z.scrollTop};const Ve=Me.findIndex(Y=>Y.id===t);Ve>=te&&we(Ve+1),w(Me),sn[t]=Me,Ns(O,l)}catch{T("error")}})(),V.current=Date.now(),()=>{clearTimeout(H)}};W(A,[t,h]);const[D,_]=E(!1);W(()=>{let R=setInterval(()=>{const H=Date.now();V.current&&H-V.current>=6e4&&_(!0)},6e4);return()=>{clearInterval(R)}},[]),ut(()=>{var H,X;if(!I.length)return;const R=on[t];if(R)P.current.scrollTop=R;else if(J.current){const ce={offsetTop:(H=x.current)==null?void 0:H.offsetTop,scrollTop:(X=P.current)==null?void 0:X.scrollTop},Pe=ce.offsetTop-J.current.offsetTop+ce.scrollTop;P.current.scrollTop=Pe}else I.length===1&&(P.current.scrollTop=0);J.current=null},[I]),W(()=>{y.reloadStatusPage<=0||(async()=>{try{const{instanceURL:R}=Et(),H=`https://${R}/api/v1/statuses/${t}/context`;return await(await caches.open("api")).delete(H,{ignoreVary:!0}),A({reloadHero:!0})}catch{}})()},[y.reloadStatusPage]),W(()=>()=>{on={},$.reloadStatusPage=0,sn={},Rn={},En.clear()},[]);const M=y.statuses[q]||y.statuses[t],K=ge(()=>{if(!M)return"";const{account:R}=M,H=document.createElement("div");return H.innerHTML=R.displayName,H.innerText.trim()},[M]),ue=ge(()=>{if(!M)return"";let R=Nn(M);return R.length>64&&(R=R.slice(0,64)+"…"),R},[M]);qe(K&&ue?`${K}: "${ue}"`:"Status","/:instance?/s/:id");const ne=ge(()=>{if(!M)return;const{url:R}=M;if(R)return URL.parse(R).hostname},[M]),le=ge(()=>{if(ne)return ne===l},[ne,l]),[te,we]=E(en),de=ge(()=>I.length-te,[I.length,te]),ae=I.some(R=>R.descendant),fe=I.filter(R=>R.ancestor),[Re,Se]=E(!0),Ae=ge(()=>{if(!x.current||Re)return null;const{top:R}=x.current.getBoundingClientRect();return R>0?"down":"up"},[Re]);Le("esc",()=>{location.hash=n},{enabled:!u,ignoreEventWhen:R=>!!document.querySelector("#modal-container > *")}),Le("backspace",()=>{location.hash=n}),Le("j",()=>{const R=document.activeElement.closest(".status-link, .status-focus"),H=R==null?void 0:R.getBoundingClientRect(),X=Array.from(P.current.querySelectorAll(Ai));if(R&&H.top0){const ce=X.indexOf(R);let Pe=X[ce+1];Pe&&(Pe.focus(),Pe.scrollIntoView(Ft))}else{const ce=X.find(Pe=>{const C=Pe.getBoundingClientRect();return C.top>=44&&C.left>=0});ce&&(ce.focus(),ce.scrollIntoView(Ft))}}),Le("k",()=>{const R=document.activeElement.closest(".status-link, .status-focus"),H=R==null?void 0:R.getBoundingClientRect(),X=Array.from(P.current.querySelectorAll(Ai));if(R&&H.top0){const ce=X.indexOf(R);let Pe=X[ce-1];Pe&&(Pe.focus(),Pe.scrollIntoView(Ft))}else{const ce=X.find(Pe=>{const C=Pe.getBoundingClientRect();return C.top>=44&&C.left>=0});ce&&(ce.focus(),ce.scrollIntoView(Ft))}}),Le("x",()=>{const R=document.activeElement.closest(".status-link, .status-focus");if(R){const H=R.nextElementSibling;H&&H.tagName.toLowerCase()==="details"&&(H.open=!H.open)}});const[Oe,xe]=E(!1),Ie=B(u?"media+status":"status"),Ce=et((R,H,X,ce)=>{R.preventDefault(),R.stopPropagation(),o({media:H+1,mediaStatusID:ce.id})},[t]),ve=et((R,H)=>{an(H.id)},[]);W(()=>{let R;return f&&u&&(R=setTimeout(()=>{var X;const H=(X=P.current)==null?void 0:X.querySelector(`.status-link[href*="/${f}"]`);H&&H.scrollIntoView(Ft)},400)),()=>{clearTimeout(R)}},[f,u]);const Q=et((R,H)=>{const{id:X,ancestor:ce,isThread:Pe,descendant:C,thread:O,replies:j,repliesCount:z,weight:Z}=R,be=X===t;return e("li",{ref:be?x:null,class:`${ce?"ancestor":""} ${C?"descendant":""} ${O?"thread":""} ${be?"hero":""}`,children:[be?e(L,{children:[e(ht,{threshold:.1,onChange:se=>{queueMicrotask(()=>{requestAnimationFrame(()=>{Se(se)})})},class:"status-focus",tabIndex:0,children:e(Be,{statusID:X,instance:l,withinContext:!0,size:"l",enableTranslate:!0,forceTranslate:c})}),k!=="loading"&&!S?e("div",{class:"post-status-banner",children:[e("p",{children:"You're not logged in. Interactions (reply, boost, etc) are not possible."}),e(oe,{to:"/login",class:"button",children:"Log in"})]}):!g&&e("div",{class:"post-status-banner",children:[e("p",{children:["This post is from another instance (",e("b",{children:l}),"). Interactions (reply, boost, etc) are not possible."]}),e("button",{type:"button",disabled:k==="loading",onClick:()=>{T("loading"),(async()=>{try{const se=await b.v2.search.fetch({q:M.url,type:"statuses",resolve:!0,limit:1});if(se.statuses.length){const Te=se.statuses[0];location.hash=m?`/${m}/s/${Te.id}`:`/s/${Te.id}`}else throw new Error("No results")}catch(se){T("default"),alert("Error: "+se)}})()},children:[e(v,{icon:"transfer"})," Switch to my instance to enable interactions"]})]})]}):e(yc,{linkable:Pe||ce,to:l?`/${l}/s/${X}`:`/s/${X}`,onClick:()=>{an(X)},children:[H===0&&ce?e(ht,{threshold:.5,onChange:se=>{queueMicrotask(()=>{requestAnimationFrame(()=>{xe(se)})})},children:e(Be,{statusID:X,instance:l,withinContext:!0,size:O||ce?"m":"s",enableTranslate:!0,onMediaClick:Ce,onStatusLinkClick:ve})}):e(Be,{statusID:X,instance:l,withinContext:!0,size:O||ce?"m":"s",enableTranslate:!0,onMediaClick:Ce,onStatusLinkClick:ve,showActionsBar:!!C}),ce&&z>1&&e("div",{class:"replies-link",children:[e(v,{icon:"comment2"})," ",e("span",{title:z,children:je(z)})]})," "]}),C&&(j==null?void 0:j.length)>0&&e(xs,{instance:l,replies:j,hasParentThread:O,level:1,accWeight:Z,openAll:N.currentan(X)}}),k==="loading"&&be&&!!(M!=null&&M.repliesCount)&&!ae&&e("div",{class:"status-loading",children:e($e,{abrupt:M.repliesCount>=3})}),k==="error"&&be&&!!(M!=null&&M.repliesCount)&&!ae&&e("div",{class:"status-error",children:["Unable to load replies.",e("br",{}),e("button",{type:"button",class:"plain",onClick:()=>{$.reloadStatusPage++},children:"Try again"})]})]},X)},[t,l,k,S,g,c,Ce,ve,ae]),me=ge(()=>{var R;if("navigation"in window&&(navigation!=null&&navigation.entries)){const H=navigation.entries()[navigation.currentEntry.index-1];if(H!=null&&H.url)return Ri.test(H.url)}return Ri.test((R=$.prevLocation)==null?void 0:R.pathname)},[q]),F=ge(()=>{if(!de)return[];const R=[];function H(X){R.push(X.id),X.replies&&X.replies.forEach(H)}return I.slice(te).forEach(H),R.map(X=>Xe(X,l))},[de,I,te,l]),re=ge(()=>I.slice(0,te).map(Q),[I,te,Q]);return W(()=>{let R=setTimeout(()=>{if(!x.current)return;const H=x.current.querySelector(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)");H&&H.click()},1e3);return()=>clearTimeout(R)},[t]),e("div",{tabIndex:"-1",ref:P,class:`status-deck deck contained ${I.length>1?"padded-bottom":""} ${Ie.current==="status"&&!a.current?"slide-in":""} ${d?`deck-view-${d}`:""}`,onAnimationEnd:R=>{Ie.current==="status"&&(Ie.current=null)},children:[e("header",{class:`${k==="loading"?"loading":""}`,onDblClick:R=>{$.reloadStatusPage++},children:e("div",{class:"header-grid header-grid-2",children:[e("h1",{children:[me&&e("button",{type:"button",class:"plain deck-back",onClick:()=>{history.back()},children:e(v,{icon:"chevron-left",size:"xl"})}),!Re&&M&&k!=="loading"?e(L,{children:[e("span",{class:"hero-heading",children:[e(_t,{account:M.account,instance:l,showAvatar:!0,short:!0})," ",e("span",{class:"insignificant",children:["•"," ",e(It,{datetime:M.createdAt,format:"micro"})]})]})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:R=>{R.preventDefault(),R.stopPropagation(),x.current.scrollIntoView({behavior:"smooth",block:"start"})},title:"Go to main post",children:e(v,{icon:Ae==="down"?"arrow-down":"arrow-up"})})]}):e(L,{children:["Post"," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:R=>{R.preventDefault(),R.stopPropagation(),P.current.scrollTo({top:0,behavior:"smooth"})},hidden:!fe.length||Oe,title:`${fe.length} posts above ‒ Go to top`,children:[e(v,{icon:"arrow-up"}),fe.filter((R,H,X)=>X.findIndex(ce=>ce.accountID===R.accountID)===H).slice(0,3).map(R=>e(st,{url:R.account.avatar,alt:R.account.displayName},R.account.id)),fe.length>3&&e(L,{children:[" ",e("span",{class:"insignificant",children:je(fe.length)})]})]})]})]}),e("div",{class:"header-side",children:[e("button",{type:"button",class:"plain4 button-switch-view",style:{display:d==="full"?"":"none"},onClick:()=>{p(null),i.delete("media"),i.delete("media-only"),i.delete("view"),o(i)},title:"Switch to Side Peek view",children:e(v,{icon:"layout4",size:"l"})}),D&&e("button",{type:"button",class:"plain button-refresh",onClick:()=>{$.reloadStatusPage++,_(!1)},children:e(v,{icon:"refresh",size:"l"})}),e(Ze,{align:"end",portal:{target:P.current},menuButton:e("button",{type:"button",class:"button plain4",children:e(v,{icon:"more",alt:"Actions",size:"xl"})}),children:[e(pe,{disabled:k==="loading",onClick:()=>{$.reloadStatusPage++},children:[e(v,{icon:"refresh"}),e("span",{children:"Refresh"})]}),e(pe,{className:"menu-switch-view",onClick:()=>{p(d==="full"?null:"full"),i.delete("media"),i.delete("media-only"),d==="full"?i.delete("view"):i.set("view","full"),o(i)},children:[e(v,{icon:{"":"layout5",full:"layout4"}[d||""]}),e("span",{children:["Switch to ",d==="full"?"Side Peek":"Full"," view"]})]}),e(pe,{onClick:()=>{Array.from(P.current.querySelectorAll(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)")).forEach(H=>{H.click()})},children:[e(v,{icon:"eye-open"})," ",e("span",{children:"Show all sensitive content"})]}),e(ze,{}),e(Ki,{className:"plain",children:"Experimental"}),e(pe,{disabled:!ne||le,onClick:()=>{const R=nc(M.url);R?location.hash=R:alert("Unable to switch")},children:[e(v,{icon:"transfer"}),e("small",{class:"menu-double-lines",children:["Switch to post's instance",ne?e(L,{children:[" ","(",e("b",{children:Ut.toUnicode(ne)}),")"]}):""]})]})]}),e(oe,{class:"button plain deck-close",to:n,children:e(v,{icon:"x",size:"xl"})})]})]})}),I.length&&M?e("ul",{class:`timeline flat contextual grow ${k==="loading"?"loading":""}`,children:[re,de>0&&e("li",{children:e("button",{type:"button",class:"plain block show-more",disabled:k==="loading",onClick:()=>we(R=>R+en),style:{marginBlockEnd:"6em"},"data-state-post-ids":F.join(" "),children:[e("div",{class:"ib avatars-bunch",children:I.slice(te,te+5).map(R=>e(st,{url:R.account.avatarStatic},R.id))})," ",e("div",{class:"ib",children:["Show more…"," ",e("span",{class:"tag",children:de>en?`${en}+`:de})]})]})})]}):e(L,{children:[k==="loading"&&e("ul",{class:"timeline flat contextual grow loading",children:e("li",{children:e(Be,{skeleton:!0,size:"l"})})}),k==="error"&&e("p",{class:"ui-state",children:["Unable to load post",e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>{$.reloadStatusPage++},children:"Try again"})]})]})]})}function xs({replies:t,instance:n,hasParentThread:s,level:i,accWeight:o,openAll:r,parentLink:f}){const[u,a]=ot(),d=y=>y.reduce((I,w)=>{const{repliesCount:k,replies:T}=w,x=(T==null?void 0:T.length)||k;return I+x+d(T||[])},0),p=t.length+d(t),c=t.length===p,h=t.map(y=>y.account).filter((y,I,w)=>w.findIndex(k=>k.id===y.id)===I).slice(0,3),l=ge(()=>t==null?void 0:t.reduce((y,I)=>y+(I==null?void 0:I.weight),o),[o,t==null?void 0:t.length]);let b=!1;(r||l<=gc||!s&&p===1&&Ht(t[0])<2)&&(b=!0);const m=Rn[t[0].id],S=et((y,I,w,k)=>{y.preventDefault(),y.stopPropagation(),a({media:I+1,mediaStatusID:k.id})},[]),g=B();return ut(()=>{var I;function y(w){w.target.dataset.scrollLeft=w.target.scrollLeft}return(I=g.current)==null||I.addEventListener("scroll",y,{passive:!0}),()=>{var w;(w=g.current)==null||w.removeEventListener("scroll",y)}},[]),e("details",{ref:g,class:"replies",open:m||b,onToggle:y=>{const{open:I}=y.target;Rn[t[0].id]=I},style:{"--comments-level":i},"data-comments-level":i,"data-comments-level-overflow":i>4,children:[e("summary",{class:"replies-summary",hidden:b,children:[e("span",{class:"avatars",children:h.map(y=>e(st,{url:y.avatarStatic,title:`${y.displayName} @${y.username}`,squircle:y==null?void 0:y.bot},y.id))}),e("span",{class:"replies-counts",children:[e("b",{children:[e("span",{title:t.length,children:je(t.length)})," ","repl",t.length===1?"y":"ies"]}),!c&&p>1&&e(L,{children:[" ","·"," ",e("span",{children:[e("span",{title:p,children:je(p)})," ","comment",p===1?"":"s"]})]})]}),e(v,{icon:"chevron-down",class:"replies-summary-chevron"}),!!f&&e(oe,{class:"replies-parent-link",to:f.to,onClick:f.onClick,title:"View post with its replies",children:"»"})]}),e("ul",{children:t.map(y=>{var I,w;return e("li",{children:[e("div",{class:"status-focus",tabIndex:0,children:[e(Be,{statusID:y.id,instance:n,withinContext:!0,size:"s",enableTranslate:!0,onMediaClick:S,showActionsBar:!0}),!((I=y.replies)!=null&&I.length)&&y.repliesCount>0&&e("div",{class:"replies-link",children:[e(v,{icon:"comment2"})," ",e("span",{title:y.repliesCount,children:je(y.repliesCount)})]})]}),((w=y.replies)==null?void 0:w.length)&&e(xs,{instance:n,replies:y.replies,level:i+1,accWeight:b?l:y.weight,openAll:r,parentLink:{to:n?`/${n}/s/${y.id}`:`/s/${y.id}`,onClick:()=>{an(y.id)}}})]},y.id)})})]})}const vc=140,kc=35,Sc=70,Ic=140,En=new Map;function Ht(t){var l,b;const n=En.get(t.id);if(n)return n;const{spoilerText:s,content:i,mediaAttachments:o,poll:r,card:f}=t,u=Wi(s+i),a=o!=null&&o.length?vc:0,d=(((l=r==null?void 0:r.options)==null?void 0:l.length)||0)*kc,p=f&&(o!=null&&o.length||(b=r==null?void 0:r.options)!=null&&b.length)?0:Sc,h=(u+a+d+p)/Ic;return En.set(t.id,h),h}const Cc=Je(bc);function Tc(){const t=St(),{id:n,instance:s}=t;return e(Cc,{id:n,instance:s})}const xc=""+new URL("boosts-carousel-YjmjXTE6.jpg",import.meta.url).href,$c=""+new URL("grouped-notifications-xYMFVY91.jpg",import.meta.url).href,Ac=""+new URL("multi-column-ETnJNDVb.jpg",import.meta.url).href,Rc=""+new URL("multi-hashtag-timeline-x-SDVR4g.jpg",import.meta.url).href,Ec=""+new URL("nested-comments-thread-Ib-fZGS3.jpg",import.meta.url).href,_c="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xml:space='preserve'%20fill-rule='evenodd'%20stroke-linejoin='round'%20stroke-miterlimit='2'%20clip-rule='evenodd'%20viewBox='0%200%20102%2028'%3e%3cpath%20fill='none'%20d='M0%200h101.5v27.5H0z'/%3e%3cg%20fill-rule='nonzero'%3e%3cpath%20fill='url(%23a)'%20d='M2.32%2021.85c1.4%200%202.21-.85%202.21-2.3v-4.64H8.5c4.45%200%207.54-2.9%207.54-7.24%200-4.35-2.98-7.24-7.32-7.24h-6.4C.93.43.11%201.28.11%202.73v16.82c0%201.45.82%202.3%202.21%202.3Zm2.21-10.4V3.94h3c2.54%200%204%201.34%204%203.75s-1.47%203.76-4%203.76h-3Z'/%3e%3cpath%20fill='url(%23b)'%20d='M20.52%2021.88c1.25%200%202.13-.76%202.13-2.23v-7.04c0-2.07%201.2-3.49%203.21-3.49%201.95%200%202.95%201.23%202.95%203.25v7.28c0%201.47.89%202.23%202.13%202.23%201.26%200%202.14-.76%202.14-2.23v-8.18c0-3.64-1.99-5.9-5.48-5.9-2.38%200-4.1%201.12-4.93%203.1h-.09V2.3c0-1.38-.78-2.2-2.1-2.2-1.31%200-2.1.82-2.1%202.2v17.34c0%201.47.9%202.23%202.14%202.23Z'/%3e%3cpath%20fill='url(%23c)'%20d='M40.45%2021.82c1.96%200%203.93-.98%204.8-2.65h.1v.8c.08%201.27.89%201.91%202.05%201.91%201.21%200%202.08-.73%202.08-2.15v-8.95c0-3.17-2.63-5.25-6.65-5.25-3.26%200-5.78%201.16-6.5%203.04-.15.32-.23.63-.23.96%200%20.97.75%201.64%201.79%201.64.69%200%201.23-.26%201.7-.79.95-1.23%201.74-1.65%203.04-1.65%201.62%200%202.64.85%202.64%202.31v1.04l-3.95.24c-3.93.23-6.13%201.88-6.13%204.74%200%202.83%202.27%204.76%205.26%204.76Zm1.4-3.09c-1.43%200-2.4-.73-2.4-1.9%200-1.12.91-1.83%202.51-1.95l3.31-.2v1.14c0%201.7-1.54%202.91-3.41%202.91Z'/%3e%3cpath%20fill='url(%23d)'%20d='M54.37%2021.88c1.26%200%202.14-.76%202.14-2.23v-7.09c0-2.03%201.21-3.44%203.13-3.44s2.89%201.17%202.89%203.22v7.31c0%201.47.88%202.23%202.14%202.23%201.24%200%202.13-.76%202.13-2.23v-8.2c0-3.68-1.96-5.87-5.45-5.87-2.41%200-4%201.07-4.83%203.01h-.09v-.87c0-1.35-.85-2.17-2.14-2.17-1.28%200-2.06.82-2.06%202.15v11.95c0%201.47.9%202.23%202.14%202.23Z'/%3e%3cpath%20fill='url(%23e)'%20d='M71.65%2027.17c1.26%200%202.14-.76%202.14-2.23v-6h.09a5.15%205.15%200%200%200%204.88%202.88c3.92%200%206.35-3.05%206.35-8.1%200-5.07-2.44-8.1-6.43-8.1a5.12%205.12%200%200%200-4.86%202.99h-.09v-.85c0-1.45-.88-2.21-2.1-2.21-1.24%200-2.11.76-2.11%202.2v17.2c0%201.46.89%202.22%202.13%202.22Zm5.6-8.8c-2.1%200-3.47-1.8-3.47-4.65%200-2.81%201.37-4.67%203.47-4.67%202.14%200%203.49%201.83%203.49%204.67%200%202.86-1.35%204.66-3.5%204.66Z'/%3e%3cpath%20fill='url(%23f)'%20d='M89.61%2027.39c3.44%200%205.26-1.5%206.73-5.55l4.81-13.1a4%204%200%200%200%20.24-1.26c0-1.13-.85-1.93-2.08-1.93-1.1%200-1.71.51-2.07%201.7l-3.4%2010.9h-.08L90.35%207.28c-.36-1.25-.94-1.73-2.07-1.73-1.26%200-2.21.83-2.21%201.99%200%20.35.09.82.25%201.26l5%2013.21-.21.56c-.52%201.1-1.32%201.42-2.07%201.42l-.75-.01c-.96%200-1.56.54-1.56%201.4%200%201.29%201%202%202.88%202Z'/%3e%3c/g%3e%3cdefs%3e%3cradialGradient%20id='a'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='rotate(28.51%20.06%20.22)%20scale(57.6252)'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23a4bff7'/%3e%3cstop%20offset='1'%20stop-color='%236081e6'/%3e%3c/radialGradient%3e%3cradialGradient%20id='b'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='rotate(28.51%20.06%20.22)%20scale(57.6252)'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23a4bff7'/%3e%3cstop%20offset='1'%20stop-color='%236081e6'/%3e%3c/radialGradient%3e%3cradialGradient%20id='c'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='rotate(28.51%20.06%20.22)%20scale(57.6252)'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23a4bff7'/%3e%3cstop%20offset='1'%20stop-color='%236081e6'/%3e%3c/radialGradient%3e%3cradialGradient%20id='d'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='rotate(28.51%20.06%20.22)%20scale(57.6252)'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23a4bff7'/%3e%3cstop%20offset='1'%20stop-color='%236081e6'/%3e%3c/radialGradient%3e%3cradialGradient%20id='e'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='rotate(28.51%20.06%20.22)%20scale(57.6252)'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23a4bff7'/%3e%3cstop%20offset='1'%20stop-color='%236081e6'/%3e%3c/radialGradient%3e%3cradialGradient%20id='f'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='rotate(28.51%20.06%20.22)%20scale(57.6252)'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23a4bff7'/%3e%3cstop%20offset='1'%20stop-color='%236081e6'/%3e%3c/radialGradient%3e%3c/defs%3e%3c/svg%3e";var Lc={PHANPY_CLIENT_NAME:"Phanpy",PHANPY_WEBSITE:"https://phanpy.social",PHANPY_LINGVA_INSTANCES:"lingva.phanpy.social lingva.lunar.icu lingva.garudalinux.org translate.plausibility.cloud",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",VITE_APP_ENV:"production",BASE_URL:"./",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{PHANPY_DEFAULT_INSTANCE:zt,PHANPY_WEBSITE:Ei,PHANPY_PRIVACY_POLICY_URL:Mc,PHANPY_DEFAULT_INSTANCE_REGISTRATION_URL:_i}=Lc,Li=Ei?Ei.replace(/https?:\/\//g,"").replace(/\/$/,""):null,Mi=`${"2024-06-23T09:40:47.957Z".slice(0,10).replace(/-/g,".")}.20d0b1c`;function Di(){return qe(null,["/","/welcome"]),e("main",{id:"welcome",children:[e("div",{class:"hero-container",children:[e("div",{class:"hero-content",children:[e("h1",{children:[e("img",{src:Hn,alt:"",width:"160",height:"160",style:{aspectRatio:"1/1",marginBlockEnd:-16}}),e("img",{src:_c,alt:"Phanpy",width:"200"})]}),e("p",{class:"desc",children:"A minimalistic opinionated Mastodon web client."}),e("p",{children:e(oe,{to:zt?`/login?instance=${zt}&submit=1`:"/login",class:"button",children:zt?"Log in":"Log in with Mastodon"})}),zt&&_i&&e("p",{children:e("a",{href:_i,class:"button plain5",children:"Sign up"})}),!zt&&e("p",{class:"insignificant",children:e("small",{children:["Connect your existing Mastodon/Fediverse account.",e("br",{}),"Your credentials are not stored on this server."]})})]}),(Li||Mi)&&e("p",{class:"app-site-version",children:e("small",{children:[Li," ",Mi]})}),e("p",{children:[e("a",{href:"https://github.com/cheeaun/phanpy",target:"_blank",children:"Built"})," ","by"," ",e("a",{href:"https://mastodon.social/@cheeaun",target:"_blank",onClick:t=>{t.preventDefault(),$.showAccount="cheeaun@mastodon.social"},children:"@cheeaun"}),"."," ",e("a",{href:Mc,target:"_blank",children:"Privacy Policy"}),"."]})]}),e("div",{id:"why-container",children:e("div",{class:"sections",children:[e("section",{children:[e("img",{src:xc,alt:"Screenshot of Boosts Carousel",loading:"lazy"}),e("h4",{children:"Boosts Carousel"}),e("p",{children:"Visually separate original posts and re-shared posts (boosted posts)."})]}),e("section",{children:[e("img",{src:Ec,alt:"Screenshot of nested comments thread",loading:"lazy"}),e("h4",{children:"Nested comments thread"}),e("p",{children:"Effortlessly follow conversations. Semi-collapsible replies."})]}),e("section",{children:[e("img",{src:$c,alt:"Screenshot of grouped notifications",loading:"lazy"}),e("h4",{children:"Grouped notifications"}),e("p",{children:"Similar notifications are grouped and collapsed to reduce clutter."})]}),e("section",{children:[e("img",{src:Ac,alt:"Screenshot of multi-column UI",loading:"lazy"}),e("h4",{children:"Single or multi-column"}),e("p",{children:"By default, single column for zen-mode seekers. Configurable multi-column for power users."})]}),e("section",{children:[e("img",{src:Rc,alt:"Screenshot of multi-hashtag timeline with a form to add more hashtags",loading:"lazy"}),e("h4",{children:"Multi-hashtag timeline"}),e("p",{children:"Up to 5 hashtags combined into a single timeline."})]})]})})]})}const Dc=window.alert;window.__nativeAlert||(window.__nativeAlert=Dc);window.alert=function(t){t instanceof Error&&(t!=null&&t.message)&&(t=t.message),typeof t!="string"&&(t=JSON.stringify(t));const n=io({text:t,className:"alert",gravity:"top",position:"center",duration:1e4,offset:{y:48},onClick:()=>{n.hideToast()}});n.showToast()};window.__STATES__=$;window.__STATES_STATS__=()=>{const t=["statuses","accounts","spoilers","unfurledLinks","statusQuotes"],n={};t.forEach(o=>{n[o]=Object.keys($[o]).length});const{statuses:s}=$,i=[];for(const o in s)document.querySelector(`[data-state-post-id~="${o}"], [data-state-post-ids~="${o}"]`)||i.push(o)};setInterval(()=>{if(!window.__IDLE__)return;const{statuses:t,unfurledLinks:n,notifications:s}=$;let i=0;const{instance:o}=ee();for(const r in t){if(!window.__IDLE__)break;try{const f=document.querySelector(`[data-state-post-id~="${r}"], [data-state-post-ids~="${r}"]`),u=s.some(a=>{var d;return r===Xe((d=a.status)==null?void 0:d.id,o)});if(!f&&!u){delete $.statuses[r],delete $.statusQuotes[r];for(const a in n){const d=n[a];if(Xe(d.id,d.instance)===r){delete $.unfurledLinks[a];break}}i++}}catch{}}},15*60*1e3);setTimeout(()=>{for(const t in Kt)setTimeout(()=>{var n,s,i,o;Array.isArray(Kt[t])?(s=(n=Kt[t])[0])==null||s.call(n):(o=(i=Kt)[t])==null||o.call(i)},1)},5e3);(()=>{window.__IDLE__=!0;const t=["mousemove","mousedown","resize","keydown","touchstart","pointerdown","pointermove","wheel"],n=()=>{window.__IDLE__=!0},i=Xi(n,3e3),o=()=>{window.__IDLE__=!1,i()};t.forEach(r=>{window.addEventListener(r,o,{passive:!0,capture:!0})}),window.addEventListener("blur",n,{passive:!0}),document.documentElement.addEventListener("mouseleave",r=>{!r.relatedTarget&&!r.toElement&&n()},{passive:!0})})();const Pc=/iPad|iPhone|iPod/.test(navigator.userAgent);Pc&&document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible"){const t=ye.local.get("theme");let n;if(t){if(n=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),n){const s=n.content,i=t==="light"?n.dataset.themeLightColorTemp:n.dataset.themeDarkColorTemp;n.content=i||"",setTimeout(()=>{n.content=s},10)}}else{const s=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(n=document.querySelector(`meta[name="theme-color"][media*="${s}"]`),n){const i=n.dataset.content,o=n.dataset.contentTemp;n.content=o||"",setTimeout(()=>{n.content=i},10)}}}});{const t=ye.local.get("theme");if(t){document.documentElement.classList.add(`is-${t}`),document.querySelector('meta[name="color-scheme"]').setAttribute("content",t||"dark light");const s=document.querySelector('meta[data-theme-setting="manual"]');s&&(s.name="theme-color",s.content=t==="light"?s.dataset.themeLightColor:s.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(o=>{o.name=""})}const n=ye.local.get("textSize");n&&document.documentElement.style.setProperty("--text-size",`${n}px`)}Oi($,t=>{var n;for(const[s,i,o,r]of t){if(i.join(".")==="settings.shortcutsViewMode"){const f=document.getElementById("app");f&&(f.dataset.shortcutsViewMode=(n=$.shortcuts)!=null&&n.length?o:"")}i.join(".")==="settings.cloakMode"&&document.body.classList.toggle("cloak",o)}});function Nc(){const[t,n]=E(!1),[s,i]=E("loading");W(()=>{const r=ye.local.get("instanceURL"),f=decodeURIComponent((window.location.search.match(/code=([^&]+)/)||[,""])[1]);if(f){window.history.replaceState({},document.title,window.location.pathname||"/");const u=ye.session.get("clientID"),a=ye.session.get("clientSecret"),d=ye.session.get("vapidKey");(async()=>{i("loading");const{access_token:p}=await uc({instanceURL:r,client_id:u,client_secret:a,code:f}),c=Us({instance:r,accessToken:p});await Promise.allSettled([Zn(c),Jn(c,r),Os(c,r,p,d)]),Qn(),n(!0),i("default")})()}else{window.__IGNORE_GET_ACCOUNT_ERROR__=!0;const u=Et();if(u){Ni(u.info.id);const{client:a}=ee({account:u}),{instance:d}=a;Qn(),i("loading"),(async()=>{try{await Zn(a),await Jn(a,d)}catch{}finally{n(!0),i("default")}})()}else i("default")}},[]);let o=Nt();return $.currentLocation=o.pathname,W(Tn,[o,t]),/\/https?:/.test(o.pathname)?e(ic,{}):e(L,{children:[e(Uc,{isLoggedIn:t,loading:s==="loading"}),e(Oc,{isLoggedIn:t}),s==="default"&&e(Ln,{children:e(Ue,{path:"/:instance?/s/:id",element:e(Tc,{})})}),t&&e(co,{}),t&&e(Ma,{}),e(xa,{}),t&&e(Ea,{}),e(ro,{isLoggedIn:t}),s!=="loading"&&e(_a,{onClose:Tn}),e(lo,{})]})}function Uc({isLoggedIn:t,loading:n}){const s=Nt(),i=ge(()=>{const{pathname:o}=s;return!/^\/(login|welcome)/i.test(o)},[s]);return e(Ln,{location:i||s,children:[e(Ue,{path:"/",element:t?e(ec,{}):n?e($e,{id:"loader-root"}):e(Di,{})}),e(Ue,{path:"/login",element:e(pc,{})}),e(Ue,{path:"/welcome",element:e(Di,{})})]})}function Pi(){return $.prevLocation||null}function Oc({isLoggedIn:t}){const n=Nt(),s=B(Pi());return ge(()=>qt("/:instance/s/:id",n.pathname)||qt("/s/:id",n.pathname),[n.pathname,qt])?s.current||(s.current=Pi()):s.current=null,e(Ln,{location:s.current||n,children:[t&&e(L,{children:[e(Ue,{path:"/notifications",element:e(ks,{})}),e(Ue,{path:"/mentions",element:e(vs,{})}),e(Ue,{path:"/following",element:e(Kn,{})}),e(Ue,{path:"/b",element:e(fs,{})}),e(Ue,{path:"/f",element:e(ps,{})}),e(Ue,{path:"/l",children:[e(Ue,{index:!0,element:e(sc,{})}),e(Ue,{path:":id",element:e(bs,{})})]}),e(Ue,{path:"/fh",element:e(Ir,{})}),e(Ue,{path:"/ft",element:e(wr,{})}),e(Ue,{path:"/catchup",element:e(or,{})})]}),e(Ue,{path:"/:instance?/t/:hashtag",element:e(gs,{})}),e(Ue,{path:"/:instance?/a/:id",element:e(Ka,{})}),e(Ue,{path:"/:instance?/p",children:[e(Ue,{index:!0,element:e(An,{})}),e(Ue,{path:"l",element:e(An,{local:!0})})]}),e(Ue,{path:"/:instance?/trending",element:e(Cs,{})}),e(Ue,{path:"/:instance?/search",element:e(Ss,{})})]})}zs(e(Fs,{children:e(Nc,{})}),document.getElementById("app"));setTimeout(()=>{try{Object.keys(localStorage).forEach(t=>{t.startsWith("iconify")&&localStorage.removeItem(t)}),Object.keys(sessionStorage).forEach(t=>{t.startsWith("iconify")&&sessionStorage.removeItem(t)}),localStorage.removeItem("settings:boostsCarousel")}catch{}},5e3);window.__CLOAK__=()=>{document.body.classList.toggle("cloak")}; //# sourceMappingURL=main-hRAbIWke.js.map