30 lines
312 KiB
JavaScript
30 lines
312 KiB
JavaScript
import{A as q,y as G,M as ot,u as ce,d as R,s as E,a as se,b as Je,p as yt,c as Ge,q as tt,g as vt,e,k as D,T as u,f as vi,h as xt,i as Gt,j as Ln,l as Te,m as ke,L as Oo,C as Xn,n as zo,o as Fo,r as Mn,t as yi,v as ji,w as bi,x as Qt,z as qn,B as Oe,E as Bo,F as wi,G as ue,H as $n,I as Nn,_ as St,J as $s,K as au,N as Ns,O as ki,P as qo,Q as Uo,R as rt,S as Ko,U as Si,V as Ho,W as bt,X as jo,Y as Yo,Z as Ci,$ as _i,a0 as Nt,a1 as Qe,a2 as Ps,a3 as Vo,a4 as Ds,a5 as Go,a6 as Wo,a7 as cn,a8 as Zo,ab as Xo,ac as Jn,ad as Qn,ae as Jo,af as Yi,ag as Qo,ah as ea,ai as ta,aj as Ii,ak as Ze,am as na,an as ia,ao as sa,ap as oa,aq as aa,ar as ca}from"./pwa-viewport-CZFc0vUU.js";import{u as Ai,f as Fe,s as le,o as Vi,a as ra,V as Os,b as zs,I,C as Ti,M as Ke,c as He,S as hn,d as ge,e as Un,R as Ct,n as st,g as Fs,h as Ue,A as pt,N as mt,i as lt,j as ft,L as fe,l as Mt,k as la,m as Bs,p as Bt,q as uu,r as Xe,t as Kn,v as ut,w as Gi,T as qs,x as it,y as li,z as Us,E as Ks,B as We,D as gt,F as je,G as Tt,H as da,J as ua,K as zt,O as xi,P as Hs,Q as ha,U as Zt,W as pa,X as fa,Y as Hn,Z as ma,_ as qt,$ as ga,a0 as va,a1 as js,a2 as ya,a3 as Ei,a4 as ba,a5 as wa,a6 as ka,a7 as Sa,a8 as Ca,a9 as Ys,aa as _a,ab as Ia,ac as Wi,ad as Aa,ae as Ta}from"./ScheduledAtField-BOlu1KST.js";import{ICONS as jt}from"./ICONS-BzjICR_A.js";var Vs=xa;function xa(n,i,o){var s=null,a=null,c=function(){s&&(clearTimeout(s),a=null,s=null)},p=function(){var d=a;c(),d&&d()},l=function(){if(!i)return n.apply(this,arguments);var d=this,r=arguments,h=o&&!s;if(c(),a=function(){n.apply(d,r)},s=setTimeout(function(){if(s=null,!h){var m=a;return a=null,m()}},i),h)return a()};return l.cancel=c,l.flush=p,l}(function(n,i){"use strict";typeof n.CustomEvent!="function"&&(n.CustomEvent=function(y,v){v=v||{bubbles:!1,cancelable:!1,detail:void 0};var C=i.createEvent("CustomEvent");return C.initCustomEvent(y,v.bubbles,v.cancelable,v.detail),C},n.CustomEvent.prototype=n.Event.prototype),i.addEventListener("touchstart",h,!1),i.addEventListener("touchmove",m,!1),i.addEventListener("touchend",r,!1);var o=null,s=null,a=null,c=null,p=null,l=null,d=0;function r(y){if(l===y.target){var v=parseInt(f(l,"data-swipe-threshold","20"),10),C=f(l,"data-swipe-unit","px"),k=parseInt(f(l,"data-swipe-timeout","500"),10),b=Date.now()-p,g="",_=y.changedTouches||y.touches||[];if(C==="vh"&&(v=Math.round(v/100*i.documentElement.clientHeight)),C==="vw"&&(v=Math.round(v/100*i.documentElement.clientWidth)),Math.abs(a)>Math.abs(c)?Math.abs(a)>v&&b<k&&(a>0?g="swiped-left":g="swiped-right"):Math.abs(c)>v&&b<k&&(c>0?g="swiped-up":g="swiped-down"),g!==""){var w={dir:g.replace(/swiped-/,""),touchType:(_[0]||{}).touchType||"direct",fingers:d,xStart:parseInt(o,10),xEnd:parseInt((_[0]||{}).clientX||-1,10),yStart:parseInt(s,10),yEnd:parseInt((_[0]||{}).clientY||-1,10)};l.dispatchEvent(new CustomEvent("swiped",{bubbles:!0,cancelable:!0,detail:w})),l.dispatchEvent(new CustomEvent(g,{bubbles:!0,cancelable:!0,detail:w}))}o=null,s=null,p=null}}function h(y){y.target.getAttribute("data-swipe-ignore")!=="true"&&(l=y.target,p=Date.now(),o=y.touches[0].clientX,s=y.touches[0].clientY,a=0,c=0,d=y.touches.length)}function m(y){if(!(!o||!s)){var v=y.touches[0].clientX,C=y.touches[0].clientY;a=o-v,c=s-C}}function f(y,v,C){for(;y&&y!==i.documentElement;){var k=y.getAttribute(v);if(k)return k;y=y.parentNode}return C}})(window,document);function Xt(n=()=>{},i=[]){const o=q(n);G(()=>{o.current=n},[i]),G(()=>{const s=()=>{const a=document.hidden||document.visibilityState==="hidden";o.current(!a)};return document.addEventListener("visibilitychange",s),()=>document.removeEventListener("visibilitychange",s)},[])}const Ea=1e3*3,Zi=2e4,Ra=ot(function({isLoggedIn:i}){const{_:o}=ce(),[s,a]=R(!0),c=q();Xt(r=>{clearTimeout(c.current),r?a(!0):c.current=setTimeout(()=>{a(!1)},Zi)});const p=async(r,h,m)=>{if(E.notificationsLast){const f=r.v1.notifications.list({limit:1,sinceId:E.notificationsLast.id}).values(),{value:y}=await f.next();if(y?.length)if(m)E.notificationsShowNew=!0;else{let v;try{v=(await r.v1.markers.fetch({timeline:"notifications"}))?.notifications?.lastReadId}catch{}v?E.notificationsShowNew=y[0].id!==v:E.notificationsShowNew=!0}}};G(()=>{let r,h,m;if(i&&s){const{masto:f,streaming:y,instance:v}=se();(async()=>{await p(f,v);let C=!1;y&&(h=setTimeout(()=>{(async()=>{try{C=!0,r=y.user.notification.subscribe();for await(const k of r){if(!r||!s)break;k.event==="notification"&&Je(k.payload,v,{skipThreading:!0}),E.notificationsShowNew=!0}}catch{C=!1}C||(m=setInterval(()=>{p(f,v,!0)},Zi))})()},Ea))})()}return()=>{r?.unsubscribe?.(),r=null,clearTimeout(h),clearInterval(m)}},[s,i]);const l=q(),d=()=>{l.current=Date.now(),fetch("./version.json").then(r=>r.json()).then(r=>{r&&(E.appVersion=r)}).catch(r=>{})};return Ai(d,s&&1e3*60*30),Xt(r=>{r&&(l.current?Date.now()-l.current>1e3*60*60&&d():d())}),Fe("shift+alt+k",r=>{if(!r.shiftKey||!r.altKey)return;const h=E.settings.cloakMode;E.settings.cloakMode=!h,le({text:o(h?{id:"oguMwa"}:{id:"IXZLPs"})})},{useKey:!0,ignoreEventWhen:r=>r.metaKey||r.ctrlKey}),null}),La=yt(async(n,i)=>{const o=n.v1.accounts.$select(i).statuses.list({limit:3,exclude_replies:!0,exclude_reblogs:!0}).values(),{value:s}=await o.next();return s||[]},{maxAge:6e4});function Ma(){const{_:n}=ce(),i=Ge(E),{masto:o}=se(),[s,a]=R(!1),[c,p]=R([]),[l,d]=R(!1),r=q(null),h=q(null),m=i.settings.shortcutsViewMode==="multi-column";function f(k){if(k.key&&k.key.toLowerCase()!=="c")return;if(i.composerState.minimized){E.composerState.minimized=!1,Vi();return}const b=document.querySelectorAll("data.compose-data"),g=!m&&b.length===1?JSON.parse(b[0].value):void 0;k.shiftKey?ra(g)||(E.showCompose=g||!0):(Vi(),E.showCompose=g||!0)}Fe("c, shift+c",f,{useKey:!0,ignoreEventWhen:k=>!!document.querySelector("#modal-container > *")||k.metaKey||k.ctrlKey||k.altKey});const y=Os(()=>{a(!0)},{threshold:600}),v=tt(async()=>{try{d(!0);const k=vt();if(!k)return;const b=await La(o,k);p(b)}catch{}finally{d(!1)}},[o]),C=tt(k=>{zs({replyToStatus:k}),a(!1)},[]);return G(()=>{s&&v()},[v,s]),e(D,{children:[e("button",{ref:r,type:"button",id:"compose-button",onClick:f,onContextMenu:k=>{k.preventDefault(),a(!0)},...y(),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(Ti,{ref:h,state:s?"open":void 0,anchorRef:r,onClose:()=>a(!1),direction:"top",gap:8,unmountOnClose:!0,portal:{target:document.body},boundingBoxPadding:Fs(),containerProps:{style:{zIndex:19},onClick:()=>{h.current?.closeMenu?.()}},submenuOpenDelay:600,children:[e(Ke,{to:"/sp",children:[e(I,{icon:"schedule"})," ",e("span",{children:e(u,{id:"+GkIdc"})})]}),e(He,{}),e(hn,{align:"end",direction:"top",shift:-8,disabled:l||c.length===0,label:e(D,{children:[e(I,{icon:"comment"})," ",e("span",{className:"menu-grow",children:e(u,{id:"LwOr4P"})}),l?"…":e(I,{icon:"chevron-right"})]}),children:c.length>0&&c.map(k=>{const b=new Date(k.createdAt),g=Date.now()-b.getTime()<864e5;return e(ge,{onClick:()=>C(k),children:e("small",{children:[e("div",{class:"menu-post-text",children:Un(k)}),e("span",{className:"more-insignificant",children:[g&&e(D,{children:[e(Ct,{datetime:b,format:"micro"})," ","‒"," "]}),e("time",{className:"created",dateTime:b.toISOString(),title:b.toLocaleString(),children:st(k.createdAt)})]})]})},k.id)})})]})]})}function Xi({key1:n,key2:i}){return e(u,{id:"Qh+0sm",values:{key1:n,key2:i},components:{0:e("kbd",{}),1:e("kbd",{})}})}const $a=ot(function(){const{_:i}=ce(),o=Ge(E);function s(){E.showKeyboardShortcutsHelp=!1}return Fe("?",()=>{E.showKeyboardShortcutsHelp=!0},{useKey:!0,ignoreEventWhen:a=>/\/catchup/i.test(location.hash)||a.metaKey||a.ctrlKey||a.altKey}),!!o.showKeyboardShortcutsHelp&&e(Ue,{onClose:s,children:e("div",{id:"keyboard-shortcuts-help-container",class:"sheet",tabindex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:s,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{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(u,{id:"mzjGX4",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"S5ez7Y"}),keys:e(u,{id:"Fd8FaU",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"VkLESX"}),keys:e("kbd",{children:"."})},{action:i({id:"jsFF8C"}),keys:e(u,{id:"80sOCm",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:e(u,{id:"41gejM",components:{0:e("br",{})}}),keys:e("kbd",{children:"x"})},{action:i({id:"jAj8rv"}),keys:e(u,{id:"evz6c6",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"duF1lx"}),keys:e(u,{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(u,{id:"+Cxvld",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"1pKapz"}),keys:e(u,{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(u,{id:"XpQLJF",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"cqi4Mx"}),keys:e(u,{id:"84WuL2",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"kulphB"}),keys:e(u,{id:"yrz6Ck",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"ZhhOwV"}),keys:e("kbd",{children:"q"})},{action:i({id:"PZlHt8"}),keys:e("kbd",{children:"d"})},{action:i({id:"C7ujRh"}),keys:e(u,{id:"v4TbMP",components:{0:e("kbd",{}),1:e("kbd",{}),2:e("kbd",{})}})},{action:i({id:"UmuIdg"}),keys:e(Xi,{key1:"g",key2:"h"})},{action:i({id:"0YgcH9"}),keys:e(Xi,{key1:"g",key2:"n"})}].map(({action:a,className:c,keys:p})=>e("tr",{children:[e("th",{class:c,children:a}),e("td",{children:p})]},a))})})})]})})}),di=new Set,nt=new WeakMap,Ut=new WeakMap,ht=new WeakMap,rn=new WeakMap,ei=new WeakMap,on=new WeakMap,Ft=new WeakMap,$t=new WeakMap,Wt=new WeakSet;let ct,Ri=0,Li=0;const It="__aa_tgt",ln="__aa_del",Pn="__aa_new",Gs=n=>{const i=Oa(n);i&&i.forEach(o=>za(o))},Na=n=>{n.forEach(i=>{i.target===ct&&Pa(),nt.has(i.target)&&Ht(i.target)})};function Ws(n){const i=n.getBoundingClientRect(),o=ct?.clientWidth||0,s=ct?.clientHeight||0;return i.bottom<0||i.top>s||i.right<0||i.left>o}function Mi(n){const i=rn.get(n);i?.disconnect();let o=nt.get(n),s=0;const a=5;o||(o=Jt(n),nt.set(n,o));const{offsetWidth:c,offsetHeight:p}=ct,d=[o.top-a,c-(o.left+a+o.width),p-(o.top+a+o.height),o.left-a].map(h=>`${-1*Math.floor(h)}px`).join(" "),r=new IntersectionObserver(()=>{++s>1&&Ht(n)},{root:ct,threshold:1,rootMargin:d});r.observe(n),rn.set(n,r)}function Ht(n,i=!0){clearTimeout($t.get(n));const o=jn(n),s=i?dn(o)?500:o.duration:0;$t.set(n,setTimeout(async()=>{const a=ht.get(n);try{await a?.finished,nt.set(n,Jt(n)),Mi(n)}catch{}},s))}function Pa(){clearTimeout($t.get(ct)),$t.set(ct,setTimeout(()=>{di.forEach(n=>Cn(n,i=>Zs(()=>Ht(i))))},100))}function Da(n){setTimeout(()=>{on.set(n,setInterval(()=>Zs(Ht.bind(null,n)),2e3))},Math.round(2e3*Math.random()))}function Zs(n){typeof requestIdleCallback=="function"?requestIdleCallback(()=>n()):requestAnimationFrame(()=>n())}let _t;const Xs=typeof window<"u"&&"ResizeObserver"in window;Xs&&(ct=document.documentElement,new MutationObserver(Gs),_t=new ResizeObserver(Na),window.addEventListener("scroll",()=>{Li=window.scrollY,Ri=window.scrollX}),_t.observe(ct));function Oa(n){return n.reduce((s,a)=>[...s,...Array.from(a.addedNodes),...Array.from(a.removedNodes)],[]).every(s=>s.nodeName==="#comment")?!1:n.reduce((s,a)=>{if(s===!1)return!1;if(a.target instanceof Element){if(ti(a.target),!s.has(a.target)){s.add(a.target);for(let c=0;c<a.target.children.length;c++){const p=a.target.children.item(c);if(p){if(ln in p)return!1;ti(a.target,p),s.add(p)}}}if(a.removedNodes.length)for(let c=0;c<a.removedNodes.length;c++){const p=a.removedNodes[c];if(ln in p)return!1;p instanceof Element&&(s.add(p),ti(a.target,p),Ut.set(p,[a.previousSibling,a.nextSibling]))}}return s},new Set)}function ti(n,i){!i&&!(It in n)?Object.defineProperty(n,It,{value:n}):i&&!(It in i)&&Object.defineProperty(i,It,{value:n})}function za(n){var i,o;const s=n.isConnected,a=nt.has(n);s&&Ut.has(n)&&Ut.delete(n),((i=ht.get(n))===null||i===void 0?void 0:i.playState)!=="finished"&&((o=ht.get(n))===null||o===void 0||o.cancel()),Pn in n?Ji(n):a&&s?Ba(n):a&&!s?qa(n):Ji(n)}function kt(n){return Number(n.replace(/[^0-9.\-]/g,""))}function Fa(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 Jt(n){const i=n.getBoundingClientRect(),{x:o,y:s}=Fa(n);return{top:i.top+s,left:i.left+o,width:i.width,height:i.height}}function Js(n,i,o){let s=i.width,a=i.height,c=o.width,p=o.height;const l=getComputedStyle(n);if(l.getPropertyValue("box-sizing")==="content-box"){const r=kt(l.paddingTop)+kt(l.paddingBottom)+kt(l.borderTopWidth)+kt(l.borderBottomWidth),h=kt(l.paddingLeft)+kt(l.paddingRight)+kt(l.borderRightWidth)+kt(l.borderLeftWidth);s-=h,c-=h,a-=r,p-=r}return[s,c,a,p].map(Math.round)}function jn(n){return It in n&&Ft.has(n[It])?Ft.get(n[It]):{duration:250,easing:"ease-in-out"}}function Qs(n){if(It in n)return n[It]}function $i(n){const i=Qs(n);return i?Wt.has(i):!1}function Cn(n,...i){i.forEach(o=>o(n,Ft.has(n)));for(let o=0;o<n.children.length;o++){const s=n.children.item(o);s&&i.forEach(a=>a(s,Ft.has(s)))}}function Ni(n){return Array.isArray(n)?n:[n]}function dn(n){return typeof n=="function"}function Ba(n){const i=nt.get(n),o=Jt(n);if(!$i(n))return nt.set(n,o);if(Ws(n)){nt.set(n,o),Mi(n);return}let s;if(!i)return;const a=jn(n);if(typeof a!="function"){let c=i.left-o.left,p=i.top-o.top;const l=i.left+i.width-(o.left+o.width);i.top+i.height-(o.top+o.height)==0&&(p=0),l==0&&(c=0);const[r,h,m,f]=Js(n,i,o),y={transform:`translate(${c}px, ${p}px)`},v={transform:"translate(0, 0)"};r!==h&&(y.width=`${r}px`,v.width=`${h}px`),m!==f&&(y.height=`${m}px`,v.height=`${f}px`),s=n.animate([y,v],{duration:a.duration,easing:a.easing})}else{const[c]=Ni(a(n,"remain",i,o));s=new Animation(c),s.play()}ht.set(n,s),nt.set(n,o),s.addEventListener("finish",Ht.bind(null,n,!1),{once:!0})}function Ji(n){Pn in n&&delete n[Pn];const i=Jt(n);nt.set(n,i);const o=jn(n);if(!$i(n))return;if(Ws(n)){Mi(n);return}let s;if(typeof o!="function")s=n.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:o.duration*1.5,easing:"ease-in"});else{const[a]=Ni(o(n,"add",i));s=new Animation(a),s.play()}ht.set(n,s),s.addEventListener("finish",Ht.bind(null,n,!1),{once:!0})}function Qi(n,i){var o;n.remove(),nt.delete(n),Ut.delete(n),ht.delete(n),(o=rn.get(n))===null||o===void 0||o.disconnect(),setTimeout(()=>{if(ln in n&&delete n[ln],Object.defineProperty(n,Pn,{value:!0,configurable:!0}),i&&n instanceof HTMLElement)for(const s in i)n.style[s]=""},0)}function qa(n){var i;if(!Ut.has(n)||!nt.has(n))return;const[o,s]=Ut.get(n);Object.defineProperty(n,ln,{value:!0,configurable:!0});const a=window.scrollX,c=window.scrollY;if(s&&s.parentNode&&s.parentNode instanceof Element?s.parentNode.insertBefore(n,s):o&&o.parentNode?o.parentNode.appendChild(n):(i=Qs(n))===null||i===void 0||i.appendChild(n),!$i(n))return Qi(n);const[p,l,d,r]=Ka(n),h=jn(n),m=nt.get(n);(a!==Ri||c!==Li)&&Ua(n,a,c,h);let f,y={position:"absolute",top:`${p}px`,left:`${l}px`,width:`${d}px`,height:`${r}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!dn(h))Object.assign(n.style,y),f=n.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:h.duration,easing:"ease-out"});else{const[v,C]=Ni(h(n,"remove",m));C?.styleReset!==!1&&(y=C?.styleReset||y,Object.assign(n.style,y)),f=new Animation(v),f.play()}ht.set(n,f),f.addEventListener("finish",()=>Qi(n,y),{once:!0})}function Ua(n,i,o,s){const a=Ri-i,c=Li-o,p=document.documentElement.style.scrollBehavior;if(getComputedStyle(ct).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+a,window.scrollY+c),!n.parentElement)return;const d=n.parentElement;let r=d.clientHeight,h=d.clientWidth;const m=performance.now();function f(){requestAnimationFrame(()=>{if(!dn(s)){const y=r-d.clientHeight,v=h-d.clientWidth;m+s.duration>performance.now()?(window.scrollTo({left:window.scrollX-v,top:window.scrollY-y}),r=d.clientHeight,h=d.clientWidth,f()):document.documentElement.style.scrollBehavior=p}})}f()}function Ka(n){var i;const o=nt.get(n),[s,,a]=Js(n,o,Jt(n));let c=n.parentElement;for(;c&&(getComputedStyle(c).position==="static"||c instanceof HTMLBodyElement);)c=c.parentElement;c||(c=document.body);const p=getComputedStyle(c),l=!ht.has(n)||((i=ht.get(n))===null||i===void 0?void 0:i.playState)==="finished"?Jt(c):nt.get(c),d=Math.round(o.top-l.top)-kt(p.borderTopWidth),r=Math.round(o.left-l.left)-kt(p.borderLeftWidth);return[d,r,s,a]}function eo(n,i={}){if(Xs&&_t&&!(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!dn(i)&&!i.disrespectUserMotionPreference)){Wt.add(n),getComputedStyle(n).position==="static"&&Object.assign(n.style,{position:"relative"}),Cn(n,Ht,Da,p=>_t?.observe(p)),dn(i)?Ft.set(n,i):Ft.set(n,{duration:250,easing:"ease-in-out",...i});const c=new MutationObserver(Gs);c.observe(n,{childList:!0}),ei.set(n,c),di.add(n)}return Object.freeze({parent:n,enable:()=>{Wt.add(n)},disable:()=>{Wt.delete(n),Cn(n,s=>{const a=ht.get(s);try{a?.cancel()}catch{}ht.delete(s);const c=$t.get(s);c&&clearTimeout(c),$t.delete(s);const p=on.get(s);p&&clearInterval(p),on.delete(s)})},isEnabled:()=>Wt.has(n),destroy:()=>{Wt.delete(n),di.delete(n),Ft.delete(n);const s=ei.get(n);s?.disconnect(),ei.delete(n),Cn(n,a=>{_t?.unobserve(a);const c=ht.get(a);try{c?.cancel()}catch{}ht.delete(a);const p=rn.get(a);p?.disconnect(),rn.delete(a);const l=on.get(a);l&&clearInterval(l),on.delete(a);const d=$t.get(a);d&&clearTimeout(d),$t.delete(a),nt.delete(a),Ut.delete(a)})}})}function Yn(n){const i=q(null),[o,s]=R(),a=c=>{o&&(c?o.enable():o.disable())};return G(()=>{i.current instanceof HTMLElement&&s(eo(i.current,n||{}))},[]),G(()=>()=>{var c;(c=o?.destroy)===null||c===void 0||c.call(o)},[o]),[i,a]}function Ha(n){return("0"+n.toString(16)).slice(-2)}function ja(){var n=new Uint32Array(28);return window.crypto.getRandomValues(n),Array.from(n,Ha).join("")}function Ya(n){const o=new TextEncoder().encode(n);return window.crypto.subtle.digest("SHA-256",o)}function Va(n){let i="";const o=new Uint8Array(n),s=o.byteLength;for(var a=0;a<s;a++)i+=String.fromCharCode(o[a]);return btoa(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function to(n){const i=await Ya(n);return Va(i)}async function Ga({instanceURL:n}){if(!n)return!1;try{const i=await fetch(`https://${n}/.well-known/oauth-authorization-server`);return!i.ok||i.status!==200?!1:!!(await i.json()).code_challenge_methods_supported?.includes("S256")}catch{return!1}}window.__generateCodeChallenge=to;const Wa={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:Za,PHANPY_CLIENT_NAME:Xa,PHANPY_WEBSITE:Dn}=Wa,Pi="read write follow push",Ja=Dn?Dn.toLowerCase().includes(location.hostname):!1,Qa=location.origin+location.pathname,Vn=Za||!Ja?Qa:Dn;async function ec({instanceURL:n}){const i=new URLSearchParams({client_name:Xa,redirect_uris:Vn,scopes:Pi,website:Dn});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 tc({instanceURL:n,client_id:i,forceLogin:o=!1}){const s=ja(),a=await to(s),c=new URLSearchParams({client_id:i,code_challenge_method:"S256",code_challenge:a,redirect_uri:Vn,response_type:"code",scope:Pi});return o&&c.append("force_login",!0),[`https://${n}/oauth/authorize?${c.toString()}`,s]}async function nc({instanceURL:n,client_id:i,forceLogin:o=!1}){const s=new URLSearchParams({client_id:i,scope:Pi,redirect_uri:Vn,response_type:"code"});return o&&s.append("force_login",!0),`https://${n}/oauth/authorize?${s.toString()}`}async function ic({instanceURL:n,client_id:i,client_secret:o,code:s,code_verifier:a}){const c=new URLSearchParams({client_id:i,redirect_uri:Vn,grant_type:"authorization_code",code:s});return o&&c.append("client_secret",o),a&&c.append("code_verifier",a),await(await fetch(`https://${n}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:c.toString()})).json()}async function sc({instanceURL:n,client_id:i,client_secret:o,token:s}){try{const a=new URLSearchParams({client_id:i,client_secret:o,token:s});return(await fetch(`https://${n}/oauth/revoke`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:a.toString(),keepalive:!0})).ok}catch(a){return console.erro("Error revoking token",a),!1}}const oc=window.matchMedia("(display-mode: standalone)").matches;function ac({onClose:n}){const{_:i}=ce(),{masto:o}=se(),s=vi(),a=vt(),c=s.length>1,[p,l]=xt(r=>r+1,0),[d]=Yn();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(u,{id:"bPwFdf"})})}),e("main",{children:e("section",{children:[e("ul",{class:"accounts-list",ref:d,children:s.map((r,h)=>{const m=r.info.id===a,f=h===0;return e("li",{children:[e("div",{children:[c&&e("span",{class:`current ${m?"is-current":""}`,children:e(I,{icon:"check-circle",alt:i({id:"Hp1l6f"})})}),e(pt,{url:r.info.avatarStatic,size:"xxl",onDblClick:async()=>{if(m)try{const y=await o.v1.accounts.$select(r.info.id).fetch();r.info=y,Gt(s),l()}catch{}}}),e(mt,{account:c?{...r.info,acct:/@/.test(r.info.acct)?r.info.acct:`${r.info.acct}@${r.instanceURL}`}:r.info,showAcct:!0,onClick:()=>{m?E.showAccount=`${r.info.username}@${r.instanceURL}`:(Ln(r.info.id),location.reload())}})]}),e("div",{class:"actions",children:[f&&c&&e(D,{children:[e("span",{class:"tag",children:e(u,{id:"ovBPCi"})})," "]}),e(lt,{align:"end",menuButton:e("button",{type:"button",class:"plain more-button",children:e(I,{icon:"more",size:"l",alt:i({id:"2FYpfJ"})})}),children:[c&&e(D,{children:[e(ge,{disabled:m,onClick:()=>{Ln(r.info.id),location.reload()},children:[e(I,{icon:"transfer"})," ",e(u,{id:"3t/Nrv"})]}),!oc&&!m&&e(Ke,{href:`./?account=${r.info.id}`,target:"_blank",children:[e(I,{icon:"external"}),e("span",{children:e(u,{id:"PZgZtY"})})]}),e(He,{})]}),e(ge,{onClick:()=>{E.showAccount=`${r.info.username}@${r.instanceURL}`},children:[e(I,{icon:"user"}),e("span",{children:e(u,{id:"40z2Fm"})})]}),e(He,{}),c&&e(D,{children:[e(ge,{disabled:f,onClick:()=>{s.splice(h,1),s.unshift(r),Gt(s),l()},children:[e(I,{icon:"check-circle"}),e("span",{children:e(u,{id:"PPcets"})})]}),e(ge,{disabled:h<=1,onClick:()=>{s.splice(h,1),s.splice(h-1,0,r),Gt(s),l()},children:[e(I,{icon:"arrow-up"}),e("span",{children:e(u,{id:"QyioBP"})})]}),e(ge,{disabled:h===0||h===s.length-1,onClick:()=>{s.splice(h,1),s.splice(h+1,0,r),Gt(s),l()},children:[e(I,{icon:"arrow-down"}),e("span",{children:e(u,{id:"3Ib6FN"})})]}),e(He,{})]}),e(ft,{subMenu:!0,confirmLabel:e(D,{children:[e(I,{icon:"exit"}),e("span",{children:e(u,{id:"k08LxG",values:{0:r.info.acct},components:{0:e("span",{class:"bidi-isolate"})}})})]}),disabled:!m,menuItemClassName:"danger",onClick:async()=>{await sc({instanceURL:r.instanceURL,client_id:r.clientId,client_secret:r.clientSecret,token:r.accessToken}),s.splice(h,1),Gt(s);try{Te.session.get("currentAccount")===r.info.id&&Te.session.del("currentAccount")}catch{}location.href=location.pathname||"/"},children:[e(I,{icon:"exit"}),e("span",{children:e(u,{id:"CXk1bI"})})]}),!!r?.createdAt&&e("div",{class:"footer",children:[e(I,{icon:"account-add"}),e("span",{children:e(u,{id:"+9E7iR",values:{0:st(r.createdAt)},components:{0:e(Ct,{datetime:r.createdAt})}})})]})]})]})]},r.info.id)})}),e("p",{children:e(fe,{to:"/login",class:"button plain2",onClick:n,children:[e(I,{icon:"plus"})," ",e("span",{children:e(u,{id:"Is7/PB"})})]})}),c&&e("p",{children:e("small",{children:e(u,{id:"52x24e",components:{0:e("i",{})}})})})]})})]})}const Di="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",cc={"zh-CN":"zh-Hans","zh-TW":"zh-Hant","pt-BR":"pt-BR"};function Oi(){const{i18n:n}=ce(),i=ke(()=>Oo.map(o=>{const s=cc[o]||o.replace(/-[a-z]+$/i,""),a=Mt({code:s,locale:o,fallback:Xn.find(p=>p.code===o)?.nativeName}),c=Mt({code:s,locale:n.locale,fallback:Xn.find(p=>p.code===o)?.name});return{code:o,regionlessCode:s,_common:c,native:a}}).sort((o,s)=>{const a=o._common.localeCompare(s._common,n.locale);return a!==0?a:o.code<s.code?-1:o.code>s.code?1:0}),[]);return e("label",{class:"lang-selector",children:["🌐"," ",e("select",{class:"small",value:n.locale||Fo,onChange:o=>{Te.local.set("lang",o.target.value),zo(o.target.value)},children:[i.map(({code:o,regionlessCode:s,native:a})=>{const c=Mt({code:s,locale:n.locale,fallback:Xn.find(l=>l.code===o)?.name});return e("option",{value:o,"data-regionless-code":s,children:!!c&&c!==a?`${a} - ${c}`:a},o)}),void 0]})]})}function es(n){const{masto:i}=se();return i.v1.push.subscription.create(n)}function rc(){const{masto:n}=se();return n.v1.push.subscription.fetch()}function lc(n){const{masto:i}=se();return i.v1.push.subscription.update(n)}function dc(){const{masto:n}=se();return n.v1.push.subscription.remove()}function Gn(){return"serviceWorker"in navigator&&"PushManager"in window}function uc(){return navigator.serviceWorker.getRegistration()}async function zi(){const n=await uc(),i=n?await n.pushManager.getSubscription():void 0;return{registration:n,subscription:i}}function no(n){const i="=".repeat((4-n.length%4)%4),o=`${n}${i}`.replace(/-/g,"+").replace(/_/g,"/"),s=window.atob(o),a=new Uint8Array(s.length);for(let c=0;c<s.length;++c)a[c]=s.charCodeAt(c);return a}async function hc(){if(!Gn())return;const{subscription:n}=await zi();let i=null;try{i=await rc()}catch(o){if(!/(not found|unknown)/i.test(o.message))throw o}if(i&&n){const o=i.endpoint===n.endpoint,s=Mn(),a=i.serverKey===s;if(!o)throw new Error("Backend subscription endpoint changed");if(!a)throw new Error("Backend subscription key and vapid key changed")}if(n&&!i){const o=Mn();if(o){const{applicationServerKey:s}=n.options,a=no(o).toString(),c=new Uint8Array(s).toString();if(!(a===c))throw await n.unsubscribe(),new Error("Subscription key and vapid key changed")}}return{subscription:n,backendSubscription:i}}async function ts({data:n,policy:i}){if(!Gn())return;let{registration:o,subscription:s}=await zi(),a=null;if(s)try{a=await lc({data:n,policy:i})}catch{a=await es({subscription:s,data:n,policy:i})}else{const c=Mn();if(!c)throw new Error("No server key found");s=await o.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:no(c)}),a=await es({subscription:s,data:n,policy:i})}return{subscription:s,backendSubscription:a}}async function ns(){if(!Gn())return;const{subscription:n}=await zi();n&&(await dc(),await n.unsubscribe())}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"},is=16,Dt=[14,15,16,17,18,19,20],{PHANPY_WEBSITE:ss,PHANPY_PRIVACY_POLICY_URL:fc,PHANPY_TRANSLANG_INSTANCES:mc,PHANPY_IMG_ALT_API_URL:gc,PHANPY_GIPHY_API_KEY:vc}=pc,os=Object.entries(la.tl).map(([n,i])=>({code:n,name:i})),yc="TransLang API";function bc({onClose:n}){const{_:i}=ce(),o=Ge(E),s=Te.local.get("theme")||"auto",a=q(),c=o.settings.contentTranslationTargetLanguage||null,p=Bs(),l=Mt(p),d=Te.local.get("textSize")||is,[r,h]=R(yi()),{masto:m,authenticated:f,instance:y}=se(),[v,C]=R(Te.local.get("experiments-tabBarV2")??!1),k=r["posting:default:visibility"]==="private";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(u,{id:"Tz0i8g"})})}),e("main",{children:[e("section",{children:e("ul",{children:[e("li",{children:[e("div",{children:e("label",{children:e(u,{id:"aAIQg2"})})}),e("div",{children:e("form",{ref:a,onInput:b=>{b.preventDefault();const _=new FormData(a.current).get("theme"),w=document.documentElement;if(_==="auto"){w.classList.remove("is-light","is-dark");const A=document.querySelector('meta[data-theme-setting="manual"]');A&&(A.name=""),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(T=>{T.name="theme-color"})}else{w.classList.toggle("is-light",_==="light"),w.classList.toggle("is-dark",_==="dark");const A=document.querySelector('meta[data-theme-setting="manual"]');A&&(A.name="theme-color",A.content=_==="light"?A.dataset.themeLightColor:A.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(T=>{T.name=""})}document.querySelector('meta[name="color-scheme"]').setAttribute("content",_==="auto"?"light dark":_),_==="auto"?Te.local.del("theme"):Te.local.set("theme",_)},children:e("div",{class:"radio-group",children:[e("label",{children:[e("input",{type:"radio",name:"theme",value:"light",defaultChecked:s==="light"}),e("span",{children:e(u,{id:"1njn7W"})})]}),e("label",{children:[e("input",{type:"radio",name:"theme",value:"dark",defaultChecked:s==="dark"}),e("span",{children:e(u,{id:"pvnfJD"})})]}),e("label",{children:[e("input",{type:"radio",name:"theme",value:"auto",defaultChecked:s!=="light"&&s!=="dark"}),e("span",{children:e(u,{id:"R9Khdg"})})]})]})})})]}),e("li",{children:[e("div",{children:e("label",{children:e(u,{id:"7r6sCa"})})}),e("div",{class:"range-group",children:[e("span",{style:{fontSize:Dt[0]},children:e(u,{id:"J6ypuD"})})," ",e("input",{type:"range",min:Dt[0],max:Dt[Dt.length-1],step:"1",value:d,list:"sizes",onChange:b=>{const g=parseInt(b.target.value,10);document.documentElement.style.setProperty("--text-size",`${g}px`),g===is?Te.local.del("textSize"):Te.local.set("textSize",b.target.value)}})," ",e("span",{style:{fontSize:Dt[Dt.length-1]},children:e(u,{id:"J6ypuD"})}),e("datalist",{id:"sizes",children:Dt.map(b=>e("option",{value:b}))})]})]}),e("li",{children:[e("span",{children:[e("label",{children:e(u,{id:"CeJHfb"})}),e("br",{}),e("small",{children:e("a",{href:"https://crowdin.com/project/phanpy",target:"_blank",rel:"noopener",children:e(u,{id:"FFmj1D"})})})]}),e(Oi,{})]})]})}),f&&e(D,{children:[e("h3",{children:e(u,{id:"PcoS3v"})}),e("section",{children:e("ul",{children:[e("li",{children:[e("label",{for:"posting-privacy-field",children:[e(u,{id:"NAjVvt"})," ",e(I,{icon:"cloud",alt:i({id:"N2FcBE"}),class:"synced-icon"})]}),e("select",{id:"posting-privacy-field",value:r["posting:default:visibility"]||"public",onChange:b=>{const{value:g}=b.target;(async()=>{try{await m.v1.accounts.updateCredentials({source:{privacy:g}});const _={...r,"posting:default:visibility":g};g==="private"&&(_["posting:default:quote_policy"]="nobody"),h(_),ji(_)}catch{alert(i({id:"Oa+KBY"}))}})()},children:[e("option",{value:"public",children:e(u,{id:"7d1a0d"})}),e("option",{value:"unlisted",children:e(u,{id:"pPYeIN"})}),e("option",{value:"private",children:e(u,{id:"x5LEuB"})})]})]}),Bt()&&e("li",{children:[e("label",{for:"posting-quote-policy-field",children:[e(u,{id:"eKInue"})," ",e(I,{icon:"cloud",alt:i({id:"N2FcBE"}),class:"synced-icon"})]}),e("select",{id:"posting-quote-policy-field",value:r["posting:default:quote_policy"]||k?"nobody":"public",disabled:k,onChange:b=>{const{value:g}=b.target;(async()=>{try{await m.v1.accounts.updateCredentials({source:{quote_policy:g}}),h({...r,"posting:default:quote_policy":g}),ji({...r,"posting:default:quote_policy":g})}catch{alert(i({id:"hEe3YR"}))}})()},children:[e("option",{value:"public",disabled:k,children:e(u,{id:"hDWXuG"})}),e("option",{value:"followers",disabled:k,children:e(u,{id:"9Ko+Xp"})}),e("option",{value:"nobody",children:e(u,{id:"+bAQ3S"})})]})]})]})}),e("p",{class:"section-postnote",children:[e(I,{icon:"cloud",alt:i({id:"N2FcBE"}),class:"synced-icon"})," ",e("small",{children:e(u,{id:"xlsg7n",values:{instance:y},components:{0:e("a",{href:`https://${y}/`,target:"_blank",rel:"noopener"})}})})]})]}),e("h3",{children:e(u,{id:"ivdhsq"})}),e("section",{children:e("ul",{children:[e("li",{class:"block",children:e("label",{children:[e("input",{type:"checkbox",checked:o.settings.autoRefresh,onChange:b=>{E.settings.autoRefresh=b.target.checked}})," ",e(u,{id:"0mC0SF"})]})}),e("li",{class:"block",children:e("label",{children:[e("input",{type:"checkbox",checked:o.settings.boostsCarousel,onChange:b=>{E.settings.boostsCarousel=b.target.checked}})," ",e(u,{id:"TSbnoW"})]})}),!!mc&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:o.settings.contentTranslation,onChange:b=>{const{checked:g}=b.target;E.settings.contentTranslation=g,g||(E.settings.contentTranslationTargetLanguage=null)}})," ",e(u,{id:"0SdaOt"})]}),e("div",{class:`sub-section ${o.settings.contentTranslation?"":"more-insignificant"}`,children:[e("div",{children:e("label",{children:[e(u,{id:"zXCa9e"})," ",e("select",{value:c||"",disabled:!o.settings.contentTranslation,style:{width:"10em"},onChange:b=>{E.settings.contentTranslationTargetLanguage=b.target.value||null},children:[e("option",{value:"",children:e(u,{id:"jNCSyx",values:{systemTargetLanguageText:l}})}),e("option",{disabled:!0,children:"──────────"}),os.map(b=>{const g=Mt({code:b.code,fallback:b.name}),_=Mt({code:b.code,locale:b.code}),w=_&&g!==_;return e("option",{value:b.code,children:w?`${_} - ${g}`:g})})]})]})}),e("hr",{}),e("div",{class:"checkbox-fieldset",children:[e(u,{id:"cc0NrU",values:{0:o.settings.contentTranslationHideLanguages.length}}),e("div",{class:"checkbox-fields",children:os.map(b=>{const g=Mt({code:b.code,fallback:b.name}),_=Mt({code:b.code,locale:b.code}),w=_&&g!==_;return e("label",{children:[e("input",{type:"checkbox",checked:o.settings.contentTranslationHideLanguages.includes(b.code),onChange:A=>{const{checked:S}=A.target;S?E.settings.contentTranslationHideLanguages.push(b.code):E.settings.contentTranslationHideLanguages=o.settings.contentTranslationHideLanguages.filter(T=>T!==b.code)}})," ",w?e("span",{children:[_," ",e("span",{class:"insignificant ib",children:["- ",g]})]}):g]})})})]}),e("p",{class:"insignificant",children:e("small",{children:e(u,{id:"7I3sDQ",values:{TRANSLATION_API_NAME:yc},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:o.settings.contentTranslationAutoInline,disabled:!o.settings.contentTranslation,onChange:b=>{E.settings.contentTranslationAutoInline=b.target.checked}})," ",e(u,{id:"gURvmk"})]}),e("p",{class:"insignificant",children:e("small",{children:e(u,{id:"PbHARL",components:{0:e("b",{})}})})})]})]})]}),!!vc&&f&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:o.settings.composerGIFPicker,onChange:b=>{E.settings.composerGIFPicker=b.target.checked}})," ",e(u,{id:"D7/2jB"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(u,{id:"/CLBTL",components:{0:e("a",{href:"https://developers.giphy.com/",target:"_blank",rel:"noopener"})}})})})]}),!!gc&&f&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:o.settings.mediaAltGenerator,onChange:b=>{E.settings.mediaAltGenerator=b.target.checked}})," ",e(u,{id:"9q5uor"})," ",e(I,{icon:"sparkles2",class:"more-insignificant"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(u,{id:"faZ9RI"})})}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(u,{id:"fHZgvt",components:{0:e("a",{href:"https://github.com/cheeaun/img-alt-api",target:"_blank",rel:"noopener"})}})})})]}),f&&bi()?.mastodon>=2&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:o.settings.groupedNotificationsAlpha,onChange:b=>{E.settings.groupedNotificationsAlpha=b.target.checked}})," ",e(u,{id:"aGziA/"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(u,{id:"X17jCM"})})})]}),f&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:o.settings.shortcutSettingsCloudImportExport,onChange:b=>{E.settings.shortcutSettingsCloudImportExport=b.target.checked}})," ",e(u,{id:"570qTm"})," ",e(I,{icon:"cloud",class:"more-insignificant"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(u,{id:"0tZAhT",components:{0:e("br",{})}})})}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(u,{id:"fHf1v/"})})})]}),e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:o.settings.cloakMode,onChange:b=>{E.settings.cloakMode=b.target.checked}})," ",e(u,{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(u,{id:"T/hglb"})})})]}),f&&e("li",{children:e("button",{type:"button",class:"light",onClick:()=>{E.showDrafts=!0,E.showSettings=!1},children:e(u,{id:"krk5ws"})})})]})}),f&&e(wc,{onClose:n}),e("h3",{children:e(u,{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:Di,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:b=>{b.preventDefault(),E.showAccount="phanpy@hachyderm.io"},children:"@phanpy"}),e("br",{}),e(u,{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:b=>{b.preventDefault(),E.showAccount="cheeaun@mastodon.social"}})}})]})]}),e("p",{children:[e("a",{href:"https://github.com/sponsors/cheeaun",target:"_blank",rel:"noopener",children:e(u,{id:"O4cLCR"})})," ","·"," ",e("a",{href:"https://www.buymeacoffee.com/cheeaun",target:"_blank",rel:"noopener",children:e(u,{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(u,{id:"3ePd3I"})})," ","·"," ",e("a",{href:fc,target:"_blank",rel:"noopener",children:e(u,{id:"LcET2C"})})]}),e("p",{children:[ss&&e(D,{children:[e(u,{id:"pFnMHn",values:{0:ss.replace(/https?:\/\//g,"").replace(/\/$/,"")},components:{0:e("span",{class:"insignificant"})}}),e("br",{})]}),e(u,{id:"6KkH+2",values:{0:e("span",{class:"ib insignificant",children:["(",e("a",{href:"https://github.com/cheeaun/phanpy/commit/7d7cb91",target:"_blank",rel:"noopener",children:e(Ct,{datetime:new Date("2025-11-08T15:05:40.014Z")})}),")"]})},components:{0:e("span",{class:"insignificant"}),1:e("input",{type:"text",class:"version-string",readOnly:!0,size:"18",value:`${"2025-11-08T15:05:40.014Z".slice(0,10).replace(/-/g,".")}.7d7cb91`,onClick:b=>{b.target.select();try{navigator.clipboard.writeText(b.target.value),le(i({id:"PiPfua"}))}catch{le(i({id:"gdxreD"}))}}})}})]})]}),void 0]})]})}function wc({onClose:n}){const{_:i}=ce();if(!Gn())return null;const{instance:o}=se(),[s,a]=R("default"),c=q(),[p,l]=R(!1),[d,r]=R(!1),h=q();G(()=>{(async()=>{a("loading");try{const{subscription:f,backendSubscription:y}=await hc();if(y?.policy&&y.policy!=="none"){l(!0);const{alerts:v,policy:C}=y;h.current=C;const{elements:k}=c.current,b=k.namedItem("policy");b&&(b.value=C),Object.entries(v).forEach(([g,_])=>{const w=k.namedItem(g);w?.type==="checkbox"&&(w.checked=!!_)})}a("default")}catch(f){/outside.*authorized/i.test(f.message)?r(!0):alert(f?.message||f),a("error")}})()},[]);const m=s==="loading";return e("form",{ref:c,onChange:()=>{setTimeout(()=>{const f=Object.fromEntries(new FormData(c.current)),y=!!f["policy-allow"],v={data:{policy:f.policy,alerts:{mention:!!f.mention,favourite:!!f.favourite,reblog:!!f.reblog,follow:!!f.follow,follow_request:!!f.followRequest,poll:!!f.poll,update:!!f.update,status:!!f.status}}};let C=0;Object.keys(v.data.alerts).forEach(b=>{v.data.alerts[b]?C++:delete v.data.alerts[b]});const k=h.current!==v.data.policy;y&&C>0?k?ns().then(()=>{ts(v)}).catch(b=>{alert(i({id:"I6pdY3"}))}):ts(v).catch(b=>{alert(i({id:"I6pdY3"}))}):ns().catch(b=>{alert(i({id:"q1zFd+"}))})},100)},children:[e("h3",{children:e(u,{id:"WUHLnz"})}),e("section",{children:e("ul",{children:e("li",{children:[e("label",{children:[e("input",{type:"checkbox",disabled:m||d,name:"policy-allow",checked:p,onChange:async f=>{const{checked:y}=f.target;if(y){const v=await Notification.requestPermission();v==="granted"?l(!0):(l(!1),v==="denied"&&alert(i({id:"6LUsk7"})))}else l(!1)}})," ",e(u,{id:"qYNCa1",values:{0:[{value:"all",label:i({id:"+niKJH"})},{value:"followed",label:i({id:"x2NYtp"})},{value:"follower",label:i({id:"PBFNgg"})}].map(f=>e("option",{value:f.value,children:f.label}))},components:{0:e("select",{name:"policy",disabled:m||d||!p})}})]}),e("div",{class:"shazam-container no-animation",style:{width:"100%"},hidden:!p,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(f=>e("li",{children:e("label",{children:[e("input",{type:"checkbox",name:f.value})," ",f.label]})}))})})})}),d&&e("div",{class:"sub-section",children:e("p",{children:e(u,{id:"8d0b8B",components:{0:e(fe,{to:`/login?instance=${o}`,onClick:n}),1:e("b",{})}})})})]})})}),e("p",{class:"section-postnote",children:e("small",{children:e(u,{id:"z96cOX",components:{0:e("b",{})}})})})]})}const ui=()=>{let n=setTimeout(()=>{const i=document.getElementById("columns");if(i){const o=i.querySelector(".deck-container.focus");if(o)o.focus();else{const s=Array.from(i.querySelectorAll(".deck-container")).find(a=>a.getBoundingClientRect().left>=0);s?s.focus():i.querySelector(".deck-container")?.focus?.()}}else{const o=document.querySelectorAll("#modal-container > *");if(o?.length){const p=o[o.length-1],l=p.querySelector('[tabindex="-1"]')||p;if(l){l.focus();return}}if(document.querySelector(".deck-backdrop"))return;const a=document.querySelectorAll(".deck-container"),c=a[a.length-1];c&&c.tabIndex===-1&&c.focus()}},100);return()=>clearTimeout(n)};function io(n){if(!n)return;const i=Qt(),o=q(i.pathname);G(()=>{o.current&&i.pathname!==o.current&&n?.()},[i.pathname,n])}function kc({acct:n,instance:i}){let[o,s]=n.split("@");s||(s=i);const a=qn.toASCII(n);return e("div",{class:"handle-info",children:[e("span",{class:"handle-handle",title:a,children:[e("b",{class:"handle-username",children:o}),e("span",{class:"handle-at",children:"@"}),e("b",{class:"handle-server",children:s})]}),e("div",{class:"handle-legend",children:[e("span",{class:"ib",children:[e("span",{class:"handle-legend-icon username"})," ",e(u,{id:"silO9A"})]})," ",e("span",{class:"ib",children:[e("span",{class:"handle-legend-icon server"})," ",e(u,{id:"rZgCpJ"})]})]})]})}const Sc=["image/jpeg","image/png","image/gif","image/webp"],as=Sc.join(",");function Cc({name:n,value:i,disabled:o,index:s}){const[a,c]=R(!!i);return e("tr",{children:[e("td",{children:e("input",{type:"text",name:`fields_attributes[${s}][name]`,defaultValue:n,disabled:o,maxLength:255,required:a,dir:"auto"})}),e("td",{children:e("input",{type:"text",name:`fields_attributes[${s}][value]`,defaultValue:i,disabled:o,maxLength:255,onChange:p=>c(!!p.currentTarget.value),dir:"auto"})})]})}function _c({onClose:n=()=>{}}){const{_:i}=ce(),{masto:o}=se(),[s,a]=R("loading"),[c,p]=R(null),[l,d]=R(null),[r,h]=R(null);G(()=>{(async()=>{try{const w=await o.v1.accounts.verifyCredentials();p(w),a("default")}catch{a("error")}})()},[]);const{displayName:m,source:f,avatar:y,header:v}=c||{},{note:C,fields:k}=f||{},b=q(null),g=[...y?[{type:"image",url:y}]:[],...r?[{type:"image",url:r}]:[]],_=[...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(u,{id:"9OpVZg"})})}),e("main",{children:s==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):e("form",{onSubmit:w=>{w.preventDefault();const A=new FormData(w.target),S=A.get("header"),T=A.get("avatar"),M=A.get("display_name"),L=A.get("note"),H=b.current.querySelectorAll('input[name^="fields_attributes"]'),F=[];H.forEach(U=>{const W=U.name,[Q,V,j]=W.match(/fields_attributes\[(\d+)\]\[(.+)\]/)||[],K=U.value?U.value.trim():"";V&&j&&K&&(F[V]||(F[V]={}),F[V][j]=K)}),F.forEach(U=>{U.name&&!U.value&&(U.value="")}),(async()=>{try{const U=await o.v1.accounts.updateCredentials({header:S,avatar:T,displayName:M,note:L,fieldsAttributes:F});n?.({state:"success",account:U})}catch(U){alert(U?.message||i({id:"FwMMx0"}))}})()},children:[e("div",{class:"edit-profile-media-container",children:[e("label",{children:[e(u,{id:"C5zXYJ"})," ",e("input",{type:"file",name:"header",accept:as,onChange:w=>{const A=w.target.files[0];if(A){const S=URL.createObjectURL(A);d(S)}}})]}),e("div",{class:"edit-profile-media-field",children:[v?e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{E.showMediaModal={mediaAttachments:_,mediaIndex:0}},children:e("img",{src:v,alt:""})}):e("div",{class:"edit-media"}),l&&e(D,{children:[e(I,{icon:"arrow-right"}),e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{E.showMediaModal={mediaAttachments:_,mediaIndex:1}},children:e("img",{src:l,alt:""})})]})]})]}),e("div",{class:"edit-profile-media-container",children:[e("label",{children:[e(u,{id:"4XF0BB"})," ",e("input",{type:"file",name:"avatar",accept:as,onChange:w=>{const A=w.target.files[0];if(A){const S=URL.createObjectURL(A);h(S)}}})]}),e("div",{class:"edit-profile-media-field",children:[y?e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{E.showMediaModal={mediaAttachments:g,mediaIndex:0}},children:e("img",{src:y,alt:""})}):e("div",{class:"edit-media"}),r&&e(D,{children:[e(I,{icon:"arrow-right"}),e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{E.showMediaModal={mediaAttachments:g,mediaIndex:1}},children:e("img",{src:r,alt:""})})]})]})]}),e("p",{children:e("label",{children:[e(u,{id:"6YtxFj"})," ",e("input",{type:"text",name:"display_name",defaultValue:m,maxLength:30,disabled:s==="loading",dir:"auto"})]})}),e("p",{children:e("label",{children:[e(u,{id:"E+oKCO"}),e("textarea",{defaultValue:C,name:"note",maxLength:500,rows:"5",disabled:s==="loading",dir:"auto"})]})}),e("p",{children:e(u,{id:"T4I119"})}),e("table",{ref:b,children:[e("thead",{children:e("tr",{children:[e("th",{children:e(u,{id:"87a/t/"})}),e("th",{children:e(u,{id:"4b3oEV"})})]})}),e("tbody",{children:Array.from({length:Math.max(4,k.length)}).map((w,A)=>{const{name:S="",value:T=""}=k[A]||{};return e(Cc,{name:S,value:T,index:A,disabled:s==="loading"},A)})})]}),e("footer",{children:[e("button",{type:"button",class:"light",disabled:s==="loading",onClick:()=>{n?.()},children:e(u,{id:"dEgA5A"})}),e("button",{type:"submit",disabled:s==="loading",children:e(u,{id:"tfDRzk"})})]})]})})]})}const Ic=80;function Ac({accountID:n,info:i,open:o=!1,onlyOpenIfHasEndorsements:s=!1}){const{masto:a}=se(),c=q(),[p,l]=R("default"),[d,r]=R([]),[h,m]=R({});return G(()=>{Xe("@mastodon/endorsements")&&o&&(async()=>{l("loading");try{const y=await a.v1.accounts.$select(n).endorsements.list({limit:Ic});if(!y.length){l("default");return}r(y),l("default"),setTimeout(()=>{c.current.scrollIntoView({behavior:"smooth",block:"nearest"})},300);const v=await Kn(y,h);v&&m(v)}catch{l("error")}})()},[o,n]),(s?o&&d.length>0:o)?e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e("div",{class:"endorsements-container",ref:c,children:[e("h3",{children:e(u,{id:"UIfdY1",values:{0:i.username}})}),p==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):d.length>0?e("ul",{class:`endorsements ${d.length>10?"expanded":""}`,children:d.map(y=>e("li",{children:e(ut,{account:y,showStats:!0,avatarSize:"xxl",relationship:h[y.id]},y.id)}))}):e("p",{class:"ui-state insignificant",children:e(u,{id:"AgkUZa"})})]})})}):null}const so=1e3*60,Tc=24*60*60*1e3,hi=yt(async()=>{const{masto:n}=se(),i=await n.v1.lists.list();return i.sort((o,s)=>o.title.localeCompare(s.title)),i.length&&setTimeout(()=>{Te.account.set("lists",{lists:i,updatedAt:Date.now()})},1),i},{maxAge:so});async function pn(){try{const{lists:n,updatedAt:i}=Te.account.get("lists")||{};return n?.length?(Date.now()-i>Tc&&hi(),n):await hi()}catch{return[]}}const xc=yt(n=>{const{masto:i}=se();return i.v1.lists.$select(n).fetch()},{maxAge:so});async function oo(n){const{lists:i}=Te.account.get("lists")||{};if(i?.length){const o=i.find(s=>s.id===n);if(o)return o}try{return xc(n)}catch{return null}}async function Ec(n){return(await oo(n))?.title||""}function Rc(n){const{lists:i}=Te.account.get("lists")||{};i?.length&&(i.push(n),i.sort((o,s)=>o.title.localeCompare(s.title)),Te.account.set("lists",{lists:i,updatedAt:Date.now()}))}function Lc(n){const{lists:i}=Te.account.get("lists")||{};if(i?.length){const o=i.findIndex(s=>s.id===n.id);o!==-1&&(i[o]=n,i.sort((s,a)=>s.title.localeCompare(a.title)),Te.account.set("lists",{lists:i,updatedAt:Date.now()}))}}function Mc(n){const{lists:i}=Te.account.get("lists")||{};if(i?.length){const o=i.findIndex(s=>s.id===n);o!==-1&&(i.splice(o,1),Te.account.set("lists",{lists:i,updatedAt:Date.now()}))}}function Kt({insignificant:n}){const{_:i}=ce();return e(I,{icon:"filter",size:"xs",class:`list-exclusive-badge ${n?"insignificant":""}`,title:i({id:"FNptcJ"})})}function Fi({list:n,onClose:i}){const{_:o}=ce(),{masto:s}=se(),[a,c]=R("default"),p=!!n,l=q(),d=q(),r=q();G(()=>{p&&(l.current.value=n.title,d.current.value=n.repliesPolicy,r.current&&(r.current.checked=n.exclusive))},[p]);const h=Xe("@mastodon/list-exclusive")||Xe("@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:o({id:"yz7wBu"})})})," ",e("header",{children:e("h2",{children:o(p?{id:"tuhghE"}:{id:"Sb2gYF"})})}),e("main",{children:e("form",{class:"list-form",onSubmit:m=>{m.preventDefault();const f=new FormData(m.target),y=f.get("title"),v=f.get("replies_policy"),C=f.get("exclusive")==="on";c("loading"),(async()=>{try{let k;p?k=await s.v1.lists.$select(n.id).update({title:y,replies_policy:v,exclusive:C}):k=await s.v1.lists.create({title:y,replies_policy:v,exclusive:C}),c("default"),i?.({state:"success",list:k}),setTimeout(()=>{p?Lc(k):Rc(k)},1)}catch{c("error"),alert(o(p?{id:"R7ep1i"}:{id:"KPoj8w"}))}})()},children:[e("div",{class:"list-form-row",children:e("label",{for:"list-title",children:[e(u,{id:"6YtxFj"})," ",e("input",{ref:l,type:"text",id:"list-title",name:"title",required:!0,disabled:a==="loading",dir:"auto"})]})}),e("div",{class:"list-form-row",children:e("select",{ref:d,name:"replies_policy",required:!0,disabled:a==="loading",children:[e("option",{value:"list",children:e(u,{id:"ei6pnR"})}),e("option",{value:"followed",children:e(u,{id:"Mr53YX"})}),e("option",{value:"none",children:e(u,{id:"PM7llw"})})]})}),h&&e("div",{class:"list-form-row",children:e("label",{class:"label-block",children:[e("input",{ref:r,type:"checkbox",name:"exclusive",disabled:a==="loading"})," ",e(Kt,{insignificant:!0})," ",e(u,{id:"jxxYp0"})]})}),e("div",{class:"list-form-footer",children:[e("button",{type:"submit",disabled:a==="loading",children:o(p?{id:"tfDRzk"}:{id:"hYgDIe"})}),p&&e(ft,{disabled:a==="loading",align:"end",menuItemClassName:"danger",confirmLabel:o({id:"+kQ/cY"}),onClick:()=>{c("loading"),(async()=>{try{await s.v1.lists.$select(n.id).remove(),c("default"),i?.({state:"deleted"}),setTimeout(()=>{Mc(n.id)},1)}catch{c("error"),alert(o({id:"tqUaGL"}))}})()},children:e("button",{type:"button",class:"light danger",disabled:a==="loading",children:e(u,{id:"Jb6/SB"})})})]})]})})]})}function $c({accountID:n,onClose:i}){const{_:o}=ce(),{masto:s}=se(),[a,c]=R("default"),[p,l]=R([]),[d,r]=R([]),[h,m]=xt(v=>v+1,0);G(()=>{c("loading"),(async()=>{try{const v=await pn();l(v);const C=await s.v1.accounts.$select(n).lists.list();r(C),c("default")}catch{c("error")}})()},[h]);const[f,y]=R(!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:o({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{id:"sJ2yQc"})})}),e("main",{children:[p.length>0?e("ul",{class:"list-add-remove",children:p.map(v=>{const C=d.some(k=>k.id===v.id);return e("li",{children:e("button",{type:"button",class:`light ${C?"checked":""}`,disabled:a==="loading",onClick:()=>{c("loading"),(async()=>{try{C?await s.v1.lists.$select(v.id).accounts.remove({accountIds:[n]}):await s.v1.lists.$select(v.id).accounts.create({accountIds:[n]}),m()}catch{c("error"),alert(o(C?{id:"7KnEYa"}:{id:"Tba8uO"}))}})()},children:[e(I,{icon:"check-circle",alt:"☑️"}),e("span",{children:v.title})]})})})}):a==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):a==="error"?e("p",{class:"ui-state",children:e(u,{id:"v/l5uA"})}):e("p",{class:"ui-state",children:e(u,{id:"/MJ7gZ"})}),e("button",{type:"button",class:"plain2",onClick:()=>y(!0),disabled:a!=="default",children:[e(I,{icon:"plus",size:"l"})," ",e("span",{children:e(u,{id:"Sb2gYF"})})]})]}),f&&e(Ue,{onClick:v=>{v.target===v.currentTarget&&y(!1)},children:e(Fi,{list:f?.list,onClose:v=>{v.state==="success"&&m(),y(!1)}})})]})}function Nc({account:n,note:i,onRelationshipChange:o=()=>{},onClose:s=()=>{}}){const{_:a}=ce(),{masto:c}=se(),[p,l]=R("default"),d=q(null);return G(()=>{let r;return d.current&&!i&&(r=setTimeout(()=>{d.current.focus?.()},100)),()=>{clearTimeout(r)}},[]),e("div",{class:"sheet",id:"private-note-container",children:[!!s&&e("button",{type:"button",class:"sheet-close",onClick:s,children:e(I,{icon:"x",alt:a({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(u,{id:"DYqYm5",values:{0:n?.username||n?.acct},components:{0:e("span",{class:"bidi-isolate"})}})})}),e("main",{children:e("form",{onSubmit:r=>{r.preventDefault();const m=new FormData(r.target).get("note");m?.trim()!==i?.trim()&&(l("loading"),(async()=>{try{const f=await c.v1.accounts.$select(n?.id).note.create({comment:m});l("default"),o(f),s()}catch(f){l("error"),alert(f?.message||a({id:"ot8LpF"}))}})())},children:[e("textarea",{ref:d,name:"note",disabled:p==="loading",dir:"auto",children:i}),e("footer",{children:[e("button",{type:"button",class:"light",disabled:p==="loading",onClick:()=>{s?.()},children:e(u,{id:"dEgA5A"})}),e("span",{children:[e(Oe,{abrupt:!0,hidden:p!=="loading"}),e("button",{disabled:p==="loading",type:"submit",children:e(u,{id:"SrwrEj"})})]})]})]})})]})}function Pc({note:n,fields:i,onClose:o}){const{_:s}=ce(),a=i?.map(({name:p,value:l})=>`${p}
|
||
${Gi(l)}`).join(`
|
||
|
||
`)||"",c=Gi(n)+(a?`
|
||
|
||
${a}`:"");return e("div",{class:"sheet",children:[!!o&&e("button",{type:"button",class:"sheet-close",onClick:o,children:e(I,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{id:"9groMz"})})}),e("main",{children:[e("p",{style:{whiteSpace:"pre-wrap"},children:c}),e(qs,{forceTranslate:!0,text:c})]})]})}const Dc=[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],Yt={0:{id:"9ZP9cc"},300:it(5,"minute"),1800:it(30,"minute"),3600:it(1,"hour"),21600:it(6,"hour"),86400:it(1,"day"),259200:it(3,"day"),604800:it(1,"week"),2592e3:it(30,"day")};function Oc({info:n,instance:i,standalone:o,authenticated:s,onRelationshipChange:a=()=>{},setShowEditProfile:c=()=>{},showEndorsements:p=!1,renderEndorsements:l=!1,setRenderEndorsements:d=()=>{}}){if(!n)return null;const{_:r,_:h}=ce(),{masto:m,instance:f,authenticated:y}=se(),v=i===f,[C,k]=R("default"),[b,g]=R(null),{id:_,acct:w,url:A,username:S,locked:T,lastStatusAt:M,note:L,fields:H,moved:F}=n,U=q(_),{following:W,showingReblogs:Q,notifying:V,followedBy:j,blocking:K,blockedBy:pe,muting:$,mutingNotifications:ie,requested:Y,domainBlocking:ee,endorsed:he,note:re}=b||{},[J,Ce]=R(null),[ve,ye]=R(!1),Ne=w.includes("@")?w:`${w}@${i}`,Se=Xe("@mastodon/endorsements");G(()=>{if(n){const O=vt();let Ie;(async()=>{if(v&&s)Ie=_;else if(!v&&y){const Ee=n.acct.includes("@");try{const P=await m.v2.search.list({q:Ee?n.acct:`${n.username}@${i}`,type:"accounts",limit:1,resolve:!0});P.accounts.length&&(Ie=P.accounts[0].id,Ce(P.accounts[0]))}catch{}}if(!Ie)return;if(O===Ie){ye(!0);return}U.current=Ie,k("loading");const Me=m.v1.accounts.relationships.fetch({id:[Ie]});try{const Ee=await Me;if(k("default"),Ee.length){const P=Ee[0];g(P),a({relationship:P,currentID:Ie})}}catch{k("error")}})()}},[n,s]),G(()=>{n&&ve&&Bo(n)},[n,ve]);const Ae=C==="loading",[xe,Pe]=R(!1),[ze,Be]=R(!1),[Ye,oe]=R(!1),[Le,Re]=R([]);return e(D,{children:[e("div",{class:"actions",children:[e("span",{children:[j?e("span",{class:"tag",children:e(u,{id:"p3UO/y"})}):M?e("small",{class:"insignificant",children:e(u,{id:"F3cM1G",values:{0:st(M,{hideTime:!0})},components:{0:e("span",{class:"ib"})}})}):e("span",{}),$&&e("span",{class:"tag danger",children:e(u,{id:"+IJm1Z"})}),K&&e("span",{class:"tag danger",children:e(u,{id:"32TndD"})})]})," ",e("span",{class:"buttons",children:[!!re&&e("button",{type:"button",class:"private-note-tag",title:h({id:"zxFxcH"}),onClick:()=>{oe(!0)},dir:"auto",children:e("span",{children:re})}),e(lt,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:e("button",{type:"button",class:"plain",disabled:Ae,children:e(I,{icon:"more",size:"l",alt:h({id:"2FYpfJ"})})}),onMenuChange:O=>{W&&O.open&&(async()=>{try{const Ie=await m.v1.accounts.$select(U.current).lists.list();Re(Ie)}catch{}})()},children:[y&&!ve?e(D,{children:[e(ge,{onClick:()=>{zs({draftStatus:{status:`@${J?.acct||w} `}})},children:[e(I,{icon:"at"}),e("span",{children:e(u,{id:"3LkfZu",values:{username:S},components:{0:e("span",{class:"bidi-isolate"})}})})]}),e(ge,{onClick:()=>{Pe(!0)},children:[e(I,{icon:"translate"}),e("span",{children:e(u,{id:"R8mSiS"})})]}),Xe("@mastodon/profile-private-note")&&e(ge,{onClick:()=>{oe(!0)},children:[e(I,{icon:"pencil"}),e("span",{children:h(re?{id:"U+Gokq"}:{id:"VcQzRi"})})]}),W&&!!b&&e(D,{children:[e(ge,{onClick:()=>{k("loading"),(async()=>{try{const O=await m.v1.accounts.$select(U.current).follow({notify:!V});O&&g(O),k("default"),le(O.notifying?h({id:"jL3N0G",values:{username:S}}):h({id:"0h4/9h",values:{username:S}}))}catch(O){alert(O),k("error")}})()},children:[e(I,{icon:"notification"}),e("span",{children:h(V?{id:"osJmEN"}:{id:"I92Z+b"})})]}),e(ge,{onClick:()=>{k("loading"),(async()=>{try{const O=await m.v1.accounts.$select(U.current).follow({reblogs:!Q});O&&g(O),k("default"),le(O.showingReblogs?h({id:"0X2KC8",values:{username:S}}):h({id:"cXWjH0",values:{username:S}}))}catch(O){alert(O),k("error")}})()},children:[e(I,{icon:"rocket"}),e("span",{children:h(Q?{id:"GRUr8d"}:{id:"uREpT3"})})]})]}),Se&&W&&e(ge,{onClick:()=>{k("loading"),(async()=>{try{if(he){const O=await m.v1.accounts.$select(J?.id||_).unpin();g(O),k("default"),le(h({id:"pWFLFk",values:{username:S}}))}else{const O=await m.v1.accounts.$select(J?.id||_).pin();g(O),k("default"),le(h({id:"xhiXaF",values:{username:S}}))}}catch{k("error"),he?le(h({id:"xHq5L2",values:{username:S}})):le(h({id:"Owr/5+",values:{username:S}}))}})()},children:[e(I,{icon:"endorsement"}),h(he?{id:"S9JvjK"}:{id:"UlJ3QN"})]}),p&&Se&&!l&&e(ge,{onClick:()=>d(!0),children:[e(I,{icon:"endorsement"}),e("span",{children:e(u,{id:"Qopbnd"})})]}),W&&e(ge,{onClick:()=>{Be(!0)},children:[e(I,{icon:"list"}),Le.length?e(D,{children:[e("small",{class:"menu-grow",children:[e(u,{id:"sJ2yQc"}),e("br",{}),e("span",{class:"more-insignificant",children:Le.map(O=>O.title).join(", ")})]}),e("small",{class:"more-insignificant",children:Le.length})]}):e("span",{children:e(u,{id:"sJ2yQc"})})]}),e(He,{})]}):Se&&!l&&e(D,{children:[e(ge,{onClick:()=>d(!0),children:[e(I,{icon:"endorsement"}),"Show featured profiles"]}),e(He,{})]}),e(ge,{onClick:()=>{const O=`@${J?.acct||Ne}`;try{navigator.clipboard.writeText(O),le(h({id:"zJoEwS"}))}catch{le(h({id:"BC0lSD"}))}},children:[e(I,{icon:"copy"}),e("small",{children:[e(u,{id:"27x6gl"}),e("br",{}),e("span",{class:"more-insignificant bidi-isolate",children:["@",J?.acct||Ne]})]})]}),e(ge,{href:A,target:"_blank",children:[e(I,{icon:"external"}),e("small",{class:"menu-double-lines",children:zc(A)})]}),e("div",{class:"menu-horizontal",children:[e(ge,{onClick:()=>{try{navigator.clipboard.writeText(A),le(h({id:"edWbV6"}))}catch{le(h({id:"W1ewR0"}))}},children:[e(I,{icon:"link"}),e("span",{children:e(u,{id:"he3ygx"})})]}),navigator?.share&&navigator?.canShare?.({url:A})&&e(ge,{onClick:()=>{try{navigator.share({url:A})}catch{alert(h({id:"TtG3Uh"}))}},children:[e(I,{icon:"share"}),e("span",{children:e(u,{id:"LFKLqp"})})]})]}),!!b&&e(D,{children:[e(He,{}),$?e(ge,{onClick:()=>{k("loading"),(async()=>{try{const O=await m.v1.accounts.$select(J?.id||_).unmute();g(O),k("default"),le(h({id:"B4Xkly",values:{username:S}})),E.reloadGenericAccounts.id="mute",E.reloadGenericAccounts.counter++}catch{k("error")}})()},children:[e(I,{icon:"unmute"}),e("span",{children:e(u,{id:"Q/HUhC",values:{username:S},components:{0:e("span",{class:"bidi-isolate"})}})})]}):e(hn,{menuClassName:"menu-blur",openTrigger:"clickOnly",direction:"bottom",overflow:"auto",shift:16,label:e(D,{children:[e(I,{icon:"mute"}),e("span",{class:"menu-grow",children:e(u,{id:"xhPEH3",values:{username:S},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:Dc.map(O=>e(ge,{onClick:()=>{k("loading"),(async()=>{try{const Ie=await m.v1.accounts.$select(J?.id||_).mute({duration:O});g(Ie),k("default"),le(h({id:"/plB9m",values:{0:typeof Yt[O]=="function"?Yt[O]():r(Yt[O]),username:S}})),E.reloadGenericAccounts.id="mute",E.reloadGenericAccounts.counter++}catch{k("error"),le(h({id:"vWGBjT",values:{username:S}}))}})()},children:typeof Yt[O]=="function"?Yt[O]():r(Yt[O])}))})}),j&&e(ft,{subMenu:!0,menuItemClassName:"danger",confirmLabel:e(D,{children:[e(I,{icon:"user-x"}),e("span",{children:e(u,{id:"unyq2W",values:{username:S},components:{0:e("span",{class:"bidi-isolate"})}})})]}),onClick:()=>{k("loading"),(async()=>{try{const O=await m.v1.accounts.$select(J?.id||_).removeFromFollowers();g(O),k("default"),le(h({id:"AgkcM/",values:{username:S}})),E.reloadGenericAccounts.id="followers",E.reloadGenericAccounts.counter++}catch{k("error")}})()},children:[e(I,{icon:"user-x"}),e("span",{children:e(u,{id:"VCZ0OT"})})]}),e(ft,{subMenu:!0,confirm:!K,confirmLabel:e(D,{children:[e(I,{icon:"block"}),e("span",{children:e(u,{id:"aforS9",values:{username:S},components:{0:e("span",{class:"bidi-isolate"})}})})]}),itemProps:{className:"danger"},menuItemClassName:"danger",onClick:()=>{k("loading"),(async()=>{try{if(K){const O=await m.v1.accounts.$select(J?.id||_).unblock();g(O),k("default"),le(h({id:"sI9N29",values:{username:S}}))}else{const O=await m.v1.accounts.$select(J?.id||_).block();g(O),k("default"),le(h({id:"uYcYzu",values:{username:S}}))}E.reloadGenericAccounts.id="block",E.reloadGenericAccounts.counter++}catch{k("error"),K?le(h({id:"0tG4wG",values:{username:S}})):le(h({id:"pA+qEx",values:{username:S}}))}})()},children:K?e(D,{children:[e(I,{icon:"unblock"}),e("span",{children:e(u,{id:"/3LJfX",values:{username:S},components:{0:e("span",{class:"bidi-isolate"})}})})]}):e(D,{children:[e(I,{icon:"block"}),e("span",{children:e(u,{id:"JRswkR",values:{username:S},components:{0:e("span",{class:"bidi-isolate"})}})})]})}),e(ge,{className:"danger",onClick:()=>{E.showReportModal={account:J||n}},children:[e(I,{icon:"flag"}),e("span",{children:e(u,{id:"qTJgpR",values:{username:S},components:{0:e("span",{class:"bidi-isolate"})}})})]})]}),y&&ve&&o&&Xe("@mastodon/profile-edit")&&e(D,{children:[e(He,{}),e(ge,{onClick:()=>{c(!0)},children:[e(I,{icon:"pencil"}),e("span",{children:e(u,{id:"9OpVZg"})})]})]}),!1]}),!b&&C==="loading"&&e(Oe,{abrupt:!0}),!!b&&!F&&e(ft,{confirm:W||Y,confirmLabel:e("span",{children:h(Y?{id:"e7qQIH"}:{id:"eYsAQr",values:{0:n.acct||n.username}})}),menuItemClassName:"danger",align:"end",disabled:Ae,onClick:()=>{k("loading"),(async()=>{try{let O;W||Y?O=await m.v1.accounts.$select(U.current).unfollow():O=await m.v1.accounts.$select(U.current).follow(),O&&(g(O),p&&Se&&!l&&O.following&&d("onlyOpenIfHasEndorsements")),k("default")}catch(O){alert(O),k("error")}})()},children:e("button",{type:"button",class:`${W||Y?"light swap":""}`,"data-swap-state":W||Y?"danger":"",disabled:Ae,children:W?e(D,{children:[e("span",{children:e(u,{id:"y6sq5j"})}),e("span",{children:e(u,{id:"HKrBPX"})})]}):Y?e(D,{children:[e("span",{children:e(u,{id:"Yx0Ud8"})}),e("span",{children:e(u,{id:"yTVtKs"})})]}):T?e(D,{children:[e(I,{icon:"lock"})," ",e("span",{children:e(u,{id:"MKEPCY"})})]}):h({id:"MKEPCY"})})})]})]}),!!xe&&e(Ue,{onClose:()=>{Pe(!1)},children:e(Pc,{note:L,fields:H,onClose:()=>Pe(!1)})}),!!ze&&e(Ue,{onClose:()=>{Be(!1)},children:e($c,{accountID:U.current,onClose:()=>Be(!1)})}),!!Ye&&e(Ue,{onClose:()=>{oe(!1)},children:e(Nc,{account:n,note:re,onRelationshipChange:O=>{g(O)},onClose:()=>oe(!1)})})]})}function zc(n){if(!n)return;const i=URL.parse(n);if(!i)return;const{host:o,pathname:s}=i,a=s.replace(/\/$/,"").replace(/^\//,"");return e(D,{children:[e("span",{class:"more-insignificant",children:[qn.toUnicode(o),"/"]}),e("wbr",{}),e("span",{children:a})]})}const cs=80,ao=1e3*60*10;function Fc(n,i){return i.v1.accounts.familiarFollowers.fetch({id:[n]})}const Bc=yt(Fc,{maxAge:ao});async function qc(n,i){const o=i.v1.accounts.$select(n).statuses.list({limit:20}).values().next(),{value:s}=await o,a={total:s.length,originals:0,replies:0,boosts:0,quotes:0};return s.forEach(c=>{c.reblog?a.boosts++:c.inReplyToId&&c.inReplyToAccountId!==c.account.id?a.replies++:Bt()&&(c.quote?.id||c.quote?.quotedStatus?.id)?a.quotes++:a.originals++}),s.length&&(a.daysSinceLastPost=Math.ceil((Date.now()-Date.parse(s[s.length-1].createdAt))/864e5)),a}const Uc=yt(qc,{maxAge:ao});function co({account:n,fetchAccount:i=()=>{},standalone:o,instance:s,authenticated:a,showEndorsements:c=!1}){const{i18n:p,_:l}=ce(),{masto:d,authenticated:r}=se({instance:s}),{masto:h,instance:m}=se(),[f,y]=R("default"),v=typeof n=="string",[C,k]=R(v?null:n),b=ke(()=>s===m,[s,m]);G(()=>{if(!v){k(n);return}y("loading"),(async()=>{try{const z=await i();E.accounts[`${z.id}@${s}`]=z,k(z),y("default")}catch{k(null),y("error")}})()},[v,n,i]);const{acct:g,avatar:_,avatarStatic:w,bot:A,createdAt:S,displayName:T,emojis:M,fields:L,followersCount:H,followingCount:F,group:U,id:W,lastStatusAt:Q,locked:V,note:j,statusesCount:K,url:pe,username:$,memorial:ie,moved:Y,roles:ee,hideCollections:he}=C||{};let re=!1,{header:J,headerStatic:Ce}=C||{};(!J||/missing\.png$/.test(J))&&_&&!/missing\.png$/.test(_)&&(J=_,re=!0,w&&!/missing\.png$/.test(w)&&(Ce=w));const ve=ke(()=>W===vt(),[W]);G(()=>{const z=!!(C?.id&&C?.username&&C?.acct&&C?.avatar&&C?.avatarStatic&&C?.displayName&&C?.url);if(ve&&s&&z){const de=vi();let _e=!1;de.forEach(me=>{me.info.id===C.id&&me.instanceURL===s&&(me.info=C,_e=!0)}),_e&&Gt(de)}},[ve,C,s]);const ye=wi(pe),[Ne,Se]=R([]),Ae=q(),xe=q([]);async function Pe(z){(z||!Ae.current)&&(Ae.current=d.v1.accounts.$select(W).followers.list({limit:cs}).values());const de=await Ae.current.next();if(ve||!b)return de;const{value:_e}=de;let me=[];if(z){let X=[];try{X=await d.v1.accounts.familiarFollowers.fetch({id:[W]})}catch{}xe.current=X?.[0]?.accounts||[],me=[...xe.current,..._e.filter(te=>!xe.current.some(we=>we.id===te.id))]}else _e?.length&&(me=_e.filter(X=>!xe.current.some(te=>te.id===X.id)));return{...de,value:me}}const ze=q();async function Be(z){return(z||!ze.current)&&(ze.current=d.v1.accounts.$select(W).following.list({limit:cs}).values()),await ze.current.next()}const Ye=o?"div":fe,oe=s?`/${s}/a/${W}`:`/a/${W}`,[Le,Re]=R([]),[O,Ie]=R(),[Me,Ee]=R("default"),P=!!O?.total,be=async z=>{try{const de=await Bc(z,h);Re(de[0].accounts.slice(0,Kc))}catch{}},qe=async()=>{if(W){Ee("loading");try{const z=await Uc(W,d);Ie(z),Ee("default")}catch{Ee("error")}}},De=tt(({relationship:z,currentID:de})=>{z.following||(be(de),!o&&K>0&&qe())},[o,W,K]),N=tt(z=>{z.id===W&&(k(z),E.accounts[`${z.id}@${s}`]=z)},[W,s]),ae=v&&n&&/^https?:\/\//.test(n),[x,B]=R(!1),[Z,ne]=R(!1);return e(D,{children:[e("div",{tabIndex:"-1",class:`account-container ${f==="loading"?"skeleton":""}`,style:{"--header-color-1":Ne[0],"--header-color-2":Ne[1],"--header-color-3":Ne[2],"--header-color-4":Ne[3]},children:[f==="error"&&e("div",{class:"ui-state",children:[e("p",{children:e(u,{id:"44hICK"})}),v?e("p",{children:ae?e("a",{href:n,target:"_blank",rel:"noopener",children:n}):e("code",{class:"insignificant",children:n})}):e("p",{children:e("a",{href:pe,target:"_blank",rel:"noopener",children:[e(u,{id:"Aadw0+"})," ",e(I,{icon:"external"})]})})]}),f==="loading"?e(D,{children:[e("header",{children:e(ut,{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(u,{id:"x5LEuB"})]}),e("div",{children:[e("span",{children:"██"})," ",e(u,{id:"following.stats"})]}),e("div",{children:[e("span",{children:"██"})," ",e(u,{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"})})})})]})]})]}):C&&e(D,{children:[!!Y&&e("div",{class:"account-moved",children:[e("p",{children:e(u,{id:"C6cVP/",values:{displayName:T},components:{0:e("b",{})}})}),e(ut,{account:Y,instance:s,onClick:z=>{z.stopPropagation(),E.showAccount=Y}})]}),!!J&&!/missing\.png$/.test(J)&&e("img",{src:J,alt:"",class:`header-banner ${re?"header-is-avatar":""}`,onError:z=>{z.target.crossOrigin?z.target.src!==Ce?z.target.src=Ce:(z.target.removeAttribute("crossorigin"),z.target.src=J):z.target.src!==Ce?z.target.src=Ce:z.target.remove()},crossOrigin:"anonymous",onLoad:z=>{z.target.classList.add("loaded");try{const de=window.OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"),_e=de.getContext("2d",{willReadFrequently:!0});de.width=z.target.width,de.height=z.target.height,_e.imageSmoothingEnabled=!1,_e.drawImage(z.target,0,0);const me=10,te=[_e.getImageData(0,0,me,me).data,_e.getImageData(z.target.width-me,0,me,me).data,_e.getImageData(0,z.target.height-me,me,me).data,_e.getImageData(z.target.width-me,z.target.height-me,me,me).data].map(we=>{let $e=0,Ve=0,at=0,et=0;for(let Rt=0;Rt<we.length;Rt+=4)$e+=we[Rt],Ve+=we[Rt+1],at+=we[Rt+2],et+=we[Rt+3];const wt=we.length/4;return[$e/wt,Ve/wt,at/wt,et/wt]}).map(we=>{const[$e,Ve,at,et]=Hc(we);return`rgba(${$e}, ${Ve}, ${at}, ${et})`});Se(te)}catch{}}}),e("header",{children:o?e(lt,{shift:window.matchMedia("(min-width: calc(40em))").matches?114:64,menuButton:e("div",{children:e(ut,{account:C,instance:s,avatarSize:"xxxl",onClick:()=>{}})}),children:[e("div",{class:"szh-menu__header",children:e(kc,{acct:g,instance:s})}),e(ge,{onClick:()=>{const z=g.includes("@")?`@${g}`:`@${g}@${s}`;try{navigator.clipboard.writeText(z),le(l({id:"zJoEwS"}))}catch{le(l({id:"BC0lSD"}))}},children:[e(I,{icon:"link"}),e("span",{children:e(u,{id:"27x6gl"})})]}),e(ge,{href:pe,target:"_blank",children:[e(I,{icon:"external"}),e("span",{children:e(u,{id:"Bz5hLl"})})]}),e(He,{}),e(ge,{onClick:()=>{E.showMediaModal={mediaAttachments:[{type:"image",url:w}]}},children:[e(I,{icon:"user"}),e("span",{children:e(u,{id:"7WYl2I"})})]}),!!Ce&&!re&&e(ge,{onClick:()=>{E.showMediaModal={mediaAttachments:[{type:"image",url:Ce}]}},children:[e(I,{icon:"media"}),e("span",{children:e(u,{id:"ZNme5R"})})]}),r&&ve&&Xe("@mastodon/profile-edit")&&e(D,{children:[e(He,{}),e(ge,{onClick:()=>{B(!0)},children:[e(I,{icon:"pencil"}),e("span",{children:e(u,{id:"9OpVZg"})})]})]})]}):e(ut,{account:C,instance:s,avatarSize:"xxxl",internal:!0})}),e("div",{class:"faux-header-bg","aria-hidden":"true"}),e("main",{children:[!!ie&&e("span",{class:"tag",children:e(u,{id:"prdIOK"})}),!!A&&e("span",{class:"tag",children:[e(I,{icon:"bot"})," ",e(u,{id:"9Vdq+j"})]}),!!U&&e("span",{class:"tag",children:[e(I,{icon:"group"})," ",e(u,{id:"L8fEEm"})]}),e("div",{class:"note",dir:"auto",onClick:Us({instance:m}),dangerouslySetInnerHTML:{__html:li(j,{emojis:M})}}),e("div",{class:"account-metadata-box",children:[L?.length>0&&e("div",{class:"profile-metadata",children:L.map(({name:z,value:de,verifiedAt:_e},me)=>e("div",{class:`profile-field ${_e?"profile-verified":""}`,dir:"auto",children:[e("b",{children:[e(Ks,{text:z,emojis:M})," ",!!_e&&e(I,{icon:"check-circle",size:"s",alt:l({id:"QDEWii"})})]}),e("p",{dangerouslySetInnerHTML:{__html:li(de,{emojis:M})}})]},z+me))}),e("div",{class:"stats",children:[e(Ye,{tabIndex:0,to:oe,onClick:()=>{setTimeout(()=>{E.showGenericAccounts={id:"followers",heading:l({id:"x5LEuB"}),fetchAccounts:Pe,instance:s,excludeRelationshipAttrs:ve?["followedBy"]:[],blankCopy:he?l({id:"BRV/wh"}):void 0}},0)},children:[!!Le.length&&e("span",{class:"shazam-container-horizontal",children:e("span",{class:"shazam-container-inner stats-avatars-bunch",children:Le.map(z=>e(pt,{url:z.avatarStatic,size:"s",alt:`${z.displayName} @${z.acct}`,squircle:z?.bot}))})}),e(u,{id:"TbttfX",values:{0:We(H),1:We(H),followersCount:H},components:{0:e("span",{title:H}),1:e("span",{title:H})}})]}),e(Ye,{class:"insignificant",tabIndex:0,to:oe,onClick:()=>{setTimeout(()=>{E.showGenericAccounts={heading:l({id:"following.stats"}),fetchAccounts:Be,instance:s,excludeRelationshipAttrs:ve?["following"]:[],blankCopy:he?l({id:"BRV/wh"}):void 0}},0)},children:[e(u,{id:"SGcIK+",values:{0:We(F),followingCount:F},components:{0:e("span",{title:F})}}),e("br",{})]}),e(Ye,{class:"insignificant",to:oe,children:e(u,{id:"C4x3+X",values:{0:We(K),1:We(K),statusesCount:K},components:{0:e("span",{title:K}),1:e("span",{title:K})}})}),!!S&&e("div",{class:"insignificant",children:e(u,{id:"PCcEFZ",values:{0:st(S,{hideTime:!0})},components:{0:e("time",{datetime:S})}})})]})]}),!!O&&e(Ye,{to:oe,class:"account-metadata-box",onClick:void 0,children:e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:P?e("div",{class:"posting-stats",title:Bt()?l({id:"CKHUZ2",values:{0:(O.originals/O.total).toLocaleString(p.locale||void 0,{style:"percent"}),1:(O.replies/O.total).toLocaleString(p.locale||void 0,{style:"percent"}),2:(O.quotes/O.total).toLocaleString(p.locale||void 0,{style:"percent"}),3:(O.boosts/O.total).toLocaleString(p.locale||void 0,{style:"percent"})}}):l({id:"wiuWLe",values:{0:(O.originals/O.total).toLocaleString(p.locale||void 0,{style:"percent"}),1:(O.replies/O.total).toLocaleString(p.locale||void 0,{style:"percent"}),2:(O.boosts/O.total).toLocaleString(p.locale||void 0,{style:"percent"})}}),children:[e("div",{children:O.daysSinceLastPost<365?ue._({id:"oZUtTk",values:{0:O.total,1:O.daysSinceLastPost,2:O.daysSinceLastPost,3:O.daysSinceLastPost,4:O.total,5:O.total,6:O.daysSinceLastPost}}):ue._({id:"JvA7Mo",values:{0:O.total,1:O.total}})}),e("div",{class:"posting-stats-bar",children:[O.originals>0&&e("div",{class:"posting-stats-bar-section posting-stats-bar-originals",style:{"--percentage":`${O.originals/O.total*100}%`}}),O.replies>0&&e("div",{class:"posting-stats-bar-section posting-stats-bar-replies",style:{"--percentage":`${O.replies/O.total*100}%`}}),O.quotes>0&&e("div",{class:"posting-stats-bar-section posting-stats-bar-quotes",style:{"--percentage":`${O.quotes/O.total*100}%`}}),O.boosts>0&&e("div",{class:"posting-stats-bar-section posting-stats-bar-boosts",style:{"--percentage":`${O.boosts/O.total*100}%`}})]}),e("div",{class:"posting-stats-legends",children:[e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-bar-originals"})," ",e(u,{id:"HxF6Fk"})]})," ",e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-bar-replies"})," ",e(u,{id:"N8UzTV"})]})," ",Bt()&&e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-bar-quotes"})," ",e(u,{id:"eWLklq"})]}),e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-bar-boosts"})," ",e(u,{id:"puY2t0"})]})]})]}):e("div",{class:"posting-stats",children:e(u,{id:"vl3XTJ"})})})})}),!Y&&e("div",{class:"account-metadata-box",children:e("div",{class:"shazam-container no-animation",hidden:!!O,children:e("div",{class:"shazam-container-inner",children:e("button",{type:"button",class:"posting-stats-button",disabled:Me==="loading",onClick:()=>{qe()},children:[e("div",{class:`posting-stats-icon ${Me==="loading"?"loading":""}`}),e(u,{id:"PjP87f"})," "]})})})})]}),e("footer",{children:e(Oc,{info:C,instance:s,standalone:o,authenticated:a,onRelationshipChange:De,onProfileUpdate:N,setShowEditProfile:B,showEndorsements:c,renderEndorsements:Z,setRenderEndorsements:ne})}),e(Ac,{accountID:W,info:C,open:Z,onlyOpenIfHasEndorsements:Z==="onlyOpenIfHasEndorsements"})]})]}),!!x&&e(Ue,{onClose:()=>{B(!1)},children:e(_c,{onClose:({state:z,account:de}={})=>{B(!1),z==="success"&&de&&N(de)}})})]})}const Kc=3;function Hc([n,i,o]){const s=.2126*n+.7152*i+.0722*o;let a;return s>=220?a=1:s<=50?a=.1:a=s/255,a=Math.min(1,a),[n,i,o,a]}function jc({account:n,instance:i,onClose:o}){const{_:s}=ce(),{masto:a,instance:c,authenticated:p}=se({instance:i}),l=typeof n=="string";return G(()=>{l||(E.accounts[`${n.id}@${c}`]=n)},[n]),io(o),e("div",{class:"sheet",children:[!!o&&e("button",{type:"button",class:"sheet-close outer",onClick:o,children:e(I,{icon:"x",alt:s({id:"yz7wBu"})})}),e(co,{instance:c,authenticated:p,account:n,fetchAccount:async()=>{if(l)try{return await a.v1.accounts.lookup({acct:n,skip_webfinger:!1})}catch{const r=await a.v2.search.list({q:n,type:"accounts",limit:p?1:11,resolve:p});if(r.accounts.length){const h=r.accounts.find(m=>m.url===n||n.startsWith(m.url));if(h)return h}if(/^https?:\/\/[^/]+\/@[^/]+$/.test(n)){const h=URL.parse(n);if(h){const{hostname:m,pathname:f}=h,y=f.replace(/^\//,"").replace(/\/$/,"")+"@"+m,v=await a.v2.search.list({q:y,type:"accounts",limit:1,resolve:p});if(v.accounts.length)return v.accounts[0]}}}else return n}})]})}function Yc({onClose:n}){const{_:i}=ce(),{masto:o}=se(),[s,a]=R("default"),[c,p]=R([]),[l,d]=xt(h=>h+1,0);G(()=>{a("loading"),(async()=>{try{const h=await gt.drafts.keys();if(h.length){const m=$n(),f=h.filter(y=>y.startsWith(m));if(f.length){const y=await gt.drafts.getMany(f);y.sort((v,C)=>Date.parse(C.updatedAt)-Date.parse(v.updatedAt)),p(y)}else p([])}else p([]);a("default")}catch{a("error")}})()},[l]);const r=c?.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(u,{id:"krk5ws"})," ",e(Oe,{abrupt:!0,hidden:s!=="loading"})]}),r&&e("div",{class:"insignificant",children:e(u,{id:"Ap/10+"})})]}),e("main",{children:r?e(D,{children:[e("ul",{class:"drafts-list",children:c.map(h=>{const{updatedAt:m,key:f,draftStatus:y,replyTo:v,quote:C}=h,k=new Date(m);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(D,{children:[e("span",{class:"bidi-isolate",children:["@",v.account.acct]}),e("br",{})]}),st(k)]})]}),e(ft,{confirmLabel:e("span",{children:e(u,{id:"/W5yFF"})}),menuItemClassName:"danger",align:"end",disabled:s==="loading",onClick:()=>{(async()=>{try{await gt.drafts.del(f),d()}catch{alert(i({id:"rEYoku"}))}})()},children:e("button",{type:"button",class:"small light",disabled:s==="loading",children:e(u,{id:"Jb6/SB"})})})]}),e("button",{type:"button",disabled:s==="loading",class:"draft-item",onClick:async()=>{let b,g;if(v?.id||C?.id){if(a("loading"),v)try{b=await o.v1.statuses.$select(v.id).fetch()}catch{alert(i({id:"tMwimH"})),a("default");return}if(C)try{g=await o.v1.statuses.$select(C.id).fetch()}catch{alert(i({id:"2oZ4Iw"})),a("default")}a("default")}window.__COMPOSE__={draftStatus:y,replyToStatus:b,quoteStatus:g},E.showCompose=!0,E.showDrafts=!1},children:e(Vc,{draft:h})})]},m)})}),c.length>1&&e("p",{children:e(ft,{confirmLabel:e("span",{children:e(u,{id:"3IakFR"})}),menuItemClassName:"danger",disabled:s==="loading",onClick:()=>{(async()=>{a("loading");try{await gt.drafts.delMany(c.map(h=>h.key)),a("default"),d()}catch{alert(i({id:"0J4sZq"})),a("error")}})()},children:e("button",{type:"button",class:"light danger",disabled:s==="loading",children:e(u,{id:"hOg+Mt"})})})})]}):e("p",{children:e(u,{id:"8iQ+jk"})})})]})}function Vc({draft:n}){const{_:i}=ce(),{draftStatus:o,replyTo:s,quote:a}=n,{status:c,spoilerText:p,poll:l,mediaAttachments:d}=o,r=l?.options?.length>0,h=d?.length>0,m=!!a?.id,f=r||h||m,y=ke(()=>{if(!h)return;const v=d.find(b=>/image/.test(b.type));if(!v)return;const{file:C}=v;return URL.createObjectURL(C)},[h,d]);return e(D,{children:e("div",{class:"mini-draft",children:[f&&e("div",{class:`mini-draft-aside ${y?"has-image":""}`,style:y?{"--bg-image":`url(${y})`}:{},children:[r&&e(I,{icon:"poll",alt:i({id:"4WUbF1"})}),h&&e("span",{children:[e(I,{icon:"attachment",alt:i({id:"xYilR2"})})," ",e("small",{children:d?.length})]}),m&&e(I,{icon:"quote",alt:i({id:"ZhhOwV"})})]}),e("div",{class:"mini-draft-main",children:[!!p&&e("div",{class:"mini-draft-spoiler",children:p}),!!c&&e("div",{class:"mini-draft-status",children:c})]})]})})}function Gc({html:n,url:i,width:o,height:s,onClose:a=()=>{}}){const{_:c}=ce();return e("div",{class:"embed-modal-container",children:[e("div",{class:"top-controls",children:[e("button",{type:"button",class:"light",onClick:()=>a(),children:e(I,{icon:"x",alt:c({id:"yz7wBu"})})}),i&&e("a",{href:i,target:"_blank",rel:"noopener",class:"button plain",children:[e("span",{children:e(u,{id:"4/RpOy"})})," ",e(I,{icon:"external"})]})]}),e("div",{class:"embed-content",dangerouslySetInnerHTML:{__html:n},style:{"--width":o+"px","--height":s+"px","--aspect-ratio":`${o}/${s}`}})]})}function Wc({instance:n,excludeRelationshipAttrs:i=[],postID:o,onClose:s=()=>{},blankCopy:a}){const{_:c}=ce(),{masto:p,instance:l}=se(),d=n?n===l:!0,r=Ge(E),[h,m]=R("default"),[f,y]=R(!1);if(io(s),!r.showGenericAccounts)return null;const{id:v,heading:C,fetchAccounts:k,accounts:b,showReactions:g}=r.showGenericAccounts,[_,w]=R(b?.length?b:[]),[A,S]=R({}),T=async F=>{if(!F?.length||!d)return;const U=await Kn(F,A);U&&S({...A,...U})},M=F=>{k&&(F&&!_?.length&&w([]),m("loading"),(async()=>{try{const{done:U,value:W}=await k(F);if(Array.isArray(W)){if(F){const Q=[];for(let V=0;V<W.length;V++){const j=W[V],K=Q.find((pe,$)=>pe.id===j.id&&V!==$);K?K._types.push(...j._types):Q.push({_types:[],...j})}w(Q)}else w(Q=>{const V=Q;for(const j of W){const K=V.find(pe=>pe.id===j.id);K?K._types.push(...j._types):V.push(j)}return V});y(!U),T(W)}else y(!1);m("default")}catch{m("error")}})())},L=q(!0);G(()=>{_?.length>0?k?(M(!0),L.current=!1):T(_):(M(!0),L.current=!1)},[k]),G(()=>{L.current||r.reloadGenericAccounts?.id===v&&M(!0)},[r.reloadGenericAccounts.counter]);const H=E.statuses[o];return e("div",{id:"generic-accounts-container",class:"sheet",tabindex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:s,children:e(I,{icon:"x",alt:c({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:C||c({id:"bPwFdf"})})}),e("main",{children:[H&&e(fe,{to:`/${n||l}/s/${H.id}`,class:"post-preview",children:e(je,{status:H,size:"s",readOnly:!0})}),_.length>0?e(D,{children:[e("ul",{class:"accounts-list",children:_.map(F=>{const U=A[F.id],W=`${F.id}-${F._types?.length||""}`;return e("li",{children:[g&&F._types?.length>0&&e("div",{class:"reactions-block",children:F._types.map(Q=>e(I,{icon:{reblog:"rocket",favourite:"heart"}[Q],class:`${Q}-icon`}))}),e("div",{class:"account-relationships",children:e(ut,{account:F,showStats:!0,relationship:U,excludeRelationshipAttrs:i})})]},W)})}),h==="default"?f?e(Tt,{onChange:F=>{F&&M()},children:e("button",{type:"button",class:"plain block",onClick:()=>M(),children:e(u,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(u,{id:"2EYeAZ"})}):h==="loading"&&e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})})]}):h==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):h==="error"?e("p",{class:"ui-state",children:e(u,{id:"AThL/k"})}):e("p",{class:"ui-state insignificant",children:a||c({id:"10OlfF"})})]})]})}const Zc=140;function Xc({alt:n,lang:i,onClose:o}){const{_:s}=ce(),a=Ge(E),[c,p]=R(!1),l=Bs(!0),d=a.settings.contentTranslationHideLanguages||[],r=!!i&&i!==l&&!Nn([i],[l])&&!d.find(h=>i===h||Nn([i],[h]));return G(()=>{const h=n?.length>0&&n?.length<=Zc;r&&h&&p(!0)},[r,n]),e("div",{class:"sheet",tabindex:"-1",children:[!!o&&e("button",{type:"button",class:"sheet-close outer",onClick:o,children:e(I,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{class:"header-grid",children:[e("h2",{children:e(u,{id:"5gfDMm"})}),e("div",{class:"header-side",children:e(lt,{align:"end",menuButton:e("button",{type:"button",class:"plain4",children:e(I,{icon:"more",alt:s({id:"2FYpfJ"}),size:"xl"})}),children:[e(ge,{disabled:c,onClick:()=>{p(!0)},children:[e(I,{icon:"translate"}),e("span",{children:e(u,{id:"pi8x/S"})})]}),da&&e(ge,{onClick:()=>{ua(n,i)},children:[e(I,{icon:"speak"}),e("span",{children:e(u,{id:"yIBLq8"})})]})]})})]}),e("main",{lang:i,dir:"auto",children:[e("p",{style:{whiteSpace:"pre-wrap",textWrap:"pretty"},children:n}),(r||c)&&e(qs,{forceTranslate:c,sourceLanguage:i,text:n})]})]})}const{min:pu,max:fu}=Math;const ro={};for(let n of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])ro[`[object ${n}]`]=n.toLowerCase();function Jc(n){return ro[Object.prototype.toString.call(n)]||"object"}const en=(n,i=null)=>n.length>=3?Array.prototype.slice.call(n):Jc(n[0])=="object"&&i?i.split("").filter(o=>n[0][o]!==void 0).map(o=>n[0][o]):n[0].slice(0);const{PI:Wn,min:mu,max:gu}=Math;const vu=Wn*2,yu=Wn/3,Qc=Wn/180,er=180/Wn;function On(n,i){let o=n.length;Array.isArray(n[0])||(n=[n]),Array.isArray(i[0])||(i=i.map(p=>[p]));let s=i[0].length,a=i[0].map((p,l)=>i.map(d=>d[l])),c=n.map(p=>a.map(l=>Array.isArray(p)?p.reduce((d,r,h)=>d+r*(l[h]||0),0):l.reduce((d,r)=>d+r*p,0)));return o===1&&(c=c[0]),s===1?c.map(p=>p[0]):c}const lo={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 ni=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},tr=(n,i,o)=>{const{MtxAdaptMa:s,MtxAdaptMaI:a,MtxXYZ2RGB:c,RefWhiteRGB:p,Xn:l,Yn:d,Zn:r}=lo,h=l*s.m00+d*s.m10+r*s.m20,m=l*s.m01+d*s.m11+r*s.m21,f=l*s.m02+d*s.m12+r*s.m22,y=p.X*s.m00+p.Y*s.m10+p.Z*s.m20,v=p.X*s.m01+p.Y*s.m11+p.Z*s.m21,C=p.X*s.m02+p.Y*s.m12+p.Z*s.m22,k=(n*s.m00+i*s.m10+o*s.m20)*(y/h),b=(n*s.m01+i*s.m11+o*s.m21)*(v/m),g=(n*s.m02+i*s.m12+o*s.m22)*(C/f),_=k*a.m00+b*a.m10+g*a.m20,w=k*a.m01+b*a.m11+g*a.m21,A=k*a.m02+b*a.m12+g*a.m22,S=ni(_*c.m00+w*c.m10+A*c.m20),T=ni(_*c.m01+w*c.m11+A*c.m21),M=ni(_*c.m02+w*c.m12+A*c.m22);return[S*255,T*255,M*255]},Bi=(...n)=>{n=en(n,"lab");const[i,o,s,...a]=n,[c,p,l]=nr([i,o,s]),[d,r,h]=tr(c,p,l);return[d,r,h,...a.length>0&&a[0]<1?[a[0]]:[]]};function nr(n){var i=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],o=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],s=On(o,n);return On(i,s.map(a=>a**3))}function ii(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 ir=(n,i,o)=>{n=ii(n/255),i=ii(i/255),o=ii(o/255);const{MtxRGB2XYZ:s,MtxAdaptMa:a,MtxAdaptMaI:c,Xn:p,Yn:l,Zn:d,As:r,Bs:h,Cs:m}=lo;let f=n*s.m00+i*s.m10+o*s.m20,y=n*s.m01+i*s.m11+o*s.m21,v=n*s.m02+i*s.m12+o*s.m22;const C=p*a.m00+l*a.m10+d*a.m20,k=p*a.m01+l*a.m11+d*a.m21,b=p*a.m02+l*a.m12+d*a.m22;let g=f*a.m00+y*a.m10+v*a.m20,_=f*a.m01+y*a.m11+v*a.m21,w=f*a.m02+y*a.m12+v*a.m22;return g*=C/r,_*=k/h,w*=b/m,f=g*c.m00+_*c.m10+w*c.m20,y=g*c.m01+_*c.m11+w*c.m21,v=g*c.m02+_*c.m12+w*c.m22,[f,y,v]},qi=(...n)=>{const[i,o,s,...a]=en(n,"rgb"),c=ir(i,o,s);return[...sr(c),...a.length>0&&a[0]<1?[a[0]]:[]]};function sr(n){const i=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],o=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],s=On(i,n);return On(o,s.map(a=>Math.cbrt(a)))}const{sin:or,cos:ar}=Math,cr=(...n)=>{let[i,o,s]=en(n,"lch");return isNaN(s)&&(s=0),s=s*Qc,[i,ar(s)*o,or(s)*o]},si=(...n)=>{n=en(n,"lch");const[i,o,s,...a]=n,[c,p,l]=cr(i,o,s),[d,r,h]=Bi(c,p,l);return[d,r,h,...a.length>0&&a[0]<1?[a[0]]:[]]},{sqrt:rr,atan2:lr,round:dr}=Math,ur=(...n)=>{const[i,o,s]=en(n,"lab"),a=rr(o*o+s*s);let c=(lr(s,o)*er+360)%360;return dr(a*1e4)===0&&(c=Number.NaN),[i,a,c]},hr=(...n)=>{const[i,o,s,...a]=en(n,"rgb"),[c,p,l]=qi(i,o,s),[d,r,h]=ur(c,p,l);return[d,r,h,...a.length>0&&a[0]<1?[a[0]]:[]]},pr={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:bu}=pr;function uo({mediaAttachments:n,statusID:i,instance:o,lang:s,index:a=0,onClose:c=()=>{}}){const{_:p}=ce(),[l,d]=R("default"),r=q(null),[h,m]=R(a),f=q(null);St(()=>{f.current?.scrollIntoView()},[]);const y=q(i);G(()=>{const w=a*r.current.clientWidth,A=y.current!==i;A&&(y.current=i),r.current.focus(),r.current.scrollTo({left:w*(zt()?-1:1),behavior:A?"auto":"smooth"})},[a,i]);const[v,C]=R(!0);G(()=>{let w=A=>{c(A,h,n,r)};return r.current&&r.current.addEventListener("swiped-down",w),()=>{r.current&&r.current.removeEventListener("swiped-down",w)}},[h,n]),Fe("esc",w=>{c(w,h,n,r)},{ignoreEventWhen:w=>!!document.querySelector("#modal-container > *")||w.metaKey||w.ctrlKey||w.altKey||w.shiftKey,useKey:!0},[c,h,n]),G(()=>{let w=()=>{const{clientWidth:A,scrollLeft:S}=r.current,T=Math.round(Math.abs(S)/A);m(T)};return r.current&&r.current.addEventListener("scroll",w,{passive:!0}),()=>{r.current&&r.current.removeEventListener("scroll",w)}},[]),G(()=>{let w=setTimeout(()=>{r.current?.focus?.()},100);return()=>clearTimeout(w)},[]);const k=ke(()=>n?.map(w=>{const{blurhash:A}=w;if(A){const S=xi(A);return hr(S)}return null}),[n]),b=ke(()=>k?.map(w=>w?{light:si([.95,.01,w[2]]),dark:si([.35,.01,w[2]]),default:si([.6,w[1],w[2]])}:null)),g=ke(()=>{const A=100/b.length,S=b.map((L,H)=>{const F=H*A+5,U=(H+1)*A-5;return L?.light&&L?.dark?{light:`
|
||
rgb(${L.light?.join(",")}) ${F}%,
|
||
rgb(${L.light?.join(",")}) ${U}%
|
||
`,dark:`
|
||
rgb(${L.dark?.join(",")}) ${F}%,
|
||
rgb(${L.dark?.join(",")}) ${U}%
|
||
`}:{light:`
|
||
transparent ${F}%,
|
||
transparent ${U}%
|
||
`,dark:`
|
||
transparent ${F}%,
|
||
transparent ${U}%
|
||
`}}),T=S.map(L=>L.light).join(", "),M=S.map(L=>L.dark).join(", ");return{light:T,dark:M}},[b]);let _=q(null);return G(()=>()=>{_.current?.hideToast?.()},[]),St(()=>{const w=b[h];let A,S;if(w){const T=Te.local.get("theme");if(T){const M=`rgb(${w[T].join(",")})`;A=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),A&&(S=A.content,A.content=M)}else{const M=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",L=`rgb(${w[M].join(",")})`;A=document.querySelector(`meta[name="theme-color"][media*="${M}"]`),A&&(S=A.content,A.content=L)}}return()=>{A&&S&&(A.content=S)}},[h,b]),e("div",{class:`media-modal-container media-modal-count-${n?.length}`,children:[e("div",{ref:r,tabIndex:"0","data-swipe-threshold":"44",class:"carousel",onClick:w=>{(w.target.classList.contains("carousel-item")||w.target.classList.contains("media")||w.target.classList.contains("media-zoom"))&&c(w,h,n,r)},style:n.length>1?{backgroundAttachment:"local","--accent-gradient-light":g?.light,"--accent-gradient-dark":g?.dark}:{},children:n?.map((w,A)=>{const S=n.length===1?b[A]:null;return e("div",{class:"carousel-item",style:S?{"--accent-color":`rgb(${S.default.join(",")})`,"--accent-light-color":`rgb(${S.light?.join(",")})`,"--accent-dark-color":`rgb(${S.dark?.join(",")})`,"--accent-alpha-color":`rgba(${S.default.join(",")}, 0.4)`}:{},tabindex:"0",ref:A===h?f:null,onClick:T=>{T.target.classList.contains("media")||C(!v)},children:[!!w.description&&e("button",{type:"button",class:"media-alt",hidden:!v,onClick:()=>{E.showMediaAlt={alt:w.description,lang:s}},children:[e("span",{class:"alt-badge",children:"ALT"}),e("span",{class:"media-alt-desc",lang:s,dir:"auto",children:w.description})]}),e(Hs,{media:w,showOriginal:!0,lang:s})]},w.id)})}),e("div",{class:"carousel-top-controls",hidden:!v,children:[e("span",{children:e("button",{type:"button",class:"carousel-button",onClick:w=>c(w,h,n,r),children:e(I,{icon:"x",alt:p({id:"yz7wBu"})})})}),n?.length>1?e("span",{class:"carousel-dots",children:n?.map((w,A)=>e("button",{type:"button",disabled:A===h,class:`carousel-dot ${A===h?"active":""}`,onClick:S=>{S.preventDefault(),S.stopPropagation();const T=r.current.clientWidth*A*(zt()?-1:1);r.current.focus(),r.current.scrollTo({left:T,behavior:"smooth"})},children:e(I,{icon:"round",size:"s",alt:"⸱"})},w.id))}):e("span",{}),e("span",{children:[e(lt,{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:p({id:"2FYpfJ"})})}),children:[e(Ke,{href:n[h]?.remoteUrl||n[h]?.url,class:"carousel-button",target:"_blank",title:p({id:"5hXGws"}),children:[e(I,{icon:"popout"}),e("span",{children:e(u,{id:"aDr7Vc"})})]}),!1]})," ",!!i&&e(fe,{to:`${o?`/${o}`:""}/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(u,{id:"ISg5SQ"})," "]}),"»"]})]})]}),n?.length>1&&e("div",{class:"carousel-controls",hidden:!v,children:[e("button",{type:"button",class:"carousel-button",hidden:h===0,onClick:w=>{w.preventDefault(),w.stopPropagation(),r.current.focus(),r.current.scrollTo({left:r.current.clientWidth*(h-1)*(zt()?-1:1),behavior:"smooth"})},children:e(I,{icon:"arrow-left",alt:p({id:"DHhJ7s"})})}),e("button",{type:"button",class:"carousel-button",hidden:h===n.length-1,onClick:w=>{w.preventDefault(),w.stopPropagation(),r.current.focus(),r.current.scrollTo({left:r.current.clientWidth*(h+1)*(zt()?-1:1),behavior:"smooth"})},children:e(I,{icon:"arrow-right",alt:p({id:"hXzOVo"})})})]})]})}function fr({url:n,linkText:i,onClose:o}){const{_:s}=ce();if(!n)return null;let a=n;try{const l=URL.parse(n),d=l.protocol,r=l.hostname,h=n.slice(l.origin.length);a=e(D,{children:[d,"//",e("strong",{children:r}),h]})}catch{}const c=()=>{try{navigator.clipboard.writeText(n),le(s({id:"edWbV6"}))}catch{le(s({id:"W1ewR0"}))}},p=()=>{if(navigator.share&&navigator.canShare({url:n}))try{navigator.share({url:n})}catch{}};return e("div",{class:"sheet sheet-modal",id:"open-link-sheet",tabindex:"-1",children:[!!o&&e("button",{type:"button",class:"sheet-close",onClick:o,children:e(I,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{class:"header-grid",children:e("h2",{children:e(u,{id:"Gj4mrz"})})}),e("main",{children:[!!i&&e(D,{children:[e("p",{class:"link-text",children:[e(I,{icon:"cursor-hand",size:"xl"})," ",i]}),e("div",{class:"arrow",children:e(I,{icon:"arrow-down"})})]}),e("p",{class:"full-url",children:a})]}),e("footer",{children:[e("button",{type:"button",class:"light",onClick:o,children:e(u,{id:"dEgA5A"})}),e("span",{class:"spacer"}),e("button",{type:"button",class:"plain6",onClick:c,children:e(I,{icon:"copy",alt:s({id:"he3ygx"})})}),navigator.canShare&&navigator.canShare({url:n})&&e("button",{type:"button",class:"plain6",onClick:p,children:e(I,{icon:"share",alt:s({id:"LFKLqp"})})}),e("a",{class:"button",href:n,target:"_blank",rel:"noopener noreferrer",onClick:o,children:e(u,{id:"1TNIig"})})]})]})}const mr=["spam","legal","violation","other"],tn={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 gr(n,i){if(!n.translations||!i)return null;const o=Object.keys(n.translations);if(!o?.length)return null;let s=Nn([i],o,null);if(!s){const a=o.map(c=>c.split(/(?=[A-Z])/).map((l,d)=>d===0?l:l.toLowerCase()).join("-"));s=Nn([i],a,null)}if(s&&s.includes("-")){const[a,c]=s.split("-");s=a+c.charAt(0).toUpperCase()+c.slice(1)}return s}function vr(n,i){return n?.length?i?n.map(o=>{const s=gr(o,i);return{...o,_translatedText:o.translations?.[s]?.text||null}}):n:[]}function yr({account:n,post:i,onClose:o}){const{_:s,_:a,i18n:c}=ce(),{masto:p}=se(),[l,d]=R("default"),[r,h]=n.acct.split("@"),[m,f]=ke(()=>{const{rules:w,domain:A}=$s();return[vr(w||[],c.locale),A]},[c.locale]),[y,v]=R(null),[C,k]=R(!1),b=q(null),[g,_]=R(!1);return e("div",{class:"report-modal-container",children:[e("div",{class:"top-controls",children:[e("h1",{children:a(i?{id:"muLhL3"}:{id:"ACul2G",values:{username:r}})}),e("button",{type:"button",class:"plain4 small",disabled:l==="loading",onClick:()=>o(),children:e(I,{icon:"x",size:"xl",alt:a({id:"yz7wBu"})})})]}),e("main",{children:[e("div",{class:"report-preview",children:i?e(je,{status:i,size:"s",previewMode:!0}):e(ut,{account:n,avatarSize:"xxl",useAvatarStatic:!0,showStats:!0,showActivity:!0})}),!!y&&!tn[y].excludeStamp&&e("span",{class:"rubber-stamp","aria-hidden":"true",children:[s(tn[y].stampLabel||s(tn[y].label)),e("small",{children:e(u,{id:"2WtL62"})})]},y),e("form",{onSubmit:w=>{w.preventDefault();const A=new FormData(w.target),S=Object.fromEntries(A.entries());let{category:T,comment:M,forward:L}=S;M||(M=void 0),L==="on"&&(L=!0);const H=T==="violation"?Object.entries(S).filter(([U])=>U.startsWith("rule_ids")).map(([U,W])=>W):void 0,F={category:T,comment:M,forward:L,ruleIds:H};d("loading"),(async()=>{try{await p.v1.reports.create({accountId:n.id,statusIds:i?.id?[i.id]:void 0,category:T,comment:M,ruleIds:H,forward:L}),d("success"),le(a(i?{id:"y3ou+8"}:{id:"R9kjEL"})),o()}catch(U){d("error"),le(U?.message||a(i?{id:"+3FjPq"}:{id:"oEQq5w"}))}})()},children:[e("p",{children:a(i?{id:"L9fUm+"}:{id:"rSLkfe"})}),e("section",{class:"report-categories",children:mr.map(w=>w==="violation"&&!m?.length?null:e(D,{children:[e("label",{class:"report-category",children:[e("input",{type:"radio",name:"category",value:w,required:!0,disabled:l==="loading",onChange:A=>{v(A.target.value),k(A.target.value==="violation")}}),e("span",{children:[s(tn[w].label)," ",e("small",{class:"ib insignificant",children:s(tn[w].description)})]})]}),w==="violation"&&!!m?.length&&e("div",{class:"shazam-container no-animation",hidden:!C,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"report-rules",ref:b,children:m.map((A,S)=>e("label",{class:"report-rule",children:[e("input",{type:"checkbox",name:`rule_ids[${S}]`,value:A.id,required:C&&!g,disabled:l==="loading",onChange:T=>{const{checked:M}=T.target;M?_(!0):b.current.querySelectorAll("input:checked").length||_(!1)}}),e("span",{children:A._translatedText||A.text})]},A.id))})})})]},w))}),e("section",{class:"report-comment",children:[e("p",{children:e("label",{for:"report-comment",children:e(u,{id:"ecVtjm"})})}),e("textarea",{maxlength:"1000",rows:"1",name:"comment",id:"report-comment",disabled:l==="loading",required:!i})]}),!!h&&h!==f&&e("section",{children:e("p",{children:e("label",{children:[e("input",{type:"checkbox",switch:!0,name:"forward",disabled:l==="loading"})," ",e("span",{children:e(u,{id:"cyjS8M",values:{domain:h},components:{0:e("i",{})}})})]})})}),e("footer",{children:[e("button",{type:"submit",disabled:l==="loading",children:e(u,{id:"4cijjm"})})," ",e("button",{type:"submit",class:"plain2",disabled:l==="loading",onClick:async()=>{try{await p.v1.accounts.$select(n.id).mute(),le(a({id:"/BGBeF",values:{username:r}}))}catch{le(a({id:"v02K7/",values:{username:r}}))}},children:e(u,{id:"caeqw/",components:{0:e("small",{class:"ib"})}})})," ",e("button",{type:"submit",class:"plain2",disabled:l==="loading",onClick:async()=>{try{await p.v1.accounts.$select(n.id).block(),le(a({id:"kjUejn",values:{username:r}}))}catch{le(a({id:"pMcdDp",values:{username:r}}))}},children:e(u,{id:"JybQca",components:{0:e("small",{class:"ib"})}})}),e(Oe,{hidden:l!=="loading"})]})]})]})]})}var _n={exports:{}},wu=_n.exports,rs;function br(){return rs||(rs=1,function(n){var i=function(){var o=String.fromCharCode,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",c={};function p(d,r){if(!c[d]){c[d]={};for(var h=0;h<d.length;h++)c[d][d.charAt(h)]=h}return c[d][r]}var l={compressToBase64:function(d){if(d==null)return"";var r=l._compress(d,6,function(h){return s.charAt(h)});switch(r.length%4){default:case 0:return r;case 1:return r+"===";case 2:return r+"==";case 3:return r+"="}},decompressFromBase64:function(d){return d==null?"":d==""?null:l._decompress(d.length,32,function(r){return p(s,d.charAt(r))})},compressToUTF16:function(d){return d==null?"":l._compress(d,15,function(r){return o(r+32)})+" "},decompressFromUTF16:function(d){return d==null?"":d==""?null:l._decompress(d.length,16384,function(r){return d.charCodeAt(r)-32})},compressToUint8Array:function(d){for(var r=l.compress(d),h=new Uint8Array(r.length*2),m=0,f=r.length;m<f;m++){var y=r.charCodeAt(m);h[m*2]=y>>>8,h[m*2+1]=y%256}return h},decompressFromUint8Array:function(d){if(d==null)return l.decompress(d);for(var r=new Array(d.length/2),h=0,m=r.length;h<m;h++)r[h]=d[h*2]*256+d[h*2+1];var f=[];return r.forEach(function(y){f.push(o(y))}),l.decompress(f.join(""))},compressToEncodedURIComponent:function(d){return d==null?"":l._compress(d,6,function(r){return a.charAt(r)})},decompressFromEncodedURIComponent:function(d){return d==null?"":d==""?null:(d=d.replace(/ /g,"+"),l._decompress(d.length,32,function(r){return p(a,d.charAt(r))}))},compress:function(d){return l._compress(d,16,function(r){return o(r)})},_compress:function(d,r,h){if(d==null)return"";var m,f,y={},v={},C="",k="",b="",g=2,_=3,w=2,A=[],S=0,T=0,M;for(M=0;M<d.length;M+=1)if(C=d.charAt(M),Object.prototype.hasOwnProperty.call(y,C)||(y[C]=_++,v[C]=!0),k=b+C,Object.prototype.hasOwnProperty.call(y,k))b=k;else{if(Object.prototype.hasOwnProperty.call(v,b)){if(b.charCodeAt(0)<256){for(m=0;m<w;m++)S=S<<1,T==r-1?(T=0,A.push(h(S)),S=0):T++;for(f=b.charCodeAt(0),m=0;m<8;m++)S=S<<1|f&1,T==r-1?(T=0,A.push(h(S)),S=0):T++,f=f>>1}else{for(f=1,m=0;m<w;m++)S=S<<1|f,T==r-1?(T=0,A.push(h(S)),S=0):T++,f=0;for(f=b.charCodeAt(0),m=0;m<16;m++)S=S<<1|f&1,T==r-1?(T=0,A.push(h(S)),S=0):T++,f=f>>1}g--,g==0&&(g=Math.pow(2,w),w++),delete v[b]}else for(f=y[b],m=0;m<w;m++)S=S<<1|f&1,T==r-1?(T=0,A.push(h(S)),S=0):T++,f=f>>1;g--,g==0&&(g=Math.pow(2,w),w++),y[k]=_++,b=String(C)}if(b!==""){if(Object.prototype.hasOwnProperty.call(v,b)){if(b.charCodeAt(0)<256){for(m=0;m<w;m++)S=S<<1,T==r-1?(T=0,A.push(h(S)),S=0):T++;for(f=b.charCodeAt(0),m=0;m<8;m++)S=S<<1|f&1,T==r-1?(T=0,A.push(h(S)),S=0):T++,f=f>>1}else{for(f=1,m=0;m<w;m++)S=S<<1|f,T==r-1?(T=0,A.push(h(S)),S=0):T++,f=0;for(f=b.charCodeAt(0),m=0;m<16;m++)S=S<<1|f&1,T==r-1?(T=0,A.push(h(S)),S=0):T++,f=f>>1}g--,g==0&&(g=Math.pow(2,w),w++),delete v[b]}else for(f=y[b],m=0;m<w;m++)S=S<<1|f&1,T==r-1?(T=0,A.push(h(S)),S=0):T++,f=f>>1;g--,g==0&&(g=Math.pow(2,w),w++)}for(f=2,m=0;m<w;m++)S=S<<1|f&1,T==r-1?(T=0,A.push(h(S)),S=0):T++,f=f>>1;for(;;)if(S=S<<1,T==r-1){A.push(h(S));break}else T++;return A.join("")},decompress:function(d){return d==null?"":d==""?null:l._decompress(d.length,32768,function(r){return d.charCodeAt(r)})},_decompress:function(d,r,h){var m=[],f,y=4,v=4,C=3,k="",b=[],g,_,w,A,S,T,M,L={val:h(0),position:r,index:1};for(g=0;g<3;g+=1)m[g]=g;for(w=0,S=Math.pow(2,2),T=1;T!=S;)A=L.val&L.position,L.position>>=1,L.position==0&&(L.position=r,L.val=h(L.index++)),w|=(A>0?1:0)*T,T<<=1;switch(f=w){case 0:for(w=0,S=Math.pow(2,8),T=1;T!=S;)A=L.val&L.position,L.position>>=1,L.position==0&&(L.position=r,L.val=h(L.index++)),w|=(A>0?1:0)*T,T<<=1;M=o(w);break;case 1:for(w=0,S=Math.pow(2,16),T=1;T!=S;)A=L.val&L.position,L.position>>=1,L.position==0&&(L.position=r,L.val=h(L.index++)),w|=(A>0?1:0)*T,T<<=1;M=o(w);break;case 2:return""}for(m[3]=M,_=M,b.push(M);;){if(L.index>d)return"";for(w=0,S=Math.pow(2,C),T=1;T!=S;)A=L.val&L.position,L.position>>=1,L.position==0&&(L.position=r,L.val=h(L.index++)),w|=(A>0?1:0)*T,T<<=1;switch(M=w){case 0:for(w=0,S=Math.pow(2,8),T=1;T!=S;)A=L.val&L.position,L.position>>=1,L.position==0&&(L.position=r,L.val=h(L.index++)),w|=(A>0?1:0)*T,T<<=1;m[v++]=o(w),M=v-1,y--;break;case 1:for(w=0,S=Math.pow(2,16),T=1;T!=S;)A=L.val&L.position,L.position>>=1,L.position==0&&(L.position=r,L.val=h(L.index++)),w|=(A>0?1:0)*T,T<<=1;m[v++]=o(w),M=v-1,y--;break;case 2:return b.join("")}if(y==0&&(y=Math.pow(2,C),C++),m[M])k=m[M];else if(M===v)k=_+_.charAt(0);else return null;b.push(k),m[v++]=_+k.charAt(0),y--,_=k,y==0&&(y=Math.pow(2,C),C++)}}};return l}();n!=null?n.exports=i:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return i})}(_n)),_n.exports}var ls=br();const wr="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",kr="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",Sr="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,_r=10;async function zn(){const{masto:n}=se(),i=n.v1.followedTags.list({limit:Cr}).values(),o=[];let s=0;do{const{value:a,done:c}=await i.next();if(c||a?.length===0)break;o.push(...a),s++}while(s<_r);return o.sort((a,c)=>a.name.localeCompare(c.name)),o.length&&setTimeout(()=>{Te.account.set("followedTags",{tags:o,updatedAt:Date.now()})},1),o}const Ir=24*60*60*1e3;async function Ar(){try{const{tags:n,updatedAt:i}=Te.account.get("followedTags")||{};return n?.length?(Date.now()-i>Ir&&zn(),n):await zn()}catch{return[]}}const ds=document.createElement("div"),Tr=n=>{if(!n)return[];if(n.indexOf("#")===-1)return[];ds.innerHTML=n;const i=ds.querySelectorAll("a.hashtag");return i.length?Array.from(i).map(o=>o.innerText.trim().replace(/^[^#]*#+/,"")):[]};function In({children:n}){if(typeof n=="string")return n;const[i,o]=R("");return G(()=>{Promise.resolve(n).then(o)},[n]),i}const At=9,xr=["following","mentions","notifications","list","public","trending","search","hashtag","bookmarks","favourites"],ho={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"}},An={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}]},Er=yt(async({id:n})=>{const i=await se().masto.v1.accounts.$select(n).fetch();return i.username||i.acct||i.displayName}),Fn={following:{id:"home",title:(n,i)=>i===0?ue._({id:"i0qMbr"}):ue._({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?Ec(n):ue._({id:"h16FyT"}),path:({id:n})=>n?`/l/${n}`:"/l",icon:"list",excludeViewMode:({id:n})=>n?[]:["multi-column"]},public:{id:"public",title:({local:n})=>n?ue._({id:"d5zxa4"}):ue._({id:"4ERYY7"}),subtitle:({instance:n})=>n||se().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||se().instance,path:({instance:n})=>`/${n}/trending`,icon:"chart"},search:{id:"search",title:({query:n})=>n?`“${n}”`:ue._({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:Er,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||se().instance,path:({hashtag:n,instance:i,media:o})=>`${i?`/${i}`:""}/t/${n.split(/\s+/).join("+")}${o?"?media=1":""}`,icon:"hashtag"}};function Rr({onClose:n}){const{_:i}=ce(),o=Ge(E),{shortcuts:s}=o,[a,c]=R(!1),[p,l]=R(!1),[d]=Yn();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:ue._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:[e(I,{icon:"shortcut"})," ",e(u,{id:"CTqTgr"})," ",e("sup",{style:{fontSize:12,opacity:.5,textTransform:"uppercase"},children:e(u,{id:"A1As8l"})})]})}),e("main",{children:[e("p",{children:e(u,{id:"CIHAsy"})}),e("div",{class:"shortcuts-view-mode",children:[{value:"float-button",label:ue._({id:"qwdOim"}),imgURL:wr},{value:"tab-menu-bar",label:ue._({id:"UxBoCm"}),imgURL:Sr},{value:"multi-column",label:ue._({id:"uvDfdW"}),imgURL:kr}].map(({value:r,label:h,imgURL:m})=>{const f=o.settings.shortcutsViewMode===r||r==="float-button"&&!o.settings.shortcutsViewMode;return e("label",{class:f?"checked":"",children:[e("input",{type:"radio",name:"shortcuts-view-mode",value:r,checked:f,onChange:y=>{E.settings.shortcutsViewMode=y.target.value}})," ",e("img",{src:m,alt:"",width:"80",height:"58"})," ",e("span",{children:h})]},r)})}),s.length>0?e(D,{children:[e("ol",{class:"shortcuts-list",ref:d,children:s.filter(Boolean).map((r,h)=>{const m=Object.values(r).join("-"),{type:f}=r;if(!Fn[f])return null;let{icon:y,title:v,subtitle:C,excludeViewMode:k}=Fn[f];typeof v=="function"?v=v(r,h):v=i(v),typeof C=="function"?C=C(r,h):C=i(C),typeof y=="function"&&(y=y(r,h)),typeof k=="function"&&(k=k(r,h));const b=k?.includes(o.settings.shortcutsViewMode);return e("li",{children:[e(I,{icon:y}),e("span",{class:"shortcut-text",children:[e(In,{children:v}),C&&e(D,{children:[" ",e("small",{class:"ib insignificant",children:C})]}),b&&e("span",{class:"tag",children:e(u,{id:"5KJFnN"})})]}),e("span",{class:"shortcut-actions",children:[e("button",{type:"button",class:"plain small",disabled:h===0,onClick:()=>{const g=Array.from(E.shortcuts);if(h>0){const _=E.shortcuts[h-1];g[h-1]=r,g[h]=_,E.shortcuts=g}},children:e(I,{icon:"arrow-up",alt:ue._({id:"QyioBP"})})}),e("button",{type:"button",class:"plain small",disabled:h===s.length-1,onClick:()=>{const g=Array.from(E.shortcuts);if(h<E.shortcuts.length-1){const _=E.shortcuts[h+1];g[h+1]=r,g[h]=_,E.shortcuts=g}},children:e(I,{icon:"arrow-down",alt:ue._({id:"3Ib6FN"})})}),e("button",{type:"button",class:"plain small",onClick:()=>{c({shortcut:r,shortcutIndex:h})},children:e(I,{icon:"pencil",alt:ue._({id:"ePK91l"})})})]})]},m)})}),s.length===1&&o.settings.shortcutsViewMode!=="float-button"&&e("div",{class:"ui-state insignificant",children:[e(I,{icon:"info"})," ",e("small",{children:e(u,{id:"3Xq4Zi"})})]})]}):e("div",{class:"ui-state insignificant",children:[e("p",{children:o.settings.shortcutsViewMode==="multi-column"?ue._({id:"3xIN+E"}):ue._({id:"vLxvHT"})}),e("p",{children:e(u,{id:"Fq4zw3",components:{0:e("br",{}),1:e("a",{href:"#",onClick:r=>{r.preventDefault(),E.shortcuts=[{type:"following"},{type:"notifications"}]}})}})})]}),e("p",{class:"insignificant",children:s.length>=At&&(o.settings.shortcutsViewMode==="multi-column"?ue._({id:"RqXfsz",values:{SHORTCUTS_LIMIT:At}}):ue._({id:"EVRO/o",values:{SHORTCUTS_LIMIT:At}}))}),e("p",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e("button",{type:"button",class:"light",onClick:()=>l(!0),children:e(u,{id:"bgVLbt"})}),e("button",{type:"button",disabled:s.length>=At,onClick:()=>c(!0),children:[e(I,{icon:"plus"})," ",e("span",{children:o.settings.shortcutsViewMode==="multi-column"?ue._({id:"Vh3ADI"}):ue._({id:"9tmn6W"})})]})]})]}),a&&e(Ue,{onClick:r=>{r.target===r.currentTarget&&c(!1)},children:e(Lr,{shortcut:a.shortcut,shortcutIndex:a.shortcutIndex,onSubmit:({result:r,mode:h})=>{h==="edit"?E.shortcuts[a.shortcutIndex]=r:E.shortcuts.push(r)},onClose:()=>c(!1)})}),p&&e(Ue,{onClick:r=>{r.target===r.currentTarget&&l(!1)},children:e(Mr,{shortcuts:s,onClose:()=>l(!1)})})]})}const us={list:{id:"1qL+L+"},search:{id:"dmTmkQ"},hashtag:{id:"E8laYz"}};function Lr({onSubmit:n,disabled:i,shortcut:o,shortcutIndex:s,onClose:a}){const{_:c}=ce(),p=!!o,[l,d]=R(o?.type||null),[r,h]=R("default"),[m,f]=R([]),[y,v]=R([]);G(()=>{(async()=>{if(l==="list")try{h("loading");const k=await pn();f(k),h("default")}catch{h("error")}})(),(async()=>{if(l==="hashtag")try{const k=await zn();v(k)}catch{}})()},[l]);const C=q();return G(()=>{if(p&&l&&An[l]){const k=C.current;An[l].forEach(({name:b,type:g})=>{const _=k.querySelector(`[name="${b}"]`);_&&o[b]&&(g==="checkbox"?_.checked=o[b]==="on":_.value=o[b])})}},[p,l]),e("div",{id:"shortcut-settings-form",class:"sheet",children:[!!a&&e("button",{type:"button",class:"sheet-close",onClick:a,children:e(I,{icon:"x",alt:ue._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:p?ue._({id:"pe1jog"}):ue._({id:"Lsxpe5"})})}),e("main",{tabindex:"-1",children:e("form",{ref:C,onSubmit:k=>{k.preventDefault();const b=new FormData(k.target),g={};b.forEach((_,w)=>{g[w]=_?.trim(),w==="instance"&&(g[w]=g[w].replace(/^https?:\/\//,"").replace(/\/+$/,""),g[w]=g[w].replace(/^@?[^@]+@/,""))}),g.type&&(n({result:g,mode:p?"edit":"add"}),k.target.reset(),d(null),a?.())},children:[e("p",{children:e("label",{children:[e("span",{children:e(u,{id:"cklVjM"})}),e("select",{required:!0,disabled:i,onChange:k=>{d(k.target.value)},defaultValue:p?o.type:void 0,name:"type",dir:"auto",children:[e("option",{}),xr.map(k=>e("option",{value:k,children:c(ho[k])}))]})]})}),An[l]?.map?.(({text:k,name:b,type:g,placeholder:_,pattern:w,notRequired:A})=>l==="list"?e("p",{children:e("label",{children:[e("span",{children:e(u,{id:"2BBAbc"})}),e("select",{name:"id",required:!A,disabled:i||r==="loading",defaultValue:p?o.id:void 0,dir:"auto",children:[e("option",{value:""}),m.map(S=>e("option",{value:S.id,children:S.title}))]})]})}):e("p",{children:e("label",{children:[e("span",{children:c(k)})," ",e("input",{type:g,switch:g==="checkbox"||void 0,name:b,placeholder:c(_),required:g==="text"&&!A,disabled:i,list:l==="hashtag"?"followed-hashtags-datalist":null,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:w,dir:"auto"}),l==="hashtag"&&y.length>0&&e("datalist",{id:"followed-hashtags-datalist",children:y.map(S=>e("option",{value:S.name}))})]})})),!!us[l]&&e("p",{class:"form-note insignificant",children:[e(I,{icon:"info"}),c(us[l])]}),e("footer",{children:[e("button",{type:"submit",class:"block",disabled:i||r==="loading",children:p?ue._({id:"tfDRzk"}):ue._({id:"m16xKo"})}),p&&e("button",{type:"button",class:"light danger",onClick:()=>{E.shortcuts.splice(s,1),a?.()},children:e(u,{id:"t/YqKh"})})]})]})})]})}function Mr({shortcuts:n,onClose:i}){const{_:o}=ce(),{masto:s}=se(),a=ke(()=>!n||!n.filter(Boolean).length?"":ls.compressToEncodedURIComponent(JSON.stringify(n.filter(Boolean))),[n]),[c,p]=R(""),[l,d]=R("default"),r=ke(()=>{if(!c)return d("default"),null;try{const f=JSON.parse(ls.decompressFromEncodedURIComponent(c));if(!Array.isArray(f))throw new Error("Not an array");return d("default"),f}catch{try{const y=JSON.parse(c);if(!Array.isArray(y))throw new Error("Not an array");return d("default"),y}catch{return d("error"),null}}},[c]),h=E.shortcuts.length>0,m=q();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:ue._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{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(u,{id:"l3s5ri"})})]}),e("p",{class:"field-button",children:[e("input",{ref:m,type:"text",name:"import",placeholder:ue._({id:"tBmklN"}),class:"block",onInput:f=>{p(f.target.value)},dir:"auto"}),E.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2 small",disabled:l==="cloud-downloading",onClick:async()=>{d("cloud-downloading");const f=vt();le(ue._({id:"HLqLGx"}));try{const v=(await s.v1.accounts.relationships.fetch({id:[f]}))[0];if(v){const{note:C=""}=v;if(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/.test(C)){const k=C.match(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/)[1],{v:b,dt:g,data:_}=JSON.parse(k);m.current.value=_,m.current.dispatchEvent(new Event("input"))}}d("default")}catch{d("error"),le(ue._({id:"gCDfX+"}))}},title:ue._({id:"B6cG3J"}),children:[e(I,{icon:"cloud"}),e(I,{icon:"arrow-down"})]})]}),!!r&&Array.isArray(r)&&e(D,{children:[e("p",{children:[e("b",{children:r.length})," shortcut",r.length>1?"s":""," ",e("small",{class:"insignificant",children:["(",c.length," characters)"]})]}),e("ol",{class:"import-settings-list",children:r.map(f=>e("li",{children:[e("span",{style:{opacity:n.some(y=>Object.keys(y).every(v=>y[v]===f[v]))?1:0},children:"*"}),e("span",{children:[o(ho[f.type]),f.type==="list"&&" ⚠️"," ",An[f.type]?.map?.(({text:y,name:v,type:C})=>f[v]?e(D,{children:[e("span",{class:"tag collapsed insignificant",children:[y,":"," ",C==="checkbox"?f[v]==="on"?"✅":"❌":f[v]]})," "]}):null)]})]}))}),e("p",{children:[e("small",{children:e(u,{id:"o6sElH"})}),e("br",{}),e("small",{children:["⚠️"," ",e(u,{id:"N4z4P/"})]})]})]}),l==="error"&&e("p",{class:"error",children:e("small",{children:["⚠️ ",e(u,{id:"ZhsPEb"})]})}),e("p",{children:[h&&e(D,{children:[e(ft,{confirmLabel:ue._({id:"6MzUUU"}),menuFooter:e("div",{class:"footer",children:e(u,{id:"nl8sCE"})}),onClick:()=>{const f=r.filter(C=>!E.shortcuts.some(k=>Object.keys(k).every(b=>k[b]===C[b])));if(!f.length){le(ue._({id:"o6L30P"}));return}let y=[...E.shortcuts,...f];const v=y.length>At;v&&(y=y.slice(0,At)),E.shortcuts=y,le(v?ue._({id:"SBmqmC",values:{SHORTCUTS_LIMIT:At}}):ue._({id:"QO9uTx"})),i?.()},children:e("button",{type:"button",class:"plain2",disabled:!r,children:e(u,{id:"c89gCv"})})})," "]}),e(ft,{confirmLabel:h?ue._({id:"6ZjzWP"}):ue._({id:"DWumLi"}),menuItemClassName:h?"danger":void 0,onClick:()=>{E.shortcuts=r,le(ue._({id:"QO9uTx"})),i?.()},children:e("button",{type:"button",class:"plain2",disabled:!r,children:h?ue._({id:"uIp8WL"}):ue._({id:"Sjnlwj"})})})]})]}),e("section",{children:[e("h3",{children:[e(I,{icon:"arrow-up-circle",size:"l",class:"insignificant"})," ",e("span",{children:e(u,{id:"GS+Mus"})})]}),e("p",{children:e("input",{style:{width:"100%"},type:"text",value:a,readOnly:!0,onClick:f=>{if(f.target.value){f.target.select();try{navigator.clipboard.writeText(f.target.value),le(ue._({id:"cWtH+v"}))}catch{le(ue._({id:"yUWyHa"}))}}},dir:"auto"})}),e("p",{children:[e("button",{type:"button",class:"plain2",disabled:!a,onClick:()=>{try{navigator.clipboard.writeText(a),le(ue._({id:"+Kq2vY"}))}catch{le(ue._({id:"tFvxZF"}))}},children:[e(I,{icon:"clipboard"})," ",e("span",{children:e(u,{id:"he3ygx"})})]})," ",navigator?.share&&navigator?.canShare?.({text:a})&&e("button",{type:"button",class:"plain2",disabled:!a,onClick:()=>{try{navigator.share({text:a})}catch{alert(ue._({id:"TtG3Uh"}))}},children:[e(I,{icon:"share"})," ",e("span",{children:e(u,{id:"Z8lGw6"})})]})," ",E.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2",disabled:l==="cloud-uploading",onClick:async()=>{d("cloud-uploading");const f=vt();try{const v=(await s.v1.accounts.relationships.fetch({id:[f]}))[0];if(v){const{note:C=""}=v;let k="";const b=JSON.stringify({v:"1",dt:Date.now(),data:a});/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/.test(C)?k=C.replace(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/,`<phanpy-shortcuts-settings>${b}</phanpy-shortcuts-settings>`):k=`${C}
|
||
|
||
|
||
<phanpy-shortcuts-settings>${b}</phanpy-shortcuts-settings>`,le(ue._({id:"9ZYiLz"})),await s.v1.accounts.$select(f).note.create({comment:k}),d("default"),le(ue._({id:"5w02SH"}))}}catch{d("error"),le(ue._({id:"aVsTYo"}))}},title:ue._({id:"gWd6Cu"}),children:[e(I,{icon:"cloud"}),e(I,{icon:"arrow-up"})]})," ",a.length>0&&e("small",{class:"insignificant ib",children:e(u,{id:"IPXOXm",values:{0:a.length}})})]}),!!a&&e("details",{children:[e("summary",{class:"insignificant",children:e("small",{children:e(u,{id:"e5E+WH"})})}),e("textarea",{style:{width:"100%"},rows:10,readOnly:!0,children:JSON.stringify(n.filter(Boolean),null,2)})]})]}),E.settings.shortcutSettingsCloudImportExport&&e("footer",{children:e("p",{children:[e(I,{icon:"cloud"})," ",e(u,{id:"C4T6O/"})]})})]})]})}Ns(E,n=>{for(const[i,o,s,a]of n)/^show/i.test(o)&&!s&&ui()});function $r(){const{_:n}=ce(),i=Ge(E),o=ki(),s=Qt();return G(()=>{setTimeout(qo,1e3)},[]),e(D,{children:[!!i.showCompose&&e(Ue,{class:`solid ${i.composerState.minimized?"min":""}`,minimized:!!i.composerState.minimized,children:e(Uo,{replyToStatus:typeof i.showCompose!="boolean"?i.showCompose.replyToStatus:window.__COMPOSE__?.replyToStatus||null,replyMode:E.showCompose?.replyMode||window.__COMPOSE__?.replyMode||"all",editStatus:E.showCompose?.editStatus||window.__COMPOSE__?.editStatus||null,draftStatus:E.showCompose?.draftStatus||window.__COMPOSE__?.draftStatus||null,quoteStatus:E.showCompose?.quoteStatus||window.__COMPOSE__?.quoteStatus||null,onClose:a=>{const{newStatus:c,instance:p,type:l,scheduledAt:d}=a||{};E.showCompose=!1,window.__COMPOSE__=null,c&&(E.reloadStatusPage++,d&&E.reloadScheduledPosts++,le({text:{post:n(d?{id:"IrX0sj"}:{id:"aTyHBW"}),reply:n(d?{id:"+38pse"}:{id:"lZdBKl"}),edit:n({id:"a5BN7l"})}[l||"post"],delay:1e3,duration:1e4,onClick:r=>{r.hideToast(),E.prevLocation=s,o(d?"/sp":p?`/${p}/s/${c.id}`:`/s/${c.id}`)}}))}})}),!!i.showSettings&&e(Ue,{onClose:()=>{E.showSettings=!1},children:e(bc,{onClose:()=>{E.showSettings=!1}})}),!!i.showAccounts&&e(Ue,{onClose:()=>{E.showAccounts=!1},children:e(ac,{onClose:()=>{E.showAccounts=!1}})}),!!i.showAccount&&e(Ue,{onClose:()=>{E.showAccount=!1},children:e(jc,{account:i.showAccount?.account||i.showAccount,instance:i.showAccount?.instance,onClose:({destination:a}={})=>{E.showAccount=!1}})}),!!i.showOpenLink&&e(Ue,{onClose:()=>{E.showOpenLink=!1},children:e(fr,{url:i.showOpenLink.url,linkText:i.showOpenLink.linkText,onClose:()=>{E.showOpenLink=!1}})}),!!i.showDrafts&&e(Ue,{onClose:()=>{E.showDrafts=!1},children:e(Yc,{onClose:()=>E.showDrafts=!1})}),!!i.showMediaModal&&e(Ue,{onClick:a=>{(a.target===a.currentTarget||a.target.classList.contains("media"))&&(E.showMediaModal=!1)},children:e(uo,{mediaAttachments:i.showMediaModal.mediaAttachments,instance:i.showMediaModal.instance,index:i.showMediaModal.mediaIndex,statusID:i.showMediaModal.statusID,onClose:()=>{E.showMediaModal=!1}})}),!!i.showShortcutsSettings&&e(Ue,{onClose:()=>{E.showShortcutsSettings=!1},children:e(Rr,{onClose:()=>E.showShortcutsSettings=!1})}),!!i.showGenericAccounts&&e(Ue,{onClose:()=>{E.showGenericAccounts=!1},children:e(Wc,{instance:i.showGenericAccounts.instance,excludeRelationshipAttrs:i.showGenericAccounts.excludeRelationshipAttrs,postID:i.showGenericAccounts.postID,onClose:()=>E.showGenericAccounts=!1,blankCopy:i.showGenericAccounts.blankCopy})}),!!i.showMediaAlt&&e(Ue,{onClose:a=>{E.showMediaAlt=!1},children:e(Xc,{alt:i.showMediaAlt.alt||i.showMediaAlt,lang:i.showMediaAlt?.lang,onClose:()=>{E.showMediaAlt=!1}})}),!!i.showEmbedModal&&e(Ue,{class:"solid",onClose:()=>{E.showEmbedModal=!1},children:e(Gc,{html:i.showEmbedModal.html,url:i.showEmbedModal.url,width:i.showEmbedModal.width,height:i.showEmbedModal.height,onClose:()=>{E.showEmbedModal=!1}})}),!!i.showReportModal&&e(Ue,{onClose:()=>{E.showReportModal=!1},children:e(yr,{account:i.showReportModal.account,post:i.showReportModal.post,onClose:()=>{E.showReportModal=!1}})})]})}const Nr=ot(function(){const i=ki(),o={useKey:!0,ignoreEventWhen:s=>!!document.querySelector("#modal-container > *")||s.metaKey||s.ctrlKey||s.altKey};return Fe("g>h",()=>i("/"),o),Fe("g>n",()=>i("/notifications"),o),null});function pi({accountID:n,onChange:i}){const{_:o}=ce(),{masto:s}=se(),[a,c]=R("default"),[p,l]=R(null),[d,r]=R(null),h=d!==null;return e("p",{class:"follow-request-buttons",children:[e("button",{type:"button",disabled:a==="loading"||h,onClick:()=>{c("loading"),l("accept"),(async()=>{try{const m=await s.v1.followRequests.$select(n).authorize();if(!m?.followedBy)throw new Error("Follow request not accepted");r(m),i()}catch{}c("default")})()},children:e(u,{id:"g3UF2V"})})," ",e("button",{type:"button",disabled:a==="loading"||h,class:"light danger",onClick:()=>{c("loading"),l("reject"),(async()=>{try{const m=await s.v1.followRequests.$select(n).reject();if(m?.followedBy)throw new Error("Follow request not rejected");r(m),i()}catch{c("default")}})()},children:e(u,{id:"1t/NnN"})}),e("span",{class:"follow-request-states",children:h&&p?p==="accept"?e(I,{icon:"check-circle",alt:o({id:"bzMKg7"}),class:"follow-accepted"}):e(I,{icon:"x-circle",alt:o({id:"ekCRTP"}),class:"follow-rejected"}):e(Oe,{hidden:a!=="loading"})})]})}const hs={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",quote:"quote",quoted_update:"pencil"};function ps({account:n,emoji:i,emoji_url:o}){let s,a;typeof o=="string"?s=o:(s=o?.url,a=o?.staticUrl);const c=s?e(ha,{url:s,staticUrl:a,alt:i}):i;return e(u,{id:"i5uN6K",values:{account:n,emojiObject:c}})}const oi={status:({account:n})=>e(u,{id:"idiIxW",values:{account:n}}),reblog:({count:n,account:i,postsCount:o,postType:s,components:{Subject:a}})=>e(u,{id:"jkt9P5",values:{0:We(n),1:We(n),count:n,postsCount:o,postType:s,account:i},components:{0:e(a,{clickable:n>1}),1:e("span",{title:n}),2:e(a,{clickable:n>1}),3:e("span",{title:n})}}),follow:({account:n,count:i,components:{Subject:o}})=>e(u,{id:"+71G9C",values:{0:We(i),count:i,account:n},components:{0:e(o,{clickable:i>1}),1:e("span",{title:i})}}),follow_request:({account:n})=>e(u,{id:"eh6NHW",values:{account:n}}),favourite:({account:n,count:i,postsCount:o,postType:s,components:{Subject:a}})=>e(u,{id:"RqX1mR",values:{0:We(i),1:We(i),count:i,postsCount:o,postType:s,account:n},components:{0:e(a,{clickable:i>1}),1:e("span",{title:i}),2:e(a,{clickable:i>1}),3:e("span",{title:i})}}),poll:()=>ue._({id:"kIlJaS"}),"poll-self":()=>ue._({id:"kpjzdN"}),"poll-voted":()=>ue._({id:"moT7M8"}),update:({account:n})=>n?e(u,{id:"W+eFn3",values:{account:n}}):ue._({id:"uzt17m"}),"favourite+reblog":({count:n,account:i,postsCount:o,postType:s,components:{Subject:a}})=>e(u,{id:"NunZZQ",values:{0:We(n),1:We(n),count:n,postsCount:o,postType:s,account:i},components:{0:e(a,{clickable:n>1}),1:e("span",{title:n}),2:e(a,{clickable:n>1}),3:e("span",{title:n})}}),quoted_update:({account:n})=>e(u,{id:"pkB7ti",values:{account:n}}),"admin.sign_up":({account:n})=>e(u,{id:"fJCCpx",values:{account:n}}),"admin.report":({account:n,targetAccount:i})=>e(u,{id:"eNfCmq",values:{account:n,targetAccount:i}}),severed_relationships:({name:n})=>e(u,{id:"Xl9v6+",values:{name:n},components:{0:e("i",{})}}),moderation_warning:()=>e("b",{children:e(u,{id:"YqffEv"})}),emoji_reaction:ps,"pleroma:emoji_reaction":ps,annual_report:({year:n})=>e(u,{id:"INLTzH",values:{year:n}})},Pr={account_suspension:({from:n,targetName:i})=>e(u,{id:"uRkcgw",values:{from:n,targetName:i},components:{0:e("i",{}),1:e("i",{})}}),domain_block:({from:n,targetName:i,followersCount:o,followingCount:s})=>e(u,{id:"Q3yArs",values:{from:n,targetName:i,followersCount:o,followingCount:s},components:{0:e("i",{}),1:e("i",{})}}),user_domain_block:({targetName:n,followersCount:i,followingCount:o})=>e(u,{id:"RQKWUa",values:{targetName:n,followersCount:i,followingCount:o},components:{0:e("i",{})}})},Dr={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"}},ai=30;function Or({notification:n,instance:i,isStatic:o,disableContextMenu:s}){const{_:a}=ce(),{masto:c}=se(),{id:p,status:l,account:d,report:r,event:h,moderation_warning:m,annualReport:f,_ids:y,_accounts:v,_statuses:C,_groupKeys:k,sampleAccounts:b,notificationsCount:g,groupKey:_,_notificationsCount:w,_sampleAccountsCount:A}=n;let{type:S}=n;if((S==="mention"||S==="quote")&&!l)return null;const T=l?.reblog||l,M=T?.id,L=vt(),H=L===d?.id,F=l?.poll?.voted,U=!!l?.inReplyToAccountId&&l?.inReplyToAccountId!==L&&l?.account?.id===L;let W=0,Q=0;if(S==="favourite+reblog"){if(v)for(const ee of v)ee._types?.includes("favourite")&&W++,ee._types?.includes("reblog")&&Q++;!Q&&W&&(S="favourite"),!W&&Q&&(S="reblog")}let V;S==="poll"?V=oi[H?"poll-self":F?"poll-voted":"poll"]:oi[S]?V=oi[S]:V=ue._({id:"ODqZt1",values:{type:S}});const j=({clickable:ee,...he})=>ee?e("b",{tabIndex:"0",onClick:Y,...he}):e("b",{...he}),K=g>0&&g>b?.length,pe=K?"remote":"local";if(typeof V=="function"){const ee=(S==="favourite"||S==="reblog")&&g?K?g:b?.length:v?.length||b?.length||(d?1:0),he=C?.length||(l?1:0);if(S==="admin.report"){const re=r?.targetAccount;re&&(V=V({account:e(mt,{account:d,showAvatar:!0}),targetAccount:e(mt,{account:re,showAvatar:!0})}))}else if(S==="severed_relationships"){const re=h?.targetName;re&&(V=V({name:re}))}else if((S==="emoji_reaction"||S==="pleroma:emoji_reaction")&&n.emoji){const re=n.emoji_url||l?.emojis?.find?.(J=>J?.shortcode===n.emoji.replace(/^:/,"").replace(/:$/,""));V=V({account:e(mt,{account:d,showAvatar:!0}),emoji:n.emoji,emojiURL:re})}else S==="annual_report"?V=V({...n.annualReport}):V=V({account:d?e(mt,{account:d,showAvatar:!0}):b?.[0]&&e(mt,{account:b[0],showAvatar:!0}),count:ee,postsCount:he,postType:U?"reply":"post",components:{Subject:j}})}const $=n.createdAt&&new Date(n.createdAt).toLocaleString(),ie={"favourite+reblog":ue._({id:"+XOeb+"}),favourite:ue._({id:"LQFF6J"}),reblog:ue._({id:"phQpSa"}),follow:ue._({id:"Ih01jh"})}[S]||ue._({id:"bPwFdf"}),Y=()=>{E.showGenericAccounts={heading:ie,accounts:v,showReactions:S==="favourite+reblog",excludeRelationshipAttrs:S==="follow"?["followedBy"]:[],postID:rt(M,i)}};if(l?.filtered){const ee=l?.account?.id===L,he=Zt(l.filtered,"notifications");if(!H&&!ee&&he?.action==="hide")return null}return e("div",{class:`notification notification-${S}`,"data-notification-id":y||p,"data-group-key":k?.join(" ")||_,tabIndex:"0",children:[e("div",{class:`notification-type notification-${S}`,title:$,children:S==="favourite+reblog"?e(D,{children:[e(I,{icon:"rocket",size:"xl",alt:S,class:"reblog-icon"}),e(I,{icon:"heart",size:"xl",alt:S,class:"favourite-icon"})]}):e(I,{icon:hs[S]||"notification",size:"xl",alt:S})}),e("div",{class:"notification-content",children:[S!=="mention"&&S!=="quote"&&e(D,{children:[e("p",{children:V}),S==="follow_request"&&e(pi,{accountID:d.id}),S==="severed_relationships"&&e("div",{children:[Pr[h.type]({from:i,...h}),e("br",{}),e("a",{href:`https://${i}/severed_relationships`,target:"_blank",rel:"noopener",children:e(u,{id:"YL6Y8P",components:{0:e(I,{icon:"external",size:"s"})}})}),"."]}),S==="moderation_warning"&&!!m&&e("div",{children:[a(Dr[m.action]()),e("br",{}),e("a",{href:`/disputes/strikes/${m.id}`,target:"_blank",rel:"noopener",children:e(u,{id:"YL6Y8P",components:{0:e(I,{icon:"external",size:"s"})}})})]}),S==="annual_report"&&e("div",{children:e(fe,{to:`/annual_report/${f?.year}`,children:e(u,{id:"5PGPvG"})})})]}),v?.length>1&&e("p",{class:"avatars-stack",children:[v.slice(0,ai).map(ee=>e(D,{children:[e("a",{href:ee.url,rel:"noopener",class:"account-avatar-stack",onClick:he=>{he.preventDefault(),E.showAccount=ee},children:[e(pt,{url:ee.avatarStatic,size:v.length<=10?"xxl":v.length<20?"xl":"l",alt:`${ee.displayName} @${ee.acct}`,squircle:ee?.bot},ee.id),S==="favourite+reblog"&&e("div",{class:"account-sub-icons",children:ee._types.map(he=>e(I,{icon:hs[he],size:"s",class:`${he}-icon`}))})]},ee.id)," "]},ee.id)),(S==="favourite+reblog"||S==="favourite"||S==="reblog")&&pe==="remote"?e("button",{type:"button",class:"small plain","data-group-keys":k?.join(" "),onClick:()=>{E.showGenericAccounts={heading:ie,accounts:v,fetchAccounts:async()=>{const ee=await Promise.allSettled(k.map(async re=>{const J=c.v2.notifications.$select(re).accounts.list().values();return[re,(await J.next()).value]})),he=[];for(const re of ee){const[J,Ce]=re.value,ve=/^favourite/.test(J)?"favourite":/^reblog/.test(J)?"reblog":null;if(ve)for(const ye of Ce){const Ne=he.find(Se=>Se.id===ye.id);Ne?Ne._types.push(ve):(ye._types=[ve],he.push(ye))}}return{done:!0,value:he}},showReactions:S==="favourite+reblog",postID:rt(M,i)}},children:["+",(S==="favourite"||S==="reblog")&&g-v.length,e(I,{icon:"chevron-down"})]}):e("button",{type:"button",class:"small plain",onClick:Y,children:[v.length>ai&&`+${v.length-ai}`,e(I,{icon:"chevron-down"})]})]}),!v?.length&&b?.length>1&&e("p",{class:"avatars-stack",children:[b.map(ee=>e(D,{children:[e("a",{href:ee.url,rel:"noopener",class:"account-avatar-stack",onClick:he=>{he.preventDefault(),E.showAccount=ee},children:e(pt,{url:ee.avatarStatic,size:"xxl",alt:`${ee.displayName} @${ee.acct}`,squircle:ee?.bot},ee.id)},ee.id)," "]},ee.id)),g>b.length&&e(fe,{to:i?`/${i}/s/${l.id}`:`/s/${l.id}`,class:"button small plain centered",children:["+",g-b.length,e(I,{icon:"chevron-right"})]})]}),C?.length>1&&e("ul",{class:"notification-group-statuses",children:C.map(ee=>e("li",{children:e(fs,{class:`status-link status-type-${S}`,to:i?`/${i}/s/${ee.id}`:`/s/${ee.id}`,children:e(je,{status:ee,size:"s",previewMode:!0,allowContextMenu:!0,allowFilters:!0})})},ee.id))}),l&&(!C?.length||C?.length<=1)&&e(fs,{class:`status-link status-type-${S}`,to:i?`/${i}/s/${M}`:`/s/${M}`,onContextMenu:s?void 0:ee=>{const he=ee.target.querySelector(".status");if(he){if(ee.metaKey)return;ee.preventDefault(),he.dispatchEvent(new MouseEvent("contextmenu",{clientX:ee.clientX,clientY:ee.clientY}))}},children:o?e(je,{status:T,size:"s",readOnly:!0,allowContextMenu:!0,allowFilters:!0}):e(je,{statusID:M,size:"s",readOnly:!0,allowContextMenu:!0,allowFilters:!0})})]})]})}function fs(n){const i=pa();return e(fe,{...n,"data-read-more":ue._({id:"8fZueG"}),ref:i})}const un=ot(Or,(n,i)=>n.notification?.id===i.notification?.id);"serviceWorker"in navigator&&navigator.serviceWorker.addEventListener("message",n=>{const{type:i,id:o,accessToken:s}=n?.data||{};i==="notification"&&(E.routeNotification={id:o,accessToken:s})});const zr=ot(function(){const{_:i}=ce();if(!("serviceWorker"in navigator))return null;const o=Ge(E),{routeNotification:s}=o,{id:a,accessToken:c}=s||{},[p,l]=R(!1);St(()=>{if(!a||!c)return;const{instance:r}=se(),{masto:h,instance:m}=se({accessToken:c}),f=r===m,y=c?Ko(c):Si();(async()=>{const v=await h.v1.notifications.$select(a).fetch();if(v&&y){const C=y.instanceURL,{type:k,status:b,account:g}=v,_=!!document.querySelector("#modal-container > *"),w=k==="follow"&&!!g?.id,A=!!g?.id,S=!!b?.id;w&&f?E.showAccount={account:g,instance:C}:_||!f||A&&S?l({id:a,account:y,notification:v,sameInstance:f}):S?location.hash=`/${r}/s/${b.id}`:w?location.hash=`/${r}/a/${g.id}`:location.hash="/notifications"}})()},[a,c]),St(()=>{navigator?.clearAppBadge&&navigator.clearAppBadge()},[]),Xt(r=>{r&&navigator?.clearAppBadge&&navigator.clearAppBadge()});const d=()=>{l(!1),E.routeNotification=null,/\/notifications\?id=/i.test(location.hash)&&(location.hash="/notifications")};if(p){const{id:r,account:h,notification:m,sameInstance:f}=p;return e(Ue,{onClick:y=>{y.target===y.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(u,{id:"5+87Pq"})})}),e("main",{children:[!f&&e("p",{children:e(u,{id:"k9N0Xk"})}),e("div",{class:"notification-peek",onClick:y=>{const{target:v}=y;(y.target.tagName==="BUTTON"||y.target.tagName==="A")&&d()},children:e(un,{instance:h.instanceURL,notification:m,isStatic:!0})}),e("div",{style:{textAlign:"end"},children:e(fe,{to:"/notifications",class:"button light",onClick:d,children:[e("span",{children:e(u,{id:"/WA/tl"})})," ",e(I,{icon:"arrow-right"})]})})]})]})})}return null}),Zn=({limit:n}={})=>{const i=Te.account.get("searchHistory")||[];return n?i.slice(0,n):i},Fr=10,Tn=(n,i=null)=>{if(!n?.trim?.())return;const o=Zn(),s=o.findIndex(c=>c.query===n&&c.queryType===i);s!==-1&&o.splice(s,1),o.unshift({query:n.trim(),queryType:i,timestamp:Date.now()});const a=o.slice(0,Fr);Te.account.set("searchHistory",a)},Br=(n,i=null)=>{const s=Zn().filter(a=>!(a.query===n&&a.queryType===i));Te.account.set("searchHistory",s)},qr=()=>{Te.account.set("searchHistory",[])},Ot=(n,i,o)=>{let s,a,c;if(i==="statuses")s=e(u,{id:"o1mMWT",values:{query:n},components:{0:e("q",{})}}),a=`/search?q=${encodeURIComponent(n)}&type=statuses`,c="document";else if(i==="accounts")s=e(u,{id:"cDoNQr",values:{query:n},components:{0:e("q",{})}}),a=`/search?q=${encodeURIComponent(n)}&type=accounts`,c="group";else if(i==="hashtags"){const p=n[0],l=n.replace(/^[##]/,""),d=`${p}${l}`;s=e(u,{id:"mFfcu0",values:{hashtag:d},components:{0:e("mark",{})}}),a=`/${o}/t/${l}`,c="hashtag"}else s=e(u,{id:"48oDit",values:{query:n},components:{0:e("small",{class:"insignificant"})}}),a=`/search?q=${encodeURIComponent(n)}`,c="search";return{label:s,to:a,icon:c}},po=Ho((n,i)=>{const{_:o}=ce(),{instance:s}=se(),[a,c]=bt(),[p,l]=R(!1),[d,r]=R(a.get("q")||""),h=a.get("type"),m=q(null),f=q(null);jo(i,()=>({setValue:C=>{r(C)},focus:()=>{f.current.focus()},select:()=>{f.current.select()},blur:()=>{f.current.blur()}}));const y=ke(()=>Zn({limit:5}),[n?.hidden]),v=ke(()=>{if(!d)return[];const k=y.filter(g=>g.query===d?!1:g.query.toLowerCase().includes(d.toLowerCase())).slice(0,2).map(g=>({...Ot(g.query,g.queryType,s),queryType:g.queryType,isRecentSearch:!0,historyItem:g}));return[{...Ot(d,null,s),top:!h&&!/\s/.test(d),hidden:!!h},...k,{...Ot(d,"statuses",s),hidden:/^https?:/.test(d),top:/\s/.test(d),queryType:"statuses"},{...Ot(d,"hashtags",s),hidden:/^[@@]/.test(d)||/^https?:/.test(d)||/\s/.test(d),top:/^[##]/.test(d),type:"link",queryType:"hashtags"},{label:e(u,{id:"gEoOUj",values:{query:d},components:{0:e("mark",{})}}),to:`/${d}`,hidden:!/^https?:/.test(d),top:/^https?:/.test(d),type:"link",icon:"arrow-right"},{...Ot(d,"accounts",s),queryType:"accounts"}].sort((g,_)=>{if(h){if(g.queryType===h)return-1;if(_.queryType===h)return 1}return g.top&&!_.top?-1:!g.top&&_.top?1:0}).filter(({hidden:g})=>!g)},[d,h,s]);return e("form",{ref:m,class:"search-popover-container",onSubmit:C=>{if(C.preventDefault(),/\/search/.test(location.hash))if(d){const b={q:d};h&&(b.type=h),c(b)}else c({});else d?location.hash=`/search?q=${encodeURIComponent(d)}${h?`&type=${h}`:""}`:location.hash="/search";Tn(d,h),n?.onSubmit?.(C)},children:[e("input",{ref:f,value:d,name:"q",type:"search",placeholder:o({id:"A1taO8"}),dir:"auto",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",onSearch:C=>{C.target.value||c({})},onInput:C=>{r(C.target.value),l(!0)},onFocus:()=>{l(!0);const C=m.current?.querySelector(".search-popover-item");C&&C.classList.add("focus")},onBlur:()=>{setTimeout(()=>{l(!1)},100),m.current?.querySelector(".search-popover-item.focus")?.classList.remove("focus")},onKeyDown:C=>{const{key:k}=C;switch(k){case"Escape":l(!1);break;case"Down":case"ArrowDown":if(C.preventDefault(),p){const b=m.current.querySelector(".search-popover-item.focus");if(b){let g=b.nextElementSibling;for(;g&&g.hidden;)g=g.nextElementSibling;g&&(g.classList.add("focus"),Array.from(g.parentElement.children).filter(w=>w!==g).forEach(w=>{w.classList.remove("focus")}))}else{const g=m.current.querySelector(".search-popover-item");g&&g.classList.add("focus")}}break;case"Up":case"ArrowUp":if(C.preventDefault(),p){const b=document.querySelector(".search-popover-item.focus");if(b){let g=b.previousElementSibling;for(;g&&g.hidden;)g=g.previousElementSibling;g&&(g.classList.add("focus"),Array.from(g.parentElement.children).filter(w=>w!==g).forEach(w=>{w.classList.remove("focus")}))}else{const g=document.querySelectorAll(".search-popover-item"),_=g[g.length-1];_&&_.classList.add("focus")}}break;case"Enter":if(p){const b=document.querySelector(".search-popover-item.focus");b&&(C.preventDefault(),b.click()),l(!1),n?.onSubmit?.(C)}break}}}),e("div",{class:"search-popover",hidden:!p,children:[!d&&y.length>0&&e("div",{class:"search-popover-recent-searches",children:[e("div",{class:"search-popover-header",children:[e(I,{icon:"history",size:"s"}),e(u,{id:"4R1B1H"})]}),y.map((C,k)=>{const{label:b,to:g,icon:_}=Ot(C.query,C.queryType,s);return e(fe,{to:g,class:`search-popover-item ${k===0?"focus":""}`,onClick:w=>{Tn(C.query,C.queryType),n?.onSubmit?.(w)},children:[e(I,{icon:_,class:"more-insignificant"}),e("span",{children:b})]},`${C.query}-${C.queryType}-${C.timestamp}`)}),e(fe,{to:"/search",class:"search-popover-item search-history-see-all",children:[e(I,{icon:"more2",class:"more-insignificant"}),e("span",{children:e(u,{id:"gukqfD"})})]})]}),v.map(({label:C,to:k,icon:b,queryType:g,isRecentSearch:_,historyItem:w},A)=>e(fe,{to:k,class:`search-popover-item ${_?"search-popover-item-recent":""} ${A===0?"focus":""}`,onClick:S=>{_||Tn(d,g),n?.onSubmit?.(S)},children:[e(I,{icon:b,class:"more-insignificant"}),e("span",{children:C})]},_?`recent-${w.query}-${w.queryType}-${w.timestamp}`:`suggestion-${g||"general"}-${A}`))]})]})}),Ur=ot(function({onClose:i=()=>{}}){const[o,s]=R(!1),a=q(null);Fe(["Slash","/"],l=>{s(!0),setTimeout(()=>{a.current?.focus?.(),a.current?.select?.()},0)},{useKey:!0,preventDefault:!0,ignoreEventWhen:l=>{const d=/\/search/.test(location.hash),r=!!document.querySelector("#modal-container > *");return d||r||l.metaKey||l.ctrlKey||l.altKey||l.shiftKey}});const c=()=>{s(!1),i()};Fe("esc",l=>{a.current?.blur?.(),c()},{enabled:o,enableOnFormTags:!0,preventDefault:!0,useKey:!0,ignoreEventWhen:l=>l.metaKey||l.ctrlKey||l.altKey||l.shiftKey});const p=!o;return e("div",{id:"search-command-container",hidden:p,onClick:l=>{l.target===l.currentTarget&&c()},children:e(po,{ref:a,hidden:p,onSubmit:()=>{c()}})})});function Kr(){const{_:n,_:i}=ce(),{instance:o}=se(),s=Ge(E),{shortcuts:a,settings:c}=s;if(!a.length)return null;const p=c.shortcutsViewMode==="multi-column"||!c.shortcutsViewMode&&c.shortcutsColumnsMode,l=q(),d=q(),r=q(!1),h=a.map((v,C)=>{const{type:k,...b}=v;if(!Fn[k])return null;let{id:g,path:_,title:w,subtitle:A,icon:S}=Fn[k];return typeof g=="function"&&(g=g(b,C)),typeof _=="function"&&(_=_({...b,instance:b.instance||o},C)),typeof w=="function"?w=w(b,C):w?.id&&(w=i(w)),typeof A=="function"?A=A(b,C):A?.id&&(A=i(A)),typeof S=="function"&&(S=S(b,C)),g==="lists"&&(r.current=!0),{id:g,path:_,title:w,subtitle:A,icon:S}}).filter(Boolean);G(()=>{if(s.settings.shortcutsViewMode==="tab-menu-bar"&&d.current){const v=setTimeout(()=>{const C=d.current?.querySelector(".is-active");C&&C.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},100);return()=>clearTimeout(v)}},[]);const m=ki();Fe(["1","2","3","4","5","6","7","8","9"],v=>{const C=parseInt(v.key,10)-1;if(C<h.length){const{path:k}=h[C];k&&(m(k),l.current?.closeMenu?.())}},{enabled:!p,useKey:!0,ignoreEventWhen:v=>v.metaKey||v.ctrlKey||v.altKey||v.shiftKey});const[f,y]=R([]);return p?null:e("div",{id:"shortcuts",children:s.settings.shortcutsViewMode==="tab-menu-bar"?e("nav",{ref:d,class:"tab-bar",onContextMenu:v=>{v.preventDefault(),E.showShortcutsSettings=!0},children:e("ul",{children:h.map(({id:v,path:C,title:k,subtitle:b,icon:g},_)=>e("li",{children:e(fe,{class:b?"has-subtitle":"",to:C,onClick:w=>{if(w.target.classList.contains("is-active")){w.preventDefault();const A=document.getElementById(`${v}-page`);if(A){A.scrollTop=0;const S=A.querySelector(".updates-button");S&&S.click()}}},children:[e(I,{icon:g,size:"xl"}),e("span",{children:[e(In,{children:k}),b&&e(D,{children:[e("br",{}),e("small",{children:b})]})]})]})},`${_}-${v}-${k}-${b}-${C}`))})}):e(lt,{instanceRef:l,overflow:"auto",viewScroll:"close",menuClassName:"glass-menu shortcuts-menu",gap:8,position:"anchor",onMenuChange:v=>{v.open&&r.current&&pn().then(y)},menuButton:e("button",{type:"button",id:"shortcuts-button",class:"plain",onContextMenu:v=>{v.preventDefault(),E.showShortcutsSettings=!0},onTransitionStart:v=>{try{const{target:C}=v;getComputedStyle(C).pointerEvents==="none"&&l.current?.closeMenu?.()}catch{}},children:e(I,{icon:"shortcut",size:"xl",alt:n({id:"CTqTgr"})})}),children:h.map(({id:v,path:C,title:k,subtitle:b,icon:g},_)=>v==="lists"?e(hn,{menuClassName:"glass-menu",overflow:"auto",gap:-8,label:e(D,{children:[e(I,{icon:g,size:"l"}),e("span",{class:"menu-grow",children:e(In,{children:k})}),e(I,{icon:"chevron-right"})]}),children:[e(Ke,{to:"/l",children:e("span",{children:e(u,{id:"BHWx+g"})})}),e(He,{}),f?.map(w=>e(Ke,{to:`/l/${w.id}`,children:e("span",{children:[w.title,w.exclusive&&e(D,{children:[" ",e(Kt,{})]})]})},w.id))]}):e(Ke,{to:C,class:"glass-menu-item",children:[e(I,{icon:g,size:"l"})," ",e("span",{class:"menu-grow",children:[e("span",{children:e(In,{children:k})}),b&&e(D,{children:[" ",e("small",{class:"more-insignificant",children:b})]})]}),e("span",{class:"menu-shortcut hide-until-focus-visible",children:_+1})]},`${_}-${v}-${k}-${b}-${C}`))})})}const Hr=ot(Kr);function jr(n){let i=[],o=[],s=0;for(let a=0;a<n.length;a++){const c=n[a];c.reblog&&!c.account?.group?(o.push(c),s++):(i.push(c),s<3&&(s=0))}if(n.length>10&&(o.length>n.length/4||s>=3)){const a=o.map(c=>c.id);if(o.length>n.length*3/4)i=[...i,{id:a,items:o,type:"boosts"}];else{const c=Math.floor(i.length/2);i=[...i.slice(0,c),{id:a,items:o,type:"boosts"},...i.slice(c)]}return i}else return n}function ms(n,i){const o=Te.account.get("boostedStatusIDs")||{},s=n.filter(c=>{if(!c.reblog)return!0;const p=`${i}-${c.reblog.id}`,l=o[p];return l&&l!==c.id?!1:(o[p]=c.id,!0)}),a=Object.keys(o);return a.length>50&&a.slice(0,a.length-50).forEach(c=>{delete o[c]}),Te.account.set("boostedStatusIDs",o),s}function Yr(n,i){const o=[];let s=0;n.forEach(l=>{for(let r=0;r<o.length;r++){if(o[r].find(h=>h.id===l.id))return;if(o[r].find(h=>h.id===l.inReplyToId)||o[r].find(h=>h.inReplyToId===l.id)){o[r].push(l);return}}const d=n.find(r=>r.id===l.inReplyToId);d&&(o[s++]=[l,d])});for(let l=0;l<o.length;l++)for(let d=l+1;d<o.length;d++)o[l].find(h=>o[d].includes(h))&&(o[l]=[...o[l],...o[d]],o[l]=o[l].filter((h,m,f)=>f.findIndex(y=>y.id===h.id)===m),o.splice(d,1),d--);o.forEach(l=>{l.sort((d,r)=>!d.inReplyToId&&!r.inReplyToId?Date.parse(d.createdAt)-Date.parse(r.createdAt):d.inReplyToId===r.id?1:r.inReplyToId===d.id||!d.inReplyToId?-1:r.inReplyToId?Date.parse(d.createdAt)-Date.parse(r.createdAt):1)}),o.forEach(l=>{const d=l[0].account.id;l.forEach(r=>{r.account.id!==d&&(r._differentAuthor=!0)})}),o.length;const a=[],c=[],p=[];return n.forEach(l=>{if(l.reblog){a.push(l);return}for(let d=0;d<o.length;d++)if(o[d].find(r=>r.id===l.id)){if(c.includes(d))return;const r=o[d];r.sort((m,f)=>Date.parse(m.createdAt)-Date.parse(f.createdAt));const h=r[0].account.id;a.push({id:r.map(m=>m.id),items:r,type:r.every(m=>m.account.id===h)?"thread":"conversation"}),c.push(d);return}if(l.inReplyToId&&l.inReplyToAccountId!==l.account.id){const d=rt(l.id,i);E.statusReply[d]||p.push({sKey:d,inReplyToId:l.inReplyToId})}a.push(l)}),p?.length&&queueMicrotask(()=>{const{masto:l}=se({instance:i});async function d(){for(let r=0;r<p.length;r++){const{sKey:h,inReplyToId:m}=p[r];try{const f=await Vr(m,l);Je(f,i,{skipThreading:!0}),E.statusReply[h]={id:f.id,instance:i},await new Promise(y=>setTimeout(y,1e3))}catch{}}}if(Xe("@mastodon/fetch-multiple-statuses")){const r=p.map(({inReplyToId:h})=>h);(async()=>{try{const h=await l.v1.statuses.list({id:r});if(h?.length)for(const m of h){Je(m,i,{skipThreading:!0});const f=p.find(({inReplyToId:y})=>y===m.id)?.sKey;f&&(E.statusReply[f]={id:m.id,instance:i})}else d()}catch{d()}})()}else d()}),a}const Vr=yt((n,i)=>i.v1.statuses.$select(n).fetch());async function fo(n,i){const o=await Ar();if(!o.length)return;const{statusFollowedTags:s}=E,a=[];if(n.forEach(c=>{if(c.reblog)return;const{id:p,content:l,tags:d=[]}=c,r=rt(p,i);if(s[r]?.length)return;const h=Tr(l);if(!h.length&&!d.length)return;const m=o.reduce((f,y)=>((h.some(v=>v.toLowerCase()===y.name.toLowerCase())||d.some(v=>v.name.toLowerCase()===y.name.toLowerCase()))&&f.push(y.name),f),[]);m.length&&a.push({item:c,sKey:r,followedTags:m})}),a.length){const c=a.map(l=>l.item.account),p=await Kn(c);if(!p)return;a.forEach(l=>{const{item:d,sKey:r,followedTags:h}=l,m=p[d.account.id];m&&!m.following&&(s[r]=h)})}}function Gr(){E.statusFollowedTags={}}function Wr({scrollableRef:n,distanceFromStart:i=1,distanceFromEnd:o=1,scrollThresholdStart:s=10,scrollThresholdEnd:a=10,direction:c="vertical",distanceFromStartPx:p,distanceFromEndPx:l}={}){const[d,r]=R(null),[h,m]=R(!1),[f,y]=R(!1),[v,C]=R(!1),[k,b]=R(!1),g=c==="vertical";return St(()=>{const _=n.current;if(!_)return{};let w=g?_.scrollTop:_.scrollLeft;function A(){const{scrollTop:S,scrollLeft:T,scrollHeight:M,scrollWidth:L,clientHeight:H,clientWidth:F}=_,U=g?S:T,W=g?M:L,Q=g?H:F,V=Math.abs(U-w),j=p||Math.min(Q*i,W,U),K=l||Math.min(Q*o,W,W-U-Q);V>=(w<U?a:s)&&(r(w<U?"end":"start"),w=U),m(U<=0),y(U+Q>=W),C(U<=j),b(U+Q>=W-K)}return _.addEventListener("scroll",A,{passive:!0}),()=>_.removeEventListener("scroll",A)},[i,o,s,a]),{scrollDirection:d,reachStart:h,reachEnd:f,nearReachStart:v,nearReachEnd:k,init:()=>{n.current&&n.current.dispatchEvent(new Event("scroll"))}}}function Zr({scrollableRef:n,distanceFromStart:i=1,distanceFromEnd:o=1,scrollThresholdStart:s=10,scrollThresholdEnd:a=10,direction:c="vertical",distanceFromStartPx:p,distanceFromEndPx:l,init:d}={},r){if(!r)return;const h=c==="vertical",m=q(null),f=q(null),y=fa(()=>{let v=!1,C=!1,k=!1,b=!1;const g=n.current,{scrollTop:_,scrollLeft:w,scrollHeight:A,scrollWidth:S,clientHeight:T,clientWidth:M}=g,L=h?_:w,H=h?A:S,F=h?T:M,U=L-m.current,W=U>0,Q=W?a:s,V=p||Math.min(F*i,H,L),j=l||Math.min(F*o,H,H-L-F);Math.abs(U)>=Q&&(f.current=W?"end":"start",m.current=L),v=L<=0,C=L+F>=H,k=L<=V,b=L+F>=H-j,r({scrollDirection:f.current,reachStart:v,reachEnd:C,nearReachStart:k,nearReachEnd:b})},500,{leading:!1});return St(()=>{const v=n.current;return v&&(m.current=v[h?"scrollTop":"scrollLeft"],v.addEventListener("scroll",y,{passive:!0})),()=>{v&&v.removeEventListener("scroll",y)}},[]),G(()=>{d&&n.current&&queueMicrotask(()=>{n.current.dispatchEvent(new Event("scroll"))})},[d]),{resetScrollDirection:()=>{f.current=null}}}function Xr({class:n,statusID:i,status:o,instance:s,parent:a,onMediaClick:c}){const{_:p}=ce();let l=rt(i,s);const d=Ge(E);if(o||(o=d.statuses[l]||d.statuses[i],l=rt(o?.id,s)),!o)return null;const{account:{acct:r,avatar:h,avatarStatic:m,id:f,url:y,displayName:v,username:C,emojis:k,bot:b,group:g},id:_,repliesCount:w,reblogged:A,reblogsCount:S,favourited:T,favouritesCount:M,bookmarked:L,poll:H,muted:F,sensitive:U,spoilerText:W,visibility:Q,language:V,editedAt:j,filtered:K,card:pe,createdAt:$,inReplyToId:ie,inReplyToAccountId:Y,content:ee,mentions:he,mediaAttachments:re,reblog:J,uri:Ce,url:ve,emojis:ye,_deleted:Ne,_pinned:Se}=o;if(!re?.length)return null;const Ae=Ie=>{Ie.shiftKey},xe=ke(()=>vt(),[]),Pe=ke(()=>xe&&xe===f,[f,xe]),ze=Yo(Hn),Be=!Pe&&Zt(K,ze);if(Be?.action==="hide")return null;const Ye=U,Re=(yi()["reading:expand:media"]?.toLowerCase()||"default")==="show_all",O=a||"div";return re.map((Ie,Me)=>{const Ee=`${l}-${Ie.id}`,P=Be?.titlesStr;return e(O,{"data-state-post-id":l,onMouseEnter:Ae,"data-spoiler-text":W||(U?p({id:"FKojeB"}):void 0),"data-filtered-text":Be?p(P?{id:"7FGvtQ",values:{filterTitleStr:P}}:{id:"03Qqf9"}):void 0,class:`
|
||
media-post
|
||
${Be?"filtered":""}
|
||
${Ye?"has-spoiler":""}
|
||
${Re?"show-media":""}
|
||
`,children:e(Hs,{class:n,media:Ie,lang:V,to:`/${s}/s/${_}?media-only=${Me+1}`,onClick:c?be=>c(be,Me,Ie,o):void 0})},Ee)})}const gs=ot(Xr);function Jr(n){const{_:i}=ce(),o=Ge(E),{masto:s,instance:a,authenticated:c}=se(),[p,l]=ke(()=>{const _=vi();return[_.find(A=>A.info.id===vt())||_[0],_.length>1]},[]),d=(o.settings.shortcutsViewMode==="multi-column"||!o.settings.shortcutsViewMode&&o.settings.shortcutsColumnsMode)&&!o.shortcuts.find(_=>_.type==="following"),r=Os(()=>{E.showAccounts=!0},{threshold:600,detect:"touch",cancelOnMovement:!0}),h=q(),[m,f]=R(void 0),y=Fs([0,0,o.settings.shortcutsViewMode==="tab-menu-bar"?50:0,0]),v=q();async function C(_){return(_||!v.current)&&(v.current=s.v1.mutes.list({limit:80}).values()),await v.current.next()}const k=q();async function b(_){return(_||!k.current)&&(k.current=s.v1.blocks.list({limit:80}).values()),await k.current.next()}const g=q();return e(D,{children:[e("button",{ref:h,type:"button",class:`button plain nav-menu-button ${l?"with-avatar":""} ${m==="open"?"active":""}`,style:{position:"relative"},onClick:()=>{g.current=Date.now(),f(_=>_?void 0:"open")},onContextMenu:_=>{_.preventDefault(),E.showAccounts=!0},...r(),children:[l&&e(pt,{url:p?.info?.avatar||p?.info?.avatarStatic,size:"l",squircle:p?.info?.bot}),e(I,{icon:"menu",size:l?"s":"l",alt:i({id:"zucql+"})})]}),e(Ti,{menuClassName:"nav-menu",state:m,anchorRef:h,onClose:()=>{f(void 0)},containerProps:{style:{zIndex:10},onClick:()=>{Date.now()-g.current<300}},portal:{target:document.body},...n,overflow:"auto",viewScroll:"close",position:"anchor",align:"center",boundingBoxPadding:y,unmountOnClose:!0,children:[!!o.appVersion?.commitHash&&o.appVersion.commitHash!=="7d7cb91"&&e("div",{class:"top-menu",children:[e(ge,{onClick:()=>{confirm(i({id:"Djbaby"}))&&(async()=>{try{location.reload()}catch{}})()},children:[e(I,{icon:"sparkles",class:"sparkle-icon",size:"l"})," ",e("span",{children:e(u,{id:"95IFnD"})})]}),e(He,{})]}),e("section",{children:[e(Ke,{to:"/",children:[e(I,{icon:"home",size:"l"})," ",e("span",{children:e(u,{id:"i0qMbr"})})]}),c?e(D,{children:[d&&e(Ke,{to:"/following",children:[e(I,{icon:"following",size:"l"})," ",e("span",{children:e(u,{id:"following.title"})})]}),e(Ke,{to:"/catchup",children:[e(I,{icon:"history2",size:"l"}),e("span",{children:e(u,{id:"xrl8fj"})})]}),Xe("@mastodon/mentions")&&e(Ke,{to:"/mentions",children:[e(I,{icon:"at",size:"l"})," ",e("span",{children:e(u,{id:"/bZzdR"})})]}),e(Ke,{to:"/notifications",children:[e(I,{icon:"notification",size:"l"})," ",e("span",{children:e(u,{id:"iDNBZe"})}),o.notificationsShowNew&&e("sup",{title:i({id:"isRobC"}),style:{opacity:.5},children:[" ","•"]})]}),e(He,{}),p?.info?.id&&e(Ke,{to:`/${a}/a/${p.info.id}`,children:[e(I,{icon:"user",size:"l"})," ",e("span",{children:e(u,{id:"vERlcd"})})]}),e(Qr,{menuState:m}),e(Ke,{to:"/b",children:[e(I,{icon:"bookmark",size:"l"})," ",e("span",{children:e(u,{id:"7Ff7ia"})})]}),e(hn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(D,{children:[e(I,{icon:"more",size:"l"}),e("span",{class:"menu-grow",children:e(u,{id:"24misb"})}),e(I,{icon:"chevron-right"})]}),children:[e(Ke,{to:"/f",children:[e(I,{icon:"heart",size:"l"})," ",e("span",{children:e(u,{id:"zZOZj7"})})]}),e(Ke,{to:"/fh",children:[e(I,{icon:"hashtag",size:"l"})," ",e("span",{children:e(u,{id:"Xi1/bw"})})]}),e(Ke,{to:"/sp",children:[e(I,{icon:"schedule",size:"l"})," ",e("span",{children:e(u,{id:"+GkIdc"})})]}),e(He,{}),Xe("@mastodon/filters")&&e(Ke,{to:"/ft",children:[e(I,{icon:"filters",size:"l"})," ",e("span",{children:e(u,{id:"cSev+j"})})]}),e(ge,{onClick:()=>{E.showGenericAccounts={id:"mute",heading:i({id:"sOKhEA"}),fetchAccounts:C,excludeRelationshipAttrs:["muting"]}},children:[e(I,{icon:"mute",size:"l"})," ",e("span",{children:e(u,{id:"n1sANU"})})]}),e(ge,{onClick:()=>{E.showGenericAccounts={id:"block",heading:i({id:"nL8nlr"}),fetchAccounts:b,excludeRelationshipAttrs:["blocking"]}},children:[e(I,{icon:"block",size:"l"})," ",e("span",{children:e(u,{id:"r3RRWo"})})]})," "]}),e(He,{}),e(ge,{onClick:()=>{E.showAccounts=!0},children:[e(I,{icon:"group",size:"l"})," ",e("span",{children:e(u,{id:"7e0O8Z"})})]})]}):e(D,{children:[e(He,{}),e(Ke,{to:"/login",children:[e(I,{icon:"user",size:"l"})," ",e("span",{children:e(u,{id:"sQia9P"})})]})]})]}),e("section",{children:[e(He,{}),e(Ke,{to:"/search",children:[e(I,{icon:"search",size:"l"})," ",e("span",{children:e(u,{id:"A1taO8"})})]}),e(Ke,{to:`/${a}/trending`,children:[e(I,{icon:"chart",size:"l"})," ",e("span",{children:e(u,{id:"4/iCqx"})})]}),e(Ke,{to:`/${a}/p/l`,children:[e(I,{icon:"building",size:"l"})," ",e("span",{children:e(u,{id:"d5zxa4"})})]}),e(Ke,{to:`/${a}/p`,children:[e(I,{icon:"earth",size:"l"})," ",e("span",{children:e(u,{id:"4ERYY7"})})]}),c?e(D,{children:[e(He,{className:"divider-grow"}),e(ge,{onClick:()=>{E.showKeyboardShortcutsHelp=!0},children:[e(I,{icon:"keyboard",size:"l"})," ",e("span",{children:e(u,{id:"77Emn0"})})]}),e(ge,{onClick:()=>{E.showShortcutsSettings=!0},children:[e(I,{icon:"shortcut",size:"l"})," ",e("span",{children:e(u,{id:"8Kudkr"})})]}),e(ge,{onClick:()=>{E.showSettings=!0},children:[e(I,{icon:"gear",size:"l"})," ",e("span",{children:e(u,{id:"uVbUP8"})})]})]}):e(D,{children:[e(He,{}),e(ge,{onClick:()=>{E.showSettings=!0},children:[e(I,{icon:"gear",size:"l"})," ",e("span",{children:e(u,{id:"uVbUP8"})})]})]})]})]})]})}function Qr({menuState:n}){const i=Xe("@mastodon/lists"),[o,s]=R([]);return G(()=>{i&&n==="open"&&pn().then(s)},[n,i]),o.length>0?e(hn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(D,{children:[e(I,{icon:"list",size:"l"}),e("span",{class:"menu-grow",children:e(u,{id:"h16FyT"})}),e(I,{icon:"chevron-right"})]}),children:[e(Ke,{to:"/l",children:e("span",{children:e(u,{id:"BHWx+g"})})}),o?.length>0&&e(D,{children:[e(He,{}),o.map(a=>e(Ke,{to:`/l/${a.id}`,children:e("span",{children:[a.title,a.exclusive&&e(D,{children:[" ",e(Kt,{})]})]})},a.id))]})]}):i&&e(Ke,{to:"/l",children:[e(I,{icon:"list",size:"l"}),e("span",{children:e(u,{id:"h16FyT"})})]})}const Pt=ot(Jr),vn={block:"start",inline:"center",behavior:"smooth"};function Et({title:n,titleComponent:i,id:o,instance:s,emptyText:a,errorText:c,useItemID:p,boostsCarousel:l,fetchItems:d=()=>{},checkForUpdates:r=()=>{},checkForUpdatesInterval:h=15e3,headerStart:m,headerEnd:f,timelineStart:y,refresh:v,view:C,filterContext:k,showFollowedTags:b,showReplyParent:g,clearWhenRefresh:_}){const{_:w}=ce(),A=Ge(E),[S,T]=R([]),[M,L]=R("start"),[H,F]=R(!1),[U,W]=R(!1),[Q,V]=R(!0),j=q();__BENCHMARK.start(`timeline-${o}-load`);const K=ke(()=>Ci(),[]),pe=C!=="media",$=q(0),ie=ma(oe=>{W(!1),L("loading"),(async()=>{try{const Le=$.current=Date.now();let{done:Re,value:O}=await d(oe);if(Le!==$.current)return;if(Array.isArray(O)){const[Ie,Me]=O.reduce((Ee,P)=>(P._pinned?Ee[0].push(P):Ee[1].push(P),Ee),[[],[]]);O=Me,pe&&(l&&(O=jr(O)),O=Yr(O,s)),Ie.length&&(O=Ie.concat(O)),T(oe?O:Ee=>[...Ee,...O]),O.length||(Re=!0),F(!Re)}else F(!1);L("default"),__BENCHMARK.end(`timeline-${o}-load`)}catch{L("error"),oe&&!S.length&&c&&le(c)}finally{ie.cancel()}})()},1e3,{leading:!0}),Y=".timeline-item, .timeline-item-alt",ee=Fe("j, shift+j",(oe,Le)=>{if(oe.shiftKey!==Le.shift)return;const Re=document.activeElement.closest(Y),O=Re?.getBoundingClientRect(),Ie=Array.from(j.current.querySelectorAll(Y)).filter(Me=>!!Me.offsetHeight);if(Re&&O.top<j.current.clientHeight&&O.bottom>0){const Me=Ie.indexOf(Re);let Ee=Ie[Me+1];Le.shift&&(Ee=Ie.find((P,be)=>be>Me&&!P.classList.contains("timeline-item-alt"))),Ee&&(Ee.focus(),Ee.scrollIntoView(vn))}else{const Me=Ie.find(Ee=>{const P=Ee.getBoundingClientRect();return P.top>=44&&P.left>=0});Me&&(Me.focus(),Me.scrollIntoView(vn))}},{useKey:!0,ignoreEventWhen:oe=>oe.metaKey||oe.ctrlKey||oe.altKey}),he=Fe("k, shift+k",(oe,Le)=>{if(oe.shiftKey!==Le.shift)return;const Re=document.activeElement.closest(Y),O=Re?.getBoundingClientRect(),Ie=Array.from(j.current.querySelectorAll(Y)).filter(Me=>!!Me.offsetHeight);if(Re&&O.top<j.current.clientHeight&&O.bottom>0){const Me=Ie.indexOf(Re);let Ee=Ie[Me-1];Le.shift&&(Ee=Ie.findLast((P,be)=>be<Me&&!P.classList.contains("timeline-item-alt"))),Ee&&(Ee.focus(),Ee.scrollIntoView(vn))}else{const Me=Ie.find(Ee=>{const P=Ee.getBoundingClientRect();return P.top>=44&&P.left>=0});Me&&(Me.focus(),Me.scrollIntoView(vn))}},{useKey:!0,ignoreEventWhen:oe=>oe.metaKey||oe.ctrlKey||oe.altKey}),re=Fe(["enter","o"],()=>{const oe=document.activeElement;oe?.matches(Y)&&oe.click()},{useKey:!0,ignoreEventWhen:oe=>oe.metaKey||oe.ctrlKey||oe.altKey||oe.shiftKey}),J=S.length>0&&M!=="loading"&&U,Ce=tt(()=>{J&&ie(!0),j.current?.scrollTo({top:0,behavior:"smooth"})},[ie,J]),ve=Fe(".",Ce,{useKey:!0,ignoreEventWhen:oe=>oe.metaKey||oe.ctrlKey||oe.altKey||oe.shiftKey}),ye=q(),[Ne,Se]=R(!1),Ae=tt(({scrollDirection:oe,nearReachStart:Le,reachStart:Re})=>{if(ye.current){const O=oe==="end"&&!Le;ye.current.hidden=O}Se(Le),Re&&ie(!0)},[Se,ie]),{resetScrollDirection:xe}=Zr({scrollableRef:j,distanceFromEnd:2,scrollThresholdStart:44},Ae);G(()=>{j.current?.scrollTo({top:0}),ie(!0)},[]);const Pe=q(!0);G(()=>{if(Pe.current){Pe.current=!1;return}_&&S?.length&&(ie.cancel?.(),T([])),ie(!0)},[_,v]);const ze=q(C);G(()=>{ze.current!==C&&(ze.current=C,T([]))},[C]);const Be=tt(async({disableIdleCheck:oe=!1}={})=>{const Le=j.current?getComputedStyle(j.current).pointerEvents==="none":!1;A.settings.autoRefresh&&j.current.scrollTop<16&&(oe||window.__IDLE__)&&!il()&&!Le?ie(!0):await r()&&W(!0)},[o,ie,r,A.settings.autoRefresh]),Ye=q();return Xt(oe=>{if(oe){const Le=Date.now()-Ye.current;(!Ye.current||Le>1e3*3)&&Be({disableIdleCheck:!0})}else Ye.current=Date.now();V(oe)},[r,Be,A.settings.autoRefresh]),Ai(Be,Q&&!U?h*(Ne?1:2):null),e(Hn.Provider,{value:k,children:e("div",{id:`${o}-page`,class:`deck-container ${K?"deck-container-media-first":""}`,ref:oe=>{j.current=oe,ee.current=oe,he.current=oe,re.current=oe,ve.current=oe},tabIndex:"-1",onClick:oe=>{ye.current&&oe.target.closest(".timeline-item, .timeline-item-alt")&&setTimeout(()=>{ye.current.hidden=!1,xe()},250)},children:e("div",{class:"timeline-deck deck",children:[e("header",{ref:ye,onClick:oe=>{oe.target.closest("a, button")||j.current?.scrollTo({top:0,behavior:"smooth"})},onDblClick:oe=>{oe.target.closest("a, button")||ie(!0)},class:M==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Pt,{}),m??e(fe,{to:"/",class:"button plain home-button",children:e(I,{icon:"home",size:"l",alt:w({id:"i0qMbr"})})})]}),n&&(i||e("h1",{children:n})),e("div",{class:"header-side",children:!!f&&f})]}),J&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:Ce,children:[e(I,{icon:"arrow-up"})," ",e(u,{id:"2yr1/p"})]})]}),!!y&&e("div",{class:`timeline-start ${M==="loading"?"loading":""}`,children:y}),S.length?e(D,{children:[e("ul",{class:`timeline ${C?`timeline-${C}`:""}`,children:[S.map(oe=>e(el,{status:oe,instance:s,useItemID:p,filterContext:k,view:C,showFollowedTags:b,showReplyParent:g,mediaFirst:K},oe.id+oe?._pinned+C)),H&&M==="loading"&&(C==="media"?null:e(D,{children:[e("li",{style:{height:"20vh"},children:e(je,{skeleton:!0,mediaFirst:K})}),e("li",{style:{height:"25vh"},children:e(je,{skeleton:!0,mediaFirst:K})})]}))]}),M==="default"&&(H?e(Tt,{root:j.current,rootMargin:`0px 0px ${screen.height*1.5}px 0px`,onChange:oe=>{oe&&ie()},children:e("button",{type:"button",class:"plain block",onClick:()=>ie(),style:{marginBlockEnd:"6em"},children:e(u,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(u,{id:"2EYeAZ"})}))]}):M==="loading"?e("ul",{class:"timeline",children:Array.from({length:5}).map((oe,Le)=>C==="media"?e("div",{style:{height:"50vh"}}):e("li",{children:e(je,{skeleton:!0,mediaFirst:K})},Le))}):M!=="error"&&M!=="start"&&e("p",{class:"ui-state",children:a}),M==="error"&&e("p",{class:"ui-state",children:[c,e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>ie(!S.length),children:e(u,{id:"KDw4GX"})})]})]})})})}const el=ot(({status:n,instance:i,useItemID:o,filterContext:s,view:a,showFollowedTags:c,showReplyParent:p,mediaFirst:l})=>{const{_:d}=ce(),{id:r,reblog:h,items:m,type:f,_pinned:y}=n;y&&(o=!1);const v=h?.id||r,C=i?`/${i}/s/${v}`:`/s/${v}`;if(m){let b=qt(m,s),g="";if(f==="boosts"?g=ue._({id:"NuqppG",values:{0:b.length}}):f==="pinned"&&(g=d({id:"GlfmCu"})),f==="boosts"||f==="pinned"){const A=new Set;if(b.sort((S,T)=>{const M=Zt(S.filtered,s),L=Zt(T.filtered,s);return M&&M?.action!=="blur"&&A.add(S.id),L&&L?.action!=="blur"&&A.add(T.id),M&&!L?1:!M&&L?-1:0}),A.size>=2){const T=[],M=[];b.forEach(H=>{A.has(H.id)?M.push(H):T.push(H)});const L=[];for(let H=0;H<M.length;H+=5)L.push({_grouped:!0,posts:M.slice(H,H+5)});b=T.concat(L)}return e("li",{class:"timeline-item-carousel",children:e(tl,{title:g,class:`${f}-carousel`,children:b.map(S=>{const{id:T,reblog:M,_pinned:L,_grouped:H}=S;if(H)return e("li",{class:"timeline-item-carousel-group",children:S.posts.map(W=>{const{id:Q,reblog:V,_pinned:j}=W,K=V?.id||Q,pe=i?`/${i}/s/${K}`:`/s/${K}`;return j&&(o=!1),e(fe,{class:"status-carousel-link timeline-item-alt",to:pe,children:o?e(je,{statusID:Q,instance:i,size:"s"}):e(je,{status:W,instance:i,size:"s"})})})},T);const F=M?.id||T,U=i?`/${i}/s/${F}`:`/s/${F}`;return L&&(o=!1),e("li",{children:e(fe,{class:"status-carousel-link timeline-item-alt",to:U,children:o?e(je,{statusID:T,instance:i,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:l}):e(je,{status:S,instance:i,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:l})})},T)})})},`timeline-${r}`)}const w=b.length>3;return b.map((A,S)=>{const{id:T,_differentAuthor:M}=A,L=i?`/${i}/s/${T}`:`/s/${T}`,H=S>0&&S<b.length-1,F=A.sensitive&&!!A.spoilerText,U=!M&&F&&S>0||w&&H&&(f==="thread"||f==="conversation"&&!M&&!b[S-1]._differentAuthor&&!b[S+1]._differentAuthor),W=S===0,Q=S===b.length-1;return e("li",{class:`timeline-item-container timeline-item-container-type-${f} timeline-item-container-${W?"start":Q?"end":"middle"} ${M?"timeline-item-diff-author":""}`,children:e(fe,{class:"status-link timeline-item",to:L,children:U?e(nl,{status:A,instance:i,filterContext:s}):o?e(je,{statusID:T,instance:i,enableCommentHint:Q,showFollowedTags:c}):e(je,{status:A,instance:i,enableCommentHint:Q,showFollowedTags:c})})},`timeline-${T}`)})}const k=`timeline-${r+y}`;return a==="media"?o?e(gs,{class:"timeline-item",parent:"li",statusID:r,instance:i},k):e(gs,{class:"timeline-item",parent:"li",status:n,instance:i},k):e("li",{children:e(fe,{class:"status-link timeline-item",to:C,children:o?e(je,{statusID:r,instance:i,enableCommentHint:!0,showFollowedTags:c,showReplyParent:p,mediaFirst:l}):e(je,{status:n,instance:i,enableCommentHint:!0,showFollowedTags:c,showReplyParent:p,mediaFirst:l})})},k)},(n,i)=>{const o=(n.status?.id||"").toString(),s=(i.status?.id||"").toString();return o===s&&n.instance===i.instance&&n.view===i.view});function tl({title:n,class:i,children:o}){const{_:s}=ce(),a=q(),c=q(),p=q(),[l,d]=R(!1);return G(()=>{setTimeout(()=>{d(!0)},1)},[]),e("div",{class:`status-carousel ${i}`,children:[e("header",{children:[e("h3",{children:n}),e("span",{children:[e("button",{ref:c,type:"button",class:"small plain2",onClick:()=>{const r=Math.min(320,a.current?.offsetWidth)*(zt()?1:-1);a.current?.scrollBy({left:r,behavior:"smooth"})},children:e(I,{icon:"chevron-left",alt:s({id:"DHhJ7s"})})})," ",e("button",{ref:p,type:"button",class:"small plain2",onClick:()=>{const r=Math.min(320,a.current?.offsetWidth)*(zt()?-1:1);a.current?.scrollBy({left:r,behavior:"smooth"})},children:e(I,{icon:"chevron-right",alt:s({id:"hXzOVo"})})})]})]}),e("ul",{ref:a,children:[e(Tt,{class:"status-carousel-beacon",onChange:r=>{c.current&&(c.current.disabled=r)}}),o[0],l&&o.slice(1),e(Tt,{class:"status-carousel-beacon",onChange:r=>{p.current&&(p.current.disabled=r)}})]})]})}function nl({status:n,instance:i,filterContext:o}){const{_:s}=ce(),a=Ge(E),{id:c,visibility:p,language:l}=n,d=Un(n),r=rt(c,i),h=Zt(n.filtered,o);return e("article",{class:`status compact-thread ${p==="direct"?"visibility-direct":""}`,tabindex:"-1",children:[e("div",{class:"status-thread-badge-container",children:e(ga,{index:a.statusThreadNumber[r]})}),e("div",{class:"content-compact",title:d,lang:l,dir:"auto",children:h&&h?.action!=="blur"?e("b",{class:"status-filtered-badge badge-meta horizontal",title:h?.titlesStr||"",children:h?.titlesStr?e(u,{id:"sr6maL",values:{0:h.titlesStr},components:{0:e("span",{}),1:e("span",{})}}):e("span",{children:e(u,{id:"03Qqf9"})})}):e(D,{children:[d,n.sensitive&&n.spoilerText&&e(D,{children:[" ",e("span",{class:"spoiler-badge",children:e(I,{icon:"eye-close",size:"s",alt:s({id:"gnKo7f"})})})]})]})})]})}function il(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}const Vt=20,Ui=1983,vs=`${Ui}-01`,sl=_i(()=>{try{const n=document.createElement("input");return n.setAttribute("type","month"),n.type==="month"}catch{return!1}});async function ol(n){const{masto:i}=se({instance:n});return!!(await i.v2.search.list({q:"from:me",type:"statuses",limit:1}))?.statuses?.length}const al=yt(ol);function cl(){const{i18n:n,_:i}=ce(),o=Ge(E),{id:s,...a}=Nt(),[c,p]=bt(),l=c.get("month"),d=!c.get("replies"),r=!!c.get("boosts"),h=c.get("tagged"),m=!!c.get("media"),{masto:f,instance:y,authenticated:v}=se({instance:a.instance}),{masto:C,instance:k}=se(),b=q(),g=[l,d,r,h,m],[_,w]=R(),A=q(0);G(()=>{A.current=0},g);const S=ke(()=>Ci(),[]),T=ke(()=>y===k,[y,k]),[M,L]=R(!1);G(()=>{T&&_?.acct&&(async()=>{const re=await al(y);L(re)})()},[y,T,_?.acct]);async function H(re){const J=/^\d{4}-[01]\d$/.test(l),Ce=l?.split?.("-")?.[0]>=Ui;if(J&&Ce){if(!_)return{value:[],done:!0};const[Se,Ae]=l.split("-"),xe=parseInt(Ae,10)-1,Pe=new Date(Se,xe,0),ze=`${Pe.getFullYear()}-${(Pe.getMonth()+1).toString().padStart(2,"0")}-${Pe.getDate().toString().padStart(2,"0")}`,Be=new Date(Se,xe+1,1),Ye=`${Be.getFullYear()}-${(Be.getMonth()+1).toString().padStart(2,"0")}-${Be.getDate().toString().padStart(2,"0")}`;let oe;re?(oe=Vt+1,A.current=0):(oe=Vt+A.current+1,A.current+=Vt);const Le=await f.v2.search.list({q:`from:${_.acct} after:${ze} before:${Ye}`,type:"statuses",limit:oe,offset:A.current});if(Le?.statuses?.length){const Re=Le.statuses.slice(0,Vt);Re.forEach(Ie=>{Je(Ie,y)});const O=Le.statuses.length<=Vt;return{value:Re,done:O}}else return{value:[],done:!0}}let ve=[];if(re){const{value:Se}=await f.v1.accounts.$select(s).statuses.list({pinned:!0}).values().next();if(Se?.length&&!h&&!m){const Ae=Se.map(xe=>(Je(xe,y),{...xe,_pinned:!0}));if(Ae.length>=3){const xe=Ae.map(Pe=>Pe.id);ve.push({id:xe,items:Ae,type:"pinned"})}else ve.push(...Ae)}}(re||!b.current)&&(b.current=f.v1.accounts.$select(s).statuses.list({limit:Vt,exclude_replies:d,exclude_reblogs:r,only_media:m||void 0,tagged:h}).values());const{value:ye,done:Ne}=await b.current.next();if(ye?.length){if(!Xe("@mastodon/pinned-posts")&&ve.length){let Se=[];ve[0]?.type==="pinned"?Se=ve[0].id:Se=ve.filter(xe=>xe._pinned).map(xe=>xe.id),Se.every(xe=>ye.some(Pe=>Pe.id===xe))&&(ve=[])}ve.push(...ye),ye.forEach(Se=>{Je(Se,y)})}return{value:ve,done:Ne}}const[F,U]=R([]);let W=i({id:"/cKnpj"});if(_?.acct){const re=(/@/.test(_.acct)?"":"@")+_.acct,J=_?.displayName?`${_.displayName} (${re})`:`${re}`;if(!d)W=i({id:"hS1Opy",values:{accountDisplay:J}});else if(r)W=i({id:"A/CX5F",values:{accountDisplay:J}});else if(h)W=i({id:"QQrO94",values:{accountDisplay:J,tagged:h}});else if(m)W=i({id:"NoG5wD",values:{accountDisplay:J}});else if(l){const Ce=new Date(l).toLocaleString(n.locale,{month:"long",year:"numeric"});W=i({id:"8GjLvB",values:{accountDisplay:J,monthYear:Ce}})}else W=J}Qe(W,"/:instance?/a/:id");const Q=tt(()=>dl(s,f),[s,f]);G(()=>{(async()=>{try{const re=await Q();w(re)}catch{}if(!S)try{const re=await f.v1.accounts.$select(s).featuredTags.list();U(re)}catch{}})()},[s,S]);const{displayName:V,acct:j,emojis:K}=_||{},pe=ke(()=>_?.id===vt(),[_?.id]),$=q(),ie=ke(()=>{const re=!d||r||h||m||!!l,J=o.accounts[`${s}@${y}`];return e(D,{children:[e(co,{instance:y,account:J||s,fetchAccount:Q,authenticated:v,standalone:!0,showEndorsements:!0}),!S&&e("div",{class:"filter-bar",ref:$,style:{position:"relative"},children:[re?e(fe,{to:`/${y}/a/${s}`,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(fe,{to:`/${y}/a/${s}${d?"?replies=1":""}`,onClick:()=>{d&&le(i({id:"PIWNSQ"}))},class:d?"":"is-active",children:e(u,{id:"5BFynH"})}),e(fe,{to:`/${y}/a/${s}${r?"":"?boosts=0"}`,onClick:()=>{r||le(i({id:"Qd13i0"}))},class:r?"is-active":"",children:e(u,{id:"usxQx0"})}),e(fe,{to:`/${y}/a/${s}${m?"":"?media=1"}`,onClick:()=>{m||le(i({id:"rKpfPY"}))},class:m?"is-active":"",children:e(u,{id:"xYilR2"})}),F.map(Ce=>e(fe,{to:`/${y}/a/${s}${h===Ce.name?"":`?tagged=${encodeURIComponent(Ce.name)}`}`,onClick:()=>{h!==Ce.name&&le(i({id:"L+HFfr",values:{0:Ce.name}}))},class:h===Ce.name?"is-active":"",children:e("span",{children:[e("span",{class:"more-insignificant",children:"#"}),Ce.name]})},Ce.id)),M&&(sl()?e("label",{class:`filter-field ${l?"is-active":""}`,children:[e(I,{icon:"month",size:"l"}),e("input",{type:"month",disabled:!_?.acct,value:l||"",min:vs,max:new Date().toISOString().slice(0,7),onInput:Ce=>{const{value:ve,validity:ye}=Ce.currentTarget;if(!ye.valid)return;p(ve?{month:ve}:{});const[Ne,Se]=ve.split("-"),Ae=parseInt(Se,10)-1,xe=new Date(Ne,Ae);le(i({id:"0WUFGD",values:{0:xe.toLocaleString(n.locale,{month:"long",year:"numeric"})}}))}})]}):e(rl,{class:`filter-field ${l?"is-active":""}`,disabled:!_?.acct,value:l||"",min:vs,max:new Date().toISOString().slice(0,7),onInput:Ce=>{const{value:ve,validity:ye}=Ce;ye.valid&&p(ve?{month:ve}:{})}}))]})]})},[s,y,v,F,Q,M,...g]);G(()=>{const re=$.current?.querySelector(".is-active");re&&$.current.scrollTo({behavior:"smooth",left:re.offsetLeft-($.current.offsetWidth-re.offsetWidth)/2})},[F,M,...g]);const Y=ke(()=>_?.url?URL.parse(_.url)?.hostname:null,[_]),he=!!_&&!(y===Y);return e(D,{children:[e(Et,{title:`${_?.acct?"@"+_.acct:i({id:"+owNNn"})}`,titleComponent:e("h1",{class:"header-double-lines header-account",children:[e("b",{children:e(Ks,{text:V,emojis:K,resolverURL:_?.url})}),e("div",{children:e("span",{class:"bidi-isolate",children:["@",j]})})]}),id:"account-statuses",instance:y,emptyText:i({id:"+k97fV"}),errorText:i({id:"scd9lw"}),fetchItems:H,useItemID:!0,view:m||S?"media":void 0,boostsCarousel:o.settings.boostsCarousel,timelineStart:ie,refresh:[d,r,h,m,l+_?.acct].toString(),headerEnd:e(lt,{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(ge,{disabled:!he,onClick:()=>{(async()=>{try{const{masto:re}=se({instance:Y}),J=await re.v1.accounts.lookup({acct:_.acct}),{id:Ce}=J;location.hash=`/${Y}/a/${Ce}`}catch{alert(i({id:"FgdLx0"}))}})()},children:[e(I,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:e(u,{id:"/JFxxT",values:{0:Y?e(D,{children:[" ","(",e("b",{children:qn.toUnicode(Y)}),")"]}):null}})})]}),!T&&e(ge,{onClick:()=>{(async()=>{try{const re=await C.v1.accounts.lookup({acct:_.acct+"@"+y}),{id:J}=re;location.hash=`/${k}/a/${J}`}catch{alert(i({id:"FgdLx0"}))}})()},children:[e(I,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:e(u,{id:"HkuyOu",values:{currentInstance:k},components:{0:e("b",{})}})})]})]})},s),j&&!pe&&e("data",{class:"compose-data",value:JSON.stringify({draftStatus:{status:`@${j} `}})})]})}function rl(n){const{i18n:i}=ce(),{class:o,disabled:s,value:a,min:c,max:p,onInput:l=()=>{}}=n,[d,r]=a?.split("-")||[],h=q(),m=q(),f=(y,v)=>{const[C,k]=c?.split("-")||[],[b,g]=p?.split("-")||[];return!(v<C||v>b||v===C&&y<k||v===b&&y>g)};return e("div",{class:o,children:[e(I,{icon:"month",size:"l"}),e("select",{ref:h,disabled:s,value:r||"",onInput:y=>{const{value:v}=y.currentTarget,C=m.current.value;if(!f(v,C))return{value:"",validity:{valid:!1}};l({value:v?`${C}-${v}`:"",validity:{valid:!0}})},children:[e("option",{value:"",children:e(u,{id:"HajiZl"})}),e("option",{disabled:!0,children:"-----"}),Array.from({length:12},(y,v)=>e("option",{value:(v+1).toString().padStart(2,"0"),children:new Date(0,v).toLocaleString(i.locale,{month:"long"})},v))]})," ",e("input",{ref:m,type:"number",disabled:s,value:d||new Date().getFullYear(),min:c?.slice(0,4)||Ui,max:p?.slice(0,4)||new Date().getFullYear(),onInput:y=>{const{value:v,validity:C}=y.currentTarget,k=h.current.value;if(!C.valid||!f(k,v))return{value:"",validity:{valid:!1}};l({value:v?`${v}-${k}`:"",validity:{valid:!0}})},style:{width:"4.5em"}})]})}function ll(n,i){return i.v1.accounts.$select(n).fetch()}const dl=yt(ll,{maxAge:30*60*1e3});function ul(){const n=Nt(),{year:i}=n;Qe(i?`Annual Report: ${i}`:"Annual Report");const{masto:o,instance:s}=se(),[a,c]=R(null),[p,l]=R("default");G(()=>{i&&(async()=>{l("loading");const y=await o.v1.annualReports.$select(i).fetch();c(y),l("default")})()},[i]);const{accounts:d,annualReports:r,statuses:h}=a||{},m=r?.find(y=>y.year==i)?.data,f=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"]}),p==="loading"&&e("p",{children:[e(Oe,{abrupt:!0})," ",e(u,{id:"Pwqkdw"})]}),!!m&&e("dl",{children:Object.entries(m).map(([y,v])=>e(D,{children:[e("dt",{children:y}),e("dd",{class:`report-${y}`,children:Array.isArray(v)?e("table",{children:[e("thead",{children:e("tr",{children:Object.entries(v[0]).map(([C,k])=>e("th",{class:C!=="month"&&typeof k=="number"?"number":"",children:C}))})}),e("tbody",{children:v.map(C=>e("tr",{children:Object.entries(C).map(([k,b])=>e("td",{class:k!=="month"&&typeof b=="number"?"number":"",children:b&&/(accountId)/i.test(k)&&/^(mostRebloggedAccounts|commonlyInteractedWithAccounts)$/i.test(y)?e(mt,{account:d?.find(g=>g.id===b),showAvatar:!0}):k==="month"?f.setMonth(b-1)&&f.toLocaleString(void 0,{month:"long"}):typeof b=="number"?b.toLocaleString():b}))}))})]}):typeof v=="object"?/^(topStatuses)$/i.test(y)?e("dl",{children:Object.entries(v).map(([C,k])=>e(D,{children:[e("dt",{children:C}),e("dd",{children:k&&e(fe,{to:`/${s}/s/${k}`,children:e(je,{status:h?.find(b=>b.id===k),size:"s",readOnly:!0})})})]}))}):e("table",{children:e("tbody",{children:Object.entries(v).map(([C,k])=>e("tr",{children:[e("th",{children:C}),e("td",{class:typeof k=="number"?"number":"",children:k})]}))})}):typeof v=="string"?v:JSON.stringify(v,null,2)})]}))})]}),e("hr",{}),e("p",{style:{textAlign:"center"},children:e(fe,{to:"/",children:e(u,{id:"iWpEwy"})})})]})}const hl=20;function mo(){const{_:n}=ce();Qe(n({id:"7Ff7ia"}),"/b");const{masto:i,instance:o}=se(),s=q();async function a(c){return(c||!s.current)&&(s.current=i.v1.bookmarks.list({limit:hl}).values()),await s.current.next()}return e(Et,{title:n({id:"7Ff7ia"}),id:"bookmarks",emptyText:n({id:"8k2w6G"}),errorText:n({id:"UoL+FC"}),instance:o,fetchItems:a})}const pl=""+new URL("catch-up-O5q5C75Z.png",import.meta.url).href,fl="home",dt=[{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}],ml={original:{id:"HxF6Fk"},replies:{id:"N8UzTV"},boosts:{id:"puY2t0"},quotes:{id:"eWLklq"},followedTags:{id:"lCLRBe"},groups:{id:"zhrjek"},filtered:{id:"03Qqf9"}},gl=["createdAt","repliesCount","favouritesCount","reblogsCount","density"],vl=[null,"account"],yl=_i(n=>new Intl.DateTimeFormat(n||void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"}));function Bn(n){return n?.id||n?.quotedStatus?.id}function bl(){const{i18n:n,_:i,_:o}=ce(),s=yl(n.locale);Qe("Catch-up","/catchup");const{masto:a,instance:c}=se(),[p,l]=bt(),d=p.get("id"),[r,h]=R("start"),[m,f]=R(!1),y=ke(()=>vt(),[]),v=x=>x===y,C=Xe("@pixelfed/home-include-reblogs");async function k({maxCreatedAt:x}){const B=[],Z=a.v1.timelines.home.list({limit:40}),ne=Z.values();e:for(;;)try{C&&Z.params&&(typeof Z.params=="string"?Z.params+="&include_reblogs=true":Z.params.include_reblogs=!0);const z=await ne.next(),{value:de}=z;if(de?.length){await fo(de,c);let _e=!1;for(let me=0;me<de.length;me++){const X=de[me],te=Date.parse(X.createdAt);if(!x||te>=x){const $e=!v(X.reblog?.account?.id||X.account.id)&&Zt(X.reblog?.filtered||X.filtered,fl);if($e?.action==="hide")continue;X._filtered=$e;const Ve=rt(X.id,c);X._followedTags=E.statusFollowedTags[Ve]?[...E.statusFollowedTags[Ve]]:[],B.push(X),_e=!0}if(!_e)break e}}else break e;await new Promise(_e=>setTimeout(_e,1e3))}catch{break e}return B.forEach(z=>{if(z?.inReplyToId){const de=B.find(_e=>_e.id===z.inReplyToId);de&&!de.inReplyToId&&(de._thread=!0)}}),B}const[b,g]=R([]),_=q(),w=q(),A=ke(()=>$n(),[]),S=tt(async({duration:x}={})=>{const B=Date.now(),Z=x?B-x:null;h("loading");const ne=await k({maxCreatedAt:Z}),z=`${A}-${va()}`;try{await gt.catchup.set(z,{id:z,posts:ne,count:ne.length,startAt:Z,endAt:B}),l({id:z})}catch{}},[]);G(()=>{d?(async()=>{const x=await gt.catchup.get(d);x&&(x.posts.sort((B,Z)=>B.createdAt>Z.createdAt?1:-1),g(x.posts),h("results"))})():r==="results"&&(g([]),h("start"))},[d]);const[T,M]=xt(x=>x+1,0),[L,H]=R(null),[F,U]=R([]);G(()=>{(async()=>{try{const x=await gt.catchup.keys();if(x.length){const B=$n(),Z=x.filter(ne=>ne.startsWith(`${B}-`));if(Z.length){let ne=await gt.catchup.getMany(Z);ne.sort((me,X)=>X.endAt-me.endAt);let z=ne.slice(0,3),de=ne.slice(3);const _e=z.map(me=>{const{id:X,count:te,startAt:we,endAt:$e}=me;return{id:X,count:te,startAt:we,endAt:$e}});U(_e),H(z[0].endAt),ne=null,z=null,queueMicrotask(()=>{de.length&>.catchup.delMany(de.map(me=>me.id)).then(()=>{de=null}).catch(me=>{})});return}}}catch{}U([])})()},[T]),G(()=>{r==="start"&&M()},[r==="start"]);const[W,Q]=ke(()=>{let x=0,B=0,Z=0,ne=0,z=0,de=0,_e=0;const me={};for(const te of b){te._filtered&&te._filtered?.action!=="blur"?(x++,te.__FILTER="filtered"):te.group?(B++,te.__FILTER="groups"):te.reblog?(Z++,te.__FILTER="boosts"):Bt()&&Bn(te.quote)?(ne++,te.__FILTER="quotes"):te._followedTags?.length?(de++,te.__FILTER="followedTags"):te.inReplyToId&&te.inReplyToAccountId!==te.account?.id?(z++,te.__FILTER="replies"):(_e++,te.__FILTER="original");const we=te.reblog||te;if(te.__FILTER!=="filtered"&&we.card?.url&&we.card?.image&&we.card?.type==="link"){const{card:$e,favouritesCount:Ve,reblogsCount:at}=we;let{url:et}=$e;if(et=et.replace(/\/$/,""),!me[et])me[et]={postID:we.id,card:$e,shared:1,sharers:[te.account],likes:Ve,boosts:at};else{if(me[et].sharers.find(wt=>wt.id===te.account.id))continue;me[et].shared++,me[et].sharers.push(te.account),me[et].postID!==we.id&&(me[et].likes+=Ve,me[et].boosts+=at)}}}let X=[];for(const te in me)X.push({url:te,...me[te]});if(X.sort((te,we)=>te.shared>we.shared?-1:te.shared<we.shared?1:te.boosts>we.boosts?-1:te.boosts<we.boosts?1:te.likes>we.likes?-1:te.likes<we.likes?1:te.quotes>we.quotes?-1:te.quotes<we.quotes?1:0),X.length>10)e:for(let te=10;te<X.length;te++){const{shared:we}=X[te];if(we<=1){X=X.slice(0,te);break e}}return[{filtered:x,groups:B,boosts:Z,quotes:ne,replies:z,followedTags:de,original:_e},X]},[b]),[V,j]=R("all"),[K,pe]=R(null),[$,ie]=R(1),[Y,ee]=R("createdAt"),[he,re]=R("asc"),[J,Ce]=R(null),[ve,ye,Ne]=ke(()=>{const x={},B=new Map;let Z=b.filter(z=>{const de=V==="all"||z.__FILTER===V;return de&&(x[z.account.id]=z.account,B.set(z.account.id,(B.get(z.account.id)||0)+1)),de});const ne={};return Z.forEach(z=>{z.reblog&&(ne[z.reblog.id]?(ne[z.reblog.id].__BOOSTERS?ne[z.reblog.id].__BOOSTERS.add(z.account):ne[z.reblog.id].__BOOSTERS=new Set([z.account]),z.__HIDDEN=!0):ne[z.reblog.id]=z)}),K&&B.has(K)&&(Z=Z.filter(z=>z.account.id===K||[...z.__BOOSTERS||[]].find(de=>de.id===K))),[Z,x,Object.fromEntries(B)]},[V,K,b]),Se=ke(()=>{const x={};return ve.forEach(B=>{x[B.id]=B}),x},[ve]),Ae=ke(()=>Object.keys(Ne).sort((x,B)=>Ne[B]-Ne[x]),[Ne]),xe=ke(()=>{const x={};return Ae.forEach((B,Z)=>{x[B]=Z}),ve.filter(B=>!B.__HIDDEN).sort((B,Z)=>{if(J==="account"){const ne=B.account.id,z=Z.account.id,de=x[ne],_e=x[z],me=de-_e;if(me!==0)return me}if(Y!=="createdAt"&&(B=B.reblog||B,Z=Z.reblog||Z,Y!=="density"&&B[Y]===Z[Y]))return B.createdAt>Z.createdAt?1:-1;if(Y==="density"){const ne=ys(B),z=ys(Z);return he==="asc"?ne>z?1:-1:z>ne?1:-1}return he==="asc"?B[Y]>Z[Y]?1:-1:Z[Y]>B[Y]?1:-1})},[ve,Y,he,J,Ae]),Pe=q(null),ze=q(null),Be=q(!1);G(()=>{b.length>100||Be.current||ze.current&&(eo(ze.current,{duration:200}),Be.current=!0)},[b,ze]);const Ye=b.length>160?"3d":"2d",oe=ke(()=>Ye!=="2d"?null:b.map(x=>{const B=Se[x.id];return e("span",{class:`post-dot ${B?"post-dot-highlight":""}`},x.id)}),[Se]),Le=ke(()=>Ye!=="3d"||!b?.length?null:Al(b,"createdAt",320).map((B,Z)=>e("div",{class:"posts-bin",children:B.map(ne=>{const z=Se[ne.id];return e("span",{class:`post-dot ${z?"post-dot-highlight":""}`},ne.id)})},Z)),[Se]),Re=q(null),O=ke(()=>L?(Date.now()-L)/1e3/60/60:null,[L,$]);G(()=>{if(r!=="results")return;const x=K&&ye[K]?ye[K].username:"",B=he==="asc"?0:1,Z={account:"authors"};let ne=le({duration:5e3,text:o({id:"XKZRZ/",values:{selectedFilterCategory:V,sortBy:Y,sortOrder:he,groupBy:J}})});return()=>{ne?.hideToast?.()}},[r,V,K,Y,he,J,ye]),G(()=>{if(K&&ye[K]){const x=ze.current.querySelector(`[data-author="${K}"]`),B=ze.current?.getBoundingClientRect(),Z=x?.getBoundingClientRect();Z.left<B.left||Z.right>B.right?x.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}):Z.top<0&&x.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})}},[K,ye]);const[Ie,Me]=R(!1),Ee=".catchup-list > li > a",P=Fe("j",()=>{const x=document.activeElement.closest(Ee),B=x?.getBoundingClientRect(),Z=Array.from(Re.current.querySelectorAll(Ee));if(x&&B.top<Re.current.clientHeight&&B.bottom>0){const ne=Z.indexOf(x),z=Z[ne+1];z&&(z.focus(),z.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const ne=Z.find(z=>z.getBoundingClientRect().top>=0);ne&&(ne.focus(),ne.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{useKey:!0,preventDefault:!0,ignoreEventWhen:x=>x.metaKey||x.ctrlKey||x.altKey||x.shiftKey}),be=Fe("k",()=>{const x=document.activeElement.closest(Ee),B=x?.getBoundingClientRect(),Z=Array.from(Re.current.querySelectorAll(Ee));if(x&&B.top<Re.current.clientHeight&&B.bottom>0){const ne=Z.indexOf(x);let z=Z[ne-1];z&&(z.focus(),z.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const ne=Z.find(z=>{const de=z.getBoundingClientRect();return de.top>=44&&de.left>=0});ne&&(ne.focus(),ne.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{useKey:!0,preventDefault:!0,ignoreEventWhen:x=>x.metaKey||x.ctrlKey||x.altKey||x.shiftKey}),qe=Fe("h, l",(x,B)=>{const Z=B.keys[0];if(K){const ne=Ae.indexOf(K);Z==="h"?ne>0&&ne<Ae.length&&(pe(Ae[ne-1]),Re.current?.focus()):Z==="l"&&ne<Ae.length-1&&ne>=0&&(pe(Ae[ne+1]),Re.current?.focus())}else Z==="l"&&(pe(Ae[0]),Re.current?.focus())},{useKey:!0,preventDefault:!0,ignoreEventWhen:x=>x.metaKey||x.ctrlKey||x.altKey||x.shiftKey,enableOnFormTags:["input"]}),De=Fe("esc",()=>{pe(null),Re.current?.focus()},{preventDefault:!0,ignoreEventWhen:x=>x.metaKey||x.ctrlKey||x.altKey||x.shiftKey,enableOnFormTags:["input"],useKey:!0}),N=Fe(".",()=>{Re.current?.scrollTo({top:0,behavior:"smooth"})},{useKey:!0,preventDefault:!0,ignoreEventWhen:x=>x.metaKey||x.ctrlKey||x.altKey||x.shiftKey,enableOnFormTags:["input"]}),ae=tt(x=>{const B=document.activeElement,Z=B?.tagName==="INPUT"&&B.type==="radio";if((x.key==="ArrowDown"||x.key==="ArrowUp"||x.key==="ArrowLeft"||x.key==="ArrowRight")&&Z){B.blur();return}},[]);return e("div",{ref:x=>{Re.current=x,P.current=x,be.current=x,qe.current=x,De.current=x,N.current=x},id:"catchup-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck wide",children:[e("header",{class:`${r==="loading"?"loading":""}`,onClick:x=>{x.target.closest("a, button")||Re.current?.scrollTo({top:0,behavior:"smooth"})},children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Pt,{}),r==="results"&&e(fe,{to:"/catchup",class:"button plain",children:e(I,{icon:"history2",size:"l",alt:o({id:"xrl8fj"})})}),r==="start"&&e(fe,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l",alt:o({id:"i0qMbr"})})})]}),e("h1",{children:r!=="start"&&e(u,{id:"wyL/3/",components:{0:e("sup",{})}})}),e("div",{class:"header-side",children:r!=="start"&&r!=="loading"&&e("button",{type:"button",class:"plain",onClick:()=>{Me(!0)},children:e(u,{id:"c3XJ18"})})})]})}),e("main",{onKeyDown:ae,children:[r==="start"&&e("div",{class:"catchup-start",children:[e("h1",{children:e(u,{id:"wyL/3/",components:{0:e("sup",{})}})}),e("details",{children:[e("summary",{children:e(u,{id:"CxKPv6"})}),e("p",{children:e(u,{id:"YMU1CK"})}),e("img",{src:pl,width:"1200",height:"900",alt:o({id:"CeInO2"})}),e("p",{children:e("button",{type:"button",onClick:x=>{x.target.closest("details").open=!1},children:e(u,{id:"2jI8hh"})})})]}),e("p",{children:e(u,{id:"1RfGk7"})}),e("p",{children:e("b",{children:e(u,{id:"OOEonE"})})}),e("div",{class:"catchup-form",children:[e("input",{ref:_,type:"range",value:$,min:dt[0].value,max:dt[dt.length-1].value,step:"1",list:"catchup-ranges",onChange:x=>ie(+x.target.value)})," ",e("span",{style:{width:"8em"},children:[i(dt[$-1].label),e("br",{}),e("small",{class:"insignificant",children:$==dt[dt.length-1].value?o({id:"NMNiaO"}):st(new Date(Date.now()-$*60*60*1e3))})]}),e("datalist",{id:"catchup-ranges",children:dt.map(({label:x,value:B})=>e("option",{value:B,label:i(x)}))})," ",e("button",{type:"button",onClick:()=>{if($<dt[dt.length-1].value){let x;$===dt[dt.length-1].value&&w.current?.checked?x=Date.now()-L:x=$*60*60*1e3,S({duration:x})}else S()},children:e(u,{id:"R0yu2l"})})]}),O&&$>O?e("p",{class:"catchup-info",children:[e(I,{icon:"info"})," ",e(u,{id:"AGyV7s"})]}):$===dt[dt.length-1].value&&L?e("p",{class:"catchup-info",children:e("label",{children:[e("input",{type:"checkbox",switch:!0,checked:!0,ref:w})," ",e(u,{id:"dDJEHI",values:{0:s.format(new Date(L))}})]})}):null,e("p",{class:"insignificant",children:e("small",{children:e(u,{id:"EAjFM0"})})}),!!F?.length&&e("div",{class:"catchup-prev",children:[e("p",{children:e(u,{id:"Yfb9A8"})}),e("ul",{children:F.map(x=>e("li",{children:[e(fe,{to:`/catchup?id=${x.id}`,children:[e(I,{icon:"history2"})," ",e("span",{children:x.startAt?s.formatRange(new Date(x.startAt),new Date(x.endAt)):`… – ${s.format(new Date(x.endAt))}`})]})," ",e("span",{children:[e("small",{class:"ib insignificant",children:e(u,{id:"S6XZwv",values:{0:x.count}})})," ",e("button",{type:"button",class:"light danger small",onClick:async()=>{if(confirm(o({id:"D9CmP2"}))){let Z=le(o({id:"xJUo4P",values:{0:x.id}}));await gt.catchup.del(x.id),Z?.hideToast?.(),le(o({id:"1dyGG/",values:{0:x.id}})),M()}},children:e(I,{icon:"x",alt:o({id:"t/YqKh"})})})]})]},x.id))}),F.length>=3&&e("p",{children:e("small",{children:e(u,{id:"sXmrl4"})})})]})]}),r==="loading"&&e("div",{class:"ui-state catchup-start",children:[e(Oe,{abrupt:!0}),e("p",{class:"insignificant",children:e(u,{id:"rbUTzD"})}),e("p",{class:"insignificant",children:e(u,{id:"q9urQO"})})]}),r==="results"&&e(D,{children:[e("div",{class:"catchup-header",children:[b.length>0&&e("p",{children:e("b",{class:"ib",children:s.formatRange(new Date(b[0].createdAt),new Date(b[b.length-1].createdAt))})}),e("aside",{children:[e("button",{hidden:V==="all"&&!K&&Y==="createdAt"&&he==="asc",type:"button",class:"plain4 small",onClick:()=>{j("all"),pe(null),ee("createdAt"),Ce(null),re("asc")},children:e(u,{id:"I9EnzM"})}),Q?.length>0&&e("button",{type:"button",class:"plain small",onClick:()=>f(!m),children:[e(u,{id:"EIZREX"})," ",e(I,{icon:"chevron-down",style:{transform:m?"rotate(180deg)":"rotate(0deg)"}})]})]})]}),e("div",{class:"shazam-container no-animation",hidden:!m,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"catchup-top-links links-bar",children:Q.map(x=>{const{card:B,shared:Z,sharers:ne,likes:z,boosts:de}=x,{blurhash:_e,title:me,description:X,url:te,image:we,imageDescription:$e,language:Ve,width:at,height:et,publishedAt:wt}=B,Rt=wi(te);let fn;if(_e){const mn=xi(_e),gn=qi(mn);fn=Bi([.6,gn[1],gn[2]])}return e("a",{href:te,target:"_blank",rel:"noopener",class:"link-block",style:fn?{"--accent-color":`rgb(${fn.join(",")})`,"--accent-alpha-color":`rgba(${fn.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:we,alt:$e,width:at,height:et,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:Rt})," ",!!wt&&e(D,{children:"· "}),!!wt&&e(D,{children:e(Ct,{datetime:wt,format:"micro"})})]}),!!me&&e("h1",{class:"title",lang:Ve,dir:"auto",title:me,children:me})]}),!!X&&e("p",{class:"description",lang:Ve,dir:"auto",title:X,children:X}),e("hr",{}),e("p",{style:{whiteSpace:"nowrap"},children:e(u,{id:"bfSr6z",values:{0:ne.map(mn=>{const{avatarStatic:gn,displayName:Po}=mn;return e("button",{type:"button",class:"plain",style:{padding:0},onClick:Hi=>{Hi.preventDefault(),Hi.stopPropagation();const{id:Do}=mn;pe(Do),j("all")},children:e(pt,{url:gn,size:"s",alt:Po})})})}})})]})]})},te)})})})}),b.length>=5&&(Ye==="3d"?e("div",{class:"catchup-posts-viz-time-bar",children:Le}):e("div",{class:"catchup-posts-viz-bar",children:oe})),b.length>=2&&e("div",{class:"catchup-filters",children:[e("label",{class:"filter-cat",children:[e("input",{type:"radio",name:"filter-cat",checked:V.toLowerCase()==="all",onChange:()=>{j("all")}}),e(u,{id:"N40H+G"})," ",e("span",{class:"count",children:b.length})]}),Object.entries(ml).map(([x,B])=>!!W[x]&&e("label",{class:"filter-cat",title:(W[x]/b.length*100).toFixed(2)+"%",children:[e("input",{type:"radio",name:"filter-cat",checked:V.toLowerCase()===x.toLowerCase(),onChange:()=>{j(x),x==="boosts"&&(ee("reblogsCount"),re("desc"),Ce(null))}}),i(B)," ",e("span",{class:"count",children:W[x]})]},i(B)))]}),b.length>=2&&!!Ne&&e("div",{class:"catchup-filters authors-filters",ref:ze,children:[Ae.map(x=>e("label",{class:"filter-author","data-author":x,children:[e("input",{type:"radio",name:"filter-author",checked:K===x,onChange:()=>{pe(x)},onClick:()=>{K===x&&pe(null)}}),e(pt,{url:ye[x].avatarStatic||ye[x].avatar,size:"xxl",alt:`${ye[x].displayName} (@${ye[x].acct})`})," ",e("span",{class:"count",children:Ne[x]}),e("span",{class:"username",children:ye[x].username})]},`${x}-${Ne[x]}`)),Ae.length>5&&e("small",{style:{whiteSpace:"nowrap",paddingInline:"1em",opacity:.33},children:e(u,{id:"HHtYi7",values:{0:Ae.length}})},"authors-count")]}),b.length>=2&&e("div",{class:"catchup-filters",children:[e("span",{class:"filter-label",children:e(u,{id:"f6Hub0"})})," ",e("fieldset",{class:"radio-field-group",children:gl.map(x=>e("label",{class:"filter-sort",onClick:B=>{Y===x&&(B.preventDefault(),B.stopPropagation(),re(he==="asc"?"desc":"asc"))},children:[e("input",{type:"radio",name:"filter-sort-cat",checked:Y===x,onChange:()=>{ee(x);const B=/(replies|favourites|reblogs|quotes)/.test(x)?"desc":"asc";re(B)}}),{createdAt:o({id:"mYGY3B"}),repliesCount:o({id:"N8UzTV"}),favouritesCount:o({id:"zZOZj7"}),reblogsCount:o({id:"puY2t0"}),quotesCount:o({id:"eWLklq"}),density:o({id:"0tQ7AD"})}[x],Y===x&&(he==="asc"?" ↑":" ↓")]},x))}),e("span",{class:"filter-label",children:e(u,{id:"group.filter"})})," ",e("fieldset",{class:"radio-field-group",children:vl.map(x=>e("label",{class:"filter-group",children:[e("input",{type:"radio",name:"filter-group",checked:J===x,onChange:()=>{Ce(x)},disabled:x==="account"&&K}),{account:o({id:"dpqPBg"})}[x]||o({id:"EdQY6l"})]},x||"none"))}),K&&Ae.length>1?e("button",{type:"button",class:"plain6 small",onClick:()=>{pe(null)},style:{whiteSpace:"nowrap"},children:e(u,{id:"/dlmrZ"})}):null]}),e("ul",{class:`catchup-list catchup-filter-${V||""} ${Y?`catchup-sort-${Y}`:""} ${K&&ye[K]?"catchup-selected-author":""} ${J?`catchup-group-${J}`:""}`,children:xe.map((x,B)=>{const Z=x.reblog?.id||x.id;let ne=!1;return J==="account"&&(Pe.current&&x.account.id!==Pe.current&&B>0&&(ne=!0),Pe.current=x.account.id),e(D,{children:[ne&&e("li",{class:"separator"}),e(kl,{to:`/${c}/s/${Z}`,post:x,root:Re.current})]},`${x.id}-${ne}`)})}),e("footer",{children:ve.length>5&&e("p",{children:[o(V==="boosts"?{id:"eVosYr"}:{id:"rhmyFK"})," ",e("button",{type:"button",class:"textual",onClick:()=>{Re.current.scrollTop=0},children:e(u,{id:"0MgdN+"})}),"."]})})]})]})]}),Ie&&e(Ue,{onClose:()=>Me(!1),children:e("div",{class:"sheet",id:"catchup-help-sheet",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>Me(!1),children:e(I,{icon:"x",alt:o({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{id:"c3XJ18"})})}),e("main",{children:e("dl",{children:[e("dt",{children:e(u,{id:"EIZREX"})}),e("dd",{children:e(u,{id:"YmGrIy"})}),e("dt",{children:e(u,{id:"coaNtr"})}),e("dd",{children:e(u,{id:"UUrqX1"})}),e("dt",{children:e(u,{id:"ScQBC/"})}),e("dd",{children:e(u,{id:"srocAr"})}),e("dt",{children:e(u,{id:"77Emn0"})}),e("dd",{children:e("table",{children:e("tbody",{children:[e("tr",{children:[e("td",{children:e(u,{id:"Gy9P9T"})}),e("td",{children:e("kbd",{children:"j"})})]}),e("tr",{children:[e("td",{children:e(u,{id:"6XYpYY"})}),e("td",{children:e("kbd",{children:"k"})})]}),e("tr",{children:[e("td",{children:e(u,{id:"f5dduh"})}),e("td",{children:e("kbd",{children:"l"})})]}),e("tr",{children:[e("td",{children:e(u,{id:"rj0vxZ"})}),e("td",{children:e("kbd",{children:"h"})})]}),e("tr",{children:[e("td",{children:e(u,{id:"jsFF8C"})}),e("td",{children:e("kbd",{children:"Enter"})})]}),e("tr",{children:[e("td",{children:e(u,{id:"bUUv3P"})}),e("td",{children:e("kbd",{children:"."})})]})]})})})]})})]})})]})}const wl=ot(function({post:n}){const{id:i,account:o,group:s,reblog:a,quote:c,inReplyToId:p,inReplyToAccountId:l,_followedTags:d,_filtered:r,visibility:h,__BOOSTERS:m}=n,f=p&&l!==o.id,y=!!r&&r?.action!=="blur",v=C=>{C.shiftKey};return e("article",{class:`post-line ${s?"group":a?"reblog":Bt()&&Bn(c)?"quote":d?.length?"followed-tags":""} ${f?"reply-to":""} ${y?"filtered":""} visibility-${h}`,onMouseEnter:v,children:[e("span",{class:"post-author",children:a?e("span",{class:"post-reblog-avatar",children:[e(pt,{url:o.avatarStatic||o.avatar,squircle:o.bot}),m?.size>0?[...m].map(C=>e(pt,{url:C.avatarStatic||C.avatar,squircle:C.bot})):""," ",e(I,{icon:"rocket"})," ",e(mt,{account:a.account,showAvatar:!0})]}):Bn(c)?e("span",{class:"post-quote-avatar",children:[e(pt,{url:o.avatarStatic||o.avatar,squircle:o.bot})," ",e(I,{icon:"quote"})," ",e(mt,{account:c.quotedStatus?.account||c.account,showAvatar:!0})]}):e(mt,{account:o,showAvatar:!0})}),e(_l,{post:a||n,filterInfo:r}),e("span",{class:"post-meta",children:[e(Il,{post:a||n})," ",e(Ct,{datetime:new Date(a?.createdAt||n.createdAt),format:"micro"})]})]})},(n,i)=>n?.post?.id===i?.post?.id),kl=({root:n,to:i,...o})=>{const s=q(),[a,c]=R(!1);return G(()=>{const p=new IntersectionObserver(l=>{l[0].isIntersecting&&(queueMicrotask(()=>c(!0)),p.unobserve(s.current))},{root:n,rootMargin:`${Math.max(320,screen.height*.75)}px`});return s.current&&p.observe(s.current),()=>{s.current&&p.unobserve(s.current)}},[]),a?e("li",{children:e(fe,{to:i,children:e(wl,{...o})})}):e("li",{ref:s,style:{height:"4em"}})},Sl=8,Cl=8;function ys(n){const{spoilerText:i,content:o,poll:s,mediaAttachments:a,card:c}=n,p=s?.options?.length?s.options.reduce((d,r)=>d+r.title,""):"";return(i.length+js(o)+p.length)/140+(a?.length?Sl*a.length:c?.image?Cl:0)}const Lt=48;function _l({post:n,filterInfo:i}){const{_:o}=ce();let{spoilerText:s,sensitive:a,content:c,emojis:p,poll:l,mediaAttachments:d,card:r,inReplyToId:h,inReplyToAccountId:m,account:f,_thread:y,quote:v}=n;const C=h&&m===f.id||!!y;let k=Bt()&&Bn(v)?v.quotedStatus||v:null;(k?.spoilerText||k?.sensitive)&&(k=null),k?.emojis&&p.push(...k.emojis),!d?.length&&k?.mediaAttachments?.length&&(d=k.mediaAttachments);const g=!!yi()["reading:expand:spoilers"],_=g||!s&&!a&&i?.action!=="blur",w=c?Un(n):"",A=!s||g;return e("div",{class:"post-peek",title:s?"":w,children:[e("span",{class:"post-peek-content",children:[C&&!A&&e(D,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:"Thread"})," "]}),i&&i?.action!=="blur"?e("span",{class:"post-peek-filtered",children:i?.titlesStr?o({id:"suKjh3",values:{0:i.titlesStr}}):o({id:"03Qqf9"})}):e(D,{children:[!!s&&e("span",{class:"post-peek-spoiler",children:[e(I,{icon:`${g?"eye-open":"eye-close"}`})," ",s]}),A&&e("div",{class:"post-peek-html",children:[C&&e(D,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:e(u,{id:"e66y2Z"})})," "]}),!!c&&e("div",{dangerouslySetInnerHTML:{__html:ya(c,p)+(k?.content?`<blockquote class="post-peek-quote">${k.content}</blockquote>`:"")}}),!!l?.options?.length&&l.options.map(S=>e("div",{children:[l.multiple?"▪️":"•"," ",S.title]})),!c&&d?.length===1&&d[0].description&&e(D,{children:[e("span",{class:"post-peek-tag post-peek-alt",children:"ALT"})," ",e("div",{children:d[0].description})]})]})]})]}),(!i||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(u,{id:"4WUbF1"})]}),d?.length?d.map(S=>{const T=S.previewUrl||S.url,M=S.previewRemoteUrl||S.remoteUrl,L=S.meta?.original?S.meta.original.width:S.meta?.small?.width||S.meta?.original?.width,H=S.meta?.original?S.meta.original.height:S.meta?.small?.height||S.meta?.original?.height;return e("span",{class:"post-peek-media",children:{image:(T||M)&&_?e("img",{src:T,width:Lt,height:Lt,alt:S.description,loading:"lazy",onError:F=>{const{src:U}=F.target;U===T&&(F.target.src=M)},style:{"--anim-duration":`${Math.min(Math.max(Math.max(L,H)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"🖼"}),gifv:(T||M)&&_?e("img",{src:T,width:Lt,height:Lt,alt:S.description,loading:"lazy",onError:F=>{const{src:U}=F.target;U===T&&(F.target.src=M)}}):e("span",{class:"post-peek-faux-media",children:"🎞️"}),video:(T||M)&&_?e("img",{src:T,width:Lt,height:Lt,alt:S.description,loading:"lazy",onError:F=>{const{src:U}=F.target;U===T&&(F.target.src=M)}}):e("span",{class:"post-peek-faux-media",children:"📹"}),audio:e("span",{class:"post-peek-faux-media",children:"🎵"})}[S.type]||null},S.id)}):!!r&&r.image&&_&&e("span",{class:`post-peek-media post-peek-card card-${r.type||""}`,children:r.image?e("img",{src:r.image,width:Lt,height:Lt,alt:r.title||r.description||r.imageDescription,loading:"lazy",style:{"--anim-duration":r.width&&r.height&&`${Math.min(Math.max(Math.max(r.width,r.height)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"🔗"})})]})]})}function Il({post:n}){const{_:i}=ce(),{reblogsCount:o,repliesCount:s,favouritesCount:a,quotesCount:c}=n;return e("span",{class:"post-stats",children:[s>0&&e("span",{class:"post-stat-replies",children:[e(I,{icon:"comment2",size:"s",alt:i({id:"N8UzTV"})})," ",We(s)]}),a>0&&e("span",{class:"post-stat-likes",children:[e(I,{icon:"heart",size:"s",alt:i({id:"zZOZj7"})})," ",We(a)]}),o>0||c>0?e("span",{class:"post-stat-boosts",children:[e(I,{icon:"rocket",size:"s",alt:i({id:"puY2t0"})})," ",o>0||c>0?`${o>0?We(o):""}${o>0&&c>0?"+":""}${c>0?We(c):""}`:We(o)]}):null]})}function Al(n,i,o){const s=n.map(d=>new Date(d[i])),a=s.reduce((d,r)=>r<d?r:d,s[0]),c=s.reduce((d,r)=>r>d?r:d,s[0]),p=Math.min(c.getTime(),Date.now())-a.getTime(),l=Array.from({length:o},()=>[]);return n.forEach(d=>{const r=Date.parse(d[i]);if(r>Date.now())l[l.length-1].push(d);else{const h=(r-a.getTime())/p,m=Math.floor(h*(o-1));l[m].push(d)}}),l}const Tl=20;function go(){const{_:n}=ce();Qe(n({id:"zZOZj7"}),"/favourites");const{masto:i,instance:o}=se(),s=q();async function a(c){return(c||!s.current)&&(s.current=i.v1.favourites.list({limit:Tl}).values()),await s.current.next()}return e(Et,{title:n({id:"zZOZj7"}),id:"favourites",emptyText:n({id:"PHIrMr"}),errorText:n({id:"khVljG"}),instance:o,fetchItems:a})}const xl=["home","public","notifications","thread","account"],bs=["thread","account"],El={home:{id:"Buy2bt"},notifications:{id:"iDNBZe"},public:{id:"RO10dm"},thread:{id:"EnJuK0"},account:{id:"vrQQgz"}},Rl=[0,30*60,60*60,6*60*60,12*60*60,60*60*24,60*60*24*7,60*60*24*30],ci={0:{id:"qqeAJM"},1800:it(30,"minute"),3600:it(1,"hour"),21600:it(6,"hour"),43200:it(12,"hour"),86400:it(24,"hour"),604800:it(7,"day"),2592e3:it(30,"day")};function Ll(){const{_:n}=ce(),{masto:i}=se();Qe(n({id:"cSev+j"}),"/ft");const[o,s]=R("default"),[a,c]=R(!1),[p,l]=xt(h=>h+1,0),[d,r]=R([]);return G(()=>{s("loading"),(async()=>{try{const h=await i.v2.filters.list();h.sort((m,f)=>m.title.localeCompare(f.title)),h.forEach(m=>{m.keywords?.length&&m.keywords.sort((f,y)=>f.id-y.id)}),r(h),s("default")}catch{s("error")}})()},[p]),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(Pt,{}),e(fe,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l",alt:n({id:"i0qMbr"})})})]}),e("h1",{children:e(u,{id:"cSev+j"})}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{c(!0)},children:e(I,{icon:"plus",size:"l",alt:n({id:"yFfBdX"})})})})]})}),e("main",{children:d.length>0?e(D,{children:[e("ul",{class:"filters-list",children:d.map(h=>{const{id:m,title:f,expiresAt:y,keywords:v}=h;return e("li",{children:[e("div",{children:[e("h2",{children:f}),v?.length>0&&e("div",{children:v.map(C=>e(D,{children:[e("span",{class:"tag collapsed insignificant",children:C.wholeWord?`“${C.keyword}”`:C.keyword})," "]}))}),e("small",{class:"insignificant",children:e(vo,{expiresAt:y})})]}),e("button",{type:"button",class:"plain",onClick:()=>{c({filter:h})},children:e(I,{icon:"pencil",size:"l",alt:"Edit filter"})})]},m)})}),d.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(u,{id:"5vzJxv",values:{0:d.length}})})})]}):o==="loading"?e("p",{class:"ui-state",children:e(Oe,{})}):o==="error"?e("p",{class:"ui-state",children:e(u,{id:"qcAUwp"})}):e("p",{class:"ui-state",children:e(u,{id:"cWIHTt"})})})]}),!!a&&e(Ue,{title:n({id:"vCSBPD"}),onClose:()=>{c(!1)},children:e(Nl,{filter:a?.filter,onClose:h=>{h.state==="success"&&l(),c(!1)}})})]})}let Ml=1;const $l=()=>Ml++;function Nl({filter:n,onClose:i}){const{_:o,_:s}=ce(),{masto:a}=se(),[c,p]=R("default"),l=!!n,{context:d,expiresAt:r,id:h,keywords:m,title:f,filterAction:y}=n||{},v=!!r,C=v&&new Date(r),[k,b]=R(m||[]),g=q(),[_,w]=R([]),[A,S]=R([]),T=k.filter(M=>!_.includes(M.id)&&!A.includes(M._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:s({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:s(l?{id:"3mOee6"}:{id:"yFfBdX"})})}),e("main",{children:e("form",{onSubmit:M=>{M.preventDefault();const L=new FormData(M.target),H=L.get("title"),F=L.getAll("keyword_attributes[][id]"),U=L.getAll("keyword_attributes[][keyword]"),W=[...g.current.querySelectorAll('input[name="keyword_attributes[][whole_word]"]')].map(pe=>pe.checked),Q=U.map((pe,$)=>({id:F[$]||void 0,keyword:pe,wholeWord:W[$]}));l&&_?.length&&_.forEach(pe=>{Q.push({id:pe,_destroy:!0})});const V=L.getAll("context");let j=L.get("expires_in");const K=L.get("filter_action");!H||!V?.length||(p("loading"),(async()=>{try{let pe;l?(j===""||j===null?v?j=Math.floor((C-Date.now())/1e3):j=null:j==="0"||j===0?j=null:j=+j,pe=await a.v2.filters.$select(h).update({title:H,context:V,expiresIn:j,keywordsAttributes:Q,filterAction:K})):(j=+j||null,pe=await a.v2.filters.create({title:H,context:V,expiresIn:j,keywordsAttributes:Q,filterAction:K})),p("default"),i?.({state:"success",filter:pe})}catch{p("error"),alert(s(l?{id:"H8RP+h"}:{id:"Fr0hAN"}))}})())},children:[e("div",{class:"filter-form-row",children:e("label",{children:[e("b",{children:e(u,{id:"MHrjPM"})}),e("input",{type:"text",name:"title",defaultValue:f,disabled:c==="loading",dir:"auto",required:!0})]})}),e("div",{class:"filter-form-keywords",ref:g,children:[T.length?e("ul",{class:"filter-keywords",children:T.map(M=>{const{id:L,keyword:H,wholeWord:F,_id:U}=M;return e("li",{children:[e("input",{type:"hidden",name:"keyword_attributes[][id]",value:L}),e("input",{name:"keyword_attributes[][keyword]",type:"text",defaultValue:H,disabled:c==="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:L,defaultChecked:F,disabled:c==="loading"})," ",e(u,{id:"/7UQ7y"})]}),e("button",{type:"button",class:"light danger small",disabled:c==="loading",onClick:()=>{L?(_.push(L),w([..._])):U&&(A.push(U),S([...A]))},children:e(I,{icon:"x",alt:s({id:"t/YqKh"})})})]})]},`${L}-${U}`)})}):e("div",{class:"filter-keywords",children:e("div",{class:"insignificant",children:e(u,{id:"SYKm3p"})})}),e("footer",{class:"filter-keywords-footer",children:[e("button",{type:"button",class:"light",onClick:()=>{b([...k,{_id:$l(),keyword:"",wholeWord:!0}]),setTimeout(()=>{const M=g.current.querySelectorAll('input[type="text"]');M[M.length-1]?.focus?.()},10)},children:e(u,{id:"qn5Dbn"})})," ",T?.length>1&&e("small",{class:"insignificant",children:e(u,{id:"1JZ175",values:{0:T.length}})})]})]}),e("div",{class:"filter-form-cols",children:[e("div",{class:"filter-form-col",children:[e("div",{children:e("b",{children:e(u,{id:"uqf7Yq"})})}),xl.map(M=>e("div",{children:[e("label",{class:bs.includes(M)?"insignificant":"",children:[e("input",{type:"checkbox",name:"context",value:M,defaultChecked:d?d.includes(M):!0,disabled:c==="loading"})," ",o(El[M]),bs.includes(M)?"*":""]})," "]})),e("p",{children:e("small",{class:"insignificant",children:e(u,{id:"m0G499"})})})]}),e("div",{class:"filter-form-col",children:[l&&e(u,{id:"ucJk3m",components:{0:e("b",{}),1:e(vo,{expiresAt:r,showNeverExpires:!0})}}),e("div",{children:[e("label",{for:"filters-expires_in",children:s(l?{id:"BcNdg+"}:{id:"agO/T/"})}),e("select",{id:"filters-expires_in",name:"expires_in",disabled:c==="loading",defaultValue:l?void 0:0,children:[l&&e("option",{}),Rl.map(M=>e("option",{value:M,children:typeof ci[M]=="function"?ci[M]():o(ci[M])}))]})]}),e("p",{children:[e(u,{id:"blQMpa"}),e("br",{}),bi()?.mastodon>=5&&e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"blur",defaultChecked:y==="blur",disabled:c==="loading"})," ",e(u,{id:"ggxOw9"})]})," ",e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"warn",defaultChecked:y!=="hide"&&y!=="blur"||!l,disabled:c==="loading"})," ",e(u,{id:"jbreWy"})]})," ",e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"hide",defaultChecked:y==="hide",disabled:c==="loading"})," ",e(u,{id:"zNCBmf"})]})]})]})]}),e("footer",{class:"filter-form-footer",children:[e("span",{children:[e("button",{type:"submit",disabled:c==="loading",children:s(l?{id:"tfDRzk"}:{id:"hYgDIe"})})," ",e(Oe,{abrupt:!0,hidden:c!=="loading"})]}),l&&e(ft,{disabled:c==="loading",align:"end",menuItemClassName:"danger",confirmLabel:s({id:"BPjyR2"}),onClick:()=>{p("loading"),(async()=>{try{await a.v2.filters.$select(h).remove(),p("default"),i?.({state:"success"})}catch{p("error"),alert(s({id:"4Dh9J1"}))}})()},children:e("button",{type:"button",class:"light danger",onClick:()=>{},disabled:c==="loading",children:e(u,{id:"Jb6/SB"})})})]})]})})]})}function vo({expiresAt:n,showNeverExpires:i}){const{_:o}=ce(),s=!!n,a=s&&new Date(n),c=s&&Date.parse(n)<=Date.now(),[p,l]=xt(d=>d+1,0);return Ai(l,c||3e4),c?o({id:"M1RnFv"}):s?e(u,{id:"urGtsw",components:{0:e(Ct,{datetime:a})}}):i&&o({id:"O1Aswy"})}function Pl(){const{_:n}=ce(),{masto:i,instance:o}=se();Qe(n({id:"Xi1/bw"}),"/fh");const[s,a]=R("default"),[c,p]=R([]);return G(()=>{a("loading"),(async()=>{try{const l=await zn();p(l),a("default")}catch{a("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(Pt,{}),e(fe,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l",alt:n({id:"i0qMbr"})})})]}),e("h1",{children:e(u,{id:"Xi1/bw"})}),e("div",{class:"header-side"})]})}),e("main",{children:c.length>0?e(D,{children:[e("ul",{class:"link-list",children:c.map(l=>e("li",{children:e(fe,{to:o?`/${o}/t/${l.name}`:`/t/${l.name}`,children:[e(I,{icon:"hashtag",alt:"#"})," ",e("span",{children:l.name})]})}))}),c.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(u,{id:"2S/uvJ",values:{0:c.length}})})})]}):s==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):s==="error"?e("p",{class:"ui-state",children:e(u,{id:"2AeREO"})}):e("p",{class:"ui-state",children:e(u,{id:"vKsGhk"})})})]})})}const Dl=20;function Ki({title:n,path:i,id:o,...s}){const{_:a}=ce();Qe(n||a({id:"following.title"}),i||"/following");const{masto:c,streaming:p,instance:l,client:d}=se(),[r,h]=R(p),m=Ge(E),f=q(),y=q(),v=q();G(()=>{!p&&d?.onStreamingReady&&d.onStreamingReady(g=>{h(g)})},[d]),__BENCHMARK.end("time-to-following");const C=Xe("@pixelfed/home-include-reblogs");async function k(g){(g||!y.current)&&(__BENCHMARK.start("fetch-home-first"),f.current=c.v1.timelines.home.list({limit:Dl}),y.current=f.current.values()),C&&f.current?.params&&(typeof f.current.params=="string"?f.current.params+="&include_reblogs=true":f.current.params.include_reblogs=!0);const _=await y.current.next();let{value:w}=_;if(w?.length){let A=!1;g&&(w[0].id!==v.current&&(A=!0),v.current=w[0].id),w.forEach(S=>{Je(S,l)}),w=ms(w,l),g&&A&&Gr(),setTimeout(()=>{fo(w,l)},100),w.sort((S,T)=>Date.parse(T.createdAt)-Date.parse(S.createdAt))}return __BENCHMARK.end("fetch-home-first"),{..._,value:w}}async function b(){try{const g={limit:5,since_id:v.current};Xe("@pixelfed/home-include-reblogs")&&(g.include_reblogs=!0);const _=await c.v1.timelines.home.list(g).values().next();let{value:w}=_;const A=w[0]?.id===v.current;return!!(w?.length&&!A&&(v.current=w[0].id,w=ms(w,l),w=qt(w,"home"),w.some(S=>!S.reblog)))}catch{return!1}}return G(()=>{let g;return(async()=>{if(r){g=r.user.subscribe();for await(const _ of g){if(!g)break;if(_.event==="status.update"){const w=_.payload;Je(w,l)}else if(_.event==="delete"){const w=_.payload,A=Ps(w,l);A&&(A._deleted=!0)}}}})(),()=>{g?.unsubscribe?.(),g=null}},[r]),e(Et,{title:n||a({id:"following.title"}),id:o||"following",emptyText:a({id:"nJEKbY"}),errorText:a({id:"7QSeK6"}),instance:l,fetchItems:k,checkForUpdates:b,useItemID:!0,boostsCarousel:m.settings.boostsCarousel,...s,filterContext:"home",showFollowedTags:!0,showReplyParent:!0})}const Ol=20,zl=4,ws=zl+1;function yo({media:n,columnMode:i,...o}){const{_:s}=ce();let{hashtag:a,...c}=i?{}:Nt();o.hashtag&&(a=o.hashtag);let p=a.trim().split(/[\s+]+/);p.sort(),a=p[0];const[l,d]=bt(),r=n||!!l.get("media"),h=r?"?media=1":"",{masto:m,instance:f,authenticated:y}=se({instance:o?.instance||c.instance}),{masto:v,instance:C,authenticated:k}=se(),b=p.map($=>`#${$}`).join(" "),g=s(f?r?{id:"kH0rA0",values:{hashtagTitle:b,instance:f}}:{id:"IK0zKi",values:{hashtagTitle:b,instance:f}}:r?{id:"hHSI3w",values:{hashtagTitle:b}}:{id:"+ZzjRY",values:{hashtagTitle:b}});Qe(g,"/:instance?/t/:hashtag");const _=q(),w=ke(()=>Ci(),[]),A=q(void 0);async function S($){const ie=await m.v1.timelines.tag.$select(a).list({limit:Ol,any:p.slice(1),maxId:$?void 0:A.current,onlyMedia:r?!0:void 0}).values().next();let{value:Y}=ie;return Y?.length&&($&&(_.current=Y[0].id),Y.forEach(ee=>{Je(ee,f,{skipThreading:r||w})}),A.current=Y[Y.length-1].id),{...ie,value:Y}}async function T(){try{const $=await m.v1.timelines.tag.$select(a).list({limit:1,any:p.slice(1),since_id:_.current,onlyMedia:r}).values().next();let{value:ie}=$;const Y=ie[0]?.id===_.current;return ie?.length&&!Y?(ie=qt(ie,"public"),!0):!1}catch{return!1}}const[M,L]=R("default"),[H,F]=R();G(()=>{(async()=>{try{const $=await m.v1.tags.$select(a).fetch();F($)}catch{}})()},[a]);const U=p.length>=ws,[W,Q]=R("default"),[V,j]=R([]),[K,pe]=R(!1);return G(()=>{y&&(async()=>{try{const $=await m.v1.featuredTags.list();j($),pe($.some(ie=>ie.name.toLowerCase()===a.toLowerCase()))}catch{}})()},[]),e(D,{children:[e(Et,{title:g,titleComponent:!!f&&e("h1",{class:"header-double-lines",children:[e("b",{dir:"auto",children:b}),e("div",{children:f})]}),id:"hashtag",instance:f,emptyText:s({id:"CNSLAW"}),errorText:s({id:"yjj6Ll"}),fetchItems:S,checkForUpdates:T,useItemID:!0,view:r||w?"media":void 0,refresh:r,filterContext:"public",headerEnd:e(lt,{portal:!0,setDownOverflow:!0,overflow:"auto",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(I,{icon:"more",size:"l",alt:s({id:"2FYpfJ"})})}),children:[!!H&&p.length===1&&e(D,{children:[e(ft,{subMenu:!0,confirm:H.following,confirmLabel:s({id:"ctJi7k",values:{hashtag:a}}),disabled:M==="loading"||!y,onClick:()=>{L("loading"),H.following?m.v1.tags.$select(a).unfollow().then(()=>{F({...H,following:!1}),le(s({id:"doK/ij",values:{hashtag:a}}))}).catch($=>{alert($)}).finally(()=>{L("default")}):m.v1.tags.$select(a).follow().then(()=>{F({...H,following:!0}),le(s({id:"R9+aEN",values:{hashtag:a}}))}).catch($=>{alert($)}).finally(()=>{L("default")})},children:H.following?e(D,{children:[e(I,{icon:"check-circle"})," ",e("span",{children:e(u,{id:"HOSk7R"})})]}):e(D,{children:[e(I,{icon:"plus"})," ",e("span",{children:e(u,{id:"MKEPCY"})})]})}),e(ge,{type:"checkbox",checked:K,disabled:W==="loading"||!y,onClick:()=>{if(Q("loading"),K){const $=V.find(ie=>ie.name.toLowerCase()===a.toLowerCase()).id;$?m.v1.featuredTags.$select($).remove().then(()=>{pe(!1),le(s({id:"VH+Tf9"})),j(V.filter(ie=>ie.id!==$))}).catch(ie=>{}).finally(()=>{Q("default")}):le(s({id:"3OLv47"}))}else m.v1.featuredTags.create({name:a}).then($=>{pe(!0),le(s({id:"9ra4hn"})),j(V.concat($))}).catch($=>{}).finally(()=>{Q("default")})},children:K?e(D,{children:[e(I,{icon:"check-circle"}),e("span",{children:e(u,{id:"9ra4hn"})})]}):e(D,{children:[e(I,{icon:"check-circle"}),e("span",{children:e(u,{id:"UlJ3QN"})})]})}),e(He,{})]}),!w&&e(D,{children:[e(Ei,{className:"plain",children:e(u,{id:"cSev+j"})}),e(ge,{type:"checkbox",checked:!!r,onClick:()=>{r?l.delete("media"):l.set("media","1"),d(l)},children:[e(I,{icon:"check-circle",alt:"☑️"})," ",e("span",{class:"menu-grow",children:e(u,{id:"eK4SL/"})})]}),e(He,{})]}),e(ba,{className:"menu-field",disabled:U,children:({ref:$})=>e("form",{onSubmit:ie=>{ie.preventDefault();const Y=ie.target[0].value?.trim?.();Y&&!p.some(ee=>ee.toLowerCase()===Y.toLowerCase())&&(p.push(Y),p.sort(),location.hash=f?`/${f}/t/${p.join("+")}${h}`:`/t/${p.join("+")}${h}`)},children:[e(I,{icon:"hashtag"}),e("input",{ref:$,type:"text",placeholder:U?ue._({id:"ouWc/D",values:{TOTAL_TAGS_LIMIT:ws}}):s({id:"cxL5F9"}),required:!0,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:"[^##][^\\s##]+[^##]",disabled:U,dir:"auto"})]})}),e(wa,{takeOverflow:!0,children:p.map(($,ie)=>e(ge,{disabled:p.length===1,onClick:Y=>{p.splice(ie,1),p.sort(),location.hash=f?`/${f}/t/${p.join("+")}${h}`:`/t/${p.join("+")}${h}`},children:[e(I,{icon:"x",alt:s({id:"OISAkj"}),class:"danger-icon"}),e("span",{class:"bidi-isolate",children:[e("span",{class:"more-insignificant",children:"#"}),$]})]},$))}),e(He,{}),e(ge,{disabled:!k,onClick:()=>{if(E.shortcuts.length>=At){alert(ue._({id:"XN1xAY",values:{SHORTCUTS_LIMIT:At}}));return}const $={type:"hashtag",hashtag:p.join(" "),instance:f,media:r?"on":void 0};E.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(s({id:"kfeQnS"})):(E.shortcuts.push($),le(s({id:"MIhb91"})))},children:[e(I,{icon:"shortcut"})," ",e("span",{children:e(u,{id:"i02Lq/"})})]}),e(ge,{onClick:()=>{let $=prompt(s({id:"2MQ2cd"}));if(!/\./.test($)){$&&alert(s({id:"7WddtO"}));return}$&&($=$.toLowerCase().trim(),location.hash=`/${$}/t/${p.join("+")}${h}`)},children:[e(I,{icon:"bus"})," ",e("span",{children:e(u,{id:"Sq04Yc"})})]}),C!==f&&e(ge,{onClick:()=>{location.hash=`/${C}/t/${p.join("+")}${h}`},children:[e(I,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(u,{id:"iAzCp4",values:{currentInstance:C},components:{0:e("b",{})}})})]})]})},f+b),!i&&!!p?.length&&e("data",{class:"compose-data",value:JSON.stringify({draftStatus:{status:`${p.length>1?`
|
||
|
||
`:" "}${b}`}})})]})}const Fl=20;function bo(n){const{_:i}=ce(),o=Ge(E),{masto:s,instance:a}=se(),c=n?.id||Nt()?.id,p=q(),l=q();async function d(g){(g||!l.current)&&(l.current=s.v1.timelines.list.$select(c).list({limit:Fl}).values());const _=await l.current.next();let{value:w}=_;return w?.length&&(g&&(p.current=w[0].id),w.forEach(A=>{Je(A,a)})),{..._,value:w}}async function r(){try{const g=await s.v1.timelines.list.$select(c).list({limit:1,since_id:p.current});let{value:_}=g;const w=_[0]?.id===p.current;return _?.length&&!w?(_=qt(_,"home"),!0):!1}catch{return!1}}const[h,m]=R([]),[f,y]=R({title:"List"});Qe(f.title,"/l/:id"),G(()=>{(async()=>{try{const g=await oo(c);y(g)}catch{}})()},[c]);const[v,C]=R(!1),[k,b]=R(!1);return e(D,{children:[e(Et,{title:f.title,id:"list",emptyText:i({id:"KkDhfU"}),errorText:i({id:"7QSeK6"}),instance:a,fetchItems:d,checkForUpdates:r,useItemID:!0,boostsCarousel:o.settings.boostsCarousel,filterContext:"home",showReplyParent:!0,headerStart:e(lt,{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:g=>{g.open&&pn().then(m)},children:[e(Ke,{to:"/l",children:e("span",{children:e(u,{id:"BHWx+g"})})}),h?.length>0&&e(D,{children:[e(He,{}),h.map(g=>e(Ke,{to:`/l/${g.id}`,children:e("span",{children:[g.title,g.exclusive&&e(D,{children:[" ",e(Kt,{})]})]})},g.id))]})]}),headerEnd:e(lt,{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:[f?.exclusive&&e(D,{children:[e(Ei,{className:"plain",children:[e(Kt,{})," ",e(u,{id:"FNptcJ"})]}),e(He,{})]}),e(ge,{onClick:()=>C({list:f}),children:[e(I,{icon:"pencil",size:"l"}),e("span",{children:e(u,{id:"ePK91l"})})]}),e(ge,{onClick:()=>b(!0),children:[e(I,{icon:"group",size:"l"}),e("span",{children:e(u,{id:"hB02vO"})})]})]})},c),v&&e(Ue,{onClick:g=>{g.target===g.currentTarget&&C(!1)},children:e(Fi,{list:v?.list,onClose:g=>{g.state==="success"&&g.list?y(g.list):g.state==="deleted"&&(location.hash="/l"),C(!1)}})}),k&&e(Ue,{onClick:g=>{g.target===g.currentTarget&&b(!1)},children:e(ql,{listID:c,onClose:()=>b(!1)})})]})}const Bl=40;function ql({listID:n,onClose:i}){const{_:o}=ce(),{masto:s,instance:a}=se(),[c,p]=R([]),[l,d]=R("default"),[r,h]=R(!1),m=q();async function f(y){h(!1),d("loading"),(async()=>{try{(y||!m.current)&&(m.current=s.v1.lists.$select(n).accounts.list({limit:Bl}).values());const v=await m.current.next();let{done:C,value:k}=v;k?.length?(p(y?k:c.concat(k)),h(!C)):h(!1),d("default")}catch{d("error")}})()}return G(()=>{f(!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:o({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{id:"hB02vO"})})}),e("main",{children:e("ul",{children:[c.map(y=>e("li",{children:[e(ut,{account:y,instance:a}),e(Ul,{account:y,listID:n})]},y.id)),r&&l==="default"&&e(Tt,{as:"li",onChange:y=>y&&f(),children:e("button",{type:"button",class:"light block",onClick:f,children:e(u,{id:"uXRAkV"})})})]})})]})}function Ul({account:n,listID:i}){const{_:o}=ce(),{masto:s}=se(),[a,c]=R("default"),[p,l]=R(!1);return e(ft,{confirm:!p,confirmLabel:e("span",{children:e(u,{id:"j5n9Ry",values:{0:n.username},components:{0:e("span",{class:"bidi-isolate"})}})}),align:"end",menuItemClassName:"danger",onClick:()=>{p?(c("loading"),(async()=>{try{await s.v1.lists.$select(i).accounts.create({accountIds:[n.id]}),c("default"),l(!1)}catch{c("error")}})()):(c("loading"),(async()=>{try{await s.v1.lists.$select(i).accounts.remove({accountIds:[n.id]}),c("default"),l(!0)}catch{c("error")}})())},children:e("button",{type:"button",class:`light ${p?"":"danger"}`,disabled:a==="loading",children:o(p?{id:"m16xKo"}:{id:"MWIaew"})})})}const Kl={mention:["account","status"],quote:["account","status"],status:["account","status"],reblog:["account","status"],follow:["account"],follow_request:["account"],favourite:["account","status"],poll:["status"],update:["status"]},Hl=["favourite","reblog","follow"],wo=n=>Hl.includes(n);function ko(n){return n.filter(i=>{const{type:o,id:s,createdAt:a}=i;if(!o)return!1;const c=Kl[o];return c?.length?c.every(p=>!!i[p]):!0})}function So(n){if(n?.notificationGroups){const{accounts:i=[],notificationGroups:o=[],statuses:s=[]}=n;return o.map(a=>{const{sampleAccountIds:c,statusId:p}=a,l=c?.map(r=>i.find(h=>h.id===r))||[],d=s?.find(r=>r.id===p)||null;return{...a,sampleAccounts:l,status:d}})}return n}function jl(n){const i=n.map(p=>{const{latestPageNotificationAt:l,mostRecentNotificationId:d,sampleAccounts:r,notificationsCount:h}=p;return{id:""+d,createdAt:l,account:r[0],...p}}),o={},s=[];for(let p=0;p<i.length;p++){const l=i[p],{type:d,status:r,createdAt:h,notificationsCount:m,sampleAccounts:f,groupKey:y}=l,v=h?new Date(h).toLocaleDateString():"";let C=d;!(m>0&&f?.length>0&&m>f?.length)&&(d==="favourite"||d==="reblog")&&(C="favourite+reblog");const b=`${r?.id}-${C}-${v}`,g=o[b];if(!wo(d))s.push(l);else if(g)f.forEach(_=>{const w=g.sampleAccounts.find(A=>A.id===_.id);w?(w._types.push(d),w._types.sort().reverse()):g.sampleAccounts.push({..._,_types:[d]})}),g.notificationsCount=Math.min(g.notificationsCount,m),g._notificationsCount.push(m),g._sampleAccountsCount.push(f?.length),g._accounts=g.sampleAccounts,g._groupKeys.push(y);else{const _=f.map(w=>({...w,_types:[d]}));o[b]={...l,sampleAccounts:_,type:C,_accounts:_,_groupKeys:y?[y]:[],_notificationsCount:[m],_sampleAccountsCount:[f?.length]},s.push(o[b])}}const a={},c=[];for(let p=0;p<s.length;p++){const l=s[p],{type:d,account:r,_accounts:h,sampleAccounts:m,createdAt:f,groupKey:y}=l,v=f?new Date(f).toLocaleDateString():"",C=m?.length===1||h?.length===1;if((d==="favourite"||d==="reblog"||d==="favourite+reblog")&&C){const k=`${r?.id}-${d}-${v}`,b=a[k];if(b)b._statuses.push(l.status),b._ids+=`-${l.id}`,b._groupKeys.push(y);else{let g=a[k]={...l,type:d,_ids:l.id,_statuses:[l.status],_groupKeys:y?[y]:[]};c.push(g)}}else c.push(l)}return c}function Yl(n){n=ko(n);const i={},o=[];for(let c=0,p=0;c<n.length;c++){const l=n[c],{id:d,status:r,account:h,type:m,createdAt:f}=l,y=f?new Date(f).toLocaleDateString():"";let v=m;(m==="favourite"||m==="reblog")&&(v="favourite+reblog");const C=`${r?.id}-${v}-${y}`,k=i[C];if(!wo(m))o[p++]=l;else if(k?.account){const b=k._accounts.find(g=>g.id===h.id);b?(b._types.push(m),b._types.sort().reverse(),k._ids+=`-${d}`):(h._types=[m],k._accounts.push(h),k._ids+=`-${d}`)}else{h&&(h._types=[m]);let b=i[C]={...l,type:v,_ids:d,_accounts:h?[h]:[]};o[p++]=b}}const s={},a=[];for(let c=0,p=0;c<o.length;c++){const l=o[c],{id:d,account:r,_accounts:h,type:m,createdAt:f}=l,y=f?new Date(f).toLocaleDateString():"";if(m==="favourite+reblog"&&r&&h.length===1){const v=`${r?.id}-${m}-${y}`,C=s[v];if(C)C._statuses.push(l.status),C._ids+=`-${d}`;else{let k=s[v]={...l,type:m,_ids:d,_statuses:[l.status]};a[p++]=k}}else a[p++]=l}return a}const ks=20,Vl=new URLSearchParams;function Co({columnMode:n,...i}){const{_:o}=ce(),{masto:s,instance:a}=se(),[c]=n?[Vl]:bt(),[p,l]=R(null),d=i?.type||c.get("type")||p;Qe(o(d==="private"?{id:"2BApYc"}:{id:"/bZzdR"}),"/mentions");const r=q(),h=q();async function m(g){(g||!r.current)&&(r.current=s.v1.notifications.list({limit:ks,types:["mention"]}).values());const _=await r.current.next();let{value:w}=_;return w?.length&&(w=ko(w),g&&(h.current=w[0].id),w.forEach(({status:A})=>{Je(A,a)})),{..._,value:w?.map(A=>A.status)}}const f=q(),y=q();async function v(g){(g||!f.current)&&(f.current=s.v1.conversations.list({limit:ks}).values());const _=await f.current.next();let{value:w}=_;return w=w?.filter(A=>A.lastStatus),w?.length&&(g&&(y.current=w[0].lastStatus.id),w.forEach(({lastStatus:A})=>{Je(A,a)})),{..._,value:w?.map(A=>A.lastStatus)}}function C(...g){return d==="private"?v(...g):m(...g)}async function k(){if(d==="private")try{const g=await s.v1.conversations.list({limit:1,since_id:y.current}).values().next();let{value:_}=g;const w=_[0]?.id===y.current;return _?.length&&!w?(y.current=_[0].lastStatus.id,!0):!1}catch{return!1}else try{const g=await s.v1.notifications.list({limit:1,types:["mention"],since_id:h.current}).values().next();let{value:_}=g;return _?.length?(h.current=_[0].id,!0):!1}catch{return!1}}const b=ke(()=>e("div",{class:"filter-bar centered",children:[e(fe,{to:"/mentions",class:d?"":"is-active",onClick:g=>{n&&(g.preventDefault(),l(null))},children:e(u,{id:"N40H+G"})}),e(fe,{to:"/mentions?type=private",class:d==="private"?"is-active":"",onClick:g=>{n&&(g.preventDefault(),l("private"))},children:e(u,{id:"zwBp5t"})})]}),[d]);return e(Et,{title:o({id:"/bZzdR"}),id:"mentions",emptyText:o({id:"03jFGT"}),errorText:o({id:"pqR9KF"}),instance:a,fetchItems:C,checkForUpdates:k,useItemID:!0,timelineStart:b,refresh:d,filterContext:"notifications"})}const Gl=80,Wl=20,Zl=new URLSearchParams,yn={block:"center",inline:"center",behavior:"smooth"},_o=_i(()=>bi()?.mastodon>=2,{maxAge:1e3*60*5});function Io(n={}){const{masto:i}=se();return E.settings.groupedNotificationsAlpha&&_o()?i.v2.notifications.list({limit:Wl,...n}):i.v1.notifications.list({limit:Gl,...n})}function Ao(n={}){return Io(n).values()}function To(n){return E.settings.groupedNotificationsAlpha&&_o()?jl(n):Yl(n)}const Xl=["forNotFollowing","forNotFollowers","forNewAccounts","forPrivateMentions","forLimitedAccounts"],Jl={forNotFollowing:{id:"d+hDoa"},forNotFollowers:{id:"oAwuQj"},forNewAccounts:{id:"Srs8u7"},forPrivateMentions:{id:"IDC5Uw"},forLimitedAccounts:{id:"XMGM2e"}};function Ql({columnMode:n}){const{_:i,_:o}=ce();Qe(o({id:"iDNBZe"}),"/notifications");const{masto:s,instance:a}=se(),c=Ge(E),[p,l]=R("default"),[d]=n?[Zl]:bt(),r=d.get("id"),h=d.get("access_token"),[m,f]=R(!1),[y,v]=R(!1),C=q(),{nearReachEnd:k,scrollDirection:b,reachStart:g,nearReachStart:_}=Wr({scrollableRef:C}),w=b==="end"&&!_,[A,S]=R([]),[T,M]=R([]),L=q(),H=q();async function F(P){if((P||!H.current)&&(L.current=Io({excludeTypes:["follow_request"]}),H.current=L.current.values()),/max_id=($|&)/i.test(H.current?.nextParams))return{done:!0};const be=await H.current.next(),qe=So(be.value);if(qe?.length){qe.forEach(N=>{Je(N.status,a,{skipThreading:!0})});const De=To(qe);P?(E.notificationsLast=De[0],E.notifications=De,s.v1.markers.create({notifications:{lastReadId:De[0].id}}).catch(()=>{})):E.notifications.push(...De)}return E.notificationsShowNew=!1,E.notificationsLastFetchTime=Date.now(),be}async function U(){try{return await s.v1.followRequests.list({limit:80})}catch{return[]}}const W=()=>{l("loading"),(async()=>{try{const P=await U();S(P),l("default")}catch{l("error")}})()};async function Q(){try{return await s.v1.announcements.list()}catch{return[]}}const V=Xe("@mastodon/filtered-notifications"),[j,K]=R(!1),[pe,$]=R({});function ie(){return s.v2.notifications.policy.fetch().catch(()=>{})}function Y(){ie().then(P=>{$(P)}).catch(()=>{})}const[ee,he]=R(null);function re(){return s.v1.notifications.requests.list()}const J=P=>{ve(!1),l("loading"),(async()=>{try{const be=F(P);P&&(Q().then(De=>{De.sort((N,ae)=>Date.parse(ae.updatedAt||ae.createdAt)-Date.parse(N.updatedAt||N.createdAt)),M(De)}).catch(()=>{}),U().then(De=>{S(De)}).catch(()=>{}),V&&Y());const{done:qe}=await be;f(!qe),l("default")}catch{l("error")}})()};G(()=>{J(!0)},[]),G(()=>{g&&J(!0)},[g]);const[Ce,ve]=R(!1),ye=tt(({disableIdleCheck:P=!1}={})=>{p!=="loading"&&c.settings.autoRefresh&&C.current?.scrollTop<16&&(P||window.__IDLE__)&&!ed()&&J(!0)},[c.notificationsShowNew,c.settings.autoRefresh,p]),Ne=q();Xt(P=>{if(P){const be=Date.now()-Ne.current;!Ne.current||be>1e3*3?ye({disableIdleCheck:!0}):Ne.current=Date.now()}});const Se=q(!0);G(()=>{let P=Vo(E,"notificationsShowNew",be=>{if(Se.current){Se.current=!1;return}p!=="loading"&&(be&&ye(),ve(be))});return()=>P?.()},[]);const Ae=new Date,xe=new Date(Ae-24*60*60*1e3);let Pe=new Date;const ze=!c.notifications.some(P=>new Date(P.createdAt).toDateString()===Ae.toDateString()),Be=q();G(()=>{r&&(E.routeNotification={id:r,accessToken:atob(h)})},[r,h]);const[Ye,oe]=R(null);G(async()=>{const P=new Date;if(P.getMonth()!==11||!Xe("@mastodon/annual-report"))return;let be=Te.account.get("annualReportNotification");if(be){oe(be);return}const qe=Ao({types:["annual_report"]});try{be=(await qe.next())?.value?.notificationGroups?.[0],be?.annualReport?.year==P.getFullYear()&&(oe(be),Te.account.set("annualReportNotification",be))}catch{}},[]);const Le=".notification",Re=Fe("j",()=>{const P=document.activeElement.closest(Le),be=P?.getBoundingClientRect(),qe=Array.from(C.current.querySelectorAll(Le));if(P&&be.top<C.current.clientHeight&&be.bottom>0){const De=qe.indexOf(P);let N=qe[De+1];N&&(N.focus(),N.scrollIntoView(yn))}else{const De=qe.find(N=>{const ae=N.getBoundingClientRect();return ae.top>=44&&ae.left>=0});De&&(De.focus(),De.scrollIntoView(yn))}},{useKey:!0,ignoreEventWhen:P=>P.metaKey||P.ctrlKey||P.altKey||P.shiftKey}),O=Fe("k",()=>{const P=document.activeElement.closest(Le),be=P?.getBoundingClientRect(),qe=Array.from(C.current.querySelectorAll(Le));if(P&&be.top<C.current.clientHeight&&be.bottom>0){const De=qe.indexOf(P);let N=qe[De-1];N&&(N.focus(),N.scrollIntoView(yn))}else{const De=qe.find(N=>{const ae=N.getBoundingClientRect();return ae.top>=44&&ae.left>=0});De&&(De.focus(),De.scrollIntoView(yn))}},{useKey:!0,ignoreEventWhen:P=>P.metaKey||P.ctrlKey||P.altKey||P.shiftKey}),Ie=Fe(["enter","o"],()=>{const be=document.activeElement.closest(Le)?.querySelector(".status-link");be&&be.click()},{useKey:!0,ignoreEventWhen:P=>P.metaKey||P.ctrlKey||P.altKey||P.shiftKey}),Me=new Date,Ee=ke(()=>st(Me,{forceOpts:{weekday:"long"}}),[Me]);return e("div",{id:"notifications-page",class:"deck-container",ref:P=>{C.current=P,Re.current=P,O.current=P,Ie.current=P},tabIndex:"-1",children:[e("div",{class:`timeline-deck deck ${y?"only-mentions":""}`,children:[e("header",{hidden:w,onClick:P=>{P.target.closest("a, button")||C.current?.scrollTo({top:0,behavior:"smooth"})},onDblClick:P=>{P.target.closest("a, button")||J(!0)},class:p==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Pt,{}),e(fe,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l",alt:o({id:"i0qMbr"})})})]}),e("h1",{children:e(u,{id:"iDNBZe"})}),e("div",{class:"header-side",children:V&&e("button",{type:"button",class:"button plain4",onClick:()=>{K(!0)},children:e(I,{icon:"settings",size:"l",alt:o({id:"a/+arl"})})})})]}),Ce&&p!=="loading"&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:()=>{J(!0),C.current?.scrollTo({top:0,behavior:"smooth"})},children:[e(I,{icon:"arrow-up"})," ",e(u,{id:"Jy9RU/"})]})]}),T.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(u,{id:"0whvLM",values:{0:T.length}})," ",e("small",{class:"insignificant",children:a})]}),T.length>1&&e("span",{class:"announcements-nav-buttons",children:T.map((P,be)=>e("button",{type:"button",class:"plain2 small",onClick:()=>{Be.current?.children[be].scrollIntoView({behavior:"smooth",block:"nearest"})},children:be+1}))})]}),e("ul",{class:`announcements-list-${T.length>1?"multiple":"single"}`,ref:Be,children:T.map(P=>e("li",{children:e(td,{announcement:P})}))})]})})}),A.length>0&&e("div",{class:"follow-requests",children:[e("h2",{class:"timeline-header",children:e(u,{id:"6Fs1Ba"})}),A.length>5?e("details",{children:[e("summary",{children:e(u,{id:"7dHKu4",values:{0:A.length}})}),e("ul",{children:A.map(P=>e("li",{children:[e(ut,{account:P}),e(pi,{accountID:P.id,onChange:()=>{}})]},P.id))})]}):e("ul",{children:A.map(P=>e("li",{children:[e(ut,{account:P}),e(pi,{accountID:P.id,onChange:()=>{}})]},P.id))})]}),V&&pe?.summary?.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:be}=P.target;if(be){const qe=await re();he(qe)}},children:[e("summary",{children:e(u,{id:"N3Bq0f",values:{0:pe.summary.pendingRequestsCount}})}),ee?ee?.length>0&&e("ul",{children:ee.map(P=>e("li",{children:[e("div",{class:"request-notifcations",children:[!P.lastStatus?.id&&e(ut,{useAvatarStatic:!0,showStats:!0,account:P.account}),P.lastStatus?.id&&e("div",{class:"last-post",children:e(fe,{class:"status-link",to:`/${a}/s/${P.lastStatus.id}`,children:e(je,{status:P.lastStatus,size:"s",readOnly:!0})})}),e(id,{request:P})]}),e(sd,{request:P,onChange:()=>{J(!0)}})]},P.id))}):e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})})]})})})}),Ye&&e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e(un,{notification:Ye})})}),e("div",{id:"mentions-option",children:e("label",{children:[e("input",{type:"checkbox",checked:y,onChange:P=>{v(P.target.checked)}})," ",e(u,{id:"0udtPI"})]})}),e("h2",{class:"timeline-header",children:[e(u,{id:"ecUA8p"})," ",e("small",{class:"insignificant bidi-isolate",children:Ee})]}),ze&&e("p",{class:"ui-state insignificant",children:p==="default"?o({id:"KS7iJH"}):e(D,{children:"…"})}),c.notifications.length?e(Hn.Provider,{value:"notifications",children:c.notifications.filter(P=>P.type!=="follow_request").map(P=>{if(y&&P.type!=="mention")return null;const be=new Date(P.createdAt),qe=be.toDateString()!==Pe.toDateString();qe&&(Pe=be);const De=be.toDateString()===xe.toDateString()?o({id:"y/0uwd"}):st(Pe,{hideTime:!0}),N=st(Pe,{forceOpts:{weekday:"long"}});return e(D,{children:[qe&&e("h2",{class:"timeline-header",children:[e("span",{children:De})," ",e("small",{class:"insignificant bidi-isolate",children:N})]}),e(un,{instance:a,notification:P},P._ids||P.id)]},P._ids||P.id)})}):e(D,{children:[p==="loading"&&e(D,{children:e("ul",{class:"timeline flat",children:Array.from({length:5}).map((P,be)=>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:"███████████ ████"})})]}))})}),p==="error"&&e("p",{class:"ui-state",children:[e(u,{id:"gjzl8E"}),e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>J(!0),children:e(u,{id:"KDw4GX"})})]})]}),m&&e(Tt,{onChange:P=>{P&&J()},children:e("button",{type:"button",class:"plain block",disabled:p==="loading",onClick:()=>J(),style:{marginBlockEnd:"6em"},children:p==="loading"?e(Oe,{abrupt:!0}):e(u,{id:"uXRAkV"})})})]}),V&&j&&e(Ue,{onClick:P=>{P.target===P.currentTarget&&K(!1)},children:e("div",{class:"sheet",id:"notifications-settings",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>K(!1),children:e(I,{icon:"x",alt:o({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{id:"a/+arl"})})}),e("main",{children:e("form",{onSubmit:P=>{P.preventDefault();const{forNotFollowing:be,forNotFollowers:qe,forNewAccounts:De,forPrivateMentions:N,forLimitedAccounts:ae}=P.target,x={...pe,forNotFollowing:be.value,forNotFollowers:qe.value,forNewAccounts:De.value,forPrivateMentions:N.value,forLimitedAccounts:ae.value};$(x),K(!1),(async()=>{try{await s.v2.notifications.policy.update(x),le(o({id:"4+7X9i"}))}catch{}})()},children:[e("p",{children:e(u,{id:"WrkPTf"})}),e("div",{class:"notification-policy-fields",children:Xl.map(P=>{const be=pe[P];return e("div",{children:e("label",{children:[i(Jl[P]),e("select",{name:P,defaultValue:be,class:"small",children:[e("option",{value:"accept",children:e(u,{id:"g3UF2V"})}),e("option",{value:"filter",children:e(u,{id:"o7J4JM"})}),e("option",{value:"drop",children:e(u,{id:"gbbkE7"})})]})]})},P)})}),e("p",{children:e("button",{type:"submit",children:e(u,{id:"tfDRzk"})})})]})})]})})]})}function ed(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}function td({announcement:n}){const{instance:i}=se(),{contact:o}=$s(),s=o?.account,{id:a,content:c,startsAt:p,endsAt:l,published:d,allDay:r,publishedAt:h,updatedAt:m,read:f,mentions:y,statuses:v,tags:C,emojis:k,reactions:b}=n,g=new Date(h),_=st(g),w=new Date(m),A=st(w);return e("div",{class:"announcement-block",children:[e(ut,{account:s}),e("div",{class:"announcement-content",onClick:Us({mentions:y,instance:i}),dangerouslySetInnerHTML:{__html:li(c,{emojis:k})}}),e("p",{class:"insignificant",children:[e("time",{datetime:g.toISOString(),children:st(g)}),m&&A!==_&&e(D,{children:[" ","•"," ",e("span",{class:"ib",children:e(u,{id:"TbFrLc",values:{0:st(w)},components:{0:e("time",{datetime:w.toISOString()})}})})]})]}),e("div",{class:"announcement-reactions",hidden:!0,children:b.map(S=>{const{name:T,count:M,me:L,staticUrl:H,url:F}=S;return e("button",{type:"button",class:`plain4 small ${L?"reacted":""}`,children:[F||H?e("img",{src:F||H,alt:T,width:"16",height:"16"}):e("span",{children:T})," ",e("span",{class:"count",children:We(M)})]})})})]})}function nd(n){const{masto:i}=se();return i.v1.notifications.list({accountID:n})}function id({request:n}){const{instance:i}=se(),[o,s]=R("loading"),{account:a,lastStatus:c}=n,[p,l]=R(!1),[d,r]=R([]);function h(){l(!1)}return G(()=>{n?.account?.id&&p&&(s("loading"),(async()=>{const m=await nd(n.account.id);r(m||[]),s("default")})())},[p,n?.account?.id]),e(D,{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(u,{id:"H0wUNM",values:{0:a.username},components:{0:e("span",{class:"bidi-isolate"})}})})," ",e(I,{icon:"chevron-down"})]}),p&&e(Ue,{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(u,{id:"MXOmPt",values:{0:a.username},components:{0:e("span",{class:"bidi-isolate"})}})})}),e("main",{children:o==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):d.map(m=>e("div",{class:"notification-peek",onClick:f=>{const{target:y}=f;(f.target.tagName==="BUTTON"||f.target.tagName==="A")&&h()},children:e(un,{instance:i,notification:m,isStatic:!0})}))})]})})]})}function sd({request:n,onChange:i}){const{_:o}=ce(),{masto:s}=se(),[a,c]=R("default"),[p,l]=R(null),d=p!==null;return e("p",{class:"notification-request-buttons",children:[e("button",{type:"button",disabled:a==="loading"||d,onClick:()=>{c("loading"),(async()=>{try{await s.v1.notifications.requests.$select(n.id).accept(),l("accept"),c("default"),i({request:n,state:"accept"}),le(o({id:"ZtBMwU",values:{0:n.account.username}}))}catch{c("error"),le(o({id:"S92JKG"}))}})()},children:e(u,{id:"h7peZQ"})})," ",e("button",{type:"button",disabled:a==="loading"||d,class:"light danger",onClick:()=>{c("loading"),(async()=>{try{await s.v1.notifications.requests.$select(n.id).dismiss(),l("dismiss"),c("default"),i({request:n,state:"dismiss"}),le(o({id:"ibBDry",values:{0:n.account.username}}))}catch{c("error"),le(o({id:"S5aemF"}))}})()},children:e(u,{id:"1QfxQT"})}),e("span",{class:"notification-request-states",children:a==="loading"?e(Oe,{abrupt:!0}):p==="accept"?e(I,{icon:"check-circle",alt:o({id:"bzMKg7"}),class:"notification-accepted"}):p==="dismiss"&&e(I,{icon:"x-circle",alt:o({id:"J6hrEy"}),class:"notification-dismissed"})})]})}const xo=ot(Ql),od=20;function fi({local:n,columnMode:i,...o}){const{_:s}=ce(),a=Ge(E),c=!!n,p=i?{}:Nt(),{masto:l,instance:d}=se({instance:o?.instance||p.instance}),{masto:r,instance:h}=se(),m=s(c?{id:"u96B/B",values:{instance:d}}:{id:"PgVqvd",values:{instance:d}});Qe(m,c?"/:instance?/p/l":"/:instance?/p");const f=q(),y=q();async function v(k){if(k||!y.current){const _={limit:od,local:c||void 0};!c&&Xe("@pixelfed/global-feed")&&(_.remote=!0),y.current=l.v1.timelines.public.list(_).values()}const b=await y.current.next();let{value:g}=b;return g?.length&&(k&&(f.current=g[0].id),g.forEach(_=>{Je(_,d)})),{...b,value:g}}async function C(){try{const k=await l.v1.timelines.public.list({limit:1,local:c,since_id:f.current}).values().next();let{value:b}=k;const g=b[0]?.id===f.current;return b?.length&&!g?(b=qt(b,"public"),!0):!1}catch{return!1}}return e(Et,{title:m,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:s(c?{id:"pJQgQV"}:{id:"cg0I+x"})}),e("div",{children:d})]}),id:"public",instance:d,emptyText:s({id:"BiZJ6G"}),errorText:s({id:"scd9lw"}),fetchItems:v,checkForUpdates:C,useItemID:!0,headerStart:e(D,{}),boostsCarousel:a.settings.boostsCarousel,filterContext:"public",headerEnd:e(lt,{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(ge,{href:c?`/#/${d}/p`:`/#/${d}/p/l`,children:c?e(D,{children:[e(I,{icon:"transfer"})," ",e("span",{children:e(u,{id:"dXMiUw"})})]}):e(D,{children:[e(I,{icon:"transfer"})," ",e("span",{children:e(u,{id:"t2B/we"})})]})}),e(He,{}),e(ge,{onClick:()=>{let k=prompt(s({id:"2MQ2cd"}));if(!/\./.test(k)){k&&alert(s({id:"7WddtO"}));return}k&&(k=k.toLowerCase().trim(),location.hash=c?`/${k}/p/l`:`/${k}/p`)},children:[e(I,{icon:"bus"})," ",e("span",{children:e(u,{id:"Sq04Yc"})})]}),h!==d&&e(ge,{onClick:()=>{location.hash=c?`/${h}/p/l`:`/${h}/p`},children:[e(I,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(u,{id:"iAzCp4",values:{currentInstance:h},components:{0:e("b",{})}})})]})]})},d+c)}function ad({onItemClick:n}){const{_:i}=ce(),{instance:o}=se(),[,s]=xt(d=>d+1,0),a=Zn(),c=()=>{qr(),le({text:i({id:"hgPsUe"}),delay:1e3}),s()},p=(d,r)=>{Br(d,r),s()},[l]=Yn();return a.length===0?null:e("div",{class:"recent-searches",children:[e("div",{class:"recent-searches-header",children:[e(I,{icon:"history"})," ",e("span",{children:e(u,{id:"4R1B1H"})}),e("span",{class:"spacer"}),e("button",{type:"button",class:"plain4 small",onClick:c,disabled:a.length<=0,children:e("span",{children:e(u,{id:"yYxB17"})})})]}),e("ul",{class:"link-list recent-searches-list",ref:l,children:a.map(d=>{const{label:r,to:h,icon:m}=Ot(d.query,d.queryType,o);return e("li",{class:"recent-searches-item",children:[e(fe,{to:h,class:"recent-searches-link",onClick:f=>{Tn(d.query,d.queryType),n?.(f)},children:[e(I,{icon:m,class:"more-insignificant"}),e("span",{class:"recent-searches-label",children:r})]}),e("button",{type:"button",class:"plain4 small",onClick:()=>p(d.query,d.queryType),children:e(I,{icon:"trash",alt:i({id:"xCJdfg"})})})]},`${d.query}-${d.queryType}-${d.timestamp}`)})})]})}const bn=5,ri=40,cd=new URLSearchParams,wn={block:"nearest",inline:"center",behavior:"smooth"};function Eo({columnMode:n,...i}){const{_:o}=ce(),s=n?{}:Nt(),{masto:a,instance:c,authenticated:p}=se({instance:s.instance}),[l,d]=R("default"),[r]=n?[cd]:bt(),h=q(),m=i?.query||r.get("q"),f=n?"statuses":i?.type||r.get("type");let y=o({id:"A1taO8"});if(m)switch(f){case"statuses":y=o({id:"6YeoAt",values:{q:m}});break;case"accounts":y=o({id:"fpgumQ",values:{q:m}});break;case"hashtags":y=o({id:"AuiMZZ",values:{q:m}});break;default:y=o({id:"wr3GZI",values:{q:m}})}Qe(y,"/search");const[v,C]=R(!1),k=q(0);G(()=>{k.current=0},[m,f]);const b=q();St(()=>{b.current?.scrollTo?.(0,0)},[m,f]);const[g,_]=R([]),[w,A]=R([]),[S,T]=R([]);G(()=>{_([]),A([]),T([])},[m]);const M={statuses:g,accounts:w,hashtags:S},L={statuses:_,accounts:A,hashtags:T},[H,F]=R({}),U=async $=>{if(!$?.length)return;const ie=await Kn($,H);ie&&F({...H,...ie})};function W($){$&&(k.current=0),!(!$&&!p)&&(d("loading"),$&&!f&&(_(g.slice(0,bn)),A(w.slice(0,bn)),T(S.slice(0,bn))),(async()=>{const ie={q:m,resolve:p,limit:bn};f&&(ie.limit=ri,ie.type=f,p&&(ie.offset=k.current));try{const Y=await a.v2.search.list(ie);if(f)if($){L[f](Y[f]);const ee=Y[f]?.length;k.current=ri,C(!!ee)}else if(Y[f]?.[0]?.id===M[f]?.[0]?.id)C(!1);else{L[f](he=>[...he,...Y[f]]);const ee=Y[f]?.length;k.current=k.current+ri,C(!!ee)}else _(Y.statuses||[]),A(Y.accounts||[]),T(Y.hashtags||[]),k.current=0,C(!1);U(Y.accounts),d("default")}catch{d("error")}})())}const Q=q();Xt($=>{const ie=b.current?.scrollTop===0;if($&&ie){const Y=Date.now()-Q.current;!Q.current||Y>1e3*3?W(!0):Q.current=Date.now()}}),G(()=>{let $;return h.current?.setValue?.(m||""),m?W(!0):$=setTimeout(()=>{h.current?.focus?.()},150),()=>clearTimeout($)},[m,f,c]),Fe(["Slash","/"],$=>{h.current?.focus?.(),h.current?.select?.()},{useKey:!0,preventDefault:!0,ignoreEventWhen:$=>$.metaKey||$.ctrlKey||$.altKey||$.shiftKey});const V=".timeline > li > a, .hashtag-list > li > a",j=Fe("j",()=>{const $=document.activeElement.closest(V),ie=$?.getBoundingClientRect(),Y=Array.from(b.current.querySelectorAll(V));if($&&ie.top<b.current.clientHeight&&ie.bottom>0){const ee=Y.indexOf($);let he=Y[ee+1];he&&(he.focus(),he.scrollIntoView(wn))}else{const ee=Y.find(he=>{const re=he.getBoundingClientRect();return re.top>=44&&re.left>=0});ee&&(ee.focus(),ee.scrollIntoView(wn))}},{useKey:!0,ignoreEventWhen:$=>$.metaKey||$.ctrlKey||$.altKey||$.shiftKey}),K=Fe("k",()=>{const $=document.activeElement.closest(V),ie=$?.getBoundingClientRect(),Y=Array.from(b.current.querySelectorAll(V));if($&&ie.top<b.current.clientHeight&&ie.bottom>0){const ee=Y.indexOf($);let he=Y[ee-1];he&&(he.focus(),he.scrollIntoView(wn))}else{const ee=Y.find(he=>{const re=he.getBoundingClientRect();return re.top>=44&&re.left>=0});ee&&(ee.focus(),ee.scrollIntoView(wn))}},{useKey:!0,ignoreEventWhen:$=>$.metaKey||$.ctrlKey||$.altKey||$.shiftKey}),[pe]=Yn();return e("div",{id:"search-page",class:"deck-container",tabIndex:"-1",ref:$=>{b.current=$,j.current=$,K.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(Pt,{})}),e(po,{ref:h}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{W(!0)},disabled:l==="loading",children:e(I,{icon:"search",size:"l",alt:o({id:"A1taO8"})})})})]})}),e("main",{children:[!!m&&!n&&e("div",{ref:pe,class:`filter-bar ${l==="loading"?"loading":""}`,children:[!!f&&e(fe,{to:`/search${m?`?q=${encodeURIComponent(m)}`:""}`,children:[e(I,{icon:"chevron-left"})," ",e(u,{id:"N40H+G"})]}),[{label:o({id:"bPwFdf"}),type:"accounts",to:`/search?q=${encodeURIComponent(m)}&type=accounts`},{label:o({id:"VwUsHI"}),type:"hashtags",to:`/search?q=${encodeURIComponent(m)}&type=hashtags`},{label:o({id:"+owNNn"}),type:"statuses",to:`/search?q=${encodeURIComponent(m)}&type=statuses`}].sort(($,ie)=>$.type===f?-1:ie.type===f?1:0).map($=>e(fe,{to:$.to,children:$.label},$.type))]}),m?e(D,{children:[(!f||f==="accounts")&&e(D,{children:[f!=="accounts"&&e("h2",{class:"timeline-header",children:[e(u,{id:"bPwFdf"})," ",e(fe,{to:`/search?q=${encodeURIComponent(m)}&type=accounts`,children:e(I,{icon:"arrow-right",size:"l",alt:o({id:"V1fa9u"})})})]}),w.length>0?e(D,{children:[e("ul",{class:"timeline flat accounts-list",children:w.map($=>e("li",{children:e(ut,{account:$,instance:c,showStats:!0,relationship:H[$.id]})},$.id))}),f!=="accounts"&&e("div",{class:"ui-state",children:e(fe,{class:"plain button",to:`/search?q=${encodeURIComponent(m)}&type=accounts`,children:[e(u,{id:"BMmtZ8"})," ",e(I,{icon:"arrow-right"})]})})]}):!f&&(l==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):e("p",{class:"ui-state",children:e(u,{id:"YYB61U"})}))]}),(!f||f==="hashtags")&&e(D,{children:[f!=="hashtags"&&e("h2",{class:"timeline-header",children:[e(u,{id:"VwUsHI"})," ",e(fe,{to:`/search?q=${encodeURIComponent(m)}&type=hashtags`,children:e(I,{icon:"arrow-right",size:"l",alt:o({id:"V1fa9u"})})})]}),S.length>0?e(D,{children:[e("ul",{class:"link-list hashtag-list",children:S.map($=>{const{name:ie,history:Y}=$,ee=Y?.reduce?.((he,re)=>he+ +re.uses,0);return e("li",{children:e(fe,{to:c?`/${c}/t/${ie}`:`/t/${ie}`,children:[e(I,{icon:"hashtag",alt:"#"}),e("span",{children:ie}),!!ee&&e("span",{class:"count",children:We(ee)})]})},`${ie}-${ee}`)})}),f!=="hashtags"&&e("div",{class:"ui-state",children:e(fe,{class:"plain button",to:`/search?q=${encodeURIComponent(m)}&type=hashtags`,children:[e(u,{id:"Nc/W5J"})," ",e(I,{icon:"arrow-right"})]})})]}):!f&&(l==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):e("p",{class:"ui-state",children:e(u,{id:"4MFM3P"})}))]}),(!f||f==="statuses")&&e(D,{children:[f!=="statuses"&&e("h2",{class:"timeline-header",children:[e(u,{id:"+owNNn"})," ",e(fe,{to:`/search?q=${encodeURIComponent(m)}&type=statuses`,children:e(I,{icon:"arrow-right",size:"l",alt:o({id:"V1fa9u"})})})]}),g.length>0?e(D,{children:[e("ul",{class:"timeline",children:g.map($=>e("li",{children:e(fe,{class:"status-link",to:c?`/${c}/s/${$.id}`:`/s/${$.id}`,children:e(je,{status:$})})},$.id))}),f!=="statuses"&&e("div",{class:"ui-state",children:e(fe,{class:"plain button",to:`/search?q=${encodeURIComponent(m)}&type=statuses`,children:[e(u,{id:"LYCgej"})," ",e(I,{icon:"arrow-right"})]})})]}):!f&&(l==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):e("p",{class:"ui-state",children:e(u,{id:"Hzi9AA"})}))]}),!!f&&(l==="default"?v?e(Tt,{onChange:$=>{$&&W()},children:e("button",{type:"button",class:"plain block",onClick:()=>W(),style:{marginBlockEnd:"6em"},children:e(u,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(u,{id:"2EYeAZ"})}):l==="loading"&&e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}))]}):l==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):e(D,{children:[e("p",{class:"ui-state insignificant",children:e(u,{id:"fGn1Hk"})}),e(ad,{})]})]})]})})}const rd=20,Ro=10*60*1e3,ld=yt(n=>n.v1.trends.links.list().values().next(),{maxAge:Ro}),dd=yt(n=>n.v1.trends.tags.list().values().next(),{maxAge:Ro});function ud(n){return Xe("@pixelfed/trending")?n.pixelfed.v2.discover.posts.trending.list({range:"daily"}).values():n.v1.trends.statuses.list({limit:rd}).values()}function hd(n,i){return n.v1.timelines.link.list(i).values()}function Lo({columnMode:n,...i}){const{_:o}=ce(),s=Ge(E),a=n?{}:Nt(),{masto:c,instance:p}=se({instance:i?.instance||a.instance}),{masto:l,instance:d}=se(),r=o({id:"cI3UEs",values:{instance:p}});Qe(r,"/:instance?/trending");const h=q(),m=p===d,[f,y]=R([]),[v,C]=R([]),k=q();async function b(Q){if(Q||!k.current){if(k.current=ud(c),Xe("@mastodon/trending-hashtags"))try{const{value:K}=await dd(c);K?.length&&y(K)}catch{}if(Xe("@mastodon/trending-links"))try{const{value:K}=await ld(c,p),pe=K?.filter?.($=>$.type==="link");pe?.length&&C(pe)}catch{}}const V=await k.current.next();let{value:j}=V;return j?.length&&(Q&&(h.current=j[0].id),j.forEach(K=>{Je(K,p)})),{...V,value:j}}const[g,_]=R(!1),w=q(),[A,S]=R(null),T=!!A,M=q(),L=m&&Xe("@mastodon/trending-link-posts");G(()=>{A&&M.current&&M.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[A]);const H=q();async function F(Q){(Q||!w.current)&&(_(!0),w.current=hd(c,{url:A})),H.current=A;const V=await w.current.next();let{value:j}=V;return j?.length&&(j=qt(j,"public"),j.forEach(K=>{Je(K,p)})),H.current===A&&_(!1),{...V,value:j}}async function U(){try{const Q=await c.v1.trends.statuses.list({limit:1}).values().next();let{value:V}=Q;return V=qt(V,"public"),V?.length&&V[0].id!==h.current?(h.current=V[0].id,!0):!1}catch{return!1}}const W=ke(()=>e(D,{children:[!!f.length&&e("div",{class:"filter-bar expandable",children:[e(I,{icon:"chart",class:"insignificant",size:"l"}),f.map((Q,V)=>{const{name:j,history:K}=Q,pe=K.reduce(($,ie)=>$+ +ie.uses,0);return e(fe,{to:`/${p}/t/${j}`,children:[e("span",{dir:"auto",children:[e("span",{class:"more-insignificant",children:"#"}),j]}),e("span",{class:"filter-count",children:We(pe)})]},j)})]}),!!v.length&&e("div",{class:"links-bar",children:[e("header",{children:e("h3",{children:e(u,{id:"9veeTb"})})}),v.map(Q=>{const{authors:V,authorName:j,authorUrl:K,blurhash:pe,description:$,height:ie,image:Y,imageDescription:ee,language:he,providerName:re,providerUrl:J,publishedAt:Ce,title:ve,url:ye,width:Ne}=Q,Se=V?.[0]?.account?.id?V[0].account:null,Ae=ve.length<30,xe=!!(j||Se),Pe=wi(ye);let ze;if(pe){const Be=xi(pe),Ye=qi(Be);ze=Bi([.6,Ye[1],Ye[2]])}return e("div",{children:[e("a",{ref:A===ye?M:null,href:ye,target:"_blank",rel:"noopener",class:`link-block ${T?A===ye?"active":"inactive":""}`,style:ze?{"--accent-color":`rgb(${ze.join(",")})`,"--accent-alpha-color":`rgba(${ze.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:Y,alt:ee,width:Ne,height:ie,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:Pe})," ",!!Ce&&e(D,{children:"· "}),!!Ce&&e(D,{children:e(Ct,{datetime:Ce,format:"micro"})})]}),!!ve&&e("h1",{class:"title",lang:he,dir:"auto",title:ve,children:ve})]}),!!$&&e("p",{class:`description ${xe&&!Ae?"":"more-lines"}`,lang:he,dir:"auto",title:$,children:$}),xe&&e(D,{children:[e("hr",{}),e("p",{class:"byline",children:e("small",{children:e(u,{id:"aavdrC",values:{0:Se?e(mt,{account:Se,showAvatar:!0}):K?e("a",{href:K,target:"_blank",rel:"noopener",children:j}):j}})})})]})]})]})}),L&&e("button",{type:"button",class:"small plain4 block",onClick:()=>{S(ye)},disabled:ye===A,children:[e(I,{icon:"comment2"})," ",e("span",{children:e(u,{id:"/bZzdR"})})," ",e(I,{icon:"chevron-down"})]})]},ye)})]}),L&&!!v.length&&e("div",{class:`timeline-header-block ${T?"blended":""}`,children:T?e(D,{children:[e("div",{style:{width:50,flexShrink:0,textAlign:"center"},children:g?e(Oe,{abrupt:!0}):e("button",{type:"button",class:"light",onClick:()=>{S(null)},children:e(I,{icon:"x",alt:o({id:"9Q/4xJ"})})})}),e("p",{children:e(u,{id:"BATCqf",values:{0:A.replace(/^https?:\/\/(www\.)?/i,"").replace(/\/$/,"")},components:{0:e("span",{class:"link-text"})}})})]}):e("p",{class:"insignificant",children:e(u,{id:"Vosm4k"})})})]}),[f,v,A,g]);return e(Et,{title:r,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:e(u,{id:"4/iCqx"})}),e("div",{children:p})]}),id:"trending",instance:p,emptyText:o({id:"6HA9+s"}),errorText:o({id:"scd9lw"}),fetchItems:T?F:b,checkForUpdates:T?void 0:U,checkForUpdatesInterval:5*60*1e3,useItemID:!0,headerStart:e(D,{}),boostsCarousel:s.settings.boostsCarousel,filterContext:"public",timelineStart:W,refresh:A,clearWhenRefresh:!0,view:T?"link-mentions":void 0,headerEnd:e(lt,{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(ge,{onClick:()=>{let Q=prompt(o({id:"2MQ2cd"}));if(!/\./.test(Q)){Q&&alert(o({id:"7WddtO"}));return}Q&&(Q=Q.toLowerCase().trim(),location.hash=`/${Q}/trending`)},children:[e(I,{icon:"bus"})," ",e("span",{children:e(u,{id:"Sq04Yc"})})]}),d!==p&&e(ge,{onClick:()=>{location.hash=`/${d}/trending`},children:[e(I,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(u,{id:"iAzCp4",values:{currentInstance:d},components:{0:e("b",{})}})})]})]})},p)}const Ss={block:"nearest",inline:"nearest",behavior:"smooth"};function pd(){const{_:n}=ce();Qe(n({id:"i0qMbr"}),"/");const i=Ge(E),{shortcuts:o}=i,s=o.map(a=>{if(!a)return null;const{type:c,...p}=a,l={following:Ki,notifications:xo,list:bo,public:fi,bookmarks:mo,favourites:go,hashtag:yo,mentions:Co,trending:Lo,search:Eo}[c];return!l||c==="search"&&!p.query||c==="list"&&!p.id?null:e(l,{...p,columnMode:!0},c+JSON.stringify(p))});return Fe(["1","2","3","4","5","6","7","8","9"],a=>{try{const c=parseInt(a.key,10)-1,p=document.querySelectorAll("#columns > *")[c];p&&(p.focus(),p.scrollIntoView(Ss))}catch{}},{useKey:!0,ignoreEventWhen:a=>a.metaKey||a.ctrlKey||a.altKey||a.shiftKey}),Fe(["[","]"],(a,c)=>{const p=c.keys[0],l=document.activeElement.closest("#columns > *"),d=zt(),r=d?"]":"[",h=d?"[":"]";let m;p===r?m=l?l.previousElementSibling:document.querySelectorAll("#columns > *")[0]:p===h&&(m=l?l.nextElementSibling:document.querySelectorAll("#columns > *")[1]),m&&(m.focus(),m.scrollIntoView(Ss))},{useKey:!0,ignoreEventWhen:a=>a.metaKey||a.ctrlKey||a.altKey||a.shiftKey}),e("div",{id:"columns",onContextMenu:a=>{a.target.closest(".deck > header")&&!a.target.closest("a")&&!a.target.closest("button")&&(a.preventDefault(),E.showShortcutsSettings=!0)},onFocus:()=>{const a=document.activeElement.closest("#columns > *");a&&document.querySelectorAll("#columns > *").forEach(c=>{c.classList.toggle("focus",c===a)})},children:s})}function fd(){const{_:n}=ce(),i=Ge(E);return __BENCHMARK.end("time-to-home"),G(()=>{(async()=>{const o=await gt.drafts.keys();if(o.length){const s=$n();o.filter(c=>c.startsWith(s)).length&&(E.showDrafts=!0)}})()},[]),e(D,{children:(i.settings.shortcutsViewMode==="multi-column"||!i.settings.shortcutsViewMode&&i.settings.shortcutsColumnsMode)&&i.shortcuts?.length?e(pd,{}):e(Ki,{title:n({id:"i0qMbr"}),path:"/",id:"home",headerStart:!1,headerEnd:e(md,{})})})}function md(){const{_:n}=ce(),i=Ge(E),o=q(),[s,a]=R(void 0);return e(D,{children:[e(fe,{ref:o,to:"/notifications",class:`button plain notifications-button ${i.notificationsShowNew?"has-badge":""} ${s||""}`,onClick:c=>{c.stopPropagation(),window.matchMedia("(min-width: calc(40em))").matches&&(c.preventDefault(),a(p=>p?void 0:"open"))},children:e(I,{icon:"notification",size:"l",alt:n({id:"iDNBZe"})})}),e(vd,{state:s,anchorRef:o,onClose:()=>a(void 0)})]})}const gd=5;function vd({anchorRef:n,state:i,onClose:o}){const{masto:s,instance:a}=se(),c=Ge(E),[p,l]=R("default"),d=Ao();async function r(){const k=await d.next(),b=So(k.value);if(b?.length){b.forEach(_=>{Je(_.status,a,{skipThreading:!0})});const g=To(b);E.notificationsLast=g[0],E.notifications=g,s.v1.markers.create({notifications:{lastReadId:g[0].id}}).catch(()=>{})}return E.notificationsShowNew=!1,E.notificationsLastFetchTime=Date.now(),k}const[h,m]=R(!1);function f(){return s.v1.followRequests.list({limit:1})}function y({skipFollowRequests:k=!1}={}){l("loading"),(async()=>{try{if(await r(),!k){const b=await f();m(!!b?.length)}l("default")}catch{l("error")}})()}const v=q(),C=52;return G(()=>{i==="open"&&(c.notificationsShowNew?v.current?.scrollTop<=C&&y({skipFollowRequests:!0}):y())},[i,c.notificationsShowNew]),e(Ti,{ref:v,menuClassName:"notifications-menu",state:i,anchorRef:n,onClose:o,portal:{target:document.body},containerProps:{onClick:()=>{v.current?.closeMenu?.()}},overflow:"auto",viewScroll:"close",position:"anchor",align:"center",boundingBoxPadding:"8 8 8 8",children:[e("header",{children:e("h2",{children:e(u,{id:"iDNBZe"})})}),e(Hn.Provider,{value:"notifications",children:e("main",{children:c.notifications.length?e(D,{children:c.notifications.slice(0,gd).map(k=>e(un,{instance:a,notification:k,disableContextMenu:!0},k._ids||k.id))}):p==="loading"?e("div",{class:"ui-state",children:e(Oe,{abrupt:!0})}):p==="error"&&e("div",{class:"ui-state",children:[e("p",{children:e(u,{id:"5GFQTh"})}),e("p",{children:e("button",{type:"button",onClick:y,children:e(u,{id:"KDw4GX"})})})]})})}),e("footer",{children:[e(fe,{to:"/mentions",class:"button plain",children:[e(I,{icon:"at"})," ",e("span",{children:e(u,{id:"/bZzdR"})})]}),e(fe,{to:"/notifications",class:"button plain2",children:[h?e(u,{id:"OdVhdR",components:{0:e("span",{class:"tag collapsed"}),1:e("span",{})}}):e("b",{children:e(u,{id:"gukqfD"})})," ",e(I,{icon:"arrow-right"})]})]})]})}const yd=ot(fd),bd=[/^\/@[^@\/]+\/(?:statuses|posts)\/([^\/]+)/i,/\/notes\/([^\/]+)/i,/^\/(?:notice|objects)\/([a-z0-9-]+)/i,/\/@[^@\/]+\/post\/([^\/]+)/i,/\/@[^@\/]+@?[^\/]+?\/([^\/]+)/i,/^\/p\/[^\/]+\/([^\/]+)/i];function Mo(n){const i=URL.parse(n);if(!i)return{};const{hostname:o,pathname:s}=i;for(const a of bd){const[,c]=s.match(a)||[];if(c)return{instance:o,id:c}}return{}}function wd(n){const{instance:i,id:o}=Mo(n);return i&&o?`/${i}/s/${o}`:null}function kd(){const i=Qt().pathname.replace(/^\//,""),o=Mo(i),s=o?.instance?`/${o.instance}/s/${o.id}`:null,[a,c]=R("loading");return St(()=>{c("loading"),(async()=>{try{const{instance:p,id:l}=o;if(l){const{masto:d}=se({instance:p});if(await d.v1.statuses.$select(l).fetch()){window.location.hash=s+"?view=full";return}}}catch{}{const{masto:p,instance:l}=se(),d=await p.v2.search.list({q:i,limit:1,resolve:!0});if(d.statuses.length){const r=d.statuses[0];window.location.hash=`/${l}/s/${r.id}?view=full`}else if(d.accounts.length){const r=d.accounts[0];window.location.hash=`/${l}/a/${r.id}`}else s?window.location.hash=s+"?view=full":c("error")}})()},[s]),e("div",{class:"ui-state",tabIndex:"-1",children:[a==="loading"?e(D,{children:[e(Oe,{abrupt:!0}),e("h2",{children:e(u,{id:"RTAr/z"})}),e("p",{children:e("a",{href:i,target:"_blank",rel:"noopener",children:i})})]}):e(D,{children:[e("h2",{children:e(u,{id:"ufzZSJ"})}),e("p",{children:e("a",{href:i,target:"_blank",rel:"noopener",children:i})})]}),e("hr",{}),e("p",{children:e(fe,{to:"/",children:e(u,{id:"iWpEwy"})})})]})}function Sd(){const{_:n}=ce();Qe(n({id:"h16FyT"}),"/l");const[i,o]=R("default"),[s,a]=xt(h=>h+1,0),[c,p]=R([]);G(()=>{o("loading"),(async()=>{try{const h=await hi();p(h),o("default")}catch{o("error")}})()},[s]);const[l,d]=R(!1),r=c.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(Pt,{}),e(fe,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l"})})]}),e("h1",{children:e(u,{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:c.length>0?e(D,{children:[e("ul",{class:"link-list",children:c.map(h=>e("li",{children:e(fe,{to:`/l/${h.id}`,children:[e(I,{icon:"list"})," ",e("span",{children:[h.title,h.exclusive&&e(D,{children:[" ",e(Kt,{insignificant:!0})]})]})]})}))}),c.length>1&&e("footer",{class:"ui-state",children:[r&&e("p",{children:e("small",{class:"insignificant",children:[e(Kt,{})," ",e(u,{id:"FNptcJ"})]})}),e("p",{children:e("small",{class:"insignificant",children:e(u,{id:"8prZNK",values:{0:c.length}})})})]})]}):i==="loading"?e("p",{class:"ui-state",children:e(Oe,{})}):i==="error"?e("p",{class:"ui-state",children:e(u,{id:"v/l5uA"})}):e("p",{class:"ui-state",children:e(u,{id:"IvPikw"})})})]}),l&&e(Ue,{onClick:h=>{h.target===h.currentTarget&&d(!1)},children:e(Fi,{list:l?.list,onClose:h=>{h.state==="success"&&a(),d(!1)}})})]})}const Cd=""+new URL("instances-Dd-nff5Z.json",import.meta.url).href,_d={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}=_d;function Ad(){const{_:n}=ce();Qe(n({id:"sQia9P"}),"/login");const i=q(),o=Te.local.get("instanceURL"),[s,a]=R("default"),[c]=bt(),p=c.get("instance"),l=c.get("submit"),[d,r]=R(p||o?.toLowerCase()||""),[h,m]=R([]),f=q();G(()=>{(async()=>{try{const w=await(await fetch(Cd)).json();m(w),f.current=new ka(w)}catch{}})()},[]);const y=_=>{_&&(async()=>{try{const A=await(await fetch(`https://${_}/.well-known/host-meta`)).text(),L=new DOMParser().parseFromString(A,"text/xml").getElementsByTagName("Link")[0].getAttribute("template"),H=URL.parse(L),{host:F}=H;_!==F&&(_=F)}catch{}Te.local.set("instanceURL",_),a("loading");try{let w=Ds(_);(!w||!w.client_id||!w.client_secret)&&(w=await ec({instanceURL:_}),Go(_,w));const{client_id:A,client_secret:S}=w,T=await Ga({instanceURL:_}),M=Wo(_);if(T)if(A&&S){const[L,H]=await tc({instanceURL:_,client_id:A,forceLogin:M});Te.sessionCookie.set("codeVerifier",H),location.href=L}else alert(n({id:"ZP1FIA"}));else A&&S?location.href=await nc({instanceURL:_,client_id:A,forceLogin:M}):alert(n({id:"ZP1FIA"}));a("default")}catch{a("error")}})()},v=d?d.replace(/^https?:\/\//,"").replace(/\/+$/,"").replace(/^@?[^@]+@/,"").trim():null,C=/[^\s\r\n\t\/\\]+\.[^\s\r\n\t\/\\]+/.test(v)&&!/[\s\/\\@]/.test(v),k=v?f.current?.search(v,{limit:10})?.map(_=>_.item):[],b=C?v:k?.length?k[0]:d?h.find(_=>_.includes(d)):null,g=_=>{_.preventDefault(),y(b)};return l&&G(()=>{y(p||b)},[]),e("main",{id:"login",style:{textAlign:"center"},children:e("form",{onSubmit:g,children:[e("h1",{children:[e("img",{src:Di,alt:"",width:"80",height:"80"}),e("br",{}),e(u,{id:"sQia9P"})]}),e("label",{children:[e("p",{children:e(u,{id:"kyAi7k"})}),e("input",{value:d,required:!0,type:"text",class:"large",id:"instanceURL",ref:i,disabled:s==="loading",autocorrect:"off",autocapitalize:"off",autocomplete:"off",spellCheck:!1,placeholder:n({id:"u3gOdY"}),onInput:_=>{r(_.target.value)},dir:"auto"}),k?.length>0?e("ul",{id:"instances-suggestions",children:k.map((_,w)=>e("li",{children:e("button",{type:"button",class:"plain5",onClick:()=>{y(_)},children:_})}))}):e("div",{id:"instances-eg",children:e(u,{id:"/OvbEC"})})]}),s==="error"&&e("p",{class:"error",children:e(u,{id:"rmBHZn"})}),e("div",{children:[e("button",{disabled:s==="loading"||!d||!b,children:n(b?{id:"2xahsi",values:{selectedInstanceText:b}}:{id:"xGVfLh"})})," "]}),e(Oe,{hidden:s!=="loading"}),e("hr",{}),!Id&&e("p",{children:e("a",{href:"https://joinmastodon.org/servers",target:"_blank",children:e(u,{id:"LcOiWS"})})}),e("p",{children:e(fe,{to:"/",children:e(u,{id:"iWpEwy"})})}),e(Oi,{})]})})}const Td=40;function xd(){const{_:n}=ce(),i=Ge(E);Qe(n({id:"+GkIdc"}),"/sp");const{masto:o}=se(),[s,a]=R([]),[c,p]=R("default"),[l,d]=xt(m=>m+1,0),[r,h]=R(!1);return G(d,[i.reloadScheduledPosts]),G(()=>{p("loading"),(async()=>{try{const m=o.v1.scheduledStatuses.list({limit:Td}).values(),f=[];let y;do y=(await m.next()).value,y?.length&&f.push(...y);while(y?.length);a(f)}catch{p("error")}finally{p("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(Pt,{}),e(fe,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l",alt:n({id:"i0qMbr"})})})]}),e("h1",{children:e(u,{id:"+GkIdc"})}),e("div",{class:"header-side",children:e(lt,{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(ge,{onClick:()=>{d()},children:[e(I,{icon:"refresh",size:"l"}),e("span",{children:e(u,{id:"lCF0wC"})})]})})})]})}),e("main",{children:[s.length?e("ul",{class:"posts-list",children:s.map(m=>{const{id:f,params:y,scheduledAt:v,mediaAttachments:C}=m,{inReplyToId:k,language:b,poll:g,sensitive:_,spoilerText:w,text:A,visibility:S,quotedStatusId:T,quoteApprovalPolicy:M}=y,L={id:f,inReplyToId:k,language:b,mediaAttachments:C,poll:g?{...g,expiresAt:new Date(Date.now()+g.expiresIn*1e3),options:g.options.map(H=>({title:H,votesCount:0}))}:void 0,sensitive:_,spoilerText:w,text:A,visibility:S,content:`<p>${A}</p>`,quotedStatusId:T,quoteApprovalPolicy:M};return e("li",{children:e(Ed,{status:L,scheduledAt:v,onClick:()=>{h({post:L,scheduledAt:new Date(v)})}})},f)})}):e("p",{class:"ui-state",children:c==="loading"?e(Oe,{}):n({id:"mZYb1f"})}),r&&e(Ue,{onClick:m=>{m.target===m.currentTarget&&h(!1)},children:e(Rd,{post:r.post,scheduledAt:r.scheduledAt,onClose:()=>h(!1)})})]})]})})}function Ed({status:n,scheduledAt:i,onClick:o}){const s=ke(()=>{const a=(Date.parse(i)-Date.now())/36e5;return a<24?"time":a<720?"day":"month"},[i]);return e("button",{type:"button",class:"textual block",onClick:o,children:[e("div",{class:`post-schedule-meta post-schedule-${s}`,children:[e(I,{icon:s,class:"insignificant"})," ",e("span",{children:e(u,{id:"aEp6lO",values:{0:st(i,{formatOpts:{weekday:"short",second:"numeric"}})},components:{0:e("b",{}),1:e(Ct,{datetime:i}),2:e("small",{})}})})]}),e(je,{status:n,size:"s",previewMode:!0,readOnly:!0})]})}function Rd({post:n,scheduledAt:i,onClose:o}){const{masto:s,instance:a}=se(),{_:c}=ce(),[p,l]=R("default"),[d,r]=R(),h=d&&d.getTime()!==i.getTime(),m=Sa(),f=i&&i<=Date.now(),{inReplyToId:y}=n,[v,C]=R(null),{quotedStatusId:k}=n;return e("div",{id:"scheduled-post-sheet",class:"sheet",children:[e("button",{type:"button",class:"sheet-close",onClick:o,children:e(I,{icon:"x",size:"l",alt:c({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:[e(u,{id:"orjBLU",components:{0:e("b",{}),1:e(Ct,{datetime:i})}}),e("br",{}),e("small",{children:st(i,{formatOpts:{weekday:"short",second:"numeric"}})})]})}),e("main",{tabIndex:"-1",children:[!!v&&e("div",{class:"status-reply",children:e(je,{status:v,size:"s",previewMode:!0,readOnly:!0})}),e(je,{status:n,size:"s",previewMode:!0,readOnly:!0,onMediaClick:(b,g,_,w)=>{b.preventDefault(),E.showMediaModal={mediaAttachments:n.mediaAttachments,mediaIndex:g}}}),e("form",{onSubmit:b=>{b.preventDefault(),l("loading"),(async()=>{try{await s.v1.scheduledStatuses.$select(n.id).update({scheduledAt:d.toISOString()}),le(c({id:"40naR1"})),o(),l("default"),E.reloadScheduledPosts++}catch{l("error"),le(c({id:"ZM3jAs"}))}})()},children:e("footer",{children:[e("div",{class:"row",children:e("span",{children:[e(Ca,{scheduledAt:i,setScheduledAt:b=>{r(b)}})," ",e("small",{class:"ib",children:m})]})}),e("div",{class:"row",children:[e("button",{disabled:!h||p==="loading"||f,children:e(u,{id:"QqW27M"})}),e("span",{class:"grow"}),e(ft,{align:"end",menuItemClassName:"danger",confirmLabel:c({id:"09u3Kk"}),onClick:()=>{l("loading"),(async()=>{try{await se().masto.v1.scheduledStatuses.$select(n.id).remove(),le(c({id:"/zL/Mq"})),o(),l("default"),E.reloadScheduledPosts++}catch{l("error"),le(c({id:"aOh6Md"}))}})()},children:e("button",{type:"button",class:"light danger",disabled:p==="loading"||f,children:e(u,{id:"Jb6/SB"})})})]})]})})]})]})}function Ld(){const{_:n}=ce(),{prevEditedAt:i,nextEditedAt:o,editedAtIndex:s,editHistoryMode:a,editHistoryRef:c,exitEditHistory:p}=Ys();return a?e("div",{class:"edit-history-controls",children:[e(I,{icon:"edit"}),e("b",{class:"edit-history-heading",children:n({id:"HSA2au"})}),e("span",{class:"spacer"}),e("span",{class:"edit-history-pagination",children:[e("button",{type:"button",class:"plain4",onClick:()=>{i()},disabled:!a||s+1>=c.current.length,children:e(I,{icon:"chevron-left",alt:n({id:"DHhJ7s"})})})," ",c.current.length-s," /"," ",c.current.length," ",e("button",{type:"button",class:"plain4",onClick:()=>{o()},disabled:!a||s<=0,children:e(I,{icon:"chevron-right",alt:n({id:"hXzOVo"})})})]}),e("button",{type:"button",class:"plain3",onClick:()=>{p()},children:e(I,{icon:"exit",alt:n({id:"ydzS9x"})})})]}):null}const Md={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:Cs}=Md,kn=40,$d=10,Nd=5;let mi={},xn={},En={};function Rn(n){delete xn[n],delete En[n]}const nn={block:"nearest",inline:"center",behavior:"smooth"},_s=".status-link:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *), .status-focus:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *)",Is=/\/s\//i;function Pd(n){const{id:i}=n,{masto:o,instance:s}=se({instance:n.instance}),a=Ge(E),[c,p]=bt(),l=c.get("media"),d=c.get("media-only"),r=parseInt(l||d,10);let h=r>0;const m=c.get("mediaStatusID"),f=Ps(m,s);m&&!f&&(h=!1);const y=h&&!!d,v=rt(i,s),[C,k]=R(E.statuses[v]);G(()=>{E.statuses[v]&&k(E.statuses[v])},[v]);const b=ke(()=>{const{prevLocation:S}=E,T=(S?.pathname||"")+(S?.search||""),M=cn("/:instance/s/:id",T)||cn("/s/:id",T);return!T||M?"/":T},[]);G(()=>{!C&&h&&(async()=>{try{const S=await o.v1.statuses.$select(i).fetch();Je(S,s),k(S)}catch{alert("Unable to load post."),location.hash=b}})()},[h]);const g=m?a.statuses[rt(m,s)]?.mediaAttachments:C?.mediaAttachments,_=()=>window.matchMedia("(min-width: calc(40em + 350px))").matches?"large":"small",w=tt(()=>{_()==="small"&&a.prevLocation?history.back():y?location.hash=b:(c.delete("media"),c.delete("mediaStatusID"),p(c))},[y,b,a.prevLocation]),A=tt((S,T,M,L)=>{if(_()==="large"&&!y){w();return}if(h&&document.startViewTransition){const H=M[T],{id:F,blurhash:U,url:W}=H,Q=_a(F||U||W),j=[...document.querySelectorAll(`.status .media [data-view-transition-name="${Q}"]`)].filter?.(pe=>{const $=pe.getBoundingClientRect();return $.top<window.innerHeight&&$.bottom>0&&$.left<window.innerWidth&&$.right>0}),K=j.length===1?j[0]:j.find(pe=>!!pe.closest(".status-deck"));K?document.startViewTransition(()=>{K.style.viewTransitionName=Q,L?.current&&L.current.querySelectorAll(".media img, .media video")?.forEach($=>{$.style.viewTransitionName=""}),w()}).ready.finally(()=>{K.style.viewTransitionName="",K.dataset.viewTransitioned=Q}):w()}else w()},[h,y]);return G(()=>{let S=setTimeout(()=>{const T=document.querySelector(".carousel");T&&T.focus()},100);return()=>clearTimeout(S)},[y]),G(()=>{const S=document.querySelectorAll(".deck-container");return S.forEach(T=>{T.setAttribute("inert","")}),()=>{S.forEach(T=>{T.removeAttribute("inert")})}},[]),e("div",{class:"deck-backdrop",children:[h?g?.length?e(uo,{mediaAttachments:g,statusID:m||i,instance:s,lang:C?.language,index:r-1,onClose:A}):e("div",{class:"media-modal-container loading",children:e(Oe,{abrupt:!0})}):e(fe,{to:b}),!y&&e(Ia,{statusID:i,children:e(Od,{id:i,instance:n.instance,closeLink:b})})]})}function Dd(n){const{linkable:i,to:o,onClick:s,...a}=n;return i?e(fe,{class:"status-link",to:o,onClick:s,...a}):e("div",{class:"status-focus",tabIndex:0,...a})}function As(n,i){return Date.parse(n.createdAt)-Date.parse(i.createdAt)}const Ts=1e3*60*60*24*30;function Od({id:n,closeLink:i="/",instance:o}){const{_:s}=ce(),[a,c]=bt(),p=a.get("media"),l=a.get("mediaStatusID"),d=parseInt(p,10)>0,r=q(!E.prevLocation&&(history.length===1||"navigation"in window&&navigation?.entries?.()?.length===1)),[h,m]=R(a.get("view")||r.current?"full":null),f=!!parseInt(a.get("translate")),{masto:y,instance:v}=se({instance:o}),{masto:C,instance:k,authenticated:b}=se(),g=v===k,_=Ge(E),[w,A]=R([]),[S,T]=R("default"),M=q(),L=rt(n,v),H=q(0),F=q();G(()=>{F.current?.focus()},[]),G(()=>{const N=Vs(()=>{if(!F.current)return;const{scrollTop:ae}=F.current;S!=="loading"&&(En[n]=ae)},50);return F.current?.addEventListener("scroll",N,{passive:!0}),N(),()=>{N.cancel(),F.current?.removeEventListener("scroll",N)}},[n,S!=="loading"]);const{editHistoryMode:U,initEditHistory:W,editedAtIndex:Q,editHistoryRef:V}=Ys(),j=q(),K=q(),[pe,$]=R(0),ie=q(null),Y=()=>{if(!ie.current)return;let{ancestors:N,descendants:ae,heroStatus:x}=ie.current;if(U&&ae?.length){const X=V.current[Q],te=Date.parse(X.createdAt),we=V.current[Q-1],$e=we?Date.parse(we.createdAt):null;ae=ae.filter(Ve=>{const at=Date.parse(Ve.editedAt||Ve.createdAt);return at>=te&&(!$e||at<=$e)})}N.sort(As),ae.sort(As),H.current=ae?.length||0;const B=new Set;N.forEach(X=>{Je(X,v,{skipThreading:!0}),X.inReplyToId&&!N.find(te=>te.id===X.inReplyToId)&&B.add(X.inReplyToId)});const Z=N.every(X=>X.account.id===x.account.id),ne=[];ae.forEach(X=>{if(Je(X,v,{}),X.inReplyToId&&!ae.find(te=>te.id===X.inReplyToId)&&X.inReplyToId!==x.id&&B.add(X.inReplyToId),X.inReplyToAccountId===X.account.id)ne.push(X);else if(X.inReplyToId===x.id)ne.push(X);else if(!X.inReplyToAccountId&&ne.find(te=>te.id===X.inReplyToId&&te.account.id===x.account.id)&&X.account.id===x.account.id)ne.push(X);else{const te=ae.find(we=>we.id===X.inReplyToId);te&&(te.__replies||(te.__replies=[]),te.__replies.push(X))}}),ne.sort((X,te)=>{const we=x.account.id;return X.account.id===we&&te.account.id!==we?-1:te.account.id===we&&X.account.id!==we?1:0}),B.size;let z=1;function de(X,te){const we=te+1;return we>z&&(z=te),X?.map($e=>({id:$e.id,account:$e.account,repliesCount:$e.repliesCount,content:$e.content,weight:an($e),level:we,replies:de($e.__replies,we)}))}const _e=ne.map(X=>({id:X.id,account:X.account,accountID:X.account.id,descendant:!0,thread:X.account.id===x.account.id,weight:an(X),level:1,replies:de(X.__replies,1),createdAt:X.createdAt}));return{allStatuses:[...N.map(X=>({id:X.id,ancestor:!0,isThread:Z,accountID:X.account.id,account:X.account,repliesCount:X.repliesCount,weight:an(X),createdAt:X.createdAt})),{id:n,accountID:x.account.id,weight:an(x),createdAt:x.createdAt},..._e],ancestorsIsThread:Z,mappedNestedDescendants:_e}},ee=({reloadHero:N}={})=>{T("loading");let ae;const x=xn[n];if(x){const B=x.filter(Z=>E.statuses[L]);A(B)}else A([{id:n}]);return(async()=>{const B=()=>Wi(()=>y.v1.statuses.$select(n).fetch(),{retries:4}),Z=Wi(()=>y.v1.statuses.$select(n).context.fetch(),{retries:8}),ne=!!_.statuses[L];let z=_.statuses[L];if(!(ne&&!N))try{z=await B(),Je(z,v),await new Promise(de=>{setTimeout(de,100)})}catch{T("error");return}try{const de=await Z,{ancestors:_e}=de;ie.current={...de,heroStatus:z};const{allStatuses:me,ancestorsIsThread:X,mappedNestedDescendants:te}=Y(),we=_e.length&&!X?[]:te.filter(at=>at.thread),$e=(X?_e.length:0)+we.length;$e>0&&$e<100&&$($e+1),T("default"),j.current={offsetTop:M.current?.offsetTop,scrollTop:F.current?.scrollTop};const Ve=_e.length||0;Ve>=Se&&Ae(Ve+1),A(me),xn[n]=me,Zo(z,v)}catch{T("error")}})(),K.current=Date.now(),()=>{clearTimeout(ae)}};G(ee,[n,y]),G(()=>{try{const{allStatuses:N}=Y();A(N)}catch{}},[U,Q]);const[he,re]=R(!1);G(()=>{let N=setInterval(()=>{const ae=Date.now();K.current&&ae-K.current>=6e4&&re(!0)},6e4);return()=>{clearInterval(N)}},[]),St(()=>{if(!w.length)return;const N=En[n];if(N)F.current.scrollTop=N;else if(j.current){const ae={offsetTop:M.current?.offsetTop,scrollTop:F.current?.scrollTop},x=ae.offsetTop-j.current.offsetTop+ae.scrollTop;F.current.scrollTop=x}else w.length===1&&(F.current.scrollTop=0);j.current=null},[w]),G(()=>{_.reloadStatusPage<=0||(async()=>{try{const{instanceURL:N}=Si(),ae=`https://${N}/api/v1/statuses/${n}/context`;return await(await caches.open("api")).delete(ae,{ignoreVary:!0}),ee({reloadHero:!0})}catch{}})()},[_.reloadStatusPage]),G(()=>()=>{En={},E.reloadStatusPage=0,xn={},mi={},gi.clear()},[]);const J=_.statuses[L]||_.statuses[n],Ce=ke(()=>{if(!J)return"";const{account:N}=J,ae=document.createElement("div");return ae.innerHTML=N.displayName,ae.innerText.trim()},[J]),ve=ke(()=>{if(!J)return"";let N=Un(J);return N.length>64&&(N=N.slice(0,64)+"…"),N},[J]);Qe(Ce&&ve?`${Ce}: "${ve}"`:s({id:"post.title"}),"/:instance?/s/:id");const ye=ke(()=>{if(!J)return;const{url:N}=J;if(N)return URL.parse(N)?.hostname},[J]),Ne=ke(()=>{if(ye)return ye===v},[ye,v]),[Se,Ae]=R(kn),xe=ke(()=>w.length-Se,[w.length,Se]),Pe=w.some(N=>N.descendant),ze=w.filter(N=>N.ancestor),[Be,Ye]=R(!0),oe=ke(()=>{if(!M.current||Be)return null;const{top:N}=M.current.getBoundingClientRect();return N>0?"down":"up"},[Be]);Fe("esc",()=>{location.hash=i},{enabled:!d,ignoreEventWhen:N=>!!document.querySelector("#modal-container > *")||N.metaKey||N.ctrlKey||N.altKey||N.shiftKey,useKey:!0}),Fe("backspace",()=>{location.hash=i},{useKey:!0,ignoreEventWhen:N=>N.metaKey||N.ctrlKey||N.altKey||N.shiftKey}),Fe("j",()=>{const N=document.activeElement.closest(".status-link, .status-focus"),ae=N?.getBoundingClientRect(),x=Array.from(F.current.querySelectorAll(_s));if(N&&ae.top<F.current.clientHeight&&ae.bottom>0){const B=x.indexOf(N);let Z=x[B+1];Z&&(Z.focus(),Z.scrollIntoView(nn))}else{const B=x.find(Z=>{const ne=Z.getBoundingClientRect();return ne.top>=44&&ne.left>=0});B&&(B.focus(),B.scrollIntoView(nn))}},{useKey:!0,ignoreEventWhen:N=>N.metaKey||N.ctrlKey||N.altKey||N.shiftKey}),Fe("k",()=>{const N=document.activeElement.closest(".status-link, .status-focus"),ae=N?.getBoundingClientRect(),x=Array.from(F.current.querySelectorAll(_s));if(N&&ae.top<F.current.clientHeight&&ae.bottom>0){const B=x.indexOf(N);let Z=x[B-1];Z&&(Z.focus(),Z.scrollIntoView(nn))}else{const B=x.find(Z=>{const ne=Z.getBoundingClientRect();return ne.top>=44&&ne.left>=0});B&&(B.focus(),B.scrollIntoView(nn))}},{useKey:!0,ignoreEventWhen:N=>N.metaKey||N.ctrlKey||N.altKey||N.shiftKey}),Fe("x",()=>{const N=document.activeElement.closest(".status-link, .status-focus");if(N){const ae=N.nextElementSibling;ae&&ae.tagName.toLowerCase()==="details"&&(ae.open=!ae.open)}},{useKey:!0,ignoreEventWhen:N=>N.metaKey||N.ctrlKey||N.altKey||N.shiftKey});const[Le,Re]=R(!1),O=q(d?"media+status":"status"),Ie=tt((N,ae,x,B)=>{N.preventDefault(),N.stopPropagation(),c({media:ae+1,mediaStatusID:B.id})},[n]),Me=tt((N,ae)=>{Rn(ae.id)},[]);G(()=>{let N;return l&&d&&(N=setTimeout(()=>{const ae=F.current?.querySelector(`.status-link[href*="/${l}"]`);ae&&ae.scrollIntoView(nn)},400)),()=>{clearTimeout(N)}},[l,d]);const Ee=tt((N,ae)=>{const{id:x,ancestor:B,isThread:Z,descendant:ne,thread:z,replies:de,repliesCount:_e,weight:me,level:X}=N,te=x===n;return e("li",{ref:te?M:null,class:`${B?"ancestor":""} ${ne?"descendant":""} ${z?"thread":""} ${te?"hero":""}`,children:[te?e(D,{children:[e(Tt,{threshold:.1,onChange:$e=>{queueMicrotask(()=>{requestAnimationFrame(()=>{Ye($e)})})},class:"status-focus",tabIndex:0,children:e(je,{statusID:x,instance:v,withinContext:!0,size:"l",enableTranslate:!0,forceTranslate:f})}),S!=="loading"&&!b?e("div",{class:"post-status-banner",children:[e("p",{children:e(u,{id:"Vyeh4F"})}),e(fe,{to:Cs?`/login?instance=${Cs}&submit=1`:"/login",class:"button",children:e(u,{id:"sQia9P"})})]}):!g&&e("div",{class:"post-status-banner",children:[e("p",{children:e(u,{id:"j5roNG",values:{instance:v},components:{0:e("b",{})}})}),e("button",{type:"button",disabled:S==="loading",onClick:()=>{T("loading"),(async()=>{try{const $e=await C.v2.search.list({q:J.url,type:"statuses",resolve:!0,limit:1});if($e.statuses.length){const Ve=$e.statuses[0];location.hash=k?`/${k}/s/${Ve.id}`:`/s/${Ve.id}`}else throw new Error("No results")}catch($e){T("default"),alert(s({id:"DnepCE",values:{e:$e}}))}})()},children:[e(I,{icon:"transfer"})," ",e(u,{id:"ejAVrO"})]})]})]}):e(Dd,{linkable:Z||B,to:v?`/${v}/s/${x}`:`/s/${x}`,onClick:()=>{Rn(x)},children:[ae===0&&B?e(Tt,{threshold:.5,onChange:$e=>{queueMicrotask(()=>{requestAnimationFrame(()=>{Re($e)})})},children:e(je,{statusID:x,instance:v,withinContext:!0,size:z||B?"m":"s",enableTranslate:!0,onMediaClick:Ie,onStatusLinkClick:Me})}):e(je,{statusID:x,instance:v,withinContext:!0,size:z||B?"m":"s",enableTranslate:!0,onMediaClick:Ie,onStatusLinkClick:Me,showActionsBar:!!ne}),B&&_e>1&&e("div",{class:"replies-link",children:[e(I,{icon:"comment2",alt:s({id:"N8UzTV"})})," ",e("span",{title:_e,children:We(_e)})]})," "]}),ne&&de?.length>0&&e($o,{instance:v,replies:de,hasParentThread:z,level:X,accWeight:me,openAll:H.current<$d,parentLink:{to:v?`/${v}/s/${x}`:`/s/${x}`,onClick:()=>Rn(x)}}),S==="loading"&&te&&!!J?.repliesCount&&!Pe&&e("div",{class:"status-loading",children:e(Oe,{abrupt:J.repliesCount>=3})}),S==="error"&&te&&!!J?.repliesCount&&!Pe&&e("div",{class:"status-error",children:[e(u,{id:"HQJU6W"}),e("br",{}),e("button",{type:"button",class:"plain",onClick:()=>{E.reloadStatusPage++},children:e(u,{id:"KDw4GX"})})]})]},x)},[n,v,S,b,g,f,Ie,Me,Pe]),P=ke(()=>{if("navigation"in window&&navigation?.entries){const N=navigation.entries()[navigation.currentEntry.index-1];if(N?.url)return Is.test(N.url)}return Is.test(E.prevLocation?.pathname)},[L]),be=ke(()=>{if(!xe)return[];const N=[];function ae(x){N.push(x.id),x.replies&&x.replies.forEach(ae)}return w.slice(Se).forEach(ae),N.map(x=>rt(x,v))},[xe,w,Se,v]);function qe(N){if(N<12)return ue._({id:"DqsEm+",values:{months:N}});{const ae=Math.floor(N/12);return ue._({id:"24w+FD",values:{years:ae}})}}const De=ke(()=>{const N=[],ae=w.slice(0,Se);for(let x=0;x<ae.length;x++){const B=ae[x];if(x>0){const Z=ae[x-1],{createdAt:ne,descendant:z,thread:de,id:_e}=B;if(Z?.createdAt&&ne){const me=Date.parse(ne);if(isFinite(me)&&me>Ts){const X=Date.parse(Z.createdAt);if(X&&isFinite(X)){const{ancestor:te,id:we}=Z,Ve=~~((me-X)/Ts);Ve>0&&N.push(e("li",{style:{"--time-gap-range":Math.min(12,Ve)},class:`time-gap ${te?"ancestor":""} ${z?"descendant":""} ${de?"thread":""}`,children:qe(Ve)},`time-gap-${_e}-${we}`))}}}}N.push(Ee(B,x))}return N},[w,Se,Ee,U,Q]);return G(()=>{let N=setTimeout(()=>{if(!M.current)return;const ae=M.current.querySelector(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)");ae&&ae.click()},1e3);return()=>clearTimeout(N)},[n]),e(Aa.Provider,{value:pe,children:e("div",{tabIndex:"-1",ref:F,class:`status-deck deck contained ${w.length>1?"padded-bottom":""} ${O.current==="status"&&!r.current?"slide-in":""} ${h?`deck-view-${h}`:""} ${U?"edit-history-mode":""}`,style:U?{"--edit-history-percentage":`${Q/(V.current.length-1)}`}:void 0,onAnimationEnd:N=>{O.current==="status"&&(O.current=null)},children:[e("header",{class:`${S==="loading"?"loading":""}`,onDblClick:N=>{E.reloadStatusPage++},children:e("div",{class:"header-grid header-grid-2",children:[e("h1",{children:[P&&e("button",{type:"button",class:"plain deck-back",onClick:()=>{history.back()},children:e(I,{icon:"chevron-left",size:"xl",alt:s({id:"iH8pgl"})})}),!Be&&J&&S!=="loading"?e(D,{children:[e("span",{class:"hero-heading",children:[e(mt,{account:J.account,instance:v,showAvatar:!0,short:!0})," ",e("span",{class:"insignificant",children:["•"," ",e(Ct,{datetime:J.createdAt,format:"micro"})]})]})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:N=>{N.preventDefault(),N.stopPropagation(),M.current.scrollIntoView({behavior:"smooth",block:"start"})},title:s({id:"NCy+Nw"}),children:e(I,{icon:oe==="down"?"arrow-down":"arrow-up"})})]}):e(D,{children:[e(u,{id:"post.title"})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:N=>{N.preventDefault(),N.stopPropagation(),F.current.scrollTo({top:0,behavior:"smooth"})},hidden:!ze.length||Le,title:s({id:"R8CUl0",values:{0:ze.length}}),children:[e(I,{icon:"arrow-up"}),ze.filter((N,ae,x)=>x.findIndex(B=>B.accountID===N.accountID)===ae).slice(0,3).map(N=>e(pt,{url:N.account.avatarStatic||N.account.avatar,alt:N.account.displayName,squircle:N.account?.bot},N.account.id)),ze.length>3&&e(D,{children:[" ",e("span",{class:"insignificant",children:We(ze.length)})]})]})]})]}),e("div",{class:"header-side",children:[e("button",{type:"button",class:"plain4 button-switch-view",style:{display:h==="full"?"":"none"},onClick:()=>{m(null),a.delete("media"),a.delete("media-only"),a.delete("view"),c(a)},title:s({id:"+/xYEI"}),children:e(I,{icon:"layout4",size:"l"})}),he&&e("button",{type:"button",class:"plain button-refresh",onClick:()=>{E.reloadStatusPage++,re(!1)},children:e(I,{icon:"refresh",size:"l",alt:s({id:"lCF0wC"})})}),e(lt,{align:"end",portal:{target:F.current},menuButton:e("button",{type:"button",class:"button plain4",children:e(I,{icon:"more",alt:s({id:"2FYpfJ"}),size:"xl"})}),children:[e(ge,{disabled:S==="loading",onClick:()=>{E.reloadStatusPage++},children:[e(I,{icon:"refresh"}),e("span",{children:e(u,{id:"lCF0wC"})})]}),e(ge,{className:"menu-switch-view",onClick:()=>{m(h==="full"?null:"full"),a.delete("media"),a.delete("media-only"),h==="full"?a.delete("view"):a.set("view","full"),c(a)},children:[e(I,{icon:{"":"layout5",full:"layout4"}[h||""]}),e("span",{children:s(h==="full"?{id:"+/xYEI"}:{id:"2LiWsE"})})]}),e(ge,{onClick:()=>{Array.from(F.current.querySelectorAll(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)")).forEach(ae=>{ae.click()})},children:[e(I,{icon:"eye-open"})," ",e("span",{children:e(u,{id:"8r8KmB"})})]}),e(He,{}),e(Ei,{className:"plain",children:e(u,{id:"Rsjgm0"})}),e(ge,{disabled:!ye||Ne,onClick:()=>{const N=wd(J.url);N?location.hash=N:alert(s({id:"9J6biQ"}))},children:[e(I,{icon:"transfer"}),e("small",{class:"menu-double-lines",children:s(ye?{id:"Kp9SAs",values:{0:qn.toUnicode(ye)}}:{id:"lb07+k"})})]}),e(ge,{disabled:!g||S==="loading"||!J?.editedAt||!H.current,onClick:W,children:[e(I,{icon:"edit"}),e("span",{children:s({id:"OqaQnE"})})]})]}),e(fe,{class:"button plain deck-close",to:i,children:e(I,{icon:"x",size:"xl",alt:s({id:"yz7wBu"})})})]})]})}),e(Ld,{}),w.length&&J?e("ul",{class:`timeline flat contextual grow ${S==="loading"?"loading":""}`,children:[De,xe>0&&e("li",{class:"descendant descendant-more",children:e("button",{type:"button",class:"plain block show-more",disabled:S==="loading",onClick:()=>Ae(N=>N+kn),style:{marginBlockEnd:"6em"},"data-state-post-ids":be.join(" "),children:[e("div",{class:"ib avatars-bunch",children:w.slice(Se,Se+5).map(N=>e(pt,{url:N.account.avatarStatic},N.id))})," ",e("div",{class:"ib",children:[e(u,{id:"uXRAkV"})," ",e("span",{class:"tag",children:xe>kn?`${kn}+`:xe})]})]})})]}):e(D,{children:[S==="loading"&&e("ul",{class:"timeline flat contextual grow loading",children:e("li",{children:e(je,{skeleton:!0,size:"l"})})}),S==="error"&&e("p",{class:"ui-state",children:[e(u,{id:"JWxodU"}),e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>{E.reloadStatusPage++},children:e(u,{id:"KDw4GX"})})]})]})]})})}function $o({replies:n,instance:i,hasParentThread:o,level:s,accWeight:a,openAll:c,parentLink:p}){const{_:l}=ce(),[d,r]=bt(),h=T=>T.reduce((M,L)=>{const{repliesCount:H,replies:F}=L,U=F?.length||H;return M+U+h(F||[])},0),m=n.length+h(n),f=n.length===m,y=n.map(T=>T.account).filter((T,M,L)=>L.findIndex(H=>H.id===T.id)===M).slice(0,3),v=ke(()=>n?.reduce((T,M)=>T+M?.weight,a),[a,n?.length]);let C=!1;(c||v<=Nd||!o&&m===1&&an(n[0])<2)&&(C=!0);const k=mi[n[0].id],b=tt((T,M,L,H)=>{T.preventDefault(),T.stopPropagation(),r({media:M+1,mediaStatusID:H.id})},[]),g=q();St(()=>{function T(M){M.target.dataset.scrollLeft=M.target.scrollLeft}return g.current?.addEventListener("scroll",T,{passive:!0}),()=>{g.current?.removeEventListener("scroll",T)}},[]);const[_,w]=R(k||C);G(()=>{let T;return!k&&!C&&(T=setTimeout(()=>w(!0),100)),()=>clearTimeout(T)},[k,C]);const A=C?"div":"details",S=A==="details";return e(A,{ref:g,class:"replies",open:S?k||C:void 0,onToggle:S?T=>{const{open:M}=T.target;mi[n[0].id]=M}:void 0,style:{"--comments-level":s},"data-comments-level":s,"data-comments-level-overflow":s>4,children:[!C&&e("summary",{class:"replies-summary",hidden:C,children:[e("span",{class:"avatars",children:y.map(T=>e(pt,{url:T.avatarStatic,title:`${T.displayName} @${T.username}`,squircle:T?.bot},T.id))}),e("span",{class:"replies-counts",children:[e("b",{children:e(u,{id:"DOQUen",values:{0:n.length,1:We(n.length)},components:{0:e("span",{title:n.length})}})}),!f&&m>1&&e(D,{children:[" ","·"," ",e("span",{children:e(u,{id:"qSQQSe",values:{0:We(m),totalComments:m},components:{0:e("span",{title:m})}})})]})]}),e(I,{icon:"chevron-down",class:"replies-summary-chevron"}),!!p&&e(fe,{class:"replies-parent-link",to:p.to,onClick:p.onClick,title:l({id:"ZlV82A"}),children:"»"})]}),_&&e("ul",{children:n.map(T=>e("li",{children:[e("div",{class:"status-focus",tabIndex:0,children:[e(je,{statusID:T.id,instance:i,withinContext:!0,size:"s",enableTranslate:!0,onMediaClick:b,showActionsBar:!0}),!T.replies?.length&&T.repliesCount>0&&e("div",{class:"replies-link",children:[e(I,{icon:"comment2",alt:l({id:"N8UzTV"})})," ",e("span",{title:T.repliesCount,children:We(T.repliesCount)})]})]}),T.replies?.length&&e($o,{instance:i,replies:T.replies,level:T.level,accWeight:C?v:T.weight,openAll:c,parentLink:{to:i?`/${i}/s/${T.id}`:`/s/${T.id}`,onClick:()=>{Rn(T.id)}}})]},T.id))})]})}const zd=140,Fd=35,Bd=70,qd=140,gi=new Map;function an(n){const i=gi.get(n.id);if(i)return i;const{spoilerText:o,content:s,mediaAttachments:a,poll:c,card:p}=n,l=js(o+s),d=a?.length?zd:0,r=(c?.options?.length||0)*Fd,h=p&&(a?.length||c?.options?.length)?0:Bd,f=(l+d+r+h)/qd;return gi.set(n.id,f),f}const Ud=ot(Pd);function Kd(){const n=Nt(),{id:i,instance:o}=n;return e(Ud,{id:i,instance:o})}const Hd=""+new URL("boosts-carousel-BiOaNdMT.jpg",import.meta.url).href,jd=""+new URL("grouped-notifications-DFgwVVj3.jpg",import.meta.url).href,Yd=""+new URL("multi-column-ROck0NVt.jpg",import.meta.url).href,Vd=""+new URL("multi-hashtag-timeline-DH5INVHi.jpg",import.meta.url).href,Gd=""+new URL("nested-comments-thread-hv59kZLc.jpg",import.meta.url).href,Wd="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",Zd={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:sn,PHANPY_WEBSITE:xs,PHANPY_PRIVACY_POLICY_URL:Xd,PHANPY_DEFAULT_INSTANCE_REGISTRATION_URL:Es}=Zd,Rs=xs?xs.replace(/https?:\/\//g,"").replace(/\/$/,""):null,Ls=`${"2025-11-08T15:05:40.014Z".slice(0,10).replace(/-/g,".")}.7d7cb91`;function No(){const{_:n}=ce();return Qe(null,["/","/welcome"]),e("main",{id:"welcome",children:[e("div",{class:"hero-container",children:[e("div",{class:"hero-content",children:[e("h1",{children:[e("img",{src:Di,alt:"",width:"160",height:"160",style:{aspectRatio:"1/1",marginBlockEnd:-16}}),e("img",{src:Wd,alt:"Phanpy",width:"200"})]}),e("p",{class:"desc",children:e(u,{id:"Ogtv0V"})}),e("p",{children:e(fe,{to:sn?`/login?instance=${sn}&submit=1`:"/login",class:"button",children:n(sn?{id:"sQia9P"}:{id:"ZLoGls"})})}),sn&&Es&&e("p",{children:e("a",{href:Es,class:"button plain5",children:e(u,{id:"e+RpCP"})})}),!sn&&e("p",{class:"insignificant",children:e("small",{children:e(u,{id:"fvAsUK",components:{0:e("br",{})}})})})]}),(Rs||Ls)&&e("p",{class:"app-site-version",children:e("small",{children:[Rs," ",Ls]})}),e("p",{children:e(u,{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(),E.showAccount="cheeaun@mastodon.social"}}),2:e("a",{href:Xd,target:"_blank"})}})}),e("div",{children:e(Oi,{})})]}),e("div",{id:"why-container",children:e("div",{class:"sections",children:[e("section",{children:[e("img",{src:Hd,alt:n({id:"S5cYrQ"}),loading:"lazy"}),e("h4",{children:e(u,{id:"Tu+sCN"})}),e("p",{children:e(u,{id:"e2uVlo"})})]}),e("section",{children:[e("img",{src:Gd,alt:n({id:"CGQ27z"}),loading:"lazy"}),e("h4",{children:e(u,{id:"cYE45+"})}),e("p",{children:e(u,{id:"Pc7QKh"})})]}),e("section",{children:[e("img",{src:jd,alt:n({id:"rnrM7k"}),loading:"lazy"}),e("h4",{children:e(u,{id:"4RRMre"})}),e("p",{children:e(u,{id:"8GMtDr"})})]}),e("section",{children:[e("img",{src:Yd,alt:n({id:"VLKtvP"}),loading:"lazy"}),e("h4",{children:e(u,{id:"pEkad9"})}),e("p",{children:e(u,{id:"t7Py5R"})})]}),e("section",{children:[e("img",{src:Vd,alt:n({id:"wOax6E"}),loading:"lazy"}),e("h4",{children:e(u,{id:"Wi1Ov0"})}),e("p",{children:e(u,{id:"tS2i+h"})})]})]})})]})}const Jd=window.alert;window.__nativeAlert||(window.__nativeAlert=Jd);window.alert=function(n){n instanceof Error&&n?.message&&(n=n.message),typeof n!="string"&&(n=JSON.stringify(n));const i=Ta({text:n,className:"alert",gravity:"top",position:"center",duration:1e4,offset:{y:48},onClick:()=>{i.hideToast()}});i.showToast()};window.__STATES__=E;window.__STATES_STATS__=()=>{const n=["statuses","accounts","spoilers","unfurledLinks","statusQuotes"],i={};n.forEach(a=>{i[a]=Object.keys(E[a]).length});const{statuses:o}=E,s=[];for(const a in o)document.querySelector(`[data-state-post-id~="${a}"], [data-state-post-ids~="${a}"]`)||s.push(a)};setInterval(()=>{if(!window.__IDLE__)return;const{statuses:n,unfurledLinks:i,notifications:o}=E;let s=0;const{instance:a}=se();for(const c in n){if(!window.__IDLE__)break;try{const p=document.querySelector(`[data-state-post-id~="${c}"], [data-state-post-ids~="${c}"]`),l=o.some(d=>c===rt(d.status?.id,a));if(!p&&!l){delete E.statuses[c],delete E.statusQuotes[c];for(const d in i){const r=i[d];if(rt(r.id,r.instance)===c){delete E.unfurledLinks[d];break}}s++}}catch{}}},15*60*1e3);setTimeout(()=>{for(const n in jt)setTimeout(()=>{Array.isArray(jt[n])?jt[n][0]?.():typeof jt[n]=="object"?jt[n].module?.():jt[n]?.()},1)},5e3);(()=>{window.__IDLE__=!0;const n=["mousemove","mousedown","resize","keydown","touchstart","pointerdown","pointermove","wheel"],i=()=>{window.__IDLE__=!0},s=Vs(i,3e3),a=()=>{window.__IDLE__=!1,s()};n.forEach(c=>{window.addEventListener(c,a,{passive:!0,capture:!0})}),window.addEventListener("blur",i,{passive:!0}),document.documentElement.addEventListener("mouseleave",c=>{!c.relatedTarget&&!c.toElement&&i()},{passive:!0})})();const Qd=/iPad|iPhone|iPod/.test(navigator.userAgent);Qd&&document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible"){if(document.getElementsByClassName("media-modal-container").length>0)return;const i=Te.local.get("theme");let o;if(i){if(o=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),o){const s=o.content,a=i==="light"?o.dataset.themeLightColorTemp:o.dataset.themeDarkColorTemp;o.content=a||"",setTimeout(()=>{o.content=s},10)}}else{const s=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(o=document.querySelector(`meta[name="theme-color"][media*="${s}"]`),o){const a=o.dataset.content,c=o.dataset.contentTemp;o.content=c||"",setTimeout(()=>{o.content=a},10)}}}});{const n=Te.local.get("theme");if(n){document.documentElement.classList.add(`is-${n}`),document.querySelector('meta[name="color-scheme"]').setAttribute("content",n||"light dark");const o=document.querySelector('meta[data-theme-setting="manual"]');o&&(o.name="theme-color",o.content=n==="light"?o.dataset.themeLightColor:o.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(a=>{a.name=""})}const i=Te.local.get("textSize");i&&document.documentElement.style.setProperty("--text-size",`${i}px`)}Ns(E,n=>{for(const[i,o,s,a]of n){if(o.join(".")==="settings.shortcutsViewMode"){const c=document.getElementById("app");c&&(c.dataset.shortcutsViewMode=E.shortcuts?.length?s:"")}o.join(".")==="settings.cloakMode"&&document.body.classList.toggle("cloak",s)}});const Sn=new Map;window.__BENCH_RESULTS=new Map;window.__BENCHMARK={start(n){},end(n){}};document.body.classList.toggle("exp-tab-bar-v2",Te.local.get("experiments-tabBarV2")??!1);function eu(){const[n,i]=R(!1),[o,s]=R("loading");__BENCHMARK.start("app-init"),__BENCHMARK.start("time-to-following"),__BENCHMARK.start("time-to-home"),__BENCHMARK.start("time-to-isLoggedIn"),ce(),G(()=>{const c=Te.local.get("instanceURL"),p=decodeURIComponent((window.location.search.match(/code=([^&]+)/)||[,""])[1]);if(p){window.history.replaceState({},document.title,window.location.pathname||"/");const{client_id:l,client_secret:d,vapid_key:r}=Ds(c)||{},h=Mn(c)||r,m=Te.sessionCookie.get("codeVerifier");(async()=>{s("loading");const{access_token:f}=await ic({instanceURL:c,client_id:l,client_secret:d,code:p,code_verifier:m||void 0});if(f){const y=Xo({instance:c,accessToken:f});await Promise.allSettled([Jn(y),Qn(y,c),Jo(y,c,f,h)]),Yi(),window.__IGNORE_GET_ACCOUNT_ERROR__=!0,i(!0),s("default")}else s("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=Qo(l),d&&(Ln(d.info.id),window.history.replaceState({},document.title,window.location.pathname||"/"))),d||(d=Si()),d){Ln(d.info.id);const{client:r}=se({account:d}),{instance:h}=r;Yi(),s("loading"),(async()=>{try{ea()&&ta(h)?(Jn(r),Qn(r,h)):await Promise.allSettled([Jn(r),Qn(r,h)])}catch{}finally{i(!0),s("default"),__BENCHMARK.end("app-init")}})()}else s("default"),__BENCHMARK.end("app-init")}Te.sessionCookie.del("clientID"),Te.sessionCookie.del("clientSecret"),Te.sessionCookie.del("codeVerifier")},[]);let a=Qt();return E.currentLocation=a.pathname,G(ui,[a,n]),/\/https?:/.test(a.pathname)?e(kd,{}):o==="loading"?e(Oe,{id:"loader-root"}):e(D,{children:[e(nu,{isLoggedIn:n}),e(iu,{isLoggedIn:n}),e(Ii,{children:e(Ze,{path:"/:instance?/s/:id",element:e(Kd,{})})}),n&&e(Ma,{}),n&&e(Hr,{}),e($r,{}),n&&e(zr,{}),e(Ra,{isLoggedIn:n}),n&&e(Nr,{}),e(Ur,{onClose:ui}),e($a,{})]})}function tu({isLoggedIn:n}){return n&&__BENCHMARK.end("time-to-isLoggedIn"),n?e(yd,{}):e(No,{})}const nu=ot(({isLoggedIn:n})=>{const i=Qt(),o=ke(()=>{const{pathname:s}=i;return!/^\/(login|welcome|_sandbox)/i.test(s)},[i]);return e(Ii,{location:o||i,children:[e(Ze,{path:"/",element:e(tu,{isLoggedIn:n})}),e(Ze,{path:"/login",element:e(Ad,{})}),e(Ze,{path:"/welcome",element:e(No,{})}),void 0]})});function Ms(){return E.prevLocation||null}function iu({isLoggedIn:n}){const i=Qt(),o=q(Ms());return ke(()=>cn("/:instance/s/:id",i.pathname)||cn("/s/:id",i.pathname),[i.pathname,cn])?o.current||(o.current=Ms()):o.current=null,e(Ii,{location:o.current||i,children:[n&&e(D,{children:[e(Ze,{path:"/notifications",element:e(xo,{})}),e(Ze,{path:"/mentions",element:e(Co,{})}),e(Ze,{path:"/following",element:e(Ki,{})}),e(Ze,{path:"/b",element:e(mo,{})}),e(Ze,{path:"/f",element:e(go,{})}),e(Ze,{path:"/l",children:[e(Ze,{index:!0,element:e(Sd,{})}),e(Ze,{path:":id",element:e(bo,{})})]}),e(Ze,{path:"/fh",element:e(Pl,{})}),e(Ze,{path:"/sp",element:e(xd,{})}),e(Ze,{path:"/ft",element:e(Ll,{})}),e(Ze,{path:"/catchup",element:e(bl,{})}),e(Ze,{path:"/annual_report/:year",element:e(ul,{})})]}),e(Ze,{path:"/:instance?/t/:hashtag",element:e(yo,{})}),e(Ze,{path:"/:instance?/a/:id",element:e(cl,{})}),e(Ze,{path:"/:instance?/p",children:[e(Ze,{index:!0,element:e(fi,{})}),e(Ze,{path:"l",element:e(fi,{local:!0})})]}),e(Ze,{path:"/:instance?/trending",element:e(Lo,{})}),e(Ze,{path:"/:instance?/search",element:e(Eo,{})})]})}na();ia();sa(e(oa,{i18n:ue,children:e(aa,{children:e(ca,{children:e(eu,{})})})}),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 o=!1;const s=1e4,a=60*60*1e3;async function c(){if(window.__IDLE__)try{const p=await caches.keys();for(const l of p){if(i.includes(l))continue;const d=await caches.open(l),r=await d.keys();if(r.length>50){const h=r.slice(50);for(const m of h)await d.delete(m)}}o=!0}catch{}setTimeout(c,o?a:s)}setTimeout(c,s)}window.__CLOAK__=()=>{document.body.classList.toggle("cloak")};
|
||
//# sourceMappingURL=main-BiOvAqQu.js.map
|