import{A as j,y as X,h as L,s as A,a as ce,b as Ge,i as g,x as ct,u as Be,c as e,T as l,d as he,g as bt,p as $t,e as mn,k as q,f as Xe,C as Tn,L as Vs,j as be,D as Gs,l as Ws,n as Pn,o as Yt,q as wt,r as it,t as Ks,v as Le,w as gn,z as hi,_ as vt,B as Zi,E as vl,F as Ji,G as Xi,H as Zs,I as Js,J as st,K as Xs,M as Yn,N as ut,O as Qs,P as eo,Q as to,R as Vn,S as Mt,U as Ke,V as Qi,W as es,X as no,Y as Qt,Z as io,$ as so,a0 as fi,a1 as pi,a2 as oo,a3 as mi,a4 as co,a5 as Gn,a6 as je,a7 as ao,a8 as ro,a9 as lo,aa as uo}from"./useTitle-SRT6j-GL.js";import{u as Wn,s as de,a as Ue,o as gi,b as ho,I as S,M as ze,A as lt,N as Ct,c as ot,d as ge,e as Oe,f as Ye,g as rt,L as ue,l as St,h as ts,t as bi,i as Je,R as Vt,j as et,p as Gt,k as at,m as ns,n as Nn,E as is,q as Ve,r as pt,v as fo,S as bn,w as vi,T as ss,x as dt,y as Kn,z as qe,B as yt,C as po,D as mo,F as Et,G as Zn,H as os,J as go,K as bo,O as vo,P as cs,Q as en,U as yo,V as wo,W as as,X as ko,Y as Rt,Z as Jn,_ as _o,$ as rs,a0 as So,a1 as ls,a2 as Co,a3 as Io,a4 as To,a5 as yi,a6 as xo,a7 as Ot}from"./fuse-MwQ_F2cO.js";import"./tinyld-light-PxOyhYWY.js";var ds=Ao;function Ao(t,n,i){var s=null,o=null,a=function(){s&&(clearTimeout(s),o=null,s=null)},f=function(){var c=o;a(),c&&c()},d=function(){if(!n)return t.apply(this,arguments);var c=this,r=arguments,m=i&&!s;if(a(),o=function(){t.apply(c,r)},s=setTimeout(function(){if(s=null,!m){var h=o;return o=null,h()}},n),m)return o()};return d.cancel=a,d.flush=f,d}/*! * 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 * @license MIT */(function(t,n){"use strict";typeof t.CustomEvent!="function"&&(t.CustomEvent=function(u,v){v=v||{bubbles:!1,cancelable:!1,detail:void 0};var b=n.createEvent("CustomEvent");return b.initCustomEvent(u,v.bubbles,v.cancelable,v.detail),b},t.CustomEvent.prototype=t.Event.prototype),n.addEventListener("touchstart",m,!1),n.addEventListener("touchmove",h,!1),n.addEventListener("touchend",r,!1);var i=null,s=null,o=null,a=null,f=null,d=null,c=0;function r(u){if(d===u.target){var v=parseInt(p(d,"data-swipe-threshold","20"),10),b=p(d,"data-swipe-unit","px"),w=parseInt(p(d,"data-swipe-timeout","500"),10),k=Date.now()-f,y="",C=u.changedTouches||u.touches||[];if(b==="vh"&&(v=Math.round(v/100*n.documentElement.clientHeight)),b==="vw"&&(v=Math.round(v/100*n.documentElement.clientWidth)),Math.abs(o)>Math.abs(a)?Math.abs(o)>v&&k0?y="swiped-left":y="swiped-right"):Math.abs(a)>v&&k0?y="swiped-up":y="swiped-down"),y!==""){var _={dir:y.replace(/swiped-/,""),touchType:(C[0]||{}).touchType||"direct",fingers:c,xStart:parseInt(i,10),xEnd:parseInt((C[0]||{}).clientX||-1,10),yStart:parseInt(s,10),yEnd:parseInt((C[0]||{}).clientY||-1,10)};d.dispatchEvent(new CustomEvent("swiped",{bubbles:!0,cancelable:!0,detail:_})),d.dispatchEvent(new CustomEvent(y,{bubbles:!0,cancelable:!0,detail:_}))}i=null,s=null,f=null}}function m(u){u.target.getAttribute("data-swipe-ignore")!=="true"&&(d=u.target,f=Date.now(),i=u.touches[0].clientX,s=u.touches[0].clientY,o=0,a=0,c=u.touches.length)}function h(u){if(!(!i||!s)){var v=u.touches[0].clientX,b=u.touches[0].clientY;o=i-v,a=s-b}}function p(u,v,b){for(;u&&u!==n.documentElement;){var w=u.getAttribute(v);if(w)return w;u=u.parentNode}return b}})(window,document);function Bt(t=()=>{},n=[]){const i=j(t);X(()=>{i.current=t},[n]),X(()=>{const s=()=>{const o=document.hidden||document.visibilityState==="hidden";i.current(!o)};return document.addEventListener("visibilitychange",s),()=>document.removeEventListener("visibilitychange",s)},[])}const Eo=1e3*3,wi=2e4,Ro=ct(function({isLoggedIn:n}){const[i,s]=L(!0),o=j();Bt(c=>{clearTimeout(o.current),c?s(!0):o.current=setTimeout(()=>{s(!1)},wi)});const a=async(c,r,m)=>{var h;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 v;try{const b=await c.v1.markers.fetch({timeline:"notifications"});v=(h=b==null?void 0:b.notifications)==null?void 0:h.lastReadId}catch{}v?A.notificationsShowNew=u[0].id!==v:A.notificationsShowNew=!0}}};X(()=>{let c,r,m;if(n&&i){const{masto:h,streaming:p,instance:u}=ce();(async()=>{await a(h,u);let v=!1;p&&(r=setTimeout(()=>{(async()=>{try{v=!0,c=p.user.notification.subscribe();for await(const b of c){if(!c||!i)break;b.event==="notification"&&Ge(b.payload,u,{skipThreading:!0}),A.notificationsShowNew=!0}}catch{v=!1}v||(m=setInterval(()=>{a(h,u,!0)},wi))})()},Eo))})()}return()=>{var h;(h=c==null?void 0:c.unsubscribe)==null||h.call(c),c=null,clearTimeout(r),clearInterval(m)}},[i,n]);const f=j(),d=()=>{f.current=Date.now(),fetch("./version.json").then(c=>c.json()).then(c=>{c&&(A.appVersion=c)}).catch(c=>{})};return Wn(d,i&&1e3*60*30),Bt(c=>{c&&(f.current?Date.now()-f.current>1e3*60*60&&d():d())}),Ue("shift+alt+k",()=>{const c=A.settings.cloakMode;A.settings.cloakMode=!c,de({text:c?g._({id:"oguMwa"}):g._({id:"IXZLPs"})})}),null});function Lo(){const t=Be(A);function n(i){if(t.composerState.minimized){A.composerState.minimized=!1,gi();return}i.shiftKey?ho()||(A.showCompose=!0):(gi(),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(S,{icon:"quill",size:"xl",alt:g._({id:"QOhkyl"})})})}const $o=ct(function(){const n=Be(A);function i(){A.showKeyboardShortcutsHelp=!1}return Ue("?, shift+?, shift+slash",s=>{A.showKeyboardShortcutsHelp=!0},{ignoreEventWhen:s=>!!document.querySelector("#modal-container > *")}),!!n.showKeyboardShortcutsHelp&&e(ze,{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(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(l,{id:"77Emn0"})})}),e("main",{children:e("table",{children:e("tbody",{children:[{action:g._({id:"ulXSNi"}),keys:e("kbd",{children:"?"})},{action:g._({id:"Gy9P9T"}),keys:e("kbd",{children:"j"})},{action:g._({id:"6XYpYY"}),keys:e("kbd",{children:"k"})},{action:g._({id:"DYowFe"}),keys:e(l,{id:"mzjGX4",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"S5ez7Y"}),keys:e(l,{id:"Fd8FaU",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"VkLESX"}),keys:e("kbd",{children:"."})},{action:g._({id:"jsFF8C"}),keys:e(l,{id:"80sOCm",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:e(l,{id:"41gejM",components:{0:e("br",{})}}),keys:e("kbd",{children:"x"})},{action:g._({id:"jAj8rv"}),keys:e(l,{id:"evz6c6",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"duF1lx"}),keys:e(l,{id:"nhpsIN",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"AIa/f7"}),keys:e("kbd",{children:"c"})},{action:g._({id:"snPx8X"}),className:"insignificant",keys:e(l,{id:"+Cxvld",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"1pKapz"}),keys:e(l,{id:"py67WT",components:{0:e("kbd",{}),1:e("kbd",{}),2:e("kbd",{}),3:e("kbd",{})}})},{action:g._({id:"A1taO8"}),keys:e("kbd",{children:"/"})},{action:g._({id:"ImOQa9"}),keys:e("kbd",{children:"r"})},{action:g._({id:"KFs8c6"}),className:"insignificant",keys:e(l,{id:"XpQLJF",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"cqi4Mx"}),keys:e(l,{id:"84WuL2",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"kulphB"}),keys:e(l,{id:"yrz6Ck",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"PZlHt8"}),keys:e("kbd",{children:"d"})},{action:g._({id:"C7ujRh"}),keys:e(l,{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))})})})]})})}),us=new Set,tt=new WeakMap,qt=new WeakMap,Lt=new WeakMap,On=new WeakMap,Mo=new WeakMap,Ht=new WeakMap,vn=new WeakMap,Jt=new WeakSet;let It,Xn=0,Qn=0;const mt="__aa_tgt",tn="__aa_del",yn="__aa_new",Do=t=>{const n=Fo(t);n&&n.forEach(i=>Bo(i))},Po=t=>{t.forEach(n=>{n.target===It&&Oo(),tt.has(n.target)&&Dt(n.target)})};function No(t){const n=On.get(t);n==null||n.disconnect();let i=tt.get(t),s=0;const o=5;i||(i=jt(t),tt.set(t,i));const{offsetWidth:a,offsetHeight:f}=It,c=[i.top-o,a-(i.left+o+i.width),f-(i.top+o+i.height),i.left-o].map(m=>`${-1*Math.floor(m)}px`).join(" "),r=new IntersectionObserver(()=>{++s>1&&Dt(t)},{root:It,threshold:1,rootMargin:c});r.observe(t),On.set(t,r)}function Dt(t){clearTimeout(vn.get(t));const n=_n(t),i=nn(n)?500:n.duration;vn.set(t,setTimeout(async()=>{const s=Lt.get(t);try{await(s==null?void 0:s.finished),tt.set(t,jt(t)),No(t)}catch{}},i))}function Oo(){clearTimeout(vn.get(It)),vn.set(It,setTimeout(()=>{us.forEach(t=>ms(t,n=>hs(()=>Dt(n))))},100))}function zo(t){setTimeout(()=>{Mo.set(t,setInterval(()=>hs(Dt.bind(null,t)),2e3))},Math.round(2e3*Math.random()))}function hs(t){typeof requestIdleCallback=="function"?requestIdleCallback(()=>t()):requestAnimationFrame(()=>t())}let zn,Ft;const Uo=typeof window<"u"&&"ResizeObserver"in window;Uo&&(It=document.documentElement,zn=new MutationObserver(Do),Ft=new ResizeObserver(Po),window.addEventListener("scroll",()=>{Qn=window.scrollY,Xn=window.scrollX}),Ft.observe(It));function Fo(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(xn(o.target),!s.has(o.target)){s.add(o.target);for(let a=0;ai(t,Ht.has(t)));for(let i=0;io(s,Ht.has(s)))}}function ti(t){return Array.isArray(t)?t:[t]}function nn(t){return typeof t=="function"}function Ho(t){const n=tt.get(t),i=jt(t);if(!ei(t))return tt.set(t,i);let s;if(!n)return;const o=_n(t);if(typeof o!="function"){const a=n.left-i.left,f=n.top-i.top,[d,c,r,m]=fs(t,n,i),h={transform:`translate(${a}px, ${f}px)`},p={transform:"translate(0, 0)"};d!==c&&(h.width=`${d}px`,p.width=`${c}px`),r!==m&&(h.height=`${r}px`,p.height=`${m}px`),s=t.animate([h,p],{duration:o.duration,easing:o.easing})}else{const[a]=ti(o(t,"remain",n,i));s=new Animation(a),s.play()}Lt.set(t,s),tt.set(t,i),s.addEventListener("finish",Dt.bind(null,t))}function ki(t){yn in t&&delete t[yn];const n=jt(t);tt.set(t,n);const i=_n(t);if(!ei(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]=ti(i(t,"add",n));s=new Animation(o),s.play()}Lt.set(t,s),s.addEventListener("finish",Dt.bind(null,t))}function _i(t,n){var i;t.remove(),tt.delete(t),qt.delete(t),Lt.delete(t),(i=On.get(t))===null||i===void 0||i.disconnect(),setTimeout(()=>{if(tn in t&&delete t[tn],Object.defineProperty(t,yn,{value:!0,configurable:!0}),n&&t instanceof HTMLElement)for(const s in n)t.style[s]=""},0)}function jo(t){var n;if(!qt.has(t)||!tt.has(t))return;const[i,s]=qt.get(t);Object.defineProperty(t,tn,{value:!0,configurable:!0});const o=window.scrollX,a=window.scrollY;if(s&&s.parentNode&&s.parentNode instanceof Element?s.parentNode.insertBefore(t,s):i&&i.parentNode?i.parentNode.appendChild(t):(n=ps(t))===null||n===void 0||n.appendChild(t),!ei(t))return _i(t);const[f,d,c,r]=Vo(t),m=_n(t),h=tt.get(t);(o!==Xn||a!==Qn)&&Yo(t,o,a,m);let p,u={position:"absolute",top:`${f}px`,left:`${d}px`,width:`${c}px`,height:`${r}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!nn(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[v,b]=ti(m(t,"remove",h));(b==null?void 0:b.styleReset)!==!1&&(u=(b==null?void 0:b.styleReset)||u,Object.assign(t.style,u)),p=new Animation(v),p.play()}Lt.set(t,p),p.addEventListener("finish",_i.bind(null,t,u))}function Yo(t,n,i,s){const o=Xn-n,a=Qn-i,f=document.documentElement.style.scrollBehavior;if(getComputedStyle(It).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+o,window.scrollY+a),!t.parentElement)return;const c=t.parentElement;let r=c.clientHeight,m=c.clientWidth;const h=performance.now();function p(){requestAnimationFrame(()=>{if(!nn(s)){const u=r-c.clientHeight,v=m-c.clientWidth;h+s.duration>performance.now()?(window.scrollTo({left:window.scrollX-v,top:window.scrollY-u}),r=c.clientHeight,m=c.clientWidth,p()):document.documentElement.style.scrollBehavior=f}})}p()}function Vo(t){const n=tt.get(t),[i,,s]=fs(t,n,jt(t));let o=t.parentElement;for(;o&&(getComputedStyle(o).position==="static"||o instanceof HTMLBodyElement);)o=o.parentElement;o||(o=document.body);const a=getComputedStyle(o),f=tt.get(o)||jt(o),d=Math.round(n.top-f.top)-ht(a.borderTopWidth),c=Math.round(n.left-f.left)-ht(a.borderLeftWidth);return[d,c,i,s]}function gs(t,n={}){return zn&&Ft&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!nn(n)&&!n.disrespectUserMotionPreference||(Jt.add(t),getComputedStyle(t).position==="static"&&Object.assign(t.style,{position:"relative"}),ms(t,Dt,zo,o=>Ft==null?void 0:Ft.observe(o)),nn(n)?Ht.set(t,n):Ht.set(t,{duration:250,easing:"ease-in-out",...n}),zn.observe(t,{childList:!0}),us.add(t))),Object.freeze({parent:t,enable:()=>{Jt.add(t)},disable:()=>{Jt.delete(t)},isEnabled:()=>Jt.has(t)})}function ni(t){const n=j(null),[i,s]=L(),o=a=>{i&&(a?i.enable():i.disable())};return X(()=>{n.current instanceof HTMLElement&&s(gs(n.current,t||{}))},[]),[n,o]}const Go=window.matchMedia("(display-mode: standalone)").matches;function Wo({onClose:t}){const{masto:n}=ce(),i=he.local.getJSON("accounts"),s=bt(),o=i.length>1,[a,f]=$t(c=>c+1,0),[d]=ni();return e("div",{id:"accounts-container",class:"sheet",tabIndex:"-1",children:[!!t&&e("button",{type:"button",class:"sheet-close",onClick:t,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{class:"header-grid",children:e("h2",{children:e(l,{id:"bPwFdf"})})}),e("main",{children:e("section",{children:[e("ul",{class:"accounts-list",ref:d,children:i.map((c,r)=>{const m=c.info.id===s,h=r===0;return e("li",{children:[e("div",{children:[o&&e("span",{class:`current ${m?"is-current":""}`,children:e(S,{icon:"check-circle",alt:g._({id:"Hp1l6f"})})}),e(lt,{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,he.local.setJSON("accounts",i),f()}catch{}}}),e(Ct,{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}`:(mn(c.info.id),location.reload())}})]}),e("div",{class:"actions",children:[h&&o&&e(q,{children:[e("span",{class:"tag",children:e(l,{id:"ovBPCi"})})," "]}),e(ot,{align:"end",menuButton:e("button",{type:"button",class:"plain more-button",children:e(S,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),children:[o&&e(q,{children:[e(ge,{disabled:m,onClick:()=>{mn(c.info.id),location.reload()},children:[e(S,{icon:"transfer"})," ",e(l,{id:"3t/Nrv"})]}),!Go&&!m&&e(Oe,{href:`./?account=${c.info.id}`,target:"_blank",children:[e(S,{icon:"external"}),e("span",{children:e(l,{id:"PZgZtY"})})]}),e(Ye,{})]}),e(ge,{onClick:()=>{A.showAccount=`${c.info.username}@${c.instanceURL}`},children:[e(S,{icon:"user"}),e("span",{children:e(l,{id:"40z2Fm"})})]}),e(Ye,{}),o&&e(ge,{disabled:h,onClick:()=>{i.splice(r,1),i.unshift(c),he.local.setJSON("accounts",i),f()},children:[e(S,{icon:"check-circle"}),e("span",{children:e(l,{id:"PPcets"})})]}),e(rt,{subMenu:!0,confirmLabel:e(q,{children:[e(S,{icon:"exit"}),e("span",{children:e(l,{id:"k08LxG",values:{0:c.info.acct},components:{0:e("span",{class:"bidi-isolate"})}})})]}),disabled:!m,menuItemClassName:"danger",onClick:()=>{i.splice(r,1),he.local.setJSON("accounts",i),location.href=location.pathname||"/"},children:[e(S,{icon:"exit"}),e("span",{children:e(l,{id:"CXk1bI"})})]})]})]})]},c.info.id)})}),e("p",{children:e(ue,{to:"/login",class:"button plain2",onClick:t,children:[e(S,{icon:"plus"})," ",e("span",{children:e(l,{id:"Is7/PB"})})]})}),o&&e("p",{children:e("small",{children:e(l,{id:"52x24e",components:{0:e("i",{})}})})})]})})]})}const ii="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",Ko={"zh-CN":"zh-Hans","zh-TW":"zh-Hant","pt-BR":"pt-BR"};function si(){const{i18n:t}=Xe(),n=be(()=>Vs.map(i=>{var f,d;const s=Ko[i]||i.replace(/-[a-z]+$/i,""),o=St({code:s,locale:i,fallback:(f=Tn.find(c=>c.code===i))==null?void 0:f.nativeName}),a=St({code:s,locale:t.locale,fallback:(d=Tn.find(c=>c.code===i))==null?void 0:d.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.codes.code?1:0}),[]);return e("label",{class:"lang-selector",children:["๐ŸŒ"," ",e("select",{class:"small",value:t.locale||Gs,onChange:i=>{he.local.set("lang",i.target.value),Ws(i.target.value)},children:[n.map(({code:i,regionlessCode:s,native:o})=>{var d;const a=St({code:s,locale:t.locale,fallback:(d=Tn.find(c=>c.code===i))==null?void 0:d.name});return e("option",{value:i,"data-regionless-code":s,children:!!a&&a!==o?`${o} - ${a}`:o},i)}),void 0]})]})}function Si(t){const{masto:n}=ce();return n.v1.push.subscription.create(t)}function Zo(){const{masto:t}=ce();return t.v1.push.subscription.fetch()}function Jo(t){const{masto:n}=ce();return n.v1.push.subscription.update(t)}function Xo(){const{masto:t}=ce();return t.v1.push.subscription.remove()}function Sn(){return"serviceWorker"in navigator&&"PushManager"in window}function Qo(){return navigator.serviceWorker.getRegistration()}async function oi(){const t=await Qo(),n=t?await t.pushManager.getSubscription():void 0;return{registration:t,subscription:n}}function bs(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{u.preventDefault();const b=new FormData(s.current).get("theme"),w=document.documentElement;if(b==="auto"){w.classList.remove("is-light","is-dark");const k=document.querySelector('meta[data-theme-setting="manual"]');k&&(k.name=""),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(C=>{C.name="theme-color"})}else{w.classList.toggle("is-light",b==="light"),w.classList.toggle("is-dark",b==="dark");const k=document.querySelector('meta[data-theme-setting="manual"]');k&&(k.name="theme-color",k.content=b==="light"?k.dataset.themeLightColor:k.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(C=>{C.name=""})}document.querySelector('meta[name="color-scheme"]').setAttribute("content",b==="auto"?"dark light":b),b==="auto"?he.local.del("theme"):he.local.set("theme",b)},children:e("div",{class:"radio-group",children:[e("label",{children:[e("input",{type:"radio",name:"theme",value:"light",defaultChecked:i==="light"}),e("span",{children:e(l,{id:"1njn7W"})})]}),e("label",{children:[e("input",{type:"radio",name:"theme",value:"dark",defaultChecked:i==="dark"}),e("span",{children:e(l,{id:"pvnfJD"})})]}),e("label",{children:[e("input",{type:"radio",name:"theme",value:"auto",defaultChecked:i!=="light"&&i!=="dark"}),e("span",{children:e(l,{id:"R9Khdg"})})]})]})})})]}),e("li",{children:[e("div",{children:e("label",{children:e(l,{id:"7r6sCa"})})}),e("div",{class:"range-group",children:[e("span",{style:{fontSize:At[0]},children:e(l,{id:"J6ypuD"})})," ",e("input",{type:"range",min:At[0],max:At[At.length-1],step:"1",value:d,list:"sizes",onChange:u=>{const v=parseInt(u.target.value,10);document.documentElement.style.setProperty("--text-size",`${v}px`),v===Ti?he.local.del("textSize"):he.local.set("textSize",u.target.value)}})," ",e("span",{style:{fontSize:At[At.length-1]},children:e(l,{id:"J6ypuD"})}),e("datalist",{id:"sizes",children:At.map(u=>e("option",{value:u}))})]})]}),e("li",{children:[e("span",{children:[e("label",{children:e(l,{id:"CeJHfb"})}),e("br",{}),e("small",{children:e("a",{href:"https://crowdin.com/project/phanpy",target:"_blank",rel:"noopener noreferrer",children:e(l,{id:"FFmj1D"})})})]}),e(si,{})]})]})}),h&&e(q,{children:[e("h3",{children:e(l,{id:"PcoS3v"})}),e("section",{children:e("ul",{children:e("li",{children:[e("div",{children:e("label",{for:"posting-privacy-field",children:[e(l,{id:"NAjVvt"})," ",e(S,{icon:"cloud",alt:g._({id:"N2FcBE"}),class:"synced-icon"})]})}),e("div",{children:e("select",{id:"posting-privacy-field",value:c["posting:default:visibility"]||"public",onChange:u=>{const{value:v}=u.target;(async()=>{try{await m.v1.accounts.updateCredentials({source:{privacy:v}}),r({...c,"posting:default:visibility":v}),he.account.set("preferences",{...c,"posting:default:visibility":v})}catch{alert(g._({id:"Oa+KBY"}))}})()},children:[e("option",{value:"public",children:e(l,{id:"7d1a0d"})}),e("option",{value:"unlisted",children:e(l,{id:"WDcQq9"})}),e("option",{value:"private",children:e(l,{id:"o34OrG"})})]})})]})})}),e("p",{class:"section-postnote",children:[e(S,{icon:"cloud",alt:g._({id:"N2FcBE"}),class:"synced-icon"})," ",e("small",{children:e(l,{id:"xlsg7n",values:{instance:p},components:{0:e("a",{href:`https://${p}/`,target:"_blank",rel:"noopener noreferrer"})}})})]})]}),e("h3",{children:e(l,{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(l,{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(l,{id:"TSbnoW"})]})}),e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.contentTranslation,onChange:u=>{const{checked:v}=u.target;A.settings.contentTranslation=v,v||(A.settings.contentTranslationTargetLanguage=null)}})," ",e(l,{id:"0SdaOt"})]}),e("div",{class:`sub-section ${n.settings.contentTranslation?"":"more-insignificant"}`,children:[e("div",{children:e("label",{children:[e(l,{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(l,{id:"jNCSyx",values:{systemTargetLanguageText:f}})}),e("option",{disabled:!0,children:"โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€"}),bi.map(u=>{const v=St({code:u.code,fallback:u.name}),b=St({code:u.code,locale:u.code}),w=v!==b;return e("option",{value:u.code,children:w?`${b} - ${v}`:v})})]})]})}),e("hr",{}),e("div",{class:"checkbox-fieldset",children:[e(l,{id:"cc0NrU",values:{0:n.settings.contentTranslationHideLanguages.length}}),e("div",{class:"checkbox-fields",children:bi.map(u=>{const v=St({code:u.code,fallback:u.name}),b=St({code:u.code,locale:u.code}),w=v!==b;return e("label",{children:[e("input",{type:"checkbox",checked:n.settings.contentTranslationHideLanguages.includes(u.code),onChange:k=>{const{checked:y}=k.target;y?A.settings.contentTranslationHideLanguages.push(u.code):A.settings.contentTranslationHideLanguages=n.settings.contentTranslationHideLanguages.filter(C=>C!==u.code)}})," ",w?e("span",{children:[b," ",e("span",{class:"insignificant",children:["- ",v]})]}):v]})})})]}),e("p",{class:"insignificant",children:e("small",{children:e(l,{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(l,{id:"gURvmk"})]}),e("p",{class:"insignificant",children:e("small",{children:e(l,{id:"PbHARL",components:{0:e("b",{})}})})})]})]})]}),!!sc&&h&&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(l,{id:"D7/2jB"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(l,{id:"/CLBTL",components:{0:e("a",{href:"https://developers.giphy.com/",target:"_blank",rel:"noopener noreferrer"})}})})})]}),!!ic&&h&&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(l,{id:"9q5uor"})," ",e(S,{icon:"sparkles2",class:"more-insignificant"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(l,{id:"faZ9RI"})})}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(l,{id:"fHZgvt",components:{0:e("a",{href:"https://github.com/cheeaun/img-alt-api",target:"_blank",rel:"noopener noreferrer"})}})})})]}),h&&Je("@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(l,{id:"aGziA/"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(l,{id:"X17jCM"})})})]}),h&&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(l,{id:"570qTm"})," ",e(S,{icon:"cloud",class:"more-insignificant"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(l,{id:"0tZAhT",components:{0:e("br",{})}})})}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(l,{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(l,{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(l,{id:"T/hglb"})})})]}),h&&e("li",{children:e("button",{type:"button",class:"light",onClick:()=>{A.showDrafts=!0,A.showSettings=!1},children:e(l,{id:"krk5ws"})})})]})}),h&&e(cc,{onClose:t}),e("h3",{children:e(l,{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:ii,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(l,{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(l,{id:"O4cLCR"})})," ","ยท"," ",e("a",{href:"https://www.buymeacoffee.com/cheeaun",target:"_blank",rel:"noopener noreferrer",children:e(l,{id:"Ng063n"})})," ","ยท"," ",e("a",{href:nc,target:"_blank",rel:"noopener noreferrer",children:e(l,{id:"LcET2C"})})]}),e("p",{children:[xi&&e(q,{children:[e(l,{id:"pFnMHn",values:{0:xi.replace(/https?:\/\//g,"").replace(/\/$/,"")},components:{0:e("span",{class:"insignificant"})}}),e("br",{})]}),e(l,{id:"6KkH+2",values:{0:e("span",{class:"ib insignificant",children:["(",e("a",{href:"https://github.com/cheeaun/phanpy/commit/1b8ab47",target:"_blank",rel:"noopener noreferrer",children:e(Vt,{datetime:new Date("2024-08-31T13:00:46.020Z")})}),")"]})},components:{0:e("span",{class:"insignificant"}),1:e("input",{type:"text",class:"version-string",readOnly:!0,size:"18",value:`${"2024-08-31T13:00:46.020Z".slice(0,10).replace(/-/g,".")}.1b8ab47`,onClick:u=>{u.target.select();try{navigator.clipboard.writeText(u.target.value),de(g._({id:"PiPfua"}))}catch{de(g._({id:"gdxreD"}))}}})}})]})]})]})]})}function cc({onClose:t}){if(!Sn())return null;const{instance:n}=ce(),[i,s]=L("default"),o=j(),[a,f]=L(!1),[d,c]=L(!1),r=j();X(()=>{(async()=>{s("loading");try{const{subscription:h,backendSubscription:p}=await ec();if(p!=null&&p.policy&&p.policy!=="none"){f(!0);const{alerts:u,policy:v}=p;r.current=v;const{elements:b}=o.current,w=b.namedItem("policy");w&&(w.value=v),Object.keys(u).forEach(k=>{const y=b.namedItem(k);(y==null?void 0:y.type)==="checkbox"&&(y.checked=!0)})}s("default")}catch(h){/outside.*authorized/i.test(h.message)?c(!0):alert((h==null?void 0:h.message)||h),s("error")}})()},[]);const m=i==="loading";return e("form",{ref:o,onChange:()=>{setTimeout(()=>{const h=Object.fromEntries(new FormData(o.current)),p=!!h["policy-allow"],u={data:{policy:h.policy,alerts:{mention:!!h.mention,favourite:!!h.favourite,reblog:!!h.reblog,follow:!!h.follow,follow_request:!!h.followRequest,poll:!!h.poll,update:!!h.update,status:!!h.status}}};let v=0;Object.keys(u.data.alerts).forEach(w=>{u.data.alerts[w]?v++:delete u.data.alerts[w]});const b=r.current!==u.data.policy;p&&v>0?b?Ii().then(()=>{Ci(u)}).catch(w=>{alert(g._({id:"I6pdY3"}))}):Ci(u).catch(w=>{alert(g._({id:"I6pdY3"}))}):Ii().catch(w=>{alert(g._({id:"q1zFd+"}))})},100)},children:[e("h3",{children:e(l,{id:"WUHLnz"})}),e("section",{children:e("ul",{children:e("li",{children:[e("label",{children:[e("input",{type:"checkbox",disabled:m||d,name:"policy-allow",checked:a,onChange:async h=>{const{checked:p}=h.target;if(p){const u=await Notification.requestPermission();u==="granted"?f(!0):(f(!1),u==="denied"&&alert(g._({id:"6LUsk7"})))}else f(!1)}})," ",e(l,{id:"qYNCa1",values:{0:[{value:"all",label:g._({id:"+niKJH"})},{value:"followed",label:g._({id:"x2NYtp"})},{value:"follower",label:g._({id:"PBFNgg"})}].map(h=>e("option",{value:h.value,children:h.label}))},components:{0:e("select",{name:"policy",disabled:m||d||!a})}})]}),e("div",{class:"shazam-container no-animation",style:{width:"100%"},hidden:!a,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"sub-section",children:e("ul",{children:[{value:"mention",label:g._({id:"/bZzdR"})},{value:"favourite",label:g._({id:"zZOZj7"})},{value:"reblog",label:g._({id:"puY2t0"})},{value:"follow",label:g._({id:"aaJhcT"})},{value:"followRequest",label:g._({id:"6Fs1Ba"})},{value:"poll",label:g._({id:"wNExRS"})},{value:"update",label:g._({id:"K/EtE6"})},{value:"status",label:g._({id:"2yr1/p"})}].map(h=>e("li",{children:e("label",{children:[e("input",{type:"checkbox",name:h.value})," ",h.label]})}))})})})}),d&&e("div",{class:"sub-section",children:e("p",{children:e(l,{id:"8d0b8B",components:{0:e(ue,{to:`/login?instance=${n}`,onClick:t}),1:e("b",{})}})})})]})})}),e("p",{class:"section-postnote",children:e("small",{children:e(l,{id:"z96cOX",components:{0:e("b",{})}})})})]})}const Un=()=>{let t=setTimeout(()=>{if(!document.getElementById("columns")){const i=document.querySelectorAll("#modal-container > *");if(i!=null&&i.length){const f=i[i.length-1],d=f.querySelector('[tabindex="-1"]')||f;if(d){d.focus();return}}if(document.querySelector(".deck-backdrop"))return;const o=document.querySelectorAll(".deck-container"),a=o[o.length-1];a&&a.tabIndex===-1&&a.focus()}},100);return()=>clearTimeout(t)};function vs(t){if(!t)return;const n=Yt(),i=j(n.pathname);X(()=>{i.current&&n.pathname!==i.current&&(t==null||t())},[n.pathname,t])}const ys=1e3*60,ac=24*60*60*1e3,Fn=wt(async()=>{const{masto:t}=ce(),n=await t.v1.lists.list();return n.sort((i,s)=>i.title.localeCompare(s.title)),n.length&&setTimeout(()=>{he.account.set("lists",{lists:n,updatedAt:Date.now()})},1),n},{maxAge:ys});async function sn(){try{const{lists:t,updatedAt:n}=he.account.get("lists")||{};return t!=null&&t.length?(Date.now()-n>ac&&Fn(),t):await Fn()}catch{return[]}}const rc=wt(t=>{const{masto:n}=ce();return n.v1.lists.$select(t).fetch()},{maxAge:ys});async function ws(t){const{lists:n}=he.account.get("lists")||{};if(n!=null&&n.length){const i=n.find(s=>s.id===t);if(i)return i}try{return rc(t)}catch{return null}}async function lc(t){const n=await ws(t);return(n==null?void 0:n.title)||""}function dc(t){const{lists:n}=he.account.get("lists")||{};n!=null&&n.length&&(n.push(t),n.sort((i,s)=>i.title.localeCompare(s.title)),he.account.set("lists",{lists:n,updatedAt:Date.now()}))}function uc(t){const{lists:n}=he.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)),he.account.set("lists",{lists:n,updatedAt:Date.now()}))}}function hc(t){const{lists:n}=he.account.get("lists")||{};if(n!=null&&n.length){const i=n.findIndex(s=>s.id===t);i!==-1&&(n.splice(i,1),he.account.set("lists",{lists:n,updatedAt:Date.now()}))}}function ci({list:t,onClose:n}){const{masto:i}=ce(),[s,o]=L("default"),a=!!t,f=j(),d=j(),c=j();X(()=>{a&&(f.current.value=t.title,d.current.value=t.repliesPolicy,c.current&&(c.current.checked=t.exclusive))},[a]);const r=Je("@mastodon/list-exclusive");return e("div",{class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})})," ",e("header",{children:e("h2",{children:a?g._({id:"tuhghE"}):g._({id:"Sb2gYF"})})}),e("main",{children:e("form",{class:"list-form",onSubmit:m=>{m.preventDefault();const h=new FormData(m.target),p=h.get("title"),u=h.get("replies_policy"),v=h.get("exclusive")==="on";o("loading"),(async()=>{try{let b;a?b=await i.v1.lists.$select(t.id).update({title:p,replies_policy:u,exclusive:v}):b=await i.v1.lists.create({title:p,replies_policy:u,exclusive:v}),o("default"),n==null||n({state:"success",list:b}),setTimeout(()=>{a?uc(b):dc(b)},1)}catch{o("error"),alert(a?g._({id:"R7ep1i"}):g._({id:"KPoj8w"}))}})()},children:[e("div",{class:"list-form-row",children:e("label",{for:"list-title",children:[e(l,{id:"6YtxFj"})," ",e("input",{ref:f,type:"text",id:"list-title",name:"title",required:!0,disabled:s==="loading",dir:"auto"})]})}),e("div",{class:"list-form-row",children:e("select",{ref:d,name:"replies_policy",required:!0,disabled:s==="loading",children:[e("option",{value:"list",children:e(l,{id:"ei6pnR"})}),e("option",{value:"followed",children:e(l,{id:"Mr53YX"})}),e("option",{value:"none",children:e(l,{id:"PM7llw"})})]})}),r&&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(l,{id:"jxxYp0"})]})}),e("div",{class:"list-form-footer",children:[e("button",{type:"submit",disabled:s==="loading",children:a?g._({id:"tfDRzk"}):g._({id:"hYgDIe"})}),a&&e(rt,{disabled:s==="loading",align:"end",menuItemClassName:"danger",confirmLabel:g._({id:"+kQ/cY"}),onClick:()=>{o("loading"),(async()=>{try{await i.v1.lists.$select(t.id).remove(),o("default"),n==null||n({state:"deleted"}),setTimeout(()=>{hc(t.id)},1)}catch{o("error"),alert(g._({id:"tqUaGL"}))}})()},children:e("button",{type:"button",class:"light danger",disabled:s==="loading",children:e(l,{id:"Jb6/SB"})})})]})]})})]})}const fc=[60*5,60*30,60*60,60*60*6,60*60*24,60*60*24*3,60*60*24*7,0],zt={0:{id:"9ZP9cc"},300:et(5,"minute"),1800:et(30,"minute"),3600:et(1,"hour"),21600:et(6,"hour"),86400:et(1,"day"),259200:et(3,"day"),604800:et(1,"week")},Ai=80,ks=1e3*60*10;function pc(t,n){return n.v1.accounts.familiarFollowers.fetch({id:[t]})}const mc=wt(pc,{maxAge:ks});async function gc(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 bc=wt(gc,{maxAge:ks});function _s({account:t,fetchAccount:n=()=>{},standalone:i,instance:s,authenticated:o}){const{i18n:a}=Xe(),{masto:f}=ce({instance:s}),{masto:d,instance:c}=ce(),[r,m]=L("default"),h=typeof t=="string",[p,u]=L(h?null:t),v=be(()=>s===c,[s,c]);X(()=>{if(!h){u(t);return}m("loading"),(async()=>{try{const Q=await n();A.accounts[`${Q.id}@${s}`]=Q,u(Q),m("default")}catch{u(null),m("error")}})()},[h,t,n]);const{acct:b,avatar:w,avatarStatic:k,bot:y,createdAt:C,displayName:_,emojis:T,fields:I,followersCount:x,followingCount:z,group:D,id:M,lastStatusAt:G,locked:se,note:Z,statusesCount:P,url:N,username:U,memorial:Y,moved:F,roles:ie,hideCollections:O}=p||{};let ne=!1,{header:ye,headerStatic:ee}=p||{};(!ye||/missing\.png$/.test(ye))&&w&&!/missing\.png$/.test(w)&&(ye=w,ne=!0,k&&!/missing\.png$/.test(k)&&(ee=k));const fe=be(()=>M===bt(),[M]);X(()=>{const Q=!!(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(fe&&s&&Q){const Re=he.local.getJSON("accounts");let Ne=!1;Re.forEach(R=>{R.info.id===p.id&&R.instanceURL===s&&(R.info=p,Ne=!0)}),Ne&&he.local.setJSON("accounts",Re)}},[fe,p,s]);const ve=be(()=>N?Gt.toUnicode(URL.parse(N).hostname):null,[N]),[pe,we]=L([]),$e=j(),Me=j([]);async function xe(Q){var V;(Q||!$e.current)&&($e.current=f.v1.accounts.$select(M).followers.list({limit:Ai}));const Re=await $e.current.next();if(fe||!v)return Re;const{value:Ne}=Re;let R=[];if(Q){let oe=[];try{oe=await f.v1.accounts.familiarFollowers.fetch({id:[M]})}catch{}Me.current=((V=oe==null?void 0:oe[0])==null?void 0:V.accounts)||[],R=[...Me.current,...Ne.filter(H=>!Me.current.some(te=>te.id===H.id))]}else Ne!=null&&Ne.length&&(R=Ne.filter(oe=>!Me.current.some(H=>H.id===oe.id)));return{...Re,value:R}}const Ee=j();async function Fe(Q){return(Q||!Ee.current)&&(Ee.current=f.v1.accounts.$select(M).following.list({limit:Ai})),await Ee.current.next()}const ke=i?"div":ue,J=s?`/${s}/a/${M}`:`/a/${M}`,[me,Te]=L([]),[re,W]=L(),[$,E]=L("default"),B=!!(re!=null&&re.total),K=async Q=>{try{const Re=await mc(Q,d);Te(Re[0].accounts.slice(0,vc))}catch{}},le=async()=>{if(M){E("loading");try{const Q=await bc(M,f);W(Q),E("default")}catch{E("error")}}},Ce=it(({relationship:Q,currentID:Re})=>{Q.following||(K(Re),!i&&P>0&&le())},[i,M,P]),We=it(Q=>{Q.id===M&&(u(Q),A.accounts[`${Q.id}@${s}`]=Q)},[M,s]);return e("div",{tabIndex:"-1",class:`account-container ${r==="loading"?"skeleton":""}`,style:{"--header-color-1":pe[0],"--header-color-2":pe[1],"--header-color-3":pe[2],"--header-color-4":pe[3]},children:[r==="error"&&e("div",{class:"ui-state",children:[e("p",{children:e(l,{id:"44hICK"})}),e("p",{children:e("a",{href:h?t:N,target:"_blank",rel:"noopener noreferrer",children:[e(l,{id:"Aadw0+"})," ",e(S,{icon:"external"})]})})]}),r==="loading"?e(q,{children:[e("header",{children:e(at,{avatarSize:"xxxl",skeleton:!0})}),e("main",{children:[e("div",{class:"note",children:[e("p",{children:"โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆโ–ˆ"}),e("p",{children:"โ–ˆโ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆ"})]}),e("div",{class:"account-metadata-box",children:[e("div",{class:"profile-metadata",children:[e("div",{class:"profile-field",children:[e("b",{class:"more-insignificant",children:"โ–ˆโ–ˆโ–ˆ"}),e("p",{children:"โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ"})]}),e("div",{class:"profile-field",children:[e("b",{class:"more-insignificant",children:"โ–ˆโ–ˆโ–ˆโ–ˆ"}),e("p",{children:"โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ"})]})]}),e("div",{class:"stats",children:[e("div",{children:[e("span",{children:"โ–ˆโ–ˆ"})," ",e(l,{id:"x5LEuB"})]}),e("div",{children:[e("span",{children:"โ–ˆโ–ˆ"})," ",e(l,{id:"y6sq5j"})]}),e("div",{children:[e("span",{children:"โ–ˆโ–ˆ"})," ",e(l,{id:"+owNNn"})]})]})]}),e("div",{class:"actions",children:[e("span",{}),e("span",{class:"buttons",children:e("button",{type:"button",class:"plain",disabled:!0,children:e(S,{icon:"more",size:"l",alt:a._({id:"2FYpfJ"})})})})]})]})]}):p&&e(q,{children:[!!F&&e("div",{class:"account-moved",children:[e("p",{children:e(l,{id:"C6cVP/",values:{displayName:_},components:{0:e("b",{})}})}),e(at,{account:F,instance:s,onClick:Q=>{Q.stopPropagation(),A.showAccount=F}})]}),!!ye&&!/missing\.png$/.test(ye)&&e("img",{src:ye,alt:"",class:`header-banner ${ne?"header-is-avatar":""}`,onError:Q=>{Q.target.crossOrigin?Q.target.src!==ee?Q.target.src=ee:(Q.target.removeAttribute("crossorigin"),Q.target.src=ye):Q.target.src!==ee?Q.target.src=ee:Q.target.remove()},crossOrigin:"anonymous",onLoad:Q=>{Q.target.classList.add("loaded");try{const Re=window.OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"),Ne=Re.getContext("2d",{willReadFrequently:!0});Re.width=Q.target.width,Re.height=Q.target.height,Ne.imageSmoothingEnabled=!1,Ne.drawImage(Q.target,0,0);const R=10,oe=[Ne.getImageData(0,0,R,R).data,Ne.getImageData(Q.target.width-R,0,R,R).data,Ne.getImageData(0,Q.target.height-R,R,R).data,Ne.getImageData(Q.target.width-R,Q.target.height-R,R,R).data].map(H=>{let te=0,Ae=0,Se=0,_e=0;for(let ae=0;ae{const[te,Ae,Se,_e]=wc(H);return`rgba(${te}, ${Ae}, ${Se}, ${_e})`});we(oe)}catch{}}}),e("header",{children:i?e(ot,{shift:window.matchMedia("(min-width: calc(40em))").matches?114:64,menuButton:e("div",{children:e(at,{account:p,instance:s,avatarSize:"xxxl",onClick:()=>{}})}),children:[e("div",{class:"szh-menu__header",children:e(xc,{acct:b,instance:s})}),e(ge,{onClick:()=>{const Q=b.includes("@")?`@${b}`:`@${b}@${s}`;try{navigator.clipboard.writeText(Q),de(a._({id:"zJoEwS"}))}catch{de(a._({id:"BC0lSD"}))}},children:[e(S,{icon:"link"}),e("span",{children:e(l,{id:"27x6gl"})})]}),e(ge,{href:N,target:"_blank",children:[e(S,{icon:"external"}),e("span",{children:e(l,{id:"Bz5hLl"})})]}),e(Ye,{}),e(Oe,{href:p.avatar,target:"_blank",children:[e(S,{icon:"user"}),e("span",{children:e(l,{id:"7WYl2I"})})]}),e(Oe,{href:p.header,target:"_blank",children:[e(S,{icon:"media"}),e("span",{children:e(l,{id:"ZNme5R"})})]})]}):e(at,{account:p,instance:s,avatarSize:"xxxl",internal:!0})}),e("div",{class:"faux-header-bg","aria-hidden":"true"}),e("main",{children:[!!Y&&e("span",{class:"tag",children:e(l,{id:"prdIOK"})}),!!y&&e("span",{class:"tag",children:[e(S,{icon:"bot"})," ",e(l,{id:"9Vdq+j"})]}),!!D&&e("span",{class:"tag",children:[e(S,{icon:"group"})," ",e(l,{id:"L8fEEm"})]}),ie==null?void 0:ie.map(Q=>e("span",{class:"tag",children:[Q.name,!!ve&&e(q,{children:[" ",e("span",{class:"more-insignificant",children:ve})]})]})),e("div",{class:"note",dir:"auto",onClick:ns({instance:c}),dangerouslySetInnerHTML:{__html:Nn(Z,{emojis:T})}}),e("div",{class:"account-metadata-box",children:[(I==null?void 0:I.length)>0&&e("div",{class:"profile-metadata",children:I.map(({name:Q,value:Re,verifiedAt:Ne},R)=>e("div",{class:`profile-field ${Ne?"profile-verified":""}`,dir:"auto",children:[e("b",{children:[e(is,{text:Q,emojis:T})," ",!!Ne&&e(S,{icon:"check-circle",size:"s",alt:a._({id:"QDEWii"})})]}),e("p",{dangerouslySetInnerHTML:{__html:Nn(Re,{emojis:T})}})]},Q+R))}),e("div",{class:"stats",children:[e(ke,{tabIndex:0,to:J,onClick:()=>{setTimeout(()=>{A.showGenericAccounts={id:"followers",heading:a._({id:"x5LEuB"}),fetchAccounts:xe,instance:s,excludeRelationshipAttrs:fe?["followedBy"]:[],blankCopy:O?a._({id:"BRV/wh"}):void 0}},0)},children:[!!me.length&&e("span",{class:"shazam-container-horizontal",children:e("span",{class:"shazam-container-inner stats-avatars-bunch",children:me.map(Q=>e(lt,{url:Q.avatarStatic,size:"s",alt:`${Q.displayName} @${Q.acct}`,squircle:Q==null?void 0:Q.bot}))})}),e("span",{title:x,children:Ve(x)})," ",e(l,{id:"x5LEuB"})]}),e(ke,{class:"insignificant",tabIndex:0,to:J,onClick:()=>{setTimeout(()=>{A.showGenericAccounts={heading:a._({id:"y6sq5j"}),fetchAccounts:Fe,instance:s,excludeRelationshipAttrs:fe?["following"]:[],blankCopy:O?a._({id:"BRV/wh"}):void 0}},0)},children:[e("span",{title:z,children:Ve(z)})," ",e(l,{id:"y6sq5j"}),e("br",{})]}),e(ke,{class:"insignificant",to:J,children:[e("span",{title:P,children:Ve(P)})," ",e(l,{id:"+owNNn"})]}),!!C&&e("div",{class:"insignificant",children:e(l,{id:"PCcEFZ",values:{0:pt(C,{hideTime:!0})},components:{0:e("time",{datetime:C})}})})]})]}),!!re&&e(ke,{to:J,class:"account-metadata-box",children:e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:B?e("div",{class:"posting-stats",title:a._({id:"wiuWLe",values:{0:(re.originals/re.total).toLocaleString(a.locale||void 0,{style:"percent"}),1:(re.replies/re.total).toLocaleString(a.locale||void 0,{style:"percent"}),2:(re.boosts/re.total).toLocaleString(a.locale||void 0,{style:"percent"})}}),children:[e("div",{children:re.daysSinceLastPost<365?a._({id:"oZUtTk",values:{0:re.total,1:re.daysSinceLastPost,2:re.daysSinceLastPost,3:re.daysSinceLastPost,4:re.total,5:re.total,6:re.daysSinceLastPost}}):a._({id:"JvA7Mo",values:{0:re.total,1:re.total}})}),e("div",{class:"posting-stats-bar",style:{"--originals-percentage":`${re.originals/re.total*100}%`,"--replies-percentage":`${(re.originals+re.replies)/re.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(l,{id:"HxF6Fk"})]})," ",e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-legend-item-replies"})," ",e(l,{id:"N8UzTV"})]})," ",e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-legend-item-boosts"})," ",e(l,{id:"puY2t0"})]})]})]}):e("div",{class:"posting-stats",children:e(l,{id:"vl3XTJ"})})})})}),!F&&e("div",{class:"account-metadata-box",children:e("div",{class:"shazam-container no-animation",hidden:!!re,children:e("div",{class:"shazam-container-inner",children:e("button",{type:"button",class:"posting-stats-button",disabled:$==="loading",onClick:()=>{le()},children:[e("div",{class:`posting-stats-bar posting-stats-icon ${$==="loading"?"loading":""}`,style:{"--originals-percentage":"33%","--replies-percentage":"66%"}}),e(l,{id:"PjP87f"})," "]})})})})]}),e("footer",{children:e(yc,{info:p,instance:s,standalone:i,authenticated:o,onRelationshipChange:Ce,onProfileUpdate:We})})]})]})}const vc=3;function yc({info:t,instance:n,standalone:i,authenticated:s,onRelationshipChange:o=()=>{},onProfileUpdate:a=()=>{}}){var re;if(!t)return null;const{_:f}=Xe(),{masto:d,instance:c,authenticated:r}=ce(),m=n===c,[h,p]=L("default"),[u,v]=L(null),{id:b,acct:w,url:k,username:y,locked:C,lastStatusAt:_,note:T,fields:I,moved:x}=t,z=j(b),{following:D,showingReblogs:M,notifying:G,followedBy:se,blocking:Z,blockedBy:P,muting:N,mutingNotifications:U,requested:Y,domainBlocking:F,endorsed:ie,note:O}=u||{},[ne,ye]=L(null),[ee,fe]=L(!1),ve=w.includes("@")?w:`${w}@${n}`;X(()=>{if(t){const W=bt();let $;(async()=>{if(m&&s)$=b;else if(!m&&r){const B=t.acct.includes("@");try{const K=await d.v2.search.fetch({q:B?t.acct:`${t.username}@${n}`,type:"accounts",limit:1,resolve:!0});K.accounts.length&&($=K.accounts[0].id,ye(K.accounts[0]))}catch{}}if(!$)return;if(W===$){fe(!0);return}z.current=$,p("loading");const E=d.v1.accounts.relationships.fetch({id:[$]});try{const B=await E;if(p("default"),B.length){const K=B[0];v(K),o({relationship:K,currentID:$})}}catch{p("error")}})()}},[t,s]),X(()=>{t&&ee&&Ks(t)},[t,ee]);const pe=h==="loading",[we,$e]=L(!1),[Me,xe]=L(!1),[Ee,Fe]=L(!1),[ke,J]=L(!1),[me,Te]=L([]);return e(q,{children:[e("div",{class:"actions",children:[e("span",{children:[se?e("span",{class:"tag",children:e(l,{id:"p3UO/y"})}):_?e("small",{class:"insignificant",children:e(l,{id:"F3cM1G",values:{0:pt(_,{hideTime:!0})},components:{0:e("span",{class:"ib"})}})}):e("span",{}),N&&e("span",{class:"tag danger",children:e(l,{id:"+IJm1Z"})}),Z&&e("span",{class:"tag danger",children:e(l,{id:"32TndD"})})]})," ",e("span",{class:"buttons",children:[!!O&&e("button",{type:"button",class:"private-note-tag",title:g._({id:"zxFxcH"}),onClick:()=>{Fe(!0)},dir:"auto",children:e("span",{children:O})}),e(ot,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:e("button",{type:"button",class:"plain",disabled:pe,children:e(S,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),onMenuChange:W=>{D&&W.open&&(async()=>{try{const $=await d.v1.accounts.$select(z.current).lists.list();Te($)}catch{}})()},children:[r&&!ee&&e(q,{children:[e(ge,{onClick:()=>{fo({draftStatus:{status:`@${(ne==null?void 0:ne.acct)||w} `}})},children:[e(S,{icon:"at"}),e("span",{children:e(l,{id:"3LkfZu",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]}),e(ge,{onClick:()=>{$e(!0)},children:[e(S,{icon:"translate"}),e("span",{children:e(l,{id:"R8mSiS"})})]}),Je("@mastodon/profile-private-note")&&e(ge,{onClick:()=>{Fe(!0)},children:[e(S,{icon:"pencil"}),e("span",{children:O?g._({id:"U+Gokq"}):g._({id:"VcQzRi"})})]}),D&&!!u&&e(q,{children:[e(ge,{onClick:()=>{p("loading"),(async()=>{try{const W=await d.v1.accounts.$select(z.current).follow({notify:!G});W&&v(W),p("default"),de(W.notifying?g._({id:"jL3N0G",values:{username:y}}):g._({id:"WBugD/",values:{username:y}}))}catch(W){alert(W),p("error")}})()},children:[e(S,{icon:"notification"}),e("span",{children:G?g._({id:"osJmEN"}):g._({id:"I92Z+b"})})]}),e(ge,{onClick:()=>{p("loading"),(async()=>{try{const W=await d.v1.accounts.$select(z.current).follow({reblogs:!M});W&&v(W),p("default"),de(W.showingReblogs?g._({id:"0X2KC8",values:{username:y}}):g._({id:"cXWjH0",values:{username:y}}))}catch(W){alert(W),p("error")}})()},children:[e(S,{icon:"rocket"}),e("span",{children:M?g._({id:"GRUr8d"}):g._({id:"uREpT3"})})]})]}),D&&e(ge,{onClick:()=>{xe(!0)},children:[e(S,{icon:"list"}),me.length?e(q,{children:[e("small",{class:"menu-grow",children:[e(l,{id:"sJ2yQc"}),e("br",{}),e("span",{class:"more-insignificant",children:me.map(W=>W.title).join(", ")})]}),e("small",{class:"more-insignificant",children:me.length})]}):e("span",{children:e(l,{id:"sJ2yQc"})})]}),e(Ye,{})]}),e(ge,{onClick:()=>{const W=`@${(ne==null?void 0:ne.acct)||ve}`;try{navigator.clipboard.writeText(W),de(g._({id:"zJoEwS"}))}catch{de(g._({id:"BC0lSD"}))}},children:[e(S,{icon:"copy"}),e("small",{children:[e(l,{id:"27x6gl"}),e("br",{}),e("span",{class:"more-insignificant bidi-isolate",children:["@",(ne==null?void 0:ne.acct)||ve]})]})]}),e(ge,{href:k,target:"_blank",children:[e(S,{icon:"external"}),e("small",{class:"menu-double-lines",children:kc(k)})]}),e("div",{class:"menu-horizontal",children:[e(ge,{onClick:()=>{try{navigator.clipboard.writeText(k),de(g._({id:"edWbV6"}))}catch{de(g._({id:"W1ewR0"}))}},children:[e(S,{icon:"link"}),e("span",{children:e(l,{id:"he3ygx"})})]}),(navigator==null?void 0:navigator.share)&&((re=navigator==null?void 0:navigator.canShare)==null?void 0:re.call(navigator,{url:k}))&&e(ge,{onClick:()=>{try{navigator.share({url:k})}catch{alert(g._({id:"TtG3Uh"}))}},children:[e(S,{icon:"share"}),e("span",{children:e(l,{id:"LFKLqp"})})]})]}),!!u&&e(q,{children:[e(Ye,{}),N?e(ge,{onClick:()=>{p("loading"),(async()=>{try{const W=await d.v1.accounts.$select((ne==null?void 0:ne.id)||b).unmute();v(W),p("default"),de(g._({id:"B4Xkly",values:{username:y}})),A.reloadGenericAccounts.id="mute",A.reloadGenericAccounts.counter++}catch{p("error")}})()},children:[e(S,{icon:"unmute"}),e("span",{children:e(l,{id:"Q/HUhC",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]}):e(bn,{menuClassName:"menu-blur",openTrigger:"clickOnly",direction:"bottom",overflow:"auto",shift:16,label:e(q,{children:[e(S,{icon:"mute"}),e("span",{class:"menu-grow",children:e(l,{id:"xhPEH3",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})}),e("span",{style:{textOverflow:"clip"},children:[e(S,{icon:"time"}),e(S,{icon:"chevron-right"})]})]}),children:e("div",{class:"menu-wrap",children:fc.map(W=>e(ge,{onClick:()=>{p("loading"),(async()=>{try{const $=await d.v1.accounts.$select((ne==null?void 0:ne.id)||b).mute({duration:W});v($),p("default"),de(g._({id:"/plB9m",values:{0:typeof zt[W]=="function"?zt[W]():f(zt[W]),username:y}})),A.reloadGenericAccounts.id="mute",A.reloadGenericAccounts.counter++}catch{p("error"),de(g._({id:"vWGBjT",values:{username:y}}))}})()},children:typeof zt[W]=="function"?zt[W]():f(zt[W])}))})}),se&&e(rt,{subMenu:!0,menuItemClassName:"danger",confirmLabel:e(q,{children:[e(S,{icon:"user-x"}),e("span",{children:e(l,{id:"unyq2W",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]}),onClick:()=>{p("loading"),(async()=>{try{const W=await d.v1.accounts.$select((ne==null?void 0:ne.id)||b).removeFromFollowers();v(W),p("default"),de(g._({id:"AgkcM/",values:{username:y}})),A.reloadGenericAccounts.id="followers",A.reloadGenericAccounts.counter++}catch{p("error")}})()},children:[e(S,{icon:"user-x"}),e("span",{children:e(l,{id:"VCZ0OT"})})]}),e(rt,{subMenu:!0,confirm:!Z,confirmLabel:e(q,{children:[e(S,{icon:"block"}),e("span",{children:e(l,{id:"aforS9",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]}),menuItemClassName:"danger",onClick:()=>{p("loading"),(async()=>{try{if(Z){const W=await d.v1.accounts.$select((ne==null?void 0:ne.id)||b).unblock();v(W),p("default"),de(g._({id:"sI9N29",values:{username:y}}))}else{const W=await d.v1.accounts.$select((ne==null?void 0:ne.id)||b).block();v(W),p("default"),de(g._({id:"uYcYzu",values:{username:y}}))}A.reloadGenericAccounts.id="block",A.reloadGenericAccounts.counter++}catch{p("error"),Z?de(g._({id:"0tG4wG",values:{username:y}})):de(g._({id:"pA+qEx",values:{username:y}}))}})()},children:Z?e(q,{children:[e(S,{icon:"unblock"}),e("span",{children:e(l,{id:"/3LJfX",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]}):e(q,{children:[e(S,{icon:"block"}),e("span",{children:e(l,{id:"JRswkR",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]})}),e(ge,{className:"danger",onClick:()=>{A.showReportModal={account:ne||t}},children:[e(S,{icon:"flag"}),e("span",{children:e(l,{id:"qTJgpR",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]})]}),r&&ee&&i&&Je("@mastodon/profile-edit")&&e(q,{children:[e(Ye,{}),e(ge,{onClick:()=>{J(!0)},children:[e(S,{icon:"pencil"}),e("span",{children:e(l,{id:"9OpVZg"})})]})]}),!1]}),!u&&h==="loading"&&e(Le,{abrupt:!0}),!!u&&!x&&e(rt,{confirm:D||Y,confirmLabel:e("span",{children:Y?g._({id:"e7qQIH"}):g._({id:"eYsAQr",values:{0:t.acct||t.username}})}),menuItemClassName:"danger",align:"end",disabled:pe,onClick:()=>{p("loading"),(async()=>{try{let W;D||Y?W=await d.v1.accounts.$select(z.current).unfollow():W=await d.v1.accounts.$select(z.current).follow(),W&&v(W),p("default")}catch(W){alert(W),p("error")}})()},children:e("button",{type:"button",class:`${D||Y?"light swap":""}`,"data-swap-state":D||Y?"danger":"",disabled:pe,children:D?e(q,{children:[e("span",{children:e(l,{id:"y6sq5j"})}),e("span",{children:e(l,{id:"HKrBPX"})})]}):Y?e(q,{children:[e("span",{children:e(l,{id:"Yx0Ud8"})}),e("span",{children:e(l,{id:"yTVtKs"})})]}):C?e(q,{children:[e(S,{icon:"lock"})," ",e("span",{children:e(l,{id:"MKEPCY"})})]}):g._({id:"MKEPCY"})})})]})]}),!!we&&e(ze,{onClose:()=>{$e(!1)},children:e(_c,{note:T,fields:I,onClose:()=>$e(!1)})}),!!Me&&e(ze,{onClose:()=>{xe(!1)},children:e(Sc,{accountID:z.current,onClose:()=>xe(!1)})}),!!Ee&&e(ze,{onClose:()=>{Fe(!1)},children:e(Cc,{account:t,note:O,onRelationshipChange:W=>{v(W)},onClose:()=>Fe(!1)})}),!!ke&&e(ze,{onClose:()=>{J(!1)},children:e(Ic,{onClose:({state:W,account:$}={})=>{J(!1),W==="success"&&$&&a($)}})})]})}function wc([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 kc(t){if(!t)return;const n=URL.parse(t),{host:i,pathname:s}=n,o=s.replace(/\/$/,"").replace(/^\//,"");return e(q,{children:[e("span",{class:"more-insignificant",children:[Gt.toUnicode(i),"/"]}),e("wbr",{}),e("span",{children:o})]})}function _c({note:t,fields:n,onClose:i}){const s=(n==null?void 0:n.map(({name:a,value:f})=>`${a} ${vi(f)}`).join(` `))||"",o=vi(t)+(s?` ${s}`:"");return e("div",{class:"sheet",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(l,{id:"9groMz"})})}),e("main",{children:[e("p",{style:{whiteSpace:"pre-wrap"},children:o}),e(ss,{forceTranslate:!0,text:o})]})]})}function Sc({accountID:t,onClose:n}){const{masto:i}=ce(),[s,o]=L("default"),[a,f]=L([]),[d,c]=L([]),[r,m]=$t(u=>u+1,0);X(()=>{o("loading"),(async()=>{try{const u=await sn();f(u);const v=await i.v1.accounts.$select(t).lists.list();c(v),o("default")}catch{o("error")}})()},[r]);const[h,p]=L(!1);return e("div",{class:"sheet",id:"list-add-remove-container",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(l,{id:"sJ2yQc"})})}),e("main",{children:[a.length>0?e("ul",{class:"list-add-remove",children:a.map(u=>{const v=d.some(b=>b.id===u.id);return e("li",{children:e("button",{type:"button",class:`light ${v?"checked":""}`,disabled:s==="loading",onClick:()=>{o("loading"),(async()=>{try{v?await i.v1.lists.$select(u.id).accounts.remove({accountIds:[t]}):await i.v1.lists.$select(u.id).accounts.create({accountIds:[t]}),m()}catch{o("error"),alert(v?g._({id:"7KnEYa"}):g._({id:"Tba8uO"}))}})()},children:[e(S,{icon:"check-circle",alt:"โ˜‘๏ธ"}),e("span",{children:u.title})]})})})}):s==="loading"?e("p",{class:"ui-state",children:e(Le,{abrupt:!0})}):s==="error"?e("p",{class:"ui-state",children:e(l,{id:"v/l5uA"})}):e("p",{class:"ui-state",children:e(l,{id:"/MJ7gZ"})}),e("button",{type:"button",class:"plain2",onClick:()=>p(!0),disabled:s!=="default",children:[e(S,{icon:"plus",size:"l"})," ",e("span",{children:e(l,{id:"Sb2gYF"})})]})]}),h&&e(ze,{onClick:u=>{u.target===u.currentTarget&&p(!1)},children:e(ci,{list:h==null?void 0:h.list,onClose:u=>{u.state==="success"&&m(),p(!1)}})})]})}function Cc({account:t,note:n,onRelationshipChange:i=()=>{},onClose:s=()=>{}}){const{masto:o}=ce(),[a,f]=L("default"),d=j(null);return X(()=>{let c;return d.current&&!n&&(c=setTimeout(()=>{var r,m;(m=(r=d.current).focus)==null||m.call(r)},100)),()=>{clearTimeout(c)}},[]),e("div",{class:"sheet",id:"private-note-container",children:[!!s&&e("button",{type:"button",class:"sheet-close",onClick:s,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(l,{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())&&(f("loading"),(async()=>{try{const h=await o.v1.accounts.$select(t==null?void 0:t.id).note.create({comment:m});f("default"),i(h),s()}catch(h){f("error"),alert((h==null?void 0:h.message)||g._({id:"ot8LpF"}))}})())},children:[e("textarea",{ref:d,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(l,{id:"dEgA5A"})}),e("span",{children:[e(Le,{abrupt:!0,hidden:a!=="loading"}),e("button",{disabled:a==="loading",type:"submit",children:e(l,{id:"SrwrEj"})})]})]})]})})]})}function Ic({onClose:t=()=>{}}){const{masto:n}=ce(),[i,s]=L("loading"),[o,a]=L(null);X(()=>{(async()=>{try{const h=await n.v1.accounts.verifyCredentials();a(h),s("default")}catch{s("error")}})()},[]);const{displayName:f,source:d}=o||{},{note:c,fields:r}=d||{},m=j(null);return e("div",{class:"sheet",id:"edit-profile-container",children:[!!t&&e("button",{type:"button",class:"sheet-close",onClick:t,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(l,{id:"9OpVZg"})})}),e("main",{children:i==="loading"?e("p",{class:"ui-state",children:e(Le,{abrupt:!0})}):e("form",{onSubmit:h=>{h.preventDefault();const p=new FormData(h.target),u=p.get("display_name"),v=p.get("note"),b=m.current.querySelectorAll('input[name^="fields_attributes"]'),w=[];b.forEach(k=>{const y=k.name,[C,_,T]=y.match(/fields_attributes\[(\d+)\]\[(.+)\]/)||[],I=k.value?k.value.trim():"";_&&T&&I&&(w[_]||(w[_]={}),w[_][T]=I)}),w.forEach(k=>{k.name&&!k.value&&(k.value="")}),(async()=>{try{const k=await n.v1.accounts.updateCredentials({displayName:u,note:v,fieldsAttributes:w});t==null||t({state:"success",account:k})}catch(k){alert((k==null?void 0:k.message)||g._({id:"FwMMx0"}))}})()},children:[e("p",{children:e("label",{children:["Name"," ",e("input",{type:"text",name:"display_name",defaultValue:f,maxLength:30,disabled:i==="loading",dir:"auto"})]})}),e("p",{children:e("label",{children:[e(l,{id:"E+oKCO"}),e("textarea",{defaultValue:c,name:"note",maxLength:500,rows:"5",disabled:i==="loading",dir:"auto"})]})}),e("p",{children:e(l,{id:"T4I119"})}),e("table",{ref:m,children:[e("thead",{children:e("tr",{children:[e("th",{children:e(l,{id:"87a/t/"})}),e("th",{children:e(l,{id:"4b3oEV"})})]})}),e("tbody",{children:Array.from({length:Math.max(4,r.length)}).map((h,p)=>{const{name:u="",value:v=""}=r[p]||{};return e(Tc,{name:u,value:v,index:p,disabled:i==="loading"},p)})})]}),e("footer",{children:[e("button",{type:"button",class:"light",disabled:i==="loading",onClick:()=>{t==null||t()},children:e(l,{id:"dEgA5A"})}),e("button",{type:"submit",disabled:i==="loading",children:e(l,{id:"tfDRzk"})})]})]})})]})}function Tc({name:t,value:n,disabled:i,index:s}){const[o,a]=L(!!n);return e("tr",{children:[e("td",{children:e("input",{type:"text",name:`fields_attributes[${s}][name]`,defaultValue:t,disabled:i,maxLength:255,required:o,dir:"auto"})}),e("td",{children:e("input",{type:"text",name:`fields_attributes[${s}][value]`,defaultValue:n,disabled:i,maxLength:255,onChange:f=>a(!!f.currentTarget.value),dir:"auto"})})]})}function xc({acct:t,instance:n}){let[i,s]=t.split("@");return s||(s=n),e("div",{class:"handle-info",children:[e("span",{class:"handle-handle",children:[e("b",{class:"handle-username",children:i}),e("span",{class:"handle-at",children:"@"}),e("b",{class:"handle-server",children:s})]}),e("div",{class:"handle-legend",children:[e("span",{class:"ib",children:[e("span",{class:"handle-legend-icon username"})," ",e(l,{id:"silO9A"})]})," ",e("span",{class:"ib",children:[e("span",{class:"handle-legend-icon server"})," ",e(l,{id:"rZgCpJ"})]})]})]})}function Ac({account:t,instance:n,onClose:i}){const{masto:s,instance:o,authenticated:a}=ce({instance:n}),f=typeof t=="string";return X(()=>{f||(A.accounts[`${t.id}@${o}`]=t)},[t]),vs(i),e("div",{class:"sheet",children:[!!i&&e("button",{type:"button",class:"sheet-close outer",onClick:i,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e(_s,{instance:o,authenticated:a,account:t,fetchAccount:async()=>{if(f)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 r=URL.parse(t),{hostname:m,pathname:h}=r,p=h.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 Ec({onClose:t}){const{masto:n}=ce(),[i,s]=L("default"),[o,a]=L([]),[f,d]=$t(r=>r+1,0);X(()=>{s("loading"),(async()=>{try{const r=await dt.drafts.keys();if(r.length){const m=gn(),h=r.filter(p=>p.startsWith(m));if(h.length){const p=await dt.drafts.getMany(h);p.sort((u,v)=>new Date(v.updatedAt).getTime()-new Date(u.updatedAt).getTime()),a(p)}else a([])}else a([]);s("default")}catch{s("error")}})()},[f]);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(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:[e("h2",{children:[e(l,{id:"krk5ws"})," ",e(Le,{abrupt:!0,hidden:i!=="loading"})]}),c&&e("div",{class:"insignificant",children:e(l,{id:"Ap/10+"})})]}),e("main",{children:c?e(q,{children:[e("ul",{class:"drafts-list",children:o.map(r=>{const{updatedAt:m,key:h,draftStatus:p,replyTo:u}=r,v=new Date(m);return e("li",{children:[e("div",{class:"mini-draft-meta",children:[e("b",{children:[e(S,{icon:u?"reply":"quill",size:"s"})," ",e("time",{children:[!!u&&e(q,{children:[e("span",{class:"bidi-isolate",children:["@",u.account.acct]}),e("br",{})]}),pt(v)]})]}),e(rt,{confirmLabel:e("span",{children:e(l,{id:"/W5yFF"})}),menuItemClassName:"danger",align:"end",disabled:i==="loading",onClick:()=>{(async()=>{try{await dt.drafts.del(h),d()}catch{alert(g._({id:"rEYoku"}))}})()},children:e("button",{type:"button",class:"small light",disabled:i==="loading",children:e(l,{id:"Jb6/SB"})})})]}),e("button",{type:"button",disabled:i==="loading",class:"draft-item",onClick:async()=>{let b;if(u){s("loading");try{b=await n.v1.statuses.$select(u.id).fetch()}catch{alert(g._({id:"tMwimH"})),s("default");return}s("default")}window.__COMPOSE__={draftStatus:p,replyToStatus:b},A.showCompose=!0,A.showDrafts=!1},children:e(Rc,{draft:r})})]},m)})}),o.length>1&&e("p",{children:e(rt,{confirmLabel:e("span",{children:e(l,{id:"3IakFR"})}),menuItemClassName:"danger",disabled:i==="loading",onClick:()=>{(async()=>{s("loading");try{await dt.drafts.delMany(o.map(r=>r.key)),s("default"),d()}catch{alert(g._({id:"0J4sZq"})),s("error")}})()},children:e("button",{type:"button",class:"light danger",disabled:i==="loading",children:e(l,{id:"hOg+Mt"})})})})]}):e("p",{children:e(l,{id:"8iQ+jk"})})})]})}function Rc({draft:t}){var h;const{draftStatus:n,replyTo:i}=t,{status:s,spoilerText:o,poll:a,mediaAttachments:f}=n,d=((h=a==null?void 0:a.options)==null?void 0:h.length)>0,c=(f==null?void 0:f.length)>0,r=d||c,m=be(()=>{if(!c)return;const p=f.find(b=>/image/.test(b.type));if(!p)return;const{file:u}=p;return URL.createObjectURL(u)},[c,f]);return e(q,{children:e("div",{class:"mini-draft",children:[r&&e("div",{class:`mini-draft-aside ${m?"has-image":""}`,style:m?{"--bg-image":`url(${m})`}:{},children:[d&&e(S,{icon:"poll",alt:g._({id:"4WUbF1"})}),c&&e("span",{children:[e(S,{icon:"attachment",alt:g._({id:"xYilR2"})})," ",e("small",{children:f==null?void 0:f.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 Lc({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(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),n&&e("a",{href:n,target:"_blank",rel:"noopener noreferrer",class:"button plain",children:[e("span",{children:e(l,{id:"4/RpOy"})})," ",e(S,{icon:"external"})]})]}),e("div",{class:"embed-content",dangerouslySetInnerHTML:{__html:t},style:{"--width":i+"px","--height":s+"px","--aspect-ratio":`${i}/${s}`}})]})}function $c({instance:t,excludeRelationshipAttrs:n=[],postID:i,onClose:s=()=>{},blankCopy:o=g._({id:"10OlfF"})}){const{masto:a,instance:f}=ce(),d=t?t===f:!0,c=Be(A),[r,m]=L("default"),[h,p]=L([]),[u,v]=L(!1);if(vs(s),!c.showGenericAccounts)return null;const{id:b,heading:w,fetchAccounts:k,accounts:y,showReactions:C}=c.showGenericAccounts,[_,T]=L({}),I=async M=>{if(!(M!=null&&M.length)||!d)return;const G=await Kn(M,_);G&&T({..._,...G})},x=M=>{k&&(M&&p([]),m("loading"),(async()=>{try{const{done:G,value:se}=await k(M);if(Array.isArray(se)){if(M){const Z=[];for(let P=0;PY.id===N.id&&P!==F);U?U._types.push(...N._types):Z.push({_types:[],...N})}p(Z)}else p(Z=>{const P=Z;for(const N of se){const U=P.find(Y=>Y.id===N.id);U?U._types.push(...N._types):P.push(N)}return P});v(!G),I(se)}else v(!1);m("default")}catch{m("error")}})())},z=j(!0);X(()=>{(y==null?void 0:y.length)>0?(p(y),I(y)):(x(!0),z.current=!1)},[y,k]),X(()=>{var M;z.current||((M=c.reloadGenericAccounts)==null?void 0:M.id)===b&&x(!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(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:w||g._({id:"bPwFdf"})})}),e("main",{children:[D&&e(ue,{to:`/${t||f}/s/${D.id}`,class:"post-preview",children:e(qe,{status:D,size:"s",readOnly:!0})}),h.length>0?e(q,{children:[e("ul",{class:"accounts-list",children:h.map(M=>{var Z,P;const G=_[M.id],se=`${M.id}-${((Z=M._types)==null?void 0:Z.length)||""}`;return e("li",{children:[C&&((P=M._types)==null?void 0:P.length)>0&&e("div",{class:"reactions-block",children:M._types.map(N=>e(S,{icon:{reblog:"rocket",favourite:"heart"}[N],class:`${N}-icon`}))}),e("div",{class:"account-relationships",children:e(at,{account:M,showStats:!0,relationship:G,excludeRelationshipAttrs:n})})]},se)})}),r==="default"?u?e(yt,{onChange:M=>{M&&x()},children:e("button",{type:"button",class:"plain block",onClick:()=>x(),children:e(l,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(l,{id:"2EYeAZ"})}):r==="loading"&&e("p",{class:"ui-state",children:e(Le,{abrupt:!0})})]}):r==="loading"?e("p",{class:"ui-state",children:e(Le,{abrupt:!0})}):r==="error"?e("p",{class:"ui-state",children:e(l,{id:"AThL/k"})}):e("p",{class:"ui-state insignificant",children:o})]})]})}function Mc({alt:t,lang:n,onClose:i}){const s=Be(A),[o,a]=L(!1),f=ts(!0),d=s.settings.contentTranslationHideLanguages||[],c=!!n&&n!==f&&!hi([n],[f])&&!d.find(r=>n===r||hi([n],[r]));return e("div",{class:"sheet",tabindex:"-1",children:[!!i&&e("button",{type:"button",class:"sheet-close outer",onClick:i,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{class:"header-grid",children:[e("h2",{children:e(l,{id:"5gfDMm"})}),e("div",{class:"header-side",children:e(ot,{align:"end",menuButton:e("button",{type:"button",class:"plain4",children:e(S,{icon:"more",alt:g._({id:"2FYpfJ"}),size:"xl"})}),children:[e(ge,{disabled:o,onClick:()=>{a(!0)},children:[e(S,{icon:"translate"}),e("span",{children:e(l,{id:"pi8x/S"})})]}),po&&e(ge,{onClick:()=>{mo(t,n)},children:[e(S,{icon:"speak"}),e("span",{children:e(l,{id:"yIBLq8"})})]})]})})]}),e("main",{lang:n,dir:"auto",children:[e("p",{style:{whiteSpace:"pre-wrap",textWrap:"pretty"},children:t}),(c||o)&&e(ss,{forceTranslate:o,sourceLanguage:n,text:t})]})]})}function An(t,n,i){return Math.max(Math.min(t,i),n)}const En=t=>t>=.04045?Math.pow((t+.055)/1.055,2.4):t/12.92,Rn=t=>t>=.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t;function ai([t,n,i]){t=En(t/255),n=En(n/255),i=En(i/255);var s=.4122214708*t+.5363325363*n+.0514459929*i,o=.2119034982*t+.6806995451*n+.1073969566*i,a=.0883024619*t+.2817188376*n+.6299787005*i;return s=Math.cbrt(s),o=Math.cbrt(o),a=Math.cbrt(a),[s*.2104542553+o*.793617785+a*-.0040720468,s*1.9779984951+o*-2.428592205+a*.4505937099,s*.0259040371+o*.7827717662+a*-.808675766]}function ri([t,n,c]){var s=t+n*.3963377774+c*.2158037573,o=t+n*-.1055613458+c*-.0638541728,a=t+n*-.0894841775+c*-1.291485548;s=s**3,o=o**3,a=a**3;var f=s*4.0767416621+o*-3.3077115913+a*.2309699292,d=s*-1.2684380046+o*2.6097574011+a*-.3413193965,c=s*-.0041960863+o*-.7034186147+a*1.707614701;return f=255*Rn(f),d=255*Rn(d),c=255*Rn(c),f=An(f,0,255),d=An(d,0,255),c=An(c,0,255),f=Math.round(f),d=Math.round(d),c=Math.round(c),[f,d,c]}const Dc={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:kl}=Dc;function Ss({mediaAttachments:t,statusID:n,instance:i,lang:s,index:o=0,onClose:a=()=>{}}){var y,C;const[f,d]=L("default"),c=j(null),[r,m]=L(o),h=j(null);vt(()=>{var _;(_=h.current)==null||_.scrollIntoView()},[]);const p=j(n);X(()=>{const _=o*c.current.clientWidth,T=p.current!==n;T&&(p.current=n),c.current.focus(),c.current.scrollTo({left:_*(Et()?-1:1),behavior:T?"auto":"smooth"})},[o,n]);const[u,v]=L(!0);X(()=>{let _=()=>{a()};return c.current&&c.current.addEventListener("swiped-down",_),()=>{c.current&&c.current.removeEventListener("swiped-down",_)}},[]),Ue("esc",a,{ignoreEventWhen:_=>!!document.querySelector("#modal-container > *")},[a]),X(()=>{let _=()=>{const{clientWidth:T,scrollLeft:I}=c.current,x=Math.round(Math.abs(I)/T);m(x)};return c.current&&c.current.addEventListener("scroll",_,{passive:!0}),()=>{c.current&&c.current.removeEventListener("scroll",_)}},[]),X(()=>{let _=setTimeout(()=>{var T,I;(I=(T=c.current)==null?void 0:T.focus)==null||I.call(T)},100);return()=>clearTimeout(_)},[]);const b=be(()=>t==null?void 0:t.map(_=>{const{blurhash:T}=_;if(T){const I=Zn(T),x=ai(I);return ri([.6,x[1],x[2]])}return null}),[t]),w=be(()=>{var I;const T=100/b.length;return((I=b==null?void 0:b.map((x,z)=>{const D=z*T+5,M=(z+1)*T-5;return x?` rgba(${x==null?void 0:x.join(",")}, 0.4) ${D}%, rgba(${x==null?void 0:x.join(",")}, 0.4) ${M}% `:` transparent ${D}%, transparent ${M}% `}))==null?void 0:I.join(", "))||"transparent"},[b]);let k=j(null);return X(()=>()=>{var _,T;(T=(_=k.current)==null?void 0:_.hideToast)==null||T.call(_)},[]),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:_=>{(_.target.classList.contains("carousel-item")||_.target.classList.contains("media")||_.target.classList.contains("media-zoom"))&&a()},style:t.length>1?{backgroundAttachment:"local",backgroundImage:`linear-gradient( to ${Et()?"left":"right"}, ${w})`}:{},children:t==null?void 0:t.map((_,T)=>{const I=t.length===1?b[T]:null;return e("div",{class:"carousel-item",style:I?{"--accent-color":`rgb(${I==null?void 0:I.join(",")})`,"--accent-alpha-color":`rgba(${I==null?void 0:I.join(",")}, 0.4)`}:{},tabindex:"0",ref:T===r?h:null,onClick:x=>{x.target.classList.contains("media")||v(!u)},children:[!!_.description&&e("button",{type:"button",class:"media-alt",hidden:!u,onClick:()=>{A.showMediaAlt={alt:_.description,lang:s}},children:[e("span",{class:"alt-badge",children:"ALT"}),e("span",{class:"media-alt-desc",lang:s,dir:"auto",children:_.description})]}),e(os,{media:_,showOriginal:!0,lang:s})]},_.id)})}),e("div",{class:"carousel-top-controls",hidden:!u,children:[e("span",{children:e("button",{type:"button",class:"carousel-button",onClick:()=>a(),children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})})}),(t==null?void 0:t.length)>1?e("span",{class:"carousel-dots",children:t==null?void 0:t.map((_,T)=>e("button",{type:"button",disabled:T===r,class:`carousel-dot ${T===r?"active":""}`,onClick:I=>{I.preventDefault(),I.stopPropagation();const x=c.current.clientWidth*T*(Et()?-1:1);c.current.scrollTo({left:x,behavior:"smooth"}),c.current.focus()},children:e(S,{icon:"round",size:"s",alt:"โธฑ"})},_.id))}):e("span",{}),e("span",{children:[e(ot,{overflow:"auto",align:"end",position:"anchor",gap:4,menuClassName:"glass-menu",menuButton:e("button",{type:"button",class:"carousel-button",children:e(S,{icon:"more",alt:g._({id:"2FYpfJ"})})}),children:[e(Oe,{href:((y=t[r])==null?void 0:y.remoteUrl)||((C=t[r])==null?void 0:C.url),class:"carousel-button",target:"_blank",title:g._({id:"5hXGws"}),children:[e(S,{icon:"popout"}),e("span",{children:e(l,{id:"aDr7Vc"})})]}),!1]})," ",e(ue,{to:`${i?`/${i}`:""}/s/${n}${window.matchMedia("(min-width: calc(40em + 350px))").matches?`?media=${r+1}`:""}`,class:"button carousel-button media-post-link",children:[e("span",{class:"button-label",children:[e(l,{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:r===0,onClick:_=>{_.preventDefault(),_.stopPropagation(),c.current.focus(),c.current.scrollTo({left:c.current.clientWidth*(r-1)*(Et()?-1:1),behavior:"smooth"})},children:e(S,{icon:"arrow-left",alt:g._({id:"DHhJ7s"})})}),e("button",{type:"button",class:"carousel-button",hidden:r===t.length-1,onClick:_=>{_.preventDefault(),_.stopPropagation(),c.current.focus(),c.current.scrollTo({left:c.current.clientWidth*(r+1)*(Et()?-1:1),behavior:"smooth"})},children:e(S,{icon:"arrow-right",alt:g._({id:"hXzOVo"})})})]})]})}const Pc=[,"spam","legal","violation","other"],Wt={spam:{label:{id:"t8dIOP"},description:{id:"csQin/"}},legal:{label:{id:"IjKdHM"},description:{id:"e6tGFu"}},violation:{label:{id:"KPFHM2"},description:{id:"fpotTF"},stampLabel:{id:"iuLUuH"}},other:{label:{id:"/IX/7x"},description:{id:"kxiG8g"},excludeStamp:!0}};function Nc({account:t,post:n,onClose:i}){const{_:s}=Xe(),{masto:o}=ce(),[a,f]=L("default"),[d,c]=t.acct.split("@"),[r,m]=be(()=>{const{rules:y,domain:C}=Zi();return[y||[],C]}),[h,p]=L(null),[u,v]=L(!1),b=j(null),[w,k]=L(!1);return e("div",{class:"report-modal-container",children:[e("div",{class:"top-controls",children:[e("h1",{children:n?g._({id:"muLhL3"}):g._({id:"ACul2G",values:{username:d}})}),e("button",{type:"button",class:"plain4 small",disabled:a==="loading",onClick:()=>i(),children:e(S,{icon:"x",size:"xl",alt:g._({id:"yz7wBu"})})})]}),e("main",{children:[e("div",{class:"report-preview",children:n?e(qe,{status:n,size:"s",previewMode:!0}):e(at,{account:t,avatarSize:"xxl",useAvatarStatic:!0,showStats:!0,showActivity:!0})}),!!h&&!Wt[h].excludeStamp&&e("span",{class:"rubber-stamp","aria-hidden":"true",children:[s(Wt[h].stampLabel||s(Wt[h].label)),e("small",{children:e(l,{id:"2WtL62"})})]},h),e("form",{onSubmit:y=>{y.preventDefault();const C=new FormData(y.target),_=Object.fromEntries(C.entries());let{category:T,comment:I,forward:x}=_;I||(I=void 0),x==="on"&&(x=!0);const z=T==="violation"?Object.entries(_).filter(([M])=>M.startsWith("rule_ids")).map(([M,G])=>G):void 0,D={category:T,comment:I,forward:x,ruleIds:z};f("loading"),(async()=>{try{await o.v1.reports.create({accountId:t.id,statusIds:n!=null&&n.id?[n.id]:void 0,category:T,comment:I,ruleIds:z,forward:x}),f("success"),de(n?g._({id:"y3ou+8"}):g._({id:"R9kjEL"})),i()}catch(M){f("error"),de((M==null?void 0:M.message)||(n?g._({id:"+3FjPq"}):g._({id:"oEQq5w"})))}})()},children:[e("p",{children:n?g._({id:"L9fUm+"}):g._({id:"rSLkfe"})}),e("section",{class:"report-categories",children:Pc.map(y=>y==="violation"&&!(r!=null&&r.length)?null:e(q,{children:[e("label",{class:"report-category",children:[e("input",{type:"radio",name:"category",value:y,required:!0,disabled:a==="loading",onChange:C=>{p(C.target.value),v(C.target.value==="violation")}}),e("span",{children:[s(Wt[y].label)," ย ",e("small",{class:"ib insignificant",children:s(Wt[y].description)})]})]}),y==="violation"&&!!(r!=null&&r.length)&&e("div",{class:"shazam-container no-animation",hidden:!u,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"report-rules",ref:b,children:r.map((C,_)=>e("label",{class:"report-rule",children:[e("input",{type:"checkbox",name:`rule_ids[${_}]`,value:C.id,required:u&&!w,disabled:a==="loading",onChange:T=>{const{checked:I}=T.target;I?k(!0):b.current.querySelectorAll("input:checked").length||k(!1)}}),e("span",{children:C.text})]},C.id))})})})]},y))}),e("section",{class:"report-comment",children:[e("p",{children:e("label",{for:"report-comment",children:e(l,{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(l,{id:"cyjS8M",values:{domain:c},components:{0:e("i",{})}})})]})})}),e("footer",{children:[e("button",{type:"submit",disabled:a==="loading",children:e(l,{id:"4cijjm"})})," ",e("button",{type:"submit",class:"plain2",disabled:a==="loading",onClick:async()=>{try{await o.v1.accounts.$select(t.id).mute(),de(g._({id:"/BGBeF",values:{username:d}}))}catch{de(g._({id:"v02K7/",values:{username:d}}))}},children:e(l,{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(),de(g._({id:"kjUejn",values:{username:d}}))}catch{de(g._({id:"pMcdDp",values:{username:d}}))}},children:e(l,{id:"JybQca",components:{0:e("small",{class:"ib"})}})}),e(Le,{hidden:a!=="loading"})]})]})]})]})}var li={exports:{}},_l=li.exports;(function(t){var n=function(){var i=String.fromCharCode,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",a={};function f(c,r){if(!a[c]){a[c]={};for(var m=0;m>>8,m[h*2+1]=u%256}return m},decompressFromUint8Array:function(c){if(c==null)return d.decompress(c);for(var r=new Array(c.length/2),m=0,h=r.length;m>1}else{for(p=1,h=0;h<_;h++)I=I<<1|p,x==r-1?(x=0,T.push(m(I)),I=0):x++,p=0;for(p=k.charCodeAt(0),h=0;h<16;h++)I=I<<1|p&1,x==r-1?(x=0,T.push(m(I)),I=0):x++,p=p>>1}y--,y==0&&(y=Math.pow(2,_),_++),delete v[k]}else for(p=u[k],h=0;h<_;h++)I=I<<1|p&1,x==r-1?(x=0,T.push(m(I)),I=0):x++,p=p>>1;y--,y==0&&(y=Math.pow(2,_),_++),u[w]=C++,k=String(b)}if(k!==""){if(Object.prototype.hasOwnProperty.call(v,k)){if(k.charCodeAt(0)<256){for(h=0;h<_;h++)I=I<<1,x==r-1?(x=0,T.push(m(I)),I=0):x++;for(p=k.charCodeAt(0),h=0;h<8;h++)I=I<<1|p&1,x==r-1?(x=0,T.push(m(I)),I=0):x++,p=p>>1}else{for(p=1,h=0;h<_;h++)I=I<<1|p,x==r-1?(x=0,T.push(m(I)),I=0):x++,p=0;for(p=k.charCodeAt(0),h=0;h<16;h++)I=I<<1|p&1,x==r-1?(x=0,T.push(m(I)),I=0):x++,p=p>>1}y--,y==0&&(y=Math.pow(2,_),_++),delete v[k]}else for(p=u[k],h=0;h<_;h++)I=I<<1|p&1,x==r-1?(x=0,T.push(m(I)),I=0):x++,p=p>>1;y--,y==0&&(y=Math.pow(2,_),_++)}for(p=2,h=0;h<_;h++)I=I<<1|p&1,x==r-1?(x=0,T.push(m(I)),I=0):x++,p=p>>1;for(;;)if(I=I<<1,x==r-1){T.push(m(I));break}else x++;return T.join("")},decompress:function(c){return c==null?"":c==""?null:d._decompress(c.length,32768,function(r){return c.charCodeAt(r)})},_decompress:function(c,r,m){var h=[],p,u=4,v=4,b=3,w="",k=[],y,C,_,T,I,x,z,D={val:m(0),position:r,index:1};for(y=0;y<3;y+=1)h[y]=y;for(_=0,I=Math.pow(2,2),x=1;x!=I;)T=D.val&D.position,D.position>>=1,D.position==0&&(D.position=r,D.val=m(D.index++)),_|=(T>0?1:0)*x,x<<=1;switch(p=_){case 0:for(_=0,I=Math.pow(2,8),x=1;x!=I;)T=D.val&D.position,D.position>>=1,D.position==0&&(D.position=r,D.val=m(D.index++)),_|=(T>0?1:0)*x,x<<=1;z=i(_);break;case 1:for(_=0,I=Math.pow(2,16),x=1;x!=I;)T=D.val&D.position,D.position>>=1,D.position==0&&(D.position=r,D.val=m(D.index++)),_|=(T>0?1:0)*x,x<<=1;z=i(_);break;case 2:return""}for(h[3]=z,C=z,k.push(z);;){if(D.index>c)return"";for(_=0,I=Math.pow(2,b),x=1;x!=I;)T=D.val&D.position,D.position>>=1,D.position==0&&(D.position=r,D.val=m(D.index++)),_|=(T>0?1:0)*x,x<<=1;switch(z=_){case 0:for(_=0,I=Math.pow(2,8),x=1;x!=I;)T=D.val&D.position,D.position>>=1,D.position==0&&(D.position=r,D.val=m(D.index++)),_|=(T>0?1:0)*x,x<<=1;h[v++]=i(_),z=v-1,u--;break;case 1:for(_=0,I=Math.pow(2,16),x=1;x!=I;)T=D.val&D.position,D.position>>=1,D.position==0&&(D.position=r,D.val=m(D.index++)),_|=(T>0?1:0)*x,x<<=1;h[v++]=i(_),z=v-1,u--;break;case 2:return k.join("")}if(u==0&&(u=Math.pow(2,b),b++),h[z])w=h[z];else if(z===v)w=C+C.charAt(0);else return null;k.push(w),h[v++]=C+w.charAt(0),u--,C=w,u==0&&(u=Math.pow(2,b),b++)}}};return d}();t!=null?t.exports=n:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return n})})(li);var Ei=li.exports;const Oc="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",zc="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",Uc="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",Fc=200,Bc=10;async function wn(){const{masto:t}=ce(),n=t.v1.followedTags.list({limit:Fc}),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(so.name.localeCompare(a.name)),i.length&&setTimeout(()=>{he.account.set("followedTags",{tags:i,updatedAt:Date.now()})},1),i}const qc=24*60*60*1e3;async function Hc(){try{const{tags:t,updatedAt:n}=he.account.get("followedTags")||{};return t!=null&&t.length?(Date.now()-n>qc&&wn(),t):await wn()}catch{return[]}}const Ri=document.createElement("div"),jc=t=>{if(!t)return[];if(t.indexOf("#")===-1)return[];Ri.innerHTML=t;const n=Ri.querySelectorAll("a.hashtag");return n.length?Array.from(n).map(i=>i.innerText.trim().replace(/^[^#]*#+/,"")):[]};function dn({children:t}){if(typeof t=="string")return t;const[n,i]=L("");return X(()=>{Promise.resolve(t).then(i)},[t]),n}const gt=9,Yc=["following","mentions","notifications","list","public","trending","search","hashtag","bookmarks","favourites"],Cs={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"}},un={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}]},Vc=wt(async({id:t})=>{const n=await ce().masto.v1.accounts.$select(t).fetch();return n.username||n.acct||n.displayName}),kn={following:{id:"home",title:(t,n)=>n===0?g._({id:"i0qMbr"}):g._({id:"y6sq5j"}),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?lc(t):g._({id:"h16FyT"}),path:({id:t})=>t?`/l/${t}`:"/l",icon:"list",excludeViewMode:({id:t})=>t?[]:["multi-column"]},public:{id:"public",title:({local:t})=>t?g._({id:"d5zxa4"}):g._({id:"4ERYY7"}),subtitle:({instance:t})=>t||ce().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||ce().instance,path:({instance:t})=>`/${t}/trending`,icon:"chart"},search:{id:"search",title:({query:t})=>t?`โ€œ${t}โ€`:g._({id:"A1taO8"}),path:({query:t})=>t?`/search?q=${encodeURIComponent(t)}&type=statuses`:"/search",icon:"search",excludeViewMode:({query:t})=>t?[]:["multi-column"]},"account-statuses":{id:"account-statuses",title:Vc,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||ce().instance,path:({hashtag:t,instance:n,media:i})=>`${n?`/${n}`:""}/t/${t.split(/\s+/).join("+")}${i?"?media=1":""}`,icon:"hashtag"}};function Gc({onClose:t}){const{_:n}=Xe(),i=Be(A),{shortcuts:s}=i,[o,a]=L(!1),[f,d]=L(!1),[c]=ni();return e("div",{id:"shortcuts-settings-container",class:"sheet",tabindex:"-1",children:[!!t&&e("button",{type:"button",class:"sheet-close",onClick:t,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:[e(S,{icon:"shortcut"})," ",e(l,{id:"CTqTgr"})," ",e("sup",{style:{fontSize:12,opacity:.5,textTransform:"uppercase"},children:e(l,{id:"A1As8l"})})]})}),e("main",{children:[e("p",{children:e(l,{id:"CIHAsy"})}),e("div",{class:"shortcuts-view-mode",children:[{value:"float-button",label:g._({id:"qwdOim"}),imgURL:Oc},{value:"tab-menu-bar",label:g._({id:"UxBoCm"}),imgURL:Uc},{value:"multi-column",label:g._({id:"uvDfdW"}),imgURL:zc}].map(({value:r,label:m,imgURL:h})=>{const p=i.settings.shortcutsViewMode===r||r==="float-button"&&!i.settings.shortcutsViewMode;return e("label",{class:p?"checked":"",children:[e("input",{type:"radio",name:"shortcuts-view-mode",value:r,checked:p,onChange:u=>{A.settings.shortcutsViewMode=u.target.value}})," ",e("img",{src:h,alt:"",width:"80",height:"58"})," ",e("span",{children:m})]},r)})}),s.length>0?e(q,{children:[e("ol",{class:"shortcuts-list",ref:c,children:s.filter(Boolean).map((r,m)=>{const h=Object.values(r).join("-"),{type:p}=r;if(!kn[p])return null;let{icon:u,title:v,subtitle:b,excludeViewMode:w}=kn[p];typeof v=="function"?v=v(r,m):v=n(v),typeof b=="function"?b=b(r,m):b=n(b),typeof u=="function"&&(u=u(r,m)),typeof w=="function"&&(w=w(r,m));const k=w==null?void 0:w.includes(i.settings.shortcutsViewMode);return e("li",{children:[e(S,{icon:u}),e("span",{class:"shortcut-text",children:[e(dn,{children:v}),b&&e(q,{children:[" ",e("small",{class:"ib insignificant",children:b})]}),k&&e("span",{class:"tag",children:e(l,{id:"5KJFnN"})})]}),e("span",{class:"shortcut-actions",children:[e("button",{type:"button",class:"plain small",disabled:m===0,onClick:()=>{const y=Array.from(A.shortcuts);if(m>0){const C=A.shortcuts[m-1];y[m-1]=r,y[m]=C,A.shortcuts=y}},children:e(S,{icon:"arrow-up",alt:g._({id:"QyioBP"})})}),e("button",{type:"button",class:"plain small",disabled:m===s.length-1,onClick:()=>{const y=Array.from(A.shortcuts);if(m{a({shortcut:r,shortcutIndex:m})},children:e(S,{icon:"pencil",alt:g._({id:"ePK91l"})})})]})]},h)})}),s.length===1&&i.settings.shortcutsViewMode!=="float-button"&&e("div",{class:"ui-state insignificant",children:[e(S,{icon:"info"})," ",e("small",{children:e(l,{id:"3Xq4Zi"})})]})]}):e("div",{class:"ui-state insignificant",children:[e("p",{children:i.settings.shortcutsViewMode==="multi-column"?g._({id:"3xIN+E"}):g._({id:"vLxvHT"})}),e("p",{children:e(l,{id:"Fq4zw3",components:{0:e("br",{}),1:e("a",{href:"#",onClick:r=>{r.preventDefault(),A.shortcuts=[{type:"following"},{type:"notifications"}]}})}})})]}),e("p",{class:"insignificant",children:s.length>=gt&&(i.settings.shortcutsViewMode==="multi-column"?g._({id:"RqXfsz",values:{SHORTCUTS_LIMIT:gt}}):g._({id:"EVRO/o",values:{SHORTCUTS_LIMIT:gt}}))}),e("p",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e("button",{type:"button",class:"light",onClick:()=>d(!0),children:e(l,{id:"bgVLbt"})}),e("button",{type:"button",disabled:s.length>=gt,onClick:()=>a(!0),children:[e(S,{icon:"plus"})," ",e("span",{children:i.settings.shortcutsViewMode==="multi-column"?g._({id:"Vh3ADI"}):g._({id:"9tmn6W"})})]})]})]}),o&&e(ze,{onClick:r=>{r.target===r.currentTarget&&a(!1)},children:e(Wc,{shortcut:o.shortcut,shortcutIndex:o.shortcutIndex,onSubmit:({result:r,mode:m})=>{m==="edit"?A.shortcuts[o.shortcutIndex]=r:A.shortcuts.push(r)},onClose:()=>a(!1)})}),f&&e(ze,{onClick:r=>{r.target===r.currentTarget&&d(!1)},children:e(Kc,{shortcuts:s,onClose:()=>d(!1)})})]})}const Li={list:{id:"1qL+L+"},search:{id:"dmTmkQ"},hashtag:{id:"E8laYz"}};function Wc({onSubmit:t,disabled:n,shortcut:i,shortcutIndex:s,onClose:o}){var w,k;const{_:a}=Xe(),f=!!i,[d,c]=L((i==null?void 0:i.type)||null),[r,m]=L("default"),[h,p]=L([]),[u,v]=L([]);X(()=>{(async()=>{if(d==="list")try{m("loading");const y=await sn();p(y),m("default")}catch{m("error")}})(),(async()=>{if(d==="hashtag")try{const y=await wn();v(y)}catch{}})()},[d]);const b=j();return X(()=>{if(f&&d&&un[d]){const y=b.current;un[d].forEach(({name:C,type:_})=>{const T=y.querySelector(`[name="${C}"]`);T&&i[C]&&(_==="checkbox"?T.checked=i[C]==="on":T.value=i[C])})}},[f,d]),e("div",{id:"shortcut-settings-form",class:"sheet",children:[!!o&&e("button",{type:"button",class:"sheet-close",onClick:o,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:f?g._({id:"pe1jog"}):g._({id:"Lsxpe5"})})}),e("main",{tabindex:"-1",children:e("form",{ref:b,onSubmit:y=>{y.preventDefault();const C=new FormData(y.target),_={};C.forEach((T,I)=>{_[I]=T==null?void 0:T.trim(),I==="instance"&&(_[I]=_[I].replace(/^https?:\/\//,"").replace(/\/+$/,""),_[I]=_[I].replace(/^@?[^@]+@/,""))}),_.type&&(t({result:_,mode:f?"edit":"add"}),y.target.reset(),c(null),o==null||o())},children:[e("p",{children:e("label",{children:[e("span",{children:e(l,{id:"cklVjM"})}),e("select",{required:!0,disabled:n,onChange:y=>{c(y.target.value)},defaultValue:f?i.type:void 0,name:"type",dir:"auto",children:[e("option",{}),Yc.map(y=>e("option",{value:y,children:a(Cs[y])}))]})]})}),(k=(w=un[d])==null?void 0:w.map)==null?void 0:k.call(w,({text:y,name:C,type:_,placeholder:T,pattern:I,notRequired:x})=>d==="list"?e("p",{children:e("label",{children:[e("span",{children:e(l,{id:"2BBAbc"})}),e("select",{name:"id",required:!x,disabled:n||r==="loading",defaultValue:f?i.id:void 0,dir:"auto",children:[e("option",{value:""}),h.map(z=>e("option",{value:z.id,children:z.title}))]})]})}):e("p",{children:e("label",{children:[e("span",{children:a(y)})," ",e("input",{type:_,switch:_==="checkbox"||void 0,name:C,placeholder:a(T),required:_==="text"&&!x,disabled:n,list:d==="hashtag"?"followed-hashtags-datalist":null,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:I,dir:"auto"}),d==="hashtag"&&u.length>0&&e("datalist",{id:"followed-hashtags-datalist",children:u.map(z=>e("option",{value:z.name}))})]})})),!!Li[d]&&e("p",{class:"form-note insignificant",children:[e(S,{icon:"info"}),a(Li[d])]}),e("footer",{children:[e("button",{type:"submit",class:"block",disabled:n||r==="loading",children:f?g._({id:"tfDRzk"}):g._({id:"m16xKo"})}),f&&e("button",{type:"button",class:"light danger",onClick:()=>{A.shortcuts.splice(s,1),o==null||o()},children:e(l,{id:"t/YqKh"})})]})]})})]})}function Kc({shortcuts:t,onClose:n}){var p;const{_:i}=Xe(),{masto:s}=ce(),o=be(()=>!t||!t.filter(Boolean).length?"":Ei.compressToEncodedURIComponent(JSON.stringify(t.filter(Boolean))),[t]),[a,f]=L(""),[d,c]=L("default"),r=be(()=>{if(!a)return c("default"),null;try{const u=JSON.parse(Ei.decompressFromEncodedURIComponent(a));if(!Array.isArray(u))throw new Error("Not an array");return c("default"),u}catch{try{const v=JSON.parse(a);if(!Array.isArray(v))throw new Error("Not an array");return c("default"),v}catch{return c("error"),null}}},[a]),m=A.shortcuts.length>0,h=j();return e("div",{id:"import-export-container",class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(l,{id:"OOa7/5",components:{0:e("small",{class:"ib insignificant"})}})})}),e("main",{tabindex:"-1",children:[e("section",{children:[e("h3",{children:[e(S,{icon:"arrow-down-circle",size:"l",class:"insignificant"})," ",e("span",{children:e(l,{id:"l3s5ri"})})]}),e("p",{class:"field-button",children:[e("input",{ref:h,type:"text",name:"import",placeholder:g._({id:"tBmklN"}),class:"block",onInput:u=>{f(u.target.value)},dir:"auto"}),A.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2 small",disabled:d==="cloud-downloading",onClick:async()=>{c("cloud-downloading");const u=bt();de(g._({id:"HLqLGx"}));try{const b=(await s.v1.accounts.relationships.fetch({id:[u]}))[0];if(b){const{note:w=""}=b;if(/(.*)<\/phanpy-shortcuts-settings>/.test(w)){const k=w.match(/(.*)<\/phanpy-shortcuts-settings>/)[1],{v:y,dt:C,data:_}=JSON.parse(k);h.current.value=_,h.current.dispatchEvent(new Event("input"))}}c("default")}catch{c("error"),de(g._({id:"gCDfX+"}))}},title:g._({id:"B6cG3J"}),children:[e(S,{icon:"cloud"}),e(S,{icon:"arrow-down"})]})]}),!!r&&Array.isArray(r)&&e(q,{children:[e("p",{children:[e("b",{children:r.length})," shortcut",r.length>1?"s":""," ",e("small",{class:"insignificant",children:["(",a.length," characters)"]})]}),e("ol",{class:"import-settings-list",children:r.map(u=>{var v,b;return e("li",{children:[e("span",{style:{opacity:t.some(w=>Object.keys(w).every(k=>w[k]===u[k]))?1:0},children:"*"}),e("span",{children:[i(Cs[u.type]),u.type==="list"&&" โš ๏ธ"," ",(b=(v=un[u.type])==null?void 0:v.map)==null?void 0:b.call(v,({text:w,name:k,type:y})=>u[k]?e(q,{children:[e("span",{class:"tag collapsed insignificant",children:[w,":"," ",y==="checkbox"?u[k]==="on"?"โœ…":"โŒ":u[k]]})," "]}):null)]})]})})}),e("p",{children:[e("small",{children:e(l,{id:"o6sElH"})}),e("br",{}),e("small",{children:["โš ๏ธ"," ",e(l,{id:"N4z4P/"})]})]})]}),d==="error"&&e("p",{class:"error",children:e("small",{children:["โš ๏ธ ",e(l,{id:"ZhsPEb"})]})}),e("p",{children:[m&&e(q,{children:[e(rt,{confirmLabel:g._({id:"6MzUUU"}),menuFooter:e("div",{class:"footer",children:e(l,{id:"nl8sCE"})}),onClick:()=>{const u=r.filter(w=>!A.shortcuts.some(k=>Object.keys(k).every(y=>k[y]===w[y])));if(!u.length){de(g._({id:"o6L30P"}));return}let v=[...A.shortcuts,...u];const b=v.length>gt;b&&(v=v.slice(0,gt)),A.shortcuts=v,de(b?g._({id:"SBmqmC",values:{SHORTCUTS_LIMIT:gt}}):g._({id:"QO9uTx"})),n==null||n()},children:e("button",{type:"button",class:"plain2",disabled:!r,children:e(l,{id:"c89gCv"})})})," "]}),e(rt,{confirmLabel:m?g._({id:"6ZjzWP"}):g._({id:"DWumLi"}),menuItemClassName:m?"danger":void 0,onClick:()=>{A.shortcuts=r,de(g._({id:"QO9uTx"})),n==null||n()},children:e("button",{type:"button",class:"plain2",disabled:!r,children:m?g._({id:"uIp8WL"}):g._({id:"Sjnlwj"})})})]})]}),e("section",{children:[e("h3",{children:[e(S,{icon:"arrow-up-circle",size:"l",class:"insignificant"})," ",e("span",{children:e(l,{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),de(g._({id:"cWtH+v"}))}catch{de(g._({id:"yUWyHa"}))}}},dir:"auto"})}),e("p",{children:[e("button",{type:"button",class:"plain2",disabled:!o,onClick:()=>{try{navigator.clipboard.writeText(o),de(g._({id:"+Kq2vY"}))}catch{de(g._({id:"tFvxZF"}))}},children:[e(S,{icon:"clipboard"})," ",e("span",{children:e(l,{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(g._({id:"TtG3Uh"}))}},children:[e(S,{icon:"share"})," ",e("span",{children:e(l,{id:"Z8lGw6"})})]})," ",A.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2",disabled:d==="cloud-uploading",onClick:async()=>{c("cloud-uploading");const u=bt();try{const b=(await s.v1.accounts.relationships.fetch({id:[u]}))[0];if(b){const{note:w=""}=b;let k="";const y=JSON.stringify({v:"1",dt:Date.now(),data:o});/(.*)<\/phanpy-shortcuts-settings>/.test(w)?k=w.replace(/(.*)<\/phanpy-shortcuts-settings>/,`${y}`):k=`${w} ${y}`,de(g._({id:"9ZYiLz"})),await s.v1.accounts.$select(u).note.create({comment:k}),c("default"),de(g._({id:"5w02SH"}))}}catch{c("error"),de(g._({id:"aVsTYo"}))}},title:g._({id:"gWd6Cu"}),children:[e(S,{icon:"cloud"}),e(S,{icon:"arrow-up"})]})," ",o.length>0&&e("small",{class:"insignificant ib",children:e(l,{id:"IPXOXm",values:{0:o.length}})})]}),!!o&&e("details",{children:[e("summary",{class:"insignificant",children:e("small",{children:e(l,{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(S,{icon:"cloud"})," ",e(l,{id:"C4T6O/"})]})})]})]})}Ji(A,t=>{for(const[n,i,s,o]of t)/^show/i.test(i)&&!s&&Un()});function Zc(){var s,o,a,f,d,c,r,m;const t=Be(A),n=Xi(),i=Yt();return X(()=>{setTimeout(Zs,1e3)},[]),e(q,{children:[!!t.showCompose&&e(ze,{class:`solid ${t.composerState.minimized?"min":""}`,minimized:!!t.composerState.minimized,children:e(Js,{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:((f=A.showCompose)==null?void 0:f.draftStatus)||((d=window.__COMPOSE__)==null?void 0:d.draftStatus)||null,onClose:h=>{const{newStatus:p,instance:u,type:v}=h||{};A.showCompose=!1,window.__COMPOSE__=null,p&&(A.reloadStatusPage++,de({text:{post:g._({id:"aTyHBW"}),reply:g._({id:"lZdBKl"}),edit:g._({id:"a5BN7l"})}[v||"post"],delay:1e3,duration:1e4,onClick:b=>{b.hideToast(),A.prevLocation=i,n(u?`/${u}/s/${p.id}`:`/s/${p.id}`)}}))}})}),!!t.showSettings&&e(ze,{onClose:()=>{A.showSettings=!1},children:e(oc,{onClose:()=>{A.showSettings=!1}})}),!!t.showAccounts&&e(ze,{onClose:()=>{A.showAccounts=!1},children:e(Wo,{onClose:()=>{A.showAccounts=!1}})}),!!t.showAccount&&e(ze,{onClose:()=>{A.showAccount=!1},children:e(Ac,{account:((c=t.showAccount)==null?void 0:c.account)||t.showAccount,instance:(r=t.showAccount)==null?void 0:r.instance,onClose:({destination:h}={})=>{A.showAccount=!1}})}),!!t.showDrafts&&e(ze,{onClose:()=>{A.showDrafts=!1},children:e(Ec,{onClose:()=>A.showDrafts=!1})}),!!t.showMediaModal&&e(ze,{onClick:h=>{(h.target===h.currentTarget||h.target.classList.contains("media"))&&(A.showMediaModal=!1)},children:e(Ss,{mediaAttachments:t.showMediaModal.mediaAttachments,instance:t.showMediaModal.instance,index:t.showMediaModal.index,statusID:t.showMediaModal.statusID,onClose:()=>{A.showMediaModal=!1}})}),!!t.showShortcutsSettings&&e(ze,{onClose:()=>{A.showShortcutsSettings=!1},children:e(Gc,{onClose:()=>A.showShortcutsSettings=!1})}),!!t.showGenericAccounts&&e(ze,{onClose:()=>{A.showGenericAccounts=!1},children:e($c,{instance:t.showGenericAccounts.instance,excludeRelationshipAttrs:t.showGenericAccounts.excludeRelationshipAttrs,postID:t.showGenericAccounts.postID,onClose:()=>A.showGenericAccounts=!1,blankCopy:t.showGenericAccounts.blankCopy})}),!!t.showMediaAlt&&e(ze,{onClose:h=>{A.showMediaAlt=!1},children:e(Mc,{alt:t.showMediaAlt.alt||t.showMediaAlt,lang:(m=t.showMediaAlt)==null?void 0:m.lang,onClose:()=>{A.showMediaAlt=!1}})}),!!t.showEmbedModal&&e(ze,{class:"solid",onClose:()=>{A.showEmbedModal=!1},children:e(Lc,{html:t.showEmbedModal.html,url:t.showEmbedModal.url,width:t.showEmbedModal.width,height:t.showEmbedModal.height,onClose:()=>{A.showEmbedModal=!1}})}),!!t.showReportModal&&e(ze,{onClose:()=>{A.showReportModal=!1},children:e(Nc,{account:t.showReportModal.account,post:t.showReportModal.post,onClose:()=>{A.showReportModal=!1}})})]})}function Bn({accountID:t,onChange:n}){const{masto:i}=ce(),[s,o]=L("default"),[a,f]=L(null),[d,c]=L(null),r=d!==null;return e("p",{class:"follow-request-buttons",children:[e("button",{type:"button",disabled:s==="loading"||r,onClick:()=>{o("loading"),f("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(l,{id:"g3UF2V"})})," ",e("button",{type:"button",disabled:s==="loading"||r,class:"light danger",onClick:()=>{o("loading"),f("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(l,{id:"1t/NnN"})}),e("span",{class:"follow-request-states",children:r&&a?a==="accept"?e(S,{icon:"check-circle",alt:g._({id:"bzMKg7"}),class:"follow-accepted"}):e(S,{icon:"x-circle",alt:g._({id:"ekCRTP"}),class:"follow-rejected"}):e(Le,{hidden:s!=="loading"})})]})}const $i={mention:"comment",status:"notification",reblog:"rocket",follow:"follow",follow_request:"follow-add",favourite:"heart",poll:"poll",update:"pencil","admin.signup":"account-edit","admin.report":"account-warning",severed_relationships:"heart-break",moderation_warning:"alert",emoji_reaction:"emoji2","pleroma:emoji_reaction":"emoji2"};function Mi({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(go,{url:s,staticUrl:o,alt:n}):n;return e(l,{id:"i5uN6K",values:{account:t,emojiObject:a}})}const Ln={status:({account:t})=>e(l,{id:"idiIxW",values:{account:t}}),reblog:({count:t,account:n,postsCount:i,postType:s,components:{Subject:o}})=>e(l,{id:"jkt9P5",values:{0:Ve(t),1:Ve(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(l,{id:"+71G9C",values:{0:Ve(n),count:n,account:t},components:{0:e(i,{clickable:n>1}),1:e("span",{title:n})}}),follow_request:({account:t})=>e(l,{id:"eh6NHW",values:{account:t}}),favourite:({account:t,count:n,postsCount:i,postType:s,components:{Subject:o}})=>e(l,{id:"RqX1mR",values:{0:Ve(n),1:Ve(n),count:n,postsCount:i,postType:s,account:t},components:{0:e(o,{clickable:n>1}),1:e("span",{title:n}),2:e(o,{clickable:n>1}),3:e("span",{title:n})}}),poll:()=>g._({id:"kIlJaS"}),"poll-self":()=>g._({id:"kpjzdN"}),"poll-voted":()=>g._({id:"moT7M8"}),update:()=>g._({id:"uzt17m"}),"favourite+reblog":({count:t,account:n,postsCount:i,postType:s,components:{Subject:o}})=>e(l,{id:"NunZZQ",values:{0:Ve(t),1:Ve(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(l,{id:"fJCCpx",values:{account:t}}),"admin.report":({account:t,targetAccount:n})=>e(l,{id:"eNfCmq",values:{account:t,targetAccount:n}}),severed_relationships:({name:t})=>e(l,{id:"Xl9v6+",values:{name:t},components:{0:e("i",{})}}),moderation_warning:()=>e("b",{children:e(l,{id:"YqffEv"})}),emoji_reaction:Mi,"pleroma:emoji_reaction":Mi},Jc={account_suspension:({from:t,targetName:n})=>e(l,{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(l,{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(l,{id:"RQKWUa",values:{targetName:t,followersCount:n,followingCount:i},components:{0:e("i",{})}})},Xc={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"}},$n=30;function Qc({notification:t,instance:n,isStatic:i,disableContextMenu:s}){var P,N,U,Y,F,ie;const{_:o}=Xe(),{id:a,status:f,account:d,report:c,event:r,moderation_warning:m,_ids:h,_accounts:p,_statuses:u,sampleAccounts:v,notificationsCount:b}=t;let{type:w}=t;if(w==="mention"&&!f)return null;const k=(f==null?void 0:f.reblog)||f,y=k==null?void 0:k.id,C=bt(),_=C===(d==null?void 0:d.id),T=(P=f==null?void 0:f.poll)==null?void 0:P.voted,I=!!(f!=null&&f.inReplyToAccountId)&&(f==null?void 0:f.inReplyToAccountId)!==C&&((N=f==null?void 0:f.account)==null?void 0:N.id)===C;let x=0,z=0;if(w==="favourite+reblog"){if(p)for(const O of p)(U=O._types)!=null&&U.includes("favourite")&&x++,(Y=O._types)!=null&&Y.includes("reblog")&&z++;!z&&x&&(w="favourite"),!x&&z&&(w="reblog")}let D;w==="poll"?D=Ln[_?"poll-self":T?"poll-voted":"poll"]:Ln[w]?D=Ln[w]:D=g._({id:"ODqZt1",values:{type:w}});const M=({clickable:O,...ne})=>O?e("b",{tabIndex:"0",onClick:Z,...ne}):e("b",{...ne});if(typeof D=="function"){const O=(p==null?void 0:p.length)||(v==null?void 0:v.length)||(d?1:0),ne=(u==null?void 0:u.length)||0;if(w==="admin.report"){const ye=c==null?void 0:c.targetAccount;ye&&(D=D({account:e(Ct,{account:d,showAvatar:!0}),targetAccount:e(Ct,{account:ye,showAvatar:!0})}))}else if(w==="severed_relationships"){const ye=r==null?void 0:r.targetName;ye&&(D=D({name:ye}))}else if((w==="emoji_reaction"||w==="pleroma:emoji_reaction")&&t.emoji){const ye=t.emoji_url||((ie=(F=f==null?void 0:f.emojis)==null?void 0:F.find)==null?void 0:ie.call(F,ee=>(ee==null?void 0:ee.shortcode)===t.emoji.replace(/^:/,"").replace(/:$/,"")));D=D({emoji:t.emoji,emojiURL:ye})}else D=D({account:d?e(Ct,{account:d,showAvatar:!0}):(v==null?void 0:v[0])&&e(Ct,{account:v[0],showAvatar:!0}),count:O,postsCount:ne,postType:I?"reply":"post",components:{Subject:M}})}const G=t.createdAt&&new Date(t.createdAt).toLocaleString(),se={"favourite+reblog":g._({id:"+XOeb+"}),favourite:g._({id:"LQFF6J"}),reblog:g._({id:"phQpSa"}),follow:g._({id:"Ih01jh"})}[w]||g._({id:"bPwFdf"}),Z=()=>{A.showGenericAccounts={heading:se,accounts:p,showReactions:w==="favourite+reblog",excludeRelationshipAttrs:w==="follow"?["followedBy"]:[],postID:st(y,n)}};return e("div",{class:`notification notification-${w}`,"data-notification-id":h||a,tabIndex:"0",children:[e("div",{class:`notification-type notification-${w}`,title:G,children:w==="favourite+reblog"?e(q,{children:[e(S,{icon:"rocket",size:"xl",alt:w,class:"reblog-icon"}),e(S,{icon:"heart",size:"xl",alt:w,class:"favourite-icon"})]}):e(S,{icon:$i[w]||"notification",size:"xl",alt:w})}),e("div",{class:"notification-content",children:[w!=="mention"&&e(q,{children:[e("p",{children:D}),w==="follow_request"&&e(Bn,{accountID:d.id}),w==="severed_relationships"&&e("div",{children:[Jc[r.type]({from:n,...r}),e("br",{}),e("a",{href:`https://${n}/severed_relationships`,target:"_blank",rel:"noopener noreferrer",children:e(l,{id:"YL6Y8P",components:{0:e(S,{icon:"external",size:"s"})}})}),"."]}),w==="moderation_warning"&&!!m&&e("div",{children:[o(Xc[m.action]()),e("br",{}),e("a",{href:`/disputes/strikes/${m.id}`,target:"_blank",rel:"noopener noreferrer",children:e(l,{id:"YL6Y8P",components:{0:e(S,{icon:"external",size:"s"})}})})]})]}),(p==null?void 0:p.length)>1&&e("p",{class:"avatars-stack",children:[p.slice(0,$n).map(O=>e(q,{children:[e("a",{href:O.url,rel:"noopener noreferrer",class:"account-avatar-stack",onClick:ne=>{ne.preventDefault(),A.showAccount=O},children:[e(lt,{url:O.avatarStatic,size:p.length<=10?"xxl":p.length<20?"xl":"l",alt:`${O.displayName} @${O.acct}`,squircle:O==null?void 0:O.bot},O.id),w==="favourite+reblog"&&e("div",{class:"account-sub-icons",children:O._types.map(ne=>e(S,{icon:$i[ne],size:"s",class:`${ne}-icon`}))})]},O.id)," "]},O.id)),e("button",{type:"button",class:"small plain",onClick:Z,children:[p.length>$n&&`+${p.length-$n}`,e(S,{icon:"chevron-down"})]})]}),!(p!=null&&p.length)&&(v==null?void 0:v.length)>1&&e("p",{class:"avatars-stack",children:[v.map(O=>e(q,{children:[e("a",{href:O.url,rel:"noopener noreferrer",class:"account-avatar-stack",onClick:ne=>{ne.preventDefault(),A.showAccount=O},children:e(lt,{url:O.avatarStatic,size:"xxl",alt:`${O.displayName} @${O.acct}`,squircle:O==null?void 0:O.bot},O.id)},O.id)," "]},O.id)),b>v.length&&e(ue,{to:n?`/${n}/s/${f.id}`:`/s/${f.id}`,class:"button small plain centered",children:["+",b-v.length,e(S,{icon:"chevron-right"})]})]}),(u==null?void 0:u.length)>1&&e("ul",{class:"notification-group-statuses",children:u.map(O=>e("li",{children:e(Di,{class:`status-link status-type-${w}`,to:n?`/${n}/s/${O.id}`:`/s/${O.id}`,children:e(qe,{status:O,size:"s",previewMode:!0,allowContextMenu:!0})})},O.id))}),f&&(!(u!=null&&u.length)||(u==null?void 0:u.length)<=1)&&e(Di,{class:`status-link status-type-${w}`,to:n?`/${n}/s/${y}`:`/s/${y}`,onContextMenu:s?void 0:O=>{const ne=O.target.querySelector(".status");if(ne){if(O.metaKey)return;O.preventDefault(),ne.dispatchEvent(new MouseEvent("contextmenu",{clientX:O.clientX,clientY:O.clientY}))}},children:i?e(qe,{status:k,size:"s",readOnly:!0,allowContextMenu:!0}):e(qe,{statusID:y,size:"s",readOnly:!0,allowContextMenu:!0})})]})]})}function Di(t){const n=bo();return e(ue,{...t,"data-read-more":g._({id:"8fZueG"}),ref:n})}const Cn=ct(Qc,(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 ea=ct(function(){if(!("serviceWorker"in navigator))return null;const n=Be(A),{routeNotification:i}=n,{id:s,accessToken:o}=i||{},[a,f]=L(!1);vt(()=>{if(!s||!o)return;const{instance:c}=ce(),{masto:r,instance:m}=ce({accessToken:o}),h=c===m,p=o?Xs(o):Yn();(async()=>{const u=await r.v1.notifications.$select(s).fetch();if(u&&p){const v=p.instanceURL,{type:b,status:w,account:k}=u,y=!!document.querySelector("#modal-container > *"),C=b==="follow"&&!!(k!=null&&k.id),_=!!(k!=null&&k.id),T=!!(w!=null&&w.id);C&&h?A.showAccount={account:k,instance:v}:y||!h||_&&T?f({id:s,account:p,notification:u,sameInstance:h}):T?location.hash=`/${c}/s/${w.id}`:C?location.hash=`/${c}/a/${k.id}`:location.hash="/notifications"}})()},[s,o]),vt(()=>{navigator!=null&&navigator.clearAppBadge&&navigator.clearAppBadge()},[]),Bt(c=>{c&&(navigator!=null&&navigator.clearAppBadge)&&navigator.clearAppBadge()});const d=()=>{f(!1),A.routeNotification=null,/\/notifications\?id=/i.test(location.hash)&&(location.hash="/notifications")};if(a){const{id:c,account:r,notification:m,sameInstance:h}=a;return e(ze,{onClick:p=>{p.target===p.currentTarget&&d()},children:e("div",{class:"sheet",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:d,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(l,{id:"5+87Pq"})})}),e("main",{children:[!h&&e("p",{children:e(l,{id:"k9N0Xk"})}),e("div",{class:"notification-peek",onClick:p=>{const{target:u}=p;(p.target.tagName==="BUTTON"||p.target.tagName==="A")&&d()},children:e(Cn,{instance:r.instanceURL,notification:m,isStatic:!0})}),e("div",{style:{textAlign:"end"},children:e(ue,{to:"/notifications",class:"button light",onClick:d,children:[e("span",{children:e(l,{id:"/WA/tl"})})," ",e(S,{icon:"arrow-right"})]})})]})]})})}return null}),Is=eo((t,n)=>{const{instance:i}=ce(),[s,o]=ut(),[a,f]=L(!1),[d,c]=L(s.get("q")||""),r=s.get("type"),m=j(null),h=j(null);return Qs(n,()=>({setValue:p=>{c(p)},focus:()=>{h.current.focus()},select:()=>{h.current.select()},blur:()=>{h.current.blur()}})),e("form",{ref:m,class:"search-popover-container",onSubmit:p=>{var v;if(p.preventDefault(),/\/search/.test(location.hash))if(d){const b={q:d};r&&(b.type=r),o(b)}else o({});else d?location.hash=`/search?q=${encodeURIComponent(d)}${r?`&type=${r}`:""}`:location.hash="/search";(v=t==null?void 0:t.onSubmit)==null||v.call(t,p)},children:[e("input",{ref:h,value:d,name:"q",type:"search",placeholder:g._({id:"A1taO8"}),dir:"auto",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",onSearch:p=>{p.target.value||o({})},onInput:p=>{c(p.target.value),f(!0)},onFocus:()=>{var p,u;f(!0),(u=(p=m.current)==null?void 0:p.querySelector(".search-popover-item"))==null||u.classList.add("focus")},onBlur:()=>{var p,u;setTimeout(()=>{f(!1)},100),(u=(p=m.current)==null?void 0:p.querySelector(".search-popover-item.focus"))==null||u.classList.remove("focus")},onKeyDown:p=>{var v;const{key:u}=p;switch(u){case"Escape":f(!1);break;case"Down":case"ArrowDown":if(p.preventDefault(),a){const b=m.current.querySelector(".search-popover-item.focus");if(b){let w=b.nextElementSibling;for(;w&&w.hidden;)w=w.nextElementSibling;w&&(w.classList.add("focus"),Array.from(w.parentElement.children).filter(y=>y!==w).forEach(y=>{y.classList.remove("focus")}))}else{const w=m.current.querySelector(".search-popover-item");w&&w.classList.add("focus")}}break;case"Up":case"ArrowUp":if(p.preventDefault(),a){const b=document.querySelector(".search-popover-item.focus");if(b){let w=b.previousElementSibling;for(;w&&w.hidden;)w=w.previousElementSibling;w&&(w.classList.add("focus"),Array.from(w.parentElement.children).filter(y=>y!==w).forEach(y=>{y.classList.remove("focus")}))}else{const w=document.querySelector(".search-popover-item:last-child");w&&w.classList.add("focus")}}break;case"Enter":if(a){const b=document.querySelector(".search-popover-item.focus");b&&(p.preventDefault(),b.click()),f(!1),(v=t==null?void 0:t.onSubmit)==null||v.call(t,p)}break}}}),e("div",{class:"search-popover",hidden:!a||!d,children:!!d&&[{label:e(l,{id:"48oDit",values:{query:d},components:{0:e("small",{class:"insignificant"})}}),to:`/search?q=${encodeURIComponent(d)}`,top:!r&&!/\s/.test(d),hidden:!!r},{label:e(l,{id:"o1mMWT",values:{query:d},components:{0:e("q",{})}}),to:`/search?q=${encodeURIComponent(d)}&type=statuses`,hidden:/^https?:/.test(d),top:/\s/.test(d),icon:"document",queryType:"statuses"},{label:e(l,{id:"YAZw8D",values:{0:d.replace(/^#/,"")},components:{0:e("mark",{})}}),to:`/${i}/t/${d.replace(/^#/,"")}`,hidden:/^@/.test(d)||/^https?:/.test(d)||/\s/.test(d),top:/^#/.test(d),type:"link",icon:"hashtag",queryType:"hashtags"},{label:e(l,{id:"gEoOUj",values:{query:d},components:{0:e("mark",{})}}),to:`/${d}`,hidden:!/^https?:/.test(d),top:/^https?:/.test(d),type:"link"},{label:e(l,{id:"cDoNQr",values:{query:d},components:{0:e("q",{})}}),to:`/search?q=${encodeURIComponent(d)}&type=accounts`,icon:"group",queryType:"accounts"}].sort((p,u)=>{if(r){if(p.queryType===r)return-1;if(u.queryType===r)return 1}return p.top&&!u.top?-1:!p.top&&u.top?1:0}).filter(({hidden:p})=>!p).map(({label:p,to:u,icon:v,type:b},w)=>e(ue,{to:u,class:`search-popover-item ${w===0?"focus":""}`,onClick:k=>{var y;(y=t==null?void 0:t.onSubmit)==null||y.call(t,k)},children:[e(S,{icon:v||(b==="link"?"arrow-right":"search"),class:"more-insignificant"}),e("span",{children:p})," "]}))})]})}),ta=ct(function({onClose:n=()=>{}}){const[i,s]=L(!1),o=j(null);Ue(["Slash","/"],f=>{s(!0),setTimeout(()=>{var d,c,r,m;(c=(d=o.current)==null?void 0:d.focus)==null||c.call(d),(m=(r=o.current)==null?void 0:r.select)==null||m.call(r)},0)},{preventDefault:!0,ignoreEventWhen:f=>{const d=/\/search/.test(location.hash),c=!!document.querySelector("#modal-container > *");return d||c}});const a=()=>{s(!1),n()};return Ue("esc",f=>{var d,c;(c=(d=o.current)==null?void 0:d.blur)==null||c.call(d),a()},{enabled:i,enableOnFormTags:!0,preventDefault:!0}),e("div",{id:"search-command-container",hidden:!i,onClick:f=>{f.target===f.currentTarget&&a()},children:e(Is,{ref:o,onSubmit:()=>{a()}})})});function na(){const{_:t}=Xe(),{instance:n}=ce(),i=Be(A),{shortcuts:s,settings:o}=i;if(!s.length||o.shortcutsViewMode==="multi-column"||!o.shortcutsViewMode&&o.shortcutsColumnsMode)return null;const a=j(),f=j(!1),d=s.map((h,p)=>{const{type:u,...v}=h;if(!kn[u])return null;let{id:b,path:w,title:k,subtitle:y,icon:C}=kn[u];return typeof b=="function"&&(b=b(v,p)),typeof w=="function"&&(w=w({...v,instance:v.instance||n},p)),typeof k=="function"?k=k(v,p):k=t(k),typeof y=="function"?y=y(v,p):y=t(y),typeof C=="function"&&(C=C(v,p)),b==="lists"&&(f.current=!0),{id:b,path:w,title:k,subtitle:y,icon:C}}).filter(Boolean),c=Xi();Ue(["1","2","3","4","5","6","7","8","9"],(h,p)=>{var v,b;const u=parseInt(p.keys[0],10)-1;if(u{h.preventDefault(),A.showShortcutsSettings=!0},children:e("ul",{children:d.map(({id:h,path:p,title:u,subtitle:v,icon:b},w)=>e("li",{children:e(ue,{class:v?"has-subtitle":"",to:p,onClick:k=>{if(k.target.classList.contains("is-active")){k.preventDefault();const y=document.getElementById(`${h}-page`);if(y){y.scrollTop=0;const C=y.querySelector(".updates-button");C&&C.click()}}},children:[e(S,{icon:b,size:"xl",alt:u}),e("span",{children:[e(dn,{children:u}),v&&e(q,{children:[e("br",{}),e("small",{children:v})]})]})]})},`${w}-${h}-${u}-${v}-${p}`))})}):e(ot,{instanceRef:a,overflow:"auto",viewScroll:"close",menuClassName:"glass-menu shortcuts-menu",gap:8,position:"anchor",onMenuChange:h=>{h.open&&f.current&&sn().then(m)},menuButton:e("button",{type:"button",id:"shortcuts-button",class:"plain",onContextMenu:h=>{h.preventDefault(),A.showShortcutsSettings=!0},onTransitionStart:h=>{var p,u;try{const{target:v}=h;getComputedStyle(v).pointerEvents==="none"&&((u=(p=a.current)==null?void 0:p.closeMenu)==null||u.call(p))}catch{}},children:e(S,{icon:"shortcut",size:"xl",alt:g._({id:"CTqTgr"})})}),children:d.map(({id:h,path:p,title:u,subtitle:v,icon:b},w)=>h==="lists"?e(bn,{menuClassName:"glass-menu",overflow:"auto",gap:-8,label:e(q,{children:[e(S,{icon:b,size:"l"}),e("span",{class:"menu-grow",children:e(dn,{children:u})}),e(S,{icon:"chevron-right"})]}),children:[e(Oe,{to:"/l",children:e("span",{children:e(l,{id:"BHWx+g"})})}),e(Ye,{}),r==null?void 0:r.map(k=>e(Oe,{to:`/l/${k.id}`,children:e("span",{children:k.title})},k.id))]}):e(Oe,{to:p,class:"glass-menu-item",children:[e(S,{icon:b,size:"l"})," ",e("span",{class:"menu-grow",children:[e("span",{children:e(dn,{children:u})}),v&&e(q,{children:[" ",e("small",{class:"more-insignificant",children:v})]})]}),e("span",{class:"menu-shortcut hide-until-focus-visible",children:w+1})]},`${w}-${h}-${u}-${v}-${p}`))})})}const ia=ct(na);function sa(t){var o;let n=[],i=[],s=0;for(let a=0;a10&&(i.length>t.length/4||s>=3)){const a=i.map(f=>f.id);if(i.length>t.length*3/4)n=[...n,{id:a,items:i,type:"boosts"}];else{const f=Math.floor(n.length/2);n=[...n.slice(0,f),{id:a,items:i,type:"boosts"},...n.slice(f)]}return n}else return t}function Pi(t,n){const i=he.account.get("boostedStatusIDs")||{},s=t.filter(a=>{if(!a.reblog)return!0;const f=`${n}-${a.reblog.id}`,d=i[f];return d&&d!==a.id?!1:(i[f]=a.id,!0)}),o=Object.keys(i);return o.length>50&&o.slice(0,o.length-50).forEach(a=>{delete i[a]}),he.account.set("boostedStatusIDs",i),s}function oa(t,n){const i=[];let s=0;t.forEach(d=>{for(let r=0;rm.id===d.id))return;if(i[r].find(m=>m.id===d.inReplyToId)||i[r].find(m=>m.inReplyToId===d.id)){i[r].push(d);return}}const c=t.find(r=>r.id===d.inReplyToId);c&&(i[s++]=[d,c])});for(let d=0;di[c].includes(m))&&(i[d]=[...i[d],...i[c]],i[d]=i[d].filter((m,h,p)=>p.findIndex(u=>u.id===m.id)===h),i.splice(c,1),c--);i.forEach(d=>{d.sort((c,r)=>!c.inReplyToId&&!r.inReplyToId?new Date(c.createdAt)-new Date(r.createdAt):c.inReplyToId===r.id?1:r.inReplyToId===c.id||!c.inReplyToId?-1:r.inReplyToId?new Date(c.createdAt)-new Date(r.createdAt):1)}),i.forEach(d=>{const c=d[0].account.id;d.forEach(r=>{r.account.id!==c&&(r._differentAuthor=!0)})}),i.length;const o=[],a=[],f=[];return t.forEach(d=>{if(d.reblog){o.push(d);return}for(let c=0;cr.id===d.id)){if(a.includes(c))return;const r=i[c];r.sort((h,p)=>{const u=new Date(h.createdAt),v=new Date(p.createdAt);return u-v});const m=r[0].account.id;o.push({id:r.map(h=>h.id),items:r,type:r.every(h=>h.account.id===m)?"thread":"conversation"}),a.push(c);return}if(d.inReplyToId&&d.inReplyToAccountId!==d.account.id){const c=st(d.id,n);A.statusReply[c]||f.push({sKey:c,inReplyToId:d.inReplyToId})}o.push(d)}),f!=null&&f.length&&queueMicrotask(()=>{const{masto:d}=ce({instance:n});async function c(){for(let r=0;rsetTimeout(u,1e3))}catch{}}}if(Je("@mastodon/fetch-multiple-statuses")){const r=f.map(({inReplyToId:m})=>m);(async()=>{var m;try{const h=await d.v1.statuses.list({id:r});if(h!=null&&h.length)for(const p of h){Ge(p,n,{skipThreading:!0});const u=(m=f.find(({inReplyToId:v})=>v===p.id))==null?void 0:m.sKey;u&&(A.statusReply[u]={id:p.id,instance:n})}else c()}catch{c()}})()}else c()}),o}const ca=wt((t,n)=>n.v1.statuses.$select(t).fetch());async function Ts(t,n){const i=await Hc();if(!i.length)return;const{statusFollowedTags:s}=A,o=[];if(t.forEach(a=>{var p;if(a.reblog)return;const{id:f,content:d,tags:c=[]}=a,r=st(f,n);if((p=s[r])!=null&&p.length)return;const m=jc(d);if(!m.length&&!c.length)return;const h=i.reduce((u,v)=>((m.some(b=>b.toLowerCase()===v.name.toLowerCase())||c.some(b=>b.name.toLowerCase()===v.name.toLowerCase()))&&u.push(v.name),u),[]);h.length&&o.push({item:a,sKey:r,followedTags:h})}),o.length){const a=o.map(d=>d.item.account),f=await Kn(a);if(!f)return;o.forEach(d=>{const{item:c,sKey:r,followedTags:m}=d,h=f[c.account.id];h&&!h.following&&(s[r]=m)})}}function aa(){A.statusFollowedTags={}}function ra({scrollableRef:t,distanceFromStart:n=1,distanceFromEnd:i=1,scrollThresholdStart:s=10,scrollThresholdEnd:o=10,direction:a="vertical",distanceFromStartPx:f,distanceFromEndPx:d}={}){const[c,r]=L(null),[m,h]=L(!1),[p,u]=L(!1),[v,b]=L(!1),[w,k]=L(!1),y=a==="vertical";return vt(()=>{const C=t.current;if(!C)return{};let _=y?C.scrollTop:C.scrollLeft;function T(){const{scrollTop:I,scrollLeft:x,scrollHeight:z,scrollWidth:D,clientHeight:M,clientWidth:G}=C,se=y?I:x,Z=y?z:D,P=y?M:G,N=Math.abs(se-_),U=f||Math.min(P*n,Z,se),Y=d||Math.min(P*i,Z,Z-se-P);N>=(_=Z),b(se<=U),k(se+P>=Z-Y)}return C.addEventListener("scroll",T,{passive:!0}),()=>C.removeEventListener("scroll",T)},[n,i,s,o]),{scrollDirection:c,reachStart:m,reachEnd:p,nearReachStart:v,nearReachEnd:w,init:()=>{t.current&&t.current.dispatchEvent(new Event("scroll"))}}}function la({scrollableRef:t,distanceFromStart:n=1,distanceFromEnd:i=1,scrollThresholdStart:s=10,scrollThresholdEnd:o=10,direction:a="vertical",distanceFromStartPx:f,distanceFromEndPx:d,init:c}={},r,m){if(!r)return;const h=a==="vertical",p=j(null),u=j(null),v=vo(()=>{let b=!1,w=!1,k=!1,y=!1;const C=t.current,{scrollTop:_,scrollLeft:T,scrollHeight:I,scrollWidth:x,clientHeight:z,clientWidth:D}=C,M=h?_:T,G=h?I:x,se=h?z:D,Z=Math.abs(M-p.current),P=f||Math.min(se*n,G,M),N=d||Math.min(se*i,G,G-M-se);Z>=(p.current=G,k=M<=P,y=M+se>=G-N,r({scrollDirection:u.current,reachStart:b,reachEnd:w,nearReachStart:k,nearReachEnd:y})},500);vt(()=>{const b=t.current;return b?(p.current=b[h?"scrollTop":"scrollLeft"],b.addEventListener("scroll",v,{passive:!0}),()=>b.removeEventListener("scroll",v)):{}},[n,i,s,o,...m]),X(()=>{c&&t.current&&queueMicrotask(()=>{t.current.dispatchEvent(new Event("scroll"))})},[c])}function da({class:t,statusID:n,status:i,instance:s,parent:o,onMediaClick:a}){let f=st(n,s);const d=Be(A);if(i||(i=d.statuses[f]||d.statuses[n],f=st(i==null?void 0:i.id,s)),!i)return null;const{account:{acct:c,avatar:r,avatarStatic:m,id:h,url:p,displayName:u,username:v,emojis:b,bot:w,group:k},id:y,repliesCount:C,reblogged:_,reblogsCount:T,favourited:I,favouritesCount:x,bookmarked:z,poll:D,muted:M,sensitive:G,spoilerText:se,visibility:Z,language:P,editedAt:N,filtered:U,card:Y,createdAt:F,inReplyToId:ie,inReplyToAccountId:O,content:ne,mentions:ye,mediaAttachments:ee,reblog:fe,uri:ve,url:pe,emojis:we,_deleted:$e,_pinned:Me}=i;if(!(ee!=null&&ee.length))return null;const xe=$=>{$.shiftKey},Ee=be(()=>bt(),[]),Fe=be(()=>Ee&&Ee===h,[h,Ee]),ke=to(cs),J=!Fe&&en(U,ke);if((J==null?void 0:J.action)==="hide")return null;const me=G,re=be(()=>{var E;return((E=(he.account.get("preferences")||{})["reading:expand:media"])==null?void 0:E.toLowerCase())||"default"},[])==="show_all",W=o||"div";return ee.map(($,E)=>{const B=`${f}-${$.id}`,K=J==null?void 0:J.titlesStr;return e(W,{"data-state-post-id":f,onMouseEnter:xe,"data-spoiler-text":se||(G?g._({id:"FKojeB"}):void 0),"data-filtered-text":J?K?g._({id:"7FGvtQ",values:{filterTitleStr:K}}):g._({id:"03Qqf9"}):void 0,class:` media-post ${J?"filtered":""} ${me?"has-spoiler":""} ${re?"show-media":""} `,children:e(os,{class:t,media:$,lang:P,to:`/${s}/s/${y}?media-only=${E+1}`,onClick:a?le=>a(le,E,$,i):void 0})},B)})}const Ni=ct(da);function ua(t){var T,I,x,z,D;const n=Be(A),{masto:i,instance:s,authenticated:o}=ce(),[a,f]=be(()=>{const M=he.local.getJSON("accounts")||[];return[M.find(se=>se.info.id===bt())||M[0],M.length>1]},[]),d=(n.settings.shortcutsViewMode==="multi-column"||!n.settings.shortcutsViewMode&&n.settings.shortcutsColumnsMode)&&!n.shortcuts.find(M=>M.type==="following"),c=yo(()=>{A.showAccounts=!0},{threshold:600,detect:"touch",cancelOnMovement:!0}),r=j(),[m,h]=L(void 0),p=wo([0,0,n.settings.shortcutsViewMode==="tab-menu-bar"?50:0,0]),u=j();async function v(M){return(M||!u.current)&&(u.current=i.v1.mutes.list({limit:80})),await u.current.next()}const b=j();async function w(M){return(M||!b.current)&&(b.current=i.v1.blocks.list({limit:80})),await b.current.next()}const k=Je("@mastodon/lists"),[y,C]=L([]);X(()=>{k&&m==="open"&&sn().then(C)},[m==="open"]);const _=j();return e(q,{children:[e("button",{ref:r,type:"button",class:`button plain nav-menu-button ${f?"with-avatar":""} ${m==="open"?"active":""}`,style:{position:"relative"},onClick:()=>{_.current=Date.now(),h(M=>M?void 0:"open")},onContextMenu:M=>{M.preventDefault(),A.showAccounts=!0},...c(),children:[f&&e(lt,{url:((T=a==null?void 0:a.info)==null?void 0:T.avatar)||((I=a==null?void 0:a.info)==null?void 0:I.avatarStatic),size:"l",squircle:(x=a==null?void 0:a.info)==null?void 0:x.bot}),e(S,{icon:"menu",size:f?"s":"l",alt:g._({id:"zucql+"})})]}),e(as,{menuClassName:"nav-menu",state:m,anchorRef:r,onClose:()=>{h(void 0)},containerProps:{style:{zIndex:10},onClick:()=>{Date.now()-_.current<300}},portal:{target:document.body},...t,overflow:"auto",viewScroll:"close",position:"anchor",align:"center",boundingBoxPadding:p,unmountOnClose:!0,children:[!!((z=n.appVersion)!=null&&z.commitHash)&&n.appVersion.commitHash!=="1b8ab47"&&e("div",{class:"top-menu",children:[e(ge,{onClick:()=>{confirm(g._({id:"Djbaby"}))&&(async()=>{try{location.reload()}catch{}})()},children:[e(S,{icon:"sparkles",class:"sparkle-icon",size:"l"})," ",e("span",{children:e(l,{id:"95IFnD"})})]}),e(Ye,{})]}),e("section",{children:[e(Oe,{to:"/",children:[e(S,{icon:"home",size:"l"})," ",e("span",{children:e(l,{id:"i0qMbr"})})]}),o?e(q,{children:[d&&e(Oe,{to:"/following",children:[e(S,{icon:"following",size:"l"})," ",e("span",{children:e(l,{id:"y6sq5j"})})]}),e(Oe,{to:"/catchup",children:[e(S,{icon:"history2",size:"l"}),e("span",{children:e(l,{id:"xrl8fj"})})]}),Je("@mastodon/mentions")&&e(Oe,{to:"/mentions",children:[e(S,{icon:"at",size:"l"})," ",e("span",{children:e(l,{id:"/bZzdR"})})]}),e(Oe,{to:"/notifications",children:[e(S,{icon:"notification",size:"l"})," ",e("span",{children:e(l,{id:"iDNBZe"})}),n.notificationsShowNew&&e("sup",{title:g._({id:"isRobC"}),style:{opacity:.5},children:[" ","โ€ข"]})]}),e(Ye,{}),((D=a==null?void 0:a.info)==null?void 0:D.id)&&e(Oe,{to:`/${s}/a/${a.info.id}`,children:[e(S,{icon:"user",size:"l"})," ",e("span",{children:e(l,{id:"vERlcd"})})]}),(y==null?void 0:y.length)>0?e(bn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(q,{children:[e(S,{icon:"list",size:"l"}),e("span",{class:"menu-grow",children:e(l,{id:"h16FyT"})}),e(S,{icon:"chevron-right"})]}),children:[e(Oe,{to:"/l",children:e("span",{children:e(l,{id:"BHWx+g"})})}),(y==null?void 0:y.length)>0&&e(q,{children:[e(Ye,{}),y.map(M=>e(Oe,{to:`/l/${M.id}`,children:e("span",{children:M.title})},M.id))]})]}):k&&e(Oe,{to:"/l",children:[e(S,{icon:"list",size:"l"}),e("span",{children:e(l,{id:"h16FyT"})})]}),e(Oe,{to:"/b",children:[e(S,{icon:"bookmark",size:"l"})," ",e("span",{children:e(l,{id:"7Ff7ia"})})]}),e(bn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(q,{children:[e(S,{icon:"more",size:"l"}),e("span",{class:"menu-grow",children:e(l,{id:"24misb"})}),e(S,{icon:"chevron-right"})]}),children:[e(Oe,{to:"/f",children:[e(S,{icon:"heart",size:"l"})," ",e("span",{children:e(l,{id:"zZOZj7"})})]}),e(Oe,{to:"/fh",children:[e(S,{icon:"hashtag",size:"l"})," ",e("span",{children:e(l,{id:"Xi1/bw"})})]}),e(Ye,{}),Je("@mastodon/filters")&&e(Oe,{to:"/ft",children:[e(S,{icon:"filters",size:"l"})," ",e("span",{children:e(l,{id:"cSev+j"})})]}),e(ge,{onClick:()=>{A.showGenericAccounts={id:"mute",heading:g._({id:"sOKhEA"}),fetchAccounts:v,excludeRelationshipAttrs:["muting"]}},children:[e(S,{icon:"mute",size:"l"})," ",e("span",{children:e(l,{id:"n1sANU"})})]}),e(ge,{onClick:()=>{A.showGenericAccounts={id:"block",heading:g._({id:"nL8nlr"}),fetchAccounts:w,excludeRelationshipAttrs:["blocking"]}},children:[e(S,{icon:"block",size:"l"})," ",e("span",{children:e(l,{id:"r3RRWo"})})]})," "]}),e(Ye,{}),e(ge,{onClick:()=>{A.showAccounts=!0},children:[e(S,{icon:"group",size:"l"})," ",e("span",{children:e(l,{id:"7e0O8Z"})})]})]}):e(q,{children:[e(Ye,{}),e(Oe,{to:"/login",children:[e(S,{icon:"user",size:"l"})," ",e("span",{children:e(l,{id:"sQia9P"})})]})]})]}),e("section",{children:[e(Ye,{}),e(Oe,{to:"/search",children:[e(S,{icon:"search",size:"l"})," ",e("span",{children:e(l,{id:"A1taO8"})})]}),e(Oe,{to:`/${s}/trending`,children:[e(S,{icon:"chart",size:"l"})," ",e("span",{children:e(l,{id:"4/iCqx"})})]}),e(Oe,{to:`/${s}/p/l`,children:[e(S,{icon:"building",size:"l"})," ",e("span",{children:e(l,{id:"d5zxa4"})})]}),e(Oe,{to:`/${s}/p`,children:[e(S,{icon:"earth",size:"l"})," ",e("span",{children:e(l,{id:"4ERYY7"})})]}),o?e(q,{children:[e(Ye,{className:"divider-grow"}),e(ge,{onClick:()=>{A.showKeyboardShortcutsHelp=!0},children:[e(S,{icon:"keyboard",size:"l"})," ",e("span",{children:e(l,{id:"77Emn0"})})]}),e(ge,{onClick:()=>{A.showShortcutsSettings=!0},children:[e(S,{icon:"shortcut",size:"l"})," ",e("span",{children:e(l,{id:"8Kudkr"})})]}),e(ge,{onClick:()=>{A.showSettings=!0},children:[e(S,{icon:"gear",size:"l"})," ",e("span",{children:e(l,{id:"uVbUP8"})})]})]}):e(q,{children:[e(Ye,{}),e(ge,{onClick:()=>{A.showSettings=!0},children:[e(S,{icon:"gear",size:"l"})," ",e("span",{children:e(l,{id:"uVbUP8"})})]})]})]})]})]})}const Pt=ct(ua),cn={block:"nearest",inline:"center",behavior:"smooth"};function kt({title:t,titleComponent:n,id:i,instance:s,emptyText:o,errorText:a,useItemID:f,boostsCarousel:d,fetchItems:c=()=>{},checkForUpdates:r=()=>{},checkForUpdatesInterval:m=15e3,headerStart:h,headerEnd:p,timelineStart:u,refresh:v,view:b,filterContext:w,showFollowedTags:k,showReplyParent:y,clearWhenRefresh:C}){const _=Be(A),[T,I]=L([]),[x,z]=L("start"),[D,M]=L(!1),[G,se]=L(!1),[Z,P]=L(!0),N=j(),U=be(()=>Vn(),[]),Y=b!=="media",F=j(0),ie=ko(J=>{se(!1),z("loading"),(async()=>{try{const me=F.current=Date.now();let{done:Te,value:re}=await c(J);if(me!==F.current)return;if(Array.isArray(re)){const[W,$]=re.reduce((E,B)=>(B._pinned?E[0].push(B):E[1].push(B),E),[[],[]]);re=$,Y&&(d&&(re=sa(re)),re=oa(re,s)),W.length&&(re=W.concat(re)),I(J?re:E=>[...E,...re]),re.length||(Te=!0),M(!Te)}else M(!1);z("default")}catch{z("error"),J&&!T.length&&a&&de(a)}finally{ie.cancel()}})()},1e3,{leading:!0}),O=".timeline-item, .timeline-item-alt",ne=Ue("j, shift+j",(J,me)=>{const Te=document.activeElement.closest(O),re=Te==null?void 0:Te.getBoundingClientRect(),W=Array.from(N.current.querySelectorAll(O));if(Te&&re.top0){const $=W.indexOf(Te);let E=W[$+1];me.shift&&(E=W.find((B,K)=>K>$&&!B.classList.contains("timeline-item-alt"))),E&&(E.focus(),E.scrollIntoView(cn))}else{const $=W.find(E=>{const B=E.getBoundingClientRect();return B.top>=44&&B.left>=0});$&&($.focus(),$.scrollIntoView(cn))}}),ye=Ue("k, shift+k",(J,me)=>{const Te=document.activeElement.closest(O),re=Te==null?void 0:Te.getBoundingClientRect(),W=Array.from(N.current.querySelectorAll(O));if(Te&&re.top0){const $=W.indexOf(Te);let E=W[$-1];me.shift&&(E=W.findLast((B,K)=>K<$&&!B.classList.contains("timeline-item-alt"))),E&&(E.focus(),E.scrollIntoView(cn))}else{const $=W.find(E=>{const B=E.getBoundingClientRect();return B.top>=44&&B.left>=0});$&&($.focus(),$.scrollIntoView(cn))}}),ee=Ue(["enter","o"],()=>{const J=document.activeElement;J!=null&&J.matches(O)&&J.click()}),fe=T.length>0&&x!=="loading"&&G,ve=it(()=>{var J;fe&&ie(!0),(J=N.current)==null||J.scrollTo({top:0,behavior:"smooth"})},[ie,fe]),pe=Ue(".",ve),we=j(),[$e,Me]=L(!1);la({scrollableRef:N,distanceFromEnd:2,scrollThresholdStart:44},({scrollDirection:J,nearReachStart:me,reachStart:Te})=>{if(we.current){const re=J==="end"&&!me;we.current.hidden=re}Me(me),Te&&ie(!0)},[]),X(()=>{var J;(J=N.current)==null||J.scrollTo({top:0}),ie(!0)},[]);const xe=j(!0);X(()=>{var J;if(xe.current){xe.current=!1;return}C&&(T!=null&&T.length)&&((J=ie.cancel)==null||J.call(ie),I([])),ie(!0)},[C,v]);const Ee=j(b);X(()=>{Ee.current!==b&&(Ee.current=b,I([]))},[b]);const Fe=it(async({disableIdleCheck:J=!1}={})=>{const me=N.current?getComputedStyle(N.current).pointerEvents==="none":!1;_.settings.autoRefresh&&N.current.scrollTop<16&&(J||window.__IDLE__)&&!ma()&&!me?ie(!0):await r()&&se(!0)},[i,ie,r,_.settings.autoRefresh]),ke=j();return Bt(J=>{if(J){const me=Date.now()-ke.current;(!ke.current||me>1e3*3)&&Fe({disableIdleCheck:!0})}else ke.current=Date.now();P(J)},[r,Fe,_.settings.autoRefresh]),Wn(Fe,Z&&!G?m*($e?1:2):null),e(cs.Provider,{value:w,children:e("div",{id:`${i}-page`,class:`deck-container ${U?"deck-container-media-first":""}`,ref:J=>{N.current=J,ne.current=J,ye.current=J,ee.current=J,pe.current=J},tabIndex:"-1",onClick:J=>{we.current&&J.target.closest(".timeline-item, .timeline-item-alt")&&setTimeout(()=>{we.current.hidden=!1},250)},children:e("div",{class:"timeline-deck deck",children:[e("header",{ref:we,onClick:J=>{var me;J.target.closest("a, button")||(me=N.current)==null||me.scrollTo({top:0,behavior:"smooth"})},onDblClick:J=>{J.target.closest("a, button")||ie(!0)},class:x==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Pt,{}),h??e(ue,{to:"/",class:"button plain home-button",children:e(S,{icon:"home",size:"l",alt:g._({id:"i0qMbr"})})})]}),t&&(n||e("h1",{children:t})),e("div",{class:"header-side",children:!!p&&p})]}),fe&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:ve,children:[e(S,{icon:"arrow-up"})," ",e(l,{id:"2yr1/p"})]})]}),!!u&&e("div",{class:`timeline-start ${x==="loading"?"loading":""}`,children:u}),T.length?e(q,{children:[e("ul",{class:`timeline ${b?`timeline-${b}`:""}`,children:[T.map(J=>e(ha,{status:J,instance:s,useItemID:f,filterContext:w,view:b,showFollowedTags:k,showReplyParent:y,mediaFirst:U},J.id+(J==null?void 0:J._pinned)+b)),D&&x==="loading"&&(b==="media"?null:e(q,{children:[e("li",{style:{height:"20vh"},children:e(qe,{skeleton:!0,mediaFirst:U})}),e("li",{style:{height:"25vh"},children:e(qe,{skeleton:!0,mediaFirst:U})})]}))]}),x==="default"&&(D?e(yt,{root:N.current,rootMargin:`0px 0px ${screen.height*1.5}px 0px`,onChange:J=>{J&&ie()},children:e("button",{type:"button",class:"plain block",onClick:()=>ie(),style:{marginBlockEnd:"6em"},children:e(l,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(l,{id:"2EYeAZ"})}))]}):x==="loading"?e("ul",{class:"timeline",children:Array.from({length:5}).map((J,me)=>b==="media"?e("div",{style:{height:"50vh"}}):e("li",{children:e(qe,{skeleton:!0,mediaFirst:U})},me))}):x!=="error"&&x!=="start"&&e("p",{class:"ui-state",children:o}),x==="error"&&e("p",{class:"ui-state",children:[a,e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>ie(!T.length),children:e(l,{id:"KDw4GX"})})]})]})})})}const ha=ct(({status:t,instance:n,useItemID:i,filterContext:s,view:o,showFollowedTags:a,showReplyParent:f,mediaFirst:d})=>{const{id:c,reblog:r,items:m,type:h,_pinned:p}=t;p&&(i=!1);const u=(r==null?void 0:r.id)||c,v=n?`/${n}/s/${u}`:`/s/${u}`;if(m){let w=Rt(m,s),k="";if(h==="boosts"?k=`${w.length} Boosts`:h==="pinned"&&(k="Pinned posts"),h==="boosts"||h==="pinned"){const _=new Set;if(w.sort((T,I)=>{const x=en(T.filtered,s),z=en(I.filtered,s);return x&&_.add(T.id),z&&_.add(I.id),x&&!z?1:!x&&z?-1:0}),_.size>=2){const I=[],x=[];w.forEach(D=>{_.has(D.id)?x.push(D):I.push(D)});const z=[];for(let D=0;D{const{id:I,reblog:x,_pinned:z,_grouped:D}=T;if(D)return e("li",{class:"timeline-item-carousel-group",children:T.posts.map(se=>{const{id:Z,reblog:P,_pinned:N}=se,U=(P==null?void 0:P.id)||Z,Y=n?`/${n}/s/${U}`:`/s/${U}`;return N&&(i=!1),e(ue,{class:"status-carousel-link timeline-item-alt",to:Y,children:i?e(qe,{statusID:Z,instance:n,size:"s"}):e(qe,{status:se,instance:n,size:"s"})})})},I);const M=(x==null?void 0:x.id)||I,G=n?`/${n}/s/${M}`:`/s/${M}`;return z&&(i=!1),e("li",{children:e(ue,{class:"status-carousel-link timeline-item-alt",to:G,children:i?e(qe,{statusID:I,instance:n,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:d}):e(qe,{status:T,instance:n,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:d})})},I)})})},`timeline-${c}`)}const C=w.length>3;return w.map((_,T)=>{const{id:I,_differentAuthor:x}=_,z=n?`/${n}/s/${I}`:`/s/${I}`,D=T>0&&T0||C&&D&&(h==="thread"||h==="conversation"&&!x&&!w[T-1]._differentAuthor&&!w[T+1]._differentAuthor),se=T===0,Z=T===w.length-1;return e("li",{class:`timeline-item-container timeline-item-container-type-${h} timeline-item-container-${se?"start":Z?"end":"middle"} ${x?"timeline-item-diff-author":""}`,children:e(ue,{class:"status-link timeline-item",to:z,children:G?e(pa,{status:_,instance:n,filterContext:s}):i?e(qe,{statusID:I,instance:n,enableCommentHint:Z,showFollowedTags:a}):e(qe,{status:_,instance:n,enableCommentHint:Z,showFollowedTags:a})})},`timeline-${I}`)})}const b=`timeline-${c+p}`;return o==="media"?i?e(Ni,{class:"timeline-item",parent:"li",statusID:c,instance:n},b):e(Ni,{class:"timeline-item",parent:"li",status:t,instance:n},b):e("li",{children:e(ue,{class:"status-link timeline-item",to:v,children:i?e(qe,{statusID:c,instance:n,enableCommentHint:!0,showFollowedTags:a,showReplyParent:f,mediaFirst:d}):e(qe,{status:t,instance:n,enableCommentHint:!0,showFollowedTags:a,showReplyParent:f,mediaFirst:d})})},b)},(t,n)=>{var o,a;const i=(((o=t.status)==null?void 0:o.id)||"").toString(),s=(((a=n.status)==null?void 0:a.id)||"").toString();return i===s&&t.instance===n.instance&&t.view===n.view});function fa({title:t,class:n,children:i}){const s=j(),o=j(),a=j(),[f,d]=L(!1);return X(()=>{setTimeout(()=>{d(!0)},1)},[]),e("div",{class:`status-carousel ${n}`,children:[e("header",{children:[e("h3",{children:t}),e("span",{children:[e("button",{ref:o,type:"button",class:"small plain2",onClick:()=>{var r,m;const c=Math.min(320,(r=s.current)==null?void 0:r.offsetWidth)*(Et()?1:-1);(m=s.current)==null||m.scrollBy({left:c,behavior:"smooth"})},children:e(S,{icon:"chevron-left",alt:g._({id:"DHhJ7s"})})})," ",e("button",{ref:a,type:"button",class:"small plain2",onClick:()=>{var r,m;const c=Math.min(320,(r=s.current)==null?void 0:r.offsetWidth)*(Et()?-1:1);(m=s.current)==null||m.scrollBy({left:c,behavior:"smooth"})},children:e(S,{icon:"chevron-right",alt:g._({id:"hXzOVo"})})})]})]}),e("ul",{ref:s,children:[e(yt,{class:"status-carousel-beacon",onChange:c=>{o.current&&(o.current.disabled=c)}}),i[0],f&&i.slice(1),e(yt,{class:"status-carousel-beacon",onChange:c=>{a.current&&(a.current.disabled=c)}})]})]})}function pa({status:t,instance:n,filterContext:i}){const s=Be(A),{id:o,visibility:a,language:f}=t,d=Jn(t),c=st(o,n),r=en(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(S,{icon:"thread",size:"s",alt:g._({id:"e66y2Z"})}),s.statusThreadNumber[c]?` ${s.statusThreadNumber[c]}/X`:""]}):e("div",{class:"status-thread-badge",children:e(S,{icon:"thread",size:"s",alt:g._({id:"e66y2Z"})})}),e("div",{class:"content-compact",title:d,lang:f,dir:"auto",children:r?e("b",{class:"status-filtered-badge badge-meta horizontal",title:(r==null?void 0:r.titlesStr)||"",children:r!=null&&r.titlesStr?e(l,{id:"sr6maL",values:{0:r.titlesStr},components:{0:e("span",{}),1:e("span",{})}}):e("span",{children:e(l,{id:"03Qqf9"})})}):e(q,{children:[d,t.sensitive&&t.spoilerText&&e(q,{children:[" ",e("span",{class:"spoiler-badge",children:e(S,{icon:"eye-close",size:"s",alt:g._({id:"gnKo7f"})})})]})]})})]})}function ma(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}const Ut=20,di=1983,Oi=`${di}-01`,ga=(()=>{try{const t=document.createElement("input");return t.setAttribute("type","month"),t.type==="month"}catch{return!1}})();async function ba(t){var s;const{masto:n}=ce({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 va=wt(ba);function ya(){const t=Be(A),{id:n,...i}=Mt(),[s,o]=ut(),a=s.get("month"),f=!s.get("replies"),d=!!s.get("boosts"),c=s.get("tagged"),r=!!s.get("media"),{masto:m,instance:h,authenticated:p}=ce({instance:i.instance}),{masto:u,instance:v}=ce(),b=j(),w=[a,f,d,c,r],[k,y]=L(),C=j(0);X(()=>{C.current=0},w);const _=be(()=>Vn(),[]),T=be(()=>h===v,[h,v]),[I,x]=L(!1);X(()=>{T&&k!=null&&k.acct&&(async()=>{const ee=await va(h);x(ee)})()},[h,T,k==null?void 0:k.acct]);async function z(ee){var Me,xe,Ee,Fe;const fe=/^\d{4}-[01]\d$/.test(a),ve=((xe=(Me=a==null?void 0:a.split)==null?void 0:Me.call(a,"-"))==null?void 0:xe[0])>=di;if(fe&&ve){if(!k)return{value:[],done:!0};const[ke,J]=a.split("-"),me=parseInt(J,10)-1,Te=new Date(ke,me,0),re=`${Te.getFullYear()}-${(Te.getMonth()+1).toString().padStart(2,"0")}-${Te.getDate().toString().padStart(2,"0")}`,W=new Date(ke,me+1,1),$=`${W.getFullYear()}-${(W.getMonth()+1).toString().padStart(2,"0")}-${W.getDate().toString().padStart(2,"0")}`;let E;ee?(E=Ut+1,C.current=0):(E=Ut+C.current+1,C.current+=Ut);const B=await m.v2.search.fetch({q:`from:${k.acct} after:${re} before:${$}`,type:"statuses",limit:E,offset:C.current});if((Ee=B==null?void 0:B.statuses)!=null&&Ee.length){const K=B.statuses.slice(0,Ut);K.forEach(Ce=>{Ge(Ce,h)});const le=B.statuses.length<=Ut;return{value:K,done:le}}else return{value:[],done:!0}}let pe=[];if(ee){const{value:ke}=await m.v1.accounts.$select(n).statuses.list({pinned:!0}).next();if(ke!=null&&ke.length&&!c&&!r){const J=ke.map(me=>(Ge(me,h),{...me,_pinned:!0}));if(J.length>=3){const me=J.map(Te=>Te.id);pe.push({id:me,items:J,type:"pinned"})}else pe.push(...J)}}(ee||!b.current)&&(b.current=m.v1.accounts.$select(n).statuses.list({limit:Ut,exclude_replies:f,exclude_reblogs:d,only_media:r||void 0,tagged:c}));const{value:we,done:$e}=await b.current.next();if(we!=null&&we.length){if(pe.length){let ke=[];((Fe=pe[0])==null?void 0:Fe.type)==="pinned"?ke=pe[0].id:ke=pe.filter(me=>me._pinned).map(me=>me.id),ke.every(me=>we.some(Te=>Te.id===me))&&(pe=[])}pe.push(...we),we.forEach(ke=>{Ge(ke,h)})}return{value:pe,done:$e}}const[D,M]=L([]),{i18n:G}=Xe();let se=G._({id:"/cKnpj"});if(k!=null&&k.acct){const ee=/@/.test(k.acct)?"":"@"+k.acct,fe=k!=null&&k.displayName?`${k.displayName} (${ee})`:`${ee}`;if(!f)se=G._({id:"hS1Opy",values:{accountDisplay:fe}});else if(d)se=G._({id:"A/CX5F",values:{accountDisplay:fe}});else if(c)se=G._({id:"QQrO94",values:{accountDisplay:fe,tagged:c}});else if(r)se=G._({id:"NoG5wD",values:{accountDisplay:fe}});else if(a){const ve=new Date(a).toLocaleString(G.locale,{month:"long",year:"numeric"});se=G._({id:"8GjLvB",values:{accountDisplay:fe,monthYear:ve}})}else se=fe}Ke(se,"/:instance?/a/:id");const Z=j(),P=it(()=>{const ee=Z.current||m.v1.accounts.$select(n).fetch();return Z.current=ee,ee},[n,m]);X(()=>{(async()=>{try{const ee=await P();y(ee)}catch{}if(!_)try{const ee=await m.v1.accounts.$select(n).featuredTags.list();M(ee)}catch{}})()},[n,_]);const{displayName:N,acct:U,emojis:Y}=k||{},F=j(),ie=be(()=>{const ee=!f||d||c||r||!!a,fe=t.accounts[`${n}@${h}`];return e(q,{children:[e(_s,{instance:h,account:fe||n,fetchAccount:P,authenticated:p,standalone:!0}),!_&&e("div",{class:"filter-bar",ref:F,style:{position:"relative"},children:[ee?e(ue,{to:`/${h}/a/${n}`,class:"insignificant filter-clear",title:G._({id:"u8JHrO"}),children:e(S,{icon:"x",size:"l",alt:G._({id:"xCJdfg"})})},"clear-filters"):e(S,{icon:"filter",class:"insignificant",size:"l",alt:G._({id:"cSev+j"})}),e(ue,{to:`/${h}/a/${n}${f?"?replies=1":""}`,onClick:()=>{f&&de(G._({id:"PIWNSQ"}))},class:f?"":"is-active",children:e(l,{id:"5BFynH"})}),e(ue,{to:`/${h}/a/${n}${d?"":"?boosts=0"}`,onClick:()=>{d||de(G._({id:"Qd13i0"}))},class:d?"is-active":"",children:e(l,{id:"usxQx0"})}),e(ue,{to:`/${h}/a/${n}${r?"":"?media=1"}`,onClick:()=>{r||de(G._({id:"rKpfPY"}))},class:r?"is-active":"",children:e(l,{id:"xYilR2"})}),D.map(ve=>e(ue,{to:`/${h}/a/${n}${c===ve.name?"":`?tagged=${encodeURIComponent(ve.name)}`}`,onClick:()=>{c!==ve.name&&de(G._({id:"L+HFfr",values:{0:ve.name}}))},class:c===ve.name?"is-active":"",children:e("span",{children:[e("span",{class:"more-insignificant",children:"#"}),ve.name]})},ve.id)),I&&(ga?e("label",{class:`filter-field ${a?"is-active":""}`,children:[e(S,{icon:"month",size:"l"}),e("input",{type:"month",disabled:!(k!=null&&k.acct),value:a||"",min:Oi,max:new Date().toISOString().slice(0,7),onInput:ve=>{const{value:pe,validity:we}=ve.currentTarget;if(!we.valid)return;o(pe?{month:pe}:{});const[$e,Me]=pe.split("-"),xe=parseInt(Me,10)-1,Ee=new Date($e,xe);de(G._({id:"0WUFGD",values:{0:Ee.toLocaleString(G.locale,{month:"long",year:"numeric"})}}))}})]}):e(wa,{class:`filter-field ${a?"is-active":""}`,disabled:!(k!=null&&k.acct),value:a||"",min:Oi,max:new Date().toISOString().slice(0,7),onInput:ve=>{const{value:pe,validity:we}=ve;we.valid&&o(pe?{month:pe}:{})}}))]})]})},[n,h,p,D,P,I,...w]);X(()=>{var fe;const ee=(fe=F.current)==null?void 0:fe.querySelector(".is-active");ee&&F.current.scrollTo({behavior:"smooth",left:ee.offsetLeft-(F.current.offsetWidth-ee.offsetWidth)/2})},[D,I,...w]);const O=be(()=>k!=null&&k.url?URL.parse(k.url).hostname:null,[k]),ye=!!k&&!(h===O);return e(kt,{title:`${k!=null&&k.acct?"@"+k.acct:G._({id:"+owNNn"})}`,titleComponent:e("h1",{class:"header-double-lines header-account",children:[e("b",{children:e(is,{text:N,emojis:Y})}),e("div",{children:e("span",{class:"bidi-isolate",children:["@",U]})})]}),id:"account-statuses",instance:h,emptyText:G._({id:"+k97fV"}),errorText:G._({id:"scd9lw"}),fetchItems:z,useItemID:!0,view:r||_?"media":void 0,boostsCarousel:t.settings.boostsCarousel,timelineStart:ie,refresh:[f,d,c,r,a+(k==null?void 0:k.acct)].toString(),headerEnd:e(ot,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(S,{icon:"more",size:"l",alt:G._({id:"2FYpfJ"})})}),children:[e(ge,{disabled:!ye,onClick:()=>{(async()=>{try{const{masto:ee}=ce({instance:O}),fe=await ee.v1.accounts.lookup({acct:k.acct}),{id:ve}=fe;location.hash=`/${O}/a/${ve}`}catch{alert(G._({id:"FgdLx0"}))}})()},children:[e(S,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:e(l,{id:"/JFxxT",values:{0:O?e(q,{children:[" ","(",e("b",{children:Gt.toUnicode(O)}),")"]}):null}})})]}),!T&&e(ge,{onClick:()=>{(async()=>{try{const ee=await u.v1.accounts.lookup({acct:k.acct+"@"+h}),{id:fe}=ee;location.hash=`/${v}/a/${fe}`}catch{alert(G._({id:"FgdLx0"}))}})()},children:[e(S,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:e(l,{id:"HkuyOu",values:{currentInstance:v},components:{0:e("b",{})}})})]})]})},n)}function wa(t){const{i18n:n}=Xe(),{class:i,disabled:s,value:o,min:a,max:f,onInput:d=()=>{}}=t,[c,r]=(o==null?void 0:o.split("-"))||[],m=j(),h=j(),p=(u,v)=>{const[b,w]=(a==null?void 0:a.split("-"))||[],[k,y]=(f==null?void 0:f.split("-"))||[];return!(vk||v===b&&uy)};return e("div",{class:i,children:[e(S,{icon:"month",size:"l"}),e("select",{ref:m,disabled:s,value:r||"",onInput:u=>{const{value:v}=u.currentTarget,b=h.current.value;if(!p(v,b))return{value:"",validity:{valid:!1}};d({value:v?`${b}-${v}`:"",validity:{valid:!0}})},children:[e("option",{value:"",children:e(l,{id:"HajiZl"})}),e("option",{disabled:!0,children:"-----"}),Array.from({length:12},(u,v)=>e("option",{value:(v+1).toString().padStart(2,"0"),children:new Date(0,v).toLocaleString(n.locale,{month:"long"})},v))]})," ",e("input",{ref:h,type:"number",disabled:s,value:c||new Date().getFullYear(),min:(a==null?void 0:a.slice(0,4))||di,max:(f==null?void 0:f.slice(0,4))||new Date().getFullYear(),onInput:u=>{const{value:v,validity:b}=u.currentTarget,w=m.current.value;if(!b.valid||!p(w,v))return{value:"",validity:{valid:!1}};d({value:v?`${v}-${w}`:"",validity:{valid:!0}})},style:{width:"4.5em"}})]})}const ka=20;function xs(){Ke(g._({id:"7Ff7ia"}),"/bookmarks");const{masto:t,instance:n}=ce(),i=j();async function s(o){return(o||!i.current)&&(i.current=t.v1.bookmarks.list({limit:ka})),await i.current.next()}return e(kt,{title:g._({id:"7Ff7ia"}),id:"bookmarks",emptyText:"No bookmarks yet. Go bookmark something!",errorText:g._({id:"UoL+FC"}),instance:n,fetchItems:s})}const _a=""+new URL("catch-up-DuauQu-W.png",import.meta.url).href,Sa="home",nt=[{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}],Ca={original:{id:"HxF6Fk"},replies:{id:"N8UzTV"},boosts:{id:"puY2t0"},followedTags:{id:"lCLRBe"},groups:{id:"zhrjek"},filtered:{id:"03Qqf9"}},Ia=["createdAt","repliesCount","favouritesCount","reblogsCount","density"],Ta=[null,"account"],xa=Qi(t=>new Intl.DateTimeFormat(t||void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"}));function Aa(){const{i18n:t,_:n}=Xe(),i=xa(t.locale);Ke("Catch-up","/catchup");const{masto:s,instance:o}=ce(),[a,f]=ut(),d=a.get("id"),[c,r]=L("start"),[m,h]=L(!1),p=be(()=>bt(),[]),u=R=>R===p,v=Je("@pixelfed/home-include-reblogs");async function b({maxCreatedAt:R}){var te,Ae,Se;const V=R?new Date(R):null,oe=[],H=s.v1.timelines.home.list({limit:40});e:for(;;)try{v&&H.nextParams&&(typeof H.nextParams=="string"?H.nextParams+="&include_reblogs=true":H.nextParams.include_reblogs=!0);const _e=await H.next(),{value:De}=_e;if(De!=null&&De.length){await Ts(De,o);let ae=!1;for(let Pe=0;Pe=V){const He=!u(((Ae=(te=Ze.reblog)==null?void 0:te.account)==null?void 0:Ae.id)||Ze.account.id)&&en(((Se=Ze.reblog)==null?void 0:Se.filtered)||Ze.filtered,Sa);if((He==null?void 0:He.action)==="hide")continue;Ze._filtered=He;const ft=st(Ze.id,o);Ze._followedTags=A.statusFollowedTags[ft]?[...A.statusFollowedTags[ft]]:[],oe.push(Ze),ae=!0}if(!ae)break e}}else break e;await new Promise(ae=>setTimeout(ae,1e3))}catch{break e}return oe.forEach(_e=>{if(_e!=null&&_e.inReplyToId){const De=oe.find(ae=>ae.id===_e.inReplyToId);De&&!De.inReplyToId&&(De._thread=!0)}}),oe}const[w,k]=L([]),y=j(),C=j(),_=be(()=>gn(),[]),T=it(async({duration:R}={})=>{const V=Date.now(),oe=R?V-R:null;r("loading");const H=await b({maxCreatedAt:oe}),te=`${_}-${_o()}`;try{await dt.catchup.set(te,{id:te,posts:H,count:H.length,startAt:oe,endAt:V}),f({id:te})}catch{}},[]);X(()=>{d?(async()=>{const R=await dt.catchup.get(d);R&&(R.posts.sort((V,oe)=>V.createdAt>oe.createdAt?1:-1),k(R.posts),r("results"))})():c==="results"&&(k([]),r("start"))},[d]);const[I,x]=$t(R=>R+1,0),[z,D]=L(null),[M,G]=L([]);X(()=>{(async()=>{try{const R=await dt.catchup.keys();if(R.length){const V=gn(),oe=R.filter(H=>H.startsWith(`${V}-`));if(oe.length){let H=await dt.catchup.getMany(oe);H.sort((_e,De)=>De.endAt-_e.endAt);let te=H.slice(0,3),Ae=H.slice(3);const Se=te.map(_e=>{const{id:De,count:ae,startAt:Pe,endAt:Ze}=_e;return{id:De,count:ae,startAt:Pe,endAt:Ze}});G(Se),D(te[0].endAt),H=null,te=null,queueMicrotask(()=>{Ae.length&&dt.catchup.delMany(Ae.map(_e=>_e.id)).then(()=>{Ae=null}).catch(_e=>{})});return}}}catch{}G([])})()},[I]),X(()=>{c==="start"&&x()},[c==="start"]);const[se,Z]=be(()=>{var De,ae,Pe,Ze,Tt;let R=0,V=0,oe=0,H=0,te=0,Ae=0;const Se={};for(const Ie of w){Ie._filtered?(R++,Ie.__FILTER="filtered"):Ie.group?(V++,Ie.__FILTER="groups"):Ie.reblog?(oe++,Ie.__FILTER="boosts"):(De=Ie._followedTags)!=null&&De.length?(te++,Ie.__FILTER="followedTags"):Ie.inReplyToId&&Ie.inReplyToAccountId!==((ae=Ie.account)==null?void 0:ae.id)?(H++,Ie.__FILTER="replies"):(Ae++,Ie.__FILTER="original");const He=Ie.reblog||Ie;if(Ie.__FILTER!=="filtered"&&((Pe=He.card)!=null&&Pe.url)&&((Ze=He.card)!=null&&Ze.image)&&((Tt=He.card)==null?void 0:Tt.type)==="link"){const{card:ft,favouritesCount:on,reblogsCount:xt}=He;let{url:Qe}=ft;if(Qe=Qe.replace(/\/$/,""),!Se[Qe])Se[Qe]={postID:He.id,card:ft,shared:1,sharers:[Ie.account],likes:on,boosts:xt};else{if(Se[Qe].sharers.find(Nt=>Nt.id===Ie.account.id))continue;Se[Qe].shared++,Se[Qe].sharers.push(Ie.account),Se[Qe].postID!==He.id&&(Se[Qe].likes+=on,Se[Qe].boosts+=xt)}}}let _e=[];for(const Ie in Se)_e.push({url:Ie,...Se[Ie]});if(_e.sort((Ie,He)=>Ie.shared>He.shared?-1:Ie.sharedHe.boosts?-1:Ie.boostsHe.likes?-1:Ie.likes10)e:for(let Ie=10;Ie<_e.length;Ie++){const{shared:He}=_e[Ie];if(He<=1){_e=_e.slice(0,Ie);break e}}return[{filtered:R,groups:V,boosts:oe,replies:H,followedTags:te,original:Ae},_e]},[w]),[P,N]=L("all"),[U,Y]=L(null),[F,ie]=L(1),[O,ne]=L("createdAt"),[ye,ee]=L("asc"),[fe,ve]=L(null),[pe,we,$e]=be(()=>{const R={},V=new Map;let oe=w.filter(te=>{const Ae=P==="all"||te.__FILTER===P;return Ae&&(R[te.account.id]=te.account,V.set(te.account.id,(V.get(te.account.id)||0)+1)),Ae});const H={};return oe.forEach(te=>{te.reblog&&(H[te.reblog.id]?(H[te.reblog.id].__BOOSTERS?H[te.reblog.id].__BOOSTERS.add(te.account):H[te.reblog.id].__BOOSTERS=new Set([te.account]),te.__HIDDEN=!0):H[te.reblog.id]=te)}),U&&V.has(U)&&(oe=oe.filter(te=>te.account.id===U||[...te.__BOOSTERS||[]].find(Ae=>Ae.id===U))),[oe,R,Object.fromEntries(V)]},[P,U,w]),Me=be(()=>{const R={};return pe.forEach(V=>{R[V.id]=V}),R},[pe]),xe=be(()=>Object.keys($e).sort((R,V)=>$e[V]-$e[R]),[$e]),Ee=be(()=>{const R={};return xe.forEach((V,oe)=>{R[V]=oe}),pe.filter(V=>!V.__HIDDEN).sort((V,oe)=>{if(fe==="account"){const H=V.account.id,te=oe.account.id,Ae=R[H],Se=R[te],_e=Ae-Se;if(_e!==0)return _e}if(O!=="createdAt"&&(V=V.reblog||V,oe=oe.reblog||oe,O!=="density"&&V[O]===oe[O]))return V.createdAt>oe.createdAt?1:-1;if(O==="density"){const H=zi(V),te=zi(oe);return ye==="asc"?H>te?1:-1:te>H?1:-1}return ye==="asc"?V[O]>oe[O]?1:-1:oe[O]>V[O]?1:-1})},[pe,O,ye,fe,xe]),Fe=j(null),ke=j(null),J=j(!1);X(()=>{w.length>100||J.current||ke.current&&(gs(ke.current,{duration:200}),J.current=!0)},[w,ke]);const me=w.length>160?"3d":"2d",Te=be(()=>me!=="2d"?null:w.map(R=>{const V=Me[R.id];return e("span",{class:`post-dot ${V?"post-dot-highlight":""}`},R.id)}),[Me]),re=be(()=>me!=="3d"||!(w!=null&&w.length)?null:Pa(w,"createdAt",320).map((V,oe)=>e("div",{class:"posts-bin",children:V.map(H=>{const te=Me[H.id];return e("span",{class:`post-dot ${te?"post-dot-highlight":""}`},H.id)})},oe)),[Me]),W=j(null),$=be(()=>z?(Date.now()-z)/1e3/60/60:null,[z,F]);X(()=>{if(c!=="results")return;const R=U&&we[U]?we[U].username:"",V=ye==="asc"?0:1,oe={account:"authors"};let H=de({duration:5e3,text:t._({id:"TLYeLT",values:{selectedFilterCategory:P,sortBy:O,sortOrder:ye,groupBy:fe}})});return()=>{var te;(te=H==null?void 0:H.hideToast)==null||te.call(H)}},[c,P,U,O,ye,fe,we]),X(()=>{var R;if(U&&we[U]){const V=ke.current.querySelector(`[data-author="${U}"]`),oe=(R=ke.current)==null?void 0:R.getBoundingClientRect(),H=V==null?void 0:V.getBoundingClientRect();H.leftoe.right?V.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}):H.top<0&&V.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})}},[U,we]);const[E,B]=L(!1),K=".catchup-list > li > a",le=Ue("j",()=>{const R=document.activeElement.closest(K),V=R==null?void 0:R.getBoundingClientRect(),oe=Array.from(W.current.querySelectorAll(K));if(R&&V.top0){const H=oe.indexOf(R),te=oe[H+1];te&&(te.focus(),te.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const H=oe.find(te=>te.getBoundingClientRect().top>=0);H&&(H.focus(),H.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{preventDefault:!0,ignoreModifiers:!0}),Ce=Ue("k",()=>{const R=document.activeElement.closest(K),V=R==null?void 0:R.getBoundingClientRect(),oe=Array.from(W.current.querySelectorAll(K));if(R&&V.top0){const H=oe.indexOf(R);let te=oe[H-1];te&&(te.focus(),te.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const H=oe.find(te=>{const Ae=te.getBoundingClientRect();return Ae.top>=44&&Ae.left>=0});H&&(H.focus(),H.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{preventDefault:!0,ignoreModifiers:!0}),We=Ue("h, l",(R,V)=>{var H,te,Ae;const oe=V.keys[0];if(U){const Se=xe.indexOf(U);oe==="h"?Se>0&&Se=0&&(Y(xe[Se+1]),(te=W.current)==null||te.focus())}else oe==="l"&&(Y(xe[0]),(Ae=W.current)==null||Ae.focus())},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]}),Q=Ue("esc",()=>{var R;Y(null),(R=W.current)==null||R.focus()},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]}),Re=Ue(".",()=>{var R;(R=W.current)==null||R.scrollTo({top:0,behavior:"smooth"})},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]}),Ne=it(R=>{const V=document.activeElement,oe=(V==null?void 0:V.tagName)==="INPUT"&&V.type==="radio";if((R.key==="ArrowDown"||R.key==="ArrowUp"||R.key==="ArrowLeft"||R.key==="ArrowRight")&&oe){V.blur();return}},[]);return e("div",{ref:R=>{W.current=R,le.current=R,Ce.current=R,We.current=R,Q.current=R},id:"catchup-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck wide",children:[e("header",{class:`${c==="loading"?"loading":""}`,onClick:R=>{var V;R.target.closest("a, button")||(V=W.current)==null||V.scrollTo({top:0,behavior:"smooth"})},children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Pt,{}),c==="results"&&e(ue,{to:"/catchup",class:"button plain",children:e(S,{icon:"history2",size:"l",alt:t._({id:"xrl8fj"})})}),c==="start"&&e(ue,{to:"/",class:"button plain",children:e(S,{icon:"home",size:"l",alt:t._({id:"i0qMbr"})})})]}),e("h1",{children:c!=="start"&&e(l,{id:"wyL/3/",components:{0:e("sup",{})}})}),e("div",{class:"header-side",children:c!=="start"&&c!=="loading"&&e("button",{type:"button",class:"plain",onClick:()=>{B(!0)},children:e(l,{id:"c3XJ18"})})})]})}),e("main",{onKeyDown:Ne,children:[c==="start"&&e("div",{class:"catchup-start",children:[e("h1",{children:e(l,{id:"wyL/3/",components:{0:e("sup",{})}})}),e("details",{children:[e("summary",{children:e(l,{id:"CxKPv6"})}),e("p",{children:e(l,{id:"YMU1CK"})}),e("img",{src:_a,width:"1200",height:"900",alt:t._({id:"CeInO2"})}),e("p",{children:e("button",{type:"button",onClick:R=>{R.target.closest("details").open=!1},children:e(l,{id:"2jI8hh"})})})]}),e("p",{children:e(l,{id:"1RfGk7"})}),e("p",{children:e("b",{children:e(l,{id:"OOEonE"})})}),e("div",{class:"catchup-form",children:[e("input",{ref:y,type:"range",value:F,min:nt[0].value,max:nt[nt.length-1].value,step:"1",list:"catchup-ranges",onChange:R=>ie(+R.target.value)})," ",e("span",{style:{width:"8em"},children:[n(nt[F-1].label),e("br",{}),e("small",{class:"insignificant",children:F==nt[nt.length-1].value?t._({id:"NMNiaO"}):pt(new Date(Date.now()-F*60*60*1e3))})]}),e("datalist",{id:"catchup-ranges",children:nt.map(({label:R,value:V})=>e("option",{value:V,label:n(R)}))})," ",e("button",{type:"button",onClick:()=>{var R;if(F$?e("p",{class:"catchup-info",children:[e(S,{icon:"info"})," ",e(l,{id:"AGyV7s"})]}):F===nt[nt.length-1].value&&z?e("p",{class:"catchup-info",children:e("label",{children:[e("input",{type:"checkbox",switch:!0,checked:!0,ref:C})," ",e(l,{id:"dDJEHI",values:{0:i.format(new Date(z))}})]})}):null,e("p",{class:"insignificant",children:e("small",{children:e(l,{id:"EAjFM0"})})}),!!(M!=null&&M.length)&&e("div",{class:"catchup-prev",children:[e("p",{children:e(l,{id:"Yfb9A8"})}),e("ul",{children:M.map(R=>e("li",{children:[e(ue,{to:`/catchup?id=${R.id}`,children:[e(S,{icon:"history2"})," ",e("span",{children:R.startAt?i.formatRange(new Date(R.startAt),new Date(R.endAt)):`โ€ฆโ€‰โ€“โ€‰${i.format(new Date(R.endAt))}`})]})," ",e("span",{children:[e("small",{class:"ib insignificant",children:e(l,{id:"S6XZwv",values:{0:R.count}})})," ",e("button",{type:"button",class:"light danger small",onClick:async()=>{var oe;if(confirm(t._({id:"D9CmP2"}))){let H=de(H`Removing Catch-up ${R.id}`);await dt.catchup.del(R.id),(oe=H==null?void 0:H.hideToast)==null||oe.call(H),de(H`Catch-up ${R.id} removed`),x()}},children:e(S,{icon:"x",alt:t._({id:"t/YqKh"})})})]})]},R.id))}),M.length>=3&&e("p",{children:e("small",{children:e(l,{id:"sXmrl4"})})})]})]}),c==="loading"&&e("div",{class:"ui-state catchup-start",children:[e(Le,{abrupt:!0}),e("p",{class:"insignificant",children:e(l,{id:"rbUTzD"})}),e("p",{class:"insignificant",children:e(l,{id:"q9urQO"})})]}),c==="results"&&e(q,{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:P==="all"&&!U&&O==="createdAt"&&ye==="asc",type:"button",class:"plain4 small",onClick:()=>{N("all"),Y(null),ne("createdAt"),ve(null),ee("asc")},children:e(l,{id:"I9EnzM"})}),(Z==null?void 0:Z.length)>0&&e("button",{type:"button",class:"plain small",onClick:()=>h(!m),children:[e(l,{id:"EIZREX"})," ",e(S,{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:Z.map(R=>{const{card:V,shared:oe,sharers:H,likes:te,boosts:Ae}=R,{blurhash:Se,title:_e,description:De,url:ae,image:Pe,imageDescription:Ze,language:Tt,width:Ie,height:He,publishedAt:ft}=V,on=Gt.toUnicode(URL.parse(ae).hostname.replace(/^www\./,"").replace(/\/$/,""));let xt;if(Se){const Qe=Zn(Se),Nt=ai(Qe);xt=ri([.6,Nt[1],Nt[2]])}return e("a",{href:ae,target:"_blank",rel:"noopener noreferrer",style:xt?{"--accent-color":`rgb(${xt.join(",")})`,"--accent-alpha-color":`rgba(${xt.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:Pe,alt:Ze,width:Ie,height:He,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:on})," ",!!ft&&e(q,{children:"ยท "}),!!ft&&e(q,{children:e(Vt,{datetime:ft,format:"micro"})})]}),!!_e&&e("h1",{class:"title",lang:Tt,dir:"auto",title:_e,children:_e})]}),!!De&&e("p",{class:"description",lang:Tt,dir:"auto",title:De,children:De}),e("hr",{}),e("p",{style:{whiteSpace:"nowrap"},children:e(l,{id:"bfSr6z",values:{0:H.map(Qe=>{const{avatarStatic:Nt,displayName:Ys}=Qe;return e(lt,{url:Nt,size:"s",alt:Ys})})}})})]})]})},ae)})})})}),w.length>=5&&(me==="3d"?e("div",{class:"catchup-posts-viz-time-bar",children:re}):e("div",{class:"catchup-posts-viz-bar",children:Te})),w.length>=2&&e("div",{class:"catchup-filters",children:[e("label",{class:"filter-cat",children:[e("input",{type:"radio",name:"filter-cat",checked:P.toLowerCase()==="all",onChange:()=>{N("all")}}),e(l,{id:"N40H+G"})," ",e("span",{class:"count",children:w.length})]}),Object.entries(Ca).map(([R,V])=>!!se[R]&&e("label",{class:"filter-cat",title:(se[R]/w.length*100).toFixed(2)+"%",children:[e("input",{type:"radio",name:"filter-cat",checked:P.toLowerCase()===R.toLowerCase(),onChange:()=>{N(R),R==="boosts"&&(ne("reblogsCount"),ee("desc"),ve(null))}}),n(V)," ",e("span",{class:"count",children:se[R]})]},n(V)))]}),w.length>=2&&!!$e&&e("div",{class:"catchup-filters authors-filters",ref:ke,children:[xe.map(R=>e("label",{class:"filter-author","data-author":R,children:[e("input",{type:"radio",name:"filter-author",checked:U===R,onChange:()=>{Y(R)},onClick:()=>{U===R&&Y(null)}}),e(lt,{url:we[R].avatarStatic||we[R].avatar,size:"xxl",alt:`${we[R].displayName} (@${we[R].acct})`})," ",e("span",{class:"count",children:$e[R]}),e("span",{class:"username",children:we[R].username})]},`${R}-${$e[R]}`)),xe.length>5&&e("small",{style:{whiteSpace:"nowrap",paddingInline:"1em",opacity:.33},children:e(l,{id:"HHtYi7",values:{0:xe.length}})},"authors-count")]}),w.length>=2&&e("div",{class:"catchup-filters",children:[e("span",{class:"filter-label",children:e(l,{id:"f6Hub0"})})," ",e("fieldset",{class:"radio-field-group",children:Ia.map(R=>e("label",{class:"filter-sort",onClick:V=>{O===R&&(V.preventDefault(),V.stopPropagation(),ee(ye==="asc"?"desc":"asc"))},children:[e("input",{type:"radio",name:"filter-sort-cat",checked:O===R,onChange:()=>{ne(R);const V=/(replies|favourites|reblogs)/.test(R)?"desc":"asc";ee(V)}}),{createdAt:t._({id:"mYGY3B"}),repliesCount:t._({id:"N8UzTV"}),favouritesCount:t._({id:"zZOZj7"}),reblogsCount:t._({id:"puY2t0"}),density:t._({id:"0tQ7AD"})}[R],O===R&&(ye==="asc"?" โ†‘":" โ†“")]},R))}),e("span",{class:"filter-label",children:e(l,{id:"L8fEEm"})})," ",e("fieldset",{class:"radio-field-group",children:Ta.map(R=>e("label",{class:"filter-group",children:[e("input",{type:"radio",name:"filter-group",checked:fe===R,onChange:()=>{ve(R)},disabled:R==="account"&&U}),{account:t._({id:"dpqPBg"})}[R]||t._({id:"EdQY6l"})]},R||"none"))}),U&&xe.length>1?e("button",{type:"button",class:"plain6 small",onClick:()=>{Y(null)},style:{whiteSpace:"nowrap"},children:e(l,{id:"/dlmrZ"})}):null]}),e("ul",{class:`catchup-list catchup-filter-${P||""} ${O?`catchup-sort-${O}`:""} ${U&&we[U]?"catchup-selected-author":""} ${fe?`catchup-group-${fe}`:""}`,children:Ee.map((R,V)=>{var te;const oe=((te=R.reblog)==null?void 0:te.id)||R.id;let H=!1;return fe==="account"&&(Fe.current&&R.account.id!==Fe.current&&V>0&&(H=!0),Fe.current=R.account.id),e(q,{children:[H&&e("li",{class:"separator"}),e(Ra,{to:`/${o}/s/${oe}`,post:R,root:W.current})]},`${R.id}-${H}`)})}),e("footer",{children:pe.length>5&&e("p",{children:[P==="boosts"?t._({id:"eVosYr"}):t._({id:"rhmyFK"})," ",e("button",{type:"button",class:"textual",onClick:()=>{W.current.scrollTop=0},children:e(l,{id:"0MgdN+"})}),"."]})})]})]})]}),E&&e(ze,{onClose:()=>B(!1),children:e("div",{class:"sheet",id:"catchup-help-sheet",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>B(!1),children:e(S,{icon:"x",alt:t._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(l,{id:"c3XJ18"})})}),e("main",{children:e("dl",{children:[e("dt",{children:e(l,{id:"EIZREX"})}),e("dd",{children:e(l,{id:"YmGrIy"})}),e("dt",{children:e(l,{id:"coaNtr"})}),e("dd",{children:e(l,{id:"UUrqX1"})}),e("dt",{children:e(l,{id:"ScQBC/"})}),e("dd",{children:e(l,{id:"srocAr"})}),e("dt",{children:e(l,{id:"77Emn0"})}),e("dd",{children:e("table",{children:e("tbody",{children:[e("tr",{children:[e("td",{children:e(l,{id:"Gy9P9T"})}),e("td",{children:e("kbd",{children:"j"})})]}),e("tr",{children:[e("td",{children:e(l,{id:"6XYpYY"})}),e("td",{children:e("kbd",{children:"k"})})]}),e("tr",{children:[e("td",{children:e(l,{id:"f5dduh"})}),e("td",{children:e("kbd",{children:"l"})})]}),e("tr",{children:[e("td",{children:e(l,{id:"rj0vxZ"})}),e("td",{children:e("kbd",{children:"h"})})]}),e("tr",{children:[e("td",{children:e(l,{id:"jsFF8C"})}),e("td",{children:e("kbd",{children:"Enter"})})]}),e("tr",{children:[e("td",{children:e(l,{id:"bUUv3P"})}),e("td",{children:e("kbd",{children:"."})})]})]})})})]})})]})})]})}const Ea=ct(function({post:t}){const{id:n,account:i,group:s,reblog:o,inReplyToId:a,inReplyToAccountId:f,_followedTags:d,_filtered:c,visibility:r,__BOOSTERS:m}=t,h=a&&f!==i.id,p=!!c,u=v=>{v.shiftKey};return e("article",{class:`post-line ${s?"group":o?"reblog":d!=null&&d.length?"followed-tags":""} ${h?"reply-to":""} ${p?"filtered":""} visibility-${r}`,onMouseEnter:u,children:[e("span",{class:"post-author",children:o?e("span",{class:"post-reblog-avatar",children:[e(lt,{url:i.avatarStatic||i.avatar,squircle:i.bot}),(m==null?void 0:m.size)>0?[...m].map(v=>e(lt,{url:v.avatarStatic||v.avatar,squircle:v.bot})):""," ",e(S,{icon:"rocket"})," ",e(Ct,{account:o.account,showAvatar:!0})]}):e(Ct,{account:i,showAvatar:!0})}),e(Ma,{post:o||t,filterInfo:c}),e("span",{class:"post-meta",children:[e(Da,{post:o||t})," ",e(Vt,{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)}),Ra=({root:t,to:n,...i})=>{const s=j(),[o,a]=L(!1);return X(()=>{const f=new IntersectionObserver(d=>{d[0].isIntersecting&&(queueMicrotask(()=>a(!0)),f.unobserve(s.current))},{root:t,rootMargin:`${Math.max(320,screen.height*.75)}px`});return s.current&&f.observe(s.current),()=>{s.current&&f.unobserve(s.current)}},[]),o?e("li",{children:e(ue,{to:n,children:e(Ea,{...i})})}):e("li",{ref:s,style:{height:"4em"}})},La=8,$a=8;function zi(t){var c;const{spoilerText:n,content:i,poll:s,mediaAttachments:o,card:a}=t,f=(c=s==null?void 0:s.options)!=null&&c.length?s.options.reduce((r,m)=>r+m.title,""):"";return(n.length+rs(i)+f.length)/140+(o!=null&&o.length?La*o.length:a!=null&&a.image?$a:0)}const _t=48;function Ma({post:t,filterInfo:n}){var y;const{spoilerText:i,sensitive:s,content:o,emojis:a,poll:f,mediaAttachments:d,card:c,inReplyToId:r,inReplyToAccountId:m,account:h,_thread:p}=t,u=r&&m===h.id||!!p,v=be(()=>!!(he.account.get("preferences")||{})["reading:expand:spoilers"],[]),b=v||!i&&!s,w=o?Jn(t):"",k=!i||v;return e("div",{class:"post-peek",title:i?"":w,children:[e("span",{class:"post-peek-content",children:[u&&!k&&e(q,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:"Thread"})," "]}),n?e("span",{class:"post-peek-filtered",children:n!=null&&n.titlesStr?g._({id:"suKjh3",values:{0:n.titlesStr}}):g._({id:"03Qqf9"})}):e(q,{children:[!!i&&e("span",{class:"post-peek-spoiler",children:[e(S,{icon:`${v?"eye-open":"eye-close"}`})," ",i]}),k&&e("div",{class:"post-peek-html",children:[u&&e(q,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:e(l,{id:"e66y2Z"})})," "]}),!!o&&e("div",{dangerouslySetInnerHTML:{__html:So(o,a)}}),!!((y=f==null?void 0:f.options)!=null&&y.length)&&f.options.map(C=>e("div",{children:[f.multiple?"โ–ช๏ธ":"โ€ข"," ",C.title]})),!o&&(d==null?void 0:d.length)===1&&d[0].description&&e(q,{children:[e("span",{class:"post-peek-tag post-peek-alt",children:"ALT"})," ",e("div",{children:d[0].description})]})]})]})]}),!n&&e("span",{class:"post-peek-post-content",children:[!!f&&e("span",{class:"post-peek-tag post-peek-poll",children:[e(S,{icon:"poll",size:"s"}),e(l,{id:"4WUbF1"})]}),d!=null&&d.length?d.map(C=>{var z,D,M,G,se,Z,P,N,U,Y;const _=C.previewUrl||C.url,T=C.previewRemoteUrl||C.remoteUrl,I=(z=C.meta)!=null&&z.original?C.meta.original.width:((M=(D=C.meta)==null?void 0:D.small)==null?void 0:M.width)||((se=(G=C.meta)==null?void 0:G.original)==null?void 0:se.width),x=(Z=C.meta)!=null&&Z.original?C.meta.original.height:((N=(P=C.meta)==null?void 0:P.small)==null?void 0:N.height)||((Y=(U=C.meta)==null?void 0:U.original)==null?void 0:Y.height);return e("span",{class:"post-peek-media",children:{image:(_||T)&&b?e("img",{src:_,width:_t,height:_t,alt:C.description,loading:"lazy",onError:F=>{const{src:ie}=F.target;ie===_&&(F.target.src=T)},style:{"--anim-duration":`${Math.min(Math.max(Math.max(I,x)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"๐Ÿ–ผ"}),gifv:(_||T)&&b?e("img",{src:_,width:_t,height:_t,alt:C.description,loading:"lazy",onError:F=>{const{src:ie}=F.target;ie===_&&(F.target.src=T)}}):e("span",{class:"post-peek-faux-media",children:"๐ŸŽž๏ธ"}),video:(_||T)&&b?e("img",{src:_,width:_t,height:_t,alt:C.description,loading:"lazy",onError:F=>{const{src:ie}=F.target;ie===_&&(F.target.src=T)}}):e("span",{class:"post-peek-faux-media",children:"๐Ÿ“น"}),audio:e("span",{class:"post-peek-faux-media",children:"๐ŸŽต"})}[C.type]||null},C.id)}):!!c&&c.image&&b&&e("span",{class:`post-peek-media post-peek-card card-${c.type||""}`,children:c.image?e("img",{src:c.image,width:_t,height:_t,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 Da({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(S,{icon:"comment2",size:"s",alt:g._({id:"N8UzTV"})})," ",Ve(i)]}),s>0&&e("span",{class:"post-stat-likes",children:[e(S,{icon:"heart",size:"s",alt:g._({id:"zZOZj7"})})," ",Ve(s)]}),n>0&&e("span",{class:"post-stat-boosts",children:[e(S,{icon:"rocket",size:"s",alt:g._({id:"puY2t0"})})," ",Ve(n)]})]})}function Pa(t,n,i){const s=t.map(c=>new Date(c[n])),o=s.reduce((c,r)=>rr>c?r:c,s[0]).getTime()-o.getTime(),d=Array.from({length:i},()=>[]);return t.forEach(c=>{const m=(new Date(c[n]).getTime()-o.getTime())/f,h=Math.floor(m*(i-1));d[h].push(c)}),d}const Na=20;function As(){Ke(g._({id:"zZOZj7"}),"/favourites");const{masto:t,instance:n}=ce(),i=j();async function s(o){return(o||!i.current)&&(i.current=t.v1.favourites.list({limit:Na})),await i.current.next()}return e(kt,{title:g._({id:"zZOZj7"}),id:"favourites",emptyText:"No likes yet. Go like something!",errorText:g._({id:"khVljG"}),instance:n,fetchItems:s})}const Oa=["home","public","notifications","thread","account"],Ui=["notifications","thread","account"],za={home:{id:"Buy2bt"},notifications:{id:"iDNBZe"},public:{id:"RO10dm"},thread:{id:"EnJuK0"},account:{id:"vrQQgz"}},Ua=[0,30*60,60*60,6*60*60,12*60*60,60*60*24,60*60*24*7,60*60*24*30],Mn={0:{id:"qqeAJM"},1800:et(30,"minute"),3600:et(1,"hour"),21600:et(6,"hour"),43200:et(12,"hour"),86400:et(24,"hour"),604800:et(7,"day"),2592e3:et(30,"day")};function Fa(){const{masto:t}=ce();Ke(g._({id:"cSev+j"}),"/ft");const[n,i]=L("default"),[s,o]=L(!1),[a,f]=$t(r=>r+1,0),[d,c]=L([]);return X(()=>{i("loading"),(async()=>{try{const r=await t.v2.filters.list();r.sort((m,h)=>m.title.localeCompare(h.title)),r.forEach(m=>{var h;(h=m.keywords)!=null&&h.length&&m.keywords.sort((p,u)=>p.id-u.id)}),c(r),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(ue,{to:"/",class:"button plain",children:e(S,{icon:"home",size:"l",alt:g._({id:"i0qMbr"})})})]}),e("h1",{children:e(l,{id:"cSev+j"})}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{o(!0)},children:e(S,{icon:"plus",size:"l",alt:g._({id:"yFfBdX"})})})})]})}),e("main",{children:d.length>0?e(q,{children:[e("ul",{class:"filters-list",children:d.map(r=>{const{id:m,title:h,expiresAt:p,keywords:u}=r;return e("li",{children:[e("div",{children:[e("h2",{children:h}),(u==null?void 0:u.length)>0&&e("div",{children:u.map(v=>e(q,{children:[e("span",{class:"tag collapsed insignificant",children:v.wholeWord?`โ€œ${v.keyword}โ€`:v.keyword})," "]}))}),e("small",{class:"insignificant",children:e(Es,{expiresAt:p})})]}),e("button",{type:"button",class:"plain",onClick:()=>{o({filter:r})},children:e(S,{icon:"pencil",size:"l",alt:"Edit filter"})})]},m)})}),d.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(l,{id:"5vzJxv",values:{0:d.length}})})})]}):n==="loading"?e("p",{class:"ui-state",children:e(Le,{})}):n==="error"?e("p",{class:"ui-state",children:e(l,{id:"qcAUwp"})}):e("p",{class:"ui-state",children:e(l,{id:"cWIHTt"})})})]}),!!s&&e(ze,{title:g._({id:"vCSBPD"}),onClose:()=>{o(!1)},children:e(Ha,{filter:s==null?void 0:s.filter,onClose:r=>{r.state==="success"&&f(),o(!1)}})})]})}let Ba=1;const qa=()=>Ba++;function Ha({filter:t,onClose:n}){const{_:i}=Xe(),{masto:s}=ce(),[o,a]=L("default"),f=!!t,{context:d,expiresAt:c,id:r,keywords:m,title:h,filterAction:p}=t||{},u=!!c,v=u&&new Date(c),[b,w]=L(m||[]),k=j(),[y,C]=L([]),[_,T]=L([]),I=b.filter(x=>!y.includes(x.id)&&!_.includes(x._id));return e("div",{class:"sheet",id:"filters-add-edit-modal",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:f?g._({id:"3mOee6"}):g._({id:"yFfBdX"})})}),e("main",{children:e("form",{onSubmit:x=>{x.preventDefault();const z=new FormData(x.target),D=z.get("title"),M=z.getAll("keyword_attributes[][id]"),G=z.getAll("keyword_attributes[][keyword]"),se=[...k.current.querySelectorAll('input[name="keyword_attributes[][whole_word]"]')].map(Y=>Y.checked),Z=G.map((Y,F)=>({id:M[F]||void 0,keyword:Y,wholeWord:se[F]}));f&&(y!=null&&y.length)&&y.forEach(Y=>{Z.push({id:Y,_destroy:!0})});const P=z.getAll("context");let N=z.get("expires_in");const U=z.get("filter_action");!D||!(P!=null&&P.length)||(a("loading"),(async()=>{try{let Y;f?(N===""||N===null?u?N=Math.floor((v-new Date)/1e3):N=null:N==="0"||N===0?N=null:N=+N,Y=await s.v2.filters.$select(r).update({title:D,context:P,expiresIn:N,keywordsAttributes:Z,filterAction:U})):(N=+N||null,Y=await s.v2.filters.create({title:D,context:P,expiresIn:N,keywordsAttributes:Z,filterAction:U})),a("default"),n==null||n({state:"success",filter:Y})}catch{a("error"),alert(f?g._({id:"H8RP+h"}):g._({id:"Fr0hAN"}))}})())},children:[e("div",{class:"filter-form-row",children:e("label",{children:[e("b",{children:e(l,{id:"MHrjPM"})}),e("input",{type:"text",name:"title",defaultValue:h,disabled:o==="loading",dir:"auto",required:!0})]})}),e("div",{class:"filter-form-keywords",ref:k,children:[I.length?e("ul",{class:"filter-keywords",children:I.map(x=>{const{id:z,keyword:D,wholeWord:M,_id:G}=x;return e("li",{children:[e("input",{type:"hidden",name:"keyword_attributes[][id]",value:z}),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:z,defaultChecked:M,disabled:o==="loading"})," ",e(l,{id:"/7UQ7y"})]}),e("button",{type:"button",class:"light danger small",disabled:o==="loading",onClick:()=>{z?(y.push(z),C([...y])):G&&(_.push(G),T([..._]))},children:e(S,{icon:"x",alt:g._({id:"t/YqKh"})})})]})]},`${z}-${G}`)})}):e("div",{class:"filter-keywords",children:e("div",{class:"insignificant",children:e(l,{id:"SYKm3p"})})}),e("footer",{class:"filter-keywords-footer",children:[e("button",{type:"button",class:"light",onClick:()=>{w([...b,{_id:qa(),keyword:"",wholeWord:!0}]),setTimeout(()=>{var z,D;const x=k.current.querySelectorAll('input[type="text"]');(D=(z=x[x.length-1])==null?void 0:z.focus)==null||D.call(z)},10)},children:e(l,{id:"qn5Dbn"})})," ",(I==null?void 0:I.length)>1&&e("small",{class:"insignificant",children:e(l,{id:"1JZ175",values:{0:I.length}})})]})]}),e("div",{class:"filter-form-cols",children:[e("div",{class:"filter-form-col",children:[e("div",{children:e("b",{children:e(l,{id:"uqf7Yq"})})}),Oa.map(x=>e("div",{children:[e("label",{class:Ui.includes(x)?"insignificant":"",children:[e("input",{type:"checkbox",name:"context",value:x,defaultChecked:d?d.includes(x):!0,disabled:o==="loading"})," ",i(za[x]),Ui.includes(x)?"*":""]})," "]})),e("p",{children:e("small",{class:"insignificant",children:e(l,{id:"m0G499"})})})]}),e("div",{class:"filter-form-col",children:[f&&e(l,{id:"ucJk3m",components:{0:e("b",{}),1:e(Es,{expiresAt:c,showNeverExpires:!0})}}),e("div",{children:[e("label",{for:"filters-expires_in",children:f?g._({id:"BcNdg+"}):g._({id:"agO/T/"})}),e("select",{id:"filters-expires_in",name:"expires_in",disabled:o==="loading",defaultValue:f?void 0:0,children:[f&&e("option",{}),Ua.map(x=>e("option",{value:x,children:typeof Mn[x]=="function"?Mn[x]():i(Mn[x])}))]})]}),e("p",{children:[e(l,{id:"blQMpa"}),e("br",{}),e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"warn",defaultChecked:p==="warn"||!f,disabled:o==="loading"})," ",e(l,{id:"jbreWy"})]})," ",e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"hide",defaultChecked:p==="hide",disabled:o==="loading"})," ",e(l,{id:"zNCBmf"})]})]})]})]}),e("footer",{class:"filter-form-footer",children:[e("span",{children:[e("button",{type:"submit",disabled:o==="loading",children:f?g._({id:"tfDRzk"}):g._({id:"hYgDIe"})})," ",e(Le,{abrupt:!0,hidden:o!=="loading"})]}),f&&e(rt,{disabled:o==="loading",align:"end",menuItemClassName:"danger",confirmLabel:g._({id:"BPjyR2"}),onClick:()=>{a("loading"),(async()=>{try{await s.v2.filters.$select(r).remove(),a("default"),n==null||n({state:"success"})}catch{a("error"),alert(g._({id:"4Dh9J1"}))}})()},children:e("button",{type:"button",class:"light danger",onClick:()=>{},disabled:o==="loading",children:e(l,{id:"Jb6/SB"})})})]})]})})]})}function Es({expiresAt:t,showNeverExpires:n}){const i=!!t,s=i&&new Date(t),o=i&&s<=new Date,[a,f]=$t(d=>d+1,0);return Wn(f,o||3e4),o?g._({id:"M1RnFv"}):i?e(l,{id:"urGtsw",components:{0:e(Vt,{datetime:s})}}):n&&g._({id:"O1Aswy"})}function ja(){const{masto:t,instance:n}=ce();Ke(g._({id:"Xi1/bw"}),"/fh");const[i,s]=L("default"),[o,a]=L([]);return X(()=>{s("loading"),(async()=>{try{const f=await wn();a(f),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(ue,{to:"/",class:"button plain",children:e(S,{icon:"home",size:"l",alt:g._({id:"i0qMbr"})})})]}),e("h1",{children:e(l,{id:"Xi1/bw"})}),e("div",{class:"header-side"})]})}),e("main",{children:o.length>0?e(q,{children:[e("ul",{class:"link-list",children:o.map(f=>e("li",{children:e(ue,{to:n?`/${n}/t/${f.name}`:`/t/${f.name}`,children:[e(S,{icon:"hashtag",alt:"#"})," ",e("span",{children:f.name})]})}))}),o.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(l,{id:"2S/uvJ",values:{0:o.length}})})})]}):i==="loading"?e("p",{class:"ui-state",children:e(Le,{abrupt:!0})}):i==="error"?e("p",{class:"ui-state",children:e(l,{id:"2AeREO"})}):e("p",{class:"ui-state",children:e(l,{id:"vKsGhk"})})})]})})}const Ya=20;function ui({title:t,path:n,id:i,...s}){Ke(t||g._({id:"y6sq5j"}),n||"/following");const{masto:o,streaming:a,instance:f}=ce(),d=Be(A),c=j(),r=j(),m=Je("@pixelfed/home-include-reblogs");async function h(u){var w;(u||!c.current)&&(c.current=o.v1.timelines.home.list({limit:Ya})),m&&((w=c.current)!=null&&w.nextParams)&&(typeof c.current.nextParams=="string"?c.current.nextParams+="&include_reblogs=true":c.current.nextParams.include_reblogs=!0);const v=await c.current.next();let{value:b}=v;if(b!=null&&b.length){let k=!1;u&&(b[0].id!==r.current&&(k=!0),r.current=b[0].id),b.forEach(y=>{Ge(y,f)}),b=Pi(b,f),u&&k&&aa(),Ts(b,f),b.sort((y,C)=>{const _=new Date(y.createdAt);return new Date(C.createdAt)-_})}return{...v,value:b}}async function p(){var u;try{const v={limit:5,since_id:r.current};Je("@pixelfed/home-include-reblogs")&&(v.include_reblogs=!0);const b=await o.v1.timelines.home.list(v).next();let{value:w}=b;const k=((u=w[0])==null?void 0:u.id)===r.current;return!!(w!=null&&w.length&&!k&&(r.current=w[0].id,w=Pi(w,f),w=Rt(w,"home"),w.some(y=>!y.reblog)))}catch{return!1}}return X(()=>{let u;return(async()=>{if(a){u=a.user.subscribe();for await(const v of u){if(!u)break;if(v.event==="status.update"){const b=v.payload;Ge(b,f)}else if(v.event==="delete"){const b=v.payload,w=es(b,f);w&&(w._deleted=!0)}}}})(),()=>{var v;(v=u==null?void 0:u.unsubscribe)==null||v.call(u),u=null}},[a]),e(kt,{title:t||g._({id:"y6sq5j"}),id:i||"following",emptyText:g._({id:"nJEKbY"}),errorText:g._({id:"7QSeK6"}),instance:f,fetchItems:h,checkForUpdates:p,useItemID:!0,boostsCarousel:d.settings.boostsCarousel,...s,filterContext:"home",showFollowedTags:!0,showReplyParent:!0})}const Va=20,Ga=4,Fi=Ga+1;function Rs({media:t,columnMode:n,...i}){let{hashtag:s,...o}=n?{}:Mt();i.hashtag&&(s=i.hashtag);let a=s.trim().split(/[\s+]+/);a.sort(),s=a[0];const[f,d]=ut(),c=t||!!f.get("media"),r=c?"?media=1":"",{masto:m,instance:h,authenticated:p}=ce({instance:(i==null?void 0:i.instance)||o.instance}),{masto:u,instance:v,authenticated:b}=ce(),w=a.map(F=>`#${F}`).join(" "),k=h?c?g._({id:"kH0rA0",values:{hashtagTitle:w,instance:h}}):g._({id:"IK0zKi",values:{hashtagTitle:w,instance:h}}):c?g._({id:"hHSI3w",values:{hashtagTitle:w}}):g._({id:"+ZzjRY",values:{hashtagTitle:w}});Ke(k,"/:instance?/t/:hashtag");const y=j(),C=be(()=>Vn(),[]),_=j(void 0);async function T(F){const ie=await m.v1.timelines.tag.$select(s).list({limit:Va,any:a.slice(1),maxId:F?void 0:_.current,onlyMedia:c?!0:void 0}).next();let{value:O}=ie;return O!=null&&O.length&&(F&&(y.current=O[0].id),O.forEach(ne=>{Ge(ne,h,{skipThreading:c||C})}),_.current=O[O.length-1].id),{...ie,value:O}}async function I(){var F;try{const ie=await m.v1.timelines.tag.$select(s).list({limit:1,any:a.slice(1),since_id:y.current,onlyMedia:c}).next();let{value:O}=ie;const ne=((F=O[0])==null?void 0:F.id)===y.current;return O!=null&&O.length&&!ne?(O=Rt(O,"public"),!0):!1}catch{return!1}}const[x,z]=L("default"),[D,M]=L();X(()=>{(async()=>{try{const F=await m.v1.tags.$select(s).fetch();M(F)}catch{}})()},[s]);const G=a.length>=Fi,[se,Z]=L("default"),[P,N]=L([]),[U,Y]=L(!1);return X(()=>{p&&(async()=>{try{const F=await m.v1.featuredTags.list();N(F),Y(F.some(ie=>ie.name.toLowerCase()===s.toLowerCase()))}catch{}})()},[]),e(kt,{title:k,titleComponent:!!h&&e("h1",{class:"header-double-lines",children:[e("b",{dir:"auto",children:w}),e("div",{children:h})]}),id:"hashtag",instance:h,emptyText:g._({id:"CNSLAW"}),errorText:g._({id:"yjj6Ll"}),fetchItems:T,checkForUpdates:I,useItemID:!0,view:c||C?"media":void 0,refresh:c,filterContext:"public",headerEnd:e(ot,{portal:!0,setDownOverflow:!0,overflow:"auto",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(S,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),children:[!!D&&a.length===1&&e(q,{children:[e(rt,{subMenu:!0,confirm:D.following,confirmLabel:`Unfollow #${s}?`,disabled:x==="loading"||!p,onClick:()=>{z("loading"),D.following?m.v1.tags.$select(s).unfollow().then(()=>{M({...D,following:!1}),de(g._({id:"doK/ij",values:{hashtag:s}}))}).catch(F=>{alert(F)}).finally(()=>{z("default")}):m.v1.tags.$select(s).follow().then(()=>{M({...D,following:!0}),de(g._({id:"R9+aEN",values:{hashtag:s}}))}).catch(F=>{alert(F)}).finally(()=>{z("default")})},children:D.following?e(q,{children:[e(S,{icon:"check-circle"})," ",e("span",{children:e(l,{id:"HOSk7R"})})]}):e(q,{children:[e(S,{icon:"plus"})," ",e("span",{children:e(l,{id:"MKEPCY"})})]})}),e(ge,{type:"checkbox",checked:U,disabled:se==="loading"||!p,onClick:()=>{if(Z("loading"),U){const F=P.find(ie=>ie.name.toLowerCase()===s.toLowerCase()).id;F?m.v1.featuredTags.$select(F).remove().then(()=>{Y(!1),de(g._({id:"VH+Tf9"})),N(P.filter(ie=>ie.id!==F))}).catch(ie=>{}).finally(()=>{Z("default")}):de(g._({id:"3OLv47"}))}else m.v1.featuredTags.create({name:s}).then(F=>{Y(!0),de(g._({id:"9ra4hn"})),N(P.concat(F))}).catch(F=>{}).finally(()=>{Z("default")})},children:U?e(q,{children:[e(S,{icon:"check-circle"}),e("span",{children:e(l,{id:"9ra4hn"})})]}):e(q,{children:[e(S,{icon:"check-circle"}),e("span",{children:e(l,{id:"UlJ3QN"})})]})}),e(Ye,{})]}),!C&&e(q,{children:[e(ls,{className:"plain",children:e(l,{id:"cSev+j"})}),e(ge,{type:"checkbox",checked:!!c,onClick:()=>{c?f.delete("media"):f.set("media","1"),d(f)},children:[e(S,{icon:"check-circle",alt:"โ˜‘๏ธ"})," ",e("span",{class:"menu-grow",children:e(l,{id:"eK4SL/"})})]}),e(Ye,{})]}),e(Co,{className:"menu-field",disabled:G,children:({ref:F})=>e("form",{onSubmit:ie=>{var ne,ye;ie.preventDefault();const O=(ye=(ne=ie.target[0].value)==null?void 0:ne.trim)==null?void 0:ye.call(ne);O&&!a.some(ee=>ee.toLowerCase()===O.toLowerCase())&&(a.push(O),a.sort(),location.hash=h?`/${h}/t/${a.join("+")}`:`/t/${a.join("+")}${r}`)},children:[e(S,{icon:"hashtag"}),e("input",{ref:F,type:"text",placeholder:G?g._({id:"ouWc/D",values:{TOTAL_TAGS_LIMIT:Fi}}):g._({id:"cxL5F9"}),required:!0,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:"[^#][^\\s#]+[^#]",disabled:G,dir:"auto"})]})}),e(Io,{takeOverflow:!0,children:a.map((F,ie)=>e(ge,{disabled:a.length===1,onClick:O=>{a.splice(ie,1),a.sort(),location.hash=h?`/${h}/t/${a.join("+")}${r}`:`/t/${a.join("+")}${r}`},children:[e(S,{icon:"x",alt:g._({id:"OISAkj"}),class:"danger-icon"}),e("span",{class:"bidi-isolate",children:[e("span",{class:"more-insignificant",children:"#"}),F]})]},F))}),e(Ye,{}),e(ge,{disabled:!b,onClick:()=>{if(A.shortcuts.length>=gt){alert(g._({id:"XN1xAY",values:{SHORTCUTS_LIMIT:gt}}));return}const F={type:"hashtag",hashtag:a.join(" "),instance:h,media:c?"on":void 0};A.shortcuts.some(O=>O.type===F.type&&O.hashtag.split(/[\s+]+/).sort().join(" ")===F.hashtag.split(/[\s+]+/).sort().join(" ")&&(O.instance?O.instance===F.instance:!0)&&(O.media?!!O.media==!!F.media:!0))?alert(g._({id:"kfeQnS"})):(A.shortcuts.push(F),de(g._({id:"MIhb91"})))},children:[e(S,{icon:"shortcut"})," ",e("span",{children:e(l,{id:"i02Lq/"})})]}),e(ge,{onClick:()=>{let F=prompt(g._({id:"2MQ2cd"}));if(!/\./.test(F)){F&&alert(g._({id:"7WddtO"}));return}F&&(F=F.toLowerCase().trim(),location.hash=`/${F}/t/${a.join("+")}${r}`)},children:[e(S,{icon:"bus"})," ",e("span",{children:e(l,{id:"Sq04Yc"})})]}),v!==h&&e(ge,{onClick:()=>{location.hash=`/${v}/t/${a.join("+")}${r}`},children:[e(S,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(l,{id:"iAzCp4",values:{currentInstance:v},components:{0:e("b",{})}})})]})]})},h+w)}const Wa=20;function Ls(t){var k;const n=Be(A),{masto:i,instance:s}=ce(),o=(t==null?void 0:t.id)||((k=Mt())==null?void 0:k.id),a=j(),f=j();async function d(y){(y||!f.current)&&(f.current=i.v1.timelines.list.$select(o).list({limit:Wa}));const C=await f.current.next();let{value:_}=C;return _!=null&&_.length&&(y&&(a.current=_[0].id),_.forEach(T=>{Ge(T,s)})),{...C,value:_}}async function c(){var y;try{const C=await i.v1.timelines.list.$select(o).list({limit:1,since_id:a.current});let{value:_}=C;const T=((y=_[0])==null?void 0:y.id)===a.current;return _!=null&&_.length&&!T?(_=Rt(_,"home"),!0):!1}catch{return!1}}const[r,m]=L([]);X(()=>{sn().then(m)},[]);const[h,p]=L({title:"List"});Ke(h.title,"/l/:id"),X(()=>{(async()=>{try{const y=await ws(o);p(y)}catch{}})()},[o]);const[u,v]=L(!1),[b,w]=L(!1);return e(q,{children:[e(kt,{title:h.title,id:"list",emptyText:g._({id:"KkDhfU"}),errorText:g._({id:"7QSeK6"}),instance:s,fetchItems:d,checkForUpdates:c,useItemID:!0,boostsCarousel:n.settings.boostsCarousel,filterContext:"home",showReplyParent:!0,headerStart:e(ot,{overflow:"auto",menuButton:e("button",{type:"button",class:"plain",children:[e(S,{icon:"list",size:"l",alt:g._({id:"h16FyT"})}),e(S,{icon:"chevron-down",size:"s"})]}),children:[e(Oe,{to:"/l",children:e("span",{children:e(l,{id:"BHWx+g"})})}),(r==null?void 0:r.length)>0&&e(q,{children:[e(Ye,{}),r.map(y=>e(Oe,{to:`/l/${y.id}`,children:e("span",{children:y.title})},y.id))]})]}),headerEnd:e(ot,{portal:!0,setDownOverflow:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(S,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),children:[e(ge,{onClick:()=>v({list:h}),children:[e(S,{icon:"pencil",size:"l"}),e("span",{children:e(l,{id:"ePK91l"})})]}),e(ge,{onClick:()=>w(!0),children:[e(S,{icon:"group",size:"l"}),e("span",{children:e(l,{id:"hB02vO"})})]})]})},o),u&&e(ze,{onClick:y=>{y.target===y.currentTarget&&v(!1)},children:e(ci,{list:u==null?void 0:u.list,onClose:y=>{y.state==="success"&&y.list?p(y.list):y.state==="deleted"&&(location.hash="/l"),v(!1)}})}),b&&e(ze,{onClick:y=>{y.target===y.currentTarget&&w(!1)},children:e(Za,{listID:o,onClose:()=>w(!1)})})]})}const Ka=40;function Za({listID:t,onClose:n}){const{masto:i,instance:s}=ce(),[o,a]=L([]),[f,d]=L("default"),[c,r]=L(!1),m=j();async function h(p){r(!1),d("loading"),(async()=>{try{(p||!m.current)&&(m.current=i.v1.lists.$select(t).accounts.list({limit:Ka}));const u=await m.current.next();let{done:v,value:b}=u;b!=null&&b.length?(a(p?b:o.concat(b)),r(!v)):r(!1),d("default")}catch{d("error")}})()}return X(()=>{h(!0)},[]),e("div",{class:"sheet",id:"list-manage-members-container",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(l,{id:"hB02vO"})})}),e("main",{children:e("ul",{children:[o.map(p=>e("li",{children:[e(at,{account:p,instance:s}),e(Ja,{account:p,listID:t})]},p.id)),c&&f==="default"&&e(yt,{as:"li",onChange:p=>p&&h(),children:e("button",{type:"button",class:"light block",onClick:h,children:e(l,{id:"uXRAkV"})})})]})})]})}function Ja({account:t,listID:n}){const{masto:i}=ce(),[s,o]=L("default"),[a,f]=L(!1);return e(rt,{confirm:!a,confirmLabel:e("span",{children:e(l,{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"),f(!1)}catch{o("error")}})()):(o("loading"),(async()=>{try{await i.v1.lists.$select(n).accounts.remove({accountIds:[t.id]}),o("default"),f(!0)}catch{o("error")}})())},children:e("button",{type:"button",class:`light ${a?"":"danger"}`,disabled:s==="loading",children:a?g._({id:"m16xKo"}):g._({id:"MWIaew"})})})}const Xa={mention:["account","status"],status:["account","status"],reblog:["account","status"],follow:["account"],follow_request:["account"],favourite:["account","status"],poll:["status"],update:["status"]};function $s(t){return t.filter(n=>{const{type:i,id:s,createdAt:o}=n;if(!i)return!1;const a=Xa[i];return a!=null&&a.length?a.every(f=>!!n[f]):!0})}function Ms(t){if(t!=null&&t.notificationGroups){const{accounts:n=[],notificationGroups:i=[],statuses:s=[]}=t;return i.map(o=>{const{sampleAccountIds:a,statusId:f}=o,d=(a==null?void 0:a.map(r=>n.find(m=>m.id===r)))||[],c=(s==null?void 0:s.find(r=>r.id===f))||null;return{...o,sampleAccounts:d,status:c}})}return t}function Qa(t){const n=t.map(o=>{const{latestPageNotificationAt:a,mostRecentNotificationId:f,sampleAccounts:d,notificationsCount:c}=o;return{id:""+f,createdAt:a,account:d[0],...o}}),i={},s=[];for(let o=0;oy.id===m.id);k?(k._types.push(h),k._types.sort().reverse(),w._ids+=`-${c}`):(m._types=[h],w._accounts.push(m),w._ids+=`-${c}`)}else{m&&(m._types=[h]);let k=n[b]={...d,type:v,_ids:c,_accounts:m?[m]:[]};i[f++]=k}}const s={},o=[];for(let a=0,f=0;a{Ge(_,s)})),{...y,value:C==null?void 0:C.map(_=>_.status)}}const h=j(),p=j();async function u(k){(k||!h.current)&&(h.current=i.v1.conversations.list({limit:Bi}));const y=await h.current.next();let{value:C}=y;return C=C==null?void 0:C.filter(_=>_.lastStatus),C!=null&&C.length&&(k&&(p.current=C[0].lastStatus.id),C.forEach(({lastStatus:_})=>{Ge(_,s)})),{...y,value:C==null?void 0:C.map(_=>_.lastStatus)}}function v(...k){return d==="private"?u(...k):m(...k)}async function b(){var k;if(d==="private")try{const y=await i.v1.conversations.list({limit:1,since_id:p.current}).next();let{value:C}=y;const _=((k=C[0])==null?void 0:k.id)===p.current;return C!=null&&C.length&&!_?(p.current=C[0].lastStatus.id,!0):!1}catch{return!1}else try{const y=await i.v1.notifications.list({limit:1,types:["mention"],since_id:r.current}).next();let{value:C}=y;return C!=null&&C.length?(r.current=C[0].id,!0):!1}catch{return!1}}const w=be(()=>e("div",{class:"filter-bar centered",children:[e(ue,{to:"/mentions",class:d?"":"is-active",onClick:k=>{t&&(k.preventDefault(),f(null))},children:e(l,{id:"N40H+G"})}),e(ue,{to:"/mentions?type=private",class:d==="private"?"is-active":"",onClick:k=>{t&&(k.preventDefault(),f("private"))},children:e(l,{id:"zwBp5t"})})]}),[d]);return e(kt,{title:g._({id:"/bZzdR"}),id:"mentions",emptyText:g._({id:"03jFGT"}),errorText:g._({id:"pqR9KF"}),instance:s,fetchItems:v,checkForUpdates:b,useItemID:!0,timelineStart:w,refresh:d})}const nr=80,ir=20,sr=new URLSearchParams,an={block:"center",inline:"center",behavior:"smooth"},Ps=Qi(()=>Je("@mastodon/grouped-notifications"),{maxAge:1e3*60*5});function Ns(t={}){const{masto:n}=ce();return A.settings.groupedNotificationsAlpha&&Ps()?n.v2_alpha.notifications.list({limit:ir,...t}):n.v1.notifications.list({limit:nr,...t})}function Os(t){return A.settings.groupedNotificationsAlpha&&Ps()?Qa(t):er(t)}const or=["forNotFollowing","forNotFollowers","forNewAccounts","forPrivateMentions","forLimitedAccounts"],cr={forNotFollowing:{id:"d+hDoa"},forNotFollowers:{id:"oAwuQj"},forNewAccounts:{id:"Srs8u7"},forPrivateMentions:{id:"IDC5Uw"},forLimitedAccounts:{id:"XMGM2e"}};function ar({columnMode:t}){var W;const{_:n}=Xe();Ke(g._({id:"iDNBZe"}),"/notifications");const{masto:i,instance:s}=ce(),o=Be(A),[a,f]=L("default"),[d]=t?[sr]:ut(),c=d.get("id"),r=d.get("access_token"),[m,h]=L(!1),[p,u]=L(!1),v=j(),{nearReachEnd:b,scrollDirection:w,reachStart:k,nearReachStart:y}=ra({scrollableRef:v}),C=w==="end"&&!y,[_,T]=L([]),[I,x]=L([]),z=j();async function D($){var K;if(($||!z.current)&&(z.current=Ns({excludeTypes:["follow_request"]})),/max_id=($|&)/i.test((K=z.current)==null?void 0:K.nextParams))return{done:!0};const E=await z.current.next(),B=Ms(E.value);if(B!=null&&B.length){B.forEach(Ce=>{Ge(Ce.status,s,{skipThreading:!0})});const le=Os(B);$?(A.notificationsLast=le[0],A.notifications=le,i.v1.markers.create({notifications:{lastReadId:le[0].id}}).catch(()=>{})):A.notifications.push(...le)}return A.notificationsShowNew=!1,A.notificationsLastFetchTime=Date.now(),E}async function M(){try{return await i.v1.followRequests.list({limit:80})}catch{return[]}}const G=()=>{f("loading"),(async()=>{try{const $=await M();T($),f("default")}catch{f("error")}})()};async function se(){try{return await i.v1.announcements.list()}catch{return[]}}const Z=Je("@mastodon/filtered-notifications"),[P,N]=L(!1),[U,Y]=L({});function F(){return i.v2.notifications.policy.fetch().catch(()=>{})}function ie(){F().then($=>{Y($)}).catch(()=>{})}const[O,ne]=L(null);function ye(){return i.v1.notifications.requests.list()}const ee=$=>{ve(!1),f("loading"),(async()=>{try{const E=D($);$&&(se().then(K=>{K.sort((le,Ce)=>{const We=new Date(le.updatedAt||le.createdAt);return new Date(Ce.updatedAt||Ce.createdAt)-We}),x(K)}).catch(()=>{}),M().then(K=>{T(K)}).catch(()=>{}),Z&&ie());const{done:B}=await E;h(!B),f("default")}catch{f("error")}})()};X(()=>{ee(!0)},[]),X(()=>{k&&ee(!0)},[k]);const[fe,ve]=L(!1),pe=it(({disableIdleCheck:$=!1}={})=>{var E;a!=="loading"&&o.settings.autoRefresh&&((E=v.current)==null?void 0:E.scrollTop)<16&&($||window.__IDLE__)&&!rr()&&ee(!0)},[o.notificationsShowNew,o.settings.autoRefresh,a]),we=j();Bt($=>{if($){const E=Date.now()-we.current;!we.current||E>1e3*3?pe({disableIdleCheck:!0}):we.current=Date.now()}});const $e=j(!0);X(()=>{let $=no(A,"notificationsShowNew",E=>{if($e.current){$e.current=!1;return}a!=="loading"&&(E&&pe(),ve(E))});return()=>$==null?void 0:$()},[]);const Me=new Date,xe=new Date(Me-24*60*60*1e3);let Ee=new Date;const Fe=!o.notifications.some($=>new Date($.createdAt).toDateString()===Me.toDateString()),ke=j();X(()=>{c&&(A.routeNotification={id:c,accessToken:atob(r)})},[c,r]);const J=".notification",me=Ue("j",()=>{const $=document.activeElement.closest(J),E=$==null?void 0:$.getBoundingClientRect(),B=Array.from(v.current.querySelectorAll(J));if($&&E.top0){const K=B.indexOf($);let le=B[K+1];le&&(le.focus(),le.scrollIntoView(an))}else{const K=B.find(le=>{const Ce=le.getBoundingClientRect();return Ce.top>=44&&Ce.left>=0});K&&(K.focus(),K.scrollIntoView(an))}}),Te=Ue("k",()=>{const $=document.activeElement.closest(J),E=$==null?void 0:$.getBoundingClientRect(),B=Array.from(v.current.querySelectorAll(J));if($&&E.top0){const K=B.indexOf($);let le=B[K-1];le&&(le.focus(),le.scrollIntoView(an))}else{const K=B.find(le=>{const Ce=le.getBoundingClientRect();return Ce.top>=44&&Ce.left>=0});K&&(K.focus(),K.scrollIntoView(an))}}),re=Ue(["enter","o"],()=>{const $=document.activeElement.closest(J),E=$==null?void 0:$.querySelector(".status-link");E&&E.click()});return e("div",{id:"notifications-page",class:"deck-container",ref:$=>{v.current=$,me.current=$,Te.current=$,re.current=$},tabIndex:"-1",children:[e("div",{class:`timeline-deck deck ${p?"only-mentions":""}`,children:[e("header",{hidden:C,onClick:$=>{var E;$.target.closest("a, button")||(E=v.current)==null||E.scrollTo({top:0,behavior:"smooth"})},onDblClick:$=>{$.target.closest("a, button")||ee(!0)},class:a==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Pt,{}),e(ue,{to:"/",class:"button plain",children:e(S,{icon:"home",size:"l",alt:g._({id:"i0qMbr"})})})]}),e("h1",{children:e(l,{id:"iDNBZe"})}),e("div",{class:"header-side",children:Z&&e("button",{type:"button",class:"button plain4",onClick:()=>{N(!0)},children:e(S,{icon:"settings",size:"l",alt:g._({id:"a/+arl"})})})})]}),fe&&a!=="loading"&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:()=>{var $;ee(!0),($=v.current)==null||$.scrollTo({top:0,behavior:"smooth"})},children:[e(S,{icon:"arrow-up"})," ",e(l,{id:"Jy9RU/"})]})]}),I.length>0&&e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e("details",{class:"announcements",children:[e("summary",{children:[e("span",{children:[e(S,{icon:"announce",class:"announcement-icon",size:"l"})," ",e(l,{id:"0whvLM",values:{0:I.length}})," ",e("small",{class:"insignificant",children:s})]}),I.length>1&&e("span",{class:"announcements-nav-buttons",children:I.map(($,E)=>e("button",{type:"button",class:"plain2 small",onClick:()=>{var B;(B=ke.current)==null||B.children[E].scrollIntoView({behavior:"smooth",block:"nearest"})},children:E+1}))})]}),e("ul",{class:`announcements-list-${I.length>1?"multiple":"single"}`,ref:ke,children:I.map($=>e("li",{children:e(lr,{announcement:$})}))})]})})}),_.length>0&&e("div",{class:"follow-requests",children:[e("h2",{class:"timeline-header",children:e(l,{id:"6Fs1Ba"})}),_.length>5?e("details",{children:[e("summary",{children:e(l,{id:"7dHKu4",values:{0:_.length}})}),e("ul",{children:_.map($=>e("li",{children:[e(at,{account:$}),e(Bn,{accountID:$.id,onChange:()=>{}})]},$.id))})]}):e("ul",{children:_.map($=>e("li",{children:[e(at,{account:$}),e(Bn,{accountID:$.id,onChange:()=>{}})]},$.id))})]}),Z&&((W=U==null?void 0:U.summary)==null?void 0:W.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 $=>{const{open:E}=$.target;if(E){const B=await ye();ne(B)}},children:[e("summary",{children:e(l,{id:"N3Bq0f",values:{0:U.summary.pendingRequestsCount}})}),O?(O==null?void 0:O.length)>0&&e("ul",{children:O.map($=>{var E,B;return e("li",{children:[e("div",{class:"request-notifcations",children:[!((E=$.lastStatus)!=null&&E.id)&&e(at,{useAvatarStatic:!0,showStats:!0,account:$.account}),((B=$.lastStatus)==null?void 0:B.id)&&e("div",{class:"last-post",children:e(ue,{class:"status-link",to:`/${s}/s/${$.lastStatus.id}`,children:e(qe,{status:$.lastStatus,size:"s",readOnly:!0})})}),e(ur,{request:$})]}),e(hr,{request:$,onChange:()=>{ee(!0)}})]},$.id)})}):e("p",{class:"ui-state",children:e(Le,{abrupt:!0})})]})})})}),e("div",{id:"mentions-option",children:e("label",{children:[e("input",{type:"checkbox",checked:p,onChange:$=>{u($.target.checked)}})," ",e(l,{id:"0udtPI"})]})}),e("h2",{class:"timeline-header",children:e(l,{id:"ecUA8p"})}),Fe&&e("p",{class:"ui-state insignificant",children:a==="default"?g._({id:"KS7iJH"}):e(q,{children:"โ€ฆ"})}),o.notifications.length?e(q,{children:o.notifications.filter($=>$.type!=="follow_request").map($=>{if(p&&$.type!=="mention")return null;const E=new Date($.createdAt),B=E.toDateString()!==Ee.toDateString();B&&(Ee=E);const K=E.toDateString()===xe.toDateString()?g._({id:"y/0uwd"}):pt(Ee,{hideTime:!0});return e(q,{children:[B&&e("h2",{class:"timeline-header",children:K}),e(Cn,{instance:s,notification:$},$._ids||$.id)]},$._ids||$.id)})}):e(q,{children:[a==="loading"&&e(q,{children:e("ul",{class:"timeline flat",children:Array.from({length:5}).map(($,E)=>e("li",{class:"notification skeleton",children:[e("div",{class:"notification-type",children:e(S,{icon:"notification",size:"xl"})}),e("div",{class:"notification-content",children:e("p",{children:"โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆโ–ˆ"})})]}))})}),a==="error"&&e("p",{class:"ui-state",children:[e(l,{id:"gjzl8E"}),e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>ee(!0),children:e(l,{id:"KDw4GX"})})]})]}),m&&e(yt,{onChange:$=>{$&&ee()},children:e("button",{type:"button",class:"plain block",disabled:a==="loading",onClick:()=>ee(),style:{marginBlockEnd:"6em"},children:a==="loading"?e(Le,{abrupt:!0}):e(l,{id:"uXRAkV"})})})]}),Z&&P&&e(ze,{onClick:$=>{$.target===$.currentTarget&&N(!1)},children:e("div",{class:"sheet",id:"notifications-settings",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>N(!1),children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(l,{id:"a/+arl"})})}),e("main",{children:e("form",{onSubmit:$=>{$.preventDefault();const{forNotFollowing:E,forNotFollowers:B,forNewAccounts:K,forPrivateMentions:le,forLimitedAccounts:Ce}=$.target,We={...U,forNotFollowing:E.value,forNotFollowers:B.value,forNewAccounts:K.value,forPrivateMentions:le.value,forLimitedAccounts:Ce.value};Y(We),N(!1),(async()=>{try{await i.v2.notifications.policy.update(We),de(g._({id:"4+7X9i"}))}catch{}})()},children:[e("p",{children:e(l,{id:"WrkPTf"})}),e("div",{class:"notification-policy-fields",children:or.map($=>{const E=U[$];return e("div",{children:e("label",{children:[n(cr[$]),e("select",{name:$,defaultValue:E,class:"small",children:[e("option",{value:"accept",children:e(l,{id:"g3UF2V"})}),e("option",{value:"filter",children:e(l,{id:"o7J4JM"})}),e("option",{value:"drop",children:e(l,{id:"gbbkE7"})})]})]})},$)})}),e("p",{children:e("button",{type:"submit",children:e(l,{id:"tfDRzk"})})})]})})]})})]})}function rr(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}function lr({announcement:t}){const{instance:n}=ce(),{contact:i}=Zi(),s=i==null?void 0:i.account,{id:o,content:a,startsAt:f,endsAt:d,published:c,allDay:r,publishedAt:m,updatedAt:h,read:p,mentions:u,statuses:v,tags:b,emojis:w,reactions:k}=t,y=new Date(m),C=pt(y),_=new Date(h),T=pt(_);return e("div",{class:"announcement-block",children:[e(at,{account:s}),e("div",{class:"announcement-content",onClick:ns({mentions:u,instance:n}),dangerouslySetInnerHTML:{__html:Nn(a,{emojis:w})}}),e("p",{class:"insignificant",children:[e("time",{datetime:y.toISOString(),children:pt(y)}),h&&T!==C&&e(q,{children:[" ","โ€ข"," ",e("span",{class:"ib",children:e(l,{id:"TbFrLc",values:{0:pt(_)},components:{0:e("time",{datetime:_.toISOString()})}})})]})]}),e("div",{class:"announcement-reactions",hidden:!0,children:k.map(I=>{const{name:x,count:z,me:D,staticUrl:M,url:G}=I;return e("button",{type:"button",class:`plain4 small ${D?"reacted":""}`,children:[G||M?e("img",{src:G||M,alt:x,width:"16",height:"16"}):e("span",{children:x})," ",e("span",{class:"count",children:Ve(z)})]})})})]})}function dr(t){const{masto:n}=ce();return n.v1.notifications.list({accountID:t})}function ur({request:t}){var h;const{instance:n}=ce(),[i,s]=L("loading"),{account:o,lastStatus:a}=t,[f,d]=L(!1),[c,r]=L([]);function m(){d(!1)}return X(()=>{var p;(p=t==null?void 0:t.account)!=null&&p.id&&f&&(s("loading"),(async()=>{const u=await dr(t.account.id);r(u||[]),s("default")})())},[f,(h=t==null?void 0:t.account)==null?void 0:h.id]),e(q,{children:[e("button",{type:"button",class:"plain4 request-notifications-account",onClick:()=>{d(!0)},children:[e(S,{icon:"notification",class:"more-insignificant"})," ",e("small",{children:e(l,{id:"H0wUNM",values:{0:o.username},components:{0:e("span",{class:"bidi-isolate"})}})})," ",e(S,{icon:"chevron-down"})]}),f&&e(ze,{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(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(l,{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(Le,{abrupt:!0})}):c.map(p=>e("div",{class:"notification-peek",onClick:u=>{const{target:v}=u;(u.target.tagName==="BUTTON"||u.target.tagName==="A")&&m()},children:e(Cn,{instance:n,notification:p,isStatic:!0})}))})]})})]})}function hr({request:t,onChange:n}){const{masto:i}=ce(),[s,o]=L("default"),[a,f]=L(null),d=a!==null;return e("p",{class:"notification-request-buttons",children:[e("button",{type:"button",disabled:s==="loading"||d,onClick:()=>{o("loading"),(async()=>{try{await i.v1.notifications.requests.$select(t.id).accept(),f("accept"),o("default"),n({request:t,state:"accept"}),de(g._({id:"ZtBMwU",values:{0:t.account.username}}))}catch{o("error"),de(g._({id:"S92JKG"}))}})()},children:e(l,{id:"h7peZQ"})})," ",e("button",{type:"button",disabled:s==="loading"||d,class:"light danger",onClick:()=>{o("loading"),(async()=>{try{await i.v1.notifications.requests.$select(t.id).dismiss(),f("dismiss"),o("default"),n({request:t,state:"dismiss"}),de(g._({id:"ibBDry",values:{0:t.account.username}}))}catch{o("error"),de(g._({id:"S5aemF"}))}})()},children:e(l,{id:"1QfxQT"})}),e("span",{class:"notification-request-states",children:s==="loading"?e(Le,{abrupt:!0}):a==="accept"?e(S,{icon:"check-circle",alt:g._({id:"bzMKg7"}),class:"notification-accepted"}):a==="dismiss"&&e(S,{icon:"x-circle",alt:g._({id:"J6hrEy"}),class:"notification-dismissed"})})]})}const zs=ct(ar),fr=20;function qn({local:t,columnMode:n,...i}){const s=Be(A),o=!!t,a=n?{}:Mt(),{masto:f,instance:d}=ce({instance:(i==null?void 0:i.instance)||a.instance}),{masto:c,instance:r}=ce(),m=o?g._({id:"u96B/B",values:{instance:d}}):g._({id:"PgVqvd",values:{instance:d}});Ke(m,o?"/:instance?/p/l":"/:instance?/p");const h=j(),p=j();async function u(b){if(b||!p.current){const y={limit:fr,local:o||void 0};!o&&Je("@pixelfed/global-feed")&&(y.remote=!0),p.current=f.v1.timelines.public.list(y)}const w=await p.current.next();let{value:k}=w;return k!=null&&k.length&&(b&&(h.current=k[0].id),k.forEach(y=>{Ge(y,d)})),{...w,value:k}}async function v(){var b;try{const w=await f.v1.timelines.public.list({limit:1,local:o,since_id:h.current}).next();let{value:k}=w;const y=((b=k[0])==null?void 0:b.id)===h.current;return k!=null&&k.length&&!y?(k=Rt(k,"public"),!0):!1}catch{return!1}}return e(kt,{title:m,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:o?g._({id:"pJQgQV"}):g._({id:"cg0I+x"})}),e("div",{children:d})]}),id:"public",instance:d,emptyText:g._({id:"BiZJ6G"}),errorText:g._({id:"scd9lw"}),fetchItems:u,checkForUpdates:v,useItemID:!0,headerStart:e(q,{}),boostsCarousel:s.settings.boostsCarousel,filterContext:"public",headerEnd:e(ot,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(S,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),children:[e(ge,{href:o?`/#/${d}/p`:`/#/${d}/p/l`,children:o?e(q,{children:[e(S,{icon:"transfer"})," ",e("span",{children:e(l,{id:"dXMiUw"})})]}):e(q,{children:[e(S,{icon:"transfer"})," ",e("span",{children:e(l,{id:"t2B/we"})})]})}),e(Ye,{}),e(ge,{onClick:()=>{let b=prompt(g._({id:"2MQ2cd"}));if(!/\./.test(b)){b&&alert(g._({id:"7WddtO"}));return}b&&(b=b.toLowerCase().trim(),location.hash=o?`/${b}/p/l`:`/${b}/p`)},children:[e(S,{icon:"bus"})," ",e("span",{children:e(l,{id:"Sq04Yc"})})]}),r!==d&&e(ge,{onClick:()=>{location.hash=o?`/${r}/p/l`:`/${r}/p`},children:[e(S,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(l,{id:"iAzCp4",values:{currentInstance:r},components:{0:e("b",{})}})})]})]})},d+o)}const rn=5,Dn=40,pr=new URLSearchParams;function Us({columnMode:t,...n}){const i=t?{}:Mt(),{masto:s,instance:o,authenticated:a}=ce({instance:i.instance}),[f,d]=L("default"),[c]=t?[pr]:ut(),r=j(),m=(n==null?void 0:n.query)||c.get("q"),h=t?"statuses":(n==null?void 0:n.type)||c.get("type");let p=g._({id:"A1taO8"});if(m)switch(h){case"statuses":p=g._({id:"6YeoAt",values:{q:m}});break;case"accounts":p=g._({id:"fpgumQ",values:{q:m}});break;case"hashtags":p=g._({id:"AuiMZZ",values:{q:m}});break;default:p=g._({id:"wr3GZI",values:{q:m}})}Ke(p,"/search");const[u,v]=L(!1),b=j(0);X(()=>{b.current=0},[m,h]);const w=j();vt(()=>{var P,N;(N=(P=w.current)==null?void 0:P.scrollTo)==null||N.call(P,0,0)},[m,h]);const[k,y]=L([]),[C,_]=L([]),[T,I]=L([]);X(()=>{y([]),_([]),I([])},[m]);const x={statuses:y,accounts:_,hashtags:I},[z,D]=L({}),M=async P=>{if(!(P!=null&&P.length))return;const N=await Kn(P,z);N&&D({...z,...N})};function G(P){P&&(b.current=0),!(!P&&!a)&&(d("loading"),P&&!h&&(y(k.slice(0,rn)),_(C.slice(0,rn)),I(T.slice(0,rn))),(async()=>{var U,Y;const N={q:m,resolve:a,limit:rn};h&&(N.limit=Dn,N.type=h,a&&(N.offset=b.current));try{const F=await s.v2.search.fetch(N);if(h)if(P){x[h](F[h]);const ie=(U=F[h])==null?void 0:U.length;b.current=Dn,v(!!ie)}else{x[h](O=>[...O,...F[h]]);const ie=(Y=F[h])==null?void 0:Y.length;b.current=b.current+Dn,v(!!ie)}else y(F.statuses||[]),_(F.accounts||[]),I(F.hashtags||[]),b.current=0,v(!1);M(F.accounts),d("default")}catch{d("error")}})())}const se=j();Bt(P=>{var U;const N=((U=w.current)==null?void 0:U.scrollTop)===0;if(P&&N){const Y=Date.now()-se.current;!se.current||Y>1e3*3?G(!0):se.current=Date.now()}}),X(()=>{var P,N,U,Y;(N=(P=r.current)==null?void 0:P.setValue)==null||N.call(P,m||""),m?G(!0):(Y=(U=r.current)==null?void 0:U.focus)==null||Y.call(U)},[m,h,o]),Ue(["/","Slash"],P=>{var N,U,Y,F;(U=(N=r.current)==null?void 0:N.focus)==null||U.call(N),(F=(Y=r.current)==null?void 0:Y.select)==null||F.call(Y)},{preventDefault:!0});const[Z]=ni();return e("div",{id:"search-page",class:"deck-container",ref:w,children:e("div",{class:"timeline-deck deck",children:[e("header",{class:f==="loading"?"loading":"",children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:e(Pt,{})}),e(Is,{ref:r}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{G(!0)},disabled:f==="loading",children:e(S,{icon:"search",size:"l",alt:g._({id:"A1taO8"})})})})]})}),e("main",{children:[!!m&&!t&&e("div",{ref:Z,class:`filter-bar ${f==="loading"?"loading":""}`,children:[!!h&&e(ue,{to:`/search${m?`?q=${encodeURIComponent(m)}`:""}`,children:[e(S,{icon:"chevron-left"})," ",e(l,{id:"N40H+G"})]}),[{label:g._({id:"bPwFdf"}),type:"accounts",to:`/search?q=${encodeURIComponent(m)}&type=accounts`},{label:g._({id:"VwUsHI"}),type:"hashtags",to:`/search?q=${encodeURIComponent(m)}&type=hashtags`},{label:g._({id:"+owNNn"}),type:"statuses",to:`/search?q=${encodeURIComponent(m)}&type=statuses`}].sort((P,N)=>P.type===h?-1:N.type===h?1:0).map(P=>e(ue,{to:P.to,children:P.label},P.type))]}),m?e(q,{children:[(!h||h==="accounts")&&e(q,{children:[h!=="accounts"&&e("h2",{class:"timeline-header",children:[e(l,{id:"bPwFdf"})," ",e(ue,{to:`/search?q=${encodeURIComponent(m)}&type=accounts`,children:e(S,{icon:"arrow-right",size:"l",alt:g._({id:"V1fa9u"})})})]}),C.length>0?e(q,{children:[e("ul",{class:"timeline flat accounts-list",children:C.map(P=>e("li",{children:e(at,{account:P,instance:o,showStats:!0,relationship:z[P.id]})},P.id))}),h!=="accounts"&&e("div",{class:"ui-state",children:e(ue,{class:"plain button",to:`/search?q=${encodeURIComponent(m)}&type=accounts`,children:[e(l,{id:"BMmtZ8"})," ",e(S,{icon:"arrow-right"})]})})]}):!h&&(f==="loading"?e("p",{class:"ui-state",children:e(Le,{abrupt:!0})}):e("p",{class:"ui-state",children:e(l,{id:"YYB61U"})}))]}),(!h||h==="hashtags")&&e(q,{children:[h!=="hashtags"&&e("h2",{class:"timeline-header",children:[e(l,{id:"VwUsHI"})," ",e(ue,{to:`/search?q=${encodeURIComponent(m)}&type=hashtags`,children:e(S,{icon:"arrow-right",size:"l",alt:g._({id:"V1fa9u"})})})]}),T.length>0?e(q,{children:[e("ul",{class:"link-list hashtag-list",children:T.map(P=>{var F;const{name:N,history:U}=P,Y=(F=U==null?void 0:U.reduce)==null?void 0:F.call(U,(ie,O)=>ie+ +O.uses,0);return e("li",{children:e(ue,{to:o?`/${o}/t/${N}`:`/t/${N}`,children:[e(S,{icon:"hashtag",alt:"#"}),e("span",{children:N}),!!Y&&e("span",{class:"count",children:Ve(Y)})]})},`${N}-${Y}`)})}),h!=="hashtags"&&e("div",{class:"ui-state",children:e(ue,{class:"plain button",to:`/search?q=${encodeURIComponent(m)}&type=hashtags`,children:[e(l,{id:"Nc/W5J"})," ",e(S,{icon:"arrow-right"})]})})]}):!h&&(f==="loading"?e("p",{class:"ui-state",children:e(Le,{abrupt:!0})}):e("p",{class:"ui-state",children:e(l,{id:"4MFM3P"})}))]}),(!h||h==="statuses")&&e(q,{children:[h!=="statuses"&&e("h2",{class:"timeline-header",children:[e(l,{id:"+owNNn"})," ",e(ue,{to:`/search?q=${encodeURIComponent(m)}&type=statuses`,children:e(S,{icon:"arrow-right",size:"l",alt:g._({id:"V1fa9u"})})})]}),k.length>0?e(q,{children:[e("ul",{class:"timeline",children:k.map(P=>e("li",{children:e(ue,{class:"status-link",to:o?`/${o}/s/${P.id}`:`/s/${P.id}`,children:e(qe,{status:P})})},P.id))}),h!=="statuses"&&e("div",{class:"ui-state",children:e(ue,{class:"plain button",to:`/search?q=${encodeURIComponent(m)}&type=statuses`,children:[e(l,{id:"LYCgej"})," ",e(S,{icon:"arrow-right"})]})})]}):!h&&(f==="loading"?e("p",{class:"ui-state",children:e(Le,{abrupt:!0})}):e("p",{class:"ui-state",children:e(l,{id:"Hzi9AA"})}))]}),!!h&&(f==="default"?u?e(yt,{onChange:P=>{P&&G()},children:e("button",{type:"button",class:"plain block",onClick:()=>G(),style:{marginBlockEnd:"6em"},children:e(l,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(l,{id:"2EYeAZ"})}):f==="loading"&&e("p",{class:"ui-state",children:e(Le,{abrupt:!0})}))]}):f==="loading"?e("p",{class:"ui-state",children:e(Le,{abrupt:!0})}):e("p",{class:"ui-state",children:e(l,{id:"fGn1Hk"})})]})]})})}const mr=20,Fs=10*60*1e3,gr=wt(t=>t.v1.trends.links.list().next(),{maxAge:Fs}),br=wt(t=>t.v1.trends.tags.list().next(),{maxAge:Fs});function vr(t){return Je("@pixelfed/trending")?t.pixelfed.v2.discover.posts.trending.list({range:"daily"}):t.v1.trends.statuses.list({limit:mr})}function yr(t,n){return t.v1.timelines.link.list(n)}function Bs({columnMode:t,...n}){const i=Be(A),s=t?{}:Mt(),{masto:o,instance:a}=ce({instance:(n==null?void 0:n.instance)||s.instance}),{masto:f,instance:d}=ce(),c=g._({id:"cI3UEs",values:{instance:a}});Ke(c,"/:instance?/trending");const r=j(),m=a===d,[h,p]=L([]),[u,v]=L([]),b=j();async function w(Z){var U;if(Z||!b.current){if(b.current=vr(o),Je("@mastodon/trending-hashtags"))try{const{value:Y}=await br(o);Y!=null&&Y.length&&p(Y)}catch{}if(Je("@mastodon/trending-links"))try{const{value:Y}=await gr(o,a),F=(U=Y==null?void 0:Y.filter)==null?void 0:U.call(Y,ie=>ie.type==="link");F!=null&&F.length&&v(F)}catch{}}const P=await b.current.next();let{value:N}=P;return N!=null&&N.length&&(Z&&(r.current=N[0].id),N.forEach(Y=>{Ge(Y,a)})),{...P,value:N}}const[k,y]=L(!1),C=j(),[_,T]=L(null),I=!!_,x=j(),z=m&&Je("@mastodon/trending-link-posts");X(()=>{_&&x.current&&x.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[_]);const D=j();async function M(Z){(Z||!C.current)&&(y(!0),C.current=yr(o,{url:_})),D.current=_;const P=await C.current.next();let{value:N}=P;return N!=null&&N.length&&(N=Rt(N,"public"),N.forEach(U=>{Ge(U,a)})),D.current===_&&y(!1),{...P,value:N}}async function G(){try{const Z=await o.v1.trends.statuses.list({limit:1}).next();let{value:P}=Z;return P=Rt(P,"public"),P!=null&&P.length&&P[0].id!==r.current?(r.current=P[0].id,!0):!1}catch{return!1}}const se=be(()=>e(q,{children:[!!h.length&&e("div",{class:"filter-bar expandable",children:[e(S,{icon:"chart",class:"insignificant",size:"l"}),h.map((Z,P)=>{const{name:N,history:U}=Z,Y=U.reduce((F,ie)=>F+ +ie.uses,0);return e(ue,{to:`/${a}/t/${N}`,children:[e("span",{dir:"auto",children:[e("span",{class:"more-insignificant",children:"#"}),N]}),e("span",{class:"filter-count",children:Ve(Y)})]},N)})]}),!!u.length&&e("div",{class:"links-bar",children:[e("header",{children:e("h3",{children:e(l,{id:"9veeTb"})})}),u.map(Z=>{const{authorName:P,authorUrl:N,blurhash:U,description:Y,height:F,image:ie,imageDescription:O,language:ne,providerName:ye,providerUrl:ee,publishedAt:fe,title:ve,url:pe,width:we}=Z,$e=Gt.toUnicode(URL.parse(pe).hostname.replace(/^www\./,"").replace(/\/$/,""));let Me;if(U){const xe=Zn(U),Ee=ai(xe);Me=ri([.6,Ee[1],Ee[2]])}return e("div",{children:[e("a",{ref:_===pe?x:null,href:pe,target:"_blank",rel:"noopener noreferrer",class:I?_===pe?"active":"inactive":"",style:Me?{"--accent-color":`rgb(${Me.join(",")})`,"--accent-alpha-color":`rgba(${Me.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:ie,alt:O,width:we,height:F,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:$e})," ",!!fe&&e(q,{children:"ยท "}),!!fe&&e(q,{children:e(Vt,{datetime:fe,format:"micro"})})]}),!!ve&&e("h1",{class:"title",lang:ne,dir:"auto",title:ve,children:ve})]}),!!Y&&e("p",{class:"description",lang:ne,dir:"auto",title:Y,children:Y})]})]})}),z&&e("button",{type:"button",class:"small plain4 block",onClick:()=>{T(pe)},disabled:pe===_,children:[e(S,{icon:"comment2"})," ",e("span",{children:e(l,{id:"/bZzdR"})})," ",e(S,{icon:"chevron-down"})]})]},pe)})]}),z&&!!u.length&&e("div",{class:`timeline-header-block ${I?"blended":""}`,children:I?e(q,{children:[e("div",{style:{width:50,flexShrink:0,textAlign:"center"},children:k?e(Le,{abrupt:!0}):e("button",{type:"button",class:"light",onClick:()=>{T(null)},children:e(S,{icon:"x",alt:g._({id:"9Q/4xJ"})})})}),e("p",{children:e(l,{id:"BATCqf",values:{0:_.replace(/^https?:\/\/(www\.)?/i,"").replace(/\/$/,"")},components:{0:e("span",{class:"link-text"})}})})]}):e("p",{class:"insignificant",children:e(l,{id:"Vosm4k"})})})]}),[h,u,_,k]);return e(kt,{title:c,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:e(l,{id:"4/iCqx"})}),e("div",{children:a})]}),id:"trending",instance:a,emptyText:g._({id:"6HA9+s"}),errorText:g._({id:"scd9lw"}),fetchItems:I?M:w,checkForUpdates:I?void 0:G,checkForUpdatesInterval:5*60*1e3,useItemID:!0,headerStart:e(q,{}),boostsCarousel:i.settings.boostsCarousel,filterContext:"public",timelineStart:se,refresh:_,clearWhenRefresh:!0,view:I?"link-mentions":void 0,headerEnd:e(ot,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(S,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),children:[e(ge,{onClick:()=>{let Z=prompt(g._({id:"2MQ2cd"}));if(!/\./.test(Z)){Z&&alert(g._({id:"7WddtO"}));return}Z&&(Z=Z.toLowerCase().trim(),location.hash=`/${Z}/trending`)},children:[e(S,{icon:"bus"})," ",e("span",{children:e(l,{id:"Sq04Yc"})})]}),d!==a&&e(ge,{onClick:()=>{location.hash=`/${d}/trending`},children:[e(S,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(l,{id:"iAzCp4",values:{currentInstance:d},components:{0:e("b",{})}})})]})]})},a)}function wr(){Ke(g._({id:"i0qMbr"}),"/");const t=Be(A),{shortcuts:n}=t,i=n.map(s=>{if(!s)return null;const{type:o,...a}=s,f={following:ui,notifications:zs,list:Ls,public:qn,bookmarks:xs,favourites:As,hashtag:Rs,mentions:Ds,trending:Bs,search:Us}[o];return!f||o==="search"&&!a.query||o==="list"&&!a.id?null:e(f,{...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;document.querySelectorAll("#columns > *")[a].focus()}catch{}}),e("div",{id:"columns",onContextMenu:s=>{s.target.closest(".deck > header")&&!s.target.closest("a")&&!s.target.closest("button")&&(s.preventDefault(),A.showShortcutsSettings=!0)},children:i})}function kr(){var i;const{_:t}=Xe(),n=Be(A);return X(()=>{(async()=>{const s=await dt.drafts.keys();if(s.length){const o=gn();s.filter(f=>f.startsWith(o)).length&&(A.showDrafts=!0)}})()},[]),e(q,{children:(n.settings.shortcutsViewMode==="multi-column"||!n.settings.shortcutsViewMode&&n.settings.shortcutsColumnsMode)&&((i=n.shortcuts)!=null&&i.length)?e(wr,{}):e(ui,{title:t({id:"i0qMbr"}),path:"/",id:"home",headerStart:!1,headerEnd:e(_r,{})})})}function _r(){const t=Be(A),n=j(),[i,s]=L(void 0);return e(q,{children:[e(ue,{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(S,{icon:"notification",size:"l",alt:g._({id:"iDNBZe"})})}),e(Cr,{state:i,anchorRef:n,onClose:()=>s(void 0)})]})}const Sr=5;function Cr({anchorRef:t,state:n,onClose:i}){const{masto:s,instance:o}=ce(),a=Be(A),[f,d]=L("default"),c=Ns();async function r(){const b=await c.next(),w=Ms(b.value);if(w!=null&&w.length){w.forEach(y=>{Ge(y.status,o,{skipThreading:!0})});const k=Os(w);A.notificationsLast=k[0],A.notifications=k,s.v1.markers.create({notifications:{lastReadId:k[0].id}}).catch(()=>{})}return A.notificationsShowNew=!1,A.notificationsLastFetchTime=Date.now(),b}const[m,h]=L(!1);function p(){return s.v1.followRequests.list({limit:1})}function u(){d("loading"),(async()=>{try{await r();const b=await p();h(!!(b!=null&&b.length)),d("default")}catch{d("error")}})()}X(()=>{n==="open"&&u()},[n]);const v=j();return e(as,{ref:v,menuClassName:"notifications-menu",state:n,anchorRef:t,onClose:i,portal:{target:document.body},containerProps:{onClick:()=>{var b,w;(w=(b=v.current)==null?void 0:b.closeMenu)==null||w.call(b)}},overflow:"auto",viewScroll:"close",position:"anchor",align:"center",boundingBoxPadding:"8 8 8 8",children:[e("header",{children:e("h2",{children:e(l,{id:"iDNBZe"})})}),e("main",{children:a.notifications.length?e(q,{children:a.notifications.slice(0,Sr).map(b=>e(Cn,{instance:o,notification:b,disableContextMenu:!0},b._ids||b.id))}):f==="loading"?e("div",{class:"ui-state",children:e(Le,{abrupt:!0})}):f==="error"&&e("div",{class:"ui-state",children:[e("p",{children:e(l,{id:"5GFQTh"})}),e("p",{children:e("button",{type:"button",onClick:u,children:e(l,{id:"KDw4GX"})})})]})}),e("footer",{children:[e(ue,{to:"/mentions",class:"button plain",children:[e(S,{icon:"at"})," ",e("span",{children:e(l,{id:"/bZzdR"})})]}),e(ue,{to:"/notifications",class:"button plain2",children:[m?e(l,{id:"OdVhdR",components:{0:e("span",{class:"tag collapsed"}),1:e("span",{})}}):e("b",{children:e(l,{id:"gukqfD"})})," ",e(S,{icon:"arrow-right"})]})]})]})}const Ir=ct(kr),Tr=[/^\/@[^@\/]+\/(?:statuses|posts)\/([^\/]+)/i,/\/notes\/([^\/]+)/i,/^\/(?:notice|objects)\/([a-z0-9-]+)/i,/\/@[^@\/]+\/post\/([^\/]+)/i,/\/@[^@\/]+@?[^\/]+?\/([^\/]+)/i,/^\/p\/[^\/]+\/([^\/]+)/i];function qs(t){const{hostname:n,pathname:i}=URL.parse(t);for(const s of Tr){const[,o]=i.match(s)||[];if(o)return{instance:n,id:o}}return{}}function xr(t){const{instance:n,id:i}=qs(t);return n&&i?`/${n}/s/${i}`:null}function Ar(){const n=Yt().pathname.replace(/^\//,""),i=qs(n),s=i!=null&&i.instance?`/${i.instance}/s/${i.id}`:null,[o,a]=L("loading");return vt(()=>{a("loading"),(async()=>{try{const{instance:f,id:d}=i;if(d){const{masto:c}=ce({instance:f});if(await c.v1.statuses.$select(d).fetch()){window.location.hash=s+"?view=full";return}}}catch{}{const{masto:f,instance:d}=ce(),c=await f.v2.search.fetch({q:n,limit:1,resolve:!0});if(c.statuses.length){const r=c.statuses[0];window.location.hash=`/${d}/s/${r.id}?view=full`}else if(c.accounts.length){const r=c.accounts[0];window.location.hash=`/${d}/a/${r.id}`}else s?window.location.hash=s+"?view=full":a("error")}})()},[s]),e("div",{class:"ui-state",tabIndex:"-1",children:[o==="loading"?e(q,{children:[e(Le,{abrupt:!0}),e("h2",{children:e(l,{id:"RTAr/z"})}),e("p",{children:e("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:n})})]}):e(q,{children:[e("h2",{children:e(l,{id:"ufzZSJ"})}),e("p",{children:e("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:n})})]}),e("hr",{}),e("p",{children:e(ue,{to:"/",children:e(l,{id:"iWpEwy"})})})]})}function Er(){Ke(g._({id:"h16FyT"}),"/l");const[t,n]=L("default"),[i,s]=$t(c=>c+1,0),[o,a]=L([]);X(()=>{n("loading"),(async()=>{try{const c=await Fn();a(c),n("default")}catch{n("error")}})()},[i]);const[f,d]=L(!1);return e("div",{id:"lists-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck",children:[e("header",{children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Pt,{}),e(ue,{to:"/",class:"button plain",children:e(S,{icon:"home",size:"l"})})]}),e("h1",{children:e(l,{id:"h16FyT"})}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>d(!0),children:e(S,{icon:"plus",size:"l",alt:g._({id:"Sb2gYF"})})})})]})}),e("main",{children:o.length>0?e(q,{children:[e("ul",{class:"link-list",children:o.map(c=>e("li",{children:e(ue,{to:`/l/${c.id}`,children:e("span",{children:[e(S,{icon:"list"})," ",e("span",{children:c.title})]})})}))}),o.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(l,{id:"8prZNK",values:{0:o.length}})})})]}):t==="loading"?e("p",{class:"ui-state",children:e(Le,{})}):t==="error"?e("p",{class:"ui-state",children:e(l,{id:"v/l5uA"})}):e("p",{class:"ui-state",children:e(l,{id:"IvPikw"})})})]}),f&&e(ze,{onClick:c=>{c.target===c.currentTarget&&d(!1)},children:e(ci,{list:f==null?void 0:f.list,onClose:c=>{c.state==="success"&&s(),d(!1)}})})]})}const Rr=""+new URL("instances-CwO9tuGQ.json",import.meta.url).href;function Lr(t){return("0"+t.toString(16)).slice(-2)}function $r(){var t=new Uint32Array(28);return window.crypto.getRandomValues(t),Array.from(t,Lr).join("")}function Mr(t){const i=new TextEncoder().encode(t);return window.crypto.subtle.digest("SHA-256",i)}function Dr(t){let n="";const i=new Uint8Array(t),s=i.byteLength;for(var o=0;o{(async()=>{try{const T=await(await fetch(Rr)).json();m(T),h.current=new To(T)}catch{}})()},[]);const p=_=>{_&&(he.local.set("instanceURL",_),(async()=>{s("loading");try{const{client_id:T,client_secret:I,vapid_key:x}=await Ur({instanceURL:_});if(await Pr({instanceURL:_}))if(T&&I){he.sessionCookie.set("clientID",T),he.sessionCookie.set("clientSecret",I),he.sessionCookie.set("vapidKey",x);const[D,M]=await Fr({instanceURL:_,client_id:T});he.sessionCookie.set("codeVerifier",M),location.href=D}else alert(g._({id:"ZP1FIA"}));else T&&I?(he.sessionCookie.set("clientID",T),he.sessionCookie.set("clientSecret",I),he.sessionCookie.set("vapidKey",x),location.href=await Br({instanceURL:_,client_id:T})):alert(g._({id:"ZP1FIA"}));s("default")}catch{s("error")}})())},u=d?d.replace(/^https?:\/\//,"").replace(/\/+$/,"").replace(/^@?[^@]+@/,"").trim():null,v=/[^\s\r\n\t\/\\]+\.[^\s\r\n\t\/\\]+/.test(u)&&!/[\s\/\\@]/.test(u),b=u?(C=(y=h.current)==null?void 0:y.search(u,{limit:10}))==null?void 0:C.map(_=>_.item):[],w=v?u:b!=null&&b.length?b[0]:d?r.find(_=>_.includes(d)):null,k=_=>{_.preventDefault(),p(w)};return f&&X(()=>{p(a||w)},[]),e("main",{id:"login",style:{textAlign:"center"},children:e("form",{onSubmit:k,children:[e("h1",{children:[e("img",{src:ii,alt:"",width:"80",height:"80"}),e("br",{}),e(l,{id:"sQia9P"})]}),e("label",{children:[e("p",{children:e(l,{id:"kyAi7k"})}),e("input",{value:d,required:!0,type:"text",class:"large",id:"instanceURL",ref:t,disabled:i==="loading",autocorrect:"off",autocapitalize:"off",autocomplete:"off",spellCheck:!1,placeholder:"instance domain",onInput:_=>{c(_.target.value)},dir:"auto"}),(b==null?void 0:b.length)>0?e("ul",{id:"instances-suggestions",children:b.map((_,T)=>e("li",{children:e("button",{type:"button",class:"plain5",onClick:()=>{p(_)},children:_})}))}):e("div",{id:"instances-eg",children:e(l,{id:"/OvbEC"})})]}),i==="error"&&e("p",{class:"error",children:e(l,{id:"rmBHZn"})}),e("div",{children:[e("button",{disabled:i==="loading"||!d||!w,children:w?g._({id:"2xahsi",values:{selectedInstanceText:w}}):g._({id:"xGVfLh"})})," "]}),e(Le,{hidden:i!=="loading"}),e("hr",{}),!jr&&e("p",{children:e("a",{href:"https://joinmastodon.org/servers",target:"_blank",children:e(l,{id:"LcOiWS"})})}),e("p",{children:e(ue,{to:"/",children:e(l,{id:"iWpEwy"})})}),e(si,{})]})})}const ln=40,Vr=10,Gr=5;let Hn={},hn={},fn={};function pn(t){delete hn[t],delete fn[t]}const Kt={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 ~ * *)",Hi=/\/s\//i;function Wr(t){var _;const{id:n}=t,{masto:i,instance:s}=ce({instance:t.instance}),o=Be(A),[a,f]=ut(),d=a.get("media"),c=a.get("media-only"),r=parseInt(d||c,10);let m=r>0;const h=a.get("mediaStatusID"),p=es(h,s);h&&!p&&(m=!1);const u=m&&!!c,v=st(n,s),[b,w]=L(A.statuses[v]);X(()=>{A.statuses[v]&&w(A.statuses[v])},[v]);const k=be(()=>{const{prevLocation:T}=A,I=((T==null?void 0:T.pathname)||"")+((T==null?void 0:T.search)||""),x=Qt("/:instance/s/:id",I)||Qt("/s/:id",I);return!I||x?"/":I},[]);X(()=>{!b&&m&&(async()=>{try{const T=await i.v1.statuses.$select(n).fetch();Ge(T,s),w(T)}catch{alert("Unable to load post."),location.hash=k}})()},[m]);const y=h?(_=o.statuses[st(h,s)])==null?void 0:_.mediaAttachments:b==null?void 0:b.mediaAttachments,C=it(()=>{!window.matchMedia("(min-width: calc(40em + 350px))").matches&&o.prevLocation?history.back():u?location.hash=k:(a.delete("media"),a.delete("mediaStatusID"),f(a))},[u,k,o.prevLocation]);return X(()=>{let T=setTimeout(()=>{const I=document.querySelector(".carousel");I&&I.focus()},100);return()=>clearTimeout(T)},[u]),X(()=>{const T=document.querySelectorAll(".deck-container");return T.forEach(I=>{I.setAttribute("inert","")}),()=>{T.forEach(I=>{I.removeAttribute("inert")})}},[]),e("div",{class:"deck-backdrop",children:[m?y!=null&&y.length?e(Ss,{mediaAttachments:y,statusID:h||n,instance:s,lang:b==null?void 0:b.language,index:r-1,onClose:C}):e("div",{class:"media-modal-container loading",children:e(Le,{abrupt:!0})}):e(ue,{to:k}),!u&&e(Zr,{id:n,instance:t.instance,closeLink:k})]})}function Kr(t){const{linkable:n,to:i,onClick:s,...o}=t;return n?e(ue,{class:"status-link",to:i,onClick:s,...o}):e("div",{class:"status-focus",tabIndex:0,...o})}function Zr({id:t,closeLink:n="/",instance:i}){var W,$;const[s,o]=ut(),a=s.get("media"),f=s.get("mediaStatusID"),d=parseInt(a,10)>0,c=j(!A.prevLocation&&(history.length===1||"navigation"in window&&(($=(W=navigation==null?void 0:navigation.entries)==null?void 0:W.call(navigation))==null?void 0:$.length)===1)),[r,m]=L(s.get("view")||c.current?"full":null),h=!!parseInt(s.get("translate")),{masto:p,instance:u}=ce({instance:i}),{masto:v,instance:b,authenticated:w}=ce(),k=u===b,y=Be(A),[C,_]=L([]),[T,I]=L("default"),x=j(),z=st(t,u),D=j(0),M=j();X(()=>{var E;(E=M.current)==null||E.focus()},[]),X(()=>{var B;const E=ds(()=>{if(!M.current)return;const{scrollTop:K}=M.current;T!=="loading"&&(fn[t]=K)},50);return(B=M.current)==null||B.addEventListener("scroll",E,{passive:!0}),E(),()=>{var K;E.cancel(),(K=M.current)==null||K.removeEventListener("scroll",E)}},[t,T!=="loading"]);const G=j(),se=j(),Z=({reloadHero:E}={})=>{I("loading");let B;const K=hn[t];if(K){const le=K.filter(Ce=>A.statuses[z]);_(le)}else _([{id:t}]);return(async()=>{var Re,Ne;const le=()=>yi(()=>p.v1.statuses.$select(t).fetch(),{retries:4}),Ce=yi(()=>p.v1.statuses.$select(t).context.fetch(),{retries:8}),We=!!y.statuses[z];let Q=y.statuses[z];if(!(We&&!E))try{Q=await le(),Ge(Q,u),await new Promise(R=>{setTimeout(R,100)})}catch{I("error");return}try{let R=function(ae){return ae==null?void 0:ae.map(Pe=>({id:Pe.id,account:Pe.account,repliesCount:Pe.repliesCount,content:Pe.content,weight:Xt(Pe),replies:R(Pe.__replies)}))};const V=await Ce,{ancestors:oe,descendants:H}=V;D.current=(H==null?void 0:H.length)||0;const te=new Set;oe.forEach(ae=>{Ge(ae,u,{skipThreading:!0}),ae.inReplyToId&&!oe.find(Pe=>Pe.id===ae.inReplyToId)&&te.add(ae.inReplyToId)});const Ae=oe.every(ae=>ae.account.id===Q.account.id),Se=[];H.forEach(ae=>{if(Ge(ae,u,{skipThreading:!0}),ae.inReplyToId&&!H.find(Pe=>Pe.id===ae.inReplyToId)&&ae.inReplyToId!==Q.id&&te.add(ae.inReplyToId),ae.inReplyToAccountId===ae.account.id)Se.push(ae);else if(ae.inReplyToId===Q.id)Se.push(ae);else if(!ae.inReplyToAccountId&&Se.find(Pe=>Pe.id===ae.inReplyToId)&&ae.account.id===Q.account.id)Se.push(ae);else{const Pe=H.find(Ze=>Ze.id===ae.inReplyToId);Pe&&(Pe.__replies||(Pe.__replies=[]),Pe.__replies.push(ae))}}),te.size;const _e=[...oe.map(ae=>({id:ae.id,ancestor:!0,isThread:Ae,accountID:ae.account.id,account:ae.account,repliesCount:ae.repliesCount,weight:Xt(ae)})),{id:t,accountID:Q.account.id,weight:Xt(Q)},...Se.map(ae=>({id:ae.id,account:ae.account,accountID:ae.account.id,descendant:!0,thread:ae.account.id===Q.account.id,weight:Xt(ae),replies:R(ae.__replies)}))];I("default"),G.current={offsetTop:(Re=x.current)==null?void 0:Re.offsetTop,scrollTop:(Ne=M.current)==null?void 0:Ne.scrollTop};const De=_e.findIndex(ae=>ae.id===t);De>=ne&&ye(De+1),_(_e),hn[t]=_e,io(Q,u)}catch{I("error")}})(),se.current=Date.now(),()=>{clearTimeout(B)}};X(Z,[t,p]);const[P,N]=L(!1);X(()=>{let E=setInterval(()=>{const B=Date.now();se.current&&B-se.current>=6e4&&N(!0)},6e4);return()=>{clearInterval(E)}},[]),vt(()=>{var B,K;if(!C.length)return;const E=fn[t];if(E)M.current.scrollTop=E;else if(G.current){const le={offsetTop:(B=x.current)==null?void 0:B.offsetTop,scrollTop:(K=M.current)==null?void 0:K.scrollTop},Ce=le.offsetTop-G.current.offsetTop+le.scrollTop;M.current.scrollTop=Ce}else C.length===1&&(M.current.scrollTop=0);G.current=null},[C]),X(()=>{y.reloadStatusPage<=0||(async()=>{try{const{instanceURL:E}=Yn(),B=`https://${E}/api/v1/statuses/${t}/context`;return await(await caches.open("api")).delete(B,{ignoreVary:!0}),Z({reloadHero:!0})}catch{}})()},[y.reloadStatusPage]),X(()=>()=>{fn={},A.reloadStatusPage=0,hn={},Hn={},jn.clear()},[]);const U=y.statuses[z]||y.statuses[t],Y=be(()=>{if(!U)return"";const{account:E}=U,B=document.createElement("div");return B.innerHTML=E.displayName,B.innerText.trim()},[U]),F=be(()=>{if(!U)return"";let E=Jn(U);return E.length>64&&(E=E.slice(0,64)+"โ€ฆ"),E},[U]);Ke(Y&&F?`${Y}: "${F}"`:g._({id:"y28hnO"}),"/:instance?/s/:id");const ie=be(()=>{if(!U)return;const{url:E}=U;if(E)return URL.parse(E).hostname},[U]),O=be(()=>{if(ie)return ie===u},[ie,u]),[ne,ye]=L(ln),ee=be(()=>C.length-ne,[C.length,ne]),fe=C.some(E=>E.descendant),ve=C.filter(E=>E.ancestor),[pe,we]=L(!0),$e=be(()=>{if(!x.current||pe)return null;const{top:E}=x.current.getBoundingClientRect();return E>0?"down":"up"},[pe]);Ue("esc",()=>{location.hash=n},{enabled:!d,ignoreEventWhen:E=>!!document.querySelector("#modal-container > *")}),Ue("backspace",()=>{location.hash=n}),Ue("j",()=>{const E=document.activeElement.closest(".status-link, .status-focus"),B=E==null?void 0:E.getBoundingClientRect(),K=Array.from(M.current.querySelectorAll(qi));if(E&&B.top0){const le=K.indexOf(E);let Ce=K[le+1];Ce&&(Ce.focus(),Ce.scrollIntoView(Kt))}else{const le=K.find(Ce=>{const We=Ce.getBoundingClientRect();return We.top>=44&&We.left>=0});le&&(le.focus(),le.scrollIntoView(Kt))}}),Ue("k",()=>{const E=document.activeElement.closest(".status-link, .status-focus"),B=E==null?void 0:E.getBoundingClientRect(),K=Array.from(M.current.querySelectorAll(qi));if(E&&B.top0){const le=K.indexOf(E);let Ce=K[le-1];Ce&&(Ce.focus(),Ce.scrollIntoView(Kt))}else{const le=K.find(Ce=>{const We=Ce.getBoundingClientRect();return We.top>=44&&We.left>=0});le&&(le.focus(),le.scrollIntoView(Kt))}}),Ue("x",()=>{const E=document.activeElement.closest(".status-link, .status-focus");if(E){const B=E.nextElementSibling;B&&B.tagName.toLowerCase()==="details"&&(B.open=!B.open)}});const[Me,xe]=L(!1),Ee=j(d?"media+status":"status"),Fe=it((E,B,K,le)=>{E.preventDefault(),E.stopPropagation(),o({media:B+1,mediaStatusID:le.id})},[t]),ke=it((E,B)=>{pn(B.id)},[]);X(()=>{let E;return f&&d&&(E=setTimeout(()=>{var K;const B=(K=M.current)==null?void 0:K.querySelector(`.status-link[href*="/${f}"]`);B&&B.scrollIntoView(Kt)},400)),()=>{clearTimeout(E)}},[f,d]);const J=it((E,B)=>{const{id:K,ancestor:le,isThread:Ce,descendant:We,thread:Q,replies:Re,repliesCount:Ne,weight:R}=E,V=K===t;return e("li",{ref:V?x:null,class:`${le?"ancestor":""} ${We?"descendant":""} ${Q?"thread":""} ${V?"hero":""}`,children:[V?e(q,{children:[e(yt,{threshold:.1,onChange:H=>{queueMicrotask(()=>{requestAnimationFrame(()=>{we(H)})})},class:"status-focus",tabIndex:0,children:e(qe,{statusID:K,instance:u,withinContext:!0,size:"l",enableTranslate:!0,forceTranslate:h})}),T!=="loading"&&!w?e("div",{class:"post-status-banner",children:[e("p",{children:e(l,{id:"Vyeh4F"})}),e(ue,{to:"/login",class:"button",children:e(l,{id:"sQia9P"})})]}):!k&&e("div",{class:"post-status-banner",children:[e("p",{children:e(l,{id:"j5roNG",values:{instance:u},components:{0:e("b",{})}})}),e("button",{type:"button",disabled:T==="loading",onClick:()=>{I("loading"),(async()=>{try{const H=await v.v2.search.fetch({q:U.url,type:"statuses",resolve:!0,limit:1});if(H.statuses.length){const te=H.statuses[0];location.hash=b?`/${b}/s/${te.id}`:`/s/${te.id}`}else throw new Error("No results")}catch(H){I("default"),alert(g._({id:"DnepCE",values:{e:H}}))}})()},children:[e(S,{icon:"transfer"})," ",e(l,{id:"ejAVrO"})]})]})]}):e(Kr,{linkable:Ce||le,to:u?`/${u}/s/${K}`:`/s/${K}`,onClick:()=>{pn(K)},children:[B===0&&le?e(yt,{threshold:.5,onChange:H=>{queueMicrotask(()=>{requestAnimationFrame(()=>{xe(H)})})},children:e(qe,{statusID:K,instance:u,withinContext:!0,size:Q||le?"m":"s",enableTranslate:!0,onMediaClick:Fe,onStatusLinkClick:ke})}):e(qe,{statusID:K,instance:u,withinContext:!0,size:Q||le?"m":"s",enableTranslate:!0,onMediaClick:Fe,onStatusLinkClick:ke,showActionsBar:!!We}),le&&Ne>1&&e("div",{class:"replies-link",children:[e(S,{icon:"comment2",alt:g._({id:"N8UzTV"})})," ",e("span",{title:Ne,children:Ve(Ne)})]})," "]}),We&&(Re==null?void 0:Re.length)>0&&e(js,{instance:u,replies:Re,hasParentThread:Q,level:1,accWeight:R,openAll:D.currentpn(K)}}),T==="loading"&&V&&!!(U!=null&&U.repliesCount)&&!fe&&e("div",{class:"status-loading",children:e(Le,{abrupt:U.repliesCount>=3})}),T==="error"&&V&&!!(U!=null&&U.repliesCount)&&!fe&&e("div",{class:"status-error",children:[e(l,{id:"HQJU6W"}),e("br",{}),e("button",{type:"button",class:"plain",onClick:()=>{A.reloadStatusPage++},children:e(l,{id:"KDw4GX"})})]})]},K)},[t,u,T,w,k,h,Fe,ke,fe]),me=be(()=>{var E;if("navigation"in window&&(navigation!=null&&navigation.entries)){const B=navigation.entries()[navigation.currentEntry.index-1];if(B!=null&&B.url)return Hi.test(B.url)}return Hi.test((E=A.prevLocation)==null?void 0:E.pathname)},[z]),Te=be(()=>{if(!ee)return[];const E=[];function B(K){E.push(K.id),K.replies&&K.replies.forEach(B)}return C.slice(ne).forEach(B),E.map(K=>st(K,u))},[ee,C,ne,u]),re=be(()=>C.slice(0,ne).map(J),[C,ne,J]);return X(()=>{let E=setTimeout(()=>{if(!x.current)return;const B=x.current.querySelector(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)");B&&B.click()},1e3);return()=>clearTimeout(E)},[t]),e("div",{tabIndex:"-1",ref:M,class:`status-deck deck contained ${C.length>1?"padded-bottom":""} ${Ee.current==="status"&&!c.current?"slide-in":""} ${r?`deck-view-${r}`:""}`,onAnimationEnd:E=>{Ee.current==="status"&&(Ee.current=null)},children:[e("header",{class:`${T==="loading"?"loading":""}`,onDblClick:E=>{A.reloadStatusPage++},children:e("div",{class:"header-grid header-grid-2",children:[e("h1",{children:[me&&e("button",{type:"button",class:"plain deck-back",onClick:()=>{history.back()},children:e(S,{icon:"chevron-left",size:"xl",alt:g._({id:"iH8pgl"})})}),!pe&&U&&T!=="loading"?e(q,{children:[e("span",{class:"hero-heading",children:[e(Ct,{account:U.account,instance:u,showAvatar:!0,short:!0})," ",e("span",{class:"insignificant",children:["โ€ข"," ",e(Vt,{datetime:U.createdAt,format:"micro"})]})]})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:E=>{E.preventDefault(),E.stopPropagation(),x.current.scrollIntoView({behavior:"smooth",block:"start"})},title:g._({id:"NCy+Nw"}),children:e(S,{icon:$e==="down"?"arrow-down":"arrow-up"})})]}):e(q,{children:["Post"," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:E=>{E.preventDefault(),E.stopPropagation(),M.current.scrollTo({top:0,behavior:"smooth"})},hidden:!ve.length||Me,title:g._({id:"R8CUl0",values:{0:ve.length}}),children:[e(S,{icon:"arrow-up"}),ve.filter((E,B,K)=>K.findIndex(le=>le.accountID===E.accountID)===B).slice(0,3).map(E=>e(lt,{url:E.account.avatar,alt:E.account.displayName},E.account.id)),ve.length>3&&e(q,{children:[" ",e("span",{class:"insignificant",children:Ve(ve.length)})]})]})]})]}),e("div",{class:"header-side",children:[e("button",{type:"button",class:"plain4 button-switch-view",style:{display:r==="full"?"":"none"},onClick:()=>{m(null),s.delete("media"),s.delete("media-only"),s.delete("view"),o(s)},title:g._({id:"+/xYEI"}),children:e(S,{icon:"layout4",size:"l"})}),P&&e("button",{type:"button",class:"plain button-refresh",onClick:()=>{A.reloadStatusPage++,N(!1)},children:e(S,{icon:"refresh",size:"l",alt:g._({id:"lCF0wC"})})}),e(ot,{align:"end",portal:{target:M.current},menuButton:e("button",{type:"button",class:"button plain4",children:e(S,{icon:"more",alt:g._({id:"2FYpfJ"}),size:"xl"})}),children:[e(ge,{disabled:T==="loading",onClick:()=>{A.reloadStatusPage++},children:[e(S,{icon:"refresh"}),e("span",{children:e(l,{id:"lCF0wC"})})]}),e(ge,{className:"menu-switch-view",onClick:()=>{m(r==="full"?null:"full"),s.delete("media"),s.delete("media-only"),r==="full"?s.delete("view"):s.set("view","full"),o(s)},children:[e(S,{icon:{"":"layout5",full:"layout4"}[r||""]}),e("span",{children:r==="full"?g._({id:"+/xYEI"}):g._({id:"2LiWsE"})})]}),e(ge,{onClick:()=>{Array.from(M.current.querySelectorAll(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)")).forEach(B=>{B.click()})},children:[e(S,{icon:"eye-open"})," ",e("span",{children:e(l,{id:"8r8KmB"})})]}),e(Ye,{}),e(ls,{className:"plain",children:e(l,{id:"Rsjgm0"})}),e(ge,{disabled:!ie||O,onClick:()=>{const E=xr(U.url);E?location.hash=E:alert(g._({id:"9J6biQ"}))},children:[e(S,{icon:"transfer"}),e("small",{class:"menu-double-lines",children:ie?g._({id:"Kp9SAs",values:{0:Gt.toUnicode(ie)}}):g._({id:"lb07+k"})})]})]}),e(ue,{class:"button plain deck-close",to:n,children:e(S,{icon:"x",size:"xl",alt:g._({id:"yz7wBu"})})})]})]})}),C.length&&U?e("ul",{class:`timeline flat contextual grow ${T==="loading"?"loading":""}`,children:[re,ee>0&&e("li",{children:e("button",{type:"button",class:"plain block show-more",disabled:T==="loading",onClick:()=>ye(E=>E+ln),style:{marginBlockEnd:"6em"},"data-state-post-ids":Te.join(" "),children:[e("div",{class:"ib avatars-bunch",children:C.slice(ne,ne+5).map(E=>e(lt,{url:E.account.avatarStatic},E.id))})," ",e("div",{class:"ib",children:[e(l,{id:"uXRAkV"})," ",e("span",{class:"tag",children:ee>ln?`${ln}+`:ee})]})]})})]}):e(q,{children:[T==="loading"&&e("ul",{class:"timeline flat contextual grow loading",children:e("li",{children:e(qe,{skeleton:!0,size:"l"})})}),T==="error"&&e("p",{class:"ui-state",children:[e(l,{id:"JWxodU"}),e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>{A.reloadStatusPage++},children:e(l,{id:"KDw4GX"})})]})]})]})}function js({replies:t,instance:n,hasParentThread:i,level:s,accWeight:o,openAll:a,parentLink:f}){const[d,c]=ut(),r=y=>y.reduce((C,_)=>{const{repliesCount:T,replies:I}=_,x=(I==null?void 0:I.length)||T;return C+x+r(I||[])},0),m=t.length+r(t),h=t.length===m,p=t.map(y=>y.account).filter((y,C,_)=>_.findIndex(T=>T.id===y.id)===C).slice(0,3),u=be(()=>t==null?void 0:t.reduce((y,C)=>y+(C==null?void 0:C.weight),o),[o,t==null?void 0:t.length]);let v=!1;(a||u<=Gr||!i&&m===1&&Xt(t[0])<2)&&(v=!0);const b=Hn[t[0].id],w=it((y,C,_,T)=>{y.preventDefault(),y.stopPropagation(),c({media:C+1,mediaStatusID:T.id})},[]),k=j();return vt(()=>{var C;function y(_){_.target.dataset.scrollLeft=_.target.scrollLeft}return(C=k.current)==null||C.addEventListener("scroll",y,{passive:!0}),()=>{var _;(_=k.current)==null||_.removeEventListener("scroll",y)}},[]),e("details",{ref:k,class:"replies",open:b||v,onToggle:y=>{const{open:C}=y.target;Hn[t[0].id]=C},style:{"--comments-level":s},"data-comments-level":s,"data-comments-level-overflow":s>4,children:[e("summary",{class:"replies-summary",hidden:v,children:[e("span",{class:"avatars",children:p.map(y=>e(lt,{url:y.avatarStatic,title:`${y.displayName} @${y.username}`,squircle:y==null?void 0:y.bot},y.id))}),e("span",{class:"replies-counts",children:[e("b",{children:e(l,{id:"DOQUen",values:{0:t.length,1:Ve(t.length)},components:{0:e("span",{title:t.length})}})}),!h&&m>1&&e(q,{children:[" ","ยท"," ",e("span",{children:e(l,{id:"qSQQSe",values:{0:Ve(m),totalComments:m},components:{0:e("span",{title:m})}})})]})]}),e(S,{icon:"chevron-down",class:"replies-summary-chevron"}),!!f&&e(ue,{class:"replies-parent-link",to:f.to,onClick:f.onClick,title:g._({id:"ZlV82A"}),children:"ยป"})]}),e("ul",{children:t.map(y=>{var C,_;return e("li",{children:[e("div",{class:"status-focus",tabIndex:0,children:[e(qe,{statusID:y.id,instance:n,withinContext:!0,size:"s",enableTranslate:!0,onMediaClick:w,showActionsBar:!0}),!((C=y.replies)!=null&&C.length)&&y.repliesCount>0&&e("div",{class:"replies-link",children:[e(S,{icon:"comment2",alt:g._({id:"N8UzTV"})})," ",e("span",{title:y.repliesCount,children:Ve(y.repliesCount)})]})]}),((_=y.replies)==null?void 0:_.length)&&e(js,{instance:n,replies:y.replies,level:s+1,accWeight:v?u:y.weight,openAll:a,parentLink:{to:n?`/${n}/s/${y.id}`:`/s/${y.id}`,onClick:()=>{pn(y.id)}}})]},y.id)})})]})}const Jr=140,Xr=35,Qr=70,el=140,jn=new Map;function Xt(t){var u,v;const n=jn.get(t.id);if(n)return n;const{spoilerText:i,content:s,mediaAttachments:o,poll:a,card:f}=t,d=rs(i+s),c=o!=null&&o.length?Jr:0,r=(((u=a==null?void 0:a.options)==null?void 0:u.length)||0)*Xr,m=f&&(o!=null&&o.length||(v=a==null?void 0:a.options)!=null&&v.length)?0:Qr,p=(d+c+r+m)/el;return jn.set(t.id,p),p}const tl=ct(Wr);function nl(){const t=Mt(),{id:n,instance:i}=t;return e(tl,{id:n,instance:i})}const il=""+new URL("boosts-carousel-YjmjXTE6.jpg",import.meta.url).href,sl=""+new URL("grouped-notifications-xYMFVY91.jpg",import.meta.url).href,ol=""+new URL("multi-column-ETnJNDVb.jpg",import.meta.url).href,cl=""+new URL("multi-hashtag-timeline-x-SDVR4g.jpg",import.meta.url).href,al=""+new URL("nested-comments-thread-Ib-fZGS3.jpg",import.meta.url).href,rl="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",ll={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:Zt,PHANPY_WEBSITE:ji,PHANPY_PRIVACY_POLICY_URL:dl,PHANPY_DEFAULT_INSTANCE_REGISTRATION_URL:Yi}=ll,Vi=ji?ji.replace(/https?:\/\//g,"").replace(/\/$/,""):null,Gi=`${"2024-08-31T13:00:46.020Z".slice(0,10).replace(/-/g,".")}.1b8ab47`;function Wi(){return Ke(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:ii,alt:"",width:"160",height:"160",style:{aspectRatio:"1/1",marginBlockEnd:-16}}),e("img",{src:rl,alt:"Phanpy",width:"200"})]}),e("p",{class:"desc",children:e(l,{id:"Ogtv0V"})}),e("p",{children:e(ue,{to:Zt?`/login?instance=${Zt}&submit=1`:"/login",class:"button",children:Zt?g._({id:"sQia9P"}):g._({id:"ZLoGls"})})}),Zt&&Yi&&e("p",{children:e("a",{href:Yi,class:"button plain5",children:e(l,{id:"e+RpCP"})})}),!Zt&&e("p",{class:"insignificant",children:e("small",{children:e(l,{id:"fvAsUK",components:{0:e("br",{})}})})})]}),(Vi||Gi)&&e("p",{class:"app-site-version",children:e("small",{children:[Vi," ",Gi]})}),e("p",{children:e(l,{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:dl,target:"_blank"})}})}),e("div",{children:e(si,{})})]}),e("div",{id:"why-container",children:e("div",{class:"sections",children:[e("section",{children:[e("img",{src:il,alt:g._({id:"S5cYrQ"}),loading:"lazy"}),e("h4",{children:e(l,{id:"Tu+sCN"})}),e("p",{children:e(l,{id:"e2uVlo"})})]}),e("section",{children:[e("img",{src:al,alt:g._({id:"CGQ27z"}),loading:"lazy"}),e("h4",{children:e(l,{id:"cYE45+"})}),e("p",{children:e(l,{id:"Pc7QKh"})})]}),e("section",{children:[e("img",{src:sl,alt:g._({id:"rnrM7k"}),loading:"lazy"}),e("h4",{children:e(l,{id:"4RRMre"})}),e("p",{children:e(l,{id:"8GMtDr"})})]}),e("section",{children:[e("img",{src:ol,alt:g._({id:"VLKtvP"}),loading:"lazy"}),e("h4",{children:e(l,{id:"pEkad9"})}),e("p",{children:e(l,{id:"t7Py5R"})})]}),e("section",{children:[e("img",{src:cl,alt:g._({id:"wOax6E"}),loading:"lazy"}),e("h4",{children:e(l,{id:"Wi1Ov0"})}),e("p",{children:e(l,{id:"tS2i+h"})})]})]})})]})}const ul=window.alert;window.__nativeAlert||(window.__nativeAlert=ul);window.alert=function(t){t instanceof Error&&(t!=null&&t.message)&&(t=t.message),typeof t!="string"&&(t=JSON.stringify(t));const n=xo({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}=ce();for(const a in t){if(!window.__IDLE__)break;try{const f=document.querySelector(`[data-state-post-id~="${a}"], [data-state-post-ids~="${a}"]`),d=i.some(c=>{var r;return a===st((r=c.status)==null?void 0:r.id,o)});if(!f&&!d){delete A.statuses[a],delete A.statusQuotes[a];for(const c in n){const r=n[c];if(st(r.id,r.instance)===a){delete A.unfurledLinks[c];break}}s++}}catch{}}},15*60*1e3);setTimeout(()=>{for(const t in Ot)setTimeout(()=>{var n,i,s,o,a,f;Array.isArray(Ot[t])?(i=(n=Ot[t])[0])==null||i.call(n):typeof Ot[t]=="object"?(o=(s=Ot[t]).module)==null||o.call(s):(f=(a=Ot)[t])==null||f.call(a)},1)},5e3);(()=>{window.__IDLE__=!0;const t=["mousemove","mousedown","resize","keydown","touchstart","pointerdown","pointermove","wheel"],n=()=>{window.__IDLE__=!0},s=ds(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 hl=/iPad|iPhone|iPod/.test(navigator.userAgent);hl&&document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible"){const t=he.local.get("theme");let n;if(t){if(n=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),n){const i=n.content,s=t==="light"?n.dataset.themeLightColorTemp:n.dataset.themeDarkColorTemp;n.content=s||"",setTimeout(()=>{n.content=i},10)}}else{const i=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(n=document.querySelector(`meta[name="theme-color"][media*="${i}"]`),n){const s=n.dataset.content,o=n.dataset.contentTemp;n.content=o||"",setTimeout(()=>{n.content=s},10)}}}});{const t=he.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=he.local.get("textSize");n&&document.documentElement.style.setProperty("--text-size",`${n}px`)}Ji(A,t=>{var n;for(const[i,s,o,a]of t){if(s.join(".")==="settings.shortcutsViewMode"){const f=document.getElementById("app");f&&(f.dataset.shortcutsViewMode=(n=A.shortcuts)!=null&&n.length?o:"")}s.join(".")==="settings.cloakMode"&&document.body.classList.toggle("cloak",o)}});function fl(){const[t,n]=L(!1),[i,s]=L("loading");Xe(),X(()=>{const a=he.local.get("instanceURL"),f=decodeURIComponent((window.location.search.match(/code=([^&]+)/)||[,""])[1]);if(f){window.history.replaceState({},document.title,window.location.pathname||"/");const d=he.sessionCookie.get("clientID"),c=he.sessionCookie.get("clientSecret"),r=he.sessionCookie.get("vapidKey"),m=he.sessionCookie.get("codeVerifier");(async()=>{s("loading");const{access_token:h}=await qr({instanceURL:a,client_id:d,client_secret:c,code:f,code_verifier:m||void 0});if(h){const p=so({instance:a,accessToken:h});await Promise.allSettled([fi(p),pi(p,a),oo(p,a,h,r)]),mi(),window.__IGNORE_GET_ACCOUNT_ERROR__=!0,n(!0),s("default")}else s("error")})()}else{window.__IGNORE_GET_ACCOUNT_ERROR__=!0;const d=decodeURIComponent((window.location.search.match(/account=([^&]+)/)||[,""])[1]);let c;if(d&&(c=co(d),c&&(mn(c.info.id),window.history.replaceState({},document.title,window.location.pathname||"/"))),c||(c=Yn()),c){mn(c.info.id);const{client:r}=ce({account:c}),{instance:m}=r;mi(),s("loading"),(async()=>{try{await fi(r),await pi(r,m)}catch{}finally{n(!0),s("default")}})()}else s("default")}he.sessionCookie.del("clientID"),he.sessionCookie.del("clientSecret"),he.sessionCookie.del("codeVerifier")},[]);let o=Yt();return A.currentLocation=o.pathname,X(Un,[o,t]),/\/https?:/.test(o.pathname)?e(Ar,{}):e(q,{children:[e(pl,{isLoggedIn:t,loading:i==="loading"}),e(ml,{isLoggedIn:t}),i==="default"&&e(Gn,{children:e(je,{path:"/:instance?/s/:id",element:e(nl,{})})}),t&&e(Lo,{}),t&&e(ia,{}),e(Zc,{}),t&&e(ea,{}),e(Ro,{isLoggedIn:t}),i!=="loading"&&e(ta,{onClose:Un}),e($o,{})]})}function pl({isLoggedIn:t,loading:n}){const i=Yt(),s=be(()=>{const{pathname:o}=i;return!/^\/(login|welcome)/i.test(o)},[i]);return e(Gn,{location:s||i,children:[e(je,{path:"/",element:t?e(Ir,{}):n?e(Le,{id:"loader-root"}):e(Wi,{})}),e(je,{path:"/login",element:e(Yr,{})}),e(je,{path:"/welcome",element:e(Wi,{})})]})}function Ki(){return A.prevLocation||null}function ml({isLoggedIn:t}){const n=Yt(),i=j(Ki());return be(()=>Qt("/:instance/s/:id",n.pathname)||Qt("/s/:id",n.pathname),[n.pathname,Qt])?i.current||(i.current=Ki()):i.current=null,e(Gn,{location:i.current||n,children:[t&&e(q,{children:[e(je,{path:"/notifications",element:e(zs,{})}),e(je,{path:"/mentions",element:e(Ds,{})}),e(je,{path:"/following",element:e(ui,{})}),e(je,{path:"/b",element:e(xs,{})}),e(je,{path:"/f",element:e(As,{})}),e(je,{path:"/l",children:[e(je,{index:!0,element:e(Er,{})}),e(je,{path:":id",element:e(Ls,{})})]}),e(je,{path:"/fh",element:e(ja,{})}),e(je,{path:"/ft",element:e(Fa,{})}),e(je,{path:"/catchup",element:e(Aa,{})})]}),e(je,{path:"/:instance?/t/:hashtag",element:e(Rs,{})}),e(je,{path:"/:instance?/a/:id",element:e(ya,{})}),e(je,{path:"/:instance?/p",children:[e(je,{index:!0,element:e(qn,{})}),e(je,{path:"l",element:e(qn,{local:!0})})]}),e(je,{path:"/:instance?/trending",element:e(Bs,{})}),e(je,{path:"/:instance?/search",element:e(Us,{})})]})}ao();uo(e(ro,{i18n:g,children:e(lo,{children:e(fl,{})})}),document.getElementById("app"));setTimeout(()=>{try{Object.keys(localStorage).forEach(t=>{t.startsWith("iconify")&&localStorage.removeItem(t)}),Object.keys(sessionStorage).forEach(t=>{t.startsWith("iconify")&&sessionStorage.removeItem(t)}),localStorage.removeItem("settings:boostsCarousel")}catch{}},5e3);window.__CLOAK__=()=>{document.body.classList.toggle("cloak")}; //# sourceMappingURL=main-kbQH2PR3.js.map