Files
phanpy-cz/assets/main-BcxE7N7D.js
2025-06-13 21:22:20 +02:00

37 lines
308 KiB
JavaScript
Raw 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 j,y as Q,M as ut,u as le,d as M,s as x,a as re,b as et,p as bt,c as We,q as it,g as kt,e,k as U,T as f,f as ri,h as Lt,i as Yt,j as In,l as Ae,L as _o,C as Kn,D as Co,n as Ue,o as Io,r as Tn,t as li,v as To,w as bs,x as Jt,z as pe,B as Ao,E as Be,F as An,G as Mi,_ as St,H as vs,I as Od,J as ws,K as ks,N as xo,O as Eo,P as lt,Q as Ro,R as di,S as Lo,U as vt,V as Mo,W as $o,X as ui,Y as Mt,Z as tt,$ as Ss,a0 as _s,a1 as No,a2 as Cs,a3 as Po,a4 as Do,a5 as cn,a6 as Oo,a9 as zo,aa as Hn,ab as qn,ac as Uo,ad as $i,ae as Bo,af as Fo,ag as Ko,ah as hi,ai as Xe,ak as Ho,al as qo,am as Yo,an as jo}from"./useTitle-B3g1dZoe.js";import{u as fi,w as qe,s as fe,o as Ni,a as Vo,V as Is,b as Ts,I,C as pi,c as As,M as je,d as Ve,S as dn,e as ye,f as Nn,R as _t,n as ct,g as Ye,A as mt,N as yt,h as dt,i as pt,L as ge,l as Et,j as Go,k as xs,m as Je,p as Kd,q as ot,r as un,t as ft,v as Qn,x as Es,E as Rs,y as Qe,z as Pi,T as Ls,B as Pn,D as gt,F as Ge,G as Tt,H as Wo,J as Zo,K as Ot,O as mi,P as Ms,Q as Xo,U as Vt,W as Jo,X as Qo,Y as Dn,Z as ec,_ as zt,$ as tc,a0 as $s,a1 as Ns,a2 as nc,a3 as gi,a4 as ic,a5 as sc,a6 as oc,a7 as cc,a8 as ac,a9 as rc,aa as Di,ab as lc,ac as Kt}from"./ScheduledAtField-Cxf1jSLj.js";var Ps=dc;function dc(n,i,s){var o=null,c=null,r=function(){o&&(clearTimeout(o),c=null,o=null)},u=function(){var d=c;r(),d&&d()},l=function(){if(!i)return n.apply(this,arguments);var d=this,a=arguments,h=s&&!o;if(r(),c=function(){n.apply(d,a)},o=setTimeout(function(){if(o=null,!h){var p=c;return c=null,p()}},i),h)return c()};return l.cancel=r,l.flush=u,l}/*!
* 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(n,i){"use strict";typeof n.CustomEvent!="function"&&(n.CustomEvent=function(g,v){v=v||{bubbles:!1,cancelable:!1,detail:void 0};var y=i.createEvent("CustomEvent");return y.initCustomEvent(g,v.bubbles,v.cancelable,v.detail),y},n.CustomEvent.prototype=n.Event.prototype),i.addEventListener("touchstart",h,!1),i.addEventListener("touchmove",p,!1),i.addEventListener("touchend",a,!1);var s=null,o=null,c=null,r=null,u=null,l=null,d=0;function a(g){if(l===g.target){var v=parseInt(m(l,"data-swipe-threshold","20"),10),y=m(l,"data-swipe-unit","px"),w=parseInt(m(l,"data-swipe-timeout","500"),10),b=Date.now()-u,S="",_=g.changedTouches||g.touches||[];if(y==="vh"&&(v=Math.round(v/100*i.documentElement.clientHeight)),y==="vw"&&(v=Math.round(v/100*i.documentElement.clientWidth)),Math.abs(c)>Math.abs(r)?Math.abs(c)>v&&b<w&&(c>0?S="swiped-left":S="swiped-right"):Math.abs(r)>v&&b<w&&(r>0?S="swiped-up":S="swiped-down"),S!==""){var T={dir:S.replace(/swiped-/,""),touchType:(_[0]||{}).touchType||"direct",fingers:d,xStart:parseInt(s,10),xEnd:parseInt((_[0]||{}).clientX||-1,10),yStart:parseInt(o,10),yEnd:parseInt((_[0]||{}).clientY||-1,10)};l.dispatchEvent(new CustomEvent("swiped",{bubbles:!0,cancelable:!0,detail:T})),l.dispatchEvent(new CustomEvent(S,{bubbles:!0,cancelable:!0,detail:T}))}s=null,o=null,u=null}}function h(g){g.target.getAttribute("data-swipe-ignore")!=="true"&&(l=g.target,u=Date.now(),s=g.touches[0].clientX,o=g.touches[0].clientY,c=0,r=0,d=g.touches.length)}function p(g){if(!(!s||!o)){var v=g.touches[0].clientX,y=g.touches[0].clientY;c=s-v,r=o-y}}function m(g,v,y){for(;g&&g!==i.documentElement;){var w=g.getAttribute(v);if(w)return w;g=g.parentNode}return y}})(window,document);function Gt(n=()=>{},i=[]){const s=j(n);Q(()=>{s.current=n},[i]),Q(()=>{const o=()=>{const c=document.hidden||document.visibilityState==="hidden";s.current(!c)};return document.addEventListener("visibilitychange",o),()=>document.removeEventListener("visibilitychange",o)},[])}const uc=1e3*3,Oi=2e4,hc=ut(function({isLoggedIn:i}){const{_:s}=le(),[o,c]=M(!0),r=j();Gt(a=>{clearTimeout(r.current),a?c(!0):r.current=setTimeout(()=>{c(!1)},Oi)});const u=async(a,h,p)=>{var m;if(x.notificationsLast){const g=a.v1.notifications.list({limit:1,sinceId:x.notificationsLast.id}).values(),{value:v}=await g.next();if(v!=null&&v.length)if(p)x.notificationsShowNew=!0;else{let y;try{const w=await a.v1.markers.fetch({timeline:"notifications"});y=(m=w==null?void 0:w.notifications)==null?void 0:m.lastReadId}catch{}y?x.notificationsShowNew=v[0].id!==y:x.notificationsShowNew=!0}}};Q(()=>{let a,h,p;if(i&&o){const{masto:m,streaming:g,instance:v}=re();(async()=>{await u(m,v);let y=!1;g&&(h=setTimeout(()=>{(async()=>{try{y=!0,a=g.user.notification.subscribe();for await(const w of a){if(!a||!o)break;w.event==="notification"&&et(w.payload,v,{skipThreading:!0}),x.notificationsShowNew=!0}}catch{y=!1}y||(p=setInterval(()=>{u(m,v,!0)},Oi))})()},uc))})()}return()=>{var m;(m=a==null?void 0:a.unsubscribe)==null||m.call(a),a=null,clearTimeout(h),clearInterval(p)}},[o,i]);const l=j(),d=()=>{l.current=Date.now(),fetch("./version.json").then(a=>a.json()).then(a=>{a&&(x.appVersion=a)}).catch(a=>{})};return fi(d,o&&1e3*60*30),Gt(a=>{a&&(l.current?Date.now()-l.current>1e3*60*60&&d():d())}),qe("shift+alt+k",a=>{if(!a.shiftKey||!a.altKey)return;const h=x.settings.cloakMode;x.settings.cloakMode=!h,fe({text:s(h?{id:"oguMwa"}:{id:"IXZLPs"})})},{useKey:!0,ignoreEventWhen:a=>a.metaKey||a.ctrlKey}),null}),fc=bt(async(n,i)=>{const s=n.v1.accounts.$select(i).statuses.list({limit:3,exclude_replies:!0,exclude_reblogs:!0}).values(),{value:o}=await s.next();return o||[]},{maxAge:6e4});function pc(){const{_:n}=le(),i=We(x),{masto:s}=re(),[o,c]=M(!1),[r,u]=M([]),[l,d]=M(!1),a=j(null),h=j(null),p=i.settings.shortcutsViewMode==="multi-column";function m(w){if(w.key&&w.key.toLowerCase()!=="c")return;if(i.composerState.minimized){x.composerState.minimized=!1,Ni();return}const b=document.querySelectorAll("data.compose-data"),S=!p&&b.length===1?JSON.parse(b[0].value):void 0;w.shiftKey?Vo(S)||(x.showCompose=S||!0):(Ni(),x.showCompose=S||!0)}qe("c, shift+c",m,{useKey:!0,ignoreEventWhen:w=>!!document.querySelector("#modal-container > *")||w.metaKey||w.ctrlKey||w.altKey});const g=Is(()=>{c(!0)},{threshold:600}),v=it(async()=>{try{d(!0);const w=kt();if(!w)return;const b=await fc(s,w);u(b)}catch{}finally{d(!1)}},[s]),y=it(w=>{Ts({replyToStatus:w}),c(!1)},[]);return Q(()=>{o&&v()},[v,o]),e(U,{children:[e("button",{ref:a,type:"button",id:"compose-button",onClick:m,onContextMenu:w=>{w.preventDefault(),c(!0)},...g(),class:`${i.composerState.minimized?"min":""} ${i.composerState.publishing?"loading":""} ${i.composerState.publishingError?"error":""}`,children:e(I,{icon:"quill",size:"xl",alt:n({id:"QOhkyl"})})}),e(pi,{ref:h,state:o?"open":void 0,anchorRef:a,onClose:()=>c(!1),direction:"top",gap:8,unmountOnClose:!0,portal:{target:document.body},boundingBoxPadding:As(),containerProps:{style:{zIndex:19},onClick:()=>{var w,b;(b=(w=h.current)==null?void 0:w.closeMenu)==null||b.call(w)}},submenuOpenDelay:600,children:[e(je,{to:"/sp",children:[e(I,{icon:"schedule"})," ",e("span",{children:e(f,{id:"+GkIdc"})})]}),e(Ve,{}),e(dn,{align:"end",direction:"top",shift:-8,disabled:l||r.length===0,label:e(U,{children:[e(I,{icon:"comment"})," ",e("span",{className:"menu-grow",children:e(f,{id:"LwOr4P"})}),l?"…":e(I,{icon:"chevron-right"})]}),children:r.length>0&&r.map(w=>{const b=new Date(w.createdAt),S=new Date().getTime()-b.getTime()<864e5;return e(ye,{onClick:()=>y(w),children:e("small",{children:[e("div",{class:"menu-post-text",children:Nn(w)}),e("span",{className:"more-insignificant",children:[S&&e(U,{children:[e(_t,{datetime:b,format:"micro"})," ",""," "]}),e("time",{className:"created",dateTime:b.toISOString(),title:b.toLocaleString(),children:ct(w.createdAt)})]})]})},w.id)})})]})]})}const mc=ut(function(){const{_:i}=le(),s=We(x);function o(){x.showKeyboardShortcutsHelp=!1}return qe("?",()=>{x.showKeyboardShortcutsHelp=!0},{useKey:!0,ignoreEventWhen:c=>/\/catchup/i.test(location.hash)||c.metaKey||c.ctrlKey||c.altKey}),!!s.showKeyboardShortcutsHelp&&e(Ye,{onClose:o,children:e("div",{id:"keyboard-shortcuts-help-container",class:"sheet",tabindex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:o,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(f,{id:"77Emn0"})})}),e("main",{children:e("table",{children:e("tbody",{children:[{action:i({id:"ulXSNi"}),keys:e("kbd",{children:"?"})},{action:i({id:"Gy9P9T"}),keys:e("kbd",{children:"j"})},{action:i({id:"6XYpYY"}),keys:e("kbd",{children:"k"})},{action:i({id:"DYowFe"}),keys:e(f,{id:"mzjGX4",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"S5ez7Y"}),keys:e(f,{id:"Fd8FaU",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"VkLESX"}),keys:e("kbd",{children:"."})},{action:i({id:"jsFF8C"}),keys:e(f,{id:"80sOCm",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:e(f,{id:"41gejM",components:{0:e("br",{})}}),keys:e("kbd",{children:"x"})},{action:i({id:"jAj8rv"}),keys:e(f,{id:"evz6c6",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"duF1lx"}),keys:e(f,{id:"nhpsIN",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"YrR3Co"}),keys:e("kbd",{children:"]"})},{action:i({id:"noxAFR"}),keys:e("kbd",{children:"["})},{action:i({id:"AIa/f7"}),keys:e("kbd",{children:"c"})},{action:i({id:"snPx8X"}),className:"insignificant",keys:e(f,{id:"+Cxvld",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"1pKapz"}),keys:e(f,{id:"py67WT",components:{0:e("kbd",{}),1:e("kbd",{}),2:e("kbd",{}),3:e("kbd",{})}})},{action:i({id:"A1taO8"}),keys:e("kbd",{children:"/"})},{action:i({id:"ImOQa9"}),keys:e("kbd",{children:"r"})},{action:i({id:"KFs8c6"}),className:"insignificant",keys:e(f,{id:"XpQLJF",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"cqi4Mx"}),keys:e(f,{id:"84WuL2",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"kulphB"}),keys:e(f,{id:"yrz6Ck",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"PZlHt8"}),keys:e("kbd",{children:"d"})},{action:i({id:"C7ujRh"}),keys:e(f,{id:"v4TbMP",components:{0:e("kbd",{}),1:e("kbd",{}),2:e("kbd",{})}})}].map(({action:c,className:r,keys:u})=>e("tr",{children:[e("th",{class:r,children:c}),e("td",{children:u})]},c))})})})]})})}),Ds=new Set,rt=new WeakMap,Wt=new WeakMap,Ut=new WeakMap,ei=new WeakMap,gc=new WeakMap,Zt=new WeakMap,xn=new WeakMap,sn=new WeakSet;let Rt,yi=0,bi=0;const Ct="__aa_tgt",an="__aa_del",En="__aa_new",yc=n=>{const i=_c(n);i&&i.forEach(s=>Cc(s))},bc=n=>{n.forEach(i=>{i.target===Rt&&wc(),rt.has(i.target)&&Ft(i.target)})};function vc(n){const i=ei.get(n);i==null||i.disconnect();let s=rt.get(n),o=0;const c=5;s||(s=Xt(n),rt.set(n,s));const{offsetWidth:r,offsetHeight:u}=Rt,d=[s.top-c,r-(s.left+c+s.width),u-(s.top+c+s.height),s.left-c].map(h=>`${-1*Math.floor(h)}px`).join(" "),a=new IntersectionObserver(()=>{++o>1&&Ft(n)},{root:Rt,threshold:1,rootMargin:d});a.observe(n),ei.set(n,a)}function Ft(n){clearTimeout(xn.get(n));const i=On(n),s=rn(i)?500:i.duration;xn.set(n,setTimeout(async()=>{const o=Ut.get(n);try{await(o==null?void 0:o.finished),rt.set(n,Xt(n)),vc(n)}catch{}},s))}function wc(){clearTimeout(xn.get(Rt)),xn.set(Rt,setTimeout(()=>{Ds.forEach(n=>Bs(n,i=>Os(()=>Ft(i))))},100))}function kc(n){setTimeout(()=>{gc.set(n,setInterval(()=>Os(Ft.bind(null,n)),2e3))},Math.round(2e3*Math.random()))}function Os(n){typeof requestIdleCallback=="function"?requestIdleCallback(()=>n()):requestAnimationFrame(()=>n())}let ti,jt;const Sc=typeof window<"u"&&"ResizeObserver"in window;Sc&&(Rt=document.documentElement,ti=new MutationObserver(yc),jt=new ResizeObserver(bc),window.addEventListener("scroll",()=>{bi=window.scrollY,yi=window.scrollX}),jt.observe(Rt));function _c(n){return n.reduce((o,c)=>[...o,...Array.from(c.addedNodes),...Array.from(c.removedNodes)],[]).every(o=>o.nodeName==="#comment")?!1:n.reduce((o,c)=>{if(o===!1)return!1;if(c.target instanceof Element){if(Yn(c.target),!o.has(c.target)){o.add(c.target);for(let r=0;r<c.target.children.length;r++){const u=c.target.children.item(r);if(u){if(an in u)return!1;Yn(c.target,u),o.add(u)}}}if(c.removedNodes.length)for(let r=0;r<c.removedNodes.length;r++){const u=c.removedNodes[r];if(an in u)return!1;u instanceof Element&&(o.add(u),Yn(c.target,u),Wt.set(u,[c.previousSibling,c.nextSibling]))}}return o},new Set)}function Yn(n,i){!i&&!(Ct in n)?Object.defineProperty(n,Ct,{value:n}):i&&!(Ct in i)&&Object.defineProperty(i,Ct,{value:n})}function Cc(n){var i;const s=n.isConnected,o=rt.has(n);s&&Wt.has(n)&&Wt.delete(n),Ut.has(n)&&((i=Ut.get(n))===null||i===void 0||i.cancel()),En in n?zi(n):o&&s?Tc(n):o&&!s?Ac(n):zi(n)}function wt(n){return Number(n.replace(/[^0-9.\-]/g,""))}function Ic(n){let i=n.parentElement;for(;i;){if(i.scrollLeft||i.scrollTop)return{x:i.scrollLeft,y:i.scrollTop};i=i.parentElement}return{x:0,y:0}}function Xt(n){const i=n.getBoundingClientRect(),{x:s,y:o}=Ic(n);return{top:i.top+o,left:i.left+s,width:i.width,height:i.height}}function zs(n,i,s){let o=i.width,c=i.height,r=s.width,u=s.height;const l=getComputedStyle(n);if(l.getPropertyValue("box-sizing")==="content-box"){const a=wt(l.paddingTop)+wt(l.paddingBottom)+wt(l.borderTopWidth)+wt(l.borderBottomWidth),h=wt(l.paddingLeft)+wt(l.paddingRight)+wt(l.borderRightWidth)+wt(l.borderLeftWidth);o-=h,r-=h,c-=a,u-=a}return[o,r,c,u].map(Math.round)}function On(n){return Ct in n&&Zt.has(n[Ct])?Zt.get(n[Ct]):{duration:250,easing:"ease-in-out"}}function Us(n){if(Ct in n)return n[Ct]}function vi(n){const i=Us(n);return i?sn.has(i):!1}function Bs(n,...i){i.forEach(s=>s(n,Zt.has(n)));for(let s=0;s<n.children.length;s++){const o=n.children.item(s);o&&i.forEach(c=>c(o,Zt.has(o)))}}function wi(n){return Array.isArray(n)?n:[n]}function rn(n){return typeof n=="function"}function Tc(n){const i=rt.get(n),s=Xt(n);if(!vi(n))return rt.set(n,s);let o;if(!i)return;const c=On(n);if(typeof c!="function"){const r=i.left-s.left,u=i.top-s.top,[l,d,a,h]=zs(n,i,s),p={transform:`translate(${r}px, ${u}px)`},m={transform:"translate(0, 0)"};l!==d&&(p.width=`${l}px`,m.width=`${d}px`),a!==h&&(p.height=`${a}px`,m.height=`${h}px`),o=n.animate([p,m],{duration:c.duration,easing:c.easing})}else{const[r]=wi(c(n,"remain",i,s));o=new Animation(r),o.play()}Ut.set(n,o),rt.set(n,s),o.addEventListener("finish",Ft.bind(null,n))}function zi(n){En in n&&delete n[En];const i=Xt(n);rt.set(n,i);const s=On(n);if(!vi(n))return;let o;if(typeof s!="function")o=n.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[c]=wi(s(n,"add",i));o=new Animation(c),o.play()}Ut.set(n,o),o.addEventListener("finish",Ft.bind(null,n))}function Ui(n,i){var s;n.remove(),rt.delete(n),Wt.delete(n),Ut.delete(n),(s=ei.get(n))===null||s===void 0||s.disconnect(),setTimeout(()=>{if(an in n&&delete n[an],Object.defineProperty(n,En,{value:!0,configurable:!0}),i&&n instanceof HTMLElement)for(const o in i)n.style[o]=""},0)}function Ac(n){var i;if(!Wt.has(n)||!rt.has(n))return;const[s,o]=Wt.get(n);Object.defineProperty(n,an,{value:!0,configurable:!0});const c=window.scrollX,r=window.scrollY;if(o&&o.parentNode&&o.parentNode instanceof Element?o.parentNode.insertBefore(n,o):s&&s.parentNode?s.parentNode.appendChild(n):(i=Us(n))===null||i===void 0||i.appendChild(n),!vi(n))return Ui(n);const[u,l,d,a]=Ec(n),h=On(n),p=rt.get(n);(c!==yi||r!==bi)&&xc(n,c,r,h);let m,g={position:"absolute",top:`${u}px`,left:`${l}px`,width:`${d}px`,height:`${a}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!rn(h))Object.assign(n.style,g),m=n.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:h.duration,easing:"ease-out"});else{const[v,y]=wi(h(n,"remove",p));(y==null?void 0:y.styleReset)!==!1&&(g=(y==null?void 0:y.styleReset)||g,Object.assign(n.style,g)),m=new Animation(v),m.play()}Ut.set(n,m),m.addEventListener("finish",Ui.bind(null,n,g))}function xc(n,i,s,o){const c=yi-i,r=bi-s,u=document.documentElement.style.scrollBehavior;if(getComputedStyle(Rt).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+c,window.scrollY+r),!n.parentElement)return;const d=n.parentElement;let a=d.clientHeight,h=d.clientWidth;const p=performance.now();function m(){requestAnimationFrame(()=>{if(!rn(o)){const g=a-d.clientHeight,v=h-d.clientWidth;p+o.duration>performance.now()?(window.scrollTo({left:window.scrollX-v,top:window.scrollY-g}),a=d.clientHeight,h=d.clientWidth,m()):document.documentElement.style.scrollBehavior=u}})}m()}function Ec(n){const i=rt.get(n),[s,,o]=zs(n,i,Xt(n));let c=n.parentElement;for(;c&&(getComputedStyle(c).position==="static"||c instanceof HTMLBodyElement);)c=c.parentElement;c||(c=document.body);const r=getComputedStyle(c),u=rt.get(c)||Xt(c),l=Math.round(i.top-u.top)-wt(r.borderTopWidth),d=Math.round(i.left-u.left)-wt(r.borderLeftWidth);return[l,d,s,o]}function Fs(n,i={}){return ti&&jt&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!rn(i)&&!i.disrespectUserMotionPreference||(sn.add(n),getComputedStyle(n).position==="static"&&Object.assign(n.style,{position:"relative"}),Bs(n,Ft,kc,c=>jt==null?void 0:jt.observe(c)),rn(i)?Zt.set(n,i):Zt.set(n,{duration:250,easing:"ease-in-out",...i}),ti.observe(n,{childList:!0}),Ds.add(n))),Object.freeze({parent:n,enable:()=>{sn.add(n)},disable:()=>{sn.delete(n)},isEnabled:()=>sn.has(n)})}function ki(n){const i=j(null),[s,o]=M(),c=r=>{s&&(r?s.enable():s.disable())};return Q(()=>{i.current instanceof HTMLElement&&o(Fs(i.current,n||{}))},[]),[i,c]}function Rc(n){return("0"+n.toString(16)).slice(-2)}function Lc(){var n=new Uint32Array(28);return window.crypto.getRandomValues(n),Array.from(n,Rc).join("")}function Mc(n){const s=new TextEncoder().encode(n);return window.crypto.subtle.digest("SHA-256",s)}function $c(n){let i="";const s=new Uint8Array(n),o=s.byteLength;for(var c=0;c<o;c++)i+=String.fromCharCode(s[c]);return btoa(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Ks(n){const i=await Mc(n);return $c(i)}async function Nc({instanceURL:n}){var i;if(!n)return!1;try{const s=await fetch(`https://${n}/.well-known/oauth-authorization-server`);return!s.ok||s.status!==200?!1:!!((i=(await s.json()).code_challenge_methods_supported)!=null&&i.includes("S256"))}catch{return!1}}window.__generateCodeChallenge=Ks;const Pc={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",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",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{DEV:Dc,PHANPY_CLIENT_NAME:Oc,PHANPY_WEBSITE:Rn}=Pc,Si="read write follow push",zc=Rn?Rn.toLowerCase().includes(location.hostname):!1,Uc=location.origin+location.pathname,zn=Dc||!zc?Uc:Rn;async function Bc({instanceURL:n}){const i=new URLSearchParams({client_name:Oc,redirect_uris:zn,scopes:Si,website:Rn});return await(await fetch(`https://${n}/api/v1/apps`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i.toString()})).json()}async function Fc({instanceURL:n,client_id:i,forceLogin:s=!1}){const o=Lc(),c=await Ks(o),r=new URLSearchParams({client_id:i,code_challenge_method:"S256",code_challenge:c,redirect_uri:zn,response_type:"code",scope:Si});return s&&r.append("force_login",!0),[`https://${n}/oauth/authorize?${r.toString()}`,o]}async function Kc({instanceURL:n,client_id:i,forceLogin:s=!1}){const o=new URLSearchParams({client_id:i,scope:Si,redirect_uri:zn,response_type:"code"});return s&&o.append("force_login",!0),`https://${n}/oauth/authorize?${o.toString()}`}async function Hc({instanceURL:n,client_id:i,client_secret:s,code:o,code_verifier:c}){const r=new URLSearchParams({client_id:i,redirect_uri:zn,grant_type:"authorization_code",code:o});return s&&r.append("client_secret",s),c&&r.append("code_verifier",c),await(await fetch(`https://${n}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:r.toString()})).json()}async function qc({instanceURL:n,client_id:i,client_secret:s,token:o}){try{const c=new URLSearchParams({client_id:i,client_secret:s,token:o});return(await fetch(`https://${n}/oauth/revoke`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:c.toString(),keepalive:!0})).ok}catch(c){return console.erro("Error revoking token",c),!1}}const Yc=window.matchMedia("(display-mode: standalone)").matches;function jc({onClose:n}){const{_:i}=le(),{masto:s}=re(),o=ri(),c=kt(),r=o.length>1,[u,l]=Lt(a=>a+1,0),[d]=ki();return e("div",{id:"accounts-container",class:"sheet",tabIndex:"-1",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{class:"header-grid",children:e("h2",{children:e(f,{id:"bPwFdf"})})}),e("main",{children:e("section",{children:[e("ul",{class:"accounts-list",ref:d,children:o.map((a,h)=>{const p=a.info.id===c,m=h===0;return e("li",{children:[e("div",{children:[r&&e("span",{class:`current ${p?"is-current":""}`,children:e(I,{icon:"check-circle",alt:i({id:"Hp1l6f"})})}),e(mt,{url:a.info.avatarStatic,size:"xxl",onDblClick:async()=>{if(p)try{const g=await s.v1.accounts.$select(a.info.id).fetch();a.info=g,Yt(o),l()}catch{}}}),e(yt,{account:r?{...a.info,acct:/@/.test(a.info.acct)?a.info.acct:`${a.info.acct}@${a.instanceURL}`}:a.info,showAcct:!0,onClick:()=>{p?x.showAccount=`${a.info.username}@${a.instanceURL}`:(In(a.info.id),location.reload())}})]}),e("div",{class:"actions",children:[m&&r&&e(U,{children:[e("span",{class:"tag",children:e(f,{id:"ovBPCi"})})," "]}),e(dt,{align:"end",menuButton:e("button",{type:"button",class:"plain more-button",children:e(I,{icon:"more",size:"l",alt:i({id:"2FYpfJ"})})}),children:[r&&e(U,{children:[e(ye,{disabled:p,onClick:()=>{In(a.info.id),location.reload()},children:[e(I,{icon:"transfer"})," ",e(f,{id:"3t/Nrv"})]}),!Yc&&!p&&e(je,{href:`./?account=${a.info.id}`,target:"_blank",children:[e(I,{icon:"external"}),e("span",{children:e(f,{id:"PZgZtY"})})]}),e(Ve,{})]}),e(ye,{onClick:()=>{x.showAccount=`${a.info.username}@${a.instanceURL}`},children:[e(I,{icon:"user"}),e("span",{children:e(f,{id:"40z2Fm"})})]}),e(Ve,{}),r&&e(U,{children:[e(ye,{disabled:m,onClick:()=>{o.splice(h,1),o.unshift(a),Yt(o),l()},children:[e(I,{icon:"check-circle"}),e("span",{children:e(f,{id:"PPcets"})})]}),e(ye,{disabled:h<=1,onClick:()=>{o.splice(h,1),o.splice(h-1,0,a),Yt(o),l()},children:[e(I,{icon:"arrow-up"}),e("span",{children:e(f,{id:"QyioBP"})})]}),e(ye,{disabled:h===0||h===o.length-1,onClick:()=>{o.splice(h,1),o.splice(h+1,0,a),Yt(o),l()},children:[e(I,{icon:"arrow-down"}),e("span",{children:e(f,{id:"3Ib6FN"})})]}),e(Ve,{})]}),e(pt,{subMenu:!0,confirmLabel:e(U,{children:[e(I,{icon:"exit"}),e("span",{children:e(f,{id:"k08LxG",values:{0:a.info.acct},components:{0:e("span",{class:"bidi-isolate"})}})})]}),disabled:!p,menuItemClassName:"danger",onClick:async()=>{await qc({instanceURL:a.instanceURL,client_id:a.clientId,client_secret:a.clientSecret,token:a.accessToken}),o.splice(h,1),Yt(o),location.href=location.pathname||"/"},children:[e(I,{icon:"exit"}),e("span",{children:e(f,{id:"CXk1bI"})})]}),!!(a!=null&&a.createdAt)&&e("div",{class:"footer",children:[e(I,{icon:"account-add"}),e("span",{children:e(f,{id:"+9E7iR",values:{0:ct(a.createdAt)},components:{0:e(_t,{datetime:a.createdAt})}})})]})]})]})]},a.info.id)})}),e("p",{children:e(ge,{to:"/login",class:"button plain2",onClick:n,children:[e(I,{icon:"plus"})," ",e("span",{children:e(f,{id:"Is7/PB"})})]})}),r&&e("p",{children:e("small",{children:e(f,{id:"52x24e",components:{0:e("i",{})}})})})]})})]})}const _i="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",Vc={"zh-CN":"zh-Hans","zh-TW":"zh-Hant","pt-BR":"pt-BR"};function Ci(){const{i18n:n}=le(),i=Ae(()=>_o.map(s=>{var u,l;const o=Vc[s]||s.replace(/-[a-z]+$/i,""),c=Et({code:o,locale:s,fallback:(u=Kn.find(d=>d.code===s))==null?void 0:u.nativeName}),r=Et({code:o,locale:n.locale,fallback:(l=Kn.find(d=>d.code===s))==null?void 0:l.name});return{code:s,regionlessCode:o,_common:r,native:c}}).sort((s,o)=>{const c=s._common.localeCompare(o._common,n.locale);return c!==0?c:s.code<o.code?-1:s.code>o.code?1:0}),[]);return e("label",{class:"lang-selector",children:["🌐"," ",e("select",{class:"small",value:n.locale||Co,onChange:s=>{Ue.local.set("lang",s.target.value),Io(s.target.value)},children:[i.map(({code:s,regionlessCode:o,native:c})=>{var l;const r=Et({code:o,locale:n.locale,fallback:(l=Kn.find(d=>d.code===s))==null?void 0:l.name});return e("option",{value:s,"data-regionless-code":o,children:!!r&&r!==c?`${c} - ${r}`:c},s)}),void 0]})]})}function Bi(n){const{masto:i}=re();return i.v1.push.subscription.create(n)}function Gc(){const{masto:n}=re();return n.v1.push.subscription.fetch()}function Wc(n){const{masto:i}=re();return i.v1.push.subscription.update(n)}function Zc(){const{masto:n}=re();return n.v1.push.subscription.remove()}function Un(){return"serviceWorker"in navigator&&"PushManager"in window}function Xc(){return navigator.serviceWorker.getRegistration()}async function Ii(){const n=await Xc(),i=n?await n.pushManager.getSubscription():void 0;return{registration:n,subscription:i}}function Hs(n){const i="=".repeat((4-n.length%4)%4),s=`${n}${i}`.replace(/-/g,"+").replace(/_/g,"/"),o=window.atob(s),c=new Uint8Array(o.length);for(let r=0;r<o.length;++r)c[r]=o.charCodeAt(r);return c}async function Jc(){if(!Un())return;const{subscription:n}=await Ii();let i=null;try{i=await Gc()}catch(s){if(!/(not found|unknown)/i.test(s.message))throw s}if(i&&n){const s=i.endpoint===n.endpoint,o=Tn(),c=i.serverKey===o;if(!s)throw new Error("Backend subscription endpoint changed");if(!c)throw new Error("Backend subscription key and vapid key changed")}if(n&&!i){const s=Tn();if(s){const{applicationServerKey:o}=n.options,c=Hs(s).toString(),r=new Uint8Array(o).toString();if(!(c===r))throw await n.unsubscribe(),new Error("Subscription key and vapid key changed")}}return{subscription:n,backendSubscription:i}}async function Fi({data:n,policy:i}){if(!Un())return;let{registration:s,subscription:o}=await Ii(),c=null;if(o)try{c=await Wc({data:n,policy:i})}catch{c=await Bi({subscription:o,data:n,policy:i})}else{const r=Tn();if(!r)throw new Error("No server key found");o=await s.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Hs(r)}),c=await Bi({subscription:o,data:n,policy:i})}return{subscription:o,backendSubscription:c}}async function Ki(){if(!Un())return;const{subscription:n}=await Ii();n&&(await Zc(),await n.unsubscribe())}const Qc={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",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",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},Hi=16,Dt=[14,15,16,17,18,19,20],{PHANPY_WEBSITE:qi,PHANPY_PRIVACY_POLICY_URL:ea,PHANPY_TRANSLANG_INSTANCES:ta,PHANPY_IMG_ALT_API_URL:na,PHANPY_GIPHY_API_KEY:ia}=Qc,Yi=Object.entries(Go.tl).map(([n,i])=>({code:n,name:i})),sa="TransLang API";function oa({onClose:n}){var v;const{_:i}=le(),s=We(x),o=Ue.local.get("theme")||"auto",c=j(),r=s.settings.contentTranslationTargetLanguage||null,u=xs(),l=Et(u),d=Ue.local.get("textSize")||Hi,[a,h]=M(li()),{masto:p,authenticated:m,instance:g}=re();return e("div",{id:"settings-container",class:"sheet",tabIndex:"-1",style:{"--current-text-size":`${d}px`},children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(f,{id:"Tz0i8g"})})}),e("main",{children:[e("section",{children:e("ul",{children:[e("li",{children:[e("div",{children:e("label",{children:e(f,{id:"aAIQg2"})})}),e("div",{children:e("form",{ref:c,onInput:y=>{y.preventDefault();const b=new FormData(c.current).get("theme"),S=document.documentElement;if(b==="auto"){S.classList.remove("is-light","is-dark");const _=document.querySelector('meta[data-theme-setting="manual"]');_&&(_.name=""),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(A=>{A.name="theme-color"})}else{S.classList.toggle("is-light",b==="light"),S.classList.toggle("is-dark",b==="dark");const _=document.querySelector('meta[data-theme-setting="manual"]');_&&(_.name="theme-color",_.content=b==="light"?_.dataset.themeLightColor:_.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(A=>{A.name=""})}document.querySelector('meta[name="color-scheme"]').setAttribute("content",b==="auto"?"dark light":b),b==="auto"?Ue.local.del("theme"):Ue.local.set("theme",b)},children:e("div",{class:"radio-group",children:[e("label",{children:[e("input",{type:"radio",name:"theme",value:"light",defaultChecked:o==="light"}),e("span",{children:e(f,{id:"1njn7W"})})]}),e("label",{children:[e("input",{type:"radio",name:"theme",value:"dark",defaultChecked:o==="dark"}),e("span",{children:e(f,{id:"pvnfJD"})})]}),e("label",{children:[e("input",{type:"radio",name:"theme",value:"auto",defaultChecked:o!=="light"&&o!=="dark"}),e("span",{children:e(f,{id:"R9Khdg"})})]})]})})})]}),e("li",{children:[e("div",{children:e("label",{children:e(f,{id:"7r6sCa"})})}),e("div",{class:"range-group",children:[e("span",{style:{fontSize:Dt[0]},children:e(f,{id:"J6ypuD"})})," ",e("input",{type:"range",min:Dt[0],max:Dt[Dt.length-1],step:"1",value:d,list:"sizes",onChange:y=>{const w=parseInt(y.target.value,10);document.documentElement.style.setProperty("--text-size",`${w}px`),w===Hi?Ue.local.del("textSize"):Ue.local.set("textSize",y.target.value)}})," ",e("span",{style:{fontSize:Dt[Dt.length-1]},children:e(f,{id:"J6ypuD"})}),e("datalist",{id:"sizes",children:Dt.map(y=>e("option",{value:y}))})]})]}),e("li",{children:[e("span",{children:[e("label",{children:e(f,{id:"CeJHfb"})}),e("br",{}),e("small",{children:e("a",{href:"https://crowdin.com/project/phanpy",target:"_blank",rel:"noopener",children:e(f,{id:"FFmj1D"})})})]}),e(Ci,{})]})]})}),m&&e(U,{children:[e("h3",{children:e(f,{id:"PcoS3v"})}),e("section",{children:e("ul",{children:e("li",{children:[e("div",{children:e("label",{for:"posting-privacy-field",children:[e(f,{id:"NAjVvt"})," ",e(I,{icon:"cloud",alt:i({id:"N2FcBE"}),class:"synced-icon"})]})}),e("div",{children:e("select",{id:"posting-privacy-field",value:a["posting:default:visibility"]||"public",onChange:y=>{const{value:w}=y.target;(async()=>{try{await p.v1.accounts.updateCredentials({source:{privacy:w}}),h({...a,"posting:default:visibility":w}),To({...a,"posting:default:visibility":w})}catch{alert(i({id:"Oa+KBY"}))}})()},children:[e("option",{value:"public",children:e(f,{id:"7d1a0d"})}),e("option",{value:"unlisted",children:e(f,{id:"WDcQq9"})}),e("option",{value:"private",children:e(f,{id:"o34OrG"})})]})})]})})}),e("p",{class:"section-postnote",children:[e(I,{icon:"cloud",alt:i({id:"N2FcBE"}),class:"synced-icon"})," ",e("small",{children:e(f,{id:"xlsg7n",values:{instance:g},components:{0:e("a",{href:`https://${g}/`,target:"_blank",rel:"noopener"})}})})]})]}),e("h3",{children:e(f,{id:"ivdhsq"})}),e("section",{children:e("ul",{children:[e("li",{class:"block",children:e("label",{children:[e("input",{type:"checkbox",checked:s.settings.autoRefresh,onChange:y=>{x.settings.autoRefresh=y.target.checked}})," ",e(f,{id:"0mC0SF"})]})}),e("li",{class:"block",children:e("label",{children:[e("input",{type:"checkbox",checked:s.settings.boostsCarousel,onChange:y=>{x.settings.boostsCarousel=y.target.checked}})," ",e(f,{id:"TSbnoW"})]})}),!!ta&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:s.settings.contentTranslation,onChange:y=>{const{checked:w}=y.target;x.settings.contentTranslation=w,w||(x.settings.contentTranslationTargetLanguage=null)}})," ",e(f,{id:"0SdaOt"})]}),e("div",{class:`sub-section ${s.settings.contentTranslation?"":"more-insignificant"}`,children:[e("div",{children:e("label",{children:[e(f,{id:"zXCa9e"})," ",e("select",{value:r||"",disabled:!s.settings.contentTranslation,style:{width:"10em"},onChange:y=>{x.settings.contentTranslationTargetLanguage=y.target.value||null},children:[e("option",{value:"",children:e(f,{id:"jNCSyx",values:{systemTargetLanguageText:l}})}),e("option",{disabled:!0,children:"──────────"}),Yi.map(y=>{const w=Et({code:y.code,fallback:y.name}),b=Et({code:y.code,locale:y.code}),S=b&&w!==b;return e("option",{value:y.code,children:S?`${b} - ${w}`:w})})]})]})}),e("hr",{}),e("div",{class:"checkbox-fieldset",children:[e(f,{id:"cc0NrU",values:{0:s.settings.contentTranslationHideLanguages.length}}),e("div",{class:"checkbox-fields",children:Yi.map(y=>{const w=Et({code:y.code,fallback:y.name}),b=Et({code:y.code,locale:y.code}),S=b&&w!==b;return e("label",{children:[e("input",{type:"checkbox",checked:s.settings.contentTranslationHideLanguages.includes(y.code),onChange:_=>{const{checked:T}=_.target;T?x.settings.contentTranslationHideLanguages.push(y.code):x.settings.contentTranslationHideLanguages=s.settings.contentTranslationHideLanguages.filter(A=>A!==y.code)}})," ",S?e("span",{children:[b," ",e("span",{class:"insignificant ib",children:["- ",w]})]}):w]})})})]}),e("p",{class:"insignificant",children:e("small",{children:e(f,{id:"7I3sDQ",values:{TRANSLATION_API_NAME:sa},components:{0:e("a",{href:"https://github.com/cheeaun/translang-api",target:"_blank",rel:"noopener"})}})})}),e("hr",{}),e("div",{children:[e("label",{children:[e("input",{type:"checkbox",checked:s.settings.contentTranslationAutoInline,disabled:!s.settings.contentTranslation,onChange:y=>{x.settings.contentTranslationAutoInline=y.target.checked}})," ",e(f,{id:"gURvmk"})]}),e("p",{class:"insignificant",children:e("small",{children:e(f,{id:"PbHARL",components:{0:e("b",{})}})})})]})]})]}),!!ia&&m&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:s.settings.composerGIFPicker,onChange:y=>{x.settings.composerGIFPicker=y.target.checked}})," ",e(f,{id:"D7/2jB"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(f,{id:"/CLBTL",components:{0:e("a",{href:"https://developers.giphy.com/",target:"_blank",rel:"noopener"})}})})})]}),!!na&&m&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:s.settings.mediaAltGenerator,onChange:y=>{x.settings.mediaAltGenerator=y.target.checked}})," ",e(f,{id:"9q5uor"})," ",e(I,{icon:"sparkles2",class:"more-insignificant"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(f,{id:"faZ9RI"})})}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(f,{id:"fHZgvt",components:{0:e("a",{href:"https://github.com/cheeaun/img-alt-api",target:"_blank",rel:"noopener"})}})})})]}),m&&Je("@mastodon/grouped-notifications")&&((v=bs())==null?void 0:v.mastodon)>=2&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:s.settings.groupedNotificationsAlpha,onChange:y=>{x.settings.groupedNotificationsAlpha=y.target.checked}})," ",e(f,{id:"aGziA/"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(f,{id:"X17jCM"})})})]}),m&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:s.settings.shortcutSettingsCloudImportExport,onChange:y=>{x.settings.shortcutSettingsCloudImportExport=y.target.checked}})," ",e(f,{id:"570qTm"})," ",e(I,{icon:"cloud",class:"more-insignificant"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(f,{id:"0tZAhT",components:{0:e("br",{})}})})}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(f,{id:"fHf1v/"})})})]}),e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:s.settings.cloakMode,onChange:y=>{x.settings.cloakMode=y.target.checked}})," ",e(f,{id:"lxYe+I",components:{0:e("span",{class:"insignificant"}),1:e("samp",{}),2:e("samp",{})}})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(f,{id:"T/hglb"})})})]}),m&&e("li",{children:e("button",{type:"button",class:"light",onClick:()=>{x.showDrafts=!0,x.showSettings=!1},children:e(f,{id:"krk5ws"})})})]})}),m&&e(ca,{onClose:n}),e("h3",{children:e(f,{id:"uyJsf6"})}),e("section",{children:[e("div",{style:{display:"flex",flexWrap:"wrap",gap:8,lineHeight:1.25,alignItems:"center",marginTop:8},children:[e("img",{src:_i,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",onClick:y=>{y.preventDefault(),x.showAccount="phanpy@hachyderm.io"},children:"@phanpy"}),e("br",{}),e(f,{id:"AZ2EoP",components:{0:e("a",{href:"https://github.com/cheeaun/phanpy",target:"_blank",rel:"noopener"}),1:e("a",{href:"https://mastodon.social/@cheeaun",rel:"noopener",onClick:y=>{y.preventDefault(),x.showAccount="cheeaun@mastodon.social"}})}})]})]}),e("p",{children:[e("a",{href:"https://github.com/sponsors/cheeaun",target:"_blank",rel:"noopener",children:e(f,{id:"O4cLCR"})})," ","·"," ",e("a",{href:"https://www.buymeacoffee.com/cheeaun",target:"_blank",rel:"noopener",children:e(f,{id:"Ng063n"})})," ","·"," ",e("a",{href:"https://patreon.com/cheeaun",target:"_blank",rel:"noopener",children:"Patreon"})," ","·"," ",e("a",{href:"https://github.com/cheeaun/phanpy/blob/main/CHANGELOG.md",target:"_blank",rel:"noopener",children:e(f,{id:"3ePd3I"})})," ","·"," ",e("a",{href:ea,target:"_blank",rel:"noopener",children:e(f,{id:"LcET2C"})})]}),e("p",{children:[qi&&e(U,{children:[e(f,{id:"pFnMHn",values:{0:qi.replace(/https?:\/\//g,"").replace(/\/$/,"")},components:{0:e("span",{class:"insignificant"})}}),e("br",{})]}),e(f,{id:"6KkH+2",values:{0:e("span",{class:"ib insignificant",children:["(",e("a",{href:"https://github.com/cheeaun/phanpy/commit/43d0d1e",target:"_blank",rel:"noopener",children:e(_t,{datetime:new Date("2025-06-12T23:49:22.800Z")})}),")"]})},components:{0:e("span",{class:"insignificant"}),1:e("input",{type:"text",class:"version-string",readOnly:!0,size:"18",value:`${"2025-06-12T23:49:22.800Z".slice(0,10).replace(/-/g,".")}.43d0d1e`,onClick:y=>{y.target.select();try{navigator.clipboard.writeText(y.target.value),fe(i({id:"PiPfua"}))}catch{fe(i({id:"gdxreD"}))}}})}})]})]}),void 0]})]})}function ca({onClose:n}){const{_:i}=le();if(!Un())return null;const{instance:s}=re(),[o,c]=M("default"),r=j(),[u,l]=M(!1),[d,a]=M(!1),h=j();Q(()=>{(async()=>{c("loading");try{const{subscription:m,backendSubscription:g}=await Jc();if(g!=null&&g.policy&&g.policy!=="none"){l(!0);const{alerts:v,policy:y}=g;h.current=y;const{elements:w}=r.current,b=w.namedItem("policy");b&&(b.value=y),Object.entries(v).forEach(([S,_])=>{const T=w.namedItem(S);(T==null?void 0:T.type)==="checkbox"&&(T.checked=!!_)})}c("default")}catch(m){/outside.*authorized/i.test(m.message)?a(!0):alert((m==null?void 0:m.message)||m),c("error")}})()},[]);const p=o==="loading";return e("form",{ref:r,onChange:()=>{setTimeout(()=>{const m=Object.fromEntries(new FormData(r.current)),g=!!m["policy-allow"],v={data:{policy:m.policy,alerts:{mention:!!m.mention,favourite:!!m.favourite,reblog:!!m.reblog,follow:!!m.follow,follow_request:!!m.followRequest,poll:!!m.poll,update:!!m.update,status:!!m.status}}};let y=0;Object.keys(v.data.alerts).forEach(b=>{v.data.alerts[b]?y++:delete v.data.alerts[b]});const w=h.current!==v.data.policy;g&&y>0?w?Ki().then(()=>{Fi(v)}).catch(b=>{alert(i({id:"I6pdY3"}))}):Fi(v).catch(b=>{alert(i({id:"I6pdY3"}))}):Ki().catch(b=>{alert(i({id:"q1zFd+"}))})},100)},children:[e("h3",{children:e(f,{id:"WUHLnz"})}),e("section",{children:e("ul",{children:e("li",{children:[e("label",{children:[e("input",{type:"checkbox",disabled:p||d,name:"policy-allow",checked:u,onChange:async m=>{const{checked:g}=m.target;if(g){const v=await Notification.requestPermission();v==="granted"?l(!0):(l(!1),v==="denied"&&alert(i({id:"6LUsk7"})))}else l(!1)}})," ",e(f,{id:"qYNCa1",values:{0:[{value:"all",label:i({id:"+niKJH"})},{value:"followed",label:i({id:"x2NYtp"})},{value:"follower",label:i({id:"PBFNgg"})}].map(m=>e("option",{value:m.value,children:m.label}))},components:{0:e("select",{name:"policy",disabled:p||d||!u})}})]}),e("div",{class:"shazam-container no-animation",style:{width:"100%"},hidden:!u,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"sub-section",children:e("ul",{children:[{value:"mention",label:i({id:"/bZzdR"})},{value:"favourite",label:i({id:"zZOZj7"})},{value:"reblog",label:i({id:"puY2t0"})},{value:"follow",label:i({id:"aaJhcT"})},{value:"followRequest",label:i({id:"6Fs1Ba"})},{value:"poll",label:i({id:"wNExRS"})},{value:"update",label:i({id:"K/EtE6"})},{value:"status",label:i({id:"2yr1/p"})}].map(m=>e("li",{children:e("label",{children:[e("input",{type:"checkbox",name:m.value})," ",m.label]})}))})})})}),d&&e("div",{class:"sub-section",children:e("p",{children:e(f,{id:"8d0b8B",components:{0:e(ge,{to:`/login?instance=${s}`,onClick:n}),1:e("b",{})}})})})]})})}),e("p",{class:"section-postnote",children:e("small",{children:e(f,{id:"z96cOX",components:{0:e("b",{})}})})})]})}const ni=()=>{let n=setTimeout(()=>{var s,o;const i=document.getElementById("columns");if(i){const c=i.querySelector(".deck-container.focus");if(c)c.focus();else{const r=Array.from(i.querySelectorAll(".deck-container")).find(u=>u.getBoundingClientRect().left>=0);r?r.focus():(o=(s=i.querySelector(".deck-container"))==null?void 0:s.focus)==null||o.call(s)}}else{const c=document.querySelectorAll("#modal-container > *");if(c!=null&&c.length){const d=c[c.length-1],a=d.querySelector('[tabindex="-1"]')||d;if(a){a.focus();return}}if(document.querySelector(".deck-backdrop"))return;const u=document.querySelectorAll(".deck-container"),l=u[u.length-1];l&&l.tabIndex===-1&&l.focus()}},100);return()=>clearTimeout(n)};function qs(n){if(!n)return;const i=Jt(),s=j(i.pathname);Q(()=>{s.current&&i.pathname!==s.current&&(n==null||n())},[i.pathname,n])}const Ys=1e3*60,aa=24*60*60*1e3,ii=bt(async()=>{const{masto:n}=re(),i=await n.v1.lists.list();return i.sort((s,o)=>s.title.localeCompare(o.title)),i.length&&setTimeout(()=>{Ue.account.set("lists",{lists:i,updatedAt:Date.now()})},1),i},{maxAge:Ys});async function hn(){try{const{lists:n,updatedAt:i}=Ue.account.get("lists")||{};return n!=null&&n.length?(Date.now()-i>aa&&ii(),n):await ii()}catch{return[]}}const ra=bt(n=>{const{masto:i}=re();return i.v1.lists.$select(n).fetch()},{maxAge:Ys});async function js(n){const{lists:i}=Ue.account.get("lists")||{};if(i!=null&&i.length){const s=i.find(o=>o.id===n);if(s)return s}try{return ra(n)}catch{return null}}async function la(n){const i=await js(n);return(i==null?void 0:i.title)||""}function da(n){const{lists:i}=Ue.account.get("lists")||{};i!=null&&i.length&&(i.push(n),i.sort((s,o)=>s.title.localeCompare(o.title)),Ue.account.set("lists",{lists:i,updatedAt:Date.now()}))}function ua(n){const{lists:i}=Ue.account.get("lists")||{};if(i!=null&&i.length){const s=i.findIndex(o=>o.id===n.id);s!==-1&&(i[s]=n,i.sort((o,c)=>o.title.localeCompare(c.title)),Ue.account.set("lists",{lists:i,updatedAt:Date.now()}))}}function ha(n){const{lists:i}=Ue.account.get("lists")||{};if(i!=null&&i.length){const s=i.findIndex(o=>o.id===n);s!==-1&&(i.splice(s,1),Ue.account.set("lists",{lists:i,updatedAt:Date.now()}))}}function Bt({insignificant:n}){const{_:i}=le();return e(I,{icon:"filter",size:"xs",class:`list-exclusive-badge ${n?"insignificant":""}`,title:i({id:"FNptcJ"})})}function Ti({list:n,onClose:i}){const{_:s}=le(),{masto:o}=re(),[c,r]=M("default"),u=!!n,l=j(),d=j(),a=j();Q(()=>{u&&(l.current.value=n.title,d.current.value=n.repliesPolicy,a.current&&(a.current.checked=n.exclusive))},[u]);const h=Je("@mastodon/list-exclusive")||Je("@gotosocial/list-exclusive");return e("div",{class:"sheet",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(I,{icon:"x",alt:s({id:"yz7wBu"})})})," ",e("header",{children:e("h2",{children:s(u?{id:"tuhghE"}:{id:"Sb2gYF"})})}),e("main",{children:e("form",{class:"list-form",onSubmit:p=>{p.preventDefault();const m=new FormData(p.target),g=m.get("title"),v=m.get("replies_policy"),y=m.get("exclusive")==="on";r("loading"),(async()=>{try{let w;u?w=await o.v1.lists.$select(n.id).update({title:g,replies_policy:v,exclusive:y}):w=await o.v1.lists.create({title:g,replies_policy:v,exclusive:y}),r("default"),i==null||i({state:"success",list:w}),setTimeout(()=>{u?ua(w):da(w)},1)}catch{r("error"),alert(s(u?{id:"R7ep1i"}:{id:"KPoj8w"}))}})()},children:[e("div",{class:"list-form-row",children:e("label",{for:"list-title",children:[e(f,{id:"6YtxFj"})," ",e("input",{ref:l,type:"text",id:"list-title",name:"title",required:!0,disabled:c==="loading",dir:"auto"})]})}),e("div",{class:"list-form-row",children:e("select",{ref:d,name:"replies_policy",required:!0,disabled:c==="loading",children:[e("option",{value:"list",children:e(f,{id:"ei6pnR"})}),e("option",{value:"followed",children:e(f,{id:"Mr53YX"})}),e("option",{value:"none",children:e(f,{id:"PM7llw"})})]})}),h&&e("div",{class:"list-form-row",children:e("label",{class:"label-block",children:[e("input",{ref:a,type:"checkbox",name:"exclusive",disabled:c==="loading"})," ",e(Bt,{insignificant:!0})," ",e(f,{id:"jxxYp0"})]})}),e("div",{class:"list-form-footer",children:[e("button",{type:"submit",disabled:c==="loading",children:s(u?{id:"tfDRzk"}:{id:"hYgDIe"})}),u&&e(pt,{disabled:c==="loading",align:"end",menuItemClassName:"danger",confirmLabel:s({id:"+kQ/cY"}),onClick:()=>{r("loading"),(async()=>{try{await o.v1.lists.$select(n.id).remove(),r("default"),i==null||i({state:"deleted"}),setTimeout(()=>{ha(n.id)},1)}catch{r("error"),alert(s({id:"tqUaGL"}))}})()},children:e("button",{type:"button",class:"light danger",disabled:c==="loading",children:e(f,{id:"Jb6/SB"})})})]})]})})]})}const fa=[60*5,60*30,60*60,60*60*6,60*60*24,60*60*24*3,60*60*24*7,60*60*24*30,0],Ht={0:{id:"9ZP9cc"},300:ot(5,"minute"),1800:ot(30,"minute"),3600:ot(1,"hour"),21600:ot(6,"hour"),86400:ot(1,"day"),259200:ot(3,"day"),604800:ot(1,"week"),2592e3:ot(30,"day")},ji=80,Vs=1e3*60*10;function pa(n,i){return i.v1.accounts.familiarFollowers.fetch({id:[n]})}const ma=bt(pa,{maxAge:Vs});async function ga(n,i){const s=i.v1.accounts.$select(n).statuses.list({limit:20}).values().next(),{value:o}=await s,c={total:o.length,originals:0,replies:0,boosts:0};return o.forEach(r=>{r.reblog?c.boosts++:r.inReplyToId&&r.inReplyToAccountId!==r.account.id?c.replies++:c.originals++}),o.length&&(c.daysSinceLastPost=Math.ceil((Date.now()-new Date(o[o.length-1].createdAt))/864e5)),c}const ya=bt(ga,{maxAge:Vs}),ba=80;function Gs({account:n,fetchAccount:i=()=>{},standalone:s,instance:o,authenticated:c,showEndorsements:r=!1}){const{i18n:u,_:l}=le(),{masto:d,authenticated:a}=re({instance:o}),{masto:h,instance:p}=re(),[m,g]=M("default"),v=typeof n=="string",[y,w]=M(v?null:n),b=Ae(()=>o===p,[o,p]);Q(()=>{if(!v){w(n);return}g("loading"),(async()=>{try{const z=await i();x.accounts[`${z.id}@${o}`]=z,w(z),g("default")}catch{w(null),g("error")}})()},[v,n,i]);const{acct:S,avatar:_,avatarStatic:T,bot:A,createdAt:k,displayName:C,emojis:E,fields:R,followersCount:F,followingCount:D,group:W,id:G,lastStatusAt:X,locked:q,note:Z,statusesCount:B,url:ee,username:$,memorial:K,moved:Y,roles:te,hideCollections:J}=y||{};let ue=!1,{header:he,headerStatic:ne}=y||{};(!he||/missing\.png$/.test(he))&&_&&!/missing\.png$/.test(_)&&(he=_,ue=!0,T&&!/missing\.png$/.test(T)&&(ne=T));const we=Ae(()=>G===kt(),[G]);Q(()=>{const z=!!(y!=null&&y.id&&(y!=null&&y.username)&&(y!=null&&y.acct)&&(y!=null&&y.avatar)&&(y!=null&&y.avatarStatic)&&(y!=null&&y.displayName)&&(y!=null&&y.url));if(we&&o&&z){const be=ri();let ve=!1;be.forEach(_e=>{_e.info.id===y.id&&_e.instanceURL===o&&(_e.info=y,ve=!0)}),ve&&Yt(be)}},[we,y,o]);const Ce=Ae(()=>{var ve;if(!ee)return null;const z=(ve=URL.parse(ee))==null?void 0:ve.hostname;return z?un.toUnicode(z):null},[ee]),[se,Te]=M([]),Ie=j(),Pe=j([]);async function $e(z){var Ze;(z||!Ie.current)&&(Ie.current=d.v1.accounts.$select(G).followers.list({limit:ji}).values());const be=await Ie.current.next();if(we||!b)return be;const{value:ve}=be;let _e=[];if(z){let Fe=[];try{Fe=await d.v1.accounts.familiarFollowers.fetch({id:[G]})}catch{}Pe.current=((Ze=Fe==null?void 0:Fe[0])==null?void 0:Ze.accounts)||[],_e=[...Pe.current,...ve.filter(de=>!Pe.current.some(ze=>ze.id===de.id))]}else ve!=null&&ve.length&&(_e=ve.filter(Fe=>!Pe.current.some(de=>de.id===Fe.id)));return{...be,value:_e}}const Ee=j();async function H(z){return(z||!Ee.current)&&(Ee.current=d.v1.accounts.$select(G).following.list({limit:ji}).values()),await Ee.current.next()}const ke=s?"div":ge,De=o?`/${o}/a/${G}`:`/a/${G}`,[xe,Me]=M([]),[me,N]=M(),[O,oe]=M("default"),Le=!!(me!=null&&me.total),P=async z=>{try{const be=await ma(z,h);Me(be[0].accounts.slice(0,va))}catch{}},ce=async()=>{if(G){oe("loading");try{const z=await ya(G,d);N(z),oe("default")}catch{oe("error")}}},Se=it(({relationship:z,currentID:be})=>{z.following||(P(be),!s&&B>0&&ce())},[s,G,B]),Ne=it(z=>{z.id===G&&(w(z),x.accounts[`${z.id}@${o}`]=z)},[G,o]),Oe=v&&n&&/^https?:\/\//.test(n),[L,V]=M(!1),[ae,ie]=M(!1);return e(U,{children:[e("div",{tabIndex:"-1",class:`account-container ${m==="loading"?"skeleton":""}`,style:{"--header-color-1":se[0],"--header-color-2":se[1],"--header-color-3":se[2],"--header-color-4":se[3]},children:[m==="error"&&e("div",{class:"ui-state",children:[e("p",{children:e(f,{id:"44hICK"})}),v?e("p",{children:Oe?e("a",{href:n,target:"_blank",rel:"noopener",children:n}):e("code",{class:"insignificant",children:n})}):e("p",{children:e("a",{href:ee,target:"_blank",rel:"noopener",children:[e(f,{id:"Aadw0+"})," ",e(I,{icon:"external"})]})})]}),m==="loading"?e(U,{children:[e("header",{children:e(ft,{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:"██"})," ",e(f,{id:"x5LEuB"})]}),e("div",{children:[e("span",{children:"██"})," ",e(f,{id:"following.stats"})]}),e("div",{children:[e("span",{children:"██"})," ",e(f,{id:"+owNNn"})]})]})]}),e("div",{class:"actions",children:[e("span",{}),e("span",{class:"buttons",children:e("button",{type:"button",class:"plain",disabled:!0,children:e(I,{icon:"more",size:"l",alt:l({id:"2FYpfJ"})})})})]})]})]}):y&&e(U,{children:[!!Y&&e("div",{class:"account-moved",children:[e("p",{children:e(f,{id:"C6cVP/",values:{displayName:C},components:{0:e("b",{})}})}),e(ft,{account:Y,instance:o,onClick:z=>{z.stopPropagation(),x.showAccount=Y}})]}),!!he&&!/missing\.png$/.test(he)&&e("img",{src:he,alt:"",class:`header-banner ${ue?"header-is-avatar":""}`,onError:z=>{z.target.crossOrigin?z.target.src!==ne?z.target.src=ne:(z.target.removeAttribute("crossorigin"),z.target.src=he):z.target.src!==ne?z.target.src=ne:z.target.remove()},crossOrigin:"anonymous",onLoad:z=>{z.target.classList.add("loaded");try{const be=window.OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"),ve=be.getContext("2d",{willReadFrequently:!0});be.width=z.target.width,be.height=z.target.height,ve.imageSmoothingEnabled=!1,ve.drawImage(z.target,0,0);const _e=10,Fe=[ve.getImageData(0,0,_e,_e).data,ve.getImageData(z.target.width-_e,0,_e,_e).data,ve.getImageData(0,z.target.height-_e,_e,_e).data,ve.getImageData(z.target.width-_e,z.target.height-_e,_e,_e).data].map(de=>{let ze=0,Ke=0,nt=0,Re=0;for(let at=0;at<de.length;at+=4)ze+=de[at],Ke+=de[at+1],nt+=de[at+2],Re+=de[at+3];const He=de.length/4;return[ze/He,Ke/He,nt/He,Re/He]}).map(de=>{const[ze,Ke,nt,Re]=ka(de);return`rgba(${ze}, ${Ke}, ${nt}, ${Re})`});Te(Fe)}catch{}}}),e("header",{children:s?e(dt,{shift:window.matchMedia("(min-width: calc(40em))").matches?114:64,menuButton:e("div",{children:e(ft,{account:y,instance:o,avatarSize:"xxxl",onClick:()=>{}})}),children:[e("div",{class:"szh-menu__header",children:e(Ea,{acct:S,instance:o})}),e(ye,{onClick:()=>{const z=S.includes("@")?`@${S}`:`@${S}@${o}`;try{navigator.clipboard.writeText(z),fe(l({id:"zJoEwS"}))}catch{fe(l({id:"BC0lSD"}))}},children:[e(I,{icon:"link"}),e("span",{children:e(f,{id:"27x6gl"})})]}),e(ye,{href:ee,target:"_blank",children:[e(I,{icon:"external"}),e("span",{children:e(f,{id:"Bz5hLl"})})]}),e(Ve,{}),e(ye,{onClick:()=>{x.showMediaModal={mediaAttachments:[{type:"image",url:T}]}},children:[e(I,{icon:"user"}),e("span",{children:e(f,{id:"7WYl2I"})})]}),!!ne&&!ue&&e(ye,{onClick:()=>{x.showMediaModal={mediaAttachments:[{type:"image",url:ne}]}},children:[e(I,{icon:"media"}),e("span",{children:e(f,{id:"ZNme5R"})})]}),a&&we&&Je("@mastodon/profile-edit")&&e(U,{children:[e(Ve,{}),e(ye,{onClick:()=>{V(!0)},children:[e(I,{icon:"pencil"}),e("span",{children:e(f,{id:"9OpVZg"})})]})]})]}):e(ft,{account:y,instance:o,avatarSize:"xxxl",internal:!0})}),e("div",{class:"faux-header-bg","aria-hidden":"true"}),e("main",{children:[!!K&&e("span",{class:"tag",children:e(f,{id:"prdIOK"})}),!!A&&e("span",{class:"tag",children:[e(I,{icon:"bot"})," ",e(f,{id:"9Vdq+j"})]}),!!W&&e("span",{class:"tag",children:[e(I,{icon:"group"})," ",e(f,{id:"L8fEEm"})]}),te==null?void 0:te.map(z=>e("span",{class:"tag",children:[z.name,!!Ce&&e(U,{children:[" ",e("span",{class:"more-insignificant",children:Ce})]})]})),e("div",{class:"note",dir:"auto",onClick:Es({instance:p}),dangerouslySetInnerHTML:{__html:Qn(Z,{emojis:E})}}),e("div",{class:"account-metadata-box",children:[(R==null?void 0:R.length)>0&&e("div",{class:"profile-metadata",children:R.map(({name:z,value:be,verifiedAt:ve},_e)=>e("div",{class:`profile-field ${ve?"profile-verified":""}`,dir:"auto",children:[e("b",{children:[e(Rs,{text:z,emojis:E})," ",!!ve&&e(I,{icon:"check-circle",size:"s",alt:l({id:"QDEWii"})})]}),e("p",{dangerouslySetInnerHTML:{__html:Qn(be,{emojis:E})}})]},z+_e))}),e("div",{class:"stats",children:[e(ke,{tabIndex:0,to:De,onClick:()=>{setTimeout(()=>{x.showGenericAccounts={id:"followers",heading:l({id:"x5LEuB"}),fetchAccounts:$e,instance:o,excludeRelationshipAttrs:we?["followedBy"]:[],blankCopy:J?l({id:"BRV/wh"}):void 0}},0)},children:[!!xe.length&&e("span",{class:"shazam-container-horizontal",children:e("span",{class:"shazam-container-inner stats-avatars-bunch",children:xe.map(z=>e(mt,{url:z.avatarStatic,size:"s",alt:`${z.displayName} @${z.acct}`,squircle:z==null?void 0:z.bot}))})}),e("span",{title:F,children:Qe(F)})," ",e(f,{id:"x5LEuB"})]}),e(ke,{class:"insignificant",tabIndex:0,to:De,onClick:()=>{setTimeout(()=>{x.showGenericAccounts={heading:l({id:"following.stats"}),fetchAccounts:H,instance:o,excludeRelationshipAttrs:we?["following"]:[],blankCopy:J?l({id:"BRV/wh"}):void 0}},0)},children:[e("span",{title:D,children:Qe(D)})," ",e(f,{id:"following.stats"}),e("br",{})]}),e(ke,{class:"insignificant",to:De,children:[e("span",{title:B,children:Qe(B)})," ",e(f,{id:"+owNNn"})]}),!!k&&e("div",{class:"insignificant",children:e(f,{id:"PCcEFZ",values:{0:ct(k,{hideTime:!0})},components:{0:e("time",{datetime:k})}})})]})]}),!!me&&e(ke,{to:De,class:"account-metadata-box",children:e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:Le?e("div",{class:"posting-stats",title:l({id:"wiuWLe",values:{0:(me.originals/me.total).toLocaleString(u.locale||void 0,{style:"percent"}),1:(me.replies/me.total).toLocaleString(u.locale||void 0,{style:"percent"}),2:(me.boosts/me.total).toLocaleString(u.locale||void 0,{style:"percent"})}}),children:[e("div",{children:me.daysSinceLastPost<365?pe._({id:"oZUtTk",values:{0:me.total,1:me.daysSinceLastPost,2:me.daysSinceLastPost,3:me.daysSinceLastPost,4:me.total,5:me.total,6:me.daysSinceLastPost}}):pe._({id:"JvA7Mo",values:{0:me.total,1:me.total}})}),e("div",{class:"posting-stats-bar",style:{"--originals-percentage":`${me.originals/me.total*100}%`,"--replies-percentage":`${(me.originals+me.replies)/me.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"})," ",e(f,{id:"HxF6Fk"})]})," ",e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-legend-item-replies"})," ",e(f,{id:"N8UzTV"})]})," ",e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-legend-item-boosts"})," ",e(f,{id:"puY2t0"})]})]})]}):e("div",{class:"posting-stats",children:e(f,{id:"vl3XTJ"})})})})}),!Y&&e("div",{class:"account-metadata-box",children:e("div",{class:"shazam-container no-animation",hidden:!!me,children:e("div",{class:"shazam-container-inner",children:e("button",{type:"button",class:"posting-stats-button",disabled:O==="loading",onClick:()=>{ce()},children:[e("div",{class:`posting-stats-bar posting-stats-icon ${O==="loading"?"loading":""}`,style:{"--originals-percentage":"33%","--replies-percentage":"66%"}}),e(f,{id:"PjP87f"})," "]})})})})]}),e("footer",{children:e(wa,{info:y,instance:o,standalone:s,authenticated:c,onRelationshipChange:Se,onProfileUpdate:Ne,setShowEditProfile:V,showEndorsements:r,renderEndorsements:ae,setRenderEndorsements:ie})}),e(Ra,{accountID:G,info:y,open:ae,onlyOpenIfHasEndorsements:ae==="onlyOpenIfHasEndorsements"})]})]}),!!L&&e(Ye,{onClose:()=>{V(!1)},children:e(Aa,{onClose:({state:z,account:be}={})=>{V(!1),z==="success"&&be&&Ne(be)}})})]})}const va=3;function wa({info:n,instance:i,standalone:s,authenticated:o,onRelationshipChange:c=()=>{},onProfileUpdate:r=()=>{},setShowEditProfile:u=()=>{},showEndorsements:l=!1,renderEndorsements:d=!1,setRenderEndorsements:a=()=>{}}){var N;if(!n)return null;const{_:h,_:p}=le(),{masto:m,instance:g,authenticated:v}=re(),y=i===g,[w,b]=M("default"),[S,_]=M(null),{id:T,acct:A,url:k,username:C,locked:E,lastStatusAt:R,note:F,fields:D,moved:W}=n,G=j(T),{following:X,showingReblogs:q,notifying:Z,followedBy:B,blocking:ee,blockedBy:$,muting:K,mutingNotifications:Y,requested:te,domainBlocking:J,endorsed:ue,note:he}=S||{},[ne,we]=M(null),[Ce,se]=M(!1),Te=A.includes("@")?A:`${A}@${i}`,Ie=Je("@mastodon/endorsements");Q(()=>{if(n){const O=kt();let oe;(async()=>{if(y&&o)oe=T;else if(!y&&v){const P=n.acct.includes("@");try{const ce=await m.v2.search.list({q:P?n.acct:`${n.username}@${i}`,type:"accounts",limit:1,resolve:!0});ce.accounts.length&&(oe=ce.accounts[0].id,we(ce.accounts[0]))}catch{}}if(!oe)return;if(O===oe){se(!0);return}G.current=oe,b("loading");const Le=m.v1.accounts.relationships.fetch({id:[oe]});try{const P=await Le;if(b("default"),P.length){const ce=P[0];_(ce),c({relationship:ce,currentID:oe})}}catch{b("error")}})()}},[n,o]),Q(()=>{n&&Ce&&Ao(n)},[n,Ce]);const Pe=w==="loading",[$e,Ee]=M(!1),[H,ke]=M(!1),[De,xe]=M(!1),[Me,me]=M([]);return e(U,{children:[e("div",{class:"actions",children:[e("span",{children:[B?e("span",{class:"tag",children:e(f,{id:"p3UO/y"})}):R?e("small",{class:"insignificant",children:e(f,{id:"F3cM1G",values:{0:ct(R,{hideTime:!0})},components:{0:e("span",{class:"ib"})}})}):e("span",{}),K&&e("span",{class:"tag danger",children:e(f,{id:"+IJm1Z"})}),ee&&e("span",{class:"tag danger",children:e(f,{id:"32TndD"})})]})," ",e("span",{class:"buttons",children:[!!he&&e("button",{type:"button",class:"private-note-tag",title:p({id:"zxFxcH"}),onClick:()=>{xe(!0)},dir:"auto",children:e("span",{children:he})}),e(dt,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:e("button",{type:"button",class:"plain",disabled:Pe,children:e(I,{icon:"more",size:"l",alt:p({id:"2FYpfJ"})})}),onMenuChange:O=>{X&&O.open&&(async()=>{try{const oe=await m.v1.accounts.$select(G.current).lists.list();me(oe)}catch{}})()},children:[v&&!Ce?e(U,{children:[e(ye,{onClick:()=>{Ts({draftStatus:{status:`@${(ne==null?void 0:ne.acct)||A} `}})},children:[e(I,{icon:"at"}),e("span",{children:e(f,{id:"3LkfZu",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]}),e(ye,{onClick:()=>{Ee(!0)},children:[e(I,{icon:"translate"}),e("span",{children:e(f,{id:"R8mSiS"})})]}),Je("@mastodon/profile-private-note")&&e(ye,{onClick:()=>{xe(!0)},children:[e(I,{icon:"pencil"}),e("span",{children:p(he?{id:"U+Gokq"}:{id:"VcQzRi"})})]}),X&&!!S&&e(U,{children:[e(ye,{onClick:()=>{b("loading"),(async()=>{try{const O=await m.v1.accounts.$select(G.current).follow({notify:!Z});O&&_(O),b("default"),fe(O.notifying?p({id:"jL3N0G",values:{username:C}}):p({id:"0h4/9h",values:{username:C}}))}catch(O){alert(O),b("error")}})()},children:[e(I,{icon:"notification"}),e("span",{children:p(Z?{id:"osJmEN"}:{id:"I92Z+b"})})]}),e(ye,{onClick:()=>{b("loading"),(async()=>{try{const O=await m.v1.accounts.$select(G.current).follow({reblogs:!q});O&&_(O),b("default"),fe(O.showingReblogs?p({id:"0X2KC8",values:{username:C}}):p({id:"cXWjH0",values:{username:C}}))}catch(O){alert(O),b("error")}})()},children:[e(I,{icon:"rocket"}),e("span",{children:p(q?{id:"GRUr8d"}:{id:"uREpT3"})})]})]}),Ie&&X&&e(ye,{onClick:()=>{b("loading"),(async()=>{try{if(ue){const O=await m.v1.accounts.$select((ne==null?void 0:ne.id)||T).unpin();_(O),b("default"),fe(p({id:"pWFLFk",values:{username:C}}))}else{const O=await m.v1.accounts.$select((ne==null?void 0:ne.id)||T).pin();_(O),b("default"),fe(p({id:"xhiXaF",values:{username:C}}))}}catch{b("error"),ue?fe(p({id:"xHq5L2",values:{username:C}})):fe(p({id:"Owr/5+",values:{username:C}}))}})()},children:[e(I,{icon:"endorsement"}),p(ue?{id:"S9JvjK"}:{id:"UlJ3QN"})]}),l&&Ie&&!d&&e(ye,{onClick:()=>a(!0),children:[e(I,{icon:"endorsement"}),e("span",{children:e(f,{id:"Qopbnd"})})]}),X&&e(ye,{onClick:()=>{ke(!0)},children:[e(I,{icon:"list"}),Me.length?e(U,{children:[e("small",{class:"menu-grow",children:[e(f,{id:"sJ2yQc"}),e("br",{}),e("span",{class:"more-insignificant",children:Me.map(O=>O.title).join(", ")})]}),e("small",{class:"more-insignificant",children:Me.length})]}):e("span",{children:e(f,{id:"sJ2yQc"})})]}),e(Ve,{})]}):Ie&&!d&&e(U,{children:[e(ye,{onClick:()=>a(!0),children:[e(I,{icon:"endorsement"}),"Show featured profiles"]}),e(Ve,{})]}),e(ye,{onClick:()=>{const O=`@${(ne==null?void 0:ne.acct)||Te}`;try{navigator.clipboard.writeText(O),fe(p({id:"zJoEwS"}))}catch{fe(p({id:"BC0lSD"}))}},children:[e(I,{icon:"copy"}),e("small",{children:[e(f,{id:"27x6gl"}),e("br",{}),e("span",{class:"more-insignificant bidi-isolate",children:["@",(ne==null?void 0:ne.acct)||Te]})]})]}),e(ye,{href:k,target:"_blank",children:[e(I,{icon:"external"}),e("small",{class:"menu-double-lines",children:Sa(k)})]}),e("div",{class:"menu-horizontal",children:[e(ye,{onClick:()=>{try{navigator.clipboard.writeText(k),fe(p({id:"edWbV6"}))}catch{fe(p({id:"W1ewR0"}))}},children:[e(I,{icon:"link"}),e("span",{children:e(f,{id:"he3ygx"})})]}),(navigator==null?void 0:navigator.share)&&((N=navigator==null?void 0:navigator.canShare)==null?void 0:N.call(navigator,{url:k}))&&e(ye,{onClick:()=>{try{navigator.share({url:k})}catch{alert(p({id:"TtG3Uh"}))}},children:[e(I,{icon:"share"}),e("span",{children:e(f,{id:"LFKLqp"})})]})]}),!!S&&e(U,{children:[e(Ve,{}),K?e(ye,{onClick:()=>{b("loading"),(async()=>{try{const O=await m.v1.accounts.$select((ne==null?void 0:ne.id)||T).unmute();_(O),b("default"),fe(p({id:"B4Xkly",values:{username:C}})),x.reloadGenericAccounts.id="mute",x.reloadGenericAccounts.counter++}catch{b("error")}})()},children:[e(I,{icon:"unmute"}),e("span",{children:e(f,{id:"Q/HUhC",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]}):e(dn,{menuClassName:"menu-blur",openTrigger:"clickOnly",direction:"bottom",overflow:"auto",shift:16,label:e(U,{children:[e(I,{icon:"mute"}),e("span",{class:"menu-grow",children:e(f,{id:"xhPEH3",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})}),e("span",{style:{textOverflow:"clip"},children:[e(I,{icon:"time"}),e(I,{icon:"chevron-right"})]})]}),children:e("div",{class:"menu-wrap",children:fa.map(O=>e(ye,{onClick:()=>{b("loading"),(async()=>{try{const oe=await m.v1.accounts.$select((ne==null?void 0:ne.id)||T).mute({duration:O});_(oe),b("default"),fe(p({id:"/plB9m",values:{0:typeof Ht[O]=="function"?Ht[O]():h(Ht[O]),username:C}})),x.reloadGenericAccounts.id="mute",x.reloadGenericAccounts.counter++}catch{b("error"),fe(p({id:"vWGBjT",values:{username:C}}))}})()},children:typeof Ht[O]=="function"?Ht[O]():h(Ht[O])}))})}),B&&e(pt,{subMenu:!0,menuItemClassName:"danger",confirmLabel:e(U,{children:[e(I,{icon:"user-x"}),e("span",{children:e(f,{id:"unyq2W",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]}),onClick:()=>{b("loading"),(async()=>{try{const O=await m.v1.accounts.$select((ne==null?void 0:ne.id)||T).removeFromFollowers();_(O),b("default"),fe(p({id:"AgkcM/",values:{username:C}})),x.reloadGenericAccounts.id="followers",x.reloadGenericAccounts.counter++}catch{b("error")}})()},children:[e(I,{icon:"user-x"}),e("span",{children:e(f,{id:"VCZ0OT"})})]}),e(pt,{subMenu:!0,confirm:!ee,confirmLabel:e(U,{children:[e(I,{icon:"block"}),e("span",{children:e(f,{id:"aforS9",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]}),itemProps:{className:"danger"},menuItemClassName:"danger",onClick:()=>{b("loading"),(async()=>{try{if(ee){const O=await m.v1.accounts.$select((ne==null?void 0:ne.id)||T).unblock();_(O),b("default"),fe(p({id:"sI9N29",values:{username:C}}))}else{const O=await m.v1.accounts.$select((ne==null?void 0:ne.id)||T).block();_(O),b("default"),fe(p({id:"uYcYzu",values:{username:C}}))}x.reloadGenericAccounts.id="block",x.reloadGenericAccounts.counter++}catch{b("error"),ee?fe(p({id:"0tG4wG",values:{username:C}})):fe(p({id:"pA+qEx",values:{username:C}}))}})()},children:ee?e(U,{children:[e(I,{icon:"unblock"}),e("span",{children:e(f,{id:"/3LJfX",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]}):e(U,{children:[e(I,{icon:"block"}),e("span",{children:e(f,{id:"JRswkR",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]})}),e(ye,{className:"danger",onClick:()=>{x.showReportModal={account:ne||n}},children:[e(I,{icon:"flag"}),e("span",{children:e(f,{id:"qTJgpR",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]})]}),v&&Ce&&s&&Je("@mastodon/profile-edit")&&e(U,{children:[e(Ve,{}),e(ye,{onClick:()=>{u(!0)},children:[e(I,{icon:"pencil"}),e("span",{children:e(f,{id:"9OpVZg"})})]})]}),!1]}),!S&&w==="loading"&&e(Be,{abrupt:!0}),!!S&&!W&&e(pt,{confirm:X||te,confirmLabel:e("span",{children:p(te?{id:"e7qQIH"}:{id:"eYsAQr",values:{0:n.acct||n.username}})}),menuItemClassName:"danger",align:"end",disabled:Pe,onClick:()=>{b("loading"),(async()=>{try{let O;X||te?O=await m.v1.accounts.$select(G.current).unfollow():O=await m.v1.accounts.$select(G.current).follow(),O&&(_(O),O.following&&a("onlyOpenIfHasEndorsements")),b("default")}catch(O){alert(O),b("error")}})()},children:e("button",{type:"button",class:`${X||te?"light swap":""}`,"data-swap-state":X||te?"danger":"",disabled:Pe,children:X?e(U,{children:[e("span",{children:e(f,{id:"y6sq5j"})}),e("span",{children:e(f,{id:"HKrBPX"})})]}):te?e(U,{children:[e("span",{children:e(f,{id:"Yx0Ud8"})}),e("span",{children:e(f,{id:"yTVtKs"})})]}):E?e(U,{children:[e(I,{icon:"lock"})," ",e("span",{children:e(f,{id:"MKEPCY"})})]}):p({id:"MKEPCY"})})})]})]}),!!$e&&e(Ye,{onClose:()=>{Ee(!1)},children:e(_a,{note:F,fields:D,onClose:()=>Ee(!1)})}),!!H&&e(Ye,{onClose:()=>{ke(!1)},children:e(Ca,{accountID:G.current,onClose:()=>ke(!1)})}),!!De&&e(Ye,{onClose:()=>{xe(!1)},children:e(Ia,{account:n,note:he,onRelationshipChange:O=>{_(O)},onClose:()=>xe(!1)})})]})}function ka([n,i,s]){const o=.2126*n+.7152*i+.0722*s;let c;return o>=220?c=1:o<=50?c=.1:c=o/255,c=Math.min(1,c),[n,i,s,c]}function Sa(n){if(!n)return;const i=URL.parse(n);if(!i)return;const{host:s,pathname:o}=i,c=o.replace(/\/$/,"").replace(/^\//,"");return e(U,{children:[e("span",{class:"more-insignificant",children:[un.toUnicode(s),"/"]}),e("wbr",{}),e("span",{children:c})]})}function _a({note:n,fields:i,onClose:s}){const{_:o}=le(),c=(i==null?void 0:i.map(({name:u,value:l})=>`${u}
${Pi(l)}`).join(`
`))||"",r=Pi(n)+(c?`
${c}`:"");return e("div",{class:"sheet",children:[!!s&&e("button",{type:"button",class:"sheet-close",onClick:s,children:e(I,{icon:"x",alt:o({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(f,{id:"9groMz"})})}),e("main",{children:[e("p",{style:{whiteSpace:"pre-wrap"},children:r}),e(Ls,{forceTranslate:!0,text:r})]})]})}function Ca({accountID:n,onClose:i}){const{_:s}=le(),{masto:o}=re(),[c,r]=M("default"),[u,l]=M([]),[d,a]=M([]),[h,p]=Lt(v=>v+1,0);Q(()=>{r("loading"),(async()=>{try{const v=await hn();l(v);const y=await o.v1.accounts.$select(n).lists.list();a(y),r("default")}catch{r("error")}})()},[h]);const[m,g]=M(!1);return e("div",{class:"sheet",id:"list-add-remove-container",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(I,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(f,{id:"sJ2yQc"})})}),e("main",{children:[u.length>0?e("ul",{class:"list-add-remove",children:u.map(v=>{const y=d.some(w=>w.id===v.id);return e("li",{children:e("button",{type:"button",class:`light ${y?"checked":""}`,disabled:c==="loading",onClick:()=>{r("loading"),(async()=>{try{y?await o.v1.lists.$select(v.id).accounts.remove({accountIds:[n]}):await o.v1.lists.$select(v.id).accounts.create({accountIds:[n]}),p()}catch{r("error"),alert(s(y?{id:"7KnEYa"}:{id:"Tba8uO"}))}})()},children:[e(I,{icon:"check-circle",alt:"☑️"}),e("span",{children:v.title})]})})})}):c==="loading"?e("p",{class:"ui-state",children:e(Be,{abrupt:!0})}):c==="error"?e("p",{class:"ui-state",children:e(f,{id:"v/l5uA"})}):e("p",{class:"ui-state",children:e(f,{id:"/MJ7gZ"})}),e("button",{type:"button",class:"plain2",onClick:()=>g(!0),disabled:c!=="default",children:[e(I,{icon:"plus",size:"l"})," ",e("span",{children:e(f,{id:"Sb2gYF"})})]})]}),m&&e(Ye,{onClick:v=>{v.target===v.currentTarget&&g(!1)},children:e(Ti,{list:m==null?void 0:m.list,onClose:v=>{v.state==="success"&&p(),g(!1)}})})]})}function Ia({account:n,note:i,onRelationshipChange:s=()=>{},onClose:o=()=>{}}){const{_:c}=le(),{masto:r}=re(),[u,l]=M("default"),d=j(null);return Q(()=>{let a;return d.current&&!i&&(a=setTimeout(()=>{var h,p;(p=(h=d.current).focus)==null||p.call(h)},100)),()=>{clearTimeout(a)}},[]),e("div",{class:"sheet",id:"private-note-container",children:[!!o&&e("button",{type:"button",class:"sheet-close",onClick:o,children:e(I,{icon:"x",alt:c({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(f,{id:"DYqYm5",values:{0:(n==null?void 0:n.username)||(n==null?void 0:n.acct)},components:{0:e("span",{class:"bidi-isolate"})}})})}),e("main",{children:e("form",{onSubmit:a=>{a.preventDefault();const p=new FormData(a.target).get("note");(p==null?void 0:p.trim())!==(i==null?void 0:i.trim())&&(l("loading"),(async()=>{try{const m=await r.v1.accounts.$select(n==null?void 0:n.id).note.create({comment:p});l("default"),s(m),o()}catch(m){l("error"),alert((m==null?void 0:m.message)||c({id:"ot8LpF"}))}})())},children:[e("textarea",{ref:d,name:"note",disabled:u==="loading",dir:"auto",children:i}),e("footer",{children:[e("button",{type:"button",class:"light",disabled:u==="loading",onClick:()=>{o==null||o()},children:e(f,{id:"dEgA5A"})}),e("span",{children:[e(Be,{abrupt:!0,hidden:u!=="loading"}),e("button",{disabled:u==="loading",type:"submit",children:e(f,{id:"SrwrEj"})})]})]})]})})]})}const Ta=["image/jpeg","image/png","image/gif","image/webp"],Vi=Ta.join(",");function Aa({onClose:n=()=>{}}){const{_:i}=le(),{masto:s}=re(),[o,c]=M("loading"),[r,u]=M(null),[l,d]=M(null),[a,h]=M(null);Q(()=>{(async()=>{try{const T=await s.v1.accounts.verifyCredentials();u(T),c("default")}catch{c("error")}})()},[]);const{displayName:p,source:m,avatar:g,header:v}=r||{},{note:y,fields:w}=m||{},b=j(null),S=[...g?[{type:"image",url:g}]:[],...a?[{type:"image",url:a}]:[]],_=[...v?[{type:"image",url:v}]:[],...l?[{type:"image",url:l}]:[]];return e("div",{class:"sheet",id:"edit-profile-container",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(f,{id:"9OpVZg"})})}),e("main",{children:o==="loading"?e("p",{class:"ui-state",children:e(Be,{abrupt:!0})}):e("form",{onSubmit:T=>{T.preventDefault();const A=new FormData(T.target),k=A.get("header"),C=A.get("avatar"),E=A.get("display_name"),R=A.get("note"),F=b.current.querySelectorAll('input[name^="fields_attributes"]'),D=[];F.forEach(W=>{const G=W.name,[X,q,Z]=G.match(/fields_attributes\[(\d+)\]\[(.+)\]/)||[],B=W.value?W.value.trim():"";q&&Z&&B&&(D[q]||(D[q]={}),D[q][Z]=B)}),D.forEach(W=>{W.name&&!W.value&&(W.value="")}),(async()=>{try{const W=await s.v1.accounts.updateCredentials({header:k,avatar:C,displayName:E,note:R,fieldsAttributes:D});n==null||n({state:"success",account:W})}catch(W){alert((W==null?void 0:W.message)||i({id:"FwMMx0"}))}})()},children:[e("div",{class:"edit-profile-media-container",children:[e("label",{children:[e(f,{id:"C5zXYJ"})," ",e("input",{type:"file",name:"header",accept:Vi,onChange:T=>{const A=T.target.files[0];if(A){const k=URL.createObjectURL(A);d(k)}}})]}),e("div",{class:"edit-profile-media-field",children:[v?e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{x.showMediaModal={mediaAttachments:_,mediaIndex:0}},children:e("img",{src:v,alt:""})}):e("div",{class:"edit-media"}),l&&e(U,{children:[e(I,{icon:"arrow-right"}),e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{x.showMediaModal={mediaAttachments:_,mediaIndex:1}},children:e("img",{src:l,alt:""})})]})]})]}),e("div",{class:"edit-profile-media-container",children:[e("label",{children:[e(f,{id:"4XF0BB"})," ",e("input",{type:"file",name:"avatar",accept:Vi,onChange:T=>{const A=T.target.files[0];if(A){const k=URL.createObjectURL(A);h(k)}}})]}),e("div",{class:"edit-profile-media-field",children:[g?e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{x.showMediaModal={mediaAttachments:S,mediaIndex:0}},children:e("img",{src:g,alt:""})}):e("div",{class:"edit-media"}),a&&e(U,{children:[e(I,{icon:"arrow-right"}),e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{x.showMediaModal={mediaAttachments:S,mediaIndex:1}},children:e("img",{src:a,alt:""})})]})]})]}),e("p",{children:e("label",{children:[e(f,{id:"6YtxFj"})," ",e("input",{type:"text",name:"display_name",defaultValue:p,maxLength:30,disabled:o==="loading",dir:"auto"})]})}),e("p",{children:e("label",{children:[e(f,{id:"E+oKCO"}),e("textarea",{defaultValue:y,name:"note",maxLength:500,rows:"5",disabled:o==="loading",dir:"auto"})]})}),e("p",{children:e(f,{id:"T4I119"})}),e("table",{ref:b,children:[e("thead",{children:e("tr",{children:[e("th",{children:e(f,{id:"87a/t/"})}),e("th",{children:e(f,{id:"4b3oEV"})})]})}),e("tbody",{children:Array.from({length:Math.max(4,w.length)}).map((T,A)=>{const{name:k="",value:C=""}=w[A]||{};return e(xa,{name:k,value:C,index:A,disabled:o==="loading"},A)})})]}),e("footer",{children:[e("button",{type:"button",class:"light",disabled:o==="loading",onClick:()=>{n==null||n()},children:e(f,{id:"dEgA5A"})}),e("button",{type:"submit",disabled:o==="loading",children:e(f,{id:"tfDRzk"})})]})]})})]})}function xa({name:n,value:i,disabled:s,index:o}){const[c,r]=M(!!i);return e("tr",{children:[e("td",{children:e("input",{type:"text",name:`fields_attributes[${o}][name]`,defaultValue:n,disabled:s,maxLength:255,required:c,dir:"auto"})}),e("td",{children:e("input",{type:"text",name:`fields_attributes[${o}][value]`,defaultValue:i,disabled:s,maxLength:255,onChange:u=>r(!!u.currentTarget.value),dir:"auto"})})]})}function Ea({acct:n,instance:i}){let[s,o]=n.split("@");o||(o=i);const c=un.toASCII(n);return e("div",{class:"handle-info",children:[e("span",{class:"handle-handle",title:c,children:[e("b",{class:"handle-username",children:s}),e("span",{class:"handle-at",children:"@"}),e("b",{class:"handle-server",children:o})]}),e("div",{class:"handle-legend",children:[e("span",{class:"ib",children:[e("span",{class:"handle-legend-icon username"})," ",e(f,{id:"silO9A"})]})," ",e("span",{class:"ib",children:[e("span",{class:"handle-legend-icon server"})," ",e(f,{id:"rZgCpJ"})]})]})]})}function Ra({accountID:n,info:i,open:s=!1,onlyOpenIfHasEndorsements:o=!1}){const{masto:c}=re(),r=j(),[u,l]=M("default"),[d,a]=M([]),[h,p]=M({});return Q(()=>{Je("@mastodon/endorsements")&&s&&(async()=>{l("loading");try{const g=await c.v1.accounts.$select(n).endorsements.list({limit:ba});if(!g.length){l("default");return}a(g),l("default"),setTimeout(()=>{r.current.scrollIntoView({behavior:"smooth",block:"nearest"})},300);const v=await Pn(g,h);v&&p(v)}catch{l("error")}})()},[s,n]),(o?s&&d.length>0:s)?e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e("div",{class:"endorsements-container",ref:r,children:[e("h3",{children:e(f,{id:"UIfdY1",values:{0:i.username}})}),u==="loading"?e("p",{class:"ui-state",children:e(Be,{abrupt:!0})}):d.length>0?e("ul",{class:`endorsements ${d.length>10?"expanded":""}`,children:d.map(g=>e("li",{children:e(ft,{account:g,showStats:!0,avatarSize:"xxl",relationship:h[g.id]},g.id)}))}):e("p",{class:"ui-state insignificant",children:e(f,{id:"AgkUZa"})})]})})}):null}function La({account:n,instance:i,onClose:s}){const{_:o}=le(),{masto:c,instance:r,authenticated:u}=re({instance:i}),l=typeof n=="string";return Q(()=>{l||(x.accounts[`${n.id}@${r}`]=n)},[n]),qs(s),e("div",{class:"sheet",children:[!!s&&e("button",{type:"button",class:"sheet-close outer",onClick:s,children:e(I,{icon:"x",alt:o({id:"yz7wBu"})})}),e(Gs,{instance:r,authenticated:u,account:n,fetchAccount:async()=>{if(l)try{return await c.v1.accounts.lookup({acct:n,skip_webfinger:!1})}catch{const a=await c.v2.search.list({q:n,type:"accounts",limit:u?1:11,resolve:u});if(a.accounts.length){const h=a.accounts.find(p=>p.url===n||n.startsWith(p.url));if(h)return h}if(/^https?:\/\/[^/]+\/@[^/]+$/.test(n)){const h=URL.parse(n);if(h){const{hostname:p,pathname:m}=h,g=m.replace(/^\//,"").replace(/\/$/,"")+"@"+p,v=await c.v2.search.list({q:g,type:"accounts",limit:1,resolve:u});if(v.accounts.length)return v.accounts[0]}}}else return n}})]})}function Ma({onClose:n}){const{_:i}=le(),{masto:s}=re(),[o,c]=M("default"),[r,u]=M([]),[l,d]=Lt(h=>h+1,0);Q(()=>{c("loading"),(async()=>{try{const h=await gt.drafts.keys();if(h.length){const p=An(),m=h.filter(g=>g.startsWith(p));if(m.length){const g=await gt.drafts.getMany(m);g.sort((v,y)=>new Date(y.updatedAt).getTime()-new Date(v.updatedAt).getTime()),u(g)}else u([])}else u([]);c("default")}catch{c("error")}})()},[l]);const a=(r==null?void 0:r.length)>0;return e("div",{class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:[e("h2",{children:[e(f,{id:"krk5ws"})," ",e(Be,{abrupt:!0,hidden:o!=="loading"})]}),a&&e("div",{class:"insignificant",children:e(f,{id:"Ap/10+"})})]}),e("main",{children:a?e(U,{children:[e("ul",{class:"drafts-list",children:r.map(h=>{const{updatedAt:p,key:m,draftStatus:g,replyTo:v}=h,y=new Date(p);return e("li",{children:[e("div",{class:"mini-draft-meta",children:[e("b",{children:[e(I,{icon:v?"reply":"quill",size:"s"})," ",e("time",{children:[!!v&&e(U,{children:[e("span",{class:"bidi-isolate",children:["@",v.account.acct]}),e("br",{})]}),ct(y)]})]}),e(pt,{confirmLabel:e("span",{children:e(f,{id:"/W5yFF"})}),menuItemClassName:"danger",align:"end",disabled:o==="loading",onClick:()=>{(async()=>{try{await gt.drafts.del(m),d()}catch{alert(i({id:"rEYoku"}))}})()},children:e("button",{type:"button",class:"small light",disabled:o==="loading",children:e(f,{id:"Jb6/SB"})})})]}),e("button",{type:"button",disabled:o==="loading",class:"draft-item",onClick:async()=>{let w;if(v){c("loading");try{w=await s.v1.statuses.$select(v.id).fetch()}catch{alert(i({id:"tMwimH"})),c("default");return}c("default")}window.__COMPOSE__={draftStatus:g,replyToStatus:w},x.showCompose=!0,x.showDrafts=!1},children:e($a,{draft:h})})]},p)})}),r.length>1&&e("p",{children:e(pt,{confirmLabel:e("span",{children:e(f,{id:"3IakFR"})}),menuItemClassName:"danger",disabled:o==="loading",onClick:()=>{(async()=>{c("loading");try{await gt.drafts.delMany(r.map(h=>h.key)),c("default"),d()}catch{alert(i({id:"0J4sZq"})),c("error")}})()},children:e("button",{type:"button",class:"light danger",disabled:o==="loading",children:e(f,{id:"hOg+Mt"})})})})]}):e("p",{children:e(f,{id:"8iQ+jk"})})})]})}function $a({draft:n}){var m;const{_:i}=le(),{draftStatus:s,replyTo:o}=n,{status:c,spoilerText:r,poll:u,mediaAttachments:l}=s,d=((m=u==null?void 0:u.options)==null?void 0:m.length)>0,a=(l==null?void 0:l.length)>0,h=d||a,p=Ae(()=>{if(!a)return;const g=l.find(w=>/image/.test(w.type));if(!g)return;const{file:v}=g;return URL.createObjectURL(v)},[a,l]);return e(U,{children:e("div",{class:"mini-draft",children:[h&&e("div",{class:`mini-draft-aside ${p?"has-image":""}`,style:p?{"--bg-image":`url(${p})`}:{},children:[d&&e(I,{icon:"poll",alt:i({id:"4WUbF1"})}),a&&e("span",{children:[e(I,{icon:"attachment",alt:i({id:"xYilR2"})})," ",e("small",{children:l==null?void 0:l.length})]})]}),e("div",{class:"mini-draft-main",children:[!!r&&e("div",{class:"mini-draft-spoiler",children:r}),!!c&&e("div",{class:"mini-draft-status",children:c})]})]})})}function Na({html:n,url:i,width:s,height:o,onClose:c=()=>{}}){const{_:r}=le();return e("div",{class:"embed-modal-container",children:[e("div",{class:"top-controls",children:[e("button",{type:"button",class:"light",onClick:()=>c(),children:e(I,{icon:"x",alt:r({id:"yz7wBu"})})}),i&&e("a",{href:i,target:"_blank",rel:"noopener",class:"button plain",children:[e("span",{children:e(f,{id:"4/RpOy"})})," ",e(I,{icon:"external"})]})]}),e("div",{class:"embed-content",dangerouslySetInnerHTML:{__html:n},style:{"--width":s+"px","--height":o+"px","--aspect-ratio":`${s}/${o}`}})]})}function Pa({instance:n,excludeRelationshipAttrs:i=[],postID:s,onClose:o=()=>{},blankCopy:c}){const{_:r}=le(),{masto:u,instance:l}=re(),d=n?n===l:!0,a=We(x),[h,p]=M("default"),[m,g]=M(!1);if(qs(o),!a.showGenericAccounts)return null;const{id:v,heading:y,fetchAccounts:w,accounts:b,showReactions:S}=a.showGenericAccounts,[_,T]=M(b!=null&&b.length?b:[]),[A,k]=M({}),C=async D=>{if(!(D!=null&&D.length)||!d)return;const W=await Pn(D,A);W&&k({...A,...W})},E=D=>{w&&(D&&!(_!=null&&_.length)&&T([]),p("loading"),(async()=>{try{const{done:W,value:G}=await w(D);if(Array.isArray(G)){if(D){const X=[];for(let q=0;q<G.length;q++){const Z=G[q],B=X.find((ee,$)=>ee.id===Z.id&&q!==$);B?B._types.push(...Z._types):X.push({_types:[],...Z})}T(X)}else T(X=>{const q=X;for(const Z of G){const B=q.find(ee=>ee.id===Z.id);B?B._types.push(...Z._types):q.push(Z)}return q});g(!W),C(G)}else g(!1);p("default")}catch{p("error")}})())},R=j(!0);Q(()=>{(_==null?void 0:_.length)>0?w?(E(!0),R.current=!1):C(_):(E(!0),R.current=!1)},[w]),Q(()=>{var D;R.current||((D=a.reloadGenericAccounts)==null?void 0:D.id)===v&&E(!0)},[a.reloadGenericAccounts.counter]);const F=x.statuses[s];return e("div",{id:"generic-accounts-container",class:"sheet",tabindex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:o,children:e(I,{icon:"x",alt:r({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:y||r({id:"bPwFdf"})})}),e("main",{children:[F&&e(ge,{to:`/${n||l}/s/${F.id}`,class:"post-preview",children:e(Ge,{status:F,size:"s",readOnly:!0})}),_.length>0?e(U,{children:[e("ul",{class:"accounts-list",children:_.map(D=>{var X,q;const W=A[D.id],G=`${D.id}-${((X=D._types)==null?void 0:X.length)||""}`;return e("li",{children:[S&&((q=D._types)==null?void 0:q.length)>0&&e("div",{class:"reactions-block",children:D._types.map(Z=>e(I,{icon:{reblog:"rocket",favourite:"heart"}[Z],class:`${Z}-icon`}))}),e("div",{class:"account-relationships",children:e(ft,{account:D,showStats:!0,relationship:W,excludeRelationshipAttrs:i})})]},G)})}),h==="default"?m?e(Tt,{onChange:D=>{D&&E()},children:e("button",{type:"button",class:"plain block",onClick:()=>E(),children:e(f,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(f,{id:"2EYeAZ"})}):h==="loading"&&e("p",{class:"ui-state",children:e(Be,{abrupt:!0})})]}):h==="loading"?e("p",{class:"ui-state",children:e(Be,{abrupt:!0})}):h==="error"?e("p",{class:"ui-state",children:e(f,{id:"AThL/k"})}):e("p",{class:"ui-state insignificant",children:c||r({id:"10OlfF"})})]})]})}const Da=140;function Oa({alt:n,lang:i,onClose:s}){const{_:o}=le(),c=We(x),[r,u]=M(!1),l=xs(!0),d=c.settings.contentTranslationHideLanguages||[],a=!!i&&i!==l&&!Mi([i],[l])&&!d.find(h=>i===h||Mi([i],[h]));return Q(()=>{const h=(n==null?void 0:n.length)>0&&(n==null?void 0:n.length)<=Da;a&&h&&u(!0)},[a,n]),e("div",{class:"sheet",tabindex:"-1",children:[!!s&&e("button",{type:"button",class:"sheet-close outer",onClick:s,children:e(I,{icon:"x",alt:o({id:"yz7wBu"})})}),e("header",{class:"header-grid",children:[e("h2",{children:e(f,{id:"5gfDMm"})}),e("div",{class:"header-side",children:e(dt,{align:"end",menuButton:e("button",{type:"button",class:"plain4",children:e(I,{icon:"more",alt:o({id:"2FYpfJ"}),size:"xl"})}),children:[e(ye,{disabled:r,onClick:()=>{u(!0)},children:[e(I,{icon:"translate"}),e("span",{children:e(f,{id:"pi8x/S"})})]}),Wo&&e(ye,{onClick:()=>{Zo(n,i)},children:[e(I,{icon:"speak"}),e("span",{children:e(f,{id:"yIBLq8"})})]})]})})]}),e("main",{lang:i,dir:"auto",children:[e("p",{style:{whiteSpace:"pre-wrap",textWrap:"pretty"},children:n}),(a||r)&&e(Ls,{forceTranslate:r,sourceLanguage:i,text:n})]})]})}const{min:Hd,max:qd}=Math;const Ws={};for(let n of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])Ws[`[object ${n}]`]=n.toLowerCase();function za(n){return Ws[Object.prototype.toString.call(n)]||"object"}const Qt=(n,i=null)=>n.length>=3?Array.prototype.slice.call(n):za(n[0])=="object"&&i?i.split("").filter(s=>n[0][s]!==void 0).map(s=>n[0][s]):n[0].slice(0);const{PI:Bn,min:Yd,max:jd}=Math;const Vd=Bn*2,Gd=Bn/3,Ua=Bn/180,Ba=180/Bn;function Ln(n,i){let s=n.length;Array.isArray(n[0])||(n=[n]),Array.isArray(i[0])||(i=i.map(u=>[u]));let o=i[0].length,c=i[0].map((u,l)=>i.map(d=>d[l])),r=n.map(u=>c.map(l=>Array.isArray(u)?u.reduce((d,a,h)=>d+a*(l[h]||0),0):l.reduce((d,a)=>d+a*u,0)));return s===1&&(r=r[0]),o===1?r.map(u=>u[0]):r}const Zs={Kn:18,labWhitePoint:"d65",Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452,kE:216/24389,kKE:8,kK:24389/27,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-.2040259135167538,m20:-.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-.0685,m20:-.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-.008528664575177328,m10:-.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}};const jn=n=>{const i=Math.sign(n);return n=Math.abs(n),(n<=.0031308?n*12.92:1.055*Math.pow(n,1/2.4)-.055)*i},Fa=(n,i,s)=>{const{MtxAdaptMa:o,MtxAdaptMaI:c,MtxXYZ2RGB:r,RefWhiteRGB:u,Xn:l,Yn:d,Zn:a}=Zs,h=l*o.m00+d*o.m10+a*o.m20,p=l*o.m01+d*o.m11+a*o.m21,m=l*o.m02+d*o.m12+a*o.m22,g=u.X*o.m00+u.Y*o.m10+u.Z*o.m20,v=u.X*o.m01+u.Y*o.m11+u.Z*o.m21,y=u.X*o.m02+u.Y*o.m12+u.Z*o.m22,w=(n*o.m00+i*o.m10+s*o.m20)*(g/h),b=(n*o.m01+i*o.m11+s*o.m21)*(v/p),S=(n*o.m02+i*o.m12+s*o.m22)*(y/m),_=w*c.m00+b*c.m10+S*c.m20,T=w*c.m01+b*c.m11+S*c.m21,A=w*c.m02+b*c.m12+S*c.m22,k=jn(_*r.m00+T*r.m10+A*r.m20),C=jn(_*r.m01+T*r.m11+A*r.m21),E=jn(_*r.m02+T*r.m12+A*r.m22);return[k*255,C*255,E*255]},Ai=(...n)=>{n=Qt(n,"lab");const[i,s,o,...c]=n,[r,u,l]=Ka([i,s,o]),[d,a,h]=Fa(r,u,l);return[d,a,h,...c.length>0&&c[0]<1?[c[0]]:[]]};function Ka(n){var i=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],s=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],o=Ln(s,n);return Ln(i,o.map(c=>c**3))}function Vn(n){const i=Math.sign(n);return n=Math.abs(n),(n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4))*i}const Ha=(n,i,s)=>{n=Vn(n/255),i=Vn(i/255),s=Vn(s/255);const{MtxRGB2XYZ:o,MtxAdaptMa:c,MtxAdaptMaI:r,Xn:u,Yn:l,Zn:d,As:a,Bs:h,Cs:p}=Zs;let m=n*o.m00+i*o.m10+s*o.m20,g=n*o.m01+i*o.m11+s*o.m21,v=n*o.m02+i*o.m12+s*o.m22;const y=u*c.m00+l*c.m10+d*c.m20,w=u*c.m01+l*c.m11+d*c.m21,b=u*c.m02+l*c.m12+d*c.m22;let S=m*c.m00+g*c.m10+v*c.m20,_=m*c.m01+g*c.m11+v*c.m21,T=m*c.m02+g*c.m12+v*c.m22;return S*=y/a,_*=w/h,T*=b/p,m=S*r.m00+_*r.m10+T*r.m20,g=S*r.m01+_*r.m11+T*r.m21,v=S*r.m02+_*r.m12+T*r.m22,[m,g,v]},xi=(...n)=>{const[i,s,o,...c]=Qt(n,"rgb"),r=Ha(i,s,o);return[...qa(r),...c.length>0&&c[0]<1?[c[0]]:[]]};function qa(n){const i=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],s=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],o=Ln(i,n);return Ln(s,o.map(c=>Math.cbrt(c)))}const{sin:Ya,cos:ja}=Math,Va=(...n)=>{let[i,s,o]=Qt(n,"lch");return isNaN(o)&&(o=0),o=o*Ua,[i,ja(o)*s,Ya(o)*s]},Gn=(...n)=>{n=Qt(n,"lch");const[i,s,o,...c]=n,[r,u,l]=Va(i,s,o),[d,a,h]=Ai(r,u,l);return[d,a,h,...c.length>0&&c[0]<1?[c[0]]:[]]},{sqrt:Ga,atan2:Wa,round:Za}=Math,Xa=(...n)=>{const[i,s,o]=Qt(n,"lab"),c=Ga(s*s+o*o);let r=(Wa(o,s)*Ba+360)%360;return Za(c*1e4)===0&&(r=Number.NaN),[i,c,r]},Ja=(...n)=>{const[i,s,o,...c]=Qt(n,"rgb"),[r,u,l]=xi(i,s,o),[d,a,h]=Xa(r,u,l);return[d,a,h,...c.length>0&&c[0]<1?[c[0]]:[]]},Qa={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",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",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_IMG_ALT_API_URL:Wd}=Qa;function Xs({mediaAttachments:n,statusID:i,instance:s,lang:o,index:c=0,onClose:r=()=>{}}){var T,A;const{_:u}=le(),[l,d]=M("default"),a=j(null),[h,p]=M(c),m=j(null);St(()=>{var k;(k=m.current)==null||k.scrollIntoView()},[]);const g=j(i);Q(()=>{const k=c*a.current.clientWidth,C=g.current!==i;C&&(g.current=i),a.current.focus(),a.current.scrollTo({left:k*(Ot()?-1:1),behavior:C?"auto":"smooth"})},[c,i]);const[v,y]=M(!0);Q(()=>{let k=C=>{r(C,h,n,a)};return a.current&&a.current.addEventListener("swiped-down",k),()=>{a.current&&a.current.removeEventListener("swiped-down",k)}},[h,n]),qe("esc",k=>{r(k,h,n,a)},{ignoreEventWhen:k=>!!document.querySelector("#modal-container > *")||k.metaKey||k.ctrlKey||k.altKey||k.shiftKey,useKey:!0},[r,h,n]),Q(()=>{let k=()=>{const{clientWidth:C,scrollLeft:E}=a.current,R=Math.round(Math.abs(E)/C);p(R)};return a.current&&a.current.addEventListener("scroll",k,{passive:!0}),()=>{a.current&&a.current.removeEventListener("scroll",k)}},[]),Q(()=>{let k=setTimeout(()=>{var C,E;(E=(C=a.current)==null?void 0:C.focus)==null||E.call(C)},100);return()=>clearTimeout(k)},[]);const w=Ae(()=>n==null?void 0:n.map(k=>{const{blurhash:C}=k;if(C){const E=mi(C);return Ja(E)}return null}),[n]),b=Ae(()=>w==null?void 0:w.map(k=>k?{light:Gn([.95,.01,k[2]]),dark:Gn([.35,.01,k[2]]),default:Gn([.6,k[1],k[2]])}:null)),S=Ae(()=>{const C=100/b.length,E=b.map((D,W)=>{var q,Z,B,ee;const G=W*C+5,X=(W+1)*C-5;return D!=null&&D.light&&(D!=null&&D.dark)?{light:`
rgb(${(q=D.light)==null?void 0:q.join(",")}) ${G}%,
rgb(${(Z=D.light)==null?void 0:Z.join(",")}) ${X}%
`,dark:`
rgb(${(B=D.dark)==null?void 0:B.join(",")}) ${G}%,
rgb(${(ee=D.dark)==null?void 0:ee.join(",")}) ${X}%
`}:{light:`
transparent ${G}%,
transparent ${X}%
`,dark:`
transparent ${G}%,
transparent ${X}%
`}}),R=E.map(D=>D.light).join(", "),F=E.map(D=>D.dark).join(", ");return{light:R,dark:F}},[b]);let _=j(null);return Q(()=>()=>{var k,C;(C=(k=_.current)==null?void 0:k.hideToast)==null||C.call(k)},[]),St(()=>{const k=b[h];let C,E;if(k){const R=Ue.local.get("theme");if(R){const F=`rgb(${k[R].join(",")})`;C=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),C&&(E=C.content,C.content=F)}else{const F=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",D=`rgb(${k[F].join(",")})`;C=document.querySelector(`meta[name="theme-color"][media*="${F}"]`),C&&(E=C.content,C.content=D)}}return()=>{C&&E&&(C.content=E)}},[h,b]),e("div",{class:`media-modal-container media-modal-count-${n==null?void 0:n.length}`,children:[e("div",{ref:a,tabIndex:"0","data-swipe-threshold":"44",class:"carousel",onClick:k=>{(k.target.classList.contains("carousel-item")||k.target.classList.contains("media")||k.target.classList.contains("media-zoom"))&&r(k,h,n,a)},style:n.length>1?{backgroundAttachment:"local","--accent-gradient-light":S==null?void 0:S.light,"--accent-gradient-dark":S==null?void 0:S.dark}:{},children:n==null?void 0:n.map((k,C)=>{var R,F;const E=n.length===1?b[C]:null;return e("div",{class:"carousel-item",style:E?{"--accent-color":`rgb(${E.default.join(",")})`,"--accent-light-color":`rgb(${(R=E.light)==null?void 0:R.join(",")})`,"--accent-dark-color":`rgb(${(F=E.dark)==null?void 0:F.join(",")})`,"--accent-alpha-color":`rgba(${E.default.join(",")}, 0.4)`}:{},tabindex:"0",ref:C===h?m:null,onClick:D=>{D.target.classList.contains("media")||y(!v)},children:[!!k.description&&e("button",{type:"button",class:"media-alt",hidden:!v,onClick:()=>{x.showMediaAlt={alt:k.description,lang:o}},children:[e("span",{class:"alt-badge",children:"ALT"}),e("span",{class:"media-alt-desc",lang:o,dir:"auto",children:k.description})]}),e(Ms,{media:k,showOriginal:!0,lang:o})]},k.id)})}),e("div",{class:"carousel-top-controls",hidden:!v,children:[e("span",{children:e("button",{type:"button",class:"carousel-button",onClick:k=>r(k,h,n,a),children:e(I,{icon:"x",alt:u({id:"yz7wBu"})})})}),(n==null?void 0:n.length)>1?e("span",{class:"carousel-dots",children:n==null?void 0:n.map((k,C)=>e("button",{type:"button",disabled:C===h,class:`carousel-dot ${C===h?"active":""}`,onClick:E=>{E.preventDefault(),E.stopPropagation();const R=a.current.clientWidth*C*(Ot()?-1:1);a.current.focus(),a.current.scrollTo({left:R,behavior:"smooth"})},children:e(I,{icon:"round",size:"s",alt:"⸱"})},k.id))}):e("span",{}),e("span",{children:[e(dt,{overflow:"auto",align:"end",position:"anchor",gap:4,menuClassName:"glass-menu",menuButton:e("button",{type:"button",class:"carousel-button",children:e(I,{icon:"more",alt:u({id:"2FYpfJ"})})}),children:[e(je,{href:((T=n[h])==null?void 0:T.remoteUrl)||((A=n[h])==null?void 0:A.url),class:"carousel-button",target:"_blank",title:u({id:"5hXGws"}),children:[e(I,{icon:"popout"}),e("span",{children:e(f,{id:"aDr7Vc"})})]}),!1]})," ",!!i&&e(ge,{to:`${s?`/${s}`:""}/s/${i}${window.matchMedia("(min-width: calc(40em + 350px))").matches?`?media=${h+1}`:""}`,class:"button carousel-button media-post-link",children:[e("span",{class:"button-label",children:[e(f,{id:"ISg5SQ"})," "]}),"»"]})]})]}),(n==null?void 0:n.length)>1&&e("div",{class:"carousel-controls",hidden:!v,children:[e("button",{type:"button",class:"carousel-button",hidden:h===0,onClick:k=>{k.preventDefault(),k.stopPropagation(),a.current.focus(),a.current.scrollTo({left:a.current.clientWidth*(h-1)*(Ot()?-1:1),behavior:"smooth"})},children:e(I,{icon:"arrow-left",alt:u({id:"DHhJ7s"})})}),e("button",{type:"button",class:"carousel-button",hidden:h===n.length-1,onClick:k=>{k.preventDefault(),k.stopPropagation(),a.current.focus(),a.current.scrollTo({left:a.current.clientWidth*(h+1)*(Ot()?-1:1),behavior:"smooth"})},children:e(I,{icon:"arrow-right",alt:u({id:"hXzOVo"})})})]})]})}const er=[,"spam","legal","violation","other"],en={spam:{label:{id:"t8dIOP"},description:{id:"csQin/"}},legal:{label:{id:"IjKdHM"},description:{id:"e6tGFu"}},violation:{label:{id:"KPFHM2"},description:{id:"fpotTF"},stampLabel:{id:"iuLUuH"}},other:{label:{id:"/IX/7x"},description:{id:"kxiG8g"},excludeStamp:!0}};function tr({account:n,post:i,onClose:s}){const{_:o,_:c}=le(),{masto:r}=re(),[u,l]=M("default"),[d,a]=n.acct.split("@"),[h,p]=Ae(()=>{const{rules:_,domain:T}=vs();return[_||[],T]}),[m,g]=M(null),[v,y]=M(!1),w=j(null),[b,S]=M(!1);return e("div",{class:"report-modal-container",children:[e("div",{class:"top-controls",children:[e("h1",{children:c(i?{id:"muLhL3"}:{id:"ACul2G",values:{username:d}})}),e("button",{type:"button",class:"plain4 small",disabled:u==="loading",onClick:()=>s(),children:e(I,{icon:"x",size:"xl",alt:c({id:"yz7wBu"})})})]}),e("main",{children:[e("div",{class:"report-preview",children:i?e(Ge,{status:i,size:"s",previewMode:!0}):e(ft,{account:n,avatarSize:"xxl",useAvatarStatic:!0,showStats:!0,showActivity:!0})}),!!m&&!en[m].excludeStamp&&e("span",{class:"rubber-stamp","aria-hidden":"true",children:[o(en[m].stampLabel||o(en[m].label)),e("small",{children:e(f,{id:"2WtL62"})})]},m),e("form",{onSubmit:_=>{_.preventDefault();const T=new FormData(_.target),A=Object.fromEntries(T.entries());let{category:k,comment:C,forward:E}=A;C||(C=void 0),E==="on"&&(E=!0);const R=k==="violation"?Object.entries(A).filter(([D])=>D.startsWith("rule_ids")).map(([D,W])=>W):void 0,F={category:k,comment:C,forward:E,ruleIds:R};l("loading"),(async()=>{try{await r.v1.reports.create({accountId:n.id,statusIds:i!=null&&i.id?[i.id]:void 0,category:k,comment:C,ruleIds:R,forward:E}),l("success"),fe(c(i?{id:"y3ou+8"}:{id:"R9kjEL"})),s()}catch(D){l("error"),fe((D==null?void 0:D.message)||c(i?{id:"+3FjPq"}:{id:"oEQq5w"}))}})()},children:[e("p",{children:c(i?{id:"L9fUm+"}:{id:"rSLkfe"})}),e("section",{class:"report-categories",children:er.map(_=>_==="violation"&&!(h!=null&&h.length)?null:e(U,{children:[e("label",{class:"report-category",children:[e("input",{type:"radio",name:"category",value:_,required:!0,disabled:u==="loading",onChange:T=>{g(T.target.value),y(T.target.value==="violation")}}),e("span",{children:[o(en[_].label),"  ",e("small",{class:"ib insignificant",children:o(en[_].description)})]})]}),_==="violation"&&!!(h!=null&&h.length)&&e("div",{class:"shazam-container no-animation",hidden:!v,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"report-rules",ref:w,children:h.map((T,A)=>e("label",{class:"report-rule",children:[e("input",{type:"checkbox",name:`rule_ids[${A}]`,value:T.id,required:v&&!b,disabled:u==="loading",onChange:k=>{const{checked:C}=k.target;C?S(!0):w.current.querySelectorAll("input:checked").length||S(!1)}}),e("span",{children:T.text})]},T.id))})})})]},_))}),e("section",{class:"report-comment",children:[e("p",{children:e("label",{for:"report-comment",children:e(f,{id:"ecVtjm"})})}),e("textarea",{maxlength:"1000",rows:"1",name:"comment",id:"report-comment",disabled:u==="loading",required:!i})]}),!!a&&a!==p&&e("section",{children:e("p",{children:e("label",{children:[e("input",{type:"checkbox",switch:!0,name:"forward",disabled:u==="loading"})," ",e("span",{children:e(f,{id:"cyjS8M",values:{domain:a},components:{0:e("i",{})}})})]})})}),e("footer",{children:[e("button",{type:"submit",disabled:u==="loading",children:e(f,{id:"4cijjm"})})," ",e("button",{type:"submit",class:"plain2",disabled:u==="loading",onClick:async()=>{try{await r.v1.accounts.$select(n.id).mute(),fe(c({id:"/BGBeF",values:{username:d}}))}catch{fe(c({id:"v02K7/",values:{username:d}}))}},children:e(f,{id:"caeqw/",components:{0:e("small",{class:"ib"})}})})," ",e("button",{type:"submit",class:"plain2",disabled:u==="loading",onClick:async()=>{try{await r.v1.accounts.$select(n.id).block(),fe(c({id:"kjUejn",values:{username:d}}))}catch{fe(c({id:"pMcdDp",values:{username:d}}))}},children:e(f,{id:"JybQca",components:{0:e("small",{class:"ib"})}})}),e(Be,{hidden:u!=="loading"})]})]})]})]})}var vn={exports:{}},Zd=vn.exports,Gi;function nr(){return Gi||(Gi=1,function(n){var i=function(){var s=String.fromCharCode,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",r={};function u(d,a){if(!r[d]){r[d]={};for(var h=0;h<d.length;h++)r[d][d.charAt(h)]=h}return r[d][a]}var l={compressToBase64:function(d){if(d==null)return"";var a=l._compress(d,6,function(h){return o.charAt(h)});switch(a.length%4){default:case 0:return a;case 1:return a+"===";case 2:return a+"==";case 3:return a+"="}},decompressFromBase64:function(d){return d==null?"":d==""?null:l._decompress(d.length,32,function(a){return u(o,d.charAt(a))})},compressToUTF16:function(d){return d==null?"":l._compress(d,15,function(a){return s(a+32)})+" "},decompressFromUTF16:function(d){return d==null?"":d==""?null:l._decompress(d.length,16384,function(a){return d.charCodeAt(a)-32})},compressToUint8Array:function(d){for(var a=l.compress(d),h=new Uint8Array(a.length*2),p=0,m=a.length;p<m;p++){var g=a.charCodeAt(p);h[p*2]=g>>>8,h[p*2+1]=g%256}return h},decompressFromUint8Array:function(d){if(d==null)return l.decompress(d);for(var a=new Array(d.length/2),h=0,p=a.length;h<p;h++)a[h]=d[h*2]*256+d[h*2+1];var m=[];return a.forEach(function(g){m.push(s(g))}),l.decompress(m.join(""))},compressToEncodedURIComponent:function(d){return d==null?"":l._compress(d,6,function(a){return c.charAt(a)})},decompressFromEncodedURIComponent:function(d){return d==null?"":d==""?null:(d=d.replace(/ /g,"+"),l._decompress(d.length,32,function(a){return u(c,d.charAt(a))}))},compress:function(d){return l._compress(d,16,function(a){return s(a)})},_compress:function(d,a,h){if(d==null)return"";var p,m,g={},v={},y="",w="",b="",S=2,_=3,T=2,A=[],k=0,C=0,E;for(E=0;E<d.length;E+=1)if(y=d.charAt(E),Object.prototype.hasOwnProperty.call(g,y)||(g[y]=_++,v[y]=!0),w=b+y,Object.prototype.hasOwnProperty.call(g,w))b=w;else{if(Object.prototype.hasOwnProperty.call(v,b)){if(b.charCodeAt(0)<256){for(p=0;p<T;p++)k=k<<1,C==a-1?(C=0,A.push(h(k)),k=0):C++;for(m=b.charCodeAt(0),p=0;p<8;p++)k=k<<1|m&1,C==a-1?(C=0,A.push(h(k)),k=0):C++,m=m>>1}else{for(m=1,p=0;p<T;p++)k=k<<1|m,C==a-1?(C=0,A.push(h(k)),k=0):C++,m=0;for(m=b.charCodeAt(0),p=0;p<16;p++)k=k<<1|m&1,C==a-1?(C=0,A.push(h(k)),k=0):C++,m=m>>1}S--,S==0&&(S=Math.pow(2,T),T++),delete v[b]}else for(m=g[b],p=0;p<T;p++)k=k<<1|m&1,C==a-1?(C=0,A.push(h(k)),k=0):C++,m=m>>1;S--,S==0&&(S=Math.pow(2,T),T++),g[w]=_++,b=String(y)}if(b!==""){if(Object.prototype.hasOwnProperty.call(v,b)){if(b.charCodeAt(0)<256){for(p=0;p<T;p++)k=k<<1,C==a-1?(C=0,A.push(h(k)),k=0):C++;for(m=b.charCodeAt(0),p=0;p<8;p++)k=k<<1|m&1,C==a-1?(C=0,A.push(h(k)),k=0):C++,m=m>>1}else{for(m=1,p=0;p<T;p++)k=k<<1|m,C==a-1?(C=0,A.push(h(k)),k=0):C++,m=0;for(m=b.charCodeAt(0),p=0;p<16;p++)k=k<<1|m&1,C==a-1?(C=0,A.push(h(k)),k=0):C++,m=m>>1}S--,S==0&&(S=Math.pow(2,T),T++),delete v[b]}else for(m=g[b],p=0;p<T;p++)k=k<<1|m&1,C==a-1?(C=0,A.push(h(k)),k=0):C++,m=m>>1;S--,S==0&&(S=Math.pow(2,T),T++)}for(m=2,p=0;p<T;p++)k=k<<1|m&1,C==a-1?(C=0,A.push(h(k)),k=0):C++,m=m>>1;for(;;)if(k=k<<1,C==a-1){A.push(h(k));break}else C++;return A.join("")},decompress:function(d){return d==null?"":d==""?null:l._decompress(d.length,32768,function(a){return d.charCodeAt(a)})},_decompress:function(d,a,h){var p=[],m,g=4,v=4,y=3,w="",b=[],S,_,T,A,k,C,E,R={val:h(0),position:a,index:1};for(S=0;S<3;S+=1)p[S]=S;for(T=0,k=Math.pow(2,2),C=1;C!=k;)A=R.val&R.position,R.position>>=1,R.position==0&&(R.position=a,R.val=h(R.index++)),T|=(A>0?1:0)*C,C<<=1;switch(m=T){case 0:for(T=0,k=Math.pow(2,8),C=1;C!=k;)A=R.val&R.position,R.position>>=1,R.position==0&&(R.position=a,R.val=h(R.index++)),T|=(A>0?1:0)*C,C<<=1;E=s(T);break;case 1:for(T=0,k=Math.pow(2,16),C=1;C!=k;)A=R.val&R.position,R.position>>=1,R.position==0&&(R.position=a,R.val=h(R.index++)),T|=(A>0?1:0)*C,C<<=1;E=s(T);break;case 2:return""}for(p[3]=E,_=E,b.push(E);;){if(R.index>d)return"";for(T=0,k=Math.pow(2,y),C=1;C!=k;)A=R.val&R.position,R.position>>=1,R.position==0&&(R.position=a,R.val=h(R.index++)),T|=(A>0?1:0)*C,C<<=1;switch(E=T){case 0:for(T=0,k=Math.pow(2,8),C=1;C!=k;)A=R.val&R.position,R.position>>=1,R.position==0&&(R.position=a,R.val=h(R.index++)),T|=(A>0?1:0)*C,C<<=1;p[v++]=s(T),E=v-1,g--;break;case 1:for(T=0,k=Math.pow(2,16),C=1;C!=k;)A=R.val&R.position,R.position>>=1,R.position==0&&(R.position=a,R.val=h(R.index++)),T|=(A>0?1:0)*C,C<<=1;p[v++]=s(T),E=v-1,g--;break;case 2:return b.join("")}if(g==0&&(g=Math.pow(2,y),y++),p[E])w=p[E];else if(E===v)w=_+_.charAt(0);else return null;b.push(w),p[v++]=_+w.charAt(0),g--,_=w,g==0&&(g=Math.pow(2,y),y++)}}};return l}();n!=null?n.exports=i:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return i})}(vn)),vn.exports}var Wi=nr();const ir="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",sr="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",or="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",cr=200,ar=10;async function Mn(){const{masto:n}=re(),i=n.v1.followedTags.list({limit:cr}).values(),s=[];let o=0;do{const{value:c,done:r}=await i.next();if(r||(c==null?void 0:c.length)===0)break;s.push(...c),o++}while(o<ar);return s.sort((c,r)=>c.name.localeCompare(r.name)),s.length&&setTimeout(()=>{Ue.account.set("followedTags",{tags:s,updatedAt:Date.now()})},1),s}const rr=24*60*60*1e3;async function lr(){try{const{tags:n,updatedAt:i}=Ue.account.get("followedTags")||{};return n!=null&&n.length?(Date.now()-i>rr&&Mn(),n):await Mn()}catch{return[]}}const Zi=document.createElement("div"),dr=n=>{if(!n)return[];if(n.indexOf("#")===-1)return[];Zi.innerHTML=n;const i=Zi.querySelectorAll("a.hashtag");return i.length?Array.from(i).map(s=>s.innerText.trim().replace(/^[^#]*#+/,"")):[]};function wn({children:n}){if(typeof n=="string")return n;const[i,s]=M("");return Q(()=>{Promise.resolve(n).then(s)},[n]),i}const It=9,ur=["following","mentions","notifications","list","public","trending","search","hashtag","bookmarks","favourites"],Js={following:{id:"7ZJHdw"},notifications:{id:"iDNBZe"},list:{id:"h16FyT"},public:{id:"tXgQpk"},search:{id:"A1taO8"},"account-statuses":{id:"AeXO77"},bookmarks:{id:"7Ff7ia"},favourites:{id:"zZOZj7"},hashtag:{id:"GP8RLS"},trending:{id:"4/iCqx"},mentions:{id:"/bZzdR"}},kn={list:[{text:{id:"DUMt1y"},name:"id",notRequired:!0}],public:[{text:{id:"OgyJSr"},name:"local",type:"checkbox"},{text:{id:"kyAi7k"},name:"instance",type:"text",placeholder:{id:"7defFj"},notRequired:!0}],trending:[{text:{id:"kyAi7k"},name:"instance",type:"text",placeholder:{id:"7defFj"},notRequired:!0}],search:[{text:{id:"dmloPh"},name:"query",type:"text",placeholder:{id:"UHDQDE"},notRequired:!0}],"account-statuses":[{text:"@",name:"id",type:"text",placeholder:"cheeaun@mastodon.social"}],hashtag:[{text:"#",name:"hashtag",type:"text",placeholder:{id:"a6oTWs"},pattern:"[^#]+"},{text:{id:"eK4SL/"},name:"media",type:"checkbox"},{text:{id:"kyAi7k"},name:"instance",type:"text",placeholder:{id:"7defFj"},notRequired:!0}]},hr=bt(async({id:n})=>{const i=await re().masto.v1.accounts.$select(n).fetch();return i.username||i.acct||i.displayName}),$n={following:{id:"home",title:(n,i)=>i===0?pe._({id:"i0qMbr"}):pe._({id:"following.title"}),path:"/",icon:"home"},mentions:{id:"mentions",title:{id:"/bZzdR"},path:"/mentions",icon:"at"},notifications:{id:"notifications",title:{id:"iDNBZe"},path:"/notifications",icon:"notification"},list:{id:({id:n})=>n?"list":"lists",title:({id:n})=>n?la(n):pe._({id:"h16FyT"}),path:({id:n})=>n?`/l/${n}`:"/l",icon:"list",excludeViewMode:({id:n})=>n?[]:["multi-column"]},public:{id:"public",title:({local:n})=>n?pe._({id:"d5zxa4"}):pe._({id:"4ERYY7"}),subtitle:({instance:n})=>n||re().instance,path:({local:n,instance:i})=>`/${i}/p${n?"/l":""}`,icon:({local:n})=>n?"building":"earth"},trending:{id:"trending",title:{id:"4/iCqx"},subtitle:({instance:n})=>n||re().instance,path:({instance:n})=>`/${n}/trending`,icon:"chart"},search:{id:"search",title:({query:n})=>n?`${n}`:pe._({id:"A1taO8"}),path:({query:n})=>n?`/search?q=${encodeURIComponent(n)}&type=statuses`:"/search",icon:"search",excludeViewMode:({query:n})=>n?[]:["multi-column"]},"account-statuses":{id:"account-statuses",title:hr,path:({id:n})=>`/a/${n}`,icon:"user"},bookmarks:{id:"bookmarks",title:{id:"7Ff7ia"},path:"/b",icon:"bookmark"},favourites:{id:"favourites",title:{id:"zZOZj7"},path:"/f",icon:"heart"},hashtag:{id:"hashtag",title:({hashtag:n})=>n,subtitle:({instance:n})=>n||re().instance,path:({hashtag:n,instance:i,media:s})=>`${i?`/${i}`:""}/t/${n.split(/\s+/).join("+")}${s?"?media=1":""}`,icon:"hashtag"}};function fr({onClose:n}){const{_:i}=le(),s=We(x),{shortcuts:o}=s,[c,r]=M(!1),[u,l]=M(!1),[d]=ki();return e("div",{id:"shortcuts-settings-container",class:"sheet",tabindex:"-1",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(I,{icon:"x",alt:pe._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:[e(I,{icon:"shortcut"})," ",e(f,{id:"CTqTgr"})," ",e("sup",{style:{fontSize:12,opacity:.5,textTransform:"uppercase"},children:e(f,{id:"A1As8l"})})]})}),e("main",{children:[e("p",{children:e(f,{id:"CIHAsy"})}),e("div",{class:"shortcuts-view-mode",children:[{value:"float-button",label:pe._({id:"qwdOim"}),imgURL:ir},{value:"tab-menu-bar",label:pe._({id:"UxBoCm"}),imgURL:or},{value:"multi-column",label:pe._({id:"uvDfdW"}),imgURL:sr}].map(({value:a,label:h,imgURL:p})=>{const m=s.settings.shortcutsViewMode===a||a==="float-button"&&!s.settings.shortcutsViewMode;return e("label",{class:m?"checked":"",children:[e("input",{type:"radio",name:"shortcuts-view-mode",value:a,checked:m,onChange:g=>{x.settings.shortcutsViewMode=g.target.value}})," ",e("img",{src:p,alt:"",width:"80",height:"58"})," ",e("span",{children:h})]},a)})}),o.length>0?e(U,{children:[e("ol",{class:"shortcuts-list",ref:d,children:o.filter(Boolean).map((a,h)=>{const p=Object.values(a).join("-"),{type:m}=a;if(!$n[m])return null;let{icon:g,title:v,subtitle:y,excludeViewMode:w}=$n[m];typeof v=="function"?v=v(a,h):v=i(v),typeof y=="function"?y=y(a,h):y=i(y),typeof g=="function"&&(g=g(a,h)),typeof w=="function"&&(w=w(a,h));const b=w==null?void 0:w.includes(s.settings.shortcutsViewMode);return e("li",{children:[e(I,{icon:g}),e("span",{class:"shortcut-text",children:[e(wn,{children:v}),y&&e(U,{children:[" ",e("small",{class:"ib insignificant",children:y})]}),b&&e("span",{class:"tag",children:e(f,{id:"5KJFnN"})})]}),e("span",{class:"shortcut-actions",children:[e("button",{type:"button",class:"plain small",disabled:h===0,onClick:()=>{const S=Array.from(x.shortcuts);if(h>0){const _=x.shortcuts[h-1];S[h-1]=a,S[h]=_,x.shortcuts=S}},children:e(I,{icon:"arrow-up",alt:pe._({id:"QyioBP"})})}),e("button",{type:"button",class:"plain small",disabled:h===o.length-1,onClick:()=>{const S=Array.from(x.shortcuts);if(h<x.shortcuts.length-1){const _=x.shortcuts[h+1];S[h+1]=a,S[h]=_,x.shortcuts=S}},children:e(I,{icon:"arrow-down",alt:pe._({id:"3Ib6FN"})})}),e("button",{type:"button",class:"plain small",onClick:()=>{r({shortcut:a,shortcutIndex:h})},children:e(I,{icon:"pencil",alt:pe._({id:"ePK91l"})})})]})]},p)})}),o.length===1&&s.settings.shortcutsViewMode!=="float-button"&&e("div",{class:"ui-state insignificant",children:[e(I,{icon:"info"})," ",e("small",{children:e(f,{id:"3Xq4Zi"})})]})]}):e("div",{class:"ui-state insignificant",children:[e("p",{children:s.settings.shortcutsViewMode==="multi-column"?pe._({id:"3xIN+E"}):pe._({id:"vLxvHT"})}),e("p",{children:e(f,{id:"Fq4zw3",components:{0:e("br",{}),1:e("a",{href:"#",onClick:a=>{a.preventDefault(),x.shortcuts=[{type:"following"},{type:"notifications"}]}})}})})]}),e("p",{class:"insignificant",children:o.length>=It&&(s.settings.shortcutsViewMode==="multi-column"?pe._({id:"RqXfsz",values:{SHORTCUTS_LIMIT:It}}):pe._({id:"EVRO/o",values:{SHORTCUTS_LIMIT:It}}))}),e("p",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e("button",{type:"button",class:"light",onClick:()=>l(!0),children:e(f,{id:"bgVLbt"})}),e("button",{type:"button",disabled:o.length>=It,onClick:()=>r(!0),children:[e(I,{icon:"plus"})," ",e("span",{children:s.settings.shortcutsViewMode==="multi-column"?pe._({id:"Vh3ADI"}):pe._({id:"9tmn6W"})})]})]})]}),c&&e(Ye,{onClick:a=>{a.target===a.currentTarget&&r(!1)},children:e(pr,{shortcut:c.shortcut,shortcutIndex:c.shortcutIndex,onSubmit:({result:a,mode:h})=>{h==="edit"?x.shortcuts[c.shortcutIndex]=a:x.shortcuts.push(a)},onClose:()=>r(!1)})}),u&&e(Ye,{onClick:a=>{a.target===a.currentTarget&&l(!1)},children:e(mr,{shortcuts:o,onClose:()=>l(!1)})})]})}const Xi={list:{id:"1qL+L+"},search:{id:"dmTmkQ"},hashtag:{id:"E8laYz"}};function pr({onSubmit:n,disabled:i,shortcut:s,shortcutIndex:o,onClose:c}){var w,b;const{_:r}=le(),u=!!s,[l,d]=M((s==null?void 0:s.type)||null),[a,h]=M("default"),[p,m]=M([]),[g,v]=M([]);Q(()=>{(async()=>{if(l==="list")try{h("loading");const S=await hn();m(S),h("default")}catch{h("error")}})(),(async()=>{if(l==="hashtag")try{const S=await Mn();v(S)}catch{}})()},[l]);const y=j();return Q(()=>{if(u&&l&&kn[l]){const S=y.current;kn[l].forEach(({name:_,type:T})=>{const A=S.querySelector(`[name="${_}"]`);A&&s[_]&&(T==="checkbox"?A.checked=s[_]==="on":A.value=s[_])})}},[u,l]),e("div",{id:"shortcut-settings-form",class:"sheet",children:[!!c&&e("button",{type:"button",class:"sheet-close",onClick:c,children:e(I,{icon:"x",alt:pe._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:u?pe._({id:"pe1jog"}):pe._({id:"Lsxpe5"})})}),e("main",{tabindex:"-1",children:e("form",{ref:y,onSubmit:S=>{S.preventDefault();const _=new FormData(S.target),T={};_.forEach((A,k)=>{T[k]=A==null?void 0:A.trim(),k==="instance"&&(T[k]=T[k].replace(/^https?:\/\//,"").replace(/\/+$/,""),T[k]=T[k].replace(/^@?[^@]+@/,""))}),T.type&&(n({result:T,mode:u?"edit":"add"}),S.target.reset(),d(null),c==null||c())},children:[e("p",{children:e("label",{children:[e("span",{children:e(f,{id:"cklVjM"})}),e("select",{required:!0,disabled:i,onChange:S=>{d(S.target.value)},defaultValue:u?s.type:void 0,name:"type",dir:"auto",children:[e("option",{}),ur.map(S=>e("option",{value:S,children:r(Js[S])}))]})]})}),(b=(w=kn[l])==null?void 0:w.map)==null?void 0:b.call(w,({text:S,name:_,type:T,placeholder:A,pattern:k,notRequired:C})=>l==="list"?e("p",{children:e("label",{children:[e("span",{children:e(f,{id:"2BBAbc"})}),e("select",{name:"id",required:!C,disabled:i||a==="loading",defaultValue:u?s.id:void 0,dir:"auto",children:[e("option",{value:""}),p.map(E=>e("option",{value:E.id,children:E.title}))]})]})}):e("p",{children:e("label",{children:[e("span",{children:r(S)})," ",e("input",{type:T,switch:T==="checkbox"||void 0,name:_,placeholder:r(A),required:T==="text"&&!C,disabled:i,list:l==="hashtag"?"followed-hashtags-datalist":null,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:k,dir:"auto"}),l==="hashtag"&&g.length>0&&e("datalist",{id:"followed-hashtags-datalist",children:g.map(E=>e("option",{value:E.name}))})]})})),!!Xi[l]&&e("p",{class:"form-note insignificant",children:[e(I,{icon:"info"}),r(Xi[l])]}),e("footer",{children:[e("button",{type:"submit",class:"block",disabled:i||a==="loading",children:u?pe._({id:"tfDRzk"}):pe._({id:"m16xKo"})}),u&&e("button",{type:"button",class:"light danger",onClick:()=>{x.shortcuts.splice(o,1),c==null||c()},children:e(f,{id:"t/YqKh"})})]})]})})]})}function mr({shortcuts:n,onClose:i}){var m;const{_:s}=le(),{masto:o}=re(),c=Ae(()=>!n||!n.filter(Boolean).length?"":Wi.compressToEncodedURIComponent(JSON.stringify(n.filter(Boolean))),[n]),[r,u]=M(""),[l,d]=M("default"),a=Ae(()=>{if(!r)return d("default"),null;try{const g=JSON.parse(Wi.decompressFromEncodedURIComponent(r));if(!Array.isArray(g))throw new Error("Not an array");return d("default"),g}catch{try{const v=JSON.parse(r);if(!Array.isArray(v))throw new Error("Not an array");return d("default"),v}catch{return d("error"),null}}},[r]),h=x.shortcuts.length>0,p=j();return e("div",{id:"import-export-container",class:"sheet",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(I,{icon:"x",alt:pe._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(f,{id:"OOa7/5",components:{0:e("small",{class:"ib insignificant"})}})})}),e("main",{tabindex:"-1",children:[e("section",{children:[e("h3",{children:[e(I,{icon:"arrow-down-circle",size:"l",class:"insignificant"})," ",e("span",{children:e(f,{id:"l3s5ri"})})]}),e("p",{class:"field-button",children:[e("input",{ref:p,type:"text",name:"import",placeholder:pe._({id:"tBmklN"}),class:"block",onInput:g=>{u(g.target.value)},dir:"auto"}),x.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2 small",disabled:l==="cloud-downloading",onClick:async()=>{d("cloud-downloading");const g=kt();fe(pe._({id:"HLqLGx"}));try{const y=(await o.v1.accounts.relationships.fetch({id:[g]}))[0];if(y){const{note:w=""}=y;if(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/.test(w)){const b=w.match(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/)[1],{v:S,dt:_,data:T}=JSON.parse(b);p.current.value=T,p.current.dispatchEvent(new Event("input"))}}d("default")}catch{d("error"),fe(pe._({id:"gCDfX+"}))}},title:pe._({id:"B6cG3J"}),children:[e(I,{icon:"cloud"}),e(I,{icon:"arrow-down"})]})]}),!!a&&Array.isArray(a)&&e(U,{children:[e("p",{children:[e("b",{children:a.length})," shortcut",a.length>1?"s":""," ",e("small",{class:"insignificant",children:["(",r.length," characters)"]})]}),e("ol",{class:"import-settings-list",children:a.map(g=>{var v,y;return e("li",{children:[e("span",{style:{opacity:n.some(w=>Object.keys(w).every(b=>w[b]===g[b]))?1:0},children:"*"}),e("span",{children:[s(Js[g.type]),g.type==="list"&&" ⚠️"," ",(y=(v=kn[g.type])==null?void 0:v.map)==null?void 0:y.call(v,({text:w,name:b,type:S})=>g[b]?e(U,{children:[e("span",{class:"tag collapsed insignificant",children:[w,":"," ",S==="checkbox"?g[b]==="on"?"✅":"❌":g[b]]})," "]}):null)]})]})})}),e("p",{children:[e("small",{children:e(f,{id:"o6sElH"})}),e("br",{}),e("small",{children:["⚠️"," ",e(f,{id:"N4z4P/"})]})]})]}),l==="error"&&e("p",{class:"error",children:e("small",{children:["⚠️ ",e(f,{id:"ZhsPEb"})]})}),e("p",{children:[h&&e(U,{children:[e(pt,{confirmLabel:pe._({id:"6MzUUU"}),menuFooter:e("div",{class:"footer",children:e(f,{id:"nl8sCE"})}),onClick:()=>{const g=a.filter(w=>!x.shortcuts.some(b=>Object.keys(b).every(S=>b[S]===w[S])));if(!g.length){fe(pe._({id:"o6L30P"}));return}let v=[...x.shortcuts,...g];const y=v.length>It;y&&(v=v.slice(0,It)),x.shortcuts=v,fe(y?pe._({id:"SBmqmC",values:{SHORTCUTS_LIMIT:It}}):pe._({id:"QO9uTx"})),i==null||i()},children:e("button",{type:"button",class:"plain2",disabled:!a,children:e(f,{id:"c89gCv"})})})," "]}),e(pt,{confirmLabel:h?pe._({id:"6ZjzWP"}):pe._({id:"DWumLi"}),menuItemClassName:h?"danger":void 0,onClick:()=>{x.shortcuts=a,fe(pe._({id:"QO9uTx"})),i==null||i()},children:e("button",{type:"button",class:"plain2",disabled:!a,children:h?pe._({id:"uIp8WL"}):pe._({id:"Sjnlwj"})})})]})]}),e("section",{children:[e("h3",{children:[e(I,{icon:"arrow-up-circle",size:"l",class:"insignificant"})," ",e("span",{children:e(f,{id:"GS+Mus"})})]}),e("p",{children:e("input",{style:{width:"100%"},type:"text",value:c,readOnly:!0,onClick:g=>{if(g.target.value){g.target.select();try{navigator.clipboard.writeText(g.target.value),fe(pe._({id:"cWtH+v"}))}catch{fe(pe._({id:"yUWyHa"}))}}},dir:"auto"})}),e("p",{children:[e("button",{type:"button",class:"plain2",disabled:!c,onClick:()=>{try{navigator.clipboard.writeText(c),fe(pe._({id:"+Kq2vY"}))}catch{fe(pe._({id:"tFvxZF"}))}},children:[e(I,{icon:"clipboard"})," ",e("span",{children:e(f,{id:"he3ygx"})})]})," ",(navigator==null?void 0:navigator.share)&&((m=navigator==null?void 0:navigator.canShare)==null?void 0:m.call(navigator,{text:c}))&&e("button",{type:"button",class:"plain2",disabled:!c,onClick:()=>{try{navigator.share({text:c})}catch{alert(pe._({id:"TtG3Uh"}))}},children:[e(I,{icon:"share"})," ",e("span",{children:e(f,{id:"Z8lGw6"})})]})," ",x.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2",disabled:l==="cloud-uploading",onClick:async()=>{d("cloud-uploading");const g=kt();try{const y=(await o.v1.accounts.relationships.fetch({id:[g]}))[0];if(y){const{note:w=""}=y;let b="";const S=JSON.stringify({v:"1",dt:Date.now(),data:c});/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/.test(w)?b=w.replace(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/,`<phanpy-shortcuts-settings>${S}</phanpy-shortcuts-settings>`):b=`${w}
<phanpy-shortcuts-settings>${S}</phanpy-shortcuts-settings>`,fe(pe._({id:"9ZYiLz"})),await o.v1.accounts.$select(g).note.create({comment:b}),d("default"),fe(pe._({id:"5w02SH"}))}}catch{d("error"),fe(pe._({id:"aVsTYo"}))}},title:pe._({id:"gWd6Cu"}),children:[e(I,{icon:"cloud"}),e(I,{icon:"arrow-up"})]})," ",c.length>0&&e("small",{class:"insignificant ib",children:e(f,{id:"IPXOXm",values:{0:c.length}})})]}),!!c&&e("details",{children:[e("summary",{class:"insignificant",children:e("small",{children:e(f,{id:"e5E+WH"})})}),e("textarea",{style:{width:"100%"},rows:10,readOnly:!0,children:JSON.stringify(n.filter(Boolean),null,2)})]})]}),x.settings.shortcutSettingsCloudImportExport&&e("footer",{children:e("p",{children:[e(I,{icon:"cloud"})," ",e(f,{id:"C4T6O/"})]})})]})]})}ws(x,n=>{for(const[i,s,o,c]of n)/^show/i.test(s)&&!o&&ni()});function gr(){var c,r,u,l,d,a,h,p;const{_:n}=le(),i=We(x),s=ks(),o=Jt();return Q(()=>{setTimeout(xo,1e3)},[]),e(U,{children:[!!i.showCompose&&e(Ye,{class:`solid ${i.composerState.minimized?"min":""}`,minimized:!!i.composerState.minimized,children:e(Eo,{replyToStatus:typeof i.showCompose!="boolean"?i.showCompose.replyToStatus:((c=window.__COMPOSE__)==null?void 0:c.replyToStatus)||null,editStatus:((r=x.showCompose)==null?void 0:r.editStatus)||((u=window.__COMPOSE__)==null?void 0:u.editStatus)||null,draftStatus:((l=x.showCompose)==null?void 0:l.draftStatus)||((d=window.__COMPOSE__)==null?void 0:d.draftStatus)||null,onClose:m=>{const{newStatus:g,instance:v,type:y,scheduledAt:w}=m||{};x.showCompose=!1,window.__COMPOSE__=null,g&&(x.reloadStatusPage++,w&&x.reloadScheduledPosts++,fe({text:{post:n(w?{id:"IrX0sj"}:{id:"aTyHBW"}),reply:n(w?{id:"+38pse"}:{id:"lZdBKl"}),edit:n({id:"a5BN7l"})}[y||"post"],delay:1e3,duration:1e4,onClick:b=>{b.hideToast(),x.prevLocation=o,s(w?"/sp":v?`/${v}/s/${g.id}`:`/s/${g.id}`)}}))}})}),!!i.showSettings&&e(Ye,{onClose:()=>{x.showSettings=!1},children:e(oa,{onClose:()=>{x.showSettings=!1}})}),!!i.showAccounts&&e(Ye,{onClose:()=>{x.showAccounts=!1},children:e(jc,{onClose:()=>{x.showAccounts=!1}})}),!!i.showAccount&&e(Ye,{onClose:()=>{x.showAccount=!1},children:e(La,{account:((a=i.showAccount)==null?void 0:a.account)||i.showAccount,instance:(h=i.showAccount)==null?void 0:h.instance,onClose:({destination:m}={})=>{x.showAccount=!1}})}),!!i.showDrafts&&e(Ye,{onClose:()=>{x.showDrafts=!1},children:e(Ma,{onClose:()=>x.showDrafts=!1})}),!!i.showMediaModal&&e(Ye,{onClick:m=>{(m.target===m.currentTarget||m.target.classList.contains("media"))&&(x.showMediaModal=!1)},children:e(Xs,{mediaAttachments:i.showMediaModal.mediaAttachments,instance:i.showMediaModal.instance,index:i.showMediaModal.mediaIndex,statusID:i.showMediaModal.statusID,onClose:()=>{x.showMediaModal=!1}})}),!!i.showShortcutsSettings&&e(Ye,{onClose:()=>{x.showShortcutsSettings=!1},children:e(fr,{onClose:()=>x.showShortcutsSettings=!1})}),!!i.showGenericAccounts&&e(Ye,{onClose:()=>{x.showGenericAccounts=!1},children:e(Pa,{instance:i.showGenericAccounts.instance,excludeRelationshipAttrs:i.showGenericAccounts.excludeRelationshipAttrs,postID:i.showGenericAccounts.postID,onClose:()=>x.showGenericAccounts=!1,blankCopy:i.showGenericAccounts.blankCopy})}),!!i.showMediaAlt&&e(Ye,{onClose:m=>{x.showMediaAlt=!1},children:e(Oa,{alt:i.showMediaAlt.alt||i.showMediaAlt,lang:(p=i.showMediaAlt)==null?void 0:p.lang,onClose:()=>{x.showMediaAlt=!1}})}),!!i.showEmbedModal&&e(Ye,{class:"solid",onClose:()=>{x.showEmbedModal=!1},children:e(Na,{html:i.showEmbedModal.html,url:i.showEmbedModal.url,width:i.showEmbedModal.width,height:i.showEmbedModal.height,onClose:()=>{x.showEmbedModal=!1}})}),!!i.showReportModal&&e(Ye,{onClose:()=>{x.showReportModal=!1},children:e(tr,{account:i.showReportModal.account,post:i.showReportModal.post,onClose:()=>{x.showReportModal=!1}})})]})}function si({accountID:n,onChange:i}){const{_:s}=le(),{masto:o}=re(),[c,r]=M("default"),[u,l]=M(null),[d,a]=M(null),h=d!==null;return e("p",{class:"follow-request-buttons",children:[e("button",{type:"button",disabled:c==="loading"||h,onClick:()=>{r("loading"),l("accept"),(async()=>{try{const p=await o.v1.followRequests.$select(n).authorize();if(!(p!=null&&p.followedBy))throw new Error("Follow request not accepted");a(p),i()}catch{}r("default")})()},children:e(f,{id:"g3UF2V"})})," ",e("button",{type:"button",disabled:c==="loading"||h,class:"light danger",onClick:()=>{r("loading"),l("reject"),(async()=>{try{const p=await o.v1.followRequests.$select(n).reject();if(p!=null&&p.followedBy)throw new Error("Follow request not rejected");a(p),i()}catch{r("default")}})()},children:e(f,{id:"1t/NnN"})}),e("span",{class:"follow-request-states",children:h&&u?u==="accept"?e(I,{icon:"check-circle",alt:s({id:"bzMKg7"}),class:"follow-accepted"}):e(I,{icon:"x-circle",alt:s({id:"ekCRTP"}),class:"follow-rejected"}):e(Be,{hidden:c!=="loading"})})]})}const Ji={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",annual_report:"celebrate"};function Qi({account:n,emoji:i,emoji_url:s}){let o,c;typeof s=="string"?o=s:(o=s==null?void 0:s.url,c=s==null?void 0:s.staticUrl);const r=o?e(Xo,{url:o,staticUrl:c,alt:i}):i;return e(f,{id:"i5uN6K",values:{account:n,emojiObject:r}})}const Wn={status:({account:n})=>e(f,{id:"idiIxW",values:{account:n}}),reblog:({count:n,account:i,postsCount:s,postType:o,components:{Subject:c}})=>e(f,{id:"jkt9P5",values:{0:Qe(n),1:Qe(n),count:n,postsCount:s,postType:o,account:i},components:{0:e(c,{clickable:n>1}),1:e("span",{title:n}),2:e(c,{clickable:n>1}),3:e("span",{title:n})}}),follow:({account:n,count:i,components:{Subject:s}})=>e(f,{id:"+71G9C",values:{0:Qe(i),count:i,account:n},components:{0:e(s,{clickable:i>1}),1:e("span",{title:i})}}),follow_request:({account:n})=>e(f,{id:"eh6NHW",values:{account:n}}),favourite:({account:n,count:i,postsCount:s,postType:o,components:{Subject:c}})=>e(f,{id:"RqX1mR",values:{0:Qe(i),1:Qe(i),count:i,postsCount:s,postType:o,account:n},components:{0:e(c,{clickable:i>1}),1:e("span",{title:i}),2:e(c,{clickable:i>1}),3:e("span",{title:i})}}),poll:()=>pe._({id:"kIlJaS"}),"poll-self":()=>pe._({id:"kpjzdN"}),"poll-voted":()=>pe._({id:"moT7M8"}),update:()=>pe._({id:"uzt17m"}),"favourite+reblog":({count:n,account:i,postsCount:s,postType:o,components:{Subject:c}})=>e(f,{id:"NunZZQ",values:{0:Qe(n),1:Qe(n),count:n,postsCount:s,postType:o,account:i},components:{0:e(c,{clickable:n>1}),1:e("span",{title:n}),2:e(c,{clickable:n>1}),3:e("span",{title:n})}}),"admin.sign_up":({account:n})=>e(f,{id:"fJCCpx",values:{account:n}}),"admin.report":({account:n,targetAccount:i})=>e(f,{id:"eNfCmq",values:{account:n,targetAccount:i}}),severed_relationships:({name:n})=>e(f,{id:"Xl9v6+",values:{name:n},components:{0:e("i",{})}}),moderation_warning:()=>e("b",{children:e(f,{id:"YqffEv"})}),emoji_reaction:Qi,"pleroma:emoji_reaction":Qi,annual_report:({year:n})=>e(f,{id:"INLTzH",values:{year:n}})},yr={account_suspension:({from:n,targetName:i})=>e(f,{id:"uRkcgw",values:{from:n,targetName:i},components:{0:e("i",{}),1:e("i",{})}}),domain_block:({from:n,targetName:i,followersCount:s,followingCount:o})=>e(f,{id:"Q3yArs",values:{from:n,targetName:i,followersCount:s,followingCount:o},components:{0:e("i",{}),1:e("i",{})}}),user_domain_block:({targetName:n,followersCount:i,followingCount:s})=>e(f,{id:"RQKWUa",values:{targetName:n,followersCount:i,followingCount:s},components:{0:e("i",{})}})},br={none:{id:"ipnHrn"},disable:{id:"jw0eSZ"},mark_statuses_as_sensitive:{id:"v9jO+F"},delete_statuses:{id:"raUMBQ"},sensitive:{id:"w2OpMr"},silence:{id:"mlycBx"},suspend:{id:"Fz4lZ1"}},Zn=30;function vr({notification:n,instance:i,isStatic:s,disableContextMenu:o}){var te,J,ue,he,ne,we,Ce;const{_:c}=le(),{masto:r}=re(),{id:u,status:l,account:d,report:a,event:h,moderation_warning:p,annualReport:m,_ids:g,_accounts:v,_statuses:y,_groupKeys:w,sampleAccounts:b,notificationsCount:S,groupKey:_,_notificationsCount:T,_sampleAccountsCount:A}=n;let{type:k}=n;if(k==="mention"&&!l)return null;const C=(l==null?void 0:l.reblog)||l,E=C==null?void 0:C.id,R=kt(),F=R===(d==null?void 0:d.id),D=(te=l==null?void 0:l.poll)==null?void 0:te.voted,W=!!(l!=null&&l.inReplyToAccountId)&&(l==null?void 0:l.inReplyToAccountId)!==R&&((J=l==null?void 0:l.account)==null?void 0:J.id)===R;let G=0,X=0;if(k==="favourite+reblog"){if(v)for(const se of v)(ue=se._types)!=null&&ue.includes("favourite")&&G++,(he=se._types)!=null&&he.includes("reblog")&&X++;!X&&G&&(k="favourite"),!G&&X&&(k="reblog")}let q;k==="poll"?q=Wn[F?"poll-self":D?"poll-voted":"poll"]:Wn[k]?q=Wn[k]:q=pe._({id:"ODqZt1",values:{type:k}});const Z=({clickable:se,...Te})=>se?e("b",{tabIndex:"0",onClick:Y,...Te}):e("b",{...Te}),B=S>0&&S>(b==null?void 0:b.length),ee=B?"remote":"local";if(typeof q=="function"){const se=(k==="favourite"||k==="reblog")&&S?B?S:b==null?void 0:b.length:(v==null?void 0:v.length)||(b==null?void 0:b.length)||(d?1:0),Te=(y==null?void 0:y.length)||(l?1:0);if(k==="admin.report"){const Ie=a==null?void 0:a.targetAccount;Ie&&(q=q({account:e(yt,{account:d,showAvatar:!0}),targetAccount:e(yt,{account:Ie,showAvatar:!0})}))}else if(k==="severed_relationships"){const Ie=h==null?void 0:h.targetName;Ie&&(q=q({name:Ie}))}else if((k==="emoji_reaction"||k==="pleroma:emoji_reaction")&&n.emoji){const Ie=n.emoji_url||((we=(ne=l==null?void 0:l.emojis)==null?void 0:ne.find)==null?void 0:we.call(ne,Pe=>(Pe==null?void 0:Pe.shortcode)===n.emoji.replace(/^:/,"").replace(/:$/,"")));q=q({account:e(yt,{account:d,showAvatar:!0}),emoji:n.emoji,emojiURL:Ie})}else k==="annual_report"?q=q({...n.annualReport}):q=q({account:d?e(yt,{account:d,showAvatar:!0}):(b==null?void 0:b[0])&&e(yt,{account:b[0],showAvatar:!0}),count:se,postsCount:Te,postType:W?"reply":"post",components:{Subject:Z}})}const $=n.createdAt&&new Date(n.createdAt).toLocaleString(),K={"favourite+reblog":pe._({id:"+XOeb+"}),favourite:pe._({id:"LQFF6J"}),reblog:pe._({id:"phQpSa"}),follow:pe._({id:"Ih01jh"})}[k]||pe._({id:"bPwFdf"}),Y=()=>{x.showGenericAccounts={heading:K,accounts:v,showReactions:k==="favourite+reblog",excludeRelationshipAttrs:k==="follow"?["followedBy"]:[],postID:lt(E,i)}};if(l!=null&&l.filtered){const se=((Ce=l==null?void 0:l.account)==null?void 0:Ce.id)===R,Te=Vt(l.filtered,"notifications");if(!F&&!se&&(Te==null?void 0:Te.action)==="hide")return null}return e("div",{class:`notification notification-${k}`,"data-notification-id":g||u,"data-group-key":(w==null?void 0:w.join(" "))||_,tabIndex:"0",children:[e("div",{class:`notification-type notification-${k}`,title:$,children:k==="favourite+reblog"?e(U,{children:[e(I,{icon:"rocket",size:"xl",alt:k,class:"reblog-icon"}),e(I,{icon:"heart",size:"xl",alt:k,class:"favourite-icon"})]}):e(I,{icon:Ji[k]||"notification",size:"xl",alt:k})}),e("div",{class:"notification-content",children:[k!=="mention"&&e(U,{children:[e("p",{children:q}),k==="follow_request"&&e(si,{accountID:d.id}),k==="severed_relationships"&&e("div",{children:[yr[h.type]({from:i,...h}),e("br",{}),e("a",{href:`https://${i}/severed_relationships`,target:"_blank",rel:"noopener",children:e(f,{id:"YL6Y8P",components:{0:e(I,{icon:"external",size:"s"})}})}),"."]}),k==="moderation_warning"&&!!p&&e("div",{children:[c(br[p.action]()),e("br",{}),e("a",{href:`/disputes/strikes/${p.id}`,target:"_blank",rel:"noopener",children:e(f,{id:"YL6Y8P",components:{0:e(I,{icon:"external",size:"s"})}})})]}),k==="annual_report"&&e("div",{children:e(ge,{to:`/annual_report/${m==null?void 0:m.year}`,children:e(f,{id:"5PGPvG"})})})]}),(v==null?void 0:v.length)>1&&e("p",{class:"avatars-stack",children:[v.slice(0,Zn).map(se=>e(U,{children:[e("a",{href:se.url,rel:"noopener",class:"account-avatar-stack",onClick:Te=>{Te.preventDefault(),x.showAccount=se},children:[e(mt,{url:se.avatarStatic,size:v.length<=10?"xxl":v.length<20?"xl":"l",alt:`${se.displayName} @${se.acct}`,squircle:se==null?void 0:se.bot},se.id),k==="favourite+reblog"&&e("div",{class:"account-sub-icons",children:se._types.map(Te=>e(I,{icon:Ji[Te],size:"s",class:`${Te}-icon`}))})]},se.id)," "]},se.id)),(k==="favourite+reblog"||k==="favourite"||k==="reblog")&&ee==="remote"?e("button",{type:"button",class:"small plain","data-group-keys":w==null?void 0:w.join(" "),onClick:()=>{x.showGenericAccounts={heading:K,accounts:v,fetchAccounts:async()=>{const se=await Promise.allSettled(w.map(async Ie=>{const Pe=r.v2.notifications.$select(Ie).accounts.list().values();return[Ie,(await Pe.next()).value]})),Te=[];for(const Ie of se){const[Pe,$e]=Ie.value,Ee=/^favourite/.test(Pe)?"favourite":/^reblog/.test(Pe)?"reblog":null;if(Ee)for(const H of $e){const ke=Te.find(De=>De.id===H.id);ke?ke._types.push(Ee):(H._types=[Ee],Te.push(H))}}return{done:!0,value:Te}},showReactions:k==="favourite+reblog",postID:lt(E,i)}},children:["+",(k==="favourite"||k==="reblog")&&S-v.length,e(I,{icon:"chevron-down"})]}):e("button",{type:"button",class:"small plain",onClick:Y,children:[v.length>Zn&&`+${v.length-Zn}`,e(I,{icon:"chevron-down"})]})]}),!(v!=null&&v.length)&&(b==null?void 0:b.length)>1&&e("p",{class:"avatars-stack",children:[b.map(se=>e(U,{children:[e("a",{href:se.url,rel:"noopener",class:"account-avatar-stack",onClick:Te=>{Te.preventDefault(),x.showAccount=se},children:e(mt,{url:se.avatarStatic,size:"xxl",alt:`${se.displayName} @${se.acct}`,squircle:se==null?void 0:se.bot},se.id)},se.id)," "]},se.id)),S>b.length&&e(ge,{to:i?`/${i}/s/${l.id}`:`/s/${l.id}`,class:"button small plain centered",children:["+",S-b.length,e(I,{icon:"chevron-right"})]})]}),(y==null?void 0:y.length)>1&&e("ul",{class:"notification-group-statuses",children:y.map(se=>e("li",{children:e(es,{class:`status-link status-type-${k}`,to:i?`/${i}/s/${se.id}`:`/s/${se.id}`,children:e(Ge,{status:se,size:"s",previewMode:!0,allowContextMenu:!0,allowFilters:!0})})},se.id))}),l&&(!(y!=null&&y.length)||(y==null?void 0:y.length)<=1)&&e(es,{class:`status-link status-type-${k}`,to:i?`/${i}/s/${E}`:`/s/${E}`,onContextMenu:o?void 0:se=>{const Te=se.target.querySelector(".status");if(Te){if(se.metaKey)return;se.preventDefault(),Te.dispatchEvent(new MouseEvent("contextmenu",{clientX:se.clientX,clientY:se.clientY}))}},children:s?e(Ge,{status:C,size:"s",readOnly:!0,allowContextMenu:!0,allowFilters:!0}):e(Ge,{statusID:E,size:"s",readOnly:!0,allowContextMenu:!0,allowFilters:!0})})]})]})}function es(n){const i=Jo();return e(ge,{...n,"data-read-more":pe._({id:"8fZueG"}),ref:i})}const ln=ut(vr,(n,i)=>{var s,o;return((s=n.notification)==null?void 0:s.id)===((o=i.notification)==null?void 0:o.id)});"serviceWorker"in navigator&&navigator.serviceWorker.addEventListener("message",n=>{const{type:i,id:s,accessToken:o}=(n==null?void 0:n.data)||{};i==="notification"&&(x.routeNotification={id:s,accessToken:o})});const wr=ut(function(){const{_:i}=le();if(!("serviceWorker"in navigator))return null;const s=We(x),{routeNotification:o}=s,{id:c,accessToken:r}=o||{},[u,l]=M(!1);St(()=>{if(!c||!r)return;const{instance:a}=re(),{masto:h,instance:p}=re({accessToken:r}),m=a===p,g=r?Ro(r):di();(async()=>{const v=await h.v1.notifications.$select(c).fetch();if(v&&g){const y=g.instanceURL,{type:w,status:b,account:S}=v,_=!!document.querySelector("#modal-container > *"),T=w==="follow"&&!!(S!=null&&S.id),A=!!(S!=null&&S.id),k=!!(b!=null&&b.id);T&&m?x.showAccount={account:S,instance:y}:_||!m||A&&k?l({id:c,account:g,notification:v,sameInstance:m}):k?location.hash=`/${a}/s/${b.id}`:T?location.hash=`/${a}/a/${S.id}`:location.hash="/notifications"}})()},[c,r]),St(()=>{navigator!=null&&navigator.clearAppBadge&&navigator.clearAppBadge()},[]),Gt(a=>{a&&(navigator!=null&&navigator.clearAppBadge)&&navigator.clearAppBadge()});const d=()=>{l(!1),x.routeNotification=null,/\/notifications\?id=/i.test(location.hash)&&(location.hash="/notifications")};if(u){const{id:a,account:h,notification:p,sameInstance:m}=u;return e(Ye,{onClick:g=>{g.target===g.currentTarget&&d()},children:e("div",{class:"sheet",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:d,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(f,{id:"5+87Pq"})})}),e("main",{children:[!m&&e("p",{children:e(f,{id:"k9N0Xk"})}),e("div",{class:"notification-peek",onClick:g=>{const{target:v}=g;(g.target.tagName==="BUTTON"||g.target.tagName==="A")&&d()},children:e(ln,{instance:h.instanceURL,notification:p,isStatic:!0})}),e("div",{style:{textAlign:"end"},children:e(ge,{to:"/notifications",class:"button light",onClick:d,children:[e("span",{children:e(f,{id:"/WA/tl"})})," ",e(I,{icon:"arrow-right"})]})})]})]})})}return null}),Qs=Lo((n,i)=>{const{_:s}=le(),{instance:o}=re(),[c,r]=vt(),[u,l]=M(!1),[d,a]=M(c.get("q")||""),h=c.get("type"),p=j(null),m=j(null);return Mo(i,()=>({setValue:g=>{a(g)},focus:()=>{m.current.focus()},select:()=>{m.current.select()},blur:()=>{m.current.blur()}})),e("form",{ref:p,class:"search-popover-container",onSubmit:g=>{var y;if(g.preventDefault(),/\/search/.test(location.hash))if(d){const w={q:d};h&&(w.type=h),r(w)}else r({});else d?location.hash=`/search?q=${encodeURIComponent(d)}${h?`&type=${h}`:""}`:location.hash="/search";(y=n==null?void 0:n.onSubmit)==null||y.call(n,g)},children:[e("input",{ref:m,value:d,name:"q",type:"search",placeholder:s({id:"A1taO8"}),dir:"auto",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",onSearch:g=>{g.target.value||r({})},onInput:g=>{a(g.target.value),l(!0)},onFocus:()=>{var g,v;l(!0),(v=(g=p.current)==null?void 0:g.querySelector(".search-popover-item"))==null||v.classList.add("focus")},onBlur:()=>{var g,v;setTimeout(()=>{l(!1)},100),(v=(g=p.current)==null?void 0:g.querySelector(".search-popover-item.focus"))==null||v.classList.remove("focus")},onKeyDown:g=>{var y;const{key:v}=g;switch(v){case"Escape":l(!1);break;case"Down":case"ArrowDown":if(g.preventDefault(),u){const w=p.current.querySelector(".search-popover-item.focus");if(w){let b=w.nextElementSibling;for(;b&&b.hidden;)b=b.nextElementSibling;b&&(b.classList.add("focus"),Array.from(b.parentElement.children).filter(_=>_!==b).forEach(_=>{_.classList.remove("focus")}))}else{const b=p.current.querySelector(".search-popover-item");b&&b.classList.add("focus")}}break;case"Up":case"ArrowUp":if(g.preventDefault(),u){const w=document.querySelector(".search-popover-item.focus");if(w){let b=w.previousElementSibling;for(;b&&b.hidden;)b=b.previousElementSibling;b&&(b.classList.add("focus"),Array.from(b.parentElement.children).filter(_=>_!==b).forEach(_=>{_.classList.remove("focus")}))}else{const b=document.querySelector(".search-popover-item:last-child");b&&b.classList.add("focus")}}break;case"Enter":if(u){const w=document.querySelector(".search-popover-item.focus");w&&(g.preventDefault(),w.click()),l(!1),(y=n==null?void 0:n.onSubmit)==null||y.call(n,g)}break}}}),e("div",{class:"search-popover",hidden:!u||!d,children:!!d&&[{label:e(f,{id:"48oDit",values:{query:d},components:{0:e("small",{class:"insignificant"})}}),to:`/search?q=${encodeURIComponent(d)}`,top:!h&&!/\s/.test(d),hidden:!!h},{label:e(f,{id:"o1mMWT",values:{query:d},components:{0:e("q",{})}}),to:`/search?q=${encodeURIComponent(d)}&type=statuses`,hidden:/^https?:/.test(d),top:/\s/.test(d),icon:"document",queryType:"statuses"},{label:e(f,{id:"YAZw8D",values:{0:d.replace(/^#/,"")},components:{0:e("mark",{})}}),to:`/${o}/t/${d.replace(/^#/,"")}`,hidden:/^@/.test(d)||/^https?:/.test(d)||/\s/.test(d),top:/^#/.test(d),type:"link",icon:"hashtag",queryType:"hashtags"},{label:e(f,{id:"gEoOUj",values:{query:d},components:{0:e("mark",{})}}),to:`/${d}`,hidden:!/^https?:/.test(d),top:/^https?:/.test(d),type:"link"},{label:e(f,{id:"cDoNQr",values:{query:d},components:{0:e("q",{})}}),to:`/search?q=${encodeURIComponent(d)}&type=accounts`,icon:"group",queryType:"accounts"}].sort((g,v)=>{if(h){if(g.queryType===h)return-1;if(v.queryType===h)return 1}return g.top&&!v.top?-1:!g.top&&v.top?1:0}).filter(({hidden:g})=>!g).map(({label:g,to:v,icon:y,type:w},b)=>e(ge,{to:v,class:`search-popover-item ${b===0?"focus":""}`,onClick:S=>{var _;(_=n==null?void 0:n.onSubmit)==null||_.call(n,S)},children:[e(I,{icon:y||(w==="link"?"arrow-right":"search"),class:"more-insignificant"}),e("span",{children:g})," "]}))})]})}),kr=ut(function({onClose:i=()=>{}}){const[s,o]=M(!1),c=j(null);qe(["Slash","/"],u=>{o(!0),setTimeout(()=>{var l,d,a,h;(d=(l=c.current)==null?void 0:l.focus)==null||d.call(l),(h=(a=c.current)==null?void 0:a.select)==null||h.call(a)},0)},{useKey:!0,preventDefault:!0,ignoreEventWhen:u=>{const l=/\/search/.test(location.hash),d=!!document.querySelector("#modal-container > *");return l||d||u.metaKey||u.ctrlKey||u.altKey||u.shiftKey}});const r=()=>{o(!1),i()};return qe("esc",u=>{var l,d;(d=(l=c.current)==null?void 0:l.blur)==null||d.call(l),r()},{enabled:s,enableOnFormTags:!0,preventDefault:!0,useKey:!0,ignoreEventWhen:u=>u.metaKey||u.ctrlKey||u.altKey||u.shiftKey}),e("div",{id:"search-command-container",hidden:!s,onClick:u=>{u.target===u.currentTarget&&r()},children:e(Qs,{ref:c,onSubmit:()=>{r()}})})});function Sr(){const{_:n,_:i}=le(),{instance:s}=re(),o=We(x),{shortcuts:c,settings:r}=o;if(!c.length)return null;const u=r.shortcutsViewMode==="multi-column"||!r.shortcutsViewMode&&r.shortcutsColumnsMode,l=j(),d=j(!1),a=c.map((g,v)=>{const{type:y,...w}=g;if(!$n[y])return null;let{id:b,path:S,title:_,subtitle:T,icon:A}=$n[y];return typeof b=="function"&&(b=b(w,v)),typeof S=="function"&&(S=S({...w,instance:w.instance||s},v)),typeof _=="function"?_=_(w,v):_=i(_),typeof T=="function"?T=T(w,v):T=i(T),typeof A=="function"&&(A=A(w,v)),b==="lists"&&(d.current=!0),{id:b,path:S,title:_,subtitle:T,icon:A}}).filter(Boolean),h=ks();qe(["1","2","3","4","5","6","7","8","9"],g=>{var y,w;const v=parseInt(g.key,10)-1;if(v<a.length){const{path:b}=a[v];b&&(h(b),(w=(y=l.current)==null?void 0:y.closeMenu)==null||w.call(y))}},{enabled:!u,useKey:!0,ignoreEventWhen:g=>g.metaKey||g.ctrlKey||g.altKey||g.shiftKey});const[p,m]=M([]);return u?null:e("div",{id:"shortcuts",children:o.settings.shortcutsViewMode==="tab-menu-bar"?e("nav",{class:"tab-bar",onContextMenu:g=>{g.preventDefault(),x.showShortcutsSettings=!0},children:e("ul",{children:a.map(({id:g,path:v,title:y,subtitle:w,icon:b},S)=>e("li",{children:e(ge,{class:w?"has-subtitle":"",to:v,onClick:_=>{if(_.target.classList.contains("is-active")){_.preventDefault();const T=document.getElementById(`${g}-page`);if(T){T.scrollTop=0;const A=T.querySelector(".updates-button");A&&A.click()}}},children:[e(I,{icon:b,size:"xl",alt:y}),e("span",{children:[e(wn,{children:y}),w&&e(U,{children:[e("br",{}),e("small",{children:w})]})]})]})},`${S}-${g}-${y}-${w}-${v}`))})}):e(dt,{instanceRef:l,overflow:"auto",viewScroll:"close",menuClassName:"glass-menu shortcuts-menu",gap:8,position:"anchor",onMenuChange:g=>{g.open&&d.current&&hn().then(m)},menuButton:e("button",{type:"button",id:"shortcuts-button",class:"plain",onContextMenu:g=>{g.preventDefault(),x.showShortcutsSettings=!0},onTransitionStart:g=>{var v,y;try{const{target:w}=g;getComputedStyle(w).pointerEvents==="none"&&((y=(v=l.current)==null?void 0:v.closeMenu)==null||y.call(v))}catch{}},children:e(I,{icon:"shortcut",size:"xl",alt:n({id:"CTqTgr"})})}),children:a.map(({id:g,path:v,title:y,subtitle:w,icon:b},S)=>g==="lists"?e(dn,{menuClassName:"glass-menu",overflow:"auto",gap:-8,label:e(U,{children:[e(I,{icon:b,size:"l"}),e("span",{class:"menu-grow",children:e(wn,{children:y})}),e(I,{icon:"chevron-right"})]}),children:[e(je,{to:"/l",children:e("span",{children:e(f,{id:"BHWx+g"})})}),e(Ve,{}),p==null?void 0:p.map(_=>e(je,{to:`/l/${_.id}`,children:e("span",{children:[_.title,_.exclusive&&e(U,{children:[" ",e(Bt,{})]})]})},_.id))]}):e(je,{to:v,class:"glass-menu-item",children:[e(I,{icon:b,size:"l"})," ",e("span",{class:"menu-grow",children:[e("span",{children:e(wn,{children:y})}),w&&e(U,{children:[" ",e("small",{class:"more-insignificant",children:w})]})]}),e("span",{class:"menu-shortcut hide-until-focus-visible",children:S+1})]},`${S}-${g}-${y}-${w}-${v}`))})})}const _r=ut(Sr);function Cr(n){var c;let i=[],s=[],o=0;for(let r=0;r<n.length;r++){const u=n[r];u.reblog&&!((c=u.account)!=null&&c.group)?(s.push(u),o++):(i.push(u),o<3&&(o=0))}if(n.length>10&&(s.length>n.length/4||o>=3)){const r=s.map(u=>u.id);if(s.length>n.length*3/4)i=[...i,{id:r,items:s,type:"boosts"}];else{const u=Math.floor(i.length/2);i=[...i.slice(0,u),{id:r,items:s,type:"boosts"},...i.slice(u)]}return i}else return n}function ts(n,i){const s=Ue.account.get("boostedStatusIDs")||{},o=n.filter(r=>{if(!r.reblog)return!0;const u=`${i}-${r.reblog.id}`,l=s[u];return l&&l!==r.id?!1:(s[u]=r.id,!0)}),c=Object.keys(s);return c.length>50&&c.slice(0,c.length-50).forEach(r=>{delete s[r]}),Ue.account.set("boostedStatusIDs",s),o}function Ir(n,i){const s=[];let o=0;n.forEach(l=>{for(let a=0;a<s.length;a++){if(s[a].find(h=>h.id===l.id))return;if(s[a].find(h=>h.id===l.inReplyToId)||s[a].find(h=>h.inReplyToId===l.id)){s[a].push(l);return}}const d=n.find(a=>a.id===l.inReplyToId);d&&(s[o++]=[l,d])});for(let l=0;l<s.length;l++)for(let d=l+1;d<s.length;d++)s[l].find(h=>s[d].includes(h))&&(s[l]=[...s[l],...s[d]],s[l]=s[l].filter((h,p,m)=>m.findIndex(g=>g.id===h.id)===p),s.splice(d,1),d--);s.forEach(l=>{l.sort((d,a)=>!d.inReplyToId&&!a.inReplyToId?new Date(d.createdAt)-new Date(a.createdAt):d.inReplyToId===a.id?1:a.inReplyToId===d.id||!d.inReplyToId?-1:a.inReplyToId?new Date(d.createdAt)-new Date(a.createdAt):1)}),s.forEach(l=>{const d=l[0].account.id;l.forEach(a=>{a.account.id!==d&&(a._differentAuthor=!0)})}),s.length;const c=[],r=[],u=[];return n.forEach(l=>{if(l.reblog){c.push(l);return}for(let d=0;d<s.length;d++)if(s[d].find(a=>a.id===l.id)){if(r.includes(d))return;const a=s[d];a.sort((p,m)=>{const g=new Date(p.createdAt),v=new Date(m.createdAt);return g-v});const h=a[0].account.id;c.push({id:a.map(p=>p.id),items:a,type:a.every(p=>p.account.id===h)?"thread":"conversation"}),r.push(d);return}if(l.inReplyToId&&l.inReplyToAccountId!==l.account.id){const d=lt(l.id,i);x.statusReply[d]||u.push({sKey:d,inReplyToId:l.inReplyToId})}c.push(l)}),u!=null&&u.length&&queueMicrotask(()=>{const{masto:l}=re({instance:i});async function d(){for(let a=0;a<u.length;a++){const{sKey:h,inReplyToId:p}=u[a];try{const m=await Tr(p,l);et(m,i,{skipThreading:!0}),x.statusReply[h]={id:m.id,instance:i},await new Promise(g=>setTimeout(g,1e3))}catch{}}}if(Je("@mastodon/fetch-multiple-statuses")){const a=u.map(({inReplyToId:h})=>h);(async()=>{var h;try{const p=await l.v1.statuses.list({id:a});if(p!=null&&p.length)for(const m of p){et(m,i,{skipThreading:!0});const g=(h=u.find(({inReplyToId:v})=>v===m.id))==null?void 0:h.sKey;g&&(x.statusReply[g]={id:m.id,instance:i})}else d()}catch{d()}})()}else d()}),c}const Tr=bt((n,i)=>i.v1.statuses.$select(n).fetch());async function eo(n,i){const s=await lr();if(!s.length)return;const{statusFollowedTags:o}=x,c=[];if(n.forEach(r=>{var m;if(r.reblog)return;const{id:u,content:l,tags:d=[]}=r,a=lt(u,i);if((m=o[a])!=null&&m.length)return;const h=dr(l);if(!h.length&&!d.length)return;const p=s.reduce((g,v)=>((h.some(y=>y.toLowerCase()===v.name.toLowerCase())||d.some(y=>y.name.toLowerCase()===v.name.toLowerCase()))&&g.push(v.name),g),[]);p.length&&c.push({item:r,sKey:a,followedTags:p})}),c.length){const r=c.map(l=>l.item.account),u=await Pn(r);if(!u)return;c.forEach(l=>{const{item:d,sKey:a,followedTags:h}=l,p=u[d.account.id];p&&!p.following&&(o[a]=h)})}}function Ar(){x.statusFollowedTags={}}function xr({scrollableRef:n,distanceFromStart:i=1,distanceFromEnd:s=1,scrollThresholdStart:o=10,scrollThresholdEnd:c=10,direction:r="vertical",distanceFromStartPx:u,distanceFromEndPx:l}={}){const[d,a]=M(null),[h,p]=M(!1),[m,g]=M(!1),[v,y]=M(!1),[w,b]=M(!1),S=r==="vertical";return St(()=>{const _=n.current;if(!_)return{};let T=S?_.scrollTop:_.scrollLeft;function A(){const{scrollTop:k,scrollLeft:C,scrollHeight:E,scrollWidth:R,clientHeight:F,clientWidth:D}=_,W=S?k:C,G=S?E:R,X=S?F:D,q=Math.abs(W-T),Z=u||Math.min(X*i,G,W),B=l||Math.min(X*s,G,G-W-X);q>=(T<W?c:o)&&(a(T<W?"end":"start"),T=W),p(W<=0),g(W+X>=G),y(W<=Z),b(W+X>=G-B)}return _.addEventListener("scroll",A,{passive:!0}),()=>_.removeEventListener("scroll",A)},[i,s,o,c]),{scrollDirection:d,reachStart:h,reachEnd:m,nearReachStart:v,nearReachEnd:w,init:()=>{n.current&&n.current.dispatchEvent(new Event("scroll"))}}}function Er({scrollableRef:n,distanceFromStart:i=1,distanceFromEnd:s=1,scrollThresholdStart:o=10,scrollThresholdEnd:c=10,direction:r="vertical",distanceFromStartPx:u,distanceFromEndPx:l,init:d}={},a,h){if(!a)return;const p=r==="vertical",m=j(null),g=j(null),v=Qo(()=>{let y=!1,w=!1,b=!1,S=!1;const _=n.current,{scrollTop:T,scrollLeft:A,scrollHeight:k,scrollWidth:C,clientHeight:E,clientWidth:R}=_,F=p?T:A,D=p?k:C,W=p?E:R,G=Math.abs(F-m.current),X=u||Math.min(W*i,D,F),q=l||Math.min(W*s,D,D-F-W);G>=(m.current<F?c:o)&&(g.current=m.current<F?"end":"start",m.current=F),y=F<=0,w=F+W>=D,b=F<=X,S=F+W>=D-q,a({scrollDirection:g.current,reachStart:y,reachEnd:w,nearReachStart:b,nearReachEnd:S})},500);St(()=>{const y=n.current;return y?(m.current=y[p?"scrollTop":"scrollLeft"],y.addEventListener("scroll",v,{passive:!0}),()=>y.removeEventListener("scroll",v)):{}},[i,s,o,c,...h]),Q(()=>{d&&n.current&&queueMicrotask(()=>{n.current.dispatchEvent(new Event("scroll"))})},[d])}function Rr({class:n,statusID:i,status:s,instance:o,parent:c,onMediaClick:r}){var N;const{_:u}=le();let l=lt(i,o);const d=We(x);if(s||(s=d.statuses[l]||d.statuses[i],l=lt(s==null?void 0:s.id,o)),!s)return null;const{account:{acct:a,avatar:h,avatarStatic:p,id:m,url:g,displayName:v,username:y,emojis:w,bot:b,group:S},id:_,repliesCount:T,reblogged:A,reblogsCount:k,favourited:C,favouritesCount:E,bookmarked:R,poll:F,muted:D,sensitive:W,spoilerText:G,visibility:X,language:q,editedAt:Z,filtered:B,card:ee,createdAt:$,inReplyToId:K,inReplyToAccountId:Y,content:te,mentions:J,mediaAttachments:ue,reblog:he,uri:ne,url:we,emojis:Ce,_deleted:se,_pinned:Te}=s;if(!(ue!=null&&ue.length))return null;const Ie=O=>{O.shiftKey},Pe=Ae(()=>kt(),[]),$e=Ae(()=>Pe&&Pe===m,[m,Pe]),Ee=$o(Dn),H=!$e&&Vt(B,Ee);if((H==null?void 0:H.action)==="hide")return null;const ke=W,Me=(((N=li()["reading:expand:media"])==null?void 0:N.toLowerCase())||"default")==="show_all",me=c||"div";return ue.map((O,oe)=>{const Le=`${l}-${O.id}`,P=H==null?void 0:H.titlesStr;return e(me,{"data-state-post-id":l,onMouseEnter:Ie,"data-spoiler-text":G||(W?u({id:"FKojeB"}):void 0),"data-filtered-text":H?u(P?{id:"7FGvtQ",values:{filterTitleStr:P}}:{id:"03Qqf9"}):void 0,class:`
media-post
${H?"filtered":""}
${ke?"has-spoiler":""}
${Me?"show-media":""}
`,children:e(Ms,{class:n,media:O,lang:q,to:`/${o}/s/${_}?media-only=${oe+1}`,onClick:r?ce=>r(ce,oe,O,s):void 0})},Le)})}const ns=ut(Rr);function Lr(n){var _,T,A,k,C;const{_:i}=le(),s=We(x),{masto:o,instance:c,authenticated:r}=re(),[u,l]=Ae(()=>{const E=ri();return[E.find(F=>F.info.id===kt())||E[0],E.length>1]},[]),d=(s.settings.shortcutsViewMode==="multi-column"||!s.settings.shortcutsViewMode&&s.settings.shortcutsColumnsMode)&&!s.shortcuts.find(E=>E.type==="following"),a=Is(()=>{x.showAccounts=!0},{threshold:600,detect:"touch",cancelOnMovement:!0}),h=j(),[p,m]=M(void 0),g=As([0,0,s.settings.shortcutsViewMode==="tab-menu-bar"?50:0,0]),v=j();async function y(E){return(E||!v.current)&&(v.current=o.v1.mutes.list({limit:80}).values()),await v.current.next()}const w=j();async function b(E){return(E||!w.current)&&(w.current=o.v1.blocks.list({limit:80}).values()),await w.current.next()}const S=j();return e(U,{children:[e("button",{ref:h,type:"button",class:`button plain nav-menu-button ${l?"with-avatar":""} ${p==="open"?"active":""}`,style:{position:"relative"},onClick:()=>{S.current=Date.now(),m(E=>E?void 0:"open")},onContextMenu:E=>{E.preventDefault(),x.showAccounts=!0},...a(),children:[l&&e(mt,{url:((_=u==null?void 0:u.info)==null?void 0:_.avatar)||((T=u==null?void 0:u.info)==null?void 0:T.avatarStatic),size:"l",squircle:(A=u==null?void 0:u.info)==null?void 0:A.bot}),e(I,{icon:"menu",size:l?"s":"l",alt:i({id:"zucql+"})})]}),e(pi,{menuClassName:"nav-menu",state:p,anchorRef:h,onClose:()=>{m(void 0)},containerProps:{style:{zIndex:10},onClick:()=>{Date.now()-S.current<300}},portal:{target:document.body},...n,overflow:"auto",viewScroll:"close",position:"anchor",align:"center",boundingBoxPadding:g,unmountOnClose:!0,children:[!!((k=s.appVersion)!=null&&k.commitHash)&&s.appVersion.commitHash!=="43d0d1e"&&e("div",{class:"top-menu",children:[e(ye,{onClick:()=>{confirm(i({id:"Djbaby"}))&&(async()=>{try{location.reload()}catch{}})()},children:[e(I,{icon:"sparkles",class:"sparkle-icon",size:"l"})," ",e("span",{children:e(f,{id:"95IFnD"})})]}),e(Ve,{})]}),e("section",{children:[e(je,{to:"/",children:[e(I,{icon:"home",size:"l"})," ",e("span",{children:e(f,{id:"i0qMbr"})})]}),r?e(U,{children:[d&&e(je,{to:"/following",children:[e(I,{icon:"following",size:"l"})," ",e("span",{children:e(f,{id:"following.title"})})]}),e(je,{to:"/catchup",children:[e(I,{icon:"history2",size:"l"}),e("span",{children:e(f,{id:"xrl8fj"})})]}),Je("@mastodon/mentions")&&e(je,{to:"/mentions",children:[e(I,{icon:"at",size:"l"})," ",e("span",{children:e(f,{id:"/bZzdR"})})]}),e(je,{to:"/notifications",children:[e(I,{icon:"notification",size:"l"})," ",e("span",{children:e(f,{id:"iDNBZe"})}),s.notificationsShowNew&&e("sup",{title:i({id:"isRobC"}),style:{opacity:.5},children:[" ","•"]})]}),e(Ve,{}),((C=u==null?void 0:u.info)==null?void 0:C.id)&&e(je,{to:`/${c}/a/${u.info.id}`,children:[e(I,{icon:"user",size:"l"})," ",e("span",{children:e(f,{id:"vERlcd"})})]}),e(Mr,{menuState:p}),e(je,{to:"/b",children:[e(I,{icon:"bookmark",size:"l"})," ",e("span",{children:e(f,{id:"7Ff7ia"})})]}),e(dn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(U,{children:[e(I,{icon:"more",size:"l"}),e("span",{class:"menu-grow",children:e(f,{id:"24misb"})}),e(I,{icon:"chevron-right"})]}),children:[e(je,{to:"/f",children:[e(I,{icon:"heart",size:"l"})," ",e("span",{children:e(f,{id:"zZOZj7"})})]}),e(je,{to:"/fh",children:[e(I,{icon:"hashtag",size:"l"})," ",e("span",{children:e(f,{id:"Xi1/bw"})})]}),e(je,{to:"/sp",children:[e(I,{icon:"schedule",size:"l"})," ",e("span",{children:e(f,{id:"+GkIdc"})})]}),e(Ve,{}),Je("@mastodon/filters")&&e(je,{to:"/ft",children:[e(I,{icon:"filters",size:"l"})," ",e("span",{children:e(f,{id:"cSev+j"})})]}),e(ye,{onClick:()=>{x.showGenericAccounts={id:"mute",heading:i({id:"sOKhEA"}),fetchAccounts:y,excludeRelationshipAttrs:["muting"]}},children:[e(I,{icon:"mute",size:"l"})," ",e("span",{children:e(f,{id:"n1sANU"})})]}),e(ye,{onClick:()=>{x.showGenericAccounts={id:"block",heading:i({id:"nL8nlr"}),fetchAccounts:b,excludeRelationshipAttrs:["blocking"]}},children:[e(I,{icon:"block",size:"l"})," ",e("span",{children:e(f,{id:"r3RRWo"})})]})," "]}),e(Ve,{}),e(ye,{onClick:()=>{x.showAccounts=!0},children:[e(I,{icon:"group",size:"l"})," ",e("span",{children:e(f,{id:"7e0O8Z"})})]})]}):e(U,{children:[e(Ve,{}),e(je,{to:"/login",children:[e(I,{icon:"user",size:"l"})," ",e("span",{children:e(f,{id:"sQia9P"})})]})]})]}),e("section",{children:[e(Ve,{}),e(je,{to:"/search",children:[e(I,{icon:"search",size:"l"})," ",e("span",{children:e(f,{id:"A1taO8"})})]}),e(je,{to:`/${c}/trending`,children:[e(I,{icon:"chart",size:"l"})," ",e("span",{children:e(f,{id:"4/iCqx"})})]}),e(je,{to:`/${c}/p/l`,children:[e(I,{icon:"building",size:"l"})," ",e("span",{children:e(f,{id:"d5zxa4"})})]}),e(je,{to:`/${c}/p`,children:[e(I,{icon:"earth",size:"l"})," ",e("span",{children:e(f,{id:"4ERYY7"})})]}),r?e(U,{children:[e(Ve,{className:"divider-grow"}),e(ye,{onClick:()=>{x.showKeyboardShortcutsHelp=!0},children:[e(I,{icon:"keyboard",size:"l"})," ",e("span",{children:e(f,{id:"77Emn0"})})]}),e(ye,{onClick:()=>{x.showShortcutsSettings=!0},children:[e(I,{icon:"shortcut",size:"l"})," ",e("span",{children:e(f,{id:"8Kudkr"})})]}),e(ye,{onClick:()=>{x.showSettings=!0},children:[e(I,{icon:"gear",size:"l"})," ",e("span",{children:e(f,{id:"uVbUP8"})})]})]}):e(U,{children:[e(Ve,{}),e(ye,{onClick:()=>{x.showSettings=!0},children:[e(I,{icon:"gear",size:"l"})," ",e("span",{children:e(f,{id:"uVbUP8"})})]})]})]})]})]})}function Mr({menuState:n}){const i=Je("@mastodon/lists"),[s,o]=M([]);return Q(()=>{i&&n==="open"&&hn().then(o)},[n,i]),s.length>0?e(dn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(U,{children:[e(I,{icon:"list",size:"l"}),e("span",{class:"menu-grow",children:e(f,{id:"h16FyT"})}),e(I,{icon:"chevron-right"})]}),children:[e(je,{to:"/l",children:e("span",{children:e(f,{id:"BHWx+g"})})}),(s==null?void 0:s.length)>0&&e(U,{children:[e(Ve,{}),s.map(c=>e(je,{to:`/l/${c.id}`,children:e("span",{children:[c.title,c.exclusive&&e(U,{children:[" ",e(Bt,{})]})]})},c.id))]})]}):i&&e(je,{to:"/l",children:[e(I,{icon:"list",size:"l"}),e("span",{children:e(f,{id:"h16FyT"})})]})}const $t=ut(Lr),fn={block:"start",inline:"center",behavior:"smooth"};function At({title:n,titleComponent:i,id:s,instance:o,emptyText:c,errorText:r,useItemID:u,boostsCarousel:l,fetchItems:d=()=>{},checkForUpdates:a=()=>{},checkForUpdatesInterval:h=15e3,headerStart:p,headerEnd:m,timelineStart:g,refresh:v,view:y,filterContext:w,showFollowedTags:b,showReplyParent:S,clearWhenRefresh:_}){const{_:T}=le(),A=We(x),[k,C]=M([]),[E,R]=M("start"),[F,D]=M(!1),[W,G]=M(!1),[X,q]=M(!0),Z=j();__BENCHMARK.start(`timeline-${s}-load`);const B=Ae(()=>ui(),[]),ee=y!=="media",$=j(0),K=ec(H=>{G(!1),R("loading"),(async()=>{try{const ke=$.current=Date.now();let{done:De,value:xe}=await d(H);if(ke!==$.current)return;if(Array.isArray(xe)){const[Me,me]=xe.reduce((N,O)=>(O._pinned?N[0].push(O):N[1].push(O),N),[[],[]]);xe=me,ee&&(l&&(xe=Cr(xe)),xe=Ir(xe,o)),Me.length&&(xe=Me.concat(xe)),C(H?xe:N=>[...N,...xe]),xe.length||(De=!0),D(!De)}else D(!1);R("default"),__BENCHMARK.end(`timeline-${s}-load`)}catch{R("error"),H&&!k.length&&r&&fe(r)}finally{K.cancel()}})()},1e3,{leading:!0}),Y=".timeline-item, .timeline-item-alt",te=qe("j, shift+j",(H,ke)=>{if(H.shiftKey!==ke.shift)return;const De=document.activeElement.closest(Y),xe=De==null?void 0:De.getBoundingClientRect(),Me=Array.from(Z.current.querySelectorAll(Y)).filter(me=>!!me.offsetHeight);if(De&&xe.top<Z.current.clientHeight&&xe.bottom>0){const me=Me.indexOf(De);let N=Me[me+1];ke.shift&&(N=Me.find((O,oe)=>oe>me&&!O.classList.contains("timeline-item-alt"))),N&&(N.focus(),N.scrollIntoView(fn))}else{const me=Me.find(N=>{const O=N.getBoundingClientRect();return O.top>=44&&O.left>=0});me&&(me.focus(),me.scrollIntoView(fn))}},{useKey:!0,ignoreEventWhen:H=>H.metaKey||H.ctrlKey||H.altKey}),J=qe("k, shift+k",(H,ke)=>{if(H.shiftKey!==ke.shift)return;const De=document.activeElement.closest(Y),xe=De==null?void 0:De.getBoundingClientRect(),Me=Array.from(Z.current.querySelectorAll(Y)).filter(me=>!!me.offsetHeight);if(De&&xe.top<Z.current.clientHeight&&xe.bottom>0){const me=Me.indexOf(De);let N=Me[me-1];ke.shift&&(N=Me.findLast((O,oe)=>oe<me&&!O.classList.contains("timeline-item-alt"))),N&&(N.focus(),N.scrollIntoView(fn))}else{const me=Me.find(N=>{const O=N.getBoundingClientRect();return O.top>=44&&O.left>=0});me&&(me.focus(),me.scrollIntoView(fn))}},{useKey:!0,ignoreEventWhen:H=>H.metaKey||H.ctrlKey||H.altKey}),ue=qe(["enter","o"],()=>{const H=document.activeElement;H!=null&&H.matches(Y)&&H.click()},{useKey:!0,ignoreEventWhen:H=>H.metaKey||H.ctrlKey||H.altKey||H.shiftKey}),he=k.length>0&&E!=="loading"&&W,ne=it(()=>{var H;he&&K(!0),(H=Z.current)==null||H.scrollTo({top:0,behavior:"smooth"})},[K,he]),we=qe(".",ne,{useKey:!0,ignoreEventWhen:H=>H.metaKey||H.ctrlKey||H.altKey||H.shiftKey}),Ce=j(),[se,Te]=M(!1);Er({scrollableRef:Z,distanceFromEnd:2,scrollThresholdStart:44},({scrollDirection:H,nearReachStart:ke,reachStart:De})=>{if(Ce.current){const xe=H==="end"&&!ke;Ce.current.hidden=xe}Te(ke),De&&K(!0)},[]),Q(()=>{var H;(H=Z.current)==null||H.scrollTo({top:0}),K(!0)},[]);const Ie=j(!0);Q(()=>{var H;if(Ie.current){Ie.current=!1;return}_&&(k!=null&&k.length)&&((H=K.cancel)==null||H.call(K),C([])),K(!0)},[_,v]);const Pe=j(y);Q(()=>{Pe.current!==y&&(Pe.current=y,C([]))},[y]);const $e=it(async({disableIdleCheck:H=!1}={})=>{const ke=Z.current?getComputedStyle(Z.current).pointerEvents==="none":!1;A.settings.autoRefresh&&Z.current.scrollTop<16&&(H||window.__IDLE__)&&!Dr()&&!ke?K(!0):await a()&&G(!0)},[s,K,a,A.settings.autoRefresh]),Ee=j();return Gt(H=>{if(H){const ke=Date.now()-Ee.current;(!Ee.current||ke>1e3*3)&&$e({disableIdleCheck:!0})}else Ee.current=Date.now();q(H)},[a,$e,A.settings.autoRefresh]),fi($e,X&&!W?h*(se?1:2):null),e(Dn.Provider,{value:w,children:e("div",{id:`${s}-page`,class:`deck-container ${B?"deck-container-media-first":""}`,ref:H=>{Z.current=H,te.current=H,J.current=H,ue.current=H,we.current=H},tabIndex:"-1",onClick:H=>{Ce.current&&H.target.closest(".timeline-item, .timeline-item-alt")&&setTimeout(()=>{Ce.current.hidden=!1},250)},children:e("div",{class:"timeline-deck deck",children:[e("header",{ref:Ce,onClick:H=>{var ke;H.target.closest("a, button")||(ke=Z.current)==null||ke.scrollTo({top:0,behavior:"smooth"})},onDblClick:H=>{H.target.closest("a, button")||K(!0)},class:E==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e($t,{}),p??e(ge,{to:"/",class:"button plain home-button",children:e(I,{icon:"home",size:"l",alt:T({id:"i0qMbr"})})})]}),n&&(i||e("h1",{children:n})),e("div",{class:"header-side",children:!!m&&m})]}),he&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:ne,children:[e(I,{icon:"arrow-up"})," ",e(f,{id:"2yr1/p"})]})]}),!!g&&e("div",{class:`timeline-start ${E==="loading"?"loading":""}`,children:g}),k.length?e(U,{children:[e("ul",{class:`timeline ${y?`timeline-${y}`:""}`,children:[k.map(H=>e($r,{status:H,instance:o,useItemID:u,filterContext:w,view:y,showFollowedTags:b,showReplyParent:S,mediaFirst:B},H.id+(H==null?void 0:H._pinned)+y)),F&&E==="loading"&&(y==="media"?null:e(U,{children:[e("li",{style:{height:"20vh"},children:e(Ge,{skeleton:!0,mediaFirst:B})}),e("li",{style:{height:"25vh"},children:e(Ge,{skeleton:!0,mediaFirst:B})})]}))]}),E==="default"&&(F?e(Tt,{root:Z.current,rootMargin:`0px 0px ${screen.height*1.5}px 0px`,onChange:H=>{H&&K()},children:e("button",{type:"button",class:"plain block",onClick:()=>K(),style:{marginBlockEnd:"6em"},children:e(f,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(f,{id:"2EYeAZ"})}))]}):E==="loading"?e("ul",{class:"timeline",children:Array.from({length:5}).map((H,ke)=>y==="media"?e("div",{style:{height:"50vh"}}):e("li",{children:e(Ge,{skeleton:!0,mediaFirst:B})},ke))}):E!=="error"&&E!=="start"&&e("p",{class:"ui-state",children:c}),E==="error"&&e("p",{class:"ui-state",children:[r,e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>K(!k.length),children:e(f,{id:"KDw4GX"})})]})]})})})}const $r=ut(({status:n,instance:i,useItemID:s,filterContext:o,view:c,showFollowedTags:r,showReplyParent:u,mediaFirst:l})=>{const{_:d}=le(),{id:a,reblog:h,items:p,type:m,_pinned:g}=n;g&&(s=!1);const v=(h==null?void 0:h.id)||a,y=i?`/${i}/s/${v}`:`/s/${v}`;if(p){let b=zt(p,o),S="";if(m==="boosts"?S=pe._({id:"NuqppG",values:{0:b.length}}):m==="pinned"&&(S=d({id:"GlfmCu"})),m==="boosts"||m==="pinned"){const A=new Set;if(b.sort((k,C)=>{const E=Vt(k.filtered,o),R=Vt(C.filtered,o);return E&&(E==null?void 0:E.action)!=="blur"&&A.add(k.id),R&&(R==null?void 0:R.action)!=="blur"&&A.add(C.id),E&&!R?1:!E&&R?-1:0}),A.size>=2){const C=[],E=[];b.forEach(F=>{A.has(F.id)?E.push(F):C.push(F)});const R=[];for(let F=0;F<E.length;F+=5)R.push({_grouped:!0,posts:E.slice(F,F+5)});b=C.concat(R)}return e("li",{class:"timeline-item-carousel",children:e(Nr,{title:S,class:`${m}-carousel`,children:b.map(k=>{const{id:C,reblog:E,_pinned:R,_grouped:F}=k;if(F)return e("li",{class:"timeline-item-carousel-group",children:k.posts.map(G=>{const{id:X,reblog:q,_pinned:Z}=G,B=(q==null?void 0:q.id)||X,ee=i?`/${i}/s/${B}`:`/s/${B}`;return Z&&(s=!1),e(ge,{class:"status-carousel-link timeline-item-alt",to:ee,children:s?e(Ge,{statusID:X,instance:i,size:"s"}):e(Ge,{status:G,instance:i,size:"s"})})})},C);const D=(E==null?void 0:E.id)||C,W=i?`/${i}/s/${D}`:`/s/${D}`;return R&&(s=!1),e("li",{children:e(ge,{class:"status-carousel-link timeline-item-alt",to:W,children:s?e(Ge,{statusID:C,instance:i,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:l}):e(Ge,{status:k,instance:i,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:l})})},C)})})},`timeline-${a}`)}const T=b.length>3;return b.map((A,k)=>{const{id:C,_differentAuthor:E}=A,R=i?`/${i}/s/${C}`:`/s/${C}`,F=k>0&&k<b.length-1,D=A.sensitive&&!!A.spoilerText,W=!E&&D&&k>0||T&&F&&(m==="thread"||m==="conversation"&&!E&&!b[k-1]._differentAuthor&&!b[k+1]._differentAuthor),G=k===0,X=k===b.length-1;return e("li",{class:`timeline-item-container timeline-item-container-type-${m} timeline-item-container-${G?"start":X?"end":"middle"} ${E?"timeline-item-diff-author":""}`,children:e(ge,{class:"status-link timeline-item",to:R,children:W?e(Pr,{status:A,instance:i,filterContext:o}):s?e(Ge,{statusID:C,instance:i,enableCommentHint:X,showFollowedTags:r}):e(Ge,{status:A,instance:i,enableCommentHint:X,showFollowedTags:r})})},`timeline-${C}`)})}const w=`timeline-${a+g}`;return c==="media"?s?e(ns,{class:"timeline-item",parent:"li",statusID:a,instance:i},w):e(ns,{class:"timeline-item",parent:"li",status:n,instance:i},w):e("li",{children:e(ge,{class:"status-link timeline-item",to:y,children:s?e(Ge,{statusID:a,instance:i,enableCommentHint:!0,showFollowedTags:r,showReplyParent:u,mediaFirst:l}):e(Ge,{status:n,instance:i,enableCommentHint:!0,showFollowedTags:r,showReplyParent:u,mediaFirst:l})})},w)},(n,i)=>{var c,r;const s=(((c=n.status)==null?void 0:c.id)||"").toString(),o=(((r=i.status)==null?void 0:r.id)||"").toString();return s===o&&n.instance===i.instance&&n.view===i.view});function Nr({title:n,class:i,children:s}){const{_:o}=le(),c=j(),r=j(),u=j(),[l,d]=M(!1);return Q(()=>{setTimeout(()=>{d(!0)},1)},[]),e("div",{class:`status-carousel ${i}`,children:[e("header",{children:[e("h3",{children:n}),e("span",{children:[e("button",{ref:r,type:"button",class:"small plain2",onClick:()=>{var h,p;const a=Math.min(320,(h=c.current)==null?void 0:h.offsetWidth)*(Ot()?1:-1);(p=c.current)==null||p.scrollBy({left:a,behavior:"smooth"})},children:e(I,{icon:"chevron-left",alt:o({id:"DHhJ7s"})})})," ",e("button",{ref:u,type:"button",class:"small plain2",onClick:()=>{var h,p;const a=Math.min(320,(h=c.current)==null?void 0:h.offsetWidth)*(Ot()?-1:1);(p=c.current)==null||p.scrollBy({left:a,behavior:"smooth"})},children:e(I,{icon:"chevron-right",alt:o({id:"hXzOVo"})})})]})]}),e("ul",{ref:c,children:[e(Tt,{class:"status-carousel-beacon",onChange:a=>{r.current&&(r.current.disabled=a)}}),s[0],l&&s.slice(1),e(Tt,{class:"status-carousel-beacon",onChange:a=>{u.current&&(u.current.disabled=a)}})]})]})}function Pr({status:n,instance:i,filterContext:s}){const{_:o}=le(),c=We(x),{id:r,visibility:u,language:l}=n,d=Nn(n),a=lt(r,i),h=Vt(n.filtered,s);return e("article",{class:`status compact-thread ${u==="direct"?"visibility-direct":""}`,tabindex:"-1",children:[c.statusThreadNumber[a]?e("div",{class:"status-thread-badge",children:[e(I,{icon:"thread",size:"s",alt:o({id:"e66y2Z"})}),c.statusThreadNumber[a]?` ${c.statusThreadNumber[a]}/X`:""]}):e("div",{class:"status-thread-badge",children:e(I,{icon:"thread",size:"s",alt:o({id:"e66y2Z"})})}),e("div",{class:"content-compact",title:d,lang:l,dir:"auto",children:h&&(h==null?void 0:h.action)!=="blur"?e("b",{class:"status-filtered-badge badge-meta horizontal",title:(h==null?void 0:h.titlesStr)||"",children:h!=null&&h.titlesStr?e(f,{id:"sr6maL",values:{0:h.titlesStr},components:{0:e("span",{}),1:e("span",{})}}):e("span",{children:e(f,{id:"03Qqf9"})})}):e(U,{children:[d,n.sensitive&&n.spoilerText&&e(U,{children:[" ",e("span",{class:"spoiler-badge",children:e(I,{icon:"eye-close",size:"s",alt:o({id:"gnKo7f"})})})]})]})})]})}function Dr(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}const qt=20,Ei=1983,is=`${Ei}-01`,Or=(()=>{try{const n=document.createElement("input");return n.setAttribute("type","month"),n.type==="month"}catch{return!1}})();async function zr(n){var o;const{masto:i}=re({instance:n}),s=await i.v2.search.list({q:"from:me",type:"statuses",limit:1});return!!((o=s==null?void 0:s.statuses)!=null&&o.length)}const Ur=bt(zr);function Br(){const{i18n:n,_:i}=le(),s=We(x),{id:o,...c}=Mt(),[r,u]=vt(),l=r.get("month"),d=!r.get("replies"),a=!!r.get("boosts"),h=r.get("tagged"),p=!!r.get("media"),{masto:m,instance:g,authenticated:v}=re({instance:c.instance}),{masto:y,instance:w}=re(),b=j(),S=[l,d,a,h,p],[_,T]=M(),A=j(0);Q(()=>{A.current=0},S);const k=Ae(()=>ui(),[]),C=Ae(()=>g===w,[g,w]),[E,R]=M(!1);Q(()=>{C&&_!=null&&_.acct&&(async()=>{const J=await Ur(g);R(J)})()},[g,C,_==null?void 0:_.acct]);async function F(J){var se,Te,Ie,Pe;const ue=/^\d{4}-[01]\d$/.test(l),he=((Te=(se=l==null?void 0:l.split)==null?void 0:se.call(l,"-"))==null?void 0:Te[0])>=Ei;if(ue&&he){if(!_)return{value:[],done:!0};const[$e,Ee]=l.split("-"),H=parseInt(Ee,10)-1,ke=new Date($e,H,0),De=`${ke.getFullYear()}-${(ke.getMonth()+1).toString().padStart(2,"0")}-${ke.getDate().toString().padStart(2,"0")}`,xe=new Date($e,H+1,1),Me=`${xe.getFullYear()}-${(xe.getMonth()+1).toString().padStart(2,"0")}-${xe.getDate().toString().padStart(2,"0")}`;let me;J?(me=qt+1,A.current=0):(me=qt+A.current+1,A.current+=qt);const N=await m.v2.search.list({q:`from:${_.acct} after:${De} before:${Me}`,type:"statuses",limit:me,offset:A.current});if((Ie=N==null?void 0:N.statuses)!=null&&Ie.length){const O=N.statuses.slice(0,qt);O.forEach(Le=>{et(Le,g)});const oe=N.statuses.length<=qt;return{value:O,done:oe}}else return{value:[],done:!0}}let ne=[];if(J){const{value:$e}=await m.v1.accounts.$select(o).statuses.list({pinned:!0}).values().next();if($e!=null&&$e.length&&!h&&!p){const Ee=$e.map(H=>(et(H,g),{...H,_pinned:!0}));if(Ee.length>=3){const H=Ee.map(ke=>ke.id);ne.push({id:H,items:Ee,type:"pinned"})}else ne.push(...Ee)}}(J||!b.current)&&(b.current=m.v1.accounts.$select(o).statuses.list({limit:qt,exclude_replies:d,exclude_reblogs:a,only_media:p||void 0,tagged:h}).values());const{value:we,done:Ce}=await b.current.next();if(we!=null&&we.length){if(ne.length){let $e=[];((Pe=ne[0])==null?void 0:Pe.type)==="pinned"?$e=ne[0].id:$e=ne.filter(H=>H._pinned).map(H=>H.id),$e.every(H=>we.some(ke=>ke.id===H))&&(ne=[])}ne.push(...we),we.forEach($e=>{et($e,g)})}return{value:ne,done:Ce}}const[D,W]=M([]);let G=i({id:"/cKnpj"});if(_!=null&&_.acct){const J=(/@/.test(_.acct)?"":"@")+_.acct,ue=_!=null&&_.displayName?`${_.displayName} (${J})`:`${J}`;if(!d)G=i({id:"hS1Opy",values:{accountDisplay:ue}});else if(a)G=i({id:"A/CX5F",values:{accountDisplay:ue}});else if(h)G=i({id:"QQrO94",values:{accountDisplay:ue,tagged:h}});else if(p)G=i({id:"NoG5wD",values:{accountDisplay:ue}});else if(l){const he=new Date(l).toLocaleString(n.locale,{month:"long",year:"numeric"});G=i({id:"8GjLvB",values:{accountDisplay:ue,monthYear:he}})}else G=ue}tt(G,"/:instance?/a/:id");const X=it(()=>Hr(o,m),[o,m]);Q(()=>{(async()=>{try{const J=await X();T(J)}catch{}if(!k)try{const J=await m.v1.accounts.$select(o).featuredTags.list();W(J)}catch{}})()},[o,k]);const{displayName:q,acct:Z,emojis:B}=_||{},ee=j(),$=Ae(()=>{const J=!d||a||h||p||!!l,ue=s.accounts[`${o}@${g}`];return e(U,{children:[e(Gs,{instance:g,account:ue||o,fetchAccount:X,authenticated:v,standalone:!0,showEndorsements:!0}),!k&&e("div",{class:"filter-bar",ref:ee,style:{position:"relative"},children:[J?e(ge,{to:`/${g}/a/${o}`,class:"insignificant filter-clear",title:i({id:"u8JHrO"}),children:e(I,{icon:"x",size:"l",alt:i({id:"xCJdfg"})})},"clear-filters"):e(I,{icon:"filter",class:"insignificant",size:"l",alt:i({id:"cSev+j"})}),e(ge,{to:`/${g}/a/${o}${d?"?replies=1":""}`,onClick:()=>{d&&fe(i({id:"PIWNSQ"}))},class:d?"":"is-active",children:e(f,{id:"5BFynH"})}),e(ge,{to:`/${g}/a/${o}${a?"":"?boosts=0"}`,onClick:()=>{a||fe(i({id:"Qd13i0"}))},class:a?"is-active":"",children:e(f,{id:"usxQx0"})}),e(ge,{to:`/${g}/a/${o}${p?"":"?media=1"}`,onClick:()=>{p||fe(i({id:"rKpfPY"}))},class:p?"is-active":"",children:e(f,{id:"xYilR2"})}),D.map(he=>e(ge,{to:`/${g}/a/${o}${h===he.name?"":`?tagged=${encodeURIComponent(he.name)}`}`,onClick:()=>{h!==he.name&&fe(i({id:"L+HFfr",values:{0:he.name}}))},class:h===he.name?"is-active":"",children:e("span",{children:[e("span",{class:"more-insignificant",children:"#"}),he.name]})},he.id)),E&&(Or?e("label",{class:`filter-field ${l?"is-active":""}`,children:[e(I,{icon:"month",size:"l"}),e("input",{type:"month",disabled:!(_!=null&&_.acct),value:l||"",min:is,max:new Date().toISOString().slice(0,7),onInput:he=>{const{value:ne,validity:we}=he.currentTarget;if(!we.valid)return;u(ne?{month:ne}:{});const[Ce,se]=ne.split("-"),Te=parseInt(se,10)-1,Ie=new Date(Ce,Te);fe(i({id:"0WUFGD",values:{0:Ie.toLocaleString(n.locale,{month:"long",year:"numeric"})}}))}})]}):e(Fr,{class:`filter-field ${l?"is-active":""}`,disabled:!(_!=null&&_.acct),value:l||"",min:is,max:new Date().toISOString().slice(0,7),onInput:he=>{const{value:ne,validity:we}=he;we.valid&&u(ne?{month:ne}:{})}}))]})]})},[o,g,v,D,X,E,...S]);Q(()=>{var ue;const J=(ue=ee.current)==null?void 0:ue.querySelector(".is-active");J&&ee.current.scrollTo({behavior:"smooth",left:J.offsetLeft-(ee.current.offsetWidth-J.offsetWidth)/2})},[D,E,...S]);const K=Ae(()=>{var ue;return _!=null&&_.url?(ue=URL.parse(_.url))==null?void 0:ue.hostname:null},[_]),te=!!_&&!(g===K);return e(U,{children:[e(At,{title:`${_!=null&&_.acct?"@"+_.acct:i({id:"+owNNn"})}`,titleComponent:e("h1",{class:"header-double-lines header-account",children:[e("b",{children:e(Rs,{text:q,emojis:B})}),e("div",{children:e("span",{class:"bidi-isolate",children:["@",Z]})})]}),id:"account-statuses",instance:g,emptyText:i({id:"+k97fV"}),errorText:i({id:"scd9lw"}),fetchItems:F,useItemID:!0,view:p||k?"media":void 0,boostsCarousel:s.settings.boostsCarousel,timelineStart:$,refresh:[d,a,h,p,l+(_==null?void 0:_.acct)].toString(),headerEnd:e(dt,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(I,{icon:"more",size:"l",alt:i({id:"2FYpfJ"})})}),children:[e(ye,{disabled:!te,onClick:()=>{(async()=>{try{const{masto:J}=re({instance:K}),ue=await J.v1.accounts.lookup({acct:_.acct}),{id:he}=ue;location.hash=`/${K}/a/${he}`}catch{alert(i({id:"FgdLx0"}))}})()},children:[e(I,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:e(f,{id:"/JFxxT",values:{0:K?e(U,{children:[" ","(",e("b",{children:un.toUnicode(K)}),")"]}):null}})})]}),!C&&e(ye,{onClick:()=>{(async()=>{try{const J=await y.v1.accounts.lookup({acct:_.acct+"@"+g}),{id:ue}=J;location.hash=`/${w}/a/${ue}`}catch{alert(i({id:"FgdLx0"}))}})()},children:[e(I,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:e(f,{id:"HkuyOu",values:{currentInstance:w},components:{0:e("b",{})}})})]})]})},o),Z&&e("data",{class:"compose-data",value:JSON.stringify({draftStatus:{status:`@${Z} `}})})]})}function Fr(n){const{i18n:i}=le(),{class:s,disabled:o,value:c,min:r,max:u,onInput:l=()=>{}}=n,[d,a]=(c==null?void 0:c.split("-"))||[],h=j(),p=j(),m=(g,v)=>{const[y,w]=(r==null?void 0:r.split("-"))||[],[b,S]=(u==null?void 0:u.split("-"))||[];return!(v<y||v>b||v===y&&g<w||v===b&&g>S)};return e("div",{class:s,children:[e(I,{icon:"month",size:"l"}),e("select",{ref:h,disabled:o,value:a||"",onInput:g=>{const{value:v}=g.currentTarget,y=p.current.value;if(!m(v,y))return{value:"",validity:{valid:!1}};l({value:v?`${y}-${v}`:"",validity:{valid:!0}})},children:[e("option",{value:"",children:e(f,{id:"HajiZl"})}),e("option",{disabled:!0,children:"-----"}),Array.from({length:12},(g,v)=>e("option",{value:(v+1).toString().padStart(2,"0"),children:new Date(0,v).toLocaleString(i.locale,{month:"long"})},v))]})," ",e("input",{ref:p,type:"number",disabled:o,value:d||new Date().getFullYear(),min:(r==null?void 0:r.slice(0,4))||Ei,max:(u==null?void 0:u.slice(0,4))||new Date().getFullYear(),onInput:g=>{const{value:v,validity:y}=g.currentTarget,w=h.current.value;if(!y.valid||!m(w,v))return{value:"",validity:{valid:!1}};l({value:v?`${v}-${w}`:"",validity:{valid:!0}})},style:{width:"4.5em"}})]})}function Kr(n,i){return i.v1.accounts.$select(n).fetch()}const Hr=bt(Kr,{maxAge:30*60*1e3});function qr(){var g;const n=Mt(),{year:i}=n;tt(i?`Annual Report: ${i}`:"Annual Report");const{masto:s,instance:o}=re(),[c,r]=M(null),[u,l]=M("default");Q(()=>{i&&(async()=>{l("loading");const v=await s.v1.annualReports.$select(i).fetch();r(v),l("default")})()},[i]);const{accounts:d,annualReports:a,statuses:h}=c||{},p=(g=a==null?void 0:a.find(v=>v.year==i))==null?void 0:g.data,m=new Date;return e("div",{id:"annual-report-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"report",children:[e("h1",{children:[i," #Wrapstodon"]}),u==="loading"&&e("p",{children:[e(Be,{abrupt:!0})," ",e(f,{id:"Pwqkdw"})]}),!!p&&e("dl",{children:Object.entries(p).map(([v,y])=>e(U,{children:[e("dt",{children:v}),e("dd",{class:`report-${v}`,children:Array.isArray(y)?e("table",{children:[e("thead",{children:e("tr",{children:Object.entries(y[0]).map(([w,b])=>e("th",{class:w!=="month"&&typeof b=="number"?"number":"",children:w}))})}),e("tbody",{children:y.map(w=>e("tr",{children:Object.entries(w).map(([b,S])=>e("td",{class:b!=="month"&&typeof S=="number"?"number":"",children:S&&/(accountId)/i.test(b)&&/^(mostRebloggedAccounts|commonlyInteractedWithAccounts)$/i.test(v)?e(yt,{account:d==null?void 0:d.find(_=>_.id===S),showAvatar:!0}):b==="month"?m.setMonth(S-1)&&m.toLocaleString(void 0,{month:"long"}):typeof S=="number"?S.toLocaleString():S}))}))})]}):typeof y=="object"?/^(topStatuses)$/i.test(v)?e("dl",{children:Object.entries(y).map(([w,b])=>e(U,{children:[e("dt",{children:w}),e("dd",{children:b&&e(ge,{to:`/${o}/s/${b}`,children:e(Ge,{status:h==null?void 0:h.find(S=>S.id===b),size:"s",readOnly:!0})})})]}))}):e("table",{children:e("tbody",{children:Object.entries(y).map(([w,b])=>e("tr",{children:[e("th",{children:w}),e("td",{class:typeof b=="number"?"number":"",children:b})]}))})}):typeof y=="string"?y:JSON.stringify(y,null,2)})]}))})]}),e("hr",{}),e("p",{style:{textAlign:"center"},children:e(ge,{to:"/",children:e(f,{id:"iWpEwy"})})})]})}const Yr=20;function to(){const{_:n}=le();tt(n({id:"7Ff7ia"}),"/bookmarks");const{masto:i,instance:s}=re(),o=j();async function c(r){return(r||!o.current)&&(o.current=i.v1.bookmarks.list({limit:Yr}).values()),await o.current.next()}return e(At,{title:n({id:"7Ff7ia"}),id:"bookmarks",emptyText:n({id:"8k2w6G"}),errorText:n({id:"UoL+FC"}),instance:s,fetchItems:c})}const jr=""+new URL("catch-up-O5q5C75Z.png",import.meta.url).href,Vr="home",ht=[{label:{id:"Ov9hfp"},value:1},{label:{id:"tVE2wM"},value:2},{label:{id:"8+HOWa"},value:3},{label:{id:"1o+mEC"},value:4},{label:{id:"dZZ8oA"},value:5},{label:{id:"lpPucp"},value:6},{label:{id:"r9r5X6"},value:7},{label:{id:"I9uBFA"},value:8},{label:{id:"pBYFlb"},value:9},{label:{id:"wvL7OJ"},value:10},{label:{id:"7Vb+qD"},value:11},{label:{id:"VU1Pnd"},value:12},{label:{id:"vpc27K"},value:13}],Gr={original:{id:"HxF6Fk"},replies:{id:"N8UzTV"},boosts:{id:"puY2t0"},followedTags:{id:"lCLRBe"},groups:{id:"zhrjek"},filtered:{id:"03Qqf9"}},Wr=["createdAt","repliesCount","favouritesCount","reblogsCount","density"],Zr=[null,"account"],Xr=Ss(n=>new Intl.DateTimeFormat(n||void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"}));function Jr(){const{i18n:n,_:i,_:s}=le(),o=Xr(n.locale);tt("Catch-up","/catchup");const{masto:c,instance:r}=re(),[u,l]=vt(),d=u.get("id"),[a,h]=M("start"),[p,m]=M(!1),g=Ae(()=>kt(),[]),v=L=>L===g,y=Je("@pixelfed/home-include-reblogs");async function w({maxCreatedAt:L}){var be,ve,_e;const V=L?new Date(L):null,ae=[],ie=c.v1.timelines.home.list({limit:40}),z=ie.values();e:for(;;)try{y&&ie.params&&(typeof ie.params=="string"?ie.params+="&include_reblogs=true":ie.params.include_reblogs=!0);const Ze=await z.next(),{value:Fe}=Ze;if(Fe!=null&&Fe.length){await eo(Fe,r);let de=!1;for(let ze=0;ze<Fe.length;ze++){const Ke=Fe[ze],nt=new Date(Ke.createdAt);if(!V||nt>=V){const He=!v(((ve=(be=Ke.reblog)==null?void 0:be.account)==null?void 0:ve.id)||Ke.account.id)&&Vt(((_e=Ke.reblog)==null?void 0:_e.filtered)||Ke.filtered,Vr);if((He==null?void 0:He.action)==="hide")continue;Ke._filtered=He;const at=lt(Ke.id,r);Ke._followedTags=x.statusFollowedTags[at]?[...x.statusFollowedTags[at]]:[],ae.push(Ke),de=!0}if(!de)break e}}else break e;await new Promise(de=>setTimeout(de,1e3))}catch{break e}return ae.forEach(Ze=>{if(Ze!=null&&Ze.inReplyToId){const Fe=ae.find(de=>de.id===Ze.inReplyToId);Fe&&!Fe.inReplyToId&&(Fe._thread=!0)}}),ae}const[b,S]=M([]),_=j(),T=j(),A=Ae(()=>An(),[]),k=it(async({duration:L}={})=>{const V=Date.now(),ae=L?V-L:null;h("loading");const ie=await w({maxCreatedAt:ae}),z=`${A}-${tc()}`;try{await gt.catchup.set(z,{id:z,posts:ie,count:ie.length,startAt:ae,endAt:V}),l({id:z})}catch{}},[]);Q(()=>{d?(async()=>{const L=await gt.catchup.get(d);L&&(L.posts.sort((V,ae)=>V.createdAt>ae.createdAt?1:-1),S(L.posts),h("results"))})():a==="results"&&(S([]),h("start"))},[d]);const[C,E]=Lt(L=>L+1,0),[R,F]=M(null),[D,W]=M([]);Q(()=>{(async()=>{try{const L=await gt.catchup.keys();if(L.length){const V=An(),ae=L.filter(ie=>ie.startsWith(`${V}-`));if(ae.length){let ie=await gt.catchup.getMany(ae);ie.sort((_e,Ze)=>Ze.endAt-_e.endAt);let z=ie.slice(0,3),be=ie.slice(3);const ve=z.map(_e=>{const{id:Ze,count:Fe,startAt:de,endAt:ze}=_e;return{id:Ze,count:Fe,startAt:de,endAt:ze}});W(ve),F(z[0].endAt),ie=null,z=null,queueMicrotask(()=>{be.length&&gt.catchup.delMany(be.map(_e=>_e.id)).then(()=>{be=null}).catch(_e=>{})});return}}}catch{}W([])})()},[C]),Q(()=>{a==="start"&&E()},[a==="start"]);const[G,X]=Ae(()=>{var Ze,Fe,de,ze,Ke,nt;let L=0,V=0,ae=0,ie=0,z=0,be=0;const ve={};for(const Re of b){Re._filtered&&((Ze=Re._filtered)==null?void 0:Ze.action)!=="blur"?(L++,Re.__FILTER="filtered"):Re.group?(V++,Re.__FILTER="groups"):Re.reblog?(ae++,Re.__FILTER="boosts"):(Fe=Re._followedTags)!=null&&Fe.length?(z++,Re.__FILTER="followedTags"):Re.inReplyToId&&Re.inReplyToAccountId!==((de=Re.account)==null?void 0:de.id)?(ie++,Re.__FILTER="replies"):(be++,Re.__FILTER="original");const He=Re.reblog||Re;if(Re.__FILTER!=="filtered"&&((ze=He.card)!=null&&ze.url)&&((Ke=He.card)!=null&&Ke.image)&&((nt=He.card)==null?void 0:nt.type)==="link"){const{card:at,favouritesCount:Nt,reblogsCount:Pt}=He;let{url:st}=at;if(st=st.replace(/\/$/,""),!ve[st])ve[st]={postID:He.id,card:at,shared:1,sharers:[Re.account],likes:Nt,boosts:Pt};else{if(ve[st].sharers.find(Fn=>Fn.id===Re.account.id))continue;ve[st].shared++,ve[st].sharers.push(Re.account),ve[st].postID!==He.id&&(ve[st].likes+=Nt,ve[st].boosts+=Pt)}}}let _e=[];for(const Re in ve)_e.push({url:Re,...ve[Re]});if(_e.sort((Re,He)=>Re.shared>He.shared?-1:Re.shared<He.shared?1:Re.boosts>He.boosts?-1:Re.boosts<He.boosts?1:Re.likes>He.likes?-1:Re.likes<He.likes?1:0),_e.length>10)e:for(let Re=10;Re<_e.length;Re++){const{shared:He}=_e[Re];if(He<=1){_e=_e.slice(0,Re);break e}}return[{filtered:L,groups:V,boosts:ae,replies:ie,followedTags:z,original:be},_e]},[b]),[q,Z]=M("all"),[B,ee]=M(null),[$,K]=M(1),[Y,te]=M("createdAt"),[J,ue]=M("asc"),[he,ne]=M(null),[we,Ce,se]=Ae(()=>{const L={},V=new Map;let ae=b.filter(z=>{const be=q==="all"||z.__FILTER===q;return be&&(L[z.account.id]=z.account,V.set(z.account.id,(V.get(z.account.id)||0)+1)),be});const ie={};return ae.forEach(z=>{z.reblog&&(ie[z.reblog.id]?(ie[z.reblog.id].__BOOSTERS?ie[z.reblog.id].__BOOSTERS.add(z.account):ie[z.reblog.id].__BOOSTERS=new Set([z.account]),z.__HIDDEN=!0):ie[z.reblog.id]=z)}),B&&V.has(B)&&(ae=ae.filter(z=>z.account.id===B||[...z.__BOOSTERS||[]].find(be=>be.id===B))),[ae,L,Object.fromEntries(V)]},[q,B,b]),Te=Ae(()=>{const L={};return we.forEach(V=>{L[V.id]=V}),L},[we]),Ie=Ae(()=>Object.keys(se).sort((L,V)=>se[V]-se[L]),[se]),Pe=Ae(()=>{const L={};return Ie.forEach((V,ae)=>{L[V]=ae}),we.filter(V=>!V.__HIDDEN).sort((V,ae)=>{if(he==="account"){const ie=V.account.id,z=ae.account.id,be=L[ie],ve=L[z],_e=be-ve;if(_e!==0)return _e}if(Y!=="createdAt"&&(V=V.reblog||V,ae=ae.reblog||ae,Y!=="density"&&V[Y]===ae[Y]))return V.createdAt>ae.createdAt?1:-1;if(Y==="density"){const ie=ss(V),z=ss(ae);return J==="asc"?ie>z?1:-1:z>ie?1:-1}return J==="asc"?V[Y]>ae[Y]?1:-1:ae[Y]>V[Y]?1:-1})},[we,Y,J,he,Ie]),$e=j(null),Ee=j(null),H=j(!1);Q(()=>{b.length>100||H.current||Ee.current&&(Fs(Ee.current,{duration:200}),H.current=!0)},[b,Ee]);const ke=b.length>160?"3d":"2d",De=Ae(()=>ke!=="2d"?null:b.map(L=>{const V=Te[L.id];return e("span",{class:`post-dot ${V?"post-dot-highlight":""}`},L.id)}),[Te]),xe=Ae(()=>ke!=="3d"||!(b!=null&&b.length)?null:ol(b,"createdAt",320).map((V,ae)=>e("div",{class:"posts-bin",children:V.map(ie=>{const z=Te[ie.id];return e("span",{class:`post-dot ${z?"post-dot-highlight":""}`},ie.id)})},ae)),[Te]),Me=j(null),me=Ae(()=>R?(Date.now()-R)/1e3/60/60:null,[R,$]);Q(()=>{if(a!=="results")return;const L=B&&Ce[B]?Ce[B].username:"",V=J==="asc"?0:1,ae={account:"authors"};let ie=fe({duration:5e3,text:s({id:"TLYeLT",values:{selectedFilterCategory:q,sortBy:Y,sortOrder:J,groupBy:he}})});return()=>{var z;(z=ie==null?void 0:ie.hideToast)==null||z.call(ie)}},[a,q,B,Y,J,he,Ce]),Q(()=>{var L;if(B&&Ce[B]){const V=Ee.current.querySelector(`[data-author="${B}"]`),ae=(L=Ee.current)==null?void 0:L.getBoundingClientRect(),ie=V==null?void 0:V.getBoundingClientRect();ie.left<ae.left||ie.right>ae.right?V.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}):ie.top<0&&V.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})}},[B,Ce]);const[N,O]=M(!1),oe=".catchup-list > li > a",Le=qe("j",()=>{const L=document.activeElement.closest(oe),V=L==null?void 0:L.getBoundingClientRect(),ae=Array.from(Me.current.querySelectorAll(oe));if(L&&V.top<Me.current.clientHeight&&V.bottom>0){const ie=ae.indexOf(L),z=ae[ie+1];z&&(z.focus(),z.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const ie=ae.find(z=>z.getBoundingClientRect().top>=0);ie&&(ie.focus(),ie.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{useKey:!0,preventDefault:!0,ignoreEventWhen:L=>L.metaKey||L.ctrlKey||L.altKey||L.shiftKey}),P=qe("k",()=>{const L=document.activeElement.closest(oe),V=L==null?void 0:L.getBoundingClientRect(),ae=Array.from(Me.current.querySelectorAll(oe));if(L&&V.top<Me.current.clientHeight&&V.bottom>0){const ie=ae.indexOf(L);let z=ae[ie-1];z&&(z.focus(),z.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const ie=ae.find(z=>{const be=z.getBoundingClientRect();return be.top>=44&&be.left>=0});ie&&(ie.focus(),ie.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{useKey:!0,preventDefault:!0,ignoreEventWhen:L=>L.metaKey||L.ctrlKey||L.altKey||L.shiftKey}),ce=qe("h, l",(L,V)=>{var ie,z,be;const ae=V.keys[0];if(B){const ve=Ie.indexOf(B);ae==="h"?ve>0&&ve<Ie.length&&(ee(Ie[ve-1]),(ie=Me.current)==null||ie.focus()):ae==="l"&&ve<Ie.length-1&&ve>=0&&(ee(Ie[ve+1]),(z=Me.current)==null||z.focus())}else ae==="l"&&(ee(Ie[0]),(be=Me.current)==null||be.focus())},{useKey:!0,preventDefault:!0,ignoreEventWhen:L=>L.metaKey||L.ctrlKey||L.altKey||L.shiftKey,enableOnFormTags:["input"]}),Se=qe("esc",()=>{var L;ee(null),(L=Me.current)==null||L.focus()},{preventDefault:!0,ignoreEventWhen:L=>L.metaKey||L.ctrlKey||L.altKey||L.shiftKey,enableOnFormTags:["input"],useKey:!0}),Ne=qe(".",()=>{var L;(L=Me.current)==null||L.scrollTo({top:0,behavior:"smooth"})},{useKey:!0,preventDefault:!0,ignoreEventWhen:L=>L.metaKey||L.ctrlKey||L.altKey||L.shiftKey,enableOnFormTags:["input"]}),Oe=it(L=>{const V=document.activeElement,ae=(V==null?void 0:V.tagName)==="INPUT"&&V.type==="radio";if((L.key==="ArrowDown"||L.key==="ArrowUp"||L.key==="ArrowLeft"||L.key==="ArrowRight")&&ae){V.blur();return}},[]);return e("div",{ref:L=>{Me.current=L,Le.current=L,P.current=L,ce.current=L,Se.current=L,Ne.current=L},id:"catchup-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck wide",children:[e("header",{class:`${a==="loading"?"loading":""}`,onClick:L=>{var V;L.target.closest("a, button")||(V=Me.current)==null||V.scrollTo({top:0,behavior:"smooth"})},children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e($t,{}),a==="results"&&e(ge,{to:"/catchup",class:"button plain",children:e(I,{icon:"history2",size:"l",alt:s({id:"xrl8fj"})})}),a==="start"&&e(ge,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l",alt:s({id:"i0qMbr"})})})]}),e("h1",{children:a!=="start"&&e(f,{id:"wyL/3/",components:{0:e("sup",{})}})}),e("div",{class:"header-side",children:a!=="start"&&a!=="loading"&&e("button",{type:"button",class:"plain",onClick:()=>{O(!0)},children:e(f,{id:"c3XJ18"})})})]})}),e("main",{onKeyDown:Oe,children:[a==="start"&&e("div",{class:"catchup-start",children:[e("h1",{children:e(f,{id:"wyL/3/",components:{0:e("sup",{})}})}),e("details",{children:[e("summary",{children:e(f,{id:"CxKPv6"})}),e("p",{children:e(f,{id:"YMU1CK"})}),e("img",{src:jr,width:"1200",height:"900",alt:s({id:"CeInO2"})}),e("p",{children:e("button",{type:"button",onClick:L=>{L.target.closest("details").open=!1},children:e(f,{id:"2jI8hh"})})})]}),e("p",{children:e(f,{id:"1RfGk7"})}),e("p",{children:e("b",{children:e(f,{id:"OOEonE"})})}),e("div",{class:"catchup-form",children:[e("input",{ref:_,type:"range",value:$,min:ht[0].value,max:ht[ht.length-1].value,step:"1",list:"catchup-ranges",onChange:L=>K(+L.target.value)})," ",e("span",{style:{width:"8em"},children:[i(ht[$-1].label),e("br",{}),e("small",{class:"insignificant",children:$==ht[ht.length-1].value?s({id:"NMNiaO"}):ct(new Date(Date.now()-$*60*60*1e3))})]}),e("datalist",{id:"catchup-ranges",children:ht.map(({label:L,value:V})=>e("option",{value:V,label:i(L)}))})," ",e("button",{type:"button",onClick:()=>{var L;if($<ht[ht.length-1].value){let V;$===ht[ht.length-1].value&&((L=T.current)!=null&&L.checked)?V=Date.now()-R:V=$*60*60*1e3,k({duration:V})}else k()},children:e(f,{id:"R0yu2l"})})]}),me&&$>me?e("p",{class:"catchup-info",children:[e(I,{icon:"info"})," ",e(f,{id:"AGyV7s"})]}):$===ht[ht.length-1].value&&R?e("p",{class:"catchup-info",children:e("label",{children:[e("input",{type:"checkbox",switch:!0,checked:!0,ref:T})," ",e(f,{id:"dDJEHI",values:{0:o.format(new Date(R))}})]})}):null,e("p",{class:"insignificant",children:e("small",{children:e(f,{id:"EAjFM0"})})}),!!(D!=null&&D.length)&&e("div",{class:"catchup-prev",children:[e("p",{children:e(f,{id:"Yfb9A8"})}),e("ul",{children:D.map(L=>e("li",{children:[e(ge,{to:`/catchup?id=${L.id}`,children:[e(I,{icon:"history2"})," ",e("span",{children:L.startAt?o.formatRange(new Date(L.startAt),new Date(L.endAt)):`… – ${o.format(new Date(L.endAt))}`})]})," ",e("span",{children:[e("small",{class:"ib insignificant",children:e(f,{id:"S6XZwv",values:{0:L.count}})})," ",e("button",{type:"button",class:"light danger small",onClick:async()=>{var ae;if(confirm(s({id:"D9CmP2"}))){let ie=fe(s({id:"xJUo4P",values:{0:L.id}}));await gt.catchup.del(L.id),(ae=ie==null?void 0:ie.hideToast)==null||ae.call(ie),fe(s({id:"1dyGG/",values:{0:L.id}})),E()}},children:e(I,{icon:"x",alt:s({id:"t/YqKh"})})})]})]},L.id))}),D.length>=3&&e("p",{children:e("small",{children:e(f,{id:"sXmrl4"})})})]})]}),a==="loading"&&e("div",{class:"ui-state catchup-start",children:[e(Be,{abrupt:!0}),e("p",{class:"insignificant",children:e(f,{id:"rbUTzD"})}),e("p",{class:"insignificant",children:e(f,{id:"q9urQO"})})]}),a==="results"&&e(U,{children:[e("div",{class:"catchup-header",children:[b.length>0&&e("p",{children:e("b",{class:"ib",children:o.formatRange(new Date(b[0].createdAt),new Date(b[b.length-1].createdAt))})}),e("aside",{children:[e("button",{hidden:q==="all"&&!B&&Y==="createdAt"&&J==="asc",type:"button",class:"plain4 small",onClick:()=>{Z("all"),ee(null),te("createdAt"),ne(null),ue("asc")},children:e(f,{id:"I9EnzM"})}),(X==null?void 0:X.length)>0&&e("button",{type:"button",class:"plain small",onClick:()=>m(!p),children:[e(f,{id:"EIZREX"})," ",e(I,{icon:"chevron-down",style:{transform:p?"rotate(180deg)":"rotate(0deg)"}})]})]})]}),e("div",{class:"shazam-container no-animation",hidden:!p,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"catchup-top-links links-bar",children:X.map(L=>{const{card:V,shared:ae,sharers:ie,likes:z,boosts:be}=L,{blurhash:ve,title:_e,description:Ze,url:Fe,image:de,imageDescription:ze,language:Ke,width:nt,height:Re,publishedAt:He}=V,at=$s(Fe);let Nt;if(ve){const Pt=mi(ve),st=xi(Pt);Nt=Ai([.6,st[1],st[2]])}return e("a",{href:Fe,target:"_blank",rel:"noopener",class:"link-block",style:Nt?{"--accent-color":`rgb(${Nt.join(",")})`,"--accent-alpha-color":`rgba(${Nt.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:de,alt:ze,width:nt,height:Re,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:at})," ",!!He&&e(U,{children:"· "}),!!He&&e(U,{children:e(_t,{datetime:He,format:"micro"})})]}),!!_e&&e("h1",{class:"title",lang:Ke,dir:"auto",title:_e,children:_e})]}),!!Ze&&e("p",{class:"description",lang:Ke,dir:"auto",title:Ze,children:Ze}),e("hr",{}),e("p",{style:{whiteSpace:"nowrap"},children:e(f,{id:"bfSr6z",values:{0:ie.map(Pt=>{const{avatarStatic:st,displayName:Fn}=Pt;return e("button",{type:"button",class:"plain",style:{padding:0},onClick:Li=>{Li.preventDefault(),Li.stopPropagation();const{id:So}=Pt;ee(So),Z("all")},children:e(mt,{url:st,size:"s",alt:Fn})})})}})})]})]})},Fe)})})})}),b.length>=5&&(ke==="3d"?e("div",{class:"catchup-posts-viz-time-bar",children:xe}):e("div",{class:"catchup-posts-viz-bar",children:De})),b.length>=2&&e("div",{class:"catchup-filters",children:[e("label",{class:"filter-cat",children:[e("input",{type:"radio",name:"filter-cat",checked:q.toLowerCase()==="all",onChange:()=>{Z("all")}}),e(f,{id:"N40H+G"})," ",e("span",{class:"count",children:b.length})]}),Object.entries(Gr).map(([L,V])=>!!G[L]&&e("label",{class:"filter-cat",title:(G[L]/b.length*100).toFixed(2)+"%",children:[e("input",{type:"radio",name:"filter-cat",checked:q.toLowerCase()===L.toLowerCase(),onChange:()=>{Z(L),L==="boosts"&&(te("reblogsCount"),ue("desc"),ne(null))}}),i(V)," ",e("span",{class:"count",children:G[L]})]},i(V)))]}),b.length>=2&&!!se&&e("div",{class:"catchup-filters authors-filters",ref:Ee,children:[Ie.map(L=>e("label",{class:"filter-author","data-author":L,children:[e("input",{type:"radio",name:"filter-author",checked:B===L,onChange:()=>{ee(L)},onClick:()=>{B===L&&ee(null)}}),e(mt,{url:Ce[L].avatarStatic||Ce[L].avatar,size:"xxl",alt:`${Ce[L].displayName} (@${Ce[L].acct})`})," ",e("span",{class:"count",children:se[L]}),e("span",{class:"username",children:Ce[L].username})]},`${L}-${se[L]}`)),Ie.length>5&&e("small",{style:{whiteSpace:"nowrap",paddingInline:"1em",opacity:.33},children:e(f,{id:"HHtYi7",values:{0:Ie.length}})},"authors-count")]}),b.length>=2&&e("div",{class:"catchup-filters",children:[e("span",{class:"filter-label",children:e(f,{id:"f6Hub0"})})," ",e("fieldset",{class:"radio-field-group",children:Wr.map(L=>e("label",{class:"filter-sort",onClick:V=>{Y===L&&(V.preventDefault(),V.stopPropagation(),ue(J==="asc"?"desc":"asc"))},children:[e("input",{type:"radio",name:"filter-sort-cat",checked:Y===L,onChange:()=>{te(L);const V=/(replies|favourites|reblogs)/.test(L)?"desc":"asc";ue(V)}}),{createdAt:s({id:"mYGY3B"}),repliesCount:s({id:"N8UzTV"}),favouritesCount:s({id:"zZOZj7"}),reblogsCount:s({id:"puY2t0"}),density:s({id:"0tQ7AD"})}[L],Y===L&&(J==="asc"?" ↑":" ↓")]},L))}),e("span",{class:"filter-label",children:e(f,{id:"group.filter"})})," ",e("fieldset",{class:"radio-field-group",children:Zr.map(L=>e("label",{class:"filter-group",children:[e("input",{type:"radio",name:"filter-group",checked:he===L,onChange:()=>{ne(L)},disabled:L==="account"&&B}),{account:s({id:"dpqPBg"})}[L]||s({id:"EdQY6l"})]},L||"none"))}),B&&Ie.length>1?e("button",{type:"button",class:"plain6 small",onClick:()=>{ee(null)},style:{whiteSpace:"nowrap"},children:e(f,{id:"/dlmrZ"})}):null]}),e("ul",{class:`catchup-list catchup-filter-${q||""} ${Y?`catchup-sort-${Y}`:""} ${B&&Ce[B]?"catchup-selected-author":""} ${he?`catchup-group-${he}`:""}`,children:Pe.map((L,V)=>{var z;const ae=((z=L.reblog)==null?void 0:z.id)||L.id;let ie=!1;return he==="account"&&($e.current&&L.account.id!==$e.current&&V>0&&(ie=!0),$e.current=L.account.id),e(U,{children:[ie&&e("li",{class:"separator"}),e(el,{to:`/${r}/s/${ae}`,post:L,root:Me.current})]},`${L.id}-${ie}`)})}),e("footer",{children:we.length>5&&e("p",{children:[s(q==="boosts"?{id:"eVosYr"}:{id:"rhmyFK"})," ",e("button",{type:"button",class:"textual",onClick:()=>{Me.current.scrollTop=0},children:e(f,{id:"0MgdN+"})}),"."]})})]})]})]}),N&&e(Ye,{onClose:()=>O(!1),children:e("div",{class:"sheet",id:"catchup-help-sheet",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>O(!1),children:e(I,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(f,{id:"c3XJ18"})})}),e("main",{children:e("dl",{children:[e("dt",{children:e(f,{id:"EIZREX"})}),e("dd",{children:e(f,{id:"YmGrIy"})}),e("dt",{children:e(f,{id:"coaNtr"})}),e("dd",{children:e(f,{id:"UUrqX1"})}),e("dt",{children:e(f,{id:"ScQBC/"})}),e("dd",{children:e(f,{id:"srocAr"})}),e("dt",{children:e(f,{id:"77Emn0"})}),e("dd",{children:e("table",{children:e("tbody",{children:[e("tr",{children:[e("td",{children:e(f,{id:"Gy9P9T"})}),e("td",{children:e("kbd",{children:"j"})})]}),e("tr",{children:[e("td",{children:e(f,{id:"6XYpYY"})}),e("td",{children:e("kbd",{children:"k"})})]}),e("tr",{children:[e("td",{children:e(f,{id:"f5dduh"})}),e("td",{children:e("kbd",{children:"l"})})]}),e("tr",{children:[e("td",{children:e(f,{id:"rj0vxZ"})}),e("td",{children:e("kbd",{children:"h"})})]}),e("tr",{children:[e("td",{children:e(f,{id:"jsFF8C"})}),e("td",{children:e("kbd",{children:"Enter"})})]}),e("tr",{children:[e("td",{children:e(f,{id:"bUUv3P"})}),e("td",{children:e("kbd",{children:"."})})]})]})})})]})})]})})]})}const Qr=ut(function({post:n}){const{id:i,account:s,group:o,reblog:c,inReplyToId:r,inReplyToAccountId:u,_followedTags:l,_filtered:d,visibility:a,__BOOSTERS:h}=n,p=r&&u!==s.id,m=!!d&&(d==null?void 0:d.action)!=="blur",g=v=>{v.shiftKey};return e("article",{class:`post-line ${o?"group":c?"reblog":l!=null&&l.length?"followed-tags":""} ${p?"reply-to":""} ${m?"filtered":""} visibility-${a}`,onMouseEnter:g,children:[e("span",{class:"post-author",children:c?e("span",{class:"post-reblog-avatar",children:[e(mt,{url:s.avatarStatic||s.avatar,squircle:s.bot}),(h==null?void 0:h.size)>0?[...h].map(v=>e(mt,{url:v.avatarStatic||v.avatar,squircle:v.bot})):""," ",e(I,{icon:"rocket"})," ",e(yt,{account:c.account,showAvatar:!0})]}):e(yt,{account:s,showAvatar:!0})}),e(il,{post:c||n,filterInfo:d}),e("span",{class:"post-meta",children:[e(sl,{post:c||n})," ",e(_t,{datetime:new Date((c==null?void 0:c.createdAt)||n.createdAt),format:"micro"})]})]})},(n,i)=>{var s,o;return((s=n==null?void 0:n.post)==null?void 0:s.id)===((o=i==null?void 0:i.post)==null?void 0:o.id)}),el=({root:n,to:i,...s})=>{const o=j(),[c,r]=M(!1);return Q(()=>{const u=new IntersectionObserver(l=>{l[0].isIntersecting&&(queueMicrotask(()=>r(!0)),u.unobserve(o.current))},{root:n,rootMargin:`${Math.max(320,screen.height*.75)}px`});return o.current&&u.observe(o.current),()=>{o.current&&u.unobserve(o.current)}},[]),c?e("li",{children:e(ge,{to:i,children:e(Qr,{...s})})}):e("li",{ref:o,style:{height:"4em"}})},tl=8,nl=8;function ss(n){var d;const{spoilerText:i,content:s,poll:o,mediaAttachments:c,card:r}=n,u=(d=o==null?void 0:o.options)!=null&&d.length?o.options.reduce((a,h)=>a+h.title,""):"";return(i.length+Ns(s)+u.length)/140+(c!=null&&c.length?tl*c.length:r!=null&&r.image?nl:0)}const xt=48;function il({post:n,filterInfo:i}){var T;const{_:s}=le(),{spoilerText:o,sensitive:c,content:r,emojis:u,poll:l,mediaAttachments:d,card:a,inReplyToId:h,inReplyToAccountId:p,account:m,_thread:g}=n,v=h&&p===m.id||!!g,w=!!li()["reading:expand:spoilers"],b=w||!o&&!c&&(i==null?void 0:i.action)!=="blur",S=r?Nn(n):"",_=!o||w;return e("div",{class:"post-peek",title:o?"":S,children:[e("span",{class:"post-peek-content",children:[v&&!_&&e(U,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:"Thread"})," "]}),i&&(i==null?void 0:i.action)!=="blur"?e("span",{class:"post-peek-filtered",children:i!=null&&i.titlesStr?s({id:"suKjh3",values:{0:i.titlesStr}}):s({id:"03Qqf9"})}):e(U,{children:[!!o&&e("span",{class:"post-peek-spoiler",children:[e(I,{icon:`${w?"eye-open":"eye-close"}`})," ",o]}),_&&e("div",{class:"post-peek-html",children:[v&&e(U,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:e(f,{id:"e66y2Z"})})," "]}),!!r&&e("div",{dangerouslySetInnerHTML:{__html:nc(r,u)}}),!!((T=l==null?void 0:l.options)!=null&&T.length)&&l.options.map(A=>e("div",{children:[l.multiple?"▪️":"•"," ",A.title]})),!r&&(d==null?void 0:d.length)===1&&d[0].description&&e(U,{children:[e("span",{class:"post-peek-tag post-peek-alt",children:"ALT"})," ",e("div",{children:d[0].description})]})]})]})]}),(!i||(i==null?void 0:i.action)==="blur")&&e("span",{class:"post-peek-post-content",children:[!!l&&e("span",{class:"post-peek-tag post-peek-poll",children:[e(I,{icon:"poll",size:"s"}),e(f,{id:"4WUbF1"})]}),d!=null&&d.length?d.map(A=>{var F,D,W,G,X,q,Z,B,ee,$;const k=A.previewUrl||A.url,C=A.previewRemoteUrl||A.remoteUrl,E=(F=A.meta)!=null&&F.original?A.meta.original.width:((W=(D=A.meta)==null?void 0:D.small)==null?void 0:W.width)||((X=(G=A.meta)==null?void 0:G.original)==null?void 0:X.width),R=(q=A.meta)!=null&&q.original?A.meta.original.height:((B=(Z=A.meta)==null?void 0:Z.small)==null?void 0:B.height)||(($=(ee=A.meta)==null?void 0:ee.original)==null?void 0:$.height);return e("span",{class:"post-peek-media",children:{image:(k||C)&&b?e("img",{src:k,width:xt,height:xt,alt:A.description,loading:"lazy",onError:K=>{const{src:Y}=K.target;Y===k&&(K.target.src=C)},style:{"--anim-duration":`${Math.min(Math.max(Math.max(E,R)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"🖼"}),gifv:(k||C)&&b?e("img",{src:k,width:xt,height:xt,alt:A.description,loading:"lazy",onError:K=>{const{src:Y}=K.target;Y===k&&(K.target.src=C)}}):e("span",{class:"post-peek-faux-media",children:"🎞️"}),video:(k||C)&&b?e("img",{src:k,width:xt,height:xt,alt:A.description,loading:"lazy",onError:K=>{const{src:Y}=K.target;Y===k&&(K.target.src=C)}}):e("span",{class:"post-peek-faux-media",children:"📹"}),audio:e("span",{class:"post-peek-faux-media",children:"🎵"})}[A.type]||null},A.id)}):!!a&&a.image&&b&&e("span",{class:`post-peek-media post-peek-card card-${a.type||""}`,children:a.image?e("img",{src:a.image,width:xt,height:xt,alt:a.title||a.description||a.imageDescription,loading:"lazy",style:{"--anim-duration":a.width&&a.height&&`${Math.min(Math.max(Math.max(a.width,a.height)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"🔗"})})]})]})}function sl({post:n}){const{_:i}=le(),{reblogsCount:s,repliesCount:o,favouritesCount:c}=n;return e("span",{class:"post-stats",children:[o>0&&e("span",{class:"post-stat-replies",children:[e(I,{icon:"comment2",size:"s",alt:i({id:"N8UzTV"})})," ",Qe(o)]}),c>0&&e("span",{class:"post-stat-likes",children:[e(I,{icon:"heart",size:"s",alt:i({id:"zZOZj7"})})," ",Qe(c)]}),s>0&&e("span",{class:"post-stat-boosts",children:[e(I,{icon:"rocket",size:"s",alt:i({id:"puY2t0"})})," ",Qe(s)]})]})}function ol(n,i,s){const o=n.map(d=>new Date(d[i])),c=o.reduce((d,a)=>a<d?a:d,o[0]),r=o.reduce((d,a)=>a>d?a:d,o[0]),u=Math.min(r.getTime(),Date.now())-c.getTime(),l=Array.from({length:s},()=>[]);return n.forEach(d=>{const a=new Date(d[i]);if(a.getTime()>Date.now())l[l.length-1].push(d);else{const h=(a.getTime()-c.getTime())/u,p=Math.floor(h*(s-1));l[p].push(d)}}),l}const cl=20;function no(){const{_:n}=le();tt(n({id:"zZOZj7"}),"/favourites");const{masto:i,instance:s}=re(),o=j();async function c(r){return(r||!o.current)&&(o.current=i.v1.favourites.list({limit:cl}).values()),await o.current.next()}return e(At,{title:n({id:"zZOZj7"}),id:"favourites",emptyText:n({id:"PHIrMr"}),errorText:n({id:"khVljG"}),instance:s,fetchItems:c})}const al=["home","public","notifications","thread","account"],os=["thread","account"],rl={home:{id:"Buy2bt"},notifications:{id:"iDNBZe"},public:{id:"RO10dm"},thread:{id:"EnJuK0"},account:{id:"vrQQgz"}},ll=[0,30*60,60*60,6*60*60,12*60*60,60*60*24,60*60*24*7,60*60*24*30],Xn={0:{id:"qqeAJM"},1800:ot(30,"minute"),3600:ot(1,"hour"),21600:ot(6,"hour"),43200:ot(12,"hour"),86400:ot(24,"hour"),604800:ot(7,"day"),2592e3:ot(30,"day")};function dl(){const{_:n}=le(),{masto:i}=re();tt(n({id:"cSev+j"}),"/ft");const[s,o]=M("default"),[c,r]=M(!1),[u,l]=Lt(h=>h+1,0),[d,a]=M([]);return Q(()=>{o("loading"),(async()=>{try{const h=await i.v2.filters.list();h.sort((p,m)=>p.title.localeCompare(m.title)),h.forEach(p=>{var m;(m=p.keywords)!=null&&m.length&&p.keywords.sort((g,v)=>g.id-v.id)}),a(h),o("default")}catch{o("error")}})()},[u]),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($t,{}),e(ge,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l",alt:n({id:"i0qMbr"})})})]}),e("h1",{children:e(f,{id:"cSev+j"})}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{r(!0)},children:e(I,{icon:"plus",size:"l",alt:n({id:"yFfBdX"})})})})]})}),e("main",{children:d.length>0?e(U,{children:[e("ul",{class:"filters-list",children:d.map(h=>{const{id:p,title:m,expiresAt:g,keywords:v}=h;return e("li",{children:[e("div",{children:[e("h2",{children:m}),(v==null?void 0:v.length)>0&&e("div",{children:v.map(y=>e(U,{children:[e("span",{class:"tag collapsed insignificant",children:y.wholeWord?`${y.keyword}`:y.keyword})," "]}))}),e("small",{class:"insignificant",children:e(io,{expiresAt:g})})]}),e("button",{type:"button",class:"plain",onClick:()=>{r({filter:h})},children:e(I,{icon:"pencil",size:"l",alt:"Edit filter"})})]},p)})}),d.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(f,{id:"5vzJxv",values:{0:d.length}})})})]}):s==="loading"?e("p",{class:"ui-state",children:e(Be,{})}):s==="error"?e("p",{class:"ui-state",children:e(f,{id:"qcAUwp"})}):e("p",{class:"ui-state",children:e(f,{id:"cWIHTt"})})})]}),!!c&&e(Ye,{title:n({id:"vCSBPD"}),onClose:()=>{r(!1)},children:e(fl,{filter:c==null?void 0:c.filter,onClose:h=>{h.state==="success"&&l(),r(!1)}})})]})}let ul=1;const hl=()=>ul++;function fl({filter:n,onClose:i}){var E;const{_:s,_:o}=le(),{masto:c}=re(),[r,u]=M("default"),l=!!n,{context:d,expiresAt:a,id:h,keywords:p,title:m,filterAction:g}=n||{},v=!!a,y=v&&new Date(a),[w,b]=M(p||[]),S=j(),[_,T]=M([]),[A,k]=M([]),C=w.filter(R=>!_.includes(R.id)&&!A.includes(R._id));return e("div",{class:"sheet",id:"filters-add-edit-modal",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(I,{icon:"x",alt:o({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:o(l?{id:"3mOee6"}:{id:"yFfBdX"})})}),e("main",{children:e("form",{onSubmit:R=>{R.preventDefault();const F=new FormData(R.target),D=F.get("title"),W=F.getAll("keyword_attributes[][id]"),G=F.getAll("keyword_attributes[][keyword]"),X=[...S.current.querySelectorAll('input[name="keyword_attributes[][whole_word]"]')].map($=>$.checked),q=G.map(($,K)=>({id:W[K]||void 0,keyword:$,wholeWord:X[K]}));l&&(_!=null&&_.length)&&_.forEach($=>{q.push({id:$,_destroy:!0})});const Z=F.getAll("context");let B=F.get("expires_in");const ee=F.get("filter_action");!D||!(Z!=null&&Z.length)||(u("loading"),(async()=>{try{let $;l?(B===""||B===null?v?B=Math.floor((y-new Date)/1e3):B=null:B==="0"||B===0?B=null:B=+B,$=await c.v2.filters.$select(h).update({title:D,context:Z,expiresIn:B,keywordsAttributes:q,filterAction:ee})):(B=+B||null,$=await c.v2.filters.create({title:D,context:Z,expiresIn:B,keywordsAttributes:q,filterAction:ee})),u("default"),i==null||i({state:"success",filter:$})}catch{u("error"),alert(o(l?{id:"H8RP+h"}:{id:"Fr0hAN"}))}})())},children:[e("div",{class:"filter-form-row",children:e("label",{children:[e("b",{children:e(f,{id:"MHrjPM"})}),e("input",{type:"text",name:"title",defaultValue:m,disabled:r==="loading",dir:"auto",required:!0})]})}),e("div",{class:"filter-form-keywords",ref:S,children:[C.length?e("ul",{class:"filter-keywords",children:C.map(R=>{const{id:F,keyword:D,wholeWord:W,_id:G}=R;return e("li",{children:[e("input",{type:"hidden",name:"keyword_attributes[][id]",value:F}),e("input",{name:"keyword_attributes[][keyword]",type:"text",defaultValue:D,disabled:r==="loading",required:!0,dir:"auto"}),e("div",{class:"filter-keyword-actions",children:[e("label",{children:[e("input",{name:"keyword_attributes[][whole_word]",type:"checkbox",value:F,defaultChecked:W,disabled:r==="loading"})," ",e(f,{id:"/7UQ7y"})]}),e("button",{type:"button",class:"light danger small",disabled:r==="loading",onClick:()=>{F?(_.push(F),T([..._])):G&&(A.push(G),k([...A]))},children:e(I,{icon:"x",alt:o({id:"t/YqKh"})})})]})]},`${F}-${G}`)})}):e("div",{class:"filter-keywords",children:e("div",{class:"insignificant",children:e(f,{id:"SYKm3p"})})}),e("footer",{class:"filter-keywords-footer",children:[e("button",{type:"button",class:"light",onClick:()=>{b([...w,{_id:hl(),keyword:"",wholeWord:!0}]),setTimeout(()=>{var F,D;const R=S.current.querySelectorAll('input[type="text"]');(D=(F=R[R.length-1])==null?void 0:F.focus)==null||D.call(F)},10)},children:e(f,{id:"qn5Dbn"})})," ",(C==null?void 0:C.length)>1&&e("small",{class:"insignificant",children:e(f,{id:"1JZ175",values:{0:C.length}})})]})]}),e("div",{class:"filter-form-cols",children:[e("div",{class:"filter-form-col",children:[e("div",{children:e("b",{children:e(f,{id:"uqf7Yq"})})}),al.map(R=>e("div",{children:[e("label",{class:os.includes(R)?"insignificant":"",children:[e("input",{type:"checkbox",name:"context",value:R,defaultChecked:d?d.includes(R):!0,disabled:r==="loading"})," ",s(rl[R]),os.includes(R)?"*":""]})," "]})),e("p",{children:e("small",{class:"insignificant",children:e(f,{id:"m0G499"})})})]}),e("div",{class:"filter-form-col",children:[l&&e(f,{id:"ucJk3m",components:{0:e("b",{}),1:e(io,{expiresAt:a,showNeverExpires:!0})}}),e("div",{children:[e("label",{for:"filters-expires_in",children:o(l?{id:"BcNdg+"}:{id:"agO/T/"})}),e("select",{id:"filters-expires_in",name:"expires_in",disabled:r==="loading",defaultValue:l?void 0:0,children:[l&&e("option",{}),ll.map(R=>e("option",{value:R,children:typeof Xn[R]=="function"?Xn[R]():s(Xn[R])}))]})]}),e("p",{children:[e(f,{id:"blQMpa"}),e("br",{}),((E=bs())==null?void 0:E.mastodon)>=5&&e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"blur",defaultChecked:g==="blur",disabled:r==="loading"})," ",e(f,{id:"ggxOw9"})]})," ",e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"warn",defaultChecked:g!=="hide"&&g!=="blur"||!l,disabled:r==="loading"})," ",e(f,{id:"jbreWy"})]})," ",e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"hide",defaultChecked:g==="hide",disabled:r==="loading"})," ",e(f,{id:"zNCBmf"})]})]})]})]}),e("footer",{class:"filter-form-footer",children:[e("span",{children:[e("button",{type:"submit",disabled:r==="loading",children:o(l?{id:"tfDRzk"}:{id:"hYgDIe"})})," ",e(Be,{abrupt:!0,hidden:r!=="loading"})]}),l&&e(pt,{disabled:r==="loading",align:"end",menuItemClassName:"danger",confirmLabel:o({id:"BPjyR2"}),onClick:()=>{u("loading"),(async()=>{try{await c.v2.filters.$select(h).remove(),u("default"),i==null||i({state:"success"})}catch{u("error"),alert(o({id:"4Dh9J1"}))}})()},children:e("button",{type:"button",class:"light danger",onClick:()=>{},disabled:r==="loading",children:e(f,{id:"Jb6/SB"})})})]})]})})]})}function io({expiresAt:n,showNeverExpires:i}){const{_:s}=le(),o=!!n,c=o&&new Date(n),r=o&&c<=new Date,[u,l]=Lt(d=>d+1,0);return fi(l,r||3e4),r?s({id:"M1RnFv"}):o?e(f,{id:"urGtsw",components:{0:e(_t,{datetime:c})}}):i&&s({id:"O1Aswy"})}function pl(){const{_:n}=le(),{masto:i,instance:s}=re();tt(n({id:"Xi1/bw"}),"/fh");const[o,c]=M("default"),[r,u]=M([]);return Q(()=>{c("loading"),(async()=>{try{const l=await Mn();u(l),c("default")}catch{c("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($t,{}),e(ge,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l",alt:n({id:"i0qMbr"})})})]}),e("h1",{children:e(f,{id:"Xi1/bw"})}),e("div",{class:"header-side"})]})}),e("main",{children:r.length>0?e(U,{children:[e("ul",{class:"link-list",children:r.map(l=>e("li",{children:e(ge,{to:s?`/${s}/t/${l.name}`:`/t/${l.name}`,children:[e(I,{icon:"hashtag",alt:"#"})," ",e("span",{children:l.name})]})}))}),r.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(f,{id:"2S/uvJ",values:{0:r.length}})})})]}):o==="loading"?e("p",{class:"ui-state",children:e(Be,{abrupt:!0})}):o==="error"?e("p",{class:"ui-state",children:e(f,{id:"2AeREO"})}):e("p",{class:"ui-state",children:e(f,{id:"vKsGhk"})})})]})})}const ml=20;function Ri({title:n,path:i,id:s,...o}){const{_:c}=le();tt(n||c({id:"following.title"}),i||"/following");const{masto:r,streaming:u,instance:l}=re(),d=We(x),a=j(),h=j(),p=j();__BENCHMARK.end("time-to-following");const m=Je("@pixelfed/home-include-reblogs");async function g(y){var S;(y||!h.current)&&(__BENCHMARK.start("fetch-home-first"),a.current=r.v1.timelines.home.list({limit:ml}),h.current=a.current.values()),m&&((S=a.current)!=null&&S.params)&&(typeof a.current.params=="string"?a.current.params+="&include_reblogs=true":a.current.params.include_reblogs=!0);const w=await h.current.next();let{value:b}=w;if(b!=null&&b.length){let _=!1;y&&(b[0].id!==p.current&&(_=!0),p.current=b[0].id),b.forEach(T=>{et(T,l)}),b=ts(b,l),y&&_&&Ar(),eo(b,l),b.sort((T,A)=>{const k=new Date(T.createdAt);return new Date(A.createdAt)-k})}return __BENCHMARK.end("fetch-home-first"),{...w,value:b}}async function v(){var y;try{const w={limit:5,since_id:p.current};Je("@pixelfed/home-include-reblogs")&&(w.include_reblogs=!0);const b=await r.v1.timelines.home.list(w).values().next();let{value:S}=b;const _=((y=S[0])==null?void 0:y.id)===p.current;return!!(S!=null&&S.length&&!_&&(p.current=S[0].id,S=ts(S,l),S=zt(S,"home"),S.some(T=>!T.reblog)))}catch{return!1}}return Q(()=>{let y;return(async()=>{if(u){y=u.user.subscribe();for await(const w of y){if(!y)break;if(w.event==="status.update"){const b=w.payload;et(b,l)}else if(w.event==="delete"){const b=w.payload,S=_s(b,l);S&&(S._deleted=!0)}}}})(),()=>{var w;(w=y==null?void 0:y.unsubscribe)==null||w.call(y),y=null}},[u]),e(At,{title:n||c({id:"following.title"}),id:s||"following",emptyText:c({id:"nJEKbY"}),errorText:c({id:"7QSeK6"}),instance:l,fetchItems:g,checkForUpdates:v,useItemID:!0,boostsCarousel:d.settings.boostsCarousel,...o,filterContext:"home",showFollowedTags:!0,showReplyParent:!0})}const gl=20,yl=4,cs=yl+1;function so({media:n,columnMode:i,...s}){const{_:o}=le();let{hashtag:c,...r}=i?{}:Mt();s.hashtag&&(c=s.hashtag);let u=c.trim().split(/[\s+]+/);u.sort(),c=u[0];const[l,d]=vt(),a=n||!!l.get("media"),h=a?"?media=1":"",{masto:p,instance:m,authenticated:g}=re({instance:(s==null?void 0:s.instance)||r.instance}),{masto:v,instance:y,authenticated:w}=re(),b=u.map($=>`#${$}`).join(" "),S=o(m?a?{id:"kH0rA0",values:{hashtagTitle:b,instance:m}}:{id:"IK0zKi",values:{hashtagTitle:b,instance:m}}:a?{id:"hHSI3w",values:{hashtagTitle:b}}:{id:"+ZzjRY",values:{hashtagTitle:b}});tt(S,"/:instance?/t/:hashtag");const _=j(),T=Ae(()=>ui(),[]),A=j(void 0);async function k($){const K=await p.v1.timelines.tag.$select(c).list({limit:gl,any:u.slice(1),maxId:$?void 0:A.current,onlyMedia:a?!0:void 0}).values().next();let{value:Y}=K;return Y!=null&&Y.length&&($&&(_.current=Y[0].id),Y.forEach(te=>{et(te,m,{skipThreading:a||T})}),A.current=Y[Y.length-1].id),{...K,value:Y}}async function C(){var $;try{const K=await p.v1.timelines.tag.$select(c).list({limit:1,any:u.slice(1),since_id:_.current,onlyMedia:a}).values().next();let{value:Y}=K;const te=(($=Y[0])==null?void 0:$.id)===_.current;return Y!=null&&Y.length&&!te?(Y=zt(Y,"public"),!0):!1}catch{return!1}}const[E,R]=M("default"),[F,D]=M();Q(()=>{(async()=>{try{const $=await p.v1.tags.$select(c).fetch();D($)}catch{}})()},[c]);const W=u.length>=cs,[G,X]=M("default"),[q,Z]=M([]),[B,ee]=M(!1);return Q(()=>{g&&(async()=>{try{const $=await p.v1.featuredTags.list();Z($),ee($.some(K=>K.name.toLowerCase()===c.toLowerCase()))}catch{}})()},[]),e(U,{children:[e(At,{title:S,titleComponent:!!m&&e("h1",{class:"header-double-lines",children:[e("b",{dir:"auto",children:b}),e("div",{children:m})]}),id:"hashtag",instance:m,emptyText:o({id:"CNSLAW"}),errorText:o({id:"yjj6Ll"}),fetchItems:k,checkForUpdates:C,useItemID:!0,view:a||T?"media":void 0,refresh:a,filterContext:"public",headerEnd:e(dt,{portal:!0,setDownOverflow:!0,overflow:"auto",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(I,{icon:"more",size:"l",alt:o({id:"2FYpfJ"})})}),children:[!!F&&u.length===1&&e(U,{children:[e(pt,{subMenu:!0,confirm:F.following,confirmLabel:o({id:"ctJi7k",values:{hashtag:c}}),disabled:E==="loading"||!g,onClick:()=>{R("loading"),F.following?p.v1.tags.$select(c).unfollow().then(()=>{D({...F,following:!1}),fe(o({id:"doK/ij",values:{hashtag:c}}))}).catch($=>{alert($)}).finally(()=>{R("default")}):p.v1.tags.$select(c).follow().then(()=>{D({...F,following:!0}),fe(o({id:"R9+aEN",values:{hashtag:c}}))}).catch($=>{alert($)}).finally(()=>{R("default")})},children:F.following?e(U,{children:[e(I,{icon:"check-circle"})," ",e("span",{children:e(f,{id:"HOSk7R"})})]}):e(U,{children:[e(I,{icon:"plus"})," ",e("span",{children:e(f,{id:"MKEPCY"})})]})}),e(ye,{type:"checkbox",checked:B,disabled:G==="loading"||!g,onClick:()=>{if(X("loading"),B){const $=q.find(K=>K.name.toLowerCase()===c.toLowerCase()).id;$?p.v1.featuredTags.$select($).remove().then(()=>{ee(!1),fe(o({id:"VH+Tf9"})),Z(q.filter(K=>K.id!==$))}).catch(K=>{}).finally(()=>{X("default")}):fe(o({id:"3OLv47"}))}else p.v1.featuredTags.create({name:c}).then($=>{ee(!0),fe(o({id:"9ra4hn"})),Z(q.concat($))}).catch($=>{}).finally(()=>{X("default")})},children:B?e(U,{children:[e(I,{icon:"check-circle"}),e("span",{children:e(f,{id:"9ra4hn"})})]}):e(U,{children:[e(I,{icon:"check-circle"}),e("span",{children:e(f,{id:"UlJ3QN"})})]})}),e(Ve,{})]}),!T&&e(U,{children:[e(gi,{className:"plain",children:e(f,{id:"cSev+j"})}),e(ye,{type:"checkbox",checked:!!a,onClick:()=>{a?l.delete("media"):l.set("media","1"),d(l)},children:[e(I,{icon:"check-circle",alt:"☑️"})," ",e("span",{class:"menu-grow",children:e(f,{id:"eK4SL/"})})]}),e(Ve,{})]}),e(ic,{className:"menu-field",disabled:W,children:({ref:$})=>e("form",{onSubmit:K=>{var te,J;K.preventDefault();const Y=(J=(te=K.target[0].value)==null?void 0:te.trim)==null?void 0:J.call(te);Y&&!u.some(ue=>ue.toLowerCase()===Y.toLowerCase())&&(u.push(Y),u.sort(),location.hash=m?`/${m}/t/${u.join("+")}${h}`:`/t/${u.join("+")}${h}`)},children:[e(I,{icon:"hashtag"}),e("input",{ref:$,type:"text",placeholder:W?pe._({id:"ouWc/D",values:{TOTAL_TAGS_LIMIT:cs}}):o({id:"cxL5F9"}),required:!0,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:"[^#][^\\s#]+[^#]",disabled:W,dir:"auto"})]})}),e(sc,{takeOverflow:!0,children:u.map(($,K)=>e(ye,{disabled:u.length===1,onClick:Y=>{u.splice(K,1),u.sort(),location.hash=m?`/${m}/t/${u.join("+")}${h}`:`/t/${u.join("+")}${h}`},children:[e(I,{icon:"x",alt:o({id:"OISAkj"}),class:"danger-icon"}),e("span",{class:"bidi-isolate",children:[e("span",{class:"more-insignificant",children:"#"}),$]})]},$))}),e(Ve,{}),e(ye,{disabled:!w,onClick:()=>{if(x.shortcuts.length>=It){alert(pe._({id:"XN1xAY",values:{SHORTCUTS_LIMIT:It}}));return}const $={type:"hashtag",hashtag:u.join(" "),instance:m,media:a?"on":void 0};x.shortcuts.some(Y=>Y.type===$.type&&Y.hashtag.split(/[\s+]+/).sort().join(" ")===$.hashtag.split(/[\s+]+/).sort().join(" ")&&(Y.instance?Y.instance===$.instance:!0)&&(Y.media?!!Y.media==!!$.media:!0))?alert(o({id:"kfeQnS"})):(x.shortcuts.push($),fe(o({id:"MIhb91"})))},children:[e(I,{icon:"shortcut"})," ",e("span",{children:e(f,{id:"i02Lq/"})})]}),e(ye,{onClick:()=>{let $=prompt(o({id:"2MQ2cd"}));if(!/\./.test($)){$&&alert(o({id:"7WddtO"}));return}$&&($=$.toLowerCase().trim(),location.hash=`/${$}/t/${u.join("+")}${h}`)},children:[e(I,{icon:"bus"})," ",e("span",{children:e(f,{id:"Sq04Yc"})})]}),y!==m&&e(ye,{onClick:()=>{location.hash=`/${y}/t/${u.join("+")}${h}`},children:[e(I,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(f,{id:"iAzCp4",values:{currentInstance:y},components:{0:e("b",{})}})})]})]})},m+b),!i&&!!(u!=null&&u.length)&&e("data",{class:"compose-data",value:JSON.stringify({draftStatus:{status:`${u.length>1?`
`:" "}${b}`}})})]})}const bl=20;function oo(n){var S;const{_:i}=le(),s=We(x),{masto:o,instance:c}=re(),r=(n==null?void 0:n.id)||((S=Mt())==null?void 0:S.id),u=j(),l=j();async function d(_){(_||!l.current)&&(l.current=o.v1.timelines.list.$select(r).list({limit:bl}).values());const T=await l.current.next();let{value:A}=T;return A!=null&&A.length&&(_&&(u.current=A[0].id),A.forEach(k=>{et(k,c)})),{...T,value:A}}async function a(){var _;try{const T=await o.v1.timelines.list.$select(r).list({limit:1,since_id:u.current});let{value:A}=T;const k=((_=A[0])==null?void 0:_.id)===u.current;return A!=null&&A.length&&!k?(A=zt(A,"home"),!0):!1}catch{return!1}}const[h,p]=M([]),[m,g]=M({title:"List"});tt(m.title,"/l/:id"),Q(()=>{(async()=>{try{const _=await js(r);g(_)}catch{}})()},[r]);const[v,y]=M(!1),[w,b]=M(!1);return e(U,{children:[e(At,{title:m.title,id:"list",emptyText:i({id:"KkDhfU"}),errorText:i({id:"7QSeK6"}),instance:c,fetchItems:d,checkForUpdates:a,useItemID:!0,boostsCarousel:s.settings.boostsCarousel,filterContext:"home",showReplyParent:!0,headerStart:e(dt,{overflow:"auto",menuButton:e("button",{type:"button",class:"plain",children:[e(I,{icon:"list",size:"l",alt:i({id:"h16FyT"})}),e(I,{icon:"chevron-down",size:"s"})]}),onMenuChange:_=>{_.open&&hn().then(p)},children:[e(je,{to:"/l",children:e("span",{children:e(f,{id:"BHWx+g"})})}),(h==null?void 0:h.length)>0&&e(U,{children:[e(Ve,{}),h.map(_=>e(je,{to:`/l/${_.id}`,children:e("span",{children:[_.title,_.exclusive&&e(U,{children:[" ",e(Bt,{})]})]})},_.id))]})]}),headerEnd:e(dt,{portal:!0,setDownOverflow:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(I,{icon:"more",size:"l",alt:i({id:"2FYpfJ"})})}),children:[(m==null?void 0:m.exclusive)&&e(U,{children:[e(gi,{className:"plain",children:[e(Bt,{})," ",e(f,{id:"FNptcJ"})]}),e(Ve,{})]}),e(ye,{onClick:()=>y({list:m}),children:[e(I,{icon:"pencil",size:"l"}),e("span",{children:e(f,{id:"ePK91l"})})]}),e(ye,{onClick:()=>b(!0),children:[e(I,{icon:"group",size:"l"}),e("span",{children:e(f,{id:"hB02vO"})})]})]})},r),v&&e(Ye,{onClick:_=>{_.target===_.currentTarget&&y(!1)},children:e(Ti,{list:v==null?void 0:v.list,onClose:_=>{_.state==="success"&&_.list?g(_.list):_.state==="deleted"&&(location.hash="/l"),y(!1)}})}),w&&e(Ye,{onClick:_=>{_.target===_.currentTarget&&b(!1)},children:e(wl,{listID:r,onClose:()=>b(!1)})})]})}const vl=40;function wl({listID:n,onClose:i}){const{_:s}=le(),{masto:o,instance:c}=re(),[r,u]=M([]),[l,d]=M("default"),[a,h]=M(!1),p=j();async function m(g){h(!1),d("loading"),(async()=>{try{(g||!p.current)&&(p.current=o.v1.lists.$select(n).accounts.list({limit:vl}).values());const v=await p.current.next();let{done:y,value:w}=v;w!=null&&w.length?(u(g?w:r.concat(w)),h(!y)):h(!1),d("default")}catch{d("error")}})()}return Q(()=>{m(!0)},[]),e("div",{class:"sheet",id:"list-manage-members-container",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(I,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(f,{id:"hB02vO"})})}),e("main",{children:e("ul",{children:[r.map(g=>e("li",{children:[e(ft,{account:g,instance:c}),e(kl,{account:g,listID:n})]},g.id)),a&&l==="default"&&e(Tt,{as:"li",onChange:g=>g&&m(),children:e("button",{type:"button",class:"light block",onClick:m,children:e(f,{id:"uXRAkV"})})})]})})]})}function kl({account:n,listID:i}){const{_:s}=le(),{masto:o}=re(),[c,r]=M("default"),[u,l]=M(!1);return e(pt,{confirm:!u,confirmLabel:e("span",{children:e(f,{id:"j5n9Ry",values:{0:n.username},components:{0:e("span",{class:"bidi-isolate"})}})}),align:"end",menuItemClassName:"danger",onClick:()=>{u?(r("loading"),(async()=>{try{await o.v1.lists.$select(i).accounts.create({accountIds:[n.id]}),r("default"),l(!1)}catch{r("error")}})()):(r("loading"),(async()=>{try{await o.v1.lists.$select(i).accounts.remove({accountIds:[n.id]}),r("default"),l(!0)}catch{r("error")}})())},children:e("button",{type:"button",class:`light ${u?"":"danger"}`,disabled:c==="loading",children:s(u?{id:"m16xKo"}:{id:"MWIaew"})})})}const Sl={mention:["account","status"],status:["account","status"],reblog:["account","status"],follow:["account"],follow_request:["account"],favourite:["account","status"],poll:["status"],update:["status"]},_l=["favourite","reblog","follow"],co=n=>_l.includes(n);function ao(n){return n.filter(i=>{const{type:s,id:o,createdAt:c}=i;if(!s)return!1;const r=Sl[s];return r!=null&&r.length?r.every(u=>!!i[u]):!0})}function ro(n){if(n!=null&&n.notificationGroups){const{accounts:i=[],notificationGroups:s=[],statuses:o=[]}=n;return s.map(c=>{const{sampleAccountIds:r,statusId:u}=c,l=(r==null?void 0:r.map(a=>i.find(h=>h.id===a)))||[],d=(o==null?void 0:o.find(a=>a.id===u))||null;return{...c,sampleAccounts:l,status:d}})}return n}function Cl(n){const i=n.map(u=>{const{latestPageNotificationAt:l,mostRecentNotificationId:d,sampleAccounts:a,notificationsCount:h}=u;return{id:""+d,createdAt:l,account:a[0],...u}}),s={},o=[];for(let u=0;u<i.length;u++){const l=i[u],{type:d,status:a,createdAt:h,notificationsCount:p,sampleAccounts:m,groupKey:g}=l,v=h?new Date(h).toLocaleDateString():"";let y=d;!(p>0&&(m==null?void 0:m.length)>0&&p>(m==null?void 0:m.length))&&(d==="favourite"||d==="reblog")&&(y="favourite+reblog");const b=`${a==null?void 0:a.id}-${y}-${v}`,S=s[b];if(!co(d))o.push(l);else if(S)m.forEach(_=>{const T=S.sampleAccounts.find(A=>A.id===_.id);T?(T._types.push(d),T._types.sort().reverse()):S.sampleAccounts.push({..._,_types:[d]})}),S.notificationsCount=Math.min(S.notificationsCount,p),S._notificationsCount.push(p),S._sampleAccountsCount.push(m==null?void 0:m.length),S._accounts=S.sampleAccounts,S._groupKeys.push(g);else{const _=m.map(T=>({...T,_types:[d]}));s[b]={...l,sampleAccounts:_,type:y,_accounts:_,_groupKeys:g?[g]:[],_notificationsCount:[p],_sampleAccountsCount:[m==null?void 0:m.length]},o.push(s[b])}}const c={},r=[];for(let u=0;u<o.length;u++){const l=o[u],{type:d,account:a,_accounts:h,sampleAccounts:p,createdAt:m,groupKey:g}=l,v=m?new Date(m).toLocaleDateString():"",y=(p==null?void 0:p.length)===1||(h==null?void 0:h.length)===1;if((d==="favourite"||d==="reblog"||d==="favourite+reblog")&&y){const w=`${a==null?void 0:a.id}-${d}-${v}`,b=c[w];if(b)b._statuses.push(l.status),b._ids+=`-${l.id}`,b._groupKeys.push(g);else{let S=c[w]={...l,type:d,_ids:l.id,_statuses:[l.status],_groupKeys:g?[g]:[]};r.push(S)}}else r.push(l)}return r}function Il(n){n=ao(n);const i={},s=[];for(let r=0,u=0;r<n.length;r++){const l=n[r],{id:d,status:a,account:h,type:p,createdAt:m}=l,g=m?new Date(m).toLocaleDateString():"";let v=p;(p==="favourite"||p==="reblog")&&(v="favourite+reblog");const y=`${a==null?void 0:a.id}-${v}-${g}`,w=i[y];if(!co(p))s[u++]=l;else if(w!=null&&w.account){const b=w._accounts.find(S=>S.id===h.id);b?(b._types.push(p),b._types.sort().reverse(),w._ids+=`-${d}`):(h._types=[p],w._accounts.push(h),w._ids+=`-${d}`)}else{h&&(h._types=[p]);let b=i[y]={...l,type:v,_ids:d,_accounts:h?[h]:[]};s[u++]=b}}const o={},c=[];for(let r=0,u=0;r<s.length;r++){const l=s[r],{id:d,account:a,_accounts:h,type:p,createdAt:m}=l,g=m?new Date(m).toLocaleDateString():"";if(p==="favourite+reblog"&&a&&h.length===1){const v=`${a==null?void 0:a.id}-${p}-${g}`,y=o[v];if(y)y._statuses.push(l.status),y._ids+=`-${d}`;else{let w=o[v]={...l,type:p,_ids:d,_statuses:[l.status]};c[u++]=w}}else c[u++]=l}return c}const as=20,Tl=new URLSearchParams;function lo({columnMode:n,...i}){const{_:s}=le(),{masto:o,instance:c}=re(),[r]=n?[Tl]:vt(),[u,l]=M(null),d=(i==null?void 0:i.type)||r.get("type")||u;tt(s(d==="private"?{id:"2BApYc"}:{id:"/bZzdR"}),"/mentions");const a=j(),h=j();async function p(S){(S||!a.current)&&(a.current=o.v1.notifications.list({limit:as,types:["mention"]}).values());const _=await a.current.next();let{value:T}=_;return T!=null&&T.length&&(T=ao(T),S&&(h.current=T[0].id),T.forEach(({status:A})=>{et(A,c)})),{..._,value:T==null?void 0:T.map(A=>A.status)}}const m=j(),g=j();async function v(S){(S||!m.current)&&(m.current=o.v1.conversations.list({limit:as}).values());const _=await m.current.next();let{value:T}=_;return T=T==null?void 0:T.filter(A=>A.lastStatus),T!=null&&T.length&&(S&&(g.current=T[0].lastStatus.id),T.forEach(({lastStatus:A})=>{et(A,c)})),{..._,value:T==null?void 0:T.map(A=>A.lastStatus)}}function y(...S){return d==="private"?v(...S):p(...S)}async function w(){var S;if(d==="private")try{const _=await o.v1.conversations.list({limit:1,since_id:g.current}).values().next();let{value:T}=_;const A=((S=T[0])==null?void 0:S.id)===g.current;return T!=null&&T.length&&!A?(g.current=T[0].lastStatus.id,!0):!1}catch{return!1}else try{const _=await o.v1.notifications.list({limit:1,types:["mention"],since_id:h.current}).values().next();let{value:T}=_;return T!=null&&T.length?(h.current=T[0].id,!0):!1}catch{return!1}}const b=Ae(()=>e("div",{class:"filter-bar centered",children:[e(ge,{to:"/mentions",class:d?"":"is-active",onClick:S=>{n&&(S.preventDefault(),l(null))},children:e(f,{id:"N40H+G"})}),e(ge,{to:"/mentions?type=private",class:d==="private"?"is-active":"",onClick:S=>{n&&(S.preventDefault(),l("private"))},children:e(f,{id:"zwBp5t"})})]}),[d]);return e(At,{title:s({id:"/bZzdR"}),id:"mentions",emptyText:s({id:"03jFGT"}),errorText:s({id:"pqR9KF"}),instance:c,fetchItems:y,checkForUpdates:w,useItemID:!0,timelineStart:b,refresh:d,filterContext:"notifications"})}const Al=80,xl=20,El=new URLSearchParams,pn={block:"center",inline:"center",behavior:"smooth"},uo=Ss(()=>Je("@mastodon/grouped-notifications"),{maxAge:1e3*60*5});function ho(n={}){const{masto:i}=re();return x.settings.groupedNotificationsAlpha&&uo()?i.v2.notifications.list({limit:xl,...n}):i.v1.notifications.list({limit:Al,...n})}function fo(n={}){return ho(n).values()}function po(n){return x.settings.groupedNotificationsAlpha&&uo()?Cl(n):Il(n)}const Rl=["forNotFollowing","forNotFollowers","forNewAccounts","forPrivateMentions","forLimitedAccounts"],Ll={forNotFollowing:{id:"d+hDoa"},forNotFollowers:{id:"oAwuQj"},forNewAccounts:{id:"Srs8u7"},forPrivateMentions:{id:"IDC5Uw"},forLimitedAccounts:{id:"XMGM2e"}};function Ml({columnMode:n}){var Le;const{_:i,_:s}=le();tt(s({id:"iDNBZe"}),"/notifications");const{masto:o,instance:c}=re(),r=We(x),[u,l]=M("default"),[d]=n?[El]:vt(),a=d.get("id"),h=d.get("access_token"),[p,m]=M(!1),[g,v]=M(!1),y=j(),{nearReachEnd:w,scrollDirection:b,reachStart:S,nearReachStart:_}=xr({scrollableRef:y}),T=b==="end"&&!_,[A,k]=M([]),[C,E]=M([]),R=j(),F=j();async function D(P){var Ne;if((P||!F.current)&&(R.current=ho({excludeTypes:["follow_request"]}),F.current=R.current.values()),/max_id=($|&)/i.test((Ne=F.current)==null?void 0:Ne.nextParams))return{done:!0};const ce=await F.current.next(),Se=ro(ce.value);if(Se!=null&&Se.length){Se.forEach(L=>{et(L.status,c,{skipThreading:!0})});const Oe=po(Se);P?(x.notificationsLast=Oe[0],x.notifications=Oe,o.v1.markers.create({notifications:{lastReadId:Oe[0].id}}).catch(()=>{})):x.notifications.push(...Oe)}return x.notificationsShowNew=!1,x.notificationsLastFetchTime=Date.now(),ce}async function W(){try{return await o.v1.followRequests.list({limit:80})}catch{return[]}}const G=()=>{l("loading"),(async()=>{try{const P=await W();k(P),l("default")}catch{l("error")}})()};async function X(){try{return await o.v1.announcements.list()}catch{return[]}}const q=Je("@mastodon/filtered-notifications"),[Z,B]=M(!1),[ee,$]=M({});function K(){return o.v2.notifications.policy.fetch().catch(()=>{})}function Y(){K().then(P=>{$(P)}).catch(()=>{})}const[te,J]=M(null);function ue(){return o.v1.notifications.requests.list()}const he=P=>{we(!1),l("loading"),(async()=>{try{const ce=D(P);P&&(X().then(Ne=>{Ne.sort((Oe,L)=>{const V=new Date(Oe.updatedAt||Oe.createdAt);return new Date(L.updatedAt||L.createdAt)-V}),E(Ne)}).catch(()=>{}),W().then(Ne=>{k(Ne)}).catch(()=>{}),q&&Y());const{done:Se}=await ce;m(!Se),l("default")}catch{l("error")}})()};Q(()=>{he(!0)},[]),Q(()=>{S&&he(!0)},[S]);const[ne,we]=M(!1),Ce=it(({disableIdleCheck:P=!1}={})=>{var ce;u!=="loading"&&r.settings.autoRefresh&&((ce=y.current)==null?void 0:ce.scrollTop)<16&&(P||window.__IDLE__)&&!$l()&&he(!0)},[r.notificationsShowNew,r.settings.autoRefresh,u]),se=j();Gt(P=>{if(P){const ce=Date.now()-se.current;!se.current||ce>1e3*3?Ce({disableIdleCheck:!0}):se.current=Date.now()}});const Te=j(!0);Q(()=>{let P=No(x,"notificationsShowNew",ce=>{if(Te.current){Te.current=!1;return}u!=="loading"&&(ce&&Ce(),we(ce))});return()=>P==null?void 0:P()},[]);const Ie=new Date,Pe=new Date(Ie-24*60*60*1e3);let $e=new Date;const Ee=!r.notifications.some(P=>new Date(P.createdAt).toDateString()===Ie.toDateString()),H=j();Q(()=>{a&&(x.routeNotification={id:a,accessToken:atob(h)})},[a,h]);const[ke,De]=M(null);Q(async()=>{var Ne,Oe,L;const P=new Date;if(P.getMonth()!==11||!Je("@mastodon/annual-report"))return;let ce=Ue.account.get("annualReportNotification");if(ce){De(ce);return}const Se=fo({types:["annual_report"]});try{const V=await Se.next();ce=(Oe=(Ne=V==null?void 0:V.value)==null?void 0:Ne.notificationGroups)==null?void 0:Oe[0],((L=ce==null?void 0:ce.annualReport)==null?void 0:L.year)==P.getFullYear()&&(De(ce),Ue.account.set("annualReportNotification",ce))}catch{}},[]);const xe=".notification",Me=qe("j",()=>{const P=document.activeElement.closest(xe),ce=P==null?void 0:P.getBoundingClientRect(),Se=Array.from(y.current.querySelectorAll(xe));if(P&&ce.top<y.current.clientHeight&&ce.bottom>0){const Ne=Se.indexOf(P);let Oe=Se[Ne+1];Oe&&(Oe.focus(),Oe.scrollIntoView(pn))}else{const Ne=Se.find(Oe=>{const L=Oe.getBoundingClientRect();return L.top>=44&&L.left>=0});Ne&&(Ne.focus(),Ne.scrollIntoView(pn))}},{useKey:!0,ignoreEventWhen:P=>P.metaKey||P.ctrlKey||P.altKey||P.shiftKey}),me=qe("k",()=>{const P=document.activeElement.closest(xe),ce=P==null?void 0:P.getBoundingClientRect(),Se=Array.from(y.current.querySelectorAll(xe));if(P&&ce.top<y.current.clientHeight&&ce.bottom>0){const Ne=Se.indexOf(P);let Oe=Se[Ne-1];Oe&&(Oe.focus(),Oe.scrollIntoView(pn))}else{const Ne=Se.find(Oe=>{const L=Oe.getBoundingClientRect();return L.top>=44&&L.left>=0});Ne&&(Ne.focus(),Ne.scrollIntoView(pn))}},{useKey:!0,ignoreEventWhen:P=>P.metaKey||P.ctrlKey||P.altKey||P.shiftKey}),N=qe(["enter","o"],()=>{const P=document.activeElement.closest(xe),ce=P==null?void 0:P.querySelector(".status-link");ce&&ce.click()},{useKey:!0,ignoreEventWhen:P=>P.metaKey||P.ctrlKey||P.altKey||P.shiftKey}),O=new Date,oe=Ae(()=>ct(O,{forceOpts:{weekday:"long"}}),[O]);return e("div",{id:"notifications-page",class:"deck-container",ref:P=>{y.current=P,Me.current=P,me.current=P,N.current=P},tabIndex:"-1",children:[e("div",{class:`timeline-deck deck ${g?"only-mentions":""}`,children:[e("header",{hidden:T,onClick:P=>{var ce;P.target.closest("a, button")||(ce=y.current)==null||ce.scrollTo({top:0,behavior:"smooth"})},onDblClick:P=>{P.target.closest("a, button")||he(!0)},class:u==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e($t,{}),e(ge,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l",alt:s({id:"i0qMbr"})})})]}),e("h1",{children:e(f,{id:"iDNBZe"})}),e("div",{class:"header-side",children:q&&e("button",{type:"button",class:"button plain4",onClick:()=>{B(!0)},children:e(I,{icon:"settings",size:"l",alt:s({id:"a/+arl"})})})})]}),ne&&u!=="loading"&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:()=>{var P;he(!0),(P=y.current)==null||P.scrollTo({top:0,behavior:"smooth"})},children:[e(I,{icon:"arrow-up"})," ",e(f,{id:"Jy9RU/"})]})]}),C.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(I,{icon:"announce",class:"announcement-icon",size:"l"})," ",e(f,{id:"0whvLM",values:{0:C.length}})," ",e("small",{class:"insignificant",children:c})]}),C.length>1&&e("span",{class:"announcements-nav-buttons",children:C.map((P,ce)=>e("button",{type:"button",class:"plain2 small",onClick:()=>{var Se;(Se=H.current)==null||Se.children[ce].scrollIntoView({behavior:"smooth",block:"nearest"})},children:ce+1}))})]}),e("ul",{class:`announcements-list-${C.length>1?"multiple":"single"}`,ref:H,children:C.map(P=>e("li",{children:e(Nl,{announcement:P})}))})]})})}),A.length>0&&e("div",{class:"follow-requests",children:[e("h2",{class:"timeline-header",children:e(f,{id:"6Fs1Ba"})}),A.length>5?e("details",{children:[e("summary",{children:e(f,{id:"7dHKu4",values:{0:A.length}})}),e("ul",{children:A.map(P=>e("li",{children:[e(ft,{account:P}),e(si,{accountID:P.id,onChange:()=>{}})]},P.id))})]}):e("ul",{children:A.map(P=>e("li",{children:[e(ft,{account:P}),e(si,{accountID:P.id,onChange:()=>{}})]},P.id))})]}),q&&((Le=ee==null?void 0:ee.summary)==null?void 0:Le.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 P=>{const{open:ce}=P.target;if(ce){const Se=await ue();J(Se)}},children:[e("summary",{children:e(f,{id:"N3Bq0f",values:{0:ee.summary.pendingRequestsCount}})}),te?(te==null?void 0:te.length)>0&&e("ul",{children:te.map(P=>{var ce,Se;return e("li",{children:[e("div",{class:"request-notifcations",children:[!((ce=P.lastStatus)!=null&&ce.id)&&e(ft,{useAvatarStatic:!0,showStats:!0,account:P.account}),((Se=P.lastStatus)==null?void 0:Se.id)&&e("div",{class:"last-post",children:e(ge,{class:"status-link",to:`/${c}/s/${P.lastStatus.id}`,children:e(Ge,{status:P.lastStatus,size:"s",readOnly:!0})})}),e(Dl,{request:P})]}),e(Ol,{request:P,onChange:()=>{he(!0)}})]},P.id)})}):e("p",{class:"ui-state",children:e(Be,{abrupt:!0})})]})})})}),ke&&e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e(ln,{notification:ke})})}),e("div",{id:"mentions-option",children:e("label",{children:[e("input",{type:"checkbox",checked:g,onChange:P=>{v(P.target.checked)}})," ",e(f,{id:"0udtPI"})]})}),e("h2",{class:"timeline-header",children:[e(f,{id:"ecUA8p"})," ",e("small",{class:"insignificant bidi-isolate",children:oe})]}),Ee&&e("p",{class:"ui-state insignificant",children:u==="default"?s({id:"KS7iJH"}):e(U,{children:"…"})}),r.notifications.length?e(Dn.Provider,{value:"notifications",children:r.notifications.filter(P=>P.type!=="follow_request").map(P=>{if(g&&P.type!=="mention")return null;const ce=new Date(P.createdAt),Se=ce.toDateString()!==$e.toDateString();Se&&($e=ce);const Ne=ce.toDateString()===Pe.toDateString()?s({id:"y/0uwd"}):ct($e,{hideTime:!0}),Oe=ct($e,{forceOpts:{weekday:"long"}});return e(U,{children:[Se&&e("h2",{class:"timeline-header",children:[e("span",{children:Ne})," ",e("small",{class:"insignificant bidi-isolate",children:Oe})]}),e(ln,{instance:c,notification:P},P._ids||P.id)]},P._ids||P.id)})}):e(U,{children:[u==="loading"&&e(U,{children:e("ul",{class:"timeline flat",children:Array.from({length:5}).map((P,ce)=>e("li",{class:"notification skeleton",children:[e("div",{class:"notification-type",children:e(I,{icon:"notification",size:"xl"})}),e("div",{class:"notification-content",children:e("p",{children:"███████████ ████"})})]}))})}),u==="error"&&e("p",{class:"ui-state",children:[e(f,{id:"gjzl8E"}),e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>he(!0),children:e(f,{id:"KDw4GX"})})]})]}),p&&e(Tt,{onChange:P=>{P&&he()},children:e("button",{type:"button",class:"plain block",disabled:u==="loading",onClick:()=>he(),style:{marginBlockEnd:"6em"},children:u==="loading"?e(Be,{abrupt:!0}):e(f,{id:"uXRAkV"})})})]}),q&&Z&&e(Ye,{onClick:P=>{P.target===P.currentTarget&&B(!1)},children:e("div",{class:"sheet",id:"notifications-settings",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>B(!1),children:e(I,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(f,{id:"a/+arl"})})}),e("main",{children:e("form",{onSubmit:P=>{P.preventDefault();const{forNotFollowing:ce,forNotFollowers:Se,forNewAccounts:Ne,forPrivateMentions:Oe,forLimitedAccounts:L}=P.target,V={...ee,forNotFollowing:ce.value,forNotFollowers:Se.value,forNewAccounts:Ne.value,forPrivateMentions:Oe.value,forLimitedAccounts:L.value};$(V),B(!1),(async()=>{try{await o.v2.notifications.policy.update(V),fe(s({id:"4+7X9i"}))}catch{}})()},children:[e("p",{children:e(f,{id:"WrkPTf"})}),e("div",{class:"notification-policy-fields",children:Rl.map(P=>{const ce=ee[P];return e("div",{children:e("label",{children:[i(Ll[P]),e("select",{name:P,defaultValue:ce,class:"small",children:[e("option",{value:"accept",children:e(f,{id:"g3UF2V"})}),e("option",{value:"filter",children:e(f,{id:"o7J4JM"})}),e("option",{value:"drop",children:e(f,{id:"gbbkE7"})})]})]})},P)})}),e("p",{children:e("button",{type:"submit",children:e(f,{id:"tfDRzk"})})})]})})]})})]})}function $l(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}function Nl({announcement:n}){const{instance:i}=re(),{contact:s}=vs(),o=s==null?void 0:s.account,{id:c,content:r,startsAt:u,endsAt:l,published:d,allDay:a,publishedAt:h,updatedAt:p,read:m,mentions:g,statuses:v,tags:y,emojis:w,reactions:b}=n,S=new Date(h),_=ct(S),T=new Date(p),A=ct(T);return e("div",{class:"announcement-block",children:[e(ft,{account:o}),e("div",{class:"announcement-content",onClick:Es({mentions:g,instance:i}),dangerouslySetInnerHTML:{__html:Qn(r,{emojis:w})}}),e("p",{class:"insignificant",children:[e("time",{datetime:S.toISOString(),children:ct(S)}),p&&A!==_&&e(U,{children:[" ","•"," ",e("span",{class:"ib",children:e(f,{id:"TbFrLc",values:{0:ct(T)},components:{0:e("time",{datetime:T.toISOString()})}})})]})]}),e("div",{class:"announcement-reactions",hidden:!0,children:b.map(k=>{const{name:C,count:E,me:R,staticUrl:F,url:D}=k;return e("button",{type:"button",class:`plain4 small ${R?"reacted":""}`,children:[D||F?e("img",{src:D||F,alt:C,width:"16",height:"16"}):e("span",{children:C})," ",e("span",{class:"count",children:Qe(E)})]})})})]})}function Pl(n){const{masto:i}=re();return i.v1.notifications.list({accountID:n})}function Dl({request:n}){var p;const{instance:i}=re(),[s,o]=M("loading"),{account:c,lastStatus:r}=n,[u,l]=M(!1),[d,a]=M([]);function h(){l(!1)}return Q(()=>{var m;(m=n==null?void 0:n.account)!=null&&m.id&&u&&(o("loading"),(async()=>{const g=await Pl(n.account.id);a(g||[]),o("default")})())},[u,(p=n==null?void 0:n.account)==null?void 0:p.id]),e(U,{children:[e("button",{type:"button",class:"plain4 request-notifications-account",onClick:()=>{l(!0)},children:[e(I,{icon:"notification",class:"more-insignificant"})," ",e("small",{children:e(f,{id:"H0wUNM",values:{0:c.username},components:{0:e("span",{class:"bidi-isolate"})}})})," ",e(I,{icon:"chevron-down"})]}),u&&e(Ye,{onClick:m=>{m.target===m.currentTarget&&h()},children:e("div",{class:"sheet",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:h,children:e(I,{icon:"x",alt:t`Close`})}),e("header",{children:e("b",{children:e(f,{id:"MXOmPt",values:{0:c.username},components:{0:e("span",{class:"bidi-isolate"})}})})}),e("main",{children:s==="loading"?e("p",{class:"ui-state",children:e(Be,{abrupt:!0})}):d.map(m=>e("div",{class:"notification-peek",onClick:g=>{const{target:v}=g;(g.target.tagName==="BUTTON"||g.target.tagName==="A")&&h()},children:e(ln,{instance:i,notification:m,isStatic:!0})}))})]})})]})}function Ol({request:n,onChange:i}){const{_:s}=le(),{masto:o}=re(),[c,r]=M("default"),[u,l]=M(null),d=u!==null;return e("p",{class:"notification-request-buttons",children:[e("button",{type:"button",disabled:c==="loading"||d,onClick:()=>{r("loading"),(async()=>{try{await o.v1.notifications.requests.$select(n.id).accept(),l("accept"),r("default"),i({request:n,state:"accept"}),fe(s({id:"ZtBMwU",values:{0:n.account.username}}))}catch{r("error"),fe(s({id:"S92JKG"}))}})()},children:e(f,{id:"h7peZQ"})})," ",e("button",{type:"button",disabled:c==="loading"||d,class:"light danger",onClick:()=>{r("loading"),(async()=>{try{await o.v1.notifications.requests.$select(n.id).dismiss(),l("dismiss"),r("default"),i({request:n,state:"dismiss"}),fe(s({id:"ibBDry",values:{0:n.account.username}}))}catch{r("error"),fe(s({id:"S5aemF"}))}})()},children:e(f,{id:"1QfxQT"})}),e("span",{class:"notification-request-states",children:c==="loading"?e(Be,{abrupt:!0}):u==="accept"?e(I,{icon:"check-circle",alt:s({id:"bzMKg7"}),class:"notification-accepted"}):u==="dismiss"&&e(I,{icon:"x-circle",alt:s({id:"J6hrEy"}),class:"notification-dismissed"})})]})}const mo=ut(Ml),zl=20;function oi({local:n,columnMode:i,...s}){const{_:o}=le(),c=We(x),r=!!n,u=i?{}:Mt(),{masto:l,instance:d}=re({instance:(s==null?void 0:s.instance)||u.instance}),{masto:a,instance:h}=re(),p=o(r?{id:"u96B/B",values:{instance:d}}:{id:"PgVqvd",values:{instance:d}});tt(p,r?"/:instance?/p/l":"/:instance?/p");const m=j(),g=j();async function v(w){if(w||!g.current){const _={limit:zl,local:r||void 0};!r&&Je("@pixelfed/global-feed")&&(_.remote=!0),g.current=l.v1.timelines.public.list(_).values()}const b=await g.current.next();let{value:S}=b;return S!=null&&S.length&&(w&&(m.current=S[0].id),S.forEach(_=>{et(_,d)})),{...b,value:S}}async function y(){var w;try{const b=await l.v1.timelines.public.list({limit:1,local:r,since_id:m.current}).values().next();let{value:S}=b;const _=((w=S[0])==null?void 0:w.id)===m.current;return S!=null&&S.length&&!_?(S=zt(S,"public"),!0):!1}catch{return!1}}return e(At,{title:p,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:o(r?{id:"pJQgQV"}:{id:"cg0I+x"})}),e("div",{children:d})]}),id:"public",instance:d,emptyText:o({id:"BiZJ6G"}),errorText:o({id:"scd9lw"}),fetchItems:v,checkForUpdates:y,useItemID:!0,headerStart:e(U,{}),boostsCarousel:c.settings.boostsCarousel,filterContext:"public",headerEnd:e(dt,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(I,{icon:"more",size:"l",alt:o({id:"2FYpfJ"})})}),children:[e(ye,{href:r?`/#/${d}/p`:`/#/${d}/p/l`,children:r?e(U,{children:[e(I,{icon:"transfer"})," ",e("span",{children:e(f,{id:"dXMiUw"})})]}):e(U,{children:[e(I,{icon:"transfer"})," ",e("span",{children:e(f,{id:"t2B/we"})})]})}),e(Ve,{}),e(ye,{onClick:()=>{let w=prompt(o({id:"2MQ2cd"}));if(!/\./.test(w)){w&&alert(o({id:"7WddtO"}));return}w&&(w=w.toLowerCase().trim(),location.hash=r?`/${w}/p/l`:`/${w}/p`)},children:[e(I,{icon:"bus"})," ",e("span",{children:e(f,{id:"Sq04Yc"})})]}),h!==d&&e(ye,{onClick:()=>{location.hash=r?`/${h}/p/l`:`/${h}/p`},children:[e(I,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(f,{id:"iAzCp4",values:{currentInstance:h},components:{0:e("b",{})}})})]})]})},d+r)}const mn=5,Jn=40,Ul=new URLSearchParams,gn={block:"nearest",inline:"center",behavior:"smooth"};function go({columnMode:n,...i}){const{_:s}=le(),o=n?{}:Mt(),{masto:c,instance:r,authenticated:u}=re({instance:o.instance}),[l,d]=M("default"),[a]=n?[Ul]:vt(),h=j(),p=(i==null?void 0:i.query)||a.get("q"),m=n?"statuses":(i==null?void 0:i.type)||a.get("type");let g=s({id:"A1taO8"});if(p)switch(m){case"statuses":g=s({id:"6YeoAt",values:{q:p}});break;case"accounts":g=s({id:"fpgumQ",values:{q:p}});break;case"hashtags":g=s({id:"AuiMZZ",values:{q:p}});break;default:g=s({id:"wr3GZI",values:{q:p}})}tt(g,"/search");const[v,y]=M(!1),w=j(0);Q(()=>{w.current=0},[p,m]);const b=j();St(()=>{var $,K;(K=($=b.current)==null?void 0:$.scrollTo)==null||K.call($,0,0)},[p,m]);const[S,_]=M([]),[T,A]=M([]),[k,C]=M([]);Q(()=>{_([]),A([]),C([])},[p]);const E={statuses:S,accounts:T,hashtags:k},R={statuses:_,accounts:A,hashtags:C},[F,D]=M({}),W=async $=>{if(!($!=null&&$.length))return;const K=await Pn($,F);K&&D({...F,...K})};function G($){$&&(w.current=0),!(!$&&!u)&&(d("loading"),$&&!m&&(_(S.slice(0,mn)),A(T.slice(0,mn)),C(k.slice(0,mn))),(async()=>{var Y,te,J,ue,he,ne;const K={q:p,resolve:u,limit:mn};m&&(K.limit=Jn,K.type=m,u&&(K.offset=w.current));try{const we=await c.v2.search.list(K);if(m)if($){R[m](we[m]);const Ce=(Y=we[m])==null?void 0:Y.length;w.current=Jn,y(!!Ce)}else if(((J=(te=we[m])==null?void 0:te[0])==null?void 0:J.id)===((he=(ue=E[m])==null?void 0:ue[0])==null?void 0:he.id))y(!1);else{R[m](se=>[...se,...we[m]]);const Ce=(ne=we[m])==null?void 0:ne.length;w.current=w.current+Jn,y(!!Ce)}else _(we.statuses||[]),A(we.accounts||[]),C(we.hashtags||[]),w.current=0,y(!1);W(we.accounts),d("default")}catch{d("error")}})())}const X=j();Gt($=>{var Y;const K=((Y=b.current)==null?void 0:Y.scrollTop)===0;if($&&K){const te=Date.now()-X.current;!X.current||te>1e3*3?G(!0):X.current=Date.now()}}),Q(()=>{var K,Y;let $;return(Y=(K=h.current)==null?void 0:K.setValue)==null||Y.call(K,p||""),p?G(!0):$=setTimeout(()=>{var te,J;(J=(te=h.current)==null?void 0:te.focus)==null||J.call(te)},150),()=>clearTimeout($)},[p,m,r]),qe(["Slash","/"],$=>{var K,Y,te,J;(Y=(K=h.current)==null?void 0:K.focus)==null||Y.call(K),(J=(te=h.current)==null?void 0:te.select)==null||J.call(te)},{useKey:!0,preventDefault:!0,ignoreEventWhen:$=>$.metaKey||$.ctrlKey||$.altKey||$.shiftKey});const q=".timeline > li > a, .hashtag-list > li > a",Z=qe("j",()=>{const $=document.activeElement.closest(q),K=$==null?void 0:$.getBoundingClientRect(),Y=Array.from(b.current.querySelectorAll(q));if($&&K.top<b.current.clientHeight&&K.bottom>0){const te=Y.indexOf($);let J=Y[te+1];J&&(J.focus(),J.scrollIntoView(gn))}else{const te=Y.find(J=>{const ue=J.getBoundingClientRect();return ue.top>=44&&ue.left>=0});te&&(te.focus(),te.scrollIntoView(gn))}},{useKey:!0,ignoreEventWhen:$=>$.metaKey||$.ctrlKey||$.altKey||$.shiftKey}),B=qe("k",()=>{const $=document.activeElement.closest(q),K=$==null?void 0:$.getBoundingClientRect(),Y=Array.from(b.current.querySelectorAll(q));if($&&K.top<b.current.clientHeight&&K.bottom>0){const te=Y.indexOf($);let J=Y[te-1];J&&(J.focus(),J.scrollIntoView(gn))}else{const te=Y.find(J=>{const ue=J.getBoundingClientRect();return ue.top>=44&&ue.left>=0});te&&(te.focus(),te.scrollIntoView(gn))}},{useKey:!0,ignoreEventWhen:$=>$.metaKey||$.ctrlKey||$.altKey||$.shiftKey}),[ee]=ki();return e("div",{id:"search-page",class:"deck-container",tabIndex:"-1",ref:$=>{b.current=$,Z.current=$,B.current=$},children:e("div",{class:"timeline-deck deck",children:[e("header",{class:l==="loading"?"loading":"",children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:e($t,{})}),e(Qs,{ref:h}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{G(!0)},disabled:l==="loading",children:e(I,{icon:"search",size:"l",alt:s({id:"A1taO8"})})})})]})}),e("main",{children:[!!p&&!n&&e("div",{ref:ee,class:`filter-bar ${l==="loading"?"loading":""}`,children:[!!m&&e(ge,{to:`/search${p?`?q=${encodeURIComponent(p)}`:""}`,children:[e(I,{icon:"chevron-left"})," ",e(f,{id:"N40H+G"})]}),[{label:s({id:"bPwFdf"}),type:"accounts",to:`/search?q=${encodeURIComponent(p)}&type=accounts`},{label:s({id:"VwUsHI"}),type:"hashtags",to:`/search?q=${encodeURIComponent(p)}&type=hashtags`},{label:s({id:"+owNNn"}),type:"statuses",to:`/search?q=${encodeURIComponent(p)}&type=statuses`}].sort(($,K)=>$.type===m?-1:K.type===m?1:0).map($=>e(ge,{to:$.to,children:$.label},$.type))]}),p?e(U,{children:[(!m||m==="accounts")&&e(U,{children:[m!=="accounts"&&e("h2",{class:"timeline-header",children:[e(f,{id:"bPwFdf"})," ",e(ge,{to:`/search?q=${encodeURIComponent(p)}&type=accounts`,children:e(I,{icon:"arrow-right",size:"l",alt:s({id:"V1fa9u"})})})]}),T.length>0?e(U,{children:[e("ul",{class:"timeline flat accounts-list",children:T.map($=>e("li",{children:e(ft,{account:$,instance:r,showStats:!0,relationship:F[$.id]})},$.id))}),m!=="accounts"&&e("div",{class:"ui-state",children:e(ge,{class:"plain button",to:`/search?q=${encodeURIComponent(p)}&type=accounts`,children:[e(f,{id:"BMmtZ8"})," ",e(I,{icon:"arrow-right"})]})})]}):!m&&(l==="loading"?e("p",{class:"ui-state",children:e(Be,{abrupt:!0})}):e("p",{class:"ui-state",children:e(f,{id:"YYB61U"})}))]}),(!m||m==="hashtags")&&e(U,{children:[m!=="hashtags"&&e("h2",{class:"timeline-header",children:[e(f,{id:"VwUsHI"})," ",e(ge,{to:`/search?q=${encodeURIComponent(p)}&type=hashtags`,children:e(I,{icon:"arrow-right",size:"l",alt:s({id:"V1fa9u"})})})]}),k.length>0?e(U,{children:[e("ul",{class:"link-list hashtag-list",children:k.map($=>{var J;const{name:K,history:Y}=$,te=(J=Y==null?void 0:Y.reduce)==null?void 0:J.call(Y,(ue,he)=>ue+ +he.uses,0);return e("li",{children:e(ge,{to:r?`/${r}/t/${K}`:`/t/${K}`,children:[e(I,{icon:"hashtag",alt:"#"}),e("span",{children:K}),!!te&&e("span",{class:"count",children:Qe(te)})]})},`${K}-${te}`)})}),m!=="hashtags"&&e("div",{class:"ui-state",children:e(ge,{class:"plain button",to:`/search?q=${encodeURIComponent(p)}&type=hashtags`,children:[e(f,{id:"Nc/W5J"})," ",e(I,{icon:"arrow-right"})]})})]}):!m&&(l==="loading"?e("p",{class:"ui-state",children:e(Be,{abrupt:!0})}):e("p",{class:"ui-state",children:e(f,{id:"4MFM3P"})}))]}),(!m||m==="statuses")&&e(U,{children:[m!=="statuses"&&e("h2",{class:"timeline-header",children:[e(f,{id:"+owNNn"})," ",e(ge,{to:`/search?q=${encodeURIComponent(p)}&type=statuses`,children:e(I,{icon:"arrow-right",size:"l",alt:s({id:"V1fa9u"})})})]}),S.length>0?e(U,{children:[e("ul",{class:"timeline",children:S.map($=>e("li",{children:e(ge,{class:"status-link",to:r?`/${r}/s/${$.id}`:`/s/${$.id}`,children:e(Ge,{status:$})})},$.id))}),m!=="statuses"&&e("div",{class:"ui-state",children:e(ge,{class:"plain button",to:`/search?q=${encodeURIComponent(p)}&type=statuses`,children:[e(f,{id:"LYCgej"})," ",e(I,{icon:"arrow-right"})]})})]}):!m&&(l==="loading"?e("p",{class:"ui-state",children:e(Be,{abrupt:!0})}):e("p",{class:"ui-state",children:e(f,{id:"Hzi9AA"})}))]}),!!m&&(l==="default"?v?e(Tt,{onChange:$=>{$&&G()},children:e("button",{type:"button",class:"plain block",onClick:()=>G(),style:{marginBlockEnd:"6em"},children:e(f,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(f,{id:"2EYeAZ"})}):l==="loading"&&e("p",{class:"ui-state",children:e(Be,{abrupt:!0})}))]}):l==="loading"?e("p",{class:"ui-state",children:e(Be,{abrupt:!0})}):e("p",{class:"ui-state",children:e(f,{id:"fGn1Hk"})})]})]})})}const Bl=20,yo=10*60*1e3,Fl=bt(n=>n.v1.trends.links.list().values().next(),{maxAge:yo}),Kl=bt(n=>n.v1.trends.tags.list().values().next(),{maxAge:yo});function Hl(n){return Je("@pixelfed/trending")?n.pixelfed.v2.discover.posts.trending.list({range:"daily"}).values():n.v1.trends.statuses.list({limit:Bl}).values()}function ql(n,i){return n.v1.timelines.link.list(i).values()}function bo({columnMode:n,...i}){const{_:s}=le(),o=We(x),c=n?{}:Mt(),{masto:r,instance:u}=re({instance:(i==null?void 0:i.instance)||c.instance}),{masto:l,instance:d}=re(),a=s({id:"cI3UEs",values:{instance:u}});tt(a,"/:instance?/trending");const h=j(),p=u===d,[m,g]=M([]),[v,y]=M([]),w=j();async function b(X){var B;if(X||!w.current){if(w.current=Hl(r),Je("@mastodon/trending-hashtags"))try{const{value:ee}=await Kl(r);ee!=null&&ee.length&&g(ee)}catch{}if(Je("@mastodon/trending-links"))try{const{value:ee}=await Fl(r,u),$=(B=ee==null?void 0:ee.filter)==null?void 0:B.call(ee,K=>K.type==="link");$!=null&&$.length&&y($)}catch{}}const q=await w.current.next();let{value:Z}=q;return Z!=null&&Z.length&&(X&&(h.current=Z[0].id),Z.forEach(ee=>{et(ee,u)})),{...q,value:Z}}const[S,_]=M(!1),T=j(),[A,k]=M(null),C=!!A,E=j(),R=p&&Je("@mastodon/trending-link-posts");Q(()=>{A&&E.current&&E.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[A]);const F=j();async function D(X){(X||!T.current)&&(_(!0),T.current=ql(r,{url:A})),F.current=A;const q=await T.current.next();let{value:Z}=q;return Z!=null&&Z.length&&(Z=zt(Z,"public"),Z.forEach(B=>{et(B,u)})),F.current===A&&_(!1),{...q,value:Z}}async function W(){try{const X=await r.v1.trends.statuses.list({limit:1}).values().next();let{value:q}=X;return q=zt(q,"public"),q!=null&&q.length&&q[0].id!==h.current?(h.current=q[0].id,!0):!1}catch{return!1}}const G=Ae(()=>e(U,{children:[!!m.length&&e("div",{class:"filter-bar expandable",children:[e(I,{icon:"chart",class:"insignificant",size:"l"}),m.map((X,q)=>{const{name:Z,history:B}=X,ee=B.reduce(($,K)=>$+ +K.uses,0);return e(ge,{to:`/${u}/t/${Z}`,children:[e("span",{dir:"auto",children:[e("span",{class:"more-insignificant",children:"#"}),Z]}),e("span",{class:"filter-count",children:Qe(ee)})]},Z)})]}),!!v.length&&e("div",{class:"links-bar",children:[e("header",{children:e("h3",{children:e(f,{id:"9veeTb"})})}),v.map(X=>{var H,ke;const{authors:q,authorName:Z,authorUrl:B,blurhash:ee,description:$,height:K,image:Y,imageDescription:te,language:J,providerName:ue,providerUrl:he,publishedAt:ne,title:we,url:Ce,width:se}=X,Te=(ke=(H=q==null?void 0:q[0])==null?void 0:H.account)!=null&&ke.id?q[0].account:null,Ie=we.length<30,Pe=!!(Z||Te),$e=$s(Ce);let Ee;if(ee){const De=mi(ee),xe=xi(De);Ee=Ai([.6,xe[1],xe[2]])}return e("div",{children:[e("a",{ref:A===Ce?E:null,href:Ce,target:"_blank",rel:"noopener",class:`link-block ${C?A===Ce?"active":"inactive":""}`,style:Ee?{"--accent-color":`rgb(${Ee.join(",")})`,"--accent-alpha-color":`rgba(${Ee.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:Y,alt:te,width:se,height:K,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:$e})," ",!!ne&&e(U,{children:"· "}),!!ne&&e(U,{children:e(_t,{datetime:ne,format:"micro"})})]}),!!we&&e("h1",{class:"title",lang:J,dir:"auto",title:we,children:we})]}),!!$&&e("p",{class:`description ${Pe&&!Ie?"":"more-lines"}`,lang:J,dir:"auto",title:$,children:$}),Pe&&e(U,{children:[e("hr",{}),e("p",{class:"byline",children:e("small",{children:e(f,{id:"aavdrC",values:{0:Te?e(yt,{account:Te,showAvatar:!0}):B?e("a",{href:B,target:"_blank",rel:"noopener",children:Z}):Z}})})})]})]})]})}),R&&e("button",{type:"button",class:"small plain4 block",onClick:()=>{k(Ce)},disabled:Ce===A,children:[e(I,{icon:"comment2"})," ",e("span",{children:e(f,{id:"/bZzdR"})})," ",e(I,{icon:"chevron-down"})]})]},Ce)})]}),R&&!!v.length&&e("div",{class:`timeline-header-block ${C?"blended":""}`,children:C?e(U,{children:[e("div",{style:{width:50,flexShrink:0,textAlign:"center"},children:S?e(Be,{abrupt:!0}):e("button",{type:"button",class:"light",onClick:()=>{k(null)},children:e(I,{icon:"x",alt:s({id:"9Q/4xJ"})})})}),e("p",{children:e(f,{id:"BATCqf",values:{0:A.replace(/^https?:\/\/(www\.)?/i,"").replace(/\/$/,"")},components:{0:e("span",{class:"link-text"})}})})]}):e("p",{class:"insignificant",children:e(f,{id:"Vosm4k"})})})]}),[m,v,A,S]);return e(At,{title:a,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:e(f,{id:"4/iCqx"})}),e("div",{children:u})]}),id:"trending",instance:u,emptyText:s({id:"6HA9+s"}),errorText:s({id:"scd9lw"}),fetchItems:C?D:b,checkForUpdates:C?void 0:W,checkForUpdatesInterval:5*60*1e3,useItemID:!0,headerStart:e(U,{}),boostsCarousel:o.settings.boostsCarousel,filterContext:"public",timelineStart:G,refresh:A,clearWhenRefresh:!0,view:C?"link-mentions":void 0,headerEnd:e(dt,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(I,{icon:"more",size:"l",alt:s({id:"2FYpfJ"})})}),children:[e(ye,{onClick:()=>{let X=prompt(s({id:"2MQ2cd"}));if(!/\./.test(X)){X&&alert(s({id:"7WddtO"}));return}X&&(X=X.toLowerCase().trim(),location.hash=`/${X}/trending`)},children:[e(I,{icon:"bus"})," ",e("span",{children:e(f,{id:"Sq04Yc"})})]}),d!==u&&e(ye,{onClick:()=>{location.hash=`/${d}/trending`},children:[e(I,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(f,{id:"iAzCp4",values:{currentInstance:d},components:{0:e("b",{})}})})]})]})},u)}const rs={block:"nearest",inline:"nearest",behavior:"smooth"};function Yl(){const{_:n}=le();tt(n({id:"i0qMbr"}),"/");const i=We(x),{shortcuts:s}=i,o=s.map(c=>{if(!c)return null;const{type:r,...u}=c,l={following:Ri,notifications:mo,list:oo,public:oi,bookmarks:to,favourites:no,hashtag:so,mentions:lo,trending:bo,search:go}[r];return!l||r==="search"&&!u.query||r==="list"&&!u.id?null:e(l,{...u,columnMode:!0},r+JSON.stringify(u))});return qe(["1","2","3","4","5","6","7","8","9"],c=>{try{const r=parseInt(c.key,10)-1,u=document.querySelectorAll("#columns > *")[r];u&&(u.focus(),u.scrollIntoView(rs))}catch{}},{useKey:!0,ignoreEventWhen:c=>c.metaKey||c.ctrlKey||c.altKey||c.shiftKey}),qe(["[","]"],(c,r)=>{const u=r.keys[0],l=document.activeElement.closest("#columns > *"),d=Ot(),a=d?"]":"[",h=d?"[":"]";let p;u===a?p=l?l.previousElementSibling:document.querySelectorAll("#columns > *")[0]:u===h&&(p=l?l.nextElementSibling:document.querySelectorAll("#columns > *")[1]),p&&(p.focus(),p.scrollIntoView(rs))},{useKey:!0,ignoreEventWhen:c=>c.metaKey||c.ctrlKey||c.altKey||c.shiftKey}),e("div",{id:"columns",onContextMenu:c=>{c.target.closest(".deck > header")&&!c.target.closest("a")&&!c.target.closest("button")&&(c.preventDefault(),x.showShortcutsSettings=!0)},onFocus:()=>{const c=document.activeElement.closest("#columns > *");c&&document.querySelectorAll("#columns > *").forEach(r=>{r.classList.toggle("focus",r===c)})},children:o})}function jl(){var s;const{_:n}=le(),i=We(x);return __BENCHMARK.end("time-to-home"),Q(()=>{(async()=>{const o=await gt.drafts.keys();if(o.length){const c=An();o.filter(u=>u.startsWith(c)).length&&(x.showDrafts=!0)}})()},[]),e(U,{children:(i.settings.shortcutsViewMode==="multi-column"||!i.settings.shortcutsViewMode&&i.settings.shortcutsColumnsMode)&&((s=i.shortcuts)!=null&&s.length)?e(Yl,{}):e(Ri,{title:n({id:"i0qMbr"}),path:"/",id:"home",headerStart:!1,headerEnd:e(Vl,{})})})}function Vl(){const{_:n}=le(),i=We(x),s=j(),[o,c]=M(void 0);return e(U,{children:[e(ge,{ref:s,to:"/notifications",class:`button plain notifications-button ${i.notificationsShowNew?"has-badge":""} ${o||""}`,onClick:r=>{r.stopPropagation(),window.matchMedia("(min-width: calc(40em))").matches&&(r.preventDefault(),c(u=>u?void 0:"open"))},children:e(I,{icon:"notification",size:"l",alt:n({id:"iDNBZe"})})}),e(Wl,{state:o,anchorRef:s,onClose:()=>c(void 0)})]})}const Gl=5;function Wl({anchorRef:n,state:i,onClose:s}){const{masto:o,instance:c}=re(),r=We(x),[u,l]=M("default"),d=fo();async function a(){const w=await d.next(),b=ro(w.value);if(b!=null&&b.length){b.forEach(_=>{et(_.status,c,{skipThreading:!0})});const S=po(b);x.notificationsLast=S[0],x.notifications=S,o.v1.markers.create({notifications:{lastReadId:S[0].id}}).catch(()=>{})}return x.notificationsShowNew=!1,x.notificationsLastFetchTime=Date.now(),w}const[h,p]=M(!1);function m(){return o.v1.followRequests.list({limit:1})}function g({skipFollowRequests:w=!1}={}){l("loading"),(async()=>{try{if(await a(),!w){const b=await m();p(!!(b!=null&&b.length))}l("default")}catch{l("error")}})()}const v=j(),y=52;return Q(()=>{if(i==="open")if(r.notificationsShowNew){const w=v.current;(w==null?void 0:w.scrollTop)<=y&&g({skipFollowRequests:!0})}else g()},[i,r.notificationsShowNew]),e(pi,{ref:v,menuClassName:"notifications-menu",state:i,anchorRef:n,onClose:s,portal:{target:document.body},containerProps:{onClick:()=>{var w,b;(b=(w=v.current)==null?void 0:w.closeMenu)==null||b.call(w)}},overflow:"auto",viewScroll:"close",position:"anchor",align:"center",boundingBoxPadding:"8 8 8 8",children:[e("header",{children:e("h2",{children:e(f,{id:"iDNBZe"})})}),e(Dn.Provider,{value:"notifications",children:e("main",{children:r.notifications.length?e(U,{children:r.notifications.slice(0,Gl).map(w=>e(ln,{instance:c,notification:w,disableContextMenu:!0},w._ids||w.id))}):u==="loading"?e("div",{class:"ui-state",children:e(Be,{abrupt:!0})}):u==="error"&&e("div",{class:"ui-state",children:[e("p",{children:e(f,{id:"5GFQTh"})}),e("p",{children:e("button",{type:"button",onClick:g,children:e(f,{id:"KDw4GX"})})})]})})}),e("footer",{children:[e(ge,{to:"/mentions",class:"button plain",children:[e(I,{icon:"at"})," ",e("span",{children:e(f,{id:"/bZzdR"})})]}),e(ge,{to:"/notifications",class:"button plain2",children:[h?e(f,{id:"OdVhdR",components:{0:e("span",{class:"tag collapsed"}),1:e("span",{})}}):e("b",{children:e(f,{id:"gukqfD"})})," ",e(I,{icon:"arrow-right"})]})]})]})}const Zl=ut(jl),Xl=[/^\/@[^@\/]+\/(?:statuses|posts)\/([^\/]+)/i,/\/notes\/([^\/]+)/i,/^\/(?:notice|objects)\/([a-z0-9-]+)/i,/\/@[^@\/]+\/post\/([^\/]+)/i,/\/@[^@\/]+@?[^\/]+?\/([^\/]+)/i,/^\/p\/[^\/]+\/([^\/]+)/i];function vo(n){const i=URL.parse(n);if(!i)return{};const{hostname:s,pathname:o}=i;for(const c of Xl){const[,r]=o.match(c)||[];if(r)return{instance:s,id:r}}return{}}function Jl(n){const{instance:i,id:s}=vo(n);return i&&s?`/${i}/s/${s}`:null}function Ql(){const i=Jt().pathname.replace(/^\//,""),s=vo(i),o=s!=null&&s.instance?`/${s.instance}/s/${s.id}`:null,[c,r]=M("loading");return St(()=>{r("loading"),(async()=>{try{const{instance:u,id:l}=s;if(l){const{masto:d}=re({instance:u});if(await d.v1.statuses.$select(l).fetch()){window.location.hash=o+"?view=full";return}}}catch{}{const{masto:u,instance:l}=re(),d=await u.v2.search.list({q:i,limit:1,resolve:!0});if(d.statuses.length){const a=d.statuses[0];window.location.hash=`/${l}/s/${a.id}?view=full`}else if(d.accounts.length){const a=d.accounts[0];window.location.hash=`/${l}/a/${a.id}`}else o?window.location.hash=o+"?view=full":r("error")}})()},[o]),e("div",{class:"ui-state",tabIndex:"-1",children:[c==="loading"?e(U,{children:[e(Be,{abrupt:!0}),e("h2",{children:e(f,{id:"RTAr/z"})}),e("p",{children:e("a",{href:i,target:"_blank",rel:"noopener",children:i})})]}):e(U,{children:[e("h2",{children:e(f,{id:"ufzZSJ"})}),e("p",{children:e("a",{href:i,target:"_blank",rel:"noopener",children:i})})]}),e("hr",{}),e("p",{children:e(ge,{to:"/",children:e(f,{id:"iWpEwy"})})})]})}function ed(){const{_:n}=le();tt(n({id:"h16FyT"}),"/l");const[i,s]=M("default"),[o,c]=Lt(h=>h+1,0),[r,u]=M([]);Q(()=>{s("loading"),(async()=>{try{const h=await ii();u(h),s("default")}catch{s("error")}})()},[o]);const[l,d]=M(!1),a=r.some(h=>h.exclusive);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($t,{}),e(ge,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l"})})]}),e("h1",{children:e(f,{id:"h16FyT"})}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>d(!0),children:e(I,{icon:"plus",size:"l",alt:n({id:"Sb2gYF"})})})})]})}),e("main",{children:r.length>0?e(U,{children:[e("ul",{class:"link-list",children:r.map(h=>e("li",{children:e(ge,{to:`/l/${h.id}`,children:[e(I,{icon:"list"})," ",e("span",{children:[h.title,h.exclusive&&e(U,{children:[" ",e(Bt,{insignificant:!0})]})]})]})}))}),r.length>1&&e("footer",{class:"ui-state",children:[a&&e("p",{children:e("small",{class:"insignificant",children:[e(Bt,{})," ",e(f,{id:"FNptcJ"})]})}),e("p",{children:e("small",{class:"insignificant",children:e(f,{id:"8prZNK",values:{0:r.length}})})})]})]}):i==="loading"?e("p",{class:"ui-state",children:e(Be,{})}):i==="error"?e("p",{class:"ui-state",children:e(f,{id:"v/l5uA"})}):e("p",{class:"ui-state",children:e(f,{id:"IvPikw"})})})]}),l&&e(Ye,{onClick:h=>{h.target===h.currentTarget&&d(!1)},children:e(Ti,{list:l==null?void 0:l.list,onClose:h=>{h.state==="success"&&c(),d(!1)}})})]})}const td=""+new URL("instances-LA7224ZB.json",import.meta.url).href,nd={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",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",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_DEFAULT_INSTANCE:id}=nd;function sd(){var _,T;const{_:n}=le();tt(n({id:"sQia9P"}),"/login");const i=j(),s=Ue.local.get("instanceURL"),[o,c]=M("default"),[r]=vt(),u=r.get("instance"),l=r.get("submit"),[d,a]=M(u||(s==null?void 0:s.toLowerCase())||""),[h,p]=M([]),m=j();Q(()=>{(async()=>{try{const k=await(await fetch(td)).json();p(k),m.current=new oc(k)}catch{}})()},[]);const g=A=>{A&&(async()=>{try{const C=await(await fetch(`https://${A}/.well-known/host-meta`)).text(),D=new DOMParser().parseFromString(C,"text/xml").getElementsByTagName("Link")[0].getAttribute("template"),W=URL.parse(D),{host:G}=W;A!==G&&(A=G)}catch{}Ue.local.set("instanceURL",A),c("loading");try{let k=Cs(A);k||(k=await Bc({instanceURL:A}),Po(A,k));const{client_id:C,client_secret:E}=k,R=await Nc({instanceURL:A}),F=Do(A);if(R)if(C&&E){const[D,W]=await Fc({instanceURL:A,client_id:C,forceLogin:F});Ue.sessionCookie.set("codeVerifier",W),location.href=D}else alert(n({id:"ZP1FIA"}));else C&&E?location.href=await Kc({instanceURL:A,client_id:C,forceLogin:F}):alert(n({id:"ZP1FIA"}));c("default")}catch{c("error")}})()},v=d?d.replace(/^https?:\/\//,"").replace(/\/+$/,"").replace(/^@?[^@]+@/,"").trim():null,y=/[^\s\r\n\t\/\\]+\.[^\s\r\n\t\/\\]+/.test(v)&&!/[\s\/\\@]/.test(v),w=v?(T=(_=m.current)==null?void 0:_.search(v,{limit:10}))==null?void 0:T.map(A=>A.item):[],b=y?v:w!=null&&w.length?w[0]:d?h.find(A=>A.includes(d)):null,S=A=>{A.preventDefault(),g(b)};return l&&Q(()=>{g(u||b)},[]),e("main",{id:"login",style:{textAlign:"center"},children:e("form",{onSubmit:S,children:[e("h1",{children:[e("img",{src:_i,alt:"",width:"80",height:"80"}),e("br",{}),e(f,{id:"sQia9P"})]}),e("label",{children:[e("p",{children:e(f,{id:"kyAi7k"})}),e("input",{value:d,required:!0,type:"text",class:"large",id:"instanceURL",ref:i,disabled:o==="loading",autocorrect:"off",autocapitalize:"off",autocomplete:"off",spellCheck:!1,placeholder:n({id:"u3gOdY"}),onInput:A=>{a(A.target.value)},dir:"auto"}),(w==null?void 0:w.length)>0?e("ul",{id:"instances-suggestions",children:w.map((A,k)=>e("li",{children:e("button",{type:"button",class:"plain5",onClick:()=>{g(A)},children:A})}))}):e("div",{id:"instances-eg",children:e(f,{id:"/OvbEC"})})]}),o==="error"&&e("p",{class:"error",children:e(f,{id:"rmBHZn"})}),e("div",{children:[e("button",{disabled:o==="loading"||!d||!b,children:n(b?{id:"2xahsi",values:{selectedInstanceText:b}}:{id:"xGVfLh"})})," "]}),e(Be,{hidden:o!=="loading"}),e("hr",{}),!id&&e("p",{children:e("a",{href:"https://joinmastodon.org/servers",target:"_blank",children:e(f,{id:"LcOiWS"})})}),e("p",{children:e(ge,{to:"/",children:e(f,{id:"iWpEwy"})})}),e(Ci,{})]})})}const od=40;function cd(){const{_:n}=le(),i=We(x);tt(n({id:"+GkIdc"}),"/sp");const{masto:s}=re(),[o,c]=M([]),[r,u]=M("default"),[l,d]=Lt(p=>p+1,0),[a,h]=M(!1);return Q(d,[i.reloadScheduledPosts]),Q(()=>{u("loading"),(async()=>{try{const p=s.v1.scheduledStatuses.list({limit:od}).values(),m=[];let g;do g=(await p.next()).value,g!=null&&g.length&&m.push(...g);while(g!=null&&g.length);c(m)}catch{u("error")}finally{u("default")}})()},[l]),e("div",{id:"scheduled-posts-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($t,{}),e(ge,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l",alt:n({id:"i0qMbr"})})})]}),e("h1",{children:e(f,{id:"+GkIdc"})}),e("div",{class:"header-side",children:e(dt,{portal:!0,setDownOverflow:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(I,{icon:"more",size:"l",alt:n({id:"2FYpfJ"})})}),children:e(ye,{onClick:()=>{d()},children:[e(I,{icon:"refresh",size:"l"}),e("span",{children:e(f,{id:"lCF0wC"})})]})})})]})}),e("main",{children:[o.length?e("ul",{class:"posts-list",children:o.map(p=>{const{id:m,params:g,scheduledAt:v,mediaAttachments:y}=p,{inReplyToId:w,language:b,poll:S,sensitive:_,spoilerText:T,text:A,visibility:k}=g,C={id:m,inReplyToId:w,language:b,mediaAttachments:y,poll:S?{...S,expiresAt:new Date(Date.now()+S.expiresIn*1e3),options:S.options.map(E=>({title:E,votesCount:0}))}:void 0,sensitive:_,spoilerText:T,text:A,visibility:k,content:`<p>${A}</p>`};return e("li",{children:e(ad,{status:C,scheduledAt:v,onClick:()=>{h({post:C,scheduledAt:new Date(v)})}})},m)})}):e("p",{class:"ui-state",children:r==="loading"?e(Be,{}):n({id:"mZYb1f"})}),a&&e(Ye,{onClick:p=>{p.target===p.currentTarget&&h(!1)},children:e(rd,{post:a.post,scheduledAt:a.scheduledAt,onClose:()=>h(!1)})})]})]})})}function ad({status:n,scheduledAt:i,onClick:s}){const o=Ae(()=>{const c=(new Date(i).getTime()-Date.now())/36e5;return c<24?"time":c<720?"day":"month"},[i]);return e("button",{type:"button",class:"textual block",onClick:s,children:[e("div",{class:`post-schedule-meta post-schedule-${o}`,children:[e(I,{icon:o,class:"insignificant"})," ",e("span",{children:e(f,{id:"aEp6lO",values:{0:ct(i,{formatOpts:{weekday:"short",second:"numeric"}})},components:{0:e("b",{}),1:e(_t,{datetime:i}),2:e("small",{})}})})]}),e(Ge,{status:n,size:"s",previewMode:!0,readOnly:!0})]})}function rd({post:n,scheduledAt:i,onClose:s}){const{masto:o}=re(),{_:c}=le(),[r,u]=M("default"),[l,d]=M(),a=l&&l.getTime()!==i.getTime(),h=cc(),p=i&&i<=Date.now(),{inReplyToId:m}=n,[g,v]=M(null);return e("div",{id:"scheduled-post-sheet",class:"sheet",children:[e("button",{type:"button",class:"sheet-close",onClick:s,children:e(I,{icon:"x",size:"l",alt:c({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:[e(f,{id:"orjBLU",components:{0:e("b",{}),1:e(_t,{datetime:i})}}),e("br",{}),e("small",{children:ct(i,{formatOpts:{weekday:"short",second:"numeric"}})})]})}),e("main",{tabIndex:"-1",children:[!!g&&e("div",{class:"status-reply",children:e(Ge,{status:g,size:"s",previewMode:!0,readOnly:!0})}),e(Ge,{status:n,size:"s",previewMode:!0,readOnly:!0,onMediaClick:(y,w,b,S)=>{y.preventDefault(),x.showMediaModal={mediaAttachments:n.mediaAttachments,mediaIndex:w}}}),e("form",{onSubmit:y=>{y.preventDefault(),u("loading"),(async()=>{try{await o.v1.scheduledStatuses.$select(n.id).update({scheduledAt:l.toISOString()}),fe(c({id:"40naR1"})),s(),u("default"),x.reloadScheduledPosts++}catch{u("error"),fe(c({id:"ZM3jAs"}))}})()},children:e("footer",{children:[e("div",{class:"row",children:e("span",{children:[e(ac,{scheduledAt:i,setScheduledAt:y=>{d(y)}})," ",e("small",{class:"ib",children:h})]})}),e("div",{class:"row",children:[e("button",{disabled:!a||r==="loading"||p,children:e(f,{id:"QqW27M"})}),e("span",{class:"grow"}),e(pt,{align:"end",menuItemClassName:"danger",confirmLabel:c({id:"09u3Kk"}),onClick:()=>{u("loading"),(async()=>{try{await re().masto.v1.scheduledStatuses.$select(n.id).remove(),fe(c({id:"/zL/Mq"})),s(),u("default"),x.reloadScheduledPosts++}catch{u("error"),fe(c({id:"aOh6Md"}))}})()},children:e("button",{type:"button",class:"light danger",disabled:r==="loading"||p,children:e(f,{id:"Jb6/SB"})})})]})]})})]})]})}const ld={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",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",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_DEFAULT_INSTANCE:ls}=ld,yn=40,dd=10,ud=5;let ci={},Sn={},_n={};function Cn(n){delete Sn[n],delete _n[n]}const tn={block:"nearest",inline:"center",behavior:"smooth"},ds=".status-link:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *), .status-focus:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *)",us=/\/s\//i;function hd(n){var C;const{_:i}=le(),{id:s}=n,{masto:o,instance:c}=re({instance:n.instance}),r=We(x),[u,l]=vt(),d=u.get("media"),a=u.get("media-only"),h=parseInt(d||a,10);let p=h>0;const m=u.get("mediaStatusID"),g=_s(m,c);m&&!g&&(p=!1);const v=p&&!!a,y=lt(s,c),[w,b]=M(x.statuses[y]);Q(()=>{x.statuses[y]&&b(x.statuses[y])},[y]);const S=Ae(()=>{const{prevLocation:E}=x,R=((E==null?void 0:E.pathname)||"")+((E==null?void 0:E.search)||""),F=cn("/:instance/s/:id",R)||cn("/s/:id",R);return!R||F?"/":R},[]);Q(()=>{!w&&p&&(async()=>{try{const E=await o.v1.statuses.$select(s).fetch();et(E,c),b(E)}catch{alert("Unable to load post."),location.hash=S}})()},[p]);const _=m?(C=r.statuses[lt(m,c)])==null?void 0:C.mediaAttachments:w==null?void 0:w.mediaAttachments,T=()=>window.matchMedia("(min-width: calc(40em + 350px))").matches?"large":"small",A=it(()=>{T()==="small"&&r.prevLocation?history.back():v?location.hash=S:(u.delete("media"),u.delete("mediaStatusID"),l(u))},[v,S,r.prevLocation]),k=it((E,R,F,D)=>{var W,G;if(T()==="large"&&!v){A();return}if(p&&document.startViewTransition){const X=F[R],{id:q,blurhash:Z,url:B}=X,ee=rc(q||Z||B),K=(G=(W=[...document.querySelectorAll(`.status .media [data-view-transition-name="${ee}"]`)]).filter)==null?void 0:G.call(W,te=>{const J=te.getBoundingClientRect();return J.top<window.innerHeight&&J.bottom>0&&J.left<window.innerWidth&&J.right>0}),Y=K.length===1?K[0]:K.find(te=>!!te.closest(".status-deck"));Y?document.startViewTransition(()=>{var J;Y.style.viewTransitionName=ee,D!=null&&D.current&&((J=D.current.querySelectorAll(".media img, .media video"))==null||J.forEach(ue=>{ue.style.viewTransitionName=""})),A()}).ready.finally(()=>{Y.style.viewTransitionName=""}):A()}else A()},[p,v]);return Q(()=>{let E=setTimeout(()=>{const R=document.querySelector(".carousel");R&&R.focus()},100);return()=>clearTimeout(E)},[v]),Q(()=>{const E=document.querySelectorAll(".deck-container");return E.forEach(R=>{R.setAttribute("inert","")}),()=>{E.forEach(R=>{R.removeAttribute("inert")})}},[]),e("div",{class:"deck-backdrop",children:[p?_!=null&&_.length?e(Xs,{mediaAttachments:_,statusID:m||s,instance:c,lang:w==null?void 0:w.language,index:h-1,onClose:k}):e("div",{class:"media-modal-container loading",children:e(Be,{abrupt:!0})}):e(ge,{to:S}),!v&&e(pd,{id:s,instance:n.instance,closeLink:S})]})}function fd(n){const{linkable:i,to:s,onClick:o,...c}=n;return i?e(ge,{class:"status-link",to:s,onClick:o,...c}):e("div",{class:"status-focus",tabIndex:0,...c})}function hs(n,i){return new Date(i.created_at)-new Date(n.created_at)}function pd({id:n,closeLink:i="/",instance:s}){var Me,me;const{_:o}=le(),[c,r]=vt(),u=c.get("media"),l=c.get("mediaStatusID"),d=parseInt(u,10)>0,a=j(!x.prevLocation&&(history.length===1||"navigation"in window&&((me=(Me=navigation==null?void 0:navigation.entries)==null?void 0:Me.call(navigation))==null?void 0:me.length)===1)),[h,p]=M(c.get("view")||a.current?"full":null),m=!!parseInt(c.get("translate")),{masto:g,instance:v}=re({instance:s}),{masto:y,instance:w,authenticated:b}=re(),S=v===w,_=We(x),[T,A]=M([]),[k,C]=M("default"),E=j(),R=lt(n,v),F=j(0),D=j();Q(()=>{var N;(N=D.current)==null||N.focus()},[]),Q(()=>{var O;const N=Ps(()=>{if(!D.current)return;const{scrollTop:oe}=D.current;k!=="loading"&&(_n[n]=oe)},50);return(O=D.current)==null||O.addEventListener("scroll",N,{passive:!0}),N(),()=>{var oe;N.cancel(),(oe=D.current)==null||oe.removeEventListener("scroll",N)}},[n,k!=="loading"]);const W=j(),G=j(),X=({reloadHero:N}={})=>{C("loading");let O;const oe=Sn[n];if(oe){const Le=oe.filter(P=>x.statuses[R]);A(Le)}else A([{id:n}]);return(async()=>{var Ne,Oe;const Le=()=>Di(()=>g.v1.statuses.$select(n).fetch(),{retries:4}),P=Di(()=>g.v1.statuses.$select(n).context.fetch(),{retries:8}),ce=!!_.statuses[R];let Se=_.statuses[R];if(!(ce&&!N))try{Se=await Le(),et(Se,v),await new Promise(L=>{setTimeout(L,100)})}catch{C("error");return}try{let L=function(de,ze){const Ke=ze+1;return Ke>_e&&(_e=ze),de==null?void 0:de.map(nt=>({id:nt.id,account:nt.account,repliesCount:nt.repliesCount,content:nt.content,weight:on(nt),level:Ke,replies:L(nt.__replies,Ke)}))};const V=await P,{ancestors:ae,descendants:ie}=V;ae.sort(hs),ie.sort(hs),F.current=(ie==null?void 0:ie.length)||0;const z=new Set;ae.forEach(de=>{et(de,v,{skipThreading:!0}),de.inReplyToId&&!ae.find(ze=>ze.id===de.inReplyToId)&&z.add(de.inReplyToId)});const be=ae.every(de=>de.account.id===Se.account.id),ve=[];ie.forEach(de=>{if(et(de,v,{skipThreading:!0}),de.inReplyToId&&!ie.find(ze=>ze.id===de.inReplyToId)&&de.inReplyToId!==Se.id&&z.add(de.inReplyToId),de.inReplyToAccountId===de.account.id)ve.push(de);else if(de.inReplyToId===Se.id)ve.push(de);else if(!de.inReplyToAccountId&&ve.find(ze=>ze.id===de.inReplyToId&&ze.account.id===Se.account.id)&&de.account.id===Se.account.id)ve.push(de);else{const ze=ie.find(Ke=>Ke.id===de.inReplyToId);ze&&(ze.__replies||(ze.__replies=[]),ze.__replies.push(de))}}),ve.sort((de,ze)=>{const Ke=Se.account.id;return de.account.id===Ke&&ze.account.id!==Ke?-1:ze.account.id===Ke&&de.account.id!==Ke?1:0}),z.size;let _e=1;const Ze=[...ae.map(de=>({id:de.id,ancestor:!0,isThread:be,accountID:de.account.id,account:de.account,repliesCount:de.repliesCount,weight:on(de)})),{id:n,accountID:Se.account.id,weight:on(Se)},...ve.map(de=>({id:de.id,account:de.account,accountID:de.account.id,descendant:!0,thread:de.account.id===Se.account.id,weight:on(de),level:1,replies:L(de.__replies,1)}))];C("default"),W.current={offsetTop:(Ne=E.current)==null?void 0:Ne.offsetTop,scrollTop:(Oe=D.current)==null?void 0:Oe.scrollTop};const Fe=ae.length||0;Fe>=te&&J(Fe+1),A(Ze),Sn[n]=Ze,Oo(Se,v)}catch{C("error")}})(),G.current=Date.now(),()=>{clearTimeout(O)}};Q(X,[n,g]);const[q,Z]=M(!1);Q(()=>{let N=setInterval(()=>{const O=Date.now();G.current&&O-G.current>=6e4&&Z(!0)},6e4);return()=>{clearInterval(N)}},[]),St(()=>{var O,oe;if(!T.length)return;const N=_n[n];if(N)D.current.scrollTop=N;else if(W.current){const Le={offsetTop:(O=E.current)==null?void 0:O.offsetTop,scrollTop:(oe=D.current)==null?void 0:oe.scrollTop},P=Le.offsetTop-W.current.offsetTop+Le.scrollTop;D.current.scrollTop=P}else T.length===1&&(D.current.scrollTop=0);W.current=null},[T]),Q(()=>{_.reloadStatusPage<=0||(async()=>{try{const{instanceURL:N}=di(),O=`https://${N}/api/v1/statuses/${n}/context`;return await(await caches.open("api")).delete(O,{ignoreVary:!0}),X({reloadHero:!0})}catch{}})()},[_.reloadStatusPage]),Q(()=>()=>{_n={},x.reloadStatusPage=0,Sn={},ci={},ai.clear()},[]);const B=_.statuses[R]||_.statuses[n],ee=Ae(()=>{if(!B)return"";const{account:N}=B,O=document.createElement("div");return O.innerHTML=N.displayName,O.innerText.trim()},[B]),$=Ae(()=>{if(!B)return"";let N=Nn(B);return N.length>64&&(N=N.slice(0,64)+"…"),N},[B]);tt(ee&&$?`${ee}: "${$}"`:o({id:"post.title"}),"/:instance?/s/:id");const K=Ae(()=>{var O;if(!B)return;const{url:N}=B;if(N)return(O=URL.parse(N))==null?void 0:O.hostname},[B]),Y=Ae(()=>{if(K)return K===v},[K,v]),[te,J]=M(yn),ue=Ae(()=>T.length-te,[T.length,te]),he=T.some(N=>N.descendant),ne=T.filter(N=>N.ancestor),[we,Ce]=M(!0),se=Ae(()=>{if(!E.current||we)return null;const{top:N}=E.current.getBoundingClientRect();return N>0?"down":"up"},[we]);qe("esc",()=>{location.hash=i},{enabled:!d,ignoreEventWhen:N=>!!document.querySelector("#modal-container > *")||N.metaKey||N.ctrlKey||N.altKey||N.shiftKey,useKey:!0}),qe("backspace",()=>{location.hash=i},{useKey:!0,ignoreEventWhen:N=>N.metaKey||N.ctrlKey||N.altKey||N.shiftKey}),qe("j",()=>{const N=document.activeElement.closest(".status-link, .status-focus"),O=N==null?void 0:N.getBoundingClientRect(),oe=Array.from(D.current.querySelectorAll(ds));if(N&&O.top<D.current.clientHeight&&O.bottom>0){const Le=oe.indexOf(N);let P=oe[Le+1];P&&(P.focus(),P.scrollIntoView(tn))}else{const Le=oe.find(P=>{const ce=P.getBoundingClientRect();return ce.top>=44&&ce.left>=0});Le&&(Le.focus(),Le.scrollIntoView(tn))}},{useKey:!0,ignoreEventWhen:N=>N.metaKey||N.ctrlKey||N.altKey||N.shiftKey}),qe("k",()=>{const N=document.activeElement.closest(".status-link, .status-focus"),O=N==null?void 0:N.getBoundingClientRect(),oe=Array.from(D.current.querySelectorAll(ds));if(N&&O.top<D.current.clientHeight&&O.bottom>0){const Le=oe.indexOf(N);let P=oe[Le-1];P&&(P.focus(),P.scrollIntoView(tn))}else{const Le=oe.find(P=>{const ce=P.getBoundingClientRect();return ce.top>=44&&ce.left>=0});Le&&(Le.focus(),Le.scrollIntoView(tn))}},{useKey:!0,ignoreEventWhen:N=>N.metaKey||N.ctrlKey||N.altKey||N.shiftKey}),qe("x",()=>{const N=document.activeElement.closest(".status-link, .status-focus");if(N){const O=N.nextElementSibling;O&&O.tagName.toLowerCase()==="details"&&(O.open=!O.open)}},{useKey:!0,ignoreEventWhen:N=>N.metaKey||N.ctrlKey||N.altKey||N.shiftKey});const[Te,Ie]=M(!1),Pe=j(d?"media+status":"status"),$e=it((N,O,oe,Le)=>{N.preventDefault(),N.stopPropagation(),r({media:O+1,mediaStatusID:Le.id})},[n]),Ee=it((N,O)=>{Cn(O.id)},[]);Q(()=>{let N;return l&&d&&(N=setTimeout(()=>{var oe;const O=(oe=D.current)==null?void 0:oe.querySelector(`.status-link[href*="/${l}"]`);O&&O.scrollIntoView(tn)},400)),()=>{clearTimeout(N)}},[l,d]);const H=it((N,O)=>{const{id:oe,ancestor:Le,isThread:P,descendant:ce,thread:Se,replies:Ne,repliesCount:Oe,weight:L,level:V}=N,ae=oe===n;return e("li",{ref:ae?E:null,class:`${Le?"ancestor":""} ${ce?"descendant":""} ${Se?"thread":""} ${ae?"hero":""}`,children:[ae?e(U,{children:[e(Tt,{threshold:.1,onChange:z=>{queueMicrotask(()=>{requestAnimationFrame(()=>{Ce(z)})})},class:"status-focus",tabIndex:0,children:e(Ge,{statusID:oe,instance:v,withinContext:!0,size:"l",enableTranslate:!0,forceTranslate:m})}),k!=="loading"&&!b?e("div",{class:"post-status-banner",children:[e("p",{children:e(f,{id:"Vyeh4F"})}),e(ge,{to:ls?`/login?instance=${ls}&submit=1`:"/login",class:"button",children:e(f,{id:"sQia9P"})})]}):!S&&e("div",{class:"post-status-banner",children:[e("p",{children:e(f,{id:"j5roNG",values:{instance:v},components:{0:e("b",{})}})}),e("button",{type:"button",disabled:k==="loading",onClick:()=>{C("loading"),(async()=>{try{const z=await y.v2.search.list({q:B.url,type:"statuses",resolve:!0,limit:1});if(z.statuses.length){const be=z.statuses[0];location.hash=w?`/${w}/s/${be.id}`:`/s/${be.id}`}else throw new Error("No results")}catch(z){C("default"),alert(o({id:"DnepCE",values:{e:z}}))}})()},children:[e(I,{icon:"transfer"})," ",e(f,{id:"ejAVrO"})]})]})]}):e(fd,{linkable:P||Le,to:v?`/${v}/s/${oe}`:`/s/${oe}`,onClick:()=>{Cn(oe)},children:[O===0&&Le?e(Tt,{threshold:.5,onChange:z=>{queueMicrotask(()=>{requestAnimationFrame(()=>{Ie(z)})})},children:e(Ge,{statusID:oe,instance:v,withinContext:!0,size:Se||Le?"m":"s",enableTranslate:!0,onMediaClick:$e,onStatusLinkClick:Ee})}):e(Ge,{statusID:oe,instance:v,withinContext:!0,size:Se||Le?"m":"s",enableTranslate:!0,onMediaClick:$e,onStatusLinkClick:Ee,showActionsBar:!!ce}),Le&&Oe>1&&e("div",{class:"replies-link",children:[e(I,{icon:"comment2",alt:o({id:"N8UzTV"})})," ",e("span",{title:Oe,children:Qe(Oe)})]})," "]}),ce&&(Ne==null?void 0:Ne.length)>0&&e(wo,{instance:v,replies:Ne,hasParentThread:Se,level:V,accWeight:L,openAll:F.current<dd,parentLink:{to:v?`/${v}/s/${oe}`:`/s/${oe}`,onClick:()=>Cn(oe)}}),k==="loading"&&ae&&!!(B!=null&&B.repliesCount)&&!he&&e("div",{class:"status-loading",children:e(Be,{abrupt:B.repliesCount>=3})}),k==="error"&&ae&&!!(B!=null&&B.repliesCount)&&!he&&e("div",{class:"status-error",children:[e(f,{id:"HQJU6W"}),e("br",{}),e("button",{type:"button",class:"plain",onClick:()=>{x.reloadStatusPage++},children:e(f,{id:"KDw4GX"})})]})]},oe)},[n,v,k,b,S,m,$e,Ee,he]),ke=Ae(()=>{var N;if("navigation"in window&&(navigation!=null&&navigation.entries)){const O=navigation.entries()[navigation.currentEntry.index-1];if(O!=null&&O.url)return us.test(O.url)}return us.test((N=x.prevLocation)==null?void 0:N.pathname)},[R]),De=Ae(()=>{if(!ue)return[];const N=[];function O(oe){N.push(oe.id),oe.replies&&oe.replies.forEach(O)}return T.slice(te).forEach(O),N.map(oe=>lt(oe,v))},[ue,T,te,v]),xe=Ae(()=>T.slice(0,te).map(H),[T,te,H]);return Q(()=>{let N=setTimeout(()=>{if(!E.current)return;const O=E.current.querySelector(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)");O&&O.click()},1e3);return()=>clearTimeout(N)},[n]),e("div",{tabIndex:"-1",ref:D,class:`status-deck deck contained ${T.length>1?"padded-bottom":""} ${Pe.current==="status"&&!a.current?"slide-in":""} ${h?`deck-view-${h}`:""}`,onAnimationEnd:N=>{Pe.current==="status"&&(Pe.current=null)},children:[e("header",{class:`${k==="loading"?"loading":""}`,onDblClick:N=>{x.reloadStatusPage++},children:e("div",{class:"header-grid header-grid-2",children:[e("h1",{children:[ke&&e("button",{type:"button",class:"plain deck-back",onClick:()=>{history.back()},children:e(I,{icon:"chevron-left",size:"xl",alt:o({id:"iH8pgl"})})}),!we&&B&&k!=="loading"?e(U,{children:[e("span",{class:"hero-heading",children:[e(yt,{account:B.account,instance:v,showAvatar:!0,short:!0})," ",e("span",{class:"insignificant",children:["•"," ",e(_t,{datetime:B.createdAt,format:"micro"})]})]})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:N=>{N.preventDefault(),N.stopPropagation(),E.current.scrollIntoView({behavior:"smooth",block:"start"})},title:o({id:"NCy+Nw"}),children:e(I,{icon:se==="down"?"arrow-down":"arrow-up"})})]}):e(U,{children:[e(f,{id:"post.title"})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:N=>{N.preventDefault(),N.stopPropagation(),D.current.scrollTo({top:0,behavior:"smooth"})},hidden:!ne.length||Te,title:o({id:"R8CUl0",values:{0:ne.length}}),children:[e(I,{icon:"arrow-up"}),ne.filter((N,O,oe)=>oe.findIndex(Le=>Le.accountID===N.accountID)===O).slice(0,3).map(N=>{var O;return e(mt,{url:N.account.avatarStatic||N.account.avatar,alt:N.account.displayName,squircle:(O=N.account)==null?void 0:O.bot},N.account.id)}),ne.length>3&&e(U,{children:[" ",e("span",{class:"insignificant",children:Qe(ne.length)})]})]})]})]}),e("div",{class:"header-side",children:[e("button",{type:"button",class:"plain4 button-switch-view",style:{display:h==="full"?"":"none"},onClick:()=>{p(null),c.delete("media"),c.delete("media-only"),c.delete("view"),r(c)},title:o({id:"+/xYEI"}),children:e(I,{icon:"layout4",size:"l"})}),q&&e("button",{type:"button",class:"plain button-refresh",onClick:()=>{x.reloadStatusPage++,Z(!1)},children:e(I,{icon:"refresh",size:"l",alt:o({id:"lCF0wC"})})}),e(dt,{align:"end",portal:{target:D.current},menuButton:e("button",{type:"button",class:"button plain4",children:e(I,{icon:"more",alt:o({id:"2FYpfJ"}),size:"xl"})}),children:[e(ye,{disabled:k==="loading",onClick:()=>{x.reloadStatusPage++},children:[e(I,{icon:"refresh"}),e("span",{children:e(f,{id:"lCF0wC"})})]}),e(ye,{className:"menu-switch-view",onClick:()=>{p(h==="full"?null:"full"),c.delete("media"),c.delete("media-only"),h==="full"?c.delete("view"):c.set("view","full"),r(c)},children:[e(I,{icon:{"":"layout5",full:"layout4"}[h||""]}),e("span",{children:o(h==="full"?{id:"+/xYEI"}:{id:"2LiWsE"})})]}),e(ye,{onClick:()=>{Array.from(D.current.querySelectorAll(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)")).forEach(O=>{O.click()})},children:[e(I,{icon:"eye-open"})," ",e("span",{children:e(f,{id:"8r8KmB"})})]}),e(Ve,{}),e(gi,{className:"plain",children:e(f,{id:"Rsjgm0"})}),e(ye,{disabled:!K||Y,onClick:()=>{const N=Jl(B.url);N?location.hash=N:alert(o({id:"9J6biQ"}))},children:[e(I,{icon:"transfer"}),e("small",{class:"menu-double-lines",children:o(K?{id:"Kp9SAs",values:{0:un.toUnicode(K)}}:{id:"lb07+k"})})]})]}),e(ge,{class:"button plain deck-close",to:i,children:e(I,{icon:"x",size:"xl",alt:o({id:"yz7wBu"})})})]})]})}),T.length&&B?e("ul",{class:`timeline flat contextual grow ${k==="loading"?"loading":""}`,children:[xe,ue>0&&e("li",{class:"descendant descendant-more",children:e("button",{type:"button",class:"plain block show-more",disabled:k==="loading",onClick:()=>J(N=>N+yn),style:{marginBlockEnd:"6em"},"data-state-post-ids":De.join(" "),children:[e("div",{class:"ib avatars-bunch",children:T.slice(te,te+5).map(N=>e(mt,{url:N.account.avatarStatic},N.id))})," ",e("div",{class:"ib",children:[e(f,{id:"uXRAkV"})," ",e("span",{class:"tag",children:ue>yn?`${yn}+`:ue})]})]})})]}):e(U,{children:[k==="loading"&&e("ul",{class:"timeline flat contextual grow loading",children:e("li",{children:e(Ge,{skeleton:!0,size:"l"})})}),k==="error"&&e("p",{class:"ui-state",children:[e(f,{id:"JWxodU"}),e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>{x.reloadStatusPage++},children:e(f,{id:"KDw4GX"})})]})]})]})}function wo({replies:n,instance:i,hasParentThread:s,level:o,accWeight:c,openAll:r,parentLink:u}){const{_:l}=le(),[d,a]=vt(),h=C=>C.reduce((E,R)=>{const{repliesCount:F,replies:D}=R,W=(D==null?void 0:D.length)||F;return E+W+h(D||[])},0),p=n.length+h(n),m=n.length===p,g=n.map(C=>C.account).filter((C,E,R)=>R.findIndex(F=>F.id===C.id)===E).slice(0,3),v=Ae(()=>n==null?void 0:n.reduce((C,E)=>C+(E==null?void 0:E.weight),c),[c,n==null?void 0:n.length]);let y=!1;(r||v<=ud||!s&&p===1&&on(n[0])<2)&&(y=!0);const w=ci[n[0].id],b=it((C,E,R,F)=>{C.preventDefault(),C.stopPropagation(),a({media:E+1,mediaStatusID:F.id})},[]),S=j();St(()=>{var E;function C(R){R.target.dataset.scrollLeft=R.target.scrollLeft}return(E=S.current)==null||E.addEventListener("scroll",C,{passive:!0}),()=>{var R;(R=S.current)==null||R.removeEventListener("scroll",C)}},[]);const[_,T]=M(w||y);Q(()=>{let C;return!w&&!y&&(C=setTimeout(()=>T(!0),100)),()=>clearTimeout(C)},[w,y]);const A=y?"div":"details",k=A==="details";return e(A,{ref:S,class:"replies",open:k?w||y:void 0,onToggle:k?C=>{const{open:E}=C.target;ci[n[0].id]=E}:void 0,style:{"--comments-level":o},"data-comments-level":o,"data-comments-level-overflow":o>4,children:[!y&&e("summary",{class:"replies-summary",hidden:y,children:[e("span",{class:"avatars",children:g.map(C=>e(mt,{url:C.avatarStatic,title:`${C.displayName} @${C.username}`,squircle:C==null?void 0:C.bot},C.id))}),e("span",{class:"replies-counts",children:[e("b",{children:e(f,{id:"DOQUen",values:{0:n.length,1:Qe(n.length)},components:{0:e("span",{title:n.length})}})}),!m&&p>1&&e(U,{children:[" ","·"," ",e("span",{children:e(f,{id:"qSQQSe",values:{0:Qe(p),totalComments:p},components:{0:e("span",{title:p})}})})]})]}),e(I,{icon:"chevron-down",class:"replies-summary-chevron"}),!!u&&e(ge,{class:"replies-parent-link",to:u.to,onClick:u.onClick,title:l({id:"ZlV82A"}),children:"»"})]}),_&&e("ul",{children:n.map(C=>{var E,R;return e("li",{children:[e("div",{class:"status-focus",tabIndex:0,children:[e(Ge,{statusID:C.id,instance:i,withinContext:!0,size:"s",enableTranslate:!0,onMediaClick:b,showActionsBar:!0}),!((E=C.replies)!=null&&E.length)&&C.repliesCount>0&&e("div",{class:"replies-link",children:[e(I,{icon:"comment2",alt:l({id:"N8UzTV"})})," ",e("span",{title:C.repliesCount,children:Qe(C.repliesCount)})]})]}),((R=C.replies)==null?void 0:R.length)&&e(wo,{instance:i,replies:C.replies,level:C.level,accWeight:y?v:C.weight,openAll:r,parentLink:{to:i?`/${i}/s/${C.id}`:`/s/${C.id}`,onClick:()=>{Cn(C.id)}}})]},C.id)})})]})}const md=140,gd=35,yd=70,bd=140,ai=new Map;function on(n){var g,v;const i=ai.get(n.id);if(i)return i;const{spoilerText:s,content:o,mediaAttachments:c,poll:r,card:u}=n,l=Ns(s+o),d=c!=null&&c.length?md:0,a=(((g=r==null?void 0:r.options)==null?void 0:g.length)||0)*gd,h=u&&(c!=null&&c.length||(v=r==null?void 0:r.options)!=null&&v.length)?0:yd,m=(l+d+a+h)/bd;return ai.set(n.id,m),m}const vd=ut(hd);function wd(){const n=Mt(),{id:i,instance:s}=n;return e(vd,{id:i,instance:s})}const kd=""+new URL("boosts-carousel-BiOaNdMT.jpg",import.meta.url).href,Sd=""+new URL("grouped-notifications-DFgwVVj3.jpg",import.meta.url).href,_d=""+new URL("multi-column-ROck0NVt.jpg",import.meta.url).href,Cd=""+new URL("multi-hashtag-timeline-DH5INVHi.jpg",import.meta.url).href,Id=""+new URL("nested-comments-thread-hv59kZLc.jpg",import.meta.url).href,Td="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",Ad={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",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",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_DEFAULT_INSTANCE:nn,PHANPY_WEBSITE:fs,PHANPY_PRIVACY_POLICY_URL:xd,PHANPY_DEFAULT_INSTANCE_REGISTRATION_URL:ps}=Ad,ms=fs?fs.replace(/https?:\/\//g,"").replace(/\/$/,""):null,gs=`${"2025-06-12T23:49:22.800Z".slice(0,10).replace(/-/g,".")}.43d0d1e`;function ko(){const{_:n}=le();return tt(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:_i,alt:"",width:"160",height:"160",style:{aspectRatio:"1/1",marginBlockEnd:-16}}),e("img",{src:Td,alt:"Phanpy",width:"200"})]}),e("p",{class:"desc",children:e(f,{id:"Ogtv0V"})}),e("p",{children:e(ge,{to:nn?`/login?instance=${nn}&submit=1`:"/login",class:"button",children:n(nn?{id:"sQia9P"}:{id:"ZLoGls"})})}),nn&&ps&&e("p",{children:e("a",{href:ps,class:"button plain5",children:e(f,{id:"e+RpCP"})})}),!nn&&e("p",{class:"insignificant",children:e("small",{children:e(f,{id:"fvAsUK",components:{0:e("br",{})}})})})]}),(ms||gs)&&e("p",{class:"app-site-version",children:e("small",{children:[ms," ",gs]})}),e("p",{children:e(f,{id:"BskFI2",components:{0:e("a",{href:"https://github.com/cheeaun/phanpy",target:"_blank"}),1:e("a",{href:"https://mastodon.social/@cheeaun",target:"_blank",onClick:i=>{i.preventDefault(),x.showAccount="cheeaun@mastodon.social"}}),2:e("a",{href:xd,target:"_blank"})}})}),e("div",{children:e(Ci,{})})]}),e("div",{id:"why-container",children:e("div",{class:"sections",children:[e("section",{children:[e("img",{src:kd,alt:n({id:"S5cYrQ"}),loading:"lazy"}),e("h4",{children:e(f,{id:"Tu+sCN"})}),e("p",{children:e(f,{id:"e2uVlo"})})]}),e("section",{children:[e("img",{src:Id,alt:n({id:"CGQ27z"}),loading:"lazy"}),e("h4",{children:e(f,{id:"cYE45+"})}),e("p",{children:e(f,{id:"Pc7QKh"})})]}),e("section",{children:[e("img",{src:Sd,alt:n({id:"rnrM7k"}),loading:"lazy"}),e("h4",{children:e(f,{id:"4RRMre"})}),e("p",{children:e(f,{id:"8GMtDr"})})]}),e("section",{children:[e("img",{src:_d,alt:n({id:"VLKtvP"}),loading:"lazy"}),e("h4",{children:e(f,{id:"pEkad9"})}),e("p",{children:e(f,{id:"t7Py5R"})})]}),e("section",{children:[e("img",{src:Cd,alt:n({id:"wOax6E"}),loading:"lazy"}),e("h4",{children:e(f,{id:"Wi1Ov0"})}),e("p",{children:e(f,{id:"tS2i+h"})})]})]})})]})}const Ed=window.alert;window.__nativeAlert||(window.__nativeAlert=Ed);window.alert=function(n){n instanceof Error&&(n!=null&&n.message)&&(n=n.message),typeof n!="string"&&(n=JSON.stringify(n));const i=lc({text:n,className:"alert",gravity:"top",position:"center",duration:1e4,offset:{y:48},onClick:()=>{i.hideToast()}});i.showToast()};window.__STATES__=x;window.__STATES_STATS__=()=>{const n=["statuses","accounts","spoilers","unfurledLinks","statusQuotes"],i={};n.forEach(c=>{i[c]=Object.keys(x[c]).length});const{statuses:s}=x,o=[];for(const c in s)document.querySelector(`[data-state-post-id~="${c}"], [data-state-post-ids~="${c}"]`)||o.push(c)};setInterval(()=>{if(!window.__IDLE__)return;const{statuses:n,unfurledLinks:i,notifications:s}=x;let o=0;const{instance:c}=re();for(const r in n){if(!window.__IDLE__)break;try{const u=document.querySelector(`[data-state-post-id~="${r}"], [data-state-post-ids~="${r}"]`),l=s.some(d=>{var a;return r===lt((a=d.status)==null?void 0:a.id,c)});if(!u&&!l){delete x.statuses[r],delete x.statusQuotes[r];for(const d in i){const a=i[d];if(lt(a.id,a.instance)===r){delete x.unfurledLinks[d];break}}o++}}catch{}}},15*60*1e3);setTimeout(()=>{for(const n in Kt)setTimeout(()=>{var i,s,o,c,r,u;Array.isArray(Kt[n])?(s=(i=Kt[n])[0])==null||s.call(i):typeof Kt[n]=="object"?(c=(o=Kt[n]).module)==null||c.call(o):(u=(r=Kt)[n])==null||u.call(r)},1)},5e3);(()=>{window.__IDLE__=!0;const n=["mousemove","mousedown","resize","keydown","touchstart","pointerdown","pointermove","wheel"],i=()=>{window.__IDLE__=!0},o=Ps(i,3e3),c=()=>{window.__IDLE__=!1,o()};n.forEach(r=>{window.addEventListener(r,c,{passive:!0,capture:!0})}),window.addEventListener("blur",i,{passive:!0}),document.documentElement.addEventListener("mouseleave",r=>{!r.relatedTarget&&!r.toElement&&i()},{passive:!0})})();const Rd=/iPad|iPhone|iPod/.test(navigator.userAgent);Rd&&document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible"){if(document.getElementsByClassName("media-modal-container").length>0)return;const i=Ue.local.get("theme");let s;if(i){if(s=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),s){const o=s.content,c=i==="light"?s.dataset.themeLightColorTemp:s.dataset.themeDarkColorTemp;s.content=c||"",setTimeout(()=>{s.content=o},10)}}else{const o=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(s=document.querySelector(`meta[name="theme-color"][media*="${o}"]`),s){const c=s.dataset.content,r=s.dataset.contentTemp;s.content=r||"",setTimeout(()=>{s.content=c},10)}}}});{const n=Ue.local.get("theme");if(n){document.documentElement.classList.add(`is-${n}`),document.querySelector('meta[name="color-scheme"]').setAttribute("content",n||"dark light");const s=document.querySelector('meta[data-theme-setting="manual"]');s&&(s.name="theme-color",s.content=n==="light"?s.dataset.themeLightColor:s.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(c=>{c.name=""})}const i=Ue.local.get("textSize");i&&document.documentElement.style.setProperty("--text-size",`${i}px`)}ws(x,n=>{var i;for(const[s,o,c,r]of n){if(o.join(".")==="settings.shortcutsViewMode"){const u=document.getElementById("app");u&&(u.dataset.shortcutsViewMode=(i=x.shortcuts)!=null&&i.length?c:"")}o.join(".")==="settings.cloakMode"&&document.body.classList.toggle("cloak",c)}});const bn=new Map;window.__BENCH_RESULTS=new Map;window.__BENCHMARK={start(n){},end(n){}};function Ld(){const[n,i]=M(!1),[s,o]=M("loading");__BENCHMARK.start("app-init"),__BENCHMARK.start("time-to-following"),__BENCHMARK.start("time-to-home"),__BENCHMARK.start("time-to-isLoggedIn"),le(),Q(()=>{const r=Ue.local.get("instanceURL"),u=decodeURIComponent((window.location.search.match(/code=([^&]+)/)||[,""])[1]);if(u){window.history.replaceState({},document.title,window.location.pathname||"/");const{client_id:l,client_secret:d,vapid_key:a}=Cs(r)||{},h=Tn(r)||a,p=Ue.sessionCookie.get("codeVerifier");(async()=>{o("loading");const{access_token:m}=await Hc({instanceURL:r,client_id:l,client_secret:d,code:u,code_verifier:p||void 0});if(m){const g=zo({instance:r,accessToken:m});await Promise.allSettled([Hn(g),qn(g,r),Uo(g,r,m,h)]),$i(),window.__IGNORE_GET_ACCOUNT_ERROR__=!0,i(!0),o("default")}else o("error");__BENCHMARK.end("app-init")})()}else{window.__IGNORE_GET_ACCOUNT_ERROR__=!0;const l=decodeURIComponent((window.location.search.match(/account=([^&]+)/)||[,""])[1]);let d;if(l&&(d=Bo(l),d&&(In(d.info.id),window.history.replaceState({},document.title,window.location.pathname||"/"))),d||(d=di()),d){In(d.info.id);const{client:a}=re({account:d}),{instance:h}=a;$i(),o("loading"),(async()=>{try{Fo()&&Ko(h)?(Hn(a),qn(a,h)):await Promise.allSettled([Hn(a),qn(a,h)])}catch{}finally{i(!0),o("default"),__BENCHMARK.end("app-init")}})()}else o("default"),__BENCHMARK.end("app-init")}Ue.sessionCookie.del("clientID"),Ue.sessionCookie.del("clientSecret"),Ue.sessionCookie.del("codeVerifier")},[]);let c=Jt();return x.currentLocation=c.pathname,Q(ni,[c,n]),/\/https?:/.test(c.pathname)?e(Ql,{}):s==="loading"?e(Be,{id:"loader-root"}):e(U,{children:[e($d,{isLoggedIn:n}),e(Nd,{isLoggedIn:n}),e(hi,{children:e(Xe,{path:"/:instance?/s/:id",element:e(wd,{})})}),n&&e(pc,{}),n&&e(_r,{}),e(gr,{}),n&&e(wr,{}),e(hc,{isLoggedIn:n}),e(kr,{onClose:ni}),e(mc,{})]})}function Md({isLoggedIn:n}){return n&&__BENCHMARK.end("time-to-isLoggedIn"),n?e(Zl,{}):e(ko,{})}const $d=ut(({isLoggedIn:n})=>{const i=Jt(),s=Ae(()=>{const{pathname:o}=i;return!/^\/(login|welcome|_sandbox)/i.test(o)},[i]);return e(hi,{location:s||i,children:[e(Xe,{path:"/",element:e(Md,{isLoggedIn:n})}),e(Xe,{path:"/login",element:e(sd,{})}),e(Xe,{path:"/welcome",element:e(ko,{})}),void 0]})});function ys(){return x.prevLocation||null}function Nd({isLoggedIn:n}){const i=Jt(),s=j(ys());return Ae(()=>cn("/:instance/s/:id",i.pathname)||cn("/s/:id",i.pathname),[i.pathname,cn])?s.current||(s.current=ys()):s.current=null,e(hi,{location:s.current||i,children:[n&&e(U,{children:[e(Xe,{path:"/notifications",element:e(mo,{})}),e(Xe,{path:"/mentions",element:e(lo,{})}),e(Xe,{path:"/following",element:e(Ri,{})}),e(Xe,{path:"/b",element:e(to,{})}),e(Xe,{path:"/f",element:e(no,{})}),e(Xe,{path:"/l",children:[e(Xe,{index:!0,element:e(ed,{})}),e(Xe,{path:":id",element:e(oo,{})})]}),e(Xe,{path:"/fh",element:e(pl,{})}),e(Xe,{path:"/sp",element:e(cd,{})}),e(Xe,{path:"/ft",element:e(dl,{})}),e(Xe,{path:"/catchup",element:e(Jr,{})}),e(Xe,{path:"/annual_report/:year",element:e(qr,{})})]}),e(Xe,{path:"/:instance?/t/:hashtag",element:e(so,{})}),e(Xe,{path:"/:instance?/a/:id",element:e(Br,{})}),e(Xe,{path:"/:instance?/p",children:[e(Xe,{index:!0,element:e(oi,{})}),e(Xe,{path:"l",element:e(oi,{local:!0})})]}),e(Xe,{path:"/:instance?/trending",element:e(bo,{})}),e(Xe,{path:"/:instance?/search",element:e(go,{})})]})}Ho();qo(e(Yo,{i18n:pe,children:e(jo,{children:e(Ld,{})})}),document.getElementById("app"));setTimeout(()=>{try{Object.keys(localStorage).forEach(n=>{n.startsWith("iconify")&&localStorage.removeItem(n)}),Object.keys(sessionStorage).forEach(n=>{n.startsWith("iconify")&&sessionStorage.removeItem(n)}),localStorage.removeItem("settings:boostsCarousel")}catch{}},5e3);if("serviceWorker"in navigator&&typeof caches<"u"){const i=["icons"];let s=!1;const o=1e4,c=60*60*1e3;async function r(){if(window.__IDLE__)try{const u=await caches.keys();for(const l of u){if(i.includes(l))continue;const d=await caches.open(l),a=await d.keys();if(a.length>50){const h=a.slice(50);for(const p of h)await d.delete(p)}}s=!0}catch{}setTimeout(r,s?c:o)}setTimeout(r,o)}window.__CLOAK__=()=>{document.body.classList.toggle("cloak")};
//# sourceMappingURL=main-BcxE7N7D.js.map