phanpy-cz/assets/main-FOJmGvRC.js
2024-07-22 20:23:01 +02:00

33 lines
270 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{A as q,y as Z,h as A,s as $,a as ie,b as He,x as Je,u as Ne,c as e,k as R,d as we,g as dt,p as kt,e as Pi,f as Rt,i as Pt,j as ft,T as me,q as et,l as Rs,L as $e,m as rn,_ as ut,n as Ui,o as Gc,r as Oi,t as Fi,v as Es,C as Ls,w as Xe,z as Ms,B as ot,F as Ns,D as Ds,E as Ps,G as En,H as St,I as qe,J as zi,K as Us,M as Os,N as qt,O as Fs,P as zs,Q as Zn,R as Jn,S as Bs,U as Qn,V as Ln,W as Fe,X as Hs,Y as qs}from"./useTitle-KlNTnsJV.js";import{u as Mn,s as oe,a as Le,o as ei,b as Vs,I as v,M as _e,A as nt,N as Et,c as Ze,d as pe,e as Be,f as tt,L as re,g as Bi,l as Gs,t as ti,h as Ve,R as It,p as Ut,i as Qe,j as Ee,k as Hi,m as Sn,E as qi,n as je,q as rt,r as js,S as cn,v as ni,T as Vi,w as st,x as Nn,y as Ue,z as ht,B as ii,C as Ys,D as Ws,F as Dn,G as Gi,H as Ks,J as Xs,K as Zs,O as ji,P as Vt,Q as Js,U as Qs,V as Yi,W as eo,X as wt,Y as Pn,Z as to,_ as Wi,$ as no,a0 as Ki,a1 as io,a2 as so,a3 as oo,a4 as si,a5 as ao,a6 as Kt}from"./fuse-eCqHk9H3.js";import"./tinyld-light-PxOyhYWY.js";import"./index-cp67bciK.js";var Xi=ro;function ro(t,n,s){var i=null,o=null,a=function(){i&&(clearTimeout(i),o=null,i=null)},h=function(){var r=o;a(),r&&r()},u=function(){if(!n)return t.apply(this,arguments);var r=this,d=arguments,p=s&&!i;if(a(),o=function(){t.apply(r,d)},i=setTimeout(function(){if(i=null,!p){var c=o;return o=null,c()}},n),p)return o()};return u.cancel=a,u.flush=h,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 <www.johndoherty.info>
* @license MIT
*/(function(t,n){"use strict";typeof t.CustomEvent!="function"&&(t.CustomEvent=function(l,g){g=g||{bubbles:!1,cancelable:!1,detail:void 0};var m=n.createEvent("CustomEvent");return m.initCustomEvent(l,g.bubbles,g.cancelable,g.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,a=null,h=null,u=null,r=0;function d(l){if(u===l.target){var g=parseInt(f(u,"data-swipe-threshold","20"),10),m=f(u,"data-swipe-unit","px"),k=parseInt(f(u,"data-swipe-timeout","500"),10),b=Date.now()-h,y="",T=l.changedTouches||l.touches||[];if(m==="vh"&&(g=Math.round(g/100*n.documentElement.clientHeight)),m==="vw"&&(g=Math.round(g/100*n.documentElement.clientWidth)),Math.abs(o)>Math.abs(a)?Math.abs(o)>g&&b<k&&(o>0?y="swiped-left":y="swiped-right"):Math.abs(a)>g&&b<k&&(a>0?y="swiped-up":y="swiped-down"),y!==""){var w={dir:y.replace(/swiped-/,""),touchType:(T[0]||{}).touchType||"direct",fingers:r,xStart:parseInt(s,10),xEnd:parseInt((T[0]||{}).clientX||-1,10),yStart:parseInt(i,10),yEnd:parseInt((T[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,h=null}}function p(l){l.target.getAttribute("data-swipe-ignore")!=="true"&&(u=l.target,h=Date.now(),s=l.touches[0].clientX,i=l.touches[0].clientY,o=0,a=0,r=l.touches.length)}function c(l){if(!(!s||!i)){var g=l.touches[0].clientX,m=l.touches[0].clientY;o=s-g,a=i-m}}function f(l,g,m){for(;l&&l!==n.documentElement;){var k=l.getAttribute(g);if(k)return k;l=l.parentNode}return m}})(window,document);function Lt(t=()=>{},n=[]){const s=q(t);Z(()=>{s.current=t},[n]),Z(()=>{const i=()=>{const o=document.hidden||document.visibilityState==="hidden";s.current(!o)};return document.addEventListener("visibilitychange",i),()=>document.removeEventListener("visibilitychange",i)},[])}const co=1e3*3,lo=15e3,uo=Je(function({isLoggedIn:n}){const[s,i]=A(!0);Lt(i);const o=async(u,r,d)=>{var p;if($.notificationsLast){const c=u.v1.notifications.list({limit:1,sinceId:$.notificationsLast.id}),{value:f}=await c.next();if(f!=null&&f.length)if(d)$.notificationsShowNew=!0;else{let l;try{const g=await u.v1.markers.fetch({timeline:"notifications"});l=(p=g==null?void 0:g.notifications)==null?void 0:p.lastReadId}catch{}l?$.notificationsShowNew=f[0].id!==l:$.notificationsShowNew=!0}}};Z(()=>{let u,r;if(n&&s){const{masto:d,streaming:p,instance:c}=ie();(async()=>{await o(d,c);let f=!1;p&&(r=setTimeout(()=>{(async()=>{try{f=!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{f=!1}f||(r=setInterval(()=>{o(d,c,!0)},lo))})()},co))})()}return()=>{var d;(d=u==null?void 0:u.unsubscribe)==null||d.call(u),u=null,clearTimeout(r),clearInterval(r)}},[s,n]);const a=q(),h=()=>{a.current=Date.now(),fetch("./version.json").then(u=>u.json()).then(u=>{u&&($.appVersion=u)}).catch(u=>{})};return Mn(h,s&&1e3*60*30),Lt(u=>{u&&(a.current?Date.now()-a.current>1e3*60*60&&h():h())}),Le("shift+alt+k",()=>{const u=$.settings.cloakMode;$.settings.cloakMode=!u,oe({text:`Cloak mode ${u?"disabled":"enabled"}`})}),null});function ho(){const t=Ne($);function n(s){if(t.composerState.minimized){$.composerState.minimized=!1,ei();return}s.shiftKey?Vs()||($.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 fo=Je(function(){const n=Ne($);function s(){$.showKeyboardShortcutsHelp=!1}return Le("?, shift+?, shift+slash",i=>{$.showKeyboardShortcutsHelp=!0},{ignoreEventWhen:i=>!!document.querySelector("#modal-container > *")}),!!n.showKeyboardShortcutsHelp&&e(_e,{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(R,{children:[e("kbd",{children:"Shift"})," + ",e("kbd",{children:"j"})]})},{action:"Skip carousel to previous post",keys:e(R,{children:[e("kbd",{children:"Shift"})," + ",e("kbd",{children:"k"})]})},{action:"Load new posts",keys:e("kbd",{children:"."})},{action:"Open post details",keys:e(R,{children:[e("kbd",{children:"Enter"})," or ",e("kbd",{children:"o"})]})},{action:e(R,{children:["Expand content warning or",e("br",{}),"toggle expanded/collapsed thread"]}),keys:e("kbd",{children:"x"})},{action:"Close post or dialogs",keys:e(R,{children:[e("kbd",{children:"Esc"})," or ",e("kbd",{children:"Backspace"})]})},{action:"Focus column in multi-column mode",keys:e(R,{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(R,{children:[e("kbd",{children:"Shift"})," + ",e("kbd",{children:"c"})]})},{action:"Send post",keys:e(R,{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(R,{children:[e("kbd",{children:"Shift"})," + ",e("kbd",{children:"r"})]})},{action:"Like (favourite)",keys:e(R,{children:[e("kbd",{children:"l"})," or ",e("kbd",{children:"f"})]})},{action:"Boost",keys:e(R,{children:[e("kbd",{children:"Shift"})," + ",e("kbd",{children:"b"})]})},{action:"Bookmark",keys:e("kbd",{children:"d"})},{action:"Toggle Cloak mode",keys:e(R,{children:[e("kbd",{children:"Shift"})," + ",e("kbd",{children:"Alt"})," + ",e("kbd",{children:"k"})]})}].map(({action:i,className:o,keys:a})=>e("tr",{children:[e("th",{class:o,children:i}),e("td",{children:a})]},i))})})]})})}),Zi=new Set,We=new WeakMap,Mt=new WeakMap,vt=new WeakMap,In=new WeakMap,po=new WeakMap,Nt=new WeakMap,ln=new WeakMap,Bt=new WeakSet;let gt,Un=0,On=0;const ct="__aa_tgt",Gt="__aa_del",dn="__aa_new",mo=t=>{const n=ko(t);n&&n.forEach(s=>So(s))},go=t=>{t.forEach(n=>{n.target===gt&&yo(),We.has(n.target)&&Ct(n.target)})};function bo(t){const n=In.get(t);n==null||n.disconnect();let s=We.get(t),i=0;const o=5;s||(s=Dt(t),We.set(t,s));const{offsetWidth:a,offsetHeight:h}=gt,r=[s.top-o,a-(s.left+o+s.width),h-(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:r});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,Dt(t)),bo(t)}catch{}},s))}function yo(){clearTimeout(ln.get(gt)),ln.set(gt,setTimeout(()=>{Zi.forEach(t=>ts(t,n=>Ji(()=>Ct(n))))},100))}function wo(t){setTimeout(()=>{po.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,_t;const vo=typeof window<"u"&&"ResizeObserver"in window;vo&&(gt=document.documentElement,Cn=new MutationObserver(mo),_t=new ResizeObserver(go),window.addEventListener("scroll",()=>{On=window.scrollY,Un=window.scrollX}),_t.observe(gt));function ko(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 a=0;a<o.target.children.length;a++){const h=o.target.children.item(a);if(h){if(Gt in h)return!1;gn(o.target,h),i.add(h)}}}if(o.removedNodes.length)for(let a=0;a<o.removedNodes.length;a++){const h=o.removedNodes[a];if(Gt in h)return!1;h instanceof Element&&(i.add(h),gn(o.target,h),Mt.set(h,[o.previousSibling,o.nextSibling]))}}return i},new Set)}function gn(t,n){!n&&!(ct in t)?Object.defineProperty(t,ct,{value:t}):n&&!(ct in n)&&Object.defineProperty(n,ct,{value:t})}function So(t){var n;const s=t.isConnected,i=We.has(t);s&&Mt.has(t)&&Mt.delete(t),vt.has(t)&&((n=vt.get(t))===null||n===void 0||n.cancel()),dn in t?oi(t):i&&s?Co(t):i&&!s?To(t):oi(t)}function at(t){return Number(t.replace(/[^0-9.\-]/g,""))}function Io(t){let n=t.parentElement;for(;n;){if(n.scrollLeft||n.scrollTop)return{x:n.scrollLeft,y:n.scrollTop};n=n.parentElement}return{x:0,y:0}}function Dt(t){const n=t.getBoundingClientRect(),{x:s,y:i}=Io(t);return{top:n.top+i,left:n.left+s,width:n.width,height:n.height}}function Qi(t,n,s){let i=n.width,o=n.height,a=s.width,h=s.height;const u=getComputedStyle(t);if(u.getPropertyValue("box-sizing")==="content-box"){const d=at(u.paddingTop)+at(u.paddingBottom)+at(u.borderTopWidth)+at(u.borderBottomWidth),p=at(u.paddingLeft)+at(u.paddingRight)+at(u.borderRightWidth)+at(u.borderLeftWidth);i-=p,a-=p,o-=d,h-=d}return[i,a,o,h].map(Math.round)}function fn(t){return ct in t&&Nt.has(t[ct])?Nt.get(t[ct]):{duration:250,easing:"ease-in-out"}}function es(t){if(ct in t)return t[ct]}function Fn(t){const n=es(t);return n?Bt.has(n):!1}function ts(t,...n){n.forEach(s=>s(t,Nt.has(t)));for(let s=0;s<t.children.length;s++){const i=t.children.item(s);i&&n.forEach(o=>o(i,Nt.has(i)))}}function zn(t){return Array.isArray(t)?t:[t]}function jt(t){return typeof t=="function"}function Co(t){const n=We.get(t),s=Dt(t);if(!Fn(t))return We.set(t,s);let i;if(!n)return;const o=fn(t);if(typeof o!="function"){const a=n.left-s.left,h=n.top-s.top,[u,r,d,p]=Qi(t,n,s),c={transform:`translate(${a}px, ${h}px)`},f={transform:"translate(0, 0)"};u!==r&&(c.width=`${u}px`,f.width=`${r}px`),d!==p&&(c.height=`${d}px`,f.height=`${p}px`),i=t.animate([c,f],{duration:o.duration,easing:o.easing})}else{const[a]=zn(o(t,"remain",n,s));i=new Animation(a),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=Dt(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 To(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,a=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[h,u,r,d]=$o(t),p=fn(t),c=We.get(t);(o!==Un||a!==On)&&xo(t,o,a,p);let f,l={position:"absolute",top:`${h}px`,left:`${u}px`,width:`${r}px`,height:`${d}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!jt(p))Object.assign(t.style,l),f=t.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:p.duration,easing:"ease-out"});else{const[g,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)),f=new Animation(g),f.play()}vt.set(t,f),f.addEventListener("finish",ai.bind(null,t,l))}function xo(t,n,s,i){const o=Un-n,a=On-s,h=document.documentElement.style.scrollBehavior;if(getComputedStyle(gt).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+o,window.scrollY+a),!t.parentElement)return;const r=t.parentElement;let d=r.clientHeight,p=r.clientWidth;const c=performance.now();function f(){requestAnimationFrame(()=>{if(!jt(i)){const l=d-r.clientHeight,g=p-r.clientWidth;c+i.duration>performance.now()?(window.scrollTo({left:window.scrollX-g,top:window.scrollY-l}),d=r.clientHeight,p=r.clientWidth,f()):document.documentElement.style.scrollBehavior=h}})}f()}function $o(t){const n=We.get(t),[s,,i]=Qi(t,n,Dt(t));let o=t.parentElement;for(;o&&(getComputedStyle(o).position==="static"||o instanceof HTMLBodyElement);)o=o.parentElement;o||(o=document.body);const a=getComputedStyle(o),h=We.get(o)||Dt(o),u=Math.round(n.top-h.top)-at(a.borderTopWidth),r=Math.round(n.left-h.left)-at(a.borderLeftWidth);return[u,r,s,i]}function ns(t,n={}){return Cn&&_t&&(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,wo,o=>_t==null?void 0:_t.observe(o)),jt(n)?Nt.set(t,n):Nt.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=q(null),[s,i]=A(),o=a=>{s&&(a?s.enable():s.disable())};return Z(()=>{n.current instanceof HTMLElement&&i(ns(n.current,t||{}))},[]),[n,o]}function Ao({onClose:t}){const{masto:n}=ie(),s=we.local.getJSON("accounts"),i=dt(),o=s.length>1,[a,h]=kt(r=>r+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((r,d)=>{const p=r.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(nt,{url:r.info.avatarStatic,size:"xxl",onDblClick:async()=>{if(p)try{const f=await n.v1.accounts.$select(r.info.id).fetch();r.info=f,we.local.setJSON("accounts",s),h()}catch{}}}),e(Et,{account:o?{...r.info,acct:/@/.test(r.info.acct)?r.info.acct:`${r.info.acct}@${r.instanceURL}`}:r.info,showAcct:!0,onClick:()=>{p?$.showAccount=`${r.info.username}@${r.instanceURL}`:(Pi(r.info.id),location.reload())}})]}),e("div",{class:"actions",children:[c&&o&&e(R,{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=`${r.info.username}@${r.instanceURL}`},children:[e(v,{icon:"user"}),e("span",{children:"View profile…"})]}),e(Be,{}),o&&e(pe,{disabled:c,onClick:()=>{s.splice(d,1),s.unshift(r),we.local.setJSON("accounts",s),h()},children:[e(v,{icon:"check-circle"}),e("span",{children:"Set as default"})]}),e(tt,{subMenu:!0,confirmLabel:e(R,{children:[e(v,{icon:"exit"}),e("span",{children:["Log out @",r.info.acct,"?"]})]}),disabled:!p,menuItemClassName:"danger",onClick:()=>{s.splice(d,1),we.local.setJSON("accounts",s),location.href=location.pathname||"/"},children:[e(v,{icon:"exit"}),e("span",{children:"Log out…"})]})]})]})]},r.info.id)})}),e("p",{children:e(re,{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}=ie();return n.v1.push.subscription.create(t)}function _o(){const{masto:t}=ie();return t.v1.push.subscription.fetch()}function Ro(t){const{masto:n}=ie();return n.v1.push.subscription.update(t)}function Eo(){const{masto:t}=ie();return t.v1.push.subscription.remove()}function pn(){return"serviceWorker"in navigator&&"PushManager"in window}function Lo(){return navigator.serviceWorker.getRegistration()}async function qn(){const t=await Lo(),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 a=0;a<i.length;++a)o[a]=i.charCodeAt(a);return o}async function Mo(){if(!pn())return;const{subscription:t}=await qn();let n=null;try{n=await _o()}catch(s){if(!/(not found|unknown)/i.test(s.message))throw s}if(n&&t){const s=n.endpoint===t.endpoint,{vapidKey:i}=Rt(),o=n.serverKey===i;if(!s)throw new Error("Backend subscription endpoint changed");if(!o)throw new Error("Backend subscription key and vapid key changed")}if(t&&!n){const{vapidKey:s}=Rt();if(s){const{applicationServerKey:i}=t.options,o=is(s).toString(),a=new Uint8Array(i).toString();if(!(o===a))throw await t.unsubscribe(),new Error("Subscription key and vapid key changed")}}return{subscription:t,backendSubscription:n}}async function ci({data:t,policy:n}){if(!pn())return;let{registration:s,subscription:i}=await qn(),o=null;if(i)try{o=await Ro({data:t,policy:n})}catch{o=await ri({subscription:i,data:t,policy:n})}else{const{vapidKey:a}=Rt();if(!a)throw new Error("No server key found");i=await s.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:is(a)}),o=await ri({subscription:i,data:t,policy:n})}return{subscription:i,backendSubscription:o}}async function li(){if(!pn())return;const{subscription:t}=await qn();t&&(await Eo(),await t.unsubscribe())}var No={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 di=16,yt=[14,15,16,17,18,19,20],{PHANPY_WEBSITE:ui,PHANPY_PRIVACY_POLICY_URL:Do,PHANPY_IMG_ALT_API_URL:Po,PHANPY_GIPHY_API_KEY:Uo}=No;function Oo({onClose:t}){const n=Ne($),s=we.local.get("theme")||"auto",i=q(),o=n.settings.contentTranslationTargetLanguage||null,a=Bi(),h=Gs(a),u=we.local.get("textSize")||di,[r,d]=A(we.account.get("preferences")||{}),{masto:p,authenticated:c,instance:f}=ie();return e("div",{id:"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:"Settings"})}),e("main",{children:[e("section",{children:e("ul",{children:[e("li",{children:[e("div",{children:e("label",{children:"Appearance"})}),e("div",{children:e("form",{ref:i,onInput:l=>{l.preventDefault();const m=new FormData(i.current).get("theme"),k=document.documentElement;if(m==="auto"){k.classList.remove("is-light","is-dark");const b=document.querySelector('meta[data-theme-setting="manual"]');b&&(b.name=""),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(T=>{T.name="theme-color"})}else{k.classList.toggle("is-light",m==="light"),k.classList.toggle("is-dark",m==="dark");const b=document.querySelector('meta[data-theme-setting="manual"]');b&&(b.name="theme-color",b.content=m==="light"?b.dataset.themeLightColor:b.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(T=>{T.name=""})}document.querySelector('meta[name="color-scheme"]').setAttribute("content",m==="auto"?"dark light":m),m==="auto"?we.local.del("theme"):we.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 g=parseInt(l.target.value,10);document.documentElement.style.setProperty("--text-size",`${g}px`),g===di?we.local.del("textSize"):we.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(R,{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:r["posting:default:visibility"]||"public",onChange:l=>{const{value:g}=l.target;(async()=>{try{await p.v1.accounts.updateCredentials({source:{privacy:g}}),d({...r,"posting:default:visibility":g}),we.account.set("preferences",{...r,"posting:default:visibility":g})}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://${f}/`,target:"_blank",rel:"noopener noreferrer",children:["Go to your instance (",f,") 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:g}=l.target;$.settings.contentTranslation=g,g||($.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 (",h,")"]}),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(R,{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:g=>{const{checked:m}=g.target;m?$.settings.contentTranslationHideLanguages.push(l.code):$.settings.contentTranslationHideLanguages=n.settings.contentTranslationHideLanguages.filter(k=>k!==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."]})})]})]})]}),!!Uo&&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."]})})]}),!!Po&&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&&Ve("@mastodon/grouped-notifications")&&e("li",{children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.groupedNotificationsAlpha,onChange:l=>{$.settings.groupedNotificationsAlpha=l.target.checked}})," ","Server-side grouped notifications"]}),e("div",{class:"sub-section insignificant",children:e("small",{children:"Alpha-stage feature. Potentially improved grouping window but basic grouping logic."})})]}),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 profiles 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(Fo,{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:Do,target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"})]}),e("p",{children:[ui&&e(R,{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-07-22T10:39:10.061Z".slice(0,10).replace(/-/g,".")}.81e330d`,onClick:l=>{l.target.select();try{navigator.clipboard.writeText(l.target.value),oe("Version string copied")}catch{oe("Unable to copy version string")}}})," ",e("span",{class:"ib insignificant",children:["(",e("a",{href:"https://github.com/cheeaun/phanpy/commit/81e330d",target:"_blank",rel:"noopener noreferrer",children:e(It,{datetime:new Date("2024-07-22T10:39:10.061Z")})}),")"]})]})]})]})]})}function Fo({onClose:t}){if(!pn())return null;const{instance:n}=ie(),[s,i]=A("default"),o=q(),[a,h]=A(!1),[u,r]=A(!1),d=q();Z(()=>{(async()=>{i("loading");try{const{subscription:c,backendSubscription:f}=await Mo();if(f!=null&&f.policy&&f.policy!=="none"){h(!0);const{alerts:l,policy:g}=f;d.current=g;const{elements:m}=o.current,k=m.namedItem("policy");k&&(k.value=g),Object.keys(l).forEach(b=>{const y=m.namedItem(b);(y==null?void 0:y.type)==="checkbox"&&(y.checked=!0)})}i("default")}catch(c){/outside.*authorized/i.test(c.message)?r(!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)),f=!!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 g=0;Object.keys(l.data.alerts).forEach(k=>{l.data.alerts[k]?g++:delete l.data.alerts[k]});const m=d.current!==l.data.policy;f&&g>0?m?li().then(()=>{ci(l)}).catch(k=>{alert("Failed to update subscription. Please try again.")}):ci(l).catch(k=>{alert("Failed to update subscription. Please try again.")}):li().catch(k=>{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:a,onChange:async c=>{const{checked:f}=c.target;if(f){const l=await Notification.requestPermission();l==="granted"?h(!0):(h(!1),l==="denied"&&alert("Push notifications are blocked. Please enable them in your browser settings."))}else h(!1)}})," ","Allow from"," ",e("select",{name:"policy",disabled:p||u||!a,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:!a,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(re,{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 h=s[s.length-1],u=h.querySelector('[tabindex="-1"]')||h;if(u){u.focus();return}}if(document.querySelector(".deck-backdrop"))return;const o=document.querySelectorAll(".deck-container"),a=o[o.length-1];a&&a.tabIndex===-1&&a.focus()}},100);return()=>clearTimeout(t)};function ss(t){if(!t)return;const n=Pt(),s=q(n.pathname);Z(()=>{s.current&&n.pathname!==s.current&&(t==null||t())},[n.pathname,t])}const os=1e3*60,zo=24*60*60*1e3,xn=ft(async()=>{const{masto:t}=ie(),n=await t.v1.lists.list();return n.sort((s,i)=>s.title.localeCompare(i.title)),n.length&&setTimeout(()=>{we.account.set("lists",{lists:n,updatedAt:Date.now()})},1),n},{maxAge:os});async function Yt(){try{const{lists:t,updatedAt:n}=we.account.get("lists")||{};return t!=null&&t.length?(Date.now()-n>zo&&xn(),t):await xn()}catch{return[]}}const Bo=ft(t=>{const{masto:n}=ie();return n.v1.lists.$select(t).fetch()},{maxAge:os});async function as(t){const{lists:n}=we.account.get("lists")||{};if(n!=null&&n.length){const s=n.find(i=>i.id===t);if(s)return s}try{return Bo(t)}catch{return null}}async function Ho(t){const n=await as(t);return(n==null?void 0:n.title)||""}function qo(t){const{lists:n}=we.account.get("lists")||{};n!=null&&n.length&&(n.push(t),n.sort((s,i)=>s.title.localeCompare(i.title)),we.account.set("lists",{lists:n,updatedAt:Date.now()}))}function Vo(t){const{lists:n}=we.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)),we.account.set("lists",{lists:n,updatedAt:Date.now()}))}}function Go(t){const{lists:n}=we.account.get("lists")||{};if(n!=null&&n.length){const s=n.findIndex(i=>i.id===t);s!==-1&&(n.splice(s,1),we.account.set("lists",{lists:n,updatedAt:Date.now()}))}}function Vn({list:t,onClose:n}){const{masto:s}=ie(),[i,o]=A("default"),a=!!t,h=q(),u=q(),r=q();Z(()=>{a&&(h.current.value=t.title,u.current.value=t.repliesPolicy,r.current&&(r.current.checked=t.exclusive))},[a]);const d=Ve("@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:a?"Edit list":"New list"})}),e("main",{children:e("form",{class:"list-form",onSubmit:p=>{p.preventDefault();const c=new FormData(p.target),f=c.get("title"),l=c.get("replies_policy"),g=c.get("exclusive")==="on";o("loading"),(async()=>{try{let m;a?m=await s.v1.lists.$select(t.id).update({title:f,replies_policy:l,exclusive:g}):m=await s.v1.lists.create({title:f,replies_policy:l,exclusive:g}),o("default"),n==null||n({state:"success",list:m}),setTimeout(()=>{a?Vo(m):qo(m)},1)}catch{o("error"),alert(a?"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:h,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:r,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:a?"Save":"Create"}),a&&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(()=>{Go(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 jo=[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 Yo(t,n){return n.v1.accounts.familiarFollowers.fetch({id:[t]})}const Wo=ft(Yo,{maxAge:rs});async function Ko(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(a=>{a.reblog?o.boosts++:a.inReplyToId&&a.inReplyToAccountId!==a.account.id?o.replies++:o.originals++}),i.length&&(o.daysSinceLastPost=Math.ceil((Date.now()-new Date(i[i.length-1].createdAt))/864e5)),o}const Xo=ft(Ko,{maxAge:rs});function cs({account:t,fetchAccount:n=()=>{},standalone:s,instance:i,authenticated:o}){const{masto:a}=ie({instance:i}),{masto:h,instance:u}=ie(),[r,d]=A("default"),p=typeof t=="string",[c,f]=A(p?null:t),l=me(()=>i===u,[i,u]);Z(()=>{if(!p){f(t);return}d("loading"),(async()=>{try{const C=await n();$.accounts[`${C.id}@${i}`]=C,f(C),d("default")}catch{f(null),d("error")}})()},[p,t,n]);const{acct:g,avatar:m,avatarStatic:k,bot:b,createdAt:y,displayName:T,emojis:w,fields:S,followersCount:I,followingCount:x,group:U,id:M,lastStatusAt:N,locked:te,note:J,statusesCount:L,url:P,username:F,memorial:z,moved:j,roles:V,hideCollections:D}=c||{};let se=!1,{header:G,headerStatic:de}=c||{};(!G||/missing\.png$/.test(G))&&m&&!/missing\.png$/.test(m)&&(G=m,se=!0,k&&!/missing\.png$/.test(k)&&(de=k));const he=me(()=>M===dt(),[M]);Z(()=>{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(he&&i&&C){const O=we.local.getJSON("accounts");let Y=!1;O.forEach(H=>{H.info.id===c.id&&H.instanceURL===i&&(H.info=c,Y=!0)}),Y&&we.local.setJSON("accounts",O)}},[he,c,i]);const le=me(()=>P?Ut.toUnicode(URL.parse(P).hostname):null,[P]),[ge,Te]=A([]),Se=q(),Pe=q([]);async function Re(C){var ne;(C||!Se.current)&&(Se.current=a.v1.accounts.$select(M).followers.list({limit:fi}));const O=await Se.current.next();if(he||!l)return O;const{value:Y}=O;let H=[];if(C){let ye=[];try{ye=await a.v1.accounts.familiarFollowers.fetch({id:[M]})}catch{}Pe.current=((ne=ye==null?void 0:ye[0])==null?void 0:ne.accounts)||[],H=[...Pe.current,...Y.filter(fe=>!Pe.current.some(ce=>ce.id===fe.id))]}else Y!=null&&Y.length&&(H=Y.filter(ye=>!Pe.current.some(fe=>fe.id===ye.id)));return{...O,value:H}}const Ae=q();async function Ie(C){return(C||!Ae.current)&&(Ae.current=a.v1.accounts.$select(M).following.list({limit:fi})),await Ae.current.next()}const xe=s?"div":re,ve=i?`/${i}/a/${M}`:`/a/${M}`,[ee,be]=A([]),[ae,K]=A(),[E,W]=A("default"),_=!!(ae!=null&&ae.total),B=async C=>{try{const O=await Wo(C,h);be(O[0].accounts.slice(0,Zo))}catch{}},Q=async()=>{if(M){W("loading");try{const C=await Xo(M,a);K(C),W("default")}catch{W("error")}}},ue=et(({relationship:C,currentID:O})=>{C.following||(B(O),!s&&L>0&&Q())},[s,M,L]),De=et(C=>{C.id===M&&(f(C),$.accounts[`${C.id}@${i}`]=C)},[M,i]);return e("div",{tabIndex:"-1",class:`account-container ${r==="loading"?"skeleton":""}`,style:{"--header-color-1":ge[0],"--header-color-2":ge[1],"--header-color-3":ge[2],"--header-color-4":ge[3]},children:[r==="error"&&e("div",{class:"ui-state",children:[e("p",{children:"Unable to load account."}),e("p",{children:e("a",{href:p?t:P,target:"_blank",rel:"noopener noreferrer",children:["Go to account page ",e(v,{icon:"external"})]})})]}),r==="loading"?e(R,{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(R,{children:[!!j&&e("div",{class:"account-moved",children:[e("p",{children:[e("b",{children:T})," has indicated that their new account is now:"]}),e(Qe,{account:j,instance:i,onClick:C=>{C.stopPropagation(),$.showAccount=j}})]}),!!G&&!/missing\.png$/.test(G)&&e("img",{src:G,alt:"",class:`header-banner ${se?"header-is-avatar":""}`,onError:C=>{C.target.crossOrigin?C.target.src!==de?C.target.src=de:(C.target.removeAttribute("crossorigin"),C.target.src=G):C.target.src!==de?C.target.src=de:C.target.remove()},crossOrigin:"anonymous",onLoad:C=>{C.target.classList.add("loaded");try{const O=window.OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"),Y=O.getContext("2d",{willReadFrequently:!0});O.width=C.target.width,O.height=C.target.height,Y.imageSmoothingEnabled=!1,Y.drawImage(C.target,0,0);const H=10,ye=[Y.getImageData(0,0,H,H).data,Y.getImageData(C.target.width-H,0,H,H).data,Y.getImageData(0,C.target.height-H,H,H).data,Y.getImageData(C.target.width-H,C.target.height-H,H,H).data].map(fe=>{let ce=0,Ce=0,Oe=0,ze=0;for(let Ge=0;Ge<fe.length;Ge+=4)ce+=fe[Ge],Ce+=fe[Ge+1],Oe+=fe[Ge+2],ze+=fe[Ge+3];const Me=fe.length/4;return[ce/Me,Ce/Me,Oe/Me,ze/Me]}).map(fe=>{const[ce,Ce,Oe,ze]=Qo(fe);return`rgba(${ce}, ${Ce}, ${Oe}, ${ze})`});Te(ye)}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(aa,{acct:g,instance:i})}),e(pe,{onClick:()=>{const C=g.includes("@")?`@${g}`:`@${g}@${i}`;try{navigator.clipboard.writeText(C),oe("Handle copied")}catch{oe("Unable to copy handle")}},children:[e(v,{icon:"link"}),e("span",{children:"Copy handle"})]}),e(pe,{href:P,target:"_blank",children:[e(v,{icon:"external"}),e("span",{children:"Go to original profile page"})]}),e(Be,{}),e(Ee,{href:c.avatar,target:"_blank",children:[e(v,{icon:"user"}),e("span",{children:"View profile image"})]}),e(Ee,{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:[!!z&&e("span",{class:"tag",children:"In Memoriam"}),!!b&&e("span",{class:"tag",children:[e(v,{icon:"bot"})," Automated"]}),!!U&&e("span",{class:"tag",children:[e(v,{icon:"group"})," Group"]}),V==null?void 0:V.map(C=>e("span",{class:"tag",children:[C.name,!!le&&e(R,{children:[" ",e("span",{class:"more-insignificant",children:le})]})]})),e("div",{class:"note",dir:"auto",onClick:Hi({instance:u}),dangerouslySetInnerHTML:{__html:Sn(J,{emojis:w})}}),e("div",{class:"account-metadata-box",children:[(S==null?void 0:S.length)>0&&e("div",{class:"profile-metadata",children:S.map(({name:C,value:O,verifiedAt:Y},H)=>e("div",{class:`profile-field ${Y?"profile-verified":""}`,dir:"auto",children:[e("b",{children:[e(qi,{text:C,emojis:w})," ",!!Y&&e(v,{icon:"check-circle",size:"s"})]}),e("p",{dangerouslySetInnerHTML:{__html:Sn(O,{emojis:w})}})]},C+H))}),e("div",{class:"stats",children:[e(xe,{tabIndex:0,to:ve,onClick:()=>{setTimeout(()=>{$.showGenericAccounts={id:"followers",heading:"Followers",fetchAccounts:Re,instance:i,excludeRelationshipAttrs:he?["followedBy"]:[],blankCopy:D?"This user has chosen to not make this information available.":void 0}},0)},children:[!!ee.length&&e("span",{class:"shazam-container-horizontal",children:e("span",{class:"shazam-container-inner stats-avatars-bunch",children:ee.map(C=>e(nt,{url:C.avatarStatic,size:"s",alt:`${C.displayName} @${C.acct}`,squircle:C==null?void 0:C.bot}))})}),e("span",{title:I,children:je(I)})," ","Followers"]}),e(xe,{class:"insignificant",tabIndex:0,to:ve,onClick:()=>{setTimeout(()=>{$.showGenericAccounts={heading:"Following",fetchAccounts:Ie,instance:i,excludeRelationshipAttrs:he?["following"]:[],blankCopy:D?"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(xe,{class:"insignificant",to:ve,children:[e("span",{title:L,children:je(L)})," ","Posts"]}),!!y&&e("div",{class:"insignificant",children:["Joined"," ",e("time",{datetime:y,children:rt(y,{hideTime:!0})})]})]})]}),!!ae&&e(xe,{to:ve,class:"account-metadata-box",children:e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:_?e("div",{class:"posting-stats",title:`${Math.round(ae.originals/ae.total*100)}% original posts, ${Math.round(ae.replies/ae.total*100)}% replies, ${Math.round(ae.boosts/ae.total*100)}% boosts`,children:[e("div",{children:ae.daysSinceLastPost<365?`Last ${ae.total} post${ae.total>1?"s":""} in the past
${ae.daysSinceLastPost} day${ae.daysSinceLastPost>1?"s":""}`:`
Last ${ae.total} posts in the past year(s)
`}),e("div",{class:"posting-stats-bar",style:{"--originals-percentage":`${ae.originals/ae.total*100}%`,"--replies-percentage":`${(ae.originals+ae.replies)/ae.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."})})})}),!j&&e("div",{class:"account-metadata-box",children:e("div",{class:"shazam-container no-animation",hidden:!!ae,children:e("div",{class:"shazam-container-inner",children:e("button",{type:"button",class:"posting-stats-button",disabled:E==="loading",onClick:()=>{Q()},children:[e("div",{class:`posting-stats-bar posting-stats-icon ${E==="loading"?"loading":""}`,style:{"--originals-percentage":"33%","--replies-percentage":"66%"}}),"View post stats"," "]})})})})]}),e("footer",{children:e(Jo,{info:c,instance:i,standalone:s,authenticated:o,onRelationshipChange:ue,onProfileUpdate:De})})]})]})}const Zo=3;function Jo({info:t,instance:n,standalone:s,authenticated:i,onRelationshipChange:o=()=>{},onProfileUpdate:a=()=>{}}){var ae;if(!t)return null;const{masto:h,instance:u,authenticated:r}=ie(),d=n===u,[p,c]=A("default"),[f,l]=A(null),{id:g,acct:m,url:k,username:b,locked:y,lastStatusAt:T,note:w,fields:S,moved:I}=t,x=q(g),{following:U,showingReblogs:M,notifying:N,followedBy:te,blocking:J,blockedBy:L,muting:P,mutingNotifications:F,requested:z,domainBlocking:j,endorsed:V,note:D}=f||{},[se,G]=A(null),[de,he]=A(!1),le=m.includes("@")?m:`${m}@${n}`;Z(()=>{if(t){const K=dt();let E;(async()=>{if(d&&i)E=g;else if(!d&&r){const _=t.acct.includes("@");try{const B=await h.v2.search.fetch({q:_?t.acct:`${t.username}@${n}`,type:"accounts",limit:1,resolve:!0});B.accounts.length&&(E=B.accounts[0].id,G(B.accounts[0]))}catch{}}if(!E)return;if(K===E){he(!0);return}x.current=E,c("loading");const W=h.v1.accounts.relationships.fetch({id:[E]});try{const _=await W;if(c("default"),_.length){const B=_[0];l(B),o({relationship:B,currentID:E})}}catch{c("error")}})()}},[t,i]),Z(()=>{t&&de&&Rs(t)},[t,de]);const ge=p==="loading",[Te,Se]=A(!1),[Pe,Re]=A(!1),[Ae,Ie]=A(!1),[xe,ve]=A(!1),[ee,be]=A([]);return e(R,{children:[e("div",{class:"actions",children:[e("span",{children:[te?e("span",{class:"tag",children:"Follows you"}):T?e("small",{class:"insignificant",children:["Last post:"," ",e("span",{class:"ib",children:rt(T,{hideTime:!0})})]}):e("span",{}),P&&e("span",{class:"tag danger",children:"Muted"}),J&&e("span",{class:"tag danger",children:"Blocked"})]})," ",e("span",{class:"buttons",children:[!!D&&e("button",{type:"button",class:"private-note-tag",title:"Private note",onClick:()=>{Ie(!0)},dir:"auto",children:e("span",{children:D})}),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:ge,children:e(v,{icon:"more",size:"l",alt:"More"})}),onMenuChange:K=>{U&&K.open&&(async()=>{try{const E=await h.v1.accounts.$select(x.current).lists.list();be(E)}catch{}})()},children:[r&&!de&&e(R,{children:[e(pe,{onClick:()=>{js({draftStatus:{status:`@${(se==null?void 0:se.acct)||m} `}})},children:[e(v,{icon:"at"}),e("span",{children:["Mention @",b]})]}),e(pe,{onClick:()=>{Se(!0)},children:[e(v,{icon:"translate"}),e("span",{children:"Translate bio"})]}),Ve("@mastodon/profile-private-note")&&e(pe,{onClick:()=>{Ie(!0)},children:[e(v,{icon:"pencil"}),e("span",{children:D?"Edit private note":"Add private note"})]}),U&&!!f&&e(R,{children:[e(pe,{onClick:()=>{c("loading"),(async()=>{try{const K=await h.v1.accounts.$select(x.current).follow({notify:!N});K&&l(K),c("default"),oe(K.notifying?`Notifications enabled for @${b}'s posts.`:` Notifications disabled for @${b}'s posts.`)}catch(K){alert(K),c("error")}})()},children:[e(v,{icon:"notification"}),e("span",{children:N?"Disable notifications":"Enable notifications"})]}),e(pe,{onClick:()=>{c("loading"),(async()=>{try{const K=await h.v1.accounts.$select(x.current).follow({reblogs:!M});K&&l(K),c("default"),oe(K.showingReblogs?`Boosts from @${b} enabled.`:`Boosts from @${b} disabled.`)}catch(K){alert(K),c("error")}})()},children:[e(v,{icon:"rocket"}),e("span",{children:M?"Disable boosts":"Enable boosts"})]})]}),U&&e(pe,{onClick:()=>{Re(!0)},children:[e(v,{icon:"list"}),ee.length?e(R,{children:[e("small",{class:"menu-grow",children:["Add/Remove from Lists",e("br",{}),e("span",{class:"more-insignificant",children:ee.map(K=>K.title).join(", ")})]}),e("small",{class:"more-insignificant",children:ee.length})]}):e("span",{children:"Add/Remove from Lists"})]}),e(Be,{})]}),e(pe,{onClick:()=>{const K=`@${(se==null?void 0:se.acct)||le}`;try{navigator.clipboard.writeText(K),oe("Handle copied")}catch{oe("Unable to copy handle")}},children:[e(v,{icon:"copy"}),e("small",{children:["Copy handle",e("br",{}),e("span",{class:"more-insignificant",children:["@",(se==null?void 0:se.acct)||le]})]})]}),e(pe,{href:k,target:"_blank",children:[e(v,{icon:"external"}),e("small",{class:"menu-double-lines",children:ea(k)})]}),e("div",{class:"menu-horizontal",children:[e(pe,{onClick:()=>{try{navigator.clipboard.writeText(k),oe("Link copied")}catch{oe("Unable to copy link")}},children:[e(v,{icon:"link"}),e("span",{children:"Copy"})]}),(navigator==null?void 0:navigator.share)&&((ae=navigator==null?void 0:navigator.canShare)==null?void 0:ae.call(navigator,{url:k}))&&e(pe,{onClick:()=>{try{navigator.share({url:k})}catch{alert("Sharing doesn't seem to work.")}},children:[e(v,{icon:"share"}),e("span",{children:"Share…"})]})]}),!!f&&e(R,{children:[e(Be,{}),P?e(pe,{onClick:()=>{c("loading"),(async()=>{try{const K=await h.v1.accounts.$select((se==null?void 0:se.id)||g).unmute();l(K),c("default"),oe(`Unmuted @${b}`),$.reloadGenericAccounts.id="mute",$.reloadGenericAccounts.counter++}catch{c("error")}})()},children:[e(v,{icon:"unmute"}),e("span",{children:["Unmute @",b]})]}):e(cn,{menuClassName:"menu-blur",openTrigger:"clickOnly",direction:"bottom",overflow:"auto",shift:16,label:e(R,{children:[e(v,{icon:"mute"}),e("span",{class:"menu-grow",children:["Mute @",b,"…"]}),e("span",{style:{textOverflow:"clip"},children:[e(v,{icon:"time"}),e(v,{icon:"chevron-right"})]})]}),children:e("div",{class:"menu-wrap",children:jo.map(K=>e(pe,{onClick:()=>{c("loading"),(async()=>{try{const E=await h.v1.accounts.$select((se==null?void 0:se.id)||g).mute({duration:K});l(E),c("default"),oe(`Muted @${b} for ${hi[K]}`),$.reloadGenericAccounts.id="mute",$.reloadGenericAccounts.counter++}catch{c("error"),oe(`Unable to mute @${b}`)}})()},children:hi[K]}))})}),te&&e(tt,{subMenu:!0,menuItemClassName:"danger",confirmLabel:e(R,{children:[e(v,{icon:"user-x"}),e("span",{children:["Remove @",b," from followers?"]})]}),onClick:()=>{c("loading"),(async()=>{try{const K=await h.v1.accounts.$select((se==null?void 0:se.id)||g).removeFromFollowers();l(K),c("default"),oe(`@${b} 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:!J,confirmLabel:e(R,{children:[e(v,{icon:"block"}),e("span",{children:["Block @",b,"?"]})]}),menuItemClassName:"danger",onClick:()=>{c("loading"),(async()=>{try{if(J){const K=await h.v1.accounts.$select((se==null?void 0:se.id)||g).unblock();l(K),c("default"),oe(`Unblocked @${b}`)}else{const K=await h.v1.accounts.$select((se==null?void 0:se.id)||g).block();l(K),c("default"),oe(`Blocked @${b}`)}$.reloadGenericAccounts.id="block",$.reloadGenericAccounts.counter++}catch{c("error"),J?oe(`Unable to unblock @${b}`):oe(`Unable to block @${b}`)}})()},children:J?e(R,{children:[e(v,{icon:"unblock"}),e("span",{children:["Unblock @",b]})]}):e(R,{children:[e(v,{icon:"block"}),e("span",{children:["Block @",b,"…"]})]})}),e(pe,{className:"danger",onClick:()=>{$.showReportModal={account:se||t}},children:[e(v,{icon:"flag"}),e("span",{children:["Report @",b,"…"]})]})]}),r&&de&&s&&Ve("@mastodon/profile-edit")&&e(R,{children:[e(Be,{}),e(pe,{onClick:()=>{ve(!0)},children:[e(v,{icon:"pencil"}),e("span",{children:"Edit profile"})]})]}),!1]}),!f&&p==="loading"&&e($e,{abrupt:!0}),!!f&&!I&&e(tt,{confirm:U||z,confirmLabel:e("span",{children:z?"Withdraw follow request?":`Unfollow @${t.acct||t.username}?`}),menuItemClassName:"danger",align:"end",disabled:ge,onClick:()=>{c("loading"),(async()=>{try{let K;U||z?K=await h.v1.accounts.$select(x.current).unfollow():K=await h.v1.accounts.$select(x.current).follow(),K&&l(K),c("default")}catch(K){alert(K),c("error")}})()},children:e("button",{type:"button",class:`${U||z?"light swap":""}`,"data-swap-state":U||z?"danger":"",disabled:ge,children:U?e(R,{children:[e("span",{children:"Following"}),e("span",{children:"Unfollow…"})]}):z?e(R,{children:[e("span",{children:"Requested"}),e("span",{children:"Withdraw…"})]}):y?e(R,{children:[e(v,{icon:"lock"})," ",e("span",{children:"Follow"})]}):"Follow"})})]})]}),!!Te&&e(_e,{onClose:()=>{Se(!1)},children:e(ta,{note:w,fields:S,onClose:()=>Se(!1)})}),!!Pe&&e(_e,{onClose:()=>{Re(!1)},children:e(na,{accountID:x.current,onClose:()=>Re(!1)})}),!!Ae&&e(_e,{onClose:()=>{Ie(!1)},children:e(ia,{account:t,note:D,onRelationshipChange:K=>{l(K)},onClose:()=>Ie(!1)})}),!!xe&&e(_e,{onClose:()=>{ve(!1)},children:e(sa,{onClose:({state:K,account:E}={})=>{ve(!1),K==="success"&&E&&a(E)}})})]})}function Qo([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 ea(t){if(!t)return;const n=URL.parse(t),{host:s,pathname:i}=n,o=i.replace(/\/$/,"").replace(/^\//,"");return e(R,{children:[e("span",{class:"more-insignificant",children:[Ut.toUnicode(s),"/"]}),e("wbr",{}),e("span",{children:o})]})}function ta({note:t,fields:n,onClose:s}){const i=(n==null?void 0:n.map(({name:a,value:h})=>`${a}
${ni(h)}`).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 na({accountID:t,onClose:n}){const{masto:s}=ie(),[i,o]=A("default"),[a,h]=A([]),[u,r]=A([]),[d,p]=kt(l=>l+1,0);Z(()=>{o("loading"),(async()=>{try{const l=await Yt();h(l);const g=await s.v1.accounts.$select(t).lists.list();r(g),o("default")}catch{o("error")}})()},[d]);const[c,f]=A(!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:[a.length>0?e("ul",{class:"list-add-remove",children:a.map(l=>{const g=u.some(m=>m.id===l.id);return e("li",{children:e("button",{type:"button",class:`light ${g?"checked":""}`,disabled:i==="loading",onClick:()=>{o("loading"),(async()=>{try{g?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(g?"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:()=>f(!0),disabled:i!=="default",children:[e(v,{icon:"plus",size:"l"})," ",e("span",{children:"New list"})]})]}),c&&e(_e,{onClick:l=>{l.target===l.currentTarget&&f(!1)},children:e(Vn,{list:c==null?void 0:c.list,onClose:l=>{l.state==="success"&&p(),f(!1)}})})]})}function ia({account:t,note:n,onRelationshipChange:s=()=>{},onClose:i=()=>{}}){const{masto:o}=ie(),[a,h]=A("default"),u=q(null);return Z(()=>{let r;return u.current&&!n&&(r=setTimeout(()=>{var d,p;(p=(d=u.current).focus)==null||p.call(d)},100)),()=>{clearTimeout(r)}},[]),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:r=>{r.preventDefault();const p=new FormData(r.target).get("note");(p==null?void 0:p.trim())!==(n==null?void 0:n.trim())&&(h("loading"),(async()=>{try{const c=await o.v1.accounts.$select(t==null?void 0:t.id).note.create({comment:p});h("default"),s(c),i()}catch(c){h("error"),alert((c==null?void 0:c.message)||"Unable to update private note.")}})())},children:[e("textarea",{ref:u,name:"note",disabled:a==="loading",children:n}),e("footer",{children:[e("button",{type:"button",class:"light",disabled:a==="loading",onClick:()=>{i==null||i()},children:"Cancel"}),e("span",{children:[e($e,{abrupt:!0,hidden:a!=="loading"}),e("button",{disabled:a==="loading",type:"submit",children:"Save & close"})]})]})]})})]})}function sa({onClose:t=()=>{}}){const{masto:n}=ie(),[s,i]=A("loading"),[o,a]=A(null);Z(()=>{(async()=>{try{const c=await n.v1.accounts.verifyCredentials();a(c),i("default")}catch{i("error")}})()},[]);const{displayName:h,source:u}=o||{},{note:r,fields:d}=u||{},p=q(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 f=new FormData(c.target),l=f.get("display_name"),g=f.get("note"),m=p.current.querySelectorAll('input[name^="fields_attributes"]'),k=[];m.forEach(b=>{const y=b.name,[T,w,S]=y.match(/fields_attributes\[(\d+)\]\[(.+)\]/)||[],I=b.value?b.value.trim():"";w&&S&&I&&(k[w]||(k[w]={}),k[w][S]=I)}),k.forEach(b=>{b.name&&!b.value&&(b.value="")}),(async()=>{try{const b=await n.v1.accounts.updateCredentials({displayName:l,note:g,fieldsAttributes:k});t==null||t({state:"success",account:b})}catch(b){alert((b==null?void 0:b.message)||"Unable to update profile.")}})()},children:[e("p",{children:e("label",{children:["Name"," ",e("input",{type:"text",name:"display_name",defaultValue:h,maxLength:30,disabled:s==="loading"})]})}),e("p",{children:e("label",{children:["Bio",e("textarea",{defaultValue:r,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,f)=>{const{name:l="",value:g=""}=d[f]||{};return e(oa,{name:l,value:g,index:f,disabled:s==="loading"},f)})})]}),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 oa({name:t,value:n,disabled:s,index:i}){const[o,a]=A(!!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:h=>a(!!h.currentTarget.value)})})]})}function aa({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 ra({account:t,instance:n,onClose:s}){const{masto:i,instance:o,authenticated:a}=ie({instance:n}),h=typeof t=="string";return Z(()=>{h||($.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:a,account:t,fetchAccount:async()=>{if(h)try{return await i.v1.accounts.lookup({acct:t,skip_webfinger:!1})}catch{const r=await i.v2.search.fetch({q:t,type:"accounts",limit:1,resolve:a});if(r.accounts.length)return r.accounts[0];if(/https?:\/\/[^/]+\/@/.test(t)){const d=URL.parse(t),{hostname:p,pathname:c}=d,f=c.replace(/^\//,"").replace(/\/$/,"")+"@"+p,l=await i.v2.search.fetch({q:f,type:"accounts",limit:1,resolve:a});if(l.accounts.length)return l.accounts[0]}}else return t}})]})}function ca({onClose:t}){const{masto:n}=ie(),[s,i]=A("default"),[o,a]=A([]),[h,u]=kt(d=>d+1,0);Z(()=>{i("loading"),(async()=>{try{const d=await st.drafts.keys();if(d.length){const p=rn(),c=d.filter(f=>f.startsWith(p));if(c.length){const f=await st.drafts.getMany(c);f.sort((l,g)=>new Date(g.updatedAt).getTime()-new Date(l.updatedAt).getTime()),a(f)}else a([])}else a([]);i("default")}catch{i("error")}})()},[h]);const r=(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"})]}),r&&e("div",{class:"insignificant",children:"Looks like you have unsent drafts. Let's continue where you left off."})]}),e("main",{children:r?e(R,{children:[e("ul",{class:"drafts-list",children:o.map(d=>{const{updatedAt:p,key:c,draftStatus:f,replyTo:l}=d,g=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(R,{children:["@",l.account.acct,e("br",{})]}),rt(g)]})]}),e(tt,{confirmLabel:e("span",{children:"Delete this draft?"}),menuItemClassName:"danger",align:"end",disabled:s==="loading",onClick:()=>{(async()=>{try{await st.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:f,replyToStatus:m},$.showCompose=!0,$.showDrafts=!1},children:e(la,{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 st.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 la({draft:t}){var c;const{draftStatus:n,replyTo:s}=t,{status:i,spoilerText:o,poll:a,mediaAttachments:h}=n,u=((c=a==null?void 0:a.options)==null?void 0:c.length)>0,r=(h==null?void 0:h.length)>0,d=u||r,p=me(()=>{if(!r)return;const f=h.find(m=>/image/.test(m.type));if(!f)return;const{file:l}=f;return URL.createObjectURL(l)},[r,h]);return e(R,{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"}),r&&e("span",{children:[e(v,{icon:"attachment"})," ",e("small",{children:h==null?void 0:h.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 da({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 ua({instance:t,excludeRelationshipAttrs:n=[],postID:s,onClose:i=()=>{},blankCopy:o="Nothing to show"}){const{masto:a,instance:h}=ie(),u=t?t===h:!0,r=Ne($),[d,p]=A("default"),[c,f]=A([]),[l,g]=A(!1);if(ss(i),!r.showGenericAccounts)return null;const{id:m,heading:k,fetchAccounts:b,accounts:y,showReactions:T}=r.showGenericAccounts,[w,S]=A({}),I=async N=>{if(!(N!=null&&N.length)||!u)return;const te=await Nn(N,w);te&&S({...w,...te})},x=N=>{b&&(N&&f([]),p("loading"),(async()=>{try{const{done:te,value:J}=await b(N);if(Array.isArray(J)){if(N){const L=[];for(let P=0;P<J.length;P++){const F=J[P],z=L.find((j,V)=>j.id===F.id&&P!==V);z?z._types.push(...F._types):L.push({_types:[],...F})}f(L)}else f(L=>{const P=L;for(const F of J){const z=P.find(j=>j.id===F.id);z?z._types.push(...F._types):P.push(F)}return P});g(!te),I(J)}else g(!1);p("default")}catch{p("error")}})())},U=q(!0);Z(()=>{(y==null?void 0:y.length)>0?(f(y),I(y)):(x(!0),U.current=!1)},[y,b]),Z(()=>{var N;U.current||((N=r.reloadGenericAccounts)==null?void 0:N.id)===m&&x(!0)},[r.reloadGenericAccounts.counter]);const M=$.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:k||"Accounts"})}),e("main",{children:[M&&e(re,{to:`/${t||h}/s/${M.id}`,class:"post-preview",children:e(Ue,{status:M,size:"s",readOnly:!0})}),c.length>0?e(R,{children:[e("ul",{class:"accounts-list",children:c.map(N=>{var L,P;const te=w[N.id],J=`${N.id}-${((L=N._types)==null?void 0:L.length)||""}`;return e("li",{children:[T&&((P=N._types)==null?void 0:P.length)>0&&e("div",{class:"reactions-block",children:N._types.map(F=>e(v,{icon:{reblog:"rocket",favourite:"heart"}[F],class:`${F}-icon`}))}),e("div",{class:"account-relationships",children:e(Qe,{account:N,showStats:!0,relationship:te,excludeRelationshipAttrs:n})})]},J)})}),d==="default"?l?e(ht,{onChange:N=>{N&&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 ha({alt:t,lang:n,onClose:s}){const i=Ne($),[o,a]=A(!1),h=Bi(!0),u=i.settings.contentTranslationHideLanguages||[],r=!!n&&n!==h&&!ii([n],[h])&&!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:()=>{a(!0)},children:[e(v,{icon:"translate"}),e("span",{children:"Translate"})]}),Ys&&e(pe,{onClick:()=>{Ws(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}),(r||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,a=.0883024619*t+.2817188376*n+.6299787005*s;return i=Math.cbrt(i),o=Math.cbrt(o),a=Math.cbrt(a),[i*.2104542553+o*.793617785+a*-.0040720468,i*1.9779984951+o*-2.428592205+a*.4505937099,i*.0259040371+o*.7827717662+a*-.808675766]}function jn([t,n,r]){var i=t+n*.3963377774+r*.2158037573,o=t+n*-.1055613458+r*-.0638541728,a=t+n*-.0894841775+r*-1.291485548;i=i**3,o=o**3,a=a**3;var h=i*4.0767416621+o*-3.3077115913+a*.2309699292,u=i*-1.2684380046+o*2.6097574011+a*-.3413193965,r=i*-.0041960863+o*-.7034186147+a*1.707614701;return h=255*wn(h),u=255*wn(u),r=255*wn(r),h=bn(h,0,255),u=bn(u,0,255),r=bn(r,0,255),h=Math.round(h),u=Math.round(u),r=Math.round(r),[h,u,r]}var fa={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:Kc}=fa;function ls({mediaAttachments:t,statusID:n,instance:s,lang:i,index:o=0,onClose:a=()=>{}}){var y,T;const[h,u]=A("default"),r=q(null),[d,p]=A(o),c=q(null);ut(()=>{var w;(w=c.current)==null||w.scrollIntoView()},[]);const f=q(n);Z(()=>{const w=o*r.current.clientWidth,S=f.current!==n;S&&(f.current=n),r.current.scrollTo({left:w,behavior:S?"auto":"smooth"}),r.current.focus()},[o,n]);const[l,g]=A(!0);Z(()=>{let w=()=>{a()};return r.current&&r.current.addEventListener("swiped-down",w),()=>{r.current&&r.current.removeEventListener("swiped-down",w)}},[]),Le("esc",a,{ignoreEventWhen:w=>!!document.querySelector("#modal-container > *")},[a]),Z(()=>{let w=()=>{const{clientWidth:S,scrollLeft:I}=r.current,x=Math.round(I/S);p(x)};return r.current&&r.current.addEventListener("scroll",w,{passive:!0}),()=>{r.current&&r.current.removeEventListener("scroll",w)}},[]),Z(()=>{let w=setTimeout(()=>{var S,I;(I=(S=r.current)==null?void 0:S.focus)==null||I.call(S)},100);return()=>clearTimeout(w)},[]);const m=me(()=>t==null?void 0:t.map(w=>{const{blurhash:S}=w;if(S){const I=Dn(S),x=Gn(I);return jn([.6,x[1],x[2]])}return null}),[t]),k=me(()=>{var I;const S=100/m.length;return((I=m==null?void 0:m.map((x,U)=>{const M=U*S+5,N=(U+1)*S-5;return x?`
rgba(${x==null?void 0:x.join(",")}, 0.4) ${M}%,
rgba(${x==null?void 0:x.join(",")}, 0.4) ${N}%
`:`
transparent ${M}%,
transparent ${N}%
`}))==null?void 0:I.join(", "))||"transparent"},[m]);let b=q(null);return Z(()=>()=>{var w,S;(S=(w=b.current)==null?void 0:w.hideToast)==null||S.call(w)},[]),e("div",{class:`media-modal-container media-modal-count-${t==null?void 0:t.length}`,children:[e("div",{ref:r,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"))&&a()},style:t.length>1?{backgroundAttachment:"local",backgroundImage:`linear-gradient(
to right, ${k})`}:{},children:t==null?void 0:t.map((w,S)=>{const I=t.length===1?m[S]:null;return e("div",{class:"carousel-item",style:I?{"--accent-color":`rgb(${I==null?void 0:I.join(",")})`,"--accent-alpha-color":`rgba(${I==null?void 0:I.join(",")}, 0.4)`}:{},tabindex:"0",ref:S===d?c:null,onClick:x=>{x.target.classList.contains("media")||g(!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:()=>a(),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,S)=>e("button",{type:"button",disabled:S===d,class:`carousel-dot ${S===d?"active":""}`,onClick:I=>{I.preventDefault(),I.stopPropagation(),r.current.scrollTo({left:r.current.clientWidth*S,behavior:"smooth"}),r.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(Ee,{href:((y=t[d])==null?void 0:y.remoteUrl)||((T=t[d])==null?void 0:T.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(re,{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(),r.current.focus(),r.current.scrollTo({left:r.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(),r.current.focus(),r.current.scrollTo({left:r.current.clientWidth*(d+1),behavior:"smooth"})},children:e(v,{icon:"arrow-right"})})]})]})}const pa=[,"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 ma({account:t,post:n,onClose:s}){const{masto:i}=ie(),[o,a]=A("default"),[h,u]=t.acct.split("@"),[r,d]=me(()=>{const{rules:b,domain:y}=Ui();return[b||[],y]}),[p,c]=A(null),[f,l]=A(!1),g=q(null),[m,k]=A(!1);return e("div",{class:"report-modal-container",children:[e("div",{class:"top-controls",children:[e("h1",{children:n?"Report Post":`Report @${h}`}),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(Ue,{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:b=>{b.preventDefault();const y=new FormData(b.target),T=Object.fromEntries(y.entries());let{category:w,comment:S,forward:I}=T;S||(S=void 0),I==="on"&&(I=!0);const x=w==="violation"?Object.entries(T).filter(([M])=>M.startsWith("rule_ids")).map(([M,N])=>N):void 0,U={category:w,comment:S,forward:I,ruleIds:x};a("loading"),(async()=>{try{await i.v1.reports.create({accountId:t.id,statusIds:n!=null&&n.id?[n.id]:void 0,category:w,comment:S,ruleIds:x,forward:I}),a("success"),oe(n?"Post reported":"Profile reported"),s()}catch(M){a("error"),oe((M==null?void 0:M.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:pa.map(b=>b==="violation"&&!(r!=null&&r.length)?null:e(R,{children:[e("label",{class:"report-category",children:[e("input",{type:"radio",name:"category",value:b,required:!0,disabled:o==="loading",onChange:y=>{c(y.target.value),l(y.target.value==="violation")}}),e("span",{children:[Ot[b].label,"  ",e("small",{class:"ib insignificant",children:Ot[b].description})]})]}),b==="violation"&&!!(r!=null&&r.length)&&e("div",{class:"shazam-container no-animation",hidden:!f,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"report-rules",ref:g,children:r.map((y,T)=>e("label",{class:"report-rule",children:[e("input",{type:"checkbox",name:`rule_ids[${T}]`,value:y.id,required:f&&!m,disabled:o==="loading",onChange:w=>{const{checked:S}=w.target;S?k(!0):g.current.querySelectorAll("input:checked").length||k(!1)}}),e("span",{children:y.text})]},y.id))})})})]},b))}),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(),oe(`Muted ${h}`)}catch{oe(`Unable to mute ${h}`)}},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(),oe(`Blocked ${h}`)}catch{oe(`Unable to block ${h}`)}},children:["Send Report ",e("small",{class:"ib",children:"+ Block profile"})]}),e($e,{hidden:o!=="loading"})]})]})]})]})}var Yn={exports:{}},Xc=Yn.exports;(function(t){var n=function(){var s=String.fromCharCode,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",a={};function h(r,d){if(!a[r]){a[r]={};for(var p=0;p<r.length;p++)a[r][r.charAt(p)]=p}return a[r][d]}var u={compressToBase64:function(r){if(r==null)return"";var d=u._compress(r,6,function(p){return i.charAt(p)});switch(d.length%4){default:case 0:return d;case 1:return d+"===";case 2:return d+"==";case 3:return d+"="}},decompressFromBase64:function(r){return r==null?"":r==""?null:u._decompress(r.length,32,function(d){return h(i,r.charAt(d))})},compressToUTF16:function(r){return r==null?"":u._compress(r,15,function(d){return s(d+32)})+" "},decompressFromUTF16:function(r){return r==null?"":r==""?null:u._decompress(r.length,16384,function(d){return r.charCodeAt(d)-32})},compressToUint8Array:function(r){for(var d=u.compress(r),p=new Uint8Array(d.length*2),c=0,f=d.length;c<f;c++){var l=d.charCodeAt(c);p[c*2]=l>>>8,p[c*2+1]=l%256}return p},decompressFromUint8Array:function(r){if(r==null)return u.decompress(r);for(var d=new Array(r.length/2),p=0,c=d.length;p<c;p++)d[p]=r[p*2]*256+r[p*2+1];var f=[];return d.forEach(function(l){f.push(s(l))}),u.decompress(f.join(""))},compressToEncodedURIComponent:function(r){return r==null?"":u._compress(r,6,function(d){return o.charAt(d)})},decompressFromEncodedURIComponent:function(r){return r==null?"":r==""?null:(r=r.replace(/ /g,"+"),u._decompress(r.length,32,function(d){return h(o,r.charAt(d))}))},compress:function(r){return u._compress(r,16,function(d){return s(d)})},_compress:function(r,d,p){if(r==null)return"";var c,f,l={},g={},m="",k="",b="",y=2,T=3,w=2,S=[],I=0,x=0,U;for(U=0;U<r.length;U+=1)if(m=r.charAt(U),Object.prototype.hasOwnProperty.call(l,m)||(l[m]=T++,g[m]=!0),k=b+m,Object.prototype.hasOwnProperty.call(l,k))b=k;else{if(Object.prototype.hasOwnProperty.call(g,b)){if(b.charCodeAt(0)<256){for(c=0;c<w;c++)I=I<<1,x==d-1?(x=0,S.push(p(I)),I=0):x++;for(f=b.charCodeAt(0),c=0;c<8;c++)I=I<<1|f&1,x==d-1?(x=0,S.push(p(I)),I=0):x++,f=f>>1}else{for(f=1,c=0;c<w;c++)I=I<<1|f,x==d-1?(x=0,S.push(p(I)),I=0):x++,f=0;for(f=b.charCodeAt(0),c=0;c<16;c++)I=I<<1|f&1,x==d-1?(x=0,S.push(p(I)),I=0):x++,f=f>>1}y--,y==0&&(y=Math.pow(2,w),w++),delete g[b]}else for(f=l[b],c=0;c<w;c++)I=I<<1|f&1,x==d-1?(x=0,S.push(p(I)),I=0):x++,f=f>>1;y--,y==0&&(y=Math.pow(2,w),w++),l[k]=T++,b=String(m)}if(b!==""){if(Object.prototype.hasOwnProperty.call(g,b)){if(b.charCodeAt(0)<256){for(c=0;c<w;c++)I=I<<1,x==d-1?(x=0,S.push(p(I)),I=0):x++;for(f=b.charCodeAt(0),c=0;c<8;c++)I=I<<1|f&1,x==d-1?(x=0,S.push(p(I)),I=0):x++,f=f>>1}else{for(f=1,c=0;c<w;c++)I=I<<1|f,x==d-1?(x=0,S.push(p(I)),I=0):x++,f=0;for(f=b.charCodeAt(0),c=0;c<16;c++)I=I<<1|f&1,x==d-1?(x=0,S.push(p(I)),I=0):x++,f=f>>1}y--,y==0&&(y=Math.pow(2,w),w++),delete g[b]}else for(f=l[b],c=0;c<w;c++)I=I<<1|f&1,x==d-1?(x=0,S.push(p(I)),I=0):x++,f=f>>1;y--,y==0&&(y=Math.pow(2,w),w++)}for(f=2,c=0;c<w;c++)I=I<<1|f&1,x==d-1?(x=0,S.push(p(I)),I=0):x++,f=f>>1;for(;;)if(I=I<<1,x==d-1){S.push(p(I));break}else x++;return S.join("")},decompress:function(r){return r==null?"":r==""?null:u._decompress(r.length,32768,function(d){return r.charCodeAt(d)})},_decompress:function(r,d,p){var c=[],f,l=4,g=4,m=3,k="",b=[],y,T,w,S,I,x,U,M={val:p(0),position:d,index:1};for(y=0;y<3;y+=1)c[y]=y;for(w=0,I=Math.pow(2,2),x=1;x!=I;)S=M.val&M.position,M.position>>=1,M.position==0&&(M.position=d,M.val=p(M.index++)),w|=(S>0?1:0)*x,x<<=1;switch(f=w){case 0:for(w=0,I=Math.pow(2,8),x=1;x!=I;)S=M.val&M.position,M.position>>=1,M.position==0&&(M.position=d,M.val=p(M.index++)),w|=(S>0?1:0)*x,x<<=1;U=s(w);break;case 1:for(w=0,I=Math.pow(2,16),x=1;x!=I;)S=M.val&M.position,M.position>>=1,M.position==0&&(M.position=d,M.val=p(M.index++)),w|=(S>0?1:0)*x,x<<=1;U=s(w);break;case 2:return""}for(c[3]=U,T=U,b.push(U);;){if(M.index>r)return"";for(w=0,I=Math.pow(2,m),x=1;x!=I;)S=M.val&M.position,M.position>>=1,M.position==0&&(M.position=d,M.val=p(M.index++)),w|=(S>0?1:0)*x,x<<=1;switch(U=w){case 0:for(w=0,I=Math.pow(2,8),x=1;x!=I;)S=M.val&M.position,M.position>>=1,M.position==0&&(M.position=d,M.val=p(M.index++)),w|=(S>0?1:0)*x,x<<=1;c[g++]=s(w),U=g-1,l--;break;case 1:for(w=0,I=Math.pow(2,16),x=1;x!=I;)S=M.val&M.position,M.position>>=1,M.position==0&&(M.position=d,M.val=p(M.index++)),w|=(S>0?1:0)*x,x<<=1;c[g++]=s(w),U=g-1,l--;break;case 2:return b.join("")}if(l==0&&(l=Math.pow(2,m),m++),c[U])k=c[U];else if(U===g)k=T+T.charAt(0);else return null;b.push(k),c[g++]=T+k.charAt(0),l--,T=k,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 ga="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",ba="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",ya="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",wa=200,va=10;async function un(){const{masto:t}=ie(),n=t.v1.followedTags.list({limit:wa}),s=[];let i=0;do{const{value:o,done:a}=await n.next();if(a||(o==null?void 0:o.length)===0)break;s.push(...o),i++}while(i<va);return s.sort((o,a)=>o.name.localeCompare(a.name)),s.length&&setTimeout(()=>{we.account.set("followedTags",{tags:s,updatedAt:Date.now()})},1),s}const ka=24*60*60*1e3;async function Sa(){try{const{tags:t,updatedAt:n}=we.account.get("followedTags")||{};return t!=null&&t.length?(Date.now()-n>ka&&un(),t):await un()}catch{return[]}}const mi=document.createElement("div"),Ia=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]=A("");return Z(()=>{Promise.resolve(t).then(s)},[t]),n}const lt=9,Ca=["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}]},Ta=ft(async({id:t})=>{const n=await ie().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?Ho(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||ie().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||ie().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:Ta,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||ie().instance,path:({hashtag:t,instance:n,media:s})=>`${n?`/${n}`:""}/t/${t.split(/\s+/).join("+")}${s?"?media=1":""}`,icon:"hashtag"}};function xa({onClose:t}){const n=Ne($),{shortcuts:s}=n,[i,o]=A(!1),[a,h]=A(!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:ga},{value:"tab-menu-bar",label:"Tab/Menu bar",imgURL:ya},{value:"multi-column",label:"Multi-column",imgURL:ba}].map(({value:r,label:d,imgURL:p})=>{const c=n.settings.shortcutsViewMode===r||r==="float-button"&&!n.settings.shortcutsViewMode;return e("label",{class:c?"checked":"",children:[e("input",{type:"radio",name:"shortcuts-view-mode",value:r,checked:c,onChange:f=>{$.settings.shortcutsViewMode=f.target.value}})," ",e("img",{src:p,alt:"",width:"80",height:"58"})," ",e("span",{children:d})]},r)})}),s.length>0?e(R,{children:[e("ol",{class:"shortcuts-list",ref:u,children:s.filter(Boolean).map((r,d)=>{const p=Object.values(r).join("-"),{type:c}=r;if(!hn[c])return null;let{icon:f,title:l,subtitle:g,excludeViewMode:m}=hn[c];typeof l=="function"&&(l=l(r,d)),typeof g=="function"&&(g=g(r,d)),typeof f=="function"&&(f=f(r,d)),typeof m=="function"&&(m=m(r,d));const k=m==null?void 0:m.includes(n.settings.shortcutsViewMode);return e("li",{children:[e(v,{icon:f}),e("span",{class:"shortcut-text",children:[e(tn,{children:l}),g&&e(R,{children:[" ",e("small",{class:"ib insignificant",children:g})]}),k&&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 b=Array.from($.shortcuts);if(d>0){const y=$.shortcuts[d-1];b[d-1]=r,b[d]=y,$.shortcuts=b}},children:e(v,{icon:"arrow-up",alt:"Move up"})}),e("button",{type:"button",class:"plain small",disabled:d===s.length-1,onClick:()=>{const b=Array.from($.shortcuts);if(d<$.shortcuts.length-1){const y=$.shortcuts[d+1];b[d+1]=r,b[d]=y,$.shortcuts=b}},children:e(v,{icon:"arrow-down",alt:"Move down"})}),e("button",{type:"button",class:"plain small",onClick:()=>{o({shortcut:r,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:r=>{r.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:()=>h(!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(_e,{onClick:r=>{r.target===r.currentTarget&&o(!1)},children:e($a,{shortcut:i.shortcut,shortcutIndex:i.shortcutIndex,onSubmit:({result:r,mode:d})=>{d==="edit"?$.shortcuts[i.shortcutIndex]=r:$.shortcuts.push(r)},onClose:()=>o(!1)})}),a&&e(_e,{onClick:r=>{r.target===r.currentTarget&&h(!1)},children:e(Aa,{shortcuts:s,onClose:()=>h(!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 $a({onSubmit:t,disabled:n,shortcut:s,shortcutIndex:i,onClose:o}){var k,b;const a=!!s,[h,u]=A((s==null?void 0:s.type)||null),{masto:r}=ie(),[d,p]=A("default"),[c,f]=A([]),[l,g]=A([]);Z(()=>{(async()=>{if(h==="list")try{p("loading");const y=await Yt();f(y),p("default")}catch{p("error")}})(),(async()=>{if(h==="hashtag")try{const y=await un();g(y)}catch{}})()},[h]);const m=q();return Z(()=>{if(a&&h&&nn[h]){const y=m.current;nn[h].forEach(({name:T,type:w})=>{const S=y.querySelector(`[name="${T}"]`);S&&s[T]&&(w==="checkbox"?S.checked=s[T]==="on":S.value=s[T])})}},[a,h]),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:[a?"Edit":"Add"," shortcut"]})}),e("main",{tabindex:"-1",children:e("form",{ref:m,onSubmit:y=>{y.preventDefault();const T=new FormData(y.target),w={};T.forEach((S,I)=>{w[I]=S==null?void 0:S.trim(),I==="instance"&&(w[I]=w[I].replace(/^https?:\/\//,"").replace(/\/+$/,""),w[I]=w[I].replace(/^@?[^@]+@/,""))}),w.type&&(t({result:w,mode:a?"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:a?s.type:void 0,name:"type",children:[e("option",{}),Ca.map(y=>e("option",{value:y,children:ds[y]}))]})]})}),(b=(k=nn[h])==null?void 0:k.map)==null?void 0:b.call(k,({text:y,name:T,type:w,placeholder:S,pattern:I,notRequired:x})=>h==="list"?e("p",{children:e("label",{children:[e("span",{children:"List"}),e("select",{name:"id",required:!x,disabled:n||d==="loading",defaultValue:a?s.id:void 0,children:[e("option",{value:""}),c.map(U=>e("option",{value:U.id,children:U.title}))]})]})}):e("p",{children:e("label",{children:[e("span",{children:y})," ",e("input",{type:w,switch:w==="checkbox"||void 0,name:T,placeholder:S,required:w==="text"&&!x,disabled:n,list:h==="hashtag"?"followed-hashtags-datalist":null,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:I}),h==="hashtag"&&l.length>0&&e("datalist",{id:"followed-hashtags-datalist",children:l.map(U=>e("option",{value:U.name}))})]})})),!!gi[h]&&e("p",{class:"form-note insignificant",children:[e(v,{icon:"info"}),gi[h]]}),e("footer",{children:[e("button",{type:"submit",class:"block",disabled:n||d==="loading",children:a?"Save":"Add"}),a&&e("button",{type:"button",class:"light danger",onClick:()=>{$.shortcuts.splice(i,1),o==null||o()},children:"Remove"})]})]})})]})}function Aa({shortcuts:t,onClose:n}){var c;const{masto:s}=ie(),i=me(()=>!t||!t.filter(Boolean).length?"":pi.compressToEncodedURIComponent(JSON.stringify(t.filter(Boolean))),[t]),[o,a]=A(""),[h,u]=A("default"),r=me(()=>{if(!o)return u("default"),null;try{const f=JSON.parse(pi.decompressFromEncodedURIComponent(o));if(!Array.isArray(f))throw new Error("Not an array");return u("default"),f}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=q();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:f=>{a(f.target.value)}}),$.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2 small",disabled:h==="cloud-downloading",onClick:async()=>{u("cloud-downloading");const f=dt();oe("Downloading saved shortcuts from instance server…");try{const g=(await s.v1.accounts.relationships.fetch({id:[f]}))[0];if(g){const{note:m=""}=g;if(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/.test(m)){const k=m.match(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/)[1],{v:b,dt:y,data:T}=JSON.parse(k);p.current.value=T,p.current.dispatchEvent(new Event("input"))}}u("default")}catch{u("error"),oe("Unable to download shortcuts")}},title:"Download shortcuts from instance server",children:[e(v,{icon:"cloud"}),e(v,{icon:"arrow-down"})]})]}),!!r&&Array.isArray(r)&&e(R,{children:[e("p",{children:[e("b",{children:r.length})," shortcut",r.length>1?"s":""," ",e("small",{class:"insignificant",children:["(",o.length," characters)"]})]}),e("ol",{class:"import-settings-list",children:r.map(f=>{var l,g;return e("li",{children:[e("span",{style:{opacity:t.some(m=>Object.keys(m).every(k=>m[k]===f[k]))?1:0},children:"*"}),e("span",{children:[ds[f.type],f.type==="list"&&" ⚠️"," ",(g=(l=nn[f.type])==null?void 0:l.map)==null?void 0:g.call(l,({text:m,name:k,type:b})=>f[k]?e(R,{children:[e("span",{class:"tag collapsed insignificant",children:[m,":"," ",b==="checkbox"?f[k]==="on"?"✅":"❌":f[k]]})," "]}):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."})]})]}),h==="error"&&e("p",{class:"error",children:e("small",{children:"⚠️ Invalid settings format"})}),e("p",{children:[d&&e(R,{children:[e(tt,{confirmLabel:"Append to current shortcuts?",menuFooter:e("div",{class:"footer",children:"Only shortcuts that dont exist in current shortcuts will be appended."}),onClick:()=>{const f=r.filter(m=>!$.shortcuts.some(k=>Object.keys(k).every(b=>k[b]===m[b])));if(!f.length){oe("No new shortcuts to import");return}let l=[...$.shortcuts,...f];const g=l.length>lt;g&&(l=l.slice(0,lt)),$.shortcuts=l,oe(g?`Shortcuts imported. Exceeded max ${lt}, so the rest are not imported.`:"Shortcuts imported"),n==null||n()},children:e("button",{type:"button",class:"plain2",disabled:!r,children:"Import & append…"})})," "]}),e(tt,{confirmLabel:d?"Override current shortcuts?":"Import shortcuts?",menuItemClassName:d?"danger":void 0,onClick:()=>{$.shortcuts=r,oe("Shortcuts imported"),n==null||n()},children:e("button",{type:"button",class:"plain2",disabled:!r,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:f=>{if(f.target.value){f.target.select();try{navigator.clipboard.writeText(f.target.value),oe("Shortcuts copied")}catch{oe("Unable to copy shortcuts")}}}})}),e("p",{children:[e("button",{type:"button",class:"plain2",disabled:!i,onClick:()=>{try{navigator.clipboard.writeText(i),oe("Shortcut settings copied")}catch{oe("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:h==="cloud-uploading",onClick:async()=>{u("cloud-uploading");const f=dt();try{const g=(await s.v1.accounts.relationships.fetch({id:[f]}))[0];if(g){const{note:m=""}=g;let k="";if(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/.test(m)){const b=JSON.stringify({v:"1",dt:Date.now(),data:i});k=m.replace(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/,`<phanpy-shortcuts-settings>${b}</phanpy-shortcuts-settings>`)}else k=`${m}
<phanpy-shortcuts-settings>${settingsJSON}</phanpy-shortcuts-settings>`;oe("Saving shortcuts to instance server…"),await s.v1.accounts.$select(f).note.create({comment:k}),u("default"),oe("Shortcuts saved")}}catch{u("error"),oe("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 _a(){var i,o,a,h,u,r,d,p;const t=Ne($),n=Fi(),s=Pt();return Z(()=>{setTimeout(Es,1e3)},[]),e(R,{children:[!!t.showCompose&&e(_e,{class:`solid ${t.composerState.minimized?"min":""}`,minimized:!!t.composerState.minimized,children:e(Ls,{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)||((a=window.__COMPOSE__)==null?void 0:a.editStatus)||null,draftStatus:((h=$.showCompose)==null?void 0:h.draftStatus)||((u=window.__COMPOSE__)==null?void 0:u.draftStatus)||null,onClose:c=>{const{newStatus:f,instance:l,type:g}=c||{};$.showCompose=!1,window.__COMPOSE__=null,f&&($.reloadStatusPage++,oe({text:{post:"Post published. Check it out.",reply:"Reply posted. Check it out.",edit:"Post updated. Check it out."}[g||"post"],delay:1e3,duration:1e4,onClick:m=>{m.hideToast(),$.prevLocation=s,n(l?`/${l}/s/${f.id}`:`/s/${f.id}`)}}))}})}),!!t.showSettings&&e(_e,{onClose:()=>{$.showSettings=!1},children:e(Oo,{onClose:()=>{$.showSettings=!1}})}),!!t.showAccounts&&e(_e,{onClose:()=>{$.showAccounts=!1},children:e(Ao,{onClose:()=>{$.showAccounts=!1}})}),!!t.showAccount&&e(_e,{onClose:()=>{$.showAccount=!1},children:e(ra,{account:((r=t.showAccount)==null?void 0:r.account)||t.showAccount,instance:(d=t.showAccount)==null?void 0:d.instance,onClose:({destination:c}={})=>{$.showAccount=!1}})}),!!t.showDrafts&&e(_e,{onClose:()=>{$.showDrafts=!1},children:e(ca,{onClose:()=>$.showDrafts=!1})}),!!t.showMediaModal&&e(_e,{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(_e,{onClose:()=>{$.showShortcutsSettings=!1},children:e(xa,{onClose:()=>$.showShortcutsSettings=!1})}),!!t.showGenericAccounts&&e(_e,{onClose:()=>{$.showGenericAccounts=!1},children:e(ua,{instance:t.showGenericAccounts.instance,excludeRelationshipAttrs:t.showGenericAccounts.excludeRelationshipAttrs,postID:t.showGenericAccounts.postID,onClose:()=>$.showGenericAccounts=!1,blankCopy:t.showGenericAccounts.blankCopy})}),!!t.showMediaAlt&&e(_e,{onClose:c=>{$.showMediaAlt=!1},children:e(ha,{alt:t.showMediaAlt.alt||t.showMediaAlt,lang:(p=t.showMediaAlt)==null?void 0:p.lang,onClose:()=>{$.showMediaAlt=!1}})}),!!t.showEmbedModal&&e(_e,{class:"solid",onClose:()=>{$.showEmbedModal=!1},children:e(da,{html:t.showEmbedModal.html,url:t.showEmbedModal.url,width:t.showEmbedModal.width,height:t.showEmbedModal.height,onClose:()=>{$.showEmbedModal=!1}})}),!!t.showReportModal&&e(_e,{onClose:()=>{$.showReportModal=!1},children:e(ma,{account:t.showReportModal.account,post:t.showReportModal.post,onClose:()=>{$.showReportModal=!1}})})]})}function $n({accountID:t,onChange:n}){const{masto:s}=ie(),[i,o]=A("default"),[a,h]=A(null),[u,r]=A(null),d=u!==null;return e("p",{class:"follow-request-buttons",children:[e("button",{type:"button",disabled:i==="loading"||d,onClick:()=>{o("loading"),h("accept"),(async()=>{try{const p=await s.v1.followRequests.$select(t).authorize();if(!(p!=null&&p.followedBy))throw new Error("Follow request not accepted");r(p),n()}catch{}o("default")})()},children:"Accept"})," ",e("button",{type:"button",disabled:i==="loading"||d,class:"light danger",onClick:()=>{o("loading"),h("reject"),(async()=>{try{const p=await s.v1.followRequests.$select(t).reject();if(p!=null&&p.followedBy)throw new Error("Follow request not rejected");r(p),n()}catch{o("default")}})()},children:"Reject"}),e("span",{class:"follow-request-states",children:d&&a?a==="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(R,{children:["reacted to your post with"," ",e(Ks,{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(R,{children:["reported ",t]}),severed_relationships:t=>e(R,{children:["Lost connections with ",e("i",{children:t}),"."]}),moderation_warning:e("b",{children:"Moderation warning"}),emoji_reaction:yi,"pleroma:emoji_reaction":yi},Ra={account_suspension:({from:t,targetName:n})=>e(R,{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(R,{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(R,{children:["You have blocked ",e("i",{children:t}),". Removed followers: ",n,", followings: ",s,"."]})},Ea={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 La({notification:t,instance:n,isStatic:s,disableContextMenu:i}){var J,L,P,F,z,j;const{id:o,status:a,account:h,report:u,event:r,moderation_warning:d,_ids:p,_accounts:c,_statuses:f,sampleAccounts:l,notificationsCount:g}=t;let{type:m}=t;const k=(a==null?void 0:a.reblog)||a,b=k==null?void 0:k.id,y=dt(),T=y===(h==null?void 0:h.id),w=(J=a==null?void 0:a.poll)==null?void 0:J.voted,S=!!(a!=null&&a.inReplyToAccountId)&&(a==null?void 0:a.inReplyToAccountId)!==y&&((L=a==null?void 0:a.account)==null?void 0:L.id)===y;let I=0,x=0;if(m==="favourite+reblog"){if(c)for(const V of c)(P=V._types)!=null&&P.includes("favourite")&&I++,(F=V._types)!=null&&F.includes("reblog")&&x++;!x&&I&&(m="favourite"),!I&&x&&(m="reblog")}let U;if(m==="poll"?U=$t[T?"poll-self":w?"poll-voted":"poll"]:m==="reblog"||m==="favourite"||m==="favourite+reblog"?(f==null?void 0:f.length)>1?U=$t[`${m}+account`]:S?U=$t[`${m}_reply`]:U=$t[m]:$t[m]?U=$t[m]:U=`[Unknown notification type: ${m}]`,typeof U=="function"){const V=(f==null?void 0:f.length)||(c==null?void 0:c.length);if(m==="admin.report"){const D=u==null?void 0:u.targetAccount;D&&(U=U(e(Et,{account:D,showAvatar:!0})))}else if(m==="severed_relationships"){const D=r==null?void 0:r.targetName;D&&(U=U(D))}else if((m==="emoji_reaction"||m==="pleroma:emoji_reaction")&&t.emoji){const D=t.emoji_url||((j=(z=a==null?void 0:a.emojis)==null?void 0:z.find)==null?void 0:j.call(z,se=>(se==null?void 0:se.shortcode)===t.emoji.replace(/^:/,"").replace(/:$/,"")));U=U(t.emoji,D)}else V&&(U=U(V))}if(m==="mention"&&!a)return null;const M=t.createdAt&&new Date(t.createdAt).toLocaleString(),N={"favourite+reblog":"Boosted/Liked by…",favourite:"Liked by…",reblog:"Boosted by…",follow:"Followed by…"}[m]||"Accounts",te=()=>{$.showGenericAccounts={heading:N,accounts:c,showReactions:m==="favourite+reblog",excludeRelationshipAttrs:m==="follow"?["followedBy"]:[],postID:Xe(b,n)}};return e("div",{class:`notification notification-${m}`,"data-notification-id":p||o,tabIndex:"0",children:[e("div",{class:`notification-type notification-${m}`,title:M,children:m==="favourite+reblog"?e(R,{children:[e(v,{icon:"rocket",size:"xl",alt:m,class:"reblog-icon"}),e(v,{icon:"heart",size:"xl",alt:m,class:"favourite-icon"})]}):e(v,{icon:bi[m]||"notification",size:"xl",alt:m})}),e("div",{class:"notification-content",children:[m!=="mention"&&e(R,{children:[e("p",{children:[!/poll|update|severed_relationships/i.test(m)&&e(R,{children:(c==null?void 0:c.length)>1?e(R,{children:[e("b",{tabIndex:"0",onClick:te,children:[e("span",{title:c.length,children:je(c.length)})," ","people"]})," "]}):g>1?e(R,{children:[e("b",{children:[e("span",{title:g,children:je(g)})," ","people"]})," "]}):h&&e(R,{children:[e(Et,{account:h,showAvatar:!0})," "]})}),U,m==="mention"&&e("span",{class:"insignificant",children:[" ","•"," ",e(It,{datetime:t.createdAt,format:"micro"})]})]}),m==="follow_request"&&e($n,{accountID:h.id}),m==="severed_relationships"&&e("div",{children:[Ra[r.type]({from:n,...r}),e("br",{}),e("a",{href:`https://${n}/severed_relationships`,target:"_blank",rel:"noopener noreferrer",children:["Learn more ",e(v,{icon:"external",size:"s"})]}),"."]}),m==="moderation_warning"&&!!d&&e("div",{children:[Ea[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"})]}),"."]})]}),(c==null?void 0:c.length)>1&&e("p",{class:"avatars-stack",children:[c.slice(0,vn).map(V=>e(R,{children:[e("a",{href:V.url,rel:"noopener noreferrer",class:"account-avatar-stack",onClick:D=>{D.preventDefault(),$.showAccount=V},children:[e(nt,{url:V.avatarStatic,size:c.length<=10?"xxl":c.length<20?"xl":"l",alt:`${V.displayName} @${V.acct}`,squircle:V==null?void 0:V.bot},V.id),m==="favourite+reblog"&&e("div",{class:"account-sub-icons",children:V._types.map(D=>e(v,{icon:bi[D],size:"s",class:`${D}-icon`}))})]},V.id)," "]},V.id)),e("button",{type:"button",class:"small plain",onClick:te,children:[c.length>vn&&`+${c.length-vn}`,e(v,{icon:"chevron-down"})]})]}),!(c!=null&&c.length)&&(l==null?void 0:l.length)>1&&e("p",{class:"avatars-stack",children:[l.map(V=>e(R,{children:[e("a",{href:V.url,rel:"noopener noreferrer",class:"account-avatar-stack",onClick:D=>{D.preventDefault(),$.showAccount=V},children:e(nt,{url:V.avatarStatic,size:"xxl",alt:`${V.displayName} @${V.acct}`,squircle:V==null?void 0:V.bot},V.id)},V.id)," "]},V.id)),g>l.length&&e(re,{to:n?`/${n}/s/${a.id}`:`/s/${a.id}`,class:"button small plain centered",children:["+",g-l.length,e(v,{icon:"chevron-right"})]})]}),(f==null?void 0:f.length)>1&&e("ul",{class:"notification-group-statuses",children:f.map(V=>e("li",{children:e(wi,{class:`status-link status-type-${m}`,to:n?`/${n}/s/${V.id}`:`/s/${V.id}`,children:e(Ue,{status:V,size:"s",previewMode:!0,allowContextMenu:!0})})},V.id))}),a&&(!(f!=null&&f.length)||(f==null?void 0:f.length)<=1)&&e(wi,{class:`status-link status-type-${m}`,to:n?`/${n}/s/${b}`:`/s/${b}`,onContextMenu:i?void 0:V=>{const D=V.target.querySelector(".status");if(D){if(V.metaKey)return;V.preventDefault(),D.dispatchEvent(new MouseEvent("contextmenu",{clientX:V.clientX,clientY:V.clientY}))}},children:s?e(Ue,{status:k,size:"s",readOnly:!0,allowContextMenu:!0}):e(Ue,{statusID:b,size:"s",readOnly:!0,allowContextMenu:!0})})]})]})}function wi(t){const n=Xs();return e(re,{...t,"data-read-more":"Read more →",ref:n})}const mn=Je(La,(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 Ma=Je(function(){if(!("serviceWorker"in navigator))return null;const n=Ne($),{routeNotification:s}=n,{id:i,accessToken:o}=s||{},[a,h]=A(!1);ut(()=>{if(!i||!o)return;const{instance:r}=ie(),{masto:d,instance:p}=ie({accessToken:o}),c=r===p,f=o?Ms(o):Rt();(async()=>{const l=await d.v1.notifications.$select(i).fetch();if(l&&f){const g=f.instanceURL,{type:m,status:k,account:b}=l,y=!!document.querySelector("#modal-container > *"),T=m==="follow"&&!!(b!=null&&b.id),w=!!(b!=null&&b.id),S=!!(k!=null&&k.id);T&&c?$.showAccount={account:b,instance:g}:y||!c||w&&S?h({id:i,account:f,notification:l,sameInstance:c}):S?location.hash=`/${r}/s/${k.id}`:T?location.hash=`/${r}/a/${b.id}`:location.hash="/notifications"}})()},[i,o]),ut(()=>{navigator!=null&&navigator.clearAppBadge&&navigator.clearAppBadge()},[]),Lt(r=>{r&&(navigator!=null&&navigator.clearAppBadge)&&navigator.clearAppBadge()});const u=()=>{h(!1),$.routeNotification=null,/\/notifications\?id=/i.test(location.hash)&&(location.hash="/notifications")};if(a){const{id:r,account:d,notification:p,sameInstance:c}=a;return e(_e,{onClick:f=>{f.target===f.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:f=>{const{target:l}=f;(f.target.tagName==="BUTTON"||f.target.tagName==="A")&&u()},children:e(mn,{instance:d.instanceURL,notification:p,isStatic:!0})}),e("div",{style:{textAlign:"end"},children:e(re,{to:"/notifications",class:"button light",onClick:u,children:[e("span",{children:"View all notifications"})," ",e(v,{icon:"arrow-right"})]})})]})]})})}return null}),us=Ds((t,n)=>{const{instance:s}=ie(),[i,o]=ot(),[a,h]=A(!1),[u,r]=A(i.get("q")||""),d=i.get("type"),p=q(null),c=q(null);return Ns(n,()=>({setValue:f=>{r(f)},focus:()=>{c.current.focus()},select:()=>{c.current.select()},blur:()=>{c.current.blur()}})),e("form",{ref:p,class:"search-popover-container",onSubmit:f=>{var g;if(f.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";(g=t==null?void 0:t.onSubmit)==null||g.call(t,f)},children:[e("input",{ref:c,value:u,name:"q",type:"search",placeholder:"Search",dir:"auto",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",onSearch:f=>{f.target.value||o({})},onInput:f=>{r(f.target.value),h(!0)},onFocus:()=>{var f,l;h(!0),(l=(f=p.current)==null?void 0:f.querySelector(".search-popover-item"))==null||l.classList.add("focus")},onBlur:()=>{var f,l;setTimeout(()=>{h(!1)},100),(l=(f=p.current)==null?void 0:f.querySelector(".search-popover-item.focus"))==null||l.classList.remove("focus")},onKeyDown:f=>{var g;const{key:l}=f;switch(l){case"Escape":h(!1);break;case"Down":case"ArrowDown":if(f.preventDefault(),a){const m=p.current.querySelector(".search-popover-item.focus");if(m){let k=m.nextElementSibling;for(;k&&k.hidden;)k=k.nextElementSibling;k&&(k.classList.add("focus"),Array.from(k.parentElement.children).filter(y=>y!==k).forEach(y=>{y.classList.remove("focus")}))}else{const k=p.current.querySelector(".search-popover-item");k&&k.classList.add("focus")}}break;case"Up":case"ArrowUp":if(f.preventDefault(),a){const m=document.querySelector(".search-popover-item.focus");if(m){let k=m.previousElementSibling;for(;k&&k.hidden;)k=k.previousElementSibling;k&&(k.classList.add("focus"),Array.from(k.parentElement.children).filter(y=>y!==k).forEach(y=>{y.classList.remove("focus")}))}else{const k=document.querySelector(".search-popover-item:last-child");k&&k.classList.add("focus")}}break;case"Enter":if(a){const m=document.querySelector(".search-popover-item.focus");m&&(f.preventDefault(),m.click()),h(!1),(g=t==null?void 0:t.onSubmit)==null||g.call(t,f)}break}}}),e("div",{class:"search-popover",hidden:!a||!u,children:!!u&&[{label:e(R,{children:[u," ",e("small",{class:"insignificant",children:" accounts, hashtags & posts"})]}),to:`/search?q=${encodeURIComponent(u)}`,top:!d&&!/\s/.test(u),hidden:!!d},{label:e(R,{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(R,{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(R,{children:["Look up ",e("mark",{children:u})]}),to:`/${u}`,hidden:!/^https?:/.test(u),top:/^https?:/.test(u),type:"link"},{label:e(R,{children:["Accounts with ",e("q",{children:u})]}),to:`/search?q=${encodeURIComponent(u)}&type=accounts`,icon:"group",queryType:"accounts"}].sort((f,l)=>{if(d){if(f.queryType===d)return-1;if(l.queryType===d)return 1}return f.top&&!l.top?-1:!f.top&&l.top?1:0}).filter(({hidden:f})=>!f).map(({label:f,to:l,icon:g,type:m},k)=>e(re,{to:l,class:`search-popover-item ${k===0?"focus":""}`,onClick:b=>{var y;(y=t==null?void 0:t.onSubmit)==null||y.call(t,b)},children:[e(v,{icon:g||(m==="link"?"arrow-right":"search"),class:"more-insignificant"}),e("span",{children:f})," "]}))})]})}),Na=Je(function({onClose:n=()=>{}}){const[s,i]=A(!1),o=q(null);Le(["Slash","/"],h=>{i(!0),setTimeout(()=>{var u,r,d,p;(r=(u=o.current)==null?void 0:u.focus)==null||r.call(u),(p=(d=o.current)==null?void 0:d.select)==null||p.call(d)},0)},{preventDefault:!0,ignoreEventWhen:h=>{const u=/\/search/.test(location.hash),r=!!document.querySelector("#modal-container > *");return u||r}});const a=()=>{i(!1),n()};return Le("esc",h=>{var u,r;(r=(u=o.current)==null?void 0:u.blur)==null||r.call(u),a()},{enabled:s,enableOnFormTags:!0,preventDefault:!0}),e("div",{id:"search-command-container",hidden:!s,onClick:h=>{h.target===h.currentTarget&&a()},children:e(us,{ref:o,onSubmit:()=>{a()}})})});function Da(){const{instance:t}=ie(),n=Ne($),{shortcuts:s,settings:i}=n;if(!s.length||i.shortcutsViewMode==="multi-column"||!i.shortcutsViewMode&&i.shortcutsColumnsMode)return null;const o=q(),a=q(!1),h=s.map((p,c)=>{const{type:f,...l}=p;if(!hn[f])return null;let{id:g,path:m,title:k,subtitle:b,icon:y}=hn[f];return typeof g=="function"&&(g=g(l,c)),typeof m=="function"&&(m=m({...l,instance:l.instance||t},c)),typeof k=="function"&&(k=k(l,c)),typeof b=="function"&&(b=b(l,c)),typeof y=="function"&&(y=y(l,c)),g==="lists"&&(a.current=!0),{id:g,path:m,title:k,subtitle:b,icon:y}}).filter(Boolean),u=Fi();Le(["1","2","3","4","5","6","7","8","9"],(p,c)=>{var l,g;const f=parseInt(c.keys[0],10)-1;if(f<h.length){const{path:m}=h[f];m&&(u(m),(g=(l=o.current)==null?void 0:l.closeMenu)==null||g.call(l))}});const[r,d]=A([]);return e("div",{id:"shortcuts",children:n.settings.shortcutsViewMode==="tab-menu-bar"?e("nav",{class:"tab-bar",onContextMenu:p=>{p.preventDefault(),$.showShortcutsSettings=!0},children:e("ul",{children:h.map(({id:p,path:c,title:f,subtitle:l,icon:g},m)=>e("li",{children:e(re,{class:l?"has-subtitle":"",to:c,onClick:k=>{if(k.target.classList.contains("is-active")){k.preventDefault();const b=document.getElementById(`${p}-page`);if(b){b.scrollTop=0;const y=b.querySelector(".updates-button");y&&y.click()}}},children:[e(v,{icon:g,size:"xl",alt:f}),e("span",{children:[e(tn,{children:f}),l&&e(R,{children:[e("br",{}),e("small",{children:l})]})]})]})},`${m}-${p}-${f}-${l}-${c}`))})}):e(Ze,{instanceRef:o,overflow:"auto",viewScroll:"close",menuClassName:"glass-menu shortcuts-menu",gap:8,position:"anchor",onMenuChange:p=>{p.open&&a.current&&Yt().then(d)},menuButton:e("button",{type:"button",id:"shortcuts-button",class:"plain",onContextMenu:p=>{p.preventDefault(),$.showShortcutsSettings=!0},onTransitionStart:p=>{var c,f;try{const{target:l}=p;getComputedStyle(l).pointerEvents==="none"&&((f=(c=o.current)==null?void 0:c.closeMenu)==null||f.call(c))}catch{}},children:e(v,{icon:"shortcut",size:"xl",alt:"Shortcuts"})}),children:h.map(({id:p,path:c,title:f,subtitle:l,icon:g},m)=>p==="lists"?e(cn,{menuClassName:"glass-menu",overflow:"auto",gap:-8,label:e(R,{children:[e(v,{icon:g,size:"l"}),e("span",{class:"menu-grow",children:e(tn,{children:f})}),e(v,{icon:"chevron-right"})]}),children:[e(Ee,{to:"/l",children:e("span",{children:"All Lists"})}),e(Be,{}),r==null?void 0:r.map(k=>e(Ee,{to:`/l/${k.id}`,children:e("span",{children:k.title})},k.id))]}):e(Ee,{to:c,class:"glass-menu-item",children:[e(v,{icon:g,size:"l"})," ",e("span",{class:"menu-grow",children:[e("span",{children:e(tn,{children:f})}),l&&e(R,{children:[" ",e("small",{class:"more-insignificant",children:l})]})]}),e("span",{class:"menu-shortcut hide-until-focus-visible",children:m+1})]},`${m}-${p}-${f}-${l}-${c}`))})})}const Pa=Je(Da);function Ua(t){var o;let n=[],s=[],i=0;for(let a=0;a<t.length;a++){const h=t[a];h.reblog&&!((o=h.account)!=null&&o.group)?(s.push(h),i++):(n.push(h),i<3&&(i=0))}if(t.length>10&&(s.length>t.length/4||i>=3)){const a=s.map(h=>h.id);if(s.length>t.length*3/4)n=[...n,{id:a,items:s,type:"boosts"}];else{const h=Math.floor(n.length/2);n=[...n.slice(0,h),{id:a,items:s,type:"boosts"},...n.slice(h)]}return n}else return t}function vi(t,n){const s=we.account.get("boostedStatusIDs")||{},i=t.filter(a=>{if(!a.reblog)return!0;const h=`${n}-${a.reblog.id}`,u=s[h];return u&&u!==a.id?!1:(s[h]=a.id,!0)}),o=Object.keys(s);return o.length>50&&o.slice(0,o.length-50).forEach(a=>{delete s[a]}),we.account.set("boostedStatusIDs",s),i}function Oa(t,n){const s=[];let i=0;t.forEach(u=>{for(let d=0;d<s.length;d++){if(s[d].find(p=>p.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 r=t.find(d=>d.id===u.inReplyToId);r&&(s[i++]=[u,r])});for(let u=0;u<s.length;u++)for(let r=u+1;r<s.length;r++)s[u].find(p=>s[r].includes(p))&&(s[u]=[...s[u],...s[r]],s[u]=s[u].filter((p,c,f)=>f.findIndex(l=>l.id===p.id)===c),s.splice(r,1),r--);s.forEach(u=>{u.sort((r,d)=>!r.inReplyToId&&!d.inReplyToId?new Date(r.createdAt)-new Date(d.createdAt):r.inReplyToId===d.id?1:d.inReplyToId===r.id||!r.inReplyToId?-1:d.inReplyToId?new Date(r.createdAt)-new Date(d.createdAt):1)}),s.forEach(u=>{const r=u[0].account.id;u.forEach(d=>{d.account.id!==r&&(d._differentAuthor=!0)})}),s.length;const o=[],a=[],h=[];return t.forEach(u=>{if(u.reblog){o.push(u);return}for(let r=0;r<s.length;r++)if(s[r].find(d=>d.id===u.id)){if(a.includes(r))return;const d=s[r];d.sort((c,f)=>{const l=new Date(c.createdAt),g=new Date(f.createdAt);return l-g});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"}),a.push(r);return}if(u.inReplyToId&&u.inReplyToAccountId!==u.account.id){const r=Xe(u.id,n);$.statusReply[r]||h.push({sKey:r,inReplyToId:u.inReplyToId})}o.push(u)}),h!=null&&h.length&&queueMicrotask(()=>{const{masto:u}=ie({instance:n});async function r(){for(let d=0;d<h.length;d++){const{sKey:p,inReplyToId:c}=h[d];try{const f=await Fa(c,u);He(f,n,{skipThreading:!0}),$.statusReply[p]={id:f.id,instance:n},await new Promise(l=>setTimeout(l,1e3))}catch{}}}if(Ve("@mastodon/fetch-multiple-statuses")){const d=h.map(({inReplyToId:p})=>p);(async()=>{var p;try{const c=await u.v1.statuses.list({id:d});if(c!=null&&c.length)for(const f of c){He(f,n,{skipThreading:!0});const l=(p=h.find(({inReplyToId:g})=>g===f.id))==null?void 0:p.sKey;l&&($.statusReply[l]={id:f.id,instance:n})}else r()}catch{r()}})()}else r()}),o}const Fa=ft((t,n)=>n.v1.statuses.$select(t).fetch());async function hs(t,n){const s=await Sa();if(!s.length)return;const{statusFollowedTags:i}=$,o=[];if(t.forEach(a=>{var f;if(a.reblog)return;const{id:h,content:u,tags:r=[]}=a,d=Xe(h,n);if((f=i[d])!=null&&f.length)return;const p=Ia(u);if(!p.length&&!r.length)return;const c=s.reduce((l,g)=>((p.some(m=>m.toLowerCase()===g.name.toLowerCase())||r.some(m=>m.name.toLowerCase()===g.name.toLowerCase()))&&l.push(g.name),l),[]);c.length&&o.push({item:a,sKey:d,followedTags:c})}),o.length){const a=o.map(u=>u.item.account),h=await Nn(a);if(!h)return;o.forEach(u=>{const{item:r,sKey:d,followedTags:p}=u,c=h[r.account.id];c&&!c.following&&(i[d]=p)})}}function za(){$.statusFollowedTags={}}function Ba({scrollableRef:t,distanceFromStart:n=1,distanceFromEnd:s=1,scrollThresholdStart:i=10,scrollThresholdEnd:o=10,direction:a="vertical",distanceFromStartPx:h,distanceFromEndPx:u}={}){const[r,d]=A(null),[p,c]=A(!1),[f,l]=A(!1),[g,m]=A(!1),[k,b]=A(!1),y=a==="vertical";return ut(()=>{const T=t.current;if(!T)return{};let w=y?T.scrollTop:T.scrollLeft;function S(){const{scrollTop:I,scrollLeft:x,scrollHeight:U,scrollWidth:M,clientHeight:N,clientWidth:te}=T,J=y?I:x,L=y?U:M,P=y?N:te,F=Math.abs(J-w),z=h||Math.min(P*n,L,J),j=u||Math.min(P*s,L,L-J-P);F>=(w<J?o:i)&&(d(w<J?"end":"start"),w=J),c(J<=0),l(J+P>=L),m(J<=z),b(J+P>=L-j)}return T.addEventListener("scroll",S,{passive:!0}),()=>T.removeEventListener("scroll",S)},[n,s,i,o]),{scrollDirection:r,reachStart:p,reachEnd:f,nearReachStart:g,nearReachEnd:k,init:()=>{t.current&&t.current.dispatchEvent(new Event("scroll"))}}}function Ha({scrollableRef:t,distanceFromStart:n=1,distanceFromEnd:s=1,scrollThresholdStart:i=10,scrollThresholdEnd:o=10,direction:a="vertical",distanceFromStartPx:h,distanceFromEndPx:u,init:r}={},d,p){if(!d)return;const c=a==="vertical",f=q(null),l=q(null),g=Zs(()=>{let m=!1,k=!1,b=!1,y=!1;const T=t.current,{scrollTop:w,scrollLeft:S,scrollHeight:I,scrollWidth:x,clientHeight:U,clientWidth:M}=T,N=c?w:S,te=c?I:x,J=c?U:M,L=Math.abs(N-f.current),P=h||Math.min(J*n,te,N),F=u||Math.min(J*s,te,te-N-J);L>=(f.current<N?o:i)&&(l.current=f.current<N?"end":"start",f.current=N),m=N<=0,k=N+J>=te,b=N<=P,y=N+J>=te-F,d({scrollDirection:l.current,reachStart:m,reachEnd:k,nearReachStart:b,nearReachEnd:y})},500);ut(()=>{const m=t.current;return m?(f.current=m[c?"scrollTop":"scrollLeft"],m.addEventListener("scroll",g,{passive:!0}),()=>m.removeEventListener("scroll",g)):{}},[n,s,i,o,...p]),Z(()=>{r&&t.current&&queueMicrotask(()=>{t.current.dispatchEvent(new Event("scroll"))})},[r])}function qa({class:t,statusID:n,status:s,instance:i,parent:o,onMediaClick:a}){let h=Xe(n,i);const u=Ne($);if(s||(s=u.statuses[h]||u.statuses[n],h=Xe(s==null?void 0:s.id,i)),!s)return null;const{account:{acct:r,avatar:d,avatarStatic:p,id:c,url:f,displayName:l,username:g,emojis:m,bot:k,group:b},id:y,repliesCount:T,reblogged:w,reblogsCount:S,favourited:I,favouritesCount:x,bookmarked:U,poll:M,muted:N,sensitive:te,spoilerText:J,visibility:L,language:P,editedAt:F,filtered:z,card:j,createdAt:V,inReplyToId:D,inReplyToAccountId:se,content:G,mentions:de,mediaAttachments:he,reblog:le,uri:ge,url:Te,emojis:Se,_deleted:Pe,_pinned:Re}=s;if(!(he!=null&&he.length))return null;const Ae=W=>{W.shiftKey},Ie=me(()=>dt(),[]),xe=me(()=>Ie&&Ie===c,[c,Ie]),ve=Ps(ji),ee=!xe&&Vt(z,ve);if((ee==null?void 0:ee.action)==="hide")return null;const be=te,K=me(()=>(we.account.get("preferences")||{})["reading:expand:media"]||"default",[])==="show_all",E=o||"div";return he.map((W,_)=>{const B=`${h}-${W.id}`,Q=ee==null?void 0:ee.titlesStr;return e(E,{"data-state-post-id":h,onMouseEnter:Ae,"data-spoiler-text":J||(te?"Sensitive media":void 0),"data-filtered-text":ee?`Filtered${Q?`: ${Q}`:""}`:void 0,class:`
media-post
${ee?"filtered":""}
${be?"has-spoiler":""}
${K?"show-media":""}
`,children:e(Gi,{class:t,media:W,lang:P,to:`/${i}/s/${y}?media-only=${_+1}`,onClick:a?ue=>a(ue,_,W,s):void 0})},B)})}const ki=Je(qa);function Va(t){var S,I,x,U,M;const n=Ne($),{masto:s,instance:i,authenticated:o}=ie(),[a,h]=me(()=>{const N=we.local.getJSON("accounts")||[];return[N.find(J=>J.info.id===dt())||N[0],N.length>1]},[]),u=(n.settings.shortcutsViewMode==="multi-column"||!n.settings.shortcutsViewMode&&n.settings.shortcutsColumnsMode)&&!n.shortcuts.find(N=>N.type==="following"),r=Js(()=>{$.showAccounts=!0},{threshold:600,detect:"touch",cancelOnMovement:!0}),d=q(),[p,c]=A(void 0),f=Qs([0,0,n.settings.shortcutsViewMode==="tab-menu-bar"?50:0,0]),l=q();async function g(N){return(N||!l.current)&&(l.current=s.v1.mutes.list({limit:80})),await l.current.next()}const m=q();async function k(N){return(N||!m.current)&&(m.current=s.v1.blocks.list({limit:80})),await m.current.next()}const b=Ve("@mastodon/lists"),[y,T]=A([]);Z(()=>{b&&p==="open"&&Yt().then(T)},[p==="open"]);const w=q();return e(R,{children:[e("button",{ref:d,type:"button",class:`button plain nav-menu-button ${h?"with-avatar":""} ${p==="open"?"active":""}`,style:{position:"relative"},onClick:()=>{w.current=Date.now(),c(N=>N?void 0:"open")},onContextMenu:N=>{N.preventDefault(),$.showAccounts=!0},...r(),children:[h&&e(nt,{url:((S=a==null?void 0:a.info)==null?void 0:S.avatar)||((I=a==null?void 0:a.info)==null?void 0:I.avatarStatic),size:"l",squircle:(x=a==null?void 0:a.info)==null?void 0:x.bot}),e(v,{icon:"menu",size:h?"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:f,unmountOnClose:!0,children:[!!((U=n.appVersion)!=null&&U.commitHash)&&n.appVersion.commitHash!=="81e330d"&&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(Be,{})]}),e("section",{children:[e(Ee,{to:"/",children:[e(v,{icon:"home",size:"l"})," ",e("span",{children:"Home"})]}),o?e(R,{children:[u&&e(Ee,{to:"/following",children:[e(v,{icon:"following",size:"l"})," ",e("span",{children:"Following"})]}),e(Ee,{to:"/catchup",children:[e(v,{icon:"history2",size:"l"}),e("span",{children:"Catch-up"})]}),Ve("@mastodon/mentions")&&e(Ee,{to:"/mentions",children:[e(v,{icon:"at",size:"l"})," ",e("span",{children:"Mentions"})]}),e(Ee,{to:"/notifications",children:[e(v,{icon:"notification",size:"l"})," ",e("span",{children:"Notifications"}),n.notificationsShowNew&&e("sup",{title:"New",style:{opacity:.5},children:[" ","•"]})]}),e(Be,{}),((M=a==null?void 0:a.info)==null?void 0:M.id)&&e(Ee,{to:`/${i}/a/${a.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(R,{children:[e(v,{icon:"list",size:"l"}),e("span",{class:"menu-grow",children:"Lists"}),e(v,{icon:"chevron-right"})]}),children:[e(Ee,{to:"/l",children:e("span",{children:"All Lists"})}),(y==null?void 0:y.length)>0&&e(R,{children:[e(Be,{}),y.map(N=>e(Ee,{to:`/l/${N.id}`,children:e("span",{children:N.title})},N.id))]})]}):b&&e(Ee,{to:"/l",children:[e(v,{icon:"list",size:"l"}),e("span",{children:"Lists"})]}),e(Ee,{to:"/b",children:[e(v,{icon:"bookmark",size:"l"})," ",e("span",{children:"Bookmarks"})]}),e(cn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(R,{children:[e(v,{icon:"more",size:"l"}),e("span",{class:"menu-grow",children:"More…"}),e(v,{icon:"chevron-right"})]}),children:[e(Ee,{to:"/f",children:[e(v,{icon:"heart",size:"l"})," ",e("span",{children:"Likes"})]}),e(Ee,{to:"/fh",children:[e(v,{icon:"hashtag",size:"l"})," ",e("span",{children:"Followed Hashtags"})]}),e(Be,{}),Ve("@mastodon/filters")&&e(Ee,{to:"/ft",children:[e(v,{icon:"filters",size:"l"}),"Filters"]}),e(pe,{onClick:()=>{$.showGenericAccounts={id:"mute",heading:"Muted users",fetchAccounts:g,excludeRelationshipAttrs:["muting"]}},children:[e(v,{icon:"mute",size:"l"})," Muted users…"]}),e(pe,{onClick:()=>{$.showGenericAccounts={id:"block",heading:"Blocked users",fetchAccounts:k,excludeRelationshipAttrs:["blocking"]}},children:[e(v,{icon:"block",size:"l"}),"Blocked users…"]})," "]}),e(Be,{}),e(pe,{onClick:()=>{$.showAccounts=!0},children:[e(v,{icon:"group",size:"l"})," ",e("span",{children:"Accounts…"})]})]}):e(R,{children:[e(Be,{}),e(Ee,{to:"/login",children:[e(v,{icon:"user",size:"l"})," ",e("span",{children:"Log in"})]})]})]}),e("section",{children:[e(Be,{}),e(Ee,{to:"/search",children:[e(v,{icon:"search",size:"l"})," ",e("span",{children:"Search"})]}),e(Ee,{to:`/${i}/trending`,children:[e(v,{icon:"chart",size:"l"})," ",e("span",{children:"Trending"})]}),e(Ee,{to:`/${i}/p/l`,children:[e(v,{icon:"building",size:"l"})," ",e("span",{children:"Local"})]}),e(Ee,{to:`/${i}/p`,children:[e(v,{icon:"earth",size:"l"})," ",e("span",{children:"Federated"})]}),o?e(R,{children:[e(Be,{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(R,{children:[e(Be,{}),e(pe,{onClick:()=>{$.showSettings=!0},children:[e(v,{icon:"gear",size:"l"})," ",e("span",{children:"Settings…"})]})]})]})]})]})}const Tt=Je(Va),Xt={block:"nearest",inline:"center",behavior:"smooth"};function pt({title:t,titleComponent:n,id:s,instance:i,emptyText:o,errorText:a,useItemID:h,boostsCarousel:u,fetchItems:r=()=>{},checkForUpdates:d=()=>{},checkForUpdatesInterval:p=15e3,headerStart:c,headerEnd:f,timelineStart:l,refresh:g,view:m,filterContext:k,showFollowedTags:b,showReplyParent:y,clearWhenRefresh:T}){const w=Ne($),[S,I]=A([]),[x,U]=A("start"),[M,N]=A(!1),[te,J]=A(!1),[L,P]=A(!0),F=q(),z=me(()=>En(),[]),j=m!=="media",V=q(0),D=eo(ee=>{J(!1),U("loading"),(async()=>{try{const be=V.current=Date.now();let{done:ae,value:K}=await r(ee);if(be!==V.current)return;if(Array.isArray(K)){const[E,W]=K.reduce((_,B)=>(B._pinned?_[0].push(B):_[1].push(B),_),[[],[]]);K=W,j&&(u&&(K=Ua(K)),K=Oa(K,i)),E.length&&(K=E.concat(K)),I(ee?K:_=>[..._,...K]),K.length||(ae=!0),N(!ae)}else N(!1);U("default")}catch{U("error")}finally{D.cancel()}})()},1e3,{leading:!0}),se=".timeline-item, .timeline-item-alt",G=Le("j, shift+j",(ee,be)=>{const ae=document.activeElement.closest(se),K=ae==null?void 0:ae.getBoundingClientRect(),E=Array.from(F.current.querySelectorAll(se));if(ae&&K.top<F.current.clientHeight&&K.bottom>0){const W=E.indexOf(ae);let _=E[W+1];be.shift&&(_=E.find((B,Q)=>Q>W&&!B.classList.contains("timeline-item-alt"))),_&&(_.focus(),_.scrollIntoView(Xt))}else{const W=E.find(_=>{const B=_.getBoundingClientRect();return B.top>=44&&B.left>=0});W&&(W.focus(),W.scrollIntoView(Xt))}}),de=Le("k, shift+k",(ee,be)=>{const ae=document.activeElement.closest(se),K=ae==null?void 0:ae.getBoundingClientRect(),E=Array.from(F.current.querySelectorAll(se));if(ae&&K.top<F.current.clientHeight&&K.bottom>0){const W=E.indexOf(ae);let _=E[W-1];be.shift&&(_=E.findLast((B,Q)=>Q<W&&!B.classList.contains("timeline-item-alt"))),_&&(_.focus(),_.scrollIntoView(Xt))}else{const W=E.find(_=>{const B=_.getBoundingClientRect();return B.top>=44&&B.left>=0});W&&(W.focus(),W.scrollIntoView(Xt))}}),he=Le(["enter","o"],()=>{const ee=document.activeElement;ee!=null&&ee.matches(se)&&ee.click()}),le=S.length>0&&x!=="loading"&&te,ge=et(()=>{var ee;le&&D(!0),(ee=F.current)==null||ee.scrollTo({top:0,behavior:"smooth"})},[D,le]),Te=Le(".",ge),Se=q(),[Pe,Re]=A(!1);Ha({scrollableRef:F,distanceFromEnd:2,scrollThresholdStart:44},({scrollDirection:ee,nearReachStart:be,reachStart:ae})=>{if(Se.current){const K=ee==="end"&&!be;Se.current.hidden=K}Re(be),ae&&D(!0)},[]),Z(()=>{var ee;(ee=F.current)==null||ee.scrollTo({top:0}),D(!0)},[]);const Ae=q(!0);Z(()=>{var ee;if(Ae.current){Ae.current=!1;return}T&&(S!=null&&S.length)&&((ee=D.cancel)==null||ee.call(D),I([])),D(!0)},[T,g]);const Ie=q(m);Z(()=>{Ie.current!==m&&(Ie.current=m,I([]))},[m]);const xe=et(async({disableIdleCheck:ee=!1}={})=>{const be=F.current?getComputedStyle(F.current).pointerEvents==="none":!1;w.settings.autoRefresh&&F.current.scrollTop<16&&(ee||window.__IDLE__)&&!Wa()&&!be?D(!0):await d()&&J(!0)},[s,D,d,w.settings.autoRefresh]),ve=q();return Lt(ee=>{if(ee){const be=Date.now()-ve.current;(!ve.current||be>1e3*3)&&xe({disableIdleCheck:!0})}else ve.current=Date.now();P(ee)},[d,xe,w.settings.autoRefresh]),Mn(xe,L&&!te?p*(Pe?1:2):null),e(ji.Provider,{value:k,children:e("div",{id:`${s}-page`,class:`deck-container ${z?"deck-container-media-first":""}`,ref:ee=>{F.current=ee,G.current=ee,de.current=ee,he.current=ee,Te.current=ee},tabIndex:"-1",onClick:ee=>{Se.current&&ee.target.closest(".timeline-item, .timeline-item-alt")&&setTimeout(()=>{Se.current.hidden=!1},250)},children:e("div",{class:"timeline-deck deck",children:[e("header",{ref:Se,onClick:ee=>{var be;ee.target.closest("a, button")||(be=F.current)==null||be.scrollTo({top:0,behavior:"smooth"})},onDblClick:ee=>{ee.target.closest("a, button")||D(!0)},class:x==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Tt,{}),c??e(re,{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:!!f&&f})]}),le&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:ge,children:[e(v,{icon:"arrow-up"})," New posts"]})]}),!!l&&e("div",{class:`timeline-start ${x==="loading"?"loading":""}`,children:l}),S.length?e(R,{children:[e("ul",{class:`timeline ${m?`timeline-${m}`:""}`,children:[S.map(ee=>e(Ga,{status:ee,instance:i,useItemID:h,filterContext:k,view:m,showFollowedTags:b,showReplyParent:y,mediaFirst:z},ee.id+(ee==null?void 0:ee._pinned)+m)),M&&x==="loading"&&(m==="media"?null:e(R,{children:[e("li",{style:{height:"20vh"},children:e(Ue,{skeleton:!0,mediaFirst:z})}),e("li",{style:{height:"25vh"},children:e(Ue,{skeleton:!0,mediaFirst:z})})]}))]}),x==="default"&&(M?e(ht,{root:F.current,rootMargin:`0px 0px ${screen.height*1.5}px 0px`,onChange:ee=>{ee&&D()},children:e("button",{type:"button",class:"plain block",onClick:()=>D(),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((ee,be)=>m==="media"?e("div",{style:{height:"50vh"}}):e("li",{children:e(Ue,{skeleton:!0,mediaFirst:z})},be))}):x!=="error"&&x!=="start"&&e("p",{class:"ui-state",children:o}),x==="error"&&e("p",{class:"ui-state",children:[a,e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>D(!S.length),children:"Try again"})]})]})})})}const Ga=Je(({status:t,instance:n,useItemID:s,filterContext:i,view:o,showFollowedTags:a,showReplyParent:h,mediaFirst:u})=>{const{id:r,reblog:d,items:p,type:c,_pinned:f}=t;f&&(s=!1);const l=(d==null?void 0:d.id)||r,g=n?`/${n}/s/${l}`:`/s/${l}`;if(p){let k=wt(p,i),b="";if(c==="boosts"?b=`${k.length} Boosts`:c==="pinned"&&(b="Pinned posts"),c==="boosts"||c==="pinned"){const w=new Set;if(k.sort((S,I)=>{const x=Vt(S.filtered,i),U=Vt(I.filtered,i);return x&&w.add(S.id),U&&w.add(I.id),x&&!U?1:!x&&U?-1:0}),w.size>=2){const I=[],x=[];k.forEach(M=>{w.has(M.id)?x.push(M):I.push(M)});const U=[];for(let M=0;M<x.length;M+=5)U.push({_grouped:!0,posts:x.slice(M,M+5)});k=I.concat(U)}return e("li",{class:"timeline-item-carousel",children:e(ja,{title:b,class:`${c}-carousel`,children:k.map(S=>{const{id:I,reblog:x,_pinned:U,_grouped:M}=S;if(M)return e("li",{class:"timeline-item-carousel-group",children:S.posts.map(J=>{const{id:L,reblog:P,_pinned:F}=J,z=(P==null?void 0:P.id)||L,j=n?`/${n}/s/${z}`:`/s/${z}`;return F&&(s=!1),e(re,{class:"status-carousel-link timeline-item-alt",to:j,children:s?e(Ue,{statusID:L,instance:n,size:"s"}):e(Ue,{status:J,instance:n,size:"s"})})})},I);const N=(x==null?void 0:x.id)||I,te=n?`/${n}/s/${N}`:`/s/${N}`;return U&&(s=!1),e("li",{children:e(re,{class:"status-carousel-link timeline-item-alt",to:te,children:s?e(Ue,{statusID:I,instance:n,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:u}):e(Ue,{status:S,instance:n,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:u})})},I)})})},`timeline-${r}`)}const T=k.length>3;return k.map((w,S)=>{const{id:I,_differentAuthor:x}=w,U=n?`/${n}/s/${I}`:`/s/${I}`,M=S>0&&S<k.length-1,N=w.sensitive&&!!w.spoilerText,te=!x&&N&&S>0||T&&M&&(c==="thread"||c==="conversation"&&!x&&!k[S-1]._differentAuthor&&!k[S+1]._differentAuthor),J=S===0,L=S===k.length-1;return e("li",{class:`timeline-item-container timeline-item-container-type-${c} timeline-item-container-${J?"start":L?"end":"middle"} ${x?"timeline-item-diff-author":""}`,children:e(re,{class:"status-link timeline-item",to:U,children:te?e(Ya,{status:w,instance:n,filterContext:i}):s?e(Ue,{statusID:I,instance:n,enableCommentHint:L,showFollowedTags:a}):e(Ue,{status:w,instance:n,enableCommentHint:L,showFollowedTags:a})})},`timeline-${I}`)})}const m=`timeline-${r+f}`;return o==="media"?s?e(ki,{class:"timeline-item",parent:"li",statusID:r,instance:n},m):e(ki,{class:"timeline-item",parent:"li",status:t,instance:n},m):e("li",{children:e(re,{class:"status-link timeline-item",to:g,children:s?e(Ue,{statusID:r,instance:n,enableCommentHint:!0,showFollowedTags:a,showReplyParent:h,mediaFirst:u}):e(Ue,{status:t,instance:n,enableCommentHint:!0,showFollowedTags:a,showReplyParent:h,mediaFirst:u})})},m)},(t,n)=>{var o,a;const s=(((o=t.status)==null?void 0:o.id)||"").toString(),i=(((a=n.status)==null?void 0:a.id)||"").toString();return s===i&&t.instance===n.instance&&t.view===n.view});function ja({title:t,class:n,children:s}){const i=q(),o=q(),a=q(),[h,u]=A(!1);return Z(()=>{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 r,d;(d=i.current)==null||d.scrollBy({left:-Math.min(320,(r=i.current)==null?void 0:r.offsetWidth),behavior:"smooth"})},children:e(v,{icon:"chevron-left"})})," ",e("button",{ref:a,type:"button",class:"small plain2",onClick:()=>{var r,d;(d=i.current)==null||d.scrollBy({left:Math.min(320,(r=i.current)==null?void 0:r.offsetWidth),behavior:"smooth"})},children:e(v,{icon:"chevron-right"})})]})]}),e("ul",{ref:i,children:[e(ht,{class:"status-carousel-beacon",onChange:r=>{o.current&&(o.current.disabled=r)}}),s[0],h&&s.slice(1),e(ht,{class:"status-carousel-beacon",onChange:r=>{a.current&&(a.current.disabled=r)}})]})]})}function Ya({status:t,instance:n,filterContext:s}){const i=Ne($),{id:o,visibility:a,language:h}=t,u=Pn(t),r=Xe(o,n),d=Vt(t.filtered,s);return e("article",{class:`status compact-thread ${a==="direct"?"visibility-direct":""}`,tabindex:"-1",children:[i.statusThreadNumber[r]?e("div",{class:"status-thread-badge",children:[e(v,{icon:"thread",size:"s"}),i.statusThreadNumber[r]?` ${i.statusThreadNumber[r]}/X`:""]}):e("div",{class:"status-thread-badge",children:e(v,{icon:"thread",size:"s"})}),e("div",{class:"content-compact",title:u,lang:h,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(R,{children:[u,t.sensitive&&t.spoilerText&&e(R,{children:[" ",e("span",{class:"spoiler-badge",children:e(v,{icon:"eye-close",size:"s"})})]})]})})]})}function Wa(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}const At=20,Wn=1983,Si=`${Wn}-01`,Ka=(()=>{try{const t=document.createElement("input");return t.setAttribute("type","month"),t.type==="month"}catch{return!1}})();async function Xa(t){var i;const{masto:n}=ie({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 Za=ft(Xa);function Ja(){const t=Ne($),{id:n,...s}=St(),[i,o]=ot(),a=i.get("month"),h=!i.get("replies"),u=!!i.get("boosts"),r=i.get("tagged"),d=!!i.get("media"),{masto:p,instance:c,authenticated:f}=ie({instance:s.instance}),{masto:l,instance:g}=ie(),m=q(),k=[a,h,u,r,d],[b,y]=A(),T=q(0);Z(()=>{T.current=0},k);const w=me(()=>En(),[]),S=me(()=>c===g,[c,g]),[I,x]=A(!1);Z(()=>{S&&b!=null&&b.acct&&(async()=>{const G=await Za(c);x(G)})()},[c,S,b==null?void 0:b.acct]);async function U(G){var Se,Pe,Re,Ae;const de=/^\d{4}-[01]\d$/.test(a),he=((Pe=(Se=a==null?void 0:a.split)==null?void 0:Se.call(a,"-"))==null?void 0:Pe[0])>=Wn;if(de&&he){if(!b)return{value:[],done:!0};const[Ie,xe]=a.split("-"),ve=parseInt(xe,10)-1,ee=new Date(Ie,ve,0),be=`${ee.getFullYear()}-${(ee.getMonth()+1).toString().padStart(2,"0")}-${ee.getDate().toString().padStart(2,"0")}`,ae=new Date(Ie,ve+1,1),K=`${ae.getFullYear()}-${(ae.getMonth()+1).toString().padStart(2,"0")}-${ae.getDate().toString().padStart(2,"0")}`;let E;G?(E=At+1,T.current=0):(E=At+T.current+1,T.current+=At);const W=await p.v2.search.fetch({q:`from:${b.acct} after:${be} before:${K}`,type:"statuses",limit:E,offset:T.current});if((Re=W==null?void 0:W.statuses)!=null&&Re.length){const _=W.statuses.slice(0,At);_.forEach(Q=>{He(Q,c)});const B=W.statuses.length<=At;return{value:_,done:B}}else return{value:[],done:!0}}let le=[];if(G){const{value:Ie}=await p.v1.accounts.$select(n).statuses.list({pinned:!0}).next();if(Ie!=null&&Ie.length&&!r&&!d){const xe=Ie.map(ve=>(He(ve,c),{...ve,_pinned:!0}));if(xe.length>=3){const ve=xe.map(ee=>ee.id);le.push({id:ve,items:xe,type:"pinned"})}else le.push(...xe)}}(G||!m.current)&&(m.current=p.v1.accounts.$select(n).statuses.list({limit:At,exclude_replies:h,exclude_reblogs:u,only_media:d||void 0,tagged:r}));const{value:ge,done:Te}=await m.current.next();if(ge!=null&&ge.length){if(le.length){let Ie=[];((Ae=le[0])==null?void 0:Ae.type)==="pinned"?Ie=le[0].id:Ie=le.filter(ve=>ve._pinned).map(ve=>ve.id),Ie.every(ve=>ge.some(ee=>ee.id===ve))&&(le=[])}le.push(...ge),ge.forEach(Ie=>{He(Ie,c)})}return{value:le,done:Te}}const[M,N]=A([]);qe(b!=null&&b.acct?`${b!=null&&b.displayName?`${b.displayName} (${/@/.test(b.acct)?"":"@"}${b.acct})`:`${/@/.test(b.acct)?"":"@"}${b.acct}`}${h?u?" (- Boosts)":r?` (#${r})`:d?" (Media)":a?` (${new Date(a).toLocaleString("default",{month:"long",year:"numeric"})})`:"":" (+ Replies)"}`:"Account posts","/:instance?/a/:id");const te=q(),J=et(()=>{const G=te.current||p.v1.accounts.$select(n).fetch();return te.current=G,G},[n,p]);Z(()=>{(async()=>{try{const G=await J();y(G)}catch{}if(!w)try{const G=await p.v1.accounts.$select(n).featuredTags.list();N(G)}catch{}})()},[n,w]);const{displayName:L,acct:P,emojis:F}=b||{},z=q(),j=me(()=>{const G=!h||u||r||d||!!a,de=t.accounts[`${n}@${c}`];return e(R,{children:[e(cs,{instance:c,account:de||n,fetchAccount:J,authenticated:f,standalone:!0}),!w&&e("div",{class:"filter-bar",ref:z,style:{position:"relative"},children:[G?e(re,{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(re,{to:`/${c}/a/${n}${h?"?replies=1":""}`,onClick:()=>{h&&oe("Showing post with replies")},class:h?"":"is-active",children:"+ Replies"}),e(re,{to:`/${c}/a/${n}${u?"":"?boosts=0"}`,onClick:()=>{u||oe("Showing posts without boosts")},class:u?"is-active":"",children:"- Boosts"}),e(re,{to:`/${c}/a/${n}${d?"":"?media=1"}`,onClick:()=>{d||oe("Showing posts with media")},class:d?"is-active":"",children:"Media"}),M.map(he=>e(re,{to:`/${c}/a/${n}${r===he.name?"":`?tagged=${encodeURIComponent(he.name)}`}`,onClick:()=>{r!==he.name&&oe(`Showing posts tagged with #${he.name}`)},class:r===he.name?"is-active":"",children:e("span",{children:[e("span",{class:"more-insignificant",children:"#"}),he.name]})},he.id)),I&&(Ka?e("label",{class:`filter-field ${a?"is-active":""}`,children:[e(v,{icon:"month",size:"l"}),e("input",{type:"month",disabled:!(b!=null&&b.acct),value:a||"",min:Si,max:new Date().toISOString().slice(0,7),onInput:he=>{const{value:le,validity:ge}=he.currentTarget;if(!ge.valid)return;o(le?{month:le}:{});const[Te,Se]=le.split("-"),Pe=parseInt(Se,10)-1,Re=new Date(Te,Pe);oe(`Showing posts in ${Re.toLocaleString("default",{month:"long",year:"numeric"})}`)}})]}):e(Qa,{class:`filter-field ${a?"is-active":""}`,disabled:!(b!=null&&b.acct),value:a||"",min:Si,max:new Date().toISOString().slice(0,7),onInput:he=>{const{value:le,validity:ge}=he;ge.valid&&o(le?{month:le}:{})}}))]})]})},[n,c,f,M,J,I,...k]);Z(()=>{var de;const G=(de=z.current)==null?void 0:de.querySelector(".is-active");G&&z.current.scrollTo({behavior:"smooth",left:G.offsetLeft-(z.current.offsetWidth-G.offsetWidth)/2})},[M,I,...k]);const V=me(()=>b!=null&&b.url?URL.parse(b.url).hostname:null,[b]),se=!!b&&!(c===V);return e(pt,{title:`${b!=null&&b.acct?"@"+b.acct:"Posts"}`,titleComponent:e("h1",{class:"header-double-lines header-account",children:[e("b",{children:e(qi,{text:L,emojis:F})}),e("div",{children:e("span",{children:["@",P]})})]}),id:"account-statuses",instance:c,emptyText:"Nothing to see here yet.",errorText:"Unable to load posts",fetchItems:U,useItemID:!0,view:d||w?"media":void 0,boostsCarousel:t.settings.boostsCarousel,timelineStart:j,refresh:[h,u,r,d,a+(b==null?void 0:b.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:!se,onClick:()=>{(async()=>{try{const{masto:G}=ie({instance:V}),de=await G.v1.accounts.lookup({acct:b.acct}),{id:he}=de;location.hash=`/${V}/a/${he}`}catch{alert("Unable to fetch account info")}})()},children:[e(v,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:["Switch to account's instance"," ",V?e(R,{children:[" ","(",e("b",{children:Ut.toUnicode(V)}),")"]}):null]})]}),!S&&e(pe,{onClick:()=>{(async()=>{try{const G=await l.v1.accounts.lookup({acct:b.acct+"@"+c}),{id:de}=G;location.hash=`/${g}/a/${de}`}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:g}),")"]})]})]})},n)}function Qa(t){const{class:n,disabled:s,value:i,min:o,max:a,onInput:h=()=>{}}=t,[u,r]=(i==null?void 0:i.split("-"))||[],d=q(),p=q(),c=(f,l)=>{const[g,m]=(o==null?void 0:o.split("-"))||[],[k,b]=(a==null?void 0:a.split("-"))||[];return!(l<g||l>k||l===g&&f<m||l===k&&f>b)};return e("div",{class:n,children:[e(v,{icon:"month",size:"l"}),e("select",{ref:d,disabled:s,value:r||"",onInput:f=>{const{value:l}=f.currentTarget,g=p.current.value;if(!c(l,g))return{value:"",validity:{valid:!1}};h({value:l?`${g}-${l}`:"",validity:{valid:!0}})},children:[e("option",{value:"",children:"Month"}),e("option",{disabled:!0,children:"-----"}),Array.from({length:12},(f,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:(a==null?void 0:a.slice(0,4))||new Date().getFullYear(),onInput:f=>{const{value:l,validity:g}=f.currentTarget,m=d.current.value;if(!g.valid||!c(m,l))return{value:"",validity:{valid:!1}};h({value:l?`${l}-${m}`:"",validity:{valid:!0}})},style:{width:"4.5em"}})]})}const er=20;function fs(){qe("Bookmarks","/b");const{masto:t,instance:n}=ie(),s=q();async function i(o){return(o||!s.current)&&(s.current=t.v1.bookmarks.list({limit:er})),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 tr=""+new URL("catch-up-DuauQu-W.png",import.meta.url).href,nr="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}],ir=["Original","Replies","Boosts","Followed tags","Groups","Filtered"],sr=["createdAt","repliesCount","favouritesCount","reblogsCount","density"],or=[null,"account"],Ii={Filtered:"filtered",Groups:"group",Boosts:"boost",Replies:"reply","Followed tags":"followedTags",Original:"original"},ar={Filtered:"filtered posts",Groups:"group posts",Boosts:"boosts",Replies:"replies","Followed tags":"followed-tag posts",Original:"original posts"},rr={createdAt:["oldest","latest"],repliesCount:["fewest replies","most replies"],favouritesCount:["fewest likes","most likes"],reblogsCount:["fewest boosts","most boosts"],density:["least dense","most dense"]};function cr(){qe("Catch-up","/catchup");const{masto:t,instance:n}=ie(),[s,i]=ot(),o=s.get("id"),[a,h]=A("start"),[u,r]=A(!1),d=me(()=>dt(),[]),p=C=>C===d,c=Ve("@pixelfed/home-include-reblogs");async function f({maxCreatedAt:C}){var ne,ye,fe;const O=C?new Date(C):null,Y=[],H=t.v1.timelines.home.list({limit:40});e:for(;;)try{c&&H.nextParams&&(typeof H.nextParams=="string"?H.nextParams+="&include_reblogs=true":H.nextParams.include_reblogs=!0);const ce=await H.next(),{value:Ce}=ce;if(Ce!=null&&Ce.length){await hs(Ce,n);let Oe=!1;for(let ze=0;ze<Ce.length;ze++){const Me=Ce[ze],Ge=new Date(Me.createdAt);if(!O||Ge>=O){const ke=!p(((ye=(ne=Me.reblog)==null?void 0:ne.account)==null?void 0:ye.id)||Me.account.id)&&Vt(((fe=Me.reblog)==null?void 0:fe.filtered)||Me.filtered,nr);if((ke==null?void 0:ke.action)==="hide")continue;Me._filtered=ke;const it=Xe(Me.id,n);Me._followedTags=$.statusFollowedTags[it]?[...$.statusFollowedTags[it]]:[],Y.push(Me),Oe=!0}if(!Oe)break e}}else break e;await new Promise(Oe=>setTimeout(Oe,1e3))}catch{break e}return Y.forEach(ce=>{if(ce!=null&&ce.inReplyToId){const Ce=Y.find(Oe=>Oe.id===ce.inReplyToId);Ce&&!Ce.inReplyToId&&(Ce._thread=!0)}}),Y}const[l,g]=A([]),m=q(),k=q(),b=me(()=>rn(),[]),y=et(async({duration:C}={})=>{const O=Date.now(),Y=C?O-C:null;h("loading");const H=await f({maxCreatedAt:Y}),ne=`${b}-${to()}`;try{await st.catchup.set(ne,{id:ne,posts:H,count:H.length,startAt:Y,endAt:O}),i({id:ne})}catch{}},[]);Z(()=>{o?(async()=>{const C=await st.catchup.get(o);C&&(C.posts.sort((O,Y)=>O.createdAt>Y.createdAt?1:-1),g(C.posts),h("results"))})():a==="results"&&(g([]),h("start"))},[o]);const[T,w]=kt(C=>C+1,0),[S,I]=A(null),[x,U]=A([]);Z(()=>{(async()=>{try{const C=await st.catchup.keys();if(C.length){const O=rn(),Y=C.filter(H=>H.startsWith(`${O}-`));if(Y.length){let H=await st.catchup.getMany(Y);H.sort((ce,Ce)=>Ce.endAt-ce.endAt);let ne=H.slice(0,3),ye=H.slice(3);const fe=ne.map(ce=>{const{id:Ce,count:Oe,startAt:ze,endAt:Me}=ce;return{id:Ce,count:Oe,startAt:ze,endAt:Me}});U(fe),I(ne[0].endAt),H=null,ne=null,queueMicrotask(()=>{ye.length&&st.catchup.delMany(ye.map(ce=>ce.id)).then(()=>{ye=null}).catch(ce=>{})});return}}}catch{}U([])})()},[T]),Z(()=>{a==="start"&&w()},[a==="start"]);const[M,N]=me(()=>{var Ce,Oe,ze,Me,Ge;let C=0,O=0,Y=0,H=0,ne=0,ye=0;const fe={};for(const X of l){X._filtered?(C++,X.__FILTER="filtered"):X.group?(O++,X.__FILTER="group"):X.reblog?(Y++,X.__FILTER="boost"):(Ce=X._followedTags)!=null&&Ce.length?(ne++,X.__FILTER="followedTags"):X.inReplyToId&&X.inReplyToAccountId!==((Oe=X.account)==null?void 0:Oe.id)?(H++,X.__FILTER="reply"):(ye++,X.__FILTER="original");const ke=X.reblog||X;if(X.__FILTER!=="filtered"&&((ze=ke.card)!=null&&ze.url)&&((Me=ke.card)!=null&&Me.image)&&((Ge=ke.card)==null?void 0:Ge.type)==="link"){const{card:it,favouritesCount:Wt,reblogsCount:bt}=ke;let{url:Ye}=it;if(Ye=Ye.replace(/\/$/,""),!fe[Ye])fe[Ye]={postID:ke.id,card:it,shared:1,sharers:[X.account],likes:Wt,boosts:bt};else{if(fe[Ye].sharers.find(xt=>xt.id===X.account.id))continue;fe[Ye].shared++,fe[Ye].sharers.push(X.account),fe[Ye].postID!==ke.id&&(fe[Ye].likes+=Wt,fe[Ye].boosts+=bt)}}}let ce=[];for(const X in fe)ce.push({url:X,...fe[X]});if(ce.sort((X,ke)=>X.shared>ke.shared?-1:X.shared<ke.shared?1:X.boosts>ke.boosts?-1:X.boosts<ke.boosts?1:X.likes>ke.likes?-1:X.likes<ke.likes?1:0),ce.length>10)e:for(let X=10;X<ce.length;X++){const{shared:ke}=ce[X];if(ke<=1){ce=ce.slice(0,X);break e}}return[{Filtered:C,Groups:O,Boosts:Y,Replies:H,"Followed tags":ne,Original:ye},ce]},[l]),[te,J]=A("All"),[L,P]=A(null),[F,z]=A(1),[j,V]=A("createdAt"),[D,se]=A("asc"),[G,de]=A(null),[he,le,ge]=me(()=>{const C={},O=new Map;let Y=l.filter(ne=>{const ye=te==="All"||ne.__FILTER===Ii[te];return ye&&(C[ne.account.id]=ne.account,O.set(ne.account.id,(O.get(ne.account.id)||0)+1)),ye});const H={};return Y.forEach(ne=>{ne.reblog&&(H[ne.reblog.id]?(H[ne.reblog.id].__BOOSTERS?H[ne.reblog.id].__BOOSTERS.add(ne.account):H[ne.reblog.id].__BOOSTERS=new Set([ne.account]),ne.__HIDDEN=!0):H[ne.reblog.id]=ne)}),L&&O.has(L)&&(Y=Y.filter(ne=>ne.account.id===L||[...ne.__BOOSTERS||[]].find(ye=>ye.id===L))),[Y,C,Object.fromEntries(O)]},[te,L,l]),Te=me(()=>{const C={};return he.forEach(O=>{C[O.id]=O}),C},[he]),Se=me(()=>Object.keys(ge).sort((C,O)=>ge[O]-ge[C]),[ge]),Pe=me(()=>{const C={};return Se.forEach((O,Y)=>{C[O]=Y}),he.filter(O=>!O.__HIDDEN).sort((O,Y)=>{if(G==="account"){const H=O.account.id,ne=Y.account.id,ye=C[H],fe=C[ne],ce=ye-fe;if(ce!==0)return ce}if(j!=="createdAt"&&(O=O.reblog||O,Y=Y.reblog||Y,j!=="density"&&O[j]===Y[j]))return O.createdAt>Y.createdAt?1:-1;if(j==="density"){const H=Ci(O),ne=Ci(Y);return D==="asc"?H>ne?1:-1:ne>H?1:-1}return D==="asc"?O[j]>Y[j]?1:-1:Y[j]>O[j]?1:-1})},[he,j,D,G,Se]),Re=q(null),Ae=q(null),Ie=q(!1);Z(()=>{l.length>100||Ie.current||Ae.current&&(ns(Ae.current,{duration:200}),Ie.current=!0)},[l,Ae]);const xe=l.length>160?"3d":"2d",ve=me(()=>xe!=="2d"?null:l.map(C=>{const O=Te[C.id];return e("span",{class:`post-dot ${O?"post-dot-highlight":""}`},C.id)}),[Te]),ee=me(()=>xe!=="3d"||!(l!=null&&l.length)?null:gr(l,"createdAt",320).map((O,Y)=>e("div",{class:"posts-bin",children:O.map(H=>{const ne=Te[H.id];return e("span",{class:`post-dot ${ne?"post-dot-highlight":""}`},H.id)})},Y)),[Te]),be=q(null),ae=me(()=>S?(Date.now()-S)/1e3/60/60:null,[S,F]);Z(()=>{if(a!=="results")return;const C=L&&le[L]?le[L].username:"",O=D==="asc"?0:1,Y={account:"authors"};let H=oe({duration:5e3,text:`Showing ${ar[te]||"all posts"}${C?` by @${C}`:""}, ${rr[j][O]} first${G?`, grouped by ${G==="account"?Y[G]:""}`:""}`});return()=>{var ne;(ne=H==null?void 0:H.hideToast)==null||ne.call(H)}},[a,te,L,j,D,G,le]),Z(()=>{var C;if(L&&le[L]){const O=Ae.current.querySelector(`[data-author="${L}"]`),Y=(C=Ae.current)==null?void 0:C.getBoundingClientRect(),H=O==null?void 0:O.getBoundingClientRect();H.left<Y.left||H.right>Y.right?O.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}):H.top<0&&O.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})}},[L,le]);const[K,E]=A(!1),W=".catchup-list > li > a",_=Le("j",()=>{const C=document.activeElement.closest(W),O=C==null?void 0:C.getBoundingClientRect(),Y=Array.from(be.current.querySelectorAll(W));if(C&&O.top<be.current.clientHeight&&O.bottom>0){const H=Y.indexOf(C),ne=Y[H+1];ne&&(ne.focus(),ne.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const H=Y.find(ne=>ne.getBoundingClientRect().top>=0);H&&(H.focus(),H.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{preventDefault:!0,ignoreModifiers:!0}),B=Le("k",()=>{const C=document.activeElement.closest(W),O=C==null?void 0:C.getBoundingClientRect(),Y=Array.from(be.current.querySelectorAll(W));if(C&&O.top<be.current.clientHeight&&O.bottom>0){const H=Y.indexOf(C);let ne=Y[H-1];ne&&(ne.focus(),ne.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const H=Y.find(ne=>{const ye=ne.getBoundingClientRect();return ye.top>=44&&ye.left>=0});H&&(H.focus(),H.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{preventDefault:!0,ignoreModifiers:!0}),Q=Le("h, l",(C,O)=>{var H,ne,ye;const Y=O.keys[0];if(L){const fe=Se.indexOf(L);Y==="h"?fe>0&&fe<Se.length&&(P(Se[fe-1]),(H=be.current)==null||H.focus()):Y==="l"&&fe<Se.length-1&&fe>=0&&(P(Se[fe+1]),(ne=be.current)==null||ne.focus())}else Y==="l"&&(P(Se[0]),(ye=be.current)==null||ye.focus())},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]}),ue=Le("esc",()=>{var C;P(null),(C=be.current)==null||C.focus()},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]}),De=Le(".",()=>{var C;(C=be.current)==null||C.scrollTo({top:0,behavior:"smooth"})},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]});return e("div",{ref:C=>{be.current=C,_.current=C,B.current=C,Q.current=C,ue.current=C},id:"catchup-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck wide",children:[e("header",{class:`${a==="loading"?"loading":""}`,onClick:C=>{var O;C.target.closest("a, button")||(O=be.current)==null||O.scrollTo({top:0,behavior:"smooth"})},children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Tt,{}),a==="results"&&e(re,{to:"/catchup",class:"button plain",children:e(v,{icon:"history2",size:"l"})}),a==="start"&&e(re,{to:"/",class:"button plain",children:e(v,{icon:"home",size:"l"})})]}),e("h1",{children:a!=="start"&&e(R,{children:["Catch-up ",e("sup",{children:"beta"})]})}),e("div",{class:"header-side",children:a!=="start"&&a!=="loading"&&e("button",{type:"button",class:"plain",onClick:()=>{E(!0)},children:"Help"})})]})}),e("main",{children:[a==="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:tr,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:F,min:Ke[0].value,max:Ke[Ke.length-1].value,step:"1",list:"catchup-ranges",onChange:C=>z(+C.target.value)})," ",e("span",{style:{width:"8em"},children:[Ke[F-1].label,e("br",{}),e("small",{class:"insignificant",children:F==Ke[Ke.length-1].value?"until the max":rt(new Date(Date.now()-F*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<Ke[Ke.length-1].value){let O;F===Ke[Ke.length-1].value&&((C=k.current)!=null&&C.checked)?O=Date.now()-S:O=F*60*60*1e3,y({duration:O})}else y()},children:"Catch up"})]}),ae&&F>ae?e("p",{class:"catchup-info",children:[e(v,{icon:"info"})," Overlaps with your last catch-up"]}):F===Ke[Ke.length-1].value&&S?e("p",{class:"catchup-info",children:e("label",{children:[e("input",{type:"checkbox",switch:!0,checked:!0,ref:k})," ","Until the last catch-up (",Zt.format(new Date(S)),")"]})}):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(re,{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 Y;if(confirm("Remove this catch-up?")){let H=oe(`Removing Catch-up ${C.id}`);await st.catchup.del(C.id),(Y=H==null?void 0:H.hideToast)==null||Y.call(H),oe(`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."})})]})]}),a==="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."})]}),a==="results"&&e(R,{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:te==="All"&&!L&&j==="createdAt"&&D==="asc",type:"button",class:"plain4 small",onClick:()=>{J("All"),P(null),V("createdAt"),de(null),se("asc")},children:"Reset filters"}),(N==null?void 0:N.length)>0&&e("button",{type:"button",class:"plain small",onClick:()=>r(!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:N.map(C=>{const{card:O,shared:Y,sharers:H,likes:ne,boosts:ye}=C,{blurhash:fe,title:ce,description:Ce,url:Oe,image:ze,imageDescription:Me,language:Ge,width:X,height:ke,publishedAt:it}=O,Wt=Ut.toUnicode(URL.parse(Oe).hostname.replace(/^www\./,"").replace(/\/$/,""));let bt;if(fe){const Ye=Dn(fe),xt=Gn(Ye);bt=jn([.6,xt[1],xt[2]])}return e("a",{href:Oe,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:ze,alt:Me,width:X,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})," ",!!it&&e(R,{children:"· "}),!!it&&e(R,{children:e(It,{datetime:it,format:"micro"})})]}),!!ce&&e("h1",{class:"title",lang:Ge,dir:"auto",title:ce,children:ce})]}),!!Ce&&e("p",{class:"description",lang:Ge,dir:"auto",title:Ce,children:Ce}),e("hr",{}),e("p",{style:{whiteSpace:"nowrap"},children:["Shared by"," ",H.map(Ye=>{const{avatarStatic:xt,displayName:_s}=Ye;return e(nt,{url:xt,size:"s",alt:_s})})]})]})]})},Oe)})})})}),l.length>=5&&(xe==="3d"?e("div",{class:"catchup-posts-viz-time-bar",children:ee}):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:te.toLowerCase()==="all",onChange:()=>{J("All")}}),"All ",e("span",{class:"count",children:l.length})]}),ir.map(C=>!!M[C]&&e("label",{class:"filter-cat",title:(M[C]/l.length*100).toFixed(2)+"%",children:[e("input",{type:"radio",name:"filter-cat",checked:te.toLowerCase()===C.toLowerCase(),onChange:()=>{J(C),C==="Boosts"&&(V("reblogsCount"),de(null))}}),C," ",e("span",{class:"count",children:M[C]})]},C))]}),l.length>=2&&!!ge&&e("div",{class:"catchup-filters authors-filters",ref:Ae,children:[Se.map(C=>e("label",{class:"filter-author","data-author":C,children:[e("input",{type:"radio",name:"filter-author",checked:L===C,onChange:()=>{P(C)},onClick:()=>{L===C&&P(null)}}),e(nt,{url:le[C].avatarStatic||le[C].avatar,size:"xxl",alt:`${le[C].displayName} (@${le[C].acct})`})," ",e("span",{class:"count",children:ge[C]}),e("span",{class:"username",children:le[C].username})]},`${C}-${ge[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:sr.map(C=>e("label",{class:"filter-sort",onClick:O=>{j===C&&(O.preventDefault(),O.stopPropagation(),se(D==="asc"?"desc":"asc"))},children:[e("input",{type:"radio",name:"filter-sort-cat",checked:j===C,onChange:()=>{V(C);const O=/(replies|favourites|reblogs)/.test(C)?"desc":"asc";se(O)}}),{createdAt:"Date",repliesCount:"Replies",favouritesCount:"Likes",reblogsCount:"Boosts",density:"Density"}[C],j===C&&(D==="asc"?" ↑":" ↓")]},C))}),e("span",{class:"filter-label",children:"Group"})," ",e("fieldset",{class:"radio-field-group",children:or.map(C=>e("label",{class:"filter-group",children:[e("input",{type:"radio",name:"filter-group",checked:G===C,onChange:()=>{de(C)},disabled:C==="account"&&L}),{account:"Authors"}[C]||"None"]},C||"none"))}),L&&Se.length>1?e("button",{type:"button",class:"plain6 small",onClick:()=>{P(null)},style:{whiteSpace:"nowrap"},children:"Show all authors"}):null]}),e("ul",{class:`catchup-list catchup-filter-${Ii[te]||""} ${j?`catchup-sort-${j}`:""} ${L&&le[L]?"catchup-selected-author":""} ${G?`catchup-group-${G}`:""}`,children:Pe.map((C,O)=>{var ne;const Y=((ne=C.reblog)==null?void 0:ne.id)||C.id;let H=!1;return G==="account"&&(Re.current&&C.account.id!==Re.current&&O>0&&(H=!0),Re.current=C.account.id),e(R,{children:[H&&e("li",{class:"separator"}),e(dr,{to:`/${n}/s/${Y}`,post:C,root:be.current})]},`${C.id}-${H}`)})}),e("footer",{children:he.length>5&&e("p",{children:[te==="Boosts"?"You don't have to read everything.":"That's all."," ",e("button",{type:"button",class:"textual",onClick:()=>{be.current.scrollTop=0},children:"Back to top"}),"."]})})]})]})]}),K&&e(_e,{onClose:()=>E(!1),children:e("div",{class:"sheet",id:"catchup-help-sheet",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>E(!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 lr=Je(function({post:t}){const{id:n,account:s,group:i,reblog:o,inReplyToId:a,inReplyToAccountId:h,_followedTags:u,_filtered:r,visibility:d,__BOOSTERS:p}=t,c=a&&h!==s.id,f=!!r,l=g=>{g.shiftKey};return e("article",{class:`post-line ${i?"group":o?"reblog":u!=null&&u.length?"followed-tags":""} ${c?"reply-to":""} ${f?"filtered":""} visibility-${d}`,onMouseEnter:l,children:[e("span",{class:"post-author",children:o?e("span",{class:"post-reblog-avatar",children:[e(nt,{url:s.avatarStatic||s.avatar,squircle:s.bot}),(p==null?void 0:p.size)>0?[...p].map(g=>e(nt,{url:g.avatarStatic||g.avatar,squircle:g.bot})):""," ",e(v,{icon:"rocket"})," ",e(Et,{account:o.account,showAvatar:!0})]}):e(Et,{account:s,showAvatar:!0})}),e(fr,{post:o||t,filterInfo:r}),e("span",{class:"post-meta",children:[e(pr,{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)}),dr=({root:t,to:n,...s})=>{const i=q(),[o,a]=A(!1);return Z(()=>{const h=new IntersectionObserver(u=>{u[0].isIntersecting&&(queueMicrotask(()=>a(!0)),h.unobserve(i.current))},{root:t,rootMargin:`${Math.max(320,screen.height*.75)}px`});return i.current&&h.observe(i.current),()=>{i.current&&h.unobserve(i.current)}},[]),o?e("li",{children:e(re,{to:n,children:e(lr,{...s})})}):e("li",{ref:i,style:{height:"4em"}})},ur=8,hr=8;function Ci(t){var r;const{spoilerText:n,content:s,poll:i,mediaAttachments:o,card:a}=t,h=(r=i==null?void 0:i.options)!=null&&r.length?i.options.reduce((d,p)=>d+p.title,""):"";return(n.length+Wi(s)+h.length)/140+(o!=null&&o.length?ur*o.length:a!=null&&a.image?hr:0)}const mt=48;function fr({post:t,filterInfo:n}){var y;const{spoilerText:s,sensitive:i,content:o,emojis:a,poll:h,mediaAttachments:u,card:r,inReplyToId:d,inReplyToAccountId:p,account:c,_thread:f}=t,l=d&&p===c.id||!!f,g=me(()=>!!(we.account.get("preferences")||{})["reading:expand:spoilers"],[]),m=g||!s&&!i,k=o?Pn(t):"",b=!s||g;return e("div",{class:"post-peek",title:s?"":k,children:[e("span",{class:"post-peek-content",children:[l&&!b&&e(R,{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(R,{children:[!!s&&e("span",{class:"post-peek-spoiler",children:[e(v,{icon:`${g?"eye-open":"eye-close"}`})," ",s]}),b&&e("div",{class:"post-peek-html",children:[l&&e(R,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:"Thread"})," "]}),!!o&&e("div",{dangerouslySetInnerHTML:{__html:no(o,a)}}),!!((y=h==null?void 0:h.options)!=null&&y.length)&&h.options.map(T=>e("div",{children:[h.multiple?"▪️":"•"," ",T.title]})),!o&&(u==null?void 0:u.length)===1&&u[0].description&&e(R,{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:[!!h&&e("span",{class:"post-peek-tag post-peek-poll",children:[e(v,{icon:"poll",size:"s"}),"Poll"]}),u!=null&&u.length?u.map(T=>{var U,M,N,te,J,L,P,F,z,j;const w=T.previewUrl||T.url,S=T.previewRemoteUrl||T.remoteUrl,I=(U=T.meta)!=null&&U.original?T.meta.original.width:((N=(M=T.meta)==null?void 0:M.small)==null?void 0:N.width)||((J=(te=T.meta)==null?void 0:te.original)==null?void 0:J.width),x=(L=T.meta)!=null&&L.original?T.meta.original.height:((F=(P=T.meta)==null?void 0:P.small)==null?void 0:F.height)||((j=(z=T.meta)==null?void 0:z.original)==null?void 0:j.height);return e("span",{class:"post-peek-media",children:{image:(w||S)&&m?e("img",{src:w,width:mt,height:mt,alt:T.description,loading:"lazy",onError:V=>{const{src:D}=V.target;D===w&&(V.target.src=S)},style:{"--anim-duration":`${Math.min(Math.max(Math.max(I,x)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"🖼"}),gifv:(w||S)&&m?e("img",{src:w,width:mt,height:mt,alt:T.description,loading:"lazy",onError:V=>{const{src:D}=V.target;D===w&&(V.target.src=S)}}):e("span",{class:"post-peek-faux-media",children:"🎞️"}),video:(w||S)&&m?e("img",{src:w,width:mt,height:mt,alt:T.description,loading:"lazy",onError:V=>{const{src:D}=V.target;D===w&&(V.target.src=S)}}):e("span",{class:"post-peek-faux-media",children:"📹"}),audio:e("span",{class:"post-peek-faux-media",children:"🎵"})}[T.type]||null},T.id)}):!!r&&r.image&&m&&e("span",{class:`post-peek-media post-peek-card card-${r.type||""}`,children:r.image?e("img",{src:r.image,width:mt,height:mt,alt:r.title||r.description||r.imageDescription,loading:"lazy",style:{"--anim-duration":r.width&&r.height&&`${Math.min(Math.max(Math.max(r.width,r.height)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"🔗"})})]})]})}function pr({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:mr}=new Intl.DateTimeFormat().resolvedOptions(),Zt=new Intl.DateTimeFormat(mr,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"});function gr(t,n,s){const i=t.map(r=>new Date(r[n])),o=i.reduce((r,d)=>d<r?d:r,i[0]),h=i.reduce((r,d)=>d>r?d:r,i[0]).getTime()-o.getTime(),u=Array.from({length:s},()=>[]);return t.forEach(r=>{const p=(new Date(r[n]).getTime()-o.getTime())/h,c=Math.floor(p*(s-1));u[c].push(r)}),u}const br=20;function ps(){qe("Likes","/f");const{masto:t,instance:n}=ie(),s=q();async function i(o){return(o||!s.current)&&(s.current=t.v1.favourites.list({limit:br})),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 yr=["home","public","notifications","thread","account"],Ti=["notifications","thread","account"],wr={home:"Home and lists",notifications:"Notifications",public:"Public timelines",thread:"Conversations",account:"Profiles"},vr=[0,30*60,60*60,6*60*60,12*60*60,60*60*24,60*60*24*7,60*60*24*30],kr={0:"Never",1800:"30 minutes",3600:"1 hour",21600:"6 hours",43200:"12 hours",86400:"24 hours",604800:"7 days",2592e3:"30 days"};function Sr(){const{masto:t}=ie();qe("Filters","/ft");const[n,s]=A("default"),[i,o]=A(!1),[a,h]=kt(d=>d+1,0),[u,r]=A([]);return Z(()=>{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((f,l)=>f.id-l.id)}),r(d),s("default")}catch{s("error")}})()},[a]),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(re,{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(R,{children:[e("ul",{class:"filters-list",children:u.map(d=>{const{id:p,title:c,expiresAt:f,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(g=>e(R,{children:[e("span",{class:"tag collapsed insignificant",children:g.wholeWord?`${g.keyword}`:g.keyword})," "]}))}),e("small",{class:"insignificant",children:e(ms,{expiresAt:f})})]}),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(_e,{title:"Add filter",onClose:()=>{o(!1)},children:e(Tr,{filter:i==null?void 0:i.filter,onClose:d=>{d.state==="success"&&h(),o(!1)}})})]})}let Ir=1;const Cr=()=>Ir++;function Tr({filter:t,onClose:n}){const{masto:s}=ie(),[i,o]=A("default"),a=!!t,{context:h,expiresAt:u,id:r,keywords:d,title:p,filterAction:c}=t||{},f=!!u,l=f&&new Date(u),[g,m]=A(d||[]),k=q(),[b,y]=A([]),[T,w]=A([]),S=g.filter(I=>!b.includes(I.id)&&!T.includes(I._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:a?"Edit filter":"New filter"})}),e("main",{children:e("form",{onSubmit:I=>{I.preventDefault();const x=new FormData(I.target),U=x.get("title"),M=x.getAll("keyword_attributes[][id]"),N=x.getAll("keyword_attributes[][keyword]"),te=[...k.current.querySelectorAll('input[name="keyword_attributes[][whole_word]"]')].map(z=>z.checked),J=N.map((z,j)=>({id:M[j]||void 0,keyword:z,wholeWord:te[j]}));a&&(b!=null&&b.length)&&b.forEach(z=>{J.push({id:z,_destroy:!0})});const L=x.getAll("context");let P=x.get("expires_in");const F=x.get("filter_action");!U||!(L!=null&&L.length)||(o("loading"),(async()=>{try{let z;a?(P===""||P===null?f?P=Math.floor((l-new Date)/1e3):P=null:P==="0"||P===0?P=null:P=+P,z=await s.v2.filters.$select(r).update({title:U,context:L,expiresIn:P,keywordsAttributes:J,filterAction:F})):(P=+P||null,z=await s.v2.filters.create({title:U,context:L,expiresIn:P,keywordsAttributes:J,filterAction:F})),o("default"),n==null||n({state:"success",filter:z})}catch{o("error"),alert(a?"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:k,children:[S.length?e("ul",{class:"filter-keywords",children:S.map(I=>{const{id:x,keyword:U,wholeWord:M,_id:N}=I;return e("li",{children:[e("input",{type:"hidden",name:"keyword_attributes[][id]",value:x}),e("input",{name:"keyword_attributes[][keyword]",type:"text",defaultValue:U,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:M,disabled:i==="loading"})," ","Whole word"]}),e("button",{type:"button",class:"light danger small",disabled:i==="loading",onClick:()=>{x?(b.push(x),y([...b])):N&&(T.push(N),w([...T]))},children:e(v,{icon:"x"})})]})]},`${x}-${N}`)})}):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([...g,{_id:Cr(),keyword:"",wholeWord:!0}]),setTimeout(()=>{var x,U;const I=k.current.querySelectorAll('input[type="text"]');(U=(x=I[I.length-1])==null?void 0:x.focus)==null||U.call(x)},10)},children:"Add keyword"})," ",(S==null?void 0:S.length)>1&&e("small",{class:"insignificant",children:[S.length," keyword",S.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…"})}),yr.map(I=>e("div",{children:[e("label",{class:Ti.includes(I)?"insignificant":"",children:[e("input",{type:"checkbox",name:"context",value:I,defaultChecked:h?h.includes(I):!0,disabled:i==="loading"})," ",wr[I],Ti.includes(I)?"*":""]})," "]})),e("p",{children:e("small",{class:"insignificant",children:"* Not implemented yet"})})]}),e("div",{class:"filter-form-col",children:[a&&e(R,{children:["Status:"," ",e("b",{children:e(ms,{expiresAt:u,showNeverExpires:!0})})]}),e("div",{children:[e("label",{for:"filters-expires_in",children:a?"Change expiry":"Expiry"}),e("select",{id:"filters-expires_in",name:"expires_in",disabled:i==="loading",defaultValue:a?void 0:0,children:[a&&e("option",{}),vr.map(I=>e("option",{value:I,children:kr[I]}))]})]}),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"||!a,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:a?"Save":"Create"})," ",e($e,{abrupt:!0,hidden:i!=="loading"})]}),a&&e(tt,{disabled:i==="loading",align:"end",menuItemClassName:"danger",confirmLabel:"Delete this filter?",onClick:()=>{o("loading"),(async()=>{try{await s.v2.filters.$select(r).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,[a,h]=kt(u=>u+1,0);return Mn(h,o||3e4),o?"Expired":s?e(R,{children:["Expiring ",e(It,{datetime:i})]}):n&&"Never expires"}function xr(){const{masto:t,instance:n}=ie();qe("Followed Hashtags","/fh");const[s,i]=A("default"),[o,a]=A([]);return Z(()=>{i("loading"),(async()=>{try{const h=await un();a(h),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(re,{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(R,{children:[e("ul",{class:"link-list",children:o.map(h=>e("li",{children:e(re,{to:n?`/${n}/t/${h.name}`:`/t/${h.name}`,children:[e(v,{icon:"hashtag"})," ",e("span",{children:h.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 $r=20;function Kn({title:t,path:n,id:s,...i}){qe(t||"Following",n||"/following");const{masto:o,streaming:a,instance:h}=ie(),u=Ne($),r=q(),d=q(),p=Ve("@pixelfed/home-include-reblogs");async function c(l){var k;(l||!r.current)&&(r.current=o.v1.timelines.home.list({limit:$r})),p&&((k=r.current)!=null&&k.nextParams)&&(typeof r.current.nextParams=="string"?r.current.nextParams+="&include_reblogs=true":r.current.nextParams.include_reblogs=!0);const g=await r.current.next();let{value:m}=g;if(m!=null&&m.length){let b=!1;l&&(m[0].id!==d.current&&(b=!0),d.current=m[0].id),m.forEach(y=>{He(y,h)}),m=vi(m,h),l&&b&&za(),hs(m,h),m.sort((y,T)=>{const w=new Date(y.createdAt);return new Date(T.createdAt)-w})}return{...g,value:m}}async function f(){var l;try{const g={limit:5,since_id:d.current};Ve("@pixelfed/home-include-reblogs")&&(g.include_reblogs=!0);const m=await o.v1.timelines.home.list(g).next();let{value:k}=m;const b=((l=k[0])==null?void 0:l.id)===d.current;return!!(k!=null&&k.length&&!b&&(d.current=k[0].id,k=vi(k,h),k=wt(k,"home"),k.some(y=>!y.reblog)))}catch{return!1}}return Z(()=>{let l;return(async()=>{if(a){l=a.user.subscribe();for await(const g of l){if(!l)break;if(g.event==="status.update"){const m=g.payload;He(m,h)}else if(g.event==="delete"){const m=g.payload,k=zi(m,h);k&&(k._deleted=!0)}}}})(),()=>{var g;(g=l==null?void 0:l.unsubscribe)==null||g.call(l),l=null}},[a]),e(pt,{title:t||"Following",id:s||"following",emptyText:"Nothing to see here.",errorText:"Unable to load posts.",instance:h,fetchItems:c,checkForUpdates:f,useItemID:!0,boostsCarousel:u.settings.boostsCarousel,...i,filterContext:"home",showFollowedTags:!0,showReplyParent:!0})}const Ar=20,_r=4,xi=_r+1;function gs({media:t,columnMode:n,...s}){let{hashtag:i,...o}=n?{}:St();s.hashtag&&(i=s.hashtag);let a=i.trim().split(/[\s+]+/);a.sort(),i=a[0];const[h,u]=ot(),r=t||!!h.get("media"),d=r?"?media=1":"",{masto:p,instance:c,authenticated:f}=ie({instance:(s==null?void 0:s.instance)||o.instance}),{masto:l,instance:g,authenticated:m}=ie(),k=a.map(D=>`#${D}`).join(" "),b=r?" (Media only)":"",y=c?`${k}${b} on ${c}`:`${k}${b}`;qe(y,"/:instance?/t/:hashtag");const T=q(),w=me(()=>En(),[]),S=q(void 0);async function I(D){const se=await p.v1.timelines.tag.$select(i).list({limit:Ar,any:a.slice(1),maxId:D?void 0:S.current,onlyMedia:r?!0:void 0}).next();let{value:G}=se;return G!=null&&G.length&&(D&&(T.current=G[0].id),G.forEach(de=>{He(de,c,{skipThreading:r||w})}),S.current=G[G.length-1].id),{...se,value:G}}async function x(){var D;try{const se=await p.v1.timelines.tag.$select(i).list({limit:1,any:a.slice(1),since_id:T.current,onlyMedia:r}).next();let{value:G}=se;const de=((D=G[0])==null?void 0:D.id)===T.current;return G!=null&&G.length&&!de?(G=wt(G,"public"),!0):!1}catch{return!1}}const[U,M]=A("default"),[N,te]=A();Z(()=>{(async()=>{try{const D=await p.v1.tags.$select(i).fetch();te(D)}catch{}})()},[i]);const J=a.length>=xi,[L,P]=A("default"),[F,z]=A([]),[j,V]=A(!1);return Z(()=>{f&&(async()=>{try{const D=await p.v1.featuredTags.list();z(D),V(D.some(se=>se.name.toLowerCase()===i.toLowerCase()))}catch{}})()},[]),e(pt,{title:y,titleComponent:!!c&&e("h1",{class:"header-double-lines",children:[e("b",{children:k}),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:I,checkForUpdates:x,useItemID:!0,view:r||w?"media":void 0,refresh:r,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:[!!N&&a.length===1&&e(R,{children:[e(tt,{subMenu:!0,confirm:N.following,confirmLabel:`Unfollow #${i}?`,disabled:U==="loading"||!f,onClick:()=>{M("loading"),N.following?p.v1.tags.$select(i).unfollow().then(()=>{te({...N,following:!1}),oe(`Unfollowed #${i}`)}).catch(D=>{alert(D)}).finally(()=>{M("default")}):p.v1.tags.$select(i).follow().then(()=>{te({...N,following:!0}),oe(`Followed #${i}`)}).catch(D=>{alert(D)}).finally(()=>{M("default")})},children:N.following?e(R,{children:[e(v,{icon:"check-circle"})," ",e("span",{children:"Following…"})]}):e(R,{children:[e(v,{icon:"plus"})," ",e("span",{children:"Follow"})]})}),e(pe,{type:"checkbox",checked:j,disabled:L==="loading"||!f,onClick:()=>{if(P("loading"),j){const D=F.find(se=>se.name.toLowerCase()===i.toLowerCase()).id;D?p.v1.featuredTags.$select(D).remove().then(()=>{V(!1),oe("Unfeatured on profile"),z(F.filter(se=>se.id!==D))}).catch(se=>{}).finally(()=>{P("default")}):oe("Unable to unfeature on profile")}else p.v1.featuredTags.create({name:i}).then(D=>{V(!0),oe("Featured on profile"),z(F.concat(D))}).catch(D=>{}).finally(()=>{P("default")})},children:j?e(R,{children:[e(v,{icon:"check-circle"}),e("span",{children:"Featured on profile"})]}):e(R,{children:[e(v,{icon:"check-circle"}),e("span",{children:"Feature on profile"})]})}),e(Be,{})]}),!w&&e(R,{children:[e(Ki,{className:"plain",children:"Filters"}),e(pe,{type:"checkbox",checked:!!r,onClick:()=>{r?h.delete("media"):h.set("media","1"),u(h)},children:[e(v,{icon:"check-circle"})," ",e("span",{class:"menu-grow",children:"Media only"})]}),e(Be,{})]}),e(io,{className:"menu-field",disabled:J,children:({ref:D})=>e("form",{onSubmit:se=>{var de,he;se.preventDefault();const G=(he=(de=se.target[0].value)==null?void 0:de.trim)==null?void 0:he.call(de);G&&!a.some(le=>le.toLowerCase()===G.toLowerCase())&&(a.push(G),a.sort(),location.hash=c?`/${c}/t/${a.join("+")}`:`/t/${a.join("+")}${d}`)},children:[e(v,{icon:"hashtag"}),e("input",{ref:D,type:"text",placeholder:J?`Max ${xi} tags`:"Add hashtag",required:!0,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:"[^#][^\\s#]+[^#]",disabled:J})]})}),e(so,{takeOverflow:!0,children:a.map((D,se)=>e(pe,{disabled:a.length===1,onClick:G=>{a.splice(se,1),a.sort(),location.hash=c?`/${c}/t/${a.join("+")}${d}`:`/t/${a.join("+")}${d}`},children:[e(v,{icon:"x",alt:"Remove hashtag",class:"danger-icon"}),e("span",{children:[e("span",{class:"more-insignificant",children:"#"}),D]})]},D))}),e(Be,{}),e(pe,{disabled:!m,onClick:()=>{if($.shortcuts.length>=lt){alert(`Max ${lt} shortcuts reached. Unable to add shortcut.`);return}const D={type:"hashtag",hashtag:a.join(" "),instance:c,media:r?"on":void 0};$.shortcuts.some(G=>G.type===D.type&&G.hashtag.split(/[\s+]+/).sort().join(" ")===D.hashtag.split(/[\s+]+/).sort().join(" ")&&(G.instance?G.instance===D.instance:!0)&&(G.media?!!G.media==!!D.media:!0))?alert("This shortcut already exists"):($.shortcuts.push(D),oe("Hashtag shortcut added"))},children:[e(v,{icon:"shortcut"})," ",e("span",{children:"Add to Shortcuts"})]}),e(pe,{onClick:()=>{let D=prompt('Enter a new instance e.g. "mastodon.social"');if(!/\./.test(D)){D&&alert("Invalid instance");return}D&&(D=D.toLowerCase().trim(),location.hash=`/${D}/t/${a.join("+")}${d}`)},children:[e(v,{icon:"bus"})," ",e("span",{children:"Go to another instance…"})]}),g!==c&&e(pe,{onClick:()=>{location.hash=`/${g}/t/${a.join("+")}${d}`},children:[e(v,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:["Go to my instance (",e("b",{children:g}),")"]})]})]})},c+k)}const Rr=20;function bs(t){var b;const n=Ne($),{masto:s,instance:i}=ie(),o=(t==null?void 0:t.id)||((b=St())==null?void 0:b.id),a=q(),h=q();async function u(y){(y||!h.current)&&(h.current=s.v1.timelines.list.$select(o).list({limit:Rr}));const T=await h.current.next();let{value:w}=T;return w!=null&&w.length&&(y&&(a.current=w[0].id),w.forEach(S=>{He(S,i)})),{...T,value:w}}async function r(){var y;try{const T=await s.v1.timelines.list.$select(o).list({limit:1,since_id:a.current});let{value:w}=T;const S=((y=w[0])==null?void 0:y.id)===a.current;return w!=null&&w.length&&!S?(w=wt(w,"home"),!0):!1}catch{return!1}}const[d,p]=A([]);Z(()=>{Yt().then(p)},[]);const[c,f]=A({title:"List"});qe(c.title,"/l/:id"),Z(()=>{(async()=>{try{const y=await as(o);f(y)}catch{}})()},[o]);const[l,g]=A(!1),[m,k]=A(!1);return e(R,{children:[e(pt,{title:c.title,id:"list",emptyText:"Nothing yet.",errorText:"Unable to load posts.",instance:i,fetchItems:u,checkForUpdates:r,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(Ee,{to:"/l",children:e("span",{children:"All Lists"})}),(d==null?void 0:d.length)>0&&e(R,{children:[e(Be,{}),d.map(y=>e(Ee,{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:()=>g({list:c}),children:[e(v,{icon:"pencil",size:"l"}),e("span",{children:"Edit"})]}),e(pe,{onClick:()=>k(!0),children:[e(v,{icon:"group",size:"l"}),e("span",{children:"Manage members"})]})]})},o),l&&e(_e,{onClick:y=>{y.target===y.currentTarget&&g(!1)},children:e(Vn,{list:l==null?void 0:l.list,onClose:y=>{y.state==="success"&&y.list?f(y.list):y.state==="deleted"&&(location.hash="/l"),g(!1)}})}),m&&e(_e,{onClick:y=>{y.target===y.currentTarget&&k(!1)},children:e(Lr,{listID:o,onClose:()=>k(!1)})})]})}const Er=40;function Lr({listID:t,onClose:n}){const{masto:s,instance:i}=ie(),[o,a]=A([]),[h,u]=A("default"),[r,d]=A(!1),p=q();async function c(f){d(!1),u("loading"),(async()=>{try{(f||!p.current)&&(p.current=s.v1.lists.$select(t).accounts.list({limit:Er}));const l=await p.current.next();let{done:g,value:m}=l;m!=null&&m.length?(a(f?m:o.concat(m)),d(!g)):d(!1),u("default")}catch{u("error")}})()}return Z(()=>{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(f=>e("li",{children:[e(Qe,{account:f,instance:i}),e(Mr,{account:f,listID:t})]},f.id)),r&&h==="default"&&e(ht,{as:"li",onChange:f=>f&&c(),children:e("button",{type:"button",class:"light block",onClick:c,children:"Show more…"})})]})})]})}function Mr({account:t,listID:n}){const{masto:s}=ie(),[i,o]=A("default"),[a,h]=A(!1);return e(tt,{confirm:!a,confirmLabel:e("span",{children:["Remove @",t.username," from list?"]}),align:"end",menuItemClassName:"danger",onClick:()=>{a?(o("loading"),(async()=>{try{await s.v1.lists.$select(n).accounts.create({accountIds:[t.id]}),o("default"),h(!1)}catch{o("error")}})()):(o("loading"),(async()=>{try{await s.v1.lists.$select(n).accounts.remove({accountIds:[t.id]}),o("default"),h(!0)}catch{o("error")}})())},children:e("button",{type:"button",class:`light ${a?"":"danger"}`,disabled:i==="loading",children:a?"Add":"Remove…"})})}const Nr={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 a=Nr[s];return a!=null&&a.length?a.every(h=>!!n[h]):!0})}function Dr(t){const n=t.map(o=>{const{latestPageNotificationAt:a,mostRecentNotificationId:h,sampleAccounts:u,notificationsCount:r}=o;return{id:""+h,createdAt:a,account:u[0],...o}}),s={},i=[];for(let o=0;o<n.length;o++){const a=n[o],{type:h,account:u,_accounts:r,sampleAccounts:d,createdAt:p}=a,c=p?new Date(p).toLocaleDateString():"",f=(d==null?void 0:d.length)===1||(r==null?void 0:r.length)===1;if((h==="favourite"||h==="reblog")&&f){const l=`${u==null?void 0:u.id}-${h}-${c}`,g=s[l];if(g)g._statuses.push(a.status),g._ids+=`-${a.id}`;else{let m=s[l]={...a,type:h,_ids:a.id,_statuses:[a.status]};i.push(m)}}else i.push(a)}return i}function Pr(t){t=ys(t);const n={},s=[];for(let a=0,h=0;a<t.length;a++){const u=t[a],{id:r,status:d,account:p,type:c,createdAt:f}=u,l=f?new Date(f).toLocaleDateString():"";let g=c;(c==="favourite"||c==="reblog")&&(g="favourite+reblog");const m=`${d==null?void 0:d.id}-${g}-${l}`,k=n[m];if(g==="follow_request")s[h++]=u;else if(k!=null&&k.account){const b=k._accounts.find(y=>y.id===p.id);b?(b._types.push(c),b._types.sort().reverse(),k._ids+=`-${r}`):(p._types=[c],k._accounts.push(p),k._ids+=`-${r}`)}else{p&&(p._types=[c]);let b=n[m]={...u,type:g,_ids:r,_accounts:p?[p]:[]};s[h++]=b}}const i={},o=[];for(let a=0,h=0;a<s.length;a++){const u=s[a],{id:r,account:d,_accounts:p,type:c,createdAt:f}=u,l=f?new Date(f).toLocaleDateString():"";if(c==="favourite+reblog"&&d&&p.length===1){const g=`${d==null?void 0:d.id}-${c}-${l}`,m=i[g];if(m)m._statuses.push(u.status),m._ids+=`-${r}`;else{let k=i[g]={...u,type:c,_ids:r,_statuses:[u.status]};o[h++]=k}}else o[h++]=u}return o}const $i=20,Ur=new URLSearchParams;function ws({columnMode:t,...n}){const{masto:s,instance:i}=ie(),[o]=t?[Ur]:ot(),[a,h]=A(null),u=(n==null?void 0:n.type)||o.get("type")||a;qe(`Mentions${u==="private"?" (Private)":""}`,"/mentions");const r=q(),d=q();async function p(b){(b||!r.current)&&(r.current=s.v1.notifications.list({limit:$i,types:["mention"]}));const y=await r.current.next();let{value:T}=y;return T!=null&&T.length&&(T=ys(T),b&&(d.current=T[0].id),T.forEach(({status:w})=>{He(w,i)})),{...y,value:T==null?void 0:T.map(w=>w.status)}}const c=q(),f=q();async function l(b){(b||!c.current)&&(c.current=s.v1.conversations.list({limit:$i}));const y=await c.current.next();let{value:T}=y;return T=T==null?void 0:T.filter(w=>w.lastStatus),T!=null&&T.length&&(b&&(f.current=T[0].lastStatus.id),T.forEach(({lastStatus:w})=>{He(w,i)})),{...y,value:T==null?void 0:T.map(w=>w.lastStatus)}}function g(...b){return u==="private"?l(...b):p(...b)}async function m(){var b;if(u==="private")try{const y=await s.v1.conversations.list({limit:1,since_id:f.current}).next();let{value:T}=y;const w=((b=T[0])==null?void 0:b.id)===f.current;return T!=null&&T.length&&!w?(f.current=T[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:T}=y;return T!=null&&T.length?(d.current=T[0].id,!0):!1}catch{return!1}}const k=me(()=>e("div",{class:"filter-bar centered",children:[e(re,{to:"/mentions",class:u?"":"is-active",onClick:b=>{t&&(b.preventDefault(),h(null))},children:"All"}),e(re,{to:"/mentions?type=private",class:u==="private"?"is-active":"",onClick:b=>{t&&(b.preventDefault(),h("private"))},children:"Private"})]}),[u]);return e(pt,{title:"Mentions",id:"mentions",emptyText:"No one mentioned you :(",errorText:"Unable to load mentions.",instance:i,fetchItems:g,checkForUpdates:m,useItemID:!0,timelineStart:k,refresh:u})}const Or=80,Fr=20,zr=new URLSearchParams,Jt={block:"center",inline:"center",behavior:"smooth"},vs=Us(()=>Ve("@mastodon/grouped-notifications"),{maxAge:1e3*60*5});function ks(t={}){const{masto:n}=ie();return $.settings.groupedNotificationsAlpha&&vs()?n.v2_alpha.notifications.list({limit:Fr,...t}):n.v1.notifications.list({limit:Or,...t})}function Ss(t){return $.settings.groupedNotificationsAlpha&&vs()?Dr(t):Pr(t)}function Br({columnMode:t}){var K;qe("Notifications","/notifications");const{masto:n,instance:s}=ie(),i=Ne($),[o,a]=A("default"),[h]=t?[zr]:ot(),u=h.get("id"),r=h.get("access_token"),[d,p]=A(!1),[c,f]=A(!1),l=q(),{nearReachEnd:g,scrollDirection:m,reachStart:k,nearReachStart:b}=Ba({scrollableRef:l}),y=m==="end"&&!b,[T,w]=A([]),[S,I]=A([]),x=q();async function U(E){var B;if((E||!x.current)&&(x.current=ks({excludeTypes:["follow_request"]})),/max_id=($|&)/i.test((B=x.current)==null?void 0:B.nextParams))return{done:!0};const W=await x.current.next(),_=W.value;if(_!=null&&_.length){_.forEach(ue=>{He(ue.status,s,{skipThreading:!0})});const Q=Ss(_);E?($.notificationsLast=Q[0],$.notifications=Q,n.v1.markers.create({notifications:{lastReadId:Q[0].id}}).catch(()=>{})):$.notifications.push(...Q)}return $.notificationsShowNew=!1,$.notificationsLastFetchTime=Date.now(),W}async function M(){try{return await n.v1.followRequests.list({limit:80})}catch{return[]}}const N=()=>{a("loading"),(async()=>{try{const E=await M();w(E),a("default")}catch{a("error")}})()};async function te(){try{return await n.v1.announcements.list()}catch{return[]}}const J=Ve("@mastodon/filtered-notifications"),[L,P]=A(!1),[F,z]=A({});function j(){return n.v1.notifications.policy.fetch().catch(()=>{})}function V(){j().then(E=>{z(E)}).catch(()=>{})}const[D,se]=A(null);function G(){return n.v1.notifications.requests.list()}const de=E=>{le(!1),a("loading"),(async()=>{try{const W=U(E);E&&(te().then(B=>{B.sort((Q,ue)=>{const De=new Date(Q.updatedAt||Q.createdAt);return new Date(ue.updatedAt||ue.createdAt)-De}),I(B)}).catch(()=>{}),M().then(B=>{w(B)}).catch(()=>{}),J&&V());const{done:_}=await W;p(!_),a("default")}catch{a("error")}})()};Z(()=>{de(!0)},[]),Z(()=>{k&&de(!0)},[k]);const[he,le]=A(!1),ge=et(({disableIdleCheck:E=!1}={})=>{var W;o!=="loading"&&i.settings.autoRefresh&&((W=l.current)==null?void 0:W.scrollTop)<16&&(E||window.__IDLE__)&&!Hr()&&de(!0)},[i.notificationsShowNew,i.settings.autoRefresh,o]),Te=q();Lt(E=>{if(E){const W=Date.now()-Te.current;!Te.current||W>1e3*3?ge({disableIdleCheck:!0}):Te.current=Date.now()}});const Se=q(!0);Z(()=>{let E=Os($,"notificationsShowNew",W=>{if(Se.current){Se.current=!1;return}o!=="loading"&&(W&&ge(),le(W))});return()=>E==null?void 0:E()},[]);const Pe=new Date,Re=new Date(Pe-24*60*60*1e3);let Ae=new Date;const Ie=!i.notifications.some(E=>new Date(E.createdAt).toDateString()===Pe.toDateString()),xe=q();Z(()=>{u&&($.routeNotification={id:u,accessToken:atob(r)})},[u,r]);const ve=".notification",ee=Le("j",()=>{const E=document.activeElement.closest(ve),W=E==null?void 0:E.getBoundingClientRect(),_=Array.from(l.current.querySelectorAll(ve));if(E&&W.top<l.current.clientHeight&&W.bottom>0){const B=_.indexOf(E);let Q=_[B+1];Q&&(Q.focus(),Q.scrollIntoView(Jt))}else{const B=_.find(Q=>{const ue=Q.getBoundingClientRect();return ue.top>=44&&ue.left>=0});B&&(B.focus(),B.scrollIntoView(Jt))}}),be=Le("k",()=>{const E=document.activeElement.closest(ve),W=E==null?void 0:E.getBoundingClientRect(),_=Array.from(l.current.querySelectorAll(ve));if(E&&W.top<l.current.clientHeight&&W.bottom>0){const B=_.indexOf(E);let Q=_[B-1];Q&&(Q.focus(),Q.scrollIntoView(Jt))}else{const B=_.find(Q=>{const ue=Q.getBoundingClientRect();return ue.top>=44&&ue.left>=0});B&&(B.focus(),B.scrollIntoView(Jt))}}),ae=Le(["enter","o"],()=>{const E=document.activeElement.closest(ve),W=E==null?void 0:E.querySelector(".status-link");W&&W.click()});return e("div",{id:"notifications-page",class:"deck-container",ref:E=>{l.current=E,ee.current=E,be.current=E,ae.current=E},tabIndex:"-1",children:[e("div",{class:`timeline-deck deck ${c?"only-mentions":""}`,children:[e("header",{hidden:y,onClick:E=>{var W;E.target.closest("a, button")||(W=l.current)==null||W.scrollTo({top:0,behavior:"smooth"})},onDblClick:E=>{E.target.closest("a, button")||de(!0)},class:o==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Tt,{}),e(re,{to:"/",class:"button plain",children:e(v,{icon:"home",size:"l",alt:"Home"})})]}),e("h1",{children:"Notifications"}),e("div",{class:"header-side",children:J&&e("button",{type:"button",class:"button plain4",onClick:()=>{P(!0)},children:e(v,{icon:"settings",size:"l",alt:"Notifications settings"})})})]}),he&&o!=="loading"&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:()=>{var E;de(!0),(E=l.current)==null||E.scrollTo({top:0,behavior:"smooth"})},children:[e(v,{icon:"arrow-up"})," New notifications"]})]}),S.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",S.length>1?"s":""]})," ",e("small",{class:"insignificant",children:s})]}),S.length>1&&e("span",{class:"announcements-nav-buttons",children:S.map((E,W)=>e("button",{type:"button",class:"plain2 small",onClick:()=>{var _;(_=xe.current)==null||_.children[W].scrollIntoView({behavior:"smooth",block:"nearest"})},children:W+1}))})]}),e("ul",{class:`announcements-list-${S.length>1?"multiple":"single"}`,ref:xe,children:S.map(E=>e("li",{children:e(qr,{announcement:E})}))})]})})}),T.length>0&&e("div",{class:"follow-requests",children:[e("h2",{class:"timeline-header",children:"Follow requests"}),T.length>5?e("details",{children:[e("summary",{children:[T.length," follow requests"]}),e("ul",{children:T.map(E=>e("li",{children:[e(Qe,{account:E}),e($n,{accountID:E.id,onChange:()=>{}})]},E.id))})]}):e("ul",{children:T.map(E=>e("li",{children:[e(Qe,{account:E}),e($n,{accountID:E.id,onChange:()=>{}})]},E.id))})]}),J&&((K=F==null?void 0:F.summary)==null?void 0:K.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 E=>{const{open:W}=E.target;if(W){const _=await G();se(_)}},children:[e("summary",{children:["Filtered notifications from"," ",F.summary.pendingRequestsCount," people"]}),D?(D==null?void 0:D.length)>0&&e("ul",{children:D.map(E=>{var W,_;return e("li",{children:[e("div",{class:"request-notifcations",children:[!((W=E.lastStatus)!=null&&W.id)&&e(Qe,{useAvatarStatic:!0,showStats:!0,account:E.account}),((_=E.lastStatus)==null?void 0:_.id)&&e("div",{class:"last-post",children:e(re,{class:"status-link",to:`/${s}/s/${E.lastStatus.id}`,children:e(Ue,{status:E.lastStatus,size:"s",readOnly:!0})})}),e(Gr,{request:E})]}),e(jr,{request:E,onChange:()=>{de(!0)}})]},E.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:E=>{f(E.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(R,{children:"…"})}),i.notifications.length?e(R,{children:i.notifications.filter(E=>E.type!=="follow_request").map(E=>{if(c&&E.type!=="mention")return null;const W=new Date(E.createdAt),_=W.toDateString()!==Ae.toDateString();_&&(Ae=W);const B=W.toDateString()===Re.toDateString()?"Yesterday":rt(Ae,{hideTime:!0});return e(R,{children:[_&&e("h2",{class:"timeline-header",children:B}),e(mn,{instance:s,notification:E},E._ids||E.id)]},E._ids||E.id)})}):e(R,{children:[o==="loading"&&e(R,{children:e("ul",{class:"timeline flat",children:Array.from({length:5}).map((E,W)=>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:()=>de(!0),children:"Try again"})]})]}),d&&e(ht,{onChange:E=>{E&&de()},children:e("button",{type:"button",class:"plain block",disabled:o==="loading",onClick:()=>de(),style:{marginBlockEnd:"6em"},children:o==="loading"?e($e,{abrupt:!0}):e(R,{children:"Show more…"})})})]}),J&&L&&e(_e,{onClick:E=>{E.target===E.currentTarget&&P(!1)},children:e("div",{class:"sheet",id:"notifications-settings",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>P(!1),children:e(v,{icon:"x"})}),e("header",{children:e("h2",{children:"Notifications settings"})}),e("main",{children:e("form",{onSubmit:E=>{E.preventDefault();const{filterNotFollowing:W,filterNotFollowers:_,filterNewAccounts:B,filterPrivateMentions:Q}=E.target,ue={filterNotFollowing:W.checked,filterNotFollowers:_.checked,filterNewAccounts:B.checked,filterPrivateMentions:Q.checked};z({...F,...ue}),P(!1),(async()=>{try{await n.v1.notifications.policy.update(ue),oe("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:F.filterNotFollowing,name:"filterNotFollowing"})," ","You don't follow"]})}),e("p",{children:e("label",{children:[e("input",{type:"checkbox",switch:!0,defaultChecked:F.filterNotFollowers,name:"filterNotFollowers"})," ","Who don't follow you"]})}),e("p",{children:e("label",{children:[e("input",{type:"checkbox",switch:!0,defaultChecked:F.filterNewAccounts,name:"filterNewAccounts"})," ","With a new account"]})}),e("p",{children:e("label",{children:[e("input",{type:"checkbox",switch:!0,defaultChecked:F.filterPrivateMentions,name:"filterPrivateMentions"})," ","Who unsolicitedly private mention you"]})}),e("p",{children:e("button",{type:"submit",children:"Save"})})]})})]})})]})}function Hr(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}function qr({announcement:t}){const{instance:n}=ie(),{contact:s}=Ui(),i=s==null?void 0:s.account,{id:o,content:a,startsAt:h,endsAt:u,published:r,allDay:d,publishedAt:p,updatedAt:c,read:f,mentions:l,statuses:g,tags:m,emojis:k,reactions:b}=t,y=new Date(p),T=rt(y),w=new Date(c),S=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(a,{emojis:k})}}),e("p",{class:"insignificant",children:[e("time",{datetime:y.toISOString(),children:rt(y)}),c&&S!==T&&e(R,{children:[" ","•"," ",e("span",{class:"ib",children:["Updated"," ",e("time",{datetime:w.toISOString(),children:rt(w)})]})]})]}),e("div",{class:"announcement-reactions",hidden:!0,children:b.map(I=>{const{name:x,count:U,me:M,staticUrl:N,url:te}=I;return e("button",{type:"button",class:`plain4 small ${M?"reacted":""}`,children:[te||N?e("img",{src:te||N,alt:x,width:"16",height:"16"}):e("span",{children:x})," ",e("span",{class:"count",children:je(U)})]})})})]})}function Vr(t){const{masto:n}=ie();return n.v1.notifications.list({accountID:t})}function Gr({request:t}){var c;const{instance:n}=ie(),[s,i]=A("loading"),{account:o,lastStatus:a}=t,[h,u]=A(!1),[r,d]=A([]);function p(){u(!1)}return Z(()=>{var f;(f=t==null?void 0:t.account)!=null&&f.id&&h&&(i("loading"),(async()=>{const l=await Vr(t.account.id);d(l||[]),i("default")})())},[h,(c=t==null?void 0:t.account)==null?void 0:c.id]),e(R,{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"})]}),h&&e(_e,{onClick:f=>{f.target===f.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})}):r.map(f=>e("div",{class:"notification-peek",onClick:l=>{const{target:g}=l;(l.target.tagName==="BUTTON"||l.target.tagName==="A")&&p()},children:e(mn,{instance:n,notification:f,isStatic:!0})}))})]})})]})}function jr({request:t,onChange:n}){const{masto:s}=ie(),[i,o]=A("default"),[a,h]=A(null),u=a!==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(),h("accept"),o("default"),n({request:t,state:"accept"}),oe(`Notifications from @${t.account.username} will not be filtered from now on.`)}catch{o("error"),oe("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(),h("dismiss"),o("default"),n({request:t,state:"dismiss"}),oe(`Notifications from @${t.account.username} will not show up in Filtered notifications from now on.`)}catch{o("error"),oe("Unable to dismiss notification request")}})()},children:"Dismiss"}),e("span",{class:"notification-request-states",children:i==="loading"?e($e,{abrupt:!0}):a==="accept"?e(v,{icon:"check-circle",alt:"Accepted",class:"notification-accepted"}):a==="dismiss"&&e(v,{icon:"x-circle",alt:"Dismissed",class:"notification-dismissed"})})]})}const Is=Je(Br),Yr=20;function An({local:t,columnMode:n,...s}){const i=Ne($),o=!!t,a=n?{}:St(),{masto:h,instance:u}=ie({instance:(s==null?void 0:s.instance)||a.instance}),{masto:r,instance:d}=ie(),p=`${o?"Local":"Federated"} timeline (${u})`;qe(p,o?"/:instance?/p/l":"/:instance?/p");const c=q(),f=q();async function l(m){if(m||!f.current){const y={limit:Yr,local:o||void 0};!o&&Ve("@pixelfed/global-feed")&&(y.remote=!0),f.current=h.v1.timelines.public.list(y)}const k=await f.current.next();let{value:b}=k;return b!=null&&b.length&&(m&&(c.current=b[0].id),b.forEach(y=>{He(y,u)})),{...k,value:b}}async function g(){var m;try{const k=await h.v1.timelines.public.list({limit:1,local:o,since_id:c.current}).next();let{value:b}=k;const y=((m=b[0])==null?void 0:m.id)===c.current;return b!=null&&b.length&&!y?(b=wt(b,"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:g,useItemID:!0,headerStart:e(R,{}),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(R,{children:[e(v,{icon:"transfer"})," ",e("span",{children:"Switch to Federated"})]}):e(R,{children:[e(v,{icon:"transfer"})," ",e("span",{children:"Switch to Local"})]})}),e(Be,{}),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,Wr=new URLSearchParams;function Cs({columnMode:t,...n}){const s=t?{}:St(),{masto:i,instance:o,authenticated:a}=ie({instance:s.instance}),[h,u]=A("default"),[r]=t?[Wr]:ot(),d=q(),p=(n==null?void 0:n.query)||r.get("q"),c=t?"statuses":(n==null?void 0:n.type)||r.get("type");qe(p?`Search: ${p}${c?` (${{statuses:"Posts",accounts:"Accounts",hashtags:"Hashtags"}[c]})`:""}`:"Search","/search");const[f,l]=A(!1),g=q(0);Z(()=>{g.current=0},[p,c]);const m=q();ut(()=>{var L,P;(P=(L=m.current)==null?void 0:L.scrollTo)==null||P.call(L,0,0)},[p,c]);const[k,b]=A([]),[y,T]=A([]),[w,S]=A([]);Z(()=>{b([]),T([]),S([])},[p]);const I={statuses:b,accounts:T,hashtags:S},[x,U]=A({}),M=async L=>{if(!(L!=null&&L.length))return;const P=await Nn(L,x);P&&U({...x,...P})};function N(L){L&&(g.current=0),!(!L&&!a)&&(u("loading"),L&&!c&&(b(k.slice(0,Qt)),T(y.slice(0,Qt)),S(w.slice(0,Qt))),(async()=>{var F,z;const P={q:p,resolve:a,limit:Qt};c&&(P.limit=kn,P.type=c,a&&(P.offset=g.current));try{const j=await i.v2.search.fetch(P);if(c)if(L){I[c](j[c]);const V=(F=j[c])==null?void 0:F.length;g.current=kn,l(!!V)}else{I[c](D=>[...D,...j[c]]);const V=(z=j[c])==null?void 0:z.length;g.current=g.current+kn,l(!!V)}else b(j.statuses||[]),T(j.accounts||[]),S(j.hashtags||[]),g.current=0,l(!1);M(j.accounts),u("default")}catch{u("error")}})())}const te=q();Lt(L=>{var F;const P=((F=m.current)==null?void 0:F.scrollTop)===0;if(L&&P){const z=Date.now()-te.current;!te.current||z>1e3*3?N(!0):te.current=Date.now()}}),Z(()=>{var L,P,F,z;(P=(L=d.current)==null?void 0:L.setValue)==null||P.call(L,p||""),p?N(!0):(z=(F=d.current)==null?void 0:F.focus)==null||z.call(F)},[p,c,o]),Le(["/","Slash"],L=>{var P,F,z,j;(F=(P=d.current)==null?void 0:P.focus)==null||F.call(P),(j=(z=d.current)==null?void 0:z.select)==null||j.call(z)},{preventDefault:!0});const[J]=Bn();return e("div",{id:"search-page",class:"deck-container",ref:m,children:e("div",{class:"timeline-deck deck",children:[e("header",{class:h==="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:()=>{N(!0)},disabled:h==="loading",children:e(v,{icon:"search",size:"l"})})})]})}),e("main",{children:[!!p&&!t&&e("div",{ref:J,class:`filter-bar ${h==="loading"?"loading":""}`,children:[!!c&&e(re,{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((L,P)=>L.type===c?-1:P.type===c?1:0).map(L=>e(re,{to:L.to,children:L.label},L.type))]}),p?e(R,{children:[(!c||c==="accounts")&&e(R,{children:[c!=="accounts"&&e("h2",{class:"timeline-header",children:["Accounts"," ",e(re,{to:`/search?q=${encodeURIComponent(p)}&type=accounts`,children:e(v,{icon:"arrow-right",size:"l"})})]}),y.length>0?e(R,{children:[e("ul",{class:"timeline flat accounts-list",children:y.map(L=>e("li",{children:e(Qe,{account:L,instance:o,showStats:!0,relationship:x[L.id]})},L.id))}),c!=="accounts"&&e("div",{class:"ui-state",children:e(re,{class:"plain button",to:`/search?q=${encodeURIComponent(p)}&type=accounts`,children:["See more accounts ",e(v,{icon:"arrow-right"})]})})]}):!c&&(h==="loading"?e("p",{class:"ui-state",children:e($e,{abrupt:!0})}):e("p",{class:"ui-state",children:"No accounts found."}))]}),(!c||c==="hashtags")&&e(R,{children:[c!=="hashtags"&&e("h2",{class:"timeline-header",children:["Hashtags"," ",e(re,{to:`/search?q=${encodeURIComponent(p)}&type=hashtags`,children:e(v,{icon:"arrow-right",size:"l"})})]}),w.length>0?e(R,{children:[e("ul",{class:"link-list hashtag-list",children:w.map(L=>{var j;const{name:P,history:F}=L,z=(j=F==null?void 0:F.reduce)==null?void 0:j.call(F,(V,D)=>V+ +D.uses,0);return e("li",{children:e(re,{to:o?`/${o}/t/${P}`:`/t/${P}`,children:[e(v,{icon:"hashtag"}),e("span",{children:P}),!!z&&e("span",{class:"count",children:je(z)})]})},`${P}-${z}`)})}),c!=="hashtags"&&e("div",{class:"ui-state",children:e(re,{class:"plain button",to:`/search?q=${encodeURIComponent(p)}&type=hashtags`,children:["See more hashtags ",e(v,{icon:"arrow-right"})]})})]}):!c&&(h==="loading"?e("p",{class:"ui-state",children:e($e,{abrupt:!0})}):e("p",{class:"ui-state",children:"No hashtags found."}))]}),(!c||c==="statuses")&&e(R,{children:[c!=="statuses"&&e("h2",{class:"timeline-header",children:["Posts"," ",e(re,{to:`/search?q=${encodeURIComponent(p)}&type=statuses`,children:e(v,{icon:"arrow-right",size:"l"})})]}),k.length>0?e(R,{children:[e("ul",{class:"timeline",children:k.map(L=>e("li",{children:e(re,{class:"status-link",to:o?`/${o}/s/${L.id}`:`/s/${L.id}`,children:e(Ue,{status:L})})},L.id))}),c!=="statuses"&&e("div",{class:"ui-state",children:e(re,{class:"plain button",to:`/search?q=${encodeURIComponent(p)}&type=statuses`,children:["See more posts ",e(v,{icon:"arrow-right"})]})})]}):!c&&(h==="loading"?e("p",{class:"ui-state",children:e($e,{abrupt:!0})}):e("p",{class:"ui-state",children:"No posts found."}))]}),!!c&&(h==="default"?f?e(ht,{onChange:L=>{L&&N()},children:e("button",{type:"button",class:"plain block",onClick:()=>N(),style:{marginBlockEnd:"6em"},children:"Show more…"})}):e("p",{class:"ui-state insignificant",children:"The end."}):h==="loading"&&e("p",{class:"ui-state",children:e($e,{abrupt:!0})}))]}):h==="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 Kr=20,Ts=10*60*1e3,Xr=ft(t=>t.v1.trends.links.list().next(),{maxAge:Ts}),Zr=ft(t=>t.v1.trends.tags.list().next(),{maxAge:Ts});function Jr(t){return Ve("@pixelfed/trending")?t.pixelfed.v2.discover.posts.trending.list({range:"daily"}):t.v1.trends.statuses.list({limit:Kr})}function Qr(t,n){return t.v1.timelines.link.list(n)}function xs({columnMode:t,...n}){const s=Ne($),i=t?{}:St(),{masto:o,instance:a}=ie({instance:(n==null?void 0:n.instance)||i.instance}),{masto:h,instance:u}=ie(),r=`Trending (${a})`;qe(r,"/:instance?/trending");const d=q(),p=a===u,[c,f]=A([]),[l,g]=A([]),m=q();async function k(L){var z;if(L||!m.current){if(m.current=Jr(o),Ve("@mastodon/trending-hashtags"))try{const{value:j}=await Zr(o);j!=null&&j.length&&f(j)}catch{}if(Ve("@mastodon/trending-links"))try{const{value:j}=await Xr(o,a),V=(z=j==null?void 0:j.filter)==null?void 0:z.call(j,D=>D.type==="link");V!=null&&V.length&&g(V)}catch{}}const P=await m.current.next();let{value:F}=P;return F!=null&&F.length&&(L&&(d.current=F[0].id),F.forEach(j=>{He(j,a)})),{...P,value:F}}const[b,y]=A(!1),T=q(),[w,S]=A(null),I=!!w,x=q(),U=p&&Ve("@mastodon/trending-hashtags");Z(()=>{w&&x.current&&x.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[w]);const M=q();async function N(L){(L||!T.current)&&(y(!0),T.current=Qr(o,{url:w})),M.current=w;const P=await T.current.next();let{value:F}=P;return F!=null&&F.length&&(F=wt(F,"public"),F.forEach(z=>{He(z,a)})),M.current===w&&y(!1),{...P,value:F}}async function te(){try{const L=await o.v1.trends.statuses.list({limit:1}).next();let{value:P}=L;return P=wt(P,"public"),P!=null&&P.length&&P[0].id!==d.current?(d.current=P[0].id,!0):!1}catch{return!1}}const J=me(()=>e(R,{children:[!!c.length&&e("div",{class:"filter-bar expandable",children:[e(v,{icon:"chart",class:"insignificant",size:"l"}),c.map((L,P)=>{const{name:F,history:z}=L,j=z.reduce((V,D)=>V+ +D.uses,0);return e(re,{to:`/${a}/t/${F}`,children:[e("span",{children:[e("span",{class:"more-insignificant",children:"#"}),F]}),e("span",{class:"filter-count",children:je(j)})]},F)})]}),!!l.length&&e("div",{class:"links-bar",children:[e("header",{children:e("h3",{children:"Trending News"})}),l.map(L=>{const{authorName:P,authorUrl:F,blurhash:z,description:j,height:V,image:D,imageDescription:se,language:G,providerName:de,providerUrl:he,publishedAt:le,title:ge,url:Te,width:Se}=L,Pe=Ut.toUnicode(URL.parse(Te).hostname.replace(/^www\./,"").replace(/\/$/,""));let Re;if(z){const Ae=Dn(z),Ie=Gn(Ae);Re=jn([.6,Ie[1],Ie[2]])}return e("div",{children:[e("a",{ref:w===Te?x:null,href:Te,target:"_blank",rel:"noopener noreferrer",class:I?w===Te?"active":"inactive":"",style:Re?{"--accent-color":`rgb(${Re.join(",")})`,"--accent-alpha-color":`rgba(${Re.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:D,alt:se,width:Se,height:V,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:Pe})," ",!!le&&e(R,{children:"· "}),!!le&&e(R,{children:e(It,{datetime:le,format:"micro"})})]}),!!ge&&e("h1",{class:"title",lang:G,dir:"auto",title:ge,children:ge})]}),!!j&&e("p",{class:"description",lang:G,dir:"auto",title:j,children:j})]})]})}),U&&e("button",{type:"button",class:"small plain4 block",onClick:()=>{S(Te)},disabled:Te===w,children:[e(v,{icon:"comment2"})," ",e("span",{children:"Mentions"})," ",e(v,{icon:"chevron-down"})]})]},Te)})]}),U&&!!l.length&&e("div",{class:`timeline-header-block ${I?"blended":""}`,children:I?e(R,{children:[e("div",{style:{width:50,flexShrink:0,textAlign:"center"},children:b?e($e,{abrupt:!0}):e("button",{type:"button",class:"light",onClick:()=>{S(null)},children:e(v,{icon:"x"})})}),e("p",{children:["Showing posts mentioning"," ",e("span",{class:"link-text",children:w.replace(/^https?:\/\/(www\.)?/i,"").replace(/\/$/,"")})]})]}):e("p",{class:"insignificant",children:"Trending posts"})})]}),[c,l,w,b]);return e(pt,{title:r,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:"Trending"}),e("div",{children:a})]}),id:"trending",instance:a,emptyText:"No trending posts.",errorText:"Unable to load posts",fetchItems:I?N:k,checkForUpdates:I?void 0:te,checkForUpdatesInterval:5*60*1e3,useItemID:!0,headerStart:e(R,{}),boostsCarousel:s.settings.boostsCarousel,filterContext:"public",timelineStart:J,refresh:w,clearWhenRefresh:!0,view:I?"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 L=prompt('Enter a new instance e.g. "mastodon.social"');if(!/\./.test(L)){L&&alert("Invalid instance");return}L&&(L=L.toLowerCase().trim(),location.hash=`/${L}/trending`)},children:[e(v,{icon:"bus"})," ",e("span",{children:"Go to another instance…"})]}),u!==a&&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}),")"]})]})]})},a)}function ec(){qe("Home","/");const t=Ne($),{shortcuts:n}=t,s=n.map(i=>{if(!i)return null;const{type:o,...a}=i,h={following:Kn,notifications:Is,list:bs,public:An,bookmarks:fs,favourites:ps,hashtag:gs,mentions:ws,trending:xs,search:Cs}[o];return!h||o==="search"&&!a.query||o==="list"&&!a.id?null:e(h,{...a,columnMode:!0},o+JSON.stringify(a))});return Le(["1","2","3","4","5","6","7","8","9"],(i,o)=>{try{const a=parseInt(o.keys[0],10)-1;document.querySelectorAll("#columns > *")[a].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 tc(){var n;const t=Ne($);return Z(()=>{(async()=>{const s=await st.drafts.keys();if(s.length){const i=rn();s.filter(a=>a.startsWith(i)).length&&($.showDrafts=!0)}})()},[]),e(R,{children:(t.settings.shortcutsViewMode==="multi-column"||!t.settings.shortcutsViewMode&&t.settings.shortcutsColumnsMode)&&((n=t.shortcuts)!=null&&n.length)?e(ec,{}):e(Kn,{title:"Home",path:"/",id:"home",headerStart:!1,headerEnd:e(nc,{})})})}function nc(){const t=Ne($),n=q(),[s,i]=A(void 0);return e(R,{children:[e(re,{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(a=>a?void 0:"open"))},children:e(v,{icon:"notification",size:"l",alt:"Notifications"})}),e(sc,{state:s,anchorRef:n,onClose:()=>i(void 0)})]})}const ic=5;function sc({anchorRef:t,state:n,onClose:s}){const{masto:i,instance:o}=ie(),a=Ne($),[h,u]=A("default"),r=ks();async function d(){const g=await r.next(),m=g.value;if(m!=null&&m.length){m.forEach(b=>{He(b.status,o,{skipThreading:!0})});const k=Ss(m);$.notificationsLast=k[0],$.notifications=k,i.v1.markers.create({notifications:{lastReadId:k[0].id}}).catch(()=>{})}return $.notificationsShowNew=!1,$.notificationsLastFetchTime=Date.now(),g}const[p,c]=A(!1);function f(){return i.v1.followRequests.list({limit:1})}function l(){u("loading"),(async()=>{try{await d();const g=await f();c(!!(g!=null&&g.length)),u("default")}catch{u("error")}})()}return Z(()=>{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:a.notifications.length?e(R,{children:a.notifications.slice(0,ic).map(g=>e(mn,{instance:o,notification:g,disableContextMenu:!0},g._ids||g.id))}):h==="loading"?e("div",{class:"ui-state",children:e($e,{abrupt:!0})}):h==="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(re,{to:"/mentions",class:"button plain",children:[e(v,{icon:"at"})," ",e("span",{children:"Mentions"})]}),e(re,{to:"/notifications",class:"button plain2",children:[p?e(R,{children:[e("span",{class:"tag collapsed",children:"New"})," ",e("span",{children:"Follow Requests"})]}):e("b",{children:"See all"})," ",e(v,{icon:"arrow-right"})]})]})]})}const oc=Je(tc),ac=[/^\/@[^@\/]+\/(?:statuses|posts)\/([^\/]+)/i,/\/notes\/([^\/]+)/i,/^\/(?:notice|objects)\/([a-z0-9-]+)/i,/\/@[^@\/]+@?[^\/]+?\/([^\/]+)/i,/^\/p\/[^\/]+\/([^\/]+)/i];function $s(t){const{hostname:n,pathname:s}=URL.parse(t);for(const i of ac){const[,o]=s.match(i)||[];if(o)return{instance:n,id:o}}return{}}function rc(t){const{instance:n,id:s}=$s(t);return n&&s?`/${n}/s/${s}`:null}function cc(){const n=Pt().pathname.replace(/^\//,""),s=$s(n),i=s!=null&&s.instance?`/${s.instance}/s/${s.id}`:null,[o,a]=A("loading");return ut(()=>{a("loading"),(async()=>{try{const{instance:h,id:u}=s,{masto:r}=ie({instance:h});if(await r.v1.statuses.$select(u).fetch()){window.location.hash=i+"?view=full";return}}catch{}{const{masto:h,instance:u}=ie(),r=await h.v2.search.fetch({q:n,limit:1,resolve:!0});if(r.statuses.length){const d=r.statuses[0];window.location.hash=`/${u}/s/${d.id}?view=full`}else if(r.accounts.length){const d=r.accounts[0];window.location.hash=`/${u}/a/${d.id}`}else i?window.location.hash=i+"?view=full":a("error")}})()},[i]),e("div",{class:"ui-state",tabIndex:"-1",children:[o==="loading"?e(R,{children:[e($e,{abrupt:!0}),e("h2",{children:"Resolving…"}),e("p",{children:e("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:n})})]}):e(R,{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(re,{to:"/",children:"Go home"})})]})}function lc(){qe("Lists","/l");const[t,n]=A("default"),[s,i]=kt(r=>r+1,0),[o,a]=A([]);Z(()=>{n("loading"),(async()=>{try{const r=await xn();a(r),n("default")}catch{n("error")}})()},[s]);const[h,u]=A(!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(re,{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(R,{children:[e("ul",{class:"link-list",children:o.map(r=>e("li",{children:e(re,{to:`/l/${r.id}`,children:e("span",{children:[e(v,{icon:"list"})," ",e("span",{children:r.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."})})]}),h&&e(_e,{onClick:r=>{r.target===r.currentTarget&&u(!1)},children:e(Vn,{list:h==null?void 0:h.list,onClose:r=>{r.state==="success"&&i(),u(!1)}})})]})}const dc=""+new URL("instances-MzK7fGXv.json",import.meta.url).href;var uc={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:hc,PHANPY_WEBSITE:fc}=uc,Xn="read write follow push";async function pc({instanceURL:t}){const n=new URLSearchParams({client_name:hc,redirect_uris:location.origin+location.pathname,scopes:Xn,website:fc});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 mc({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 gc({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 bc={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:yc}=bc;function wc(){var y,T;qe("Log in");const t=q(),n=we.local.get("instanceURL"),[s,i]=A("default"),[o]=ot(),a=o.get("instance"),h=o.get("submit"),[u,r]=A(a||(n==null?void 0:n.toLowerCase())||""),[d,p]=A([]),c=q();Z(()=>{(async()=>{try{const S=await(await fetch(dc)).json();p(S),c.current=new oo(S)}catch{}})()},[]);const f=w=>{w&&(we.local.set("instanceURL",w),(async()=>{i("loading");try{const{client_id:S,client_secret:I,vapid_key:x}=await pc({instanceURL:w});S&&I?(we.session.set("clientID",S),we.session.set("clientSecret",I),we.session.set("vapidKey",x),location.href=await mc({instanceURL:w,client_id:S})):alert("Failed to register application"),i("default")}catch{i("error")}})())},l=u?u.replace(/^https?:\/\//,"").replace(/\/+$/,"").replace(/^@?[^@]+@/,"").trim():null,g=/[^\s\r\n\t\/\\]+\.[^\s\r\n\t\/\\]+/.test(l)&&!/[\s\/\\@]/.test(l),m=l?(T=(y=c.current)==null?void 0:y.search(l,{limit:10}))==null?void 0:T.map(w=>w.item):[],k=g?l:m!=null&&m.length?m[0]:u?d.find(w=>w.includes(u)):null,b=w=>{w.preventDefault(),f(k)};return h&&Z(()=>{f(a||k)},[]),e("main",{id:"login",style:{textAlign:"center"},children:e("form",{onSubmit:b,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=>{r(w.target.value)}}),(m==null?void 0:m.length)>0?e("ul",{id:"instances-suggestions",children:m.map((w,S)=>e("li",{children:e("button",{type:"button",class:"plain5",onClick:()=>{f(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||!k,children:k?`Continue with ${k}`:"Continue"})," "]}),e($e,{hidden:s!=="loading"}),e("hr",{}),!yc&&e("p",{children:e("a",{href:"https://joinmastodon.org/servers",target:"_blank",children:"Don't have an account? Create one!"})}),e("p",{children:e(re,{to:"/",children:"Go home"})})]})})}const en=40,vc=10,kc=5;let _n={},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 ~ * *)",_i=/\/s\//i;function Sc(t){var w;const{id:n}=t,{masto:s,instance:i}=ie({instance:t.instance}),o=Ne($),[a,h]=ot(),u=a.get("media"),r=a.get("media-only"),d=parseInt(u||r,10);let p=d>0;const c=a.get("mediaStatusID"),f=zi(c,i);c&&!f&&(p=!1);const l=p&&!!r,g=Xe(n,i),[m,k]=A($.statuses[g]);Z(()=>{$.statuses[g]&&k($.statuses[g])},[g]);const b=me(()=>{const{prevLocation:S}=$,I=((S==null?void 0:S.pathname)||"")+((S==null?void 0:S.search)||""),x=qt("/:instance/s/:id",I)||qt("/s/:id",I);return!I||x?"/":I},[]);Z(()=>{!m&&p&&(async()=>{try{const S=await s.v1.statuses.$select(n).fetch();He(S,i),k(S)}catch{alert("Unable to load post."),location.hash=b}})()},[p]);const y=c?(w=o.statuses[Xe(c,i)])==null?void 0:w.mediaAttachments:m==null?void 0:m.mediaAttachments,T=et(()=>{!window.matchMedia("(min-width: calc(40em + 350px))").matches&&o.prevLocation?history.back():l?location.hash=b:(a.delete("media"),a.delete("mediaStatusID"),h(a))},[l,b,o.prevLocation]);return Z(()=>{let S=setTimeout(()=>{const I=document.querySelector(".carousel");I&&I.focus()},100);return()=>clearTimeout(S)},[l]),Z(()=>{const S=document.querySelectorAll(".deck-container");return S.forEach(I=>{I.setAttribute("inert","")}),()=>{S.forEach(I=>{I.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:T}):e("div",{class:"media-modal-container loading",children:e($e,{abrupt:!0})}):e(re,{to:b}),!l&&e(Cc,{id:n,instance:t.instance,closeLink:b})]})}function Ic(t){const{linkable:n,to:s,onClick:i,...o}=t;return n?e(re,{class:"status-link",to:s,onClick:i,...o}):e("div",{class:"status-focus",tabIndex:0,...o})}function Cc({id:t,closeLink:n="/",instance:s}){var E,W;const[i,o]=ot(),a=i.get("media"),h=i.get("mediaStatusID"),u=parseInt(a,10)>0,r=q(!$.prevLocation&&(history.length===1||"navigation"in window&&((W=(E=navigation==null?void 0:navigation.entries)==null?void 0:E.call(navigation))==null?void 0:W.length)===1)),[d,p]=A(i.get("view")||r.current?"full":null),c=!!parseInt(i.get("translate")),{masto:f,instance:l}=ie({instance:s}),{masto:g,instance:m,authenticated:k}=ie(),b=l===m,y=Ne($),[T,w]=A([]),[S,I]=A("default"),x=q(),U=Xe(t,l),M=q(0),N=q();Z(()=>{var _;(_=N.current)==null||_.focus()},[]),Z(()=>{var B;const _=Xi(()=>{if(!N.current)return;const{scrollTop:Q}=N.current;S!=="loading"&&(on[t]=Q)},50);return(B=N.current)==null||B.addEventListener("scroll",_,{passive:!0}),_(),()=>{var Q;_.cancel(),(Q=N.current)==null||Q.removeEventListener("scroll",_)}},[t,S!=="loading"]);const te=q(),J=q(),L=({reloadHero:_}={})=>{I("loading");let B;const Q=sn[t];if(Q){const ue=Q.filter(De=>$.statuses[U]);w(ue)}else w([{id:t}]);return(async()=>{var Y,H;const ue=()=>si(()=>f.v1.statuses.$select(t).fetch(),{retries:4}),De=si(()=>f.v1.statuses.$select(t).context.fetch(),{retries:8}),C=!!y.statuses[U];let O=y.statuses[U];if(!(C&&!_))try{O=await ue(),He(O,l),await new Promise(ne=>{setTimeout(ne,100)})}catch{I("error");return}try{let ne=function(X){return X==null?void 0:X.map(ke=>({id:ke.id,account:ke.account,repliesCount:ke.repliesCount,content:ke.content,weight:Ht(ke),replies:ne(ke.__replies)}))};const ye=await De,{ancestors:fe,descendants:ce}=ye;M.current=(ce==null?void 0:ce.length)||0;const Ce=new Set;fe.forEach(X=>{He(X,l,{skipThreading:!0}),X.inReplyToId&&!fe.find(ke=>ke.id===X.inReplyToId)&&Ce.add(X.inReplyToId)});const Oe=fe.every(X=>X.account.id===O.account.id),ze=[];ce.forEach(X=>{if(He(X,l,{skipThreading:!0}),X.inReplyToId&&!ce.find(ke=>ke.id===X.inReplyToId)&&X.inReplyToId!==O.id&&Ce.add(X.inReplyToId),X.inReplyToAccountId===X.account.id)ze.push(X);else if(X.inReplyToId===O.id)ze.push(X);else if(!X.inReplyToAccountId&&ze.find(ke=>ke.id===X.inReplyToId)&&X.account.id===O.account.id)ze.push(X);else{const ke=ce.find(it=>it.id===X.inReplyToId);ke&&(ke.__replies||(ke.__replies=[]),ke.__replies.push(X))}}),Ce.size;const Me=[...fe.map(X=>({id:X.id,ancestor:!0,isThread:Oe,accountID:X.account.id,account:X.account,repliesCount:X.repliesCount,weight:Ht(X)})),{id:t,accountID:O.account.id,weight:Ht(O)},...ze.map(X=>({id:X.id,account:X.account,accountID:X.account.id,descendant:!0,thread:X.account.id===O.account.id,weight:Ht(X),replies:ne(X.__replies)}))];I("default"),te.current={offsetTop:(Y=x.current)==null?void 0:Y.offsetTop,scrollTop:(H=N.current)==null?void 0:H.scrollTop};const Ge=Me.findIndex(X=>X.id===t);Ge>=G&&de(Ge+1),w(Me),sn[t]=Me,Fs(O,l)}catch{I("error")}})(),J.current=Date.now(),()=>{clearTimeout(B)}};Z(L,[t,f]);const[P,F]=A(!1);Z(()=>{let _=setInterval(()=>{const B=Date.now();J.current&&B-J.current>=6e4&&F(!0)},6e4);return()=>{clearInterval(_)}},[]),ut(()=>{var B,Q;if(!T.length)return;const _=on[t];if(_)N.current.scrollTop=_;else if(te.current){const ue={offsetTop:(B=x.current)==null?void 0:B.offsetTop,scrollTop:(Q=N.current)==null?void 0:Q.scrollTop},De=ue.offsetTop-te.current.offsetTop+ue.scrollTop;N.current.scrollTop=De}else T.length===1&&(N.current.scrollTop=0);te.current=null},[T]),Z(()=>{y.reloadStatusPage<=0||(async()=>{try{const{instanceURL:_}=Rt(),B=`https://${_}/api/v1/statuses/${t}/context`;return await(await caches.open("api")).delete(B,{ignoreVary:!0}),L({reloadHero:!0})}catch{}})()},[y.reloadStatusPage]),Z(()=>()=>{on={},$.reloadStatusPage=0,sn={},_n={},Rn.clear()},[]);const z=y.statuses[U]||y.statuses[t],j=me(()=>{if(!z)return"";const{account:_}=z,B=document.createElement("div");return B.innerHTML=_.displayName,B.innerText.trim()},[z]),V=me(()=>{if(!z)return"";let _=Pn(z);return _.length>64&&(_=_.slice(0,64)+"…"),_},[z]);qe(j&&V?`${j}: "${V}"`:"Status","/:instance?/s/:id");const D=me(()=>{if(!z)return;const{url:_}=z;if(_)return URL.parse(_).hostname},[z]),se=me(()=>{if(D)return D===l},[D,l]),[G,de]=A(en),he=me(()=>T.length-G,[T.length,G]),le=T.some(_=>_.descendant),ge=T.filter(_=>_.ancestor),[Te,Se]=A(!0),Pe=me(()=>{if(!x.current||Te)return null;const{top:_}=x.current.getBoundingClientRect();return _>0?"down":"up"},[Te]);Le("esc",()=>{location.hash=n},{enabled:!u,ignoreEventWhen:_=>!!document.querySelector("#modal-container > *")}),Le("backspace",()=>{location.hash=n}),Le("j",()=>{const _=document.activeElement.closest(".status-link, .status-focus"),B=_==null?void 0:_.getBoundingClientRect(),Q=Array.from(N.current.querySelectorAll(Ai));if(_&&B.top<N.current.clientHeight&&B.bottom>0){const ue=Q.indexOf(_);let De=Q[ue+1];De&&(De.focus(),De.scrollIntoView(Ft))}else{const ue=Q.find(De=>{const C=De.getBoundingClientRect();return C.top>=44&&C.left>=0});ue&&(ue.focus(),ue.scrollIntoView(Ft))}}),Le("k",()=>{const _=document.activeElement.closest(".status-link, .status-focus"),B=_==null?void 0:_.getBoundingClientRect(),Q=Array.from(N.current.querySelectorAll(Ai));if(_&&B.top<N.current.clientHeight&&B.bottom>0){const ue=Q.indexOf(_);let De=Q[ue-1];De&&(De.focus(),De.scrollIntoView(Ft))}else{const ue=Q.find(De=>{const C=De.getBoundingClientRect();return C.top>=44&&C.left>=0});ue&&(ue.focus(),ue.scrollIntoView(Ft))}}),Le("x",()=>{const _=document.activeElement.closest(".status-link, .status-focus");if(_){const B=_.nextElementSibling;B&&B.tagName.toLowerCase()==="details"&&(B.open=!B.open)}});const[Re,Ae]=A(!1),Ie=q(u?"media+status":"status"),xe=et((_,B,Q,ue)=>{_.preventDefault(),_.stopPropagation(),o({media:B+1,mediaStatusID:ue.id})},[t]),ve=et((_,B)=>{an(B.id)},[]);Z(()=>{let _;return h&&u&&(_=setTimeout(()=>{var Q;const B=(Q=N.current)==null?void 0:Q.querySelector(`.status-link[href*="/${h}"]`);B&&B.scrollIntoView(Ft)},400)),()=>{clearTimeout(_)}},[h,u]);const ee=et((_,B)=>{const{id:Q,ancestor:ue,isThread:De,descendant:C,thread:O,replies:Y,repliesCount:H,weight:ne}=_,ye=Q===t;return e("li",{ref:ye?x:null,class:`${ue?"ancestor":""} ${C?"descendant":""} ${O?"thread":""} ${ye?"hero":""}`,children:[ye?e(R,{children:[e(ht,{threshold:.1,onChange:ce=>{queueMicrotask(()=>{requestAnimationFrame(()=>{Se(ce)})})},class:"status-focus",tabIndex:0,children:e(Ue,{statusID:Q,instance:l,withinContext:!0,size:"l",enableTranslate:!0,forceTranslate:c})}),S!=="loading"&&!k?e("div",{class:"post-status-banner",children:[e("p",{children:"You're not logged in. Interactions (reply, boost, etc) are not possible."}),e(re,{to:"/login",class:"button",children:"Log in"})]}):!b&&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:S==="loading",onClick:()=>{I("loading"),(async()=>{try{const ce=await g.v2.search.fetch({q:z.url,type:"statuses",resolve:!0,limit:1});if(ce.statuses.length){const Ce=ce.statuses[0];location.hash=m?`/${m}/s/${Ce.id}`:`/s/${Ce.id}`}else throw new Error("No results")}catch(ce){I("default"),alert("Error: "+ce)}})()},children:[e(v,{icon:"transfer"})," Switch to my instance to enable interactions"]})]})]}):e(Ic,{linkable:De||ue,to:l?`/${l}/s/${Q}`:`/s/${Q}`,onClick:()=>{an(Q)},children:[B===0&&ue?e(ht,{threshold:.5,onChange:ce=>{queueMicrotask(()=>{requestAnimationFrame(()=>{Ae(ce)})})},children:e(Ue,{statusID:Q,instance:l,withinContext:!0,size:O||ue?"m":"s",enableTranslate:!0,onMediaClick:xe,onStatusLinkClick:ve})}):e(Ue,{statusID:Q,instance:l,withinContext:!0,size:O||ue?"m":"s",enableTranslate:!0,onMediaClick:xe,onStatusLinkClick:ve,showActionsBar:!!C}),ue&&H>1&&e("div",{class:"replies-link",children:[e(v,{icon:"comment2"})," ",e("span",{title:H,children:je(H)})]})," "]}),C&&(Y==null?void 0:Y.length)>0&&e(As,{instance:l,replies:Y,hasParentThread:O,level:1,accWeight:ne,openAll:M.current<vc,parentLink:{to:l?`/${l}/s/${Q}`:`/s/${Q}`,onClick:()=>an(Q)}}),S==="loading"&&ye&&!!(z!=null&&z.repliesCount)&&!le&&e("div",{class:"status-loading",children:e($e,{abrupt:z.repliesCount>=3})}),S==="error"&&ye&&!!(z!=null&&z.repliesCount)&&!le&&e("div",{class:"status-error",children:["Unable to load replies.",e("br",{}),e("button",{type:"button",class:"plain",onClick:()=>{$.reloadStatusPage++},children:"Try again"})]})]},Q)},[t,l,S,k,b,c,xe,ve,le]),be=me(()=>{var _;if("navigation"in window&&(navigation!=null&&navigation.entries)){const B=navigation.entries()[navigation.currentEntry.index-1];if(B!=null&&B.url)return _i.test(B.url)}return _i.test((_=$.prevLocation)==null?void 0:_.pathname)},[U]),ae=me(()=>{if(!he)return[];const _=[];function B(Q){_.push(Q.id),Q.replies&&Q.replies.forEach(B)}return T.slice(G).forEach(B),_.map(Q=>Xe(Q,l))},[he,T,G,l]),K=me(()=>T.slice(0,G).map(ee),[T,G,ee]);return Z(()=>{let _=setTimeout(()=>{if(!x.current)return;const B=x.current.querySelector(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)");B&&B.click()},1e3);return()=>clearTimeout(_)},[t]),e("div",{tabIndex:"-1",ref:N,class:`status-deck deck contained ${T.length>1?"padded-bottom":""} ${Ie.current==="status"&&!r.current?"slide-in":""} ${d?`deck-view-${d}`:""}`,onAnimationEnd:_=>{Ie.current==="status"&&(Ie.current=null)},children:[e("header",{class:`${S==="loading"?"loading":""}`,onDblClick:_=>{$.reloadStatusPage++},children:e("div",{class:"header-grid header-grid-2",children:[e("h1",{children:[be&&e("button",{type:"button",class:"plain deck-back",onClick:()=>{history.back()},children:e(v,{icon:"chevron-left",size:"xl"})}),!Te&&z&&S!=="loading"?e(R,{children:[e("span",{class:"hero-heading",children:[e(Et,{account:z.account,instance:l,showAvatar:!0,short:!0})," ",e("span",{class:"insignificant",children:["•"," ",e(It,{datetime:z.createdAt,format:"micro"})]})]})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:_=>{_.preventDefault(),_.stopPropagation(),x.current.scrollIntoView({behavior:"smooth",block:"start"})},title:"Go to main post",children:e(v,{icon:Pe==="down"?"arrow-down":"arrow-up"})})]}):e(R,{children:["Post"," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:_=>{_.preventDefault(),_.stopPropagation(),N.current.scrollTo({top:0,behavior:"smooth"})},hidden:!ge.length||Re,title:`${ge.length} posts above Go to top`,children:[e(v,{icon:"arrow-up"}),ge.filter((_,B,Q)=>Q.findIndex(ue=>ue.accountID===_.accountID)===B).slice(0,3).map(_=>e(nt,{url:_.account.avatar,alt:_.account.displayName},_.account.id)),ge.length>3&&e(R,{children:[" ",e("span",{class:"insignificant",children:je(ge.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"})}),P&&e("button",{type:"button",class:"plain button-refresh",onClick:()=>{$.reloadStatusPage++,F(!1)},children:e(v,{icon:"refresh",size:"l"})}),e(Ze,{align:"end",portal:{target:N.current},menuButton:e("button",{type:"button",class:"button plain4",children:e(v,{icon:"more",alt:"Actions",size:"xl"})}),children:[e(pe,{disabled:S==="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(N.current.querySelectorAll(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)")).forEach(B=>{B.click()})},children:[e(v,{icon:"eye-open"})," ",e("span",{children:"Show all sensitive content"})]}),e(Be,{}),e(Ki,{className:"plain",children:"Experimental"}),e(pe,{disabled:!D||se,onClick:()=>{const _=rc(z.url);_?location.hash=_:alert("Unable to switch")},children:[e(v,{icon:"transfer"}),e("small",{class:"menu-double-lines",children:["Switch to post's instance",D?e(R,{children:[" ","(",e("b",{children:Ut.toUnicode(D)}),")"]}):""]})]})]}),e(re,{class:"button plain deck-close",to:n,children:e(v,{icon:"x",size:"xl"})})]})]})}),T.length&&z?e("ul",{class:`timeline flat contextual grow ${S==="loading"?"loading":""}`,children:[K,he>0&&e("li",{children:e("button",{type:"button",class:"plain block show-more",disabled:S==="loading",onClick:()=>de(_=>_+en),style:{marginBlockEnd:"6em"},"data-state-post-ids":ae.join(" "),children:[e("div",{class:"ib avatars-bunch",children:T.slice(G,G+5).map(_=>e(nt,{url:_.account.avatarStatic},_.id))})," ",e("div",{class:"ib",children:["Show more…"," ",e("span",{class:"tag",children:he>en?`${en}+`:he})]})]})})]}):e(R,{children:[S==="loading"&&e("ul",{class:"timeline flat contextual grow loading",children:e("li",{children:e(Ue,{skeleton:!0,size:"l"})})}),S==="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 As({replies:t,instance:n,hasParentThread:s,level:i,accWeight:o,openAll:a,parentLink:h}){const[u,r]=ot(),d=y=>y.reduce((T,w)=>{const{repliesCount:S,replies:I}=w,x=(I==null?void 0:I.length)||S;return T+x+d(I||[])},0),p=t.length+d(t),c=t.length===p,f=t.map(y=>y.account).filter((y,T,w)=>w.findIndex(S=>S.id===y.id)===T).slice(0,3),l=me(()=>t==null?void 0:t.reduce((y,T)=>y+(T==null?void 0:T.weight),o),[o,t==null?void 0:t.length]);let g=!1;(a||l<=kc||!s&&p===1&&Ht(t[0])<2)&&(g=!0);const m=_n[t[0].id],k=et((y,T,w,S)=>{y.preventDefault(),y.stopPropagation(),r({media:T+1,mediaStatusID:S.id})},[]),b=q();return ut(()=>{var T;function y(w){w.target.dataset.scrollLeft=w.target.scrollLeft}return(T=b.current)==null||T.addEventListener("scroll",y,{passive:!0}),()=>{var w;(w=b.current)==null||w.removeEventListener("scroll",y)}},[]),e("details",{ref:b,class:"replies",open:m||g,onToggle:y=>{const{open:T}=y.target;_n[t[0].id]=T},style:{"--comments-level":i},"data-comments-level":i,"data-comments-level-overflow":i>4,children:[e("summary",{class:"replies-summary",hidden:g,children:[e("span",{class:"avatars",children:f.map(y=>e(nt,{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(R,{children:[" ","·"," ",e("span",{children:[e("span",{title:p,children:je(p)})," ","comment",p===1?"":"s"]})]})]}),e(v,{icon:"chevron-down",class:"replies-summary-chevron"}),!!h&&e(re,{class:"replies-parent-link",to:h.to,onClick:h.onClick,title:"View post with its replies",children:"»"})]}),e("ul",{children:t.map(y=>{var T,w;return e("li",{children:[e("div",{class:"status-focus",tabIndex:0,children:[e(Ue,{statusID:y.id,instance:n,withinContext:!0,size:"s",enableTranslate:!0,onMediaClick:k,showActionsBar:!0}),!((T=y.replies)!=null&&T.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(As,{instance:n,replies:y.replies,level:i+1,accWeight:g?l:y.weight,openAll:a,parentLink:{to:n?`/${n}/s/${y.id}`:`/s/${y.id}`,onClick:()=>{an(y.id)}}})]},y.id)})})]})}const Tc=140,xc=35,$c=70,Ac=140,Rn=new Map;function Ht(t){var l,g;const n=Rn.get(t.id);if(n)return n;const{spoilerText:s,content:i,mediaAttachments:o,poll:a,card:h}=t,u=Wi(s+i),r=o!=null&&o.length?Tc:0,d=(((l=a==null?void 0:a.options)==null?void 0:l.length)||0)*xc,p=h&&(o!=null&&o.length||(g=a==null?void 0:a.options)!=null&&g.length)?0:$c,f=(u+r+d+p)/Ac;return Rn.set(t.id,f),f}const _c=Je(Sc);function Rc(){const t=St(),{id:n,instance:s}=t;return e(_c,{id:n,instance:s})}const Ec=""+new URL("boosts-carousel-YjmjXTE6.jpg",import.meta.url).href,Lc=""+new URL("grouped-notifications-xYMFVY91.jpg",import.meta.url).href,Mc=""+new URL("multi-column-ETnJNDVb.jpg",import.meta.url).href,Nc=""+new URL("multi-hashtag-timeline-x-SDVR4g.jpg",import.meta.url).href,Dc=""+new URL("nested-comments-thread-Ib-fZGS3.jpg",import.meta.url).href,Pc="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 Uc={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:Ri,PHANPY_PRIVACY_POLICY_URL:Oc,PHANPY_DEFAULT_INSTANCE_REGISTRATION_URL:Ei}=Uc,Li=Ri?Ri.replace(/https?:\/\//g,"").replace(/\/$/,""):null,Mi=`${"2024-07-22T10:39:10.061Z".slice(0,10).replace(/-/g,".")}.81e330d`;function Ni(){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:Pc,alt:"Phanpy",width:"200"})]}),e("p",{class:"desc",children:"A minimalistic opinionated Mastodon web client."}),e("p",{children:e(re,{to:zt?`/login?instance=${zt}&submit=1`:"/login",class:"button",children:zt?"Log in":"Log in with Mastodon"})}),zt&&Ei&&e("p",{children:e("a",{href:Ei,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:Oc,target:"_blank",children:"Privacy Policy"}),"."]})]}),e("div",{id:"why-container",children:e("div",{class:"sections",children:[e("section",{children:[e("img",{src:Ec,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:Dc,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:Lc,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:Mc,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:Nc,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 Fc=window.alert;window.__nativeAlert||(window.__nativeAlert=Fc);window.alert=function(t){t instanceof Error&&(t!=null&&t.message)&&(t=t.message),typeof t!="string"&&(t=JSON.stringify(t));const n=ao({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}=ie();for(const a in t){if(!window.__IDLE__)break;try{const h=document.querySelector(`[data-state-post-id~="${a}"], [data-state-post-ids~="${a}"]`),u=s.some(r=>{var d;return a===Xe((d=r.status)==null?void 0:d.id,o)});if(!h&&!u){delete $.statuses[a],delete $.statusQuotes[a];for(const r in n){const d=n[r];if(Xe(d.id,d.instance)===a){delete $.unfurledLinks[r];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(a=>{window.addEventListener(a,o,{passive:!0,capture:!0})}),window.addEventListener("blur",n,{passive:!0}),document.documentElement.addEventListener("mouseleave",a=>{!a.relatedTarget&&!a.toElement&&n()},{passive:!0})})();const zc=/iPad|iPhone|iPod/.test(navigator.userAgent);zc&&document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible"){const t=we.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=we.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=we.local.get("textSize");n&&document.documentElement.style.setProperty("--text-size",`${n}px`)}Oi($,t=>{var n;for(const[s,i,o,a]of t){if(i.join(".")==="settings.shortcutsViewMode"){const h=document.getElementById("app");h&&(h.dataset.shortcutsViewMode=(n=$.shortcuts)!=null&&n.length?o:"")}i.join(".")==="settings.cloakMode"&&document.body.classList.toggle("cloak",o)}});function Bc(){const[t,n]=A(!1),[s,i]=A("loading");Z(()=>{const a=we.local.get("instanceURL"),h=decodeURIComponent((window.location.search.match(/code=([^&]+)/)||[,""])[1]);if(h){window.history.replaceState({},document.title,window.location.pathname||"/");const u=we.session.get("clientID"),r=we.session.get("clientSecret"),d=we.session.get("vapidKey");(async()=>{i("loading");const{access_token:p}=await gc({instanceURL:a,client_id:u,client_secret:r,code:h}),c=zs({instance:a,accessToken:p});await Promise.allSettled([Zn(c),Jn(c,a),Bs(c,a,p,d)]),Qn(),n(!0),i("default")})()}else{window.__IGNORE_GET_ACCOUNT_ERROR__=!0;const u=Rt();if(u){Pi(u.info.id);const{client:r}=ie({account:u}),{instance:d}=r;Qn(),i("loading"),(async()=>{try{await Zn(r),await Jn(r,d)}catch{}finally{n(!0),i("default")}})()}else i("default")}},[]);let o=Pt();return $.currentLocation=o.pathname,Z(Tn,[o,t]),/\/https?:/.test(o.pathname)?e(cc,{}):e(R,{children:[e(Hc,{isLoggedIn:t,loading:s==="loading"}),e(qc,{isLoggedIn:t}),s==="default"&&e(Ln,{children:e(Fe,{path:"/:instance?/s/:id",element:e(Rc,{})})}),t&&e(ho,{}),t&&e(Pa,{}),e(_a,{}),t&&e(Ma,{}),e(uo,{isLoggedIn:t}),s!=="loading"&&e(Na,{onClose:Tn}),e(fo,{})]})}function Hc({isLoggedIn:t,loading:n}){const s=Pt(),i=me(()=>{const{pathname:o}=s;return!/^\/(login|welcome)/i.test(o)},[s]);return e(Ln,{location:i||s,children:[e(Fe,{path:"/",element:t?e(oc,{}):n?e($e,{id:"loader-root"}):e(Ni,{})}),e(Fe,{path:"/login",element:e(wc,{})}),e(Fe,{path:"/welcome",element:e(Ni,{})})]})}function Di(){return $.prevLocation||null}function qc({isLoggedIn:t}){const n=Pt(),s=q(Di());return me(()=>qt("/:instance/s/:id",n.pathname)||qt("/s/:id",n.pathname),[n.pathname,qt])?s.current||(s.current=Di()):s.current=null,e(Ln,{location:s.current||n,children:[t&&e(R,{children:[e(Fe,{path:"/notifications",element:e(Is,{})}),e(Fe,{path:"/mentions",element:e(ws,{})}),e(Fe,{path:"/following",element:e(Kn,{})}),e(Fe,{path:"/b",element:e(fs,{})}),e(Fe,{path:"/f",element:e(ps,{})}),e(Fe,{path:"/l",children:[e(Fe,{index:!0,element:e(lc,{})}),e(Fe,{path:":id",element:e(bs,{})})]}),e(Fe,{path:"/fh",element:e(xr,{})}),e(Fe,{path:"/ft",element:e(Sr,{})}),e(Fe,{path:"/catchup",element:e(cr,{})})]}),e(Fe,{path:"/:instance?/t/:hashtag",element:e(gs,{})}),e(Fe,{path:"/:instance?/a/:id",element:e(Ja,{})}),e(Fe,{path:"/:instance?/p",children:[e(Fe,{index:!0,element:e(An,{})}),e(Fe,{path:"l",element:e(An,{local:!0})})]}),e(Fe,{path:"/:instance?/trending",element:e(xs,{})}),e(Fe,{path:"/:instance?/search",element:e(Cs,{})})]})}qs(e(Hs,{children:e(Bc,{})}),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-FOJmGvRC.js.map