phanpy-cz/assets/main-e75P80UH.js
2024-10-16 19:47:13 +02:00

30 lines
281 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

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

import{A as q,y as ee,h as L,s as A,a as oe,b as Ke,i as g,C as it,u as He,c as e,T as u,d as me,g as vt,p as $t,e as gn,f as B,j as Je,k as En,L as Js,l as _e,D as Qs,m as eo,o as Fn,q as Vt,r as _t,t as ot,v as to,w as Ne,x as bn,z as vi,_ as yt,B as es,E as Rl,F as ts,G as ns,H as no,I as io,J as nt,K as so,M as Zn,N as ht,O as oo,P as co,Q as ao,R as Xn,S as Mt,U as We,V as is,W as ss,X as ro,Y as en,Z as lo,$ as uo,a0 as Rn,a1 as Ln,a2 as ho,a3 as yi,a4 as fo,a5 as po,a6 as mo,a7 as Jn,a8 as je,a9 as go,aa as bo,ab as vo,ac as yo}from"./useTitle-B8ZF9tfB.js";import{u as Qn,s as ue,a as Be,o as wi,b as wo,I as C,M as Fe,A as lt,N as pt,c as ct,d as ye,e as Ue,f as Ve,g as rt,L as he,l as Ct,h as os,t as _i,i as Xe,R as Gt,j as et,p as Kt,k as at,m as cs,n as Bn,E as as,q as Ge,r as ut,v as _o,S as vn,w as ki,T as rs,x as dt,y as ei,z as qe,B as wt,C as ko,D as So,F as Et,G as ti,H as ls,J as Co,K as Bt,O as Io,P as To,Q as ds,U as xo,V as Ao,W as us,X as Eo,Y as Rt,Z as ni,_ as Ro,$ as hs,a0 as Lo,a1 as fs,a2 as $o,a3 as Mo,a4 as Do,a5 as Si,a6 as No,a7 as Ot}from"./fuse-RZOrQKm7.js";var ps=Po;function Po(t,n,i){var s=null,o=null,a=function(){s&&(clearTimeout(s),o=null,s=null)},p=function(){var c=o;a(),c&&c()},r=function(){if(!n)return t.apply(this,arguments);var c=this,l=arguments,m=i&&!s;if(a(),o=function(){t.apply(c,l)},s=setTimeout(function(){if(s=null,!m){var h=o;return o=null,h()}},n),m)return o()};return r.cancel=a,r.flush=p,r}/*!
* swiped-events.js - v@version@
* Pure JavaScript swipe events
* https://github.com/john-doherty/swiped-events
* @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element
* @author John Doherty <www.johndoherty.info>
* @license MIT
*/(function(t,n){"use strict";typeof t.CustomEvent!="function"&&(t.CustomEvent=function(d,v){v=v||{bubbles:!1,cancelable:!1,detail:void 0};var b=n.createEvent("CustomEvent");return b.initCustomEvent(d,v.bubbles,v.cancelable,v.detail),b},t.CustomEvent.prototype=t.Event.prototype),n.addEventListener("touchstart",m,!1),n.addEventListener("touchmove",h,!1),n.addEventListener("touchend",l,!1);var i=null,s=null,o=null,a=null,p=null,r=null,c=0;function l(d){if(r===d.target){var v=parseInt(f(r,"data-swipe-threshold","20"),10),b=f(r,"data-swipe-unit","px"),w=parseInt(f(r,"data-swipe-timeout","500"),10),_=Date.now()-p,y="",S=d.changedTouches||d.touches||[];if(b==="vh"&&(v=Math.round(v/100*n.documentElement.clientHeight)),b==="vw"&&(v=Math.round(v/100*n.documentElement.clientWidth)),Math.abs(o)>Math.abs(a)?Math.abs(o)>v&&_<w&&(o>0?y="swiped-left":y="swiped-right"):Math.abs(a)>v&&_<w&&(a>0?y="swiped-up":y="swiped-down"),y!==""){var k={dir:y.replace(/swiped-/,""),touchType:(S[0]||{}).touchType||"direct",fingers:c,xStart:parseInt(i,10),xEnd:parseInt((S[0]||{}).clientX||-1,10),yStart:parseInt(s,10),yEnd:parseInt((S[0]||{}).clientY||-1,10)};r.dispatchEvent(new CustomEvent("swiped",{bubbles:!0,cancelable:!0,detail:k})),r.dispatchEvent(new CustomEvent(y,{bubbles:!0,cancelable:!0,detail:k}))}i=null,s=null,p=null}}function m(d){d.target.getAttribute("data-swipe-ignore")!=="true"&&(r=d.target,p=Date.now(),i=d.touches[0].clientX,s=d.touches[0].clientY,o=0,a=0,c=d.touches.length)}function h(d){if(!(!i||!s)){var v=d.touches[0].clientX,b=d.touches[0].clientY;o=i-v,a=s-b}}function f(d,v,b){for(;d&&d!==n.documentElement;){var w=d.getAttribute(v);if(w)return w;d=d.parentNode}return b}})(window,document);function Ht(t=()=>{},n=[]){const i=q(t);ee(()=>{i.current=t},[n]),ee(()=>{const s=()=>{const o=document.hidden||document.visibilityState==="hidden";i.current(!o)};return document.addEventListener("visibilitychange",s),()=>document.removeEventListener("visibilitychange",s)},[])}const Oo=1e3*3,Ci=2e4,zo=it(function({isLoggedIn:n}){const[i,s]=L(!0),o=q();Ht(c=>{clearTimeout(o.current),c?s(!0):o.current=setTimeout(()=>{s(!1)},Ci)});const a=async(c,l,m)=>{var h;if(A.notificationsLast){const f=c.v1.notifications.list({limit:1,sinceId:A.notificationsLast.id}),{value:d}=await f.next();if(d!=null&&d.length)if(m)A.notificationsShowNew=!0;else{let v;try{const b=await c.v1.markers.fetch({timeline:"notifications"});v=(h=b==null?void 0:b.notifications)==null?void 0:h.lastReadId}catch{}v?A.notificationsShowNew=d[0].id!==v:A.notificationsShowNew=!0}}};ee(()=>{let c,l,m;if(n&&i){const{masto:h,streaming:f,instance:d}=oe();(async()=>{await a(h,d);let v=!1;f&&(l=setTimeout(()=>{(async()=>{try{v=!0,c=f.user.notification.subscribe();for await(const b of c){if(!c||!i)break;b.event==="notification"&&Ke(b.payload,d,{skipThreading:!0}),A.notificationsShowNew=!0}}catch{v=!1}v||(m=setInterval(()=>{a(h,d,!0)},Ci))})()},Oo))})()}return()=>{var h;(h=c==null?void 0:c.unsubscribe)==null||h.call(c),c=null,clearTimeout(l),clearInterval(m)}},[i,n]);const p=q(),r=()=>{p.current=Date.now(),fetch("./version.json").then(c=>c.json()).then(c=>{c&&(A.appVersion=c)}).catch(c=>{})};return Qn(r,i&&1e3*60*30),Ht(c=>{c&&(p.current?Date.now()-p.current>1e3*60*60&&r():r())}),Be("shift+alt+k",()=>{const c=A.settings.cloakMode;A.settings.cloakMode=!c,ue({text:c?g._({id:"oguMwa"}):g._({id:"IXZLPs"})})}),null});function Uo(){const t=He(A);function n(i){if(t.composerState.minimized){A.composerState.minimized=!1,wi();return}i.shiftKey?wo()||(A.showCompose=!0):(wi(),A.showCompose=!0)}return Be("c, shift+c",n,{ignoreEventWhen:i=>!!document.querySelector("#modal-container > *")}),e("button",{type:"button",id:"compose-button",onClick:n,class:`${t.composerState.minimized?"min":""} ${t.composerState.publishing?"loading":""} ${t.composerState.publishingError?"error":""}`,children:e(C,{icon:"quill",size:"xl",alt:g._({id:"QOhkyl"})})})}const Fo=it(function(){const n=He(A);function i(){A.showKeyboardShortcutsHelp=!1}return Be("?, shift+?, shift+slash",s=>{A.showKeyboardShortcutsHelp=!0},{ignoreEventWhen:s=>!!document.querySelector("#modal-container > *")}),!!n.showKeyboardShortcutsHelp&&e(Fe,{onClose:i,children:e("div",{id:"keyboard-shortcuts-help-container",class:"sheet",tabindex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:i,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{id:"77Emn0"})})}),e("main",{children:e("table",{children:e("tbody",{children:[{action:g._({id:"ulXSNi"}),keys:e("kbd",{children:"?"})},{action:g._({id:"Gy9P9T"}),keys:e("kbd",{children:"j"})},{action:g._({id:"6XYpYY"}),keys:e("kbd",{children:"k"})},{action:g._({id:"DYowFe"}),keys:e(u,{id:"mzjGX4",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"S5ez7Y"}),keys:e(u,{id:"Fd8FaU",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"VkLESX"}),keys:e("kbd",{children:"."})},{action:g._({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:g._({id:"jAj8rv"}),keys:e(u,{id:"evz6c6",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"duF1lx"}),keys:e(u,{id:"nhpsIN",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"AIa/f7"}),keys:e("kbd",{children:"c"})},{action:g._({id:"snPx8X"}),className:"insignificant",keys:e(u,{id:"+Cxvld",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"1pKapz"}),keys:e(u,{id:"py67WT",components:{0:e("kbd",{}),1:e("kbd",{}),2:e("kbd",{}),3:e("kbd",{})}})},{action:g._({id:"A1taO8"}),keys:e("kbd",{children:"/"})},{action:g._({id:"ImOQa9"}),keys:e("kbd",{children:"r"})},{action:g._({id:"KFs8c6"}),className:"insignificant",keys:e(u,{id:"XpQLJF",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"cqi4Mx"}),keys:e(u,{id:"84WuL2",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"kulphB"}),keys:e(u,{id:"yrz6Ck",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"PZlHt8"}),keys:e("kbd",{children:"d"})},{action:g._({id:"C7ujRh"}),keys:e(u,{id:"v4TbMP",components:{0:e("kbd",{}),1:e("kbd",{}),2:e("kbd",{})}})}].map(({action:s,className:o,keys:a})=>e("tr",{children:[e("th",{class:o,children:s}),e("td",{children:a})]},s))})})})]})})}),ms=new Set,tt=new WeakMap,qt=new WeakMap,Lt=new WeakMap,Hn=new WeakMap,Bo=new WeakMap,Yt=new WeakMap,yn=new WeakMap,Jt=new WeakSet;let It,ii=0,si=0;const gt="__aa_tgt",tn="__aa_del",wn="__aa_new",Ho=t=>{const n=Ko(t);n&&n.forEach(i=>Wo(i))},qo=t=>{t.forEach(n=>{n.target===It&&jo(),tt.has(n.target)&&Dt(n.target)})};function Yo(t){const n=Hn.get(t);n==null||n.disconnect();let i=tt.get(t),s=0;const o=5;i||(i=jt(t),tt.set(t,i));const{offsetWidth:a,offsetHeight:p}=It,c=[i.top-o,a-(i.left+o+i.width),p-(i.top+o+i.height),i.left-o].map(m=>`${-1*Math.floor(m)}px`).join(" "),l=new IntersectionObserver(()=>{++s>1&&Dt(t)},{root:It,threshold:1,rootMargin:c});l.observe(t),Hn.set(t,l)}function Dt(t){clearTimeout(yn.get(t));const n=Cn(t),i=nn(n)?500:n.duration;yn.set(t,setTimeout(async()=>{const s=Lt.get(t);try{await(s==null?void 0:s.finished),tt.set(t,jt(t)),Yo(t)}catch{}},i))}function jo(){clearTimeout(yn.get(It)),yn.set(It,setTimeout(()=>{ms.forEach(t=>ys(t,n=>gs(()=>Dt(n))))},100))}function Vo(t){setTimeout(()=>{Bo.set(t,setInterval(()=>gs(Dt.bind(null,t)),2e3))},Math.round(2e3*Math.random()))}function gs(t){typeof requestIdleCallback=="function"?requestIdleCallback(()=>t()):requestAnimationFrame(()=>t())}let qn,Ft;const Go=typeof window<"u"&&"ResizeObserver"in window;Go&&(It=document.documentElement,qn=new MutationObserver(Ho),Ft=new ResizeObserver(qo),window.addEventListener("scroll",()=>{si=window.scrollY,ii=window.scrollX}),Ft.observe(It));function Ko(t){return t.reduce((s,o)=>[...s,...Array.from(o.addedNodes),...Array.from(o.removedNodes)],[]).every(s=>s.nodeName==="#comment")?!1:t.reduce((s,o)=>{if(s===!1)return!1;if(o.target instanceof Element){if($n(o.target),!s.has(o.target)){s.add(o.target);for(let a=0;a<o.target.children.length;a++){const p=o.target.children.item(a);if(p){if(tn in p)return!1;$n(o.target,p),s.add(p)}}}if(o.removedNodes.length)for(let a=0;a<o.removedNodes.length;a++){const p=o.removedNodes[a];if(tn in p)return!1;p instanceof Element&&(s.add(p),$n(o.target,p),qt.set(p,[o.previousSibling,o.nextSibling]))}}return s},new Set)}function $n(t,n){!n&&!(gt in t)?Object.defineProperty(t,gt,{value:t}):n&&!(gt in n)&&Object.defineProperty(n,gt,{value:t})}function Wo(t){var n;const i=t.isConnected,s=tt.has(t);i&&qt.has(t)&&qt.delete(t),Lt.has(t)&&((n=Lt.get(t))===null||n===void 0||n.cancel()),wn in t?Ii(t):s&&i?Xo(t):s&&!i?Jo(t):Ii(t)}function ft(t){return Number(t.replace(/[^0-9.\-]/g,""))}function Zo(t){let n=t.parentElement;for(;n;){if(n.scrollLeft||n.scrollTop)return{x:n.scrollLeft,y:n.scrollTop};n=n.parentElement}return{x:0,y:0}}function jt(t){const n=t.getBoundingClientRect(),{x:i,y:s}=Zo(t);return{top:n.top+s,left:n.left+i,width:n.width,height:n.height}}function bs(t,n,i){let s=n.width,o=n.height,a=i.width,p=i.height;const r=getComputedStyle(t);if(r.getPropertyValue("box-sizing")==="content-box"){const l=ft(r.paddingTop)+ft(r.paddingBottom)+ft(r.borderTopWidth)+ft(r.borderBottomWidth),m=ft(r.paddingLeft)+ft(r.paddingRight)+ft(r.borderRightWidth)+ft(r.borderLeftWidth);s-=m,a-=m,o-=l,p-=l}return[s,a,o,p].map(Math.round)}function Cn(t){return gt in t&&Yt.has(t[gt])?Yt.get(t[gt]):{duration:250,easing:"ease-in-out"}}function vs(t){if(gt in t)return t[gt]}function oi(t){const n=vs(t);return n?Jt.has(n):!1}function ys(t,...n){n.forEach(i=>i(t,Yt.has(t)));for(let i=0;i<t.children.length;i++){const s=t.children.item(i);s&&n.forEach(o=>o(s,Yt.has(s)))}}function ci(t){return Array.isArray(t)?t:[t]}function nn(t){return typeof t=="function"}function Xo(t){const n=tt.get(t),i=jt(t);if(!oi(t))return tt.set(t,i);let s;if(!n)return;const o=Cn(t);if(typeof o!="function"){const a=n.left-i.left,p=n.top-i.top,[r,c,l,m]=bs(t,n,i),h={transform:`translate(${a}px, ${p}px)`},f={transform:"translate(0, 0)"};r!==c&&(h.width=`${r}px`,f.width=`${c}px`),l!==m&&(h.height=`${l}px`,f.height=`${m}px`),s=t.animate([h,f],{duration:o.duration,easing:o.easing})}else{const[a]=ci(o(t,"remain",n,i));s=new Animation(a),s.play()}Lt.set(t,s),tt.set(t,i),s.addEventListener("finish",Dt.bind(null,t))}function Ii(t){wn in t&&delete t[wn];const n=jt(t);tt.set(t,n);const i=Cn(t);if(!oi(t))return;let s;if(typeof i!="function")s=t.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:i.duration*1.5,easing:"ease-in"});else{const[o]=ci(i(t,"add",n));s=new Animation(o),s.play()}Lt.set(t,s),s.addEventListener("finish",Dt.bind(null,t))}function Ti(t,n){var i;t.remove(),tt.delete(t),qt.delete(t),Lt.delete(t),(i=Hn.get(t))===null||i===void 0||i.disconnect(),setTimeout(()=>{if(tn in t&&delete t[tn],Object.defineProperty(t,wn,{value:!0,configurable:!0}),n&&t instanceof HTMLElement)for(const s in n)t.style[s]=""},0)}function Jo(t){var n;if(!qt.has(t)||!tt.has(t))return;const[i,s]=qt.get(t);Object.defineProperty(t,tn,{value:!0,configurable:!0});const o=window.scrollX,a=window.scrollY;if(s&&s.parentNode&&s.parentNode instanceof Element?s.parentNode.insertBefore(t,s):i&&i.parentNode?i.parentNode.appendChild(t):(n=vs(t))===null||n===void 0||n.appendChild(t),!oi(t))return Ti(t);const[p,r,c,l]=ec(t),m=Cn(t),h=tt.get(t);(o!==ii||a!==si)&&Qo(t,o,a,m);let f,d={position:"absolute",top:`${p}px`,left:`${r}px`,width:`${c}px`,height:`${l}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!nn(m))Object.assign(t.style,d),f=t.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:m.duration,easing:"ease-out"});else{const[v,b]=ci(m(t,"remove",h));(b==null?void 0:b.styleReset)!==!1&&(d=(b==null?void 0:b.styleReset)||d,Object.assign(t.style,d)),f=new Animation(v),f.play()}Lt.set(t,f),f.addEventListener("finish",Ti.bind(null,t,d))}function Qo(t,n,i,s){const o=ii-n,a=si-i,p=document.documentElement.style.scrollBehavior;if(getComputedStyle(It).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+o,window.scrollY+a),!t.parentElement)return;const c=t.parentElement;let l=c.clientHeight,m=c.clientWidth;const h=performance.now();function f(){requestAnimationFrame(()=>{if(!nn(s)){const d=l-c.clientHeight,v=m-c.clientWidth;h+s.duration>performance.now()?(window.scrollTo({left:window.scrollX-v,top:window.scrollY-d}),l=c.clientHeight,m=c.clientWidth,f()):document.documentElement.style.scrollBehavior=p}})}f()}function ec(t){const n=tt.get(t),[i,,s]=bs(t,n,jt(t));let o=t.parentElement;for(;o&&(getComputedStyle(o).position==="static"||o instanceof HTMLBodyElement);)o=o.parentElement;o||(o=document.body);const a=getComputedStyle(o),p=tt.get(o)||jt(o),r=Math.round(n.top-p.top)-ft(a.borderTopWidth),c=Math.round(n.left-p.left)-ft(a.borderLeftWidth);return[r,c,i,s]}function ws(t,n={}){return qn&&Ft&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!nn(n)&&!n.disrespectUserMotionPreference||(Jt.add(t),getComputedStyle(t).position==="static"&&Object.assign(t.style,{position:"relative"}),ys(t,Dt,Vo,o=>Ft==null?void 0:Ft.observe(o)),nn(n)?Yt.set(t,n):Yt.set(t,{duration:250,easing:"ease-in-out",...n}),qn.observe(t,{childList:!0}),ms.add(t))),Object.freeze({parent:t,enable:()=>{Jt.add(t)},disable:()=>{Jt.delete(t)},isEnabled:()=>Jt.has(t)})}function ai(t){const n=q(null),[i,s]=L(),o=a=>{i&&(a?i.enable():i.disable())};return ee(()=>{n.current instanceof HTMLElement&&s(ws(n.current,t||{}))},[]),[n,o]}const tc=window.matchMedia("(display-mode: standalone)").matches;function nc({onClose:t}){const{masto:n}=oe(),i=me.local.getJSON("accounts"),s=vt(),o=i.length>1,[a,p]=$t(c=>c+1,0),[r]=ai();return e("div",{id:"accounts-container",class:"sheet",tabIndex:"-1",children:[!!t&&e("button",{type:"button",class:"sheet-close",onClick:t,children:e(C,{icon:"x",alt:g._({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:r,children:i.map((c,l)=>{const m=c.info.id===s,h=l===0;return e("li",{children:[e("div",{children:[o&&e("span",{class:`current ${m?"is-current":""}`,children:e(C,{icon:"check-circle",alt:g._({id:"Hp1l6f"})})}),e(lt,{url:c.info.avatarStatic,size:"xxl",onDblClick:async()=>{if(m)try{const f=await n.v1.accounts.$select(c.info.id).fetch();c.info=f,me.local.setJSON("accounts",i),p()}catch{}}}),e(pt,{account:o?{...c.info,acct:/@/.test(c.info.acct)?c.info.acct:`${c.info.acct}@${c.instanceURL}`}:c.info,showAcct:!0,onClick:()=>{m?A.showAccount=`${c.info.username}@${c.instanceURL}`:(gn(c.info.id),location.reload())}})]}),e("div",{class:"actions",children:[h&&o&&e(B,{children:[e("span",{class:"tag",children:e(u,{id:"ovBPCi"})})," "]}),e(ct,{align:"end",menuButton:e("button",{type:"button",class:"plain more-button",children:e(C,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),children:[o&&e(B,{children:[e(ye,{disabled:m,onClick:()=>{gn(c.info.id),location.reload()},children:[e(C,{icon:"transfer"})," ",e(u,{id:"3t/Nrv"})]}),!tc&&!m&&e(Ue,{href:`./?account=${c.info.id}`,target:"_blank",children:[e(C,{icon:"external"}),e("span",{children:e(u,{id:"PZgZtY"})})]}),e(Ve,{})]}),e(ye,{onClick:()=>{A.showAccount=`${c.info.username}@${c.instanceURL}`},children:[e(C,{icon:"user"}),e("span",{children:e(u,{id:"40z2Fm"})})]}),e(Ve,{}),o&&e(ye,{disabled:h,onClick:()=>{i.splice(l,1),i.unshift(c),me.local.setJSON("accounts",i),p()},children:[e(C,{icon:"check-circle"}),e("span",{children:e(u,{id:"PPcets"})})]}),e(rt,{subMenu:!0,confirmLabel:e(B,{children:[e(C,{icon:"exit"}),e("span",{children:e(u,{id:"k08LxG",values:{0:c.info.acct},components:{0:e("span",{class:"bidi-isolate"})}})})]}),disabled:!m,menuItemClassName:"danger",onClick:()=>{i.splice(l,1),me.local.setJSON("accounts",i),location.href=location.pathname||"/"},children:[e(C,{icon:"exit"}),e("span",{children:e(u,{id:"CXk1bI"})})]})]})]})]},c.info.id)})}),e("p",{children:e(he,{to:"/login",class:"button plain2",onClick:t,children:[e(C,{icon:"plus"})," ",e("span",{children:e(u,{id:"Is7/PB"})})]})}),o&&e("p",{children:e("small",{children:e(u,{id:"52x24e",components:{0:e("i",{})}})})})]})})]})}const ri="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",ic={"zh-CN":"zh-Hans","zh-TW":"zh-Hant","pt-BR":"pt-BR"};function li(){const{i18n:t}=Je(),n=_e(()=>Js.map(i=>{var p,r;const s=ic[i]||i.replace(/-[a-z]+$/i,""),o=Ct({code:s,locale:i,fallback:(p=En.find(c=>c.code===i))==null?void 0:p.nativeName}),a=Ct({code:s,locale:t.locale,fallback:(r=En.find(c=>c.code===i))==null?void 0:r.name});return{code:i,regionlessCode:s,_common:a,native:o}}).sort((i,s)=>{const o=i._common.localeCompare(s._common,t.locale);return o!==0?o:i.code<s.code?-1:i.code>s.code?1:0}),[]);return e("label",{class:"lang-selector",children:["🌐"," ",e("select",{class:"small",value:t.locale||Qs,onChange:i=>{me.local.set("lang",i.target.value),eo(i.target.value)},children:[n.map(({code:i,regionlessCode:s,native:o})=>{var r;const a=Ct({code:s,locale:t.locale,fallback:(r=En.find(c=>c.code===i))==null?void 0:r.name});return e("option",{value:i,"data-regionless-code":s,children:!!a&&a!==o?`${o} - ${a}`:o},i)}),void 0]})]})}function xi(t){const{masto:n}=oe();return n.v1.push.subscription.create(t)}function sc(){const{masto:t}=oe();return t.v1.push.subscription.fetch()}function oc(t){const{masto:n}=oe();return n.v1.push.subscription.update(t)}function cc(){const{masto:t}=oe();return t.v1.push.subscription.remove()}function In(){return"serviceWorker"in navigator&&"PushManager"in window}function ac(){return navigator.serviceWorker.getRegistration()}async function di(){const t=await ac(),n=t?await t.pushManager.getSubscription():void 0;return{registration:t,subscription:n}}function _s(t){const n="=".repeat((4-t.length%4)%4),i=`${t}${n}`.replace(/-/g,"+").replace(/_/g,"/"),s=window.atob(i),o=new Uint8Array(s.length);for(let a=0;a<s.length;++a)o[a]=s.charCodeAt(a);return o}async function rc(){if(!In())return;const{subscription:t}=await di();let n=null;try{n=await sc()}catch(i){if(!/(not found|unknown)/i.test(i.message))throw i}if(n&&t){const i=n.endpoint===t.endpoint,s=Fn(),o=n.serverKey===s;if(!i)throw new Error("Backend subscription endpoint changed");if(!o)throw new Error("Backend subscription key and vapid key changed")}if(t&&!n){const i=Fn();if(i){const{applicationServerKey:s}=t.options,o=_s(i).toString(),a=new Uint8Array(s).toString();if(!(o===a))throw await t.unsubscribe(),new Error("Subscription key and vapid key changed")}}return{subscription:t,backendSubscription:n}}async function Ai({data:t,policy:n}){if(!In())return;let{registration:i,subscription:s}=await di(),o=null;if(s)try{o=await oc({data:t,policy:n})}catch{o=await xi({subscription:s,data:t,policy:n})}else{const a=Fn();if(!a)throw new Error("No server key found");s=await i.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:_s(a)}),o=await xi({subscription:s,data:t,policy:n})}return{subscription:s,backendSubscription:o}}async function Ei(){if(!In())return;const{subscription:t}=await di();t&&(await cc(),await t.unsubscribe())}const lc={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_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},Ri=16,At=[14,15,16,17,18,19,20],{PHANPY_WEBSITE:Li,PHANPY_PRIVACY_POLICY_URL:dc,PHANPY_IMG_ALT_API_URL:uc,PHANPY_GIPHY_API_KEY:hc}=lc;function fc({onClose:t}){const n=He(A),i=me.local.get("theme")||"auto",s=q(),o=n.settings.contentTranslationTargetLanguage||null,a=os(),p=Ct(a),r=me.local.get("textSize")||Ri,[c,l]=L(me.account.get("preferences")||{}),{masto:m,authenticated:h,instance:f}=oe();return e("div",{id:"settings-container",class:"sheet",tabIndex:"-1",style:{"--current-text-size":`${r}px`},children:[!!t&&e("button",{type:"button",class:"sheet-close",onClick:t,children:e(C,{icon:"x",alt:g._({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:s,onInput:d=>{d.preventDefault();const b=new FormData(s.current).get("theme"),w=document.documentElement;if(b==="auto"){w.classList.remove("is-light","is-dark");const _=document.querySelector('meta[data-theme-setting="manual"]');_&&(_.name=""),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(S=>{S.name="theme-color"})}else{w.classList.toggle("is-light",b==="light"),w.classList.toggle("is-dark",b==="dark");const _=document.querySelector('meta[data-theme-setting="manual"]');_&&(_.name="theme-color",_.content=b==="light"?_.dataset.themeLightColor:_.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(S=>{S.name=""})}document.querySelector('meta[name="color-scheme"]').setAttribute("content",b==="auto"?"dark light":b),b==="auto"?me.local.del("theme"):me.local.set("theme",b)},children:e("div",{class:"radio-group",children:[e("label",{children:[e("input",{type:"radio",name:"theme",value:"light",defaultChecked:i==="light"}),e("span",{children:e(u,{id:"1njn7W"})})]}),e("label",{children:[e("input",{type:"radio",name:"theme",value:"dark",defaultChecked:i==="dark"}),e("span",{children:e(u,{id:"pvnfJD"})})]}),e("label",{children:[e("input",{type:"radio",name:"theme",value:"auto",defaultChecked:i!=="light"&&i!=="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:At[0]},children:e(u,{id:"J6ypuD"})})," ",e("input",{type:"range",min:At[0],max:At[At.length-1],step:"1",value:r,list:"sizes",onChange:d=>{const v=parseInt(d.target.value,10);document.documentElement.style.setProperty("--text-size",`${v}px`),v===Ri?me.local.del("textSize"):me.local.set("textSize",d.target.value)}})," ",e("span",{style:{fontSize:At[At.length-1]},children:e(u,{id:"J6ypuD"})}),e("datalist",{id:"sizes",children:At.map(d=>e("option",{value:d}))})]})]}),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 noreferrer",children:e(u,{id:"FFmj1D"})})})]}),e(li,{})]})]})}),h&&e(B,{children:[e("h3",{children:e(u,{id:"PcoS3v"})}),e("section",{children:e("ul",{children:e("li",{children:[e("div",{children:e("label",{for:"posting-privacy-field",children:[e(u,{id:"NAjVvt"})," ",e(C,{icon:"cloud",alt:g._({id:"N2FcBE"}),class:"synced-icon"})]})}),e("div",{children:e("select",{id:"posting-privacy-field",value:c["posting:default:visibility"]||"public",onChange:d=>{const{value:v}=d.target;(async()=>{try{await m.v1.accounts.updateCredentials({source:{privacy:v}}),l({...c,"posting:default:visibility":v}),me.account.set("preferences",{...c,"posting:default:visibility":v})}catch{alert(g._({id:"Oa+KBY"}))}})()},children:[e("option",{value:"public",children:e(u,{id:"7d1a0d"})}),e("option",{value:"unlisted",children:e(u,{id:"WDcQq9"})}),e("option",{value:"private",children:e(u,{id:"o34OrG"})})]})})]})})}),e("p",{class:"section-postnote",children:[e(C,{icon:"cloud",alt:g._({id:"N2FcBE"}),class:"synced-icon"})," ",e("small",{children:e(u,{id:"xlsg7n",values:{instance:f},components:{0:e("a",{href:`https://${f}/`,target:"_blank",rel:"noopener noreferrer"})}})})]})]}),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:n.settings.autoRefresh,onChange:d=>{A.settings.autoRefresh=d.target.checked}})," ",e(u,{id:"0mC0SF"})]})}),e("li",{class:"block",children:e("label",{children:[e("input",{type:"checkbox",checked:n.settings.boostsCarousel,onChange:d=>{A.settings.boostsCarousel=d.target.checked}})," ",e(u,{id:"TSbnoW"})]})}),e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.contentTranslation,onChange:d=>{const{checked:v}=d.target;A.settings.contentTranslation=v,v||(A.settings.contentTranslationTargetLanguage=null)}})," ",e(u,{id:"0SdaOt"})]}),e("div",{class:`sub-section ${n.settings.contentTranslation?"":"more-insignificant"}`,children:[e("div",{children:e("label",{children:[e(u,{id:"rJ8YHs"})," ",e("select",{value:o||"",disabled:!n.settings.contentTranslation,style:{width:"10em"},onChange:d=>{A.settings.contentTranslationTargetLanguage=d.target.value||null},children:[e("option",{value:"",children:e(u,{id:"jNCSyx",values:{systemTargetLanguageText:p}})}),e("option",{disabled:!0,children:"──────────"}),_i.map(d=>{const v=Ct({code:d.code,fallback:d.name}),b=Ct({code:d.code,locale:d.code}),w=v!==b;return e("option",{value:d.code,children:w?`${b} - ${v}`:v})})]})]})}),e("hr",{}),e("div",{class:"checkbox-fieldset",children:[e(u,{id:"cc0NrU",values:{0:n.settings.contentTranslationHideLanguages.length}}),e("div",{class:"checkbox-fields",children:_i.map(d=>{const v=Ct({code:d.code,fallback:d.name}),b=Ct({code:d.code,locale:d.code}),w=v!==b;return e("label",{children:[e("input",{type:"checkbox",checked:n.settings.contentTranslationHideLanguages.includes(d.code),onChange:_=>{const{checked:y}=_.target;y?A.settings.contentTranslationHideLanguages.push(d.code):A.settings.contentTranslationHideLanguages=n.settings.contentTranslationHideLanguages.filter(S=>S!==d.code)}})," ",w?e("span",{children:[b," ",e("span",{class:"insignificant",children:["- ",v]})]}):v]})})})]}),e("p",{class:"insignificant",children:e("small",{children:e(u,{id:"xpF+wU",components:{0:e("a",{href:"https://github.com/cheeaun/lingva-api",target:"_blank",rel:"noopener noreferrer"}),1:e("a",{href:"https://github.com/thedaviddelta/lingva-translate",target:"_blank",rel:"noopener noreferrer"})}})})}),e("hr",{}),e("div",{children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.contentTranslationAutoInline,disabled:!n.settings.contentTranslation,onChange:d=>{A.settings.contentTranslationAutoInline=d.target.checked}})," ",e(u,{id:"gURvmk"})]}),e("p",{class:"insignificant",children:e("small",{children:e(u,{id:"PbHARL",components:{0:e("b",{})}})})})]})]})]}),!!hc&&h&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.composerGIFPicker,onChange:d=>{A.settings.composerGIFPicker=d.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 noreferrer"})}})})})]}),!!uc&&h&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.mediaAltGenerator,onChange:d=>{A.settings.mediaAltGenerator=d.target.checked}})," ",e(u,{id:"9q5uor"})," ",e(C,{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 noreferrer"})}})})})]}),h&&Xe("@mastodon/grouped-notifications")&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.groupedNotificationsAlpha,onChange:d=>{A.settings.groupedNotificationsAlpha=d.target.checked}})," ",e(u,{id:"aGziA/"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(u,{id:"X17jCM"})})})]}),h&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.shortcutSettingsCloudImportExport,onChange:d=>{A.settings.shortcutSettingsCloudImportExport=d.target.checked}})," ",e(u,{id:"570qTm"})," ",e(C,{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:n.settings.cloakMode,onChange:d=>{A.settings.cloakMode=d.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"})})})]}),h&&e("li",{children:e("button",{type:"button",class:"light",onClick:()=>{A.showDrafts=!0,A.showSettings=!1},children:e(u,{id:"krk5ws"})})})]})}),h&&e(pc,{onClose:t}),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:ri,alt:"",width:"64",height:"64",style:{aspectRatio:"1/1",verticalAlign:"middle",background:"#b7cdf9",borderRadius:12}}),e("div",{children:[e("b",{children:"Phanpy"})," ",e("a",{href:"https://hachyderm.io/@phanpy",rel:"noopener noreferrer",onClick:d=>{d.preventDefault(),A.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 noreferrer"}),1:e("a",{href:"https://mastodon.social/@cheeaun",rel:"noopener noreferrer",onClick:d=>{d.preventDefault(),A.showAccount="cheeaun@mastodon.social"}})}})]})]}),e("p",{children:[e("a",{href:"https://github.com/sponsors/cheeaun",target:"_blank",rel:"noopener noreferrer",children:e(u,{id:"O4cLCR"})})," ","·"," ",e("a",{href:"https://www.buymeacoffee.com/cheeaun",target:"_blank",rel:"noopener noreferrer",children:e(u,{id:"Ng063n"})})," ","·"," ",e("a",{href:dc,target:"_blank",rel:"noopener noreferrer",children:e(u,{id:"LcET2C"})})]}),e("p",{children:[Li&&e(B,{children:[e(u,{id:"pFnMHn",values:{0:Li.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/e3df9ff",target:"_blank",rel:"noopener noreferrer",children:e(Gt,{datetime:new Date("2024-10-15T12:51:15.104Z")})}),")"]})},components:{0:e("span",{class:"insignificant"}),1:e("input",{type:"text",class:"version-string",readOnly:!0,size:"18",value:`${"2024-10-15T12:51:15.104Z".slice(0,10).replace(/-/g,".")}.e3df9ff`,onClick:d=>{d.target.select();try{navigator.clipboard.writeText(d.target.value),ue(g._({id:"PiPfua"}))}catch{ue(g._({id:"gdxreD"}))}}})}})]})]}),void 0]})]})}function pc({onClose:t}){if(!In())return null;const{instance:n}=oe(),[i,s]=L("default"),o=q(),[a,p]=L(!1),[r,c]=L(!1),l=q();ee(()=>{(async()=>{s("loading");try{const{subscription:h,backendSubscription:f}=await rc();if(f!=null&&f.policy&&f.policy!=="none"){p(!0);const{alerts:d,policy:v}=f;l.current=v;const{elements:b}=o.current,w=b.namedItem("policy");w&&(w.value=v),Object.keys(d).forEach(_=>{const y=b.namedItem(_);(y==null?void 0:y.type)==="checkbox"&&(y.checked=!0)})}s("default")}catch(h){/outside.*authorized/i.test(h.message)?c(!0):alert((h==null?void 0:h.message)||h),s("error")}})()},[]);const m=i==="loading";return e("form",{ref:o,onChange:()=>{setTimeout(()=>{const h=Object.fromEntries(new FormData(o.current)),f=!!h["policy-allow"],d={data:{policy:h.policy,alerts:{mention:!!h.mention,favourite:!!h.favourite,reblog:!!h.reblog,follow:!!h.follow,follow_request:!!h.followRequest,poll:!!h.poll,update:!!h.update,status:!!h.status}}};let v=0;Object.keys(d.data.alerts).forEach(w=>{d.data.alerts[w]?v++:delete d.data.alerts[w]});const b=l.current!==d.data.policy;f&&v>0?b?Ei().then(()=>{Ai(d)}).catch(w=>{alert(g._({id:"I6pdY3"}))}):Ai(d).catch(w=>{alert(g._({id:"I6pdY3"}))}):Ei().catch(w=>{alert(g._({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||r,name:"policy-allow",checked:a,onChange:async h=>{const{checked:f}=h.target;if(f){const d=await Notification.requestPermission();d==="granted"?p(!0):(p(!1),d==="denied"&&alert(g._({id:"6LUsk7"})))}else p(!1)}})," ",e(u,{id:"qYNCa1",values:{0:[{value:"all",label:g._({id:"+niKJH"})},{value:"followed",label:g._({id:"x2NYtp"})},{value:"follower",label:g._({id:"PBFNgg"})}].map(h=>e("option",{value:h.value,children:h.label}))},components:{0:e("select",{name:"policy",disabled:m||r||!a})}})]}),e("div",{class:"shazam-container no-animation",style:{width:"100%"},hidden:!a,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"sub-section",children:e("ul",{children:[{value:"mention",label:g._({id:"/bZzdR"})},{value:"favourite",label:g._({id:"zZOZj7"})},{value:"reblog",label:g._({id:"puY2t0"})},{value:"follow",label:g._({id:"aaJhcT"})},{value:"followRequest",label:g._({id:"6Fs1Ba"})},{value:"poll",label:g._({id:"wNExRS"})},{value:"update",label:g._({id:"K/EtE6"})},{value:"status",label:g._({id:"2yr1/p"})}].map(h=>e("li",{children:e("label",{children:[e("input",{type:"checkbox",name:h.value})," ",h.label]})}))})})})}),r&&e("div",{class:"sub-section",children:e("p",{children:e(u,{id:"8d0b8B",components:{0:e(he,{to:`/login?instance=${n}`,onClick:t}),1:e("b",{})}})})})]})})}),e("p",{class:"section-postnote",children:e("small",{children:e(u,{id:"z96cOX",components:{0:e("b",{})}})})})]})}const Yn=()=>{let t=setTimeout(()=>{if(!document.getElementById("columns")){const i=document.querySelectorAll("#modal-container > *");if(i!=null&&i.length){const p=i[i.length-1],r=p.querySelector('[tabindex="-1"]')||p;if(r){r.focus();return}}if(document.querySelector(".deck-backdrop"))return;const o=document.querySelectorAll(".deck-container"),a=o[o.length-1];a&&a.tabIndex===-1&&a.focus()}},100);return()=>clearTimeout(t)};function ks(t){if(!t)return;const n=Vt(),i=q(n.pathname);ee(()=>{i.current&&n.pathname!==i.current&&(t==null||t())},[n.pathname,t])}const Ss=1e3*60,mc=24*60*60*1e3,jn=_t(async()=>{const{masto:t}=oe(),n=await t.v1.lists.list();return n.sort((i,s)=>i.title.localeCompare(s.title)),n.length&&setTimeout(()=>{me.account.set("lists",{lists:n,updatedAt:Date.now()})},1),n},{maxAge:Ss});async function sn(){try{const{lists:t,updatedAt:n}=me.account.get("lists")||{};return t!=null&&t.length?(Date.now()-n>mc&&jn(),t):await jn()}catch{return[]}}const gc=_t(t=>{const{masto:n}=oe();return n.v1.lists.$select(t).fetch()},{maxAge:Ss});async function Cs(t){const{lists:n}=me.account.get("lists")||{};if(n!=null&&n.length){const i=n.find(s=>s.id===t);if(i)return i}try{return gc(t)}catch{return null}}async function bc(t){const n=await Cs(t);return(n==null?void 0:n.title)||""}function vc(t){const{lists:n}=me.account.get("lists")||{};n!=null&&n.length&&(n.push(t),n.sort((i,s)=>i.title.localeCompare(s.title)),me.account.set("lists",{lists:n,updatedAt:Date.now()}))}function yc(t){const{lists:n}=me.account.get("lists")||{};if(n!=null&&n.length){const i=n.findIndex(s=>s.id===t.id);i!==-1&&(n[i]=t,n.sort((s,o)=>s.title.localeCompare(o.title)),me.account.set("lists",{lists:n,updatedAt:Date.now()}))}}function wc(t){const{lists:n}=me.account.get("lists")||{};if(n!=null&&n.length){const i=n.findIndex(s=>s.id===t);i!==-1&&(n.splice(i,1),me.account.set("lists",{lists:n,updatedAt:Date.now()}))}}function ui({list:t,onClose:n}){const{masto:i}=oe(),[s,o]=L("default"),a=!!t,p=q(),r=q(),c=q();ee(()=>{a&&(p.current.value=t.title,r.current.value=t.repliesPolicy,c.current&&(c.current.checked=t.exclusive))},[a]);const l=Xe("@mastodon/list-exclusive");return e("div",{class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})})," ",e("header",{children:e("h2",{children:a?g._({id:"tuhghE"}):g._({id:"Sb2gYF"})})}),e("main",{children:e("form",{class:"list-form",onSubmit:m=>{m.preventDefault();const h=new FormData(m.target),f=h.get("title"),d=h.get("replies_policy"),v=h.get("exclusive")==="on";o("loading"),(async()=>{try{let b;a?b=await i.v1.lists.$select(t.id).update({title:f,replies_policy:d,exclusive:v}):b=await i.v1.lists.create({title:f,replies_policy:d,exclusive:v}),o("default"),n==null||n({state:"success",list:b}),setTimeout(()=>{a?yc(b):vc(b)},1)}catch{o("error"),alert(a?g._({id:"R7ep1i"}):g._({id:"KPoj8w"}))}})()},children:[e("div",{class:"list-form-row",children:e("label",{for:"list-title",children:[e(u,{id:"6YtxFj"})," ",e("input",{ref:p,type:"text",id:"list-title",name:"title",required:!0,disabled:s==="loading",dir:"auto"})]})}),e("div",{class:"list-form-row",children:e("select",{ref:r,name:"replies_policy",required:!0,disabled:s==="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"})})]})}),l&&e("div",{class:"list-form-row",children:e("label",{class:"label-block",children:[e("input",{ref:c,type:"checkbox",name:"exclusive",disabled:s==="loading"})," ",e(u,{id:"jxxYp0"})]})}),e("div",{class:"list-form-footer",children:[e("button",{type:"submit",disabled:s==="loading",children:a?g._({id:"tfDRzk"}):g._({id:"hYgDIe"})}),a&&e(rt,{disabled:s==="loading",align:"end",menuItemClassName:"danger",confirmLabel:g._({id:"+kQ/cY"}),onClick:()=>{o("loading"),(async()=>{try{await i.v1.lists.$select(t.id).remove(),o("default"),n==null||n({state:"deleted"}),setTimeout(()=>{wc(t.id)},1)}catch{o("error"),alert(g._({id:"tqUaGL"}))}})()},children:e("button",{type:"button",class:"light danger",disabled:s==="loading",children:e(u,{id:"Jb6/SB"})})})]})]})})]})}const _c=[60*5,60*30,60*60,60*60*6,60*60*24,60*60*24*3,60*60*24*7,0],zt={0:{id:"9ZP9cc"},300:et(5,"minute"),1800:et(30,"minute"),3600:et(1,"hour"),21600:et(6,"hour"),86400:et(1,"day"),259200:et(3,"day"),604800:et(1,"week")},$i=80,Is=1e3*60*10;function kc(t,n){return n.v1.accounts.familiarFollowers.fetch({id:[t]})}const Sc=_t(kc,{maxAge:Is});async function Cc(t,n){const i=n.v1.accounts.$select(t).statuses.list({limit:20}).next(),{value:s}=await i,o={total:s.length,originals:0,replies:0,boosts:0};return s.forEach(a=>{a.reblog?o.boosts++:a.inReplyToId&&a.inReplyToAccountId!==a.account.id?o.replies++:o.originals++}),s.length&&(o.daysSinceLastPost=Math.ceil((Date.now()-new Date(s[s.length-1].createdAt))/864e5)),o}const Ic=_t(Cc,{maxAge:Is});function Ts({account:t,fetchAccount:n=()=>{},standalone:i,instance:s,authenticated:o}){const{i18n:a}=Je(),{masto:p}=oe({instance:s}),{masto:r,instance:c}=oe(),[l,m]=L("default"),h=typeof t=="string",[f,d]=L(h?null:t),v=_e(()=>s===c,[s,c]);ee(()=>{if(!h){d(t);return}m("loading"),(async()=>{try{const Z=await n();A.accounts[`${Z.id}@${s}`]=Z,d(Z),m("default")}catch{d(null),m("error")}})()},[h,t,n]);const{acct:b,avatar:w,avatarStatic:_,bot:y,createdAt:S,displayName:k,emojis:T,fields:I,followersCount:x,followingCount:O,group:P,id:$,lastStatusAt:Y,locked:X,note:J,statusesCount:N,url:M,username:z,memorial:V,moved:U,roles:ie,hideCollections:Q}=f||{};let de=!1,{header:Ie,headerStatic:te}=f||{};(!Ie||/missing\.png$/.test(Ie))&&w&&!/missing\.png$/.test(w)&&(Ie=w,de=!0,_&&!/missing\.png$/.test(_)&&(te=_));const ge=_e(()=>$===vt(),[$]);ee(()=>{const Z=!!(f!=null&&f.id&&(f!=null&&f.username)&&(f!=null&&f.acct)&&(f!=null&&f.avatar)&&(f!=null&&f.avatarStatic)&&(f!=null&&f.displayName)&&(f!=null&&f.url));if(ge&&s&&Z){const $e=me.local.getJSON("accounts");let Pe=!1;$e.forEach(R=>{R.info.id===f.id&&R.instanceURL===s&&(R.info=f,Pe=!0)}),Pe&&me.local.setJSON("accounts",$e)}},[ge,f,s]);const we=_e(()=>M?Kt.toUnicode(URL.parse(M).hostname):null,[M]),[G,ce]=L([]),ke=q(),Ae=q([]);async function Re(Z){var j;(Z||!ke.current)&&(ke.current=p.v1.accounts.$select($).followers.list({limit:$i}));const $e=await ke.current.next();if(ge||!v)return $e;const{value:Pe}=$e;let R=[];if(Z){let se=[];try{se=await p.v1.accounts.familiarFollowers.fetch({id:[$]})}catch{}Ae.current=((j=se==null?void 0:se[0])==null?void 0:j.accounts)||[],R=[...Ae.current,...Pe.filter(H=>!Ae.current.some(ne=>ne.id===H.id))]}else Pe!=null&&Pe.length&&(R=Pe.filter(se=>!Ae.current.some(H=>H.id===se.id)));return{...$e,value:R}}const Le=q();async function De(Z){return(Z||!Le.current)&&(Le.current=p.v1.accounts.$select($).following.list({limit:$i})),await Le.current.next()}const be=i?"div":he,W=s?`/${s}/a/${$}`:`/a/${$}`,[pe,Te]=L([]),[le,K]=L(),[fe,D]=L("default"),E=!!(le!=null&&le.total),F=async Z=>{try{const $e=await Sc(Z,r);Te($e[0].accounts.slice(0,Tc))}catch{}},ae=async()=>{if($){D("loading");try{const Z=await Ic($,p);K(Z),D("default")}catch{D("error")}}},ve=ot(({relationship:Z,currentID:$e})=>{Z.following||(F($e),!i&&N>0&&ae())},[i,$,N]),Se=ot(Z=>{Z.id===$&&(d(Z),A.accounts[`${Z.id}@${s}`]=Z)},[$,s]);return e("div",{tabIndex:"-1",class:`account-container ${l==="loading"?"skeleton":""}`,style:{"--header-color-1":G[0],"--header-color-2":G[1],"--header-color-3":G[2],"--header-color-4":G[3]},children:[l==="error"&&e("div",{class:"ui-state",children:[e("p",{children:e(u,{id:"44hICK"})}),e("p",{children:e("a",{href:h?t:M,target:"_blank",rel:"noopener noreferrer",children:[e(u,{id:"Aadw0+"})," ",e(C,{icon:"external"})]})})]}),l==="loading"?e(B,{children:[e("header",{children:e(at,{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(C,{icon:"more",size:"l",alt:a._({id:"2FYpfJ"})})})})]})]})]}):f&&e(B,{children:[!!U&&e("div",{class:"account-moved",children:[e("p",{children:e(u,{id:"C6cVP/",values:{displayName:k},components:{0:e("b",{})}})}),e(at,{account:U,instance:s,onClick:Z=>{Z.stopPropagation(),A.showAccount=U}})]}),!!Ie&&!/missing\.png$/.test(Ie)&&e("img",{src:Ie,alt:"",class:`header-banner ${de?"header-is-avatar":""}`,onError:Z=>{Z.target.crossOrigin?Z.target.src!==te?Z.target.src=te:(Z.target.removeAttribute("crossorigin"),Z.target.src=Ie):Z.target.src!==te?Z.target.src=te:Z.target.remove()},crossOrigin:"anonymous",onLoad:Z=>{Z.target.classList.add("loaded");try{const $e=window.OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"),Pe=$e.getContext("2d",{willReadFrequently:!0});$e.width=Z.target.width,$e.height=Z.target.height,Pe.imageSmoothingEnabled=!1,Pe.drawImage(Z.target,0,0);const R=10,se=[Pe.getImageData(0,0,R,R).data,Pe.getImageData(Z.target.width-R,0,R,R).data,Pe.getImageData(0,Z.target.height-R,R,R).data,Pe.getImageData(Z.target.width-R,Z.target.height-R,R,R).data].map(H=>{let ne=0,Me=0,xe=0,Ce=0;for(let re=0;re<H.length;re+=4)ne+=H[re],Me+=H[re+1],xe+=H[re+2],Ce+=H[re+3];const Oe=H.length/4;return[ne/Oe,Me/Oe,xe/Oe,Ce/Oe]}).map(H=>{const[ne,Me,xe,Ce]=Ac(H);return`rgba(${ne}, ${Me}, ${xe}, ${Ce})`});ce(se)}catch{}}}),e("header",{children:i?e(ct,{shift:window.matchMedia("(min-width: calc(40em))").matches?114:64,menuButton:e("div",{children:e(at,{account:f,instance:s,avatarSize:"xxxl",onClick:()=>{}})}),children:[e("div",{class:"szh-menu__header",children:e(Nc,{acct:b,instance:s})}),e(ye,{onClick:()=>{const Z=b.includes("@")?`@${b}`:`@${b}@${s}`;try{navigator.clipboard.writeText(Z),ue(a._({id:"zJoEwS"}))}catch{ue(a._({id:"BC0lSD"}))}},children:[e(C,{icon:"link"}),e("span",{children:e(u,{id:"27x6gl"})})]}),e(ye,{href:M,target:"_blank",children:[e(C,{icon:"external"}),e("span",{children:e(u,{id:"Bz5hLl"})})]}),e(Ve,{}),e(Ue,{href:f.avatar,target:"_blank",children:[e(C,{icon:"user"}),e("span",{children:e(u,{id:"7WYl2I"})})]}),e(Ue,{href:f.header,target:"_blank",children:[e(C,{icon:"media"}),e("span",{children:e(u,{id:"ZNme5R"})})]})]}):e(at,{account:f,instance:s,avatarSize:"xxxl",internal:!0})}),e("div",{class:"faux-header-bg","aria-hidden":"true"}),e("main",{children:[!!V&&e("span",{class:"tag",children:e(u,{id:"prdIOK"})}),!!y&&e("span",{class:"tag",children:[e(C,{icon:"bot"})," ",e(u,{id:"9Vdq+j"})]}),!!P&&e("span",{class:"tag",children:[e(C,{icon:"group"})," ",e(u,{id:"L8fEEm"})]}),ie==null?void 0:ie.map(Z=>e("span",{class:"tag",children:[Z.name,!!we&&e(B,{children:[" ",e("span",{class:"more-insignificant",children:we})]})]})),e("div",{class:"note",dir:"auto",onClick:cs({instance:c}),dangerouslySetInnerHTML:{__html:Bn(J,{emojis:T})}}),e("div",{class:"account-metadata-box",children:[(I==null?void 0:I.length)>0&&e("div",{class:"profile-metadata",children:I.map(({name:Z,value:$e,verifiedAt:Pe},R)=>e("div",{class:`profile-field ${Pe?"profile-verified":""}`,dir:"auto",children:[e("b",{children:[e(as,{text:Z,emojis:T})," ",!!Pe&&e(C,{icon:"check-circle",size:"s",alt:a._({id:"QDEWii"})})]}),e("p",{dangerouslySetInnerHTML:{__html:Bn($e,{emojis:T})}})]},Z+R))}),e("div",{class:"stats",children:[e(be,{tabIndex:0,to:W,onClick:()=>{setTimeout(()=>{A.showGenericAccounts={id:"followers",heading:a._({id:"x5LEuB"}),fetchAccounts:Re,instance:s,excludeRelationshipAttrs:ge?["followedBy"]:[],blankCopy:Q?a._({id:"BRV/wh"}):void 0}},0)},children:[!!pe.length&&e("span",{class:"shazam-container-horizontal",children:e("span",{class:"shazam-container-inner stats-avatars-bunch",children:pe.map(Z=>e(lt,{url:Z.avatarStatic,size:"s",alt:`${Z.displayName} @${Z.acct}`,squircle:Z==null?void 0:Z.bot}))})}),e("span",{title:x,children:Ge(x)})," ",e(u,{id:"x5LEuB"})]}),e(be,{class:"insignificant",tabIndex:0,to:W,onClick:()=>{setTimeout(()=>{A.showGenericAccounts={heading:a._({id:"following.stats"}),fetchAccounts:De,instance:s,excludeRelationshipAttrs:ge?["following"]:[],blankCopy:Q?a._({id:"BRV/wh"}):void 0}},0)},children:[e("span",{title:O,children:Ge(O)})," ",e(u,{id:"following.stats"}),e("br",{})]}),e(be,{class:"insignificant",to:W,children:[e("span",{title:N,children:Ge(N)})," ",e(u,{id:"+owNNn"})]}),!!S&&e("div",{class:"insignificant",children:e(u,{id:"PCcEFZ",values:{0:ut(S,{hideTime:!0})},components:{0:e("time",{datetime:S})}})})]})]}),!!le&&e(be,{to:W,class:"account-metadata-box",children:e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:E?e("div",{class:"posting-stats",title:a._({id:"wiuWLe",values:{0:(le.originals/le.total).toLocaleString(a.locale||void 0,{style:"percent"}),1:(le.replies/le.total).toLocaleString(a.locale||void 0,{style:"percent"}),2:(le.boosts/le.total).toLocaleString(a.locale||void 0,{style:"percent"})}}),children:[e("div",{children:le.daysSinceLastPost<365?a._({id:"oZUtTk",values:{0:le.total,1:le.daysSinceLastPost,2:le.daysSinceLastPost,3:le.daysSinceLastPost,4:le.total,5:le.total,6:le.daysSinceLastPost}}):a._({id:"JvA7Mo",values:{0:le.total,1:le.total}})}),e("div",{class:"posting-stats-bar",style:{"--originals-percentage":`${le.originals/le.total*100}%`,"--replies-percentage":`${(le.originals+le.replies)/le.total*100}%`}}),e("div",{class:"posting-stats-legends",children:[e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-legend-item-originals"})," ",e(u,{id:"HxF6Fk"})]})," ",e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-legend-item-replies"})," ",e(u,{id:"N8UzTV"})]})," ",e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-legend-item-boosts"})," ",e(u,{id:"puY2t0"})]})]})]}):e("div",{class:"posting-stats",children:e(u,{id:"vl3XTJ"})})})})}),!U&&e("div",{class:"account-metadata-box",children:e("div",{class:"shazam-container no-animation",hidden:!!le,children:e("div",{class:"shazam-container-inner",children:e("button",{type:"button",class:"posting-stats-button",disabled:fe==="loading",onClick:()=>{ae()},children:[e("div",{class:`posting-stats-bar posting-stats-icon ${fe==="loading"?"loading":""}`,style:{"--originals-percentage":"33%","--replies-percentage":"66%"}}),e(u,{id:"PjP87f"})," "]})})})})]}),e("footer",{children:e(xc,{info:f,instance:s,standalone:i,authenticated:o,onRelationshipChange:ve,onProfileUpdate:Se})})]})]})}const Tc=3;function xc({info:t,instance:n,standalone:i,authenticated:s,onRelationshipChange:o=()=>{},onProfileUpdate:a=()=>{}}){var le;if(!t)return null;const{_:p}=Je(),{masto:r,instance:c,authenticated:l}=oe(),m=n===c,[h,f]=L("default"),[d,v]=L(null),{id:b,acct:w,url:_,username:y,locked:S,lastStatusAt:k,note:T,fields:I,moved:x}=t,O=q(b),{following:P,showingReblogs:$,notifying:Y,followedBy:X,blocking:J,blockedBy:N,muting:M,mutingNotifications:z,requested:V,domainBlocking:U,endorsed:ie,note:Q}=d||{},[de,Ie]=L(null),[te,ge]=L(!1),we=w.includes("@")?w:`${w}@${n}`;ee(()=>{if(t){const K=vt();let fe;(async()=>{if(m&&s)fe=b;else if(!m&&l){const E=t.acct.includes("@");try{const F=await r.v2.search.fetch({q:E?t.acct:`${t.username}@${n}`,type:"accounts",limit:1,resolve:!0});F.accounts.length&&(fe=F.accounts[0].id,Ie(F.accounts[0]))}catch{}}if(!fe)return;if(K===fe){ge(!0);return}O.current=fe,f("loading");const D=r.v1.accounts.relationships.fetch({id:[fe]});try{const E=await D;if(f("default"),E.length){const F=E[0];v(F),o({relationship:F,currentID:fe})}}catch{f("error")}})()}},[t,s]),ee(()=>{t&&te&&to(t)},[t,te]);const G=h==="loading",[ce,ke]=L(!1),[Ae,Re]=L(!1),[Le,De]=L(!1),[be,W]=L(!1),[pe,Te]=L([]);return e(B,{children:[e("div",{class:"actions",children:[e("span",{children:[X?e("span",{class:"tag",children:e(u,{id:"p3UO/y"})}):k?e("small",{class:"insignificant",children:e(u,{id:"F3cM1G",values:{0:ut(k,{hideTime:!0})},components:{0:e("span",{class:"ib"})}})}):e("span",{}),M&&e("span",{class:"tag danger",children:e(u,{id:"+IJm1Z"})}),J&&e("span",{class:"tag danger",children:e(u,{id:"32TndD"})})]})," ",e("span",{class:"buttons",children:[!!Q&&e("button",{type:"button",class:"private-note-tag",title:g._({id:"zxFxcH"}),onClick:()=>{De(!0)},dir:"auto",children:e("span",{children:Q})}),e(ct,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:e("button",{type:"button",class:"plain",disabled:G,children:e(C,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),onMenuChange:K=>{P&&K.open&&(async()=>{try{const fe=await r.v1.accounts.$select(O.current).lists.list();Te(fe)}catch{}})()},children:[l&&!te&&e(B,{children:[e(ye,{onClick:()=>{_o({draftStatus:{status:`@${(de==null?void 0:de.acct)||w} `}})},children:[e(C,{icon:"at"}),e("span",{children:e(u,{id:"3LkfZu",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]}),e(ye,{onClick:()=>{ke(!0)},children:[e(C,{icon:"translate"}),e("span",{children:e(u,{id:"R8mSiS"})})]}),Xe("@mastodon/profile-private-note")&&e(ye,{onClick:()=>{De(!0)},children:[e(C,{icon:"pencil"}),e("span",{children:Q?g._({id:"U+Gokq"}):g._({id:"VcQzRi"})})]}),P&&!!d&&e(B,{children:[e(ye,{onClick:()=>{f("loading"),(async()=>{try{const K=await r.v1.accounts.$select(O.current).follow({notify:!Y});K&&v(K),f("default"),ue(K.notifying?g._({id:"jL3N0G",values:{username:y}}):g._({id:"WBugD/",values:{username:y}}))}catch(K){alert(K),f("error")}})()},children:[e(C,{icon:"notification"}),e("span",{children:Y?g._({id:"osJmEN"}):g._({id:"I92Z+b"})})]}),e(ye,{onClick:()=>{f("loading"),(async()=>{try{const K=await r.v1.accounts.$select(O.current).follow({reblogs:!$});K&&v(K),f("default"),ue(K.showingReblogs?g._({id:"0X2KC8",values:{username:y}}):g._({id:"cXWjH0",values:{username:y}}))}catch(K){alert(K),f("error")}})()},children:[e(C,{icon:"rocket"}),e("span",{children:$?g._({id:"GRUr8d"}):g._({id:"uREpT3"})})]})]}),P&&e(ye,{onClick:()=>{Re(!0)},children:[e(C,{icon:"list"}),pe.length?e(B,{children:[e("small",{class:"menu-grow",children:[e(u,{id:"sJ2yQc"}),e("br",{}),e("span",{class:"more-insignificant",children:pe.map(K=>K.title).join(", ")})]}),e("small",{class:"more-insignificant",children:pe.length})]}):e("span",{children:e(u,{id:"sJ2yQc"})})]}),e(Ve,{})]}),e(ye,{onClick:()=>{const K=`@${(de==null?void 0:de.acct)||we}`;try{navigator.clipboard.writeText(K),ue(g._({id:"zJoEwS"}))}catch{ue(g._({id:"BC0lSD"}))}},children:[e(C,{icon:"copy"}),e("small",{children:[e(u,{id:"27x6gl"}),e("br",{}),e("span",{class:"more-insignificant bidi-isolate",children:["@",(de==null?void 0:de.acct)||we]})]})]}),e(ye,{href:_,target:"_blank",children:[e(C,{icon:"external"}),e("small",{class:"menu-double-lines",children:Ec(_)})]}),e("div",{class:"menu-horizontal",children:[e(ye,{onClick:()=>{try{navigator.clipboard.writeText(_),ue(g._({id:"edWbV6"}))}catch{ue(g._({id:"W1ewR0"}))}},children:[e(C,{icon:"link"}),e("span",{children:e(u,{id:"he3ygx"})})]}),(navigator==null?void 0:navigator.share)&&((le=navigator==null?void 0:navigator.canShare)==null?void 0:le.call(navigator,{url:_}))&&e(ye,{onClick:()=>{try{navigator.share({url:_})}catch{alert(g._({id:"TtG3Uh"}))}},children:[e(C,{icon:"share"}),e("span",{children:e(u,{id:"LFKLqp"})})]})]}),!!d&&e(B,{children:[e(Ve,{}),M?e(ye,{onClick:()=>{f("loading"),(async()=>{try{const K=await r.v1.accounts.$select((de==null?void 0:de.id)||b).unmute();v(K),f("default"),ue(g._({id:"B4Xkly",values:{username:y}})),A.reloadGenericAccounts.id="mute",A.reloadGenericAccounts.counter++}catch{f("error")}})()},children:[e(C,{icon:"unmute"}),e("span",{children:e(u,{id:"Q/HUhC",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]}):e(vn,{menuClassName:"menu-blur",openTrigger:"clickOnly",direction:"bottom",overflow:"auto",shift:16,label:e(B,{children:[e(C,{icon:"mute"}),e("span",{class:"menu-grow",children:e(u,{id:"xhPEH3",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})}),e("span",{style:{textOverflow:"clip"},children:[e(C,{icon:"time"}),e(C,{icon:"chevron-right"})]})]}),children:e("div",{class:"menu-wrap",children:_c.map(K=>e(ye,{onClick:()=>{f("loading"),(async()=>{try{const fe=await r.v1.accounts.$select((de==null?void 0:de.id)||b).mute({duration:K});v(fe),f("default"),ue(g._({id:"/plB9m",values:{0:typeof zt[K]=="function"?zt[K]():p(zt[K]),username:y}})),A.reloadGenericAccounts.id="mute",A.reloadGenericAccounts.counter++}catch{f("error"),ue(g._({id:"vWGBjT",values:{username:y}}))}})()},children:typeof zt[K]=="function"?zt[K]():p(zt[K])}))})}),X&&e(rt,{subMenu:!0,menuItemClassName:"danger",confirmLabel:e(B,{children:[e(C,{icon:"user-x"}),e("span",{children:e(u,{id:"unyq2W",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]}),onClick:()=>{f("loading"),(async()=>{try{const K=await r.v1.accounts.$select((de==null?void 0:de.id)||b).removeFromFollowers();v(K),f("default"),ue(g._({id:"AgkcM/",values:{username:y}})),A.reloadGenericAccounts.id="followers",A.reloadGenericAccounts.counter++}catch{f("error")}})()},children:[e(C,{icon:"user-x"}),e("span",{children:e(u,{id:"VCZ0OT"})})]}),e(rt,{subMenu:!0,confirm:!J,confirmLabel:e(B,{children:[e(C,{icon:"block"}),e("span",{children:e(u,{id:"aforS9",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]}),itemProps:{className:"danger"},menuItemClassName:"danger",onClick:()=>{f("loading"),(async()=>{try{if(J){const K=await r.v1.accounts.$select((de==null?void 0:de.id)||b).unblock();v(K),f("default"),ue(g._({id:"sI9N29",values:{username:y}}))}else{const K=await r.v1.accounts.$select((de==null?void 0:de.id)||b).block();v(K),f("default"),ue(g._({id:"uYcYzu",values:{username:y}}))}A.reloadGenericAccounts.id="block",A.reloadGenericAccounts.counter++}catch{f("error"),J?ue(g._({id:"0tG4wG",values:{username:y}})):ue(g._({id:"pA+qEx",values:{username:y}}))}})()},children:J?e(B,{children:[e(C,{icon:"unblock"}),e("span",{children:e(u,{id:"/3LJfX",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]}):e(B,{children:[e(C,{icon:"block"}),e("span",{children:e(u,{id:"JRswkR",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]})}),e(ye,{className:"danger",onClick:()=>{A.showReportModal={account:de||t}},children:[e(C,{icon:"flag"}),e("span",{children:e(u,{id:"qTJgpR",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]})]}),l&&te&&i&&Xe("@mastodon/profile-edit")&&e(B,{children:[e(Ve,{}),e(ye,{onClick:()=>{W(!0)},children:[e(C,{icon:"pencil"}),e("span",{children:e(u,{id:"9OpVZg"})})]})]}),!1]}),!d&&h==="loading"&&e(Ne,{abrupt:!0}),!!d&&!x&&e(rt,{confirm:P||V,confirmLabel:e("span",{children:V?g._({id:"e7qQIH"}):g._({id:"eYsAQr",values:{0:t.acct||t.username}})}),menuItemClassName:"danger",align:"end",disabled:G,onClick:()=>{f("loading"),(async()=>{try{let K;P||V?K=await r.v1.accounts.$select(O.current).unfollow():K=await r.v1.accounts.$select(O.current).follow(),K&&v(K),f("default")}catch(K){alert(K),f("error")}})()},children:e("button",{type:"button",class:`${P||V?"light swap":""}`,"data-swap-state":P||V?"danger":"",disabled:G,children:P?e(B,{children:[e("span",{children:e(u,{id:"y6sq5j"})}),e("span",{children:e(u,{id:"HKrBPX"})})]}):V?e(B,{children:[e("span",{children:e(u,{id:"Yx0Ud8"})}),e("span",{children:e(u,{id:"yTVtKs"})})]}):S?e(B,{children:[e(C,{icon:"lock"})," ",e("span",{children:e(u,{id:"MKEPCY"})})]}):g._({id:"MKEPCY"})})})]})]}),!!ce&&e(Fe,{onClose:()=>{ke(!1)},children:e(Rc,{note:T,fields:I,onClose:()=>ke(!1)})}),!!Ae&&e(Fe,{onClose:()=>{Re(!1)},children:e(Lc,{accountID:O.current,onClose:()=>Re(!1)})}),!!Le&&e(Fe,{onClose:()=>{De(!1)},children:e($c,{account:t,note:Q,onRelationshipChange:K=>{v(K)},onClose:()=>De(!1)})}),!!be&&e(Fe,{onClose:()=>{W(!1)},children:e(Mc,{onClose:({state:K,account:fe}={})=>{W(!1),K==="success"&&fe&&a(fe)}})})]})}function Ac([t,n,i]){const s=.2126*t+.7152*n+.0722*i;let o;return s>=220?o=1:s<=50?o=.1:o=s/255,o=Math.min(1,o),[t,n,i,o]}function Ec(t){if(!t)return;const n=URL.parse(t),{host:i,pathname:s}=n,o=s.replace(/\/$/,"").replace(/^\//,"");return e(B,{children:[e("span",{class:"more-insignificant",children:[Kt.toUnicode(i),"/"]}),e("wbr",{}),e("span",{children:o})]})}function Rc({note:t,fields:n,onClose:i}){const s=(n==null?void 0:n.map(({name:a,value:p})=>`${a}
${ki(p)}`).join(`
`))||"",o=ki(t)+(s?`
${s}`:"");return e("div",{class:"sheet",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{id:"9groMz"})})}),e("main",{children:[e("p",{style:{whiteSpace:"pre-wrap"},children:o}),e(rs,{forceTranslate:!0,text:o})]})]})}function Lc({accountID:t,onClose:n}){const{masto:i}=oe(),[s,o]=L("default"),[a,p]=L([]),[r,c]=L([]),[l,m]=$t(d=>d+1,0);ee(()=>{o("loading"),(async()=>{try{const d=await sn();p(d);const v=await i.v1.accounts.$select(t).lists.list();c(v),o("default")}catch{o("error")}})()},[l]);const[h,f]=L(!1);return e("div",{class:"sheet",id:"list-add-remove-container",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{id:"sJ2yQc"})})}),e("main",{children:[a.length>0?e("ul",{class:"list-add-remove",children:a.map(d=>{const v=r.some(b=>b.id===d.id);return e("li",{children:e("button",{type:"button",class:`light ${v?"checked":""}`,disabled:s==="loading",onClick:()=>{o("loading"),(async()=>{try{v?await i.v1.lists.$select(d.id).accounts.remove({accountIds:[t]}):await i.v1.lists.$select(d.id).accounts.create({accountIds:[t]}),m()}catch{o("error"),alert(v?g._({id:"7KnEYa"}):g._({id:"Tba8uO"}))}})()},children:[e(C,{icon:"check-circle",alt:"☑️"}),e("span",{children:d.title})]})})})}):s==="loading"?e("p",{class:"ui-state",children:e(Ne,{abrupt:!0})}):s==="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:()=>f(!0),disabled:s!=="default",children:[e(C,{icon:"plus",size:"l"})," ",e("span",{children:e(u,{id:"Sb2gYF"})})]})]}),h&&e(Fe,{onClick:d=>{d.target===d.currentTarget&&f(!1)},children:e(ui,{list:h==null?void 0:h.list,onClose:d=>{d.state==="success"&&m(),f(!1)}})})]})}function $c({account:t,note:n,onRelationshipChange:i=()=>{},onClose:s=()=>{}}){const{masto:o}=oe(),[a,p]=L("default"),r=q(null);return ee(()=>{let c;return r.current&&!n&&(c=setTimeout(()=>{var l,m;(m=(l=r.current).focus)==null||m.call(l)},100)),()=>{clearTimeout(c)}},[]),e("div",{class:"sheet",id:"private-note-container",children:[!!s&&e("button",{type:"button",class:"sheet-close",onClick:s,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(u,{id:"DYqYm5",values:{0:(t==null?void 0:t.username)||(t==null?void 0:t.acct)},components:{0:e("span",{class:"bidi-isolate"})}})})}),e("main",{children:e("form",{onSubmit:c=>{c.preventDefault();const m=new FormData(c.target).get("note");(m==null?void 0:m.trim())!==(n==null?void 0:n.trim())&&(p("loading"),(async()=>{try{const h=await o.v1.accounts.$select(t==null?void 0:t.id).note.create({comment:m});p("default"),i(h),s()}catch(h){p("error"),alert((h==null?void 0:h.message)||g._({id:"ot8LpF"}))}})())},children:[e("textarea",{ref:r,name:"note",disabled:a==="loading",dir:"auto",children:n}),e("footer",{children:[e("button",{type:"button",class:"light",disabled:a==="loading",onClick:()=>{s==null||s()},children:e(u,{id:"dEgA5A"})}),e("span",{children:[e(Ne,{abrupt:!0,hidden:a!=="loading"}),e("button",{disabled:a==="loading",type:"submit",children:e(u,{id:"SrwrEj"})})]})]})]})})]})}function Mc({onClose:t=()=>{}}){const{masto:n}=oe(),[i,s]=L("loading"),[o,a]=L(null);ee(()=>{(async()=>{try{const h=await n.v1.accounts.verifyCredentials();a(h),s("default")}catch{s("error")}})()},[]);const{displayName:p,source:r}=o||{},{note:c,fields:l}=r||{},m=q(null);return e("div",{class:"sheet",id:"edit-profile-container",children:[!!t&&e("button",{type:"button",class:"sheet-close",onClick:t,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(u,{id:"9OpVZg"})})}),e("main",{children:i==="loading"?e("p",{class:"ui-state",children:e(Ne,{abrupt:!0})}):e("form",{onSubmit:h=>{h.preventDefault();const f=new FormData(h.target),d=f.get("display_name"),v=f.get("note"),b=m.current.querySelectorAll('input[name^="fields_attributes"]'),w=[];b.forEach(_=>{const y=_.name,[S,k,T]=y.match(/fields_attributes\[(\d+)\]\[(.+)\]/)||[],I=_.value?_.value.trim():"";k&&T&&I&&(w[k]||(w[k]={}),w[k][T]=I)}),w.forEach(_=>{_.name&&!_.value&&(_.value="")}),(async()=>{try{const _=await n.v1.accounts.updateCredentials({displayName:d,note:v,fieldsAttributes:w});t==null||t({state:"success",account:_})}catch(_){alert((_==null?void 0:_.message)||g._({id:"FwMMx0"}))}})()},children:[e("p",{children:e("label",{children:[e(u,{id:"6YtxFj"})," ",e("input",{type:"text",name:"display_name",defaultValue:p,maxLength:30,disabled:i==="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:i==="loading",dir:"auto"})]})}),e("p",{children:e(u,{id:"T4I119"})}),e("table",{ref:m,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,l.length)}).map((h,f)=>{const{name:d="",value:v=""}=l[f]||{};return e(Dc,{name:d,value:v,index:f,disabled:i==="loading"},f)})})]}),e("footer",{children:[e("button",{type:"button",class:"light",disabled:i==="loading",onClick:()=>{t==null||t()},children:e(u,{id:"dEgA5A"})}),e("button",{type:"submit",disabled:i==="loading",children:e(u,{id:"tfDRzk"})})]})]})})]})}function Dc({name:t,value:n,disabled:i,index:s}){const[o,a]=L(!!n);return e("tr",{children:[e("td",{children:e("input",{type:"text",name:`fields_attributes[${s}][name]`,defaultValue:t,disabled:i,maxLength:255,required:o,dir:"auto"})}),e("td",{children:e("input",{type:"text",name:`fields_attributes[${s}][value]`,defaultValue:n,disabled:i,maxLength:255,onChange:p=>a(!!p.currentTarget.value),dir:"auto"})})]})}function Nc({acct:t,instance:n}){let[i,s]=t.split("@");return s||(s=n),e("div",{class:"handle-info",children:[e("span",{class:"handle-handle",children:[e("b",{class:"handle-username",children:i}),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"})]})]})]})}function Pc({account:t,instance:n,onClose:i}){const{masto:s,instance:o,authenticated:a}=oe({instance:n}),p=typeof t=="string";return ee(()=>{p||(A.accounts[`${t.id}@${o}`]=t)},[t]),ks(i),e("div",{class:"sheet",children:[!!i&&e("button",{type:"button",class:"sheet-close outer",onClick:i,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e(Ts,{instance:o,authenticated:a,account:t,fetchAccount:async()=>{if(p)try{return await s.v1.accounts.lookup({acct:t,skip_webfinger:!1})}catch{const c=await s.v2.search.fetch({q:t,type:"accounts",limit:1,resolve:a});if(c.accounts.length)return c.accounts[0];if(/https?:\/\/[^/]+\/@/.test(t)){const l=URL.parse(t),{hostname:m,pathname:h}=l,f=h.replace(/^\//,"").replace(/\/$/,"")+"@"+m,d=await s.v2.search.fetch({q:f,type:"accounts",limit:1,resolve:a});if(d.accounts.length)return d.accounts[0]}}else return t}})]})}function Oc({onClose:t}){const{masto:n}=oe(),[i,s]=L("default"),[o,a]=L([]),[p,r]=$t(l=>l+1,0);ee(()=>{s("loading"),(async()=>{try{const l=await dt.drafts.keys();if(l.length){const m=bn(),h=l.filter(f=>f.startsWith(m));if(h.length){const f=await dt.drafts.getMany(h);f.sort((d,v)=>new Date(v.updatedAt).getTime()-new Date(d.updatedAt).getTime()),a(f)}else a([])}else a([]);s("default")}catch{s("error")}})()},[p]);const c=(o==null?void 0:o.length)>0;return e("div",{class:"sheet",children:[!!t&&e("button",{type:"button",class:"sheet-close",onClick:t,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:[e("h2",{children:[e(u,{id:"krk5ws"})," ",e(Ne,{abrupt:!0,hidden:i!=="loading"})]}),c&&e("div",{class:"insignificant",children:e(u,{id:"Ap/10+"})})]}),e("main",{children:c?e(B,{children:[e("ul",{class:"drafts-list",children:o.map(l=>{const{updatedAt:m,key:h,draftStatus:f,replyTo:d}=l,v=new Date(m);return e("li",{children:[e("div",{class:"mini-draft-meta",children:[e("b",{children:[e(C,{icon:d?"reply":"quill",size:"s"})," ",e("time",{children:[!!d&&e(B,{children:[e("span",{class:"bidi-isolate",children:["@",d.account.acct]}),e("br",{})]}),ut(v)]})]}),e(rt,{confirmLabel:e("span",{children:e(u,{id:"/W5yFF"})}),menuItemClassName:"danger",align:"end",disabled:i==="loading",onClick:()=>{(async()=>{try{await dt.drafts.del(h),r()}catch{alert(g._({id:"rEYoku"}))}})()},children:e("button",{type:"button",class:"small light",disabled:i==="loading",children:e(u,{id:"Jb6/SB"})})})]}),e("button",{type:"button",disabled:i==="loading",class:"draft-item",onClick:async()=>{let b;if(d){s("loading");try{b=await n.v1.statuses.$select(d.id).fetch()}catch{alert(g._({id:"tMwimH"})),s("default");return}s("default")}window.__COMPOSE__={draftStatus:f,replyToStatus:b},A.showCompose=!0,A.showDrafts=!1},children:e(zc,{draft:l})})]},m)})}),o.length>1&&e("p",{children:e(rt,{confirmLabel:e("span",{children:e(u,{id:"3IakFR"})}),menuItemClassName:"danger",disabled:i==="loading",onClick:()=>{(async()=>{s("loading");try{await dt.drafts.delMany(o.map(l=>l.key)),s("default"),r()}catch{alert(g._({id:"0J4sZq"})),s("error")}})()},children:e("button",{type:"button",class:"light danger",disabled:i==="loading",children:e(u,{id:"hOg+Mt"})})})})]}):e("p",{children:e(u,{id:"8iQ+jk"})})})]})}function zc({draft:t}){var h;const{draftStatus:n,replyTo:i}=t,{status:s,spoilerText:o,poll:a,mediaAttachments:p}=n,r=((h=a==null?void 0:a.options)==null?void 0:h.length)>0,c=(p==null?void 0:p.length)>0,l=r||c,m=_e(()=>{if(!c)return;const f=p.find(b=>/image/.test(b.type));if(!f)return;const{file:d}=f;return URL.createObjectURL(d)},[c,p]);return e(B,{children:e("div",{class:"mini-draft",children:[l&&e("div",{class:`mini-draft-aside ${m?"has-image":""}`,style:m?{"--bg-image":`url(${m})`}:{},children:[r&&e(C,{icon:"poll",alt:g._({id:"4WUbF1"})}),c&&e("span",{children:[e(C,{icon:"attachment",alt:g._({id:"xYilR2"})})," ",e("small",{children:p==null?void 0:p.length})]})]}),e("div",{class:"mini-draft-main",children:[!!o&&e("div",{class:"mini-draft-spoiler",children:o}),!!s&&e("div",{class:"mini-draft-status",children:s})]})]})})}function Uc({html:t,url:n,width:i,height:s,onClose:o=()=>{}}){return e("div",{class:"embed-modal-container",children:[e("div",{class:"top-controls",children:[e("button",{type:"button",class:"light",onClick:()=>o(),children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),n&&e("a",{href:n,target:"_blank",rel:"noopener noreferrer",class:"button plain",children:[e("span",{children:e(u,{id:"4/RpOy"})})," ",e(C,{icon:"external"})]})]}),e("div",{class:"embed-content",dangerouslySetInnerHTML:{__html:t},style:{"--width":i+"px","--height":s+"px","--aspect-ratio":`${i}/${s}`}})]})}function Fc({instance:t,excludeRelationshipAttrs:n=[],postID:i,onClose:s=()=>{},blankCopy:o=g._({id:"10OlfF"})}){const{masto:a,instance:p}=oe(),r=t?t===p:!0,c=He(A),[l,m]=L("default"),[h,f]=L([]),[d,v]=L(!1);if(ks(s),!c.showGenericAccounts)return null;const{id:b,heading:w,fetchAccounts:_,accounts:y,showReactions:S}=c.showGenericAccounts,[k,T]=L({}),I=async $=>{if(!($!=null&&$.length)||!r)return;const Y=await ei($,k);Y&&T({...k,...Y})},x=$=>{_&&($&&f([]),m("loading"),(async()=>{try{const{done:Y,value:X}=await _($);if(Array.isArray(X)){if($){const J=[];for(let N=0;N<X.length;N++){const M=X[N],z=J.find((V,U)=>V.id===M.id&&N!==U);z?z._types.push(...M._types):J.push({_types:[],...M})}f(J)}else f(J=>{const N=J;for(const M of X){const z=N.find(V=>V.id===M.id);z?z._types.push(...M._types):N.push(M)}return N});v(!Y),I(X)}else v(!1);m("default")}catch{m("error")}})())},O=q(!0);ee(()=>{(y==null?void 0:y.length)>0?(f(y),I(y)):(x(!0),O.current=!1)},[y,_]),ee(()=>{var $;O.current||(($=c.reloadGenericAccounts)==null?void 0:$.id)===b&&x(!0)},[c.reloadGenericAccounts.counter]);const P=A.statuses[i];return e("div",{id:"generic-accounts-container",class:"sheet",tabindex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:s,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:w||g._({id:"bPwFdf"})})}),e("main",{children:[P&&e(he,{to:`/${t||p}/s/${P.id}`,class:"post-preview",children:e(qe,{status:P,size:"s",readOnly:!0})}),h.length>0?e(B,{children:[e("ul",{class:"accounts-list",children:h.map($=>{var J,N;const Y=k[$.id],X=`${$.id}-${((J=$._types)==null?void 0:J.length)||""}`;return e("li",{children:[S&&((N=$._types)==null?void 0:N.length)>0&&e("div",{class:"reactions-block",children:$._types.map(M=>e(C,{icon:{reblog:"rocket",favourite:"heart"}[M],class:`${M}-icon`}))}),e("div",{class:"account-relationships",children:e(at,{account:$,showStats:!0,relationship:Y,excludeRelationshipAttrs:n})})]},X)})}),l==="default"?d?e(wt,{onChange:$=>{$&&x()},children:e("button",{type:"button",class:"plain block",onClick:()=>x(),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(Ne,{abrupt:!0})})]}):l==="loading"?e("p",{class:"ui-state",children:e(Ne,{abrupt:!0})}):l==="error"?e("p",{class:"ui-state",children:e(u,{id:"AThL/k"})}):e("p",{class:"ui-state insignificant",children:o})]})]})}function Bc({alt:t,lang:n,onClose:i}){const s=He(A),[o,a]=L(!1),p=os(!0),r=s.settings.contentTranslationHideLanguages||[],c=!!n&&n!==p&&!vi([n],[p])&&!r.find(l=>n===l||vi([n],[l]));return e("div",{class:"sheet",tabindex:"-1",children:[!!i&&e("button",{type:"button",class:"sheet-close outer",onClick:i,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{class:"header-grid",children:[e("h2",{children:e(u,{id:"5gfDMm"})}),e("div",{class:"header-side",children:e(ct,{align:"end",menuButton:e("button",{type:"button",class:"plain4",children:e(C,{icon:"more",alt:g._({id:"2FYpfJ"}),size:"xl"})}),children:[e(ye,{disabled:o,onClick:()=>{a(!0)},children:[e(C,{icon:"translate"}),e("span",{children:e(u,{id:"pi8x/S"})})]}),ko&&e(ye,{onClick:()=>{So(t,n)},children:[e(C,{icon:"speak"}),e("span",{children:e(u,{id:"yIBLq8"})})]})]})})]}),e("main",{lang:n,dir:"auto",children:[e("p",{style:{whiteSpace:"pre-wrap",textWrap:"pretty"},children:t}),(c||o)&&e(rs,{forceTranslate:o,sourceLanguage:n,text:t})]})]})}function Mn(t,n,i){return Math.max(Math.min(t,i),n)}const Dn=t=>t>=.04045?Math.pow((t+.055)/1.055,2.4):t/12.92,Nn=t=>t>=.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t;function hi([t,n,i]){t=Dn(t/255),n=Dn(n/255),i=Dn(i/255);var s=.4122214708*t+.5363325363*n+.0514459929*i,o=.2119034982*t+.6806995451*n+.1073969566*i,a=.0883024619*t+.2817188376*n+.6299787005*i;return s=Math.cbrt(s),o=Math.cbrt(o),a=Math.cbrt(a),[s*.2104542553+o*.793617785+a*-.0040720468,s*1.9779984951+o*-2.428592205+a*.4505937099,s*.0259040371+o*.7827717662+a*-.808675766]}function fi([t,n,c]){var s=t+n*.3963377774+c*.2158037573,o=t+n*-.1055613458+c*-.0638541728,a=t+n*-.0894841775+c*-1.291485548;s=s**3,o=o**3,a=a**3;var p=s*4.0767416621+o*-3.3077115913+a*.2309699292,r=s*-1.2684380046+o*2.6097574011+a*-.3413193965,c=s*-.0041960863+o*-.7034186147+a*1.707614701;return p=255*Nn(p),r=255*Nn(r),c=255*Nn(c),p=Mn(p,0,255),r=Mn(r,0,255),c=Mn(c,0,255),p=Math.round(p),r=Math.round(r),c=Math.round(c),[p,r,c]}const Hc={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_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_IMG_ALT_API_URL:$l}=Hc;function xs({mediaAttachments:t,statusID:n,instance:i,lang:s,index:o=0,onClose:a=()=>{}}){var y,S;const[p,r]=L("default"),c=q(null),[l,m]=L(o),h=q(null);yt(()=>{var k;(k=h.current)==null||k.scrollIntoView()},[]);const f=q(n);ee(()=>{const k=o*c.current.clientWidth,T=f.current!==n;T&&(f.current=n),c.current.focus(),c.current.scrollTo({left:k*(Et()?-1:1),behavior:T?"auto":"smooth"})},[o,n]);const[d,v]=L(!0);ee(()=>{let k=()=>{a()};return c.current&&c.current.addEventListener("swiped-down",k),()=>{c.current&&c.current.removeEventListener("swiped-down",k)}},[]),Be("esc",a,{ignoreEventWhen:k=>!!document.querySelector("#modal-container > *")},[a]),ee(()=>{let k=()=>{const{clientWidth:T,scrollLeft:I}=c.current,x=Math.round(Math.abs(I)/T);m(x)};return c.current&&c.current.addEventListener("scroll",k,{passive:!0}),()=>{c.current&&c.current.removeEventListener("scroll",k)}},[]),ee(()=>{let k=setTimeout(()=>{var T,I;(I=(T=c.current)==null?void 0:T.focus)==null||I.call(T)},100);return()=>clearTimeout(k)},[]);const b=_e(()=>t==null?void 0:t.map(k=>{const{blurhash:T}=k;if(T){const I=ti(T),x=hi(I);return fi([.6,x[1],x[2]])}return null}),[t]),w=_e(()=>{var I;const T=100/b.length;return((I=b==null?void 0:b.map((x,O)=>{const P=O*T+5,$=(O+1)*T-5;return x?`
rgba(${x==null?void 0:x.join(",")}, 0.4) ${P}%,
rgba(${x==null?void 0:x.join(",")}, 0.4) ${$}%
`:`
transparent ${P}%,
transparent ${$}%
`}))==null?void 0:I.join(", "))||"transparent"},[b]);let _=q(null);return ee(()=>()=>{var k,T;(T=(k=_.current)==null?void 0:k.hideToast)==null||T.call(k)},[]),e("div",{class:`media-modal-container media-modal-count-${t==null?void 0:t.length}`,children:[e("div",{ref:c,tabIndex:"0","data-swipe-threshold":"44",class:"carousel",onClick:k=>{(k.target.classList.contains("carousel-item")||k.target.classList.contains("media")||k.target.classList.contains("media-zoom"))&&a()},style:t.length>1?{backgroundAttachment:"local",backgroundImage:`linear-gradient(
to ${Et()?"left":"right"}, ${w})`}:{},children:t==null?void 0:t.map((k,T)=>{const I=t.length===1?b[T]:null;return e("div",{class:"carousel-item",style:I?{"--accent-color":`rgb(${I==null?void 0:I.join(",")})`,"--accent-alpha-color":`rgba(${I==null?void 0:I.join(",")}, 0.4)`}:{},tabindex:"0",ref:T===l?h:null,onClick:x=>{x.target.classList.contains("media")||v(!d)},children:[!!k.description&&e("button",{type:"button",class:"media-alt",hidden:!d,onClick:()=>{A.showMediaAlt={alt:k.description,lang:s}},children:[e("span",{class:"alt-badge",children:"ALT"}),e("span",{class:"media-alt-desc",lang:s,dir:"auto",children:k.description})]}),e(ls,{media:k,showOriginal:!0,lang:s})]},k.id)})}),e("div",{class:"carousel-top-controls",hidden:!d,children:[e("span",{children:e("button",{type:"button",class:"carousel-button",onClick:()=>a(),children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})})}),(t==null?void 0:t.length)>1?e("span",{class:"carousel-dots",children:t==null?void 0:t.map((k,T)=>e("button",{type:"button",disabled:T===l,class:`carousel-dot ${T===l?"active":""}`,onClick:I=>{I.preventDefault(),I.stopPropagation();const x=c.current.clientWidth*T*(Et()?-1:1);c.current.scrollTo({left:x,behavior:"smooth"}),c.current.focus()},children:e(C,{icon:"round",size:"s",alt:"⸱"})},k.id))}):e("span",{}),e("span",{children:[e(ct,{overflow:"auto",align:"end",position:"anchor",gap:4,menuClassName:"glass-menu",menuButton:e("button",{type:"button",class:"carousel-button",children:e(C,{icon:"more",alt:g._({id:"2FYpfJ"})})}),children:[e(Ue,{href:((y=t[l])==null?void 0:y.remoteUrl)||((S=t[l])==null?void 0:S.url),class:"carousel-button",target:"_blank",title:g._({id:"5hXGws"}),children:[e(C,{icon:"popout"}),e("span",{children:e(u,{id:"aDr7Vc"})})]}),!1]})," ",e(he,{to:`${i?`/${i}`:""}/s/${n}${window.matchMedia("(min-width: calc(40em + 350px))").matches?`?media=${l+1}`:""}`,class:"button carousel-button media-post-link",children:[e("span",{class:"button-label",children:[e(u,{id:"ISg5SQ"})," "]}),"»"]})]})]}),(t==null?void 0:t.length)>1&&e("div",{class:"carousel-controls",hidden:!d,children:[e("button",{type:"button",class:"carousel-button",hidden:l===0,onClick:k=>{k.preventDefault(),k.stopPropagation(),c.current.focus(),c.current.scrollTo({left:c.current.clientWidth*(l-1)*(Et()?-1:1),behavior:"smooth"})},children:e(C,{icon:"arrow-left",alt:g._({id:"DHhJ7s"})})}),e("button",{type:"button",class:"carousel-button",hidden:l===t.length-1,onClick:k=>{k.preventDefault(),k.stopPropagation(),c.current.focus(),c.current.scrollTo({left:c.current.clientWidth*(l+1)*(Et()?-1:1),behavior:"smooth"})},children:e(C,{icon:"arrow-right",alt:g._({id:"hXzOVo"})})})]})]})}const qc=[,"spam","legal","violation","other"],Wt={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 Yc({account:t,post:n,onClose:i}){const{_:s}=Je(),{masto:o}=oe(),[a,p]=L("default"),[r,c]=t.acct.split("@"),[l,m]=_e(()=>{const{rules:y,domain:S}=es();return[y||[],S]}),[h,f]=L(null),[d,v]=L(!1),b=q(null),[w,_]=L(!1);return e("div",{class:"report-modal-container",children:[e("div",{class:"top-controls",children:[e("h1",{children:n?g._({id:"muLhL3"}):g._({id:"ACul2G",values:{username:r}})}),e("button",{type:"button",class:"plain4 small",disabled:a==="loading",onClick:()=>i(),children:e(C,{icon:"x",size:"xl",alt:g._({id:"yz7wBu"})})})]}),e("main",{children:[e("div",{class:"report-preview",children:n?e(qe,{status:n,size:"s",previewMode:!0}):e(at,{account:t,avatarSize:"xxl",useAvatarStatic:!0,showStats:!0,showActivity:!0})}),!!h&&!Wt[h].excludeStamp&&e("span",{class:"rubber-stamp","aria-hidden":"true",children:[s(Wt[h].stampLabel||s(Wt[h].label)),e("small",{children:e(u,{id:"2WtL62"})})]},h),e("form",{onSubmit:y=>{y.preventDefault();const S=new FormData(y.target),k=Object.fromEntries(S.entries());let{category:T,comment:I,forward:x}=k;I||(I=void 0),x==="on"&&(x=!0);const O=T==="violation"?Object.entries(k).filter(([$])=>$.startsWith("rule_ids")).map(([$,Y])=>Y):void 0,P={category:T,comment:I,forward:x,ruleIds:O};p("loading"),(async()=>{try{await o.v1.reports.create({accountId:t.id,statusIds:n!=null&&n.id?[n.id]:void 0,category:T,comment:I,ruleIds:O,forward:x}),p("success"),ue(n?g._({id:"y3ou+8"}):g._({id:"R9kjEL"})),i()}catch($){p("error"),ue(($==null?void 0:$.message)||(n?g._({id:"+3FjPq"}):g._({id:"oEQq5w"})))}})()},children:[e("p",{children:n?g._({id:"L9fUm+"}):g._({id:"rSLkfe"})}),e("section",{class:"report-categories",children:qc.map(y=>y==="violation"&&!(l!=null&&l.length)?null:e(B,{children:[e("label",{class:"report-category",children:[e("input",{type:"radio",name:"category",value:y,required:!0,disabled:a==="loading",onChange:S=>{f(S.target.value),v(S.target.value==="violation")}}),e("span",{children:[s(Wt[y].label),"  ",e("small",{class:"ib insignificant",children:s(Wt[y].description)})]})]}),y==="violation"&&!!(l!=null&&l.length)&&e("div",{class:"shazam-container no-animation",hidden:!d,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"report-rules",ref:b,children:l.map((S,k)=>e("label",{class:"report-rule",children:[e("input",{type:"checkbox",name:`rule_ids[${k}]`,value:S.id,required:d&&!w,disabled:a==="loading",onChange:T=>{const{checked:I}=T.target;I?_(!0):b.current.querySelectorAll("input:checked").length||_(!1)}}),e("span",{children:S.text})]},S.id))})})})]},y))}),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:a==="loading",required:!n})]}),!!c&&c!==m&&e("section",{children:e("p",{children:e("label",{children:[e("input",{type:"checkbox",switch:!0,name:"forward",disabled:a==="loading"})," ",e("span",{children:e(u,{id:"cyjS8M",values:{domain:c},components:{0:e("i",{})}})})]})})}),e("footer",{children:[e("button",{type:"submit",disabled:a==="loading",children:e(u,{id:"4cijjm"})})," ",e("button",{type:"submit",class:"plain2",disabled:a==="loading",onClick:async()=>{try{await o.v1.accounts.$select(t.id).mute(),ue(g._({id:"/BGBeF",values:{username:r}}))}catch{ue(g._({id:"v02K7/",values:{username:r}}))}},children:e(u,{id:"caeqw/",components:{0:e("small",{class:"ib"})}})})," ",e("button",{type:"submit",class:"plain2",disabled:a==="loading",onClick:async()=>{try{await o.v1.accounts.$select(t.id).block(),ue(g._({id:"kjUejn",values:{username:r}}))}catch{ue(g._({id:"pMcdDp",values:{username:r}}))}},children:e(u,{id:"JybQca",components:{0:e("small",{class:"ib"})}})}),e(Ne,{hidden:a!=="loading"})]})]})]})]})}var pi={exports:{}},Ml=pi.exports;(function(t){var n=function(){var i=String.fromCharCode,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",a={};function p(c,l){if(!a[c]){a[c]={};for(var m=0;m<c.length;m++)a[c][c.charAt(m)]=m}return a[c][l]}var r={compressToBase64:function(c){if(c==null)return"";var l=r._compress(c,6,function(m){return s.charAt(m)});switch(l.length%4){default:case 0:return l;case 1:return l+"===";case 2:return l+"==";case 3:return l+"="}},decompressFromBase64:function(c){return c==null?"":c==""?null:r._decompress(c.length,32,function(l){return p(s,c.charAt(l))})},compressToUTF16:function(c){return c==null?"":r._compress(c,15,function(l){return i(l+32)})+" "},decompressFromUTF16:function(c){return c==null?"":c==""?null:r._decompress(c.length,16384,function(l){return c.charCodeAt(l)-32})},compressToUint8Array:function(c){for(var l=r.compress(c),m=new Uint8Array(l.length*2),h=0,f=l.length;h<f;h++){var d=l.charCodeAt(h);m[h*2]=d>>>8,m[h*2+1]=d%256}return m},decompressFromUint8Array:function(c){if(c==null)return r.decompress(c);for(var l=new Array(c.length/2),m=0,h=l.length;m<h;m++)l[m]=c[m*2]*256+c[m*2+1];var f=[];return l.forEach(function(d){f.push(i(d))}),r.decompress(f.join(""))},compressToEncodedURIComponent:function(c){return c==null?"":r._compress(c,6,function(l){return o.charAt(l)})},decompressFromEncodedURIComponent:function(c){return c==null?"":c==""?null:(c=c.replace(/ /g,"+"),r._decompress(c.length,32,function(l){return p(o,c.charAt(l))}))},compress:function(c){return r._compress(c,16,function(l){return i(l)})},_compress:function(c,l,m){if(c==null)return"";var h,f,d={},v={},b="",w="",_="",y=2,S=3,k=2,T=[],I=0,x=0,O;for(O=0;O<c.length;O+=1)if(b=c.charAt(O),Object.prototype.hasOwnProperty.call(d,b)||(d[b]=S++,v[b]=!0),w=_+b,Object.prototype.hasOwnProperty.call(d,w))_=w;else{if(Object.prototype.hasOwnProperty.call(v,_)){if(_.charCodeAt(0)<256){for(h=0;h<k;h++)I=I<<1,x==l-1?(x=0,T.push(m(I)),I=0):x++;for(f=_.charCodeAt(0),h=0;h<8;h++)I=I<<1|f&1,x==l-1?(x=0,T.push(m(I)),I=0):x++,f=f>>1}else{for(f=1,h=0;h<k;h++)I=I<<1|f,x==l-1?(x=0,T.push(m(I)),I=0):x++,f=0;for(f=_.charCodeAt(0),h=0;h<16;h++)I=I<<1|f&1,x==l-1?(x=0,T.push(m(I)),I=0):x++,f=f>>1}y--,y==0&&(y=Math.pow(2,k),k++),delete v[_]}else for(f=d[_],h=0;h<k;h++)I=I<<1|f&1,x==l-1?(x=0,T.push(m(I)),I=0):x++,f=f>>1;y--,y==0&&(y=Math.pow(2,k),k++),d[w]=S++,_=String(b)}if(_!==""){if(Object.prototype.hasOwnProperty.call(v,_)){if(_.charCodeAt(0)<256){for(h=0;h<k;h++)I=I<<1,x==l-1?(x=0,T.push(m(I)),I=0):x++;for(f=_.charCodeAt(0),h=0;h<8;h++)I=I<<1|f&1,x==l-1?(x=0,T.push(m(I)),I=0):x++,f=f>>1}else{for(f=1,h=0;h<k;h++)I=I<<1|f,x==l-1?(x=0,T.push(m(I)),I=0):x++,f=0;for(f=_.charCodeAt(0),h=0;h<16;h++)I=I<<1|f&1,x==l-1?(x=0,T.push(m(I)),I=0):x++,f=f>>1}y--,y==0&&(y=Math.pow(2,k),k++),delete v[_]}else for(f=d[_],h=0;h<k;h++)I=I<<1|f&1,x==l-1?(x=0,T.push(m(I)),I=0):x++,f=f>>1;y--,y==0&&(y=Math.pow(2,k),k++)}for(f=2,h=0;h<k;h++)I=I<<1|f&1,x==l-1?(x=0,T.push(m(I)),I=0):x++,f=f>>1;for(;;)if(I=I<<1,x==l-1){T.push(m(I));break}else x++;return T.join("")},decompress:function(c){return c==null?"":c==""?null:r._decompress(c.length,32768,function(l){return c.charCodeAt(l)})},_decompress:function(c,l,m){var h=[],f,d=4,v=4,b=3,w="",_=[],y,S,k,T,I,x,O,P={val:m(0),position:l,index:1};for(y=0;y<3;y+=1)h[y]=y;for(k=0,I=Math.pow(2,2),x=1;x!=I;)T=P.val&P.position,P.position>>=1,P.position==0&&(P.position=l,P.val=m(P.index++)),k|=(T>0?1:0)*x,x<<=1;switch(f=k){case 0:for(k=0,I=Math.pow(2,8),x=1;x!=I;)T=P.val&P.position,P.position>>=1,P.position==0&&(P.position=l,P.val=m(P.index++)),k|=(T>0?1:0)*x,x<<=1;O=i(k);break;case 1:for(k=0,I=Math.pow(2,16),x=1;x!=I;)T=P.val&P.position,P.position>>=1,P.position==0&&(P.position=l,P.val=m(P.index++)),k|=(T>0?1:0)*x,x<<=1;O=i(k);break;case 2:return""}for(h[3]=O,S=O,_.push(O);;){if(P.index>c)return"";for(k=0,I=Math.pow(2,b),x=1;x!=I;)T=P.val&P.position,P.position>>=1,P.position==0&&(P.position=l,P.val=m(P.index++)),k|=(T>0?1:0)*x,x<<=1;switch(O=k){case 0:for(k=0,I=Math.pow(2,8),x=1;x!=I;)T=P.val&P.position,P.position>>=1,P.position==0&&(P.position=l,P.val=m(P.index++)),k|=(T>0?1:0)*x,x<<=1;h[v++]=i(k),O=v-1,d--;break;case 1:for(k=0,I=Math.pow(2,16),x=1;x!=I;)T=P.val&P.position,P.position>>=1,P.position==0&&(P.position=l,P.val=m(P.index++)),k|=(T>0?1:0)*x,x<<=1;h[v++]=i(k),O=v-1,d--;break;case 2:return _.join("")}if(d==0&&(d=Math.pow(2,b),b++),h[O])w=h[O];else if(O===v)w=S+S.charAt(0);else return null;_.push(w),h[v++]=S+w.charAt(0),d--,S=w,d==0&&(d=Math.pow(2,b),b++)}}};return r}();t!=null?t.exports=n:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return n})})(pi);var Mi=pi.exports;const jc="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",Vc="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",Gc="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",Kc=200,Wc=10;async function _n(){const{masto:t}=oe(),n=t.v1.followedTags.list({limit:Kc}),i=[];let s=0;do{const{value:o,done:a}=await n.next();if(a||(o==null?void 0:o.length)===0)break;i.push(...o),s++}while(s<Wc);return i.sort((o,a)=>o.name.localeCompare(a.name)),i.length&&setTimeout(()=>{me.account.set("followedTags",{tags:i,updatedAt:Date.now()})},1),i}const Zc=24*60*60*1e3;async function Xc(){try{const{tags:t,updatedAt:n}=me.account.get("followedTags")||{};return t!=null&&t.length?(Date.now()-n>Zc&&_n(),t):await _n()}catch{return[]}}const Di=document.createElement("div"),Jc=t=>{if(!t)return[];if(t.indexOf("#")===-1)return[];Di.innerHTML=t;const n=Di.querySelectorAll("a.hashtag");return n.length?Array.from(n).map(i=>i.innerText.trim().replace(/^[^#]*#+/,"")):[]};function un({children:t}){if(typeof t=="string")return t;const[n,i]=L("");return ee(()=>{Promise.resolve(t).then(i)},[t]),n}const bt=9,Qc=["following","mentions","notifications","list","public","trending","search","hashtag","bookmarks","favourites"],As={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"}},hn={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}]},ea=_t(async({id:t})=>{const n=await oe().masto.v1.accounts.$select(t).fetch();return n.username||n.acct||n.displayName}),kn={following:{id:"home",title:(t,n)=>n===0?g._({id:"i0qMbr"}):g._({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:t})=>t?"list":"lists",title:({id:t})=>t?bc(t):g._({id:"h16FyT"}),path:({id:t})=>t?`/l/${t}`:"/l",icon:"list",excludeViewMode:({id:t})=>t?[]:["multi-column"]},public:{id:"public",title:({local:t})=>t?g._({id:"d5zxa4"}):g._({id:"4ERYY7"}),subtitle:({instance:t})=>t||oe().instance,path:({local:t,instance:n})=>`/${n}/p${t?"/l":""}`,icon:({local:t})=>t?"building":"earth"},trending:{id:"trending",title:{id:"4/iCqx"},subtitle:({instance:t})=>t||oe().instance,path:({instance:t})=>`/${t}/trending`,icon:"chart"},search:{id:"search",title:({query:t})=>t?`${t}`:g._({id:"A1taO8"}),path:({query:t})=>t?`/search?q=${encodeURIComponent(t)}&type=statuses`:"/search",icon:"search",excludeViewMode:({query:t})=>t?[]:["multi-column"]},"account-statuses":{id:"account-statuses",title:ea,path:({id:t})=>`/a/${t}`,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:t})=>t,subtitle:({instance:t})=>t||oe().instance,path:({hashtag:t,instance:n,media:i})=>`${n?`/${n}`:""}/t/${t.split(/\s+/).join("+")}${i?"?media=1":""}`,icon:"hashtag"}};function ta({onClose:t}){const{_:n}=Je(),i=He(A),{shortcuts:s}=i,[o,a]=L(!1),[p,r]=L(!1),[c]=ai();return e("div",{id:"shortcuts-settings-container",class:"sheet",tabindex:"-1",children:[!!t&&e("button",{type:"button",class:"sheet-close",onClick:t,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:[e(C,{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:g._({id:"qwdOim"}),imgURL:jc},{value:"tab-menu-bar",label:g._({id:"UxBoCm"}),imgURL:Gc},{value:"multi-column",label:g._({id:"uvDfdW"}),imgURL:Vc}].map(({value:l,label:m,imgURL:h})=>{const f=i.settings.shortcutsViewMode===l||l==="float-button"&&!i.settings.shortcutsViewMode;return e("label",{class:f?"checked":"",children:[e("input",{type:"radio",name:"shortcuts-view-mode",value:l,checked:f,onChange:d=>{A.settings.shortcutsViewMode=d.target.value}})," ",e("img",{src:h,alt:"",width:"80",height:"58"})," ",e("span",{children:m})]},l)})}),s.length>0?e(B,{children:[e("ol",{class:"shortcuts-list",ref:c,children:s.filter(Boolean).map((l,m)=>{const h=Object.values(l).join("-"),{type:f}=l;if(!kn[f])return null;let{icon:d,title:v,subtitle:b,excludeViewMode:w}=kn[f];typeof v=="function"?v=v(l,m):v=n(v),typeof b=="function"?b=b(l,m):b=n(b),typeof d=="function"&&(d=d(l,m)),typeof w=="function"&&(w=w(l,m));const _=w==null?void 0:w.includes(i.settings.shortcutsViewMode);return e("li",{children:[e(C,{icon:d}),e("span",{class:"shortcut-text",children:[e(un,{children:v}),b&&e(B,{children:[" ",e("small",{class:"ib insignificant",children:b})]}),_&&e("span",{class:"tag",children:e(u,{id:"5KJFnN"})})]}),e("span",{class:"shortcut-actions",children:[e("button",{type:"button",class:"plain small",disabled:m===0,onClick:()=>{const y=Array.from(A.shortcuts);if(m>0){const S=A.shortcuts[m-1];y[m-1]=l,y[m]=S,A.shortcuts=y}},children:e(C,{icon:"arrow-up",alt:g._({id:"QyioBP"})})}),e("button",{type:"button",class:"plain small",disabled:m===s.length-1,onClick:()=>{const y=Array.from(A.shortcuts);if(m<A.shortcuts.length-1){const S=A.shortcuts[m+1];y[m+1]=l,y[m]=S,A.shortcuts=y}},children:e(C,{icon:"arrow-down",alt:g._({id:"3Ib6FN"})})}),e("button",{type:"button",class:"plain small",onClick:()=>{a({shortcut:l,shortcutIndex:m})},children:e(C,{icon:"pencil",alt:g._({id:"ePK91l"})})})]})]},h)})}),s.length===1&&i.settings.shortcutsViewMode!=="float-button"&&e("div",{class:"ui-state insignificant",children:[e(C,{icon:"info"})," ",e("small",{children:e(u,{id:"3Xq4Zi"})})]})]}):e("div",{class:"ui-state insignificant",children:[e("p",{children:i.settings.shortcutsViewMode==="multi-column"?g._({id:"3xIN+E"}):g._({id:"vLxvHT"})}),e("p",{children:e(u,{id:"Fq4zw3",components:{0:e("br",{}),1:e("a",{href:"#",onClick:l=>{l.preventDefault(),A.shortcuts=[{type:"following"},{type:"notifications"}]}})}})})]}),e("p",{class:"insignificant",children:s.length>=bt&&(i.settings.shortcutsViewMode==="multi-column"?g._({id:"RqXfsz",values:{SHORTCUTS_LIMIT:bt}}):g._({id:"EVRO/o",values:{SHORTCUTS_LIMIT:bt}}))}),e("p",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e("button",{type:"button",class:"light",onClick:()=>r(!0),children:e(u,{id:"bgVLbt"})}),e("button",{type:"button",disabled:s.length>=bt,onClick:()=>a(!0),children:[e(C,{icon:"plus"})," ",e("span",{children:i.settings.shortcutsViewMode==="multi-column"?g._({id:"Vh3ADI"}):g._({id:"9tmn6W"})})]})]})]}),o&&e(Fe,{onClick:l=>{l.target===l.currentTarget&&a(!1)},children:e(na,{shortcut:o.shortcut,shortcutIndex:o.shortcutIndex,onSubmit:({result:l,mode:m})=>{m==="edit"?A.shortcuts[o.shortcutIndex]=l:A.shortcuts.push(l)},onClose:()=>a(!1)})}),p&&e(Fe,{onClick:l=>{l.target===l.currentTarget&&r(!1)},children:e(ia,{shortcuts:s,onClose:()=>r(!1)})})]})}const Ni={list:{id:"1qL+L+"},search:{id:"dmTmkQ"},hashtag:{id:"E8laYz"}};function na({onSubmit:t,disabled:n,shortcut:i,shortcutIndex:s,onClose:o}){var w,_;const{_:a}=Je(),p=!!i,[r,c]=L((i==null?void 0:i.type)||null),[l,m]=L("default"),[h,f]=L([]),[d,v]=L([]);ee(()=>{(async()=>{if(r==="list")try{m("loading");const y=await sn();f(y),m("default")}catch{m("error")}})(),(async()=>{if(r==="hashtag")try{const y=await _n();v(y)}catch{}})()},[r]);const b=q();return ee(()=>{if(p&&r&&hn[r]){const y=b.current;hn[r].forEach(({name:S,type:k})=>{const T=y.querySelector(`[name="${S}"]`);T&&i[S]&&(k==="checkbox"?T.checked=i[S]==="on":T.value=i[S])})}},[p,r]),e("div",{id:"shortcut-settings-form",class:"sheet",children:[!!o&&e("button",{type:"button",class:"sheet-close",onClick:o,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:p?g._({id:"pe1jog"}):g._({id:"Lsxpe5"})})}),e("main",{tabindex:"-1",children:e("form",{ref:b,onSubmit:y=>{y.preventDefault();const S=new FormData(y.target),k={};S.forEach((T,I)=>{k[I]=T==null?void 0:T.trim(),I==="instance"&&(k[I]=k[I].replace(/^https?:\/\//,"").replace(/\/+$/,""),k[I]=k[I].replace(/^@?[^@]+@/,""))}),k.type&&(t({result:k,mode:p?"edit":"add"}),y.target.reset(),c(null),o==null||o())},children:[e("p",{children:e("label",{children:[e("span",{children:e(u,{id:"cklVjM"})}),e("select",{required:!0,disabled:n,onChange:y=>{c(y.target.value)},defaultValue:p?i.type:void 0,name:"type",dir:"auto",children:[e("option",{}),Qc.map(y=>e("option",{value:y,children:a(As[y])}))]})]})}),(_=(w=hn[r])==null?void 0:w.map)==null?void 0:_.call(w,({text:y,name:S,type:k,placeholder:T,pattern:I,notRequired:x})=>r==="list"?e("p",{children:e("label",{children:[e("span",{children:e(u,{id:"2BBAbc"})}),e("select",{name:"id",required:!x,disabled:n||l==="loading",defaultValue:p?i.id:void 0,dir:"auto",children:[e("option",{value:""}),h.map(O=>e("option",{value:O.id,children:O.title}))]})]})}):e("p",{children:e("label",{children:[e("span",{children:a(y)})," ",e("input",{type:k,switch:k==="checkbox"||void 0,name:S,placeholder:a(T),required:k==="text"&&!x,disabled:n,list:r==="hashtag"?"followed-hashtags-datalist":null,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:I,dir:"auto"}),r==="hashtag"&&d.length>0&&e("datalist",{id:"followed-hashtags-datalist",children:d.map(O=>e("option",{value:O.name}))})]})})),!!Ni[r]&&e("p",{class:"form-note insignificant",children:[e(C,{icon:"info"}),a(Ni[r])]}),e("footer",{children:[e("button",{type:"submit",class:"block",disabled:n||l==="loading",children:p?g._({id:"tfDRzk"}):g._({id:"m16xKo"})}),p&&e("button",{type:"button",class:"light danger",onClick:()=>{A.shortcuts.splice(s,1),o==null||o()},children:e(u,{id:"t/YqKh"})})]})]})})]})}function ia({shortcuts:t,onClose:n}){var f;const{_:i}=Je(),{masto:s}=oe(),o=_e(()=>!t||!t.filter(Boolean).length?"":Mi.compressToEncodedURIComponent(JSON.stringify(t.filter(Boolean))),[t]),[a,p]=L(""),[r,c]=L("default"),l=_e(()=>{if(!a)return c("default"),null;try{const d=JSON.parse(Mi.decompressFromEncodedURIComponent(a));if(!Array.isArray(d))throw new Error("Not an array");return c("default"),d}catch{try{const v=JSON.parse(a);if(!Array.isArray(v))throw new Error("Not an array");return c("default"),v}catch{return c("error"),null}}},[a]),m=A.shortcuts.length>0,h=q();return e("div",{id:"import-export-container",class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(C,{icon:"x",alt:g._({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(C,{icon:"arrow-down-circle",size:"l",class:"insignificant"})," ",e("span",{children:e(u,{id:"l3s5ri"})})]}),e("p",{class:"field-button",children:[e("input",{ref:h,type:"text",name:"import",placeholder:g._({id:"tBmklN"}),class:"block",onInput:d=>{p(d.target.value)},dir:"auto"}),A.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2 small",disabled:r==="cloud-downloading",onClick:async()=>{c("cloud-downloading");const d=vt();ue(g._({id:"HLqLGx"}));try{const b=(await s.v1.accounts.relationships.fetch({id:[d]}))[0];if(b){const{note:w=""}=b;if(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/.test(w)){const _=w.match(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/)[1],{v:y,dt:S,data:k}=JSON.parse(_);h.current.value=k,h.current.dispatchEvent(new Event("input"))}}c("default")}catch{c("error"),ue(g._({id:"gCDfX+"}))}},title:g._({id:"B6cG3J"}),children:[e(C,{icon:"cloud"}),e(C,{icon:"arrow-down"})]})]}),!!l&&Array.isArray(l)&&e(B,{children:[e("p",{children:[e("b",{children:l.length})," shortcut",l.length>1?"s":""," ",e("small",{class:"insignificant",children:["(",a.length," characters)"]})]}),e("ol",{class:"import-settings-list",children:l.map(d=>{var v,b;return e("li",{children:[e("span",{style:{opacity:t.some(w=>Object.keys(w).every(_=>w[_]===d[_]))?1:0},children:"*"}),e("span",{children:[i(As[d.type]),d.type==="list"&&" ⚠️"," ",(b=(v=hn[d.type])==null?void 0:v.map)==null?void 0:b.call(v,({text:w,name:_,type:y})=>d[_]?e(B,{children:[e("span",{class:"tag collapsed insignificant",children:[w,":"," ",y==="checkbox"?d[_]==="on"?"✅":"❌":d[_]]})," "]}):null)]})]})})}),e("p",{children:[e("small",{children:e(u,{id:"o6sElH"})}),e("br",{}),e("small",{children:["⚠️"," ",e(u,{id:"N4z4P/"})]})]})]}),r==="error"&&e("p",{class:"error",children:e("small",{children:["⚠️ ",e(u,{id:"ZhsPEb"})]})}),e("p",{children:[m&&e(B,{children:[e(rt,{confirmLabel:g._({id:"6MzUUU"}),menuFooter:e("div",{class:"footer",children:e(u,{id:"nl8sCE"})}),onClick:()=>{const d=l.filter(w=>!A.shortcuts.some(_=>Object.keys(_).every(y=>_[y]===w[y])));if(!d.length){ue(g._({id:"o6L30P"}));return}let v=[...A.shortcuts,...d];const b=v.length>bt;b&&(v=v.slice(0,bt)),A.shortcuts=v,ue(b?g._({id:"SBmqmC",values:{SHORTCUTS_LIMIT:bt}}):g._({id:"QO9uTx"})),n==null||n()},children:e("button",{type:"button",class:"plain2",disabled:!l,children:e(u,{id:"c89gCv"})})})," "]}),e(rt,{confirmLabel:m?g._({id:"6ZjzWP"}):g._({id:"DWumLi"}),menuItemClassName:m?"danger":void 0,onClick:()=>{A.shortcuts=l,ue(g._({id:"QO9uTx"})),n==null||n()},children:e("button",{type:"button",class:"plain2",disabled:!l,children:m?g._({id:"uIp8WL"}):g._({id:"Sjnlwj"})})})]})]}),e("section",{children:[e("h3",{children:[e(C,{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:o,readOnly:!0,onClick:d=>{if(d.target.value){d.target.select();try{navigator.clipboard.writeText(d.target.value),ue(g._({id:"cWtH+v"}))}catch{ue(g._({id:"yUWyHa"}))}}},dir:"auto"})}),e("p",{children:[e("button",{type:"button",class:"plain2",disabled:!o,onClick:()=>{try{navigator.clipboard.writeText(o),ue(g._({id:"+Kq2vY"}))}catch{ue(g._({id:"tFvxZF"}))}},children:[e(C,{icon:"clipboard"})," ",e("span",{children:e(u,{id:"he3ygx"})})]})," ",(navigator==null?void 0:navigator.share)&&((f=navigator==null?void 0:navigator.canShare)==null?void 0:f.call(navigator,{text:o}))&&e("button",{type:"button",class:"plain2",disabled:!o,onClick:()=>{try{navigator.share({text:o})}catch{alert(g._({id:"TtG3Uh"}))}},children:[e(C,{icon:"share"})," ",e("span",{children:e(u,{id:"Z8lGw6"})})]})," ",A.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2",disabled:r==="cloud-uploading",onClick:async()=>{c("cloud-uploading");const d=vt();try{const b=(await s.v1.accounts.relationships.fetch({id:[d]}))[0];if(b){const{note:w=""}=b;let _="";const y=JSON.stringify({v:"1",dt:Date.now(),data:o});/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/.test(w)?_=w.replace(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/,`<phanpy-shortcuts-settings>${y}</phanpy-shortcuts-settings>`):_=`${w}
<phanpy-shortcuts-settings>${y}</phanpy-shortcuts-settings>`,ue(g._({id:"9ZYiLz"})),await s.v1.accounts.$select(d).note.create({comment:_}),c("default"),ue(g._({id:"5w02SH"}))}}catch{c("error"),ue(g._({id:"aVsTYo"}))}},title:g._({id:"gWd6Cu"}),children:[e(C,{icon:"cloud"}),e(C,{icon:"arrow-up"})]})," ",o.length>0&&e("small",{class:"insignificant ib",children:e(u,{id:"IPXOXm",values:{0:o.length}})})]}),!!o&&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(t.filter(Boolean),null,2)})]})]}),A.settings.shortcutSettingsCloudImportExport&&e("footer",{children:e("p",{children:[e(C,{icon:"cloud"})," ",e(u,{id:"C4T6O/"})]})})]})]})}ts(A,t=>{for(const[n,i,s,o]of t)/^show/i.test(i)&&!s&&Yn()});function sa(){var s,o,a,p,r,c,l,m;const t=He(A),n=ns(),i=Vt();return ee(()=>{setTimeout(no,1e3)},[]),e(B,{children:[!!t.showCompose&&e(Fe,{class:`solid ${t.composerState.minimized?"min":""}`,minimized:!!t.composerState.minimized,children:e(io,{replyToStatus:typeof t.showCompose!="boolean"?t.showCompose.replyToStatus:((s=window.__COMPOSE__)==null?void 0:s.replyToStatus)||null,editStatus:((o=A.showCompose)==null?void 0:o.editStatus)||((a=window.__COMPOSE__)==null?void 0:a.editStatus)||null,draftStatus:((p=A.showCompose)==null?void 0:p.draftStatus)||((r=window.__COMPOSE__)==null?void 0:r.draftStatus)||null,onClose:h=>{const{newStatus:f,instance:d,type:v}=h||{};A.showCompose=!1,window.__COMPOSE__=null,f&&(A.reloadStatusPage++,ue({text:{post:g._({id:"aTyHBW"}),reply:g._({id:"lZdBKl"}),edit:g._({id:"a5BN7l"})}[v||"post"],delay:1e3,duration:1e4,onClick:b=>{b.hideToast(),A.prevLocation=i,n(d?`/${d}/s/${f.id}`:`/s/${f.id}`)}}))}})}),!!t.showSettings&&e(Fe,{onClose:()=>{A.showSettings=!1},children:e(fc,{onClose:()=>{A.showSettings=!1}})}),!!t.showAccounts&&e(Fe,{onClose:()=>{A.showAccounts=!1},children:e(nc,{onClose:()=>{A.showAccounts=!1}})}),!!t.showAccount&&e(Fe,{onClose:()=>{A.showAccount=!1},children:e(Pc,{account:((c=t.showAccount)==null?void 0:c.account)||t.showAccount,instance:(l=t.showAccount)==null?void 0:l.instance,onClose:({destination:h}={})=>{A.showAccount=!1}})}),!!t.showDrafts&&e(Fe,{onClose:()=>{A.showDrafts=!1},children:e(Oc,{onClose:()=>A.showDrafts=!1})}),!!t.showMediaModal&&e(Fe,{onClick:h=>{(h.target===h.currentTarget||h.target.classList.contains("media"))&&(A.showMediaModal=!1)},children:e(xs,{mediaAttachments:t.showMediaModal.mediaAttachments,instance:t.showMediaModal.instance,index:t.showMediaModal.index,statusID:t.showMediaModal.statusID,onClose:()=>{A.showMediaModal=!1}})}),!!t.showShortcutsSettings&&e(Fe,{onClose:()=>{A.showShortcutsSettings=!1},children:e(ta,{onClose:()=>A.showShortcutsSettings=!1})}),!!t.showGenericAccounts&&e(Fe,{onClose:()=>{A.showGenericAccounts=!1},children:e(Fc,{instance:t.showGenericAccounts.instance,excludeRelationshipAttrs:t.showGenericAccounts.excludeRelationshipAttrs,postID:t.showGenericAccounts.postID,onClose:()=>A.showGenericAccounts=!1,blankCopy:t.showGenericAccounts.blankCopy})}),!!t.showMediaAlt&&e(Fe,{onClose:h=>{A.showMediaAlt=!1},children:e(Bc,{alt:t.showMediaAlt.alt||t.showMediaAlt,lang:(m=t.showMediaAlt)==null?void 0:m.lang,onClose:()=>{A.showMediaAlt=!1}})}),!!t.showEmbedModal&&e(Fe,{class:"solid",onClose:()=>{A.showEmbedModal=!1},children:e(Uc,{html:t.showEmbedModal.html,url:t.showEmbedModal.url,width:t.showEmbedModal.width,height:t.showEmbedModal.height,onClose:()=>{A.showEmbedModal=!1}})}),!!t.showReportModal&&e(Fe,{onClose:()=>{A.showReportModal=!1},children:e(Yc,{account:t.showReportModal.account,post:t.showReportModal.post,onClose:()=>{A.showReportModal=!1}})})]})}function Vn({accountID:t,onChange:n}){const{masto:i}=oe(),[s,o]=L("default"),[a,p]=L(null),[r,c]=L(null),l=r!==null;return e("p",{class:"follow-request-buttons",children:[e("button",{type:"button",disabled:s==="loading"||l,onClick:()=>{o("loading"),p("accept"),(async()=>{try{const m=await i.v1.followRequests.$select(t).authorize();if(!(m!=null&&m.followedBy))throw new Error("Follow request not accepted");c(m),n()}catch{}o("default")})()},children:e(u,{id:"g3UF2V"})})," ",e("button",{type:"button",disabled:s==="loading"||l,class:"light danger",onClick:()=>{o("loading"),p("reject"),(async()=>{try{const m=await i.v1.followRequests.$select(t).reject();if(m!=null&&m.followedBy)throw new Error("Follow request not rejected");c(m),n()}catch{o("default")}})()},children:e(u,{id:"1t/NnN"})}),e("span",{class:"follow-request-states",children:l&&a?a==="accept"?e(C,{icon:"check-circle",alt:g._({id:"bzMKg7"}),class:"follow-accepted"}):e(C,{icon:"x-circle",alt:g._({id:"ekCRTP"}),class:"follow-rejected"}):e(Ne,{hidden:s!=="loading"})})]})}const Pi={mention:"comment",status:"notification",reblog:"rocket",follow:"follow",follow_request:"follow-add",favourite:"heart",poll:"poll",update:"pencil","admin.signup":"account-edit","admin.report":"account-warning",severed_relationships:"heart-break",moderation_warning:"alert",emoji_reaction:"emoji2","pleroma:emoji_reaction":"emoji2"};function Oi({account:t,emoji:n,emoji_url:i}){let s,o;typeof i=="string"?s=i:(s=i==null?void 0:i.url,o=i==null?void 0:i.staticUrl);const a=s?e(Co,{url:s,staticUrl:o,alt:n}):n;return e(u,{id:"i5uN6K",values:{account:t,emojiObject:a}})}const Pn={status:({account:t})=>e(u,{id:"idiIxW",values:{account:t}}),reblog:({count:t,account:n,postsCount:i,postType:s,components:{Subject:o}})=>e(u,{id:"jkt9P5",values:{0:Ge(t),1:Ge(t),count:t,postsCount:i,postType:s,account:n},components:{0:e(o,{clickable:t>1}),1:e("span",{title:t}),2:e(o,{clickable:t>1}),3:e("span",{title:t})}}),follow:({account:t,count:n,components:{Subject:i}})=>e(u,{id:"+71G9C",values:{0:Ge(n),count:n,account:t},components:{0:e(i,{clickable:n>1}),1:e("span",{title:n})}}),follow_request:({account:t})=>e(u,{id:"eh6NHW",values:{account:t}}),favourite:({account:t,count:n,postsCount:i,postType:s,components:{Subject:o}})=>e(u,{id:"RqX1mR",values:{0:Ge(n),1:Ge(n),count:n,postsCount:i,postType:s,account:t},components:{0:e(o,{clickable:n>1}),1:e("span",{title:n}),2:e(o,{clickable:n>1}),3:e("span",{title:n})}}),poll:()=>g._({id:"kIlJaS"}),"poll-self":()=>g._({id:"kpjzdN"}),"poll-voted":()=>g._({id:"moT7M8"}),update:()=>g._({id:"uzt17m"}),"favourite+reblog":({count:t,account:n,postsCount:i,postType:s,components:{Subject:o}})=>e(u,{id:"NunZZQ",values:{0:Ge(t),1:Ge(t),count:t,postsCount:i,postType:s,account:n},components:{0:e(o,{clickable:t>1}),1:e("span",{title:t}),2:e(o,{clickable:t>1}),3:e("span",{title:t})}}),"admin.sign_up":({account:t})=>e(u,{id:"fJCCpx",values:{account:t}}),"admin.report":({account:t,targetAccount:n})=>e(u,{id:"eNfCmq",values:{account:t,targetAccount:n}}),severed_relationships:({name:t})=>e(u,{id:"Xl9v6+",values:{name:t},components:{0:e("i",{})}}),moderation_warning:()=>e("b",{children:e(u,{id:"YqffEv"})}),emoji_reaction:Oi,"pleroma:emoji_reaction":Oi},oa={account_suspension:({from:t,targetName:n})=>e(u,{id:"uRkcgw",values:{from:t,targetName:n},components:{0:e("i",{}),1:e("i",{})}}),domain_block:({from:t,targetName:n,followersCount:i,followingCount:s})=>e(u,{id:"Q3yArs",values:{from:t,targetName:n,followersCount:i,followingCount:s},components:{0:e("i",{}),1:e("i",{})}}),user_domain_block:({targetName:t,followersCount:n,followingCount:i})=>e(u,{id:"RQKWUa",values:{targetName:t,followersCount:n,followingCount:i},components:{0:e("i",{})}})},ca={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"}},On=30;function aa({notification:t,instance:n,isStatic:i,disableContextMenu:s}){var ie,Q,de,Ie,te,ge,we;const{_:o}=Je(),{masto:a}=oe(),{id:p,status:r,account:c,report:l,event:m,moderation_warning:h,_ids:f,_accounts:d,_statuses:v,_groupKeys:b,sampleAccounts:w,notificationsCount:_,groupKey:y}=t;let{type:S}=t;if(S==="mention"&&!r)return null;const k=(r==null?void 0:r.reblog)||r,T=k==null?void 0:k.id,I=vt(),x=I===(c==null?void 0:c.id),O=(ie=r==null?void 0:r.poll)==null?void 0:ie.voted,P=!!(r!=null&&r.inReplyToAccountId)&&(r==null?void 0:r.inReplyToAccountId)!==I&&((Q=r==null?void 0:r.account)==null?void 0:Q.id)===I;let $=0,Y=0;if(S==="favourite+reblog"){if(d)for(const G of d)(de=G._types)!=null&&de.includes("favourite")&&$++,(Ie=G._types)!=null&&Ie.includes("reblog")&&Y++;!Y&&$&&(S="favourite"),!$&&Y&&(S="reblog")}let X;S==="poll"?X=Pn[x?"poll-self":O?"poll-voted":"poll"]:Pn[S]?X=Pn[S]:X=g._({id:"ODqZt1",values:{type:S}});const J=({clickable:G,...ce})=>G?e("b",{tabIndex:"0",onClick:z,...ce}):e("b",{...ce});if(typeof X=="function"){const G=(d==null?void 0:d.length)||(w==null?void 0:w.length)||(c?1:0),ce=(v==null?void 0:v.length)||(r?1:0);if(S==="admin.report"){const ke=l==null?void 0:l.targetAccount;ke&&(X=X({account:e(pt,{account:c,showAvatar:!0}),targetAccount:e(pt,{account:ke,showAvatar:!0})}))}else if(S==="severed_relationships"){const ke=m==null?void 0:m.targetName;ke&&(X=X({name:ke}))}else if((S==="emoji_reaction"||S==="pleroma:emoji_reaction")&&t.emoji){const ke=t.emoji_url||((ge=(te=r==null?void 0:r.emojis)==null?void 0:te.find)==null?void 0:ge.call(te,Ae=>(Ae==null?void 0:Ae.shortcode)===t.emoji.replace(/^:/,"").replace(/:$/,"")));X=X({account:e(pt,{account:c,showAvatar:!0}),emoji:t.emoji,emojiURL:ke})}else X=X({account:c?e(pt,{account:c,showAvatar:!0}):(w==null?void 0:w[0])&&e(pt,{account:w[0],showAvatar:!0}),count:G,postsCount:ce,postType:P?"reply":"post",components:{Subject:J}})}const N=t.createdAt&&new Date(t.createdAt).toLocaleString(),M={"favourite+reblog":g._({id:"+XOeb+"}),favourite:g._({id:"LQFF6J"}),reblog:g._({id:"phQpSa"}),follow:g._({id:"Ih01jh"})}[S]||g._({id:"bPwFdf"}),z=()=>{A.showGenericAccounts={heading:M,accounts:d,showReactions:S==="favourite+reblog",excludeRelationshipAttrs:S==="follow"?["followedBy"]:[],postID:nt(T,n)}},U=_>0&&_>(w==null?void 0:w.length)?"remote":"local";if(r!=null&&r.filtered){const G=((we=r==null?void 0:r.account)==null?void 0:we.id)===I,ce=Bt(r.filtered,"notifications");if(!x&&!G&&(ce==null?void 0:ce.action)==="hide")return null}return e("div",{class:`notification notification-${S}`,"data-notification-id":f||p,"data-group-key":(b==null?void 0:b.join(" "))||y,tabIndex:"0",children:[e("div",{class:`notification-type notification-${S}`,title:N,children:S==="favourite+reblog"?e(B,{children:[e(C,{icon:"rocket",size:"xl",alt:S,class:"reblog-icon"}),e(C,{icon:"heart",size:"xl",alt:S,class:"favourite-icon"})]}):e(C,{icon:Pi[S]||"notification",size:"xl",alt:S})}),e("div",{class:"notification-content",children:[S!=="mention"&&e(B,{children:[e("p",{children:X}),S==="follow_request"&&e(Vn,{accountID:c.id}),S==="severed_relationships"&&e("div",{children:[oa[m.type]({from:n,...m}),e("br",{}),e("a",{href:`https://${n}/severed_relationships`,target:"_blank",rel:"noopener noreferrer",children:e(u,{id:"YL6Y8P",components:{0:e(C,{icon:"external",size:"s"})}})}),"."]}),S==="moderation_warning"&&!!h&&e("div",{children:[o(ca[h.action]()),e("br",{}),e("a",{href:`/disputes/strikes/${h.id}`,target:"_blank",rel:"noopener noreferrer",children:e(u,{id:"YL6Y8P",components:{0:e(C,{icon:"external",size:"s"})}})})]})]}),(d==null?void 0:d.length)>1&&e("p",{class:"avatars-stack",children:[d.slice(0,On).map(G=>e(B,{children:[e("a",{href:G.url,rel:"noopener noreferrer",class:"account-avatar-stack",onClick:ce=>{ce.preventDefault(),A.showAccount=G},children:[e(lt,{url:G.avatarStatic,size:d.length<=10?"xxl":d.length<20?"xl":"l",alt:`${G.displayName} @${G.acct}`,squircle:G==null?void 0:G.bot},G.id),S==="favourite+reblog"&&e("div",{class:"account-sub-icons",children:G._types.map(ce=>e(C,{icon:Pi[ce],size:"s",class:`${ce}-icon`}))})]},G.id)," "]},G.id)),S==="favourite+reblog"&&U==="remote"?e("button",{type:"button",class:"small plain","data-group-keys":b==null?void 0:b.join(" "),onClick:()=>{A.showGenericAccounts={heading:M,fetchAccounts:async()=>{const G=await Promise.allSettled(b.map(async ke=>{const Ae=a.v2.notifications.$select(ke).accounts.list();return[ke,(await Ae.next()).value]})),ce=[];for(const ke of G){const[Ae,Re]=ke.value,Le=/^favourite/.test(Ae)?"favourite":/^reblog/.test(Ae)?"reblog":null;if(Le)for(const De of Re){const be=ce.find(W=>W.id===De.id);be?be._types.push(Le):(De._types=[Le],ce.push(De))}}return{done:!0,value:ce}},showReactions:!0,postID:nt(T,n)}},children:e(C,{icon:"chevron-down"})}):e("button",{type:"button",class:"small plain",onClick:z,children:[d.length>On&&`+${d.length-On}`,e(C,{icon:"chevron-down"})]})]}),!(d!=null&&d.length)&&(w==null?void 0:w.length)>1&&e("p",{class:"avatars-stack",children:[w.map(G=>e(B,{children:[e("a",{href:G.url,rel:"noopener noreferrer",class:"account-avatar-stack",onClick:ce=>{ce.preventDefault(),A.showAccount=G},children:e(lt,{url:G.avatarStatic,size:"xxl",alt:`${G.displayName} @${G.acct}`,squircle:G==null?void 0:G.bot},G.id)},G.id)," "]},G.id)),_>w.length&&e(he,{to:n?`/${n}/s/${r.id}`:`/s/${r.id}`,class:"button small plain centered",children:["+",_-w.length,e(C,{icon:"chevron-right"})]})]}),(v==null?void 0:v.length)>1&&e("ul",{class:"notification-group-statuses",children:v.map(G=>e("li",{children:e(zi,{class:`status-link status-type-${S}`,to:n?`/${n}/s/${G.id}`:`/s/${G.id}`,children:e(qe,{status:G,size:"s",previewMode:!0,allowContextMenu:!0})})},G.id))}),r&&(!(v!=null&&v.length)||(v==null?void 0:v.length)<=1)&&e(zi,{class:`status-link status-type-${S}`,to:n?`/${n}/s/${T}`:`/s/${T}`,onContextMenu:s?void 0:G=>{const ce=G.target.querySelector(".status");if(ce){if(G.metaKey)return;G.preventDefault(),ce.dispatchEvent(new MouseEvent("contextmenu",{clientX:G.clientX,clientY:G.clientY}))}},children:i?e(qe,{status:k,size:"s",readOnly:!0,allowContextMenu:!0}):e(qe,{statusID:T,size:"s",readOnly:!0,allowContextMenu:!0})})]})]})}function zi(t){const n=Io();return e(he,{...t,"data-read-more":g._({id:"8fZueG"}),ref:n})}const Tn=it(aa,(t,n)=>{var i,s;return((i=t.notification)==null?void 0:i.id)===((s=n.notification)==null?void 0:s.id)});"serviceWorker"in navigator&&navigator.serviceWorker.addEventListener("message",t=>{const{type:n,id:i,accessToken:s}=(t==null?void 0:t.data)||{};n==="notification"&&(A.routeNotification={id:i,accessToken:s})});const ra=it(function(){if(!("serviceWorker"in navigator))return null;const n=He(A),{routeNotification:i}=n,{id:s,accessToken:o}=i||{},[a,p]=L(!1);yt(()=>{if(!s||!o)return;const{instance:c}=oe(),{masto:l,instance:m}=oe({accessToken:o}),h=c===m,f=o?so(o):Zn();(async()=>{const d=await l.v1.notifications.$select(s).fetch();if(d&&f){const v=f.instanceURL,{type:b,status:w,account:_}=d,y=!!document.querySelector("#modal-container > *"),S=b==="follow"&&!!(_!=null&&_.id),k=!!(_!=null&&_.id),T=!!(w!=null&&w.id);S&&h?A.showAccount={account:_,instance:v}:y||!h||k&&T?p({id:s,account:f,notification:d,sameInstance:h}):T?location.hash=`/${c}/s/${w.id}`:S?location.hash=`/${c}/a/${_.id}`:location.hash="/notifications"}})()},[s,o]),yt(()=>{navigator!=null&&navigator.clearAppBadge&&navigator.clearAppBadge()},[]),Ht(c=>{c&&(navigator!=null&&navigator.clearAppBadge)&&navigator.clearAppBadge()});const r=()=>{p(!1),A.routeNotification=null,/\/notifications\?id=/i.test(location.hash)&&(location.hash="/notifications")};if(a){const{id:c,account:l,notification:m,sameInstance:h}=a;return e(Fe,{onClick:f=>{f.target===f.currentTarget&&r()},children:e("div",{class:"sheet",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:r,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(u,{id:"5+87Pq"})})}),e("main",{children:[!h&&e("p",{children:e(u,{id:"k9N0Xk"})}),e("div",{class:"notification-peek",onClick:f=>{const{target:d}=f;(f.target.tagName==="BUTTON"||f.target.tagName==="A")&&r()},children:e(Tn,{instance:l.instanceURL,notification:m,isStatic:!0})}),e("div",{style:{textAlign:"end"},children:e(he,{to:"/notifications",class:"button light",onClick:r,children:[e("span",{children:e(u,{id:"/WA/tl"})})," ",e(C,{icon:"arrow-right"})]})})]})]})})}return null}),Es=co((t,n)=>{const{instance:i}=oe(),[s,o]=ht(),[a,p]=L(!1),[r,c]=L(s.get("q")||""),l=s.get("type"),m=q(null),h=q(null);return oo(n,()=>({setValue:f=>{c(f)},focus:()=>{h.current.focus()},select:()=>{h.current.select()},blur:()=>{h.current.blur()}})),e("form",{ref:m,class:"search-popover-container",onSubmit:f=>{var v;if(f.preventDefault(),/\/search/.test(location.hash))if(r){const b={q:r};l&&(b.type=l),o(b)}else o({});else r?location.hash=`/search?q=${encodeURIComponent(r)}${l?`&type=${l}`:""}`:location.hash="/search";(v=t==null?void 0:t.onSubmit)==null||v.call(t,f)},children:[e("input",{ref:h,value:r,name:"q",type:"search",placeholder:g._({id:"A1taO8"}),dir:"auto",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",onSearch:f=>{f.target.value||o({})},onInput:f=>{c(f.target.value),p(!0)},onFocus:()=>{var f,d;p(!0),(d=(f=m.current)==null?void 0:f.querySelector(".search-popover-item"))==null||d.classList.add("focus")},onBlur:()=>{var f,d;setTimeout(()=>{p(!1)},100),(d=(f=m.current)==null?void 0:f.querySelector(".search-popover-item.focus"))==null||d.classList.remove("focus")},onKeyDown:f=>{var v;const{key:d}=f;switch(d){case"Escape":p(!1);break;case"Down":case"ArrowDown":if(f.preventDefault(),a){const b=m.current.querySelector(".search-popover-item.focus");if(b){let w=b.nextElementSibling;for(;w&&w.hidden;)w=w.nextElementSibling;w&&(w.classList.add("focus"),Array.from(w.parentElement.children).filter(y=>y!==w).forEach(y=>{y.classList.remove("focus")}))}else{const w=m.current.querySelector(".search-popover-item");w&&w.classList.add("focus")}}break;case"Up":case"ArrowUp":if(f.preventDefault(),a){const b=document.querySelector(".search-popover-item.focus");if(b){let w=b.previousElementSibling;for(;w&&w.hidden;)w=w.previousElementSibling;w&&(w.classList.add("focus"),Array.from(w.parentElement.children).filter(y=>y!==w).forEach(y=>{y.classList.remove("focus")}))}else{const w=document.querySelector(".search-popover-item:last-child");w&&w.classList.add("focus")}}break;case"Enter":if(a){const b=document.querySelector(".search-popover-item.focus");b&&(f.preventDefault(),b.click()),p(!1),(v=t==null?void 0:t.onSubmit)==null||v.call(t,f)}break}}}),e("div",{class:"search-popover",hidden:!a||!r,children:!!r&&[{label:e(u,{id:"48oDit",values:{query:r},components:{0:e("small",{class:"insignificant"})}}),to:`/search?q=${encodeURIComponent(r)}`,top:!l&&!/\s/.test(r),hidden:!!l},{label:e(u,{id:"o1mMWT",values:{query:r},components:{0:e("q",{})}}),to:`/search?q=${encodeURIComponent(r)}&type=statuses`,hidden:/^https?:/.test(r),top:/\s/.test(r),icon:"document",queryType:"statuses"},{label:e(u,{id:"YAZw8D",values:{0:r.replace(/^#/,"")},components:{0:e("mark",{})}}),to:`/${i}/t/${r.replace(/^#/,"")}`,hidden:/^@/.test(r)||/^https?:/.test(r)||/\s/.test(r),top:/^#/.test(r),type:"link",icon:"hashtag",queryType:"hashtags"},{label:e(u,{id:"gEoOUj",values:{query:r},components:{0:e("mark",{})}}),to:`/${r}`,hidden:!/^https?:/.test(r),top:/^https?:/.test(r),type:"link"},{label:e(u,{id:"cDoNQr",values:{query:r},components:{0:e("q",{})}}),to:`/search?q=${encodeURIComponent(r)}&type=accounts`,icon:"group",queryType:"accounts"}].sort((f,d)=>{if(l){if(f.queryType===l)return-1;if(d.queryType===l)return 1}return f.top&&!d.top?-1:!f.top&&d.top?1:0}).filter(({hidden:f})=>!f).map(({label:f,to:d,icon:v,type:b},w)=>e(he,{to:d,class:`search-popover-item ${w===0?"focus":""}`,onClick:_=>{var y;(y=t==null?void 0:t.onSubmit)==null||y.call(t,_)},children:[e(C,{icon:v||(b==="link"?"arrow-right":"search"),class:"more-insignificant"}),e("span",{children:f})," "]}))})]})}),la=it(function({onClose:n=()=>{}}){const[i,s]=L(!1),o=q(null);Be(["Slash","/"],p=>{s(!0),setTimeout(()=>{var r,c,l,m;(c=(r=o.current)==null?void 0:r.focus)==null||c.call(r),(m=(l=o.current)==null?void 0:l.select)==null||m.call(l)},0)},{preventDefault:!0,ignoreEventWhen:p=>{const r=/\/search/.test(location.hash),c=!!document.querySelector("#modal-container > *");return r||c}});const a=()=>{s(!1),n()};return Be("esc",p=>{var r,c;(c=(r=o.current)==null?void 0:r.blur)==null||c.call(r),a()},{enabled:i,enableOnFormTags:!0,preventDefault:!0}),e("div",{id:"search-command-container",hidden:!i,onClick:p=>{p.target===p.currentTarget&&a()},children:e(Es,{ref:o,onSubmit:()=>{a()}})})});function da(){const{_:t}=Je(),{instance:n}=oe(),i=He(A),{shortcuts:s,settings:o}=i;if(!s.length||o.shortcutsViewMode==="multi-column"||!o.shortcutsViewMode&&o.shortcutsColumnsMode)return null;const a=q(),p=q(!1),r=s.map((h,f)=>{const{type:d,...v}=h;if(!kn[d])return null;let{id:b,path:w,title:_,subtitle:y,icon:S}=kn[d];return typeof b=="function"&&(b=b(v,f)),typeof w=="function"&&(w=w({...v,instance:v.instance||n},f)),typeof _=="function"?_=_(v,f):_=t(_),typeof y=="function"?y=y(v,f):y=t(y),typeof S=="function"&&(S=S(v,f)),b==="lists"&&(p.current=!0),{id:b,path:w,title:_,subtitle:y,icon:S}}).filter(Boolean),c=ns();Be(["1","2","3","4","5","6","7","8","9"],(h,f)=>{var v,b;const d=parseInt(f.keys[0],10)-1;if(d<r.length){const{path:w}=r[d];w&&(c(w),(b=(v=a.current)==null?void 0:v.closeMenu)==null||b.call(v))}});const[l,m]=L([]);return e("div",{id:"shortcuts",children:i.settings.shortcutsViewMode==="tab-menu-bar"?e("nav",{class:"tab-bar",onContextMenu:h=>{h.preventDefault(),A.showShortcutsSettings=!0},children:e("ul",{children:r.map(({id:h,path:f,title:d,subtitle:v,icon:b},w)=>e("li",{children:e(he,{class:v?"has-subtitle":"",to:f,onClick:_=>{if(_.target.classList.contains("is-active")){_.preventDefault();const y=document.getElementById(`${h}-page`);if(y){y.scrollTop=0;const S=y.querySelector(".updates-button");S&&S.click()}}},children:[e(C,{icon:b,size:"xl",alt:d}),e("span",{children:[e(un,{children:d}),v&&e(B,{children:[e("br",{}),e("small",{children:v})]})]})]})},`${w}-${h}-${d}-${v}-${f}`))})}):e(ct,{instanceRef:a,overflow:"auto",viewScroll:"close",menuClassName:"glass-menu shortcuts-menu",gap:8,position:"anchor",onMenuChange:h=>{h.open&&p.current&&sn().then(m)},menuButton:e("button",{type:"button",id:"shortcuts-button",class:"plain",onContextMenu:h=>{h.preventDefault(),A.showShortcutsSettings=!0},onTransitionStart:h=>{var f,d;try{const{target:v}=h;getComputedStyle(v).pointerEvents==="none"&&((d=(f=a.current)==null?void 0:f.closeMenu)==null||d.call(f))}catch{}},children:e(C,{icon:"shortcut",size:"xl",alt:g._({id:"CTqTgr"})})}),children:r.map(({id:h,path:f,title:d,subtitle:v,icon:b},w)=>h==="lists"?e(vn,{menuClassName:"glass-menu",overflow:"auto",gap:-8,label:e(B,{children:[e(C,{icon:b,size:"l"}),e("span",{class:"menu-grow",children:e(un,{children:d})}),e(C,{icon:"chevron-right"})]}),children:[e(Ue,{to:"/l",children:e("span",{children:e(u,{id:"BHWx+g"})})}),e(Ve,{}),l==null?void 0:l.map(_=>e(Ue,{to:`/l/${_.id}`,children:e("span",{children:_.title})},_.id))]}):e(Ue,{to:f,class:"glass-menu-item",children:[e(C,{icon:b,size:"l"})," ",e("span",{class:"menu-grow",children:[e("span",{children:e(un,{children:d})}),v&&e(B,{children:[" ",e("small",{class:"more-insignificant",children:v})]})]}),e("span",{class:"menu-shortcut hide-until-focus-visible",children:w+1})]},`${w}-${h}-${d}-${v}-${f}`))})})}const ua=it(da);function ha(t){var o;let n=[],i=[],s=0;for(let a=0;a<t.length;a++){const p=t[a];p.reblog&&!((o=p.account)!=null&&o.group)?(i.push(p),s++):(n.push(p),s<3&&(s=0))}if(t.length>10&&(i.length>t.length/4||s>=3)){const a=i.map(p=>p.id);if(i.length>t.length*3/4)n=[...n,{id:a,items:i,type:"boosts"}];else{const p=Math.floor(n.length/2);n=[...n.slice(0,p),{id:a,items:i,type:"boosts"},...n.slice(p)]}return n}else return t}function Ui(t,n){const i=me.account.get("boostedStatusIDs")||{},s=t.filter(a=>{if(!a.reblog)return!0;const p=`${n}-${a.reblog.id}`,r=i[p];return r&&r!==a.id?!1:(i[p]=a.id,!0)}),o=Object.keys(i);return o.length>50&&o.slice(0,o.length-50).forEach(a=>{delete i[a]}),me.account.set("boostedStatusIDs",i),s}function fa(t,n){const i=[];let s=0;t.forEach(r=>{for(let l=0;l<i.length;l++){if(i[l].find(m=>m.id===r.id))return;if(i[l].find(m=>m.id===r.inReplyToId)||i[l].find(m=>m.inReplyToId===r.id)){i[l].push(r);return}}const c=t.find(l=>l.id===r.inReplyToId);c&&(i[s++]=[r,c])});for(let r=0;r<i.length;r++)for(let c=r+1;c<i.length;c++)i[r].find(m=>i[c].includes(m))&&(i[r]=[...i[r],...i[c]],i[r]=i[r].filter((m,h,f)=>f.findIndex(d=>d.id===m.id)===h),i.splice(c,1),c--);i.forEach(r=>{r.sort((c,l)=>!c.inReplyToId&&!l.inReplyToId?new Date(c.createdAt)-new Date(l.createdAt):c.inReplyToId===l.id?1:l.inReplyToId===c.id||!c.inReplyToId?-1:l.inReplyToId?new Date(c.createdAt)-new Date(l.createdAt):1)}),i.forEach(r=>{const c=r[0].account.id;r.forEach(l=>{l.account.id!==c&&(l._differentAuthor=!0)})}),i.length;const o=[],a=[],p=[];return t.forEach(r=>{if(r.reblog){o.push(r);return}for(let c=0;c<i.length;c++)if(i[c].find(l=>l.id===r.id)){if(a.includes(c))return;const l=i[c];l.sort((h,f)=>{const d=new Date(h.createdAt),v=new Date(f.createdAt);return d-v});const m=l[0].account.id;o.push({id:l.map(h=>h.id),items:l,type:l.every(h=>h.account.id===m)?"thread":"conversation"}),a.push(c);return}if(r.inReplyToId&&r.inReplyToAccountId!==r.account.id){const c=nt(r.id,n);A.statusReply[c]||p.push({sKey:c,inReplyToId:r.inReplyToId})}o.push(r)}),p!=null&&p.length&&queueMicrotask(()=>{const{masto:r}=oe({instance:n});async function c(){for(let l=0;l<p.length;l++){const{sKey:m,inReplyToId:h}=p[l];try{const f=await pa(h,r);Ke(f,n,{skipThreading:!0}),A.statusReply[m]={id:f.id,instance:n},await new Promise(d=>setTimeout(d,1e3))}catch{}}}if(Xe("@mastodon/fetch-multiple-statuses")){const l=p.map(({inReplyToId:m})=>m);(async()=>{var m;try{const h=await r.v1.statuses.list({id:l});if(h!=null&&h.length)for(const f of h){Ke(f,n,{skipThreading:!0});const d=(m=p.find(({inReplyToId:v})=>v===f.id))==null?void 0:m.sKey;d&&(A.statusReply[d]={id:f.id,instance:n})}else c()}catch{c()}})()}else c()}),o}const pa=_t((t,n)=>n.v1.statuses.$select(t).fetch());async function Rs(t,n){const i=await Xc();if(!i.length)return;const{statusFollowedTags:s}=A,o=[];if(t.forEach(a=>{var f;if(a.reblog)return;const{id:p,content:r,tags:c=[]}=a,l=nt(p,n);if((f=s[l])!=null&&f.length)return;const m=Jc(r);if(!m.length&&!c.length)return;const h=i.reduce((d,v)=>((m.some(b=>b.toLowerCase()===v.name.toLowerCase())||c.some(b=>b.name.toLowerCase()===v.name.toLowerCase()))&&d.push(v.name),d),[]);h.length&&o.push({item:a,sKey:l,followedTags:h})}),o.length){const a=o.map(r=>r.item.account),p=await ei(a);if(!p)return;o.forEach(r=>{const{item:c,sKey:l,followedTags:m}=r,h=p[c.account.id];h&&!h.following&&(s[l]=m)})}}function ma(){A.statusFollowedTags={}}function ga({scrollableRef:t,distanceFromStart:n=1,distanceFromEnd:i=1,scrollThresholdStart:s=10,scrollThresholdEnd:o=10,direction:a="vertical",distanceFromStartPx:p,distanceFromEndPx:r}={}){const[c,l]=L(null),[m,h]=L(!1),[f,d]=L(!1),[v,b]=L(!1),[w,_]=L(!1),y=a==="vertical";return yt(()=>{const S=t.current;if(!S)return{};let k=y?S.scrollTop:S.scrollLeft;function T(){const{scrollTop:I,scrollLeft:x,scrollHeight:O,scrollWidth:P,clientHeight:$,clientWidth:Y}=S,X=y?I:x,J=y?O:P,N=y?$:Y,M=Math.abs(X-k),z=p||Math.min(N*n,J,X),V=r||Math.min(N*i,J,J-X-N);M>=(k<X?o:s)&&(l(k<X?"end":"start"),k=X),h(X<=0),d(X+N>=J),b(X<=z),_(X+N>=J-V)}return S.addEventListener("scroll",T,{passive:!0}),()=>S.removeEventListener("scroll",T)},[n,i,s,o]),{scrollDirection:c,reachStart:m,reachEnd:f,nearReachStart:v,nearReachEnd:w,init:()=>{t.current&&t.current.dispatchEvent(new Event("scroll"))}}}function ba({scrollableRef:t,distanceFromStart:n=1,distanceFromEnd:i=1,scrollThresholdStart:s=10,scrollThresholdEnd:o=10,direction:a="vertical",distanceFromStartPx:p,distanceFromEndPx:r,init:c}={},l,m){if(!l)return;const h=a==="vertical",f=q(null),d=q(null),v=To(()=>{let b=!1,w=!1,_=!1,y=!1;const S=t.current,{scrollTop:k,scrollLeft:T,scrollHeight:I,scrollWidth:x,clientHeight:O,clientWidth:P}=S,$=h?k:T,Y=h?I:x,X=h?O:P,J=Math.abs($-f.current),N=p||Math.min(X*n,Y,$),M=r||Math.min(X*i,Y,Y-$-X);J>=(f.current<$?o:s)&&(d.current=f.current<$?"end":"start",f.current=$),b=$<=0,w=$+X>=Y,_=$<=N,y=$+X>=Y-M,l({scrollDirection:d.current,reachStart:b,reachEnd:w,nearReachStart:_,nearReachEnd:y})},500);yt(()=>{const b=t.current;return b?(f.current=b[h?"scrollTop":"scrollLeft"],b.addEventListener("scroll",v,{passive:!0}),()=>b.removeEventListener("scroll",v)):{}},[n,i,s,o,...m]),ee(()=>{c&&t.current&&queueMicrotask(()=>{t.current.dispatchEvent(new Event("scroll"))})},[c])}function va({class:t,statusID:n,status:i,instance:s,parent:o,onMediaClick:a}){let p=nt(n,s);const r=He(A);if(i||(i=r.statuses[p]||r.statuses[n],p=nt(i==null?void 0:i.id,s)),!i)return null;const{account:{acct:c,avatar:l,avatarStatic:m,id:h,url:f,displayName:d,username:v,emojis:b,bot:w,group:_},id:y,repliesCount:S,reblogged:k,reblogsCount:T,favourited:I,favouritesCount:x,bookmarked:O,poll:P,muted:$,sensitive:Y,spoilerText:X,visibility:J,language:N,editedAt:M,filtered:z,card:V,createdAt:U,inReplyToId:ie,inReplyToAccountId:Q,content:de,mentions:Ie,mediaAttachments:te,reblog:ge,uri:we,url:G,emojis:ce,_deleted:ke,_pinned:Ae}=i;if(!(te!=null&&te.length))return null;const Re=fe=>{fe.shiftKey},Le=_e(()=>vt(),[]),De=_e(()=>Le&&Le===h,[h,Le]),be=ao(ds),W=!De&&Bt(z,be);if((W==null?void 0:W.action)==="hide")return null;const pe=Y,le=_e(()=>{var D;return((D=(me.account.get("preferences")||{})["reading:expand:media"])==null?void 0:D.toLowerCase())||"default"},[])==="show_all",K=o||"div";return te.map((fe,D)=>{const E=`${p}-${fe.id}`,F=W==null?void 0:W.titlesStr;return e(K,{"data-state-post-id":p,onMouseEnter:Re,"data-spoiler-text":X||(Y?g._({id:"FKojeB"}):void 0),"data-filtered-text":W?F?g._({id:"7FGvtQ",values:{filterTitleStr:F}}):g._({id:"03Qqf9"}):void 0,class:`
media-post
${W?"filtered":""}
${pe?"has-spoiler":""}
${le?"show-media":""}
`,children:e(ls,{class:t,media:fe,lang:N,to:`/${s}/s/${y}?media-only=${D+1}`,onClick:a?ae=>a(ae,D,fe,i):void 0})},E)})}const Fi=it(va);function ya(t){var T,I,x,O,P;const n=He(A),{masto:i,instance:s,authenticated:o}=oe(),[a,p]=_e(()=>{const $=me.local.getJSON("accounts")||[];return[$.find(X=>X.info.id===vt())||$[0],$.length>1]},[]),r=(n.settings.shortcutsViewMode==="multi-column"||!n.settings.shortcutsViewMode&&n.settings.shortcutsColumnsMode)&&!n.shortcuts.find($=>$.type==="following"),c=xo(()=>{A.showAccounts=!0},{threshold:600,detect:"touch",cancelOnMovement:!0}),l=q(),[m,h]=L(void 0),f=Ao([0,0,n.settings.shortcutsViewMode==="tab-menu-bar"?50:0,0]),d=q();async function v($){return($||!d.current)&&(d.current=i.v1.mutes.list({limit:80})),await d.current.next()}const b=q();async function w($){return($||!b.current)&&(b.current=i.v1.blocks.list({limit:80})),await b.current.next()}const _=Xe("@mastodon/lists"),[y,S]=L([]);ee(()=>{_&&m==="open"&&sn().then(S)},[m==="open"]);const k=q();return e(B,{children:[e("button",{ref:l,type:"button",class:`button plain nav-menu-button ${p?"with-avatar":""} ${m==="open"?"active":""}`,style:{position:"relative"},onClick:()=>{k.current=Date.now(),h($=>$?void 0:"open")},onContextMenu:$=>{$.preventDefault(),A.showAccounts=!0},...c(),children:[p&&e(lt,{url:((T=a==null?void 0:a.info)==null?void 0:T.avatar)||((I=a==null?void 0:a.info)==null?void 0:I.avatarStatic),size:"l",squircle:(x=a==null?void 0:a.info)==null?void 0:x.bot}),e(C,{icon:"menu",size:p?"s":"l",alt:g._({id:"zucql+"})})]}),e(us,{menuClassName:"nav-menu",state:m,anchorRef:l,onClose:()=>{h(void 0)},containerProps:{style:{zIndex:10},onClick:()=>{Date.now()-k.current<300}},portal:{target:document.body},...t,overflow:"auto",viewScroll:"close",position:"anchor",align:"center",boundingBoxPadding:f,unmountOnClose:!0,children:[!!((O=n.appVersion)!=null&&O.commitHash)&&n.appVersion.commitHash!=="e3df9ff"&&e("div",{class:"top-menu",children:[e(ye,{onClick:()=>{confirm(g._({id:"Djbaby"}))&&(async()=>{try{location.reload()}catch{}})()},children:[e(C,{icon:"sparkles",class:"sparkle-icon",size:"l"})," ",e("span",{children:e(u,{id:"95IFnD"})})]}),e(Ve,{})]}),e("section",{children:[e(Ue,{to:"/",children:[e(C,{icon:"home",size:"l"})," ",e("span",{children:e(u,{id:"i0qMbr"})})]}),o?e(B,{children:[r&&e(Ue,{to:"/following",children:[e(C,{icon:"following",size:"l"})," ",e("span",{children:e(u,{id:"following.title"})})]}),e(Ue,{to:"/catchup",children:[e(C,{icon:"history2",size:"l"}),e("span",{children:e(u,{id:"xrl8fj"})})]}),Xe("@mastodon/mentions")&&e(Ue,{to:"/mentions",children:[e(C,{icon:"at",size:"l"})," ",e("span",{children:e(u,{id:"/bZzdR"})})]}),e(Ue,{to:"/notifications",children:[e(C,{icon:"notification",size:"l"})," ",e("span",{children:e(u,{id:"iDNBZe"})}),n.notificationsShowNew&&e("sup",{title:g._({id:"isRobC"}),style:{opacity:.5},children:[" ","•"]})]}),e(Ve,{}),((P=a==null?void 0:a.info)==null?void 0:P.id)&&e(Ue,{to:`/${s}/a/${a.info.id}`,children:[e(C,{icon:"user",size:"l"})," ",e("span",{children:e(u,{id:"vERlcd"})})]}),(y==null?void 0:y.length)>0?e(vn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(B,{children:[e(C,{icon:"list",size:"l"}),e("span",{class:"menu-grow",children:e(u,{id:"h16FyT"})}),e(C,{icon:"chevron-right"})]}),children:[e(Ue,{to:"/l",children:e("span",{children:e(u,{id:"BHWx+g"})})}),(y==null?void 0:y.length)>0&&e(B,{children:[e(Ve,{}),y.map($=>e(Ue,{to:`/l/${$.id}`,children:e("span",{children:$.title})},$.id))]})]}):_&&e(Ue,{to:"/l",children:[e(C,{icon:"list",size:"l"}),e("span",{children:e(u,{id:"h16FyT"})})]}),e(Ue,{to:"/b",children:[e(C,{icon:"bookmark",size:"l"})," ",e("span",{children:e(u,{id:"7Ff7ia"})})]}),e(vn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(B,{children:[e(C,{icon:"more",size:"l"}),e("span",{class:"menu-grow",children:e(u,{id:"24misb"})}),e(C,{icon:"chevron-right"})]}),children:[e(Ue,{to:"/f",children:[e(C,{icon:"heart",size:"l"})," ",e("span",{children:e(u,{id:"zZOZj7"})})]}),e(Ue,{to:"/fh",children:[e(C,{icon:"hashtag",size:"l"})," ",e("span",{children:e(u,{id:"Xi1/bw"})})]}),e(Ve,{}),Xe("@mastodon/filters")&&e(Ue,{to:"/ft",children:[e(C,{icon:"filters",size:"l"})," ",e("span",{children:e(u,{id:"cSev+j"})})]}),e(ye,{onClick:()=>{A.showGenericAccounts={id:"mute",heading:g._({id:"sOKhEA"}),fetchAccounts:v,excludeRelationshipAttrs:["muting"]}},children:[e(C,{icon:"mute",size:"l"})," ",e("span",{children:e(u,{id:"n1sANU"})})]}),e(ye,{onClick:()=>{A.showGenericAccounts={id:"block",heading:g._({id:"nL8nlr"}),fetchAccounts:w,excludeRelationshipAttrs:["blocking"]}},children:[e(C,{icon:"block",size:"l"})," ",e("span",{children:e(u,{id:"r3RRWo"})})]})," "]}),e(Ve,{}),e(ye,{onClick:()=>{A.showAccounts=!0},children:[e(C,{icon:"group",size:"l"})," ",e("span",{children:e(u,{id:"7e0O8Z"})})]})]}):e(B,{children:[e(Ve,{}),e(Ue,{to:"/login",children:[e(C,{icon:"user",size:"l"})," ",e("span",{children:e(u,{id:"sQia9P"})})]})]})]}),e("section",{children:[e(Ve,{}),e(Ue,{to:"/search",children:[e(C,{icon:"search",size:"l"})," ",e("span",{children:e(u,{id:"A1taO8"})})]}),e(Ue,{to:`/${s}/trending`,children:[e(C,{icon:"chart",size:"l"})," ",e("span",{children:e(u,{id:"4/iCqx"})})]}),e(Ue,{to:`/${s}/p/l`,children:[e(C,{icon:"building",size:"l"})," ",e("span",{children:e(u,{id:"d5zxa4"})})]}),e(Ue,{to:`/${s}/p`,children:[e(C,{icon:"earth",size:"l"})," ",e("span",{children:e(u,{id:"4ERYY7"})})]}),o?e(B,{children:[e(Ve,{className:"divider-grow"}),e(ye,{onClick:()=>{A.showKeyboardShortcutsHelp=!0},children:[e(C,{icon:"keyboard",size:"l"})," ",e("span",{children:e(u,{id:"77Emn0"})})]}),e(ye,{onClick:()=>{A.showShortcutsSettings=!0},children:[e(C,{icon:"shortcut",size:"l"})," ",e("span",{children:e(u,{id:"8Kudkr"})})]}),e(ye,{onClick:()=>{A.showSettings=!0},children:[e(C,{icon:"gear",size:"l"})," ",e("span",{children:e(u,{id:"uVbUP8"})})]})]}):e(B,{children:[e(Ve,{}),e(ye,{onClick:()=>{A.showSettings=!0},children:[e(C,{icon:"gear",size:"l"})," ",e("span",{children:e(u,{id:"uVbUP8"})})]})]})]})]})]})}const Nt=it(ya),cn={block:"nearest",inline:"center",behavior:"smooth"};function kt({title:t,titleComponent:n,id:i,instance:s,emptyText:o,errorText:a,useItemID:p,boostsCarousel:r,fetchItems:c=()=>{},checkForUpdates:l=()=>{},checkForUpdatesInterval:m=15e3,headerStart:h,headerEnd:f,timelineStart:d,refresh:v,view:b,filterContext:w,showFollowedTags:_,showReplyParent:y,clearWhenRefresh:S}){const k=He(A),[T,I]=L([]),[x,O]=L("start"),[P,$]=L(!1),[Y,X]=L(!1),[J,N]=L(!0),M=q();__BENCHMARK.start(`timeline-${i}-load`);const z=_e(()=>Xn(),[]),V=b!=="media",U=q(0),ie=Eo(W=>{X(!1),O("loading"),(async()=>{try{const pe=U.current=Date.now();let{done:Te,value:le}=await c(W);if(pe!==U.current)return;if(Array.isArray(le)){const[K,fe]=le.reduce((D,E)=>(E._pinned?D[0].push(E):D[1].push(E),D),[[],[]]);le=fe,V&&(r&&(le=ha(le)),le=fa(le,s)),K.length&&(le=K.concat(le)),I(W?le:D=>[...D,...le]),le.length||(Te=!0),$(!Te)}else $(!1);O("default"),__BENCHMARK.end(`timeline-${i}-load`)}catch{O("error"),W&&!T.length&&a&&ue(a)}finally{ie.cancel()}})()},1e3,{leading:!0}),Q=".timeline-item, .timeline-item-alt",de=Be("j, shift+j",(W,pe)=>{const Te=document.activeElement.closest(Q),le=Te==null?void 0:Te.getBoundingClientRect(),K=Array.from(M.current.querySelectorAll(Q));if(Te&&le.top<M.current.clientHeight&&le.bottom>0){const fe=K.indexOf(Te);let D=K[fe+1];pe.shift&&(D=K.find((E,F)=>F>fe&&!E.classList.contains("timeline-item-alt"))),D&&(D.focus(),D.scrollIntoView(cn))}else{const fe=K.find(D=>{const E=D.getBoundingClientRect();return E.top>=44&&E.left>=0});fe&&(fe.focus(),fe.scrollIntoView(cn))}}),Ie=Be("k, shift+k",(W,pe)=>{const Te=document.activeElement.closest(Q),le=Te==null?void 0:Te.getBoundingClientRect(),K=Array.from(M.current.querySelectorAll(Q));if(Te&&le.top<M.current.clientHeight&&le.bottom>0){const fe=K.indexOf(Te);let D=K[fe-1];pe.shift&&(D=K.findLast((E,F)=>F<fe&&!E.classList.contains("timeline-item-alt"))),D&&(D.focus(),D.scrollIntoView(cn))}else{const fe=K.find(D=>{const E=D.getBoundingClientRect();return E.top>=44&&E.left>=0});fe&&(fe.focus(),fe.scrollIntoView(cn))}}),te=Be(["enter","o"],()=>{const W=document.activeElement;W!=null&&W.matches(Q)&&W.click()}),ge=T.length>0&&x!=="loading"&&Y,we=ot(()=>{var W;ge&&ie(!0),(W=M.current)==null||W.scrollTo({top:0,behavior:"smooth"})},[ie,ge]),G=Be(".",we),ce=q(),[ke,Ae]=L(!1);ba({scrollableRef:M,distanceFromEnd:2,scrollThresholdStart:44},({scrollDirection:W,nearReachStart:pe,reachStart:Te})=>{if(ce.current){const le=W==="end"&&!pe;ce.current.hidden=le}Ae(pe),Te&&ie(!0)},[]),ee(()=>{var W;(W=M.current)==null||W.scrollTo({top:0}),ie(!0)},[]);const Re=q(!0);ee(()=>{var W;if(Re.current){Re.current=!1;return}S&&(T!=null&&T.length)&&((W=ie.cancel)==null||W.call(ie),I([])),ie(!0)},[S,v]);const Le=q(b);ee(()=>{Le.current!==b&&(Le.current=b,I([]))},[b]);const De=ot(async({disableIdleCheck:W=!1}={})=>{const pe=M.current?getComputedStyle(M.current).pointerEvents==="none":!1;k.settings.autoRefresh&&M.current.scrollTop<16&&(W||window.__IDLE__)&&!Sa()&&!pe?ie(!0):await l()&&X(!0)},[i,ie,l,k.settings.autoRefresh]),be=q();return Ht(W=>{if(W){const pe=Date.now()-be.current;(!be.current||pe>1e3*3)&&De({disableIdleCheck:!0})}else be.current=Date.now();N(W)},[l,De,k.settings.autoRefresh]),Qn(De,J&&!Y?m*(ke?1:2):null),e(ds.Provider,{value:w,children:e("div",{id:`${i}-page`,class:`deck-container ${z?"deck-container-media-first":""}`,ref:W=>{M.current=W,de(W),Ie(W),te(W),G(W)},tabIndex:"-1",onClick:W=>{ce.current&&W.target.closest(".timeline-item, .timeline-item-alt")&&setTimeout(()=>{ce.current.hidden=!1},250)},children:e("div",{class:"timeline-deck deck",children:[e("header",{ref:ce,onClick:W=>{var pe;W.target.closest("a, button")||(pe=M.current)==null||pe.scrollTo({top:0,behavior:"smooth"})},onDblClick:W=>{W.target.closest("a, button")||ie(!0)},class:x==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Nt,{}),h??e(he,{to:"/",class:"button plain home-button",children:e(C,{icon:"home",size:"l",alt:g._({id:"i0qMbr"})})})]}),t&&(n||e("h1",{children:t})),e("div",{class:"header-side",children:!!f&&f})]}),ge&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:we,children:[e(C,{icon:"arrow-up"})," ",e(u,{id:"2yr1/p"})]})]}),!!d&&e("div",{class:`timeline-start ${x==="loading"?"loading":""}`,children:d}),T.length?e(B,{children:[e("ul",{class:`timeline ${b?`timeline-${b}`:""}`,children:[T.map(W=>e(wa,{status:W,instance:s,useItemID:p,filterContext:w,view:b,showFollowedTags:_,showReplyParent:y,mediaFirst:z},W.id+(W==null?void 0:W._pinned)+b)),P&&x==="loading"&&(b==="media"?null:e(B,{children:[e("li",{style:{height:"20vh"},children:e(qe,{skeleton:!0,mediaFirst:z})}),e("li",{style:{height:"25vh"},children:e(qe,{skeleton:!0,mediaFirst:z})})]}))]}),x==="default"&&(P?e(wt,{root:M.current,rootMargin:`0px 0px ${screen.height*1.5}px 0px`,onChange:W=>{W&&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"})}))]}):x==="loading"?e("ul",{class:"timeline",children:Array.from({length:5}).map((W,pe)=>b==="media"?e("div",{style:{height:"50vh"}}):e("li",{children:e(qe,{skeleton:!0,mediaFirst:z})},pe))}):x!=="error"&&x!=="start"&&e("p",{class:"ui-state",children:o}),x==="error"&&e("p",{class:"ui-state",children:[a,e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>ie(!T.length),children:e(u,{id:"KDw4GX"})})]})]})})})}const wa=it(({status:t,instance:n,useItemID:i,filterContext:s,view:o,showFollowedTags:a,showReplyParent:p,mediaFirst:r})=>{const{id:c,reblog:l,items:m,type:h,_pinned:f}=t;f&&(i=!1);const d=(l==null?void 0:l.id)||c,v=n?`/${n}/s/${d}`:`/s/${d}`;if(m){let w=Rt(m,s),_="";if(h==="boosts"?_=g._({id:"NuqppG",values:{0:w.length}}):h==="pinned"&&(_=g._({id:"GlfmCu"})),h==="boosts"||h==="pinned"){const k=new Set;if(w.sort((T,I)=>{const x=Bt(T.filtered,s),O=Bt(I.filtered,s);return x&&k.add(T.id),O&&k.add(I.id),x&&!O?1:!x&&O?-1:0}),k.size>=2){const I=[],x=[];w.forEach(P=>{k.has(P.id)?x.push(P):I.push(P)});const O=[];for(let P=0;P<x.length;P+=5)O.push({_grouped:!0,posts:x.slice(P,P+5)});w=I.concat(O)}return e("li",{class:"timeline-item-carousel",children:e(_a,{title:_,class:`${h}-carousel`,children:w.map(T=>{const{id:I,reblog:x,_pinned:O,_grouped:P}=T;if(P)return e("li",{class:"timeline-item-carousel-group",children:T.posts.map(X=>{const{id:J,reblog:N,_pinned:M}=X,z=(N==null?void 0:N.id)||J,V=n?`/${n}/s/${z}`:`/s/${z}`;return M&&(i=!1),e(he,{class:"status-carousel-link timeline-item-alt",to:V,children:i?e(qe,{statusID:J,instance:n,size:"s"}):e(qe,{status:X,instance:n,size:"s"})})})},I);const $=(x==null?void 0:x.id)||I,Y=n?`/${n}/s/${$}`:`/s/${$}`;return O&&(i=!1),e("li",{children:e(he,{class:"status-carousel-link timeline-item-alt",to:Y,children:i?e(qe,{statusID:I,instance:n,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:r}):e(qe,{status:T,instance:n,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:r})})},I)})})},`timeline-${c}`)}const S=w.length>3;return w.map((k,T)=>{const{id:I,_differentAuthor:x}=k,O=n?`/${n}/s/${I}`:`/s/${I}`,P=T>0&&T<w.length-1,$=k.sensitive&&!!k.spoilerText,Y=!x&&$&&T>0||S&&P&&(h==="thread"||h==="conversation"&&!x&&!w[T-1]._differentAuthor&&!w[T+1]._differentAuthor),X=T===0,J=T===w.length-1;return e("li",{class:`timeline-item-container timeline-item-container-type-${h} timeline-item-container-${X?"start":J?"end":"middle"} ${x?"timeline-item-diff-author":""}`,children:e(he,{class:"status-link timeline-item",to:O,children:Y?e(ka,{status:k,instance:n,filterContext:s}):i?e(qe,{statusID:I,instance:n,enableCommentHint:J,showFollowedTags:a}):e(qe,{status:k,instance:n,enableCommentHint:J,showFollowedTags:a})})},`timeline-${I}`)})}const b=`timeline-${c+f}`;return o==="media"?i?e(Fi,{class:"timeline-item",parent:"li",statusID:c,instance:n},b):e(Fi,{class:"timeline-item",parent:"li",status:t,instance:n},b):e("li",{children:e(he,{class:"status-link timeline-item",to:v,children:i?e(qe,{statusID:c,instance:n,enableCommentHint:!0,showFollowedTags:a,showReplyParent:p,mediaFirst:r}):e(qe,{status:t,instance:n,enableCommentHint:!0,showFollowedTags:a,showReplyParent:p,mediaFirst:r})})},b)},(t,n)=>{var o,a;const i=(((o=t.status)==null?void 0:o.id)||"").toString(),s=(((a=n.status)==null?void 0:a.id)||"").toString();return i===s&&t.instance===n.instance&&t.view===n.view});function _a({title:t,class:n,children:i}){const s=q(),o=q(),a=q(),[p,r]=L(!1);return ee(()=>{setTimeout(()=>{r(!0)},1)},[]),e("div",{class:`status-carousel ${n}`,children:[e("header",{children:[e("h3",{children:t}),e("span",{children:[e("button",{ref:o,type:"button",class:"small plain2",onClick:()=>{var l,m;const c=Math.min(320,(l=s.current)==null?void 0:l.offsetWidth)*(Et()?1:-1);(m=s.current)==null||m.scrollBy({left:c,behavior:"smooth"})},children:e(C,{icon:"chevron-left",alt:g._({id:"DHhJ7s"})})})," ",e("button",{ref:a,type:"button",class:"small plain2",onClick:()=>{var l,m;const c=Math.min(320,(l=s.current)==null?void 0:l.offsetWidth)*(Et()?-1:1);(m=s.current)==null||m.scrollBy({left:c,behavior:"smooth"})},children:e(C,{icon:"chevron-right",alt:g._({id:"hXzOVo"})})})]})]}),e("ul",{ref:s,children:[e(wt,{class:"status-carousel-beacon",onChange:c=>{o.current&&(o.current.disabled=c)}}),i[0],p&&i.slice(1),e(wt,{class:"status-carousel-beacon",onChange:c=>{a.current&&(a.current.disabled=c)}})]})]})}function ka({status:t,instance:n,filterContext:i}){const s=He(A),{id:o,visibility:a,language:p}=t,r=ni(t),c=nt(o,n),l=Bt(t.filtered,i);return e("article",{class:`status compact-thread ${a==="direct"?"visibility-direct":""}`,tabindex:"-1",children:[s.statusThreadNumber[c]?e("div",{class:"status-thread-badge",children:[e(C,{icon:"thread",size:"s",alt:g._({id:"e66y2Z"})}),s.statusThreadNumber[c]?` ${s.statusThreadNumber[c]}/X`:""]}):e("div",{class:"status-thread-badge",children:e(C,{icon:"thread",size:"s",alt:g._({id:"e66y2Z"})})}),e("div",{class:"content-compact",title:r,lang:p,dir:"auto",children:l?e("b",{class:"status-filtered-badge badge-meta horizontal",title:(l==null?void 0:l.titlesStr)||"",children:l!=null&&l.titlesStr?e(u,{id:"sr6maL",values:{0:l.titlesStr},components:{0:e("span",{}),1:e("span",{})}}):e("span",{children:e(u,{id:"03Qqf9"})})}):e(B,{children:[r,t.sensitive&&t.spoilerText&&e(B,{children:[" ",e("span",{class:"spoiler-badge",children:e(C,{icon:"eye-close",size:"s",alt:g._({id:"gnKo7f"})})})]})]})})]})}function Sa(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}const Ut=20,mi=1983,Bi=`${mi}-01`,Ca=(()=>{try{const t=document.createElement("input");return t.setAttribute("type","month"),t.type==="month"}catch{return!1}})();async function Ia(t){var s;const{masto:n}=oe({instance:t}),i=await n.v2.search.fetch({q:"from:me",type:"statuses",limit:1});return!!((s=i==null?void 0:i.statuses)!=null&&s.length)}const Ta=_t(Ia);function xa(){const t=He(A),{id:n,...i}=Mt(),[s,o]=ht(),a=s.get("month"),p=!s.get("replies"),r=!!s.get("boosts"),c=s.get("tagged"),l=!!s.get("media"),{masto:m,instance:h,authenticated:f}=oe({instance:i.instance}),{masto:d,instance:v}=oe(),b=q(),w=[a,p,r,c,l],[_,y]=L(),S=q(0);ee(()=>{S.current=0},w);const k=_e(()=>Xn(),[]),T=_e(()=>h===v,[h,v]),[I,x]=L(!1);ee(()=>{T&&_!=null&&_.acct&&(async()=>{const te=await Ta(h);x(te)})()},[h,T,_==null?void 0:_.acct]);async function O(te){var Ae,Re,Le,De;const ge=/^\d{4}-[01]\d$/.test(a),we=((Re=(Ae=a==null?void 0:a.split)==null?void 0:Ae.call(a,"-"))==null?void 0:Re[0])>=mi;if(ge&&we){if(!_)return{value:[],done:!0};const[be,W]=a.split("-"),pe=parseInt(W,10)-1,Te=new Date(be,pe,0),le=`${Te.getFullYear()}-${(Te.getMonth()+1).toString().padStart(2,"0")}-${Te.getDate().toString().padStart(2,"0")}`,K=new Date(be,pe+1,1),fe=`${K.getFullYear()}-${(K.getMonth()+1).toString().padStart(2,"0")}-${K.getDate().toString().padStart(2,"0")}`;let D;te?(D=Ut+1,S.current=0):(D=Ut+S.current+1,S.current+=Ut);const E=await m.v2.search.fetch({q:`from:${_.acct} after:${le} before:${fe}`,type:"statuses",limit:D,offset:S.current});if((Le=E==null?void 0:E.statuses)!=null&&Le.length){const F=E.statuses.slice(0,Ut);F.forEach(ve=>{Ke(ve,h)});const ae=E.statuses.length<=Ut;return{value:F,done:ae}}else return{value:[],done:!0}}let G=[];if(te){const{value:be}=await m.v1.accounts.$select(n).statuses.list({pinned:!0}).next();if(be!=null&&be.length&&!c&&!l){const W=be.map(pe=>(Ke(pe,h),{...pe,_pinned:!0}));if(W.length>=3){const pe=W.map(Te=>Te.id);G.push({id:pe,items:W,type:"pinned"})}else G.push(...W)}}(te||!b.current)&&(b.current=m.v1.accounts.$select(n).statuses.list({limit:Ut,exclude_replies:p,exclude_reblogs:r,only_media:l||void 0,tagged:c}));const{value:ce,done:ke}=await b.current.next();if(ce!=null&&ce.length){if(G.length){let be=[];((De=G[0])==null?void 0:De.type)==="pinned"?be=G[0].id:be=G.filter(pe=>pe._pinned).map(pe=>pe.id),be.every(pe=>ce.some(Te=>Te.id===pe))&&(G=[])}G.push(...ce),ce.forEach(be=>{Ke(be,h)})}return{value:G,done:ke}}const[P,$]=L([]),{i18n:Y}=Je();let X=Y._({id:"/cKnpj"});if(_!=null&&_.acct){const te=/@/.test(_.acct)?"":"@"+_.acct,ge=_!=null&&_.displayName?`${_.displayName} (${te})`:`${te}`;if(!p)X=Y._({id:"hS1Opy",values:{accountDisplay:ge}});else if(r)X=Y._({id:"A/CX5F",values:{accountDisplay:ge}});else if(c)X=Y._({id:"QQrO94",values:{accountDisplay:ge,tagged:c}});else if(l)X=Y._({id:"NoG5wD",values:{accountDisplay:ge}});else if(a){const we=new Date(a).toLocaleString(Y.locale,{month:"long",year:"numeric"});X=Y._({id:"8GjLvB",values:{accountDisplay:ge,monthYear:we}})}else X=ge}We(X,"/:instance?/a/:id");const J=q(),N=ot(()=>{const te=J.current||m.v1.accounts.$select(n).fetch();return J.current=te,te},[n,m]);ee(()=>{(async()=>{try{const te=await N();y(te)}catch{}if(!k)try{const te=await m.v1.accounts.$select(n).featuredTags.list();$(te)}catch{}})()},[n,k]);const{displayName:M,acct:z,emojis:V}=_||{},U=q(),ie=_e(()=>{const te=!p||r||c||l||!!a,ge=t.accounts[`${n}@${h}`];return e(B,{children:[e(Ts,{instance:h,account:ge||n,fetchAccount:N,authenticated:f,standalone:!0}),!k&&e("div",{class:"filter-bar",ref:U,style:{position:"relative"},children:[te?e(he,{to:`/${h}/a/${n}`,class:"insignificant filter-clear",title:Y._({id:"u8JHrO"}),children:e(C,{icon:"x",size:"l",alt:Y._({id:"xCJdfg"})})},"clear-filters"):e(C,{icon:"filter",class:"insignificant",size:"l",alt:Y._({id:"cSev+j"})}),e(he,{to:`/${h}/a/${n}${p?"?replies=1":""}`,onClick:()=>{p&&ue(Y._({id:"PIWNSQ"}))},class:p?"":"is-active",children:e(u,{id:"5BFynH"})}),e(he,{to:`/${h}/a/${n}${r?"":"?boosts=0"}`,onClick:()=>{r||ue(Y._({id:"Qd13i0"}))},class:r?"is-active":"",children:e(u,{id:"usxQx0"})}),e(he,{to:`/${h}/a/${n}${l?"":"?media=1"}`,onClick:()=>{l||ue(Y._({id:"rKpfPY"}))},class:l?"is-active":"",children:e(u,{id:"xYilR2"})}),P.map(we=>e(he,{to:`/${h}/a/${n}${c===we.name?"":`?tagged=${encodeURIComponent(we.name)}`}`,onClick:()=>{c!==we.name&&ue(Y._({id:"L+HFfr",values:{0:we.name}}))},class:c===we.name?"is-active":"",children:e("span",{children:[e("span",{class:"more-insignificant",children:"#"}),we.name]})},we.id)),I&&(Ca?e("label",{class:`filter-field ${a?"is-active":""}`,children:[e(C,{icon:"month",size:"l"}),e("input",{type:"month",disabled:!(_!=null&&_.acct),value:a||"",min:Bi,max:new Date().toISOString().slice(0,7),onInput:we=>{const{value:G,validity:ce}=we.currentTarget;if(!ce.valid)return;o(G?{month:G}:{});const[ke,Ae]=G.split("-"),Re=parseInt(Ae,10)-1,Le=new Date(ke,Re);ue(Y._({id:"0WUFGD",values:{0:Le.toLocaleString(Y.locale,{month:"long",year:"numeric"})}}))}})]}):e(Aa,{class:`filter-field ${a?"is-active":""}`,disabled:!(_!=null&&_.acct),value:a||"",min:Bi,max:new Date().toISOString().slice(0,7),onInput:we=>{const{value:G,validity:ce}=we;ce.valid&&o(G?{month:G}:{})}}))]})]})},[n,h,f,P,N,I,...w]);ee(()=>{var ge;const te=(ge=U.current)==null?void 0:ge.querySelector(".is-active");te&&U.current.scrollTo({behavior:"smooth",left:te.offsetLeft-(U.current.offsetWidth-te.offsetWidth)/2})},[P,I,...w]);const Q=_e(()=>_!=null&&_.url?URL.parse(_.url).hostname:null,[_]),Ie=!!_&&!(h===Q);return e(kt,{title:`${_!=null&&_.acct?"@"+_.acct:Y._({id:"+owNNn"})}`,titleComponent:e("h1",{class:"header-double-lines header-account",children:[e("b",{children:e(as,{text:M,emojis:V})}),e("div",{children:e("span",{class:"bidi-isolate",children:["@",z]})})]}),id:"account-statuses",instance:h,emptyText:Y._({id:"+k97fV"}),errorText:Y._({id:"scd9lw"}),fetchItems:O,useItemID:!0,view:l||k?"media":void 0,boostsCarousel:t.settings.boostsCarousel,timelineStart:ie,refresh:[p,r,c,l,a+(_==null?void 0:_.acct)].toString(),headerEnd:e(ct,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(C,{icon:"more",size:"l",alt:Y._({id:"2FYpfJ"})})}),children:[e(ye,{disabled:!Ie,onClick:()=>{(async()=>{try{const{masto:te}=oe({instance:Q}),ge=await te.v1.accounts.lookup({acct:_.acct}),{id:we}=ge;location.hash=`/${Q}/a/${we}`}catch{alert(Y._({id:"FgdLx0"}))}})()},children:[e(C,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:e(u,{id:"/JFxxT",values:{0:Q?e(B,{children:[" ","(",e("b",{children:Kt.toUnicode(Q)}),")"]}):null}})})]}),!T&&e(ye,{onClick:()=>{(async()=>{try{const te=await d.v1.accounts.lookup({acct:_.acct+"@"+h}),{id:ge}=te;location.hash=`/${v}/a/${ge}`}catch{alert(Y._({id:"FgdLx0"}))}})()},children:[e(C,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:e(u,{id:"HkuyOu",values:{currentInstance:v},components:{0:e("b",{})}})})]})]})},n)}function Aa(t){const{i18n:n}=Je(),{class:i,disabled:s,value:o,min:a,max:p,onInput:r=()=>{}}=t,[c,l]=(o==null?void 0:o.split("-"))||[],m=q(),h=q(),f=(d,v)=>{const[b,w]=(a==null?void 0:a.split("-"))||[],[_,y]=(p==null?void 0:p.split("-"))||[];return!(v<b||v>_||v===b&&d<w||v===_&&d>y)};return e("div",{class:i,children:[e(C,{icon:"month",size:"l"}),e("select",{ref:m,disabled:s,value:l||"",onInput:d=>{const{value:v}=d.currentTarget,b=h.current.value;if(!f(v,b))return{value:"",validity:{valid:!1}};r({value:v?`${b}-${v}`:"",validity:{valid:!0}})},children:[e("option",{value:"",children:e(u,{id:"HajiZl"})}),e("option",{disabled:!0,children:"-----"}),Array.from({length:12},(d,v)=>e("option",{value:(v+1).toString().padStart(2,"0"),children:new Date(0,v).toLocaleString(n.locale,{month:"long"})},v))]})," ",e("input",{ref:h,type:"number",disabled:s,value:c||new Date().getFullYear(),min:(a==null?void 0:a.slice(0,4))||mi,max:(p==null?void 0:p.slice(0,4))||new Date().getFullYear(),onInput:d=>{const{value:v,validity:b}=d.currentTarget,w=m.current.value;if(!b.valid||!f(w,v))return{value:"",validity:{valid:!1}};r({value:v?`${v}-${w}`:"",validity:{valid:!0}})},style:{width:"4.5em"}})]})}const Ea=20;function Ls(){We(g._({id:"7Ff7ia"}),"/bookmarks");const{masto:t,instance:n}=oe(),i=q();async function s(o){return(o||!i.current)&&(i.current=t.v1.bookmarks.list({limit:Ea})),await i.current.next()}return e(kt,{title:g._({id:"7Ff7ia"}),id:"bookmarks",emptyText:g._({id:"8k2w6G"}),errorText:g._({id:"UoL+FC"}),instance:n,fetchItems:s})}const Ra=""+new URL("catch-up-DuauQu-W.png",import.meta.url).href,La="home",st=[{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}],$a={original:{id:"HxF6Fk"},replies:{id:"N8UzTV"},boosts:{id:"puY2t0"},followedTags:{id:"lCLRBe"},groups:{id:"zhrjek"},filtered:{id:"03Qqf9"}},Ma=["createdAt","repliesCount","favouritesCount","reblogsCount","density"],Da=[null,"account"],Na=is(t=>new Intl.DateTimeFormat(t||void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"}));function Pa(){const{i18n:t,_:n}=Je(),i=Na(t.locale);We("Catch-up","/catchup");const{masto:s,instance:o}=oe(),[a,p]=ht(),r=a.get("id"),[c,l]=L("start"),[m,h]=L(!1),f=_e(()=>vt(),[]),d=R=>R===f,v=Xe("@pixelfed/home-include-reblogs");async function b({maxCreatedAt:R}){var ne,Me,xe;const j=R?new Date(R):null,se=[],H=s.v1.timelines.home.list({limit:40});e:for(;;)try{v&&H.nextParams&&(typeof H.nextParams=="string"?H.nextParams+="&include_reblogs=true":H.nextParams.include_reblogs=!0);const Ce=await H.next(),{value:Oe}=Ce;if(Oe!=null&&Oe.length){await Rs(Oe,o);let re=!1;for(let ze=0;ze<Oe.length;ze++){const Ze=Oe[ze],Tt=new Date(Ze.createdAt);if(!j||Tt>=j){const Ye=!d(((Me=(ne=Ze.reblog)==null?void 0:ne.account)==null?void 0:Me.id)||Ze.account.id)&&Bt(((xe=Ze.reblog)==null?void 0:xe.filtered)||Ze.filtered,La);if((Ye==null?void 0:Ye.action)==="hide")continue;Ze._filtered=Ye;const mt=nt(Ze.id,o);Ze._followedTags=A.statusFollowedTags[mt]?[...A.statusFollowedTags[mt]]:[],se.push(Ze),re=!0}if(!re)break e}}else break e;await new Promise(re=>setTimeout(re,1e3))}catch{break e}return se.forEach(Ce=>{if(Ce!=null&&Ce.inReplyToId){const Oe=se.find(re=>re.id===Ce.inReplyToId);Oe&&!Oe.inReplyToId&&(Oe._thread=!0)}}),se}const[w,_]=L([]),y=q(),S=q(),k=_e(()=>bn(),[]),T=ot(async({duration:R}={})=>{const j=Date.now(),se=R?j-R:null;l("loading");const H=await b({maxCreatedAt:se}),ne=`${k}-${Ro()}`;try{await dt.catchup.set(ne,{id:ne,posts:H,count:H.length,startAt:se,endAt:j}),p({id:ne})}catch{}},[]);ee(()=>{r?(async()=>{const R=await dt.catchup.get(r);R&&(R.posts.sort((j,se)=>j.createdAt>se.createdAt?1:-1),_(R.posts),l("results"))})():c==="results"&&(_([]),l("start"))},[r]);const[I,x]=$t(R=>R+1,0),[O,P]=L(null),[$,Y]=L([]);ee(()=>{(async()=>{try{const R=await dt.catchup.keys();if(R.length){const j=bn(),se=R.filter(H=>H.startsWith(`${j}-`));if(se.length){let H=await dt.catchup.getMany(se);H.sort((Ce,Oe)=>Oe.endAt-Ce.endAt);let ne=H.slice(0,3),Me=H.slice(3);const xe=ne.map(Ce=>{const{id:Oe,count:re,startAt:ze,endAt:Ze}=Ce;return{id:Oe,count:re,startAt:ze,endAt:Ze}});Y(xe),P(ne[0].endAt),H=null,ne=null,queueMicrotask(()=>{Me.length&&dt.catchup.delMany(Me.map(Ce=>Ce.id)).then(()=>{Me=null}).catch(Ce=>{})});return}}}catch{}Y([])})()},[I]),ee(()=>{c==="start"&&x()},[c==="start"]);const[X,J]=_e(()=>{var Oe,re,ze,Ze,Tt;let R=0,j=0,se=0,H=0,ne=0,Me=0;const xe={};for(const Ee of w){Ee._filtered?(R++,Ee.__FILTER="filtered"):Ee.group?(j++,Ee.__FILTER="groups"):Ee.reblog?(se++,Ee.__FILTER="boosts"):(Oe=Ee._followedTags)!=null&&Oe.length?(ne++,Ee.__FILTER="followedTags"):Ee.inReplyToId&&Ee.inReplyToAccountId!==((re=Ee.account)==null?void 0:re.id)?(H++,Ee.__FILTER="replies"):(Me++,Ee.__FILTER="original");const Ye=Ee.reblog||Ee;if(Ee.__FILTER!=="filtered"&&((ze=Ye.card)!=null&&ze.url)&&((Ze=Ye.card)!=null&&Ze.image)&&((Tt=Ye.card)==null?void 0:Tt.type)==="link"){const{card:mt,favouritesCount:on,reblogsCount:xt}=Ye;let{url:Qe}=mt;if(Qe=Qe.replace(/\/$/,""),!xe[Qe])xe[Qe]={postID:Ye.id,card:mt,shared:1,sharers:[Ee.account],likes:on,boosts:xt};else{if(xe[Qe].sharers.find(Pt=>Pt.id===Ee.account.id))continue;xe[Qe].shared++,xe[Qe].sharers.push(Ee.account),xe[Qe].postID!==Ye.id&&(xe[Qe].likes+=on,xe[Qe].boosts+=xt)}}}let Ce=[];for(const Ee in xe)Ce.push({url:Ee,...xe[Ee]});if(Ce.sort((Ee,Ye)=>Ee.shared>Ye.shared?-1:Ee.shared<Ye.shared?1:Ee.boosts>Ye.boosts?-1:Ee.boosts<Ye.boosts?1:Ee.likes>Ye.likes?-1:Ee.likes<Ye.likes?1:0),Ce.length>10)e:for(let Ee=10;Ee<Ce.length;Ee++){const{shared:Ye}=Ce[Ee];if(Ye<=1){Ce=Ce.slice(0,Ee);break e}}return[{filtered:R,groups:j,boosts:se,replies:H,followedTags:ne,original:Me},Ce]},[w]),[N,M]=L("all"),[z,V]=L(null),[U,ie]=L(1),[Q,de]=L("createdAt"),[Ie,te]=L("asc"),[ge,we]=L(null),[G,ce,ke]=_e(()=>{const R={},j=new Map;let se=w.filter(ne=>{const Me=N==="all"||ne.__FILTER===N;return Me&&(R[ne.account.id]=ne.account,j.set(ne.account.id,(j.get(ne.account.id)||0)+1)),Me});const H={};return se.forEach(ne=>{ne.reblog&&(H[ne.reblog.id]?(H[ne.reblog.id].__BOOSTERS?H[ne.reblog.id].__BOOSTERS.add(ne.account):H[ne.reblog.id].__BOOSTERS=new Set([ne.account]),ne.__HIDDEN=!0):H[ne.reblog.id]=ne)}),z&&j.has(z)&&(se=se.filter(ne=>ne.account.id===z||[...ne.__BOOSTERS||[]].find(Me=>Me.id===z))),[se,R,Object.fromEntries(j)]},[N,z,w]),Ae=_e(()=>{const R={};return G.forEach(j=>{R[j.id]=j}),R},[G]),Re=_e(()=>Object.keys(ke).sort((R,j)=>ke[j]-ke[R]),[ke]),Le=_e(()=>{const R={};return Re.forEach((j,se)=>{R[j]=se}),G.filter(j=>!j.__HIDDEN).sort((j,se)=>{if(ge==="account"){const H=j.account.id,ne=se.account.id,Me=R[H],xe=R[ne],Ce=Me-xe;if(Ce!==0)return Ce}if(Q!=="createdAt"&&(j=j.reblog||j,se=se.reblog||se,Q!=="density"&&j[Q]===se[Q]))return j.createdAt>se.createdAt?1:-1;if(Q==="density"){const H=Hi(j),ne=Hi(se);return Ie==="asc"?H>ne?1:-1:ne>H?1:-1}return Ie==="asc"?j[Q]>se[Q]?1:-1:se[Q]>j[Q]?1:-1})},[G,Q,Ie,ge,Re]),De=q(null),be=q(null),W=q(!1);ee(()=>{w.length>100||W.current||be.current&&(ws(be.current,{duration:200}),W.current=!0)},[w,be]);const pe=w.length>160?"3d":"2d",Te=_e(()=>pe!=="2d"?null:w.map(R=>{const j=Ae[R.id];return e("span",{class:`post-dot ${j?"post-dot-highlight":""}`},R.id)}),[Ae]),le=_e(()=>pe!=="3d"||!(w!=null&&w.length)?null:qa(w,"createdAt",320).map((j,se)=>e("div",{class:"posts-bin",children:j.map(H=>{const ne=Ae[H.id];return e("span",{class:`post-dot ${ne?"post-dot-highlight":""}`},H.id)})},se)),[Ae]),K=q(null),fe=_e(()=>O?(Date.now()-O)/1e3/60/60:null,[O,U]);ee(()=>{if(c!=="results")return;const R=z&&ce[z]?ce[z].username:"",j=Ie==="asc"?0:1,se={account:"authors"};let H=ue({duration:5e3,text:t._({id:"TLYeLT",values:{selectedFilterCategory:N,sortBy:Q,sortOrder:Ie,groupBy:ge}})});return()=>{var ne;(ne=H==null?void 0:H.hideToast)==null||ne.call(H)}},[c,N,z,Q,Ie,ge,ce]),ee(()=>{var R;if(z&&ce[z]){const j=be.current.querySelector(`[data-author="${z}"]`),se=(R=be.current)==null?void 0:R.getBoundingClientRect(),H=j==null?void 0:j.getBoundingClientRect();H.left<se.left||H.right>se.right?j.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}):H.top<0&&j.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})}},[z,ce]);const[D,E]=L(!1),F=".catchup-list > li > a",ae=Be("j",()=>{const R=document.activeElement.closest(F),j=R==null?void 0:R.getBoundingClientRect(),se=Array.from(K.current.querySelectorAll(F));if(R&&j.top<K.current.clientHeight&&j.bottom>0){const H=se.indexOf(R),ne=se[H+1];ne&&(ne.focus(),ne.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const H=se.find(ne=>ne.getBoundingClientRect().top>=0);H&&(H.focus(),H.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{preventDefault:!0,ignoreModifiers:!0}),ve=Be("k",()=>{const R=document.activeElement.closest(F),j=R==null?void 0:R.getBoundingClientRect(),se=Array.from(K.current.querySelectorAll(F));if(R&&j.top<K.current.clientHeight&&j.bottom>0){const H=se.indexOf(R);let ne=se[H-1];ne&&(ne.focus(),ne.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const H=se.find(ne=>{const Me=ne.getBoundingClientRect();return Me.top>=44&&Me.left>=0});H&&(H.focus(),H.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{preventDefault:!0,ignoreModifiers:!0}),Se=Be("h, l",(R,j)=>{var H,ne,Me;const se=j.keys[0];if(z){const xe=Re.indexOf(z);se==="h"?xe>0&&xe<Re.length&&(V(Re[xe-1]),(H=K.current)==null||H.focus()):se==="l"&&xe<Re.length-1&&xe>=0&&(V(Re[xe+1]),(ne=K.current)==null||ne.focus())}else se==="l"&&(V(Re[0]),(Me=K.current)==null||Me.focus())},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]}),Z=Be("esc",()=>{var R;V(null),(R=K.current)==null||R.focus()},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]}),$e=Be(".",()=>{var R;(R=K.current)==null||R.scrollTo({top:0,behavior:"smooth"})},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]}),Pe=ot(R=>{const j=document.activeElement,se=(j==null?void 0:j.tagName)==="INPUT"&&j.type==="radio";if((R.key==="ArrowDown"||R.key==="ArrowUp"||R.key==="ArrowLeft"||R.key==="ArrowRight")&&se){j.blur();return}},[]);return e("div",{ref:R=>{K.current=R,ae(R),ve(R),Se(R),Z(R)},id:"catchup-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck wide",children:[e("header",{class:`${c==="loading"?"loading":""}`,onClick:R=>{var j;R.target.closest("a, button")||(j=K.current)==null||j.scrollTo({top:0,behavior:"smooth"})},children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Nt,{}),c==="results"&&e(he,{to:"/catchup",class:"button plain",children:e(C,{icon:"history2",size:"l",alt:t._({id:"xrl8fj"})})}),c==="start"&&e(he,{to:"/",class:"button plain",children:e(C,{icon:"home",size:"l",alt:t._({id:"i0qMbr"})})})]}),e("h1",{children:c!=="start"&&e(u,{id:"wyL/3/",components:{0:e("sup",{})}})}),e("div",{class:"header-side",children:c!=="start"&&c!=="loading"&&e("button",{type:"button",class:"plain",onClick:()=>{E(!0)},children:e(u,{id:"c3XJ18"})})})]})}),e("main",{onKeyDown:Pe,children:[c==="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:Ra,width:"1200",height:"900",alt:t._({id:"CeInO2"})}),e("p",{children:e("button",{type:"button",onClick:R=>{R.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:y,type:"range",value:U,min:st[0].value,max:st[st.length-1].value,step:"1",list:"catchup-ranges",onChange:R=>ie(+R.target.value)})," ",e("span",{style:{width:"8em"},children:[n(st[U-1].label),e("br",{}),e("small",{class:"insignificant",children:U==st[st.length-1].value?t._({id:"NMNiaO"}):ut(new Date(Date.now()-U*60*60*1e3))})]}),e("datalist",{id:"catchup-ranges",children:st.map(({label:R,value:j})=>e("option",{value:j,label:n(R)}))})," ",e("button",{type:"button",onClick:()=>{var R;if(U<st[st.length-1].value){let j;U===st[st.length-1].value&&((R=S.current)!=null&&R.checked)?j=Date.now()-O:j=U*60*60*1e3,T({duration:j})}else T()},children:e(u,{id:"R0yu2l"})})]}),fe&&U>fe?e("p",{class:"catchup-info",children:[e(C,{icon:"info"})," ",e(u,{id:"AGyV7s"})]}):U===st[st.length-1].value&&O?e("p",{class:"catchup-info",children:e("label",{children:[e("input",{type:"checkbox",switch:!0,checked:!0,ref:S})," ",e(u,{id:"dDJEHI",values:{0:i.format(new Date(O))}})]})}):null,e("p",{class:"insignificant",children:e("small",{children:e(u,{id:"EAjFM0"})})}),!!($!=null&&$.length)&&e("div",{class:"catchup-prev",children:[e("p",{children:e(u,{id:"Yfb9A8"})}),e("ul",{children:$.map(R=>e("li",{children:[e(he,{to:`/catchup?id=${R.id}`,children:[e(C,{icon:"history2"})," ",e("span",{children:R.startAt?i.formatRange(new Date(R.startAt),new Date(R.endAt)):`… – ${i.format(new Date(R.endAt))}`})]})," ",e("span",{children:[e("small",{class:"ib insignificant",children:e(u,{id:"S6XZwv",values:{0:R.count}})})," ",e("button",{type:"button",class:"light danger small",onClick:async()=>{var se;if(confirm(t._({id:"D9CmP2"}))){let H=ue(H`Removing Catch-up ${R.id}`);await dt.catchup.del(R.id),(se=H==null?void 0:H.hideToast)==null||se.call(H),ue(H`Catch-up ${R.id} removed`),x()}},children:e(C,{icon:"x",alt:t._({id:"t/YqKh"})})})]})]},R.id))}),$.length>=3&&e("p",{children:e("small",{children:e(u,{id:"sXmrl4"})})})]})]}),c==="loading"&&e("div",{class:"ui-state catchup-start",children:[e(Ne,{abrupt:!0}),e("p",{class:"insignificant",children:e(u,{id:"rbUTzD"})}),e("p",{class:"insignificant",children:e(u,{id:"q9urQO"})})]}),c==="results"&&e(B,{children:[e("div",{class:"catchup-header",children:[w.length>0&&e("p",{children:e("b",{class:"ib",children:i.formatRange(new Date(w[0].createdAt),new Date(w[w.length-1].createdAt))})}),e("aside",{children:[e("button",{hidden:N==="all"&&!z&&Q==="createdAt"&&Ie==="asc",type:"button",class:"plain4 small",onClick:()=>{M("all"),V(null),de("createdAt"),we(null),te("asc")},children:e(u,{id:"I9EnzM"})}),(J==null?void 0:J.length)>0&&e("button",{type:"button",class:"plain small",onClick:()=>h(!m),children:[e(u,{id:"EIZREX"})," ",e(C,{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:J.map(R=>{const{card:j,shared:se,sharers:H,likes:ne,boosts:Me}=R,{blurhash:xe,title:Ce,description:Oe,url:re,image:ze,imageDescription:Ze,language:Tt,width:Ee,height:Ye,publishedAt:mt}=j,on=Kt.toUnicode(URL.parse(re).hostname.replace(/^www\./,"").replace(/\/$/,""));let xt;if(xe){const Qe=ti(xe),Pt=hi(Qe);xt=fi([.6,Pt[1],Pt[2]])}return e("a",{href:re,target:"_blank",rel:"noopener noreferrer",class:"link-block",style:xt?{"--accent-color":`rgb(${xt.join(",")})`,"--accent-alpha-color":`rgba(${xt.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:ze,alt:Ze,width:Ee,height:Ye,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:on})," ",!!mt&&e(B,{children:"· "}),!!mt&&e(B,{children:e(Gt,{datetime:mt,format:"micro"})})]}),!!Ce&&e("h1",{class:"title",lang:Tt,dir:"auto",title:Ce,children:Ce})]}),!!Oe&&e("p",{class:"description",lang:Tt,dir:"auto",title:Oe,children:Oe}),e("hr",{}),e("p",{style:{whiteSpace:"nowrap"},children:e(u,{id:"bfSr6z",values:{0:H.map(Qe=>{const{avatarStatic:Pt,displayName:Zs}=Qe;return e("button",{type:"button",class:"plain",style:{padding:0},onClick:bi=>{bi.preventDefault(),bi.stopPropagation();const{id:Xs}=Qe;V(Xs),M("all")},children:e(lt,{url:Pt,size:"s",alt:Zs})})})}})})]})]})},re)})})})}),w.length>=5&&(pe==="3d"?e("div",{class:"catchup-posts-viz-time-bar",children:le}):e("div",{class:"catchup-posts-viz-bar",children:Te})),w.length>=2&&e("div",{class:"catchup-filters",children:[e("label",{class:"filter-cat",children:[e("input",{type:"radio",name:"filter-cat",checked:N.toLowerCase()==="all",onChange:()=>{M("all")}}),e(u,{id:"N40H+G"})," ",e("span",{class:"count",children:w.length})]}),Object.entries($a).map(([R,j])=>!!X[R]&&e("label",{class:"filter-cat",title:(X[R]/w.length*100).toFixed(2)+"%",children:[e("input",{type:"radio",name:"filter-cat",checked:N.toLowerCase()===R.toLowerCase(),onChange:()=>{M(R),R==="boosts"&&(de("reblogsCount"),te("desc"),we(null))}}),n(j)," ",e("span",{class:"count",children:X[R]})]},n(j)))]}),w.length>=2&&!!ke&&e("div",{class:"catchup-filters authors-filters",ref:be,children:[Re.map(R=>e("label",{class:"filter-author","data-author":R,children:[e("input",{type:"radio",name:"filter-author",checked:z===R,onChange:()=>{V(R)},onClick:()=>{z===R&&V(null)}}),e(lt,{url:ce[R].avatarStatic||ce[R].avatar,size:"xxl",alt:`${ce[R].displayName} (@${ce[R].acct})`})," ",e("span",{class:"count",children:ke[R]}),e("span",{class:"username",children:ce[R].username})]},`${R}-${ke[R]}`)),Re.length>5&&e("small",{style:{whiteSpace:"nowrap",paddingInline:"1em",opacity:.33},children:e(u,{id:"HHtYi7",values:{0:Re.length}})},"authors-count")]}),w.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:Ma.map(R=>e("label",{class:"filter-sort",onClick:j=>{Q===R&&(j.preventDefault(),j.stopPropagation(),te(Ie==="asc"?"desc":"asc"))},children:[e("input",{type:"radio",name:"filter-sort-cat",checked:Q===R,onChange:()=>{de(R);const j=/(replies|favourites|reblogs)/.test(R)?"desc":"asc";te(j)}}),{createdAt:t._({id:"mYGY3B"}),repliesCount:t._({id:"N8UzTV"}),favouritesCount:t._({id:"zZOZj7"}),reblogsCount:t._({id:"puY2t0"}),density:t._({id:"0tQ7AD"})}[R],Q===R&&(Ie==="asc"?" ↑":" ↓")]},R))}),e("span",{class:"filter-label",children:e(u,{id:"L8fEEm"})})," ",e("fieldset",{class:"radio-field-group",children:Da.map(R=>e("label",{class:"filter-group",children:[e("input",{type:"radio",name:"filter-group",checked:ge===R,onChange:()=>{we(R)},disabled:R==="account"&&z}),{account:t._({id:"dpqPBg"})}[R]||t._({id:"EdQY6l"})]},R||"none"))}),z&&Re.length>1?e("button",{type:"button",class:"plain6 small",onClick:()=>{V(null)},style:{whiteSpace:"nowrap"},children:e(u,{id:"/dlmrZ"})}):null]}),e("ul",{class:`catchup-list catchup-filter-${N||""} ${Q?`catchup-sort-${Q}`:""} ${z&&ce[z]?"catchup-selected-author":""} ${ge?`catchup-group-${ge}`:""}`,children:Le.map((R,j)=>{var ne;const se=((ne=R.reblog)==null?void 0:ne.id)||R.id;let H=!1;return ge==="account"&&(De.current&&R.account.id!==De.current&&j>0&&(H=!0),De.current=R.account.id),e(B,{children:[H&&e("li",{class:"separator"}),e(za,{to:`/${o}/s/${se}`,post:R,root:K.current})]},`${R.id}-${H}`)})}),e("footer",{children:G.length>5&&e("p",{children:[N==="boosts"?t._({id:"eVosYr"}):t._({id:"rhmyFK"})," ",e("button",{type:"button",class:"textual",onClick:()=>{K.current.scrollTop=0},children:e(u,{id:"0MgdN+"})}),"."]})})]})]})]}),D&&e(Fe,{onClose:()=>E(!1),children:e("div",{class:"sheet",id:"catchup-help-sheet",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>E(!1),children:e(C,{icon:"x",alt:t._({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 Oa=it(function({post:t}){const{id:n,account:i,group:s,reblog:o,inReplyToId:a,inReplyToAccountId:p,_followedTags:r,_filtered:c,visibility:l,__BOOSTERS:m}=t,h=a&&p!==i.id,f=!!c,d=v=>{v.shiftKey};return e("article",{class:`post-line ${s?"group":o?"reblog":r!=null&&r.length?"followed-tags":""} ${h?"reply-to":""} ${f?"filtered":""} visibility-${l}`,onMouseEnter:d,children:[e("span",{class:"post-author",children:o?e("span",{class:"post-reblog-avatar",children:[e(lt,{url:i.avatarStatic||i.avatar,squircle:i.bot}),(m==null?void 0:m.size)>0?[...m].map(v=>e(lt,{url:v.avatarStatic||v.avatar,squircle:v.bot})):""," ",e(C,{icon:"rocket"})," ",e(pt,{account:o.account,showAvatar:!0})]}):e(pt,{account:i,showAvatar:!0})}),e(Ba,{post:o||t,filterInfo:c}),e("span",{class:"post-meta",children:[e(Ha,{post:o||t})," ",e(Gt,{datetime:new Date((o==null?void 0:o.createdAt)||t.createdAt),format:"micro"})]})]})},(t,n)=>{var i,s;return((i=t==null?void 0:t.post)==null?void 0:i.id)===((s=n==null?void 0:n.post)==null?void 0:s.id)}),za=({root:t,to:n,...i})=>{const s=q(),[o,a]=L(!1);return ee(()=>{const p=new IntersectionObserver(r=>{r[0].isIntersecting&&(queueMicrotask(()=>a(!0)),p.unobserve(s.current))},{root:t,rootMargin:`${Math.max(320,screen.height*.75)}px`});return s.current&&p.observe(s.current),()=>{s.current&&p.unobserve(s.current)}},[]),o?e("li",{children:e(he,{to:n,children:e(Oa,{...i})})}):e("li",{ref:s,style:{height:"4em"}})},Ua=8,Fa=8;function Hi(t){var c;const{spoilerText:n,content:i,poll:s,mediaAttachments:o,card:a}=t,p=(c=s==null?void 0:s.options)!=null&&c.length?s.options.reduce((l,m)=>l+m.title,""):"";return(n.length+hs(i)+p.length)/140+(o!=null&&o.length?Ua*o.length:a!=null&&a.image?Fa:0)}const St=48;function Ba({post:t,filterInfo:n}){var y;const{spoilerText:i,sensitive:s,content:o,emojis:a,poll:p,mediaAttachments:r,card:c,inReplyToId:l,inReplyToAccountId:m,account:h,_thread:f}=t,d=l&&m===h.id||!!f,v=_e(()=>!!(me.account.get("preferences")||{})["reading:expand:spoilers"],[]),b=v||!i&&!s,w=o?ni(t):"",_=!i||v;return e("div",{class:"post-peek",title:i?"":w,children:[e("span",{class:"post-peek-content",children:[d&&!_&&e(B,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:"Thread"})," "]}),n?e("span",{class:"post-peek-filtered",children:n!=null&&n.titlesStr?g._({id:"suKjh3",values:{0:n.titlesStr}}):g._({id:"03Qqf9"})}):e(B,{children:[!!i&&e("span",{class:"post-peek-spoiler",children:[e(C,{icon:`${v?"eye-open":"eye-close"}`})," ",i]}),_&&e("div",{class:"post-peek-html",children:[d&&e(B,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:e(u,{id:"e66y2Z"})})," "]}),!!o&&e("div",{dangerouslySetInnerHTML:{__html:Lo(o,a)}}),!!((y=p==null?void 0:p.options)!=null&&y.length)&&p.options.map(S=>e("div",{children:[p.multiple?"▪️":"•"," ",S.title]})),!o&&(r==null?void 0:r.length)===1&&r[0].description&&e(B,{children:[e("span",{class:"post-peek-tag post-peek-alt",children:"ALT"})," ",e("div",{children:r[0].description})]})]})]})]}),!n&&e("span",{class:"post-peek-post-content",children:[!!p&&e("span",{class:"post-peek-tag post-peek-poll",children:[e(C,{icon:"poll",size:"s"}),e(u,{id:"4WUbF1"})]}),r!=null&&r.length?r.map(S=>{var O,P,$,Y,X,J,N,M,z,V;const k=S.previewUrl||S.url,T=S.previewRemoteUrl||S.remoteUrl,I=(O=S.meta)!=null&&O.original?S.meta.original.width:(($=(P=S.meta)==null?void 0:P.small)==null?void 0:$.width)||((X=(Y=S.meta)==null?void 0:Y.original)==null?void 0:X.width),x=(J=S.meta)!=null&&J.original?S.meta.original.height:((M=(N=S.meta)==null?void 0:N.small)==null?void 0:M.height)||((V=(z=S.meta)==null?void 0:z.original)==null?void 0:V.height);return e("span",{class:"post-peek-media",children:{image:(k||T)&&b?e("img",{src:k,width:St,height:St,alt:S.description,loading:"lazy",onError:U=>{const{src:ie}=U.target;ie===k&&(U.target.src=T)},style:{"--anim-duration":`${Math.min(Math.max(Math.max(I,x)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"🖼"}),gifv:(k||T)&&b?e("img",{src:k,width:St,height:St,alt:S.description,loading:"lazy",onError:U=>{const{src:ie}=U.target;ie===k&&(U.target.src=T)}}):e("span",{class:"post-peek-faux-media",children:"🎞️"}),video:(k||T)&&b?e("img",{src:k,width:St,height:St,alt:S.description,loading:"lazy",onError:U=>{const{src:ie}=U.target;ie===k&&(U.target.src=T)}}):e("span",{class:"post-peek-faux-media",children:"📹"}),audio:e("span",{class:"post-peek-faux-media",children:"🎵"})}[S.type]||null},S.id)}):!!c&&c.image&&b&&e("span",{class:`post-peek-media post-peek-card card-${c.type||""}`,children:c.image?e("img",{src:c.image,width:St,height:St,alt:c.title||c.description||c.imageDescription,loading:"lazy",style:{"--anim-duration":c.width&&c.height&&`${Math.min(Math.max(Math.max(c.width,c.height)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"🔗"})})]})]})}function Ha({post:t}){const{reblogsCount:n,repliesCount:i,favouritesCount:s}=t;return e("span",{class:"post-stats",children:[i>0&&e("span",{class:"post-stat-replies",children:[e(C,{icon:"comment2",size:"s",alt:g._({id:"N8UzTV"})})," ",Ge(i)]}),s>0&&e("span",{class:"post-stat-likes",children:[e(C,{icon:"heart",size:"s",alt:g._({id:"zZOZj7"})})," ",Ge(s)]}),n>0&&e("span",{class:"post-stat-boosts",children:[e(C,{icon:"rocket",size:"s",alt:g._({id:"puY2t0"})})," ",Ge(n)]})]})}function qa(t,n,i){const s=t.map(c=>new Date(c[n])),o=s.reduce((c,l)=>l<c?l:c,s[0]),p=s.reduce((c,l)=>l>c?l:c,s[0]).getTime()-o.getTime(),r=Array.from({length:i},()=>[]);return t.forEach(c=>{const m=(new Date(c[n]).getTime()-o.getTime())/p,h=Math.floor(m*(i-1));r[h].push(c)}),r}const Ya=20;function $s(){We(g._({id:"zZOZj7"}),"/favourites");const{masto:t,instance:n}=oe(),i=q();async function s(o){return(o||!i.current)&&(i.current=t.v1.favourites.list({limit:Ya})),await i.current.next()}return e(kt,{title:g._({id:"zZOZj7"}),id:"favourites",emptyText:g._({id:"PHIrMr"}),errorText:g._({id:"khVljG"}),instance:n,fetchItems:s})}const ja=["home","public","notifications","thread","account"],qi=["notifications","thread","account"],Va={home:{id:"Buy2bt"},notifications:{id:"iDNBZe"},public:{id:"RO10dm"},thread:{id:"EnJuK0"},account:{id:"vrQQgz"}},Ga=[0,30*60,60*60,6*60*60,12*60*60,60*60*24,60*60*24*7,60*60*24*30],zn={0:{id:"qqeAJM"},1800:et(30,"minute"),3600:et(1,"hour"),21600:et(6,"hour"),43200:et(12,"hour"),86400:et(24,"hour"),604800:et(7,"day"),2592e3:et(30,"day")};function Ka(){const{masto:t}=oe();We(g._({id:"cSev+j"}),"/ft");const[n,i]=L("default"),[s,o]=L(!1),[a,p]=$t(l=>l+1,0),[r,c]=L([]);return ee(()=>{i("loading"),(async()=>{try{const l=await t.v2.filters.list();l.sort((m,h)=>m.title.localeCompare(h.title)),l.forEach(m=>{var h;(h=m.keywords)!=null&&h.length&&m.keywords.sort((f,d)=>f.id-d.id)}),c(l),i("default")}catch{i("error")}})()},[a]),e("div",{id:"filters-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck",children:[e("header",{children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Nt,{}),e(he,{to:"/",class:"button plain",children:e(C,{icon:"home",size:"l",alt:g._({id:"i0qMbr"})})})]}),e("h1",{children:e(u,{id:"cSev+j"})}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{o(!0)},children:e(C,{icon:"plus",size:"l",alt:g._({id:"yFfBdX"})})})})]})}),e("main",{children:r.length>0?e(B,{children:[e("ul",{class:"filters-list",children:r.map(l=>{const{id:m,title:h,expiresAt:f,keywords:d}=l;return e("li",{children:[e("div",{children:[e("h2",{children:h}),(d==null?void 0:d.length)>0&&e("div",{children:d.map(v=>e(B,{children:[e("span",{class:"tag collapsed insignificant",children:v.wholeWord?`${v.keyword}`:v.keyword})," "]}))}),e("small",{class:"insignificant",children:e(Ms,{expiresAt:f})})]}),e("button",{type:"button",class:"plain",onClick:()=>{o({filter:l})},children:e(C,{icon:"pencil",size:"l",alt:"Edit filter"})})]},m)})}),r.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(u,{id:"5vzJxv",values:{0:r.length}})})})]}):n==="loading"?e("p",{class:"ui-state",children:e(Ne,{})}):n==="error"?e("p",{class:"ui-state",children:e(u,{id:"qcAUwp"})}):e("p",{class:"ui-state",children:e(u,{id:"cWIHTt"})})})]}),!!s&&e(Fe,{title:g._({id:"vCSBPD"}),onClose:()=>{o(!1)},children:e(Xa,{filter:s==null?void 0:s.filter,onClose:l=>{l.state==="success"&&p(),o(!1)}})})]})}let Wa=1;const Za=()=>Wa++;function Xa({filter:t,onClose:n}){const{_:i}=Je(),{masto:s}=oe(),[o,a]=L("default"),p=!!t,{context:r,expiresAt:c,id:l,keywords:m,title:h,filterAction:f}=t||{},d=!!c,v=d&&new Date(c),[b,w]=L(m||[]),_=q(),[y,S]=L([]),[k,T]=L([]),I=b.filter(x=>!y.includes(x.id)&&!k.includes(x._id));return e("div",{class:"sheet",id:"filters-add-edit-modal",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:p?g._({id:"3mOee6"}):g._({id:"yFfBdX"})})}),e("main",{children:e("form",{onSubmit:x=>{x.preventDefault();const O=new FormData(x.target),P=O.get("title"),$=O.getAll("keyword_attributes[][id]"),Y=O.getAll("keyword_attributes[][keyword]"),X=[..._.current.querySelectorAll('input[name="keyword_attributes[][whole_word]"]')].map(V=>V.checked),J=Y.map((V,U)=>({id:$[U]||void 0,keyword:V,wholeWord:X[U]}));p&&(y!=null&&y.length)&&y.forEach(V=>{J.push({id:V,_destroy:!0})});const N=O.getAll("context");let M=O.get("expires_in");const z=O.get("filter_action");!P||!(N!=null&&N.length)||(a("loading"),(async()=>{try{let V;p?(M===""||M===null?d?M=Math.floor((v-new Date)/1e3):M=null:M==="0"||M===0?M=null:M=+M,V=await s.v2.filters.$select(l).update({title:P,context:N,expiresIn:M,keywordsAttributes:J,filterAction:z})):(M=+M||null,V=await s.v2.filters.create({title:P,context:N,expiresIn:M,keywordsAttributes:J,filterAction:z})),a("default"),n==null||n({state:"success",filter:V})}catch{a("error"),alert(p?g._({id:"H8RP+h"}):g._({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:h,disabled:o==="loading",dir:"auto",required:!0})]})}),e("div",{class:"filter-form-keywords",ref:_,children:[I.length?e("ul",{class:"filter-keywords",children:I.map(x=>{const{id:O,keyword:P,wholeWord:$,_id:Y}=x;return e("li",{children:[e("input",{type:"hidden",name:"keyword_attributes[][id]",value:O}),e("input",{name:"keyword_attributes[][keyword]",type:"text",defaultValue:P,disabled:o==="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:O,defaultChecked:$,disabled:o==="loading"})," ",e(u,{id:"/7UQ7y"})]}),e("button",{type:"button",class:"light danger small",disabled:o==="loading",onClick:()=>{O?(y.push(O),S([...y])):Y&&(k.push(Y),T([...k]))},children:e(C,{icon:"x",alt:g._({id:"t/YqKh"})})})]})]},`${O}-${Y}`)})}):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:()=>{w([...b,{_id:Za(),keyword:"",wholeWord:!0}]),setTimeout(()=>{var O,P;const x=_.current.querySelectorAll('input[type="text"]');(P=(O=x[x.length-1])==null?void 0:O.focus)==null||P.call(O)},10)},children:e(u,{id:"qn5Dbn"})})," ",(I==null?void 0:I.length)>1&&e("small",{class:"insignificant",children:e(u,{id:"1JZ175",values:{0:I.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"})})}),ja.map(x=>e("div",{children:[e("label",{class:qi.includes(x)?"insignificant":"",children:[e("input",{type:"checkbox",name:"context",value:x,defaultChecked:r?r.includes(x):!0,disabled:o==="loading"})," ",i(Va[x]),qi.includes(x)?"*":""]})," "]})),e("p",{children:e("small",{class:"insignificant",children:e(u,{id:"m0G499"})})})]}),e("div",{class:"filter-form-col",children:[p&&e(u,{id:"ucJk3m",components:{0:e("b",{}),1:e(Ms,{expiresAt:c,showNeverExpires:!0})}}),e("div",{children:[e("label",{for:"filters-expires_in",children:p?g._({id:"BcNdg+"}):g._({id:"agO/T/"})}),e("select",{id:"filters-expires_in",name:"expires_in",disabled:o==="loading",defaultValue:p?void 0:0,children:[p&&e("option",{}),Ga.map(x=>e("option",{value:x,children:typeof zn[x]=="function"?zn[x]():i(zn[x])}))]})]}),e("p",{children:[e(u,{id:"blQMpa"}),e("br",{}),e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"warn",defaultChecked:f==="warn"||!p,disabled:o==="loading"})," ",e(u,{id:"jbreWy"})]})," ",e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"hide",defaultChecked:f==="hide",disabled:o==="loading"})," ",e(u,{id:"zNCBmf"})]})]})]})]}),e("footer",{class:"filter-form-footer",children:[e("span",{children:[e("button",{type:"submit",disabled:o==="loading",children:p?g._({id:"tfDRzk"}):g._({id:"hYgDIe"})})," ",e(Ne,{abrupt:!0,hidden:o!=="loading"})]}),p&&e(rt,{disabled:o==="loading",align:"end",menuItemClassName:"danger",confirmLabel:g._({id:"BPjyR2"}),onClick:()=>{a("loading"),(async()=>{try{await s.v2.filters.$select(l).remove(),a("default"),n==null||n({state:"success"})}catch{a("error"),alert(g._({id:"4Dh9J1"}))}})()},children:e("button",{type:"button",class:"light danger",onClick:()=>{},disabled:o==="loading",children:e(u,{id:"Jb6/SB"})})})]})]})})]})}function Ms({expiresAt:t,showNeverExpires:n}){const i=!!t,s=i&&new Date(t),o=i&&s<=new Date,[a,p]=$t(r=>r+1,0);return Qn(p,o||3e4),o?g._({id:"M1RnFv"}):i?e(u,{id:"urGtsw",components:{0:e(Gt,{datetime:s})}}):n&&g._({id:"O1Aswy"})}function Ja(){const{masto:t,instance:n}=oe();We(g._({id:"Xi1/bw"}),"/fh");const[i,s]=L("default"),[o,a]=L([]);return ee(()=>{s("loading"),(async()=>{try{const p=await _n();a(p),s("default")}catch{s("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(Nt,{}),e(he,{to:"/",class:"button plain",children:e(C,{icon:"home",size:"l",alt:g._({id:"i0qMbr"})})})]}),e("h1",{children:e(u,{id:"Xi1/bw"})}),e("div",{class:"header-side"})]})}),e("main",{children:o.length>0?e(B,{children:[e("ul",{class:"link-list",children:o.map(p=>e("li",{children:e(he,{to:n?`/${n}/t/${p.name}`:`/t/${p.name}`,children:[e(C,{icon:"hashtag",alt:"#"})," ",e("span",{children:p.name})]})}))}),o.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(u,{id:"2S/uvJ",values:{0:o.length}})})})]}):i==="loading"?e("p",{class:"ui-state",children:e(Ne,{abrupt:!0})}):i==="error"?e("p",{class:"ui-state",children:e(u,{id:"2AeREO"})}):e("p",{class:"ui-state",children:e(u,{id:"vKsGhk"})})})]})})}const Qa=20;function gi({title:t,path:n,id:i,...s}){We(t||g._({id:"following.title"}),n||"/following");const{masto:o,streaming:a,instance:p}=oe(),r=He(A),c=q(),l=q();__BENCHMARK.end("time-to-following");const m=Xe("@pixelfed/home-include-reblogs");async function h(d){var w;(d||!c.current)&&(__BENCHMARK.start("fetch-home-first"),c.current=o.v1.timelines.home.list({limit:Qa})),m&&((w=c.current)!=null&&w.nextParams)&&(typeof c.current.nextParams=="string"?c.current.nextParams+="&include_reblogs=true":c.current.nextParams.include_reblogs=!0);const v=await c.current.next();let{value:b}=v;if(b!=null&&b.length){let _=!1;d&&(b[0].id!==l.current&&(_=!0),l.current=b[0].id),b.forEach(y=>{Ke(y,p)}),b=Ui(b,p),d&&_&&ma(),Rs(b,p),b.sort((y,S)=>{const k=new Date(y.createdAt);return new Date(S.createdAt)-k})}return __BENCHMARK.end("fetch-home-first"),{...v,value:b}}async function f(){var d;try{const v={limit:5,since_id:l.current};Xe("@pixelfed/home-include-reblogs")&&(v.include_reblogs=!0);const b=await o.v1.timelines.home.list(v).next();let{value:w}=b;const _=((d=w[0])==null?void 0:d.id)===l.current;return!!(w!=null&&w.length&&!_&&(l.current=w[0].id,w=Ui(w,p),w=Rt(w,"home"),w.some(y=>!y.reblog)))}catch{return!1}}return ee(()=>{let d;return(async()=>{if(a){d=a.user.subscribe();for await(const v of d){if(!d)break;if(v.event==="status.update"){const b=v.payload;Ke(b,p)}else if(v.event==="delete"){const b=v.payload,w=ss(b,p);w&&(w._deleted=!0)}}}})(),()=>{var v;(v=d==null?void 0:d.unsubscribe)==null||v.call(d),d=null}},[a]),e(kt,{title:t||g._({id:"following.title"}),id:i||"following",emptyText:g._({id:"nJEKbY"}),errorText:g._({id:"7QSeK6"}),instance:p,fetchItems:h,checkForUpdates:f,useItemID:!0,boostsCarousel:r.settings.boostsCarousel,...s,filterContext:"home",showFollowedTags:!0,showReplyParent:!0})}const er=20,tr=4,Yi=tr+1;function Ds({media:t,columnMode:n,...i}){let{hashtag:s,...o}=n?{}:Mt();i.hashtag&&(s=i.hashtag);let a=s.trim().split(/[\s+]+/);a.sort(),s=a[0];const[p,r]=ht(),c=t||!!p.get("media"),l=c?"?media=1":"",{masto:m,instance:h,authenticated:f}=oe({instance:(i==null?void 0:i.instance)||o.instance}),{masto:d,instance:v,authenticated:b}=oe(),w=a.map(U=>`#${U}`).join(" "),_=h?c?g._({id:"kH0rA0",values:{hashtagTitle:w,instance:h}}):g._({id:"IK0zKi",values:{hashtagTitle:w,instance:h}}):c?g._({id:"hHSI3w",values:{hashtagTitle:w}}):g._({id:"+ZzjRY",values:{hashtagTitle:w}});We(_,"/:instance?/t/:hashtag");const y=q(),S=_e(()=>Xn(),[]),k=q(void 0);async function T(U){const ie=await m.v1.timelines.tag.$select(s).list({limit:er,any:a.slice(1),maxId:U?void 0:k.current,onlyMedia:c?!0:void 0}).next();let{value:Q}=ie;return Q!=null&&Q.length&&(U&&(y.current=Q[0].id),Q.forEach(de=>{Ke(de,h,{skipThreading:c||S})}),k.current=Q[Q.length-1].id),{...ie,value:Q}}async function I(){var U;try{const ie=await m.v1.timelines.tag.$select(s).list({limit:1,any:a.slice(1),since_id:y.current,onlyMedia:c}).next();let{value:Q}=ie;const de=((U=Q[0])==null?void 0:U.id)===y.current;return Q!=null&&Q.length&&!de?(Q=Rt(Q,"public"),!0):!1}catch{return!1}}const[x,O]=L("default"),[P,$]=L();ee(()=>{(async()=>{try{const U=await m.v1.tags.$select(s).fetch();$(U)}catch{}})()},[s]);const Y=a.length>=Yi,[X,J]=L("default"),[N,M]=L([]),[z,V]=L(!1);return ee(()=>{f&&(async()=>{try{const U=await m.v1.featuredTags.list();M(U),V(U.some(ie=>ie.name.toLowerCase()===s.toLowerCase()))}catch{}})()},[]),e(kt,{title:_,titleComponent:!!h&&e("h1",{class:"header-double-lines",children:[e("b",{dir:"auto",children:w}),e("div",{children:h})]}),id:"hashtag",instance:h,emptyText:g._({id:"CNSLAW"}),errorText:g._({id:"yjj6Ll"}),fetchItems:T,checkForUpdates:I,useItemID:!0,view:c||S?"media":void 0,refresh:c,filterContext:"public",headerEnd:e(ct,{portal:!0,setDownOverflow:!0,overflow:"auto",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(C,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),children:[!!P&&a.length===1&&e(B,{children:[e(rt,{subMenu:!0,confirm:P.following,confirmLabel:g._({id:"ctJi7k",values:{hashtag:s}}),disabled:x==="loading"||!f,onClick:()=>{O("loading"),P.following?m.v1.tags.$select(s).unfollow().then(()=>{$({...P,following:!1}),ue(g._({id:"doK/ij",values:{hashtag:s}}))}).catch(U=>{alert(U)}).finally(()=>{O("default")}):m.v1.tags.$select(s).follow().then(()=>{$({...P,following:!0}),ue(g._({id:"R9+aEN",values:{hashtag:s}}))}).catch(U=>{alert(U)}).finally(()=>{O("default")})},children:P.following?e(B,{children:[e(C,{icon:"check-circle"})," ",e("span",{children:e(u,{id:"HOSk7R"})})]}):e(B,{children:[e(C,{icon:"plus"})," ",e("span",{children:e(u,{id:"MKEPCY"})})]})}),e(ye,{type:"checkbox",checked:z,disabled:X==="loading"||!f,onClick:()=>{if(J("loading"),z){const U=N.find(ie=>ie.name.toLowerCase()===s.toLowerCase()).id;U?m.v1.featuredTags.$select(U).remove().then(()=>{V(!1),ue(g._({id:"VH+Tf9"})),M(N.filter(ie=>ie.id!==U))}).catch(ie=>{}).finally(()=>{J("default")}):ue(g._({id:"3OLv47"}))}else m.v1.featuredTags.create({name:s}).then(U=>{V(!0),ue(g._({id:"9ra4hn"})),M(N.concat(U))}).catch(U=>{}).finally(()=>{J("default")})},children:z?e(B,{children:[e(C,{icon:"check-circle"}),e("span",{children:e(u,{id:"9ra4hn"})})]}):e(B,{children:[e(C,{icon:"check-circle"}),e("span",{children:e(u,{id:"UlJ3QN"})})]})}),e(Ve,{})]}),!S&&e(B,{children:[e(fs,{className:"plain",children:e(u,{id:"cSev+j"})}),e(ye,{type:"checkbox",checked:!!c,onClick:()=>{c?p.delete("media"):p.set("media","1"),r(p)},children:[e(C,{icon:"check-circle",alt:"☑️"})," ",e("span",{class:"menu-grow",children:e(u,{id:"eK4SL/"})})]}),e(Ve,{})]}),e($o,{className:"menu-field",disabled:Y,children:({ref:U})=>e("form",{onSubmit:ie=>{var de,Ie;ie.preventDefault();const Q=(Ie=(de=ie.target[0].value)==null?void 0:de.trim)==null?void 0:Ie.call(de);Q&&!a.some(te=>te.toLowerCase()===Q.toLowerCase())&&(a.push(Q),a.sort(),location.hash=h?`/${h}/t/${a.join("+")}`:`/t/${a.join("+")}${l}`)},children:[e(C,{icon:"hashtag"}),e("input",{ref:U,type:"text",placeholder:Y?g._({id:"ouWc/D",values:{TOTAL_TAGS_LIMIT:Yi}}):g._({id:"cxL5F9"}),required:!0,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:"[^#][^\\s#]+[^#]",disabled:Y,dir:"auto"})]})}),e(Mo,{takeOverflow:!0,children:a.map((U,ie)=>e(ye,{disabled:a.length===1,onClick:Q=>{a.splice(ie,1),a.sort(),location.hash=h?`/${h}/t/${a.join("+")}${l}`:`/t/${a.join("+")}${l}`},children:[e(C,{icon:"x",alt:g._({id:"OISAkj"}),class:"danger-icon"}),e("span",{class:"bidi-isolate",children:[e("span",{class:"more-insignificant",children:"#"}),U]})]},U))}),e(Ve,{}),e(ye,{disabled:!b,onClick:()=>{if(A.shortcuts.length>=bt){alert(g._({id:"XN1xAY",values:{SHORTCUTS_LIMIT:bt}}));return}const U={type:"hashtag",hashtag:a.join(" "),instance:h,media:c?"on":void 0};A.shortcuts.some(Q=>Q.type===U.type&&Q.hashtag.split(/[\s+]+/).sort().join(" ")===U.hashtag.split(/[\s+]+/).sort().join(" ")&&(Q.instance?Q.instance===U.instance:!0)&&(Q.media?!!Q.media==!!U.media:!0))?alert(g._({id:"kfeQnS"})):(A.shortcuts.push(U),ue(g._({id:"MIhb91"})))},children:[e(C,{icon:"shortcut"})," ",e("span",{children:e(u,{id:"i02Lq/"})})]}),e(ye,{onClick:()=>{let U=prompt(g._({id:"2MQ2cd"}));if(!/\./.test(U)){U&&alert(g._({id:"7WddtO"}));return}U&&(U=U.toLowerCase().trim(),location.hash=`/${U}/t/${a.join("+")}${l}`)},children:[e(C,{icon:"bus"})," ",e("span",{children:e(u,{id:"Sq04Yc"})})]}),v!==h&&e(ye,{onClick:()=>{location.hash=`/${v}/t/${a.join("+")}${l}`},children:[e(C,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(u,{id:"iAzCp4",values:{currentInstance:v},components:{0:e("b",{})}})})]})]})},h+w)}const nr=20;function Ns(t){var _;const n=He(A),{masto:i,instance:s}=oe(),o=(t==null?void 0:t.id)||((_=Mt())==null?void 0:_.id),a=q(),p=q();async function r(y){(y||!p.current)&&(p.current=i.v1.timelines.list.$select(o).list({limit:nr}));const S=await p.current.next();let{value:k}=S;return k!=null&&k.length&&(y&&(a.current=k[0].id),k.forEach(T=>{Ke(T,s)})),{...S,value:k}}async function c(){var y;try{const S=await i.v1.timelines.list.$select(o).list({limit:1,since_id:a.current});let{value:k}=S;const T=((y=k[0])==null?void 0:y.id)===a.current;return k!=null&&k.length&&!T?(k=Rt(k,"home"),!0):!1}catch{return!1}}const[l,m]=L([]);ee(()=>{sn().then(m)},[]);const[h,f]=L({title:"List"});We(h.title,"/l/:id"),ee(()=>{(async()=>{try{const y=await Cs(o);f(y)}catch{}})()},[o]);const[d,v]=L(!1),[b,w]=L(!1);return e(B,{children:[e(kt,{title:h.title,id:"list",emptyText:g._({id:"KkDhfU"}),errorText:g._({id:"7QSeK6"}),instance:s,fetchItems:r,checkForUpdates:c,useItemID:!0,boostsCarousel:n.settings.boostsCarousel,filterContext:"home",showReplyParent:!0,headerStart:e(ct,{overflow:"auto",menuButton:e("button",{type:"button",class:"plain",children:[e(C,{icon:"list",size:"l",alt:g._({id:"h16FyT"})}),e(C,{icon:"chevron-down",size:"s"})]}),children:[e(Ue,{to:"/l",children:e("span",{children:e(u,{id:"BHWx+g"})})}),(l==null?void 0:l.length)>0&&e(B,{children:[e(Ve,{}),l.map(y=>e(Ue,{to:`/l/${y.id}`,children:e("span",{children:y.title})},y.id))]})]}),headerEnd:e(ct,{portal:!0,setDownOverflow:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(C,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),children:[e(ye,{onClick:()=>v({list:h}),children:[e(C,{icon:"pencil",size:"l"}),e("span",{children:e(u,{id:"ePK91l"})})]}),e(ye,{onClick:()=>w(!0),children:[e(C,{icon:"group",size:"l"}),e("span",{children:e(u,{id:"hB02vO"})})]})]})},o),d&&e(Fe,{onClick:y=>{y.target===y.currentTarget&&v(!1)},children:e(ui,{list:d==null?void 0:d.list,onClose:y=>{y.state==="success"&&y.list?f(y.list):y.state==="deleted"&&(location.hash="/l"),v(!1)}})}),b&&e(Fe,{onClick:y=>{y.target===y.currentTarget&&w(!1)},children:e(sr,{listID:o,onClose:()=>w(!1)})})]})}const ir=40;function sr({listID:t,onClose:n}){const{masto:i,instance:s}=oe(),[o,a]=L([]),[p,r]=L("default"),[c,l]=L(!1),m=q();async function h(f){l(!1),r("loading"),(async()=>{try{(f||!m.current)&&(m.current=i.v1.lists.$select(t).accounts.list({limit:ir}));const d=await m.current.next();let{done:v,value:b}=d;b!=null&&b.length?(a(f?b:o.concat(b)),l(!v)):l(!1),r("default")}catch{r("error")}})()}return ee(()=>{h(!0)},[]),e("div",{class:"sheet",id:"list-manage-members-container",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{id:"hB02vO"})})}),e("main",{children:e("ul",{children:[o.map(f=>e("li",{children:[e(at,{account:f,instance:s}),e(or,{account:f,listID:t})]},f.id)),c&&p==="default"&&e(wt,{as:"li",onChange:f=>f&&h(),children:e("button",{type:"button",class:"light block",onClick:h,children:e(u,{id:"uXRAkV"})})})]})})]})}function or({account:t,listID:n}){const{masto:i}=oe(),[s,o]=L("default"),[a,p]=L(!1);return e(rt,{confirm:!a,confirmLabel:e("span",{children:e(u,{id:"j5n9Ry",values:{0:t.username},components:{0:e("span",{class:"bidi-isolate"})}})}),align:"end",menuItemClassName:"danger",onClick:()=>{a?(o("loading"),(async()=>{try{await i.v1.lists.$select(n).accounts.create({accountIds:[t.id]}),o("default"),p(!1)}catch{o("error")}})()):(o("loading"),(async()=>{try{await i.v1.lists.$select(n).accounts.remove({accountIds:[t.id]}),o("default"),p(!0)}catch{o("error")}})())},children:e("button",{type:"button",class:`light ${a?"":"danger"}`,disabled:s==="loading",children:a?g._({id:"m16xKo"}):g._({id:"MWIaew"})})})}const cr={mention:["account","status"],status:["account","status"],reblog:["account","status"],follow:["account"],follow_request:["account"],favourite:["account","status"],poll:["status"],update:["status"]};function Ps(t){return t.filter(n=>{const{type:i,id:s,createdAt:o}=n;if(!i)return!1;const a=cr[i];return a!=null&&a.length?a.every(p=>!!n[p]):!0})}function Os(t){if(t!=null&&t.notificationGroups){const{accounts:n=[],notificationGroups:i=[],statuses:s=[]}=t;return i.map(o=>{const{sampleAccountIds:a,statusId:p}=o,r=(a==null?void 0:a.map(l=>n.find(m=>m.id===l)))||[],c=(s==null?void 0:s.find(l=>l.id===p))||null;return{...o,sampleAccounts:r,status:c}})}return t}function ar(t){const n=t.map(p=>{const{latestPageNotificationAt:r,mostRecentNotificationId:c,sampleAccounts:l,notificationsCount:m}=p;return{id:""+c,createdAt:r,account:l[0],...p}}),i={},s=[];for(let p=0;p<n.length;p++){const r=n[p],{type:c,status:l,createdAt:m,notificationsCount:h,sampleAccounts:f,groupKey:d}=r,v=m?new Date(m).toLocaleDateString():"";let b=c;const w=h>0&&h===(f==null?void 0:f.length);(c==="favourite"||c==="reblog")&&(b="favourite+reblog");const _=`${l==null?void 0:l.id}-${b}-${v}`,y=i[_];if(y)f.forEach(S=>{const k=y.sampleAccounts.find(T=>T.id===S.id);k?(k._types.push(c),k._types.sort().reverse()):y.sampleAccounts.push({...S,_types:[c]})}),y.notificationsCount=Math.min(y.notificationsCount,h),y._notificationsCount.push(h),y._accounts=y.sampleAccounts,y._groupKeys.push(d);else{const S=f.map(k=>({...k,_types:[c]}));i[_]={...r,sampleAccounts:S,type:b,_accounts:S,_groupKeys:d?[d]:[],_notificationsCount:[h]},s.push(i[_])}}const o={},a=[];for(let p=0;p<s.length;p++){const r=s[p],{type:c,account:l,_accounts:m,sampleAccounts:h,createdAt:f,groupKey:d}=r,v=f?new Date(f).toLocaleDateString():"",b=(h==null?void 0:h.length)===1||(m==null?void 0:m.length)===1;if((c==="favourite"||c==="reblog"||c==="favourite+reblog")&&b){const w=`${l==null?void 0:l.id}-${c}-${v}`,_=o[w];if(_)_._statuses.push(r.status),_._ids+=`-${r.id}`,_._groupKeys.push(d);else{let y=o[w]={...r,type:c,_ids:r.id,_statuses:[r.status],_groupKeys:d?[d]:[]};a.push(y)}}else a.push(r)}return a}function rr(t){t=Ps(t);const n={},i=[];for(let a=0,p=0;a<t.length;a++){const r=t[a],{id:c,status:l,account:m,type:h,createdAt:f}=r,d=f?new Date(f).toLocaleDateString():"";let v=h;(h==="favourite"||h==="reblog")&&(v="favourite+reblog");const b=`${l==null?void 0:l.id}-${v}-${d}`,w=n[b];if(v==="follow_request")i[p++]=r;else if(w!=null&&w.account){const _=w._accounts.find(y=>y.id===m.id);_?(_._types.push(h),_._types.sort().reverse(),w._ids+=`-${c}`):(m._types=[h],w._accounts.push(m),w._ids+=`-${c}`)}else{m&&(m._types=[h]);let _=n[b]={...r,type:v,_ids:c,_accounts:m?[m]:[]};i[p++]=_}}const s={},o=[];for(let a=0,p=0;a<i.length;a++){const r=i[a],{id:c,account:l,_accounts:m,type:h,createdAt:f}=r,d=f?new Date(f).toLocaleDateString():"";if(h==="favourite+reblog"&&l&&m.length===1){const v=`${l==null?void 0:l.id}-${h}-${d}`,b=s[v];if(b)b._statuses.push(r.status),b._ids+=`-${c}`;else{let w=s[v]={...r,type:h,_ids:c,_statuses:[r.status]};o[p++]=w}}else o[p++]=r}return o}const ji=20,lr=new URLSearchParams;function zs({columnMode:t,...n}){const{masto:i,instance:s}=oe(),[o]=t?[lr]:ht(),[a,p]=L(null),r=(n==null?void 0:n.type)||o.get("type")||a;We(r==="private"?g._({id:"2BApYc"}):g._({id:"/bZzdR"}),"/mentions");const c=q(),l=q();async function m(_){(_||!c.current)&&(c.current=i.v1.notifications.list({limit:ji,types:["mention"]}));const y=await c.current.next();let{value:S}=y;return S!=null&&S.length&&(S=Ps(S),_&&(l.current=S[0].id),S.forEach(({status:k})=>{Ke(k,s)})),{...y,value:S==null?void 0:S.map(k=>k.status)}}const h=q(),f=q();async function d(_){(_||!h.current)&&(h.current=i.v1.conversations.list({limit:ji}));const y=await h.current.next();let{value:S}=y;return S=S==null?void 0:S.filter(k=>k.lastStatus),S!=null&&S.length&&(_&&(f.current=S[0].lastStatus.id),S.forEach(({lastStatus:k})=>{Ke(k,s)})),{...y,value:S==null?void 0:S.map(k=>k.lastStatus)}}function v(..._){return r==="private"?d(..._):m(..._)}async function b(){var _;if(r==="private")try{const y=await i.v1.conversations.list({limit:1,since_id:f.current}).next();let{value:S}=y;const k=((_=S[0])==null?void 0:_.id)===f.current;return S!=null&&S.length&&!k?(f.current=S[0].lastStatus.id,!0):!1}catch{return!1}else try{const y=await i.v1.notifications.list({limit:1,types:["mention"],since_id:l.current}).next();let{value:S}=y;return S!=null&&S.length?(l.current=S[0].id,!0):!1}catch{return!1}}const w=_e(()=>e("div",{class:"filter-bar centered",children:[e(he,{to:"/mentions",class:r?"":"is-active",onClick:_=>{t&&(_.preventDefault(),p(null))},children:e(u,{id:"N40H+G"})}),e(he,{to:"/mentions?type=private",class:r==="private"?"is-active":"",onClick:_=>{t&&(_.preventDefault(),p("private"))},children:e(u,{id:"zwBp5t"})})]}),[r]);return e(kt,{title:g._({id:"/bZzdR"}),id:"mentions",emptyText:g._({id:"03jFGT"}),errorText:g._({id:"pqR9KF"}),instance:s,fetchItems:v,checkForUpdates:b,useItemID:!0,timelineStart:w,refresh:r})}const dr=80,ur=20,hr=new URLSearchParams,an={block:"center",inline:"center",behavior:"smooth"},Us=is(()=>Xe("@mastodon/grouped-notifications"),{maxAge:1e3*60*5});function Fs(t={}){const{masto:n}=oe();return A.settings.groupedNotificationsAlpha&&Us()?n.v2.notifications.list({limit:ur,...t}):n.v1.notifications.list({limit:dr,...t})}function Bs(t){return A.settings.groupedNotificationsAlpha&&Us()?ar(t):rr(t)}const fr=["forNotFollowing","forNotFollowers","forNewAccounts","forPrivateMentions","forLimitedAccounts"],pr={forNotFollowing:{id:"d+hDoa"},forNotFollowers:{id:"oAwuQj"},forNewAccounts:{id:"Srs8u7"},forPrivateMentions:{id:"IDC5Uw"},forLimitedAccounts:{id:"XMGM2e"}};function mr({columnMode:t}){var D;const{_:n}=Je();We(g._({id:"iDNBZe"}),"/notifications");const{masto:i,instance:s}=oe(),o=He(A),[a,p]=L("default"),[r]=t?[hr]:ht(),c=r.get("id"),l=r.get("access_token"),[m,h]=L(!1),[f,d]=L(!1),v=q(),{nearReachEnd:b,scrollDirection:w,reachStart:_,nearReachStart:y}=ga({scrollableRef:v}),S=w==="end"&&!y,[k,T]=L([]),[I,x]=L([]),O=q();async function P(E){var ve;if((E||!O.current)&&(O.current=Fs({excludeTypes:["follow_request"]})),/max_id=($|&)/i.test((ve=O.current)==null?void 0:ve.nextParams))return{done:!0};const F=await O.current.next(),ae=Os(F.value);if(ae!=null&&ae.length){ae.forEach(Z=>{Ke(Z.status,s,{skipThreading:!0})});const Se=Bs(ae);E?(A.notificationsLast=Se[0],A.notifications=Se,i.v1.markers.create({notifications:{lastReadId:Se[0].id}}).catch(()=>{})):A.notifications.push(...Se)}return A.notificationsShowNew=!1,A.notificationsLastFetchTime=Date.now(),F}async function $(){try{return await i.v1.followRequests.list({limit:80})}catch{return[]}}const Y=()=>{p("loading"),(async()=>{try{const E=await $();T(E),p("default")}catch{p("error")}})()};async function X(){try{return await i.v1.announcements.list()}catch{return[]}}const J=Xe("@mastodon/filtered-notifications"),[N,M]=L(!1),[z,V]=L({});function U(){return i.v2.notifications.policy.fetch().catch(()=>{})}function ie(){U().then(E=>{V(E)}).catch(()=>{})}const[Q,de]=L(null);function Ie(){return i.v1.notifications.requests.list()}const te=E=>{we(!1),p("loading"),(async()=>{try{const F=P(E);E&&(X().then(ve=>{ve.sort((Se,Z)=>{const $e=new Date(Se.updatedAt||Se.createdAt);return new Date(Z.updatedAt||Z.createdAt)-$e}),x(ve)}).catch(()=>{}),$().then(ve=>{T(ve)}).catch(()=>{}),J&&ie());const{done:ae}=await F;h(!ae),p("default")}catch{p("error")}})()};ee(()=>{te(!0)},[]),ee(()=>{_&&te(!0)},[_]);const[ge,we]=L(!1),G=ot(({disableIdleCheck:E=!1}={})=>{var F;a!=="loading"&&o.settings.autoRefresh&&((F=v.current)==null?void 0:F.scrollTop)<16&&(E||window.__IDLE__)&&!gr()&&te(!0)},[o.notificationsShowNew,o.settings.autoRefresh,a]),ce=q();Ht(E=>{if(E){const F=Date.now()-ce.current;!ce.current||F>1e3*3?G({disableIdleCheck:!0}):ce.current=Date.now()}});const ke=q(!0);ee(()=>{let E=ro(A,"notificationsShowNew",F=>{if(ke.current){ke.current=!1;return}a!=="loading"&&(F&&G(),we(F))});return()=>E==null?void 0:E()},[]);const Ae=new Date,Re=new Date(Ae-24*60*60*1e3);let Le=new Date;const De=!o.notifications.some(E=>new Date(E.createdAt).toDateString()===Ae.toDateString()),be=q();ee(()=>{c&&(A.routeNotification={id:c,accessToken:atob(l)})},[c,l]);const W=".notification",pe=Be("j",()=>{const E=document.activeElement.closest(W),F=E==null?void 0:E.getBoundingClientRect(),ae=Array.from(v.current.querySelectorAll(W));if(E&&F.top<v.current.clientHeight&&F.bottom>0){const ve=ae.indexOf(E);let Se=ae[ve+1];Se&&(Se.focus(),Se.scrollIntoView(an))}else{const ve=ae.find(Se=>{const Z=Se.getBoundingClientRect();return Z.top>=44&&Z.left>=0});ve&&(ve.focus(),ve.scrollIntoView(an))}}),Te=Be("k",()=>{const E=document.activeElement.closest(W),F=E==null?void 0:E.getBoundingClientRect(),ae=Array.from(v.current.querySelectorAll(W));if(E&&F.top<v.current.clientHeight&&F.bottom>0){const ve=ae.indexOf(E);let Se=ae[ve-1];Se&&(Se.focus(),Se.scrollIntoView(an))}else{const ve=ae.find(Se=>{const Z=Se.getBoundingClientRect();return Z.top>=44&&Z.left>=0});ve&&(ve.focus(),ve.scrollIntoView(an))}}),le=Be(["enter","o"],()=>{const E=document.activeElement.closest(W),F=E==null?void 0:E.querySelector(".status-link");F&&F.click()}),K=new Date,fe=_e(()=>ut(K,{forceOpts:{weekday:"long"}}),[K]);return e("div",{id:"notifications-page",class:"deck-container",ref:E=>{v.current=E,pe(E),Te(E),le(E)},tabIndex:"-1",children:[e("div",{class:`timeline-deck deck ${f?"only-mentions":""}`,children:[e("header",{hidden:S,onClick:E=>{var F;E.target.closest("a, button")||(F=v.current)==null||F.scrollTo({top:0,behavior:"smooth"})},onDblClick:E=>{E.target.closest("a, button")||te(!0)},class:a==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Nt,{}),e(he,{to:"/",class:"button plain",children:e(C,{icon:"home",size:"l",alt:g._({id:"i0qMbr"})})})]}),e("h1",{children:e(u,{id:"iDNBZe"})}),e("div",{class:"header-side",children:J&&e("button",{type:"button",class:"button plain4",onClick:()=>{M(!0)},children:e(C,{icon:"settings",size:"l",alt:g._({id:"a/+arl"})})})})]}),ge&&a!=="loading"&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:()=>{var E;te(!0),(E=v.current)==null||E.scrollTo({top:0,behavior:"smooth"})},children:[e(C,{icon:"arrow-up"})," ",e(u,{id:"Jy9RU/"})]})]}),I.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(C,{icon:"announce",class:"announcement-icon",size:"l"})," ",e(u,{id:"0whvLM",values:{0:I.length}})," ",e("small",{class:"insignificant",children:s})]}),I.length>1&&e("span",{class:"announcements-nav-buttons",children:I.map((E,F)=>e("button",{type:"button",class:"plain2 small",onClick:()=>{var ae;(ae=be.current)==null||ae.children[F].scrollIntoView({behavior:"smooth",block:"nearest"})},children:F+1}))})]}),e("ul",{class:`announcements-list-${I.length>1?"multiple":"single"}`,ref:be,children:I.map(E=>e("li",{children:e(br,{announcement:E})}))})]})})}),k.length>0&&e("div",{class:"follow-requests",children:[e("h2",{class:"timeline-header",children:e(u,{id:"6Fs1Ba"})}),k.length>5?e("details",{children:[e("summary",{children:e(u,{id:"7dHKu4",values:{0:k.length}})}),e("ul",{children:k.map(E=>e("li",{children:[e(at,{account:E}),e(Vn,{accountID:E.id,onChange:()=>{}})]},E.id))})]}):e("ul",{children:k.map(E=>e("li",{children:[e(at,{account:E}),e(Vn,{accountID:E.id,onChange:()=>{}})]},E.id))})]}),J&&((D=z==null?void 0:z.summary)==null?void 0:D.pendingRequestsCount)>0&&e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e("div",{class:"filtered-notifications",children:e("details",{onToggle:async E=>{const{open:F}=E.target;if(F){const ae=await Ie();de(ae)}},children:[e("summary",{children:e(u,{id:"N3Bq0f",values:{0:z.summary.pendingRequestsCount}})}),Q?(Q==null?void 0:Q.length)>0&&e("ul",{children:Q.map(E=>{var F,ae;return e("li",{children:[e("div",{class:"request-notifcations",children:[!((F=E.lastStatus)!=null&&F.id)&&e(at,{useAvatarStatic:!0,showStats:!0,account:E.account}),((ae=E.lastStatus)==null?void 0:ae.id)&&e("div",{class:"last-post",children:e(he,{class:"status-link",to:`/${s}/s/${E.lastStatus.id}`,children:e(qe,{status:E.lastStatus,size:"s",readOnly:!0})})}),e(yr,{request:E})]}),e(wr,{request:E,onChange:()=>{te(!0)}})]},E.id)})}):e("p",{class:"ui-state",children:e(Ne,{abrupt:!0})})]})})})}),e("div",{id:"mentions-option",children:e("label",{children:[e("input",{type:"checkbox",checked:f,onChange:E=>{d(E.target.checked)}})," ",e(u,{id:"0udtPI"})]})}),e("h2",{class:"timeline-header",children:[e(u,{id:"ecUA8p"})," ",e("small",{class:"insignificant bidi-isolate",children:fe})]}),De&&e("p",{class:"ui-state insignificant",children:a==="default"?g._({id:"KS7iJH"}):e(B,{children:"…"})}),o.notifications.length?e(B,{children:o.notifications.filter(E=>E.type!=="follow_request").map(E=>{if(f&&E.type!=="mention")return null;const F=new Date(E.createdAt),ae=F.toDateString()!==Le.toDateString();ae&&(Le=F);const ve=F.toDateString()===Re.toDateString()?g._({id:"y/0uwd"}):ut(Le,{hideTime:!0}),Se=ut(Le,{forceOpts:{weekday:"long"}});return e(B,{children:[ae&&e("h2",{class:"timeline-header",children:[e("span",{children:ve})," ",e("small",{class:"insignificant bidi-isolate",children:Se})]}),e(Tn,{instance:s,notification:E},E._ids||E.id)]},E._ids||E.id)})}):e(B,{children:[a==="loading"&&e(B,{children:e("ul",{class:"timeline flat",children:Array.from({length:5}).map((E,F)=>e("li",{class:"notification skeleton",children:[e("div",{class:"notification-type",children:e(C,{icon:"notification",size:"xl"})}),e("div",{class:"notification-content",children:e("p",{children:"███████████ ████"})})]}))})}),a==="error"&&e("p",{class:"ui-state",children:[e(u,{id:"gjzl8E"}),e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>te(!0),children:e(u,{id:"KDw4GX"})})]})]}),m&&e(wt,{onChange:E=>{E&&te()},children:e("button",{type:"button",class:"plain block",disabled:a==="loading",onClick:()=>te(),style:{marginBlockEnd:"6em"},children:a==="loading"?e(Ne,{abrupt:!0}):e(u,{id:"uXRAkV"})})})]}),J&&N&&e(Fe,{onClick:E=>{E.target===E.currentTarget&&M(!1)},children:e("div",{class:"sheet",id:"notifications-settings",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>M(!1),children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{id:"a/+arl"})})}),e("main",{children:e("form",{onSubmit:E=>{E.preventDefault();const{forNotFollowing:F,forNotFollowers:ae,forNewAccounts:ve,forPrivateMentions:Se,forLimitedAccounts:Z}=E.target,$e={...z,forNotFollowing:F.value,forNotFollowers:ae.value,forNewAccounts:ve.value,forPrivateMentions:Se.value,forLimitedAccounts:Z.value};V($e),M(!1),(async()=>{try{await i.v2.notifications.policy.update($e),ue(g._({id:"4+7X9i"}))}catch{}})()},children:[e("p",{children:e(u,{id:"WrkPTf"})}),e("div",{class:"notification-policy-fields",children:fr.map(E=>{const F=z[E];return e("div",{children:e("label",{children:[n(pr[E]),e("select",{name:E,defaultValue:F,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"})})]})]})},E)})}),e("p",{children:e("button",{type:"submit",children:e(u,{id:"tfDRzk"})})})]})})]})})]})}function gr(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}function br({announcement:t}){const{instance:n}=oe(),{contact:i}=es(),s=i==null?void 0:i.account,{id:o,content:a,startsAt:p,endsAt:r,published:c,allDay:l,publishedAt:m,updatedAt:h,read:f,mentions:d,statuses:v,tags:b,emojis:w,reactions:_}=t,y=new Date(m),S=ut(y),k=new Date(h),T=ut(k);return e("div",{class:"announcement-block",children:[e(at,{account:s}),e("div",{class:"announcement-content",onClick:cs({mentions:d,instance:n}),dangerouslySetInnerHTML:{__html:Bn(a,{emojis:w})}}),e("p",{class:"insignificant",children:[e("time",{datetime:y.toISOString(),children:ut(y)}),h&&T!==S&&e(B,{children:[" ","•"," ",e("span",{class:"ib",children:e(u,{id:"TbFrLc",values:{0:ut(k)},components:{0:e("time",{datetime:k.toISOString()})}})})]})]}),e("div",{class:"announcement-reactions",hidden:!0,children:_.map(I=>{const{name:x,count:O,me:P,staticUrl:$,url:Y}=I;return e("button",{type:"button",class:`plain4 small ${P?"reacted":""}`,children:[Y||$?e("img",{src:Y||$,alt:x,width:"16",height:"16"}):e("span",{children:x})," ",e("span",{class:"count",children:Ge(O)})]})})})]})}function vr(t){const{masto:n}=oe();return n.v1.notifications.list({accountID:t})}function yr({request:t}){var h;const{instance:n}=oe(),[i,s]=L("loading"),{account:o,lastStatus:a}=t,[p,r]=L(!1),[c,l]=L([]);function m(){r(!1)}return ee(()=>{var f;(f=t==null?void 0:t.account)!=null&&f.id&&p&&(s("loading"),(async()=>{const d=await vr(t.account.id);l(d||[]),s("default")})())},[p,(h=t==null?void 0:t.account)==null?void 0:h.id]),e(B,{children:[e("button",{type:"button",class:"plain4 request-notifications-account",onClick:()=>{r(!0)},children:[e(C,{icon:"notification",class:"more-insignificant"})," ",e("small",{children:e(u,{id:"H0wUNM",values:{0:o.username},components:{0:e("span",{class:"bidi-isolate"})}})})," ",e(C,{icon:"chevron-down"})]}),p&&e(Fe,{onClick:f=>{f.target===f.currentTarget&&m()},children:e("div",{class:"sheet",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:m,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(u,{id:"MXOmPt",values:{0:o.username},components:{0:e("span",{class:"bidi-isolate"})}})})}),e("main",{children:i==="loading"?e("p",{class:"ui-state",children:e(Ne,{abrupt:!0})}):c.map(f=>e("div",{class:"notification-peek",onClick:d=>{const{target:v}=d;(d.target.tagName==="BUTTON"||d.target.tagName==="A")&&m()},children:e(Tn,{instance:n,notification:f,isStatic:!0})}))})]})})]})}function wr({request:t,onChange:n}){const{masto:i}=oe(),[s,o]=L("default"),[a,p]=L(null),r=a!==null;return e("p",{class:"notification-request-buttons",children:[e("button",{type:"button",disabled:s==="loading"||r,onClick:()=>{o("loading"),(async()=>{try{await i.v1.notifications.requests.$select(t.id).accept(),p("accept"),o("default"),n({request:t,state:"accept"}),ue(g._({id:"ZtBMwU",values:{0:t.account.username}}))}catch{o("error"),ue(g._({id:"S92JKG"}))}})()},children:e(u,{id:"h7peZQ"})})," ",e("button",{type:"button",disabled:s==="loading"||r,class:"light danger",onClick:()=>{o("loading"),(async()=>{try{await i.v1.notifications.requests.$select(t.id).dismiss(),p("dismiss"),o("default"),n({request:t,state:"dismiss"}),ue(g._({id:"ibBDry",values:{0:t.account.username}}))}catch{o("error"),ue(g._({id:"S5aemF"}))}})()},children:e(u,{id:"1QfxQT"})}),e("span",{class:"notification-request-states",children:s==="loading"?e(Ne,{abrupt:!0}):a==="accept"?e(C,{icon:"check-circle",alt:g._({id:"bzMKg7"}),class:"notification-accepted"}):a==="dismiss"&&e(C,{icon:"x-circle",alt:g._({id:"J6hrEy"}),class:"notification-dismissed"})})]})}const Hs=it(mr),_r=20;function Gn({local:t,columnMode:n,...i}){const s=He(A),o=!!t,a=n?{}:Mt(),{masto:p,instance:r}=oe({instance:(i==null?void 0:i.instance)||a.instance}),{masto:c,instance:l}=oe(),m=o?g._({id:"u96B/B",values:{instance:r}}):g._({id:"PgVqvd",values:{instance:r}});We(m,o?"/:instance?/p/l":"/:instance?/p");const h=q(),f=q();async function d(b){if(b||!f.current){const y={limit:_r,local:o||void 0};!o&&Xe("@pixelfed/global-feed")&&(y.remote=!0),f.current=p.v1.timelines.public.list(y)}const w=await f.current.next();let{value:_}=w;return _!=null&&_.length&&(b&&(h.current=_[0].id),_.forEach(y=>{Ke(y,r)})),{...w,value:_}}async function v(){var b;try{const w=await p.v1.timelines.public.list({limit:1,local:o,since_id:h.current}).next();let{value:_}=w;const y=((b=_[0])==null?void 0:b.id)===h.current;return _!=null&&_.length&&!y?(_=Rt(_,"public"),!0):!1}catch{return!1}}return e(kt,{title:m,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:o?g._({id:"pJQgQV"}):g._({id:"cg0I+x"})}),e("div",{children:r})]}),id:"public",instance:r,emptyText:g._({id:"BiZJ6G"}),errorText:g._({id:"scd9lw"}),fetchItems:d,checkForUpdates:v,useItemID:!0,headerStart:e(B,{}),boostsCarousel:s.settings.boostsCarousel,filterContext:"public",headerEnd:e(ct,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(C,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),children:[e(ye,{href:o?`/#/${r}/p`:`/#/${r}/p/l`,children:o?e(B,{children:[e(C,{icon:"transfer"})," ",e("span",{children:e(u,{id:"dXMiUw"})})]}):e(B,{children:[e(C,{icon:"transfer"})," ",e("span",{children:e(u,{id:"t2B/we"})})]})}),e(Ve,{}),e(ye,{onClick:()=>{let b=prompt(g._({id:"2MQ2cd"}));if(!/\./.test(b)){b&&alert(g._({id:"7WddtO"}));return}b&&(b=b.toLowerCase().trim(),location.hash=o?`/${b}/p/l`:`/${b}/p`)},children:[e(C,{icon:"bus"})," ",e("span",{children:e(u,{id:"Sq04Yc"})})]}),l!==r&&e(ye,{onClick:()=>{location.hash=o?`/${l}/p/l`:`/${l}/p`},children:[e(C,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(u,{id:"iAzCp4",values:{currentInstance:l},components:{0:e("b",{})}})})]})]})},r+o)}const rn=5,Un=40,kr=new URLSearchParams;function qs({columnMode:t,...n}){const i=t?{}:Mt(),{masto:s,instance:o,authenticated:a}=oe({instance:i.instance}),[p,r]=L("default"),[c]=t?[kr]:ht(),l=q(),m=(n==null?void 0:n.query)||c.get("q"),h=t?"statuses":(n==null?void 0:n.type)||c.get("type");let f=g._({id:"A1taO8"});if(m)switch(h){case"statuses":f=g._({id:"6YeoAt",values:{q:m}});break;case"accounts":f=g._({id:"fpgumQ",values:{q:m}});break;case"hashtags":f=g._({id:"AuiMZZ",values:{q:m}});break;default:f=g._({id:"wr3GZI",values:{q:m}})}We(f,"/search");const[d,v]=L(!1),b=q(0);ee(()=>{b.current=0},[m,h]);const w=q();yt(()=>{var N,M;(M=(N=w.current)==null?void 0:N.scrollTo)==null||M.call(N,0,0)},[m,h]);const[_,y]=L([]),[S,k]=L([]),[T,I]=L([]);ee(()=>{y([]),k([]),I([])},[m]);const x={statuses:y,accounts:k,hashtags:I},[O,P]=L({}),$=async N=>{if(!(N!=null&&N.length))return;const M=await ei(N,O);M&&P({...O,...M})};function Y(N){N&&(b.current=0),!(!N&&!a)&&(r("loading"),N&&!h&&(y(_.slice(0,rn)),k(S.slice(0,rn)),I(T.slice(0,rn))),(async()=>{var z,V;const M={q:m,resolve:a,limit:rn};h&&(M.limit=Un,M.type=h,a&&(M.offset=b.current));try{const U=await s.v2.search.fetch(M);if(h)if(N){x[h](U[h]);const ie=(z=U[h])==null?void 0:z.length;b.current=Un,v(!!ie)}else{x[h](Q=>[...Q,...U[h]]);const ie=(V=U[h])==null?void 0:V.length;b.current=b.current+Un,v(!!ie)}else y(U.statuses||[]),k(U.accounts||[]),I(U.hashtags||[]),b.current=0,v(!1);$(U.accounts),r("default")}catch{r("error")}})())}const X=q();Ht(N=>{var z;const M=((z=w.current)==null?void 0:z.scrollTop)===0;if(N&&M){const V=Date.now()-X.current;!X.current||V>1e3*3?Y(!0):X.current=Date.now()}}),ee(()=>{var N,M,z,V;(M=(N=l.current)==null?void 0:N.setValue)==null||M.call(N,m||""),m?Y(!0):(V=(z=l.current)==null?void 0:z.focus)==null||V.call(z)},[m,h,o]),Be(["/","Slash"],N=>{var M,z,V,U;(z=(M=l.current)==null?void 0:M.focus)==null||z.call(M),(U=(V=l.current)==null?void 0:V.select)==null||U.call(V)},{preventDefault:!0});const[J]=ai();return e("div",{id:"search-page",class:"deck-container",ref:w,children:e("div",{class:"timeline-deck deck",children:[e("header",{class:p==="loading"?"loading":"",children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:e(Nt,{})}),e(Es,{ref:l}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{Y(!0)},disabled:p==="loading",children:e(C,{icon:"search",size:"l",alt:g._({id:"A1taO8"})})})})]})}),e("main",{children:[!!m&&!t&&e("div",{ref:J,class:`filter-bar ${p==="loading"?"loading":""}`,children:[!!h&&e(he,{to:`/search${m?`?q=${encodeURIComponent(m)}`:""}`,children:[e(C,{icon:"chevron-left"})," ",e(u,{id:"N40H+G"})]}),[{label:g._({id:"bPwFdf"}),type:"accounts",to:`/search?q=${encodeURIComponent(m)}&type=accounts`},{label:g._({id:"VwUsHI"}),type:"hashtags",to:`/search?q=${encodeURIComponent(m)}&type=hashtags`},{label:g._({id:"+owNNn"}),type:"statuses",to:`/search?q=${encodeURIComponent(m)}&type=statuses`}].sort((N,M)=>N.type===h?-1:M.type===h?1:0).map(N=>e(he,{to:N.to,children:N.label},N.type))]}),m?e(B,{children:[(!h||h==="accounts")&&e(B,{children:[h!=="accounts"&&e("h2",{class:"timeline-header",children:[e(u,{id:"bPwFdf"})," ",e(he,{to:`/search?q=${encodeURIComponent(m)}&type=accounts`,children:e(C,{icon:"arrow-right",size:"l",alt:g._({id:"V1fa9u"})})})]}),S.length>0?e(B,{children:[e("ul",{class:"timeline flat accounts-list",children:S.map(N=>e("li",{children:e(at,{account:N,instance:o,showStats:!0,relationship:O[N.id]})},N.id))}),h!=="accounts"&&e("div",{class:"ui-state",children:e(he,{class:"plain button",to:`/search?q=${encodeURIComponent(m)}&type=accounts`,children:[e(u,{id:"BMmtZ8"})," ",e(C,{icon:"arrow-right"})]})})]}):!h&&(p==="loading"?e("p",{class:"ui-state",children:e(Ne,{abrupt:!0})}):e("p",{class:"ui-state",children:e(u,{id:"YYB61U"})}))]}),(!h||h==="hashtags")&&e(B,{children:[h!=="hashtags"&&e("h2",{class:"timeline-header",children:[e(u,{id:"VwUsHI"})," ",e(he,{to:`/search?q=${encodeURIComponent(m)}&type=hashtags`,children:e(C,{icon:"arrow-right",size:"l",alt:g._({id:"V1fa9u"})})})]}),T.length>0?e(B,{children:[e("ul",{class:"link-list hashtag-list",children:T.map(N=>{var U;const{name:M,history:z}=N,V=(U=z==null?void 0:z.reduce)==null?void 0:U.call(z,(ie,Q)=>ie+ +Q.uses,0);return e("li",{children:e(he,{to:o?`/${o}/t/${M}`:`/t/${M}`,children:[e(C,{icon:"hashtag",alt:"#"}),e("span",{children:M}),!!V&&e("span",{class:"count",children:Ge(V)})]})},`${M}-${V}`)})}),h!=="hashtags"&&e("div",{class:"ui-state",children:e(he,{class:"plain button",to:`/search?q=${encodeURIComponent(m)}&type=hashtags`,children:[e(u,{id:"Nc/W5J"})," ",e(C,{icon:"arrow-right"})]})})]}):!h&&(p==="loading"?e("p",{class:"ui-state",children:e(Ne,{abrupt:!0})}):e("p",{class:"ui-state",children:e(u,{id:"4MFM3P"})}))]}),(!h||h==="statuses")&&e(B,{children:[h!=="statuses"&&e("h2",{class:"timeline-header",children:[e(u,{id:"+owNNn"})," ",e(he,{to:`/search?q=${encodeURIComponent(m)}&type=statuses`,children:e(C,{icon:"arrow-right",size:"l",alt:g._({id:"V1fa9u"})})})]}),_.length>0?e(B,{children:[e("ul",{class:"timeline",children:_.map(N=>e("li",{children:e(he,{class:"status-link",to:o?`/${o}/s/${N.id}`:`/s/${N.id}`,children:e(qe,{status:N})})},N.id))}),h!=="statuses"&&e("div",{class:"ui-state",children:e(he,{class:"plain button",to:`/search?q=${encodeURIComponent(m)}&type=statuses`,children:[e(u,{id:"LYCgej"})," ",e(C,{icon:"arrow-right"})]})})]}):!h&&(p==="loading"?e("p",{class:"ui-state",children:e(Ne,{abrupt:!0})}):e("p",{class:"ui-state",children:e(u,{id:"Hzi9AA"})}))]}),!!h&&(p==="default"?d?e(wt,{onChange:N=>{N&&Y()},children:e("button",{type:"button",class:"plain block",onClick:()=>Y(),style:{marginBlockEnd:"6em"},children:e(u,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(u,{id:"2EYeAZ"})}):p==="loading"&&e("p",{class:"ui-state",children:e(Ne,{abrupt:!0})}))]}):p==="loading"?e("p",{class:"ui-state",children:e(Ne,{abrupt:!0})}):e("p",{class:"ui-state",children:e(u,{id:"fGn1Hk"})})]})]})})}const Sr=20,Ys=10*60*1e3,Cr=_t(t=>t.v1.trends.links.list().next(),{maxAge:Ys}),Ir=_t(t=>t.v1.trends.tags.list().next(),{maxAge:Ys});function Tr(t){return Xe("@pixelfed/trending")?t.pixelfed.v2.discover.posts.trending.list({range:"daily"}):t.v1.trends.statuses.list({limit:Sr})}function xr(t,n){return t.v1.timelines.link.list(n)}function js({columnMode:t,...n}){const i=He(A),s=t?{}:Mt(),{masto:o,instance:a}=oe({instance:(n==null?void 0:n.instance)||s.instance}),{masto:p,instance:r}=oe(),c=g._({id:"cI3UEs",values:{instance:a}});We(c,"/:instance?/trending");const l=q(),m=a===r,[h,f]=L([]),[d,v]=L([]),b=q();async function w(J){var z;if(J||!b.current){if(b.current=Tr(o),Xe("@mastodon/trending-hashtags"))try{const{value:V}=await Ir(o);V!=null&&V.length&&f(V)}catch{}if(Xe("@mastodon/trending-links"))try{const{value:V}=await Cr(o,a),U=(z=V==null?void 0:V.filter)==null?void 0:z.call(V,ie=>ie.type==="link");U!=null&&U.length&&v(U)}catch{}}const N=await b.current.next();let{value:M}=N;return M!=null&&M.length&&(J&&(l.current=M[0].id),M.forEach(V=>{Ke(V,a)})),{...N,value:M}}const[_,y]=L(!1),S=q(),[k,T]=L(null),I=!!k,x=q(),O=m&&Xe("@mastodon/trending-link-posts");ee(()=>{k&&x.current&&x.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[k]);const P=q();async function $(J){(J||!S.current)&&(y(!0),S.current=xr(o,{url:k})),P.current=k;const N=await S.current.next();let{value:M}=N;return M!=null&&M.length&&(M=Rt(M,"public"),M.forEach(z=>{Ke(z,a)})),P.current===k&&y(!1),{...N,value:M}}async function Y(){try{const J=await o.v1.trends.statuses.list({limit:1}).next();let{value:N}=J;return N=Rt(N,"public"),N!=null&&N.length&&N[0].id!==l.current?(l.current=N[0].id,!0):!1}catch{return!1}}const X=_e(()=>e(B,{children:[!!h.length&&e("div",{class:"filter-bar expandable",children:[e(C,{icon:"chart",class:"insignificant",size:"l"}),h.map((J,N)=>{const{name:M,history:z}=J,V=z.reduce((U,ie)=>U+ +ie.uses,0);return e(he,{to:`/${a}/t/${M}`,children:[e("span",{dir:"auto",children:[e("span",{class:"more-insignificant",children:"#"}),M]}),e("span",{class:"filter-count",children:Ge(V)})]},M)})]}),!!d.length&&e("div",{class:"links-bar",children:[e("header",{children:e("h3",{children:e(u,{id:"9veeTb"})})}),d.map(J=>{var W,pe;const{authors:N,authorName:M,authorUrl:z,blurhash:V,description:U,height:ie,image:Q,imageDescription:de,language:Ie,providerName:te,providerUrl:ge,publishedAt:we,title:G,url:ce,width:ke}=J,Ae=(pe=(W=N==null?void 0:N[0])==null?void 0:W.account)!=null&&pe.id?N[0].account:null,Re=G.length<30,Le=!!(M||Ae),De=Kt.toUnicode(URL.parse(ce).hostname.replace(/^www\./,"").replace(/\/$/,""));let be;if(V){const Te=ti(V),le=hi(Te);be=fi([.6,le[1],le[2]])}return e("div",{children:[e("a",{ref:k===ce?x:null,href:ce,target:"_blank",rel:"noopener noreferrer",class:`link-block ${I?k===ce?"active":"inactive":""}`,style:be?{"--accent-color":`rgb(${be.join(",")})`,"--accent-alpha-color":`rgba(${be.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:Q,alt:de,width:ke,height:ie,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:De})," ",!!we&&e(B,{children:"· "}),!!we&&e(B,{children:e(Gt,{datetime:we,format:"micro"})})]}),!!G&&e("h1",{class:"title",lang:Ie,dir:"auto",title:G,children:G})]}),!!U&&e("p",{class:`description ${Le&&!Re?"":"more-lines"}`,lang:Ie,dir:"auto",title:U,children:U}),Le&&e(B,{children:[e("hr",{}),e("p",{class:"byline",children:e("small",{children:e(u,{id:"aavdrC",values:{0:Ae?e(pt,{account:Ae,showAvatar:!0}):z?e("a",{href:z,target:"_blank",rel:"noopener noreferrer",children:M}):M}})})})]})]})]})}),O&&e("button",{type:"button",class:"small plain4 block",onClick:()=>{T(ce)},disabled:ce===k,children:[e(C,{icon:"comment2"})," ",e("span",{children:e(u,{id:"/bZzdR"})})," ",e(C,{icon:"chevron-down"})]})]},ce)})]}),O&&!!d.length&&e("div",{class:`timeline-header-block ${I?"blended":""}`,children:I?e(B,{children:[e("div",{style:{width:50,flexShrink:0,textAlign:"center"},children:_?e(Ne,{abrupt:!0}):e("button",{type:"button",class:"light",onClick:()=>{T(null)},children:e(C,{icon:"x",alt:g._({id:"9Q/4xJ"})})})}),e("p",{children:e(u,{id:"BATCqf",values:{0:k.replace(/^https?:\/\/(www\.)?/i,"").replace(/\/$/,"")},components:{0:e("span",{class:"link-text"})}})})]}):e("p",{class:"insignificant",children:e(u,{id:"Vosm4k"})})})]}),[h,d,k,_]);return e(kt,{title:c,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:e(u,{id:"4/iCqx"})}),e("div",{children:a})]}),id:"trending",instance:a,emptyText:g._({id:"6HA9+s"}),errorText:g._({id:"scd9lw"}),fetchItems:I?$:w,checkForUpdates:I?void 0:Y,checkForUpdatesInterval:5*60*1e3,useItemID:!0,headerStart:e(B,{}),boostsCarousel:i.settings.boostsCarousel,filterContext:"public",timelineStart:X,refresh:k,clearWhenRefresh:!0,view:I?"link-mentions":void 0,headerEnd:e(ct,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(C,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),children:[e(ye,{onClick:()=>{let J=prompt(g._({id:"2MQ2cd"}));if(!/\./.test(J)){J&&alert(g._({id:"7WddtO"}));return}J&&(J=J.toLowerCase().trim(),location.hash=`/${J}/trending`)},children:[e(C,{icon:"bus"})," ",e("span",{children:e(u,{id:"Sq04Yc"})})]}),r!==a&&e(ye,{onClick:()=>{location.hash=`/${r}/trending`},children:[e(C,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(u,{id:"iAzCp4",values:{currentInstance:r},components:{0:e("b",{})}})})]})]})},a)}function Ar(){We(g._({id:"i0qMbr"}),"/");const t=He(A),{shortcuts:n}=t,i=n.map(s=>{if(!s)return null;const{type:o,...a}=s,p={following:gi,notifications:Hs,list:Ns,public:Gn,bookmarks:Ls,favourites:$s,hashtag:Ds,mentions:zs,trending:js,search:qs}[o];return!p||o==="search"&&!a.query||o==="list"&&!a.id?null:e(p,{...a,columnMode:!0},o+JSON.stringify(a))});return Be(["1","2","3","4","5","6","7","8","9"],(s,o)=>{try{const a=parseInt(o.keys[0],10)-1;document.querySelectorAll("#columns > *")[a].focus()}catch{}}),e("div",{id:"columns",onContextMenu:s=>{s.target.closest(".deck > header")&&!s.target.closest("a")&&!s.target.closest("button")&&(s.preventDefault(),A.showShortcutsSettings=!0)},children:i})}function Er(){var i;const{_:t}=Je(),n=He(A);return __BENCHMARK.end("time-to-home"),ee(()=>{(async()=>{const s=await dt.drafts.keys();if(s.length){const o=bn();s.filter(p=>p.startsWith(o)).length&&(A.showDrafts=!0)}})()},[]),e(B,{children:(n.settings.shortcutsViewMode==="multi-column"||!n.settings.shortcutsViewMode&&n.settings.shortcutsColumnsMode)&&((i=n.shortcuts)!=null&&i.length)?e(Ar,{}):e(gi,{title:t({id:"i0qMbr"}),path:"/",id:"home",headerStart:!1,headerEnd:e(Rr,{})})})}function Rr(){const t=He(A),n=q(),[i,s]=L(void 0);return e(B,{children:[e(he,{ref:n,to:"/notifications",class:`button plain notifications-button ${t.notificationsShowNew?"has-badge":""} ${i||""}`,onClick:o=>{o.stopPropagation(),window.matchMedia("(min-width: calc(40em))").matches&&(o.preventDefault(),s(a=>a?void 0:"open"))},children:e(C,{icon:"notification",size:"l",alt:g._({id:"iDNBZe"})})}),e($r,{state:i,anchorRef:n,onClose:()=>s(void 0)})]})}const Lr=5;function $r({anchorRef:t,state:n,onClose:i}){const{masto:s,instance:o}=oe(),a=He(A),[p,r]=L("default"),c=Fs();async function l(){const b=await c.next(),w=Os(b.value);if(w!=null&&w.length){w.forEach(y=>{Ke(y.status,o,{skipThreading:!0})});const _=Bs(w);A.notificationsLast=_[0],A.notifications=_,s.v1.markers.create({notifications:{lastReadId:_[0].id}}).catch(()=>{})}return A.notificationsShowNew=!1,A.notificationsLastFetchTime=Date.now(),b}const[m,h]=L(!1);function f(){return s.v1.followRequests.list({limit:1})}function d(){r("loading"),(async()=>{try{await l();const b=await f();h(!!(b!=null&&b.length)),r("default")}catch{r("error")}})()}ee(()=>{n==="open"&&d()},[n]);const v=q();return e(us,{ref:v,menuClassName:"notifications-menu",state:n,anchorRef:t,onClose:i,portal:{target:document.body},containerProps:{onClick:()=>{var b,w;(w=(b=v.current)==null?void 0:b.closeMenu)==null||w.call(b)}},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("main",{children:a.notifications.length?e(B,{children:a.notifications.slice(0,Lr).map(b=>e(Tn,{instance:o,notification:b,disableContextMenu:!0},b._ids||b.id))}):p==="loading"?e("div",{class:"ui-state",children:e(Ne,{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:d,children:e(u,{id:"KDw4GX"})})})]})}),e("footer",{children:[e(he,{to:"/mentions",class:"button plain",children:[e(C,{icon:"at"})," ",e("span",{children:e(u,{id:"/bZzdR"})})]}),e(he,{to:"/notifications",class:"button plain2",children:[m?e(u,{id:"OdVhdR",components:{0:e("span",{class:"tag collapsed"}),1:e("span",{})}}):e("b",{children:e(u,{id:"gukqfD"})})," ",e(C,{icon:"arrow-right"})]})]})]})}const Mr=it(Er),Dr=[/^\/@[^@\/]+\/(?:statuses|posts)\/([^\/]+)/i,/\/notes\/([^\/]+)/i,/^\/(?:notice|objects)\/([a-z0-9-]+)/i,/\/@[^@\/]+\/post\/([^\/]+)/i,/\/@[^@\/]+@?[^\/]+?\/([^\/]+)/i,/^\/p\/[^\/]+\/([^\/]+)/i];function Vs(t){const{hostname:n,pathname:i}=URL.parse(t);for(const s of Dr){const[,o]=i.match(s)||[];if(o)return{instance:n,id:o}}return{}}function Nr(t){const{instance:n,id:i}=Vs(t);return n&&i?`/${n}/s/${i}`:null}function Pr(){const n=Vt().pathname.replace(/^\//,""),i=Vs(n),s=i!=null&&i.instance?`/${i.instance}/s/${i.id}`:null,[o,a]=L("loading");return yt(()=>{a("loading"),(async()=>{try{const{instance:p,id:r}=i;if(r){const{masto:c}=oe({instance:p});if(await c.v1.statuses.$select(r).fetch()){window.location.hash=s+"?view=full";return}}}catch{}{const{masto:p,instance:r}=oe(),c=await p.v2.search.fetch({q:n,limit:1,resolve:!0});if(c.statuses.length){const l=c.statuses[0];window.location.hash=`/${r}/s/${l.id}?view=full`}else if(c.accounts.length){const l=c.accounts[0];window.location.hash=`/${r}/a/${l.id}`}else s?window.location.hash=s+"?view=full":a("error")}})()},[s]),e("div",{class:"ui-state",tabIndex:"-1",children:[o==="loading"?e(B,{children:[e(Ne,{abrupt:!0}),e("h2",{children:e(u,{id:"RTAr/z"})}),e("p",{children:e("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:n})})]}):e(B,{children:[e("h2",{children:e(u,{id:"ufzZSJ"})}),e("p",{children:e("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:n})})]}),e("hr",{}),e("p",{children:e(he,{to:"/",children:e(u,{id:"iWpEwy"})})})]})}function Or(){We(g._({id:"h16FyT"}),"/l");const[t,n]=L("default"),[i,s]=$t(c=>c+1,0),[o,a]=L([]);ee(()=>{n("loading"),(async()=>{try{const c=await jn();a(c),n("default")}catch{n("error")}})()},[i]);const[p,r]=L(!1);return e("div",{id:"lists-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck",children:[e("header",{children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Nt,{}),e(he,{to:"/",class:"button plain",children:e(C,{icon:"home",size:"l"})})]}),e("h1",{children:e(u,{id:"h16FyT"})}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>r(!0),children:e(C,{icon:"plus",size:"l",alt:g._({id:"Sb2gYF"})})})})]})}),e("main",{children:o.length>0?e(B,{children:[e("ul",{class:"link-list",children:o.map(c=>e("li",{children:e(he,{to:`/l/${c.id}`,children:e("span",{children:[e(C,{icon:"list"})," ",e("span",{children:c.title})]})})}))}),o.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(u,{id:"8prZNK",values:{0:o.length}})})})]}):t==="loading"?e("p",{class:"ui-state",children:e(Ne,{})}):t==="error"?e("p",{class:"ui-state",children:e(u,{id:"v/l5uA"})}):e("p",{class:"ui-state",children:e(u,{id:"IvPikw"})})})]}),p&&e(Fe,{onClick:c=>{c.target===c.currentTarget&&r(!1)},children:e(ui,{list:p==null?void 0:p.list,onClose:c=>{c.state==="success"&&s(),r(!1)}})})]})}const zr=""+new URL("instances-CwO9tuGQ.json",import.meta.url).href;function Ur(t){return("0"+t.toString(16)).slice(-2)}function Fr(){var t=new Uint32Array(28);return window.crypto.getRandomValues(t),Array.from(t,Ur).join("")}function Br(t){const i=new TextEncoder().encode(t);return window.crypto.subtle.digest("SHA-256",i)}function Hr(t){let n="";const i=new Uint8Array(t),s=i.byteLength;for(var o=0;o<s;o++)n+=String.fromCharCode(i[o]);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Gs(t){const n=await Br(t);return Hr(n)}async function qr({instanceURL:t}){var n;if(!t)return!1;try{const i=await fetch(`https://${t}/.well-known/oauth-authorization-server`);return!i.ok||i.status!==200?!1:!!((n=(await i.json()).code_challenge_methods_supported)!=null&&n.includes("S256"))}catch{return!1}}window.__generateCodeChallenge=Gs;const Yr={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_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{DEV:jr,PHANPY_CLIENT_NAME:Vr,PHANPY_WEBSITE:Sn}=Yr,xn="read write follow push",Gr=Sn?Sn.toLowerCase().includes(location.hostname):!1,Kr=location.origin+location.pathname,An=jr||!Gr?Kr:Sn;async function Wr({instanceURL:t}){const n=new URLSearchParams({client_name:Vr,redirect_uris:An,scopes:xn,website:Sn});return await(await fetch(`https://${t}/api/v1/apps`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:n.toString()})).json()}async function Zr({instanceURL:t,client_id:n}){const i=Fr(),s=await Gs(i),o=new URLSearchParams({client_id:n,code_challenge_method:"S256",code_challenge:s,redirect_uri:An,response_type:"code",scope:xn});return[`https://${t}/oauth/authorize?${o.toString()}`,i]}async function Xr({instanceURL:t,client_id:n}){const i=new URLSearchParams({client_id:n,scope:xn,redirect_uri:An,response_type:"code"});return`https://${t}/oauth/authorize?${i.toString()}`}async function Jr({instanceURL:t,client_id:n,client_secret:i,code:s,code_verifier:o}){const a=new URLSearchParams({client_id:n,redirect_uri:An,grant_type:"authorization_code",code:s,scope:xn});return i&&a.append("client_secret",i),o&&a.append("code_verifier",o),await(await fetch(`https://${t}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:a.toString()})).json()}const Qr={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_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_DEFAULT_INSTANCE:el}=Qr;function tl(){var y,S;We("Log in");const t=q(),n=me.local.get("instanceURL"),[i,s]=L("default"),[o]=ht(),a=o.get("instance"),p=o.get("submit"),[r,c]=L(a||(n==null?void 0:n.toLowerCase())||""),[l,m]=L([]),h=q();ee(()=>{(async()=>{try{const T=await(await fetch(zr)).json();m(T),h.current=new Do(T)}catch{}})()},[]);const f=k=>{k&&(async()=>{try{const I=await(await fetch(`https://${k}/.well-known/host-meta`)).text(),$=new DOMParser().parseFromString(I,"text/xml").getElementsByTagName("Link")[0].getAttribute("template"),Y=URL.parse($),{host:X}=Y;k!==X&&(k=X)}catch{}me.local.set("instanceURL",k),s("loading");try{const{client_id:T,client_secret:I,vapid_key:x}=await Wr({instanceURL:k});if(await qr({instanceURL:k}))if(T&&I){me.sessionCookie.set("clientID",T),me.sessionCookie.set("clientSecret",I),me.sessionCookie.set("vapidKey",x);const[P,$]=await Zr({instanceURL:k,client_id:T});me.sessionCookie.set("codeVerifier",$),location.href=P}else alert(g._({id:"ZP1FIA"}));else T&&I?(me.sessionCookie.set("clientID",T),me.sessionCookie.set("clientSecret",I),me.sessionCookie.set("vapidKey",x),location.href=await Xr({instanceURL:k,client_id:T})):alert(g._({id:"ZP1FIA"}));s("default")}catch{s("error")}})()},d=r?r.replace(/^https?:\/\//,"").replace(/\/+$/,"").replace(/^@?[^@]+@/,"").trim():null,v=/[^\s\r\n\t\/\\]+\.[^\s\r\n\t\/\\]+/.test(d)&&!/[\s\/\\@]/.test(d),b=d?(S=(y=h.current)==null?void 0:y.search(d,{limit:10}))==null?void 0:S.map(k=>k.item):[],w=v?d:b!=null&&b.length?b[0]:r?l.find(k=>k.includes(r)):null,_=k=>{k.preventDefault(),f(w)};return p&&ee(()=>{f(a||w)},[]),e("main",{id:"login",style:{textAlign:"center"},children:e("form",{onSubmit:_,children:[e("h1",{children:[e("img",{src:ri,alt:"",width:"80",height:"80"}),e("br",{}),e(u,{id:"sQia9P"})]}),e("label",{children:[e("p",{children:e(u,{id:"kyAi7k"})}),e("input",{value:r,required:!0,type:"text",class:"large",id:"instanceURL",ref:t,disabled:i==="loading",autocorrect:"off",autocapitalize:"off",autocomplete:"off",spellCheck:!1,placeholder:g._({id:"u3gOdY"}),onInput:k=>{c(k.target.value)},dir:"auto"}),(b==null?void 0:b.length)>0?e("ul",{id:"instances-suggestions",children:b.map((k,T)=>e("li",{children:e("button",{type:"button",class:"plain5",onClick:()=>{f(k)},children:k})}))}):e("div",{id:"instances-eg",children:e(u,{id:"/OvbEC"})})]}),i==="error"&&e("p",{class:"error",children:e(u,{id:"rmBHZn"})}),e("div",{children:[e("button",{disabled:i==="loading"||!r||!w,children:w?g._({id:"2xahsi",values:{selectedInstanceText:w}}):g._({id:"xGVfLh"})})," "]}),e(Ne,{hidden:i!=="loading"}),e("hr",{}),!el&&e("p",{children:e("a",{href:"https://joinmastodon.org/servers",target:"_blank",children:e(u,{id:"LcOiWS"})})}),e("p",{children:e(he,{to:"/",children:e(u,{id:"iWpEwy"})})}),e(li,{})]})})}const nl={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_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_DEFAULT_INSTANCE:Vi}=nl,ln=40,il=10,sl=5;let Kn={},fn={},pn={};function mn(t){delete fn[t],delete pn[t]}const Zt={block:"nearest",inline:"center",behavior:"smooth"},Gi=".status-link:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *), .status-focus:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *)",Ki=/\/s\//i;function ol(t){var k;const{id:n}=t,{masto:i,instance:s}=oe({instance:t.instance}),o=He(A),[a,p]=ht(),r=a.get("media"),c=a.get("media-only"),l=parseInt(r||c,10);let m=l>0;const h=a.get("mediaStatusID"),f=ss(h,s);h&&!f&&(m=!1);const d=m&&!!c,v=nt(n,s),[b,w]=L(A.statuses[v]);ee(()=>{A.statuses[v]&&w(A.statuses[v])},[v]);const _=_e(()=>{const{prevLocation:T}=A,I=((T==null?void 0:T.pathname)||"")+((T==null?void 0:T.search)||""),x=en("/:instance/s/:id",I)||en("/s/:id",I);return!I||x?"/":I},[]);ee(()=>{!b&&m&&(async()=>{try{const T=await i.v1.statuses.$select(n).fetch();Ke(T,s),w(T)}catch{alert("Unable to load post."),location.hash=_}})()},[m]);const y=h?(k=o.statuses[nt(h,s)])==null?void 0:k.mediaAttachments:b==null?void 0:b.mediaAttachments,S=ot(()=>{!window.matchMedia("(min-width: calc(40em + 350px))").matches&&o.prevLocation?history.back():d?location.hash=_:(a.delete("media"),a.delete("mediaStatusID"),p(a))},[d,_,o.prevLocation]);return ee(()=>{let T=setTimeout(()=>{const I=document.querySelector(".carousel");I&&I.focus()},100);return()=>clearTimeout(T)},[d]),ee(()=>{const T=document.querySelectorAll(".deck-container");return T.forEach(I=>{I.setAttribute("inert","")}),()=>{T.forEach(I=>{I.removeAttribute("inert")})}},[]),e("div",{class:"deck-backdrop",children:[m?y!=null&&y.length?e(xs,{mediaAttachments:y,statusID:h||n,instance:s,lang:b==null?void 0:b.language,index:l-1,onClose:S}):e("div",{class:"media-modal-container loading",children:e(Ne,{abrupt:!0})}):e(he,{to:_}),!d&&e(al,{id:n,instance:t.instance,closeLink:_})]})}function cl(t){const{linkable:n,to:i,onClick:s,...o}=t;return n?e(he,{class:"status-link",to:i,onClick:s,...o}):e("div",{class:"status-focus",tabIndex:0,...o})}function al({id:t,closeLink:n="/",instance:i}){var K,fe;const[s,o]=ht(),a=s.get("media"),p=s.get("mediaStatusID"),r=parseInt(a,10)>0,c=q(!A.prevLocation&&(history.length===1||"navigation"in window&&((fe=(K=navigation==null?void 0:navigation.entries)==null?void 0:K.call(navigation))==null?void 0:fe.length)===1)),[l,m]=L(s.get("view")||c.current?"full":null),h=!!parseInt(s.get("translate")),{masto:f,instance:d}=oe({instance:i}),{masto:v,instance:b,authenticated:w}=oe(),_=d===b,y=He(A),[S,k]=L([]),[T,I]=L("default"),x=q(),O=nt(t,d),P=q(0),$=q();ee(()=>{var D;(D=$.current)==null||D.focus()},[]),ee(()=>{var E;const D=ps(()=>{if(!$.current)return;const{scrollTop:F}=$.current;T!=="loading"&&(pn[t]=F)},50);return(E=$.current)==null||E.addEventListener("scroll",D,{passive:!0}),D(),()=>{var F;D.cancel(),(F=$.current)==null||F.removeEventListener("scroll",D)}},[t,T!=="loading"]);const Y=q(),X=q(),J=({reloadHero:D}={})=>{I("loading");let E;const F=fn[t];if(F){const ae=F.filter(ve=>A.statuses[O]);k(ae)}else k([{id:t}]);return(async()=>{var $e,Pe;const ae=()=>Si(()=>f.v1.statuses.$select(t).fetch(),{retries:4}),ve=Si(()=>f.v1.statuses.$select(t).context.fetch(),{retries:8}),Se=!!y.statuses[O];let Z=y.statuses[O];if(!(Se&&!D))try{Z=await ae(),Ke(Z,d),await new Promise(R=>{setTimeout(R,100)})}catch{I("error");return}try{let R=function(re){return re==null?void 0:re.map(ze=>({id:ze.id,account:ze.account,repliesCount:ze.repliesCount,content:ze.content,weight:Qt(ze),replies:R(ze.__replies)}))};const j=await ve,{ancestors:se,descendants:H}=j;P.current=(H==null?void 0:H.length)||0;const ne=new Set;se.forEach(re=>{Ke(re,d,{skipThreading:!0}),re.inReplyToId&&!se.find(ze=>ze.id===re.inReplyToId)&&ne.add(re.inReplyToId)});const Me=se.every(re=>re.account.id===Z.account.id),xe=[];H.forEach(re=>{if(Ke(re,d,{skipThreading:!0}),re.inReplyToId&&!H.find(ze=>ze.id===re.inReplyToId)&&re.inReplyToId!==Z.id&&ne.add(re.inReplyToId),re.inReplyToAccountId===re.account.id)xe.push(re);else if(re.inReplyToId===Z.id)xe.push(re);else if(!re.inReplyToAccountId&&xe.find(ze=>ze.id===re.inReplyToId)&&re.account.id===Z.account.id)xe.push(re);else{const ze=H.find(Ze=>Ze.id===re.inReplyToId);ze&&(ze.__replies||(ze.__replies=[]),ze.__replies.push(re))}}),ne.size;const Ce=[...se.map(re=>({id:re.id,ancestor:!0,isThread:Me,accountID:re.account.id,account:re.account,repliesCount:re.repliesCount,weight:Qt(re)})),{id:t,accountID:Z.account.id,weight:Qt(Z)},...xe.map(re=>({id:re.id,account:re.account,accountID:re.account.id,descendant:!0,thread:re.account.id===Z.account.id,weight:Qt(re),replies:R(re.__replies)}))];I("default"),Y.current={offsetTop:($e=x.current)==null?void 0:$e.offsetTop,scrollTop:(Pe=$.current)==null?void 0:Pe.scrollTop};const Oe=Ce.findIndex(re=>re.id===t);Oe>=de&&Ie(Oe+1),k(Ce),fn[t]=Ce,lo(Z,d)}catch{I("error")}})(),X.current=Date.now(),()=>{clearTimeout(E)}};ee(J,[t,f]);const[N,M]=L(!1);ee(()=>{let D=setInterval(()=>{const E=Date.now();X.current&&E-X.current>=6e4&&M(!0)},6e4);return()=>{clearInterval(D)}},[]),yt(()=>{var E,F;if(!S.length)return;const D=pn[t];if(D)$.current.scrollTop=D;else if(Y.current){const ae={offsetTop:(E=x.current)==null?void 0:E.offsetTop,scrollTop:(F=$.current)==null?void 0:F.scrollTop},ve=ae.offsetTop-Y.current.offsetTop+ae.scrollTop;$.current.scrollTop=ve}else S.length===1&&($.current.scrollTop=0);Y.current=null},[S]),ee(()=>{y.reloadStatusPage<=0||(async()=>{try{const{instanceURL:D}=Zn(),E=`https://${D}/api/v1/statuses/${t}/context`;return await(await caches.open("api")).delete(E,{ignoreVary:!0}),J({reloadHero:!0})}catch{}})()},[y.reloadStatusPage]),ee(()=>()=>{pn={},A.reloadStatusPage=0,fn={},Kn={},Wn.clear()},[]);const z=y.statuses[O]||y.statuses[t],V=_e(()=>{if(!z)return"";const{account:D}=z,E=document.createElement("div");return E.innerHTML=D.displayName,E.innerText.trim()},[z]),U=_e(()=>{if(!z)return"";let D=ni(z);return D.length>64&&(D=D.slice(0,64)+"…"),D},[z]);We(V&&U?`${V}: "${U}"`:g._({id:"post.title"}),"/:instance?/s/:id");const ie=_e(()=>{if(!z)return;const{url:D}=z;if(D)return URL.parse(D).hostname},[z]),Q=_e(()=>{if(ie)return ie===d},[ie,d]),[de,Ie]=L(ln),te=_e(()=>S.length-de,[S.length,de]),ge=S.some(D=>D.descendant),we=S.filter(D=>D.ancestor),[G,ce]=L(!0),ke=_e(()=>{if(!x.current||G)return null;const{top:D}=x.current.getBoundingClientRect();return D>0?"down":"up"},[G]);Be("esc",()=>{location.hash=n},{enabled:!r,ignoreEventWhen:D=>!!document.querySelector("#modal-container > *")}),Be("backspace",()=>{location.hash=n}),Be("j",()=>{const D=document.activeElement.closest(".status-link, .status-focus"),E=D==null?void 0:D.getBoundingClientRect(),F=Array.from($.current.querySelectorAll(Gi));if(D&&E.top<$.current.clientHeight&&E.bottom>0){const ae=F.indexOf(D);let ve=F[ae+1];ve&&(ve.focus(),ve.scrollIntoView(Zt))}else{const ae=F.find(ve=>{const Se=ve.getBoundingClientRect();return Se.top>=44&&Se.left>=0});ae&&(ae.focus(),ae.scrollIntoView(Zt))}}),Be("k",()=>{const D=document.activeElement.closest(".status-link, .status-focus"),E=D==null?void 0:D.getBoundingClientRect(),F=Array.from($.current.querySelectorAll(Gi));if(D&&E.top<$.current.clientHeight&&E.bottom>0){const ae=F.indexOf(D);let ve=F[ae-1];ve&&(ve.focus(),ve.scrollIntoView(Zt))}else{const ae=F.find(ve=>{const Se=ve.getBoundingClientRect();return Se.top>=44&&Se.left>=0});ae&&(ae.focus(),ae.scrollIntoView(Zt))}}),Be("x",()=>{const D=document.activeElement.closest(".status-link, .status-focus");if(D){const E=D.nextElementSibling;E&&E.tagName.toLowerCase()==="details"&&(E.open=!E.open)}});const[Ae,Re]=L(!1),Le=q(r?"media+status":"status"),De=ot((D,E,F,ae)=>{D.preventDefault(),D.stopPropagation(),o({media:E+1,mediaStatusID:ae.id})},[t]),be=ot((D,E)=>{mn(E.id)},[]);ee(()=>{let D;return p&&r&&(D=setTimeout(()=>{var F;const E=(F=$.current)==null?void 0:F.querySelector(`.status-link[href*="/${p}"]`);E&&E.scrollIntoView(Zt)},400)),()=>{clearTimeout(D)}},[p,r]);const W=ot((D,E)=>{const{id:F,ancestor:ae,isThread:ve,descendant:Se,thread:Z,replies:$e,repliesCount:Pe,weight:R}=D,j=F===t;return e("li",{ref:j?x:null,class:`${ae?"ancestor":""} ${Se?"descendant":""} ${Z?"thread":""} ${j?"hero":""}`,children:[j?e(B,{children:[e(wt,{threshold:.1,onChange:H=>{queueMicrotask(()=>{requestAnimationFrame(()=>{ce(H)})})},class:"status-focus",tabIndex:0,children:e(qe,{statusID:F,instance:d,withinContext:!0,size:"l",enableTranslate:!0,forceTranslate:h})}),T!=="loading"&&!w?e("div",{class:"post-status-banner",children:[e("p",{children:e(u,{id:"Vyeh4F"})}),e(he,{to:Vi?`/login?instance=${Vi}&submit=1`:"/login",class:"button",children:e(u,{id:"sQia9P"})})]}):!_&&e("div",{class:"post-status-banner",children:[e("p",{children:e(u,{id:"j5roNG",values:{instance:d},components:{0:e("b",{})}})}),e("button",{type:"button",disabled:T==="loading",onClick:()=>{I("loading"),(async()=>{try{const H=await v.v2.search.fetch({q:z.url,type:"statuses",resolve:!0,limit:1});if(H.statuses.length){const ne=H.statuses[0];location.hash=b?`/${b}/s/${ne.id}`:`/s/${ne.id}`}else throw new Error("No results")}catch(H){I("default"),alert(g._({id:"DnepCE",values:{e:H}}))}})()},children:[e(C,{icon:"transfer"})," ",e(u,{id:"ejAVrO"})]})]})]}):e(cl,{linkable:ve||ae,to:d?`/${d}/s/${F}`:`/s/${F}`,onClick:()=>{mn(F)},children:[E===0&&ae?e(wt,{threshold:.5,onChange:H=>{queueMicrotask(()=>{requestAnimationFrame(()=>{Re(H)})})},children:e(qe,{statusID:F,instance:d,withinContext:!0,size:Z||ae?"m":"s",enableTranslate:!0,onMediaClick:De,onStatusLinkClick:be})}):e(qe,{statusID:F,instance:d,withinContext:!0,size:Z||ae?"m":"s",enableTranslate:!0,onMediaClick:De,onStatusLinkClick:be,showActionsBar:!!Se}),ae&&Pe>1&&e("div",{class:"replies-link",children:[e(C,{icon:"comment2",alt:g._({id:"N8UzTV"})})," ",e("span",{title:Pe,children:Ge(Pe)})]})," "]}),Se&&($e==null?void 0:$e.length)>0&&e(Ks,{instance:d,replies:$e,hasParentThread:Z,level:1,accWeight:R,openAll:P.current<il,parentLink:{to:d?`/${d}/s/${F}`:`/s/${F}`,onClick:()=>mn(F)}}),T==="loading"&&j&&!!(z!=null&&z.repliesCount)&&!ge&&e("div",{class:"status-loading",children:e(Ne,{abrupt:z.repliesCount>=3})}),T==="error"&&j&&!!(z!=null&&z.repliesCount)&&!ge&&e("div",{class:"status-error",children:[e(u,{id:"HQJU6W"}),e("br",{}),e("button",{type:"button",class:"plain",onClick:()=>{A.reloadStatusPage++},children:e(u,{id:"KDw4GX"})})]})]},F)},[t,d,T,w,_,h,De,be,ge]),pe=_e(()=>{var D;if("navigation"in window&&(navigation!=null&&navigation.entries)){const E=navigation.entries()[navigation.currentEntry.index-1];if(E!=null&&E.url)return Ki.test(E.url)}return Ki.test((D=A.prevLocation)==null?void 0:D.pathname)},[O]),Te=_e(()=>{if(!te)return[];const D=[];function E(F){D.push(F.id),F.replies&&F.replies.forEach(E)}return S.slice(de).forEach(E),D.map(F=>nt(F,d))},[te,S,de,d]),le=_e(()=>S.slice(0,de).map(W),[S,de,W]);return ee(()=>{let D=setTimeout(()=>{if(!x.current)return;const E=x.current.querySelector(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)");E&&E.click()},1e3);return()=>clearTimeout(D)},[t]),e("div",{tabIndex:"-1",ref:$,class:`status-deck deck contained ${S.length>1?"padded-bottom":""} ${Le.current==="status"&&!c.current?"slide-in":""} ${l?`deck-view-${l}`:""}`,onAnimationEnd:D=>{Le.current==="status"&&(Le.current=null)},children:[e("header",{class:`${T==="loading"?"loading":""}`,onDblClick:D=>{A.reloadStatusPage++},children:e("div",{class:"header-grid header-grid-2",children:[e("h1",{children:[pe&&e("button",{type:"button",class:"plain deck-back",onClick:()=>{history.back()},children:e(C,{icon:"chevron-left",size:"xl",alt:g._({id:"iH8pgl"})})}),!G&&z&&T!=="loading"?e(B,{children:[e("span",{class:"hero-heading",children:[e(pt,{account:z.account,instance:d,showAvatar:!0,short:!0})," ",e("span",{class:"insignificant",children:["•"," ",e(Gt,{datetime:z.createdAt,format:"micro"})]})]})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:D=>{D.preventDefault(),D.stopPropagation(),x.current.scrollIntoView({behavior:"smooth",block:"start"})},title:g._({id:"NCy+Nw"}),children:e(C,{icon:ke==="down"?"arrow-down":"arrow-up"})})]}):e(B,{children:[e(u,{id:"post.title"})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:D=>{D.preventDefault(),D.stopPropagation(),$.current.scrollTo({top:0,behavior:"smooth"})},hidden:!we.length||Ae,title:g._({id:"R8CUl0",values:{0:we.length}}),children:[e(C,{icon:"arrow-up"}),we.filter((D,E,F)=>F.findIndex(ae=>ae.accountID===D.accountID)===E).slice(0,3).map(D=>e(lt,{url:D.account.avatar,alt:D.account.displayName},D.account.id)),we.length>3&&e(B,{children:[" ",e("span",{class:"insignificant",children:Ge(we.length)})]})]})]})]}),e("div",{class:"header-side",children:[e("button",{type:"button",class:"plain4 button-switch-view",style:{display:l==="full"?"":"none"},onClick:()=>{m(null),s.delete("media"),s.delete("media-only"),s.delete("view"),o(s)},title:g._({id:"+/xYEI"}),children:e(C,{icon:"layout4",size:"l"})}),N&&e("button",{type:"button",class:"plain button-refresh",onClick:()=>{A.reloadStatusPage++,M(!1)},children:e(C,{icon:"refresh",size:"l",alt:g._({id:"lCF0wC"})})}),e(ct,{align:"end",portal:{target:$.current},menuButton:e("button",{type:"button",class:"button plain4",children:e(C,{icon:"more",alt:g._({id:"2FYpfJ"}),size:"xl"})}),children:[e(ye,{disabled:T==="loading",onClick:()=>{A.reloadStatusPage++},children:[e(C,{icon:"refresh"}),e("span",{children:e(u,{id:"lCF0wC"})})]}),e(ye,{className:"menu-switch-view",onClick:()=>{m(l==="full"?null:"full"),s.delete("media"),s.delete("media-only"),l==="full"?s.delete("view"):s.set("view","full"),o(s)},children:[e(C,{icon:{"":"layout5",full:"layout4"}[l||""]}),e("span",{children:l==="full"?g._({id:"+/xYEI"}):g._({id:"2LiWsE"})})]}),e(ye,{onClick:()=>{Array.from($.current.querySelectorAll(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)")).forEach(E=>{E.click()})},children:[e(C,{icon:"eye-open"})," ",e("span",{children:e(u,{id:"8r8KmB"})})]}),e(Ve,{}),e(fs,{className:"plain",children:e(u,{id:"Rsjgm0"})}),e(ye,{disabled:!ie||Q,onClick:()=>{const D=Nr(z.url);D?location.hash=D:alert(g._({id:"9J6biQ"}))},children:[e(C,{icon:"transfer"}),e("small",{class:"menu-double-lines",children:ie?g._({id:"Kp9SAs",values:{0:Kt.toUnicode(ie)}}):g._({id:"lb07+k"})})]})]}),e(he,{class:"button plain deck-close",to:n,children:e(C,{icon:"x",size:"xl",alt:g._({id:"yz7wBu"})})})]})]})}),S.length&&z?e("ul",{class:`timeline flat contextual grow ${T==="loading"?"loading":""}`,children:[le,te>0&&e("li",{children:e("button",{type:"button",class:"plain block show-more",disabled:T==="loading",onClick:()=>Ie(D=>D+ln),style:{marginBlockEnd:"6em"},"data-state-post-ids":Te.join(" "),children:[e("div",{class:"ib avatars-bunch",children:S.slice(de,de+5).map(D=>e(lt,{url:D.account.avatarStatic},D.id))})," ",e("div",{class:"ib",children:[e(u,{id:"uXRAkV"})," ",e("span",{class:"tag",children:te>ln?`${ln}+`:te})]})]})})]}):e(B,{children:[T==="loading"&&e("ul",{class:"timeline flat contextual grow loading",children:e("li",{children:e(qe,{skeleton:!0,size:"l"})})}),T==="error"&&e("p",{class:"ui-state",children:[e(u,{id:"JWxodU"}),e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>{A.reloadStatusPage++},children:e(u,{id:"KDw4GX"})})]})]})]})}function Ks({replies:t,instance:n,hasParentThread:i,level:s,accWeight:o,openAll:a,parentLink:p}){const[r,c]=ht(),l=y=>y.reduce((S,k)=>{const{repliesCount:T,replies:I}=k,x=(I==null?void 0:I.length)||T;return S+x+l(I||[])},0),m=t.length+l(t),h=t.length===m,f=t.map(y=>y.account).filter((y,S,k)=>k.findIndex(T=>T.id===y.id)===S).slice(0,3),d=_e(()=>t==null?void 0:t.reduce((y,S)=>y+(S==null?void 0:S.weight),o),[o,t==null?void 0:t.length]);let v=!1;(a||d<=sl||!i&&m===1&&Qt(t[0])<2)&&(v=!0);const b=Kn[t[0].id],w=ot((y,S,k,T)=>{y.preventDefault(),y.stopPropagation(),c({media:S+1,mediaStatusID:T.id})},[]),_=q();return yt(()=>{var S;function y(k){k.target.dataset.scrollLeft=k.target.scrollLeft}return(S=_.current)==null||S.addEventListener("scroll",y,{passive:!0}),()=>{var k;(k=_.current)==null||k.removeEventListener("scroll",y)}},[]),e("details",{ref:_,class:"replies",open:b||v,onToggle:y=>{const{open:S}=y.target;Kn[t[0].id]=S},style:{"--comments-level":s},"data-comments-level":s,"data-comments-level-overflow":s>4,children:[e("summary",{class:"replies-summary",hidden:v,children:[e("span",{class:"avatars",children:f.map(y=>e(lt,{url:y.avatarStatic,title:`${y.displayName} @${y.username}`,squircle:y==null?void 0:y.bot},y.id))}),e("span",{class:"replies-counts",children:[e("b",{children:e(u,{id:"DOQUen",values:{0:t.length,1:Ge(t.length)},components:{0:e("span",{title:t.length})}})}),!h&&m>1&&e(B,{children:[" ","·"," ",e("span",{children:e(u,{id:"qSQQSe",values:{0:Ge(m),totalComments:m},components:{0:e("span",{title:m})}})})]})]}),e(C,{icon:"chevron-down",class:"replies-summary-chevron"}),!!p&&e(he,{class:"replies-parent-link",to:p.to,onClick:p.onClick,title:g._({id:"ZlV82A"}),children:"»"})]}),e("ul",{children:t.map(y=>{var S,k;return e("li",{children:[e("div",{class:"status-focus",tabIndex:0,children:[e(qe,{statusID:y.id,instance:n,withinContext:!0,size:"s",enableTranslate:!0,onMediaClick:w,showActionsBar:!0}),!((S=y.replies)!=null&&S.length)&&y.repliesCount>0&&e("div",{class:"replies-link",children:[e(C,{icon:"comment2",alt:g._({id:"N8UzTV"})})," ",e("span",{title:y.repliesCount,children:Ge(y.repliesCount)})]})]}),((k=y.replies)==null?void 0:k.length)&&e(Ks,{instance:n,replies:y.replies,level:s+1,accWeight:v?d:y.weight,openAll:a,parentLink:{to:n?`/${n}/s/${y.id}`:`/s/${y.id}`,onClick:()=>{mn(y.id)}}})]},y.id)})})]})}const rl=140,ll=35,dl=70,ul=140,Wn=new Map;function Qt(t){var d,v;const n=Wn.get(t.id);if(n)return n;const{spoilerText:i,content:s,mediaAttachments:o,poll:a,card:p}=t,r=hs(i+s),c=o!=null&&o.length?rl:0,l=(((d=a==null?void 0:a.options)==null?void 0:d.length)||0)*ll,m=p&&(o!=null&&o.length||(v=a==null?void 0:a.options)!=null&&v.length)?0:dl,f=(r+c+l+m)/ul;return Wn.set(t.id,f),f}const hl=it(ol);function fl(){const t=Mt(),{id:n,instance:i}=t;return e(hl,{id:n,instance:i})}const pl=""+new URL("boosts-carousel-YjmjXTE6.jpg",import.meta.url).href,ml=""+new URL("grouped-notifications-xYMFVY91.jpg",import.meta.url).href,gl=""+new URL("multi-column-ETnJNDVb.jpg",import.meta.url).href,bl=""+new URL("multi-hashtag-timeline-x-SDVR4g.jpg",import.meta.url).href,vl=""+new URL("nested-comments-thread-Ib-fZGS3.jpg",import.meta.url).href,yl="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",wl={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_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_DEFAULT_INSTANCE:Xt,PHANPY_WEBSITE:Wi,PHANPY_PRIVACY_POLICY_URL:_l,PHANPY_DEFAULT_INSTANCE_REGISTRATION_URL:Zi}=wl,Xi=Wi?Wi.replace(/https?:\/\//g,"").replace(/\/$/,""):null,Ji=`${"2024-10-15T12:51:15.104Z".slice(0,10).replace(/-/g,".")}.e3df9ff`;function Ws(){return We(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:ri,alt:"",width:"160",height:"160",style:{aspectRatio:"1/1",marginBlockEnd:-16}}),e("img",{src:yl,alt:"Phanpy",width:"200"})]}),e("p",{class:"desc",children:e(u,{id:"Ogtv0V"})}),e("p",{children:e(he,{to:Xt?`/login?instance=${Xt}&submit=1`:"/login",class:"button",children:Xt?g._({id:"sQia9P"}):g._({id:"ZLoGls"})})}),Xt&&Zi&&e("p",{children:e("a",{href:Zi,class:"button plain5",children:e(u,{id:"e+RpCP"})})}),!Xt&&e("p",{class:"insignificant",children:e("small",{children:e(u,{id:"fvAsUK",components:{0:e("br",{})}})})})]}),(Xi||Ji)&&e("p",{class:"app-site-version",children:e("small",{children:[Xi," ",Ji]})}),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:t=>{t.preventDefault(),A.showAccount="cheeaun@mastodon.social"}}),2:e("a",{href:_l,target:"_blank"})}})}),e("div",{children:e(li,{})})]}),e("div",{id:"why-container",children:e("div",{class:"sections",children:[e("section",{children:[e("img",{src:pl,alt:g._({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:vl,alt:g._({id:"CGQ27z"}),loading:"lazy"}),e("h4",{children:e(u,{id:"cYE45+"})}),e("p",{children:e(u,{id:"Pc7QKh"})})]}),e("section",{children:[e("img",{src:ml,alt:g._({id:"rnrM7k"}),loading:"lazy"}),e("h4",{children:e(u,{id:"4RRMre"})}),e("p",{children:e(u,{id:"8GMtDr"})})]}),e("section",{children:[e("img",{src:gl,alt:g._({id:"VLKtvP"}),loading:"lazy"}),e("h4",{children:e(u,{id:"pEkad9"})}),e("p",{children:e(u,{id:"t7Py5R"})})]}),e("section",{children:[e("img",{src:bl,alt:g._({id:"wOax6E"}),loading:"lazy"}),e("h4",{children:e(u,{id:"Wi1Ov0"})}),e("p",{children:e(u,{id:"tS2i+h"})})]})]})})]})}const kl=window.alert;window.__nativeAlert||(window.__nativeAlert=kl);window.alert=function(t){t instanceof Error&&(t!=null&&t.message)&&(t=t.message),typeof t!="string"&&(t=JSON.stringify(t));const n=No({text:t,className:"alert",gravity:"top",position:"center",duration:1e4,offset:{y:48},onClick:()=>{n.hideToast()}});n.showToast()};window.__STATES__=A;window.__STATES_STATS__=()=>{const t=["statuses","accounts","spoilers","unfurledLinks","statusQuotes"],n={};t.forEach(o=>{n[o]=Object.keys(A[o]).length});const{statuses:i}=A,s=[];for(const o in i)document.querySelector(`[data-state-post-id~="${o}"], [data-state-post-ids~="${o}"]`)||s.push(o)};setInterval(()=>{if(!window.__IDLE__)return;const{statuses:t,unfurledLinks:n,notifications:i}=A;let s=0;const{instance:o}=oe();for(const a in t){if(!window.__IDLE__)break;try{const p=document.querySelector(`[data-state-post-id~="${a}"], [data-state-post-ids~="${a}"]`),r=i.some(c=>{var l;return a===nt((l=c.status)==null?void 0:l.id,o)});if(!p&&!r){delete A.statuses[a],delete A.statusQuotes[a];for(const c in n){const l=n[c];if(nt(l.id,l.instance)===a){delete A.unfurledLinks[c];break}}s++}}catch{}}},15*60*1e3);setTimeout(()=>{for(const t in Ot)setTimeout(()=>{var n,i,s,o,a,p;Array.isArray(Ot[t])?(i=(n=Ot[t])[0])==null||i.call(n):typeof Ot[t]=="object"?(o=(s=Ot[t]).module)==null||o.call(s):(p=(a=Ot)[t])==null||p.call(a)},1)},5e3);(()=>{window.__IDLE__=!0;const t=["mousemove","mousedown","resize","keydown","touchstart","pointerdown","pointermove","wheel"],n=()=>{window.__IDLE__=!0},s=ps(n,3e3),o=()=>{window.__IDLE__=!1,s()};t.forEach(a=>{window.addEventListener(a,o,{passive:!0,capture:!0})}),window.addEventListener("blur",n,{passive:!0}),document.documentElement.addEventListener("mouseleave",a=>{!a.relatedTarget&&!a.toElement&&n()},{passive:!0})})();const Sl=/iPad|iPhone|iPod/.test(navigator.userAgent);Sl&&document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible"){const t=me.local.get("theme");let n;if(t){if(n=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),n){const i=n.content,s=t==="light"?n.dataset.themeLightColorTemp:n.dataset.themeDarkColorTemp;n.content=s||"",setTimeout(()=>{n.content=i},10)}}else{const i=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(n=document.querySelector(`meta[name="theme-color"][media*="${i}"]`),n){const s=n.dataset.content,o=n.dataset.contentTemp;n.content=o||"",setTimeout(()=>{n.content=s},10)}}}});{const t=me.local.get("theme");if(t){document.documentElement.classList.add(`is-${t}`),document.querySelector('meta[name="color-scheme"]').setAttribute("content",t||"dark light");const i=document.querySelector('meta[data-theme-setting="manual"]');i&&(i.name="theme-color",i.content=t==="light"?i.dataset.themeLightColor:i.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(o=>{o.name=""})}const n=me.local.get("textSize");n&&document.documentElement.style.setProperty("--text-size",`${n}px`)}ts(A,t=>{var n;for(const[i,s,o,a]of t){if(s.join(".")==="settings.shortcutsViewMode"){const p=document.getElementById("app");p&&(p.dataset.shortcutsViewMode=(n=A.shortcuts)!=null&&n.length?o:"")}s.join(".")==="settings.cloakMode"&&document.body.classList.toggle("cloak",o)}});const dn=new Map;window.__BENCH_RESULTS=new Map;window.__BENCHMARK={start(t){},end(t){}};function Cl(){const[t,n]=L(!1),[i,s]=L("loading");__BENCHMARK.start("app-init"),__BENCHMARK.start("time-to-following"),__BENCHMARK.start("time-to-home"),__BENCHMARK.start("time-to-isLoggedIn"),Je(),ee(()=>{const a=me.local.get("instanceURL"),p=decodeURIComponent((window.location.search.match(/code=([^&]+)/)||[,""])[1]);if(p){window.history.replaceState({},document.title,window.location.pathname||"/");const r=me.sessionCookie.get("clientID"),c=me.sessionCookie.get("clientSecret"),l=me.sessionCookie.get("vapidKey"),m=me.sessionCookie.get("codeVerifier");(async()=>{s("loading");const{access_token:h}=await Jr({instanceURL:a,client_id:r,client_secret:c,code:p,code_verifier:m||void 0});if(h){const f=uo({instance:a,accessToken:h});await Promise.allSettled([Rn(f),Ln(f,a),ho(f,a,h,l)]),yi(),window.__IGNORE_GET_ACCOUNT_ERROR__=!0,n(!0),s("default")}else s("error");__BENCHMARK.end("app-init")})()}else{window.__IGNORE_GET_ACCOUNT_ERROR__=!0;const r=decodeURIComponent((window.location.search.match(/account=([^&]+)/)||[,""])[1]);let c;if(r&&(c=fo(r),c&&(gn(c.info.id),window.history.replaceState({},document.title,window.location.pathname||"/"))),c||(c=Zn()),c){gn(c.info.id);const{client:l}=oe({account:c}),{instance:m}=l;yi(),s("loading"),(async()=>{try{po()&&mo(m)?(Rn(l),Ln(l,m)):await Promise.allSettled([Rn(l),Ln(l,m)])}catch{}finally{n(!0),s("default"),__BENCHMARK.end("app-init")}})()}else s("default"),__BENCHMARK.end("app-init")}me.sessionCookie.del("clientID"),me.sessionCookie.del("clientSecret"),me.sessionCookie.del("codeVerifier")},[]);let o=Vt();return A.currentLocation=o.pathname,ee(Yn,[o,t]),/\/https?:/.test(o.pathname)?e(Pr,{}):i==="loading"?e(Ne,{id:"loader-root"}):e(B,{children:[e(Tl,{isLoggedIn:t}),e(xl,{isLoggedIn:t}),e(Jn,{children:e(je,{path:"/:instance?/s/:id",element:e(fl,{})})}),t&&e(Uo,{}),t&&e(ua,{}),e(sa,{}),t&&e(ra,{}),e(zo,{isLoggedIn:t}),e(la,{onClose:Yn}),e(Fo,{})]})}function Il({isLoggedIn:t}){return t&&__BENCHMARK.end("time-to-isLoggedIn"),t?e(Mr,{}):e(Ws,{})}const Tl=it(({isLoggedIn:t})=>{const n=Vt(),i=_e(()=>{const{pathname:s}=n;return!/^\/(login|welcome)/i.test(s)},[n]);return e(Jn,{location:i||n,children:[e(je,{path:"/",element:e(Il,{isLoggedIn:t})}),e(je,{path:"/login",element:e(tl,{})}),e(je,{path:"/welcome",element:e(Ws,{})})]})});function Qi(){return A.prevLocation||null}function xl({isLoggedIn:t}){const n=Vt(),i=q(Qi());return _e(()=>en("/:instance/s/:id",n.pathname)||en("/s/:id",n.pathname),[n.pathname,en])?i.current||(i.current=Qi()):i.current=null,e(Jn,{location:i.current||n,children:[t&&e(B,{children:[e(je,{path:"/notifications",element:e(Hs,{})}),e(je,{path:"/mentions",element:e(zs,{})}),e(je,{path:"/following",element:e(gi,{})}),e(je,{path:"/b",element:e(Ls,{})}),e(je,{path:"/f",element:e($s,{})}),e(je,{path:"/l",children:[e(je,{index:!0,element:e(Or,{})}),e(je,{path:":id",element:e(Ns,{})})]}),e(je,{path:"/fh",element:e(Ja,{})}),e(je,{path:"/ft",element:e(Ka,{})}),e(je,{path:"/catchup",element:e(Pa,{})})]}),e(je,{path:"/:instance?/t/:hashtag",element:e(Ds,{})}),e(je,{path:"/:instance?/a/:id",element:e(xa,{})}),e(je,{path:"/:instance?/p",children:[e(je,{index:!0,element:e(Gn,{})}),e(je,{path:"l",element:e(Gn,{local:!0})})]}),e(je,{path:"/:instance?/trending",element:e(js,{})}),e(je,{path:"/:instance?/search",element:e(qs,{})})]})}go();yo(e(bo,{i18n:g,children:e(vo,{children:e(Cl,{})})}),document.getElementById("app"));setTimeout(()=>{try{Object.keys(localStorage).forEach(t=>{t.startsWith("iconify")&&localStorage.removeItem(t)}),Object.keys(sessionStorage).forEach(t=>{t.startsWith("iconify")&&sessionStorage.removeItem(t)}),localStorage.removeItem("settings:boostsCarousel")}catch{}},5e3);if("serviceWorker"in navigator&&typeof caches<"u"){const n=["icons"];let i=!1;const s=1e4,o=60*60*1e3;async function a(){if(window.__IDLE__)try{const p=await caches.keys();for(const r of p){if(n.includes(r))continue;const c=await caches.open(r),l=await c.keys();if(l.length>50){const m=l.slice(50);for(const h of m)await c.delete(h)}}i=!0}catch{}setTimeout(a,i?o:s)}setTimeout(a,s)}window.__CLOAK__=()=>{document.body.classList.toggle("cloak")};
//# sourceMappingURL=main-e75P80UH.js.map