35 lines
291 KiB
JavaScript
35 lines
291 KiB
JavaScript
import{A as Y,y as ie,h as R,s as A,a as ae,b as We,i as b,C as st,u as qe,c as e,T as d,d as ve,g as wt,p as Mt,e as vn,f as O,j as Qe,k as Mn,L as ao,l as Ce,D as ro,m as lo,o as Yn,q as Gt,r as _t,t as ct,v as uo,w as Oe,x as wn,z as Si,_ as gt,B as as,E as id,F as rs,G as ls,H as ho,I as fo,J as it,K as po,M as ti,N as pt,O as mo,P as go,Q as bo,R as ni,S as xt,U as Xe,V as ds,W as us,X as yo,Y as tn,Z as vo,$ as wo,a0 as Dn,a1 as Nn,a2 as ko,a3 as Ci,a4 as _o,a5 as So,a6 as Co,a7 as ii,a8 as je,a9 as Io,aa as To,ab as xo,ac as Ao}from"./useTitle-6CgMxXiB.js";import{u as si,s as he,a as Ue,o as Ii,b as Eo,I as C,M as Fe,A as dt,N as ht,c as at,d as Se,e as Be,f as Ge,g as lt,L as fe,l as It,h as hs,t as Ti,i as Ze,R as Kt,p as od,j as tt,k as Dt,m as rt,n as fs,q as jn,E as ps,r as Ke,v as ft,w as Ro,S as xn,x as xi,T as ms,y as ut,z as oi,B as Ye,C as kt,D as Lo,F as $o,G as Rt,H as ci,J as gs,K as Mo,O as Ht,P as Do,Q as No,U as bs,V as Po,W as Oo,X as ys,Y as zo,Z as Lt,_ as ai,$ as Uo,a0 as vs,a1 as Bo,a2 as ws,a3 as Fo,a4 as Ho,a5 as qo,a6 as Ai,a7 as Yo,a8 as zt}from"./fuse-3cGZwVM1.js";var ks=jo;function jo(t,n,i){var s=null,o=null,a=function(){s&&(clearTimeout(s),o=null,s=null)},h=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 f=o;return o=null,f()}},n),m)return o()};return r.cancel=a,r.flush=h,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(u,y){y=y||{bubbles:!1,cancelable:!1,detail:void 0};var g=n.createEvent("CustomEvent");return g.initCustomEvent(u,y.bubbles,y.cancelable,y.detail),g},t.CustomEvent.prototype=t.Event.prototype),n.addEventListener("touchstart",m,!1),n.addEventListener("touchmove",f,!1),n.addEventListener("touchend",l,!1);var i=null,s=null,o=null,a=null,h=null,r=null,c=0;function l(u){if(r===u.target){var y=parseInt(p(r,"data-swipe-threshold","20"),10),g=p(r,"data-swipe-unit","px"),w=parseInt(p(r,"data-swipe-timeout","500"),10),v=Date.now()-h,k="",x=u.changedTouches||u.touches||[];if(g==="vh"&&(y=Math.round(y/100*n.documentElement.clientHeight)),g==="vw"&&(y=Math.round(y/100*n.documentElement.clientWidth)),Math.abs(o)>Math.abs(a)?Math.abs(o)>y&&v<w&&(o>0?k="swiped-left":k="swiped-right"):Math.abs(a)>y&&v<w&&(a>0?k="swiped-up":k="swiped-down"),k!==""){var S={dir:k.replace(/swiped-/,""),touchType:(x[0]||{}).touchType||"direct",fingers:c,xStart:parseInt(i,10),xEnd:parseInt((x[0]||{}).clientX||-1,10),yStart:parseInt(s,10),yEnd:parseInt((x[0]||{}).clientY||-1,10)};r.dispatchEvent(new CustomEvent("swiped",{bubbles:!0,cancelable:!0,detail:S})),r.dispatchEvent(new CustomEvent(k,{bubbles:!0,cancelable:!0,detail:S}))}i=null,s=null,h=null}}function m(u){u.target.getAttribute("data-swipe-ignore")!=="true"&&(r=u.target,h=Date.now(),i=u.touches[0].clientX,s=u.touches[0].clientY,o=0,a=0,c=u.touches.length)}function f(u){if(!(!i||!s)){var y=u.touches[0].clientX,g=u.touches[0].clientY;o=i-y,a=s-g}}function p(u,y,g){for(;u&&u!==n.documentElement;){var w=u.getAttribute(y);if(w)return w;u=u.parentNode}return g}})(window,document);function qt(t=()=>{},n=[]){const i=Y(t);ie(()=>{i.current=t},[n]),ie(()=>{const s=()=>{const o=document.hidden||document.visibilityState==="hidden";i.current(!o)};return document.addEventListener("visibilitychange",s),()=>document.removeEventListener("visibilitychange",s)},[])}const Vo=1e3*3,Ei=2e4,Go=st(function({isLoggedIn:n}){const[i,s]=R(!0),o=Y();qt(c=>{clearTimeout(o.current),c?s(!0):o.current=setTimeout(()=>{s(!1)},Ei)});const a=async(c,l,m)=>{var f;if(A.notificationsLast){const p=c.v1.notifications.list({limit:1,sinceId:A.notificationsLast.id}),{value:u}=await p.next();if(u!=null&&u.length)if(m)A.notificationsShowNew=!0;else{let y;try{const g=await c.v1.markers.fetch({timeline:"notifications"});y=(f=g==null?void 0:g.notifications)==null?void 0:f.lastReadId}catch{}y?A.notificationsShowNew=u[0].id!==y:A.notificationsShowNew=!0}}};ie(()=>{let c,l,m;if(n&&i){const{masto:f,streaming:p,instance:u}=ae();(async()=>{await a(f,u);let y=!1;p&&(l=setTimeout(()=>{(async()=>{try{y=!0,c=p.user.notification.subscribe();for await(const g of c){if(!c||!i)break;g.event==="notification"&&We(g.payload,u,{skipThreading:!0}),A.notificationsShowNew=!0}}catch{y=!1}y||(m=setInterval(()=>{a(f,u,!0)},Ei))})()},Vo))})()}return()=>{var f;(f=c==null?void 0:c.unsubscribe)==null||f.call(c),c=null,clearTimeout(l),clearInterval(m)}},[i,n]);const h=Y(),r=()=>{h.current=Date.now(),fetch("./version.json").then(c=>c.json()).then(c=>{c&&(A.appVersion=c)}).catch(c=>{})};return si(r,i&&1e3*60*30),qt(c=>{c&&(h.current?Date.now()-h.current>1e3*60*60&&r():r())}),Ue("shift+alt+k",()=>{const c=A.settings.cloakMode;A.settings.cloakMode=!c,he({text:c?b._({id:"oguMwa"}):b._({id:"IXZLPs"})})}),null});function Ko(){const t=qe(A);function n(i){if(t.composerState.minimized){A.composerState.minimized=!1,Ii();return}i.shiftKey?Eo()||(A.showCompose=!0):(Ii(),A.showCompose=!0)}return Ue("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:b._({id:"QOhkyl"})})})}const Wo=st(function(){const n=qe(A);function i(){A.showKeyboardShortcutsHelp=!1}return Ue("?, 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:b._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(d,{id:"77Emn0"})})}),e("main",{children:e("table",{children:e("tbody",{children:[{action:b._({id:"ulXSNi"}),keys:e("kbd",{children:"?"})},{action:b._({id:"Gy9P9T"}),keys:e("kbd",{children:"j"})},{action:b._({id:"6XYpYY"}),keys:e("kbd",{children:"k"})},{action:b._({id:"DYowFe"}),keys:e(d,{id:"mzjGX4",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:b._({id:"S5ez7Y"}),keys:e(d,{id:"Fd8FaU",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:b._({id:"VkLESX"}),keys:e("kbd",{children:"."})},{action:b._({id:"jsFF8C"}),keys:e(d,{id:"80sOCm",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:e(d,{id:"41gejM",components:{0:e("br",{})}}),keys:e("kbd",{children:"x"})},{action:b._({id:"jAj8rv"}),keys:e(d,{id:"evz6c6",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:b._({id:"duF1lx"}),keys:e(d,{id:"nhpsIN",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:b._({id:"YrR3Co"}),keys:e("kbd",{children:"]"})},{action:b._({id:"noxAFR"}),keys:e("kbd",{children:"["})},{action:b._({id:"AIa/f7"}),keys:e("kbd",{children:"c"})},{action:b._({id:"snPx8X"}),className:"insignificant",keys:e(d,{id:"+Cxvld",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:b._({id:"1pKapz"}),keys:e(d,{id:"py67WT",components:{0:e("kbd",{}),1:e("kbd",{}),2:e("kbd",{}),3:e("kbd",{})}})},{action:b._({id:"A1taO8"}),keys:e("kbd",{children:"/"})},{action:b._({id:"ImOQa9"}),keys:e("kbd",{children:"r"})},{action:b._({id:"KFs8c6"}),className:"insignificant",keys:e(d,{id:"XpQLJF",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:b._({id:"cqi4Mx"}),keys:e(d,{id:"84WuL2",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:b._({id:"kulphB"}),keys:e(d,{id:"yrz6Ck",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:b._({id:"PZlHt8"}),keys:e("kbd",{children:"d"})},{action:b._({id:"C7ujRh"}),keys:e(d,{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))})})})]})})}),_s=new Set,nt=new WeakMap,Yt=new WeakMap,$t=new WeakMap,Vn=new WeakMap,Zo=new WeakMap,jt=new WeakMap,kn=new WeakMap,Qt=new WeakSet;let Tt,ri=0,li=0;const yt="__aa_tgt",nn="__aa_del",_n="__aa_new",Xo=t=>{const n=ic(t);n&&n.forEach(i=>sc(i))},Jo=t=>{t.forEach(n=>{n.target===Tt&&ec(),nt.has(n.target)&&Nt(n.target)})};function Qo(t){const n=Vn.get(t);n==null||n.disconnect();let i=nt.get(t),s=0;const o=5;i||(i=Vt(t),nt.set(t,i));const{offsetWidth:a,offsetHeight:h}=Tt,c=[i.top-o,a-(i.left+o+i.width),h-(i.top+o+i.height),i.left-o].map(m=>`${-1*Math.floor(m)}px`).join(" "),l=new IntersectionObserver(()=>{++s>1&&Nt(t)},{root:Tt,threshold:1,rootMargin:c});l.observe(t),Vn.set(t,l)}function Nt(t){clearTimeout(kn.get(t));const n=An(t),i=sn(n)?500:n.duration;kn.set(t,setTimeout(async()=>{const s=$t.get(t);try{await(s==null?void 0:s.finished),nt.set(t,Vt(t)),Qo(t)}catch{}},i))}function ec(){clearTimeout(kn.get(Tt)),kn.set(Tt,setTimeout(()=>{_s.forEach(t=>Ts(t,n=>Ss(()=>Nt(n))))},100))}function tc(t){setTimeout(()=>{Zo.set(t,setInterval(()=>Ss(Nt.bind(null,t)),2e3))},Math.round(2e3*Math.random()))}function Ss(t){typeof requestIdleCallback=="function"?requestIdleCallback(()=>t()):requestAnimationFrame(()=>t())}let Gn,Ft;const nc=typeof window<"u"&&"ResizeObserver"in window;nc&&(Tt=document.documentElement,Gn=new MutationObserver(Xo),Ft=new ResizeObserver(Jo),window.addEventListener("scroll",()=>{li=window.scrollY,ri=window.scrollX}),Ft.observe(Tt));function ic(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(Pn(o.target),!s.has(o.target)){s.add(o.target);for(let a=0;a<o.target.children.length;a++){const h=o.target.children.item(a);if(h){if(nn in h)return!1;Pn(o.target,h),s.add(h)}}}if(o.removedNodes.length)for(let a=0;a<o.removedNodes.length;a++){const h=o.removedNodes[a];if(nn in h)return!1;h instanceof Element&&(s.add(h),Pn(o.target,h),Yt.set(h,[o.previousSibling,o.nextSibling]))}}return s},new Set)}function Pn(t,n){!n&&!(yt in t)?Object.defineProperty(t,yt,{value:t}):n&&!(yt in n)&&Object.defineProperty(n,yt,{value:t})}function sc(t){var n;const i=t.isConnected,s=nt.has(t);i&&Yt.has(t)&&Yt.delete(t),$t.has(t)&&((n=$t.get(t))===null||n===void 0||n.cancel()),_n in t?Ri(t):s&&i?cc(t):s&&!i?ac(t):Ri(t)}function mt(t){return Number(t.replace(/[^0-9.\-]/g,""))}function oc(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 Vt(t){const n=t.getBoundingClientRect(),{x:i,y:s}=oc(t);return{top:n.top+s,left:n.left+i,width:n.width,height:n.height}}function Cs(t,n,i){let s=n.width,o=n.height,a=i.width,h=i.height;const r=getComputedStyle(t);if(r.getPropertyValue("box-sizing")==="content-box"){const l=mt(r.paddingTop)+mt(r.paddingBottom)+mt(r.borderTopWidth)+mt(r.borderBottomWidth),m=mt(r.paddingLeft)+mt(r.paddingRight)+mt(r.borderRightWidth)+mt(r.borderLeftWidth);s-=m,a-=m,o-=l,h-=l}return[s,a,o,h].map(Math.round)}function An(t){return yt in t&&jt.has(t[yt])?jt.get(t[yt]):{duration:250,easing:"ease-in-out"}}function Is(t){if(yt in t)return t[yt]}function di(t){const n=Is(t);return n?Qt.has(n):!1}function Ts(t,...n){n.forEach(i=>i(t,jt.has(t)));for(let i=0;i<t.children.length;i++){const s=t.children.item(i);s&&n.forEach(o=>o(s,jt.has(s)))}}function ui(t){return Array.isArray(t)?t:[t]}function sn(t){return typeof t=="function"}function cc(t){const n=nt.get(t),i=Vt(t);if(!di(t))return nt.set(t,i);let s;if(!n)return;const o=An(t);if(typeof o!="function"){const a=n.left-i.left,h=n.top-i.top,[r,c,l,m]=Cs(t,n,i),f={transform:`translate(${a}px, ${h}px)`},p={transform:"translate(0, 0)"};r!==c&&(f.width=`${r}px`,p.width=`${c}px`),l!==m&&(f.height=`${l}px`,p.height=`${m}px`),s=t.animate([f,p],{duration:o.duration,easing:o.easing})}else{const[a]=ui(o(t,"remain",n,i));s=new Animation(a),s.play()}$t.set(t,s),nt.set(t,i),s.addEventListener("finish",Nt.bind(null,t))}function Ri(t){_n in t&&delete t[_n];const n=Vt(t);nt.set(t,n);const i=An(t);if(!di(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]=ui(i(t,"add",n));s=new Animation(o),s.play()}$t.set(t,s),s.addEventListener("finish",Nt.bind(null,t))}function Li(t,n){var i;t.remove(),nt.delete(t),Yt.delete(t),$t.delete(t),(i=Vn.get(t))===null||i===void 0||i.disconnect(),setTimeout(()=>{if(nn in t&&delete t[nn],Object.defineProperty(t,_n,{value:!0,configurable:!0}),n&&t instanceof HTMLElement)for(const s in n)t.style[s]=""},0)}function ac(t){var n;if(!Yt.has(t)||!nt.has(t))return;const[i,s]=Yt.get(t);Object.defineProperty(t,nn,{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=Is(t))===null||n===void 0||n.appendChild(t),!di(t))return Li(t);const[h,r,c,l]=lc(t),m=An(t),f=nt.get(t);(o!==ri||a!==li)&&rc(t,o,a,m);let p,u={position:"absolute",top:`${h}px`,left:`${r}px`,width:`${c}px`,height:`${l}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!sn(m))Object.assign(t.style,u),p=t.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:m.duration,easing:"ease-out"});else{const[y,g]=ui(m(t,"remove",f));(g==null?void 0:g.styleReset)!==!1&&(u=(g==null?void 0:g.styleReset)||u,Object.assign(t.style,u)),p=new Animation(y),p.play()}$t.set(t,p),p.addEventListener("finish",Li.bind(null,t,u))}function rc(t,n,i,s){const o=ri-n,a=li-i,h=document.documentElement.style.scrollBehavior;if(getComputedStyle(Tt).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 f=performance.now();function p(){requestAnimationFrame(()=>{if(!sn(s)){const u=l-c.clientHeight,y=m-c.clientWidth;f+s.duration>performance.now()?(window.scrollTo({left:window.scrollX-y,top:window.scrollY-u}),l=c.clientHeight,m=c.clientWidth,p()):document.documentElement.style.scrollBehavior=h}})}p()}function lc(t){const n=nt.get(t),[i,,s]=Cs(t,n,Vt(t));let o=t.parentElement;for(;o&&(getComputedStyle(o).position==="static"||o instanceof HTMLBodyElement);)o=o.parentElement;o||(o=document.body);const a=getComputedStyle(o),h=nt.get(o)||Vt(o),r=Math.round(n.top-h.top)-mt(a.borderTopWidth),c=Math.round(n.left-h.left)-mt(a.borderLeftWidth);return[r,c,i,s]}function xs(t,n={}){return Gn&&Ft&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!sn(n)&&!n.disrespectUserMotionPreference||(Qt.add(t),getComputedStyle(t).position==="static"&&Object.assign(t.style,{position:"relative"}),Ts(t,Nt,tc,o=>Ft==null?void 0:Ft.observe(o)),sn(n)?jt.set(t,n):jt.set(t,{duration:250,easing:"ease-in-out",...n}),Gn.observe(t,{childList:!0}),_s.add(t))),Object.freeze({parent:t,enable:()=>{Qt.add(t)},disable:()=>{Qt.delete(t)},isEnabled:()=>Qt.has(t)})}function hi(t){const n=Y(null),[i,s]=R(),o=a=>{i&&(a?i.enable():i.disable())};return ie(()=>{n.current instanceof HTMLElement&&s(xs(n.current,t||{}))},[]),[n,o]}const dc=window.matchMedia("(display-mode: standalone)").matches;function uc({onClose:t}){const{masto:n}=ae(),i=ve.local.getJSON("accounts"),s=wt(),o=i.length>1,[a,h]=Mt(c=>c+1,0),[r]=hi();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:b._({id:"yz7wBu"})})}),e("header",{class:"header-grid",children:e("h2",{children:e(d,{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,f=l===0;return e("li",{children:[e("div",{children:[o&&e("span",{class:`current ${m?"is-current":""}`,children:e(C,{icon:"check-circle",alt:b._({id:"Hp1l6f"})})}),e(dt,{url:c.info.avatarStatic,size:"xxl",onDblClick:async()=>{if(m)try{const p=await n.v1.accounts.$select(c.info.id).fetch();c.info=p,ve.local.setJSON("accounts",i),h()}catch{}}}),e(ht,{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}`:(vn(c.info.id),location.reload())}})]}),e("div",{class:"actions",children:[f&&o&&e(O,{children:[e("span",{class:"tag",children:e(d,{id:"ovBPCi"})})," "]}),e(at,{align:"end",menuButton:e("button",{type:"button",class:"plain more-button",children:e(C,{icon:"more",size:"l",alt:b._({id:"2FYpfJ"})})}),children:[o&&e(O,{children:[e(Se,{disabled:m,onClick:()=>{vn(c.info.id),location.reload()},children:[e(C,{icon:"transfer"})," ",e(d,{id:"3t/Nrv"})]}),!dc&&!m&&e(Be,{href:`./?account=${c.info.id}`,target:"_blank",children:[e(C,{icon:"external"}),e("span",{children:e(d,{id:"PZgZtY"})})]}),e(Ge,{})]}),e(Se,{onClick:()=>{A.showAccount=`${c.info.username}@${c.instanceURL}`},children:[e(C,{icon:"user"}),e("span",{children:e(d,{id:"40z2Fm"})})]}),e(Ge,{}),o&&e(Se,{disabled:f,onClick:()=>{i.splice(l,1),i.unshift(c),ve.local.setJSON("accounts",i),h()},children:[e(C,{icon:"check-circle"}),e("span",{children:e(d,{id:"PPcets"})})]}),e(lt,{subMenu:!0,confirmLabel:e(O,{children:[e(C,{icon:"exit"}),e("span",{children:e(d,{id:"k08LxG",values:{0:c.info.acct},components:{0:e("span",{class:"bidi-isolate"})}})})]}),disabled:!m,menuItemClassName:"danger",onClick:()=>{i.splice(l,1),ve.local.setJSON("accounts",i),location.href=location.pathname||"/"},children:[e(C,{icon:"exit"}),e("span",{children:e(d,{id:"CXk1bI"})})]})]})]})]},c.info.id)})}),e("p",{children:e(fe,{to:"/login",class:"button plain2",onClick:t,children:[e(C,{icon:"plus"})," ",e("span",{children:e(d,{id:"Is7/PB"})})]})}),o&&e("p",{children:e("small",{children:e(d,{id:"52x24e",components:{0:e("i",{})}})})})]})})]})}const fi="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",hc={"zh-CN":"zh-Hans","zh-TW":"zh-Hant","pt-BR":"pt-BR"};function pi(){const{i18n:t}=Qe(),n=Ce(()=>ao.map(i=>{var h,r;const s=hc[i]||i.replace(/-[a-z]+$/i,""),o=It({code:s,locale:i,fallback:(h=Mn.find(c=>c.code===i))==null?void 0:h.nativeName}),a=It({code:s,locale:t.locale,fallback:(r=Mn.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||ro,onChange:i=>{ve.local.set("lang",i.target.value),lo(i.target.value)},children:[n.map(({code:i,regionlessCode:s,native:o})=>{var r;const a=It({code:s,locale:t.locale,fallback:(r=Mn.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 $i(t){const{masto:n}=ae();return n.v1.push.subscription.create(t)}function fc(){const{masto:t}=ae();return t.v1.push.subscription.fetch()}function pc(t){const{masto:n}=ae();return n.v1.push.subscription.update(t)}function mc(){const{masto:t}=ae();return t.v1.push.subscription.remove()}function En(){return"serviceWorker"in navigator&&"PushManager"in window}function gc(){return navigator.serviceWorker.getRegistration()}async function mi(){const t=await gc(),n=t?await t.pushManager.getSubscription():void 0;return{registration:t,subscription:n}}function As(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 bc(){if(!En())return;const{subscription:t}=await mi();let n=null;try{n=await fc()}catch(i){if(!/(not found|unknown)/i.test(i.message))throw i}if(n&&t){const i=n.endpoint===t.endpoint,s=Yn(),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=Yn();if(i){const{applicationServerKey:s}=t.options,o=As(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 Mi({data:t,policy:n}){if(!En())return;let{registration:i,subscription:s}=await mi(),o=null;if(s)try{o=await pc({data:t,policy:n})}catch{o=await $i({subscription:s,data:t,policy:n})}else{const a=Yn();if(!a)throw new Error("No server key found");s=await i.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:As(a)}),o=await $i({subscription:s,data:t,policy:n})}return{subscription:s,backendSubscription:o}}async function Di(){if(!En())return;const{subscription:t}=await mi();t&&(await mc(),await t.unsubscribe())}const yc={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"},Ni=16,Et=[14,15,16,17,18,19,20],{PHANPY_WEBSITE:Pi,PHANPY_PRIVACY_POLICY_URL:vc,PHANPY_IMG_ALT_API_URL:wc,PHANPY_GIPHY_API_KEY:kc}=yc;function _c({onClose:t}){const n=qe(A),i=ve.local.get("theme")||"auto",s=Y(),o=n.settings.contentTranslationTargetLanguage||null,a=hs(),h=It(a),r=ve.local.get("textSize")||Ni,[c,l]=R(ve.account.get("preferences")||{}),{masto:m,authenticated:f,instance:p}=ae();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:b._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(d,{id:"Tz0i8g"})})}),e("main",{children:[e("section",{children:e("ul",{children:[e("li",{children:[e("div",{children:e("label",{children:e(d,{id:"aAIQg2"})})}),e("div",{children:e("form",{ref:s,onInput:u=>{u.preventDefault();const g=new FormData(s.current).get("theme"),w=document.documentElement;if(g==="auto"){w.classList.remove("is-light","is-dark");const v=document.querySelector('meta[data-theme-setting="manual"]');v&&(v.name=""),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(x=>{x.name="theme-color"})}else{w.classList.toggle("is-light",g==="light"),w.classList.toggle("is-dark",g==="dark");const v=document.querySelector('meta[data-theme-setting="manual"]');v&&(v.name="theme-color",v.content=g==="light"?v.dataset.themeLightColor:v.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(x=>{x.name=""})}document.querySelector('meta[name="color-scheme"]').setAttribute("content",g==="auto"?"dark light":g),g==="auto"?ve.local.del("theme"):ve.local.set("theme",g)},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(d,{id:"1njn7W"})})]}),e("label",{children:[e("input",{type:"radio",name:"theme",value:"dark",defaultChecked:i==="dark"}),e("span",{children:e(d,{id:"pvnfJD"})})]}),e("label",{children:[e("input",{type:"radio",name:"theme",value:"auto",defaultChecked:i!=="light"&&i!=="dark"}),e("span",{children:e(d,{id:"R9Khdg"})})]})]})})})]}),e("li",{children:[e("div",{children:e("label",{children:e(d,{id:"7r6sCa"})})}),e("div",{class:"range-group",children:[e("span",{style:{fontSize:Et[0]},children:e(d,{id:"J6ypuD"})})," ",e("input",{type:"range",min:Et[0],max:Et[Et.length-1],step:"1",value:r,list:"sizes",onChange:u=>{const y=parseInt(u.target.value,10);document.documentElement.style.setProperty("--text-size",`${y}px`),y===Ni?ve.local.del("textSize"):ve.local.set("textSize",u.target.value)}})," ",e("span",{style:{fontSize:Et[Et.length-1]},children:e(d,{id:"J6ypuD"})}),e("datalist",{id:"sizes",children:Et.map(u=>e("option",{value:u}))})]})]}),e("li",{children:[e("span",{children:[e("label",{children:e(d,{id:"CeJHfb"})}),e("br",{}),e("small",{children:e("a",{href:"https://crowdin.com/project/phanpy",target:"_blank",rel:"noopener noreferrer",children:e(d,{id:"FFmj1D"})})})]}),e(pi,{})]})]})}),f&&e(O,{children:[e("h3",{children:e(d,{id:"PcoS3v"})}),e("section",{children:e("ul",{children:e("li",{children:[e("div",{children:e("label",{for:"posting-privacy-field",children:[e(d,{id:"NAjVvt"})," ",e(C,{icon:"cloud",alt:b._({id:"N2FcBE"}),class:"synced-icon"})]})}),e("div",{children:e("select",{id:"posting-privacy-field",value:c["posting:default:visibility"]||"public",onChange:u=>{const{value:y}=u.target;(async()=>{try{await m.v1.accounts.updateCredentials({source:{privacy:y}}),l({...c,"posting:default:visibility":y}),ve.account.set("preferences",{...c,"posting:default:visibility":y})}catch{alert(b._({id:"Oa+KBY"}))}})()},children:[e("option",{value:"public",children:e(d,{id:"7d1a0d"})}),e("option",{value:"unlisted",children:e(d,{id:"WDcQq9"})}),e("option",{value:"private",children:e(d,{id:"o34OrG"})})]})})]})})}),e("p",{class:"section-postnote",children:[e(C,{icon:"cloud",alt:b._({id:"N2FcBE"}),class:"synced-icon"})," ",e("small",{children:e(d,{id:"xlsg7n",values:{instance:p},components:{0:e("a",{href:`https://${p}/`,target:"_blank",rel:"noopener noreferrer"})}})})]})]}),e("h3",{children:e(d,{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:u=>{A.settings.autoRefresh=u.target.checked}})," ",e(d,{id:"0mC0SF"})]})}),e("li",{class:"block",children:e("label",{children:[e("input",{type:"checkbox",checked:n.settings.boostsCarousel,onChange:u=>{A.settings.boostsCarousel=u.target.checked}})," ",e(d,{id:"TSbnoW"})]})}),e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.contentTranslation,onChange:u=>{const{checked:y}=u.target;A.settings.contentTranslation=y,y||(A.settings.contentTranslationTargetLanguage=null)}})," ",e(d,{id:"0SdaOt"})]}),e("div",{class:`sub-section ${n.settings.contentTranslation?"":"more-insignificant"}`,children:[e("div",{children:e("label",{children:[e(d,{id:"rJ8YHs"})," ",e("select",{value:o||"",disabled:!n.settings.contentTranslation,style:{width:"10em"},onChange:u=>{A.settings.contentTranslationTargetLanguage=u.target.value||null},children:[e("option",{value:"",children:e(d,{id:"jNCSyx",values:{systemTargetLanguageText:h}})}),e("option",{disabled:!0,children:"──────────"}),Ti.map(u=>{const y=It({code:u.code,fallback:u.name}),g=It({code:u.code,locale:u.code}),w=y!==g;return e("option",{value:u.code,children:w?`${g} - ${y}`:y})})]})]})}),e("hr",{}),e("div",{class:"checkbox-fieldset",children:[e(d,{id:"cc0NrU",values:{0:n.settings.contentTranslationHideLanguages.length}}),e("div",{class:"checkbox-fields",children:Ti.map(u=>{const y=It({code:u.code,fallback:u.name}),g=It({code:u.code,locale:u.code}),w=y!==g;return e("label",{children:[e("input",{type:"checkbox",checked:n.settings.contentTranslationHideLanguages.includes(u.code),onChange:v=>{const{checked:k}=v.target;k?A.settings.contentTranslationHideLanguages.push(u.code):A.settings.contentTranslationHideLanguages=n.settings.contentTranslationHideLanguages.filter(x=>x!==u.code)}})," ",w?e("span",{children:[g," ",e("span",{class:"insignificant",children:["- ",y]})]}):y]})})})]}),e("p",{class:"insignificant",children:e("small",{children:e(d,{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:u=>{A.settings.contentTranslationAutoInline=u.target.checked}})," ",e(d,{id:"gURvmk"})]}),e("p",{class:"insignificant",children:e("small",{children:e(d,{id:"PbHARL",components:{0:e("b",{})}})})})]})]})]}),!!kc&&f&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.composerGIFPicker,onChange:u=>{A.settings.composerGIFPicker=u.target.checked}})," ",e(d,{id:"D7/2jB"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(d,{id:"/CLBTL",components:{0:e("a",{href:"https://developers.giphy.com/",target:"_blank",rel:"noopener noreferrer"})}})})})]}),!!wc&&f&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.mediaAltGenerator,onChange:u=>{A.settings.mediaAltGenerator=u.target.checked}})," ",e(d,{id:"9q5uor"})," ",e(C,{icon:"sparkles2",class:"more-insignificant"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(d,{id:"faZ9RI"})})}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(d,{id:"fHZgvt",components:{0:e("a",{href:"https://github.com/cheeaun/img-alt-api",target:"_blank",rel:"noopener noreferrer"})}})})})]}),f&&Ze("@mastodon/grouped-notifications")&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.groupedNotificationsAlpha,onChange:u=>{A.settings.groupedNotificationsAlpha=u.target.checked}})," ",e(d,{id:"aGziA/"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(d,{id:"X17jCM"})})})]}),f&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.shortcutSettingsCloudImportExport,onChange:u=>{A.settings.shortcutSettingsCloudImportExport=u.target.checked}})," ",e(d,{id:"570qTm"})," ",e(C,{icon:"cloud",class:"more-insignificant"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(d,{id:"0tZAhT",components:{0:e("br",{})}})})}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(d,{id:"fHf1v/"})})})]}),e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.cloakMode,onChange:u=>{A.settings.cloakMode=u.target.checked}})," ",e(d,{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(d,{id:"T/hglb"})})})]}),f&&e("li",{children:e("button",{type:"button",class:"light",onClick:()=>{A.showDrafts=!0,A.showSettings=!1},children:e(d,{id:"krk5ws"})})})]})}),f&&e(Sc,{onClose:t}),e("h3",{children:e(d,{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:fi,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:u=>{u.preventDefault(),A.showAccount="phanpy@hachyderm.io"},children:"@phanpy"}),e("br",{}),e(d,{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:u=>{u.preventDefault(),A.showAccount="cheeaun@mastodon.social"}})}})]})]}),e("p",{children:[e("a",{href:"https://github.com/sponsors/cheeaun",target:"_blank",rel:"noopener noreferrer",children:e(d,{id:"O4cLCR"})})," ","·"," ",e("a",{href:"https://www.buymeacoffee.com/cheeaun",target:"_blank",rel:"noopener noreferrer",children:e(d,{id:"Ng063n"})})," ","·"," ",e("a",{href:"https://patreon.com/cheeaun",target:"_blank",rel:"noopener noreferrer",children:"Patreon"})," ","·"," ",e("a",{href:vc,target:"_blank",rel:"noopener noreferrer",children:e(d,{id:"LcET2C"})})]}),e("p",{children:[Pi&&e(O,{children:[e(d,{id:"pFnMHn",values:{0:Pi.replace(/https?:\/\//g,"").replace(/\/$/,"")},components:{0:e("span",{class:"insignificant"})}}),e("br",{})]}),e(d,{id:"6KkH+2",values:{0:e("span",{class:"ib insignificant",children:["(",e("a",{href:"https://github.com/cheeaun/phanpy/commit/7e1ffc5",target:"_blank",rel:"noopener noreferrer",children:e(Kt,{datetime:new Date("2024-12-08T11:50:56.977Z")})}),")"]})},components:{0:e("span",{class:"insignificant"}),1:e("input",{type:"text",class:"version-string",readOnly:!0,size:"18",value:`${"2024-12-08T11:50:56.977Z".slice(0,10).replace(/-/g,".")}.7e1ffc5`,onClick:u=>{u.target.select();try{navigator.clipboard.writeText(u.target.value),he(b._({id:"PiPfua"}))}catch{he(b._({id:"gdxreD"}))}}})}})]})]}),void 0]})]})}function Sc({onClose:t}){if(!En())return null;const{instance:n}=ae(),[i,s]=R("default"),o=Y(),[a,h]=R(!1),[r,c]=R(!1),l=Y();ie(()=>{(async()=>{s("loading");try{const{subscription:f,backendSubscription:p}=await bc();if(p!=null&&p.policy&&p.policy!=="none"){h(!0);const{alerts:u,policy:y}=p;l.current=y;const{elements:g}=o.current,w=g.namedItem("policy");w&&(w.value=y),Object.keys(u).forEach(v=>{const k=g.namedItem(v);(k==null?void 0:k.type)==="checkbox"&&(k.checked=!0)})}s("default")}catch(f){/outside.*authorized/i.test(f.message)?c(!0):alert((f==null?void 0:f.message)||f),s("error")}})()},[]);const m=i==="loading";return e("form",{ref:o,onChange:()=>{setTimeout(()=>{const f=Object.fromEntries(new FormData(o.current)),p=!!f["policy-allow"],u={data:{policy:f.policy,alerts:{mention:!!f.mention,favourite:!!f.favourite,reblog:!!f.reblog,follow:!!f.follow,follow_request:!!f.followRequest,poll:!!f.poll,update:!!f.update,status:!!f.status}}};let y=0;Object.keys(u.data.alerts).forEach(w=>{u.data.alerts[w]?y++:delete u.data.alerts[w]});const g=l.current!==u.data.policy;p&&y>0?g?Di().then(()=>{Mi(u)}).catch(w=>{alert(b._({id:"I6pdY3"}))}):Mi(u).catch(w=>{alert(b._({id:"I6pdY3"}))}):Di().catch(w=>{alert(b._({id:"q1zFd+"}))})},100)},children:[e("h3",{children:e(d,{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 f=>{const{checked:p}=f.target;if(p){const u=await Notification.requestPermission();u==="granted"?h(!0):(h(!1),u==="denied"&&alert(b._({id:"6LUsk7"})))}else h(!1)}})," ",e(d,{id:"qYNCa1",values:{0:[{value:"all",label:b._({id:"+niKJH"})},{value:"followed",label:b._({id:"x2NYtp"})},{value:"follower",label:b._({id:"PBFNgg"})}].map(f=>e("option",{value:f.value,children:f.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:b._({id:"/bZzdR"})},{value:"favourite",label:b._({id:"zZOZj7"})},{value:"reblog",label:b._({id:"puY2t0"})},{value:"follow",label:b._({id:"aaJhcT"})},{value:"followRequest",label:b._({id:"6Fs1Ba"})},{value:"poll",label:b._({id:"wNExRS"})},{value:"update",label:b._({id:"K/EtE6"})},{value:"status",label:b._({id:"2yr1/p"})}].map(f=>e("li",{children:e("label",{children:[e("input",{type:"checkbox",name:f.value})," ",f.label]})}))})})})}),r&&e("div",{class:"sub-section",children:e("p",{children:e(d,{id:"8d0b8B",components:{0:e(fe,{to:`/login?instance=${n}`,onClick:t}),1:e("b",{})}})})})]})})}),e("p",{class:"section-postnote",children:e("small",{children:e(d,{id:"z96cOX",components:{0:e("b",{})}})})})]})}const Kn=()=>{let t=setTimeout(()=>{var i,s;const n=document.getElementById("columns");if(n){const o=n.querySelector(".deck-container.focus");if(o)o.focus();else{const a=n.querySelectorAll(".deck-container").find(h=>h.getBoundingClientRect().left>=0);a?a.focus():(s=(i=n.querySelector(".deck-container"))==null?void 0:i.focus)==null||s.call(i)}}else{const o=document.querySelectorAll("#modal-container > *");if(o!=null&&o.length){const c=o[o.length-1],l=c.querySelector('[tabindex="-1"]')||c;if(l){l.focus();return}}if(document.querySelector(".deck-backdrop"))return;const h=document.querySelectorAll(".deck-container"),r=h[h.length-1];r&&r.tabIndex===-1&&r.focus()}},100);return()=>clearTimeout(t)};function Es(t){if(!t)return;const n=Gt(),i=Y(n.pathname);ie(()=>{i.current&&n.pathname!==i.current&&(t==null||t())},[n.pathname,t])}const Rs=1e3*60,Cc=24*60*60*1e3,Wn=_t(async()=>{const{masto:t}=ae(),n=await t.v1.lists.list();return n.sort((i,s)=>i.title.localeCompare(s.title)),n.length&&setTimeout(()=>{ve.account.set("lists",{lists:n,updatedAt:Date.now()})},1),n},{maxAge:Rs});async function cn(){try{const{lists:t,updatedAt:n}=ve.account.get("lists")||{};return t!=null&&t.length?(Date.now()-n>Cc&&Wn(),t):await Wn()}catch{return[]}}const Ic=_t(t=>{const{masto:n}=ae();return n.v1.lists.$select(t).fetch()},{maxAge:Rs});async function Ls(t){const{lists:n}=ve.account.get("lists")||{};if(n!=null&&n.length){const i=n.find(s=>s.id===t);if(i)return i}try{return Ic(t)}catch{return null}}async function Tc(t){const n=await Ls(t);return(n==null?void 0:n.title)||""}function xc(t){const{lists:n}=ve.account.get("lists")||{};n!=null&&n.length&&(n.push(t),n.sort((i,s)=>i.title.localeCompare(s.title)),ve.account.set("lists",{lists:n,updatedAt:Date.now()}))}function Ac(t){const{lists:n}=ve.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)),ve.account.set("lists",{lists:n,updatedAt:Date.now()}))}}function Ec(t){const{lists:n}=ve.account.get("lists")||{};if(n!=null&&n.length){const i=n.findIndex(s=>s.id===t);i!==-1&&(n.splice(i,1),ve.account.set("lists",{lists:n,updatedAt:Date.now()}))}}function gi({list:t,onClose:n}){const{masto:i}=ae(),[s,o]=R("default"),a=!!t,h=Y(),r=Y(),c=Y();ie(()=>{a&&(h.current.value=t.title,r.current.value=t.repliesPolicy,c.current&&(c.current.checked=t.exclusive))},[a]);const l=Ze("@mastodon/list-exclusive")||Ze("@gotosocial/list-exclusive");return e("div",{class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(C,{icon:"x",alt:b._({id:"yz7wBu"})})})," ",e("header",{children:e("h2",{children:a?b._({id:"tuhghE"}):b._({id:"Sb2gYF"})})}),e("main",{children:e("form",{class:"list-form",onSubmit:m=>{m.preventDefault();const f=new FormData(m.target),p=f.get("title"),u=f.get("replies_policy"),y=f.get("exclusive")==="on";o("loading"),(async()=>{try{let g;a?g=await i.v1.lists.$select(t.id).update({title:p,replies_policy:u,exclusive:y}):g=await i.v1.lists.create({title:p,replies_policy:u,exclusive:y}),o("default"),n==null||n({state:"success",list:g}),setTimeout(()=>{a?Ac(g):xc(g)},1)}catch{o("error"),alert(a?b._({id:"R7ep1i"}):b._({id:"KPoj8w"}))}})()},children:[e("div",{class:"list-form-row",children:e("label",{for:"list-title",children:[e(d,{id:"6YtxFj"})," ",e("input",{ref:h,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(d,{id:"ei6pnR"})}),e("option",{value:"followed",children:e(d,{id:"Mr53YX"})}),e("option",{value:"none",children:e(d,{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(d,{id:"jxxYp0"})]})}),e("div",{class:"list-form-footer",children:[e("button",{type:"submit",disabled:s==="loading",children:a?b._({id:"tfDRzk"}):b._({id:"hYgDIe"})}),a&&e(lt,{disabled:s==="loading",align:"end",menuItemClassName:"danger",confirmLabel:b._({id:"+kQ/cY"}),onClick:()=>{o("loading"),(async()=>{try{await i.v1.lists.$select(t.id).remove(),o("default"),n==null||n({state:"deleted"}),setTimeout(()=>{Ec(t.id)},1)}catch{o("error"),alert(b._({id:"tqUaGL"}))}})()},children:e("button",{type:"button",class:"light danger",disabled:s==="loading",children:e(d,{id:"Jb6/SB"})})})]})]})})]})}const Rc=[60*5,60*30,60*60,60*60*6,60*60*24,60*60*24*3,60*60*24*7,60*60*24*30,0],Ut={0:{id:"9ZP9cc"},300:tt(5,"minute"),1800:tt(30,"minute"),3600:tt(1,"hour"),21600:tt(6,"hour"),86400:tt(1,"day"),259200:tt(3,"day"),604800:tt(1,"week"),2592e3:tt(30,"day")},Oi=80,$s=1e3*60*10;function Lc(t,n){return n.v1.accounts.familiarFollowers.fetch({id:[t]})}const $c=_t(Lc,{maxAge:$s});async function Mc(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 Dc=_t(Mc,{maxAge:$s});function Ms({account:t,fetchAccount:n=()=>{},standalone:i,instance:s,authenticated:o}){const{i18n:a}=Qe(),{masto:h}=ae({instance:s}),{masto:r,instance:c}=ae(),[l,m]=R("default"),f=typeof t=="string",[p,u]=R(f?null:t),y=Ce(()=>s===c,[s,c]);ie(()=>{if(!f){u(t);return}m("loading"),(async()=>{try{const F=await n();A.accounts[`${F.id}@${s}`]=F,u(F),m("default")}catch{u(null),m("error")}})()},[f,t,n]);const{acct:g,avatar:w,avatarStatic:v,bot:k,createdAt:x,displayName:S,emojis:I,fields:_,followersCount:T,followingCount:$,group:D,id:M,lastStatusAt:G,locked:te,note:B,statusesCount:V,url:z,username:H,memorial:ne,moved:L,roles:q,hideCollections:U}=p||{};let W=!1,{header:de,headerStatic:Q}=p||{};(!de||/missing\.png$/.test(de))&&w&&!/missing\.png$/.test(w)&&(de=w,W=!0,v&&!/missing\.png$/.test(v)&&(Q=v));const me=Ce(()=>M===wt(),[M]);ie(()=>{const F=!!(p!=null&&p.id&&(p!=null&&p.username)&&(p!=null&&p.acct)&&(p!=null&&p.avatar)&&(p!=null&&p.avatarStatic)&&(p!=null&&p.displayName)&&(p!=null&&p.url));if(me&&s&&F){const pe=ve.local.getJSON("accounts");let Ae=!1;pe.forEach(E=>{E.info.id===p.id&&E.instanceURL===s&&(E.info=p,Ae=!0)}),Ae&&ve.local.setJSON("accounts",pe)}},[me,p,s]);const ke=Ce(()=>z?Dt.toUnicode(URL.parse(z).hostname):null,[z]),[ue,j]=R([]),be=Y(),Re=Y([]);async function xe(F){var K;(F||!be.current)&&(be.current=h.v1.accounts.$select(M).followers.list({limit:Oi}));const pe=await be.current.next();if(me||!y)return pe;const{value:Ae}=pe;let E=[];if(F){let oe=[];try{oe=await h.v1.accounts.familiarFollowers.fetch({id:[M]})}catch{}Re.current=((K=oe==null?void 0:oe[0])==null?void 0:K.accounts)||[],E=[...Re.current,...Ae.filter(Z=>!Re.current.some(se=>se.id===Z.id))]}else Ae!=null&&Ae.length&&(E=Ae.filter(oe=>!Re.current.some(Z=>Z.id===oe.id)));return{...pe,value:E}}const Ne=Y();async function Pe(F){return(F||!Ne.current)&&(Ne.current=h.v1.accounts.$select(M).following.list({limit:Oi})),await Ne.current.next()}const _e=i?"div":fe,J=s?`/${s}/a/${M}`:`/a/${M}`,[ge,Ee]=R([]),[le,X]=R(),[we,P]=R("default"),ee=!!(le!=null&&le.total),re=async F=>{try{const pe=await $c(F,r);Ee(pe[0].accounts.slice(0,Nc))}catch{}},N=async()=>{if(M){P("loading");try{const F=await Dc(M,h);X(F),P("default")}catch{P("error")}}},ce=ct(({relationship:F,currentID:pe})=>{F.following||(re(pe),!i&&V>0&&N())},[i,M,V]),Ie=ct(F=>{F.id===M&&(u(F),A.accounts[`${F.id}@${s}`]=F)},[M,s]);return e("div",{tabIndex:"-1",class:`account-container ${l==="loading"?"skeleton":""}`,style:{"--header-color-1":ue[0],"--header-color-2":ue[1],"--header-color-3":ue[2],"--header-color-4":ue[3]},children:[l==="error"&&e("div",{class:"ui-state",children:[e("p",{children:e(d,{id:"44hICK"})}),e("p",{children:e("a",{href:f?t:z,target:"_blank",rel:"noopener noreferrer",children:[e(d,{id:"Aadw0+"})," ",e(C,{icon:"external"})]})})]}),l==="loading"?e(O,{children:[e("header",{children:e(rt,{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(d,{id:"x5LEuB"})]}),e("div",{children:[e("span",{children:"██"})," ",e(d,{id:"following.stats"})]}),e("div",{children:[e("span",{children:"██"})," ",e(d,{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"})})})})]})]})]}):p&&e(O,{children:[!!L&&e("div",{class:"account-moved",children:[e("p",{children:e(d,{id:"C6cVP/",values:{displayName:S},components:{0:e("b",{})}})}),e(rt,{account:L,instance:s,onClick:F=>{F.stopPropagation(),A.showAccount=L}})]}),!!de&&!/missing\.png$/.test(de)&&e("img",{src:de,alt:"",class:`header-banner ${W?"header-is-avatar":""}`,onError:F=>{F.target.crossOrigin?F.target.src!==Q?F.target.src=Q:(F.target.removeAttribute("crossorigin"),F.target.src=de):F.target.src!==Q?F.target.src=Q:F.target.remove()},crossOrigin:"anonymous",onLoad:F=>{F.target.classList.add("loaded");try{const pe=window.OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"),Ae=pe.getContext("2d",{willReadFrequently:!0});pe.width=F.target.width,pe.height=F.target.height,Ae.imageSmoothingEnabled=!1,Ae.drawImage(F.target,0,0);const E=10,oe=[Ae.getImageData(0,0,E,E).data,Ae.getImageData(F.target.width-E,0,E,E).data,Ae.getImageData(0,F.target.height-E,E,E).data,Ae.getImageData(F.target.width-E,F.target.height-E,E,E).data].map(Z=>{let se=0,Me=0,Le=0,$e=0;for(let He=0;He<Z.length;He+=4)se+=Z[He],Me+=Z[He+1],Le+=Z[He+2],$e+=Z[He+3];const ze=Z.length/4;return[se/ze,Me/ze,Le/ze,$e/ze]}).map(Z=>{const[se,Me,Le,$e]=Oc(Z);return`rgba(${se}, ${Me}, ${Le}, ${$e})`});j(oe)}catch{}}}),e("header",{children:i?e(at,{shift:window.matchMedia("(min-width: calc(40em))").matches?114:64,menuButton:e("div",{children:e(rt,{account:p,instance:s,avatarSize:"xxxl",onClick:()=>{}})}),children:[e("div",{class:"szh-menu__header",children:e(Yc,{acct:g,instance:s})}),e(Se,{onClick:()=>{const F=g.includes("@")?`@${g}`:`@${g}@${s}`;try{navigator.clipboard.writeText(F),he(a._({id:"zJoEwS"}))}catch{he(a._({id:"BC0lSD"}))}},children:[e(C,{icon:"link"}),e("span",{children:e(d,{id:"27x6gl"})})]}),e(Se,{href:z,target:"_blank",children:[e(C,{icon:"external"}),e("span",{children:e(d,{id:"Bz5hLl"})})]}),e(Ge,{}),e(Be,{href:p.avatar,target:"_blank",children:[e(C,{icon:"user"}),e("span",{children:e(d,{id:"7WYl2I"})})]}),e(Be,{href:p.header,target:"_blank",children:[e(C,{icon:"media"}),e("span",{children:e(d,{id:"ZNme5R"})})]})]}):e(rt,{account:p,instance:s,avatarSize:"xxxl",internal:!0})}),e("div",{class:"faux-header-bg","aria-hidden":"true"}),e("main",{children:[!!ne&&e("span",{class:"tag",children:e(d,{id:"prdIOK"})}),!!k&&e("span",{class:"tag",children:[e(C,{icon:"bot"})," ",e(d,{id:"9Vdq+j"})]}),!!D&&e("span",{class:"tag",children:[e(C,{icon:"group"})," ",e(d,{id:"L8fEEm"})]}),q==null?void 0:q.map(F=>e("span",{class:"tag",children:[F.name,!!ke&&e(O,{children:[" ",e("span",{class:"more-insignificant",children:ke})]})]})),e("div",{class:"note",dir:"auto",onClick:fs({instance:c}),dangerouslySetInnerHTML:{__html:jn(B,{emojis:I})}}),e("div",{class:"account-metadata-box",children:[(_==null?void 0:_.length)>0&&e("div",{class:"profile-metadata",children:_.map(({name:F,value:pe,verifiedAt:Ae},E)=>e("div",{class:`profile-field ${Ae?"profile-verified":""}`,dir:"auto",children:[e("b",{children:[e(ps,{text:F,emojis:I})," ",!!Ae&&e(C,{icon:"check-circle",size:"s",alt:a._({id:"QDEWii"})})]}),e("p",{dangerouslySetInnerHTML:{__html:jn(pe,{emojis:I})}})]},F+E))}),e("div",{class:"stats",children:[e(_e,{tabIndex:0,to:J,onClick:()=>{setTimeout(()=>{A.showGenericAccounts={id:"followers",heading:a._({id:"x5LEuB"}),fetchAccounts:xe,instance:s,excludeRelationshipAttrs:me?["followedBy"]:[],blankCopy:U?a._({id:"BRV/wh"}):void 0}},0)},children:[!!ge.length&&e("span",{class:"shazam-container-horizontal",children:e("span",{class:"shazam-container-inner stats-avatars-bunch",children:ge.map(F=>e(dt,{url:F.avatarStatic,size:"s",alt:`${F.displayName} @${F.acct}`,squircle:F==null?void 0:F.bot}))})}),e("span",{title:T,children:Ke(T)})," ",e(d,{id:"x5LEuB"})]}),e(_e,{class:"insignificant",tabIndex:0,to:J,onClick:()=>{setTimeout(()=>{A.showGenericAccounts={heading:a._({id:"following.stats"}),fetchAccounts:Pe,instance:s,excludeRelationshipAttrs:me?["following"]:[],blankCopy:U?a._({id:"BRV/wh"}):void 0}},0)},children:[e("span",{title:$,children:Ke($)})," ",e(d,{id:"following.stats"}),e("br",{})]}),e(_e,{class:"insignificant",to:J,children:[e("span",{title:V,children:Ke(V)})," ",e(d,{id:"+owNNn"})]}),!!x&&e("div",{class:"insignificant",children:e(d,{id:"PCcEFZ",values:{0:ft(x,{hideTime:!0})},components:{0:e("time",{datetime:x})}})})]})]}),!!le&&e(_e,{to:J,class:"account-metadata-box",children:e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:ee?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(d,{id:"HxF6Fk"})]})," ",e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-legend-item-replies"})," ",e(d,{id:"N8UzTV"})]})," ",e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-legend-item-boosts"})," ",e(d,{id:"puY2t0"})]})]})]}):e("div",{class:"posting-stats",children:e(d,{id:"vl3XTJ"})})})})}),!L&&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:we==="loading",onClick:()=>{N()},children:[e("div",{class:`posting-stats-bar posting-stats-icon ${we==="loading"?"loading":""}`,style:{"--originals-percentage":"33%","--replies-percentage":"66%"}}),e(d,{id:"PjP87f"})," "]})})})})]}),e("footer",{children:e(Pc,{info:p,instance:s,standalone:i,authenticated:o,onRelationshipChange:ce,onProfileUpdate:Ie})})]})]})}const Nc=3;function Pc({info:t,instance:n,standalone:i,authenticated:s,onRelationshipChange:o=()=>{},onProfileUpdate:a=()=>{}}){var le;if(!t)return null;const{_:h}=Qe(),{masto:r,instance:c,authenticated:l}=ae(),m=n===c,[f,p]=R("default"),[u,y]=R(null),{id:g,acct:w,url:v,username:k,locked:x,lastStatusAt:S,note:I,fields:_,moved:T}=t,$=Y(g),{following:D,showingReblogs:M,notifying:G,followedBy:te,blocking:B,blockedBy:V,muting:z,mutingNotifications:H,requested:ne,domainBlocking:L,endorsed:q,note:U}=u||{},[W,de]=R(null),[Q,me]=R(!1),ke=w.includes("@")?w:`${w}@${n}`;ie(()=>{if(t){const X=wt();let we;(async()=>{if(m&&s)we=g;else if(!m&&l){const ee=t.acct.includes("@");try{const re=await r.v2.search.fetch({q:ee?t.acct:`${t.username}@${n}`,type:"accounts",limit:1,resolve:!0});re.accounts.length&&(we=re.accounts[0].id,de(re.accounts[0]))}catch{}}if(!we)return;if(X===we){me(!0);return}$.current=we,p("loading");const P=r.v1.accounts.relationships.fetch({id:[we]});try{const ee=await P;if(p("default"),ee.length){const re=ee[0];y(re),o({relationship:re,currentID:we})}}catch{p("error")}})()}},[t,s]),ie(()=>{t&&Q&&uo(t)},[t,Q]);const ue=f==="loading",[j,be]=R(!1),[Re,xe]=R(!1),[Ne,Pe]=R(!1),[_e,J]=R(!1),[ge,Ee]=R([]);return e(O,{children:[e("div",{class:"actions",children:[e("span",{children:[te?e("span",{class:"tag",children:e(d,{id:"p3UO/y"})}):S?e("small",{class:"insignificant",children:e(d,{id:"F3cM1G",values:{0:ft(S,{hideTime:!0})},components:{0:e("span",{class:"ib"})}})}):e("span",{}),z&&e("span",{class:"tag danger",children:e(d,{id:"+IJm1Z"})}),B&&e("span",{class:"tag danger",children:e(d,{id:"32TndD"})})]})," ",e("span",{class:"buttons",children:[!!U&&e("button",{type:"button",class:"private-note-tag",title:b._({id:"zxFxcH"}),onClick:()=>{Pe(!0)},dir:"auto",children:e("span",{children:U})}),e(at,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:e("button",{type:"button",class:"plain",disabled:ue,children:e(C,{icon:"more",size:"l",alt:b._({id:"2FYpfJ"})})}),onMenuChange:X=>{D&&X.open&&(async()=>{try{const we=await r.v1.accounts.$select($.current).lists.list();Ee(we)}catch{}})()},children:[l&&!Q&&e(O,{children:[e(Se,{onClick:()=>{Ro({draftStatus:{status:`@${(W==null?void 0:W.acct)||w} `}})},children:[e(C,{icon:"at"}),e("span",{children:e(d,{id:"3LkfZu",values:{username:k},components:{0:e("span",{class:"bidi-isolate"})}})})]}),e(Se,{onClick:()=>{be(!0)},children:[e(C,{icon:"translate"}),e("span",{children:e(d,{id:"R8mSiS"})})]}),Ze("@mastodon/profile-private-note")&&e(Se,{onClick:()=>{Pe(!0)},children:[e(C,{icon:"pencil"}),e("span",{children:U?b._({id:"U+Gokq"}):b._({id:"VcQzRi"})})]}),D&&!!u&&e(O,{children:[e(Se,{onClick:()=>{p("loading"),(async()=>{try{const X=await r.v1.accounts.$select($.current).follow({notify:!G});X&&y(X),p("default"),he(X.notifying?b._({id:"jL3N0G",values:{username:k}}):b._({id:"WBugD/",values:{username:k}}))}catch(X){alert(X),p("error")}})()},children:[e(C,{icon:"notification"}),e("span",{children:G?b._({id:"osJmEN"}):b._({id:"I92Z+b"})})]}),e(Se,{onClick:()=>{p("loading"),(async()=>{try{const X=await r.v1.accounts.$select($.current).follow({reblogs:!M});X&&y(X),p("default"),he(X.showingReblogs?b._({id:"0X2KC8",values:{username:k}}):b._({id:"cXWjH0",values:{username:k}}))}catch(X){alert(X),p("error")}})()},children:[e(C,{icon:"rocket"}),e("span",{children:M?b._({id:"GRUr8d"}):b._({id:"uREpT3"})})]})]}),D&&e(Se,{onClick:()=>{xe(!0)},children:[e(C,{icon:"list"}),ge.length?e(O,{children:[e("small",{class:"menu-grow",children:[e(d,{id:"sJ2yQc"}),e("br",{}),e("span",{class:"more-insignificant",children:ge.map(X=>X.title).join(", ")})]}),e("small",{class:"more-insignificant",children:ge.length})]}):e("span",{children:e(d,{id:"sJ2yQc"})})]}),e(Ge,{})]}),e(Se,{onClick:()=>{const X=`@${(W==null?void 0:W.acct)||ke}`;try{navigator.clipboard.writeText(X),he(b._({id:"zJoEwS"}))}catch{he(b._({id:"BC0lSD"}))}},children:[e(C,{icon:"copy"}),e("small",{children:[e(d,{id:"27x6gl"}),e("br",{}),e("span",{class:"more-insignificant bidi-isolate",children:["@",(W==null?void 0:W.acct)||ke]})]})]}),e(Se,{href:v,target:"_blank",children:[e(C,{icon:"external"}),e("small",{class:"menu-double-lines",children:zc(v)})]}),e("div",{class:"menu-horizontal",children:[e(Se,{onClick:()=>{try{navigator.clipboard.writeText(v),he(b._({id:"edWbV6"}))}catch{he(b._({id:"W1ewR0"}))}},children:[e(C,{icon:"link"}),e("span",{children:e(d,{id:"he3ygx"})})]}),(navigator==null?void 0:navigator.share)&&((le=navigator==null?void 0:navigator.canShare)==null?void 0:le.call(navigator,{url:v}))&&e(Se,{onClick:()=>{try{navigator.share({url:v})}catch{alert(b._({id:"TtG3Uh"}))}},children:[e(C,{icon:"share"}),e("span",{children:e(d,{id:"LFKLqp"})})]})]}),!!u&&e(O,{children:[e(Ge,{}),z?e(Se,{onClick:()=>{p("loading"),(async()=>{try{const X=await r.v1.accounts.$select((W==null?void 0:W.id)||g).unmute();y(X),p("default"),he(b._({id:"B4Xkly",values:{username:k}})),A.reloadGenericAccounts.id="mute",A.reloadGenericAccounts.counter++}catch{p("error")}})()},children:[e(C,{icon:"unmute"}),e("span",{children:e(d,{id:"Q/HUhC",values:{username:k},components:{0:e("span",{class:"bidi-isolate"})}})})]}):e(xn,{menuClassName:"menu-blur",openTrigger:"clickOnly",direction:"bottom",overflow:"auto",shift:16,label:e(O,{children:[e(C,{icon:"mute"}),e("span",{class:"menu-grow",children:e(d,{id:"xhPEH3",values:{username:k},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:Rc.map(X=>e(Se,{onClick:()=>{p("loading"),(async()=>{try{const we=await r.v1.accounts.$select((W==null?void 0:W.id)||g).mute({duration:X});y(we),p("default"),he(b._({id:"/plB9m",values:{0:typeof Ut[X]=="function"?Ut[X]():h(Ut[X]),username:k}})),A.reloadGenericAccounts.id="mute",A.reloadGenericAccounts.counter++}catch{p("error"),he(b._({id:"vWGBjT",values:{username:k}}))}})()},children:typeof Ut[X]=="function"?Ut[X]():h(Ut[X])}))})}),te&&e(lt,{subMenu:!0,menuItemClassName:"danger",confirmLabel:e(O,{children:[e(C,{icon:"user-x"}),e("span",{children:e(d,{id:"unyq2W",values:{username:k},components:{0:e("span",{class:"bidi-isolate"})}})})]}),onClick:()=>{p("loading"),(async()=>{try{const X=await r.v1.accounts.$select((W==null?void 0:W.id)||g).removeFromFollowers();y(X),p("default"),he(b._({id:"AgkcM/",values:{username:k}})),A.reloadGenericAccounts.id="followers",A.reloadGenericAccounts.counter++}catch{p("error")}})()},children:[e(C,{icon:"user-x"}),e("span",{children:e(d,{id:"VCZ0OT"})})]}),e(lt,{subMenu:!0,confirm:!B,confirmLabel:e(O,{children:[e(C,{icon:"block"}),e("span",{children:e(d,{id:"aforS9",values:{username:k},components:{0:e("span",{class:"bidi-isolate"})}})})]}),itemProps:{className:"danger"},menuItemClassName:"danger",onClick:()=>{p("loading"),(async()=>{try{if(B){const X=await r.v1.accounts.$select((W==null?void 0:W.id)||g).unblock();y(X),p("default"),he(b._({id:"sI9N29",values:{username:k}}))}else{const X=await r.v1.accounts.$select((W==null?void 0:W.id)||g).block();y(X),p("default"),he(b._({id:"uYcYzu",values:{username:k}}))}A.reloadGenericAccounts.id="block",A.reloadGenericAccounts.counter++}catch{p("error"),B?he(b._({id:"0tG4wG",values:{username:k}})):he(b._({id:"pA+qEx",values:{username:k}}))}})()},children:B?e(O,{children:[e(C,{icon:"unblock"}),e("span",{children:e(d,{id:"/3LJfX",values:{username:k},components:{0:e("span",{class:"bidi-isolate"})}})})]}):e(O,{children:[e(C,{icon:"block"}),e("span",{children:e(d,{id:"JRswkR",values:{username:k},components:{0:e("span",{class:"bidi-isolate"})}})})]})}),e(Se,{className:"danger",onClick:()=>{A.showReportModal={account:W||t}},children:[e(C,{icon:"flag"}),e("span",{children:e(d,{id:"qTJgpR",values:{username:k},components:{0:e("span",{class:"bidi-isolate"})}})})]})]}),l&&Q&&i&&Ze("@mastodon/profile-edit")&&e(O,{children:[e(Ge,{}),e(Se,{onClick:()=>{J(!0)},children:[e(C,{icon:"pencil"}),e("span",{children:e(d,{id:"9OpVZg"})})]})]}),!1]}),!u&&f==="loading"&&e(Oe,{abrupt:!0}),!!u&&!T&&e(lt,{confirm:D||ne,confirmLabel:e("span",{children:ne?b._({id:"e7qQIH"}):b._({id:"eYsAQr",values:{0:t.acct||t.username}})}),menuItemClassName:"danger",align:"end",disabled:ue,onClick:()=>{p("loading"),(async()=>{try{let X;D||ne?X=await r.v1.accounts.$select($.current).unfollow():X=await r.v1.accounts.$select($.current).follow(),X&&y(X),p("default")}catch(X){alert(X),p("error")}})()},children:e("button",{type:"button",class:`${D||ne?"light swap":""}`,"data-swap-state":D||ne?"danger":"",disabled:ue,children:D?e(O,{children:[e("span",{children:e(d,{id:"y6sq5j"})}),e("span",{children:e(d,{id:"HKrBPX"})})]}):ne?e(O,{children:[e("span",{children:e(d,{id:"Yx0Ud8"})}),e("span",{children:e(d,{id:"yTVtKs"})})]}):x?e(O,{children:[e(C,{icon:"lock"})," ",e("span",{children:e(d,{id:"MKEPCY"})})]}):b._({id:"MKEPCY"})})})]})]}),!!j&&e(Fe,{onClose:()=>{be(!1)},children:e(Uc,{note:I,fields:_,onClose:()=>be(!1)})}),!!Re&&e(Fe,{onClose:()=>{xe(!1)},children:e(Bc,{accountID:$.current,onClose:()=>xe(!1)})}),!!Ne&&e(Fe,{onClose:()=>{Pe(!1)},children:e(Fc,{account:t,note:U,onRelationshipChange:X=>{y(X)},onClose:()=>Pe(!1)})}),!!_e&&e(Fe,{onClose:()=>{J(!1)},children:e(Hc,{onClose:({state:X,account:we}={})=>{J(!1),X==="success"&&we&&a(we)}})})]})}function Oc([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 zc(t){if(!t)return;const n=URL.parse(t),{host:i,pathname:s}=n,o=s.replace(/\/$/,"").replace(/^\//,"");return e(O,{children:[e("span",{class:"more-insignificant",children:[Dt.toUnicode(i),"/"]}),e("wbr",{}),e("span",{children:o})]})}function Uc({note:t,fields:n,onClose:i}){const s=(n==null?void 0:n.map(({name:a,value:h})=>`${a}
|
||
${xi(h)}`).join(`
|
||
|
||
`))||"",o=xi(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:b._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(d,{id:"9groMz"})})}),e("main",{children:[e("p",{style:{whiteSpace:"pre-wrap"},children:o}),e(ms,{forceTranslate:!0,text:o})]})]})}function Bc({accountID:t,onClose:n}){const{masto:i}=ae(),[s,o]=R("default"),[a,h]=R([]),[r,c]=R([]),[l,m]=Mt(u=>u+1,0);ie(()=>{o("loading"),(async()=>{try{const u=await cn();h(u);const y=await i.v1.accounts.$select(t).lists.list();c(y),o("default")}catch{o("error")}})()},[l]);const[f,p]=R(!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:b._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(d,{id:"sJ2yQc"})})}),e("main",{children:[a.length>0?e("ul",{class:"list-add-remove",children:a.map(u=>{const y=r.some(g=>g.id===u.id);return e("li",{children:e("button",{type:"button",class:`light ${y?"checked":""}`,disabled:s==="loading",onClick:()=>{o("loading"),(async()=>{try{y?await i.v1.lists.$select(u.id).accounts.remove({accountIds:[t]}):await i.v1.lists.$select(u.id).accounts.create({accountIds:[t]}),m()}catch{o("error"),alert(y?b._({id:"7KnEYa"}):b._({id:"Tba8uO"}))}})()},children:[e(C,{icon:"check-circle",alt:"☑️"}),e("span",{children:u.title})]})})})}):s==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):s==="error"?e("p",{class:"ui-state",children:e(d,{id:"v/l5uA"})}):e("p",{class:"ui-state",children:e(d,{id:"/MJ7gZ"})}),e("button",{type:"button",class:"plain2",onClick:()=>p(!0),disabled:s!=="default",children:[e(C,{icon:"plus",size:"l"})," ",e("span",{children:e(d,{id:"Sb2gYF"})})]})]}),f&&e(Fe,{onClick:u=>{u.target===u.currentTarget&&p(!1)},children:e(gi,{list:f==null?void 0:f.list,onClose:u=>{u.state==="success"&&m(),p(!1)}})})]})}function Fc({account:t,note:n,onRelationshipChange:i=()=>{},onClose:s=()=>{}}){const{masto:o}=ae(),[a,h]=R("default"),r=Y(null);return ie(()=>{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:b._({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(d,{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())&&(h("loading"),(async()=>{try{const f=await o.v1.accounts.$select(t==null?void 0:t.id).note.create({comment:m});h("default"),i(f),s()}catch(f){h("error"),alert((f==null?void 0:f.message)||b._({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(d,{id:"dEgA5A"})}),e("span",{children:[e(Oe,{abrupt:!0,hidden:a!=="loading"}),e("button",{disabled:a==="loading",type:"submit",children:e(d,{id:"SrwrEj"})})]})]})]})})]})}function Hc({onClose:t=()=>{}}){const{masto:n}=ae(),[i,s]=R("loading"),[o,a]=R(null);ie(()=>{(async()=>{try{const f=await n.v1.accounts.verifyCredentials();a(f),s("default")}catch{s("error")}})()},[]);const{displayName:h,source:r}=o||{},{note:c,fields:l}=r||{},m=Y(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:b._({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(d,{id:"9OpVZg"})})}),e("main",{children:i==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):e("form",{onSubmit:f=>{f.preventDefault();const p=new FormData(f.target),u=p.get("display_name"),y=p.get("note"),g=m.current.querySelectorAll('input[name^="fields_attributes"]'),w=[];g.forEach(v=>{const k=v.name,[x,S,I]=k.match(/fields_attributes\[(\d+)\]\[(.+)\]/)||[],_=v.value?v.value.trim():"";S&&I&&_&&(w[S]||(w[S]={}),w[S][I]=_)}),w.forEach(v=>{v.name&&!v.value&&(v.value="")}),(async()=>{try{const v=await n.v1.accounts.updateCredentials({displayName:u,note:y,fieldsAttributes:w});t==null||t({state:"success",account:v})}catch(v){alert((v==null?void 0:v.message)||b._({id:"FwMMx0"}))}})()},children:[e("p",{children:e("label",{children:[e(d,{id:"6YtxFj"})," ",e("input",{type:"text",name:"display_name",defaultValue:h,maxLength:30,disabled:i==="loading",dir:"auto"})]})}),e("p",{children:e("label",{children:[e(d,{id:"E+oKCO"}),e("textarea",{defaultValue:c,name:"note",maxLength:500,rows:"5",disabled:i==="loading",dir:"auto"})]})}),e("p",{children:e(d,{id:"T4I119"})}),e("table",{ref:m,children:[e("thead",{children:e("tr",{children:[e("th",{children:e(d,{id:"87a/t/"})}),e("th",{children:e(d,{id:"4b3oEV"})})]})}),e("tbody",{children:Array.from({length:Math.max(4,l.length)}).map((f,p)=>{const{name:u="",value:y=""}=l[p]||{};return e(qc,{name:u,value:y,index:p,disabled:i==="loading"},p)})})]}),e("footer",{children:[e("button",{type:"button",class:"light",disabled:i==="loading",onClick:()=>{t==null||t()},children:e(d,{id:"dEgA5A"})}),e("button",{type:"submit",disabled:i==="loading",children:e(d,{id:"tfDRzk"})})]})]})})]})}function qc({name:t,value:n,disabled:i,index:s}){const[o,a]=R(!!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:h=>a(!!h.currentTarget.value),dir:"auto"})})]})}function Yc({acct:t,instance:n}){let[i,s]=t.split("@");s||(s=n);const o=Dt.toASCII(t);return e("div",{class:"handle-info",children:[e("span",{class:"handle-handle",title:o,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(d,{id:"silO9A"})]})," ",e("span",{class:"ib",children:[e("span",{class:"handle-legend-icon server"})," ",e(d,{id:"rZgCpJ"})]})]})]})}function jc({account:t,instance:n,onClose:i}){const{masto:s,instance:o,authenticated:a}=ae({instance:n}),h=typeof t=="string";return ie(()=>{h||(A.accounts[`${t.id}@${o}`]=t)},[t]),Es(i),e("div",{class:"sheet",children:[!!i&&e("button",{type:"button",class:"sheet-close outer",onClick:i,children:e(C,{icon:"x",alt:b._({id:"yz7wBu"})})}),e(Ms,{instance:o,authenticated:a,account:t,fetchAccount:async()=>{if(h)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:f}=l,p=f.replace(/^\//,"").replace(/\/$/,"")+"@"+m,u=await s.v2.search.fetch({q:p,type:"accounts",limit:1,resolve:a});if(u.accounts.length)return u.accounts[0]}}else return t}})]})}function Vc({onClose:t}){const{masto:n}=ae(),[i,s]=R("default"),[o,a]=R([]),[h,r]=Mt(l=>l+1,0);ie(()=>{s("loading"),(async()=>{try{const l=await ut.drafts.keys();if(l.length){const m=wn(),f=l.filter(p=>p.startsWith(m));if(f.length){const p=await ut.drafts.getMany(f);p.sort((u,y)=>new Date(y.updatedAt).getTime()-new Date(u.updatedAt).getTime()),a(p)}else a([])}else a([]);s("default")}catch{s("error")}})()},[h]);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:b._({id:"yz7wBu"})})}),e("header",{children:[e("h2",{children:[e(d,{id:"krk5ws"})," ",e(Oe,{abrupt:!0,hidden:i!=="loading"})]}),c&&e("div",{class:"insignificant",children:e(d,{id:"Ap/10+"})})]}),e("main",{children:c?e(O,{children:[e("ul",{class:"drafts-list",children:o.map(l=>{const{updatedAt:m,key:f,draftStatus:p,replyTo:u}=l,y=new Date(m);return e("li",{children:[e("div",{class:"mini-draft-meta",children:[e("b",{children:[e(C,{icon:u?"reply":"quill",size:"s"})," ",e("time",{children:[!!u&&e(O,{children:[e("span",{class:"bidi-isolate",children:["@",u.account.acct]}),e("br",{})]}),ft(y)]})]}),e(lt,{confirmLabel:e("span",{children:e(d,{id:"/W5yFF"})}),menuItemClassName:"danger",align:"end",disabled:i==="loading",onClick:()=>{(async()=>{try{await ut.drafts.del(f),r()}catch{alert(b._({id:"rEYoku"}))}})()},children:e("button",{type:"button",class:"small light",disabled:i==="loading",children:e(d,{id:"Jb6/SB"})})})]}),e("button",{type:"button",disabled:i==="loading",class:"draft-item",onClick:async()=>{let g;if(u){s("loading");try{g=await n.v1.statuses.$select(u.id).fetch()}catch{alert(b._({id:"tMwimH"})),s("default");return}s("default")}window.__COMPOSE__={draftStatus:p,replyToStatus:g},A.showCompose=!0,A.showDrafts=!1},children:e(Gc,{draft:l})})]},m)})}),o.length>1&&e("p",{children:e(lt,{confirmLabel:e("span",{children:e(d,{id:"3IakFR"})}),menuItemClassName:"danger",disabled:i==="loading",onClick:()=>{(async()=>{s("loading");try{await ut.drafts.delMany(o.map(l=>l.key)),s("default"),r()}catch{alert(b._({id:"0J4sZq"})),s("error")}})()},children:e("button",{type:"button",class:"light danger",disabled:i==="loading",children:e(d,{id:"hOg+Mt"})})})})]}):e("p",{children:e(d,{id:"8iQ+jk"})})})]})}function Gc({draft:t}){var f;const{draftStatus:n,replyTo:i}=t,{status:s,spoilerText:o,poll:a,mediaAttachments:h}=n,r=((f=a==null?void 0:a.options)==null?void 0:f.length)>0,c=(h==null?void 0:h.length)>0,l=r||c,m=Ce(()=>{if(!c)return;const p=h.find(g=>/image/.test(g.type));if(!p)return;const{file:u}=p;return URL.createObjectURL(u)},[c,h]);return e(O,{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:b._({id:"4WUbF1"})}),c&&e("span",{children:[e(C,{icon:"attachment",alt:b._({id:"xYilR2"})})," ",e("small",{children:h==null?void 0:h.length})]})]}),e("div",{class:"mini-draft-main",children:[!!o&&e("div",{class:"mini-draft-spoiler",children:o}),!!s&&e("div",{class:"mini-draft-status",children:s})]})]})})}function Kc({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:b._({id:"yz7wBu"})})}),n&&e("a",{href:n,target:"_blank",rel:"noopener noreferrer",class:"button plain",children:[e("span",{children:e(d,{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 Wc({instance:t,excludeRelationshipAttrs:n=[],postID:i,onClose:s=()=>{},blankCopy:o=b._({id:"10OlfF"})}){const{masto:a,instance:h}=ae(),r=t?t===h:!0,c=qe(A),[l,m]=R("default"),[f,p]=R([]),[u,y]=R(!1);if(Es(s),!c.showGenericAccounts)return null;const{id:g,heading:w,fetchAccounts:v,accounts:k,showReactions:x}=c.showGenericAccounts,[S,I]=R({}),_=async M=>{if(!(M!=null&&M.length)||!r)return;const G=await oi(M,S);G&&I({...S,...G})},T=M=>{v&&(M&&p([]),m("loading"),(async()=>{try{const{done:G,value:te}=await v(M);if(Array.isArray(te)){if(M){const B=[];for(let V=0;V<te.length;V++){const z=te[V],H=B.find((ne,L)=>ne.id===z.id&&V!==L);H?H._types.push(...z._types):B.push({_types:[],...z})}p(B)}else p(B=>{const V=B;for(const z of te){const H=V.find(ne=>ne.id===z.id);H?H._types.push(...z._types):V.push(z)}return V});y(!G),_(te)}else y(!1);m("default")}catch{m("error")}})())},$=Y(!0);ie(()=>{(k==null?void 0:k.length)>0?(p(k),_(k)):(T(!0),$.current=!1)},[k,v]),ie(()=>{var M;$.current||((M=c.reloadGenericAccounts)==null?void 0:M.id)===g&&T(!0)},[c.reloadGenericAccounts.counter]);const D=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:b._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:w||b._({id:"bPwFdf"})})}),e("main",{children:[D&&e(fe,{to:`/${t||h}/s/${D.id}`,class:"post-preview",children:e(Ye,{status:D,size:"s",readOnly:!0})}),f.length>0?e(O,{children:[e("ul",{class:"accounts-list",children:f.map(M=>{var B,V;const G=S[M.id],te=`${M.id}-${((B=M._types)==null?void 0:B.length)||""}`;return e("li",{children:[x&&((V=M._types)==null?void 0:V.length)>0&&e("div",{class:"reactions-block",children:M._types.map(z=>e(C,{icon:{reblog:"rocket",favourite:"heart"}[z],class:`${z}-icon`}))}),e("div",{class:"account-relationships",children:e(rt,{account:M,showStats:!0,relationship:G,excludeRelationshipAttrs:n})})]},te)})}),l==="default"?u?e(kt,{onChange:M=>{M&&T()},children:e("button",{type:"button",class:"plain block",onClick:()=>T(),children:e(d,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(d,{id:"2EYeAZ"})}):l==="loading"&&e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})})]}):l==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):l==="error"?e("p",{class:"ui-state",children:e(d,{id:"AThL/k"})}):e("p",{class:"ui-state insignificant",children:o})]})]})}function Zc({alt:t,lang:n,onClose:i}){const s=qe(A),[o,a]=R(!1),h=hs(!0),r=s.settings.contentTranslationHideLanguages||[],c=!!n&&n!==h&&!Si([n],[h])&&!r.find(l=>n===l||Si([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:b._({id:"yz7wBu"})})}),e("header",{class:"header-grid",children:[e("h2",{children:e(d,{id:"5gfDMm"})}),e("div",{class:"header-side",children:e(at,{align:"end",menuButton:e("button",{type:"button",class:"plain4",children:e(C,{icon:"more",alt:b._({id:"2FYpfJ"}),size:"xl"})}),children:[e(Se,{disabled:o,onClick:()=>{a(!0)},children:[e(C,{icon:"translate"}),e("span",{children:e(d,{id:"pi8x/S"})})]}),Lo&&e(Se,{onClick:()=>{$o(t,n)},children:[e(C,{icon:"speak"}),e("span",{children:e(d,{id:"yIBLq8"})})]})]})})]}),e("main",{lang:n,dir:"auto",children:[e("p",{style:{whiteSpace:"pre-wrap",textWrap:"pretty"},children:t}),(c||o)&&e(ms,{forceTranslate:o,sourceLanguage:n,text:t})]})]})}const{min:cd,max:ad}=Math;const Ds={};for(let t of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])Ds[`[object ${t}]`]=t.toLowerCase();function Xc(t){return Ds[Object.prototype.toString.call(t)]||"object"}const Wt=(t,n=null)=>t.length>=3?Array.prototype.slice.call(t):Xc(t[0])=="object"&&n?n.split("").filter(i=>t[0][i]!==void 0).map(i=>t[0][i]):t[0].slice(0);const{PI:Rn,min:rd,max:ld}=Math;const dd=Rn*2,ud=Rn/3,Jc=Rn/180,Qc=180/Rn;function Sn(t,n){let i=t.length;Array.isArray(t[0])||(t=[t]),Array.isArray(n[0])||(n=n.map(h=>[h]));let s=n[0].length,o=n[0].map((h,r)=>n.map(c=>c[r])),a=t.map(h=>o.map(r=>Array.isArray(h)?h.reduce((c,l,m)=>c+l*(r[m]||0),0):r.reduce((c,l)=>c+l*h,0)));return i===1&&(a=a[0]),s===1?a.map(h=>h[0]):a}const Ns={Kn:18,labWhitePoint:"d65",Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452,kE:216/24389,kKE:8,kK:24389/27,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-.2040259135167538,m20:-.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-.0685,m20:-.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-.008528664575177328,m10:-.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}};const On=t=>{const n=Math.sign(t);return t=Math.abs(t),(t<=.0031308?t*12.92:1.055*Math.pow(t,1/2.4)-.055)*n},ea=(t,n,i)=>{const{MtxAdaptMa:s,MtxAdaptMaI:o,MtxXYZ2RGB:a,RefWhiteRGB:h,Xn:r,Yn:c,Zn:l}=Ns,m=r*s.m00+c*s.m10+l*s.m20,f=r*s.m01+c*s.m11+l*s.m21,p=r*s.m02+c*s.m12+l*s.m22,u=h.X*s.m00+h.Y*s.m10+h.Z*s.m20,y=h.X*s.m01+h.Y*s.m11+h.Z*s.m21,g=h.X*s.m02+h.Y*s.m12+h.Z*s.m22,w=(t*s.m00+n*s.m10+i*s.m20)*(u/m),v=(t*s.m01+n*s.m11+i*s.m21)*(y/f),k=(t*s.m02+n*s.m12+i*s.m22)*(g/p),x=w*o.m00+v*o.m10+k*o.m20,S=w*o.m01+v*o.m11+k*o.m21,I=w*o.m02+v*o.m12+k*o.m22,_=On(x*a.m00+S*a.m10+I*a.m20),T=On(x*a.m01+S*a.m11+I*a.m21),$=On(x*a.m02+S*a.m12+I*a.m22);return[_*255,T*255,$*255]},bi=(...t)=>{t=Wt(t,"lab");const[n,i,s,...o]=t,[a,h,r]=ta([n,i,s]),[c,l,m]=ea(a,h,r);return[c,l,m,...o.length>0&&o[0]<1?[o[0]]:[]]};function ta(t){var n=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],i=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],s=Sn(i,t);return Sn(n,s.map(o=>o**3))}function zn(t){const n=Math.sign(t);return t=Math.abs(t),(t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4))*n}const na=(t,n,i)=>{t=zn(t/255),n=zn(n/255),i=zn(i/255);const{MtxRGB2XYZ:s,MtxAdaptMa:o,MtxAdaptMaI:a,Xn:h,Yn:r,Zn:c,As:l,Bs:m,Cs:f}=Ns;let p=t*s.m00+n*s.m10+i*s.m20,u=t*s.m01+n*s.m11+i*s.m21,y=t*s.m02+n*s.m12+i*s.m22;const g=h*o.m00+r*o.m10+c*o.m20,w=h*o.m01+r*o.m11+c*o.m21,v=h*o.m02+r*o.m12+c*o.m22;let k=p*o.m00+u*o.m10+y*o.m20,x=p*o.m01+u*o.m11+y*o.m21,S=p*o.m02+u*o.m12+y*o.m22;return k*=g/l,x*=w/m,S*=v/f,p=k*a.m00+x*a.m10+S*a.m20,u=k*a.m01+x*a.m11+S*a.m21,y=k*a.m02+x*a.m12+S*a.m22,[p,u,y]},yi=(...t)=>{const[n,i,s,...o]=Wt(t,"rgb"),a=na(n,i,s);return[...ia(a),...o.length>0&&o[0]<1?[o[0]]:[]]};function ia(t){const n=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],i=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],s=Sn(n,t);return Sn(i,s.map(o=>Math.cbrt(o)))}const{sin:sa,cos:oa}=Math,ca=(...t)=>{let[n,i,s]=Wt(t,"lch");return isNaN(s)&&(s=0),s=s*Jc,[n,oa(s)*i,sa(s)*i]},Un=(...t)=>{t=Wt(t,"lch");const[n,i,s,...o]=t,[a,h,r]=ca(n,i,s),[c,l,m]=bi(a,h,r);return[c,l,m,...o.length>0&&o[0]<1?[o[0]]:[]]},{sqrt:aa,atan2:ra,round:la}=Math,da=(...t)=>{const[n,i,s]=Wt(t,"lab"),o=aa(i*i+s*s);let a=(ra(s,i)*Qc+360)%360;return la(o*1e4)===0&&(a=Number.NaN),[n,o,a]},ua=(...t)=>{const[n,i,s,...o]=Wt(t,"rgb"),[a,h,r]=yi(n,i,s),[c,l,m]=da(a,h,r);return[c,l,m,...o.length>0&&o[0]<1?[o[0]]:[]]},ha={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:hd}=ha;function Ps({mediaAttachments:t,statusID:n,instance:i,lang:s,index:o=0,onClose:a=()=>{}}){var x,S;const[h,r]=R("default"),c=Y(null),[l,m]=R(o),f=Y(null);gt(()=>{var I;(I=f.current)==null||I.scrollIntoView()},[]);const p=Y(n);ie(()=>{const I=o*c.current.clientWidth,_=p.current!==n;_&&(p.current=n),c.current.focus(),c.current.scrollTo({left:I*(Rt()?-1:1),behavior:_?"auto":"smooth"})},[o,n]);const[u,y]=R(!0);ie(()=>{let I=()=>{a()};return c.current&&c.current.addEventListener("swiped-down",I),()=>{c.current&&c.current.removeEventListener("swiped-down",I)}},[]),Ue("esc",a,{ignoreEventWhen:I=>!!document.querySelector("#modal-container > *")},[a]),ie(()=>{let I=()=>{const{clientWidth:_,scrollLeft:T}=c.current,$=Math.round(Math.abs(T)/_);m($)};return c.current&&c.current.addEventListener("scroll",I,{passive:!0}),()=>{c.current&&c.current.removeEventListener("scroll",I)}},[]),ie(()=>{let I=setTimeout(()=>{var _,T;(T=(_=c.current)==null?void 0:_.focus)==null||T.call(_)},100);return()=>clearTimeout(I)},[]);const g=Ce(()=>t==null?void 0:t.map(I=>{const{blurhash:_}=I;if(_){const T=ci(_);return ua(T)}return null}),[t]),w=Ce(()=>g==null?void 0:g.map(I=>I?{light:Un([.95,.01,I[2]]),dark:Un([.35,.01,I[2]]),default:Un([.6,I[1],I[2]])}:null)),v=Ce(()=>{const _=100/w.length,T=w.map((M,G)=>{var V,z,H,ne;const te=G*_+5,B=(G+1)*_-5;return M!=null&&M.light&&(M!=null&&M.dark)?{light:`
|
||
rgb(${(V=M.light)==null?void 0:V.join(",")}) ${te}%,
|
||
rgb(${(z=M.light)==null?void 0:z.join(",")}) ${B}%
|
||
`,dark:`
|
||
rgb(${(H=M.dark)==null?void 0:H.join(",")}) ${te}%,
|
||
rgb(${(ne=M.dark)==null?void 0:ne.join(",")}) ${B}%
|
||
`}:{light:`
|
||
transparent ${te}%,
|
||
transparent ${B}%
|
||
`,dark:`
|
||
transparent ${te}%,
|
||
transparent ${B}%
|
||
`}}),$=T.map(M=>M.light).join(", "),D=T.map(M=>M.dark).join(", ");return{light:$,dark:D}},[w]);let k=Y(null);return ie(()=>()=>{var I,_;(_=(I=k.current)==null?void 0:I.hideToast)==null||_.call(I)},[]),gt(()=>{const I=w[l];let _,T;if(I){const $=ve.local.get("theme");if($){const D=`rgb(${I[$].join(",")})`;_=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),_&&(T=_.content,_.content=D)}else{const D=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",M=`rgb(${I[D].join(",")})`;_=document.querySelector(`meta[name="theme-color"][media*="${D}"]`),_&&(T=_.content,_.content=M)}}return()=>{_&&T&&(_.content=T)}},[l,w]),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:I=>{(I.target.classList.contains("carousel-item")||I.target.classList.contains("media")||I.target.classList.contains("media-zoom"))&&a()},style:t.length>1?{backgroundAttachment:"local","--accent-gradient-light":v==null?void 0:v.light,"--accent-gradient-dark":v==null?void 0:v.dark}:{},children:t==null?void 0:t.map((I,_)=>{var $,D;const T=t.length===1?w[_]:null;return e("div",{class:"carousel-item",style:T?{"--accent-color":`rgb(${T.default.join(",")})`,"--accent-light-color":`rgb(${($=T.light)==null?void 0:$.join(",")})`,"--accent-dark-color":`rgb(${(D=T.dark)==null?void 0:D.join(",")})`,"--accent-alpha-color":`rgba(${T.default.join(",")}, 0.4)`}:{},tabindex:"0",ref:_===l?f:null,onClick:M=>{M.target.classList.contains("media")||y(!u)},children:[!!I.description&&e("button",{type:"button",class:"media-alt",hidden:!u,onClick:()=>{A.showMediaAlt={alt:I.description,lang:s}},children:[e("span",{class:"alt-badge",children:"ALT"}),e("span",{class:"media-alt-desc",lang:s,dir:"auto",children:I.description})]}),e(gs,{media:I,showOriginal:!0,lang:s})]},I.id)})}),e("div",{class:"carousel-top-controls",hidden:!u,children:[e("span",{children:e("button",{type:"button",class:"carousel-button",onClick:()=>a(),children:e(C,{icon:"x",alt:b._({id:"yz7wBu"})})})}),(t==null?void 0:t.length)>1?e("span",{class:"carousel-dots",children:t==null?void 0:t.map((I,_)=>e("button",{type:"button",disabled:_===l,class:`carousel-dot ${_===l?"active":""}`,onClick:T=>{T.preventDefault(),T.stopPropagation();const $=c.current.clientWidth*_*(Rt()?-1:1);c.current.focus(),c.current.scrollTo({left:$,behavior:"smooth"})},children:e(C,{icon:"round",size:"s",alt:"⸱"})},I.id))}):e("span",{}),e("span",{children:[e(at,{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:b._({id:"2FYpfJ"})})}),children:[e(Be,{href:((x=t[l])==null?void 0:x.remoteUrl)||((S=t[l])==null?void 0:S.url),class:"carousel-button",target:"_blank",title:b._({id:"5hXGws"}),children:[e(C,{icon:"popout"}),e("span",{children:e(d,{id:"aDr7Vc"})})]}),!1]})," ",e(fe,{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(d,{id:"ISg5SQ"})," "]}),"»"]})]})]}),(t==null?void 0:t.length)>1&&e("div",{class:"carousel-controls",hidden:!u,children:[e("button",{type:"button",class:"carousel-button",hidden:l===0,onClick:I=>{I.preventDefault(),I.stopPropagation(),c.current.focus(),c.current.scrollTo({left:c.current.clientWidth*(l-1)*(Rt()?-1:1),behavior:"smooth"})},children:e(C,{icon:"arrow-left",alt:b._({id:"DHhJ7s"})})}),e("button",{type:"button",class:"carousel-button",hidden:l===t.length-1,onClick:I=>{I.preventDefault(),I.stopPropagation(),c.current.focus(),c.current.scrollTo({left:c.current.clientWidth*(l+1)*(Rt()?-1:1),behavior:"smooth"})},children:e(C,{icon:"arrow-right",alt:b._({id:"hXzOVo"})})})]})]})}const fa=[,"spam","legal","violation","other"],Zt={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 pa({account:t,post:n,onClose:i}){const{_:s}=Qe(),{masto:o}=ae(),[a,h]=R("default"),[r,c]=t.acct.split("@"),[l,m]=Ce(()=>{const{rules:k,domain:x}=as();return[k||[],x]}),[f,p]=R(null),[u,y]=R(!1),g=Y(null),[w,v]=R(!1);return e("div",{class:"report-modal-container",children:[e("div",{class:"top-controls",children:[e("h1",{children:n?b._({id:"muLhL3"}):b._({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:b._({id:"yz7wBu"})})})]}),e("main",{children:[e("div",{class:"report-preview",children:n?e(Ye,{status:n,size:"s",previewMode:!0}):e(rt,{account:t,avatarSize:"xxl",useAvatarStatic:!0,showStats:!0,showActivity:!0})}),!!f&&!Zt[f].excludeStamp&&e("span",{class:"rubber-stamp","aria-hidden":"true",children:[s(Zt[f].stampLabel||s(Zt[f].label)),e("small",{children:e(d,{id:"2WtL62"})})]},f),e("form",{onSubmit:k=>{k.preventDefault();const x=new FormData(k.target),S=Object.fromEntries(x.entries());let{category:I,comment:_,forward:T}=S;_||(_=void 0),T==="on"&&(T=!0);const $=I==="violation"?Object.entries(S).filter(([M])=>M.startsWith("rule_ids")).map(([M,G])=>G):void 0,D={category:I,comment:_,forward:T,ruleIds:$};h("loading"),(async()=>{try{await o.v1.reports.create({accountId:t.id,statusIds:n!=null&&n.id?[n.id]:void 0,category:I,comment:_,ruleIds:$,forward:T}),h("success"),he(n?b._({id:"y3ou+8"}):b._({id:"R9kjEL"})),i()}catch(M){h("error"),he((M==null?void 0:M.message)||(n?b._({id:"+3FjPq"}):b._({id:"oEQq5w"})))}})()},children:[e("p",{children:n?b._({id:"L9fUm+"}):b._({id:"rSLkfe"})}),e("section",{class:"report-categories",children:fa.map(k=>k==="violation"&&!(l!=null&&l.length)?null:e(O,{children:[e("label",{class:"report-category",children:[e("input",{type:"radio",name:"category",value:k,required:!0,disabled:a==="loading",onChange:x=>{p(x.target.value),y(x.target.value==="violation")}}),e("span",{children:[s(Zt[k].label)," ",e("small",{class:"ib insignificant",children:s(Zt[k].description)})]})]}),k==="violation"&&!!(l!=null&&l.length)&&e("div",{class:"shazam-container no-animation",hidden:!u,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"report-rules",ref:g,children:l.map((x,S)=>e("label",{class:"report-rule",children:[e("input",{type:"checkbox",name:`rule_ids[${S}]`,value:x.id,required:u&&!w,disabled:a==="loading",onChange:I=>{const{checked:_}=I.target;_?v(!0):g.current.querySelectorAll("input:checked").length||v(!1)}}),e("span",{children:x.text})]},x.id))})})})]},k))}),e("section",{class:"report-comment",children:[e("p",{children:e("label",{for:"report-comment",children:e(d,{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(d,{id:"cyjS8M",values:{domain:c},components:{0:e("i",{})}})})]})})}),e("footer",{children:[e("button",{type:"submit",disabled:a==="loading",children:e(d,{id:"4cijjm"})})," ",e("button",{type:"submit",class:"plain2",disabled:a==="loading",onClick:async()=>{try{await o.v1.accounts.$select(t.id).mute(),he(b._({id:"/BGBeF",values:{username:r}}))}catch{he(b._({id:"v02K7/",values:{username:r}}))}},children:e(d,{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(),he(b._({id:"kjUejn",values:{username:r}}))}catch{he(b._({id:"pMcdDp",values:{username:r}}))}},children:e(d,{id:"JybQca",components:{0:e("small",{class:"ib"})}})}),e(Oe,{hidden:a!=="loading"})]})]})]})]})}var vi={exports:{}},fd=vi.exports;(function(t){var n=function(){var i=String.fromCharCode,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",a={};function h(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 h(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),f=0,p=l.length;f<p;f++){var u=l.charCodeAt(f);m[f*2]=u>>>8,m[f*2+1]=u%256}return m},decompressFromUint8Array:function(c){if(c==null)return r.decompress(c);for(var l=new Array(c.length/2),m=0,f=l.length;m<f;m++)l[m]=c[m*2]*256+c[m*2+1];var p=[];return l.forEach(function(u){p.push(i(u))}),r.decompress(p.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 h(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 f,p,u={},y={},g="",w="",v="",k=2,x=3,S=2,I=[],_=0,T=0,$;for($=0;$<c.length;$+=1)if(g=c.charAt($),Object.prototype.hasOwnProperty.call(u,g)||(u[g]=x++,y[g]=!0),w=v+g,Object.prototype.hasOwnProperty.call(u,w))v=w;else{if(Object.prototype.hasOwnProperty.call(y,v)){if(v.charCodeAt(0)<256){for(f=0;f<S;f++)_=_<<1,T==l-1?(T=0,I.push(m(_)),_=0):T++;for(p=v.charCodeAt(0),f=0;f<8;f++)_=_<<1|p&1,T==l-1?(T=0,I.push(m(_)),_=0):T++,p=p>>1}else{for(p=1,f=0;f<S;f++)_=_<<1|p,T==l-1?(T=0,I.push(m(_)),_=0):T++,p=0;for(p=v.charCodeAt(0),f=0;f<16;f++)_=_<<1|p&1,T==l-1?(T=0,I.push(m(_)),_=0):T++,p=p>>1}k--,k==0&&(k=Math.pow(2,S),S++),delete y[v]}else for(p=u[v],f=0;f<S;f++)_=_<<1|p&1,T==l-1?(T=0,I.push(m(_)),_=0):T++,p=p>>1;k--,k==0&&(k=Math.pow(2,S),S++),u[w]=x++,v=String(g)}if(v!==""){if(Object.prototype.hasOwnProperty.call(y,v)){if(v.charCodeAt(0)<256){for(f=0;f<S;f++)_=_<<1,T==l-1?(T=0,I.push(m(_)),_=0):T++;for(p=v.charCodeAt(0),f=0;f<8;f++)_=_<<1|p&1,T==l-1?(T=0,I.push(m(_)),_=0):T++,p=p>>1}else{for(p=1,f=0;f<S;f++)_=_<<1|p,T==l-1?(T=0,I.push(m(_)),_=0):T++,p=0;for(p=v.charCodeAt(0),f=0;f<16;f++)_=_<<1|p&1,T==l-1?(T=0,I.push(m(_)),_=0):T++,p=p>>1}k--,k==0&&(k=Math.pow(2,S),S++),delete y[v]}else for(p=u[v],f=0;f<S;f++)_=_<<1|p&1,T==l-1?(T=0,I.push(m(_)),_=0):T++,p=p>>1;k--,k==0&&(k=Math.pow(2,S),S++)}for(p=2,f=0;f<S;f++)_=_<<1|p&1,T==l-1?(T=0,I.push(m(_)),_=0):T++,p=p>>1;for(;;)if(_=_<<1,T==l-1){I.push(m(_));break}else T++;return I.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 f=[],p,u=4,y=4,g=3,w="",v=[],k,x,S,I,_,T,$,D={val:m(0),position:l,index:1};for(k=0;k<3;k+=1)f[k]=k;for(S=0,_=Math.pow(2,2),T=1;T!=_;)I=D.val&D.position,D.position>>=1,D.position==0&&(D.position=l,D.val=m(D.index++)),S|=(I>0?1:0)*T,T<<=1;switch(p=S){case 0:for(S=0,_=Math.pow(2,8),T=1;T!=_;)I=D.val&D.position,D.position>>=1,D.position==0&&(D.position=l,D.val=m(D.index++)),S|=(I>0?1:0)*T,T<<=1;$=i(S);break;case 1:for(S=0,_=Math.pow(2,16),T=1;T!=_;)I=D.val&D.position,D.position>>=1,D.position==0&&(D.position=l,D.val=m(D.index++)),S|=(I>0?1:0)*T,T<<=1;$=i(S);break;case 2:return""}for(f[3]=$,x=$,v.push($);;){if(D.index>c)return"";for(S=0,_=Math.pow(2,g),T=1;T!=_;)I=D.val&D.position,D.position>>=1,D.position==0&&(D.position=l,D.val=m(D.index++)),S|=(I>0?1:0)*T,T<<=1;switch($=S){case 0:for(S=0,_=Math.pow(2,8),T=1;T!=_;)I=D.val&D.position,D.position>>=1,D.position==0&&(D.position=l,D.val=m(D.index++)),S|=(I>0?1:0)*T,T<<=1;f[y++]=i(S),$=y-1,u--;break;case 1:for(S=0,_=Math.pow(2,16),T=1;T!=_;)I=D.val&D.position,D.position>>=1,D.position==0&&(D.position=l,D.val=m(D.index++)),S|=(I>0?1:0)*T,T<<=1;f[y++]=i(S),$=y-1,u--;break;case 2:return v.join("")}if(u==0&&(u=Math.pow(2,g),g++),f[$])w=f[$];else if($===y)w=x+x.charAt(0);else return null;v.push(w),f[y++]=x+w.charAt(0),u--,x=w,u==0&&(u=Math.pow(2,g),g++)}}};return r}();t!=null?t.exports=n:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return n})})(vi);var zi=vi.exports;const ma="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2084%2062'%3e%3crect%20width='64'%20height='48'%20x='18'%20y='2'%20fill='%23fff'%20stroke='%23999'%20stroke-width='3'%20rx='4'/%3e%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",ga="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",ba="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",ya=200,va=10;async function Cn(){const{masto:t}=ae(),n=t.v1.followedTags.list({limit:ya}),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<va);return i.sort((o,a)=>o.name.localeCompare(a.name)),i.length&&setTimeout(()=>{ve.account.set("followedTags",{tags:i,updatedAt:Date.now()})},1),i}const wa=24*60*60*1e3;async function ka(){try{const{tags:t,updatedAt:n}=ve.account.get("followedTags")||{};return t!=null&&t.length?(Date.now()-n>wa&&Cn(),t):await Cn()}catch{return[]}}const Ui=document.createElement("div"),_a=t=>{if(!t)return[];if(t.indexOf("#")===-1)return[];Ui.innerHTML=t;const n=Ui.querySelectorAll("a.hashtag");return n.length?Array.from(n).map(i=>i.innerText.trim().replace(/^[^#]*#+/,"")):[]};function pn({children:t}){if(typeof t=="string")return t;const[n,i]=R("");return ie(()=>{Promise.resolve(t).then(i)},[t]),n}const vt=9,Sa=["following","mentions","notifications","list","public","trending","search","hashtag","bookmarks","favourites"],Os={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"}},mn={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}]},Ca=_t(async({id:t})=>{const n=await ae().masto.v1.accounts.$select(t).fetch();return n.username||n.acct||n.displayName}),In={following:{id:"home",title:(t,n)=>n===0?b._({id:"i0qMbr"}):b._({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?Tc(t):b._({id:"h16FyT"}),path:({id:t})=>t?`/l/${t}`:"/l",icon:"list",excludeViewMode:({id:t})=>t?[]:["multi-column"]},public:{id:"public",title:({local:t})=>t?b._({id:"d5zxa4"}):b._({id:"4ERYY7"}),subtitle:({instance:t})=>t||ae().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||ae().instance,path:({instance:t})=>`/${t}/trending`,icon:"chart"},search:{id:"search",title:({query:t})=>t?`“${t}”`:b._({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:Ca,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||ae().instance,path:({hashtag:t,instance:n,media:i})=>`${n?`/${n}`:""}/t/${t.split(/\s+/).join("+")}${i?"?media=1":""}`,icon:"hashtag"}};function Ia({onClose:t}){const{_:n}=Qe(),i=qe(A),{shortcuts:s}=i,[o,a]=R(!1),[h,r]=R(!1),[c]=hi();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:b._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:[e(C,{icon:"shortcut"})," ",e(d,{id:"CTqTgr"})," ",e("sup",{style:{fontSize:12,opacity:.5,textTransform:"uppercase"},children:e(d,{id:"A1As8l"})})]})}),e("main",{children:[e("p",{children:e(d,{id:"CIHAsy"})}),e("div",{class:"shortcuts-view-mode",children:[{value:"float-button",label:b._({id:"qwdOim"}),imgURL:ma},{value:"tab-menu-bar",label:b._({id:"UxBoCm"}),imgURL:ba},{value:"multi-column",label:b._({id:"uvDfdW"}),imgURL:ga}].map(({value:l,label:m,imgURL:f})=>{const p=i.settings.shortcutsViewMode===l||l==="float-button"&&!i.settings.shortcutsViewMode;return e("label",{class:p?"checked":"",children:[e("input",{type:"radio",name:"shortcuts-view-mode",value:l,checked:p,onChange:u=>{A.settings.shortcutsViewMode=u.target.value}})," ",e("img",{src:f,alt:"",width:"80",height:"58"})," ",e("span",{children:m})]},l)})}),s.length>0?e(O,{children:[e("ol",{class:"shortcuts-list",ref:c,children:s.filter(Boolean).map((l,m)=>{const f=Object.values(l).join("-"),{type:p}=l;if(!In[p])return null;let{icon:u,title:y,subtitle:g,excludeViewMode:w}=In[p];typeof y=="function"?y=y(l,m):y=n(y),typeof g=="function"?g=g(l,m):g=n(g),typeof u=="function"&&(u=u(l,m)),typeof w=="function"&&(w=w(l,m));const v=w==null?void 0:w.includes(i.settings.shortcutsViewMode);return e("li",{children:[e(C,{icon:u}),e("span",{class:"shortcut-text",children:[e(pn,{children:y}),g&&e(O,{children:[" ",e("small",{class:"ib insignificant",children:g})]}),v&&e("span",{class:"tag",children:e(d,{id:"5KJFnN"})})]}),e("span",{class:"shortcut-actions",children:[e("button",{type:"button",class:"plain small",disabled:m===0,onClick:()=>{const k=Array.from(A.shortcuts);if(m>0){const x=A.shortcuts[m-1];k[m-1]=l,k[m]=x,A.shortcuts=k}},children:e(C,{icon:"arrow-up",alt:b._({id:"QyioBP"})})}),e("button",{type:"button",class:"plain small",disabled:m===s.length-1,onClick:()=>{const k=Array.from(A.shortcuts);if(m<A.shortcuts.length-1){const x=A.shortcuts[m+1];k[m+1]=l,k[m]=x,A.shortcuts=k}},children:e(C,{icon:"arrow-down",alt:b._({id:"3Ib6FN"})})}),e("button",{type:"button",class:"plain small",onClick:()=>{a({shortcut:l,shortcutIndex:m})},children:e(C,{icon:"pencil",alt:b._({id:"ePK91l"})})})]})]},f)})}),s.length===1&&i.settings.shortcutsViewMode!=="float-button"&&e("div",{class:"ui-state insignificant",children:[e(C,{icon:"info"})," ",e("small",{children:e(d,{id:"3Xq4Zi"})})]})]}):e("div",{class:"ui-state insignificant",children:[e("p",{children:i.settings.shortcutsViewMode==="multi-column"?b._({id:"3xIN+E"}):b._({id:"vLxvHT"})}),e("p",{children:e(d,{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>=vt&&(i.settings.shortcutsViewMode==="multi-column"?b._({id:"RqXfsz",values:{SHORTCUTS_LIMIT:vt}}):b._({id:"EVRO/o",values:{SHORTCUTS_LIMIT:vt}}))}),e("p",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e("button",{type:"button",class:"light",onClick:()=>r(!0),children:e(d,{id:"bgVLbt"})}),e("button",{type:"button",disabled:s.length>=vt,onClick:()=>a(!0),children:[e(C,{icon:"plus"})," ",e("span",{children:i.settings.shortcutsViewMode==="multi-column"?b._({id:"Vh3ADI"}):b._({id:"9tmn6W"})})]})]})]}),o&&e(Fe,{onClick:l=>{l.target===l.currentTarget&&a(!1)},children:e(Ta,{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)})}),h&&e(Fe,{onClick:l=>{l.target===l.currentTarget&&r(!1)},children:e(xa,{shortcuts:s,onClose:()=>r(!1)})})]})}const Bi={list:{id:"1qL+L+"},search:{id:"dmTmkQ"},hashtag:{id:"E8laYz"}};function Ta({onSubmit:t,disabled:n,shortcut:i,shortcutIndex:s,onClose:o}){var w,v;const{_:a}=Qe(),h=!!i,[r,c]=R((i==null?void 0:i.type)||null),[l,m]=R("default"),[f,p]=R([]),[u,y]=R([]);ie(()=>{(async()=>{if(r==="list")try{m("loading");const k=await cn();p(k),m("default")}catch{m("error")}})(),(async()=>{if(r==="hashtag")try{const k=await Cn();y(k)}catch{}})()},[r]);const g=Y();return ie(()=>{if(h&&r&&mn[r]){const k=g.current;mn[r].forEach(({name:x,type:S})=>{const I=k.querySelector(`[name="${x}"]`);I&&i[x]&&(S==="checkbox"?I.checked=i[x]==="on":I.value=i[x])})}},[h,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:b._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:h?b._({id:"pe1jog"}):b._({id:"Lsxpe5"})})}),e("main",{tabindex:"-1",children:e("form",{ref:g,onSubmit:k=>{k.preventDefault();const x=new FormData(k.target),S={};x.forEach((I,_)=>{S[_]=I==null?void 0:I.trim(),_==="instance"&&(S[_]=S[_].replace(/^https?:\/\//,"").replace(/\/+$/,""),S[_]=S[_].replace(/^@?[^@]+@/,""))}),S.type&&(t({result:S,mode:h?"edit":"add"}),k.target.reset(),c(null),o==null||o())},children:[e("p",{children:e("label",{children:[e("span",{children:e(d,{id:"cklVjM"})}),e("select",{required:!0,disabled:n,onChange:k=>{c(k.target.value)},defaultValue:h?i.type:void 0,name:"type",dir:"auto",children:[e("option",{}),Sa.map(k=>e("option",{value:k,children:a(Os[k])}))]})]})}),(v=(w=mn[r])==null?void 0:w.map)==null?void 0:v.call(w,({text:k,name:x,type:S,placeholder:I,pattern:_,notRequired:T})=>r==="list"?e("p",{children:e("label",{children:[e("span",{children:e(d,{id:"2BBAbc"})}),e("select",{name:"id",required:!T,disabled:n||l==="loading",defaultValue:h?i.id:void 0,dir:"auto",children:[e("option",{value:""}),f.map($=>e("option",{value:$.id,children:$.title}))]})]})}):e("p",{children:e("label",{children:[e("span",{children:a(k)})," ",e("input",{type:S,switch:S==="checkbox"||void 0,name:x,placeholder:a(I),required:S==="text"&&!T,disabled:n,list:r==="hashtag"?"followed-hashtags-datalist":null,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:_,dir:"auto"}),r==="hashtag"&&u.length>0&&e("datalist",{id:"followed-hashtags-datalist",children:u.map($=>e("option",{value:$.name}))})]})})),!!Bi[r]&&e("p",{class:"form-note insignificant",children:[e(C,{icon:"info"}),a(Bi[r])]}),e("footer",{children:[e("button",{type:"submit",class:"block",disabled:n||l==="loading",children:h?b._({id:"tfDRzk"}):b._({id:"m16xKo"})}),h&&e("button",{type:"button",class:"light danger",onClick:()=>{A.shortcuts.splice(s,1),o==null||o()},children:e(d,{id:"t/YqKh"})})]})]})})]})}function xa({shortcuts:t,onClose:n}){var p;const{_:i}=Qe(),{masto:s}=ae(),o=Ce(()=>!t||!t.filter(Boolean).length?"":zi.compressToEncodedURIComponent(JSON.stringify(t.filter(Boolean))),[t]),[a,h]=R(""),[r,c]=R("default"),l=Ce(()=>{if(!a)return c("default"),null;try{const u=JSON.parse(zi.decompressFromEncodedURIComponent(a));if(!Array.isArray(u))throw new Error("Not an array");return c("default"),u}catch{try{const y=JSON.parse(a);if(!Array.isArray(y))throw new Error("Not an array");return c("default"),y}catch{return c("error"),null}}},[a]),m=A.shortcuts.length>0,f=Y();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:b._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(d,{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(d,{id:"l3s5ri"})})]}),e("p",{class:"field-button",children:[e("input",{ref:f,type:"text",name:"import",placeholder:b._({id:"tBmklN"}),class:"block",onInput:u=>{h(u.target.value)},dir:"auto"}),A.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2 small",disabled:r==="cloud-downloading",onClick:async()=>{c("cloud-downloading");const u=wt();he(b._({id:"HLqLGx"}));try{const g=(await s.v1.accounts.relationships.fetch({id:[u]}))[0];if(g){const{note:w=""}=g;if(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/.test(w)){const v=w.match(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/)[1],{v:k,dt:x,data:S}=JSON.parse(v);f.current.value=S,f.current.dispatchEvent(new Event("input"))}}c("default")}catch{c("error"),he(b._({id:"gCDfX+"}))}},title:b._({id:"B6cG3J"}),children:[e(C,{icon:"cloud"}),e(C,{icon:"arrow-down"})]})]}),!!l&&Array.isArray(l)&&e(O,{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(u=>{var y,g;return e("li",{children:[e("span",{style:{opacity:t.some(w=>Object.keys(w).every(v=>w[v]===u[v]))?1:0},children:"*"}),e("span",{children:[i(Os[u.type]),u.type==="list"&&" ⚠️"," ",(g=(y=mn[u.type])==null?void 0:y.map)==null?void 0:g.call(y,({text:w,name:v,type:k})=>u[v]?e(O,{children:[e("span",{class:"tag collapsed insignificant",children:[w,":"," ",k==="checkbox"?u[v]==="on"?"✅":"❌":u[v]]})," "]}):null)]})]})})}),e("p",{children:[e("small",{children:e(d,{id:"o6sElH"})}),e("br",{}),e("small",{children:["⚠️"," ",e(d,{id:"N4z4P/"})]})]})]}),r==="error"&&e("p",{class:"error",children:e("small",{children:["⚠️ ",e(d,{id:"ZhsPEb"})]})}),e("p",{children:[m&&e(O,{children:[e(lt,{confirmLabel:b._({id:"6MzUUU"}),menuFooter:e("div",{class:"footer",children:e(d,{id:"nl8sCE"})}),onClick:()=>{const u=l.filter(w=>!A.shortcuts.some(v=>Object.keys(v).every(k=>v[k]===w[k])));if(!u.length){he(b._({id:"o6L30P"}));return}let y=[...A.shortcuts,...u];const g=y.length>vt;g&&(y=y.slice(0,vt)),A.shortcuts=y,he(g?b._({id:"SBmqmC",values:{SHORTCUTS_LIMIT:vt}}):b._({id:"QO9uTx"})),n==null||n()},children:e("button",{type:"button",class:"plain2",disabled:!l,children:e(d,{id:"c89gCv"})})})," "]}),e(lt,{confirmLabel:m?b._({id:"6ZjzWP"}):b._({id:"DWumLi"}),menuItemClassName:m?"danger":void 0,onClick:()=>{A.shortcuts=l,he(b._({id:"QO9uTx"})),n==null||n()},children:e("button",{type:"button",class:"plain2",disabled:!l,children:m?b._({id:"uIp8WL"}):b._({id:"Sjnlwj"})})})]})]}),e("section",{children:[e("h3",{children:[e(C,{icon:"arrow-up-circle",size:"l",class:"insignificant"})," ",e("span",{children:e(d,{id:"GS+Mus"})})]}),e("p",{children:e("input",{style:{width:"100%"},type:"text",value:o,readOnly:!0,onClick:u=>{if(u.target.value){u.target.select();try{navigator.clipboard.writeText(u.target.value),he(b._({id:"cWtH+v"}))}catch{he(b._({id:"yUWyHa"}))}}},dir:"auto"})}),e("p",{children:[e("button",{type:"button",class:"plain2",disabled:!o,onClick:()=>{try{navigator.clipboard.writeText(o),he(b._({id:"+Kq2vY"}))}catch{he(b._({id:"tFvxZF"}))}},children:[e(C,{icon:"clipboard"})," ",e("span",{children:e(d,{id:"he3ygx"})})]})," ",(navigator==null?void 0:navigator.share)&&((p=navigator==null?void 0:navigator.canShare)==null?void 0:p.call(navigator,{text:o}))&&e("button",{type:"button",class:"plain2",disabled:!o,onClick:()=>{try{navigator.share({text:o})}catch{alert(b._({id:"TtG3Uh"}))}},children:[e(C,{icon:"share"})," ",e("span",{children:e(d,{id:"Z8lGw6"})})]})," ",A.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2",disabled:r==="cloud-uploading",onClick:async()=>{c("cloud-uploading");const u=wt();try{const g=(await s.v1.accounts.relationships.fetch({id:[u]}))[0];if(g){const{note:w=""}=g;let v="";const k=JSON.stringify({v:"1",dt:Date.now(),data:o});/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/.test(w)?v=w.replace(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/,`<phanpy-shortcuts-settings>${k}</phanpy-shortcuts-settings>`):v=`${w}
|
||
|
||
|
||
<phanpy-shortcuts-settings>${k}</phanpy-shortcuts-settings>`,he(b._({id:"9ZYiLz"})),await s.v1.accounts.$select(u).note.create({comment:v}),c("default"),he(b._({id:"5w02SH"}))}}catch{c("error"),he(b._({id:"aVsTYo"}))}},title:b._({id:"gWd6Cu"}),children:[e(C,{icon:"cloud"}),e(C,{icon:"arrow-up"})]})," ",o.length>0&&e("small",{class:"insignificant ib",children:e(d,{id:"IPXOXm",values:{0:o.length}})})]}),!!o&&e("details",{children:[e("summary",{class:"insignificant",children:e("small",{children:e(d,{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(d,{id:"C4T6O/"})]})})]})]})}rs(A,t=>{for(const[n,i,s,o]of t)/^show/i.test(i)&&!s&&Kn()});function Aa(){var s,o,a,h,r,c,l,m;const t=qe(A),n=ls(),i=Gt();return ie(()=>{setTimeout(ho,1e3)},[]),e(O,{children:[!!t.showCompose&&e(Fe,{class:`solid ${t.composerState.minimized?"min":""}`,minimized:!!t.composerState.minimized,children:e(fo,{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:((h=A.showCompose)==null?void 0:h.draftStatus)||((r=window.__COMPOSE__)==null?void 0:r.draftStatus)||null,onClose:f=>{const{newStatus:p,instance:u,type:y}=f||{};A.showCompose=!1,window.__COMPOSE__=null,p&&(A.reloadStatusPage++,he({text:{post:b._({id:"aTyHBW"}),reply:b._({id:"lZdBKl"}),edit:b._({id:"a5BN7l"})}[y||"post"],delay:1e3,duration:1e4,onClick:g=>{g.hideToast(),A.prevLocation=i,n(u?`/${u}/s/${p.id}`:`/s/${p.id}`)}}))}})}),!!t.showSettings&&e(Fe,{onClose:()=>{A.showSettings=!1},children:e(_c,{onClose:()=>{A.showSettings=!1}})}),!!t.showAccounts&&e(Fe,{onClose:()=>{A.showAccounts=!1},children:e(uc,{onClose:()=>{A.showAccounts=!1}})}),!!t.showAccount&&e(Fe,{onClose:()=>{A.showAccount=!1},children:e(jc,{account:((c=t.showAccount)==null?void 0:c.account)||t.showAccount,instance:(l=t.showAccount)==null?void 0:l.instance,onClose:({destination:f}={})=>{A.showAccount=!1}})}),!!t.showDrafts&&e(Fe,{onClose:()=>{A.showDrafts=!1},children:e(Vc,{onClose:()=>A.showDrafts=!1})}),!!t.showMediaModal&&e(Fe,{onClick:f=>{(f.target===f.currentTarget||f.target.classList.contains("media"))&&(A.showMediaModal=!1)},children:e(Ps,{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(Ia,{onClose:()=>A.showShortcutsSettings=!1})}),!!t.showGenericAccounts&&e(Fe,{onClose:()=>{A.showGenericAccounts=!1},children:e(Wc,{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:f=>{A.showMediaAlt=!1},children:e(Zc,{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(Kc,{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(pa,{account:t.showReportModal.account,post:t.showReportModal.post,onClose:()=>{A.showReportModal=!1}})})]})}function Zn({accountID:t,onChange:n}){const{masto:i}=ae(),[s,o]=R("default"),[a,h]=R(null),[r,c]=R(null),l=r!==null;return e("p",{class:"follow-request-buttons",children:[e("button",{type:"button",disabled:s==="loading"||l,onClick:()=>{o("loading"),h("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(d,{id:"g3UF2V"})})," ",e("button",{type:"button",disabled:s==="loading"||l,class:"light danger",onClick:()=>{o("loading"),h("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(d,{id:"1t/NnN"})}),e("span",{class:"follow-request-states",children:l&&a?a==="accept"?e(C,{icon:"check-circle",alt:b._({id:"bzMKg7"}),class:"follow-accepted"}):e(C,{icon:"x-circle",alt:b._({id:"ekCRTP"}),class:"follow-rejected"}):e(Oe,{hidden:s!=="loading"})})]})}const Fi={mention:"comment",status:"notification",reblog:"rocket",follow:"follow",follow_request:"follow-add",favourite:"heart",poll:"poll",update:"pencil","admin.signup":"account-edit","admin.report":"account-warning",severed_relationships:"heart-break",moderation_warning:"alert",emoji_reaction:"emoji2","pleroma:emoji_reaction":"emoji2",annual_report:"celebrate"};function Hi({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(Mo,{url:s,staticUrl:o,alt:n}):n;return e(d,{id:"i5uN6K",values:{account:t,emojiObject:a}})}const Bn={status:({account:t})=>e(d,{id:"idiIxW",values:{account:t}}),reblog:({count:t,account:n,postsCount:i,postType:s,components:{Subject:o}})=>e(d,{id:"jkt9P5",values:{0:Ke(t),1:Ke(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(d,{id:"+71G9C",values:{0:Ke(n),count:n,account:t},components:{0:e(i,{clickable:n>1}),1:e("span",{title:n})}}),follow_request:({account:t})=>e(d,{id:"eh6NHW",values:{account:t}}),favourite:({account:t,count:n,postsCount:i,postType:s,components:{Subject:o}})=>e(d,{id:"RqX1mR",values:{0:Ke(n),1:Ke(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:()=>b._({id:"kIlJaS"}),"poll-self":()=>b._({id:"kpjzdN"}),"poll-voted":()=>b._({id:"moT7M8"}),update:()=>b._({id:"uzt17m"}),"favourite+reblog":({count:t,account:n,postsCount:i,postType:s,components:{Subject:o}})=>e(d,{id:"NunZZQ",values:{0:Ke(t),1:Ke(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(d,{id:"fJCCpx",values:{account:t}}),"admin.report":({account:t,targetAccount:n})=>e(d,{id:"eNfCmq",values:{account:t,targetAccount:n}}),severed_relationships:({name:t})=>e(d,{id:"Xl9v6+",values:{name:t},components:{0:e("i",{})}}),moderation_warning:()=>e("b",{children:e(d,{id:"YqffEv"})}),emoji_reaction:Hi,"pleroma:emoji_reaction":Hi,annual_report:({year:t})=>e(d,{id:"INLTzH",values:{year:t}})},Ea={account_suspension:({from:t,targetName:n})=>e(d,{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(d,{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(d,{id:"RQKWUa",values:{targetName:t,followersCount:n,followingCount:i},components:{0:e("i",{})}})},Ra={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"}},Fn=30;function La({notification:t,instance:n,isStatic:i,disableContextMenu:s}){var U,W,de,Q,me,ke,ue;const{_:o}=Qe(),{masto:a}=ae(),{id:h,status:r,account:c,report:l,event:m,moderation_warning:f,annualReport:p,_ids:u,_accounts:y,_statuses:g,_groupKeys:w,sampleAccounts:v,notificationsCount:k,groupKey:x}=t;let{type:S}=t;if(S==="mention"&&!r)return null;const I=(r==null?void 0:r.reblog)||r,_=I==null?void 0:I.id,T=wt(),$=T===(c==null?void 0:c.id),D=(U=r==null?void 0:r.poll)==null?void 0:U.voted,M=!!(r!=null&&r.inReplyToAccountId)&&(r==null?void 0:r.inReplyToAccountId)!==T&&((W=r==null?void 0:r.account)==null?void 0:W.id)===T;let G=0,te=0;if(S==="favourite+reblog"){if(y)for(const j of y)(de=j._types)!=null&&de.includes("favourite")&&G++,(Q=j._types)!=null&&Q.includes("reblog")&&te++;!te&&G&&(S="favourite"),!G&&te&&(S="reblog")}let B;S==="poll"?B=Bn[$?"poll-self":D?"poll-voted":"poll"]:Bn[S]?B=Bn[S]:B=b._({id:"ODqZt1",values:{type:S}});const V=({clickable:j,...be})=>j?e("b",{tabIndex:"0",onClick:ne,...be}):e("b",{...be});if(typeof B=="function"){const j=(y==null?void 0:y.length)||(v==null?void 0:v.length)||(c?1:0),be=(g==null?void 0:g.length)||(r?1:0);if(S==="admin.report"){const Re=l==null?void 0:l.targetAccount;Re&&(B=B({account:e(ht,{account:c,showAvatar:!0}),targetAccount:e(ht,{account:Re,showAvatar:!0})}))}else if(S==="severed_relationships"){const Re=m==null?void 0:m.targetName;Re&&(B=B({name:Re}))}else if((S==="emoji_reaction"||S==="pleroma:emoji_reaction")&&t.emoji){const Re=t.emoji_url||((ke=(me=r==null?void 0:r.emojis)==null?void 0:me.find)==null?void 0:ke.call(me,xe=>(xe==null?void 0:xe.shortcode)===t.emoji.replace(/^:/,"").replace(/:$/,"")));B=B({account:e(ht,{account:c,showAvatar:!0}),emoji:t.emoji,emojiURL:Re})}else S==="annual_report"?B=B({...t.annualReport}):B=B({account:c?e(ht,{account:c,showAvatar:!0}):(v==null?void 0:v[0])&&e(ht,{account:v[0],showAvatar:!0}),count:j,postsCount:be,postType:M?"reply":"post",components:{Subject:V}})}const z=t.createdAt&&new Date(t.createdAt).toLocaleString(),H={"favourite+reblog":b._({id:"+XOeb+"}),favourite:b._({id:"LQFF6J"}),reblog:b._({id:"phQpSa"}),follow:b._({id:"Ih01jh"})}[S]||b._({id:"bPwFdf"}),ne=()=>{A.showGenericAccounts={heading:H,accounts:y,showReactions:S==="favourite+reblog",excludeRelationshipAttrs:S==="follow"?["followedBy"]:[],postID:it(_,n)}},q=k>0&&k>(v==null?void 0:v.length)?"remote":"local";if(r!=null&&r.filtered){const j=((ue=r==null?void 0:r.account)==null?void 0:ue.id)===T,be=Ht(r.filtered,"notifications");if(!$&&!j&&(be==null?void 0:be.action)==="hide")return null}return e("div",{class:`notification notification-${S}`,"data-notification-id":u||h,"data-group-key":(w==null?void 0:w.join(" "))||x,tabIndex:"0",children:[e("div",{class:`notification-type notification-${S}`,title:z,children:S==="favourite+reblog"?e(O,{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:Fi[S]||"notification",size:"xl",alt:S})}),e("div",{class:"notification-content",children:[S!=="mention"&&e(O,{children:[e("p",{children:B}),S==="follow_request"&&e(Zn,{accountID:c.id}),S==="severed_relationships"&&e("div",{children:[Ea[m.type]({from:n,...m}),e("br",{}),e("a",{href:`https://${n}/severed_relationships`,target:"_blank",rel:"noopener noreferrer",children:e(d,{id:"YL6Y8P",components:{0:e(C,{icon:"external",size:"s"})}})}),"."]}),S==="moderation_warning"&&!!f&&e("div",{children:[o(Ra[f.action]()),e("br",{}),e("a",{href:`/disputes/strikes/${f.id}`,target:"_blank",rel:"noopener noreferrer",children:e(d,{id:"YL6Y8P",components:{0:e(C,{icon:"external",size:"s"})}})})]}),S==="annual_report"&&e("div",{children:e(fe,{to:`/annual_report/${p==null?void 0:p.year}`,children:e(d,{id:"5PGPvG"})})})]}),(y==null?void 0:y.length)>1&&e("p",{class:"avatars-stack",children:[y.slice(0,Fn).map(j=>e(O,{children:[e("a",{href:j.url,rel:"noopener noreferrer",class:"account-avatar-stack",onClick:be=>{be.preventDefault(),A.showAccount=j},children:[e(dt,{url:j.avatarStatic,size:y.length<=10?"xxl":y.length<20?"xl":"l",alt:`${j.displayName} @${j.acct}`,squircle:j==null?void 0:j.bot},j.id),S==="favourite+reblog"&&e("div",{class:"account-sub-icons",children:j._types.map(be=>e(C,{icon:Fi[be],size:"s",class:`${be}-icon`}))})]},j.id)," "]},j.id)),S==="favourite+reblog"&&q==="remote"?e("button",{type:"button",class:"small plain","data-group-keys":w==null?void 0:w.join(" "),onClick:()=>{A.showGenericAccounts={heading:H,fetchAccounts:async()=>{const j=await Promise.allSettled(w.map(async Re=>{const xe=a.v2.notifications.$select(Re).accounts.list();return[Re,(await xe.next()).value]})),be=[];for(const Re of j){const[xe,Ne]=Re.value,Pe=/^favourite/.test(xe)?"favourite":/^reblog/.test(xe)?"reblog":null;if(Pe)for(const _e of Ne){const J=be.find(ge=>ge.id===_e.id);J?J._types.push(Pe):(_e._types=[Pe],be.push(_e))}}return{done:!0,value:be}},showReactions:!0,postID:it(_,n)}},children:e(C,{icon:"chevron-down"})}):e("button",{type:"button",class:"small plain",onClick:ne,children:[y.length>Fn&&`+${y.length-Fn}`,e(C,{icon:"chevron-down"})]})]}),!(y!=null&&y.length)&&(v==null?void 0:v.length)>1&&e("p",{class:"avatars-stack",children:[v.map(j=>e(O,{children:[e("a",{href:j.url,rel:"noopener noreferrer",class:"account-avatar-stack",onClick:be=>{be.preventDefault(),A.showAccount=j},children:e(dt,{url:j.avatarStatic,size:"xxl",alt:`${j.displayName} @${j.acct}`,squircle:j==null?void 0:j.bot},j.id)},j.id)," "]},j.id)),k>v.length&&e(fe,{to:n?`/${n}/s/${r.id}`:`/s/${r.id}`,class:"button small plain centered",children:["+",k-v.length,e(C,{icon:"chevron-right"})]})]}),(g==null?void 0:g.length)>1&&e("ul",{class:"notification-group-statuses",children:g.map(j=>e("li",{children:e(qi,{class:`status-link status-type-${S}`,to:n?`/${n}/s/${j.id}`:`/s/${j.id}`,children:e(Ye,{status:j,size:"s",previewMode:!0,allowContextMenu:!0})})},j.id))}),r&&(!(g!=null&&g.length)||(g==null?void 0:g.length)<=1)&&e(qi,{class:`status-link status-type-${S}`,to:n?`/${n}/s/${_}`:`/s/${_}`,onContextMenu:s?void 0:j=>{const be=j.target.querySelector(".status");if(be){if(j.metaKey)return;j.preventDefault(),be.dispatchEvent(new MouseEvent("contextmenu",{clientX:j.clientX,clientY:j.clientY}))}},children:i?e(Ye,{status:I,size:"s",readOnly:!0,allowContextMenu:!0}):e(Ye,{statusID:_,size:"s",readOnly:!0,allowContextMenu:!0})})]})]})}function qi(t){const n=Do();return e(fe,{...t,"data-read-more":b._({id:"8fZueG"}),ref:n})}const on=st(La,(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 $a=st(function(){if(!("serviceWorker"in navigator))return null;const n=qe(A),{routeNotification:i}=n,{id:s,accessToken:o}=i||{},[a,h]=R(!1);gt(()=>{if(!s||!o)return;const{instance:c}=ae(),{masto:l,instance:m}=ae({accessToken:o}),f=c===m,p=o?po(o):ti();(async()=>{const u=await l.v1.notifications.$select(s).fetch();if(u&&p){const y=p.instanceURL,{type:g,status:w,account:v}=u,k=!!document.querySelector("#modal-container > *"),x=g==="follow"&&!!(v!=null&&v.id),S=!!(v!=null&&v.id),I=!!(w!=null&&w.id);x&&f?A.showAccount={account:v,instance:y}:k||!f||S&&I?h({id:s,account:p,notification:u,sameInstance:f}):I?location.hash=`/${c}/s/${w.id}`:x?location.hash=`/${c}/a/${v.id}`:location.hash="/notifications"}})()},[s,o]),gt(()=>{navigator!=null&&navigator.clearAppBadge&&navigator.clearAppBadge()},[]),qt(c=>{c&&(navigator!=null&&navigator.clearAppBadge)&&navigator.clearAppBadge()});const r=()=>{h(!1),A.routeNotification=null,/\/notifications\?id=/i.test(location.hash)&&(location.hash="/notifications")};if(a){const{id:c,account:l,notification:m,sameInstance:f}=a;return e(Fe,{onClick:p=>{p.target===p.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:b._({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(d,{id:"5+87Pq"})})}),e("main",{children:[!f&&e("p",{children:e(d,{id:"k9N0Xk"})}),e("div",{class:"notification-peek",onClick:p=>{const{target:u}=p;(p.target.tagName==="BUTTON"||p.target.tagName==="A")&&r()},children:e(on,{instance:l.instanceURL,notification:m,isStatic:!0})}),e("div",{style:{textAlign:"end"},children:e(fe,{to:"/notifications",class:"button light",onClick:r,children:[e("span",{children:e(d,{id:"/WA/tl"})})," ",e(C,{icon:"arrow-right"})]})})]})]})})}return null}),zs=go((t,n)=>{const{instance:i}=ae(),[s,o]=pt(),[a,h]=R(!1),[r,c]=R(s.get("q")||""),l=s.get("type"),m=Y(null),f=Y(null);return mo(n,()=>({setValue:p=>{c(p)},focus:()=>{f.current.focus()},select:()=>{f.current.select()},blur:()=>{f.current.blur()}})),e("form",{ref:m,class:"search-popover-container",onSubmit:p=>{var y;if(p.preventDefault(),/\/search/.test(location.hash))if(r){const g={q:r};l&&(g.type=l),o(g)}else o({});else r?location.hash=`/search?q=${encodeURIComponent(r)}${l?`&type=${l}`:""}`:location.hash="/search";(y=t==null?void 0:t.onSubmit)==null||y.call(t,p)},children:[e("input",{ref:f,value:r,name:"q",type:"search",placeholder:b._({id:"A1taO8"}),dir:"auto",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",onSearch:p=>{p.target.value||o({})},onInput:p=>{c(p.target.value),h(!0)},onFocus:()=>{var p,u;h(!0),(u=(p=m.current)==null?void 0:p.querySelector(".search-popover-item"))==null||u.classList.add("focus")},onBlur:()=>{var p,u;setTimeout(()=>{h(!1)},100),(u=(p=m.current)==null?void 0:p.querySelector(".search-popover-item.focus"))==null||u.classList.remove("focus")},onKeyDown:p=>{var y;const{key:u}=p;switch(u){case"Escape":h(!1);break;case"Down":case"ArrowDown":if(p.preventDefault(),a){const g=m.current.querySelector(".search-popover-item.focus");if(g){let w=g.nextElementSibling;for(;w&&w.hidden;)w=w.nextElementSibling;w&&(w.classList.add("focus"),Array.from(w.parentElement.children).filter(k=>k!==w).forEach(k=>{k.classList.remove("focus")}))}else{const w=m.current.querySelector(".search-popover-item");w&&w.classList.add("focus")}}break;case"Up":case"ArrowUp":if(p.preventDefault(),a){const g=document.querySelector(".search-popover-item.focus");if(g){let w=g.previousElementSibling;for(;w&&w.hidden;)w=w.previousElementSibling;w&&(w.classList.add("focus"),Array.from(w.parentElement.children).filter(k=>k!==w).forEach(k=>{k.classList.remove("focus")}))}else{const w=document.querySelector(".search-popover-item:last-child");w&&w.classList.add("focus")}}break;case"Enter":if(a){const g=document.querySelector(".search-popover-item.focus");g&&(p.preventDefault(),g.click()),h(!1),(y=t==null?void 0:t.onSubmit)==null||y.call(t,p)}break}}}),e("div",{class:"search-popover",hidden:!a||!r,children:!!r&&[{label:e(d,{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(d,{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(d,{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(d,{id:"gEoOUj",values:{query:r},components:{0:e("mark",{})}}),to:`/${r}`,hidden:!/^https?:/.test(r),top:/^https?:/.test(r),type:"link"},{label:e(d,{id:"cDoNQr",values:{query:r},components:{0:e("q",{})}}),to:`/search?q=${encodeURIComponent(r)}&type=accounts`,icon:"group",queryType:"accounts"}].sort((p,u)=>{if(l){if(p.queryType===l)return-1;if(u.queryType===l)return 1}return p.top&&!u.top?-1:!p.top&&u.top?1:0}).filter(({hidden:p})=>!p).map(({label:p,to:u,icon:y,type:g},w)=>e(fe,{to:u,class:`search-popover-item ${w===0?"focus":""}`,onClick:v=>{var k;(k=t==null?void 0:t.onSubmit)==null||k.call(t,v)},children:[e(C,{icon:y||(g==="link"?"arrow-right":"search"),class:"more-insignificant"}),e("span",{children:p})," "]}))})]})}),Ma=st(function({onClose:n=()=>{}}){const[i,s]=R(!1),o=Y(null);Ue(["Slash","/"],h=>{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:h=>{const r=/\/search/.test(location.hash),c=!!document.querySelector("#modal-container > *");return r||c}});const a=()=>{s(!1),n()};return Ue("esc",h=>{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:h=>{h.target===h.currentTarget&&a()},children:e(zs,{ref:o,onSubmit:()=>{a()}})})});function Da(){const{_:t}=Qe(),{instance:n}=ae(),i=qe(A),{shortcuts:s,settings:o}=i;if(!s.length)return null;const a=o.shortcutsViewMode==="multi-column"||!o.shortcutsViewMode&&o.shortcutsColumnsMode;if(a)return null;const h=Y(),r=Y(!1),c=s.map((p,u)=>{const{type:y,...g}=p;if(!In[y])return null;let{id:w,path:v,title:k,subtitle:x,icon:S}=In[y];return typeof w=="function"&&(w=w(g,u)),typeof v=="function"&&(v=v({...g,instance:g.instance||n},u)),typeof k=="function"?k=k(g,u):k=t(k),typeof x=="function"?x=x(g,u):x=t(x),typeof S=="function"&&(S=S(g,u)),w==="lists"&&(r.current=!0),{id:w,path:v,title:k,subtitle:x,icon:S}}).filter(Boolean),l=ls();Ue(["1","2","3","4","5","6","7","8","9"],(p,u)=>{var g,w;const y=parseInt(u.keys[0],10)-1;if(y<c.length){const{path:v}=c[y];v&&(l(v),(w=(g=h.current)==null?void 0:g.closeMenu)==null||w.call(g))}},{enabled:!a});const[m,f]=R([]);return e("div",{id:"shortcuts",children:i.settings.shortcutsViewMode==="tab-menu-bar"?e("nav",{class:"tab-bar",onContextMenu:p=>{p.preventDefault(),A.showShortcutsSettings=!0},children:e("ul",{children:c.map(({id:p,path:u,title:y,subtitle:g,icon:w},v)=>e("li",{children:e(fe,{class:g?"has-subtitle":"",to:u,onClick:k=>{if(k.target.classList.contains("is-active")){k.preventDefault();const x=document.getElementById(`${p}-page`);if(x){x.scrollTop=0;const S=x.querySelector(".updates-button");S&&S.click()}}},children:[e(C,{icon:w,size:"xl",alt:y}),e("span",{children:[e(pn,{children:y}),g&&e(O,{children:[e("br",{}),e("small",{children:g})]})]})]})},`${v}-${p}-${y}-${g}-${u}`))})}):e(at,{instanceRef:h,overflow:"auto",viewScroll:"close",menuClassName:"glass-menu shortcuts-menu",gap:8,position:"anchor",onMenuChange:p=>{p.open&&r.current&&cn().then(f)},menuButton:e("button",{type:"button",id:"shortcuts-button",class:"plain",onContextMenu:p=>{p.preventDefault(),A.showShortcutsSettings=!0},onTransitionStart:p=>{var u,y;try{const{target:g}=p;getComputedStyle(g).pointerEvents==="none"&&((y=(u=h.current)==null?void 0:u.closeMenu)==null||y.call(u))}catch{}},children:e(C,{icon:"shortcut",size:"xl",alt:b._({id:"CTqTgr"})})}),children:c.map(({id:p,path:u,title:y,subtitle:g,icon:w},v)=>p==="lists"?e(xn,{menuClassName:"glass-menu",overflow:"auto",gap:-8,label:e(O,{children:[e(C,{icon:w,size:"l"}),e("span",{class:"menu-grow",children:e(pn,{children:y})}),e(C,{icon:"chevron-right"})]}),children:[e(Be,{to:"/l",children:e("span",{children:e(d,{id:"BHWx+g"})})}),e(Ge,{}),m==null?void 0:m.map(k=>e(Be,{to:`/l/${k.id}`,children:e("span",{children:k.title})},k.id))]}):e(Be,{to:u,class:"glass-menu-item",children:[e(C,{icon:w,size:"l"})," ",e("span",{class:"menu-grow",children:[e("span",{children:e(pn,{children:y})}),g&&e(O,{children:[" ",e("small",{class:"more-insignificant",children:g})]})]}),e("span",{class:"menu-shortcut hide-until-focus-visible",children:v+1})]},`${v}-${p}-${y}-${g}-${u}`))})})}const Na=st(Da);function Pa(t){var o;let n=[],i=[],s=0;for(let a=0;a<t.length;a++){const h=t[a];h.reblog&&!((o=h.account)!=null&&o.group)?(i.push(h),s++):(n.push(h),s<3&&(s=0))}if(t.length>10&&(i.length>t.length/4||s>=3)){const a=i.map(h=>h.id);if(i.length>t.length*3/4)n=[...n,{id:a,items:i,type:"boosts"}];else{const h=Math.floor(n.length/2);n=[...n.slice(0,h),{id:a,items:i,type:"boosts"},...n.slice(h)]}return n}else return t}function Yi(t,n){const i=ve.account.get("boostedStatusIDs")||{},s=t.filter(a=>{if(!a.reblog)return!0;const h=`${n}-${a.reblog.id}`,r=i[h];return r&&r!==a.id?!1:(i[h]=a.id,!0)}),o=Object.keys(i);return o.length>50&&o.slice(0,o.length-50).forEach(a=>{delete i[a]}),ve.account.set("boostedStatusIDs",i),s}function Oa(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,f,p)=>p.findIndex(u=>u.id===m.id)===f),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=[],h=[];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((f,p)=>{const u=new Date(f.createdAt),y=new Date(p.createdAt);return u-y});const m=l[0].account.id;o.push({id:l.map(f=>f.id),items:l,type:l.every(f=>f.account.id===m)?"thread":"conversation"}),a.push(c);return}if(r.inReplyToId&&r.inReplyToAccountId!==r.account.id){const c=it(r.id,n);A.statusReply[c]||h.push({sKey:c,inReplyToId:r.inReplyToId})}o.push(r)}),h!=null&&h.length&&queueMicrotask(()=>{const{masto:r}=ae({instance:n});async function c(){for(let l=0;l<h.length;l++){const{sKey:m,inReplyToId:f}=h[l];try{const p=await za(f,r);We(p,n,{skipThreading:!0}),A.statusReply[m]={id:p.id,instance:n},await new Promise(u=>setTimeout(u,1e3))}catch{}}}if(Ze("@mastodon/fetch-multiple-statuses")){const l=h.map(({inReplyToId:m})=>m);(async()=>{var m;try{const f=await r.v1.statuses.list({id:l});if(f!=null&&f.length)for(const p of f){We(p,n,{skipThreading:!0});const u=(m=h.find(({inReplyToId:y})=>y===p.id))==null?void 0:m.sKey;u&&(A.statusReply[u]={id:p.id,instance:n})}else c()}catch{c()}})()}else c()}),o}const za=_t((t,n)=>n.v1.statuses.$select(t).fetch());async function Us(t,n){const i=await ka();if(!i.length)return;const{statusFollowedTags:s}=A,o=[];if(t.forEach(a=>{var p;if(a.reblog)return;const{id:h,content:r,tags:c=[]}=a,l=it(h,n);if((p=s[l])!=null&&p.length)return;const m=_a(r);if(!m.length&&!c.length)return;const f=i.reduce((u,y)=>((m.some(g=>g.toLowerCase()===y.name.toLowerCase())||c.some(g=>g.name.toLowerCase()===y.name.toLowerCase()))&&u.push(y.name),u),[]);f.length&&o.push({item:a,sKey:l,followedTags:f})}),o.length){const a=o.map(r=>r.item.account),h=await oi(a);if(!h)return;o.forEach(r=>{const{item:c,sKey:l,followedTags:m}=r,f=h[c.account.id];f&&!f.following&&(s[l]=m)})}}function Ua(){A.statusFollowedTags={}}function Ba({scrollableRef:t,distanceFromStart:n=1,distanceFromEnd:i=1,scrollThresholdStart:s=10,scrollThresholdEnd:o=10,direction:a="vertical",distanceFromStartPx:h,distanceFromEndPx:r}={}){const[c,l]=R(null),[m,f]=R(!1),[p,u]=R(!1),[y,g]=R(!1),[w,v]=R(!1),k=a==="vertical";return gt(()=>{const x=t.current;if(!x)return{};let S=k?x.scrollTop:x.scrollLeft;function I(){const{scrollTop:_,scrollLeft:T,scrollHeight:$,scrollWidth:D,clientHeight:M,clientWidth:G}=x,te=k?_:T,B=k?$:D,V=k?M:G,z=Math.abs(te-S),H=h||Math.min(V*n,B,te),ne=r||Math.min(V*i,B,B-te-V);z>=(S<te?o:s)&&(l(S<te?"end":"start"),S=te),f(te<=0),u(te+V>=B),g(te<=H),v(te+V>=B-ne)}return x.addEventListener("scroll",I,{passive:!0}),()=>x.removeEventListener("scroll",I)},[n,i,s,o]),{scrollDirection:c,reachStart:m,reachEnd:p,nearReachStart:y,nearReachEnd:w,init:()=>{t.current&&t.current.dispatchEvent(new Event("scroll"))}}}function Fa({scrollableRef:t,distanceFromStart:n=1,distanceFromEnd:i=1,scrollThresholdStart:s=10,scrollThresholdEnd:o=10,direction:a="vertical",distanceFromStartPx:h,distanceFromEndPx:r,init:c}={},l,m){if(!l)return;const f=a==="vertical",p=Y(null),u=Y(null),y=No(()=>{let g=!1,w=!1,v=!1,k=!1;const x=t.current,{scrollTop:S,scrollLeft:I,scrollHeight:_,scrollWidth:T,clientHeight:$,clientWidth:D}=x,M=f?S:I,G=f?_:T,te=f?$:D,B=Math.abs(M-p.current),V=h||Math.min(te*n,G,M),z=r||Math.min(te*i,G,G-M-te);B>=(p.current<M?o:s)&&(u.current=p.current<M?"end":"start",p.current=M),g=M<=0,w=M+te>=G,v=M<=V,k=M+te>=G-z,l({scrollDirection:u.current,reachStart:g,reachEnd:w,nearReachStart:v,nearReachEnd:k})},500);gt(()=>{const g=t.current;return g?(p.current=g[f?"scrollTop":"scrollLeft"],g.addEventListener("scroll",y,{passive:!0}),()=>g.removeEventListener("scroll",y)):{}},[n,i,s,o,...m]),ie(()=>{c&&t.current&&queueMicrotask(()=>{t.current.dispatchEvent(new Event("scroll"))})},[c])}function Ha({class:t,statusID:n,status:i,instance:s,parent:o,onMediaClick:a}){let h=it(n,s);const r=qe(A);if(i||(i=r.statuses[h]||r.statuses[n],h=it(i==null?void 0:i.id,s)),!i)return null;const{account:{acct:c,avatar:l,avatarStatic:m,id:f,url:p,displayName:u,username:y,emojis:g,bot:w,group:v},id:k,repliesCount:x,reblogged:S,reblogsCount:I,favourited:_,favouritesCount:T,bookmarked:$,poll:D,muted:M,sensitive:G,spoilerText:te,visibility:B,language:V,editedAt:z,filtered:H,card:ne,createdAt:L,inReplyToId:q,inReplyToAccountId:U,content:W,mentions:de,mediaAttachments:Q,reblog:me,uri:ke,url:ue,emojis:j,_deleted:be,_pinned:Re}=i;if(!(Q!=null&&Q.length))return null;const xe=we=>{we.shiftKey},Ne=Ce(()=>wt(),[]),Pe=Ce(()=>Ne&&Ne===f,[f,Ne]),_e=bo(bs),J=!Pe&&Ht(H,_e);if((J==null?void 0:J.action)==="hide")return null;const ge=G,le=Ce(()=>{var P;return((P=(ve.account.get("preferences")||{})["reading:expand:media"])==null?void 0:P.toLowerCase())||"default"},[])==="show_all",X=o||"div";return Q.map((we,P)=>{const ee=`${h}-${we.id}`,re=J==null?void 0:J.titlesStr;return e(X,{"data-state-post-id":h,onMouseEnter:xe,"data-spoiler-text":te||(G?b._({id:"FKojeB"}):void 0),"data-filtered-text":J?re?b._({id:"7FGvtQ",values:{filterTitleStr:re}}):b._({id:"03Qqf9"}):void 0,class:`
|
||
media-post
|
||
${J?"filtered":""}
|
||
${ge?"has-spoiler":""}
|
||
${le?"show-media":""}
|
||
`,children:e(gs,{class:t,media:we,lang:V,to:`/${s}/s/${k}?media-only=${P+1}`,onClick:a?N=>a(N,P,we,i):void 0})},ee)})}const ji=st(Ha);function qa(t){var k,x,S,I,_;const n=qe(A),{masto:i,instance:s,authenticated:o}=ae(),[a,h]=Ce(()=>{const T=ve.local.getJSON("accounts")||[];return[T.find(D=>D.info.id===wt())||T[0],T.length>1]},[]),r=(n.settings.shortcutsViewMode==="multi-column"||!n.settings.shortcutsViewMode&&n.settings.shortcutsColumnsMode)&&!n.shortcuts.find(T=>T.type==="following"),c=Po(()=>{A.showAccounts=!0},{threshold:600,detect:"touch",cancelOnMovement:!0}),l=Y(),[m,f]=R(void 0),p=Oo([0,0,n.settings.shortcutsViewMode==="tab-menu-bar"?50:0,0]),u=Y();async function y(T){return(T||!u.current)&&(u.current=i.v1.mutes.list({limit:80})),await u.current.next()}const g=Y();async function w(T){return(T||!g.current)&&(g.current=i.v1.blocks.list({limit:80})),await g.current.next()}const v=Y();return e(O,{children:[e("button",{ref:l,type:"button",class:`button plain nav-menu-button ${h?"with-avatar":""} ${m==="open"?"active":""}`,style:{position:"relative"},onClick:()=>{v.current=Date.now(),f(T=>T?void 0:"open")},onContextMenu:T=>{T.preventDefault(),A.showAccounts=!0},...c(),children:[h&&e(dt,{url:((k=a==null?void 0:a.info)==null?void 0:k.avatar)||((x=a==null?void 0:a.info)==null?void 0:x.avatarStatic),size:"l",squircle:(S=a==null?void 0:a.info)==null?void 0:S.bot}),e(C,{icon:"menu",size:h?"s":"l",alt:b._({id:"zucql+"})})]}),e(ys,{menuClassName:"nav-menu",state:m,anchorRef:l,onClose:()=>{f(void 0)},containerProps:{style:{zIndex:10},onClick:()=>{Date.now()-v.current<300}},portal:{target:document.body},...t,overflow:"auto",viewScroll:"close",position:"anchor",align:"center",boundingBoxPadding:p,unmountOnClose:!0,children:[!!((I=n.appVersion)!=null&&I.commitHash)&&n.appVersion.commitHash!=="7e1ffc5"&&e("div",{class:"top-menu",children:[e(Se,{onClick:()=>{confirm(b._({id:"Djbaby"}))&&(async()=>{try{location.reload()}catch{}})()},children:[e(C,{icon:"sparkles",class:"sparkle-icon",size:"l"})," ",e("span",{children:e(d,{id:"95IFnD"})})]}),e(Ge,{})]}),e("section",{children:[e(Be,{to:"/",children:[e(C,{icon:"home",size:"l"})," ",e("span",{children:e(d,{id:"i0qMbr"})})]}),o?e(O,{children:[r&&e(Be,{to:"/following",children:[e(C,{icon:"following",size:"l"})," ",e("span",{children:e(d,{id:"following.title"})})]}),e(Be,{to:"/catchup",children:[e(C,{icon:"history2",size:"l"}),e("span",{children:e(d,{id:"xrl8fj"})})]}),Ze("@mastodon/mentions")&&e(Be,{to:"/mentions",children:[e(C,{icon:"at",size:"l"})," ",e("span",{children:e(d,{id:"/bZzdR"})})]}),e(Be,{to:"/notifications",children:[e(C,{icon:"notification",size:"l"})," ",e("span",{children:e(d,{id:"iDNBZe"})}),n.notificationsShowNew&&e("sup",{title:b._({id:"isRobC"}),style:{opacity:.5},children:[" ","•"]})]}),e(Ge,{}),((_=a==null?void 0:a.info)==null?void 0:_.id)&&e(Be,{to:`/${s}/a/${a.info.id}`,children:[e(C,{icon:"user",size:"l"})," ",e("span",{children:e(d,{id:"vERlcd"})})]}),e(Ya,{menuState:m}),e(Be,{to:"/b",children:[e(C,{icon:"bookmark",size:"l"})," ",e("span",{children:e(d,{id:"7Ff7ia"})})]}),e(xn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(O,{children:[e(C,{icon:"more",size:"l"}),e("span",{class:"menu-grow",children:e(d,{id:"24misb"})}),e(C,{icon:"chevron-right"})]}),children:[e(Be,{to:"/f",children:[e(C,{icon:"heart",size:"l"})," ",e("span",{children:e(d,{id:"zZOZj7"})})]}),e(Be,{to:"/fh",children:[e(C,{icon:"hashtag",size:"l"})," ",e("span",{children:e(d,{id:"Xi1/bw"})})]}),e(Ge,{}),Ze("@mastodon/filters")&&e(Be,{to:"/ft",children:[e(C,{icon:"filters",size:"l"})," ",e("span",{children:e(d,{id:"cSev+j"})})]}),e(Se,{onClick:()=>{A.showGenericAccounts={id:"mute",heading:b._({id:"sOKhEA"}),fetchAccounts:y,excludeRelationshipAttrs:["muting"]}},children:[e(C,{icon:"mute",size:"l"})," ",e("span",{children:e(d,{id:"n1sANU"})})]}),e(Se,{onClick:()=>{A.showGenericAccounts={id:"block",heading:b._({id:"nL8nlr"}),fetchAccounts:w,excludeRelationshipAttrs:["blocking"]}},children:[e(C,{icon:"block",size:"l"})," ",e("span",{children:e(d,{id:"r3RRWo"})})]})," "]}),e(Ge,{}),e(Se,{onClick:()=>{A.showAccounts=!0},children:[e(C,{icon:"group",size:"l"})," ",e("span",{children:e(d,{id:"7e0O8Z"})})]})]}):e(O,{children:[e(Ge,{}),e(Be,{to:"/login",children:[e(C,{icon:"user",size:"l"})," ",e("span",{children:e(d,{id:"sQia9P"})})]})]})]}),e("section",{children:[e(Ge,{}),e(Be,{to:"/search",children:[e(C,{icon:"search",size:"l"})," ",e("span",{children:e(d,{id:"A1taO8"})})]}),e(Be,{to:`/${s}/trending`,children:[e(C,{icon:"chart",size:"l"})," ",e("span",{children:e(d,{id:"4/iCqx"})})]}),e(Be,{to:`/${s}/p/l`,children:[e(C,{icon:"building",size:"l"})," ",e("span",{children:e(d,{id:"d5zxa4"})})]}),e(Be,{to:`/${s}/p`,children:[e(C,{icon:"earth",size:"l"})," ",e("span",{children:e(d,{id:"4ERYY7"})})]}),o?e(O,{children:[e(Ge,{className:"divider-grow"}),e(Se,{onClick:()=>{A.showKeyboardShortcutsHelp=!0},children:[e(C,{icon:"keyboard",size:"l"})," ",e("span",{children:e(d,{id:"77Emn0"})})]}),e(Se,{onClick:()=>{A.showShortcutsSettings=!0},children:[e(C,{icon:"shortcut",size:"l"})," ",e("span",{children:e(d,{id:"8Kudkr"})})]}),e(Se,{onClick:()=>{A.showSettings=!0},children:[e(C,{icon:"gear",size:"l"})," ",e("span",{children:e(d,{id:"uVbUP8"})})]})]}):e(O,{children:[e(Ge,{}),e(Se,{onClick:()=>{A.showSettings=!0},children:[e(C,{icon:"gear",size:"l"})," ",e("span",{children:e(d,{id:"uVbUP8"})})]})]})]})]})]})}function Ya({menuState:t}){const n=Ze("@mastodon/lists"),[i,s]=R([]);return ie(()=>{n&&t==="open"&&cn().then(s)},[t,n]),i.length>0?e(xn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(O,{children:[e(C,{icon:"list",size:"l"}),e("span",{class:"menu-grow",children:e(d,{id:"h16FyT"})}),e(C,{icon:"chevron-right"})]}),children:[e(Be,{to:"/l",children:e("span",{children:e(d,{id:"BHWx+g"})})}),(i==null?void 0:i.length)>0&&e(O,{children:[e(Ge,{}),i.map(o=>e(Be,{to:`/l/${o.id}`,children:e("span",{children:o.title})},o.id))]})]}):n&&e(Be,{to:"/l",children:[e(C,{icon:"list",size:"l"}),e("span",{children:e(d,{id:"h16FyT"})})]})}const Pt=st(qa),rn={block:"nearest",inline:"center",behavior:"smooth"};function St({title:t,titleComponent:n,id:i,instance:s,emptyText:o,errorText:a,useItemID:h,boostsCarousel:r,fetchItems:c=()=>{},checkForUpdates:l=()=>{},checkForUpdatesInterval:m=15e3,headerStart:f,headerEnd:p,timelineStart:u,refresh:y,view:g,filterContext:w,showFollowedTags:v,showReplyParent:k,clearWhenRefresh:x}){const S=qe(A),[I,_]=R([]),[T,$]=R("start"),[D,M]=R(!1),[G,te]=R(!1),[B,V]=R(!0),z=Y();__BENCHMARK.start(`timeline-${i}-load`);const H=Ce(()=>ni(),[]),ne=g!=="media",L=Y(0),q=zo(J=>{te(!1),$("loading"),(async()=>{try{const ge=L.current=Date.now();let{done:Ee,value:le}=await c(J);if(ge!==L.current)return;if(Array.isArray(le)){const[X,we]=le.reduce((P,ee)=>(ee._pinned?P[0].push(ee):P[1].push(ee),P),[[],[]]);le=we,ne&&(r&&(le=Pa(le)),le=Oa(le,s)),X.length&&(le=X.concat(le)),_(J?le:P=>[...P,...le]),le.length||(Ee=!0),M(!Ee)}else M(!1);$("default"),__BENCHMARK.end(`timeline-${i}-load`)}catch{$("error"),J&&!I.length&&a&&he(a)}finally{q.cancel()}})()},1e3,{leading:!0}),U=".timeline-item, .timeline-item-alt",W=Ue("j, shift+j",(J,ge)=>{const Ee=document.activeElement.closest(U),le=Ee==null?void 0:Ee.getBoundingClientRect(),X=Array.from(z.current.querySelectorAll(U));if(Ee&&le.top<z.current.clientHeight&&le.bottom>0){const we=X.indexOf(Ee);let P=X[we+1];ge.shift&&(P=X.find((ee,re)=>re>we&&!ee.classList.contains("timeline-item-alt"))),P&&(P.focus(),P.scrollIntoView(rn))}else{const we=X.find(P=>{const ee=P.getBoundingClientRect();return ee.top>=44&&ee.left>=0});we&&(we.focus(),we.scrollIntoView(rn))}}),de=Ue("k, shift+k",(J,ge)=>{const Ee=document.activeElement.closest(U),le=Ee==null?void 0:Ee.getBoundingClientRect(),X=Array.from(z.current.querySelectorAll(U));if(Ee&&le.top<z.current.clientHeight&&le.bottom>0){const we=X.indexOf(Ee);let P=X[we-1];ge.shift&&(P=X.findLast((ee,re)=>re<we&&!ee.classList.contains("timeline-item-alt"))),P&&(P.focus(),P.scrollIntoView(rn))}else{const we=X.find(P=>{const ee=P.getBoundingClientRect();return ee.top>=44&&ee.left>=0});we&&(we.focus(),we.scrollIntoView(rn))}}),Q=Ue(["enter","o"],()=>{const J=document.activeElement;J!=null&&J.matches(U)&&J.click()}),me=I.length>0&&T!=="loading"&&G,ke=ct(()=>{var J;me&&q(!0),(J=z.current)==null||J.scrollTo({top:0,behavior:"smooth"})},[q,me]),ue=Ue(".",ke),j=Y(),[be,Re]=R(!1);Fa({scrollableRef:z,distanceFromEnd:2,scrollThresholdStart:44},({scrollDirection:J,nearReachStart:ge,reachStart:Ee})=>{if(j.current){const le=J==="end"&&!ge;j.current.hidden=le}Re(ge),Ee&&q(!0)},[]),ie(()=>{var J;(J=z.current)==null||J.scrollTo({top:0}),q(!0)},[]);const xe=Y(!0);ie(()=>{var J;if(xe.current){xe.current=!1;return}x&&(I!=null&&I.length)&&((J=q.cancel)==null||J.call(q),_([])),q(!0)},[x,y]);const Ne=Y(g);ie(()=>{Ne.current!==g&&(Ne.current=g,_([]))},[g]);const Pe=ct(async({disableIdleCheck:J=!1}={})=>{const ge=z.current?getComputedStyle(z.current).pointerEvents==="none":!1;S.settings.autoRefresh&&z.current.scrollTop<16&&(J||window.__IDLE__)&&!Ka()&&!ge?q(!0):await l()&&te(!0)},[i,q,l,S.settings.autoRefresh]),_e=Y();return qt(J=>{if(J){const ge=Date.now()-_e.current;(!_e.current||ge>1e3*3)&&Pe({disableIdleCheck:!0})}else _e.current=Date.now();V(J)},[l,Pe,S.settings.autoRefresh]),si(Pe,B&&!G?m*(be?1:2):null),e(bs.Provider,{value:w,children:e("div",{id:`${i}-page`,class:`deck-container ${H?"deck-container-media-first":""}`,ref:J=>{z.current=J,W(J),de(J),Q(J),ue(J)},tabIndex:"-1",onClick:J=>{j.current&&J.target.closest(".timeline-item, .timeline-item-alt")&&setTimeout(()=>{j.current.hidden=!1},250)},children:e("div",{class:"timeline-deck deck",children:[e("header",{ref:j,onClick:J=>{var ge;J.target.closest("a, button")||(ge=z.current)==null||ge.scrollTo({top:0,behavior:"smooth"})},onDblClick:J=>{J.target.closest("a, button")||q(!0)},class:T==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Pt,{}),f??e(fe,{to:"/",class:"button plain home-button",children:e(C,{icon:"home",size:"l",alt:b._({id:"i0qMbr"})})})]}),t&&(n||e("h1",{children:t})),e("div",{class:"header-side",children:!!p&&p})]}),me&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:ke,children:[e(C,{icon:"arrow-up"})," ",e(d,{id:"2yr1/p"})]})]}),!!u&&e("div",{class:`timeline-start ${T==="loading"?"loading":""}`,children:u}),I.length?e(O,{children:[e("ul",{class:`timeline ${g?`timeline-${g}`:""}`,children:[I.map(J=>e(ja,{status:J,instance:s,useItemID:h,filterContext:w,view:g,showFollowedTags:v,showReplyParent:k,mediaFirst:H},J.id+(J==null?void 0:J._pinned)+g)),D&&T==="loading"&&(g==="media"?null:e(O,{children:[e("li",{style:{height:"20vh"},children:e(Ye,{skeleton:!0,mediaFirst:H})}),e("li",{style:{height:"25vh"},children:e(Ye,{skeleton:!0,mediaFirst:H})})]}))]}),T==="default"&&(D?e(kt,{root:z.current,rootMargin:`0px 0px ${screen.height*1.5}px 0px`,onChange:J=>{J&&q()},children:e("button",{type:"button",class:"plain block",onClick:()=>q(),style:{marginBlockEnd:"6em"},children:e(d,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(d,{id:"2EYeAZ"})}))]}):T==="loading"?e("ul",{class:"timeline",children:Array.from({length:5}).map((J,ge)=>g==="media"?e("div",{style:{height:"50vh"}}):e("li",{children:e(Ye,{skeleton:!0,mediaFirst:H})},ge))}):T!=="error"&&T!=="start"&&e("p",{class:"ui-state",children:o}),T==="error"&&e("p",{class:"ui-state",children:[a,e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>q(!I.length),children:e(d,{id:"KDw4GX"})})]})]})})})}const ja=st(({status:t,instance:n,useItemID:i,filterContext:s,view:o,showFollowedTags:a,showReplyParent:h,mediaFirst:r})=>{const{id:c,reblog:l,items:m,type:f,_pinned:p}=t;p&&(i=!1);const u=(l==null?void 0:l.id)||c,y=n?`/${n}/s/${u}`:`/s/${u}`;if(m){let w=Lt(m,s),v="";if(f==="boosts"?v=b._({id:"NuqppG",values:{0:w.length}}):f==="pinned"&&(v=b._({id:"GlfmCu"})),f==="boosts"||f==="pinned"){const S=new Set;if(w.sort((I,_)=>{const T=Ht(I.filtered,s),$=Ht(_.filtered,s);return T&&S.add(I.id),$&&S.add(_.id),T&&!$?1:!T&&$?-1:0}),S.size>=2){const _=[],T=[];w.forEach(D=>{S.has(D.id)?T.push(D):_.push(D)});const $=[];for(let D=0;D<T.length;D+=5)$.push({_grouped:!0,posts:T.slice(D,D+5)});w=_.concat($)}return e("li",{class:"timeline-item-carousel",children:e(Va,{title:v,class:`${f}-carousel`,children:w.map(I=>{const{id:_,reblog:T,_pinned:$,_grouped:D}=I;if(D)return e("li",{class:"timeline-item-carousel-group",children:I.posts.map(te=>{const{id:B,reblog:V,_pinned:z}=te,H=(V==null?void 0:V.id)||B,ne=n?`/${n}/s/${H}`:`/s/${H}`;return z&&(i=!1),e(fe,{class:"status-carousel-link timeline-item-alt",to:ne,children:i?e(Ye,{statusID:B,instance:n,size:"s"}):e(Ye,{status:te,instance:n,size:"s"})})})},_);const M=(T==null?void 0:T.id)||_,G=n?`/${n}/s/${M}`:`/s/${M}`;return $&&(i=!1),e("li",{children:e(fe,{class:"status-carousel-link timeline-item-alt",to:G,children:i?e(Ye,{statusID:_,instance:n,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:r}):e(Ye,{status:I,instance:n,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:r})})},_)})})},`timeline-${c}`)}const x=w.length>3;return w.map((S,I)=>{const{id:_,_differentAuthor:T}=S,$=n?`/${n}/s/${_}`:`/s/${_}`,D=I>0&&I<w.length-1,M=S.sensitive&&!!S.spoilerText,G=!T&&M&&I>0||x&&D&&(f==="thread"||f==="conversation"&&!T&&!w[I-1]._differentAuthor&&!w[I+1]._differentAuthor),te=I===0,B=I===w.length-1;return e("li",{class:`timeline-item-container timeline-item-container-type-${f} timeline-item-container-${te?"start":B?"end":"middle"} ${T?"timeline-item-diff-author":""}`,children:e(fe,{class:"status-link timeline-item",to:$,children:G?e(Ga,{status:S,instance:n,filterContext:s}):i?e(Ye,{statusID:_,instance:n,enableCommentHint:B,showFollowedTags:a}):e(Ye,{status:S,instance:n,enableCommentHint:B,showFollowedTags:a})})},`timeline-${_}`)})}const g=`timeline-${c+p}`;return o==="media"?i?e(ji,{class:"timeline-item",parent:"li",statusID:c,instance:n},g):e(ji,{class:"timeline-item",parent:"li",status:t,instance:n},g):e("li",{children:e(fe,{class:"status-link timeline-item",to:y,children:i?e(Ye,{statusID:c,instance:n,enableCommentHint:!0,showFollowedTags:a,showReplyParent:h,mediaFirst:r}):e(Ye,{status:t,instance:n,enableCommentHint:!0,showFollowedTags:a,showReplyParent:h,mediaFirst:r})})},g)},(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 Va({title:t,class:n,children:i}){const s=Y(),o=Y(),a=Y(),[h,r]=R(!1);return ie(()=>{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)*(Rt()?1:-1);(m=s.current)==null||m.scrollBy({left:c,behavior:"smooth"})},children:e(C,{icon:"chevron-left",alt:b._({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)*(Rt()?-1:1);(m=s.current)==null||m.scrollBy({left:c,behavior:"smooth"})},children:e(C,{icon:"chevron-right",alt:b._({id:"hXzOVo"})})})]})]}),e("ul",{ref:s,children:[e(kt,{class:"status-carousel-beacon",onChange:c=>{o.current&&(o.current.disabled=c)}}),i[0],h&&i.slice(1),e(kt,{class:"status-carousel-beacon",onChange:c=>{a.current&&(a.current.disabled=c)}})]})]})}function Ga({status:t,instance:n,filterContext:i}){const s=qe(A),{id:o,visibility:a,language:h}=t,r=ai(t),c=it(o,n),l=Ht(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:b._({id:"e66y2Z"})}),s.statusThreadNumber[c]?` ${s.statusThreadNumber[c]}/X`:""]}):e("div",{class:"status-thread-badge",children:e(C,{icon:"thread",size:"s",alt:b._({id:"e66y2Z"})})}),e("div",{class:"content-compact",title:r,lang:h,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(d,{id:"sr6maL",values:{0:l.titlesStr},components:{0:e("span",{}),1:e("span",{})}}):e("span",{children:e(d,{id:"03Qqf9"})})}):e(O,{children:[r,t.sensitive&&t.spoilerText&&e(O,{children:[" ",e("span",{class:"spoiler-badge",children:e(C,{icon:"eye-close",size:"s",alt:b._({id:"gnKo7f"})})})]})]})})]})}function Ka(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}const Bt=20,wi=1983,Vi=`${wi}-01`,Wa=(()=>{try{const t=document.createElement("input");return t.setAttribute("type","month"),t.type==="month"}catch{return!1}})();async function Za(t){var s;const{masto:n}=ae({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 Xa=_t(Za);function Ja(){const t=qe(A),{id:n,...i}=xt(),[s,o]=pt(),a=s.get("month"),h=!s.get("replies"),r=!!s.get("boosts"),c=s.get("tagged"),l=!!s.get("media"),{masto:m,instance:f,authenticated:p}=ae({instance:i.instance}),{masto:u,instance:y}=ae(),g=Y(),w=[a,h,r,c,l],[v,k]=R(),x=Y(0);ie(()=>{x.current=0},w);const S=Ce(()=>ni(),[]),I=Ce(()=>f===y,[f,y]),[_,T]=R(!1);ie(()=>{I&&v!=null&&v.acct&&(async()=>{const Q=await Xa(f);T(Q)})()},[f,I,v==null?void 0:v.acct]);async function $(Q){var Re,xe,Ne,Pe;const me=/^\d{4}-[01]\d$/.test(a),ke=((xe=(Re=a==null?void 0:a.split)==null?void 0:Re.call(a,"-"))==null?void 0:xe[0])>=wi;if(me&&ke){if(!v)return{value:[],done:!0};const[_e,J]=a.split("-"),ge=parseInt(J,10)-1,Ee=new Date(_e,ge,0),le=`${Ee.getFullYear()}-${(Ee.getMonth()+1).toString().padStart(2,"0")}-${Ee.getDate().toString().padStart(2,"0")}`,X=new Date(_e,ge+1,1),we=`${X.getFullYear()}-${(X.getMonth()+1).toString().padStart(2,"0")}-${X.getDate().toString().padStart(2,"0")}`;let P;Q?(P=Bt+1,x.current=0):(P=Bt+x.current+1,x.current+=Bt);const ee=await m.v2.search.fetch({q:`from:${v.acct} after:${le} before:${we}`,type:"statuses",limit:P,offset:x.current});if((Ne=ee==null?void 0:ee.statuses)!=null&&Ne.length){const re=ee.statuses.slice(0,Bt);re.forEach(ce=>{We(ce,f)});const N=ee.statuses.length<=Bt;return{value:re,done:N}}else return{value:[],done:!0}}let ue=[];if(Q){const{value:_e}=await m.v1.accounts.$select(n).statuses.list({pinned:!0}).next();if(_e!=null&&_e.length&&!c&&!l){const J=_e.map(ge=>(We(ge,f),{...ge,_pinned:!0}));if(J.length>=3){const ge=J.map(Ee=>Ee.id);ue.push({id:ge,items:J,type:"pinned"})}else ue.push(...J)}}(Q||!g.current)&&(g.current=m.v1.accounts.$select(n).statuses.list({limit:Bt,exclude_replies:h,exclude_reblogs:r,only_media:l||void 0,tagged:c}));const{value:j,done:be}=await g.current.next();if(j!=null&&j.length){if(ue.length){let _e=[];((Pe=ue[0])==null?void 0:Pe.type)==="pinned"?_e=ue[0].id:_e=ue.filter(ge=>ge._pinned).map(ge=>ge.id),_e.every(ge=>j.some(Ee=>Ee.id===ge))&&(ue=[])}ue.push(...j),j.forEach(_e=>{We(_e,f)})}return{value:ue,done:be}}const[D,M]=R([]),{i18n:G}=Qe();let te=G._({id:"/cKnpj"});if(v!=null&&v.acct){const Q=(/@/.test(v.acct)?"":"@")+v.acct,me=v!=null&&v.displayName?`${v.displayName} (${Q})`:`${Q}`;if(!h)te=G._({id:"hS1Opy",values:{accountDisplay:me}});else if(r)te=G._({id:"A/CX5F",values:{accountDisplay:me}});else if(c)te=G._({id:"QQrO94",values:{accountDisplay:me,tagged:c}});else if(l)te=G._({id:"NoG5wD",values:{accountDisplay:me}});else if(a){const ke=new Date(a).toLocaleString(G.locale,{month:"long",year:"numeric"});te=G._({id:"8GjLvB",values:{accountDisplay:me,monthYear:ke}})}else te=me}Xe(te,"/:instance?/a/:id");const B=Y(),V=ct(()=>{const Q=B.current||m.v1.accounts.$select(n).fetch();return B.current=Q,Q},[n,m]);ie(()=>{(async()=>{try{const Q=await V();k(Q)}catch{}if(!S)try{const Q=await m.v1.accounts.$select(n).featuredTags.list();M(Q)}catch{}})()},[n,S]);const{displayName:z,acct:H,emojis:ne}=v||{},L=Y(),q=Ce(()=>{const Q=!h||r||c||l||!!a,me=t.accounts[`${n}@${f}`];return e(O,{children:[e(Ms,{instance:f,account:me||n,fetchAccount:V,authenticated:p,standalone:!0}),!S&&e("div",{class:"filter-bar",ref:L,style:{position:"relative"},children:[Q?e(fe,{to:`/${f}/a/${n}`,class:"insignificant filter-clear",title:G._({id:"u8JHrO"}),children:e(C,{icon:"x",size:"l",alt:G._({id:"xCJdfg"})})},"clear-filters"):e(C,{icon:"filter",class:"insignificant",size:"l",alt:G._({id:"cSev+j"})}),e(fe,{to:`/${f}/a/${n}${h?"?replies=1":""}`,onClick:()=>{h&&he(G._({id:"PIWNSQ"}))},class:h?"":"is-active",children:e(d,{id:"5BFynH"})}),e(fe,{to:`/${f}/a/${n}${r?"":"?boosts=0"}`,onClick:()=>{r||he(G._({id:"Qd13i0"}))},class:r?"is-active":"",children:e(d,{id:"usxQx0"})}),e(fe,{to:`/${f}/a/${n}${l?"":"?media=1"}`,onClick:()=>{l||he(G._({id:"rKpfPY"}))},class:l?"is-active":"",children:e(d,{id:"xYilR2"})}),D.map(ke=>e(fe,{to:`/${f}/a/${n}${c===ke.name?"":`?tagged=${encodeURIComponent(ke.name)}`}`,onClick:()=>{c!==ke.name&&he(G._({id:"L+HFfr",values:{0:ke.name}}))},class:c===ke.name?"is-active":"",children:e("span",{children:[e("span",{class:"more-insignificant",children:"#"}),ke.name]})},ke.id)),_&&(Wa?e("label",{class:`filter-field ${a?"is-active":""}`,children:[e(C,{icon:"month",size:"l"}),e("input",{type:"month",disabled:!(v!=null&&v.acct),value:a||"",min:Vi,max:new Date().toISOString().slice(0,7),onInput:ke=>{const{value:ue,validity:j}=ke.currentTarget;if(!j.valid)return;o(ue?{month:ue}:{});const[be,Re]=ue.split("-"),xe=parseInt(Re,10)-1,Ne=new Date(be,xe);he(G._({id:"0WUFGD",values:{0:Ne.toLocaleString(G.locale,{month:"long",year:"numeric"})}}))}})]}):e(Qa,{class:`filter-field ${a?"is-active":""}`,disabled:!(v!=null&&v.acct),value:a||"",min:Vi,max:new Date().toISOString().slice(0,7),onInput:ke=>{const{value:ue,validity:j}=ke;j.valid&&o(ue?{month:ue}:{})}}))]})]})},[n,f,p,D,V,_,...w]);ie(()=>{var me;const Q=(me=L.current)==null?void 0:me.querySelector(".is-active");Q&&L.current.scrollTo({behavior:"smooth",left:Q.offsetLeft-(L.current.offsetWidth-Q.offsetWidth)/2})},[D,_,...w]);const U=Ce(()=>v!=null&&v.url?URL.parse(v.url).hostname:null,[v]),de=!!v&&!(f===U);return e(St,{title:`${v!=null&&v.acct?"@"+v.acct:G._({id:"+owNNn"})}`,titleComponent:e("h1",{class:"header-double-lines header-account",children:[e("b",{children:e(ps,{text:z,emojis:ne})}),e("div",{children:e("span",{class:"bidi-isolate",children:["@",H]})})]}),id:"account-statuses",instance:f,emptyText:G._({id:"+k97fV"}),errorText:G._({id:"scd9lw"}),fetchItems:$,useItemID:!0,view:l||S?"media":void 0,boostsCarousel:t.settings.boostsCarousel,timelineStart:q,refresh:[h,r,c,l,a+(v==null?void 0:v.acct)].toString(),headerEnd:e(at,{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(Se,{disabled:!de,onClick:()=>{(async()=>{try{const{masto:Q}=ae({instance:U}),me=await Q.v1.accounts.lookup({acct:v.acct}),{id:ke}=me;location.hash=`/${U}/a/${ke}`}catch{alert(G._({id:"FgdLx0"}))}})()},children:[e(C,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:e(d,{id:"/JFxxT",values:{0:U?e(O,{children:[" ","(",e("b",{children:Dt.toUnicode(U)}),")"]}):null}})})]}),!I&&e(Se,{onClick:()=>{(async()=>{try{const Q=await u.v1.accounts.lookup({acct:v.acct+"@"+f}),{id:me}=Q;location.hash=`/${y}/a/${me}`}catch{alert(G._({id:"FgdLx0"}))}})()},children:[e(C,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:e(d,{id:"HkuyOu",values:{currentInstance:y},components:{0:e("b",{})}})})]})]})},n)}function Qa(t){const{i18n:n}=Qe(),{class:i,disabled:s,value:o,min:a,max:h,onInput:r=()=>{}}=t,[c,l]=(o==null?void 0:o.split("-"))||[],m=Y(),f=Y(),p=(u,y)=>{const[g,w]=(a==null?void 0:a.split("-"))||[],[v,k]=(h==null?void 0:h.split("-"))||[];return!(y<g||y>v||y===g&&u<w||y===v&&u>k)};return e("div",{class:i,children:[e(C,{icon:"month",size:"l"}),e("select",{ref:m,disabled:s,value:l||"",onInput:u=>{const{value:y}=u.currentTarget,g=f.current.value;if(!p(y,g))return{value:"",validity:{valid:!1}};r({value:y?`${g}-${y}`:"",validity:{valid:!0}})},children:[e("option",{value:"",children:e(d,{id:"HajiZl"})}),e("option",{disabled:!0,children:"-----"}),Array.from({length:12},(u,y)=>e("option",{value:(y+1).toString().padStart(2,"0"),children:new Date(0,y).toLocaleString(n.locale,{month:"long"})},y))]})," ",e("input",{ref:f,type:"number",disabled:s,value:c||new Date().getFullYear(),min:(a==null?void 0:a.slice(0,4))||wi,max:(h==null?void 0:h.slice(0,4))||new Date().getFullYear(),onInput:u=>{const{value:y,validity:g}=u.currentTarget,w=m.current.value;if(!g.valid||!p(w,y))return{value:"",validity:{valid:!1}};r({value:y?`${y}-${w}`:"",validity:{valid:!0}})},style:{width:"4.5em"}})]})}function er(){var u;const t=xt(),{year:n}=t;Xe(n?`Annual Report: ${n}`:"Annual Report");const{masto:i,instance:s}=ae(),[o,a]=R(null),[h,r]=R("default");ie(()=>{n&&(async()=>{r("loading");const y=await i.v1.annualReports.$select(n).fetch();a(y),r("default")})()},[n]);const{accounts:c,annualReports:l,statuses:m}=o||{},f=(u=l==null?void 0:l.find(y=>y.year==n))==null?void 0:u.data,p=new Date;return e("div",{id:"annual-report-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"report",children:[e("h1",{children:[n," #Wrapstodon"]}),h==="loading"&&e("p",{children:[e(Oe,{abrupt:!0})," ",e(d,{id:"Pwqkdw"})]}),!!f&&e("dl",{children:Object.entries(f).map(([y,g])=>e(O,{children:[e("dt",{children:y}),e("dd",{class:`report-${y}`,children:Array.isArray(g)?e("table",{children:[e("thead",{children:e("tr",{children:Object.entries(g[0]).map(([w,v])=>e("th",{class:w!=="month"&&typeof v=="number"?"number":"",children:w}))})}),e("tbody",{children:g.map(w=>e("tr",{children:Object.entries(w).map(([v,k])=>e("td",{class:v!=="month"&&typeof k=="number"?"number":"",children:k&&/(accountId)/i.test(v)&&/^(mostRebloggedAccounts|commonlyInteractedWithAccounts)$/i.test(y)?e(ht,{account:c==null?void 0:c.find(x=>x.id===k),showAvatar:!0}):v==="month"?p.setMonth(k-1)&&p.toLocaleString(void 0,{month:"long"}):typeof k=="number"?k.toLocaleString():k}))}))})]}):typeof g=="object"?/^(topStatuses)$/i.test(y)?e("dl",{children:Object.entries(g).map(([w,v])=>e(O,{children:[e("dt",{children:w}),e("dd",{children:v&&e(fe,{to:`/${s}/s/${v}`,children:e(Ye,{status:m==null?void 0:m.find(k=>k.id===v),size:"s",readOnly:!0})})})]}))}):e("table",{children:e("tbody",{children:Object.entries(g).map(([w,v])=>e("tr",{children:[e("th",{children:w}),e("td",{class:typeof v=="number"?"number":"",children:v})]}))})}):typeof g=="string"?g:JSON.stringify(g,null,2)})]}))})]}),e("hr",{}),e("p",{style:{textAlign:"center"},children:e(fe,{to:"/",children:e(d,{id:"iWpEwy"})})})]})}const tr=20;function Bs(){Xe(b._({id:"7Ff7ia"}),"/bookmarks");const{masto:t,instance:n}=ae(),i=Y();async function s(o){return(o||!i.current)&&(i.current=t.v1.bookmarks.list({limit:tr})),await i.current.next()}return e(St,{title:b._({id:"7Ff7ia"}),id:"bookmarks",emptyText:b._({id:"8k2w6G"}),errorText:b._({id:"UoL+FC"}),instance:n,fetchItems:s})}const nr=""+new URL("catch-up-DuauQu-W.png",import.meta.url).href,ir="home",ot=[{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}],sr={original:{id:"HxF6Fk"},replies:{id:"N8UzTV"},boosts:{id:"puY2t0"},followedTags:{id:"lCLRBe"},groups:{id:"zhrjek"},filtered:{id:"03Qqf9"}},or=["createdAt","repliesCount","favouritesCount","reblogsCount","density"],cr=[null,"account"],ar=ds(t=>new Intl.DateTimeFormat(t||void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"}));function rr(){const{i18n:t,_:n}=Qe(),i=ar(t.locale);Xe("Catch-up","/catchup");const{masto:s,instance:o}=ae(),[a,h]=pt(),r=a.get("id"),[c,l]=R("start"),[m,f]=R(!1),p=Ce(()=>wt(),[]),u=E=>E===p,y=Ze("@pixelfed/home-include-reblogs");async function g({maxCreatedAt:E}){var se,Me,Le;const K=E?new Date(E):null,oe=[],Z=s.v1.timelines.home.list({limit:40});e:for(;;)try{y&&Z.nextParams&&(typeof Z.nextParams=="string"?Z.nextParams+="&include_reblogs=true":Z.nextParams.include_reblogs=!0);const $e=await Z.next(),{value:ze}=$e;if(ze!=null&&ze.length){await Us(ze,o);let He=!1;for(let ye=0;ye<ze.length;ye++){const De=ze[ye],Je=new Date(De.createdAt);if(!K||Je>=K){const Ve=!u(((Me=(se=De.reblog)==null?void 0:se.account)==null?void 0:Me.id)||De.account.id)&&Ht(((Le=De.reblog)==null?void 0:Le.filtered)||De.filtered,ir);if((Ve==null?void 0:Ve.action)==="hide")continue;De._filtered=Ve;const bt=it(De.id,o);De._followedTags=A.statusFollowedTags[bt]?[...A.statusFollowedTags[bt]]:[],oe.push(De),He=!0}if(!He)break e}}else break e;await new Promise(He=>setTimeout(He,1e3))}catch{break e}return oe.forEach($e=>{if($e!=null&&$e.inReplyToId){const ze=oe.find(He=>He.id===$e.inReplyToId);ze&&!ze.inReplyToId&&(ze._thread=!0)}}),oe}const[w,v]=R([]),k=Y(),x=Y(),S=Ce(()=>wn(),[]),I=ct(async({duration:E}={})=>{const K=Date.now(),oe=E?K-E:null;l("loading");const Z=await g({maxCreatedAt:oe}),se=`${S}-${Uo()}`;try{await ut.catchup.set(se,{id:se,posts:Z,count:Z.length,startAt:oe,endAt:K}),h({id:se})}catch{}},[]);ie(()=>{r?(async()=>{const E=await ut.catchup.get(r);E&&(E.posts.sort((K,oe)=>K.createdAt>oe.createdAt?1:-1),v(E.posts),l("results"))})():c==="results"&&(v([]),l("start"))},[r]);const[_,T]=Mt(E=>E+1,0),[$,D]=R(null),[M,G]=R([]);ie(()=>{(async()=>{try{const E=await ut.catchup.keys();if(E.length){const K=wn(),oe=E.filter(Z=>Z.startsWith(`${K}-`));if(oe.length){let Z=await ut.catchup.getMany(oe);Z.sort(($e,ze)=>ze.endAt-$e.endAt);let se=Z.slice(0,3),Me=Z.slice(3);const Le=se.map($e=>{const{id:ze,count:He,startAt:ye,endAt:De}=$e;return{id:ze,count:He,startAt:ye,endAt:De}});G(Le),D(se[0].endAt),Z=null,se=null,queueMicrotask(()=>{Me.length&&ut.catchup.delMany(Me.map($e=>$e.id)).then(()=>{Me=null}).catch($e=>{})});return}}}catch{}G([])})()},[_]),ie(()=>{c==="start"&&T()},[c==="start"]);const[te,B]=Ce(()=>{var ze,He,ye,De,Je;let E=0,K=0,oe=0,Z=0,se=0,Me=0;const Le={};for(const Te of w){Te._filtered?(E++,Te.__FILTER="filtered"):Te.group?(K++,Te.__FILTER="groups"):Te.reblog?(oe++,Te.__FILTER="boosts"):(ze=Te._followedTags)!=null&&ze.length?(se++,Te.__FILTER="followedTags"):Te.inReplyToId&&Te.inReplyToAccountId!==((He=Te.account)==null?void 0:He.id)?(Z++,Te.__FILTER="replies"):(Me++,Te.__FILTER="original");const Ve=Te.reblog||Te;if(Te.__FILTER!=="filtered"&&((ye=Ve.card)!=null&&ye.url)&&((De=Ve.card)!=null&&De.image)&&((Je=Ve.card)==null?void 0:Je.type)==="link"){const{card:bt,favouritesCount:an,reblogsCount:At}=Ve;let{url:et}=bt;if(et=et.replace(/\/$/,""),!Le[et])Le[et]={postID:Ve.id,card:bt,shared:1,sharers:[Te.account],likes:an,boosts:At};else{if(Le[et].sharers.find(Ot=>Ot.id===Te.account.id))continue;Le[et].shared++,Le[et].sharers.push(Te.account),Le[et].postID!==Ve.id&&(Le[et].likes+=an,Le[et].boosts+=At)}}}let $e=[];for(const Te in Le)$e.push({url:Te,...Le[Te]});if($e.sort((Te,Ve)=>Te.shared>Ve.shared?-1:Te.shared<Ve.shared?1:Te.boosts>Ve.boosts?-1:Te.boosts<Ve.boosts?1:Te.likes>Ve.likes?-1:Te.likes<Ve.likes?1:0),$e.length>10)e:for(let Te=10;Te<$e.length;Te++){const{shared:Ve}=$e[Te];if(Ve<=1){$e=$e.slice(0,Te);break e}}return[{filtered:E,groups:K,boosts:oe,replies:Z,followedTags:se,original:Me},$e]},[w]),[V,z]=R("all"),[H,ne]=R(null),[L,q]=R(1),[U,W]=R("createdAt"),[de,Q]=R("asc"),[me,ke]=R(null),[ue,j,be]=Ce(()=>{const E={},K=new Map;let oe=w.filter(se=>{const Me=V==="all"||se.__FILTER===V;return Me&&(E[se.account.id]=se.account,K.set(se.account.id,(K.get(se.account.id)||0)+1)),Me});const Z={};return oe.forEach(se=>{se.reblog&&(Z[se.reblog.id]?(Z[se.reblog.id].__BOOSTERS?Z[se.reblog.id].__BOOSTERS.add(se.account):Z[se.reblog.id].__BOOSTERS=new Set([se.account]),se.__HIDDEN=!0):Z[se.reblog.id]=se)}),H&&K.has(H)&&(oe=oe.filter(se=>se.account.id===H||[...se.__BOOSTERS||[]].find(Me=>Me.id===H))),[oe,E,Object.fromEntries(K)]},[V,H,w]),Re=Ce(()=>{const E={};return ue.forEach(K=>{E[K.id]=K}),E},[ue]),xe=Ce(()=>Object.keys(be).sort((E,K)=>be[K]-be[E]),[be]),Ne=Ce(()=>{const E={};return xe.forEach((K,oe)=>{E[K]=oe}),ue.filter(K=>!K.__HIDDEN).sort((K,oe)=>{if(me==="account"){const Z=K.account.id,se=oe.account.id,Me=E[Z],Le=E[se],$e=Me-Le;if($e!==0)return $e}if(U!=="createdAt"&&(K=K.reblog||K,oe=oe.reblog||oe,U!=="density"&&K[U]===oe[U]))return K.createdAt>oe.createdAt?1:-1;if(U==="density"){const Z=Gi(K),se=Gi(oe);return de==="asc"?Z>se?1:-1:se>Z?1:-1}return de==="asc"?K[U]>oe[U]?1:-1:oe[U]>K[U]?1:-1})},[ue,U,de,me,xe]),Pe=Y(null),_e=Y(null),J=Y(!1);ie(()=>{w.length>100||J.current||_e.current&&(xs(_e.current,{duration:200}),J.current=!0)},[w,_e]);const ge=w.length>160?"3d":"2d",Ee=Ce(()=>ge!=="2d"?null:w.map(E=>{const K=Re[E.id];return e("span",{class:`post-dot ${K?"post-dot-highlight":""}`},E.id)}),[Re]),le=Ce(()=>ge!=="3d"||!(w!=null&&w.length)?null:mr(w,"createdAt",320).map((K,oe)=>e("div",{class:"posts-bin",children:K.map(Z=>{const se=Re[Z.id];return e("span",{class:`post-dot ${se?"post-dot-highlight":""}`},Z.id)})},oe)),[Re]),X=Y(null),we=Ce(()=>$?(Date.now()-$)/1e3/60/60:null,[$,L]);ie(()=>{if(c!=="results")return;const E=H&&j[H]?j[H].username:"",K=de==="asc"?0:1,oe={account:"authors"};let Z=he({duration:5e3,text:t._({id:"TLYeLT",values:{selectedFilterCategory:V,sortBy:U,sortOrder:de,groupBy:me}})});return()=>{var se;(se=Z==null?void 0:Z.hideToast)==null||se.call(Z)}},[c,V,H,U,de,me,j]),ie(()=>{var E;if(H&&j[H]){const K=_e.current.querySelector(`[data-author="${H}"]`),oe=(E=_e.current)==null?void 0:E.getBoundingClientRect(),Z=K==null?void 0:K.getBoundingClientRect();Z.left<oe.left||Z.right>oe.right?K.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}):Z.top<0&&K.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})}},[H,j]);const[P,ee]=R(!1),re=".catchup-list > li > a",N=Ue("j",()=>{const E=document.activeElement.closest(re),K=E==null?void 0:E.getBoundingClientRect(),oe=Array.from(X.current.querySelectorAll(re));if(E&&K.top<X.current.clientHeight&&K.bottom>0){const Z=oe.indexOf(E),se=oe[Z+1];se&&(se.focus(),se.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const Z=oe.find(se=>se.getBoundingClientRect().top>=0);Z&&(Z.focus(),Z.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{preventDefault:!0,ignoreModifiers:!0}),ce=Ue("k",()=>{const E=document.activeElement.closest(re),K=E==null?void 0:E.getBoundingClientRect(),oe=Array.from(X.current.querySelectorAll(re));if(E&&K.top<X.current.clientHeight&&K.bottom>0){const Z=oe.indexOf(E);let se=oe[Z-1];se&&(se.focus(),se.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const Z=oe.find(se=>{const Me=se.getBoundingClientRect();return Me.top>=44&&Me.left>=0});Z&&(Z.focus(),Z.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{preventDefault:!0,ignoreModifiers:!0}),Ie=Ue("h, l",(E,K)=>{var Z,se,Me;const oe=K.keys[0];if(H){const Le=xe.indexOf(H);oe==="h"?Le>0&&Le<xe.length&&(ne(xe[Le-1]),(Z=X.current)==null||Z.focus()):oe==="l"&&Le<xe.length-1&&Le>=0&&(ne(xe[Le+1]),(se=X.current)==null||se.focus())}else oe==="l"&&(ne(xe[0]),(Me=X.current)==null||Me.focus())},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]}),F=Ue("esc",()=>{var E;ne(null),(E=X.current)==null||E.focus()},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]}),pe=Ue(".",()=>{var E;(E=X.current)==null||E.scrollTo({top:0,behavior:"smooth"})},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]}),Ae=ct(E=>{const K=document.activeElement,oe=(K==null?void 0:K.tagName)==="INPUT"&&K.type==="radio";if((E.key==="ArrowDown"||E.key==="ArrowUp"||E.key==="ArrowLeft"||E.key==="ArrowRight")&&oe){K.blur();return}},[]);return e("div",{ref:E=>{X.current=E,N(E),ce(E),Ie(E),F(E)},id:"catchup-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck wide",children:[e("header",{class:`${c==="loading"?"loading":""}`,onClick:E=>{var K;E.target.closest("a, button")||(K=X.current)==null||K.scrollTo({top:0,behavior:"smooth"})},children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Pt,{}),c==="results"&&e(fe,{to:"/catchup",class:"button plain",children:e(C,{icon:"history2",size:"l",alt:t._({id:"xrl8fj"})})}),c==="start"&&e(fe,{to:"/",class:"button plain",children:e(C,{icon:"home",size:"l",alt:t._({id:"i0qMbr"})})})]}),e("h1",{children:c!=="start"&&e(d,{id:"wyL/3/",components:{0:e("sup",{})}})}),e("div",{class:"header-side",children:c!=="start"&&c!=="loading"&&e("button",{type:"button",class:"plain",onClick:()=>{ee(!0)},children:e(d,{id:"c3XJ18"})})})]})}),e("main",{onKeyDown:Ae,children:[c==="start"&&e("div",{class:"catchup-start",children:[e("h1",{children:e(d,{id:"wyL/3/",components:{0:e("sup",{})}})}),e("details",{children:[e("summary",{children:e(d,{id:"CxKPv6"})}),e("p",{children:e(d,{id:"YMU1CK"})}),e("img",{src:nr,width:"1200",height:"900",alt:t._({id:"CeInO2"})}),e("p",{children:e("button",{type:"button",onClick:E=>{E.target.closest("details").open=!1},children:e(d,{id:"2jI8hh"})})})]}),e("p",{children:e(d,{id:"1RfGk7"})}),e("p",{children:e("b",{children:e(d,{id:"OOEonE"})})}),e("div",{class:"catchup-form",children:[e("input",{ref:k,type:"range",value:L,min:ot[0].value,max:ot[ot.length-1].value,step:"1",list:"catchup-ranges",onChange:E=>q(+E.target.value)})," ",e("span",{style:{width:"8em"},children:[n(ot[L-1].label),e("br",{}),e("small",{class:"insignificant",children:L==ot[ot.length-1].value?t._({id:"NMNiaO"}):ft(new Date(Date.now()-L*60*60*1e3))})]}),e("datalist",{id:"catchup-ranges",children:ot.map(({label:E,value:K})=>e("option",{value:K,label:n(E)}))})," ",e("button",{type:"button",onClick:()=>{var E;if(L<ot[ot.length-1].value){let K;L===ot[ot.length-1].value&&((E=x.current)!=null&&E.checked)?K=Date.now()-$:K=L*60*60*1e3,I({duration:K})}else I()},children:e(d,{id:"R0yu2l"})})]}),we&&L>we?e("p",{class:"catchup-info",children:[e(C,{icon:"info"})," ",e(d,{id:"AGyV7s"})]}):L===ot[ot.length-1].value&&$?e("p",{class:"catchup-info",children:e("label",{children:[e("input",{type:"checkbox",switch:!0,checked:!0,ref:x})," ",e(d,{id:"dDJEHI",values:{0:i.format(new Date($))}})]})}):null,e("p",{class:"insignificant",children:e("small",{children:e(d,{id:"EAjFM0"})})}),!!(M!=null&&M.length)&&e("div",{class:"catchup-prev",children:[e("p",{children:e(d,{id:"Yfb9A8"})}),e("ul",{children:M.map(E=>e("li",{children:[e(fe,{to:`/catchup?id=${E.id}`,children:[e(C,{icon:"history2"})," ",e("span",{children:E.startAt?i.formatRange(new Date(E.startAt),new Date(E.endAt)):`… – ${i.format(new Date(E.endAt))}`})]})," ",e("span",{children:[e("small",{class:"ib insignificant",children:e(d,{id:"S6XZwv",values:{0:E.count}})})," ",e("button",{type:"button",class:"light danger small",onClick:async()=>{var oe;if(confirm(t._({id:"D9CmP2"}))){let Z=he(t._({id:"xJUo4P",values:{0:E.id}}));await ut.catchup.del(E.id),(oe=Z==null?void 0:Z.hideToast)==null||oe.call(Z),he(t._({id:"1dyGG/",values:{0:E.id}})),T()}},children:e(C,{icon:"x",alt:t._({id:"t/YqKh"})})})]})]},E.id))}),M.length>=3&&e("p",{children:e("small",{children:e(d,{id:"sXmrl4"})})})]})]}),c==="loading"&&e("div",{class:"ui-state catchup-start",children:[e(Oe,{abrupt:!0}),e("p",{class:"insignificant",children:e(d,{id:"rbUTzD"})}),e("p",{class:"insignificant",children:e(d,{id:"q9urQO"})})]}),c==="results"&&e(O,{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:V==="all"&&!H&&U==="createdAt"&&de==="asc",type:"button",class:"plain4 small",onClick:()=>{z("all"),ne(null),W("createdAt"),ke(null),Q("asc")},children:e(d,{id:"I9EnzM"})}),(B==null?void 0:B.length)>0&&e("button",{type:"button",class:"plain small",onClick:()=>f(!m),children:[e(d,{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:B.map(E=>{const{card:K,shared:oe,sharers:Z,likes:se,boosts:Me}=E,{blurhash:Le,title:$e,description:ze,url:He,image:ye,imageDescription:De,language:Je,width:Te,height:Ve,publishedAt:bt}=K,an=Dt.toUnicode(URL.parse(He).hostname.replace(/^www\./,"").replace(/\/$/,""));let At;if(Le){const et=ci(Le),Ot=yi(et);At=bi([.6,Ot[1],Ot[2]])}return e("a",{href:He,target:"_blank",rel:"noopener noreferrer",class:"link-block",style:At?{"--accent-color":`rgb(${At.join(",")})`,"--accent-alpha-color":`rgba(${At.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:ye,alt:De,width:Te,height:Ve,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:an})," ",!!bt&&e(O,{children:"· "}),!!bt&&e(O,{children:e(Kt,{datetime:bt,format:"micro"})})]}),!!$e&&e("h1",{class:"title",lang:Je,dir:"auto",title:$e,children:$e})]}),!!ze&&e("p",{class:"description",lang:Je,dir:"auto",title:ze,children:ze}),e("hr",{}),e("p",{style:{whiteSpace:"nowrap"},children:e(d,{id:"bfSr6z",values:{0:Z.map(et=>{const{avatarStatic:Ot,displayName:oo}=et;return e("button",{type:"button",class:"plain",style:{padding:0},onClick:_i=>{_i.preventDefault(),_i.stopPropagation();const{id:co}=et;ne(co),z("all")},children:e(dt,{url:Ot,size:"s",alt:oo})})})}})})]})]})},He)})})})}),w.length>=5&&(ge==="3d"?e("div",{class:"catchup-posts-viz-time-bar",children:le}):e("div",{class:"catchup-posts-viz-bar",children:Ee})),w.length>=2&&e("div",{class:"catchup-filters",children:[e("label",{class:"filter-cat",children:[e("input",{type:"radio",name:"filter-cat",checked:V.toLowerCase()==="all",onChange:()=>{z("all")}}),e(d,{id:"N40H+G"})," ",e("span",{class:"count",children:w.length})]}),Object.entries(sr).map(([E,K])=>!!te[E]&&e("label",{class:"filter-cat",title:(te[E]/w.length*100).toFixed(2)+"%",children:[e("input",{type:"radio",name:"filter-cat",checked:V.toLowerCase()===E.toLowerCase(),onChange:()=>{z(E),E==="boosts"&&(W("reblogsCount"),Q("desc"),ke(null))}}),n(K)," ",e("span",{class:"count",children:te[E]})]},n(K)))]}),w.length>=2&&!!be&&e("div",{class:"catchup-filters authors-filters",ref:_e,children:[xe.map(E=>e("label",{class:"filter-author","data-author":E,children:[e("input",{type:"radio",name:"filter-author",checked:H===E,onChange:()=>{ne(E)},onClick:()=>{H===E&&ne(null)}}),e(dt,{url:j[E].avatarStatic||j[E].avatar,size:"xxl",alt:`${j[E].displayName} (@${j[E].acct})`})," ",e("span",{class:"count",children:be[E]}),e("span",{class:"username",children:j[E].username})]},`${E}-${be[E]}`)),xe.length>5&&e("small",{style:{whiteSpace:"nowrap",paddingInline:"1em",opacity:.33},children:e(d,{id:"HHtYi7",values:{0:xe.length}})},"authors-count")]}),w.length>=2&&e("div",{class:"catchup-filters",children:[e("span",{class:"filter-label",children:e(d,{id:"f6Hub0"})})," ",e("fieldset",{class:"radio-field-group",children:or.map(E=>e("label",{class:"filter-sort",onClick:K=>{U===E&&(K.preventDefault(),K.stopPropagation(),Q(de==="asc"?"desc":"asc"))},children:[e("input",{type:"radio",name:"filter-sort-cat",checked:U===E,onChange:()=>{W(E);const K=/(replies|favourites|reblogs)/.test(E)?"desc":"asc";Q(K)}}),{createdAt:t._({id:"mYGY3B"}),repliesCount:t._({id:"N8UzTV"}),favouritesCount:t._({id:"zZOZj7"}),reblogsCount:t._({id:"puY2t0"}),density:t._({id:"0tQ7AD"})}[E],U===E&&(de==="asc"?" ↑":" ↓")]},E))}),e("span",{class:"filter-label",children:e(d,{id:"group.filter"})})," ",e("fieldset",{class:"radio-field-group",children:cr.map(E=>e("label",{class:"filter-group",children:[e("input",{type:"radio",name:"filter-group",checked:me===E,onChange:()=>{ke(E)},disabled:E==="account"&&H}),{account:t._({id:"dpqPBg"})}[E]||t._({id:"EdQY6l"})]},E||"none"))}),H&&xe.length>1?e("button",{type:"button",class:"plain6 small",onClick:()=>{ne(null)},style:{whiteSpace:"nowrap"},children:e(d,{id:"/dlmrZ"})}):null]}),e("ul",{class:`catchup-list catchup-filter-${V||""} ${U?`catchup-sort-${U}`:""} ${H&&j[H]?"catchup-selected-author":""} ${me?`catchup-group-${me}`:""}`,children:Ne.map((E,K)=>{var se;const oe=((se=E.reblog)==null?void 0:se.id)||E.id;let Z=!1;return me==="account"&&(Pe.current&&E.account.id!==Pe.current&&K>0&&(Z=!0),Pe.current=E.account.id),e(O,{children:[Z&&e("li",{class:"separator"}),e(dr,{to:`/${o}/s/${oe}`,post:E,root:X.current})]},`${E.id}-${Z}`)})}),e("footer",{children:ue.length>5&&e("p",{children:[V==="boosts"?t._({id:"eVosYr"}):t._({id:"rhmyFK"})," ",e("button",{type:"button",class:"textual",onClick:()=>{X.current.scrollTop=0},children:e(d,{id:"0MgdN+"})}),"."]})})]})]})]}),P&&e(Fe,{onClose:()=>ee(!1),children:e("div",{class:"sheet",id:"catchup-help-sheet",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>ee(!1),children:e(C,{icon:"x",alt:t._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(d,{id:"c3XJ18"})})}),e("main",{children:e("dl",{children:[e("dt",{children:e(d,{id:"EIZREX"})}),e("dd",{children:e(d,{id:"YmGrIy"})}),e("dt",{children:e(d,{id:"coaNtr"})}),e("dd",{children:e(d,{id:"UUrqX1"})}),e("dt",{children:e(d,{id:"ScQBC/"})}),e("dd",{children:e(d,{id:"srocAr"})}),e("dt",{children:e(d,{id:"77Emn0"})}),e("dd",{children:e("table",{children:e("tbody",{children:[e("tr",{children:[e("td",{children:e(d,{id:"Gy9P9T"})}),e("td",{children:e("kbd",{children:"j"})})]}),e("tr",{children:[e("td",{children:e(d,{id:"6XYpYY"})}),e("td",{children:e("kbd",{children:"k"})})]}),e("tr",{children:[e("td",{children:e(d,{id:"f5dduh"})}),e("td",{children:e("kbd",{children:"l"})})]}),e("tr",{children:[e("td",{children:e(d,{id:"rj0vxZ"})}),e("td",{children:e("kbd",{children:"h"})})]}),e("tr",{children:[e("td",{children:e(d,{id:"jsFF8C"})}),e("td",{children:e("kbd",{children:"Enter"})})]}),e("tr",{children:[e("td",{children:e(d,{id:"bUUv3P"})}),e("td",{children:e("kbd",{children:"."})})]})]})})})]})})]})})]})}const lr=st(function({post:t}){const{id:n,account:i,group:s,reblog:o,inReplyToId:a,inReplyToAccountId:h,_followedTags:r,_filtered:c,visibility:l,__BOOSTERS:m}=t,f=a&&h!==i.id,p=!!c,u=y=>{y.shiftKey};return e("article",{class:`post-line ${s?"group":o?"reblog":r!=null&&r.length?"followed-tags":""} ${f?"reply-to":""} ${p?"filtered":""} visibility-${l}`,onMouseEnter:u,children:[e("span",{class:"post-author",children:o?e("span",{class:"post-reblog-avatar",children:[e(dt,{url:i.avatarStatic||i.avatar,squircle:i.bot}),(m==null?void 0:m.size)>0?[...m].map(y=>e(dt,{url:y.avatarStatic||y.avatar,squircle:y.bot})):""," ",e(C,{icon:"rocket"})," ",e(ht,{account:o.account,showAvatar:!0})]}):e(ht,{account:i,showAvatar:!0})}),e(fr,{post:o||t,filterInfo:c}),e("span",{class:"post-meta",children:[e(pr,{post:o||t})," ",e(Kt,{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)}),dr=({root:t,to:n,...i})=>{const s=Y(),[o,a]=R(!1);return ie(()=>{const h=new IntersectionObserver(r=>{r[0].isIntersecting&&(queueMicrotask(()=>a(!0)),h.unobserve(s.current))},{root:t,rootMargin:`${Math.max(320,screen.height*.75)}px`});return s.current&&h.observe(s.current),()=>{s.current&&h.unobserve(s.current)}},[]),o?e("li",{children:e(fe,{to:n,children:e(lr,{...i})})}):e("li",{ref:s,style:{height:"4em"}})},ur=8,hr=8;function Gi(t){var c;const{spoilerText:n,content:i,poll:s,mediaAttachments:o,card:a}=t,h=(c=s==null?void 0:s.options)!=null&&c.length?s.options.reduce((l,m)=>l+m.title,""):"";return(n.length+vs(i)+h.length)/140+(o!=null&&o.length?ur*o.length:a!=null&&a.image?hr:0)}const Ct=48;function fr({post:t,filterInfo:n}){var k;const{spoilerText:i,sensitive:s,content:o,emojis:a,poll:h,mediaAttachments:r,card:c,inReplyToId:l,inReplyToAccountId:m,account:f,_thread:p}=t,u=l&&m===f.id||!!p,y=Ce(()=>!!(ve.account.get("preferences")||{})["reading:expand:spoilers"],[]),g=y||!i&&!s,w=o?ai(t):"",v=!i||y;return e("div",{class:"post-peek",title:i?"":w,children:[e("span",{class:"post-peek-content",children:[u&&!v&&e(O,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:"Thread"})," "]}),n?e("span",{class:"post-peek-filtered",children:n!=null&&n.titlesStr?b._({id:"suKjh3",values:{0:n.titlesStr}}):b._({id:"03Qqf9"})}):e(O,{children:[!!i&&e("span",{class:"post-peek-spoiler",children:[e(C,{icon:`${y?"eye-open":"eye-close"}`})," ",i]}),v&&e("div",{class:"post-peek-html",children:[u&&e(O,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:e(d,{id:"e66y2Z"})})," "]}),!!o&&e("div",{dangerouslySetInnerHTML:{__html:Bo(o,a)}}),!!((k=h==null?void 0:h.options)!=null&&k.length)&&h.options.map(x=>e("div",{children:[h.multiple?"▪️":"•"," ",x.title]})),!o&&(r==null?void 0:r.length)===1&&r[0].description&&e(O,{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:[!!h&&e("span",{class:"post-peek-tag post-peek-poll",children:[e(C,{icon:"poll",size:"s"}),e(d,{id:"4WUbF1"})]}),r!=null&&r.length?r.map(x=>{var $,D,M,G,te,B,V,z,H,ne;const S=x.previewUrl||x.url,I=x.previewRemoteUrl||x.remoteUrl,_=($=x.meta)!=null&&$.original?x.meta.original.width:((M=(D=x.meta)==null?void 0:D.small)==null?void 0:M.width)||((te=(G=x.meta)==null?void 0:G.original)==null?void 0:te.width),T=(B=x.meta)!=null&&B.original?x.meta.original.height:((z=(V=x.meta)==null?void 0:V.small)==null?void 0:z.height)||((ne=(H=x.meta)==null?void 0:H.original)==null?void 0:ne.height);return e("span",{class:"post-peek-media",children:{image:(S||I)&&g?e("img",{src:S,width:Ct,height:Ct,alt:x.description,loading:"lazy",onError:L=>{const{src:q}=L.target;q===S&&(L.target.src=I)},style:{"--anim-duration":`${Math.min(Math.max(Math.max(_,T)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"🖼"}),gifv:(S||I)&&g?e("img",{src:S,width:Ct,height:Ct,alt:x.description,loading:"lazy",onError:L=>{const{src:q}=L.target;q===S&&(L.target.src=I)}}):e("span",{class:"post-peek-faux-media",children:"🎞️"}),video:(S||I)&&g?e("img",{src:S,width:Ct,height:Ct,alt:x.description,loading:"lazy",onError:L=>{const{src:q}=L.target;q===S&&(L.target.src=I)}}):e("span",{class:"post-peek-faux-media",children:"📹"}),audio:e("span",{class:"post-peek-faux-media",children:"🎵"})}[x.type]||null},x.id)}):!!c&&c.image&&g&&e("span",{class:`post-peek-media post-peek-card card-${c.type||""}`,children:c.image?e("img",{src:c.image,width:Ct,height:Ct,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 pr({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:b._({id:"N8UzTV"})})," ",Ke(i)]}),s>0&&e("span",{class:"post-stat-likes",children:[e(C,{icon:"heart",size:"s",alt:b._({id:"zZOZj7"})})," ",Ke(s)]}),n>0&&e("span",{class:"post-stat-boosts",children:[e(C,{icon:"rocket",size:"s",alt:b._({id:"puY2t0"})})," ",Ke(n)]})]})}function mr(t,n,i){const s=t.map(c=>new Date(c[n])),o=s.reduce((c,l)=>l<c?l:c,s[0]),h=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())/h,f=Math.floor(m*(i-1));r[f].push(c)}),r}const gr=20;function Fs(){Xe(b._({id:"zZOZj7"}),"/favourites");const{masto:t,instance:n}=ae(),i=Y();async function s(o){return(o||!i.current)&&(i.current=t.v1.favourites.list({limit:gr})),await i.current.next()}return e(St,{title:b._({id:"zZOZj7"}),id:"favourites",emptyText:b._({id:"PHIrMr"}),errorText:b._({id:"khVljG"}),instance:n,fetchItems:s})}const br=["home","public","notifications","thread","account"],Ki=["notifications","thread","account"],yr={home:{id:"Buy2bt"},notifications:{id:"iDNBZe"},public:{id:"RO10dm"},thread:{id:"EnJuK0"},account:{id:"vrQQgz"}},vr=[0,30*60,60*60,6*60*60,12*60*60,60*60*24,60*60*24*7,60*60*24*30],Hn={0:{id:"qqeAJM"},1800:tt(30,"minute"),3600:tt(1,"hour"),21600:tt(6,"hour"),43200:tt(12,"hour"),86400:tt(24,"hour"),604800:tt(7,"day"),2592e3:tt(30,"day")};function wr(){const{masto:t}=ae();Xe(b._({id:"cSev+j"}),"/ft");const[n,i]=R("default"),[s,o]=R(!1),[a,h]=Mt(l=>l+1,0),[r,c]=R([]);return ie(()=>{i("loading"),(async()=>{try{const l=await t.v2.filters.list();l.sort((m,f)=>m.title.localeCompare(f.title)),l.forEach(m=>{var f;(f=m.keywords)!=null&&f.length&&m.keywords.sort((p,u)=>p.id-u.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(Pt,{}),e(fe,{to:"/",class:"button plain",children:e(C,{icon:"home",size:"l",alt:b._({id:"i0qMbr"})})})]}),e("h1",{children:e(d,{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:b._({id:"yFfBdX"})})})})]})}),e("main",{children:r.length>0?e(O,{children:[e("ul",{class:"filters-list",children:r.map(l=>{const{id:m,title:f,expiresAt:p,keywords:u}=l;return e("li",{children:[e("div",{children:[e("h2",{children:f}),(u==null?void 0:u.length)>0&&e("div",{children:u.map(y=>e(O,{children:[e("span",{class:"tag collapsed insignificant",children:y.wholeWord?`“${y.keyword}”`:y.keyword})," "]}))}),e("small",{class:"insignificant",children:e(Hs,{expiresAt:p})})]}),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(d,{id:"5vzJxv",values:{0:r.length}})})})]}):n==="loading"?e("p",{class:"ui-state",children:e(Oe,{})}):n==="error"?e("p",{class:"ui-state",children:e(d,{id:"qcAUwp"})}):e("p",{class:"ui-state",children:e(d,{id:"cWIHTt"})})})]}),!!s&&e(Fe,{title:b._({id:"vCSBPD"}),onClose:()=>{o(!1)},children:e(Sr,{filter:s==null?void 0:s.filter,onClose:l=>{l.state==="success"&&h(),o(!1)}})})]})}let kr=1;const _r=()=>kr++;function Sr({filter:t,onClose:n}){const{_:i}=Qe(),{masto:s}=ae(),[o,a]=R("default"),h=!!t,{context:r,expiresAt:c,id:l,keywords:m,title:f,filterAction:p}=t||{},u=!!c,y=u&&new Date(c),[g,w]=R(m||[]),v=Y(),[k,x]=R([]),[S,I]=R([]),_=g.filter(T=>!k.includes(T.id)&&!S.includes(T._id));return e("div",{class:"sheet",id:"filters-add-edit-modal",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(C,{icon:"x",alt:b._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:h?b._({id:"3mOee6"}):b._({id:"yFfBdX"})})}),e("main",{children:e("form",{onSubmit:T=>{T.preventDefault();const $=new FormData(T.target),D=$.get("title"),M=$.getAll("keyword_attributes[][id]"),G=$.getAll("keyword_attributes[][keyword]"),te=[...v.current.querySelectorAll('input[name="keyword_attributes[][whole_word]"]')].map(ne=>ne.checked),B=G.map((ne,L)=>({id:M[L]||void 0,keyword:ne,wholeWord:te[L]}));h&&(k!=null&&k.length)&&k.forEach(ne=>{B.push({id:ne,_destroy:!0})});const V=$.getAll("context");let z=$.get("expires_in");const H=$.get("filter_action");!D||!(V!=null&&V.length)||(a("loading"),(async()=>{try{let ne;h?(z===""||z===null?u?z=Math.floor((y-new Date)/1e3):z=null:z==="0"||z===0?z=null:z=+z,ne=await s.v2.filters.$select(l).update({title:D,context:V,expiresIn:z,keywordsAttributes:B,filterAction:H})):(z=+z||null,ne=await s.v2.filters.create({title:D,context:V,expiresIn:z,keywordsAttributes:B,filterAction:H})),a("default"),n==null||n({state:"success",filter:ne})}catch{a("error"),alert(h?b._({id:"H8RP+h"}):b._({id:"Fr0hAN"}))}})())},children:[e("div",{class:"filter-form-row",children:e("label",{children:[e("b",{children:e(d,{id:"MHrjPM"})}),e("input",{type:"text",name:"title",defaultValue:f,disabled:o==="loading",dir:"auto",required:!0})]})}),e("div",{class:"filter-form-keywords",ref:v,children:[_.length?e("ul",{class:"filter-keywords",children:_.map(T=>{const{id:$,keyword:D,wholeWord:M,_id:G}=T;return e("li",{children:[e("input",{type:"hidden",name:"keyword_attributes[][id]",value:$}),e("input",{name:"keyword_attributes[][keyword]",type:"text",defaultValue:D,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:$,defaultChecked:M,disabled:o==="loading"})," ",e(d,{id:"/7UQ7y"})]}),e("button",{type:"button",class:"light danger small",disabled:o==="loading",onClick:()=>{$?(k.push($),x([...k])):G&&(S.push(G),I([...S]))},children:e(C,{icon:"x",alt:b._({id:"t/YqKh"})})})]})]},`${$}-${G}`)})}):e("div",{class:"filter-keywords",children:e("div",{class:"insignificant",children:e(d,{id:"SYKm3p"})})}),e("footer",{class:"filter-keywords-footer",children:[e("button",{type:"button",class:"light",onClick:()=>{w([...g,{_id:_r(),keyword:"",wholeWord:!0}]),setTimeout(()=>{var $,D;const T=v.current.querySelectorAll('input[type="text"]');(D=($=T[T.length-1])==null?void 0:$.focus)==null||D.call($)},10)},children:e(d,{id:"qn5Dbn"})})," ",(_==null?void 0:_.length)>1&&e("small",{class:"insignificant",children:e(d,{id:"1JZ175",values:{0:_.length}})})]})]}),e("div",{class:"filter-form-cols",children:[e("div",{class:"filter-form-col",children:[e("div",{children:e("b",{children:e(d,{id:"uqf7Yq"})})}),br.map(T=>e("div",{children:[e("label",{class:Ki.includes(T)?"insignificant":"",children:[e("input",{type:"checkbox",name:"context",value:T,defaultChecked:r?r.includes(T):!0,disabled:o==="loading"})," ",i(yr[T]),Ki.includes(T)?"*":""]})," "]})),e("p",{children:e("small",{class:"insignificant",children:e(d,{id:"m0G499"})})})]}),e("div",{class:"filter-form-col",children:[h&&e(d,{id:"ucJk3m",components:{0:e("b",{}),1:e(Hs,{expiresAt:c,showNeverExpires:!0})}}),e("div",{children:[e("label",{for:"filters-expires_in",children:h?b._({id:"BcNdg+"}):b._({id:"agO/T/"})}),e("select",{id:"filters-expires_in",name:"expires_in",disabled:o==="loading",defaultValue:h?void 0:0,children:[h&&e("option",{}),vr.map(T=>e("option",{value:T,children:typeof Hn[T]=="function"?Hn[T]():i(Hn[T])}))]})]}),e("p",{children:[e(d,{id:"blQMpa"}),e("br",{}),e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"warn",defaultChecked:p==="warn"||!h,disabled:o==="loading"})," ",e(d,{id:"jbreWy"})]})," ",e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"hide",defaultChecked:p==="hide",disabled:o==="loading"})," ",e(d,{id:"zNCBmf"})]})]})]})]}),e("footer",{class:"filter-form-footer",children:[e("span",{children:[e("button",{type:"submit",disabled:o==="loading",children:h?b._({id:"tfDRzk"}):b._({id:"hYgDIe"})})," ",e(Oe,{abrupt:!0,hidden:o!=="loading"})]}),h&&e(lt,{disabled:o==="loading",align:"end",menuItemClassName:"danger",confirmLabel:b._({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(b._({id:"4Dh9J1"}))}})()},children:e("button",{type:"button",class:"light danger",onClick:()=>{},disabled:o==="loading",children:e(d,{id:"Jb6/SB"})})})]})]})})]})}function Hs({expiresAt:t,showNeverExpires:n}){const i=!!t,s=i&&new Date(t),o=i&&s<=new Date,[a,h]=Mt(r=>r+1,0);return si(h,o||3e4),o?b._({id:"M1RnFv"}):i?e(d,{id:"urGtsw",components:{0:e(Kt,{datetime:s})}}):n&&b._({id:"O1Aswy"})}function Cr(){const{masto:t,instance:n}=ae();Xe(b._({id:"Xi1/bw"}),"/fh");const[i,s]=R("default"),[o,a]=R([]);return ie(()=>{s("loading"),(async()=>{try{const h=await Cn();a(h),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(Pt,{}),e(fe,{to:"/",class:"button plain",children:e(C,{icon:"home",size:"l",alt:b._({id:"i0qMbr"})})})]}),e("h1",{children:e(d,{id:"Xi1/bw"})}),e("div",{class:"header-side"})]})}),e("main",{children:o.length>0?e(O,{children:[e("ul",{class:"link-list",children:o.map(h=>e("li",{children:e(fe,{to:n?`/${n}/t/${h.name}`:`/t/${h.name}`,children:[e(C,{icon:"hashtag",alt:"#"})," ",e("span",{children:h.name})]})}))}),o.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(d,{id:"2S/uvJ",values:{0:o.length}})})})]}):i==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):i==="error"?e("p",{class:"ui-state",children:e(d,{id:"2AeREO"})}):e("p",{class:"ui-state",children:e(d,{id:"vKsGhk"})})})]})})}const Ir=20;function ki({title:t,path:n,id:i,...s}){Xe(t||b._({id:"following.title"}),n||"/following");const{masto:o,streaming:a,instance:h}=ae(),r=qe(A),c=Y(),l=Y();__BENCHMARK.end("time-to-following");const m=Ze("@pixelfed/home-include-reblogs");async function f(u){var w;(u||!c.current)&&(__BENCHMARK.start("fetch-home-first"),c.current=o.v1.timelines.home.list({limit:Ir})),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 y=await c.current.next();let{value:g}=y;if(g!=null&&g.length){let v=!1;u&&(g[0].id!==l.current&&(v=!0),l.current=g[0].id),g.forEach(k=>{We(k,h)}),g=Yi(g,h),u&&v&&Ua(),Us(g,h),g.sort((k,x)=>{const S=new Date(k.createdAt);return new Date(x.createdAt)-S})}return __BENCHMARK.end("fetch-home-first"),{...y,value:g}}async function p(){var u;try{const y={limit:5,since_id:l.current};Ze("@pixelfed/home-include-reblogs")&&(y.include_reblogs=!0);const g=await o.v1.timelines.home.list(y).next();let{value:w}=g;const v=((u=w[0])==null?void 0:u.id)===l.current;return!!(w!=null&&w.length&&!v&&(l.current=w[0].id,w=Yi(w,h),w=Lt(w,"home"),w.some(k=>!k.reblog)))}catch{return!1}}return ie(()=>{let u;return(async()=>{if(a){u=a.user.subscribe();for await(const y of u){if(!u)break;if(y.event==="status.update"){const g=y.payload;We(g,h)}else if(y.event==="delete"){const g=y.payload,w=us(g,h);w&&(w._deleted=!0)}}}})(),()=>{var y;(y=u==null?void 0:u.unsubscribe)==null||y.call(u),u=null}},[a]),e(St,{title:t||b._({id:"following.title"}),id:i||"following",emptyText:b._({id:"nJEKbY"}),errorText:b._({id:"7QSeK6"}),instance:h,fetchItems:f,checkForUpdates:p,useItemID:!0,boostsCarousel:r.settings.boostsCarousel,...s,filterContext:"home",showFollowedTags:!0,showReplyParent:!0})}const Tr=20,xr=4,Wi=xr+1;function qs({media:t,columnMode:n,...i}){let{hashtag:s,...o}=n?{}:xt();i.hashtag&&(s=i.hashtag);let a=s.trim().split(/[\s+]+/);a.sort(),s=a[0];const[h,r]=pt(),c=t||!!h.get("media"),l=c?"?media=1":"",{masto:m,instance:f,authenticated:p}=ae({instance:(i==null?void 0:i.instance)||o.instance}),{masto:u,instance:y,authenticated:g}=ae(),w=a.map(L=>`#${L}`).join(" "),v=f?c?b._({id:"kH0rA0",values:{hashtagTitle:w,instance:f}}):b._({id:"IK0zKi",values:{hashtagTitle:w,instance:f}}):c?b._({id:"hHSI3w",values:{hashtagTitle:w}}):b._({id:"+ZzjRY",values:{hashtagTitle:w}});Xe(v,"/:instance?/t/:hashtag");const k=Y(),x=Ce(()=>ni(),[]),S=Y(void 0);async function I(L){const q=await m.v1.timelines.tag.$select(s).list({limit:Tr,any:a.slice(1),maxId:L?void 0:S.current,onlyMedia:c?!0:void 0}).next();let{value:U}=q;return U!=null&&U.length&&(L&&(k.current=U[0].id),U.forEach(W=>{We(W,f,{skipThreading:c||x})}),S.current=U[U.length-1].id),{...q,value:U}}async function _(){var L;try{const q=await m.v1.timelines.tag.$select(s).list({limit:1,any:a.slice(1),since_id:k.current,onlyMedia:c}).next();let{value:U}=q;const W=((L=U[0])==null?void 0:L.id)===k.current;return U!=null&&U.length&&!W?(U=Lt(U,"public"),!0):!1}catch{return!1}}const[T,$]=R("default"),[D,M]=R();ie(()=>{(async()=>{try{const L=await m.v1.tags.$select(s).fetch();M(L)}catch{}})()},[s]);const G=a.length>=Wi,[te,B]=R("default"),[V,z]=R([]),[H,ne]=R(!1);return ie(()=>{p&&(async()=>{try{const L=await m.v1.featuredTags.list();z(L),ne(L.some(q=>q.name.toLowerCase()===s.toLowerCase()))}catch{}})()},[]),e(St,{title:v,titleComponent:!!f&&e("h1",{class:"header-double-lines",children:[e("b",{dir:"auto",children:w}),e("div",{children:f})]}),id:"hashtag",instance:f,emptyText:b._({id:"CNSLAW"}),errorText:b._({id:"yjj6Ll"}),fetchItems:I,checkForUpdates:_,useItemID:!0,view:c||x?"media":void 0,refresh:c,filterContext:"public",headerEnd:e(at,{portal:!0,setDownOverflow:!0,overflow:"auto",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(C,{icon:"more",size:"l",alt:b._({id:"2FYpfJ"})})}),children:[!!D&&a.length===1&&e(O,{children:[e(lt,{subMenu:!0,confirm:D.following,confirmLabel:b._({id:"ctJi7k",values:{hashtag:s}}),disabled:T==="loading"||!p,onClick:()=>{$("loading"),D.following?m.v1.tags.$select(s).unfollow().then(()=>{M({...D,following:!1}),he(b._({id:"doK/ij",values:{hashtag:s}}))}).catch(L=>{alert(L)}).finally(()=>{$("default")}):m.v1.tags.$select(s).follow().then(()=>{M({...D,following:!0}),he(b._({id:"R9+aEN",values:{hashtag:s}}))}).catch(L=>{alert(L)}).finally(()=>{$("default")})},children:D.following?e(O,{children:[e(C,{icon:"check-circle"})," ",e("span",{children:e(d,{id:"HOSk7R"})})]}):e(O,{children:[e(C,{icon:"plus"})," ",e("span",{children:e(d,{id:"MKEPCY"})})]})}),e(Se,{type:"checkbox",checked:H,disabled:te==="loading"||!p,onClick:()=>{if(B("loading"),H){const L=V.find(q=>q.name.toLowerCase()===s.toLowerCase()).id;L?m.v1.featuredTags.$select(L).remove().then(()=>{ne(!1),he(b._({id:"VH+Tf9"})),z(V.filter(q=>q.id!==L))}).catch(q=>{}).finally(()=>{B("default")}):he(b._({id:"3OLv47"}))}else m.v1.featuredTags.create({name:s}).then(L=>{ne(!0),he(b._({id:"9ra4hn"})),z(V.concat(L))}).catch(L=>{}).finally(()=>{B("default")})},children:H?e(O,{children:[e(C,{icon:"check-circle"}),e("span",{children:e(d,{id:"9ra4hn"})})]}):e(O,{children:[e(C,{icon:"check-circle"}),e("span",{children:e(d,{id:"UlJ3QN"})})]})}),e(Ge,{})]}),!x&&e(O,{children:[e(ws,{className:"plain",children:e(d,{id:"cSev+j"})}),e(Se,{type:"checkbox",checked:!!c,onClick:()=>{c?h.delete("media"):h.set("media","1"),r(h)},children:[e(C,{icon:"check-circle",alt:"☑️"})," ",e("span",{class:"menu-grow",children:e(d,{id:"eK4SL/"})})]}),e(Ge,{})]}),e(Fo,{className:"menu-field",disabled:G,children:({ref:L})=>e("form",{onSubmit:q=>{var W,de;q.preventDefault();const U=(de=(W=q.target[0].value)==null?void 0:W.trim)==null?void 0:de.call(W);U&&!a.some(Q=>Q.toLowerCase()===U.toLowerCase())&&(a.push(U),a.sort(),location.hash=f?`/${f}/t/${a.join("+")}`:`/t/${a.join("+")}${l}`)},children:[e(C,{icon:"hashtag"}),e("input",{ref:L,type:"text",placeholder:G?b._({id:"ouWc/D",values:{TOTAL_TAGS_LIMIT:Wi}}):b._({id:"cxL5F9"}),required:!0,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:"[^#][^\\s#]+[^#]",disabled:G,dir:"auto"})]})}),e(Ho,{takeOverflow:!0,children:a.map((L,q)=>e(Se,{disabled:a.length===1,onClick:U=>{a.splice(q,1),a.sort(),location.hash=f?`/${f}/t/${a.join("+")}${l}`:`/t/${a.join("+")}${l}`},children:[e(C,{icon:"x",alt:b._({id:"OISAkj"}),class:"danger-icon"}),e("span",{class:"bidi-isolate",children:[e("span",{class:"more-insignificant",children:"#"}),L]})]},L))}),e(Ge,{}),e(Se,{disabled:!g,onClick:()=>{if(A.shortcuts.length>=vt){alert(b._({id:"XN1xAY",values:{SHORTCUTS_LIMIT:vt}}));return}const L={type:"hashtag",hashtag:a.join(" "),instance:f,media:c?"on":void 0};A.shortcuts.some(U=>U.type===L.type&&U.hashtag.split(/[\s+]+/).sort().join(" ")===L.hashtag.split(/[\s+]+/).sort().join(" ")&&(U.instance?U.instance===L.instance:!0)&&(U.media?!!U.media==!!L.media:!0))?alert(b._({id:"kfeQnS"})):(A.shortcuts.push(L),he(b._({id:"MIhb91"})))},children:[e(C,{icon:"shortcut"})," ",e("span",{children:e(d,{id:"i02Lq/"})})]}),e(Se,{onClick:()=>{let L=prompt(b._({id:"2MQ2cd"}));if(!/\./.test(L)){L&&alert(b._({id:"7WddtO"}));return}L&&(L=L.toLowerCase().trim(),location.hash=`/${L}/t/${a.join("+")}${l}`)},children:[e(C,{icon:"bus"})," ",e("span",{children:e(d,{id:"Sq04Yc"})})]}),y!==f&&e(Se,{onClick:()=>{location.hash=`/${y}/t/${a.join("+")}${l}`},children:[e(C,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(d,{id:"iAzCp4",values:{currentInstance:y},components:{0:e("b",{})}})})]})]})},f+w)}const Ar=20;function Ys(t){var v;const n=qe(A),{masto:i,instance:s}=ae(),o=(t==null?void 0:t.id)||((v=xt())==null?void 0:v.id),a=Y(),h=Y();async function r(k){(k||!h.current)&&(h.current=i.v1.timelines.list.$select(o).list({limit:Ar}));const x=await h.current.next();let{value:S}=x;return S!=null&&S.length&&(k&&(a.current=S[0].id),S.forEach(I=>{We(I,s)})),{...x,value:S}}async function c(){var k;try{const x=await i.v1.timelines.list.$select(o).list({limit:1,since_id:a.current});let{value:S}=x;const I=((k=S[0])==null?void 0:k.id)===a.current;return S!=null&&S.length&&!I?(S=Lt(S,"home"),!0):!1}catch{return!1}}const[l,m]=R([]);ie(()=>{cn().then(m)},[]);const[f,p]=R({title:"List"});Xe(f.title,"/l/:id"),ie(()=>{(async()=>{try{const k=await Ls(o);p(k)}catch{}})()},[o]);const[u,y]=R(!1),[g,w]=R(!1);return e(O,{children:[e(St,{title:f.title,id:"list",emptyText:b._({id:"KkDhfU"}),errorText:b._({id:"7QSeK6"}),instance:s,fetchItems:r,checkForUpdates:c,useItemID:!0,boostsCarousel:n.settings.boostsCarousel,filterContext:"home",showReplyParent:!0,headerStart:e(at,{overflow:"auto",menuButton:e("button",{type:"button",class:"plain",children:[e(C,{icon:"list",size:"l",alt:b._({id:"h16FyT"})}),e(C,{icon:"chevron-down",size:"s"})]}),children:[e(Be,{to:"/l",children:e("span",{children:e(d,{id:"BHWx+g"})})}),(l==null?void 0:l.length)>0&&e(O,{children:[e(Ge,{}),l.map(k=>e(Be,{to:`/l/${k.id}`,children:e("span",{children:k.title})},k.id))]})]}),headerEnd:e(at,{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:b._({id:"2FYpfJ"})})}),children:[e(Se,{onClick:()=>y({list:f}),children:[e(C,{icon:"pencil",size:"l"}),e("span",{children:e(d,{id:"ePK91l"})})]}),e(Se,{onClick:()=>w(!0),children:[e(C,{icon:"group",size:"l"}),e("span",{children:e(d,{id:"hB02vO"})})]})]})},o),u&&e(Fe,{onClick:k=>{k.target===k.currentTarget&&y(!1)},children:e(gi,{list:u==null?void 0:u.list,onClose:k=>{k.state==="success"&&k.list?p(k.list):k.state==="deleted"&&(location.hash="/l"),y(!1)}})}),g&&e(Fe,{onClick:k=>{k.target===k.currentTarget&&w(!1)},children:e(Rr,{listID:o,onClose:()=>w(!1)})})]})}const Er=40;function Rr({listID:t,onClose:n}){const{masto:i,instance:s}=ae(),[o,a]=R([]),[h,r]=R("default"),[c,l]=R(!1),m=Y();async function f(p){l(!1),r("loading"),(async()=>{try{(p||!m.current)&&(m.current=i.v1.lists.$select(t).accounts.list({limit:Er}));const u=await m.current.next();let{done:y,value:g}=u;g!=null&&g.length?(a(p?g:o.concat(g)),l(!y)):l(!1),r("default")}catch{r("error")}})()}return ie(()=>{f(!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:b._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(d,{id:"hB02vO"})})}),e("main",{children:e("ul",{children:[o.map(p=>e("li",{children:[e(rt,{account:p,instance:s}),e(Lr,{account:p,listID:t})]},p.id)),c&&h==="default"&&e(kt,{as:"li",onChange:p=>p&&f(),children:e("button",{type:"button",class:"light block",onClick:f,children:e(d,{id:"uXRAkV"})})})]})})]})}function Lr({account:t,listID:n}){const{masto:i}=ae(),[s,o]=R("default"),[a,h]=R(!1);return e(lt,{confirm:!a,confirmLabel:e("span",{children:e(d,{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"),h(!1)}catch{o("error")}})()):(o("loading"),(async()=>{try{await i.v1.lists.$select(n).accounts.remove({accountIds:[t.id]}),o("default"),h(!0)}catch{o("error")}})())},children:e("button",{type:"button",class:`light ${a?"":"danger"}`,disabled:s==="loading",children:a?b._({id:"m16xKo"}):b._({id:"MWIaew"})})})}const $r={mention:["account","status"],status:["account","status"],reblog:["account","status"],follow:["account"],follow_request:["account"],favourite:["account","status"],poll:["status"],update:["status"]},Mr=["favourite","reblog","follow"],js=t=>Mr.includes(t);function Vs(t){return t.filter(n=>{const{type:i,id:s,createdAt:o}=n;if(!i)return!1;const a=$r[i];return a!=null&&a.length?a.every(h=>!!n[h]):!0})}function Gs(t){if(t!=null&&t.notificationGroups){const{accounts:n=[],notificationGroups:i=[],statuses:s=[]}=t;return i.map(o=>{const{sampleAccountIds:a,statusId:h}=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===h))||null;return{...o,sampleAccounts:r,status:c}})}return t}function Dr(t){const n=t.map(h=>{const{latestPageNotificationAt:r,mostRecentNotificationId:c,sampleAccounts:l,notificationsCount:m}=h;return{id:""+c,createdAt:r,account:l[0],...h}}),i={},s=[];for(let h=0;h<n.length;h++){const r=n[h],{type:c,status:l,createdAt:m,notificationsCount:f,sampleAccounts:p,groupKey:u}=r,y=m?new Date(m).toLocaleDateString():"";let g=c;f>0&&(p==null||p.length),(c==="favourite"||c==="reblog")&&(g="favourite+reblog");const w=`${l==null?void 0:l.id}-${g}-${y}`,v=i[w];if(!js(c))s.push(r);else if(v)p.forEach(k=>{const x=v.sampleAccounts.find(S=>S.id===k.id);x?(x._types.push(c),x._types.sort().reverse()):v.sampleAccounts.push({...k,_types:[c]})}),v.notificationsCount=Math.min(v.notificationsCount,f),v._notificationsCount.push(f),v._accounts=v.sampleAccounts,v._groupKeys.push(u);else{const k=p.map(x=>({...x,_types:[c]}));i[w]={...r,sampleAccounts:k,type:g,_accounts:k,_groupKeys:u?[u]:[],_notificationsCount:[f]},s.push(i[w])}}const o={},a=[];for(let h=0;h<s.length;h++){const r=s[h],{type:c,account:l,_accounts:m,sampleAccounts:f,createdAt:p,groupKey:u}=r,y=p?new Date(p).toLocaleDateString():"",g=(f==null?void 0:f.length)===1||(m==null?void 0:m.length)===1;if((c==="favourite"||c==="reblog"||c==="favourite+reblog")&&g){const w=`${l==null?void 0:l.id}-${c}-${y}`,v=o[w];if(v)v._statuses.push(r.status),v._ids+=`-${r.id}`,v._groupKeys.push(u);else{let k=o[w]={...r,type:c,_ids:r.id,_statuses:[r.status],_groupKeys:u?[u]:[]};a.push(k)}}else a.push(r)}return a}function Nr(t){t=Vs(t);const n={},i=[];for(let a=0,h=0;a<t.length;a++){const r=t[a],{id:c,status:l,account:m,type:f,createdAt:p}=r,u=p?new Date(p).toLocaleDateString():"";let y=f;(f==="favourite"||f==="reblog")&&(y="favourite+reblog");const g=`${l==null?void 0:l.id}-${y}-${u}`,w=n[g];if(!js(f))i[h++]=r;else if(w!=null&&w.account){const v=w._accounts.find(k=>k.id===m.id);v?(v._types.push(f),v._types.sort().reverse(),w._ids+=`-${c}`):(m._types=[f],w._accounts.push(m),w._ids+=`-${c}`)}else{m&&(m._types=[f]);let v=n[g]={...r,type:y,_ids:c,_accounts:m?[m]:[]};i[h++]=v}}const s={},o=[];for(let a=0,h=0;a<i.length;a++){const r=i[a],{id:c,account:l,_accounts:m,type:f,createdAt:p}=r,u=p?new Date(p).toLocaleDateString():"";if(f==="favourite+reblog"&&l&&m.length===1){const y=`${l==null?void 0:l.id}-${f}-${u}`,g=s[y];if(g)g._statuses.push(r.status),g._ids+=`-${c}`;else{let w=s[y]={...r,type:f,_ids:c,_statuses:[r.status]};o[h++]=w}}else o[h++]=r}return o}const Zi=20,Pr=new URLSearchParams;function Ks({columnMode:t,...n}){const{masto:i,instance:s}=ae(),[o]=t?[Pr]:pt(),[a,h]=R(null),r=(n==null?void 0:n.type)||o.get("type")||a;Xe(r==="private"?b._({id:"2BApYc"}):b._({id:"/bZzdR"}),"/mentions");const c=Y(),l=Y();async function m(v){(v||!c.current)&&(c.current=i.v1.notifications.list({limit:Zi,types:["mention"]}));const k=await c.current.next();let{value:x}=k;return x!=null&&x.length&&(x=Vs(x),v&&(l.current=x[0].id),x.forEach(({status:S})=>{We(S,s)})),{...k,value:x==null?void 0:x.map(S=>S.status)}}const f=Y(),p=Y();async function u(v){(v||!f.current)&&(f.current=i.v1.conversations.list({limit:Zi}));const k=await f.current.next();let{value:x}=k;return x=x==null?void 0:x.filter(S=>S.lastStatus),x!=null&&x.length&&(v&&(p.current=x[0].lastStatus.id),x.forEach(({lastStatus:S})=>{We(S,s)})),{...k,value:x==null?void 0:x.map(S=>S.lastStatus)}}function y(...v){return r==="private"?u(...v):m(...v)}async function g(){var v;if(r==="private")try{const k=await i.v1.conversations.list({limit:1,since_id:p.current}).next();let{value:x}=k;const S=((v=x[0])==null?void 0:v.id)===p.current;return x!=null&&x.length&&!S?(p.current=x[0].lastStatus.id,!0):!1}catch{return!1}else try{const k=await i.v1.notifications.list({limit:1,types:["mention"],since_id:l.current}).next();let{value:x}=k;return x!=null&&x.length?(l.current=x[0].id,!0):!1}catch{return!1}}const w=Ce(()=>e("div",{class:"filter-bar centered",children:[e(fe,{to:"/mentions",class:r?"":"is-active",onClick:v=>{t&&(v.preventDefault(),h(null))},children:e(d,{id:"N40H+G"})}),e(fe,{to:"/mentions?type=private",class:r==="private"?"is-active":"",onClick:v=>{t&&(v.preventDefault(),h("private"))},children:e(d,{id:"zwBp5t"})})]}),[r]);return e(St,{title:b._({id:"/bZzdR"}),id:"mentions",emptyText:b._({id:"03jFGT"}),errorText:b._({id:"pqR9KF"}),instance:s,fetchItems:y,checkForUpdates:g,useItemID:!0,timelineStart:w,refresh:r})}const Or=80,zr=20,Ur=new URLSearchParams,ln={block:"center",inline:"center",behavior:"smooth"},Ws=ds(()=>Ze("@mastodon/grouped-notifications"),{maxAge:1e3*60*5});function Xn(t={}){const{masto:n}=ae();return A.settings.groupedNotificationsAlpha&&Ws()?n.v2.notifications.list({limit:zr,...t}):n.v1.notifications.list({limit:Or,...t})}function Zs(t){return A.settings.groupedNotificationsAlpha&&Ws()?Dr(t):Nr(t)}const Br=["forNotFollowing","forNotFollowers","forNewAccounts","forPrivateMentions","forLimitedAccounts"],Fr={forNotFollowing:{id:"d+hDoa"},forNotFollowers:{id:"oAwuQj"},forNewAccounts:{id:"Srs8u7"},forPrivateMentions:{id:"IDC5Uw"},forLimitedAccounts:{id:"XMGM2e"}};function Hr({columnMode:t}){var re;const{_:n}=Qe();Xe(b._({id:"iDNBZe"}),"/notifications");const{masto:i,instance:s}=ae(),o=qe(A),[a,h]=R("default"),[r]=t?[Ur]:pt(),c=r.get("id"),l=r.get("access_token"),[m,f]=R(!1),[p,u]=R(!1),y=Y(),{nearReachEnd:g,scrollDirection:w,reachStart:v,nearReachStart:k}=Ba({scrollableRef:y}),x=w==="end"&&!k,[S,I]=R([]),[_,T]=R([]),$=Y();async function D(N){var F;if((N||!$.current)&&($.current=Xn({excludeTypes:["follow_request"]})),/max_id=($|&)/i.test((F=$.current)==null?void 0:F.nextParams))return{done:!0};const ce=await $.current.next(),Ie=Gs(ce.value);if(Ie!=null&&Ie.length){Ie.forEach(Ae=>{We(Ae.status,s,{skipThreading:!0})});const pe=Zs(Ie);N?(A.notificationsLast=pe[0],A.notifications=pe,i.v1.markers.create({notifications:{lastReadId:pe[0].id}}).catch(()=>{})):A.notifications.push(...pe)}return A.notificationsShowNew=!1,A.notificationsLastFetchTime=Date.now(),ce}async function M(){try{return await i.v1.followRequests.list({limit:80})}catch{return[]}}const G=()=>{h("loading"),(async()=>{try{const N=await M();I(N),h("default")}catch{h("error")}})()};async function te(){try{return await i.v1.announcements.list()}catch{return[]}}const B=Ze("@mastodon/filtered-notifications"),[V,z]=R(!1),[H,ne]=R({});function L(){return i.v2.notifications.policy.fetch().catch(()=>{})}function q(){L().then(N=>{ne(N)}).catch(()=>{})}const[U,W]=R(null);function de(){return i.v1.notifications.requests.list()}const Q=N=>{ke(!1),h("loading"),(async()=>{try{const ce=D(N);N&&(te().then(F=>{F.sort((pe,Ae)=>{const E=new Date(pe.updatedAt||pe.createdAt);return new Date(Ae.updatedAt||Ae.createdAt)-E}),T(F)}).catch(()=>{}),M().then(F=>{I(F)}).catch(()=>{}),B&&q());const{done:Ie}=await ce;f(!Ie),h("default")}catch{h("error")}})()};ie(()=>{Q(!0)},[]),ie(()=>{v&&Q(!0)},[v]);const[me,ke]=R(!1),ue=ct(({disableIdleCheck:N=!1}={})=>{var ce;a!=="loading"&&o.settings.autoRefresh&&((ce=y.current)==null?void 0:ce.scrollTop)<16&&(N||window.__IDLE__)&&!qr()&&Q(!0)},[o.notificationsShowNew,o.settings.autoRefresh,a]),j=Y();qt(N=>{if(N){const ce=Date.now()-j.current;!j.current||ce>1e3*3?ue({disableIdleCheck:!0}):j.current=Date.now()}});const be=Y(!0);ie(()=>{let N=yo(A,"notificationsShowNew",ce=>{if(be.current){be.current=!1;return}a!=="loading"&&(ce&&ue(),ke(ce))});return()=>N==null?void 0:N()},[]);const Re=new Date,xe=new Date(Re-24*60*60*1e3);let Ne=new Date;const Pe=!o.notifications.some(N=>new Date(N.createdAt).toDateString()===Re.toDateString()),_e=Y();ie(()=>{c&&(A.routeNotification={id:c,accessToken:atob(l)})},[c,l]);const[J,ge]=R(null);ie(async()=>{var F,pe,Ae;const N=new Date;if(N.getMonth()!==11||!Ze("@mastodon/annual-report"))return;let ce=ve.account.get("annualReportNotification");if(ce){ge(ce);return}const Ie=Xn({types:["annual_report"]});try{const E=await Ie.next();ce=(pe=(F=E==null?void 0:E.value)==null?void 0:F.notificationGroups)==null?void 0:pe[0],((Ae=ce==null?void 0:ce.annualReport)==null?void 0:Ae.year)==N.getFullYear()&&(ge(ce),ve.account.set("annualReportNotification",ce))}catch{}},[]);const Ee=".notification",le=Ue("j",()=>{const N=document.activeElement.closest(Ee),ce=N==null?void 0:N.getBoundingClientRect(),Ie=Array.from(y.current.querySelectorAll(Ee));if(N&&ce.top<y.current.clientHeight&&ce.bottom>0){const F=Ie.indexOf(N);let pe=Ie[F+1];pe&&(pe.focus(),pe.scrollIntoView(ln))}else{const F=Ie.find(pe=>{const Ae=pe.getBoundingClientRect();return Ae.top>=44&&Ae.left>=0});F&&(F.focus(),F.scrollIntoView(ln))}}),X=Ue("k",()=>{const N=document.activeElement.closest(Ee),ce=N==null?void 0:N.getBoundingClientRect(),Ie=Array.from(y.current.querySelectorAll(Ee));if(N&&ce.top<y.current.clientHeight&&ce.bottom>0){const F=Ie.indexOf(N);let pe=Ie[F-1];pe&&(pe.focus(),pe.scrollIntoView(ln))}else{const F=Ie.find(pe=>{const Ae=pe.getBoundingClientRect();return Ae.top>=44&&Ae.left>=0});F&&(F.focus(),F.scrollIntoView(ln))}}),we=Ue(["enter","o"],()=>{const N=document.activeElement.closest(Ee),ce=N==null?void 0:N.querySelector(".status-link");ce&&ce.click()}),P=new Date,ee=Ce(()=>ft(P,{forceOpts:{weekday:"long"}}),[P]);return e("div",{id:"notifications-page",class:"deck-container",ref:N=>{y.current=N,le(N),X(N),we(N)},tabIndex:"-1",children:[e("div",{class:`timeline-deck deck ${p?"only-mentions":""}`,children:[e("header",{hidden:x,onClick:N=>{var ce;N.target.closest("a, button")||(ce=y.current)==null||ce.scrollTo({top:0,behavior:"smooth"})},onDblClick:N=>{N.target.closest("a, button")||Q(!0)},class:a==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Pt,{}),e(fe,{to:"/",class:"button plain",children:e(C,{icon:"home",size:"l",alt:b._({id:"i0qMbr"})})})]}),e("h1",{children:e(d,{id:"iDNBZe"})}),e("div",{class:"header-side",children:B&&e("button",{type:"button",class:"button plain4",onClick:()=>{z(!0)},children:e(C,{icon:"settings",size:"l",alt:b._({id:"a/+arl"})})})})]}),me&&a!=="loading"&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:()=>{var N;Q(!0),(N=y.current)==null||N.scrollTo({top:0,behavior:"smooth"})},children:[e(C,{icon:"arrow-up"})," ",e(d,{id:"Jy9RU/"})]})]}),_.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(d,{id:"0whvLM",values:{0:_.length}})," ",e("small",{class:"insignificant",children:s})]}),_.length>1&&e("span",{class:"announcements-nav-buttons",children:_.map((N,ce)=>e("button",{type:"button",class:"plain2 small",onClick:()=>{var Ie;(Ie=_e.current)==null||Ie.children[ce].scrollIntoView({behavior:"smooth",block:"nearest"})},children:ce+1}))})]}),e("ul",{class:`announcements-list-${_.length>1?"multiple":"single"}`,ref:_e,children:_.map(N=>e("li",{children:e(Yr,{announcement:N})}))})]})})}),S.length>0&&e("div",{class:"follow-requests",children:[e("h2",{class:"timeline-header",children:e(d,{id:"6Fs1Ba"})}),S.length>5?e("details",{children:[e("summary",{children:e(d,{id:"7dHKu4",values:{0:S.length}})}),e("ul",{children:S.map(N=>e("li",{children:[e(rt,{account:N}),e(Zn,{accountID:N.id,onChange:()=>{}})]},N.id))})]}):e("ul",{children:S.map(N=>e("li",{children:[e(rt,{account:N}),e(Zn,{accountID:N.id,onChange:()=>{}})]},N.id))})]}),B&&((re=H==null?void 0:H.summary)==null?void 0:re.pendingRequestsCount)>0&&e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e("div",{class:"filtered-notifications",children:e("details",{onToggle:async N=>{const{open:ce}=N.target;if(ce){const Ie=await de();W(Ie)}},children:[e("summary",{children:e(d,{id:"N3Bq0f",values:{0:H.summary.pendingRequestsCount}})}),U?(U==null?void 0:U.length)>0&&e("ul",{children:U.map(N=>{var ce,Ie;return e("li",{children:[e("div",{class:"request-notifcations",children:[!((ce=N.lastStatus)!=null&&ce.id)&&e(rt,{useAvatarStatic:!0,showStats:!0,account:N.account}),((Ie=N.lastStatus)==null?void 0:Ie.id)&&e("div",{class:"last-post",children:e(fe,{class:"status-link",to:`/${s}/s/${N.lastStatus.id}`,children:e(Ye,{status:N.lastStatus,size:"s",readOnly:!0})})}),e(Vr,{request:N})]}),e(Gr,{request:N,onChange:()=>{Q(!0)}})]},N.id)})}):e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})})]})})})}),J&&e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e(on,{notification:J})})}),e("div",{id:"mentions-option",children:e("label",{children:[e("input",{type:"checkbox",checked:p,onChange:N=>{u(N.target.checked)}})," ",e(d,{id:"0udtPI"})]})}),e("h2",{class:"timeline-header",children:[e(d,{id:"ecUA8p"})," ",e("small",{class:"insignificant bidi-isolate",children:ee})]}),Pe&&e("p",{class:"ui-state insignificant",children:a==="default"?b._({id:"KS7iJH"}):e(O,{children:"…"})}),o.notifications.length?e(O,{children:o.notifications.filter(N=>N.type!=="follow_request").map(N=>{if(p&&N.type!=="mention")return null;const ce=new Date(N.createdAt),Ie=ce.toDateString()!==Ne.toDateString();Ie&&(Ne=ce);const F=ce.toDateString()===xe.toDateString()?b._({id:"y/0uwd"}):ft(Ne,{hideTime:!0}),pe=ft(Ne,{forceOpts:{weekday:"long"}});return e(O,{children:[Ie&&e("h2",{class:"timeline-header",children:[e("span",{children:F})," ",e("small",{class:"insignificant bidi-isolate",children:pe})]}),e(on,{instance:s,notification:N},N._ids||N.id)]},N._ids||N.id)})}):e(O,{children:[a==="loading"&&e(O,{children:e("ul",{class:"timeline flat",children:Array.from({length:5}).map((N,ce)=>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(d,{id:"gjzl8E"}),e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>Q(!0),children:e(d,{id:"KDw4GX"})})]})]}),m&&e(kt,{onChange:N=>{N&&Q()},children:e("button",{type:"button",class:"plain block",disabled:a==="loading",onClick:()=>Q(),style:{marginBlockEnd:"6em"},children:a==="loading"?e(Oe,{abrupt:!0}):e(d,{id:"uXRAkV"})})})]}),B&&V&&e(Fe,{onClick:N=>{N.target===N.currentTarget&&z(!1)},children:e("div",{class:"sheet",id:"notifications-settings",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>z(!1),children:e(C,{icon:"x",alt:b._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(d,{id:"a/+arl"})})}),e("main",{children:e("form",{onSubmit:N=>{N.preventDefault();const{forNotFollowing:ce,forNotFollowers:Ie,forNewAccounts:F,forPrivateMentions:pe,forLimitedAccounts:Ae}=N.target,E={...H,forNotFollowing:ce.value,forNotFollowers:Ie.value,forNewAccounts:F.value,forPrivateMentions:pe.value,forLimitedAccounts:Ae.value};ne(E),z(!1),(async()=>{try{await i.v2.notifications.policy.update(E),he(b._({id:"4+7X9i"}))}catch{}})()},children:[e("p",{children:e(d,{id:"WrkPTf"})}),e("div",{class:"notification-policy-fields",children:Br.map(N=>{const ce=H[N];return e("div",{children:e("label",{children:[n(Fr[N]),e("select",{name:N,defaultValue:ce,class:"small",children:[e("option",{value:"accept",children:e(d,{id:"g3UF2V"})}),e("option",{value:"filter",children:e(d,{id:"o7J4JM"})}),e("option",{value:"drop",children:e(d,{id:"gbbkE7"})})]})]})},N)})}),e("p",{children:e("button",{type:"submit",children:e(d,{id:"tfDRzk"})})})]})})]})})]})}function qr(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}function Yr({announcement:t}){const{instance:n}=ae(),{contact:i}=as(),s=i==null?void 0:i.account,{id:o,content:a,startsAt:h,endsAt:r,published:c,allDay:l,publishedAt:m,updatedAt:f,read:p,mentions:u,statuses:y,tags:g,emojis:w,reactions:v}=t,k=new Date(m),x=ft(k),S=new Date(f),I=ft(S);return e("div",{class:"announcement-block",children:[e(rt,{account:s}),e("div",{class:"announcement-content",onClick:fs({mentions:u,instance:n}),dangerouslySetInnerHTML:{__html:jn(a,{emojis:w})}}),e("p",{class:"insignificant",children:[e("time",{datetime:k.toISOString(),children:ft(k)}),f&&I!==x&&e(O,{children:[" ","•"," ",e("span",{class:"ib",children:e(d,{id:"TbFrLc",values:{0:ft(S)},components:{0:e("time",{datetime:S.toISOString()})}})})]})]}),e("div",{class:"announcement-reactions",hidden:!0,children:v.map(_=>{const{name:T,count:$,me:D,staticUrl:M,url:G}=_;return e("button",{type:"button",class:`plain4 small ${D?"reacted":""}`,children:[G||M?e("img",{src:G||M,alt:T,width:"16",height:"16"}):e("span",{children:T})," ",e("span",{class:"count",children:Ke($)})]})})})]})}function jr(t){const{masto:n}=ae();return n.v1.notifications.list({accountID:t})}function Vr({request:t}){var f;const{instance:n}=ae(),[i,s]=R("loading"),{account:o,lastStatus:a}=t,[h,r]=R(!1),[c,l]=R([]);function m(){r(!1)}return ie(()=>{var p;(p=t==null?void 0:t.account)!=null&&p.id&&h&&(s("loading"),(async()=>{const u=await jr(t.account.id);l(u||[]),s("default")})())},[h,(f=t==null?void 0:t.account)==null?void 0:f.id]),e(O,{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(d,{id:"H0wUNM",values:{0:o.username},components:{0:e("span",{class:"bidi-isolate"})}})})," ",e(C,{icon:"chevron-down"})]}),h&&e(Fe,{onClick:p=>{p.target===p.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:b._({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(d,{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(Oe,{abrupt:!0})}):c.map(p=>e("div",{class:"notification-peek",onClick:u=>{const{target:y}=u;(u.target.tagName==="BUTTON"||u.target.tagName==="A")&&m()},children:e(on,{instance:n,notification:p,isStatic:!0})}))})]})})]})}function Gr({request:t,onChange:n}){const{masto:i}=ae(),[s,o]=R("default"),[a,h]=R(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(),h("accept"),o("default"),n({request:t,state:"accept"}),he(b._({id:"ZtBMwU",values:{0:t.account.username}}))}catch{o("error"),he(b._({id:"S92JKG"}))}})()},children:e(d,{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(),h("dismiss"),o("default"),n({request:t,state:"dismiss"}),he(b._({id:"ibBDry",values:{0:t.account.username}}))}catch{o("error"),he(b._({id:"S5aemF"}))}})()},children:e(d,{id:"1QfxQT"})}),e("span",{class:"notification-request-states",children:s==="loading"?e(Oe,{abrupt:!0}):a==="accept"?e(C,{icon:"check-circle",alt:b._({id:"bzMKg7"}),class:"notification-accepted"}):a==="dismiss"&&e(C,{icon:"x-circle",alt:b._({id:"J6hrEy"}),class:"notification-dismissed"})})]})}const Xs=st(Hr),Kr=20;function Jn({local:t,columnMode:n,...i}){const s=qe(A),o=!!t,a=n?{}:xt(),{masto:h,instance:r}=ae({instance:(i==null?void 0:i.instance)||a.instance}),{masto:c,instance:l}=ae(),m=o?b._({id:"u96B/B",values:{instance:r}}):b._({id:"PgVqvd",values:{instance:r}});Xe(m,o?"/:instance?/p/l":"/:instance?/p");const f=Y(),p=Y();async function u(g){if(g||!p.current){const k={limit:Kr,local:o||void 0};!o&&Ze("@pixelfed/global-feed")&&(k.remote=!0),p.current=h.v1.timelines.public.list(k)}const w=await p.current.next();let{value:v}=w;return v!=null&&v.length&&(g&&(f.current=v[0].id),v.forEach(k=>{We(k,r)})),{...w,value:v}}async function y(){var g;try{const w=await h.v1.timelines.public.list({limit:1,local:o,since_id:f.current}).next();let{value:v}=w;const k=((g=v[0])==null?void 0:g.id)===f.current;return v!=null&&v.length&&!k?(v=Lt(v,"public"),!0):!1}catch{return!1}}return e(St,{title:m,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:o?b._({id:"pJQgQV"}):b._({id:"cg0I+x"})}),e("div",{children:r})]}),id:"public",instance:r,emptyText:b._({id:"BiZJ6G"}),errorText:b._({id:"scd9lw"}),fetchItems:u,checkForUpdates:y,useItemID:!0,headerStart:e(O,{}),boostsCarousel:s.settings.boostsCarousel,filterContext:"public",headerEnd:e(at,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(C,{icon:"more",size:"l",alt:b._({id:"2FYpfJ"})})}),children:[e(Se,{href:o?`/#/${r}/p`:`/#/${r}/p/l`,children:o?e(O,{children:[e(C,{icon:"transfer"})," ",e("span",{children:e(d,{id:"dXMiUw"})})]}):e(O,{children:[e(C,{icon:"transfer"})," ",e("span",{children:e(d,{id:"t2B/we"})})]})}),e(Ge,{}),e(Se,{onClick:()=>{let g=prompt(b._({id:"2MQ2cd"}));if(!/\./.test(g)){g&&alert(b._({id:"7WddtO"}));return}g&&(g=g.toLowerCase().trim(),location.hash=o?`/${g}/p/l`:`/${g}/p`)},children:[e(C,{icon:"bus"})," ",e("span",{children:e(d,{id:"Sq04Yc"})})]}),l!==r&&e(Se,{onClick:()=>{location.hash=o?`/${l}/p/l`:`/${l}/p`},children:[e(C,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(d,{id:"iAzCp4",values:{currentInstance:l},components:{0:e("b",{})}})})]})]})},r+o)}const dn=5,qn=40,Wr=new URLSearchParams,un={block:"nearest",inline:"center",behavior:"smooth"};function Js({columnMode:t,...n}){const i=t?{}:xt(),{masto:s,instance:o,authenticated:a}=ae({instance:i.instance}),[h,r]=R("default"),[c]=t?[Wr]:pt(),l=Y(),m=(n==null?void 0:n.query)||c.get("q"),f=t?"statuses":(n==null?void 0:n.type)||c.get("type");let p=b._({id:"A1taO8"});if(m)switch(f){case"statuses":p=b._({id:"6YeoAt",values:{q:m}});break;case"accounts":p=b._({id:"fpgumQ",values:{q:m}});break;case"hashtags":p=b._({id:"AuiMZZ",values:{q:m}});break;default:p=b._({id:"wr3GZI",values:{q:m}})}Xe(p,"/search");const[u,y]=R(!1),g=Y(0);ie(()=>{g.current=0},[m,f]);const w=Y();gt(()=>{var L,q;(q=(L=w.current)==null?void 0:L.scrollTo)==null||q.call(L,0,0)},[m,f]);const[v,k]=R([]),[x,S]=R([]),[I,_]=R([]);ie(()=>{k([]),S([]),_([])},[m]);const T={statuses:v,accounts:x,hashtags:I},$={statuses:k,accounts:S,hashtags:_},[D,M]=R({}),G=async L=>{if(!(L!=null&&L.length))return;const q=await oi(L,D);q&&M({...D,...q})};function te(L){L&&(g.current=0),!(!L&&!a)&&(r("loading"),L&&!f&&(k(v.slice(0,dn)),S(x.slice(0,dn)),_(I.slice(0,dn))),(async()=>{var U,W,de,Q,me,ke;const q={q:m,resolve:a,limit:dn};f&&(q.limit=qn,q.type=f,a&&(q.offset=g.current));try{const ue=await s.v2.search.fetch(q);if(f)if(L){$[f](ue[f]);const j=(U=ue[f])==null?void 0:U.length;g.current=qn,y(!!j)}else if(((de=(W=ue[f])==null?void 0:W[0])==null?void 0:de.id)===((me=(Q=T[f])==null?void 0:Q[0])==null?void 0:me.id))y(!1);else{$[f](be=>[...be,...ue[f]]);const j=(ke=ue[f])==null?void 0:ke.length;g.current=g.current+qn,y(!!j)}else k(ue.statuses||[]),S(ue.accounts||[]),_(ue.hashtags||[]),g.current=0,y(!1);G(ue.accounts),r("default")}catch{r("error")}})())}const B=Y();qt(L=>{var U;const q=((U=w.current)==null?void 0:U.scrollTop)===0;if(L&&q){const W=Date.now()-B.current;!B.current||W>1e3*3?te(!0):B.current=Date.now()}}),ie(()=>{var q,U;let L;return(U=(q=l.current)==null?void 0:q.setValue)==null||U.call(q,m||""),m?te(!0):L=setTimeout(()=>{var W,de;(de=(W=l.current)==null?void 0:W.focus)==null||de.call(W)},150),()=>clearTimeout(L)},[m,f,o]),Ue(["/","Slash"],L=>{var q,U,W,de;(U=(q=l.current)==null?void 0:q.focus)==null||U.call(q),(de=(W=l.current)==null?void 0:W.select)==null||de.call(W)},{preventDefault:!0});const V=".timeline > li > a, .hashtag-list > li > a",z=Ue("j",()=>{const L=document.activeElement.closest(V),q=L==null?void 0:L.getBoundingClientRect(),U=Array.from(w.current.querySelectorAll(V));if(L&&q.top<w.current.clientHeight&&q.bottom>0){const W=U.indexOf(L);let de=U[W+1];de&&(de.focus(),de.scrollIntoView(un))}else{const W=U.find(de=>{const Q=de.getBoundingClientRect();return Q.top>=44&&Q.left>=0});W&&(W.focus(),W.scrollIntoView(un))}}),H=Ue("k",()=>{const L=document.activeElement.closest(V),q=L==null?void 0:L.getBoundingClientRect(),U=Array.from(w.current.querySelectorAll(V));if(L&&q.top<w.current.clientHeight&&q.bottom>0){const W=U.indexOf(L);let de=U[W-1];de&&(de.focus(),de.scrollIntoView(un))}else{const W=U.find(de=>{const Q=de.getBoundingClientRect();return Q.top>=44&&Q.left>=0});W&&(W.focus(),W.scrollIntoView(un))}}),[ne]=hi();return e("div",{id:"search-page",class:"deck-container",tabIndex:"-1",ref:L=>{w.current=L,z(L),H(L)},children:e("div",{class:"timeline-deck deck",children:[e("header",{class:h==="loading"?"loading":"",children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:e(Pt,{})}),e(zs,{ref:l}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{te(!0)},disabled:h==="loading",children:e(C,{icon:"search",size:"l",alt:b._({id:"A1taO8"})})})})]})}),e("main",{children:[!!m&&!t&&e("div",{ref:ne,class:`filter-bar ${h==="loading"?"loading":""}`,children:[!!f&&e(fe,{to:`/search${m?`?q=${encodeURIComponent(m)}`:""}`,children:[e(C,{icon:"chevron-left"})," ",e(d,{id:"N40H+G"})]}),[{label:b._({id:"bPwFdf"}),type:"accounts",to:`/search?q=${encodeURIComponent(m)}&type=accounts`},{label:b._({id:"VwUsHI"}),type:"hashtags",to:`/search?q=${encodeURIComponent(m)}&type=hashtags`},{label:b._({id:"+owNNn"}),type:"statuses",to:`/search?q=${encodeURIComponent(m)}&type=statuses`}].sort((L,q)=>L.type===f?-1:q.type===f?1:0).map(L=>e(fe,{to:L.to,children:L.label},L.type))]}),m?e(O,{children:[(!f||f==="accounts")&&e(O,{children:[f!=="accounts"&&e("h2",{class:"timeline-header",children:[e(d,{id:"bPwFdf"})," ",e(fe,{to:`/search?q=${encodeURIComponent(m)}&type=accounts`,children:e(C,{icon:"arrow-right",size:"l",alt:b._({id:"V1fa9u"})})})]}),x.length>0?e(O,{children:[e("ul",{class:"timeline flat accounts-list",children:x.map(L=>e("li",{children:e(rt,{account:L,instance:o,showStats:!0,relationship:D[L.id]})},L.id))}),f!=="accounts"&&e("div",{class:"ui-state",children:e(fe,{class:"plain button",to:`/search?q=${encodeURIComponent(m)}&type=accounts`,children:[e(d,{id:"BMmtZ8"})," ",e(C,{icon:"arrow-right"})]})})]}):!f&&(h==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):e("p",{class:"ui-state",children:e(d,{id:"YYB61U"})}))]}),(!f||f==="hashtags")&&e(O,{children:[f!=="hashtags"&&e("h2",{class:"timeline-header",children:[e(d,{id:"VwUsHI"})," ",e(fe,{to:`/search?q=${encodeURIComponent(m)}&type=hashtags`,children:e(C,{icon:"arrow-right",size:"l",alt:b._({id:"V1fa9u"})})})]}),I.length>0?e(O,{children:[e("ul",{class:"link-list hashtag-list",children:I.map(L=>{var de;const{name:q,history:U}=L,W=(de=U==null?void 0:U.reduce)==null?void 0:de.call(U,(Q,me)=>Q+ +me.uses,0);return e("li",{children:e(fe,{to:o?`/${o}/t/${q}`:`/t/${q}`,children:[e(C,{icon:"hashtag",alt:"#"}),e("span",{children:q}),!!W&&e("span",{class:"count",children:Ke(W)})]})},`${q}-${W}`)})}),f!=="hashtags"&&e("div",{class:"ui-state",children:e(fe,{class:"plain button",to:`/search?q=${encodeURIComponent(m)}&type=hashtags`,children:[e(d,{id:"Nc/W5J"})," ",e(C,{icon:"arrow-right"})]})})]}):!f&&(h==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):e("p",{class:"ui-state",children:e(d,{id:"4MFM3P"})}))]}),(!f||f==="statuses")&&e(O,{children:[f!=="statuses"&&e("h2",{class:"timeline-header",children:[e(d,{id:"+owNNn"})," ",e(fe,{to:`/search?q=${encodeURIComponent(m)}&type=statuses`,children:e(C,{icon:"arrow-right",size:"l",alt:b._({id:"V1fa9u"})})})]}),v.length>0?e(O,{children:[e("ul",{class:"timeline",children:v.map(L=>e("li",{children:e(fe,{class:"status-link",to:o?`/${o}/s/${L.id}`:`/s/${L.id}`,children:e(Ye,{status:L})})},L.id))}),f!=="statuses"&&e("div",{class:"ui-state",children:e(fe,{class:"plain button",to:`/search?q=${encodeURIComponent(m)}&type=statuses`,children:[e(d,{id:"LYCgej"})," ",e(C,{icon:"arrow-right"})]})})]}):!f&&(h==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):e("p",{class:"ui-state",children:e(d,{id:"Hzi9AA"})}))]}),!!f&&(h==="default"?u?e(kt,{onChange:L=>{L&&te()},children:e("button",{type:"button",class:"plain block",onClick:()=>te(),style:{marginBlockEnd:"6em"},children:e(d,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(d,{id:"2EYeAZ"})}):h==="loading"&&e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}))]}):h==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):e("p",{class:"ui-state",children:e(d,{id:"fGn1Hk"})})]})]})})}const Zr=20,Qs=10*60*1e3,Xr=_t(t=>t.v1.trends.links.list().next(),{maxAge:Qs}),Jr=_t(t=>t.v1.trends.tags.list().next(),{maxAge:Qs});function Qr(t){return Ze("@pixelfed/trending")?t.pixelfed.v2.discover.posts.trending.list({range:"daily"}):t.v1.trends.statuses.list({limit:Zr})}function el(t,n){return t.v1.timelines.link.list(n)}function eo({columnMode:t,...n}){const i=qe(A),s=t?{}:xt(),{masto:o,instance:a}=ae({instance:(n==null?void 0:n.instance)||s.instance}),{masto:h,instance:r}=ae(),c=b._({id:"cI3UEs",values:{instance:a}});Xe(c,"/:instance?/trending");const l=Y(),m=a===r,[f,p]=R([]),[u,y]=R([]),g=Y();async function w(B){var H;if(B||!g.current){if(g.current=Qr(o),Ze("@mastodon/trending-hashtags"))try{const{value:ne}=await Jr(o);ne!=null&&ne.length&&p(ne)}catch{}if(Ze("@mastodon/trending-links"))try{const{value:ne}=await Xr(o,a),L=(H=ne==null?void 0:ne.filter)==null?void 0:H.call(ne,q=>q.type==="link");L!=null&&L.length&&y(L)}catch{}}const V=await g.current.next();let{value:z}=V;return z!=null&&z.length&&(B&&(l.current=z[0].id),z.forEach(ne=>{We(ne,a)})),{...V,value:z}}const[v,k]=R(!1),x=Y(),[S,I]=R(null),_=!!S,T=Y(),$=m&&Ze("@mastodon/trending-link-posts");ie(()=>{S&&T.current&&T.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[S]);const D=Y();async function M(B){(B||!x.current)&&(k(!0),x.current=el(o,{url:S})),D.current=S;const V=await x.current.next();let{value:z}=V;return z!=null&&z.length&&(z=Lt(z,"public"),z.forEach(H=>{We(H,a)})),D.current===S&&k(!1),{...V,value:z}}async function G(){try{const B=await o.v1.trends.statuses.list({limit:1}).next();let{value:V}=B;return V=Lt(V,"public"),V!=null&&V.length&&V[0].id!==l.current?(l.current=V[0].id,!0):!1}catch{return!1}}const te=Ce(()=>e(O,{children:[!!f.length&&e("div",{class:"filter-bar expandable",children:[e(C,{icon:"chart",class:"insignificant",size:"l"}),f.map((B,V)=>{const{name:z,history:H}=B,ne=H.reduce((L,q)=>L+ +q.uses,0);return e(fe,{to:`/${a}/t/${z}`,children:[e("span",{dir:"auto",children:[e("span",{class:"more-insignificant",children:"#"}),z]}),e("span",{class:"filter-count",children:Ke(ne)})]},z)})]}),!!u.length&&e("div",{class:"links-bar",children:[e("header",{children:e("h3",{children:e(d,{id:"9veeTb"})})}),u.map(B=>{var J,ge;const{authors:V,authorName:z,authorUrl:H,blurhash:ne,description:L,height:q,image:U,imageDescription:W,language:de,providerName:Q,providerUrl:me,publishedAt:ke,title:ue,url:j,width:be}=B,Re=(ge=(J=V==null?void 0:V[0])==null?void 0:J.account)!=null&&ge.id?V[0].account:null,xe=ue.length<30,Ne=!!(z||Re),Pe=Dt.toUnicode(URL.parse(j).hostname.replace(/^www\./,"").replace(/\/$/,""));let _e;if(ne){const Ee=ci(ne),le=yi(Ee);_e=bi([.6,le[1],le[2]])}return e("div",{children:[e("a",{ref:S===j?T:null,href:j,target:"_blank",rel:"noopener noreferrer",class:`link-block ${_?S===j?"active":"inactive":""}`,style:_e?{"--accent-color":`rgb(${_e.join(",")})`,"--accent-alpha-color":`rgba(${_e.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:U,alt:W,width:be,height:q,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:Pe})," ",!!ke&&e(O,{children:"· "}),!!ke&&e(O,{children:e(Kt,{datetime:ke,format:"micro"})})]}),!!ue&&e("h1",{class:"title",lang:de,dir:"auto",title:ue,children:ue})]}),!!L&&e("p",{class:`description ${Ne&&!xe?"":"more-lines"}`,lang:de,dir:"auto",title:L,children:L}),Ne&&e(O,{children:[e("hr",{}),e("p",{class:"byline",children:e("small",{children:e(d,{id:"aavdrC",values:{0:Re?e(ht,{account:Re,showAvatar:!0}):H?e("a",{href:H,target:"_blank",rel:"noopener noreferrer",children:z}):z}})})})]})]})]})}),$&&e("button",{type:"button",class:"small plain4 block",onClick:()=>{I(j)},disabled:j===S,children:[e(C,{icon:"comment2"})," ",e("span",{children:e(d,{id:"/bZzdR"})})," ",e(C,{icon:"chevron-down"})]})]},j)})]}),$&&!!u.length&&e("div",{class:`timeline-header-block ${_?"blended":""}`,children:_?e(O,{children:[e("div",{style:{width:50,flexShrink:0,textAlign:"center"},children:v?e(Oe,{abrupt:!0}):e("button",{type:"button",class:"light",onClick:()=>{I(null)},children:e(C,{icon:"x",alt:b._({id:"9Q/4xJ"})})})}),e("p",{children:e(d,{id:"BATCqf",values:{0:S.replace(/^https?:\/\/(www\.)?/i,"").replace(/\/$/,"")},components:{0:e("span",{class:"link-text"})}})})]}):e("p",{class:"insignificant",children:e(d,{id:"Vosm4k"})})})]}),[f,u,S,v]);return e(St,{title:c,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:e(d,{id:"4/iCqx"})}),e("div",{children:a})]}),id:"trending",instance:a,emptyText:b._({id:"6HA9+s"}),errorText:b._({id:"scd9lw"}),fetchItems:_?M:w,checkForUpdates:_?void 0:G,checkForUpdatesInterval:5*60*1e3,useItemID:!0,headerStart:e(O,{}),boostsCarousel:i.settings.boostsCarousel,filterContext:"public",timelineStart:te,refresh:S,clearWhenRefresh:!0,view:_?"link-mentions":void 0,headerEnd:e(at,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(C,{icon:"more",size:"l",alt:b._({id:"2FYpfJ"})})}),children:[e(Se,{onClick:()=>{let B=prompt(b._({id:"2MQ2cd"}));if(!/\./.test(B)){B&&alert(b._({id:"7WddtO"}));return}B&&(B=B.toLowerCase().trim(),location.hash=`/${B}/trending`)},children:[e(C,{icon:"bus"})," ",e("span",{children:e(d,{id:"Sq04Yc"})})]}),r!==a&&e(Se,{onClick:()=>{location.hash=`/${r}/trending`},children:[e(C,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(d,{id:"iAzCp4",values:{currentInstance:r},components:{0:e("b",{})}})})]})]})},a)}const Xi={block:"nearest",inline:"nearest",behavior:"smooth"};function tl(){Xe(b._({id:"i0qMbr"}),"/");const t=qe(A),{shortcuts:n}=t,i=n.map(s=>{if(!s)return null;const{type:o,...a}=s,h={following:ki,notifications:Xs,list:Ys,public:Jn,bookmarks:Bs,favourites:Fs,hashtag:qs,mentions:Ks,trending:eo,search:Js}[o];return!h||o==="search"&&!a.query||o==="list"&&!a.id?null:e(h,{...a,columnMode:!0},o+JSON.stringify(a))});return Ue(["1","2","3","4","5","6","7","8","9"],(s,o)=>{try{const a=parseInt(o.keys[0],10)-1,h=document.querySelectorAll("#columns > *")[a];h&&(h.focus(),h.scrollIntoView(Xi))}catch{}}),Ue(["[","]"],(s,o)=>{const a=o.keys[0],h=document.activeElement.closest("#columns > *"),r=Rt(),c=r?"]":"[",l=r?"[":"]";let m;a===c?m=h?h.previousElementSibling:document.querySelectorAll("#columns > *")[0]:a===l&&(m=h?h.nextElementSibling:document.querySelectorAll("#columns > *")[1]),m&&(m.focus(),m.scrollIntoView(Xi))}),e("div",{id:"columns",onContextMenu:s=>{s.target.closest(".deck > header")&&!s.target.closest("a")&&!s.target.closest("button")&&(s.preventDefault(),A.showShortcutsSettings=!0)},onFocus:()=>{const s=document.activeElement.closest("#columns > *");s&&document.querySelectorAll("#columns > *").forEach(o=>{o.classList.toggle("focus",o===s)})},children:i})}function nl(){var i;const{_:t}=Qe(),n=qe(A);return __BENCHMARK.end("time-to-home"),ie(()=>{(async()=>{const s=await ut.drafts.keys();if(s.length){const o=wn();s.filter(h=>h.startsWith(o)).length&&(A.showDrafts=!0)}})()},[]),e(O,{children:(n.settings.shortcutsViewMode==="multi-column"||!n.settings.shortcutsViewMode&&n.settings.shortcutsColumnsMode)&&((i=n.shortcuts)!=null&&i.length)?e(tl,{}):e(ki,{title:t({id:"i0qMbr"}),path:"/",id:"home",headerStart:!1,headerEnd:e(il,{})})})}function il(){const t=qe(A),n=Y(),[i,s]=R(void 0);return e(O,{children:[e(fe,{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:b._({id:"iDNBZe"})})}),e(ol,{state:i,anchorRef:n,onClose:()=>s(void 0)})]})}const sl=5;function ol({anchorRef:t,state:n,onClose:i}){const{masto:s,instance:o}=ae(),a=qe(A),[h,r]=R("default"),c=Xn();async function l(){const g=await c.next(),w=Gs(g.value);if(w!=null&&w.length){w.forEach(k=>{We(k.status,o,{skipThreading:!0})});const v=Zs(w);A.notificationsLast=v[0],A.notifications=v,s.v1.markers.create({notifications:{lastReadId:v[0].id}}).catch(()=>{})}return A.notificationsShowNew=!1,A.notificationsLastFetchTime=Date.now(),g}const[m,f]=R(!1);function p(){return s.v1.followRequests.list({limit:1})}function u(){r("loading"),(async()=>{try{await l();const g=await p();f(!!(g!=null&&g.length)),r("default")}catch{r("error")}})()}ie(()=>{n==="open"&&u()},[n]);const y=Y();return e(ys,{ref:y,menuClassName:"notifications-menu",state:n,anchorRef:t,onClose:i,portal:{target:document.body},containerProps:{onClick:()=>{var g,w;(w=(g=y.current)==null?void 0:g.closeMenu)==null||w.call(g)}},overflow:"auto",viewScroll:"close",position:"anchor",align:"center",boundingBoxPadding:"8 8 8 8",children:[e("header",{children:e("h2",{children:e(d,{id:"iDNBZe"})})}),e("main",{children:a.notifications.length?e(O,{children:a.notifications.slice(0,sl).map(g=>e(on,{instance:o,notification:g,disableContextMenu:!0},g._ids||g.id))}):h==="loading"?e("div",{class:"ui-state",children:e(Oe,{abrupt:!0})}):h==="error"&&e("div",{class:"ui-state",children:[e("p",{children:e(d,{id:"5GFQTh"})}),e("p",{children:e("button",{type:"button",onClick:u,children:e(d,{id:"KDw4GX"})})})]})}),e("footer",{children:[e(fe,{to:"/mentions",class:"button plain",children:[e(C,{icon:"at"})," ",e("span",{children:e(d,{id:"/bZzdR"})})]}),e(fe,{to:"/notifications",class:"button plain2",children:[m?e(d,{id:"OdVhdR",components:{0:e("span",{class:"tag collapsed"}),1:e("span",{})}}):e("b",{children:e(d,{id:"gukqfD"})})," ",e(C,{icon:"arrow-right"})]})]})]})}const cl=st(nl),al=[/^\/@[^@\/]+\/(?:statuses|posts)\/([^\/]+)/i,/\/notes\/([^\/]+)/i,/^\/(?:notice|objects)\/([a-z0-9-]+)/i,/\/@[^@\/]+\/post\/([^\/]+)/i,/\/@[^@\/]+@?[^\/]+?\/([^\/]+)/i,/^\/p\/[^\/]+\/([^\/]+)/i];function to(t){const{hostname:n,pathname:i}=URL.parse(t);for(const s of al){const[,o]=i.match(s)||[];if(o)return{instance:n,id:o}}return{}}function rl(t){const{instance:n,id:i}=to(t);return n&&i?`/${n}/s/${i}`:null}function ll(){const n=Gt().pathname.replace(/^\//,""),i=to(n),s=i!=null&&i.instance?`/${i.instance}/s/${i.id}`:null,[o,a]=R("loading");return gt(()=>{a("loading"),(async()=>{try{const{instance:h,id:r}=i;if(r){const{masto:c}=ae({instance:h});if(await c.v1.statuses.$select(r).fetch()){window.location.hash=s+"?view=full";return}}}catch{}{const{masto:h,instance:r}=ae(),c=await h.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(O,{children:[e(Oe,{abrupt:!0}),e("h2",{children:e(d,{id:"RTAr/z"})}),e("p",{children:e("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:n})})]}):e(O,{children:[e("h2",{children:e(d,{id:"ufzZSJ"})}),e("p",{children:e("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:n})})]}),e("hr",{}),e("p",{children:e(fe,{to:"/",children:e(d,{id:"iWpEwy"})})})]})}function dl(){Xe(b._({id:"h16FyT"}),"/l");const[t,n]=R("default"),[i,s]=Mt(c=>c+1,0),[o,a]=R([]);ie(()=>{n("loading"),(async()=>{try{const c=await Wn();a(c),n("default")}catch{n("error")}})()},[i]);const[h,r]=R(!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(Pt,{}),e(fe,{to:"/",class:"button plain",children:e(C,{icon:"home",size:"l"})})]}),e("h1",{children:e(d,{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:b._({id:"Sb2gYF"})})})})]})}),e("main",{children:o.length>0?e(O,{children:[e("ul",{class:"link-list",children:o.map(c=>e("li",{children:e(fe,{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(d,{id:"8prZNK",values:{0:o.length}})})})]}):t==="loading"?e("p",{class:"ui-state",children:e(Oe,{})}):t==="error"?e("p",{class:"ui-state",children:e(d,{id:"v/l5uA"})}):e("p",{class:"ui-state",children:e(d,{id:"IvPikw"})})})]}),h&&e(Fe,{onClick:c=>{c.target===c.currentTarget&&r(!1)},children:e(gi,{list:h==null?void 0:h.list,onClose:c=>{c.state==="success"&&s(),r(!1)}})})]})}const ul=""+new URL("instances-CwO9tuGQ.json",import.meta.url).href;function hl(t){return("0"+t.toString(16)).slice(-2)}function fl(){var t=new Uint32Array(28);return window.crypto.getRandomValues(t),Array.from(t,hl).join("")}function pl(t){const i=new TextEncoder().encode(t);return window.crypto.subtle.digest("SHA-256",i)}function ml(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 no(t){const n=await pl(t);return ml(n)}async function gl({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=no;const bl={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:yl,PHANPY_CLIENT_NAME:vl,PHANPY_WEBSITE:Tn}=bl,Ln="read write follow push",wl=Tn?Tn.toLowerCase().includes(location.hostname):!1,kl=location.origin+location.pathname,$n=yl||!wl?kl:Tn;async function _l({instanceURL:t}){const n=new URLSearchParams({client_name:vl,redirect_uris:$n,scopes:Ln,website:Tn});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 Sl({instanceURL:t,client_id:n}){const i=fl(),s=await no(i),o=new URLSearchParams({client_id:n,code_challenge_method:"S256",code_challenge:s,redirect_uri:$n,response_type:"code",scope:Ln});return[`https://${t}/oauth/authorize?${o.toString()}`,i]}async function Cl({instanceURL:t,client_id:n}){const i=new URLSearchParams({client_id:n,scope:Ln,redirect_uri:$n,response_type:"code"});return`https://${t}/oauth/authorize?${i.toString()}`}async function Il({instanceURL:t,client_id:n,client_secret:i,code:s,code_verifier:o}){const a=new URLSearchParams({client_id:n,redirect_uri:$n,grant_type:"authorization_code",code:s,scope:Ln});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 Tl={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:xl}=Tl;function Al(){var k,x;Xe("Log in");const t=Y(),n=ve.local.get("instanceURL"),[i,s]=R("default"),[o]=pt(),a=o.get("instance"),h=o.get("submit"),[r,c]=R(a||(n==null?void 0:n.toLowerCase())||""),[l,m]=R([]),f=Y();ie(()=>{(async()=>{try{const I=await(await fetch(ul)).json();m(I),f.current=new qo(I)}catch{}})()},[]);const p=S=>{S&&(async()=>{try{const _=await(await fetch(`https://${S}/.well-known/host-meta`)).text(),M=new DOMParser().parseFromString(_,"text/xml").getElementsByTagName("Link")[0].getAttribute("template"),G=URL.parse(M),{host:te}=G;S!==te&&(S=te)}catch{}ve.local.set("instanceURL",S),s("loading");try{const{client_id:I,client_secret:_,vapid_key:T}=await _l({instanceURL:S});if(await gl({instanceURL:S}))if(I&&_){ve.sessionCookie.set("clientID",I),ve.sessionCookie.set("clientSecret",_),ve.sessionCookie.set("vapidKey",T);const[D,M]=await Sl({instanceURL:S,client_id:I});ve.sessionCookie.set("codeVerifier",M),location.href=D}else alert(b._({id:"ZP1FIA"}));else I&&_?(ve.sessionCookie.set("clientID",I),ve.sessionCookie.set("clientSecret",_),ve.sessionCookie.set("vapidKey",T),location.href=await Cl({instanceURL:S,client_id:I})):alert(b._({id:"ZP1FIA"}));s("default")}catch{s("error")}})()},u=r?r.replace(/^https?:\/\//,"").replace(/\/+$/,"").replace(/^@?[^@]+@/,"").trim():null,y=/[^\s\r\n\t\/\\]+\.[^\s\r\n\t\/\\]+/.test(u)&&!/[\s\/\\@]/.test(u),g=u?(x=(k=f.current)==null?void 0:k.search(u,{limit:10}))==null?void 0:x.map(S=>S.item):[],w=y?u:g!=null&&g.length?g[0]:r?l.find(S=>S.includes(r)):null,v=S=>{S.preventDefault(),p(w)};return h&&ie(()=>{p(a||w)},[]),e("main",{id:"login",style:{textAlign:"center"},children:e("form",{onSubmit:v,children:[e("h1",{children:[e("img",{src:fi,alt:"",width:"80",height:"80"}),e("br",{}),e(d,{id:"sQia9P"})]}),e("label",{children:[e("p",{children:e(d,{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:b._({id:"u3gOdY"}),onInput:S=>{c(S.target.value)},dir:"auto"}),(g==null?void 0:g.length)>0?e("ul",{id:"instances-suggestions",children:g.map((S,I)=>e("li",{children:e("button",{type:"button",class:"plain5",onClick:()=>{p(S)},children:S})}))}):e("div",{id:"instances-eg",children:e(d,{id:"/OvbEC"})})]}),i==="error"&&e("p",{class:"error",children:e(d,{id:"rmBHZn"})}),e("div",{children:[e("button",{disabled:i==="loading"||!r||!w,children:w?b._({id:"2xahsi",values:{selectedInstanceText:w}}):b._({id:"xGVfLh"})})," "]}),e(Oe,{hidden:i!=="loading"}),e("hr",{}),!xl&&e("p",{children:e("a",{href:"https://joinmastodon.org/servers",target:"_blank",children:e(d,{id:"LcOiWS"})})}),e("p",{children:e(fe,{to:"/",children:e(d,{id:"iWpEwy"})})}),e(pi,{})]})})}const El={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:Ji}=El,hn=40,Rl=10,Ll=5;let Qn={},gn={},bn={};function yn(t){delete gn[t],delete bn[t]}const Xt={block:"nearest",inline:"center",behavior:"smooth"},Qi=".status-link:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *), .status-focus:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *)",es=/\/s\//i;function $l(t){var S;const{id:n}=t,{masto:i,instance:s}=ae({instance:t.instance}),o=qe(A),[a,h]=pt(),r=a.get("media"),c=a.get("media-only"),l=parseInt(r||c,10);let m=l>0;const f=a.get("mediaStatusID"),p=us(f,s);f&&!p&&(m=!1);const u=m&&!!c,y=it(n,s),[g,w]=R(A.statuses[y]);ie(()=>{A.statuses[y]&&w(A.statuses[y])},[y]);const v=Ce(()=>{const{prevLocation:I}=A,_=((I==null?void 0:I.pathname)||"")+((I==null?void 0:I.search)||""),T=tn("/:instance/s/:id",_)||tn("/s/:id",_);return!_||T?"/":_},[]);ie(()=>{!g&&m&&(async()=>{try{const I=await i.v1.statuses.$select(n).fetch();We(I,s),w(I)}catch{alert("Unable to load post."),location.hash=v}})()},[m]);const k=f?(S=o.statuses[it(f,s)])==null?void 0:S.mediaAttachments:g==null?void 0:g.mediaAttachments,x=ct(()=>{!window.matchMedia("(min-width: calc(40em + 350px))").matches&&o.prevLocation?history.back():u?location.hash=v:(a.delete("media"),a.delete("mediaStatusID"),h(a))},[u,v,o.prevLocation]);return ie(()=>{let I=setTimeout(()=>{const _=document.querySelector(".carousel");_&&_.focus()},100);return()=>clearTimeout(I)},[u]),ie(()=>{const I=document.querySelectorAll(".deck-container");return I.forEach(_=>{_.setAttribute("inert","")}),()=>{I.forEach(_=>{_.removeAttribute("inert")})}},[]),e("div",{class:"deck-backdrop",children:[m?k!=null&&k.length?e(Ps,{mediaAttachments:k,statusID:f||n,instance:s,lang:g==null?void 0:g.language,index:l-1,onClose:x}):e("div",{class:"media-modal-container loading",children:e(Oe,{abrupt:!0})}):e(fe,{to:v}),!u&&e(Dl,{id:n,instance:t.instance,closeLink:v})]})}function Ml(t){const{linkable:n,to:i,onClick:s,...o}=t;return n?e(fe,{class:"status-link",to:i,onClick:s,...o}):e("div",{class:"status-focus",tabIndex:0,...o})}function ts(t,n){return new Date(n.created_at)-new Date(t.created_at)}function Dl({id:t,closeLink:n="/",instance:i}){var X,we;const[s,o]=pt(),a=s.get("media"),h=s.get("mediaStatusID"),r=parseInt(a,10)>0,c=Y(!A.prevLocation&&(history.length===1||"navigation"in window&&((we=(X=navigation==null?void 0:navigation.entries)==null?void 0:X.call(navigation))==null?void 0:we.length)===1)),[l,m]=R(s.get("view")||c.current?"full":null),f=!!parseInt(s.get("translate")),{masto:p,instance:u}=ae({instance:i}),{masto:y,instance:g,authenticated:w}=ae(),v=u===g,k=qe(A),[x,S]=R([]),[I,_]=R("default"),T=Y(),$=it(t,u),D=Y(0),M=Y();ie(()=>{var P;(P=M.current)==null||P.focus()},[]),ie(()=>{var ee;const P=ks(()=>{if(!M.current)return;const{scrollTop:re}=M.current;I!=="loading"&&(bn[t]=re)},50);return(ee=M.current)==null||ee.addEventListener("scroll",P,{passive:!0}),P(),()=>{var re;P.cancel(),(re=M.current)==null||re.removeEventListener("scroll",P)}},[t,I!=="loading"]);const G=Y(),te=Y(),B=({reloadHero:P}={})=>{_("loading");let ee;const re=gn[t];if(re){const N=re.filter(ce=>A.statuses[$]);S(N)}else S([{id:t}]);return(async()=>{var pe,Ae;const N=()=>Ai(()=>p.v1.statuses.$select(t).fetch(),{retries:4}),ce=Ai(()=>p.v1.statuses.$select(t).context.fetch(),{retries:8}),Ie=!!k.statuses[$];let F=k.statuses[$];if(!(Ie&&!P))try{F=await N(),We(F,u),await new Promise(E=>{setTimeout(E,100)})}catch{_("error");return}try{let E=function(ye,De){const Je=De+1;return Je>$e&&($e=De),ye==null?void 0:ye.map(Te=>({id:Te.id,account:Te.account,repliesCount:Te.repliesCount,content:Te.content,weight:en(Te),level:Je,replies:E(Te.__replies,Je)}))};const K=await ce,{ancestors:oe,descendants:Z}=K;oe.sort(ts),Z.sort(ts),D.current=(Z==null?void 0:Z.length)||0;const se=new Set;oe.forEach(ye=>{We(ye,u,{skipThreading:!0}),ye.inReplyToId&&!oe.find(De=>De.id===ye.inReplyToId)&&se.add(ye.inReplyToId)});const Me=oe.every(ye=>ye.account.id===F.account.id),Le=[];Z.forEach(ye=>{if(We(ye,u,{skipThreading:!0}),ye.inReplyToId&&!Z.find(De=>De.id===ye.inReplyToId)&&ye.inReplyToId!==F.id&&se.add(ye.inReplyToId),ye.inReplyToAccountId===ye.account.id)Le.push(ye);else if(ye.inReplyToId===F.id)Le.push(ye);else if(!ye.inReplyToAccountId&&Le.find(De=>De.id===ye.inReplyToId&&De.account.id===F.account.id)&&ye.account.id===F.account.id)Le.push(ye);else{const De=Z.find(Je=>Je.id===ye.inReplyToId);De&&(De.__replies||(De.__replies=[]),De.__replies.push(ye))}}),Le.sort((ye,De)=>{const Je=F.account.id;return ye.account.id===Je&&De.account.id!==Je?-1:De.account.id===Je&&ye.account.id!==Je?1:0}),se.size;let $e=1;const ze=[...oe.map(ye=>({id:ye.id,ancestor:!0,isThread:Me,accountID:ye.account.id,account:ye.account,repliesCount:ye.repliesCount,weight:en(ye)})),{id:t,accountID:F.account.id,weight:en(F)},...Le.map(ye=>({id:ye.id,account:ye.account,accountID:ye.account.id,descendant:!0,thread:ye.account.id===F.account.id,weight:en(ye),level:1,replies:E(ye.__replies,1)}))];_("default"),G.current={offsetTop:(pe=T.current)==null?void 0:pe.offsetTop,scrollTop:(Ae=M.current)==null?void 0:Ae.scrollTop};const He=oe.length||0;He>=W&&de(He+1),S(ze),gn[t]=ze,vo(F,u)}catch{_("error")}})(),te.current=Date.now(),()=>{clearTimeout(ee)}};ie(B,[t,p]);const[V,z]=R(!1);ie(()=>{let P=setInterval(()=>{const ee=Date.now();te.current&&ee-te.current>=6e4&&z(!0)},6e4);return()=>{clearInterval(P)}},[]),gt(()=>{var ee,re;if(!x.length)return;const P=bn[t];if(P)M.current.scrollTop=P;else if(G.current){const N={offsetTop:(ee=T.current)==null?void 0:ee.offsetTop,scrollTop:(re=M.current)==null?void 0:re.scrollTop},ce=N.offsetTop-G.current.offsetTop+N.scrollTop;M.current.scrollTop=ce}else x.length===1&&(M.current.scrollTop=0);G.current=null},[x]),ie(()=>{k.reloadStatusPage<=0||(async()=>{try{const{instanceURL:P}=ti(),ee=`https://${P}/api/v1/statuses/${t}/context`;return await(await caches.open("api")).delete(ee,{ignoreVary:!0}),B({reloadHero:!0})}catch{}})()},[k.reloadStatusPage]),ie(()=>()=>{bn={},A.reloadStatusPage=0,gn={},Qn={},ei.clear()},[]);const H=k.statuses[$]||k.statuses[t],ne=Ce(()=>{if(!H)return"";const{account:P}=H,ee=document.createElement("div");return ee.innerHTML=P.displayName,ee.innerText.trim()},[H]),L=Ce(()=>{if(!H)return"";let P=ai(H);return P.length>64&&(P=P.slice(0,64)+"…"),P},[H]);Xe(ne&&L?`${ne}: "${L}"`:b._({id:"post.title"}),"/:instance?/s/:id");const q=Ce(()=>{if(!H)return;const{url:P}=H;if(P)return URL.parse(P).hostname},[H]),U=Ce(()=>{if(q)return q===u},[q,u]),[W,de]=R(hn),Q=Ce(()=>x.length-W,[x.length,W]),me=x.some(P=>P.descendant),ke=x.filter(P=>P.ancestor),[ue,j]=R(!0),be=Ce(()=>{if(!T.current||ue)return null;const{top:P}=T.current.getBoundingClientRect();return P>0?"down":"up"},[ue]);Ue("esc",()=>{location.hash=n},{enabled:!r,ignoreEventWhen:P=>!!document.querySelector("#modal-container > *")}),Ue("backspace",()=>{location.hash=n}),Ue("j",()=>{const P=document.activeElement.closest(".status-link, .status-focus"),ee=P==null?void 0:P.getBoundingClientRect(),re=Array.from(M.current.querySelectorAll(Qi));if(P&&ee.top<M.current.clientHeight&&ee.bottom>0){const N=re.indexOf(P);let ce=re[N+1];ce&&(ce.focus(),ce.scrollIntoView(Xt))}else{const N=re.find(ce=>{const Ie=ce.getBoundingClientRect();return Ie.top>=44&&Ie.left>=0});N&&(N.focus(),N.scrollIntoView(Xt))}}),Ue("k",()=>{const P=document.activeElement.closest(".status-link, .status-focus"),ee=P==null?void 0:P.getBoundingClientRect(),re=Array.from(M.current.querySelectorAll(Qi));if(P&&ee.top<M.current.clientHeight&&ee.bottom>0){const N=re.indexOf(P);let ce=re[N-1];ce&&(ce.focus(),ce.scrollIntoView(Xt))}else{const N=re.find(ce=>{const Ie=ce.getBoundingClientRect();return Ie.top>=44&&Ie.left>=0});N&&(N.focus(),N.scrollIntoView(Xt))}}),Ue("x",()=>{const P=document.activeElement.closest(".status-link, .status-focus");if(P){const ee=P.nextElementSibling;ee&&ee.tagName.toLowerCase()==="details"&&(ee.open=!ee.open)}});const[Re,xe]=R(!1),Ne=Y(r?"media+status":"status"),Pe=ct((P,ee,re,N)=>{P.preventDefault(),P.stopPropagation(),o({media:ee+1,mediaStatusID:N.id})},[t]),_e=ct((P,ee)=>{yn(ee.id)},[]);ie(()=>{let P;return h&&r&&(P=setTimeout(()=>{var re;const ee=(re=M.current)==null?void 0:re.querySelector(`.status-link[href*="/${h}"]`);ee&&ee.scrollIntoView(Xt)},400)),()=>{clearTimeout(P)}},[h,r]);const J=ct((P,ee)=>{const{id:re,ancestor:N,isThread:ce,descendant:Ie,thread:F,replies:pe,repliesCount:Ae,weight:E,level:K}=P,oe=re===t;return e("li",{ref:oe?T:null,class:`${N?"ancestor":""} ${Ie?"descendant":""} ${F?"thread":""} ${oe?"hero":""}`,children:[oe?e(O,{children:[e(kt,{threshold:.1,onChange:se=>{queueMicrotask(()=>{requestAnimationFrame(()=>{j(se)})})},class:"status-focus",tabIndex:0,children:e(Ye,{statusID:re,instance:u,withinContext:!0,size:"l",enableTranslate:!0,forceTranslate:f})}),I!=="loading"&&!w?e("div",{class:"post-status-banner",children:[e("p",{children:e(d,{id:"Vyeh4F"})}),e(fe,{to:Ji?`/login?instance=${Ji}&submit=1`:"/login",class:"button",children:e(d,{id:"sQia9P"})})]}):!v&&e("div",{class:"post-status-banner",children:[e("p",{children:e(d,{id:"j5roNG",values:{instance:u},components:{0:e("b",{})}})}),e("button",{type:"button",disabled:I==="loading",onClick:()=>{_("loading"),(async()=>{try{const se=await y.v2.search.fetch({q:H.url,type:"statuses",resolve:!0,limit:1});if(se.statuses.length){const Me=se.statuses[0];location.hash=g?`/${g}/s/${Me.id}`:`/s/${Me.id}`}else throw new Error("No results")}catch(se){_("default"),alert(b._({id:"DnepCE",values:{e:se}}))}})()},children:[e(C,{icon:"transfer"})," ",e(d,{id:"ejAVrO"})]})]})]}):e(Ml,{linkable:ce||N,to:u?`/${u}/s/${re}`:`/s/${re}`,onClick:()=>{yn(re)},children:[ee===0&&N?e(kt,{threshold:.5,onChange:se=>{queueMicrotask(()=>{requestAnimationFrame(()=>{xe(se)})})},children:e(Ye,{statusID:re,instance:u,withinContext:!0,size:F||N?"m":"s",enableTranslate:!0,onMediaClick:Pe,onStatusLinkClick:_e})}):e(Ye,{statusID:re,instance:u,withinContext:!0,size:F||N?"m":"s",enableTranslate:!0,onMediaClick:Pe,onStatusLinkClick:_e,showActionsBar:!!Ie}),N&&Ae>1&&e("div",{class:"replies-link",children:[e(C,{icon:"comment2",alt:b._({id:"N8UzTV"})})," ",e("span",{title:Ae,children:Ke(Ae)})]})," "]}),Ie&&(pe==null?void 0:pe.length)>0&&e(io,{instance:u,replies:pe,hasParentThread:F,level:K,accWeight:E,openAll:D.current<Rl,parentLink:{to:u?`/${u}/s/${re}`:`/s/${re}`,onClick:()=>yn(re)}}),I==="loading"&&oe&&!!(H!=null&&H.repliesCount)&&!me&&e("div",{class:"status-loading",children:e(Oe,{abrupt:H.repliesCount>=3})}),I==="error"&&oe&&!!(H!=null&&H.repliesCount)&&!me&&e("div",{class:"status-error",children:[e(d,{id:"HQJU6W"}),e("br",{}),e("button",{type:"button",class:"plain",onClick:()=>{A.reloadStatusPage++},children:e(d,{id:"KDw4GX"})})]})]},re)},[t,u,I,w,v,f,Pe,_e,me]),ge=Ce(()=>{var P;if("navigation"in window&&(navigation!=null&&navigation.entries)){const ee=navigation.entries()[navigation.currentEntry.index-1];if(ee!=null&&ee.url)return es.test(ee.url)}return es.test((P=A.prevLocation)==null?void 0:P.pathname)},[$]),Ee=Ce(()=>{if(!Q)return[];const P=[];function ee(re){P.push(re.id),re.replies&&re.replies.forEach(ee)}return x.slice(W).forEach(ee),P.map(re=>it(re,u))},[Q,x,W,u]),le=Ce(()=>x.slice(0,W).map(J),[x,W,J]);return ie(()=>{let P=setTimeout(()=>{if(!T.current)return;const ee=T.current.querySelector(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)");ee&&ee.click()},1e3);return()=>clearTimeout(P)},[t]),e("div",{tabIndex:"-1",ref:M,class:`status-deck deck contained ${x.length>1?"padded-bottom":""} ${Ne.current==="status"&&!c.current?"slide-in":""} ${l?`deck-view-${l}`:""}`,onAnimationEnd:P=>{Ne.current==="status"&&(Ne.current=null)},children:[e("header",{class:`${I==="loading"?"loading":""}`,onDblClick:P=>{A.reloadStatusPage++},children:e("div",{class:"header-grid header-grid-2",children:[e("h1",{children:[ge&&e("button",{type:"button",class:"plain deck-back",onClick:()=>{history.back()},children:e(C,{icon:"chevron-left",size:"xl",alt:b._({id:"iH8pgl"})})}),!ue&&H&&I!=="loading"?e(O,{children:[e("span",{class:"hero-heading",children:[e(ht,{account:H.account,instance:u,showAvatar:!0,short:!0})," ",e("span",{class:"insignificant",children:["•"," ",e(Kt,{datetime:H.createdAt,format:"micro"})]})]})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:P=>{P.preventDefault(),P.stopPropagation(),T.current.scrollIntoView({behavior:"smooth",block:"start"})},title:b._({id:"NCy+Nw"}),children:e(C,{icon:be==="down"?"arrow-down":"arrow-up"})})]}):e(O,{children:[e(d,{id:"post.title"})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:P=>{P.preventDefault(),P.stopPropagation(),M.current.scrollTo({top:0,behavior:"smooth"})},hidden:!ke.length||Re,title:b._({id:"R8CUl0",values:{0:ke.length}}),children:[e(C,{icon:"arrow-up"}),ke.filter((P,ee,re)=>re.findIndex(N=>N.accountID===P.accountID)===ee).slice(0,3).map(P=>e(dt,{url:P.account.avatar,alt:P.account.displayName},P.account.id)),ke.length>3&&e(O,{children:[" ",e("span",{class:"insignificant",children:Ke(ke.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:b._({id:"+/xYEI"}),children:e(C,{icon:"layout4",size:"l"})}),V&&e("button",{type:"button",class:"plain button-refresh",onClick:()=>{A.reloadStatusPage++,z(!1)},children:e(C,{icon:"refresh",size:"l",alt:b._({id:"lCF0wC"})})}),e(at,{align:"end",portal:{target:M.current},menuButton:e("button",{type:"button",class:"button plain4",children:e(C,{icon:"more",alt:b._({id:"2FYpfJ"}),size:"xl"})}),children:[e(Se,{disabled:I==="loading",onClick:()=>{A.reloadStatusPage++},children:[e(C,{icon:"refresh"}),e("span",{children:e(d,{id:"lCF0wC"})})]}),e(Se,{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"?b._({id:"+/xYEI"}):b._({id:"2LiWsE"})})]}),e(Se,{onClick:()=>{Array.from(M.current.querySelectorAll(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)")).forEach(ee=>{ee.click()})},children:[e(C,{icon:"eye-open"})," ",e("span",{children:e(d,{id:"8r8KmB"})})]}),e(Ge,{}),e(ws,{className:"plain",children:e(d,{id:"Rsjgm0"})}),e(Se,{disabled:!q||U,onClick:()=>{const P=rl(H.url);P?location.hash=P:alert(b._({id:"9J6biQ"}))},children:[e(C,{icon:"transfer"}),e("small",{class:"menu-double-lines",children:q?b._({id:"Kp9SAs",values:{0:Dt.toUnicode(q)}}):b._({id:"lb07+k"})})]})]}),e(fe,{class:"button plain deck-close",to:n,children:e(C,{icon:"x",size:"xl",alt:b._({id:"yz7wBu"})})})]})]})}),x.length&&H?e("ul",{class:`timeline flat contextual grow ${I==="loading"?"loading":""}`,children:[le,Q>0&&e("li",{class:"descendant descendant-more",children:e("button",{type:"button",class:"plain block show-more",disabled:I==="loading",onClick:()=>de(P=>P+hn),style:{marginBlockEnd:"6em"},"data-state-post-ids":Ee.join(" "),children:[e("div",{class:"ib avatars-bunch",children:x.slice(W,W+5).map(P=>e(dt,{url:P.account.avatarStatic},P.id))})," ",e("div",{class:"ib",children:[e(d,{id:"uXRAkV"})," ",e("span",{class:"tag",children:Q>hn?`${hn}+`:Q})]})]})})]}):e(O,{children:[I==="loading"&&e("ul",{class:"timeline flat contextual grow loading",children:e("li",{children:e(Ye,{skeleton:!0,size:"l"})})}),I==="error"&&e("p",{class:"ui-state",children:[e(d,{id:"JWxodU"}),e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>{A.reloadStatusPage++},children:e(d,{id:"KDw4GX"})})]})]})]})}function io({replies:t,instance:n,hasParentThread:i,level:s,accWeight:o,openAll:a,parentLink:h}){const[r,c]=pt(),l=_=>_.reduce((T,$)=>{const{repliesCount:D,replies:M}=$,G=(M==null?void 0:M.length)||D;return T+G+l(M||[])},0),m=t.length+l(t),f=t.length===m,p=t.map(_=>_.account).filter((_,T,$)=>$.findIndex(D=>D.id===_.id)===T).slice(0,3),u=Ce(()=>t==null?void 0:t.reduce((_,T)=>_+(T==null?void 0:T.weight),o),[o,t==null?void 0:t.length]);let y=!1;(a||u<=Ll||!i&&m===1&&en(t[0])<2)&&(y=!0);const g=Qn[t[0].id],w=ct((_,T,$,D)=>{_.preventDefault(),_.stopPropagation(),c({media:T+1,mediaStatusID:D.id})},[]),v=Y();gt(()=>{var T;function _($){$.target.dataset.scrollLeft=$.target.scrollLeft}return(T=v.current)==null||T.addEventListener("scroll",_,{passive:!0}),()=>{var $;($=v.current)==null||$.removeEventListener("scroll",_)}},[]);const[k,x]=R(g||y);ie(()=>{let _;return!g&&!y&&(_=setTimeout(()=>x(!0),100)),()=>clearTimeout(_)},[g,y]);const S=y?"div":"details",I=S==="details";return e(S,{ref:v,class:"replies",open:I?g||y:void 0,onToggle:I?_=>{const{open:T}=_.target;Qn[t[0].id]=T}:void 0,style:{"--comments-level":s},"data-comments-level":s,"data-comments-level-overflow":s>4,children:[!y&&e("summary",{class:"replies-summary",hidden:y,children:[e("span",{class:"avatars",children:p.map(_=>e(dt,{url:_.avatarStatic,title:`${_.displayName} @${_.username}`,squircle:_==null?void 0:_.bot},_.id))}),e("span",{class:"replies-counts",children:[e("b",{children:e(d,{id:"DOQUen",values:{0:t.length,1:Ke(t.length)},components:{0:e("span",{title:t.length})}})}),!f&&m>1&&e(O,{children:[" ","·"," ",e("span",{children:e(d,{id:"qSQQSe",values:{0:Ke(m),totalComments:m},components:{0:e("span",{title:m})}})})]})]}),e(C,{icon:"chevron-down",class:"replies-summary-chevron"}),!!h&&e(fe,{class:"replies-parent-link",to:h.to,onClick:h.onClick,title:b._({id:"ZlV82A"}),children:"»"})]}),k&&e("ul",{children:t.map(_=>{var T,$;return e("li",{children:[e("div",{class:"status-focus",tabIndex:0,children:[e(Ye,{statusID:_.id,instance:n,withinContext:!0,size:"s",enableTranslate:!0,onMediaClick:w,showActionsBar:!0}),!((T=_.replies)!=null&&T.length)&&_.repliesCount>0&&e("div",{class:"replies-link",children:[e(C,{icon:"comment2",alt:b._({id:"N8UzTV"})})," ",e("span",{title:_.repliesCount,children:Ke(_.repliesCount)})]})]}),(($=_.replies)==null?void 0:$.length)&&e(io,{instance:n,replies:_.replies,level:_.level,accWeight:y?u:_.weight,openAll:a,parentLink:{to:n?`/${n}/s/${_.id}`:`/s/${_.id}`,onClick:()=>{yn(_.id)}}})]},_.id)})})]})}const Nl=140,Pl=35,Ol=70,zl=140,ei=new Map;function en(t){var u,y;const n=ei.get(t.id);if(n)return n;const{spoilerText:i,content:s,mediaAttachments:o,poll:a,card:h}=t,r=vs(i+s),c=o!=null&&o.length?Nl:0,l=(((u=a==null?void 0:a.options)==null?void 0:u.length)||0)*Pl,m=h&&(o!=null&&o.length||(y=a==null?void 0:a.options)!=null&&y.length)?0:Ol,p=(r+c+l+m)/zl;return ei.set(t.id,p),p}const Ul=st($l);function Bl(){const t=xt(),{id:n,instance:i}=t;return e(Ul,{id:n,instance:i})}const Fl=""+new URL("boosts-carousel-YjmjXTE6.jpg",import.meta.url).href,Hl=""+new URL("grouped-notifications-xYMFVY91.jpg",import.meta.url).href,ql=""+new URL("multi-column-ETnJNDVb.jpg",import.meta.url).href,Yl=""+new URL("multi-hashtag-timeline-x-SDVR4g.jpg",import.meta.url).href,jl=""+new URL("nested-comments-thread-Ib-fZGS3.jpg",import.meta.url).href,Vl="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",Gl={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:Jt,PHANPY_WEBSITE:ns,PHANPY_PRIVACY_POLICY_URL:Kl,PHANPY_DEFAULT_INSTANCE_REGISTRATION_URL:is}=Gl,ss=ns?ns.replace(/https?:\/\//g,"").replace(/\/$/,""):null,os=`${"2024-12-08T11:50:56.977Z".slice(0,10).replace(/-/g,".")}.7e1ffc5`;function so(){return Xe(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:fi,alt:"",width:"160",height:"160",style:{aspectRatio:"1/1",marginBlockEnd:-16}}),e("img",{src:Vl,alt:"Phanpy",width:"200"})]}),e("p",{class:"desc",children:e(d,{id:"Ogtv0V"})}),e("p",{children:e(fe,{to:Jt?`/login?instance=${Jt}&submit=1`:"/login",class:"button",children:Jt?b._({id:"sQia9P"}):b._({id:"ZLoGls"})})}),Jt&&is&&e("p",{children:e("a",{href:is,class:"button plain5",children:e(d,{id:"e+RpCP"})})}),!Jt&&e("p",{class:"insignificant",children:e("small",{children:e(d,{id:"fvAsUK",components:{0:e("br",{})}})})})]}),(ss||os)&&e("p",{class:"app-site-version",children:e("small",{children:[ss," ",os]})}),e("p",{children:e(d,{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:Kl,target:"_blank"})}})}),e("div",{children:e(pi,{})})]}),e("div",{id:"why-container",children:e("div",{class:"sections",children:[e("section",{children:[e("img",{src:Fl,alt:b._({id:"S5cYrQ"}),loading:"lazy"}),e("h4",{children:e(d,{id:"Tu+sCN"})}),e("p",{children:e(d,{id:"e2uVlo"})})]}),e("section",{children:[e("img",{src:jl,alt:b._({id:"CGQ27z"}),loading:"lazy"}),e("h4",{children:e(d,{id:"cYE45+"})}),e("p",{children:e(d,{id:"Pc7QKh"})})]}),e("section",{children:[e("img",{src:Hl,alt:b._({id:"rnrM7k"}),loading:"lazy"}),e("h4",{children:e(d,{id:"4RRMre"})}),e("p",{children:e(d,{id:"8GMtDr"})})]}),e("section",{children:[e("img",{src:ql,alt:b._({id:"VLKtvP"}),loading:"lazy"}),e("h4",{children:e(d,{id:"pEkad9"})}),e("p",{children:e(d,{id:"t7Py5R"})})]}),e("section",{children:[e("img",{src:Yl,alt:b._({id:"wOax6E"}),loading:"lazy"}),e("h4",{children:e(d,{id:"Wi1Ov0"})}),e("p",{children:e(d,{id:"tS2i+h"})})]})]})})]})}const Wl=window.alert;window.__nativeAlert||(window.__nativeAlert=Wl);window.alert=function(t){t instanceof Error&&(t!=null&&t.message)&&(t=t.message),typeof t!="string"&&(t=JSON.stringify(t));const n=Yo({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}=ae();for(const a in t){if(!window.__IDLE__)break;try{const h=document.querySelector(`[data-state-post-id~="${a}"], [data-state-post-ids~="${a}"]`),r=i.some(c=>{var l;return a===it((l=c.status)==null?void 0:l.id,o)});if(!h&&!r){delete A.statuses[a],delete A.statusQuotes[a];for(const c in n){const l=n[c];if(it(l.id,l.instance)===a){delete A.unfurledLinks[c];break}}s++}}catch{}}},15*60*1e3);setTimeout(()=>{for(const t in zt)setTimeout(()=>{var n,i,s,o,a,h;Array.isArray(zt[t])?(i=(n=zt[t])[0])==null||i.call(n):typeof zt[t]=="object"?(o=(s=zt[t]).module)==null||o.call(s):(h=(a=zt)[t])==null||h.call(a)},1)},5e3);(()=>{window.__IDLE__=!0;const t=["mousemove","mousedown","resize","keydown","touchstart","pointerdown","pointermove","wheel"],n=()=>{window.__IDLE__=!0},s=ks(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 Zl=/iPad|iPhone|iPod/.test(navigator.userAgent);Zl&&document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible"){if(document.getElementsByClassName("media-modal-container").length>0)return;const n=ve.local.get("theme");let i;if(n){if(i=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),i){const s=i.content,o=n==="light"?i.dataset.themeLightColorTemp:i.dataset.themeDarkColorTemp;i.content=o||"",setTimeout(()=>{i.content=s},10)}}else{const s=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(i=document.querySelector(`meta[name="theme-color"][media*="${s}"]`),i){const o=i.dataset.content,a=i.dataset.contentTemp;i.content=a||"",setTimeout(()=>{i.content=o},10)}}}});{const t=ve.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=ve.local.get("textSize");n&&document.documentElement.style.setProperty("--text-size",`${n}px`)}rs(A,t=>{var n;for(const[i,s,o,a]of t){if(s.join(".")==="settings.shortcutsViewMode"){const h=document.getElementById("app");h&&(h.dataset.shortcutsViewMode=(n=A.shortcuts)!=null&&n.length?o:"")}s.join(".")==="settings.cloakMode"&&document.body.classList.toggle("cloak",o)}});const fn=new Map;window.__BENCH_RESULTS=new Map;window.__BENCHMARK={start(t){},end(t){}};function Xl(){const[t,n]=R(!1),[i,s]=R("loading");__BENCHMARK.start("app-init"),__BENCHMARK.start("time-to-following"),__BENCHMARK.start("time-to-home"),__BENCHMARK.start("time-to-isLoggedIn"),Qe(),ie(()=>{const a=ve.local.get("instanceURL"),h=decodeURIComponent((window.location.search.match(/code=([^&]+)/)||[,""])[1]);if(h){window.history.replaceState({},document.title,window.location.pathname||"/");const r=ve.sessionCookie.get("clientID"),c=ve.sessionCookie.get("clientSecret"),l=ve.sessionCookie.get("vapidKey"),m=ve.sessionCookie.get("codeVerifier");(async()=>{s("loading");const{access_token:f}=await Il({instanceURL:a,client_id:r,client_secret:c,code:h,code_verifier:m||void 0});if(f){const p=wo({instance:a,accessToken:f});await Promise.allSettled([Dn(p),Nn(p,a),ko(p,a,f,l)]),Ci(),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=_o(r),c&&(vn(c.info.id),window.history.replaceState({},document.title,window.location.pathname||"/"))),c||(c=ti()),c){vn(c.info.id);const{client:l}=ae({account:c}),{instance:m}=l;Ci(),s("loading"),(async()=>{try{So()&&Co(m)?(Dn(l),Nn(l,m)):await Promise.allSettled([Dn(l),Nn(l,m)])}catch{}finally{n(!0),s("default"),__BENCHMARK.end("app-init")}})()}else s("default"),__BENCHMARK.end("app-init")}ve.sessionCookie.del("clientID"),ve.sessionCookie.del("clientSecret"),ve.sessionCookie.del("codeVerifier")},[]);let o=Gt();return A.currentLocation=o.pathname,ie(Kn,[o,t]),/\/https?:/.test(o.pathname)?e(ll,{}):i==="loading"?e(Oe,{id:"loader-root"}):e(O,{children:[e(Ql,{isLoggedIn:t}),e(ed,{isLoggedIn:t}),e(ii,{children:e(je,{path:"/:instance?/s/:id",element:e(Bl,{})})}),t&&e(Ko,{}),t&&e(Na,{}),e(Aa,{}),t&&e($a,{}),e(Go,{isLoggedIn:t}),e(Ma,{onClose:Kn}),e(Wo,{})]})}function Jl({isLoggedIn:t}){return t&&__BENCHMARK.end("time-to-isLoggedIn"),t?e(cl,{}):e(so,{})}const Ql=st(({isLoggedIn:t})=>{const n=Gt(),i=Ce(()=>{const{pathname:s}=n;return!/^\/(login|welcome)/i.test(s)},[n]);return e(ii,{location:i||n,children:[e(je,{path:"/",element:e(Jl,{isLoggedIn:t})}),e(je,{path:"/login",element:e(Al,{})}),e(je,{path:"/welcome",element:e(so,{})})]})});function cs(){return A.prevLocation||null}function ed({isLoggedIn:t}){const n=Gt(),i=Y(cs());return Ce(()=>tn("/:instance/s/:id",n.pathname)||tn("/s/:id",n.pathname),[n.pathname,tn])?i.current||(i.current=cs()):i.current=null,e(ii,{location:i.current||n,children:[t&&e(O,{children:[e(je,{path:"/notifications",element:e(Xs,{})}),e(je,{path:"/mentions",element:e(Ks,{})}),e(je,{path:"/following",element:e(ki,{})}),e(je,{path:"/b",element:e(Bs,{})}),e(je,{path:"/f",element:e(Fs,{})}),e(je,{path:"/l",children:[e(je,{index:!0,element:e(dl,{})}),e(je,{path:":id",element:e(Ys,{})})]}),e(je,{path:"/fh",element:e(Cr,{})}),e(je,{path:"/ft",element:e(wr,{})}),e(je,{path:"/catchup",element:e(rr,{})}),e(je,{path:"/annual_report/:year",element:e(er,{})})]}),e(je,{path:"/:instance?/t/:hashtag",element:e(qs,{})}),e(je,{path:"/:instance?/a/:id",element:e(Ja,{})}),e(je,{path:"/:instance?/p",children:[e(je,{index:!0,element:e(Jn,{})}),e(je,{path:"l",element:e(Jn,{local:!0})})]}),e(je,{path:"/:instance?/trending",element:e(eo,{})}),e(je,{path:"/:instance?/search",element:e(Js,{})})]})}Io();Ao(e(To,{i18n:b,children:e(xo,{children:e(Xl,{})})}),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 h=await caches.keys();for(const r of h){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 f of m)await c.delete(f)}}i=!0}catch{}setTimeout(a,i?o:s)}setTimeout(a,s)}window.__CLOAK__=()=>{document.body.classList.toggle("cloak")};
|
||
//# sourceMappingURL=main-hNUnS08_.js.map
|